-
Notifications
You must be signed in to change notification settings - Fork 298
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?
Changes from all commits
957b483
e789702
87d31ff
778e9db
67e8211
28b1893
ed419ec
d816bfa
aff1486
9f22aa6
e75b7ef
21ca265
62a77f0
fd54b8d
234ff72
eec3c2b
81aa68b
f999d1a
abaa760
b63b36c
e5b725e
b702aab
51900f9
5489c46
3ce401d
38d3e48
082ca79
99b4ac1
303117d
40b1eb8
1a5eaa9
06e16f5
9c41969
2d979c3
bee9b3c
caaa54d
33f38c7
db82059
986ed3c
1d0b9c9
7c58060
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,8 @@ Given a commutative semiring `R`, and a type `X`, we construct the free `R`-alge | |
of the composition of an algebra morphism with `ι` is the algebra morphism itself. | ||
5. `equiv_monoid_algebra_free_monoid : free_algebra R X ≃ₐ[R] monoid_algebra R (free_monoid X)` | ||
6. An inductive principle `induction`. | ||
7. Statements about the natural grading of the free algebra `grades x i`: `grades.map_algebra_map`, | ||
`grades.map_algebra_ι`, and `grades.map_grades`. | ||
|
||
## Implementation details | ||
|
||
|
@@ -371,6 +373,90 @@ begin | |
exact of_id a, | ||
end | ||
|
||
variables {R X} | ||
|
||
/-- | ||
Separate an element of the free algebra into its ℕ-graded components. | ||
|
||
This is defined as an `alg_hom` to `add_monoid_algebra` so that algebra operators can be moved | ||
before and after the mapping. | ||
-/ | ||
noncomputable | ||
def grades : (free_algebra R X) →ₐ[R] add_monoid_algebra (free_algebra R X) ℕ := | ||
lift R $ finsupp.single 1 ∘ ι R | ||
|
||
/-- Recombining the grades recovers the original element-/ | ||
lemma sum_id_grades : | ||
(add_monoid_algebra.sum_id R).comp grades = alg_hom.id R (free_algebra R X) := | ||
begin | ||
ext, | ||
simp [grades, add_monoid_algebra.sum_id_apply, finsupp.sum_single_index], | ||
end | ||
|
||
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 commentThe 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 commentThe 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 |
||
|
||
@[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 | ||
Comment on lines
+396
to
+402
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seemed harmless, and it makes the mouthful that is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You mean the instance? Why not make it a local instance? |
||
|
||
|
||
/-- An element of `R` lifted with `algebra_map` has a single grade 0 element -/ | ||
lemma grades.map_algebra_map (r : R) : | ||
grades (algebra_map R (free_algebra R X) r) = finsupp.single 0 (algebra_map R _ r) := | ||
by simp | ||
|
||
/-- An element of `X` lifted with the canonical `ι R` function has a single grade 1 element -/ | ||
lemma grades.map_ι (x : X) : | ||
grades (ι R x) = finsupp.single 1 (ι R x) := | ||
by simp [grades] | ||
|
||
-- note this is true for any `zero_hom`, not just `grades`. Of course, then we need to repeat this | ||
-- for `add_monoid_hom`, `add_equiv`, `linear_map`, `ring_hom`, `ring_equiv`, `alg_hom`, ... | ||
private lemma map_single_apply (x : free_algebra R X) (i j : ℕ) : | ||
grades (finsupp.single i x j) = finsupp.single i (grades x) j := | ||
by rw [finsupp.single_apply, finsupp.single_apply, apply_ite grades, grades.map_zero] | ||
|
||
/-- The grade-`i` part consists only of itself -/ | ||
@[simp] | ||
lemma grades.map_grades (x : free_algebra R X) (i : ℕ) : | ||
grades (grades x i) = finsupp.single i (grades x i) := | ||
begin | ||
induction x using free_algebra.induction generalizing i, | ||
case h_grade0 : { | ||
rw [grades.map_algebra_map, map_single_apply, grades.map_algebra_map, | ||
finsupp.single_of_single_apply], | ||
}, | ||
case h_grade1 : { | ||
rw [grades.map_ι, map_single_apply, grades.map_ι, | ||
finsupp.single_of_single_apply], | ||
}, | ||
case h_add : x y hx hy { | ||
rw [grades.map_add, finsupp.add_apply, grades.map_add, finsupp.single_add, hx, hy], | ||
}, | ||
case h_mul : f g hx hy { | ||
rw grades.map_mul, | ||
rw add_monoid_algebra.mul_def, | ||
simp_rw [finsupp.sum_apply], | ||
|
||
-- pull the sums to the outside | ||
have : finsupp.single i = finsupp.single_add_hom i := rfl, | ||
rw this, | ||
simp_rw alg_hom.map_finsupp_sum, | ||
simp_rw add_monoid_hom.map_finsupp_sum, | ||
simp_rw finsupp.sum, | ||
congr, ext1 fi, | ||
congr, ext1 gi, | ||
rw ←this, | ||
|
||
-- this proof now resembles the other three | ||
rw [map_single_apply, grades.map_mul, | ||
finsupp.single_of_single_apply], | ||
rw [hx, hy, add_monoid_algebra.single_mul_single], | ||
}, | ||
end | ||
|
||
/-- The star ring formed by reversing the elements of products -/ | ||
instance : star_ring (free_algebra R X) := | ||
{ star := opposite.unop ∘ lift R (opposite.op ∘ ι R), | ||
|
@@ -393,5 +479,4 @@ by simp [star, has_star.star] | |
def star_hom : free_algebra R X ≃ₐ[R] (free_algebra R X)ᵒᵖ := | ||
{ commutes' := λ r, by simp [star_algebra_map], | ||
..star_ring_equiv } | ||
|
||
end free_algebra |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. Split to #5219 |
||
single a ((single a' b) a) = single a' (single a' b) a := | ||
begin | ||
rw [single_apply, single_apply], | ||
ext, | ||
split_ifs, | ||
{ rw h, }, | ||
Vierkantor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ rw [zero_apply, single_apply, if_t_t], }, | ||
end | ||
|
||
lemma support_single_ne_zero (hb : b ≠ 0) : (single a b).support = {a} := | ||
if_neg hb | ||
|
||
|
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 thatpolynomial A
is defeq toadd_monoid_algebra A ℕ
).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 ofgrades (x * y)
.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.
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.