@@ -97,6 +97,7 @@ Section PrimaryBackup.
97
97
PB_input_handler h i d = (os, d', ms) ->
98
98
(h = Primary /\
99
99
state d' = state d /\
100
+ os = [] /\
100
101
exists r,
101
102
i = Request r /\
102
103
queue d' = queue d ++ [r] /\
@@ -425,6 +426,13 @@ Section PrimaryBackup.
425
426
intros. destruct h; auto.
426
427
Qed .
427
428
429
+ Lemma inputs_m_inl_read :
430
+ forall h l,
431
+ inputs_m ((h, inl Read) :: l) = inputs_m l.
432
+ Proof .
433
+ intros. destruct h; auto.
434
+ Qed .
435
+
428
436
Lemma list_destruct_last :
429
437
forall A (l : list A),
430
438
l = [] \/ exists l' x, l = l' ++ [x].
@@ -496,6 +504,13 @@ Section PrimaryBackup.
496
504
auto.
497
505
Qed .
498
506
507
+ Lemma inputs_m_backup :
508
+ forall i l,
509
+ inputs_m ((Backup, inl i) :: l) = inputs_m l.
510
+ Proof .
511
+ auto.
512
+ Qed .
513
+
499
514
Lemma step_1_star_no_trace_no_step :
500
515
forall st st' tr,
501
516
step_1_star st st' tr ->
@@ -643,6 +658,15 @@ Section PrimaryBackup.
643
658
+ subst. constructor. auto.
644
659
Qed .
645
660
661
+ Lemma outputs_m_read_response_singleton :
662
+ forall h o,
663
+ outputs_m [(h, inr [ReadResponse o])] = [].
664
+ Proof .
665
+ intros.
666
+ simpl in *.
667
+ break_match; auto.
668
+ Qed .
669
+
646
670
Lemma correspond_reachable :
647
671
forall net tr_m,
648
672
step_m_star step_m_init net tr_m ->
@@ -680,23 +704,29 @@ Section PrimaryBackup.
680
704
outputs_m_inr_nil_singleton.
681
705
+ find_apply_lem_hyp PB_input_handler_defn.
682
706
intuition; subst;
683
- try rewrite inputs_m_app in *.
707
+ repeat rewrite snoc_assoc in *;
708
+ repeat rewrite inputs_m_app in *.
684
709
* break_exists. break_and. subst.
710
+ rewrite inputs_m_inr_singleton in *. rewrite app_nil_r in *.
685
711
rewrite inputs_m_primary_inl_request_singleton in *.
686
712
find_apply_lem_hyp inputs_1_invert_app. break_exists. break_and.
687
713
subst. simpl in *. find_inversion. destruct x1.
688
714
find_apply_lem_hyp step_1_snoc_inv. break_exists. break_and.
689
- { eapply correspond_preserved_snoc; eauto.
715
+ { eapply correspond_preserved_primary_same_no_outputs; eauto.
716
+ eapply correspond_preserved_snoc; eauto.
690
717
- eauto using step_1_singleton_inversion.
691
718
- rewrite update_eq by auto. auto.
692
719
- rewrite update_eq by auto. auto.
693
720
}
694
- * rewrite inputs_m_inl_read_singleton in *. rewrite app_nil_r in *.
721
+ * rewrite inputs_m_inr_singleton in *. rewrite app_nil_r in *.
722
+ rewrite inputs_m_inl_read_singleton in *. rewrite app_nil_r in *.
695
723
eauto using
696
724
correspond_preserved_primary_same_no_outputs,
697
725
update_nop,
698
- outputs_m_inl_read_singleton.
699
- * rewrite inputs_m_backup_singleton in *. rewrite app_nil_r in *.
726
+ outputs_m_inl_read_singleton,
727
+ outputs_m_read_response_singleton.
728
+ * rewrite inputs_m_inr_singleton in *.
729
+ rewrite inputs_m_backup_singleton in *. repeat rewrite app_nil_r in *.
700
730
eauto using correspond_preserved_primary_same_no_outputs, update_diff.
701
731
Qed .
702
732
@@ -716,12 +746,18 @@ Section PrimaryBackup.
716
746
rewrite inputs_m_inr_singleton in H
717
747
| [ H : context [ inputs_m [(Primary, inl (Request _))] ] |- _ ] =>
718
748
rewrite inputs_m_primary_inl_request_singleton in H
749
+ | [ H : context [ inputs_m ((Primary, inl (Request _)) :: _) ] |- _ ] =>
750
+ rewrite inputs_m_primary_inl in H
719
751
| [ H : context [ inputs_m [(_, inl Read)] ] |- _ ] =>
720
752
rewrite inputs_m_inl_read_singleton in H
753
+ | [ H : context [ inputs_m ((_, inl Read) :: _) ] |- _ ] =>
754
+ rewrite inputs_m_inl_read in H
721
755
| [ H : context [ inputs_1 _ = [] ] |- _ ] =>
722
756
apply inputs_1_nil_is_nil in H; subst
723
757
| [ H : context [ inputs_m [_] ] |- _ ] =>
724
758
rewrite inputs_m_backup_singleton in H
759
+ | [ H : context [ inputs_m (_ :: _) ] |- _ ] =>
760
+ rewrite inputs_m_backup in H
725
761
| [ H : step_1_star _ _ [] |- _ ] =>
726
762
apply step_1_star_no_trace_no_step in H; [|solve [auto]]; subst
727
763
| [ H : step_1_star _ _ [_] |- _ ] =>
@@ -742,17 +778,20 @@ Section PrimaryBackup.
742
778
| [ H : exists _, _ |- _ ] => break_exists
743
779
| [ H : _ \/ _ |- _ ] => break_or_hyp
744
780
| _ => repeat break_let; repeat find_rewrite; repeat tuple_inversion; subst; auto
745
- end;
781
+ end; repeat rewrite snoc_assoc;
746
782
eauto using
747
783
correspond_preserved_primary_same_no_outputs,
748
784
update_nop,
749
785
update_diff,
750
786
outputs_m_inr_nil_singleton,
751
- outputs_m_inl_read_singleton.
787
+ outputs_m_inl_read_singleton,
788
+ outputs_m_read_response_singleton.
752
789
- eapply correspond_preserved_primary_apply_entry; eauto using update_eq.
753
790
- eapply correspond_preserved_primary_apply_entry; eauto using update_eq.
754
- - eapply correspond_preserved_snoc; eauto; rewrite update_eq by auto; repeat find_rewrite; auto.
755
- - eapply correspond_preserved_snoc; eauto; rewrite update_eq by auto; repeat find_rewrite; auto.
791
+ - eapply correspond_preserved_primary_same_no_outputs; eauto.
792
+ eapply correspond_preserved_snoc; eauto; rewrite update_eq by auto; repeat find_rewrite; auto.
793
+ - eapply correspond_preserved_primary_same_no_outputs; eauto.
794
+ eapply correspond_preserved_snoc; eauto; rewrite update_eq by auto; repeat find_rewrite; auto.
756
795
Qed .
757
796
758
797
Lemma step_m_outputs_m :
@@ -784,10 +823,10 @@ Section PrimaryBackup.
784
823
rewrite update_diff by auto. auto.
785
824
- rewrite inputs_m_inr_singleton.
786
825
rewrite update_diff by auto. auto.
787
- - break_exists. intuition; subst; rewrite inputs_m_primary_inl_request_singleton ; eauto.
788
- - rewrite inputs_m_inl_read_singleton . rewrite update_eq by auto. auto.
789
- - rewrite inputs_m_inl_read_singleton . rewrite update_diff by auto. auto.
790
- - rewrite inputs_m_backup_singleton .
826
+ - break_exists. intuition; subst; rewrite inputs_m_primary_inl ; eauto.
827
+ - rewrite inputs_m_inl_read . rewrite update_eq by auto. auto.
828
+ - rewrite inputs_m_inl_read . rewrite update_diff by auto. auto.
829
+ - rewrite inputs_m_backup .
791
830
rewrite update_diff by auto. auto.
792
831
Qed .
793
832
@@ -958,22 +997,31 @@ Section PrimaryBackup.
958
997
repeat break_match; repeat find_inversion; auto; try discriminate.
959
998
Qed .
960
999
961
- Definition no_output_at_backup {A B} x := forall y, snd x = @inr A (list B) y -> fst x = Primary \/ y = [].
1000
+ Definition no_output_at_backup {A} x := forall y, snd x = @inr A _ y ->
1001
+ fst x = Primary \/
1002
+ match y with
1003
+ | [] => True
1004
+ | [ReadResponse _] => True
1005
+ | _ => False
1006
+ end .
962
1007
963
- Definition no_output_at_backup_trace {A B } tr := (forall x, In x tr -> @no_output_at_backup A B x).
1008
+ Definition no_output_at_backup_trace {A} tr := (forall x, In x tr -> @no_output_at_backup A x).
964
1009
965
1010
Lemma NOABT_tail :
966
- forall A B x y,
967
- @no_output_at_backup_trace A B (x :: y) ->
1011
+ forall A x y,
1012
+ @no_output_at_backup_trace A (x :: y) ->
968
1013
no_output_at_backup_trace y.
969
1014
Proof .
970
1015
unfold no_output_at_backup_trace.
971
1016
intros. simpl in *. eauto.
972
1017
Qed .
973
1018
974
1019
Lemma NOABT_contra :
975
- forall A B l tr,
976
- @no_output_at_backup_trace A B ((Backup, inr l) :: tr) -> l = [].
1020
+ forall A l tr,
1021
+ @no_output_at_backup_trace A ((Backup, inr l) :: tr) ->
1022
+ l = [] \/
1023
+ exists d,
1024
+ l = [ReadResponse d].
977
1025
Proof .
978
1026
unfold no_output_at_backup_trace, no_output_at_backup.
979
1027
intros. simpl in *.
@@ -983,6 +1031,7 @@ Section PrimaryBackup.
983
1031
simpl in *.
984
1032
econcludes.
985
1033
intuition.
1034
+ repeat break_match; intuition eauto.
986
1035
Qed .
987
1036
988
1037
Lemma outputs_m_revert_trace :
@@ -1001,40 +1050,40 @@ Section PrimaryBackup.
1001
1050
repeat break_match; auto.
1002
1051
+ rewrite IHtr by eauto using NOABT_tail. auto.
1003
1052
+ find_copy_apply_lem_hyp NOABT_tail.
1004
- find_apply_lem_hyp NOABT_contra.
1005
- subst. simpl. auto.
1053
+ find_apply_lem_hyp NOABT_contra. intuition; break_exists;
1054
+ subst; simpl; auto.
1006
1055
Qed .
1007
1056
1008
1057
Lemma NOABT_nil :
1009
- forall A B ,
1010
- @no_output_at_backup_trace A B [].
1058
+ forall A,
1059
+ @no_output_at_backup_trace A [].
1011
1060
Proof .
1012
1061
unfold no_output_at_backup_trace.
1013
1062
simpl. intuition.
1014
1063
Qed .
1015
1064
1016
1065
Lemma NOABT_cons :
1017
- forall A B x y,
1066
+ forall A x y,
1018
1067
no_output_at_backup x ->
1019
- @no_output_at_backup_trace A B y ->
1068
+ @no_output_at_backup_trace A y ->
1020
1069
no_output_at_backup_trace (x :: y).
1021
1070
Proof .
1022
1071
unfold no_output_at_backup_trace, no_output_at_backup.
1023
1072
simpl. intros. intuition; subst; eauto.
1024
1073
Qed .
1025
1074
1026
1075
Lemma NOABT_head :
1027
- forall A B x y,
1028
- @no_output_at_backup_trace A B (x :: y) ->
1076
+ forall A x y,
1077
+ @no_output_at_backup_trace A (x :: y) ->
1029
1078
no_output_at_backup x.
1030
1079
Proof .
1031
1080
unfold no_output_at_backup_trace, no_output_at_backup.
1032
1081
simpl. intuition.
1033
1082
Qed .
1034
1083
1035
1084
Lemma NOABT_app :
1036
- forall A B xs ys,
1037
- @no_output_at_backup_trace A B xs ->
1085
+ forall A xs ys,
1086
+ @no_output_at_backup_trace A xs ->
1038
1087
no_output_at_backup_trace ys ->
1039
1088
no_output_at_backup_trace (xs ++ ys).
1040
1089
Proof .
@@ -1045,25 +1094,33 @@ Section PrimaryBackup.
1045
1094
Qed .
1046
1095
1047
1096
Lemma NOABT_singleton_inr_nil :
1048
- forall A B h,
1049
- @no_output_at_backup_trace A B [(h, inr [])].
1097
+ forall A h,
1098
+ @no_output_at_backup_trace A [(h, inr [])].
1099
+ Proof .
1100
+ unfold no_output_at_backup_trace, no_output_at_backup.
1101
+ simpl. intros. intuition. subst. simpl in *. find_inversion. auto.
1102
+ Qed .
1103
+
1104
+ Lemma NOABT_singleton_inr_read_response :
1105
+ forall A h d,
1106
+ @no_output_at_backup_trace A [(h, inr [ReadResponse d])].
1050
1107
Proof .
1051
1108
unfold no_output_at_backup_trace, no_output_at_backup.
1052
1109
simpl. intros. intuition. subst. simpl in *. find_inversion. auto.
1053
1110
Qed .
1054
1111
1055
1112
Lemma NOABT_singleton_primary :
1056
- forall A B out,
1057
- no_output_at_backup_trace [(Primary, @inr A (list B) out)].
1113
+ forall A out,
1114
+ no_output_at_backup_trace [(Primary, @inr A _ out)].
1058
1115
Proof .
1059
1116
unfold no_output_at_backup_trace, no_output_at_backup.
1060
1117
simpl.
1061
1118
intuition. subst. simpl in *. find_inversion. auto.
1062
1119
Qed .
1063
1120
1064
1121
Lemma NOABT_singleton_inl :
1065
- forall A B h r,
1066
- @no_output_at_backup_trace A B [(h, inl r)].
1122
+ forall A h r,
1123
+ @no_output_at_backup_trace A [(h, inl r)].
1067
1124
Proof .
1068
1125
unfold no_output_at_backup_trace, no_output_at_backup.
1069
1126
simpl. intuition. subst. simpl in *. discriminate.
@@ -1085,7 +1142,11 @@ Section PrimaryBackup.
1085
1142
+ find_apply_lem_hyp PB_net_defn'.
1086
1143
intuition; subst; repeat find_rewrite;
1087
1144
auto using NOABT_singleton_inr_nil, NOABT_singleton_primary.
1088
- + auto using NOABT_singleton_inl.
1145
+ + rewrite cons_cons_app. apply NOABT_app.
1146
+ * auto using NOABT_singleton_inl.
1147
+ * find_apply_lem_hyp PB_input_handler_defn.
1148
+ intuition; break_exists; intuition; subst;
1149
+ auto using NOABT_singleton_inr_nil, NOABT_singleton_inr_read_response.
1089
1150
Qed .
1090
1151
1091
1152
Definition zero_or_one_outputs_per_step {A B C} t :=
@@ -1195,7 +1256,11 @@ Section PrimaryBackup.
1195
1256
intuition; subst; auto using ZOOOPST_singleton_nil.
1196
1257
break_exists. break_and. break_match.
1197
1258
intuition; subst; auto using ZOOOPST_singleton_singleton.
1198
- + auto using ZOOOPST_singleton_inl.
1259
+ + rewrite cons_cons_app.
1260
+ apply ZOOOPST_app.
1261
+ * auto using ZOOOPST_singleton_inl.
1262
+ * find_apply_lem_hyp PB_input_handler_defn; intuition; subst;
1263
+ auto using ZOOOPST_singleton_nil, ZOOOPST_singleton_singleton.
1199
1264
Qed .
1200
1265
1201
1266
Lemma inputs_1_m_revert :
@@ -1232,10 +1297,12 @@ Section PrimaryBackup.
1232
1297
intuition; subst; simpl in *.
1233
1298
* break_exists.
1234
1299
intuition; subst;
1235
- rewrite (inputs_m_primary_inl_request_singleton); rewrite update_eq; auto.
1236
- * rewrite (inputs_m_inl_read_singleton).
1300
+ rewrite (inputs_m_primary_inl); rewrite update_eq; auto.
1301
+ * rewrite (inputs_m_inl_read).
1302
+ rewrite inputs_m_inr_singleton.
1237
1303
rewrite app_nil_r. rewrite update_nop. auto.
1238
- * rewrite (inputs_m_backup_singleton).
1304
+ * rewrite (inputs_m_backup).
1305
+ rewrite inputs_m_inr_singleton.
1239
1306
rewrite app_nil_r. rewrite update_nop. auto.
1240
1307
Qed .
1241
1308
End PrimaryBackup.
0 commit comments