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/dfinsupp): Port over the finsupp.lift_add_hom API #4821

Closed
wants to merge 3 commits into from

Conversation

eric-wieser
Copy link
Member

@eric-wieser eric-wieser commented Oct 29, 2020

These lemmas are mostly copied with minimal translation from finsupp.
A few proofs are taken from direct_sum.
The API of direct_sum is deliberately unchanged in this PR.


cc @urkud and @kckennylau, who wrote parts of this moved code.

@eric-wieser eric-wieser added blocked-by-other-PR This PR depends on another PR which is still in the queue. A bot manages this label via PR comment. awaiting-review The author would like community review of the PR labels Oct 29, 2020
Comment on lines +421 to +426
top_unique $ λ x hx, (begin
apply dfinsupp.induction x,
exact add_submonoid.zero_mem _,
exact λ a b f ha hb hf, add_submonoid.add_mem _
(add_submonoid.subset_closure $ set.mem_Union.2 ⟨a, set.mem_range_self _⟩) hf
end)
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 worked in term mode for finsupp, but the elaborator couldn't fill out the underscores unless I did it in tactic mode.

Comment on lines 776 to 819
/--
When summing over an `add_monoid_hom`, the decidability assumption is not needed, and the result is
also an `add_monoid_hom` -/
def sum_add_hom [Π i, add_monoid (β i)] [add_comm_monoid γ] (φ : Π i, β i →+ γ) : ((Π₀ i, β i) →+ γ) :=
{ to_fun := (λ f,
quotient.lift_on f (λ x, ∑ i in x.2.to_finset, φ i (x.1 i)) $ λ x y H,
begin
have H1 : x.2.to_finset ∩ y.2.to_finset ⊆ x.2.to_finset, from finset.inter_subset_left _ _,
have H2 : x.2.to_finset ∩ y.2.to_finset ⊆ y.2.to_finset, from finset.inter_subset_right _ _,
refine (finset.sum_subset H1 _).symm.trans ((finset.sum_congr rfl _).trans (finset.sum_subset H2 _)),
{ intros i H1 H2, rw finset.mem_inter at H2, rw H i,
simp only [multiset.mem_to_finset] at H1 H2,
rw [(y.3 i).resolve_left (mt (and.intro H1) H2), add_monoid_hom.map_zero] },
{ intros i H1, rw H i },
{ intros i H1 H2, rw finset.mem_inter at H2, rw ← H i,
simp only [multiset.mem_to_finset] at H1 H2,
rw [(x.3 i).resolve_left (mt (λ H3, and.intro H3 H1) H2), add_monoid_hom.map_zero] }
end),
map_add' := assume f g,
begin
refine quotient.induction_on f (λ x, _),
refine quotient.induction_on g (λ y, _),
change ∑ i in _, _ = (∑ i in _, _) + (∑ i in _, _),
simp only, conv { to_lhs, congr, skip, funext, rw add_monoid_hom.map_add },
simp only [finset.sum_add_distrib],
congr' 1,
{ refine (finset.sum_subset _ _).symm,
{ intro i, simp only [multiset.mem_to_finset, multiset.mem_add], exact or.inl },
{ intros i H1 H2, simp only [multiset.mem_to_finset, multiset.mem_add] at H2,
rw [(x.3 i).resolve_left H2, add_monoid_hom.map_zero] } },
{ refine (finset.sum_subset _ _).symm,
{ intro i, simp only [multiset.mem_to_finset, multiset.mem_add], exact or.inr },
{ intros i H1 H2, simp only [multiset.mem_to_finset, multiset.mem_add] at H2,
rw [(y.3 i).resolve_left H2, add_monoid_hom.map_zero] } }
end,
map_zero' := rfl }

@[simp] lemma sum_add_hom_single [Π i, add_monoid (β i)] [add_comm_monoid γ]
(φ : Π i, β i →+ γ) (i) (x : β i) : sum_add_hom φ (single i x) = φ i x :=
(add_zero _).trans $ congr_arg (φ i) $ show (if H : i ∈ ({i} : finset _) then x else 0) = x,
from dif_pos $ finset.mem_singleton_self i
Copy link
Member Author

Choose a reason for hiding this comment

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

These proofs are taken verbatim from direct_sum

Comment on lines +841 to +846
left_inv := λ x, by { ext, simp },
right_inv := λ ψ, by { ext, simp },
map_add' := λ F G, by { ext, simp } }
Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks to @urkud's awesome ext lemma, the longer proofs of these from direct_sum can be discarded.

@github-actions github-actions bot added merge-conflict Please `git merge origin/master` then a bot will remove this label. and removed merge-conflict Please `git merge origin/master` then a bot will remove this label. labels Oct 29, 2020
@eric-wieser eric-wieser removed the blocked-by-other-PR This PR depends on another PR which is still in the queue. A bot manages this label via PR comment. label Oct 29, 2020
Copy link
Member

@jcommelin jcommelin 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 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-review The author would like community review of the PR labels Oct 30, 2020
bors bot pushed a commit that referenced this pull request Oct 30, 2020
These lemmas are mostly copied with minimal translation from `finsupp`.
A few proofs are taken from `direct_sum`.
The API of `direct_sum` is deliberately unchanged in this PR.
@bors
Copy link

bors bot commented Oct 30, 2020

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(data/dfinsupp): Port over the finsupp.lift_add_hom API [Merged by Bors] - feat(data/dfinsupp): Port over the finsupp.lift_add_hom API Oct 30, 2020
@bors bors bot closed this Oct 30, 2020
@bors bors bot deleted the dfinsupp-lift-add-hom branch October 30, 2020 11:08
lecopivo pushed a commit to lecopivo/mathlib that referenced this pull request Oct 31, 2020
…over-community#4821)

These lemmas are mostly copied with minimal translation from `finsupp`.
A few proofs are taken from `direct_sum`.
The API of `direct_sum` is deliberately unchanged in this PR.
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

2 participants