Proof using misi smsi lmi.
intros.
find_copy_apply_lem_hyp log_matching_invariant. unfold log_matching in *.
find_copy_apply_lem_hyp state_machine_safety_invariant. unfold state_machine_safety in *.
find_copy_apply_lem_hyp max_index_sanity_invariant. unfold maxIndex_sanity in *.
unfold commitIndex_lastApplied_match.
intuition; simpl in *.
- unfold log_matching_hosts in *. intuition. simpl in *.
match goal with
| H : forall (_ : name) (_ : nat), _ |- In ?e (_ (_ ?h)) =>
specialize (H h (eIndex e)); forward H;
intuition
end.
+ find_apply_hyp_hyp; omega.
+ eapply le_trans; [|eapply_prop maxIndex_lastApplied].
simpl. omega.
+ break_exists. intuition.
match goal with
| _ : eIndex ?e = eIndex ?e' |- _ =>
cut (e = e'); [intros; subst; auto|]
end.
eapply_prop state_machine_safety_host; unfold commit_recorded; intuition eauto;
simpl in *; intuition.
- unfold log_matching_hosts in *. intuition. simpl in *.
match goal with
| H : forall (_ : name) (_ : nat), _ |- In ?e (_ (_ ?h)) =>
specialize (H h (eIndex e)); forward H;
intuition
end.
+ find_apply_hyp_hyp; omega.
+ eapply le_trans; [|eapply_prop maxIndex_commitIndex].
simpl. omega.
+ break_exists. intuition.
match goal with
| _ : eIndex ?e = eIndex ?e' |- _ =>
cut (e = e'); [intros; subst; auto|]
end.
eapply_prop state_machine_safety_host; unfold commit_recorded; intuition eauto;
simpl in *; intuition.
Qed.

Theorem lastApplied_lastApplied_match_invariant :
forall net,
raft_intermediate_reachable net ->
lastApplied_lastApplied_match net.