Skip to content

Commit f51d724

Browse files
committed
chore(Geometry/Convex): uninstantiate AddTorsor.toConvexSpace (#39461)
This instance is defined through choice and is therefore very diamond-prone.
1 parent 5b6287c commit f51d724

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

Mathlib/Analysis/Convex/MetricSpace.lean

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ public section
4040

4141
namespace Convexity
4242

43+
attribute [local instance] AddTorsor.toConvexSpace
44+
4345
open ConvexSpace
4446

4547
variable {I X : Type*} [ConvexSpace ℝ X] [MetricSpace X]

Mathlib/Geometry/Convex/ConvexSpace/AffineSpace.lean

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,18 @@ theorem convexCombination_assoc (f : StdSimplex R (StdSimplex R P)) :
9898
simp only [Finsupp.coe_smul, Pi.smul_apply, smul_eq_mul, hp', mul_zero,
9999
not_true_eq_false] at hp
100100

101-
instance instConvexSpace : ConvexSpace R P where
101+
/-- Any affine space is a convex space.
102+
103+
This is not an instance because its convex combination operation is defined through the choice of an
104+
arbitrary basepoint, which makes it very diamond-prone. -/
105+
@[implicit_reducible]
106+
def toConvexSpace : ConvexSpace R P where
102107
sConvexComb := convexCombination
103108
sConvexComb_single := convexCombination_single
104109
assoc := convexCombination_assoc
105110

111+
attribute [local instance] toConvexSpace
112+
106113
/-- `ConvexSpace.sConvexComb` in an affine space is the affine combination. -/
107114
theorem sConvexComb_eq_affineCombination (s : StdSimplex R P) :
108115
s.sConvexComb = s.weights.support.affineCombination R id s.weights := by
@@ -156,6 +163,8 @@ open Finsupp
156163

157164
namespace Convexity
158165

166+
attribute [local instance] AddTorsor.toConvexSpace
167+
159168
theorem sConvexComb_eq_sum (f : StdSimplex R V) :
160169
f.sConvexComb = f.weights.sum fun i r ↦ r • i := by
161170
simp [AddTorsor.sConvexComb_eq_affineCombination,

0 commit comments

Comments
 (0)