Local Arguments update {_} {_} _ _ _ _ _ : simpl never.
Set Implicit Arguments.
Class BaseParamsTotalMap (P0 : BaseParams) (P1 : BaseParams) :=
{
tot_map_data : @data P0 -> @data P1 ;
tot_map_input : @input P0 -> @input P1 ;
tot_map_output : @output P0 -> @output P1
}.
Class MultiParamsNameTotalMap
(B0 : BaseParams) (B1 : BaseParams)
(P0 : MultiParams B0) (P1 : MultiParams B1)  :=
{
tot_map_name : @name B0 P0 -> @name B1 P1 ;
tot_map_name_inv : @name B1 P1 -> @name B0 P0
}.
Class MultiParamsNameTotalMapBijective `(M : MultiParamsNameTotalMap) : Prop :=
{
tot_map_name_inv_inverse : forall n, tot_map_name_inv (tot_map_name n) = n ;
tot_map_name_inverse_inv : forall n, tot_map_name (tot_map_name_inv n) = n ;
}.
Class MultiParamsMsgTotalMap
(B0 : BaseParams) (B1 : BaseParams)
(P0 : MultiParams B0) (P1 : MultiParams B1) :=
{
tot_map_msg : @msg B0 P0 -> @msg B1 P1
}.
Section TotalMapDefs.
Context {base_fst : BaseParams}.
Context {base_snd : BaseParams}.
Context {multi_fst : MultiParams base_fst}.
Context {multi_snd : MultiParams base_snd}.
Context {base_map : BaseParamsTotalMap base_fst base_snd}.
Context {name_map : MultiParamsNameTotalMap multi_fst multi_snd}.
Context {msg_map : MultiParamsMsgTotalMap multi_fst multi_snd}.
Definition tot_map_name_msgs :=
map (fun nm => (tot_map_name (fst nm), tot_map_msg (snd nm))).
Definition tot_mapped_net_handlers me src m st :=
let '(out, st', ps) := net_handlers me src m st in
(map tot_map_output out, tot_map_data st', tot_map_name_msgs ps).
Definition tot_mapped_input_handlers me inp st :=
let '(out, st', ps) := input_handlers me inp st in
(map tot_map_output out, tot_map_data st', tot_map_name_msgs ps).
End TotalMapDefs.
Class MultiParamsTotalMapCongruency
(B0 : BaseParams) (B1 : BaseParams)
(P0 : MultiParams B0) (P1 : MultiParams B1)
(B : BaseParamsTotalMap B0 B1)
(N : MultiParamsNameTotalMap P0 P1)
(P : MultiParamsMsgTotalMap P0 P1) : Prop :=
{
tot_init_handlers_eq : forall n,
tot_map_data (init_handlers n) = init_handlers (tot_map_name n) ;
tot_net_handlers_eq : forall me src m st,
tot_mapped_net_handlers me src m st =
net_handlers (tot_map_name me) (tot_map_name src) (tot_map_msg m) (tot_map_data st) ;
tot_input_handlers_eq : forall me inp st,
tot_mapped_input_handlers me inp st =
input_handlers (tot_map_name me) (tot_map_input inp) (tot_map_data st)
}.
Class FailureParamsTotalMapCongruency
(B0 : BaseParams) (B1 : BaseParams)
(P0 : MultiParams B0) (P1 : MultiParams B1)
(F0 : FailureParams P0) (F1 : FailureParams P1)
(B : BaseParamsTotalMap B0 B1) : Prop :=
{
tot_reboot_eq : forall d, tot_map_data (reboot d) = reboot (tot_map_data d)
}.
Class NameOverlayParamsTotalMapCongruency
(B0 : BaseParams) (B1 : BaseParams)
(P0 : MultiParams B0) (P1 : MultiParams B1)
(O0 : NameOverlayParams P0) (O1 : NameOverlayParams P1)
(N : MultiParamsNameTotalMap P0 P1) : Prop :=
{
tot_adjacent_to_fst_snd : forall n n',
adjacent_to n n' <-> adjacent_to (tot_map_name n) (tot_map_name n')
}.
Class FailMsgParamsTotalMapCongruency
(B0 : BaseParams) (B1 : BaseParams)
(P0 : MultiParams B0) (P1 : MultiParams B1)
(F0 : FailMsgParams P0) (F1 : FailMsgParams P1)
(P : MultiParamsMsgTotalMap P0 P1) : Prop :=
{
tot_fail_msg_fst_snd : msg_fail = tot_map_msg msg_fail
}.
Class NewMsgParamsTotalMapCongruency
(B0 : BaseParams) (B1 : BaseParams)
(P0 : MultiParams B0) (P1 : MultiParams B1)
(N0 : NewMsgParams P0) (N1 : NewMsgParams P1)
(P : MultiParamsMsgTotalMap P0 P1) : Prop :=
{
tot_new_msg_fst_snd : msg_new = tot_map_msg msg_new
}.
Section TotalMapBijective.
Context `{MB : MultiParamsNameTotalMapBijective}.

Lemma tot_map_name_injective :
forall n n', tot_map_name n = tot_map_name n' -> n = n'.