blob: f3f8d448212b454d25323a5f448b7b7830163219 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
Require Export Crypto.Specific.GF25519Reflective.Common.
Require Import Crypto.Specific.GF25519BoundedCommon.
Require Import Crypto.Reflection.Z.Interpretations64.
Require Import Crypto.Reflection.Syntax.
Require Import Crypto.Reflection.SmartMap.
Require Import Crypto.Reflection.Application.
Require Import Crypto.Util.Tactics.
Local Opaque Interp.
Lemma ExprBinOp_correct_and_bounded
ropW op (ropZ_sig : rexpr_binop_sig op)
(Hbounds : correct_and_bounded_genT ropW ropZ_sig)
(H0 : forall xy
(xy := (eta_fe25519W (fst xy), eta_fe25519W (snd xy)))
(Hxy : is_bounded (fe25519WToZ (fst xy)) = true
/\ is_bounded (fe25519WToZ (snd xy)) = true),
let Hx := let (Hx, Hy) := Hxy in Hx in
let Hy := let (Hx, Hy) := Hxy in Hy in
let args := binop_args_to_bounded xy Hx Hy in
match LiftOption.of'
(ApplyInterpedAll (Interp (@BoundedWordW.interp_op) ropW)
(LiftOption.to' (Some args)))
with
| Some _ => True
| None => False
end)
(H1 : forall xy
(xy := (eta_fe25519W (fst xy), eta_fe25519W (snd xy)))
(Hxy : is_bounded (fe25519WToZ (fst xy)) = true
/\ is_bounded (fe25519WToZ (snd xy)) = true),
let Hx := let (Hx, Hy) := Hxy in Hx in
let Hy := let (Hx, Hy) := Hxy in Hy in
let args := binop_args_to_bounded (fst xy, snd xy) Hx Hy in
let x' := SmartVarfMap (fun _ : base_type => BoundedWordW.BoundedWordToBounds) args in
match LiftOption.of'
(ApplyInterpedAll (Interp (@ZBounds.interp_op) ropW) (LiftOption.to' (Some x')))
with
| Some bounds => binop_bounds_good bounds = true
| None => False
end)
: binop_correct_and_bounded ropW op.
Proof.
intros x y Hx Hy.
pose x as x'; pose y as y'.
hnf in x, y; destruct_head' prod.
specialize (H0 (x', y') (conj Hx Hy)).
specialize (H1 (x', y') (conj Hx Hy)).
let args := constr:(binop_args_to_bounded (x', y') Hx Hy) in
t_correct_and_bounded ropZ_sig Hbounds H0 H1 args.
Qed.
|