Zulip Chat Archive

Stream: Is there code for X?

Topic: Tactic to find minimal typeclass


Vasily Ilin (Feb 19 2026 at 21:32):

Is there a tactic to find the minimal typeclass for a conclusion to hold?
For example, example [LT β] : Refl (List.le (α := β)) := sorry is not true but this is: example [Preorder β] : Refl (List.le (α := β)) := List.le_refl.

Eric Wieser (Feb 19 2026 at 21:40):

@Alex J. Best had a project for this a while ago, and someone else did more recently

Ruben Van de Velde (Feb 19 2026 at 21:42):

"for a conclusion to hold", no. "for the given proof to work, assuming you've got a working typeclass already (e.g. Preorder in your case)", that's workable

Alex J. Best (Feb 19 2026 at 22:54):

@Anand Rao Tadipatri is one of the more recent people whose thought about this.

Anand Rao Tadipatri (Feb 23 2026 at 17:59):

The proof generalization that @AG and I worked on doesn't handle typeclass generalization at the moment, but I believe @Vlad Tsyrklevich has worked in this direction a bit in Lean4.

Vlad Tsyrklevich (Feb 23 2026 at 18:07):

Assuming you are starting with a working proof, Jovan had some faster code here #mathlib4 > Linter for generalizing type class hypotheses. I think it may not always find the most general type class, but you could run it to a fixpoint if necessary. There's nothing conveniently packaged up as far as I know.


Last updated: Feb 28 2026 at 14:05 UTC