feat: shuffles, permuted lists and other prerequisites for combinatorics - #43779
feat: shuffles, permuted lists and other prerequisites for combinatorics#43779SashaIr wants to merge 4 commits into
Conversation
Test for the Data\List\Shuffle.lean file, to be applied everywhere if approved.
Welcome new contributor!Thank you for contributing to Mathlib! If you haven't done so already, please review our contribution guidelines, as well as the style guide and naming conventions. In particular, we kindly remind contributors that we have guidelines regarding the use of AI when making pull requests. We use a review queue to manage reviews. If your PR does not appear there, it is probably because it is not successfully building (i.e., it doesn't have a green checkmark), has the If you haven't already done so, please come to Zulip and join the Lean community. |
PR summary ba3d3b0020
|
| Files | Import difference |
|---|---|
| ../mathlib-ci/scripts/pr_summary/import_trans_difference.sh all | |
| There are 6312 files with changed transitive imports taking up over 287577 characters: this is too many to display! | |
You can run this locally from your mathlib4 directory: |
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
Declarations diff (regex)
+ Finite.toLattice
+ Finite.toLatticeOfSup
+ IsShuffle
+ IsShuffle.filter_eq_left
+ IsShuffle.filter_eq_right
+ IsShuffle.symm
+ append_mem_shuffle
+ card_permutations_toFinset
+ card_rearrangements
+ card_rearrangements_eq_sum
+ card_rearrangements_mul_prod_factorial
+ countP_eq_card_filter_range
+ eq_of_getD_eq
+ eq_of_length_eq_of_getD_eq
+ exists_bijOn_of_card_fiber_eq
+ exists_equiv_of_card_fiber_eq
+ fiberSubtypeEquiv
+ filterMap_head?_sublist_flatten
+ getD_append_cons_left
+ getD_append_cons_right
+ getD_append_cons_self
+ getD_le_sum
+ getD_tail
+ getD_zero_eq_headD
+ getElem_mid_left
+ getElem_mid_left'
+ getElem_mid_mid
+ getElem_mid_mid'
+ getElem_mid_right
+ getElem_mid_right'
+ getLastD_eq_getD
+ headD_le_sum
+ idxOf_append_singleton
+ isShuffle_append
+ isShuffle_filter
+ isShuffle_nil_left
+ isShuffle_nil_left_iff
+ isShuffle_nil_right
+ isShuffle_nil_right_iff
+ le_getLast_of_pairwise_le
+ length_append_mid
+ length_eq_sum_count
+ length_le_one_of_pairwise
+ length_of_isShuffle
+ length_shuffle
+ mem_flatten_of_mem_getD
+ mem_getD_of_mem_flatten
+ mem_rearrangements
+ mem_shuffle_comm
+ mem_shuffle_iff
+ pairwise_le_getElem?_mono
+ perm_append_of_isShuffle
+ perm_append_of_mem_shuffle
+ prod_factorial_count_erase
+ prod_factorial_count_mul_multinomial
+ rearrangements
+ rearrangements_eq_biUnion
+ rearrangements_zero
+ set_append_cons_left
+ set_append_cons_right
+ set_append_cons_self
+ shuffle
+ shuffle_cons_cons
+ shuffle_nil_left
+ shuffle_nil_right
+ shuffle_perm_comm
+ split_three_getD
+ split_three_getElem
+ sublist_concat_cases
+ sublist_left_of_isShuffle
+ sublist_left_of_mem_shuffle
+ sublist_right_of_isShuffle
+ sublist_right_of_mem_shuffle
+ sublist_three_cases
+ sum_eq_sum_range_getD
+ sum_eq_sum_range_getD_length
+ sum_set_add_getElem
+ sum_tail_add_getD_zero
+ sum_take_eq_sum_range
+ sum_take_le_sum
+ sum_take_succ_getD
You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>
## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.
Declarations diff (Lean)
✅ Lean-aware diff — post-build, computed from the Lean environment (commit
ba3d3b0).
- +95 new declarations
- −0 removed declarations
+Finite.toLattice
+Finite.toLatticeOfSup
+Fintype.exists_bijOn_of_card_fiber_eq
+Fintype.exists_equiv_of_card_fiber_eq
+Fintype.fiberSubtypeEquiv
+List.IsShuffle
+List.IsShuffle.below
+List.IsShuffle.below.casesOn
+List.IsShuffle.below.left
+List.IsShuffle.below.nil
+List.IsShuffle.below.rec
+List.IsShuffle.below.right
+List.IsShuffle.brecOn
+List.IsShuffle.casesOn
+List.IsShuffle.filter_eq_left
+List.IsShuffle.filter_eq_right
+List.IsShuffle.left
+List.IsShuffle.nil
+List.IsShuffle.rec
+List.IsShuffle.recOn
+List.IsShuffle.right
+List.IsShuffle.symm
+List.append_mem_shuffle
+List.card_permutations_toFinset
+List.card_rearrangements
+List.card_rearrangements_eq_sum
+List.card_rearrangements_mul_prod_factorial
+List.countP_eq_card_filter_range
+List.eq_of_getD_eq
+List.eq_of_length_eq_of_getD_eq
+List.filterMap_head?_sublist_flatten
+List.getD_append_cons_left
+List.getD_append_cons_right
+List.getD_append_cons_self
+List.getD_le_sum
+List.getD_tail
+List.getD_zero_eq_headD
+List.getElem_mid_left
+List.getElem_mid_left'
+List.getElem_mid_mid
+List.getElem_mid_mid'
+List.getElem_mid_right
+List.getElem_mid_right'
+List.getLastD_eq_getD
+List.headD_le_sum
+List.idxOf_append_singleton
+List.isShuffle_append
+List.isShuffle_filter
+List.isShuffle_nil_left
+List.isShuffle_nil_left_iff
+List.isShuffle_nil_right
+List.isShuffle_nil_right_iff
+List.le_getLast_of_pairwise_le
+List.length_append_mid
+List.length_eq_sum_count
+List.length_le_one_of_pairwise
+List.length_of_isShuffle
+List.length_shuffle
+List.mem_flatten_of_mem_getD
+List.mem_getD_of_mem_flatten
+List.mem_rearrangements
+List.mem_shuffle_comm
+List.mem_shuffle_iff
+List.pairwise_le_getElem?_mono
+List.perm_append_of_isShuffle
+List.perm_append_of_mem_shuffle
+List.prod_factorial_count_erase
+List.rearrangements
+List.rearrangements_eq_biUnion
+List.rearrangements_zero
+List.set_append_cons_left
+List.set_append_cons_right
+List.set_append_cons_self
+List.shuffle
+List.shuffle.eq_def
+List.shuffle_cons_cons
+List.shuffle_nil_left
+List.shuffle_nil_right
+List.shuffle_perm_comm
+List.split_three_getD
+List.split_three_getElem
+List.sublist_concat_cases
+List.sublist_left_of_isShuffle
+List.sublist_left_of_mem_shuffle
+List.sublist_right_of_isShuffle
+List.sublist_right_of_mem_shuffle
+List.sublist_three_cases
+List.sum_eq_sum_range_getD
+List.sum_eq_sum_range_getD_length
+List.sum_set_add_getElem
+List.sum_tail_add_getD_zero
+List.sum_take_eq_sum_range
+List.sum_take_le_sum
+List.sum_take_succ_getD
+Multiset.prod_factorial_count_mul_multinomialNo changes to strong technical debt.
Increase in weak tech debt: (relative, absolute) = (5.00, 0.00)
| Current number | Change | Type (weak) |
|---|---|---|
| exposed public sections | 5071 | 5 |
Current commit ba3d3b0020
Reference commit 8d52ea9a14
This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.py pr_summary
- The
relativevalue is the weighted sum of the differences with weight given by the inverse of the current value of the statistic. - The
absolutevalue is therelativevalue divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).
✅ PR Title Formatted CorrectlyThe title of this PR has been updated to match our commit style conventions. |
|
|
||
| variable (p m s : List α) {i j : ℕ} | ||
|
|
||
| theorem length_append_mid : (p ++ m ++ s).length = p.length + m.length + s.length := by |
There was a problem hiding this comment.
| theorem length_append_mid : (p ++ m ++ s).length = p.length + m.length + s.length := by | |
| theorem length_append_append : (p ++ m ++ s).length = p.length + m.length + s.length := by |
and similarly below
| simp [Nat.add_assoc] | ||
|
|
||
| theorem getElem_mid_left (hi : i < p.length) : | ||
| (p ++ m ++ s)[i]'(by simp; omega) = p[i] := by |
There was a problem hiding this comment.
| (p ++ m ++ s)[i]'(by simp; omega) = p[i] := by | |
| (p ++ m ++ s)[i]'(by simp; lia) = p[i] := by |
or even
| (p ++ m ++ s)[i]'(by simp; omega) = p[i] := by | |
| (p ++ m ++ s)[i]'(by grind) = p[i] := by |
might work. omega is essentially deprecated.
| theorem filterMap_head?_sublist_flatten (L : List (List α)) : | ||
| (L.filterMap head?).Sublist L.flatten := by |
There was a problem hiding this comment.
| theorem filterMap_head?_sublist_flatten (L : List (List α)) : | |
| (L.filterMap head?).Sublist L.flatten := by | |
| theorem filterMap_head?_sublist_flatten (L : List (List α)) : | |
| L.filterMap head? <+ L.flatten := by |
eric-wieser
left a comment
There was a problem hiding this comment.
As discussed on Zulip, this currently appears to violate the license terms of Coq-combi, as this PR is essentially relicensing derived GPLed code as Apache.
|
On reflection, I think it is best to close this entirely; otherwise revewers will see this and will have to be careful not to write derived code themselves. |
This is the first PR in a series of 22 PRs porting the Coq-Combi library to Mathlib.
This PR contains prerequisites for the subsequent port, mainly lemmas about lists, and does not yet include the main Coq-Combi development.
The intended final state of the port is available in my
coq-combibranch. The subsequent PRs will progressively introduce the remaining parts of the port.#mathlib4 > Porting of Coq-Combi @ 💬