Skip to content

Commit 9626ac1

Browse files
proofs(idris2): make Filesystem.Model typecheck under Idris2 0.8.0 (#69)
The model used Data.List.lookup, elem, and (==) on values of type Path and (Path, FSEntry), and called isJust on Maybe values, without bringing the required Eq instances or the Data.Maybe import into scope. As a result Filesystem.Model.idr failed to type-check at lines 103/108/135/ 152/169, blocking the entire proofs/idris2/ build tree. Fix the type errors directly: * Import Data.Maybe so isJust resolves at line 103. * Add a public-export Eq Path instance defined by structural pattern match on the Root/Cons constructors. This sits alongside the existing DecEq Path instance and satisfies the Eq constraints required by Data.List.lookup, elem, and the Maybe-equality at line 135. * Add a public-export Eq FSEntry instance matching on Dir/File, which satisfies Eq (Path, FSEntry) at line 169 (Idris2 derives Eq on tuples from Eq on their components automatically). No theorems are added or modified. The two ?holes at the bottom of the file (?equivSymProof, ?equivTransProof) are out of scope for this PR and remain open — they are tractable separately. Refs #41 (seam-walk pre-existing failure); unblocks future Idris2 proof work and is a prerequisite for adding a build-idris2 Justfile target + verify-idris2 CI job (separate follow-up).
1 parent 9b7c627 commit 9626ac1

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

proofs/idris2/src/Filesystem/Model.idr

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
module Filesystem.Model
99

1010
import Data.List
11+
import Data.Maybe
1112
import Data.String
1213
import Decidable.Equality
1314

@@ -49,6 +50,13 @@ DecEq Path where
4950
decEq (Cons x xs) (Cons y ys) | No contra =
5051
No (\Refl => contra Refl)
5152

53+
||| Boolean equality on paths (required by Data.List.lookup / elem)
54+
public export
55+
Eq Path where
56+
Root == Root = True
57+
(Cons x xs) == (Cons y ys) = x == y && xs == ys
58+
_ == _ = False
59+
5260
||| Parent of a path
5361
export
5462
parent : Path -> Maybe Path
@@ -78,6 +86,13 @@ data FSEntry : Type where
7886
||| File entry with content
7987
File : FileContent -> FSEntry
8088

89+
||| Boolean equality on filesystem entries
90+
public export
91+
Eq FSEntry where
92+
Dir == Dir = True
93+
(File c1) == (File c2) = c1 == c2
94+
_ == _ = False
95+
8196
||| Filesystem state mapping paths to entries
8297
public export
8398
record Filesystem where

0 commit comments

Comments
 (0)