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/fin/tuple/basic): injectivity of fin.cons x xs #17779

Closed
wants to merge 3 commits into from

Conversation

eric-wieser
Copy link
Member


Open in Gitpod

@Vierkantor Vierkantor self-assigned this Dec 6, 2022
Copy link
Collaborator

@Vierkantor Vierkantor left a comment

Choose a reason for hiding this comment

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

Thanks!

bors d+

src/data/list/range.lean Outdated Show resolved Hide resolved
@@ -301,8 +301,21 @@ theorem of_fn_eq_map {α n} {f : fin n → α} :
of_fn f = (fin_range n).map f :=
by rw [← of_fn_id, map_of_fn, function.right_id]

theorem nodup_of_fn {α n} {f : fin n → α} (hf : function.injective f) :
theorem nodup_of_fn_of_injective {α n} {f : fin n → α} (hf : function.injective f) :
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's unfortunate that of_fn has a name like that, it makes all the names involving it hard to read. I'm thinking perhaps dot notation might be a nice way around it:

Suggested change
theorem nodup_of_fn_of_injective {α n} {f : fin n → α} (hf : function.injective f) :
theorem _root_.function.injective.nodup_of_fn {α n} {f : fin n → α} (hf : function.injective f) :

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't really like moving this out of the list namespace, because neither nodup or of_fn are immediately recognizable as list operators.

Copy link
Member Author

Choose a reason for hiding this comment

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

I could just inline this into nodup_of_fn if the name is really unlikable; it's not needed once the iff is available.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's fine to keep the current name, I just would like to encourage you to think of an alternative :)

Copy link
Member Author

Choose a reason for hiding this comment

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

How about (in a future PR) renaming list.of_fn to fin.to_list or function.to_list or tuple.to_list?

| 0 x := by convert h0
| (n + 1) x := cons_cases (λ x₀ x, h _ _ $ cons_induction _) x

lemma cons_injective_of_injective {α} {x₀ : α} {x : fin n → α} (hx₀ : x₀ ∉ set.range x)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't mind this name so much, this suggestion is more to match with the nodup_of_fn suggestion:

Suggested change
lemma cons_injective_of_injective {α} {x₀ : α} {x : fin n → α} (hx₀ : x₀ ∉ set.range x)
lemma _root_.function.injective.fin_cons {α} {x₀ : α} {x : fin n → α} (hx₀ : x₀ ∉ set.range x)

@bors
Copy link

bors bot commented Dec 6, 2022

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

@leanprover-community-bot-assistant leanprover-community-bot-assistant added delegated The PR author may merge after reviewing final suggestions. and removed awaiting-review The author would like community review of the PR labels Dec 6, 2022
Co-authored-by: Anne Baanen <Vierkantor@users.noreply.github.com>
@jcommelin jcommelin added the awaiting-author A reviewer has asked the author a question or requested changes label Dec 8, 2022
@eric-wieser
Copy link
Member Author

bors merge

@github-actions github-actions bot added ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) and removed awaiting-author A reviewer has asked the author a question or requested changes labels Dec 9, 2022
@bors
Copy link

bors bot commented Dec 9, 2022

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(data/fin/tuple/basic): injectivity of fin.cons x xs [Merged by Bors] - feat(data/fin/tuple/basic): injectivity of fin.cons x xs Dec 9, 2022
@bors bors bot closed this Dec 9, 2022
@bors bors bot deleted the eric-wieser/list.of_fn_nodup branch December 9, 2022 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
delegated The PR author may merge after reviewing final suggestions. ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants