Section TermsAndIndicesFromOneLog.
Context {orig_base_params : BaseParams}.
Context {one_node_params : OneNodeParams orig_base_params}.
Context {raft_params : RaftParams orig_base_params}.
Context {ctgzi : current_term_gt_zero_interface}.
Definition terms_and_indices_from_one_log_ind (net : network) : Prop :=
terms_and_indices_from_one_log net /\ terms_and_indices_from_one_log_nw net.
Proof using.
split.
- unfold terms_and_indices_from_one_log, terms_and_indices_from_one. simpl. contradiction.
- unfold terms_and_indices_from_one_log_nw, terms_and_indices_from_one. simpl. contradiction.
Qed.
Proof using.
intros. find_apply_hyp_hyp. break_or_hyp; eauto. unfold send_packets in *. do_in_map.
find_apply_hyp_hyp. unfold not in *. find_false.
subst. simpl in *. repeat find_rewrite. eauto 10.
Qed.
Proof using ctgzi.
red. unfold terms_and_indices_from_one_log_ind. split; red; simpl in *; intuition.
- find_higher_order_rewrite. update_destruct; subst; rewrite_update; auto.
find_apply_lem_hyp handleClientRequest_log. intuition.
+ repeat find_rewrite. auto.
+ break_exists. intuition.
unfold terms_and_indices_from_one_log, terms_and_indices_from_one in *.
intros. repeat find_rewrite. simpl in *. break_or_hyp.
* intuition. find_apply_lem_hyp current_term_gt_zero_invariant. find_rewrite.
eapply_prop current_term_gt_zero. congruence.
* eauto.
- eapply taifol_no_append_entries; pose handleClientRequest_no_append_entries; eauto.
Qed.
Proof using.
red. unfold terms_and_indices_from_one_log_ind. split; red; simpl in *; intuition.
- find_higher_order_rewrite. update_destruct; subst; rewrite_update; auto.
find_apply_lem_hyp handleTimeout_log_same. find_rewrite. auto.
- eapply taifol_no_append_entries; pose handleTimeout_packets; eauto.
Qed.
Proof using.
induction xs.
- auto.
- unfold terms_and_indices_from_one in *. simpl. intros. break_or_hyp; eauto.
Qed.
Proof using.
unfold terms_and_indices_from_one. eauto.
Qed.

Lemma terms_and_indices_from_one_log_ind_append_entries :
raft_net_invariant_append_entries terms_and_indices_from_one_log_ind.