(* 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.machine2.machine.
Require Export DistributedReferenceCounting.machine2.cardinal.
Require Export DistributedReferenceCounting.machine2.comm.
Unset Standard Proposition Elimination Names.
Section ALTERNATE.
Inductive D_queue : queue Message -> Prop :=
| D_empty : D_queue (empty Message)
| D_dec : forall qm : queue Message, D_queue (input Message dec qm).
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)).

(* Specifications: *)
Lemma not_D_queue :
forall (q0 : queue Message) (m : Message),
m <> dec -> ~ D_queue (input Message m q0).
Lemma D_first_out :
forall q0 : queue Message, D_queue q0 -> D_queue (first_out Message q0).
Lemma alt_first_out :
forall q0 : queue Message, alternate q0 -> alternate (first_out Message q0).