I desperately look for the reason of a strange behaviour of compiled
SPAD code:

I have coded a category MonoidAction with default code containing the
code for "orbit" using the group action *

Then I made two different domains for this category, for one the
inherited "orbit" functions works without problem,

(18) -> g := enG.1

   (18)  (1 5 4 3 2)
                                                 Type:
Permutation(OneToN(5))
(19) -> g * w    -- group action works!)

   (19)  3
                                                 Type:
PermutationGroupOnN(5)
(20) -> orbit w  -- inherited operation from category default works)

   (20)  [3,4,5,2,1]
                                           Type:
List(PermutationGroupOnN(5))


for the other, however, I get a strange break occuring immediately when
I call orbit:


D*v  --group action works!)


   (7)  [- 1,0]
                      Type:
CyclicTwoDimensionalVelocity(Fraction(Integer),d)
(8) -> orbit v  -- inherited operation orbit from category defaults
immediately fails:

debugger invoked on a SIMPLE-CONDITION: break

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [CONTINUE] Return from BREAK.

(|evalSlotDomain| 4 #1=#((|CyclicTwoDimensionalVelocity| #2=(|Fraction|
#3=(|Integer|)) |d|) (#4=#<FUNCTION |lookupComplete|> #1# #(~= 35
|stabilizer| 41 |second| 46 |orbitLengths| 51 |orbitLength| 56 |orbit|
61 ...)) NIL 0 (#(|MonoidAction&| |SetCategory&| |BasicType&| T)
#((|MonoidAction| (|CyclicGroup| 4 7)) (|SetCategory|) (|BasicType|)
(|CoercibleTo| 32)) . #(0 10 9 11 0 6 0 14 0 10 0 15 ...)) #5=#((|List|
#2#) (#<FUNCTION |lookupIncomplete|> #5# #(|setUnion| 102
|setIntersection| 108 |setDifference| 114 |removeDuplicates| 120 |null|
125 |nil| 130 ...)) NIL 261759 (#(|ListAggregate&| #(# # NIL 0 # NIL #5#
#6=# # # # # ...) |ExtensibleLinearAggregate&| |FiniteLinearAggregate&|
|UnaryRecursiveAggregate&| |LinearAggregate&| |RecursiveAggregate&|
|IndexedAggregate&| |Collection&| |OrderedSet&| |HomogeneousAggregate&|
T ...) #((|ListAggregate| 6) (|StreamAggregate| 6)
(|ExtensibleLinearAggregate| 6) (|FiniteLinearAggregate| 6)
(|UnaryRecursiveAggregate| 6) (|LinearAggregate| 6)
(|RecursiveAggregate| 6) (|IndexedAggregate| 27 6) (|Collection| 6)
(|OrderedSet|) (|HomogeneousAggregate| 6) (|Comparable|) ...) . #(1 13
12 0 14 3 13 12 0 15 15 16 ...)) #7=#((|IndexedList| #2# 1) (#4# #7#
#(~= 97 |value| 103 |third| 108 |tail| 113 |swap!| 118 |split!| 125
...)) NIL 130879 (#(|ListAggregate&| |StreamAggregate&|
|ExtensibleLinearAggregate&| |FiniteLinearAggregate&| #
|LinearAggregate&| |RecursiveAggregate&| |IndexedAggregate&|
|Collection&| |OrderedSet&| |HomogeneousAggregate&| T ...) #(# # # # # #
# # # # # # ...) . #(1 0 11 0 35 1 0 0 0 37 1 6 ...)) NIL #6# 1
(|NonNegativeInteger|) (#<FUNCTION |ILIST;#;$Nni;1|> . #7#) (#<FUNCTION
|ILIST;concat;S2$;2|> . #7#) (|Boolean|) ...) #6# (#<FUNCTION
|LIST;nil;$;1|> . #5#) (|Boolean|) (#<FUNCTION |LIST;null;$B;2|> . #5#)
(#<FUNCTION |LIST;cons;S2$;3|> . #5#) (#<FUNCTION |LIST;append;3$;4|> .
#5#) ...) #6# |d| #5# (|List| $) #8=#((|CyclicGroup| 4 |d|) (#4# #8#
#(~= 41 |smaller?| 47 |size| 53 |sample| 57 |recip| 61 |random| 66 ...))
NIL 0 (#(|FiniteGroup&| |Group&| |Monoid&| |SemiGroup&| T |Finite&|
|SetCategory&| T T T |BasicType&| T ...) #((|FiniteGroup|) (|Group|)
(|Monoid|) (|SemiGroup|) (|Comparable|) (|Finite|) (|SetCategory|)
(|ConvertibleTo| 20) (|FinitelyGenerated|) (|ConvertibleTo| 43)
(|BasicType|) (|unitsKnown|) ...) . #(1 12 11 0 13 1 14 11 0 15 2 11
...)) NIL 4 |d| #9=#(#3# (#4# #9# #(~= 121 |zero?| 127 |unitNormal| 132
|unitCanonical| 137 |unit?| 142 |symmetricRemainder| 147 ...)) NIL 0
(#(|IntegerNumberSystem&| |PolynomialFactorizationExplicit&|
|EuclideanDomain&| |UniqueFactorizationDomain&| T T |GcdDomain&| T
|OrderedRing&| T |Algebra&| T ...) #(# # # # # # # # # # # # ...) . #(1
7 6 0 8 3 7 6 0 9 9 10 ...)) NIL (|Void|) (|OpenMathDevice|)
(#10=#<FUNCTION |newGoGet|> #9# 0 . |OMputApp|) (|String|) (#10# #9# 5 .
|OMputSymbol|) #3# ...) (|Boolean|) (#<FUNCTION |CYCGRP;one?;$B;7|> .
#8#) (|OutputForm|) ...) (#<FUNCTION |CYCGRP;generators;L;20|> . #8#) ...))
0]

