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: add String.splitOn_of_valid #743

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

chabulhwi
Copy link
Contributor

@chabulhwi chabulhwi commented Apr 16, 2024

String.splitOn_of_valid is the first of the eleven unproved theorems
about strings. I added the following to prove it:

  • lemmas about Nat.add and lists
  • the file Batteries.Data.List.SplitOnList
  • the theorem String.splitOnAux_of_valid

This is the third version of #495 and includes #531. The second version is #719.

@chabulhwi chabulhwi force-pushed the String.splitOn_of_valid_v3 branch 4 times, most recently from 2df1e65 to 3699b5d Compare April 16, 2024 09:30
@chabulhwi
Copy link
Contributor Author

awaiting-review

@github-actions github-actions bot added the awaiting-review This PR is ready for review; the author thinks it is ready to be merged. label Apr 16, 2024
@chabulhwi chabulhwi force-pushed the String.splitOn_of_valid_v3 branch 4 times, most recently from 75b032f to dd5f11a Compare April 17, 2024 01:22
@semorrison
Copy link
Collaborator

This is doing too many things at once. Can you split out the preliminary steps (upstreaming from Mathlib) as separate PRs?

@semorrison semorrison added awaiting-author Waiting for PR author to address issues and removed awaiting-review This PR is ready for review; the author thinks it is ready to be merged. labels Apr 17, 2024
@chabulhwi chabulhwi force-pushed the String.splitOn_of_valid_v3 branch 4 times, most recently from e6b2836 to cf96e0e Compare April 19, 2024 14:53
@chabulhwi
Copy link
Contributor Author

chabulhwi commented Apr 19, 2024

This is doing too many things at once. Can you split out the preliminary steps (upstreaming from Mathlib) as separate PRs?

@semorrison I've split these commits into separate PRs.

@chabulhwi
Copy link
Contributor Author

awaiting-review

@github-actions github-actions bot added awaiting-review This PR is ready for review; the author thinks it is ready to be merged. and removed awaiting-author Waiting for PR author to address issues labels Apr 19, 2024
@chabulhwi chabulhwi changed the title feat: add String.splitOn_of_valid feat: add String.splitOn_of_valid Apr 19, 2024
@semorrison semorrison added depends on another PR This is stacked on top of another Std4 PR. and removed awaiting-review This PR is ready for review; the author thinks it is ready to be merged. labels Apr 24, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the merge-conflict This PR has merge conflicts with the `main` branch which must be resolved by the author. label May 2, 2024
@chabulhwi chabulhwi force-pushed the String.splitOn_of_valid_v3 branch from cf96e0e to 55046a9 Compare May 3, 2024 01:28
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot removed the merge-conflict This PR has merge conflicts with the `main` branch which must be resolved by the author. label May 3, 2024
@chabulhwi chabulhwi force-pushed the String.splitOn_of_valid_v3 branch from 55046a9 to 4af3b7e Compare May 3, 2024 01:55
@chabulhwi
Copy link
Contributor Author

I resolved merge conflicts.

@chabulhwi chabulhwi force-pushed the String.splitOn_of_valid_v3 branch 9 times, most recently from 2c75571 to d080155 Compare May 7, 2024 06:10
@chabulhwi
Copy link
Contributor Author

@semorrison I resolved all the conversations.

@chabulhwi chabulhwi force-pushed the String.splitOn_of_valid_v3 branch from d080155 to 91413c1 Compare May 9, 2024 16:34
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the merge-conflict This PR has merge conflicts with the `main` branch which must be resolved by the author. label May 9, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot removed the merge-conflict This PR has merge conflicts with the `main` branch which must be resolved by the author. label May 10, 2024
chabulhwi and others added 5 commits May 23, 2024 22:52
* `List.isEmpty_iff_eq_nil` and `List.modifyHead_modifyHead` are from
  `Mathlib.Data.List.Basic`. I removed the `simp` priority and `nolint`
  attribute from `modifyHead_modifyHead` because we don't need them
  anymore.
* `List.cons_prefix_cons` is from `Mathlib.Data.List.Infix`. Its
  previous name was `List.cons_prefix_iff`.

We need these theorems to prove `String.splitOn_of_valid`. See
leanprover-community#756.

Co-authored-by: Kim Morrison <kim@tqft.net>
Most of these lemmas are needed to prove `String.splitOn_of_valid`.
* `List.splitOnceP` returns `(l₁, l₂)` for the first split `l = l₁ ++
  l₂` such that `P l₂` returns true.
* `List.splitOnList` splits a list at every occurrence of a separator
  list. The separators are not in the result.
* `List.splitOnListAux` is an auxiliary definition for proving
  `String.splitOnAux_of_valid`.

Co-authored-by: Mario Carneiro <di.gama@gmail.com>
Co-authored-by: Kim Morrison <scott.morrison@gmail.com>
Add `String.splitOnAux_of_valid` and `String.splitOn_of_valid`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
depends on another PR This is stacked on top of another Std4 PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants