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

Commit c062d9e

Browse files
committed
feat(*): more bundled versions of (fin 2 → α) ≃ (α × α) (#10214)
Also ensure that the inverse function uses vector notation when possible.
1 parent e4a882d commit c062d9e

File tree

4 files changed

+81
-15
lines changed

4 files changed

+81
-15
lines changed

src/data/equiv/fin.lean

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Copyright (c) 2018 Kenny Lau. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Kenny Lau
55
-/
6-
import data.fin.basic
6+
import data.fin.vec_notation
77
import data.equiv.basic
88
import tactic.norm_num
99

@@ -54,13 +54,14 @@ non-dependent version and `prod_equiv_pi_fin_two` for a version with inputs `α
5454
`γ = fin.cons α (fin.cons β fin_zero_elim)`. See also `pi_fin_two_equiv` and
5555
`fin_two_arrow_equiv`. -/
5656
@[simps {fully_applied := ff }] def prod_equiv_pi_fin_two (α β : Type u) :
57-
α × β ≃ Π i : fin 2, @fin.cons _ (λ _, Type u) α (fin.cons β fin_zero_elim) i :=
57+
α × β ≃ Π i : fin 2, ![α, β] i :=
5858
(pi_fin_two_equiv (fin.cons α (fin.cons β fin_zero_elim))).symm
5959

6060
/-- The space of functions `fin 2 → α` is equivalent to `α × α`. See also `pi_fin_two_equiv` and
6161
`prod_equiv_pi_fin_two`. -/
62-
@[simps {fully_applied := ff}] def fin_two_arrow_equiv (α : Type*) : (fin 2 → α) ≃ α × α :=
63-
pi_fin_two_equiv (λ _, α)
62+
@[simps { fully_applied := ff }] def fin_two_arrow_equiv (α : Type*) : (fin 2 → α) ≃ α × α :=
63+
{ inv_fun := λ x, ![x.1, x.2],
64+
.. pi_fin_two_equiv (λ _, α) }
6465

6566
/-- `Π i : fin 2, α i` is order equivalent to `α 0 × α 1`. See also `order_iso.fin_two_arrow_equiv`
6667
for a non-dependent version. -/
@@ -72,7 +73,7 @@ def order_iso.pi_fin_two_iso (α : fin 2 → Type u) [Π i, preorder (α i)] :
7273
/-- The space of functions `fin 2 → α` is order equivalent to `α × α`. See also
7374
`order_iso.pi_fin_two_iso`. -/
7475
def order_iso.fin_two_arrow_iso (α : Type*) [preorder α] : (fin 2 → α) ≃o α × α :=
75-
order_iso.pi_fin_two_iso (λ _, α)
76+
{ to_equiv := fin_two_arrow_equiv α, .. order_iso.pi_fin_two_iso (λ _, α) }
7677

7778
/-- The 'identity' equivalence between `fin n` and `fin m` when `n = m`. -/
7879
def fin_congr {n m : ℕ} (h : n = m) : fin n ≃ fin m :=

src/linear_algebra/pi.lean

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Johannes Hölzl, Mario Carneiro, Kevin Buzzard, Yury Kudryashov, Eric Wieser
55
-/
66
import linear_algebra.basic
7+
import data.equiv.fin
78

89
/-!
910
# Pi types of modules
@@ -341,6 +342,21 @@ def fun_unique (ι R M : Type*) [unique ι] [semiring R] [add_comm_monoid M] [mo
341342
map_smul' := λ c f, rfl,
342343
.. equiv.fun_unique ι M }
343344

345+
variables (R M)
346+
347+
/-- Linear equivalence between dependent functions `Π i : fin 2, M i` and `M 0 × M 1`. -/
348+
@[simps { simp_rhs := tt, fully_applied := ff }]
349+
def pi_fin_two (M : fin 2Type v) [Π i, add_comm_monoid (M i)] [Π i, module R (M i)] :
350+
(Π i, M i) ≃ₗ[R] M 0 × M 1 :=
351+
{ map_add' := λ f g, rfl,
352+
map_smul' := λ c f, rfl,
353+
.. pi_fin_two_equiv M }
354+
355+
/-- Linear equivalence between vectors in `M² = fin 2 → M` and `M × M`. -/
356+
@[simps { simp_rhs := tt, fully_applied := ff }]
357+
def fin_two_arrow : (fin 2 → M) ≃ₗ[R] M × M :=
358+
{ .. fin_two_arrow_equiv M, .. pi_fin_two R (λ _, M) }
359+
344360
end linear_equiv
345361

346362
section extend

src/topology/algebra/module.lean

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,7 @@ section semiring
238238
-/
239239

240240
variables
241-
{R₁ : Type*} [semiring R₁]
242-
{R₂ : Type*} [semiring R₂]
243-
{R₃ : Type*} [semiring R₃]
241+
{R₁ : Type*} {R₂ : Type*} {R₃ : Type*} [semiring R₁] [semiring R₂] [semiring R₃]
244242
{σ₁₂ : R₁ →+* R₂} {σ₂₃ : R₂ →+* R₃}
245243
{M₁ : Type*} [topological_space M₁] [add_comm_monoid M₁]
246244
{M₂ : Type*} [topological_space M₂] [add_comm_monoid M₂]
@@ -274,6 +272,16 @@ coe_injective.eq_iff
274272
theorem coe_fn_injective : @function.injective (M₁ →SL[σ₁₂] M₂) (M₁ → M₂) coe_fn :=
275273
linear_map.coe_injective.comp coe_injective
276274

275+
/-- See Note [custom simps projection]. We need to specify this projection explicitly in this case,
276+
because it is a composition of multiple projections. -/
277+
def simps.apply (h : M₁ →SL[σ₁₂] M₂) : M₁ → M₂ := h
278+
279+
/-- See Note [custom simps projection]. -/
280+
def simps.coe (h : M₁ →SL[σ₁₂] M₂) : M₁ →ₛₗ[σ₁₂] M₂ := h
281+
282+
initialize_simps_projections continuous_linear_map
283+
(to_linear_map_to_fun → apply, to_linear_map → coe)
284+
277285
@[ext] theorem ext {f g : M₁ →SL[σ₁₂] M₂} (h : ∀ x, f x = g x) : f = g :=
278286
coe_fn_injective $ funext h
279287

@@ -1063,18 +1071,16 @@ namespace continuous_linear_equiv
10631071

10641072
section add_comm_monoid
10651073

1066-
variables {R₁ : Type*} [semiring R₁]
1067-
{R₂ : Type*} [semiring R₂]
1068-
{R₃ : Type*} [semiring R₃]
1074+
variables {R₁ : Type*} {R₂ : Type*} {R₃ : Type*} [semiring R₁] [semiring R₂] [semiring R₃]
1075+
{σ₁₂ : R₁ →+* R₂} {σ₂₁ : R₂ →+* R₁} [ring_hom_inv_pair σ₁₂ σ₂₁] [ring_hom_inv_pair σ₂₁ σ₁₂]
1076+
{σ₂₃ : R₂ →+* R₃} {σ₃₂ : R₃ →+* R₂} [ring_hom_inv_pair σ₂₃ σ₃₂] [ring_hom_inv_pair σ₃₂ σ₂₃]
1077+
{σ₁₃ : R₁ →+* R₃} {σ₃₁ : R₃ →+* R₁} [ring_hom_inv_pair σ₁₃ σ₃₁] [ring_hom_inv_pair σ₃₁ σ₁₃]
1078+
[ring_hom_comp_triple σ₁₂ σ₂₃ σ₁₃] [ring_hom_comp_triple σ₃₂ σ₂₁ σ₃₁]
10691079
{M₁ : Type*} [topological_space M₁] [add_comm_monoid M₁]
10701080
{M₂ : Type*} [topological_space M₂] [add_comm_monoid M₂]
10711081
{M₃ : Type*} [topological_space M₃] [add_comm_monoid M₃]
10721082
{M₄ : Type*} [topological_space M₄] [add_comm_monoid M₄]
10731083
[module R₁ M₁] [module R₂ M₂] [module R₃ M₃]
1074-
{σ₁₂ : R₁ →+* R₂} {σ₂₁ : R₂ →+* R₁} [ring_hom_inv_pair σ₁₂ σ₂₁] [ring_hom_inv_pair σ₂₁ σ₁₂]
1075-
{σ₂₃ : R₂ →+* R₃} {σ₃₂ : R₃ →+* R₂} [ring_hom_inv_pair σ₂₃ σ₃₂] [ring_hom_inv_pair σ₃₂ σ₂₃]
1076-
{σ₁₃ : R₁ →+* R₃} {σ₃₁ : R₃ →+* R₁} [ring_hom_inv_pair σ₁₃ σ₃₁] [ring_hom_inv_pair σ₃₁ σ₁₃]
1077-
[ring_hom_comp_triple σ₁₂ σ₂₃ σ₁₃] [ring_hom_comp_triple σ₃₂ σ₂₁ σ₃₁]
10781084

10791085
include σ₂₁
10801086
/-- A continuous linear equivalence induces a continuous linear map. -/
@@ -1207,6 +1213,16 @@ by { ext, refl }
12071213
e.to_homeomorph.symm = e.symm.to_homeomorph :=
12081214
rfl
12091215

1216+
/-- See Note [custom simps projection]. We need to specify this projection explicitly in this case,
1217+
because it is a composition of multiple projections. -/
1218+
def simps.apply (h : M₁ ≃SL[σ₁₂] M₂) : M₁ → M₂ := h
1219+
1220+
/-- See Note [custom simps projection] -/
1221+
def simps.symm_apply (h : M₁ ≃SL[σ₁₂] M₂) : M₂ → M₁ := h.symm
1222+
1223+
initialize_simps_projections continuous_linear_equiv
1224+
(to_linear_equiv_to_fun → apply, to_linear_equiv_inv_fun → symm_apply)
1225+
12101226
lemma symm_map_nhds_eq (e : M₁ ≃SL[σ₁₂] M₂) (x : M₁) : map e.symm (𝓝 (e x)) = 𝓝 x :=
12111227
e.to_homeomorph.symm_map_nhds_eq x
12121228
omit σ₂₁
@@ -1316,6 +1332,13 @@ e.to_linear_equiv.to_equiv.image_eq_preimage s
13161332

13171333
protected lemma image_symm_eq_preimage (e : M₁ ≃SL[σ₁₂] M₂) (s : set M₂) : e.symm '' s = e ⁻¹' s :=
13181334
by rw [e.symm.image_eq_preimage, e.symm_symm]
1335+
1336+
@[simp] protected lemma symm_preimage_preimage (e : M₁ ≃SL[σ₁₂] M₂) (s : set M₂) :
1337+
e.symm ⁻¹' (e ⁻¹' s) = s := e.to_linear_equiv.to_equiv.symm_preimage_preimage s
1338+
1339+
@[simp] protected lemma preimage_symm_preimage (e : M₁ ≃SL[σ₁₂] M₂) (s : set M₁) :
1340+
e ⁻¹' (e.symm ⁻¹' s) = s := e.symm.symm_preimage_preimage s
1341+
13191342
omit σ₂₁
13201343

13211344
/-- Create a `continuous_linear_equiv` from two `continuous_linear_map`s that are
@@ -1528,6 +1551,20 @@ variables {ι R M}
15281551
@[simp] lemma coe_fun_unique : ⇑(fun_unique ι R M) = function.eval (default ι) := rfl
15291552
@[simp] lemma coe_fun_unique_symm : ⇑(fun_unique ι R M).symm = function.const ι := rfl
15301553

1554+
variables (R M)
1555+
1556+
/-- Continuous linear equivalence between dependent functions `Π i : fin 2, M i` and `M 0 × M 1`. -/
1557+
@[simps { fully_applied := ff }]
1558+
def pi_fin_two (M : fin 2Type*) [Π i, add_comm_monoid (M i)] [Π i, module R (M i)]
1559+
[Π i, topological_space (M i)] :
1560+
(Π i, M i) ≃L[R] M 0 × M 1 :=
1561+
{ to_linear_equiv := linear_equiv.pi_fin_two R M, .. homeomorph.pi_fin_two M }
1562+
1563+
/-- Continuous linear equivalence between vectors in `M² = fin 2 → M` and `M × M`. -/
1564+
@[simps { fully_applied := ff }]
1565+
def fin_two_arrow : (fin 2 → M) ≃L[R] M × M :=
1566+
{ to_linear_equiv := linear_equiv.fin_two_arrow R M, .. pi_fin_two R (λ _, M) }
1567+
15311568
end
15321569

15331570
end continuous_linear_equiv

src/topology/homeomorph.lean

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Johannes Hölzl, Patrick Massot, Sébastien Gouëzel, Zhouhang Zhou, Reid Barton
55
-/
66
import topology.dense_embedding
7+
import data.equiv.fin
78

89
/-!
910
# Homeomorphisms
@@ -399,6 +400,17 @@ def fun_unique (ι α : Type*) [unique ι] [topological_space α] : (ι → α)
399400
continuous_to_fun := continuous_apply _,
400401
continuous_inv_fun := continuous_pi (λ _, continuous_id) }
401402

403+
/-- Homeomorphism between dependent functions `Π i : fin 2, α i` and `α 0 × α 1`. -/
404+
@[simps { fully_applied := ff }]
405+
def {u} pi_fin_two (α : fin 2Type u) [Π i, topological_space (α i)] : (Π i, α i) ≃ₜ α 0 × α 1 :=
406+
{ to_equiv := pi_fin_two_equiv α,
407+
continuous_to_fun := (continuous_apply 0).prod_mk (continuous_apply 1),
408+
continuous_inv_fun := continuous_pi $ fin.forall_fin_two.2 ⟨continuous_fst, continuous_snd⟩ }
409+
410+
/-- Homeomorphism between `α² = fin 2 → α` and `α × α`. -/
411+
@[simps { fully_applied := ff }] def fin_two_arrow : (fin 2 → α) ≃ₜ α × α :=
412+
{ to_equiv := fin_two_arrow_equiv α, .. pi_fin_two (λ _, α) }
413+
402414
/--
403415
A subset of a topological space is homeomorphic to its image under a homeomorphism.
404416
-/

0 commit comments

Comments
 (0)