%%% Bisimilarity-up-to for the synchronous pi-calculus
%%%
%%%
%%% For more details, please see the paper:
%%%
%%% "A lightweight formalization of the meta-theory of
%%% bisimulation-up-to" by K. Chaudhuri, M. Cimini, and
%%% D. Miller, 2014
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Processes
Kind name,proc type.
%% action prefixes
Type taup proc -> proc.
Type inp name -> (name -> proc) -> proc.
Type oup name -> name -> proc -> proc.
%% name restriction
Type nu (name -> proc) -> proc.
%% replication
Type repl proc -> proc.
%% core process algebra
Type plus, par proc -> proc -> proc.
Type null proc.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Labels of the LTS
Kind label type.
Type tau label.
Type up, dn name -> name -> label.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% The steps of the LTS
% The steps are defined by a mutually inductive definition of a relation
% one for closed steps and oneb for bound steps, i.e., steps that contain
% a name that is restricted (nu) or bound (inp) in an outer scope.
Define
one : proc -> label -> proc -> prop,
oneb : proc -> (name -> label) -> (name -> proc) -> prop
by
/* internal steps */
; one (taup P) tau P
/* closed output */
; one (oup X Y P) (up X Y) P
/* core process algebra */
; one (plus P Q) L R := one P L R
; one (plus P Q) L R := one Q L R
; one (par P Q) L (par R Q) := one P L R
; one (par P Q) L (par P R) := one Q L R
; one (repl P) L (par (repl P) R) := one P L R
; one (nu P) L (nu Q) := nabla x, one (P x) L (Q x)
/* closed communication */
; one (par P Q) tau (par PP QQ) :=
/* case of P getting input */
(exists X Y R, oneb P (dn X) R /\ one Q (up X Y) QQ /\ PP = R Y)
/* case of Q getting input */
\/ (exists X Y R, one P (up X Y) PP /\ oneb Q (dn X) R /\ QQ = R Y)
/* internal closed communication in a replicated process */
; one (repl P) tau (par (repl P) (par PP QQ)) :=
exists X Y R,
one P (up X Y) PP
/\ oneb P (dn X) R /\ QQ = R Y
/* bound communication */
; one (par P Q) tau (nu y\ par (PP y) (QQ y)) :=
/* case of P getting input */
(exists X, oneb P (dn X) PP /\ oneb Q (up X) QQ)
/* case of Q getting input */
\/ (exists X, oneb P (up X) PP /\ oneb Q (dn X) QQ)
/* internal bound communication in a replicated process */
; one (repl P) tau (par (repl P) (nu y\ par (PP y) (QQ y))) :=
exists X, oneb P (up X) PP /\ oneb P (dn X) QQ
/* bound output */
; oneb (nu P) (up X) R := nabla y, one (P y) (up X y) (R y)
/* bound input */
; oneb (inp X P) (dn X) P
/* core process algebra for bound labels */
; oneb (plus P Q) L R := oneb P L R
; oneb (plus P Q) L R := oneb Q L R
; oneb (par P Q) L (x\ par (R x) Q) := oneb P L R
; oneb (par P Q) L (x\ par P (R x)) := oneb Q L R
; oneb (repl P) L (x\ par (repl P) (R x)) := oneb P L R
; oneb (nu P) L (y\ nu x\ R x y) := nabla x, oneb (P x) L (R x).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Bisimilarity-up-to
CoDefine bisim_up_to : (proc -> proc -> proc -> proc -> prop) ->
proc -> proc -> prop by
bisim_up_to Tech P Q :=
(forall L P1, one P L P1 ->
exists Q1, one Q L Q1 /\
exists P2 Q2, Tech P1 P2 Q1 Q2 /\
bisim_up_to Tech P2 Q2)
/\ (forall X P1, oneb P (dn X) P1 ->
exists Q1, oneb Q (dn X) Q1 /\
exists P2 Q2, forall N,
Tech (P1 N) (P2 N) (Q1 N) (Q2 N) /\
bisim_up_to Tech (P2 N) (Q2 N))
/\ (forall X P1, oneb P (up X) P1 ->
exists Q1, oneb Q (up X) Q1 /\
exists P2 Q2, nabla x,
Tech (P1 x) (P2 x) (Q1 x) (Q2 x) /\
bisim_up_to Tech (P2 x) (Q2 x))
/\ (forall L Q1, one Q L Q1 ->
exists P1, one P L P1 /\
exists P2 Q2, Tech P1 P2 Q1 Q2 /\
bisim_up_to Tech P2 Q2)
/\ (forall X Q1, oneb Q (dn X) Q1 ->
exists P1, oneb P (dn X) P1 /\
exists P2 Q2, forall N,
Tech (P1 N) (P2 N) (Q1 N) (Q2 N) /\
bisim_up_to Tech (P2 N) (Q2 N))
/\ (forall X Q1, oneb Q (up X) Q1 ->
exists P1, oneb P (up X) P1 /\
exists P2 Q2, nabla x,
Tech (P1 x) (P2 x) (Q1 x) (Q2 x) /\
bisim_up_to Tech (P2 x) (Q2 x)).
Define refl_t : proc -> proc -> proc -> proc -> prop by
refl_t P P Q Q.
Define is_sound : (proc -> proc -> proc -> proc -> prop) -> prop by
is_sound Tech :=
forall P Q, bisim_up_to Tech P Q -> bisim_up_to refl_t P Q.
Theorem bisim_reflexive : forall P, bisim_up_to refl_t P P.
CH : coinduction. intros !P. unfold.
- intros !L !Pstep Hone. witness Pstep. split.
+ search.
+ witness Pstep. witness Pstep. split.
* search.
* backchain *CH.
- intros !X !Pdn HonebDn. witness Pdn. split.
+ search.
+ witness Pdn. witness Pdn. intros. split.
* search.
* backchain *CH.
- intros !X !Pup HonebUp. witness Pup. split.
+ search.
+ witness Pup. witness Pup. intros. split.
* search.
* backchain *CH.
- intros !L !Qstep HoneQ. witness Qstep. split.
+ search.
+ witness Qstep. witness Qstep. intros. split.
* search.
* backchain *CH.
- intros !X !Qdn HonebDnQ. witness Qdn. split.
+ search.
+ witness Qdn. witness Qdn. intros. split.
* search.
* backchain *CH.
- intros !X !Qup HonebUpQ. witness Qup. split.
+ search.
+ witness Qup. witness Qup. intros. split.
* search.
* backchain *CH.
Theorem bisim_eq_1L : forall P1 P2 Q,
bisim_up_to refl_t P1 Q -> P1 = P2 -> bisim_up_to refl_t P2 Q.
intros _ Heq. case Heq. search.
Theorem bisim_eq_1R : forall P1 P2 Q,
bisim_up_to refl_t P2 Q -> P1 = P2 -> bisim_up_to refl_t P1 Q.
intros _ Heq. case Heq. search.
Theorem bisim_eq_2L : forall P Q1 Q2,
bisim_up_to refl_t P Q1 -> Q1 = Q2 -> bisim_up_to refl_t P Q2.
intros _ Heq. case Heq. search.
Theorem bisim_eq_2R : forall P Q1 Q2,
bisim_up_to refl_t P Q2 -> Q1 = Q2 -> bisim_up_to refl_t P Q1.
intros _ Heq. case Heq. search.
Theorem bisim_symmetric : forall P Q,
bisim_up_to refl_t P Q ->
bisim_up_to refl_t Q P.
CH : coinduction. intros Hbisim. Bis1* : case Hbisim. unfold.
- clear Bis1 Bis2 Bis3 Bis5 Bis6.
intros !L !PstepQ HstepQ.
!PstepP _ Hrefl : apply *Bis4 to *HstepQ.
witness PstepP. split.
+ search.
+ witness PstepQ. witness PstepP. case Hrefl. split.
* search.
* backchain *CH.
- clear Bis1 Bis2 Bis3 Bis4 Bis6.
intros !X !PdnQ HstepQ.
!PdnP _ Hforall : apply *Bis5 to *HstepQ.
witness PdnP. split.
+ search.
+ witness PdnQ. witness PdnP. intros !Nmsg.
HreflN HbisimN : apply *Hforall with N = Nmsg.
HeqQ HeqP : case HreflN. split.
* search.
* backchain *CH.
Hmid : apply bisim_eq_1R to *HbisimN *HeqP.
apply bisim_eq_2R to *Hmid *HeqQ. search.
- clear Bis1 Bis2 Bis3 Bis4 Bis5.
intros !X !PupQ HstepQ.
!PupP _ Hrefl : apply *Bis6 to *HstepQ.
witness PupP. split.
+ search.
+ witness PupQ. witness PupP. intros. case Hrefl.
split.
* search.
* backchain *CH.
- clear Bis2 Bis3 Bis4 Bis5 Bis6.
intros !L !QstepP HstepP.
!QstepQ _ Hrefl : apply *Bis1 to *HstepP.
witness QstepQ. split.
+ search.
+ witness QstepQ. witness QstepP. case Hrefl. split.
* search.
* backchain *CH.
- clear Bis1 Bis3 Bis4 Bis5 Bis6.
intros !X !QdnP HstepP.
!QdnQ _ Hforall : apply *Bis2 to *HstepP.
witness QdnQ. split.
+ search.
+ witness QdnQ. witness QdnP. intros !Nmsg.
HreflN HbisimN : apply *Hforall with N = Nmsg.
HeqQ HeqP : case HreflN. split.
* search.
* backchain *CH.
Hmid : apply bisim_eq_1R to *HbisimN *HeqP.
apply bisim_eq_2R to *Hmid *HeqQ. search.
- clear Bis1 Bis2 Bis4 Bis5 Bis6.
intros !X !QupP HstepP.
!QupQ _ Hrefl : apply *Bis3 to *HstepP.
witness QupQ. split.
+ search.
+ witness QupQ. witness QupP. intros. case Hrefl.
split.
* search.
* backchain *CH.
Theorem bisim_transitive : forall P Q R,
bisim_up_to refl_t P Q -> bisim_up_to refl_t Q R -> bisim_up_to refl_t P R.
CH : coinduction. intros HbisimPQ HbisimQR.
Left1* : case HbisimPQ. Right1* : case HbisimQR. unfold.
- intros !L !Pstep HstepP.
!Qmid !PmidL !QmidL HoneQ HreflL : apply *Left1 to *HstepP.
!QstepR !PmidR !QmidR _ HreflR : apply *Right1 to *HoneQ.
witness QstepR. split.
+ search.
+ witness Pstep. witness QstepR. split.
* search.
* case HreflL. case HreflR. backchain *CH.
- intros !X !Pdn HstepP.
!QmidDn !PmidL !QmidL HoneQ HforallL : apply *Left2 to *HstepP.
!QdnR !PmidR !QmidR HoneR HforallR : apply *Right2 to *HoneQ.
witness QdnR. split.
+ search.
+ witness Pdn. witness QdnR. intros !Nmsg. split.
* search.
* HreflL HbisimL : apply *HforallL with N = Nmsg.
HreflR HbisimR : apply *HforallR with N = Nmsg.
HeqQleft HeqPleft : case HreflL.
HeqQright HeqPmid : case HreflR.
HbisimStepA : apply bisim_eq_1R to *HbisimL *HeqPleft.
HbisimStepB : apply bisim_eq_2R to *HbisimStepA *HeqQleft.
apply *bisim_eq_2L to *HbisimStepB *HeqPmid.
apply bisim_eq_2R to *HbisimR *HeqQright.
backchain *CH.
- intros !X !Pup HstepP.
!QmidUp !PmidL !QmidL HoneQ HreflL : apply *Left3 to *HstepP.
!QupR !PmidR !QmidR _ HreflR : apply *Right3 to *HoneQ.
witness QupR. split.
+ search.
+ witness Pup. witness QupR. intros. split.
* search.
* case HreflL. case HreflR. backchain *CH.
- intros !L !Qstep HstepR.
!PmidQ !PmidL !QmidL HoneQ HreflL : apply *Right4 to *HstepR.
!PstepP !PmidR !QmidR _ HreflR : apply *Left4 to *HoneQ.
witness PstepP. split.
+ search.
+ witness PstepP. witness Qstep. split.
* search.
* case HreflL. case HreflR. backchain *CH.
- intros !X !Qdn HstepR.
!PmidQdn !PmidL !QmidL HoneQ HforallL : apply *Right5 to *HstepR.
!PdnP !PmidR !QmidR HoneP HforallR : apply *Left5 to *HoneQ.
witness PdnP. split.
+ search.
+ witness PdnP. witness Qdn. intros !Nmsg. split.
* search.
* HreflL HbisimL : apply *HforallL with N = Nmsg.
HreflR HbisimR : apply *HforallR with N = Nmsg.
HeqQleft HeqPmid : case HreflL.
HeqQright HeqPright : case HreflR.
HbisimStepA : apply bisim_eq_1R to *HbisimL *HeqPmid.
apply bisim_eq_2R to *HbisimStepA *HeqQleft.
HbisimStepC : apply bisim_eq_1R to *HbisimR *HeqPright.
apply bisim_eq_2R to *HbisimStepC *HeqQright.
backchain *CH.
- intros !X !Qup HstepR.
!PmidQup !PmidL !QmidL HoneQ HreflL : apply *Right6 to *HstepR.
!PupP !PmidR !QmidR _ HreflR : apply *Left6 to *HoneQ.
witness PupP. split.
+ search.
+ witness PupP. witness Qup. intros. split.
* search.
* case HreflL. case HreflR. backchain *CH.