-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filtration by memory model #78
base: master
Are you sure you want to change the base?
Changes from 5 commits
0376b90
0eb6fed
4fc3268
af5819f
de88ae1
caeb845
a7f4827
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,4 @@ prime_eventstruct.v | |
eventstructure.v | ||
transitionsystem.v | ||
regmachine.v | ||
memory_model.v |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,6 +106,8 @@ Notation "w << r" := (write_read_from w r) (at level 0). | |
Lemma rf_thrdend w : w << ThreadEnd = false. | ||
Proof. by case: w. Qed. | ||
|
||
Definition same_loc l l' := lloc l == lloc l'. | ||
|
||
|
||
(* ************************************************************************* *) | ||
(* Exec Event Structure *) | ||
|
@@ -512,7 +514,7 @@ Lemma cfE e1 e2: e1 # e2 = cf_step e1 e2. | |
Proof. | ||
apply/idP/idP; last by apply: cf_step_cf. | ||
case/cfP=> e1' [e2' [[]]]. | ||
case: (boolP (e1' == e1))=> [/eqP-> _|]. | ||
case: (boolP (e1' == e1))=> [/eqP-> _ |]. | ||
- case: (boolP (e2' == e2))=> [/eqP->_->|]; first (apply/orP; by left). | ||
move/ca_step_last/[apply] => [[x /and3P[/cf_consistr H N + /icf_cf/H]]]. | ||
rewrite lt_neqAle=> /andP[] *. | ||
|
@@ -548,10 +550,10 @@ Proof. | |
suff C: ~ m # (fpred m). | ||
case: (boolP (frf m == m))=> [/eqP fE|?]. | ||
- rewrite cfE => /orP; rewrite orbb icfxx => [[]] //=. | ||
rewrite fE; case: ifP=> [/eqP//|_]; case: ifP=>//= _; by rewrite orbF => /C. | ||
rewrite fE; case: ifP=> [/eqP//| _]; case: ifP=>//= _; by rewrite orbF => /C. | ||
rewrite cfE icfxx orbb=> /hasP[? /(mem_subseq (filter_subseq _ _))] /=. | ||
by rewrite ?inE=> /orP[/eqP->|/eqP->/C]//; rewrite rff_consist. | ||
move=> /cfP[x [y [[]]]]; case: (eqVneq x m)=> [-> _|]. | ||
move=> /cfP[x [y [[]]]]; case: (eqVneq x m)=> [-> _ |]. | ||
- by move=> /ca_le L /and4P[_ /eqP<- _ /(le_lt_trans L)]; rewrite ltxx. | ||
move/ca_step_last=> /[apply] [[z /and3P[/[swap]]]]. | ||
rewrite /ica !inE=> /pred2P[]-> Cx L. | ||
|
@@ -561,6 +563,32 @@ Proof. | |
by move=> Cy /icf_cf/cf_consist2/(_ Cx Cy); exact/IHm. | ||
Qed. | ||
|
||
(* ************************************************************************* *) | ||
(* Writes-Before relation *) | ||
(* ************************************************************************* *) | ||
|
||
Definition sca_suffix : E -> seq E := suffix (fica_lt). | ||
|
||
Definition contr_loc f : E -> seq E := | ||
fun e => (f ∘ (same_loc (lab e) \o lab)ᶠ) e. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one looks a bit cryptic. For example, there are two There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can't apply eta conversion because we use |
||
|
||
Definition contr_wrire f : E -> seq E := | ||
(is_write \o lab)ᶠ ∘ f ∘ (is_write \o lab)ᶠ. | ||
|
||
Definition frf_inv : E -> seq E := | ||
fun e => [seq x <- dom | frf x == e]. | ||
|
||
(* wb := [W] ; (po ∪ rf)⁺ |loc ; [W] ∪ [W]; (po ∪ rf)⁺ ; rf⁻ ; [W] \ id *) | ||
|
||
Definition fwb : {fsfun E -> seq E with [::]} := | ||
[fsfun x in (seq_fset tt dom) => | ||
( | ||
contr_wrire (contr_loc sca_suffix) | ||
∪ | ||
strictify (contr_wrire (frf_inv ∘ (contr_loc sca_suffix))) | ||
) x]. | ||
|
||
|
||
End ExecEventStructure. | ||
|
||
Canonical es_eqMixin disp E := EqMixin (@eqesP disp E). | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
From mathcomp Require Import ssreflect ssrfun ssrbool ssrnat seq. | ||
From mathcomp Require Import eqtype choice finfun finmap tuple. | ||
From event_struct Require Import utilities eventstructure inhtype relations. | ||
From event_struct Require Import transitionsystem ident regmachine. | ||
|
||
|
||
Set Implicit Arguments. | ||
Unset Strict Implicit. | ||
Unset Printing Implicit Defensive. | ||
|
||
Section MMConsist. | ||
|
||
Context {V : inhType} {disp} {E : identType disp}. | ||
|
||
(*Notation n := (@n val).*) | ||
Notation exec_event_struct := (@fin_exec_event_struct V _ E). | ||
Notation cexec_event_struct := (@cexec_event_struct V _ E). | ||
|
||
Section GeneralDef. | ||
|
||
Variable mm_pred : pred cexec_event_struct. | ||
|
||
Inductive mm_config := MMConsist (c : config) of mm_pred (evstr c). | ||
|
||
Coercion config_of (mmc : mm_config) := | ||
let '(MMConsist c _) := mmc in c. | ||
|
||
Canonical config_subType := [subType for config_of]. | ||
|
||
Lemma consist_inj : injective config_of. | ||
Proof. exact: val_inj. Qed. | ||
|
||
Variable pgm : parprog (V := V). | ||
|
||
Definition mm_eval_ster mmc pr : seq mm_config := | ||
pmap insub (eval_step pgm mmc pr). | ||
|
||
End GeneralDef. | ||
|
||
Export FinClosure. | ||
|
||
Definition ra_consist (es : cexec_event_struct):= | ||
all (fun x => x \notin t_closure (fwb es) x) (dom es). | ||
|
||
End MMConsist. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,8 +42,6 @@ Local Open Scope ra_terms. | |
Definition sfrel {T : eqType} (f : T -> seq T) : rel T := | ||
[rel a b | a \in f b]. | ||
|
||
|
||
|
||
Section Strictify. | ||
|
||
Context {T : eqType}. | ||
|
@@ -361,3 +359,25 @@ End FinRTClosure. | |
|
||
End FinClosure. | ||
|
||
Section Operations. | ||
|
||
Context {T : Type}. | ||
Variables (f g : T -> seq T) (p : pred T). | ||
|
||
Definition composition := | ||
fun x => do y <- g x; f y. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is Kleisli composition. You can use notation |
||
|
||
Definition fun_of_pred := | ||
fun x => if p x then [:: x] else [::]. | ||
|
||
Definition funion := | ||
fun x => f x ++ g x. | ||
|
||
End Operations. | ||
|
||
Notation "p 'ᶠ'" := (fun_of_pred p) (at level 10). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I remember we were discussing that this is related to "tests" from Kleene Algebras with Tests, but currently we cannot use the notation from
I prefer the second solution. |
||
Notation "f ∘ g" := (composition f g) (at level 100, right associativity). | ||
Notation "f ∪ g" := (funion f g) (at level 100). | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does
contr
stands for?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contraction