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] - refactor(linear_algebra/pi): add linear_map.single to match add_monoid_hom.single #6315

Closed
wants to merge 2 commits into from

Conversation

eric-wieser
Copy link
Member

This changes the definition of std_basis to be exactly linear_map.single, but proves equality with the old definition.

In future, it might make sense to remove std_basis entirely.


@eric-wieser eric-wieser added the awaiting-review The author would like community review of the PR label Feb 19, 2021
…noid_hom.single`

This changes the definition of `std_basis` to be exactly `linear_map.single`, but proves equality with the old definition.

In future, it might make sense to remove `std_basis` entirely.
@eric-wieser eric-wieser 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 Feb 19, 2021
@eric-wieser eric-wieser 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 Feb 19, 2021
@[simps]
def single [decidable_eq ι] (i : ι) : φ i →ₗ[R] (Πi, φ i) :=
{ to_fun := pi.single i,
map_smul' := λ r x, begin
Copy link
Member

Choose a reason for hiding this comment

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

Since you simplify linear_map.single i x to pi.single i x, it makes sense to add a lemma pi.single_smul somewhere near the definition of pi.semimodule. BTW, function.update_eq_iff gives a slightly shorter proof.
Otherwise LGTM.
bors d+

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't have pi.single_add yet either, but I think we should - I'll leave adding all of those lemmas to a follow-up PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

But I will have a go at golfing this proof.

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 came up with

  map_smul' := λ r x, begin
    ext j,
    have := (function.apply_update (λ i, (•) r) 0 i x j).symm,
    simp only [pi.zero_apply, smul_zero] at this,
    exact this,
  end,

Do you have a better proof in mind?

@bors
Copy link

bors bot commented Feb 19, 2021

✌️ 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.

@bryangingechen bryangingechen added the delegated The PR author may merge after reviewing final suggestions. label Feb 19, 2021
@eric-wieser
Copy link
Member Author

Let's golf the proofs in the follow-up, since adding pi.single_smul and related lemmas is a larger change than the rest of this PR!

@eric-wieser
Copy link
Member Author

bors r+

bors bot pushed a commit that referenced this pull request Feb 19, 2021
…noid_hom.single` (#6315)

This changes the definition of `std_basis` to be exactly `linear_map.single`, but proves equality with the old definition.

In future, it might make sense to remove `std_basis` entirely.
@eric-wieser
Copy link
Member Author

eric-wieser commented Feb 20, 2021

bors r+

Not sure what happened there, bors appears to have discarded that batch.

@bryangingechen
Copy link
Collaborator

The log says that bors crashed, hopefully just a transient thing:

{%DBConnection.ConnectionError{
   message: "connection not available because of disconnection"
 },
 [
   {DBConnection, :checkout, 2,
    [file: 'lib/db_connection.ex', line: 934]},
   {DBConnection, :run, 3,
    [file: 'lib/db_connection.ex', line: 750]},
   {DBConnection, :prepare_execute, 4,
    [file: 'lib/db_connection.ex', line: 592]},
   {Ecto.Adapters.Postgres.Connection, :prepare_execute, 5,
    [
      file: 'lib/ecto/adapters/postgres/connection.ex',
      line: 73
    ]},
   {Ecto.Adapters.SQL, :sql_call, 6,
    [file: 'lib/ecto/adapters/sql.ex', line: 256]},
   {Ecto.Adapters.SQL, :execute_and_cache, 7,
    [file: 'lib/ecto/adapters/sql.ex', line: 426]},
   {Ecto.Repo.Queryable, :execute, 5,
    [file: 'lib/ecto/repo/queryable.ex', line: 133]},
   {Ecto.Repo.Queryable, :all, 4,
    [file: 'lib/ecto/repo/queryable.ex', line: 37]}
 ]}

@eric-wieser eric-wieser 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 20, 2021
bors bot pushed a commit that referenced this pull request Feb 20, 2021
…noid_hom.single` (#6315)

This changes the definition of `std_basis` to be exactly `linear_map.single`, but proves equality with the old definition.

In future, it might make sense to remove `std_basis` entirely.
@bors
Copy link

bors bot commented Feb 20, 2021

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title refactor(linear_algebra/pi): add linear_map.single to match add_monoid_hom.single [Merged by Bors] - refactor(linear_algebra/pi): add linear_map.single to match add_monoid_hom.single Feb 20, 2021
@bors bors bot closed this Feb 20, 2021
@bors bors bot deleted the eric-wieser/rename-single branch February 20, 2021 03:58
b-mehta pushed a commit that referenced this pull request Apr 2, 2021
…noid_hom.single` (#6315)

This changes the definition of `std_basis` to be exactly `linear_map.single`, but proves equality with the old definition.

In future, it might make sense to remove `std_basis` entirely.
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

3 participants