(* 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                                                     *)
(* Communications *)
(* Without specifying how messages are defined, I am constructing general Lemma in terms of reduce *)
Require Export reduce.
Require Export DistributedReferenceCounting.machine2.cardinal.
Require Export sigma2.
Require Export sum.
Section CARDINAL_EFFECT.
(* This section is really using the inductive type Message *)
Let Bag_of_message := Bag_of_Data Message.
Variable inc_fun : Site -> Z.

(* Specifications: *)
Lemma cardinal_post_message :
forall (m : Message) (s1 s2 : Site) (b : Bag_of_message),
cardinal (Post_message Message m b s1 s2 s1 s2) =
(cardinal (b s1 s2) + cardinal_count m)%Z.
Lemma cardinal_collect_message :
forall (m : Message) (s1 s2 : Site) (b : Bag_of_message),
first Message (b s1 s2) = value Message m ->
cardinal (Collect_message Message b s1 s2 s1 s2) =
(cardinal (b s1 s2) - cardinal_count m)%Z.