Section SeqNumCorrect.
Context {orig_base_params : BaseParams}.
Context {orig_multi_params : MultiParams orig_base_params}.
Proof using.
induction l; intros; simpl in *.
- find_inversion. simpl in *. intuition.
- break_match. find_inversion. simpl in *. intuition.
+ subst. simpl. lia.
+ eauto using le_gt_trans, le_plus_l.
Qed.
Proof using.
induction l; intros; simpl in *.
- intros. find_inversion. intuition.
- break_match. find_inversion.
find_insterU. find_insterU. conclude_using eauto.
lia.
Qed.
Proof using.
induction l; intros; simpl in *.
- invcs H. intuition.
- break_match.
invcs H. intuition.
+ subst. simpl.
apply processPackets_num_monotonic in Heqp0. intuition.
+ specialize (IHl n0 l0). apply IHl; auto.
Qed.
Proof using.
induction l; intros; simpl in *.
- invcs H. intuition.
- break_match. invcs H.
intuition.
+ subst. intuition.
+ subst. simpl in *.
apply processPackets_correct with (p := p) in Heqp0; intuition.
+ subst. simpl in *.
apply processPackets_correct with (p := p') in Heqp0; intuition.
+ apply IHl with n0 l0 p p'; intuition.
Qed.
Proof using.
induction l; intros; simpl in *.
- find_inversion. simpl in *. intuition.
- break_match. find_inversion. simpl in *.
intuition; subst; simpl in *; eauto;
subst; eapply processPackets_correct in Heqp; eauto; lia.
Qed.
Proof using.
induction l; intros.
- simpl in *. find_inversion. constructor.
- simpl in *. break_match. find_inversion.
specialize (IHl n0 l0). concludes.
constructor; auto.
intro.
eapply processPackets_correct in H; eauto.
simpl in *. lia.
Qed.
Proof using.
induction l.
- auto.
- simpl. break_match. simpl in *. rewrite IHl. destruct a. auto.
Qed.
Definition orig_packet := @packet _ orig_multi_params.
Definition orig_network := @network _ orig_multi_params.
Definition seq_num_packet := @packet _ multi_params.
Definition seq_num_network := @network _ multi_params.
Definition revertPacket (p : seq_num_packet) : orig_packet :=
@mkPacket _ orig_multi_params (pSrc p) (pDst p) (tmMsg (pBody p)).
Definition pkt_eq_dec (x y : seq_num_packet) : {x = y} + {x <> y}.
decide equality.
- apply msg_eq_dec.
- apply name_eq_dec.
- apply name_eq_dec.
Defined.
Definition revertNetwork (net: seq_num_network) : orig_network :=
mkNetwork
(map revertPacket
(filter (fun (p : seq_num_packet) =>
if member (tmNum (pBody p)) (assoc_default name_eq_dec (tdSeen (nwState net (pDst p))) (pSrc p) [])
then false else true)
(dedup pkt_eq_dec (nwPackets net))))
(fun h => (tdData (nwState net h))).
Proof using.
intros; destruct net, net'.
simpl in *.
subst.
auto.
Qed.
Definition sequence_sane (net : seq_num_network) :=
(forall p,
In p (nwPackets net) ->
tmNum (pBody p) < (tdNum ((nwState net) (pSrc p)))).

Lemma reachable_sane :
true_in_reachable step_dup step_async_init sequence_sane.