[Not sure if this belongs here or in sage-dev...]

I am trying to implement coercions between algebras that are related by 
base change. For example,consider

A=CombinatorialFreeModule(ZZ['x'], ['1','2'])
B=CombinatorialFreeModule(ZZ, ['1','2'])
A.module_morphism(
    lambda a: B._from_dict({b: c.subtitute(x=1) for (b,c) in a}), 
    codomain=B, category=A.category()
).register_as_coercion()

This fails with a category mismatch error because A is defined over Z[x] 
and B over Z:

ValueError: Free module generated by {'1', '2'} over Univariate Polynomial 
Ring in x over Integer Ring is not in Category of finite dimensional 
modules with basis over Integer Ring

This is entirely reasonable because I have not specified how Z is a 
Z[x]-module, but when I try to define this it seems I need slightly 
different syntax:

Rx = ZZ['x]
R = ZZ
Rx.module_morphism(function=lambda f: f.substitute(x=1), codomain=R)

This also fails with a category mismatch:

ValueError: Integer Ring is not in Category of modules over Integer Ring

My actual use case is slightly more complicated in that I have an algebra 
defined as a combinatorial free module with multiple realisations and the 
rings could be different, but this is the essence of my problem. I could 
just fudge this but I'd like to do this "properly".

Andrew 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/58aa4e0a-47e5-4293-b4cc-d9046eb85073n%40googlegroups.com.

Reply via email to