# Affine combinations of points #

This file defines affine combinations of points.

## Main definitions #

• weightedVSubOfPoint is a general weighted combination of subtractions with an explicit base point, yielding a vector.

• weightedVSub uses an arbitrary choice of base point and is intended to be used when the sum of weights is 0, in which case the result is independent of the choice of base point.

• affineCombination adds the weighted combination to the arbitrary base point, yielding a point rather than a vector, and is intended to be used when the sum of weights is 1, in which case the result is independent of the choice of base point.

These definitions are for sums over a Finset; versions for a Fintype may be obtained using Finset.univ, while versions for a Finsupp may be obtained using Finsupp.support.

## References #

• https://en.wikipedia.org/wiki/Affine_space
theorem Finset.univ_fin2 :
Finset.univ = {0, 1}
def Finset.weightedVSubOfPoint {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (p : ιP) (b : P) :
(ιk) →ₗ[k] V

A weighted sum of the results of subtracting a base point from the given points, as a linear map on the weights. The main cases of interest are where the sum of the weights is 0, in which case the sum is independent of the choice of base point, and where the sum of the weights is 1, in which case the sum added to the base point is independent of the choice of base point.

Equations
Instances For
@[simp]
theorem Finset.weightedVSubOfPoint_apply {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p : ιP) (b : P) :
() w = Finset.sum s fun (i : ι) => w i (p i -ᵥ b)
@[simp]
theorem Finset.weightedVSubOfPoint_apply_const {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p : P) (b : P) :
(Finset.weightedVSubOfPoint s (fun (x : ι) => p) b) w = (Finset.sum s fun (i : ι) => w i) (p -ᵥ b)

The value of weightedVSubOfPoint, where the given points are equal.

theorem Finset.weightedVSubOfPoint_congr {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) {w₁ : ιk} {w₂ : ιk} (hw : is, w₁ i = w₂ i) {p₁ : ιP} {p₂ : ιP} (hp : is, p₁ i = p₂ i) (b : P) :
() w₁ = () w₂

weightedVSubOfPoint gives equal results for two families of weights and two families of points that are equal on s.

theorem Finset.weightedVSubOfPoint_eq_of_weights_eq {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (p : ιP) (j : ι) (w₁ : ιk) (w₂ : ιk) (hw : ∀ (i : ι), i jw₁ i = w₂ i) :
(Finset.weightedVSubOfPoint s p (p j)) w₁ = (Finset.weightedVSubOfPoint s p (p j)) w₂

Given a family of points, if we use a member of the family as a base point, the weightedVSubOfPoint does not depend on the value of the weights at this point.

theorem Finset.weightedVSubOfPoint_eq_of_sum_eq_zero {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p : ιP) (h : (Finset.sum s fun (i : ι) => w i) = 0) (b₁ : P) (b₂ : P) :
() w = () w

The weighted sum is independent of the base point when the sum of the weights is 0.

theorem Finset.weightedVSubOfPoint_vadd_eq_of_sum_eq_one {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p : ιP) (h : (Finset.sum s fun (i : ι) => w i) = 1) (b₁ : P) (b₂ : P) :
() w +ᵥ b₁ = () w +ᵥ b₂

The weighted sum, added to the base point, is independent of the base point when the sum of the weights is 1.

@[simp]
theorem Finset.weightedVSubOfPoint_erase {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) [] (w : ιk) (p : ιP) (i : ι) :

The weighted sum is unaffected by removing the base point, if present, from the set of points.

@[simp]
theorem Finset.weightedVSubOfPoint_insert {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) [] (w : ιk) (p : ιP) (i : ι) :

The weighted sum is unaffected by adding the base point, whether or not present, to the set of points.

theorem Finset.weightedVSubOfPoint_indicator_subset {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (w : ιk) (p : ιP) (b : P) {s₁ : } {s₂ : } (h : s₁ s₂) :
() w = () (Set.indicator (s₁) w)

The weighted sum is unaffected by changing the weights to the corresponding indicator function and adding points to the set.

theorem Finset.weightedVSubOfPoint_map {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} {ι₂ : Type u_5} (s₂ : Finset ι₂) (e : ι₂ ι) (w : ιk) (p : ιP) (b : P) :
(Finset.weightedVSubOfPoint (Finset.map e s₂) p b) w = (Finset.weightedVSubOfPoint s₂ (p e) b) (w e)

A weighted sum, over the image of an embedding, equals a weighted sum with the same points and weights over the original Finset.

theorem Finset.sum_smul_vsub_eq_weightedVSubOfPoint_sub {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p₁ : ιP) (p₂ : ιP) (b : P) :
(Finset.sum s fun (i : ι) => w i (p₁ i -ᵥ p₂ i)) = () w - () w

A weighted sum of pairwise subtractions, expressed as a subtraction of two weightedVSubOfPoint expressions.

theorem Finset.sum_smul_vsub_const_eq_weightedVSubOfPoint_sub {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p₁ : ιP) (p₂ : P) (b : P) :
(Finset.sum s fun (i : ι) => w i (p₁ i -ᵥ p₂)) = () w - (Finset.sum s fun (i : ι) => w i) (p₂ -ᵥ b)

A weighted sum of pairwise subtractions, where the point on the right is constant, expressed as a subtraction involving a weightedVSubOfPoint expression.

theorem Finset.sum_smul_const_vsub_eq_sub_weightedVSubOfPoint {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p₂ : ιP) (p₁ : P) (b : P) :
(Finset.sum s fun (i : ι) => w i (p₁ -ᵥ p₂ i)) = (Finset.sum s fun (i : ι) => w i) (p₁ -ᵥ b) - () w

A weighted sum of pairwise subtractions, where the point on the left is constant, expressed as a subtraction involving a weightedVSubOfPoint expression.

theorem Finset.weightedVSubOfPoint_sdiff {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) [] {s₂ : } (h : s₂ s) (w : ιk) (p : ιP) (b : P) :
(Finset.weightedVSubOfPoint (s \ s₂) p b) w + () w = () w

A weighted sum may be split into such sums over two subsets.

theorem Finset.weightedVSubOfPoint_sdiff_sub {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) [] {s₂ : } (h : s₂ s) (w : ιk) (p : ιP) (b : P) :
(Finset.weightedVSubOfPoint (s \ s₂) p b) w - () (-w) = () w

A weighted sum may be split into a subtraction of such sums over two subsets.

theorem Finset.weightedVSubOfPoint_subtype_eq_filter {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p : ιP) (b : P) (pred : ιProp) [DecidablePred pred] :
((Finset.weightedVSubOfPoint (Finset.subtype pred s) (fun (i : Subtype pred) => p i) b) fun (i : Subtype pred) => w i) = (Finset.weightedVSubOfPoint (Finset.filter pred s) p b) w

A weighted sum over s.subtype pred equals one over s.filter pred.

theorem Finset.weightedVSubOfPoint_filter_of_ne {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p : ιP) (b : P) {pred : ιProp} [DecidablePred pred] (h : is, w i 0pred i) :

A weighted sum over s.filter pred equals one over s if all the weights at indices in s not satisfying pred are zero.

theorem Finset.weightedVSubOfPoint_const_smul {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p : ιP) (b : P) (c : k) :
() (c w) = c () w

A constant multiplier of the weights in weightedVSubOfPoint may be moved outside the sum.

def Finset.weightedVSub {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (p : ιP) :
(ιk) →ₗ[k] V

A weighted sum of the results of subtracting a default base point from the given points, as a linear map on the weights. This is intended to be used when the sum of the weights is 0; that condition is specified as a hypothesis on those lemmas that require it.

Equations
Instances For
theorem Finset.weightedVSub_apply {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p : ιP) :
() w = Finset.sum s fun (i : ι) => w i (p i -ᵥ )

Applying weightedVSub with given weights. This is for the case where a result involving a default base point is OK (for example, when that base point will cancel out later); a more typical use case for weightedVSub would involve selecting a preferred base point with weightedVSub_eq_weightedVSubOfPoint_of_sum_eq_zero and then using weightedVSubOfPoint_apply.

theorem Finset.weightedVSub_eq_weightedVSubOfPoint_of_sum_eq_zero {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p : ιP) (h : (Finset.sum s fun (i : ι) => w i) = 0) (b : P) :
() w = () w

weightedVSub gives the sum of the results of subtracting any base point, when the sum of the weights is 0.

@[simp]
theorem Finset.weightedVSub_apply_const {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p : P) (h : (Finset.sum s fun (i : ι) => w i) = 0) :
(Finset.weightedVSub s fun (x : ι) => p) w = 0

The value of weightedVSub, where the given points are equal and the sum of the weights is 0.

@[simp]
theorem Finset.weightedVSub_empty {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (w : ιk) (p : ιP) :
() w = 0

The weightedVSub for an empty set is 0.

theorem Finset.weightedVSub_congr {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) {w₁ : ιk} {w₂ : ιk} (hw : is, w₁ i = w₂ i) {p₁ : ιP} {p₂ : ιP} (hp : is, p₁ i = p₂ i) :
() w₁ = () w₂

weightedVSub gives equal results for two families of weights and two families of points that are equal on s.

theorem Finset.weightedVSub_indicator_subset {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (w : ιk) (p : ιP) {s₁ : } {s₂ : } (h : s₁ s₂) :
() w = () (Set.indicator (s₁) w)

The weighted sum is unaffected by changing the weights to the corresponding indicator function and adding points to the set.

theorem Finset.weightedVSub_map {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} {ι₂ : Type u_5} (s₂ : Finset ι₂) (e : ι₂ ι) (w : ιk) (p : ιP) :
(Finset.weightedVSub (Finset.map e s₂) p) w = (Finset.weightedVSub s₂ (p e)) (w e)

A weighted subtraction, over the image of an embedding, equals a weighted subtraction with the same points and weights over the original Finset.

theorem Finset.sum_smul_vsub_eq_weightedVSub_sub {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p₁ : ιP) (p₂ : ιP) :
(Finset.sum s fun (i : ι) => w i (p₁ i -ᵥ p₂ i)) = () w - () w

A weighted sum of pairwise subtractions, expressed as a subtraction of two weightedVSub expressions.

theorem Finset.sum_smul_vsub_const_eq_weightedVSub {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p₁ : ιP) (p₂ : P) (h : (Finset.sum s fun (i : ι) => w i) = 0) :
(Finset.sum s fun (i : ι) => w i (p₁ i -ᵥ p₂)) = () w

A weighted sum of pairwise subtractions, where the point on the right is constant and the sum of the weights is 0.

theorem Finset.sum_smul_const_vsub_eq_neg_weightedVSub {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p₂ : ιP) (p₁ : P) (h : (Finset.sum s fun (i : ι) => w i) = 0) :
(Finset.sum s fun (i : ι) => w i (p₁ -ᵥ p₂ i)) = -() w

A weighted sum of pairwise subtractions, where the point on the left is constant and the sum of the weights is 0.

theorem Finset.weightedVSub_sdiff {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) [] {s₂ : } (h : s₂ s) (w : ιk) (p : ιP) :
(Finset.weightedVSub (s \ s₂) p) w + () w = () w

A weighted sum may be split into such sums over two subsets.

theorem Finset.weightedVSub_sdiff_sub {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) [] {s₂ : } (h : s₂ s) (w : ιk) (p : ιP) :
(Finset.weightedVSub (s \ s₂) p) w - () (-w) = () w

A weighted sum may be split into a subtraction of such sums over two subsets.

theorem Finset.weightedVSub_subtype_eq_filter {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p : ιP) (pred : ιProp) [DecidablePred pred] :
((Finset.weightedVSub (Finset.subtype pred s) fun (i : Subtype pred) => p i) fun (i : Subtype pred) => w i) = (Finset.weightedVSub (Finset.filter pred s) p) w

A weighted sum over s.subtype pred equals one over s.filter pred.

theorem Finset.weightedVSub_filter_of_ne {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p : ιP) {pred : ιProp} [DecidablePred pred] (h : is, w i 0pred i) :
(Finset.weightedVSub (Finset.filter pred s) p) w = () w

A weighted sum over s.filter pred equals one over s if all the weights at indices in s not satisfying pred are zero.

theorem Finset.weightedVSub_const_smul {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p : ιP) (c : k) :
() (c w) = c () w

A constant multiplier of the weights in weightedVSub_of may be moved outside the sum.

Equations
def Finset.affineCombination (k : Type u_1) {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (p : ιP) :
(ιk) →ᵃ[k] P

A weighted sum of the results of subtracting a default base point from the given points, added to that base point, as an affine map on the weights. This is intended to be used when the sum of the weights is 1, in which case it is an affine combination (barycenter) of the points with the given weights; that condition is specified as a hypothesis on those lemmas that require it.

Equations
• One or more equations did not get rendered due to their size.
Instances For
@[simp]
theorem Finset.affineCombination_linear (k : Type u_1) {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (p : ιP) :
().linear =

The linear map corresponding to affineCombination is weightedVSub.

theorem Finset.affineCombination_apply {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p : ιP) :
() w = () w +ᵥ

Applying affineCombination with given weights. This is for the case where a result involving a default base point is OK (for example, when that base point will cancel out later); a more typical use case for affineCombination would involve selecting a preferred base point with affineCombination_eq_weightedVSubOfPoint_vadd_of_sum_eq_one and then using weightedVSubOfPoint_apply.

@[simp]
theorem Finset.affineCombination_apply_const {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p : P) (h : (Finset.sum s fun (i : ι) => w i) = 1) :
(Finset.affineCombination k s fun (x : ι) => p) w = p

The value of affineCombination, where the given points are equal.

theorem Finset.affineCombination_congr {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) {w₁ : ιk} {w₂ : ιk} (hw : is, w₁ i = w₂ i) {p₁ : ιP} {p₂ : ιP} (hp : is, p₁ i = p₂ i) :
() w₁ = () w₂

affineCombination gives equal results for two families of weights and two families of points that are equal on s.

theorem Finset.affineCombination_eq_weightedVSubOfPoint_vadd_of_sum_eq_one {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p : ιP) (h : (Finset.sum s fun (i : ι) => w i) = 1) (b : P) :
() w = () w +ᵥ b

affineCombination gives the sum with any base point, when the sum of the weights is 1.

theorem Finset.weightedVSub_vadd_affineCombination {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w₁ : ιk) (w₂ : ιk) (p : ιP) :
() w₁ +ᵥ () w₂ = () (w₁ + w₂)

Adding a weightedVSub to an affineCombination.

theorem Finset.affineCombination_vsub {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w₁ : ιk) (w₂ : ιk) (p : ιP) :
() w₁ -ᵥ () w₂ = () (w₁ - w₂)

Subtracting two affineCombinations.

theorem Finset.attach_affineCombination_of_injective {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] [] (s : ) (w : Pk) (f : { x : P // x s }P) (hf : ) :
() (w f) = (Finset.affineCombination k (Finset.image f Finset.univ) id) w
theorem Finset.attach_affineCombination_coe {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] (s : ) (w : Pk) :
(Finset.affineCombination k () Subtype.val) (w Subtype.val) = () w
@[simp]
theorem Finset.weightedVSub_eq_linear_combination {k : Type u_1} {V : Type u_2} [Ring k] [] [Module k V] {ι : Type u_6} (s : ) {w : ιk} {p : ιV} (hw : = 0) :
() w = Finset.sum s fun (i : ι) => w i p i

Viewing a module as an affine space modelled on itself, a weightedVSub is just a linear combination.

@[simp]
theorem Finset.affineCombination_eq_linear_combination {k : Type u_1} {V : Type u_2} [Ring k] [] [Module k V] {ι : Type u_4} (s : ) (p : ιV) (w : ιk) (hw : (Finset.sum s fun (i : ι) => w i) = 1) :
() w = Finset.sum s fun (i : ι) => w i p i

Viewing a module as an affine space modelled on itself, affine combinations are just linear combinations.

@[simp]
theorem Finset.affineCombination_of_eq_one_of_eq_zero {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p : ιP) {i : ι} (his : i s) (hwi : w i = 1) (hw0 : i2s, i2 iw i2 = 0) :
() w = p i

An affineCombination equals a point if that point is in the set and has weight 1 and the other points in the set have weight 0.

theorem Finset.affineCombination_indicator_subset {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (w : ιk) (p : ιP) {s₁ : } {s₂ : } (h : s₁ s₂) :
() w = () (Set.indicator (s₁) w)

An affine combination is unaffected by changing the weights to the corresponding indicator function and adding points to the set.

theorem Finset.affineCombination_map {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} {ι₂ : Type u_5} (s₂ : Finset ι₂) (e : ι₂ ι) (w : ιk) (p : ιP) :
(Finset.affineCombination k (Finset.map e s₂) p) w = (Finset.affineCombination k s₂ (p e)) (w e)

An affine combination, over the image of an embedding, equals an affine combination with the same points and weights over the original Finset.

theorem Finset.sum_smul_vsub_eq_affineCombination_vsub {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p₁ : ιP) (p₂ : ιP) :
(Finset.sum s fun (i : ι) => w i (p₁ i -ᵥ p₂ i)) = () w -ᵥ () w

A weighted sum of pairwise subtractions, expressed as a subtraction of two affineCombination expressions.

theorem Finset.sum_smul_vsub_const_eq_affineCombination_vsub {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p₁ : ιP) (p₂ : P) (h : (Finset.sum s fun (i : ι) => w i) = 1) :
(Finset.sum s fun (i : ι) => w i (p₁ i -ᵥ p₂)) = () w -ᵥ p₂

A weighted sum of pairwise subtractions, where the point on the right is constant and the sum of the weights is 1.

theorem Finset.sum_smul_const_vsub_eq_vsub_affineCombination {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p₂ : ιP) (p₁ : P) (h : (Finset.sum s fun (i : ι) => w i) = 1) :
(Finset.sum s fun (i : ι) => w i (p₁ -ᵥ p₂ i)) = p₁ -ᵥ () w

A weighted sum of pairwise subtractions, where the point on the left is constant and the sum of the weights is 1.

theorem Finset.affineCombination_sdiff_sub {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) [] {s₂ : } (h : s₂ s) (w : ιk) (p : ιP) :
(Finset.affineCombination k (s \ s₂) p) w -ᵥ () (-w) = () w

A weighted sum may be split into a subtraction of affine combinations over two subsets.

theorem Finset.affineCombination_eq_of_weightedVSub_eq_zero_of_eq_neg_one {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) {w : ιk} {p : ιP} (hw : () w = 0) {i : ι} [DecidablePred fun (x : ι) => x i] (his : i s) (hwi : w i = -1) :
(Finset.affineCombination k (Finset.filter (fun (x : ι) => x i) s) p) w = p i

If a weighted sum is zero and one of the weights is -1, the corresponding point is the affine combination of the other points with the given weights.

theorem Finset.affineCombination_subtype_eq_filter {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p : ιP) (pred : ιProp) [DecidablePred pred] :
((Finset.affineCombination k (Finset.subtype pred s) fun (i : Subtype pred) => p i) fun (i : Subtype pred) => w i) = (Finset.affineCombination k (Finset.filter pred s) p) w

An affine combination over s.subtype pred equals one over s.filter pred.

theorem Finset.affineCombination_filter_of_ne {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) (w : ιk) (p : ιP) {pred : ιProp} [DecidablePred pred] (h : is, w i 0pred i) :

An affine combination over s.filter pred equals one over s if all the weights at indices in s not satisfying pred are zero.

theorem Finset.eq_weightedVSubOfPoint_subset_iff_eq_weightedVSubOfPoint_subtype {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} {v : V} {x : k} {s : Set ι} {p : ιP} {b : P} :
(∃ (fs : ), fs s ∃ (w : ιk), (Finset.sum fs fun (i : ι) => w i) = x v = () w) ∃ (fs : Finset s) (w : sk), (Finset.sum fs fun (i : s) => w i) = x v = (Finset.weightedVSubOfPoint fs (fun (i : s) => p i) b) w

Suppose an indexed family of points is given, along with a subset of the index type. A vector can be expressed as weightedVSubOfPoint using a Finset lying within that subset and with a given sum of weights if and only if it can be expressed as weightedVSubOfPoint with that sum of weights for the corresponding indexed family whose index type is the subtype corresponding to that subset.

theorem Finset.eq_weightedVSub_subset_iff_eq_weightedVSub_subtype (k : Type u_1) {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} {v : V} {s : Set ι} {p : ιP} :
(∃ (fs : ), fs s ∃ (w : ιk), (Finset.sum fs fun (i : ι) => w i) = 0 v = () w) ∃ (fs : Finset s) (w : sk), (Finset.sum fs fun (i : s) => w i) = 0 v = (Finset.weightedVSub fs fun (i : s) => p i) w

Suppose an indexed family of points is given, along with a subset of the index type. A vector can be expressed as weightedVSub using a Finset lying within that subset and with sum of weights 0 if and only if it can be expressed as weightedVSub with sum of weights 0 for the corresponding indexed family whose index type is the subtype corresponding to that subset.

theorem Finset.eq_affineCombination_subset_iff_eq_affineCombination_subtype (k : Type u_1) (V : Type u_2) {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} {p0 : P} {s : Set ι} {p : ιP} :
(∃ (fs : ), fs s ∃ (w : ιk), (Finset.sum fs fun (i : ι) => w i) = 1 p0 = () w) ∃ (fs : Finset s) (w : sk), (Finset.sum fs fun (i : s) => w i) = 1 p0 = (Finset.affineCombination k fs fun (i : s) => p i) w

Suppose an indexed family of points is given, along with a subset of the index type. A point can be expressed as an affineCombination using a Finset lying within that subset and with sum of weights 1 if and only if it can be expressed an affineCombination with sum of weights 1 for the corresponding indexed family whose index type is the subtype corresponding to that subset.

theorem Finset.map_affineCombination {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) {V₂ : Type u_6} {P₂ : Type u_7} [] [Module k V₂] [AddTorsor V₂ P₂] (p : ιP) (w : ιk) (hw : = 1) (f : P →ᵃ[k] P₂) :
f (() w) = (Finset.affineCombination k s (f p)) w

Affine maps commute with affine combinations.

def Finset.affineCombinationSingleWeights (k : Type u_1) [Ring k] {ι : Type u_4} [] (i : ι) :
ιk

Weights for expressing a single point as an affine combination.

Equations
Instances For
@[simp]
theorem Finset.affineCombinationSingleWeights_apply_self (k : Type u_1) [Ring k] {ι : Type u_4} [] (i : ι) :
@[simp]
theorem Finset.affineCombinationSingleWeights_apply_of_ne (k : Type u_1) [Ring k] {ι : Type u_4} [] {i : ι} {j : ι} (h : j i) :
@[simp]
theorem Finset.sum_affineCombinationSingleWeights (k : Type u_1) [Ring k] {ι : Type u_4} (s : ) [] {i : ι} (h : i s) :
(Finset.sum s fun (j : ι) => ) = 1
def Finset.weightedVSubVSubWeights (k : Type u_1) [Ring k] {ι : Type u_4} [] (i : ι) (j : ι) :
ιk

Weights for expressing the subtraction of two points as a weightedVSub.

Equations
Instances For
@[simp]
theorem Finset.weightedVSubVSubWeights_self (k : Type u_1) [Ring k] {ι : Type u_4} [] (i : ι) :
@[simp]
theorem Finset.weightedVSubVSubWeights_apply_left (k : Type u_1) [Ring k] {ι : Type u_4} [] {i : ι} {j : ι} (h : i j) :
= 1
@[simp]
theorem Finset.weightedVSubVSubWeights_apply_right (k : Type u_1) [Ring k] {ι : Type u_4} [] {i : ι} {j : ι} (h : i j) :
= -1
@[simp]
theorem Finset.weightedVSubVSubWeights_apply_of_ne (k : Type u_1) [Ring k] {ι : Type u_4} [] {i : ι} {j : ι} {t : ι} (hi : t i) (hj : t j) :
= 0
@[simp]
theorem Finset.sum_weightedVSubVSubWeights (k : Type u_1) [Ring k] {ι : Type u_4} (s : ) [] {i : ι} {j : ι} (hi : i s) (hj : j s) :
(Finset.sum s fun (t : ι) => ) = 0
def Finset.affineCombinationLineMapWeights {k : Type u_1} [Ring k] {ι : Type u_4} [] (i : ι) (j : ι) (c : k) :
ιk

Weights for expressing lineMap as an affine combination.

Equations
Instances For
@[simp]
theorem Finset.affineCombinationLineMapWeights_self {k : Type u_1} [Ring k] {ι : Type u_4} [] (i : ι) (c : k) :
@[simp]
theorem Finset.affineCombinationLineMapWeights_apply_left {k : Type u_1} [Ring k] {ι : Type u_4} [] {i : ι} {j : ι} (h : i j) (c : k) :
= 1 - c
@[simp]
theorem Finset.affineCombinationLineMapWeights_apply_right {k : Type u_1} [Ring k] {ι : Type u_4} [] {i : ι} {j : ι} (h : i j) (c : k) :
@[simp]
theorem Finset.affineCombinationLineMapWeights_apply_of_ne {k : Type u_1} [Ring k] {ι : Type u_4} [] {i : ι} {j : ι} {t : ι} (hi : t i) (hj : t j) (c : k) :
@[simp]
theorem Finset.sum_affineCombinationLineMapWeights {k : Type u_1} [Ring k] {ι : Type u_4} (s : ) [] {i : ι} {j : ι} (hi : i s) (hj : j s) (c : k) :
(Finset.sum s fun (t : ι) => ) = 1
@[simp]
theorem Finset.affineCombination_affineCombinationSingleWeights (k : Type u_1) {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) [] (p : ιP) {i : ι} (hi : i s) :
= p i

An affine combination with affineCombinationSingleWeights gives the specified point.

@[simp]
theorem Finset.weightedVSub_weightedVSubVSubWeights (k : Type u_1) {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) [] (p : ιP) {i : ι} {j : ι} (hi : i s) (hj : j s) :
() () = p i -ᵥ p j

A weighted subtraction with weightedVSubVSubWeights gives the result of subtracting the specified points.

@[simp]
theorem Finset.affineCombination_affineCombinationLineMapWeights {k : Type u_1} {V : Type u_2} {P : Type u_3} [Ring k] [] [Module k V] [S : ] {ι : Type u_4} (s : ) [] (p : ιP) {i : ι} {j : ι} (hi : i s) (hj : j s) (c : k) :
() = (AffineMap.lineMap (p i) (p j)) c

An affine combination with affineCombinationLineMapWeights gives the result of line_map.

def Finset.centroidWeights (k : Type u_1) [] {ι : Type u_4} (s : ) :
ιk

The weights for the centroid of some points.

Equations
Instances For
@[simp]
theorem Finset.centroidWeights_apply (k : Type u_1) [] {ι : Type u_4} (s : ) (i : ι) :
= (s.card)⁻¹

centroidWeights at any point.

theorem Finset.centroidWeights_eq_const (k : Type u_1) [] {ι : Type u_4} (s : ) :
= Function.const ι (s.card)⁻¹

centroidWeights equals a constant function.

theorem Finset.sum_centroidWeights_eq_one_of_cast_card_ne_zero {k : Type u_1} [] {ι : Type u_4} (s : ) (h : s.card 0) :
(Finset.sum s fun (i : ι) => ) = 1

The weights in the centroid sum to 1, if the number of points, converted to k, is not zero.

theorem Finset.sum_centroidWeights_eq_one_of_card_ne_zero (k : Type u_1) [] {ι : Type u_4} (s : ) [] (h : s.card 0) :
(Finset.sum s fun (i : ι) => ) = 1

In the characteristic zero case, the weights in the centroid sum to 1 if the number of points is not zero.

theorem Finset.sum_centroidWeights_eq_one_of_nonempty (k : Type u_1) [] {ι : Type u_4} (s : ) [] (h : s.Nonempty) :
(Finset.sum s fun (i : ι) => ) = 1

In the characteristic zero case, the weights in the centroid sum to 1 if the set is nonempty.

theorem Finset.sum_centroidWeights_eq_one_of_card_eq_add_one (k : Type u_1) [] {ι : Type u_4} (s : ) [] {n : } (h : s.card = n + 1) :
(Finset.sum s fun (i : ι) => ) = 1

In the characteristic zero case, the weights in the centroid sum to 1 if the number of points is n + 1.

def Finset.centroid (k : Type u_1) {V : Type u_2} {P : Type u_3} [] [] [Module k V] [] {ι : Type u_4} (s : ) (p : ιP) :
P

The centroid of some points. Although defined for any s, this is intended to be used in the case where the number of points, converted to k, is not zero.

Equations
• = () ()
Instances For
theorem Finset.centroid_def (k : Type u_1) {V : Type u_2} {P : Type u_3} [] [] [Module k V] [] {ι : Type u_4} (s : ) (p : ιP) :
= () ()

The definition of the centroid.

theorem Finset.centroid_univ (k : Type u_1) {V : Type u_2} {P : Type u_3} [] [] [Module k V] [] (s : ) :
Finset.centroid k Finset.univ Subtype.val = Finset.centroid k s id
@[simp]
theorem Finset.centroid_singleton (k : Type u_1) {V : Type u_2} {P : Type u_3} [] [] [Module k V] [] {ι : Type u_4} (p : ιP) (i : ι) :
Finset.centroid k {i} p = p i

The centroid of a single point.

theorem Finset.centroid_pair (k : Type u_1) {V : Type u_2} {P : Type u_3} [] [] [Module k V] [] {ι : Type u_4} [] [] (p : ιP) (i₁ : ι) (i₂ : ι) :
Finset.centroid k {i₁, i₂} p = 2⁻¹ (p i₂ -ᵥ p i₁) +ᵥ p i₁

The centroid of two points, expressed directly as adding a vector to a point.

theorem Finset.centroid_pair_fin (k : Type u_1) {V : Type u_2} {P : Type u_3} [] [] [Module k V] [] [] (p : Fin 2P) :
Finset.centroid k Finset.univ p = 2⁻¹ (p 1 -ᵥ p 0) +ᵥ p 0

The centroid of two points indexed by Fin 2, expressed directly as adding a vector to the first point.

theorem Finset.centroid_map (k : Type u_1) {V : Type u_2} {P : Type u_3} [] [] [Module k V] [] {ι : Type u_4} {ι₂ : Type u_5} (s₂ : Finset ι₂) (e : ι₂ ι) (p : ιP) :
Finset.centroid k (Finset.map e s₂) p = Finset.centroid k s₂ (p e)

A centroid, over the image of an embedding, equals a centroid with the same points and weights over the original Finset.

def Finset.centroidWeightsIndicator (k : Type u_1) [] {ι : Type u_4} (s : ) :
ιk

centroidWeights gives the weights for the centroid as a constant function, which is suitable when summing over the points whose centroid is being taken. This function gives the weights in a form suitable for summing over a larger set of points, as an indicator function that is zero outside the set whose centroid is being taken. In the case of a Fintype, the sum may be over univ.

Equations
Instances For
theorem Finset.centroidWeightsIndicator_def (k : Type u_1) [] {ι : Type u_4} (s : ) :

The definition of centroidWeightsIndicator.

theorem Finset.sum_centroidWeightsIndicator (k : Type u_1) [] {ι : Type u_4} (s : ) [] :
(Finset.sum Finset.univ fun (i : ι) => ) = Finset.sum s fun (i : ι) =>

The sum of the weights for the centroid indexed by a Fintype.

theorem Finset.sum_centroidWeightsIndicator_eq_one_of_card_ne_zero (k : Type u_1) [] {ι : Type u_4} (s : ) [] [] (h : s.card 0) :
(Finset.sum Finset.univ fun (i : ι) => ) = 1

In the characteristic zero case, the weights in the centroid indexed by a Fintype sum to 1 if the number of points is not zero.

theorem Finset.sum_centroidWeightsIndicator_eq_one_of_nonempty (k : Type u_1) [] {ι : Type u_4} (s : ) [] [] (h : s.Nonempty) :
(Finset.sum Finset.univ fun (i : ι) => ) = 1

In the characteristic zero case, the weights in the centroid indexed by a Fintype sum to 1 if the set is nonempty.

theorem Finset.sum_centroidWeightsIndicator_eq_one_of_card_eq_add_one (k : Type u_1) [] {ι : Type u_4} (s : ) [] [] {n : } (h : s.card = n + 1) :
(Finset.sum Finset.univ fun (i : ι) => ) = 1

In the characteristic zero case, the weights in the centroid indexed by a Fintype sum to 1 if the number of points is n + 1.

theorem Finset.centroid_eq_affineCombination_fintype (k : Type u_1) {V : Type u_2} {P : Type u_3} [] [] [Module k V] [] {ι : Type u_4} (s : ) [] (p : ιP) :
= (Finset.affineCombination k Finset.univ p)

The centroid as an affine combination over a Fintype.

theorem Finset.centroid_eq_centroid_image_of_inj_on (k : Type u_1) {V : Type u_2} {P : Type u_3} [] [] [Module k V] [] {ι : Type u_4} (s : ) {p : ιP} (hi : is, js, p i = p ji = j) {ps : Set P} [Fintype ps] (hps : ps = p '' s) :
= Finset.centroid k Finset.univ fun (x : ps) => x

An indexed family of points that is injective on the given Finset has the same centroid as the image of that Finset. This is stated in terms of a set equal to the image to provide control of definitional equality for the index type used for the centroid of the image.

theorem Finset.centroid_eq_of_inj_on_of_image_eq (k : Type u_1) {V : Type u_2} {P : Type u_3} [] [] [Module k V] [] {ι : Type u_4} (s : ) {ι₂ : Type u_5} (s₂ : Finset ι₂) {p : ιP} (hi : is, js, p i = p ji = j) {p₂ : ι₂P} (hi₂ : is₂, js₂, p₂ i = p₂ ji = j) (he : p '' s = p₂ '' s₂) :
= Finset.centroid k s₂ p₂

Two indexed families of points that are injective on the given Finsets and with the same points in the image of those Finsets have the same centroid.

theorem weightedVSub_mem_vectorSpan {ι : Type u_1} {k : Type u_2} {V : Type u_3} {P : Type u_4} [Ring k] [] [Module k V] [] {s : } {w : ιk} (h : (Finset.sum s fun (i : ι) => w i) = 0) (p : ιP) :
() w vectorSpan k ()

A weightedVSub with sum of weights 0 is in the vectorSpan of an indexed family.

theorem affineCombination_mem_affineSpan {ι : Type u_1} {k : Type u_2} {V : Type u_3} {P : Type u_4} [Ring k] [] [Module k V] [] [] {s : } {w : ιk} (h : (Finset.sum s fun (i : ι) => w i) = 1) (p : ιP) :
() w affineSpan k ()

An affineCombination with sum of weights 1 is in the affineSpan of an indexed family, if the underlying ring is nontrivial.

theorem mem_vectorSpan_iff_eq_weightedVSub {ι : Type u_1} (k : Type u_2) {V : Type u_3} {P : Type u_4} [Ring k] [] [Module k V] [] {v : V} {p : ιP} :
v vectorSpan k () ∃ (s : ) (w : ιk), (Finset.sum s fun (i : ι) => w i) = 0 v = () w

A vector is in the vectorSpan of an indexed family if and only if it is a weightedVSub with sum of weights 0.

theorem eq_affineCombination_of_mem_affineSpan {ι : Type u_1} {k : Type u_2} {V : Type u_3} {P : Type u_4} [Ring k] [] [Module k V] [] {p1 : P} {p : ιP} (h : p1 affineSpan k ()) :
∃ (s : ) (w : ιk), (Finset.sum s fun (i : ι) => w i) = 1 p1 = () w

A point in the affineSpan of an indexed family is an affineCombination with sum of weights 1. See also eq_affineCombination_of_mem_affineSpan_of_fintype.

theorem eq_affineCombination_of_mem_affineSpan_of_fintype {ι : Type u_1} {k : Type u_2} {V : Type u_3} {P : Type u_4} [Ring k] [] [Module k V] [] [] {p1 : P} {p : ιP} (h : p1 affineSpan k ()) :
∃ (w : ιk), (Finset.sum Finset.univ fun (i : ι) => w i) = 1 p1 = (Finset.affineCombination k Finset.univ p) w
theorem mem_affineSpan_iff_eq_affineCombination {ι : Type u_1} (k : Type u_2) (V : Type u_3) {P : Type u_4} [Ring k] [] [Module k V] [] [] {p1 : P} {p : ιP} :
p1 affineSpan k () ∃ (s : ) (w : ιk), (Finset.sum s fun (i : ι) => w i) = 1 p1 = () w

A point is in the affineSpan of an indexed family if and only if it is an affineCombination with sum of weights 1, provided the underlying ring is nontrivial.

theorem mem_affineSpan_iff_eq_weightedVSubOfPoint_vadd {ι : Type u_1} (k : Type u_2) (V : Type u_3) {P : Type u_4} [Ring k] [] [Module k V] [] [] (p : ιP) (j : ι) (q : P) :
q affineSpan k () ∃ (s : ) (w : ιk), q = (Finset.weightedVSubOfPoint s p (p j)) w +ᵥ p j

Given a family of points together with a chosen base point in that family, membership of the affine span of this family corresponds to an identity in terms of weightedVSubOfPoint, with weights that are not required to sum to 1.

theorem affineSpan_eq_affineSpan_lineMap_units {k : Type u_2} {V : Type u_3} {P : Type u_4} [Ring k] [] [Module k V] [] [] {s : Set P} {p : P} (hp : p s) (w : skˣ) :
affineSpan k (Set.range fun (q : s) => () (w q)) =

Given a set of points, together with a chosen base point in this set, if we affinely transport all other members of the set along the line joining them to this base point, the affine span is unchanged.

theorem centroid_mem_affineSpan_of_cast_card_ne_zero {k : Type u_1} {V : Type u_2} {P : Type u_3} [] [] [Module k V] [] {ι : Type u_4} {s : } (p : ιP) (h : s.card 0) :

The centroid lies in the affine span if the number of points, converted to k, is not zero.

theorem centroid_mem_affineSpan_of_card_ne_zero (k : Type u_1) {V : Type u_2} {P : Type u_3} [] [] [Module k V] [] {ι : Type u_4} [] {s : } (p : ιP) (h : s.card 0) :

In the characteristic zero case, the centroid lies in the affine span if the number of points is not zero.

theorem centroid_mem_affineSpan_of_nonempty (k : Type u_1) {V : Type u_2} {P : Type u_3} [] [] [Module k V] [] {ι : Type u_4} [] {s : } (p : ιP) (h : s.Nonempty) :

In the characteristic zero case, the centroid lies in the affine span if the set is nonempty.

theorem centroid_mem_affineSpan_of_card_eq_add_one (k : Type u_1) {V : Type u_2} {P : Type u_3} [] [] [Module k V] [] {ι : Type u_4} [] {s : } (p : ιP) {n : } (h : s.card = n + 1) :

In the characteristic zero case, the centroid lies in the affine span if the number of points is n + 1.

def AffineMap.weightedVSubOfPoint {k : Type u_1} {V : Type u_2} (P : Type u_3) [] [] [Module k V] [] {ι : Type u_4} (s : ) (w : ιk) :
(ιP) × P →ᵃ[k] V

A weighted sum, as an affine map on the points involved.

Equations
• One or more equations did not get rendered due to their size.
Instances For