Zulip Chat Archive

Stream: mathlib4

Topic: Create typeclass goals with apply?


Joël Riou (Feb 23 2023 at 19:39):

In mathlib, in order to prove epi g, one could use apply category_theory.epi_of_epi f g, which would create the goal epi (f ≫ g) if this class could not be infered automatically. Is there a way to do the same in mathlib4? (Apart from refine @epi_of_epi _ _ _ _ _ f g ?_.)

Adam Topaz (Feb 23 2023 at 19:51):

mathlib3 also had apply_with ... { instances := ff }. I suppose we have something similar in mathlib4?

Adam Topaz (Feb 23 2023 at 19:53):

https://leanprover-community.github.io/mathlib4_docs/Mathlib/Tactic/ApplyWith.html#Mathlib.Tactic.applyWith

Adam Topaz (Feb 23 2023 at 19:55):

So I think(hope) that apply (config := { synthAssignedInstances := false }) epi_of_epi f g should work?

Joël Riou (Feb 23 2023 at 20:04):

I had just tried this, but it does not seem to work on https://github.com/leanprover-community/mathlib4/pull/2467/files#diff-8fa3d373d90b7fa7d6c162fd2cd095aa9f8b9d8317ccd32b5d3e20e18d361196R105

Adam Topaz (Feb 23 2023 at 20:11):

hmmm... that's not great.

Adam Topaz (Feb 23 2023 at 20:13):

refine probably won't scale for this application. I don't know of any other tricks through.

Reid Barton (Feb 24 2023 at 18:58):

A "trick" that works well in this and similar situations is to use regular definitions rather than classes.


Last updated: Dec 20 2023 at 11:08 UTC