Skip to content

Commit 5b78d4c

Browse files
committed
Test
1 parent e14338e commit 5b78d4c

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import Lean.PremiseSelection
2+
3+
-- A custom function that simp doesn't know about
4+
def myCustomAdd (x y : Nat) : Nat := x + y
5+
6+
-- A helper lemma about our custom function
7+
theorem myCustomAdd_comm (x y : Nat) : myCustomAdd x y = myCustomAdd y x := by
8+
simp [myCustomAdd, Nat.add_comm]
9+
10+
-- Set up a premise selector that suggests our helper theorem
11+
set_premise_selector (fun _ _ => pure #[{ name := `myCustomAdd_comm, score := 1.0 }])
12+
13+
-- Test that regular simp? fails without the premise
14+
example (a b : Nat) : myCustomAdd a b = myCustomAdd b a := by
15+
fail_if_success simp?
16+
exact myCustomAdd_comm a b
17+
18+
-- Test that simp? +suggestions succeeds by using the selected premise
19+
/--
20+
info: Try this:
21+
[apply] simp only [myCustomAdd_comm]
22+
-/
23+
#guard_msgs in
24+
example (a b : Nat) : myCustomAdd a b = myCustomAdd b a := by
25+
simp? +suggestions

0 commit comments

Comments
 (0)