@@ -867,8 +867,10 @@ Section LockServ.
867
867
match trace with
868
868
| [] => True
869
869
| (Client n, (inl Unlock)) :: tr' => match holder with
870
- | Some m => m = n /\ trace_mutual_exclusion' None tr'
871
- | _ => False
870
+ | Some m => if fin_eq_dec _ n m
871
+ then trace_mutual_exclusion' None tr'
872
+ else trace_mutual_exclusion' holder tr'
873
+ | _ => trace_mutual_exclusion' holder tr'
872
874
end
873
875
| (n, (inl _)) :: tr' => trace_mutual_exclusion' holder tr'
874
876
| (Client n, (inr [Locked])) :: tr' => trace_mutual_exclusion' (Some n) tr'
@@ -1070,7 +1072,6 @@ Section LockServ.
1070
1072
1071
1073
Lemma trace_mutex'_unlock_extend :
1072
1074
forall tr h c,
1073
- last_holder' h tr = Some c ->
1074
1075
trace_mutual_exclusion' h tr ->
1075
1076
trace_mutual_exclusion' h (tr ++ [(Client c, inl Unlock)]).
1076
1077
Proof .
@@ -1079,17 +1080,38 @@ Section LockServ.
1079
1080
1080
1081
Lemma last_holder'_unlock_none :
1081
1082
forall tr h c,
1083
+ last_holder' h tr = Some c ->
1082
1084
last_holder' h (tr ++ [(Client c, inl Unlock)]) = None.
1083
1085
Proof .
1084
1086
induction tr; intros; simpl in *; repeat break_match; intuition.
1087
+ congruence.
1085
1088
Qed .
1086
1089
1087
1090
Lemma last_holder_unlock_none :
1088
1091
forall tr c,
1092
+ last_holder tr = Some c ->
1089
1093
last_holder (tr ++ [(Client c, inl Unlock)]) = None.
1090
1094
Proof .
1091
1095
intros.
1092
- apply last_holder'_unlock_none.
1096
+ apply last_holder'_unlock_none. auto.
1097
+ Qed .
1098
+
1099
+ Lemma last_holder_some_unlock_inv :
1100
+ forall tr h c n,
1101
+ last_holder' h (tr ++ [(Client c, inl Unlock)]) = Some n ->
1102
+ last_holder' h tr = Some n.
1103
+ Proof .
1104
+ induction tr; intros; simpl in *; repeat break_match; subst;
1105
+ intuition; try congruence; eauto.
1106
+ Qed .
1107
+
1108
+ Lemma last_holder'_neq_unlock_extend :
1109
+ forall tr h n c,
1110
+ last_holder' h tr = Some n ->
1111
+ n <> c ->
1112
+ last_holder' h (tr ++ [(Client c, inl Unlock)]) = Some n.
1113
+ Proof .
1114
+ induction tr; intros; simpl in *; repeat break_match; subst; try congruence; intuition.
1093
1115
Qed .
1094
1116
1095
1117
Lemma LockServ_mutual_exclusion_trace :
@@ -1159,16 +1181,23 @@ Section LockServ.
1159
1181
end.
1160
1182
apply last_holder'_input_extend; auto. congruence.
1161
1183
- apply trace_mutex'_unlock_extend; auto.
1162
- - rewrite last_holder_unlock_none in *. discriminate.
1184
+ - rewrite last_holder_unlock_none in *; auto . discriminate.
1163
1185
- my_update_destruct; try find_inversion; rewrite_update.
1164
1186
+ discriminate.
1165
1187
+ assert (mutual_exclusion (nwState st))
1166
1188
by eauto using mutual_exclusion_invariant, reachable_intro.
1167
1189
unfold mutual_exclusion in *.
1168
1190
assert (c = n) by eauto. congruence.
1169
- - admit.
1170
- - admit.
1171
- - admit.
1191
+ - apply trace_mutex'_unlock_extend. auto.
1192
+ - rewrite update_nop.
1193
+ find_apply_lem_hyp last_holder_some_unlock_inv.
1194
+ auto.
1195
+ - match goal with
1196
+ | [ H : _ |- _ ] => rewrite update_nop in H
1197
+ end.
1198
+ assert (n <> c) by congruence.
1199
+ find_apply_hyp_hyp.
1200
+ apply last_holder'_neq_unlock_extend; auto.
1172
1201
- apply trace_mutual_exclusion'_extend_input; auto. congruence.
1173
1202
- rewrite update_nop_ext. find_apply_lem_hyp last_holder'_input_inv; try congruence.
1174
1203
auto.
0 commit comments