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
feat(algebra/free_algebra): Define a grading #4321
base: master
Are you sure you want to change the base?
Conversation
noncomputable | ||
instance : has_coe (add_monoid_algebra (free_algebra R X) ℕ) (free_algebra R X) := ⟨ | ||
(add_monoid_algebra.sum_id R : add_monoid_algebra (free_algebra R X) ℕ →ₐ[R] (free_algebra R X)) | ||
⟩ | ||
|
||
@[simp, norm_cast] | ||
lemma coe_def (x : add_monoid_algebra (free_algebra R X) ℕ) : (x : free_algebra R X) = add_monoid_algebra.sum_id R x := rfl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seemed harmless, and it makes the mouthful that is add_monoid_algebra.sum_id
not really matter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean the instance? Why not make it a local instance?
src/data/monoid_algebra.lean
Outdated
@@ -679,6 +684,42 @@ lemma alg_hom_ext_iff {R : Type u₃} [comm_semiring k] [add_monoid G] | |||
(∀ x, φ₁ (finsupp.single x 1) = φ₂ (finsupp.single x 1)) ↔ φ₁ = φ₂ := | |||
⟨λ h, alg_hom_ext h, by rintro rfl _; refl⟩ | |||
|
|||
/-- | |||
The `alg_hom` which maps from a grading of an algebra `A` back to that algebra. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't use the word "grading" in this context. Rather, I would call this map the augmentation map of the monoid algebra: https://ncatlab.org/nlab/show/augmentation+ideal#for_group_algebras
For the Lean identifier, either augmentation
or something like your sum_id
or perhaps sum_coeffs
seems fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind suggesting a complete docstring? My mathematical background is severely lacking.
src/data/monoid_algebra.lean
Outdated
@@ -225,10 +225,10 @@ instance [ring k] [monoid G] : ring (monoid_algebra k G) := | |||
instance [comm_ring k] [comm_monoid G] : comm_ring (monoid_algebra k G) := | |||
{ mul_comm := mul_comm, .. monoid_algebra.ring} | |||
|
|||
instance [semiring k] : has_scalar k (monoid_algebra k G) := | |||
instance {R : Type*} [semiring R] [semiring k] [semimodule R k] : has_scalar R (monoid_algebra k G) := |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you switch the names R
and k
in this instance and the next one? This way around is too confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated #4365 to use a clearer naming
53afbc0
to
9824b22
Compare
9824b22
to
c31795f
Compare
ad8308a
to
a66671e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that if this is to be the way a grading is defined, it might be good to spell out what the heck is going on in the module docstring -- it took me a while to figure out the relationship between grades
and what most people think of as a grading (a decomposition of A into a direct sum of A_i).
-/ | ||
noncomputable | ||
def grades : (free_algebra R X) →ₐ[R] add_monoid_algebra (free_algebra R X) ℕ := | ||
lift R $ finsupp.single 1 ∘ ι R |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have some algebra A (the free algebra), and the question is how to usefully state that A is actually an infinite internal direct sum of submodules A_i. This grades
map here seems to be a map which does the following: if a is in A, let a_i be its i'th "piece". Then a_i is in A_i and all but finitely many a_i are zero. We can regard the a_i as elements of A. Now the a_i is a finite sequence of elements of A. So we can make them into a polynomial a_i X^i. grades
sends a to this polynomial. I am surprised that this is a useful concept! But one cool thing about it is that it does seem to be a ring homomorphism, rather than just an R-module homomorphism. The next lemma says that if you evaluate the polynomial at 1 then you get back the element you started with. I've been out of the loop for over a month -- sorry if all this conversation has been had already. Is this the way to do grading of an algebra? It still seems a bit weird to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think my choice not to use polynomial
was deliberate, since I wasn't really trying to invoke the mental model of one (although admittedly I had not spotted that polynomial A
is defeq to add_monoid_algebra A ℕ
).
I am surprised that this is a useful concept!
It seemed to me like the only (and obvious) way to induce a grading from the universal property alone. I have no idea if this is "how it's done", it's just the way I stumbled upon. I suppose though there's no need for it to be the public interface to the grading, it was just simplest to leave it that way, and the fact it was a ring homomorphism seemed cute, even though there's zero reason to need grades x * grades y
as an alternate spelling of grades (x * y)
.
Is this the way to do grading of an algebra?
I assume you mean for a general algebra?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the question is how to usefully state that A is actually an infinite internal direct sum of submodules A_i
I attempted to do this in #4812. The proofs were really quite painful, and I don't think we want to use an API like that until dfinsupp
is easier to use.
noncomputable | ||
instance : has_coe (add_monoid_algebra (free_algebra R X) ℕ) (free_algebra R X) := ⟨ | ||
(add_monoid_algebra.sum_id R : add_monoid_algebra (free_algebra R X) ℕ →ₐ[R] (free_algebra R X)) | ||
⟩ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this really be an instance? Do we know for sure that this is the coercion that everyone will want? "evaluate the polynomial at 1"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm reading this as "evaluate my direct sum over A_i back into A" - I hadn't thought of the "evaluate the polynomial" interpretation, and I think it hurts rather than hinders
noncomputable | ||
instance : has_coe (add_monoid_algebra (free_algebra R X) ℕ) (free_algebra R X) := ⟨ | ||
(add_monoid_algebra.sum_id R : add_monoid_algebra (free_algebra R X) ℕ →ₐ[R] (free_algebra R X)) | ||
⟩ | ||
|
||
@[simp, norm_cast] | ||
lemma coe_def (x : add_monoid_algebra (free_algebra R X) ℕ) : (x : free_algebra R X) = add_monoid_algebra.sum_id R x := rfl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean the instance? Why not make it a local instance?
… eric-wieser/free_algebra-grading
7274502
to
1d0b9c9
Compare
Now without any real changes to |
@@ -200,6 +200,16 @@ begin | |||
{ rw [single_eq_of_ne h, zero_apply] } | |||
end | |||
|
|||
lemma single_of_single_apply (a a' : α) (b : M) : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Split to #5219
The grading takes the form
free_algebra R X →ₐ[R] add_monoid_algebra (free_algebra R X) ℕ
It's likely that there are more generic lemmas about grading that can be shared with
tensor_algebra
and friends, but that's left to follow-up workR ≠ k
insemimodule R (monoid_algebra k G)
#4365map_finsupp_(sum|prod)
toalg_(hom|equiv)
#4603