Skip to content
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: lemmas about List.tail #5360

Merged
merged 2 commits into from
Sep 16, 2024
Merged

feat: lemmas about List.tail #5360

merged 2 commits into from
Sep 16, 2024

Conversation

kim-em
Copy link
Collaborator

@kim-em kim-em commented Sep 16, 2024

No description provided.

@kim-em kim-em requested a review from digama0 as a code owner September 16, 2024 08:25
@kim-em kim-em enabled auto-merge September 16, 2024 08:25
The number of elements satisfying a predicate in a sublist is at least the number of elements satisfying the predicate in the list,
minus the difference in the lengths.
-/
theorem Sublist.le_countP (s : l₁ <+ l₂) (p) : countP p l₂ - (l₂.length - l₁.length) ≤ countP p l₁ := by
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe avoiding Nat.sub, since that is the general advise, isn’t it?

Suggested change
theorem Sublist.le_countP (s : l₁ <+ l₂) (p) : countP p l₂ - (l₂.length - l₁.length) ≤ countP p l₁ := by
theorem Sublist.le_countP (s : l₁ <+ l₂) (p) : countP p l₂ + l₁.length ≤ countP p l₁ + l₂.length := by

(This is based on a suggestion by @jcommelin on a somewhat similar lemma of mine in leanprover-community/mathlib4#15383 (comment))

But I agree that reads much less natural that way.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I trust in omega for things like this.

@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc September 16, 2024 08:36 Inactive
@kim-em kim-em added this pull request to the merge queue Sep 16, 2024
@kim-em kim-em removed this pull request from the merge queue due to a manual request Sep 16, 2024
@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 Sep 16, 2024
@leanprover-community-mathlib4-bot
Copy link
Collaborator

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 7740a38a716a033d2bd495d07e80a1d05558cd2b --onto 5eea8355baa64e6fda4e3874a0f45649d4c27633. (2024-09-16 08:45:16)

@kim-em kim-em enabled auto-merge September 16, 2024 09:12
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc September 16, 2024 09:23 Inactive
@kim-em kim-em added this pull request to the merge queue Sep 16, 2024
Merged via the queue into master with commit 45af92f Sep 16, 2024
14 checks passed
mathlib-bors bot pushed a commit to leanprover-community/mathlib4 that referenced this pull request Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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