proposition: Lemma reachable_by_through_app_strong: forall (g: PreGraph V E) P l1 l2, (forall n, reachable_by_through_set g l1 P n \/ ~ reachable_by_through_set g l1 P n) -> (forall n, reachable_by_through_set g (l1 ++ l2) P n <-> reachable_by_through_set g l1 P n \/ reachable_by_through_set (predicate_partialgraph g (Complement _ (reachable_by_through_set g l1 P))) l2 P n).
proof: Proof. intros. rewrite reachable_by_through_app. destruct (H n); [tauto |]. apply or_iff_compat_l. split; intros. + destruct H1 as [m [? ?]]. exists m; split; auto. assert (forall m, g |= m ~o~> n satisfying P -> ~ reachable_by_through_set g l1 P m). 1: { intros m0 ? [s [? ?]]. apply H0; exists s. split; auto. apply reachable_by_trans with m0; auto. } rewrite reachable_by_eq_partialgraph_reachable in H2 |- *. rewrite partial_partialgraph. clear H1. rewrite reachable_ind_reachable in H2. induction H2. - destruct (H x); [tauto |]. apply reachable_refl. simpl. split; [destruct H1; auto |]. rewrite Intersection_spec. split; [auto | destruct H1; auto]. - assert (Complement V (reachable_by_through_set g l1 P) x). 1: { apply H3. rewrite reachable_by_eq_partialgraph_reachable, reachable_ind_reachable. apply ind.reachable_cons with y; auto. } assert (vvalid (predicate_partialgraph g (Intersection V (Complement V (reachable_by_through_set g l1 P)) P)) x). 1: { split; [destruct H1 as [[? _] _]; auto |]. rewrite Intersection_spec. split; [auto | destruct H1 as [[_ ?] _]; auto]. } assert ((predicate_partialgraph g (Intersection V (Complement V (reachable_by_through_set g l1 P)) P)) ~=~ (predicate_partialgraph (predicate_partialgraph g P) (Complement V (reachable_by_through_set g l1 P)))) by (rewrite Intersection_comm, partial_partialgraph; reflexivity). apply step_reachable with y; [| auto | auto]. rewrite (step_si _ _ _ _ H6). apply partialgraph_step; [destruct H1 as [? [? ?]]; auto | auto]. + destruct H1 as [s [? ?]]; exists s; split; auto. rewrite reachable_by_eq_partialgraph_reachable in H2 |- *. rewrite partial_partialgraph, Intersection_comm, <- partial_partialgraph, <- reachable_by_eq_partialgraph_reachable in H2. apply reachable_by_is_reachable in H2; auto. Qed.
imports: Coq.Arith.Arith Coq.Logic.ProofIrrelevance Coq.Logic.FunctionalExtensionality Coq.Classes.Morphisms Coq.Classes.Equivalence CertiGraph.lib.Coqlib CertiGraph.lib.Ensembles_ext CertiGraph.lib.relation_list CertiGraph.lib.List_ext CertiGraph.lib.Equivalence_ext CertiGraph.lib.EquivDec_ext VST.msl.Coqlib2 CertiGraph.graph.graph_model CertiGraph.graph.path_lemmas CertiGraph.graph.reachable_ind CertiGraph.graph.graph_gen CertiGraph.graph.graph_relation