Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apply?/exact?/have?/rw? issues #3426

Open
1 of 3 tasks
semorrison opened this issue Apr 13, 2023 · 8 comments
Open
1 of 3 tasks

apply?/exact?/have?/rw? issues #3426

semorrison opened this issue Apr 13, 2023 · 8 comments
Labels
bug Something isn't working t-meta Tactics, attributes or user commands

Comments

@semorrison
Copy link
Contributor

semorrison commented Apr 13, 2023

Please list bugs in these tactics here.

@semorrison
Copy link
Contributor Author

Should

example (p q : Prop) : (p ↔ q) ↔ (¬p ↔ ¬q) := by library_search

work? The flipped version successfully finds not_iff_not, and I thought library_search was meant to handle the symmetric versions of lemmas.

@semorrison
Copy link
Contributor Author

From https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/Showing.20that.20a.20structure.20is.20.60Fintype.60

import Mathlib.Data.Fintype.Sigma
import Mathlib.Tactic.LibrarySearch

instance [Fintype α] (f : α ≃ β) : Fintype β := by library_search
-- suggestion: refine { elems := ?_ (id (Equiv.symm f)), complete := (_ : ∀ (x : β), x ∈ ?_) }

@fpvandoorn fpvandoorn changed the title library_search issues apply?/exact?/have?/rw? issues Jun 28, 2023
@fpvandoorn
Copy link
Member

@semorrison I hope you don't mind that I hijacked your first comment here to keep track of some Zulip threads where I reported issues.

@fpvandoorn fpvandoorn added bug Something isn't working t-meta Tactics, attributes or user commands labels Jun 28, 2023
@ocfnash
Copy link
Contributor

ocfnash commented Jul 20, 2023

From https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/library_search.20fails.20to.20find.20theorem/near/377013391

import Mathlib

example {n : ℕ} : n = 00 < n := by exact? -- Fails to find `eq_zero_or_pos`

including reply from @dwrensha pointing out that this is a consequence of the isInternal' heuristic here:

| .str _ s => "match_".isPrefixOf s || "proof_".isPrefixOf s || "eq_".isPrefixOf s

@grhkm21
Copy link
Collaborator

grhkm21 commented Oct 15, 2023

import Mathlib.Tactic

example (h : ¬P ∨ Q) (h' : P) : Q := by exact? -- fails
example (h : ¬P ∨ Q) (h' : P) : Q := imp_iff_not_or.mpr h h'

@fpvandoorn
Copy link
Member

@grhkm21 I believe this is an intentional limitation: some lemmas apply to every goal, and for performance reasons they are not tried by exact?. Your example is one such lemma.

@semorrison
Copy link
Contributor Author

But it might well be possible to re-enable trying these universal lemmas, as in the current model they would be tried last, and we have an automatic mechanism to stop before reaching a timeout. Someone should try!

@adomasbaliuka
Copy link
Collaborator

adomasbaliuka commented Jan 7, 2024

import Mathlib

example (x y c : ℝ) (h: 0 < c) : x < y → c * x < c * y := by exact?

suggests the malformed term

  exact fun a =>
    (fun {α} {a b c} [Mul α] [Zero α] [Preorder α] [PosMulStrictMono α] [PosMulReflectLT α] a0 =>
        (mul_lt_mul_left a0).mpr)
      h a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working t-meta Tactics, attributes or user commands
Projects
None yet
Development

No branches or pull requests

5 participants