Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit e60899c

Browse files
committed
feat(linear_algebra/orientation): inherit an action by units R on module.ray R M (#10738)
This action is just the action inherited on the elements of the module under the quotient. We provide it generally for any group `G` that satisfies the required properties, but are only really interested in `G = units R`. This PR also provides `module.ray.map`, for sending a ray through a linear equivalence. This generalization also provides us with `mul_action (M ≃ₗ[R] M) (module.ray R M)`, which might also turn out to be useful.
1 parent ea88bd6 commit e60899c

File tree

1 file changed

+112
-6
lines changed

1 file changed

+112
-6
lines changed

src/linear_algebra/orientation.lean

Lines changed: 112 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ section ordered_comm_semiring
3939

4040
variables (R : Type*) [ordered_comm_semiring R]
4141
variables {M : Type*} [add_comm_monoid M] [module R M]
42+
variables {N : Type*} [add_comm_monoid N] [module R N]
4243
variables (ι : Type*) [decidable_eq ι]
4344

4445
/-- Two vectors are in the same ray if some positive multiples of them are equal (in the typical
@@ -90,6 +91,24 @@ lemma same_ray.pos_smul_left {v₁ v₂ : M} {r : R} (h : same_ray R v₁ v₂)
9091
same_ray R (r • v₁) v₂ :=
9192
transitive_same_ray R M (same_ray_pos_smul_left v₁ hr) h
9293

94+
/-- If two vectors are on the same ray then they remain so after appling a linear map. -/
95+
lemma same_ray.map {v₁ v₂ : M} (f : M →ₗ[R] N)
96+
(h : same_ray R v₁ v₂) : same_ray R (f v₁) (f v₂) :=
97+
let ⟨r₁, r₂, hr₁, hr₂, h⟩ := h in
98+
⟨r₁, r₂, hr₁, hr₂, by rw [←f.map_smul, ←f.map_smul, h]⟩
99+
100+
/-- If two vectors are on the same ray then they remain so after appling a linear equivalence. -/
101+
@[simp] lemma same_ray_map_iff {v₁ v₂ : M} (e : M ≃ₗ[R] N) :
102+
same_ray R (e v₁) (e v₂) ↔ same_ray R v₁ v₂ :=
103+
⟨λ h, by simpa using same_ray.map e.symm.to_linear_map h, same_ray.map e.to_linear_map⟩
104+
105+
/-- If two vectors are on the same ray then both scaled by the same action are also on the same
106+
ray. -/
107+
lemma same_ray.smul {S : Type*} [has_scalar S M] [smul_comm_class R S M] {v₁ v₂ : M} (s : S)
108+
(h : same_ray R v₁ v₂) : same_ray R (s • v₁) (s • v₂) :=
109+
let ⟨r₁, r₂, hr₁, hr₂, h⟩ := h in
110+
⟨r₁, r₂, hr₁, hr₂, by rw [smul_comm r₁ s v₁, smul_comm r₂ s v₂, h]⟩
111+
93112
variables (R M)
94113

95114
/-- The setoid of the `same_ray` relation for elements of a module. -/
@@ -153,8 +172,61 @@ begin
153172
exact same_ray_pos_smul_left v hr
154173
end
155174

175+
/-- An equivalence between modules implies an equivalence between ray vectors. -/
176+
def ray_vector.map_linear_equiv (e : M ≃ₗ[R] N) : ray_vector M ≃ ray_vector N :=
177+
equiv.subtype_equiv e.to_equiv $ λ _, e.map_ne_zero_iff.symm
178+
179+
/-- An equivalence between modules implies an equivalence between rays. -/
180+
def module.ray.map [nontrivial R] (e : M ≃ₗ[R] N) : module.ray R M ≃ module.ray R N :=
181+
quotient.congr (ray_vector.map_linear_equiv e) $ λ ⟨a, ha⟩ ⟨b, hb⟩, (same_ray_map_iff _).symm
182+
183+
@[simp] lemma module.ray.map_apply [nontrivial R] (e : M ≃ₗ[R] N) (v : M) (hv : v ≠ 0) :
184+
module.ray.map e (ray_of_ne_zero _ v hv) = ray_of_ne_zero _ (e v) (e.map_ne_zero_iff.2 hv) := rfl
185+
186+
@[simp] lemma module.ray.map_refl [nontrivial R] :
187+
(module.ray.map $ linear_equiv.refl R M) = equiv.refl _ :=
188+
equiv.ext $ module.ray.ind R $ λ _ _, rfl
189+
190+
@[simp] lemma module.ray.map_symm [nontrivial R] (e : M ≃ₗ[R] N) :
191+
(module.ray.map e).symm = module.ray.map e.symm := rfl
192+
193+
section action
194+
variables {G : Type*} [group G] [nontrivial R] [distrib_mul_action G M] [smul_comm_class R G M]
195+
196+
/-- Any invertible action preserves the non-zeroness of ray vectors. This is primarily of interest
197+
when `G = units R` -/
198+
instance : mul_action G (ray_vector M) :=
199+
{ smul := λ r, (subtype.map ((•) r) $ λ a, (smul_ne_zero_iff_ne _).2),
200+
mul_smul := λ a b m, subtype.ext $ mul_smul a b _,
201+
one_smul := λ m, subtype.ext $ one_smul _ _ }
202+
203+
/-- Any invertible action preserves the non-zeroness of rays. This is primarily of interest when
204+
`G = units R` -/
205+
instance : mul_action G (module.ray R M) :=
206+
{ smul := λ r, quotient.map ((•) r) (λ a b, same_ray.smul _),
207+
mul_smul := λ a b, quotient.ind $ by exact(λ m, congr_arg quotient.mk $ mul_smul a b _),
208+
one_smul := quotient.ind $ by exact (λ m, congr_arg quotient.mk $ one_smul _ _), }
209+
210+
/-- The action via `linear_equiv.apply_distrib_mul_action` corresponds to `module.ray.map`. -/
211+
@[simp] lemma module.ray.linear_equiv_smul_eq_map (e : M ≃ₗ[R] M) (v : module.ray R M) :
212+
e • v = module.ray.map e v := rfl
213+
214+
@[simp] lemma smul_ray_of_ne_zero (g : G) (v : M) (hv) :
215+
g • ray_of_ne_zero R v hv = ray_of_ne_zero R (g • v) ((smul_ne_zero_iff_ne _).2 hv) := rfl
216+
217+
end action
218+
156219
namespace module.ray
157220

221+
/-- Scaling by a positive unit is a no-op. -/
222+
lemma units_smul_of_pos [nontrivial R] (u : units R) (hu : 0 < (u : R)) (v : module.ray R M) :
223+
u • v = v :=
224+
begin
225+
induction v using module.ray.ind,
226+
rw [smul_ray_of_ne_zero, ray_eq_iff],
227+
exact same_ray_pos_smul_left _ hu,
228+
end
229+
158230
/-- An arbitrary `ray_vector` giving a ray. -/
159231
def some_ray_vector [nontrivial R] (x : module.ray R M) : ray_vector M :=
160232
quotient.out x
@@ -258,6 +330,15 @@ begin
258330
exact x_hv (eq_zero_of_same_ray_self_neg h)
259331
end
260332

333+
/-- Scaling by a negative unit is negation. -/
334+
lemma units_smul_of_neg [nontrivial R] (u : units R) (hu : (u : R) < 0) (v : module.ray R M) :
335+
u • v = -v :=
336+
begin
337+
induction v using module.ray.ind,
338+
rw [smul_ray_of_ne_zero, ←ray_neg, ray_eq_iff, ←same_ray_neg_swap, units.smul_def, ←neg_smul],
339+
exact same_ray_pos_smul_left _ (neg_pos_of_neg hu),
340+
end
341+
261342
end module.ray
262343

263344
namespace basis
@@ -286,9 +367,12 @@ begin
286367
exact same_ray_pos_smul_left _ hr,
287368
end
288369

370+
section
371+
variables [no_zero_smul_divisors R M]
372+
289373
/-- A nonzero vector is in the same ray as a multiple of itself if and only if that multiple
290374
is positive. -/
291-
@[simp] lemma same_ray_smul_right_iff [no_zero_smul_divisors R M] {v : M} (hv : v ≠ 0) (r : R) :
375+
@[simp] lemma same_ray_smul_right_iff {v : M} (hv : v ≠ 0) (r : R) :
292376
same_ray R v (r • v) ↔ 0 < r :=
293377
begin
294378
split,
@@ -304,7 +388,7 @@ end
304388

305389
/-- A multiple of a nonzero vector is in the same ray as that vector if and only if that multiple
306390
is positive. -/
307-
@[simp] lemma same_ray_smul_left_iff [no_zero_smul_divisors R M] {v : M} (hv : v ≠ 0) (r : R) :
391+
@[simp] lemma same_ray_smul_left_iff {v : M} (hv : v ≠ 0) (r : R) :
308392
same_ray R (r • v) v ↔ 0 < r :=
309393
begin
310394
rw (symmetric_same_ray R M).iff,
@@ -313,22 +397,44 @@ end
313397

314398
/-- The negation of a nonzero vector is in the same ray as a multiple of that vector if and
315399
only if that multiple is negative. -/
316-
@[simp] lemma same_ray_neg_smul_right_iff [no_zero_smul_divisors R M] {v : M} (hv : v ≠ 0)
317-
(r : R) : same_ray R (-v) (r • v) ↔ r < 0 :=
400+
@[simp] lemma same_ray_neg_smul_right_iff {v : M} (hv : v ≠ 0) (r : R) :
401+
same_ray R (-v) (r • v) ↔ r < 0 :=
318402
begin
319403
rw [←same_ray_neg_iff, neg_neg, ←neg_smul, same_ray_smul_right_iff hv (-r)],
320404
exact right.neg_pos_iff
321405
end
322406

323407
/-- A multiple of a nonzero vector is in the same ray as the negation of that vector if and
324408
only if that multiple is negative. -/
325-
@[simp] lemma same_ray_neg_smul_left_iff [no_zero_smul_divisors R M] {v : M} (hv : v ≠ 0)
326-
(r : R) : same_ray R (r • v) (-v) ↔ r < 0 :=
409+
@[simp] lemma same_ray_neg_smul_left_iff {v : M} (hv : v ≠ 0) (r : R) :
410+
same_ray R (r • v) (-v) ↔ r < 0 :=
327411
begin
328412
rw [←same_ray_neg_iff, neg_neg, ←neg_smul, same_ray_smul_left_iff hv (-r)],
329413
exact left.neg_pos_iff
330414
end
331415

416+
/-- A nonzero vector is in the same ray as a multiple of itself if and only if that multiple
417+
is positive. -/
418+
@[simp] lemma units_smul_eq_self_iff {u : units R} {v : module.ray R M} :
419+
u • v = v ↔ (0 : R) < u :=
420+
begin
421+
induction v using module.ray.ind with v hv,
422+
rw [smul_ray_of_ne_zero, ray_eq_iff, units.smul_def],
423+
exact same_ray_smul_left_iff hv _,
424+
end
425+
426+
/-- A nonzero vector is in the same ray as a multiple of itself if and only if that multiple
427+
is positive. -/
428+
@[simp] lemma units_smul_eq_neg_iff {u : units R} {v : module.ray R M} :
429+
u • v = -v ↔ ↑u < (0 : R) :=
430+
begin
431+
induction v using module.ray.ind with v hv,
432+
rw [smul_ray_of_ne_zero, ←ray_neg, ray_eq_iff, units.smul_def],
433+
exact same_ray_neg_smul_left_iff hv _,
434+
end
435+
436+
end
437+
332438
namespace basis
333439

334440
variables [fintype ι]

0 commit comments

Comments
 (0)