Hi Eric,

On 2014-06-02, Eric Gourgoulhon <egourgoul...@gmail.com> wrote:
>> How about defining two parents (CU and CCU, with a coercion CCU --> CU=20
>> and a partial conversion CU --> CCU), and two element classes (SF and a=
>=20
>> subclass CSF), and having CU(0) create an instance of CSF, but set the=20
>> instance's parent to CU?=20
>>
>
> Thank you for your anwser.=20
> Is this the standard way to implement algebraic substructures ? i.e. have a=
>=20
> coercion B -> A and a partial conversion B -> A when B is a subspace (in=20
> the present case a subalgebra) of A ?

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.

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.

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.

Reply via email to