File tree Expand file tree Collapse file tree 2 files changed +43
-5
lines changed
.claude/skills/restructure-solutions Expand file tree Collapse file tree 2 files changed +43
-5
lines changed Original file line number Diff line number Diff line change @@ -102,8 +102,10 @@ example : solution'' ... := ...
102102
103103## Notes
104104
105- - Use ` native_decide ` for tests involving iterators or complex computations that don't reduce well
106- - Use ` decide ` for tests involving simple recursive functions or monadic code
105+ - Use the ` cbv ` tactic for tests when possible. It might fail to reduce some special constructs.
106+ - If ` cbv ` fails, use ` decide ` (for simple recursive functions or monadic code) or ` native_decide `
107+ (for tests involving iterators or complex computations that don't reduce well).
108+ - If you use ` cbv ` , use ` set_option cbv.warning false ` .
107109- Preserve all comments, attributes, and proof code exactly as they are
108110- Helper lemmas that are used across multiple solutions should stay in the first Verification section where they appear
109111- Problem number X can be found in ` HumanEvalLean/HumanEvalX.lean `
Original file line number Diff line number Diff line change 11module
22
3- def add : Unit :=
4- ()
3+ set_option cbv.warning false
4+
5+ /-!
6+ ## Implementation
7+
8+ Lean supports addition out of the box, so we just reference to it and to the lemmas verifying its
9+ behavior.
10+ -/
11+
12+ /-- info: Nat.add : Nat → Nat → Nat -/
13+ #guard_msgs in
14+ #check Nat.add
15+
16+ /-! ## Tests -/
17+
18+ example : Nat.add 0 1 = 1 := by cbv
19+ example : Nat.add 1 0 = 1 := by cbv
20+ example : Nat.add 2 3 = 5 := by cbv
21+ example : Nat.add 5 7 = 12 := by cbv
22+ example : Nat.add 7 5 = 12 := by cbv
23+
24+ /-! ## Verification -/
25+
26+ /-- info: Nat.add_zero (n : Nat) : n + 0 = n -/
27+ #guard_msgs in
28+ #check Nat.add_zero
29+
30+ /-- info: Nat.zero_add (n : Nat) : 0 + n = n -/
31+ #guard_msgs in
32+ #check Nat.zero_add
33+
34+ /-- info: Nat.add_assoc (n m k : Nat) : n + m + k = n + (m + k) -/
35+ #guard_msgs in
36+ #check Nat.add_assoc
37+
38+ /-- info: Nat.add_comm (n m : Nat) : n + m = m + n -/
39+ #guard_msgs in
40+ #check Nat.add_comm
541
642/-!
743## Prompt
@@ -46,4 +82,4 @@ def check(candidate):
4682 assert candidate(x, y) == x + y
4783
4884```
49- -/
85+ -/
You can’t perform that action at this time.
0 commit comments