Skip to content

Commit 1543e74

Browse files
committed
clean proof up
1 parent 354faa3 commit 1543e74

File tree

1 file changed

+22
-50
lines changed

1 file changed

+22
-50
lines changed

systems/TreeDynamicCorrect.v

Lines changed: 22 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Require Import Verdi.DynamicNetLemmas.
88
Require Import StructTact.Update.
99
Require Import StructTact.Update2.
1010
Require Import StructTact.StructTactics.
11+
Require Import StructTact.ListUtil.
1112

1213
Require Import TreeAux.
1314
Require Import FailureRecorderDynamic.
@@ -1378,7 +1379,7 @@ Proof.
13781379
subst; rewrite_update; try find_inversion;
13791380
[match goal with
13801381
| [ H : In (Level lvo') ?chan,
1381-
H' : refl_trans_1n_trace _ _ (_, ?net) _ |- _ ] =>
1382+
H' : refl_trans_1n_trace _ _ (_, ?net) _ |- _ ] =>
13821383
assert (H_empty: odnwPackets net n' n' = [])
13831384
by eauto using Tree_self_channel_empty;
13841385
simpl in H_empty;
@@ -1388,51 +1389,25 @@ Proof.
13881389
end|].
13891390
destruct (name_eq_dec h n');
13901391
subst; rewrite_update; try find_inversion; repeat find_rewrite.
1391-
-- match goal with
1392+
-- cut (NSet.In n' (adjacent d0) \/ In New (odnwPackets net0 n' n));
1393+
try by intuition eauto using collate_in_in.
1394+
match goal with
13921395
| [ H : In (Level lvo') (collate _ _ _ ?sends _ _) |- _ ] =>
13931396
destruct (In_dec name_eq_dec n (map fst sends));
1394-
[|erewrite collate_not_in_eq in H; eauto]
1397+
[eauto|erewrite collate_not_in_eq in H; eauto]
13951398
end.
1396-
** assert (NSet.In n' (adjacent d0) \/ In New (odnwPackets net0 n' n)).
1397-
{
1398-
eapply Tree_adjacent_or_incoming_new_reciprocal; eauto.
1399-
unfold level_adjacent in *.
1400-
rewrite NSet.fold_spec in i.
1401-
unfold flip in i.
1402-
unfold level_fold in i.
1403-
apply in_map_iff in i; break_exists_name pkt; break_and.
1404-
assert (forall A B (B_eq_dec: forall (b1 b2 : B), {b1 = b2} + {b1 <> b2}) (l : list A) (g : A -> B) y acc,
1405-
In y (fold_left (fun a b => g b :: a) l acc) ->
1406-
In y acc \/ exists x, In x l /\ y = g x).
1407-
{
1408-
intros A B B_eq_dec l.
1409-
induction l.
1410-
- tauto.
1411-
- simpl.
1412-
intros.
1413-
destruct (B_eq_dec y (g a)); subst.
1414-
+ right.
1415-
exists a.
1416-
tauto.
1417-
+ eapply IHl in H12.
1418-
break_or_hyp; [left|right].
1419-
* eauto using In_cons_neq.
1420-
* break_exists_exists;
1421-
tauto.
1422-
}
1423-
apply H12 in H10;
1424-
(repeat decide equality || auto using name_eq_dec).
1425-
break_or_hyp => //=.
1426-
break_exists; break_and.
1427-
left.
1428-
cut (InA eq (fst pkt) (NSet.elements (adjacent d))). by auto with set.
1429-
cut (In (fst pkt) (NSet.elements (adjacent d))). by auto with set.
1430-
repeat find_rewrite.
1431-
auto.
1432-
}
1433-
break_or_hyp; auto using collate_in_in.
1434-
** assert (NSet.In n' (adjacent d0) \/ In New (odnwPackets net0 n' n)) by eauto.
1435-
break_or_hyp; auto using collate_in_in.
1399+
eapply Tree_adjacent_or_incoming_new_reciprocal; eauto.
1400+
unfold level_adjacent, flip, level_fold in *.
1401+
find_rewrite_lem NSet.fold_spec.
1402+
find_apply_lem_hyp in_map_iff.
1403+
break_exists_name pkt; break_and.
1404+
find_eapply_lem_hyp in_fold_left_by_cons_in;
1405+
(repeat decide equality || auto using name_eq_dec).
1406+
break_or_hyp => //=.
1407+
break_exists; break_and.
1408+
cut (InA eq (fst pkt) (NSet.elements (adjacent d)));
1409+
cut (In (fst pkt) (NSet.elements (adjacent d)));
1410+
by auto with set || by repeat find_rewrite.
14361411
-- destruct (name_eq_dec h n);
14371412
subst; rewrite_update; try find_inversion.
14381413
** assert (NSet.In n' (adjacent d) \/ In New (odnwPackets net0 n' n)).
@@ -1467,13 +1442,10 @@ Proof.
14671442
try find_injection;
14681443
auto.
14691444
- intros.
1470-
assert (NSet.In n' (adjacent d) \/ In New (odnwPackets net0 n' n)).
1471-
{
1472-
eapply IHrefl_trans_1n_trace1 with (lvo':=lvo'); eauto.
1473-
eapply collate_map2snd_in_neq_in_before; eauto || congruence.
1474-
}
1475-
break_or_hyp;
1476-
auto using collate_in_in.
1445+
cut (NSet.In n' (adjacent d) \/ In New (odnwPackets net0 n' n));
1446+
try by intuition auto using collate_in_in.
1447+
eapply IHrefl_trans_1n_trace1 with (lvo':=lvo'); eauto.
1448+
eapply collate_map2snd_in_neq_in_before; eauto || congruence.
14771449
Qed.
14781450

14791451
Lemma Tree_in_before_all_new_level :

0 commit comments

Comments
 (0)