From 0b03656ba15c354165ee14eda054de4489faeb9c Mon Sep 17 00:00:00 2001 From: Jason Gross Date: Sat, 14 Oct 2017 16:01:37 -0400 Subject: Run remake_curves.py --- .../montgomery64_2e152m17/CurveParameters.v | 34 ++++++++++++++++++++++ src/Specific/montgomery64_2e152m17/Synthesis.v | 9 ++++++ src/Specific/montgomery64_2e152m17/compiler.sh | 4 +++ src/Specific/montgomery64_2e152m17/feadd.v | 14 +++++++++ src/Specific/montgomery64_2e152m17/feaddDisplay.v | 4 +++ src/Specific/montgomery64_2e152m17/femul.v | 14 +++++++++ src/Specific/montgomery64_2e152m17/femulDisplay.v | 4 +++ src/Specific/montgomery64_2e152m17/fenz.v | 16 ++++++++++ src/Specific/montgomery64_2e152m17/fenzDisplay.v | 4 +++ src/Specific/montgomery64_2e152m17/feopp.v | 14 +++++++++ src/Specific/montgomery64_2e152m17/feoppDisplay.v | 4 +++ src/Specific/montgomery64_2e152m17/fesub.v | 14 +++++++++ src/Specific/montgomery64_2e152m17/fesubDisplay.v | 4 +++ 13 files changed, 139 insertions(+) create mode 100644 src/Specific/montgomery64_2e152m17/CurveParameters.v create mode 100644 src/Specific/montgomery64_2e152m17/Synthesis.v create mode 100755 src/Specific/montgomery64_2e152m17/compiler.sh create mode 100644 src/Specific/montgomery64_2e152m17/feadd.v create mode 100644 src/Specific/montgomery64_2e152m17/feaddDisplay.v create mode 100644 src/Specific/montgomery64_2e152m17/femul.v create mode 100644 src/Specific/montgomery64_2e152m17/femulDisplay.v create mode 100644 src/Specific/montgomery64_2e152m17/fenz.v create mode 100644 src/Specific/montgomery64_2e152m17/fenzDisplay.v create mode 100644 src/Specific/montgomery64_2e152m17/feopp.v create mode 100644 src/Specific/montgomery64_2e152m17/feoppDisplay.v create mode 100644 src/Specific/montgomery64_2e152m17/fesub.v create mode 100644 src/Specific/montgomery64_2e152m17/fesubDisplay.v (limited to 'src/Specific/montgomery64_2e152m17') diff --git a/src/Specific/montgomery64_2e152m17/CurveParameters.v b/src/Specific/montgomery64_2e152m17/CurveParameters.v new file mode 100644 index 000000000..d80db4404 --- /dev/null +++ b/src/Specific/montgomery64_2e152m17/CurveParameters.v @@ -0,0 +1,34 @@ +Require Import Crypto.Specific.Framework.RawCurveParameters. +Require Import Crypto.Util.LetIn. + +(*** +Modulus : 2^152 - 17 +Base: 64 +***) + +Definition curve : CurveParameters := + {| + sz := 2%nat; + bitwidth := 64; + s := 2^152; + c := [(1, 17)]; + carry_chains := None; + + a24 := None; + coef_div_modulus := None; + + goldilocks := Some false; + montgomery := true; + + mul_code := None; + + square_code := None; + + upper_bound_of_exponent := None; + allowable_bit_widths := None; + freeze_extra_allowable_bit_widths := None; + modinv_fuel := None + |}. + +Ltac extra_prove_mul_eq _ := idtac. +Ltac extra_prove_square_eq _ := idtac. diff --git a/src/Specific/montgomery64_2e152m17/Synthesis.v b/src/Specific/montgomery64_2e152m17/Synthesis.v new file mode 100644 index 000000000..660d4d245 --- /dev/null +++ b/src/Specific/montgomery64_2e152m17/Synthesis.v @@ -0,0 +1,9 @@ +Require Import Crypto.Specific.Framework.SynthesisFramework. +Require Import Crypto.Specific.montgomery64_2e152m17.CurveParameters. + +Module P <: PrePackage. + Definition package : Tag.Context. + Proof. make_Synthesis_package curve extra_prove_mul_eq extra_prove_square_eq. Defined. +End P. + +Module Export S := PackageSynthesis P. diff --git a/src/Specific/montgomery64_2e152m17/compiler.sh b/src/Specific/montgomery64_2e152m17/compiler.sh new file mode 100755 index 000000000..518f95765 --- /dev/null +++ b/src/Specific/montgomery64_2e152m17/compiler.sh @@ -0,0 +1,4 @@ +#!/bin/sh +set -eu + +gcc -fno-peephole2 `#GCC BUG 81300` -march=native -mtune=native -std=gnu11 -O3 -flto -fomit-frame-pointer -fwrapv -Wno-attributes -Wno-incompatible-pointer-types -fno-strict-aliasing "$@" diff --git a/src/Specific/montgomery64_2e152m17/feadd.v b/src/Specific/montgomery64_2e152m17/feadd.v new file mode 100644 index 000000000..3eb15cbd2 --- /dev/null +++ b/src/Specific/montgomery64_2e152m17/feadd.v @@ -0,0 +1,14 @@ +Require Import Crypto.Arithmetic.PrimeFieldTheorems. +Require Import Crypto.Specific.montgomery64_2e152m17.Synthesis. + +(* TODO : change this to field once field isomorphism happens *) +Definition add : + { add : feBW_small -> feBW_small -> feBW_small + | forall a b, phiM_small (add a b) = F.add (phiM_small a) (phiM_small b) }. +Proof. + Set Ltac Profiling. + Time synthesize_add (). + Show Ltac Profile. +Time Defined. + +Print Assumptions add. diff --git a/src/Specific/montgomery64_2e152m17/feaddDisplay.v b/src/Specific/montgomery64_2e152m17/feaddDisplay.v new file mode 100644 index 000000000..7a603d0b1 --- /dev/null +++ b/src/Specific/montgomery64_2e152m17/feaddDisplay.v @@ -0,0 +1,4 @@ +Require Import Crypto.Specific.montgomery64_2e152m17.feadd. +Require Import Crypto.Specific.Framework.IntegrationTestDisplayCommon. + +Check display add. diff --git a/src/Specific/montgomery64_2e152m17/femul.v b/src/Specific/montgomery64_2e152m17/femul.v new file mode 100644 index 000000000..b61e84f27 --- /dev/null +++ b/src/Specific/montgomery64_2e152m17/femul.v @@ -0,0 +1,14 @@ +Require Import Crypto.Arithmetic.PrimeFieldTheorems. +Require Import Crypto.Specific.montgomery64_2e152m17.Synthesis. + +(* TODO : change this to field once field isomorphism happens *) +Definition mul : + { mul : feBW_small -> feBW_small -> feBW_small + | forall a b, phiM_small (mul a b) = F.mul (phiM_small a) (phiM_small b) }. +Proof. + Set Ltac Profiling. + Time synthesize_mul (). + Show Ltac Profile. +Time Defined. + +Print Assumptions mul. diff --git a/src/Specific/montgomery64_2e152m17/femulDisplay.v b/src/Specific/montgomery64_2e152m17/femulDisplay.v new file mode 100644 index 000000000..42d75752f --- /dev/null +++ b/src/Specific/montgomery64_2e152m17/femulDisplay.v @@ -0,0 +1,4 @@ +Require Import Crypto.Specific.montgomery64_2e152m17.femul. +Require Import Crypto.Specific.Framework.IntegrationTestDisplayCommon. + +Check display mul. diff --git a/src/Specific/montgomery64_2e152m17/fenz.v b/src/Specific/montgomery64_2e152m17/fenz.v new file mode 100644 index 000000000..5fa15d88a --- /dev/null +++ b/src/Specific/montgomery64_2e152m17/fenz.v @@ -0,0 +1,16 @@ +Require Import Coq.ZArith.ZArith. +Require Import Crypto.Arithmetic.PrimeFieldTheorems. +Require Import Crypto.Specific.montgomery64_2e152m17.Synthesis. +Local Open Scope Z_scope. + +(* TODO : change this to field once field isomorphism happens *) +Definition nonzero : + { nonzero : feBW_small -> BoundedWord.BoundedWord 1 adjusted_bitwidth bound1 + | forall a, (BoundedWord.BoundedWordToZ _ _ _ (nonzero a) =? 0) = (if Decidable.dec (phiM_small a = F.of_Z m 0) then true else false) }. +Proof. + Set Ltac Profiling. + Time synthesize_nonzero (). + Show Ltac Profile. +Time Defined. + +Print Assumptions nonzero. diff --git a/src/Specific/montgomery64_2e152m17/fenzDisplay.v b/src/Specific/montgomery64_2e152m17/fenzDisplay.v new file mode 100644 index 000000000..7532a7e20 --- /dev/null +++ b/src/Specific/montgomery64_2e152m17/fenzDisplay.v @@ -0,0 +1,4 @@ +Require Import Crypto.Specific.montgomery64_2e152m17.fenz. +Require Import Crypto.Specific.Framework.IntegrationTestDisplayCommon. + +Check display nonzero. diff --git a/src/Specific/montgomery64_2e152m17/feopp.v b/src/Specific/montgomery64_2e152m17/feopp.v new file mode 100644 index 000000000..fc6ac48e9 --- /dev/null +++ b/src/Specific/montgomery64_2e152m17/feopp.v @@ -0,0 +1,14 @@ +Require Import Crypto.Arithmetic.PrimeFieldTheorems. +Require Import Crypto.Specific.montgomery64_2e152m17.Synthesis. + +(* TODO : change this to field once field isomorphism happens *) +Definition opp : + { opp : feBW_small -> feBW_small + | forall a, phiM_small (opp a) = F.opp (phiM_small a) }. +Proof. + Set Ltac Profiling. + Time synthesize_opp (). + Show Ltac Profile. +Time Defined. + +Print Assumptions opp. diff --git a/src/Specific/montgomery64_2e152m17/feoppDisplay.v b/src/Specific/montgomery64_2e152m17/feoppDisplay.v new file mode 100644 index 000000000..fbc2835be --- /dev/null +++ b/src/Specific/montgomery64_2e152m17/feoppDisplay.v @@ -0,0 +1,4 @@ +Require Import Crypto.Specific.montgomery64_2e152m17.feopp. +Require Import Crypto.Specific.Framework.IntegrationTestDisplayCommon. + +Check display opp. diff --git a/src/Specific/montgomery64_2e152m17/fesub.v b/src/Specific/montgomery64_2e152m17/fesub.v new file mode 100644 index 000000000..164b4e75e --- /dev/null +++ b/src/Specific/montgomery64_2e152m17/fesub.v @@ -0,0 +1,14 @@ +Require Import Crypto.Arithmetic.PrimeFieldTheorems. +Require Import Crypto.Specific.montgomery64_2e152m17.Synthesis. + +(* TODO : change this to field once field isomorphism happens *) +Definition sub : + { sub : feBW_small -> feBW_small -> feBW_small + | forall a b, phiM_small (sub a b) = F.sub (phiM_small a) (phiM_small b) }. +Proof. + Set Ltac Profiling. + Time synthesize_sub (). + Show Ltac Profile. +Time Defined. + +Print Assumptions sub. diff --git a/src/Specific/montgomery64_2e152m17/fesubDisplay.v b/src/Specific/montgomery64_2e152m17/fesubDisplay.v new file mode 100644 index 000000000..235c1cc4a --- /dev/null +++ b/src/Specific/montgomery64_2e152m17/fesubDisplay.v @@ -0,0 +1,4 @@ +Require Import Crypto.Specific.montgomery64_2e152m17.fesub. +Require Import Crypto.Specific.Framework.IntegrationTestDisplayCommon. + +Check display sub. -- cgit v1.2.3