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

51 lines
1.7 KiB
Lean4

/-!
This test checks what deriving `DecidableEq` does when the inductive type has
non-injective indices, and just how bad the error messages are.
-/
opaque f : Nat Nat
set_option deriving.decEq.linear_construction_threshold 0
set_option deriving.beq.linear_construction_threshold 0
/--
error: Dependent elimination failed: Failed to solve equation
f n✝ = f n
-/
#guard_msgs(pass trace, all) in
inductive T : (n : Nat) Type where
| mk1 : Fin n T (f n)
| mk2 : Fin (2*n) T (f n)
deriving BEq, DecidableEq
set_option deriving.decEq.linear_construction_threshold 10000
set_option deriving.beq.linear_construction_threshold 10000
/--
error: Tactic `cases` failed with a nested error:
Dependent elimination failed: Failed to solve equation
f n✝¹ = f n✝
at case `T'.mk1` after processing
_, (T'.mk1 _ _), _
the dependent pattern matcher can solve the following kinds of equations
- <var> = <term> and <term> = <var>
- <term> = <term> where the terms are definitionally equal
- <constructor> = <constructor>, examples: List.cons x xs = List.cons y ys, and List.cons x xs = List.nil
---
error: Tactic `cases` failed with a nested error:
Dependent elimination failed: Failed to solve equation
f n✝¹ = f n✝
at case `T'.mk1` after processing
_, (T'.mk1 _ _), _
the dependent pattern matcher can solve the following kinds of equations
- <var> = <term> and <term> = <var>
- <term> = <term> where the terms are definitionally equal
- <constructor> = <constructor>, examples: List.cons x xs = List.cons y ys, and List.cons x xs = List.nil
-/
#guard_msgs(pass trace, all) in
inductive T' : (n : Nat) Type where
| mk1 : Fin n T' (f n)
| mk2 : Fin (2*n) T' (f n)
deriving BEq, DecidableEq