Skip to content

Commit 28539d1

Browse files
committed
feat(LinearAlgebra/AffineSpace/AffineSubspace/Basic): parallel lines in triples of points (#31712)
Add a lemma that, given two triples of points, if the lines determined by corresponding pairs of points are parallel, then the vectors between corresponding pairs of points are all related by the same nonzero scale factor (with certain degenerate cases excluded and some hypotheses made weaker than "parallel" to make it more convenient to use in some cases without needing to exclude other impossible degenerate cases at the site of use).
1 parent b26203f commit 28539d1

File tree

1 file changed

+49
-0
lines changed
  • Mathlib/LinearAlgebra/AffineSpace/AffineSubspace

1 file changed

+49
-0
lines changed

Mathlib/LinearAlgebra/AffineSpace/AffineSubspace/Basic.lean

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,10 +851,27 @@ theorem affineSpan_pair_parallel_iff_vectorSpan_eq {p₁ p₂ p₃ p₄ : P} :
851851
simp [affineSpan_parallel_iff_vectorSpan_eq_and_eq_empty_iff_eq_empty, ←
852852
not_nonempty_iff_eq_empty]
853853

854+
lemma affineSpan_pair_parallel_iff_exists_unit_smul' [NoZeroSMulDivisors k V] {p₁ q₁ p₂ q₂ : P} :
855+
line[k, p₁, q₁] ∥ line[k, p₂, q₂] ↔ ∃ z : kˣ, z • (q₁ -ᵥ p₁) = q₂ -ᵥ p₂ := by
856+
rw [AffineSubspace.affineSpan_pair_parallel_iff_vectorSpan_eq, vectorSpan_pair_rev,
857+
vectorSpan_pair_rev, Submodule.span_singleton_eq_span_singleton]
858+
859+
lemma affineSpan_pair_parallel_iff_exists_unit_smul [NoZeroSMulDivisors k V] {p₁ q₁ p₂ q₂ : P} :
860+
line[k, p₁, q₁] ∥ line[k, p₂, q₂] ↔ ∃ z : kˣ, z • (q₂ -ᵥ p₂) = q₁ -ᵥ p₁ := by
861+
rw [affineSpan_pair_parallel_iff_exists_unit_smul']
862+
exact ⟨fun ⟨z, hz⟩ ↦ ⟨z⁻¹, by simp [← hz]⟩, fun ⟨z, hz⟩ ↦ ⟨z⁻¹, by simp [← hz]⟩⟩
863+
864+
lemma direction_affineSpan_pair_le_iff_exists_smul {p₁ q₁ p₂ q₂ : P} :
865+
line[k, p₁, q₁].direction ≤ line[k, p₂, q₂].direction ↔ ∃ z : k, z • (q₂ -ᵥ p₂) = q₁ -ᵥ p₁ := by
866+
rw [direction_affineSpan, direction_affineSpan, vectorSpan_pair_rev, vectorSpan_pair_rev,
867+
Submodule.span_singleton_le_iff_mem, Submodule.mem_span_singleton]
868+
854869
end AffineSubspace
855870

856871
section DivisionRing
857872

873+
open AffineSubspace
874+
858875
variable {k V P : Type*} [DivisionRing k] [AddCommGroup V] [Module k V] [AffineSpace V P]
859876

860877
/-- The span of two different points that lie in a line through two points equals that line. -/
@@ -891,4 +908,36 @@ lemma affineSpan_pair_eq_of_right_mem_of_ne {p₁ p₂ p₃ : P} (h : p₁ ∈ l
891908
line[k, p₂, p₁] = line[k, p₂, p₃] :=
892909
affineSpan_pair_eq_of_mem_of_mem_of_ne (left_mem_affineSpan_pair _ _ _) h hne.symm
893910

911+
/-- Given two triples of non-collinear points, if the lines determined by corresponding pairs of
912+
points are parallel, then the vectors between corresponding pairs of points are all related by the
913+
same nonzero scale factor. (The formal statement is slightly more general.) -/
914+
theorem exists_eq_smul_of_parallel {p₁ p₂ p₃ p₄ p₅ p₆ : P} (h₂ : p₂ ∉ line[k, p₁, p₃])
915+
(h₁₂₄₅ : line[k, p₁, p₂] ∥ line[k, p₄, p₅])
916+
(h₂₃₅₆ : line[k, p₅, p₆].direction ≤ line[k, p₂, p₃].direction)
917+
(h₃₁₆₄ : line[k, p₆, p₄].direction ≤ line[k, p₃, p₁].direction) :
918+
∃ r : k, r ≠ 0 ∧ p₅ -ᵥ p₄ = r • (p₂ -ᵥ p₁) ∧ p₆ -ᵥ p₅ = r • (p₃ -ᵥ p₂) ∧
919+
p₄ -ᵥ p₆ = r • (p₁ -ᵥ p₃) := by
920+
rw [affineSpan_pair_parallel_iff_exists_unit_smul'] at h₁₂₄₅
921+
rw [direction_affineSpan_pair_le_iff_exists_smul] at h₂₃₅₆ h₃₁₆₄
922+
obtain ⟨r₁, hr₁⟩ := h₁₂₄₅
923+
obtain ⟨r₂, hr₂⟩ := h₂₃₅₆
924+
obtain ⟨r₃, hr₃⟩ := h₃₁₆₄
925+
rw [Units.smul_def] at hr₁
926+
by_cases h : (r₁ : k) = r₂
927+
· refine ⟨r₁, r₁.ne_zero, hr₁.symm, h ▸ hr₂.symm, ?_⟩
928+
rw [← neg_inj, neg_vsub_eq_vsub_rev, ← smul_neg, neg_vsub_eq_vsub_rev,
929+
← vsub_add_vsub_cancel p₆ p₅ p₄, ← vsub_add_vsub_cancel p₃ p₂ p₁, smul_add, hr₁, h, hr₂]
930+
· exfalso
931+
have h₁₂ : (r₁ : k) • (p₂ -ᵥ p₁) + r₂ • (p₃ -ᵥ p₂) ∈ vectorSpan k {p₁, p₃} := by
932+
rw [hr₁, hr₂, add_comm, vsub_add_vsub_cancel, ← neg_vsub_eq_vsub_rev, neg_mem_iff, ← hr₃]
933+
exact smul_vsub_mem_vectorSpan_pair _ _ _
934+
have h₁₁ : (r₁ : k) • (p₂ -ᵥ p₁) + (r₁ : k) • (p₃ -ᵥ p₂) ∈ vectorSpan k {p₁, p₃} := by
935+
rw [add_comm, ← smul_add, vsub_add_vsub_cancel]
936+
exact smul_vsub_rev_mem_vectorSpan_pair _ _ _
937+
have h₂₁ : (r₂ - r₁) • (p₃ -ᵥ p₂) ∈ vectorSpan k {p₁, p₃} := by
938+
simpa [sub_smul] using sub_mem h₁₂ h₁₁
939+
rw [Submodule.smul_mem_iff _ (by rwa [sub_ne_zero, ne_comm]), ← direction_affineSpan,
940+
vsub_left_mem_direction_iff_mem (right_mem_affineSpan_pair _ _ _)] at h₂₁
941+
exact h₂ h₂₁
942+
894943
end DivisionRing

0 commit comments

Comments
 (0)