Zulip Chat Archive
Stream: mathlib4
Topic: rfl tactic
Scott Morrison (Sep 18 2022 at 23:44):
@Newell Jensen, I agree relationAppM?
belongs higher up. #253 hasn't seen much progress recently; perhaps one solution is to make a mini-PR with just relationAppM?
in some "central" location. You can then use it for your work, and #253 can be refactored to use it.
Newell Jensen (Sep 18 2022 at 23:56):
@Scott Morrison from the current directory structure my suggestion would be to make a directory Relation
in the Tactic
folder and then within it that we could have Symm.lean, Trans.lean, Rfl.lean
and Main.lean
(this actually follows the directory structure in Lean4).
Scott Morrison (Sep 18 2022 at 23:58):
That sounds fine. Where in would you put something like relationAppM?
? That feels like it should go somewhere even more central, e.g. Mathlib/Lean/Expr.lean
.
Newell Jensen (Sep 18 2022 at 23:59):
I was thinking in the Main.lean
but if others think it should be somewhere else and have better reasons than that is probably the better solution. I was just modeling my suggestion after the directory structure within Lean4
s tactics.
Newell Jensen (Sep 19 2022 at 00:03):
From the other code in Mathlb/Lean/Expr
folder seems better to keep tactic code in the Tactic
directory IMHO.
Newell Jensen (Sep 19 2022 at 00:37):
@Scott Morrison here is #425. Thanks for the input.
Johan Commelin (Sep 19 2022 at 05:25):
@Newell Jensen Note that you can write mathlib4#425
and zulip will turn this into mathlib4#425. This works with every repo in the leanprover-community organization on github.
Newell Jensen (Sep 19 2022 at 05:30):
Thanks @Johan Commelin
Newell Jensen (Sep 22 2022 at 20:21):
@Mario Carneiro just put up mathlib4#436 and let me know if you can think of any further corner cases to check for the attribute parsing. I based this branch off of mathlib4#425 but for some reason github is showing the additional file from mathlib4#425 (will most likely go away if that branch lands first).
Newell Jensen (Sep 22 2022 at 20:26):
From what I read online having two PRs from dependent branches would be handled appropriately. Seeing the commit history of the parent branch in the child PR is making me queasy... :laughing:
Mario Carneiro (Sep 22 2022 at 20:44):
yeah that's normal
Newell Jensen (Sep 22 2022 at 22:21):
@Mario Carneiro updated the branch to use elab_rules
and pushed. However, something I noticed, and this may not be a big deal, is that the docstring that pops up from the tool tip seems to be affected by the priority. For example, in the tests, if you however over by rfl
in the example that uses the refl
attribute, it will show the docstring from Lean 4 and not the docstring for the tactic I wrote. Is there a way to also set the priority of the docstring?
Mario Carneiro (Sep 22 2022 at 22:24):
Yes, that's intentional. It's not priority based, it's just the docs on the syntax declaration that are being shown, which should incorporate elements of all the elab_rules associated to that syntax
Mario Carneiro (Sep 22 2022 at 22:24):
which makes things a bit awkward for something like a mathlib extension of a core tactic
Mario Carneiro (Sep 22 2022 at 22:25):
it might be possible to overwrite the doc string on the original syntax?
Mario Carneiro (Sep 22 2022 at 22:28):
Nope, it panics if you call addDocString
on a declaration from another module
Newell Jensen (Sep 22 2022 at 22:30):
I mean, its not a big deal, at least IMHO, since the docstring from Lean 4 is valid as well so.... just wanted to bring your attention to it in case you felt like it should be changed somehow.
Mario Carneiro (Sep 22 2022 at 22:34):
yeah, the easiest way to address the problem is to make the docstring of the core tactic vague enough to apply to your version as well
Newell Jensen (Sep 22 2022 at 22:39):
Its just the docstring for macro "rfl" : tactic => `(eq_refl)
that shows up, so unless you think we should change that, won't pay it anymore mind. The only suggestion that I would have is that we could change that dosctring so it doesn't mention the extensibility, i.e. the second sentence, and extract that to sit in a non-docstring comment.
Mario Carneiro (Sep 22 2022 at 22:42):
The docstring there is the main docstring for rfl
Mario Carneiro (Sep 22 2022 at 22:43):
it's probably a bit misleading that it's written using the macro
command since it's supposed to be only the first of multiple implementations
Mario Carneiro (Sep 22 2022 at 22:45):
why wouldn't we mention the extensibility? That's an important piece of information for readers, especially if they are looking at a definition that says only macro "rfl" : tactic => `(eq_refl)
Newell Jensen (Sep 22 2022 at 22:48):
I don't know where all the docstrings show up within the ecosystem so that suggestion could definitely be misplaced. I was only viewing it from a tooltip perspective. Where are all the places that the docstrings show up?
Mario Carneiro (Sep 22 2022 at 22:54):
The tooltip shows the documentation on the syntax "rfl"
declaration
Mario Carneiro (Sep 22 2022 at 22:55):
so if you have
/-- doc 1 -/
syntax "foo" : term
/-- doc 2 -/
macro_rules | `(foo) => ...
/-- doc 3 -/
elab_rules | `(foo) => ...
then you will see only doc 1
in the tooltip
Mario Carneiro (Sep 22 2022 at 22:56):
doc 2
and doc 3
are more code-reading focused documentation
Mario Carneiro (Sep 22 2022 at 22:59):
doc 1
should summarize all the macro_rules and elab_rules that will be declared for it because it's the user-facing documentation
Newell Jensen (Sep 22 2022 at 23:18):
Mario Carneiro said:
doc 1
should summarize all the macro_rules and elab_rules that will be declared for it because it's the user-facing documentation
If I am following you correctly then this would imply that I would need to create a branch in Lean 4 to update this doc 1
, correct?
Mario Carneiro (Sep 23 2022 at 00:05):
yes
Mario Carneiro (Sep 23 2022 at 00:05):
but lean 4 welcomes documentation improvements so I don't think this would be a major problem
Newell Jensen (Sep 29 2022 at 18:00):
@Mario Carneiro I see that you are trying to merge the rfl
branch before the one that was stubbed out with some code from Siddhartha. It might be too late and not a big deal since the one has the code from the other.
Mario Carneiro (Sep 29 2022 at 18:01):
I removed that part
Newell Jensen (Sep 29 2022 at 18:01):
Yeah just saw that
Newell Jensen (Sep 29 2022 at 18:01):
Cool, will start looking at next tactic I should take on...thanks for the help.
Mario Carneiro (Sep 29 2022 at 18:02):
The original implementation wasn't great, and I don't think it's needed here anyway since you are already checking that the two sides are defeq
Mario Carneiro (Sep 29 2022 at 18:06):
@Newell Jensen A procedural note: you should make PRs originating in the mathlib4 repo itself, from a branch you create to master, or else the CI won't run on it
Newell Jensen (Sep 29 2022 at 18:07):
What did I do (just to be clear where my error was)?
Mario Carneiro (Sep 29 2022 at 18:11):
You PR'd from your fork of mathlib4
Mario Carneiro (Sep 29 2022 at 18:12):
the mathlib4 CI doesn't run on forks
Newell Jensen (Sep 29 2022 at 18:18):
Ah okay, so used to doing it from forks didn't realize that I needed to just do it directly to the repo. mathlib4
seems unique in this regard (compared to lean 4
etc)
Mario Carneiro (Sep 29 2022 at 18:19):
it's the same procedure used in mathlib
repo, but yes it is a bit unique compared to most github projects
Newell Jensen (Sep 29 2022 at 18:29):
We don't need mathlib4#425 then now correct?
Last updated: Dec 20 2023 at 11:08 UTC