1.1 --- a/test/Tools/isac/Knowledge/rational-2.sml Sun Oct 09 06:53:03 2022 +0200
1.2 +++ b/test/Tools/isac/Knowledge/rational-2.sml Sun Oct 09 07:44:22 2022 +0200
1.3 @@ -44,7 +44,7 @@
1.4 "-------- integration lev.1 fun factout_p_ -----------------------------------";
1.5 "-------- integration lev.1 fun factout_p_ -----------------------------------";
1.6 "-------- integration lev.1 fun factout_p_ -----------------------------------";
1.7 -val t = TermC.str2term "(x \<up> 2 + - 1*y \<up> 2) / (x \<up> 2 + - 1*x*y)"
1.8 +val t = TermC.parse_test @{context} "(x \<up> 2 + - 1*y \<up> 2) / (x \<up> 2 + - 1*x*y)"
1.9 val SOME (t', asm) = factout_p_ thy t;
1.10 if UnparseC.term t' = "(x + y) * (x + - 1 * y) / (x * (x + - 1 * y))"
1.11 then () else error ("factout_p_ term 1 changed: " ^ UnparseC.term t')
1.12 @@ -52,10 +52,10 @@
1.13 if UnparseC.terms asm = "[\"x \<noteq> 0\", \"x + - 1 * y \<noteq> 0\"]"
1.14 then () else error "factout_p_ asm 1 changed"
1.15 ;
1.16 -val t = TermC.str2term "nothing + to_cancel ::real";
1.17 +val t = TermC.parse_test @{context} "nothing + to_cancel ::real";
1.18 if NONE = factout_p_ thy t then () else error "factout_p_ doesn't report non-applicable";
1.19 ;
1.20 -val t = TermC.str2term "((3 * x \<up> 2 + 6 *x + 3) / (2*x + 2))";
1.21 +val t = TermC.parse_test @{context} "((3 * x \<up> 2 + 6 *x + 3) / (2*x + 2))";
1.22 val SOME (t', asm) = factout_p_ thy t;
1.23 if UnparseC.term t' = "(3 + 3 * x) * (1 + x) / (2 * (1 + x))" andalso
1.24 UnparseC.terms asm = "[\"1 + x \<noteq> 0\"]"
1.25 @@ -64,15 +64,15 @@
1.26 "-------- integration lev.1 fun cancel_p_ ------------------------------------";
1.27 "-------- integration lev.1 fun cancel_p_ ------------------------------------";
1.28 "-------- integration lev.1 fun cancel_p_ ------------------------------------";
1.29 -val t = TermC.str2term "(x \<up> 2 + - 1*y \<up> 2) / (x \<up> 2 + - 1*x*y)"
1.30 +val t = TermC.parse_test @{context} "(x \<up> 2 + - 1*y \<up> 2) / (x \<up> 2 + - 1*x*y)"
1.31 val SOME (t', asm) = cancel_p_ thy t;
1.32 if (UnparseC.term t', UnparseC.terms asm) = ("(x + y) / x", "[\"x \<noteq> 0\"]")
1.33 then () else error ("cancel_p_ (t', asm) 1 changed: " ^ UnparseC.term t')
1.34 ;
1.35 -val t = TermC.str2term "nothing + to_cancel ::real";
1.36 +val t = TermC.parse_test @{context} "nothing + to_cancel ::real";
1.37 if NONE = cancel_p_ thy t then () else error "cancel_p_ doesn't report non-applicable";
1.38 ;
1.39 -val t = TermC.str2term "((3 * x \<up> 2 + 6 *x + 3) / (2*x + 2))";
1.40 +val t = TermC.parse_test @{context} "((3 * x \<up> 2 + 6 *x + 3) / (2*x + 2))";
1.41 val SOME (t', asm) = cancel_p_ thy t;
1.42 if UnparseC.term t' = "(3 + 3 * x) / 2" andalso UnparseC.terms asm = "[]"
1.43 then () else error "cancel_p_ 1 changed";
1.44 @@ -80,7 +80,7 @@
1.45 "-------- integration lev.1 fun common_nominator_p_ --------------------------";
1.46 "-------- integration lev.1 fun common_nominator_p_ --------------------------";
1.47 "-------- integration lev.1 fun common_nominator_p_ --------------------------";
1.48 -val t = TermC.str2term ("y / (a*x + b*x + c*x) " ^
1.49 +val t = TermC.parse_test @{context} ("y / (a*x + b*x + c*x) " ^
1.50 (* n1 d1 *)
1.51 "+ a / (x*y)");
1.52 (* n2 d2 *)
1.53 @@ -95,7 +95,7 @@
1.54 then () else error "common_nominator_p_ asm 1 changed"
1.55
1.56 "-------- example in mail Nipkow";
1.57 -val t = TermC.str2term "x/(x \<up> 2 + - 1*y \<up> 2) + y/(x \<up> 2 + - 1*x*y)";
1.58 +val t = TermC.parse_test @{context} "x/(x \<up> 2 + - 1*y \<up> 2) + y/(x \<up> 2 + - 1*x*y)";
1.59 val SOME (t', asm) = common_nominator_p_ thy t;
1.60 if UnparseC.term t' =
1.61 "x * x / ((x + - 1 * y) * ((x + y) * x)) +\ny * (x + y) / ((x + - 1 * y) * ((x + y) * x))"
1.62 @@ -105,10 +105,10 @@
1.63 then () else error "common_nominator_p_ asm 2 changed"
1.64
1.65 "-------- example: applicable tested by SML code";
1.66 -val t = TermC.str2term "nothing / to_add";
1.67 +val t = TermC.parse_test @{context} "nothing / to_add";
1.68 if NONE = common_nominator_p_ thy t then () else error "common_nominator_p_ term 3 changed";
1.69 ;
1.70 -val t = TermC.str2term "((x + (- 1)) / (x + 1)) + ((x + 1) / (x + (- 1)))";
1.71 +val t = TermC.parse_test @{context} "((x + (- 1)) / (x + 1)) + ((x + 1) / (x + (- 1)))";
1.72 val SOME (t', asm) = common_nominator_p_ thy t;
1.73 if UnparseC.term t' =
1.74 "(x + - 1) * (- 1 + x) / ((1 + x) * (- 1 + x)) +\n(x + 1) * (1 + x) / ((1 + x) * (- 1 + x))"
1.75 @@ -118,7 +118,7 @@
1.76 "-------- integration lev.1 fun add_fraction_p_ ------------------------------";
1.77 "-------- integration lev.1 fun add_fraction_p_ ------------------------------";
1.78 "-------- integration lev.1 fun add_fraction_p_ ------------------------------";
1.79 -val t = TermC.str2term "((x + (- 1)) / (x + 1)) + ((x + 1) / (x + (- 1)))";
1.80 +val t = TermC.parse_test @{context} "((x + (- 1)) / (x + 1)) + ((x + 1) / (x + (- 1)))";
1.81 val SOME (t', asm) = add_fraction_p_ thy t;
1.82 if UnparseC.term t' = "(2 + 2 * x \<up> 2) / (- 1 + x \<up> 2)"
1.83 then () else error "add_fraction_p_ 3 changed";
1.84 @@ -126,10 +126,10 @@
1.85 if UnparseC.terms asm = "[\"- 1 + x \<up> 2 \<noteq> 0\"]"
1.86 then () else error "add_fraction_p_ 3 changed";
1.87 ;
1.88 -val t = TermC.str2term "nothing / to_add";
1.89 +val t = TermC.parse_test @{context} "nothing / to_add";
1.90 if NONE = add_fraction_p_ thy t then () else error "add_fraction_p_ term 3 changed";
1.91 ;
1.92 -val t = TermC.str2term "((x + (- 1)) / (x + 1)) + ((x + 1) / (x + (- 1)))";
1.93 +val t = TermC.parse_test @{context} "((x + (- 1)) / (x + 1)) + ((x + 1) / (x + (- 1)))";
1.94 val SOME (t', asm) = add_fraction_p_ thy t;
1.95 if UnparseC.term t' = "(2 + 2 * x \<up> 2) / (- 1 + x \<up> 2)" andalso
1.96 UnparseC.terms asm = "[\"- 1 + x \<up> 2 \<noteq> 0\"]"
1.97 @@ -142,7 +142,7 @@
1.98 (which does not to work, because substitution is not done -- compare rew_sub!);
1.99 keep this sequence for the case, factout_p, cancel_p, common_nominator_p, add_fraction_p
1.100 (again) get prepat = [] changed to <>[]. *)
1.101 -val t = TermC.str2term "(x \<up> 2 + - 1*y \<up> 2) / (x \<up> 2 + - 1*x*y)";
1.102 +val t = TermC.parse_test @{context} "(x \<up> 2 + - 1*y \<up> 2) / (x \<up> 2 + - 1*x*y)";
1.103
1.104 (*rewrite_set_ @{theory Isac_Knowledge} true cancel t = NONE; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*)
1.105 "~~~~~ fun rewrite_set_, args:"; val (thy, bool, rls, term) = (thy, false, cancel_p, t);
1.106 @@ -219,13 +219,13 @@
1.107 "-------- fun rewrite_set_ cancel_p downto fun gcd_poly ----------------------";
1.108 "-------- fun rewrite_set_ cancel_p downto fun gcd_poly ----------------------";
1.109 "-------- fun rewrite_set_ cancel_p downto fun gcd_poly ----------------------";
1.110 -val t = TermC.str2term "(12 * x * y) / (8 * y \<up> 2 )";
1.111 +val t = TermC.parse_test @{context} "(12 * x * y) / (8 * y \<up> 2 )";
1.112 (* "-------- example 187a": exception Div raised...
1.113 val SOME (t', asm) = rewrite_set_ thy false cancel_p t;*)
1.114 -val t = TermC.str2term "(8 * x \<up> 2 * y * z ) / (18 * x * y \<up> 2 * z )";
1.115 +val t = TermC.parse_test @{context} "(8 * x \<up> 2 * y * z ) / (18 * x * y \<up> 2 * z )";
1.116 (* "-------- example 187b": doesn't terminate...
1.117 val SOME (t', asm) = rewrite_set_ thy false cancel_p t;*)
1.118 -val t = TermC.str2term "(9 * x \<up> 5 * y \<up> 2 * z \<up> 4) / (15 * x \<up> 6 * y \<up> 3 * z )";
1.119 +val t = TermC.parse_test @{context} "(9 * x \<up> 5 * y \<up> 2 * z \<up> 4) / (15 * x \<up> 6 * y \<up> 3 * z )";
1.120 (* "-------- example 187c": doesn't terminate...
1.121 val SOME (t', asm) = rewrite_set_ thy false cancel_p t;*)
1.122 "~~~~~ fun rewrite_set_, args:"; val (thy, bool, rls, term) = (@{theory Isac_Knowledge}, false, cancel_p, t);
1.123 @@ -274,14 +274,14 @@
1.124 "-------- rls norm_Rational downto fun gcd_poly ------------------------------";
1.125 "-------- rls norm_Rational downto fun gcd_poly ------------------------------";
1.126 "-------- rls norm_Rational downto fun gcd_poly ------------------------------";
1.127 -val t = TermC.str2term "(x \<up> 2 - 4)*(3 - y) / ((y \<up> 2 - 9)*(2+x))";
1.128 +val t = TermC.parse_test @{context} "(x \<up> 2 - 4)*(3 - y) / ((y \<up> 2 - 9)*(2+x))";
1.129 (* trace_rewrite stops with ...: (and then jEdit hangs)..
1.130 rewrite_set_ thy false norm_Rational t;
1.131 :
1.132 ### rls: cancel_p on: (- 12 + 4 * y + 3 * x \<up> 2 + - 1 * (x \<up> 2 * y)) /
1.133 (- 18 + -9 * x + 2 * y \<up> 2 + x * y \<up> 2)
1.134 *)
1.135 -val t = TermC.str2term (*copy from above: "::real" is not required due to " \<up> "*)
1.136 +val t = TermC.parse_test @{context} (*copy from above: "::real" is not required due to " \<up> "*)
1.137 ("(- 12 + 4 * y + 3 * x \<up> 2 + - 1 * (x \<up> 2 * y)) /" ^
1.138 "(- 18 + -9 * x + 2 * y \<up> 2 + x * y \<up> 2)");
1.139 (*cancel_p_ thy t;
1.140 @@ -307,7 +307,7 @@
1.141 "-------- rls norm_Rational downto fun add_fraction_p_ -----------------------";
1.142 val thy = @{theory Isac_Knowledge};
1.143 "----- SK060904- 2a non-termination of add_fraction_p_";
1.144 -val t = TermC.str2term (" (a + b * x) / (a + - 1 * (b * x)) + " ^
1.145 +val t = TermC.parse_test @{context} (" (a + b * x) / (a + - 1 * (b * x)) + " ^
1.146 " (- 1 * a + b * x) / (a + b * x) ");
1.147 (* rewrite_set_ thy false norm_Rational t
1.148 exception Div raised*)
1.149 @@ -429,7 +429,7 @@
1.150 (* Rewrite.trace_on:
1.151 add_fractions_p on: 3 = A / 2 + A / 4 + (B / 2 + - 1 * B / 2) --> 3 = A / 2 + A / 4 + 0 / 2 *)
1.152 (* |||||||||||||||||||||||||||| *)
1.153 -val t = TermC.str2term (* ||||||||||||||||||||||||| *)
1.154 +val t = TermC.parse_test @{context} (* ||||||||||||||||||||||||| *)
1.155 "AA / 4 + (BB / 2 + - 1 * BB / 2)";
1.156 "~~~~~ fun add_fraction_p_ , ad-hoc args:"; val (t) = (t);
1.157 val SOME ((n1, d1), (n2, d2)) = (*case*) check_frac_sum t (*of*);
1.158 @@ -456,26 +456,26 @@
1.159 "-------- rewrite_set_ cancel_p from: Mathematik 1 Schalk Reniets Verlag -----";
1.160 val thy = @{theory "Rational"};
1.161 "-------- WN";
1.162 -val t = TermC.str2term "(2 + -3 * x) / 9";
1.163 +val t = TermC.parse_test @{context} "(2 + -3 * x) / 9";
1.164 if NONE = rewrite_set_ ctxt false cancel_p t then ()
1.165 else error "rewrite_set_ cancel_p must return NONE, if the term cannot be cancelled";
1.166
1.167 "-------- example 186a";
1.168 -val t = TermC.str2term "(14 * x * y) / (x * y)";
1.169 - is_expanded (TermC.str2term "14 * x * y");
1.170 - is_expanded (TermC.str2term "x * y");
1.171 +val t = TermC.parse_test @{context} "(14 * x * y) / (x * y)";
1.172 + is_expanded (TermC.parse_test @{context} "14 * x * y");
1.173 + is_expanded (TermC.parse_test @{context} "x * y");
1.174 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
1.175 if (UnparseC.term t', UnparseC.terms asm) = ("14 / 1", "[]")
1.176 then () else error "rational.sml cancel Schalk 186a";
1.177
1.178 "-------- example 186b";
1.179 -val t = TermC.str2term "(60 * a * b) / ( 15 * a * b )";
1.180 +val t = TermC.parse_test @{context} "(60 * a * b) / ( 15 * a * b )";
1.181 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
1.182 if (UnparseC.term t', UnparseC.terms asm) = ("4 / 1", "[]")
1.183 then () else error "rational.sml cancel Schalk 186b";
1.184
1.185 "-------- example 186c";
1.186 -val t = TermC.str2term "(144 * a \<up> 2 * b * c) / (12 * a * b * c)";
1.187 +val t = TermC.parse_test @{context} "(144 * a \<up> 2 * b * c) / (12 * a * b * c)";
1.188 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
1.189 if (UnparseC.term t', UnparseC.terms asm) = ("12 * a / 1", "[]")
1.190 then () else error "rational.sml cancel Schalk 186c";
1.191 @@ -483,7 +483,7 @@
1.192 (* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! exception Div raised !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1.193 see --- fun rewrite_set_ downto fun gcd_poly ---
1.194 "-------- example 187a";
1.195 -val t = TermC.str2term "(12 * x * y) / (8 * y \<up> 2 )";
1.196 +val t = TermC.parse_test @{context} "(12 * x * y) / (8 * y \<up> 2 )";
1.197 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
1.198 if (UnparseC.term t', UnparseC.terms asm) = ("3 * x / (2 * y)", "[\"4 * y ~= 0\"]")
1.199 then () else error "rational.sml cancel Schalk 187a";
1.200 @@ -492,7 +492,7 @@
1.201 (* doesn't terminate !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1.202 see --- fun rewrite_set_ downto fun gcd_poly ---
1.203 "-------- example 187b";
1.204 -val t = TermC.str2term "(8 * x \<up> 2 * y * z ) / (18 * x * y \<up> 2 * z )";
1.205 +val t = TermC.parse_test @{context} "(8 * x \<up> 2 * y * z ) / (18 * x * y \<up> 2 * z )";
1.206 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
1.207 if (UnparseC.term t', UnparseC.terms asm) = ("4 * x / (9 * y)", "[\"2 * (z * (y * x)) ~= 0\"]")
1.208 then () else error "rational.sml cancel Schalk 187b";
1.209 @@ -501,7 +501,7 @@
1.210 (* doesn't terminate !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1.211 see --- fun rewrite_set_ downto fun gcd_poly ---
1.212 "-------- example 187c";
1.213 -val t = TermC.str2term "(9 * x \<up> 5 * y \<up> 2 * z \<up> 4) / (15 * x \<up> 6 * y \<up> 3 * z )";
1.214 +val t = TermC.parse_test @{context} "(9 * x \<up> 5 * y \<up> 2 * z \<up> 4) / (15 * x \<up> 6 * y \<up> 3 * z )";
1.215 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
1.216 if (UnparseC.term t', UnparseC.terms asm) =
1.217 ("3 * z \<up> 3 / (5 * (y * x))", "[\"3 * (z * (y \<up> 2 * x \<up> 5)) ~= 0\"]")
1.218 @@ -509,119 +509,119 @@
1.219 *)
1.220
1.221 "-------- example 188a";
1.222 -val t = TermC.str2term "(-8 + 8 * x) / (-9 + 9 * x)";
1.223 - is_expanded (TermC.str2term "8 * x + -8");
1.224 +val t = TermC.parse_test @{context} "(-8 + 8 * x) / (-9 + 9 * x)";
1.225 + is_expanded (TermC.parse_test @{context} "8 * x + -8");
1.226 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
1.227 if (UnparseC.term t', UnparseC.terms asm) = ("8 / 9", "[]")
1.228 then () else error "rational.sml cancel Schalk 188a";
1.229
1.230 -val t = TermC.str2term "(8*((- 1) + x))/(9*((- 1) + x))";
1.231 +val t = TermC.parse_test @{context} "(8*((- 1) + x))/(9*((- 1) + x))";
1.232 val SOME (t, _) = rewrite_set_ ctxt false make_polynomial t;
1.233 if (UnparseC.term t', UnparseC.terms asm) = ("8 / 9", "[]")
1.234 then () else error "rational.sml cancel Schalk make_polynomial 1";
1.235
1.236 "-------- example 188b";
1.237 -val t = TermC.str2term "(- 15 + 5 * x) / (- 18 + 6 * x)";
1.238 +val t = TermC.parse_test @{context} "(- 15 + 5 * x) / (- 18 + 6 * x)";
1.239 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
1.240 if (UnparseC.term t', UnparseC.terms asm) = ("5 / 6", "[]")
1.241 then () else error "rational.sml cancel Schalk 188b";
1.242
1.243 "-------- example 188c";
1.244 -val t = TermC.str2term "(a + - 1 * b) / (b + - 1 * a)";
1.245 +val t = TermC.parse_test @{context} "(a + - 1 * b) / (b + - 1 * a)";
1.246 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
1.247 if (UnparseC.term t', UnparseC.terms asm) = ("- 1 / 1", "[]")
1.248 then () else error "rational.sml cancel Schalk 188c";
1.249
1.250 -is_expanded (TermC.str2term "a + - 1 * b") = true;
1.251 -val t = TermC.str2term "((- 1)*(b + (- 1) * a))/(1*(b + (- 1) * a))";
1.252 +is_expanded (TermC.parse_test @{context} "a + - 1 * b") = true;
1.253 +val t = TermC.parse_test @{context} "((- 1)*(b + (- 1) * a))/(1*(b + (- 1) * a))";
1.254 val SOME (t', asm) = rewrite_set_ ctxt false make_polynomial t;
1.255 if (UnparseC.term t', UnparseC.terms asm) = ("(a + - 1 * b) / (- 1 * a + b)", "[]")
1.256 then () else error "rational.sml cancel Schalk make_polynomial 2";
1.257
1.258 "-------- example 190a";
1.259 -val t = TermC.str2term "( 27 * a \<up> 3 + 9 * a \<up> 2 + 3 * a + 1 ) / ( 27 * a \<up> 3 + 18 * a \<up> 2 + 3 * a )";
1.260 +val t = TermC.parse_test @{context} "( 27 * a \<up> 3 + 9 * a \<up> 2 + 3 * a + 1 ) / ( 27 * a \<up> 3 + 18 * a \<up> 2 + 3 * a )";
1.261 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
1.262 if (UnparseC.term t', UnparseC.terms asm) =
1.263 ("(1 + 9 * a \<up> 2) / (3 * a + 9 * a \<up> 2)", "[\"3 * a + 9 * a \<up> 2 \<noteq> 0\"]")
1.264 then () else error "rational.sml cancel Schalk 190a";
1.265
1.266 "-------- example 190c";
1.267 -val t = TermC.str2term "((1 + 9 * a \<up> 2)*(1 + 3 * a))/((3 * a + 9 * a \<up> 2)*(1 + 3 * a))";
1.268 +val t = TermC.parse_test @{context} "((1 + 9 * a \<up> 2)*(1 + 3 * a))/((3 * a + 9 * a \<up> 2)*(1 + 3 * a))";
1.269 val SOME (t', asm) = rewrite_set_ ctxt false make_polynomial t;
1.270 if (UnparseC.term t', UnparseC.terms asm) =
1.271 ("(1 + 3 * a + 9 * a \<up> 2 + 27 * a \<up> 3) /\n(3 * a + 18 * a \<up> 2 + 27 * a \<up> 3)", "[]")
1.272 then () else error "rational.sml make_polynomial Schalk 190c";
1.273
1.274 "-------- example 191a";
1.275 -val t = TermC.str2term "( x \<up> 2 + - 1 * y \<up> 2 ) / ( x + y )";
1.276 - is_expanded (TermC.str2term "x \<up> 2 + - 1 * y \<up> 2") = false; (*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*)
1.277 - is_expanded (TermC.str2term "x + y") = true;
1.278 +val t = TermC.parse_test @{context} "( x \<up> 2 + - 1 * y \<up> 2 ) / ( x + y )";
1.279 + is_expanded (TermC.parse_test @{context} "x \<up> 2 + - 1 * y \<up> 2") = false; (*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*)
1.280 + is_expanded (TermC.parse_test @{context} "x + y") = true;
1.281 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
1.282 if (UnparseC.term t', UnparseC.terms asm) = ("(x + - 1 * y) / 1", "[]")
1.283 then () else error "rational.sml make_polynomial Schalk 191a";
1.284
1.285 "-------- example 191b";
1.286 -val t = TermC.str2term "((x + (- 1) * y)*(x + y))/((1)*(x + y))";
1.287 +val t = TermC.parse_test @{context} "((x + (- 1) * y)*(x + y))/((1)*(x + y))";
1.288 val SOME (t', asm) = rewrite_set_ ctxt false make_polynomial t;
1.289 if (UnparseC.term t', UnparseC.terms asm) = ("(x \<up> 2 + - 1 * y \<up> 2) / (x + y)", "[]")
1.290 then () else error "rational.sml make_polynomial Schalk 191b";
1.291
1.292 "-------- example 191c";
1.293 -val t = TermC.str2term "( 9 * x \<up> 2 + -30 * x + 25 ) / ( 9 * x \<up> 2 + - 25 )";
1.294 - is_expanded (TermC.str2term "9 * x \<up> 2 + -30 * x + 25") = true;
1.295 - is_expanded (TermC.str2term "25 + -30*x + 9*x \<up> 2") = true;
1.296 - is_expanded (TermC.str2term "- 25 + 9*x \<up> 2") = true;
1.297 +val t = TermC.parse_test @{context} "( 9 * x \<up> 2 + -30 * x + 25 ) / ( 9 * x \<up> 2 + - 25 )";
1.298 + is_expanded (TermC.parse_test @{context} "9 * x \<up> 2 + -30 * x + 25") = true;
1.299 + is_expanded (TermC.parse_test @{context} "25 + -30*x + 9*x \<up> 2") = true;
1.300 + is_expanded (TermC.parse_test @{context} "- 25 + 9*x \<up> 2") = true;
1.301
1.302 -val t = TermC.str2term "(((-5) + 3 * x)*((-5) + 3 * x))/((5 + 3 * x)*((-5) + 3 * x))";
1.303 +val t = TermC.parse_test @{context} "(((-5) + 3 * x)*((-5) + 3 * x))/((5 + 3 * x)*((-5) + 3 * x))";
1.304 val SOME (t', asm) = rewrite_set_ ctxt false make_polynomial t;
1.305 if (UnparseC.term t', UnparseC.terms asm) = ("(25 + - 30 * x + 9 * x \<up> 2) / (- 25 + 9 * x \<up> 2)", "[]")
1.306 then () else error "rational.sml make_polynomial Schalk 191c";
1.307
1.308 "-------- example 192b";
1.309 -val t = TermC.str2term "( 7 * x \<up> 3 + - 1 * x \<up> 2 * y ) / ( 7 * x * y \<up> 2 + - 1 * y \<up> 3 )";
1.310 +val t = TermC.parse_test @{context} "( 7 * x \<up> 3 + - 1 * x \<up> 2 * y ) / ( 7 * x * y \<up> 2 + - 1 * y \<up> 3 )";
1.311 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
1.312 if (UnparseC.term t', UnparseC.terms asm) = ("x \<up> 2 / y \<up> 2", "[\"y \<up> 2 \<noteq> 0\"]")
1.313 then () else error "rational.sml cancel_p Schalk 192b";
1.314
1.315 -val t = TermC.str2term "((x \<up> 2)*(7 * x + (- 1) * y))/((y \<up> 2)*(7 * x + (- 1) * y))";
1.316 +val t = TermC.parse_test @{context} "((x \<up> 2)*(7 * x + (- 1) * y))/((y \<up> 2)*(7 * x + (- 1) * y))";
1.317 val SOME (t', asm) = rewrite_set_ ctxt false make_polynomial t;
1.318 if (UnparseC.term t', UnparseC.terms asm) =
1.319 ("(7 * x \<up> 3 + - 1 * x \<up> 2 * y) /\n(7 * x * y \<up> 2 + - 1 * y \<up> 3)", "[]")
1.320 then () else error "rational.sml make_polynomial Schalk 192b";
1.321
1.322 -val t = TermC.str2term "((x \<up> 2)*(7 * x + (- 1) * y))/((y \<up> 2)*(7 * x + (- 1) * y))";
1.323 +val t = TermC.parse_test @{context} "((x \<up> 2)*(7 * x + (- 1) * y))/((y \<up> 2)*(7 * x + (- 1) * y))";
1.324 val SOME (t', asm) = rewrite_set_ ctxt false make_polynomial t;
1.325 if (UnparseC.term t', UnparseC.terms asm) =
1.326 ("(7 * x \<up> 3 + - 1 * x \<up> 2 * y) /\n(7 * x * y \<up> 2 + - 1 * y \<up> 3)", "[]")
1.327 then () else error "rational.sml make_polynomial Schalk WN050929 not working";
1.328
1.329 "-------- example 193a";
1.330 -val t = TermC.str2term "( x \<up> 2 + -6 * x + 9 ) / ( x \<up> 2 + -9 )";
1.331 +val t = TermC.parse_test @{context} "( x \<up> 2 + -6 * x + 9 ) / ( x \<up> 2 + -9 )";
1.332 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
1.333 if (UnparseC.term t', UnparseC.terms asm) = ("(- 3 + x) / (3 + x)", "[\"3 + x \<noteq> 0\"]")
1.334 then () else error "rational.sml cancel_p Schalk 193a";
1.335
1.336 "-------- example 193b";
1.337 -val t = TermC.str2term "( x \<up> 2 + -8 * x + 16 ) / ( 2 * x \<up> 2 + -32 )";
1.338 +val t = TermC.parse_test @{context} "( x \<up> 2 + -8 * x + 16 ) / ( 2 * x \<up> 2 + -32 )";
1.339 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
1.340 if (UnparseC.term t', UnparseC.terms asm) = ("(- 4 + x) / (8 + 2 * x)", "[\"8 + 2 * x \<noteq> 0\"]")
1.341 then () else error "rational.sml cancel_p Schalk 193b";
1.342
1.343 "-------- example 193c";
1.344 -val t = TermC.str2term "( 2 * x + -50 * x \<up> 3 ) / ( 25 * x \<up> 2 + - 10 * x + 1 )";
1.345 +val t = TermC.parse_test @{context} "( 2 * x + -50 * x \<up> 3 ) / ( 25 * x \<up> 2 + - 10 * x + 1 )";
1.346 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
1.347 if (UnparseC.term t', UnparseC.terms asm) =
1.348 ("(2 * x + 10 * x \<up> 2) / (1 + - 5 * x)", "[\"1 + - 5 * x \<noteq> 0\"]")
1.349 then () else error "rational.sml cancel_p Schalk 193c";
1.350
1.351 (*WN: improved with new numerals*)
1.352 -val t = TermC.str2term "(- 25 + 9*x \<up> 2)/(5 + 3*x)";
1.353 +val t = TermC.parse_test @{context} "(- 25 + 9*x \<up> 2)/(5 + 3*x)";
1.354 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
1.355 if (UnparseC.term t', UnparseC.terms asm) = ("(- 5 + 3 * x) / 1", "[]")
1.356 then () else error "rational.sml cancel WN 1";
1.357
1.358 "-------- example heuberger";
1.359 -val t = TermC.str2term ("(x \<up> 4 + x * y + x \<up> 3 * y + y \<up> 2) / " ^
1.360 +val t = TermC.parse_test @{context} ("(x \<up> 4 + x * y + x \<up> 3 * y + y \<up> 2) / " ^
1.361 "(x + 5 * x \<up> 2 + y + 5 * x * y + x \<up> 2 * y \<up> 3 + x * y \<up> 4)");
1.362 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
1.363 if (UnparseC.term t', UnparseC.terms asm) =
1.364 @@ -636,7 +636,7 @@
1.365 "-------- integration lev.1 -- lev.5: cancel_p_ & add_fractions_p_ -----------";
1.366 "-------- integration lev.1 -- lev.5: cancel_p_ & add_fractions_p_ -----------";
1.367 "-------- integration lev.1 -- lev.5: cancel_p_ & add_fractions_p_ -----------";
1.368 -val t = TermC.str2term ("123 = (a*x)/(b*x) + (c*x)/(d*x) + (e*x)/(f*x::real)");
1.369 +val t = TermC.parse_test @{context} ("123 = (a*x)/(b*x) + (c*x)/(d*x) + (e*x)/(f*x::real)");
1.370 "-------- gcd_poly integration level 1: works on exact term";
1.371 if NONE = cancel_p_ thy t then () else error "cancel_p_ works on exact fraction";
1.372 if NONE = add_fraction_p_ thy t then () else error "add_fraction_p_ works on exact fraction";
1.373 @@ -701,7 +701,7 @@
1.374 "-------- reverse rewrite ----------------------------------------------------";
1.375 "-------- reverse rewrite ----------------------------------------------------";
1.376 (** the term for which reverse rewriting is demonstrated **)
1.377 -val t = TermC.str2term "(9 + - 1 * x \<up> 2) / (9 + 6 * x + x \<up> 2)";
1.378 +val t = TermC.parse_test @{context} "(9 + - 1 * x \<up> 2) / (9 + 6 * x + x \<up> 2)";
1.379 val Rrls {scr = Rfuns {init_state = ini, locate_rule = loc,
1.380 next_rule = nex, normal_form = nor, ...},...} = cancel_p;
1.381
1.382 @@ -807,7 +807,7 @@
1.383 special cases.*)
1.384
1.385 (*the term for which reverse rewriting is demonstrated*)
1.386 -val t = TermC.str2term "(9 + (- 1)*x \<up> 2) / (9 + ((-6)*x + x \<up> 2))";
1.387 +val t = TermC.parse_test @{context} "(9 + (- 1)*x \<up> 2) / (9 + ((-6)*x + x \<up> 2))";
1.388 val Rrls {scr=Rfuns {init_state=ini,locate_rule=loc,
1.389 next_rule=nex,normal_form=nor,...},...} = cancel_p;
1.390
1.391 @@ -846,46 +846,46 @@
1.392 "-------- examples: rls norm_Rational ----------------------------------------";
1.393 "-------- examples: rls norm_Rational ----------------------------------------";
1.394 "-------- examples: rls norm_Rational ----------------------------------------";
1.395 -val t = TermC.str2term "Not (6*x is_atom)";
1.396 +val t = TermC.parse_test @{context} "Not (6*x is_atom)";
1.397 val SOME (t',_) = rewrite_set_ ctxt false powers_erls t; UnparseC.term t';
1.398 "HOL.True";
1.399 -val t = TermC.str2term "1 < 2";
1.400 +val t = TermC.parse_test @{context} "1 < 2";
1.401 val SOME (t',_) = rewrite_set_ ctxt false powers_erls t; UnparseC.term t';
1.402 "HOL.True";
1.403
1.404 -val t = TermC.str2term "(6*x) \<up> 2";
1.405 +val t = TermC.parse_test @{context} "(6*x) \<up> 2";
1.406 val SOME (t',_) = rewrite_ ctxt Rewrite_Ord.function_empty powers_erls false @{thm realpow_def_atom} t;
1.407 if UnparseC.term t' = "6 * x * (6 * x) \<up> (2 + - 1)" then ()
1.408 else error "rational.sml powers_erls (6*x) \<up> 2";
1.409
1.410 -val t = TermC.str2term "- 1 * (- 2 * (5 / 2 * (13 * x / 2)))";
1.411 +val t = TermC.parse_test @{context} "- 1 * (- 2 * (5 / 2 * (13 * x / 2)))";
1.412 val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term t';
1.413 if UnparseC.term t' = "65 * x / 2" then () else error "rational.sml 4";
1.414
1.415 -val t = TermC.str2term "1 - ((13*x)/2 - 5/2) \<up> 2";
1.416 +val t = TermC.parse_test @{context} "1 - ((13*x)/2 - 5/2) \<up> 2";
1.417 val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term t';
1.418 if UnparseC.term t' = "(- 21 + 130 * x + - 169 * x \<up> 2) / 4" then ()
1.419 else error "rational.sml 5";
1.420
1.421 (*SRAM Schalk I, p.92 Nr. 609a*)
1.422 -val t = TermC.str2term "2*(3 - x/5)/3 - 4*(1 - x/3) - x/3 - 2*(x/2 - 1/4)/27 +5/54";
1.423 +val t = TermC.parse_test @{context} "2*(3 - x/5)/3 - 4*(1 - x/3) - x/3 - 2*(x/2 - 1/4)/27 +5/54";
1.424 val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term t';
1.425 if UnparseC.term t' = "(- 255 + 112 * x) / 135" then ()
1.426 else error "rational.sml 6";
1.427
1.428 (*SRAM Schalk I, p.92 Nr. 610c*)
1.429 -val t = TermC.str2term "((x- 1)/(x+1) + 1) / ((x- 1)/(x+1) - (x+1)/(x- 1)) - 2";
1.430 +val t = TermC.parse_test @{context} "((x- 1)/(x+1) + 1) / ((x- 1)/(x+1) - (x+1)/(x- 1)) - 2";
1.431 val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term t';
1.432 if UnparseC.term t' = "(3 + x) / - 2" then () else error "rational.sml 7";
1.433
1.434 (*SRAM Schalk I, p.92 Nr. 476a*)
1.435 -val t = TermC.str2term "(x \<up> 2/(1 - x \<up> 2) + 1)/(x/(1 - x) + 1) * (1 + x)";
1.436 +val t = TermC.parse_test @{context} "(x \<up> 2/(1 - x \<up> 2) + 1)/(x/(1 - x) + 1) * (1 + x)";
1.437 (*. a/b : c/d translated to a/b * d/c .*)
1.438 val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term t';
1.439 if UnparseC.term t' = "1" then () else error "rational.sml 8";
1.440
1.441 (*Schalk I, p.92 Nr. 472a*)
1.442 -val t = TermC.str2term "((8*x \<up> 2 - 32*y \<up> 2)/(2*x + 4*y))/((4*x - 8*y)/(x + y))";
1.443 +val t = TermC.parse_test @{context} "((8*x \<up> 2 - 32*y \<up> 2)/(2*x + 4*y))/((4*x - 8*y)/(x + y))";
1.444 val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term t';
1.445 if UnparseC.term t' = "x + y" then () else error "rational.sml p.92 Nr. 472a";
1.446
1.447 @@ -893,11 +893,11 @@
1.448
1.449 (*WN130910 add_fractions_p exception Div raised + history:
1.450 ### WN.2.6.03 from rlang.sml 56a
1.451 -val t = TermC.str2term "(a + b * x) / (a + - 1 * (b * x)) + (- 1 * a + b * x) / (a + b * x) = 4 * (a * b) / (a \<up> 2 + - 1 * b \<up> 2)";
1.452 +val t = TermC.parse_test @{context} "(a + b * x) / (a + - 1 * (b * x)) + (- 1 * a + b * x) / (a + b * x) = 4 * (a * b) / (a \<up> 2 + - 1 * b \<up> 2)";
1.453 val NONE = rewrite_set_ ctxt false add_fractions_p t;
1.454
1.455 THE ERROR ALREADY OCCURS IN THIS PART:
1.456 -val t = TermC.str2term "(a + b * x) / (a + - 1 * (b * x)) + (- 1 * a + b * x) / (a + b * x)";
1.457 +val t = TermC.parse_test @{context} "(a + b * x) / (a + - 1 * (b * x)) + (- 1 * a + b * x) / (a + b * x)";
1.458 val NONE = add_fraction_p_ ctxt t;
1.459
1.460 SEE Test_Some.thy: section {* add_fractions_p downto exception Div raised ===
1.461 @@ -907,13 +907,13 @@
1.462 "-------- rational numerals --------------------------------------------------";
1.463 "-------- rational numerals --------------------------------------------------";
1.464 (*SRA Schalk I, p.40 Nr. 164b *)
1.465 -val t = TermC.str2term "(47/6 - 76/9 + 13/4)/(35/12)";
1.466 +val t = TermC.parse_test @{context} "(47/6 - 76/9 + 13/4)/(35/12)";
1.467 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.468 if UnparseC.term t = "19 / 21" then ()
1.469 else error "rational.sml: diff.behav. in norm_Rational_mg 1";
1.470
1.471 (*SRA Schalk I, p.40 Nr. 166a *)
1.472 -val t = TermC.str2term "((5/4)/(4+22/7) + 37/20)*(110/3 - 110/9 * 23/11)";
1.473 +val t = TermC.parse_test @{context} "((5/4)/(4+22/7) + 37/20)*(110/3 - 110/9 * 23/11)";
1.474 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.475 if UnparseC.term t = "45 / 2" then ()
1.476 else error "rational.sml: diff.behav. in norm_Rational_mg 2";
1.477 @@ -922,55 +922,55 @@
1.478 "-------- examples cancellation from: Mathematik 1 Schalk --------------------";
1.479 "-------- examples cancellation from: Mathematik 1 Schalk --------------------";
1.480 (* e190c Stefan K.*)
1.481 -val t = TermC.str2term "((1 + 9*a \<up> 2) * (1 + 3*a)) / ((3*a + 9*a \<up> 2) * (1 + 3*a))";
1.482 +val t = TermC.parse_test @{context} "((1 + 9*a \<up> 2) * (1 + 3*a)) / ((3*a + 9*a \<up> 2) * (1 + 3*a))";
1.483 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.484 if UnparseC.term t = "(1 + 9 * a \<up> 2) / (3 * a + 9 * a \<up> 2)"
1.485 then () else error "rational.sml: diff.behav. in norm_Rational_mg 3";
1.486
1.487 (* e192b Stefan K.*)
1.488 -val t = TermC.str2term "(x \<up> 2 * (7*x + (- 1)*y)) / (y \<up> 2 * (7*x + (- 1)*y))";
1.489 +val t = TermC.parse_test @{context} "(x \<up> 2 * (7*x + (- 1)*y)) / (y \<up> 2 * (7*x + (- 1)*y))";
1.490 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.491 if UnparseC.term t = "x \<up> 2 / y \<up> 2"
1.492 then () else error "rational.sml: diff.behav. in norm_Rational_mg 4";
1.493
1.494 (*SRC Schalk I, p.66 Nr. 379c *)
1.495 -val t = TermC.str2term "(a - b)/(b - a)";
1.496 +val t = TermC.parse_test @{context} "(a - b)/(b - a)";
1.497 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.498 if UnparseC.term t = "- 1"
1.499 then () else error "rational.sml: diff.behav. in norm_Rational_mg 5";
1.500
1.501 (*SRC Schalk I, p.66 Nr. 380b *)
1.502 -val t = TermC.str2term "15*(3*x + 3) * (4*x + 9) / (12*(2*x + 7) * (5*x + 5))";
1.503 +val t = TermC.parse_test @{context} "15*(3*x + 3) * (4*x + 9) / (12*(2*x + 7) * (5*x + 5))";
1.504 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.505 if UnparseC.term t = "(27 + 12 * x) / (28 + 8 * x)"
1.506 then () else error "rational.sml: diff.behav. in norm_Rational_mg 6";
1.507
1.508 (* e190c Stefan K.*)
1.509 -val t = TermC.str2term "((1 + 9*a \<up> 2) * (1 + 3*a)) / ((3*a + 9*a \<up> 2) * (1 + 3 * a))";
1.510 +val t = TermC.parse_test @{context} "((1 + 9*a \<up> 2) * (1 + 3*a)) / ((3*a + 9*a \<up> 2) * (1 + 3 * a))";
1.511 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.512 if UnparseC.term t = "(1 + 9 * a \<up> 2) / (3 * a + 9 * a \<up> 2)"
1.513 then () else error "rational.sml: diff.behav. in norm_Rational_mg 3";
1.514
1.515 (* e192b Stefan K.*)
1.516 -val t = TermC.str2term "(x \<up> 2 * (7*x + (- 1)*y)) / (y \<up> 2 * (7*x + (- 1)*y))";
1.517 +val t = TermC.parse_test @{context} "(x \<up> 2 * (7*x + (- 1)*y)) / (y \<up> 2 * (7*x + (- 1)*y))";
1.518 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.519 if UnparseC.term t = "x \<up> 2 / y \<up> 2"
1.520 then () else error "rational.sml: diff.behav. in norm_Rational_mg 4";
1.521
1.522 (*SRC Schalk I, p.66 Nr. 379c *)
1.523 -val t = TermC.str2term "(a - b) / (b - a)";
1.524 +val t = TermC.parse_test @{context} "(a - b) / (b - a)";
1.525 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.526 if UnparseC.term t = "- 1"
1.527 then () else error "rational.sml: diff.behav. in norm_Rational_mg 5";
1.528
1.529 (*SRC Schalk I, p.66 Nr. 380b *)
1.530 -val t = TermC.str2term "15*(3*x + 3) * (4*x + 9) / (12*(2*x + 7) * (5*x + 5))";
1.531 +val t = TermC.parse_test @{context} "15*(3*x + 3) * (4*x + 9) / (12*(2*x + 7) * (5*x + 5))";
1.532 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.533 if UnparseC.term t = "(27 + 12 * x) / (28 + 8 * x)"
1.534 then () else error "rational.sml: diff.behav. in norm_Rational_mg 6";
1.535
1.536 (* extreme example from somewhere *)
1.537 -val t = TermC.str2term
1.538 +val t = TermC.parse_test @{context}
1.539 ("(a \<up> 4 * x + - 1*a \<up> 4 * y + 4*a \<up> 3 * b * x + -4*a \<up> 3 * b * y + " ^
1.540 "6*a \<up> 2 * b \<up> 2 * x + -6*a \<up> 2 * b \<up> 2 * y + 4*a * b \<up> 3 * x + -4*a * b \<up> 3 * y + " ^
1.541 "b \<up> 4 * x + - 1*b \<up> 4 * y) " ^
1.542 @@ -983,33 +983,33 @@
1.543
1.544 (*Schalk I, p.66 Nr. 381a *)
1.545 (* ATTENTION: here the rls is very slow. In Isabelle2002 this required 2 min *)
1.546 -val t = TermC.str2term "18*(a + b) \<up> 3 * (a - b) \<up> 2 / (72*(a - b) \<up> 3 * (a + b) \<up> 2)";
1.547 +val t = TermC.parse_test @{context} "18*(a + b) \<up> 3 * (a - b) \<up> 2 / (72*(a - b) \<up> 3 * (a + b) \<up> 2)";
1.548 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.549 if UnparseC.term t = "(a + b) / (4 * a + - 4 * b)"
1.550 then () else error "rational.sml: diff.behav. in norm_Rational_mg 8";
1.551
1.552 (*SRC Schalk I, p.66 Nr. 381b *)
1.553 -val t = TermC.str2term "(4*x \<up> 2 - 20*x + 25) / (2*x - 5) \<up> 3";
1.554 +val t = TermC.parse_test @{context} "(4*x \<up> 2 - 20*x + 25) / (2*x - 5) \<up> 3";
1.555 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.556 if UnparseC.term t = "1 / (- 5 + 2 * x)"
1.557 then () else error "rational.sml: diff.behav. in norm_Rational_mg 9";
1.558
1.559 (*SRC Schalk I, p.66 Nr. 381c *)
1.560 -val t = TermC.str2term "(27*a \<up> 3 + 9*a \<up> 2+3*a+1) / (27*a \<up> 3 + 18*a \<up> 2+3*a)";
1.561 +val t = TermC.parse_test @{context} "(27*a \<up> 3 + 9*a \<up> 2+3*a+1) / (27*a \<up> 3 + 18*a \<up> 2+3*a)";
1.562 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.563 if UnparseC.term t = "(1 + 9 * a \<up> 2) / (3 * a + 9 * a \<up> 2)"
1.564 then () else error "rational.sml: diff.behav. in norm_Rational_mg 10";
1.565
1.566 (*SRC Schalk I, p.66 Nr. 383a *)
1.567 -val t = TermC.str2term "(5*a \<up> 2 - 5*a*b) / (a - b) \<up> 2";
1.568 +val t = TermC.parse_test @{context} "(5*a \<up> 2 - 5*a*b) / (a - b) \<up> 2";
1.569 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.570 if UnparseC.term t = "- 5 * a / (- 1 * a + b)"
1.571 then () else error "rational.sml: diff.behav. in norm_Rational_mg 11";
1.572
1.573 "----- NOT TERMINATING ?: worked before 0707xx";
1.574 -val t = TermC.str2term "(a \<up> 2 - 1)*(b + 1) / ((b \<up> 2 - 1)*(a+1))";
1.575 +val t = TermC.parse_test @{context} "(a \<up> 2 - 1)*(b + 1) / ((b \<up> 2 - 1)*(a+1))";
1.576 (* WN130911 "exception Div raised" by
1.577 - cancel_p_ thy (TermC.str2term ("(- 1 + - 1 * b + a \<up> 2 + a \<up> 2 * b) /" ^
1.578 + cancel_p_ thy (TermC.parse_test @{context} ("(- 1 + - 1 * b + a \<up> 2 + a \<up> 2 * b) /" ^
1.579 "(- 1 + - 1 * a + b \<up> 2 + a * b \<up> 2)"))
1.580
1.581 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.582 @@ -1021,20 +1021,20 @@
1.583 "-------- examples common denominator from: Mathematik 1 Schalk --------------";
1.584 "-------- examples common denominator from: Mathematik 1 Schalk --------------";
1.585 (*SRA Schalk I, p.67 Nr. 403a *)
1.586 -val t = TermC.str2term "4/x - 3/y - 1";
1.587 +val t = TermC.parse_test @{context} "4/x - 3/y - 1";
1.588 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.589 if UnparseC.term t = "(- 3 * x + 4 * y + - 1 * x * y) / (x * y)"
1.590 then () else error "rational.sml: diff.behav. in norm_Rational_mg 12";
1.591
1.592 -val t = TermC.str2term "(2*a+3*b)/(b*c) + (3*c+a)/(a*c) - (2*a \<up> 2+3*b*c)/(a*b*c)";
1.593 +val t = TermC.parse_test @{context} "(2*a+3*b)/(b*c) + (3*c+a)/(a*c) - (2*a \<up> 2+3*b*c)/(a*b*c)";
1.594 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.595 if UnparseC.term t = "4 / c"
1.596 then () else error "rational.sml: diff.behav. in norm_Rational_mg 13";
1.597
1.598 (*SRA Schalk I, p.67 Nr. 410b *)
1.599 -val t = TermC.str2term "1/(x+1) + 1/(x+2) - 2/(x+3)";
1.600 +val t = TermC.parse_test @{context} "1/(x+1) + 1/(x+2) - 2/(x+3)";
1.601 (* WN130911 non-termination due to non-termination of
1.602 - cancel_p_ thy (TermC.str2term "(5 + 3 * x) / (6 + 11 * x + 6 * x \<up> 2 + x \<up> 3)")
1.603 + cancel_p_ thy (TermC.parse_test @{context} "(5 + 3 * x) / (6 + 11 * x + 6 * x \<up> 2 + x \<up> 3)")
1.604
1.605 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.606 if UnparseC.term t = "(5 + 3 * x) / (6 + 11 * x + 6 * x \<up> 2 + x \<up> 3)"
1.607 @@ -1042,22 +1042,22 @@
1.608 *)
1.609
1.610 (*SRA Schalk I, p.67 Nr. 413b *)
1.611 -val t = TermC.str2term "(1 + x)/(1 - x) - (1 - x)/(1 + x) + 2*x/(1 - x \<up> 2)";
1.612 +val t = TermC.parse_test @{context} "(1 + x)/(1 - x) - (1 - x)/(1 + x) + 2*x/(1 - x \<up> 2)";
1.613 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.614 if UnparseC.term t = "6 * x / (1 + - 1 * x \<up> 2)"
1.615 then () else error "rational.sml: diff.behav. in norm_Rational_mg 15";
1.616
1.617 (*SRA Schalk I, p.68 Nr. 414a *)
1.618 -val t = TermC.str2term "(x + 2)/(x - 1) + (x - 3)/(x - 2) - (x + 1)/((x - 1)*(x - 2))";
1.619 +val t = TermC.parse_test @{context} "(x + 2)/(x - 1) + (x - 3)/(x - 2) - (x + 1)/((x - 1)*(x - 2))";
1.620 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.621 if UnparseC.term t ="(- 2 + - 5 * x + 2 * x \<up> 2) / (2 + - 3 * x + x \<up> 2)"
1.622 then () else error "rational.sml: diff.behav. in norm_Rational_mg 16";
1.623
1.624 (*SRA Schalk I, p.68 Nr. 428b *)
1.625 -val t = TermC.str2term
1.626 +val t = TermC.parse_test @{context}
1.627 "1/(a - b) \<up> 2 + 1/(a + b) \<up> 2 - 2/(a \<up> 2 - b \<up> 2) - 4*(b \<up> 2 - 1)/(a \<up> 2 - b \<up> 2) \<up> 2";
1.628 (* WN130911 non-termination due to non-termination of
1.629 - cancel_p_ thy (TermC.str2term "(4 + -4 * b \<up> 2) / (a \<up> 4 + - 2 * (a \<up> 2 * b \<up> 2) + b \<up> 4)")
1.630 + cancel_p_ thy (TermC.parse_test @{context} "(4 + -4 * b \<up> 2) / (a \<up> 4 + - 2 * (a \<up> 2 * b \<up> 2) + b \<up> 4)")
1.631
1.632 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.633 if UnparseC.term t = "4 / (a \<up> 4 + - 2 * a \<up> 2 * b \<up> 2 + b \<up> 4)"
1.634 @@ -1065,14 +1065,14 @@
1.635 *)
1.636
1.637 (*SRA Schalk I, p.68 Nr. 430b *)
1.638 -val t = TermC.str2term
1.639 +val t = TermC.parse_test @{context}
1.640 "a \<up> 2/(a - 3*b) - 108*a*b \<up> 3/((a+3*b)*(a \<up> 2 - 9*b \<up> 2)) - 9*b \<up> 2*(a - 3*b)/(a+3*b) \<up> 2";
1.641 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.642 if UnparseC.term t = "a + 3 * b"
1.643 then () else error "rational.sml: diff.behav. in norm_Rational_mg 19";
1.644
1.645 (*SRA Schalk I, p.68 Nr. 432 *)
1.646 -val t = TermC.str2term
1.647 +val t = TermC.parse_test @{context}
1.648 ("(a \<up> 2 + a*b) / (a \<up> 2 - b \<up> 2) - (b \<up> 2 - a*b) / (b \<up> 2 - a \<up> 2) + " ^
1.649 "a \<up> 2*(a - b) / (a \<up> 3 - a \<up> 2*b) - 2*a*(a \<up> 2 - b \<up> 2) / (a \<up> 3 - a*b \<up> 2) - " ^
1.650 "2*b \<up> 2 / (a \<up> 2 - b \<up> 2)");
1.651 @@ -1081,7 +1081,7 @@
1.652 then () else error "rational.sml: diff.behav. in norm_Rational_mg 20";
1.653
1.654 (* some example *)
1.655 -val t = TermC.str2term "3*a / (a*b) + x/y";
1.656 +val t = TermC.parse_test @{context} "3*a / (a*b) + x/y";
1.657 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.658 if UnparseC.term t = "(3 * y + b * x) / (b * y)"
1.659 then () else error "rational.sml: diff.behav. in norm_Rational_mg 21";
1.660 @@ -1091,19 +1091,19 @@
1.661 "-------- examples multiply and cancel from: Mathematik 1 Schalk -------------";
1.662 "-------- examples multiply and cancel from: Mathematik 1 Schalk -------------";
1.663 (*------- SRM Schalk I, p.68 Nr. 436a *)
1.664 -val t = TermC.str2term "3*(x+y) / (15*(x - y)) * 25*(x - y) \<up> 2 / (18*(x + y) \<up> 2)";
1.665 +val t = TermC.parse_test @{context} "3*(x+y) / (15*(x - y)) * 25*(x - y) \<up> 2 / (18*(x + y) \<up> 2)";
1.666 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.667 if UnparseC.term t = "(- 5 * x + 5 * y) / (- 18 * x + - 18 * y)"
1.668 then () else error "rational.sml: diff.behav. in norm_Rational_mg 22";
1.669
1.670 (*------- SRM.test Schalk I, p.68 Nr. 436b *)
1.671 -val t = TermC.str2term "5*a*(a - b) \<up> 2*(a + b) \<up> 3/(7*b*(a - b) \<up> 3) * 7*b/(a + b) \<up> 3";
1.672 +val t = TermC.parse_test @{context} "5*a*(a - b) \<up> 2*(a + b) \<up> 3/(7*b*(a - b) \<up> 3) * 7*b/(a + b) \<up> 3";
1.673 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.674 if UnparseC.term t = "5 * a / (a + - 1 * b)"
1.675 then () else error "rational.sml: diff.behav. in norm_Rational_mg 23";
1.676
1.677 (*------- Schalk I, p.68 Nr. 437a *)
1.678 -val t = TermC.str2term "(3*a - 4*b) / (4*c+3*e) * (3*a+4*b)/(9*a \<up> 2 - 16*b \<up> 2)";
1.679 +val t = TermC.parse_test @{context} "(3*a - 4*b) / (4*c+3*e) * (3*a+4*b)/(9*a \<up> 2 - 16*b \<up> 2)";
1.680 (* raises an exception for unclear reasons:
1.681 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.682 :
1.683 @@ -1112,7 +1112,7 @@
1.684 exception Div raised
1.685
1.686 BUT
1.687 -val t = TermC.str2term
1.688 +val t = TermC.parse_test @{context}
1.689 ("(9 * a \<up> 2 + - 16 * b \<up> 2) / (4 * c + 3 * e) /" ^
1.690 "(9 * a \<up> 2 + - 16 * b \<up> 2)");
1.691 NONE = cancel_p_ thy t;
1.692 @@ -1122,14 +1122,14 @@
1.693 *)
1.694
1.695 "----- S.K. corrected non-termination 060904";
1.696 -val t = TermC.str2term "(3*a - 4*b) * (3*a+4*b)/((4*c+3*e)*(9*a \<up> 2 - 16*b \<up> 2))";
1.697 +val t = TermC.parse_test @{context} "(3*a - 4*b) * (3*a+4*b)/((4*c+3*e)*(9*a \<up> 2 - 16*b \<up> 2))";
1.698 val SOME (t, _) = rewrite_set_ ctxt false make_polynomial t;
1.699 if UnparseC.term t =
1.700 "(9 * a \<up> 2 + - 16 * b \<up> 2) /\n(36 * a \<up> 2 * c + 27 * a \<up> 2 * e + - 64 * b \<up> 2 * c +\n - 48 * b \<up> 2 * e)"
1.701 then () else error "rational.sml: S.K.8..corrected 060904-6";
1.702
1.703 "----- S.K. corrected non-termination of cancel_p_";
1.704 -val t'' = TermC.str2term ("(9 * a \<up> 2 + - 16 * b \<up> 2) /" ^
1.705 +val t'' = TermC.parse_test @{context} ("(9 * a \<up> 2 + - 16 * b \<up> 2) /" ^
1.706 "(36 * a \<up> 2 * c + (27 * a \<up> 2 * e + (-64 * b \<up> 2 * c + -48 * b \<up> 2 * e)))");
1.707 (* /--- DOES NOT TERMINATE AT TRANSITION isabisac15 --> Isabelle2017 --------------------------\
1.708 val SOME (t',_) = rewrite_set_ ctxt false cancel_p t'';
1.709 @@ -1138,7 +1138,7 @@
1.710 \--- DOES NOT TERMINATE AT TRANSITION isabisac15 --> Isabelle2017 --------------------------/*)
1.711
1.712 (*------- Schalk I, p.68 Nr. 437b*)
1.713 -val t = TermC.str2term "(a + b)/(x \<up> 2 - y \<up> 2) * ((x - y) \<up> 2/(a \<up> 2 - b \<up> 2))";
1.714 +val t = TermC.parse_test @{context} "(a + b)/(x \<up> 2 - y \<up> 2) * ((x - y) \<up> 2/(a \<up> 2 - b \<up> 2))";
1.715 (*val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.716 :
1.717 #### rls: cancel_p on: (a * x \<up> 2 + - 2 * (a * (x * y)) + a * y \<up> 2 + b * x \<up> 2 +
1.718 @@ -1150,25 +1150,25 @@
1.719 *)
1.720
1.721 (*------- SRM Schalk I, p.68 Nr. 438a *)
1.722 -val t = TermC.str2term "x*y / (x*y - y \<up> 2) * (x \<up> 2 - x*y)";
1.723 +val t = TermC.parse_test @{context} "x*y / (x*y - y \<up> 2) * (x \<up> 2 - x*y)";
1.724 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.725 if UnparseC.term t = "x \<up> 2"
1.726 then () else error "rational.sml: diff.behav. in norm_Rational_mg 24";
1.727
1.728 (*------- SRM Schalk I, p.68 Nr. 439b *)
1.729 -val t = TermC.str2term "(4*x \<up> 2 + 4*x + 1) * ((x \<up> 2 - 2*x \<up> 3) / (4*x \<up> 2 + 2*x))";
1.730 +val t = TermC.parse_test @{context} "(4*x \<up> 2 + 4*x + 1) * ((x \<up> 2 - 2*x \<up> 3) / (4*x \<up> 2 + 2*x))";
1.731 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.732 if UnparseC.term t = "(x + - 4 * x \<up> 3) / 2"
1.733 then () else error "rational.sml: diff.behav. in norm_Rational_mg 25";
1.734
1.735 (*------- SRM Schalk I, p.68 Nr. 440a *)
1.736 -val t = TermC.str2term "(x \<up> 2 - 2*x) / (x \<up> 2 - 3*x) * (x - 3) \<up> 2 / (x \<up> 2 - 4)";
1.737 +val t = TermC.parse_test @{context} "(x \<up> 2 - 2*x) / (x \<up> 2 - 3*x) * (x - 3) \<up> 2 / (x \<up> 2 - 4)";
1.738 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.739 if UnparseC.term t = "(- 3 + x) / (2 + x)"
1.740 then () else error "rational.sml: diff.behav. in norm_Rational_mg 26";
1.741
1.742 "----- Schalk I, p.68 Nr. 440b SK11 works since 0707xx";
1.743 -val t = TermC.str2term "(a \<up> 3 - 9*a) / (a \<up> 3*b - a*b \<up> 3) * (a \<up> 2*b + a*b \<up> 2) / (a+3)";
1.744 +val t = TermC.parse_test @{context} "(a \<up> 3 - 9*a) / (a \<up> 3*b - a*b \<up> 3) * (a \<up> 2*b + a*b \<up> 2) / (a+3)";
1.745 (* WN130911 non-termination for unclear reasons:
1.746 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.747
1.748 @@ -1179,7 +1179,7 @@
1.749 (a \<up> 3 * b + - 1 * (a * b \<up> 3)) /
1.750 (3 + a)
1.751 BUT THIS IS CORRECTLY RECOGNISED
1.752 -val t = TermC.str2term
1.753 +val t = TermC.parse_test @{context}
1.754 ("(-9 * (a \<up> 3 * b) + -9 * (a \<up> 2 * b \<up> 2) + a \<up> 5 * b + a \<up> 4 * b \<up> 2) /" ^
1.755 "(a \<up> 3 * b + - 1 * (a * b \<up> 3)) / (3 + (a::real))");
1.756 AS
1.757 @@ -1190,9 +1190,9 @@
1.758 *)
1.759
1.760 "----- SK12 works since 0707xx";
1.761 -val t = TermC.str2term "(a \<up> 3 - 9*a) * (a \<up> 2*b+a*b \<up> 2) / ((a \<up> 3*b - a*b \<up> 3) * (a+3))";
1.762 +val t = TermC.parse_test @{context} "(a \<up> 3 - 9*a) * (a \<up> 2*b+a*b \<up> 2) / ((a \<up> 3*b - a*b \<up> 3) * (a+3))";
1.763 (* WN130911 non-termination due to non-termination of
1.764 - cancel_p_ thy (TermC.str2term "(4 + -4 * b \<up> 2) / (a \<up> 4 + - 2 * (a \<up> 2 * b \<up> 2) + b \<up> 4)")
1.765 + cancel_p_ thy (TermC.parse_test @{context} "(4 + -4 * b \<up> 2) / (a \<up> 4 + - 2 * (a \<up> 2 * b \<up> 2) + b \<up> 4)")
1.766
1.767 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.768 if UnparseC.term t' = "(-3 * a + a \<up> 2) / (a + - 1 * b)" then ()
1.769 @@ -1203,53 +1203,53 @@
1.770 "-------- examples common denominator and multiplication from: Schalk --------";
1.771 "-------- examples common denominator and multiplication from: Schalk --------";
1.772 (*------- SRAM Schalk I, p.69 Nr. 441b *)
1.773 -val t = TermC.str2term "(4*a/3 + 3*b \<up> 2/a \<up> 3 + b/(4*a))*(4*b/(3*a))";
1.774 +val t = TermC.parse_test @{context} "(4*a/3 + 3*b \<up> 2/a \<up> 3 + b/(4*a))*(4*b/(3*a))";
1.775 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.776 if UnparseC.term t = "(36 * b \<up> 3 + 3 * a \<up> 2 * b \<up> 2 + 16 * a \<up> 4 * b) /\n(9 * a \<up> 4)"
1.777 then () else error "rational.sml: diff.behav. in norm_Rational_mg 28";
1.778
1.779 (*------- SRAM Schalk I, p.69 Nr. 442b *)
1.780 -val t = TermC.str2term ("(15*a \<up> 2/x \<up> 3 - 5*b \<up> 4/x \<up> 2 + 25*c \<up> 2/x) * " ^
1.781 +val t = TermC.parse_test @{context} ("(15*a \<up> 2/x \<up> 3 - 5*b \<up> 4/x \<up> 2 + 25*c \<up> 2/x) * " ^
1.782 "(x \<up> 3/(5*a*b \<up> 3*c \<up> 3)) + 1/c \<up> 3 * (b*x/a - 3*a/b \<up> 3)");
1.783 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.784 if UnparseC.term t = "5 * x \<up> 2 / (a * b \<up> 3 * c)"
1.785 then () else error "rational.sml: diff.behav. in norm_Rational_mg 29";
1.786
1.787 (*------- SRAM Schalk I, p.69 Nr. 443b *)
1.788 -val t = TermC.str2term "(a/2 + b/3) * (b/3 - a/2)";
1.789 +val t = TermC.parse_test @{context} "(a/2 + b/3) * (b/3 - a/2)";
1.790 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.791 if UnparseC.term t = "(- 9 * a \<up> 2 + 4 * b \<up> 2) / 36"
1.792 then () else error "rational.sml: diff.behav. in norm_Rational_mg 30";
1.793
1.794 (*------- SRAM Schalk I, p.69 Nr. 445b *)
1.795 -val t = TermC.str2term "(a \<up> 2/9 + 2*a/(3*b) + 4/b \<up> 2)*(a/3 - 2/b) + 8/b \<up> 3";
1.796 +val t = TermC.parse_test @{context} "(a \<up> 2/9 + 2*a/(3*b) + 4/b \<up> 2)*(a/3 - 2/b) + 8/b \<up> 3";
1.797 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.798 if UnparseC.term t = "a \<up> 3 / 27"
1.799 then () else error "rational.sml: diff.behav. in norm_Rational_mg 31";
1.800
1.801 (*------- SRAM Schalk I, p.69 Nr. 446b *)
1.802 -val t = TermC.str2term "(x/(5*x + 4*y) - y/(5*x - 4*y) + 1)*(25*x \<up> 2 - 16*y \<up> 2)";
1.803 +val t = TermC.parse_test @{context} "(x/(5*x + 4*y) - y/(5*x - 4*y) + 1)*(25*x \<up> 2 - 16*y \<up> 2)";
1.804 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.805 if UnparseC.term t = (*"30 * x \<up> 2 + -9 * x * y + - 20 * y \<up> 2" ..isabisac15 | Isabelle2017..*)
1.806 "(- 30 * x \<up> 2 + 9 * x * y + 20 * y \<up> 2) / - 1"
1.807 then () else error "rational.sml: diff.behav. in norm_Rational_mg 32";
1.808
1.809 (*------- SRAM Schalk I, p.69 Nr. 449a *)(*Achtung: rechnet ca 8 Sekunden*)
1.810 -val t = TermC.str2term
1.811 +val t = TermC.parse_test @{context}
1.812 "(2*x \<up> 2/(3*y)+x/y \<up> 2)*(4*x \<up> 4/(9*y \<up> 2)+x \<up> 2/y \<up> 4)*(2*x \<up> 2/(3*y) - x/y \<up> 2)";
1.813 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.814 if UnparseC.term t = "(- 81 * x \<up> 4 + 16 * x \<up> 8 * y \<up> 4) / (81 * y \<up> 8)"
1.815 then () else error "rational.sml: diff.behav. in norm_Rational_mg 33";
1.816
1.817 (*------- SRAM Schalk I, p.69 Nr. 450a *)
1.818 -val t = TermC.str2term
1.819 +val t = TermC.parse_test @{context}
1.820 "(4*x/(3*y)+2*y/(3*x)) \<up> 2 - (2*y/(3*x) - 2*x/y)*(2*y/(3*x)+2*x/y)";
1.821 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.822 if UnparseC.term t = "(52 * x \<up> 2 + 16 * y \<up> 2) / (9 * y \<up> 2)"
1.823 then () else error "rational.sml: diff.behav. in norm_Rational_mg 34";
1.824
1.825 (*------- SRAM Schalk I, p.69 Nr. 442b --- abgewandelt*)
1.826 -val t = TermC.str2term
1.827 +val t = TermC.parse_test @{context}
1.828 ("(15*a \<up> 4/(a*x \<up> 3) - 5*a*((b \<up> 4 - 5*c \<up> 2*x) / x \<up> 2)) * " ^
1.829 "(x \<up> 3/(5*a*b \<up> 3*c \<up> 3)) + a/c \<up> 3 * (x*(b/a) - 3*b*(a/b \<up> 4))");
1.830 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.831 @@ -1261,21 +1261,21 @@
1.832 "-------- examples double fractions from: Mathematik 1 Schalk ----------------";
1.833 "-------- examples double fractions from: Mathematik 1 Schalk ----------------";
1.834 "----- SRD Schalk I, p.69 Nr. 454b";
1.835 -val t = TermC.str2term "((2 - x)/(2*a)) / (2*a/(x - 2))";
1.836 +val t = TermC.parse_test @{context} "((2 - x)/(2*a)) / (2*a/(x - 2))";
1.837 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.838 if UnparseC.term t = "(- 4 + 4 * x + - 1 * x \<up> 2) / (4 * a \<up> 2)"
1.839 then () else error "rational.sml: diff.behav. in norm_Rational_mg 35";
1.840
1.841 "----- SRD Schalk I, p.69 Nr. 455a";
1.842 -val t = TermC.str2term "(a \<up> 2 + 1)/(a \<up> 2 - 1) / ((a+1)/(a - 1))";
1.843 +val t = TermC.parse_test @{context} "(a \<up> 2 + 1)/(a \<up> 2 - 1) / ((a+1)/(a - 1))";
1.844 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.845 if UnparseC.term t = "(1 + a \<up> 2) / (1 + 2 * a + a \<up> 2)" then ()
1.846 else error "rational.sml: diff.behav. in norm_Rational_mg 36";
1.847
1.848 "----- Schalk I, p.69 Nr. 455b";
1.849 -val t = TermC.str2term "(x \<up> 2 - 4)/(y \<up> 2 - 9)/((2+x)/(3 - y))";
1.850 +val t = TermC.parse_test @{context} "(x \<up> 2 - 4)/(y \<up> 2 - 9)/((2+x)/(3 - y))";
1.851 (* WN130911 non-termination due to non-termination of
1.852 - cancel_p_ thy (TermC.str2term ("(- 12 + 4 * y + 3 * x \<up> 2 + - 1 * (x \<up> 2 * y)) /" ^
1.853 + cancel_p_ thy (TermC.parse_test @{context} ("(- 12 + 4 * y + 3 * x \<up> 2 + - 1 * (x \<up> 2 * y)) /" ^
1.854 "(- 18 + -9 * x + 2 * y \<up> 2 + x * y \<up> 2)"))
1.855
1.856 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.857 @@ -1284,9 +1284,9 @@
1.858 *)
1.859
1.860 "----- SK060904- 1a non-termination of cancel_p_ ?: worked before 0707xx";
1.861 -val t = TermC.str2term "(x \<up> 2 - 4)*(3 - y) / ((y \<up> 2 - 9)*(2+x))";
1.862 +val t = TermC.parse_test @{context} "(x \<up> 2 - 4)*(3 - y) / ((y \<up> 2 - 9)*(2+x))";
1.863 (* WN130911 non-termination due to non-termination of
1.864 - cancel_p_ thy (TermC.str2term ("(- 12 + 4 * y + 3 * x \<up> 2 + - 1 * (x \<up> 2 * y)) /" ^
1.865 + cancel_p_ thy (TermC.parse_test @{context} ("(- 12 + 4 * y + 3 * x \<up> 2 + - 1 * (x \<up> 2 * y)) /" ^
1.866 "(- 18 + -9 * x + 2 * y \<up> 2 + x * y \<up> 2)"))
1.867
1.868 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.869 @@ -1295,25 +1295,25 @@
1.870 *)
1.871
1.872 "----- ?: worked before 0707xx";
1.873 -val t = TermC.str2term "(3 + - 1 * y) / (-9 + y \<up> 2)";
1.874 +val t = TermC.parse_test @{context} "(3 + - 1 * y) / (-9 + y \<up> 2)";
1.875 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.876 if UnparseC.term t = "- 1 / (3 + y)"
1.877 then () else error "rational.sml: - 1 / (3 + y) norm_Rational";
1.878
1.879 "----- SRD Schalk I, p.69 Nr. 456b";
1.880 -val t = TermC.str2term "(b \<up> 3 - b \<up> 2) / (b \<up> 2+b) / (b \<up> 2 - 1)";
1.881 +val t = TermC.parse_test @{context} "(b \<up> 3 - b \<up> 2) / (b \<up> 2+b) / (b \<up> 2 - 1)";
1.882 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.883 if UnparseC.term t = "b / (1 + 2 * b + b \<up> 2)"
1.884 then () else error "rational.sml: diff.behav. in norm_Rational_mg 38";
1.885
1.886 "----- SRD Schalk I, p.69 Nr. 457b";
1.887 -val t = TermC.str2term "(16*a \<up> 2 - 9*b \<up> 2)/(2*a+3*a*b) / ((4*a+3*b)/(4*a \<up> 2 - 9*a \<up> 2*b \<up> 2))";
1.888 +val t = TermC.parse_test @{context} "(16*a \<up> 2 - 9*b \<up> 2)/(2*a+3*a*b) / ((4*a+3*b)/(4*a \<up> 2 - 9*a \<up> 2*b \<up> 2))";
1.889 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.890 if UnparseC.term t = "8 * a \<up> 2 + - 6 * a * b + - 12 * a \<up> 2 * b + 9 * a * b \<up> 2"
1.891 then () else error "rational.sml: diff.behav. in norm_Rational_mg 39";
1.892
1.893 "----- Schalk I, p.69 Nr. 458b works since 0707";
1.894 -val t = TermC.str2term "(2*a \<up> 2*x - a \<up> 2) / (a*x - b*x) / (b \<up> 2*(2*x - 1) / (x*(a - b)))";
1.895 +val t = TermC.parse_test @{context} "(2*a \<up> 2*x - a \<up> 2) / (a*x - b*x) / (b \<up> 2*(2*x - 1) / (x*(a - b)))";
1.896 (*val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.897 :
1.898 ### rls: cancel_p on: (- 1 * a \<up> 2 + 2 * (a \<up> 2 * x)) / (a * x + - 1 * (b * x)) /
1.899 @@ -1321,7 +1321,7 @@
1.900 exception Div raised
1.901
1.902 BUT
1.903 -val t = TermC.str2term
1.904 +val t = TermC.parse_test @{context}
1.905 ("(- 1 * a \<up> 2 + 2 * (a \<up> 2 * x)) / (a * x + - 1 * (b * x)) /" ^
1.906 "((- 1 * b \<up> 2 + 2 * (b \<up> 2 * x)) / (a * x + - 1 * (b * x)))");
1.907 NONE = cancel_p_ thy t;
1.908 @@ -1331,18 +1331,18 @@
1.909 *)
1.910
1.911 "----- SRD Schalk I, p.69 Nr. 459b";
1.912 -val t = TermC.str2term "(a \<up> 2 - b \<up> 2)/(a*b) / (4*(a+b) \<up> 2/a)";
1.913 +val t = TermC.parse_test @{context} "(a \<up> 2 - b \<up> 2)/(a*b) / (4*(a+b) \<up> 2/a)";
1.914 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.915 if UnparseC.term t = "(a + - 1 * b) / (4 * a * b + 4 * b \<up> 2)" then ()
1.916 else error "rational.sml: diff.behav. in norm_Rational_mg 41";
1.917
1.918 "----- Schalk I, p.69 Nr. 460b nonterm.SK";
1.919 -val t = TermC.str2term "(9*(x \<up> 2 - 8*x + 16) / (4*(y \<up> 2 - 2*y + 1))) / ((3*x - 12) / (16*y - 16))";
1.920 +val t = TermC.parse_test @{context} "(9*(x \<up> 2 - 8*x + 16) / (4*(y \<up> 2 - 2*y + 1))) / ((3*x - 12) / (16*y - 16))";
1.921 (*val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.922 exception Div raised
1.923
1.924 BUT
1.925 -val t = TermC.str2term
1.926 +val t = TermC.parse_test @{context}
1.927 ("(144 + -72 * x + 9 * x \<up> 2) / (4 + -8 * y + 4 * y \<up> 2) /" ^
1.928 "((- 12 + 3 * x) / (- 16 + 16 * y))");
1.929 NONE = cancel_p_ thy t;
1.930 @@ -1352,40 +1352,40 @@
1.931 *)
1.932
1.933 "----- some variant of the above; was non-terminating before";
1.934 -val t = TermC.str2term "9*(x \<up> 2 - 8*x+16)*(16*y - 16)/(4*(y \<up> 2 - 2*y+1)*(3*x - 12))";
1.935 +val t = TermC.parse_test @{context} "9*(x \<up> 2 - 8*x+16)*(16*y - 16)/(4*(y \<up> 2 - 2*y+1)*(3*x - 12))";
1.936 val SOME (t , _) = rewrite_set_ ctxt false norm_Rational t;
1.937 if UnparseC.term t = "(48 + - 12 * x) / (1 + - 1 * y)"
1.938 then () else error "some variant of the above; was non-terminating before";
1.939
1.940 "----- SRD Schalk I, p.70 Nr. 472a";
1.941 -val t = TermC.str2term ("((8*x \<up> 2 - 32*y \<up> 2) / (2*x + 4*y)) / ((4*x - 8*y) / (x + y))");
1.942 +val t = TermC.parse_test @{context} ("((8*x \<up> 2 - 32*y \<up> 2) / (2*x + 4*y)) / ((4*x - 8*y) / (x + y))");
1.943 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.944 if UnparseC.term t = "x + y"
1.945 then () else error "rational.sml: diff.behav. in norm_Rational_mg 43";
1.946
1.947 "----- Schalk I, p.70 Nr. 478b ----- Rechenzeit: 5 sec";
1.948 -val t = TermC.str2term ("(a - (a*b + b \<up> 2)/(a+b))/(b+(a - b)/(1+(a+b)/(a - b))) / " ^
1.949 +val t = TermC.parse_test @{context} ("(a - (a*b + b \<up> 2)/(a+b))/(b+(a - b)/(1+(a+b)/(a - b))) / " ^
1.950 "((a - a \<up> 2/(a+b))/(a+(a*b)/(a - b)))");
1.951 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.952 if UnparseC.term t = "(2 * a \<up> 3 + 2 * a \<up> 2 * b) / (a \<up> 2 * b + b \<up> 3)"
1.953 then () else error "rational.sml: diff.behav. in norm_Rational_mg 51";
1.954
1.955 (*SRD Schalk I, p.69 Nr. 461a *)
1.956 -val t = TermC.str2term "(2/(x+3) + 2/(x - 3)) / (8*x/(x \<up> 2 - 9))";
1.957 +val t = TermC.parse_test @{context} "(2/(x+3) + 2/(x - 3)) / (8*x/(x \<up> 2 - 9))";
1.958 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.959 if UnparseC.term t = "1 / 2"
1.960 then () else error "rational.sml: diff.behav. in norm_Rational_mg 44";
1.961
1.962 (*SRD Schalk I, p.69 Nr. 464b *)
1.963 -val t = TermC.str2term "(a - a/(a - 2)) / (a + a/(a - 2))";
1.964 +val t = TermC.parse_test @{context} "(a - a/(a - 2)) / (a + a/(a - 2))";
1.965 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.966 if UnparseC.term t = "(- 3 + a) / (- 1 + a)"
1.967 then () else error "rational.sml: diff.behav. in norm_Rational_mg 45";
1.968
1.969 (*SRD Schalk I, p.69 Nr. 465b *)
1.970 -val t = TermC.str2term "((x+3*y)/9 + (4*y \<up> 2 - 9*z \<up> 2)/(16*x)) / (x/9 + y/6 + z/4)";
1.971 +val t = TermC.parse_test @{context} "((x+3*y)/9 + (4*y \<up> 2 - 9*z \<up> 2)/(16*x)) / (x/9 + y/6 + z/4)";
1.972 (* WN130911 non-termination due to non-termination of
1.973 - cancel_p_ thy (TermC.str2term
1.974 + cancel_p_ thy (TermC.parse_test @{context}
1.975 ("("(576 * x \<up> 2 + 1728 * (x * y) + 1296 * y \<up> 2 + - 2916 * z \<up> 2) /" ^
1.976 "(576 * x \<up> 2 + 864 * (x * y) + 1296 * (x * z))"))
1.977
1.978 @@ -1395,13 +1395,13 @@
1.979 *)
1.980
1.981 (*SRD Schalk I, p.69 Nr. 466b *)
1.982 -val t = TermC.str2term "((1 - 7*(x - 2)/(x \<up> 2 - 4)) / (6/(x+2))) / (3/(x+5)+30/(x \<up> 2 - 25))";
1.983 +val t = TermC.parse_test @{context} "((1 - 7*(x - 2)/(x \<up> 2 - 4)) / (6/(x+2))) / (3/(x+5)+30/(x \<up> 2 - 25))";
1.984 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.985 if UnparseC.term t = "(25 + - 10 * x + x \<up> 2) / 18"
1.986 then () else error "rational.sml: diff.behav. in norm_Rational_mg 47";
1.987
1.988 (*SRD Schalk I, p.70 Nr. 469 *)
1.989 -val t = TermC.str2term ("3*b \<up> 2 / (4*a \<up> 2 - 8*a*b + 4*b \<up> 2) / " ^
1.990 +val t = TermC.parse_test @{context} ("3*b \<up> 2 / (4*a \<up> 2 - 8*a*b + 4*b \<up> 2) / " ^
1.991 "(a / (a \<up> 2*b - b \<up> 3) + (a - b) / (4*a*b \<up> 2 + 4*b \<up> 3) - 1 / (4*b \<up> 2))");
1.992 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.993 if UnparseC.term t = "- 3 * b \<up> 3 / (- 2 * a + 2 * b)"
1.994 @@ -1558,13 +1558,13 @@
1.995 "-------- investigate rulesets for cancel_p ----------------------------------";
1.996 "-------- investigate rulesets for cancel_p ----------------------------------";
1.997 val thy = @{theory "Rational"};
1.998 -val t = TermC.str2term "(a \<up> 2 + - 1*b \<up> 2) / (a \<up> 2 + - 2*a*b + b \<up> 2)";
1.999 -val tt = TermC.str2term "(1 * a + 1 * b) * (1 * a + - 1 * b)"(*numerator only*);
1.1000 +val t = TermC.parse_test @{context} "(a \<up> 2 + - 1*b \<up> 2) / (a \<up> 2 + - 2*a*b + b \<up> 2)";
1.1001 +val tt = TermC.parse_test @{context} "(1 * a + 1 * b) * (1 * a + - 1 * b)"(*numerator only*);
1.1002
1.1003 "----- with rewrite_set_";
1.1004 val SOME (tt',asm) = rewrite_set_ ctxt false make_polynomial tt;
1.1005 if UnparseC.term tt'= "a \<up> 2 + - 1 * b \<up> 2" then () else error "rls chancel_p 1";
1.1006 -val tt = TermC.str2term "((1 * a + - 1 * b) * (1 * a + - 1 * b))"(*denominator only*);
1.1007 +val tt = TermC.parse_test @{context} "((1 * a + - 1 * b) * (1 * a + - 1 * b))"(*denominator only*);
1.1008 val SOME (tt',asm) = rewrite_set_ ctxt false make_polynomial tt;
1.1009 if UnparseC.term tt' = "a \<up> 2 + - 2 * a * b + b \<up> 2" then () else error "rls chancel_p 2";
1.1010
1.1011 @@ -1585,12 +1585,12 @@
1.1012 (*default_print_depth 99;*) map (UnparseC.term o #1 o #3) der; (*default_print_depth 3;*)
1.1013
1.1014 val der = Derive.do_one ctxt Atools_erls rules ro NONE
1.1015 - (TermC.str2term "(1 * a + 1 * b) * (1 * a + - 1 * b)");
1.1016 + (TermC.parse_test @{context} "(1 * a + 1 * b) * (1 * a + - 1 * b)");
1.1017 (*default_print_depth 99;*) writeln (Derive.deriv2str der); (*default_print_depth 3;*)
1.1018
1.1019 val {rules, rew_ord=(_,ro),...} = Rule_Set.rep (get_rls @{context} "rev_rew_p");
1.1020 val der = Derive.do_one ctxt Atools_erls rules ro NONE
1.1021 - (TermC.str2term "(1 * a + - 1 * b) * (1 * a + - 1 * b)");
1.1022 + (TermC.parse_test @{context} "(1 * a + - 1 * b) * (1 * a + - 1 * b)");
1.1023 (*default_print_depth 99;*) writeln (Derive.deriv2str der); (*default_print_depth 3;*)
1.1024 (*default_print_depth 99;*) map (UnparseC.term o #1) der; (*default_print_depth 3;*)
1.1025 (*WN060829 ...postponed*)
1.1026 @@ -1638,21 +1638,21 @@
1.1027 "-------- WN1309xx non-terminating rls norm_Rational -------------------------";
1.1028 "-------- WN1309xx non-terminating rls norm_Rational -------------------------";
1.1029 (*------- Schalk I, p.70 Nr. 480b; a/b : c/d translated to a/b * d/c*)
1.1030 -val t = TermC.str2term
1.1031 +val t = TermC.parse_test @{context}
1.1032 ("((12*x*y / (9*x \<up> 2 - y \<up> 2)) / (1 / (3*x - y) \<up> 2 - 1 / (3*x + y) \<up> 2)) * " ^
1.1033 "((1/(x - 5*y) \<up> 2 - 1/(x + 5*y) \<up> 2) / (20*x*y / (x \<up> 2 - 25*y \<up> 2)))");
1.1034
1.1035 (*1st factor separately simplified *)
1.1036 -val t = TermC.str2term "((12*x*y / (9*x \<up> 2 - y \<up> 2)) / (1 / (3*x - y) \<up> 2 - 1 / (3*x + y) \<up> 2))";
1.1037 +val t = TermC.parse_test @{context} "((12*x*y / (9*x \<up> 2 - y \<up> 2)) / (1 / (3*x - y) \<up> 2 - 1 / (3*x + y) \<up> 2))";
1.1038 val SOME (t', _) = rewrite_set_ ctxt false norm_Rational t;
1.1039 if UnparseC.term t' = "(- 9 * x \<up> 2 + y \<up> 2) / - 1" then () else error "Nr. 480b lhs changed";
1.1040 (*2nd factor separately simplified *)
1.1041 -val t = TermC.str2term "((1/(x - 5*y) \<up> 2 - 1/(x + 5*y) \<up> 2) / (20*x*y / (x \<up> 2 - 25*y \<up> 2)))";
1.1042 +val t = TermC.parse_test @{context} "((1/(x - 5*y) \<up> 2 - 1/(x + 5*y) \<up> 2) / (20*x*y / (x \<up> 2 - 25*y \<up> 2)))";
1.1043 val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term t';
1.1044 if UnparseC.term t' = "- 1 / (- 1 * x \<up> 2 + 25 * y \<up> 2)" then () else error "Nr. 480b rhs changed";
1.1045
1.1046 "-------- Schalk I, p.70 Nr. 477a: terms are exploding ?!?";
1.1047 -val t = TermC.str2term ("b*y/(b - 2*y)/((b \<up> 2 - y \<up> 2)/(b+2*y)) /" ^
1.1048 +val t = TermC.parse_test @{context} ("b*y/(b - 2*y)/((b \<up> 2 - y \<up> 2)/(b+2*y)) /" ^
1.1049 "(b \<up> 2*y + b*y \<up> 2) * (a+x) \<up> 2 / ((b \<up> 2 - 4*y \<up> 2) * (a+2*x) \<up> 2)");
1.1050 (*val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t;
1.1051 :
1.1052 @@ -1667,7 +1667,7 @@
1.1053 exception Div raised
1.1054
1.1055 BUT
1.1056 -val t = TermC.str2term
1.1057 +val t = TermC.parse_test @{context}
1.1058 ("(a \<up> 2 * (b * y) + 2 * (a * (b * (x * y))) + b * (x \<up> 2 * y)) /" ^
1.1059 "(b + - 2 * y) /" ^
1.1060 "((b \<up> 2 + - 1 * y \<up> 2) / (b + 2 * y)) /" ^
1.1061 @@ -1680,7 +1680,7 @@
1.1062 *)
1.1063
1.1064 (*------- Schalk I, p.70 Nr. 476b in 2003 this worked using 10 sec. *)
1.1065 -val t = TermC.str2term
1.1066 +val t = TermC.parse_test @{context}
1.1067 ("((a \<up> 2 - b \<up> 2)/(2*a*b) + 2*a*b/(a \<up> 2 - b \<up> 2)) / ((a \<up> 2 + b \<up> 2)/(2*a*b) + 1) / " ^
1.1068 "((a \<up> 2 + b \<up> 2) \<up> 2 / (a + b) \<up> 2)");
1.1069 (* Rewrite.trace_on := true; (*true false*)
1.1070 @@ -1704,7 +1704,7 @@
1.1071 *)
1.1072
1.1073 "-------- Schalk I, p.70 Nr. 480a: terms are exploding ?!?";
1.1074 -val t = TermC.str2term ("(1/x + 1/y + 1/z) / (1/x - 1/y - 1/z) / " ^
1.1075 +val t = TermC.parse_test @{context} ("(1/x + 1/y + 1/z) / (1/x - 1/y - 1/z) / " ^
1.1076 "(2*x \<up> 2 / (x \<up> 2 - z \<up> 2) / (x / (x + z) + x / (x - z)))");
1.1077 (* Rewrite.trace_on := true; (*true false*)
1.1078 rewrite_set_ ctxt false norm_Rational t;
1.1079 @@ -1722,14 +1722,14 @@
1.1080 *)
1.1081
1.1082 "-------- Schalk I, p.60 Nr. 215d: terms are exploding, internal loop does not terminate";
1.1083 -val t = TermC.str2term "(a-b) \<up> 3 * (x+y) \<up> 4 / ((x+y) \<up> 2 * (a-b) \<up> 5)";
1.1084 +val t = TermC.parse_test @{context} "(a-b) \<up> 3 * (x+y) \<up> 4 / ((x+y) \<up> 2 * (a-b) \<up> 5)";
1.1085 (* Kein Wunder, denn Z???ler und Nenner extra als Polynom dargestellt ergibt:
1.1086
1.1087 -val t = TermC.str2term "(a-b) \<up> 3 * (x+y) \<up> 4";
1.1088 +val t = TermC.parse_test @{context} "(a-b) \<up> 3 * (x+y) \<up> 4";
1.1089 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.1090 UnparseC.term t;
1.1091 "a \<up> 3 * x \<up> 4 + 4 * a \<up> 3 * x \<up> 3 * y +6 * a \<up> 3 * x \<up> 2 * y \<up> 2 +4 * a \<up> 3 * x * y \<up> 3 +a \<up> 3 * y \<up> 4 +-3 * a \<up> 2 * b * x \<up> 4 +- 12 * a \<up> 2 * b * x \<up> 3 * y +- 18 * a \<up> 2 * b * x \<up> 2 * y \<up> 2 +- 12 * a \<up> 2 * b * x * y \<up> 3 +-3 * a \<up> 2 * b * y \<up> 4 +3 * a * b \<up> 2 * x \<up> 4 +12 * a * b \<up> 2 * x \<up> 3 * y +18 * a * b \<up> 2 * x \<up> 2 * y \<up> 2 +12 * a * b \<up> 2 * x * y \<up> 3 +3 * a * b \<up> 2 * y \<up> 4 +- 1 * b \<up> 3 * x \<up> 4 +-4 * b \<up> 3 * x \<up> 3 * y +-6 * b \<up> 3 * x \<up> 2 * y \<up> 2 +-4 * b \<up> 3 * x * y \<up> 3 +- 1 * b \<up> 3 * y \<up> 4";
1.1092 -val t = TermC.str2term "((x+y) \<up> 2 * (a-b) \<up> 5)";
1.1093 +val t = TermC.parse_test @{context} "((x+y) \<up> 2 * (a-b) \<up> 5)";
1.1094 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
1.1095 UnparseC.term t;
1.1096 "a \<up> 5 * x \<up> 2 + 2 * a \<up> 5 * x * y + a \<up> 5 * y \<up> 2 +-5 * a \<up> 4 * b * x \<up> 2 +- 10 * a \<up> 4 * b * x * y +-5 * a \<up> 4 * b * y \<up> 2 +10 * a \<up> 3 * b \<up> 2 * x \<up> 2 +20 * a \<up> 3 * b \<up> 2 * x * y +10 * a \<up> 3 * b \<up> 2 * y \<up> 2 +- 10 * a \<up> 2 * b \<up> 3 * x \<up> 2 +- 20 * a \<up> 2 * b \<up> 3 * x * y +- 10 * a \<up> 2 * b \<up> 3 * y \<up> 2 +5 * a * b \<up> 4 * x \<up> 2 +10 * a * b \<up> 4 * x * y +5 * a * b \<up> 4 * y \<up> 2 +- 1 * b \<up> 5 * x \<up> 2 +- 2 * b \<up> 5 * x * y +- 1 * b \<up> 5 * y \<up> 2";
1.1097 @@ -1737,7 +1737,7 @@
1.1098 anscheinend macht dem Rechner das Krzen diese Bruches keinen Spass mehr ...*)
1.1099
1.1100 "-------- Schalk I, p.70 Nr. 480b: terms are exploding, Rewrite.trace_on stops at";
1.1101 -val t = TermC.str2term ("((12*x*y/(9*x \<up> 2 - y \<up> 2))/" ^
1.1102 +val t = TermC.parse_test @{context} ("((12*x*y/(9*x \<up> 2 - y \<up> 2))/" ^
1.1103 "(1/(3*x - y) \<up> 2 - 1/(3*x + y) \<up> 2)) *" ^
1.1104 "(1/(x - 5*y) \<up> 2 - 1/(x + 5*y) \<up> 2)/" ^
1.1105 "(20*x*y/(x \<up> 2 - 25*y \<up> 2))");