proposition: Lemma message_clock_le_state_clock: forall p h s m, let n := msg_sender m in let c := msg_clock m in let sn := alg_state (node_states s n) in (step_star (init p) h s /\ In m (messages s)) -> c <= clock sn.
proof: Proof. intros. destruct H as [H1 H2]. remember (init p) as s0 eqn: Hs. induction H1. subst sn. subst s. simpl in H2. contradiction. simpl in IHstep_star. depremise IHstep_star. assumption. inversion H. subst c. subst sn. rewrite <- H5. simpl. destruct (eq_nat_dec n0 n). simpl_override. simpl. rewrite <- H5 in H2. simpl in H2. apply in_app_iff in H2. destruct H2 as [H2 | H2]. depremise IHstep_star. rewrite <- H3. simpl. assumption. rewrite <- H3 in IHstep_star. simpl in IHstep_star. rewrite e0 in IHstep_star. simpl_override_in IHstep_star. simpl in IHstep_star. rewrite Nat.add_comm. simpl. apply le_S. assumption. apply in_map_iff in H2. destruct H2 as [rn [H21 H22]]. rewrite <- H21. simpl. assert (A1 := sem_clock_alg_state_clock p ls s2 n0). depremise A1. subst s1. assumption. simpl in A1. rewrite <- H3 in A1. simpl in A1. simpl_override_in A1. simpl in A1. rewrite A1. reflexivity. simpl_override. depremise IHstep_star. rewrite <- H3. simpl. rewrite <- H5 in H2. simpl in H2. apply in_app_iff in H2. destruct H2 as [H2 | H2]. assumption. exfalso. apply in_map_iff in H2. destruct H2 as [rn [H21 H22]]. subst n. rewrite <- H21 in n1. simpl in n1. apply n1. reflexivity. rewrite <- H3 in IHstep_star. simpl in IHstep_star. simpl_override_in IHstep_star. assumption. subst c. subst sn. rewrite <- H5. simpl. destruct (eq_nat_dec n0 n). simpl_override. simpl. depremise IHstep_star. rewrite <- H3. simpl. rewrite <- H5 in H2. simpl in H2. assumption. rewrite <- H3 in IHstep_star. simpl in IHstep_star. rewrite e0 in IHstep_star. simpl_override_in IHstep_star. simpl in IHstep_star. assumption. simpl_override. depremise IHstep_star. rewrite <- H3. simpl. rewrite <- H5 in H2. simpl in H2. assumption. rewrite <- H3 in IHstep_star. simpl in IHstep_star. simpl_override_in IHstep_star. simpl in IHstep_star. assumption. subst c. subst sn. rewrite <- H6. simpl. destruct (eq_nat_dec n0 n). simpl_override. simpl. depremise IHstep_star. rewrite <- H4. simpl. rewrite <- H6 in H2. simpl in H2. apply in_app_iff in H2. destruct H2 as [H2 | H2]. apply in_app_iff. left. assumption. apply in_app_iff. right. apply in_cons. assumption. rewrite <- H4 in IHstep_star. simpl in IHstep_star. rewrite e0 in IHstep_star. simpl_override_in IHstep_star. simpl in IHstep_star. assumption. simpl_override. depremise IHstep_star. rewrite <- H4. simpl. rewrite <- H6 in H2. simpl in H2. apply in_app_iff in H2. destruct H2 as [H2 | H2]. apply in_app_iff. left. assumption. apply in_app_iff. right. apply in_cons. assumption. rewrite <- H4 in IHstep_star. simpl in IHstep_star. simpl_override_in IHstep_star. simpl in IHstep_star. assumption. subst c. subst sn. rewrite <- H5. simpl. destruct (eq_nat_dec n0 n). simpl_override. depremise IHstep_star. rewrite <- H3. simpl. rewrite <- H5 in H2. simpl in H2. assumption. rewrite <- H3 in IHstep_star. simpl in IHstep_star. rewrite e0 in IHstep_star. simpl_override_in IHstep_star. assumption. simpl_override. depremise IHstep_star. rewrite <- H3. simpl. rewrite <- H5 in H2. simpl in H2. assumption. rewrite <- H3 in IHstep_star. simpl in IHstep_star. simpl_override_in IHstep_star. assumption. Qed.
imports: Coq(FunctionalExtensionality List Bool) Coq(Arith Arith.Peano_dec Arith.Compare_dec) Coq(Program.Basics) Chapar(Predefs extralib KVStore)