@@ -514,6 +514,82 @@ theorem AffineIndependent.notMem_affineSpan_diff [Nontrivial k] {p : ι → P}
514514@ [deprecated (since := "2025-05-23" )]
515515alias AffineIndependent.not_mem_affineSpan_diff := AffineIndependent.notMem_affineSpan_diff
516516
517+ lemma AffineIndependent.injective_affineSpan_image [Nontrivial k] {p : ι → P}
518+ (ha : AffineIndependent k p) : Injective fun (s : Set ι) ↦ affineSpan k (p '' s) := by
519+ by_contra hn
520+ rw [not_injective_iff] at hn
521+ obtain ⟨s₁, s₂, hs₁₂, hne⟩ := hn
522+ apply hne
523+ ext i
524+ simp_rw [← ha.mem_affineSpan_iff, hs₁₂]
525+
526+ /-- An auxiliary lemma for the proof of `AffineIndependent.vectorSpan_image_eq_iff`. -/
527+ private lemma AffineIndependent.vectorSpan_image_ne_of_mem_of_notMem_of_not_subsingleton
528+ [Nontrivial k] {p : ι → P} (ha : AffineIndependent k p) {s₁ s₂ : Set ι} {i : ι}
529+ (his₁ : i ∈ s₁) (his₂ : i ∉ s₂) (h₁ : ¬s₁.Subsingleton) :
530+ vectorSpan k (p '' s₁) ≠ vectorSpan k (p '' s₂) := by
531+ classical
532+ rw [Set.not_subsingleton_iff] at h₁
533+ obtain ⟨j, hj, hne⟩ := h₁.exists_ne i
534+ intro he
535+ have hs : p i -ᵥ p j ∈ vectorSpan k (p '' s₁) :=
536+ vsub_mem_vectorSpan k (Set.mem_image_of_mem _ his₁) (Set.mem_image_of_mem _ hj)
537+ rw [he, Set.image_eq_range, mem_vectorSpan_iff_eq_weightedVSub] at hs
538+ obtain ⟨fs, w, hw, hs⟩ := hs
539+ let w' : ι → k := Function.extend Subtype.val w 0
540+ have hw' : ∑ t ∈ fs.map (Embedding.subtype _), w' t = 0 := by
541+ simp only [sum_map, Embedding.subtype_apply, ← hw]
542+ exact sum_congr rfl fun t ht ↦ by simp [w']
543+ have hs' : p i -ᵥ p j = (fs.map (Embedding.subtype _)).weightedVSub p w' := by
544+ rw [hs, weightedVSub_map]
545+ simp only [Embedding.coe_subtype, Subtype.val_injective, extend_comp, w']
546+ rfl
547+ let fs' : Finset ι := insert i (insert j (fs.map (Embedding.subtype _)))
548+ have hfsfs' : fs.map (Embedding.subtype _) ⊆ fs' := by grind
549+ let w'' : ι → k := Set.indicator (fs.map (Embedding.subtype _)) w'
550+ have hs'' : p i -ᵥ p j = fs'.weightedVSub p w'' := by
551+ rw [hs']
552+ exact weightedVSubOfPoint_indicator_subset _ _ _ (by grind)
553+ have hw'' : ∑ t ∈ fs', w'' t = 0 := by
554+ rw [← hw']
555+ exact sum_indicator_subset _ (by grind)
556+ let w''' : ι → k := w'' - weightedVSubVSubWeights k i j
557+ have hi : i ∈ fs' := by grind
558+ have hj : j ∈ fs' := by grind
559+ have hw''' : ∑ t ∈ fs', w''' t = 0 := by
560+ simp [w''', sum_sub_distrib, hw'', hi, hj]
561+ have hs''' : fs'.weightedVSub p w''' = 0 := by
562+ simp [w''', ← hs'', hi, hj]
563+ have h0 := ha fs' w''' hw''' hs''' i hi
564+ simp [w''', w'', Pi.sub_apply, hne.symm, his₂] at h0
565+
566+ lemma AffineIndependent.vectorSpan_image_eq_iff [Nontrivial k] {p : ι → P}
567+ (ha : AffineIndependent k p) {s₁ s₂ : Set ι} :
568+ vectorSpan k (p '' s₁) = vectorSpan k (p '' s₂) ↔
569+ s₁ = s₂ ∨ s₁.Subsingleton ∧ s₂.Subsingleton := by
570+ constructor
571+ · intro h
572+ by_cases he : s₁ = s₂
573+ · simp [he]
574+ simp only [he, false_or]
575+ by_cases h₁ : s₁.Subsingleton
576+ · rw [vectorSpan_of_subsingleton _ (h₁.image _), eq_comm, vectorSpan_eq_bot_iff_subsingleton]
577+ at h
578+ exact ⟨h₁, Set.subsingleton_of_image ha.injective s₂ h⟩
579+ by_cases h₂ : s₂.Subsingleton
580+ · rw [vectorSpan_of_subsingleton _ (h₂.image _), vectorSpan_eq_bot_iff_subsingleton]
581+ at h
582+ exact ⟨Set.subsingleton_of_image ha.injective s₁ h, h₂⟩
583+ simp only [h₁, h₂, false_and]
584+ have hi : (∃ i ∈ s₁, i ∉ s₂) ∨ ∃ i ∈ s₂, i ∉ s₁ := by grind
585+ rcases hi with ⟨i, his₁, his₂⟩ | ⟨i, his₂, his₁⟩
586+ · exact ha.vectorSpan_image_ne_of_mem_of_notMem_of_not_subsingleton his₁ his₂ h₁ h
587+ · exact ha.vectorSpan_image_ne_of_mem_of_notMem_of_not_subsingleton his₂ his₁ h₂ h.symm
588+ · intro h
589+ rcases h with rfl | ⟨h₁, h₂⟩
590+ · rfl
591+ · simp [h₁.image p, h₂.image p, vectorSpan_of_subsingleton]
592+
517593theorem exists_nontrivial_relation_sum_zero_of_not_affine_ind {t : Finset V}
518594 (h : ¬AffineIndependent k ((↑) : t → V)) :
519595 ∃ f : V → k, ∑ e ∈ t, f e • e = 0 ∧ ∑ e ∈ t, f e = 0 ∧ ∃ x ∈ t, f x ≠ 0 := by
0 commit comments