On Sat, 28 Oct 2006 16:39:10 -0700, David Harvey <[EMAIL PROTECTED]> wrote:
> Another issue that slightly complicates this is base rings. When I do > x * y, I don't always want to coerce into the same parent; sometimes > I want to coerce x into the "base ring" of y (or vice versa), which > will mean different things depending on what the rings/algebras are. What are the rules for algebras going to be? Suppose R and S are commutative rings (for simplicity) and M and N are R modules and K is an S-module. Choose x in M and y in N. Then coerce should work exactly as before. All the _coerce_ maps are R-module homomorphisms, etc., and there is nothing new going on here. Next assume that z in K. To do x + z, we have to worry about base rings. PROPOSED RULE: Suppose there is a coerce map (of rings!) R --> S. Then to compute x+z we first compute Z = M.base_extend(S), which is an S-module such that _coerce_ on elements of M gives elements of Z in the natural way. We are now do the add Z._coerce_(x) + z using the usual rules. Next, consider multiplication. Suppose in addition that M, N, and K are all algebras. Suppose that x in M and z in K. Multiplication should work in exactly the same way as addition above. PROPOSED RULE: Suppose there is a coerce map (of rings!) R --> S. Then to compute x*z we first compute Z = M.base_extend(S), which is an S-module equipped with the data that _coerce_ on elements of M gives elements of Z in the natural way. We are now do the add Z._coerce_(x) + z using the usual rules. You know, when an object such as Z above decided that elements of some other object (e.g., M) can be coerced to it, that should also be recorded with M. And moreover, the process of recording this information with M should propogate, e.g., each object from which M can coerce elements, should be told that M can now also coerce elements to Z. This will propogate around until it stops, thus walking a component of some sort of reference graph. This will help very much to make the coercion graph transitive even in the presence of automatically generated objects like base extensions. -- William --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---