(* This program is free software; you can redistribute it and/or      *)
(* modify it under the terms of the GNU Lesser General Public License *)
(* as published by the Free Software Foundation; either version 2.1   *)
(* of the License, or (at your option) any later version.             *)
(*                                                                    *)
(* This program is distributed in the hope that it will be useful,    *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of     *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *)
(* GNU General Public License for more details.                       *)
(*                                                                    *)
(* You should have received a copy of the GNU Lesser General Public   *)
(* License along with this program; if not, write to the Free         *)
(* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *)
(* 02110-1301 USA                                                     *)
(* MESSAGES ACTIONS *)
(*definit les actions elementaires sur les messages et leurs consequences*)
Require Export counting.
Unset Standard Proposition Elimination Names.
Section M_ACTION.
(* ajout et retrait d'un message dans une file d'attente *)
Definition Post_message (m0 : Message) (b0 : Bag_of_message)
(s0 s1 : Site) :=
change_queue (queue Message) b0 s0 s1 (input Message m0 (b0 s0 s1)).
Definition Collect_message (b0 : Bag_of_message) (s0 s1 : Site) :=
change_queue (queue Message) b0 s0 s1 (first_out Message (b0 s0 s1)).

(* Specifications: *)
Lemma post_here :
forall (b0 : Bag_of_message) (m0 : Message) (s0 s1 : Site),
Post_message m0 b0 s0 s1 s0 s1 = input Message m0 (b0 s0 s1).
Lemma post_elsewhere :
forall (b0 : Bag_of_message) (m0 : Message) (s0 s1 s2 s3 : Site),
s0 <> s2 \/ s1 <> s3 -> Post_message m0 b0 s0 s1 s2 s3 = b0 s2 s3.
Lemma collect_here :
forall (b0 : Bag_of_message) (s0 s1 : Site),
Collect_message b0 s0 s1 s0 s1 = first_out Message (b0 s0 s1).
Lemma collect_elsewhere :
forall (b0 : Bag_of_message) (s0 s1 s2 s3 : Site),
s0 <> s2 \/ s1 <> s3 -> Collect_message b0 s0 s1 s2 s3 = b0 s2 s3.