Zulip Chat Archive

Stream: new members

Topic: Type specialization


Magalame (Jul 20 2022 at 13:59):

Hi, is there a way to specialize types ? What I mean is I have two complex inner product spaces A, B and I'd want a type C := A →L[ℂ] B for the sake of readability. I have tried

structure lin_bounded_map (A: Type) [inner_product_space   A] (B:Type) [inner_product_space  B] extends  A L[] B

but when asking for a A →L[ℂ] B the compiler isnt happy with me providing a lin_bounded_map A B instead. I imagine I can do

structure lin_bounded_map (A: Type) [inner_product_space   A] (B:Type) [inner_product_space  B] : Type :=
(to_func: A L[] B)

but it seems suboptimal

Andrew Yang (Jul 20 2022 at 14:12):

What you want is probably

def lin_bounded_map (A: Type) [inner_product_space   A] (B:Type) [inner_product_space  B] : Type :=
A L[] B

Eric Wieser (Jul 20 2022 at 14:14):

Right; Andrew Yang's answer is "don't extend things if you're not actually adding any new fields".

If you were adding new fields, then the answer is sometimes docs#continuous_linear_map_class, which lets you register that lin_bounded_map "is" a continuous linear map

Magalame (Jul 20 2022 at 15:50):

excellent thanks a lot!


Last updated: Dec 20 2023 at 11:08 UTC