[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Axiom-developer] Another strange coercion
From: |
Franz Lehner |
Subject: |
[Axiom-developer] Another strange coercion |
Date: |
Mon, 13 Aug 2007 19:57:07 +0200 (CEST) |
Hello,
There are many easy examples of this when you use the Axiom interpreter.
Perhaps the following is related:
Trying to implement free products of monoids
FreeProductMonoid(M1:Monoid,M2:Monoid)
(see attachment, not very elegant, but I don't know how to avoid "mixed
lists" otherwise). I am stuck at the following problem:
There are two converters
coerce:M1 -> %
coerce:M2 -> %
but somehow always the first converter is called,
in the order where they are found in the source file,
leading to strange results:
(1) -> Z2:=CyclicGroup(2,'a)
(1) CyclicGroup(2,a)
Type: Domain
(2) -> Z3:=CyclicGroup(3,'b)
(2) CyclicGroup(3,b)
Type: Domain
(3) -> G:=FreeProductMonoid(Z2,Z3)
(3) FreeProductMonoid(CyclicGroup(2,a),CyclicGroup(3,b))
Type: Domain
(4) -> a1:=a::Z2
(4) a
Type: CyclicGroup(2,a)
(5) -> b1:=b::Z3
(5) b
Type: CyclicGroup(3,b)
(6) -> a2:=a1::G
(6) a
Type: FreeProductMonoid(CyclicGroup(2,a),CyclicGroup(3,b))
(7) -> b2:=b1::G
(7) a
Type: FreeProductMonoid(CyclicGroup(2,a),CyclicGroup(3,b))
(8) -> b2a:= (b1^2) ::G
2
(8) a
Type: FreeProductMonoid(CyclicGroup(2,a),CyclicGroup(3,b))
(9) -> b2a * 1::G
(9) 1
(10) -> b::Z2
>> System error:
wrong symbol
Especially (8) is pretty strange. (9) shows that indeed b made it
into M1 and is the identity element. (10) shows that coercion in
CyclicGroup filters out the wrong symbols as it should.
What am I missing? Somehow the interpreter is confused by two almost equal
signatures (both M1 and M2 are Monoids). Is this forbidden?
Renaming the converters to coerce1 and coerce2 makes it work.
regards
Franz
free.as
Description: Text document
cyclic.as
Description: Text document
- Re: [Axiom-developer] "has" and "with" (was curious algebra failure), (continued)
- Re: [Axiom-developer] "has" and "with" (was curious algebra failure), Ralf Hemmecke, 2007/08/13
- Re: [Aldor-l] [Axiom-developer] "has" and "with" (was curious algebra failure), Gabriel Dos Reis, 2007/08/13
- Re: [Aldor-l] [Axiom-developer] "has" and "with" (was curious algebra failure), Ralf Hemmecke, 2007/08/13
- RE: [Aldor-l] [Axiom-developer] "has" and "with" (was curious algebrafailure), Weiss, Juergen, 2007/08/13
- Re: [Aldor-l] [Axiom-developer] "has" and "with" (was curious algebra failure), Bill Page, 2007/08/13
- Re: [Aldor-l] [Axiom-developer] "has" and "with" (was curious algebra failure), Gabriel Dos Reis, 2007/08/13
- Re: [Aldor-l] [Axiom-developer] "has" and "with" (was curious algebra failure), Bill Page, 2007/08/13
- [Axiom-developer] Another strange coercion,
Franz Lehner <=
- Re: [Axiom-developer] Another strange coercion, Ralf Hemmecke, 2007/08/14
- [Axiom-developer] SubDomain in SPAD and not in Aldor, Ralf Hemmecke, 2007/08/16
- Re: [Aldor-l] [Axiom-developer] "has" and "with" (was curious algebra failure), Gabriel Dos Reis, 2007/08/13
- Re: [Aldor-l] [Axiom-developer] "has" and "with" (was curious algebra failure), Ralf Hemmecke, 2007/08/14
- Re: [Aldor-l] [Axiom-developer] "has" and "with" (was curious algebra failure), Gabriel Dos Reis, 2007/08/14
- Re: [Aldor-l] [Axiom-developer] "has" and "with" (was curious algebra failure), Martin Rubey, 2007/08/14
- Re: [Aldor-l] [Axiom-developer] "has" and "with" (was curious algebrafailure), William Sit, 2007/08/14
- Re: [Aldor-l] [Axiom-developer] "has" and "with" (was curious algebrafailure), Bill Page, 2007/08/14
- Re: [Aldor-l] [Axiom-developer] "has" and "with" (was curious algebrafailure), Ralf Hemmecke, 2007/08/15
- Re: [Aldor-l] [Axiom-developer] "has" and "with" (was curious algebrafailure), Martin Rubey, 2007/08/16