Skip to content

Commit

Permalink
Don't ask for needless 32 <= Semantics.width
Browse files Browse the repository at this point in the history
As Jade pointed out in
#929 (comment),
it's not needed.
  • Loading branch information
JasonGross committed Apr 15, 2021
1 parent 7b6e733 commit a204ed3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/Bedrock/Field/Interface/Representation.v
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ Require Import Crypto.Util.ZUtil.Tactics.ZeroBounds.

Section Representation.
Context {p : Types.parameters} {field_parameters : FieldParameters}
{p_ok : Types.ok}
(width_ge_32 : 32 <= Semantics.width).
{p_ok : Types.ok}.
Context (n : nat) (weight : nat -> Z)
(loose_bounds tight_bounds : list (option zrange))
(relax_bounds :
Expand Down Expand Up @@ -74,7 +73,7 @@ Section Representation.
{ match goal with
| H : Array.array _ _ _ _ _ |- _ =>
eapply Bignum_of_bytes with (n0:=n) in H;
[ destruct H | nia.. ]
[ destruct H | (idtac + destruct Semantics.width_cases); nia.. ]
end.
eexists; eauto. }
{
Expand Down
9 changes: 6 additions & 3 deletions src/Bedrock/Field/Synthesis/Generic/Bignum.v
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ Section Bignum.
sep (emp (length x = n_bytes)) (array ptsto (word.of_Z 1) px x).

Section Proofs.
Context {ok : Types.ok}
(width_ge_32 : 32 <= Semantics.width).
Context {ok : Types.ok}.
Existing Instance semantics_ok.

(* TODO: factor this proof into a more general form that says if subarrays
Expand All @@ -51,7 +50,11 @@ Section Bignum.
cbn [array length] in *. sepsimpl; eauto. }
{ rewrite <-(firstn_skipn (Z.to_nat word_size_in_bytes) bs).
rewrite array_append.
rewrite Scalars.scalar_of_bytes with (l:=List.firstn _ _); try assumption.
rewrite Scalars.scalar_of_bytes with (l:=List.firstn _ _);
lazymatch goal with
| [ |- _ <= Semantics.width ] => destruct Semantics.width_cases; lia
| _ => idtac
end.
2:{
rewrite word_size_in_bytes_eq in *.
etransitivity;
Expand Down

0 comments on commit a204ed3

Please sign in to comment.