Zulip Chat Archive
Stream: mathlib4
Topic: exact? suggests "Tactic."
Alex Meiburg (Apr 16 2024 at 17:07):
import Mathlib
example [Nonempty α] [Fintype α] : 0 < Finset.univ.card (α := α) :=
by exact?
gives
Try this: exact Tactic.card_univ_pos α
but
example [Nonempty α] [Fintype α] : 0 < Finset.univ.card (α := α) :=
by exact Tactic.card_univ_pos α
gives
unknown identifier 'Tactic.card_univ_pos'
Damiano Testa (Apr 16 2024 at 17:33):
It seems that exact?
find private
theorems:
Mathlib/Data/Fintype/Card.lean:1302:private theorem card_univ_pos (α : Type*) [Fintype α] [Nonempty α] :
Matthew Ballard (Apr 16 2024 at 17:34):
(Perfect time for a chrome incognito emoji)
Alex Meiburg (Apr 16 2024 at 17:37):
Raises question of why that theorem is private :thinking:
Damiano Testa (Apr 16 2024 at 17:41):
I think that you "should" be using docs#Finite.card_pos, that uses Prop
-valued assumptions, rather than Type
-valued ones.
Damiano Testa (Apr 16 2024 at 17:42):
Nevertheless, this exact?
behaviour seems suboptimal...
Kyle Miller (Apr 16 2024 at 17:55):
Alex Meiburg said:
Raises question of why that theorem is private :thinking:
Easy answer: it used to be for a positivity
extension, but that extension is currently commented out since it was never ported. It's good practice for tactics to restate all theorems that they use, rather than referring to global theorems, since that reduces the risk of refactors breaking the assumptions in the metaprograms. The Qq library does help a bit with reducing this risk.
Kyle Miller (Apr 16 2024 at 17:56):
It's wrapping up Finset.univ_nonempty.card_pos
, which is already in the library, and which is what exact?
ought to give you.
Kim Morrison (Apr 17 2024 at 03:13):
Alex Meiburg said:
import Mathlib example [Nonempty α] [Fintype α] : 0 < Finset.univ.card (α := α) := by exact?
gives
Try this: exact Tactic.card_univ_pos α
but
example [Nonempty α] [Fintype α] : 0 < Finset.univ.card (α := α) := by exact Tactic.card_univ_pos α
gives
unknown identifier 'Tactic.card_univ_pos'
This is already fixed on nightly-testing, so should come good when we release v4.8.0-rc1.
Kim Morrison (Apr 17 2024 at 03:14):
(Also, just noting how autoImplicit
fragmentation causes a problem: this is a fine MWE in a downstream project that doesn't turn off autoImplicits, but can't be copied and pasted as is into Mathlib...)
Mario Carneiro (Apr 17 2024 at 05:43):
to be fair it also can't be copied and pasted as is into mathlib because it uses import Mathlib
Kevin Buzzard (Apr 17 2024 at 05:46):
It can be copied and pasted into Mathlib/scratch.lean
Last updated: May 02 2025 at 03:31 UTC