lean4-htt/tests/lean/run/3386.lean
Joachim Breitner e96467f500
refactor: introduce SameCtorUtils (#10316)
This PR shares common functionality relate to equalities between same
constructors, and when these are type-correct. In particular it uses the
more complete logic from `mkInjectivityThm` also in other places, such
as `CasesOnSameCtor` and the deriving code for `BEq`, `DecidableEq`,
`Ord`, for more consistency and better error messages.
2025-09-10 14:32:58 +00:00

24 lines
815 B
Text

/- Verify that injectivity lemmas are constructed with the right level of generality
in order to avoid type errors.
-/
inductive Tyₛ : Type (u+1)
| SPi : (T : Type u) -> (T -> Tyₛ) -> Tyₛ
set_option deriving.decEq.linear_construction_threshold 0
inductive Tmₛ.{u} : Tyₛ.{u} -> Type (u+1)
| app : Tmₛ (.SPi T A) -> (arg : T) -> Tmₛ (A arg)
/--
info: Tmₛ.app.injEq.{u} {T : Type u} {A : T → Tyₛ} (a✝ : Tmₛ (Tyₛ.SPi T A)) (arg : T) (a✝¹ : Tmₛ (Tyₛ.SPi T A)) :
(a✝.app arg = a✝¹.app arg) = (a✝ = a✝¹)
-/
#guard_msgs in
#check Tmₛ.app.injEq
/--
info: Tmₛ.app.inj.{u} {T : Type u} {A : T → Tyₛ} {a✝ : Tmₛ (Tyₛ.SPi T A)} {arg : T} {a✝¹ : Tmₛ (Tyₛ.SPi T A)} :
a✝.app arg = a✝¹.app arg → a✝ = a✝¹
-/
#guard_msgs in
#check Tmₛ.app.inj