version 1.4, 2005/04/03 11:05:21 |
version 1.5, 2005/04/06 09:26:28 |
|
|
/*&generate-prologue |
/*&generate-prologue |
*/ |
*/ |
$Id$ |
$Id$ |
$OpenXM: OpenXM/src/asir-contrib/testing/tr-ja.oxt,v 1.3 2005/04/02 05:56:57 takayama Exp $ |
$OpenXM: OpenXM/src/asir-contrib/testing/tr-ja.oxt,v 1.4 2005/04/03 11:05:21 takayama Exp $ |
|
|
$BCm0U(B: testing/tr.rr $B$G$O(B quote $B$r(B quotetolist $B$G(B list $B$KJQ49$7$F07$&$?$a(B, |
$BCm0U(B: testing/tr.rr $B$G$O(B quote $B$r(B quotetolist $B$G(B list $B$KJQ49$7$F07$&$?$a(B, |
$B2<$N;EMM$H$O$3$H$J$j(B, list $B7?$G%G!<%?$rLa$9>l9g$bB?$$(B. |
$B2<$N;EMM$H$O$3$H$J$j(B, list $B7?$G%G!<%?$rLa$9>l9g$bB?$$(B. |
$B%f!<%68@8l$G=q$$$F$$$k4X78>e(B pn(x) $B$r(B pn("x") $B$H$7$F$$$k(B. |
$B%f!<%68@8l$G=q$$$F$$$k4X78>e(B pn(x) $B$r(B pn("x") $B$H$7$F$$$k(B. |
$BB>$K$bF1MM$J4X?t$,$"$j(B. |
$BB>$K$bF1MM$J4X?t$,$"$j(B. |
|
|
gentexi <tr.oxt >t.texi |
$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. |
t.texi $B$K(B |
oxgentexi $B$O(B OpenXM/src/util $B$N2<$K$"$j$^$9(B. |
\input texinfo |
|
@def@pi{PI} |
|
$B$r2C$($F$+$i(B ptex t.texi $B$G(B $BBgBN8+$l$k$,(B, |
|
|
|
cat pre.texi >t.texi |
nkf -e tr.oxt | oxgentexi --noSorting --title 'Term rewriting functions for Risa/Asir' --author 'Nobuki Takayama' >t.texi |
${OpenXM_HOME}/asir-contrib/packages/doc/gentexi tr.oxt >>t.texi |
|
echo "@bye" >>t.texi |
|
ptex t.texi |
|
$B$H$9$l$P$b$C$H%^%K%e%"%k$C$]$$$b$N$,$G$-$k(B. |
|
|
|
@c -------------------------------------------------------------------- |
begin: AAA01| |
|
|
|
@c --------------------------------------------------------- |
|
@section $BJQ?t%Q%?!<%s$H4X?t%Q%?!<%s(B |
|
|
|
|
|
$BJQ?t%Q%?!<%s(B |
|
|
|
pn(x) $BG$0U$N$b$N$K%^%C%A(B. $B%^%C%A$7$?$b$N$r(B x $B$K(B bind. |
|
pn(x,qt_is_integer(x)) |
|
|
|
Todo; fn $B$OB?J,$$$i$J$$(B. qt_is_function(x) $B$G(B OK. |
|
fn(f) $BG$0U$N4X?t$K%^%C%A(B. $B%^%C%A$7$?4X?tL>$r(B f $B$K(B bind. |
|
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. |
|
f $B$N0z?t$r(B x, y $B$K(B bind |
|
|
|
|
|
$B%Q%?!<%s$O(B quote $B$GM?$($k(B. |
|
$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. |
|
$B$?$H$($P(B |
|
quote(tr_and(pn(x,qt_is_integer),pn(x,qt_is_non_negative(x)))) |
|
$B$O(B x $B$,(B $B@0?t$G(B - $B$,@hF,$K$D$$$F$$$J$$>l9g%^%C%A$9$k(B. |
|
|
|
end: |
|
|
|
begin: AAA02| |
|
|
@section quote $B$KBP$9$k4pK\4X?t(B |
@section quote $B$KBP$9$k4pK\4X?t(B |
|
|
|
end: |
|
|
|
|
begin: qt_node(Q) |
begin: qt_node(Q) |
quote $B%G!<%?(B {Q} $B$N(B node $B$r<h$j=P$9(B. |
quote $B%G!<%?(B {Q} $B$N(B node $B$r<h$j=P$9(B. |
example: qt_node(quote(1+2*3)) |
example: qt_node(quote(1+2*3)) |
|
|
begin: qt_replace(Qobj,[[x,Valuex],[y,Valuey],...]) |
begin: qt_replace(Qobj,[[x,Valuex],[y,Valuey],...]) |
quote object {Qobj} $B$NCf$N(B x $B$r(B Valuex, y $B$r(B Valuey, ... $B$KCV$-49$($?(B |
quote object {Qobj} $B$NCf$N(B x $B$r(B Valuex, y $B$r(B Valuey, ... $B$KCV$-49$($?(B |
quote object $B$rLa$9(B. |
quote object $B$rLa$9(B. |
|
description: |
|
$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 |
|
$B4X?t$bI,MW$+(B? |
|
|
example: qt_replace(quote(sin(x*@pi)), [[x,quote( (2*t+3) )]]) |
example: qt_replace(quote(sin(x*@pi)), [[x,quote( (2*t+3) )]]) |
end: |
end: |
|
|
Line 83 begin: qt_parenthesis(Qobj) |
|
Line 109 begin: qt_parenthesis(Qobj) |
|
quote object {Qobj} $B$NCf$N3g8L$,B-$j$J$$$H$-$K$OJd$$(B, $BB?$$$H$-$K$O<h$j5n$C$?(B |
quote object {Qobj} $B$NCf$N3g8L$,B-$j$J$$$H$-$K$OJd$$(B, $BB?$$$H$-$K$O<h$j5n$C$?(B |
quote object $B$r:n$k(B. |
quote object $B$r:n$k(B. |
+, *, /, ^, - $BEy$K$D$$$F(B asir $B$NJ8K!$G$N1i;;;R$N6/$5$r2>Dj$9$k(B. |
+, *, /, ^, - $BEy$K$D$$$F(B asir $B$NJ8K!$G$N1i;;;R$N6/$5$r2>Dj$9$k(B. |
|
description: |
|
$B;29M(B; |
|
noro_simplify.rr $B$N(B @code{remove_paren()} $B$,$9$G$K<B8=$E$_(B? |
|
@code{flatten()} $B$d(B @code{quote_to_funargs()} $B$rMxMQ$7$F$kLOMM(B. |
|
|
end: |
end: |
|
|
begin: qt_eval(Qobj,type) |
begin: qt_eval(Qobj,type) |
Qobj $B$r(B asir $B$NB>$N(B object $B$KJQ49(B. |
Qobj $B$r(B asir $B$NB>$N(B object $B$KJQ49(B. |
|
description: |
|
@code{eval_quote()} $B$,$9$G$K<B8=$E$_(B. |
|
|
end: |
end: |
|
|
begin: qt_(Obj) |
begin: qt_(Obj) |
asir $B$N(B Obj $B$r(B quote $B7?$KJQ49(B. |
asir $B$N(B Obj $B$r(B quote $B7?$KJQ49(B. |
|
description: |
|
@code{objtoquote()} $B$,$9$G$K<B8=$E$_(B. |
|
|
end: |
end: |
|
|
|
|
|
begin: tr| |
|
|
@c -------------------------------------------------------------------- |
@c -------------------------------------------------------------------- |
@section tr (term rewriting) $B$N%H%C%W%l%Y%k$N4X?t(B |
@section tr (term rewriting) $B$N%H%C%W%l%Y%k$N4X?t(B |
|
|
|
end: |
|
|
begin: tr_match0(Qobj,P) |
begin: tr_match0(Qobj,P) |
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 |
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 |
$B$rLa$9(B. |
$B$rLa$9(B. |
Line 134 begin: tr_apply_rule1(Qobj,P,Act) |
|
Line 175 begin: tr_apply_rule1(Qobj,P,Act) |
|
|
|
description: |
description: |
$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, |
$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, |
$B$=$&$G$J$$$H$-$O(B quote(sin(X*@pi)) $B$rLa$9(B. |
$B$=$&$G$J$$$H$-$O(B quote(sin(X*@@pi)) $B$rLa$9(B. |
$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 |
$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 |
$B$h$$(B. |
$B$h$$(B. |
|
|
|
|
begin: tr_make_binding(Qobj,P) |
begin: tr_make_binding(Qobj,P) |
end: |
end: |
|
|
@c --------------------------------------------------------- |
|
@section $BJQ?t%Q%?!<%s$H4X?t%Q%?!<%s(B |
|
|
|
begin: remark_on_pn() |
begin: zzz00| |
$BJQ?t%Q%?!<%s(B |
|
example: |
|
pn(x) $BG$0U$N$b$N$K%^%C%A(B. $B%^%C%A$7$?$b$N$r(B x $B$K(B bind. |
|
pn(x,qt_is_integer(x)) |
|
|
|
Todo; fn $B$OB?J,$$$i$J$$(B. qt_is_function(x) $B$G(B OK. |
@section $BNcBj(B |
fn(f) $BG$0U$N4X?t$K%^%C%A(B. $B%^%C%A$7$?4X?tL>$r(B f $B$K(B bind. |
|
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. |
|
f $B$N0z?t$r(B x, y $B$K(B bind |
|
end: |
|
|
|
@c --------------------------------------------------------- |
|
@section $B%Q%?!<%s(B |
|
|
|
begin: remark_pattern() |
|
$B%Q%?!<%s$O(B quote $B$GM?$($k(B. |
|
$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. |
|
$B$?$H$($P(B |
|
quote(tr_and(pn(x,qt_is_integer),pn(x,qt_is_non_negative(x)))) |
|
$B$O(B x $B$,(B $B@0?t$G(B - $B$,@hF,$K$D$$$F$$$J$$>l9g%^%C%A$9$k(B. |
|
end: |
end: |
|
|
@c --------------------------------------------------------- |
begin: zzz01| |
@section $BNcBj(B sin($B@0?t(B*@pi) $B$r(B 0 $B$K(B. |
$BNcBj(B sin($B@0?t(B*@@pi) $B$r(B 0 $B$K(B. |
|
|
begin: example_sin_int(); |
|
$BNcBj(B sin($B@0?t(B*@pi) $B$r(B 0 $B$K(B. |
|
example: |
example: |
/* $B=`Hw(B */ |
/* $B=`Hw(B */ |
extern P,A; |
extern P,A; |
|
|
@c ------------------------------------------------------ |
@c ------------------------------------------------------ |
@section $BNcBj(B Mathematica $B$N(B N[ ] $BAjEv$N4X?t$r%f!<%6$,=q$1$k$h$&$K(B. |
@section $BNcBj(B Mathematica $B$N(B N[ ] $BAjEv$N4X?t$r%f!<%6$,=q$1$k$h$&$K(B. |
|
|
begin: example_Mathematica_N() |
begin: zzz02| |
$BNcBj(B Mathematica $B$N(B N[ ] $BAjEv$N4X?t$r%f!<%6$,=q$1$k$h$&$K(B. |
$BNcBj(B Mathematica $B$N(B N[ ] $BAjEv$N4X?t$r%f!<%6$,=q$1$k$h$&$K(B. |
example: |
example: |
nn(sin(cos(@pi)+sqrt(2))) |
nn(sin(cos(@pi)+sqrt(2))) |
|
|
@c --------------------------------------------------------- |
@c --------------------------------------------------------- |
@section $BNcBj(B $BITDj@QJ,(B |
@section $BNcBj(B $BITDj@QJ,(B |
|
|
begin: example_indefinite_integral() |
begin: zzz03| |
$BNcBj(B $BITDj@QJ,(B |
$BNcBj(B $BITDj@QJ,(B |
example: |
example: |
/* integral(f+g) => integral(f)+integral(g) */ |
/* integral(f+g) => integral(f)+integral(g) */ |
|
|
@c --------------------------------------------------------- |
@c --------------------------------------------------------- |
@section $BNcBj(B $B4JC1$J9=J82r@O(B |
@section $BNcBj(B $B4JC1$J9=J82r@O(B |
|
|
begin: example_parsing() |
begin: zzz04|sortKey: zzz04 |
|
description: |
|
|
$BNcBj(B $B4JC1$J9=J82r@O(B |
$BNcBj(B $B4JC1$J9=J82r@O(B |
|
|
example: |
example: |
$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 |
$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 |
|
|
|
|
tr_eval_expression(quote(1+2*(3+15))); |
tr_eval_expression(quote(1+2*(3+15))); |
end: |
end: |
|
|
@c --------------------------------------------------------- |
begin: misc| |
@section $BNcBj(B $BHs2D494D$N4JC1$J9=J82r@O(B |
|
|
|
|
@section $B9M$(J}$K$D$$$F$N35@b(B |
|
|
|
$B%H%C%W%l%Y%k$N4X?tC#(B. (stylesheet $B$N9M$($K;w$F$k(B.) |
|
|
@section Todo; |
iterator $B$N0l<o(B. |
|
|
|
yacc $B$K;w$F$k(B. |
|
|
|
@section $B%G%P%C%,!<(B |
|
|
|
$BA*Br$9$Y$-%k!<%k$,Bt;3$"$k$H$-$O(B, $B7Y9p$9$k5!G=(B. |
|
|
|
$BL58B%k!<%W$N(B|$B8!=P(B. |
|
|
|
end: |
|
|
|
begin: exp| |
|
|
|
@c ------------------------------------------------ |
|
@section $B<B83E*4X?t(B |
|
|
|
end: |
|
|
|
begin: qt_map_arg(F,Q) |
|
$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 |
|
apply $B$7$?(B quote $B%G!<%?$rLa$9(B. |
|
example: qt_map_arg(nn,quote(sin(@pi)+2/3)) |
|
nn(nn(sin(nn(@pi)))+nn(nn(2)/nn(3))) |
|
end: |
|
|
|
begin: todo| |
|
|
|
@section Todo |
|
|
|
@subsection $B%f!<%6Dj5A$NCfCV1i;;;R(B |
|
|
|
tfb $B$N=q$-J}$rF3F~(B. |
|
|
|
@subsection $B?t3X$h$j$NNcBj(B |
|
|
|
$B?t3XE*$K$*$b$7$m$$NcBj$r$J$k$Y$/Bt;3MQ0U$9$k(B. |
|
$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. |
|
|
|
$BNc(B; gcd $B7W;;$NB?9`<0(B reduction $B$r(B tr $B$G<B8=(B. |
|
|
$BNc(B; $BQQ5i?t$N7W;;$r(B quote $B$G<B8=(B. |
$BNc(B; $BQQ5i?t$N7W;;$r(B quote $B$G<B8=(B. |
sort $B$d(B expand $B$OAH$_9~$_$G(B. |
sort $B$d(B expand $B$OAH$_9~$_$G(B. |
|
|
$BNc(B; Mathematica $B$N(B Expand[], Toghether[] $BAjEv$N$b$N(B. |
$BNc(B; Mathematica $B$N(B Expand[], Toghether[] $BAjEv$N$b$N(B. |
|
|
$BNc(B; D $B$N3]$1;;$r(B $B%Q%?!<%s%^%C%A$G<B8=(B. |
$BNc(B; D $B$N3]$1;;$r(B $B%Q%?!<%s%^%C%A$G<B8=(B. |
|
holonomic $B4X?t$r78?t$H$9$kHyJ,:nMQAG4D$G$N7W;;(B. |
|
|
$BNc(B; (x^(1/n))^n --> x $BEy(B. |
$BNc(B; (x^(1/n))^n --> x $BEy(B. |
|
|
|
|
|
|
$BNc(B; QE, $BO@M}<0(B. |
$BNc(B; QE, $BO@M}<0(B. |
|
|
@section $B9M$(J}$K$D$$$F$N35@b(B |
$BNc(B; $B30@QBe?t(B. |
|
|
$B%H%C%W%l%Y%k$N4X?tC#(B. (stylesheet $B$N9M$($K;w$F$k(B.) |
$BNc(B; $B4dGH(B, $B1~MQ?t3X(B, $B?@J]$N%=%j%H%s$NK\$K$"$k$h$&$J(B fermion $BEy$NNc(B. |
iterator $B$N0l<o(B. |
|
|
|
@c ------------------------------------------------ |
|
@section $B<B83E*4X?t(B |
|
|
|
begin: qt_map_arg(F,Q) |
$BNc(B; |
$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 |
Bergman, George M. |
apply $B$7$?(B quote $B%G!<%?$rLa$9(B. |
The diamond lemma for ring theory. |
example: qt_map_arg(nn,quote(sin(@pi)+2/3)) |
Advances in Math. 29 (1978), no. 2, 178--218. |
nn(nn(sin(nn(@pi)))+nn(nn(2)/nn(3))) |
$B$K$"$k$h$&$JHs2D49Be?t$NNc(B. |
|
|
end: |
end: |
|
|
|
begin: new-functions| |
|
|
@section $B$^$@%9%1%C%A$N$_$N4X?t;EMM(B |
@section $B$^$@%9%1%C%A$N$_$N4X?t;EMM(B |
|
|
qt_ltor, qt_rtol : $BLZ$N9=B$$NJQ49(B; $BNc(B (x*y)*z --> x*(y*z) |
qt_ltor, qt_rtol ; $BLZ$N9=B$$NJQ49(B; $BNc(B (x*y)*z --> x*(y*z) |
|
|
|
|
|
@subsection Index $B$D$-JQ?t(B |
|
|
idxtov(x,i) x_i $B$r@8@.(B. x_i $B$N(B index (idx) $BB0@-(B $B$r(B i $B$K(B. |
idxtov(x,i) x_i $B$r@8@.(B. x_i $B$N(B index (idx) $BB0@-(B $B$r(B i $B$K(B. |
base_name $BB0@-$r(B x $B$K(B. |
base_name $BB0@-$r(B x $B$K(B. |
idxtov(x,[i,j]) 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. |
idxtov(x,[i,j]) 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. |
|
|
qt_function($BL>A0(B, $B0z?t(B) --> quote($BL>A0(B($B0z?t(B)) $B$r@8@.(B. |
qt_function($BL>A0(B, $B0z?t(B) --> quote($BL>A0(B($B0z?t(B)) $B$r@8@.(B. |
index $BIU$-4X?t$OHyJ,4D$N<h07$KI,MW(B. |
index $BIU$-4X?t$OHyJ,4D$N<h07$KI,MW(B. |
|
|
|
@subsection $BQQ5i?t(B, dp $B$N(B pretty print. |
|
|
$B6R5i?t$N<h07(B, dp $B$N(B pretty print $B$N$?$a(B. |
$B6R5i?t$N<h07(B, dp $B$N(B pretty print $B$N$?$a(B. |
qt_qttodp(Qobj | vlist, order?) quote $B$+$i(B dp $B$r:n$k(B. |
qt_qttodp(Qobj | vlist, order?) quote $B$+$i(B dp $B$r:n$k(B. |
exponent $B$,?t$G$J$$$H:n$l$:(B. |
exponent $B$,?t$G$J$$$H:n$l$:(B. |
qt_dptoqt(Qobj | vlist) dp $B$+$i(B quote $B$r:n$k(B. vlist $B$OB0@-$GBP1~(B? |
qt_dptoqt(Qobj | vlist) dp $B$+$i(B quote $B$r:n$k(B. vlist $B$OB0@-$GBP1~(B? |
|
|
qt_expand, qt_sort, qt_ht, qt_rest, qt_mtov $B$b4pAC4X?t$H$7$FM_$7$$(B. |
qt_expand, qt_sort, qt_ht, qt_rest, qt_mtov $B$b4pAC4X?t$H$7$FM_$7$$(B. |
|
|
|
end: |
|
|
/*&generate-epilogue |
/*&generate-epilogue |
*/ |
*/ |