Skip to content

Commit 147b36e

Browse files
hyperpolymathclaude
andcommitted
proof(coq): tighten sumbool tactic patterns in file_operations + symlink_operations
Fix `destruct (list_eq_dec p p)` → exhaustive named branches in 3 files. Fixes the same issue as 1ef841c but in file_operations.v and symlink_operations.v. Also tightens create_file_has_parent and mkdir_creates_empty_dir argument handling. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d9c5109 commit 147b36e

3 files changed

Lines changed: 21 additions & 20 deletions

File tree

proofs/coq/file_operations.v

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ Theorem delete_file_removes_path :
7777
Proof.
7878
intros p fs Hpre [node Hexists].
7979
unfold delete_file, fs_update in Hexists.
80-
destruct (list_eq_dec String.string_dec p p); discriminate.
80+
destruct (list_eq_dec String.string_dec p p) as [_ | Hneq].
81+
- discriminate.
82+
- exact (Hneq eq_refl).
8183
Qed.
8284

8385
(** * File Reversibility Theorem *)
@@ -95,10 +97,12 @@ Proof.
9597
destruct (list_eq_dec String.string_dec p p').
9698
- (* p = p' *)
9799
subst.
98-
destruct (list_eq_dec String.string_dec p' p'); [|contradiction].
99-
destruct Hpre as [Hnotexists _].
100-
destruct Hnotexists.
101-
assumption.
100+
destruct (list_eq_dec String.string_dec p' p') as [_ | Hneq].
101+
+ destruct Hpre as [Hnotexists _].
102+
destruct (fs p') as [node |] eqn:Hfsp.
103+
* exfalso. apply Hnotexists. unfold path_exists. exists node. exact Hfsp.
104+
* reflexivity.
105+
+ exact (Hneq eq_refl).
102106
- (* p <> p' *)
103107
destruct (list_eq_dec String.string_dec p p'); [contradiction|].
104108
reflexivity.
@@ -136,12 +140,9 @@ Proof.
136140
destruct Hparent as [node Hnode].
137141
exists node.
138142
unfold create_file, fs_update.
139-
destruct (list_eq_dec String.string_dec p (parent_path p)).
140-
- (* p = parent_path p would mean path_exists p fs (from parentExists),
141-
contradicting notExists. Derive contradiction. *)
142-
subst. exfalso.
143-
apply HnotExists.
144-
exists node. assumption.
143+
destruct (list_eq_dec String.string_dec p (parent_path p)) as [Heq | _].
144+
- (* p = parent_path p — contradicts HnotExists: p already exists via Hnode *)
145+
exfalso. apply HnotExists. exists node. rewrite Heq. exact Hnode.
145146
- assumption.
146147
Qed.
147148

proofs/coq/filesystem_composition.v

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -470,18 +470,16 @@ Proof.
470470
exists node.
471471
split; [| assumption].
472472
unfold mkdir, fs_update.
473-
destruct (list_eq_dec String.string_dec p (parent_path p)).
474-
+ (* p = parent_path p would mean path_exists p fs via parentExists,
475-
contradicting notExists *)
476-
subst. exfalso.
477-
apply Hnotexists.
478-
exists node. assumption.
473+
destruct (list_eq_dec String.string_dec p (parent_path p)) as [Heq | _].
474+
+ (* p = parent_path p — contradicts Hnotexists: p already exists via Hnode *)
475+
exfalso. apply Hnotexists. exists node. rewrite Heq. exact Hnode.
479476
+ assumption.
480477
- (* p <> root_path *)
481478
intro Hroot.
482479
subst.
483-
destruct Hnotexists.
484-
apply path_exists_empty_fs_root.
480+
apply Hnotexists.
481+
unfold parent_exists in Hparent. simpl in Hparent.
482+
exact Hparent.
485483
Qed.
486484

487485
(** mkdir preserves well-formedness: adding a node whose parent exists

proofs/coq/symlink_operations.v

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ Theorem unlink_removes_path :
4848
Proof.
4949
intros p fs Hexists [node Hnode].
5050
unfold unlink, fs_update in Hnode.
51-
destruct (list_eq_dec String.string_dec p p); discriminate.
51+
destruct (list_eq_dec String.string_dec p p) as [_ | Hneq].
52+
- discriminate.
53+
- exact (Hneq eq_refl).
5254
Qed.
5355

5456
(** * Reversibility Theorem *)

0 commit comments

Comments
 (0)