diff options
author | Jason Gross <jgross@mit.edu> | 2017-04-01 23:22:35 -0400 |
---|---|---|
committer | Jason Gross <jgross@mit.edu> | 2017-04-01 23:22:35 -0400 |
commit | eebd184a88d1dad3163bb8db63187bce9300a1ab (patch) | |
tree | d92a3f9f9560d4ec02458bb77bffdc9edc0ff887 /src/Specific | |
parent | 68aca8687cd62127eb1dafa2029e59d38db68f3d (diff) |
Add an initial glue file in the pipeline, no option in bounds
We can do bounds analysis without options.
Also, add some tactics from another branch for the glue to start the
reflective pipeline.
Diffstat (limited to 'src/Specific')
-rw-r--r-- | src/Specific/IntegrationTest.v | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/Specific/IntegrationTest.v b/src/Specific/IntegrationTest.v index e37dacdb7..1e62937df 100644 --- a/src/Specific/IntegrationTest.v +++ b/src/Specific/IntegrationTest.v @@ -10,6 +10,8 @@ Require Import Crypto.ModularArithmetic.PrimeFieldTheorems. Require Import Crypto.Util.Tuple Crypto.Util.Sigma Crypto.Util.Notations Crypto.Util.ZRange Crypto.Util.BoundedWord. Import ListNotations. +Require Import Crypto.Reflection.Z.Bounds.Pipeline.Glue. + Section BoundedField25p5. Local Coercion Z.of_nat : nat >-> Z. @@ -35,16 +37,24 @@ Section BoundedField25p5. fun x => B.Positional.Fdecode wt (BoundedWordToZ _ _ _ x). (* TODO : change this to field once field isomorphism happens *) - Definition mul : - { mul : feBW -> feBW -> feBW - | forall a b, phi (mul a b) = (phi a * phi b)%F }. + Definition add : + { add : feBW -> feBW -> feBW + | forall a b, phi (add a b) = F.add (phi a) (phi b) }. Proof. - eexists ?[mul]; intros. cbv [phi]. - rewrite <- (proj2_sig mul_sig). - set (mulZ := proj1_sig mul_sig). - cbv beta iota delta [proj1_sig mul_sig runtime_add runtime_and runtime_mul runtime_opp runtime_shr] in mulZ. + lazymatch goal with + | [ |- { f | forall a b, ?phi (f a b) = @?rhs a b } ] + => apply lift2_sig with (P:=fun a b f => phi f = rhs a b) + end. + intros. eexists ?[add]. cbv [phi]. + rewrite <- (proj2_sig add_sig). + symmetry; rewrite <- (proj2_sig carry_sig); symmetry. + set (carry_addZ := fun a b => proj1_sig carry_sig (proj1_sig add_sig a b)). + change (proj1_sig carry_sig (proj1_sig add_sig ?a ?b)) with (carry_addZ a b). + cbv beta iota delta [proj1_sig add_sig carry_sig runtime_add runtime_and runtime_mul runtime_opp runtime_shr sz] in carry_addZ. + cbn beta iota delta [fst snd] in carry_addZ. apply f_equal. (* jgross start here! *) + (*refine_to_reflective_glue.*) Admitted. |