| 1 |
(* Proofs shared by Wf and Proofs *) |
| 2 |
From Coq Require Import Morphisms. |
| 3 |
From Coq Require Import Relations. |
| 4 |
Require Import Crypto.Util.ZRange. |
| 5 |
Require Import Crypto.Util.Option. |
| 6 |
Require Import Crypto.Util.ListUtil. |
| 7 |
Require Import Crypto.Util.ListUtil.FoldBool. |
| 8 |
Require Import Crypto.Util.NatUtil. |
| 9 |
Require Import Crypto.Util.ZUtil.Morphisms. |
| 10 |
Require Import Crypto.Util.Tactics.BreakMatch. |
| 11 |
Require Import Crypto.Util.Tactics.DestructHead. |
| 12 |
Require Import Crypto.Util.Tactics.DoWithHyp. |
| 13 |
Require Import Crypto.AbstractInterpretation.ZRange. |
| 14 |
|
| 15 |
Module Compilers. |
| 16 |
Import AbstractInterpretation.ZRange.Compilers. |
| 17 |
Export ZRange.Settings. |
| 18 |
|
| 19 |
Module ZRange. |
| 20 |
Module ident. |
| 21 |
Module option. |
| 22 |
Section interp_related. |
| 23 |
Context {shiftr_avoid_uint1 : shiftr_avoid_uint1_opt} |
| 24 |
(assume_cast_truncates : bool). |
| 25 |
Global Instance interp_Proper {t} : Proper (eq ==> @type.eqv t) (ZRange.ident.option.interp assume_cast_truncates). |
| 26 |
Proof using Type. |
| 27 |
intros idc idc' ?; subst idc'. |
| 28 |
cbv [type.related respectful type.interp]; destruct idc; |
| 29 |
repeat first [ reflexivity |
| 30 |
| progress subst |
| 31 |
| progress cbn [ZRange.type.base.option.interp ZRange.type.base.interp base.interp base.base_interp Crypto.Util.Option.bind] in * |
| 32 |
| progress cbv [Crypto.Util.Option.bind] |
| 33 |
| intro |
| 34 |
| progress destruct_head'_prod |
| 35 |
| progress destruct_head'_bool |
| 36 |
| progress destruct_head' option |
| 37 |
| progress inversion_option |
| 38 |
| discriminate |
| 39 |
| solve [ eauto ] |
| 40 |
| apply (@list_rect_Proper_gen _ ((_ -> _) -> _ -> _ -> _ -> _ -> _) ((eq ==> eq) ==> eq ==> eq ==> eq ==> eq ==> eq)%signature) |
| 41 |
| apply (@list_rect_Proper_gen _ ((_ -> _) -> _ -> _ -> _ -> _) ((eq ==> eq) ==> eq ==> eq ==> eq ==> eq)%signature) |
| 42 |
| apply (@list_rect_Proper_gen _ ((_ -> _) -> _ -> _ -> _) ((eq ==> eq) ==> eq ==> eq ==> eq)%signature) |
| 43 |
| apply (@list_rect_Proper_gen _ ((_ -> _) -> _ -> _) ((eq ==> eq) ==> eq ==> eq)%signature) |
| 44 |
| apply (@list_rect_Proper_gen _ ((_ -> _) -> _) ((eq ==> eq) ==> eq)%signature) |
| 45 |
| apply (@nat_rect_Proper_nondep_gen ((_ -> _) -> _ -> _) ((eq ==> eq) ==> eq ==> eq)%signature) |
| 46 |
| apply (@nat_rect_Proper_nondep_gen ((_ -> _) -> _) ((eq ==> eq) ==> eq)%signature) |
| 47 |
| apply (@nat_rect_Proper_nondep_gen (_ -> _) (eq ==> eq)%signature) |
| 48 |
| apply NatUtil.nat_rect_Proper_nondep |
| 49 |
| apply ListUtil.list_rect_Proper |
| 50 |
| apply ListUtil.list_rect_arrow_Proper |
| 51 |
| apply ListUtil.list_case_Proper |
| 52 |
| apply ListUtil.pointwise_map |
| 53 |
| apply ListUtil.fold_right_Proper |
| 54 |
| apply ListUtil.update_nth_Proper |
| 55 |
| cbn; apply (f_equal (@Some _)) |
| 56 |
| progress cbn [ZRange.ident.option.interp] |
| 57 |
| progress cbv [zrange_rect] |
| 58 |
| apply (f_equal2 pair) |
| 59 |
| break_innermost_match_step |
| 60 |
| match goal with |
| 61 |
| [ H : _ |- _ ] => erewrite H by (eauto; (eassumption || reflexivity)) |
| 62 |
| [ H : forall x y, x = y -> _ |- _ ] => specialize (fun x => H x x eq_refl) |
| 63 |
| [ H : forall x, ?f x = ?g x, H1 : ?f ?y = _, H2 : ?g ?y = _ |- _ ] |
| 64 |
=> specialize (H y); rewrite H1, H2 in H |
| 65 |
end |
| 66 |
| do_with_exactly_one_hyp ltac:(fun H => apply H; clear H) ]. |
| 67 |
Qed. |
| 68 |
End interp_related. |
| 69 |
End option. |
| 70 |
End ident. |
| 71 |
End ZRange. |
| 72 |
End Compilers. |