(* 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                                                     *)
Require Export DistributedReferenceCounting.machine3.machine.
Require Export DistributedReferenceCounting.machine3.cardinal.
Require Export DistributedReferenceCounting.machine3.comm.
Unset Standard Proposition Elimination Names.
Section ALTERNATE.
Inductive alternate : queue Message -> Prop :=
| alt_null : alternate (empty Message)
| alt_single_inc :
forall s0 : Site,
alternate (input Message (inc_dec s0) (empty Message))
| alt_any_alt :
forall (qm : queue Message) (m : Message),
(forall s : Site, m <> inc_dec s) ->
alternate qm -> alternate (input Message m qm)
| alt_inc_dec :
forall (qm : queue Message) (s0 : Site),
alternate qm ->
alternate (input Message (inc_dec s0) (input Message dec qm)).

Lemma alt_first_out :
forall q0 : queue Message, alternate q0 -> alternate (first_out Message q0).