Local Arguments update {_} {_} _ _ _ _ _ : simpl never.
Set Implicit Arguments.
Inductive Name := primary | backup.
Definition Name_eq_dec : forall x y : Name, {x = y} + {x <> y}.
decide equality.
Defined.
Inductive Msg := inc | ack.
Definition Msg_eq_dec : forall x y : Msg, {x = y} + {x <> y}.
decide equality.
Defined.
Inductive Input := request_inc.
Definition Input_eq_dec : forall x y : Input, {x = y} + {x <> y}.
destruct x,y. auto.
Defined.
Inductive Output := inc_executed.
Definition Output_eq_dec : forall x y : Output, {x = y} + {x <> y}.
destruct x,y. auto.
Defined.
Definition Data := nat.
Definition init_Data := 0.
Definition Handler (S : Type) := GenHandler (Name * Msg) S Output unit.
Definition PrimaryNetHandler (m : Msg) : Handler Data :=
match m with
| ack => write_output inc_executed
| _ => nop
end.
Definition PrimaryInputHandler (i : Input) : Handler Data :=
match i with
| request_inc => modify S ;; send (backup, inc)
end.
Definition BackupNetHandler (m : Msg) : Handler Data :=
match m with
| inc => modify S ;; send (primary, ack)
| _ => nop
end.
Definition BackupInputHandler (i : Input) : Handler Data := nop.
Definition NetHandler (me : Name) (m : Msg) : Handler Data :=
match me with
| primary => PrimaryNetHandler m
| backup => BackupNetHandler m
end.
Definition InputHandler (me : Name) (i : Input) : Handler Data :=
match me with
| primary => PrimaryInputHandler i
| backup => BackupInputHandler i
end.
Instance Counter_BaseParams : BaseParams :=
{
data := Data;
input := Input;
output := Output
}.
Definition Nodes : list Name := [primary; backup].

Lemma NoDup_Nodes : NoDup Nodes.