Library BranchingOrder

Require Export SP.

Branching order


Section BranchingOrder.

Local Ltac rew_inv H H' := rewrite <- H in H'; inversion H'.

Variable Sig : Signature.

The branching order is defined as: B has more branches than B' if B' can be obtained from B by removing some branches in branching terms.
Order properties.

Lemma MB_refl : forall B, B [>>] B.

Lemma MB_refl' : forall B B', B = B' -> B [>>] B'.

Lemma MB_trans : forall B B' B'', B [>>] B' -> B' [>>] B'' -> B [>>] B''.

Lemma MB_antisym : forall B B', B [>>] B' -> B' [>>] B -> B = B'.

This relation extends to networks in the natural way.

Definition more_branches_N (N N':Network Sig) := forall p, N p [>>] N' p.

Notation "N (>>) N'" := (more_branches_N N N') (at level 50).

Open Scope SP.

Lemma MBN_refl : forall N, N (>>) N.

Lemma MBN_refl' : forall N N', N (==) N' -> N (>>) N'.

Lemma MBN_trans : forall N N' N'', N (>>) N' -> N' (>>) N'' -> N (>>) N''.

Lemma MBN_antisym : forall N N', N (>>) N' -> N' (>>) N -> N (==) N'.

Lemma SP_To_MBN : forall D N1 s N2 s' D' N1' tl,
  <<N1,s>> --[tl,D]--> <<N2,s'>> -> N1' (>>) N1 -> (forall X, D X = D' X) ->
  exists N2', <<N1',s>> --[tl,D']--> <<N2',s'>> /\ N2' (>>) N2.

Lemma SPP_To_MBN : forall P1 s P2 s' P1' tl,
  Net P1' (>>) Net P1 -> (forall X, Procs P1 X = Procs P1' X) ->
  (P1,s) --[tl]--> (P2,s') ->
  exists P2', (P1',s) --[tl]--> (P2',s') /\ Net P2' (>>) Net P2
    /\ forall X, Procs P2 X = Procs P2' X.

Lemma SPP_ToStar_MBN : forall P1 s P2 s' P1' tl,
  Net P1' (>>) Net P1 -> (forall X, Procs P1 X = Procs P1' X) ->
  (P1,s) --[tl]-->* (P2,s') ->
  exists P2', (P1',s) --[tl]-->* (P2',s') /\ Net P2' (>>) Net P2
  /\ forall X, Procs P1' X = Procs P2' X.

End BranchingOrder.

Notation "N (>>) N'" := (more_branches_N _ N N') (at level 50).
Notation "B [>>] B'" := (more_branches _ B B') (at level 50).