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] - chore(data/fin,data/finset): a few lemmas #7168

Closed
wants to merge 7 commits into from

Conversation

urkud
Copy link
Member

@urkud urkud commented Apr 12, 2021

  • fin.heq_fun_iff: use Sort* instead of Type*;
  • fin.cast_refl: take h : n = n := rfl as an argument;
  • fin.cast_to_equiv, fin.cast_eq_cast: relate fin.cast to _root_.cast;
  • finset.map_cast_heq: new lemma;
  • finset.subset_univ: add @[simp];
  • card_finset_fin_le, fintype.card_finset_len, fin.prod_const : new lemmas;
  • order_iso.refl: new definition.

Open in Gitpod

@urkud urkud added the awaiting-review The author would like community review of the PR label Apr 12, 2021
by simpa using fintype.sum_pow_mul_eq_add_pow (fin n) a b

lemma fin.prod_const [comm_monoid α] (n : ℕ) (x : α) : ∏ i : fin n, x = x ^ n := by simp
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be @[to_additive] right?

Copy link
Member

Choose a reason for hiding this comment

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

to_additive can't deal with pow by itself, so we'll need a manual sum_const lemma.

Copy link
Member

Choose a reason for hiding this comment

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

We still should connect these two lemmas with @[to_additive] after proving them both, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, to_additive won't be able to use this because it'll fail to match the types of RHS.

@@ -961,6 +964,14 @@ instance finset.fintype [fintype α] : fintype (finset α) :=
fintype.card (finset α) = 2 ^ (fintype.card α) :=
finset.card_powerset finset.univ

@[simp] lemma fintype.card_finset_len [fintype α] (k : ℕ) :
fintype.card {s : finset α // s.card = k} = nat.choose (fintype.card α) k :=
Copy link
Member

Choose a reason for hiding this comment

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

Is the LHS the canonical way to talk about the number of elements satisfying a property? I would expect it to be (finset.univ.filter ...).card

by simpa using fintype.sum_pow_mul_eq_add_pow (fin n) a b

lemma fin.prod_const [comm_monoid α] (n : ℕ) (x : α) : ∏ i : fin n, x = x ^ n := by simp
Copy link
Member

Choose a reason for hiding this comment

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

We still should connect these two lemmas with @[to_additive] after proving them both, right?

@fpvandoorn
Copy link
Member

Note: I unresolved an earlier comment.

LGTM (independent of how you deal with my comment on fintype.card_finset_len)

bors d+

@bors
Copy link

bors bot commented Apr 14, 2021

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

@fpvandoorn fpvandoorn 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 Apr 14, 2021
@urkud
Copy link
Member Author

urkud commented Apr 15, 2021

bors merge

@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 Apr 15, 2021
bors bot pushed a commit that referenced this pull request Apr 15, 2021
* `fin.heq_fun_iff`: use `Sort*` instead of `Type*`;
* `fin.cast_refl`: take `h : n = n := rfl` as an argument;
* `fin.cast_to_equiv`, `fin.cast_eq_cast`: relate `fin.cast` to `_root_.cast`;
* `finset.map_cast_heq`: new lemma;
* `finset.subset_univ`: add `@[simp]`;
* `card_finset_fin_le`, `fintype.card_finset_len`, `fin.prod_const` : new lemmas;
* `order_iso.refl`: new definition.
@bors
Copy link

bors bot commented Apr 15, 2021

Build failed (retrying...):

bors bot pushed a commit that referenced this pull request Apr 15, 2021
* `fin.heq_fun_iff`: use `Sort*` instead of `Type*`;
* `fin.cast_refl`: take `h : n = n := rfl` as an argument;
* `fin.cast_to_equiv`, `fin.cast_eq_cast`: relate `fin.cast` to `_root_.cast`;
* `finset.map_cast_heq`: new lemma;
* `finset.subset_univ`: add `@[simp]`;
* `card_finset_fin_le`, `fintype.card_finset_len`, `fin.prod_const` : new lemmas;
* `order_iso.refl`: new definition.
@bors
Copy link

bors bot commented Apr 15, 2021

Canceled.

@urkud
Copy link
Member Author

urkud commented Apr 15, 2021

bors merge

bors bot pushed a commit that referenced this pull request Apr 15, 2021
* `fin.heq_fun_iff`: use `Sort*` instead of `Type*`;
* `fin.cast_refl`: take `h : n = n := rfl` as an argument;
* `fin.cast_to_equiv`, `fin.cast_eq_cast`: relate `fin.cast` to `_root_.cast`;
* `finset.map_cast_heq`: new lemma;
* `finset.subset_univ`: add `@[simp]`;
* `card_finset_fin_le`, `fintype.card_finset_len`, `fin.prod_const` : new lemmas;
* `order_iso.refl`: new definition.
@bors
Copy link

bors bot commented Apr 15, 2021

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title chore(data/fin,data/finset): a few lemmas [Merged by Bors] - chore(data/fin,data/finset): a few lemmas Apr 15, 2021
@bors bors bot closed this Apr 15, 2021
@bors bors bot deleted the fin-lemmas branch April 15, 2021 08:26
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