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(data/dfinsupp/basic): Improve definitional equalities of coercions #15521

Closed
wants to merge 4 commits into from

Conversation

eric-wieser
Copy link
Member

@eric-wieser eric-wieser commented Jul 19, 2022

This means that dfinsupp.coe_add etc are true by definition, rather than requiring the application of quotient.induction first.
The key change is that the underlying function is no longer "hidden" under the quotient, as it does not need to be.

One motivation for this is to make the API more similar to that of finsupp.

This change eliminates dfinsupp.pre, instead using {s : multiset ι // ∀ i, i ∈ s ∨ to_fun i = 0} directly.
We no longer even need to create a setoid instance, since we can just use trunc.

While adjusting some proofs in data/finsupp/interval to use the new definition, this ended up eliminating some decidable arguments. I don't think that is a consequence of this redefinition, and is incidental cleanup that could have been performed separately.


Open in Gitpod

…rcions

This means that `dfinsupp.coe_add` etc are true by definition, rather than requiring the application of `quotient.induction` first.
@eric-wieser eric-wieser added awaiting-review The author would like community review of the PR awaiting-CI The author would like to see what CI has to say before doing more work. labels Jul 19, 2022
@github-actions github-actions bot removed the awaiting-CI The author would like to see what CI has to say before doing more work. label Jul 19, 2022
@eric-wieser eric-wieser requested a review from urkud July 19, 2022 23:18
Copy link
Member

@urkud urkud left a comment

Choose a reason for hiding this comment

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

I have 2 minor comments, otherwise LGTM. Thanks!
bors d+


variable [Π i, has_zero (β i)]
variable (β)
Copy link
Member

@urkud urkud Jul 20, 2022

Choose a reason for hiding this comment

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

You change from {} to () without opening a section/namespace. Why not merge with variables above?

Copy link
Member Author

Choose a reason for hiding this comment

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

This was mostly accidental; although I find it's usually clearer to always use {} for type variables at the top of the file, as that means they never have to change if things are reordered within the file.

instance : inhabited (Π₀ i, β i) := ⟨0⟩

@[simp]
lemma coe_pre_mk (f : Π i, β i) (s : multiset ι) (hf) :
⇑(⟦⟨f, s, hf⟩⟧ : Π₀ i, β i) = f := rfl
lemma coe_mk (f : Π i, β i) (s) : ⇑(⟨f, s⟩ : Π₀ i, β i) = f := rfl
Copy link
Member

Choose a reason for hiding this comment

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

You use mk' for the constructor name. Should the lemmas use mk' as well to avoid confusion with mk below?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, probably this should be called coe_mk'. Were there any others to rename?

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 did the rename. Probably I'll follow up at some point renaming mk to mk_on or extend_finset or something, meaning mk can claim the obvious name.

@bors
Copy link

bors bot commented Jul 20, 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 Jul 20, 2022
@eric-wieser
Copy link
Member Author

bors merge

(since the last change was just a lemma rename that was only present in one file)

@github-actions github-actions bot added the ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) label Jul 20, 2022
bors bot pushed a commit that referenced this pull request Jul 20, 2022
…rcions (#15521)

This means that `dfinsupp.coe_add` etc are true by definition, rather than requiring the application of `quotient.induction` first.
The key change is that the underlying function is no longer "hidden" under the quotient, as it does not need to be.

One motivation for this is to make the API more similar to that of `finsupp`.

This change eliminates `dfinsupp.pre`, instead using `{s : multiset ι // ∀ i, i ∈ s ∨ to_fun i = 0}` directly.
We no longer even need to create a `setoid` instance, since we can just use `trunc`.

While adjusting some proofs in `data/finsupp/interval` to use the new definition, this ended up eliminating some decidable arguments. I don't think that is a consequence of this redefinition, and is incidental cleanup that could have been performed separately.
@bors
Copy link

bors bot commented Jul 20, 2022

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title refactor(data/dfinsupp/basic): Improve definitional equalities of coercions [Merged by Bors] - refactor(data/dfinsupp/basic): Improve definitional equalities of coercions Jul 20, 2022
@bors bors bot closed this Jul 20, 2022
@bors bors bot deleted the eric-wieser/dfinsupp-defeq branch July 20, 2022 13:20
joelriou pushed a commit that referenced this pull request Jul 23, 2022
…rcions (#15521)

This means that `dfinsupp.coe_add` etc are true by definition, rather than requiring the application of `quotient.induction` first.
The key change is that the underlying function is no longer "hidden" under the quotient, as it does not need to be.

One motivation for this is to make the API more similar to that of `finsupp`.

This change eliminates `dfinsupp.pre`, instead using `{s : multiset ι // ∀ i, i ∈ s ∨ to_fun i = 0}` directly.
We no longer even need to create a `setoid` instance, since we can just use `trunc`.

While adjusting some proofs in `data/finsupp/interval` to use the new definition, this ended up eliminating some decidable arguments. I don't think that is a consequence of this redefinition, and is incidental cleanup that could have been performed separately.
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