lean4-htt/tests/lean/run/library_search_all.lean
Alok Singh 949cf69246
chore: use backticks for sorry in diagnostic messages (#11608)
This PR changes the "declaration uses 'sorry'" warning to use backticks
instead of single quotes, consistent with Lean's conventions for
formatting code identifiers in diagnostic messages.
2025-12-15 14:30:21 +00:00

75 lines
1.8 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/-!
# Tests for `exact? +all`
This tests the `+all` option which collects all successful lemmas
instead of stopping at the first complete solution.
-/
set_option linter.unusedVariables false
-- Create a custom inductive with limited lemmas for controlled testing
inductive MyTrue : Prop where
| intro
-- Define exactly three ways to prove MyTrue
theorem myTrue1 : MyTrue := MyTrue.intro
theorem myTrue2 : MyTrue := MyTrue.intro
theorem myTrue3 : MyTrue := MyTrue.intro
-- Test: without +all, we get a single suggestion and the goal is solved
/--
info: Try this:
[apply] exact myTrue3
-/
#guard_msgs in
example : MyTrue := by exact?
-- Test: with +all, exact? finds all lemmas (including the constructor)
-- The goal is admitted (sorry), and all suggestions are shown in one message
/--
info: Try these:
[apply] exact myTrue3
[apply] exact MyTrue.intro
[apply] exact myTrue1
[apply] exact myTrue2
---
warning: declaration uses `sorry`
-/
#guard_msgs in
example : MyTrue := by exact? +all
-- Test: apply? also supports +all
/--
info: Try these:
[apply] exact myTrue3
[apply] exact MyTrue.intro
[apply] exact myTrue1
[apply] exact myTrue2
---
warning: declaration uses `sorry`
-/
#guard_msgs in
example : MyTrue := by apply? +all
-- Test: verify that +all without any matches still errors appropriately
/--
error: `exact?` could not close the goal. Try `apply?` to see partial suggestions.
-/
#guard_msgs in
example (n : Nat) (h : n = n + 1) : False := by exact? +all
def Empty.elim2 := @Empty.elim
/--
info: Try these:
[apply] exact h.elim
[apply] exact h.elim2
---
warning: declaration uses `sorry`
-/
#guard_msgs in
example {α : Sort u} (h : Empty) : α := by exact? +all
/-- error: `exact?` could not close the goal. -/
#guard_msgs in
example {α : Sort u} (h : Empty) : α := by exact? +all -star