We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
String.splitOn
#eval "012".splitOn "12" -- output: ["0", ""] #eval "007".splitOn "07" -- ["007"]
The value of the second expression above should be ["0", ""].
["0", ""]
I was trying to prove String.splitOn_of_valid in Std.Data.List.Lemmas, but I realized that the current definition of String.splitOn is flawed. See leanprover-community/batteries#719.
String.splitOn_of_valid
Std.Data.List.Lemmas
I think @digama0's definition of List.splitOnList in Std.Data.List.SplitOnList is correct, as can be seen below:
List.splitOnList
Std.Data.List.SplitOnList
import Std.Data.List.SplitOnList #eval ("012".1.splitOnList "12".1).map String.mk -- output: ["0", ""] #eval ("007".1.splitOnList "07".1).map String.mk -- ["0", ""]
Discussions on the Lean Zulip chat: https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/current.20definition.20of.20.60String.2EsplitOn.60.20is.20incorrect/near/430930535
4.7.0-rc2
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
The text was updated successfully, but these errors were encountered:
#3832 fixes this bug.
Sorry, something went wrong.
fix: String.splitOn bug (#3832)
e41cd31
Fixes #3829. As reported on Zulip (both [recently](https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/current.20definition.20of.20.60String.2EsplitOn.60.20is.20incorrect/near/430930535) and [a year ago](https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/should.20we.20redefine.20.60String.2EsplitOnAux.60.3F/near/365899332)), `String.splitOn` has a bug when dealing with separators of more than one character (which are luckily rare). The code change here is very small, replacing a `i` with `i - j`, but it makes termination more complex so that's where the rest of the line count goes.
Successfully merging a pull request may close this issue.
Description
The value of the second expression above should be
["0", ""]
.Context
I was trying to prove
String.splitOn_of_valid
inStd.Data.List.Lemmas
, but I realized that the current definition ofString.splitOn
is flawed. See leanprover-community/batteries#719.I think @digama0's definition of
List.splitOnList
inStd.Data.List.SplitOnList
is correct, as can be seen below:Discussions on the Lean Zulip chat: https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/current.20definition.20of.20.60String.2EsplitOn.60.20is.20incorrect/near/430930535
Version
4.7.0-rc2
Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
The text was updated successfully, but these errors were encountered: