-
Notifications
You must be signed in to change notification settings - Fork 78
Sums and products over arbitrary finite types #1367
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
base: master
Are you sure you want to change the base?
Conversation
Some patterns we've used elsewhere to differentiate are the following:
Depending on the generality of the relevant binary operation (i.e., is it associative, does it distribute over the underlying binary operation?), you might want to go with simply "binary operations on monoids", or something other than "product". |
I think "cartesian product" may be appropriate in this setting, to disambiguate from the "free product of monoids" which, perhaps counterintuitively, is the coproduct in the category of monoids. |
FWIW, I discovered that a very early attempt at the precise operation we want already existed in |
src/group-theory/products-of-tuples-of-elements-commutative-monoids.lagda.md
Outdated
Show resolved
Hide resolved
src/group-theory/products-of-tuples-of-elements-commutative-monoids.lagda.md
Outdated
Show resolved
Hide resolved
src/group-theory/products-of-tuples-of-elements-commutative-monoids.lagda.md
Outdated
Show resolved
Hide resolved
src/group-theory/products-of-tuples-of-elements-commutative-monoids.lagda.md
Outdated
Show resolved
Hide resolved
src/group-theory/products-of-tuples-of-elements-commutative-monoids.lagda.md
Outdated
Show resolved
Hide resolved
src/group-theory/products-of-tuples-of-elements-commutative-monoids.lagda.md
Outdated
Show resolved
Hide resolved
where | ||
|
||
cons-mul-fin-Commutative-Monoid : | ||
(n : ℕ) (f : functional-vec-Commutative-Monoid M (succ-ℕ n)) → |
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.
implicit n
cons-mul-fin-Monoid (monoid-Commutative-Monoid M) | ||
|
||
snoc-mul-fin-Commutative-Monoid : | ||
(n : ℕ) (f : functional-vec-Commutative-Monoid M (succ-ℕ n)) → |
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.
implicit n
where | ||
|
||
extend-mul-fin-Commutative-Monoid : | ||
(n : ℕ) (f : functional-vec-Commutative-Monoid M n) → |
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.
implicit n
mul-fin-unit-Monoid (monoid-Commutative-Monoid M) | ||
``` | ||
|
||
### Splitting products |
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 add a short explanation of what "splitting products" means? I.e.
Given an `n+m`-dimensional vector `f`, the product of its coordinates computes as...
src/group-theory/products-of-tuples-of-elements-commutative-monoids.lagda.md
Outdated
Show resolved
Hide resolved
src/group-theory/products-of-tuples-of-elements-commutative-monoids.lagda.md
Outdated
Show resolved
Hide resolved
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.
Since this file is all about products of finite families of elements, rather than just tuples, I think a better name for this file is products-finite-families-of-elements-commutative-monoids
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.
Actually, a better way to organize this is to add a second file about products of finite families of elements where you consider types A
with a counting, or a proof that A
is finite.
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.
Don't forget to add links both ways between these files
( eq-permutation-list-standard-transpositions-Fin n σ) | ||
``` | ||
|
||
### Products for a count for a type |
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 subsection should be in the Definitions* section
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.
On second thought, this should be factored to a new file.
src/group-theory/products-of-tuples-of-elements-commutative-monoids.lagda.md
Outdated
Show resolved
Hide resolved
src/group-theory/products-of-tuples-of-elements-commutative-monoids.lagda.md
Outdated
Show resolved
Hide resolved
src/group-theory/products-of-tuples-of-elements-commutative-monoids.lagda.md
Outdated
Show resolved
Hide resolved
### Splitting products | ||
|
||
```agda |
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.
please add an explanation for what splitting products means here as well
src/group-theory/products-of-tuples-of-elements-monoids.lagda.md
Outdated
Show resolved
Hide resolved
The product operation extends the binary multiplication operation on a | ||
[commutative monoid](group-theory.commutative-monoids.md) `M` to any family of | ||
elements of `M` indexed by a | ||
[standard finite type](univalent-combinatorics.standard-finite-types.md), or to | ||
any [finite type](univalent-combinatorics.finite-types.md). |
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.
After splitting up the file:
The product operation extends the binary multiplication operation on a | |
[commutative monoid](group-theory.commutative-monoids.md) `M` to any family of | |
elements of `M` indexed by a | |
[standard finite type](univalent-combinatorics.standard-finite-types.md), or to | |
any [finite type](univalent-combinatorics.finite-types.md). | |
We extend the binary multiplication operation on a | |
[commutative monoid](group-theory.commutative-monoids.md) `M` to any family of | |
elements of `M` indexed by a | |
[standard finite type](univalent-combinatorics.standard-finite-types.md). |
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.
Feel free to also try and jam in a concept macro invocation for "product" Disambiguation="of a family of elements in a commutative monoid over a standard finite type"
if you want
where | ||
|
||
shift-mul-fin-Commutative-Monoid : | ||
(n : ℕ) (f : functional-vec-Commutative-Monoid M n) → |
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.
implicit n
|
||
```agda | ||
mul-fin-Monoid : | ||
{l : Level} (M : Monoid l) (n : ℕ) → |
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.
implicit n
in this file as well?
(n : ℕ) → functional-vec-Commutative-Monoid (succ-ℕ n) → | ||
type-Commutative-Monoid M | ||
head-functional-vec-Commutative-Monoid = | ||
head-functional-vec-Monoid (monoid-Commutative-Monoid M) | ||
|
||
tail-functional-vec-Commutative-Monoid : | ||
(n : ℕ) → functional-vec-Commutative-Monoid (succ-ℕ n) → | ||
functional-vec-Commutative-Monoid n | ||
tail-functional-vec-Commutative-Monoid = | ||
tail-functional-vec-Monoid (monoid-Commutative-Monoid M) | ||
|
||
cons-functional-vec-Commutative-Monoid : | ||
(n : ℕ) → type-Commutative-Monoid M → | ||
functional-vec-Commutative-Monoid n → | ||
functional-vec-Commutative-Monoid (succ-ℕ n) | ||
cons-functional-vec-Commutative-Monoid = | ||
cons-functional-vec-Monoid (monoid-Commutative-Monoid M) | ||
|
||
snoc-functional-vec-Commutative-Monoid : | ||
(n : ℕ) → functional-vec-Commutative-Monoid n → |
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.
Again, can these n
's be made implicit?
(n : ℕ) (v w : functional-vec-Monoid M n) → functional-vec-Monoid M n | ||
add-functional-vec-Monoid n = binary-map-functional-vec n (mul-Monoid M) | ||
|
||
associative-add-functional-vec-Monoid : | ||
(n : ℕ) (v1 v2 v3 : functional-vec-Monoid M n) → |
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.
implicit n
?
[standard finite type](univalent-combinatorics.standard-finite-types.md), or by | ||
a [finite type](univalent-combinatorics.finite-types.md). |
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.
to be consistent with commutative monoids, this file can be split into two: one for tuples and one for finite families of elements
[standard finite type](univalent-combinatorics.standard-finite-types.md), or by | ||
a [finite type](univalent-combinatorics.finite-types.md). |
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.
Again, to be consistent with commutative monoids, this can also be split into two files.
Co-authored-by: Fredrik Bakke <fredrbak@gmail.com>
I declare this blocked on #1397, so we can get the better names for things. |
In preparation for polynomials and formal power series, most notably multiplication of formal power series (#1357), this starts digging into sums over arbitrary finite types, and generalizes from sums on e.g. semirings to products on monoids -- mostly commutative monoids, since they're the ones where arbitrary finite sums make sense.
There is some tension with naming over whether
group-theory.products-monoids
should indicate the monoid on the Cartesian product of two other monoids, or products of elements in a monoid. Since monoids (and groups in general) use multiplicative terminology, we can't get away with what rings have done by differentiating sums and products. (And we don't have any support for products of elements of rings, either, though the generalization to commutative monoids is intended to make that possible down the road.)This is marked a draft because there's one last thing I want to prove, which is that you can split sums over coproducts of arbitrary finite types.