[Merged by Bors] - refactor: improve API connecting ℝ- and 𝕜-linear functionals#34543
[Merged by Bors] - refactor: improve API connecting ℝ- and 𝕜-linear functionals#34543j-loreaux wants to merge 8 commits intoleanprover-community:masterfrom
ℝ- and 𝕜-linear functionals#34543Conversation
PR summary 08657ed7f8Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
| Current number | Change | Type |
|---|---|---|
| 13072 | -1 | backward.isDefEq |
Current commit a2e2012816
Reference commit 08657ed7f8
You can run this locally as
./scripts/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 PR/issue depends on:
|
|
This pull request has conflicts, please merge |
|
This pull request has conflicts, please merge |
| @[simp] | ||
| theorem extendTo𝕜'_apply_re (fr : Dual ℝ F) (x : F) : re (fr.extendTo𝕜' x : 𝕜) = fr x := by | ||
| simp only [extendTo𝕜'_apply, map_sub, zero_mul, mul_zero, sub_zero, rclike_simps] | ||
| theorem re_extendRCLike_apply (fr : Dual ℝ F) (x : F) : re (fr.extendRCLike x : 𝕜) = fr x := by |
There was a problem hiding this comment.
Should we add confluence lemmas for Complex.re and Complex.im? Also, should we add a lemma saying that extending from Real to Real gives fr?
There was a problem hiding this comment.
I don't love adding those confluence lemmas, because it just means that we have to duplicate everything whenever RCLike.re appears anywhere in a statement. In fact, I would prefer that the transition RCLike.re → Complex.re were not marked @[simp] for this reason. It would be okay if it were in some sort of simp set.
There was a problem hiding this comment.
We could have the real version, but I suspect it's probably not necessary. If you're working over ℝ, you probably have no reason to do this extension anyway.
There was a problem hiding this comment.
I know I'm late to the game, but can @j-loreaux explain more about the " ...it just means that we have to duplicate everything whenever RCLike.re ..."? I can't really see why we're happy with re_extendRCLike_apply being simp (which I am) and we wouldn't be with RCLike.re -> Complex.re.
|
|
||
| end ScalarTower | ||
| /-- `StrongDual.extendRCLike` bundled into a linear isometry equivalence. -/ | ||
| noncomputable def extendRCLikeₗᵢ : StrongDual ℝ F ≃ₗᵢ[ℝ] StrongDual 𝕜 F where |
There was a problem hiding this comment.
This one should come with @[simp] lemmas, probably generated by @[simps]. Same for other bundled versions, if there are missing @[simps]. BTW, should we have a ContinuousLinearEquiv version for topological vector spaces? This may be out of scope for this PR.
There was a problem hiding this comment.
As with the other bundled versions, I have just added @[simps! -isSimp apply symm_apply]. We don't want these to be actual simp lemmas, because we don't want to lose whichever bundling of extendRCLike we are currently using just because we applied it to some vector. So you have to ask to delete the bundling explicitly by doing simp [extendRCLikeₗᵢ_apply] or whatever.
Let me know if you disagree with this.
Yes, we should add the bundling for TVS, but I'll do it in another PR.
There was a problem hiding this comment.
Just for sanity: here you mean TVS as opposed to normed F (which is the current assumption)?
|
@j-loreaux Once you address the comments, please DM me on Zulip, and I'll try to quickly merge it (I'm not delegating, because I want to read answers to my questions before merging). |
|
bors merge |
) This PR concerns the extension of `ℝ`-linear (continuous or not) functionals to `𝕜`-linear functionals. This does several things, but I felt it was better to do it all at once, rather than having repeated churn in the same files because the current setup is a mess for numerous reasons. Unfortunately, that means the diff is a bit of a mess; I think the easiest way to review this PR is read the following discussion and then only look at the *new* code (and check that the deprecations exist). I will begin by highlighting the current problems: 1. Naming: the primary declarations `LinearMap.extendTo𝕜'` and `ContinuousLinearMap.extendTo𝕜'` are in the wrong namespaces (`Module.Dual` and `StrongDual`), and contain a variable name `𝕜`. 2. These declarations are primed, and their unprimed counterparts operate directly on `RestrictScalars`. This is nominally (according to the module documentation) for convenience, but it leads to defeq abuse (see #34530) and so should be avoided anyway. That PR removes the only occurrence of the use of the unprimed declarations in Mathlib. 3. The declaration `ContinuousLinearMap.extendTo𝕜'` has type class assumptions (normed ones) that are too strong, thereby making it unusable for non-normed spaces (e.g., when one wants to consider continuous linear functionals on the weak dual of a Banach space). 4. Point (3) led to the creation of `RCLike.extendTo𝕜'ₗ` which is just `ContinuousLinearMap.extendTo𝕜'` except reproven with weaker type class assumptions and bundled into a linear map. 5. There are missing `simp` lemmas, namely, ones concerning the imaginary part of the extension applied to a vector. 6. We're missing appropriately bundled versions, with `RCLike.extendTo𝕜'ₗ` being the only bundling currently. In this PR: we fix the above by doing the following: 1. Renaming `LinearMap.extendTo𝕜'` → `Module.Dual.extendRCLike` and `ContinuousLinearMap.extendTo𝕜'` → `StrongDual.extendRCLike`. 2. Removing the unprimed counterparts that operate on `RestrictScalars` 3. Weakening the type class assumptions on the newly renamed `StrongDual.extendRCLike` 4. Move `RCLike.extendTo𝕜'ₗ` out of its current location (`Analysis/LocallyConvex/Separation`) and next to `StrongDual.extendRCLike`; use the newly generalized `StrongDual.extendRCLike` to define it; rename it to `StrongDual.extendRCLikeₗ`; upgrade it from a linear map to a linear equivalence. 5. Add the missing simp lemmas for imaginary parts. 6. Add other appropriate bundlings, namely `Module.Dual.extendRCLikeₗ : Dual E ℝ ≃ₗ[ℝ] Dual E 𝕜`, and, in the context of normed spaces `StrongDual.extendRCLikeₗᵢ : StrongDual E ℝ ≃ₗᵢ[ℝ] StrongDual E 𝕜`.
|
Pull request successfully merged into master. Build succeeded:
|
ℝ- and 𝕜-linear functionalsℝ- and 𝕜-linear functionals
…nprover-community#34543) This PR concerns the extension of `ℝ`-linear (continuous or not) functionals to `𝕜`-linear functionals. This does several things, but I felt it was better to do it all at once, rather than having repeated churn in the same files because the current setup is a mess for numerous reasons. Unfortunately, that means the diff is a bit of a mess; I think the easiest way to review this PR is read the following discussion and then only look at the *new* code (and check that the deprecations exist). I will begin by highlighting the current problems: 1. Naming: the primary declarations `LinearMap.extendTo𝕜'` and `ContinuousLinearMap.extendTo𝕜'` are in the wrong namespaces (`Module.Dual` and `StrongDual`), and contain a variable name `𝕜`. 2. These declarations are primed, and their unprimed counterparts operate directly on `RestrictScalars`. This is nominally (according to the module documentation) for convenience, but it leads to defeq abuse (see leanprover-community#34530) and so should be avoided anyway. That PR removes the only occurrence of the use of the unprimed declarations in Mathlib. 3. The declaration `ContinuousLinearMap.extendTo𝕜'` has type class assumptions (normed ones) that are too strong, thereby making it unusable for non-normed spaces (e.g., when one wants to consider continuous linear functionals on the weak dual of a Banach space). 4. Point (3) led to the creation of `RCLike.extendTo𝕜'ₗ` which is just `ContinuousLinearMap.extendTo𝕜'` except reproven with weaker type class assumptions and bundled into a linear map. 5. There are missing `simp` lemmas, namely, ones concerning the imaginary part of the extension applied to a vector. 6. We're missing appropriately bundled versions, with `RCLike.extendTo𝕜'ₗ` being the only bundling currently. In this PR: we fix the above by doing the following: 1. Renaming `LinearMap.extendTo𝕜'` → `Module.Dual.extendRCLike` and `ContinuousLinearMap.extendTo𝕜'` → `StrongDual.extendRCLike`. 2. Removing the unprimed counterparts that operate on `RestrictScalars` 3. Weakening the type class assumptions on the newly renamed `StrongDual.extendRCLike` 4. Move `RCLike.extendTo𝕜'ₗ` out of its current location (`Analysis/LocallyConvex/Separation`) and next to `StrongDual.extendRCLike`; use the newly generalized `StrongDual.extendRCLike` to define it; rename it to `StrongDual.extendRCLikeₗ`; upgrade it from a linear map to a linear equivalence. 5. Add the missing simp lemmas for imaginary parts. 6. Add other appropriate bundlings, namely `Module.Dual.extendRCLikeₗ : Dual E ℝ ≃ₗ[ℝ] Dual E 𝕜`, and, in the context of normed spaces `StrongDual.extendRCLikeₗᵢ : StrongDual E ℝ ≃ₗᵢ[ℝ] StrongDual E 𝕜`.
…nprover-community#34543) This PR concerns the extension of `ℝ`-linear (continuous or not) functionals to `𝕜`-linear functionals. This does several things, but I felt it was better to do it all at once, rather than having repeated churn in the same files because the current setup is a mess for numerous reasons. Unfortunately, that means the diff is a bit of a mess; I think the easiest way to review this PR is read the following discussion and then only look at the *new* code (and check that the deprecations exist). I will begin by highlighting the current problems: 1. Naming: the primary declarations `LinearMap.extendTo𝕜'` and `ContinuousLinearMap.extendTo𝕜'` are in the wrong namespaces (`Module.Dual` and `StrongDual`), and contain a variable name `𝕜`. 2. These declarations are primed, and their unprimed counterparts operate directly on `RestrictScalars`. This is nominally (according to the module documentation) for convenience, but it leads to defeq abuse (see leanprover-community#34530) and so should be avoided anyway. That PR removes the only occurrence of the use of the unprimed declarations in Mathlib. 3. The declaration `ContinuousLinearMap.extendTo𝕜'` has type class assumptions (normed ones) that are too strong, thereby making it unusable for non-normed spaces (e.g., when one wants to consider continuous linear functionals on the weak dual of a Banach space). 4. Point (3) led to the creation of `RCLike.extendTo𝕜'ₗ` which is just `ContinuousLinearMap.extendTo𝕜'` except reproven with weaker type class assumptions and bundled into a linear map. 5. There are missing `simp` lemmas, namely, ones concerning the imaginary part of the extension applied to a vector. 6. We're missing appropriately bundled versions, with `RCLike.extendTo𝕜'ₗ` being the only bundling currently. In this PR: we fix the above by doing the following: 1. Renaming `LinearMap.extendTo𝕜'` → `Module.Dual.extendRCLike` and `ContinuousLinearMap.extendTo𝕜'` → `StrongDual.extendRCLike`. 2. Removing the unprimed counterparts that operate on `RestrictScalars` 3. Weakening the type class assumptions on the newly renamed `StrongDual.extendRCLike` 4. Move `RCLike.extendTo𝕜'ₗ` out of its current location (`Analysis/LocallyConvex/Separation`) and next to `StrongDual.extendRCLike`; use the newly generalized `StrongDual.extendRCLike` to define it; rename it to `StrongDual.extendRCLikeₗ`; upgrade it from a linear map to a linear equivalence. 5. Add the missing simp lemmas for imaginary parts. 6. Add other appropriate bundlings, namely `Module.Dual.extendRCLikeₗ : Dual E ℝ ≃ₗ[ℝ] Dual E 𝕜`, and, in the context of normed spaces `StrongDual.extendRCLikeₗᵢ : StrongDual E ℝ ≃ₗᵢ[ℝ] StrongDual E 𝕜`.
This PR concerns the extension of
ℝ-linear (continuous or not) functionals to𝕜-linear functionals. This does several things, but I felt it was better to do it all at once, rather than having repeated churn in the same files because the current setup is a mess for numerous reasons. Unfortunately, that means the diff is a bit of a mess; I think the easiest way to review this PR is read the following discussion and then only look at the new code (and check that the deprecations exist).I will begin by highlighting the current problems:
LinearMap.extendTo𝕜'andContinuousLinearMap.extendTo𝕜'are in the wrong namespaces (Module.DualandStrongDual), and contain a variable name𝕜.RestrictScalars. This is nominally (according to the module documentation) for convenience, but it leads to defeq abuse (see [Merged by Bors] - fix: remove defeq abuse in the Hahn-Banach theorem #34530) and so should be avoided anyway. That PR removes the only occurrence of the use of the unprimed declarations in Mathlib.ContinuousLinearMap.extendTo𝕜'has type class assumptions (normed ones) that are too strong, thereby making it unusable for non-normed spaces (e.g., when one wants to consider continuous linear functionals on the weak dual of a Banach space).RCLike.extendTo𝕜'ₗwhich is justContinuousLinearMap.extendTo𝕜'except reproven with weaker type class assumptions and bundled into a linear map.simplemmas, namely, ones concerning the imaginary part of the extension applied to a vector.RCLike.extendTo𝕜'ₗbeing the only bundling currently.In this PR: we fix the above by doing the following:
LinearMap.extendTo𝕜'→Module.Dual.extendRCLikeandContinuousLinearMap.extendTo𝕜'→StrongDual.extendRCLike.RestrictScalarsStrongDual.extendRCLikeRCLike.extendTo𝕜'ₗout of its current location (Analysis/LocallyConvex/Separation) and next toStrongDual.extendRCLike; use the newly generalizedStrongDual.extendRCLiketo define it; rename it toStrongDual.extendRCLikeₗ; upgrade it from a linear map to a linear equivalence.Module.Dual.extendRCLikeₗ : Dual E ℝ ≃ₗ[ℝ] Dual E 𝕜, and, in the context of normed spacesStrongDual.extendRCLikeₗᵢ : StrongDual E ℝ ≃ₗᵢ[ℝ] StrongDual E 𝕜.In a follow-up PR, I will add the bundling:
WeakDual.extendRCLikeL : WeakDual E ℝ ≃L[ℝ] WeakDual E 𝕜.