[BACK]Return to tr-ja.oxt CVS log [TXT][DIR] Up to [local] / OpenXM / src / asir-contrib / testing

Annotation of OpenXM/src/asir-contrib/testing/tr-ja.oxt, Revision 1.6

1.6     ! takayama    1: $Id: tr.oxt,v 1.21 2005/04/15 12:42:59 taka Exp $
        !             2: $OpenXM: OpenXM/src/asir-contrib/testing/tr-ja.oxt,v 1.5 2005/04/06 09:26:28 takayama Exp $
1.1       takayama    3:
                      4: $BCm0U(B: testing/tr.rr $B$G$O(B quote $B$r(B quotetolist $B$G(B list $B$KJQ49$7$F07$&$?$a(B,
                      5:       $B2<$N;EMM$H$O$3$H$J$j(B, list $B7?$G%G!<%?$rLa$9>l9g$bB?$$(B.
                      6:       $B%f!<%68@8l$G=q$$$F$$$k4X78>e(B pn(x) $B$r(B pn("x") $B$H$7$F$$$k(B.
                      7:       $BB>$K$bF1MM$J4X?t$,$"$j(B.
                      8:
1.5       takayama    9: $B$3$N%U%!%$%k$+$i(B texi $B%U%!%$%k$r:n@.$9$k$K$O0J2<$N$h$&$KF~NO$7$F2<$5$$(B.
                     10: oxgentexi $B$O(B OpenXM/src/util $B$N2<$K$"$j$^$9(B.
                     11:
                     12: nkf -e tr.oxt | oxgentexi --noSorting --title 'Term rewriting functions for Risa/Asir' --author 'Nobuki Takayama' >t.texi
                     13:
                     14: begin: AAA01|
                     15:
                     16: @c ---------------------------------------------------------
                     17: @section $BJQ?t%Q%?!<%s$H4X?t%Q%?!<%s(B
                     18:
                     19:
                     20: $BJQ?t%Q%?!<%s(B
                     21:
                     22: pn(x)                    $BG$0U$N$b$N$K%^%C%A(B. $B%^%C%A$7$?$b$N$r(B x $B$K(B bind.
                     23: pn(x,qt_is_integer(x))
                     24:
                     25: Todo; fn $B$OB?J,$$$i$J$$(B. qt_is_function(x) $B$G(B OK.
                     26: fn(f)                    $BG$0U$N4X?t$K%^%C%A(B. $B%^%C%A$7$?4X?tL>$r(B f $B$K(B bind.
                     27: fn(f,pn(x),pn(y))        $BG$0U$N4X?t$K%^%C%A(B. $B%^%C%A$7$?4X?tL>$r(B f $B$K(B bind.
                     28:                          f $B$N0z?t$r(B x, y $B$K(B bind
                     29:
                     30:
                     31: $B%Q%?!<%s$O(B quote $B$GM?$($k(B.
                     32: $BM=Ls8l(B  tr_and, tr_or, tr_not  $B$O%Q%?!<%s$N%^%C%A$K4X$7$FO@M}1i;;$r$*$3$J$&(B.
                     33: $B$?$H$($P(B
                     34: quote(tr_and(pn(x,qt_is_integer),pn(x,qt_is_non_negative(x))))
                     35: $B$O(B x $B$,(B $B@0?t$G(B - $B$,@hF,$K$D$$$F$$$J$$>l9g%^%C%A$9$k(B.
                     36:
                     37: end:
                     38:
                     39: begin: AAA02|
1.4       takayama   40:
1.1       takayama   41: @section quote $B$KBP$9$k4pK\4X?t(B
                     42:
1.5       takayama   43: end:
                     44:
                     45:
1.4       takayama   46: begin: qt_node(Q)
1.1       takayama   47:  quote $B%G!<%?(B {Q} $B$N(B node $B$r<h$j=P$9(B.
                     48:  example: qt_node(quote(1+2*3))
1.4       takayama   49: end:
1.1       takayama   50:
                     51:
1.4       takayama   52: begin: qt_nchild(Q)
1.1       takayama   53:  quote $B%G!<%?(B {Q} $B$N(B $B;R6!$N?t$rLa$9(B.
                     54:  example: qt_nchild(quote(1+2*3))     2 $B$rLa$9(B.
1.4       takayama   55: end:
1.1       takayama   56:
                     57:
1.4       takayama   58: begin: qt_child(Q,K)
1.1       takayama   59:  quote $B%G!<%?(B {Q} $B$N(B {K} $BHVL\$N;R6!$rLa$9(B.
                     60:  example: qt_child(quote(1+2*3),1)     quote(2*3) $B$rLa$9(B.
1.3       takayama   61:  example: qt_child(quote(1+2*3),0)     quote(1) $B$rLa$9(B.
1.4       takayama   62: end:
1.1       takayama   63:
                     64: @c --------------------------------------------------------------------
                     65: @subsection quote $B$KBP$9$k=R8l(B
                     66:
1.4       takayama   67: begin: qt_is_integer(Q)
1.1       takayama   68:  quote $B%G!<%?(B {Q} $B$,@0?t$J$i(B 1
                     69:  example: qt_is_integer(quote(0))
1.4       takayama   70: end:
1.1       takayama   71:
1.6     ! takayama   72: begin: qt_is_dependent(Q,x)
1.1       takayama   73:  quote $B%G!<%?(B {Q} $B$,ITDj85(B {x} $B$r4^$`$H(B 1, $B4^$^$J$$$H(B 0.
1.6     ! takayama   74:  example: qt_is_dependent(quote(1+1/x),x)
1.4       takayama   75: end:
                     76:
                     77: begin: qt_is_function(Q)
                     78:  quote $B%G!<%?(B {Q} $B$,4X?t$N$H$-(B 1, $B$=$&$G$J$$$H$-(B 0.
                     79:  example: qt_is_function(f(x,y));
                     80: end:
1.1       takayama   81:
                     82: @c --------------------------------------------------------------------
                     83: @subsection quote $B$KBP$9$k%3%s%9%H%i%/%?(B
                     84:
1.4       takayama   85: begin: qt_zero()
1.1       takayama   86:  quote 0 $B$rLa$9(B.
1.4       takayama   87: end:
1.1       takayama   88:
1.4       takayama   89: begin: qt_id(Qobj)
1.1       takayama   90:  quote object {Qobj} $B$r$=$N$^$^La$9(B.
1.4       takayama   91: end:
1.1       takayama   92:
1.4       takayama   93: begin: qt_replace(Qobj,[[x,Valuex],[y,Valuey],...])
1.1       takayama   94:    quote object {Qobj} $B$NCf$N(B x $B$r(B Valuex, y $B$r(B Valuey, ... $B$KCV$-49$($?(B
                     95:    quote object $B$rLa$9(B.
1.5       takayama   96:    description:
                     97:     $B2]Bj(B; x, y $B$OBgJ8;z$b5v$9$+(B? @var{Qobj} $B$b85!94^$^$l$F$$$kBgJ8;z$rI>2A$7$FCV$-49$($k(B
                     98:     $B4X?t$bI,MW$+(B?
                     99:
1.3       takayama  100:    example: qt_replace(quote(sin(x*@pi)), [[x,quote( (2*t+3) )]])
1.4       takayama  101: end:
1.1       takayama  102:
1.3       takayama  103:    qt_replace $B$O(B asir-contrib $B$N(B base_replace $B$H;w$?5!G=(B.
                    104:    quote $B$NFbIt$KBgJ8;z$G$O$8$^$kJQ?t(B($BI>2A$9$k(B)$B$,=q$1$J$$$?$a(B.
                    105:
1.4       takayama  106: begin: qt_parenthesis(Qobj)
1.1       takayama  107:    quote object {Qobj} $B$NCf$N3g8L$,B-$j$J$$$H$-$K$OJd$$(B, $BB?$$$H$-$K$O<h$j5n$C$?(B
                    108:    quote object $B$r:n$k(B.
1.3       takayama  109:    +, *, /, ^, - $BEy$K$D$$$F(B asir $B$NJ8K!$G$N1i;;;R$N6/$5$r2>Dj$9$k(B.
1.5       takayama  110:   description:
                    111:   $B;29M(B;
                    112:    noro_simplify.rr  $B$N(B @code{remove_paren()} $B$,$9$G$K<B8=$E$_(B?
                    113:    @code{flatten()} $B$d(B @code{quote_to_funargs()} $B$rMxMQ$7$F$kLOMM(B.
                    114:
1.4       takayama  115: end:
1.1       takayama  116:
1.4       takayama  117: begin: qt_eval(Qobj,type)
1.2       takayama  118:    Qobj $B$r(B asir $B$NB>$N(B object $B$KJQ49(B.
1.5       takayama  119:   description:
                    120:    @code{eval_quote()} $B$,$9$G$K<B8=$E$_(B.
                    121:
1.4       takayama  122: end:
1.2       takayama  123:
1.4       takayama  124: begin: qt_(Obj)
1.2       takayama  125:    asir $B$N(B Obj $B$r(B quote $B7?$KJQ49(B.
1.5       takayama  126:    description:
                    127:      @code{objtoquote()} $B$,$9$G$K<B8=$E$_(B.
                    128:
1.4       takayama  129: end:
1.2       takayama  130:
1.1       takayama  131:
1.5       takayama  132: begin: tr|
                    133:
1.1       takayama  134: @c --------------------------------------------------------------------
                    135: @section tr (term rewriting) $B$N%H%C%W%l%Y%k$N4X?t(B
                    136:
1.5       takayama  137: end:
                    138:
1.4       takayama  139: begin: tr_match0(Qobj,P)
1.1       takayama  140:  quote $B%G!<%?(B {Qobj} $B$,(B $B%Q%?!<%s(B {P} $B$KE,9g$9$l$P(B 1 $B$rLa$7(B, $B$=$&$G$J$1$l$P(B 0
                    141:  $B$rLa$9(B.
1.3       takayama  142:  example: tr_match0(quote(1+2*3),quote(pn(x)+pn(y)))
                    143:                  x $B$K(B quote(1), y $B$K(B quote(2*3)
                    144:           tr_match0(quote(1+2*3),quote(pn(x)+pn(y,qt_is_integer,y)))
                    145:                  qt_is_integer(2*3) $B$O(B 0 $B$J$N$G(B y $B$K$O%^%C%A$7$J$$(B.
1.4       takayama  146: end:
1.1       takayama  147:
1.4       takayama  148: begin: pn(X)
                    149:   pn(x) $B$OG$0U$N(B quote object $B$K%^%C%A$7(B, $BL>A0(B x $B$r$D$1$k(B.
                    150: description:
                    151:   tr_match0(quote(1+2*3),quote(pn(x)+pn(y)))  $B$O(B 1 $B$rLa$9$,(B,
                    152:   tr_match0(quote(1+2*3),quote(pn(x)+pn(y,tr_is_integer,x))) $B$O(B 0 $B$r$b$I$9(B.
                    153:   2*3 $B$O(B integer $B$+$i:n$i$l$?(B fnode $B$G$O$"$k$,(B integer $B$G$O$J$$$N$G(B qt_is_integer
                    154:   $B$,(B 0 $B$rLa$9$?$a(B.
                    155: end:
1.1       takayama  156:
1.4       takayama  157: begin: tr_match0_act(Qobj,P,Act)
1.1       takayama  158:  quote $B%G!<%?(B {Qobj} $B$,(B $B%Q%?!<%s(B {P} $B$KE,9g$9$l$P(B {Act} $B$r8F$S=P$7$=$NCM$rLa$9(B.
                    159:  $B%Q%?!<%s(B {P} $B$K%^%C%A$7$J$$$H$-$O(B 0.
                    160:
1.4       takayama  161:  example: tr_match0_act(quote(1+2*3),quote(pn(x)+pn(y)),[myadd,x,y])
                    162: end:
1.1       takayama  163:
1.4       takayama  164: begin: tr_or_match0_act(Qobj,Rules)
                    165: end:
1.1       takayama  166:
1.4       takayama  167: begin: tr_apply_rule1(Qobj,P,Act)
1.1       takayama  168:  quote $B%G!<%?(B {Qobj} $B$NLZ$rI}M%@hC5:w$7(B,
                    169:  $B%Q%?!<%s(B {P} $B$KE,9g$9$k$b$N$,$"$k$H$-$O(B {Act} $B$r8F$S=P$7$=$NCM$rLa$9(B.
                    170:  $B$D$^$j(B top node $B$,(B {P} $B$KE,9g$9$k$+D4$Y(B, $BE,9g$7$J$$>l9g$O$=$N;R6!$K(B
1.3       takayama  171:   tr_apply_rule1 $B$rE,MQ$9$k(B ($B$3$3$,(B tr_match_act $B$H$O0[$J$k(B).
1.1       takayama  172:  $B%^%C%A$7$J$$>l9g$O(B Qobj $B$r$=$N$^$^La$9(B ($B$3$l$,:F5"E*$KE,MQ$5$l$k(B).
                    173:
1.4       takayama  174: description:
1.3       takayama  175:  $B$3$3$G(B sin_int(X) $B$O(B X $B$,(B integer $B$N;~$O(B quote(0) $B$rLa$7(B,
1.5       takayama  176:  $B$=$&$G$J$$$H$-$O(B quote(sin(X*@@pi)) $B$rLa$9(B.
1.1       takayama  177:  $B?<$5M%@h$G=q$-49$($r$9$k$K$O(B $B4X?t(B sin_int $B$NCf$G$^$?(B tr_apply_rule1 $B$r8F$S=P$;$P(B
                    178:  $B$h$$(B.
                    179:
1.4       takayama  180:  example: tr_apply_rule1(quote(1+sin(2*@pi)),quote(sin(pn(x)*@pi)),[sin_int,x])
                    181: end:
                    182:
                    183:
                    184: begin: tr_apply_or_rules(Qobj,Rules)
                    185: end:
1.1       takayama  186:
1.2       takayama  187: @subsection $BFbIt4X?t(B
                    188:
1.4       takayama  189: begin: tr_apply_function0(Qobj,BindingTable)
                    190: end:
1.2       takayama  191:
1.4       takayama  192: begin: tr_rp(Qobj,P,A)
                    193: end:
1.2       takayama  194:
1.4       takayama  195: begin: tr_make_binding(Qobj,P)
                    196: end:
1.2       takayama  197:
1.1       takayama  198:
1.5       takayama  199: begin: zzz00|
1.4       takayama  200:
1.5       takayama  201: @section $BNcBj(B
1.1       takayama  202:
1.4       takayama  203: end:
1.1       takayama  204:
1.5       takayama  205: begin: zzz01|
                    206: $BNcBj(B  sin($B@0?t(B*@@pi) $B$r(B 0 $B$K(B.
1.4       takayama  207: example:
1.2       takayama  208:    /* $B=`Hw(B */
                    209:    extern P,A;
                    210:    P=quote(sin(pn(x)*@pi));  /* $B%Q%?!<%s(B */
                    211:    A=[sin_int,x]             /* action, action $B4X?t(B */
                    212:    def sin_int(X) {
                    213:      X = tr_apply_rule1(X,P,A); /* $B;R6!$K(B [P,A] $B$r:F5"E*$KE,MQ(B */
                    214:      if (qt_is_integer(X)) return qt_zero();
                    215:      else qt_replace(sin(y*@pi),[[y,X]]);  /* sin(x*@pi) $B$r$=$N$^$^La$9(B.*/
                    216:    }
                    217:
                    218:    /* $B7W;;(B */
                    219:    Qobj=quote(1+sin(sin(2*@pi)*@pi)*sin((1/2)*@pi));
                    220:    tr_apply_rule1(Qobj,P,A);
1.4       takayama  221: end:
1.2       takayama  222:
1.4       takayama  223: @c ------------------------------------------------------
                    224: @section $BNcBj(B Mathematica $B$N(B N[ ] $BAjEv$N4X?t$r%f!<%6$,=q$1$k$h$&$K(B.
                    225:
1.5       takayama  226: begin: zzz02|
1.4       takayama  227: $BNcBj(B Mathematica $B$N(B N[ ] $BAjEv$N4X?t$r%f!<%6$,=q$1$k$h$&$K(B.
                    228: example:
                    229:     nn(sin(cos(@pi)+sqrt(2)))
                    230:     --> nn(sin(nn(cos(nn(@pi)))+nn(sqrt(nn(2)))))
                    231:    Prog; test1-tr.rr $B$N(B test4().
                    232:
                    233:   qt_map_arg $B4X?t$rMQ$$$k(B.
                    234:   def test4() {
                    235:     Rule=[quote(nn(pn(f))),[qt_map_arg,nn,f]];
                    236:     /* nn $B$G0O$^$l$?$b$N$,$"$l$P(B, nn $B$r$=$NFbIt$K:F5"E*$K(B apply $B$9$k(B */
                    237:     R0 = quote(nn(sin(1/2)*cos(1/3)));
                    238:     print(print_input_form(R0));
                    239:     R=tr_apply_rule1(R0,Rule[0],Rule[1]);
                    240:     return R;
                    241:   }
                    242:
                    243: end:
1.1       takayama  244:
                    245: @c ---------------------------------------------------------
                    246: @section $BNcBj(B  $BITDj@QJ,(B
                    247:
1.5       takayama  248: begin: zzz03|
1.4       takayama  249: $BNcBj(B  $BITDj@QJ,(B
                    250: example:
1.2       takayama  251:    /* integral(f+g) => integral(f)+integral(g) */
                    252:    S1=[quote(integral(pn(f)+pn(g))),
                    253:        [int_linear1,f,g]];
                    254:    def int_linear1(X,Y) {
                    255:       return qt_replace(quote(integral(f)+integral(g)),[[f,X],[g,Y]]);
                    256:    }
                    257:
                    258:    /* integral(c*f) => c*integral(f) */
                    259:    def qt_independent(F,X) { return !qt_dependent(F,X); }
                    260:    S2=[quote(integral(pn(c,qt_independent(c,x))*f)),
                    261:        [int_linear2,c,f]];
                    262:    def int_linear2(X,Y) {
                    263:       return qt_replace(quote(c*integral(f)),[[c,X],[f,Y]]);
                    264:    }
                    265:
                    266:    apply_or_rules(quote(integral(a*x^2+x+2/x)),[S1,S2]);
                    267:    $B$3$l$r$3$l0J>e=q$-49$($,5/$-$J$$$^$G7+$jJV$9(B.
                    268:    $B$3$N%k!<%k$N>l9gEz$($O(B
                    269:    a*integral(x^2)+integral(x)+integral(2/x);
                    270:
                    271:    quote(integral(x^pn(n))) --> x^(n+1)/(n+1) or log(x) $B$r=q$/(B.
1.4       takayama  272: end:
1.2       takayama  273:
1.1       takayama  274: @c ---------------------------------------------------------
                    275: @section $BNcBj(B  $B4JC1$J9=J82r@O(B
                    276:
1.5       takayama  277: begin: zzz04|sortKey: zzz04
                    278: description:
                    279:
1.4       takayama  280: $BNcBj(B  $B4JC1$J9=J82r@O(B
1.5       takayama  281:
1.4       takayama  282: example:
1.2       takayama  283:    $B<0(B(expression) $B$O(B $B<0(B+$B<0(B | $B<0(B*$B<0(B | ($B<0(B) | $B@0?t(B
                    284:
                    285:    extern R1,R2,R3,R4,S1,S2,S3,S4;
                    286:    /* $BJ8K!$rK~$?$9$+$I$&$+$N(B check $BMQ(B. Action $BIt$O(B 1 $B$+(B 0 */
                    287:    R1=[quote(pn(x,is_expression(x))+pn(y,is_expression(y))), 1];
                    288:    R2=[quote(pn(x,is_expression(x))*pn(y,is_expression(y))), 1];
                    289:    R3=[quote((pn(x,is_expression(x)))), 1];
                    290:    R4=[quote(pn(x,qt_is_integer(x))), 1];
                    291:    def is_expression(Qobj) {
                    292:      R = [R1,R2,R3,R4];
                    293:      A = apply_or_match0(Qobj,R);
                    294:      if (A == 0) return 0; else return 1;
                    295:    }
                    296:
                    297:    /* $B7W;;MQ(B. R1,R2,R3,R4 $B$H:8$O6&DL(B. */
                    298:    S1=[quote(pn(x,is_expression(x))+pn(y,is_expression(y))), [myadd,x,y]];
                    299:    S2=[quote(pn(x,is_expression(x))*pn(y,is_expression(y))), [mymul,x,y]];
                    300:    S3=[quote((pn(x,is_expression(x)))), [qt_id,x]];
                    301:    S4=[quote(pn(x,qt_is_integer(x))), [qt_id,x]];
                    302:
                    303:    def eval_expression(Qobj) {
                    304:      S = [S1,S2,S3,S4];
                    305:      return apply_or_rules(Qobj,S);
                    306:    }
                    307:
                    308:    def myadd(X,Y) {
                    309:      return qt_(qt_eval(X,1)+qt_eval(Y,1));
                    310:    }
                    311:
                    312:    def mymul(X,Y) {
                    313:      return qt_(qt_eval(X,1)*qt_eval(Y,1));
                    314:    }
                    315:
                    316:    /* $B7W;;(B */
                    317:    tr_eval_expression(quote(1+2*(3+15)));
1.4       takayama  318: end:
1.1       takayama  319:
1.5       takayama  320: begin: misc|
                    321:
                    322: @section $B9M$(J}$K$D$$$F$N35@b(B
                    323:
                    324:  $B%H%C%W%l%Y%k$N4X?tC#(B.  (stylesheet $B$N9M$($K;w$F$k(B.)
                    325:
                    326:   iterator $B$N0l<o(B.
                    327:
                    328:   yacc $B$K;w$F$k(B.
                    329:
                    330: @section $B%G%P%C%,!<(B
                    331:
                    332:   $BA*Br$9$Y$-%k!<%k$,Bt;3$"$k$H$-$O(B, $B7Y9p$9$k5!G=(B.
                    333:
                    334:   $BL58B%k!<%W$N(B|$B8!=P(B.
                    335:
                    336: end:
                    337:
                    338: begin: exp|
                    339:
                    340: @c ------------------------------------------------
                    341: @section $B<B83E*4X?t(B
                    342:
                    343: end:
                    344:
                    345: begin: qt_map_arg(F,Q)
                    346:  $B4X?t(B F $B$r(B quote $B%G!<%?(B {Q} $B$N(B $B$9$Y$F$N%N!<%I$K:F5"E*$K(B
                    347:  apply $B$7$?(B quote $B%G!<%?$rLa$9(B.
                    348:  example: qt_map_arg(nn,quote(sin(@pi)+2/3))
                    349:            nn(nn(sin(nn(@pi)))+nn(nn(2)/nn(3)))
                    350: end:
                    351:
                    352: begin: todo|
                    353:
                    354: @section  Todo
                    355:
                    356: @subsection $B%f!<%6Dj5A$NCfCV1i;;;R(B
                    357:
                    358:    tfb $B$N=q$-J}$rF3F~(B.
1.1       takayama  359:
1.5       takayama  360: @subsection $B?t3X$h$j$NNcBj(B
1.1       takayama  361:
1.5       takayama  362: $B?t3XE*$K$*$b$7$m$$NcBj$r$J$k$Y$/Bt;3MQ0U$9$k(B.
                    363: $B$3$l$i$NNcBj$KBP$7$F(B tr $B$,;n:nIJ$r:n$k$N$KM-8z$G$"$k$H$$$&$3$H$r$$$&(B.
1.1       takayama  364:
1.5       takayama  365:  $BNc(B; gcd $B7W;;$NB?9`<0(B reduction $B$r(B tr $B$G<B8=(B.
1.3       takayama  366:
1.4       takayama  367:  $BNc(B; $BQQ5i?t$N7W;;$r(B quote $B$G<B8=(B.
1.3       takayama  368:         sort $B$d(B expand $B$OAH$_9~$_$G(B.
                    369:
1.4       takayama  370:  $BNc(B; Mathematica $B$N(B Expand[], Toghether[] $BAjEv$N$b$N(B.
1.3       takayama  371:
1.4       takayama  372:  $BNc(B; D $B$N3]$1;;$r(B $B%Q%?!<%s%^%C%A$G<B8=(B.
1.5       takayama  373:     holonomic $B4X?t$r78?t$H$9$kHyJ,:nMQAG4D$G$N7W;;(B.
1.3       takayama  374:
1.4       takayama  375:  $BNc(B; (x^(1/n))^n --> x $BEy(B.
1.3       takayama  376:
1.4       takayama  377:  $BNc(B; $B5-9fHyJ,$HHyJ,4D$G$N7W;;(B.
                    378:        y''+xy=0,  y''=y^2+x $BEy(B.  index $BIU$-$NJQ?t@8@.$,I,MW(B. idxtov
1.3       takayama  379:
1.4       takayama  380:  $BNc(B; QE, $BO@M}<0(B.
1.3       takayama  381:
1.5       takayama  382:  $BNc(B; $B30@QBe?t(B.
                    383:
                    384:  $BNc(B; $B4dGH(B, $B1~MQ?t3X(B, $B?@J]$N%=%j%H%s$NK\$K$"$k$h$&$J(B fermion $BEy$NNc(B.
1.3       takayama  385:
                    386:
1.5       takayama  387:  $BNc(B;
                    388:    Bergman, George M.
                    389:    The diamond lemma for ring theory.
                    390:    Advances in Math. 29 (1978), no. 2, 178--218.
                    391:    $B$K$"$k$h$&$JHs2D49Be?t$NNc(B.
1.4       takayama  392:
                    393: end:
                    394:
1.5       takayama  395: begin: new-functions|
                    396:
1.3       takayama  397: @section   $B$^$@%9%1%C%A$N$_$N4X?t;EMM(B
                    398:
1.5       takayama  399:   qt_ltor, qt_rtol ; $BLZ$N9=B$$NJQ49(B; $BNc(B (x*y)*z --> x*(y*z)
                    400:
1.6     ! takayama  401: end:
        !           402:
        !           403: begin: idx|
1.5       takayama  404:
                    405: @subsection Index $B$D$-JQ?t(B
1.3       takayama  406:
1.6     ! takayama  407: end:
        !           408:
        !           409: begin: idxtov(X,I)
        !           410:   idxtov({X},{I}) $B$OJQ?t(B {X}_{I} $B$rLa$9(B.
        !           411:   {I} $B$O%9%+%i!<$+%j%9%H(B.
        !           412:  example:
        !           413:   idxtov(x,i)  $B$O(B x_i $B$rLa$9(B.
        !           414:  description:
        !           415:   idxtov(x,[i,j])  $B$O(B x_i_j $B$r@8@.(B.  x_i_i $B$N(B index (idx) $BB0@-(B $B$r(B [i,j] $B$K(B.
        !           416:
        !           417:   @code{util_v()} $B$H$[$\F1$8(B.
        !           418:
        !           419:   x_i $B$N(B index (idx) $BB0@-(B $B$r(B i $B$K(B.
        !           420:   base_name $BB0@-$r(B  x $B$K(B.
        !           421:   $BITDj85$NB0@-$rMxMQ$9$k$3$H$K$h$j9bB.$K(B index $B$r$H$j$@$;$F(B index $B$D$-JQ?t$N(B
        !           422:   $BBe$j$,$G$-$k(B.
        !           423:
        !           424: end:
        !           425:
        !           426: begin: vtoidx(X)
        !           427:   vtoidx(x_i) $B$O(B [x,i] $B$rLa$9(B.
        !           428: description:
        !           429:   @code{util_index()} $B$H$[$\F1MM(B.
        !           430:
        !           431:  $BB0@-$N8!:w$J$N$G9bB.(B. idx $BB0@-$,L5$$>l9g$O(B i $B$r@_Dj(B.
1.3       takayama  432:
1.6     ! takayama  433:   idxtov $B4X?t$O(B $B4X?tL>$K$b;H$($k$h$&$K$9$k(B? --> $BHyJ,4DBP1~(B.
1.3       takayama  434:
                    435:   qt_function($BL>A0(B, $B0z?t(B) --> quote($BL>A0(B($B0z?t(B)) $B$r@8@.(B.
                    436:    index $BIU$-4X?t$OHyJ,4D$N<h07$KI,MW(B.
1.6     ! takayama  437: end:
        !           438:
        !           439: begin: powerSeries|
1.3       takayama  440:
1.5       takayama  441: @subsection $BQQ5i?t(B, dp $B$N(B pretty print.
                    442:
1.3       takayama  443:   $B6R5i?t$N<h07(B, dp $B$N(B pretty print $B$N$?$a(B.
                    444:   qt_qttodp(Qobj | vlist,  order?)  quote $B$+$i(B dp $B$r:n$k(B.
                    445:        exponent $B$,?t$G$J$$$H:n$l$:(B.
                    446:   qt_dptoqt(Qobj | vlist)  dp $B$+$i(B quote $B$r:n$k(B.  vlist $B$OB0@-$GBP1~(B?
1.1       takayama  447:
1.3       takayama  448:   qt_expand, qt_sort, qt_ht, qt_rest, qt_mtov $B$b4pAC4X?t$H$7$FM_$7$$(B.
1.5       takayama  449:
                    450: end:
1.1       takayama  451:
1.6     ! takayama  452: begin: MonomialSimplifier|
        !           453:
        !           454: @subsection $B%b%N%_%"%k$rI8=`7A$X(B (builtin$B$G(B?)
        !           455:
        !           456: example:
        !           457:   x^1 --> x
        !           458:   (x*y)*(z*t) --> x*y*z*t
        !           459:   x*2*y*4     --> 8*x*y      ($B;XDj$7$?JQ?t0J30$O2D49$H$9$k(B)
        !           460:   x*x^3       --> x^4
        !           461:   x*(-y)*z    --> -x*y*z
        !           462:   ((x))       --> x   $B$3$l$O(B noro_simplify.rr noro_simplify.remove_paren() $B$,BP1~(B
        !           463:
        !           464:
        !           465: end:
        !           466:
        !           467: 4/15 $BLk(B.  $B<BAu$OL@F|9V5A$N=`Hw$N=*N;8e$+(B?
        !           468: begin: qt.gtlex(f,g)
        !           469: {f} $B$O(B {g} $B$h$j(B quote tree $B$N(B lex order $B$GBg$-$$(B.
        !           470: description:
        !           471:   quote tree $B$N(B lex order $B$O<!$N$h$&$K7h$a$k(B.
        !           472:   @itemize
        !           473:   @item $BITDj85$OITDj85$N=g=x(B.
        !           474:   @item $BITDj85$h$j(B +, - , *, /, ^ $BEy$N(B node $B$OBg$-$$(B.
        !           475:         $B$?$H$($P(B x < power(x,2)  (power(x,2) $B$O(B x^2 $B$N0UL#(B)
        !           476:   @item $B$"$H$O:F5"E*(B. times(x,y) < power(x,y) $B$@$,(B,
        !           477:         times(x,y) $B$H(B times(p,q) $B$O(B x $B$H(B p $B$NHf3S(B,  $B$3$l$G$-$^$i$J$$$J$i(B,
        !           478:         y, q $B$NHf3S(B.
        !           479:   @end itemize
        !           480:
        !           481: end:

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>