Zulip Chat Archive

Stream: general

Topic: How to list all applicable theorems?


Daniel Donnelly (Apr 24 2021 at 07:00):

Given a list of types, how can I list all applicable rules (definitions, lemmas, theorems, etc) such that you can apply the rule to the list of arguments and get a proof of something?

Scott Morrison (Apr 24 2021 at 07:03):

I'm not sure the question is well defined. Every single declaration is, after all, a proof of something.

Scott Morrison (Apr 24 2021 at 07:03):

Do you want to use everything in the list of arguments?

Scott Morrison (Apr 24 2021 at 07:04):

Or perhaps prove something that is not a Pi-type?

Daniel Donnelly (Apr 24 2021 at 07:05):

I am thinking about ATP and was wondering what API's Lean offers for automated reasoning

Daniel Donnelly (Apr 24 2021 at 07:05):

Sort of like "combinatorial chemistry"

Scott Morrison (Apr 24 2021 at 07:06):

So you'll have to say what you want to do. :-)

Scott Morrison (Apr 24 2021 at 07:07):

Reading the implementations of library_search and solve_by_elim might give you a sense of how to do this sort of thing. (Not sure what your background is.)

Daniel Donnelly (Apr 24 2021 at 07:07):

@Scott Morrison thx that helps. I will read those

Daniel Donnelly (Apr 24 2021 at 07:14):

@Scott Morrison can you give a short and sweet example of using library_search and / or suggest?

Daniel Donnelly (Apr 24 2021 at 07:14):

For instance given n : N, m : N what are all applicable definitions for example

Scott Morrison (Apr 24 2021 at 07:15):

That's not at all what library_search does.

Scott Morrison (Apr 24 2021 at 07:15):

See https://leanprover.zulipchat.com/#narrow/stream/113489-new-members/topic/Extensionality.20for.20big.20operators for a recent example of someone finding library_search useful.

Scott Morrison (Apr 24 2021 at 07:15):

As I said above, your question as posed doesn't make much sense.

Scott Morrison (Apr 24 2021 at 07:15):

You need to explain what you mean by "applicable".

Daniel Donnelly (Apr 24 2021 at 07:16):

example (n m k : ℕ) : n * (m - k) = n * m - n * k :=
by library_search -- Try this: exact nat.mul_sub_left_distrib n m k

Daniel Donnelly (Apr 24 2021 at 07:16):

found some examples on library page, in other words

Daniel Donnelly (Apr 24 2021 at 07:18):

@Scott Morrison how do I include library_search into the lean file I am editing?

Scott Morrison (Apr 24 2021 at 07:19):

import tactic.suggest

Scott Morrison (Apr 24 2021 at 07:19):

or just import tactic which imports the kitchen sink.


Last updated: Dec 20 2023 at 11:08 UTC