Le lundi 2 juin 2014 15:00:25 UTC+2, Simon King a écrit : > > > If B is a sub-structure of A, then the inclusion map is (by definition > of a "sub-structure") a homomorphism. If you distinguish isomorphic > sub-structures, then this homomorphism is canonical. Hence, it should be > safe to use the embedding as a *coercion* B -> A. Note that registering a > homomorphism as a coercion has implications: It will automatically be > applied > when you do arithmetic operations or comparison between elements of B and > elements of A. > > Thanks for these comments. I already implemented coercion for something else: the restriction of a scalar field to subdomains of its domain, namely C^oo(U) coerces to C^oo(V) when V is an open subset of U. It works well, especially for the arithmetic.
> Since B is a sub-structure of A, it is *always* possible to define a > partial conversion A -> B (note the typo in your post: When we have > coercion B -> A then we *cannot* additionally have a partial conversion > in the same direction!): Its restriction to B is the identity, and it > raises an error on the complement of B. > Unlike a coercion, a conversion is not necessarily a homomorphism, and > it will not be applied automatically. > > In this frame, there should be two distinct zero elements, namely A.zero() and B.zero(), i.e. we should have A.zero() == B.zero() but A.zero() is B.zero() should return False. Correct ? Eric. Best regards, > Simon > > > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.