Zulip Chat Archive
Stream: new members
Topic: attributes
Alex Zhang (May 28 2021 at 02:51):
simp * with parity_simps
uses attribute parity_simps
. Is there any list documented of such attributes such that if I want to usesimp with
, I can look for an attribute that I want to use?
Eric Rodriguez (May 28 2021 at 05:15):
they're not that commonly used, people just tend to jam many things into simp
. i mentioned a couple more of them here
Bryan Gin-ge Chen (May 28 2021 at 05:33):
I think it might be something someone could get our documentation generator to collect, so I've opened an issue: doc-gen#133
Alex Zhang (Jun 29 2021 at 03:45):
What is the function of attitude reducibility
Kevin Buzzard (Jun 29 2021 at 07:00):
Attributes like reducible
are a message to the elaborator
Alex Zhang (Jun 29 2021 at 12:02):
Right! I noticed reducible
. There is also one called reducibility
, between which I don't fully understand the difference.
Kevin Buzzard (Jun 29 2021 at 18:47):
I can't find reducibility
in mathlib. Can you give me an example of what you're talking about?
Eric Wieser (Jun 29 2021 at 18:49):
I think docs#tactic.decl_reducibility is the underlying representation that @[reducible]
etc use
Floris van Doorn (Jun 29 2021 at 22:01):
Most low-level tactics use docs#tactic.transparency to determine how definitions to unfold, for example in docs#tactic.is_def_eq or docs#tactic.whnf. It has two more options than docs#tactic.decl_reducibility (which is new to me): instances
(this is used by type-class inference, and includes all reducible definitions and semireducible instances), and none
(unfold nothing).
Alex Zhang (Aug 21 2021 at 09:49):
Could anyone please explain the tag @[nolint unused_arguments]
before the definition of matices?
@[nolint unused_arguments]
def matrix (m : Type u) (n : Type u') [fintype m] [fintype n] (α : Type v) : Type (max u u' v) :=
m → n → α
Alex J. Best (Aug 21 2021 at 10:11):
Mathlib has several linters which check code added to the library doesn't contain certain mistakes or inefficiencies. One of these is the unused arguments linter, which complains when you try and a declaration with assumptions that aren't used. Most of the time this is useful but occasionally we want to have some assumptions on a definition that aren't required to make the definition itself. In this case mathlib assumes matrices are indexed by finite types even though this isnt necessary to define matrices as functions from m and n to alpha. So we ask the unused arguments linter to ignore this declaration using the nolint attribute.
Patrick Massot (Aug 21 2021 at 10:14):
That doesn't explain why this particular instance is allowed to be an exception.
Scott Morrison (Aug 21 2021 at 10:16):
Maybe one can just remove the [fintype]
arguments in the actual definition. (Certainly they'll be needed later.)
Scott Morrison (Aug 21 2021 at 10:16):
Ideally every @[nolint]
would also come with a comment explaining what goes wrong without it.
Scott Morrison (Aug 21 2021 at 10:16):
It's possible that in this case someone just felt the [fintype]
arguments should be there from the beginning to "signal intent".
Scott Morrison (Aug 21 2021 at 10:17):
(Usually that's a bad idea, however. Infinite matrices are actually a reasonable thing sometimes!)
Alex J. Best (Aug 21 2021 at 10:19):
Yes I don't personally understand why the assumption is here in this case. Just explaining the general principle. If you know the reason Patrick please tell us
Alex Zhang (Aug 21 2021 at 10:24):
Many thanks for your explanations!
Eric Rodriguez (Aug 21 2021 at 10:26):
Alex J. Best said:
Yes I don't personally understand why the assumption is here in this case. Just explaining the general principle. If you know the reason Patrick please tell us
seems it's just always been like that: #334, and then no-one bothered removing the assumption
Patrick Massot (Aug 21 2021 at 10:39):
I vote for removing it
Eric Wieser (Aug 21 2021 at 10:50):
Removing it would stop fintype diamonds coming up in the type itself, which is probably a good thing!
Eric Rodriguez (Aug 21 2021 at 11:22):
I was starting on this, and matrix.mul
is based on a finite definition. We could switch to composition, right? My brain is currently in "adding [fintype X]
when Lean shouts" mode...
Johan Commelin (Aug 21 2021 at 11:52):
multiplying infinite matrices is tricky
Eric Rodriguez (Aug 21 2021 at 12:01):
so should I just leave it as is for now with fintypes sprinkled?
Johan Commelin (Aug 21 2021 at 12:13):
Yeah, that's what I would do.
Johan Commelin (Aug 21 2021 at 12:13):
Someone can add a matrix.sparse_mul
later (or some other variant).
Scott Morrison (Aug 21 2021 at 12:43):
Don't you just introduce the fintype
hypothesis at the moment you define mul
?
Eric Rodriguez (Aug 21 2021 at 12:46):
yes, that's what I'm doing now but I was thinking if there was some way to have infinite matrix mul
Alex J. Best (Aug 21 2021 at 12:56):
Could there be a useful version using docs#finsum of the support of the set of products of entries to be added? Then the mul of any strictly upper triangular (i.e. nilpotent) matrices would be defined
Johan Commelin (Aug 21 2021 at 13:02):
I guess that works, but changing to finsum
will be a refactor that requires quite a bit more work than simply removing these fintype
assumptions.
Johan Commelin (Aug 21 2021 at 13:03):
If someone volunteers to do that, great!
Eric Rodriguez (Aug 21 2021 at 15:58):
i started doing this in branch#matrix_not_fintype; all I've done so far is busy-work (removing fintypes), but I'll start looking at some proofs soon... I think minor
could have less fintypes
Eric Rodriguez (Aug 21 2021 at 15:59):
one that I'm specifically interested in is induction_on; that definitely doesn't seem fintype dependent, but the proof currently uses a blunt fintype argument. however, I don't think I know the areas of mathlib that deal with these sorts of sums yet; can anyone take a look at that?
Alex J. Best (Aug 21 2021 at 17:01):
I don't think this is true without fintype (I'm not at lean so I could be wrong but): the proposition "M has only finitely many nonzero entries" is true for the standard basis and is preserved by addition but isn't true for arbitrary (infinite) matrices
Eric Rodriguez (Aug 21 2021 at 17:03):
ahh, that's a nice counterexample - thanks :)
Kevin Buzzard (Aug 21 2021 at 19:07):
In the theory of p-adic modular forms there are infinite-dimensional spaces of forms, and Hecke operators can be represented as explicit matrices over a topological ring which don't have finite support in any sense, however there is a tmul
or whatever it's called, and we only apply it when everything is absolutely convergent so there is no issue with order of summation.
Kevin Buzzard (Aug 21 2021 at 19:10):
If someone wants to knock up a tmul which works for the p-adic numbers then we could be proving theorems about p-adic modular forms before we've proved anything about classical modular forms, because p-adic modular forms have several combinatorial definitions
Johan Commelin (Aug 21 2021 at 19:27):
@Kevin Buzzard What do you mean with tmul
? In mathlib tmul
is the name for elementary tensors...
Do you mean the multiplicative variant of tsum
?
Kevin Buzzard (Aug 21 2021 at 19:44):
Yeah I just got the name wrong, I have a bad memory and lousy internet. To compute the product of the infinite matrices you use tsum to compute the coefficients.
Johan Commelin (Aug 21 2021 at 19:48):
But tsum
already exists. So everything is there in principal, right?
Kevin Buzzard (Aug 21 2021 at 20:04):
Right --- and then one has to prove things like mul_assoc etc
Kevin Buzzard (Aug 21 2021 at 20:04):
There's also a theory of characteristic power series if things converge enough
Kevin Buzzard (Aug 21 2021 at 20:06):
There's also a finite rank theory, where there is a finite support condition on columns but not rows -- then products are always well-defined
Eric Rodriguez (Aug 22 2021 at 15:50):
Eric Rodriguez (Aug 22 2021 at 15:50):
It'd be nice if it was merged soon, but honestly I had to change far less files than I thought so it's not like going to keep breaking
Eric Rodriguez (Aug 22 2021 at 15:50):
Most things like multiplying matrices it turns out ;b
Eric Rodriguez (Aug 22 2021 at 19:22):
Now compiles with no linter unused warnings :)
Eric Rodriguez (Aug 23 2021 at 18:00):
just wanna bump this — I feel like it's worth merging soon so people can start thinking about infinite matrix stuff
Last updated: Dec 20 2023 at 11:08 UTC