Skip to content

[Merged by Bors] - feat(Data/List): Nodup and head & getLast lemmas#38830

Closed
Jun2M wants to merge 15 commits into
leanprover-community:masterfrom
Jun2M:AssocFoldl
Closed

[Merged by Bors] - feat(Data/List): Nodup and head & getLast lemmas#38830
Jun2M wants to merge 15 commits into
leanprover-community:masterfrom
Jun2M:AssocFoldl

Conversation

@Jun2M

@Jun2M Jun2M commented May 2, 2026

Copy link
Copy Markdown
Collaborator

Given a Nodup list:

  • If a prefix contains the last element, they are equal

  • If a suffix contains the first element, they are equal

  • If an infix contains the first element, it is a prefix

  • If an infix contains the last element, it is a suffix

  • If the first and the last element are the same, it is a singleton

  • countP is cardinality of the filter of toFinset.


Open in Gitpod

@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown

PR summary 0927d675de

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

+ List.Nodup.card_eq_countP
+ Nodup.eq_of_getLast_mem_of_prefix
+ Nodup.eq_of_head_mem_of_getLast_mem_of_infix
+ Nodup.eq_of_head_mem_of_suffix
+ Nodup.head_eq_getLast_iff
+ Nodup.prefix_of_head_mem_of_infix
+ Nodup.suffix_of_getLast_mem_of_infix
+ filter_toFinset

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 -- pending)

Computed after the build finishes.


No changes to strong technical debt.

No changes to weak technical debt.

Current commit 0927d675de
Reference commit 783ccda4ee

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.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@github-actions github-actions Bot added the t-data Data (lists, quotients, numbers, etc) label May 2, 2026
Comment thread Mathlib/Data/List/Nodup.lean Outdated
Comment thread Mathlib/Data/List/Nodup.lean Outdated
Comment thread Mathlib/Data/List/Nodup.lean
Comment thread Mathlib/Data/List/Nodup.lean Outdated
Comment thread Mathlib/Data/List/Nodup.lean Outdated
Jun2M and others added 4 commits May 2, 2026 09:10
@mathlib-merge-conflicts mathlib-merge-conflicts Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label May 17, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

@github-actions github-actions Bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label May 21, 2026

@joneugster joneugster left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR!

Comment thread Mathlib/Data/Finset/Card.lean Outdated
Comment thread Mathlib/Data/Finset/Card.lean Outdated
Comment thread Mathlib/Data/List/Nodup.lean Outdated
@joneugster joneugster added the awaiting-author A reviewer has asked the author a question or requested changes. label Jun 2, 2026
@Jun2M
Jun2M temporarily deployed to cache-upload-forks June 4, 2026 02:28 — with GitHub Actions Inactive
@Jun2M Jun2M removed the awaiting-author A reviewer has asked the author a question or requested changes. label Jun 11, 2026
@joneugster

Copy link
Copy Markdown
Contributor

thank you!

maintainer merge

@github-actions

Copy link
Copy Markdown

🚀 Pull request has been placed on the maintainer queue by joneugster.

@mathlib-triage mathlib-triage Bot added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Jun 19, 2026

@b-mehta b-mehta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR looks good to me, but I agree with Jon's point above.

@ocfnash ocfnash left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like a bit more thought about API here.

Comment thread Mathlib/Data/Finset/Basic.lean
@ocfnash ocfnash added awaiting-author A reviewer has asked the author a question or requested changes. and removed maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. labels Jul 1, 2026
@joneugster joneugster assigned joneugster and unassigned joneugster Jul 3, 2026
@joneugster

Copy link
Copy Markdown
Contributor

Maybe it makes sense if I reassign this to @ocfnash for now. @Jun2M don't forget to comment -awaiting-author if this should be reviewed again.

@joneugster joneugster assigned ocfnash and unassigned joneugster Jul 24, 2026
This reverts commit 80e503a.

@ocfnash ocfnash left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry to have been the cause of delaying this PR for so long.

Looking more closely now I retract my comment here as I now realise the moral duplication is a legacy of the fact that List.filter consumes a Bool-valued predicated whereas Finset.filter consumes a Prop-valued predicate. It's not pretty that we are in this situation and therefore have to author these morally duplicate lemmas (to enable convenient rewriting in each direction) but I do now agree that it is the best local action we can take.

Thanks for your patience.

@ocfnash ocfnash removed the awaiting-author A reviewer has asked the author a question or requested changes. label Jul 24, 2026
@ocfnash

ocfnash commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@Jun2M I'll also repeat Jon's remark that you need to take action to get your PR back in the review queue or else it remains almost invisible to us.

bors merge

@mathlib-bors mathlib-bors Bot added the ready-to-merge This PR has been sent to bors. label Jul 24, 2026
mathlib-bors Bot pushed a commit that referenced this pull request Jul 24, 2026
Given a Nodup list:
* If a prefix contains the last element, they are equal
* If a suffix contains the first element, they are equal
* If an infix contains the first element, it is a prefix
* If an infix contains the last element, it is a suffix

* If the first and the last element are the same, it is a singleton
* `countP` is cardinality of the filter of `toFinset`.

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Oliver Nash <github@olivernash.org>
@mathlib-bors mathlib-bors Bot added the bors-staging This PR is currently being built by bors on the staging branch. label Jul 24, 2026
@mathlib-bors

mathlib-bors Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@mathlib-bors mathlib-bors Bot changed the title feat(Data/List): Nodup and head & getLast lemmas [Merged by Bors] - feat(Data/List): Nodup and head & getLast lemmas Jul 24, 2026
@mathlib-bors mathlib-bors Bot closed this Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bors-staging This PR is currently being built by bors on the staging branch. ready-to-merge This PR has been sent to bors. t-data Data (lists, quotients, numbers, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants