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) -> idempotent f -> 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 in *. assert (Zlength (upd_Znth a l (f (Znth a l))) = Zlength l). { rewrite upd_Znth_Zlength; auto. } assert (forall e : Z, In e ps -> 0 <= e < Zlength (upd_Znth a l (f (Znth a l)))) by (intros; rewrite H2; apply H; now right). destruct H1. - subst i. destruct (in_dec Z.eq_dec a ps). + rewrite IHps; auto. rewrite upd_Znth_same; auto. + rewrite fold_left_upd_Znth_diff; auto. 2: rewrite H2; auto. rewrite upd_Znth_same; auto. - rewrite IHps; auto. destruct (Z.eq_dec i a). + subst. rewrite upd_Znth_same; auto. + rewrite upd_Znth_diff; auto. 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