Skip to content

Commit 9d7e564

Browse files
authored
29 (#292)
1 parent 3e048b9 commit 9d7e564

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

HumanEvalLean/HumanEval29.lean

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
module
22

3-
def filter_by_prefix : Unit :=
4-
()
3+
def filterByPrefix (l : List String) (pref : String) : List String :=
4+
l.filter (·.startsWith pref)
5+
6+
open Classical in
7+
theorem filterByPrefix_eq {l : List String} {pref : String} :
8+
filterByPrefix l pref = l.filter (fun s => pref.toList <+: s.toList) := by
9+
simp [filterByPrefix, ← String.startsWith_string_iff]
510

611
/-!
712
## Prompt
@@ -40,4 +45,4 @@ def check(candidate):
4045
assert candidate([], 'john') == []
4146
assert candidate(['xxx', 'asd', 'xxy', 'john doe', 'xxxAAA', 'xxx'], 'xxx') == ['xxx', 'xxxAAA', 'xxx']
4247
```
43-
-/
48+
-/

0 commit comments

Comments
 (0)