@@ -12,20 +12,13 @@ public import Mathlib.LinearAlgebra.AffineSpace.AffineMap
1212/-!
1313# Modules are convex spaces
1414
15- This file shows that every semimodule over an ordered semiring is a convex space.
15+ This file shows that every module over ordered coefficients is a convex space.
1616
1717## Main declarations
1818
1919* `ConvexSpace.ofModule`: A semimodule space over a semiring is a convex space.
2020* `convexSpaceSelf`: A semiring is a convex space over itself.
2121* `IsModuleConvexSpace`: Predicate for a convex space and module structures to be compatible.
22-
23- ## Implementation notes
24-
25- It is sadly impossible to make `ConvexSpace.ofModule` a global instance since it creates diamonds
26- with structural instances such as `ConvexSpace R X → ConvexSpace R Y → ConvexSpace R (X × Y)`
27- because `(∑ i, f i).fst = ∑ i, (f i).fst` isn't defeq, ultimately because `Finset.sum` isn't a field
28- of `AddCommMonoid`.
2922 -/
3023
3124public section
@@ -36,7 +29,10 @@ variable {R M N I : Type*} [Semiring R] [PartialOrder R] [IsStrictOrderedRing R]
3629
3730/-- Any semimodule over an ordered semiring is a convex space.
3831
39- This is not an instance because it creates a diamond. -/
32+ This is not an instance because it creates a diamond with structural instances such as
33+ `ConvexSpace R X → ConvexSpace R Y → ConvexSpace R (X × Y)` because
34+ `(∑ i, f i).fst = ∑ i, (f i).fst` isn't defeq, ultimately because `Finset.sum` isn't a field of
35+ `AddCommMonoid` but derived from them through recursion. -/
4036@ [expose, implicit_reducible]
4137def ConvexSpace.ofModule : ConvexSpace R M where
4238 sConvexComb w := w.weights.sum fun m r ↦ r • m
0 commit comments