Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat(analysis/normed_space/linear_isometry): linear_equiv.of_eq as a linear_isometry_equiv #15471

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/analysis/normed_space/linear_isometry.lean
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ instance : has_coe_to_fun (E →ₛₗᵢ[σ₁₂] E₂) (λ _, E → E₂) :=
lemma coe_injective : @injective (E →ₛₗᵢ[σ₁₂] E₂) (E → E₂) coe_fn :=
fun_like.coe_injective

/-- See Note [custom simps projection]. We need to specify this projection explicitly in this case,
because it is a composition of multiple projections. -/
def simps.apply (σ₁₂ : R →+* R₂) (E E₂ : Type*) [semi_normed_group E]
[semi_normed_group E₂] [module R E] [module R₂ E₂] (h : E →ₛₗᵢ[σ₁₂] E₂) : E → E₂ := h
ADedecker marked this conversation as resolved.
Show resolved Hide resolved

initialize_simps_projections linear_isometry (to_linear_map_to_fun → apply)

@[ext] lemma ext {f g : E →ₛₗᵢ[σ₁₂] E₂} (h : ∀ x, f x = g x) : f = g :=
coe_injective $ funext h

Expand Down Expand Up @@ -400,6 +407,20 @@ def symm : E₂ ≃ₛₗᵢ[σ₂₁] E :=
@[simp] lemma to_isometric_symm : e.to_isometric.symm = e.symm.to_isometric := rfl
@[simp] lemma to_homeomorph_symm : e.to_homeomorph.symm = e.symm.to_homeomorph := rfl

/-- See Note [custom simps projection]. We need to specify this projection explicitly in this case,
because it is a composition of multiple projections. -/
def simps.apply (σ₁₂ : R →+* R₂) {σ₂₁ : R₂ →+* R} [ring_hom_inv_pair σ₁₂ σ₂₁]
[ring_hom_inv_pair σ₂₁ σ₁₂] (E E₂ : Type*) [semi_normed_group E] [semi_normed_group E₂]
[module R E] [module R₂ E₂] (h : E ≃ₛₗᵢ[σ₁₂] E₂) : E → E₂ := h

/-- See Note [custom simps projection] -/
def simps.symm_apply (σ₁₂ : R →+* R₂) {σ₂₁ : R₂ →+* R} [ring_hom_inv_pair σ₁₂ σ₂₁]
[ring_hom_inv_pair σ₂₁ σ₁₂] (E E₂ : Type*) [semi_normed_group E] [semi_normed_group E₂]
[module R E] [module R₂ E₂] (h : E ≃ₛₗᵢ[σ₁₂] E₂) : E₂ → E := h.symm

initialize_simps_projections linear_isometry_equiv
(to_linear_equiv_to_fun → apply, to_linear_equiv_inv_fun → symm_apply)

include σ₃₁ σ₃₂
/-- Composition of `linear_isometry_equiv`s as a `linear_isometry_equiv`. -/
def trans (e' : E₂ ≃ₛₗᵢ[σ₂₃] E₃) : E ≃ₛₗᵢ[σ₁₃] E₃ :=
Expand Down Expand Up @@ -586,6 +607,20 @@ rfl
((prod_assoc R E E₂ E₃).symm : E × E₂ × E₃ → (E × E₂) × E₃) = (equiv.prod_assoc E E₂ E₃).symm :=
rfl

variables {R E E₂ E₃} {R' : Type*} [ring R'] [module R' E] (p q : submodule R' E)

/-- `linear_equiv.of_eq` as a `linear_isometry_equiv`. -/
def of_eq (hpq : p = q) :
p ≃ₗᵢ[R'] q :=
{ norm_map' := λ x, rfl,
..linear_equiv.of_eq p q hpq }

variables {p q}

@[simp] lemma coe_of_eq_apply (h : p = q) (x : p) : (of_eq p q h x : E) = x := rfl
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please setup simps to work with linear isometries, if that is not already done? Then these lemmas can be auto-generated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think simps is easy to configure to generate the right name here (with coe as a prefix)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if we want to autogenerate these we can't do anything about the names. I'm struggling a bit to understand how to setup these properly, but I'll ask people in Providence tomorrow

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did the simps setup and removed the coe_of_eq_apply, here and for linear_equiv, since simps generate it as of_eq_apply, which is more homogeneous with the rest of the library. Does that sound fine ?

@[simp] lemma of_eq_symm (h : p = q) : (of_eq p q h).symm = of_eq q p h.symm := rfl
ADedecker marked this conversation as resolved.
Show resolved Hide resolved
@[simp] lemma of_eq_rfl : of_eq p p rfl = linear_isometry_equiv.refl R' p := by ext; refl

end linear_isometry_equiv

/-- Two linear isometries are equal if they are equal on basis vectors. -/
Expand Down
2 changes: 1 addition & 1 deletion src/linear_algebra/basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -1525,8 +1525,8 @@ def of_eq (h : p = q) : p ≃ₗ[R] q :=
variables {p q}

@[simp] lemma coe_of_eq_apply (h : p = q) (x : p) : (of_eq p q h x : M) = x := rfl

@[simp] lemma of_eq_symm (h : p = q) : (of_eq p q h).symm = of_eq q p h.symm := rfl
ADedecker marked this conversation as resolved.
Show resolved Hide resolved
@[simp] lemma of_eq_rfl : of_eq p p rfl = linear_equiv.refl R p := by ext; refl

include σ₂₁
/-- A linear equivalence which maps a submodule of one module onto another, restricts to a linear
Expand Down