Skip to content

Commit 11b6fe6

Browse files
committed
52
1 parent 6ddc1c7 commit 11b6fe6

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

HumanEvalLean/HumanEval52.lean

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

3-
def below_threshold : Unit :=
4-
()
3+
set_option cbv.warning false
4+
5+
public section
6+
7+
/-! ## Implementation -/
8+
9+
def belowThreshold (xs : List Nat) (t : Nat) : Bool :=
10+
xs.all (· < t)
11+
12+
/-! ## Tests -/
13+
14+
example : belowThreshold [1, 2, 4, 10] 100 = true := by cbv
15+
example : belowThreshold [1, 20, 4, 10] 5 = false := by cbv
16+
example : belowThreshold [1, 20, 4, 10] 21 = true := by cbv
17+
example : belowThreshold [1, 20, 4, 10] 22 = true := by cbv
18+
example : belowThreshold [1, 8, 4, 10] 11 = true := by cbv
19+
example : belowThreshold [1, 8, 4, 10] 10 = false := by cbv
20+
21+
/-! ## Verification -/
22+
23+
theorem belowThreshold_iff :
24+
belowThreshold xs t ↔ ∀ x ∈ xs, x < t := by
25+
grind [belowThreshold]
526

627
/-!
728
## Prompt
@@ -44,4 +65,4 @@ def check(candidate):
4465
assert not candidate([1, 8, 4, 10], 10)
4566
4667
```
47-
-/
68+
-/

0 commit comments

Comments
 (0)