Ltac do_host_independent :=
    match goal with
      | [ H : log_matching_nw ?net |- log_matching_nw ?net2 ] =>
        assert (host_independent_log_matching_nw net2);
          [apply (host_independent_log_matching_nw_invariant net);
            [
              unfold host_independent_log_matching_nw;
              unfold log_matching_nw in H;
              apply H;
              simpl in *; intuition
            |
            simpl in *; repeat find_rewrite; intuition; try do_in_app; intuition
            ]
          |]
    end.Ltac assert_do_generic_server h :=
    match goal with
      | [ _ : nwPackets ?net = _,
              H : doGenericServer ?h ?s = (?out, ?s', ?ms) |- _ ] =>
        match goal with
          | [ |-
              log_matching {|
                  nwPackets := map ?f (?l1 ++ ms) ++ ?xs ++ ?ys;
                  nwState := _ |}
            ] =>
            assert (log_matching {| nwPackets :=
                                      map f l1 ++ xs ++ ys;
                                    nwState := fun nm =>
                                                 if name_eq_dec nm h then s
                                                 else nwState net nm |})
          | [ |-
              log_matching {|
                  nwPackets := map ?f (ms ++ ?l1) ++ ?xs ++ ?ys;
                  nwState := _ |}
            ] =>
            assert (log_matching {| nwPackets :=
                                      map f l1 ++ xs ++ ys;
                                    nwState := fun nm =>
                                                 if name_eq_dec nm h then s
                                                 else nwState net nm |})
        end
    end.

(* Specifications: *)
Theorem doGenericServer_log_matching : raft_net_invariant_do_generic_server log_matching.