fact
stringlengths
9
8.05k
type
stringclasses
16 values
library
stringclasses
1 value
imports
listlengths
1
7
filename
stringclasses
31 values
symbolic_name
stringlengths
1
70
docstring
stringclasses
1 value
dup_drop_step : list A -> list A -> Prop := | DDS_dup : forall l p, In p l -> dup_drop_step l (p :: l) | DDS_drop : forall xs p ys, dup_drop_step (xs ++ p :: ys) (xs ++ ys).
Inductive
theories
[ "From Coq Require Import List Relations Permutation.", "From StructTact Require Import StructTactics.", "From Verdi Require Import Net." ]
theories/Core/DupDropReordering.v
dup_drop_step
dup_drop_step_star := clos_refl_trans_n1 _ dup_drop_step.
Definition
theories
[ "From Coq Require Import List Relations Permutation.", "From StructTact Require Import StructTactics.", "From Verdi Require Import Net." ]
theories/Core/DupDropReordering.v
dup_drop_step_star
dup_drop_step_star_trans : forall l l' l'', dup_drop_step_star l l' -> dup_drop_step_star l' l'' -> dup_drop_step_star l l''. Proof using. intros. apply clos_rt_rtn1_iff. eapply rt_trans; apply clos_rt_rtn1_iff; eauto. Qed.
Lemma
theories
[ "From Coq Require Import List Relations Permutation.", "From StructTact Require Import StructTactics.", "From Verdi Require Import Net." ]
theories/Core/DupDropReordering.v
dup_drop_step_star_trans
dup_drop_step_star_step_n1 : forall l l' l'', dup_drop_step_star l l' -> dup_drop_step l' l'' -> dup_drop_step_star l l''. Proof using. intros. econstructor; eauto. Qed.
Lemma
theories
[ "From Coq Require Import List Relations Permutation.", "From StructTact Require Import StructTactics.", "From Verdi Require Import Net." ]
theories/Core/DupDropReordering.v
dup_drop_step_star_step_n1
dup_drop_step_star_step_1n : forall l l' l'', dup_drop_step l l' -> dup_drop_step_star l' l'' -> dup_drop_step_star l l''. Proof using. intros. apply clos_rt_rtn1_iff. apply clos_rt_rt1n_iff. econstructor; [eauto|]. apply clos_rt_rt1n_iff. apply clos_rt_rtn1_iff. auto. Qed.
Lemma
theories
[ "From Coq Require Import List Relations Permutation.", "From StructTact Require Import StructTactics.", "From Verdi Require Import Net." ]
theories/Core/DupDropReordering.v
dup_drop_step_star_step_1n
dup_drop_step_star_step_1 : forall l l', dup_drop_step l l' -> dup_drop_step_star l l'. Proof using. intros. eapply dup_drop_step_star_step_1n; eauto. constructor. Qed.
Lemma
theories
[ "From Coq Require Import List Relations Permutation.", "From StructTact Require Import StructTactics.", "From Verdi Require Import Net." ]
theories/Core/DupDropReordering.v
dup_drop_step_star_step_1
dup_drop_swap : forall l x y, dup_drop_step_star (x :: y :: l) (y :: x :: l). Proof using. intros. eapply dup_drop_step_star_step_1n; [eapply DDS_dup with (p := y); simpl; auto|]. eapply dup_drop_step_star_step_1n. eapply DDS_drop with (xs := [y; x]) (p := y) (ys := l). constructor. Qed.
Lemma
theories
[ "From Coq Require Import List Relations Permutation.", "From StructTact Require Import StructTactics.", "From Verdi Require Import Net." ]
theories/Core/DupDropReordering.v
dup_drop_swap
dup_drop_cons : forall l l' x, dup_drop_step_star l l' -> dup_drop_step_star (x :: l) (x :: l'). Proof using. induction 1. - constructor. - invc H. + eapply dup_drop_step_star_trans; [eauto|]. eapply dup_drop_step_star_step_1n; [eapply DDS_dup with (p := p); simpl; auto|]. auto using dup_drop_swap. + eapply dup_drop_step_star_trans; [eauto|]. eapply dup_drop_step_star_step_1n. eapply DDS_drop with (xs := x :: xs) (p := p) (ys := ys). constructor. Qed.
Lemma
theories
[ "From Coq Require Import List Relations Permutation.", "From StructTact Require Import StructTactics.", "From Verdi Require Import Net." ]
theories/Core/DupDropReordering.v
dup_drop_cons
dup_drop_Permutation : forall l l', Permutation l l' -> dup_drop_step_star l l'. Proof using. induction 1. - constructor. - auto using dup_drop_cons. - auto using dup_drop_swap. - eauto using dup_drop_step_star_trans. Qed.
Lemma
theories
[ "From Coq Require Import List Relations Permutation.", "From StructTact Require Import StructTactics.", "From Verdi Require Import Net." ]
theories/Core/DupDropReordering.v
dup_drop_Permutation
remove_not_in_nop : forall a l, ~ In a l -> remove A_eq_dec a l = l. Proof using. induction l; simpl; intuition. break_if; congruence. Qed.
Lemma
theories
[ "From Coq Require Import List Relations Permutation.", "From StructTact Require Import StructTactics.", "From Verdi Require Import Net." ]
theories/Core/DupDropReordering.v
remove_not_in_nop
dup_drop_in : forall l l' a, dup_drop_step_star l l' -> In a l' -> In a l. Proof using. induction 1; intros. - auto. - invc H. + simpl in *. intuition. subst. auto. + apply IHclos_refl_trans_n1. find_apply_lem_hyp in_app_or. intuition auto with datatypes. Qed.
Lemma
theories
[ "From Coq Require Import List Relations Permutation.", "From StructTact Require Import StructTactics.", "From Verdi Require Import Net." ]
theories/Core/DupDropReordering.v
dup_drop_in
dup_drop_dup_early : forall l l' a, dup_drop_step_star l l' -> In a l -> dup_drop_step_star l (a :: l'). Proof using. induction 1; intros. - apply dup_drop_step_star_step_1. constructor. auto. - concludes. eapply dup_drop_step_star_trans; eauto. apply dup_drop_cons. apply dup_drop_step_star_step_1. auto. Qed.
Lemma
theories
[ "From Coq Require Import List Relations Permutation.", "From StructTact Require Import StructTactics.", "From Verdi Require Import Net." ]
theories/Core/DupDropReordering.v
dup_drop_dup_early
dup_drop_step_star_remove_In : forall l' l a, In a l' -> dup_drop_step_star l (remove A_eq_dec a l') -> dup_drop_step_star (a :: l) l'. Proof using. induction l'; simpl; intuition. - subst. break_if; try congruence. destruct (in_dec A_eq_dec a0 l'). + find_apply_hyp_hyp. eapply dup_drop_step_star_trans; eauto. eapply dup_drop_step_star_step_1. apply DDS_dup; auto. + rewrite remove_not_in_nop in * by auto. apply dup_drop_cons. auto. - break_if. + subst. find_apply_hyp_hyp. eapply dup_drop_step_star_trans; eauto. eapply dup_drop_step_star_step_1. apply DDS_dup; auto. + pose proof dup_drop_in l _ a ltac:(eauto). try concludes. (* Only needed in Coq 8.5 *) eapply dup_drop_step_star_step_n1 in H0; [| eapply DDS_drop with (xs := [])]. simpl in *. apply IHl' in H0; auto. apply dup_drop_dup_early; auto. simpl. intuition. Qed.
Lemma
theories
[ "From Coq Require Import List Relations Permutation.", "From StructTact Require Import StructTactics.", "From Verdi Require Import Net." ]
theories/Core/DupDropReordering.v
dup_drop_step_star_remove_In
remove_In_elim : forall x a l, In x (remove A_eq_dec a l) -> x <> a /\ In x l. Proof using. induction l; simpl; intuition; break_if; subst; simpl in *; intuition. Qed.
Lemma
theories
[ "From Coq Require Import List Relations Permutation.", "From StructTact Require Import StructTactics.", "From Verdi Require Import Net." ]
theories/Core/DupDropReordering.v
remove_In_elim
dup_drop_reorder : forall l l' : list A, (forall x, In x l' -> In x l) -> dup_drop_step_star l l'. Proof using A_eq_dec. induction l; intros. - destruct l'. + constructor. + simpl in *. exfalso. eauto. - destruct (in_dec A_eq_dec a l'). + eapply dup_drop_step_star_remove_In. auto. apply IHl. intros. find_apply_lem_hyp remove_In_elim. intuition. find_apply_hyp_hyp. simpl in *. intuition. exfalso. eauto. + eapply dup_drop_step_star_step_1n. eapply DDS_drop with (xs := []). apply IHl. simpl in *. intros. find_copy_apply_hyp_hyp. intuition. subst. exfalso. eauto. Qed.
Lemma
theories
[ "From Coq Require Import List Relations Permutation.", "From StructTact Require Import StructTactics.", "From Verdi Require Import Net." ]
theories/Core/DupDropReordering.v
dup_drop_reorder
step_failure_dup_drop_step : forall ps ps' Sigma f, dup_drop_step_star _ ps ps' -> step_failure_star (f, mkNetwork ps Sigma) (f, mkNetwork ps' Sigma) []. Proof using. induction 1. - constructor. - match goal with | [ H : dup_drop_step _ _ _ |- _ ] => invc H end. + find_apply_lem_hyp in_split. break_exists. break_and. subst. apply refl_trans_n1_1n_trace. eapply RTn1TStep with (cs := []). * apply refl_trans_1n_n1_trace. apply IHclos_refl_trans_n1. * eapply StepFailure_dup; [simpl; eauto|]. auto. + apply refl_trans_n1_1n_trace. eapply RTn1TStep with (cs := []). * apply refl_trans_1n_n1_trace. apply IHclos_refl_trans_n1. * eapply StepFailure_drop; [simpl; eauto|]. auto. Qed.
Theorem
theories
[ "From Coq Require Import List Relations Permutation.", "From StructTact Require Import StructTactics.", "From Verdi Require Import Net." ]
theories/Core/DupDropReordering.v
step_failure_dup_drop_step
ordered_dynamic_uninitialized_state : forall net failed tr, step_ordered_dynamic_failure_star step_ordered_dynamic_failure_init (failed, net) tr -> forall n, ~ In n (odnwNodes net) -> odnwState net n = None. Proof using. move => net failed tr H. remember step_ordered_dynamic_failure_init as y in *. have ->: net = snd (failed, net) by []. move: Heqy. induction H using refl_trans_1n_trace_n1_ind => H_init /=; first by rewrite H_init. concludes => {H_init}. match goal with | [ H : step_ordered_dynamic_failure _ _ _ |- _ ] => invc H end; rewrite /=. - move => n H_in. rewrite /= in IHrefl_trans_1n_trace1. rewrite /update /=. have H_neq: h <> n by move => H_eq; case: H_in; left. have H_not_in: ~ In n (odnwNodes net0) by move => H_not_in; case: H_in; right. case name_eq_dec => H_dec; first by rewrite H_dec in H_neq. exact: IHrefl_trans_1n_trace1. - move => n H_in. rewrite /= in IHrefl_trans_1n_trace1. rewrite /update /=. have H_neq: n <> to by move => H_eq; rewrite H_eq in H_in. case name_eq_dec => H_dec //. exact: IHrefl_trans_1n_trace1. - move => n H_in. rewrite /= in IHrefl_trans_1n_trace1. rewrite /update. have H_neq: n <> h by move => H_eq; rewrite H_eq in H_in. case name_eq_dec => H_dec //. exact: IHrefl_trans_1n_trace1. - move => n H_in. rewrite /= in IHrefl_trans_1n_trace1. exact: IHrefl_trans_1n_trace1. Qed.
Lemma
theories
[ "From Verdi Require Import Verdi.", "From StructTact Require Import Update.", "From Coq Require Import FunctionalExtensionality.", "From Coq Require Import Sumbool Relation_Definitions RelationClasses.", "From Verdi Require Import Ssrexport." ]
theories/Core/DynamicNetLemmas.v
ordered_dynamic_uninitialized_state
ordered_dynamic_initialized_state : forall net failed tr, step_ordered_dynamic_failure_star step_ordered_dynamic_failure_init (failed, net) tr -> forall n, In n (odnwNodes net) -> exists d, odnwState net n = Some d. Proof using. move => net failed tr H. remember step_ordered_dynamic_failure_init as y in *. have ->: net = snd (failed, net) by []. move: Heqy. induction H using refl_trans_1n_trace_n1_ind => H_init /=; first by rewrite H_init. repeat find_rewrite. concludes => {H_init}. match goal with | [ H : step_ordered_dynamic_failure _ _ _ |- _ ] => invc H end; rewrite /=. - move => n H_in. case: H_in => H_in. rewrite -H_in /update. break_if => //. by exists (init_handlers h). have H_neq: n <> h by move => H_eq; rewrite H_eq in H_in. have [d H_eq] := IHrefl_trans_1n_trace1 _ H_in. exists d. rewrite /update /=. by break_if. - move => n H_in. rewrite /update. break_if; first by exists d'. have [d0 H_eq] := IHrefl_trans_1n_trace1 _ H_in. by exists d0. - move => n H_in. rewrite /update. break_if; first by exists d'. have [d0 H_eq] := IHrefl_trans_1n_trace1 _ H_in. by exists d0. - move => n H_in. exact: IHrefl_trans_1n_trace1. Qed.
Lemma
theories
[ "From Verdi Require Import Verdi.", "From StructTact Require Import Update.", "From Coq Require Import FunctionalExtensionality.", "From Coq Require Import Sumbool Relation_Definitions RelationClasses.", "From Verdi Require Import Ssrexport." ]
theories/Core/DynamicNetLemmas.v
ordered_dynamic_initialized_state
ordered_dynamic_failed_then_initialized : forall net failed tr, step_ordered_dynamic_failure_star step_ordered_dynamic_failure_init (failed, net) tr -> forall n, In n failed -> In n (odnwNodes net). Proof using. move => net failed tr H. remember step_ordered_dynamic_failure_init as y in *. have ->: failed = fst (failed, net) by []. have H_eq_o: net = snd (failed, net) by []. rewrite {2}H_eq_o {H_eq_o}. move: Heqy. induction H using refl_trans_1n_trace_n1_ind => H_init /=; first by rewrite H_init. repeat find_rewrite. concludes => {H_init}. match goal with | [ H : step_ordered_dynamic_failure _ _ _ |- _ ] => invc H end; rewrite /=. - move => n H_in. right. exact: IHrefl_trans_1n_trace1. - move => n H_in. exact: IHrefl_trans_1n_trace1. - move => n H_in. exact: IHrefl_trans_1n_trace1. - move => n H_in. case: H_in => H_in; first by rewrite -H_in. exact: IHrefl_trans_1n_trace1. Qed.
Lemma
theories
[ "From Verdi Require Import Verdi.", "From StructTact Require Import Update.", "From Coq Require Import FunctionalExtensionality.", "From Coq Require Import Sumbool Relation_Definitions RelationClasses.", "From Verdi Require Import Ssrexport." ]
theories/Core/DynamicNetLemmas.v
ordered_dynamic_failed_then_initialized
ordered_dynamic_state_not_initialized_not_failed : forall net failed tr, step_ordered_dynamic_failure_star step_ordered_dynamic_failure_init (failed, net) tr -> forall n, ~ In n (odnwNodes net) -> ~ In n failed. Proof using. move => net failed tr H. remember step_ordered_dynamic_failure_init as y in *. have ->: failed = fst (failed, net) by []. have H_eq_o: net = snd (failed, net) by []. rewrite {1}H_eq_o {H_eq_o}. move: Heqy. induction H using refl_trans_1n_trace_n1_ind => H_init /=; first by rewrite H_init. repeat find_rewrite. concludes => {H_init}. match goal with | [ H : step_ordered_dynamic_failure _ _ _ |- _ ] => invc H end; rewrite /=. - move => n H_in. have H_not_in: ~ In n (odnwNodes net0) by move => H_in'; case: H_in; right. exact: IHrefl_trans_1n_trace1. - move => n H_in. exact: IHrefl_trans_1n_trace1. - move => n H_in. exact: IHrefl_trans_1n_trace1. - move => n H_in. move => H_or. case: H_or => H_or; first by repeat find_rewrite. contradict H_or. exact: IHrefl_trans_1n_trace1. Qed.
Lemma
theories
[ "From Verdi Require Import Verdi.", "From StructTact Require Import Update.", "From Coq Require Import FunctionalExtensionality.", "From Coq Require Import Sumbool Relation_Definitions RelationClasses.", "From Verdi Require Import Ssrexport." ]
theories/Core/DynamicNetLemmas.v
ordered_dynamic_state_not_initialized_not_failed
ordered_dynamic_no_outgoing_uninitialized : forall onet failed tr, step_ordered_dynamic_failure_star step_ordered_dynamic_failure_init (failed, onet) tr -> forall n, ~ In n (odnwNodes onet) -> forall n', onet.(odnwPackets) n n' = []. Proof using. move => net failed tr H. remember step_ordered_dynamic_failure_init as y in *. have ->: net = snd (failed, net) by []. move: Heqy. induction H using refl_trans_1n_trace_n1_ind => H_init /=; first by rewrite H_init. concludes => {H_init}. match goal with | [ H : step_ordered_dynamic_failure _ _ _ |- _ ] => invc H end; rewrite /=. - move => n H_a n'. have H_neq: h <> n by eauto. have H_not_in: ~ In n (odnwNodes net0) by eauto. rewrite collate_ls_not_in; first by rewrite collate_neq //; eauto. apply: not_in_not_in_filter_rel. move => H_in. case: H_not_in. move: H_in. exact: in_remove_all_was_in. - move => n H_a n'. have H_neq: to <> n by move => H_eq; rewrite -H_eq in H_a. rewrite collate_neq //. rewrite /update2. case sumbool_and => H_and; last by eauto. break_and; repeat find_rewrite. simpl in *. have IH := IHrefl_trans_1n_trace1 _ H_a. by find_higher_order_rewrite. - move => n H_a n'. have H_neq: h <> n by move => H_eq; rewrite -H_eq in H_a. rewrite collate_neq //. by eauto. - move => n H_a n'. have H_neq: h <> n by move => H_eq; rewrite -H_eq in H_a. rewrite collate_neq //. by eauto. Qed.
Lemma
theories
[ "From Verdi Require Import Verdi.", "From StructTact Require Import Update.", "From Coq Require Import FunctionalExtensionality.", "From Coq Require Import Sumbool Relation_Definitions RelationClasses.", "From Verdi Require Import Ssrexport." ]
theories/Core/DynamicNetLemmas.v
ordered_dynamic_no_outgoing_uninitialized
ordered_dynamic_nodes_no_dup : forall onet failed tr, step_ordered_dynamic_failure_star step_ordered_dynamic_failure_init (failed, onet) tr -> NoDup (odnwNodes onet). Proof using. move => net failed tr H. remember step_ordered_dynamic_failure_init as y in *. have ->: net = snd (failed, net) by []. move: Heqy. induction H using refl_trans_1n_trace_n1_ind => H_init. rewrite H_init /=. exact: NoDup_nil. concludes => {H_init}. match goal with | [ H : step_ordered_dynamic_failure _ _ _ |- _ ] => invc H end; rewrite //=. exact: NoDup_cons. Qed.
Lemma
theories
[ "From Verdi Require Import Verdi.", "From StructTact Require Import Update.", "From Coq Require Import FunctionalExtensionality.", "From Coq Require Import Sumbool Relation_Definitions RelationClasses.", "From Verdi Require Import Ssrexport." ]
theories/Core/DynamicNetLemmas.v
ordered_dynamic_nodes_no_dup
GhostMultiParams `(P : MultiParams) := { ghost_data : Type; ghost_init : ghost_data ; ghost_net_handlers : name -> name -> msg -> (ghost_data * data) -> ghost_data; ghost_input_handlers : name -> input -> (ghost_data * data) -> ghost_data }.
Class
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
GhostMultiParams
refined_net_handlers me src m st := let '(out, st', ps) := net_handlers me src m (snd st) in (out, (ghost_net_handlers me src m st, st'), ps).
Definition
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
refined_net_handlers
refined_input_handlers me inp st := let '(out, st', ps) := input_handlers me inp (snd st) in (out, (ghost_input_handlers me inp st, st'), ps).
Definition
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
refined_input_handlers
refined_init_handlers (n : name) : ghost_data * data := (ghost_init, init_handlers n).
Definition
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
refined_init_handlers
refined_reboot (st : ghost_data * data) := (fst st , reboot (snd st)).
Definition
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
refined_reboot
refined_base_params : BaseParams := { data := (ghost_data * data)%type ; input := input ; output := output }.
Instance
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
refined_base_params
refined_multi_params : MultiParams _ := { name := name ; msg := msg ; msg_eq_dec := msg_eq_dec ; name_eq_dec := name_eq_dec ; nodes := nodes ; all_names_nodes := all_names_nodes ; no_dup_nodes := no_dup_nodes ; init_handlers := refined_init_handlers; net_handlers := refined_net_handlers ; input_handlers := refined_input_handlers }.
Instance
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
refined_multi_params
refined_failure_params : FailureParams _ := { reboot := refined_reboot }.
Instance
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
refined_failure_params
deghost_packet p := @mkPacket _ multi_params (@pSrc _ refined_multi_params p) (pDst p) (pBody p).
Definition
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
deghost_packet
deghost (net : @network _ refined_multi_params) : (@network _ multi_params). refine (@mkNetwork _ multi_params (map deghost_packet (nwPackets net)) _ ). intros. destruct net as [? nwState]. concludes. destruct nwState. auto. Defined. Arguments deghost_packet /_.
Definition
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
deghost
deghost_prop I (failed_net : list name * network) : Prop := I ((fst failed_net), deghost (snd failed_net)).
Definition
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
deghost_prop
refined_base_params_tot_map : BaseParamsTotalMap refined_base_params base_params := { tot_map_data := snd ; tot_map_input := id ; tot_map_output := id }.
Instance
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
refined_base_params_tot_map
refined_multi_params_name_tot_map : MultiParamsNameTotalMap refined_multi_params multi_params := { tot_map_name := id ; tot_map_name_inv := id }.
Instance
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
refined_multi_params_name_tot_map
refined_multi_params_name_tot_map_bijective : MultiParamsNameTotalMapBijective refined_multi_params_name_tot_map := { tot_map_name_inv_inverse := fun _ => eq_refl ; tot_map_name_inverse_inv := fun _ => eq_refl }.
Instance
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
refined_multi_params_name_tot_map_bijective
refined_multi_params_tot_msg_map : MultiParamsMsgTotalMap refined_multi_params multi_params := { tot_map_msg := id }.
Instance
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
refined_multi_params_tot_msg_map
Instance refined_multi_params_map_congruency : MultiParamsTotalMapCongruency refined_base_params_tot_map refined_multi_params_name_tot_map refined_multi_params_tot_msg_map := { tot_init_handlers_eq := fun _ => eq_refl ; tot_net_handlers_eq := _ ; tot_input_handlers_eq := _ }.
Program
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
Instance
Obligation . rewrite /tot_mapped_net_handlers /= /refined_net_handlers /= /tot_map_name_msgs /= /id /=. repeat break_let. find_inversion. by rewrite /= -/id map_id map_fst_snd_id. Qed.
Next
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
Obligation
Obligation . rewrite /tot_mapped_input_handlers /=. repeat break_let. unfold refined_input_handlers in *. repeat break_let. find_inversion. by rewrite /id /= map_id /tot_map_name_msgs /= /id /= map_fst_snd_id. Qed.
Next
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
Obligation
refined_failure_params_map_congruency : FailureParamsTotalMapCongruency refined_failure_params failure_params refined_base_params_tot_map := { tot_reboot_eq := fun _ => eq_refl }.
Instance
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
refined_failure_params_map_congruency
map_id_tr : forall out, map (fun e : name * (input + list output) => let (n, s) := e in match s with | inl io => (n, inl io) | inr lo => (n, inr (map id lo)) end) out = out. Proof using. elim => //. move => tr l IH. rewrite /= IH. break_let. break_match => //=. by rewrite map_id. Qed.
Lemma
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
map_id_tr
ghost_simulation_1 : forall net net' failed failed' out, @step_failure _ _ refined_failure_params (failed, net) (failed', net') out -> @step_failure _ _ failure_params (failed, deghost net) (failed', deghost net') out. Proof using. move => net net' failed failed' out H_step. apply step_failure_tot_mapped_simulation_1 in H_step. rewrite /tot_map_name /tot_map_net /= 2!map_id /id /= in H_step. rewrite /tot_map_trace_occ /= /id /= in H_step. rewrite /tot_map_packet /= /id /= in H_step. rewrite /deghost /=. rewrite -/id map_id_tr in H_step. move: H_step. set fp := fun p : packet => _. set fp' := fun p : packet => _. have H_eq: fp = fp' by rewrite /fp /fp'; apply functional_extensionality; case => /= src dst m. rewrite H_eq {H_eq fp}. set fs1 := fun n => _. set fs2 := fun n => _. set fs1' := fun n => _. set fs2' := fun n => _. have H_eq: fs1 = fs1' by rewrite /fs1 /fs1' {fs1 fs1'}; apply functional_extensionality => n; case: net. rewrite H_eq {H_eq fs1}. have H_eq: fs2 = fs2' by rewrite /fs2 /fs2' {fs2 fs2'}; apply functional_extensionality => n; case: net'. by rewrite H_eq {H_eq fs2}. Qed.
Theorem
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
ghost_simulation_1
ghost_simulation_2 : forall net net' failed failed' out gnet, @step_failure _ _ failure_params (failed, net) (failed', net') out -> deghost gnet = net -> exists gnet', step_failure (failed, gnet) (failed', gnet') out /\ deghost gnet' = net'. Proof using. move => net net' failed failed' out gnet H_step H_eq. eapply step_failure_tot_mapped_simulation_2 in H_step => //. - move: H_step => [gnet' [H_step H_eq_net]]. exists gnet'. split; eauto. rewrite -H_eq_net {H_eq_net H_step}. rewrite /deghost /tot_map_net /= /id /= /tot_map_packet /= /id /=. set nwPf1 := fun p : packet => _. set nwPf2 := fun p : packet => _. have H_eq_p: nwPf1 = nwPf2 by rewrite /nwPf1 /nwPf2 {nwPf1 nwPf2}; apply functional_extensionality; case. set nwS1 := fun _ => _. set nwS2 := fun _ => _. have H_eq_s: nwS1 = nwS2 by rewrite /nwS1 /nwS2 {nwS1 nwS2}; apply functional_extensionality => n; case: gnet'. by rewrite H_eq_p H_eq_s. - rewrite -H_eq {H_step H_eq}. rewrite /deghost /tot_map_net /= /id /= /tot_map_packet /= /id /=. set nwPf1 := fun p : packet => _. set nwPf2 := fun p : packet => _. have H_eq_p: nwPf1 = nwPf2 by rewrite /nwPf1 /nwPf2 {nwPf1 nwPf2}; apply functional_extensionality; case. set nwS1 := fun _ => _. set nwS2 := fun _ => _. have H_eq_s: nwS1 = nwS2 by rewrite /nwS1 /nwS2 {nwS1 nwS2}; apply functional_extensionality => n; case: gnet. by rewrite H_eq_p H_eq_s. - by rewrite /tot_map_name /= map_id. - by rewrite /tot_map_name /= map_id. - move {H_step}. elim: out => //. case => n t out IH. case: t => /=; first by move => inp; rewrite /id /= IH. move => out'. by rewrite {1}/id map_id /= IH. Qed.
Theorem
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
ghost_simulation_2
ghost_packet p := @mkPacket _ refined_multi_params (@pSrc _ multi_params p) (pDst p) (pBody p).
Definition
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
ghost_packet
reghost (net : @network _ multi_params) : @network _ refined_multi_params. refine (@mkNetwork _ refined_multi_params (map ghost_packet (nwPackets net)) _ ). intros. destruct net as [? nwState]. concludes. exact (ghost_init, nwState). Defined. Arguments ghost_packet /_.
Definition
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
reghost
reghost_deghost_partial_inverses : forall net, deghost (reghost net) = net. Proof using. destruct net. unfold deghost, reghost. simpl in *. f_equal. rewrite map_map. map_id. Qed.
Lemma
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
reghost_deghost_partial_inverses
ghost_invariant_lift : forall P : _ -> Prop, (forall net net' failed failed' out, @step_failure _ _ failure_params (failed, net) (failed', net') out -> P net -> P net') -> (forall net net' failed failed' out, step_failure (failed, net) (failed', net') out -> P (deghost net) -> P (deghost net')). Proof using. intros. eauto using ghost_simulation_1. Qed.
Theorem
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
ghost_invariant_lift
ghost_invariant_lower : forall P : _ -> Prop, (forall net net' failed failed' out, step_failure (failed, net) (failed', net') out -> P (deghost net) -> P (deghost net')) -> (forall net net' failed failed' out, @step_failure _ _ failure_params (failed, net) (failed', net') out -> P net -> P net'). Proof using. intros. apply ghost_simulation_2 with (gnet := reghost net) in H0. - break_exists. intuition. subst. eapply H; eauto. rewrite reghost_deghost_partial_inverses. auto. - eauto using reghost_deghost_partial_inverses. Qed.
Theorem
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
ghost_invariant_lower
MsgGhostMultiParams `(P : MultiParams) := { ghost_msg : Type; ghost_msg_eq_dec : forall x y : ghost_msg, {x = y} + {x <> y} ; ghost_msg_default : ghost_msg ; write_ghost_msg : name -> data -> ghost_msg }.
Class
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
MsgGhostMultiParams
add_ghost_msg (me : name) (st : data) (ps : list (name * msg)) : list (name * (ghost_msg * msg)) := map (fun m => (fst m, (write_ghost_msg me st, snd m))) ps.
Definition
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
add_ghost_msg
mgv_refined_net_handlers me src (m : ghost_msg * msg) st := let '(out, st', ps) := net_handlers me src (snd m) st in (out, st', add_ghost_msg me st' ps).
Definition
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
mgv_refined_net_handlers
mgv_refined_input_handlers me inp st := let '(out, st', ps) := input_handlers me inp st in (out, st', add_ghost_msg me st' ps).
Definition
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
mgv_refined_input_handlers
mgv_msg_eq_dec : forall x y : ghost_msg * msg, {x = y} + {x <> y}. Proof using. intros. decide equality; auto using msg_eq_dec, ghost_msg_eq_dec. Qed.
Definition
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
mgv_msg_eq_dec
mgv_refined_base_params : BaseParams := { data := data ; input := input ; output := output }.
Instance
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
mgv_refined_base_params
mgv_refined_multi_params : MultiParams _ := { name := name ; msg := (ghost_msg * msg) ; msg_eq_dec := mgv_msg_eq_dec ; name_eq_dec := name_eq_dec ; nodes := nodes ; all_names_nodes := all_names_nodes ; no_dup_nodes := no_dup_nodes ; init_handlers := init_handlers; net_handlers := mgv_refined_net_handlers ; input_handlers := mgv_refined_input_handlers }.
Instance
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
mgv_refined_multi_params
mgv_refined_failure_params : FailureParams _ := { reboot := (@reboot base_params multi_params failure_params) }.
Instance
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
mgv_refined_failure_params
mgv_deghost_packet p := @mkPacket _ multi_params (@pSrc _ mgv_refined_multi_params p) (pDst p) (snd (pBody p)).
Definition
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
mgv_deghost_packet
mgv_deghost (net : @network _ mgv_refined_multi_params) : (@network _ multi_params). refine (@mkNetwork _ multi_params (map mgv_deghost_packet (nwPackets net)) _ ). intros. destruct net. concludes. auto. Defined. Arguments mgv_deghost_packet /_.
Definition
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
mgv_deghost
mgv_refined_base_params_tot_map : BaseParamsTotalMap mgv_refined_base_params base_params := { tot_map_data := id ; tot_map_input := id ; tot_map_output := id }.
Instance
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
mgv_refined_base_params_tot_map
mgv_refined_multi_params_name_tot_map : MultiParamsNameTotalMap mgv_refined_multi_params multi_params := { tot_map_name := id ; tot_map_name_inv := id ; }.
Instance
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
mgv_refined_multi_params_name_tot_map
mgv_refined_multi_params_name_tot_map_bijective : MultiParamsNameTotalMapBijective mgv_refined_multi_params_name_tot_map := { tot_map_name_inv_inverse := fun _ => eq_refl ; tot_map_name_inverse_inv := fun _ => eq_refl }.
Instance
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
mgv_refined_multi_params_name_tot_map_bijective
mgv_refined_multi_params_tot_map : MultiParamsMsgTotalMap mgv_refined_multi_params multi_params := { tot_map_msg := snd ; }.
Instance
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
mgv_refined_multi_params_tot_map
Instance mgv_refined_multi_params_map_congruency : MultiParamsTotalMapCongruency mgv_refined_base_params_tot_map mgv_refined_multi_params_name_tot_map mgv_refined_multi_params_tot_map := { tot_init_handlers_eq := fun _ => eq_refl ; tot_net_handlers_eq := _ ; tot_input_handlers_eq := _ }.
Program
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
Instance
Obligation . rewrite /tot_mapped_net_handlers /= /mgv_refined_net_handlers /= /tot_map_name_msgs /= /id /=. repeat break_let. find_inversion. rewrite -/id map_id /= /add_ghost_msg /=. elim l0 => //=. case => n m' l IH. find_inversion. by find_rewrite; find_rewrite. Qed.
Next
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
Obligation
Obligation . rewrite /tot_mapped_input_handlers /=. repeat break_let. rewrite map_id /id /=. unfold mgv_refined_input_handlers in *. repeat break_let. find_inversion. elim l1 => //=. case => n m l. move => IH. find_inversion. by find_rewrite; find_rewrite. Qed.
Next
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
Obligation
mgv_refined_failure_params_map_congruency : FailureParamsTotalMapCongruency mgv_refined_failure_params failure_params mgv_refined_base_params_tot_map := { tot_reboot_eq := fun _ => eq_refl }.
Instance
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
mgv_refined_failure_params_map_congruency
mgv_map_id_tr : forall out, map (fun e : name * (input + list output) => let (n, s) := e in match s with | inl io => (n, inl io) | inr lo => (n, inr (map id lo)) end) out = out. Proof using. elim => //. move => tr l IH. rewrite /= IH. break_let. break_match => //. by rewrite map_id. Qed.
Lemma
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
mgv_map_id_tr
mgv_ghost_simulation_1 : forall net net' failed failed' out, @step_failure _ _ mgv_refined_failure_params (failed, net) (failed', net') out -> @step_failure _ _ failure_params (failed, mgv_deghost net) (failed', mgv_deghost net') out. Proof using. move => net net' failed failed' out H_step. apply step_failure_tot_mapped_simulation_1 in H_step. rewrite /tot_map_name /tot_map_net /= 2!map_id /id /= in H_step. rewrite /tot_map_trace_occ /= /id /= in H_step. rewrite /tot_map_packet /= /id /= in H_step. rewrite /mgv_deghost /=. rewrite -/id mgv_map_id_tr in H_step. move: H_step. set fp := fun p : packet => _. set fp' := fun p : packet => _. have H_eq: fp = fp' by rewrite /fp /fp'; apply functional_extensionality; case => /= src dst m. rewrite H_eq {H_eq fp}. set fs1 := fun n => _. set fs2 := fun n => _. set fs1' := fun n => _. set fs2' := fun n => _. have H_eq: fs1 = fs1' by rewrite /fs1 /fs1' {fs1 fs1'}; apply functional_extensionality => n; case: net. rewrite H_eq {H_eq fs1}. have H_eq: fs2 = fs2' by rewrite /fs2 /fs2' {fs2 fs2'}; apply functional_extensionality => n; case: net'. by rewrite H_eq. Qed.
Theorem
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
mgv_ghost_simulation_1
mgv_ghost_packet p := @mkPacket _ mgv_refined_multi_params (@pSrc _ multi_params p) (pDst p) (ghost_msg_default, pBody p).
Definition
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
mgv_ghost_packet
mgv_reghost (net : @network _ multi_params) : @network _ mgv_refined_multi_params. refine (@mkNetwork _ mgv_refined_multi_params (map mgv_ghost_packet (nwPackets net)) _ ). intros. destruct net. concludes. auto. Defined. Arguments mgv_ghost_packet /_.
Definition
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
mgv_reghost
mgv_reghost_deghost_partial_inverses : forall net, mgv_deghost (mgv_reghost net) = net. Proof using. destruct net. unfold mgv_deghost, mgv_reghost. simpl in *. f_equal. rewrite map_map. map_id. Qed.
Lemma
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
mgv_reghost_deghost_partial_inverses
mgv_ghost_simulation_2 : forall net net' failed failed' out gnet, @step_failure _ _ failure_params (failed, net) (failed', net') out -> mgv_deghost gnet = net -> exists gnet', step_failure (failed, gnet) (failed', gnet') out /\ mgv_deghost gnet' = net'. Proof using. move => net net' failed failed' out gnet H_step H_eq. eapply step_failure_tot_mapped_simulation_2 in H_step => //. - move: H_step => [gnet' [H_step H_eq_net]]. exists gnet'. split; eauto. rewrite -H_eq_net {H_step H_eq_net}. rewrite /mgv_deghost /tot_map_net /= /id /= /tot_map_packet /= /id /=. set nwPf1 := fun p : packet => _. set nwPf2 := fun p : packet => _. have H_eq_p: nwPf1 = nwPf2 by rewrite /nwPf1 /nwPf2 {nwPf1 nwPf2}; apply functional_extensionality; case. set nwS1 := fun _ => _. set nwS2 := fun _ => _. have H_eq_s: nwS1 = nwS2 by rewrite /nwS1 /nwS2 {nwS1 nwS2}; apply functional_extensionality => n; case: gnet'. by rewrite H_eq_p H_eq_s. - rewrite -H_eq {H_step H_eq}. rewrite /mgv_deghost /tot_map_net /= /id /= /tot_map_packet /= /id /=. set nwPf1 := fun p : packet => _. set nwPf2 := fun p : packet => _. have H_eq_p: nwPf1 = nwPf2 by rewrite /nwPf1 /nwPf2 {nwPf1 nwPf2}; apply functional_extensionality; case. set nwS1 := fun _ => _. set nwS2 := fun _ => _. have H_eq_s: nwS1 = nwS2 by rewrite /nwS1 /nwS2 {nwS1 nwS2}; apply functional_extensionality => n; case: gnet. by rewrite H_eq_p H_eq_s. - by rewrite /tot_map_name /= map_id. - by rewrite /tot_map_name /= map_id. - move {H_step}. elim: out => //. case => n t out IH. case: t => /=; first by move => inp; rewrite /id /= IH. move => out'. by rewrite {1}/id map_id /= IH. Qed.
Theorem
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
mgv_ghost_simulation_2
mgv_ghost_invariant_lift : forall P : _ -> Prop, (forall net net' failed failed' out, @step_failure _ _ failure_params (failed, net) (failed', net') out -> P net -> P net') -> (forall net net' failed failed' out, step_failure (failed, net) (failed', net') out -> P (mgv_deghost net) -> P (mgv_deghost net')). Proof using. intros. eauto using mgv_ghost_simulation_1. Qed.
Theorem
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
mgv_ghost_invariant_lift
mgv_ghost_invariant_lower : forall P : _ -> Prop, (forall net net' failed failed' out, step_failure (failed, net) (failed', net') out -> P (mgv_deghost net) -> P (mgv_deghost net')) -> (forall net net' failed failed' out, @step_failure _ _ failure_params (failed, net) (failed', net') out -> P net -> P net'). Proof using. intros. apply mgv_ghost_simulation_2 with (gnet := mgv_reghost net) in H0. - break_exists. intuition. subst. eapply H; eauto. rewrite mgv_reghost_deghost_partial_inverses. auto. - eauto using mgv_reghost_deghost_partial_inverses. Qed.
Theorem
theories
[ "From Coq Require Import List.", "From StructTact Require Import StructTactics Util.", "From Verdi Require Import Net TotalMapSimulations.", "From Coq Require Import FunctionalExtensionality.", "From Verdi Require Import Ssrexport." ]
theories/Core/GhostSimulations.v
mgv_ghost_invariant_lower
GenHandler (W S O A : Type) : Type := S -> A * list O * S * list W % type.
Definition
theories
[ "From Coq Require Import List." ]
theories/Core/HandlerMonad.v
GenHandler
ret {W S O A : Type} (a : A) : GenHandler W S O A := fun s => (a, [], s, []).
Definition
theories
[ "From Coq Require Import List." ]
theories/Core/HandlerMonad.v
ret
bind {W S O A B : Type} (m : GenHandler W S O A) (f : A -> GenHandler W S O B) : GenHandler W S O B := fun s => let '(a, os1, s', ws1) := m s in let '(b, os2, s'', ws2) := f a s' in (b, os1 ++ os2, s'', ws1 ++ ws2).
Definition
theories
[ "From Coq Require Import List." ]
theories/Core/HandlerMonad.v
bind
send {W S O} (w : W) : GenHandler W S O unit := fun s => (tt, [], s, [w]).
Definition
theories
[ "From Coq Require Import List." ]
theories/Core/HandlerMonad.v
send
write_output {W S O} (o : O) : GenHandler W S O unit := fun s => (tt, [o], s, []).
Definition
theories
[ "From Coq Require Import List." ]
theories/Core/HandlerMonad.v
write_output
modify {W S O} (f : S -> S) : GenHandler W S O unit := fun s => (tt, [], f s, []).
Definition
theories
[ "From Coq Require Import List." ]
theories/Core/HandlerMonad.v
modify
put {W S O} (s : S) : GenHandler W S O unit := fun _ => (tt, [], s, []).
Definition
theories
[ "From Coq Require Import List." ]
theories/Core/HandlerMonad.v
put
get {W S O} : GenHandler W S O S := fun s => (s, [], s, []).
Definition
theories
[ "From Coq Require Import List." ]
theories/Core/HandlerMonad.v
get
runGenHandler {W S O A} (s : S) (h : GenHandler W S O A) : A * list O * S * list W % type := h s.
Definition
theories
[ "From Coq Require Import List." ]
theories/Core/HandlerMonad.v
runGenHandler
runGenHandler_ignore {W S O A} (s : S) (h : GenHandler W S O A) : list O * S * list W % type := let '(_, os, s', ms) := h s in (os, s', ms). (* for single node semantics *)
Definition
theories
[ "From Coq Require Import List." ]
theories/Core/HandlerMonad.v
runGenHandler_ignore
runGenHandler1_ignore {W S O A} (h : GenHandler W S O A) (s : S) : list O * S := let '(_, os, d, _) := runGenHandler s h in (os, d).
Definition
theories
[ "From Coq Require Import List." ]
theories/Core/HandlerMonad.v
runGenHandler1_ignore
nop {W S O : Type} := @ret W S O _ tt.
Definition
theories
[ "From Coq Require Import List." ]
theories/Core/HandlerMonad.v
nop
when {W S O A} (b : bool) (m : GenHandler W S O A) : GenHandler W S O unit := if b then m ;; ret tt else nop.
Definition
theories
[ "From Coq Require Import List." ]
theories/Core/HandlerMonad.v
when
monad_unfold := repeat unfold runGenHandler_ignore, runGenHandler, runGenHandler1_ignore, bind, send, write_output, get, when, put, nop, modify, ret in *.
Ltac
theories
[ "From Coq Require Import List." ]
theories/Core/HandlerMonad.v
monad_unfold
InverseTraceRelation `{State : Type} `{Event : Type} (step : step_relation State Event) := { init : State; T : (list Event) -> Prop; R : State -> Prop; R_dec : forall s, {R s} + {~ R s}; T_monotonic : forall tr o, T tr -> T (tr ++ o); R_false_init : ~ R init; R_implies_T : forall s s' o tr, refl_trans_1n_trace step init s tr -> ~ R s -> step s s' o -> R s' -> T (tr ++ o) }.
Class
theories
[ "From Coq Require Import List.", "From Verdi Require Import Net.", "From StructTact Require Import StructTactics." ]
theories/Core/InverseTraceRelations.v
InverseTraceRelation
inverse_trace_relations_work : forall s tr, refl_trans_1n_trace step init s tr -> R s -> T tr. Proof using. intros. find_apply_lem_hyp refl_trans_1n_n1_trace. remember init as s'. induction H. - subst. exfalso. pose R_false_init; auto. - subst. concludes. destruct (R_dec x'); intuition eauto using T_monotonic, refl_trans_n1_1n_trace, R_implies_T. Qed.
Theorem
theories
[ "From Coq Require Import List.", "From Verdi Require Import Net.", "From StructTact Require Import StructTactics." ]
theories/Core/InverseTraceRelations.v
inverse_trace_relations_work
LabeledMultiParams (P : BaseParams) := { lb_name : Type ; lb_msg : Type ; lb_msg_eq_dec : forall x y : lb_msg, {x = y} + {x <> y} ; lb_name_eq_dec : forall x y : lb_name, {x = y} + {x <> y} ; lb_nodes : list lb_name ; lb_all_names_nodes : forall n, In n lb_nodes ; lb_no_dup_nodes : NoDup lb_nodes ; label : Type ; label_silent : label ; lb_init_handlers : lb_name -> data ; lb_net_handlers : lb_name -> lb_name -> lb_msg -> data -> label * (list output) * data * list (lb_name * lb_msg) ; lb_input_handlers : lb_name -> input -> data -> label * (list output) * data * list (lb_name * lb_msg) }.
Class
theories
[ "From Verdi Require Import Verdi.", "From InfSeqExt Require Import infseq exteq.", "From Verdi Require Import Ssrexport." ]
theories/Core/LabeledNet.v
LabeledMultiParams
unlabeled_net_handlers me src m st := let '(lb, out, st', ps) := lb_net_handlers me src m st in (out, st', ps).
Definition
theories
[ "From Verdi Require Import Verdi.", "From InfSeqExt Require Import infseq exteq.", "From Verdi Require Import Ssrexport." ]
theories/Core/LabeledNet.v
unlabeled_net_handlers
unlabeled_input_handlers me inp st := let '(lb, out, st', ps) := lb_input_handlers me inp st in (out, st', ps). Global Instance unlabeled_multi_params : MultiParams base_params := { name := lb_name ; msg := lb_msg ; msg_eq_dec := lb_msg_eq_dec ; name_eq_dec := lb_name_eq_dec ; nodes := lb_nodes ; all_names_nodes := lb_all_names_nodes ; no_dup_nodes := lb_no_dup_nodes ; init_handlers := lb_init_handlers; net_handlers := unlabeled_net_handlers ; input_handlers := unlabeled_input_handlers }.
Definition
theories
[ "From Verdi Require Import Verdi.", "From InfSeqExt Require Import infseq exteq.", "From Verdi Require Import Ssrexport." ]
theories/Core/LabeledNet.v
unlabeled_input_handlers
lb_step_relation := A -> L -> A -> list trace -> Prop.
Definition
theories
[ "From Verdi Require Import Verdi.", "From InfSeqExt Require Import infseq exteq.", "From Verdi Require Import Ssrexport." ]
theories/Core/LabeledNet.v
lb_step_relation
lb_step_ex (step : lb_step_relation) (l : L) (a : A) : Prop := exists a' tr, step a l a' tr.
Definition
theories
[ "From Verdi Require Import Verdi.", "From InfSeqExt Require Import infseq exteq.", "From Verdi Require Import Ssrexport." ]
theories/Core/LabeledNet.v
lb_step_ex
event := { evt_a : A ; evt_l : L ; evt_trace : list trace }.
Record
theories
[ "From Verdi Require Import Verdi.", "From InfSeqExt Require Import infseq exteq.", "From Verdi Require Import Ssrexport." ]
theories/Core/LabeledNet.v
event
enabled (step : lb_step_relation) (l : L) (e : event) : Prop := lb_step_ex step l (evt_a e).
Definition
theories
[ "From Verdi Require Import Verdi.", "From InfSeqExt Require Import infseq exteq.", "From Verdi Require Import Ssrexport." ]
theories/Core/LabeledNet.v
enabled
occurred (l : L) (e : event) : Prop := l = evt_l e.
Definition
theories
[ "From Verdi Require Import Verdi.", "From InfSeqExt Require Import infseq exteq.", "From Verdi Require Import Ssrexport." ]
theories/Core/LabeledNet.v
occurred
inf_enabled (step : lb_step_relation) (l : L) (s : infseq event) : Prop := inf_often (now (enabled step l)) s.
Definition
theories
[ "From Verdi Require Import Verdi.", "From InfSeqExt Require Import infseq exteq.", "From Verdi Require Import Ssrexport." ]
theories/Core/LabeledNet.v
inf_enabled