Any Idea what is going on here?


Here are the 2 different code pieces:

Working code using MonoidAction:

)abbrev domain PGM PermutationGroupOnN
PermutationGroupOnN(n: PositiveInteger): Exports == Implementation where
  G              ==> Permutation OneToN(n)
  Exports        ==> Join(MonoidAction(G), SetCategory, Finite, StepThrough,
    OrderedFinite, RetractableFrom Integer, RetractableTo Integer,
      RetractableTo PositiveInteger)
  Implementation ==> OneToN(n) add
    Rep := OneToN(n)
    ((g: G) * (v: %)): % == eval(g,v::Rep)$G

Code with some error I do not know:


)abbrev domain CYC2DV CyclicTwoDimensionalVelocity
CyclicTwoDimensionalVelocity(R: Field, d: Symbol): Exports ==
Implementation where
  G   ==> CyclicGroup(4, d)
  Exports ==> MonoidAction(G) with
    construct: (R, R) -> %
      ++ [vx,vy] constructs a 2 dim velocity element.
    first : % -> R
    second : % -> R
  Implementation ==> List R add
    Rep := List R
    D : G := first generators()$G
    construct(vx: R, vy: R): % == [vx,vy]
    first(v: %): R == v.1
    second(v: %): R == v.2
    ((g: G) * (v: %)): % ==
      g = D => [- second v, first v]
      g = D*D => [- first v,- second v]
      g = D*D*D => [second v,- first v]
      v

Seemingly no principal difference, in both cases I implement the group
action *, that's it.


-- 
Mit freundlichen Grüßen

Johannes Grabmeier

Prof. Dr. Johannes Grabmeier
Köckstraße 1, D-94469 Deggendorf
Tel. +49-(0)-991-2979584, Tel. +49-(0)-151-681-70756
Tel. +49-(0)-991-3615-141 (d),  Fax: +49-(0)-3224-192688

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fricas-devel+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to