feat: add DFinsupp.mapDomain to match Finsupp.mapDomain#38977
feat: add DFinsupp.mapDomain to match Finsupp.mapDomain#38977eric-wieser wants to merge 12 commits into
DFinsupp.mapDomain to match Finsupp.mapDomain#38977Conversation
PR summary a60ac7cccfImport changes for modified filesNo significant changes to the import graph Import changes for all files
|
| Current number | Change | Type (strong) |
|---|---|---|
| 499 | 1 | erw |
Increase in weak tech debt: (relative, absolute) = (1.00, 0.00)
| Current number | Change | Type (weak) |
|---|---|---|
| 5011 | 1 | exposed public sections |
Current commit a60ac7cccf
Reference commit 1f165a51de
This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.sh pr_summary
- The
relativevalue is the weighted sum of the differences with weight given by the inverse of the current value of the statistic. - The
absolutevalue is therelativevalue divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).
|
This pull request has conflicts, please merge |
|
This PR/issue depends on: |
ad52257 to
65c9093
Compare
DFinsupp.mapDomain to match Finsupp.mapDomain
YaelDillies
left a comment
There was a problem hiding this comment.
I am worried that striving for local consistency here means you are spreading some bad design choices about Finsupp.
| theorem mapRange_fun_id (g : Π₀ i : ι, β₁ i) : | ||
| mapRange (fun _ x => x) (fun _ => rfl) g = g := by | ||
| ext | ||
| rfl | ||
|
|
||
| @[simp] | ||
| theorem mapRange_id (g : Π₀ i : ι, β₁ i) : | ||
| mapRange (fun i => (id : β₁ i → β₁ i)) (fun _ => rfl) g = g := |
There was a problem hiding this comment.
| theorem mapRange_fun_id (g : Π₀ i : ι, β₁ i) : | |
| mapRange (fun _ x => x) (fun _ => rfl) g = g := by | |
| ext | |
| rfl | |
| @[simp] | |
| theorem mapRange_id (g : Π₀ i : ι, β₁ i) : | |
| mapRange (fun i => (id : β₁ i → β₁ i)) (fun _ => rfl) g = g := | |
| @[to_fun (attr := simp) mapRange_fun_id] | |
| theorem mapRange_id (g : Π₀ i : ι, β₁ i) : | |
| mapRange (fun i => (id : β₁ i → β₁ i)) (fun _ => rfl) g = g := |
| ext | ||
| simp only [mapRange_apply] | ||
|
|
||
| theorem mapRange_comp (f : ∀ i, β₁ i → β₂ i) (f₂ : ∀ i, β i → β₁ i) (hf : ∀ i, f i 0 = 0) |
| theorem mapDomain_fun_id (x : Π₀ b, M b) : mapDomain (·) x = x := | ||
| congr($(sumAddHom_singleAddHom) x) | ||
|
|
||
| /-- Note that `x` the RHS is mildly type-incorrect. -/ |
There was a problem hiding this comment.
| /-- Note that `x` the RHS is mildly type-incorrect. -/ | |
| /-- Note that `x` in the RHS is mildly type-incorrect. -/ |
| /-- Note that `x` the RHS is mildly type-incorrect. -/ | ||
| @[simp] | ||
| theorem mapDomain_id (x : Π₀ b, M (id b)) : | ||
| mapDomain id x = x := |
There was a problem hiding this comment.
Doesn't that mean we shouldn't have this lemma?
There was a problem hiding this comment.
I tried adding the correct version with suitable casting, but simp simplifies the id in the type anyway and changes it to this form.
| · grind | ||
| · exact (hs a).resolve_left ha |>.symm | ||
|
|
||
| lemma embDomain_notin_range (f : α ↪ β) (v : Π₀ a, M (f a)) {b : β} (hb : b ∉ Set.range f) : |
There was a problem hiding this comment.
Let's not spread poor naming
| lemma embDomain_notin_range (f : α ↪ β) (v : Π₀ a, M (f a)) {b : β} (hb : b ∉ Set.range f) : | |
| lemma embDomain_of_notMem_range (f : α ↪ β) (v : Π₀ a, M (f a)) {b : β} (hb : b ∉ Set.range f) : |
See #41766 for the Finsupp rename
| is the finitely supported function whose value at `a : β` is the sum | ||
| of `v x` over all `x` such that `f x = a`. -/ |
There was a problem hiding this comment.
| is the finitely supported function whose value at `a : β` is the sum | |
| of `v x` over all `x` such that `f x = a`. -/ | |
| is the finitely supported function whose value at `a : β` is the sum | |
| of `v x` over all `x` such that `f x = a`. -/ |
| theorem mapDomain_congr {f g : α → β} [(x : N) → Decidable (x ≠ 0)] | ||
| (v : Π₀ _ : α, N) (h : ∀ x ∈ v.support, f x = g x) : | ||
| v.mapDomain f = (mapDomain g v : Π₀ _ : β, N) := by |
There was a problem hiding this comment.
I suggest
| theorem mapDomain_congr {f g : α → β} [(x : N) → Decidable (x ≠ 0)] | |
| (v : Π₀ _ : α, N) (h : ∀ x ∈ v.support, f x = g x) : | |
| v.mapDomain f = (mapDomain g v : Π₀ _ : β, N) := by | |
| @[congr] | |
| theorem mapDomain_congr {f g : α → β} [(x : N) → Decidable (x ≠ 0)] | |
| (v : Π₀ _ : α, N) (h : ∀ x ∈ v.support, f x = g x) : | |
| v.mapDomain f = (mapDomain g v : Π₀ _ : β, N) := by |
to match #39575
| theorem mapDomain_add {f : α → β} (v₁ v₂ : Π₀ a, M (f a)) : | ||
| mapDomain f (v₁ + v₂) = mapDomain f v₁ + mapDomain f v₂ := | ||
| map_add _ _ _ | ||
|
|
||
| lemma mapDomain_sub {M : β → Type*} [∀ b, AddCommGroup (M b)] | ||
| {f : α → β} (v₁ v₂ : Π₀ a, M (f a)) : | ||
| mapDomain f (v₁ - v₂) = mapDomain f v₁ - mapDomain f v₂ := | ||
| map_sub _ _ _ |
There was a problem hiding this comment.
Any reason not to make this simp?
The API for
DFinsupp.mapDomainis copied fromFinsupp.mapDomain.One motivation here is to make it easier to swap out either Basis or AddMonoidAlgebra to use DFinsupp and thus become computable.
List.find?#40326