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.
36 lines
1,022 B
Text
36 lines
1,022 B
Text
module
|
|
public import Lean
|
|
public meta import Lean.Elab.Tactic
|
|
|
|
open Lean Meta Elab Tactic Try
|
|
|
|
-- Install a `TryTactic` handler for `assumption`
|
|
@[local try_tactic assumption]
|
|
meta def evalTryApply : TryTactic := fun tac => do
|
|
-- We just use the default implementation, but return a different tactic.
|
|
evalAssumption tac
|
|
`(tactic| (trace "worked"; assumption))
|
|
|
|
/--
|
|
info: Try this:
|
|
[apply] · trace "worked"; assumption
|
|
-/
|
|
#guard_msgs (info) in
|
|
example (h : False) : False := by
|
|
try? (max := 1) -- at most one solution
|
|
|
|
-- `try?` uses `evalAndSuggest` the attribute `[try_tactic]` is used to extend `evalAndSuggest`.
|
|
-- Let's define our own `try?` that uses `evalAndSuggest`
|
|
elab stx:"my_try?" : tactic => do
|
|
-- Things to try
|
|
let toTry ← `(tactic| attempt_all | assumption | apply True | rfl)
|
|
evalAndSuggest stx toTry (originalMaxHeartbeats := 10^8)
|
|
|
|
/--
|
|
info: Try these:
|
|
[apply] · trace "worked"; assumption
|
|
[apply] rfl
|
|
-/
|
|
#guard_msgs (info) in
|
|
example (a : Nat) (h : a = a) : a = a := by
|
|
my_try?
|