Skip to content
Merged

29 #292

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions HumanEvalLean/HumanEval29.lean
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
module

def filter_by_prefix : Unit :=
()
def filterByPrefix (l : List String) (pref : String) : List String :=
l.filter (·.startsWith pref)

open Classical in
theorem filterByPrefix_eq {l : List String} {pref : String} :
filterByPrefix l pref = l.filter (fun s => pref.toList <+: s.toList) := by
simp [filterByPrefix, ← String.startsWith_string_iff]

/-!
## Prompt
Expand Down Expand Up @@ -40,4 +45,4 @@ def check(candidate):
assert candidate([], 'john') == []
assert candidate(['xxx', 'asd', 'xxy', 'john doe', 'xxxAAA', 'xxx'], 'xxx') == ['xxx', 'xxxAAA', 'xxx']
```
-/
-/
Loading