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

[Merged by Bors] - feat(data/option/*): pmap and pbind defs and lemmas #5442

Closed
wants to merge 5 commits into from

Conversation

pechersky
Copy link
Collaborator


@pechersky pechersky assigned pechersky and unassigned pechersky Dec 20, 2020
@pechersky pechersky added the awaiting-review The author would like community review of the PR label Dec 20, 2020
Comment on lines 107 to 114
/-- Partial bind. If for some `x : option α`, `f : Π (a : α), a ∈ x → option β` is a
partial function defined on `a : α` satisfying `p` giving an `option β`,
then `pbind x f h` is essentially the same as `bind x f`
but is defined only when all `x = some a` and the `a` satisfy `p`, using the proof
to apply `f`. -/
@[simp] def pbind : Π (x : option α), (Π (a : α), a ∈ x → option β) → option β
| none _ := none
| (some a) f := f a rfl
Copy link
Member

Choose a reason for hiding this comment

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

I don't see p anywhere in the code - is this comment wrong? Or should a ∈ x be p x?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tried to reword the docstring.

Copy link
Member

@robertylewis robertylewis left a comment

Choose a reason for hiding this comment

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

Some initial comments.

src/data/option/basic.lean Outdated Show resolved Hide resolved
src/data/option/basic.lean Outdated Show resolved Hide resolved
simpa only [H] using hz } }
end

@[simp] lemma pbind_eq_bind {f : α → option β} :
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
@[simp] lemma pbind_eq_bind {f : α → option β} :
@[simp] lemma pbind_eq_bind (f : α → option β) :

f is not inferable from later arguments, is there a reason for it to be implicit here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe I'm missing something, but isn't it true that we can make arguments implicit if they appear on both sides of an equality or iff, since we usually just use these lemmas in rewriting?

Copy link
Member

Choose a reason for hiding this comment

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

Ah, sorry, I lost track of this in the craziness of the last few weeks. Yes, for using these in rw/simp it doesn't matter, but it does if you want to use them in e.g. have. For iff, the lemma_name.mp only works if all the arguments are implicit, which is a good reason to prefer that. But eq.mp is less commonly used. That said it's not so important.

src/data/option/basic.lean Outdated Show resolved Hide resolved
@robertylewis robertylewis added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review The author would like community review of the PR labels Dec 28, 2020
@pechersky
Copy link
Collaborator Author

I've tried to make arguments more explicit in lemmas, and restructured the lemmas to group eq and iff separately.

@pechersky pechersky added awaiting-review The author would like community review of the PR and removed awaiting-author A reviewer has asked the author a question or requested changes labels Dec 29, 2020
@github-actions github-actions bot added the merge-conflict Please `git merge origin/master` then a bot will remove this label. label Jan 4, 2021
@github-actions github-actions bot removed the merge-conflict Please `git merge origin/master` then a bot will remove this label. label Jan 11, 2021
@bryangingechen
Copy link
Collaborator

@robertylewis any final comments?

Copy link
Member

@robertylewis robertylewis left a comment

Choose a reason for hiding this comment

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

bors d+

src/data/option/basic.lean Outdated Show resolved Hide resolved
@bors
Copy link

bors bot commented Jan 17, 2021

✌️ pechersky can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@robertylewis robertylewis added awaiting-author A reviewer has asked the author a question or requested changes delegated The PR author may merge after reviewing final suggestions. and removed awaiting-review The author would like community review of the PR labels Jan 17, 2021
Co-authored-by: Rob Lewis <Rob.y.lewis@gmail.com>
@pechersky
Copy link
Collaborator Author

bors r+

bors bot pushed a commit that referenced this pull request Jan 18, 2021
Co-authored-by: Yakov Pechersky <pechersky@users.noreply.github.com>
@bors
Copy link

bors bot commented Jan 18, 2021

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(data/option/*): pmap and pbind defs and lemmas [Merged by Bors] - feat(data/option/*): pmap and pbind defs and lemmas Jan 18, 2021
@bors bors bot closed this Jan 18, 2021
@bors bors bot deleted the pechersky/option-pmap branch January 18, 2021 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-author A reviewer has asked the author a question or requested changes delegated The PR author may merge after reviewing final suggestions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants