Skip to content

Commit 6a72ee7

Browse files
authored
Add solution for HumanEval11 (#177)
1 parent 47c5582 commit 6a72ee7

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

HumanEvalLean/HumanEval11.lean

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
1-
def string_xor : Unit :=
2-
()
1+
import Std.Data.Iterators
2+
3+
def stringXor (a b : List Bool) : List Bool :=
4+
((a.iter).zip b.iter)
5+
|>.map (fun p => Bool.xor p.1 p.2)
6+
|>.toList
7+
8+
@[simp, grind]
9+
theorem length_stringXor {a b : List Bool} : (stringXor a b).length = min a.length b.length := by
10+
simp [stringXor]
11+
12+
theorem getElem_stringXor {a b : List Bool} {i : Nat} {hia : i < a.length} {hib : i < b.length} :
13+
(stringXor a b)[i]'(by grind) = Bool.xor a[i] b[i] := by
14+
simp [stringXor]
315

416
/-!
517
## Prompt
@@ -44,4 +56,4 @@ def check(candidate):
4456
assert candidate('1', '1') == '0'
4557
assert candidate('0101', '0000') == '0101'
4658
```
47-
-/
59+
-/

lean-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
leanprover/lean4:nightly-2025-08-18
1+
leanprover/lean4:nightly-2025-06-11

0 commit comments

Comments
 (0)