Files
lean4/tests/elab/splitErrors.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

121 lines
3.2 KiB
Lean4
Raw Permalink 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.
/-! # `split` tactic errors
Assesses error messages and hints produced by the `split` tactic.
-/
/--
error: Tactic `split` failed: Specifying a term to split is not supported yet
Hint: To apply `split` at the hypothesis `h`, use `split at h`:
split a̲t̲ ̲h
-/
#guard_msgs in
example : False := by
have h : if True then True else True := trivial
split h
/-- error: Tactic `split` failed: Specifying a term to split is not supported yet -/
#guard_msgs in
example (x y : Bool) : (if x && y then 1 else 2) > (if x || y then 0 else 1) := by
split x && y
/--
error: Tactic `split` failed: Could not split an `if` or `match` expression in the goal
Hint: Use `set_option trace.split.failure true` to display additional diagnostic information
⊢ False
-/
#guard_msgs in
example : False := by
split
/--
error: Tactic `split` failed: Could not split the goal or any of the following hypotheses: `h1`
Note: `split at *` does not attempt to split at non-propositional hypotheses or those on which other hypotheses depend. It may still be possible to manually split a hypothesis using `split at`
Hint: Use `set_option trace.split.failure true` to display additional diagnostic information
h1 : True
⊢ False
-/
#guard_msgs in
example : False := by
have h1 : True := trivial
split at *
/--
error: Tactic `split` failed: Could not split an `if` or `match` expression in the type `p ∧ q` of `h`
Hint: If you meant to destruct this conjunction, use the `cases` tactic instead
Hint: Use `set_option trace.split.failure true` to display additional diagnostic information
p q : Prop
h : p ∧ q
⊢ p
-/
#guard_msgs in
example {p q : Prop} (h : p q) : p := by
split at h
/--
error: Tactic `split` failed: Could not split an `if` or `match` expression in the type `Equivalence R` of `h`
Hint: If you meant to destruct this structure, use the `cases` tactic instead
Hint: Use `set_option trace.split.failure true` to display additional diagnostic information
α : Sort u_1
R : αα → Prop
h : Equivalence R
⊢ False
-/
#guard_msgs in
example {R : α α Prop} (h : Equivalence R) : False := by
split at h
/--
error: Tactic `split` failed: Could not split the goal or any of the following hypotheses: `t`, `use_dep`
Note: `split at *` does not attempt to split at non-propositional hypotheses or those on which other hypotheses depend. It may still be possible to manually split a hypothesis using `split at`
t : True
dep : if 1 ≥ 0 then True else False
use_dep : dep = dep
⊢ False
-/
#guard_msgs in
example : False := by
have t : True := trivial
have dep : if 1 0 then True else False := by simp
have use_dep : dep = dep := rfl
set_option trace.split.failure true in
split at *
/--
error: Tactic `split` failed: Could not split an `if` or `match` expression in the type `Nat` of `x`
x : Nat := if true = true then 3 else 4
⊢ False
-/
#guard_msgs in
example : False := by
let x := if true then 3 else 4
set_option trace.split.failure true in
split at x
/--
error: Tactic `split` failed: Could not split an `if` or `match` expression in the type `True` of `h`
Hint: Use `set_option trace.split.failure true` to display additional diagnostic information
h : True
⊢ False
-/
#guard_msgs in
example : False := by
have h : True := trivial
split at h