Section StateMachineCorrect.
Context {orig_base_params : BaseParams}.
Context {one_node_params : OneNodeParams orig_base_params}.
Context {raft_params : RaftParams orig_base_params}.
Context {si : sorted_interface}.
Context {misi : max_index_sanity_interface}.
Context {smsi : state_machine_safety_interface}.
Context {lmi : log_matching_interface}.
Ltac get_invariant_pre inv :=
match goal with
| H : raft_intermediate_reachable _ |- _=>
match (type of H) with
| context [mkNetwork] =>
fail 2
end || copy_apply inv H
end.
Ltac get_invariant_post inv :=
match goal with
| H : raft_intermediate_reachable _ |- _=>
match (type of H) with
| context [mkNetwork] =>
copy_apply inv H
end
end.
Definition clientCache_to_ks (c : list (clientId * (nat * output))) :=
map (fun e => (fst e, fst (snd e))) c.
Proof using.
induction l; intros; simpl in *; intuition;
break_let; eauto.
Qed.
Proof using.
eauto using snd_execute_log'.
Qed.
Proof using.
induction c; intros; simpl in *; try congruence.
break_if; eauto.
- subst. find_inversion.
break_let. subst. simpl in *. break_if; try congruence.
destruct p. simpl in *. eauto.
- break_let; subst; simpl in *. break_if; try congruence. eauto.
Qed.
Proof using.
eauto using clientCache_to_ks_assoc.
Qed.
Proof using.
induction c; intros; simpl in *; try congruence.
break_if; eauto; try congruence.
- break_let; subst; simpl in *. break_if; try congruence. eauto.
Qed.

Lemma clientCache_to_ks_assoc_getLastId_none :
forall st client,
assoc clientId_eq_dec (clientCache_to_ks (clientCache st)) client = None ->
getLastId st client = None.