proposition: Lemma frr_dsr_quasi_iso: forall from to roots1 roots2 g1 g2 g3, from <> to -> sound_gc_graph g1 -> graph_has_gen g1 to -> graph_unmarked g1 -> roots_graph_compatible roots1 g1 -> no_dangling_dst g1 -> forward_roots_relation from to roots1 g1 roots2 g2 -> do_scan_relation from to (number_of_vertices (nth_gen g1 to)) g2 g3 -> no_edge2gen g1 from -> gc_graph_quasi_iso g1 roots1 g3 roots2 from to.
proof: Proof. pose (H3:=True). intros from to roots1 roots2 g1 g2 g3 H H0 H1 H2 H4 H5 H6 H7 Hn. pose proof H6. assert (Hc: copy_compatible g1) by (now apply graph_unmarked_copy_compatible). apply frr_semi_iso in H6; auto. 2: rewrite graph_gen_unmarked_iff in H2; apply H2. destruct H6 as [l1 [? ?]]. assert (sound_gc_graph g2) by (eapply frr_sound; eauto). pose proof H7. destruct H7 as [n [? ?]]. eapply (svwl_semi_iso _ _ _ _ roots2 g1) in H7; eauto. - destruct H7 as [l2 [? ?]]. rewrite H9 in H13 at 2. rewrite (surjective (roots_map l1) (roots_map l1)) in H13. 2: apply roots_map_bijective; eapply semi_iso_DoubleNoDup; eauto. assert (graph_has_gen g2 to) by (rewrite <- frr_graph_has_gen; eauto). assert (sound_gc_graph g3) by (eapply dsr_P_holds; eauto; apply fr_O_sound). assert (forall v, vvalid g1 v /\ vgeneration v = from <-> vvalid g3 v /\ vgeneration v = from). { destruct H0 as [? _]. red in H0. destruct H15 as [? _]. red in H15. destruct H11 as [? [? ?]]. intros; split; intros; destruct H17; split; auto. - rewrite H0 in H17. eapply frr_graph_has_v in H17; eauto. eapply svwl_graph_has_v in H17; eauto. now rewrite H15. - rewrite H15 in H17. apply svwl_graph_has_v_inv with (v := v) in H11; auto. destruct H11 as [? | [? ?]]. 2: rewrite H11 in H18; now rewrite H18 in H. apply frr_graph_has_v_inv with (v := v) in H8; auto. destruct H8 as [?|[? ?]]. 2: rewrite H8 in H18; now rewrite H18 in H. now rewrite H0. } eapply semi_quasi_iso; eauto. red. intros. unfold roots_reachable_in_gen, marked_in_gen. rewrite H16. eapply frr_dsr_reachable_iff_marked; eauto. - rewrite <- frr_graph_has_gen; eauto. - eapply frr_roots_graph_compatible; eauto. - eapply frr_no_dangling_dst; eauto. - eapply frr_not_pointing; eauto. eapply frr_Zlength_roots; eauto. - intros. rewrite nat_seq_In_iff in H13. unfold gen_has_index. lia. - eapply frr_copy_compatible; eauto. - eapply frr_gen_unmarked; eauto. rewrite graph_gen_unmarked_iff in H2; apply H2. 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