From 79d48fa72a3ac0cd2b84dc8c70eb9170088e0353 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Thu, 3 Oct 2019 17:09:03 +0200 Subject: Icall --- backend/Duplicate.v | 19 +++++++++++++++++++ backend/Duplicateproof.v | 8 ++++++++ 2 files changed, 27 insertions(+) (limited to 'backend') diff --git a/backend/Duplicate.v b/backend/Duplicate.v index 465b1538..a5e7d92a 100644 --- a/backend/Duplicate.v +++ b/backend/Duplicate.v @@ -45,6 +45,13 @@ Definition verify_is_copy revmap n n' := | Some revn => match (Pos.compare n revn) with Eq => OK tt | _ => Error(msg "verify_is_copy invalid map") end end. +Lemma product_eq {A B: Type} : + (forall (a b: A), {a=b} + {a<>b}) -> + (forall (c d: B), {c=d} + {c<>d}) -> + forall (x y: A+B), {x=y} + {x<>y}. +Proof. + intros H H'. intros. decide equality. +Qed. Definition verify_match_inst revmap inst tinst := match inst with @@ -84,6 +91,18 @@ Definition verify_match_inst revmap inst tinst := else Error (msg "Different addressing in Istore") else Error (msg "Different mchunk in Istore") | _ => Error (msg "verify_match_inst Istore") end + | Icall s ri lr r n => match tinst with + | Icall s' ri' lr' r' n' => + do u <- verify_is_copy revmap n n'; + if (signature_eq s s') then + if (product_eq Pos.eq_dec ident_eq ri ri') then + if (list_eq_dec Pos.eq_dec lr lr') then + if (Pos.eq_dec r r') then OK tt + else Error (msg "Different r r' in Icall") + else Error (msg "Different lr in Icall") + else Error (msg "Different ri in Icall") + else Error (msg "Different signatures in Icall") + | _ => Error (msg "verify_match_inst Icall") end | _ => Error(msg "not implemented") end. diff --git a/backend/Duplicateproof.v b/backend/Duplicateproof.v index c2bdf10d..e9799f08 100644 --- a/backend/Duplicateproof.v +++ b/backend/Duplicateproof.v @@ -106,6 +106,14 @@ Proof. destruct (Pos.eq_dec _ _); try discriminate. clear EQ0. subst. eapply verify_is_copy_correct_one. destruct x. eassumption. constructor. +(* Icall *) + - destruct i'; try (inversion H; fail). monadInv H. + destruct (signature_eq _ _); try discriminate. + destruct (product_eq _ _ _ _); try discriminate. + destruct (list_eq_dec _ _ _); try discriminate. + destruct (Pos.eq_dec _ _); try discriminate. + eapply verify_is_copy_correct_one. destruct x. eassumption. subst. + constructor. Qed. Lemma verify_mapping_mn_correct: -- cgit