Skip to content

feat: add List.prod, Array.prod, and Vector.prod#13200

Open
kim-em wants to merge 1 commit intoleanprover:masterfrom
kim-em:list-prod
Open

feat: add List.prod, Array.prod, and Vector.prod#13200
kim-em wants to merge 1 commit intoleanprover:masterfrom
kim-em:list-prod

Conversation

@kim-em
Copy link
Copy Markdown
Collaborator

@kim-em kim-em commented Mar 31, 2026

This PR adds prod (multiplicative fold) for List, Array, and Vector, mirroring the existing sum API. Includes basic simp lemmas (prod_nil, prod_cons, prod_append, prod_singleton, prod_reverse, prod_push, prod_eq_foldl), Nat-specialized lemmas (prod_pos_iff_forall_pos_nat, prod_eq_zero_iff_exists_zero_nat, prod_replicate_nat), Int-specialized lemmas (prod_replicate_int), cross-type lemmas (prod_toArray, prod_toList), and Perm.prod_nat with grind patterns.

The min/max pigeonhole-style bounds from the sum Nat/Int files are omitted as they don't have natural multiplicative analogues.

🤖 Prepared with Claude Code

This PR adds `prod` (multiplicative fold) for `List`, `Array`, and `Vector`,
mirroring the existing `sum` API. Includes basic simp lemmas (`prod_nil`,
`prod_cons`, `prod_append`, `prod_singleton`, `prod_reverse`, `prod_push`,
`prod_eq_foldl`), Nat-specialized lemmas (`prod_pos_iff_forall_pos_nat`,
`prod_eq_zero_iff_exists_zero_nat`, `prod_replicate_nat`), Int-specialized
lemmas (`prod_replicate_int`), cross-type lemmas (`prod_toArray`, `prod_toList`),
and `Perm.prod_nat` with grind patterns.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kim-em kim-em added the changelog-library Library label Mar 31, 2026
@kim-em kim-em requested a review from digama0 as a code owner March 31, 2026 03:58
@kim-em kim-em added the changelog-library Library label Mar 31, 2026
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Mar 31, 2026
@mathlib-lean-pr-testing
Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase f395593ffce1b94cdd025ba51c23aa5eeef7e353 --onto 4786e082dca22873d14d2a5b9b7c8843380c6e78. You can force Mathlib CI using the force-mathlib-ci label. (2026-03-31 04:44:47)

@leanprover-bot
Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase f395593ffce1b94cdd025ba51c23aa5eeef7e353 --onto cfa8c5a036d6990635c6ec50b02d0e806995cec3. You can force reference manual CI using the force-manual-ci label. (2026-03-31 04:44:49)

@kim-em kim-em requested a review from TwoFX March 31, 2026 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-library Library toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants