@@ -104,7 +104,7 @@ Proof.
104104 destruct (fs p') as [node |] eqn:Hfsp.
105105 * exfalso. apply Hnotexists. unfold path_exists. exists node. exact Hfsp.
106106 * reflexivity.
107- + exact (Hneq eq_refl).
107+ + exfalso. exact (Hneq eq_refl).
108108 - (* p <> p' *)
109109 destruct (list_eq_dec String.string_dec p p'); [contradiction|].
110110 reflexivity.
@@ -152,30 +152,28 @@ Qed.
152152
153153Theorem create_file_preserves_directories :
154154 forall p p' fs,
155+ p <> p' ->
155156 is_directory p' fs ->
156157 is_directory p' (create_file p fs).
157158Proof .
158- intros p p' fs [perms Hdir].
159+ intros p p' fs Hneq [perms Hdir].
159160 unfold is_directory.
160161 exists perms.
161162 unfold create_file, fs_update.
162- destruct (list_eq_dec String.string_dec p p').
163- - subst. discriminate Hdir.
164- - assumption.
163+ destruct (list_eq_dec String.string_dec p p'); [contradiction | assumption].
165164Qed .
166165
167166Theorem mkdir_preserves_files :
168167 forall p p' fs,
168+ p <> p' ->
169169 is_file p' fs ->
170170 is_file p' (mkdir p fs).
171171Proof .
172- intros p p' fs [perms Hfile].
172+ intros p p' fs Hneq [perms Hfile].
173173 unfold is_file.
174174 exists perms.
175175 unfold mkdir, fs_update.
176- destruct (list_eq_dec String.string_dec p p').
177- - subst. discriminate Hfile.
178- - assumption.
176+ destruct (list_eq_dec String.string_dec p p'); [contradiction | assumption].
179177Qed .
180178
181179(** * File/Directory Combination Theorems *)
@@ -193,8 +191,8 @@ Proof.
193191 split.
194192 - (* p1 is still a file after mkdir p2 *)
195193 apply mkdir_preserves_files.
196- apply create_file_creates_file .
197- assumption.
194+ + intro H. exact (Hneq (eq_sym H)) .
195+ + apply create_file_creates_file. assumption.
198196 - (* p2 is a directory after mkdir *)
199197 apply mkdir_creates_directory.
200198 assumption.
@@ -213,15 +211,11 @@ Proof.
213211 intros p1 p2 fs Hneq [node Hexists].
214212 split.
215213 - (* create_file preserves p2 *)
216- unfold path_exists.
217- exists node.
218- apply create_file_preserves_other_paths.
219- assumption.
214+ unfold path_exists. exists node.
215+ rewrite <- create_file_preserves_other_paths; assumption.
220216 - (* delete_file preserves p2 *)
221- unfold path_exists.
222- exists node.
223- apply delete_file_preserves_other_paths.
224- assumption.
217+ unfold path_exists. exists node.
218+ rewrite <- delete_file_preserves_other_paths; assumption.
225219Qed .
226220
227221(** Theorem: Reversible operations form a group-like structure *)
@@ -230,13 +224,13 @@ Theorem reversible_operations_compose :
230224 p1 <> p2 ->
231225 create_file_precondition p1 fs ->
232226 create_file_precondition p2 (create_file p1 fs) ->
233- delete_file p1 (delete_file p2 (create_file p2 (create_file p1 fs))) =
234- create_file p1 fs.
227+ delete_file p1 (delete_file p2 (create_file p2 (create_file p1 fs))) = fs.
235228Proof .
236229 intros p1 p2 fs Hneq Hpre1 Hpre2.
237- (* delete_file p2 (create_file p2 ...) = ... by reversibility *)
230+ (* delete_file p2 (create_file p2 (create_file p1 fs)) = create_file p1 fs *)
238231 rewrite create_delete_file_reversible.
239- - reflexivity.
232+ - (* delete_file p1 (create_file p1 fs) = fs *)
233+ apply create_delete_file_reversible. assumption.
240234 - assumption.
241235Qed .
242236
0 commit comments