Skip to content

Commit 36b63ce

Browse files
committed
add tests to ensure still works with -star
1 parent aec4960 commit 36b63ce

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

tests/lean/librarySearch.lean

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,3 +393,71 @@ example {α : Sort u} (h : Empty) : α := by apply? -star
393393
-- With `+star`, we find `Empty.elim` via star-indexed lemma fallback.
394394
#guard_msgs (drop info) in
395395
example {α : Sort u} (h : Empty) : α := by apply? +star
396+
397+
-- Verify that `-star` doesn't break normal (non-star-indexed) lemma search.
398+
section MinusStar
399+
400+
/--
401+
info: Try this:
402+
[apply] exact Nat.add_comm x y
403+
-/
404+
#guard_msgs in
405+
example (x y : Nat) : x + y = y + x := by apply? -star
406+
407+
/--
408+
info: Try this:
409+
[apply] exact fun a => Nat.add_le_add_right a k
410+
-/
411+
#guard_msgs in
412+
example (n m k : Nat) : n ≤ m → n + k ≤ m + k := by apply? -star
413+
414+
/--
415+
info: Try this:
416+
[apply] exact Nat.mul_dvd_mul_left a w
417+
-/
418+
#guard_msgs in
419+
example (_ha : a > 0) (w : b ∣ c) : a * b ∣ a * c := by apply? -star
420+
421+
/--
422+
info: Try this:
423+
[apply] exact Nat.lt_add_one x
424+
-/
425+
#guard_msgs in
426+
example : x < x + 1 := by exact? -star
427+
428+
/--
429+
info: Try this:
430+
[apply] exact eq_comm
431+
-/
432+
#guard_msgs in
433+
example {α : Type} (x y : α) : x = y ↔ y = x := by apply? -star
434+
435+
/--
436+
info: Try this:
437+
[apply] exact (p_iff_q a).mp h
438+
-/
439+
#guard_msgs in
440+
example {a : Nat} (h : P a) : Q a := by apply? -star
441+
442+
/--
443+
info: Try this:
444+
[apply] exact (Nat.dvd_add_iff_left h₁).mpr h₂
445+
-/
446+
#guard_msgs in
447+
example {a b c : Nat} (h₁ : a ∣ c) (h₂ : a ∣ b + c) : a ∣ b := by apply? -star
448+
449+
/--
450+
info: Try this:
451+
[apply] exact L.flatten
452+
-/
453+
#guard_msgs in
454+
example (L : List (List Nat)) : List Nat := by apply? -star using L
455+
456+
/--
457+
info: Try this:
458+
[apply] exact Bool_eq_iff
459+
-/
460+
#guard_msgs in
461+
example {A B : Bool} : (A = B) = (A ↔ B) := by apply? -star
462+
463+
end MinusStar

0 commit comments

Comments
 (0)