|
1 | 1 | From Coq Require Import Relations Relation_Operators. |
2 | | -From RelationAlgebra Require Import lattice rel kat_tac. |
| 2 | +From RelationAlgebra Require Import lattice monoid rel kat_tac rel. |
3 | 3 | From mathcomp Require Import ssreflect ssrfun ssrbool ssrnat seq path. |
4 | 4 | From mathcomp Require Import eqtype choice order finmap fintype. |
5 | 5 | From event_struct Require Import utilities relations wftype ident. |
@@ -38,6 +38,7 @@ From event_struct Require Import utilities relations wftype ident. |
38 | 38 |
|
39 | 39 | Import Order.LTheory. |
40 | 40 | Open Scope order_scope. |
| 41 | +Local Open Scope ra_terms. |
41 | 42 | Import WfClosure. |
42 | 43 |
|
43 | 44 | Set Implicit Arguments. |
@@ -567,26 +568,70 @@ Qed. |
567 | 568 | (* Writes-Before relation *) |
568 | 569 | (* ************************************************************************* *) |
569 | 570 |
|
570 | | -Definition sca_suffix : E -> seq E := suffix (fica_lt). |
571 | | - |
572 | | -Definition contr_loc f : E -> seq E := |
573 | | - fun e => (f ∘ (same_loc (lab e) \o lab)ᶠ) e. |
574 | | - |
575 | | -Definition contr_wrire f : E -> seq E := |
576 | | - (is_write \o lab)ᶠ ∘ f ∘ (is_write \o lab)ᶠ. |
577 | | - |
578 | | -Definition frf_inv : E -> seq E := |
579 | | - fun e => [seq x <- dom | frf x == e]. |
580 | | - |
581 | | -(* wb := [W] ; (po ∪ rf)⁺ |loc ; [W] ∪ [W]; (po ∪ rf)⁺ ; rf⁻ ; [W] \ id *) |
582 | | - |
583 | | -Definition fwb : {fsfun E -> seq E with [::]} := |
584 | | - [fsfun x in (seq_fset tt dom) => |
585 | | - ( |
586 | | - contr_wrire (contr_loc sca_suffix) |
587 | | - ∪ |
588 | | - strictify (contr_wrire (frf_inv ∘ (contr_loc sca_suffix))) |
589 | | - ) x]. |
| 571 | +Definition sca : hrel E E := (ca : hrel E E) ∩ (fun x y => x <> y). |
| 572 | + |
| 573 | +Definition rf_inv : hrel E E := fun x y => frf x = y. |
| 574 | + |
| 575 | +Definition wb1 : hrel E E := fun e1 e2 => |
| 576 | + ( |
| 577 | + ((same_loc (lab e1) (lab e2)) * |
| 578 | + (is_write (lab e1))) * |
| 579 | + ((is_write (lab e2)) * |
| 580 | + ((sca e1 e2))) |
| 581 | + )%type. |
| 582 | + |
| 583 | +Definition wb2 : hrel E E := fun e1 e2 => |
| 584 | + ( |
| 585 | + ((same_loc (lab e1) (lab e2)) * |
| 586 | + (is_write (lab e1))) * |
| 587 | + ((is_write (lab e2)) * |
| 588 | + (((hrel_dot _ _ _ sca rf_inv) e1 e2) * (e1 <> e2))) |
| 589 | + )%type. |
| 590 | + |
| 591 | +(* wb := [W] ; (po ∪ rf)⁺ |loc ; [W] ∪ [W]; (po ∪ rf)⁺ |loc ; rf⁻ ; [W] \ id *) |
| 592 | + |
| 593 | +Definition wb := wb1 ⊔ wb2. |
| 594 | + |
| 595 | +Definition rwb1 e1 e2 := |
| 596 | + ( |
| 597 | + ((same_loc (lab e1) (lab e2)) * |
| 598 | + (is_read (lab e1))) * |
| 599 | + ((is_read (lab e2)) * |
| 600 | + ((frf e1) <> (frf e2))) * |
| 601 | + (sca (frf e1) e2) |
| 602 | + )%type. |
| 603 | + |
| 604 | +Definition rwb2 e1 e2 := |
| 605 | + ( |
| 606 | + ((same_loc (lab e1) (lab e2)) * |
| 607 | + (is_read (lab e1))) * |
| 608 | + ((is_read (lab e2)) * |
| 609 | + ((wb1 ⋅ sca) (frf e1) e2)) |
| 610 | + )%type. |
| 611 | + |
| 612 | +Definition rwb : hrel E E := rwb1 ⊔ rwb2. |
| 613 | + |
| 614 | +Lemma wb_rbw : |
| 615 | + (exists x, wb^* x x) <-> |
| 616 | + exists x, rwb^* x x. |
| 617 | +Proof. Admitted. |
| 618 | + |
| 619 | +Definition frwb : {fsfun E -> seq E with [::]}. Admitted. |
| 620 | + |
| 621 | +Lemma frwbP e1 e2: |
| 622 | + reflect (rwb e1 e2) (e2 \in frwb e1). |
| 623 | +Proof. Admitted. |
| 624 | + |
| 625 | +Definition seq_contr (f : E -> seq E) (xs : seq E): {fsfun E -> seq E with [::]} := |
| 626 | + [fsfun x in seq_fset tt dom => [seq y <- f x | y \in xs]] . |
| 627 | + |
| 628 | +Export FinClosure. |
| 629 | + |
| 630 | +Definition fwb_cf (rs : seq E) := |
| 631 | + if rs is r :: _ then |
| 632 | + (t_closure (seq_contr frwb rs) r r) || |
| 633 | + (~~ allrel (fun e1 e2 => ~~ e1 # e2) rs rs) |
| 634 | + else false. |
590 | 635 |
|
591 | 636 |
|
592 | 637 | End ExecEventStructure. |
|
0 commit comments