lean4-htt/tests/elab/grind_local_hyps.lean
Garmelon 08eb78a5b2
chore: switch to new test/bench suite (#12590)
This PR sets up the new integrated test/bench suite. It then migrates
all benchmarks and some related tests to the new suite. There's also
some documentation and some linting.

For now, a lot of the old tests are left alone so this PR doesn't become
even larger than it already is. Eventually, all tests should be migrated
to the new suite though so there isn't a confusing mix of two systems.
2026-02-25 13:51:53 +00:00

47 lines
1.4 KiB
Text

/-! This test ensures that local declarations explicitly passed to `grind` produce an appropriate
error message, instead of just `unknown constant '...'`. -/
-- Checks that (invalid) identifiers which are not local declarations are still elaborated as global
-- constants.
/-- error: Unknown constant `h` -/
#guard_msgs in
example : 0 = 0 := by
grind [h]
-- Checks the same property as before, but in the presence of the modifier `=`, which should not
-- affect how the subsequent identifier is resolved.
/-- error: Unknown constant `h` -/
#guard_msgs in
example : 0 = 0 := by
grind [= h]
-- Checks that (valid) identifiers which are not local declarations are still elaborated as global
-- constants.
theorem t : 0 = 0 := rfl
example : 0 = 0 := by
grind [= t]
-- Checks that local hypotheses do not shadow global constants.
def P := 0 = 0
example : 0 = 0 := by
have P : 0 = 0 := rfl
grind [P]
/-- error: redundant parameter `h`, `grind` uses local hypotheses automatically -/
#guard_msgs in
example : 0 = 0 := by
have h : 1 = 1 := rfl
grind [h]
/-- error: redundant parameter `h`, `grind` uses local hypotheses automatically -/
#guard_msgs in
example : 0 = 0 := by
have h : 1 = 1 := rfl
grind only [h]
-- Checks that dot notation on a local variable for a global theorem is accepted.
-- `n.triv` means `Nat.triv n`, not a local hypothesis.
theorem Nat.triv (n : Nat) : n = n := rfl
example (n : Nat) : n = n := by
grind [n.triv]