@@ -311,6 +311,26 @@ Proof.
311
311
* now rewrite Bool.andb_false_r.
312
312
Qed .
313
313
314
+ (* This might be replaceable by something better. *)
315
+ Ltac cut_unit :=
316
+ match goal with
317
+ | [ |- (?b * ?q)%g = ?b ] =>
318
+ cut (q = 1%g);
319
+ first by intro; repeat find_rewrite; gsimpl
320
+ end .
321
+
322
+ Ltac eapply_prop P :=
323
+ match goal with
324
+ | H : P _ |- _ =>
325
+ eapply H
326
+ | H : P _ _ |- _ =>
327
+ eapply H
328
+ | H : P _ _ _ |- _ =>
329
+ eapply H
330
+ | H : P _ _ _ _ |- _ =>
331
+ eapply H
332
+ end .
333
+
314
334
(* This lemma lets us prove stabilization once we prove that its hypotheses
315
335
about the network eventually hold. *)
316
336
Lemma no_noise_means_correct_root_aggregate :
@@ -335,18 +355,10 @@ Proof.
335
355
unfold no_fail_incoming_active_event, sum_fail_balance_incoming_active_opt, non_root_nodes_have_unit in *.
336
356
rewrite sum_units_is_unit; gsimpl; intros.
337
357
destruct (odnwState o a) eqn:H_st; last by auto.
338
- match goal with
339
- | [ |- (?b * ?q)%g = ?b ] =>
340
- cut (q = 1%g);
341
- first by intro; repeat find_rewrite; gsimpl
342
- end.
358
+ cut_unit.
343
359
unfold sum_fail_map_incoming.
344
360
rewrite sum_units_is_unit; gsimpl; intros.
345
- match goal with
346
- | [ |- (?b * ?q)%g = ?b ] =>
347
- cut (q = 1%g);
348
- first by intro; repeat find_rewrite; gsimpl
349
- end.
361
+ cut_unit.
350
362
rewrite sum_fail_map_unit_when_no_fail; [by gsimpl|].
351
363
simpl.
352
364
cut (~ In Fail (odnwPackets o a0 a)); [by auto|].
@@ -358,9 +370,31 @@ Proof.
358
370
{
359
371
unfold sum_aggregate_msg_incoming_active.
360
372
unfold sum_aggregate_msg_incoming.
361
- unfold no_aggregate_incoming_active_event in *.
362
373
unfold sum_aggregate_msg.
363
- admit.
374
+ do 2 (apply sum_units_is_unit; intros; cut_unit).
375
+ break_if; [reflexivity|].
376
+ unfold no_fail_incoming_active_event in *.
377
+ simpl in *.
378
+ unfold aggregate_sum_fold.
379
+ apply sum_units_is_unit; intros; cut_unit.
380
+ match goal with
381
+ | [ |- _ ?a = _ ] =>
382
+ destruct a; reflexivity || exfalso
383
+ end.
384
+ repeat find_rewrite; simpl in *.
385
+ match goal with
386
+ | [ H : In (Aggregate ?m) (odnwPackets ?o ?src ?dst) |- _ ] =>
387
+ cut (~ In (Aggregate m) (odnwPackets o src dst));
388
+ [by auto|
389
+ assert (In dst (odnwNodes o));
390
+ first by eauto using in_remove_all_was_in]
391
+ end.
392
+ replace o with (snd e.(evt_a)) by (repeat find_rewrite; auto).
393
+ eapply_prop no_aggregate_incoming_active_event; eauto.
394
+ - repeat find_reverse_rewrite; simpl in *.
395
+ replace (snd e.(evt_a)) with o by (repeat find_rewrite; auto).
396
+ assumption.
397
+ - eauto using in_remove_all_not_in.
364
398
}
365
399
rewrite !H_sam; gsimpl.
366
400
unfold sum_aggregate.
0 commit comments