Skip to content

Commit 20811cf

Browse files
committed
chore: split Mathlib.Algebra.AddTorsor into Defs/Basic (#22310)
Preliminary to splitting the long file `Mathlib.LinearAlgebra.AffineSpace.AffineSubspace`.
1 parent 12e9e6d commit 20811cf

File tree

20 files changed

+293
-270
lines changed

20 files changed

+293
-270
lines changed

Mathlib.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import Std
22
import Batteries
33
import Mathlib.Algebra.AddConstMap.Basic
44
import Mathlib.Algebra.AddConstMap.Equiv
5-
import Mathlib.Algebra.AddTorsor
5+
import Mathlib.Algebra.AddTorsor.Basic
6+
import Mathlib.Algebra.AddTorsor.Defs
67
import Mathlib.Algebra.Algebra.Basic
78
import Mathlib.Algebra.Algebra.Bilinear
89
import Mathlib.Algebra.Algebra.Defs
Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
/-
2+
Copyright (c) 2020 Joseph Myers. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Joseph Myers, Yury Kudryashov
5+
-/
6+
import Mathlib.Algebra.AddTorsor.Defs
7+
import Mathlib.Algebra.Group.Action.Basic
8+
import Mathlib.Algebra.Group.End
9+
import Mathlib.Algebra.Group.Pointwise.Set.Basic
10+
11+
/-!
12+
# Torsors of additive group actions
13+
14+
Further results for torsors, that are not in `Mathlib.Algebra.AddTorsor.Defs` to avoid increasing
15+
imports there.
16+
-/
17+
18+
open scoped Pointwise
19+
20+
21+
section General
22+
23+
variable {G : Type*} {P : Type*} [AddGroup G] [T : AddTorsor G P]
24+
25+
namespace Set
26+
27+
theorem singleton_vsub_self (p : P) : ({p} : Set P) -ᵥ {p} = {(0 : G)} := by
28+
rw [Set.singleton_vsub_singleton, vsub_self]
29+
30+
end Set
31+
32+
/-- If the same point subtracted from two points produces equal
33+
results, those points are equal. -/
34+
theorem vsub_left_cancel {p₁ p₂ p : P} (h : p₁ -ᵥ p = p₂ -ᵥ p) : p₁ = p₂ := by
35+
rwa [← sub_eq_zero, vsub_sub_vsub_cancel_right, vsub_eq_zero_iff_eq] at h
36+
37+
/-- The same point subtracted from two points produces equal results
38+
if and only if those points are equal. -/
39+
@[simp]
40+
theorem vsub_left_cancel_iff {p₁ p₂ p : P} : p₁ -ᵥ p = p₂ -ᵥ p ↔ p₁ = p₂ :=
41+
⟨vsub_left_cancel, fun h => h ▸ rfl⟩
42+
43+
/-- Subtracting the point `p` is an injective function. -/
44+
theorem vsub_left_injective (p : P) : Function.Injective ((· -ᵥ p) : P → G) := fun _ _ =>
45+
vsub_left_cancel
46+
47+
/-- If subtracting two points from the same point produces equal
48+
results, those points are equal. -/
49+
theorem vsub_right_cancel {p₁ p₂ p : P} (h : p -ᵥ p₁ = p -ᵥ p₂) : p₁ = p₂ := by
50+
refine vadd_left_cancel (p -ᵥ p₂) ?_
51+
rw [vsub_vadd, ← h, vsub_vadd]
52+
53+
/-- Subtracting two points from the same point produces equal results
54+
if and only if those points are equal. -/
55+
@[simp]
56+
theorem vsub_right_cancel_iff {p₁ p₂ p : P} : p -ᵥ p₁ = p -ᵥ p₂ ↔ p₁ = p₂ :=
57+
⟨vsub_right_cancel, fun h => h ▸ rfl⟩
58+
59+
/-- Subtracting a point from the point `p` is an injective
60+
function. -/
61+
theorem vsub_right_injective (p : P) : Function.Injective ((p -ᵥ ·) : P → G) := fun _ _ =>
62+
vsub_right_cancel
63+
64+
end General
65+
66+
section comm
67+
68+
variable {G : Type*} {P : Type*} [AddCommGroup G] [AddTorsor G P]
69+
70+
/-- Cancellation subtracting the results of two subtractions. -/
71+
@[simp]
72+
theorem vsub_sub_vsub_cancel_left (p₁ p₂ p₃ : P) : p₃ -ᵥ p₂ - (p₃ -ᵥ p₁) = p₁ -ᵥ p₂ := by
73+
rw [sub_eq_add_neg, neg_vsub_eq_vsub_rev, add_comm, vsub_add_vsub_cancel]
74+
75+
@[simp]
76+
theorem vadd_vsub_vadd_cancel_left (v : G) (p₁ p₂ : P) : (v +ᵥ p₁) -ᵥ (v +ᵥ p₂) = p₁ -ᵥ p₂ := by
77+
rw [vsub_vadd_eq_vsub_sub, vadd_vsub_assoc, add_sub_cancel_left]
78+
79+
theorem vsub_vadd_comm (p₁ p₂ p₃ : P) : (p₁ -ᵥ p₂ : G) +ᵥ p₃ = (p₃ -ᵥ p₂) +ᵥ p₁ := by
80+
rw [← @vsub_eq_zero_iff_eq G, vadd_vsub_assoc, vsub_vadd_eq_vsub_sub]
81+
simp
82+
83+
theorem vadd_eq_vadd_iff_sub_eq_vsub {v₁ v₂ : G} {p₁ p₂ : P} :
84+
v₁ +ᵥ p₁ = v₂ +ᵥ p₂ ↔ v₂ - v₁ = p₁ -ᵥ p₂ := by
85+
rw [vadd_eq_vadd_iff_neg_add_eq_vsub, neg_add_eq_sub]
86+
87+
theorem vsub_sub_vsub_comm (p₁ p₂ p₃ p₄ : P) : p₁ -ᵥ p₂ - (p₃ -ᵥ p₄) = p₁ -ᵥ p₃ - (p₂ -ᵥ p₄) := by
88+
rw [← vsub_vadd_eq_vsub_sub, vsub_vadd_comm, vsub_vadd_eq_vsub_sub]
89+
90+
namespace Set
91+
92+
@[simp] lemma vadd_set_vsub_vadd_set (v : G) (s t : Set P) : (v +ᵥ s) -ᵥ (v +ᵥ t) = s -ᵥ t := by
93+
ext; simp [mem_vsub, mem_vadd_set]
94+
95+
end Set
96+
97+
end comm
98+
99+
namespace Prod
100+
101+
variable {G G' P P' : Type*} [AddGroup G] [AddGroup G'] [AddTorsor G P] [AddTorsor G' P']
102+
103+
instance instAddTorsor : AddTorsor (G × G') (P × P') where
104+
vadd v p := (v.1 +ᵥ p.1, v.2 +ᵥ p.2)
105+
zero_vadd _ := Prod.ext (zero_vadd _ _) (zero_vadd _ _)
106+
add_vadd _ _ _ := Prod.ext (add_vadd _ _ _) (add_vadd _ _ _)
107+
vsub p₁ p₂ := (p₁.1 -ᵥ p₂.1, p₁.2 -ᵥ p₂.2)
108+
vsub_vadd' _ _ := Prod.ext (vsub_vadd _ _) (vsub_vadd _ _)
109+
vadd_vsub' _ _ := Prod.ext (vadd_vsub _ _) (vadd_vsub _ _)
110+
111+
@[simp]
112+
theorem fst_vadd (v : G × G') (p : P × P') : (v +ᵥ p).1 = v.1 +ᵥ p.1 :=
113+
rfl
114+
115+
@[simp]
116+
theorem snd_vadd (v : G × G') (p : P × P') : (v +ᵥ p).2 = v.2 +ᵥ p.2 :=
117+
rfl
118+
119+
@[simp]
120+
theorem mk_vadd_mk (v : G) (v' : G') (p : P) (p' : P') : (v, v') +ᵥ (p, p') = (v +ᵥ p, v' +ᵥ p') :=
121+
rfl
122+
123+
@[simp]
124+
theorem fst_vsub (p₁ p₂ : P × P') : (p₁ -ᵥ p₂ : G × G').1 = p₁.1 -ᵥ p₂.1 :=
125+
rfl
126+
127+
@[simp]
128+
theorem snd_vsub (p₁ p₂ : P × P') : (p₁ -ᵥ p₂ : G × G').2 = p₁.2 -ᵥ p₂.2 :=
129+
rfl
130+
131+
@[simp]
132+
theorem mk_vsub_mk (p₁ p₂ : P) (p₁' p₂' : P') :
133+
((p₁, p₁') -ᵥ (p₂, p₂') : G × G') = (p₁ -ᵥ p₂, p₁' -ᵥ p₂') :=
134+
rfl
135+
136+
end Prod
137+
138+
namespace Pi
139+
140+
universe u v w
141+
142+
variable {I : Type u} {fg : I → Type v} [∀ i, AddGroup (fg i)] {fp : I → Type w}
143+
144+
open AddAction AddTorsor
145+
146+
/-- A product of `AddTorsor`s is an `AddTorsor`. -/
147+
instance instAddTorsor [∀ i, AddTorsor (fg i) (fp i)] : AddTorsor (∀ i, fg i) (∀ i, fp i) where
148+
vadd g p i := g i +ᵥ p i
149+
zero_vadd p := funext fun i => zero_vadd (fg i) (p i)
150+
add_vadd g₁ g₂ p := funext fun i => add_vadd (g₁ i) (g₂ i) (p i)
151+
vsub p₁ p₂ i := p₁ i -ᵥ p₂ i
152+
vsub_vadd' p₁ p₂ := funext fun i => vsub_vadd (p₁ i) (p₂ i)
153+
vadd_vsub' g p := funext fun i => vadd_vsub (g i) (p i)
154+
155+
end Pi
156+
157+
namespace Equiv
158+
159+
variable (G : Type*) (P : Type*) [AddGroup G] [AddTorsor G P]
160+
161+
@[simp]
162+
theorem constVAdd_zero : constVAdd P (0 : G) = 1 :=
163+
ext <| zero_vadd G
164+
165+
variable {G}
166+
167+
@[simp]
168+
theorem constVAdd_add (v₁ v₂ : G) : constVAdd P (v₁ + v₂) = constVAdd P v₁ * constVAdd P v₂ :=
169+
ext <| add_vadd v₁ v₂
170+
171+
/-- `Equiv.constVAdd` as a homomorphism from `Multiplicative G` to `Equiv.perm P` -/
172+
def constVAddHom : Multiplicative G →* Equiv.Perm P where
173+
toFun v := constVAdd P (v.toAdd)
174+
map_one' := constVAdd_zero G P
175+
map_mul' := constVAdd_add P
176+
177+
variable {P}
178+
179+
open Function
180+
181+
@[simp]
182+
theorem left_vsub_pointReflection (x y : P) : x -ᵥ pointReflection x y = y -ᵥ x :=
183+
neg_injective <| by simp
184+
185+
@[simp]
186+
theorem right_vsub_pointReflection (x y : P) : y -ᵥ pointReflection x y = 2 • (y -ᵥ x) :=
187+
neg_injective <| by simp [← neg_nsmul]
188+
189+
/-- `x` is the only fixed point of `pointReflection x`. This lemma requires
190+
`x + x = y + y ↔ x = y`. There is no typeclass to use here, so we add it as an explicit argument. -/
191+
theorem pointReflection_fixed_iff_of_injective_two_nsmul {x y : P} (h : Injective (2 • · : G → G)) :
192+
pointReflection x y = y ↔ y = x := by
193+
rw [pointReflection_apply, eq_comm, eq_vadd_iff_vsub_eq, ← neg_vsub_eq_vsub_rev,
194+
neg_eq_iff_add_eq_zero, ← two_nsmul, ← nsmul_zero 2, h.eq_iff, vsub_eq_zero_iff_eq, eq_comm]
195+
196+
@[deprecated (since := "2024-11-18")] alias pointReflection_fixed_iff_of_injective_bit0 :=
197+
pointReflection_fixed_iff_of_injective_two_nsmul
198+
199+
theorem injective_pointReflection_left_of_injective_two_nsmul {G P : Type*} [AddCommGroup G]
200+
[AddTorsor G P] (h : Injective (2 • · : G → G)) (y : P) :
201+
Injective fun x : P => pointReflection x y :=
202+
fun x₁ x₂ (hy : pointReflection x₁ y = pointReflection x₂ y) => by
203+
rwa [pointReflection_apply, pointReflection_apply, vadd_eq_vadd_iff_sub_eq_vsub,
204+
vsub_sub_vsub_cancel_right, ← neg_vsub_eq_vsub_rev, neg_eq_iff_add_eq_zero,
205+
← two_nsmul, ← nsmul_zero 2, h.eq_iff, vsub_eq_zero_iff_eq] at hy
206+
207+
@[deprecated (since := "2024-11-18")] alias injective_pointReflection_left_of_injective_bit0 :=
208+
injective_pointReflection_left_of_injective_two_nsmul
209+
210+
end Equiv

0 commit comments

Comments
 (0)