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/zmod/basic): Explicitly state computable right_inverses instead of just surjectivity #5797

Closed
wants to merge 1 commit into from

Conversation

eric-wieser
Copy link
Member


@eric-wieser eric-wieser added the awaiting-review The author would like community review of the PR label Jan 18, 2021
src/data/zmod/basic.lean Outdated Show resolved Hide resolved
@@ -219,36 +219,36 @@ by { cases n; refl }

end

lemma nat_cast_surjective [fact (0 < n)] :
function.surjective (coe : ℕ → zmod n) :=
lemma nat_cast_right_inverse [fact (0 < n)] :
Copy link
Member

Choose a reason for hiding this comment

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

This name sounds like nat_cast is the right inverse...

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 know what the naming convention is for these... I can currently find these lemmas that seem to match what I think you would suggest:

  • right_inverse_pth_root_frobenius
  • prod.swap_right_inverse
  • equiv.right_inverse_symm

Along with the lemmas that I added recently, which seem to match what I've done here:

  • free_algebra.algebra_map_left_inverse
  • tensor_algebra.ι_left_inverse

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we say that this is blocked on #5829, and then come back to it when that is resolved either way?

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'd rather not - I'm not sure how useful #5892 actually is, whereas with things like #6167 now merged, having readily-available inverse proofs is immediately useful.

Copy link
Member

Choose a reason for hiding this comment

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

I still think that the names used in this PR are confusing. If that issue can be solved, this PR is ready for merging.

bors bot pushed a commit that referenced this pull request Feb 17, 2021
…mes (#6280)

Split from #5797. This takes the new proofs without introducing the objectionable names.

This also renames a bunch of lemmas from `zmod.cast_*` to `zmod.nat_cast_*` and `zmod.int_cast_*`, in order to distinguish lemmas about `zmod.cast` from lemmas about `nat.cast` and `int.cast` applied with a zmod argument.

As an example, `zmod.cast_val` has been renamed to `zmod.nat_cast_zmod_val`, as the lemma statement is defeq to `(nat.cast : ℕ → zmod n) (zmod.val x) = x`, and `zmod.nat_cast_val` is already taken by `nat.cast (zmod.val x) = (x : R)`.

The full list of renames:
* `zmod.cast_val` → `zmod.nat_cast_zmod_val`
* `zmod.cast_self` → `zmod.nat_cast_self`
* `zmod.cast_self'` → `zmod.nat_cast_self'`
* `zmod.cast_mod_nat` → `zmod.nat_cast_mod`
* `zmod.cast_mod_int` → `zmod.int_cast_mod`
* `zmod.val_cast_nat` → `zmod.val_nat_cast`
* `zmod.coe_to_nat` → `zmod.nat_cast_to_nat`
* `zmod.cast_unit_of_coprime` → `coe_unit_of_coprime`
* `zmod.cast_nat_abs_val_min_abs` → `zmod.nat_cast_nat_abs_val_min_abs`
bors bot pushed a commit that referenced this pull request Feb 17, 2021
…mes (#6280)

Split from #5797. This takes the new proofs without introducing the objectionable names.

This also renames a bunch of lemmas from `zmod.cast_*` to `zmod.nat_cast_*` and `zmod.int_cast_*`, in order to distinguish lemmas about `zmod.cast` from lemmas about `nat.cast` and `int.cast` applied with a zmod argument.

As an example, `zmod.cast_val` has been renamed to `zmod.nat_cast_zmod_val`, as the lemma statement is defeq to `(nat.cast : ℕ → zmod n) (zmod.val x) = x`, and `zmod.nat_cast_val` is already taken by `nat.cast (zmod.val x) = (x : R)`.

The full list of renames:
* `zmod.cast_val` → `zmod.nat_cast_zmod_val`
* `zmod.cast_self` → `zmod.nat_cast_self`
* `zmod.cast_self'` → `zmod.nat_cast_self'`
* `zmod.cast_mod_nat` → `zmod.nat_cast_mod`
* `zmod.cast_mod_int` → `zmod.int_cast_mod`
* `zmod.val_cast_nat` → `zmod.val_nat_cast`
* `zmod.coe_to_nat` → `zmod.nat_cast_to_nat`
* `zmod.cast_unit_of_coprime` → `coe_unit_of_coprime`
* `zmod.cast_nat_abs_val_min_abs` → `zmod.nat_cast_nat_abs_val_min_abs`
@github-actions github-actions bot added the merge-conflict Please `git merge origin/master` then a bot will remove this label. label Feb 18, 2021
@github-actions github-actions bot removed the merge-conflict Please `git merge origin/master` then a bot will remove this label. label Feb 18, 2021
@eric-wieser
Copy link
Member Author

I've updated this PR now that #6280 is merged, so that now it contains no changes other than new lemma statements

@Vierkantor
Copy link
Collaborator

Since the Zulip discussion has been inactive for a while without resolution, I think you should do whatever you feel is best and when someone later has a good idea to fix it, they can go ahead and implement it. (That person might turn out to be me, but no promises.)

Copy link
Collaborator

@bryangingechen bryangingechen left a comment

Choose a reason for hiding this comment

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

I'll put this on the queue now. These lemmas look useful and we can always change the names later.
bors r+

@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-review The author would like community review of the PR labels Feb 25, 2021
bors bot pushed a commit that referenced this pull request Feb 25, 2021
@bors
Copy link

bors bot commented Feb 25, 2021

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(data/zmod/basic): Explicitly state computable right_inverses instead of just surjectivity [Merged by Bors] - feat(data/zmod/basic): Explicitly state computable right_inverses instead of just surjectivity Feb 25, 2021
@bors bors bot closed this Feb 25, 2021
@bors bors bot deleted the eric-wieser/right_inverse branch February 25, 2021 07:08
b-mehta pushed a commit that referenced this pull request Apr 2, 2021
…mes (#6280)

Split from #5797. This takes the new proofs without introducing the objectionable names.

This also renames a bunch of lemmas from `zmod.cast_*` to `zmod.nat_cast_*` and `zmod.int_cast_*`, in order to distinguish lemmas about `zmod.cast` from lemmas about `nat.cast` and `int.cast` applied with a zmod argument.

As an example, `zmod.cast_val` has been renamed to `zmod.nat_cast_zmod_val`, as the lemma statement is defeq to `(nat.cast : ℕ → zmod n) (zmod.val x) = x`, and `zmod.nat_cast_val` is already taken by `nat.cast (zmod.val x) = (x : R)`.

The full list of renames:
* `zmod.cast_val` → `zmod.nat_cast_zmod_val`
* `zmod.cast_self` → `zmod.nat_cast_self`
* `zmod.cast_self'` → `zmod.nat_cast_self'`
* `zmod.cast_mod_nat` → `zmod.nat_cast_mod`
* `zmod.cast_mod_int` → `zmod.int_cast_mod`
* `zmod.val_cast_nat` → `zmod.val_nat_cast`
* `zmod.coe_to_nat` → `zmod.nat_cast_to_nat`
* `zmod.cast_unit_of_coprime` → `coe_unit_of_coprime`
* `zmod.cast_nat_abs_val_min_abs` → `zmod.nat_cast_nat_abs_val_min_abs`
b-mehta pushed a commit that referenced this pull request Apr 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

5 participants