proposition: Lemma restricted_map_Znth_same: forall {A} {d: Inhabitant A} (f: A->A) ps l i, (forall e, In e ps -> 0 <= e < Zlength l) -> NoDup ps -> In i ps -> Znth i (restricted_map f l ps) = f (Znth i l).
proof: Proof. do 3 intro. unfold restricted_map. induction ps; intros. 1: inversion H1. simpl. simpl in H1. assert (Zlength (upd_Znth a l (f (Znth a l))) = Zlength l). { rewrite upd_Znth_Zlength; auto. apply H. now left. } destruct H1. - subst i. rewrite fold_left_upd_Znth_diff. + rewrite upd_Znth_same; auto. apply H. now left. + apply NoDup_cons_2 in H0. assumption. + rewrite H2. apply H. now left. - rewrite IHps; auto. + rewrite upd_Znth_diff; auto; [apply H; now right | apply H; now left |]. apply NoDup_cons_2 in H0. intro. apply H0. subst i. assumption. + intros. rewrite H2. apply H. now right. + apply NoDup_cons_1 in H0. assumption. Qed.
imports: Coq.ZArith.ZArith Coq.Program.Basics compcert.lib.Integers compcert.common.Values VST.veric.base VST.veric.Clight_lemmas VST.veric.val_lemmas VST.veric.shares VST.msl.seplog VST.msl.shares VST.zlist.sublist VST.floyd.coqlib3 VST.floyd.functional_base VST.floyd.data_at_rec_lemmas CertiGraph.lib.Coqlib CertiGraph.lib.EquivDec_ext CertiGraph.lib.List_ext CertiGraph.graph.graph_model CertiGraph.graph.graph_gen CertiGraph.graph.path_lemmas CertiGraph.graph.subgraph2 CertiGraph.graph.graph_relation CertiGraph.graph.graph_isomorphism CertiGraph.graph.reachable_ind CertiGraph.CertiGC.GCGraph