aboutsummaryrefslogtreecommitdiff
path: root/src/Arithmetic/Saturated.v
diff options
context:
space:
mode:
authorGravatar jadep <jade.philipoom@gmail.com>2017-06-18 15:08:55 -0400
committerGravatar jadep <jade.philipoom@gmail.com>2017-06-18 15:08:55 -0400
commitd0c486b975064d30e6fe88baca1f4a9f26ba9fb5 (patch)
tree9e950d879fdc06a58a1b55f36522b48dc6cf606f /src/Arithmetic/Saturated.v
parent30d96c047e7afe6bd1b3b84ab6532ebf1d7c5aa1 (diff)
proved eval_drop_high
Diffstat (limited to 'src/Arithmetic/Saturated.v')
-rw-r--r--src/Arithmetic/Saturated.v16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/Arithmetic/Saturated.v b/src/Arithmetic/Saturated.v
index 7b42c31e7..23c80675c 100644
--- a/src/Arithmetic/Saturated.v
+++ b/src/Arithmetic/Saturated.v
@@ -934,10 +934,22 @@ Section API.
destruct pred_nm; autorewrite with push_basesystem_eval;
rewrite Z.div_small; omega.
Qed.
-
+
+ Lemma small_left_tl n (v:T (S n)) : small v -> small (left_tl v).
+ Proof. cbv [small]. auto using In_to_list_left_tl. Qed.
+
Lemma eval_drop_high n v :
small v -> eval (@drop_high n v) = eval v mod (uweight bound n).
- Admitted.
+ Proof.
+ cbv [drop_high drop_high_cps eval].
+ rewrite Tuple.left_tl_cps_correct, push_id. (* TODO : for some reason autorewrite with uncps doesn't work here *)
+ intro H. apply small_left_tl in H.
+ rewrite (subst_left_append v) at 2.
+ autorewrite with push_basesystem_eval.
+ apply eval_small in H.
+ rewrite Z.mod_add_l' by (pose_uweight bound; auto).
+ rewrite Z.mod_small; auto.
+ Qed.
Lemma eval_scmul n a v: eval (@scmul n a v) = a * eval v.
Proof.