1.1 --- a/test/Tools/isac/FE-interface/interface.sml Mon Aug 30 14:29:49 2010 +0200
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,1349 +0,0 @@
1.4 -(* tests the interface of isac's SML-kernel in accordance to
1.5 - java-tests/isac.bridge.
1.6 -
1.7 -WN050707 ... if true, the test ist marked with a \label referring
1.8 -to the same UC in isac-docu.tex as the JUnit testcase.
1.9 -use"../smltest/FE-interface/interface.sml";
1.10 -use"interface.sml";
1.11 - *)
1.12 -
1.13 - print_depth 3;
1.14 -
1.15 -"-----------------------------------------------------------------";
1.16 -"table of contents -----------------------------------------------";
1.17 -"-----------------------------------------------------------------";
1.18 -"within struct ---------------------------------------------------";
1.19 -"-----------------------------------------------------------------";
1.20 -"--------- encode ^ -> ^^^ ---------------------------------------";
1.21 -"-----------------------------------------------------------------";
1.22 -"exported from struct --------------------------------------------";
1.23 -"-----------------------------------------------------------------";
1.24 -"---------------- empty rootpbl ----------------------------------";
1.25 -"---------------- solve_linear as rootpbl FE ---------------------";
1.26 -"--------- inspect the CalcTree No.1 with Iterator No.2 ----------";
1.27 -"---------------- miniscript with mini-subpbl --------------------";
1.28 -"--------- miniscript with mini-subpbl AUTOCALCULATE Step 1-------";
1.29 -"--------- solve_linear as rootpbl AUTOCALCULATE CompleteCalc ----";
1.30 -"--------- solve_linear as rootpbl AUTOCALC CompleteHead/Calc ----";
1.31 -"--------- miniscript with mini-subpbl AUTOCALCULATE CompleteCalc-";
1.32 -"--------- miniscript with mini-subpbl AUTO CompleteCalcHead------";
1.33 -"--------- solve_linear as rootpbl AUTOCALCULATE CompleteModel ---";
1.34 -"--------- setContext..Thy ---------------------------------------";
1.35 -"--------- miniscript with mini-subpbl AUTOCALC CompleteToSubpbl -";
1.36 -"---------------- rat-eq + subpbl: no_met, NO solution dropped ---";
1.37 -"--------- tryMatchProblem, tryRefineProblem -------------------UC";
1.38 -"--------- modifyCalcHead, resetCalcHead, modelProblem ------------";
1.39 -"--------- maximum-example, UC: Modeling an example --------------";
1.40 -"--------- solve_linear from pbl-hierarchy -----------------------";
1.41 -"--------- solve_linear as in an algebra system (CAS)-------------";
1.42 -"--------- interSteps: on 'miniscript with mini-subpbl' ----------";
1.43 -"--------- getTactic, fetchApplicableTactics ---------------------";
1.44 -"--------- getAssumptions, getAccumulatedAsms --------------------";
1.45 -"--------- arbitrary combinations of steps -----------------------";
1.46 -"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} right--";
1.47 -"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} other--";
1.48 -"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} oth 2--";
1.49 -"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} NOTok--";
1.50 -"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} right----";
1.51 -"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} other----";
1.52 -"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} other 2--";
1.53 -"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} NOTok----";
1.54 -"-----------------------------------------------------------------";
1.55 -
1.56 -"within struct ---------------------------------------------------";
1.57 -"within struct ---------------------------------------------------";
1.58 -"within struct ---------------------------------------------------";
1.59 -(*==================================================================
1.60 -
1.61 -
1.62 -"--------- encode ^ -> ^^^ ---------------------------------------";
1.63 -"--------- encode ^ -> ^^^ ---------------------------------------";
1.64 -"--------- encode ^ -> ^^^ ---------------------------------------";
1.65 -if encode "a^2+b^2=c^2" = "a^^^2+b^^^2=c^^^2" then ()
1.66 -else raise error "interface.sml: diff.behav. in encode ^ -> ^^^ ";
1.67 -
1.68 -if (decode o encode) "a^2+b^2=c^2" = "a^2+b^2=c^2" then ()
1.69 -else raise error "interface.sml: diff.behav. in de/encode ^ <-> ^^^ ";
1.70 -
1.71 -==================================================================*)
1.72 -"exported from struct --------------------------------------------";
1.73 -"exported from struct --------------------------------------------";
1.74 -"exported from struct --------------------------------------------";
1.75 -
1.76 -
1.77 -(*------------ set at startup of the Kernel --------------------------*)
1.78 - states:= []; (*resets all state information in Kernel *)
1.79 -(*----------------------------------------------------------------*)
1.80 -
1.81 -"---------------- empty rootpbl ----------------------------------";
1.82 -"---------------- empty rootpbl ----------------------------------";
1.83 -"---------------- empty rootpbl ----------------------------------";
1.84 - CalcTree [([], ("", [], []))];
1.85 - Iterator 1;
1.86 - moveActiveRoot 1;
1.87 - refFormula 1 (get_pos 1 1);
1.88 -(*WN.040222: stoert das sehr, dass e_domID etc. statt leer kommt ???*)
1.89 -
1.90 -
1.91 -"---------------- solve_linear as rootpbl FE ---------------------";
1.92 -"---------------- solve_linear as rootpbl FE ---------------------";
1.93 -"---------------- solve_linear as rootpbl FE ---------------------";
1.94 - states := [];
1.95 - CalcTree (*start of calculation, return No.1*)
1.96 - [(["equality (1+-1*2+x=0)", "solveFor x","solutions L"],
1.97 - ("Test.thy",
1.98 - ["linear","univariate","equation","test"],
1.99 - ["Test","solve_linear"]))];
1.100 - Iterator 1; (*create an active Iterator on CalcTree No.1*)
1.101 -
1.102 - moveActiveRoot 1;(*sets the CalcIterator No.1 at the root of CalcTree No.1*);
1.103 - refFormula 1 (get_pos 1 1) (*gets CalcHead; model is still empty*);
1.104 -
1.105 - fetchProposedTactic 1 (*by using Iterator No.1*);
1.106 - setNextTactic 1 (Model_Problem (*["linear","univariate","equation","test"]*));
1.107 - (*by using Iterator No.1*)
1.108 - autoCalculate 1 (Step 1);
1.109 - refFormula 1 (get_pos 1 1) (*model contains descriptions for all items*);
1.110 - autoCalculate 1 (Step 1);
1.111 -(*-----since Model_Problem + complete_mod_ in case cas of SOME-----*
1.112 - fetchProposedTactic 1;
1.113 - setNextTactic 1 (Add_Given "equality (1 + -1 * 2 + x = 0)");
1.114 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1); (*equality added*);
1.115 -
1.116 - fetchProposedTactic 1;
1.117 - setNextTactic 1 (Add_Given "solveFor x");
1.118 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.119 -
1.120 - fetchProposedTactic 1;
1.121 - setNextTactic 1 (Add_Find "solutions L");
1.122 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.123 -
1.124 - fetchProposedTactic 1;
1.125 - setNextTactic 1 (Specify_Theory "Test.thy");
1.126 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.127 -*-----since Model_Problem + complete_mod_ in case cas of SOME-----*)
1.128 -
1.129 - fetchProposedTactic 1;
1.130 - setNextTactic 1 (Specify_Problem ["linear","univariate","equation","test"]);
1.131 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.132 -(*-------------------------------------------------------------------------*)
1.133 - fetchProposedTactic 1;
1.134 - val (ptp as (pt,p), tacis) = get_calc 1; get_pos 1 1;
1.135 -
1.136 - setNextTactic 1 (Specify_Method ["Test","solve_linear"]);
1.137 - val (ptp as (pt,p), tacis) = get_calc 1; get_pos 1 1;
1.138 -
1.139 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.140 - val (ptp as (pt,p), tacis) = get_calc 1; get_pos 1 1;
1.141 -
1.142 -(*-------------------------------------------------------------------------*)
1.143 - fetchProposedTactic 1;
1.144 - val (ptp as (pt,p), tacis) = get_calc 1; get_pos 1 1;
1.145 -
1.146 - setNextTactic 1 (Apply_Method ["Test","solve_linear"]);
1.147 - val (ptp as (pt,p), tacis) = get_calc 1; get_pos 1 1;
1.148 - is_complete_mod ptp;
1.149 - is_complete_spec ptp;
1.150 -
1.151 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.152 - val (ptp as (pt,p), tacis) = get_calc 1; get_pos 1 1;
1.153 - (*term2str (get_obj g_form pt [1]);*)
1.154 -(*-------------------------------------------------------------------------*)
1.155 -
1.156 - fetchProposedTactic 1;
1.157 - setNextTactic 1 (Rewrite_Set_Inst (["(bdv,x)"], "isolate_bdv"));
1.158 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.159 -
1.160 - fetchProposedTactic 1;
1.161 - setNextTactic 1 (Rewrite_Set "Test_simplify");
1.162 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.163 -
1.164 - fetchProposedTactic 1;
1.165 - setNextTactic 1 (Check_Postcond ["linear","univariate","equation","test"]);
1.166 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.167 -
1.168 - val ((pt,_),_) = get_calc 1;
1.169 - val ip = get_pos 1 1;
1.170 - val (Form f, tac, asms) = pt_extract (pt, ip);
1.171 - (*exception just above means: 'ModSpec' has been returned: error anyway*)
1.172 - if term2str f = "[x = 1]" then () else
1.173 - raise error "FE-Kernel-interface.sml: diff.behav. in solve_linear as rootpbl";
1.174 -
1.175 -
1.176 -
1.177 -"--------- inspect the CalcTree No.1 with Iterator No.2 ---------";
1.178 -"--------- inspect the CalcTree No.1 with Iterator No.2 ---------";
1.179 -"--------- inspect the CalcTree No.1 with Iterator No.2 ---------";
1.180 -(*WN041118: inspection shifted to Iterator No.1, because others need pos'*)
1.181 - moveActiveRoot 1;
1.182 - refFormula 1 ([],Pbl); getTactic 1 ([],Pbl);(*Error*)
1.183 - moveActiveDown 1;
1.184 - refFormula 1 ([1],Frm); getTactic 1 ([1],Frm);(*Error*)
1.185 - moveActiveDown 1 ;
1.186 - refFormula 1 ([1],Res); getTactic 1 ([1],Res);(*OK*)
1.187 - (*getAssumption 1 ([1],Res); TODO.WN041217*)
1.188 - moveActiveDown 1 ; refFormula 1 ([2],Res);
1.189 - moveActiveCalcHead 1; refFormula 1 ([],Pbl);
1.190 - moveActiveDown 1;
1.191 - moveActiveDown 1;
1.192 - moveActiveDown 1;
1.193 - if get_pos 1 1 = ([2], Res) then () else
1.194 - raise error "FE-interface.sml: diff.behav. in a inspect 1 with Iterator 2";
1.195 - moveActiveDown 1; refFormula 1 ([], Res);
1.196 - if get_pos 1 1 = ([], Res) then () else
1.197 - raise error "FE-interface.sml: diff.behav. in b inspect 1 with Iterator 2";
1.198 - moveActiveCalcHead 1; refFormula 1 ([],Pbl);
1.199 -
1.200 -
1.201 -
1.202 -"---------------- miniscript with mini-subpbl --------------------";
1.203 -"---------------- miniscript with mini-subpbl --------------------";
1.204 -"---------------- miniscript with mini-subpbl --------------------";
1.205 - states:=[];
1.206 - CalcTree (*start of calculation, return No.1*)
1.207 - [(["equality (x+1=2)", "solveFor x","solutions L"],
1.208 - ("Test.thy",
1.209 - ["sqroot-test","univariate","equation","test"],
1.210 - ["Test","squ-equ-test-subpbl1"]))];
1.211 - Iterator 1;
1.212 -
1.213 - moveActiveRoot 1;
1.214 - refFormula 1 (get_pos 1 1);
1.215 - fetchProposedTactic 1;
1.216 - setNextTactic 1 (Model_Problem);
1.217 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*gets ModSpec;model is still empty*)
1.218 -
1.219 - fetchProposedTactic 1;
1.220 - setNextTactic 1 (Add_Given "equality (x + 1 = 2)");
1.221 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.222 -
1.223 - fetchProposedTactic 1;
1.224 - setNextTactic 1 (Add_Given "solveFor x");
1.225 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.226 -
1.227 - fetchProposedTactic 1;
1.228 - setNextTactic 1 (Add_Find "solutions L");
1.229 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.230 -
1.231 - fetchProposedTactic 1;
1.232 - setNextTactic 1 (Specify_Theory "Test.thy");
1.233 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.234 -
1.235 - fetchProposedTactic 1;
1.236 - setNextTactic 1 (Specify_Problem
1.237 - ["sqroot-test","univariate","equation","test"]);
1.238 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.239 -"1-----------------------------------------------------------------";
1.240 -
1.241 - fetchProposedTactic 1;
1.242 - setNextTactic 1 (Specify_Method ["Test","squ-equ-test-subpbl1"]);
1.243 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.244 -
1.245 - fetchProposedTactic 1;
1.246 - setNextTactic 1 (Apply_Method ["Test","squ-equ-test-subpbl1"]);
1.247 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.248 -
1.249 - fetchProposedTactic 1;
1.250 - setNextTactic 1 (Rewrite_Set "norm_equation");
1.251 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.252 -
1.253 - fetchProposedTactic 1;
1.254 - setNextTactic 1 (Rewrite_Set "Test_simplify");
1.255 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.256 -
1.257 - fetchProposedTactic 1;(*----------------Subproblem--------------------*);
1.258 - setNextTactic 1 (Subproblem ("Test.thy",
1.259 - ["linear","univariate","equation","test"]));
1.260 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.261 -
1.262 - fetchProposedTactic 1;
1.263 - setNextTactic 1 (Model_Problem );
1.264 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.265 -
1.266 - fetchProposedTactic 1;
1.267 - setNextTactic 1 (Add_Given "equality (-1 + x = 0)");
1.268 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.269 -
1.270 - fetchProposedTactic 1;
1.271 - setNextTactic 1 (Add_Given "solveFor x");
1.272 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.273 -
1.274 - fetchProposedTactic 1;
1.275 - setNextTactic 1 (Add_Find "solutions x_i");
1.276 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.277 -
1.278 - fetchProposedTactic 1;
1.279 - setNextTactic 1 (Specify_Theory "Test.thy");
1.280 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.281 -
1.282 - fetchProposedTactic 1;
1.283 - setNextTactic 1 (Specify_Problem ["linear","univariate","equation","test"]);
1.284 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.285 -"2-----------------------------------------------------------------";
1.286 -
1.287 - fetchProposedTactic 1;
1.288 - setNextTactic 1 (Specify_Method ["Test","solve_linear"]);
1.289 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.290 -
1.291 - fetchProposedTactic 1;
1.292 - setNextTactic 1 (Apply_Method ["Test","solve_linear"]);
1.293 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.294 -
1.295 - fetchProposedTactic 1;
1.296 - setNextTactic 1 (Rewrite_Set_Inst (["(bdv,x)"], "isolate_bdv"));
1.297 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.298 -
1.299 - fetchProposedTactic 1;
1.300 - setNextTactic 1 (Rewrite_Set "Test_simplify");
1.301 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.302 -
1.303 - fetchProposedTactic 1;
1.304 - setNextTactic 1 (Check_Postcond ["linear","univariate","equation","test"]);
1.305 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.306 -
1.307 - fetchProposedTactic 1;
1.308 - setNextTactic 1 (Check_elementwise "Assumptions");
1.309 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.310 -
1.311 - val xml = fetchProposedTactic 1;
1.312 - setNextTactic 1 (Check_Postcond
1.313 - ["sqroot-test","univariate","equation","test"]);
1.314 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.315 -
1.316 - val ((pt,_),_) = get_calc 1;
1.317 - val str = pr_ptree pr_short pt;
1.318 - writeln str;
1.319 - val ip = get_pos 1 1;
1.320 - val (Form f, tac, asms) = pt_extract (pt, ip);
1.321 - (*exception just above means: 'ModSpec' has been returned: error anyway*)
1.322 - if term2str f = "[x = 1]" then () else
1.323 - raise error "FE-interface.sml: diff.behav. in miniscript with mini-subpb";
1.324 -
1.325 - DEconstrCalcTree 1;
1.326 -
1.327 -
1.328 -"--------- miniscript with mini-subpbl AUTOCALCULATE Step 1-------";
1.329 -"--------- miniscript with mini-subpbl AUTOCALCULATE Step 1-------";
1.330 -"--------- miniscript with mini-subpbl AUTOCALCULATE Step 1-------";
1.331 - states:=[];
1.332 - CalcTree
1.333 - [(["equality (x+1=2)", "solveFor x","solutions L"],
1.334 - ("Test.thy",
1.335 - ["sqroot-test","univariate","equation","test"],
1.336 - ["Test","squ-equ-test-subpbl1"]))];
1.337 - Iterator 1;
1.338 - moveActiveRoot 1;
1.339 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.340 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.341 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.342 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.343 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.344 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.345 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.346 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.347 - (*here the solve-phase starts*)
1.348 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.349 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.350 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.351 - (*------------------------------------*)
1.352 -(* print_depth 13; get_calc 1;
1.353 - *)
1.354 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.355 - (*calc-head of subproblem*)
1.356 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.357 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.358 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.359 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.360 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.361 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.362 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.363 - (*solve-phase of the subproblem*)
1.364 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.365 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.366 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.367 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.368 - (*finish subproblem*)
1.369 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.370 - (*finish problem*)
1.371 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.372 -
1.373 - (*this checks the test for correctness..*)
1.374 - val ((pt,_),_) = get_calc 1;
1.375 - val p = get_pos 1 1;
1.376 - val (Form f, tac, asms) = pt_extract (pt, p);
1.377 - if term2str f = "[x = 1]" andalso p = ([], Res) then () else
1.378 - raise error "FE-interface.sml: diff.behav. in miniscript with mini-subpb";
1.379 -
1.380 - DEconstrCalcTree 1;
1.381 -
1.382 -"--------- solve_linear as rootpbl AUTOCALCULATE CompleteCalc ----";
1.383 -"--------- solve_linear as rootpbl AUTOCALCULATE CompleteCalc ----";
1.384 -"--------- solve_linear as rootpbl AUTOCALCULATE CompleteCalc ----";
1.385 - states:=[];
1.386 - CalcTree
1.387 - [(["equality (1+-1*2+x=0)", "solveFor x","solutions L"],
1.388 - ("Test.thy",
1.389 - ["linear","univariate","equation","test"],
1.390 - ["Test","solve_linear"]))];
1.391 - Iterator 1;
1.392 - moveActiveRoot 1;
1.393 -getFormulaeFromTo 1 ([],Pbl) ([],Pbl) 999 false;
1.394 -
1.395 - autoCalculate 1 CompleteCalc;
1.396 - val (unc, del, gen) = (([],Pbl), ([],Pbl), ([],Res));
1.397 - getFormulaeFromTo 1 unc gen 1 (*only level 1*) false;
1.398 -
1.399 - val ((pt,_),_) = get_calc 1;
1.400 - val p = get_pos 1 1;
1.401 - val (Form f, tac, asms) = pt_extract (pt, p);
1.402 - if term2str f = "[x = 1]" andalso p = ([], Res) then () else
1.403 - raise error "FE-interface.sml: diff.behav. in solve_linear/rt AUTOCALCULATE ";
1.404 -
1.405 -
1.406 -"--------- solve_linear as rootpbl AUTOCALC CompleteHead/Calc ----";
1.407 -"--------- solve_linear as rootpbl AUTOCALC CompleteHead/Calc ----";
1.408 -"--------- solve_linear as rootpbl AUTOCALC CompleteHead/Calc ----";
1.409 - states:=[];
1.410 - CalcTree
1.411 - [(["equality (1+-1*2+x=0)", "solveFor x","solutions L"],
1.412 - ("Test.thy",
1.413 - ["linear","univariate","equation","test"],
1.414 - ["Test","solve_linear"]))];
1.415 - Iterator 1;
1.416 - moveActiveRoot 1;
1.417 - autoCalculate 1 CompleteCalcHead;
1.418 - refFormula 1 (get_pos 1 1);
1.419 - val ((pt,p),_) = get_calc 1;
1.420 -
1.421 -
1.422 -
1.423 - autoCalculate 1 CompleteCalc;
1.424 - val ((pt,p),_) = get_calc 1;
1.425 - if p=([], Res) then () else
1.426 - raise error "FE-interface.sml: diff.behav. in solve_linear AUTOC Head/Calc ";
1.427 -
1.428 -
1.429 -"--------- miniscript with mini-subpbl AUTOCALCULATE CompleteCalc-";
1.430 -"--------- miniscript with mini-subpbl AUTOCALCULATE CompleteCalc-";
1.431 -"--------- miniscript with mini-subpbl AUTOCALCULATE CompleteCalc-";
1.432 - states:=[];
1.433 - CalcTree
1.434 - [(["equality (x+1=2)", "solveFor x","solutions L"],
1.435 - ("Test.thy",
1.436 - ["sqroot-test","univariate","equation","test"],
1.437 - ["Test","squ-equ-test-subpbl1"]))];
1.438 - Iterator 1;
1.439 - moveActiveRoot 1;
1.440 - autoCalculate 1 CompleteCalc;
1.441 -
1.442 -(*
1.443 -getTactic 1 ([1],Frm);
1.444 -getTactic 1 ([1],Res);
1.445 -initContext 1 Thy_ ([1],Res);
1.446 -*)
1.447 -
1.448 - (*... returns calcChangedEvent with*)
1.449 - val (unc, del, gen) = (([],Pbl), ([],Pbl), ([],Res));
1.450 - getFormulaeFromTo 1 unc gen 0 (*only result*) false;
1.451 - getFormulaeFromTo 1 unc gen 1 (*only level 1*) false;
1.452 - getFormulaeFromTo 1 unc gen 99999 (*all levels*) false;
1.453 -
1.454 - val ((pt,_),_) = get_calc 1;
1.455 - val p = get_pos 1 1;
1.456 - val (Form f, tac, asms) = pt_extract (pt, p);
1.457 - if term2str f = "[x = 1]" andalso p = ([], Res) then () else
1.458 - raise error "FE-interface.sml: diff.behav. in mini-subpbl AUTOCALCULATE 6";
1.459 -
1.460 -
1.461 -"--------- miniscript with mini-subpbl AUTO CompleteCalcHead------";
1.462 -"--------- miniscript with mini-subpbl AUTO CompleteCalcHead------";
1.463 -"--------- miniscript with mini-subpbl AUTO CompleteCalcHead------";
1.464 - states:=[];
1.465 - CalcTree
1.466 - [(["equality (x+1=2)", "solveFor x","solutions L"],
1.467 - ("Test.thy",
1.468 - ["sqroot-test","univariate","equation","test"],
1.469 - ["Test","squ-equ-test-subpbl1"]))];
1.470 - Iterator 1;
1.471 -(* doesn't terminate !!!
1.472 - autoCalculate 1 CompleteCalcHead;
1.473 -*)
1.474 -
1.475 -"--------- solve_linear as rootpbl AUTOCALCULATE CompleteModel ---";
1.476 -"--------- solve_linear as rootpbl AUTOCALCULATE CompleteModel ---";
1.477 -"--------- solve_linear as rootpbl AUTOCALCULATE CompleteModel ---";
1.478 - states:=[];
1.479 - CalcTree
1.480 - [(["equality (1+-1*2+x=0)", "solveFor x","solutions L"],
1.481 - ("Test.thy",
1.482 - ["linear","univariate","equation","test"],
1.483 - ["Test","solve_linear"]))];
1.484 - Iterator 1;
1.485 - moveActiveRoot 1;
1.486 - autoCalculate 1 CompleteModel;
1.487 - refFormula 1 (get_pos 1 1);
1.488 -
1.489 -setProblem 1 ["linear","univariate","equation","test"];
1.490 -val pos = get_pos 1 1;
1.491 -setContext 1 pos (kestoreID2guh Pbl_["linear","univariate","equation","test"]);
1.492 - refFormula 1 (get_pos 1 1);
1.493 -
1.494 -setMethod 1 ["Test","solve_linear"];
1.495 -setContext 1 pos (kestoreID2guh Met_ ["Test","solve_linear"]);
1.496 - refFormula 1 (get_pos 1 1);
1.497 - val ((pt,_),_) = get_calc 1;
1.498 - if get_obj g_spec pt [] = ("e_domID",
1.499 - ["linear", "univariate","equation","test"],
1.500 - ["Test","solve_linear"]) then ()
1.501 - else raise error "FE-interface.sml: diff.behav. in setProblem, setMethod";
1.502 -
1.503 - autoCalculate 1 CompleteCalcHead;
1.504 - refFormula 1 (get_pos 1 1);
1.505 - autoCalculate 1 CompleteCalc;
1.506 - moveActiveDown 1;
1.507 - moveActiveDown 1;
1.508 - moveActiveDown 1;
1.509 - refFormula 1 (get_pos 1 1);
1.510 - val ((pt,_),_) = get_calc 1;
1.511 - val p = get_pos 1 1;
1.512 - val (Form f, tac, asms) = pt_extract (pt, p);
1.513 - if term2str f = "[x = 1]" andalso p = ([], Res) then () else
1.514 - raise error "FE-interface.sml: diff.behav. in mini-subpbl AUTOCALCULATE 6";
1.515 -
1.516 -
1.517 -"--------- setContext..Thy ---------------------------------------";
1.518 -"--------- setContext..Thy ---------------------------------------";
1.519 -"--------- setContext..Thy ---------------------------------------";
1.520 -states:=[];
1.521 -CalcTree
1.522 -[(["equality (x+1=2)", "solveFor x","solutions L"],
1.523 - ("Test.thy",
1.524 - ["sqroot-test","univariate","equation","test"],
1.525 - ["Test","squ-equ-test-subpbl1"]))];
1.526 -Iterator 1; moveActiveRoot 1;
1.527 -autoCalculate 1 CompleteCalcHead;
1.528 -autoCalculate 1 (Step 1);
1.529 -val ((pt,p),_) = get_calc 1; show_pt pt;
1.530 -(*
1.531 -setNextTactic 1 (Rewrite_Set "Test_simplify");
1.532 -autoCalculate 1 (Step 1);
1.533 -val ((pt,p),_) = get_calc 1; show_pt pt;
1.534 -*)
1.535 -"-----^^^^^ and vvvvv do the same -----";
1.536 -setContext 1 p "thy_isac_Test-rls-Test_simplify";
1.537 -val ((pt,p),_) = get_calc 1; show_pt pt;
1.538 -
1.539 -autoCalculate 1 (Step 1);
1.540 -setContext 1 p "thy_isac_Test-rls-Test_simplify";
1.541 -val ((pt,p),_) = get_calc 1; show_pt pt;
1.542 -
1.543 -autoCalculate 1 CompleteCalc;
1.544 -
1.545 -
1.546 -
1.547 -"--------- miniscript with mini-subpbl AUTOCALC CompleteToSubpbl -";
1.548 -"--------- miniscript with mini-subpbl AUTOCALC CompleteToSubpbl -";
1.549 -"--------- miniscript with mini-subpbl AUTOCALC CompleteToSubpbl -";
1.550 - states:=[];
1.551 - CalcTree
1.552 - [(["equality (x+1=2)", "solveFor x","solutions L"],
1.553 - ("Test.thy",
1.554 - ["sqroot-test","univariate","equation","test"],
1.555 - ["Test","squ-equ-test-subpbl1"]))];
1.556 - Iterator 1; moveActiveRoot 1;
1.557 - autoCalculate 1 CompleteToSubpbl;
1.558 - refFormula 1 (get_pos 1 1); (*<ISA> -1 + x = 0 </ISA>*);
1.559 - val ((pt,_),_) = get_calc 1;
1.560 - val str = pr_ptree pr_short pt;
1.561 - writeln str;
1.562 - if str = ". ----- pblobj -----\n1. x + 1 = 2\n2. x + 1 + -1 * 2 = 0\n"
1.563 - then () else
1.564 - raise error "FE-interface.sml: diff.behav. in mini-subpbl CompleteToSubpbl-1";
1.565 -
1.566 - autoCalculate 1 (Step 1); (*proceeds only, of NOT 1 step before subplb*)
1.567 - autoCalculate 1 CompleteToSubpbl;
1.568 - val ((pt,_),_) = get_calc 1;
1.569 - val str = pr_ptree pr_short pt;
1.570 - writeln str;
1.571 - autoCalculate 1 CompleteCalc; (*das geht ohnehin !*);
1.572 - val ((pt,_),_) = get_calc 1;
1.573 - val p = get_pos 1 1;
1.574 - val (Form f, tac, asms) = pt_extract (pt, p);
1.575 - if term2str f = "[x = 1]" andalso p = ([], Res) then () else
1.576 - raise error "FE-interface.sml: diff.behav. in mini-subpbl CompleteToSubpbl 1";
1.577 -
1.578 -
1.579 -
1.580 -"---------------- rat-eq + subpbl: no_met, NO solution dropped ---";
1.581 -"---------------- rat-eq + subpbl: no_met, NO solution dropped ---";
1.582 -"---------------- rat-eq + subpbl: no_met, NO solution dropped ---";
1.583 - states:=[];
1.584 - CalcTree
1.585 - [(["equality ((5*x)/(x - 2) - x/(x+2)=4)", "solveFor x","solutions L"],
1.586 - ("RatEq.thy", ["univariate","equation"], ["no_met"]))];
1.587 - Iterator 1;
1.588 - moveActiveRoot 1;
1.589 - fetchProposedTactic 1;
1.590 - setNextTactic 1 (Model_Problem );
1.591 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.592 -(*-----since Model_Problem + complete_mod_ in case cas of SOME-----*
1.593 - setNextTactic 1 (Add_Given "equality (5 * x / (x - 2) - x / (x + 2) = 4)");
1.594 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.595 - setNextTactic 1 (Add_Given "solveFor x");
1.596 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.597 - setNextTactic 1 (Add_Find "solutions L");
1.598 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.599 -*-----since Model_Problem + complete_mod_ in case cas of SOME-----*)
1.600 - setNextTactic 1 (Specify_Theory "RatEq.thy");
1.601 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.602 - setNextTactic 1 (Specify_Problem ["rational","univariate","equation"]);
1.603 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.604 - setNextTactic 1 (Specify_Method ["RatEq","solve_rat_equation"]);
1.605 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.606 - setNextTactic 1 (Apply_Method ["RatEq","solve_rat_equation"]);
1.607 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.608 - setNextTactic 1 (Rewrite_Set "RatEq_simplify");
1.609 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.610 - setNextTactic 1 (Rewrite_Set "norm_Rational");
1.611 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.612 - setNextTactic 1 (Rewrite_Set "RatEq_eliminate");
1.613 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.614 - (* __________ for "12 * x + 4 * x ^^^ 2 = 4 * (-4 + x ^^^ 2)"*)
1.615 - setNextTactic 1 (Subproblem ("PolyEq.thy", ["normalize","polynomial",
1.616 - "univariate","equation"]));
1.617 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.618 - setNextTactic 1 (Model_Problem );
1.619 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.620 -(*-----since Model_Problem + complete_mod_ in case cas of SOME-----*
1.621 - setNextTactic 1 (Add_Given
1.622 - "equality (12 * x + 4 * x ^^^ 2 = 4 * (-4 + x ^^^ 2))");
1.623 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.624 - setNextTactic 1 (Add_Given "solveFor x");
1.625 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.626 - setNextTactic 1 (Add_Find "solutions x_i");
1.627 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.628 -*-----since Model_Problem + complete_mod_ in case cas of SOME-----*)
1.629 - setNextTactic 1 (Specify_Theory "PolyEq.thy");
1.630 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.631 - setNextTactic 1 (Specify_Problem ["normalize","polynomial",
1.632 - "univariate","equation"]);
1.633 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.634 - setNextTactic 1 (Specify_Method ["PolyEq","normalize_poly"]);
1.635 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.636 - setNextTactic 1 (Apply_Method ["PolyEq","normalize_poly"]);
1.637 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.638 - setNextTactic 1 (Rewrite ("all_left",""));
1.639 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.640 - setNextTactic 1 (Rewrite_Set_Inst (["(bdv,x)"], "make_ratpoly_in"));
1.641 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.642 - (* __________ for "16 + 12 * x = 0"*)
1.643 - setNextTactic 1 (Subproblem ("PolyEq.thy",
1.644 - ["degree_1","polynomial","univariate","equation"]));
1.645 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.646 - setNextTactic 1 (Model_Problem );
1.647 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.648 -(*-----since Model_Problem + complete_mod_ in case cas of SOME-----*
1.649 - setNextTactic 1 (Add_Given
1.650 - "equality (16 + 12 * x = 0)");
1.651 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.652 - setNextTactic 1 (Add_Given "solveFor x");
1.653 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.654 - setNextTactic 1 (Add_Find "solutions x_i");
1.655 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.656 -*-----since Model_Problem + complete_mod_ in case cas of SOME-----*)
1.657 - setNextTactic 1 (Specify_Theory "PolyEq.thy");
1.658 - (*------------- some trials in the problem-hierarchy ---------------*)
1.659 - setNextTactic 1 (Specify_Problem ["linear","univariate","equation"]);
1.660 - autoCalculate 1 (Step 1); fetchProposedTactic 1; (*<ERROR> helpless </ERROR> !!!*)
1.661 - setNextTactic 1 (Refine_Problem ["univariate","equation"]);
1.662 -
1.663 -
1.664 -
1.665 -
1.666 -
1.667 - (*------------------------------------------------------------------*)
1.668 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.669 - setNextTactic 1 (Specify_Method ["PolyEq","solve_d1_polyeq_equation"]);
1.670 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.671 - setNextTactic 1 (Apply_Method ["PolyEq","solve_d1_polyeq_equation"]);
1.672 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.673 - setNextTactic 1 (Rewrite_Set_Inst (["(bdv,x)"], "d1_polyeq_simplify"));
1.674 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.675 - setNextTactic 1 (Rewrite_Set "polyeq_simplify");
1.676 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.677 - (*==================================================================*)
1.678 - setNextTactic 1 Or_to_List;
1.679 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.680 - setNextTactic 1 (Check_elementwise "Assumptions");
1.681 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.682 - setNextTactic 1 (Check_Postcond ["degree_1","polynomial",
1.683 - "univariate","equation"]);
1.684 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.685 - setNextTactic 1 (Check_Postcond ["normalize","polynomial",
1.686 - "univariate","equation"]);
1.687 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.688 - setNextTactic 1 (Check_elementwise "Assumptions");
1.689 - autoCalculate 1 (Step 1); fetchProposedTactic 1;
1.690 - setNextTactic 1 (Check_Postcond ["rational","univariate","equation"]);
1.691 - val (ptp,_) = get_calc 1;
1.692 - val (Form t,_,_) = pt_extract ptp;
1.693 - if get_pos 1 1 = ([], Res) andalso term2str t = "[x = -4 / 3]" then ()
1.694 - else writeln "FE-inteface.sml: diff.behav. in rat-eq + subpbl: no_met, NO ..";
1.695 -
1.696 -
1.697 -"---------------- tryMatchProblem, tryRefineProblem --------------";
1.698 -"---------------- tryMatchProblem, tryRefineProblem --------------";
1.699 -"---------------- tryMatchProblem, tryRefineProblem --------------";
1.700 -(*{\bf\UC{Having \isac{} Refine the Problem
1.701 - * Automatically}\label{SPECIFY:refine-auto}\\} test match and refine with
1.702 - * x^^^2 + 4*x + 5 = 2
1.703 -see isac.bridge.TestSpecify#testMatchRefine*)
1.704 - DEconstrCalcTree 1;
1.705 - CalcTree
1.706 - [(["equality (x^2 + 4*x + 5 = 2)", "solveFor x","solutions L"],
1.707 - ("Isac.thy",
1.708 - ["univariate","equation"],
1.709 - ["no_met"]))];
1.710 - Iterator 1;
1.711 - moveActiveRoot 1;
1.712 -
1.713 - fetchProposedTactic 1;
1.714 - setNextTactic 1 (Model_Problem );
1.715 - (*..this tactic should be done 'tacitly', too !*)
1.716 -
1.717 -(*
1.718 -autoCalculate 1 CompleteCalcHead;
1.719 -checkContext 1 ([],Pbl) "pbl_equ_univ";
1.720 -checkContext 1 ([],Pbl) (kestoreID2guh Pbl_ ["univariate","equation"]);
1.721 -*)
1.722 -
1.723 - autoCalculate 1 (Step 1);
1.724 -
1.725 - fetchProposedTactic 1;
1.726 - setNextTactic 1 (Add_Given "equality (x ^^^ 2 + 4 * x + 5 = 2)");
1.727 - autoCalculate 1 (Step 1);
1.728 -
1.729 - "--------- we go into the ProblemBrowser (_NO_ pblID selected) -";
1.730 -initContext 1 Pbl_ ([],Pbl);
1.731 -initContext 1 Met_ ([],Pbl);
1.732 -
1.733 - "--------- this match will show some incomplete items: ---------";
1.734 -checkContext 1 ([],Pbl) (kestoreID2guh Pbl_ ["univariate","equation"]);
1.735 -checkContext 1 ([],Pbl) (kestoreID2guh Met_ ["LinEq", "solve_lineq_equation"]);
1.736 -
1.737 -
1.738 - fetchProposedTactic 1;
1.739 - setNextTactic 1 (Add_Given "solveFor x"); autoCalculate 1 (Step 1);
1.740 -
1.741 - fetchProposedTactic 1;
1.742 - setNextTactic 1 (Add_Find "solutions L"); autoCalculate 1 (Step 1);
1.743 -
1.744 - "--------- this is a matching model (all items correct): -------";
1.745 -checkContext 1 ([],Pbl) (kestoreID2guh Pbl_ ["univariate","equation"]);
1.746 - "--------- this is a NOT matching model (some 'false': ---------";
1.747 -checkContext 1 ([],Pbl)(kestoreID2guh Pbl_["linear","univariate","equation"]);
1.748 -
1.749 - "--------- find out a matching problem: ------------------------";
1.750 - "--------- find out a matching problem (FAILING: no new pbl) ---";
1.751 - refineProblem 1([],Pbl)(pblID2guh ["linear","univariate","equation"]);
1.752 -
1.753 - "--------- find out a matching problem (SUCCESSFUL) ------------";
1.754 - refineProblem 1 ([],Pbl) (pblID2guh ["univariate","equation"]);
1.755 -
1.756 - "--------- tryMatch, tryRefine did not change the calculation -";
1.757 - "--------- this is done by <TRANSFER> on the pbl-browser: ------";
1.758 - setNextTactic 1 (Specify_Problem ["normalize","polynomial",
1.759 - "univariate","equation"]);
1.760 - autoCalculate 1 (Step 1);
1.761 -(*WN050904 fetchProposedTactic again --> Specify_Problem ["normalize",...
1.762 - and Specify_Theory skipped in comparison to below ---^^^-inserted *)
1.763 -(*------------vvv-inserted-----------------------------------------------*)
1.764 - fetchProposedTactic 1;
1.765 - setNextTactic 1 (Specify_Problem ["normalize","polynomial",
1.766 - "univariate","equation"]);
1.767 - autoCalculate 1 (Step 1);
1.768 -
1.769 -(*and Specify_Theory skipped by fetchProposedTactic ?!?*)
1.770 -
1.771 - fetchProposedTactic 1;
1.772 - setNextTactic 1 (Specify_Method ["PolyEq","normalize_poly"]);
1.773 - autoCalculate 1 (Step 1);
1.774 -
1.775 - fetchProposedTactic 1;
1.776 - setNextTactic 1 (Apply_Method ["PolyEq","normalize_poly"]);
1.777 - autoCalculate 1 CompleteCalc;
1.778 - val ((pt,_),_) = get_calc 1;
1.779 - show_pt pt;
1.780 - val p = get_pos 1 1;
1.781 - val (Form f, tac, asms) = pt_extract (pt, p);
1.782 - if term2str f = "[x = -1, x = -3]" andalso p = ([], Res) then () else
1.783 - raise error "FE-interface.sml: diff.behav. in tryMatchProblem, tryRefine";
1.784 -
1.785 -(*------------^^^-inserted-----------------------------------------------*)
1.786 -(*WN050904 the fetchProposedTactic's below may not have worked like that
1.787 - before, too, because there was no check*)
1.788 - fetchProposedTactic 1;
1.789 - setNextTactic 1 (Specify_Theory "PolyEq.thy");
1.790 - autoCalculate 1 (Step 1);
1.791 -
1.792 - fetchProposedTactic 1;
1.793 - setNextTactic 1 (Specify_Method ["PolyEq","normalize_poly"]);
1.794 - autoCalculate 1 (Step 1);
1.795 -
1.796 - fetchProposedTactic 1;
1.797 - "--------- now the calc-header is ready for enter 'solving' ----";
1.798 - autoCalculate 1 CompleteCalc;
1.799 -
1.800 - val ((pt,_),_) = get_calc 1;
1.801 -rootthy pt;
1.802 - show_pt pt;
1.803 - val p = get_pos 1 1;
1.804 - val (Form f, tac, asms) = pt_extract (pt, p);
1.805 - if term2str f = "[x = -1, x = -3]" andalso p = ([], Res) then () else
1.806 - raise error "FE-interface.sml: diff.behav. in tryMatchProblem, tryRefine";
1.807 -
1.808 -
1.809 -"--------- modifyCalcHead, resetCalcHead, modelProblem ------------";
1.810 -"--------- modifyCalcHead, resetCalcHead, modelProblem ------------";
1.811 -"--------- modifyCalcHead, resetCalcHead, modelProblem ------------";
1.812 -
1.813 - states:=[];
1.814 - DEconstrCalcTree 1;
1.815 - CalcTree
1.816 - [(["equality (x+1=2)", "solveFor x","solutions L"],
1.817 - ("Test.thy",
1.818 - ["sqroot-test","univariate","equation","test"],
1.819 - ["Test","squ-equ-test-subpbl1"]))];
1.820 - Iterator 1;
1.821 - moveActiveRoot 1;
1.822 -
1.823 - modifyCalcHead 1 (([],Pbl),(*the position from refFormula*)
1.824 - "solve (x+1=2, x)",(*the headline*)
1.825 - [Given ["equality (x+1=2)", "solveFor x"],
1.826 - Find ["solutions L"](*,Relate []*)],
1.827 - Pbl,
1.828 - ("Test.thy",
1.829 - ["sqroot-test","univariate","equation","test"],
1.830 - ["Test","squ-equ-test-subpbl1"]));
1.831 -resetCalcHead 1;
1.832 -modelProblem 1;
1.833 -
1.834 -
1.835 -"---------------- maximum-example, UC: Modeling an example -------";
1.836 -"---------------- maximum-example, UC: Modeling an example -------";
1.837 -"---------------- maximum-example, UC: Modeling an example -------";
1.838 -(* {\bf\UC{Editing the Model}\label{SPECIFY:enter}\label{SPECIFY:check}\\}
1.839 -see isac.bridge.TestModel#testEditItems
1.840 -*)
1.841 - val elems = ["fixedValues [r=Arbfix]","maximum A","valuesFor [a,b]",
1.842 - "relations [A=a*b, (a/2)^2 + (b/2)^2 = r^2]",
1.843 - "relations [A=a*b, (a/2)^2 + (b/2)^2 = r^2]",
1.844 - "relations [A=a*b, a/2=r*sin alpha, b/2=r*cos alpha]",
1.845 - (*^^^ these are the elements for the root-problem (in variants)*)
1.846 - (*vvv these are elements required for subproblems*)
1.847 - "boundVariable a","boundVariable b","boundVariable alpha",
1.848 - "interval {x::real. 0 <= x & x <= 2*r}",
1.849 - "interval {x::real. 0 <= x & x <= 2*r}",
1.850 - "interval {x::real. 0 <= x & x <= pi}",
1.851 - "errorBound (eps=(0::real))"]
1.852 - (*specifying is not interesting for this example*)
1.853 - val spec = ("DiffApp.thy", ["maximum_of","function"],
1.854 - ["DiffApp","max_by_calculus"]);
1.855 - (*the empty model with descriptions for user-guidance by Model_Problem*)
1.856 - val empty_model = [Given ["fixedValues []"],
1.857 - Find ["maximum", "valuesFor"],
1.858 - Relate ["relations []"]];
1.859 - states:=[];
1.860 - DEconstrCalcTree 1;
1.861 - CalcTree [(elems, spec)];
1.862 - Iterator 1;
1.863 - moveActiveRoot 1;
1.864 - refFormula 1 (get_pos 1 1);
1.865 - (*this gives a completely empty model*)
1.866 -
1.867 - fetchProposedTactic 1;
1.868 -(*fill the CalcHead with Descriptions...*)
1.869 - setNextTactic 1 (Model_Problem );
1.870 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.871 -
1.872 - (*user input is !!!!!EITHER!!!!! _some_ (at least one) items of the model
1.873 - !!!!!OR!!!!! _one_ part of the specification !!!!!!!!!!!!!*)
1.874 - (*input of two items, 'fixedValues [r=Arbfix]' and 'maximum b'...*)
1.875 - modifyCalcHead 1 (([],Pbl) (*position, from previous refFormula*),
1.876 - "Problem (DiffApp.thy, [maximum_of, function])",
1.877 - (*the head-form ^^^ is not used for input here*)
1.878 - [Given ["fixedValues [r=Arbfix]"(*new input*)],
1.879 - Find ["maximum b"(*new input*), "valuesFor"],
1.880 - Relate ["relations"]],
1.881 - (*input (Arbfix will dissappear soon)*)
1.882 - Pbl (*belongsto*),
1.883 - e_spec (*no input to the specification*));
1.884 -
1.885 - (*the user does not know, what 'superfluous' for 'maximum b' may mean
1.886 - and asks what to do next*)
1.887 - fetchProposedTactic 1;
1.888 - (*the student follows the advice*)
1.889 - setNextTactic 1 (Add_Find "maximum A"); (*FIXME.17.11.03: does not yet work*)
1.890 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
1.891 -
1.892 - (*this input completes the model*)
1.893 - modifyCalcHead 1 (([],Pbl), "not used here",
1.894 - [Given ["fixedValues [r=Arbfix]"],
1.895 - Find ["maximum A", "valuesFor [a,b]"(*new input*)],
1.896 - Relate ["relations [A=a*b, \
1.897 - \(a/2)^2 + (b/2)^2 = r^2]"]], Pbl, e_spec);
1.898 -
1.899 - (*specification is not interesting an should be skipped by the dialogguide;
1.900 - !!!!!!!!!!!!!!!!!!!! input of ONE part at a time !!!!!!!!!!!!!!!!!!!!!!*)
1.901 - modifyCalcHead 1 (([],Pbl), "not used here",
1.902 - [Given ["fixedValues [r=Arbfix]"],
1.903 - Find ["maximum A", "valuesFor [a,b]"(*new input*)],
1.904 - Relate ["relations [A=a*b, \
1.905 - \(a/2)^2 + (b/2)^2 = r^2]"]], Pbl,
1.906 - ("DiffApp.thy", ["e_pblID"], ["e_metID"]));
1.907 - modifyCalcHead 1 (([],Pbl), "not used here",
1.908 - [Given ["fixedValues [r=Arbfix]"],
1.909 - Find ["maximum A", "valuesFor [a,b]"(*new input*)],
1.910 - Relate ["relations [A=a*b, \
1.911 - \(a/2)^2 + (b/2)^2 = r^2]"]], Pbl,
1.912 - ("DiffApp.thy", ["maximum_of","function"],
1.913 - ["e_metID"]));
1.914 - modifyCalcHead 1 (([],Pbl), "not used here",
1.915 - [Given ["fixedValues [r=Arbfix]"],
1.916 - Find ["maximum A", "valuesFor [a,b]"(*new input*)],
1.917 - Relate ["relations [A=a*b, \
1.918 - \(a/2)^2 + (b/2)^2 = r^2]"]], Pbl,
1.919 - ("DiffApp.thy", ["maximum_of","function"],
1.920 - ["DiffApp","max_by_calculus"]));
1.921 - (*this final calcHead now has STATUS 'complete' !*)
1.922 - DEconstrCalcTree 1;
1.923 -
1.924 -
1.925 -"--------- solve_linear from pbl-hierarchy -----------------------";
1.926 -"--------- solve_linear from pbl-hierarchy -----------------------";
1.927 -"--------- solve_linear from pbl-hierarchy -----------------------";
1.928 - states:=[];
1.929 - val (fmz, sp) = ([], ("", ["linear","univariate","equation","test"], []));
1.930 - CalcTree [(fmz, sp)];
1.931 - Iterator 1; moveActiveRoot 1;
1.932 - refFormula 1 (get_pos 1 1);
1.933 - modifyCalcHead 1 (([],Pbl),"solve (1+-1*2+x=0)",
1.934 - [Given ["equality (1+-1*2+x=0)", "solveFor x"],
1.935 - Find ["solutions L"]],
1.936 - Pbl,
1.937 - ("Test.thy", ["linear","univariate","equation","test"],
1.938 - ["Test","solve_linear"]));
1.939 - autoCalculate 1 CompleteCalc;
1.940 - refFormula 1 (get_pos 1 1);
1.941 - val ((pt,_),_) = get_calc 1;
1.942 - val p = get_pos 1 1;
1.943 - val (Form f, tac, asms) = pt_extract (pt, p);
1.944 - if term2str f = "[x = 1]" andalso p = ([], Res) then () else
1.945 - raise error "FE-interface.sml: diff.behav. in from pbl-hierarchy";
1.946 -
1.947 -
1.948 -
1.949 -"--------- solve_linear as in an algebra system (CAS)-------------";
1.950 -"--------- solve_linear as in an algebra system (CAS)-------------";
1.951 -"--------- solve_linear as in an algebra system (CAS)-------------";
1.952 - states:=[];
1.953 - val (fmz, sp) = ([], ("", [], []));
1.954 - CalcTree [(fmz, sp)];
1.955 - Iterator 1; moveActiveRoot 1;
1.956 - modifyCalcHead 1 (([],Pbl),"solveTest (1+-1*2+x=0,x)", [], Pbl, ("", [], []));
1.957 - autoCalculate 1 CompleteCalc;
1.958 - refFormula 1 (get_pos 1 1);
1.959 - val ((pt,_),_) = get_calc 1;
1.960 - val p = get_pos 1 1;
1.961 - val (Form f, tac, asms) = pt_extract (pt, p);
1.962 - if term2str f = "[x = 1]" andalso p = ([], Res) then () else
1.963 - raise error "FE-interface.sml: diff.behav. in algebra system";
1.964 -
1.965 -
1.966 -
1.967 -"--------- interSteps: on 'miniscript with mini-subpbl' ----------";
1.968 -"--------- interSteps: on 'miniscript with mini-subpbl' ----------";
1.969 -"--------- interSteps: on 'miniscript with mini-subpbl' ----------";
1.970 - states:=[];
1.971 - CalcTree
1.972 - [(["equality (x+1=2)", "solveFor x","solutions L"],
1.973 - ("Test.thy",
1.974 - ["sqroot-test","univariate","equation","test"],
1.975 - ["Test","squ-equ-test-subpbl1"]))];
1.976 - Iterator 1;
1.977 - moveActiveRoot 1;
1.978 - autoCalculate 1 CompleteCalc;
1.979 - val ((pt,_),_) = get_calc 1;
1.980 - show_pt pt;
1.981 -
1.982 - (*UC\label{SOLVE:INFO:intermediate-steps}*)
1.983 - interSteps 1 ([2],Res);
1.984 - val ((pt,_),_) = get_calc 1; show_pt pt (*new ([2,1],Frm)..([2,6],Res)*);
1.985 - val (unc, del, gen) = (([1],Res),([1],Res),([2,6],Res));
1.986 - getFormulaeFromTo 1 unc gen 1 false;
1.987 -
1.988 - (*UC\label{SOLVE:INFO:intermediate-steps}*)
1.989 - interSteps 1 ([3,2],Res);
1.990 - val ((pt,_),_) = get_calc 1; show_pt pt (*new ([3,2,1],Frm)..([3,2,2],Res)*);
1.991 - val (unc, del, gen) = (([3,1],Res),([3,1],Res),([3,2,2],Res));
1.992 - getFormulaeFromTo 1 unc gen 1 false;
1.993 -
1.994 - (*UC\label{SOLVE:INFO:intermediate-steps}*)
1.995 - interSteps 1 ([3],Res) (*no new steps in subproblems*);
1.996 - val (unc, del, gen) = (([3],Pbl),([3],Pbl),([3,2],Res));
1.997 - getFormulaeFromTo 1 unc gen 1 false;
1.998 -
1.999 - (*UC\label{SOLVE:INFO:intermediate-steps}*)
1.1000 - interSteps 1 ([],Res) (*no new steps in subproblems*);
1.1001 - val (unc, del, gen) = (([],Pbl),([],Pbl),([4],Res));
1.1002 - getFormulaeFromTo 1 unc gen 1 false;
1.1003 -
1.1004 -
1.1005 -"--------- getTactic, fetchApplicableTactics ---------------------";
1.1006 -"--------- getTactic, fetchApplicableTactics ---------------------";
1.1007 -"--------- getTactic, fetchApplicableTactics ---------------------";
1.1008 - states:=[];
1.1009 - CalcTree
1.1010 - [(["equality (x+1=2)", "solveFor x","solutions L"],
1.1011 - ("Test.thy",
1.1012 - ["sqroot-test","univariate","equation","test"],
1.1013 - ["Test","squ-equ-test-subpbl1"]))];
1.1014 - Iterator 1; moveActiveRoot 1;
1.1015 - autoCalculate 1 CompleteCalc;
1.1016 - val ((pt,_),_) = get_calc 1;
1.1017 - show_pt pt;
1.1018 -
1.1019 - (*UC\label{SOLVE:HIDE:getTactic}*)
1.1020 - getTactic 1 ([],Pbl);
1.1021 - getTactic 1 ([1],Res);
1.1022 - getTactic 1 ([3],Pbl);
1.1023 - getTactic 1 ([3,1],Frm);
1.1024 - getTactic 1 ([3],Res);
1.1025 - getTactic 1 ([],Res);
1.1026 -
1.1027 -(*UC\label{SOLVE:MANUAL:TACTIC:listall}*)
1.1028 - fetchApplicableTactics 1 99999 ([],Pbl);
1.1029 - fetchApplicableTactics 1 99999 ([1],Res);
1.1030 - fetchApplicableTactics 1 99999 ([3],Pbl);
1.1031 - fetchApplicableTactics 1 99999 ([3,1],Res);
1.1032 - fetchApplicableTactics 1 99999 ([3],Res);
1.1033 - fetchApplicableTactics 1 99999 ([],Res);
1.1034 -
1.1035 -
1.1036 -"--------- getAssumptions, getAccumulatedAsms --------------------";
1.1037 -"--------- getAssumptions, getAccumulatedAsms --------------------";
1.1038 -"--------- getAssumptions, getAccumulatedAsms --------------------";
1.1039 -states:=[];
1.1040 -CalcTree
1.1041 -[(["equality (x/(x^2 - 6*x+9) - 1/(x^2 - 3*x) =1/x)",
1.1042 - "solveFor x","solutions L"],
1.1043 - ("RatEq.thy",["univariate","equation"],["no_met"]))];
1.1044 -Iterator 1; moveActiveRoot 1;
1.1045 -autoCalculate 1 CompleteCalc;
1.1046 -val ((pt,_),_) = get_calc 1;
1.1047 -show_pt pt;
1.1048 -
1.1049 -(*UC\label{SOLVE:HELP:assumptions}*)
1.1050 -getAssumptions 1 ([3], Res);
1.1051 -getAssumptions 1 ([5], Res);
1.1052 -(*UC\label{SOLVE:HELP:assumptions-origin} WN0502 still without positions*)
1.1053 -getAccumulatedAsms 1 ([3], Res);
1.1054 -getAccumulatedAsms 1 ([5], Res);
1.1055 -
1.1056 -
1.1057 -"--------- arbitrary combinations of steps -----------------------";
1.1058 -"--------- arbitrary combinations of steps -----------------------";
1.1059 -"--------- arbitrary combinations of steps -----------------------";
1.1060 - states:=[];
1.1061 - CalcTree (*start of calculation, return No.1*)
1.1062 - [(["equality (1+-1*2+x=0)", "solveFor x","solutions L"],
1.1063 - ("Test.thy",
1.1064 - ["linear","univariate","equation","test"],
1.1065 - ["Test","solve_linear"]))];
1.1066 - Iterator 1; moveActiveRoot 1;
1.1067 -
1.1068 - fetchProposedTactic 1;
1.1069 - setNextTactic 1 (Model_Problem );
1.1070 - autoCalculate 1 (Step 1);
1.1071 -
1.1072 - fetchProposedTactic 1;
1.1073 - fetchProposedTactic 1;
1.1074 -
1.1075 - setNextTactic 1 (Add_Find "solutions L");
1.1076 - setNextTactic 1 (Add_Find "solutions L");
1.1077 -
1.1078 - autoCalculate 1 (Step 1);
1.1079 - autoCalculate 1 (Step 1);
1.1080 -
1.1081 - setNextTactic 1 (Specify_Theory "Test.thy");
1.1082 - fetchProposedTactic 1;
1.1083 - autoCalculate 1 (Step 1);
1.1084 -
1.1085 - autoCalculate 1 (Step 1);
1.1086 - autoCalculate 1 (Step 1);
1.1087 - autoCalculate 1 (Step 1);
1.1088 - autoCalculate 1 (Step 1);
1.1089 -(*------------------------- end calc-head*)
1.1090 -
1.1091 - fetchProposedTactic 1;
1.1092 - setNextTactic 1 (Rewrite_Set_Inst (["(bdv,x)"], "isolate_bdv"));
1.1093 - autoCalculate 1 (Step 1);
1.1094 -
1.1095 - setNextTactic 1 (Rewrite_Set "Test_simplify");
1.1096 - fetchProposedTactic 1;
1.1097 - autoCalculate 1 (Step 1);
1.1098 -
1.1099 - autoCalculate 1 CompleteCalc;
1.1100 - val ((pt,_),_) = get_calc 1;
1.1101 - val p = get_pos 1 1;
1.1102 - val (Form f, tac, asms) = pt_extract (pt, p);
1.1103 - if term2str f = "[x = 1]" andalso p = ([], Res) then () else
1.1104 - raise error "FE-interface.sml: diff.behav. in combinations of steps";
1.1105 -
1.1106 -
1.1107 -"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} right--";
1.1108 -"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} right--";
1.1109 -"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} right--";
1.1110 - states:=[];
1.1111 - CalcTree
1.1112 - [(["equality (x+1=2)", "solveFor x","solutions L"],
1.1113 - ("Test.thy",
1.1114 - ["sqroot-test","univariate","equation","test"],
1.1115 - ["Test","squ-equ-test-subpbl1"]))];
1.1116 - Iterator 1;
1.1117 - moveActiveRoot 1;
1.1118 - autoCalculate 1 CompleteCalcHead;
1.1119 - autoCalculate 1 (Step 1);
1.1120 - autoCalculate 1 (Step 1);
1.1121 - appendFormula 1 "-1 + x = 0";
1.1122 - (*... returns calcChangedEvent with*)
1.1123 - val (unc, del, gen) = (([1],Res), ([1],Res), ([2],Res));
1.1124 - getFormulaeFromTo 1 unc gen 99999 (*all levels*) false;
1.1125 -
1.1126 - val ((pt,_),_) = get_calc 1;
1.1127 - val p = get_pos 1 1;
1.1128 - val (Form f, tac, asms) = pt_extract (pt, p);
1.1129 - if term2str f = "-1 + x = 0" andalso p = ([2], Res) then () else
1.1130 - raise error "FE-interface.sml: diff.behav. in FORMULA:enter} right";
1.1131 -
1.1132 -"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} other--";
1.1133 -"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} other--";
1.1134 -"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} other--";
1.1135 - states:=[];
1.1136 - CalcTree
1.1137 - [(["equality (x+1=2)", "solveFor x","solutions L"],
1.1138 - ("Test.thy",
1.1139 - ["sqroot-test","univariate","equation","test"],
1.1140 - ["Test","squ-equ-test-subpbl1"]))];
1.1141 - Iterator 1;
1.1142 - moveActiveRoot 1;
1.1143 - autoCalculate 1 CompleteCalcHead;
1.1144 - autoCalculate 1 (Step 1);
1.1145 - autoCalculate 1 (Step 1);
1.1146 - appendFormula 1 "x - 1 = 0";
1.1147 - val (unc, del, gen) = (([1],Res), ([1],Res), ([2],Res));
1.1148 - getFormulaeFromTo 1 unc gen 99999 (*all levels*) false;
1.1149 - (*11 elements !!!*)
1.1150 -
1.1151 - val ((pt,_),_) = get_calc 1;
1.1152 - val p = get_pos 1 1;
1.1153 - val (Form f, tac, asms) = pt_extract (pt, p);
1.1154 - if term2str f = "x - 1 = 0" andalso p = ([2], Res) then () else
1.1155 - raise error "FE-interface.sml: diff.behav. in FORMULA:enter} other";
1.1156 -
1.1157 -"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} oth 2--";
1.1158 -"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} oth 2--";
1.1159 -"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} oth 2--";
1.1160 - states:=[];
1.1161 - CalcTree
1.1162 - [(["equality (x+1=2)", "solveFor x","solutions L"],
1.1163 - ("Test.thy",
1.1164 - ["sqroot-test","univariate","equation","test"],
1.1165 - ["Test","squ-equ-test-subpbl1"]))];
1.1166 - Iterator 1;
1.1167 - moveActiveRoot 1;
1.1168 - autoCalculate 1 CompleteCalcHead;
1.1169 - autoCalculate 1 (Step 1);
1.1170 - autoCalculate 1 (Step 1);
1.1171 - appendFormula 1 "x = 1";
1.1172 - (*... returns calcChangedEvent with*)
1.1173 - val (unc, del, gen) = (([1],Res), ([1],Res), ([3,2],Res));
1.1174 - getFormulaeFromTo 1 unc gen 99999 (*all levels*) false;
1.1175 - (*6 elements !!!*)
1.1176 -
1.1177 - val ((pt,_),_) = get_calc 1;
1.1178 - val p = get_pos 1 1;
1.1179 - val (Form f, tac, asms) = pt_extract (pt, p);
1.1180 - if term2str f = "x = 1" andalso p = ([3,2], Res) then () else
1.1181 - raise error "FE-interface.sml: diff.behav. in FORMULA:enter} oth 2";
1.1182 -
1.1183 -
1.1184 -"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} NOTok--";
1.1185 -"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} NOTok--";
1.1186 -"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} NOTok--";
1.1187 - states:=[];
1.1188 - CalcTree
1.1189 - [(["equality (x+1=2)", "solveFor x","solutions L"],
1.1190 - ("Test.thy",
1.1191 - ["sqroot-test","univariate","equation","test"],
1.1192 - ["Test","squ-equ-test-subpbl1"]))];
1.1193 - Iterator 1;
1.1194 - moveActiveRoot 1;
1.1195 - autoCalculate 1 CompleteCalcHead;
1.1196 - autoCalculate 1 (Step 1);
1.1197 - autoCalculate 1 (Step 1);
1.1198 - appendFormula 1 "x - 4711 = 0";
1.1199 - (*... returns <ERROR> no derivation found </ERROR>*)
1.1200 -
1.1201 - val ((pt,_),_) = get_calc 1;
1.1202 - val p = get_pos 1 1;
1.1203 - val (Form f, tac, asms) = pt_extract (pt, p);
1.1204 - if term2str f = "x + 1 + -1 * 2 = 0" andalso p = ([1], Res) then () else
1.1205 - raise error "FE-interface.sml: diff.behav. in FORMULA:enter} NOTok";
1.1206 -
1.1207 -
1.1208 -"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} right----";
1.1209 -"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} right----";
1.1210 -"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} right----";
1.1211 - states:=[];
1.1212 - CalcTree
1.1213 - [(["equality (x+1=2)", "solveFor x","solutions L"],
1.1214 - ("Test.thy",
1.1215 - ["sqroot-test","univariate","equation","test"],
1.1216 - ["Test","squ-equ-test-subpbl1"]))];
1.1217 - Iterator 1;
1.1218 - moveActiveRoot 1;
1.1219 - autoCalculate 1 CompleteCalc;
1.1220 - moveActiveFormula 1 ([2],Res);
1.1221 - replaceFormula 1 "-1 + x = 0" (*i.e. repeats input*);
1.1222 - (*... returns <ERROR> formula not changed </ERROR>*)
1.1223 -
1.1224 - val ((pt,_),_) = get_calc 1;
1.1225 - val p = get_pos 1 1;
1.1226 - val (Form f, tac, asms) = pt_extract (pt, p);
1.1227 - if term2str f = "-1 + x = 0" andalso p = ([2], Res) then () else
1.1228 - raise error "FE-interface.sml: diff.behav. in FORMULA:replace} right 1";
1.1229 - if map fst (get_interval ([2],Res) ([],Res) 9999 pt) =
1.1230 - [([2], Res), ([3], Pbl), ([3, 1], Frm), ([3, 1], Res), ([3, 2], Res),
1.1231 - ([3], Res), ([4], Res), ([], Res)] then () (*nothing deleted!*) else
1.1232 - raise error "FE-interface.sml: diff.behav. in FORMULA:replace} right 2";
1.1233 -
1.1234 -(*WN050211 replaceFormula didn't work on second ctree: thus now tested...*)
1.1235 - CalcTree
1.1236 - [(["equality (x+1=2)", "solveFor x","solutions L"],
1.1237 - ("Test.thy",
1.1238 - ["sqroot-test","univariate","equation","test"],
1.1239 - ["Test","squ-equ-test-subpbl1"]))];
1.1240 - Iterator 2;
1.1241 - moveActiveRoot 2;
1.1242 - autoCalculate 2 CompleteCalc;
1.1243 - moveActiveFormula 2 ([2],Res);
1.1244 - replaceFormula 2 "-1 + x = 0" (*i.e. repeats input*);
1.1245 - (*... returns <ERROR> formula not changed </ERROR>*)
1.1246 -
1.1247 - val ((pt,_),_) = get_calc 2;
1.1248 - val p = get_pos 2 1;
1.1249 - val (Form f, tac, asms) = pt_extract (pt, p);
1.1250 - if term2str f = "-1 + x = 0" andalso p = ([2], Res) then () else
1.1251 - raise error "FE-interface.sml: diff.behav. in FORMULA:replace} right 1";
1.1252 - if map fst (get_interval ([2],Res) ([],Res) 9999 pt) =
1.1253 - [([2], Res), ([3], Pbl), ([3, 1], Frm), ([3, 1], Res), ([3, 2], Res),
1.1254 - ([3], Res), ([4], Res), ([], Res)] then () (*nothing deleted!*) else
1.1255 - raise error "FE-interface.sml: diff.behav. in FORMULA:replace} right 2b";
1.1256 -
1.1257 -"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} other----";
1.1258 -"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} other----";
1.1259 -"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} other----";
1.1260 - states:=[];
1.1261 - CalcTree
1.1262 - [(["equality (x+1=2)", "solveFor x","solutions L"],
1.1263 - ("Test.thy",
1.1264 - ["sqroot-test","univariate","equation","test"],
1.1265 - ["Test","squ-equ-test-subpbl1"]))];
1.1266 - Iterator 1;
1.1267 - moveActiveRoot 1;
1.1268 - autoCalculate 1 CompleteCalc;
1.1269 - moveActiveFormula 1 ([2],Res); (*there is "-1 + x = 0"*)
1.1270 - replaceFormula 1 "x - 1 = 0"; (*<-------------------------------------*)
1.1271 - (*... returns calcChangedEvent with*)
1.1272 - val (unc, del, gen) = (([1],Res), ([4],Res), ([2],Res));
1.1273 - getFormulaeFromTo 1 unc gen 99999 (*all levels*) false;
1.1274 -
1.1275 - val ((pt,_),_) = get_calc 1;
1.1276 - show_pt pt;
1.1277 - val p = get_pos 1 1;
1.1278 - val (Form f, tac, asms) = pt_extract (pt, p);
1.1279 - if term2str f = "x - 1 = 0" andalso p = ([2], Res) then () else
1.1280 - raise error "FE-interface.sml: diff.behav. in FORMULA:replace} other 1";
1.1281 -(* for getting the list in whole length ...
1.1282 -print_depth 99;map fst (get_interval ([1],Res) ([],Res) 9999 pt);print_depth 3;
1.1283 - *)
1.1284 - if map fst (get_interval ([1],Res) ([],Res) 9999 pt) =
1.1285 - [([1], Res), ([2, 1], Frm), ([2, 1], Res), ([2, 2], Res), ([2, 3], Res),
1.1286 - ([2, 4], Res), ([2, 5], Res), ([2, 6], Res), ([2, 7], Res),
1.1287 - ([2, 8], Res), ([2, 9], Res), ([2], Res)
1.1288 -(*WN060727 {cutlevup->test_trans} removed: ,
1.1289 - ([], Res)(*dropped, if test_trans doesnt stop at PblNd*)*)] then () else
1.1290 - raise error "FE-interface.sml: diff.behav. in FORMULA:replace} other 2";
1.1291 -
1.1292 -
1.1293 -
1.1294 -"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} other 2--";
1.1295 -"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} other 2--";
1.1296 -"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} other 2--";
1.1297 - states:=[];
1.1298 - CalcTree
1.1299 - [(["equality (x+1=2)", "solveFor x","solutions L"],
1.1300 - ("Test.thy",
1.1301 - ["sqroot-test","univariate","equation","test"],
1.1302 - ["Test","squ-equ-test-subpbl1"]))];
1.1303 - Iterator 1;
1.1304 - moveActiveRoot 1;
1.1305 - autoCalculate 1 CompleteCalc;
1.1306 - moveActiveFormula 1 ([2],Res); (*there is "-1 + x = 0"*)
1.1307 - replaceFormula 1 "x = 1"; (*<-------------------------------------*)
1.1308 - (*... returns calcChangedEvent with ...*)
1.1309 - val (unc, del, gen) = (([1],Res), ([4],Res), ([3,2],Res));
1.1310 - getFormulaeFromTo 1 unc gen 99999 (*all levels*) false;
1.1311 - (*9 elements !!!*)
1.1312 -
1.1313 - val ((pt,_),_) = get_calc 1;
1.1314 - show_pt pt; (*error: ...get_interval drops ([3,2],Res) ...*)
1.1315 - val (t,_) = get_obj g_result pt [3,2]; term2str t;
1.1316 - if map fst (get_interval ([1],Res) ([],Res) 9999 pt) =
1.1317 - [([1], Res), ([2], Res), ([3], Pbl), ([3, 1], Frm), ([3, 1], Res),
1.1318 - ([3, 2, 1], Frm), ([3, 2, 1], Res), ([3, 2, 2], Res),
1.1319 - ([3,2],Res)] then () else
1.1320 - raise error "FE-interface.sml: diff.behav. in FORMULA:replace} oth2 1";
1.1321 -
1.1322 - val p = get_pos 1 1;
1.1323 - val (Form f, tac, asms) = pt_extract (pt, p);
1.1324 - if term2str f = "x = 1" andalso p = ([3,2], Res) then () else
1.1325 - raise error "FE-interface.sml: diff.behav. in FORMULA:replace} oth2 2";
1.1326 -
1.1327 -
1.1328 -
1.1329 -"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} NOTok----";
1.1330 -"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} NOTok----";
1.1331 -"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} NOTok----";
1.1332 - states:=[];
1.1333 - CalcTree
1.1334 - [(["equality (x+1=2)", "solveFor x","solutions L"],
1.1335 - ("Test.thy",
1.1336 - ["sqroot-test","univariate","equation","test"],
1.1337 - ["Test","squ-equ-test-subpbl1"]))];
1.1338 - Iterator 1;
1.1339 - moveActiveRoot 1;
1.1340 - autoCalculate 1 CompleteCalc;
1.1341 - moveActiveFormula 1 ([2],Res); (*there is "-1 + x = 0"*)
1.1342 - replaceFormula 1 "x - 4711 = 0";
1.1343 - (*... returns <ERROR> no derivation found </ERROR>*)
1.1344 -
1.1345 - val ((pt,_),_) = get_calc 1;
1.1346 - show_pt pt;
1.1347 - val p = get_pos 1 1;
1.1348 - val (Form f, tac, asms) = pt_extract (pt, p);
1.1349 - if term2str f = "-1 + x = 0" andalso p = ([2], Res) then () else
1.1350 - raise error "FE-interface.sml: diff.behav. in FORMULA:replace} NOTok";
1.1351 -
1.1352 -
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/test/Tools/isac/Frontend/interface.sml Mon Aug 30 14:35:51 2010 +0200
2.3 @@ -0,0 +1,1349 @@
2.4 +(* tests the interface of isac's SML-kernel in accordance to
2.5 + java-tests/isac.bridge.
2.6 +
2.7 +WN050707 ... if true, the test ist marked with a \label referring
2.8 +to the same UC in isac-docu.tex as the JUnit testcase.
2.9 +use"../smltest/FE-interface/interface.sml";
2.10 +use"interface.sml";
2.11 + *)
2.12 +
2.13 + print_depth 3;
2.14 +
2.15 +"-----------------------------------------------------------------";
2.16 +"table of contents -----------------------------------------------";
2.17 +"-----------------------------------------------------------------";
2.18 +"within struct ---------------------------------------------------";
2.19 +"-----------------------------------------------------------------";
2.20 +"--------- encode ^ -> ^^^ ---------------------------------------";
2.21 +"-----------------------------------------------------------------";
2.22 +"exported from struct --------------------------------------------";
2.23 +"-----------------------------------------------------------------";
2.24 +"---------------- empty rootpbl ----------------------------------";
2.25 +"---------------- solve_linear as rootpbl FE ---------------------";
2.26 +"--------- inspect the CalcTree No.1 with Iterator No.2 ----------";
2.27 +"---------------- miniscript with mini-subpbl --------------------";
2.28 +"--------- miniscript with mini-subpbl AUTOCALCULATE Step 1-------";
2.29 +"--------- solve_linear as rootpbl AUTOCALCULATE CompleteCalc ----";
2.30 +"--------- solve_linear as rootpbl AUTOCALC CompleteHead/Calc ----";
2.31 +"--------- miniscript with mini-subpbl AUTOCALCULATE CompleteCalc-";
2.32 +"--------- miniscript with mini-subpbl AUTO CompleteCalcHead------";
2.33 +"--------- solve_linear as rootpbl AUTOCALCULATE CompleteModel ---";
2.34 +"--------- setContext..Thy ---------------------------------------";
2.35 +"--------- miniscript with mini-subpbl AUTOCALC CompleteToSubpbl -";
2.36 +"---------------- rat-eq + subpbl: no_met, NO solution dropped ---";
2.37 +"--------- tryMatchProblem, tryRefineProblem -------------------UC";
2.38 +"--------- modifyCalcHead, resetCalcHead, modelProblem ------------";
2.39 +"--------- maximum-example, UC: Modeling an example --------------";
2.40 +"--------- solve_linear from pbl-hierarchy -----------------------";
2.41 +"--------- solve_linear as in an algebra system (CAS)-------------";
2.42 +"--------- interSteps: on 'miniscript with mini-subpbl' ----------";
2.43 +"--------- getTactic, fetchApplicableTactics ---------------------";
2.44 +"--------- getAssumptions, getAccumulatedAsms --------------------";
2.45 +"--------- arbitrary combinations of steps -----------------------";
2.46 +"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} right--";
2.47 +"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} other--";
2.48 +"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} oth 2--";
2.49 +"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} NOTok--";
2.50 +"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} right----";
2.51 +"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} other----";
2.52 +"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} other 2--";
2.53 +"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} NOTok----";
2.54 +"-----------------------------------------------------------------";
2.55 +
2.56 +"within struct ---------------------------------------------------";
2.57 +"within struct ---------------------------------------------------";
2.58 +"within struct ---------------------------------------------------";
2.59 +(*==================================================================
2.60 +
2.61 +
2.62 +"--------- encode ^ -> ^^^ ---------------------------------------";
2.63 +"--------- encode ^ -> ^^^ ---------------------------------------";
2.64 +"--------- encode ^ -> ^^^ ---------------------------------------";
2.65 +if encode "a^2+b^2=c^2" = "a^^^2+b^^^2=c^^^2" then ()
2.66 +else raise error "interface.sml: diff.behav. in encode ^ -> ^^^ ";
2.67 +
2.68 +if (decode o encode) "a^2+b^2=c^2" = "a^2+b^2=c^2" then ()
2.69 +else raise error "interface.sml: diff.behav. in de/encode ^ <-> ^^^ ";
2.70 +
2.71 +==================================================================*)
2.72 +"exported from struct --------------------------------------------";
2.73 +"exported from struct --------------------------------------------";
2.74 +"exported from struct --------------------------------------------";
2.75 +
2.76 +
2.77 +(*------------ set at startup of the Kernel --------------------------*)
2.78 + states:= []; (*resets all state information in Kernel *)
2.79 +(*----------------------------------------------------------------*)
2.80 +
2.81 +"---------------- empty rootpbl ----------------------------------";
2.82 +"---------------- empty rootpbl ----------------------------------";
2.83 +"---------------- empty rootpbl ----------------------------------";
2.84 + CalcTree [([], ("", [], []))];
2.85 + Iterator 1;
2.86 + moveActiveRoot 1;
2.87 + refFormula 1 (get_pos 1 1);
2.88 +(*WN.040222: stoert das sehr, dass e_domID etc. statt leer kommt ???*)
2.89 +
2.90 +
2.91 +"---------------- solve_linear as rootpbl FE ---------------------";
2.92 +"---------------- solve_linear as rootpbl FE ---------------------";
2.93 +"---------------- solve_linear as rootpbl FE ---------------------";
2.94 + states := [];
2.95 + CalcTree (*start of calculation, return No.1*)
2.96 + [(["equality (1+-1*2+x=0)", "solveFor x","solutions L"],
2.97 + ("Test.thy",
2.98 + ["linear","univariate","equation","test"],
2.99 + ["Test","solve_linear"]))];
2.100 + Iterator 1; (*create an active Iterator on CalcTree No.1*)
2.101 +
2.102 + moveActiveRoot 1;(*sets the CalcIterator No.1 at the root of CalcTree No.1*);
2.103 + refFormula 1 (get_pos 1 1) (*gets CalcHead; model is still empty*);
2.104 +
2.105 + fetchProposedTactic 1 (*by using Iterator No.1*);
2.106 + setNextTactic 1 (Model_Problem (*["linear","univariate","equation","test"]*));
2.107 + (*by using Iterator No.1*)
2.108 + autoCalculate 1 (Step 1);
2.109 + refFormula 1 (get_pos 1 1) (*model contains descriptions for all items*);
2.110 + autoCalculate 1 (Step 1);
2.111 +(*-----since Model_Problem + complete_mod_ in case cas of SOME-----*
2.112 + fetchProposedTactic 1;
2.113 + setNextTactic 1 (Add_Given "equality (1 + -1 * 2 + x = 0)");
2.114 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1); (*equality added*);
2.115 +
2.116 + fetchProposedTactic 1;
2.117 + setNextTactic 1 (Add_Given "solveFor x");
2.118 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.119 +
2.120 + fetchProposedTactic 1;
2.121 + setNextTactic 1 (Add_Find "solutions L");
2.122 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.123 +
2.124 + fetchProposedTactic 1;
2.125 + setNextTactic 1 (Specify_Theory "Test.thy");
2.126 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.127 +*-----since Model_Problem + complete_mod_ in case cas of SOME-----*)
2.128 +
2.129 + fetchProposedTactic 1;
2.130 + setNextTactic 1 (Specify_Problem ["linear","univariate","equation","test"]);
2.131 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.132 +(*-------------------------------------------------------------------------*)
2.133 + fetchProposedTactic 1;
2.134 + val (ptp as (pt,p), tacis) = get_calc 1; get_pos 1 1;
2.135 +
2.136 + setNextTactic 1 (Specify_Method ["Test","solve_linear"]);
2.137 + val (ptp as (pt,p), tacis) = get_calc 1; get_pos 1 1;
2.138 +
2.139 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.140 + val (ptp as (pt,p), tacis) = get_calc 1; get_pos 1 1;
2.141 +
2.142 +(*-------------------------------------------------------------------------*)
2.143 + fetchProposedTactic 1;
2.144 + val (ptp as (pt,p), tacis) = get_calc 1; get_pos 1 1;
2.145 +
2.146 + setNextTactic 1 (Apply_Method ["Test","solve_linear"]);
2.147 + val (ptp as (pt,p), tacis) = get_calc 1; get_pos 1 1;
2.148 + is_complete_mod ptp;
2.149 + is_complete_spec ptp;
2.150 +
2.151 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.152 + val (ptp as (pt,p), tacis) = get_calc 1; get_pos 1 1;
2.153 + (*term2str (get_obj g_form pt [1]);*)
2.154 +(*-------------------------------------------------------------------------*)
2.155 +
2.156 + fetchProposedTactic 1;
2.157 + setNextTactic 1 (Rewrite_Set_Inst (["(bdv,x)"], "isolate_bdv"));
2.158 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.159 +
2.160 + fetchProposedTactic 1;
2.161 + setNextTactic 1 (Rewrite_Set "Test_simplify");
2.162 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.163 +
2.164 + fetchProposedTactic 1;
2.165 + setNextTactic 1 (Check_Postcond ["linear","univariate","equation","test"]);
2.166 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.167 +
2.168 + val ((pt,_),_) = get_calc 1;
2.169 + val ip = get_pos 1 1;
2.170 + val (Form f, tac, asms) = pt_extract (pt, ip);
2.171 + (*exception just above means: 'ModSpec' has been returned: error anyway*)
2.172 + if term2str f = "[x = 1]" then () else
2.173 + raise error "FE-Kernel-interface.sml: diff.behav. in solve_linear as rootpbl";
2.174 +
2.175 +
2.176 +
2.177 +"--------- inspect the CalcTree No.1 with Iterator No.2 ---------";
2.178 +"--------- inspect the CalcTree No.1 with Iterator No.2 ---------";
2.179 +"--------- inspect the CalcTree No.1 with Iterator No.2 ---------";
2.180 +(*WN041118: inspection shifted to Iterator No.1, because others need pos'*)
2.181 + moveActiveRoot 1;
2.182 + refFormula 1 ([],Pbl); getTactic 1 ([],Pbl);(*Error*)
2.183 + moveActiveDown 1;
2.184 + refFormula 1 ([1],Frm); getTactic 1 ([1],Frm);(*Error*)
2.185 + moveActiveDown 1 ;
2.186 + refFormula 1 ([1],Res); getTactic 1 ([1],Res);(*OK*)
2.187 + (*getAssumption 1 ([1],Res); TODO.WN041217*)
2.188 + moveActiveDown 1 ; refFormula 1 ([2],Res);
2.189 + moveActiveCalcHead 1; refFormula 1 ([],Pbl);
2.190 + moveActiveDown 1;
2.191 + moveActiveDown 1;
2.192 + moveActiveDown 1;
2.193 + if get_pos 1 1 = ([2], Res) then () else
2.194 + raise error "FE-interface.sml: diff.behav. in a inspect 1 with Iterator 2";
2.195 + moveActiveDown 1; refFormula 1 ([], Res);
2.196 + if get_pos 1 1 = ([], Res) then () else
2.197 + raise error "FE-interface.sml: diff.behav. in b inspect 1 with Iterator 2";
2.198 + moveActiveCalcHead 1; refFormula 1 ([],Pbl);
2.199 +
2.200 +
2.201 +
2.202 +"---------------- miniscript with mini-subpbl --------------------";
2.203 +"---------------- miniscript with mini-subpbl --------------------";
2.204 +"---------------- miniscript with mini-subpbl --------------------";
2.205 + states:=[];
2.206 + CalcTree (*start of calculation, return No.1*)
2.207 + [(["equality (x+1=2)", "solveFor x","solutions L"],
2.208 + ("Test.thy",
2.209 + ["sqroot-test","univariate","equation","test"],
2.210 + ["Test","squ-equ-test-subpbl1"]))];
2.211 + Iterator 1;
2.212 +
2.213 + moveActiveRoot 1;
2.214 + refFormula 1 (get_pos 1 1);
2.215 + fetchProposedTactic 1;
2.216 + setNextTactic 1 (Model_Problem);
2.217 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*gets ModSpec;model is still empty*)
2.218 +
2.219 + fetchProposedTactic 1;
2.220 + setNextTactic 1 (Add_Given "equality (x + 1 = 2)");
2.221 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.222 +
2.223 + fetchProposedTactic 1;
2.224 + setNextTactic 1 (Add_Given "solveFor x");
2.225 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.226 +
2.227 + fetchProposedTactic 1;
2.228 + setNextTactic 1 (Add_Find "solutions L");
2.229 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.230 +
2.231 + fetchProposedTactic 1;
2.232 + setNextTactic 1 (Specify_Theory "Test.thy");
2.233 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.234 +
2.235 + fetchProposedTactic 1;
2.236 + setNextTactic 1 (Specify_Problem
2.237 + ["sqroot-test","univariate","equation","test"]);
2.238 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.239 +"1-----------------------------------------------------------------";
2.240 +
2.241 + fetchProposedTactic 1;
2.242 + setNextTactic 1 (Specify_Method ["Test","squ-equ-test-subpbl1"]);
2.243 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.244 +
2.245 + fetchProposedTactic 1;
2.246 + setNextTactic 1 (Apply_Method ["Test","squ-equ-test-subpbl1"]);
2.247 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.248 +
2.249 + fetchProposedTactic 1;
2.250 + setNextTactic 1 (Rewrite_Set "norm_equation");
2.251 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.252 +
2.253 + fetchProposedTactic 1;
2.254 + setNextTactic 1 (Rewrite_Set "Test_simplify");
2.255 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.256 +
2.257 + fetchProposedTactic 1;(*----------------Subproblem--------------------*);
2.258 + setNextTactic 1 (Subproblem ("Test.thy",
2.259 + ["linear","univariate","equation","test"]));
2.260 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.261 +
2.262 + fetchProposedTactic 1;
2.263 + setNextTactic 1 (Model_Problem );
2.264 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.265 +
2.266 + fetchProposedTactic 1;
2.267 + setNextTactic 1 (Add_Given "equality (-1 + x = 0)");
2.268 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.269 +
2.270 + fetchProposedTactic 1;
2.271 + setNextTactic 1 (Add_Given "solveFor x");
2.272 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.273 +
2.274 + fetchProposedTactic 1;
2.275 + setNextTactic 1 (Add_Find "solutions x_i");
2.276 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.277 +
2.278 + fetchProposedTactic 1;
2.279 + setNextTactic 1 (Specify_Theory "Test.thy");
2.280 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.281 +
2.282 + fetchProposedTactic 1;
2.283 + setNextTactic 1 (Specify_Problem ["linear","univariate","equation","test"]);
2.284 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.285 +"2-----------------------------------------------------------------";
2.286 +
2.287 + fetchProposedTactic 1;
2.288 + setNextTactic 1 (Specify_Method ["Test","solve_linear"]);
2.289 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.290 +
2.291 + fetchProposedTactic 1;
2.292 + setNextTactic 1 (Apply_Method ["Test","solve_linear"]);
2.293 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.294 +
2.295 + fetchProposedTactic 1;
2.296 + setNextTactic 1 (Rewrite_Set_Inst (["(bdv,x)"], "isolate_bdv"));
2.297 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.298 +
2.299 + fetchProposedTactic 1;
2.300 + setNextTactic 1 (Rewrite_Set "Test_simplify");
2.301 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.302 +
2.303 + fetchProposedTactic 1;
2.304 + setNextTactic 1 (Check_Postcond ["linear","univariate","equation","test"]);
2.305 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.306 +
2.307 + fetchProposedTactic 1;
2.308 + setNextTactic 1 (Check_elementwise "Assumptions");
2.309 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.310 +
2.311 + val xml = fetchProposedTactic 1;
2.312 + setNextTactic 1 (Check_Postcond
2.313 + ["sqroot-test","univariate","equation","test"]);
2.314 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.315 +
2.316 + val ((pt,_),_) = get_calc 1;
2.317 + val str = pr_ptree pr_short pt;
2.318 + writeln str;
2.319 + val ip = get_pos 1 1;
2.320 + val (Form f, tac, asms) = pt_extract (pt, ip);
2.321 + (*exception just above means: 'ModSpec' has been returned: error anyway*)
2.322 + if term2str f = "[x = 1]" then () else
2.323 + raise error "FE-interface.sml: diff.behav. in miniscript with mini-subpb";
2.324 +
2.325 + DEconstrCalcTree 1;
2.326 +
2.327 +
2.328 +"--------- miniscript with mini-subpbl AUTOCALCULATE Step 1-------";
2.329 +"--------- miniscript with mini-subpbl AUTOCALCULATE Step 1-------";
2.330 +"--------- miniscript with mini-subpbl AUTOCALCULATE Step 1-------";
2.331 + states:=[];
2.332 + CalcTree
2.333 + [(["equality (x+1=2)", "solveFor x","solutions L"],
2.334 + ("Test.thy",
2.335 + ["sqroot-test","univariate","equation","test"],
2.336 + ["Test","squ-equ-test-subpbl1"]))];
2.337 + Iterator 1;
2.338 + moveActiveRoot 1;
2.339 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.340 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.341 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.342 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.343 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.344 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.345 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.346 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.347 + (*here the solve-phase starts*)
2.348 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.349 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.350 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.351 + (*------------------------------------*)
2.352 +(* print_depth 13; get_calc 1;
2.353 + *)
2.354 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.355 + (*calc-head of subproblem*)
2.356 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.357 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.358 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.359 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.360 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.361 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.362 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.363 + (*solve-phase of the subproblem*)
2.364 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.365 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.366 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.367 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.368 + (*finish subproblem*)
2.369 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.370 + (*finish problem*)
2.371 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.372 +
2.373 + (*this checks the test for correctness..*)
2.374 + val ((pt,_),_) = get_calc 1;
2.375 + val p = get_pos 1 1;
2.376 + val (Form f, tac, asms) = pt_extract (pt, p);
2.377 + if term2str f = "[x = 1]" andalso p = ([], Res) then () else
2.378 + raise error "FE-interface.sml: diff.behav. in miniscript with mini-subpb";
2.379 +
2.380 + DEconstrCalcTree 1;
2.381 +
2.382 +"--------- solve_linear as rootpbl AUTOCALCULATE CompleteCalc ----";
2.383 +"--------- solve_linear as rootpbl AUTOCALCULATE CompleteCalc ----";
2.384 +"--------- solve_linear as rootpbl AUTOCALCULATE CompleteCalc ----";
2.385 + states:=[];
2.386 + CalcTree
2.387 + [(["equality (1+-1*2+x=0)", "solveFor x","solutions L"],
2.388 + ("Test.thy",
2.389 + ["linear","univariate","equation","test"],
2.390 + ["Test","solve_linear"]))];
2.391 + Iterator 1;
2.392 + moveActiveRoot 1;
2.393 +getFormulaeFromTo 1 ([],Pbl) ([],Pbl) 999 false;
2.394 +
2.395 + autoCalculate 1 CompleteCalc;
2.396 + val (unc, del, gen) = (([],Pbl), ([],Pbl), ([],Res));
2.397 + getFormulaeFromTo 1 unc gen 1 (*only level 1*) false;
2.398 +
2.399 + val ((pt,_),_) = get_calc 1;
2.400 + val p = get_pos 1 1;
2.401 + val (Form f, tac, asms) = pt_extract (pt, p);
2.402 + if term2str f = "[x = 1]" andalso p = ([], Res) then () else
2.403 + raise error "FE-interface.sml: diff.behav. in solve_linear/rt AUTOCALCULATE ";
2.404 +
2.405 +
2.406 +"--------- solve_linear as rootpbl AUTOCALC CompleteHead/Calc ----";
2.407 +"--------- solve_linear as rootpbl AUTOCALC CompleteHead/Calc ----";
2.408 +"--------- solve_linear as rootpbl AUTOCALC CompleteHead/Calc ----";
2.409 + states:=[];
2.410 + CalcTree
2.411 + [(["equality (1+-1*2+x=0)", "solveFor x","solutions L"],
2.412 + ("Test.thy",
2.413 + ["linear","univariate","equation","test"],
2.414 + ["Test","solve_linear"]))];
2.415 + Iterator 1;
2.416 + moveActiveRoot 1;
2.417 + autoCalculate 1 CompleteCalcHead;
2.418 + refFormula 1 (get_pos 1 1);
2.419 + val ((pt,p),_) = get_calc 1;
2.420 +
2.421 +
2.422 +
2.423 + autoCalculate 1 CompleteCalc;
2.424 + val ((pt,p),_) = get_calc 1;
2.425 + if p=([], Res) then () else
2.426 + raise error "FE-interface.sml: diff.behav. in solve_linear AUTOC Head/Calc ";
2.427 +
2.428 +
2.429 +"--------- miniscript with mini-subpbl AUTOCALCULATE CompleteCalc-";
2.430 +"--------- miniscript with mini-subpbl AUTOCALCULATE CompleteCalc-";
2.431 +"--------- miniscript with mini-subpbl AUTOCALCULATE CompleteCalc-";
2.432 + states:=[];
2.433 + CalcTree
2.434 + [(["equality (x+1=2)", "solveFor x","solutions L"],
2.435 + ("Test.thy",
2.436 + ["sqroot-test","univariate","equation","test"],
2.437 + ["Test","squ-equ-test-subpbl1"]))];
2.438 + Iterator 1;
2.439 + moveActiveRoot 1;
2.440 + autoCalculate 1 CompleteCalc;
2.441 +
2.442 +(*
2.443 +getTactic 1 ([1],Frm);
2.444 +getTactic 1 ([1],Res);
2.445 +initContext 1 Thy_ ([1],Res);
2.446 +*)
2.447 +
2.448 + (*... returns calcChangedEvent with*)
2.449 + val (unc, del, gen) = (([],Pbl), ([],Pbl), ([],Res));
2.450 + getFormulaeFromTo 1 unc gen 0 (*only result*) false;
2.451 + getFormulaeFromTo 1 unc gen 1 (*only level 1*) false;
2.452 + getFormulaeFromTo 1 unc gen 99999 (*all levels*) false;
2.453 +
2.454 + val ((pt,_),_) = get_calc 1;
2.455 + val p = get_pos 1 1;
2.456 + val (Form f, tac, asms) = pt_extract (pt, p);
2.457 + if term2str f = "[x = 1]" andalso p = ([], Res) then () else
2.458 + raise error "FE-interface.sml: diff.behav. in mini-subpbl AUTOCALCULATE 6";
2.459 +
2.460 +
2.461 +"--------- miniscript with mini-subpbl AUTO CompleteCalcHead------";
2.462 +"--------- miniscript with mini-subpbl AUTO CompleteCalcHead------";
2.463 +"--------- miniscript with mini-subpbl AUTO CompleteCalcHead------";
2.464 + states:=[];
2.465 + CalcTree
2.466 + [(["equality (x+1=2)", "solveFor x","solutions L"],
2.467 + ("Test.thy",
2.468 + ["sqroot-test","univariate","equation","test"],
2.469 + ["Test","squ-equ-test-subpbl1"]))];
2.470 + Iterator 1;
2.471 +(* doesn't terminate !!!
2.472 + autoCalculate 1 CompleteCalcHead;
2.473 +*)
2.474 +
2.475 +"--------- solve_linear as rootpbl AUTOCALCULATE CompleteModel ---";
2.476 +"--------- solve_linear as rootpbl AUTOCALCULATE CompleteModel ---";
2.477 +"--------- solve_linear as rootpbl AUTOCALCULATE CompleteModel ---";
2.478 + states:=[];
2.479 + CalcTree
2.480 + [(["equality (1+-1*2+x=0)", "solveFor x","solutions L"],
2.481 + ("Test.thy",
2.482 + ["linear","univariate","equation","test"],
2.483 + ["Test","solve_linear"]))];
2.484 + Iterator 1;
2.485 + moveActiveRoot 1;
2.486 + autoCalculate 1 CompleteModel;
2.487 + refFormula 1 (get_pos 1 1);
2.488 +
2.489 +setProblem 1 ["linear","univariate","equation","test"];
2.490 +val pos = get_pos 1 1;
2.491 +setContext 1 pos (kestoreID2guh Pbl_["linear","univariate","equation","test"]);
2.492 + refFormula 1 (get_pos 1 1);
2.493 +
2.494 +setMethod 1 ["Test","solve_linear"];
2.495 +setContext 1 pos (kestoreID2guh Met_ ["Test","solve_linear"]);
2.496 + refFormula 1 (get_pos 1 1);
2.497 + val ((pt,_),_) = get_calc 1;
2.498 + if get_obj g_spec pt [] = ("e_domID",
2.499 + ["linear", "univariate","equation","test"],
2.500 + ["Test","solve_linear"]) then ()
2.501 + else raise error "FE-interface.sml: diff.behav. in setProblem, setMethod";
2.502 +
2.503 + autoCalculate 1 CompleteCalcHead;
2.504 + refFormula 1 (get_pos 1 1);
2.505 + autoCalculate 1 CompleteCalc;
2.506 + moveActiveDown 1;
2.507 + moveActiveDown 1;
2.508 + moveActiveDown 1;
2.509 + refFormula 1 (get_pos 1 1);
2.510 + val ((pt,_),_) = get_calc 1;
2.511 + val p = get_pos 1 1;
2.512 + val (Form f, tac, asms) = pt_extract (pt, p);
2.513 + if term2str f = "[x = 1]" andalso p = ([], Res) then () else
2.514 + raise error "FE-interface.sml: diff.behav. in mini-subpbl AUTOCALCULATE 6";
2.515 +
2.516 +
2.517 +"--------- setContext..Thy ---------------------------------------";
2.518 +"--------- setContext..Thy ---------------------------------------";
2.519 +"--------- setContext..Thy ---------------------------------------";
2.520 +states:=[];
2.521 +CalcTree
2.522 +[(["equality (x+1=2)", "solveFor x","solutions L"],
2.523 + ("Test.thy",
2.524 + ["sqroot-test","univariate","equation","test"],
2.525 + ["Test","squ-equ-test-subpbl1"]))];
2.526 +Iterator 1; moveActiveRoot 1;
2.527 +autoCalculate 1 CompleteCalcHead;
2.528 +autoCalculate 1 (Step 1);
2.529 +val ((pt,p),_) = get_calc 1; show_pt pt;
2.530 +(*
2.531 +setNextTactic 1 (Rewrite_Set "Test_simplify");
2.532 +autoCalculate 1 (Step 1);
2.533 +val ((pt,p),_) = get_calc 1; show_pt pt;
2.534 +*)
2.535 +"-----^^^^^ and vvvvv do the same -----";
2.536 +setContext 1 p "thy_isac_Test-rls-Test_simplify";
2.537 +val ((pt,p),_) = get_calc 1; show_pt pt;
2.538 +
2.539 +autoCalculate 1 (Step 1);
2.540 +setContext 1 p "thy_isac_Test-rls-Test_simplify";
2.541 +val ((pt,p),_) = get_calc 1; show_pt pt;
2.542 +
2.543 +autoCalculate 1 CompleteCalc;
2.544 +
2.545 +
2.546 +
2.547 +"--------- miniscript with mini-subpbl AUTOCALC CompleteToSubpbl -";
2.548 +"--------- miniscript with mini-subpbl AUTOCALC CompleteToSubpbl -";
2.549 +"--------- miniscript with mini-subpbl AUTOCALC CompleteToSubpbl -";
2.550 + states:=[];
2.551 + CalcTree
2.552 + [(["equality (x+1=2)", "solveFor x","solutions L"],
2.553 + ("Test.thy",
2.554 + ["sqroot-test","univariate","equation","test"],
2.555 + ["Test","squ-equ-test-subpbl1"]))];
2.556 + Iterator 1; moveActiveRoot 1;
2.557 + autoCalculate 1 CompleteToSubpbl;
2.558 + refFormula 1 (get_pos 1 1); (*<ISA> -1 + x = 0 </ISA>*);
2.559 + val ((pt,_),_) = get_calc 1;
2.560 + val str = pr_ptree pr_short pt;
2.561 + writeln str;
2.562 + if str = ". ----- pblobj -----\n1. x + 1 = 2\n2. x + 1 + -1 * 2 = 0\n"
2.563 + then () else
2.564 + raise error "FE-interface.sml: diff.behav. in mini-subpbl CompleteToSubpbl-1";
2.565 +
2.566 + autoCalculate 1 (Step 1); (*proceeds only, of NOT 1 step before subplb*)
2.567 + autoCalculate 1 CompleteToSubpbl;
2.568 + val ((pt,_),_) = get_calc 1;
2.569 + val str = pr_ptree pr_short pt;
2.570 + writeln str;
2.571 + autoCalculate 1 CompleteCalc; (*das geht ohnehin !*);
2.572 + val ((pt,_),_) = get_calc 1;
2.573 + val p = get_pos 1 1;
2.574 + val (Form f, tac, asms) = pt_extract (pt, p);
2.575 + if term2str f = "[x = 1]" andalso p = ([], Res) then () else
2.576 + raise error "FE-interface.sml: diff.behav. in mini-subpbl CompleteToSubpbl 1";
2.577 +
2.578 +
2.579 +
2.580 +"---------------- rat-eq + subpbl: no_met, NO solution dropped ---";
2.581 +"---------------- rat-eq + subpbl: no_met, NO solution dropped ---";
2.582 +"---------------- rat-eq + subpbl: no_met, NO solution dropped ---";
2.583 + states:=[];
2.584 + CalcTree
2.585 + [(["equality ((5*x)/(x - 2) - x/(x+2)=4)", "solveFor x","solutions L"],
2.586 + ("RatEq.thy", ["univariate","equation"], ["no_met"]))];
2.587 + Iterator 1;
2.588 + moveActiveRoot 1;
2.589 + fetchProposedTactic 1;
2.590 + setNextTactic 1 (Model_Problem );
2.591 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.592 +(*-----since Model_Problem + complete_mod_ in case cas of SOME-----*
2.593 + setNextTactic 1 (Add_Given "equality (5 * x / (x - 2) - x / (x + 2) = 4)");
2.594 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.595 + setNextTactic 1 (Add_Given "solveFor x");
2.596 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.597 + setNextTactic 1 (Add_Find "solutions L");
2.598 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.599 +*-----since Model_Problem + complete_mod_ in case cas of SOME-----*)
2.600 + setNextTactic 1 (Specify_Theory "RatEq.thy");
2.601 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.602 + setNextTactic 1 (Specify_Problem ["rational","univariate","equation"]);
2.603 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.604 + setNextTactic 1 (Specify_Method ["RatEq","solve_rat_equation"]);
2.605 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.606 + setNextTactic 1 (Apply_Method ["RatEq","solve_rat_equation"]);
2.607 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.608 + setNextTactic 1 (Rewrite_Set "RatEq_simplify");
2.609 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.610 + setNextTactic 1 (Rewrite_Set "norm_Rational");
2.611 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.612 + setNextTactic 1 (Rewrite_Set "RatEq_eliminate");
2.613 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.614 + (* __________ for "12 * x + 4 * x ^^^ 2 = 4 * (-4 + x ^^^ 2)"*)
2.615 + setNextTactic 1 (Subproblem ("PolyEq.thy", ["normalize","polynomial",
2.616 + "univariate","equation"]));
2.617 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.618 + setNextTactic 1 (Model_Problem );
2.619 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.620 +(*-----since Model_Problem + complete_mod_ in case cas of SOME-----*
2.621 + setNextTactic 1 (Add_Given
2.622 + "equality (12 * x + 4 * x ^^^ 2 = 4 * (-4 + x ^^^ 2))");
2.623 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.624 + setNextTactic 1 (Add_Given "solveFor x");
2.625 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.626 + setNextTactic 1 (Add_Find "solutions x_i");
2.627 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.628 +*-----since Model_Problem + complete_mod_ in case cas of SOME-----*)
2.629 + setNextTactic 1 (Specify_Theory "PolyEq.thy");
2.630 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.631 + setNextTactic 1 (Specify_Problem ["normalize","polynomial",
2.632 + "univariate","equation"]);
2.633 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.634 + setNextTactic 1 (Specify_Method ["PolyEq","normalize_poly"]);
2.635 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.636 + setNextTactic 1 (Apply_Method ["PolyEq","normalize_poly"]);
2.637 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.638 + setNextTactic 1 (Rewrite ("all_left",""));
2.639 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.640 + setNextTactic 1 (Rewrite_Set_Inst (["(bdv,x)"], "make_ratpoly_in"));
2.641 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.642 + (* __________ for "16 + 12 * x = 0"*)
2.643 + setNextTactic 1 (Subproblem ("PolyEq.thy",
2.644 + ["degree_1","polynomial","univariate","equation"]));
2.645 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.646 + setNextTactic 1 (Model_Problem );
2.647 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.648 +(*-----since Model_Problem + complete_mod_ in case cas of SOME-----*
2.649 + setNextTactic 1 (Add_Given
2.650 + "equality (16 + 12 * x = 0)");
2.651 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.652 + setNextTactic 1 (Add_Given "solveFor x");
2.653 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.654 + setNextTactic 1 (Add_Find "solutions x_i");
2.655 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.656 +*-----since Model_Problem + complete_mod_ in case cas of SOME-----*)
2.657 + setNextTactic 1 (Specify_Theory "PolyEq.thy");
2.658 + (*------------- some trials in the problem-hierarchy ---------------*)
2.659 + setNextTactic 1 (Specify_Problem ["linear","univariate","equation"]);
2.660 + autoCalculate 1 (Step 1); fetchProposedTactic 1; (*<ERROR> helpless </ERROR> !!!*)
2.661 + setNextTactic 1 (Refine_Problem ["univariate","equation"]);
2.662 +
2.663 +
2.664 +
2.665 +
2.666 +
2.667 + (*------------------------------------------------------------------*)
2.668 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.669 + setNextTactic 1 (Specify_Method ["PolyEq","solve_d1_polyeq_equation"]);
2.670 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.671 + setNextTactic 1 (Apply_Method ["PolyEq","solve_d1_polyeq_equation"]);
2.672 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.673 + setNextTactic 1 (Rewrite_Set_Inst (["(bdv,x)"], "d1_polyeq_simplify"));
2.674 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.675 + setNextTactic 1 (Rewrite_Set "polyeq_simplify");
2.676 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.677 + (*==================================================================*)
2.678 + setNextTactic 1 Or_to_List;
2.679 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.680 + setNextTactic 1 (Check_elementwise "Assumptions");
2.681 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.682 + setNextTactic 1 (Check_Postcond ["degree_1","polynomial",
2.683 + "univariate","equation"]);
2.684 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.685 + setNextTactic 1 (Check_Postcond ["normalize","polynomial",
2.686 + "univariate","equation"]);
2.687 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.688 + setNextTactic 1 (Check_elementwise "Assumptions");
2.689 + autoCalculate 1 (Step 1); fetchProposedTactic 1;
2.690 + setNextTactic 1 (Check_Postcond ["rational","univariate","equation"]);
2.691 + val (ptp,_) = get_calc 1;
2.692 + val (Form t,_,_) = pt_extract ptp;
2.693 + if get_pos 1 1 = ([], Res) andalso term2str t = "[x = -4 / 3]" then ()
2.694 + else writeln "FE-inteface.sml: diff.behav. in rat-eq + subpbl: no_met, NO ..";
2.695 +
2.696 +
2.697 +"---------------- tryMatchProblem, tryRefineProblem --------------";
2.698 +"---------------- tryMatchProblem, tryRefineProblem --------------";
2.699 +"---------------- tryMatchProblem, tryRefineProblem --------------";
2.700 +(*{\bf\UC{Having \isac{} Refine the Problem
2.701 + * Automatically}\label{SPECIFY:refine-auto}\\} test match and refine with
2.702 + * x^^^2 + 4*x + 5 = 2
2.703 +see isac.bridge.TestSpecify#testMatchRefine*)
2.704 + DEconstrCalcTree 1;
2.705 + CalcTree
2.706 + [(["equality (x^2 + 4*x + 5 = 2)", "solveFor x","solutions L"],
2.707 + ("Isac.thy",
2.708 + ["univariate","equation"],
2.709 + ["no_met"]))];
2.710 + Iterator 1;
2.711 + moveActiveRoot 1;
2.712 +
2.713 + fetchProposedTactic 1;
2.714 + setNextTactic 1 (Model_Problem );
2.715 + (*..this tactic should be done 'tacitly', too !*)
2.716 +
2.717 +(*
2.718 +autoCalculate 1 CompleteCalcHead;
2.719 +checkContext 1 ([],Pbl) "pbl_equ_univ";
2.720 +checkContext 1 ([],Pbl) (kestoreID2guh Pbl_ ["univariate","equation"]);
2.721 +*)
2.722 +
2.723 + autoCalculate 1 (Step 1);
2.724 +
2.725 + fetchProposedTactic 1;
2.726 + setNextTactic 1 (Add_Given "equality (x ^^^ 2 + 4 * x + 5 = 2)");
2.727 + autoCalculate 1 (Step 1);
2.728 +
2.729 + "--------- we go into the ProblemBrowser (_NO_ pblID selected) -";
2.730 +initContext 1 Pbl_ ([],Pbl);
2.731 +initContext 1 Met_ ([],Pbl);
2.732 +
2.733 + "--------- this match will show some incomplete items: ---------";
2.734 +checkContext 1 ([],Pbl) (kestoreID2guh Pbl_ ["univariate","equation"]);
2.735 +checkContext 1 ([],Pbl) (kestoreID2guh Met_ ["LinEq", "solve_lineq_equation"]);
2.736 +
2.737 +
2.738 + fetchProposedTactic 1;
2.739 + setNextTactic 1 (Add_Given "solveFor x"); autoCalculate 1 (Step 1);
2.740 +
2.741 + fetchProposedTactic 1;
2.742 + setNextTactic 1 (Add_Find "solutions L"); autoCalculate 1 (Step 1);
2.743 +
2.744 + "--------- this is a matching model (all items correct): -------";
2.745 +checkContext 1 ([],Pbl) (kestoreID2guh Pbl_ ["univariate","equation"]);
2.746 + "--------- this is a NOT matching model (some 'false': ---------";
2.747 +checkContext 1 ([],Pbl)(kestoreID2guh Pbl_["linear","univariate","equation"]);
2.748 +
2.749 + "--------- find out a matching problem: ------------------------";
2.750 + "--------- find out a matching problem (FAILING: no new pbl) ---";
2.751 + refineProblem 1([],Pbl)(pblID2guh ["linear","univariate","equation"]);
2.752 +
2.753 + "--------- find out a matching problem (SUCCESSFUL) ------------";
2.754 + refineProblem 1 ([],Pbl) (pblID2guh ["univariate","equation"]);
2.755 +
2.756 + "--------- tryMatch, tryRefine did not change the calculation -";
2.757 + "--------- this is done by <TRANSFER> on the pbl-browser: ------";
2.758 + setNextTactic 1 (Specify_Problem ["normalize","polynomial",
2.759 + "univariate","equation"]);
2.760 + autoCalculate 1 (Step 1);
2.761 +(*WN050904 fetchProposedTactic again --> Specify_Problem ["normalize",...
2.762 + and Specify_Theory skipped in comparison to below ---^^^-inserted *)
2.763 +(*------------vvv-inserted-----------------------------------------------*)
2.764 + fetchProposedTactic 1;
2.765 + setNextTactic 1 (Specify_Problem ["normalize","polynomial",
2.766 + "univariate","equation"]);
2.767 + autoCalculate 1 (Step 1);
2.768 +
2.769 +(*and Specify_Theory skipped by fetchProposedTactic ?!?*)
2.770 +
2.771 + fetchProposedTactic 1;
2.772 + setNextTactic 1 (Specify_Method ["PolyEq","normalize_poly"]);
2.773 + autoCalculate 1 (Step 1);
2.774 +
2.775 + fetchProposedTactic 1;
2.776 + setNextTactic 1 (Apply_Method ["PolyEq","normalize_poly"]);
2.777 + autoCalculate 1 CompleteCalc;
2.778 + val ((pt,_),_) = get_calc 1;
2.779 + show_pt pt;
2.780 + val p = get_pos 1 1;
2.781 + val (Form f, tac, asms) = pt_extract (pt, p);
2.782 + if term2str f = "[x = -1, x = -3]" andalso p = ([], Res) then () else
2.783 + raise error "FE-interface.sml: diff.behav. in tryMatchProblem, tryRefine";
2.784 +
2.785 +(*------------^^^-inserted-----------------------------------------------*)
2.786 +(*WN050904 the fetchProposedTactic's below may not have worked like that
2.787 + before, too, because there was no check*)
2.788 + fetchProposedTactic 1;
2.789 + setNextTactic 1 (Specify_Theory "PolyEq.thy");
2.790 + autoCalculate 1 (Step 1);
2.791 +
2.792 + fetchProposedTactic 1;
2.793 + setNextTactic 1 (Specify_Method ["PolyEq","normalize_poly"]);
2.794 + autoCalculate 1 (Step 1);
2.795 +
2.796 + fetchProposedTactic 1;
2.797 + "--------- now the calc-header is ready for enter 'solving' ----";
2.798 + autoCalculate 1 CompleteCalc;
2.799 +
2.800 + val ((pt,_),_) = get_calc 1;
2.801 +rootthy pt;
2.802 + show_pt pt;
2.803 + val p = get_pos 1 1;
2.804 + val (Form f, tac, asms) = pt_extract (pt, p);
2.805 + if term2str f = "[x = -1, x = -3]" andalso p = ([], Res) then () else
2.806 + raise error "FE-interface.sml: diff.behav. in tryMatchProblem, tryRefine";
2.807 +
2.808 +
2.809 +"--------- modifyCalcHead, resetCalcHead, modelProblem ------------";
2.810 +"--------- modifyCalcHead, resetCalcHead, modelProblem ------------";
2.811 +"--------- modifyCalcHead, resetCalcHead, modelProblem ------------";
2.812 +
2.813 + states:=[];
2.814 + DEconstrCalcTree 1;
2.815 + CalcTree
2.816 + [(["equality (x+1=2)", "solveFor x","solutions L"],
2.817 + ("Test.thy",
2.818 + ["sqroot-test","univariate","equation","test"],
2.819 + ["Test","squ-equ-test-subpbl1"]))];
2.820 + Iterator 1;
2.821 + moveActiveRoot 1;
2.822 +
2.823 + modifyCalcHead 1 (([],Pbl),(*the position from refFormula*)
2.824 + "solve (x+1=2, x)",(*the headline*)
2.825 + [Given ["equality (x+1=2)", "solveFor x"],
2.826 + Find ["solutions L"](*,Relate []*)],
2.827 + Pbl,
2.828 + ("Test.thy",
2.829 + ["sqroot-test","univariate","equation","test"],
2.830 + ["Test","squ-equ-test-subpbl1"]));
2.831 +resetCalcHead 1;
2.832 +modelProblem 1;
2.833 +
2.834 +
2.835 +"---------------- maximum-example, UC: Modeling an example -------";
2.836 +"---------------- maximum-example, UC: Modeling an example -------";
2.837 +"---------------- maximum-example, UC: Modeling an example -------";
2.838 +(* {\bf\UC{Editing the Model}\label{SPECIFY:enter}\label{SPECIFY:check}\\}
2.839 +see isac.bridge.TestModel#testEditItems
2.840 +*)
2.841 + val elems = ["fixedValues [r=Arbfix]","maximum A","valuesFor [a,b]",
2.842 + "relations [A=a*b, (a/2)^2 + (b/2)^2 = r^2]",
2.843 + "relations [A=a*b, (a/2)^2 + (b/2)^2 = r^2]",
2.844 + "relations [A=a*b, a/2=r*sin alpha, b/2=r*cos alpha]",
2.845 + (*^^^ these are the elements for the root-problem (in variants)*)
2.846 + (*vvv these are elements required for subproblems*)
2.847 + "boundVariable a","boundVariable b","boundVariable alpha",
2.848 + "interval {x::real. 0 <= x & x <= 2*r}",
2.849 + "interval {x::real. 0 <= x & x <= 2*r}",
2.850 + "interval {x::real. 0 <= x & x <= pi}",
2.851 + "errorBound (eps=(0::real))"]
2.852 + (*specifying is not interesting for this example*)
2.853 + val spec = ("DiffApp.thy", ["maximum_of","function"],
2.854 + ["DiffApp","max_by_calculus"]);
2.855 + (*the empty model with descriptions for user-guidance by Model_Problem*)
2.856 + val empty_model = [Given ["fixedValues []"],
2.857 + Find ["maximum", "valuesFor"],
2.858 + Relate ["relations []"]];
2.859 + states:=[];
2.860 + DEconstrCalcTree 1;
2.861 + CalcTree [(elems, spec)];
2.862 + Iterator 1;
2.863 + moveActiveRoot 1;
2.864 + refFormula 1 (get_pos 1 1);
2.865 + (*this gives a completely empty model*)
2.866 +
2.867 + fetchProposedTactic 1;
2.868 +(*fill the CalcHead with Descriptions...*)
2.869 + setNextTactic 1 (Model_Problem );
2.870 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.871 +
2.872 + (*user input is !!!!!EITHER!!!!! _some_ (at least one) items of the model
2.873 + !!!!!OR!!!!! _one_ part of the specification !!!!!!!!!!!!!*)
2.874 + (*input of two items, 'fixedValues [r=Arbfix]' and 'maximum b'...*)
2.875 + modifyCalcHead 1 (([],Pbl) (*position, from previous refFormula*),
2.876 + "Problem (DiffApp.thy, [maximum_of, function])",
2.877 + (*the head-form ^^^ is not used for input here*)
2.878 + [Given ["fixedValues [r=Arbfix]"(*new input*)],
2.879 + Find ["maximum b"(*new input*), "valuesFor"],
2.880 + Relate ["relations"]],
2.881 + (*input (Arbfix will dissappear soon)*)
2.882 + Pbl (*belongsto*),
2.883 + e_spec (*no input to the specification*));
2.884 +
2.885 + (*the user does not know, what 'superfluous' for 'maximum b' may mean
2.886 + and asks what to do next*)
2.887 + fetchProposedTactic 1;
2.888 + (*the student follows the advice*)
2.889 + setNextTactic 1 (Add_Find "maximum A"); (*FIXME.17.11.03: does not yet work*)
2.890 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
2.891 +
2.892 + (*this input completes the model*)
2.893 + modifyCalcHead 1 (([],Pbl), "not used here",
2.894 + [Given ["fixedValues [r=Arbfix]"],
2.895 + Find ["maximum A", "valuesFor [a,b]"(*new input*)],
2.896 + Relate ["relations [A=a*b, \
2.897 + \(a/2)^2 + (b/2)^2 = r^2]"]], Pbl, e_spec);
2.898 +
2.899 + (*specification is not interesting an should be skipped by the dialogguide;
2.900 + !!!!!!!!!!!!!!!!!!!! input of ONE part at a time !!!!!!!!!!!!!!!!!!!!!!*)
2.901 + modifyCalcHead 1 (([],Pbl), "not used here",
2.902 + [Given ["fixedValues [r=Arbfix]"],
2.903 + Find ["maximum A", "valuesFor [a,b]"(*new input*)],
2.904 + Relate ["relations [A=a*b, \
2.905 + \(a/2)^2 + (b/2)^2 = r^2]"]], Pbl,
2.906 + ("DiffApp.thy", ["e_pblID"], ["e_metID"]));
2.907 + modifyCalcHead 1 (([],Pbl), "not used here",
2.908 + [Given ["fixedValues [r=Arbfix]"],
2.909 + Find ["maximum A", "valuesFor [a,b]"(*new input*)],
2.910 + Relate ["relations [A=a*b, \
2.911 + \(a/2)^2 + (b/2)^2 = r^2]"]], Pbl,
2.912 + ("DiffApp.thy", ["maximum_of","function"],
2.913 + ["e_metID"]));
2.914 + modifyCalcHead 1 (([],Pbl), "not used here",
2.915 + [Given ["fixedValues [r=Arbfix]"],
2.916 + Find ["maximum A", "valuesFor [a,b]"(*new input*)],
2.917 + Relate ["relations [A=a*b, \
2.918 + \(a/2)^2 + (b/2)^2 = r^2]"]], Pbl,
2.919 + ("DiffApp.thy", ["maximum_of","function"],
2.920 + ["DiffApp","max_by_calculus"]));
2.921 + (*this final calcHead now has STATUS 'complete' !*)
2.922 + DEconstrCalcTree 1;
2.923 +
2.924 +
2.925 +"--------- solve_linear from pbl-hierarchy -----------------------";
2.926 +"--------- solve_linear from pbl-hierarchy -----------------------";
2.927 +"--------- solve_linear from pbl-hierarchy -----------------------";
2.928 + states:=[];
2.929 + val (fmz, sp) = ([], ("", ["linear","univariate","equation","test"], []));
2.930 + CalcTree [(fmz, sp)];
2.931 + Iterator 1; moveActiveRoot 1;
2.932 + refFormula 1 (get_pos 1 1);
2.933 + modifyCalcHead 1 (([],Pbl),"solve (1+-1*2+x=0)",
2.934 + [Given ["equality (1+-1*2+x=0)", "solveFor x"],
2.935 + Find ["solutions L"]],
2.936 + Pbl,
2.937 + ("Test.thy", ["linear","univariate","equation","test"],
2.938 + ["Test","solve_linear"]));
2.939 + autoCalculate 1 CompleteCalc;
2.940 + refFormula 1 (get_pos 1 1);
2.941 + val ((pt,_),_) = get_calc 1;
2.942 + val p = get_pos 1 1;
2.943 + val (Form f, tac, asms) = pt_extract (pt, p);
2.944 + if term2str f = "[x = 1]" andalso p = ([], Res) then () else
2.945 + raise error "FE-interface.sml: diff.behav. in from pbl-hierarchy";
2.946 +
2.947 +
2.948 +
2.949 +"--------- solve_linear as in an algebra system (CAS)-------------";
2.950 +"--------- solve_linear as in an algebra system (CAS)-------------";
2.951 +"--------- solve_linear as in an algebra system (CAS)-------------";
2.952 + states:=[];
2.953 + val (fmz, sp) = ([], ("", [], []));
2.954 + CalcTree [(fmz, sp)];
2.955 + Iterator 1; moveActiveRoot 1;
2.956 + modifyCalcHead 1 (([],Pbl),"solveTest (1+-1*2+x=0,x)", [], Pbl, ("", [], []));
2.957 + autoCalculate 1 CompleteCalc;
2.958 + refFormula 1 (get_pos 1 1);
2.959 + val ((pt,_),_) = get_calc 1;
2.960 + val p = get_pos 1 1;
2.961 + val (Form f, tac, asms) = pt_extract (pt, p);
2.962 + if term2str f = "[x = 1]" andalso p = ([], Res) then () else
2.963 + raise error "FE-interface.sml: diff.behav. in algebra system";
2.964 +
2.965 +
2.966 +
2.967 +"--------- interSteps: on 'miniscript with mini-subpbl' ----------";
2.968 +"--------- interSteps: on 'miniscript with mini-subpbl' ----------";
2.969 +"--------- interSteps: on 'miniscript with mini-subpbl' ----------";
2.970 + states:=[];
2.971 + CalcTree
2.972 + [(["equality (x+1=2)", "solveFor x","solutions L"],
2.973 + ("Test.thy",
2.974 + ["sqroot-test","univariate","equation","test"],
2.975 + ["Test","squ-equ-test-subpbl1"]))];
2.976 + Iterator 1;
2.977 + moveActiveRoot 1;
2.978 + autoCalculate 1 CompleteCalc;
2.979 + val ((pt,_),_) = get_calc 1;
2.980 + show_pt pt;
2.981 +
2.982 + (*UC\label{SOLVE:INFO:intermediate-steps}*)
2.983 + interSteps 1 ([2],Res);
2.984 + val ((pt,_),_) = get_calc 1; show_pt pt (*new ([2,1],Frm)..([2,6],Res)*);
2.985 + val (unc, del, gen) = (([1],Res),([1],Res),([2,6],Res));
2.986 + getFormulaeFromTo 1 unc gen 1 false;
2.987 +
2.988 + (*UC\label{SOLVE:INFO:intermediate-steps}*)
2.989 + interSteps 1 ([3,2],Res);
2.990 + val ((pt,_),_) = get_calc 1; show_pt pt (*new ([3,2,1],Frm)..([3,2,2],Res)*);
2.991 + val (unc, del, gen) = (([3,1],Res),([3,1],Res),([3,2,2],Res));
2.992 + getFormulaeFromTo 1 unc gen 1 false;
2.993 +
2.994 + (*UC\label{SOLVE:INFO:intermediate-steps}*)
2.995 + interSteps 1 ([3],Res) (*no new steps in subproblems*);
2.996 + val (unc, del, gen) = (([3],Pbl),([3],Pbl),([3,2],Res));
2.997 + getFormulaeFromTo 1 unc gen 1 false;
2.998 +
2.999 + (*UC\label{SOLVE:INFO:intermediate-steps}*)
2.1000 + interSteps 1 ([],Res) (*no new steps in subproblems*);
2.1001 + val (unc, del, gen) = (([],Pbl),([],Pbl),([4],Res));
2.1002 + getFormulaeFromTo 1 unc gen 1 false;
2.1003 +
2.1004 +
2.1005 +"--------- getTactic, fetchApplicableTactics ---------------------";
2.1006 +"--------- getTactic, fetchApplicableTactics ---------------------";
2.1007 +"--------- getTactic, fetchApplicableTactics ---------------------";
2.1008 + states:=[];
2.1009 + CalcTree
2.1010 + [(["equality (x+1=2)", "solveFor x","solutions L"],
2.1011 + ("Test.thy",
2.1012 + ["sqroot-test","univariate","equation","test"],
2.1013 + ["Test","squ-equ-test-subpbl1"]))];
2.1014 + Iterator 1; moveActiveRoot 1;
2.1015 + autoCalculate 1 CompleteCalc;
2.1016 + val ((pt,_),_) = get_calc 1;
2.1017 + show_pt pt;
2.1018 +
2.1019 + (*UC\label{SOLVE:HIDE:getTactic}*)
2.1020 + getTactic 1 ([],Pbl);
2.1021 + getTactic 1 ([1],Res);
2.1022 + getTactic 1 ([3],Pbl);
2.1023 + getTactic 1 ([3,1],Frm);
2.1024 + getTactic 1 ([3],Res);
2.1025 + getTactic 1 ([],Res);
2.1026 +
2.1027 +(*UC\label{SOLVE:MANUAL:TACTIC:listall}*)
2.1028 + fetchApplicableTactics 1 99999 ([],Pbl);
2.1029 + fetchApplicableTactics 1 99999 ([1],Res);
2.1030 + fetchApplicableTactics 1 99999 ([3],Pbl);
2.1031 + fetchApplicableTactics 1 99999 ([3,1],Res);
2.1032 + fetchApplicableTactics 1 99999 ([3],Res);
2.1033 + fetchApplicableTactics 1 99999 ([],Res);
2.1034 +
2.1035 +
2.1036 +"--------- getAssumptions, getAccumulatedAsms --------------------";
2.1037 +"--------- getAssumptions, getAccumulatedAsms --------------------";
2.1038 +"--------- getAssumptions, getAccumulatedAsms --------------------";
2.1039 +states:=[];
2.1040 +CalcTree
2.1041 +[(["equality (x/(x^2 - 6*x+9) - 1/(x^2 - 3*x) =1/x)",
2.1042 + "solveFor x","solutions L"],
2.1043 + ("RatEq.thy",["univariate","equation"],["no_met"]))];
2.1044 +Iterator 1; moveActiveRoot 1;
2.1045 +autoCalculate 1 CompleteCalc;
2.1046 +val ((pt,_),_) = get_calc 1;
2.1047 +show_pt pt;
2.1048 +
2.1049 +(*UC\label{SOLVE:HELP:assumptions}*)
2.1050 +getAssumptions 1 ([3], Res);
2.1051 +getAssumptions 1 ([5], Res);
2.1052 +(*UC\label{SOLVE:HELP:assumptions-origin} WN0502 still without positions*)
2.1053 +getAccumulatedAsms 1 ([3], Res);
2.1054 +getAccumulatedAsms 1 ([5], Res);
2.1055 +
2.1056 +
2.1057 +"--------- arbitrary combinations of steps -----------------------";
2.1058 +"--------- arbitrary combinations of steps -----------------------";
2.1059 +"--------- arbitrary combinations of steps -----------------------";
2.1060 + states:=[];
2.1061 + CalcTree (*start of calculation, return No.1*)
2.1062 + [(["equality (1+-1*2+x=0)", "solveFor x","solutions L"],
2.1063 + ("Test.thy",
2.1064 + ["linear","univariate","equation","test"],
2.1065 + ["Test","solve_linear"]))];
2.1066 + Iterator 1; moveActiveRoot 1;
2.1067 +
2.1068 + fetchProposedTactic 1;
2.1069 + setNextTactic 1 (Model_Problem );
2.1070 + autoCalculate 1 (Step 1);
2.1071 +
2.1072 + fetchProposedTactic 1;
2.1073 + fetchProposedTactic 1;
2.1074 +
2.1075 + setNextTactic 1 (Add_Find "solutions L");
2.1076 + setNextTactic 1 (Add_Find "solutions L");
2.1077 +
2.1078 + autoCalculate 1 (Step 1);
2.1079 + autoCalculate 1 (Step 1);
2.1080 +
2.1081 + setNextTactic 1 (Specify_Theory "Test.thy");
2.1082 + fetchProposedTactic 1;
2.1083 + autoCalculate 1 (Step 1);
2.1084 +
2.1085 + autoCalculate 1 (Step 1);
2.1086 + autoCalculate 1 (Step 1);
2.1087 + autoCalculate 1 (Step 1);
2.1088 + autoCalculate 1 (Step 1);
2.1089 +(*------------------------- end calc-head*)
2.1090 +
2.1091 + fetchProposedTactic 1;
2.1092 + setNextTactic 1 (Rewrite_Set_Inst (["(bdv,x)"], "isolate_bdv"));
2.1093 + autoCalculate 1 (Step 1);
2.1094 +
2.1095 + setNextTactic 1 (Rewrite_Set "Test_simplify");
2.1096 + fetchProposedTactic 1;
2.1097 + autoCalculate 1 (Step 1);
2.1098 +
2.1099 + autoCalculate 1 CompleteCalc;
2.1100 + val ((pt,_),_) = get_calc 1;
2.1101 + val p = get_pos 1 1;
2.1102 + val (Form f, tac, asms) = pt_extract (pt, p);
2.1103 + if term2str f = "[x = 1]" andalso p = ([], Res) then () else
2.1104 + raise error "FE-interface.sml: diff.behav. in combinations of steps";
2.1105 +
2.1106 +
2.1107 +"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} right--";
2.1108 +"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} right--";
2.1109 +"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} right--";
2.1110 + states:=[];
2.1111 + CalcTree
2.1112 + [(["equality (x+1=2)", "solveFor x","solutions L"],
2.1113 + ("Test.thy",
2.1114 + ["sqroot-test","univariate","equation","test"],
2.1115 + ["Test","squ-equ-test-subpbl1"]))];
2.1116 + Iterator 1;
2.1117 + moveActiveRoot 1;
2.1118 + autoCalculate 1 CompleteCalcHead;
2.1119 + autoCalculate 1 (Step 1);
2.1120 + autoCalculate 1 (Step 1);
2.1121 + appendFormula 1 "-1 + x = 0";
2.1122 + (*... returns calcChangedEvent with*)
2.1123 + val (unc, del, gen) = (([1],Res), ([1],Res), ([2],Res));
2.1124 + getFormulaeFromTo 1 unc gen 99999 (*all levels*) false;
2.1125 +
2.1126 + val ((pt,_),_) = get_calc 1;
2.1127 + val p = get_pos 1 1;
2.1128 + val (Form f, tac, asms) = pt_extract (pt, p);
2.1129 + if term2str f = "-1 + x = 0" andalso p = ([2], Res) then () else
2.1130 + raise error "FE-interface.sml: diff.behav. in FORMULA:enter} right";
2.1131 +
2.1132 +"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} other--";
2.1133 +"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} other--";
2.1134 +"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} other--";
2.1135 + states:=[];
2.1136 + CalcTree
2.1137 + [(["equality (x+1=2)", "solveFor x","solutions L"],
2.1138 + ("Test.thy",
2.1139 + ["sqroot-test","univariate","equation","test"],
2.1140 + ["Test","squ-equ-test-subpbl1"]))];
2.1141 + Iterator 1;
2.1142 + moveActiveRoot 1;
2.1143 + autoCalculate 1 CompleteCalcHead;
2.1144 + autoCalculate 1 (Step 1);
2.1145 + autoCalculate 1 (Step 1);
2.1146 + appendFormula 1 "x - 1 = 0";
2.1147 + val (unc, del, gen) = (([1],Res), ([1],Res), ([2],Res));
2.1148 + getFormulaeFromTo 1 unc gen 99999 (*all levels*) false;
2.1149 + (*11 elements !!!*)
2.1150 +
2.1151 + val ((pt,_),_) = get_calc 1;
2.1152 + val p = get_pos 1 1;
2.1153 + val (Form f, tac, asms) = pt_extract (pt, p);
2.1154 + if term2str f = "x - 1 = 0" andalso p = ([2], Res) then () else
2.1155 + raise error "FE-interface.sml: diff.behav. in FORMULA:enter} other";
2.1156 +
2.1157 +"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} oth 2--";
2.1158 +"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} oth 2--";
2.1159 +"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} oth 2--";
2.1160 + states:=[];
2.1161 + CalcTree
2.1162 + [(["equality (x+1=2)", "solveFor x","solutions L"],
2.1163 + ("Test.thy",
2.1164 + ["sqroot-test","univariate","equation","test"],
2.1165 + ["Test","squ-equ-test-subpbl1"]))];
2.1166 + Iterator 1;
2.1167 + moveActiveRoot 1;
2.1168 + autoCalculate 1 CompleteCalcHead;
2.1169 + autoCalculate 1 (Step 1);
2.1170 + autoCalculate 1 (Step 1);
2.1171 + appendFormula 1 "x = 1";
2.1172 + (*... returns calcChangedEvent with*)
2.1173 + val (unc, del, gen) = (([1],Res), ([1],Res), ([3,2],Res));
2.1174 + getFormulaeFromTo 1 unc gen 99999 (*all levels*) false;
2.1175 + (*6 elements !!!*)
2.1176 +
2.1177 + val ((pt,_),_) = get_calc 1;
2.1178 + val p = get_pos 1 1;
2.1179 + val (Form f, tac, asms) = pt_extract (pt, p);
2.1180 + if term2str f = "x = 1" andalso p = ([3,2], Res) then () else
2.1181 + raise error "FE-interface.sml: diff.behav. in FORMULA:enter} oth 2";
2.1182 +
2.1183 +
2.1184 +"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} NOTok--";
2.1185 +"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} NOTok--";
2.1186 +"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} NOTok--";
2.1187 + states:=[];
2.1188 + CalcTree
2.1189 + [(["equality (x+1=2)", "solveFor x","solutions L"],
2.1190 + ("Test.thy",
2.1191 + ["sqroot-test","univariate","equation","test"],
2.1192 + ["Test","squ-equ-test-subpbl1"]))];
2.1193 + Iterator 1;
2.1194 + moveActiveRoot 1;
2.1195 + autoCalculate 1 CompleteCalcHead;
2.1196 + autoCalculate 1 (Step 1);
2.1197 + autoCalculate 1 (Step 1);
2.1198 + appendFormula 1 "x - 4711 = 0";
2.1199 + (*... returns <ERROR> no derivation found </ERROR>*)
2.1200 +
2.1201 + val ((pt,_),_) = get_calc 1;
2.1202 + val p = get_pos 1 1;
2.1203 + val (Form f, tac, asms) = pt_extract (pt, p);
2.1204 + if term2str f = "x + 1 + -1 * 2 = 0" andalso p = ([1], Res) then () else
2.1205 + raise error "FE-interface.sml: diff.behav. in FORMULA:enter} NOTok";
2.1206 +
2.1207 +
2.1208 +"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} right----";
2.1209 +"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} right----";
2.1210 +"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} right----";
2.1211 + states:=[];
2.1212 + CalcTree
2.1213 + [(["equality (x+1=2)", "solveFor x","solutions L"],
2.1214 + ("Test.thy",
2.1215 + ["sqroot-test","univariate","equation","test"],
2.1216 + ["Test","squ-equ-test-subpbl1"]))];
2.1217 + Iterator 1;
2.1218 + moveActiveRoot 1;
2.1219 + autoCalculate 1 CompleteCalc;
2.1220 + moveActiveFormula 1 ([2],Res);
2.1221 + replaceFormula 1 "-1 + x = 0" (*i.e. repeats input*);
2.1222 + (*... returns <ERROR> formula not changed </ERROR>*)
2.1223 +
2.1224 + val ((pt,_),_) = get_calc 1;
2.1225 + val p = get_pos 1 1;
2.1226 + val (Form f, tac, asms) = pt_extract (pt, p);
2.1227 + if term2str f = "-1 + x = 0" andalso p = ([2], Res) then () else
2.1228 + raise error "FE-interface.sml: diff.behav. in FORMULA:replace} right 1";
2.1229 + if map fst (get_interval ([2],Res) ([],Res) 9999 pt) =
2.1230 + [([2], Res), ([3], Pbl), ([3, 1], Frm), ([3, 1], Res), ([3, 2], Res),
2.1231 + ([3], Res), ([4], Res), ([], Res)] then () (*nothing deleted!*) else
2.1232 + raise error "FE-interface.sml: diff.behav. in FORMULA:replace} right 2";
2.1233 +
2.1234 +(*WN050211 replaceFormula didn't work on second ctree: thus now tested...*)
2.1235 + CalcTree
2.1236 + [(["equality (x+1=2)", "solveFor x","solutions L"],
2.1237 + ("Test.thy",
2.1238 + ["sqroot-test","univariate","equation","test"],
2.1239 + ["Test","squ-equ-test-subpbl1"]))];
2.1240 + Iterator 2;
2.1241 + moveActiveRoot 2;
2.1242 + autoCalculate 2 CompleteCalc;
2.1243 + moveActiveFormula 2 ([2],Res);
2.1244 + replaceFormula 2 "-1 + x = 0" (*i.e. repeats input*);
2.1245 + (*... returns <ERROR> formula not changed </ERROR>*)
2.1246 +
2.1247 + val ((pt,_),_) = get_calc 2;
2.1248 + val p = get_pos 2 1;
2.1249 + val (Form f, tac, asms) = pt_extract (pt, p);
2.1250 + if term2str f = "-1 + x = 0" andalso p = ([2], Res) then () else
2.1251 + raise error "FE-interface.sml: diff.behav. in FORMULA:replace} right 1";
2.1252 + if map fst (get_interval ([2],Res) ([],Res) 9999 pt) =
2.1253 + [([2], Res), ([3], Pbl), ([3, 1], Frm), ([3, 1], Res), ([3, 2], Res),
2.1254 + ([3], Res), ([4], Res), ([], Res)] then () (*nothing deleted!*) else
2.1255 + raise error "FE-interface.sml: diff.behav. in FORMULA:replace} right 2b";
2.1256 +
2.1257 +"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} other----";
2.1258 +"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} other----";
2.1259 +"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} other----";
2.1260 + states:=[];
2.1261 + CalcTree
2.1262 + [(["equality (x+1=2)", "solveFor x","solutions L"],
2.1263 + ("Test.thy",
2.1264 + ["sqroot-test","univariate","equation","test"],
2.1265 + ["Test","squ-equ-test-subpbl1"]))];
2.1266 + Iterator 1;
2.1267 + moveActiveRoot 1;
2.1268 + autoCalculate 1 CompleteCalc;
2.1269 + moveActiveFormula 1 ([2],Res); (*there is "-1 + x = 0"*)
2.1270 + replaceFormula 1 "x - 1 = 0"; (*<-------------------------------------*)
2.1271 + (*... returns calcChangedEvent with*)
2.1272 + val (unc, del, gen) = (([1],Res), ([4],Res), ([2],Res));
2.1273 + getFormulaeFromTo 1 unc gen 99999 (*all levels*) false;
2.1274 +
2.1275 + val ((pt,_),_) = get_calc 1;
2.1276 + show_pt pt;
2.1277 + val p = get_pos 1 1;
2.1278 + val (Form f, tac, asms) = pt_extract (pt, p);
2.1279 + if term2str f = "x - 1 = 0" andalso p = ([2], Res) then () else
2.1280 + raise error "FE-interface.sml: diff.behav. in FORMULA:replace} other 1";
2.1281 +(* for getting the list in whole length ...
2.1282 +print_depth 99;map fst (get_interval ([1],Res) ([],Res) 9999 pt);print_depth 3;
2.1283 + *)
2.1284 + if map fst (get_interval ([1],Res) ([],Res) 9999 pt) =
2.1285 + [([1], Res), ([2, 1], Frm), ([2, 1], Res), ([2, 2], Res), ([2, 3], Res),
2.1286 + ([2, 4], Res), ([2, 5], Res), ([2, 6], Res), ([2, 7], Res),
2.1287 + ([2, 8], Res), ([2, 9], Res), ([2], Res)
2.1288 +(*WN060727 {cutlevup->test_trans} removed: ,
2.1289 + ([], Res)(*dropped, if test_trans doesnt stop at PblNd*)*)] then () else
2.1290 + raise error "FE-interface.sml: diff.behav. in FORMULA:replace} other 2";
2.1291 +
2.1292 +
2.1293 +
2.1294 +"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} other 2--";
2.1295 +"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} other 2--";
2.1296 +"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} other 2--";
2.1297 + states:=[];
2.1298 + CalcTree
2.1299 + [(["equality (x+1=2)", "solveFor x","solutions L"],
2.1300 + ("Test.thy",
2.1301 + ["sqroot-test","univariate","equation","test"],
2.1302 + ["Test","squ-equ-test-subpbl1"]))];
2.1303 + Iterator 1;
2.1304 + moveActiveRoot 1;
2.1305 + autoCalculate 1 CompleteCalc;
2.1306 + moveActiveFormula 1 ([2],Res); (*there is "-1 + x = 0"*)
2.1307 + replaceFormula 1 "x = 1"; (*<-------------------------------------*)
2.1308 + (*... returns calcChangedEvent with ...*)
2.1309 + val (unc, del, gen) = (([1],Res), ([4],Res), ([3,2],Res));
2.1310 + getFormulaeFromTo 1 unc gen 99999 (*all levels*) false;
2.1311 + (*9 elements !!!*)
2.1312 +
2.1313 + val ((pt,_),_) = get_calc 1;
2.1314 + show_pt pt; (*error: ...get_interval drops ([3,2],Res) ...*)
2.1315 + val (t,_) = get_obj g_result pt [3,2]; term2str t;
2.1316 + if map fst (get_interval ([1],Res) ([],Res) 9999 pt) =
2.1317 + [([1], Res), ([2], Res), ([3], Pbl), ([3, 1], Frm), ([3, 1], Res),
2.1318 + ([3, 2, 1], Frm), ([3, 2, 1], Res), ([3, 2, 2], Res),
2.1319 + ([3,2],Res)] then () else
2.1320 + raise error "FE-interface.sml: diff.behav. in FORMULA:replace} oth2 1";
2.1321 +
2.1322 + val p = get_pos 1 1;
2.1323 + val (Form f, tac, asms) = pt_extract (pt, p);
2.1324 + if term2str f = "x = 1" andalso p = ([3,2], Res) then () else
2.1325 + raise error "FE-interface.sml: diff.behav. in FORMULA:replace} oth2 2";
2.1326 +
2.1327 +
2.1328 +
2.1329 +"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} NOTok----";
2.1330 +"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} NOTok----";
2.1331 +"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} NOTok----";
2.1332 + states:=[];
2.1333 + CalcTree
2.1334 + [(["equality (x+1=2)", "solveFor x","solutions L"],
2.1335 + ("Test.thy",
2.1336 + ["sqroot-test","univariate","equation","test"],
2.1337 + ["Test","squ-equ-test-subpbl1"]))];
2.1338 + Iterator 1;
2.1339 + moveActiveRoot 1;
2.1340 + autoCalculate 1 CompleteCalc;
2.1341 + moveActiveFormula 1 ([2],Res); (*there is "-1 + x = 0"*)
2.1342 + replaceFormula 1 "x - 4711 = 0";
2.1343 + (*... returns <ERROR> no derivation found </ERROR>*)
2.1344 +
2.1345 + val ((pt,_),_) = get_calc 1;
2.1346 + show_pt pt;
2.1347 + val p = get_pos 1 1;
2.1348 + val (Form f, tac, asms) = pt_extract (pt, p);
2.1349 + if term2str f = "-1 + x = 0" andalso p = ([2], Res) then () else
2.1350 + raise error "FE-interface.sml: diff.behav. in FORMULA:replace} NOTok";
2.1351 +
2.1352 +
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/test/Tools/isac/Interpret/calchead.sml Mon Aug 30 14:35:51 2010 +0200
3.3 @@ -0,0 +1,413 @@
3.4 +(* tests on calchead.sml
3.5 + author: Walther Neuper
3.6 + 051013,
3.7 + (c) due to copyright terms
3.8 +
3.9 +use"../smltest/ME/calchead.sml";
3.10 +use"calchead.sml";
3.11 +*)
3.12 +
3.13 +"-----------------------------------------------------------------";
3.14 +"table of contents -----------------------------------------------";
3.15 +"-----------------------------------------------------------------";
3.16 +"--------- get_interval after replace} other 2 -------------------";
3.17 +"--------- maximum example with 'specify' ------------------------";
3.18 +"--------- maximum example with 'specify', fmz <> [] -------------";
3.19 +"--------- maximum example with 'specify', fmz = [] --------------";
3.20 +"--------- match_ags, is_cp, cpy_nam +with EqSystem (!)-----------";
3.21 +"-----------------------------------------------------------------";
3.22 +"-----------------------------------------------------------------";
3.23 +"-----------------------------------------------------------------";
3.24 +
3.25 +
3.26 +"--------- get_interval after replace} other 2 -------------------";
3.27 +"--------- get_interval after replace} other 2 -------------------";
3.28 +"--------- get_interval after replace} other 2 -------------------";
3.29 + states:=[];
3.30 + CalcTree
3.31 + [(["equality (x+1=2)", "solveFor x","solutions L"],
3.32 + ("Test.thy",
3.33 + ["sqroot-test","univariate","equation","test"],
3.34 + ["Test","squ-equ-test-subpbl1"]))];
3.35 + Iterator 1;
3.36 + moveActiveRoot 1;
3.37 + autoCalculate 1 CompleteCalc;
3.38 + moveActiveFormula 1 ([2],Res); (*there is "-1 + x = 0"*)
3.39 + replaceFormula 1 "x = 1";
3.40 + (*... returns calcChangedEvent with ...*)
3.41 + val (unc, del, gen) = (([1],Res), ([4],Res), ([3,2],Res));
3.42 + val ((pt,_),_) = get_calc 1;
3.43 +
3.44 +print_depth 99;map fst (get_interval ([],Pbl) ([],Res) 9999 pt);print_depth 3;
3.45 +if map fst (get_interval ([],Pbl) ([],Res) 9999 pt) =
3.46 + [([], Pbl), ([1], Frm),([1], Res), ([2], Res), ([3], Pbl), ([3, 1], Frm),
3.47 + ([3, 1], Res), ([3, 2, 1], Frm), ([3, 2, 1], Res), ([3, 2, 2], Res),
3.48 + ([3, 2], Res)] then () else
3.49 +raise error "calchead.sml: diff.behav. get_interval after replace} other 2 a";
3.50 +
3.51 +print_depth 99;map fst (get_interval ([3, 2, 1], Res) ([],Res) 9999 pt);
3.52 +print_depth 3;
3.53 +if map fst (get_interval ([3, 2, 1], Res) ([],Res) 9999 pt) =
3.54 + [([3, 2, 1], Res), ([3, 2, 2], Res), ([3, 2], Res)] then () else
3.55 +raise error "modspec.sml: diff.behav. get_interval after replace} other 2 b";
3.56 +
3.57 +
3.58 +
3.59 +
3.60 +"--------- maximum example with 'specify' ------------------------";
3.61 +"--------- maximum example with 'specify' ------------------------";
3.62 +"--------- maximum example with 'specify' ------------------------";
3.63 +(*" Specify_Problem (match_itms_oris) ";*)
3.64 +val fmz =
3.65 + ["fixedValues [r=Arbfix]","maximum A",
3.66 + "valuesFor [a,b]",
3.67 + "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
3.68 + "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
3.69 + "relations [A=a*b, a/2=r*sin alpha, b/2=r*cos alpha]",
3.70 +
3.71 + "boundVariable a","boundVariable b","boundVariable alpha",
3.72 + "interval {x::real. 0 <= x & x <= 2*r}",
3.73 + "interval {x::real. 0 <= x & x <= 2*r}",
3.74 + "interval {x::real. 0 <= x & x <= pi}",
3.75 + "errorBound (eps=(0::real))"];
3.76 +val (dI',pI',mI') =
3.77 + ("DiffApp.thy",["maximum_of","function"],
3.78 + ["DiffApp","max_by_calculus"]);
3.79 +val c = []:cid;
3.80 +
3.81 +(*val nxt = Init_Proof' (fmz,(dI',pI',mI'));
3.82 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt e_pos' [] EmptyPtree;
3.83 +*)
3.84 +val (p,_,f,(_,nxt),_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
3.85 +val nxt = tac2tac_ pt p nxt;
3.86 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.87 +(*val nxt = Add_Given "fixedValues [(r::real) = Arbfix]" : tac*)
3.88 +
3.89 +val nxt = tac2tac_ pt p nxt;
3.90 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.91 +(**)
3.92 +
3.93 +(*---6.5.03
3.94 +val nxt = tac2tac_ pt p (Add_Find "valuesFor [(a::real)]");
3.95 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.96 +(*uncaught exception TYPE 6.5.03*)
3.97 +
3.98 +if ppc<>(Problem [],
3.99 + {Find=[Incompl "maximum",Incompl "valuesFor [a]"],
3.100 + Given=[Correct "fixedValues [r = Arbfix]"],
3.101 + Relate=[Incompl "relations []"], Where=[],With=[]})
3.102 +then raise error "test-maximum.sml: model stepwise - different behaviour"
3.103 +else (); (*different with show_types !!!*)
3.104 +6.5.03---*)
3.105 +
3.106 +(*-----appl_add should not create Error', but accept as Sup,Syn
3.107 +val nxt = tac2tac_ pt p (Add_Given "boundVariable a");
3.108 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.109 +(**)
3.110 +val nxt = tac2tac_ pt p (Add_Given "boundVariable a+");
3.111 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.112 +(**)---*)
3.113 +
3.114 +val m = Specify_Problem ["maximum_of","function"];
3.115 +val nxt = tac2tac_ pt p m;
3.116 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.117 +(**)
3.118 +
3.119 +if ppc<>(Problem ["maximum_of","function"],
3.120 + {Find=[Incompl "maximum",Incompl "valuesFor"],
3.121 + Given=[Correct "fixedValues [r = Arbfix]"],
3.122 + Relate=[Incompl "relations []"], Where=[],With=[]})
3.123 +then raise error "diffappl.sml: Specify_Problem different behaviour"
3.124 +else ();
3.125 +(* WN.3.9.03 (#391) Model_Specify did init_pbl newly
3.126 +if ppc<>(Problem ["maximum_of","function"],
3.127 + {Find=[Missing "maximum m_",Missing "valuesFor vs_"],
3.128 + Given=[Correct "fixedValues [r = Arbfix]"],
3.129 + Relate=[Missing "relations rs_"],Where=[],With=[]})
3.130 +then raise error "diffappl.sml: Specify_Problem different behaviour"
3.131 +else ();*)
3.132 +
3.133 +val nxt = tac2tac_ pt p(Specify_Method ["DiffApp","max_by_calculus"]);
3.134 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.135 +(**)
3.136 +
3.137 +if ppc<>(Method ["DiffApp","max_by_calculus"],
3.138 + {Find=[Incompl "maximum",Incompl "valuesFor"],
3.139 + Given=[Correct "fixedValues [r = Arbfix]",Missing "boundVariable v_",
3.140 + Missing "interval itv_",Missing "errorBound err_"],
3.141 + Relate=[Incompl "relations []"],Where=[],With=[]})
3.142 +then raise error "diffappl.sml: Specify_Method different behaviour"
3.143 +else ();
3.144 +(* WN.3.9.03 (#391) Model_Specify did init_pbl newly
3.145 +if ppc<>(Method ["DiffApp","max_by_calculus"],
3.146 + {Find=[Missing "maximum m_",Missing "valuesFor vs_"],
3.147 + Given=[Correct "fixedValues [r = Arbfix]",Missing "boundVariable v_",
3.148 + Missing "interval itv_",Missing "errorBound err_"],
3.149 + Relate=[Missing "relations rs_"],Where=[],With=[]})
3.150 +then raise error "diffappl.sml: Specify_Method different behaviour"
3.151 +else ();*)
3.152 +
3.153 +
3.154 +
3.155 +"--------- maximum example with 'specify', fmz <> [] -------------";
3.156 +"--------- maximum example with 'specify', fmz <> [] -------------";
3.157 +"--------- maximum example with 'specify', fmz <> [] -------------";
3.158 +val fmz =
3.159 + ["fixedValues [r=Arbfix]","maximum A",
3.160 + "valuesFor [a,b]",
3.161 + "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
3.162 + "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
3.163 + "relations [A=a*b, a/2=r*sin alpha, b/2=r*cos alpha]",
3.164 +
3.165 + "boundVariable a","boundVariable b","boundVariable alpha",
3.166 + "interval {x::real. 0 <= x & x <= 2*r}",
3.167 + "interval {x::real. 0 <= x & x <= 2*r}",
3.168 + "interval {x::real. 0 <= x & x <= pi}",
3.169 + "errorBound (eps=(0::real))"];
3.170 +val (dI',pI',mI') =
3.171 + ("DiffApp.thy",["maximum_of","function"],
3.172 + ["DiffApp","max_by_calculus"]);
3.173 +val c = []:cid;
3.174 +(*val nxt = Init_Proof' (fmz,(dI',pI',mI'));*)
3.175 +val (p,_,f,(_,nxt),_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
3.176 +
3.177 +val nxt = tac2tac_ pt p nxt;
3.178 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt e_pos' [] pt;
3.179 +val nxt = tac2tac_ pt p nxt;
3.180 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.181 +(*val nxt = Add_Given "fixedValues [(r::real) = Arbfix]" : tac*)
3.182 +
3.183 +val nxt = tac2tac_ pt p nxt;
3.184 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.185 +(*val nxt = Add_Find "maximum (A::bool)" : tac*)
3.186 +
3.187 +val nxt = tac2tac_ pt p nxt;
3.188 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.189 +(*val nxt = Add_Find "valuesFor [(a::real)]" : tac*)
3.190 +
3.191 +val nxt = tac2tac_ pt p nxt;
3.192 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.193 +(*val nxt = Add_Find "valuesFor [(b::real)]" : tac*)
3.194 +
3.195 +val nxt = tac2tac_ pt p nxt;
3.196 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.197 +(*val nxt = Add_Relation "relations [A = a * b]" *)
3.198 +
3.199 +val nxt = tac2tac_ pt p nxt;
3.200 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.201 +(*Add_Relation "relations\n [((a::real) // (#2::real)) ..."*)
3.202 +
3.203 +(*---------------------------- FIXXXXME.meNEW !!! partial Add-Relation !!!
3.204 + nxt_specif <> specify ?!
3.205 +
3.206 +if nxt<>(Add_Relation
3.207 + "relations [(a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]")
3.208 +then raise error "test specify, fmz <> []: nxt <> Add_Relation (a/2)^2.." else (); (*different with show_types !!!*)
3.209 +
3.210 +val nxt = tac2tac_ pt p nxt;
3.211 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.212 +------------------------------ FIXXXXME.meNEW !!! ---*)
3.213 +
3.214 +(*val nxt = Specify_Theory "DiffApp.thy" : tac*)
3.215 +
3.216 +val itms = get_obj g_pbl pt (fst p);writeln(itms2str_ ctxt itms);
3.217 +
3.218 +val nxt = tac2tac_ pt p nxt;
3.219 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.220 +(*val nxt = Specify_Problem ["maximum_of","function"]*)
3.221 +
3.222 +val nxt = tac2tac_ pt p nxt;
3.223 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.224 +(*val nxt = Specify_Method ("DiffApp.thy","max_by_calculus")*)
3.225 +
3.226 +val nxt = tac2tac_ pt p nxt;
3.227 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.228 +(*val nxt = Add_Given "boundVariable a" : tac*)
3.229 +
3.230 +val nxt = tac2tac_ pt p nxt;
3.231 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.232 +(*val nxt = Add_Given "interval {x. #0 <= x & x <= #2 * r}" : *)
3.233 +
3.234 +val nxt = tac2tac_ pt p nxt;
3.235 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.236 +(*val nxt = Add_Given "errorBound (eps = #0)" : tac*)
3.237 +
3.238 +val nxt = tac2tac_ pt p nxt;
3.239 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.240 +(*val nxt = Apply_Method ("DiffApp.thy","max_by_calculus") *)
3.241 +if nxt<>(Apply_Method ["DiffApp","max_by_calculus"])
3.242 +then raise error "test specify, fmz <> []: nxt <> Apply_Method max_by_calculus" else ();
3.243 +
3.244 +
3.245 +"--------- maximum example with 'specify', fmz = [] --------------";
3.246 +"--------- maximum example with 'specify', fmz = [] --------------";
3.247 +"--------- maximum example with 'specify', fmz = [] --------------";
3.248 +val fmz = [];
3.249 +val (dI',pI',mI') = empty_spec;
3.250 +val c = []:cid;
3.251 +
3.252 +val nxt = Init_Proof' (fmz,(dI',pI',mI'));(*!!!!!!!!*)
3.253 +(*val (p,_,f,(_,nxt),_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))]; !!!*)
3.254 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt e_pos' []
3.255 + EmptyPtree;
3.256 +val nxt = tac2tac_ pt p nxt;
3.257 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.258 +(*val nxt = Specify_Theory "e_domID" : tac*)
3.259 +
3.260 +val nxt = Specify_Theory "DiffApp.thy";
3.261 +val nxt = tac2tac_ pt p nxt;
3.262 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.263 +(*val nxt = Specify_Problem ["e_pblID"] : tac*)
3.264 +
3.265 +val nxt = Specify_Problem ["maximum_of","function"];
3.266 +val nxt = tac2tac_ pt p nxt;
3.267 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.268 +(*val nxt = Add_Given "fixedValues" : tac*)
3.269 +
3.270 +val nxt = Add_Given "fixedValues [r=Arbfix]";
3.271 +val nxt = tac2tac_ pt p nxt;
3.272 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.273 +(*val nxt = Add_Find "maximum" : tac*)
3.274 +
3.275 +val nxt = Add_Find "maximum A";
3.276 +val nxt = tac2tac_ pt p nxt;
3.277 +
3.278 +
3.279 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.280 +(*val nxt = Add_Find "valuesFor" : tac*)
3.281 +
3.282 +val nxt = Add_Find "valuesFor [a]";
3.283 +val nxt = tac2tac_ pt p nxt;
3.284 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.285 +(*val nxt = Add_Relation "relations" ---
3.286 + --- [b=Arbfix] KANN NICHT VERLANGT WERDEN !!!!*)
3.287 +
3.288 +(*30.8.01 ... funktioniert nicht mehr nach Einfuehrung env ....
3.289 +if nxt<>(Add_Relation "relations []")
3.290 +then raise error "test specify, fmz <> []: nxt <> Add_Relation.."
3.291 +else (); (*different with show_types !!!*)
3.292 +*)
3.293 +
3.294 +val nxt = Add_Relation "relations [(A=a+b)]";
3.295 +val nxt = tac2tac_ pt p nxt;
3.296 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.297 +(*val nxt = Specify_Method ("e_domID","e_metID") : tac*)
3.298 +
3.299 +val nxt = Specify_Method ["DiffApp","max_by_calculus"];
3.300 +val nxt = tac2tac_ pt p nxt;
3.301 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.302 +(*val nxt = Add_Given "boundVariable" : tac*)
3.303 +
3.304 +val nxt = Add_Given "boundVariable alpha";
3.305 +val nxt = tac2tac_ pt p nxt;
3.306 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.307 +(*val nxt = Add_Given "interval" : tac*)
3.308 +
3.309 +val nxt = Add_Given "interval {x. 2 <= x & x <= 3}";
3.310 +val nxt = tac2tac_ pt p nxt;
3.311 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.312 +(*val nxt = Add_Given "errorBound" : tac*)
3.313 +
3.314 +val nxt = Add_Given "errorBound (eps=999)";
3.315 +val nxt = tac2tac_ pt p nxt;
3.316 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
3.317 +(*val nxt = Apply_Method ("DiffApp","max_by_calculus") *)
3.318 +(*30.8.01 ... funktioniert nicht mehr nach Einfuehrung env ....
3.319 +if nxt<>(Apply_Method ("DiffApp.thy","max_by_calculus"))
3.320 +then raise error "test specify, fmz <> []: nxt <> Add_Relation.."
3.321 +else ();
3.322 +*)
3.323 +
3.324 +(* 2.4.00 nach Transfer specify -> hard_gen
3.325 +val nxt = Apply_Method ("DiffApp.thy","max_by_calculus");
3.326 +val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt; *)
3.327 +(*val nxt = Empty_Tac : tac*)
3.328 +
3.329 +
3.330 +"--------- match_ags, is_cp, cpy_nam +with EqSystem (!)-----------";
3.331 +"--------- match_ags, is_cp, cpy_nam +with EqSystem (!)-----------";
3.332 +"--------- match_ags, is_cp, cpy_nam +with EqSystem (!)-----------";
3.333 +val Const ("Script.SubProblem",_) $
3.334 + (Const ("Pair",_) $
3.335 + Free (dI',_) $
3.336 + (Const ("Pair",_) $ pI' $ mI')) $ ags' =
3.337 + (*...copied from stac2tac_*)
3.338 + str2term
3.339 + "SubProblem (EqSystem_, [linear, system], [no_met])\
3.340 + \ [bool_list_ [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2],\
3.341 + \ real_list_ [c, c_2]]";
3.342 +val ags = isalist2list ags';
3.343 +val pI = ["linear","system"];
3.344 +val pats = (#ppc o get_pbt) pI;
3.345 +case match_ags Isac.thy pats ags of
3.346 + [(1, [1], "#Given", Const ("Descript.equalities", _), _),
3.347 + (2, [1], "#Given", Const ("EqSystem.solveForVars", _),
3.348 + [ _ $ Free ("c", _) $ _, _ $ Free ("c_2", _) $ _]),
3.349 + (3, [1], "#Find", Const ("EqSystem.solution", _), [Free ("ss___", _)])]
3.350 + =>()
3.351 + | _ => raise error "calchead.sml match_ags 2 args OK -----------------";
3.352 +
3.353 +
3.354 +val Const ("Script.SubProblem",_) $
3.355 + (Const ("Pair",_) $
3.356 + Free (dI',_) $
3.357 + (Const ("Pair",_) $ pI' $ mI')) $ ags' =
3.358 + (*...copied from stac2tac_*)
3.359 + str2term
3.360 + "SubProblem (EqSystem_, [linear, system], [no_met])\
3.361 + \ [bool_list_ [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2],\
3.362 + \ real_list_ [c, c_2], bool_list_ ss___]";
3.363 +val ags = isalist2list ags';
3.364 +val pI = ["linear","system"];
3.365 +val pats = (#ppc o get_pbt) pI;
3.366 +case match_ags Isac.thy pats ags of
3.367 + [(1, [1], "#Given", Const ("Descript.equalities", _), _),
3.368 + (2, [1], "#Given", Const ("EqSystem.solveForVars", _),
3.369 + [_ $ Free ("c", _) $ _,
3.370 + _ $ Free ("c_2", _) $ _]),
3.371 + (3, [1], "#Find", Const ("EqSystem.solution", _), [Free ("ss___", _)])]
3.372 + (* type of Find: [Free ("ss___", "bool List.list")]*)
3.373 + =>()
3.374 + | _ => raise error "calchead.sml match_ags copy-named dropped --------";
3.375 +
3.376 +
3.377 +val stac as Const ("Script.SubProblem",_) $
3.378 + (Const ("Pair",_) $
3.379 + Free (dI',_) $
3.380 + (Const ("Pair",_) $ pI' $ mI')) $ ags' =
3.381 + (*...copied from stac2tac_*)
3.382 + str2term
3.383 + "SubProblem (EqSystem_, [linear, system], [no_met])\
3.384 + \ [real_list_ [c, c_2]]";
3.385 +val ags = isalist2list ags';
3.386 +val pI = ["linear","system"];
3.387 +val pats = (#ppc o get_pbt) pI;
3.388 +case ((match_ags Isac.thy pats ags)
3.389 + handle TYPE _ => []) of
3.390 + [] => match_ags_msg pI stac ags
3.391 + | _ => raise error "calchead.sml match_ags 1st arg missing --------";
3.392 +
3.393 +(*
3.394 +use"../smltest/ME/calchead.sml";
3.395 +*)
3.396 +
3.397 +val stac as Const ("Script.SubProblem",_) $
3.398 + (Const ("Pair",_) $
3.399 + Free (dI',_) $
3.400 + (Const ("Pair",_) $ pI' $ mI')) $ ags' =
3.401 + (*...copied from stac2tac_*)
3.402 + str2term
3.403 + "SubProblem (Test_,[univariate,equation,test],\
3.404 + \ [no_met]) [bool_ (x+1=2), real_ x]";
3.405 +val ags = isalist2list ags';
3.406 +val pI = ["univariate","equation","test"];
3.407 +val pats = (#ppc o get_pbt) pI;
3.408 +case match_ags Isac.thy pats ags of
3.409 + [(1, [1], "#Given",
3.410 + Const ("Descript.equality", _),
3.411 + [Const ("op =", _) $ (Const ("op +", _) $ Free ("x", _) $ _) $ _]),
3.412 + (2, [1], "#Given", Const ("Descript.solveFor", _), [Free ("x", _)]),
3.413 + (3, [1], "#Find", Const ("Descript.solutions", _), [Free ("x_i", _)])]
3.414 + (* type of Find: [Free ("x_i", "bool List.list")]*)
3.415 + => ()
3.416 + | _ => raise error "calchead.sml match_ags [univariate,equation,test]--";
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/test/Tools/isac/Interpret/ctree.sml Mon Aug 30 14:35:51 2010 +0200
4.3 @@ -0,0 +1,1324 @@
4.4 +(* tests for sml/ME/ctree.sml
4.5 + authors: Walther Neuper 060113
4.6 + (c) due to copyright terms
4.7 +
4.8 +use"../smltest/ME/ctree.sml";
4.9 +use"ctree.sml";
4.10 +*)
4.11 +
4.12 +"-----------------------------------------------------------------";
4.13 +"table of contents -----------------------------------------------";
4.14 +"-----------------------------------------------------------------";
4.15 +"-----------------------------------------------------------------";
4.16 +"-------------- build miniscript stepwise BEFORE ALL TESTS -------";
4.17 +"-------------- get_allpos' (from ptree above)--------------------";
4.18 +(**#####################################################################(**)
4.19 +"-------------- cut_level (from ptree above)----------------------";
4.20 +"-------------- cut_tree (from ptree above)-----------------------";
4.21 +"=====new ptree 1a miniscript with mini-subpbl ===================";
4.22 +"-------------- cut_level ( ,Frm) on Incomplete Nd ---------------";
4.23 +(**)#####################################################################**)
4.24 +"=====new ptree 2 miniscript with mini-subpbl ====================";
4.25 +"-------------- cut_tree (intermedi.ptree: 3rd level)-------------";
4.26 +"-------------- cappend (from ptree above)------------------------";
4.27 +"-------------- cappend minisubpbl -------------------------------";
4.28 +
4.29 +"=====new ptree 3 ================================================";
4.30 +"-------------- move_dn ------------------------------------------";
4.31 +"-------------- move_dn: Frm -> Res ------------------------------";
4.32 +"-------------- move_up ------------------------------------------";
4.33 +"------ move into detail -----------------------------------------";
4.34 +"=====new ptree 3a ===============================================";
4.35 +"-------------- move_dn in Incomplete ctree ----------------------";
4.36 +
4.37 +"=====new ptree 4: crooked by cut_level_'_ =======================";
4.38 +(*############## development stopped 0501 ########################*)
4.39 +(******************************************************************)
4.40 +(* val SAVE_get_trace = get_trace; *)
4.41 +(******************************************************************)
4.42 +"-------------- get_interval from ctree: incremental development--";
4.43 +(******************************************************************)
4.44 +(* val get_trace = SAVE_get_trace; *)
4.45 +(******************************************************************)
4.46 +(*############## development stopped 0501 ########################*)
4.47 +
4.48 +"=====new ptree 4 ratequation ====================================";
4.49 +"-------------- pt_extract form, tac, asm<>[] --------------------";
4.50 +"=====new ptree 5 minisubpbl =====================================";
4.51 +"-------------- pt_extract form, tac, asm ------------------------";
4.52 +
4.53 +(**#####################################################################(**)
4.54 +"=====new ptree 6 minisubpbl intersteps ==========================";
4.55 +"-------------- get_allpos' new ----------------------------------";
4.56 +"-------------- cut_tree new (from ptree above)-------------------";
4.57 +(**)#####################################################################**)
4.58 +
4.59 +"-----------------------------------------------------------------";
4.60 +"-----------------------------------------------------------------";
4.61 +"-----------------------------------------------------------------";
4.62 +
4.63 +
4.64 +"-------------- build miniscript stepwise BEFORE ALL TESTS -------";
4.65 +"-------------- build miniscript stepwise BEFORE ALL TESTS -------";
4.66 +"-------------- build miniscript stepwise BEFORE ALL TESTS -------";
4.67 +"this build should be detailed each time a test fails later \
4.68 +\i.e. all the tests should be caught here first \
4.69 +\and linked with a reference to the respective test environment";
4.70 +val fmz = ["equality (x+1=2)",
4.71 + "solveFor x","solutions L"];
4.72 +val (dI',pI',mI') =
4.73 + ("Test.thy",["sqroot-test","univariate","equation","test"],
4.74 + ["Test","squ-equ-test-subpbl1"]);
4.75 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
4.76 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
4.77 +(* nxt = Add_Given "equality (x + 1 = 2)"
4.78 + (writeln o (itms2str_ ctxt)) (get_obj g_pbl pt (fst p));
4.79 + *)
4.80 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
4.81 +(* (writeln o (itms2str_ ctxt)) (get_obj g_pbl pt (fst p));
4.82 + *)
4.83 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
4.84 +(* (writeln o (itms2str_ ctxt)) (get_obj g_pbl pt (fst p));
4.85 + *)
4.86 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
4.87 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
4.88 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
4.89 +"ctree.sml-------------- get_allpos' new ------------------------\"";
4.90 +val (PP, pp) = split_last [1];
4.91 +val ((pt', cuts), clevup) = cut_bottom (PP, pp) (get_nd pt PP);
4.92 +
4.93 +val cuts = get_allp [] ([], ([],Frm)) pt;
4.94 +val cuts2 = get_allps [] [1] (children pt);
4.95 +"ctree.sml-------------- cut_tree new (from ptree above)----------";
4.96 +val (pt', cuts) = cut_tree pt ([1],Frm);
4.97 +"ctree.sml-------------- cappend on complete ctree from above ----";
4.98 +val (pt', cuts) = cappend_form pt [1] e_istate (str2term "Inform[1]");
4.99 +"----------------------------------------------------------------/";
4.100 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt(*cappend_form: pos =[1]*);
4.101 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt(*cappend_atomic: pos =[1]*);
4.102 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt(*cappend_atomic: pos =[2]*);
4.103 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt(*cappend_problem: pos =[3]*);
4.104 +
4.105 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
4.106 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
4.107 +(*val nxt = ("Add_Given", Add_Given "equality (-1 + x = 0)").....*)
4.108 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
4.109 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
4.110 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
4.111 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
4.112 +(*val nxt = ("Apply_Method", Apply_Method ["Test", "solve_linear"])*)
4.113 +
4.114 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt(*cappend_form: pos =[3,1]*);
4.115 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt(*cappend_atomic: pos =[3,1]*);
4.116 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt(*cappend_atomic: pos =[3,2]*);
4.117 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt(*.append_result: pos =[3]*);
4.118 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt(*cappend_atomic: pos =[4]*);
4.119 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt(*.append_result: pos =[]*);
4.120 +val Form' (FormKF (~1,EdUndef,0,Nundef,res)) = f;
4.121 +if (snd nxt)=End_Proof' andalso res="[x = 1]" then ()
4.122 +else raise error "new behaviour in test: miniscript with mini-subpbl";
4.123 +
4.124 + show_pt pt;
4.125 +
4.126 +
4.127 +"-------------- get_allpos' (from ptree above)--------------------";
4.128 +"-------------- get_allpos' (from ptree above)--------------------";
4.129 +"-------------- get_allpos' (from ptree above)--------------------";
4.130 +if get_allpos' ([], 1) pt =
4.131 + [([], Frm),
4.132 + ([1], Frm),
4.133 + ([1], Res),
4.134 + ([2], Res),
4.135 + ([3], Frm),
4.136 + ([3, 1], Frm),
4.137 + ([3, 1], Res),
4.138 + ([3, 2], Res),
4.139 + ([3], Res),
4.140 + ([4], Res),
4.141 + ([], Res)]
4.142 +then () else raise error "ctree.sml: diff:behav. in get_allpos' 1";
4.143 +
4.144 +if get_allpos's ([], 1) (children pt) =
4.145 + [([1], Frm),
4.146 + ([1], Res),
4.147 + ([2], Res),
4.148 + ([3], Frm),
4.149 + ([3, 1], Frm),
4.150 + ([3, 1], Res),
4.151 + ([3, 2], Res),
4.152 + ([3], Res),
4.153 + ([4], Res)]
4.154 +then () else raise error "ctree.sml: diff:behav. in get_allpos' 2";
4.155 +
4.156 +if get_allpos's ([], 2) (takerest (1, children pt)) =
4.157 + [([2], Res),
4.158 + ([3], Frm),
4.159 + ([3, 1], Frm),
4.160 + ([3, 1], Res),
4.161 + ([3, 2], Res),
4.162 + ([3], Res),
4.163 + ([4], Res)]
4.164 +then () else raise error "ctree.sml: diff:behav. in get_allpos' 3";
4.165 +
4.166 +if get_allpos's ([], 3) (takerest (2, children pt)) =
4.167 + [([3], Frm),
4.168 + ([3, 1], Frm),
4.169 + ([3, 1], Res),
4.170 + ([3, 2], Res),
4.171 + ([3], Res),
4.172 + ([4], Res)]
4.173 +then () else raise error "ctree.sml: diff:behav. in get_allpos' 4";
4.174 +
4.175 +if get_allpos's ([3], 1) (children (nth 3 (children pt))) =
4.176 + [([3, 1], Frm),
4.177 + ([3, 1], Res),
4.178 + ([3, 2], Res)]
4.179 +then () else raise error "ctree.sml: diff:behav. in get_allpos' 5";
4.180 +
4.181 +if get_allpos' ([3], 1) (nth 3 (children pt)) =
4.182 + [([3], Frm),
4.183 + ([3, 1], Frm),
4.184 + ([3, 1], Res),
4.185 + ([3, 2], Res),
4.186 + ([3], Res)]
4.187 +then () else raise error "ctree.sml: diff:behav. in get_allpos' 6";
4.188 +
4.189 +
4.190 +(**##############################################################(**)
4.191 +
4.192 +"-------------- cut_level (from ptree above)----------------------";
4.193 +"-------------- cut_level (from ptree above)----------------------";
4.194 +"-------------- cut_level (from ptree above)----------------------";
4.195 +show_pt pt;
4.196 +show_pt pt';
4.197 +print_depth 99; cuts; print_depth 3;
4.198 +
4.199 +(*if cuts = [([2], Res),
4.200 + ([3], Frm),
4.201 + ([3, 1], Frm),
4.202 + ([3, 1], Res),
4.203 + ([3, 2], Res),
4.204 + ([3], Res),
4.205 + ([4], Res)]
4.206 +then () else raise error "ctree.sml: diff:behav. in cut_level 1a";
4.207 +val (res,asm) = get_obj g_result pt' [2];
4.208 +if res = e_term andalso asm = [] then () else
4.209 +raise error "ctree.sml: diff:behav. in cut_level 1aa" WN050219*);
4.210 +if not (existpt [2] pt') then () else
4.211 +raise error "ctree.sml: diff:behav. in cut_level 1aa2" (*WN050220*);
4.212 +
4.213 +val (res,asm) = get_obj g_result pt' [];
4.214 +if term2str res = "[x = 1]" (*WN050219 e_term in cut_tree!!!*) then () else
4.215 +raise error "ctree.sml: diff:behav. in cut_level 1ab";
4.216 +if map fst (get_interval ([],Frm) ([],Res) 9999 pt') =
4.217 + [([], Frm),
4.218 + ([1], Frm),
4.219 + ([1], Res),
4.220 + ([2], Res),(*, e_term in cut_tree!!!*)
4.221 + ([], Res)] then () else
4.222 +raise error "ctree.sml: diff:behav. in cut_level 1b";
4.223 +
4.224 +
4.225 +val (pt',cuts) = cut_level [] [] pt ([2],Res);
4.226 +if cuts = [([3], Frm),
4.227 + ([3, 1], Frm),
4.228 + ([3, 1], Res),
4.229 + ([3, 2], Res),
4.230 + ([3], Res),
4.231 + ([4], Res)]
4.232 +then () else raise error "ctree.sml: diff:behav. in cut_level 2a";
4.233 +
4.234 +if pr_ptree pr_short pt' = ". ----- pblobj -----\n1. x + 1 = 2\n2. x + 1 + -1 * 2 = 0\n"
4.235 +then () else raise error "ctree.sml: diff:behav. in cut_level 2b";
4.236 +
4.237 +val (pt',cuts) = cut_level [] [3] pt ([3,1],Frm);
4.238 +if cuts = [([3, 1], Res), ([3, 2], Res)]
4.239 +then () else raise error "ctree.sml: diff:behav. in cut_level 3a";
4.240 +if pr_ptree pr_short pt' = ". ----- pblobj -----\n1. x + 1 = 2\n2. x + 1 + -1 * 2 = 0\n3. ----- pblobj -----\n3.1. -1 + x = 0\n4. [x = 1]\n"
4.241 +then () else raise error "ctree.sml: diff:behav. in cut_level 3b";
4.242 +
4.243 +val (pt',cuts) = cut_level [] [3] pt ([3,1],Res);
4.244 +if cuts = [([3, 2], Res)]
4.245 +then () else raise error "ctree.sml: diff:behav. in cut_level 4a";
4.246 +if pr_ptree pr_short pt' = ". ----- pblobj -----\n1. x + 1 = 2\n2. x + 1 + -1 * 2 = 0\n3. ----- pblobj -----\n3.1. -1 + x = 0\n4. [x = 1]\n"
4.247 +then () else raise error "ctree.sml: diff:behav. in cut_level 4b";
4.248 +
4.249 +
4.250 +"-------------- cut_tree (from ptree above)-----------------------";
4.251 +"-------------- cut_tree (from ptree above)-----------------------";
4.252 +"-------------- cut_tree (from ptree above)-----------------------";
4.253 +val (pt', cuts) = cut_tree pt ([2],Frm);(*not created by move_dn -- not on WS*)
4.254 +if cuts = [([2], Res),
4.255 + ([3], Frm),
4.256 + ([3, 1], Frm),
4.257 + ([3, 1], Res),
4.258 + ([3, 2], Res),
4.259 + ([3], Res),
4.260 + ([4], Res),
4.261 + ([], Res)]
4.262 +then () else raise error "ctree.sml: diff:behav. in cut_tree 1a";
4.263 +
4.264 +val (res,asm) = get_obj g_result pt' [2];
4.265 +if res = e_term (*WN050219 done by cut_level*) then () else
4.266 +raise error "ctree.sml: diff:behav. in cut_tree 1aa";
4.267 +
4.268 +val form = get_obj g_form pt' [2];
4.269 +if term2str form = "x + 1 + -1 * 2 = 0" (*remained !!!*) then () else
4.270 +raise error "ctree.sml: diff:behav. in cut_tree 1ab";
4.271 +
4.272 +val (res,asm) = get_obj g_result pt' [];
4.273 +if res = e_term (*WN050219 done by cut_tree*) then () else
4.274 +raise error "ctree.sml: diff:behav. in cut_tree 1ac";
4.275 +
4.276 +if map fst (get_interval ([],Frm) ([],Res) 9999 pt') =
4.277 + [([], Frm),
4.278 + ([1], Frm),
4.279 + ([1], Res)] then () else
4.280 +raise error "ctree.sml: diff:behav. in cut_tree 1ad";
4.281 +
4.282 +val (pt', cuts) = cut_tree pt ([2],Res);
4.283 +if cuts = [([3], Frm),
4.284 + ([3, 1], Frm),
4.285 + ([3, 1], Res),
4.286 + ([3, 2], Res),
4.287 + ([3], Res),
4.288 + ([4], Res),
4.289 + ([], Res)]
4.290 +then () else raise error "ctree.sml: diff:behav. in cut_tree 2";
4.291 +
4.292 +val (pt', cuts) = cut_tree pt ([3,1],Frm);
4.293 +if cuts = [([3, 1], Res),
4.294 + ([3, 2], Res),
4.295 + ([3], Res),
4.296 + ([4], Res),
4.297 + ([], Res)]
4.298 +then () else raise error "ctree.sml: diff:behav. in cut_tree 3";
4.299 +
4.300 +val (pt', cuts) = cut_tree pt ([3,1],Res);
4.301 +if cuts = [([3, 2], Res),
4.302 + ([3], Res),
4.303 + ([4], Res),
4.304 + ([], Res)]
4.305 +then () else raise error "ctree.sml: diff:behav. in cut_tree 4";
4.306 +
4.307 +
4.308 +"=====new ptree 1a miniscript with mini-subpbl ===================";
4.309 +"=====new ptree 1a miniscript with mini-subpbl ===================";
4.310 +"=====new ptree 1a miniscript with mini-subpbl ===================";
4.311 +val fmz = ["equality (x+1=2)",
4.312 + "solveFor x","solutions L"];
4.313 +val (dI',pI',mI') =
4.314 + ("Test.thy",["sqroot-test","univariate","equation","test"],
4.315 + ["Test","squ-equ-test-subpbl1"]);
4.316 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
4.317 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
4.318 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
4.319 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
4.320 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
4.321 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
4.322 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
4.323 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
4.324 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
4.325 +show_pt pt;
4.326 +
4.327 +"-------------- cut_level ( ,Frm) on Incomplete Nd ---------------";
4.328 +"-------------- cut_level ( ,Frm) on Incomplete Nd ---------------";
4.329 +"-------------- cut_level ( ,Frm) on Incomplete Nd ---------------";
4.330 +
4.331 +val (pt',cuts) = cut_level [] [3] pt ([1],Frm);(*([1],Frm) is stored*)
4.332 +if cuts = [](*([1],Res) is not yet stored (Nd.ostate=Incomplete)*)
4.333 +then () else raise error "ctree.sml: diff:behav. in cut_tree 4a";
4.334 +
4.335 +val (pt', cuts) = cut_tree pt ([1],Frm);
4.336 +if cuts = []
4.337 +then () else raise error "ctree.sml: diff:behav. in cut_tree 4a";
4.338 +
4.339 +(*WN050219
4.340 +val pos as ([p],_) = ([1],Frm);
4.341 +val pt as Nd (b,_) = pt;
4.342 +
4.343 +
4.344 +show_pt pt;
4.345 +show_pt pt';
4.346 +print_depth 99;cuts;print_depth 3;
4.347 +print_depth 99;map fst (get_interval ([],Frm) ([],Res) 9999 pt');print_depth 3;
4.348 +####################################################################*)*)
4.349 +
4.350 +"=====new ptree 2 miniscript with mini-subpbl ====================";
4.351 +"=====new ptree 2 miniscript with mini-subpbl ====================";
4.352 +"=====new ptree 2 miniscript with mini-subpbl ====================";
4.353 + states:=[];
4.354 + CalcTree
4.355 + [(["equality (x+1=2)", "solveFor x","solutions L"],
4.356 + ("Test.thy",
4.357 + ["sqroot-test","univariate","equation","test"],
4.358 + ["Test","squ-equ-test-subpbl1"]))];
4.359 + Iterator 1; moveActiveRoot 1;
4.360 + autoCalculate 1 CompleteCalc;
4.361 +
4.362 + interSteps 1 ([3,2],Res);
4.363 +
4.364 + val ((pt,_),_) = get_calc 1;
4.365 + show_pt pt;
4.366 +
4.367 +"-------------- cut_tree (intermedi.ptree: 3rd level)-------------";
4.368 +"-------------- cut_tree (intermedi.ptree: 3rd level)-------------";
4.369 +"-------------- cut_tree (intermedi.ptree: 3rd level)-------------";
4.370 +(*WN050225 intermed. outcommented
4.371 + val (pt', cuts) = cut_tree pt ([3,2,1],Frm);
4.372 + if cuts = [([3, 2, 1], Res),
4.373 + ([3, 2, 2], Res),
4.374 + ([3, 2], Res),
4.375 + ([3], Res),
4.376 + ([4], Res)]
4.377 + then () else raise error "ctree.sml: diff:behav. in cut_tree 3rd level 1";
4.378 +
4.379 + val (pt', cuts) = cut_tree pt ([3,2,1],Res);
4.380 + if cuts = [([3, 2, 2], Res),
4.381 + ([3, 2], Res),
4.382 + ([3], Res),
4.383 + ([4], Res)]
4.384 + then () else raise error "ctree.sml: diff:behav. in cut_tree 3rd level 2";
4.385 +
4.386 +
4.387 +"-------------- cappend (from ptree above)------------------------";
4.388 +"-------------- cappend (from ptree above)------------------------";
4.389 +"-------------- cappend (from ptree above)------------------------";
4.390 +val (pt',cuts) = cappend_form pt [3,2,1] e_istate (str2term "newnew");
4.391 +if cuts = [([3, 2, 1], Res),
4.392 + ([3, 2, 2], Res),
4.393 + ([3, 2], Res),
4.394 + ([3], Res),
4.395 + ([4], Res),
4.396 + ([], Res)]
4.397 +then () else raise error "ctree.sml: diff:behav. in cappend_form";
4.398 +if term2str (get_obj g_form pt' [3,2,1]) = "newnew" andalso
4.399 + get_obj g_tac pt' [3,2,1] = Empty_Tac andalso
4.400 + term2str (fst (get_obj g_result pt' [3,2,1])) = "??.empty"
4.401 + then () else raise error "ctree.sml: diff:behav. in cappend 1";
4.402 +
4.403 +val (pt',cuts) = cappend_atomic pt [3,2,1] e_istate (str2term "newform")
4.404 + (Tac "test") (str2term "newresult",[]) Complete;
4.405 +if cuts = [([3, 2, 1], Res), (*?????????????*)
4.406 + ([3, 2, 2], Res),
4.407 + ([3, 2], Res),
4.408 + ([3], Res),
4.409 + ([4], Res),
4.410 + ([], Res)]
4.411 +then () else raise error "ctree.sml: diff:behav. in cappend_atomic";
4.412 +
4.413 +
4.414 +
4.415 +"-------------- cappend minisubpbl -------------------------------";
4.416 +"-------------- cappend minisubpbl -------------------------------";
4.417 +"-------------- cappend minisubpbl -------------------------------";
4.418 +"=====new ptree 1 miniscript with mini-subpbl ====================";
4.419 +val fmz = ["equality (x+1=2)",
4.420 + "solveFor x","solutions L"];
4.421 +val (dI',pI',mI') =
4.422 + ("Test.thy",["sqroot-test","univariate","equation","test"],
4.423 + ["Test","squ-equ-test-subpbl1"]);
4.424 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
4.425 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
4.426 +(* nxt = Add_Given "equality (x + 1 = 2)"
4.427 + (writeln o (itms2str_ ctxt)) (get_obj g_pbl pt (fst p));
4.428 + *)
4.429 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
4.430 +(* (writeln o (itms2str_ ctxt)) (get_obj g_pbl pt (fst p));
4.431 + *)
4.432 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
4.433 +(* (writeln o (itms2str_ ctxt)) (get_obj g_pbl pt (fst p));
4.434 + *)
4.435 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
4.436 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
4.437 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
4.438 +(*###cappend_form: pos =[1] ... while calculating nxt, which pt is dropped
4.439 +val nxt = ("Apply_Method", Apply_Method ["Test", "squ-equ-test-subpbl1"])*)
4.440 +
4.441 +(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt(**)cappend_form: pos =[1]*);
4.442 +val p = ([1], Frm);
4.443 +val (pt,cuts) = cappend_form pt (fst p) e_istate (str2term "x + 1 = 2");
4.444 +val form = get_obj g_form pt (fst p);
4.445 +val (res,_) = get_obj g_result pt (fst p);
4.446 +if term2str form = "x + 1 = 2" andalso res = e_term then () else
4.447 +raise error "ctree.sml, diff.behav. cappend minisubpbl ([1],Frm)";
4.448 +if not (existpt ((lev_on o fst) p) pt) then () else
4.449 +raise error "ctree.sml, diff.behav. cappend minisubpbl ([1],Frm) nxt";
4.450 +
4.451 +(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt(**)cappend_atomic: pos =[1]*);
4.452 +val p = ([1], Res);
4.453 +val (pt,cuts) =
4.454 + cappend_atomic pt (fst p) e_istate (str2term "x + 1 = 2")
4.455 + Empty_Tac (str2term "x + 1 + -1 * 2 = 0",[]) Incomplete;
4.456 +val form = get_obj g_form pt (fst p);
4.457 +val (res,_) = get_obj g_result pt (fst p);
4.458 +if term2str form = "x + 1 = 2" andalso term2str res = "x + 1 + -1 * 2 = 0"
4.459 +then () else raise error "ctree.sml, diff.behav. cappend minisubpbl ([1],Res)";
4.460 +if not (existpt ((lev_on o fst) p) pt) then () else
4.461 +raise error "ctree.sml, diff.behav. cappend minisubpbl ([1],Res) nxt";
4.462 +
4.463 +(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt(**)cappend_atomic: pos =[2]*);
4.464 +val p = ([2], Res);
4.465 +val (pt,cuts) =
4.466 + cappend_atomic pt (fst p) e_istate (str2term "x + 1 + -1 * 2 = 0")
4.467 + Empty_Tac (str2term "-1 + x = 0",[]) Incomplete;
4.468 +val form = get_obj g_form pt (fst p);
4.469 +val (res,_) = get_obj g_result pt (fst p);
4.470 +if term2str form = "x + 1 + -1 * 2 = 0" andalso term2str res = "-1 + x = 0"
4.471 +then () else raise error "ctree.sml, diff.behav. cappend minisubpbl ([2],Res)";
4.472 +if not (existpt ((lev_on o fst) p) pt) then () else
4.473 +raise error "ctree.sml, diff.behav. cappend minisubpbl ([2],Res) nxt";
4.474 +
4.475 +
4.476 +(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt;(**)cappend_problem: pos =[3]*)
4.477 +val p = ([3], Pbl);
4.478 +val (pt,cuts) = cappend_problem pt (fst p) e_istate e_fmz ([],e_spec,e_term);
4.479 +if is_pblobj (get_obj I pt (fst p)) then () else
4.480 +raise error "ctree.sml, diff.behav. cappend minisubpbl ([3],Pbl)";
4.481 +if not (existpt ((lev_on o fst) p) pt) then () else
4.482 +raise error "ctree.sml, diff.behav. cappend minisubpbl ([3],Pbl) nxt";
4.483 +
4.484 +(* ...complete calchead skipped...*)
4.485 +
4.486 +(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt(**)cappend_form: pos =[3,1]*);
4.487 +val p = ([3, 1], Frm);
4.488 +val (pt,cuts) = cappend_form pt (fst p) e_istate (str2term "-1 + x = 0");
4.489 +val form = get_obj g_form pt (fst p);
4.490 +val (res,_) = get_obj g_result pt (fst p);
4.491 +if term2str form = "-1 + x = 0" andalso res = e_term then () else
4.492 +raise error "ctree.sml, diff.behav. cappend minisubpbl ([3,1],Frm)";
4.493 +if not (existpt ((lev_on o fst) p) pt) then () else
4.494 +raise error "ctree.sml, diff.behav. cappend minisubpbl ([3,1],Frm) nxt";
4.495 +
4.496 +(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt;(**)cappend_atomic: pos =[3,1]*)
4.497 +val p = ([3, 1], Res);
4.498 +val (pt,cuts) =
4.499 + cappend_atomic pt (fst p) e_istate (str2term "-1 + x = 0")
4.500 + Empty_Tac (str2term "x = 0 + -1 * -1",[]) Incomplete;
4.501 +val form = get_obj g_form pt (fst p);
4.502 +val (res,_) = get_obj g_result pt (fst p);
4.503 +if term2str form = "-1 + x = 0" andalso term2str res = "x = 0 + -1 * -1" then()
4.504 +else raise error "ctree.sml, diff.behav. cappend minisubpbl ([3,1],Res)";
4.505 +if not (existpt ((lev_on o fst) p) pt) then () else
4.506 +raise error "ctree.sml, diff.behav. cappend minisubpbl ([3,1],Res) nxt";
4.507 +
4.508 +(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt(**)cappend_form: pos =[3,1]*);
4.509 +(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt(**)cappend_atomic: pos =[3,1]*);
4.510 +(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt(**)cappend_atomic: pos =[3,2]*);
4.511 +(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt(**).append_result: pos =[3]*);
4.512 +(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt(**)cappend_atomic: pos =[4]*);
4.513 +(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt(**).append_result: pos =[]*);
4.514 +
4.515 +WN050225 intermed. outcommented---*)
4.516 +
4.517 +"=====new ptree 3 ================================================";
4.518 +"=====new ptree 3 ================================================";
4.519 +"=====new ptree 3 ================================================";
4.520 + states:=[];
4.521 + CalcTree
4.522 + [(["equality (x+1=2)", "solveFor x","solutions L"],
4.523 + ("Test.thy",
4.524 + ["sqroot-test","univariate","equation","test"],
4.525 + ["Test","squ-equ-test-subpbl1"]))];
4.526 + Iterator 1; moveActiveRoot 1;
4.527 + autoCalculate 1 CompleteCalc;
4.528 +
4.529 + val ((pt,_),_) = get_calc 1;
4.530 + show_pt pt;
4.531 +
4.532 +"-------------- move_dn ------------------------------------------";
4.533 +"-------------- move_dn ------------------------------------------";
4.534 +"-------------- move_dn ------------------------------------------";
4.535 + val p = move_dn [] pt ([],Pbl) (*-> ([1],Frm)*);
4.536 + val p = move_dn [] pt p (*-> ([1],Res)*);
4.537 + val p = move_dn [] pt p (*-> ([2],Res)*);
4.538 + val p = move_dn [] pt p (*-> ([3],Pbl)*);
4.539 + val p = move_dn [] pt p (*-> ([3,1],Frm)*);
4.540 + val p = move_dn [] pt p (*-> ([3,1],Res)*);
4.541 + val p = move_dn [] pt p (*-> ([3,2],Res)*);
4.542 + val p = move_dn [] pt p (*-> ([3],Res)*);
4.543 +(* term2str (get_obj g_res pt [3]);
4.544 + term2str (get_obj g_form pt [4]);
4.545 + *)
4.546 + val p = move_dn [] pt p (*-> ([4],Res)*);
4.547 + val p = move_dn [] pt p (*-> ([],Res)*);
4.548 +(*
4.549 + val p = (move_dn [] pt p) handle e => print_exn_G e;
4.550 + Exception PTREE end of calculation*)
4.551 +if p=([],Res) then () else raise error "ctree.sml: diff:behav. in move_dn";
4.552 +
4.553 +
4.554 +"-------------- move_dn: Frm -> Res ------------------------------";
4.555 +"-------------- move_dn: Frm -> Res ------------------------------";
4.556 +"-------------- move_dn: Frm -> Res ------------------------------";
4.557 + states := [];
4.558 + CalcTree (*start of calculation, return No.1*)
4.559 + [(["equality (1+-1*2+x=0)", "solveFor x","solutions L"],
4.560 + ("Test.thy",
4.561 + ["linear","univariate","equation","test"],
4.562 + ["Test","solve_linear"]))];
4.563 + Iterator 1; moveActiveRoot 1;
4.564 + autoCalculate 1 CompleteCalcHead;
4.565 + autoCalculate 1 (Step 1);
4.566 + refFormula 1 (get_pos 1 1);
4.567 +
4.568 + moveActiveRoot 1;
4.569 + moveActiveDown 1;
4.570 + if get_pos 1 1 = ([1], Frm) then ()
4.571 + else raise error "ctree.sml: diff.behav. in move_dn: Frm -> Res (1)";
4.572 + moveActiveDown 1; (*<ERROR> pos does not exist </ERROR>*)
4.573 +
4.574 + autoCalculate 1 (Step 1);
4.575 + refFormula 1 (get_pos 1 1);
4.576 +
4.577 + moveActiveDown 1; (*<ERROR> pos does not exist </ERROR>*)
4.578 + if get_pos 1 1 = ([1], Res) then ()
4.579 + else raise error "ctree.sml: diff.behav. in move_dn: Frm -> Res (1)";
4.580 + moveActiveDown 1; (*<ERROR> pos does not exist </ERROR>*)
4.581 +
4.582 +
4.583 +"-------------- move_up ------------------------------------------";
4.584 +"-------------- move_up ------------------------------------------";
4.585 +"-------------- move_up ------------------------------------------";
4.586 + val p = move_up [] pt ([],Res); (*-> ([4],Res)*)
4.587 + val p = move_up [] pt p; (*-> ([3],Res)*)
4.588 + val p = move_up [] pt p; (*-> ([3,2],Res)*)
4.589 + val p = move_up [] pt p; (*-> ([3,1],Res)*)
4.590 + val p = move_up [] pt p; (*-> ([3,1],Frm)*)
4.591 + val p = move_up [] pt p; (*-> ([3],Pbl)*)
4.592 + val p = move_up [] pt p; (*-> ([2],Res)*)
4.593 + val p = move_up [] pt p; (*-> ([1],Res)*)
4.594 + val p = move_up [] pt p; (*-> ([1],Frm)*)
4.595 + val p = move_up [] pt p; (*-> ([],Pbl)*)
4.596 +(*val p = (move_up [] pt p) handle e => print_exn_G e;
4.597 + Exception PTREE begin of calculation*)
4.598 +if p=([],Pbl) then () else raise error "ctree.sml: diff.behav. in move_up";
4.599 +
4.600 +
4.601 +"------ move into detail -----------------------------------------";
4.602 +"------ move into detail -----------------------------------------";
4.603 +"------ move into detail -----------------------------------------";
4.604 + states:=[];
4.605 + CalcTree
4.606 + [(["equality (x+1=2)", "solveFor x","solutions L"],
4.607 + ("Test.thy",
4.608 + ["sqroot-test","univariate","equation","test"],
4.609 + ["Test","squ-equ-test-subpbl1"]))];
4.610 + Iterator 1; moveActiveRoot 1;
4.611 + autoCalculate 1 CompleteCalc;
4.612 + moveActiveRoot 1;
4.613 + moveActiveDown 1;
4.614 + moveActiveDown 1;
4.615 + moveActiveDown 1;
4.616 + refFormula 1 (get_pos 1 1) (* 2 Res, <ISA> -1 + x = 0 </ISA> *);
4.617 +
4.618 + interSteps 1 ([2],Res);
4.619 +
4.620 + val ((pt,_),_) = get_calc 1; show_pt pt;
4.621 + val p = get_pos 1 1;
4.622 +
4.623 + val p = move_up [] pt p; (*([2, 6], Res)*);
4.624 + val p = movelevel_up [] pt p;(*([2], Frm)*);
4.625 + val p = move_dn [] pt p; (*([2, 1], Frm)*);
4.626 + val p = move_dn [] pt p; (*([2, 1], Res)*);
4.627 + val p = move_dn [] pt p; (*([2, 2], Res)*);
4.628 + val p = move_dn [] pt p; (*([2, 3], Res)*);
4.629 + val p = move_dn [] pt p; (*([2, 4], Res)*);
4.630 + val p = move_dn [] pt p; (*([2, 5], Res)*);
4.631 + val p = move_dn [] pt p; (*([2, 6], Res)*);
4.632 + if p = ([2, 6], Res) then()
4.633 + else raise error "ctree.sml: diff.behav. in move into detail";
4.634 +
4.635 +"=====new ptree 3a ===============================================";
4.636 +"=====new ptree 3a ===============================================";
4.637 +"=====new ptree 3a ===============================================";
4.638 + states:=[];
4.639 + CalcTree
4.640 + [(["equality (x+1=2)", "solveFor x","solutions L"],
4.641 + ("Test.thy",
4.642 + ["sqroot-test","univariate","equation","test"],
4.643 + ["Test","squ-equ-test-subpbl1"]))];
4.644 + Iterator 1; moveActiveRoot 1;
4.645 + autoCalculate 1 CompleteCalcHead;
4.646 + autoCalculate 1 (Step 1);
4.647 + autoCalculate 1 (Step 1);
4.648 + autoCalculate 1 (Step 1);
4.649 + val ((pt,_),_) = get_calc 1;
4.650 + val p = move_dn [] pt ([],Pbl) (*-> ([1], Frm)*);
4.651 + val p = move_dn [] pt ([1], Frm) (*-> ([1], Res)*);
4.652 + val p = move_dn [] pt ([1], Res) (*-> ([2], Res)*);
4.653 + (*val p = move_dn [] pt ([2], Res) ->Exception- PTREE "[] not complete"*);
4.654 +
4.655 + moveDown 1 ([],Pbl) (*-> ([1], Frm)*);
4.656 + moveDown 1 ([1],Frm) (*-> ([1],Res)*);
4.657 + moveDown 1 ([1],Res) (*-> ([2],Res)*);
4.658 + moveDown 1 ([2],Res) (*-> pos does not exist*);
4.659 +(*
4.660 + get_obj g_ostate pt [1];
4.661 + show_pt pt;
4.662 +*)
4.663 +
4.664 +"-------------- move_dn in Incomplete ctree ----------------------";
4.665 +"-------------- move_dn in Incomplete ctree ----------------------";
4.666 +"-------------- move_dn in Incomplete ctree ----------------------";
4.667 +
4.668 +
4.669 +
4.670 +"=====new ptree 4: crooked by cut_level_'_ =======================";
4.671 +"=====new ptree 4: crooked by cut_level_'_ =======================";
4.672 +"=====new ptree 4: crooked by cut_level_'_ =======================";
4.673 +states:=[];
4.674 +CalcTree
4.675 +[(["equality (x/(x^2 - 6*x+9) - 1/(x^2 - 3*x) =1/x)",
4.676 + "solveFor x","solutions L"],
4.677 + ("RatEq.thy",["univariate","equation"],["no_met"]))];
4.678 +Iterator 1; moveActiveRoot 1;
4.679 +autoCalculate 1 CompleteCalc;
4.680 +
4.681 +getTactic 1 ([1],Res);(*Rewrite_Set RatEq_simplify*)
4.682 +getTactic 1 ([2],Res);(*Rewrite_Set norm_Rational*)
4.683 +getTactic 1 ([3],Res);(*Rewrite_Set RatEq_eliminate*)
4.684 +getTactic 1 ([4,1],Res);(*Rewrite all_left*)
4.685 +getTactic 1 ([4,2],Res);(*Rewrite_Set expand_binoms*)
4.686 +getTactic 1 ([4,3],Res);(*Rewrite_Set_Inst make_ratpoly_in*)
4.687 +
4.688 +moveActiveFormula 1 ([1],Res)(*1.1...1.4*);
4.689 +moveActiveFormula 1 ([2],Res)(**ME_Isa: 'expand' not known*);
4.690 +moveActiveFormula 1 ([3],Res)(*3.1.*);
4.691 +moveActiveFormula 1 ([4,2],Res)(*4.2.1.*);
4.692 +moveActiveFormula 1 ([4,3],Res)(**one_scr_arg: called by Script Stepwise t_=*);
4.693 +
4.694 +moveActiveFormula 1 ([1],Res)(*1.1...1.4*);
4.695 +interSteps 1 ([1],Res)(*..is activeFormula !?!*);
4.696 +
4.697 +getTactic 1 ([1,1],Res);(*Rewrite real_diff_minus*)
4.698 +getTactic 1 ([1,2],Res);(*Rewrite real_diff_minus*)
4.699 +getTactic 1 ([1,3],Res);(*Rewrite real_diff_minus*)
4.700 +getTactic 1 ([1,4],Res);(*Rewrite real_rat_mult_1*)
4.701 +
4.702 +moveActiveFormula 1 ([4,2],Res)(*4.2.1.*);
4.703 +interSteps 1 ([4,2],Res)(*..is activeFormula !?!*);
4.704 +val ((pt,_),_) = get_calc 1;
4.705 +writeln(pr_ptree pr_short pt);
4.706 +(*delete [4,1] in order to make pos [4],[4,4] for pblobjs differen [4],[4,3]:
4.707 + ###########################################################################*)
4.708 +val (pt, ppp) = cut_level_'_ [] [] pt ([4,1],Frm);
4.709 +writeln(pr_ptree pr_short pt);
4.710 +
4.711 +
4.712 +"-------------- get_interval from ctree: incremental development--";
4.713 +"-------------- get_interval from ctree: incremental development--";
4.714 +"-------------- get_interval from ctree: incremental development--";
4.715 +"--- level 1: get pos from start b to end p ----------------------";
4.716 +"--- level 1: get pos from start b to end p ----------------------";
4.717 +"--- level 1: get pos from start b to end p ----------------------";
4.718 +(******************************************************************)
4.719 +(**) val SAVE_get_trace = get_trace; (**)
4.720 +(******************************************************************)
4.721 +(*'getnds' below is structured as such:*)
4.722 +fun www _ [x] = "l+r-margin"
4.723 + | www true [x1,x2] = "l-margin, r-margin"
4.724 + | www _ [x1,x2] = "intern, r-margin"
4.725 + | www true (x::(xs as _::_)) = "l-margin " ^ www false xs
4.726 + | www _ (x::(xs as _::_)) = "intern " ^ www false xs;
4.727 +www true [1,2,3,4,5];
4.728 +(*val it = "from intern intern intern to" : string*)
4.729 +www true [1,2];
4.730 +(*val it = "from to" : string*)
4.731 +www true [1];
4.732 +(*val it = "from+to" : string*)
4.733 +
4.734 +local
4.735 +(*specific values of hd of pos p,q for simple handling take_fromto,
4.736 + from-pos p, to-pos q: take_fromto (hdp p) (hdq q) (children pt) ...
4.737 + ... can be used even for positions _below_ p or q*)
4.738 +fun hdp [] = 1 | hdp [0] = 1 | hdp x = hd x;(*start with first*)
4.739 +fun hdq [] = 99999 | hdq [0] = 99999 | hdq x = hd x;(*take until last*)
4.740 +(*analoguous for tl*)
4.741 +fun tlp [] = [0] | tlp [_] = [0] | tlp x = tl x;
4.742 +fun tlq [] = [99999] | tlq [_] = [99999] | tlq x = tl x;
4.743 +
4.744 +(*see modspec.sml#pt_form
4.745 +fun pt_form (PrfObj {form,...}) = term2str form
4.746 + | pt_form (PblObj {probl,spec,origin=(_,spec',_),...}) =
4.747 + let val (dI, pI, _) = get_somespec' spec spec'
4.748 + val {cas,...} = get_pbt pI
4.749 + in case cas of
4.750 + NONE => term2str (pblterm dI pI)
4.751 + | SOME t => term2str (subst_atomic (mk_env probl) t)
4.752 + end;
4.753 +*)
4.754 +(*.get an 'interval' from ptree down to a certain level
4.755 + by 'take_fromto children' of the nodes with specific 'from' and 'to';
4.756 + 'i > 0' suppresses output during recursive descent towards 'from'
4.757 + b: the 'from' incremented to the actual pos
4.758 + p,q: specific 'from','to' for simple use of 'take_fromto'*)
4.759 +fun getnd i (b,p) q (Nd (po, nds)) =
4.760 + (if i <= 0 then [(*[(b, pt_form po)]*) (**)[b](**)] else [])
4.761 +
4.762 + @ (writeln("getnd : b="^(ints2str' b)^", p="^
4.763 + (ints2str' p)^", q="^(ints2str' q));
4.764 +
4.765 + getnds (i-1) true (b@[hdp p], tlp p) (tlq q)
4.766 + (take_fromto (hdp p) (hdq q) nds))
4.767 +
4.768 +and getnds _ _ _ _ [] = [] (*no children*)
4.769 + | getnds i _ (b,p) q [nd] = (getnd i (b,p) q nd) (*l+r-margin*)
4.770 + | getnds i true (b,p) q [n1, n2] = (*l-margin, r-margin*)
4.771 + (writeln("getnds3: b="^ ints2str' b ^", p="^ ints2str' p ^
4.772 + ", q="^ ints2str' q);
4.773 + (getnd i ( b, p ) [99999] n1) @
4.774 + (getnd ~99999 (lev_on b,[0]) q n2))
4.775 + | getnds i _ (b,p) q [n1, n2] = (*intern, r-margin*)
4.776 + (writeln("getnds4: b="^ ints2str' b ^", p="^ ints2str' p ^
4.777 + ", q="^ ints2str' q);
4.778 + (getnd i ( b,[0]) [99999] n1) @
4.779 + (getnd ~99999 (lev_on b,[0]) q n2))
4.780 + | getnds i true (b,p) q (nd::(nds as _::_)) = (*l-margin, intern*)
4.781 + (writeln("getnds5: b="^ ints2str' b ^", p="^ ints2str' p ^
4.782 + ", q="^ ints2str' q);
4.783 + (getnd i ( b, p ) [99999] nd) @
4.784 + (getnds ~99999 false (lev_on b,[0]) q nds))
4.785 + | getnds i _ (b,p) q (nd::(nds as _::_)) = (*intern, ...*)
4.786 + (getnd i ( b,[0]) [99999] nd) @
4.787 + (getnds ~99999 false (lev_on b,[0]) q nds);
4.788 +in
4.789 +(*get an 'interval from to' from a ptree as 'intervals f t' of respective nodes
4.790 + where 'from' are pos, i.e. a key as int list, 'f' an int (to,t analoguous)
4.791 +(1) the 'f' are given
4.792 +(1a) by 'from' if 'f' = the respective element of 'from' (left margin)
4.793 +(1b) -inifinity, if 'f' > the respective element of 'from' (internal node)
4.794 +(2) the 't' ar given
4.795 +(2a) by 'to' if 't' = the respective element of 'to' (right margin)
4.796 +(2b) inifinity, if 't' < the respective element of 'to (internal node)'
4.797 +the 'f' and 't' are set by hdp,... *)
4.798 +fun get_trace pt p q =
4.799 + (flat o (getnds ((length p) -1) true ([hdp p], tlp p) (tlq q)))
4.800 + (take_fromto (hdp p) (hdq q) (children pt));
4.801 +end;
4.802 +
4.803 +writeln(pr_ptree pr_short pt);
4.804 +case get_trace pt [1,3] [4,1,1] of
4.805 + [[1,3],[1,4],[2],[3],[4],[4,1],[4,1,1]] => ()
4.806 + | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1a";
4.807 +case get_trace pt [2] [4,3,2] of
4.808 + [[2],[3],[4],[4,1],[4,1,1],[4,2],[4,3],[4,3,1],[4,3,2]] => ()
4.809 + | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1b";
4.810 +case get_trace pt [1,4] [4,3,1] of
4.811 + [[1,4],[2],[3],[4],[4,1],[4,1,1],[4,2],[4,3],[4,3,1]] => ()
4.812 + | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1c";
4.813 +case get_trace pt [4,2] [5] of
4.814 + (*[([4,2],_),([4,3],_),([4,4],_),([4,4,1],_),([4,4,2],_),([4,4,3],_),
4.815 + ([4,4,4],_),([4,4,5],_),([5],_)] => () ..with pt_form*)
4.816 + [[4,2],[4,3],[4,3,1],[4,3,2],[4,3,3],[4,3,4],[4,3,5],[5]]=>()
4.817 + | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1d";
4.818 +case get_trace pt [] [4,4,2] of
4.819 + [[1],[1,1],[1,2],[1,3],[1,4],[2],[3],[4],[4,1],[4,1,1],[4,2],
4.820 + [4,3],[4,3,1],[4,3,2]] => ()
4.821 + | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1e";
4.822 +case get_trace pt [] [] of
4.823 + [[1],[1,1],[1,2],[1,3],[1,4],[2],[3],[4],[4,1],[4,1,1],[4,2],
4.824 + [4,3],[4,3,1],[4,3,2],[4,3,3],[4,3,4],[4,3,5],[5]] => ()
4.825 + | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1f";
4.826 +case get_trace pt [4,3] [4,3] of
4.827 + [[4,3],[4,3,1],[4,3,2],[4,3,3],[4,3,4],[4,3,5]] => ()
4.828 + | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1g";
4.829 +
4.830 +"--- level 2: get pos' from start b to end p ---------------------";
4.831 +"--- level 2: get pos' from start b to end p ---------------------";
4.832 +"--- level 2: get pos' from start b to end p ---------------------";
4.833 +(*idea: pos_ is _ONLY_ relevant exactly at (endpoint of) from, to
4.834 + development stopped in favour of move_dn, see get_interval
4.835 + actually used (inefficient) version with move_dn: see modspec.sml
4.836 +*)
4.837 +(*
4.838 +case get_trace pt ([1,4],Res) ([4,4,1],Frm) of
4.839 + [[2],[3],[4],[4,1],[4,2],[4,2,1],[4,3],[4,4],[4,4,1]] => ()
4.840 + | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1b";
4.841 +case get_trace pt ([],Pbl) ([],Res) of
4.842 + [[1],[1,1],[1,2],[1,3],[1,4],[2],[3],[4],[4,1],[4,2],[4,2,1],[4,3],
4.843 + [4,4],[4,4,1],[4,4,2],[4,4,3],[4,4,4],[4,4,5],[5]] => ()
4.844 + | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1e";
4.845 +*)
4.846 +
4.847 +(******************************************************************)
4.848 +(**) val get_trace = SAVE_get_trace; (**)
4.849 +(******************************************************************)
4.850 +
4.851 +
4.852 +"=====new ptree 4 ratequation ====================================";
4.853 +"=====new ptree 4 ratequation ====================================";
4.854 +"=====new ptree 4 ratequation ====================================";
4.855 +states:=[];
4.856 +CalcTree
4.857 +[(["equality (x/(x^2 - 6*x+9) - 1/(x^2 - 3*x) =1/x)",
4.858 + "solveFor x","solutions L"],
4.859 + ("RatEq.thy",["univariate","equation"],["no_met"]))];
4.860 +Iterator 1; moveActiveRoot 1;
4.861 +autoCalculate 1 CompleteCalc;
4.862 +val ((pt,_),_) = get_calc 1;
4.863 +show_pt pt;
4.864 +
4.865 +
4.866 +"-------------- pt_extract form, tac, asm<>[] --------------------";
4.867 +"-------------- pt_extract form, tac, asm<>[] --------------------";
4.868 +"-------------- pt_extract form, tac, asm<>[] --------------------";
4.869 +val (Form form, SOME tac, asm) = pt_extract (pt, ([3], Res));
4.870 +case (term2str form, tac, terms2strs asm) of
4.871 + ("(3 + -1 * x + x ^^^ 2) * x = 1 * (9 * x + -6 * x ^^^ 2 + x ^^^ 3)",
4.872 + Subproblem
4.873 + ("PolyEq.thy",
4.874 + ["normalize", "polynomial", "univariate", "equation"]),
4.875 + ["9 * x + -6 * x ^^^ 2 + x ^^^ 3 ~= 0"]) => ()
4.876 + | _ => raise error "diff.behav.in ctree.sml: pt_extract asm<>[]";
4.877 +(*WN060717 unintentionally changed some rls/ord while
4.878 + completing knowl. for thes2file...
4.879 +
4.880 + case (term2str form, tac, terms2strs asm) of
4.881 + ((*"(3 + (-1 * x + x ^^^ 2)) * x = 1 * (9 * x + (x ^^^ 3 + -6 * x ^^^ 2))",
4.882 + *)Subproblem
4.883 + ("PolyEq.thy",
4.884 + ["normalize", "polynomial", "univariate", "equation"]),
4.885 + ["9 * x + (x ^^^ 3 + -6 * x ^^^ 2) ~= 0"]) => ()
4.886 + | _ => raise error "diff.behav.in ctree.sml: pt_extract asm<>[]";
4.887 +
4.888 +.... but it became even better*)
4.889 +
4.890 +
4.891 +
4.892 +"=====new ptree 5 minisubpbl =====================================";
4.893 +"=====new ptree 5 minisubpbl =====================================";
4.894 +"=====new ptree 5 minisubpbl =====================================";
4.895 +states:=[];
4.896 +CalcTree
4.897 + [(["equality (x+1=2)", "solveFor x","solutions L"],
4.898 + ("Test.thy",
4.899 + ["sqroot-test","univariate","equation","test"],
4.900 + ["Test","squ-equ-test-subpbl1"]))];
4.901 +Iterator 1; moveActiveRoot 1;
4.902 +autoCalculate 1 CompleteCalc;
4.903 +val ((pt,_),_) = get_calc 1;
4.904 +show_pt pt;
4.905 +
4.906 +"-------------- pt_extract form, tac, asm ------------------------";
4.907 +"-------------- pt_extract form, tac, asm ------------------------";
4.908 +"-------------- pt_extract form, tac, asm ------------------------";
4.909 +val (ModSpec (_,_,form,_,_,_), SOME tac, asm) = pt_extract (pt, ([], Frm));
4.910 +case (term2str form, tac, terms2strs asm) of
4.911 + ("solve (x + 1 = 2, x)",
4.912 + Apply_Method ["Test", "squ-equ-test-subpbl1"],
4.913 + []) => ()
4.914 + | _ => raise error "diff.behav.in ctree.sml: pt_extract ([], Pbl)";
4.915 +
4.916 +val (Form form, SOME tac, asm) = pt_extract (pt, ([1], Frm));
4.917 +case (term2str form, tac, terms2strs asm) of
4.918 + ("x + 1 = 2", Rewrite_Set "norm_equation", []) => ()
4.919 + | _ => raise error "diff.behav.in ctree.sml: pt_extract ([1], Frm)";
4.920 +
4.921 +val (Form form, SOME tac, asm) = pt_extract (pt, ([1], Res));
4.922 +case (term2str form, tac, terms2strs asm) of
4.923 + ("x + 1 + -1 * 2 = 0", Rewrite_Set "Test_simplify", []) => ()
4.924 + | _ => raise error "diff.behav.in ctree.sml: pt_extract ([1], Res)";
4.925 +
4.926 +val (Form form, SOME tac, asm) = pt_extract (pt, ([2], Res));
4.927 +case (term2str form, tac, terms2strs asm) of
4.928 + ("-1 + x = 0",
4.929 + Subproblem ("Test.thy", ["linear", "univariate", "equation", "test"]),
4.930 + []) => ()
4.931 + | _ => raise error "diff.behav.in ctree.sml: pt_extract ([2], Res)";
4.932 +
4.933 +val (ModSpec (_,_,form,_,_,_), SOME tac, asm) = pt_extract (pt, ([3], Pbl));
4.934 +case (term2str form, tac, terms2strs asm) of
4.935 + ("solve (-1 + x = 0, x)", Apply_Method ["Test", "solve_linear"], []) => ()
4.936 + | _ => raise error "diff.behav.in ctree.sml: pt_extract ([3], Pbl)";
4.937 +
4.938 +val (Form form, SOME tac, asm) = pt_extract (pt, ([3,1], Frm));
4.939 +case (term2str form, tac, terms2strs asm) of
4.940 + ("-1 + x = 0", Rewrite_Set_Inst (["(bdv, x)"], "isolate_bdv"), []) => ()
4.941 + | _ => raise error "diff.behav.in ctree.sml: pt_extract ([3,1], Frm)";
4.942 +
4.943 +val (Form form, SOME tac, asm) = pt_extract (pt, ([3,1], Res));
4.944 +case (term2str form, tac, terms2strs asm) of
4.945 + ("x = 0 + -1 * -1", Rewrite_Set "Test_simplify", []) => ()
4.946 + | _ => raise error "diff.behav.in ctree.sml: pt_extract ([3,1], Res)";
4.947 +
4.948 +val (Form form, SOME tac, asm) = pt_extract (pt, ([3,2], Res));
4.949 +case (term2str form, tac, terms2strs asm) of
4.950 + ("x = 1", Check_Postcond ["linear", "univariate", "equation", "test"],
4.951 + []) => ()
4.952 + | _ => raise error "diff.behav.in ctree.sml: pt_extract ([3,2], Res)";
4.953 +
4.954 +val (Form form, SOME tac, asm) = pt_extract (pt, ([3], Res));
4.955 +case (term2str form, tac, terms2strs asm) of
4.956 + ("[x = 1]", Check_elementwise "Assumptions", []) => ()
4.957 + | _ => raise error "diff.behav.in ctree.sml: pt_extract ([3], Res)";
4.958 +
4.959 +val (Form form, SOME tac, asm) = pt_extract (pt, ([4], Res));
4.960 +case (term2str form, tac, terms2strs asm) of
4.961 + ("[x = 1]",
4.962 + Check_Postcond ["sqroot-test", "univariate", "equation", "test"],
4.963 + []) => ()
4.964 + | _ => raise error "diff.behav.in ctree.sml: pt_extract ([4], Res)";
4.965 +
4.966 +val (Form form, tac, asm) = pt_extract (pt, ([], Res));
4.967 +case (term2str form, tac, terms2strs asm) of
4.968 + ("[x = 1]", NONE, []) => ()
4.969 + | _ => raise error "diff.behav.in ctree.sml: pt_extract ([], Res)";
4.970 +
4.971 +"=====new ptree 6 minisubpbl intersteps ==========================";
4.972 +"=====new ptree 6 minisubpbl intersteps ==========================";
4.973 +"=====new ptree 6 minisubpbl intersteps ==========================";
4.974 +states:=[];
4.975 +CalcTree
4.976 + [(["equality (x+1=2)", "solveFor x","solutions L"],
4.977 + ("Test.thy",
4.978 + ["sqroot-test","univariate","equation","test"],
4.979 + ["Test","squ-equ-test-subpbl1"]))];
4.980 +Iterator 1; moveActiveRoot 1;
4.981 +autoCalculate 1 CompleteCalc;
4.982 +interSteps 1 ([2],Res);
4.983 +interSteps 1 ([3,2],Res);
4.984 +val ((pt,_),_) = get_calc 1;
4.985 +show_pt pt;
4.986 +
4.987 +(**##############################################################**)
4.988 +"-------------- get_allpos' new ----------------------------------";
4.989 +"-------------- get_allpos' new ----------------------------------";
4.990 +"-------------- get_allpos' new ----------------------------------";
4.991 +"--- whole ctree";
4.992 +print_depth 99;
4.993 +val cuts = get_allp [] ([], ([],Frm)) pt;
4.994 +print_depth 3;
4.995 +if cuts =
4.996 + [(*never returns the first pos'*)
4.997 + ([1], Frm),
4.998 + ([1], Res),
4.999 + ([2, 1], Frm), ([2, 1], Res), ([2, 2], Res), ([2, 3], Res),
4.1000 + ([2, 4], Res), ([2, 5], Res), ([2, 6], Res),
4.1001 + ([2], Res),
4.1002 + ([3], Pbl),
4.1003 + ([3, 1], Frm), ([3, 1], Res),
4.1004 + ([3, 2, 1], Frm), ([3, 2, 1], Res), ([3, 2, 2], Res),
4.1005 + ([3, 2], Res),
4.1006 + ([3], Res),
4.1007 + ([4], Res),
4.1008 + ([], Res)] then () else
4.1009 +raise error "ctree.sml diff.behav. get_allp new []";
4.1010 +
4.1011 +print_depth 99;
4.1012 +val cuts2 = get_allps [] [1] (children pt);
4.1013 +print_depth 3;
4.1014 +if cuts = cuts2 @ [([], Res)] then () else
4.1015 +raise error "ctree.sml diff.behav. get_allps new []";
4.1016 +
4.1017 +"---(3) on S(606)..S(608)--------";
4.1018 +"--- nd [2] with 6 children---------------------------------";
4.1019 +val cuts = get_allp [] ([2], ([],Frm)) (get_nd pt [2]);
4.1020 +if cuts =
4.1021 + [([2, 1], Frm), ([2, 1], Res), ([2, 2], Res), ([2, 3], Res),
4.1022 + ([2, 4], Res), ([2, 5], Res), ([2, 6], Res),
4.1023 + ([2], Res)] then () else
4.1024 +raise error "ctree.sml diff.behav. get_allp new [2]";
4.1025 +
4.1026 +val cuts2 = get_allps [] [2,1] (children (get_nd pt [2]));
4.1027 +if cuts = cuts2 @ [([2], Res)] then () else
4.1028 +raise error "ctree.sml diff.behav. get_allps new [2]";
4.1029 +
4.1030 +
4.1031 +"---(4) on S(606)..S(608)--------";
4.1032 +"--- nd [3] subproblem--------------------------------------";
4.1033 +val cuts = get_allp [] ([3], ([],Frm)) (get_nd pt [3]);
4.1034 +if cuts =
4.1035 + [([3, 1], Frm),
4.1036 + ([3, 1], Res),
4.1037 + ([3, 2, 1], Frm), ([3, 2, 1], Res), ([3, 2, 2], Res),
4.1038 + ([3, 2], Res),
4.1039 + ([3], Res)] then () else
4.1040 +raise error "ctree.sml diff.behav. get_allp new [3]";
4.1041 +
4.1042 +val cuts2 = get_allps [] [3,1] (children (get_nd pt [3]));
4.1043 +if cuts = cuts2 @ [([3], Res)] then () else
4.1044 +raise error "ctree.sml diff.behav. get_allps new [3]";
4.1045 +
4.1046 +"--- nd [3,2] with 2 children--------------------------------";
4.1047 +val cuts = get_allp [] ([3,2], ([],Frm)) (get_nd pt [3,2]);
4.1048 +if cuts =
4.1049 + [([3, 2, 1], Frm), ([3, 2, 1], Res), ([3, 2, 2], Res),
4.1050 + ([3, 2], Res)] then () else
4.1051 +raise error "ctree.sml diff.behav. get_allp new [3,2]";
4.1052 +
4.1053 +val cuts2 = get_allps [] [3,2,1] (children (get_nd pt [3,2]));
4.1054 +if cuts = cuts2 @ [([3, 2], Res)] then () else
4.1055 +raise error "ctree.sml diff.behav. get_allps new [3,2]";
4.1056 +
4.1057 +"---(5a) on S(606)..S(608)--------";
4.1058 +"--- nd [3,2,1] with 0 children------------------------------";
4.1059 +val cuts = get_allp [] ([3,2,1], ([],Frm)) (get_nd pt [3,2,1]);
4.1060 +if cuts =
4.1061 + [] then () else
4.1062 +raise error "ctree.sml diff.behav. get_allp new [3,2,1]";
4.1063 +
4.1064 +val cuts2 = get_allps [] [3,2,1,1] (children (get_nd pt [3,2,1]));
4.1065 +if cuts = cuts2 @ [] then () else
4.1066 +raise error "ctree.sml diff.behav. get_allps new [3,2,1]";
4.1067 +
4.1068 +
4.1069 +(**#################################################################**)
4.1070 +"-------------- cut_tree new (from ptree above)-------------------";
4.1071 +"-------------- cut_tree new (from ptree above)-------------------";
4.1072 +"-------------- cut_tree new (from ptree above)-------------------";
4.1073 +show_pt pt;
4.1074 +val b = get_obj g_branch pt [];
4.1075 +if b = TransitiveB then () else
4.1076 +raise error ("ctree.sml diff.behav. in [] branch="^branch2str b);
4.1077 +val b = get_obj g_branch pt [3];
4.1078 +if b = TransitiveB then () else
4.1079 +raise error ("ctree.sml diff.behav. in [3] branch="^branch2str b);
4.1080 +
4.1081 +"---(2) on S(606)..S(608)--------";
4.1082 +val (pt', cuts) = cut_tree pt ([1],Res);
4.1083 +print_depth 99;
4.1084 +cuts;
4.1085 +print_depth 3;
4.1086 +if cuts = [([2, 1], Frm), ([2, 1], Res), ([2, 2], Res), ([2, 3], Res),
4.1087 + ([2, 4], Res), ([2, 5], Res), ([2, 6], Res), ([2], Res), ([3], Pbl),
4.1088 + ([3, 1], Frm), ([3, 1], Res), ([3, 2, 1], Frm), ([3, 2, 1], Res),
4.1089 + ([3, 2, 2], Res), ([3, 2], Res), ([3], Res), ([4], Res),
4.1090 +(*WN060727 after replacing cutlevup by test_trans:*)([], Res)] then () else
4.1091 +raise error "ctree.sml: diff.behav. cut_tree ([1],Res)";
4.1092 +
4.1093 +
4.1094 +"---(3) on S(606)..S(608)--------";
4.1095 +val (pt', cuts) = cut_tree pt ([2],Res);
4.1096 +print_depth 99;
4.1097 +cuts;
4.1098 +print_depth 3;
4.1099 +if cuts = [(*preceding step on WS was ([1]),Res*)
4.1100 + ([2, 1], Frm), ([2, 1], Res), ([2, 2], Res), ([2, 3], Res),
4.1101 + ([2, 4], Res), ([2, 5], Res), ([2, 6], Res),
4.1102 + ([2], Res),
4.1103 + ([3], Pbl),
4.1104 + ([3, 1], Frm),
4.1105 + ([3, 1], Res),
4.1106 + ([3, 2, 1], Frm), ([3, 2, 1], Res), ([3, 2, 2], Res),
4.1107 + ([3, 2], Res),
4.1108 + ([3], Res),
4.1109 + ([4], Res),
4.1110 +(*WN060727 added after replacing cutlevup by test_trans:*)([],Res)] then ()
4.1111 +else raise error "ctree.sml: diff.behav. cut_tree ([2],Res)";
4.1112 +
4.1113 +"---(4) on S(606)..S(608)--------";
4.1114 +val (pt', cuts) = cut_tree pt ([3],Pbl);
4.1115 +print_depth 99;
4.1116 +cuts;
4.1117 +print_depth 3;
4.1118 +if cuts = [([3], Pbl),
4.1119 + ([3, 1], Frm), ([3, 1], Res),
4.1120 + ([3, 2, 1], Frm), ([3, 2, 1], Res), ([3, 2, 2], Res),
4.1121 + ([3, 2], Res),
4.1122 + ([3], Res),
4.1123 + ([4], Res),
4.1124 +(*WN060727 added after replacing cutlevup by test_trans:*)([], Res)]
4.1125 +then () else raise error "ctree.sml: diff.behav. cut_tree ([3],Pbl)";
4.1126 +
4.1127 +"---(5a) on S(606)..S(608) cut_tree --------";
4.1128 +val (pt', cuts) = cut_tree pt ([3,2,1],Res);
4.1129 +print_depth 99;
4.1130 +cuts;
4.1131 +print_depth 1;
4.1132 +if cuts = [([3, 2, 2], Res), ([3, 2], Res),
4.1133 +(*WN060727 added after replacing cutlevup by test_trans:*)
4.1134 +([3], Res), ([4], Res),([],Res)] then ()
4.1135 +else raise error "ctree.sml: diff.behav. cut_tree ([3,2,1],Res)";
4.1136 +show_pt pt';
4.1137 +
4.1138 +
4.1139 +"-------------- cappend on complete ctree from above -------------";
4.1140 +"-------------- cappend on complete ctree from above -------------";
4.1141 +"-------------- cappend on complete ctree from above -------------";
4.1142 +show_pt pt;
4.1143 +
4.1144 +"---(2) on S(606)..S(608)--------";
4.1145 +val (pt', cuts) = cappend_atomic pt [1] e_istate (str2term "Inform[1]")
4.1146 + (Tac "test") (str2term "Inres[1]",[]) Complete;
4.1147 +print_depth 99;
4.1148 +cuts;
4.1149 +print_depth 3;
4.1150 +if cuts = [([2, 1], Frm), ([2, 1], Res), ([2, 2], Res), ([2, 3], Res),
4.1151 + ([2, 4], Res), ([2, 5], Res), ([2, 6], Res), ([2], Res), ([3], Pbl),
4.1152 + ([3, 1], Frm), ([3, 1], Res), ([3, 2, 1], Frm), ([3, 2, 1], Res),
4.1153 + ([3, 2, 2], Res), ([3, 2], Res), ([3], Res), ([4], Res),
4.1154 +(*WN060727 added after replacing cutlevup by test_trans:*) ([], Res)] then ()
4.1155 +else raise error "ctree.sml: diff:behav. in complete pt:append_atomic[1] cuts";
4.1156 +val afterins = get_allp [] ([], ([],Frm)) pt';
4.1157 +print_depth 99;
4.1158 +afterins;
4.1159 +print_depth 3;
4.1160 +if afterins = [([1], Frm), ([1], Res)
4.1161 +(*, WN060727 removed after replacing cutlevup by test_trans:([], Res)*)] then()
4.1162 +else raise error "ctree.sml: diff:behav. in complete pt: append_atomic[1] afterins";
4.1163 +show_pt pt';
4.1164 +
4.1165 +"---(3) on S(606)..S(608)--------";
4.1166 +show_pt pt;
4.1167 +val (pt', cuts) = cappend_atomic pt [2] e_istate (str2term "Inform[2]")
4.1168 + (Tac "test") (str2term "Inres[2]",[]) Complete;
4.1169 +print_depth 99;
4.1170 +cuts;
4.1171 +print_depth 3;
4.1172 +if cuts = [([2, 1], Frm), ([2, 1], Res), ([2, 2], Res), ([2, 3], Res),
4.1173 + ([2, 4], Res), ([2, 5], Res), ([2, 6], Res), ([2], Res), ([3], Pbl),
4.1174 + ([3, 1], Frm),([3, 1], Res), ([3, 2, 1], Frm), ([3, 2, 1], Res),
4.1175 + ([3, 2, 2], Res), ([3, 2], Res), ([3], Res), ([4], Res),
4.1176 +(*WN060727 added after replacing cutlevup by test_trans:*) ([], Res)] then ()
4.1177 +else raise error "ctree.sml: diff:behav.in complete pt: append_atomic[2] cuts";
4.1178 +val afterins = get_allp [] ([], ([],Frm)) pt';
4.1179 +print_depth 99;
4.1180 +afterins;
4.1181 +print_depth 3;
4.1182 +if afterins = [([1], Frm), ([1], Res), ([2], Frm), ([2], Res)
4.1183 +(*, WN060727 removed after replacing cutlevup by test_trans:([], Res)*)]
4.1184 +then () else
4.1185 +raise error "ctree.sml: diff:behav. in complete pt: append_atomic[2] afterins";
4.1186 +show_pt pt';
4.1187 +(*
4.1188 + val p = move_dn [] pt' ([],Pbl) (*-> ([1],Frm)*);
4.1189 + val p = move_dn [] pt' p (*-> ([1],Res)*);
4.1190 + val p = move_dn [] pt' p (*-> ([2],Frm)*);
4.1191 + val p = move_dn [] pt' p (*-> ([2],Res)*);
4.1192 +
4.1193 + term2str (get_obj g_form pt' [2]);
4.1194 + term2str (get_obj g_res pt' [2]);
4.1195 + ostate2str (get_obj g_ostate pt' [2]);
4.1196 + *)
4.1197 +
4.1198 +"---(4) on S(606)..S(608)--------";
4.1199 +val (pt', cuts) = cappend_problem pt [3] e_istate ([],e_spec)
4.1200 + ([],e_spec, str2term "Inhead[3]");
4.1201 +print_depth 99;
4.1202 +cuts;
4.1203 +print_depth 3;
4.1204 +if cuts = [([3], Pbl),
4.1205 + ([3, 1], Frm), ([3, 1], Res),
4.1206 + ([3, 2, 1], Frm), ([3, 2, 1], Res), ([3, 2, 2], Res),
4.1207 + ([3, 2], Res),
4.1208 + ([3], Res), ([4], Res),
4.1209 +(*WN060727 added after replacing cutlevup by test_trans*)([], Res)] then ()else
4.1210 +raise error "ctree.sml: diff:behav. in ccomplete pt: append_problem[3] cuts";
4.1211 +val afterins = get_allp [] ([], ([],Frm)) pt';
4.1212 +print_depth 99;
4.1213 +afterins;
4.1214 +print_depth 3;
4.1215 +if afterins =
4.1216 + [([1], Frm), ([1], Res),([2, 1], Frm), ([2, 1], Res), ([2, 2], Res),
4.1217 + ([2, 3], Res), ([2, 4], Res), ([2, 5], Res), ([2, 6], Res), ([2], Res),
4.1218 + ([3], Pbl)] then () else
4.1219 +raise error "ctree.sml: diff:behav.in complete pt: append_problem[3] afterins";
4.1220 +(* use"systest/ctree.sml";
4.1221 + use"ctree.sml";
4.1222 + *)
4.1223 +
4.1224 +"---(6-1) on S(606)..S(608)--------";
4.1225 +val (pt', cuts) = cappend_atomic pt [3,1] e_istate (str2term "Inform[3,1]")
4.1226 + (Tac "test") (str2term "Inres[3,1]",[]) Complete;
4.1227 +print_depth 99;
4.1228 +cuts;
4.1229 +print_depth 3;
4.1230 +if cuts = [([3, 2, 1], Frm), ([3, 2, 1], Res), ([3, 2, 2], Res),
4.1231 + ([3, 2], Res),
4.1232 +(*WN060727 added*)([3], Res), ([4], Res), ([], Res)] then () else
4.1233 +raise error "ctree.sml: diff:behav. in complete pt: append_atomic[3,1] cuts";
4.1234 +val afterins = get_allp [] ([], ([],Frm)) pt';
4.1235 +print_depth 99;
4.1236 +afterins;
4.1237 +print_depth 3;
4.1238 +(*WN060727 replaced after overwriting cutlevup by test_trans
4.1239 +if afterins = [([1], Frm), ([1], Res),
4.1240 + ([2, 1], Frm), ([2, 1], Res), ([2, 2], Res),
4.1241 + ([2, 3], Res), ([2, 4], Res), ([2, 5], Res), ([2, 6], Res),
4.1242 + ([2], Res),
4.1243 + ([3], Pbl),
4.1244 + ([3, 1], Frm), ([3, 1], Res)(*replaced*), (*([3, 2], Res) cut!*)
4.1245 + ([3], Res)(*cutlevup=false*),
4.1246 + ([4], Res),
4.1247 + ([], Res)(*cutlevup=false*)] then () else
4.1248 +raise error "ctree.sml: diff:behav. in complete pt: append_atomic[3,1] insrtd";
4.1249 +*)
4.1250 +if afterins = [([1], Frm), ([1], Res),
4.1251 + ([2, 1], Frm), ([2, 1], Res), ([2, 2], Res),
4.1252 + ([2, 3], Res), ([2, 4], Res), ([2, 5], Res), ([2, 6], Res),
4.1253 + ([2], Res),
4.1254 + ([3], Pbl),
4.1255 + ([3, 1], Frm), ([3, 1], Res)] then () else
4.1256 +raise error "ctree.sml: diff:behav. in complete pt: append_atomic[3,1] insrtd";
4.1257 +
4.1258 +if term2str (get_obj g_form pt' [3,1]) = "Inform [3, 1]" then () else
4.1259 +raise error "ctree.sml: diff:behav. in complete pt: append_atomic[3,1] Inform";
4.1260 +
4.1261 +"---(6) on S(606)..S(608)--------";
4.1262 +val (pt', cuts) = cappend_atomic pt [3,2] e_istate (str2term "Inform[3,2]")
4.1263 + (Tac "test") (str2term "Inres[3,2]",[]) Complete;
4.1264 +print_depth 99;
4.1265 +cuts;
4.1266 +print_depth 3;
4.1267 +if cuts = [(*just after is: cutlevup=false in [3]*)
4.1268 +(*WN060727 after test_trans instead cutlevup added:*)
4.1269 + ([3], Res), ([4], Res), ([], Res)] then () else
4.1270 +raise error "ctree.sml: diff:behav. in complete pt: append_atomic[3,2] cuts";
4.1271 +val afterins = get_allp [] ([], ([],Frm)) pt';
4.1272 +print_depth 99;
4.1273 +afterins;
4.1274 +print_depth 3;
4.1275 +(*WN060727 replaced after overwriting cutlevup by test_trans
4.1276 +if afterins = [([1], Frm), ([1], Res),
4.1277 + ([2, 1], Frm), ([2, 1], Res), ([2, 2], Res),
4.1278 + ([2, 3], Res), ([2, 4], Res), ([2, 5], Res), ([2, 6], Res),
4.1279 + ([2], Res),
4.1280 + ([3], Pbl),
4.1281 + ([3, 1], Frm), ([3, 1], Res), ([3, 2], Frm), ([3, 2], Res),
4.1282 + ([3], Res),
4.1283 + ([4], Res), ([], Res)] then () else
4.1284 +raise error "ctree.sml: diff:behav. in complete pt: append_atomic[3,2] insrtd";
4.1285 +*)
4.1286 +if afterins = [([1], Frm), ([1], Res),
4.1287 + ([2, 1], Frm), ([2, 1], Res), ([2, 2], Res),
4.1288 + ([2, 3], Res), ([2, 4], Res), ([2, 5], Res), ([2, 6], Res),
4.1289 + ([2], Res),
4.1290 + ([3], Pbl),
4.1291 + ([3, 1], Frm), ([3, 1], Res), ([3, 2], Frm), ([3, 2], Res)]
4.1292 +then () else
4.1293 +raise error "ctree.sml: diff:behav. in complete pt: append_atomic[3,2] insrtd";
4.1294 +
4.1295 +if term2str (get_obj g_form pt' [3,2]) = "Inform [3, 2]" then () else
4.1296 +raise error "ctree.sml: diff:behav. in complete pt: append_atomic[3,2] Inform";
4.1297 +
4.1298 +"---(6++) on S(606)..S(608)--------";
4.1299 +(**)
4.1300 +val (pt', cuts) = cappend_atomic pt [3,2,1] e_istate (str2term "Inform[3,2,1]")
4.1301 + (Tac "test") (str2term "Inres[3,2,1]",[]) Complete;
4.1302 +print_depth 99;
4.1303 +cuts;
4.1304 +print_depth 1;
4.1305 +if cuts = [([3, 2, 2], Res), ([3, 2], Res),
4.1306 +(*WN060727 {cutlevup->test_trans} added:*)([3], Res), ([4], Res), ([], Res)]
4.1307 +then () else
4.1308 +raise error "ctree.sml: diff:behav. in complete pt: append_atomic[3,2,1] cuts";
4.1309 +val afterins = get_allp [] ([], ([],Frm)) pt';
4.1310 +print_depth 99;
4.1311 +afterins;
4.1312 +print_depth 3;
4.1313 +if afterins = [([1], Frm), ([1], Res),
4.1314 + ([2, 1], Frm), ([2, 1], Res), ([2, 2], Res),
4.1315 + ([2, 3], Res), ([2, 4], Res), ([2, 5], Res), ([2, 6], Res),
4.1316 + ([2], Res),
4.1317 + ([3], Pbl),
4.1318 + ([3, 1], Frm), ([3, 1], Res),
4.1319 + ([3, 2, 1], Frm), ([3, 2, 1], Res)] then () else
4.1320 +raise error "ctree.sml: diff:behav. in complete pt: append_atom[3,2,1] insrtd";
4.1321 +if term2str (get_obj g_form pt' [3,2,1]) = "Inform [3, 2, 1]" then () else
4.1322 +raise error "ctree.sml: diff:behav. complete pt: append_atomic[3,2,1] Inform";
4.1323 +(*
4.1324 +show_pt pt';
4.1325 +show_pt pt;
4.1326 +*)
4.1327 +
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/test/Tools/isac/Interpret/inform.sml Mon Aug 30 14:35:51 2010 +0200
5.3 @@ -0,0 +1,772 @@
5.4 +(* tests on inform.sml
5.5 + author: Walther Neuper
5.6 + 060225,
5.7 + (c) due to copyright terms
5.8 +
5.9 +use"../smltest/ME/inform.sml";
5.10 +use"inform.sml";
5.11 +*)
5.12 +
5.13 +"-----------------------------------------------------------------";
5.14 +"table of contents -----------------------------------------------";
5.15 +"-----------------------------------------------------------------";
5.16 +"appendForm with miniscript with mini-subpbl:";
5.17 +"--------- appendFormula: on Res + equ_nrls ----------------------";
5.18 +"--------- appendFormula: on Frm + equ_nrls ----------------------";
5.19 +"--------- appendFormula: on Res + NO deriv ----------------------";
5.20 +"--------- appendFormula: on Res + late deriv --------------------";
5.21 +"--------- appendFormula: on Res + late deriv [x = 3 + -2]---///--";
5.22 +"replaceForm with miniscript with mini-subpbl:";
5.23 +"--------- replaceFormula: on Res + = ----------------------------";
5.24 +"--------- replaceFormula: on Res + = 1st Nd ---------------------";
5.25 +"--------- replaceFormula: on Frm + = 1st Nd ---------------------";
5.26 +"--------- replaceFormula: cut calculation -----------------------";
5.27 +"--------- replaceFormula: cut calculation -----------------------";
5.28 +(* 040307 copied from informtest.sml ... old versions
5.29 +"--------- maximum-example, UC: Modeling / modifyCalcHead --------";*)
5.30 +"--------- syntax error ------------------------------------------";
5.31 +"CAS-command:";
5.32 +"--------- CAS-command on ([],Pbl) -------------------------------";
5.33 +"--------- CAS-command on ([],Pbl) FE-interface ------------------";
5.34 +"--------- inform [rational,simplification] ----------------------";
5.35 +"--------- Take as 1st tac, start with <NEW> (CAS input) ---------";
5.36 +"--------- Take as 1st tac, start from exp -----------------------";
5.37 +"--------- init_form, start with <NEW> (CAS input) ---------------";
5.38 +"-----------------------------------------------------------------";
5.39 +"-----------------------------------------------------------------";
5.40 +"-----------------------------------------------------------------";
5.41 +
5.42 +
5.43 +
5.44 +
5.45 +
5.46 +
5.47 +"--------- appendFormula: on Res + equ_nrls ----------------------";
5.48 +"--------- appendFormula: on Res + equ_nrls ----------------------";
5.49 +"--------- appendFormula: on Res + equ_nrls ----------------------";
5.50 + val Script sc = (#scr o get_met) ["Test","squ-equ-test-subpbl1"];
5.51 + (writeln o term2str) sc;
5.52 + val Script sc = (#scr o get_met) ["Test","solve_linear"];
5.53 + (writeln o term2str) sc;
5.54 +
5.55 + states:=[];
5.56 + CalcTree [(["equality (x+1=2)", "solveFor x","solutions L"],
5.57 + ("Test.thy",
5.58 + ["sqroot-test","univariate","equation","test"],
5.59 + ["Test","squ-equ-test-subpbl1"]))];
5.60 + Iterator 1; moveActiveRoot 1;
5.61 + autoCalculate 1 CompleteCalcHead;
5.62 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
5.63 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
5.64 +
5.65 + appendFormula 1 "-2 * 1 + (1 + x) = 0"; refFormula 1 (get_pos 1 1);
5.66 + val ((pt,_),_) = get_calc 1;
5.67 + val str = pr_ptree pr_short pt;
5.68 + writeln str;
5.69 + if str = ". ----- pblobj -----\n1. x + 1 = 2\n2. x + 1 + -1 * 2 = 0\n2.1. x + 1 + -1 * 2 = 0\n2.2. -1 * 2 + (x + 1) = 0\n2.3. -1 * 2 + (1 + x) = 0\n2.4. 1 + (-1 * 2 + x) = 0\n2.5. 1 + (-2 + x) = 0\n2.6. 1 + (-2 * 1 + x) = 0\n" then ()
5.70 + else raise error "inform.sml: diff.behav.appendFormula: on Res + equ 1";
5.71 +
5.72 + moveDown 1 ([ ],Pbl); refFormula 1 ([1],Frm); (*x + 1 = 2*)
5.73 + moveDown 1 ([1],Frm); refFormula 1 ([1],Res); (*x + 1 + -1 * 2 = 0*)
5.74 +
5.75 + (*the seven steps of detailed derivation*)
5.76 + moveDown 1 ([1 ],Res); refFormula 1 ([2,1],Frm);
5.77 + moveDown 1 ([2,1],Frm); refFormula 1 ([2,1],Res);
5.78 + moveDown 1 ([2,1],Res); refFormula 1 ([2,2],Res);
5.79 + moveDown 1 ([2,2],Res); refFormula 1 ([2,3],Res);
5.80 + moveDown 1 ([2,3],Res); refFormula 1 ([2,4],Res);
5.81 + moveDown 1 ([2,4],Res); refFormula 1 ([2,5],Res);
5.82 + moveDown 1 ([2,5],Res); refFormula 1 ([2,6],Res);
5.83 + val ((pt,_),_) = get_calc 1;
5.84 + if "-2 * 1 + (1 + x) = 0" = term2str (fst (get_obj g_result pt [2,6])) then()
5.85 + else raise error "inform.sml: diff.behav.appendFormula: on Res + equ 2";
5.86 +
5.87 + fetchProposedTactic 1; (*takes Iterator 1 _1_*)
5.88 + val (_,(tac,_,_)::_) = get_calc 1;
5.89 + if tac = Rewrite_Set "Test_simplify" then ()
5.90 + else raise error "inform.sml: diff.behav.appendFormula: on Res + equ 3";
5.91 + autoCalculate 1 CompleteCalc;
5.92 + val ((pt,_),_) = get_calc 1;
5.93 + if "[x = 1]" = term2str (fst (get_obj g_result pt [])) then ()
5.94 + else raise error "inform.sml: diff.behav.appendFormula: on Res + equ 4";
5.95 + (* autoCalculate 1 CompleteCalc;
5.96 + val ((pt,p),_) = get_calc 1;
5.97 + (writeln o istates2str) (get_obj g_loc pt [ ]);
5.98 + (writeln o istates2str) (get_obj g_loc pt [1]);
5.99 + (writeln o istates2str) (get_obj g_loc pt [2]);
5.100 + (writeln o istates2str) (get_obj g_loc pt [3]);
5.101 + (writeln o istates2str) (get_obj g_loc pt [3,1]);
5.102 + (writeln o istates2str) (get_obj g_loc pt [3,2]);
5.103 + (writeln o istates2str) (get_obj g_loc pt [4]);
5.104 +
5.105 + *)
5.106 +"----------------------------------------------------------";
5.107 + val fod = make_deriv Isac.thy Atools_erls
5.108 + ((#rules o rep_rls) Test_simplify)
5.109 + (sqrt_right false (theory "Pure")) NONE
5.110 + (str2term "x + 1 + -1 * 2 = 0");
5.111 + (writeln o trtas2str) fod;
5.112 +
5.113 + val ifod = make_deriv Isac.thy Atools_erls
5.114 + ((#rules o rep_rls) Test_simplify)
5.115 + (sqrt_right false (theory "Pure")) NONE
5.116 + (str2term "-2 * 1 + (1 + x) = 0");
5.117 + (writeln o trtas2str) ifod;
5.118 + fun equal (_,_,(t1, _)) (_,_,(t2, _)) = t1=t2;
5.119 + val (fod', rifod') = dropwhile' equal (rev fod) (rev ifod);
5.120 + val der = fod' @ (map rev_deriv' rifod');
5.121 + (writeln o trtas2str) der;
5.122 + "----------------------------------------------------------";
5.123 +
5.124 +
5.125 +"--------- appendFormula: on Frm + equ_nrls ----------------------";
5.126 +"--------- appendFormula: on Frm + equ_nrls ----------------------";
5.127 +"--------- appendFormula: on Frm + equ_nrls ----------------------";
5.128 + states:=[];
5.129 + CalcTree [(["equality (x+1=2)", "solveFor x","solutions L"],
5.130 + ("Test.thy",
5.131 + ["sqroot-test","univariate","equation","test"],
5.132 + ["Test","squ-equ-test-subpbl1"]))];
5.133 + Iterator 1; moveActiveRoot 1;
5.134 + autoCalculate 1 CompleteCalcHead;
5.135 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*x + 1 = 2*);
5.136 +
5.137 + appendFormula 1 "2+ -1 + x = 2"; refFormula 1 (get_pos 1 1);
5.138 +
5.139 + moveDown 1 ([],Pbl); refFormula 1 ([1],Frm) (*x + 1 = 2*);
5.140 +
5.141 + moveDown 1 ([1 ],Frm); refFormula 1 ([1,1],Frm);
5.142 + moveDown 1 ([1,1],Frm); refFormula 1 ([1,1],Res);
5.143 + moveDown 1 ([1,1],Res); refFormula 1 ([1,2],Res);
5.144 + moveDown 1 ([1,2],Res); refFormula 1 ([1,3],Res);
5.145 + moveDown 1 ([1,3],Res); refFormula 1 ([1,4],Res);
5.146 + moveDown 1 ([1,4],Res); refFormula 1 ([1,5],Res);
5.147 + moveDown 1 ([1,5],Res); refFormula 1 ([1,6],Res);
5.148 + val ((pt,_),_) = get_calc 1;
5.149 + if "2 + -1 + x = 2" = term2str (fst (get_obj g_result pt [1,6])) then()
5.150 + else raise error "inform.sml: diff.behav.appendFormula: on Frm + equ 1";
5.151 +
5.152 + fetchProposedTactic 1; (*takes Iterator 1 _1_*)
5.153 + val (_,(tac,_,_)::_) = get_calc 1;
5.154 + if tac = Rewrite_Set "norm_equation" then ()
5.155 + else raise error "inform.sml: diff.behav.appendFormula: on Frm + equ 2";
5.156 + autoCalculate 1 CompleteCalc;
5.157 + val ((pt,_),_) = get_calc 1;
5.158 + if "[x = 1]" = term2str (fst (get_obj g_result pt [])) then ()
5.159 + else raise error "inform.sml: diff.behav.appendFormula: on Frm + equ 3";
5.160 +
5.161 +
5.162 +"--------- appendFormula: on Res + NO deriv ----------------------";
5.163 +"--------- appendFormula: on Res + NO deriv ----------------------";
5.164 +"--------- appendFormula: on Res + NO deriv ----------------------";
5.165 + states:=[];
5.166 + CalcTree [(["equality (x+1=2)", "solveFor x","solutions L"],
5.167 + ("Test.thy",
5.168 + ["sqroot-test","univariate","equation","test"],
5.169 + ["Test","squ-equ-test-subpbl1"]))];
5.170 + Iterator 1; moveActiveRoot 1;
5.171 + autoCalculate 1 CompleteCalcHead;
5.172 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
5.173 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
5.174 +
5.175 + appendFormula 1 "x = 2";
5.176 + val ((pt,p),_) = get_calc 1;
5.177 + val str = pr_ptree pr_short pt;
5.178 + writeln str;
5.179 + if str = ". ----- pblobj -----\n1. x + 1 = 2\n" andalso p = ([1], Res)
5.180 + then ()
5.181 + else raise error "inform.sml: diff.behav.appendFormula: Res + NOder 1";
5.182 +
5.183 + fetchProposedTactic 1;
5.184 + val (_,(tac,_,_)::_) = get_calc 1;
5.185 + if tac = Rewrite_Set "Test_simplify" then ()
5.186 + else raise error "inform.sml: diff.behav.appendFormula: Res + NOder 2";
5.187 + autoCalculate 1 CompleteCalc;
5.188 + val ((pt,_),_) = get_calc 1;
5.189 + if "[x = 1]" = term2str (fst (get_obj g_result pt [])) then ()
5.190 + else raise error "inform.sml: diff.behav.appendFormula: on Frm + equ 3";
5.191 +
5.192 +
5.193 +"--------- appendFormula: on Res + late deriv --------------------";
5.194 +"--------- appendFormula: on Res + late deriv --------------------";
5.195 +"--------- appendFormula: on Res + late deriv --------------------";
5.196 + states:=[];
5.197 + CalcTree [(["equality (x+1=2)", "solveFor x","solutions L"],
5.198 + ("Test.thy",
5.199 + ["sqroot-test","univariate","equation","test"],
5.200 + ["Test","squ-equ-test-subpbl1"]))];
5.201 + Iterator 1; moveActiveRoot 1;
5.202 + autoCalculate 1 CompleteCalcHead;
5.203 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
5.204 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
5.205 +
5.206 + appendFormula 1 "x = 1";
5.207 + val ((pt,p),_) = get_calc 1;
5.208 + val str = pr_ptree pr_short pt;
5.209 + writeln str;
5.210 + if str = ". ----- pblobj -----\n1. x + 1 = 2\n2. x + 1 + -1 * 2 = 0\n3. ----- pblobj -----\n3.1. -1 + x = 0\n3.2. x = 0 + -1 * -1\n3.2.1. x = 0 + -1 * -1\n3.2.2. x = 0 + 1\n" andalso p = ([3,2], Res)
5.211 + then () (*finds 1 step too early: ([3,2], Res) "x = 1" also by script !!!*)
5.212 + else raise error "inform.sml: diff.behav.appendFormula: Res + late d 1";
5.213 +
5.214 + fetchProposedTactic 1;
5.215 + val (_,(tac,_,_)::_) = get_calc 1;
5.216 + if tac = Check_Postcond ["linear", "univariate", "equation", "test"] then ()
5.217 + else raise error "inform.sml: diff.behav.appendFormula: Res + late d 2";
5.218 + autoCalculate 1 CompleteCalc;
5.219 + val ((pt,_),_) = get_calc 1;
5.220 + if "[x = 1]" = term2str (fst (get_obj g_result pt [])) then ()
5.221 + else raise error "inform.sml: diff.behav.appendFormula: Res + late d 3";
5.222 +
5.223 +
5.224 +"--------- appendFormula: on Res + late deriv [x = 3 + -2]---///--";
5.225 +"--------- appendFormula: on Res + late deriv [x = 3 + -2]---///--";
5.226 +"--------- appendFormula: on Res + late deriv [x = 3 + -2]---///--";
5.227 + states:=[];
5.228 + CalcTree [(["equality (x+1=2)", "solveFor x","solutions L"],
5.229 + ("Test.thy",
5.230 + ["sqroot-test","univariate","equation","test"],
5.231 + ["Test","squ-equ-test-subpbl1"]))];
5.232 + Iterator 1; moveActiveRoot 1;
5.233 + autoCalculate 1 CompleteCalcHead;
5.234 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
5.235 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
5.236 + appendFormula 1 "[x = 3 + -2*1]";
5.237 + val ((pt,p),_) = get_calc 1;
5.238 + val str = pr_ptree pr_short pt;
5.239 + writeln str;
5.240 + if str=". ----- pblobj -----\n1. x + 1 = 2\n2. x + 1 + -1 * 2 = 0\n3. ----- pblobj -----\n3.1. -1 + x = 0\n3.2. x = 0 + -1 * -1\n4. [x = 1]\n4.1. [x = 1]\n4.2. [x = -2 + 3]\n4.3. [x = 3 + -2]\n" then ()
5.241 + else raise error "inform.sml: diff.behav.appendFormula: Res + latEE 1";
5.242 + autoCalculate 1 CompleteCalc;
5.243 + val ((pt,p),_) = get_calc 1;
5.244 + if "[x = 3 + -2 * 1]" = term2str (fst (get_obj g_result pt [])) then ()
5.245 + (* ~~~~~~~~~~ simplify as last step in any script ?!*)
5.246 + else raise error "inform.sml: diff.behav.appendFormula: Res + latEE 2";
5.247 +
5.248 +
5.249 +
5.250 +"--------- replaceFormula: on Res + = ----------------------------";
5.251 +"--------- replaceFormula: on Res + = ----------------------------";
5.252 +"--------- replaceFormula: on Res + = ----------------------------";
5.253 + states:=[];
5.254 + CalcTree [(["equality (x+1=2)", "solveFor x","solutions L"],
5.255 + ("Test.thy",
5.256 + ["sqroot-test","univariate","equation","test"],
5.257 + ["Test","squ-equ-test-subpbl1"]))];
5.258 + Iterator 1; moveActiveRoot 1;
5.259 + autoCalculate 1 CompleteCalcHead;
5.260 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
5.261 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
5.262 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*-1 + x*);
5.263 +
5.264 + replaceFormula 1 "-2 * 1 + (1 + x) = 0"; refFormula 1 (get_pos 1 1);
5.265 + val ((pt,_),_) = get_calc 1;
5.266 + val str = pr_ptree pr_short pt;
5.267 + writeln str;
5.268 + if str=". ----- pblobj -----\n1. x + 1 = 2\n2. x + 1 + -1 * 2 = 0\n2.1. x + 1 + -1 * 2 = 0\n2.2. -1 * 2 + (x + 1) = 0\n2.3. -1 * 2 + (1 + x) = 0\n2.4. 1 + (-1 * 2 + x) = 0\n2.5. 1 + (-2 + x) = 0\n2.6. 1 + (-2 * 1 + x) = 0\n" then()
5.269 + else raise error "inform.sml: diff.behav.replaceFormula: on Res += 1";
5.270 + autoCalculate 1 CompleteCalc;
5.271 + val ((pt,pos as(p,_)),_) = get_calc 1;
5.272 + if pos=([],Res)andalso"[x = 1]"=(term2str o fst)(get_obj g_result pt p)then()
5.273 + else raise error "inform.sml: diff.behav.replaceFormula: on Res + = 2";
5.274 +
5.275 +
5.276 +"--------- replaceFormula: on Res + = 1st Nd ---------------------";
5.277 +"--------- replaceFormula: on Res + = 1st Nd ---------------------";
5.278 +"--------- replaceFormula: on Res + = 1st Nd ---------------------";
5.279 + states:=[];
5.280 + CalcTree [(["equality (x+1=2)", "solveFor x","solutions L"],
5.281 + ("Test.thy",
5.282 + ["sqroot-test","univariate","equation","test"],
5.283 + ["Test","squ-equ-test-subpbl1"]))];
5.284 + Iterator 1; moveActiveRoot 1;
5.285 + autoCalculate 1 CompleteCalcHead;
5.286 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
5.287 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
5.288 +
5.289 + replaceFormula 1 "x + 1 = 4 + -2"; refFormula 1 (get_pos 1 1);
5.290 + val ((pt,_),_) = get_calc 1;
5.291 + val str = pr_ptree pr_short pt;
5.292 + writeln str;
5.293 + if str=". ----- pblobj -----\n1. x + 1 = 2\n1.1. x + 1 = 2\n1.2. 1 + x = 2\n1.3. 1 + x = -2 + 4\n1.4. x + 1 = -2 + 4\n" then ()
5.294 + else raise error "inform.sml: diff.behav.replaceFormula: on Res 1 + = 1";
5.295 + autoCalculate 1 CompleteCalc;
5.296 + val ((pt,pos as(p,_)),_) = get_calc 1;
5.297 + if pos=([],Res)andalso"[x = 1]"=(term2str o fst)(get_obj g_result pt p)then()
5.298 + else raise error "inform.sml: diff.behav.replaceFormula: on Res + = 2";
5.299 +
5.300 +
5.301 +"--------- replaceFormula: on Frm + = 1st Nd ---------------------";
5.302 +"--------- replaceFormula: on Frm + = 1st Nd ---------------------";
5.303 +"--------- replaceFormula: on Frm + = 1st Nd ---------------------";
5.304 + states:=[];
5.305 + CalcTree [(["equality (x+1=2)", "solveFor x","solutions L"],
5.306 + ("Test.thy",
5.307 + ["sqroot-test","univariate","equation","test"],
5.308 + ["Test","squ-equ-test-subpbl1"]))];
5.309 + Iterator 1; moveActiveRoot 1;
5.310 + autoCalculate 1 CompleteCalcHead;
5.311 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
5.312 +
5.313 + replaceFormula 1 "x + 1 = 4 + -2"; refFormula 1 (get_pos 1 1);
5.314 + val ((pt,_),_) = get_calc 1;
5.315 + val str = pr_ptree pr_short pt;
5.316 + writeln str;
5.317 + if str=". ----- pblobj -----\n1. x + 1 = 2\n1.1. x + 1 = 2\n1.2. 1 + x = 2\n1.3. 1 + x = -2 + 4\n1.4. x + 1 = -2 + 4\n" then ()
5.318 + else raise error "inform.sml: diff.behav.replaceFormula: on Frm 1 + = 1";
5.319 + autoCalculate 1 CompleteCalc;
5.320 + val ((pt,pos as(p,_)),_) = get_calc 1;
5.321 + if pos=([],Res)andalso"[x = 1]"=(term2str o fst)(get_obj g_result pt p)then()
5.322 + else raise error "inform.sml: diff.behav.replaceFormula: on Frm 1 + = 2";
5.323 +
5.324 +
5.325 +"--------- replaceFormula: cut calculation -----------------------";
5.326 +"--------- replaceFormula: cut calculation -----------------------";
5.327 +"--------- replaceFormula: cut calculation -----------------------";
5.328 + states:=[];
5.329 + CalcTree [(["equality (x+1=2)", "solveFor x","solutions L"],
5.330 + ("Test.thy",
5.331 + ["sqroot-test","univariate","equation","test"],
5.332 + ["Test","squ-equ-test-subpbl1"]))];
5.333 + Iterator 1; moveActiveRoot 1;
5.334 + autoCalculate 1 CompleteCalc;
5.335 + moveActiveRoot 1; moveActiveDown 1;
5.336 + if get_pos 1 1 = ([1], Frm) then ()
5.337 + else raise error "inform.sml: diff.behav. cut calculation 1";
5.338 +
5.339 + replaceFormula 1 "x + 1 = 4 + -2"; refFormula 1 (get_pos 1 1);
5.340 + val ((pt,p),_) = get_calc 1;
5.341 + val str = pr_ptree pr_short pt;
5.342 + writeln str;
5.343 + if p = ([1], Res) then ()
5.344 + else raise error "inform.sml: diff.behav. cut calculation 2";
5.345 +
5.346 +
5.347 +
5.348 +(* 040307 copied from informtest.sml; ... old version
5.349 + "---------------- maximum-example, UC: Modeling / modifyCalcHead -";
5.350 + "---------------- maximum-example, UC: Modeling / modifyCalcHead -";
5.351 + "---------------- maximum-example, UC: Modeling / modifyCalcHead -";
5.352 +
5.353 + val p = ([],Pbl);
5.354 + val elems = ["fixedValues [r=Arbfix]","maximum A","valuesFor [a,b]",
5.355 + "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
5.356 + "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
5.357 + "relations [A=a*b, a/2=r*sin alpha, b/2=r*cos alpha]",
5.358 + (*^^^ these are the elements for the root-problem (in variants)*)
5.359 + (*vvv these are elements required for subproblems*)
5.360 + "boundVariable a","boundVariable b","boundVariable alpha",
5.361 + "interval {x::real. 0 <= x & x <= 2*r}",
5.362 + "interval {x::real. 0 <= x & x <= 2*r}",
5.363 + "interval {x::real. 0 <= x & x <= pi}",
5.364 + "errorBound (eps=(0::real))"]
5.365 + (*specifying is not interesting for this example*)
5.366 + val spec = ("DiffApp.thy", ["maximum_of","function"],
5.367 + ["DiffApp","max_by_calculus"]);
5.368 + (*the empty model with descriptions for user-guidance by Model_Problem*)
5.369 + val empty_model = [Given ["fixedValues []"],
5.370 + Find ["maximum", "valuesFor"],
5.371 + Relate ["relations []"]];
5.372 +
5.373 +
5.374 + (*!!!!!!!!!!!!!!!!! DON'T USE me FOR FINDING nxt !!!!!!!!!!!!!!!!!!*)
5.375 + val (p,_,f,nxt,_,pt) = CalcTreeTEST [(elems, spec)];
5.376 + (*val nxt = ("Model_Problem", ...*)
5.377 + val pbl = get_obj g_pbl pt (fst p); (writeln o (itms2str_ ctxt)) pbl;
5.378 +
5.379 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
5.380 + (*nxt = Add_Given "fixedValues [r = Arbfix]"*)
5.381 + val pbl = get_obj g_pbl pt (fst p); (writeln o (itms2str_ ctxt)) pbl;
5.382 +(*[
5.383 +(0 ,[] ,false ,#Given ,Inc fixedValues [] ,(??.empty, [])),
5.384 +(0 ,[] ,false ,#Find ,Inc maximum ,(??.empty, [])),
5.385 +(0 ,[] ,false ,#Find ,Inc valuesFor ,(??.empty, [])),
5.386 +(0 ,[] ,false ,#Relate ,Inc relations [] ,(??.empty, []))]*)
5.387 +
5.388 + (*the empty CalcHead is checked w.r.t the model and re-established as such*)
5.389 + val (b,pt,ocalhd) = input_icalhd pt (p,"", empty_model, Pbl, e_spec);
5.390 + val pbl = get_obj g_pbl pt (fst p); (writeln o (itms2str_ ctxt)) pbl;
5.391 + if ocalhd2str ocalhd = "(Pbl, ??.empty, [\n(0 ,[] ,false ,#Given ,Inc fixedValues [] ,(??.empty, [])),\n(0 ,[] ,false ,#Find ,Inc maximum ,(??.empty, [])),\n(0 ,[] ,false ,#Find ,Inc valuesFor ,(??.empty, [])),\n(0 ,[] ,false ,#Relate ,Inc relations [] ,(??.empty, []))], [], \n(\"e_domID\", [\"e_pblID\"], [\"e_metID\"]) )" then () else raise error "informtest.sml: diff.behav. max 1";
5.392 +
5.393 + (*there is one input to the model (could be more)*)
5.394 + val (b,pt,ocalhd) =
5.395 + input_icalhd pt (p,"", [Given ["fixedValues [r=Arbfix]"],
5.396 + Find ["maximum", "valuesFor"],
5.397 + Relate ["relations"]], Pbl, e_spec);
5.398 + val pbl = get_obj g_pbl pt (fst p); (writeln o (itms2str_ ctxt)) pbl;
5.399 + if ocalhd2str ocalhd = "(Pbl, ??.empty, [\n(1 ,[1,2,3] ,true ,#Given ,Cor fixedValues [r = Arbfix] ,(fix_, [[r = Arbfix]])),\n(0 ,[] ,false ,#Find ,Inc maximum ,(??.empty, [])),\n(0 ,[] ,false ,#Find ,Inc valuesFor ,(??.empty, [])),\n(0 ,[] ,false ,#Relate ,Inc relations [] ,(??.empty, []))], [], \n(\"e_domID\", [\"e_pblID\"], [\"e_metID\"]) )" then ()
5.400 + else raise error "informtest.sml: diff.behav. max 2";
5.401 +
5.402 + (*this input is complete in variant 3, but the ME doesn't recognize FIXXXXME
5.403 + val (b,pt''''',ocalhd) =
5.404 + input_icalhd pt (p,"", [Given ["fixedValues [r=Arbfix]"],
5.405 + Find ["maximum A", "valuesFor [a,b]"],
5.406 + Relate ["relations [A=a*b, a/2=r*sin alpha, \
5.407 + \b/2=r*cos alpha]"]], Pbl, e_spec);
5.408 + val pbl = get_obj g_pbl pt''''' (fst p); (writeln o (itms2str_ ctxt)) pbl;
5.409 + if ocalhd2str ocalhd = ------------^^^^^^^^^^ missing !!!*)
5.410 +
5.411 + (*this input is complete in variant 1 (variant 3 does not work yet)*)
5.412 + val (b,pt''''',ocalhd) =
5.413 + input_icalhd pt (p,"", [Given ["fixedValues [r=Arbfix]"],
5.414 + Find ["maximum A", "valuesFor [a,b]"],
5.415 + Relate ["relations [A=a*b, \
5.416 + \(a/2)^^^2 + (b/2)^^^2 = r^^^2]"]],
5.417 + Pbl, e_spec);
5.418 + val pbl = get_obj g_pbl pt''''' (fst p); (writeln o (itms2str_ ctxt)) pbl;
5.419 +
5.420 + modifycalcheadOK2xml 111 (bool2str b) ocalhd;
5.421 +*)
5.422 +
5.423 +"--------- syntax error ------------------------------------------";
5.424 +"--------- syntax error ------------------------------------------";
5.425 +"--------- syntax error ------------------------------------------";
5.426 + states:=[];
5.427 + CalcTree [(["equality (x+1=2)", "solveFor x","solutions L"],
5.428 + ("Test.thy",
5.429 + ["sqroot-test","univariate","equation","test"],
5.430 + ["Test","squ-equ-test-subpbl1"]))];
5.431 + Iterator 1; moveActiveRoot 1;
5.432 + autoCalculate 1 CompleteCalcHead;
5.433 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
5.434 + autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
5.435 +
5.436 + appendFormula 1 " x - "; (*<ERROR> syntax error in ' x - ' </ERROR>*)
5.437 + val ((pt,_),_) = get_calc 1;
5.438 + val str = pr_ptree pr_short pt;
5.439 + writeln str;
5.440 + if str = ". ----- pblobj -----\n1. x + 1 = 2\n" then ()
5.441 + else raise error "inform.sml: diff.behav.appendFormula: syntax error";
5.442 +
5.443 +
5.444 +"--------- CAS-command on ([],Pbl) -------------------------------";
5.445 +"--------- CAS-command on ([],Pbl) -------------------------------";
5.446 +"--------- CAS-command on ([],Pbl) -------------------------------";
5.447 +val (p,_,f,nxt,_,pt) =
5.448 + CalcTreeTEST [([], ("e_domID", ["e_pblID"], ["e_metID"]))];
5.449 +val ifo = "solve(x+1=2,x)";
5.450 +val (_,(_,c,(pt,p))) = inform ([],[],(pt,p)) "solve(x+1=2,x)";
5.451 +show_pt pt;
5.452 +val nxt = ("Apply_Method",Apply_Method ["Test","squ-equ-test-subpbl1"]);
5.453 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
5.454 +if p = ([1], Frm) andalso f2str f = "x + 1 = 2" then ()
5.455 +else raise error "inform.sml: diff.behav. CAScmd ([],Pbl)";
5.456 +
5.457 +
5.458 +"--------- CAS-command on ([],Pbl) FE-interface ------------------";
5.459 +"--------- CAS-command on ([],Pbl) FE-interface ------------------";
5.460 +"--------- CAS-command on ([],Pbl) FE-interface ------------------";
5.461 +states:=[];
5.462 +CalcTree [([], ("e_domID", ["e_pblID"], ["e_metID"]))];
5.463 +Iterator 1;
5.464 +moveActiveRoot 1;
5.465 +replaceFormula 1 "solve(x+1=2,x)";
5.466 +autoCalculate 1 CompleteCalc;
5.467 +val ((pt,p),_) = get_calc 1;
5.468 +show_pt pt;
5.469 +if p = ([], Res) then ()
5.470 +else raise error "inform.sml: diff.behav. CAScmd ([],Pbl) FE-interface";
5.471 +
5.472 +
5.473 +"--------- inform [rational,simplification] ----------------------";
5.474 +"--------- inform [rational,simplification] ----------------------";
5.475 +"--------- inform [rational,simplification] ----------------------";
5.476 +states:=[];
5.477 +CalcTree [(["term (4/x - 3/y - 1)", "normalform N"],
5.478 + ("Rational.thy",["rational","simplification"],
5.479 + ["simplification","of_rationals"]))];
5.480 +Iterator 1; moveActiveRoot 1;
5.481 +autoCalculate 1 CompleteCalcHead;
5.482 +autoCalculate 1 (Step 1);
5.483 +autoCalculate 1 (Step 1);
5.484 +autoCalculate 1 (Step 1);
5.485 +autoCalculate 1 (Step 1);
5.486 +"--- input the next formula that _should_ be presented by mat-engine";
5.487 +appendFormula 1 "(4 * y + -3 * x) / (x * y) + -1";
5.488 +val ((pt,p),_) = get_calc 1;
5.489 +if p = ([4], Res) andalso (length o children o (get_nd pt)) (fst p) = 2 then ()
5.490 +else raise error ("inform.sml: [rational,simplification] 1");
5.491 +
5.492 +"--- input the next formula that would be presented by mat-engine";
5.493 +(*autoCalculate 1 (Step 1);*)
5.494 +appendFormula 1 "(4 * y + -3 * x + -1 * (x * y)) / (x * y)";
5.495 +val ((pt,p),_) = get_calc 1;
5.496 +if p = ([5], Res) andalso (length o children o (get_nd pt)) (fst p) = 0 then ()
5.497 +else raise error ("inform.sml: [rational,simplification] 2");
5.498 +
5.499 +"--- input the exact final result";(*TODO: Exception- LIST "last_elem" raised*)
5.500 +appendFormula 1 "(-3 * x + 4 * y + -1 * x * y) / (x * y)";
5.501 +val ((pt,p),_) = get_calc 1;
5.502 +if p = ([6], Res) andalso (length o children o (get_nd pt)) (fst p) = 2 then ()
5.503 +else raise error ("inform.sml: [rational,simplification] 3");
5.504 +show_pt pt;
5.505 +
5.506 +"--------- Take as 1st tac, start with <NEW> (CAS input) ---------";
5.507 +"--------- Take as 1st tac, start with <NEW> (CAS input) ---------";
5.508 +"--------- Take as 1st tac, start with <NEW> (CAS input) ---------";
5.509 +val t = str2term "Diff (x^^^2 + x + 1, x)";
5.510 +case t of Const ("Diff.Diff", _) $ _ => ()
5.511 + | _ => raise
5.512 + error "diff.sml behav.changed for CAS Diff (..., x)";
5.513 +atomty t;
5.514 +"-----------------------------------------------------------------";
5.515 +(*1>*)states:=[];
5.516 +(*2>*)CalcTree [([], ("e_domID", ["e_pblID"], ["e_metID"]))];
5.517 +(*3>*)Iterator 1;moveActiveRoot 1;
5.518 +"----- here the Headline has been finished";
5.519 +(*4>*)moveActiveFormula 1 ([],Pbl);
5.520 +(*5>*)replaceFormula 1 "Diff (x^2 + x + 1, x)";
5.521 +val ((pt,_),_) = get_calc 1;
5.522 +val PblObj {probl, meth, spec, fmz, env, loc, ...} = get_obj I pt [];
5.523 +val NONE = env;
5.524 +val (SOME istate, NONE) = loc;
5.525 +print_depth 5;
5.526 +writeln"-----------------------------------------------------------";
5.527 +spec;
5.528 +writeln (itms2str_ ctxt probl);
5.529 +writeln (itms2str_ ctxt meth);
5.530 +writeln (istate2str istate);
5.531 +
5.532 +print_depth 3;
5.533 +
5.534 +refFormula 1 ([],Pbl) (*--> correct CalcHead*);
5.535 + (*081016 NOT necessary (but leave it in Java):*)
5.536 +(*6>*)(*completeCalcHead*)autoCalculate 1 CompleteCalcHead;
5.537 +"----- here the CalcHead has been completed --- ONCE MORE ?????";
5.538 +
5.539 +(***difference II***)
5.540 +val ((pt,p),_) = get_calc 1;
5.541 +(*val p = ([], Pbl)*)
5.542 +val PblObj {probl, meth, spec, fmz, env, loc, ...} = get_obj I pt [];
5.543 +val NONE = env;
5.544 +val (SOME istate, NONE) = loc;
5.545 +print_depth 5; writeln (istate2str istate); print_depth 3;
5.546 +(*ScrState ([],
5.547 + [], NONE,
5.548 + ??.empty, Sundef, false)*)
5.549 +print_depth 5; spec; print_depth 3;
5.550 +(*("Isac.thy",
5.551 + ["derivative_of", "function"],
5.552 + ["diff", "differentiate_on_R"]) : spec*)
5.553 +writeln (itms2str_ ctxt probl);
5.554 +(*[
5.555 +(1 ,[1] ,true ,#Given ,Cor functionTerm (x ^^^ 2 + x + 1) ,(f_, [x ^^^ 2 + x + 1])),
5.556 +(2 ,[1] ,true ,#Given ,Cor differentiateFor x ,(v_, [x])),
5.557 +(3 ,[1] ,true ,#Find ,Cor derivative f_'_ ,(f_'_, [f_'_]))]*)
5.558 +writeln (itms2str_ ctxt meth);
5.559 +(*[
5.560 +(1 ,[1] ,true ,#Given ,Cor functionTerm (x ^^^ 2 + x + 1) ,(f_, [x ^^^ 2 + x + 1])),
5.561 +(2 ,[1] ,true ,#Given ,Cor differentiateFor x ,(v_, [x])),
5.562 +(3 ,[1] ,true ,#Find ,Cor derivative f_'_ ,(f_'_, [f_'_]))]*)
5.563 +writeln"-----------------------------------------------------------";
5.564 +(*7>*)fetchProposedTactic 1 (*--> Apply_Method*);
5.565 +(*WN081028 fixed <ERROR> helpless </ERROR> by inform returning ...(.,Met)*)
5.566 +autoCalculate 1 CompleteCalc;
5.567 +val ((pt,p),_) = get_calc 1;
5.568 +val Form res = (#1 o pt_extract) (pt, ([],Res));
5.569 +show_pt pt;
5.570 +if p = ([], Res) andalso term2str res = "1 + 2 * x" then ()
5.571 +else raise error "diff.sml behav.changed for Diff (x^2 + x + 1, x)";
5.572 +
5.573 +
5.574 +"--------- Take as 1st tac, start from exp -----------------------";
5.575 +"--------- Take as 1st tac, start from exp -----------------------";
5.576 +"--------- Take as 1st tac, start from exp -----------------------";
5.577 +(*the following input is copied from BridgeLog Java <==> SML,
5.578 + omitting unnecessary inputs*)
5.579 +(*1>*)states:=[];
5.580 +(*2>*)CalcTree [(["functionTerm (x^2 + x + 1)", "differentiateFor x", "derivative f_'_"],("Isac.thy",["derivative_of","function"],["diff","differentiate_on_R"]))];
5.581 +(*3>*)Iterator 1; moveActiveRoot 1;
5.582 +
5.583 +(*6>*)(*completeCalcHead*)autoCalculate 1 CompleteCalcHead;
5.584 +
5.585 +(***difference II***)
5.586 +val ((pt,_),_) = get_calc 1;
5.587 +val PblObj {probl, meth, spec, fmz, env, loc, ...} = get_obj I pt [];
5.588 +val NONE = env;
5.589 +val (SOME istate, NONE) = loc;
5.590 +print_depth 5; writeln (istate2str istate); print_depth 3;
5.591 +(*ScrState ([],
5.592 + [], NONE,
5.593 + ??.empty, Sundef, false)*)
5.594 +print_depth 5; spec; print_depth 3;
5.595 +(*("Isac.thy",
5.596 + ["derivative_of", "function"],
5.597 + ["diff", "differentiate_on_R"]) : spec*)
5.598 +writeln (itms2str_ ctxt probl);
5.599 +(*[
5.600 +(1 ,[1] ,true ,#Given ,Cor functionTerm (x ^^^ 2 + x + 1) ,(f_, [x ^^^ 2 + x + 1])),
5.601 +(2 ,[1] ,true ,#Given ,Cor differentiateFor x ,(v_, [x])),
5.602 +(3 ,[1] ,true ,#Find ,Cor derivative f_'_ ,(f_'_, [f_'_]))]*)
5.603 +writeln (itms2str_ ctxt meth);
5.604 +(*[
5.605 +(1 ,[1] ,true ,#Given ,Cor functionTerm (x ^^^ 2 + x + 1) ,(f_, [x ^^^ 2 + x + 1])),
5.606 +(2 ,[1] ,true ,#Given ,Cor differentiateFor x ,(v_, [x])),
5.607 +(3 ,[1] ,true ,#Find ,Cor derivative f_'_ ,(f_'_, [f_'_]))]*)
5.608 +writeln"-----------------------------------------------------------";
5.609 +(*7>*)fetchProposedTactic 1 (*--> Apply_Method*);
5.610 +
5.611 +autoCalculate 1 (Step 1);
5.612 +val ((pt,p),_) = get_calc 1;
5.613 +val Form res = (#1 o pt_extract) (pt, p);
5.614 +if term2str res = "d_d x (x ^^^ 2 + x + 1)" then ()
5.615 +else raise error "diff.sml Diff (x^2 + x + 1, x) from exp";
5.616 +
5.617 +
5.618 +"--------- init_form, start with <NEW> (CAS input) ---------------";
5.619 +"--------- init_form, start with <NEW> (CAS input) ---------------";
5.620 +"--------- init_form, start with <NEW> (CAS input) ---------------";
5.621 +states:=[];
5.622 +CalcTree [([], ("e_domID", ["e_pblID"], ["e_metID"]))];
5.623 +(*[[from sml: > @@@@@begin@@@@@
5.624 +[[from sml: 1
5.625 +[[from sml: <CALCTREE>
5.626 +[[from sml: <CALCID> 1 </CALCID>
5.627 +[[from sml: </CALCTREE>
5.628 +[[from sml: @@@@@end@@@@@*)
5.629 +Iterator 1;
5.630 +(*[[from sml: > @@@@@begin@@@@@
5.631 +[[from sml: 1
5.632 +[[from sml: <ADDUSER>
5.633 +[[from sml: <CALCID> 1 </CALCID>
5.634 +[[from sml: <USERID> 1 </USERID>
5.635 +[[from sml: </ADDUSER>
5.636 +[[from sml: @@@@@end@@@@@*)
5.637 +moveActiveRoot 1;
5.638 +(*[[from sml: > @@@@@begin@@@@@
5.639 +[[from sml: 1
5.640 +[[from sml: <CALCITERATOR>
5.641 +[[from sml: <CALCID> 1 </CALCID>
5.642 +[[from sml: <POSITION>
5.643 +[[from sml: <INTLIST>
5.644 +[[from sml: </INTLIST>
5.645 +[[from sml: <POS> Pbl </POS>
5.646 +[[from sml: </POSITION>
5.647 +[[from sml: </CALCITERATOR>
5.648 +[[from sml: @@@@@end@@@@@*)
5.649 +getFormulaeFromTo 1 ([],Pbl) ([],Pbl) 0 false;
5.650 +(*[[from sml: > @@@@@begin@@@@@ STILL CORRECT
5.651 +[[from sml: 1
5.652 +[[from sml: <GETELEMENTSFROMTO>
5.653 +[[from sml: <CALCID> 1 </CALCID>
5.654 +[[from sml: <FORMHEADS>
5.655 +[[from sml: <CALCFORMULA>
5.656 +[[from sml: <POSITION>
5.657 +[[from sml: <INTLIST>
5.658 +[[from sml: </INTLIST>
5.659 +[[from sml: <POS> Pbl </POS>
5.660 +[[from sml: </POSITION>
5.661 +[[from sml: <FORMULA>
5.662 +[[from sml: <MATHML>
5.663 +[[from sml: <ISA> ________________________________________________ </ISA>
5.664 +[[from sml: </MATHML>
5.665 +[[from sml:
5.666 +[[from sml: </FORMULA>
5.667 +[[from sml: </CALCFORMULA>
5.668 +[[from sml: </FORMHEADS>
5.669 +[[from sml: </GETELEMENTSFROMTO>
5.670 +[[from sml: @@@@@end@@@@@*)
5.671 +refFormula 1 ([],Pbl);
5.672 +(*[[from sml: > @@@@@begin@@@@@ STILL CORRECT
5.673 +[[from sml: 1
5.674 +[[from sml: <REFFORMULA>
5.675 +[[from sml: <CALCID> 1 </CALCID>
5.676 +[[from sml: <CALCHEAD status = "incorrect">
5.677 +[[from sml: <POSITION>
5.678 +[[from sml: <INTLIST>
5.679 +[[from sml: </INTLIST>
5.680 +[[from sml: <POS> Pbl </POS>
5.681 +[[from sml: </POSITION>
5.682 +[[from sml: <HEAD>
5.683 +[[from sml: <MATHML>
5.684 +[[from sml: <ISA> Problem (e_domID, [e_pblID]) </ISA>
5.685 +[[from sml: </MATHML>
5.686 +[[from sml: </HEAD>
5.687 +[[from sml: <MODEL>
5.688 +[[from sml: <GIVEN> </GIVEN>
5.689 +[[from sml: <WHERE> </WHERE>
5.690 +[[from sml: <FIND> </FIND>
5.691 +[[from sml: <RELATE> </RELATE>
5.692 +[[from sml: </MODEL>
5.693 +[[from sml: <BELONGSTO> Pbl </BELONGSTO>
5.694 +[[from sml: <SPECIFICATION>
5.695 +[[from sml: <THEORYID> e_domID </THEORYID>
5.696 +[[from sml: <PROBLEMID>
5.697 +[[from sml: <STRINGLIST>
5.698 +[[from sml: <STRING> e_pblID </STRING>
5.699 +[[from sml: </STRINGLIST>
5.700 +[[from sml: </PROBLEMID>
5.701 +[[from sml: <METHODID>
5.702 +[[from sml: <STRINGLIST>
5.703 +[[from sml: <STRING> e_metID </STRING>
5.704 +[[from sml: </STRINGLIST>
5.705 +[[from sml: </METHODID>
5.706 +[[from sml: </SPECIFICATION>
5.707 +[[from sml: </CALCHEAD>
5.708 +[[from sml: </REFFORMULA>
5.709 +[[from sml: @@@@@end@@@@@*)
5.710 +moveActiveFormula 1 ([],Pbl);
5.711 +(*[[from sml: > @@@@@begin@@@@@
5.712 +[[from sml: 1
5.713 +[[from sml: <CALCITERATOR>
5.714 +[[from sml: <CALCID> 1 </CALCID>
5.715 +[[from sml: <POSITION>
5.716 +[[from sml: <INTLIST>
5.717 +[[from sml: </INTLIST>
5.718 +[[from sml: <POS> Pbl </POS>
5.719 +[[from sml: </POSITION>
5.720 +[[from sml: </CALCITERATOR>
5.721 +[[from sml: @@@@@end@@@@@*)
5.722 +replaceFormula 1 "Simplify (1+2)";
5.723 +(*[[from sml: > @@@@@begin@@@@@
5.724 +[[from sml: 1
5.725 +[[from sml: <REPLACEFORMULA>
5.726 +[[from sml: <CALCID> 1 </CALCID>
5.727 +[[from sml: <CALCCHANGED>
5.728 +[[from sml: <UNCHANGED>
5.729 +[[from sml: <INTLIST>
5.730 +[[from sml: </INTLIST>
5.731 +[[from sml: <POS> Pbl </POS>
5.732 +[[from sml: </UNCHANGED>
5.733 +[[from sml: <DELETED>
5.734 +[[from sml: <INTLIST>
5.735 +[[from sml: </INTLIST>
5.736 +[[from sml: <POS> Pbl </POS>
5.737 +[[from sml: </DELETED>
5.738 +[[from sml: <GENERATED>
5.739 +[[from sml: <INTLIST>
5.740 +[[from sml: </INTLIST>
5.741 +[[from sml: <POS> Met </POS> DIFFERENCE: Pbl
5.742 +[[from sml: </GENERATED>
5.743 +[[from sml: </CALCCHANGED>
5.744 +[[from sml: </REPLACEFORMULA>
5.745 +[[from sml: @@@@@end@@@@@*)
5.746 +getFormulaeFromTo 1 ([],Pbl) ([],Pbl) 0 false(* DIFFERENCE: Pbl*);
5.747 +(*@@@@@begin@@@@@
5.748 + 1
5.749 +<GETELEMENTSFROMTO>
5.750 + <CALCID> 1 </CALCID>
5.751 + <FORMHEADS>
5.752 + <CALCFORMULA>
5.753 + <POSITION>
5.754 + <INTLIST>
5.755 + </INTLIST>
5.756 + <POS> Pbl </POS>
5.757 + </POSITION>
5.758 + <FORMULA>
5.759 + <MATHML>
5.760 + <ISA> Simplify (1 + 2) </ISA> WORKS !!!!!
5.761 + </MATHML>
5.762 + </FORMULA>
5.763 + </CALCFORMULA>
5.764 + </FORMHEADS>
5.765 +</GETELEMENTSFROMTO>
5.766 +@@@@@end@@@@@*)
5.767 +getFormulaeFromTo 1 ([],Pbl) ([],Met) 0 false;
5.768 +(*[[from sml: > @@@@@begin@@@@@
5.769 +[[from sml: 1
5.770 +[[from sml: <SYSERROR>
5.771 +[[from sml: <CALCID> 1 </CALCID>
5.772 +[[from sml: <ERROR> error in getFormulaeFromTo </ERROR>
5.773 +[[from sml: </SYSERROR>
5.774 +[[from sml: @@@@@end@@@@@*)
5.775 +(*step into getFormulaeFromTo --- bug corrected...*)
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/test/Tools/isac/Interpret/mathengine.sml Mon Aug 30 14:35:51 2010 +0200
6.3 @@ -0,0 +1,69 @@
6.4 +(* test for sml/ME/mathengine.sml
6.5 + authors: Walther Neuper 2000, 2006
6.6 + (c) due to copyright terms
6.7 +
6.8 +use"../smltest/ME/mathengine.sml";
6.9 +use"mathengine.sml";
6.10 +*)
6.11 +
6.12 +"-----------------------------------------------------------------";
6.13 +"table of contents -----------------------------------------------";
6.14 +"-----------------------------------------------------------------";
6.15 +"----------- debugging setContext..pbl_ --------------------------";
6.16 +"----------- tryrefine -------------------------------------------";
6.17 +"-----------------------------------------------------------------";
6.18 +"-----------------------------------------------------------------";
6.19 +"-----------------------------------------------------------------";
6.20 +
6.21 +
6.22 +
6.23 +"----------- debugging setContext..pbl_ --------------------------";
6.24 +"----------- debugging setContext..pbl_ --------------------------";
6.25 +"----------- debugging setContext..pbl_ --------------------------";
6.26 +states:=[];
6.27 +CalcTree
6.28 +[(["equality (x+1=2)", "solveFor x","solutions L"],
6.29 + ("Test.thy",
6.30 + ["sqroot-test","univariate","equation","test"],
6.31 + ["Test","squ-equ-test-subpbl1"]))];
6.32 +Iterator 1;
6.33 +moveActiveRoot 1; modelProblem 1;
6.34 +
6.35 +val pos as (p,_) = ([],Pbl);
6.36 +val guh = "pbl_equ_univ";
6.37 +checkContext 1 pos guh;
6.38 +val ((pt,_),_) = get_calc 1;
6.39 +val pp = par_pblobj pt p;
6.40 +val keID = guh2kestoreID guh;
6.41 +case context_pbl keID pt pp of (true,["univariate", "equation"],_,_,_)=>()
6.42 +| _ => raise error "mathengine.sml: context_pbl .. pbl_equ_univ checked";
6.43 +
6.44 +case get_obj g_spec pt p of (_, ["e_pblID"], _) => ()
6.45 +| _ => raise error "mathengine.sml: context_pbl .. pbl still empty";
6.46 +setContext 1 pos guh;
6.47 +val ((pt,_),_) = get_calc 1;
6.48 +case get_obj g_spec pt p of (_, ["univariate", "equation"], _) => ()
6.49 +| _ => raise error "mathengine.sml: context_pbl .. pbl set";
6.50 +
6.51 +
6.52 +setContext 1 pos "met_eq_lin";
6.53 +val ((pt,_),_) = get_calc 1;
6.54 +case get_obj g_spec pt p of (_, _, ["LinEq", "solve_lineq_equation"]) => ()
6.55 +| _ => raise error "mathengine.sml: context_pbl .. pbl set";
6.56 +
6.57 +
6.58 +"----------- tryrefine -------------------------------------------";
6.59 +"----------- tryrefine -------------------------------------------";
6.60 +"----------- tryrefine -------------------------------------------";
6.61 +states:=[];
6.62 +CalcTree [(["equality (x/(x^2 - 6*x+9) - 1/(x^2 - 3*x) =1/x)",
6.63 + "solveFor x", "solutions L"],
6.64 + ("RatEq.thy",["univariate","equation"],["no_met"]))];
6.65 +Iterator 1;
6.66 +moveActiveRoot 1; autoCalculate 1 CompleteCalc;
6.67 +
6.68 +refineProblem 1 ([1],Res) "pbl_equ_univ"
6.69 +(*gives "pbl_equ_univ_rat" correct*);
6.70 +
6.71 +refineProblem 1 ([1],Res) (pblID2guh ["linear","univariate","equation"])
6.72 +(*ives "pbl_equ_univ_lin" incorrect*);
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/test/Tools/isac/Interpret/me.sml Mon Aug 30 14:35:51 2010 +0200
7.3 @@ -0,0 +1,528 @@
7.4 +(* tests on me.sml
7.5 + author: Walther Neuper
7.6 + 060225,
7.7 + (c) due to copyright terms
7.8 +
7.9 +use"../smltest/ME/me.sml";
7.10 +use"me.sml";
7.11 +*)
7.12 +
7.13 +"-----------------------------------------------------------------";
7.14 +"table of contents -----------------------------------------------";
7.15 +"-----------------------------------------------------------------";
7.16 +"=====new ptree 1: crippled by cut_level_'_ ======================";
7.17 +"-------------- get_interval from ctree with move_dn:modspec.sml -";
7.18 +"=====new ptree 2 without changes ================================";
7.19 +"-------------- getFormulaeFromTo --------------------------------";
7.20 +"autoCalculate";
7.21 +"--------- solve_linear as rootpbl AUTOCALCULATE CompleteModel ---";
7.22 +"--------- solve_linear as rootpbl AUTOCALCULATE CompleteCalcHead-";
7.23 +"--------- maximum-example: complete_metitms ---------------------";
7.24 +"--------- maximum-example: complete_mod -------------------------";
7.25 +"-----------------------------------------------------------------";
7.26 +"-----------------------------------------------------------------";
7.27 +"-----------------------------------------------------------------";
7.28 +
7.29 +
7.30 +
7.31 +"=====new ptree 1: crippled by cut_level_'_ ======================";
7.32 +"=====new ptree 1: crippled by cut_level_'_ ======================";
7.33 +"=====new ptree 1: crippled by cut_level_'_ ======================";
7.34 +states:=[];
7.35 +CalcTree
7.36 +[(["equality (x/(x^2 - 6*x+9) - 1/(x^2 - 3*x) =1/x)",
7.37 + "solveFor x","solutions L"],
7.38 + ("RatEq.thy",["univariate","equation"],["no_met"]))];
7.39 +Iterator 1; moveActiveRoot 1;
7.40 +autoCalculate 1 CompleteCalc;
7.41 +
7.42 +getTactic 1 ([1],Res);(*Rewrite_Set RatEq_simplify*)
7.43 +getTactic 1 ([2],Res);(*Rewrite_Set norm_Rational*)
7.44 +getTactic 1 ([3],Res);(*Rewrite_Set RatEq_eliminate*)
7.45 +getTactic 1 ([4,1],Res);(*Rewrite all_left*)
7.46 +getTactic 1 ([4,2],Res);(*Rewrite_Set expand_binoms*)
7.47 +getTactic 1 ([4,3],Res);(*Rewrite_Set_Inst make_ratpoly_in*)
7.48 +
7.49 +moveActiveFormula 1 ([1],Res)(*1.1...1.4*);
7.50 +moveActiveFormula 1 ([2],Res)(**ME_Isa: 'expand' not known*);
7.51 +moveActiveFormula 1 ([3],Res)(*3.1.*);
7.52 +moveActiveFormula 1 ([4,2],Res)(*4.2.1.*);
7.53 +moveActiveFormula 1 ([4,3],Res)(**one_scr_arg: called by Script Stepwise t_=*);
7.54 +
7.55 +moveActiveFormula 1 ([1],Res)(*1.1...1.4*);
7.56 +interSteps 1 ([1],Res)(*..is activeFormula !?!*);
7.57 +
7.58 +getTactic 1 ([1,1],Res);(*Rewrite real_diff_minus*)
7.59 +getTactic 1 ([1,2],Res);(*Rewrite real_diff_minus*)
7.60 +getTactic 1 ([1,3],Res);(*Rewrite real_diff_minus*)
7.61 +getTactic 1 ([1,4],Res);(*Rewrite real_rat_mult_1*)
7.62 +
7.63 +moveActiveFormula 1 ([4,2],Res)(*4.2.1.*);
7.64 +interSteps 1 ([4,2],Res)(*..is activeFormula !?!*);
7.65 +val ((pt,_),_) = get_calc 1;
7.66 +writeln(pr_ptree pr_short pt);
7.67 +(*delete [4,1] in order to make pos [4],[4,4] for pblobjs differen [4],[4,3]:
7.68 + ###########################################################################*)
7.69 +val (pt, _) = cut_level_'_ [] [] pt ([4,1],Frm); (*#*)
7.70 +(*##########################################################################*)
7.71 +writeln(pr_ptree pr_short pt);
7.72 +(*##########################################################################
7.73 + attention: the ctree in states is still the old (perfect) !!!
7.74 +############################################################################*)
7.75 +
7.76 +
7.77 +
7.78 +"-------------- get_interval from ctree with move_dn:modspec.sml -";
7.79 +"-------------- get_interval from ctree with move_dn:modspec.sml -";
7.80 +"-------------- get_interval from ctree with move_dn:modspec.sml -";
7.81 +writeln(pr_ptree pr_short pt);
7.82 +writeln(posterms2str (get_interval ([],Frm) ([],Res) 99999 pt));
7.83 +
7.84 +case map fst (get_interval ([],Frm) ([],Res) 99999 pt) of
7.85 + [([], Frm),
7.86 + ([1], Frm),
7.87 + ([1, 1], Frm),
7.88 + ([1, 1], Res),
7.89 + ([1, 2], Res),
7.90 + ([1, 3], Res),
7.91 + ([1, 4], Res),
7.92 + ([1], Res),
7.93 + ([2], Res),
7.94 + ([3], Res),
7.95 + ([4], Pbl),
7.96 + ([4, 1], Frm),
7.97 + ([4, 1, 1], Frm),
7.98 + ([4, 1, 1], Res),
7.99 + ([4, 1], Res),
7.100 + ([4, 2], Res),
7.101 + ([4, 3], Pbl),
7.102 + ([4, 3, 1], Frm),
7.103 + ([4, 3, 1], Res),
7.104 + ([4, 3, 2], Res),
7.105 + ([4, 3, 3], Res),
7.106 + ([4, 3, 4], Res),
7.107 + ([4, 3, 5], Res),
7.108 + ([4, 3], Res),
7.109 + ([4], Res),
7.110 + ([5], Res),
7.111 + ([], Res)] => ()
7.112 + | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1f";
7.113 +case map fst (get_interval ([],Frm) ([],Res) 1 pt) of
7.114 + [([], Frm),
7.115 + ([1], Frm),
7.116 + ([1], Res),
7.117 + ([2], Res),
7.118 + ([3], Res),
7.119 + ([4], Pbl),
7.120 + ([4], Res),
7.121 + ([5], Res),
7.122 + ([], Res)] => ()
7.123 + | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1f";
7.124 +case map fst (get_interval ([],Frm) ([],Res) 0 pt) of
7.125 + [([], Frm),
7.126 + ([], Res)] => ()
7.127 + | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1f";
7.128 +
7.129 +case map fst (get_interval ([1,3],Res) ([4,1,1],Frm) 99999 pt) of
7.130 + [([1, 3], Res),
7.131 + ([1, 4], Res),
7.132 + ([1], Res),
7.133 + ([2], Res),
7.134 + ([3], Res),
7.135 + ([4], Pbl),
7.136 + ([4, 1], Frm),
7.137 + ([4, 1, 1], Frm)] => ()
7.138 + | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1a";
7.139 +
7.140 +(*this pos' is not generated bu move_dn:......vvv: goes to end of calc*)
7.141 +case map fst (get_interval ([2],Res) ([4,3,2],Frm) 99999 pt) of
7.142 + [([2], Res),
7.143 + ([3], Res),
7.144 + ([4], Pbl),
7.145 + ([4, 1], Frm),
7.146 + ([4, 1, 1], Frm),
7.147 + ([4, 1, 1], Res),
7.148 + ([4, 1], Res),
7.149 + ([4, 2], Res),
7.150 + ([4, 3], Pbl),
7.151 + ([4, 3, 1], Frm),
7.152 + ([4, 3, 1], Res),
7.153 + ([4, 3, 2], Res),
7.154 + ([4, 3, 3], Res),(*this is beyond 'to'*)
7.155 + ([4, 3, 4], Res),(*this is beyond 'to'*)
7.156 + ([4, 3, 5], Res),(*this is beyond 'to'*)
7.157 + ([4, 3], Res), (*this is beyond 'to'*)
7.158 + ([4], Res), (*this is beyond 'to'*)
7.159 + ([5], Res), (*this is beyond 'to'*)
7.160 + ([], Res)] => () (*this is beyond 'to'*)
7.161 + | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1b";
7.162 +case map fst (get_interval ([1,4],Res) ([4,3,1],Frm) 99999 pt) of
7.163 + [([1, 4], Res),
7.164 + ([1], Res),
7.165 + ([2], Res),
7.166 + ([3], Res),
7.167 + ([4], Pbl),
7.168 + ([4, 1], Frm),
7.169 + ([4, 1, 1], Frm),
7.170 + ([4, 1, 1], Res),
7.171 + ([4, 1], Res),
7.172 + ([4, 2], Res),
7.173 + ([4, 3], Pbl),
7.174 + ([4, 3, 1], Frm)] => ()
7.175 + | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1c";
7.176 +case map fst (get_interval ([4,2],Res) ([5],Res) 99999 pt) of
7.177 + [([4, 2], Res),
7.178 + ([4, 3], Pbl),
7.179 + ([4, 3, 1], Frm),
7.180 + ([4, 3, 1], Res),
7.181 + ([4, 3, 2], Res),
7.182 + ([4, 3, 3], Res),
7.183 + ([4, 3, 4], Res),
7.184 + ([4, 3, 5], Res),
7.185 + ([4, 3], Res),
7.186 + ([4], Res),
7.187 + ([5], Res)]=>()
7.188 + | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1d";
7.189 +case map fst (get_interval ([],Frm) ([4,3,2],Res) 99999 pt) of
7.190 + [([], Frm),
7.191 + ([1], Frm),
7.192 + ([1, 1], Frm),
7.193 + ([1, 1], Res),
7.194 + ([1, 2], Res),
7.195 + ([1, 3], Res),
7.196 + ([1, 4], Res),
7.197 + ([1], Res),
7.198 + ([2], Res),
7.199 + ([3], Res),
7.200 + ([4], Pbl),
7.201 + ([4, 1], Frm),
7.202 + ([4, 1, 1], Frm),
7.203 + ([4, 1, 1], Res),
7.204 + ([4, 1], Res),
7.205 + ([4, 2], Res),
7.206 + ([4, 3], Pbl),
7.207 + ([4, 3, 1], Frm),
7.208 + ([4, 3, 1], Res),
7.209 + ([4, 3, 2], Res)] => ()
7.210 + | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1e";
7.211 +case map fst (get_interval ([4,3],Frm) ([4,3],Res) 99999 pt) of
7.212 + [([4, 3], Frm),
7.213 + ([4, 3, 1], Frm),
7.214 + ([4, 3, 1], Res),
7.215 + ([4, 3, 2], Res),
7.216 + ([4, 3, 3], Res),
7.217 + ([4, 3, 4], Res),
7.218 + ([4, 3, 5], Res),
7.219 + ([4, 3], Res)] => ()
7.220 + | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1g";
7.221 +
7.222 +
7.223 +
7.224 +
7.225 +"=====new ptree 2 without changes ================================";
7.226 +"=====new ptree 2 without changes ================================";
7.227 +"=====new ptree 2 without changes ================================";
7.228 +states:=[];
7.229 +CalcTree
7.230 +[(["equality (x/(x^2 - 6*x+9) - 1/(x^2 - 3*x) =1/x)",
7.231 + "solveFor x","solutions L"],
7.232 + ("RatEq.thy",["univariate","equation"],["no_met"]))];
7.233 +Iterator 1; moveActiveRoot 1;
7.234 +autoCalculate 1 CompleteCalc;
7.235 +val ((pt,_),_) = get_calc 1;
7.236 +writeln(pr_ptree pr_short pt);
7.237 +
7.238 +
7.239 +"-------------- getFormulaeFromTo --------------------------------";
7.240 +"-------------- getFormulaeFromTo --------------------------------";
7.241 +"-------------- getFormulaeFromTo --------------------------------";
7.242 +getFormulaeFromTo 1 ([4, 2], Res) ([4, 4], Pbl) 000;
7.243 +(*
7.244 +"@@@@@begin@@@@@" //...................................................
7.245 ++ " 1" //..............................................................
7.246 ++ "<GETELEMENTSFROMTO>" //...................................................
7.247 ++ " <CALCID> 1 </CALCID>" //..........................................
7.248 ++ " <POSFORMHEADS>" //................................................
7.249 ++ " <POSFORM>" //...................................................
7.250 ++ " <GENERATED>" //...............................................
7.251 ++ " <INTLIST>" //...............................................
7.252 ++ " <INT> 4 </INT>" //........................................
7.253 ++ " <INT> 3 </INT>" //........................................
7.254 ++ " </INTLIST>" //..............................................
7.255 ++ " <POS> Res </POS>" //........................................
7.256 ++ " </GENERATED>" //..............................................
7.257 ++ " <FORMULA>" //.................................................
7.258 ++ " <MATHML>" //................................................
7.259 ++ " <ISA> -6 * x + 5 * x ^^^ 2 = 0 </ISA>" //.................
7.260 ++ " </MATHML>" //...............................................
7.261 ++ " </FORMULA>" //................................................
7.262 ++ " </POSFORM>" //..................................................
7.263 ++ " <POSHEAD>" //...................................................
7.264 ++ " <GENERATED>" //...............................................
7.265 ++ " <INTLIST>" //...............................................
7.266 ++ " <INT> 4 </INT>" //........................................
7.267 ++ " <INT> 4 </INT>" //........................................
7.268 ++ " </INTLIST>" //..............................................
7.269 ++ " <POS> Pbl </POS>" //........................................
7.270 ++ " </GENERATED>" //..............................................
7.271 ++ " <CALCHEAD status = "correct">" //.............................
7.272 ++ " <HEAD>" //...................................................
7.273 ++ " <MATHML>" //...............................................
7.274 ++ " <ISA> solve (-6 * x + 5 * x ^^^ 2 = 0, x) </ISA>" //.....
7.275 ++ " </MATHML>" //..............................................
7.276 ++ " </HEAD>" //..................................................
7.277 ++ " <MODEL>" //.................................................
7.278 ++ " <GIVEN>" //...............................................
7.279 ++ " <ITEM status="correct">" //.............................
7.280 ++ " <MATHML>" //..........................................
7.281 ++ " <ISA> equality (-6 * x + 5 * x ^^^ 2 = 0) </ISA>" //
7.282 ++ " </MATHML>" //.........................................
7.283 ++ " </ITEM>" //.............................................
7.284 ++ " <ITEM status="correct">" //.............................
7.285 ++ " <MATHML>" //..........................................
7.286 ++ " <ISA> solveFor x </ISA>" //.........................
7.287 ++ " </MATHML>" //.........................................
7.288 ++ " </ITEM>" //.............................................
7.289 ++ " </GIVEN>" //..............................................
7.290 ++ " <WHERE>" //...............................................
7.291 ++ " <ITEM status="correct">" //.............................
7.292 ++ " <MATHML>" //..........................................
7.293 ++ " <ISA> matches (?a * ?v_ + ?v_ ^^^ 2 = 0) (-6 * x + 5 * x ^^^ 2 = 0) |"
7.294 ++ "matches (?v_ + ?v_ ^^^ 2 = 0) (-6 * x + 5 * x ^^^ 2 = 0) |" //......
7.295 ++ "matches (?v_ + ?b * ?v_ ^^^ 2 = 0) (-6 * x + 5 * x ^^^ 2 = 0) |"
7.296 ++ "matches (?a * ?v_ + ?b * ?v_ ^^^ 2 = 0) (-6 * x + 5 * x ^^^ 2 = 0) |"
7.297 ++ "matches (?v_ ^^^ 2 = 0) (-6 * x + 5 * x ^^^ 2 = 0) |" //............
7.298 ++ "matches (?b * ?v_ ^^^ 2 = 0) (-6 * x + 5 * x ^^^ 2 = 0) </ISA>" //..
7.299 ++ " </MATHML>" //.........................................
7.300 ++ " </ITEM>" //.............................................
7.301 ++ " </WHERE>" //..............................................
7.302 ++ " <FIND>" //................................................
7.303 ++ " <ITEM status="correct">" //.............................
7.304 ++ " <MATHML>" //..........................................
7.305 ++ " <ISA> solutions x_i </ISA>" //......................
7.306 ++ " </MATHML>" //.........................................
7.307 ++ " </ITEM>" //.............................................
7.308 ++ " </FIND>" //...............................................
7.309 ++ " <RELATE> </RELATE>" //...................................
7.310 ++ " </MODEL>" //................................................
7.311 ++ " <BELONGSTO> Pbl </BELONGSTO>" //............................
7.312 ++ " <SPECIFICATION>" //.........................................
7.313 ++ " <THEORYID> PolyEq.thy </THEORYID>" //.....................
7.314 ++ " <PROBLEMID>" //...........................................
7.315 ++ " <STRINGLIST>" //........................................
7.316 ++ " <STRING> bdv_only </STRING>" //.......................
7.317 ++ " <STRING> degree_2 </STRING>" //.......................
7.318 ++ " <STRING> polynomial </STRING>" //.....................
7.319 ++ " <STRING> univariate </STRING>" //.....................
7.320 ++ " <STRING> equation </STRING>" //.......................
7.321 ++ " </STRINGLIST>" //.......................................
7.322 ++ " </PROBLEMID>" //..........................................
7.323 ++ " <METHODID>" //............................................
7.324 ++ " <STRINGLIST>" //........................................
7.325 ++ " <STRING> PolyEq </STRING>" //.........................
7.326 ++ " <STRING> solve_d2_polyeq_bdvonly_equation </STRING>"
7.327 ++ " </STRINGLIST>" //.......................................
7.328 ++ " </METHODID>" //...........................................
7.329 ++ " </SPECIFICATION>" //........................................
7.330 ++ " </CALCHEAD>" //...............................................
7.331 ++ " </POSHEAD>" //..................................................
7.332 ++ " <POSFORMHEADS>" //................................................
7.333 ++ "</GETELEMENTSFROMTO>" //..................................................
7.334 ++ "@@@@@end@@@@@"
7.335 +*)
7.336 +
7.337 +
7.338 +"--------- solve_linear as rootpbl AUTOCALCULATE CompleteModel ---";
7.339 +"--------- solve_linear as rootpbl AUTOCALCULATE CompleteModel ---";
7.340 +"--------- solve_linear as rootpbl AUTOCALCULATE CompleteModel ---";
7.341 + val c = [];
7.342 + val (p,_,f,nxt,_,pt) = CalcTreeTEST
7.343 + [(["equality (1+-1*2+x=0)", "solveFor x","solutions L"],
7.344 + ("Test.thy",
7.345 + ["linear","univariate","equation","test"],
7.346 + ["Test","solve_linear"]))];
7.347 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
7.348 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
7.349 + (*xt = Add_Given "solveFor x"*)
7.350 + writeln (itms2str_ ctxt (get_obj g_pbl pt (fst p)));
7.351 +(*[
7.352 +(0 ,[] ,false ,#Given ,Inc solveFor ,(??.empty, [])),
7.353 +(0 ,[] ,false ,#Find ,Inc solutions [] ,(??.empty, [])),
7.354 +(1 ,[1] ,true ,#Given ,Cor equality (1 + -1 * 2 + x = 0) ,(e_, [1 + -1 * 2 + x = 0]))]*)
7.355 + val (pt,p) = complete_mod (pt, p);
7.356 + if itms2str_ ctxt (get_obj g_pbl pt (fst p)) = "[\n(1 ,[1] ,true ,#Given ,Cor equality (1 + -1 * 2 + x = 0) ,(e_, [1 + -1 * 2 + x = 0])),\n(2 ,[1] ,true ,#Given ,Cor solveFor x ,(v_, [x])),\n(3 ,[1] ,true ,#Find ,Cor solutions L ,(v_i_, [L]))]" then ()
7.357 + else raise error "completetest.sml: new behav. in complete_mod 1";
7.358 + writeln (itms2str_ ctxt (get_obj g_pbl pt (fst p)));
7.359 +(*[
7.360 +(1 ,[1] ,true ,#Given ,Cor equality (1 + -1 * 2 + x = 0) ,(e_, [1 + -1 * 2 + x = 0])),
7.361 +(2 ,[1] ,true ,#Given ,Cor solveFor x ,(solveFor, [x])),
7.362 +(3 ,[1] ,true ,#Find ,Cor solutions L ,(solutions, [L]))]*)
7.363 + val mits = get_obj g_met pt (fst p);
7.364 + if itms2str_ ctxt mits = "[\n(1 ,[1] ,true ,#Given ,Cor equality (1 + -1 * 2 + x = 0) ,(e_, [1 + -1 * 2 + x = 0])),\n(2 ,[1] ,true ,#Given ,Cor solveFor x ,(v_, [x])),\n(3 ,[1] ,true ,#Find ,Cor solutions L ,(v_i_, [L]))]"
7.365 + then () else raise error "completetest.sml: new behav. in complete_mod 2";
7.366 + writeln (itms2str_ ctxt mits);
7.367 +(*[
7.368 +(1 ,[1] ,true ,#Given ,Cor equality (1 + -1 * 2 + x = 0) ,(e_, [1 + -1 * 2 + x = 0])),
7.369 +(2 ,[1] ,true ,#Given ,Cor solveFor x ,(solveFor, [x])),
7.370 +(3 ,[1] ,true ,#Find ,Cor solutions L ,(solutions, [L]))]*)
7.371 +
7.372 +
7.373 +
7.374 +"--------- solve_linear as rootpbl AUTOCALCULATE CompleteCalcHead-";
7.375 +"--------- solve_linear as rootpbl AUTOCALCULATE CompleteCalcHead-";
7.376 +"--------- solve_linear as rootpbl AUTOCALCULATE CompleteCalcHead-";
7.377 + states:=[];
7.378 + CalcTree (*start of calculation, return No.1*)
7.379 + [(["equality (1+-1*2+x=0)", "solveFor x","solutions L"],
7.380 + ("Test.thy",
7.381 + ["linear","univariate","equation","test"],
7.382 + ["Test","solve_linear"]))];
7.383 + Iterator 1; moveActiveRoot 1;
7.384 +
7.385 +(*
7.386 + autoCalculate 1 CompleteCalcHead;
7.387 + autoCalculate 1 (Step 1);
7.388 + refFormula 1 (get_pos 1 1);
7.389 +
7.390 +... works
7.391 +
7.392 + autoCalculate 1 CompleteCalcHead;
7.393 + fetchProposedTactic 1; (*-> Apply_Method*);
7.394 + setNextTactic 1 (Apply_Method ["Test","solve_linear"]);
7.395 + autoCalculate 1 (Step 1);
7.396 + refFormula 1 (get_pos 1 1);
7.397 +
7.398 +... works *)
7.399 +
7.400 + autoCalculate 1 (Step 1);
7.401 + refFormula 1 (get_pos 1 1);
7.402 +
7.403 + autoCalculate 1 CompleteModel;
7.404 + refFormula 1 (get_pos 1 1);
7.405 +
7.406 + autoCalculate 1 CompleteCalcHead;
7.407 +(* *** complete_mod: only impl.for Pbl, called with ([], Met) FIXXXXXXXXXXME*)
7.408 +
7.409 +
7.410 +
7.411 +"--------- maximum-example: complete_metitms ---------------------";
7.412 +"--------- maximum-example: complete_metitms ---------------------";
7.413 +"--------- maximum-example: complete_metitms ---------------------";
7.414 + val (p,_,f,nxt,_,pt) =
7.415 + CalcTreeTEST
7.416 + [(["fixedValues [r=Arbfix]","maximum A",
7.417 + "valuesFor [a,b]",
7.418 + "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
7.419 + "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
7.420 + "relations [A=a*b, a/2=r*sin alpha, b/2=r*cos alpha]",
7.421 +
7.422 + "boundVariable a","boundVariable b","boundVariable alpha",
7.423 + "interval {x::real. 0 <= x & x <= 2*r}",
7.424 + "interval {x::real. 0 <= x & x <= 2*r}",
7.425 + "interval {x::real. 0 <= x & x <= pi}",
7.426 + "errorBound (eps=(0::real))"],
7.427 + ("DiffApp.thy",["maximum_of","function"],["DiffApp","max_by_calculus"])
7.428 + )];
7.429 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
7.430 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
7.431 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
7.432 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
7.433 + val (p,_,f,nxt,_,pt) = (me nxt p c pt) handle e => print_exn e;
7.434 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
7.435 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
7.436 + (*nxt = Specify_Theory "DiffApp.thy"*)
7.437 + val (oris, _, _) = get_obj g_origin pt (fst p);
7.438 + writeln (oris2str oris);
7.439 +(*[
7.440 +(1, ["1","2","3"], #Given,fixedValues, ["[r = Arbfix]"]),
7.441 +(2, ["1","2","3"], #Find,maximum, ["A"]),
7.442 +(3, ["1","2","3"], #Find,valuesFor, ["[a]","[b]"]),
7.443 +(4, ["1","2"], #Relate,relations, ["[A = a * b]","[(a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]"]),
7.444 +(5, ["3"], #Relate,relations, ["[A = a * b]","[a / 2 = r * sin alpha]","[b / 2 = r * cos alpha]"]),
7.445 +(6, ["1"], #undef,boundVariable, ["a"]),
7.446 +(7, ["2"], #undef,boundVariable, ["b"]),
7.447 +(8, ["3"], #undef,boundVariable, ["alpha"]),
7.448 +(9, ["1","2"], #undef,interval, ["{x. 0 <= x & x <= 2 * r}"]),
7.449 +(10, ["3"], #undef,interval, ["{x. 0 <= x & x <= pi}"]),
7.450 +(11, ["1","2","3"], #undef,errorBound, ["eps = 0"])]*)
7.451 + val pits = get_obj g_pbl pt (fst p);
7.452 + writeln (itms2str_ ctxt pits);
7.453 +(*[
7.454 +(1 ,[1,2,3] ,true,#Given ,Cor fixedValues [r = Arbfix],(fix_, [[r = Arbfix]])),
7.455 +(2 ,[1,2,3] ,true,#Find ,Cor maximum A ,(m_, [A])),
7.456 +(3 ,[1,2,3] ,true,#Find ,Cor valuesFor [a, b] ,(vs_, [[a, b]])),
7.457 +(4 ,[1,2] ,true,#Relate ,Cor relations [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^
7.458 +2 = r ^^^ 2] ,(rs_, [[A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]]))]*)
7.459 + val mits = get_obj g_met pt (fst p);
7.460 + val mits = complete_metitms oris pits []
7.461 + ((#ppc o get_met) ["DiffApp","max_by_calculus"]);
7.462 + writeln (itms2str_ ctxt mits);
7.463 +(*[
7.464 +(1 ,[1,2,3] ,true ,#Given ,Cor fixedValues [r = Arbfix] ,(fix_, [[r = Arbfix]])),
7.465 +(2 ,[1,2,3] ,true ,#Find ,Cor maximum A ,(m_, [A])),
7.466 +(3 ,[1,2,3] ,true ,#Find ,Cor valuesFor [a, b] ,(vs_, [[a, b]])),
7.467 +(4 ,[1,2] ,true ,#Relate ,Cor relations [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^
7.468 +2 = r ^^^ 2] ,(rs_, [[A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]])),
7.469 +(6 ,[1] ,true ,#undef ,Cor boundVariable a ,(boundVariable, [a])),
7.470 +(9 ,[1,2] ,true ,#undef ,Cor interval {x. 0 <= x & x <= 2 * r} ,(interval, [{x.
7.471 +0 <= x & x <= 2 * r}])),
7.472 +(11 ,[1,2,3] ,true ,#undef ,Cor errorBound (eps = 0) ,(errorBound, [eps = 0]))]*)
7.473 + if itms2str_ ctxt mits = "[\n(1 ,[1,2,3] ,true ,#Given ,Cor fixedValues [r = Arbfix] ,(fix_, [[r = Arbfix]])),\n(2 ,[1,2,3] ,true ,#Find ,Cor maximum A ,(m_, [A])),\n(3 ,[1,2,3] ,true ,#Find ,Cor valuesFor [a, b] ,(vs_, [[a, b]])),\n(4 ,[1,2] ,true ,#Relate ,Cor relations [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2] ,(rs_, [[A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]])),\n(6 ,[1] ,true ,#undef ,Cor boundVariable a ,(v_, [a])),\n(9 ,[1,2] ,true ,#undef ,Cor interval {x. 0 <= x & x <= 2 * r} ,(itv_, [{x. 0 <= x & x <= 2 * r}])),\n(11 ,[1,2,3] ,true ,#undef ,Cor errorBound (eps = 0) ,(err_, [eps = 0]))]" then ()
7.474 + else raise error "completetest.sml: new behav. in complete_metitms 1";
7.475 +
7.476 +
7.477 +"--------- maximum-example: complete_mod -------------------------";
7.478 +"--------- maximum-example: complete_mod -------------------------";
7.479 +"--------- maximum-example: complete_mod -------------------------";
7.480 + val (p,_,f,nxt,_,pt) =
7.481 + CalcTreeTEST
7.482 + [(["fixedValues [r=Arbfix]","maximum A",
7.483 + "valuesFor [a,b]",
7.484 + "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
7.485 + "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
7.486 + "relations [A=a*b, a/2=r*sin alpha, b/2=r*cos alpha]",
7.487 +
7.488 + "boundVariable a","boundVariable b","boundVariable alpha",
7.489 + "interval {x::real. 0 <= x & x <= 2*r}",
7.490 + "interval {x::real. 0 <= x & x <= 2*r}",
7.491 + "interval {x::real. 0 <= x & x <= pi}",
7.492 + "errorBound (eps=(0::real))"],
7.493 + ("DiffApp.thy",["maximum_of","function"],["DiffApp","max_by_calculus"])
7.494 + )];
7.495 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
7.496 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
7.497 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
7.498 + (*nxt = nxt = Add_Find "valuesFor [a]" FIXME.12.03 +handle Inc !*)
7.499 + val pits = get_obj g_pbl pt (fst p);
7.500 + writeln (itms2str_ ctxt pits);
7.501 +(*[
7.502 +(0 ,[] ,false ,#Find ,Inc valuesFor ,(??.empty, [])),
7.503 +(0 ,[] ,false ,#Relate ,Inc relations [] ,(??.empty, [])),
7.504 +(1 ,[1,2,3] ,true,#Given,Cor fixedValues [r = Arbfix] ,(fix_, [[r = Arbfix]])),
7.505 +(2 ,[1,2,3] ,true ,#Find ,Cor maximum A ,(m_, [A]))]*)
7.506 + val (pt,p) = complete_mod (pt,p);
7.507 + val pits = get_obj g_pbl pt (fst p);
7.508 + if itms2str_ ctxt pits = "[\n(1 ,[1,2,3] ,true ,#Given ,Cor fixedValues [r = Arbfix] ,(fix_, [[r = Arbfix]])),\n(2 ,[1,2,3] ,true ,#Find ,Cor maximum A ,(m_, [A])),\n(3 ,[1,2,3] ,true ,#Find ,Cor valuesFor [a, b] ,(vs_, [[a],[b]])),\n(4 ,[1,2] ,true ,#Relate ,Cor relations [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2] ,(rs_, [[A = a * b],[(a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]]))]"
7.509 + then () else raise error "completetest.sml: new behav. in complete_mod 3";
7.510 + writeln (itms2str_ ctxt pits);
7.511 +(*[
7.512 +(1 ,[1,2,3] ,true,#Given,Cor fixedValues [r = Arbfix] ,(fix_, [[r = Arbfix]])),
7.513 +(2 ,[1,2,3] ,true ,#Find ,Cor maximum A ,(m_, [A])),
7.514 +(3 ,[1,2,3] ,true ,#Find ,Cor valuesFor [a, b] ,(valuesFor, [[a],[b]])),
7.515 +(4 ,[1,2] ,true ,#Relate ,Cor relations [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^
7.516 +2 = r ^^^ 2] ,(relations, [[A = a * b],[(a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]]))]*)
7.517 + val mits = get_obj g_met pt (fst p);
7.518 + if itms2str_ ctxt mits = "[\n(1 ,[1,2,3] ,true ,#Given ,Cor fixedValues [r = Arbfix] ,(fix_, [[r = Arbfix]])),\n(2 ,[1,2,3] ,true ,#Find ,Cor maximum A ,(m_, [A])),\n(3 ,[1,2,3] ,true ,#Find ,Cor valuesFor [a, b] ,(vs_, [[a],[b]])),\n(4 ,[1,2] ,true ,#Relate ,Cor relations [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2] ,(rs_, [[A = a * b],[(a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]])),\n(6 ,[1] ,true ,#undef ,Cor boundVariable a ,(v_, [a])),\n(9 ,[1,2] ,true ,#undef ,Cor interval {x. 0 <= x & x <= 2 * r} ,(itv_, [{x. 0 <= x & x <= 2 * r}])),\n(11 ,[1,2,3] ,true ,#undef ,Cor errorBound (eps = 0) ,(err_, [eps = 0]))]"
7.519 + then () else raise error "completetest.sml: new behav. in complete_mod 3";
7.520 + writeln (itms2str_ ctxt mits);
7.521 +(*[
7.522 +(1 ,[1,2,3] ,true ,#Given ,Cor fixedValues [r = Arbfix] ,(fix_, [[r = Arbfix]])),
7.523 +(2 ,[1,2,3] ,true ,#Find ,Cor maximum A ,(m_, [A])),
7.524 +(3 ,[1,2,3] ,true ,#Find ,Cor valuesFor [a, b] ,(valuesFor, [[a],[b]])),
7.525 +(4 ,[1,2] ,true ,#Relate ,Cor relations [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^
7.526 +2 = r ^^^ 2] ,(relations, [[A = a * b],[(a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]])),
7.527 +(6 ,[1] ,true ,#undef ,Cor boundVariable a ,(boundVariable, [a])),
7.528 +(9 ,[1,2] ,true ,#undef ,Cor interval {x. 0 <= x & x <= 2 * r} ,(interval, [{x.
7.529 +0 <= x & x <= 2 * r}])),
7.530 +(11 ,[1,2,3] ,true ,#undef ,Cor errorBound (eps = 0) ,(errorBound, [eps = 0]))]*)
7.531 +
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/test/Tools/isac/Interpret/mstools.sml Mon Aug 30 14:35:51 2010 +0200
8.3 @@ -0,0 +1,20 @@
8.4 +(* tests on mstools.sml
8.5 + author: Walther Neuper
8.6 + 051019,
8.7 + (c) due to copyright terms
8.8 +
8.9 +use"../smltest/ME/mstools.sml";
8.10 +use"mstools.sml";
8.11 + *)
8.12 +
8.13 +"-----------------------------------------------------------------";
8.14 +"table of contents -----------------------------------------------";
8.15 +"-----------------------------------------------------------------";
8.16 +"--------- head_precond ------------------------------------------";
8.17 +"-----------------------------------------------------------------";
8.18 +
8.19 +
8.20 +
8.21 +"--------- head_precond ------------------------------------------";
8.22 +"--------- head_precond ------------------------------------------";
8.23 +"--------- head_precond ------------------------------------------";
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/test/Tools/isac/Interpret/ptyps.sml Mon Aug 30 14:35:51 2010 +0200
9.3 @@ -0,0 +1,474 @@
9.4 +(* tests for ME/ptyps.sml
9.5 + CAUTION: intermediately stores !ptyps THUS EVALUATE IN 1 GO
9.6 + author: Walther Neuper
9.7 + 010916,
9.8 + (c) due to copyright terms
9.9 +
9.10 +use"../smltest/ME/ptyps.sml";
9.11 +use"ptyps.sml";
9.12 +*)
9.13 +
9.14 +"-----------------------------------------------------------------";
9.15 +"table of contents -----------------------------------------------";
9.16 +"-----------------------------------------------------------------";
9.17 +"###### val intermediate_ptyps = !ptyps; #########################";
9.18 +"----------- store test-pbtyps -----------------------------------";
9.19 +"----------- refin test-pbtyps -----------------------------------";
9.20 +"----------- refine_ori test-pbtyps ------------------------------";
9.21 +"----------- refine test-pbtyps ----------------------------------";
9.22 +"###### ptyps:= intermediate_ptyps;###############################";
9.23 +"----------- Refine_Problem (aus subp-rooteq.sml) ----------------";
9.24 +"----------- fun coll_guhs ---------------------------------------";
9.25 +"----------- fun guh2kestoreID -----------------------------------";
9.26 +"-----------------------------------------------------------------";
9.27 +"-----------------------------------------------------------------";
9.28 +"-----------------------------------------------------------------";
9.29 +
9.30 +
9.31 +
9.32 +"###### val intermediate_ptyps = !ptyps; #########################";
9.33 +"###### val intermediate_ptyps = !ptyps; #########################";
9.34 +"###### val intermediate_ptyps = !ptyps; #########################";
9.35 +val intermediate_ptyps = !ptyps;
9.36 +
9.37 +"----------- store test-pbtyps -----------------------------------";
9.38 +"----------- store test-pbtyps -----------------------------------";
9.39 +"----------- store test-pbtyps -----------------------------------";
9.40 +ptyps:= ([]:ptyps);
9.41 +
9.42 +store_pbt
9.43 + (prep_pbt DiffApp.thy "pbl_pbla" [] e_pblID
9.44 + (["pbla"],
9.45 + [("#Given", ["fixedValues a_"])], e_rls, NONE, []));
9.46 +store_pbt
9.47 + (prep_pbt DiffApp.thy "pbl_pbla1" [] e_pblID
9.48 + (["pbla1","pbla"],
9.49 + [("#Given", ["fixedValues a_","maximum a1_"])], e_rls, NONE, []));
9.50 +store_pbt
9.51 + (prep_pbt DiffApp.thy "pbl_pbla2" [] e_pblID
9.52 + (["pbla2","pbla"],
9.53 + [("#Given", ["fixedValues a_","valuesFor a2_"])], e_rls, NONE, []));
9.54 +store_pbt
9.55 + (prep_pbt DiffApp.thy "pbl_pbla2x" [] e_pblID
9.56 + (["pbla2x","pbla2","pbla"],
9.57 + [("#Given", ["fixedValues a_","valuesFor a2_","functionOf a2x_"])],
9.58 + e_rls, NONE, []));
9.59 +store_pbt
9.60 + (prep_pbt DiffApp.thy "pbl_pbla2y" [] e_pblID
9.61 + (["pbla2y","pbla2","pbla"],
9.62 + [("#Given" ,["fixedValues a_","valuesFor a2_","boundVariable a2y_"])],
9.63 + e_rls, NONE, []));
9.64 +store_pbt
9.65 + (prep_pbt DiffApp.thy "pbl_pbla2z" [] e_pblID
9.66 + (["pbla2z","pbla2","pbla"],
9.67 + [("#Given" ,["fixedValues a_","valuesFor a2_","interval a2z_"])],
9.68 + e_rls, NONE, []));
9.69 +store_pbt
9.70 + (prep_pbt DiffApp.thy "pbl_pbla3" [] e_pblID
9.71 + (["pbla3","pbla"],
9.72 + [("#Given" ,["fixedValues a_","relations a3_"])],
9.73 + e_rls, NONE, []));
9.74 +
9.75 +show_ptyps();
9.76 +
9.77 +(*case 1: no refinement *)
9.78 +val thy = Isac.thy;
9.79 +val (d1,ts1) = split_dts thy ((term_of o the o (parse thy))
9.80 + "fixedValues [aaa=0]");
9.81 +val (d2,ts2) = split_dts thy ((term_of o the o (parse thy))
9.82 + "errorBound (ddd=0)");
9.83 +val ori1 = [(1,[1],"#Given",d1,ts1),
9.84 + (2,[1],"#Given",d2,ts2)]:ori list;
9.85 +
9.86 +
9.87 +(*case 2: refined to pbt without children *)
9.88 +val (d2,ts2) = split_dts thy ((term_of o the o (parse thy))
9.89 + "relations [aaa333]");
9.90 +val ori2 = [(1,[1],"#Given",d1,ts1),
9.91 + (2,[1],"#Given",d2,ts2)]:ori list;
9.92 +
9.93 +
9.94 +(*case 3: refined to pbt with children *)
9.95 +val (d2,ts2) = split_dts thy ((term_of o the o (parse thy))
9.96 + "valuesFor [aaa222]");
9.97 +val ori3 = [(1,[1],"#Given",d1,ts1),
9.98 + (2,[1],"#Given",d2,ts2)]:ori list;
9.99 +
9.100 +
9.101 +(*case 4: refined to children (without child)*)
9.102 +val (d3,ts3) = split_dts thy ((term_of o the o (parse thy))
9.103 + "boundVariable aaa222yyy");
9.104 +val ori4 = [(1,[1],"#Given",d1,ts1),
9.105 + (2,[1],"#Given",d2,ts2),
9.106 + (3,[1],"#Given",d3,ts3)]:ori list;
9.107 +
9.108 +"----------- refin test-pbtyps -----------------------------------";
9.109 +"----------- refin test-pbtyps -----------------------------------";
9.110 +"----------- refin test-pbtyps -----------------------------------";
9.111 +(*case 1: no refinement *)
9.112 +refin [] ori1 (hd (!ptyps));
9.113 +(*val it = SOME ["pbla"] : pblID option*)
9.114 +
9.115 +(*case 2: refined to pbt without children *)
9.116 +refin [] ori2 (hd (!ptyps));
9.117 +(*val it = SOME ["pbla","pbla3"] : pblID option*)
9.118 +
9.119 +(*case 3: refined to pbt with children *)
9.120 +refin [] ori3 (hd (!ptyps));
9.121 +(*val it = SOME ["pbla","pbla2"] : pblID option*)
9.122 +
9.123 +(*case 4: refined to children (without child)*)
9.124 +refin [] ori4 (hd (!ptyps));
9.125 +(*val it = SOME ["pbla","pbla2","pbla2y"] : pblID option*)
9.126 +
9.127 +(*case 5: start refinement somewhere in ptyps*)
9.128 +val [Ptyp ("pbla",_,[_, ppp as Ptyp ("pbla2",_,_), _])] = !ptyps;
9.129 +refin ["pbla"] ori4 ppp;
9.130 +(*val it = SOME ["pbla2","pbla2y"] : pblRD option*)
9.131 +
9.132 +
9.133 +"----------- refine_ori test-pbtyps ------------------------------";
9.134 +"----------- refine_ori test-pbtyps ------------------------------";
9.135 +"----------- refine_ori test-pbtyps ------------------------------";
9.136 +(*case 1: no refinement *)
9.137 +refine_ori ori1 ["pbla"];
9.138 +(*val it = NONE : pblID option !!!!*)
9.139 +
9.140 +(*case 2: refined to pbt without children *)
9.141 +refine_ori ori2 ["pbla"];
9.142 +(*val it = SOME ["pbla3","pbla"] : pblID option*)
9.143 +
9.144 +(*case 3: refined to pbt with children *)
9.145 +refine_ori ori3 ["pbla"];
9.146 +(*val it = SOME ["pbla2","pbla"] : pblID option*)
9.147 +
9.148 +(*case 4: refined to children (without child)*)
9.149 +val opt = refine_ori ori4 ["pbla"];
9.150 +if opt = SOME ["pbla2y","pbla2","pbla"] then ()
9.151 +else raise error "new behaviour in refine.sml case 4";
9.152 +
9.153 +(*case 5: start refinement somewhere in ptyps*)
9.154 +refine_ori ori4 ["pbla2","pbla"];
9.155 +(*val it = SOME ["pbla2y","pbla2","pbla"] : pblID option*)
9.156 +
9.157 +
9.158 +"----------- refine test-pbtyps ----------------------------------";
9.159 +"----------- refine test-pbtyps ----------------------------------";
9.160 +"----------- refine test-pbtyps ----------------------------------";
9.161 +val fmz1 = ["fixedValues [aaa=0]","errorBound (ddd=0)"];
9.162 +val fmz2 = ["fixedValues [aaa=0]","relations aaa333"];
9.163 +val fmz3 = ["fixedValues [aaa=0]","valuesFor [aaa222]"];
9.164 +val fmz4 = ["fixedValues [aaa=0]","valuesFor [aaa222]",
9.165 + "boundVariable aaa222yyy"];
9.166 +
9.167 +(*case 1: no refinement *)
9.168 +refine fmz1 ["pbla"];
9.169 +(*
9.170 +*** pass ["pbla"]
9.171 +*** pass ["pbla","pbla1"]
9.172 +*** pass ["pbla","pbla2"]
9.173 +*** pass ["pbla","pbla3"]
9.174 +val it =
9.175 + [Matches
9.176 + (["pbla"],
9.177 + {Find=[],
9.178 + Given=[Correct "fixedValues [aaa = #0]",
9.179 + Superfl "errorBound (ddd = #0)"],Relate=[],Where=[],With=[]}),
9.180 + NoMatch
9.181 + (["pbla1","pbla"],
9.182 + {Find=[],
9.183 + Given=[Correct "fixedValues [aaa = #0]",Missing "maximum a1_",
9.184 + Superfl "errorBound (ddd = #0)"],Relate=[],Where=[],With=[]}),
9.185 + NoMatch
9.186 + (["pbla2","pbla"],
9.187 + {Find=[],
9.188 + Given=[Correct "fixedValues [aaa = #0]",Missing "valuesFor a2_",
9.189 + Superfl "errorBound (ddd = #0)"],Relate=[],Where=[],With=[]}),
9.190 + NoMatch
9.191 + (["pbla3","pbla"],
9.192 + {Find=[],
9.193 + Given=[Correct "fixedValues [aaa = #0]",Missing "relations a3_",
9.194 + Superfl "errorBound (ddd = #0)"],Relate=[],Where=[],With=[]})]
9.195 + : match list*)
9.196 +
9.197 +(*case 2: refined to pbt without children *)
9.198 +refine fmz2 ["pbla"];
9.199 +(*
9.200 +*** pass ["pbla"]
9.201 +*** pass ["pbla","pbla1"]
9.202 +*** pass ["pbla","pbla2"]
9.203 +*** pass ["pbla","pbla3"]
9.204 +val it =
9.205 + [Matches
9.206 + (["pbla"],
9.207 + {Find=[],
9.208 + Given=[Correct "fixedValues [aaa = #0]",Superfl "relations aaa333"],
9.209 + Relate=[],Where=[],With=[]}),
9.210 + NoMatch
9.211 + (["pbla1","pbla"],
9.212 + {Find=[],
9.213 + Given=[Correct "fixedValues [aaa = #0]",Missing "maximum a1_",
9.214 + Superfl "relations aaa333"],Relate=[],Where=[],With=[]}),
9.215 + NoMatch
9.216 + (["pbla2","pbla"],
9.217 + {Find=[],
9.218 + Given=[Correct "fixedValues [aaa = #0]",Missing "valuesFor a2_",
9.219 + Superfl "relations aaa333"],Relate=[],Where=[],With=[]}),
9.220 + Matches
9.221 + (["pbla3","pbla"],
9.222 + {Find=[],
9.223 + Given=[Correct "fixedValues [aaa = #0]",Correct "relations aaa333"],
9.224 + Relate=[],Where=[],With=[]})] : match list*)
9.225 +
9.226 +(*case 3: refined to pbt with children *)
9.227 +refine fmz3 ["pbla"];
9.228 +(*
9.229 +*** pass ["pbla"]
9.230 +*** pass ["pbla","pbla1"]
9.231 +*** pass ["pbla","pbla2"]
9.232 +*** pass ["pbla","pbla2","pbla2x"]
9.233 +*** pass ["pbla","pbla2","pbla2y"]
9.234 +*** pass ["pbla","pbla2","pbla2z"]
9.235 +*** pass ["pbla","pbla3"]
9.236 +val it =
9.237 + [Matches
9.238 + (["pbla"],
9.239 + {Find=[],
9.240 + Given=[Correct "fixedValues [aaa = #0]",Superfl "valuesFor aaa222"],
9.241 + Relate=[],Where=[],With=[]}),
9.242 + NoMatch
9.243 + (["pbla1","pbla"],
9.244 + {Find=[],
9.245 + Given=[Correct "fixedValues [aaa = #0]",Missing "maximum a1_",
9.246 + Superfl "valuesFor aaa222"],Relate=[],Where=[],With=[]}),
9.247 + Matches
9.248 + (["pbla2","pbla"],
9.249 + {Find=[],
9.250 + Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222"],
9.251 + Relate=[],Where=[],With=[]}),
9.252 + NoMatch
9.253 + (["pbla2x","pbla2","pbla"],
9.254 + {Find=[],
9.255 + Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
9.256 + Missing "functionOf a2x_"],Relate=[],Where=[],With=[]}),
9.257 + NoMatch
9.258 + (["pbla2y","pbla2","pbla"],
9.259 + {Find=[],
9.260 + Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
9.261 + Missing "boundVariable a2y_"],Relate=[],Where=[],With=[]}),
9.262 + NoMatch
9.263 + (["pbla2z","pbla2","pbla"],
9.264 + {Find=[],
9.265 + Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
9.266 + Missing "interval a2z_"],Relate=[],Where=[],With=[]}),
9.267 + NoMatch
9.268 + (["pbla3","pbla"],
9.269 + {Find=[],
9.270 + Given=[Correct "fixedValues [aaa = #0]",Missing "relations a3_",
9.271 + Superfl "valuesFor aaa222"],Relate=[],Where=[],With=[]})]
9.272 + : match list*)
9.273 +
9.274 +(*case 4: refined to children (without child)*)
9.275 +refine fmz4 ["pbla"];
9.276 +(*
9.277 +*** pass ["pbla"]
9.278 +*** pass ["pbla","pbla1"]
9.279 +*** pass ["pbla","pbla2"]
9.280 +*** pass ["pbla","pbla2","pbla2x"]
9.281 +*** pass ["pbla","pbla2","pbla2y"]
9.282 +val it =
9.283 + [Matches
9.284 + (["pbla"],
9.285 + {Find=[],
9.286 + Given=[Correct "fixedValues [aaa = #0]",Superfl "valuesFor aaa222",
9.287 + Superfl "boundVariable aaa222yyy"],Relate=[],Where=[],With=[]}),
9.288 + NoMatch
9.289 + (["pbla1","pbla"],
9.290 + {Find=[],
9.291 + Given=[Correct "fixedValues [aaa = #0]",Missing "maximum a1_",
9.292 + Superfl "valuesFor aaa222",Superfl "boundVariable aaa222yyy"],
9.293 + Relate=[],Where=[],With=[]}),
9.294 + Matches
9.295 + (["pbla2","pbla"],
9.296 + {Find=[],
9.297 + Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
9.298 + Superfl "boundVariable aaa222yyy"],Relate=[],Where=[],With=[]}),
9.299 + NoMatch
9.300 + (["pbla2x","pbla2","pbla"],
9.301 + {Find=[],
9.302 + Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
9.303 + Missing "functionOf a2x_",Superfl "boundVariable aaa222yyy"],
9.304 + Relate=[],Where=[],With=[]}),
9.305 + Matches
9.306 + (["pbla2y","pbla2","pbla"],
9.307 + {Find=[],
9.308 + Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
9.309 + Correct "boundVariable aaa222yyy"],Relate=[],Where=[],With=[]})]
9.310 + : match list*)
9.311 +
9.312 +(*case 5: start refinement somewhere in ptyps*)
9.313 +refine fmz4 ["pbla2","pbla"];
9.314 +(*
9.315 +*** pass ["pbla","pbla2"]
9.316 +*** pass ["pbla","pbla2","pbla2x"]
9.317 +*** pass ["pbla","pbla2","pbla2y"]
9.318 +val it =
9.319 + [Matches
9.320 + (["pbla2","pbla"],
9.321 + {Find=[],
9.322 + Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
9.323 + Superfl "boundVariable aaa222yyy"],Relate=[],Where=[],With=[]}),
9.324 + NoMatch
9.325 + (["pbla2x","pbla2","pbla"],
9.326 + {Find=[],
9.327 + Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
9.328 + Missing "functionOf a2x_",Superfl "boundVariable aaa222yyy"],
9.329 + Relate=[],Where=[],With=[]}),
9.330 + Matches
9.331 + (["pbla2y","pbla2","pbla"],
9.332 + {Find=[],
9.333 + Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
9.334 + Correct "boundVariable aaa222yyy"],Relate=[],Where=[],With=[]})]
9.335 + : match list*)
9.336 +
9.337 +"###### ptyps:= intermediate_ptyps;###############################";
9.338 +"###### ptyps:= intermediate_ptyps;###############################";
9.339 +"###### ptyps:= intermediate_ptyps;###############################";
9.340 +ptyps:= intermediate_ptyps;
9.341 +show_ptyps();
9.342 +
9.343 +"----------- Refine_Problem (aus subp-rooteq.sml) ----------------";
9.344 +"----------- Refine_Problem (aus subp-rooteq.sml) ----------------";
9.345 +"----------- Refine_Problem (aus subp-rooteq.sml) ----------------";
9.346 +val fmz = ["equality ((x+1)*(x+2)=x^^^2+8)","solveFor x",
9.347 + "errorBound (eps=0)","solutions L"];
9.348 +val (dI',pI',mI') = ("Test.thy",["sqroot-test","univariate","equation","test"],
9.349 + ["Test","squ-equ-test-subpbl1"]);
9.350 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
9.351 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
9.352 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
9.353 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
9.354 +(*nxt = ("Add_Find", Add_Find "solutions L")*)
9.355 +
9.356 +val nxt = ("Specify_Problem",(*vvvv---specify a not-matching problem*)
9.357 + Specify_Problem ["linear","univariate","equation","test"]);
9.358 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
9.359 +(*ML> f;
9.360 +val it = Form' (PpcKF (0,EdUndef,0,Nundef,
9.361 + (Problem ["linear","univariate","equation","test"],
9.362 + {Find=[Incompl "solutions []"],
9.363 + Given=[Correct "equality ((x + #1) * (x + #2) = x ^^^ #2 + #8)",
9.364 + Correct "solveFor x"],Relate=[],
9.365 + Where=[False "matches (x = #0) ((x + #1) * (x + #2) = x ^^^ #2 + #8)
9.366 + |\nmatches (?b * x = #0) ((x + #1) * (x + #2) = x ^^^ #2 + #8)
9.367 + |\nmatches (?a + x = #0) ((x + #1) * (x + #2) = x ^^^ #2 + #8)
9.368 + |\nmatches (?a + ?b * x = #0) ((x + #1) * (x + #2) = x ^^^ #2 + #8)"],
9.369 + With=[]}))) : mout
9.370 +val nxt = ("Add_Find",Add_Find "solutions L") ????!!!!????*)
9.371 +
9.372 +val (p,_,f,nxt,_,pt) = (me nxt p c pt) handle e => print_exn e;
9.373 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*NEW2*);
9.374 +(*val nxt = ("Empty_Tac",Empty_Tac)
9.375 +... Refine_Problem ["linear"..] fails internally 040312: works!?!*)
9.376 +
9.377 +val nxt = ("Refine_Problem",Refine_Problem ["univariate","equation","test"]);
9.378 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
9.379 +(*("Specify_Problem", Specify_Problem ["normalize", "univariate", ...])*)
9.380 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
9.381 +(*nxt = ("Specify_Theory", Specify_Theory "Test.thy")*)
9.382 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
9.383 +(*nxt = ("Specify_Method", Specify_Method ["Test", "squ-equ-test-subpbl1"]*)
9.384 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
9.385 +(*nxt = ("Apply_Method", *)
9.386 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
9.387 +(*nxt = ("Rewrite_Set", Rewrite_Set "norm_equation")*)
9.388 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
9.389 +(*nxt = ("Rewrite_Set", Rewrite_Set "Test_simplify")*)
9.390 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
9.391 +(*Subproblem ("Test.thy", ["linear", "univariate", "equation", "test"]*)
9.392 +
9.393 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
9.394 +(*nxt = Model_Problem ["linear","univariate","equation","test"]*)
9.395 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
9.396 +(*nxt = ("Add_Given", Add_Given "equality (-6 + 3 * x = 0)"*)
9.397 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
9.398 +(**)
9.399 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
9.400 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
9.401 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
9.402 +(*nxt = Specify_Problem ["linear","univariate","equation","test"])*)
9.403 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
9.404 +(*xt = ("Specify_Method", Specify_Method ["Test", "solve_linear"])*)
9.405 +val nxt = ("Refine_Problem",Refine_Problem ["univariate","equation","test"]);
9.406 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
9.407 +(*("Specify_Problem", Specify_Problem ["linear", "univariate", ...])*)
9.408 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
9.409 +(*val nxt = ("Specify_Method",Specify_Method ("Test","solve_linear"))*)
9.410 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
9.411 +(*val nxt = ("Apply_Method",Apply_Method ("Test","solve_linear"))*)
9.412 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
9.413 +(*val nxt = ("Rewrite_Set_Inst",Rewrite_Set_Inst ([#],"isolate_bdv"))*)
9.414 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
9.415 +(*val nxt = ("Rewrite_Set",Rewrite_Set "Test_simplify")*)
9.416 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
9.417 +(*val nxt = ("Check_Postcond",Check_Postcond ["linear","univariate","eq*)
9.418 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
9.419 +(*val nxt = ("Check_elementwise",Check_elementwise "Assumptions")*)
9.420 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
9.421 +(*Check_Postcond ["normalize","univariate","equation","test"])*)
9.422 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
9.423 +val Form' (FormKF (~1,EdUndef,_,Nundef,res)) = f;
9.424 +if (snd nxt)=End_Proof' andalso res="[x = 2]" then ()
9.425 +else raise error "new behaviour in test:refine.sml:miniscript with mini-subpb";
9.426 +
9.427 +
9.428 +"----------- fun coll_guhs ---------------------------------------";
9.429 +"----------- fun coll_guhs ---------------------------------------";
9.430 +"----------- fun coll_guhs ---------------------------------------";
9.431 +val n = e_pbt;
9.432 +(#guh : pbt -> guh) e_pbt;
9.433 +
9.434 +fun XXXnode coll (Ptyp (_,[n],ns)) =
9.435 + [(#guh : pbt -> guh) n]
9.436 +and XXXnodes coll [] = coll
9.437 + | XXXnodes coll (n::ns : pbt ptyp list) = (XXXnode coll n) @
9.438 + (XXXnodes coll ns);
9.439 +(*^^^ this works, but not this ...
9.440 +fun node coll (Ptyp (_,[n],ns)) =
9.441 + [(#guh : 'a -> guh) n]
9.442 +and nodes coll [] = coll
9.443 + | nodes coll (n::ns : 'a ptyp list) = (node coll n) @ (nodes coll ns);
9.444 +
9.445 +Error:
9.446 +Can't unify {guh: 'a, ...} with 'b (Cannot unify with explicit type variable)
9.447 + Found near #guh : 'a -> guh
9.448 +
9.449 +i.e. there is no common fun for pbls and mets ?!?*)
9.450 +
9.451 +coll_pblguhs (!ptyps);
9.452 +sort string_ord (coll_pblguhs (!ptyps));
9.453 +show_pblguhs ();
9.454 +sort_pblguhs ();
9.455 +
9.456 +"----------- fun guh2kestoreID -----------------------------------";
9.457 +"----------- fun guh2kestoreID -----------------------------------";
9.458 +"----------- fun guh2kestoreID -----------------------------------";
9.459 +"----- we assumed the problem-hierarchy containing 3 elements on toplevel";
9.460 +val (Ptyp (id1,[n1 as {guh=guh1,...} : pbt], ns1)::
9.461 + Ptyp (id2,[n2 as {guh=guh2,...} : pbt], ns2):: _) = (!ptyps);
9.462 +(*
9.463 +nodes [] guh1 (!ptyps);
9.464 +nodes [] guh2 (!ptyps);
9.465 +*)
9.466 +val (Ptyp (id1,[n1 as {guh=guh1,...} : pbt], ns1)
9.467 + ::
9.468 + Ptyp (id2,[n2 as {guh=guh2,...} : pbt],
9.469 + (Ptyp (id21,[n21 as {guh=guh21,...} : pbt], ns21)) :: _ )
9.470 + ::
9.471 + Ptyp (id3,[n3 as {guh=guh3,...} : pbt], ns3)
9.472 + ::
9.473 + _ ) = (!ptyps);
9.474 +(*
9.475 +nodes [] guh3 (!ptyps);
9.476 +nodes [] guh21 (!ptyps);
9.477 +*)
9.478 \ No newline at end of file
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/test/Tools/isac/Interpret/rewtools.sml Mon Aug 30 14:35:51 2010 +0200
10.3 @@ -0,0 +1,533 @@
10.4 +(* test for sml/ME/rewtools.sml
10.5 + authors: Walther Neuper 2000, 2006
10.6 + (c) due to copyright terms
10.7 +
10.8 +use"../smltest/ME/rewtools.sml";
10.9 +use"rewtools.sml";
10.10 +*)
10.11 +
10.12 +"-----------------------------------------------------------------";
10.13 +"table of contents -----------------------------------------------";
10.14 +"-----------------------------------------------------------------";
10.15 +"----------- fun collect_isab_thys -------------------------------";
10.16 +"----------- fun thy_containing_thm ------------------------------";
10.17 +"----------- fun thy_containing_rls ------------------------------";
10.18 +"----------- fun thy_containing_cal ------------------------------";
10.19 +"----------- initContext Thy_ Integration-demo -------------------";
10.20 +"----------- initContext..Thy_, fun context_thm ------------------";
10.21 +"----------- initContext..Thy_, fun context_rls ------------------";
10.22 +"----------- checkContext..Thy_, fun context_thy -----------------";
10.23 +"----------- checkContext..Thy_, fun context_rls -----------------";
10.24 +"----------- checkContext..Thy_ on last formula ------------------";
10.25 +"----------- fun guh2theID ---------------------------------------";
10.26 +"----------- debugging on Tests/solve_linear_as_rootpbl ----------";
10.27 +"-----------------------------------------------------------------";
10.28 +"----------- fun string_of_thmI for_[.]_) ------------------------";
10.29 +"----------- (sym_real_minus_eq_cancel, (?b1 = ?a1) ..._[.]_)-----";
10.30 +"-----------------------------------------------------------------";
10.31 +"----------- fun filter_appl_rews --------------------------------";
10.32 +"----------- fun is_contained_in ---------------------------------";
10.33 +"-----------------------------------------------------------------";
10.34 +"-----------------------------------------------------------------";
10.35 +
10.36 +
10.37 +
10.38 +"----------- fun collect_isab_thys -------------------------------";
10.39 +"----------- fun collect_isab_thys -------------------------------";
10.40 +"----------- fun collect_isab_thys -------------------------------";
10.41 +val thy = first_isac_thy (*def. in Script/ListG.ML*);
10.42 +val {ancestors,...} = rep_theory thy;
10.43 +print_depth 99; map string_of_thy ancestors; print_depth 3;
10.44 +length ancestors;
10.45 +val ancestors = (#ancestors o rep_theory) first_isac_thy;
10.46 +length ancestors;
10.47 +print_depth 99; map theory2theory' ancestors; print_depth 3;
10.48 +val isabthms = (flat o (map PureThy.all_thms_of)) ancestors;
10.49 +length isabthms;
10.50 +
10.51 +val isacrules = (flat o (map (thms_of_rls o #2 o #2))) (!ruleset');
10.52 +(*thms from rulesets*)
10.53 +val isacrlsthms = ((map rep_thm_G') o flat o
10.54 + (map (PureThy.all_thms_of_rls o #2 o #2))) (!ruleset');
10.55 +length isacrlsthms;
10.56 +(*takes a few seconds...
10.57 +val isacrlsthms = gen_distinct eq_thmI isacrlsthms;
10.58 +length isacrlsthms;
10.59 +"----- theorems used in isac's rulesets -----vvvvvvvvvvvvvvvvvvvvv";
10.60 +print_depth 99; map #1 isacrlsthms; print_depth 3;
10.61 +"----- theorems used in isac's rulesets -----^^^^^^^^^^^^^^^^^^^^^";
10.62 +...*)
10.63 +
10.64 +(!theory');
10.65 +map #2 (!theory');
10.66 +map (PureThy.all_thms_of o #2) (!theory');
10.67 +val isacthms = (flat o (map (PureThy.all_thms_of o #2))) (!theory');
10.68 +(*takes a few seconds...
10.69 +val rlsthmsNOTisac = gen_diff eq_thmI (isacrlsthms, isacthms);
10.70 +length rlsthmsNOTisac;
10.71 +"----- theorems from rulesets NOT def. in isac -----vvvvvvvvvvvvvv";
10.72 +print_depth 99; map #1 rlsthmsNOTisac; print_depth 3;
10.73 +"----- theorems from rulesets NOT def. in isac -----^^^^^^^^^^^^^^";
10.74 +...*)
10.75 +
10.76 +"----- for 'fun make_isab_thm_thy'";
10.77 +inter eq_thmI isacrlsthms (PureThy.all_thms_of (nth 1 ancestors));
10.78 +inter eq_thmI;
10.79 +(inter eq_thmI);
10.80 +(inter eq_thmI) isacrlsthms;
10.81 +(*takes a few seconds...
10.82 +curry (inter eq_thmI) isacrlsthms (PureThy.all_thms_of (nth 9 ancestors));
10.83 +
10.84 +val thy = (nth 52 ancestors);
10.85 +val sec = ((inter eq_thmI) isacrlsthms o PureThy.all_thms_of) (nth 52 ancestors);
10.86 +length (PureThy.all_thms_of (nth 9 ancestors));
10.87 +length sec;
10.88 +...*)
10.89 +
10.90 +(*takes 1 minute...
10.91 +print_depth 99;
10.92 +map ((inter eq_thmI) rlsthmsNOTisac o PureThy.all_thms_of) ancestors;
10.93 +print_depth 3;
10.94 +*)
10.95 +
10.96 +(*takes some seconds...
10.97 +val isab_thm_thy = (flat o (map (make_isab_thm_thy rlsthmsNOTisac)))
10.98 + ((#ancestors o rep_theory) first_isac_thy);
10.99 +print_depth 99; isab_thm_thy; print_depth 3;
10.100 +*)
10.101 +
10.102 +
10.103 +"----------- fun thy_containing_thm ------------------------------";
10.104 +"----------- fun thy_containing_thm ------------------------------";
10.105 +"----------- fun thy_containing_thm ------------------------------";
10.106 +val (str, (thy', thy)) = ("real_diff_minus",("Root.thy", Root.thy));
10.107 +if thy_contains_thm str ("XXX",thy) then ()
10.108 +else raise error "rewtools.sml: NOT thy_contains_thm \
10.109 + \(real_diff_minus,(Root.thy,.";
10.110 +(rev (!theory'));
10.111 +dropuntil (curry op= thy');
10.112 +dropuntil ((curry op= thy') o (#1:theory' * theory -> theory'));
10.113 +val startsearch = dropuntil ((curry op= thy') o
10.114 + (#1:theory' * theory -> theory'))
10.115 + (rev (!theory'));
10.116 +if thy_containing_thm thy' str = ("IsacKnowledge", "Root.thy") then ()
10.117 +else raise error "rewtools.sml: NOT thy_containin_thm \
10.118 + \(real_diff_minus,(Root.thy,.";
10.119 +
10.120 +"----- search the same theorem somewhere further below in the list";
10.121 +if thy_contains_thm str ("XXX",Poly.thy) then ()
10.122 +else raise error "rewtools.sml: NOT thy_contains_thm \
10.123 + \(real_diff_minus,(Poly.thy,.";
10.124 +if thy_containing_thm "LinEq.thy" str = ("IsacKnowledge", "Poly.thy") then ()
10.125 +else raise error "rewtools.sml: NOT thy_containing_thm \
10.126 + \(real_diff_minus,(Poly.thy,.";
10.127 +
10.128 +"----- second test -------------------------------";
10.129 +show_thes();
10.130 +(*args vor thy_containing_thm...*)
10.131 +val (thy',str) = ("Test.thy", "radd_commute");
10.132 +val startsearch = dropuntil ((curry op= thy') o
10.133 + (#1:theory' * theory -> theory'))
10.134 + (rev (!theory'));
10.135 +length (!theory');
10.136 +length startsearch;
10.137 +if thy_containing_thm thy' str = ("IsacKnowledge", "Test.thy") then ()
10.138 +else raise error "rewtools.sml: diff.behav. in \
10.139 + \thy_containing_thm Test radd_commute";
10.140 +
10.141 +
10.142 +"----------- fun thy_containing_rls ------------------------------";
10.143 +"----------- fun thy_containing_rls ------------------------------";
10.144 +"----------- fun thy_containing_rls ------------------------------";
10.145 +val thy' = "Biegelinie.thy";
10.146 +val dropthys = takewhile [] (not o (curry op= thy') o
10.147 + (#1:theory' * theory -> theory'))
10.148 + (rev (!theory'));
10.149 +if length (!theory') <> length dropthys then ()
10.150 +else raise error "rewtools.sml: diff.behav. in thy_containing_rls 1";
10.151 +val dropthy's = map (get_thy o (#1 : (theory' * theory) -> theory'))
10.152 + dropthys;
10.153 +print_depth 99; dropthy's; print_depth 3;
10.154 +
10.155 +(*WN100819========================================================
10.156 +"Isac" mem dropthy's;
10.157 +op mem ("Isac", dropthy's);
10.158 +(op mem) o swap;
10.159 +((op mem) o swap) (dropthy's, "Isac");
10.160 +curry ((op mem) o swap);
10.161 +curry ((op mem) o swap) dropthy's "Isac";
10.162 +val startsearch = filter_out ((curry ((op mem) o swap) dropthy's) o
10.163 + ((#1 o #2) : rls' * (theory' * rls) -> theory'))
10.164 + (rev (!ruleset'));
10.165 +print_depth 99; map (#1 o #2) startsearch; print_depth 3;
10.166 +if length (!ruleset') <> length startsearch then ()
10.167 +else raise error "rewtools.sml: diff.behav. in thy_containing_rls 2";
10.168 +
10.169 +val rls' = "norm_Poly";
10.170 +case assoc (startsearch, rls') of
10.171 + SOME (thy', _) => thyID2theory' thy'
10.172 + | _ => raise error ("thy_containing_rls : rls '"^str^
10.173 + "' not in !rulset' und thy '"^thy'^"'");
10.174 +
10.175 +if thy_containing_rls thy' rls' = ("IsacKnowledge", "Poly.thy") then ()
10.176 +else raise error "rewtools.sml: diff.behav. in thy_containing_rls 3";
10.177 +
10.178 +
10.179 +"----------- fun thy_containing_cal ------------------------------";
10.180 +"----------- fun thy_containing_cal ------------------------------";
10.181 +"----------- fun thy_containing_cal ------------------------------";
10.182 +val thy' = "Atools.thy";
10.183 +val dropthys = takewhile [] (not o (curry op= thy') o
10.184 + (#1:theory' * theory -> theory'))
10.185 + (rev (!theory'));
10.186 +length dropthys <> length (!theory');
10.187 +val dropthy's = map (get_thy o (#1 : (theory' * theory) -> theory'))
10.188 + dropthys;
10.189 +
10.190 +(rev (!calclist'));
10.191 +map #1 (rev (!calclist'));
10.192 +map (#1 : calc -> string) (rev (!calclist'));
10.193 +val startsearch = filter_out ((curry ((op mem) o swap) dropthy's) o
10.194 + (#1 : calc -> string)) (rev (!calclist'));
10.195 +========================================================WN100819*)
10.196 +
10.197 +"----------- initContext Thy_ Integration-demo -------------------";
10.198 +"----------- initContext Thy_ Integration-demo -------------------";
10.199 +"----------- initContext Thy_ Integration-demo -------------------";
10.200 +states:=[];
10.201 +CalcTree
10.202 +[(["functionTerm (2 * x)","integrateBy x","antiDerivative FF"],
10.203 + ("Integrate.thy",["integrate","function"],
10.204 + ["diff","integration"]))];
10.205 +Iterator 1;
10.206 +moveActiveRoot 1;
10.207 +(*TODO.new_c: cvs before 071227, 11:50------------------
10.208 +autoCalculate 1 CompleteCalc;
10.209 +interSteps 1 ([1],Res);
10.210 +interSteps 1 ([1,1],Res);
10.211 +val ((pt,p),_) = get_calc 1; show_pt pt;
10.212 +if existpt' ([1,1,1], Frm) pt then ()
10.213 +else raise error "integrate.sml: interSteps on Rewrite_Set_Inst 1";
10.214 +
10.215 +initContext 1 Thy_ ([1,1,1], Frm);
10.216 +--------------------TODO.new_c: cvs before 071227, 11:50*)
10.217 +
10.218 +"----------- initContext..Thy_, fun context_thm ------------------";
10.219 +"----------- initContext..Thy_, fun context_thm ------------------";
10.220 +"----------- initContext..Thy_, fun context_thm ------------------";
10.221 +states:=[];
10.222 +CalcTree (*start of calculation, return No.1*)
10.223 +[(["equality (x+1=2)", "solveFor x","solutions L"],
10.224 + ("Test.thy",
10.225 + ["sqroot-test","univariate","equation","test"],
10.226 + ["Test","squ-equ-test-subpbl1"]))];
10.227 +Iterator 1; moveActiveRoot 1;
10.228 +autoCalculate 1 CompleteCalc;
10.229 +
10.230 +"----- no thy-context at result -----";
10.231 +val p = ([], Res);
10.232 +initContext 1 Thy_ p;
10.233 +
10.234 +
10.235 +interSteps 1 ([2], Res);
10.236 +interSteps 1 ([3,1], Res);
10.237 +val ((pt,_),_) = get_calc 1; show_pt pt;
10.238 +
10.239 +val p = ([2,4], Res);
10.240 +val tac = Rewrite ("radd_left_commute","");
10.241 +initContext 1 Thy_ p;
10.242 +(*Res->Res, Rewrite "radd_left_commute 1 + (-2 + x) = 0 -> -2 + (1 + x) = 0
10.243 + --- in initContext..Thy_ ---*)
10.244 +val ContThm {thm,result,...} = context_thy (pt,p) tac;
10.245 +if thm = "thy_isac_Test-thm-radd_left_commute"
10.246 + andalso term2str result = "-2 + (1 + x) = 0" then ()
10.247 +else raise error"rewtools.sml initContext..Th_ thy_Test-thm-radd_left_commute";
10.248 +
10.249 +val p = ([3,1,1], Frm);
10.250 +val tac = Rewrite_Inst (["(bdv, x)"],("risolate_bdv_add",""));
10.251 +initContext 1 Thy_ p;
10.252 +(*Frm->Res, Rewrite_Inst "risolate_bdv_add" -1 + x = 0 -> x = 0 + -1 * -1
10.253 + --- in initContext..Thy_ ---*)
10.254 +val ContThmInst {thm,result,...} = context_thy (pt,p) tac;
10.255 +if thm = "thy_isac_Test-thm-risolate_bdv_add"
10.256 + andalso term2str result = "x = 0 + -1 * -1" then ()
10.257 +else raise error "rewtools.sml initContext..Th_ thy_Test-thm-risolate_bdv_add";
10.258 +
10.259 +initContext 1 Thy_ ([2,5], Res);
10.260 +(*Res->Res, Calculate "plus" -2 + (1 + x) = 0 -> -1 + x = 0
10.261 + --- in initContext..Thy_ ---*)
10.262 +
10.263 +
10.264 +"----------- initContext..Thy_, fun context_rls ------------------";
10.265 +"----------- initContext..Thy_, fun context_rls ------------------";
10.266 +"----------- initContext..Thy_, fun context_rls ------------------";
10.267 +(*using pt from above*)
10.268 +val p = ([1], Res);
10.269 +val tac = Rewrite_Set "Test_simplify";
10.270 +initContext 1 Thy_ p;
10.271 +(*Res->Res, Rewrite_Set "Test_simplify" x + 1 + -1 * 2 = 0 -> -1 + x = 0
10.272 + --- in initContext..Thy_ ---*)
10.273 +val ContRls {rls,result,...} = context_thy (pt,p) tac;
10.274 +if rls = "thy_isac_Test-rls-Test_simplify"
10.275 + andalso term2str result = "-1 + x = 0" then ()
10.276 +else raise error "rewtools.sml initContext..Th_ thy_Test-thm-risolate_bdv_add";
10.277 +
10.278 +val p = ([3,1], Frm);
10.279 +val tac = Rewrite_Set_Inst (["(bdv, x)"],"isolate_bdv");
10.280 +initContext 1 Thy_ p;
10.281 +(*Frm->Res, Rewrite_Set_Inst "isolate_bdv" -1 + x = 0 -> x = 0 + -1 * -1
10.282 + --- in initContext..Thy_ ---*)
10.283 +val ContRlsInst {rls,result,...} = context_thy (pt,p) tac;
10.284 +if rls = "thy_isac_Test-rls-isolate_bdv"
10.285 + andalso term2str result = "x = 0 + -1 * -1" then ()
10.286 +else raise error "rewtools.sml initContext..Th_ thy_Test-thm-risolate_bdv_add";
10.287 +
10.288 +
10.289 +
10.290 +"----------- checkContext..Thy_, fun context_thy -----------------";
10.291 +"----------- checkContext..Thy_, fun context_thy -----------------";
10.292 +"----------- checkContext..Thy_, fun context_thy -----------------";
10.293 +(*using pt from above*)
10.294 +
10.295 +val p = ([2,4], Res);
10.296 +val tac = Rewrite ("radd_left_commute","");
10.297 +checkContext 1 p "thy_Test-thm-radd_left_commute";
10.298 +(* radd_left_commute: 1 + (-2 + x) = 0 -> -2 + (1 + x) = 0
10.299 + --- in checkContext..Thy_ ---*)
10.300 +val ContThm {thm,result,...} = context_thy (pt,p) tac;
10.301 +if thm = "thy_isac_Test-thm-radd_left_commute"
10.302 + andalso term2str result = "-2 + (1 + x) = 0" then ()
10.303 +else raise error "rewtools.sml checkContext.._ thy_Test-thm-radd_left_commute";
10.304 +
10.305 +val p = ([3,1,1], Frm);
10.306 +val tac = Rewrite_Inst (["(bdv,x)"],("risolate_bdv_add",""));
10.307 +checkContext 1 p "thy_Test-thm-risolate_bdv_add";
10.308 +(* risolate_bdv_add: -1 + x = 0 -> x = 0 + -1 * -1
10.309 + --- in checkContext..Thy_ ---*)
10.310 +val ContThmInst {thm,result,...} = context_thy (pt,p) tac;
10.311 +if thm = "thy_isac_Test-thm-risolate_bdv_add"
10.312 + andalso term2str result = "x = 0 + -1 * -1" then ()
10.313 +else raise error "rewtools.sml checkContext..T_ thy_Test-thm-risolate_bdv_add";
10.314 +
10.315 +val p = ([2,5], Res);
10.316 +val tac = Calculate "plus";
10.317 +(*checkContext..Thy_ 1 ([2,5], Res);*)
10.318 +(*FIXXXME #######################vvvvv kestoreID !!!!!!!!!!!!!!!!*)
10.319 +checkContext 1 p ;
10.320 +(* Calculate "plus" -2 + (1 + x) = 0 -> -1 + x = 0
10.321 + --- in checkContext..Thy_ ---*)
10.322 +
10.323 +
10.324 +"----------- checkContext..Thy_, fun context_rls -----------------";
10.325 +"----------- checkContext..Thy_, fun context_rls -----------------";
10.326 +"----------- checkContext..Thy_, fun context_rls -----------------";
10.327 +(*using pt from above*)
10.328 +show_pt pt;
10.329 +
10.330 +val p = ([1], Res);
10.331 +val tac = Rewrite_Set "Test_simplify";
10.332 +checkContext 1 p "thy_isac_Test-rls-Test_simplify";
10.333 +(*Res->Res, Rewrite_Set "Test_simplify" x + 1 + -1 * 2 = 0 -> -1 + x = 0
10.334 + --- in checkContext..Thy_ ---*)
10.335 +val ContRls {rls,result,...} = context_thy (pt,p) tac;
10.336 +if rls = "thy_isac_Test-rls-Test_simplify"
10.337 + andalso term2str result = "-1 + x = 0" then ()
10.338 +else raise error "rewtools.sml checkContext..Thy_ thy_Test-rls-Test_simplify";
10.339 +
10.340 +val p = ([3,1], Frm);
10.341 +val tac = Rewrite_Set_Inst (["(bdv, x)"],"isolate_bdv");
10.342 +checkContext 1 p "thy_Test-rls-isolate_bdv";
10.343 +val ContRlsInst {rls,result,...} = context_thy (pt,p) tac;
10.344 +if rls = "thy_isac_Test-rls-isolate_bdv"
10.345 + andalso term2str result = "x = 0 + -1 * -1" then ()
10.346 +else raise error "rewtools.sml checkContext..Thy_ thy_Test-thm-isolate_bdv";
10.347 +
10.348 +
10.349 +"----------- checkContext..Thy_ on last formula ------------------";
10.350 +"----------- checkContext..Thy_ on last formula ------------------";
10.351 +"----------- checkContext..Thy_ on last formula ------------------";
10.352 +states:=[];
10.353 +CalcTree (*start of calculation, return No.1*)
10.354 +[(["equality (x+1=2)", "solveFor x","solutions L"],
10.355 + ("Test.thy",
10.356 + ["sqroot-test","univariate","equation","test"],
10.357 + ["Test","squ-equ-test-subpbl1"]))];
10.358 +Iterator 1; moveActiveRoot 1;
10.359 +
10.360 +autoCalculate 1 CompleteCalcHead;
10.361 +autoCalculate 1 (Step 1);
10.362 +val (ptp as (pt,p), tacis) = get_calc 1; show_pt pt;
10.363 +initContext 1 Thy_ ([1], Frm);
10.364 +checkContext 1 ([1], Frm) "thy_isac_Test-thm-radd_left_commute";
10.365 +
10.366 +autoCalculate 1 (Step 1);
10.367 +val (ptp as (pt,p), tacis) = get_calc 1; show_pt pt;
10.368 +initContext 1 Thy_ ([1], Res);
10.369 +checkContext 1 ([1], Res) "thy_isac_Test-rls-Test_simplify";
10.370 +
10.371 +
10.372 +
10.373 +"----------- fun guh2theID ---------------------------------------";
10.374 +"----------- fun guh2theID ---------------------------------------";
10.375 +"----------- fun guh2theID ---------------------------------------";
10.376 +val guh = "thy_scri_ListG-thm-zip_Nil";
10.377 +
10.378 +take_fromto 1 4 (explode guh);
10.379 +take_fromto 5 9 (explode guh);
10.380 +val rest = takerest (9,(explode guh));
10.381 +
10.382 +separate "-" rest;
10.383 +space_implode "-" rest;
10.384 +commas rest;
10.385 +
10.386 +val delim = "-";
10.387 +val thyID = takewhile [] (not o (curry op= delim)) rest;
10.388 +val rest' = dropuntil (curry op= delim) rest;
10.389 +val setc = take_fromto 1 5 rest';
10.390 +val xstr = takerest (5, rest');
10.391 +
10.392 +if guh2theID guh = ["IsacScripts", "ListG", "Theorems", "zip_Nil"] then ()
10.393 +else raise error "rewtools.sml: guh2theID thy_scri_ListG-thm-zip_Nil changed";
10.394 +
10.395 +
10.396 +"----------- debugging on Tests/solve_linear_as_rootpbl ----------";
10.397 +"----------- debugging on Tests/solve_linear_as_rootpbl ----------";
10.398 +"----------- debugging on Tests/solve_linear_as_rootpbl ----------";
10.399 +"----- initContext -----";
10.400 +states:=[];
10.401 +CalcTree
10.402 + [(["equality (1+-1*2+x=0)", "solveFor x", "solutions L"],
10.403 + ("Test.thy",
10.404 + ["linear","univariate","equation","test"],
10.405 + ["Test","solve_linear"]))];
10.406 +Iterator 1; moveActiveRoot 1;
10.407 +autoCalculate 1 CompleteCalcHead;
10.408 +
10.409 +autoCalculate 1 (Step 1); val (ptp as (pt,p), tacis) = get_calc 1; show_pt pt;
10.410 +if is_curr_endof_calc pt ([1],Frm) then ()
10.411 +else raise error "rewtools.sml is_curr_endof_calc ([1],Frm)";
10.412 +
10.413 +autoCalculate 1 (Step 1); val (ptp as (pt,p), tacis) = get_calc 1; show_pt pt;
10.414 +if not (is_curr_endof_calc pt ([1],Frm)) then ()
10.415 +else raise error "rewtools.sml is_curr_endof_calc ([1],Frm) not";
10.416 +if is_curr_endof_calc pt ([1],Res) then ()
10.417 +else raise error "rewtools.sml is_curr_endof_calc ([1],Res)";
10.418 +
10.419 +initContext 1 Thy_ ([1],Res);
10.420 +
10.421 +"----- checkContext -----";
10.422 +states:=[];
10.423 +CalcTree
10.424 + [(["equality (1+-1*2+x=0)", "solveFor x", "solutions L"],
10.425 + ("Test.thy",
10.426 + ["linear","univariate","equation","test"],
10.427 + ["Test","solve_linear"]))];
10.428 +Iterator 1; moveActiveRoot 1;
10.429 +autoCalculate 1 CompleteCalc;
10.430 +interSteps 1 ([1],Res);
10.431 +val (ptp as (pt,p), tacis) = get_calc 1; show_pt pt;
10.432 +
10.433 +checkContext 1 ([1],Res) "thy_isac_Test-rls-Test_simplify";
10.434 +
10.435 +interSteps 1 ([2],Res);
10.436 +val (ptp as (pt,p), tacis) = get_calc 1; show_pt pt;
10.437 +
10.438 +checkContext 1 ([2,1],Res) "thy_isac_Test-rls-Test_simplify";
10.439 +checkContext 1 ([2,2],Res) "thy_isac_Test-rls-Test_simplify";
10.440 +
10.441 +
10.442 +"----------- fun string_of_thmI for_[.]_) ------------------------";
10.443 +"----------- fun string_of_thmI for_[.]_) ------------------------";
10.444 +"----------- fun string_of_thmI for_[.]_) ------------------------";
10.445 +"----- these work ?!?";
10.446 +val th = sym_thm real_minus_eq_cancel;
10.447 +val Th = sym_Thm (Thm ("real_minus_eq_cancel", real_minus_eq_cancel));
10.448 +val th'= mk_thm Isac.thy ((de_quote o string_of_thm) real_minus_eq_cancel);
10.449 +val th'= mk_thm Biegelinie.thy((de_quote o string_of_thm)real_minus_eq_cancel);
10.450 +
10.451 +"----- DIFFERENCE TO ABOVE ?!?: this is still ok, when called in next_tac...";
10.452 +val ((pt,(p,p_)), _) = get_calc 1; show_pt pt;
10.453 +val Appl (Rewrite' (_,_,_,_,thm',_,_)) =
10.454 + applicable_in (p,p_) pt (Rewrite ("sym_real_minus_eq_cancel",""));
10.455 +"- compose stac as done in | appy (*leaf*) by handle_leaf";
10.456 +val (th, sr, E, a, v, t) =
10.457 + ("Biegelinie.thy",
10.458 + (#srls o get_met) ["IntegrierenUndKonstanteBestimmen"],
10.459 + [(str2term "q__::bool", str2term "q x = q_0")],
10.460 + SOME (str2term "q x = q_0"),
10.461 + str2term "q__::bool",
10.462 + str2term "(Rewrite sym_real_minus_eq_cancel False) (q__::bool)");
10.463 +val (a', STac stac) = handle_leaf "next " th sr E a v t;
10.464 +term2str stac;
10.465 +"--- but this \"m\" is already corrupted";
10.466 +val (m,_) = stac2tac_ EmptyPtree (assoc_thy th) stac;
10.467 +"- because in assoc_thm'...";
10.468 +val (thy, (thmid, ct')) = (Biegelinie.thy, ("sym_real_minus_eq_cancel",""));
10.469 +val "s"::"y"::"m"::"_"::id = explode thmid;
10.470 +((num_str o (get_thm thy)) (implode id)) RS sym;
10.471 +((get_thm thy) (implode id)) RS sym;
10.472 +"... this creates [.]";
10.473 +((get_thm thy) (implode id));
10.474 +"... while this has _NO_ [.]";
10.475 +
10.476 +"----- thus we repair the [.] in string_of_thmI...";
10.477 +val thm = ((num_str o (get_thm thy)) (implode id)) RS sym;
10.478 +if string_of_thmI thm = "(?b1 = ?a1) = (- ?b1 = - ?a1)" then ()
10.479 +else raise error ("rewtools.sml: string_of_thmI " ^ string_of_thm thm ^
10.480 + " = " ^ string_of_thmI thm);
10.481 +
10.482 +
10.483 +"----------- (sym_real_minus_eq_cancel, (?b1 = ?a1) ..._[.]_)-----";
10.484 +"----------- (sym_real_minus_eq_cancel, (?b1 = ?a1) ..._[.]_)-----";
10.485 +"----------- (sym_real_minus_eq_cancel, (?b1 = ?a1) ..._[.]_)-----";
10.486 +states:=[];
10.487 +CalcTree [(["Traegerlaenge L","Streckenlast q_0","Biegelinie y",
10.488 + "RandbedingungenBiegung [y 0 = 0, y L = 0]",
10.489 + "RandbedingungenMoment [M_b 0 = 0, M_b L = 0]",
10.490 + "FunktionsVariable x"],
10.491 + ("Biegelinie.thy",
10.492 + ["MomentBestimmte","Biegelinien"],
10.493 + ["IntegrierenUndKonstanteBestimmen"]))];
10.494 +moveActiveRoot 1;
10.495 +autoCalculate 1 CompleteCalcHead;
10.496 +autoCalculate 1 (Step 1) (*Apply_Method*);
10.497 +autoCalculate 1 (Step 1) (*->GENERATED ([1], Frm)*);
10.498 +"--- this was corrupted before 'fun string_of_thmI'";
10.499 +val ((pt,(p,p_)), _) = get_calc 1; show_pt pt;
10.500 +if get_obj g_tac pt p = Rewrite ("sym_real_minus_eq_cancel",
10.501 + "(?b1 = ?a1) = (- ?b1 = - ?a1)") then ()
10.502 +else raise error "rewtools.sml: string_of_thmI ?!?";
10.503 +
10.504 +getTactic 1 ([1],Frm);
10.505 +
10.506 +"----------- fun filter_appl_rews --------------------------------";
10.507 +"----------- fun filter_appl_rews --------------------------------";
10.508 +"----------- fun filter_appl_rews --------------------------------";
10.509 +val f = str2term "a + z + 2*a + 3*z + 5 + 6";
10.510 +val thy = assoc_thy "Isac.thy";
10.511 +val subst = [(*TODO.WN071231 test Rewrite_Inst*)];
10.512 +val rls = Test_simplify;
10.513 +(* val rls = rls_p_33; filter_appl_rews ---> length 2
10.514 + val rls = norm_Poly; filter_appl_rews ---> length 1
10.515 + *)
10.516 +if filter_appl_rews thy subst f rls =
10.517 + [Rewrite ("radd_commute", "?m + ?n = ?n + ?m"),
10.518 + Rewrite ("radd_assoc", "?m + ?n + ?k = ?m + (?n + ?k)"),
10.519 + Calculate "plus"] then ()
10.520 +else raise error "rewtools.sml filter_appl_rews a + z + 2*a + 3*z + 5 + 6";
10.521 +
10.522 +
10.523 +"----------- fun is_contained_in ---------------------------------";
10.524 +"----------- fun is_contained_in ---------------------------------";
10.525 +"----------- fun is_contained_in ---------------------------------";
10.526 +val r1 = Thm ("real_diff_minus",num_str real_diff_minus);
10.527 +if contains_rule r1 Test_simplify then ()
10.528 +else raise error "rewtools.sml contains_rule Thm";
10.529 +
10.530 +val r1 = Calc ("op +", eval_binop "#add_");
10.531 +if contains_rule r1 Test_simplify then ()
10.532 +else raise error "rewtools.sml contains_rule Calc";
10.533 +
10.534 +val r1 = Calc ("op -", eval_binop "#add_");
10.535 +if not (contains_rule r1 Test_simplify) then ()
10.536 +else raise error "rewtools.sml contains_rule Calc";
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/test/Tools/isac/Interpret/script.sml Mon Aug 30 14:35:51 2010 +0200
11.3 @@ -0,0 +1,250 @@
11.4 +(* tests for ME/script.sml
11.5 + TODO.WN0509 collect typical tests from systest here !!!!!
11.6 + author: Walther Neuper 050908
11.7 + (c) copyright due to lincense terms.
11.8 +
11.9 +use"../smltest/ME/script.sml";
11.10 +use"script.sml";
11.11 +*)
11.12 +"-----------------------------------------------------------------";
11.13 +"table of contents -----------------------------------------------";
11.14 +"-----------------------------------------------------------------";
11.15 +"----------- WN0509 why does next_tac doesnt find Substitute -----";
11.16 +"----------- WN0509 Substitute 2nd part --------------------------";
11.17 +"----------- fun sel_appl_atomic_tacs ----------------------------";
11.18 +"-----------------------------------------------------------------";
11.19 +"-----------------------------------------------------------------";
11.20 +"-----------------------------------------------------------------";
11.21 +
11.22 +
11.23 +"----------- WN0509 why does next_tac doesnt find Substitute -----";
11.24 +"----------- WN0509 why does next_tac doesnt find Substitute -----";
11.25 +"----------- WN0509 why does next_tac doesnt find Substitute -----";
11.26 +
11.27 +(*replace met 'IntegrierenUndKonstanteBestimmen' with this script...*)
11.28 +val str = (*#1#*)
11.29 +"Script BiegelinieScript \
11.30 +\(l_::real) (q__::real) (v_::real) (b_::real=>real) \
11.31 +\(rb_::bool list) (rm_::bool list) = \
11.32 +\ (let q___ = Take (M_b v_ = q__); \
11.33 +\ (M1__::bool) = ((Substitute [v_ = 0])) q___ \
11.34 +\ in True)";
11.35 +val sc' = ((inst_abs thy) o term_of o the o (parse thy)) str;
11.36 +
11.37 +val str = (*#2#*)
11.38 +"Script BiegelinieScript \
11.39 +\(l_::real) (q__::real) (v_::real) (b_::real=>real) \
11.40 +\(rb_::bool list) (rm_::bool list) = \
11.41 +\ (let q___ = Take (q_ v_ = q__); \
11.42 +\ (M1__::bool) = ((Substitute [v_ = 0]) @@ \
11.43 +\ (Substitute [M_b 0 = 0])) q___ \
11.44 +\ in True)";(*..doesnt find Substitute with ..@@ !!!!!!!!!!!!!!!!!!!!!*)
11.45 +
11.46 +val str = (*#3#*)
11.47 +"Script BiegelinieScript \
11.48 +\(l_::real) (q__::real) (v_::real) (b_::real=>real) \
11.49 +\(rb_::bool list) (rm_::bool list) = \
11.50 +\ (let q___ = Take (q_ v_ = q__); \
11.51 +\ (M1__::bool) = Substitute [v_ = 0] q___ ; \
11.52 +\ M1__ = Substitute [M_b 0 = 0] M1__ \
11.53 +\ in True)"
11.54 +;
11.55 +val str = (*#4#*)
11.56 +"Script BiegelinieScript \
11.57 +\(l_::real) (q__::real) (v_::real) (b_::real=>real) \
11.58 +\(rb_::bool list) (rm_::bool list) = \
11.59 +\ (let q___ = Take (q_ v_ = q__); \
11.60 +\ (M1__::bool) = Substitute [v_ = 0] q___ ; \
11.61 +\ M1__ = Substitute [v_ = 1] q___ ; \
11.62 +\ M1__ = Substitute [v_ = 2] q___ ; \
11.63 +\ M1__ = Substitute [v_ = 3] q___ ; \
11.64 +\ M1__ = Substitute [M_b 0 = 0] M1__ \
11.65 +\ in True)"
11.66 +;
11.67 +val str = (*#5#*)
11.68 +"Script BiegelinieScript \
11.69 +\(l_::real) (q__::real) (v_::real) (b_::real=>real) \
11.70 +\(rb_::bool list) (rm_::bool list) = \
11.71 +\ (let q___ = Take (M_b v_ = q__); \
11.72 +\ (M1__::bool) = Substitute [v_ = 0] q___ ; \
11.73 +\ M2__ = Take q___ ; \
11.74 +\ M2__ = Substitute [v_ = 2] q___ \
11.75 +\ in True)"
11.76 +;
11.77 +val sc' = ((inst_abs thy) o term_of o the o (parse thy)) str;
11.78 +atomty sc';
11.79 +val {scr=Script sc,...} = get_met ["IntegrierenUndKonstanteBestimmen"];
11.80 +(*---------------------------------------------------------------------
11.81 +if sc = sc' then () else raise error"script.sml, doesnt find Substitute #1";
11.82 +---------------------------------------------------------------------*)
11.83 +
11.84 +val fmz = ["Traegerlaenge L",
11.85 + "Streckenlast (- q_0 * x^^^2 / 2 + x * c + c_2)",
11.86 + "Biegelinie y",
11.87 + "RandbedingungenBiegung [y 0 = 0, y L = 0]",
11.88 + "RandbedingungenMoment [M_b 0 = 0, M_b L = 0]",
11.89 + "FunktionsVariable x"];
11.90 +val (dI',pI',mI') =
11.91 + ("Biegelinie.thy",["MomentBestimmte","Biegelinien"],
11.92 + ["IntegrierenUndKonstanteBestimmen"]);
11.93 +val p = e_pos'; val c = [];
11.94 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
11.95 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
11.96 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
11.97 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
11.98 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
11.99 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
11.100 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
11.101 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
11.102 +case nxt of (_, Apply_Method ["IntegrierenUndKonstanteBestimmen"]) => ()
11.103 + | _ => raise error "script.sml, doesnt find Substitute #2";
11.104 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
11.105 +(* *** generate1: not impl.for Substitute' !!!!!!!!!!(*#1#*)!!!!!!!!!!!*)
11.106 +(* val nxt = ("Check_Postcond",.. !!!!!!!!!!!!!!!!!!!(*#2#*)!!!!!!!!!!!*)
11.107 +
11.108 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
11.109 +(* *** generate1: not impl.for Empty_Tac_ !!!!!!!!!!(*#3#*)!!!!!!!!!!!*)
11.110 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
11.111 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
11.112 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
11.113 +(*---------------------------------------------------------------------*)
11.114 +case nxt of (_, End_Proof') => ()
11.115 + | _ => raise error "script.sml, doesnt find Substitute #3";
11.116 +(*---------------------------------------------------------------------*)
11.117 +(*the reason, that next_tac didnt find the 2nd Substitute, was that
11.118 + the Take inbetween was missing, and thus the 2nd Substitute was applied
11.119 + the last formula in ctree, and not to argument from script*)
11.120 +
11.121 +
11.122 +"----------- WN0509 Substitute 2nd part --------------------------";
11.123 +"----------- WN0509 Substitute 2nd part --------------------------";
11.124 +"----------- WN0509 Substitute 2nd part --------------------------";
11.125 +(*replace met 'IntegrierenUndKonstanteBestimmen' with this script...*)
11.126 +val str = (*Substitute ; Substitute works*)
11.127 +"Script BiegelinieScript \
11.128 +\(l_::real) (q__::real) (v_::real) (b_::real=>real) \
11.129 +\(rb_::bool list) (rm_::bool list) = "^
11.130 +(*begin after the 2nd integrate*)
11.131 +" (let M__ = Take (M_b v_ = q__); \
11.132 +\ e1__ = nth_ 1 rm_ ; \
11.133 +\ (x1__::real) = argument_in (lhs e1__); \
11.134 +\ (M1__::bool) = Substitute [v_ = x1__] M__; \
11.135 +\ M1__ = Substitute [e1__] M1__ \
11.136 +\ in True)"
11.137 +;
11.138 +(*---^^^-OK-----------------------------------------------------------------*)
11.139 +val sc' = ((inst_abs thy) o term_of o the o (parse thy)) str;
11.140 +atomty sc';
11.141 +(*---vvv-NOT ok-------------------------------------------------------------*)
11.142 +val str = (*Substitute @@ Substitute does NOT work???*)
11.143 +"Script BiegelinieScript \
11.144 +\(l_::real) (q__::real) (v_::real) (b_::real=>real) \
11.145 +\(rb_::bool list) (rm_::bool list) = "^
11.146 +(*begin after the 2nd integrate*)
11.147 +" (let M__ = Take (M_b v_ = q__); \
11.148 +\ e1__ = nth_ 1 rm_ ; \
11.149 +\ (x1__::real) = argument_in (lhs e1__); \
11.150 +\ (M1__::bool) = ((Substitute [v_ = x1__]) @@ \
11.151 +\ (Substitute [e1__])) M__ \
11.152 +\ in True)"
11.153 +;
11.154 +
11.155 +val {scr=Script sc,...} = get_met ["IntegrierenUndKonstanteBestimmen"];
11.156 +(*---------------------------------------------------------------------
11.157 +if sc = sc' then () else raise error"script.sml, doesnt find Substitute #1";
11.158 +---------------------------------------------------------------------*)
11.159 +val fmz = ["Traegerlaenge L",
11.160 + "Streckenlast (- q_0 * x^^^2 / 2 + x * c + c_2)",
11.161 + "Biegelinie y",
11.162 + "RandbedingungenBiegung [y 0 = 0, y L = 0]",
11.163 + "RandbedingungenMoment [M_b 0 = 0, M_b L = 0]",
11.164 + "FunktionsVariable x"];
11.165 +val (dI',pI',mI') =
11.166 + ("Biegelinie.thy",["MomentBestimmte","Biegelinien"],
11.167 + ["IntegrierenUndKonstanteBestimmen"]);
11.168 +val p = e_pos'; val c = [];
11.169 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
11.170 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
11.171 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
11.172 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
11.173 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
11.174 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
11.175 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
11.176 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
11.177 +case nxt of (_, Apply_Method ["IntegrierenUndKonstanteBestimmen"]) => ()
11.178 + | _ => raise error "script.sml, doesnt find Substitute #2";
11.179 +trace_rewrite:=true;
11.180 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f(*------------------------*);
11.181 +trace_rewrite:=false;
11.182 +(*Exception TYPE raised:
11.183 +Illegal type for constant "op =" :: "[real, bool] => bool"
11.184 +Atools.argument'_in (Tools.lhs (ListG.nth_ (1 + -1 + -1) [])) =
11.185 +ListG.nth_ (1 + -1 + -1) []
11.186 +Exception-
11.187 + TYPE
11.188 + ("Illegal type for constant \"op =\" :: \"[real, bool] => bool\"",
11.189 + [],
11.190 + [Const ("Trueprop", "bool => prop") $
11.191 + (Const ("op =", "[RealDef.real, bool] => bool") $ ... $ ...)])
11.192 + raised
11.193 +... this was because eval_argument_in took "argument_in (lhs (M_b 0 = 0))"
11.194 +ie. the argument had not been simplified before ^^^^^^^^^^^^^^^
11.195 +thus corrected eval_argument_in OK*)
11.196 +
11.197 +val {srls,...} = get_met ["IntegrierenUndKonstanteBestimmen"];
11.198 +val e1__ = str2term"nth_ 1 [M_b 0 = 0, M_b L = 0]";
11.199 +val e1__ = eval_listexpr_ Biegelinie.thy srls e1__; term2str e1__;
11.200 +if term2str e1__ = "M_b 0 = 0" then () else
11.201 +raise error"script.sml diff.beh. eval_listexpr_ nth_ 1 [...";
11.202 +
11.203 +(*TODO.WN050913 ??? doesnt eval_listexpr_ go into subterms ???...
11.204 +val x1__ = str2term"argument_in (lhs (M_b 0 = 0))";
11.205 +val x1__ = eval_listexpr_ Biegelinie.thy srls x1__; term2str x1__;
11.206 +(*no rewrite*)
11.207 +calculate_ Biegelinie.thy ("Tools.lhs", eval_rhs"eval_lhs_") x1__;
11.208 +val SOME (str, t) = eval_lhs 0 "Tools.lhs" (str2term"lhs (M_b 0 = 0)") 0;*)
11.209 +
11.210 +val l__ = str2term"lhs (M_b 0 = 0)";
11.211 +val l__ = eval_listexpr_ Biegelinie.thy srls l__; term2str l__;
11.212 +val SOME (str, t) = eval_lhs 0 "Tools.lhs" (str2term"lhs (M_b 0 = 0)") 0;
11.213 +
11.214 +
11.215 +trace_rewrite:=true;
11.216 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f(*------------------------*);
11.217 +trace_rewrite:=false;
11.218 +
11.219 +show_mets();
11.220 +
11.221 +"----------- fun sel_appl_atomic_tacs ----------------------------";
11.222 +"----------- fun sel_appl_atomic_tacs ----------------------------";
11.223 +"----------- fun sel_appl_atomic_tacs ----------------------------";
11.224 +states:=[];
11.225 +CalcTree
11.226 +[(["equality (x+1=2)", "solveFor x","solutions L"],
11.227 + ("Test.thy",
11.228 + ["sqroot-test","univariate","equation","test"],
11.229 + ["Test","squ-equ-test-subpbl1"]))];
11.230 +Iterator 1;
11.231 +moveActiveRoot 1;
11.232 +autoCalculate 1 CompleteCalcHead;
11.233 +autoCalculate 1 (Step 1);
11.234 +autoCalculate 1 (Step 1);
11.235 +val ((pt, p), _) = get_calc 1; show_pt pt;
11.236 +val appltacs = sel_appl_atomic_tacs pt p;
11.237 +if appltacs =
11.238 + [Rewrite ("radd_commute", "?m + ?n = ?n + ?m"),
11.239 + Rewrite ("radd_assoc", "?m + ?n + ?k = ?m + (?n + ?k)"),
11.240 + Calculate "times"] then ()
11.241 +else raise error "script.sml fun sel_appl_atomic_tacs diff.behav.";
11.242 +
11.243 +trace_script := true;
11.244 +trace_script := false;
11.245 +applyTactic 1 p (hd appltacs);
11.246 +val ((pt, p), _) = get_calc 1; show_pt pt;
11.247 +val appltacs = sel_appl_atomic_tacs pt p;
11.248 +
11.249 +"----- WN080102 these vvv do not work, because locatetac starts the search\
11.250 + \1 stac too low";
11.251 +applyTactic 1 p (hd appltacs);
11.252 +autoCalculate 1 CompleteCalc;
11.253 +
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/test/Tools/isac/Interpret/solve.sml Mon Aug 30 14:35:51 2010 +0200
12.3 @@ -0,0 +1,537 @@
12.4 +(* tests on solve.sml
12.5 + author: Walther Neuper
12.6 + 060508,
12.7 + (c) due to copyright terms
12.8 +
12.9 +is NOT ONLY dependent on Test, but on other thys:
12.10 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12.11 +uses from Rational.ML: Rrls cancel_p, Rrls cancel
12.12 +which in turn
12.13 +uses from Poly.ML: Rls make_polynomial, Rls expand_binom
12.14 +
12.15 +use"../smltest/ME/solve.sml";
12.16 +use"solve.sml";
12.17 +*)
12.18 +
12.19 +"-----------------------------------------------------------------";
12.20 +"table of contents -----------------------------------------------";
12.21 +"-----------------------------------------------------------------";
12.22 +"--------- interSteps on norm_Rational ---------------------------";
12.23 +(*---vvv NOT working after meNEW.04mmdd*)
12.24 +"###### val intermediate_ptyps = !ptyps;val intermediate_mets = !mets";
12.25 +"--------- prepare pbl, met --------------------------------------";
12.26 +"-------- cancel, without detail ------------------------------";
12.27 +"-------- cancel, detail rev-rew (cancel) afterwards ----------";
12.28 +"-------------- cancel_p, without detail ------------------------------";
12.29 +"-------------- cancel_p, detail rev-rew (cancel) afterwards ----------";
12.30 +(*---^^^ NOT working*)
12.31 +"on 'miniscript with mini-subpbl':";
12.32 +"------ interSteps'donesteps': on 'miniscript with mini-subpbl'---";
12.33 +"------ interSteps'detailrls' after CompleteCalc -----------------";
12.34 +"------ interSteps after appendFormula ---------------------------";
12.35 +(*---vvv not brought to work 0403*)
12.36 +"------ Detail_Set -----------------------------------------------";
12.37 +"###### ptyps:= intermediate_ptyps;met:= intermediate_mets;#######";
12.38 +"-----------------------------------------------------------------";
12.39 +"-----------------------------------------------------------------";
12.40 +"-----------------------------------------------------------------";
12.41 +
12.42 +
12.43 +"--------- interSteps on norm_Rational ---------------------------";
12.44 +"--------- interSteps on norm_Rational ---------------------------";
12.45 +"--------- interSteps on norm_Rational ---------------------------";
12.46 +states:=[];(*exp_IsacCore_Simp_Rat_Double_No-7.xml*)
12.47 +CalcTree [(["term ((2/(x+3) + 2/(x - 3)) / (8*x/(x^2 - 9)))","normalform N"],
12.48 + ("Rational.thy",
12.49 + ["rational","simplification"],
12.50 + ["simplification","of_rationals"]))];
12.51 +moveActiveRoot 1;
12.52 +autoCalculate 1 CompleteCalc;
12.53 +val ((pt,_),_) = get_calc 1; show_pt pt;
12.54 +
12.55 +(*with "Script SimplifyScript (t_::real) = -----------------
12.56 + \ ((Rewrite_Set norm_Rational False) t_)"
12.57 +case pt of Nd (PblObj _, [Nd _]) => ((*met only applies norm_Rational*))
12.58 + | _ => raise error "solve.sml: interSteps on norm_Rational 1";
12.59 +interSteps 1 ([1], Res);
12.60 +getFormulaeFromTo 1 ([1], Frm) ([1,12], Res) 99999 false;
12.61 +interSteps 1 ([1,3], Res);
12.62 +
12.63 +getTactic 1 ([1,4], Res) (*here get the tactic, and ...*);
12.64 +interSteps 1 ([1,5], Res) (*... here get the intermediate steps above*);
12.65 +
12.66 +getTactic 1 ([1,5,1], Frm);
12.67 +val ((pt,_),_) = get_calc 1; show_pt pt;
12.68 +
12.69 +getTactic 1 ([1,8], Res) (*Rewrite_Set "common_nominator_p" *);
12.70 +interSteps 1 ([1,9], Res)(*TODO.WN060606 reverse rew*);
12.71 +--------------------------------------------------------------------*)
12.72 +
12.73 +case pt of Nd (PblObj _, [Nd _, Nd _, Nd _, Nd _, Nd _, Nd _]) => ()
12.74 + | _ => raise error "solve.sml: interSteps on norm_Rational 1";
12.75 +(*these have been done now by the script ^^^ immediately...
12.76 +interSteps 1 ([1], Res);
12.77 +getFormulaeFromTo 1 ([1], Frm) ([1,12], Res) 99999 false;
12.78 +*)
12.79 +interSteps 1 ([6], Res);
12.80 +
12.81 +getTactic 1 ([6,1], Frm) (*here get the tactic, and ...*);
12.82 +interSteps 1 ([6,1], Res) (*... here get the intermediate steps above*);
12.83 +
12.84 +getTactic 1 ([3,4,1], Frm);
12.85 +val ((pt,_),_) = get_calc 1; show_pt pt;
12.86 +val (Form form, SOME tac, asm) = pt_extract (pt, ([6], Res));
12.87 +case (term2str form, tac, terms2strs asm) of
12.88 + ("1 / 2", Check_Postcond ["rational", "simplification"],
12.89 + ["-36 * x + 4 * x ^^^ 3 ~= 0"]) => ()
12.90 + | _ => raise error "solve.sml: interSteps on norm_Rational 2";
12.91 +
12.92 +
12.93 +
12.94 +"###### val intermediate_ptyps = !ptyps;val intermediate_mets = !mets";
12.95 +"###### val intermediate_ptyps = !ptyps;val intermediate_mets = !mets";
12.96 +"###### val intermediate_ptyps = !ptyps;val intermediate_mets = !mets";
12.97 +val intermediate_ptyps = !ptyps;
12.98 +val intermediate_mets = !mets;
12.99 +
12.100 +"--------- prepare pbl, met --------------------------------------";
12.101 +"--------- prepare pbl, met --------------------------------------";
12.102 +"--------- prepare pbl, met --------------------------------------";
12.103 +store_pbt
12.104 + (prep_pbt Test.thy "pbl_ttestt" [] e_pblID
12.105 + (["test"],
12.106 + [],
12.107 + e_rls, NONE, []));
12.108 +store_pbt
12.109 + (prep_pbt Test.thy "pbl_ttestt_detail" [] e_pblID
12.110 + (["detail","test"],
12.111 + [("#Given" ,["realTestGiven t_"]),
12.112 + ("#Find" ,["realTestFind s_"])
12.113 + ],
12.114 + e_rls, NONE, [["Test","test_detail"]]));
12.115 +
12.116 +store_met
12.117 + (prep_met Test.thy "met_detbin" [] e_metID
12.118 + (["Test","test_detail_binom"]:metID,
12.119 + [("#Given" ,["realTestGiven t_"]),
12.120 + ("#Find" ,["realTestFind s_"])
12.121 + ],
12.122 + {rew_ord'="sqrt_right",rls'=tval_rls,calc = [],srls=e_rls,prls=e_rls,
12.123 + crls=tval_rls, nrls=e_rls(*,
12.124 + asm_rls=[],asm_thm=[("real_mult_div_cancel2","")]*)},
12.125 + "Script Testterm (g_::real) = \
12.126 + \(((Rewrite_Set expand_binoms False) @@\
12.127 + \ (Rewrite_Set cancel False)) g_)"
12.128 + ));
12.129 +store_met
12.130 + (prep_met Test.thy "met_detpoly" [] e_metID
12.131 + (["Test","test_detail_poly"]:metID,
12.132 + [("#Given" ,["realTestGiven t_"]),
12.133 + ("#Find" ,["realTestFind s_"])
12.134 + ],
12.135 + {rew_ord'="sqrt_right",rls'=tval_rls,calc=[],srls=e_rls,prls=e_rls,
12.136 + crls=tval_rls, nrls=e_rls(*,
12.137 + asm_rls=[],asm_thm=[("real_mult_div_cancel2","")]*)},
12.138 + "Script Testterm (g_::real) = \
12.139 + \(((Rewrite_Set make_polynomial False) @@\
12.140 + \ (Rewrite_Set cancel_p False)) g_)"
12.141 + ));
12.142 +
12.143 +(*---- funktionieren mit Rationals.ML: dummy-Funktionen(1)--------*)
12.144 +
12.145 +"-------- cancel, without detail ------------------------------";
12.146 +"-------- cancel, without detail ------------------------------";
12.147 +"-------- cancel, without detail ------------------------------";
12.148 +val fmz = ["realTestGiven (((3 + x) * (3 - x)) / ((3 + x) * (3 + x)))",
12.149 + "realTestFind s"];
12.150 +val (dI',pI',mI') =
12.151 + ("Test.thy",["detail","test"],["Test","test_detail_binom"]);
12.152 +
12.153 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
12.154 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.155 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.156 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.157 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.158 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.159 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.160 +(*nxt = ("Apply_Method",Apply_Method ("Test.thy","test_detail"))*)
12.161 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.162 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.163 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.164 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.165 +(*"(3 + -1 * x) / (3 + x)"*)
12.166 +if nxt = ("End_Proof'",End_Proof') then ()
12.167 +else raise error "details.sml, changed behaviour in: without detail";
12.168 +
12.169 + val str = pr_ptree pr_short pt;
12.170 + writeln str;
12.171 +
12.172 +
12.173 +"-------- cancel, detail rev-rew (cancel) afterwards ----------";
12.174 +"-------- cancel, detail rev-rew (cancel) afterwards ----------";
12.175 +"-------- cancel, detail rev-rew (cancel) afterwards ----------";
12.176 + val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
12.177 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.178 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.179 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.180 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.181 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.182 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.183 + (*nxt = ("Apply_Method",Apply_Method ("Test.thy","test_detail"))*)
12.184 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.185 + (*val nxt = ("Rewrite_Set",Rewrite_Set "expand_binoms")*)
12.186 + val (p,_,f,nxt,_,pt) = me nxt p [] pt; (* rewrite must exist for Detail*)
12.187 +(* val nxt = ("Detail",Detail);"----------------------";*)
12.188 +
12.189 +
12.190 +(*WN.11.9.03: after meNEW not yet implemented -------------------------*)
12.191 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.192 +(*FIXXXXXME.040216 #####################################################
12.193 +# val nxt = ("Detail", Detail) : string * tac
12.194 +val it = "----------------------" : string
12.195 +> val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.196 +val f = Form' (FormKF (~1, EdUndef, ...)) : mout
12.197 +val nxt = ("Empty_Tac", Empty_Tac) : string * tac
12.198 +val p = ([2, 1], Res) : pos'
12.199 +#########################################################################
12.200 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.201 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.202 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.203 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.204 + (*val nxt = ("End_Detail",End_Detail)*)
12.205 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.206 + (*val nxt = ("Rewrite_Set",Rewrite_Set "cancel")*)
12.207 + val (p,_,f,nxt,_,pt) = me nxt p [] pt; (* rewrite must exist for Detail*)
12.208 + val nxt = ("Detail",Detail);"----------------------";
12.209 + val (p,_,f,nxt,_,pt) = (me nxt p [] pt) handle e => print_exn e;
12.210 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.211 +(*15.10.02*)
12.212 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.213 +(*
12.214 +rewrite "Rationals.thy" "tless_true""e_rls"true("sym_real_plus_minus_binom","")
12.215 + "3 ^^^ 2 - x ^^^ 2";
12.216 +*)
12.217 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.218 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.219 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.220 + val (p,_,f,nxt,_,pt) = (me nxt p [] pt) handle e => print_exn e;
12.221 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.222 +if f = Form' (FormKF (~1,EdUndef,0,Nundef,"(3 - x) / (3 + x)"))
12.223 + andalso nxt = ("End_Proof'",End_Proof') then ()
12.224 +else raise error "new behaviour in details.sml, \
12.225 + \cancel, rev-rew (cancel) afterwards";
12.226 +FIXXXXXME.040216 #####################################################*)
12.227 +
12.228 +(*---- funktionieren mit Rationals.ML: dummy-Funktionen(1)--------*)
12.229 +
12.230 +"-------------- cancel_p, without detail ------------------------------";
12.231 +"-------------- cancel_p, without detail ------------------------------";
12.232 +"-------------- cancel_p, without detail ------------------------------";
12.233 +val fmz = ["realTestGiven (((3 + x)*(3+(-1)*x)) / ((3+x) * (3+x)))",
12.234 + "realTestFind s"];
12.235 +val (dI',pI',mI') =
12.236 + ("Test.thy",["detail","test"],["Test","test_detail_poly"]);
12.237 +
12.238 +(*val p = e_pos'; val c = [];
12.239 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
12.240 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
12.241 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
12.242 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.243 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.244 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.245 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.246 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.247 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.248 +(*nxt = ("Apply_Method",Apply_Method ("Test.thy","test_detail"))*)
12.249 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.250 +"(3 + x) * (3 + -1 * x) / ((3 + x) * (3 + x))";
12.251 +
12.252 + (*14.3.03*)
12.253 +(*---------------WN060614?!?---
12.254 + val t = str2term "(3 + x) * (3 + -1 * x) / ((3 + x) * (3 + x))";
12.255 + val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
12.256 + "(9 + - (x ^^^ 2)) / (9 + 6 * x + x ^^^ 2)";
12.257 + val SOME (t,_) = rewrite_set_ thy false cancel_p t; term2str t;
12.258 + cancel_p_ thy t;
12.259 +(---------------WN060614?!?---*)
12.260 +
12.261 + val t = str2term "(3 + x) * (3 + -1 * x)";
12.262 + val SOME (t,_) = rewrite_set_ thy false expand_poly t; term2str t;
12.263 + "3 * 3 + 3 * (-1 * x) + (x * 3 + x * (-1 * x))";
12.264 + val SOME (t,_) = rewrite_set_ thy false order_add_mult t; term2str t;
12.265 + "3 * 3 + (3 * x + (-1 * (3 * x) + -1 * (x * x)))";
12.266 + val SOME (t,_) = rewrite_set_ thy false simplify_power t; term2str t;
12.267 + "3 ^^^ 2 + (3 * x + (-1 * (3 * x) + -1 * x ^^^ 2))";
12.268 + val SOME (t,_) = rewrite_set_ thy false collect_numerals t; term2str t;
12.269 + "9 + (0 * x + -1 * x ^^^ 2)";
12.270 + val SOME (t,_) = rewrite_set_ thy false reduce_012 t; term2str t;
12.271 + "9 + - (x ^^^ 2)";
12.272 + (*14.3.03*)
12.273 +
12.274 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.275 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.276 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.277 +(*"(3 + -1 * x) / (3 + x)"*)
12.278 +if nxt = ("End_Proof'",End_Proof') then ()
12.279 +else raise error "details.sml, changed behaviour in: cancel_p, without detail";
12.280 +
12.281 +"-------------- cancel_p, detail rev-rew (cancel) afterwards ----------";
12.282 +"-------------- cancel_p, detail rev-rew (cancel) afterwards ----------";
12.283 +"-------------- cancel_p, detail rev-rew (cancel) afterwards ----------";
12.284 +(* val p = e_pos'; val c = [];
12.285 + val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
12.286 + val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
12.287 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
12.288 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.289 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.290 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.291 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.292 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.293 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.294 + (*nxt = ("Apply_Method",Apply_Method ("Test.thy","test_detail_poly"))*)
12.295 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.296 + (*val nxt = ("Rewrite_Set",Rewrite_Set "make_polynomial")*)
12.297 + val (p,_,f,nxt,_,pt) = me nxt p [] pt; (* rewrite must exist for Detail*)
12.298 +
12.299 +(*14.3.03.FIXXXXXME since Isa02/reverse-rew.sml:
12.300 + fun make_deriv ... Rls_ not yet impl. (| Thm | Calc)
12.301 + Rls_ needed for make_polynomial ----------------------
12.302 + val nxt = ("Detail",Detail);"----------------------";
12.303 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.304 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.305 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.306 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.307 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.308 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.309 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.310 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.311 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.312 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.313 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.314 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.315 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.316 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.317 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.318 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.319 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.320 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.321 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.322 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.323 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.324 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.325 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.326 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.327 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.328 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.329 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.330 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.331 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.332 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.333 + if nxt = ("End_Detail",End_Detail) then ()
12.334 + else raise error "details.sml: new behav. in Detail make_polynomial";
12.335 +----------------------------------------------------------------------*)
12.336 +
12.337 +(*---------------
12.338 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.339 + (*val nxt = ("Rewrite_Set",Rewrite_Set "cancel_p")*)
12.340 + val (p,_,f,nxt,_,pt) = me nxt p [] pt; (* rewrite must exist for Detail*)
12.341 + val nxt = ("Detail",Detail);"----------------------";
12.342 + val (p,_,f,nxt,_,pt) = (me nxt p [] pt) handle e => print_exn e;
12.343 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.344 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.345 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.346 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.347 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.348 + val (p,_,f,nxt,_,pt) = (me nxt p [] pt) handle e => print_exn e;
12.349 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.350 +if f = Form' (FormKF (~1,EdUndef,0,Nundef,"(3 + x) / (3 - x)"))
12.351 + andalso nxt = ("End_Proof'",End_Proof') then ()
12.352 +else raise error "new behaviour in details.sml, cancel_p afterwards";
12.353 +
12.354 +----------------*)
12.355 +
12.356 +
12.357 +
12.358 +
12.359 +
12.360 +val fmz = ["realTestGiven ((x+3)+(-1)*(2+6*x))",
12.361 + "realTestFind s"];
12.362 +val (dI',pI',mI') =
12.363 + ("Test.thy",["detail","test"],["Test","test_detail_poly"]);
12.364 +
12.365 +(* val p = e_pos'; val c = [];
12.366 + val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
12.367 + val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
12.368 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
12.369 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.370 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.371 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.372 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.373 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.374 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.375 + (*nxt = ("Apply_Method",Apply_Method ("Test.thy","test_detail_poly"))*)
12.376 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.377 +(*16.10.02 --- kommt auf POLY_EXCEPTION ?!??? ----------------------------
12.378 + (*val nxt = ("Rewrite_Set",Rewrite_Set "make_polynomial")*)
12.379 + val (p,_,f,nxt,_,pt) = me nxt p [] pt; (* rewrite must exist for Detail*)
12.380 + val nxt = ("Detail",Detail);"----------------------";
12.381 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.382 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.383 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.384 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
12.385 +-------------------------------------------------------------------------*)
12.386 +
12.387 +
12.388 +"------ interSteps'donesteps': on 'miniscript with mini-subpbl'---";
12.389 +"------ interSteps'donesteps': on 'miniscript with mini-subpbl'---";
12.390 +"------ interSteps'donesteps': on 'miniscript with mini-subpbl'---";
12.391 + states:=[];
12.392 + CalcTree
12.393 + [(["equality (x+1=2)", "solveFor x","solutions L"],
12.394 + ("Test.thy",
12.395 + ["sqroot-test","univariate","equation","test"],
12.396 + ["Test","squ-equ-test-subpbl1"]))];
12.397 + Iterator 1;
12.398 + moveActiveRoot 1;
12.399 + autoCalculate 1 CompleteCalc;
12.400 + moveActiveRoot 1;
12.401 +
12.402 + interSteps 1 ([],Res);
12.403 + val [(_,(((pt,_),_),[(_,ip)]))] = !states;
12.404 + val ("donesteps",_(*,ss*), lastpos) = detailstep pt ip;
12.405 + (*case ss of [(_,_,t1),(_,_,t2),(_,_,t3),(_,_,t4),(_,_,t5),(_,_,t6)] =>
12.406 + (writeln o terms2str) [t1,t2,t3,t4,t5,t6]
12.407 + | _ => raise error "details.sml: diff.behav. in detail miniscript";*) if lastpos = ([4], Res) then ()
12.408 + else raise error "details.sml: diff.behav. in interSteps'donesteps' 1";
12.409 +
12.410 + moveActiveDown 1;
12.411 + moveActiveDown 1;
12.412 + moveActiveDown 1;
12.413 + moveActiveDown 1;
12.414 +
12.415 + interSteps 1 ([3],Pbl) (*subproblem*);
12.416 + val [(_,(((pt,_),_),[(_,ip)]))] = !states;
12.417 + val ("donesteps",_(*,ss*), lastpos) = detailstep pt ip;
12.418 + (*case ss of [(_,_,t1),(_,_,t2),(_,_,t3)] =>
12.419 + (writeln o terms2str) [t1,t2,t3]
12.420 + | _ => raise error "details.sml: diff.behav. in detail miniscript";*) if lastpos = ([3, 2], Res) then ()
12.421 + else raise error "details.sml: diff.behav. in interSteps'donesteps' 1";
12.422 +
12.423 +
12.424 +(* val [(_,(((pt,_),_),[(_,ip)]))] = !states;
12.425 + writeln (pr_ptree pr_short pt);
12.426 + get_obj g_tac pt [4];
12.427 + *)
12.428 +
12.429 +
12.430 +"------ interSteps'detailrls' after CompleteCalc -----------------";
12.431 +"------ interSteps'detailrls' after CompleteCalc -----------------";
12.432 +"------ interSteps'detailrls' after CompleteCalc -----------------";
12.433 + states:=[];
12.434 + CalcTree
12.435 + [(["equality (x+1=2)", "solveFor x","solutions L"],
12.436 + ("Test.thy",
12.437 + ["sqroot-test","univariate","equation","test"],
12.438 + ["Test","squ-equ-test-subpbl1"]))];
12.439 + Iterator 1;
12.440 + moveActiveRoot 1;
12.441 + autoCalculate 1 CompleteCalc;
12.442 + interSteps 1 ([],Res);
12.443 + moveActiveRoot 1;
12.444 + moveActiveDown 1;
12.445 + moveActiveDown 1;
12.446 + moveActiveDown 1;
12.447 + refFormula 1 (get_pos 1 1); (* 2 Res, <ISA> -1 + x = 0 </ISA> *)
12.448 +
12.449 + interSteps 1 ([2],Res);
12.450 + val [(_,(((pt,_),_),[(_,(p,_))]))] = !states;
12.451 + if length (children (get_nd pt p)) = 6 then ()
12.452 + else raise error "details.sml: diff.behav. in interSteps'detailrls' 1";
12.453 +
12.454 + moveActiveDown 1;
12.455 + moveActiveDown 1; refFormula 1 (get_pos 1 1); (* 3,1 Frm, <ISA> -1 + x = 0 </ISA> *);
12.456 +
12.457 + interSteps 1 ([3,1],Frm) (*<ERROR> first formula on level has NO detail </E*);
12.458 + val [(_,(((pt,_),_),[(_,(p,_))]))] = !states;
12.459 + if length (children (get_nd pt p)) = 0 then () (*NO detail at ([xxx,1],Frm)*)
12.460 + else raise error "details.sml: diff.behav. in interSteps'detailrls' 2";
12.461 +
12.462 + moveActiveDown 1;
12.463 + refFormula 1 (get_pos 1 1); (* 3,1 Res, <ISA> x = 0 + -1 * -1 </ISA> *)
12.464 +
12.465 + interSteps 1 ([3,1],Res);
12.466 + val ((pt,p),_) = get_calc 1; show_pt pt;
12.467 + term2str (get_obj g_res pt [3,1,1]);(*"x = 0 + -1 * -1" ok*)
12.468 + term2str (get_obj g_form pt [3,2]); (*"x = 0 + -1 * -1" ok*)
12.469 + get_obj g_tac pt [3,1,1]; (*Rewrite_Inst.."risolate_bdv_add ok*)
12.470 +
12.471 + moveActiveDown 1;
12.472 + refFormula 1 (get_pos 1 1); (* 3,2 Res, <ISA> x = 1 </ISA> *)
12.473 +
12.474 + interSteps 1 ([3,2],Res);
12.475 + val [(_,(((pt,_),_),[(_,(p,_))]))] = !states;
12.476 + if length (children (get_nd pt p)) = 2 then ()
12.477 + else raise error "details.sml: diff.behav. in interSteps'detailrls' 3";
12.478 +
12.479 + val ((pt,p),_) = get_calc 1; show_pt pt;
12.480 +
12.481 +
12.482 +"------ interSteps after appendFormula ---------------------------";
12.483 +"------ interSteps after appendFormula ---------------------------";
12.484 +"------ interSteps after appendFormula ---------------------------";
12.485 +states:=[];
12.486 +CalcTree
12.487 +[(["equality (x+1=2)", "solveFor x","solutions L"],
12.488 + ("Test.thy",
12.489 + ["sqroot-test","univariate","equation","test"],
12.490 + ["Test","squ-equ-test-subpbl1"]))];
12.491 +Iterator 1;
12.492 +moveActiveRoot 1;
12.493 +autoCalculate 1 CompleteCalcHead;
12.494 +autoCalculate 1 (Step 1);
12.495 +autoCalculate 1 (Step 1);
12.496 +appendFormula 1 "x - 1 = 0"(*generates intermediate steps*);
12.497 +(*these are not shown, because the resulting formula is on the same
12.498 + level as the previous formula*)
12.499 +interSteps 1 ([2],Res) (*error: last unchanged was ([2, 9], Res)*);
12.500 +(*...and these are the internals*)
12.501 +val ((pt,p),_) = get_calc 1; show_pt pt;
12.502 +val (_,_,lastpos) =detailstep pt p;
12.503 +if p = ([2], Res) andalso lastpos = ([2, 9], Res) then ()
12.504 +else raise error "solve.sml: diff.beh. after appendFormula x - 1 = 0";
12.505 +
12.506 +
12.507 +"------ Detail_Set -----------------------------------------------";
12.508 +"------ Detail_Set -----------------------------------------------";
12.509 +"------ Detail_Set -----------------------------------------------";
12.510 + states:=[];
12.511 + CalcTree (*start of calculation, return No.1*)
12.512 + [(["equality (x+1=2)", "solveFor x","solutions L"],
12.513 + ("Test.thy",
12.514 + ["sqroot-test","univariate","equation","test"],
12.515 + ["Test","squ-equ-test-subpbl1"]))];
12.516 + Iterator 1; moveActiveRoot 1;
12.517 + autoCalculate 1 CompleteCalcHead;
12.518 + autoCalculate 1 (Step 1);
12.519 + autoCalculate 1 (Step 1);
12.520 +
12.521 + fetchProposedTactic 1 (*DG decides to do this tactic in detail*);
12.522 + (*TODO ...*)
12.523 + setNextTactic 1 (Detail_Set "Test_simplify");
12.524 +
12.525 +
12.526 + val ((pt,p),tacis) = get_calc 1;
12.527 + val str = pr_ptree pr_short pt;
12.528 + writeln str;
12.529 +
12.530 + print_depth 3;
12.531 + term2str (fst (get_obj g_result pt [1]));
12.532 +
12.533 +
12.534 +
12.535 +
12.536 +"###### ptyps:= intermediate_ptyps;met:= intermediate_mets;#######";
12.537 +"###### ptyps:= intermediate_ptyps;met:= intermediate_mets;#######";
12.538 +"###### ptyps:= intermediate_ptyps;met:= intermediate_mets;#######";
12.539 +ptyps:= intermediate_ptyps;
12.540 +mets:= intermediate_mets;
13.1 --- a/test/Tools/isac/IsacKnowledge/algein.sml Mon Aug 30 14:29:49 2010 +0200
13.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
13.3 @@ -1,158 +0,0 @@
13.4 -(* tests on AlgEin, Algebra Einf"uhrung, , Unterrichtsversuch IMST-Projekt
13.5 - author: Walther Neuper 2007
13.6 - (c) due to copyright terms
13.7 -
13.8 -use"../smltest/IsacKnowledge/algein.sml";
13.9 -use"algein.sml";
13.10 -*)
13.11 -val thy = AlgEin.thy;
13.12 -
13.13 -"-----------------------------------------------------------------";
13.14 -"table of contents -----------------------------------------------";
13.15 -"-----------------------------------------------------------------";
13.16 -"----------- build method 'Berechnung' 'erstSymbolisch' ----------";
13.17 -"----------- me 'Berechnung' 'erstNumerisch' ---------------------";
13.18 -"----------- auto 'Berechnung' 'erstSymbolisch' ------------------";
13.19 -"----------- Widerspruch 3 = 777 ---------------------------------";
13.20 -"-----------------------------------------------------------------";
13.21 -"-----------------------------------------------------------------";
13.22 -"-----------------------------------------------------------------";
13.23 -
13.24 -
13.25 -
13.26 -(* use"../smltest/IsacKnowledge/algein.sml";
13.27 - *)
13.28 -
13.29 -"----------- build method 'Berechnung' 'erstSymbolisch' ----------";
13.30 -"----------- build method 'Berechnung' 'erstSymbolisch' ----------";
13.31 -"----------- build method 'Berechnung' 'erstSymbolisch' ----------";
13.32 -val str =
13.33 -"Script RechnenSymbolScript (k_::bool) (q__::bool) \
13.34 -\(u_::bool list) (s_::bool list) (o_::bool list) (l_::real) =\
13.35 -\ (let t_ = (l_ = 1)\
13.36 -\ in t_)"
13.37 -;
13.38 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
13.39 -(*---^^^-OK-----------------------------------------------------------------*)
13.40 -val str =
13.41 -"Script RechnenSymbolScript (k_::bool) (q__::bool) \
13.42 -\(u_::bool list) (s_::bool list) (o_::bool list) (l_::real) =\
13.43 -\ (let t_ = Take (l_ = Oben + Senkrecht + Unten); \
13.44 -\ sum_ = boollist2sum o_;\
13.45 -\ t_ = Substitute [Oben = sum_] t_;\
13.46 -\ t_ = Substitute o_ t_;\
13.47 -\ t_ = Substitute [k_, q__] t_;\
13.48 -\ t_ = Repeat (Try (Rewrite_Set norm_Poly False)) t_\
13.49 -\ in t_)"
13.50 -;
13.51 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
13.52 -(*---vvv-NOTok--------------------------------------------------------------*)
13.53 -
13.54 -
13.55 -
13.56 -atomty sc;
13.57 -atomt sc;
13.58 -
13.59 -
13.60 -"----------- me 'Berechnung' 'erstNumerisch' ---------------------";
13.61 -"----------- me 'Berechnung' 'erstNumerisch' ---------------------";
13.62 -"----------- me 'Berechnung' 'erstNumerisch' ---------------------";
13.63 -val fmz =
13.64 - ["KantenLaenge (k=10)","Querschnitt (q=1)",
13.65 - "KantenUnten [b1 = k - 2*q, b2 = k - 2*q, b3 = k - 2*q, b4 = k - 2*q ]",
13.66 - "KantenSenkrecht [v1 = k, v2 = k, v3 = k, v4 = k]",
13.67 - "KantenOben [t1 = k - 2*q, t2 = k - 2*q, t3 = k - 2*q, t4 = k - 2*q ]",
13.68 - "GesamtLaenge L"];
13.69 -val (dI',pI',mI') =
13.70 - ("Isac.thy",["numerischSymbolische", "Berechnung"],
13.71 - ["Berechnung","erstNumerisch"]);
13.72 -val p = e_pos'; val c = [];
13.73 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))](*nxt = ("Model_Pr*);
13.74 -val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "KantenLaenge (k = 10)"*);
13.75 -val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "Querschnitt (q = 1)"*);
13.76 -val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "KantenUnten [b1 = k - 2*q]"*);
13.77 -val (p,_,f,nxt,_,pt) = me nxt p c pt(*..KantenUnten [b2 = k - 2 * q, b3=..b4*);
13.78 -val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "KantenSenkrecht [v1 = k]"*);
13.79 -val (p,_,f,nxt,_,pt) = me nxt p c pt(*..KantenSenkrecht [v2 = k, v3 = k, v4]*);
13.80 -val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "KantenOben [b1 = k - 2 *q])*);
13.81 -val (p,_,f,nxt,_,pt) = me nxt p c pt(*..KantenOben [b2 = k - 2 * q, b3 =, b4*);
13.82 -val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Find "GesamtLaenge L"*);
13.83 -val (p,_,f,nxt,_,pt) = me nxt p c pt(*Specify_Theory "AlgEin.thy"*);
13.84 -val (p,_,f,nxt,_,pt) = me nxt p c pt(*Specify_Problem ["numerischSymbolis,Be*);
13.85 -val (p,_,f,nxt,_,pt) = me nxt p c pt(*Specify_Method ["Berechnung", "erstSym*);
13.86 -val (p,_,f,nxt,_,pt) = me nxt p c pt(*Apply_Method*);
13.87 -val (p,_,f,nxt,_,pt) = me nxt p c pt(*Substitute["Oben = boollist2sum [b1 =*);
13.88 -f2str f;
13.89 -val (p,_,f,nxt,_,pt) = me nxt p c pt(*Substitute ["t1 = k - 2 * q", *);f2str f;
13.90 -val (p,_,f,nxt,_,pt) = me nxt p c pt(*Substitute ["k = 10", "q = 1"]*);f2str f;
13.91 -val (p,_,f,nxt,_,pt) = me nxt p c pt(*Rewrite_Set "norm_Rational"*);f2str f;
13.92 -val (p,_,f,nxt,_,pt) = me nxt p c pt(**);
13.93 -if f2str f = "L = 32 + senkrecht + unten" then ()
13.94 -else raise error "algein.sml diff.behav. in erstSymbolisch 1";
13.95 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val(p,_,f,nxt,_,pt)=me nxt p c pt;f2str f;
13.96 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val(p,_,f,nxt,_,pt)=me nxt p c pt;f2str f;
13.97 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val(p,_,f,nxt,_,pt)=me nxt p c pt;f2str f;
13.98 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val(p,_,f,nxt,_,pt)=me nxt p c pt;f2str f;
13.99 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
13.100 -if f2str f = "L = 104" andalso nxt = ("End_Proof'", End_Proof') then ()
13.101 -else raise error "algein.sml diff.behav. in erstSymbolisch 99";
13.102 -
13.103 -
13.104 -"----------- auto 'Berechnung' 'erstSymbolisch' ------------------";
13.105 -"----------- auto 'Berechnung' 'erstSymbolisch' ------------------";
13.106 -"----------- auto 'Berechnung' 'erstSymbolisch' ------------------";
13.107 -states:=[];
13.108 -CalcTree
13.109 -[(["KantenLaenge (k=10)","Querschnitt (q=1)",
13.110 - "KantenUnten [b1 = k - 2*q, b2 = k - 2*q, b3 = k - 2*q, b4 = k - 2*q ]",
13.111 - "KantenSenkrecht [v1 = k, v2 = k, v3 = k, v4 = k]",
13.112 - "KantenOben [t1 = k - 2*q, t2 = k - 2*q, t3 = k - 2*q, t4 = k - 2*q ]",
13.113 - "GesamtLaenge L"],
13.114 - ("Isac.thy",["numerischSymbolische", "Berechnung"],
13.115 - ["Berechnung","erstSymbolisch"]))];
13.116 -Iterator 1;
13.117 -moveActiveRoot 1;
13.118 -autoCalculate 1 CompleteCalc;
13.119 -val ((pt,p),_) = get_calc 1; show_pt pt;
13.120 -if p = ([], Res) andalso term2str (get_obj g_res pt (fst p)) = "L = 104" then()
13.121 -else raise error "algein.sml: 'Berechnung' 'erstSymbolisch' changed";
13.122 -
13.123 -(*
13.124 -show_pt pt;
13.125 -trace_rewrite:=true;
13.126 -trace_rewrite:=false;
13.127 -trace_script:=true;
13.128 -trace_script:=false;
13.129 -*)
13.130 -
13.131 -"----------- Widerspruch 3 = 777 ---------------------------------";
13.132 -"----------- Widerspruch 3 = 777 ---------------------------------";
13.133 -"----------- Widerspruch 3 = 777 ---------------------------------";
13.134 -val thy = Isac.thy;
13.135 -val rew_ord = dummy_ord;
13.136 -val erls = Erls;
13.137 -
13.138 -val thm = assoc_thm' thy ("sym_real_mult_0_right","");
13.139 -val t = str2term "0 = 0";
13.140 -val SOME (t',_) = rewrite_ thy rew_ord erls false thm t;
13.141 -term2str t';
13.142 -(********"0 = ?z1 * 0"*)
13.143 -
13.144 -(*testing code in ME/appl.sml*)
13.145 -val sube = ["?z1 = 3"];
13.146 -val subte = sube2subte sube;
13.147 -val subst = sube2subst thy sube;
13.148 -foldl and_ (true, map contains_Var subte);
13.149 -
13.150 -val t'' = subst_atomic subst t';
13.151 -term2str t'';
13.152 -(********"0 = 3 * 0"*)
13.153 -
13.154 -val thm = assoc_thm' thy ("sym","");
13.155 -(*----- GOON Widerspruch 3 = 777: sym contains "==>" instead of "=" !!!
13.156 -val SOME (t''',_) = rewrite_ thy rew_ord erls false thm t'';
13.157 -*)
13.158 -
13.159 -(* use"../smltest/IsacKnowledge/algein.sml";
13.160 - *)
13.161 -
14.1 --- a/test/Tools/isac/IsacKnowledge/atools.sml Mon Aug 30 14:29:49 2010 +0200
14.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
14.3 @@ -1,131 +0,0 @@
14.4 -(* tests on Atools.thy and Atools.ML
14.5 - author: Walther Neuper
14.6 - 050814, 08:51
14.7 - (c) due to copyright terms
14.8 -
14.9 -use"../smltest/IsacKnowledge/atools.sml";
14.10 -use"atools.sml";
14.11 -*)
14.12 -
14.13 -"-----------------------------------------------------------------";
14.14 -"table of contents -----------------------------------------------";
14.15 -"-----------------------------------------------------------------";
14.16 -"----------- occurs_in -------------------------------------------";
14.17 -"----------- argument_of -----------------------------------------";
14.18 -"----------- sameFunId -------------------------------------------";
14.19 -"----------- filter_sameFunId ------------------------------------";
14.20 -"----------- boollist2sum ----------------------------------------";
14.21 -"-----------------------------------------------------------------";
14.22 -
14.23 -
14.24 -val thy = Atools.thy;
14.25 -
14.26 -"----------- occurs_in -------------------------------------------";
14.27 -"----------- occurs_in -------------------------------------------";
14.28 -"----------- occurs_in -------------------------------------------";
14.29 -fun str2term str = (term_of o the o (parse thy )) str;
14.30 -fun term2s t = Syntax.string_of_term (thy2ctxt thy) t;
14.31 -val t = str2term "x";
14.32 -if occurs_in t t then "OK" else raise error "atools.sml: occurs_in x x -> f";
14.33 -
14.34 -val t = str2term "x occurs_in x";
14.35 -val SOME (str, t') = eval_occurs_in 0 "Atools.occurs'_in" t 0;
14.36 -if (term2s t') = "x occurs_in x = True" then ()
14.37 -else raise error "atools.sml: x occurs_in x = True ???";
14.38 -
14.39 -"------- some_occur_in";
14.40 -some_occur_in [str2term"c",str2term"c_2"] (str2term"a + b + c");
14.41 -val t = str2term "some_of [c, c_2, c_3, c_4] occur_in \
14.42 - \-1 * q_0 * L ^^^ 2 / 2 + L * c + c_2";
14.43 -val SOME (str,t') = eval_some_occur_in 0 "Atools.some'_occur'_in" t 0;
14.44 -if term2str t' =
14.45 - "some_of [c, c_2, c_3, c_4] occur_in -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2 =\nTrue" then ()
14.46 -else raise error "atools.sml: some_occur_in true";
14.47 -
14.48 -val t = str2term "some_of [c_3, c_4] occur_in \
14.49 - \-1 * q_0 * L ^^^ 2 / 2 + L * c + c_2";
14.50 -val SOME (str,t') = eval_some_occur_in 0 "Atools.some'_occur'_in" t 0;
14.51 -if term2str t' =
14.52 - "some_of [c_3, c_4] occur_in -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2 = False" then ()
14.53 -else raise error "atools.sml: some_occur_in false";
14.54 -
14.55 -
14.56 -"----------- argument_of -----------------------------------------";
14.57 -"----------- argument_of -----------------------------------------";
14.58 -"----------- argument_of -----------------------------------------";
14.59 -val t = str2term "argument_in (M_b x)";
14.60 -val SOME (str, t') = eval_argument_in 0 "Atools.argument'_in" t 0;
14.61 -if term2s t' = "(argument_in M_b x) = x" then ()
14.62 -else raise error "atools.sml:(argument_in M_b x) = x ???";
14.63 -
14.64 -"----------- sameFunId -------------------------------------------";
14.65 -"----------- sameFunId -------------------------------------------";
14.66 -"----------- sameFunId -------------------------------------------";
14.67 -val t = str2term "M_b L"; atomty t;
14.68 -val t as f1 $ _ = str2term "M_b L";
14.69 -val t as Const ("op =", _) $ (f2 $ _) $ _ = str2term "M_b x = c + L*x";
14.70 -f1 = f2 (*true*);
14.71 -val (p as Const ("Atools.sameFunId",_) $
14.72 - (f1 $ _) $
14.73 - (Const ("op =", _) $ (f2 $ _) $ _)) =
14.74 - str2term "sameFunId (M_b L) (M_b x = c + L*x)";
14.75 -f1 = f2 (*true*);
14.76 -eval_sameFunId "" "Atools.sameFunId"
14.77 - (str2term "sameFunId (M_b L) (M_b x = c + L*x)")""(*true*);
14.78 -eval_sameFunId "" "Atools.sameFunId"
14.79 - (str2term "sameFunId (M_b L) ( y' x = c + L*x)")""(*false*);
14.80 -eval_sameFunId "" "Atools.sameFunId"
14.81 - (str2term "sameFunId (M_b L) ( y x = c + L*x)")""(*false*);
14.82 -eval_sameFunId "" "Atools.sameFunId"
14.83 - (str2term "sameFunId ( y L) (M_b x = c + L*x)")""(*false*);
14.84 -eval_sameFunId "" "Atools.sameFunId"
14.85 - (str2term "sameFunId ( y L) ( y x = c + L*x)")""(*true*);
14.86 -
14.87 -"----------- filter_sameFunId ------------------------------------";
14.88 -"----------- filter_sameFunId ------------------------------------";
14.89 -"----------- filter_sameFunId ------------------------------------";
14.90 -val flhs as (fid $ _) = str2term "y' L";
14.91 -val fs = str2term "[M_b x = c + L*x, y' x = c + L*x, y x = c + L*x]";
14.92 -val (p as Const ("Atools.filter'_sameFunId",_) $ (fid $ _) $ fs) =
14.93 - str2term "filter_sameFunId (y' L) \
14.94 - \[M_b x = c + L*x, y' x = c + L*x, y x = c + L*x]";
14.95 -val SOME (str, es) = eval_filter_sameFunId "" "Atools.filter'_sameFunId" p "";
14.96 -if term2str es = "(filter_sameFunId y' L [M_b x = c + L * x, y' x = c + L * x,\n y x = c + L * x]) =\n[y' x = c + L * x]" then ()
14.97 -else raise error "atools.slm diff.behav. in filter_sameFunId";
14.98 -
14.99 -
14.100 -"----------- boollist2sum ----------------------------------------";
14.101 -"----------- boollist2sum ----------------------------------------";
14.102 -"----------- boollist2sum ----------------------------------------";
14.103 -val u_ = str2term "[]";
14.104 -val u_ = str2term "[b1 = k - 2*q]";
14.105 -val u_ = str2term "[b1 = k - 2*q, b2 = k - 2*q, b3 = k - 2*q, b4 = k - 2*q]";
14.106 -val ut_ = isalist2list u_;
14.107 -val sum_ = map lhs ut_;
14.108 -val t = list2sum sum_;
14.109 -term2str t;
14.110 -
14.111 -val t = str2term
14.112 - "boollist2sum [b1 = k - 2*q, b2 = k - 2*q, b3 = k - 2*q, b4 = k - 2*q]";
14.113 -
14.114 -val p as Const ("Atools.boollist2sum", _) $ (Const ("List.list.Cons", _) $
14.115 - _ $ _) = t;
14.116 -
14.117 -
14.118 -val SOME (str, pred) = eval_boollist2sum "" "Atools.boollist2sum" t "";
14.119 -if term2str pred = "boollist2sum\n [b1 = k - 2 * q, b2 = k - 2 * q, b3 = k - 2 * q, b4 = k - 2 * q] =\nb1 + b2 + b3 + b4" then ()
14.120 -else raise error "atools.sml diff.behav. in eval_boollist2sum";
14.121 -
14.122 -trace_rewrite:=true;
14.123 -val srls_ = append_rls "srls_..Berechnung-erstSymbolisch" e_rls
14.124 - [Calc ("Atools.boollist2sum", eval_boollist2sum "")];
14.125 -val t = str2term
14.126 - "boollist2sum [b1 = k - 2*q, b2 = k - 2*q, b3 = k - 2*q, b4 = k - 2*q]";
14.127 -case rewrite_set_ thy false srls_ t of SOME _ => ()
14.128 -| _ => raise error "atools.sml diff.rewrite boollist2sum";
14.129 -trace_rewrite:=false;
14.130 -
14.131 -
14.132 -(* use"IsacKnowledge/Atools.ML";
14.133 - use"../smltest/IsacKnowledge/atools.sml";
14.134 - *)
14.135 \ No newline at end of file
15.1 --- a/test/Tools/isac/IsacKnowledge/biegelinie.sml Mon Aug 30 14:29:49 2010 +0200
15.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
15.3 @@ -1,1040 +0,0 @@
15.4 -(* tests on biegelinie
15.5 - author: Walther Neuper 050826
15.6 - (c) due to copyright terms
15.7 -
15.8 -use"../smltest/IsacKnowledge/biegelinie.sml";
15.9 -use"biegelinie.sml";
15.10 -*)
15.11 -val thy = Biegelinie.thy;
15.12 -
15.13 -"-----------------------------------------------------------------";
15.14 -"table of contents -----------------------------------------------";
15.15 -"-----------------------------------------------------------------";
15.16 -"----------- the rules -------------------------------------------";
15.17 -"----------- Script [IntegrierenUndKonstanteBestimmen] -----------";
15.18 -"----------- IntegrierenUndKonstanteBestimmen by rewriting -------";
15.19 -"----------- simplify_leaf for this script -----------------------";
15.20 -"----------- Bsp 7.27 me -----------------------------------------";
15.21 -"----------- Bsp 7.27 autoCalculate ------------------------------";
15.22 -"----------- SubProblem (_,[vonBelastungZu,Biegelinien] ----------";
15.23 -"----------- SubProblem (_,[setzeRandbedingungen,Biegelinien] ----";
15.24 -"----------- method [Biegelinien,setzeRandbedingungenEin] + exec -";
15.25 -"----------- method [Biegelinien,setzeRandbedingungenEin]FAST ----";
15.26 -"----------- IntegrierenUndKonstanteBestimmen2: Bsp.7.70. --------";
15.27 -"----------- investigate normalforms in biegelinien --------------";
15.28 -"-----------------------------------------------------------------";
15.29 -"-----------------------------------------------------------------";
15.30 -"-----------------------------------------------------------------";
15.31 -
15.32 -
15.33 -"----------- the rules -------------------------------------------";
15.34 -"----------- the rules -------------------------------------------";
15.35 -"----------- the rules -------------------------------------------";
15.36 -fun str2term str = (term_of o the o (parse Biegelinie.thy)) str;
15.37 -fun term2s t = Syntax.string_of_term (thy2ctxt' "Biegelinie") t;
15.38 -fun rewrit thm str =
15.39 - fst (the (rewrite_ Biegelinie.thy tless_true e_rls true thm str));
15.40 -
15.41 -val t = rewrit Belastung_Querkraft (str2term "- q_ x = - q_0"); term2s t;
15.42 -if term2s t = "Q' x = - q_0" then ()
15.43 -else raise error "/biegelinie.sml: Belastung_Querkraft";
15.44 -
15.45 -val t = rewrit Querkraft_Moment (str2term "Q x = - q_0 * x + c"); term2s t;
15.46 -if term2s t = "M_b' x = - q_0 * x + c" then ()
15.47 -else raise error "/biegelinie.sml: Querkraft_Moment";
15.48 -
15.49 -val t = rewrit Moment_Neigung (str2term "M_b x = -q_0 * x^^^2/2 + q_0/2 *L*x");
15.50 - term2s t;
15.51 -if term2s t = "- EI * y'' x = - q_0 * x ^^^ 2 / 2 + q_0 / 2 * L * x" then ()
15.52 -else raise error "biegelinie.sml: Moment_Neigung";
15.53 -
15.54 -
15.55 -"----------- Script [IntegrierenUndKonstanteBestimmen] -----------";
15.56 -"----------- Script [IntegrierenUndKonstanteBestimmen] -----------";
15.57 -"----------- Script [IntegrierenUndKonstanteBestimmen] -----------";
15.58 -val str =
15.59 -"Script BiegelinieScript \
15.60 -\(l_::real) (q__::real) (v_::real) (b_::real=>real) \
15.61 -\(rb_::bool list) (rm_::bool list) = \
15.62 -\ (let q___ = Take (q_ v_ = q__); \
15.63 -\ q___ = ((Rewrite sym_real_minus_eq_cancel True) @@ \
15.64 -\ (Rewrite Belastung_Querkraft True)) q___; \
15.65 -\ (Q__:: bool) = \
15.66 -\ (SubProblem (Biegelinie_,[named,integrate,function], \
15.67 -\ [diff,integration,named]) \
15.68 -\ [real_ (rhs q___), real_ v_, real_real_ Q]); \
15.69 -\ Q__ = Rewrite Querkraft_Moment True Q__; \
15.70 -\ (M__::bool) = \
15.71 -\ (SubProblem (Biegelinie_,[named,integrate,function], \
15.72 -\ [diff,integration,named]) \
15.73 -\ [real_ (rhs Q__), real_ v_, real_real_ M_b]); \
15.74 -\ e1__ = nth_ 1 rm_; \
15.75 -\ (x1__::real) = argument_in (lhs e1__); \
15.76 -\ (M1__::bool) = (Substitute [v_ = x1__]) M__; \
15.77 -\ M1__ = (Substitute [e1__]) M1__ ; \
15.78 -\ M2__ = Take M__; "^
15.79 -(*without this Take 'Substitute [v_ = x2__]' takes _last formula from ctree_*)
15.80 -" e2__ = nth_ 2 rm_; \
15.81 -\ (x2__::real) = argument_in (lhs e2__); \
15.82 -\ (M2__::bool) = ((Substitute [v_ = x2__]) @@ \
15.83 -\ (Substitute [e2__])) M2__; \
15.84 -\ (c_1_2__::bool list) = \
15.85 -\ (SubProblem (Biegelinie_,[linear,system],[no_met]) \
15.86 -\ [booll_ [M1__, M2__], reall [c,c_2]]); \
15.87 -\ M__ = Take M__; \
15.88 -\ M__ = ((Substitute c_1_2__) @@ \
15.89 -\ (Try (Rewrite_Set_Inst [(bdv_1, c),(bdv_2, c_2)]\
15.90 -\ simplify_System False)) @@ \
15.91 -\ (Rewrite Moment_Neigung False) @@ \
15.92 -\ (Rewrite make_fun_explicit False)) M__; "^
15.93 -(*----------------------- and the same once more ------------------------*)
15.94 -" (N__:: bool) = \
15.95 -\ (SubProblem (Biegelinie_,[named,integrate,function], \
15.96 -\ [diff,integration,named]) \
15.97 -\ [real_ (rhs M__), real_ v_, real_real_ y']); \
15.98 -\ (B__:: bool) = \
15.99 -\ (SubProblem (Biegelinie_,[named,integrate,function], \
15.100 -\ [diff,integration,named]) \
15.101 -\ [real_ (rhs N__), real_ v_, real_real_ y]); \
15.102 -\ e1__ = nth_ 1 rb_; \
15.103 -\ (x1__::real) = argument_in (lhs e1__); \
15.104 -\ (B1__::bool) = (Substitute [v_ = x1__]) B__; \
15.105 -\ B1__ = (Substitute [e1__]) B1__ ; \
15.106 -\ B2__ = Take B__; \
15.107 -\ e2__ = nth_ 2 rb_; \
15.108 -\ (x2__::real) = argument_in (lhs e2__); \
15.109 -\ (B2__::bool) = ((Substitute [v_ = x2__]) @@ \
15.110 -\ (Substitute [e2__])) B2__; \
15.111 -\ (c_1_2__::bool list) = \
15.112 -\ (SubProblem (Biegelinie_,[linear,system],[no_met]) \
15.113 -\ [booll_ [B1__, B2__], reall [c,c_2]]); \
15.114 -\ B__ = Take B__; \
15.115 -\ B__ = ((Substitute c_1_2__) @@ \
15.116 -\ (Rewrite_Set_Inst [(bdv, x)] make_ratpoly_in False)) B__ \
15.117 -\ in B__)"
15.118 -;
15.119 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
15.120 -(*---^^^-OK-----------------------------------------------------------------*)
15.121 -(*---vvv-NOTok--------------------------------------------------------------*)
15.122 -atomty sc;
15.123 -atomt sc;
15.124 -
15.125 -(* use"../smltest/IsacKnowledge/biegelinie.sml";
15.126 - *)
15.127 -
15.128 -"----------- IntegrierenUndKonstanteBestimmen by rewriting -------";
15.129 -"----------- IntegrierenUndKonstanteBestimmen by rewriting -------";
15.130 -"----------- IntegrierenUndKonstanteBestimmen by rewriting -------";
15.131 -val t = str2term "M_b x = L * q_0 * x / 2 + -1 * q_0 * x ^^^ 2 / 2";
15.132 -val t = rewrit Moment_Neigung t; term2s t;
15.133 -(*was "EI * ?y'' x = L * q_0 * x / 2 + -1 * q_0 * x ^^^ 2 / 2"
15.134 - ### before declaring "y''" as a constant *)
15.135 -val t = rewrit make_fun_explicit t; term2s t;
15.136 -
15.137 -
15.138 -"----------- simplify_leaf for this script -----------------------";
15.139 -"----------- simplify_leaf for this script -----------------------";
15.140 -"----------- simplify_leaf for this script -----------------------";
15.141 -val srls = Rls {id="srls_IntegrierenUnd..",
15.142 - preconds = [],
15.143 - rew_ord = ("termlessI",termlessI),
15.144 - erls = append_rls "erls_in_srls_IntegrierenUnd.." e_rls
15.145 - [(*for asm in nth_Cons_ ...*)
15.146 - Calc ("op <",eval_equ "#less_"),
15.147 - (*2nd nth_Cons_ pushes n+-1 into asms*)
15.148 - Calc("op +", eval_binop "#add_")
15.149 - ],
15.150 - srls = Erls, calc = [],
15.151 - rules = [Thm ("nth_Cons_",num_str nth_Cons_),
15.152 - Calc("op +", eval_binop "#add_"),
15.153 - Thm ("nth_Nil_",num_str nth_Nil_),
15.154 - Calc("Tools.lhs", eval_lhs"eval_lhs_"),
15.155 - Calc("Tools.rhs", eval_rhs"eval_rhs_"),
15.156 - Calc("Atools.argument'_in",
15.157 - eval_argument_in "Atools.argument'_in")
15.158 - ],
15.159 - scr = EmptyScr};
15.160 -val rm_ = str2term"[M_b 0 = 0, M_b L = 0]";
15.161 -val M__ = str2term"M_b x = -1 * x ^^^ 2 / 2 + x * c + c_2";
15.162 -val SOME (e1__,_) =
15.163 - rewrite_set_ thy false srls
15.164 - (str2term"(nth_::[real,bool list]=>bool) 1 " $ rm_);
15.165 -if term2str e1__ = "M_b 0 = 0" then ()
15.166 -else raise error "biegelinie.sml simplify nth_ 1 rm_";
15.167 -
15.168 -val SOME (x1__,_) =
15.169 - rewrite_set_ thy false srls
15.170 - (str2term"argument_in (lhs (M_b 0 = 0))");
15.171 -if term2str x1__ = "0" then ()
15.172 -else raise error "biegelinie.sml simplify argument_in (lhs (M_b 0 = 0)";
15.173 -
15.174 -trace_rewrite:=true;
15.175 -trace_rewrite:=false;
15.176 -
15.177 -
15.178 -
15.179 -"----------- Bsp 7.27 me -----------------------------------------";
15.180 -"----------- Bsp 7.27 me -----------------------------------------";
15.181 -"----------- Bsp 7.27 me -----------------------------------------";
15.182 -val fmz = ["Traegerlaenge L","Streckenlast q_0","Biegelinie y",
15.183 - "RandbedingungenBiegung [y 0 = 0, y L = 0]",
15.184 - "RandbedingungenMoment [M_b 0 = 0, M_b L = 0]",
15.185 - "FunktionsVariable x"];
15.186 -val (dI',pI',mI') =
15.187 - ("Biegelinie.thy",["MomentBestimmte","Biegelinien"],
15.188 - ["IntegrierenUndKonstanteBestimmen"]);
15.189 -val p = e_pos'; val c = [];
15.190 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
15.191 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.192 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.193 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.194 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.195 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.196 -
15.197 -val pits = get_obj g_pbl pt (fst p);writeln (itms2str_ ctxt pits);
15.198 -(*if itms2str_ ctxt pits = ... all 5 model-items*)
15.199 -val mits = get_obj g_met pt (fst p); writeln (itms2str_ ctxt mits);
15.200 -if itms2str_ ctxt mits = "[]" then ()
15.201 -else raise error "biegelinie.sml: Bsp 7.27 #2";
15.202 -
15.203 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.204 -case nxt of (_,Add_Given "FunktionsVariable x") => ()
15.205 - | _ => raise error "biegelinie.sml: Bsp 7.27 #4a";
15.206 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.207 -val mits = get_obj g_met pt (fst p);writeln (itms2str_ ctxt mits);
15.208 -(*if itms2str_ ctxt mits = ... all 6 guard-items*)
15.209 -case nxt of (_, Apply_Method ["IntegrierenUndKonstanteBestimmen"]) => ()
15.210 - | _ => raise error "biegelinie.sml: Bsp 7.27 #4b";
15.211 -
15.212 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.213 -case pt of Nd (PblObj _, [Nd _]) => ((*Apply_Method + Take*))
15.214 - | _ => raise error "biegelinie.sml: Bsp 7.27 #4c";
15.215 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.216 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.217 -
15.218 -case nxt of
15.219 - (_,Subproblem ("Biegelinie.thy", ["named", "integrate", "function"])) => ()
15.220 - | _ => raise error "biegelinie.sml: Bsp 7.27 #4c";
15.221 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.222 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.223 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.224 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.225 -case nxt of (_, Apply_Method ["diff", "integration", "named"]) => ()
15.226 - | _ => raise error "biegelinie.sml: Bsp 7.27 #5";
15.227 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.228 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.229 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.230 -case nxt of
15.231 - ("Check_Postcond", Check_Postcond ["named", "integrate", "function"]) => ()
15.232 - | _ => raise error "biegelinie.sml: Bsp 7.27 #5a";
15.233 -
15.234 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.235 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.236 -case nxt of
15.237 - (_, Subproblem ("Biegelinie.thy", ["named", "integrate", "function"]))=>()
15.238 - | _ => raise error "biegelinie.sml: Bsp 7.27 #5b";
15.239 -
15.240 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.241 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.242 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.243 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.244 -case nxt of (_, Apply_Method ["diff", "integration","named"]) => ()
15.245 - | _ => raise error "biegelinie.sml: Bsp 7.27 #6";
15.246 -
15.247 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.248 -val (p,_,f,nxt,_,pt) = me nxt p c pt(*nxt = Check_Postcond ["named", "int..*);
15.249 -f2str f;
15.250 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.251 -case nxt of (_, Substitute ["x = 0"]) => ()
15.252 - | _ => raise error "biegelinie.sml: Bsp 7.27 #7";
15.253 -
15.254 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.255 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.256 -if f2str f = "0 = c_2 + c * 0 + -1 * q_0 / 2 * 0 ^^^ 2" then ()
15.257 -else raise error "biegelinie.sml: Bsp 7.27 #8";
15.258 -
15.259 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.260 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.261 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.262 -if f2str f = "0 = c_2 + c * L + -1 * q_0 / 2 * L ^^^ 2" then ()
15.263 -else raise error "biegelinie.sml: Bsp 7.27 #9";
15.264 -
15.265 -(*val nxt = (+, Subproblem ("Biegelinie.thy", ["normalize", ..lin..sys]))*)
15.266 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.267 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.268 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.269 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.270 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.271 -case nxt of (_, Apply_Method ["EqSystem", "normalize", "2x2"]) => ()
15.272 - | _ => raise error "biegelinie.sml: Bsp 7.27 #10";
15.273 -
15.274 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.275 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.276 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.277 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.278 -(*val nxt = Subproblem ["triangular", "2x2", "linear", "system"]*)
15.279 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.280 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.281 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.282 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.283 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.284 -case nxt of (_, Apply_Method["EqSystem", "top_down_substitution", "2x2"]) => ()
15.285 - | _ => raise error "biegelinie.sml: Bsp 7.27 #11";
15.286 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.287 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.288 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.289 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.290 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.291 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.292 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.293 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.294 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.295 -case nxt of (_, Check_Postcond ["normalize", "2x2", "linear", "system"]) => ()
15.296 - | _ => raise error "biegelinie.sml: Bsp 7.27 #12";
15.297 -
15.298 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.299 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.300 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.301 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.302 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.303 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.304 -case nxt of
15.305 - (_, Subproblem ("Biegelinie.thy", ["named", "integrate", "function"]))=>()
15.306 - | _ => raise error "biegelinie.sml: Bsp 7.27 #13";
15.307 -
15.308 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.309 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.310 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.311 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.312 -case nxt of (_, Apply_Method ["diff", "integration", "named"]) => ()
15.313 - | _ => raise error "biegelinie.sml: Bsp 7.27 #14";
15.314 -
15.315 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.316 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.317 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.318 -case nxt of
15.319 - (_, Check_Postcond ["named", "integrate", "function"]) => ()
15.320 - | _ => raise error "biegelinie.sml: Bsp 7.27 #15";
15.321 -
15.322 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.323 -if f2str f =
15.324 - "y' x = c + 1 / (-1 * EI) * (L * q_0 / 4 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3)"
15.325 -then () else raise error "biegelinie.sml: Bsp 7.27 #16 f";
15.326 -case nxt of
15.327 - (_, Subproblem ("Biegelinie.thy", ["named", "integrate", "function"]))=>()
15.328 - | _ => raise error "biegelinie.sml: Bsp 7.27 #16";
15.329 -
15.330 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.331 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.332 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.333 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.334 -case nxt of (_, Apply_Method ["diff", "integration", "named"]) => ()
15.335 - | _ => raise error "biegelinie.sml: Bsp 7.27 #17";
15.336 -
15.337 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.338 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.339 -if f2str f =
15.340 - "y x =\nc_2 + c * x +\n\
15.341 - \1 / (-1 * EI) * (L * q_0 / 12 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)"
15.342 -then () else raise error "biegelinie.sml: Bsp 7.27 #18 f";
15.343 -case nxt of
15.344 - (_, Check_Postcond ["named", "integrate", "function"]) => ()
15.345 - | _ => raise error "biegelinie.sml: Bsp 7.27 #18";
15.346 -
15.347 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.348 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.349 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.350 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.351 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.352 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.353 -case nxt of
15.354 - (_, Subproblem
15.355 - ("Biegelinie.thy", ["normalize", "2x2", "linear", "system"])) => ()
15.356 - | _ => raise error "biegelinie.sml: Bsp 7.27 #19";
15.357 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.358 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.359 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.360 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.361 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.362 -case nxt of (_, Apply_Method ["EqSystem", "normalize", "2x2"]) => ()
15.363 - | _ => raise error "biegelinie.sml: Bsp 7.27 #20";
15.364 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.365 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.366 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.367 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.368 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.369 -if f2str f = "[c_2 = 0, L * c + c_2 = -1 * q_0 * L ^^^ 4 / (-24 * EI)]" then ()
15.370 -else raise error "biegelinie.sml: Bsp 7.27 #21 f";
15.371 -case nxt of
15.372 - (_, Subproblem
15.373 - ("Biegelinie.thy", ["triangular", "2x2", "linear", "system"])) =>()
15.374 - | _ => raise error "biegelinie.sml: Bsp 7.27 #21";
15.375 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.376 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.377 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.378 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.379 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.380 -case nxt of (_, Apply_Method["EqSystem", "top_down_substitution", "2x2"]) => ()
15.381 - | _ => raise error "biegelinie.sml: Bsp 7.27 #22";
15.382 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.383 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.384 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.385 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.386 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.387 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.388 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.389 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.390 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.391 -case nxt of (_, Check_Postcond ["normalize", "2x2", "linear", "system"]) => ()
15.392 - | _ => raise error "biegelinie.sml: Bsp 7.27 #23";
15.393 -
15.394 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.395 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.396 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.397 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.398 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.399 -if f2str f =
15.400 -"y x =\n-1 * q_0 * L ^^^ 4 / (-24 * EI * L) * x +\n\
15.401 - \(2 * L * q_0 / (-1 * 24 * EI) * x ^^^ 3 +\n\
15.402 - \ -1 * q_0 / (-1 * 24 * EI) * x ^^^ 4)" then ()
15.403 -else raise error "biegelinie.sml: Bsp 7.27 #24 f";
15.404 -case nxt of ("End_Proof'", End_Proof') => ()
15.405 - | _ => raise error "biegelinie.sml: Bsp 7.27 #24";
15.406 -
15.407 -(* use"../smltest/IsacKnowledge/biegelinie.sml";
15.408 - *)
15.409 -show_pt pt;
15.410 -(*(([], Frm), Problem (Biegelinie.thy, [MomentBestimmte, Biegelinien])),
15.411 -(([1], Frm), q_ x = q_0),
15.412 -(([1], Res), - q_ x = - q_0),
15.413 -(([2], Res), Q' x = - q_0),
15.414 -(([3], Pbl), Integrate (- q_0, x)),
15.415 -(([3,1], Frm), Q x = Integral - q_0 D x),
15.416 -(([3,1], Res), Q x = -1 * q_0 * x + c),
15.417 -(([3], Res), Q x = -1 * q_0 * x + c),
15.418 -(([4], Res), M_b' x = -1 * q_0 * x + c),
15.419 -(([5], Pbl), Integrate (-1 * q_0 * x + c, x)),
15.420 -(([5,1], Frm), M_b x = Integral -1 * q_0 * x + c D x),
15.421 -(([5,1], Res), M_b x = -1 * q_0 * x ^^^ 2 / 2 + x * c + c_2),
15.422 -(([5], Res), M_b x = -1 * q_0 * x ^^^ 2 / 2 + x * c + c_2),
15.423 -(([6], Res), M_b 0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2),
15.424 -(([7], Res), 0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2),
15.425 -(([8], Res), M_b L = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2),
15.426 -(([9], Res), 0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2),
15.427 -(([10], Pbl), solveSystem [0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2] [c_2]),
15.428 -(([10,1], Frm), [0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2,
15.429 - 0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2]),
15.430 -(([10,1], Res), [0 = c_2, 0 = -1 * (q_0 * L ^^^ 2) / 2 + (L * c + c_2)]),
15.431 -(([10,2], Res), [c_2 = 0, L * c + c_2 = 0 + -1 * (-1 * (q_0 * L ^^^ 2) / 2)]),
15.432 -(([10,3], Res), [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]),
15.433 -(([10,4], Pbl), solveSystem [L * c + c_2 = q_0 * L ^^^ 2 / 2] [c_2]),
15.434 -(([10,4,1], Frm), L * c + c_2 = q_0 * L ^^^ 2 / 2),
15.435 -(([10,4,1], Res), L * c + 0 = q_0 * L ^^^ 2 / 2),
15.436 -(([10,4,2], Res), L * c = q_0 * L ^^^ 2 / 2),
15.437 -(([10,4,3], Res), c = q_0 * L ^^^ 2 / 2 / L),
15.438 -(([10,4,4], Res), c = L * q_0 / 2),
15.439 -(([10,4,5], Res), [c = L * q_0 / 2, c_2 = 0]),
15.440 -(([10,4], Res), [c = L * q_0 / 2, c_2 = 0]),
15.441 -(([10], Res), [c = L * q_0 / 2, c_2 = 0]),
15.442 -(([11], Res), M_b x = -1 * q_0 * x ^^^ 2 / 2 + x * (L * q_0 / 2) + 0),
15.443 -(([12], Res), M_b x = L * q_0 * x / 2 + -1 * q_0 * x ^^^ 2 / 2),
15.444 -(([13], Res), EI * y'' x = L * q_0 * x / 2 + -1 * q_0 * x ^^^ 2 / 2),
15.445 -(([14], Res), y'' x = 1 / EI * (L * q_0 * x / 2 + -1 * q_0 * x ^^^ 2 / 2)),
15.446 -(([15], Pbl), Integrate (1 / EI * (L * q_0 * x / 2 + -1 * q_0 * x ^^^ 2 / 2), x)),
15.447 -(([15,1], Frm), y' x = Integral 1 / EI * (L * q_0 * x / 2 + -1 * q_0 * x ^^^ 2 / 2) D x),
15.448 -(([15,1], Res), y' x =
15.449 -(Integral L * q_0 * x / 2 D x + Integral -1 * q_0 * x ^^^ 2 / 2 D x) / EI +
15.450 -c)]*)
15.451 -
15.452 -"----------- Bsp 7.27 autoCalculate ------------------------------";
15.453 -"----------- Bsp 7.27 autoCalculate ------------------------------";
15.454 -"----------- Bsp 7.27 autoCalculate ------------------------------";
15.455 - states:=[];
15.456 - CalcTree [(["Traegerlaenge L","Streckenlast q_0","Biegelinie y",
15.457 - "RandbedingungenBiegung [y 0 = 0, y L = 0]",
15.458 - "RandbedingungenMoment [M_b 0 = 0, M_b L = 0]",
15.459 - "FunktionsVariable x"],
15.460 - ("Biegelinie.thy",
15.461 - ["MomentBestimmte","Biegelinien"],
15.462 - ["IntegrierenUndKonstanteBestimmen"]))];
15.463 - moveActiveRoot 1;
15.464 - autoCalculate 1 CompleteCalcHead;
15.465 -
15.466 - fetchProposedTactic 1 (*->"Apply_Method" IntegrierenUndKonstanteBestimmen*);
15.467 -(*
15.468 -> val (_,Apply_Method' (_, NONE, ScrState is), _)::_ = tacis;
15.469 -> is = e_scrstate;
15.470 -val it = true : bool
15.471 -*)
15.472 - autoCalculate 1 (Step 1) (*->GENERATED ([1], Frm)*);
15.473 - val ((pt,_),_) = get_calc 1;
15.474 - case pt of Nd (PblObj _, [Nd _]) => ((*Apply_Method + Take*))
15.475 - | _ => raise error "biegelinie.sml: Bsp 7.27 autoCalculate#4c";
15.476 -
15.477 - autoCalculate 1 CompleteCalc;
15.478 -val ((pt,p),_) = get_calc 1;
15.479 -if p = ([], Res) andalso length (children pt) = 23 andalso
15.480 -term2str (get_obj g_res pt (fst p)) =
15.481 -"y x =\n-1 * q_0 * L ^^^ 4 / (-24 * EI * L) * x +\n(2 * L * q_0 / (-1 * 24 * EI) * x ^^^ 3 +\n -1 * q_0 / (-1 * 24 * EI) * x ^^^ 4)"
15.482 -then () else raise error "biegelinie.sml: 1st biegelin.7.27 changed";
15.483 -
15.484 - val (unc, del, gen) = (([],Pbl), ([],Pbl), ([],Res));
15.485 - getFormulaeFromTo 1 unc gen 1 (*only level 1*) false;
15.486 - show_pt pt;
15.487 -
15.488 -(*check all formulae for getTactic*)
15.489 - getTactic 1 ([1],Frm) (*see smltest/../reverse-rew.sml*);
15.490 - getTactic 1 ([5],Res) (*tac2xml: not impl. for Substitute ["x = 0"]*);
15.491 - getTactic 1 ([6],Res) (* ---"--- ["M_b 0 = 0"]*);
15.492 - getTactic 1 ([7],Res) (*!!!!!Take!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*);
15.493 - getTactic 1 ([8],Frm) (*tac2xml: not impl. for Substitute ["x = L"]*);
15.494 - getTactic 1 ([8],Res) (* ---"--- ["M_b L = 0"]*);
15.495 -
15.496 -
15.497 -"----------- SubProblem (_,[vonBelastungZu,Biegelinien] ----------";
15.498 -"----------- SubProblem (_,[vonBelastungZu,Biegelinien] ----------";
15.499 -"----------- SubProblem (_,[vonBelastungZu,Biegelinien] ----------";
15.500 -val fmz =
15.501 - ["Streckenlast q_0","FunktionsVariable x",
15.502 - "Funktionen [Q x = c + -1 * q_0 * x, \
15.503 - \M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2,\
15.504 - \ y' x = c_3 + 1 / (-1 * EI) * (c_2 * x + c / 2 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3),\
15.505 - \ y x = c_4 + c_3 * x + 1 / (-1 * EI) * (c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)]"];
15.506 -val (dI',pI',mI') = ("Biegelinie.thy", ["vonBelastungZu","Biegelinien"],
15.507 - ["Biegelinien","ausBelastung"]);
15.508 -val p = e_pos'; val c = [];
15.509 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
15.510 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.511 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.512 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.513 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.514 -if nxt = ("Apply_Method", Apply_Method ["Biegelinien", "ausBelastung"])
15.515 -then () else raise error "biegelinie.sml met2 b";
15.516 -
15.517 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "q_ x = q_0";
15.518 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "- q_ x = - q_0";
15.519 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "Q' x = - q_0";
15.520 -case nxt of (_, Subproblem (_, ["named", "integrate", "function"])) => ()
15.521 -| _ => raise error "biegelinie.sml met2 c";
15.522 -
15.523 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.524 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.525 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.526 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.527 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.528 -
15.529 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "Q x = c + -1 * q_0 * x";
15.530 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "Q x = c + -1 * q_0 * x";
15.531 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "M_b' x = c + -1 * q_0 * x";
15.532 -case nxt of (_,Subproblem (_, ["named", "integrate", "function"])) => ()
15.533 -| _ => raise error "biegelinie.sml met2 d";
15.534 -
15.535 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.536 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.537 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.538 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.539 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
15.540 - "M_b x = Integral c + -1 * q_0 * x D x";
15.541 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
15.542 - "M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2";
15.543 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
15.544 - "M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2";
15.545 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
15.546 - "- EI * y'' x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2";
15.547 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
15.548 - "y'' x = 1 / - EI * (c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2)";
15.549 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.550 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.551 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.552 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.553 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
15.554 - "y' x = Integral 1 / - EI * (c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2) D x";
15.555 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
15.556 -"y' x = Integral 1 / (-1 * EI) * (c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2) D x";
15.557 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
15.558 -"y' x =\nc_3 + 1 / (-1 * EI) * (c_2 * x + c / 2 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3)";
15.559 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
15.560 -"y' x =\nc_3 + 1 / (-1 * EI) * (c_2 * x + c / 2 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3)";
15.561 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.562 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.563 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.564 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.565 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
15.566 -"y x =\nIntegral c_3 +\n 1 / (-1 * EI) *\n (c_2 * x + c / 2 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3) D x";
15.567 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
15.568 -"y x =\nc_4 + c_3 * x +\n1 / (-1 * EI) *\n(c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)";
15.569 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
15.570 - "y x =\nc_4 + c_3 * x +\n1 / (-1 * EI) *\n(c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)";
15.571 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.572 -if nxt = ("End_Proof'", End_Proof') andalso f2str f =
15.573 - "[Q x = c + -1 * q_0 * x, M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2,\n y' x =\n c_3 + 1 / (-1 * EI) * (c_2 * x + c / 2 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3),\n y x =\n c_4 + c_3 * x +\n 1 / (-1 * EI) *\n (c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)]" then ()
15.574 -else raise error "biegelinie.sml met2 e";
15.575 -
15.576 -
15.577 -
15.578 -"----------- SubProblem (_,[setzeRandbedingungen,Biegelinien] ----";
15.579 -"----------- SubProblem (_,[setzeRandbedingungen,Biegelinien] ----";
15.580 -"----------- SubProblem (_,[setzeRandbedingungen,Biegelinien] ----";
15.581 -val str =
15.582 -"Script Function2Equality (fun_::bool) (sub_::bool) =\
15.583 -\(equ___::bool)"
15.584 -;
15.585 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
15.586 -val str =
15.587 -"Script Function2Equality (fun_::bool) (sub_::bool) =\
15.588 -\ (let v_ = argument_in (lhs fun_)\
15.589 -\ in (equ___::bool))"
15.590 -;
15.591 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
15.592 -val str =
15.593 -"Script Function2Equality (fun_::bool) (sub_::bool) =\
15.594 -\ (let v_ = argument_in (lhs fun_);\
15.595 -\ (equ_) = (Substitute [sub_]) fun_\
15.596 -\ in (equ_::bool))"
15.597 -;
15.598 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
15.599 -val str =
15.600 -"Script Function2Equality (fun_::bool) (sub_::bool) =\
15.601 -\ (let v_ = argument_in (lhs fun_);\
15.602 -\ equ_ = (Substitute [sub_]) fun_\
15.603 -\ in (Rewrite_Set_Inst [(bdv, v_)] make_ratpoly_in False) equ_)"
15.604 -;
15.605 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
15.606 -(*---^^^-OK-----------------------------------------------------------------*)
15.607 -val str =
15.608 -(*(M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2) (M_b L = 0) -->
15.609 - 0 = c_2 + c * L + -1 * q_0 / 2 * L ^^^ 2*)
15.610 -"Script Function2Equality (fun_::bool) (sub_::bool) =\
15.611 -\ (let bdv_ = argument_in (lhs fun_);\
15.612 -\ val_ = argument_in (lhs sub_);\
15.613 -\ equ_ = (Substitute [bdv_ = val_]) fun_;\
15.614 -\ equ_ = (Substitute [sub_]) fun_\
15.615 -\ in (Rewrite_Set_Inst [(bdv_, v_)] make_ratpoly_in False) equ_)"
15.616 -;
15.617 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
15.618 -(*---vvv-NOTok--------------------------------------------------------------*)
15.619 -atomty sc;
15.620 -
15.621 -val fmz = ["functionEq (M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2)",
15.622 - "substitution (M_b L = 0)",
15.623 - "equality equ___"];
15.624 -val (dI',pI',mI') = ("Biegelinie.thy", ["makeFunctionTo","equation"],
15.625 - ["Equation","fromFunction"]);
15.626 -val p = e_pos'; val c = [];
15.627 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
15.628 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.629 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.630 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.631 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.632 -
15.633 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
15.634 - "M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2";
15.635 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
15.636 - "M_b L = c_2 + c * L + -1 * q_0 / 2 * L ^^^ 2";
15.637 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
15.638 - "0 = c_2 + c * L + -1 * q_0 / 2 * L ^^^ 2";
15.639 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.640 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.641 -if nxt = ("End_Proof'", End_Proof') andalso
15.642 -(* f2str f = "0 = c_2 + L * c + -1 * q_0 / 2 * L ^^^ 2"
15.643 -CHANGE NOT considered, already on leave*)
15.644 - f2str f = "0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2"
15.645 -then () else raise error "biegelinie.sml: SubProblem (_,[setzeRandbed";
15.646 -
15.647 -
15.648 -"----------- method [Biegelinien,setzeRandbedingungenEin] + exec -";
15.649 -"----------- method [Biegelinien,setzeRandbedingungenEin] + exec -";
15.650 -"----------- method [Biegelinien,setzeRandbedingungenEin] + exec -";
15.651 -"----- check the scripts syntax";
15.652 -val str =
15.653 -"Script SetzeRandbedScript (funs_::bool list) (beds_::bool list) =\
15.654 -\ (let b1 = Take (nth_ 1 beds_)\
15.655 -\ in (equs_::bool list))"
15.656 -;
15.657 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
15.658 -val str =
15.659 -"Script SetzeRandbedScript (funs_::bool list) (beds_::bool list) =\
15.660 -\ (let b1_ = Take (nth_ 1 beds_); \
15.661 -\ fs_ = filter (sameFunId (lhs b1_)) funs_; \
15.662 -\ f1_ = hd fs_ \
15.663 -\ in (equs_::bool list))"
15.664 -;
15.665 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
15.666 -
15.667 -val ttt = str2term "sameFunId (lhs b1_) fun___"; atomty ttt;
15.668 -val ttt = str2term "filter"; atomty ttt;
15.669 -val ttt = str2term "filter::[real => bool, real list] => real list";atomty ttt;
15.670 -val ttt = str2term "filter::[bool => bool, bool list] => bool list";
15.671 -val ttt = str2term "filter (sameFunId (lhs b1_)) funs_"; atomty ttt;
15.672 -
15.673 -val str =
15.674 -"Script SetzeRandbedScript (funs_::bool list) (rb_::bool list) =\
15.675 -\ (let beds_ = rev beds_; \
15.676 -\ b1_ = Take (nth_ 1 beds_); \
15.677 -\ fs_ = filter (sameFunId (lhs b1_)) funs_; \
15.678 -\ f1_ = hd fs_ \
15.679 -\ in (equs_::bool list))"
15.680 -;
15.681 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
15.682 -val str =
15.683 -"Script SetzeRandbedScript (funs_::bool list) (rb_::bool list) =\
15.684 -\ (let b1_ = Take (nth_ 1 rb_); \
15.685 -\ fs_ = filter (sameFunId (lhs b1_)) funs_; \
15.686 -\ (equ_::bool) = \
15.687 -\ (SubProblem (Biegelinie_,[makeFunctionTo,equation],\
15.688 -\ [Equation,fromFunction]) \
15.689 -\ [bool_ (hd fs_), bool_ b1_]) \
15.690 -\ in [equ_])"
15.691 -;
15.692 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
15.693 -val str =
15.694 -"Script SetzeRandbedScript (funs_::bool list) (rb_::bool list) =\
15.695 -\ (let b1_ = Take (nth_ 1 rb_); \
15.696 -\ fs_ = filter (sameFunId (lhs b1_)) funs_; \
15.697 -\ (e1_::bool) = \
15.698 -\ (SubProblem (Biegelinie_,[makeFunctionTo,equation],\
15.699 -\ [Equation,fromFunction]) \
15.700 -\ [bool_ (hd fs_), bool_ b1_]); \
15.701 -\ b2_ = Take (nth_ 2 rb_); \
15.702 -\ fs_ = filter (sameFunId (lhs b2_)) funs_; \
15.703 -\ (e2_::bool) = \
15.704 -\ (SubProblem (Biegelinie_,[makeFunctionTo,equation],\
15.705 -\ [Equation,fromFunction]) \
15.706 -\ [bool_ (hd fs_), bool_ b2_]) \
15.707 -\ in [e1_,e1_])"
15.708 -;
15.709 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
15.710 -(*---vvv-NOTok--------------------------------------------------------------*)
15.711 -(*---^^^-OK-----------------------------------------------------------------*)
15.712 -atomty sc;
15.713 -
15.714 -"----- execute script by manual rewriting";
15.715 -(*show_types := true;*)
15.716 -val funs_ = str2term "funs_::bool list";
15.717 -val funs = str2term
15.718 - "[Q x = c + -1 * q_0 * x,\
15.719 - \M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2,\
15.720 - \y' x = c_3 + 1 / (-1 * EI) * (c_2 * x + c / 2 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3),\
15.721 - \y x = c_4 + c_3 * x + 1 / (-1 * EI) * (c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)]";
15.722 -val rb_ = str2term "rb_::bool list";
15.723 -val rb = str2term "[y 0 = 0, y L = 0, M_b 0 = 0, M_b L = 0]";
15.724 -
15.725 -"--- script expression 1";
15.726 -val screxp1_ = str2term "Take (nth_ 1 (rb_::bool list))";
15.727 -val screxp1 = subst_atomic [(rb_, rb)] screxp1_; term2str screxp1;
15.728 -val SOME (b1,_) = rewrite_set_ Isac.thy false srls2 screxp1; term2str b1;
15.729 -if term2str b1 = "Take (y 0 = 0)" then ()
15.730 -else raise error "biegelinie.sml: rew. Bieglie2 --1";
15.731 -val b1 = str2term "(y 0 = 0)";
15.732 -
15.733 -"--- script expression 2";
15.734 -val screxp2_ = str2term "filter (sameFunId (lhs b1_)) funs_";
15.735 -val b1_ = str2term "b1_::bool";
15.736 -val screxp2 = subst_atomic [(b1_,b1),(funs_,funs)] screxp2_; term2str screxp2;
15.737 -val SOME (fs,_) = rewrite_set_ Isac.thy false srls2 screxp2; term2str fs;
15.738 -if term2str fs = "[y x =\n c_4 + c_3 * x +\n 1 / (-1 * EI) *\n (c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)]" then ()
15.739 -else raise error "biegelinie.sml: rew. Bieglie2 --2";
15.740 -
15.741 -"--- script expression 3";
15.742 -val screxp3_ = str2term "SubProblem (Biegelinie_,[makeFunctionTo,equation],\
15.743 -\ [Equation,fromFunction]) \
15.744 -\ [bool_ (hd fs_), bool_ b1_]";
15.745 -val fs_ = str2term "fs_::bool list";
15.746 -val screxp3 = subst_atomic [(fs_,fs),(b1_,b1)] screxp3_;
15.747 -writeln (term2str screxp3);
15.748 -val SOME (equ,_) = rewrite_set_ Isac.thy false srls2 screxp3;
15.749 -if term2str equ = "SubProblem\n (Biegelinie_, [makeFunctionTo, equation], [Equation, fromFunction])\n [bool_\n (y x =\n c_4 + c_3 * x +\n 1 / (-1 * EI) *\n (c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)),\n bool_ (y 0 = 0)]" then ()
15.750 -else raise error "biegelinie.sml: rew. Bieglie2 --3";
15.751 -writeln (term2str equ);
15.752 -(*SubProblem
15.753 - (Biegelinie_, [makeFunctionTo, equation], [Equation, fromFunction])
15.754 - [bool_
15.755 - (y x =
15.756 - c_4 + c_3 * x +
15.757 - 1 / (-1 * EI) *
15.758 - (c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)),
15.759 - bool_ (y 0 = 0)]*)
15.760 -show_types := false;
15.761 -
15.762 -
15.763 -"----- execute script by interpreter: setzeRandbedingungenEin";
15.764 -val fmz = ["Funktionen [Q x = c + -1 * q_0 * x,\
15.765 - \M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2,\
15.766 - \y' x = c_3 + 1 / (-1 * EI) * (c_2 * x + c / 2 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3),\
15.767 - \y x = c_4 + c_3 * x + 1 / (-1 * EI) * (c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)]",
15.768 - "Randbedingungen [y 0 = 0, y L = 0, M_b 0 = 0, M_b L = 0]",
15.769 - "Gleichungen equs___"];
15.770 -val (dI',pI',mI') = ("Biegelinie.thy", ["setzeRandbedingungen","Biegelinien"],
15.771 - ["Biegelinien","setzeRandbedingungenEin"]);
15.772 -val p = e_pos'; val c = [];
15.773 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
15.774 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.775 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.776 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.777 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.778 -
15.779 -"--- before 1.subpbl [Equation, fromFunction]";
15.780 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.781 -case nxt of (_, Apply_Method ["Biegelinien", "setzeRandbedingungenEin"])=>()
15.782 -| _ => raise error "biegelinie.sml: met setzeRandbed*Ein aa";
15.783 -"----- Randbedingung y 0 = 0 in SUBpbl with met [Equation, fromFunction]";
15.784 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.785 -if (#1 o (get_obj g_fmz pt)) (fst p) =
15.786 - ["functionEq\n (y x =\n c_4 + c_3 * x +\n 1 / (-1 * EI) *\n (c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4))",
15.787 - "substitution (y 0 = 0)", "equality equ___"] then ()
15.788 -else raise error "biegelinie.sml met setzeRandbed*Ein bb";
15.789 -(writeln o istate2str) (get_istate pt p);
15.790 -"--- after 1.subpbl [Equation, fromFunction]";
15.791 -
15.792 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.793 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.794 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.795 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.796 -case nxt of (_, Apply_Method["Equation", "fromFunction"]) => ()
15.797 -| _ => raise error "biegelinie.sml met2 ff";
15.798 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
15.799 - "y x =\nc_4 + c_3 * x +\n1 / (-1 * EI) *\n(c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)";
15.800 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.801 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.802 -case nxt of (_, Check_Postcond ["makeFunctionTo", "equation"]) => ()
15.803 -| _ => raise error "biegelinie.sml met2 gg";
15.804 -
15.805 -"--- before 2.subpbl [Equation, fromFunction]";
15.806 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "0 = c_4 + 0 / (-1 * EI)" ;
15.807 -case nxt of (_,Subproblem (_, ["makeFunctionTo", "equation"])) => ()
15.808 -| _ => raise error "biegelinie.sml met2 hh";
15.809 -"--- after 1st arrival at 2.subpbl [Equation, fromFunction]";
15.810 -
15.811 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.812 -if (#1 o (get_obj g_fmz pt)) (fst p) =
15.813 - ["functionEq\n (y x =\n c_4 + c_3 * x +\n 1 / (-1 * EI) *\n (c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4))",
15.814 - "substitution (y L = 0)", "equality equ___"] then ()
15.815 -else raise error "biegelinie.sml metsetzeRandbed*Ein bb ";
15.816 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.817 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.818 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.819 -
15.820 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.821 -case nxt of (_, Apply_Method["Equation", "fromFunction"]) => ()
15.822 -| _ => raise error "biegelinie.sml met2 ii";
15.823 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "y x =\nc_4 + c_3 * x +\n1 / (-1 * EI) *\n(c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)";
15.824 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "y L =\nc_4 + c_3 * L +\n1 / (-1 * EI) *\n(c_2 / 2 * L ^^^ 2 + c / 6 * L ^^^ 3 + -1 * q_0 / 24 * L ^^^ 4)";
15.825 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "0 =\nc_4 + c_3 * L +\n1 / (-1 * EI) *\n(c_2 / 2 * L ^^^ 2 + c / 6 * L ^^^ 3 + -1 * q_0 / 24 * L ^^^ 4)";
15.826 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "0 =\nc_4 + L * c_3 +\n(12 * L ^^^ 2 * c_2 + 4 * L ^^^ 3 * c + -1 * L ^^^ 4 * q_0) / (-24 * EI)" ;
15.827 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "0 =\nc_4 + L * c_3 +\n(12 * L ^^^ 2 * c_2 + 4 * L ^^^ 3 * c + -1 * L ^^^ 4 * q_0) / (-24 * EI)";
15.828 -case nxt of (_,Subproblem (_, ["makeFunctionTo", "equation"])) => ()
15.829 -| _ => raise error "biegelinie.sml met2 jj";
15.830 -
15.831 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.832 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.833 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.834 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.835 -case nxt of (_, Apply_Method ["Equation", "fromFunction"])=>()
15.836 -| _ => raise error "biegelinie.sml met2 kk";
15.837 -
15.838 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2"(*true*);
15.839 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "0 = c_2 + c * 0 + -1 * q_0 / 2 * 0 ^^^ 2";
15.840 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "0 = c_2";
15.841 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "0 = c_2";
15.842 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.843 -case nxt of (_,Subproblem (_, ["makeFunctionTo", "equation"])) => ()
15.844 -| _ => raise error "biegelinie.sml met2 ll";
15.845 -
15.846 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.847 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.848 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.849 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.850 -case nxt of (_, Apply_Method ["Equation", "fromFunction"])=>()
15.851 -| _ => raise error "biegelinie.sml met2 mm";
15.852 -
15.853 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2";
15.854 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "M_b L = c_2 + c * L + -1 * q_0 / 2 * L ^^^ 2";
15.855 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "0 = c_2 + c * L + -1 * q_0 / 2 * L ^^^ 2";
15.856 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2";
15.857 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2";
15.858 -case nxt of (_, Check_Postcond ["setzeRandbedingungen", "Biegelinien"]) => ()
15.859 -| _ => raise error "biegelinie.sml met2 nn";
15.860 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.861 -if nxt = ("End_Proof'", End_Proof') andalso f2str f =
15.862 -(* "[0 = c_4,\n 0 =\n c_4 + L * c_3 +\n (12 * L ^^^ 2 * c_2 + 4 * L ^^^ 3 * c + -1 * L ^^^ 4 * q_0) / (-24 * EI),\n 0 = c_2, 0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2]" *)
15.863 -"[0 = c_4,\n 0 =\n c_4 + L * c_3 +\n (12 * L ^^^ 2 * c_2 + 4 * L ^^^ 3 * c + -1 * L ^^^ 4 * q_0) /\n (-1 * EI * 24),\n 0 = c_2, 0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2]"
15.864 -then () else raise error "biegelinie.sml met2 oo";
15.865 -
15.866 -(*
15.867 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
15.868 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.869 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.870 -*)
15.871 -
15.872 -"----------- method [Biegelinien,setzeRandbedingungenEin]FAST ----";
15.873 -"----------- method [Biegelinien,setzeRandbedingungenEin]FAST ----";
15.874 -"----------- method [Biegelinien,setzeRandbedingungenEin]FAST ----";
15.875 -(*---^^^-OK-----------------------------------------------------------------*)
15.876 -(*---vvv-NOTok--------------------------------------------------------------*)
15.877 -val str =
15.878 -"Script SetzeRandbedScript (funs_::bool list) (rb_::bool list) = \
15.879 -\ (let b1_ = nth_ 1 rb_; \
15.880 -\ (fs_::bool list) = filter_sameFunId (lhs b1_) funs_; \
15.881 -\ (e1_::bool) = \
15.882 -\ (SubProblem (Biegelinie_,[makeFunctionTo,equation],\
15.883 -\ [Equation,fromFunction]) \
15.884 -\ [bool_ (hd fs_), bool_ b1_]) \
15.885 -\ in [e1_,e2_,e3_,e4_])"
15.886 -;
15.887 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
15.888 -(*---vvv-NOTok--------------------------------------------------------------*)
15.889 -val str =
15.890 -"Script SetzeRandbedScript (funs_::bool list) (rb_::bool list) = \
15.891 -\ (let b1_ = nth_ 1 rb_; \
15.892 -\ fs_ = filter_sameFunId (lhs b1_) funs_; \
15.893 -\ (e1_::bool) = \
15.894 -\ (SubProblem (Biegelinie_,[makeFunctionTo,equation],\
15.895 -\ [Equation,fromFunction]) \
15.896 -\ [bool_ (hd fs_), bool_ b1_]); \
15.897 -\ b2_ = nth_ 2 rb_; \
15.898 -\ fs_ = filter_sameFunId (lhs b2_) funs_; \
15.899 -\ (e2_::bool) = \
15.900 -\ (SubProblem (Biegelinie_,[makeFunctionTo,equation],\
15.901 -\ [Equation,fromFunction]) \
15.902 -\ [bool_ (hd fs_), bool_ b2_]); \
15.903 -\ b3_ = nth_ 3 rb_; \
15.904 -\ fs_ = filter_sameFunId (lhs b3_) funs_; \
15.905 -\ (e3_::bool) = \
15.906 -\ (SubProblem (Biegelinie_,[makeFunctionTo,equation],\
15.907 -\ [Equation,fromFunction]) \
15.908 -\ [bool_ (hd fs_), bool_ b3_]); \
15.909 -\ b4_ = nth_ 4 rb_; \
15.910 -\ fs_ = filter_sameFunId (lhs b4_) funs_; \
15.911 -\ (e4_::bool) = \
15.912 -\ (SubProblem (Biegelinie_,[makeFunctionTo,equation],\
15.913 -\ [Equation,fromFunction]) \
15.914 -\ [bool_ (hd fs_), bool_ b4_]) \
15.915 -\ in [e1_,e2_,e3_,e4_])"
15.916 -;
15.917 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
15.918 -
15.919 -
15.920 -
15.921 -"----------- IntegrierenUndKonstanteBestimmen2: Bsp.7.70. --------";
15.922 -"----------- IntegrierenUndKonstanteBestimmen2: Bsp.7.70. --------";
15.923 -"----------- IntegrierenUndKonstanteBestimmen2: Bsp.7.70. --------";
15.924 -"----- script ";
15.925 -val str =
15.926 -"Script Belastung2BiegelScript (q__::real) (v_::real) = \
15.927 -\ (let q___ = Take (q_ v_ = q__); \
15.928 -\ q___ = ((Rewrite sym_real_minus_eq_cancel True) @@ \
15.929 -\ (Rewrite Belastung_Querkraft True)) q___; \
15.930 -\ (Q__:: bool) = \
15.931 -\ (SubProblem (Biegelinie_,[named,integrate,function], \
15.932 -\ [diff,integration,named]) \
15.933 -\ [real_ (rhs q___), real_ v_, real_real_ Q]); \
15.934 -\ M__ = Rewrite Querkraft_Moment True Q__; \
15.935 -\ (M__::bool) = \
15.936 -\ (SubProblem (Biegelinie_,[named,integrate,function], \
15.937 -\ [diff,integration,named]) \
15.938 -\ [real_ (rhs M__), real_ v_, real_real_ M_b]); \
15.939 -\ N__ = ((Rewrite Moment_Neigung False) @@ \
15.940 -\ (Rewrite make_fun_explicit False)) M__; \
15.941 -\ (N__:: bool) = \
15.942 -\ (SubProblem (Biegelinie_,[named,integrate,function], \
15.943 -\ [diff,integration,named]) \
15.944 -\ [real_ (rhs N__), real_ v_, real_real_ y']); \
15.945 -\ (B__:: bool) = \
15.946 -\ (SubProblem (Biegelinie_,[named,integrate,function], \
15.947 -\ [diff,integration,named]) \
15.948 -\ [real_ (rhs N__), real_ v_, real_real_ y]) \
15.949 -\ in [Q__, M__, N__, B__])"
15.950 -;
15.951 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
15.952 -(*---^^^-OK-----------------------------------------------------------------*)
15.953 -(*---vvv-NOTok--------------------------------------------------------------*)
15.954 -
15.955 -
15.956 -"----- Bsp 7.70 with me";
15.957 -val fmz = ["Traegerlaenge L","Streckenlast q_0","Biegelinie y",
15.958 - "Randbedingungen [y 0 = 0, y L = 0, M_b 0 = 0, M_b L = 0]",
15.959 - "FunktionsVariable x"];
15.960 -val (dI',pI',mI') = ("Biegelinie.thy", ["Biegelinien"],
15.961 - ["IntegrierenUndKonstanteBestimmen2"]);
15.962 -val p = e_pos'; val c = [];
15.963 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
15.964 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.965 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.966 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.967 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.968 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
15.969 -if nxt = ("Apply_Method", Apply_Method ["IntegrierenUndKonstanteBestimmen2"])
15.970 -then () else raise error "biegelinie.sml met2 a";
15.971 -
15.972 -(*** actual arg(s) missing for '["(#Find, (Funktionen, funs_))"]' i.e. should be 'copy-named' by '*_._'
15.973 -... THIS MEANS:
15.974 -#a# "Script Biegelinie2Script ..
15.975 -\ ... (SubProblem (Biegelinie_,[vonBelastungZu,Biegelinien], \
15.976 -\ [Biegelinien,ausBelastung]) \
15.977 -\ [real_ q__, real_ v_]); \
15.978 -
15.979 -#b# prep_met ... (["Biegelinien","ausBelastung"],
15.980 - ... ("#Given" ,["Streckenlast q__","FunktionsVariable v_"]),
15.981 - "Script Belastung2BiegelScript (q__::real) (v_::real) = \
15.982 -
15.983 -#a#b# BOTH HAVE 2 ARGUMENTS q__ and v_ ...OK
15.984 -##########################################################################
15.985 -BUT THE (#Find, (Funktionen, funs_)) IS NOT COPYNAMED BY funs___ !!!3*_!!!
15.986 -##########################################################################*)
15.987 -"further 'me' see ----- SubProblem (_,[vonBelastungZu,Biegelinien] -------\
15.988 -\ ----- SubProblem (_,[setzeRandbedingungen,Biegelinien] -";
15.989 -
15.990 -"----- Bsp 7.70 with autoCalculate";
15.991 -states:=[];
15.992 -CalcTree [(["Traegerlaenge L","Streckenlast q_0","Biegelinie y",
15.993 - "Randbedingungen [Q 0 = q_0 * L, M_b L = 0, y 0 = 0, y' 0 = 0]",
15.994 - "FunktionsVariable x"],
15.995 - ("Biegelinie.thy", ["Biegelinien"],
15.996 - ["IntegrierenUndKonstanteBestimmen2"]))];
15.997 -moveActiveRoot 1;
15.998 -autoCalculate 1 CompleteCalc;
15.999 -val ((pt,p),_) = get_calc 1; show_pt pt;
15.1000 -if p = ([], Res) andalso term2str (get_obj g_res pt (fst p)) =
15.1001 -"y x =\n-6 * q_0 * L ^^^ 2 / (-24 * EI) * x ^^^ 2 +\n4 * L * q_0 / (-24 * EI) * x ^^^ 3 +\n-1 * q_0 / (-24 * EI) * x ^^^ 4" then ()
15.1002 -else raise error "biegelinie.sml: diff.behav.7.70 with autoCalculate";
15.1003 -
15.1004 -val is = get_istate pt ([],Res); writeln (istate2str is);
15.1005 -val t = str2term " last \
15.1006 -\[Q x = L * q_0 + -1 * q_0 * x, \
15.1007 -\ M_b x = -1 * q_0 * L ^^^ 2 / 2 + q_0 * L / 1 * x + -1 * q_0 / 2 * x ^^^ 2,\
15.1008 -\ y' x = \
15.1009 -\ -3 * q_0 * L ^^^ 2 / (-6 * EI) * x + 3 * L * q_0 / (-6 * EI) * x ^^^ 2 +\
15.1010 -\ -1 * q_0 / (-6 * EI) * x ^^^ 3, \
15.1011 -\ y x = \
15.1012 -\ -6 * q_0 * L ^^^ 2 / (-24 * EI) * x ^^^ 2 + \
15.1013 -\ 4 * L * q_0 / (-24 * EI) * x ^^^ 3 + \
15.1014 -\ -1 * q_0 / (-24 * EI) * x ^^^ 4]";
15.1015 -val srls = append_rls "erls_IntegrierenUndK.." e_rls
15.1016 - [Calc("Tools.rhs", eval_rhs"eval_rhs_"),
15.1017 - Calc ("Atools.ident",eval_ident "#ident_"),
15.1018 - Thm ("last_thmI",num_str last_thmI),
15.1019 - Thm ("if_True",num_str if_True),
15.1020 - Thm ("if_False",num_str if_False)
15.1021 - ]
15.1022 - ;
15.1023 -val t = str2term "last [1,2,3,4]";
15.1024 -trace_rewrite := true;
15.1025 -val SOME (e1__,_) = rewrite_set_ thy false srls t;
15.1026 -trace_rewrite := false;
15.1027 -term2str e1__;
15.1028 -
15.1029 -trace_script := true;
15.1030 -trace_script := false;
15.1031 -
15.1032 -
15.1033 -"----------- investigate normalforms in biegelinien --------------";
15.1034 -"----------- investigate normalforms in biegelinien --------------";
15.1035 -"----------- investigate normalforms in biegelinien --------------";
15.1036 -"----- coming from integration:";
15.1037 -val Q = str2term "Q x = c + -1 * q_0 * x";
15.1038 -val M_b = str2term "M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2";
15.1039 -val y' = str2term "y' x = c_3 + 1 / (-1 * EI) * (c_2 * x + c / 2 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3)";
15.1040 -val y = str2term "y x = c_4 + c_3 * x +\n1 / (-1 * EI) * (c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)";
15.1041 -(*^^^ 1 / (-1 * EI) NOT distributed - ok! ^^^^^^^^^^^^^^^^^^^^^^^*)
15.1042 -
15.1043 -"----- functions comming from:";
16.1 --- a/test/Tools/isac/IsacKnowledge/complex.sml Mon Aug 30 14:29:49 2010 +0200
16.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
16.3 @@ -1,37 +0,0 @@
16.4 -(* tests for Complex.thy
16.5 -
16.6 -use"../smltest/IsacKnowledge/complex.sml";
16.7 -use"complex.sml";
16.8 -*)
16.9 -
16.10 -val thy = Isac.thy;
16.11 -subthy (Float.thy, ComplexI.thy);
16.12 -
16.13 - val t = (term_of o the o (parse ComplexI.thy)) "I__";
16.14 - atomt t;
16.15 - val t = str2term "I__";
16.16 - atomt t;
16.17 - val t = str2term "1 + 2 * I__";
16.18 - atomt t;
16.19 - val t = str2term "1 + 2 * I__ + 3 + 4 * I__ * (5 + 6 * I__) / (7 + 8 * I__)";
16.20 - atomt t;
16.21 -(*andere konkrete Syntax ???*)
16.22 -
16.23 - val t = str2term "Float ((1,2),(0,0)) * I__";
16.24 - atomt t;
16.25 - term2str t;
16.26 - val t = str2term "Float ((1,2),(0,0)) + Float ((3,4),(0,0)) * I__";
16.27 - atomt t;
16.28 - term2str t;
16.29 -
16.30 - (*--- (1.1 + 2.2 I) * (3.3 + 4.4 I) = - 6.05 + 12 I ---*)
16.31 - val t = str2term "(Float ((11,-1),(0,0)) + Float ((22,-1),(0,0)) * I__) *\
16.32 - \(Float ((33,-1),(0,0)) + Float ((44,-1),(0,0)) * I__)";
16.33 - val SOME (t',_) =
16.34 - rewrite_set_ thy false
16.35 - (append_rls "simpl_complex" make_polynomial
16.36 - [Thm ("square_I", num_str square_I)]) t;
16.37 - term2str t';
16.38 - "Float ((363, -2), 0, 0) + I__ * Float ((484, -2), 0, 0) +\
16.39 - \I__ * Float ((726, -2), 0, 0) + -1 * Float ((968, -2), 0, 0)"
16.40 - (*--- mit dem rls make_polynomial geht ja schon allerhand !!!---*)
16.41 \ No newline at end of file
17.1 --- a/test/Tools/isac/IsacKnowledge/diff.sml Mon Aug 30 14:29:49 2010 +0200
17.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
17.3 @@ -1,692 +0,0 @@
17.4 -(*
17.5 -
17.6 -use"../smltest/IsacKnowledge/diff.sml";
17.7 -use"diff.sml";
17.8 -*)
17.9 -
17.10 -"-----------------------------------------------------------------";
17.11 -"table of contents -----------------------------------------------";
17.12 -"-----------------------------------------------------------------";
17.13 -" _________________ problemtype _________________ ";
17.14 -"----------- for correction of diff_const ------------------------";
17.15 -" _________________ for correction of diff_quot _________________ ";
17.16 -" _________________ differentiate by rewrite _________________ ";
17.17 -" ______________ differentiate: me (*+ tacs input*) ______________ ";
17.18 -" ________________ differentiate stdin: student active________________ ";
17.19 -" _________________ differentiate stdin: tutor active_________________ ";
17.20 -"---------------------1.5.02 me from script ---------------------";
17.21 -"----------- primed id -------------------------------------------";
17.22 -"----------- diff_conv, sym_diff_conv ----------------------------";
17.23 -"----------- autoCalculate differentiate_on_R 2/x^2 --------------";
17.24 -"----------- autoCalculate diff after_simplification -------------";
17.25 -"----------- autoCalculate differentiate_equality ----------------";
17.26 -"----------- tests for examples ----------------------------------";
17.27 -"------------inform for x^2+x+1 ----------------------------------";
17.28 -"-----------------------------------------------------------------";
17.29 -"-----------------------------------------------------------------";
17.30 -"-----------------------------------------------------------------";
17.31 -
17.32 -
17.33 -val thy = Diff.thy;
17.34 -
17.35 -" _________________ problemtype _________________ ";
17.36 -" _________________ problemtype _________________ ";
17.37 -" _________________ problemtype _________________ ";
17.38 -val pbt = {Given =["functionTerm f_", "differentiateFor v_"],
17.39 - Where =[],
17.40 - Find =["derivative f_'_"],
17.41 - With =[],
17.42 - Relate=[]}:string ppc;
17.43 -val chkpbt = ((map (the o (parse Diff.thy))) o ppc2list) pbt;
17.44 -
17.45 -val org = ["functionTerm (d_d x (x ^^^ 2 + 3 * x + 4))",
17.46 - "differentiateFor x","derivative f_'_"];
17.47 -val chkorg = map (the o (parse Diff.thy)) org;
17.48 -
17.49 -get_pbt ["derivative_of","function"];
17.50 -get_met ["diff","differentiate_on_R"];
17.51 -
17.52 -(*erls should not be in ruleset'! Here only for tests*)
17.53 -ruleset' :=
17.54 -overwritelthy thy
17.55 - (!ruleset',
17.56 - [("erls",
17.57 - Rls {id = "erls",preconds = [], rew_ord = ("termlessI",termlessI),
17.58 - erls = e_rls, srls = Erls, calc = [], (*asm_thm = [],*)
17.59 - rules = [Thm ("refl",num_str refl),
17.60 - Thm ("le_refl",num_str le_refl),
17.61 - Thm ("radd_left_cancel_le",num_str radd_left_cancel_le),
17.62 - Thm ("not_true",num_str not_true),
17.63 - Thm ("not_false",num_str not_false),
17.64 - Thm ("and_true",and_true),
17.65 - Thm ("and_false",and_false),
17.66 - Thm ("or_true",or_true),
17.67 - Thm ("or_false",or_false),
17.68 - Thm ("and_commute",num_str and_commute),
17.69 - Thm ("or_commute",num_str or_commute),
17.70 -
17.71 - Calc ("Atools.is'_const",eval_const "#is_const_"),
17.72 - Calc ("Atools.occurs'_in", eval_occurs_in ""),
17.73 - Calc ("Tools.matches",eval_matches ""),
17.74 -
17.75 - Calc ("op +",eval_binop "#add_"),
17.76 - Calc ("op *",eval_binop "#mult_"),
17.77 - Calc ("Atools.pow" ,eval_binop "#power_"),
17.78 -
17.79 - Calc ("op <",eval_equ "#less_"),
17.80 - Calc ("op <=",eval_equ "#less_equal_"),
17.81 -
17.82 - Calc ("Atools.ident",eval_ident "#ident_")],
17.83 - scr = Script ((term_of o the o (parse thy))
17.84 - "empty_script")
17.85 - }:rls
17.86 - )]);
17.87 -
17.88 -"----------- for correction of diff_const ------------------------";
17.89 -"----------- for correction of diff_const ------------------------";
17.90 -"----------- for correction of diff_const ------------------------";
17.91 -(*re-evaluate this file, otherwise > *** ME_Isa: 'erls' not known*)
17.92 -val thy' = "Diff.thy";
17.93 -val ct = "Not (x =!= a)";
17.94 -rewrite_set thy' false "erls" ct;
17.95 -val ct = "2 is_const";
17.96 -rewrite_set thy' false "erls" ct;
17.97 -
17.98 -val thm = ("diff_const","");
17.99 -val ct = "d_d x x";
17.100 -val NONE =
17.101 - (rewrite_inst thy' "tless_true" "erls" false [("bdv","x")] thm ct);
17.102 -val ct = "d_d x 2";
17.103 -val SOME (ctt,_) =
17.104 - (rewrite_inst thy' "tless_true" "erls" false [("bdv","x")] thm ct);
17.105 -"----- for 'd_d s a' we got 'a is_const' --> False --------vvv-----";
17.106 -trace_rewrite := true;
17.107 -val ct = "d_d s a";
17.108 - (rewrite_inst thy' "tless_true" "erls" false [("bdv","s")] thm ct);
17.109 -(*got: NONE instead SOME*)
17.110 -eval_true Isac.thy [str2term "a is_const"] (assoc_rls"erls");
17.111 -(*got: false instead true; ~~~~~~~~~~~ replaced by 'is_atom'*)
17.112 -val SOME (ctt,_) =
17.113 - (rewrite_inst thy' "tless_true" "erls" false [("bdv","s")] thm ct);
17.114 -if ctt = "0" then () else raise error "diff.sml: thm 'diff_const' diff.behav.";
17.115 -trace_rewrite := false;
17.116 -"----- for 'd_d s a' we had 'a is_const' --> False --------^^^-----";
17.117 -
17.118 -val thm = ("diff_var","");
17.119 -val ct = "d_d x x";
17.120 -val SOME (ctt,_) =
17.121 - (rewrite_inst thy' "tless_true" "erls" false [("bdv","x")] thm ct);
17.122 -val ct = "d_d x a";
17.123 -val NONE =
17.124 - (rewrite_inst thy' "tless_true" "erls" false [("bdv","x")] thm ct);
17.125 -val ct = "d_d x (x+x)";
17.126 -val NONE =
17.127 -(rewrite_inst thy' "tless_true" "erls" false [("bdv","x")] thm ct);
17.128 -
17.129 -
17.130 -" _________________ for correction of diff_quot _________________ ";
17.131 -" _________________ for correction of diff_quot _________________ ";
17.132 -" _________________ for correction of diff_quot _________________ ";
17.133 -val thy' = "Diff.thy";
17.134 -val ct = "Not (x = 0)";
17.135 -rewrite_set thy' false "erls" ct;
17.136 -
17.137 -val ct = "d_d x ((x+1) / (x - 1))";
17.138 -val thm = ("diff_quot","");
17.139 -val SOME (ctt,_) =
17.140 - (rewrite_inst thy' "tless_true" "erls" true [("bdv","x")] thm ct);
17.141 -
17.142 -
17.143 -
17.144 -
17.145 -
17.146 -
17.147 -
17.148 -" _________________ differentiate by rewrite _________________ ";
17.149 -" _________________ differentiate by rewrite _________________ ";
17.150 -" _________________ differentiate by rewrite _________________ ";
17.151 -val thy' = "Diff.thy";
17.152 -val ct = "d_d x (x ^^^ 2 + 3 * x + 4)";
17.153 -"--- 1 ---";
17.154 -val thm = ("diff_sum","");
17.155 -val (ct,_) = the (rewrite_inst thy' "tless_true" "erls" true
17.156 - [("bdv","x::real")] thm ct);
17.157 -"--- 2 ---";
17.158 -val (ct,_) = the (rewrite_inst thy' "tless_true" "erls" true
17.159 - [("bdv","x::real")] thm ct);
17.160 -"--- 3 ---";
17.161 -val thm = ("diff_prod_const","");
17.162 -val (ct,_) = the (rewrite_inst thy' "tless_true" "erls" true
17.163 - [("bdv","x::real")] thm ct);
17.164 -"--- 4 ---";
17.165 -val thm = ("diff_pow","");
17.166 -val (ct,_) = the (rewrite_inst thy' "tless_true" "erls" true
17.167 - [("bdv","x::real")] thm ct);
17.168 -"--- 5 ---";
17.169 -val thm = ("diff_const","");
17.170 -val (ct,_) = the (rewrite_inst thy' "tless_true" "erls" true
17.171 - [("bdv","x::real")] thm ct);
17.172 -"--- 6 ---";
17.173 -val thm = ("diff_var","");
17.174 -val (ct,_) = the (rewrite_inst thy' "tless_true" "erls" true
17.175 - [("bdv","x::real")] thm ct);
17.176 -if ct = "2 * x ^^^ (2 - 1) + 3 * 1 + 0" then ()
17.177 -else raise error "diff.sml diff.behav. in rewrite 1";
17.178 -"--- 7 ---";
17.179 -val rls = ("Test_simplify");
17.180 -val (ct,_) = the (rewrite_set thy' false rls ct);
17.181 -if ct="3 + 2 * x" then () else raise error "new behaviour in test-example";
17.182 -
17.183 -val ct = "2 * x ^^^ (2 - 1) + 3 * 1 + 0";
17.184 -val (ct,_) = the (rewrite_set thy' true rls ct);
17.185 -
17.186 -
17.187 -(*---
17.188 -val t = str2term "x ^^^ (2 - 1)";
17.189 -val SOME (t',_) = rewrite_set_ thy false Test_simplify t;
17.190 -term2str t';
17.191 -
17.192 -val t = str2term "-1 * 1";
17.193 -val SOME (thmID,thm) = get_calculation_ thy (the(assoc(calclist,"times"))) t;
17.194 -*)
17.195 -
17.196 -
17.197 -" ______________ differentiate: me (*+ tacs input*) ______________ ";
17.198 -" ______________ differentiate: me (*+ tacs input*) ______________ ";
17.199 -" ______________ differentiate: me (*+ tacs input*) ______________ ";
17.200 -val fmz = ["functionTerm (x ^^^ 2 + 3 * x + 4)",
17.201 - "differentiateFor x","derivative f_'_"];
17.202 -val (dI',pI',mI') =
17.203 - ("Diff.thy",["derivative_of","function"],
17.204 - ["diff","diff_simpl"]);
17.205 -val p = e_pos'; val c = [];
17.206 -"--- s1 ---";
17.207 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
17.208 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.209 -"--- s2 ---";
17.210 -(*val nxt = ("Add_Given",
17.211 -Add_Given "functionTerm (d_d x (x ^^^ #2 + #3 * x + #4))");*)
17.212 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.213 -"--- s3 ---";
17.214 -(*val nxt = ("Add_Given",Add_Given "differentiateFor x");*)
17.215 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.216 -"--- s4 ---";
17.217 -(*val nxt = ("Add_Find",Add_Find "derivative f_'_");*)
17.218 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.219 -"--- s5 ---";
17.220 -(*val nxt = ("Specify_Theory",Specify_Theory dI');*)
17.221 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.222 -"--- s6 ---";
17.223 -(*val nxt = ("Specify_Problem",Specify_Problem pI');*)
17.224 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.225 -"--- s7 ---";
17.226 -(*val nxt = ("Specify_Method",Specify_Method mI');*)
17.227 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.228 -"--- s8 ---";
17.229 -(*val nxt = ("Apply_Method",Apply_Method mI');*)
17.230 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.231 -"--- 1 ---";
17.232 -(*val nxt = ("Rewrite_Inst",Rewrite_Inst (["(bdv,x)"],("diff_sum","")));*)
17.233 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.234 -"--- 2 ---";
17.235 -(*val nxt = ("Rewrite_Inst",Rewrite_Inst (["(bdv,x)"],("diff_sum","")));*)
17.236 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.237 -(*val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.238 -val (p,_,f,nxt,_,pt) = me nxt p c pt;*)
17.239 -"--- 3 ---";
17.240 -(*val nxt = ("Rewrite_Inst",Rewrite_Inst (["(bdv,x)"],("diff_prod_const",...;*)
17.241 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.242 -(*val (p,_,f,nxt,_,pt) = me nxt p c pt;*)
17.243 -"--- 4 ---";
17.244 -(*val nxt = ("Rewrite_Inst",Rewrite_Inst (["(bdv,x)"],("diff_pow","")));*)
17.245 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.246 -(*val (p,_,f,nxt,_,pt) = me nxt p c pt;*)
17.247 -"--- 5 ---";
17.248 -(*val nxt = ("Rewrite_Inst",Rewrite_Inst (["(bdv,x)"],("diff_prod_const",...;*)
17.249 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.250 -(*val (p,_,f,nxt,_,pt) = me nxt p c pt;*)
17.251 -"--- 6 ---";
17.252 -(*val nxt = ("Rewrite_Inst",Rewrite_Inst (["(bdv,x)"],("diff_var","")));*)
17.253 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.254 -if f2str f = "2 * x ^^^ (2 - 1) + 3 * 1 + 0" then ()
17.255 -else raise error "diff.sml: diff.behav. in d_d x ^^^ 2 + 3 * x + 4";
17.256 -"--- 7 ---";
17.257 -(*------------------------------11.3.03--------------------
17.258 - trace_rewrite:=true;
17.259 - val (_,_,f,_,_,_) = me nxt p c pt;
17.260 - val Form' (FormKF (_,_,_,_,res)) = f;
17.261 - trace_rewrite:=false;
17.262 -
17.263 - val ct = "2 * x ^^^ (2 - 1) + 3 * 1 + 0";
17.264 - val SOME (ct',_) = rewrite_set "Isac.thy" false "make_polynomial" ct;
17.265 -
17.266 - trace_rewrite:=true;
17.267 - val t = str2term ct;
17.268 - term2str t;
17.269 - val SOME (t',_) = rewrite_set_ Isac.thy false make_polynomial t;
17.270 - term2str t';
17.271 - trace_rewrite:=false;
17.272 -
17.273 - val SOME (t'',_) = rewrite_set_ Isac.thy false make_polynomial t';
17.274 - term2str t'';
17.275 -
17.276 - val thm = num_str realpow_eq_oneI;
17.277 - case string_of_thm thm of
17.278 -
17.279 -
17.280 - val Rewrite_Set' ("Diff.thy",false,"make_polynomial",ff,(ff',[])) = m;
17.281 - term2str ff; term2str ff';
17.282 -
17.283 -
17.284 -
17.285 ---------------------------------11.3.03--------------------*)
17.286 -
17.287 -(*val nxt = ("Rewrite_Set",Rewrite_Set "make_polynomial");*)
17.288 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.289 -"--- 8 ---";
17.290 -(*val nxt =
17.291 -("Check_Postcond",Check_Postcond ("Diff.thy","differentiate_on_R"));*)
17.292 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.293 -"--- 9 ---";
17.294 -(*val nxt = ("End_Proof'",End_Proof');*)
17.295 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
17.296 -if nxt = ("End_Proof'",End_Proof') andalso f2str f = "3 + 2 * x" then ()
17.297 -else raise error "diff.sml: new.behav. in me (*+ tacs input*)";
17.298 -(*if f = EmptyMout then () else raise error "new behaviour in + tacs input";
17.299 -meNEW extracts Form once more*)
17.300 -
17.301 -
17.302 -
17.303 -
17.304 -(*---------------- 1.5.02 -----------------------------------------
17.305 -
17.306 -" _________________ script-eval corrected _________________ ";
17.307 -" _________________ script-eval corrected _________________ ";
17.308 -" _________________ script-eval corrected _________________ ";
17.309 -val scr = Script (((inst_abs (assoc_thy "Test.thy")) o
17.310 - term_of o the o (parse Diff.thy))
17.311 - "Script Differentiate (f_::real) (v_::real) = \
17.312 - \(let f_ = Try (Repeat (Rewrite frac_conv False f_)); \
17.313 - \ f_ = Try (Repeat (Rewrite root_conv False f_)); \
17.314 - \ f_ = Repeat \
17.315 - \ ((Repeat (Rewrite_Inst [(bdv,v_)] diff_sum False f_)) Or \
17.316 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_prod_const False f_)) Or \
17.317 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_prod False f_)) Or \
17.318 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_quot False f_)) Or \
17.319 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_sin False f_)) Or \
17.320 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_sin_chain False f_)) Or \
17.321 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_cos False f_)) Or \
17.322 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_cos_chain False f_)) Or \
17.323 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_pow False f_)) Or \
17.324 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_pow_chain False f_)) Or \
17.325 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_ln False f_)) Or \
17.326 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_ln_chain False f_)) Or \
17.327 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_exp False f_)) Or \
17.328 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_exp_chain False f_)) Or \
17.329 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_const False f_)) Or \
17.330 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_var False f_)) Or \
17.331 - \ (Repeat (Rewrite_Set Test_simplify False f_))); \
17.332 - \ f_ = Try (Repeat (Rewrite sym_frac_conv False f_)) \
17.333 - \ in Try (Repeat (Rewrite sym_root_conv False f_)))");
17.334 -val d = e_rls;
17.335 -val (dI',pI',mI') =
17.336 - ("Diff.thy",e_pblID,
17.337 - ("Diff.thy","differentiate_on_R"));
17.338 -val p = e_pos'; val c = [];
17.339 -val (mI,m) = ("Init_Proof",Init_Proof ([], (dI',pI',mI')));
17.340 -val (p,_,_,_,_,pt) = me (mI,m) p c EmptyPtree;
17.341 -val nxt = ("Specify_Theory",Specify_Theory dI');
17.342 -val (p,_,_,_,_,pt) = me nxt p c pt;
17.343 -val nxt = ("Specify_Method",Specify_Method mI');
17.344 -val (p,_,_,_,_,pt) = me nxt p c pt;
17.345 -val p = ([1],Frm):pos';
17.346 -
17.347 -
17.348 -val parseee = (term_of o the o (parse Diff.thy));
17.349 -val ct = "d_d x (x ^^^ #2 + #3 * x + #4)";
17.350 -val envvv = [(parseee"f_",parseee ct),(parseee"v_",parseee"x")];
17.351 -val ets0=[([],(Tac'(Script.thy,"BS","",""),envvv,envvv,empty,empty,Safe)),
17.352 - ([],(User', [], [], empty, empty,Sundef))]:ets;
17.353 -val l0 = [];
17.354 -" --------------- 1. ---------------------------------------------";
17.355 -val (pt,_) = cappend_atomic pt[1]e_loc ct (Rewrite("test","")) ct Complete;
17.356 -val Appl m'=applicable_in p pt (Rewrite_Inst (["(bdv,x)"],("diff_sum","")));
17.357 -
17.358 -val NextStep(l1,m') = nxt_tac "Diff.thy" (pt,p) scr ets0 l0;
17.359 -(*("diff_sum","")*)
17.360 -val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets1)] =
17.361 - locate_gen "Diff.thy" m' (pt,p) (scr,d) ets0 l0;
17.362 -val ets1 = (drop_last ets0) @ ets1;val pt = update_ets pt [] [(1,ets1)];
17.363 -" --------------- 2. ---------------------------------------------";
17.364 -val Appl m'=applicable_in p pt (Rewrite_Inst (["(bdv,x)"],("diff_sum","")));
17.365 -val NextStep(l2,m') = nxt_tac "Diff.thy" (pt,p) scr ets1 l1;
17.366 -(*("diff_sum","")*)
17.367 -val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets2)] =
17.368 - locate_gen "Diff.thy" m' (pt,p) (scr,d) ets1 l1;
17.369 -val ets2 = (drop_last ets1) @ ets2;val pt = update_ets pt [] [(1,ets2)];
17.370 -" --------------- 3. ---------------------------------------------";
17.371 -val Appl m'=applicable_in p pt (Rewrite_Inst (["(bdv,x)"],("diff_prod_const","")));
17.372 -val NextStep(l3,m') = nxt_tac "Diff.thy" (pt,p) scr ets2 l2;
17.373 -(*("diff_prod_const","")*)
17.374 -val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets3)] =
17.375 - locate_gen "Diff.thy" m' (pt,p) (scr,d) ets2 l2;
17.376 -val ets3 = (drop_last ets2) @ ets3; val pt = update_ets pt [] [(1,ets3)];
17.377 -" --------------- 4. ---------------------------------------------";
17.378 -val Appl m'=applicable_in p pt (Rewrite_Inst (["(bdv,x)"],("diff_pow","")));
17.379 -val NextStep(l4,m') = nxt_tac "Diff.thy" (pt,p) scr ets3 l3;
17.380 -(*("diff_pow","")*)
17.381 -val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets4)] =
17.382 - locate_gen "Diff.thy" m' (pt,p) (scr,d) ets3 l3;
17.383 -val ets4 = (drop_last ets3) @ ets4; val pt = update_ets pt [] [(1,ets4)];
17.384 -" --------------- 5. ---------------------------------------------";
17.385 -val Appl m'=applicable_in p pt (Rewrite_Inst (["(bdv,x)"],("diff_const","")));
17.386 -val NextStep(l5,m') = nxt_tac "Diff.thy" (pt,p) scr ets4 l4;
17.387 -(*("diff_const","")*)
17.388 -val Steps[ (Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets5)] =
17.389 - locate_gen "Diff.thy" m' (pt,p) (scr,d) ets4 l4;
17.390 -val ets5 = (drop_last ets4) @ ets5; val pt = update_ets pt [] [(1,ets5)];
17.391 -" --------------- 6. ---------------------------------------------";
17.392 -val Appl m'=applicable_in p pt (Rewrite_Inst (["(bdv,x)"],("diff_var","")));
17.393 -val NextStep(l6,m') = nxt_tac "Diff.thy" (pt,p) scr ets5 l5;
17.394 -(*("diff_var","")ok; here was("diff_const","")because of wrong rule in *.thy*)
17.395 -val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets6)] =
17.396 - locate_gen "Diff.thy" m' (pt,p) (scr,d) ets5 l5;
17.397 -val ets6 = (drop_last ets5) @ ets6; val pt = update_ets pt [] [(1,ets6)];
17.398 -" --------------- 7. ---------------------------------------------";
17.399 -val Appl m'=applicable_in p pt (Rewrite_Set "Test_simplify");
17.400 -
17.401 -
17.402 - ---------------- 1.5.02 -----------------------------------------*)
17.403 -
17.404 -
17.405 -
17.406 -
17.407 -" ________________ differentiate stdin: student active________________ ";
17.408 -" ________________ differentiate stdin: student active________________ ";
17.409 -" ________________ differentiate stdin: student active________________ ";
17.410 -(*
17.411 -proofs:= []; dials:=([],[],[]);
17.412 -StdinSML 0 0 0 0 New_User;
17.413 -set_dstate 1 test_hide 4 1;(*SelRule,St..PutRuleRes,TskipS..*)
17.414 -StdinSML 1 0 0 0 New_Proof;
17.415 -val fmz = ["functionTerm (d_d x (x ^^^ 2 + 3 * x + 4))",
17.416 - "differentiateFor x","derivative f_'_"];
17.417 -val (dI',pI',mI') =
17.418 - ("Diff.thy",["derivative_of","function"],
17.419 - ["diff","differentiate_on_R"]);
17.420 -*)
17.421 -
17.422 -
17.423 -" _________________ differentiate stdin: tutor active_________________ ";
17.424 -" _________________ differentiate stdin: tutor active_________________ ";
17.425 -" _________________ differentiate stdin: tutor active_________________ ";
17.426 -(*proofs:= []; dials:=([],[],[]);
17.427 -StdinSML 0 0 0 0 New_User;
17.428 -set_dstate 1 test_hide 0 2;(*PutRule,TskipS..PutRuleRes,Tt..*)
17.429 -StdinSML 1 0 0 0 New_Proof;
17.430 -val fmz = ["functionTerm (d_d x (x ^^^ 2 + 3 * x + 4))",
17.431 - "differentiateFor x","derivative f_'_"];
17.432 -val (dI',pI',mI') =
17.433 - ("Diff.thy",["derivative_of","function"],
17.434 - ["diff","differentiate_on_R"]);
17.435 -*)
17.436 -
17.437 -
17.438 -"---------------------1.5.02 me from script ---------------------";
17.439 -"---------------------1.5.02 me from script ---------------------";
17.440 -"---------------------1.5.02 me from script ---------------------";
17.441 -(*exp_Diff_No-1.xml*)
17.442 -val fmz = ["functionTerm (x ^^^ 2 + 3 * x + 4)",
17.443 - "differentiateFor x","derivative f_'_"];
17.444 -val (dI',pI',mI') =
17.445 - ("Diff.thy",["derivative_of","function"],
17.446 - ["diff","diff_simpl"]);
17.447 -(*val p = e_pos'; val c = [];
17.448 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
17.449 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
17.450 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
17.451 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.452 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.453 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.454 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.455 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.456 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.457 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.458 -(*nxt = ("Apply_Method",Apply_Method ("Diff.thy","differentiate_on_R*)
17.459 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.460 -
17.461 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.462 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.463 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.464 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.465 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.466 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.467 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.468 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
17.469 -if nxt = ("End_Proof'",End_Proof') then ()
17.470 -else raise error "new behaviour in tests/differentiate, 1.5.02 me from script";
17.471 -
17.472 -"----------- primed id -------------------------------------------";
17.473 -"----------- primed id -------------------------------------------";
17.474 -"----------- primed id -------------------------------------------";
17.475 -
17.476 -val f_ = str2term "f_::bool";
17.477 -val f = str2term "A = s * (a - s)";
17.478 -val v_ = str2term "v_";
17.479 -val v = str2term "s";
17.480 -val screxp0 = str2term "Take ((primed (lhs f_)) = d_d v_ (rhs f_))";
17.481 -atomty screxp0;
17.482 -
17.483 -val screxp1 = subst_atomic [(f_, f), (v_, v)] screxp0;
17.484 -term2str screxp1;
17.485 -atomty screxp1;
17.486 -
17.487 -val SOME (f'_,_) = rewrite_set_ Isac.thy false srls_diff screxp1;
17.488 -if term2str f'_= "Take (A' = d_d s (s * (a - s)))" then ()
17.489 -else raise error "diff.sml: diff.behav. in 'primed'";
17.490 -atomty f'_;
17.491 -
17.492 -val str = "Script DiffEqScr (f_::bool) (v_::real) = \
17.493 -\ (let f'_ = Take ((primed (lhs f_)) = d_d v_ (rhs f_)) \
17.494 -\ in (((Try (Repeat (Rewrite frac_conv False))) @@ \
17.495 - \ (Try (Repeat (Rewrite root_conv False))) @@ \
17.496 - \ (Try (Repeat (Rewrite realpow_pow False))) @@ \
17.497 - \ (Repeat \
17.498 - \ ((Repeat (Rewrite_Inst [(bdv,v_)] diff_sum False)) Or \
17.499 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_prod_const False)) Or \
17.500 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_prod False)) Or \
17.501 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_quot True )) Or \
17.502 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_sin False)) Or \
17.503 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_sin_chain False)) Or \
17.504 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_cos False)) Or \
17.505 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_cos_chain False)) Or \
17.506 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_pow False)) Or \
17.507 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_pow_chain False)) Or \
17.508 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_ln False)) Or \
17.509 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_ln_chain False)) Or \
17.510 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_exp False)) Or \
17.511 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_exp_chain False)) Or \
17.512 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_sqrt False)) Or \
17.513 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_sqrt_chain False)) Or \
17.514 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_const False)) Or \
17.515 - \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_var False)) Or \
17.516 - \ (Repeat (Rewrite_Set make_polynomial False)))) @@ \
17.517 - \ (Try (Repeat (Rewrite sym_frac_conv False))) @@ \
17.518 - \ (Try (Repeat (Rewrite sym_root_conv False))))) f'_)"
17.519 -;
17.520 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
17.521 -
17.522 -
17.523 -"----------- diff_conv, sym_diff_conv ----------------------------";
17.524 -"----------- diff_conv, sym_diff_conv ----------------------------";
17.525 -"----------- diff_conv, sym_diff_conv ----------------------------";
17.526 -val subs = [(str2term "bdv", str2term "x")];
17.527 -val rls = diff_conv;
17.528 -
17.529 -val t = str2term "2/x^^^2";
17.530 -val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; term2str t;
17.531 -if term2str t = "2 * x ^^^ -2" then () else raise error "diff.sml 1/x";
17.532 -
17.533 -val t = str2term "sqrt (x^^^3)";
17.534 -val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; term2str t;
17.535 -if term2str t = "x ^^^ (3 / 2)" then () else raise error "diff.sml x^1/2";
17.536 -
17.537 -val t = str2term "2 / sqrt x^^^3";
17.538 -val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; term2str t;
17.539 -if term2str t = "2 * x ^^^ (-3 / 2)" then () else raise error"diff.sml x^-1/2";
17.540 -(* trace_rewrite := true;
17.541 - trace_rewrite := false;
17.542 - *)
17.543 -val rls = diff_sym_conv;
17.544 -
17.545 -val t = str2term "2 * x ^^^ -2";
17.546 -val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; term2str t;
17.547 -if term2str t = "2 / x ^^^ 2" then () else raise error "diff.sml sym 1/x";
17.548 -
17.549 -
17.550 -val t = str2term "x ^^^ (3 / 2)";
17.551 -val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; term2str t;
17.552 -if term2str t = "sqrt (x ^^^ 3)" then () else raise error"diff.sml sym x^1/x";
17.553 -
17.554 -val t = str2term "2 * x ^^^ (-3 / 2)";
17.555 -val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; term2str t;
17.556 -if term2str t ="2 / sqrt (x ^^^ 3)"then()else raise error"diff.sml sym x^-1/x";
17.557 -
17.558 -
17.559 -(* trace_rewrite:=true;
17.560 - *)
17.561 -(* trace_rewrite:=false;
17.562 - *)
17.563 -(*@@@@*)
17.564 -
17.565 -
17.566 -"----------- autoCalculate differentiate_on_R 2/x^2 --------------";
17.567 -"----------- autoCalculate differentiate_on_R 2/x^2 --------------";
17.568 -"----------- autoCalculate differentiate_on_R 2/x^2 --------------";
17.569 -states:=[];
17.570 -CalcTree
17.571 -[(["functionTerm (x^2 + x+ 1/x + 2/x^2)",
17.572 - (*"functionTerm ((x^3)^5)",*)
17.573 - "differentiateFor x", "derivative f_'_"],
17.574 - ("Isac.thy", ["derivative_of","function"],
17.575 - ["diff","differentiate_on_R"]))];
17.576 -Iterator 1;
17.577 -moveActiveRoot 1;
17.578 -autoCalculate 1 CompleteCalc;
17.579 -val ((pt,p),_) = get_calc 1; show_pt pt;
17.580 -if p = ([], Res) andalso term2str (get_obj g_res pt (fst p)) =
17.581 - "1 + 2 * x + -1 / x ^^^ 2 + -4 / x ^^^ 3" then ()
17.582 -else raise error "diff.sml: differentiate_on_R 2/x^2 changed";
17.583 -
17.584 -"-----------------------------------------------------------------";
17.585 -states:=[];
17.586 -CalcTree
17.587 -[(["functionTerm (x^3 * x^5)",
17.588 - "differentiateFor x", "derivative f_'_"],
17.589 - ("Isac.thy", ["derivative_of","function"],
17.590 - ["diff","differentiate_on_R"]))];
17.591 -Iterator 1;
17.592 -moveActiveRoot 1;
17.593 -(* trace_rewrite := true;
17.594 - trace_script := true;
17.595 - *)
17.596 -autoCalculate 1 CompleteCalc;
17.597 -(* trace_rewrite := false;
17.598 - trace_script := false;
17.599 - *)
17.600 -val ((pt,p),_) = get_calc 1; show_pt pt;
17.601 -
17.602 -if p = ([], Res) andalso term2str (get_obj g_res pt (fst p)) =
17.603 - "8 * x ^^^ 7" then ()
17.604 -else raise error "diff.sml: differentiate_on_R (x^3 * x^5) changed";
17.605 -
17.606 -
17.607 -"----------- autoCalculate diff after_simplification -------------";
17.608 -"----------- autoCalculate diff after_simplification -------------";
17.609 -"----------- autoCalculate diff after_simplification -------------";
17.610 -states:=[];
17.611 -CalcTree
17.612 -[(["functionTerm (x^3 * x^5)",
17.613 - "differentiateFor x", "derivative f_'_"],
17.614 - ("Isac.thy", ["derivative_of","function"],
17.615 - ["diff","after_simplification"]))];
17.616 -Iterator 1;
17.617 -moveActiveRoot 1;
17.618 -(* trace_rewrite := true;
17.619 - trace_script := true;
17.620 - *)
17.621 -autoCalculate 1 CompleteCalc;
17.622 -(* trace_rewrite := false;
17.623 - trace_script := false;
17.624 - *)
17.625 -val ((pt,p),_) = get_calc 1; show_pt pt;
17.626 -if p = ([], Res) andalso term2str (get_obj g_res pt (fst p)) = "8 * x ^^^ 7"
17.627 -then () else raise error "biegelinie.sml: 1st biegelin.7.27 changed";
17.628 -
17.629 -"-----------------------------------------------------------------";
17.630 -states:=[];
17.631 -CalcTree
17.632 -[(["functionTerm ((x^3)^5)",
17.633 - "differentiateFor x", "derivative f_'_"],
17.634 - ("Isac.thy", ["derivative_of","function"],
17.635 - ["diff","after_simplification"]))];
17.636 -Iterator 1;
17.637 -moveActiveRoot 1;
17.638 -autoCalculate 1 CompleteCalc;
17.639 -val ((pt,p),_) = get_calc 1; show_pt pt;
17.640 -if p = ([], Res) andalso term2str (get_obj g_res pt (fst p)) = "15 * x ^^^ 14"
17.641 -then () else raise error "biegelinie.sml: 1st biegelin.7.27 changed";
17.642 -
17.643 -
17.644 -
17.645 -"----------- autoCalculate differentiate_equality ----------------";
17.646 -"----------- autoCalculate differentiate_equality ----------------";
17.647 -"----------- autoCalculate differentiate_equality ----------------";
17.648 -states:=[];
17.649 -CalcTree
17.650 -[(["functionEq (A = s * (a - s))", "differentiateFor s", "derivativeEq f_'_"],
17.651 - ("Isac.thy", ["named","derivative_of","function"],
17.652 - ["diff","differentiate_equality"]))];
17.653 -Iterator 1;
17.654 -moveActiveRoot 1;
17.655 -autoCalculate 1 CompleteCalc;
17.656 -val ((pt,p),_) = get_calc 1; show_pt pt;
17.657 -
17.658 -
17.659 -"----------- tests for examples ----------------------------------";
17.660 -"----------- tests for examples ----------------------------------";
17.661 -"----------- tests for examples ----------------------------------";
17.662 -"----- parse errors";
17.663 -(*str2term "F = sqrt( y^2 - O) * (z + O^2)";
17.664 -str2term "O";*)
17.665 -str2term "OO";
17.666 -
17.667 -"----- thm 'diff_prod_const'";
17.668 -val subs = [(str2term "bdv", str2term "l")];
17.669 -val f = str2term "G' = d_d l (l * sqrt (7 * s ^ 2 - l ^ 2))";
17.670 -(*
17.671 -trace_rewrite := true;
17.672 -rewrite_inst_ Isac.thy tless_true erls_diff true subs diff_prod_const f;
17.673 -trace_rewrite := false;
17.674 -*)
17.675 -
17.676 -"------------inform for x^2+x+1 ----------------------------------";
17.677 -"------------inform for x^2+x+1 ----------------------------------";
17.678 -"------------inform for x^2+x+1 ----------------------------------";
17.679 -states:=[];
17.680 -CalcTree
17.681 -[(["functionTerm (x^2 + x + 1)",
17.682 - "differentiateFor x", "derivative f_'_"],
17.683 - ("Isac.thy", ["derivative_of","function"],
17.684 - ["diff","differentiate_on_R"]))];
17.685 -Iterator 1;
17.686 -moveActiveRoot 1;
17.687 -autoCalculate 1 CompleteCalcHead;
17.688 -autoCalculate 1 (Step 1);
17.689 -autoCalculate 1 (Step 1);
17.690 -autoCalculate 1 (Step 1);
17.691 -val ((pt,p),_) = get_calc 1; show_pt pt;
17.692 -appendFormula 1 "2*x + d_d x x + d_d x 1";
17.693 -val ((pt,p),_) = get_calc 1; show_pt pt;
17.694 -if existpt' ([3], Res) pt then ()
17.695 -else raise error "diff.sml: inform d_d x (x^2 + x + 1) doesnt work";
18.1 --- a/test/Tools/isac/IsacKnowledge/diffapp.sml Mon Aug 30 14:29:49 2010 +0200
18.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
18.3 @@ -1,752 +0,0 @@
18.4 -(* tests for IsacKnowledge/DiffApp
18.5 - author Walther Neuper 000301
18.6 - (c) due to copyright terms
18.7 -
18.8 - use"../smltest/IsacKnowledge/diffapp.sml";
18.9 - use"diffapp.sml";
18.10 -*)
18.11 -
18.12 -"Contents----------------------------------------------";
18.13 -" Specify_Problem (match_itms_oris) ";
18.14 -" test specify, fmz <> [] ";
18.15 -" test specify, fmz = [] ";
18.16 -" problemtypes + formalizations ";
18.17 -"-------------------- ptree of {(a,b). is-max ... ----------------";
18.18 -"--------- me .. scripts for maximum-example ---------------------";
18.19 -"--------- autoCalc .. scripts for maximum-example ---------------";
18.20 -
18.21 -"--------------------- 30.4.03: maximum .. rewrite_set_ list_rls ---------";
18.22 -"---------------------- 1.5.03: Make_fun_by_explicit ---------------------";
18.23 -"---------------------- 2.5.03: Make_fun_by_new_variable -----------------";
18.24 -
18.25 -
18.26 -
18.27 -
18.28 -
18.29 -" #################################################### ";
18.30 -" problemtypes + formalizations ";
18.31 -" #################################################### ";
18.32 -" -------------- [maximum_of,function] --------------- ";
18.33 -val pbt =
18.34 - ["fixedValues fix_","maximum m_","valuesFor vs_","relations rs_"];
18.35 -map (the o (parseold thy)) pbt;
18.36 -val fmz =
18.37 - ["fixedValues [r=Arbfix]","maximum A",
18.38 - "valuesFor [a,b]",
18.39 - "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
18.40 - "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
18.41 - "relations [A=a*b, a/2=r*sin alpha, b/2=r*cos alpha]",
18.42 -
18.43 - "boundVariable a","boundVariable b","boundVariable alpha",
18.44 - "interval {x::real. 0 <= x & x <= 2*r}",
18.45 - "interval {x::real. 0 <= x & x <= 2*r}",
18.46 - "interval {x::real. 0 <= x & x <= pi}",
18.47 - "errorBound (eps=(0::real))"];
18.48 -map (the o (parseold thy)) fmz;
18.49 -" -------------- [make,function] -------------- ";
18.50 -val pbt =
18.51 - ["functionOf f_","boundVariable v_","equalities eqs_",
18.52 - "functionTerm f_0_"];
18.53 -map (the o (parseold thy)) pbt;
18.54 -val fmz12 =
18.55 - ["functionOf A","boundVariable a","boundVariable b",
18.56 - "equalities [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
18.57 - (*28.11.00: "functionTerm (A_0=Undef)"*)"functionTerm (Undef)"];
18.58 -map (the o (parseold thy)) fmz12;
18.59 -val fmz3 =
18.60 - ["functionOf A","boundVariable a","boundVariable b",
18.61 - "equalities [A=a*b, a/2=r*sin alpha, b/2=r*cos alpha]",
18.62 - (*28.11.00: "functionTerm (A_0=Undef)"*)"functionTerm (Undef)"];
18.63 -map (the o (parseold thy)) fmz3;
18.64 -" --------- [univar,equation] --------- ";
18.65 -val pbt =
18.66 - ["equality e_","solveFor v_","solutions v_i_"];
18.67 -map (the o (parseold thy)) pbt;
18.68 -val fmz =
18.69 - ["equality ((a/2)^^^2 + (b/2)^^^2 = r^^^2)",
18.70 - "solveFor b","solutions b_i"];
18.71 -map (the o (parseold thy)) fmz;
18.72 -" ---- [on_interval,maximum_of,function] ---- ";
18.73 -val pbt =
18.74 - ["functionTerm t_","boundVariable v_","interval itv_",
18.75 - "errorBound err_","maxArgument v_0_"];
18.76 -map (the o (parseold thy)) pbt;
18.77 -val fmz12 =
18.78 - [(*28.11.00: "functionTerm (A_0 = a*sqrt(#4*r^^^#2 - a^^^#2))",*)
18.79 - "functionTerm (a*sqrt(4*r^^^2 - a^^^2))",
18.80 - (*28.11.00: "functionTerm (A_0 = b*sqrt(#4*r^^^#2 - b^^^#2))",*)
18.81 - "functionTerm (b*sqrt(4*r^^^2 - b^^^2))",
18.82 - "boundVariable a","boundVariable b",
18.83 - "interval {x::real. 0 <= x & x <= 2*r}",
18.84 - "errorBound (eps=0)","maxArgument (a_0=Undef)"];
18.85 -map (the o (parseold thy)) fmz12;
18.86 -val fmz3 =
18.87 - [(*28.11.00: "functionTerm (A_0 = (#2*r*sin alpha)*(#2*r*cos alpha))",*)
18.88 - "functionTerm ((2*r*sin alpha)*(2*r*cos alpha))",
18.89 - "boundVariable alpha",
18.90 - "interval {x::real. 0 <= x & x <= pi}",
18.91 - "errorBound (eps=0)","maxArgument (a_0=Undef)"];
18.92 -map (the o (parseold thy)) fmz3;
18.93 -" --------- [derivative_of,function] --------- ";
18.94 -val pbt =
18.95 - ["functionTerm f_","boundVariable v_","derivative f_'_"];
18.96 -map (the o (parseold thy)) pbt;
18.97 -val fmz =
18.98 - [(*28.11.00: "functionTerm (A_0=a*#2*sqrt r^^^#2 - (a//#2)^^^#2)",*)
18.99 - "functionTerm (a*2*sqrt r^^^2 - (a/2)^^^2)",
18.100 - "boundVariable a",
18.101 - (*28.11.00: "derivative (A_0'=Undef)"*)"derivative (Undef)"];
18.102 -map (the o (parseold thy)) fmz;
18.103 -" --------- [find_values,tool] --------- ";
18.104 -val pbt =
18.105 - ["maxArgument ma_","functionTerm f_","boundVariable v_",
18.106 - "valuesFor vls_","additionalRels rs_"];
18.107 -map (the o (parseold thy)) pbt;
18.108 -val fmz1 =
18.109 - ["maxArgument (a_0=(srqt 2)*r)",
18.110 - (*28.11.00: "functionTerm (A_0=a*#2*sqrt r^^^#2 - (a//#2)^^^#2)",*)
18.111 - "functionTerm (a*2*sqrt r^^^2 - (a/2)^^^2)",
18.112 - "boundVariable a",
18.113 - "valuesFor [a,b]","maximum A",
18.114 - "additionalRels [(a/2)^^^2 + (b/2)^^^2 = r^^^2]"];
18.115 -map (the o (parseold thy)) fmz1;
18.116 -
18.117 -
18.118 -
18.119 -"-------------------- ptree of {(a,b). is-max ... --------------------------";
18.120 -"-------------------- ptree of {(a,b). is-max ... --------------------------";
18.121 -"-------------------- ptree of {(a,b). is-max ... --------------------------";
18.122 -
18.123 -(* Teil von max-on-surface.sml,
18.124 - der nach Init_Proof -> prep_ori wieder l"auft
18.125 - (f"ur tests mit neuer pos')
18.126 - use"test-max-surf1.sml";
18.127 -
18.128 - Compiler.Control.Print.printDepth:=7; (*4 is default*)
18.129 - Compiler.Control.Print.printDepth:=4; (*4 is default*)
18.130 - *)
18.131 -
18.132 -(* --vvv-- ausgeliehen von test-root-equ/sml *)
18.133 -val loc = e_istate;
18.134 -val (dI',pI',mI') =
18.135 - ("Script.thy",["sqroot-test","univariate","equation"],
18.136 - ["Script","squ-equ-test2"]);
18.137 -val fmz = ["equality (sqrt(9+4*x)=sqrt x + sqrt(5+x))",
18.138 - "solveFor x","errorBound (eps=0)",
18.139 - "solutions L"];
18.140 -(*
18.141 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
18.142 -val ((p,p_),_,_,_,_,(_,pt,_)) = do_ (mI,m) e_pos'[1](e_scr,EmptyPtree,[]);
18.143 - --^^^-- ausgeliehen von test-root-equ/sml *)
18.144 -(*-------------- 9.6.03 --- cappend_ ... term -------irreparabler test
18.145 -val (pt,_) =
18.146 - cappend_problem EmptyPtree [] loc ([],(dI',pI',mI'));
18.147 -val pos = (lev_on o lev_dn) [];
18.148 -(* val pos = ([1]) *)
18.149 -val (pt,_) = cappend_parent pt pos loc "{(a,b). is-max ..."
18.150 - Empty_Tac TransitiveB;
18.151 -val pos = (lev_on o lev_dn) pos;
18.152 -(*val pos = ([1,1])*)
18.153 -val (pt,_) = cappend_atomic pt pos loc "{(a,b). is-max ..."
18.154 - Empty_Tac ("[1,1]:{(a,b). is-extremum ...",[]) Complete;
18.155 -val pos = lev_on pos;
18.156 -(*val pos = ([1,2])*)
18.157 -val (pt,_) = cappend_atomic pt pos loc "{(a,b). is-extremum ..."
18.158 - Empty_Tac ("[1,2]:{(a,b). f_x(a,b) ...",[]) Complete;
18.159 -val pos = lev_up pos;
18.160 -(*val pos = ([1])*)
18.161 -val (pt,_) = append_result pt pos e_istate ("[1#]:{(a,b). f_x(a,b) ...",[])
18.162 - Complete;
18.163 -
18.164 -val pos = lev_on pos;
18.165 -(*val pos = ([2]) *)
18.166 -val (pt,_) = cappend_atomic pt pos loc "{(a,b). f_x(a,b) ..."
18.167 - Empty_Tac ("[2]:{(a,b). f_x & f_xx &...",[]) Complete;
18.168 -val pos = lev_on pos;
18.169 -(*al pos = [3] : pos*)
18.170 -val (pt,_) = cappend_parent pt pos loc "{(a,b). f_x & f_xx &..."
18.171 - Empty_Tac TransitiveB;
18.172 -val pos = (lev_on o lev_dn) pos;
18.173 -(*pos = ([3,1]) *)
18.174 -val (pt,_) = cappend_atomic pt pos loc "{(a,b). f_x & f_xx & ..."
18.175 - Empty_Tac ("[3,1]:{(a,b). f_x & f_xx } cup ...",[]) Complete;
18.176 -val pos = lev_on pos;
18.177 -(*pos = ([3,2]) *)
18.178 -val (pt,_) = cappend_atomic pt pos loc "{(a,b). f_x & f_xx } cup.."
18.179 - Empty_Tac ("[3,2]:{(a,b). f_x ..} cup ...",[]) Complete;
18.180 -
18.181 -val pos = lev_up pos;
18.182 -(*pos = ([3]) *)
18.183 -val (pt,_) = append_result pt pos e_istate ("[3#]:{(a,b). f_x ..} cup..",[])
18.184 - Complete;
18.185 -val pos = lev_on pos;
18.186 -(*val pos = [4] : pos *)
18.187 -val (pt,_) = cappend_parent pt pos loc "{(a,b). f_x ..} cup ..."
18.188 - Empty_Tac IntersectB;
18.189 -val pos = (lev_on o lev_dn) pos;
18.190 -(*val pos = ([4,1]) *)
18.191 -val (pt,_) = cappend_parent pt pos loc "set_1 = ..."
18.192 - Empty_Tac SequenceB;
18.193 -
18.194 -
18.195 -val pos = (lev_on o lev_dn) pos;
18.196 -(*val pos = ([4,1,1]) *)
18.197 -val (pt,_) = cappend_parent(*pbl*) pt pos loc"f_x = d/dx x^3 ..."
18.198 - Empty_Tac TransitiveB;
18.199 -val pos = (lev_on o lev_dn) pos;
18.200 -(*val pos = ([4,1,1,1]) *)
18.201 -val (pt,_) = cappend_parent pt pos loc "d/dx x^3 ..."
18.202 - Empty_Tac TransitiveB;
18.203 -val pos = (lev_on o lev_dn) pos;
18.204 -(*val pos = ([4,1,1,1,1]) *)
18.205 -val (pt,_) = cappend_atomic pt pos loc "d/dx x^3 ..."
18.206 - Empty_Tac ("[4,1,1,1,1]:3x^2 + d/dx ...",[]) Complete;
18.207 -val pos = lev_on pos;
18.208 -(*val pos = ([4,1,1,1,2]) *)
18.209 -val (pt,_) = cappend_atomic pt pos loc "3x^2 + d/dx ..."
18.210 - Empty_Tac ("[4,1,1,1,2]:3x^2 + 0 + d/dx ...",[]) Complete;
18.211 -val pos = lev_on pos;
18.212 -(*pos = ([4,1,1,1,3]) *)
18.213 -val (pt,_) = cappend_atomic pt pos loc "3x^2 + 0 + d/dx ..."
18.214 - Empty_Tac ("[4,1,1,1,3]:3x^2 + 0 -3 ...",[]) Complete;
18.215 -"--- 1 ---";
18.216 -val pos = lev_up pos;
18.217 -(*pos = ([4,1,1,1]) *)
18.218 -val (pt,_) = append_result pt pos e_istate ("[4,1,1,1#]:3x^2 -3.",[])Complete;
18.219 -"--- 2 ---";
18.220 -val pos = lev_up pos;
18.221 -(*val pos = ([4,1,1]) *)
18.222 -val (pt,_) = append_result pt pos e_istate ("[4,1,1#]:found 3x^2 -3 ...",[])
18.223 - Complete;
18.224 -"--- 3 ---";
18.225 -val pos = lev_on pos;
18.226 -(*val pos = ([4,1,2]+) *)
18.227 -val (pt,_) = cappend_parent(*pbl*) pt pos loc "f_y = d/dy x^3 ..."
18.228 - Empty_Tac TransitiveB;
18.229 -"--- 4 ---";
18.230 -writeln (pr_ptree pr_short pt);
18.231 -
18.232 -(*
18.233 -. ----- pblobj -----
18.234 -1. {(a,b). is-max ...
18.235 -1.1. {(a,b). is-max ...
18.236 -1.2. {(a,b). is-extremum ...
18.237 -2. {(a,b). f_x(a,b) ...
18.238 -3. {(a,b). f_x & f_xx &...
18.239 -3.1. {(a,b). f_x & f_xx & ...
18.240 -3.2. {(a,b). f_x & f_xx } cup..
18.241 -4. {(a,b). f_x ..} cup ...
18.242 -4.1. set_1 = ...
18.243 -4.1.1. f_x = d/dx x^3 ...
18.244 -4.1.1.1. d/dx x^3 ...
18.245 -4.1.1.1.1. d/dx x^3 ...
18.246 -4.1.1.1.2. 3x^2 + d/dx ...
18.247 -4.1.1.1.3. 3x^2 + 0 + d/dx ...
18.248 -4.1.2. f_y = d/dy x^3 ...
18.249 -
18.250 - use"test-max-surf1.sml";
18.251 - *)
18.252 --------------- 9.6.03 --- cappend_ ... term -------irreparabler test---*)
18.253 -
18.254 -
18.255 -"--------- me .. scripts for maximum-example ---------------------";
18.256 -"--------- me .. scripts for maximum-example ---------------------";
18.257 -"--------- me .. scripts for maximum-example ---------------------";
18.258 -
18.259 -val fmz =
18.260 - ["fixedValues [r=Arbfix]","maximum A",
18.261 - "valuesFor [a,b]",
18.262 - "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
18.263 - "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
18.264 - "relations [A=a*b, a/2=r*sin alpha, b/2=r*cos alpha]",
18.265 -
18.266 - "boundVariable a","boundVariable b","boundVariable alpha",
18.267 - "interval {x::real. 0 <= x & x <= 2*r}",
18.268 - "interval {x::real. 0 <= x & x <= 2*r}",
18.269 - "interval {x::real. 0 <= x & x <= pi}",
18.270 - "errorBound (eps=(0::real))"];
18.271 -val (dI',pI',mI') =
18.272 - ("DiffApp.thy",["maximum_of","function"],
18.273 - ["DiffApp","max_by_calculus"]);
18.274 -
18.275 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
18.276 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.277 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.278 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.279 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.280 -val (p,_,f,nxt,_,pt) = (me nxt p c pt) handle e => print_exn e;
18.281 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.282 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.283 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.284 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.285 -case nxt of (_, Specify_Method ["DiffApp","max_by_calculus"]) => ()
18.286 - | _ => raise error "diffapp.sml: max-exp me, nxt = Specify_Method";
18.287 -
18.288 -val oris = fst3 (get_obj g_origin pt (fst p)); writeln(oris2str oris);
18.289 -val pits = get_obj g_pbl pt (fst p); writeln(itms2str_ ctxt pits);
18.290 -
18.291 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.292 -val mits = get_obj g_met pt (fst p); writeln(itms2str_ ctxt mits);
18.293 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.294 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.295 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.296 -case nxt of (_,Apply_Method ["DiffApp","max_by_calculus"] ) => ()
18.297 - | _ => raise error "diffapp.sml: max-exp me, nxt = Apply_Method";
18.298 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.299 -
18.300 -(*since 0508 Apply_Method does the 1st step, if NONE init_form -------------
18.301 -(*val nxt = ("Subproblem",Subproblem ("DiffApp.thy",["make","function"]))*)
18.302 -val (p,_,f,nxt,_,pt) = (me nxt p c pt) handle e => print_exn_G e;
18.303 -(*val nxt = ("Refine_Tacitly",Refine_Tacitly ["make","function"])*)
18.304 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.305 -(*val nxt = ("Model_Problem",Model_Problem ["by_explicit","make","function"])*)
18.306 -----------------------------------------------------------------------------*)
18.307 -case nxt of (_, Model_Problem(*["by_explicit", "make", "function"]*)) => ()
18.308 - | _ => raise error "diffapp.sml: max-exp me, nxt = Model_Problem";
18.309 -
18.310 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.311 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.312 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.313 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.314 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.315 -
18.316 -val oris = fst3 (get_obj g_origin pt (fst p));writeln(oris2str oris);
18.317 -val pits = get_obj g_pbl pt (fst p);writeln(itms2str_ ctxt pits);
18.318 -
18.319 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.320 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.321 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.322 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.323 -case nxt of (_, Apply_Method ["DiffApp", "make_fun_by_explicit"]) => ()
18.324 - | _ => raise error "diffapp.sml: max-exp Apply_Method ([1], Met) ";
18.325 -
18.326 -(*----since WN050901 (ie. corr. mathengine#nxt_specify_ ..nxt_spec Pbl->p_
18.327 -we get at ...
18.328 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.329 -...
18.330 -### assod: NotAss m= Subproblem' ,
18.331 - stac= Substitute
18.332 - [(b, (rhs o hd)
18.333 - (Subproblem (thy, [normalize, polynomial, univariate, equation])))]
18.334 - (hd (filterVar A [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]))
18.335 -*** stac2tac_ TODO: no match for Substitute
18.336 -*** [(b, (rhs o hd)
18.337 -*** (Subproblem (thy, [normalize, polynomial, univariate, equation])))]
18.338 -*** (hd (filterVar A [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]))
18.339 -Exception- ERROR raised
18.340 -
18.341 -############################################################################
18.342 -# presumerably didnt work before either, but not detected due to Emtpy_Tac #
18.343 -############################################################################
18.344 -
18.345 -(*val nxt = Subproblem ("DiffApp.thy",["univariate","equation"])) *)
18.346 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.347 -(*val nxt = Refine_Tacitly ["univariate","equation"])*)
18.348 -
18.349 -val oris = fst3 (get_obj g_origin pt (fst p));writeln(oris2str oris);
18.350 -val pits = get_obj g_pbl pt (fst p);writeln(itms2str_ ctxt pits);
18.351 -
18.352 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.353 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.354 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.355 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.356 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.357 -(*val nxt = ("Apply_Method",Apply_Method ["PolyEq","normalize_poly"])*)
18.358 -
18.359 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.360 -(*val f = Form' (FormKF (~1,EdUndef,3,Nundef,"A = a * b"))*)
18.361 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.362 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.363 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.364 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.365 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.366 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.367 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.368 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.369 -(*val f = Form' (FormKF (~1,EdUndef,4,Nundef,"[b = A / a]"))*)
18.370 -
18.371 -------------------------------------------------------------------------*)
18.372 -
18.373 -(*val f =
18.374 -Error' (Error_ "Refine_Tacitly [\"univariate\",\"equation\"] not applicable")*)
18.375 -
18.376 -
18.377 -(*----postponed.15.5.03 run scripts for maximum-example: univariate equation
18.378 -
18.379 -val (p,_,f,nxt,_,pt) = (me nxt p c pt) handle e => print_exn e;
18.380 -
18.381 -val oris = fst3 (get_obj g_origin pt (fst p));writeln(oris2str oris);
18.382 -
18.383 -val pits = get_obj g_pbl pt (fst p);writeln(itms2str_ ctxt pits);
18.384 -val pits = get_obj g_pbl pt [];writeln(itms2str_ ctxt pits);
18.385 -
18.386 -val mits = get_obj g_met pt (fst p);writeln(itms2str_ ctxt mits);
18.387 -val mits = get_obj g_met pt [];writeln(itms2str_ ctxt mits);
18.388 -
18.389 -itms2args thy ["DiffApp","max_by_calculus"] mits;
18.390 -
18.391 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
18.392 -
18.393 ----*)
18.394 -
18.395 -"--------- autoCalc .. scripts for maximum-example ---------------";
18.396 -"--------- autoCalc .. scripts for maximum-example ---------------";
18.397 -"--------- autoCalc .. scripts for maximum-example ---------------";
18.398 -(*++++++++ see systest/inform.sml 'complete_metitms' ++++++++*)
18.399 - states:=[];
18.400 -val fmz =
18.401 - ["fixedValues [r=Arbfix]","maximum A",
18.402 - "valuesFor [a,b]",
18.403 - "relations [A=a*b, (a/2)^2 + (b/2)^2 = r^2]",
18.404 - "relations [A=a*b, (a/2)^2 + (b/2)^2 = r^2]",
18.405 - "relations [A=a*b, a/2=r*sin alpha, b/2=r*cos alpha]",
18.406 -
18.407 - "boundVariable a","boundVariable b","boundVariable alpha",
18.408 - "interval {x::real. 0 <= x & x <= 2*r}",
18.409 - "interval {x::real. 0 <= x & x <= 2*r}",
18.410 - "interval {x::real. 0 <= x & x <= pi}",
18.411 - "errorBound (eps=(0::real))"];
18.412 -val (dI',pI',mI') =
18.413 - ("DiffApp.thy",["maximum_of","function"],
18.414 - ["DiffApp","max_by_calculus"]);
18.415 -
18.416 - CalcTree [(fmz, (dI',pI',mI'))];
18.417 - Iterator 1; moveActiveRoot 1;
18.418 - autoCalculate 1 CompleteCalcHead;
18.419 - refFormula 1 (get_pos 1 1);
18.420 -
18.421 - fetchProposedTactic 1;
18.422 - autoCalculate 1 (Step 1);
18.423 -
18.424 - fetchProposedTactic 1;
18.425 - autoCalculate 1 (Step 1);
18.426 - (*Subproblem on_interval maximum_of function*)
18.427 - autoCalculate 1 CompleteCalcHead;
18.428 -
18.429 - fetchProposedTactic 1;
18.430 - val ((pt,p),_) = get_calc 1;
18.431 - val mits = get_obj g_met pt (fst p);
18.432 - writeln (itms2str_ ctxt mits);
18.433 -(*
18.434 - if itms2str_ ctxt mits = "[\n(1 ,[1] ,true ,#Given ,Cor functionEq (hd rs_) ,(t_, [hd rs_])),\n(2 ,[1] ,true ,#Given ,Cor boundVariable v_ ,(v_, [v_])),\n(3 ,[1] ,true ,#Given ,Cor interval itv_ ,(itv_, [itv_])),\n(4 ,[1] ,true ,#Find ,Cor maxArgument v__0 ,(v_0_, [v__0]))]" then ()
18.435 - else raise error "diffapp.sml: diff.behav. in autoCalc .. scripts for max 1";
18.436 -*)
18.437 - (*FIXME: the environments contain identifers, and NOT values ?!?!?*)
18.438 -(* WN051209 while extending 'fun step' for initac, this became better ...
18.439 - if itms2str_ ctxt mits = "[\n(1 ,[1,2,3] ,true ,#Given ,Cor fixedValues [r = Arbfix] ,(fix_, [[r = Arbfix]])),\n(2 ,[1,2,3] ,true ,#Find ,Cor maximum A ,(m_, [A])),\n(3 ,[1,2,3] ,true ,#Find ,Cor valuesFor [a, b] ,(vs_, [[a],[b]])),\n(4 ,[1,2] ,true ,#Relate ,Cor relations [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2] ,(rs_, [[A = a * b],[(a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]])),\n(6 ,[1] ,true ,#undef ,Cor boundVariable a ,(v_, [a])),\n(9 ,[1,2] ,true ,#undef ,Cor interval {x. 0 <= x & x <= 2 * r} ,(itv_, [{x. 0 <= x & x <= 2 * r}])),\n(11 ,[1,2,3] ,true ,#undef ,Cor errorBound (eps = 0) ,(err_, [eps = 0]))]" then ()
18.440 - else raise error "diffapp.sml: diff.behav. in autoCalc .. scripts for max 1";
18.441 -*)
18.442 -
18.443 -
18.444 -
18.445 -"--------------------- 30.4.03: maximum .. rewrite_set_ list_rls ---------";
18.446 -"--------------------- 30.4.03: maximum .. rewrite_set_ list_rls ---------";
18.447 -"--------------------- 30.4.03: maximum .. rewrite_set_ list_rls ---------";
18.448 -str2term
18.449 - "Script Maximum_value(fix_::bool list)(m_::real) (rs_::bool list)\
18.450 - \ (v_::real) (itv_::real set) (err_::bool) = \
18.451 - \ (let e_ = (hd o (filterVar m_)) rs_; \
18.452 - \ t_ = (if 1 < length_ rs_ \
18.453 - \ then (SubProblem (Reals_,[make,function],[no_met])\
18.454 - \ [real_ m_, real_ v_, bool_list_ rs_])\
18.455 - \ else (hd rs_)); \
18.456 - \ (mx_::real) = SubProblem (Reals_,[on_interval,max_of,function], \
18.457 - \ [Isac,maximum_on_interval])\
18.458 - \ [bool_ t_, real_ v_, real_set_ itv_]\
18.459 - \ in ((SubProblem (Reals_,[find_values,tool],[Isac,find_values]) \
18.460 - \ [real_ mx_, real_ (Rhs t_), real_ v_, real_ m_, \
18.461 - \ bool_list_ (dropWhile (ident e_) rs_)])::bool list))";
18.462 -
18.463 -val fix_ = (str2term "fix_::bool list",
18.464 - str2term "[r=Arbfix]");
18.465 -val m_ = (str2term "m_::real",
18.466 - str2term "A");
18.467 -val rs_ = (str2term "rs_::bool list",
18.468 - str2term "[A = a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]");
18.469 -val v_ = (str2term "v_::real",
18.470 - str2term "b");
18.471 -val itv_ = (str2term "itv_::real set",
18.472 - str2term "{x::real. 0 <= x & x <= 2*r}");
18.473 -val err_ = (str2term "err_::bool",
18.474 - str2term "eps=0");
18.475 -val env = [fix_, m_, rs_ ,v_, itv_, err_];
18.476 -
18.477 -(*--- 1.line in script ---*)
18.478 -val t = str2term "(hd o (filterVar m_)) (rs_::bool list)";
18.479 -val s = subst_atomic env t;
18.480 -term2str s;
18.481 -"(hd o filterVar A) [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]";
18.482 -val SOME (s',_) = rewrite_set_ thy false list_rls s;
18.483 -val s'' = term2str s';
18.484 -if s''="A = a * b" then () else raise error "new behaviour with list_rls 1.1.";
18.485 -val env = env @ [(str2term "e_::bool",str2term "A = a * b")];
18.486 -
18.487 -(*--- 2.line: condition alone ---*)
18.488 -val t = str2term "1 < length_ (rs_::bool list)";
18.489 -val s = subst_atomic env t;
18.490 -term2str s;
18.491 -"1 < length_ [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]";
18.492 -val SOME (s',_) = rewrite_set_ thy false list_rls s;
18.493 -val s'' = term2str s';
18.494 -if s''="True" then () else raise error "new behaviour with list_rls 1.2.";
18.495 -
18.496 -(*--- 2.line in script ---*)
18.497 -val t = str2term
18.498 - "(if 1 < length_ rs_ \
18.499 - \ then (SubProblem (Reals_,[make,function],[no_met])\
18.500 - \ [real_ m_, real_ v_, bool_list_ rs_])\
18.501 - \ else (hd rs_))";
18.502 -val s = subst_atomic env t;
18.503 -term2str s;
18.504 -"if 1 < length_ [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]\
18.505 -\then SubProblem (Reals_, [make, function], [no_met])\
18.506 -\ [real_ A, real_ b,\
18.507 -\ bool_list_ [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]]\
18.508 -\else hd [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]";
18.509 -val SOME (s',_) = rewrite_set_ thy false list_rls s;
18.510 -val s'' = term2str s';
18.511 -if s'' =
18.512 -"SubProblem (Reals_, [make, function], [no_met])\n\
18.513 -\ [real_ A, real_ b,\n\
18.514 -\ bool_list_ [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]]" then ()
18.515 -else raise error "new behaviour with list_rls 1.3.";
18.516 -val env = env @ [(str2term "t_::bool",
18.517 - str2term "A = (2*sqrt(r^^^2-(b/2)^^^2)) * b")];
18.518 -
18.519 -
18.520 -
18.521 -"---------------------- 1.5.03: Make_fun_by_explicit ---------------------";
18.522 -"---------------------- 1.5.03: Make_fun_by_explicit ---------------------";
18.523 -"---------------------- 1.5.03: Make_fun_by_explicit ---------------------";
18.524 -str2term
18.525 - "Script Make_fun_by_explicit (f_::real) (v_::real) \
18.526 - \ (eqs_::bool list) = \
18.527 - \ (let h_ = (hd o (filterVar f_)) eqs_; \
18.528 - \ e_1 = hd (dropWhile (ident h_) eqs_); \
18.529 - \ vs_ = dropWhile (ident f_) (Vars h_); \
18.530 - \ v_1 = hd (dropWhile (ident v_) vs_); \
18.531 - \ (s_1::bool list)=(SubProblem(Reals_,[univar,equation],[no_met])\
18.532 - \ [bool_ e_1, real_ v_1])\
18.533 - \ in Substitute [(v_1 = (rhs o hd) s_1)] h_)";
18.534 -val f_ = (str2term "f_::real",
18.535 - str2term "A");
18.536 -val v_ = (str2term "v_::real",
18.537 - str2term "b");
18.538 -val eqs_=(str2term "eqs_::bool list",
18.539 - str2term "[A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]");
18.540 -val env = [f_, v_, eqs_];
18.541 -
18.542 -(*--- 1.line in script ---*)
18.543 -val t = str2term "(hd o (filterVar v_)) (eqs_::bool list)";
18.544 -val s = subst_atomic env t;
18.545 -term2str s;
18.546 -val t = str2term
18.547 - "(hd o filterVar b) [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]";
18.548 -val SOME (t',_) = rewrite_set_ thy false list_rls t;
18.549 -val s' = term2str t';
18.550 -if s' = "A = a * b" then () else raise error "new behaviour with list_rls 2.1";
18.551 -val env = env @ [(str2term "h_::bool", str2term s')];
18.552 -
18.553 -(*--- 2.line in script ---*)
18.554 -val t = str2term "hd (dropWhile (ident h_) (eqs_::bool list))";
18.555 -val s = subst_atomic env t;
18.556 -term2str s;
18.557 -val t = str2term
18.558 - "hd (dropWhile (ident (A = a * b))\
18.559 - \ [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2])";
18.560 -mem_rls "dropWhile_Cons" list_rls;
18.561 -mem_rls "Atools.ident" list_rls;
18.562 -val SOME (t',_) = rewrite_set_ thy false list_rls t;
18.563 -val s' = term2str t';
18.564 -if s' = "(a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2" then ()
18.565 -else raise error "new behaviour with list_rls 2.2";
18.566 -val env = env @ [(str2term "e_1::bool", str2term s')];
18.567 -
18.568 -(*--- 3.line in script ---*)
18.569 -val t = str2term "dropWhile (ident f_) (Vars (h_::bool))";
18.570 -val s = subst_atomic env t;
18.571 -term2str s;
18.572 -val t = str2term "dropWhile (ident A) (Vars (A = a * b))";
18.573 -val SOME (t',_) = rewrite_set_ thy false list_rls t;
18.574 -val s' = term2str t';
18.575 -if s' = "[a, b]" then () else raise error "new behaviour with list_rls 2.3";
18.576 -val env = env @ [(str2term "vs_::real list", str2term s')];
18.577 -
18.578 -(*--- 4.line in script ---*)
18.579 -val t = str2term "hd (dropWhile (ident v_) vs_)";
18.580 -val s = subst_atomic env t;
18.581 -term2str s;
18.582 -val t = str2term "hd (dropWhile (ident b) [a, b])";
18.583 -val SOME (t',_) = rewrite_set_ thy false list_rls t;
18.584 -val s' = term2str t';
18.585 -if s' = "a" then () else raise error "new behaviour with list_rls 2.4.";
18.586 -val env = env @ [(str2term "v_1::real", str2term s')];
18.587 -
18.588 -(*--- 5.line in script ---*)
18.589 -val t = str2term "(SubProblem(Reals_,[univar,equation],[no_met])\
18.590 - \ [bool_ e_1, real_ v_1])";
18.591 -val s = subst_atomic env t;
18.592 -term2str s;
18.593 -"SubProblem (Reals_, [univar, equation], [no_met])\n\
18.594 -\ [bool_ ((a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2), real_ a]";
18.595 -val env = env @ [(str2term "s_1::bool list",
18.596 - str2term "[a = 2 * sqrt (r^^^2 - (b/2)^^^2)]")];
18.597 -
18.598 -(*--- 6.line in script ---*)
18.599 -val t = str2term "Substitute [(v_1 = (rhs o hd) (s_1::bool list))] (h_::bool)";
18.600 -val s = subst_atomic env t;
18.601 -term2str s;
18.602 -val t = str2term
18.603 -"Substitute [(a = (rhs o hd) [a = 2 * sqrt (r ^^^ 2 - (b / 2) ^^^ 2)])]\n\
18.604 -\ (A = a * b)";
18.605 -mem_rls "Tools.rhs" list_rls;
18.606 -val SOME (t',_) = rewrite_set_ thy false list_rls t;
18.607 -val s' = term2str t';
18.608 -if s' = "Substitute [a = 2 * sqrt (r ^^^ 2 - (b / 2) ^^^ 2)] (A = a * b)"
18.609 -then () else raise error "new behaviour with list_rls 2.6.";
18.610 -
18.611 -
18.612 -"---------------------- 2.5.03: Make_fun_by_new_variable -----------------";
18.613 -"---------------------- 2.5.03: Make_fun_by_new_variable -----------------";
18.614 -"---------------------- 2.5.03: Make_fun_by_new_variable -----------------";
18.615 -str2term
18.616 - "Script Make_fun_by_new_variable (f_::real) (v_::real) \
18.617 - \ (eqs_::bool list) = \
18.618 - \(let h_ = (hd o (filterVar f_)) eqs_; \
18.619 - \ es_ = dropWhile (ident h_) eqs_; \
18.620 - \ vs_ = dropWhile (ident f_) (Vars h_); \
18.621 - \ v_1 = nth_ 1 vs_; \
18.622 - \ v_2 = nth_ 2 vs_; \
18.623 - \ e_1 = (hd o (filterVar v_1)) es_; \
18.624 - \ e_2 = (hd o (filterVar v_2)) es_; \
18.625 - \ (s_1::bool list) = (SubProblem (Reals_,[univar,equation],[no_met])\
18.626 - \ [bool_ e_1, real_ v_1]);\
18.627 - \ (s_2::bool list) = (SubProblem (Reals_,[univar,equation],[no_met])\
18.628 - \ [bool_ e_2, real_ v_2])\
18.629 - \in Substitute [(v_1 = (rhs o hd) s_1),(v_2 = (rhs o hd) s_2)] h_)";
18.630 -val f_ = (str2term "f_::real",
18.631 - str2term "A");
18.632 -val v_ = (str2term "v_::real",
18.633 - str2term "alpha");
18.634 -val eqs_=(str2term "eqs_::bool list",
18.635 - str2term "[A=a*b, a/2=r*sin alpha, b/2=r*cos alpha]");
18.636 -val env = [f_, v_, eqs_];
18.637 -
18.638 -(*--- 1.line in script ---*)
18.639 -val t = str2term "(hd o (filterVar (f_::real))) (eqs_::bool list)";
18.640 -val s = subst_atomic env t;
18.641 -term2str s;
18.642 -val t = str2term
18.643 -"(hd o filterVar A) [A = a * b, a / 2 = r * sin alpha, b / 2 = r * cos alpha]";
18.644 -trace_rewrite:=true;
18.645 -val SOME (t',_) = rewrite_set_ thy false list_rls t;
18.646 -trace_rewrite:=false;
18.647 -val s' = term2str t';
18.648 -if s' = "A = a * b" then() else raise error "new behaviour with list_rls 3.1.";
18.649 -val env = env @ [(str2term "h_::bool", str2term s')];
18.650 -
18.651 -(*--- 2.line in script ---*)
18.652 -val t = str2term "dropWhile (ident (h_::bool)) (eqs_::bool list)";
18.653 -val s = subst_atomic env t;
18.654 -term2str s;
18.655 -val t = str2term
18.656 -"dropWhile (ident (A = a * b))\
18.657 -\ [A = a * b, a / 2 = r * sin alpha, b / 2 = r * cos alpha]";
18.658 -val SOME (t',_) = rewrite_set_ thy false list_rls t;
18.659 -val s' = term2str t';
18.660 -if s' = "[a / 2 = r * sin alpha, b / 2 = r * cos alpha]"
18.661 -then () else raise error "new behaviour with list_rls 3.2.";
18.662 -val env = env @ [(str2term "es_::bool list", str2term s')];
18.663 -
18.664 -(*--- 3.line in script ---*)
18.665 -val t = str2term "dropWhile (ident (f_::real)) (Vars (h_::bool))";
18.666 -val s = subst_atomic env t;
18.667 -term2str s;
18.668 -val t = str2term "dropWhile (ident A) (Vars (A = a * b))";
18.669 -val SOME (t',_) = rewrite_set_ thy false list_rls t;
18.670 -val s' = term2str t';
18.671 -if s' = "[a, b]" then () else raise error "new behaviour with list_rls 3.3.";
18.672 -val env = env @ [(str2term "vs_::real list", str2term s')];
18.673 -
18.674 -(*--- 4.line in script ---*)
18.675 -val t = str2term "nth_ 1 vs_";
18.676 -val s = subst_atomic env t;
18.677 -term2str s;
18.678 -val t = str2term "nth_ 1 [a, b]";
18.679 -val SOME (t',_) = rewrite_set_ thy false list_rls t;
18.680 -val s' = term2str t';
18.681 -if s' = "a" then () else raise error "new behaviour with list_rls 3.4.";
18.682 -val env = env @ [(str2term "v_1", str2term s')];
18.683 -
18.684 -(*--- 5.line in script ---*)
18.685 -val t = str2term "nth_ 2 vs_";
18.686 -val s = subst_atomic env t;
18.687 -term2str s;
18.688 -val t = str2term "nth_ 2 [a, b]";
18.689 -val SOME (t',_) = rewrite_set_ thy false list_rls t;
18.690 -val s' = term2str t';
18.691 -if s' = "b" then () else raise error "new behaviour with list_rls 3.5.";
18.692 -val env = env @ [(str2term "v_2", str2term s')];
18.693 -
18.694 -(*--- 6.line in script ---*)
18.695 -val t = str2term "(hd o (filterVar v_1)) (es_::bool list)";
18.696 -val s = subst_atomic env t;
18.697 -term2str s;
18.698 -val t = str2term
18.699 - "(hd o filterVar a) [a / 2 = r * sin alpha, b / 2 = r * cos alpha]";
18.700 -val SOME (t',_) = rewrite_set_ thy false list_rls t;
18.701 -val s' = term2str t';
18.702 -if s' = "a / 2 = r * sin alpha" then ()
18.703 -else raise error "new behaviour with list_rls 3.6.";
18.704 -val e_1 = str2term "e_1::bool";
18.705 -val env = env @ [(e_1, str2term s')];
18.706 -
18.707 -(*--- 7.line in script ---*)
18.708 -val t = str2term "(hd o (filterVar v_2)) (es_::bool list)";
18.709 -val s = subst_atomic env t;
18.710 -term2str s;
18.711 -val t = str2term
18.712 - "(hd o filterVar b) [a / 2 = r * sin alpha, b / 2 = r * cos alpha]";
18.713 -val SOME (t',_) = rewrite_set_ thy false list_rls t;
18.714 -val s' = term2str t';
18.715 -if s' = "b / 2 = r * cos alpha" then ()
18.716 -else raise error "new behaviour with list_rls 3.7.";
18.717 -val env = env @ [(str2term "e_2::bool", str2term s')];
18.718 -
18.719 -(*--- 8.line in script ---*)
18.720 -val t = str2term "(SubProblem (Reals_,[univar,equation],[no_met])\
18.721 - \ [bool_ e_1, real_ v_1])";
18.722 -val s = subst_atomic env t;
18.723 -term2str s;
18.724 -"SubProblem (Reals_, [univar, equation], [no_met])\
18.725 - \ [bool_ (a / 2 = r * sin alpha), real_ a]";
18.726 -val s_1 = str2term "[a = 2*r*sin alpha]";
18.727 -val env = env @ [(str2term "s_1::bool list", s_1)];
18.728 -
18.729 -(*--- 9.line in script ---*)
18.730 -val t = str2term "(SubProblem (Reals_,[univar,equation],[no_met])\
18.731 - \ [bool_ e_2, real_ v_2])";
18.732 -val s = subst_atomic env t;
18.733 -term2str s;
18.734 -"SubProblem (Reals_, [univar, equation], [no_met])\
18.735 - \ [bool_ (b / 2 = r * cos alpha), real_ b]";
18.736 -val s_2 = str2term "[b = 2*r*cos alpha]";
18.737 -val env = env @ [(str2term "s_2::bool list", s_2)];
18.738 -
18.739 -(*--- 10.line in script ---*)
18.740 -val t = str2term
18.741 -"Substitute [(v_1 = (rhs o hd) s_1),(v_2 = (rhs o hd) s_2)] (h_::bool)";
18.742 -val s = subst_atomic env t;
18.743 -term2str s;
18.744 -"Substitute\n [(a = (rhs o hd) [a = 2 * r * sin alpha]),\
18.745 -\ (b = (rhs o hd) [b = 2 * r * cos alpha])] (A = a * b)";
18.746 -val SOME (s',_) = rewrite_set_ thy false list_rls s;
18.747 -val s'' = term2str s';
18.748 -if s'' =
18.749 -"Substitute [a = 2 * r * sin alpha, b = 2 * r * cos alpha] (A = a * b)"
18.750 -then () else raise error "new behaviour with list_rls 3.10.";
18.751 -
18.752 -
18.753 -
18.754 -
18.755 -
19.1 --- a/test/Tools/isac/IsacKnowledge/eqsystem.sml Mon Aug 30 14:29:49 2010 +0200
19.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
19.3 @@ -1,1445 +0,0 @@
19.4 -(* tests on systems of equations
19.5 - author: Walther Neuper
19.6 - 050826,
19.7 - (c) due to copyright terms
19.8 -
19.9 -use"../smltest/IsacKnowledge/eqsystem.sml";
19.10 -use"eqsystem.sml";
19.11 -*)
19.12 -val thy = EqSystem.thy;
19.13 -
19.14 -"-----------------------------------------------------------------";
19.15 -"table of contents -----------------------------------------------";
19.16 -"-----------------------------------------------------------------";
19.17 -"----------- occur_exactly_in ------------------------------------";
19.18 -"----------- problems --------------------------------------------";
19.19 -"----------- rewrite-order ord_simplify_System -------------------";
19.20 -"----------- rewrite in [EqSystem,normalize,2x2] -----------------";
19.21 -"----------- rewrite example from 2nd [EqSystem,normalize,2x2] ---";
19.22 -"----------- rewrite in [EqSystem,top_down_substitution,2x2] -----";
19.23 -"----------- rewrite in [EqSystem,normalize,4x4] -----------------";
19.24 -"----------- script [EqSystem,normalize,2x2] ---------------------";
19.25 -"----------- script [EqSystem,top_down_substitution,2x2] Vers.1 --";
19.26 -"----------- script [EqSystem,top_down_substitution,2x2] Vers.2 --";
19.27 -"----------- refine [linear,system]-------------------------------";
19.28 -"----------- refine [2x2,linear,system] search error--------------";
19.29 -"----------- me [EqSystem,normalize,2x2] -------------------------";
19.30 -"----------- me [linear,system] ..normalize..top_down_sub..-------";
19.31 -"----------- all systems from Biegelinie -------------------------";
19.32 -"----------- 4x4 systems from Biegelinie -------------------------";
19.33 -"-----------------------------------------------------------------";
19.34 -"-----------------------------------------------------------------";
19.35 -"-----------------------------------------------------------------";
19.36 -
19.37 -
19.38 -"----------- occur_exactly_in ------------------------------------";
19.39 -"----------- occur_exactly_in ------------------------------------";
19.40 -"----------- occur_exactly_in ------------------------------------";
19.41 -val all = [str2term"c", str2term"c_2", str2term"c_3"];
19.42 -val t = str2term"0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2";
19.43 -
19.44 -if occur_exactly_in [str2term"c", str2term"c_2"] all t
19.45 -then () else raise error "eqsystem.sml occur_exactly_in 1";
19.46 -
19.47 -if not (occur_exactly_in [str2term"c", str2term"c_2", str2term"c_3"] all t)
19.48 -then () else raise error "eqsystem.sml occur_exactly_in 2";
19.49 -
19.50 -if not (occur_exactly_in [str2term"c_2"] all t)
19.51 -then () else raise error "eqsystem.sml occur_exactly_in 3";
19.52 -
19.53 -
19.54 -val t = str2term"[c,c_2] from_ [c,c_2,c_3] occur_exactly_in \
19.55 - \-1 * q_0 * L ^^^ 2 / 2 + L * c + c_2";
19.56 -val SOME (str, t') = eval_occur_exactly_in 0 "EqSystem.occur'_exactly'_in" t 0;
19.57 -if str = "[c, c_2] from_ [c, c_2,\n c_3] occur_exactly_in -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2 = True" then ()
19.58 -else raise error "eval_occur_exactly_in [c, c_2]";
19.59 -
19.60 -val t = str2term"[c,c_2,c_3] from_ [c,c_2,c_3] occur_exactly_in \
19.61 - \-1 * q_0 * L ^^^ 2 / 2 + L * c + c_2";
19.62 -val SOME (str, t') = eval_occur_exactly_in 0 "EqSystem.occur'_exactly'_in" t 0;
19.63 -if str = "[c, c_2,\n c_3] from_ [c, c_2,\n c_3] occur_exactly_in -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2 = False" then ()
19.64 -else raise error "eval_occur_exactly_in [c, c_2, c_3]";
19.65 -
19.66 -val t = str2term"[c_2] from_ [c,c_2,c_3] occur_exactly_in \
19.67 - \-1 * q_0 * L ^^^ 2 / 2 + L * c + c_2";
19.68 -val SOME (str, t') = eval_occur_exactly_in 0 "EqSystem.occur'_exactly'_in" t 0;
19.69 -if str = "[c_2] from_ [c, c_2,\n c_3] occur_exactly_in -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2 = False" then ()
19.70 -else raise error "eval_occur_exactly_in [c, c_2, c_3]";
19.71 -
19.72 -val t = str2term"[] from_ [c,c_2,c_3] occur_exactly_in 0";
19.73 -val SOME (str, t') = eval_occur_exactly_in 0 "EqSystem.occur'_exactly'_in" t 0;
19.74 -if str = "[] from_ [c, c_2, c_3] occur_exactly_in 0 = True" then ()
19.75 -else raise error "eval_occur_exactly_in [c, c_2, c_3]";
19.76 -
19.77 -val t =
19.78 - str2term
19.79 - "[] from_ [c, c_2, c_3, c_4] occur_exactly_in -1 * (q_0 * L ^^^ 2) /2";
19.80 -val SOME (str, t') = eval_occur_exactly_in 0 "EqSystem.occur'_exactly'_in" t 0;
19.81 -if str = "[] from_ [c, c_2, c_3, c_4] occur_exactly_in \
19.82 - \-1 * (q_0 * L ^^^ 2) / 2 = True" then ()
19.83 -else raise error "eval_occur_exactly_in [c, c_2, c_3, c_4]";
19.84 -
19.85 -
19.86 -"----------- problems --------------------------------------------";
19.87 -"----------- problems --------------------------------------------";
19.88 -"----------- problems --------------------------------------------";
19.89 -val t = str2term "length_ [x+y=1,y=2] = 2";
19.90 -atomty t;
19.91 -val testrls = append_rls "testrls" e_rls
19.92 - [(Thm ("length_Nil_",num_str length_Nil_)),
19.93 - (Thm ("length_Cons_",num_str length_Cons_)),
19.94 - Calc ("op +", eval_binop "#add_"),
19.95 - Calc ("op =",eval_equal "#equal_")
19.96 - ];
19.97 -val SOME (t',_) = rewrite_set_ thy false testrls t;
19.98 -if term2str t' = "True" then ()
19.99 -else raise error "eqsystem.sml: length_ [x+y=1,y=2] = 2";
19.100 -
19.101 -val SOME t = parse EqSystem.thy "solution L";
19.102 -atomty (term_of t);
19.103 -val SOME t = parse Biegelinie.thy "solution L";
19.104 -atomty (term_of t);
19.105 -
19.106 -val t = str2term
19.107 -"(tl (tl (tl vs_))) from_ vs_ occur_exactly_in (nth_ 1 (es_::bool list))";
19.108 -atomty t;
19.109 -val t = str2term
19.110 -"(tl (tl (tl [c,c_2,c_3,c_4]))) from_ [c,c_2,c_3,c_4] occur_exactly_in \
19.111 -\(nth_ 1 [c_4 = 1, 2=2,3=3,4=4])";
19.112 -val SOME (t,_) =
19.113 - rewrite_set_ thy true
19.114 - (append_rls "prls_" e_rls
19.115 - [Thm ("nth_Cons_",num_str nth_Cons_),
19.116 - Thm ("nth_Nil_",num_str nth_Nil_),
19.117 - Thm ("tl_Cons",num_str tl_Cons),
19.118 - Thm ("tl_Nil",num_str tl_Nil),
19.119 - Calc ("EqSystem.occur'_exactly'_in",
19.120 - eval_occur_exactly_in
19.121 - "#eval_occur_exactly_in_")
19.122 - ]) t;
19.123 -if t = HOLogic.true_const then ()
19.124 -else raise error "eqsystem.sml ..occur_exactly_in (nth_ 1 [c_4..";
19.125 -
19.126 -
19.127 -"----------- rewrite-order ord_simplify_System -------------------";
19.128 -"----------- rewrite-order ord_simplify_System -------------------";
19.129 -"----------- rewrite-order ord_simplify_System -------------------";
19.130 -"M_b x = c * x + -1 * q_0 * (x ^^^ 2 / 2) + c_2";
19.131 -"--- add_commute ---";
19.132 -if ord_simplify_System false thy [] (str2term"-1 * q_0 * (x ^^^ 2 / 2)",
19.133 - str2term"c * x") then ()
19.134 -else raise error "integrate.sml, (-1 * q_0 * (x ^^^ 2 / 2)) < (c * x) not#1";
19.135 -
19.136 -if ord_simplify_System false thy [] (str2term"-1 * q_0 * (x ^^^ 2 / 2)",
19.137 - str2term"c_2") then ()
19.138 -else raise error "integrate.sml, (-1 * q_0 * (x ^^^ 2 / 2)) < (c_2) not#2";
19.139 -
19.140 -if ord_simplify_System false thy [] (str2term"c * x",
19.141 - str2term"c_2") then ()
19.142 -else raise error "integrate.sml, (c * x) < (c_2) not#3";
19.143 -
19.144 -"--- mult_commute ---";
19.145 -if ord_simplify_System false thy [] (str2term"x * c",
19.146 - str2term"c * x") then ()
19.147 -else raise error "integrate.sml, (x * c) < (c * x) not#4";
19.148 -
19.149 -if ord_simplify_System false thy [] (str2term"-1 * q_0 * (x ^^^ 2 / 2) * c",
19.150 - str2term"-1 * q_0 * c * (x ^^^ 2 / 2)")
19.151 -then () else raise error "integrate.sml, (. * .) < (. * .) not#5";
19.152 -
19.153 -if ord_simplify_System false thy [] (str2term"-1 * q_0 * (x ^^^ 2 / 2) * c",
19.154 - str2term"c * -1 * q_0 * (x ^^^ 2 / 2)")
19.155 -then () else raise error "integrate.sml, (. * .) < (. * .) not#6";
19.156 -
19.157 -
19.158 -"----------- rewrite in [EqSystem,normalize,2x2] -----------------";
19.159 -"----------- rewrite in [EqSystem,normalize,2x2] -----------------";
19.160 -"----------- rewrite in [EqSystem,normalize,2x2] -----------------";
19.161 -val t = str2term"[0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2,\
19.162 - \0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2]";
19.163 -val bdvs = [(str2term"bdv_1",str2term"c"),
19.164 - (str2term"bdv_2",str2term"c_2")];
19.165 -val SOME(t,_)= rewrite_set_inst_ thy true bdvs simplify_System_parenthesized t;
19.166 -if term2str t = "[0 = -1 * q_0 * L ^^^ 2 / 2 + (L * c + c_2), 0 = c_2]"
19.167 -then () else raise error "eqsystem.sml rewrite in 2x2 simplify_System_par.1";
19.168 -
19.169 -val SOME (t,_) = rewrite_set_inst_ thy true bdvs isolate_bdvs t;
19.170 -if term2str t = "[L * c + c_2 = 0 + -1 * (-1 * q_0 * L ^^^ 2 / 2), c_2 = 0]"
19.171 -then () else raise error "eqsystem.sml rewrite in 2x2 isolate_bdvs";
19.172 -
19.173 -val SOME(t,_)= rewrite_set_inst_ thy true bdvs simplify_System t;
19.174 -if term2str t = "[L * c + c_2 = q_0 * L ^^^ 2 / 2, c_2 = 0]"
19.175 -then () else raise error "eqsystem.sml rewrite in 2x2 simplify_System_par.2";
19.176 -
19.177 -val SOME (t,_) = rewrite_set_ thy true order_system t;
19.178 -if term2str t = "[c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]"
19.179 -then () else raise error "eqsystem.sml rewrite in 2x2 simplify_System_par.3";
19.180 -
19.181 -
19.182 -"----------- rewrite example from 2nd [EqSystem,normalize,2x2] ---";
19.183 -"----------- rewrite example from 2nd [EqSystem,normalize,2x2] ---";
19.184 -"----------- rewrite example from 2nd [EqSystem,normalize,2x2] ---";
19.185 -val thy = Isac.thy (*because of Undeclared constant "Biegelinie.EI*);
19.186 -val t =
19.187 - str2term"[0 = c_2 + c * 0 + 1 / EI * (L * q_0 / 12 * 0 ^^^ 3 + \
19.188 - \ -1 * q_0 / 24 * 0 ^^^ 4),\
19.189 - \ 0 = c_2 + c * L + 1 / EI * (L * q_0 / 12 * L ^^^ 3 + \
19.190 - \ -1 * q_0 / 24 * L ^^^ 4)]";
19.191 -val SOME (t,_) = rewrite_set_ thy true norm_Rational t;
19.192 -if term2str t="[0 = c_2, 0 = c_2 + L * c + L ^^^ 4 * q_0 / (EI * 24)]"
19.193 -then () else raise error "eqsystem.sml rewrite in 2x2 simplify_System_par.0b";
19.194 -
19.195 -val SOME(t,_)= rewrite_set_inst_ thy true bdvs simplify_System_parenthesized t;
19.196 -if term2str t = "[0 = c_2, 0 = q_0 * L ^^^ 4 / (24 * EI) + (L * c + c_2)]"
19.197 -then () else raise error "eqsystem.sml rewrite in 2x2 simplify_System_par.1b";
19.198 -
19.199 -val SOME (t,_) = rewrite_set_inst_ thy true bdvs isolate_bdvs t;
19.200 -if term2str t = "[c_2 = 0, L * c + c_2 = 0 + -1 * (q_0 * L ^^^ 4 / (24 * EI))]"
19.201 -then () else raise error "eqsystem.sml rewrite in 2x2 isolate_bdvs b";
19.202 -
19.203 -val SOME(t,_)= rewrite_set_inst_ thy true bdvs simplify_System t;
19.204 -if term2str t = "[c_2 = 0, L * c + c_2 = -1 * q_0 * L ^^^ 4 / (24 * EI)]"
19.205 -then () else raise error "eqsystem.sml rewrite in 2x2 simplify_System.2b";
19.206 -
19.207 -val xxx = rewrite_set_ thy true order_system t;
19.208 -if is_none xxx
19.209 -then () else raise error "eqsystem.sml rewrite in 2x2 simplify_System.3b";
19.210 -
19.211 -
19.212 -"----------- rewrite in [EqSystem,top_down_substitution,2x2] -----";
19.213 -"----------- rewrite in [EqSystem,top_down_substitution,2x2] -----";
19.214 -"----------- rewrite in [EqSystem,top_down_substitution,2x2] -----";
19.215 -val e1__ = str2term "c_2 = 77";
19.216 -val e2__ = str2term "L * c + c_2 = q_0 * L ^^^ 2 / 2";
19.217 -val bdvs = [(str2term"bdv_1",str2term"c"),
19.218 - (str2term"bdv_2",str2term"c_2")];
19.219 -val SOME (e2__,_) = rewrite_terms_ thy dummy_ord Erls [e1__] e2__;
19.220 -if term2str e2__ = "L * c + 77 = q_0 * L ^^^ 2 / 2" then ()
19.221 -else raise error "eqsystem.sml top_down_substitution,2x2] subst";
19.222 -
19.223 -val SOME (e2__,_) =
19.224 - rewrite_set_inst_ thy true bdvs simplify_System_parenthesized e2__;
19.225 -if term2str e2__ = "77 + L * c = q_0 * L ^^^ 2 / 2" then ()
19.226 -else raise error "eqsystem.sml top_down_substitution,2x2] simpl_par";
19.227 -
19.228 -val SOME (e2__,_) = rewrite_set_inst_ thy true bdvs isolate_bdvs e2__;
19.229 -if term2str e2__ = "c = (q_0 * L ^^^ 2 / 2 + -1 * 77) / L" then ()
19.230 -else raise error "eqsystem.sml top_down_substitution,2x2] isolate";
19.231 -
19.232 -val t = str2term "[c_2 = 77, c = (q_0 * L ^^^ 2 / 2 + -1 * 77) / L]";
19.233 -val SOME (t,_) = rewrite_set_ thy true order_system t;
19.234 -if term2str t = "[c = (q_0 * L ^^^ 2 / 2 + -1 * 77) / L, c_2 = 77]" then ()
19.235 -else raise error "eqsystem.sml top_down_substitution,2x2] order_system";
19.236 -
19.237 -if not (ord_simplify_System
19.238 - false thy []
19.239 - (str2term"[c_2 = 77, c = (q_0 * L ^^^ 2 / 2 + -1 * 77) / L]",
19.240 - str2term"[c = (q_0 * L ^^^ 2 / 2 + -1 * 77) / L, c_2 = 77]"))
19.241 -then () else raise error "eqsystem.sml, order_result rew_ord";
19.242 -
19.243 -trace_rewrite:=true;
19.244 -trace_rewrite:=false;
19.245 -
19.246 -
19.247 -"----------- rewrite in [EqSystem,normalize,4x4] -----------------";
19.248 -"----------- rewrite in [EqSystem,normalize,4x4] -----------------";
19.249 -"----------- rewrite in [EqSystem,normalize,4x4] -----------------";
19.250 -(*GOON??: revise rewrite in [EqSystem,normalize,4x4] from before 0609*)
19.251 -val t = str2term"[0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c_3 + c_4,\
19.252 - \0 = -1 * q_0 * L ^^^ 2 / 2 + L * c_3 + c_4,\
19.253 - \c + c_2 + c_3 + c_4 = 0,\
19.254 - \c_2 + c_3 + c_4 = 0]";
19.255 -val bdvs = [(str2term"bdv_1",str2term"c"),
19.256 - (str2term"bdv_2",str2term"c_2"),
19.257 - (str2term"bdv_3",str2term"c_3"),
19.258 - (str2term"bdv_4",str2term"c_4")];
19.259 -val SOME (t,_) =
19.260 - rewrite_set_inst_ thy true bdvs simplify_System_parenthesized t;
19.261 -if term2str t = "[0 = c_4, 0 = -1 * q_0 * L ^^^ 2 / 2 + (L * c_3 + c_4),\n\
19.262 - \ c + (c_2 + (c_3 + c_4)) = 0, c_2 + (c_3 + c_4) = 0]"
19.263 -then () else raise error "eqsystem.sml rewrite in 4x4 simplify_System_paren";
19.264 -
19.265 -val SOME (t,_) = rewrite_set_inst_ thy true bdvs isolate_bdvs t;
19.266 -if term2str t = "[c_4 = 0, \
19.267 - \L * c_3 + c_4 = 0 + -1 * (-1 * q_0 * L ^^^ 2 / 2),\n \
19.268 - \c + (c_2 + (c_3 + c_4)) = 0, c_2 + (c_3 + c_4) = 0]"
19.269 -then () else raise error "eqsystem.sml rewrite in 4x4 isolate_bdvs";
19.270 -
19.271 -val SOME(t,_)= rewrite_set_inst_ thy true bdvs simplify_System_parenthesized t;
19.272 -if term2str t = "[c_4 = 0,\
19.273 - \ L * c_3 + c_4 = q_0 * L ^^^ 2 / 2,\
19.274 - \ c + (c_2 + (c_3 + c_4)) = 0,\n\
19.275 - \ c_2 + (c_3 + c_4) = 0]"
19.276 -then () else raise error "eqsystem.sml rewrite in 4x4 simplify_System_p..2";
19.277 -
19.278 -val SOME (t,_) = rewrite_set_ thy true order_system t;
19.279 -if term2str t = "[c_4 = 0,\
19.280 - \ L * c_3 + c_4 = q_0 * L ^^^ 2 / 2,\
19.281 - \ c_2 + (c_3 + c_4) = 0,\n\
19.282 - \ c + (c_2 + (c_3 + c_4)) = 0]"
19.283 -then () else raise error "eqsystem.sml rewrite in 4x4 order_system";
19.284 -
19.285 -
19.286 -"----------- script [EqSystem,normalize,2x2] ---------------------";
19.287 -"----------- script [EqSystem,normalize,2x2] ---------------------";
19.288 -"----------- script [EqSystem,normalize,2x2] ---------------------";
19.289 -val str =
19.290 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.291 -\ (let es__ = (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.292 -\ simplify_System_parenthesized False) es_ \
19.293 -\ in ([]))";
19.294 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.295 -val str =
19.296 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.297 -\ (let es__ = (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.298 -\ simplify_System_parenthesized False) es_ \
19.299 -\ in (SubProblem (Biegelinie_,[linear,system],[no_met])\
19.300 -\ []))";
19.301 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.302 -val str =
19.303 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.304 -\ (let es__ = (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.305 -\ simplify_System_parenthesized False) es_ \
19.306 -\ in (SubProblem (Biegelinie_,[linear,system],[no_met])\
19.307 -\ [bool_list_ es__, real_list_ vs_]))"
19.308 -;
19.309 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.310 -val str =
19.311 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.312 -\ (let es__ = Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.313 -\ simplify_System_parenthesized False) es_ \
19.314 -\ in (SubProblem (Biegelinie_,[linear,system],[no_met])\
19.315 -\ [bool_list_ es__, real_list_ vs_]))"
19.316 -;
19.317 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.318 -val str =
19.319 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.320 -\ (let es__ = (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.321 -\ simplify_System_parenthesized False)) es_ \
19.322 -\ in (SubProblem (Biegelinie_,[linear,system],[no_met])\
19.323 -\ [bool_list_ es__, real_list_ vs_]))"
19.324 -;
19.325 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.326 -val str =
19.327 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.328 -\ (let es__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.329 -\ simplify_System_parenthesized False)) @@\
19.330 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.331 -\ simplify_System_parenthesized False))) es_\
19.332 -\ in (SubProblem (Biegelinie_,[linear,system],[no_met])\
19.333 -\ [bool_list_ es__, real_list_ vs_]))"
19.334 -;
19.335 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.336 -val str =
19.337 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.338 -\ (let es__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.339 -\ simplify_System_parenthesized False)) @@\
19.340 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.341 -\ simplify_System_parenthesized False)) @@\
19.342 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.343 -\ simplify_System_parenthesized False))) es_\
19.344 -\ in (SubProblem (Biegelinie_,[linear,system],[no_met])\
19.345 -\ [bool_list_ es__, real_list_ vs_]))"
19.346 -;
19.347 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.348 -val str =
19.349 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.350 -\ (let es__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.351 -\ simplify_System_parenthesized False)) @@\
19.352 -\ (Try (Rewrite_Set_Inst [] isolate_bdvs False)) @@\
19.353 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.354 -\ simplify_System_parenthesized False)) @@\
19.355 -\ (Try (Rewrite_Set order_system False))) es_\
19.356 -\ in (SubProblem (Biegelinie_,[linear,system],[no_met])\
19.357 -\ [bool_list_ es__, real_list_ vs_]))"
19.358 -;
19.359 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.360 -val str =
19.361 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.362 -\ (let es__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.363 -\ simplify_System_parenthesized False)) @@\
19.364 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_)]\
19.365 -\ isolate_bdvs False)) @@\
19.366 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.367 -\ simplify_System_parenthesized False)) @@\
19.368 -\ (Try (Rewrite_Set order_system False))) es_\
19.369 -\ in (SubProblem (Biegelinie_,[linear,system],[no_met])\
19.370 -\ [bool_list_ es__, real_list_ vs_]))"
19.371 -;
19.372 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.373 -val str =
19.374 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.375 -\ (let es__ = ((Try (Rewrite_Set simplify_System_parenthesized False)) @@\
19.376 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.377 -\ isolate_bdvs False)) @@\
19.378 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.379 -\ simplify_System_parenthesized False)) @@\
19.380 -\ (Try (Rewrite_Set order_system False))) es_\
19.381 -\ in (SubProblem (Biegelinie_,[linear,system],[no_met])\
19.382 -\ [bool_list_ es__, real_list_ vs_]))"
19.383 -;
19.384 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.385 -(*---^^^-OK-----------------------------------------------------------------*)
19.386 -(*---vvv-NOT ok-------------------------------------------------------------*)
19.387 -
19.388 -
19.389 -"----------- script [EqSystem,top_down_substitution,2x2] Vers.1 --";
19.390 -"----------- script [EqSystem,top_down_substitution,2x2] Vers.1 --";
19.391 -"----------- script [EqSystem,top_down_substitution,2x2] Vers.1 --";
19.392 -val str =
19.393 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.394 -\ (let es__ = (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.395 -\ simplify_System_parenthesized False) es_ \
19.396 -\ in ([]))";
19.397 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.398 -val str =
19.399 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.400 -\ (let e1__ = Take (hd es_) \
19.401 -\ in ([]))";
19.402 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.403 -val str =
19.404 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.405 -\ (let e1__ = Take (hd es_); \
19.406 -\ e1__ = Take (hd es_) \
19.407 -\ in ([]))";
19.408 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.409 -val str =
19.410 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.411 -\ (let e1__ = Take (hd es_); \
19.412 -\ e1__ = (Take (hd es_))\
19.413 -\ in ([]))";
19.414 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.415 -val str =
19.416 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.417 -\ (let e1__ = Take (hd es_); \
19.418 -\ e1__ = ((Rewrite_Set order_system False)) e1__\
19.419 -\ in ([]))";
19.420 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.421 -(*--------------------------------------------------------------------------*)
19.422 -val str =
19.423 -"(Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.424 -\ isolate_bdvs False) (e1__::bool)";
19.425 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.426 -(*--------------------------------------------------------------------------*)
19.427 -val str =
19.428 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.429 -\ (let e1__ = Take (hd es_); \
19.430 -\ e1__ = ((Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.431 -\ isolate_bdvs False)) e1__\
19.432 -\ in ([]))";
19.433 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.434 -val str =
19.435 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.436 -\ (let e1__ = Take (hd es_); \
19.437 -\ e1__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.438 -\ isolate_bdvs False)) @@\
19.439 -\ (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.440 -\ simplify_System False)) e1__\
19.441 -\ in ([]))";
19.442 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.443 -val str =
19.444 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.445 -\ (let e1__ = Take (hd es_); \
19.446 -\ e1__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.447 -\ isolate_bdvs False)) @@\
19.448 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.449 -\ simplify_System False))) e1__\
19.450 -\ in ([]))";
19.451 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.452 -val str =
19.453 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.454 -\ (let e1__ = Take (hd es_); \
19.455 -\ e1__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.456 -\ isolate_bdvs False)) @@ \
19.457 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.458 -\ simplify_System False))) e1__; \
19.459 -\ e2__ = Take (hd (tl es_)) \
19.460 -\ in ([]))";
19.461 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.462 -val str =
19.463 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.464 -\ (let e1__ = Take (hd es_); \
19.465 -\ e1__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.466 -\ isolate_bdvs False)) @@ \
19.467 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.468 -\ simplify_System False))) e1__; \
19.469 -\ e2__ = Take (hd (tl es_)); \
19.470 -\ e2__ = Substitute [e1__] e2__ \
19.471 -\ in ([]))";
19.472 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.473 -val str =
19.474 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.475 -\ (let e1__ = Take (hd es_); \
19.476 -\ e1__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.477 -\ isolate_bdvs False)) @@ \
19.478 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.479 -\ simplify_System False))) e1__; \
19.480 -\ e2__ = Take (hd (tl es_)); \
19.481 -\ e2__ = ((Substitute [e1__])) e2__ \
19.482 -\ in ([]))";
19.483 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.484 -val str =
19.485 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.486 -\ (let e1__ = Take (hd es_); \
19.487 -\ e1__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.488 -\ isolate_bdvs False)) @@ \
19.489 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.490 -\ simplify_System False))) e1__; \
19.491 -\ e2__ = Take (hd (tl es_)); \
19.492 -\ e2__ = ((Substitute [e1__]) @@ \
19.493 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.494 -\ isolate_bdvs False)) @@ \
19.495 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.496 -\ simplify_System False))) e2__ \
19.497 -\ in [e1__, e2__])"
19.498 -;
19.499 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.500 -val str =
19.501 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.502 -\ (let e1__ = Take (hd es_); \
19.503 -\ e1__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.504 -\ isolate_bdvs False)) @@ \
19.505 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.506 -\ simplify_System False))) e1__; \
19.507 -\ e2__ = Take (hd (tl es_)); \
19.508 -\ e2__ = ((Substitute [e1__]) @@ \
19.509 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.510 -\ simplify_System_parenthesized False)) @@ \
19.511 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.512 -\ isolate_bdvs False)) @@ \
19.513 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.514 -\ simplify_System False)) @@ \
19.515 -\ (Try (Rewrite_Set order_system False))) e2__ \
19.516 -\ in [e1__, e2__])"
19.517 -;
19.518 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.519 -(*---^^^-OK-----------------------------------------------------------------*)
19.520 -val str =
19.521 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.522 -\ (let e1__ = Take (hd es_); \
19.523 -\ e1__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.524 -\ isolate_bdvs False)) @@ \
19.525 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.526 -\ simplify_System False))) e1__; \
19.527 -\ e2__ = Take (hd (tl es_)); \
19.528 -\ e2__ = ((Substitute [e1__]) @@ \
19.529 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.530 -\ simplify_System_parenthesized False)) @@ \
19.531 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.532 -\ isolate_bdvs False)) @@ \
19.533 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.534 -\ simplify_System False))) e2__; \
19.535 -\ es__ = Take [e1__, e2__]\
19.536 -\ in (Try (Rewrite_Set order_system False)) es__)"
19.537 -;
19.538 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.539 -(*---vvv-NOT ok-------------------------------------------------------------*)
19.540 -atomty sc;
19.541 -
19.542 -"----------- script [EqSystem,top_down_substitution,2x2] Vers.2 --";
19.543 -"----------- script [EqSystem,top_down_substitution,2x2] Vers.2 --";
19.544 -"----------- script [EqSystem,top_down_substitution,2x2] Vers.2 --";
19.545 -val str =
19.546 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.547 -\ (let es__ = Take es_; \
19.548 -\ e1__ = hd es__\
19.549 -\ in ([]))"
19.550 -;
19.551 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.552 -val str =
19.553 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.554 -\ (let es__ = Take es_; \
19.555 -\ e1__ = hd es__; \
19.556 -\ e2__ = hd (tl es__)\
19.557 -\ in ([]))"
19.558 -;
19.559 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.560 -val str =
19.561 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.562 -\ (let es__ = Take es_; \
19.563 -\ e1__ = hd es__; \
19.564 -\ e2__ = hd (tl es__);\
19.565 -\ es__ = [1=2,3=4]\
19.566 -\ in ([]))"
19.567 -;
19.568 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.569 -val str =
19.570 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.571 -\ (let es__ = Take es_; \
19.572 -\ e1__ = hd es__; \
19.573 -\ e2__ = hd (tl es__);\
19.574 -\ es__ = [e1__,e2__]\
19.575 -\ in ([]))"
19.576 -;
19.577 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.578 -val str =
19.579 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.580 -\ (let es__ = Take es_; \
19.581 -\ e1__ = hd es__; \
19.582 -\ e2__ = hd (tl es__);\
19.583 -\ es__ = [e1__, Substitute [e1__] e2__];\
19.584 -\ es__ = (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.585 -\ simplify_System False)) es__ \
19.586 -\ in ([]))"
19.587 -;
19.588 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.589 -val str =
19.590 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.591 -\ (let es__ = Take es_; \
19.592 -\ e1__ = hd es__; \
19.593 -\ e2__ = hd (tl es__);\
19.594 -\ es__ = [e1__, Substitute [e1__] e2__];\
19.595 -\ es__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.596 -\ isolate_bdvs False)) @@ \
19.597 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.598 -\ simplify_System False))) es__ \
19.599 -\ in ([]))"
19.600 -;
19.601 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.602 -val str =
19.603 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.604 -\ (let es__ = Take es_; \
19.605 -\ e1__ = hd es__; \
19.606 -\ e2__ = hd (tl es__);\
19.607 -\ es__ = [e1__, Substitute [e1__] e2__];\
19.608 -\ es__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.609 -\ simplify_System_parenthesized False)) @@ \
19.610 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.611 -\ isolate_bdvs False)) @@ \
19.612 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.613 -\ simplify_System False))) es__ \
19.614 -\ in ([]))"
19.615 -;
19.616 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.617 -val str =
19.618 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.619 -\ (let es__ = Take es_; \
19.620 -\ e1__ = hd es__; \
19.621 -\ e2__ = hd (tl es__); \
19.622 -\ es__ = [e1__, Substitute [e1__] e2__]; \
19.623 -\ es__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.624 -\ simplify_System_parenthesized False)) @@ \
19.625 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.626 -\ isolate_bdvs False)) @@ \
19.627 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.628 -\ simplify_System False))) es__ \
19.629 -\ in es__)"
19.630 -;
19.631 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.632 -val str =
19.633 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.634 -\ (let es__ = Take es_; \
19.635 -\ e1__ = hd es__; \
19.636 -\ e2__ = hd (tl es__); \
19.637 -\ es__ = [e1__, Substitute [e1__] e2__] \
19.638 -\ in ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.639 -\ simplify_System_parenthesized False)) @@ \
19.640 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))] \
19.641 -\ isolate_bdvs False)) @@ \
19.642 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.643 -\ simplify_System False))) es__)"
19.644 -;
19.645 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.646 -(*---^^^-OK-----------------------------------------------------------------*)
19.647 -val str =
19.648 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.649 -\ (let es__ = Take es_; \
19.650 -\ e1__ = hd es__; \
19.651 -\ e2__ = hd (tl es__); \
19.652 -\ es__ = [e1__, Substitute [e1__] e2__] "^
19.653 -(* this ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ is a script-'Expr'
19.654 - which is not yet searched for 'STac's; thus this script does not yet work*)
19.655 -" in ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.656 -\ simplify_System_parenthesized False)) @@ \
19.657 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))] \
19.658 -\ isolate_bdvs False)) @@ \
19.659 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.660 -\ simplify_System False))) es__)"
19.661 -;
19.662 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.663 -(*---vvv-NOT ok-------------------------------------------------------------*)
19.664 -atomty sc;
19.665 -
19.666 -
19.667 -"----------- refine [linear,system]-------------------------------";
19.668 -"----------- refine [linear,system]-------------------------------";
19.669 -"----------- refine [linear,system]-------------------------------";
19.670 -val fmz = ["equalities [0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2,\
19.671 - \0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2]",
19.672 - "solveForVars [c, c_2]", "solution L"];
19.673 -val matches = refine fmz ["linear","system"];
19.674 -case matches of [_,_,_,
19.675 - Matches (["normalize", "2x2", "linear", "system"],
19.676 - {Find = [Correct "solution L"],
19.677 - With = [],
19.678 - Given =
19.679 - [Correct
19.680 - "equalities\n [0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2,\n 0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2]",
19.681 - Correct "solveForVars [c, c_2]"],
19.682 - Where = [],
19.683 - Relate = []})] => ()
19.684 - | _ => raise error "eqsystem.sml refine ['normalize','2x2'...]";
19.685 -
19.686 -
19.687 -val fmz = ["equalities [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]",
19.688 - "solveForVars [c, c_2]", "solution L"];
19.689 -val matches = refine fmz ["linear","system"];
19.690 -case matches of [_,_,
19.691 - Matches
19.692 - (["triangular", "2x2", "linear", "system"],
19.693 - {Find = [Correct "solution L"],
19.694 - With = [],
19.695 - Given =
19.696 - [Correct
19.697 - "equalities [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]",
19.698 - Correct "solveForVars [c, c_2]"],
19.699 - Where =
19.700 - [Correct
19.701 - "tl [c, c_2] from_ [c, c_2] occur_exactly_in nth_ 1\n [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]",
19.702 - Correct
19.703 - "[c, c_2] from_ [c, c_2] occur_exactly_in nth_ 2\n [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]"],
19.704 - Relate = []})] => ()
19.705 - | _ => raise error "eqsystem.sml refine ['triangular','2x2'...]";
19.706 -
19.707 -
19.708 -(*WN051014----------------------------------------------------------------
19.709 - the above 'val matches = refine fmz ["linear","system"]'
19.710 - didn't work anymore; we investigated in these steps:*)
19.711 -val fmz = ["equalities [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]",
19.712 - "solveForVars [c, c_2]", "solution L"];
19.713 -val matches = refine fmz ["triangular", "2x2", "linear","system"];
19.714 -(*... resulted in
19.715 - False "[c, c_2] from_ [c, c_2] occur_exactly_in nth_ 2\n
19.716 - [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]"]*)
19.717 -
19.718 -val t = str2term"[c, c_2] from_ [c, c_2] occur_exactly_in nth_ 2\
19.719 - \[c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]";
19.720 -trace_rewrite:=true;
19.721 -val SOME (t',_) = rewrite_set_ thy false prls_triangular t;
19.722 -(*found:...
19.723 -## try thm: nth_Cons_
19.724 -### eval asms: 1 < 2 + - 1
19.725 -==> nth_ (2 + - 1) [L * c + c_2 = q_0 * L ^^^ 2 / 2] =
19.726 - nth_ (2 + - 1 + - 1) []
19.727 -#### rls: erls_prls_triangular on: 1 < 2 + - 1
19.728 -##### try calc: op <'
19.729 -### asms accepted: ["1 < 2 + - 1"] stored: ["1 < 2 + -1"]
19.730 -
19.731 -... i.e Calc ("op +", eval_binop "#add_") was missing in erls_prls_triangular*)
19.732 -trace_rewrite:=false;
19.733 -(*WN051014------------------------------------------------------------------*)
19.734 -
19.735 -"----- relaxed preconditions for triangular system";
19.736 -val fmz = ["equalities [L * q_0 = c, \
19.737 - \ 0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2,\
19.738 - \ 0 = c_4, \
19.739 - \ 0 = c_3]",
19.740 - "solveForVars [c, c_2, c_3, c_4]", "solution L"];
19.741 -val matches = refine fmz ["linear","system"];
19.742 -(* trace_rewrite := true;
19.743 - trace_rewrite := false;
19.744 - *)
19.745 -(*print_depth 6; matches; print_depth 3;*)
19.746 -case matches of
19.747 - [Matches (["linear", "system"], _),
19.748 - NoMatch (["2x2", "linear", "system"], _),
19.749 - NoMatch (["3x3", "linear", "system"], _),
19.750 - Matches (["4x4", "linear", "system"], _),
19.751 - NoMatch (["triangular", "4x4", "linear", "system"], _),
19.752 - Matches (["normalize", "4x4", "linear", "system"], _)] => ()
19.753 - | _ => raise error "eqsystem.sml: refine relaxed triangular sys NoMatch";
19.754 -(*WN060914 does NOT match, because 3rd and 4th equ are not ordered*)
19.755 -
19.756 -val fmz = ["equalities [L * q_0 = c, \
19.757 - \ 0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2,\
19.758 - \ 0 = c_3, \
19.759 - \ 0 = c_4]",
19.760 - "solveForVars [c, c_2, c_3, c_4]", "solution L"];
19.761 -val matches = refine fmz ["triangular", "4x4", "linear","system"];
19.762 -(* print_depth 11; matches; print_depth 3;
19.763 - *)
19.764 -case matches of
19.765 - [Matches (["triangular", "4x4", "linear", "system"], _)] => ()
19.766 - | _ => raise error "eqsystem.sml: refine relaxed triangular sys Matches";
19.767 -val matches = refine fmz ["linear","system"];
19.768 -
19.769 -
19.770 -"----------- refine [2x2,linear,system] search error--------------";
19.771 -"----------- refine [2x2,linear,system] search error--------------";
19.772 -"----------- refine [2x2,linear,system] search error--------------";
19.773 -(*didn't go into ["2x2", "linear", "system"];
19.774 - we investigated in these steps:*)
19.775 -val fmz = ["equalities [0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2,\
19.776 - \0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2]",
19.777 - "solveForVars [c, c_2]", "solution L"];
19.778 -trace_rewrite:=true;
19.779 -val matches = refine fmz ["2x2", "linear","system"];
19.780 -trace_rewrite:=false;
19.781 -print_depth 11; matches; print_depth 3;
19.782 -(*brought: 'False "length_ es_ = 2"'*)
19.783 -
19.784 -(*-----fun refin' (pblRD:pblRD) fmz pbls ((Ptyp (pI,[py],[])):pbt ptyp) =
19.785 -(* val ((pblRD:pblRD), fmz, pbls, ((Ptyp (pI,[py],[])):pbt ptyp)) =
19.786 - (rev ["linear","system"], fmz, [(*match list*)],
19.787 - ((Ptyp ("2x2",[get_pbt ["2x2","linear","system"]],[])):pbt ptyp));
19.788 - *)
19.789 -> show_types:=true; term2str (hd where_); show_types:=false;
19.790 -val it = "length_ (es_::real list) = (2::real)" : string
19.791 -
19.792 -=========================================================================\
19.793 --------fun prep_pbt
19.794 -(* val (thy, (pblID, dsc_dats: (string * (string list)) list,
19.795 - ev:rls, ca: string option, metIDs:metID list)) =
19.796 - (EqSystem.thy, (["system"],
19.797 - [("#Given" ,["equalities es_", "solveForVars vs_"]),
19.798 - ("#Find" ,["solution ss___"](*___ is copy-named*))
19.799 - ],
19.800 - append_rls "e_rls" e_rls [(*for preds in where_*)],
19.801 - SOME "solveSystem es_ vs_",
19.802 - []));
19.803 - *)
19.804 -> val [("#Given", [equalities_es_, "solveForVars vs_"])] = gi;
19.805 -val equalities_es_ = "equalities es_" : string
19.806 -> val (dd, ii) = (split_did o term_of o the o (parse thy)) equalities_es_;
19.807 -> show_types:=true; term2str ii; show_types:=false;
19.808 -val it = "es_::bool list" : string
19.809 -~~~~~~~~~~~~~~~^^^^^^^^^ OK~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19.810 -
19.811 -> val {where_,...} = get_pbt ["2x2", "linear","system"];
19.812 -> show_types:=true; term2str (hd where_); show_types:=false;
19.813 -
19.814 -=========================================================================/
19.815 -
19.816 -
19.817 -
19.818 ------fun refin' ff:
19.819 -> (writeln o (itms2str_ (thy2ctxt "Isac"))) itms;
19.820 -[
19.821 -(1 ,[1] ,true ,#Given ,Cor equalities
19.822 - [0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2,
19.823 - 0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2] ,(es_, [[0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2,
19.824 - 0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2]])),
19.825 -(2 ,[1] ,true ,#Given ,Cor solveForVars [c, c_2] ,(vs_, [[c, c_2]])),
19.826 -(3 ,[1] ,true ,#Find ,Cor solution L ,(ss___, [L]))]
19.827 -
19.828 -> (writeln o pres2str) pre';
19.829 -[
19.830 -(false, length_ es_ = 2),
19.831 -(true, length_ [c, c_2] = 2)]
19.832 -
19.833 ------ fun match_oris':
19.834 -> (writeln o (itms2str_ (thy2ctxt "Isac"))) itms;
19.835 -> (writeln o pres2str) pre';
19.836 -..as in refin'
19.837 -
19.838 ------ fun check_preconds'
19.839 -> (writeln o env2str) env;
19.840 -["
19.841 -(es_, [0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2,
19.842 - 0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2])","
19.843 -(vs_, [c, c_2])","
19.844 -(ss___, L)"]
19.845 -
19.846 -> val es_ = (fst o hd) env;
19.847 -val es_ = Free ("es_", "bool List.list") : Term.term
19.848 -
19.849 -> val pre1 = hd pres;
19.850 -atomty pre1;
19.851 -***
19.852 -*** Const (op =, [real, real] => bool)
19.853 -*** . Const (ListG.length_, real list => real)
19.854 -*** . . Free (es_, real list)
19.855 -~~~~~~~~~~~~~~~~~~~^^^^^^^^^ should be bool list~~~~~~~~~~~~~~~~~~~
19.856 -*** . Free (2, real)
19.857 -***
19.858 -
19.859 -THE REASON WAS A non-type-constrained variable IN #WHERE OF PROBLEM
19.860 -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19.861 -*)
19.862 -
19.863 -
19.864 -"----------- me [EqSystem,normalize,2x2] -------------------------";
19.865 -"----------- me [EqSystem,normalize,2x2] -------------------------";
19.866 -"----------- me [EqSystem,normalize,2x2] -------------------------";
19.867 -val fmz = ["equalities [0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2,\
19.868 - \0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2]",
19.869 - "solveForVars [c, c_2]", "solution L"];
19.870 -val (dI',pI',mI') =
19.871 - ("Biegelinie.thy",["normalize", "2x2", "linear", "system"],
19.872 - ["EqSystem","normalize","2x2"]);
19.873 -val p = e_pos'; val c = [];
19.874 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
19.875 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.876 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.877 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.878 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.879 -case nxt of ("Specify_Method",_) => ()
19.880 - | _ => raise error "eqsystem.sml [EqSystem,normalize,2x2] specify";
19.881 -
19.882 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.883 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.884 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f(*["(bdv_1, c)", "(bdv_2, hd (tl [c, c_2] ... corrected srls; ran only AFTER use"RCODE-root.sml", store_met was NOT SUFFICIENT*);
19.885 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.886 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.887 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.888 -case nxt of
19.889 - (_, Subproblem ("Biegelinie.thy", ["triangular", "2x2", "linear",_])) => ()
19.890 - | _ => raise error "eqsystem.sml me [EqSystem,normalize,2x2] SubProblem";
19.891 -
19.892 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.893 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.894 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.895 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.896 -case nxt of
19.897 - (_, Specify_Method ["EqSystem", "top_down_substitution", "2x2"]) => ()
19.898 - | _ => raise error "eqsystem.sml me [EqSys...2x2] top_down_substitution";
19.899 -
19.900 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.901 -val PblObj {probl,...} = get_obj I pt [5];
19.902 - (writeln o (itms2str_ (thy2ctxt "Isac"))) probl;
19.903 -(*[
19.904 -(1 ,[1] ,true ,#Given ,Cor equalities [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2] ,(es_, [[c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]])),
19.905 -(2 ,[1] ,true ,#Given ,Cor solveForVars [c, c_2] ,(vs_, [[c, c_2]])),
19.906 -(3 ,[1] ,true ,#Find ,Cor solution ss___ ,(ss___, [ss___]))]
19.907 -*)
19.908 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.909 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.910 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.911 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.912 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.913 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.914 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.915 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.916 -case nxt of
19.917 - (_, Check_Postcond ["triangular", "2x2", "linear", "system"]) => ()
19.918 - | _ => raise error "eqsystem.sml me Subpbl .[EqSys...2x2] finished";
19.919 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.920 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.921 -if f2str f = "[c = L * q_0 / 2, c_2 = 0]" then ()
19.922 -else raise error "eqsystem.sml me [EqSys...2x2] finished f2str f";
19.923 -case nxt of
19.924 - (_, End_Proof') => ()
19.925 - | _ => raise error "eqsystem.sml me [EqSys...2x2] finished End_Proof'";
19.926 -
19.927 -
19.928 -"----------- me [linear,system] ..normalize..top_down_sub..-------";
19.929 -"----------- me [linear,system] ..normalize..top_down_sub..-------";
19.930 -"----------- me [linear,system] ..normalize..top_down_sub..-------";
19.931 -val fmz =
19.932 - ["equalities\
19.933 - \[0 = c_2 + c * 0 + 1 / EI * (L * q_0 / 12 * 0 ^^^ 3 + \
19.934 - \ -1 * q_0 / 24 * 0 ^^^ 4),\
19.935 - \ 0 = c_2 + c * L + 1 / EI * (L * q_0 / 12 * L ^^^ 3 + \
19.936 - \ -1 * q_0 / 24 * L ^^^ 4)]",
19.937 - "solveForVars [c, c_2]", "solution L"];
19.938 -val (dI',pI',mI') =
19.939 - ("Biegelinie.thy",["linear", "system"], ["no_met"]);
19.940 -val p = e_pos'; val c = [];
19.941 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
19.942 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.943 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.944 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.945 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.946 -case nxt of (_,Specify_Method ["EqSystem", "normalize", "2x2"]) => ()
19.947 - | _ => raise error "eqsystem.sml [linear,system] specify b";
19.948 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.949 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.950 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.951 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.952 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.953 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.954 -if f2str f =
19.955 -"[c_2 = 0, L * c + c_2 = -1 * q_0 * L ^^^ 4 / (24 * EI)]"
19.956 -then () else raise error "eqsystem.sml me simpl. before SubProblem b";
19.957 -case nxt of
19.958 - (_, Subproblem ("Biegelinie.thy", ["triangular", "2x2", "linear",_])) => ()
19.959 - | _ => raise error "eqsystem.sml me [linear,system] SubProblem b";
19.960 -
19.961 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.962 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.963 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.964 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.965 -case nxt of
19.966 - (_, Specify_Method ["EqSystem", "top_down_substitution", "2x2"]) => ()
19.967 - | _ => raise error "eqsystem.sml me [EqSys...2x2] top_down_substitution b";
19.968 -
19.969 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.970 -val PblObj {probl,...} = get_obj I pt [5];
19.971 - (writeln o (itms2str_ (thy2ctxt "Isac"))) probl;
19.972 -(*[
19.973 -(1 ,[1] ,true ,#Given ,Cor equalities [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2] ,(es_, [[c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]])),
19.974 -(2 ,[1] ,true ,#Given ,Cor solveForVars [c, c_2] ,(vs_, [[c, c_2]])),
19.975 -(3 ,[1] ,true ,#Find ,Cor solution ss___ ,(ss___, [ss___]))]
19.976 -*)
19.977 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.978 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.979 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.980 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.981 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.982 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.983 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.984 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.985 -case nxt of
19.986 - (_, Check_Postcond ["triangular", "2x2", "linear", "system"]) => ()
19.987 - | _ => raise error "eqsystem.sml me Subpbl .[EqSys...2x2] finished b";
19.988 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.989 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
19.990 -if f2str f =
19.991 -"[c = -1 * q_0 * L ^^^ 4 / (24 * EI * L), c_2 = 0]"
19.992 -then () else raise error "eqsystem.sml me [EqSys...2x2] finished f2str f b";
19.993 -case nxt of
19.994 - (_, End_Proof') => ()
19.995 - | _ => raise error "eqsystem.sml me [EqSys...2x2] finished End_Proof'" b;
19.996 -
19.997 -
19.998 -"----------- all systems from Biegelinie -------------------------";
19.999 -"----------- all systems from Biegelinie -------------------------";
19.1000 -"----------- all systems from Biegelinie -------------------------";
19.1001 -val subst = [(str2term "bdv_1", str2term "c"),
19.1002 - (str2term "bdv_2", str2term "c_2"),
19.1003 - (str2term "bdv_3", str2term "c_3"),
19.1004 - (str2term "bdv_4", str2term "c_4")];
19.1005 -"------- Bsp 7.27";
19.1006 -states:=[];
19.1007 -CalcTree [(["Traegerlaenge L","Streckenlast q_0","Biegelinie y",
19.1008 - "Randbedingungen [y 0 = 0, y L = 0, M_b 0 = 0, M_b L = 0]",
19.1009 - "FunktionsVariable x"],
19.1010 - ("Biegelinie.thy", ["Biegelinien"],
19.1011 - ["IntegrierenUndKonstanteBestimmen2"]))];
19.1012 -moveActiveRoot 1;
19.1013 -(*
19.1014 -trace_script := true; autoCalculate 1 CompleteCalc; trace_script := false;
19.1015 -##7.27## ordered substs
19.1016 - c_4 c_2
19.1017 -c c_2 c_3 c_4 c c_2 1->2: c
19.1018 - c_2 c_4
19.1019 -c c_2 c c_2 c_3 c_4 [2':c, 1:c_2, 3:c_4] -> 4:c_3*)
19.1020 -val t = str2term"[0 = c_4, \
19.1021 -\ 0 = c_4 + L * c_3 +(12 * L ^^^ 2 * c_2 + 4 * L ^^^ 3 * c + -1 * L ^^^ 4 * q_0) / (-24 * EI), \
19.1022 -\ 0 = c_2, \
19.1023 -\ 0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2]";
19.1024 -val SOME (t',_) = rewrite_set_ thy false isolate_bdvs_4x4 t;
19.1025 -term2str t';
19.1026 -"[c_4 = 0,\n (12 * L ^^^ 2 * c_2 + 4 * L ^^^ 3 * c + -1 * L ^^^ 4 * q_0) / (-24 * EI) =\n 0 + -1 * (c_4 + L * c_3),\n c_2 = 0, (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2 = 0]";
19.1027 -
19.1028 -
19.1029 -"----- 7.27 go through the rewrites in met_eqsys_norm_4x4";
19.1030 -val t = str2term "0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2";
19.1031 -val NONE = rewrite_set_ thy false norm_Rational t;
19.1032 -val SOME (t,_) =
19.1033 - rewrite_set_inst_ thy false subst simplify_System_parenthesized t;
19.1034 -term2str t = "0 = -1 * q_0 * L ^^^ 2 / 2 + (L * c + c_2)";
19.1035 -"--- isolate_bdvs_4x4";
19.1036 -(*
19.1037 -val SOME (t,_) = rewrite_set_inst_ thy false subst isolate_bdvs_4x4 t;
19.1038 -term2str t;
19.1039 -val SOME (t,_) = rewrite_set_inst_ thy false subst simplify_System t;
19.1040 -term2str t;
19.1041 -val SOME (t,_) = rewrite_set_ thy false order_system t;
19.1042 -term2str t;
19.1043 -*)
19.1044 -
19.1045 -"------- Bsp 7.28 ---------------vvvvvvvvvvvvv Momentenlinie postponed";
19.1046 -states:=[];
19.1047 -CalcTree [(["Traegerlaenge L","Momentenlinie (-q_0 / L * x^3 / 6)",
19.1048 - "Biegelinie y",
19.1049 - "Randbedingungen [y L = 0, y' L = 0]",
19.1050 - "FunktionsVariable x"],
19.1051 - ("Biegelinie.thy", ["vonMomentenlinieZu","Biegelinien"],
19.1052 - ["Biegelinien", "AusMomentenlinie"]))];
19.1053 -moveActiveRoot 1;
19.1054 -(*
19.1055 -trace_script := true; autoCalculate 1 CompleteCalc; trace_script := false;
19.1056 -*)
19.1057 -
19.1058 -"------- Bsp 7.69";
19.1059 -states:=[];
19.1060 -CalcTree [(["Traegerlaenge L","Streckenlast q_0","Biegelinie y",
19.1061 - "Randbedingungen [y 0 = 0, y L = 0, y' 0 = 0, y' L = 0]",
19.1062 - "FunktionsVariable x"],
19.1063 - ("Biegelinie.thy", ["Biegelinien"],
19.1064 - ["IntegrierenUndKonstanteBestimmen2"] ))];
19.1065 -moveActiveRoot 1;
19.1066 -(*
19.1067 -trace_script := true; autoCalculate 1 CompleteCalc; trace_script := false;
19.1068 -##7.69## ordered subst 2x2
19.1069 - c_4 c_3
19.1070 -c c_2 c_3 c_4 c c_2 c_3 1:c_3 -> 2:c c_2 2: c c_2
19.1071 - c_3 c_4
19.1072 -c c_2 c_3 c c_2 c_3 c_4 3:c_4 -> 4:c c_2 c_3 1:c_3 -> 4:c c_2*)
19.1073 -val t = str2term"[0 = c_4 + 0 / (-1 * EI), \
19.1074 -\ 0 = c_4 + L * c_3 + (12 * L ^^^ 2 * c_2 + 4 * L ^^^ 3 * c + -1 * L ^^^ 4 * q_0) / (-24 * EI), \
19.1075 -\ 0 = c_3 + 0 / (-1 * EI), \
19.1076 -\ 0 = c_3 + (6 * L * c_2 + 3 * L ^^^ 2 * c + -1 * L ^^^ 3 * q_0) / (-6 * EI)]";
19.1077 -
19.1078 -"------- Bsp 7.70";
19.1079 -states:=[];
19.1080 -CalcTree [(["Traegerlaenge L","Streckenlast q_0","Biegelinie y",
19.1081 - "Randbedingungen [Q 0 = q_0 * L, M_b L = 0, y 0 = 0, y' 0 = 0]",
19.1082 - "FunktionsVariable x"],
19.1083 - ("Biegelinie.thy", ["Biegelinien"],
19.1084 - ["IntegrierenUndKonstanteBestimmen2"] ))];
19.1085 -moveActiveRoot 1;
19.1086 -(*
19.1087 -trace_script := true; autoCalculate 1 CompleteCalc; trace_script := false;
19.1088 -##7.70## |subst
19.1089 -c |
19.1090 -c c_2 |1:c -> 2:c_2
19.1091 - c_3 |
19.1092 - c_4 | GOON test methods @@@@@@@@@@@@@@@@@@@@@@@@@@@*)
19.1093 -
19.1094 -"----- 7.70 go through the rewrites in met_eqsys_norm_4x4";
19.1095 -val t = str2term"[L * q_0 = c, \
19.1096 - \ 0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2,\
19.1097 - \ 0 = c_4, \
19.1098 - \ 0 = c_3]";
19.1099 -val SOME (t,_) =
19.1100 - rewrite_ thy e_rew_ord e_rls false (num_str commute_0_equality) t;
19.1101 -val SOME (t,_) =
19.1102 - rewrite_ thy e_rew_ord e_rls false (num_str commute_0_equality) t;
19.1103 -val SOME (t,_) =
19.1104 - rewrite_ thy e_rew_ord e_rls false (num_str commute_0_equality) t;
19.1105 -term2str t =
19.1106 - "[L * q_0 = c, (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2 = 0, c_4 = 0,\n c_3 = 0]";
19.1107 -val SOME (t,_) =
19.1108 - rewrite_set_inst_ thy false subst simplify_System_parenthesized t;
19.1109 -term2str t =
19.1110 -"[L * q_0 = c, -1 * q_0 * L ^^^ 2 / 2 + (L * c + c_2) = 0, c_4 = 0, c_3 = 0]";
19.1111 -val SOME (t,_) = rewrite_set_inst_ thy false subst isolate_bdvs_4x4 t;
19.1112 -term2str t =
19.1113 - "[c = (-1 * (L * q_0) + 0) / -1,\n L * c + c_2 = -1 * (-1 * q_0 * L ^^^ 2 / 2) + 0, c_4 = 0, c_3 = 0]";
19.1114 -val SOME (t,_) =
19.1115 - rewrite_set_inst_ thy false subst simplify_System_parenthesized t;
19.1116 -
19.1117 -term2str t ="[c = L * q_0, L * c + c_2 = q_0 * L ^^^ 2 / 2, c_4 = 0, c_3 = 0]";
19.1118 -val SOME (t,_) = rewrite_set_ thy false order_system t;
19.1119 -if term2str t ="[c = L * q_0, L * c + c_2 = q_0 * L ^^^ 2 / 2, c_3 = 0, c_4 = 0]" then ()
19.1120 -else raise error "eqsystem.sml: exp 7.70 normalize 4x4 by rewrite changed";
19.1121 -
19.1122 -
19.1123 -"----- 7.70 with met normalize: ";
19.1124 -val fmz = ["equalities \
19.1125 - \[L * q_0 = c, \
19.1126 - \ 0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2,\
19.1127 - \ 0 = c_4, \
19.1128 - \ 0 = c_3]",
19.1129 - "solveForVars [c, c_2, c_3, c_4]", "solution L"];
19.1130 -val (dI',pI',mI') =
19.1131 - ("Biegelinie.thy",["linear", "system"],["no_met"]);
19.1132 -val p = e_pos'; val c = [];
19.1133 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
19.1134 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.1135 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.1136 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.1137 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.1138 -case nxt of (_,Apply_Method ["EqSystem", "normalize", "4x4"]) => ()
19.1139 - | _ => raise error "eqsystem.sml [EqSystem,normalize,4x4] specify";
19.1140 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
19.1141 -"bbbbbbbbbbbbbbbbbbbbbbbbbbbbb outcommented vvvvvvvvvvvvvvvvvvvvvv";
19.1142 -(*vvvWN080102 Exception- Match raised
19.1143 - since assod Rewrite .. Rewrite'_Set
19.1144 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
19.1145 -
19.1146 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
19.1147 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
19.1148 -
19.1149 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
19.1150 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
19.1151 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
19.1152 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
19.1153 -if f2str f ="[c = L * q_0, L * c + c_2 = q_0 * L ^^^ 2 / 2, c_3 = 0, c_4 = 0]"
19.1154 -then () else raise error "eqsystem.sml: exp 7.70 normalize 4x4 by met changed";
19.1155 ---------------------------------------------------------------------------*)
19.1156 -
19.1157 -"----- 7.70 with met top_down_: ";
19.1158 -"--- scr [EqSystem,top_down_substitution,4x4] -- a saved trial";
19.1159 -(*---vvv-this script failed with if ?!?-------------------------------------*)
19.1160 -val str =
19.1161 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.1162 -\ (let e1_ = hd es_; \
19.1163 -\ v1_ = hd vs_; \
19.1164 -\ xxx = if lhs e1_ =!= v1_ \
19.1165 -\ then 0=0 \
19.1166 -\ else let e1_ = Take e1_; \
19.1167 -\ e1_ = (Rewrite_Set_Inst [(bdv_1, hd vs_), \
19.1168 -\ (bdv_2, hd (tl vs_))] \
19.1169 -\ isolate_bdvs False) e1_; \
19.1170 -\ e2_ = Take (hd (tl es_)); \
19.1171 -\ e2_ = (Substitute [e1__]) e2_ \
19.1172 -\ in [e1_, e2_])";
19.1173 -(*val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;*)
19.1174 -val str =
19.1175 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.1176 -\ (let e1_ = hd es_; \
19.1177 -\ v1_ = hd vs_; \
19.1178 -\ e2_ = Take (hd (tl es_)); \
19.1179 -\ e2_ = (Substitute [e1__]) e2_ \
19.1180 -\ in [e1_, e2_])";
19.1181 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.1182 -(*---^^^-OK-----------------------------------------------------------------*)
19.1183 -(*---vvv-NOT ok-------------------------------------------------------------*)
19.1184 -val str =
19.1185 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.1186 -\ (let e1_ = hd es_; \
19.1187 -\ v1_ = hd vs_; \
19.1188 -\ xxx = if ((lhs e1_) =!= v1_) then 1 else 2; \
19.1189 -\ e2_ = Take (hd (tl es_)); \
19.1190 -\ e2_ = (Substitute [e1__]) e2_ \
19.1191 -\ in [e1_, e2_])";
19.1192 -(*val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;*)
19.1193 -val str = "if lhs e1_ =!= v1_ then 1 else 2";
19.1194 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.1195 -
19.1196 -val str = "let xxx = (if lhs e1_ =!= v1_ then 1 else 2) in xxx";
19.1197 -(*val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;*)
19.1198 -atomty sc; term2str sc;
19.1199 -
19.1200 -"--- scr [EqSystem,top_down_substitution,4x4] -- adapted only to 7.70";
19.1201 -val str =
19.1202 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.1203 -\ (let e2__ = Take (hd (tl es_)); \
19.1204 -\ e2__ = ((Substitute [e1__]) @@ \
19.1205 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.1206 -\ simplify_System_parenthesized False)) @@ \
19.1207 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.1208 -\ isolate_bdvs False)) @@ \
19.1209 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.1210 -\ simplify_System False))) e2__;\
19.1211 -\ es__ = Take [e1__, e2__] \
19.1212 -\ in (Try (Rewrite_Set order_system False)) es__)"
19.1213 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.1214 -val str =
19.1215 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.1216 -\ (let e2__ = Take (nth_ 2 es_); \
19.1217 -\ e2__ = ((Substitute [e1__]) @@ \
19.1218 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.1219 -\ simplify_System_parenthesized False)) @@ \
19.1220 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.1221 -\ isolate_bdvs False)) @@ \
19.1222 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
19.1223 -\ simplify_System False))) e2__;\
19.1224 -\ es__ = Take [e1__, e2__] \
19.1225 -\ in (Try (Rewrite_Set order_system False)) es__)"
19.1226 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.1227 -val str =
19.1228 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.1229 -\ (let e2__ = Take (nth_ 2 es_); \
19.1230 -\ e2__ = ((Substitute [e1__]) @@ \
19.1231 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, nth_ 2 vs_)] \
19.1232 -\ simplify_System_parenthesized False)) @@ \
19.1233 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, nth_ 2 vs_)]\
19.1234 -\ isolate_bdvs False)) @@ \
19.1235 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, nth_ 2 vs_)]\
19.1236 -\ simplify_System False))) e2__;\
19.1237 -\ es__ = Take [e1__, e2__] \
19.1238 -\ in (Try (Rewrite_Set order_system False)) es__)"
19.1239 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.1240 -val str =
19.1241 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.1242 -\ (let e2__ = Take (nth_ 2 es_); \
19.1243 -\ e2__ = ((Substitute [e1__]) @@ \
19.1244 -\ (Try (Rewrite_Set_Inst [(bdv_1,nth_ 1 vs_),(bdv_2,nth_ 2 vs_),\
19.1245 -\ (bdv_3,nth_ 3 vs_),(bdv_4,nth_ 4 vs_)]\
19.1246 -\ simplify_System_parenthesized False)) @@ \
19.1247 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, nth_ 2 vs_)] \
19.1248 -\ isolate_bdvs False)) @@ \
19.1249 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, nth_ 2 vs_)] \
19.1250 -\ norm_Rational False))) e2__; \
19.1251 -\ es__ = Take [e1__, e2__] \
19.1252 -\ in [])"
19.1253 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.1254 -val str =
19.1255 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.1256 -\ (let e2_ = Take (nth_ 2 es_); \
19.1257 -\ e2_ = ((Substitute [e1_]) @@ \
19.1258 -\ (Try (Rewrite_Set_Inst [(bdv_1,nth_ 1 vs_),(bdv_2,nth_ 2 vs_),\
19.1259 -\ (bdv_3,nth_ 3 vs_),(bdv_4,nth_ 4 vs_)]\
19.1260 -\ simplify_System_parenthesized False)) @@ \
19.1261 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, nth_ 2 vs_)] \
19.1262 -\ isolate_bdvs False)) @@ \
19.1263 -\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, nth_ 2 vs_)] \
19.1264 -\ norm_Rational False))) e2_; \
19.1265 -\ es_ = Take [e1_, e2_] \
19.1266 -\ in [e1_, e2_,e3_, e4_])"
19.1267 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.1268 -val str =
19.1269 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.1270 -\ (let e2_ = Take (nth_ 2 es_); \
19.1271 -\ e2_ = ((Substitute [e1_]) @@ \
19.1272 -\ (Try (Rewrite_Set_Inst [(bdv_1,nth_ 1 vs_),(bdv_2,nth_ 2 vs_),\
19.1273 -\ (bdv_3,nth_ 3 vs_),(bdv_4,nth_ 4 vs_)]\
19.1274 -\ simplify_System_parenthesized False)) @@ \
19.1275 -\ (Try (Rewrite_Set_Inst [(bdv_1,nth_ 1 vs_),(bdv_2,nth_ 2 vs_),\
19.1276 -\ (bdv_3,nth_ 3 vs_),(bdv_4,nth_ 4 vs_)]\
19.1277 -\ isolate_bdvs False)) @@ \
19.1278 -\ (Try (Rewrite_Set_Inst [(bdv_1,nth_ 1 vs_),(bdv_2,nth_ 2 vs_),\
19.1279 -\ (bdv_3,nth_ 3 vs_),(bdv_4,nth_ 4 vs_)]\
19.1280 -\ norm_Rational False))) e2_; \
19.1281 -\ es_ = Take [e1_, e2_] \
19.1282 -\ in [e1_, e2_,e3_, e4_])"
19.1283 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.1284 -(*---^^^-OK-----------------------------------------------------------------*)
19.1285 -val str =
19.1286 -"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
19.1287 -\ (let e2_ = Take (nth_ 2 es_); \
19.1288 -\ e2_ = ((Substitute [e1_]) @@ \
19.1289 -\ (Try (Rewrite_Set_Inst [(bdv_1,nth_ 1 vs_),(bdv_2,nth_ 2 vs_),\
19.1290 -\ (bdv_3,nth_ 3 vs_),(bdv_4,nth_ 4 vs_)]\
19.1291 -\ simplify_System_parenthesized False)) @@ \
19.1292 -\ (Try (Rewrite_Set_Inst [(bdv_1,nth_ 1 vs_),(bdv_2,nth_ 2 vs_),\
19.1293 -\ (bdv_3,nth_ 3 vs_),(bdv_4,nth_ 4 vs_)]\
19.1294 -\ isolate_bdvs False)) @@ \
19.1295 -\ (Try (Rewrite_Set_Inst [(bdv_1,nth_ 1 vs_),(bdv_2,nth_ 2 vs_),\
19.1296 -\ (bdv_3,nth_ 3 vs_),(bdv_4,nth_ 4 vs_)]\
19.1297 -\ norm_Rational False))) e2_ \
19.1298 -\ in [e1_, e2_, nth_ 3 es_, nth_ 4 es_])"
19.1299 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
19.1300 -(*---vvv-NOT ok-------------------------------------------------------------*)
19.1301 -atomty sc; term2str sc;
19.1302 -
19.1303 -
19.1304 -"----- 7.70 with met top_down_: me";
19.1305 -val fmz = ["equalities \
19.1306 - \[c = L * q_0, L * c + c_2 = q_0 * L ^^^ 2 / 2, c_3 = 0, c_4 = 0]",
19.1307 - "solveForVars [c, c_2, c_3, c_4]", "solution L"];
19.1308 -val (dI',pI',mI') =
19.1309 - ("Biegelinie.thy",["linear", "system"],["no_met"]);
19.1310 -val p = e_pos'; val c = [];
19.1311 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
19.1312 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.1313 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.1314 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.1315 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.1316 -case nxt of (_,Apply_Method ["EqSystem", "top_down_substitution", "4x4"]) => ()
19.1317 - | _ => raise error "eqsystem.sml [EqSystem,top_down_,4x4] specify";
19.1318 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
19.1319 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
19.1320 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
19.1321 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
19.1322 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
19.1323 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
19.1324 -if nxt = ("End_Proof'", End_Proof') andalso
19.1325 - f2str f = "[c = L * q_0, c_2 = -1 * L ^^^ 2 * q_0 / 2, c_3 = 0, c_4 = 0]"
19.1326 -then () else raise error "eqsystem.sml: 7.70 with met top_down_: me";
19.1327 -
19.1328 -
19.1329 -"------- Bsp 7.71";
19.1330 -states:=[];
19.1331 -CalcTree [(["Traegerlaenge L","Streckenlast q_0","Biegelinie y",
19.1332 - "Randbedingungen [M_b L = 0, y 0 = 0, y L = 0, y' 0 = 0]",
19.1333 - "FunktionsVariable x"],
19.1334 - ("Biegelinie.thy", ["Biegelinien"],
19.1335 - ["IntegrierenUndKonstanteBestimmen2"] ))];
19.1336 -moveActiveRoot 1;
19.1337 -(*
19.1338 -trace_script := true; autoCalculate 1 CompleteCalc; trace_script := false;
19.1339 -##7.71## |ordered |subst.singles (recurs) |2x2 |diagonal
19.1340 -c c_2 |c c_2 |1' |1': c c_2 |
19.1341 - c_4 | c_3 |2:c_3 -> 4' :c c_2 c_4 | |
19.1342 -c c_2 c_3 c_4 | c_4 |3' | |
19.1343 - c_3 |c c_2 c_3 c_4 |3:c_4 -> 4'':c c_2 |4'':c c_2 | *)
19.1344 -val t = str2term"[0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2, \
19.1345 -\ 0 = c_4 + 0 / (-1 * EI), \
19.1346 -\ 0 = c_4 + L * c_3 +(12 * L ^^^ 2 * c_2 + 4 * L ^^^ 3 * c + -1 * L ^^^ 4 * q_0) /(-24 * EI),\
19.1347 -\ 0 = c_3 + 0 / (-1 * EI)]";
19.1348 -
19.1349 -"------- Bsp 7.72a ---------------vvvvvvvvvvvvv Momentenlinie postponed";
19.1350 -states:=[];
19.1351 -CalcTree [(["Traegerlaenge L",
19.1352 - "Momentenlinie ((q_0 * L)/ 6 * x - q_0 /(6 * L) * x^3)",
19.1353 - "Biegelinie y",
19.1354 - "Randbedingungen [y 0 = 0, y L = 0]",
19.1355 - "FunktionsVariable x"],
19.1356 - ("Biegelinie.thy", ["vonMomentenlinieZu","Biegelinien"],
19.1357 - ["Biegelinien", "AusMomentenlinie"]))];
19.1358 -moveActiveRoot 1;
19.1359 -(*
19.1360 -trace_script := true; autoCalculate 1 CompleteCalc; trace_script := false;
19.1361 -*)
19.1362 -
19.1363 -"------- Bsp 7.72b";
19.1364 -states:=[];
19.1365 -CalcTree [(["Traegerlaenge L","Streckenlast (q_0 / L * x)","Biegelinie y",
19.1366 - "Randbedingungen [M_b 0 = 0, M_b L = 0, y 0 = 0, y L = 0]",
19.1367 - "FunktionsVariable x"],
19.1368 - ("Biegelinie.thy", ["Biegelinien"],
19.1369 - ["IntegrierenUndKonstanteBestimmen2"] ))];
19.1370 -moveActiveRoot 1;
19.1371 -(*
19.1372 -trace_script := true; autoCalculate 1 CompleteCalc; trace_script := false;
19.1373 -##7.72b## |ord. |subst.singles |ord.triang.
19.1374 - c_2 | | |c_2
19.1375 -c c_2 | |1:c_2 -> 2':c |c_2 c
19.1376 - c_4 | | |
19.1377 -c c_2 c_3 c_4 | |3:c_4 -> 4':c c_2 c_3 |c_2 c c_3*)
19.1378 -val t = str2term"[0 = c_2, \
19.1379 -\ 0 = (6 * c_2 + 6 * L * c + -1 * L ^^^ 2 * q_0) / 6, \
19.1380 -\ 0 = c_4 + 0 / (-1 * EI), \
19.1381 -\ 0 = c_4 + L * c_3 + (60 * L ^^^ 2 * c_2 + 20 * L ^^^ 3 * c + -1 * L ^^^ 4 * q_0) / (-120 * EI)]";
19.1382 -
19.1383 -"------- Bsp 7.73 ---------------vvvvvvvvvvvvv Momentenlinie postponed";
19.1384 -states:=[];
19.1385 -CalcTree [(["Traegerlaenge L","Momentenlinie ???",(*description unclear*)
19.1386 - "Biegelinie y",
19.1387 - "Randbedingungen [y L = 0, y' L = 0]",
19.1388 - "FunktionsVariable x"],
19.1389 - ("Biegelinie.thy", ["vonMomentenlinieZu","Biegelinien"],
19.1390 - ["Biegelinien", "AusMomentenlinie"]))];
19.1391 -moveActiveRoot 1;
19.1392 -(*
19.1393 -trace_script := true; autoCalculate 1 CompleteCalc; trace_script := false;
19.1394 -*)
19.1395 -
19.1396 -
19.1397 -"----------- 4x4 systems from Biegelinie -------------------------";
19.1398 -"----------- 4x4 systems from Biegelinie -------------------------";
19.1399 -"----------- 4x4 systems from Biegelinie -------------------------";
19.1400 -(*GOON replace this test with 7.70 *)
19.1401 -"----- Bsp 7.27";
19.1402 -val fmz = ["equalities \
19.1403 - \[0 = c_4, \
19.1404 - \ 0 = c_4 + L * c_3 +(12 * L ^^^ 2 * c_2 + 4 * L ^^^ 3 * c + -1 * L ^^^ 4 * q_0) / (-24 * EI), \
19.1405 - \ 0 = c_2, \
19.1406 - \ 0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2]",
19.1407 - "solveForVars [c, c_2, c_3, c_4]", "solution L"];
19.1408 -val (dI',pI',mI') =
19.1409 - ("Biegelinie.thy",["normalize", "4x4", "linear", "system"],
19.1410 - ["EqSystem","normalize","4x4"]);
19.1411 -val p = e_pos'; val c = [];
19.1412 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
19.1413 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.1414 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.1415 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.1416 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
19.1417 -"------------------------------------------- Apply_Method...";
19.1418 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
19.1419 -"[0 = c_4, \
19.1420 -\ 0 = c_4 + L * c_3 +\n (12 * L ^^^ 2 * c_2 + 4 * L ^^^ 3 * c + -1 * L ^^^ 4 * q_0) / (-24 * EI), \
19.1421 -\ 0 = c_2, \
19.1422 -\ 0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2]";
19.1423 -(*vvvWN080102 Exception- Match raised
19.1424 - since assod Rewrite .. Rewrite'_Set
19.1425 -"------------------------------------------- simplify_System_parenthesized...";
19.1426 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
19.1427 -"[0 = c_4, \
19.1428 -\ 0 = -1 * q_0 * L ^^^ 4 / (-24 * EI) + \
19.1429 -\ (4 * L ^^^ 3 * c / (-24 * EI) + \
19.1430 -\ (12 * L ^^^ 2 * c_2 / (-24 * EI) + \
19.1431 -\ (L * c_3 + c_4))), \
19.1432 -\ 0 = c_2, \
19.1433 -\ 0 = -1 * q_0 * L ^^^ 2 / 2 + (L * c + c_2)]";
19.1434 -(*? "(4 * L ^^^ 3 / (-24 * EI) * c" statt "(4 * L ^^^ 3 * c / (-24 * EI)" ?*)
19.1435 -"------------------------------------------- isolate_bdvs...";
19.1436 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
19.1437 -"[c_4 = 0,\
19.1438 -\ c_4 = 0 + -1 * (-1 * q_0 * L ^^^ 4 / (-24 * EI)) + -1 * (4 * L ^^^ 3 * c / (-24 * EI)) + -1 * (12 * L ^^^ 2 * c_2 / (-24 * EI)) + -1 * (L * c_3),\
19.1439 -\ c_2 = 0, \
19.1440 -\ c_2 = 0 + -1 * (-1 * q_0 * L ^^^ 2 / 2) + -1 * (L * c)]";
19.1441 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
19.1442 -
19.1443 ----------------------------------------------------------------------*)
19.1444 -
19.1445 -(*
19.1446 -use"../smltest/IsacKnowledge/eqsystem.sml";
19.1447 -use"eqsystem.sml";
19.1448 -*)
20.1 --- a/test/Tools/isac/IsacKnowledge/equation.sml Mon Aug 30 14:29:49 2010 +0200
20.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
20.3 @@ -1,33 +0,0 @@
20.4 -(* tests on the equation solver
20.5 - author: Walther Neuper
20.6 - 070703
20.7 - (c) due to copyright terms
20.8 -
20.9 -use"../smltest/IsacKnowledge/equation.sml";
20.10 -use"equation.sml";
20.11 -*)
20.12 -val thy = Isac.thy;
20.13 -
20.14 -"-----------------------------------------------------------------";
20.15 -"table of contents -----------------------------------------------";
20.16 -"-----------------------------------------------------------------";
20.17 -"----------- CAS input -------------------------------------------";
20.18 -"-----------------------------------------------------------------";
20.19 -"-----------------------------------------------------------------";
20.20 -"-----------------------------------------------------------------";
20.21 -
20.22 -
20.23 -"----------- CAS input -------------------------------------------";
20.24 -"----------- CAS input -------------------------------------------";
20.25 -"----------- CAS input -------------------------------------------";
20.26 -states:=[];
20.27 -CalcTree [([], ("e_domID", ["e_pblID"], ["e_metID"]))];
20.28 -Iterator 1;
20.29 -moveActiveRoot 1;
20.30 -replaceFormula 1 "solve (x+1=2, x)";
20.31 -autoCalculate 1 CompleteCalc;
20.32 -val ((pt,p),_) = get_calc 1;
20.33 -val Form res = (#1 o pt_extract) (pt, ([],Res));
20.34 -show_pt pt;
20.35 -if p = ([], Res) andalso term2str res = "[x = 1]" then ()
20.36 -else raise error "equation.sml behav.changed for CAS solve (x+1=2, x))";
21.1 --- a/test/Tools/isac/IsacKnowledge/inssort.sml Mon Aug 30 14:29:49 2010 +0200
21.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
21.3 @@ -1,138 +0,0 @@
21.4 -(* use"test-inssort.sml";
21.5 - W.N.17.6.00
21.6 -*)
21.7 -
21.8 -(* insertion sort, would need lists different from script-lists WN.11.00
21.9 -WN.7.6.03: -"- started with someList :: 'a list => unl, fun dest_list *)
21.10 -
21.11 -"--------------- sort [1,4,3,2] by rewrite_set ----------------";
21.12 -val thy' = "InsSort.thy";
21.13 -val ct = "sort [1,4,3,2]";
21.14 -"--- 1 ---";
21.15 -val rls = "ins_sort";
21.16 -val (ct,_) = the (rewrite_set thy' "eval_rls" false rls ct);
21.17 -if ct="[1, 2, 3, 4]" then "sort [1,4,3,2] OK"
21.18 -else raise error "sort [1,4,3,2] didn't work";
21.19 -
21.20 -
21.21 -"---------------- sort [1,3,2] by rewrite stepwise ----------------";
21.22 -val thy' = "InsSort.thy";
21.23 -val ct = "sort [1,3,2]";
21.24 -"--- 1 ---";
21.25 -val thm = ("sort_def","");
21.26 -val (ct,_) = the (rewrite thy' "tless_true" "eval_rls" false thm ct);
21.27 -(*val ct = "foldr ins [#1::real, #3::real, #2::real] []"*)
21.28 -"--- 2 ---";
21.29 -val thm = ("foldr_rec","");
21.30 -val (ct,_) = the (rewrite thy' "tless_true" "eval_rls" false thm ct);
21.31 -(*val ct = "foldr ins [#3, #2] (ins [] #1)"*)
21.32 -"--- 3 ---";
21.33 -val thm = ("ins_base","");
21.34 -val (ct,_) = the (rewrite thy' "tless_true" "eval_rls" false thm ct);
21.35 -(*val ct = "foldr ins [#3, #2] [#1]"*)
21.36 -"--- 4 ---";
21.37 -val thm = ("foldr_rec","");
21.38 -val (ct,_) = the (rewrite thy' "tless_true" "eval_rls" false thm ct);
21.39 -(*val ct = "foldr ins [#2] (ins [#1] #3)"*)
21.40 -"--- 5 ---";
21.41 -val thm = ("ins_rec","");
21.42 -val (ct,_) = the (rewrite thy' "tless_true" "eval_rls" false thm ct);
21.43 -(*val ct = "foldr ins [#2] (if #1 < #3 then #1 # ins [] #3 else [#3, #1])"*)
21.44 -"--- 6 ---";
21.45 -val op_ = "le";
21.46 -val (ct,_) = the (calculate thy' op_ ct);
21.47 -(*val ct = "foldr ins [#2] (if True then #1 # ins [] #3 else [#3, #1])"*)
21.48 -"--- 7 ---";
21.49 -val thm = ("if_True","");
21.50 -val (ct,_) = the (rewrite thy' "tless_true" "eval_rls" false thm ct);
21.51 -(*val ct = "foldr ins [#2] (#1 # ins [] #3)"*)
21.52 -"--- 8 ---";
21.53 -val thm = ("ins_base","");
21.54 -val (ct,_) = the (rewrite thy' "tless_true" "eval_rls" false thm ct);
21.55 -(*val ct = "foldr ins [#2] [#1, #3]"*)
21.56 -"--- 9 ---";
21.57 -val thm = ("foldr_rec","");
21.58 -val (ct,_) = the (rewrite thy' "tless_true" "eval_rls" false thm ct);
21.59 -(*val ct = "foldr ins [] (ins [#1, #3] #2)"*)
21.60 -"--- 10 ---";
21.61 -val thm = ("ins_rec","");
21.62 -val (ct,_) = the (rewrite thy' "tless_true" "eval_rls" false thm ct);
21.63 -(*val ct = "foldr ins [] (if #1 < #2 then #1 # ins [#3] #2 else [#2, #1, #3])"*)
21.64 -"--- 11 ---";
21.65 -val op_ = "le";
21.66 -val (ct,_) = the (calculate thy' op_ ct);
21.67 -(*val ct = "foldr ins [] (if True then #1 # ins [#3] #2 else [#2, #1, #3])"*)
21.68 -"--- 12 ---";
21.69 -val thm = ("if_True","");
21.70 -val (ct,_) = the (rewrite thy' "tless_true" "eval_rls" false thm ct);
21.71 -(*"foldr ins [] (#1 # ins [#3] #2)"*)
21.72 -"--- 13 ---";
21.73 -val thm = ("ins_rec","");
21.74 -val (ct,_) = the (rewrite thy' "tless_true" "eval_rls" false thm ct);
21.75 -(*"foldr ins [] (#1 # (if #3 < #2 then #3 # ins [] #2 else [#2, #3]))"*)
21.76 -"--- 14 ---";
21.77 -val op_ = "le";
21.78 -val (ct,_) = the (calculate thy' op_ ct);
21.79 -(*val ct = "foldr ins [] (#1 # (if False then #3 # ins [] #2 else [#2, #3]))"*)
21.80 -"--- 15 ---";
21.81 -val thm = ("if_False","");
21.82 -val (ct,_) = the (rewrite thy' "tless_true" "eval_rls" false thm ct);
21.83 -(*val ct = "foldr ins [] [#1, #2, #3]"*)
21.84 -"--- 16 ---";
21.85 -val thm = ("foldr_base","");
21.86 -val (ct,_) = the (rewrite thy' "tless_true" "eval_rls" false thm ct);
21.87 -(*val ct = "[#1, #2, #3]"*)
21.88 -if ct="[1, 2, 3]" then "sort [1,3,2] OK"
21.89 -else raise error "sort [1,3,2] didn't work";
21.90 -
21.91 -
21.92 -"---------------- sort [1,3,2] from script ----------------";
21.93 -val fmz = ["unsorted [1,3,2]", "sorted S"];
21.94 -val (dI',pI',mI') =
21.95 - ("InsSort.thy", ["inssort","functional"], ("InsSort.thy","inssort"));
21.96 -val p = e_pos'; val c = [];
21.97 -
21.98 -
21.99 -
21.100 -(* ------- 17.6.00: mit kleinen problemen aufgegeben
21.101 -val scr=Script ((term_of o the o (parse thy))
21.102 - "Script Sort (u_::'a list) = \
21.103 - \ Rewrite_Set ins_sort False u_");
21.104 -
21.105 -val scr=Script ((term_of o the o (parse thy))
21.106 - "Script Ins_sort (u_::real list) = \
21.107 - \ (let u_ = Rewrite sort_def False u_; \
21.108 - \ u_ = Rewrite foldr_rec False u_; \
21.109 - \ u_ = Rewrite ins_base False u_; \
21.110 - \ u_ = Rewrite foldr_rec False u_; \
21.111 - \ u_ = Rewrite ins_rec False u_; \
21.112 - \ u_ = Calculate le u_; \
21.113 - \ u_ = Rewrite if_True False u_; \
21.114 - \ u_ = Rewrite ins_base False u_; \
21.115 - \ u_ = Rewrite foldr_rec False u_; \
21.116 - \ u_ = Rewrite ins_rec False u_; \
21.117 - \ u_ = Calculate le u_; \
21.118 - \ u_ = Rewrite if_True False u_; \
21.119 - \ u_ = Rewrite ins_rec False u_; \
21.120 - \ u_ = Calculate le u_; \
21.121 - \ u_ = Rewrite if_False False u_; \
21.122 - \ u_ = Rewrite foldr_base False u_ \
21.123 - \ in u_)");
21.124 -val scr=parse thy
21.125 - "Script Ins_sort (u_::real list) = \
21.126 - \ (let u_ = Rewrite sort_def False u_; \
21.127 - \ u_ = Rewrite foldr_rec False u_; \
21.128 - \ u_ = Rewrite ins_base False u_; \
21.129 - \ u_ = Rewrite foldr_rec False u_; \
21.130 - \ u_ = Rewrite ins_rec False u_; \
21.131 - \ u_ = Calculate le u_; \
21.132 - \ u_ = Rewrite if_True False u_; \
21.133 - \ u_ = Rewrite ins_base False u_; \
21.134 - \ u_ = Rewrite foldr_rec False u_; \
21.135 - \ u_ = Rewrite ins_rec False u_; \
21.136 - \ u_ = u_ \
21.137 - \ in u_)";
21.138 -
21.139 -atomty (term_of (the scr));
21.140 -
21.141 -------- *)
21.142 \ No newline at end of file
22.1 --- a/test/Tools/isac/IsacKnowledge/integrate.sml Mon Aug 30 14:29:49 2010 +0200
22.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
22.3 @@ -1,579 +0,0 @@
22.4 -(* tests on integration over the reals
22.5 - author: Walther Neuper
22.6 - 050814, 08:51
22.7 - (c) due to copyright terms
22.8 -
22.9 -use"../smltest/IsacKnowledge/integrate.sml";
22.10 -use"integrate.sml";
22.11 -*)
22.12 -val thy = Integrate.thy;
22.13 -
22.14 -"-----------------------------------------------------------------";
22.15 -"table of contents -----------------------------------------------";
22.16 -"-----------------------------------------------------------------";
22.17 -"----------- parsing ---------------------------------------------";
22.18 -"----------- integrate by rewriting ------------------------------";
22.19 -"----------- test add_new_c, is_f_x ------------------------------";
22.20 -"----------- simplify by ruleset reducing make_ratpoly_in --------";
22.21 -"----------- simplify by ruleset extending make_polynomial_in ----";
22.22 -"----------- integrate by ruleset --------------------------------";
22.23 -"----------- rewrite 3rd integration in 7.27 ---------------------";
22.24 -"----------- check probem type -----------------------------------";
22.25 -"----------- check Scripts ---------------------------------------";
22.26 -"----------- me method [diff,integration] ------------------------";
22.27 -"----------- me method [diff,integration,named] ------------------";
22.28 -"----------- me method [diff,integration,named] Biegelinie.Q -----";
22.29 -"----------- interSteps [diff,integration] -----------------------";
22.30 -"----------- method analog to rls 'integration' ------------------";
22.31 -"----------- Ambiguous input: Integral ?u + ?v D ?bdv = ..--------";
22.32 -"----------- CAS input -------------------------------------------";
22.33 -"-----------------------------------------------------------------";
22.34 -"-----------------------------------------------------------------";
22.35 -"-----------------------------------------------------------------";
22.36 -
22.37 -
22.38 -
22.39 -"----------- parsing ---------------------------------------------";
22.40 -"----------- parsing ---------------------------------------------";
22.41 -"----------- parsing ---------------------------------------------";
22.42 -fun str2term str = (term_of o the o (parse Integrate.thy)) str;
22.43 -fun term2s t = Syntax.string_of_term (thy2ctxt' "Integrate") t;
22.44 -
22.45 -val t = str2term "Integral x D x";
22.46 -val t = str2term "Integral x^^^2 D x";
22.47 -atomty t;
22.48 -
22.49 -val t = str2term "ff x is_f_x";
22.50 -case t of Const ("Integrate.is'_f'_x", _) $ _ => ()
22.51 - | _ => raise error "integrate.sml: parsing: ff x is_f_x";
22.52 -
22.53 -
22.54 -"----------- integrate by rewriting ------------------------------";
22.55 -"----------- integrate by rewriting ------------------------------";
22.56 -"----------- integrate by rewriting ------------------------------";
22.57 -val conditions_in_integration_rules =
22.58 -Rls {id="conditions_in_integration_rules",
22.59 - preconds = [],
22.60 - rew_ord = ("termlessI",termlessI),
22.61 - erls = Erls,
22.62 - srls = Erls, calc = [],
22.63 - rules = [(*for rewriting conditions in Thm's*)
22.64 - Calc ("Atools.occurs'_in",
22.65 - eval_occurs_in "#occurs_in_"),
22.66 - Thm ("not_true",num_str not_true),
22.67 - Thm ("not_false",not_false)
22.68 - ],
22.69 - scr = EmptyScr};
22.70 -val subs = [(str2term "bdv", str2term "x")];
22.71 -fun rewrit thm str =
22.72 - fst (the (rewrite_inst_ Integrate.thy tless_true
22.73 - conditions_in_integration_rules
22.74 - true subs thm str));
22.75 -val str = rewrit integral_const (str2term "Integral 1 D x"); term2s str;
22.76 -val str = rewrit integral_const (str2term "Integral M'/EJ D x"); term2s str;
22.77 -val str = (rewrit integral_const (str2term "Integral x D x"))
22.78 - handle OPTION => str2term "no_rewrite";
22.79 -
22.80 -val str = rewrit integral_var (str2term "Integral x D x"); term2s str;
22.81 -val str = (rewrit integral_var (str2term "Integral a D x"))
22.82 - handle OPTION => str2term "no_rewrite";
22.83 -
22.84 -val str = rewrit integral_add (str2term "Integral x + 1 D x"); term2s str;
22.85 -
22.86 -val str = rewrit integral_mult (str2term "Integral M'/EJ * x^^^3 D x");term2s str;
22.87 -val str = (rewrit integral_mult (str2term "Integral x * x D x"))
22.88 - handle OPTION => str2term "no_rewrite";
22.89 -
22.90 -val str = rewrit integral_pow (str2term "Integral x^^^3 D x"); term2s str;
22.91 -
22.92 -
22.93 -"----------- test add_new_c, is_f_x ------------------------------";
22.94 -"----------- test add_new_c, is_f_x ------------------------------";
22.95 -"----------- test add_new_c, is_f_x ------------------------------";
22.96 -val term = str2term "x^^^2*c + c_2";
22.97 -val cc = new_c term;
22.98 -if term2str cc = "c_3" then () else raise error "integrate.sml: new_c ???";
22.99 -
22.100 -val SOME (id,t') = eval_add_new_c "" "Integrate.add'_new'_c" term thy;
22.101 -if term2str t' = "x ^^^ 2 * c + c_2 = x ^^^ 2 * c + c_2 + c_3" then ()
22.102 -else raise error "intergrate.sml: diff. eval_add_new_c";
22.103 -
22.104 -val cc = ("Integrate.add'_new'_c", eval_add_new_c "add_new_c_");
22.105 -val SOME (thmstr, thm) = get_calculation1_ thy cc term;
22.106 -
22.107 -val SOME (t',_) = rewrite_set_ thy true add_new_c term;
22.108 -if term2str t' = "x ^^^ 2 * c + c_2 + c_3" then ()
22.109 -else raise error "intergrate.sml: diff. rewrite_set add_new_c 1";
22.110 -
22.111 -val term = str2term "ff x = x^^^2*c + c_2";
22.112 -val SOME (t',_) = rewrite_set_ thy true add_new_c term;
22.113 -if term2str t' = "ff x = x ^^^ 2 * c + c_2 + c_3" then ()
22.114 -else raise error "intergrate.sml: diff. rewrite_set add_new_c 2";
22.115 -
22.116 -
22.117 -(*WN080222 replace call_new_c with add_new_c----------------------
22.118 -val term = str2term "new_c (c * x^^^2 + c_2)";
22.119 -val SOME (_,t') = eval_new_c 0 0 term 0;
22.120 -if term2s t' = "new_c c * x ^^^ 2 + c_2 = c_3" then ()
22.121 -else raise error "integrate.sml: eval_new_c ???";
22.122 -
22.123 -val t = str2term "matches (?u + new_c ?v) (x ^^^ 2 / 2)";
22.124 -val SOME (_,t') = eval_matches "" "Tools.matches" t thy; term2s t';
22.125 -if term2s t' = "matches (?u + new_c ?v) (x ^^^ 2 / 2) = False" then ()
22.126 -else raise error "integrate.sml: matches new_c = False";
22.127 -
22.128 -val t = str2term "matches (?u + new_c ?v) (x ^^^ 2 / 2 + new_c x ^^^ 2 / 2)";
22.129 -val SOME (_,t') = eval_matches "" "Tools.matches" t thy; term2s t';
22.130 -if term2s t'="matches (?u + new_c ?v) (x ^^^ 2 / 2 + new_c x ^^^ 2 / 2) = True"
22.131 -then () else raise error "integrate.sml: matches new_c = True";
22.132 -
22.133 -val t = str2term "ff x is_f_x";
22.134 -val SOME (_,t') = eval_is_f_x "" "" t thy; term2s t';
22.135 -if term2s t' = "(ff x is_f_x) = True" then ()
22.136 -else raise error "integrate.sml: eval_is_f_x --> true";
22.137 -
22.138 -val t = str2term "q_0/2 * L * x is_f_x";
22.139 -val SOME (_,t') = eval_is_f_x "" "" t thy; term2s t';
22.140 -if term2s t' = "(q_0 / 2 * L * x is_f_x) = False" then ()
22.141 -else raise error "integrate.sml: eval_is_f_x --> false";
22.142 -
22.143 -val conditions_in_integration =
22.144 -Rls {id="conditions_in_integration",
22.145 - preconds = [],
22.146 - rew_ord = ("termlessI",termlessI),
22.147 - erls = Erls,
22.148 - srls = Erls, calc = [],
22.149 - rules = [Calc ("Tools.matches",eval_matches ""),
22.150 - Calc ("Integrate.is'_f'_x",
22.151 - eval_is_f_x "is_f_x_"),
22.152 - Thm ("not_true",num_str not_true),
22.153 - Thm ("not_false",num_str not_false)
22.154 - ],
22.155 - scr = EmptyScr};
22.156 -fun rewrit thm t =
22.157 - fst (the (rewrite_inst_ Integrate.thy tless_true
22.158 - conditions_in_integration true subs thm t));
22.159 -val t = rewrit call_for_new_c (str2term "x ^^^ 2 / 2"); term2s t;
22.160 -val t = (rewrit call_for_new_c t)
22.161 - handle OPTION => str2term "no_rewrite";
22.162 -
22.163 -val t = rewrit call_for_new_c
22.164 - (str2term "ff x = q_0/2 *L*x"); term2s t;
22.165 -val t = (rewrit call_for_new_c
22.166 - (str2term "ff x = q_0 / 2 * L * x + new_c q_0 / 2 * L * x"))
22.167 - handle OPTION => (*NOT: + new_c ..=..!!*)str2term "no_rewrite";
22.168 ---------------------------------------------------------------------*)
22.169 -
22.170 -
22.171 -"----------- simplify by ruleset reducing make_ratpoly_in --------";
22.172 -"----------- simplify by ruleset reducing make_ratpoly_in --------";
22.173 -"----------- simplify by ruleset reducing make_ratpoly_in --------";
22.174 -val thy = Isac.thy;
22.175 -val subs = [(str2term"bdv",str2term"x")];
22.176 -val t = str2term "1/EI * (L * q_0 * x / 2 + -1 * q_0 * x^^^2 / 2)";
22.177 -
22.178 -"----- stepwise from the rulesets in simplify_Integral and below-----";
22.179 -(*###*)val rls = norm_Rational_noadd_fractions;
22.180 -case rewrite_set_inst_ thy true subs rls t of
22.181 - SOME _ => raise error "integrate.sml simplify by ruleset norm_Rational_.#2"
22.182 - | NONE => ();
22.183 -(* WN051028 Rational.ML 'rat_mult_div_pow' with erls = e_rls
22.184 -applies 'rat_mult_poly_r'="?c is_polyexp ==> ?a / ?b * ?c = ?a * ?c / ?b"
22.185 -to "(L * q_0 * x / 2 + -1 * q_0 * x ^^^ 2 / 2) / EI"
22.186 -and keeps "..." is_polyexp" as an assumption.
22.187 -AFTER CORRECTION in Integrate.ML as above*)
22.188 -
22.189 -(*###*)val rls = order_add_mult_in;
22.190 -val SOME (t,[]) = rewrite_set_ thy true rls t;
22.191 -if term2str t = "1 / EI * (L * (q_0 * x) / 2 + -1 * (q_0 * x ^^^ 2) / 2)"then()
22.192 -else raise error "integrate.sml simplify by ruleset order_add_mult_in #2";
22.193 -
22.194 -(*###*)val rls = discard_parentheses;
22.195 -val SOME (t,[]) = rewrite_set_ thy true rls t;
22.196 -if term2str t = "1 / EI * (L * q_0 * x / 2 + -1 * q_0 * x ^^^ 2 / 2)" then ()
22.197 -else raise error "integrate.sml simplify by ruleset discard_parenth.. #3";
22.198 -
22.199 -(*###*)val rls =
22.200 - (append_rls "separate_bdv"
22.201 - collect_bdv
22.202 - [Thm ("separate_bdv", num_str separate_bdv),
22.203 - (*"?a * ?bdv / ?b = ?a / ?b * ?bdv"*)
22.204 - Thm ("separate_bdv_n", num_str separate_bdv_n),
22.205 - Thm ("separate_1_bdv", num_str separate_1_bdv),
22.206 - (*"?bdv / ?b = (1 / ?b) * ?bdv"*)
22.207 - Thm ("separate_1_bdv_n", num_str separate_1_bdv_n)
22.208 - ]);
22.209 -val SOME (t,[]) = rewrite_set_inst_ thy true subs rls t;
22.210 -if term2str t = "1 / EI * (L * q_0 / 2 * x + -1 * q_0 / 2 * x ^^^ 2)" then ()
22.211 -else raise error "integrate.sml simplify by ruleset separate_bdv.. #4";
22.212 -
22.213 -
22.214 -val t = str2term "1/EI * (L * q_0 * x / 2 + -1 * q_0 * x^^^2 / 2)";
22.215 -val rls = simplify_Integral;
22.216 -val SOME (t,[]) = rewrite_set_inst_ thy true subs rls t;
22.217 -if term2str t = "1 / EI * (L * q_0 / 2 * x + -1 * q_0 / 2 * x ^^^ 2)" then ()
22.218 -else raise error "integrate.sml, simplify_Integral #99";
22.219 -
22.220 -"........... 2nd integral ........................................";
22.221 -"........... 2nd integral ........................................";
22.222 -"........... 2nd integral ........................................";
22.223 -val t = str2term
22.224 - "Integral 1 / EI * (L * q_0 / 2 * (x ^^^ 2 / 2) + \
22.225 - \-1 * q_0 / 2 * (x ^^^ 3 / 3)) D x";
22.226 -val rls = simplify_Integral;
22.227 -val SOME (t,[]) = rewrite_set_inst_ thy true subs rls t;
22.228 -if term2str t =
22.229 - "Integral 1 / EI * (L * q_0 / 4 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3) D x"
22.230 -then () else raise error "integrate.sml, simplify_Integral #198";
22.231 -
22.232 -val rls = integration_rules;
22.233 -val SOME (t,[]) = rewrite_set_ thy true rls t;
22.234 -if term2str t =
22.235 - "1 / EI * (L * q_0 / 4 * (x ^^^ 3 / 3) + -1 * q_0 / 6 * (x ^^^ 4 / 4))"
22.236 -then () else raise error "integrate.sml, simplify_Integral #199";
22.237 -
22.238 -
22.239 -
22.240 -"----------- simplify by ruleset extending make_polynomial_in ----";
22.241 -"----------- simplify by ruleset extending make_polynomial_in ----";
22.242 -"----------- simplify by ruleset extending make_polynomial_in ----";
22.243 -trace_rewrite:=true;
22.244 -trace_rewrite:=false;
22.245 -(*postponed: see *)
22.246 -
22.247 -
22.248 -"----------- integrate by ruleset --------------------------------";
22.249 -"----------- integrate by ruleset --------------------------------";
22.250 -"----------- integrate by ruleset --------------------------------";
22.251 -val rls = "integration_rules";
22.252 -val subs = [("bdv","x::real")];
22.253 -fun rewrit_sinst subs rls str =
22.254 - fst (the (rewrite_set_inst "Integrate.thy" true subs rls str));
22.255 -(*~~~~~~~~~~~~~~~~~~~~~~~~~~~*)
22.256 -val str = rewrit_sinst subs rls "Integral x D x";
22.257 -val str = rewrit_sinst subs rls "Integral c * x ^^^ 2 + c_2 D x";
22.258 -if str = "c * (x ^^^ 3 / 3) + c_2 * x"
22.259 -then () else raise error "integrate.sml: diff.behav. in integration_rules";
22.260 -
22.261 -val rls = "add_new_c";
22.262 -val str = rewrit_sinst subs rls "c * (x ^^^ 3 / 3) + c_2 * x";
22.263 -if str = "c * (x ^^^ 3 / 3) + c_2 * x + c_3" then ()
22.264 -else raise error "integrate.sml: diff.behav. in add_new_c simpl.";
22.265 -
22.266 -val str = rewrit_sinst subs rls "F x = x ^^^ 3 / 3 + x";
22.267 -if str = "F x = x ^^^ 3 / 3 + x + c"(*not "F x + c =..."*) then ()
22.268 -else raise error "integrate.sml: diff.behav. in add_new_c equation";
22.269 -
22.270 -val rls = "simplify_Integral";
22.271 -(*~~~~~~~~~~~~~~~~~~~~~~~~~~~*)
22.272 -val str = "ff x = c * x + -1 * q_0 * (x ^^^ 2 / 2) + c_2";
22.273 -val str = rewrit_sinst subs rls str;
22.274 -if str = "ff x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2"
22.275 -then () else raise error "integrate.sml: diff.behav. in simplify_I #1";
22.276 -
22.277 -val rls = "integration";
22.278 -(*~~~~~~~~~~~~~~~~~~~~~~~~~~~*)
22.279 -val str = rewrit_sinst subs rls "Integral c * x ^^^ 2 + c_2 D x";
22.280 -if str = "c_3 + c_2 * x + c / 3 * x ^^^ 3"
22.281 -then () else raise error "integrate.sml: diff.behav. in integration #1";
22.282 -
22.283 -val str = rewrit_sinst subs rls "Integral 3*x^^^2 + 2*x + 1 D x";
22.284 -if str = "c + x + x ^^^ 2 + x ^^^ 3" then ()
22.285 -else raise error "integrate.sml: diff.behav. in integration #2";
22.286 -
22.287 -val str = rewrit_sinst subs rls
22.288 -"Integral 1 / EI * (L * q_0 / 2 * x + -1 * q_0 / 2 * x ^^^ 2) D x";
22.289 -if str =
22.290 - "c + 1 / EI * (L * q_0 / 4 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3)"
22.291 -then () else raise error "integrate.sml: diff.behav. in integration #3";
22.292 -
22.293 -val str = "Integral "^str^" D x";
22.294 -val str = rewrit_sinst subs rls str;
22.295 -if str =
22.296 - "c_2 + c * x + 1 / EI * (L * q_0 / 12 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)"
22.297 -then () else raise error "integrate.sml: diff.behav. in integration #4";
22.298 -
22.299 -
22.300 -"----------- rewrite 3rd integration in 7.27 ---------------------";
22.301 -"----------- rewrite 3rd integration in 7.27 ---------------------";
22.302 -"----------- rewrite 3rd integration in 7.27 ---------------------";
22.303 -val thy = Isac.thy (*because of Undeclared constant "Biegelinie.EI*);
22.304 -val bdv = [(str2term"bdv", str2term"x")];
22.305 -val t = str2term
22.306 - "Integral 1 / EI * ((L * q_0 * x + -1 * q_0 * x ^^^ 2) / 2) D x";
22.307 -val SOME(t,_)= rewrite_set_inst_ thy true bdv simplify_Integral t;
22.308 -if term2str t =
22.309 - "Integral 1 / EI * (L * q_0 / 2 * x + -1 * q_0 / 2 * x ^^^ 2) D x" then ()
22.310 -else raise error "integrate.sml 3rd integration in 7.27, simplify_Integral";
22.311 -
22.312 -val SOME(t,_)= rewrite_set_inst_ thy true bdv integration t;
22.313 -if term2str t = "c + 1 / EI * (L * q_0 / 4 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3)"
22.314 -then () else raise error "integrate.sml 3rd integration in 7.27, integration";
22.315 -
22.316 -
22.317 -"----------- check probem type -----------------------------------";
22.318 -"----------- check probem type -----------------------------------";
22.319 -"----------- check probem type -----------------------------------";
22.320 -val model = {Given =["functionTerm f_", "integrateBy v_"],
22.321 - Where =[],
22.322 - Find =["antiDerivative F_"],
22.323 - With =[],
22.324 - Relate=[]}:string ppc;
22.325 -val chkmodel = ((map (the o (parse Integrate.thy))) o ppc2list) model;
22.326 -val t1 = (term_of o hd) chkmodel;
22.327 -val t2 = (term_of o hd o tl) chkmodel;
22.328 -val t3 = (term_of o hd o tl o tl) chkmodel;
22.329 -case t3 of Const ("Integrate.antiDerivative", _) $ _ => ()
22.330 - | _ => raise error "integrate.sml: Integrate.antiDerivative ???";
22.331 -
22.332 -val model = {Given =["functionTerm f_", "integrateBy v_"],
22.333 - Where =[],
22.334 - Find =["antiDerivativeName F_"],
22.335 - With =[],
22.336 - Relate=[]}:string ppc;
22.337 -val chkmodel = ((map (the o (parse Integrate.thy))) o ppc2list) model;
22.338 -val t1 = (term_of o hd) chkmodel;
22.339 -val t2 = (term_of o hd o tl) chkmodel;
22.340 -val t3 = (term_of o hd o tl o tl) chkmodel;
22.341 -case t3 of Const ("Integrate.antiDerivativeName", _) $ _ => ()
22.342 - | _ => raise error "integrate.sml: Integrate.antiDerivativeName";
22.343 -
22.344 -"----- compare 'Find's from problem, script, formalization -------";
22.345 -val {ppc,...} = get_pbt ["named","integrate","function"];
22.346 -val ("#Find", (Const ("Integrate.antiDerivativeName", _),
22.347 - F1_ as Free ("F_", F1_type))) = last_elem ppc;
22.348 -val {scr = Script sc,... } = get_met ["diff","integration","named"];
22.349 -val [_,_, F2_] = formal_args sc;
22.350 -if F1_ = F2_ then () else raise error "integrate.sml: unequal find's";
22.351 -
22.352 -val ((dsc as Const ("Integrate.antiDerivativeName", _))
22.353 - $ Free ("ff", F3_type)) = str2term "antiDerivativeName ff";
22.354 -if is_dsc dsc then () else raise error "integrate.sml: no description";
22.355 -if F1_type = F3_type then ()
22.356 -else raise error "integrate.sml: unequal types in find's";
22.357 -
22.358 -show_ptyps();
22.359 -val pbl = get_pbt ["integrate","function"];
22.360 -case #cas pbl of SOME (Const ("Integrate.Integrate",_) $ _) => ()
22.361 - | _ => raise error "integrate.sml: Integrate.Integrate ???";
22.362 -
22.363 -
22.364 -"----------- check Scripts ---------------------------------------";
22.365 -"----------- check Scripts ---------------------------------------";
22.366 -"----------- check Scripts ---------------------------------------";
22.367 -val str =
22.368 -"Script IntegrationScript (f_::real) (v_::real) = \
22.369 -\ (let t_ = Take (Integral f_ D v_) \
22.370 -\ in (Rewrite_Set_Inst [(bdv,v_)] integration False) (t_::real))";
22.371 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
22.372 -atomty sc;
22.373 -
22.374 -val str =
22.375 -"Script NamedIntegrationScript (f_::real) (v_::real) (F_::real=>real) = \
22.376 -\ (let t_ = Take (F_ v_ = Integral f_ D v_) \
22.377 -\ in (Rewrite_Set_Inst [(bdv,v_)] integration False) t_)";
22.378 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
22.379 -atomty sc;
22.380 -show_mets();
22.381 -
22.382 -
22.383 -"----------- me method [diff,integration] ---------------------";
22.384 -"----------- me method [diff,integration] ---------------------";
22.385 -"----------- me method [diff,integration] ---------------------";
22.386 -(*exp_CalcInt_No-1.xml*)
22.387 -val fmz = ["functionTerm (x^^^2 + 1)",
22.388 - "integrateBy x","antiDerivative FF"];
22.389 -val (dI',pI',mI') =
22.390 - ("Integrate.thy",["integrate","function"],
22.391 - ["diff","integration"]);
22.392 -val p = e_pos'; val c = [];
22.393 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
22.394 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
22.395 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
22.396 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
22.397 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
22.398 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
22.399 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
22.400 -val (p,_,f,nxt,_,pt) = me nxt p c pt(*nxt <- Apply_Method*);
22.401 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
22.402 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
22.403 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
22.404 -if f2str f = "c + x + 1 / 3 * x ^^^ 3" then ()
22.405 -else raise error "integrate.sml: method [diff,integration]";
22.406 -
22.407 -
22.408 -"----------- me method [diff,integration,named] ------------------";
22.409 -"----------- me method [diff,integration,named] ------------------";
22.410 -"----------- me method [diff,integration,named] ------------------";
22.411 -(*exp_CalcInt_No-2.xml*)
22.412 -val fmz = ["functionTerm (x^^^2 + 1)",
22.413 - "integrateBy x","antiDerivativeName F"];
22.414 -val (dI',pI',mI') =
22.415 - ("Integrate.thy",["named","integrate","function"],
22.416 - ["diff","integration","named"]);
22.417 -val p = e_pos'; val c = [];
22.418 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
22.419 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
22.420 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
22.421 -val (p,_,f,nxt,_,pt) = me nxt p c pt(*nxt <- Add_Find *);
22.422 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
22.423 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
22.424 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
22.425 -val (p,_,f,nxt,_,pt) = me nxt p c pt(*nxt <- Apply_Method*);
22.426 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
22.427 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
22.428 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
22.429 -if f2str f = "F x = c + x + 1 / 3 * x ^^^ 3" then()
22.430 -else raise error "integrate.sml: method [diff,integration,named]";
22.431 -
22.432 -
22.433 -"----------- me method [diff,integration,named] Biegelinie.Q -----";
22.434 -"----------- me method [diff,integration,named] Biegelinie.Q -----";
22.435 -"----------- me method [diff,integration,named] Biegelinie.Q -----";
22.436 -(*exp_CalcInt_No-3.xml*)
22.437 -val fmz = ["functionTerm (- q_0)",
22.438 - "integrateBy x","antiDerivativeName Q"];
22.439 -val (dI',pI',mI') =
22.440 - ("Biegelinie.thy",["named","integrate","function"],
22.441 - ["diff","integration","named"]);
22.442 -val p = e_pos'; val c = [];
22.443 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
22.444 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
22.445 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
22.446 -(*Error Tac Q not in ...*)
22.447 -val (p,_,f,nxt,_,pt) = me nxt p c pt(*nxt <- Add_Find *);
22.448 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
22.449 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
22.450 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
22.451 -val (p,_,f,nxt,_,pt) = me nxt p c pt(*nxt <- Apply_Method*);
22.452 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
22.453 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
22.454 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
22.455 -
22.456 -if f2str f = "Q x = c + -1 * q_0 * x" then()
22.457 -else raise error "integrate.sml: method [diff,integration,named] .Q";
22.458 -
22.459 -
22.460 -"----------- interSteps [diff,integration] -----------------------";
22.461 -"----------- interSteps [diff,integration] -----------------------";
22.462 -"----------- interSteps [diff,integration] -----------------------";
22.463 -states:=[];
22.464 -CalcTree
22.465 -[(["functionTerm (x^2 + 1)","integrateBy x","antiDerivative FF"],
22.466 - ("Integrate.thy",["integrate","function"],
22.467 - ["diff","integration"]))];
22.468 -Iterator 1;
22.469 -moveActiveRoot 1;
22.470 -autoCalculate 1 CompleteCalc;
22.471 -val ((pt,p),_) = get_calc 1; show_pt pt;
22.472 -
22.473 -interSteps 1 ([1],Res);
22.474 -val ((pt,p),_) = get_calc 1; show_pt pt;
22.475 -if existpt' ([1,3], Res) pt then ()
22.476 -else raise error "integrate.sml: interSteps on Rewrite_Set_Inst 1";
22.477 -
22.478 -
22.479 -"----------- method analog to rls 'integration' ------------------";
22.480 -"----------- method analog to rls 'integration' ------------------";
22.481 -"----------- method analog to rls 'integration' ------------------";
22.482 -store_met
22.483 - (prep_met Integrate.thy "met_testint" [] e_metID
22.484 - (["diff","integration","test"],
22.485 - [("#Given" ,["functionTerm f_", "integrateBy v_"]),
22.486 - ("#Find" ,["antiDerivative F_"])
22.487 - ],
22.488 - {rew_ord'="tless_true", rls'=Atools_erls, calc = [],
22.489 - srls = e_rls,
22.490 - prls=e_rls,
22.491 - crls = Atools_erls, nrls = e_rls},
22.492 -"Script IntegrationScript (f_::real) (v_::real) = \
22.493 -\ (((Rewrite_Set_Inst [(bdv,v_)] integration_rules False) @@ \
22.494 -\ (Rewrite_Set_Inst [(bdv,v_)] add_new_c False) @@ \
22.495 -\ (Rewrite_Set_Inst [(bdv,v_)] simplify_Integral False)) (f_::real))"
22.496 -));
22.497 -
22.498 -states:=[];
22.499 -CalcTree
22.500 -[(["functionTerm (Integral x^2 + 1 D x)","integrateBy x",
22.501 - "antiDerivative FF"],
22.502 - ("Integrate.thy",["integrate","function"],
22.503 - ["diff","integration","test"]))];
22.504 -Iterator 1;
22.505 -moveActiveRoot 1;
22.506 -autoCalculate 1 CompleteCalcHead;
22.507 -
22.508 -fetchProposedTactic 1 (*..Apply_Method*);
22.509 -autoCalculate 1 (Step 1);
22.510 -getTactic 1 ([1], Frm) (*still empty*);
22.511 -
22.512 -fetchProposedTactic 1 (*Rewrite_Set_Inst integration_rules*);
22.513 -autoCalculate 1 (Step 1);
22.514 -
22.515 -fetchProposedTactic 1 (*Rewrite_Set_Inst add_new_c*);
22.516 -autoCalculate 1 (Step 1);
22.517 -
22.518 -fetchProposedTactic 1 (*Rewrite_Set_Inst simplify_Integral*);
22.519 -autoCalculate 1 (Step 1);
22.520 -
22.521 -autoCalculate 1 CompleteCalc;
22.522 -val ((pt,p),_) = get_calc 1; show_pt pt;
22.523 -if existpt' ([3], Res) pt then ()
22.524 -else raise error "integrate.sml: test-script doesnt work";
22.525 -
22.526 -
22.527 -"----------- Ambiguous input: Integral ?u + ?v D ?bdv = ..--------";
22.528 -"----------- Ambiguous input: Integral ?u + ?v D ?bdv = ..--------";
22.529 -"----------- Ambiguous input: Integral ?u + ?v D ?bdv = ..--------";
22.530 -states:=[];
22.531 -CalcTree
22.532 -[(["functionTerm (x^2 + 1)","integrateBy x","antiDerivative FF"],
22.533 - ("Integrate.thy",["integrate","function"],
22.534 - ["diff","integration"]))];
22.535 -Iterator 1;
22.536 -moveActiveRoot 1;
22.537 -autoCalculate 1 CompleteCalc;
22.538 -val ((pt,p),_) = get_calc 1; show_pt pt;
22.539 -
22.540 -interSteps 1 ([1],Res);
22.541 -val ((pt,p),_) = get_calc 1; show_pt pt;
22.542 -interSteps 1 ([1,1],Res);
22.543 -val ((pt,p),_) = get_calc 1; show_pt pt;
22.544 -getTactic 1 ([1,1,1],Frm);
22.545 -
22.546 -val str = (unenclose o string_of_thm) integral_add;
22.547 -writeln str;
22.548 -(*
22.549 -read_cterm (sign_of thy) (str,(TVar(("DUMMY",0),[])));
22.550 -
22.551 -*** More than one term is type correct:
22.552 -*** ((Integral (?u + ?v) D ?bdv) =
22.553 -*** (Integral ?u D (?bdv + (Integral ?v D ?bdv))))
22.554 - ###^^^###
22.555 -*** ((Integral (?u + ?v) D ?bdv) =
22.556 -*** ((Integral ?u D ?bdv) + (Integral ?v D ?bdv)))
22.557 -*)
22.558 -
22.559 -if existpt' ([1,1,5], Res) pt then ()
22.560 -else raise error "integrate.sml: interSteps on Rewrite_Set_Inst 2";
22.561 -
22.562 -"----------- CAS input -------------------------------------------";
22.563 -"----------- CAS input -------------------------------------------";
22.564 -"----------- CAS input -------------------------------------------";
22.565 -val t = str2term "Integrate (x^^^2 + x + 1, x)";
22.566 -case t of Const ("Integrate.Integrate", _) $ _ => ()
22.567 - | _ => raise error "diff.sml behav.changed for Integrate (..., x)";
22.568 -atomty t;
22.569 -
22.570 -states:=[];
22.571 -CalcTree [([], ("e_domID", ["e_pblID"], ["e_metID"]))];
22.572 -Iterator 1;
22.573 -moveActiveRoot 1;
22.574 -replaceFormula 1 "Integrate (x^2 + x + 1, x)";
22.575 -autoCalculate 1 CompleteCalc;
22.576 -val ((pt,p),_) = get_calc 1;
22.577 -val Form res = (#1 o pt_extract) (pt, ([],Res));
22.578 -show_pt pt;
22.579 -(* WN070703 does not work like Diff due to error in next-pos
22.580 -if p = ([], Res) andalso term2str res = "5 * a" then ()
22.581 -else raise error "diff.sml behav.changed for Integrate (x^2 + x + 1, x)";
22.582 -*)
23.1 --- a/test/Tools/isac/IsacKnowledge/logexp.sml Mon Aug 30 14:29:49 2010 +0200
23.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
23.3 @@ -1,61 +0,0 @@
23.4 -(* testexamples for LogExp, logarithms and exponential functions and terms
23.5 -
23.6 -use"../smltest/IsacKnowledge/logexp.sml";
23.7 -*)
23.8 -
23.9 -val thy = LogExp.thy;
23.10 -"-----------------------------------------------------------------";
23.11 -"table of contents -----------------------------------------------";
23.12 -"-----------------------------------------------------------------";
23.13 -"----------- setup presentation innsbruck ------------------------";
23.14 -"-----------------------------------------------------------------";
23.15 -"-----------------------------------------------------------------";
23.16 -"-----------------------------------------------------------------";
23.17 -
23.18 -
23.19 -"----------- setup presentation innsbruck ------------------------";
23.20 -"----------- setup presentation innsbruck ------------------------";
23.21 -"----------- setup presentation innsbruck ------------------------";
23.22 -(*
23.23 -NOT INCLUDED IN ROOT.ML and RTEST-root.sml, since the pbl and met
23.24 -defined in IsacKnowledge/Test.ML are out-commented
23.25 -in order to allow for demonstration of authoring !
23.26 -
23.27 -equality_power;
23.28 -exp_invers_log;
23.29 -(* WN071203 ???... wrong thy ?!? because parsing with Isac.thy works ?
23.30 -refine ["equality ((2 log x) = 3)","solveFor x", "solutions L"]
23.31 - ["equation","test"];
23.32 -*)
23.33 -
23.34 -val t = str2term "(2 log x)";
23.35 -val t = str2term "(2 log x) = 3";
23.36 -val t = str2term "matches ((?a log x) = ?b) ((2 log x) = 3)";
23.37 -atomty t;
23.38 -
23.39 -
23.40 -val fmz = ["equality ((2 log x) = 3)","solveFor x", "solutions L"];
23.41 -val (dI',pI',mI') =
23.42 - ("Isac.thy",["logarithmic","univariate","equation","test"],
23.43 - ["Test","solve_log"]);
23.44 -val p = e_pos'; val c = [];
23.45 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
23.46 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
23.47 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
23.48 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
23.49 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
23.50 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
23.51 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
23.52 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
23.53 -case nxt of ("Apply_Method",_) => ()
23.54 - | _ => raise error "logexp.sml setup innsbruck";
23.55 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
23.56 -
23.57 -
23.58 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
23.59 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
23.60 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
23.61 -val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
23.62 -show_pt pt;
23.63 -
23.64 -*-------------------------------------------------------------------*)
24.1 --- a/test/Tools/isac/IsacKnowledge/poly.sml Mon Aug 30 14:29:49 2010 +0200
24.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
24.3 @@ -1,423 +0,0 @@
24.4 -(* testexamples for Poly, polynomials
24.5 - author: Matthias Goldgruber 2003
24.6 - (c) due to copyright terms
24.7 -
24.8 -use"../smltest/IsacKnowledge/poly.sml";
24.9 -use"poly.sml";
24.10 -****************************************************************.*)
24.11 -
24.12 -(******************************************************************
24.13 - WN060104 'SPB' came into 'exp_IsacCore_Simp_Poly_Book.xml'
24.14 - 'SPO' came into 'exp_IsacCore_Simp_Poly_Other.xml'
24.15 -*******************************************************************)
24.16 -"-----------------------------------------------------------------";
24.17 -"table of contents -----------------------------------------------";
24.18 -"-----------------------------------------------------------------";
24.19 -"-------- investigate new uniary minus ---------------------------";
24.20 -"-------- Bsple aus Schalk I -------------------------------------";
24.21 -"-------- Script 'simplification for_polynomials' ----------------";
24.22 -"-------- check pbl 'polynomial simplification' -----------------";
24.23 -"-------- me 'polynomial simplification' Schalk I p.63 No.267b ---";
24.24 -"-------- norm_Poly NOT COMPLETE ---------------------------------";
24.25 -"-------- ord_make_polynomial ------------------------------------";
24.26 -"-----------------------------------------------------------------";
24.27 -"-----------------------------------------------------------------";
24.28 -"-----------------------------------------------------------------";
24.29 -
24.30 -
24.31 -"-------- investigate new uniary minus ---------------------------";
24.32 -"-------- investigate new uniary minus ---------------------------";
24.33 -"-------- investigate new uniary minus ---------------------------";
24.34 -val t = (#prop o rep_thm) real_diff_0; (*"0 - ?x = - ?x"*)
24.35 -atomty t;
24.36 -(*** -------------
24.37 -*** Const ( Trueprop, bool => prop)
24.38 -*** . Const ( op =, [real, real] => bool)
24.39 -*** . . Const ( op -, [real, real] => real)
24.40 -*** . . . Const ( 0, real)
24.41 -*** . . . Var ((x, 0), real)
24.42 -*** . . Const ( uminus, real => real)
24.43 -*** . . . Var ((x, 0), real) *)
24.44 -
24.45 -val t = (term_of o the o (parse thy)) "-1";
24.46 -atomty t;
24.47 -(*** -------------
24.48 -*** Free ( -1, real) *)
24.49 -val t = (term_of o the o (parse thy)) "- 1";
24.50 -atomty t;
24.51 -(*** -------------
24.52 -*** Const ( uminus, real => real)
24.53 -*** . Free ( 1, real) *)
24.54 -
24.55 -val t = (term_of o the o (parse thy)) "-x"; (*1-x syntyx error !!!*)
24.56 -atomty t;
24.57 -(**** -------------
24.58 -*** Free ( -x, real)*)
24.59 -val t = (term_of o the o (parse thy)) "- x";
24.60 -atomty t;
24.61 -(**** -------------
24.62 -*** Free ( -x, real) !!!!!!!!!!!!!!!!!!!!!!!! is the same !!!*)
24.63 -val t = (term_of o the o (parse thy)) "-(x)";
24.64 -atomty t;
24.65 -(**** -------------
24.66 -*** Free ( -x, real)*)
24.67 -
24.68 -
24.69 -"-------- Bsple aus Schalk I -------------------------------------";
24.70 -"-------- Bsple aus Schalk I -------------------------------------";
24.71 -"-------- Bsple aus Schalk I -------------------------------------";
24.72 -(*SPB Schalk I p.63 No.267b*)
24.73 -val t = str2term
24.74 - "(5*x^^^2 + 3) * (2*x^^^7 + 3) - (3*x^^^5 + 8) * (6*x^^^4 - 1)";
24.75 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
24.76 -if (term2str t) =
24.77 -"17 + 15 * x ^^^ 2 + -48 * x ^^^ 4 + 3 * x ^^^ 5 + 6 * x ^^^ 7 + -8 * x ^^^ 9"
24.78 -then ()
24.79 -else raise error "poly.sml: diff.behav. in make_polynomial 1";
24.80 -
24.81 -(*SPB Schalk I p.63 No.275b*)
24.82 - val t = str2term
24.83 - "(3*x^^^2 - 2*x*y + y^^^2) * (x^^^2 - 2*y^^^2)";
24.84 - val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
24.85 - term2str t;
24.86 -if (term2str t) =
24.87 -"3 * x ^^^ 4 + -2 * x ^^^ 3 * y + -5 * x ^^^ 2 * y ^^^ 2 + \
24.88 -\4 * x * y ^^^ 3 +\n-2 * y ^^^ 4"
24.89 -then ()
24.90 -else raise error "poly.sml: diff.behav. in make_polynomial 2";
24.91 -
24.92 -(*SPB Schalk I p.63 No.279b*)
24.93 - val t = str2term
24.94 - "(x-a)*(x-b)*(x-c)*(x-d)";
24.95 - val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
24.96 - term2str t;
24.97 -(* Richtig! *)
24.98 -if (term2str t) =
24.99 -"a * b * c * d + -1 * a * b * c * x + -1 * a * b * d * x + a * b * x ^^^ 2 +\n-1 * a * c * d * x +\na * c * x ^^^ 2 +\na * d * x ^^^ 2 +\n-1 * a * x ^^^ 3 +\n-1 * b * c * d * x +\nb * c * x ^^^ 2 +\nb * d * x ^^^ 2 +\n-1 * b * x ^^^ 3 +\nc * d * x ^^^ 2 +\n-1 * c * x ^^^ 3 +\n-1 * d * x ^^^ 3 +\nx ^^^ 4"
24.100 -then ()
24.101 -else raise error "poly.sml: diff.behav. in make_polynomial 3";
24.102 -
24.103 -(*SPB Schalk I p.63 No.291*)
24.104 - val t = str2term
24.105 - "(5+96*x^^^3+8*x*(-4+(7- 3*x)*4*x))*(5*(2- 3*x)- (-15*x*(-8*x- 5)))";
24.106 - val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
24.107 - term2str t;
24.108 -if (term2str t) =
24.109 -"50 + -770 * x + 4520 * x ^^^ 2 + -16320 * x ^^^ 3 + -26880 * x ^^^ 4"
24.110 -then ()
24.111 -else raise error "poly.sml: diff.behav. in make_polynomial 4";
24.112 -
24.113 -(*SPB Schalk I p.64 No.295c*)
24.114 - val t = str2term
24.115 - "(13*a^^^4*b^^^9*c - 12*a^^^3*b^^^6*c^^^9)^^^2";
24.116 - val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
24.117 - term2str t;
24.118 -if (term2str t) =
24.119 -"169 * a ^^^ 8 * b ^^^ 18 * c ^^^ 2 + -312 * a ^^^ 7 * b ^^^ 15 * c ^^^ 10\
24.120 -\ +\n144 * a ^^^ 6 * b ^^^ 12 * c ^^^ 18"
24.121 -then ()
24.122 -else raise error "poly.sml: diff.behav. in make_polynomial 5";
24.123 -
24.124 -(*SPB Schalk I p.64 No.299a*)
24.125 - val t = str2term
24.126 - "(x - y)*(x + y)";
24.127 - val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
24.128 - term2str t;
24.129 -if (term2str t) =
24.130 -"x ^^^ 2 + -1 * y ^^^ 2"
24.131 -then ()
24.132 -else raise error "poly.sml: diff.behav. in make_polynomial 6";
24.133 -
24.134 -(*SPB Schalk I p.64 No.300c*)
24.135 - val t = str2term
24.136 - "(3*x^^^2*y - 1)*(3*x^^^2*y + 1)";
24.137 - val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
24.138 - term2str t;
24.139 -if (term2str t) =
24.140 -"-1 + 9 * x ^^^ 4 * y ^^^ 2"
24.141 -then ()
24.142 -else raise error "poly.sml: diff.behav. in make_polynomial 7";
24.143 -
24.144 -(*SPB Schalk I p.64 No.302*)
24.145 -val t = str2term
24.146 - "(13*x^^^2 + 5)*(13*x^^^2 - 5) - (5*x^^^2 + 3)*(5*x^^^2 - 3) - (12*x^^^2 + 4)*(12*x^^^2 - 4)";
24.147 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
24.148 -if term2str t = "0" then ()
24.149 -else raise error "poly.sml: diff.behav. in make_polynomial 8";
24.150 -(* Bei Berechnung sollte 3 mal real_plus_minus_binom1_p aus expand_poly verwendet werden *)
24.151 -
24.152 -
24.153 -(*SPB Schalk I p.64 No.306a*)
24.154 -val t = str2term "((x^^^2 + 1)*(x^^^2 - 1))^^^2";
24.155 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
24.156 -if (term2str t) = "1 + 2 * x ^^^ 4 + 2 * -2 * x ^^^ 4 + x ^^^ 8" then ()
24.157 -else raise error "poly.sml: diff.behav. in make_polynomial: not confluent \
24.158 - \2 * x ^^^ 4 + 2 * -2 * x ^^^ 4 = -2 * x ^^^ 4 works again";
24.159 -
24.160 -
24.161 -(*WN071729 when reducing "rls reduce_012_" for Schaerding,
24.162 -the above resulted in the term below ... but reduces from then correctly*)
24.163 -val t = str2term "1 + 2 * x ^^^ 4 + 2 * -2 * x ^^^ 4 + x ^^^ 8";
24.164 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
24.165 -if (term2str t) = "1 + -2 * x ^^^ 4 + x ^^^ 8" then ()
24.166 -else raise error "poly.sml: diff.behav. in make_polynomial 9b";
24.167 -
24.168 -(*SPB Schalk I p.64 No.296a*)
24.169 -val t = str2term "(x - a)^^^3";
24.170 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
24.171 -if (term2str t) = "-1 * a ^^^ 3 + 3 * a ^^^ 2 * x + -3 * a * x ^^^ 2 + x ^^^ 3"
24.172 -then () else raise error "poly.sml: diff.behav. in make_polynomial 10";
24.173 -
24.174 -(*SPB Schalk I p.64 No.296c*)
24.175 -val t = str2term "(-3*x - 4*y)^^^3";
24.176 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
24.177 -if (term2str t) =
24.178 -"-27 * x ^^^ 3 + -108 * x ^^^ 2 * y + -144 * x * y ^^^ 2 + -64 * y ^^^ 3"
24.179 -then () else raise error "poly.sml: diff.behav. in make_polynomial 11";
24.180 -
24.181 -(*SPB Schalk I p.62 No.242c*)
24.182 -val t = str2term "x^^^(-4)*(x^^^(-4)*y^^^(-2))^^^(-1)*y^^^(-2)";
24.183 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
24.184 -if (term2str t) = "1" then ()
24.185 -else raise error "poly.sml: diff.behav. in make_polynomial 12";
24.186 -
24.187 -(*SPB Schalk I p.60 No.209a*)
24.188 -val t = str2term "a^^^(7-x) * a^^^x";
24.189 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
24.190 -if term2str t = "a ^^^ 7" then ()
24.191 -else raise error "poly.sml: diff.behav. in make_polynomial 13";
24.192 -
24.193 -(*SPB Schalk I p.60 No.209d*)
24.194 -val t = str2term "d^^^x * d^^^(x+1) * d^^^(2 - 2*x)";
24.195 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
24.196 -if term2str t = "d ^^^ 3" then ()
24.197 -else raise error "poly.sml: diff.behav. in make_polynomial 14";
24.198 -
24.199 -
24.200 -(*---------------------------------------------------------------------*)
24.201 -(*------------------ Bsple bei denen es Probleme gibt------------------*)
24.202 -(*---------------------------------------------------------------------*)
24.203 -
24.204 -(*Schalk I p.64 No.303*)
24.205 -val t = str2term "(a + 2*b)*(a^^^2 + 4*b^^^2)*(a - 2*b) - (a - 6*b)*(a^^^2 + 36*b^^^2)*(a + 6*b)";
24.206 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
24.207 -if term2str t = "1280 * b ^^^ 4" then ()
24.208 -else raise error "poly.sml: diff.behav. in make_polynomial 14b";
24.209 -(* Richtig - aber Binomische Formel wurde nicht verwendet! *)
24.210 -
24.211 -
24.212 -(*--------------------------------------------------------------------*)
24.213 -(*----------------------- Eigene Beispiele ---------------------------*)
24.214 -(*--------------------------------------------------------------------*)
24.215 -(*SPO*)
24.216 -val t = str2term "a^^^2*a^^^(-2)";
24.217 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
24.218 -if term2str t = "1" then ()
24.219 -else raise error "poly.sml: diff.behav. in make_polynomial 15";
24.220 -(*SPO*)
24.221 -val t = str2term "a + a + a";
24.222 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
24.223 -if term2str t = "3 * a" then ()
24.224 -else raise error "poly.sml: diff.behav. in make_polynomial 16";
24.225 -(*SPO*)
24.226 -val t = str2term "a + b + b + b";
24.227 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
24.228 -if term2str t = "a + 3 * b" then ()
24.229 -else raise error "poly.sml: diff.behav. in make_polynomial 17";
24.230 -(*SPO*)
24.231 -val t = str2term "a^^^2*b*b^^^(-1)";
24.232 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
24.233 -if term2str t = "a ^^^ 2" then ()
24.234 -else raise error "poly.sml: diff.behav. in make_polynomial 18";
24.235 -(*SPO*)
24.236 -val t = str2term "a^^^2*a^^^(-2)";
24.237 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
24.238 -if (term2str t) = "1" then ()
24.239 -else raise error "poly.sml: diff.behav. in make_polynomial 19";
24.240 -(*SPO*)
24.241 -val t = str2term "b + a - b";
24.242 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
24.243 -if (term2str t) = "a" then ()
24.244 -else raise error "poly.sml: diff.behav. in make_polynomial 20";
24.245 -(*SPO*)
24.246 -val t = str2term "b * a * a";
24.247 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
24.248 -if term2str t = "a ^^^ 2 * b" then ()
24.249 -else raise error "poly.sml: diff.behav. in make_polynomial 21";
24.250 -(*SPO*)
24.251 -val t = str2term "(a^^^2)^^^3";
24.252 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
24.253 -if term2str t = "a ^^^ 6" then ()
24.254 -else raise error "poly.sml: diff.behav. in make_polynomial 22";
24.255 -(*SPO*)
24.256 -val t = str2term "x^^^2 * y^^^2 + x * x^^^2 * y";
24.257 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
24.258 -if term2str t = "x ^^^ 3 * y + x ^^^ 2 * y ^^^ 2" then ()
24.259 -else raise error "poly.sml: diff.behav. in make_polynomial 23";
24.260 -(*SPO*)
24.261 -val t = (term_of o the o (parse thy)) "a^^^2 * (-a)^^^2";
24.262 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
24.263 -if (term2str t) = "a ^^^ 4" then ()
24.264 -else raise error "poly.sml: diff.behav. in make_polynomial 24";
24.265 -(*SPO*)
24.266 -val t = str2term "a * b * b^^^(-1) + a";
24.267 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
24.268 -if (term2str t) = "2 * a" then ()
24.269 -else raise error "poly.sml: diff.behav. in make_polynomial 25";
24.270 -(*SPO*)
24.271 -val t = str2term "a*c*b^^^(2*n) + 3*a + 5*b^^^(2*n)*c*b";
24.272 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
24.273 -if (term2str t) = "3 * a + 5 * b ^^^ (1 + 2 * n) * c + a * b ^^^ (2 * n) * c"
24.274 -then () else raise error "poly.sml: diff.behav. in make_polynomial 26";
24.275 -
24.276 -
24.277 -(*MG.27.6.03 -------------vvv-: Verschachtelte Terme -----------*)
24.278 -(*SPO*)
24.279 -val t = str2term "(1 + (x*y*a) + x)^^^(1 + (x*y*a) + x)";
24.280 - val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
24.281 - term2str t;
24.282 -if term2str t = "(1 + x + a * x * y) ^^^ (1 + x + a * x * y)"
24.283 - then () else raise error "poly.sml: diff.behav. in make_polynomial 27";(*SPO*)
24.284 -val t = str2term "(1 + x*(y*z)*zz)^^^(1 + x*(y*z)*zz)";
24.285 - val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
24.286 - term2str t;
24.287 -if term2str t = "(1 + x * y * z * zz) ^^^ (1 + x * y * z * zz)"
24.288 - then () else raise error "poly.sml: diff.behav. in make_polynomial 28";
24.289 -
24.290 -"-------- Script 'simplification for_polynomials' ----------------";
24.291 -"-------- Script 'simplification for_polynomials' ----------------";
24.292 -"-------- Script 'simplification for_polynomials' ----------------";
24.293 -val str =
24.294 -"Script SimplifyScript (t_::real) = \
24.295 -\ ((Rewrite_Set norm_Poly False) t_)";
24.296 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
24.297 -atomty sc;
24.298 -
24.299 -
24.300 -"-------- check pbl 'polynomial simplification' -----------------";
24.301 -"-------- check pbl 'polynomial simplification' -----------------";
24.302 -"-------- check pbl 'polynomial simplification' -----------------";
24.303 -val fmz = ["term ((5*x^^^2 + 3) * (2*x^^^7 + 3) \
24.304 - \- (3*x^^^5 + 8) * (6*x^^^4 - 1))",
24.305 - "normalform N"];
24.306 -(*0*)
24.307 -case refine fmz ["polynomial","simplification"]of
24.308 - [Matches (["polynomial", "simplification"], _)] => ()
24.309 - | _ => raise error "poly.sml diff.behav. in check pbl, refine";
24.310 -(*...if there is an error, then ...*)
24.311 -
24.312 -(*1*)
24.313 -print_depth 7;
24.314 -val pbt = get_pbt ["polynomial","simplification"];
24.315 -print_depth 3;
24.316 -(*if there is ...
24.317 -> val NoMatch' {Given=gi, Where=wh, Find=fi,...} = match_pbl fmz pbt;
24.318 -... then trace_rewrite:*)
24.319 -
24.320 -(*2*)
24.321 -trace_rewrite:=true;
24.322 -match_pbl fmz pbt;
24.323 -trace_rewrite:=false;
24.324 -(*... if there is no rewrite, then there is something wrong with prls*)
24.325 -
24.326 -(*3*)
24.327 -print_depth 7;
24.328 -val prls = (#prls o get_pbt) ["polynomial","simplification"];
24.329 -print_depth 3;
24.330 -val t = str2term "((5*x^^^2 + 3) * (2*x^^^7 + 3) \
24.331 - \- (3*x^^^5 + 8) * (6*x^^^4 - 1)) is_polyexp";
24.332 -trace_rewrite:=true;
24.333 -val SOME (t',_) = rewrite_set_ thy false prls t;
24.334 -trace_rewrite:=false;
24.335 -if t' = HOLogic.true_const then ()
24.336 -else raise error "poly.sml: diff.behav. in check pbl 'polynomial..";
24.337 -(*... if this works, but (*1*) does still NOT work, check types:*)
24.338 -
24.339 -(*4*)
24.340 -show_types:=true;
24.341 -(*
24.342 -> val NoMatch' {Given=gi, Where=wh, Find=fi,...} = match_pbl fmz pbt;
24.343 -val wh = [False "(t_::real => real) (is_polyexp::real)"]
24.344 -......................^^^^^^^^^^^^...............^^^^*)
24.345 -val Matches' _ = match_pbl fmz pbt;
24.346 -show_types:=false;
24.347 -
24.348 -
24.349 -"-------- me 'polynomial simplification' Schalk I p.63 No.267b ---";
24.350 -"-------- me 'polynomial simplification' Schalk I p.63 No.267b ---";
24.351 -"-------- me 'polynomial simplification' Schalk I p.63 No.267b ---";
24.352 -val fmz = ["term ((5*x^^^2 + 3) * (2*x^^^7 + 3) \
24.353 - \- (3*x^^^5 + 8) * (6*x^^^4 - 1))",
24.354 - "normalform N"];
24.355 -val (dI',pI',mI') =
24.356 - ("Poly.thy",["polynomial","simplification"],
24.357 - ["simplification","for_polynomials"]);
24.358 -val p = e_pos'; val c = [];
24.359 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
24.360 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
24.361 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
24.362 -(writeln o (itms2str_ ctxt)) (get_obj g_pbl pt (fst p));
24.363 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
24.364 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
24.365 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
24.366 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
24.367 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
24.368 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
24.369 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
24.370 -if f2str f =
24.371 -"17 + 15 * x ^^^ 2 + -48 * x ^^^ 4 + 3 * x ^^^ 5 + 6 * x ^^^ 7 + -8 * x ^^^ 9"
24.372 -then () else raise error "poly.sml diff.behav. in me Schalk I p.63 No.267b";
24.373 -
24.374 -
24.375 -"-------- interSteps for Schalk 299a -----------------------------";
24.376 -"-------- interSteps for Schalk 299a -----------------------------";
24.377 -"-------- interSteps for Schalk 299a -----------------------------";
24.378 -states:=[];
24.379 -CalcTree
24.380 -[(["term ((x - y)*(x + y))", "normalform N"],
24.381 - ("Poly.thy",["polynomial","simplification"],
24.382 - ["simplification","for_polynomials"]))];
24.383 -Iterator 1;
24.384 -moveActiveRoot 1;
24.385 -autoCalculate 1 CompleteCalc;
24.386 -val ((pt,p),_) = get_calc 1; show_pt pt;
24.387 -
24.388 -interSteps 1 ([1],Res)(*<ERROR> syserror in detailstep </ERROR>*);
24.389 -val ((pt,p),_) = get_calc 1; show_pt pt;
24.390 -if existpt' ([1,1], Frm) pt then ()
24.391 -else raise error "poly.sml: interSteps doesnt work again 1";
24.392 -
24.393 -interSteps 1 ([1,1],Res)(*<ERROR> syserror in detailstep </ERROR>*);
24.394 -val ((pt,p),_) = get_calc 1; show_pt pt;
24.395 -if existpt' ([1,1,1], Frm) pt then ()
24.396 -else raise error "poly.sml: interSteps doesnt work again 2";
24.397 -
24.398 -
24.399 -"-------- norm_Poly NOT COMPLETE ---------------------------------";
24.400 -"-------- norm_Poly NOT COMPLETE ---------------------------------";
24.401 -"-------- norm_Poly NOT COMPLETE ---------------------------------";
24.402 -trace_rewrite:=true;
24.403 -val SOME (f',_) = rewrite_set_ thy false norm_Poly
24.404 -(str2term "L = k - 2 * q + (k - 2 * q) + (k - 2 * q) + (k - 2 * q) + senkrecht + oben")(*see poly.sml: -- norm_Poly NOT COMPLETE -- TODO MG*);
24.405 -trace_rewrite:=false;
24.406 -term2str f';
24.407 -
24.408 -"-------- ord_make_polynomial ------------------------------------";
24.409 -"-------- ord_make_polynomial ------------------------------------";
24.410 -"-------- ord_make_polynomial ------------------------------------";
24.411 -val t1 = str2term "2 * b + (3 * a + 3 * b)";
24.412 -val t2 = str2term "3 * a + 3 * b + 2 * b";
24.413 -
24.414 -if ord_make_polynomial true Poly.thy [] (t1, t2) then ()
24.415 -else raise error "poly.sml: diff.behav. in ord_make_polynomial";
24.416 -
24.417 -(*WN071202: ^^^ why then is there no rewriting ...*)
24.418 -val term = str2term "2*b + (3*a + 3*b)";
24.419 -val NONE = rewrite_set_ Isac.thy false order_add_mult term;
24.420 -
24.421 -(*or why is there no rewriting this way...*)
24.422 -val t1 = str2term "2 * b + (3 * a + 3 * b)";
24.423 -val t2 = str2term "3 * a + (2 * b + 3 * b)";
24.424 -
24.425 -
24.426 -
25.1 --- a/test/Tools/isac/IsacKnowledge/polyeq.sml Mon Aug 30 14:29:49 2010 +0200
25.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
25.3 @@ -1,1178 +0,0 @@
25.4 -(* testexamples for PolyEq, poynomial equations and equational systems
25.5 - author: Richard Lang
25.6 - 2003
25.7 - (c) due to copyright terms
25.8 -
25.9 -use"../smltest/IsacKnowledge/polyeq.sml";
25.10 -use"polyeq.sml";
25.11 -
25.12 -WN030609: some expls dont work due to unfinished handling of 'expanded terms';
25.13 - others marked with TODO have to be checked, too.
25.14 -*)
25.15 -
25.16 -"-----------------------------------------------------------------";
25.17 -"table of contents -----------------------------------------------";
25.18 -(*WN060608 some ----- are not in this table*)
25.19 -"-----------------------------------------------------------------";
25.20 -"----------- tests on predicates in problems ---------------------";
25.21 -"----------- test matching problems --------------------------0---";
25.22 -"----------- (-8 - 2*x + x^^^2 = 0), (*Schalk 2, S.67 Nr.31.b----";
25.23 -"----------- (-16 + 4*x + 2*x^^^2 = 0), --------------------------";
25.24 -"----------- (a*b - (a+b)*x + x^^^2 = 0), (*Schalk 2,S.68Nr.44.a*)";
25.25 -"----------- (-64 + x^^^2 = 0), (*Schalk 2, S.66 Nr.1.a~--------*)";
25.26 -"----------- (-147 + 3*x^^^2 = 0), (*Schalk 2, S.66 Nr.1.b------*)";
25.27 -"----------- (3*x - 1 - (5*x - (2 - 4*x)) = -11),(*Schalk Is86Bsp5";
25.28 -"----------- ((x+1)*(x+2) - (3*x - 2)^^^2=.. Schalk II s.68 Bsp 37";
25.29 -"----------- interSteps ([1],Res); on Schalk Is86Bsp5-------------";
25.30 -"-----------------------------------------------------------------";
25.31 -"-----------------------------------------------------------------";
25.32 -"-----------------------------------------------------------------";
25.33 -
25.34 -val c = [];
25.35 -
25.36 -"----------- tests on predicates in problems ---------------------";
25.37 -"----------- tests on predicates in problems ---------------------";
25.38 -"----------- tests on predicates in problems ---------------------";
25.39 -(*
25.40 - Compiler.Control.Print.printDepth:=5; (*4 default*)
25.41 - trace_rewrite:=true;
25.42 - trace_rewrite:=false;
25.43 -*)
25.44 - val t1 = (term_of o the o (parse thy)) "lhs (-8 - 2*x + x^^^2 = 0)";
25.45 - val SOME (t,_) = rewrite_set_ PolyEq.thy false PolyEq_prls t1;
25.46 - if ((term2str t) = "-8 - 2 * x + x ^^^ 2") then ()
25.47 - else raise error "polyeq.sml: diff.behav. in lhs";
25.48 -
25.49 -
25.50 - val t2 = (term_of o the o (parse thy)) "(-8 - 2*x + x^^^2) is_expanded_in x";
25.51 - val SOME (t,_) = rewrite_set_ PolyEq.thy false PolyEq_prls t2;
25.52 - if (term2str t) = "True" then ()
25.53 - else raise error "polyeq.sml: diff.behav. 1 in is_expended_in";
25.54 -
25.55 - val t0 = (term_of o the o (parse thy)) "(sqrt(x)) is_poly_in x";
25.56 - val SOME (t,_) = rewrite_set_ PolyEq.thy false PolyEq_prls t0;
25.57 - if (term2str t) = "False" then ()
25.58 - else raise error "polyeq.sml: diff.behav. 2 in is_poly_in";
25.59 -
25.60 -
25.61 - val t3 = (term_of o the o (parse thy)) "(-8 + (-1)*2*x + x^^^2) is_poly_in x";
25.62 - val SOME (t,_) = rewrite_set_ PolyEq.thy false PolyEq_prls t3;
25.63 - if (term2str t) = "True" then ()
25.64 - else raise error "polyeq.sml: diff.behav. 3 in is_poly_in";
25.65 -
25.66 -
25.67 - val t4 = (term_of o the o (parse thy)) "(lhs (-8 + (-1)*2*x + x^^^2 = 0)) is_expanded_in x";
25.68 - val SOME (t,_) = rewrite_set_ PolyEq.thy false PolyEq_prls t4;
25.69 - if (term2str t) = "True" then ()
25.70 - else raise error "polyeq.sml: diff.behav. 4 in is_expended_in";
25.71 -
25.72 -
25.73 - val t6 = (term_of o the o (parse thy)) "(lhs (-8 - 2*x + x^^^2 = 0)) is_expanded_in x";
25.74 - val SOME (t,_) = rewrite_set_ PolyEq.thy false PolyEq_prls t6;
25.75 - if (term2str t) = "True" then ()
25.76 - else raise error "polyeq.sml: diff.behav. 5 in is_expended_in";
25.77 -
25.78 - val t3 = (term_of o the o (parse thy))"((-8 - 2*x + x^^^2) has_degree_in x) = 2";
25.79 - val SOME (t,_) = rewrite_set_ PolyEq.thy false PolyEq_prls t3;
25.80 - if (term2str t) = "True" then ()
25.81 - else raise error "polyeq.sml: diff.behav. in has_degree_in_in";
25.82 -
25.83 -
25.84 - val t3 = (term_of o the o (parse thy)) "((sqrt(x)) has_degree_in x) = 2";
25.85 - val SOME (t,_) = rewrite_set_ PolyEq.thy false PolyEq_prls t3;
25.86 - if (term2str t) = "False" then ()
25.87 - else raise error "polyeq.sml: diff.behav. 6 in has_degree_in_in";
25.88 -
25.89 - val t4 = (term_of o the o (parse thy))
25.90 - "((-8 - 2*x + x^^^2) has_degree_in x) = 1";
25.91 - val SOME (t,_) = rewrite_set_ PolyEq.thy false PolyEq_prls t4;
25.92 - if (term2str t) = "False" then ()
25.93 - else raise error "polyeq.sml: diff.behav. 7 in has_degree_in_in";
25.94 -
25.95 -
25.96 - val t5 = (term_of o the o (parse thy))
25.97 - "((-8 - 2*x + x^^^2) has_degree_in x) = 2";
25.98 - val SOME (t,_) = rewrite_set_ PolyEq.thy false PolyEq_prls t5;
25.99 - if (term2str t) = "True" then ()
25.100 - else raise error "polyeq.sml: diff.behav. 8 in has_degree_in_in";
25.101 -
25.102 -
25.103 -"----------- test matching problems --------------------------0---";
25.104 -"----------- test matching problems --------------------------0---";
25.105 -"----------- test matching problems --------------------------0---";
25.106 - val fmz = ["equality (-8 - 2*x + x^^^2 = 0)", "solveFor x","solutions L"];
25.107 - val pbt as {thy = thy, where_ = pre, ppc = ppc,...} =
25.108 - get_pbt ["expanded","univariate","equation"];
25.109 -
25.110 - match_pbl fmz (get_pbt ["expanded","univariate","equation"]);
25.111 - (*Matches'
25.112 - {Find=[Correct "solutions L"],
25.113 - Given=[Correct "equality (-8 - 2 * x + x ^^^ 2 = 0)",
25.114 - Correct "solveFor x"],Relate=[],
25.115 - Where=[Correct "matches (?a = 0) (-8 - 2 * x + x ^^^ 2 = 0)",
25.116 - Correct "lhs (-8 - 2 * x + x ^^^ 2 = 0) is_expanded_in x"],With=[]}
25.117 - *)
25.118 - match_pbl fmz (get_pbt ["degree_2","expanded","univariate","equation"]);
25.119 - (*Matches'
25.120 - {Find=[Correct "solutions L"],
25.121 - Given=[Correct "equality (-8 - 2 * x + x ^^^ 2 = 0)",
25.122 - Correct "solveFor x"],Relate=[],
25.123 - Where=[Correct "lhs (-8 - 2 * x + x ^^^ 2 = 0) has_degree_in x =!= 2"],
25.124 - With=[]}*)
25.125 -
25.126 -"-------------------- test thm's degree_0 --------------------------------------";
25.127 -"-------------------- test thm's degree_0 --------------------------------------";
25.128 -"----- d0_false ------";
25.129 -(*EP*)
25.130 -val fmz = ["equality ( 1 = 0)", "solveFor x","solutions L"];
25.131 -val (dI',pI',mI') = ("PolyEq.thy",["degree_0","polynomial","univariate","equation"],
25.132 - ["PolyEq","solve_d0_polyeq_equation"]);
25.133 -(*val p = e_pos';
25.134 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.135 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.136 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.137 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.138 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.139 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.140 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.141 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.142 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.143 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[]")) => ()
25.144 - | _ => raise error "polyeq.sml: diff.behav. in 1 = 0 -> []";
25.145 -
25.146 -"----- d0_true ------";
25.147 -(*EP-7*)
25.148 -val fmz = ["equality ( 0 = 0)", "solveFor x","solutions L"];
25.149 -val (dI',pI',mI') = ("PolyEq.thy",["degree_0","polynomial","univariate","equation"],
25.150 - ["PolyEq","solve_d0_polyeq_equation"]);
25.151 -(*val p = e_pos'; val c = [];
25.152 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.153 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.154 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.155 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.156 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.157 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.158 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.159 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.160 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.161 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"UniversalList")) => ()
25.162 - | _ => raise error "polyeq.sml: diff.behav. in 0 = 0 -> UniversalList";
25.163 -
25.164 -"-------------------- test thm's degree_2 ------------------------------------------";
25.165 -"-------------------- test thm's degree_2 ------------------------------------------";
25.166 -
25.167 -"-------------------- test thm's d2_pq_formulsxx[_neg]-----";
25.168 -"-------------------- test thm's d2_pq_formulsxx[_neg]-----";
25.169 -"-------------------- test thm's d2_pq_formulsxx[_neg]-----";
25.170 -
25.171 -"----- d2_pqformula1 ------!!!!";
25.172 -val fmz = ["equality (-2 +(-1)*x + x^^^2 = 0)", "solveFor x","solutions L"];
25.173 -val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"], ["PolyEq","solve_d2_polyeq_pq_equation"]);
25.174 -(*val p = e_pos'; val c = [];
25.175 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.176 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.177 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.178 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.179 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.180 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.181 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.182 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.183 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.184 -(*### or2list _ | _
25.185 - ([3],Res) "x = 2 | x = -1" Or_to_List*)
25.186 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.187 -(*### or2list _ | _
25.188 - ### applicable_in Check_elementwise: --> ([x = 2, x = -1], [])
25.189 - ([4],Res) "[x = 2, x = -1]" Check_elementwise "Assumptions"*)
25.190 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.191 -(*### applicable_in Check_elementwise: --> ([x = 2, x = -1], [])
25.192 - ([5],Res) "[x = 2, x = -1]" Check_Postcond*)
25.193 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.194 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 2, x = -1]")) => ()
25.195 - | _ => raise error "polyeq.sml: diff.behav. in -2 + (-1)*x + x^2 = 0 -> [x = 2, x = -1]";
25.196 -
25.197 -"----- d2_pqformula1_neg ------";
25.198 -(*EP-8*)
25.199 -val fmz = ["equality ( 2 +(-1)*x + x^^^2 = 0)", "solveFor x","solutions L"];
25.200 -val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"], ["PolyEq","solve_d2_polyeq_pq_equation"]);
25.201 -(*val p = e_pos'; val c = [];
25.202 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.203 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.204 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.205 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.206 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.207 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.208 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.209 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.210 -(*### or2list False
25.211 - ([1],Res) False Or_to_List)*)
25.212 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.213 -(*### or2list False
25.214 - ([2],Res) [] Check_elementwise "Assumptions"*)
25.215 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.216 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.217 -val asm = get_assumptions_ pt p;
25.218 -if f = Form' (FormKF (~1,EdUndef,0,Nundef,"[]")) andalso asm = [] then ()
25.219 -else raise error "polyeq.sml: diff.behav. in 2 +(-1)*x + x^^^2 = 0";
25.220 -
25.221 -"----- d2_pqformula2 ------";
25.222 -val fmz = ["equality (-2 +(-1)*x + 1*x^^^2 = 0)", "solveFor x","solutions L"];
25.223 -val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
25.224 - ["PolyEq","solve_d2_polyeq_pq_equation"]);
25.225 -(*val p = e_pos'; val c = [];
25.226 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.227 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.228 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.229 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.230 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.231 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.232 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.233 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.234 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.235 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.236 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.237 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 2, x = -1]")) => ()
25.238 - | _ => raise error "polyeq.sml: diff.behav. in -2 + (-1)*x + x^2 = 0 -> [x = 2, x = -1]";
25.239 -
25.240 -
25.241 -"----- d2_pqformula2_neg ------";
25.242 -val fmz = ["equality ( 2 +(-1)*x + 1*x^^^2 = 0)", "solveFor x","solutions L"];
25.243 -val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
25.244 - ["PolyEq","solve_d2_polyeq_pq_equation"]);
25.245 -(*val p = e_pos'; val c = [];
25.246 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.247 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.248 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.249 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.250 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.251 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.252 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.253 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.254 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.255 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.256 -"TODO 2 +(-1)*x + 1*x^^^2 = 0";
25.257 -"TODO 2 +(-1)*x + 1*x^^^2 = 0";
25.258 -"TODO 2 +(-1)*x + 1*x^^^2 = 0";
25.259 -
25.260 -
25.261 -"----- d2_pqformula3 ------";
25.262 -(*EP-9*)
25.263 -val fmz = ["equality (-2 + x + x^^^2 = 0)", "solveFor x","solutions L"];
25.264 -val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
25.265 - ["PolyEq","solve_d2_polyeq_pq_equation"]);
25.266 -(*val p = e_pos'; val c = [];
25.267 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.268 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.269 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.270 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.271 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.272 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.273 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.274 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.275 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.276 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.277 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.278 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 1, x = -2]")) => ()
25.279 - | _ => raise error "polyeq.sml: diff.behav. in -2 + x + x^2 = 0-> [x = 1, x = -2]";
25.280 -
25.281 -"----- d2_pqformula3_neg ------";
25.282 -val fmz = ["equality ( 2 + x + x^^^2 = 0)", "solveFor x","solutions L"];
25.283 -val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
25.284 - ["PolyEq","solve_d2_polyeq_pq_equation"]);
25.285 -(*val p = e_pos'; val c = [];
25.286 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.287 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.288 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.289 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.290 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.291 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.292 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.293 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.294 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.295 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.296 -"TODO 2 + x + x^^^2 = 0";
25.297 -"TODO 2 + x + x^^^2 = 0";
25.298 -"TODO 2 + x + x^^^2 = 0";
25.299 -
25.300 -
25.301 -"----- d2_pqformula4 ------";
25.302 -val fmz = ["equality (-2 + x + 1*x^^^2 = 0)", "solveFor x","solutions L"];
25.303 -val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
25.304 - ["PolyEq","solve_d2_polyeq_pq_equation"]);
25.305 -(*val p = e_pos'; val c = [];
25.306 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.307 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.308 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.309 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.310 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.311 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.312 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.313 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.314 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.315 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.316 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.317 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 1, x = -2]")) => ()
25.318 - | _ => raise error "polyeq.sml: diff.behav. in -2 + x + 1*x^^^2 = 0 -> [x = 1, x = -2]";
25.319 -
25.320 -"----- d2_pqformula4_neg ------";
25.321 -val fmz = ["equality ( 2 + x + 1*x^^^2 = 0)", "solveFor x","solutions L"];
25.322 -val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
25.323 - ["PolyEq","solve_d2_polyeq_pq_equation"]);
25.324 -(*val p = e_pos'; val c = [];
25.325 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.326 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.327 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.328 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.329 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.330 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.331 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.332 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.333 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.334 -"TODO 2 + x + 1*x^^^2 = 0";
25.335 -"TODO 2 + x + 1*x^^^2 = 0";
25.336 -"TODO 2 + x + 1*x^^^2 = 0";
25.337 -
25.338 -"----- d2_pqformula5 ------";
25.339 -val fmz = ["equality (1*x + x^^^2 = 0)", "solveFor x","solutions L"];
25.340 -val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
25.341 - ["PolyEq","solve_d2_polyeq_pq_equation"]);
25.342 -(*val p = e_pos'; val c = [];
25.343 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.344 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.345 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.346 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.347 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.348 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.349 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.350 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.351 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.352 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.353 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.354 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 0, x = -1]")) => ()
25.355 - | _ => raise error "polyeq.sml: diff.behav. in 1*x + x^2 = 0 -> [x = 0, x = -1]";
25.356 -
25.357 -"----- d2_pqformula6 ------";
25.358 -val fmz = ["equality (1*x + 1*x^^^2 = 0)", "solveFor x","solutions L"];
25.359 -val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
25.360 - ["PolyEq","solve_d2_polyeq_pq_equation"]);
25.361 -(*val p = e_pos'; val c = [];
25.362 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.363 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.364 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.365 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.366 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.367 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.368 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.369 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.370 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.371 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.372 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.373 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 0, x = -1]")) => ()
25.374 - | _ => raise error "polyeq.sml: diff.behav. in 1*x + 1*x^2 = 0 -> [x = 0, x = -1]";
25.375 -
25.376 -"----- d2_pqformula7 ------";
25.377 -(*EP-10*)
25.378 -val fmz = ["equality ( x + x^^^2 = 0)", "solveFor x","solutions L"];
25.379 -val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
25.380 - ["PolyEq","solve_d2_polyeq_pq_equation"]);
25.381 -(*val p = e_pos'; val c = [];
25.382 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.383 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.384 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.385 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.386 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.387 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.388 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.389 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.390 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.391 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.392 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.393 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 0, x = -1]")) => ()
25.394 - | _ => raise error "polyeq.sml: diff.behav. in x + x^2 = 0 -> [x = 0, x = -1]";
25.395 -
25.396 -"----- d2_pqformula8 ------";
25.397 -val fmz = ["equality ( x + 1*x^^^2 = 0)", "solveFor x","solutions L"];
25.398 -val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
25.399 - ["PolyEq","solve_d2_polyeq_pq_equation"]);
25.400 -(*val p = e_pos'; val c = [];
25.401 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.402 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.403 -
25.404 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.405 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.406 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.407 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.408 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.409 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.410 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.411 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.412 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.413 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 0, x = -1]")) => ()
25.414 - | _ => raise error "polyeq.sml: diff.behav. in x + 1*x^2 = 0 -> [x = 0, x = -1]";
25.415 -
25.416 -"----- d2_pqformula9 ------";
25.417 -val fmz = ["equality (-4 + x^^^2 = 0)", "solveFor x","solutions L"];
25.418 -val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
25.419 - ["PolyEq","solve_d2_polyeq_pq_equation"]);
25.420 -(*val p = e_pos'; val c = [];
25.421 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.422 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.423 -
25.424 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.425 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.426 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.427 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.428 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.429 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.430 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.431 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.432 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 2, x = -2]")) => ()
25.433 - | _ => raise error "polyeq.sml: diff.behav. in -4 + x^2 = 0 -> [x = 2, x = -2]";
25.434 -
25.435 -
25.436 -"----- d2_pqformula10_neg ------";
25.437 -val fmz = ["equality (4 + x^^^2 = 0)", "solveFor x","solutions L"];
25.438 -val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
25.439 - ["PolyEq","solve_d2_polyeq_pq_equation"]);
25.440 -(*val p = e_pos'; val c = [];
25.441 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.442 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.443 -
25.444 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.445 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.446 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.447 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.448 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.449 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.450 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.451 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.452 -"TODO 4 + x^^^2 = 0";
25.453 -"TODO 4 + x^^^2 = 0";
25.454 -"TODO 4 + x^^^2 = 0";
25.455 -
25.456 -"----- d2_pqformula10 ------";
25.457 -val fmz = ["equality (-4 + 1*x^^^2 = 0)", "solveFor x","solutions L"];
25.458 -val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
25.459 - ["PolyEq","solve_d2_polyeq_pq_equation"]);
25.460 -(*val p = e_pos'; val c = [];
25.461 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.462 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.463 -
25.464 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.465 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.466 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.467 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.468 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.469 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.470 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.471 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.472 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 2, x = -2]")) => ()
25.473 - | _ => raise error "polyeq.sml: diff.behav. in -4 + 1*x^2 = 0 -> [x = 2, x = -2]";
25.474 -
25.475 -"----- d2_pqformula9_neg ------";
25.476 -val fmz = ["equality (4 + 1*x^^^2 = 0)", "solveFor x","solutions L"];
25.477 -val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
25.478 - ["PolyEq","solve_d2_polyeq_pq_equation"]);
25.479 -(*val p = e_pos'; val c = [];
25.480 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.481 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.482 -
25.483 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.484 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.485 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.486 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.487 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.488 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.489 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.490 -"TODO 4 + 1*x^^^2 = 0";
25.491 -"TODO 4 + 1*x^^^2 = 0";
25.492 -"TODO 4 + 1*x^^^2 = 0";
25.493 -
25.494 -"-------------------- test thm's d2_abc_formulsxx[_neg]-----";
25.495 -"-------------------- test thm's d2_abc_formulsxx[_neg]-----";
25.496 -"-------------------- test thm's d2_abc_formulsxx[_neg]-----";
25.497 -
25.498 -val fmz = ["equality (-1 +(-1)*x + 2*x^^^2 = 0)", "solveFor x","solutions L"];
25.499 -val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
25.500 - ["PolyEq","solve_d2_polyeq_abc_equation"]);
25.501 -(*val p = e_pos'; val c = [];
25.502 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.503 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.504 -
25.505 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.506 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.507 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.508 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.509 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.510 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.511 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.512 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.513 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 1, x = -1 / 2]")) => ()
25.514 - | _ => raise error "polyeq.sml: diff.behav. in -1 + (-1)*x + 2*x^2 = 0 -> [x = 1, x = -1/2]";
25.515 -
25.516 -val fmz = ["equality ( 1 +(-1)*x + 2*x^^^2 = 0)", "solveFor x","solutions L"];
25.517 -val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
25.518 - ["PolyEq","solve_d2_polyeq_abc_equation"]);
25.519 -(*val p = e_pos'; val c = [];
25.520 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.521 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.522 -
25.523 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.524 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.525 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.526 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.527 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.528 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.529 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.530 -"TODO 1 +(-1)*x + 2*x^^^2 = 0";
25.531 -"TODO 1 +(-1)*x + 2*x^^^2 = 0";
25.532 -"TODO 1 +(-1)*x + 2*x^^^2 = 0";
25.533 -
25.534 -(*EP-11*)
25.535 -val fmz = ["equality (-1 + x + 2*x^^^2 = 0)", "solveFor x","solutions L"];
25.536 -val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
25.537 - ["PolyEq","solve_d2_polyeq_abc_equation"]);
25.538 -(*val p = e_pos'; val c = [];
25.539 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.540 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.541 -
25.542 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.543 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.544 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.545 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.546 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.547 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.548 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.549 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.550 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 1 / 2, x = -1]")) => ()
25.551 - | _ => raise error "polyeq.sml: diff.behav. in -1 + x + 2*x^2 = 0 -> [x = 1/2, x = -1]";
25.552 -
25.553 -val fmz = ["equality ( 1 + x + 2*x^^^2 = 0)", "solveFor x","solutions L"];
25.554 -val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
25.555 - ["PolyEq","solve_d2_polyeq_abc_equation"]);
25.556 -(*val p = e_pos'; val c = [];
25.557 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.558 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.559 -
25.560 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.561 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.562 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.563 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.564 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.565 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.566 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.567 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.568 -"TODO 1 + x + 2*x^^^2 = 0";
25.569 -"TODO 1 + x + 2*x^^^2 = 0";
25.570 -"TODO 1 + x + 2*x^^^2 = 0";
25.571 -
25.572 -val fmz = ["equality (-2 + 1*x + x^^^2 = 0)", "solveFor x","solutions L"];
25.573 -val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
25.574 - ["PolyEq","solve_d2_polyeq_abc_equation"]);
25.575 -(*val p = e_pos'; val c = [];
25.576 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.577 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.578 -
25.579 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.580 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.581 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.582 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.583 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.584 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.585 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.586 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.587 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 1, x = -2]")) => ()
25.588 - | _ => raise error "polyeq.sml: diff.behav. in -2 + 1*x + x^2 = 0 -> [x = 1, x = -2]";
25.589 -
25.590 -val fmz = ["equality ( 2 + 1*x + x^^^2 = 0)", "solveFor x","solutions L"];
25.591 -val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
25.592 - ["PolyEq","solve_d2_polyeq_abc_equation"]);
25.593 -(*val p = e_pos'; val c = [];
25.594 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.595 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.596 -
25.597 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.598 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.599 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.600 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.601 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.602 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.603 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.604 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.605 -"TODO 2 + 1*x + x^^^2 = 0";
25.606 -"TODO 2 + 1*x + x^^^2 = 0";
25.607 -"TODO 2 + 1*x + x^^^2 = 0";
25.608 -
25.609 -(*EP-12*)
25.610 -val fmz = ["equality (-2 + x + x^^^2 = 0)", "solveFor x","solutions L"];
25.611 -val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
25.612 - ["PolyEq","solve_d2_polyeq_abc_equation"]);
25.613 -(*val p = e_pos'; val c = [];
25.614 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.615 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.616 -
25.617 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.618 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.619 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.620 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.621 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.622 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.623 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.624 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.625 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 1, x = -2]")) => ()
25.626 - | _ => raise error "polyeq.sml: diff.behav. in -2 + x + x^2 = 0 -> [x = 1, x = -2]";
25.627 -
25.628 -val fmz = ["equality ( 2 + x + x^^^2 = 0)", "solveFor x","solutions L"];
25.629 -val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
25.630 - ["PolyEq","solve_d2_polyeq_abc_equation"]);
25.631 -(*val p = e_pos'; val c = [];
25.632 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.633 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.634 -
25.635 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.636 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.637 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.638 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.639 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.640 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.641 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.642 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.643 -"TODO 2 + x + x^^^2 = 0";
25.644 -"TODO 2 + x + x^^^2 = 0";
25.645 -"TODO 2 + x + x^^^2 = 0";
25.646 -
25.647 -(*EP-13*)
25.648 -val fmz = ["equality (-8 + 2*x^^^2 = 0)", "solveFor x","solutions L"];
25.649 -val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
25.650 - ["PolyEq","solve_d2_polyeq_abc_equation"]);
25.651 -(*val p = e_pos'; val c = [];
25.652 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.653 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.654 -
25.655 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.656 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.657 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.658 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.659 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.660 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.661 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.662 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.663 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 2, x = -2]")) => ()
25.664 - | _ => raise error "polyeq.sml: diff.behav. in -8 + 2*x^2 = 0 -> [x = 2, x = -2]";
25.665 -
25.666 -val fmz = ["equality ( 8+ 2*x^^^2 = 0)", "solveFor x","solutions L"];
25.667 -val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
25.668 - ["PolyEq","solve_d2_polyeq_abc_equation"]);
25.669 -(*val p = e_pos'; val c = [];
25.670 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.671 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.672 -
25.673 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.674 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.675 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.676 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.677 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.678 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.679 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.680 -"TODO 8+ 2*x^^^2 = 0";
25.681 -"TODO 8+ 2*x^^^2 = 0";
25.682 -"TODO 8+ 2*x^^^2 = 0";
25.683 -
25.684 -(*EP-14*)
25.685 -val fmz = ["equality (-4 + x^^^2 = 0)", "solveFor x","solutions L"];
25.686 -val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"], ["PolyEq","solve_d2_polyeq_abc_equation"]);
25.687 -(*val p = e_pos'; val c = [];
25.688 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.689 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.690 -
25.691 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.692 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.693 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.694 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.695 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.696 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.697 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.698 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.699 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 2, x = -2]")) => ()
25.700 - | _ => raise error "polyeq.sml: diff.behav. in -4 + x^2 = 0 -> [x = 2, x = -2]";
25.701 -
25.702 -
25.703 -val fmz = ["equality ( 4+ x^^^2 = 0)", "solveFor x","solutions L"];
25.704 -val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"], ["PolyEq","solve_d2_polyeq_abc_equation"]);
25.705 -(*val p = e_pos'; val c = [];
25.706 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.707 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.708 -
25.709 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.710 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.711 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.712 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.713 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.714 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.715 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.716 -"TODO 4+ x^^^2 = 0";
25.717 -"TODO 4+ x^^^2 = 0";
25.718 -"TODO 4+ x^^^2 = 0";
25.719 -
25.720 -(*EP-15*)
25.721 -val fmz = ["equality (2*x + 2*x^^^2 = 0)", "solveFor x","solutions L"];
25.722 -val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
25.723 - ["PolyEq","solve_d2_polyeq_abc_equation"]);
25.724 -(*val p = e_pos'; val c = [];
25.725 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.726 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.727 -
25.728 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.729 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.730 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.731 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.732 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.733 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.734 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.735 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.736 -case f of Form' (FormKF (~1,EdUndef,_,Nundef,"[x = 0, x = -1]")) => ()
25.737 - | _ => raise error "polyeq.sml: diff.behav. in x + x^2 = 0 -> [x = 0, x = -1]";
25.738 -
25.739 -val fmz = ["equality (1*x + x^^^2 = 0)", "solveFor x","solutions L"];
25.740 -val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
25.741 - ["PolyEq","solve_d2_polyeq_abc_equation"]);
25.742 -(*val p = e_pos'; val c = [];
25.743 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.744 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.745 -
25.746 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.747 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.748 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.749 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.750 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.751 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.752 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.753 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.754 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 0, x = -1]")) => ()
25.755 - | _ => raise error "polyeq.sml: diff.behav. in x + x^2 = 0 -> [x = 0, x = -1]";
25.756 -
25.757 -(*EP-16*)
25.758 -val fmz = ["equality (x + 2*x^^^2 = 0)", "solveFor x","solutions L"];
25.759 -val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
25.760 - ["PolyEq","solve_d2_polyeq_abc_equation"]);
25.761 -(*val p = e_pos'; val c = [];
25.762 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.763 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.764 -
25.765 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.766 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.767 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.768 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.769 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.770 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.771 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.772 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.773 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 0, x = -1 / 2]")) => ()
25.774 - | _ => raise error "polyeq.sml: diff.behav. in x + x^2 = 0 -> [x = 0, x = -1 / 2]";
25.775 -
25.776 -(*EP-//*)
25.777 -val fmz = ["equality (x + x^^^2 = 0)", "solveFor x","solutions L"];
25.778 -val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
25.779 - ["PolyEq","solve_d2_polyeq_abc_equation"]);
25.780 -(*val p = e_pos'; val c = [];
25.781 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.782 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.783 -
25.784 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.785 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.786 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.787 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.788 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.789 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.790 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.791 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.792 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 0, x = -1]")) => ()
25.793 - | _ => raise error "polyeq.sml: diff.behav. in x + x^2 = 0 -> [x = 0, x = -1]";
25.794 -
25.795 -"----------- (-8 - 2*x + x^^^2 = 0), (*Schalk 2, S.67 Nr.31.b----";
25.796 -"----------- (-8 - 2*x + x^^^2 = 0), (*Schalk 2, S.67 Nr.31.b----";
25.797 -"----------- (-8 - 2*x + x^^^2 = 0), (*Schalk 2, S.67 Nr.31.b----";
25.798 - val fmz = ["equality (-8 - 2*x + x^^^2 = 0)", (*Schalk 2, S.67 Nr.31.b*)
25.799 - "solveFor x","solutions L"];
25.800 - val (dI',pI',mI') =
25.801 - ("PolyEq.thy",["degree_2","expanded","univariate","equation"],
25.802 - ["PolyEq","complete_square"]);
25.803 -(* val p = e_pos'; val c = [];
25.804 - val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.805 - val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.806 -
25.807 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.808 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.809 - val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.810 - val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.811 - val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.812 - (*Apply_Method ("PolyEq.thy","complete_square")*)
25.813 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.814 - (*"-8 - 2 * x + x ^^^ 2 = 0", nxt = Rewrite_Set_Inst ... "complete_square*)
25.815 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.816 - (*"-8 + (2 / 2 - x) ^^^ 2 = (2 / 2) ^^^ 2", nxt = Rewrite("square_explicit1"*)
25.817 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.818 - (*"(2 / 2 - x) ^^^ 2 = (2 / 2) ^^^ 2 - -8" nxt = Rewrite("root_plus_minus*)
25.819 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.820 - (*"2 / 2 - x = sqrt ((2 / 2) ^^^ 2 - -8) |
25.821 - 2 / 2 - x = - sqrt ((2 / 2) ^^^ 2 - -8)" nxt = Rewr_Inst("bdv_explicit2"*)
25.822 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.823 - (*"2 / 2 - x = sqrt ((2 / 2) ^^^ 2 - -8) |
25.824 - -1*x = - (2 / 2) + - sqrt ((2 / 2) ^^^ 2 - -8)"nxt = R_Inst("bdv_explt2"*)
25.825 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.826 - (*"-1 * x = - (2 / 2) + sqrt ((2 / 2) ^^^ 2 - -8) |
25.827 - -1 * x = (- (2 / 2) + - sqrt ((2 / 2) ^^^ 2 - -8))"nxt = bdv_explicit3*)
25.828 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.829 - (*"-1 * x = - (2 / 2) + sqrt ((2 / 2) ^^^ 2 - -8) |
25.830 - x = -1 * (- (2 / 2) + - sqrt ((2 / 2) ^^^ 2 - -8))" nxt = bdv_explicit3*)
25.831 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.832 - (*"x = -1 * (- (2 / 2) + sqrt ((2 / 2) ^^^ 2 - -8)) |
25.833 - x = -1 * (- (2 / 2) + - sqrt ((2 / 2) ^^^ 2 - -8))"nxt = calculate_Ration*)
25.834 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.835 - (*"x = -2 | x = 4" nxt = Or_to_List*)
25.836 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.837 - (*"[x = -2, x = 4]" nxt = Check_Postcond*)
25.838 - val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
25.839 -(* FIXXXME
25.840 - case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = -2, x = 4]")) => () TODO
25.841 - | _ => raise error "polyeq.sml: diff.behav. in [x = -2, x = 4]";
25.842 -*)
25.843 -if f2str f = "[x = -1 * -1 + -1 * sqrt (1 ^^^ 2 - -8),\n x = -1 * -1 + -1 * (-1 * sqrt (1 ^^^ 2 - -8))]" then ()
25.844 -else raise error "polyeq.sml corrected?behav. in [x = -2, x = 4]";
25.845 -
25.846 -
25.847 -"-------------------- (3 - 10*x + 3*x^^^2 = 0), ----------------------";
25.848 -"-------------------- (3 - 10*x + 3*x^^^2 = 0), ----------------------";
25.849 -"-------------------- (3 - 10*x + 3*x^^^2 = 0), ----------------------";
25.850 -"---- test the erls ----";
25.851 - val t1 = (term_of o the o (parse thy)) "0 <= (10/3/2)^^^2 - 1";
25.852 - val SOME (t,_) = rewrite_set_ PolyEq.thy false PolyEq_erls t1;
25.853 - val t' = term2str t;
25.854 - (*if t'= "True" then ()
25.855 - else raise error "polyeq.sml: diff.behav. in 'rewrite_set_.. PolyEq_erls";*)
25.856 -(* *)
25.857 - val fmz = ["equality (3 - 10*x + 3*x^^^2 = 0)",
25.858 - "solveFor x","solutions L"];
25.859 - val (dI',pI',mI') =
25.860 - ("PolyEq.thy",["degree_2","expanded","univariate","equation"],
25.861 - ["PolyEq","complete_square"]);
25.862 -(* val p = e_pos'; val c = [];
25.863 - val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.864 - val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.865 -
25.866 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.867 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.868 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.869 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.870 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.871 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.872 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.873 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.874 - (*Apply_Method ("PolyEq.thy","complete_square")*)
25.875 - val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
25.876 -
25.877 -"----------- (-16 + 4*x + 2*x^^^2 = 0), --------------------------";
25.878 -"----------- (-16 + 4*x + 2*x^^^2 = 0), --------------------------";
25.879 -"----------- (-16 + 4*x + 2*x^^^2 = 0), --------------------------";
25.880 - val fmz = ["equality (-16 + 4*x + 2*x^^^2 = 0)",
25.881 - "solveFor x","solutions L"];
25.882 - val (dI',pI',mI') =
25.883 - ("PolyEq.thy",["degree_2","expanded","univariate","equation"],
25.884 - ["PolyEq","complete_square"]);
25.885 -(* val p = e_pos'; val c = [];
25.886 - val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.887 - val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.888 -
25.889 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.890 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.891 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.892 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.893 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.894 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.895 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.896 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.897 - (*Apply_Method ("PolyEq.thy","complete_square")*)
25.898 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.899 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.900 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.901 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.902 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.903 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.904 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.905 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.906 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.907 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.908 -(* FIXXXXME n1.,
25.909 - case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 2, x = -4]")) => () TODO
25.910 - | _ => raise error "polyeq.sml: diff.behav. in [x = 2, x = -4]";
25.911 -*)
25.912 -
25.913 -"----------- (a*b - (a+b)*x + x^^^2 = 0), (*Schalk 2,S.68Nr.44.a*)";
25.914 -"----------- (a*b - (a+b)*x + x^^^2 = 0), (*Schalk 2,S.68Nr.44.a*)";
25.915 -"----------- (a*b - (a+b)*x + x^^^2 = 0), (*Schalk 2,S.68Nr.44.a*)";
25.916 - val fmz = ["equality (a*b - (a+b)*x + x^^^2 = 0)",
25.917 - "solveFor x","solutions L"];
25.918 - val (dI',pI',mI') =
25.919 - ("PolyEq.thy",["degree_2","expanded","univariate","equation"],
25.920 - ["PolyEq","complete_square"]);
25.921 -(* val p = e_pos'; val c = [];
25.922 - val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.923 - val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.924 -
25.925 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.926 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.927 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.928 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.929 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.930 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.931 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.932 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.933 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.934 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.935 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.936 -
25.937 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.938 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.939 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.940 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.941 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.942 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.943 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.944 - val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
25.945 -(*WN.2.5.03 TODO FIXME Matthias ?
25.946 - case f of
25.947 - Form'
25.948 - (FormKF
25.949 - (~1,EdUndef,0,Nundef,
25.950 - "[x = (a + b) / 2 + -1 * sqrt ((a + b) ^^^ 2 / 2 ^^^ 2 - a * b),\n x = (a + b) / 2 + sqrt ((a + b) ^^^ 2 / 2 ^^^ 2 - a * b)]"))
25.951 - => ()
25.952 - | _ => raise error "polyeq.sml: diff.behav. in a*b - (a+b)*x + x^^^2 = 0";
25.953 - this will be simplified [x = a, x = b] to by Factor.ML*)
25.954 -
25.955 -
25.956 -"----------- (-64 + x^^^2 = 0), (*Schalk 2, S.66 Nr.1.a~--------*)";
25.957 -"----------- (-64 + x^^^2 = 0), (*Schalk 2, S.66 Nr.1.a~--------*)";
25.958 -"----------- (-64 + x^^^2 = 0), (*Schalk 2, S.66 Nr.1.a~--------*)";
25.959 - val fmz = ["equality (-64 + x^^^2 = 0)",(*Schalk 2, S.66 Nr.1.a~*)
25.960 - "solveFor x","solutions L"];
25.961 - val (dI',pI',mI') =
25.962 - ("PolyEq.thy",["degree_2","expanded","univariate","equation"],
25.963 - ["PolyEq","complete_square"]);
25.964 -(* val p = e_pos'; val c = [];
25.965 - val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.966 - val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.967 -
25.968 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.969 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.970 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.971 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.972 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.973 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.974 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.975 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.976 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.977 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.978 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.979 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.980 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.981 - val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
25.982 -(*WN.2.5.03 TODO "[x = sqrt (0 - -64), x = -1 * sqrt (0 - -64)]"
25.983 - case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 8, x = -8]")) => ()
25.984 - | _ => raise error "polyeq.sml: diff.behav. in [x = 8, x = -8]";
25.985 -*)
25.986 -
25.987 -"----------- (-147 + 3*x^^^2 = 0), (*Schalk 2, S.66 Nr.1.b------*)";
25.988 -"----------- (-147 + 3*x^^^2 = 0), (*Schalk 2, S.66 Nr.1.b------*)";
25.989 -"----------- (-147 + 3*x^^^2 = 0), (*Schalk 2, S.66 Nr.1.b------*)";
25.990 - val fmz = ["equality (-147 + 3*x^^^2 = 0)",(*Schalk 2, S.66 Nr.1.b*)
25.991 - "solveFor x","solutions L"];
25.992 - val (dI',pI',mI') =
25.993 - ("PolyEq.thy",["degree_2","expanded","univariate","equation"],
25.994 - ["PolyEq","complete_square"]);
25.995 -(* val p = e_pos'; val c = [];
25.996 - val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.997 - val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.998 -
25.999 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.1000 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.1001 - val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.1002 - val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.1003 - val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.1004 - val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.1005 - val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.1006 - val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.1007 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
25.1008 -(*WN.2.5.03 TODO "[x = sqrt (0 - -49), x = -1 * sqrt (0 - -49)]"
25.1009 - case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 7, x = -7]")) => ()
25.1010 - | _ => raise error "polyeq.sml: diff.behav. in [x = 7, x = -7]";
25.1011 -*)
25.1012 -if f2str f = "[x = sqrt (0 - -49), x = -1 * sqrt (0 - -49)]" then ()
25.1013 -else raise error "polyeq.sml CORRECTED?behav. in [x = 7, x = -7]";
25.1014 -
25.1015 -
25.1016 -"----------- (3*x - 1 - (5*x - (2 - 4*x)) = -11),(*Schalk Is86Bsp5";
25.1017 -"----------- (3*x - 1 - (5*x - (2 - 4*x)) = -11),(*Schalk Is86Bsp5";
25.1018 -"----------- (3*x - 1 - (5*x - (2 - 4*x)) = -11),(*Schalk Is86Bsp5";
25.1019 -(*EP-17 Schalk_I_p86_n5*)
25.1020 -val fmz = ["equality (3*x - 1 - (5*x - (2 - 4*x)) = -11)","solveFor x","solutions L"];
25.1021 -(* refine fmz ["univariate","equation"];
25.1022 -*)
25.1023 -val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
25.1024 -(*val p = e_pos';
25.1025 -val c = [];
25.1026 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.1027 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.1028 -
25.1029 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.1030 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1031 -(* val nxt =
25.1032 - ("Model_Problem",
25.1033 - Model_Problem ["normalize","polynomial","univariate","equation"])
25.1034 - : string * tac*)
25.1035 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1036 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1037 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1038 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1039 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1040 -(* val nxt =
25.1041 - ("Subproblem",
25.1042 - Subproblem ("PolyEq.thy",["polynomial","univariate","equation"]))
25.1043 - : string * tac *)
25.1044 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1045 -(*val nxt =
25.1046 - ("Model_Problem",
25.1047 - Model_Problem ["degree_1","polynomial","univariate","equation"])
25.1048 - : string * tac *)
25.1049 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1050 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1051 -
25.1052 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1053 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1054 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1055 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1056 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1057 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 2]")) => ()
25.1058 - | _ => raise error "polyeq.sml: diff.behav. in [x = 2]";
25.1059 -
25.1060 -
25.1061 -"----------- ((x+1)*(x+2) - (3*x - 2)^^^2=.. Schalk II s.68 Bsp 37";
25.1062 -"----------- ((x+1)*(x+2) - (3*x - 2)^^^2=.. Schalk II s.68 Bsp 37";
25.1063 -"----------- ((x+1)*(x+2) - (3*x - 2)^^^2=.. Schalk II s.68 Bsp 37";
25.1064 -(*is in rlang.sml, too*)
25.1065 -val fmz = ["equality ((x+1)*(x+2) - (3*x - 2)^^^2=(2*x - 1)^^^2+(3*x - 1)*(x+1))",
25.1066 - "solveFor x","solutions L"];
25.1067 -val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
25.1068 -
25.1069 -(*val p = e_pos'; val c = [];
25.1070 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.1071 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.1072 -
25.1073 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.1074 -(*val nxt = ("Refine_Tacitly",Refine_Tacitly ["univariate","equation"])*)
25.1075 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1076 -(* val nxt =
25.1077 - ("Model_Problem",
25.1078 - Model_Problem ["normalize","polynomial","univariate","equation"])
25.1079 - : string * tac *)
25.1080 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1081 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1082 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1083 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1084 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1085 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1086 -(* val nxt =
25.1087 - ("Subproblem",
25.1088 - Subproblem ("PolyEq.thy",["polynomial","univariate","equation"]))
25.1089 - : string * tac*)
25.1090 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1091 -(*val nxt =
25.1092 - ("Model_Problem",
25.1093 - Model_Problem ["abcFormula","degree_2","polynomial","univariate","equation"])
25.1094 - : string * tac*)
25.1095 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1096 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1097 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1098 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1099 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1100 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1101 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1102 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 2 / 15, x = 1]")) => ()
25.1103 - | _ => raise error "polyeq.sml: diff.behav. in [x = 2 / 15, x = 1]";
25.1104 -
25.1105 -
25.1106 -" -4 + x^^^2 =0 ";
25.1107 -" -4 + x^^^2 =0 ";
25.1108 -" -4 + x^^^2 =0 ";
25.1109 -val fmz = ["equality ( -4 + x^^^2 =0)", "solveFor x","solutions L"];
25.1110 -(* val fmz = ["equality (1 + x^^^2 =0)", "solveFor x","solutions L"];*)
25.1111 -(*val fmz = ["equality (0 =0)", "solveFor x","solutions L"];*)
25.1112 -val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
25.1113 -(*val p = e_pos';
25.1114 -val c = [];
25.1115 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
25.1116 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
25.1117 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
25.1118 -
25.1119 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1120 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1121 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1122 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1123 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1124 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1125 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
25.1126 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 2, x = -2]")) => ()
25.1127 - | _ => raise error "polyeq.sml: diff.behav. in [x = 2, x = -2]";
25.1128 -
25.1129 -"----------------- polyeq.sml end ------------------";
25.1130 -
25.1131 -(*Punkte aus dem TestBericht, die ich in rlang.sml nicht zuordnen konnte:*)
25.1132 -(*WN.19.3.03 ---v-*)
25.1133 -(*3(b)*)val (bdv,v) = (str2term "bdv", str2term "R1");
25.1134 -val t = str2term "-1 * (R * R2) + R2 * R1 + -1 * (R * R1) = 0";
25.1135 -val SOME (t',_) = rewrite_set_inst_ thy false [(bdv,v)] make_polynomial_in t;
25.1136 -term2str t';
25.1137 -"-1 * R * R2 + (R2 + -1 * R) * R1 = 0";
25.1138 -(*WN.19.3.03 ---^-*)
25.1139 -
25.1140 -(*3(c)*)val (bdv,v) = (str2term "bdv", str2term "p");
25.1141 -val t = str2term "y ^^^ 2 + -2 * (x * p) = 0";
25.1142 -val SOME (t',_) = rewrite_set_inst_ thy false [(bdv,v)] make_polynomial_in t;
25.1143 -term2str t';
25.1144 -"y ^^^ 2 + -2 * x * p = 0";
25.1145 -
25.1146 -(*3(d)*)val (bdv,v) = (str2term "bdv", str2term "x2");
25.1147 -val t = str2term
25.1148 -"A + x1 * (y3 * (1 / 2)) + x3 * (y2 * (1 / 2)) + -1 * (x1 * (y2 * (1 / 2))) + -1 * (x3 * (y1 * (1 / 2 ))) + y1 * (1 / 2 * x2) + -1 * (y3 * (1 / 2 * x2)) = 0";
25.1149 -val SOME (t',_) = rewrite_set_inst_ thy false [(bdv,v)] make_polynomial_in t;
25.1150 -term2str t';
25.1151 -"A + x1 * y3 * (1 / 2) + x3 * y2 * (1 / 2) + - x1 * y2 * (1 / 2) + - x3 * y1 * (1 / 2) + (y1 * (1 / 2) + - y3 * (1 / 2)) * x2 = 0";
25.1152 -val SOME (t',_) = rewrite_set_inst_ thy false [(bdv,v)] make_ratpoly_in t;
25.1153 -term2str t';
25.1154 -"A + x1 * y3 * (1 / 2) + x3 * y2 * (1 / 2) + -1 * x1 * y2 * (1 / 2) + -1 * x3 * y1 * (1 / 2) + (y1 * (1 / 2) + -1 * y3 * (1 / 2)) * x2 = 0";
25.1155 -
25.1156 -(*3(e)*)val (bdv,v) = (str2term "bdv", str2term "a");
25.1157 -val t = str2term
25.1158 -"A ^^^ 2 + c ^^^ 2 * (c / d) ^^^ 2 + (-4 * (c / d) ^^^ 2) * a ^^^ 2 = 0";
25.1159 -val NONE = rewrite_set_inst_ thy false [(bdv,v)] make_polynomial_in t;
25.1160 -(*die _unsichtbare_ Klammern sind genau wie gew"unscht*)
25.1161 -
25.1162 -
25.1163 -val t = str2term "(x + 1) * (x + 2) - (3 * x - 2) ^^^ 2 - ((2 * x - 1) ^^^ 2 + (3 * x - 1) * (x + 1)) = 0";
25.1164 -trace_rewrite:=true;
25.1165 -rewrite_set_ thy false expand_binoms t;
25.1166 -trace_rewrite:=false;
25.1167 -
25.1168 -
25.1169 -"----------- interSteps ([1],Res); on Schalk Is86Bsp5-------------";
25.1170 -"----------- interSteps ([1],Res); on Schalk Is86Bsp5-------------";
25.1171 -"----------- interSteps ([1],Res); on Schalk Is86Bsp5-------------";
25.1172 -states:=[];
25.1173 -CalcTree
25.1174 -[(["equality (3*x - 1 - (5*x - (2 - 4*x)) = -11)","solveFor x","solutions L"],
25.1175 - ("PolyEq.thy",["univariate","equation"],["no_met"]))];
25.1176 -Iterator 1;
25.1177 -moveActiveRoot 1;
25.1178 -autoCalculate 1 CompleteCalc;
25.1179 -val ((pt,p),_) = get_calc 1; show_pt pt;
25.1180 -
25.1181 -interSteps 1 ([1],Res) (*no Rewrite_Set...*);
26.1 --- a/test/Tools/isac/IsacKnowledge/polyminus.sml Mon Aug 30 14:29:49 2010 +0200
26.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
26.3 @@ -1,598 +0,0 @@
26.4 -(* tests on PolyMinus
26.5 - author: Walther Neuper
26.6 - WN071207,
26.7 - (c) due to copyright terms
26.8 -
26.9 -use"../smltest/IsacKnowledge/polyminus.sml";
26.10 -use"polyminus.sml";
26.11 -*)
26.12 -val thy = PolyMinus.thy;
26.13 -
26.14 -"-----------------------------------------------------------------";
26.15 -"table of contents -----------------------------------------------";
26.16 -"-----------------------------------------------------------------";
26.17 -"----------- fun eval_ist_monom ----------------------------------";
26.18 -"----------- watch order_add_mult -------------------------------";
26.19 -"----------- build predicate for +- ordering ---------------------";
26.20 -"----------- build fasse_zusammen --------------------------------";
26.21 -"----------- build verschoenere ----------------------------------";
26.22 -"----------- met simplification for_polynomials with_minus -------";
26.23 -"----------- pbl polynom vereinfachen p.33 -----------------------";
26.24 -"----------- met probe fuer_polynom ------------------------------";
26.25 -"----------- pbl polynom probe -----------------------------------";
26.26 -"----------- pbl klammer polynom vereinfachen p.34 ---------------";
26.27 -"----------- try fun applyTactics --------------------------------";
26.28 -"----------- pbl binom polynom vereinfachen p.39 -----------------";
26.29 -"----------- pbl binom polynom vereinfachen: cube ----------------";
26.30 -"----------- refine Vereinfache ----------------------------------";
26.31 -"-----------------------------------------------------------------";
26.32 -"-----------------------------------------------------------------";
26.33 -"-----------------------------------------------------------------";
26.34 -
26.35 -
26.36 -"----------- fun eval_ist_monom ----------------------------------";
26.37 -"----------- fun eval_ist_monom ----------------------------------";
26.38 -"----------- fun eval_ist_monom ----------------------------------";
26.39 -ist_monom (str2term "12");
26.40 -case eval_ist_monom 0 0 (str2term "12 ist_monom") 0 of
26.41 - SOME ("12 ist_monom = True", _) => ()
26.42 - | _ => raise error "polyminus.sml: 12 ist_monom = True";
26.43 -
26.44 -case eval_ist_monom 0 0 (str2term "a ist_monom") 0 of
26.45 - SOME ("a ist_monom = True", _) => ()
26.46 - | _ => raise error "polyminus.sml: a ist_monom = True";
26.47 -
26.48 -case eval_ist_monom 0 0 (str2term "(3*a) ist_monom") 0 of
26.49 - SOME ("3 * a ist_monom = True", _) => ()
26.50 - | _ => raise error "polyminus.sml: 3 * a ist_monom = True";
26.51 -
26.52 -case eval_ist_monom 0 0 (str2term "(a^^^2) ist_monom") 0 of
26.53 - SOME ("a ^^^ 2 ist_monom = True", _) => ()
26.54 - | _ => raise error "polyminus.sml: a^^^2 ist_monom = True";
26.55 -
26.56 -case eval_ist_monom 0 0 (str2term "(3*a^^^2) ist_monom") 0 of
26.57 - SOME ("3 * a ^^^ 2 ist_monom = True", _) => ()
26.58 - | _ => raise error "polyminus.sml: 3*a^^^2 ist_monom = True";
26.59 -
26.60 -case eval_ist_monom 0 0 (str2term "(a*b) ist_monom") 0 of
26.61 - SOME ("a * b ist_monom = True", _) => ()
26.62 - | _ => raise error "polyminus.sml: a*b ist_monom = True";
26.63 -
26.64 -case eval_ist_monom 0 0 (str2term "(3*a*b) ist_monom") 0 of
26.65 - SOME ("3 * a * b ist_monom = True", _) => ()
26.66 - | _ => raise error "polyminus.sml: 3*a*b ist_monom = True";
26.67 -
26.68 -
26.69 -"----------- watch order_add_mult -------------------------------";
26.70 -"----------- watch order_add_mult -------------------------------";
26.71 -"----------- watch order_add_mult -------------------------------";
26.72 -"----- with these simple variables it works...";
26.73 -trace_rewrite:=true;
26.74 -trace_rewrite:=false;
26.75 -val t = str2term "((a + d) + c) + b";
26.76 -val SOME (t,_) = rewrite_set_ thy false order_add_mult t; term2str t;
26.77 -if term2str t = "a + (b + (c + d))" then ()
26.78 -else raise error "polyminus.sml 1 watch order_add_mult";
26.79 -trace_rewrite:=false;
26.80 -
26.81 -"----- the same stepwise...";
26.82 -val od = ord_make_polynomial true Poly.thy;
26.83 -val t = str2term "((a + d) + c) + b";
26.84 -"((a + d) + c) + b";
26.85 -val SOME (t,_) = rewrite_ thy od e_rls true real_add_commute t; term2str t;
26.86 -"b + ((a + d) + c)";
26.87 -val SOME (t,_) = rewrite_ thy od e_rls true real_add_commute t; term2str t;
26.88 -"b + (c + (a + d))";
26.89 -val SOME (t,_) = rewrite_ thy od e_rls true real_add_left_commute t;term2str t;
26.90 -"b + (a + (c + d))";
26.91 -val SOME (t,_) = rewrite_ thy od e_rls true real_add_left_commute t;term2str t;
26.92 -"a + (b + (c + d))";
26.93 -if term2str t = "a + (b + (c + d))" then ()
26.94 -else raise error "polyminus.sml 2 watch order_add_mult";
26.95 -
26.96 -"----- if parentheses are right, left_commute is (almost) sufficient...";
26.97 -val t = str2term "a + (d + (c + b))";
26.98 -"a + (d + (c + b))";
26.99 -val SOME (t,_) = rewrite_ thy od e_rls true real_add_left_commute t;term2str t;
26.100 -"a + (c + (d + b))";
26.101 -val SOME (t,_) = rewrite_ thy od e_rls true real_add_commute t;term2str t;
26.102 -"a + (c + (b + d))";
26.103 -val SOME (t,_) = rewrite_ thy od e_rls true real_add_left_commute t;term2str t;
26.104 -"a + (b + (c + d))";
26.105 -
26.106 -"----- but we do not want the parentheses at right; thus: cond.rew.";
26.107 -"WN0712707 complicated monomials do not yet work ...";
26.108 -val t = str2term "((5*a + 4*d) + 3*c) + 2*b";
26.109 -val SOME (t,_) = rewrite_set_ thy false order_add_mult t; term2str t;
26.110 -if term2str t = "2 * b + (3 * c + (4 * d + 5 * a))" then ()
26.111 -else raise error "polyminus.sml: order_add_mult changed";
26.112 -
26.113 -"----- here we see rew_sub going into subterm with ord.rew....";
26.114 -val od = ord_make_polynomial false Poly.thy;
26.115 -val t = str2term "b + a + c + d";
26.116 -val SOME (t,_) = rewrite_ thy od e_rls false real_add_commute t; term2str t;
26.117 -val SOME (t,_) = rewrite_ thy od e_rls false real_add_commute t; term2str t;
26.118 -(*@@@ rew_sub gosub: t = d + (b + a + c)
26.119 - @@@ rew_sub begin: t = b + a + c*)
26.120 -
26.121 -
26.122 -"----------- build predicate for +- ordering ---------------------";
26.123 -"----------- build predicate for +- ordering ---------------------";
26.124 -"----------- build predicate for +- ordering ---------------------";
26.125 -"a" < "b";
26.126 -"ba" < "ab";
26.127 -"123" < "a"; (*unused due to ---vvv*)
26.128 -"12" < "3"; (*true !!!*)
26.129 -
26.130 -" a kleiner b ==> (b + a) = (a + b)";
26.131 -str2term "aaa";
26.132 -str2term "222 * aaa";
26.133 -(*
26.134 -case eval_kleiner 0 0 (str2term "123 kleiner 32") 0 of
26.135 - SOME ("12 kleiner 9 = False", _) => ()
26.136 - | _ => raise error "polyminus.sml: 12 kleiner 9 = False";
26.137 -*)
26.138 -case eval_kleiner 0 0 (str2term "a kleiner b") 0 of
26.139 - SOME ("a kleiner b = True", _) => ()
26.140 - | _ => raise error "polyminus.sml: a kleiner b = True";
26.141 -
26.142 -case eval_kleiner 0 0 (str2term "(10*g) kleiner f") 0 of
26.143 - SOME ("10 * g kleiner f = False", _) => ()
26.144 - | _ => raise error "polyminus.sml: 10 * g kleiner f = False";
26.145 -
26.146 -case eval_kleiner 0 0 (str2term "(a^^^2) kleiner b") 0 of
26.147 - SOME ("a ^^^ 2 kleiner b = True", _) => ()
26.148 - | _ => raise error "polyminus.sml: a ^^^ 2 kleiner b = True";
26.149 -
26.150 -case eval_kleiner 0 0 (str2term "(3*a^^^2) kleiner b") 0 of
26.151 - SOME ("3 * a ^^^ 2 kleiner b = True", _) => ()
26.152 - | _ => raise error "polyminus.sml: 3 * a ^^^ 2 kleiner b = True";
26.153 -
26.154 -case eval_kleiner 0 0 (str2term "(a*b) kleiner c") 0 of
26.155 - SOME ("a * b kleiner c = True", _) => ()
26.156 - | _ => raise error "polyminus.sml: a * b kleiner b = True";
26.157 -
26.158 -case eval_kleiner 0 0 (str2term "(3*a*b) kleiner c") 0 of
26.159 - SOME ("3 * a * b kleiner c = True", _) => ()
26.160 - | _ => raise error "polyminus.sml: 3 * a * b kleiner b = True";
26.161 -
26.162 -
26.163 -
26.164 -"----- compare tausche_plus with real_num_collect";
26.165 -val od = dummy_ord;
26.166 -
26.167 -val erls = erls_ordne_alphabetisch;
26.168 -val t = str2term "b + a";
26.169 -val SOME (t,_) = rewrite_ thy od erls false tausche_plus t; term2str t;
26.170 -if term2str t = "a + b" then ()
26.171 -else raise error "polyminus.sml: ordne_alphabetisch1 b + a";
26.172 -
26.173 -val erls = Atools_erls;
26.174 -val t = str2term "2*a + 3*a";
26.175 -val SOME (t,_) = rewrite_ thy od erls false real_num_collect t; term2str t;
26.176 -
26.177 -"----- test rewrite_, rewrite_set_";
26.178 -trace_rewrite:=true;
26.179 -val erls = erls_ordne_alphabetisch;
26.180 -val t = str2term "b + a";
26.181 -val SOME (t,_) = rewrite_set_ thy false ordne_alphabetisch t; term2str t;
26.182 -if term2str t = "a + b" then ()
26.183 -else raise error "polyminus.sml: ordne_alphabetisch a + b";
26.184 -
26.185 -val t = str2term "2*b + a";
26.186 -val SOME (t,_) = rewrite_set_ thy false ordne_alphabetisch t; term2str t;
26.187 -if term2str t = "a + 2 * b" then ()
26.188 -else raise error "polyminus.sml: ordne_alphabetisch a + 2 * b";
26.189 -
26.190 -val t = str2term "a + c + b";
26.191 -val SOME (t,_) = rewrite_set_ thy false ordne_alphabetisch t; term2str t;
26.192 -if term2str t = "a + b + c" then ()
26.193 -else raise error "polyminus.sml: ordne_alphabetisch a + b + c";
26.194 -
26.195 -"----- rewrite goes into subterms";
26.196 -val t = str2term "a + c + b + d";
26.197 -val SOME (t,_) = rewrite_ thy od erls false tausche_plus_plus t; term2str t;
26.198 -if term2str t = "a + b + c + d" then ()
26.199 -else raise error "polyminus.sml: ordne_alphabetisch1 a + b + c + d";
26.200 -
26.201 -val t = str2term "a + c + d + b";
26.202 -val SOME (t,_) = rewrite_set_ thy false ordne_alphabetisch t; term2str t;
26.203 -if term2str t = "a + b + c + d" then ()
26.204 -else raise error "polyminus.sml: ordne_alphabetisch2 a + b + c + d";
26.205 -
26.206 -"----- here we see rew_sub going into subterm with cond.rew....";
26.207 -val t = str2term "b + a + c + d";
26.208 -val SOME (t,_) = rewrite_ thy od erls false tausche_plus t; term2str t;
26.209 -if term2str t = "a + b + c + d" then ()
26.210 -else raise error "polyminus.sml: ordne_alphabetisch3 a + b + c + d";
26.211 -
26.212 -"----- compile rls for the most complicated terms";
26.213 -val t = str2term "5*e + 6*f - 8*g - 9 - 7*e - 4*f + 10*g + 12";
26.214 -"5 * e + 6 * f - 8 * g - 9 - 7 * e - 4 * f + 10 * g + 12";
26.215 -val SOME (t,_) = rewrite_set_ thy false ordne_alphabetisch t;
26.216 -if term2str t = "- 9 + 12 + 5 * e - 7 * e + 6 * f - 4 * f - 8 * g + 10 * g"
26.217 -then () else raise error "polyminus.sml: ordne_alphabetisch finished";
26.218 -
26.219 -
26.220 -"----------- build fasse_zusammen --------------------------------";
26.221 -"----------- build fasse_zusammen --------------------------------";
26.222 -"----------- build fasse_zusammen --------------------------------";
26.223 -val t = str2term "- 9 + 12 + 5 * e - 7 * e + 6 * f - 4 * f - 8 * g + 10 * g";
26.224 -val SOME (t,_) = rewrite_set_ thy false fasse_zusammen t;
26.225 -if term2str t = "3 + -2 * e + 2 * f + 2 * g" then ()
26.226 -else raise error "polyminus.sml: fasse_zusammen finished";
26.227 -
26.228 -"----------- build verschoenere ----------------------------------";
26.229 -"----------- build verschoenere ----------------------------------";
26.230 -"----------- build verschoenere ----------------------------------";
26.231 -val t = str2term "3 + -2 * e + 2 * f + 2 * g";
26.232 -val SOME (t,_) = rewrite_set_ thy false verschoenere t;
26.233 -if term2str t = "3 - 2 * e + 2 * f + 2 * g" then ()
26.234 -else raise error "polyminus.sml: verschoenere 3 + -2 * e ...";
26.235 -
26.236 -trace_rewrite:=true;
26.237 -trace_rewrite:=false;
26.238 -
26.239 -"----------- met simplification for_polynomials with_minus -------";
26.240 -"----------- met simplification for_polynomials with_minus -------";
26.241 -"----------- met simplification for_polynomials with_minus -------";
26.242 -val str =
26.243 -"Script SimplifyScript (t_::real) = \
26.244 -\ (((Try (Rewrite_Set ordne_alphabetisch False)) @@ \
26.245 -\ (Try (Rewrite_Set fasse_zusammen False)) @@ \
26.246 -\ (Try (Rewrite_Set verschoenere False))) t_)"
26.247 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
26.248 -atomty sc;
26.249 -
26.250 -
26.251 -"----------- pbl polynom vereinfachen p.33 -----------------------";
26.252 -"----------- pbl polynom vereinfachen p.33 -----------------------";
26.253 -"----------- pbl polynom vereinfachen p.33 -----------------------";
26.254 -"----------- 140 c ---";
26.255 -states:=[];
26.256 -CalcTree [(["term (5*e + 6*f - 8*g - 9 - 7*e - 4*f + 10*g + 12)",
26.257 - "normalform N"],
26.258 - ("PolyMinus.thy",["plus_minus","polynom","vereinfachen"],
26.259 - ["simplification","for_polynomials","with_minus"]))];
26.260 -moveActiveRoot 1;
26.261 -autoCalculate 1 CompleteCalc;
26.262 -val ((pt,p),_) = get_calc 1; show_pt pt;
26.263 -if p = ([], Res) andalso
26.264 - term2str (get_obj g_res pt (fst p)) = "3 - 2 * e + 2 * f + 2 * g"
26.265 -then () else raise error "polyminus.sml: Vereinfache (3 - 2 * e + 2 * f...";
26.266 -
26.267 -"----------- 140 d ---";
26.268 -states:=[];
26.269 -CalcTree [(["term (-r - 2*s - 3*t + 5 + 4*r + 8*s - 5*t - 2)",
26.270 - "normalform N"],
26.271 - ("PolyMinus.thy",["plus_minus","polynom","vereinfachen"],
26.272 - ["simplification","for_polynomials","with_minus"]))];
26.273 -moveActiveRoot 1;
26.274 -autoCalculate 1 CompleteCalc;
26.275 -val ((pt,p),_) = get_calc 1; show_pt pt;
26.276 -if p = ([], Res) andalso
26.277 - term2str (get_obj g_res pt (fst p)) = "3 + 3 * r + 6 * s - 8 * t"
26.278 -then () else raise error "polyminus.sml: Vereinfache 140 d)";
26.279 -
26.280 -
26.281 -"----------- 139 c ---";
26.282 -states:=[];
26.283 -CalcTree [(["term (3*e - 6*f - 8*e - 4*f + 5*e + 7*f)",
26.284 - "normalform N"],
26.285 - ("PolyMinus.thy",["plus_minus","polynom","vereinfachen"],
26.286 - ["simplification","for_polynomials","with_minus"]))];
26.287 -moveActiveRoot 1;
26.288 -autoCalculate 1 CompleteCalc;
26.289 -val ((pt,p),_) = get_calc 1; show_pt pt;
26.290 -if p = ([], Res) andalso
26.291 - term2str (get_obj g_res pt (fst p)) = "- (3 * f)"
26.292 -then () else raise error "polyminus.sml: Vereinfache 139 c)";
26.293 -
26.294 -"----------- 139 b ---";
26.295 -states:=[];
26.296 -CalcTree [(["term (8*u - 5*v - 5*u + 7*v - 6*u - 3*v)",
26.297 - "normalform N"],
26.298 - ("PolyMinus.thy",["plus_minus","polynom","vereinfachen"],
26.299 - ["simplification","for_polynomials","with_minus"]))];
26.300 -moveActiveRoot 1;
26.301 -autoCalculate 1 CompleteCalc;
26.302 -val ((pt,p),_) = get_calc 1; show_pt pt;
26.303 -if p = ([], Res) andalso
26.304 - term2str (get_obj g_res pt (fst p)) = "-3 * u - v"
26.305 -then () else raise error "polyminus.sml: Vereinfache 139 b)";
26.306 -
26.307 -"----------- 138 a ---";
26.308 -states:=[];
26.309 -CalcTree [(["term (2*u - 3*v - 6*u + 5*v)",
26.310 - "normalform N"],
26.311 - ("PolyMinus.thy",["plus_minus","polynom","vereinfachen"],
26.312 - ["simplification","for_polynomials","with_minus"]))];
26.313 -moveActiveRoot 1;
26.314 -autoCalculate 1 CompleteCalc;
26.315 -val ((pt,p),_) = get_calc 1; show_pt pt;
26.316 -if p = ([], Res) andalso
26.317 - term2str (get_obj g_res pt (fst p)) = "-4 * u + 2 * v"
26.318 -then () else raise error "polyminus.sml: Vereinfache 138 a)";
26.319 -
26.320 -
26.321 -"----------- met probe fuer_polynom ------------------------------";
26.322 -"----------- met probe fuer_polynom ------------------------------";
26.323 -"----------- met probe fuer_polynom ------------------------------";
26.324 -val str =
26.325 -"Script ProbeScript (e_::bool) (ws_::bool list) =\
26.326 -\ (let e_ = Take e_; \
26.327 -\ e_ = Substitute ws_ e_ \
26.328 -\ in (Repeat((Try (Repeat (Calculate times))) @@ \
26.329 -\ (Try (Repeat (Calculate plus ))) @@ \
26.330 -\ (Try (Repeat (Calculate minus))))) e_)"
26.331 -val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
26.332 -atomty sc;
26.333 -
26.334 -
26.335 -"----------- pbl polynom probe -----------------------------------";
26.336 -"----------- pbl polynom probe -----------------------------------";
26.337 -"----------- pbl polynom probe -----------------------------------";
26.338 -states:=[];
26.339 -CalcTree [(["Pruefe (5*e + 6*f - 8*g - 9 - 7*e - 4*f + 10*g + 12 =\
26.340 - \3 - 2 * e + 2 * f + 2 * g)",
26.341 - "mitWert [e = 1, f = 2, g = 3]",
26.342 - "Geprueft b"],
26.343 - ("PolyMinus.thy",["polynom","probe"],
26.344 - ["probe","fuer_polynom"]))];
26.345 -moveActiveRoot 1;
26.346 -autoCalculate 1 CompleteCalc;
26.347 -(* autoCalculate 1 CompleteCalcHead;
26.348 - autoCalculate 1 (Step 1);
26.349 - autoCalculate 1 (Step 1);
26.350 - val ((pt,p),_) = get_calc 1; term2str (get_obj g_res pt (fst p));
26.351 -@@@@@WN081114 gives "??.empty", all "Pruefe" are the same,
26.352 -although analogies work in interface.sml: FIXME.WN081114 in "Pruefe"*)
26.353 -val ((pt,p),_) = get_calc 1;
26.354 -if p = ([], Res) andalso term2str (get_obj g_res pt (fst p)) = "11 = 11"
26.355 -then () else raise error "polyminus.sml: Probe 11 = 11";
26.356 -show_pt pt;
26.357 -
26.358 -
26.359 -"----------- pbl klammer polynom vereinfachen p.34 ---------------";
26.360 -"----------- pbl klammer polynom vereinfachen p.34 ---------------";
26.361 -"----------- pbl klammer polynom vereinfachen p.34 ---------------";
26.362 -states:=[];
26.363 -CalcTree [(["term (2*u - 5 - (3 - 4*u) + (8*u + 9))",
26.364 - "normalform N"],
26.365 - ("PolyMinus.thy",["klammer","polynom","vereinfachen"],
26.366 - ["simplification","for_polynomials","with_parentheses"]))];
26.367 -moveActiveRoot 1;
26.368 -autoCalculate 1 CompleteCalc;
26.369 -val ((pt,p),_) = get_calc 1;
26.370 -if p = ([], Res) andalso
26.371 - term2str (get_obj g_res pt (fst p)) = "1 + 14 * u"
26.372 -then () else raise error "polyminus.sml: Vereinfache (2*u - 5 - (3 - ...";
26.373 -show_pt pt;
26.374 -
26.375 -"----- probe p.34 -----";
26.376 -states:=[];
26.377 -CalcTree [(["Pruefe (2*u - 5 - (3 - 4*u) + (8*u + 9) = 1 + 14 * u)",
26.378 - "mitWert [u = 2]",
26.379 - "Geprueft b"],
26.380 - ("PolyMinus.thy",["polynom","probe"],
26.381 - ["probe","fuer_polynom"]))];
26.382 -moveActiveRoot 1;
26.383 -autoCalculate 1 CompleteCalc;
26.384 -val ((pt,p),_) = get_calc 1;
26.385 -if p = ([], Res) andalso term2str (get_obj g_res pt (fst p)) = "29 = 29"
26.386 -then () else raise error "polyminus.sml: Probe 29 = 29";
26.387 -show_pt pt;
26.388 -
26.389 -
26.390 -"----------- try fun applyTactics --------------------------------";
26.391 -"----------- try fun applyTactics --------------------------------";
26.392 -"----------- try fun applyTactics --------------------------------";
26.393 -states:=[];
26.394 -CalcTree [(["term (5*e + 6*f - 8*g - 9 - 7*e - 4*f + 10*g + 12)",
26.395 - "normalform N"],
26.396 - ("PolyMinus.thy",["plus_minus","polynom","vereinfachen"],
26.397 - ["simplification","for_polynomials","with_minus"]))];
26.398 -moveActiveRoot 1;
26.399 -autoCalculate 1 CompleteCalcHead;
26.400 -autoCalculate 1 (Step 1);
26.401 -autoCalculate 1 (Step 1);
26.402 -val ((pt,p),_) = get_calc 1; show_pt pt;
26.403 -"----- 1 ^^^";
26.404 -fetchApplicableTactics 1 0 p;
26.405 -val appltacs = sel_appl_atomic_tacs pt p;
26.406 -applyTactic 1 p (hd appltacs) (*addiere_x_plus_minus*);
26.407 -val ((pt,p),_) = get_calc 1; show_pt pt;
26.408 -"----- 2 ^^^";
26.409 -trace_rewrite := true;
26.410 -val erls = erls_ordne_alphabetisch;
26.411 -val t = str2term "- 9 + 12 + 5 * e - 7 * e + (6 - 4) * f - 8 * g + 10 * g";
26.412 -val SOME (t',_) =
26.413 - rewrite_ Isac.thy e_rew_ord erls false tausche_minus t;
26.414 -term2str t'; "- 9 + 12 + 5 * e - 7 * e + (- 4 + 6) * f - 8 * g + 10 * g";
26.415 -
26.416 -val t = str2term "- 9 + 12 + 5 * e - 7 * e + (6 - 4) * f - 8 * g + 10 * g";
26.417 -val NONE =
26.418 - rewrite_ Isac.thy e_rew_ord erls false tausche_minus_plus t;
26.419 -
26.420 -val t = str2term "- 9 + 12 + 5 * e - 7 * e + (6 - 4) * f - 8 * g + 10 * g";
26.421 -val SOME (t',_) =
26.422 - rewrite_set_ Isac.thy false ordne_alphabetisch t;
26.423 -term2str t'; "- 9 + 12 + 5 * e - 7 * e - 8 * g + 10 * g + (- 4 + 6) * f";
26.424 -trace_rewrite := false;
26.425 -
26.426 -
26.427 -applyTactic 1 p (hd (sel_appl_atomic_tacs pt p)) (*tausche_minus*);
26.428 -val ((pt,p),_) = get_calc 1; show_pt pt;
26.429 -"----- 3 ^^^";
26.430 -applyTactic 1 p (hd (sel_appl_atomic_tacs pt p)) (**);
26.431 -val ((pt,p),_) = get_calc 1; show_pt pt;
26.432 -"----- 4 ^^^";
26.433 -applyTactic 1 p (hd (sel_appl_atomic_tacs pt p)) (**);
26.434 -val ((pt,p),_) = get_calc 1; show_pt pt;
26.435 -"----- 5 ^^^";
26.436 -applyTactic 1 p (hd (sel_appl_atomic_tacs pt p)) (**);
26.437 -val ((pt,p),_) = get_calc 1; show_pt pt;
26.438 -"----- 6 ^^^";
26.439 -
26.440 -(*<CALCMESSAGE> failure </CALCMESSAGE>
26.441 -applyTactic 1 p (hd (sel_appl_atomic_tacs pt p)) (**);
26.442 -val ((pt,p),_) = get_calc 1; show_pt pt;
26.443 -"----- 7 ^^^";
26.444 -*)
26.445 -
26.446 -autoCalculate 1 CompleteCalc;
26.447 -val ((pt,p),_) = get_calc 1; show_pt pt;
26.448 -(*independent from failure above: met_simp_poly_minus not confluent:
26.449 -(([9], Res), - (8 * g) + 10 * g + (3 - 2 * e + 2 * f)),
26.450 -(([], Res), - (8 * g) + 10 * g + (3 - 2 * e + 2 * f))]
26.451 -~~~~~~~~~~~###~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*)
26.452 -
26.453 -states:=[];
26.454 -CalcTree [(["term (- (8 * g) + 10 * g + h)",
26.455 - "normalform N"],
26.456 - ("PolyMinus.thy",["plus_minus","polynom","vereinfachen"],
26.457 - ["simplification","for_polynomials","with_minus"]))];
26.458 -moveActiveRoot 1;
26.459 -autoCalculate 1 CompleteCalc;
26.460 -val ((pt,p),_) = get_calc 1; show_pt pt;
26.461 -if p = ([], Res) andalso term2str (get_obj g_res pt (fst p)) = "2 * g + h"
26.462 -then () else raise error "polyminus.sml: addiere_vor_minus";
26.463 -
26.464 -
26.465 -states:=[];
26.466 -CalcTree [(["term (- (8 * g) + 10 * g + f)",
26.467 - "normalform N"],
26.468 - ("PolyMinus.thy",["plus_minus","polynom","vereinfachen"],
26.469 - ["simplification","for_polynomials","with_minus"]))];
26.470 -moveActiveRoot 1;
26.471 -autoCalculate 1 CompleteCalc;
26.472 -val ((pt,p),_) = get_calc 1; show_pt pt;
26.473 -if p = ([], Res) andalso term2str (get_obj g_res pt (fst p)) = "f + 2 * g"
26.474 -then () else raise error "polyminus.sml: tausche_vor_plus";
26.475 -
26.476 -
26.477 -"----------- pbl binom polynom vereinfachen p.39 -----------------";
26.478 -"----------- pbl binom polynom vereinfachen p.39 -----------------";
26.479 -"----------- pbl binom polynom vereinfachen p.39 -----------------";
26.480 -val rls = klammern_ausmultiplizieren;
26.481 -val t = str2term "(3 * a + 2) * (4 * a - 1)";
26.482 -val SOME (t,_) = rewrite_set_ thy false rls t; term2str t;
26.483 -"3 * a * (4 * a) - 3 * a * 1 + (2 * (4 * a) - 2 * 1)";
26.484 -val rls = discard_parentheses;
26.485 -val SOME (t,_) = rewrite_set_ thy false rls t; term2str t;
26.486 -"3 * a * 4 * a - 3 * a * 1 + (2 * 4 * a - 2 * 1)";
26.487 -val rls = ordne_monome;
26.488 -val SOME (t,_) = rewrite_set_ thy false rls t; term2str t;
26.489 -"3 * 4 * a * a - 1 * 3 * a + (2 * 4 * a - 1 * 2)";
26.490 -(*
26.491 -val t = str2term "3 * a * 4 * a";
26.492 -val rls = ordne_monome;
26.493 -val SOME (t,_) = rewrite_set_ thy false rls t; term2str t;
26.494 -*)
26.495 -val rls = klammern_aufloesen;
26.496 -val SOME (t,_) = rewrite_set_ thy false rls t; term2str t;
26.497 -"3 * 4 * a * a - 1 * 3 * a + 2 * 4 * a - 1 * 2";
26.498 -val rls = ordne_alphabetisch;
26.499 -(*TODO: make is_monom more general, a*a=a^2, ...*)
26.500 -val SOME (t,_) = rewrite_set_ thy false rls t; term2str t;
26.501 -"3 * 4 * a * a - 1 * 2 - 1 * 3 * a + 2 * 4 * a";
26.502 -(*GOON.WN080104
26.503 -val rls = fasse_zusammen;
26.504 -val SOME (t,_) = rewrite_set_ thy false rls t; term2str t;
26.505 -val rls = verschoenere;
26.506 -val SOME (t,_) = rewrite_set_ thy false rls t; term2str t;
26.507 -*)
26.508 -
26.509 -
26.510 -trace_rewrite := true;
26.511 -trace_rewrite := false;
26.512 -
26.513 -(*@@@@@@@*)
26.514 -states:=[];
26.515 -CalcTree [(["term ((3*a + 2) * (4*a - 1))",
26.516 - "normalform N"],
26.517 - ("PolyMinus.thy",["binom_klammer","polynom","vereinfachen"],
26.518 - ["simplification","for_polynomials","with_parentheses_mult"]))];
26.519 -moveActiveRoot 1;
26.520 -autoCalculate 1 CompleteCalc;
26.521 -val ((pt,p),_) = get_calc 1; show_pt pt;
26.522 -
26.523 -(*
26.524 -if p = ([], Res) andalso
26.525 - term2str (get_obj g_res pt (fst p)) = "1 + 14 * u"
26.526 -then () else raise error "polyminus.sml: Vereinfache (2*u - 5 - (3 - ...";
26.527 -*)
26.528 -
26.529 -
26.530 -"----------- pbl binom polynom vereinfachen: cube ----------------";
26.531 -"----------- pbl binom polynom vereinfachen: cube ----------------";
26.532 -"----------- pbl binom polynom vereinfachen: cube ----------------";
26.533 -states:=[];
26.534 -CalcTree [(["term (8*(a - q) + a - 2*q + 3*(a - 2*q))",
26.535 - "normalform N"],
26.536 - ("PolyMinus.thy",["binom_klammer","polynom","vereinfachen"],
26.537 - ["simplification","for_polynomials","with_parentheses_mult"]))];
26.538 -moveActiveRoot 1;
26.539 -autoCalculate 1 CompleteCalc;
26.540 -val ((pt,p),_) = get_calc 1; show_pt pt;
26.541 -
26.542 -
26.543 -"----------- refine Vereinfache ----------------------------------";
26.544 -"----------- refine Vereinfache ----------------------------------";
26.545 -"----------- refine Vereinfache ----------------------------------";
26.546 -val fmz = ["term (8*(a - q) + a - 2*q + 3*(a - 2*q))",
26.547 - "normalform N"];
26.548 -print_depth 11;
26.549 -val matches = refine fmz ["vereinfachen"];
26.550 -print_depth 3;
26.551 -
26.552 -"----- go into details, if it seems not to work -----";
26.553 -"--- does the predicate evaluate correctly ?";
26.554 -val t = str2term
26.555 - "matchsub (?a * (?b - ?c)) (8 * (a - q) + a - 2 * q + \
26.556 - \3 * (a - 2 * q))";
26.557 -val ma = eval_matchsub "" "Tools.matchsub" t thy;
26.558 -case ma of
26.559 - SOME ("matchsub (?a * (?b - ?c)) (8 * (a - q) + \
26.560 - \a - 2 * q + 3 * (a - 2 * q)) = True", _) => ()
26.561 - | _ => raise error "polyminus.sml matchsub (?a * (?b - ?c)...A";
26.562 -
26.563 -"--- does the respective prls rewrite ?";
26.564 -val prls = append_rls "prls_pbl_vereinf_poly" e_rls
26.565 - [Calc ("Poly.is'_polyexp", eval_is_polyexp ""),
26.566 - Calc ("Tools.matchsub", eval_matchsub ""),
26.567 - Thm ("or_true",or_true),
26.568 - (*"(?a | True) = True"*)
26.569 - Thm ("or_false",or_false),
26.570 - (*"(?a | False) = ?a"*)
26.571 - Thm ("not_true",num_str not_true),
26.572 - (*"(~ True) = False"*)
26.573 - Thm ("not_false",num_str not_false)
26.574 - (*"(~ False) = True"*)];
26.575 -trace_rewrite := true;
26.576 -val SOME (t', _) = rewrite_set_ thy false prls t;
26.577 -trace_rewrite := false;
26.578 -
26.579 -"--- does the respective prls rewrite the whole predicate ?";
26.580 -val t = str2term
26.581 - "Not (matchsub (?a * (?b + ?c)) (8 * (a - q) + a - 2 * q) | \
26.582 - \ matchsub (?a * (?b - ?c)) (8 * (a - q) + a - 2 * q) | \
26.583 - \ matchsub ((?b + ?c) * ?a) (8 * (a - q) + a - 2 * q) | \
26.584 - \ matchsub ((?b - ?c) * ?a) (8 * (a - q) + a - 2 * q) )";
26.585 -trace_rewrite := true;
26.586 -val SOME (t', _) = rewrite_set_ thy false prls t;
26.587 -trace_rewrite := false;
26.588 -if term2str t' = "False" then ()
26.589 -else raise error "polyminus.sml Not (matchsub (?a * (?b + ?c)) (8 ...";
26.590 -
26.591 -
26.592 -
26.593 -
26.594 -
26.595 -
26.596 -
26.597 -
26.598 -(*
26.599 -use"../smltest/IsacKnowledge/polyminus.sml";
26.600 -use"polyminus.sml";
26.601 - *)
27.1 --- a/test/Tools/isac/IsacKnowledge/rateq.sml Mon Aug 30 14:29:49 2010 +0200
27.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
27.3 @@ -1,145 +0,0 @@
27.4 -(* RL 09.02
27.5 - testexamples for RatEq, equations with fractions
27.6 -
27.7 - Compiler.Control.Print.printDepth:=10; (*4 default*)
27.8 - Compiler.Control.Print.printDepth:=5; (*4 default*)
27.9 - trace_rewrite:=true;
27.10 -
27.11 - use"kbtest/rateq.sml";
27.12 - *)
27.13 -"----------- rateq.sml begin--------";
27.14 -"---------(1/x=5) ---------------------";
27.15 -"--------- S.68, Bsp.: 40, ((x)/(x - 8) + (x - 8)/(x) = 26/5)---------------------";
27.16 -
27.17 -val t = (term_of o the o (parse RatEq.thy)) "(1/b+1/x=1) is_ratequation_in x";
27.18 -val SOME(t_, _) = rewrite_set_ RatEq.thy false RatEq_prls t;
27.19 -val result = term2str t_;
27.20 -if result <> "True" then raise error "rateq.sml: new behaviour 1:" else ();
27.21 -
27.22 -val t = (term_of o the o (parse RatEq.thy)) "(sqrt(x)=1) is_ratequation_in x";
27.23 -val SOME(t_, _) = rewrite_set_ RatEq.thy false RatEq_prls t;
27.24 -val result = term2str t_;
27.25 -if result <> "False" then raise error "rateq.sml: new behaviour 2:" else ();
27.26 -
27.27 -val t = (term_of o the o (parse RatEq.thy)) "(x=-1) is_ratequation_in x";
27.28 -val SOME(t_,_) = rewrite_set_ RatEq.thy false RatEq_prls t;
27.29 -val result = term2str t_;
27.30 -if result <> "False" then raise error "rateq.sml: new behaviour 3:" else ();
27.31 -
27.32 -val t = (term_of o the o (parse RatEq.thy)) "(3 + x^^^2 + 1/(x^^^2+3)=1) is_ratequation_in x";
27.33 -val SOME(t_,_) = rewrite_set_ RatEq.thy false RatEq_prls t;
27.34 -val result = term2str t_;
27.35 -if result <> "True" then raise error "rateq.sml: new behaviour 4:" else ();
27.36 -
27.37 -val result = match_pbl ["equality (x=1)","solveFor x","solutions L"]
27.38 - (get_pbt ["rational","univariate","equation"]);
27.39 -case result of NoMatch' _ => () | _ => raise error "rateq.sml: new behaviour: 5";
27.40 -
27.41 -val result = match_pbl ["equality (3 + x^^^2 + 1/(x^^^2+3)=1)","solveFor x","solutions L"]
27.42 - (get_pbt ["rational","univariate","equation"]);
27.43 -case result of Matches' _ => () | _ => raise error "rateq.sml: new behaviour: 6";
27.44 -
27.45 -
27.46 -(*---------rateq---- 23.8.02 ---------------------*)
27.47 -"---------(1/x=5) ---------------------";
27.48 -val fmz = ["equality (1/x=5)","solveFor x","solutions L"];
27.49 -(* refine fmz ["univariate","equation"];
27.50 - *)
27.51 -
27.52 -val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
27.53 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
27.54 -(* val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.55 - --------------------------------------- Refine_Tacitly*)
27.56 -(* nxt = ("Model_Problem",Model_Problem ["rational","univariate","equation"]) *)
27.57 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.58 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.59 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.60 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.61 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.62 -(* val nxt = ("Subproblem",Subproblem ("RatEq.thy",["univariate","equation"])*)
27.63 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.64 -(* val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.65 - --------------------------------------- Refine_Tacitly*)
27.66 -(*val nxt = ("Model_Problem", Model_Problem ["normalize","polynomial","univariate","equation"])*)
27.67 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.68 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.69 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.70 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.71 -(*val nxt = Apply_Method ["PolyEq", "normalize_poly"])*)
27.72 -
27.73 -(* get_obj g_fmz pt [2];
27.74 - *)
27.75 -
27.76 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.77 -(**** assoc_thm': 'all_left' not in 'RatEq.thy' (and parents)*)
27.78 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.79 -(* val nxt = ("Subproblem", Subproblem ("PolyEq.thy",["polynomial","univariate","equation"]))*)
27.80 -
27.81 -
27.82 -
27.83 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.84 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.85 -(* ("Model_Problem", Model_Problem ["degree_1","polynomial","univariate","equation"])*)
27.86 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.87 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.88 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.89 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.90 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.91 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.92 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.93 -(* "x = 1 / 5" *)
27.94 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.95 -if mout2str(f) = "Form' FormKF (~1,EdUndef,0,Nundef,([x = 1 / 5])" then ()
27.96 -else raise error "rateq.sml: new behaviour: [x = 1 / 5]";
27.97 -
27.98 -
27.99 -
27.100 -(*---------((x)/(x - 8) + (x - 8)/(x) = 26/5)---------------------*)
27.101 -"--------- S.68, Bsp.: 40, ((x)/(x - 8) + (x - 8)/(x) = 26/5)---------------------";
27.102 -(*EP Schalk_II_p68_n40*)
27.103 -val fmz = ["equality ((x)/(x - 8) + (x - 8)/(x) = 26/5)","solveFor x","solutions L"];
27.104 -(* val fmz = ["equality (3+x= 9*x^^^4+((1+2*x)/x^^^2)^^^2 + 6*(x^^^2*((1+2*x)/x^^^2)))",
27.105 - "solveFor x","solutions L"];*)
27.106 -
27.107 -(* refine fmz ["univariate","equation"];
27.108 -*)
27.109 -
27.110 -val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
27.111 -(*val p = e_pos';
27.112 -val c = [];
27.113 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
27.114 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
27.115 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
27.116 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.117 -(* nxt = ("Model_Problem",Model_Problem ["rational","univariate","equation"])*)
27.118 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.119 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.120 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.121 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.122 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.123 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.124 -(* nxt = ("Subproblem",Subproblem ("RatEq.thy",["univariate","equation"]))*)
27.125 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.126 -(* nxt = ("Model_Problem", Model_Problem ["normalize","polynomial","univariate","equation"])*)
27.127 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.128 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.129 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.130 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.131 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.132 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.133 -(* ("Subproblem", Subproblem ("PolyEq.thy",["polynomial","univariate","equation"])) *)
27.134 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.135 -(* nxt = ("Model_Problem", Model_Problem
27.136 - ["abcFormula","degree_2","polynomial","univariate","equation"])*)
27.137 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.138 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.139 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.140 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.141 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.142 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.143 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
27.144 -(* "x = -2, x = 10" *)
27.145 -if mout2str(f) = "Form' FormKF (~1,EdUndef,0,Nundef,([x = -2, x = 10])" then()
27.146 -else raise error "rateq.sml: new behaviour: [x = -2, x = 10]";
27.147 -
27.148 -"----------- rateq.sml end--------";
28.1 --- a/test/Tools/isac/IsacKnowledge/rational-old.sml Mon Aug 30 14:29:49 2010 +0200
28.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
28.3 @@ -1,902 +0,0 @@
28.4 -(* tests for rationals
28.5 - Stefan Karnel
28.6 - 2002
28.7 - use"../kbtest/rational.sml";
28.8 - use"kbtest/rational.sml";
28.9 - use"rational.sml";
28.10 -*)
28.11 -
28.12 -(*--------------------------------15.10.02---
28.13 -(* tests*)
28.14 -print("\n\n********************* tests *************************\n\n");
28.15 -print("\n\n***** divide tests *****\n");
28.16 -val mv_pquot1 = (#1(mv_division([(1,[1,1,1]),(1,[1,1,0]),(1,[1,0,1]),(1,[0,0,0])],[(1,[1,1,0]),(1,[0,0,0])],LEX_)));
28.17 -(* result: [(1,[0,0,1]),(1,[0,0,0])] *)
28.18 -if mv_pquot1=[(1,[0,0,1]),(1,[0,0,0])] then () else raise error ("Test failed");
28.19 -
28.20 -val mv_prest1 = (#2(mv_division([(1,[1,1,1]),(1,[1,1,0]),(1,[1,0,1]),(1,[0,0,0])],[(1,[1,1,0]),(1,[0,0,0])],LEX_)));
28.21 -(* result: [(1,[1,0,1]),(~1,[0,0,1])] *)
28.22 -if mv_prest1=[(1,[1,0,1]),(~1,[0,0,1])] then () else raise error ("Test failed");
28.23 -
28.24 -val mv_pquot2 = (#1(mv_division([(4,[2]),(8,[1]),(16,[0])],[(1,[1]),(1,[0])],LEX_)));
28.25 -(* result: [(4,[1]),(4,[0])] *)
28.26 -if mv_pquot2=[(4,[1]),(4,[0])] then () else raise error ("Test failed");
28.27 -
28.28 -val mv_prest2 = (#2(mv_division([(4,[2]),(8,[1]),(16,[0])],[(1,[1]),(1,[0])],LEX_)));
28.29 -(* result: [(12,[0]] *)
28.30 -if mv_prest2=[(12,[0])] then () else raise error ("Test failed");
28.31 -
28.32 -val mv_pquot3 = (#1(mv_division([(4,[2]),(~4,[0])],[(2,[1]),(2,[0])],LEX_)));
28.33 -(* [(2,[1]),(~2,[0])] *)
28.34 -if mv_pquot3=[(2,[1]),(~2,[0])] then () else raise error ("Test failed");
28.35 -
28.36 -val mv_prest3 = (#2(mv_division([(1,[2]),(~1,[0])],[(2,[1]),(2,[0])],LEX_)));
28.37 -(* [(1,[2]),(~1,[0])] *)
28.38 -if mv_prest3=[(1,[2]),(~1,[0])] then () else raise error ("Test failed");
28.39 -
28.40 -val mv_pquot4 = (#1(mv_division([(3,[1,1,1]),(4,[1,0,1]),(3,[0,0,1])],[(2,[1,0,0]),(4,[0,0,1])],LEX_)));
28.41 -(* [(1,[0,1,1])] *)
28.42 -if mv_pquot4=[(1,[0,1,1])] then () else raise error ("Test failed");
28.43 -
28.44 -val mv_prest4 = (#2(mv_division([(3,[1,1,1]),(4,[1,0,1]),(3,[0,0,1])],[(2,[1,0,0]),(4,[0,0,1])],GGO_)));
28.45 -(* [(1,[1,1,1]),(~4,[0,1,2]),(4,[1,0,1]),(3,[0,0,1])] *)
28.46 -if mv_prest4 =[(1,[1,1,1]),(~4,[0,1,2]),(4,[1,0,1]),(3,[0,0,1])] then () else raise error ("Test failed");
28.47 -
28.48 -val mv_pquot5 = (#1(mv_division([(3,[1,1,1]),(4,[1,0,1]),(3,[0,0,1]),(6,[2,1,3]),(4,[0,4,1]),(1,[2,2,1])],[(1,[0,0,1])],LEX_)));
28.49 -(* [(1,[2,2,0]),(6,[2,1,2]),(3,[1,1,0]),(4,[1,0,0]),(4,[0,4,0]),(3,[0,0,0])]*)
28.50 -if mv_pquot5=[(1,[2,2,0]),(6,[2,1,2]),(3,[1,1,0]),(4,[1,0,0]),(4,[0,4,0]),(3,[0,0,0])] then () else raise error ("Test failed");
28.51 -
28.52 -val mv_prest5 = (#2(mv_division([(3,[1,1,1]),(4,[1,0,1]),(3,[0,0,1]),(6,[2,1,3]),(4,[0,4,1]),(1,[2,2,1])],[(1,[0,0,1])],LEX_)));
28.53 -(* [] *)
28.54 -if mv_prest5=[] then () else raise error ("Test failed");
28.55 -
28.56 -(* (x^2 + 2(a+1)x + (a^2+2a+1)) / (x+a+1) = x+a+1 *)
28.57 -val mv_pquot6 = (#1(mv_division([(1,[2,0,0]),(2,[1,1,0]),(2,[1,0,0]),(1,[0,2,0]),(2,[0,1,0]),(1,[0,0,0])],[(1,[1,0,0]),(1,[0,1,0]),(1,[0,0,0])],LEX_)));
28.58 -if mv_pquot6=[(1,[1,0,0]),(1,[0,1,0]),(1,[0,0,0])] then () else raise error ("Test failed");
28.59 -
28.60 -val mv_prest6 = (#2(mv_division([(1,[2,0,0]),(2,[1,1,0]),(2,[1,0,0]),(1,[0,2,0]),(2,[0,1,0]),(1,[0,0,0])],[(1,[1,0,0]),(1,[0,1,0]),(1,[0,0,0])],LEX_)));
28.61 -if mv_prest6=[] then () else raise error ("Test failed");
28.62 -
28.63 -(* Exception tests *)
28.64 -(* mv_division ([(1,[0,0,0])],[(0,[1,2,3])],LEX_); *)
28.65 -
28.66 -print("\n\n***** MV_CONTENT-TESTS *****\n");
28.67 -val mv_cont1=mv_content([(1,[2,1]),(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,1]),(1,[0,0])]);
28.68 -(* [(1,[0,1]),(1,[0,0])] *)
28.69 -if mv_cont1=[(1,[0,1]),(1,[0,0])] then () else raise error ("Test failed");
28.70 -
28.71 -val mv_pp1=mv_pp([(1,[1,1]),(1,[1,0]),(1,[0,1]),(1,[0,0])]);
28.72 -(*[(1,[1,0]),(1,[0,0])]*)
28.73 -if mv_pp1=[(1,[1,0]),(1,[0,0])] then () else raise error ("Test failed");
28.74 -
28.75 -val mv_cont2=mv_content([(2,[1]),(4,[0])]);
28.76 -(* [(2,[0])] *)
28.77 -if mv_cont2=[(2,[0])] then () else raise error ("Test failed");
28.78 -
28.79 -val mv_pp2=mv_pp([(2,[1]),(4,[0])]);
28.80 -(* [(1,[1]),(2,[0])] *)
28.81 -if mv_pp2=[(1,[1]),(2,[0])] then () else raise error ("Test failed");
28.82 -
28.83 -val mv_cont3=mv_content[(8,[2,1,1]),(12,[1,0,2]),(10,[2,2,0]),(16,[1,1,1])];
28.84 -(* [(2,[0,0,0])] *)
28.85 -if mv_cont3=[(2,[0,0,0])] then () else raise error ("Test failed");
28.86 -
28.87 -val mv_pp3=mv_pp[(8,[2,1,1]),(12,[1,0,2]),(10,[2,2,0]),(16,[1,1,1])];
28.88 -(* [(5,[2,2,0]),(4,[2,1,1]),(8,[1,1,1]),(6,[1,0,2])] *)
28.89 -if mv_pp3=[(5,[2,2,0]),(4,[2,1,1]),(8,[1,1,1]),(6,[1,0,2])] then () else raise error ("Test failed");
28.90 -
28.91 -val mv_cont4=mv_content[(2,[2,1,0]),(3,[1,0,1]),(2,[1,1,0]),(3,[0,0,1])];
28.92 -(* [(1,[0,0,0])] *)
28.93 -if mv_cont4=[(1,[0,0,0])] then () else raise error ("Test failed");
28.94 -
28.95 -val mv_pp4=mv_pp [(2,[2,1,0]),(3,[1,0,1]),(2,[1,1,0]),(3,[0,0,1])];
28.96 -(* [(2,[2,1,0]),(2,[1,1,0]),(3,[1,0,1]),(3,[0,0,1])] *)
28.97 -if mv_pp4=[(2,[2,1,0]),(2,[1,1,0]),(3,[1,0,1]),(3,[0,0,1])] then () else raise error ("Test failed");
28.98 -
28.99 -val con1=mv_content([(9,[2,0]),(15,[1,1]),(12,[1,0]),(6,[0,2]),(12,[0,1])]);
28.100 -(* [(3,[0,0])] *)
28.101 -if con1=[(3,[0,0])] then () else raise error ("Test failed");
28.102 -
28.103 -val pp1=mv_pp([(9,[2,0]),(15,[1,1]),(12,[1,0]),(6,[0,2]),(12,[0,1])]);
28.104 -(* [(3,[2,0]),(5,[1,1]),(4,[1,0]),(2,[0,2]),(4,[0,1])] *)
28.105 -if pp1=[(3,[2,0]),(5,[1,1]),(4,[1,0]),(2,[0,2]),(4,[0,1])] then () else raise error ("Test failed");
28.106 -
28.107 -val con2=mv_content([(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,2]),(1,[0,1])]);
28.108 -(* [(1,[0,0])] *)
28.109 -if con2=[(1,[0,0])] then () else raise error ("Test failed");
28.110 -
28.111 -val pp2 =mv_pp([(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,2]),(1,[0,1])]);
28.112 -(* [(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,2]),(1,[0,1])] *)
28.113 -if pp2=[(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,2]),(1,[0,1])] then () else raise error ("Test failed");
28.114 -
28.115 -val cont1 = mv_content [(1,[2,1,0]),(2,[2,1,0])];
28.116 -(* [(3,[0,1,0])] *)
28.117 -if cont1=[(3,[0,1,0])] then () else raise error ("Test failed");
28.118 -
28.119 -val pp1 = mv_pp [(1,[2,1,0]),(2,[2,1,0])];
28.120 -(* [(1,[2,0,0])] *)
28.121 -if pp1=[(1,[2,0,0])] then () else raise error ("Test failed");
28.122 -
28.123 -val cont2 = mv_content [(4,[1,2,0]),(2,[2,1,0])];
28.124 -(* [(2,[0,1,0])] *)
28.125 -if cont2=[(2,[0,1,0])] then () else raise error ("Test failed");
28.126 -
28.127 -val pp2 = mv_pp [(4,[1,2,0]),(2,[2,1,0])];
28.128 -(* [(1,[2,0,0]),(2,[1,1,0])] *)
28.129 -if pp2=[(1,[2,0,0]),(2,[1,1,0])] then () else raise error ("Test failed");
28.130 -
28.131 -print("\n\n\n\n********************************************************\n\n");
28.132 -val cont3=mv_content [(65,[3,2,2]),(52,[3,2,1]),(26,[3,1,2]),(~95,[2,2,3]),(~76,[2,2,2]),(35,[2,2,1]),(28,[2,2,0]),(~38,[2,1,3]),(14,[2,1,1])];
28.133 -(*if cont3=[(1,[0,1,0])] then () else raise error ("Test failed"); *)
28.134 -val pp3=mv_pp [(65,[3,2,2]),(52,[3,2,1]),(26,[3,1,2]),(~95,[2,2,3]),(~76,[2,2,2]),(35,[2,2,1]),(28,[2,2,0]),(~38,[2,1,3]),(14,[2,1,1])];
28.135 -
28.136 -
28.137 -print("\n\n***** gcd-tests *****\n");
28.138 -val ggt1 = gcd_poly [(4,[2,2]),(8,[1,1]),(4,[0,0])] [(2,[1,1]),(2,[0,0])];
28.139 -(* [(2,[1,1]),(2,[0,0])] *)
28.140 -if ggt1=[(2,[1,1]),(2,[0,0])] then () else raise error ("Test failed");
28.141 -
28.142 -val ggt2 = gcd_poly [(8,[2,1,1]),(12,[1,0,2]),(10,[2,2,0]),(15,[1,1,1])] [(2,[2,1,0]),(3,[1,0,1]),(2,[1,1,0]),(3,[0,0,1])];
28.143 -(* [(2,[1,1,0]),(3,[0,0,1])] *)
28.144 -if ggt2=[(2,[1,1,0]),(3,[0,0,1])] then () else raise error ("Test failed");
28.145 -
28.146 -val ggt3 = gcd_poly [(1,[2,0,0]),(~2,[1,0,1]),(1,[0,0,2])] [(1,[1,0,0]),(~1,[0,0,1])];
28.147 -(* [(1,[1,0,0]),(~1,[0,0,1])] *)
28.148 -if ggt3=[(1,[1,0,0]),(~1,[0,0,1])] then () else raise error ("Test failed");
28.149 -
28.150 -val ggt4 = gcd_poly [(1,[2,1,0]),(2,[2,1,0])] [(5,[1,0,0])];
28.151 -(* [(1,[1,0,0])] *)
28.152 -if ggt4=[(1,[1,0,0])] then () else raise error ("Test failed");
28.153 -
28.154 -val ggt5 = gcd_poly [(4,[2,0,0]),(~8,[1,0,1]),(4,[0,0,2])] [(1,[2,0,0]),(~1,[0,0,2])];
28.155 -(* [(1,[1,0,0]),(~1,[0,0,1])] *)
28.156 -if ggt5=[(1,[1,0,0]),(~1,[0,0,1])] then () else raise error ("Test failed");
28.157 -
28.158 -val ggt6 = gcd_poly [(10,[2,1,1]),(14,[1,1,0]),(3,[1,0,1]),(20,[1,2,1])] [(5,[1,1,1]),(7,[2,1,1])];
28.159 -(* [(1,[0,0,0])] *)
28.160 -if ggt6=[(1,[1,0,0])] then () else raise error ("Test failed");
28.161 -
28.162 -val ggt7 = gcd_poly [(~169,[4,3,3]),(273,[4,2,2]),(247,[3,3,4]),(~91,[3,3,2]),(78,[3,3,1]),(~399,[3,2,3]),(147,[3,2,1]),(~114,[2,3,2]),(42,[2,3,0])] [(65,[3,2,2]),(52,[3,2,1]),(26,[3,1,2]),(~95,[2,2,3]),(~76,[2,2,2]),(35,[2,2,1]),(28,[2,2,0]),(~38,[2,1,3]),(14,[2,1,1])];
28.163 -(* [(13,[3,1,1]),(~19,[2,1,2]),(7,[2,1,0])] *)
28.164 -if ggt7=[(13,[3,1,1]),(~19,[2,1,2]),(7,[2,1,0])] then () else raise error ("Test failed");
28.165 -
28.166 -print("\n\n***** kgv-tests *****\n");
28.167 -val kgv1=lcm_poly [(10,[])] [(15,[])];
28.168 -(* [(30,[])] *)
28.169 -if kgv1=[(30,[])] then () else raise error ("Test failed");
28.170 -
28.171 -val kgv2=lcm_poly [(1,[2,0,0]),(~2,[1,0,1]),(1,[0,0,2])] [(1,[1,0,0]),(~1,[0,0,1])];
28.172 -(* [(1,[2,0,0]),(~2,[1,0,1]),(1,[0,0,2])] *)
28.173 -if kgv2=[(1,[2,0,0]),(~2,[1,0,1]),(1,[0,0,2])] then () else raise error ("Test failed");
28.174 -
28.175 -val kgv3=lcm_poly [(4,[2,0,0]),(~8,[1,0,1]),(4,[0,0,2])] [(1,[2,0,0]),(~1,[0,0,2])];
28.176 -(* [(4,[3,0,0]),(~4,[2,0,1]),(~4,[1,0,2]),(4,[0,0,3])] *)
28.177 -if kgv3=[(4,[3,0,0]),(~4,[2,0,1]),(~4,[1,0,2]),(4,[0,0,3])] then () else raise error ("Test failed");
28.178 -
28.179 -(*
28.180 -print("***** TERM2POLY-TESTS *****\n");
28.181 -val t0 = (term_of o the o (parse thy)) "3 * 4";
28.182 -val t1 = (term_of o the o (parse thy)) "27";
28.183 -val t11= (term_of o the o (parse thy)) "27 * c";
28.184 -val t2 = (term_of o the o (parse thy)) "b";
28.185 -val t23= (term_of o the o (parse thy)) "c^^^7";
28.186 -val t24= (term_of o the o (parse thy)) "5 * c^^^7";
28.187 -val t26= (term_of o the o (parse thy)) "a * b";
28.188 -val t3 = (term_of o the o (parse thy)) "2 + a";
28.189 -val t4 = (term_of o the o (parse thy)) "b + a";
28.190 -val t5 = (term_of o the o (parse thy)) "2 + a^^^3";*)
28.191 -val t6 = (term_of o the o (parse thy)) "5*a^^^2*b^^^3*c+4*a^^^4*b+2*a*c";
28.192 -val t7 = (term_of o the o (parse thy)) "a-b";
28.193 -(*
28.194 -(the o term2poly) t0;
28.195 -(the o term2poly) t1;
28.196 -(the o term2poly) t11;
28.197 -(the o term2poly) t2;
28.198 -(the o term2poly) t23;
28.199 -(the o term2poly) t24;
28.200 -(the o term2poly) t26;
28.201 -(the o term2poly) t3;
28.202 -(the o term2poly) t4;
28.203 -(the o term2poly) t5;
28.204 -(the o term2poly) t6;
28.205 -(the o term2poly) t7;*)
28.206 -
28.207 -
28.208 -print("\n\n***** STEP_CANCEL_TESTS: *****\n");
28.209 -(*
28.210 -val term2 = (term_of o the o (parse thy)) " (9 * a^^^2 * b) /// (6 * a * c)";
28.211 -val div2 = step_cancel term2;
28.212 -atomt div2;
28.213 -*)
28.214 -
28.215 -val term1 = (term_of o the o (parse thy)) "(10 * a^^^2 * b * c + 14 * a * b + 3 * a * c + 20 * a * b^^^2 * c) /// a";
28.216 -val div1 = step_cancel term1;
28.217 -(*if div1 = (term_of o the o (parse thy)) "((10 * a * b * c + 14 * b + 3 * c + 20 * b^^^2 * c) * a) /// (1 * a)" then () else raise raise error ("Test failed");*)
28.218 -
28.219 -val term2 = (term_of o the o (parse thy)) "(10 * a^^^2 * b * c + 14 * a * b + 3 * a * c + 20 * a * b^^^2 * c) /// (5 * a * b * c + 7 * a^^^2 * b * c) ";
28.220 -val div2 = step_cancel term2;
28.221 -(*if div2 = ([(10,[1,1,1]),(20,[0,2,1]),(14,[0,1,0]),(3,[0,0,1])],[(1,[1,0,0])],[(7,[1,1,1]),(5,[0,1,1])]) then () else raise raise error ("Test failed");*)
28.222 -
28.223 -
28.224 -val term3 = (term_of o the o (parse thy)) "(10 * a^^^2 * b * c) /// (1 * x * y * z) ";
28.225 -val div3 = step_cancel term3;
28.226 -
28.227 -
28.228 -
28.229 -(*val mul1=(term_of o the o (parse thy)) "(5*a*b*c+4*a*b+2*a*c)";
28.230 -val mul2=(the (term2poly((term_of o the o (parse thy)) "13*a^^^2*b*c+7*a*b-19*a*b*c^^^2")));
28.231 -val mul3=(the (term2poly((term_of o the o (parse thy)) "6*a*b^^^2-13*a^^^2*b^^^2*c^^^2+21*a^^^2*b*c")));
28.232 -val t1=mv_mul(mul1,mul2,LEX_);
28.233 -val t2=mv_mul(mul3,mul2,LEX_);
28.234 -val div3=step_cancel t1 t2;
28.235 -if div3=([(5,[0,1,1]),(4,[0,1,0]),(2,[0,0,1])],[(13,[3,1,1]),(~19,[2,1,2]),(7,[2,1,0])],[(~13,[1,2,2]),(21,[1,1,1]),(6,[0,2,0])]) then () else raise error ("Test failed");*)
28.236 -
28.237 -print("\n\n***** all tests successfull ;-) ******\n\n");
28.238 -
28.239 -
28.240 -
28.241 -val thy = Rational.thy;
28.242 -val rls = Prls {func=cancel};
28.243 -val t = (term_of o the o (parse thy))
28.244 - "(1 + 1 * a ^^^ 1)///(-2 + 2 * a ^^^ 2)";
28.245 -val (t,asm) = the (rewrite_set_ thy eval_rls false rls t);
28.246 -
28.247 -
28.248 -val thy' = "Rational.thy";
28.249 -val rls' = "cancel";
28.250 -val t' = "(1 + 1 * a ^^^ 1)///(-2 + 2 * a ^^^ 2)";
28.251 -val (t',asm') = the (rewrite_set thy' "eval_rls" false rls' t');
28.252 -(*if t' = "1 /// (-2 + 2 * a)" then ()
28.253 -else raise error "tests/rationals.sml(1): new behaviour";*)
28.254 -
28.255 -
28.256 -val thy' = "Rational.thy";
28.257 -val rls' = "cancel";
28.258 -val t' = "(10 * a^^^2 * b * c + 14 * a * b + 3 * a * c + 20 * a * b^^^2 * c) /// (5 * a * b * c + 7 * a^^^2 * b * c) ";
28.259 -val (t',asm') = the (rewrite_set thy' "eval_rls" false rls' t');
28.260 -
28.261 -val thy' = "Rational.thy";
28.262 -val rls' = "cancel";
28.263 -val t' = "(a^^^2 * b + 2 * a * b + b ) /// ( a^^^2 - 1 )";
28.264 -val (t',asm') = the (rewrite_set thy' "eval_rls" false rls' t');
28.265 -
28.266 -(*
28.267 -val term2 = (term_of o the o (parse thy)) "(a^^^2 * b + 2 * a * b + b ) /// ( a^^^2 - 1 )";
28.268 -val div2 = direct_cancel term2;
28.269 -val t = (term_of o the o (parse thy)) "(1 + 1 * a ^^^ 1)///(-2 + 2 * a ^^^ 2) = 0";*)
28.270 -
28.271 -
28.272 -
28.273 -(*WN folgendes aus examples he"uberkopiert ...*)
28.274 -
28.275 -(* examples from:
28.276 - Mathematik 1
28.277 - Schalk
28.278 - Reniets Verlag *)
28.279 -
28.280 -val thy' = "Rational.thy";
28.281 -val rls' = "cancel";
28.282 -val mp = "make_polynomial";
28.283 -
28.284 -(* page 63 *)
28.285 -
28.286 -print("\n\nexample 186:\n");
28.287 -print("a)\n");
28.288 -val e186a'="(14 * x * y) / ( x * y )";
28.289 -val e186a = the (rewrite_set thy' "rational_erls" false rls' e186a');
28.290 -print("b)\n");
28.291 -val e186b'="(60 * a * b) / ( 15 * a * b )";
28.292 -val e186b = the (rewrite_set thy' "rational_erls" false rls' e186b');
28.293 -print("c)\n");
28.294 -val e186c'="(144 * a^^^2 * b * c) / (12 * a * b * c )";
28.295 -val e186c = (the (rewrite_set thy' "rational_erls" false rls' e186c'))
28.296 - handle e => print_exn e;
28.297 -val t = (term_of o the o (parse thy)) e186c';
28.298 -atomt t;
28.299 -
28.300 -print("\n\nexample 187:\n");
28.301 -print("a)\n");
28.302 -val e187a'="(12 * x * y) / (8 * y^^^2 )";
28.303 -val e187a = the (rewrite_set thy' "rational_erls" false rls' e187a');
28.304 -print("b)\n");
28.305 -val e187b'="(8 * x^^^2 * y * z ) / (18 * x * y^^^2 * z )";
28.306 -val e187b = the (rewrite_set thy' "rational_erls" false rls' e187b');
28.307 -print("c)\n");
28.308 -val e187c'="(9 * x^^^5 * y^^^2 * z^^^4) / (15 * x^^^6 * y^^^3 * z )";
28.309 -val e187c = the (rewrite_set thy' "rational_erls" false rls' e187c');
28.310 -
28.311 -print("\n\nexample 188:\n");
28.312 -print("a)\n");
28.313 -val e188a'="(8 * x + -8) / (9 * x + -9 )";
28.314 -val e188a = the (rewrite_set thy' "rational_erls" false rls' e188a');
28.315 -val SOME (t,_) = rewrite_set thy' "rational_erls" false mp "(8*((-1) + x))/(9*((-1) + x))";
28.316 -if t="((-8) + 8 * x) / ((-9) + 9 * x)"then()
28.317 -else raise error "rationals.sml: e188a new behaviour";
28.318 -print("b)\n");
28.319 -val e188b'="(5 * x + -15) / (6 * x + -18 )";
28.320 -val e188b = the (rewrite_set thy' "rational_erls" false rls' e188b');
28.321 -print("c)\n");
28.322 -val e188c'="( a + -1 * b ) / ( b + -1 * a )";
28.323 -val e188c = the (rewrite_set thy' "rational_erls" false rls' e188c');
28.324 -val SOME (t,_) = rewrite_set thy' "rational_erls" false mp "((-1)*(b + (-1) * a))/(1*(b + (-1) * a))";
28.325 -if t="(a + -1 * b) / (b + -1 * a)"then()
28.326 -else raise error "rationals.sml: e188c new behaviour";
28.327 -
28.328 -print("\n\nexample 190:\n");
28.329 -print("c)\n");
28.330 -val e190c'="( 27 * a^^^3 + 9 * a^^^2 + 3 * a + 1 ) / ( 27 * a^^^3 + 18 * a^^^2 + 3 * a )";
28.331 -val e190c = the (rewrite_set thy' "rational_erls" false rls' e190c');
28.332 -val SOME (t,_) = rewrite_set thy' "rational_erls" false mp "((1 + 9 * a ^^^ 2)*(1 + 3 * a))/((3 * a + 9 * a ^^^ 2)*(1 + 3 * a))";
28.333 -if t="(1 + (3 * a + (27 * a ^^^ 3 + 9 * a ^^^ 2))) /\n(3 * a + (18 * a ^^^ 2 + 27 * a ^^^ 3))"then()
28.334 -(*TERMORDER ~~~~~~~ ~~~~~~~*)
28.335 -else raise error "rationals.sml: e190c new behaviour";
28.336 -
28.337 -print("\n\nexample 191:\n");
28.338 -print("a)\n");
28.339 -val e191a'="( x^^^2 + -1 * y^^^2 ) / ( x + y )";
28.340 -val e191a = the (rewrite_set thy' "rational_erls" false rls' e191a');
28.341 -val SOME (t,_) = rewrite_set thy' "rational_erls" false mp "((x + (-1) * y)*(x + y))/((1)*(x + y))";
28.342 -if t="(x ^^^ 2 + -1 * y ^^^ 2) / (x + y)"then()
28.343 -else raise error "rationals.sml: e191a new behaviour";
28.344 -print("c)\n");
28.345 -val e191c'="( 9 * x^^^2 + -30 * x + 25 ) / ( 9 * x^^^2 + -25 )";
28.346 -val e191c = the (rewrite_set thy' "rational_erls" false rls' e191c');
28.347 -val SOME (t,_) = rewrite_set thy' "rational_erls" false mp "(((-5) + 3 * x)*((-5) + 3 * x))/((5 + 3 * x)*((-5) + 3 * x))";
28.348 -if t="(25 + ((-30) * x + 9 * x ^^^ 2)) / ((-25) + 9 * x ^^^ 2)"then()
28.349 -else raise error "rationals.sml: 'e191c' new behaviour";
28.350 -
28.351 -print("\n\nexample 192:\n");
28.352 -print("b)\n");
28.353 -val e192b'="( 7 * x^^^3 + -1 * x^^^2 * y ) / ( 7 * x * y^^^2 + -1 * y^^^3 )";
28.354 -val e192b = the (rewrite_set thy' "rational_erls" false rls' e192b');
28.355 -val SOME (t,_) = rewrite_set thy' "rational_erls" false mp "((x ^^^ 2)*(7 * x + (-1) * y))/((y ^^^ 2)*(7 * x + (-1) * y))";
28.356 -if t="(7 * x ^^^ 3 + -1 * (y * x ^^^ 2)) / (-1 * y ^^^ 3 + 7 * (x * y ^^^ 2))"then()
28.357 -(*TERMORDER ~~~~~*)
28.358 -else raise error "rationals.sml: 'e192b' new behaviour";
28.359 -
28.360 -print("\n\nexample 193:\n");
28.361 -print("a)\n");
28.362 -val e193a'="( x^^^2 + -6 * x + 9 ) / ( x^^^2 + -9 )";
28.363 -val e193a = the (rewrite_set thy' "rational_erls" false rls' e193a');
28.364 -print("b)\n");
28.365 -val e193b'="( x^^^2 + -8 * x + 16 ) / ( 2 * x^^^2 + -32 )";
28.366 -val e193b = the (rewrite_set thy' "rational_erls" false rls' e193b');
28.367 -print("c)\n");
28.368 -val e193c'="( 2 * x + -50 * x^^^3 ) / ( 25 * x^^^2 + -10 * x + 1 )";
28.369 -val SOME(t,_) = rewrite_set thy' "rational_erls" false rls' e193c';
28.370 ---------------------------------15.10.02---*)
28.371 -
28.372 -
28.373 -(*---------- WN: 10.9.02:
28.374 -ML> val e204a = the (rewrite_set thy' "rational_erls" false rls' e204a');
28.375 -*** RATIONALS_STEP_CANCEL_EXCEPTION: Invalid fraction
28.376 -print("\n\nexample 204:\n");
28.377 -print("a)\n");
28.378 -val e204a'="((5 * x) / 9) + ((3 * x) / 9) + (x / 9)";
28.379 -val e204a = the (rewrite_set thy' "rational_erls" false rls' e204a');
28.380 -print("b)\n");
28.381 -val e204b'="5 / x + -3 / x + -1 / x";
28.382 -val e204b = the (rewrite_set thy' "rational_erls" false rls' e204b');
28.383 -
28.384 -print("\n\nexample 205:\n");
28.385 -print("a)\n");
28.386 -val e205a'="((4 * x + 7) / 8) + ((4 * x + 3) / 8)";
28.387 -val e205a = the (rewrite_set thy' "rational_erls" false rls' e205a');
28.388 -print("b)\n");
28.389 -val e205b'="((5 * x + 2) / 3) + ((-2 * x + 1) / 3)";
28.390 -val e205b = the (rewrite_set thy' "rational_erls" false rls' e205b');
28.391 -
28.392 -print("\n\nexample 206:\n");
28.393 -print("a)\n");
28.394 -val e206a'="((5 * x + 4) / (2 * x + -1)) + ((9 * x + 5) / (2 * x + -1))";
28.395 -val e206a = the (rewrite_set thy' "rational_erls" false rls' e206a');
28.396 -print("b)\n");
28.397 -val e206b'="((17 * x + -23) / (5 * x + 4)) + ((-25 + -17 * x) / (5 * x + 4))";
28.398 -val e206b = the (rewrite_set thy' "rational_erls" false rls' e206b');
28.399 -
28.400 -print("\n\nexample 207:\n");
28.401 -val e207'="((3 * x * y + 3 * y) / (x * y)) + ((5 * x * y + 7 * y) / (x * y)) + ((9 * x * y + -2 * y) / (x * y)) + ((x * y + 4 * y) / (x * y)) ";
28.402 -val e207 = the (rewrite_set thy' "rational_erls" false rls' e207');
28.403 -
28.404 -print("\n\nexample 208:\n");
28.405 -val e208'="((3 * x + 2) / (x + 2)) + ((5 * x + -1) / (x + 2)) + ((-7 * x + -3) / (x + 2)) + ((-1 * x + -3) / (x + 2)) ";
28.406 -val e208 = the (rewrite_set thy' "rational_erls" false rls' e208');
28.407 -
28.408 -print("\n\nexample 209:\n");
28.409 -val e209'="((3 * x + -7 * y + 3 * z) / (4)) + ((2 * x + 17 * y + 10 * z) / (4)) + ((-1 * x + 2 * y + z) / (4)) ";
28.410 -val e209 = the (rewrite_set thy' "rational_erls" false rls' e209');
28.411 -
28.412 -print("\n\nexample 210:\n");
28.413 -val e210'="((2 * x + 3 + -1 * x^^^2) / (5 * x)) + ((5 * x^^^2 + -2 * x + 1) / (5 * x)) + ((-3 * x^^^2 + -2 * x + 1) / (5 * x)) + ((-1 * x^^^2 + -3 * x + -5) / (5 * x)) ";
28.414 -val e210 = the (rewrite_set thy' "rational_erls" false rls' e210');
28.415 -
28.416 -print("\n\nexample 211:\n");
28.417 -print("a)\n");
28.418 -val e211a'="((b) / (a + -1 * b)) + ((-1 * a) / (a + -1 * b))";
28.419 -val e211a = the (rewrite_set thy' "rational_erls" false rls' e211a');
28.420 -print("b)\n");
28.421 -val e211b'="((b) / (b^^^2 + -1 * a^^^2)) + ((-1 * a) / (b^^^2 + -1 * a^^^2))";
28.422 -val e211b = the (rewrite_set thy' "rational_erls" false rls' e211b');
28.423 -
28.424 -print("\n\nexample 212:\n");
28.425 -print("a)\n");
28.426 -val e212a'="((4) / (x)) + ((-3) / (y)) + -1";
28.427 -val e212a = the (rewrite_set thy' "rational_erls" false rls' e212a');
28.428 -print("b)\n");
28.429 -val e212b'="((4) / (x)) + ((-5) / (y)) + ((6) / (x*y))";
28.430 -val e212b = the (rewrite_set thy' "rational_erls" false rls' e212b');
28.431 -
28.432 -print("\n\nexample 213:\n");
28.433 -print("a)\n");
28.434 -val e213a'="((5 * x) / (3 * y^^^2)) + ((19 * z) / (6 * x * y)) + ((-2 * x) / (3 * y^^^2)) + ((7 * y^^^2) / (6 * x^^^2)) ";
28.435 -val e213a = the (rewrite_set thy' "rational_erls" false rls' e213a');
28.436 -print("b)\n");
28.437 -val e213b'="((2 * b) / (3 * a^^^2)) + ((3 * c) / (7 * a * b)) + ((4 * b) / (3 * a^^^2)) + ((3 * a) / (7 * b^^^2))";
28.438 -val e213b = the (rewrite_set thy' "rational_erls" false rls' e213b');
28.439 -
28.440 -print("\n\nexample 214:\n");
28.441 -print("a)\n");
28.442 -val e214a'="((3 * x + 2 * y + 2 * z) / (4)) + ((-5 * x + -3 * y) / (3)) + ((x + y + -2 * z) / (2))";
28.443 -val e214a = the (rewrite_set thy' "rational_erls" false rls' e214a');
28.444 -print("b)\n");
28.445 -val e214b'="((5 * x + 2 * y + z) / (2)) + ((-7 * x + -3 * y) / (3)) + ((3 * x + 6 * y + -1 * z) / (12))";
28.446 -val e214b = the (rewrite_set thy' "rational_erls" false rls' e214b');
28.447 -
28.448 -print("\n\nexample 216:\n");
28.449 -print("a)\n");
28.450 -val e216a'="((2 * b + 3 * c) / (a * c)) + ((3 * a + b) / (a * b)) + ((-2 * b^^^2 + -3 * a * c) / (a * b * c))";
28.451 -val e216a = the (rewrite_set thy' "rational_erls" false rls' e216a');
28.452 -print("b)\n");
28.453 -val e216b'="((2 * a + 3 * b) / (b * c)) + ((3 * c + a) / (a * c)) + ((-2 * a^^^2 + -3 * b * c) / (a * b * c))";
28.454 -val e216b = the (rewrite_set thy' "rational_erls" false rls' e216b');
28.455 -
28.456 -print("\n\nexample 217:\n");
28.457 -val e217'="((z + -1) / (z)) + ((3 * z ^^^2 + -6 * z + 5) / (z^^^2)) + ((-4 * z^^^3 + 7 * z^^^2 + -5 * z + 5) / (z^^^3))";
28.458 -val e217 = the (rewrite_set thy' "rational_erls" false rls' e217');
28.459 -
28.460 -print("\n\nexample 218:\n");
28.461 -val e218'="((9 * a^^^3 - 5 * a^^^2 + 2 * a + 8) / (108 * a^^^4)) + ((-5 * a + 3 * a^^^2 + 4) / (8 * a^^^3)) + ((-261 * a^^^3 + 19 * a^^^2 + -112 * a + 16) / (216 * a^^^4))";
28.462 -val e218 = the (rewrite_set thy' "rational_erls" false rls' e218');
28.463 -
28.464 -print("\n\nexample 219:\n");
28.465 -print("a)\n");
28.466 -val e219a'="((1) / (y + 1)) + ((1) / (y + 2)) + ((1) / (y + 3))";
28.467 -val e219a = the (rewrite_set thy' "rational_erls" false rls' e219a');
28.468 -print("b)\n");
28.469 -val e219b'="((1) / (x + 1)) + ((1) / (x + 2)) + ((-2) / (x + 3))";
28.470 -val e219b = the (rewrite_set thy' "rational_erls" false rls' e219b');
28.471 -
28.472 -print("\n\nexample 220:\n");
28.473 -print("a)\n");
28.474 -val e220a'="((17) / (5 * r + -2)) + ((-13) / (2 * r + 3)) + ((4) / (3 * r + -5))";
28.475 -val e220a = the (rewrite_set thy' "rational_erls" false rls' e220a');
28.476 -print("b)\n");
28.477 -val e220b'="((20 * a) / (a + -3)) + ((-19 * a) / (a + -4)) + ((a) / (a + -5))";
28.478 -val e220b = the (rewrite_set thy' "rational_erls" false rls' e220b');
28.479 -
28.480 -print("\n\nexample 221:\n");
28.481 -print("a)\n");
28.482 -val e221a'="((a + b) / (a + -1 * b)) + ((a + -1 * b) / (a + b))";
28.483 -val e221a = the (rewrite_set thy' "rational_erls" false rls' e221a');
28.484 -print("b)\n");
28.485 -val e221b'="((x + -1 * y) / (x + y)) + ((x + y) / (x + -1 * y)) ";
28.486 -val e221b = the (rewrite_set thy' "rational_erls" false rls' e221b');
28.487 -
28.488 -print("\n\nexample 222:\n");
28.489 -print("a)\n");
28.490 -val e222a'="((1 + -1 * x) / (1 + x)) + ((-1 + -1 * x) / (1 + -1 * x)) + ((4 * x) / (1 + -1 * x^^^2))";
28.491 -val e222a = the (rewrite_set thy' "rational_erls" false rls' e222a');
28.492 -print("b)\n");
28.493 -val e222b'="((1 + x ) / (1 + -1 * x)) + ((-1 + x) / (1 + x)) + ((2 * x) / (1 + -1 * x^^^2))";
28.494 -val e222b = the (rewrite_set thy' "rational_erls" false rls' e222b');
28.495 -
28.496 -print("\n\nexample 225:\n");
28.497 -print("a)\n");
28.498 -val e225a'="((6 * a) / (a^^^2 + -64)) + ((a + 2) / (2 * a + 16)) + ((-1) / (2))";
28.499 -val e225a = the (rewrite_set thy' "rational_erls" false rls' e225a');
28.500 -print("b)\n");
28.501 -val e225b'="((a + 2 ) / (2 * a + 12)) + ((4 * a) / (a^^^2 + -36)) + ((-1) / (2))";
28.502 -val e225b = the (rewrite_set thy' "rational_erls" false rls' e225b');
28.503 -
28.504 -print("\n\nexample 226:\n");
28.505 -print("a)\n");
28.506 -val e226a'="((35 * z) / (49 * z^^^2 + -4)) + -1 + ((14 * z + -1) / (14 * z + 4)) ";
28.507 -val e226a = the (rewrite_set thy' "rational_erls" false rls' e226a');
28.508 -print("b)\n");
28.509 -val e226b'="((45 * a * b) / (25 * a^^^2 + -9 * b^^^2)) + ((20 * a + 3 * b) / (10 * a + 6 * b)) + -2";
28.510 -val e226b = the (rewrite_set thy' "rational_erls" false rls' e226b');
28.511 -
28.512 -print("\n\nexample 227:\n");
28.513 -print("a)\n");
28.514 -val e227a'="((6 * z + 11) / (6 * z + 14)) + ((9 * z ) / (9 * z^^^2 + -49)) + -1 ";
28.515 -val e227a = the (rewrite_set thy' "rational_erls" false rls' e227a');
28.516 -print("b)\n");
28.517 -val e227b'="((16 * a + 37 * b) / (4 * a + 10 * b)) + ((6 * a * b) / (4 * a^^^2 + -25 * b^^^2)) + -4 ";
28.518 -val e227b = the (rewrite_set thy' "rational_erls" false rls' e227b');
28.519 -
28.520 -print("\n\nexample 228:\n");
28.521 -print("a)\n");
28.522 -val e228a'="((7 * a + 11) / (3 * a^^^2 + -3)) + ((-2 * a + -1) / (a^^^2 + -1 * a)) + ((-1) / (3 * a + 3))";
28.523 -val e228a = the (rewrite_set thy' "rational_erls" false rls' e228a');
28.524 -print("b)\n");
28.525 -val e228b'="((11 * z + 2 * b) / (4 * b * z + -8 * b^^^2)) + ((-8 * z) / (z^^^2 + -4 * b^^^2)) + ((-9 * z + -2 * b) / (4 * b * z + 8 * b^^^2))";
28.526 -val e228b = the (rewrite_set thy' "rational_erls" false rls' e228b');
28.527 -
28.528 -
28.529 -print("\n\nexample 229:\n");
28.530 -print("a)\n");
28.531 -val e229a'="((5 * x^^^2 + y) / (x + 2 * y)) + ((-8 * x^^^3 + 4 * x^^^2 * y + 3 * x * y) / (x^^^2 + -4 * y^^^2)) + ((3 * x^^^2 + -4 * y) / (x + -2 * y))";
28.532 -val e229a = the (rewrite_set thy' "rational_erls" false rls' e229a');
28.533 -print("b)\n");
28.534 -val e229b'="((7 * x^^^2 + y) / (x + 3 * y)) + ((-24 * x^^^2 * y + 5 * x * y + 21 * y^^^2) / (x^^^2 + -9 * y^^^2)) + ((4 * x^^^2 + -6 * y) / (x + -3 * y))";
28.535 -val e229b = the (rewrite_set thy' "rational_erls" false rls' e229b');
28.536 -
28.537 -print("\n\nexample 230:\n");
28.538 -print("a)\n");
28.539 -val e230a'="((5 * x^^^2 + y) / (2 * x + y)) + ((-16 * x^^^3 + 2 * x^^^2 * y + 6 * x * y) / (4 * x^^^2 + -1 * y^^^2)) + ((3 * x^^^2 + -4 * y) / (2 * x + -1 * y))";
28.540 -val e230a = the (rewrite_set thy' "rational_erls" false rls' e230a');
28.541 -print("b)\n");
28.542 -val e230b'="((7 * x^^^2 + y) / (3 * x + y)) + ((-3 * x^^^3 + 15 * x * y + -7 * x^^^2 * y + 7 * y^^^2) / (9 * x^^^2 + -1 * y^^^2)) + ((4 * x^^^2 + -6 * y) / (3 * x + -1 * y))";
28.543 -val e230b = the (rewrite_set thy' "rational_erls" false rls' e230b');
28.544 -
28.545 -print("\n\nexample 231:\n");
28.546 -print("a)\n");
28.547 -val e231a'="((2 * x + 5 * y) / (x)) + ((2 * x^^^3 + -5 * y^^^3 + 3 * x * y^^^2) / (x^^^3 + -2 * x^^^2 * y + x * y^^^2)) + ((-3 * x + -6 * y) / (x + -1 * y))";
28.548 -val e231a = the (rewrite_set thy' "rational_erls" false rls' e231a');
28.549 -print("b)\n");
28.550 -val e231b'="((6 * x + 2 * y) / (x)) + ((6 * x^^^2 * y + -4 * x * y^^^2 + -2 * y^^^3) / (x^^^3 + -2 * x^^^2 * y + x * y^^^2)) + ((-5 * x + -3 * y) / (x + -1 * y))";
28.551 -val e231b = the (rewrite_set thy' "rational_erls" false rls' e231b');
28.552 -
28.553 -print("\n\nexample 232:\n");
28.554 -print("a)\n");
28.555 -val e232a'="((2 * x + 3 * y) / (x)) + ((4 * x^^^3 + -1 * x * y^^^2 + -3 * y^^^3) / (x^^^3 + -2 * x^^^2 * y + x * y^^^2)) + ((-5 * x + -6 * y) / (x + -1 * y))";
28.556 -val e232a = the (rewrite_set thy' "rational_erls" false rls' e232a');
28.557 -print("b)\n");
28.558 -val e232b'="((5 * x + 2 * y) / (x)) + ((2 * x^^^3 + -3 * x * y^^^2 + 3 * x^^^2 * y + -2 * y^^^3) / (x^^^3 + -2 * x^^^2 * y + x * y^^^2)) + ((-6 * x + -3 * y) / (x + -1 * y))";
28.559 -val e232b = the (rewrite_set thy' "rational_erls" false rls' e232b');
28.560 -
28.561 -print("\n\nexample 233:\n");
28.562 -print("a)\n");
28.563 -val e233a'="((5 * x + 6 * y) / (x)) + ((5 * x * y^^^2 + -6 * y^^^3 + -2 * x^^^3 + 3 * x^^^2 * y) / (x^^^3 + -2 * x^^^2 * y + x * y^^^2)) + ((-2 * x + -3 * y) / (x + -1 * y))";
28.564 -val e233a = the (rewrite_set thy' "rational_erls" false rls' e233a');
28.565 -print("b)\n");
28.566 -val e233b'="((6 * x + 5 * y) / (x)) + ((4 * x^^^2 * y + 3 * x * y^^^2 + -5 * y^^^3 + -2 * x^^^3) / (x^^^3 + -2 * x^^^2 * y + x * y^^^2)) + ((-3 * x + -2 * y) / (x + -1 * y))";
28.567 -val e233b = the (rewrite_set thy' "rational_erls" false rls' e233b');
28.568 -
28.569 -print("\n\nexample 234:\n");
28.570 -print("a)\n");
28.571 -val e234a'="((5 * a + b) / (2 * a * b + -2 * b^^^2)) + ((-3 * a + -1 * b) / (2 * a * b + 2 * b^^^2)) + ((-2 * a) / (a^^^2 + -1 * b^^^2))";
28.572 -val e234a = the (rewrite_set thy' "rational_erls" false rls' e234a');
28.573 -print("b)\n");
28.574 -val e234b'="((5 * a + 3 * b) / (6 * a * b + -18 * b^^^2)) + ((-3 * a + -3 * b) / (6 * a * b + 18 * b^^^2)) + ((-2 * a) / (a^^^2 + -9 * b^^^2)) ";
28.575 -val e234b = the (rewrite_set thy' "rational_erls" false rls' e234b');
28.576 -
28.577 -print("\n\nexample 235:\n");
28.578 -print("a)\n");
28.579 -val e235a'="((10 * x + 3 * y) / (12 * x * y + -18 * y^^^2)) + ((-6 * x + -3 * y) / (12 * x * y + 18 * y^^^2)) + ((-4 * x) / (4 * x^^^2 + -9 * y^^^2))";
28.580 -val e235a = the (rewrite_set thy' "rational_erls" false rls' e235a');
28.581 -print("b)\n");
28.582 -val e235b'="((8 * a + b) / (4 * a * b + -2 * b^^^2)) + ((-4 * a + -1 * b) / (4 * a * b + 2 * b^^^2)) + ((-2 * a) / (4 * a^^^2 + -1 * b^^^2)) ";
28.583 -val e235b = the (rewrite_set thy' "rational_erls" false rls' e235b');
28.584 -
28.585 -print("\n\nexample 236:\n");
28.586 -print("a)\n");
28.587 -val e236a'="((8 * a + 5 * b) / (20 * a * b + -50 * b^^^2)) + ((-4 * a + -5 * b) / (20 * a * b + 50 * b^^^2)) + ((-2 * a) / (4 * a^^^2 + -25 * b^^^2))";
28.588 -val e236a = the (rewrite_set thy' "rational_erls" false rls' e236a');
28.589 -print("b)\n");
28.590 -val e236b'="((24 * x + y) / (6 * x * y + -2 * y^^^2)) + ((-18 * x + -1 * y) / (6 * x * y + 2 * y^^^2)) + ((-15 * x) / (9 * x^^^2 + -1 * y^^^2)) ";
28.591 -val e236b = the (rewrite_set thy' "rational_erls" false rls' e236b');
28.592 -
28.593 -print("\n\nexample heuberger:\n");
28.594 -val eheu'="(x^^^4 + x * y + x^^^3 * y + y^^^2) / (x + 5 * x^^^2 + y + 5 * x * y + x^^^2 * y^^^3 + x * y^^^4)";
28.595 -val eheu = the (rewrite_set thy' "rational_erls" false rls' eheu');
28.596 -
28.597 -print("\n\nexample stiefel:\n");
28.598 -val est1'="(7) / (-14) + (-2) / (4)";
28.599 -val est1 = the (rewrite_set thy' "rational_erls" false rls' est1');
28.600 -if est1 = ("(-1) / 1",[]) then ()
28.601 -else raise error "new behaviour in rationals.sml: est1'";
28.602 --------------------------------------------------------------------------*)
28.603 -
28.604 -
28.605 -(*
28.606 - val t = (term_of o the o (parse thy))
28.607 - "(9 - x ^^^ 2) / (9 - 6 * x + x ^^^ 2)";
28.608 - val SOME (t',_) = factor_expanded_ thy t;
28.609 - term2str t';
28.610 -
28.611 - "((-3) - x) * ((-3) + x) / (((-3) + x) * ((-3) + x))"
28.612 - "(3 + x) * (3 - x) / ((3 - x) * (3 - x))"
28.613 -*)
28.614 -
28.615 -
28.616 -
28.617 -(*WN.28.8.02: tests for the 'reverse-rewrite' functions:
28.618 - these are defined in Rationals.ML and stored in
28.619 - the 'reverse-ruleset' cancel*)
28.620 -
28.621 -(*the term for which reverse rewriting is demonstrated*)
28.622 - val t = (term_of o the o (parse thy))
28.623 - "(9 - x ^^^ 2) / (9 + 6 * x + x ^^^ 2)";
28.624 - val Rrls {scr=Rfuns {init_state=ini,locate_rule=loc,
28.625 - next_rule=nex,normal_form=nor,...},...} = cancel;
28.626 -
28.627 -(*normal_form produces the result in ONE step*)
28.628 - val SOME (t',_) = nor t;
28.629 - term2str t';
28.630 -
28.631 -(*initialize the interpreter state used by the 'me'*)
28.632 - val (t,_,revsets,_) = ini t;
28.633 -
28.634 -(*find the rule 'r' to apply to term 't'*)
28.635 - val SOME r = nex revsets t;
28.636 - (*val r = Thm ("sym_#mult_2_3","6 = 2 * 3") : rule*)
28.637 -
28.638 -(*check, if the rule 'r' applied by the user to 't' belongs to the ruleset;
28.639 - if the rule is OK, the term resulting from applying the rule is returned,too;
28.640 - there might be several rule applications inbetween,
28.641 - which are listed after the thead in reverse order*)
28.642 - val (r,(t,asm))::_ = loc revsets t r;
28.643 - term2str t;
28.644 - "(9 - x ^^^ 2) / (3 ^^^ 2 + 6 * x + x ^^^ 2)";
28.645 -
28.646 -(*find the next rule to apply*)
28.647 - val SOME r = nex revsets t;
28.648 - (*val r = Thm ("sym_#power_3_2","9 = 3 ^^^ 2") : rule*)
28.649 -
28.650 -(*check the next rule*)
28.651 - val (r,(t,asm))::_ = loc revsets t r;
28.652 - term2str t;
28.653 - "(3 ^^^ 2 - x ^^^ 2) / (3 ^^^ 2 + 6 * x + x ^^^ 2)";
28.654 -
28.655 -(*find and check the next rules, rewrite*)
28.656 - val SOME r = nex revsets t;
28.657 - val (r,(t,asm))::_ = loc revsets t r;
28.658 - term2str t;
28.659 - "(3 ^^^ 2 - x ^^^ 2) / (3 ^^^ 2 + 2 * 3 * x + x ^^^ 2)";
28.660 -
28.661 - val SOME r = nex revsets t;
28.662 - val (r,(t,asm))::_ = loc revsets t r;
28.663 - term2str t;
28.664 - "(3 - x) * (3 + x) / (3 ^^^ 2 + 2 * 3 * x + x ^^^ 2)";
28.665 -
28.666 - val SOME r = nex revsets t;
28.667 - val (r,(t,asm))::_ = loc revsets t r;
28.668 - term2str t;
28.669 - "(3 - x) * (3 + x) / ((3 + x) * (3 + x))";
28.670 -
28.671 - val SOME r = nex revsets t;
28.672 - val (r,(t,asm))::_ = loc revsets t r;
28.673 - val ss = term2str t;
28.674 - if ss = "(3 - x) / (3 + x)" then ()
28.675 - else raise error "rational.sml: new behav. in rev-set cancel";
28.676 - terms2str asm;
28.677 -
28.678 -
28.679 -
28.680 -(*WN.11.9.02: the 'reverse-ruleset' cancel*)
28.681 -
28.682 - (*the term for which reverse rewriting is demonstrated*)
28.683 - val t = (term_of o the o (parse thy))
28.684 - "(9 + (-1)*x^^^2) / (9 + ((-6)*x + x^^^2))";
28.685 - val Rrls {scr=Rfuns {init_state=ini,locate_rule=loc,
28.686 - next_rule=nex,normal_form=nor,...},...} = cancel;
28.687 - (*normal_form produces the result in ONE step*)
28.688 - val SOME (t',_) = nor t;
28.689 - term2str t';
28.690 - (*initialize the interpreter state used by the 'me'*)
28.691 - val (t,_,revsets,_) = ini t;
28.692 -(*
28.693 - val [rs] = revsets;
28.694 - filter_out (eq_Thms ["sym_real_add_zero_left",
28.695 - "sym_real_mult_0",
28.696 - "sym_real_mult_1"]) rs;
28.697 -
28.698 - 10.10.02: dieser Fall terminiert nicht (make_poly enth"alt zu viele rules)
28.699 - val SOME r = nex revsets t;
28.700 - val (r,(t,asm))::_ = loc revsets t r;
28.701 - term2str t;
28.702 -
28.703 - val SOME r = nex revsets t;
28.704 - val (r,(t,asm))::_ = loc revsets t r;
28.705 - term2str t;
28.706 -
28.707 - ------ revset ----------------------------------------------------
28.708 -/// [Thm ("sym_real_add_zero_left","?z = 0 + ?z"),
28.709 -/// Thm ("sym_real_mult_0","0 = 0 * ?z"),
28.710 -! Thm ("sym_#mult_2_(-3)","(-6) * x = 2 * ((-3) * x)"),
28.711 -! Thm ("sym_#add_(-3)_3","0 = (-3) + 3"),
28.712 -
28.713 -? Thm ("sym_real_num_collect_assoc",
28.714 - "[| ?l is_const; ?m is_const |]
28.715 - ==> (?l + ?m) * ?n + ?k = ?l * ?n + (?m * ?n + ?k)"),
28.716 -OK Thm ("sym_real_mult_2_assoc","2 * ?z1.0 + ?k = ?z1.0 + (?z1.0 + ?k)"),
28.717 -OK Thm ("sym_real_add_left_commute","?y + (?x + ?z) = ?x + (?y + ?z)"),
28.718 -/// Thm ("sym_real_mult_1","?z = 1 * ?z"),
28.719 -! Thm ("sym_#power_3_2","9 = 3 ^^^ 2"),
28.720 -! Thm ("sym_#mult_-1_-1","1 * x ^^^ 2 = -1 * (-1 * x ^^^ 2)"),
28.721 -! Thm ("sym_#mult_-1_3","(-3) * x = -1 * (3 * x)"),
28.722 -OK Thm ("realpow_twoI","?r1 ^^^ 2 = ?r1 * ?r1" [.]),
28.723 -OK Thm ("sym_real_add_assoc",
28.724 - "?z1.0 + (?z2.0 + ?z3.0) = ?z1.0 + ?z2.0 + ?z3.0"),
28.725 -OK Thm
28.726 - ("sym_real_mult_assoc","?z1.0 * (?z2.0 * ?z3.0) = ?z1.0 * ?z2.0 * ?z3.0"),
28.727 -OK Thm ("sym_real_mult_left_commute",
28.728 - "?z2.0 * (?z1.0 * ?z3.0) = ?z1.0 * (?z2.0 * ?z3.0)"),
28.729 -OK Thm ("sym_real_mult_commute","?w * ?z = ?z * ?w"),
28.730 -? Thm ("sym_real_add_mult_distrib2",
28.731 - "?w * ?z1.0 + ?w * ?z2.0 = ?w * (?z1.0 + ?z2.0)"),
28.732 -? Thm ("sym_real_add_mult_distrib",
28.733 - "?z1.0 * ?w + ?z2.0 * ?w = (?z1.0 + ?z2.0) * ?w"),
28.734 -OK Thm ("real_mult_div_cancel2","?k ~= 0 ==> ?m * ?k / (?n * ?k) = ?m / ?n")]
28.735 - -------- revset ----------------------------------------------------
28.736 -
28.737 - val t = (term_of o the o (parse thy)) "(-6) * x";
28.738 - val t = (term_of o the o (parse thy))
28.739 - "(9 + (-1)*x^^^2) / (9 + ((-6)*x + x^^^2))";
28.740 - val thm = (mk_thm thy "(-6) * x = 2 * ((-3) * x)")
28.741 - handle e => print_exn e;
28.742 - val SOME (t',_) = rewrite_ thy e_rew_ord e_rls false thm t;
28.743 - term2str t';
28.744 -----------------------------------------------------------------------*)
28.745 -
28.746 -
28.747 -
28.748 -(* SK: Testbeispiele --- WN kopiert Rational.ML -> rational.sml-----
28.749 -
28.750 -val t1 = (term_of o the o (parse thy)) "((3 * x^^^2 + 6 *x + 3) / (2*x + 2))";
28.751 -val SOME (t1',rest)= cancel_ thy t1;
28.752 -val SOME (t1'',_)= factor_out_gcd_ thy t1;
28.753 -print(term2str t1'^" + Einschr\"ankung: "^term2str (hd(rest)));
28.754 -term2str t1'';
28.755 -
28.756 -val t1 = (term_of o the o (parse thy)) "((-3 * x^^^2 + 6 *x - 3) / (2*x - 2))";
28.757 -val SOME (t1',_)= cancel_ thy t1;
28.758 -val SOME (t1'',_)= factor_expanded_ thy t1;
28.759 -term2str t1';
28.760 -term2str t1'';
28.761 -
28.762 -val t2 = (term_of o the o (parse thy)) "((x+ (-1)) / (x + 1)) + ((x + 1) / (x + (-1)))";
28.763 -val SOME (t2',_) = add_fractions_ thy t2;
28.764 -val SOME (t2'',_) = common_nominators_ thy t2;
28.765 -term2str t2';
28.766 -term2str t2'';
28.767 -
28.768 -val t2 = (term_of o the o (parse thy)) "((x - 1) / (x + 1)) + ((x + 1) / (x - 1))";
28.769 -val SOME (t2',_) = add_expanded_frac_ thy t2;
28.770 -val SOME (t2'',_) = common_expanded_nom_ thy t2;
28.771 -term2str t2';
28.772 -term2str t2'';
28.773 -
28.774 -
28.775 -val t3 = (term_of o the o (parse thy)) "((1) / (2*x + 2)) + ((1) / (2*x + (-2))) + ((1) / ( x^^^2 + (-1)))+((1) / (x^^^2 + (-2)*x + 1))";
28.776 -val SOME (t3',_) = common_nominators_ thy t3;
28.777 -val SOME (t3'',_) = add_fractions_ thy t3;
28.778 -(term2str t3');
28.779 -(term2str t3'');
28.780 -
28.781 -val t3 = (term_of o the o (parse thy)) "((1) / (2*x + 2)) + ((1) / (2*x - 2)) + ((1) / ( x^^^2 - 1))+((1) / (x^^^2 - 2 * x + 1))";
28.782 -val SOME (t3',_) = common_expanded_nom_ thy t3;
28.783 -val SOME (t3'',_) = add_expanded_frac_ thy t3;
28.784 -(term2str t3');
28.785 -(term2str t3'');
28.786 --------------------------------*)
28.787 -
28.788 -(*
28.789 -val SOME(t4,t5) = norm_rational_ thy t3;
28.790 -term2str t4;
28.791 -term2str (hd(t5));*)
28.792 -
28.793 -(*val test1 = (term_of o the o (parse thy)) "1 - x^^^2 - 5 * x^^^5";
28.794 -val test2 = (term_of o the o (parse thy)) "1 + (-1) * x ^^^ 2 + (-5) * x ^^^ 5";
28.795 -val test2 = (term_of o the o (parse thy)) "1 - x";
28.796 -val test2 = (term_of o the o (parse thy)) "1 + (-1) * x";
28.797 -term2str(expanded2term(test1));
28.798 -term2str(term2expanded(test2)); *)
28.799 -
28.800 -
28.801 -
28.802 -(* WN kopiert 16.10.02 Rational.ML -> rational.sml-----vvv---*)
28.803 -
28.804 - val t=(term_of o the o (parse thy)) "(9 - x^^^2)/(9 - 6*x + x^^^2)";
28.805 - val SOME (t',_) = factout_ thy t;
28.806 - val SOME (t'',_) = cancel_ thy t;
28.807 - term2str t';
28.808 - term2str t'';
28.809 - "(3 + x) * (3 - x) / ((3 - x) * (3 - x))";
28.810 - "(3 + x) / (3 - x)";
28.811 -
28.812 - val t=(term_of o the o(parse thy))
28.813 - "(9 - x^^^2) / (9 - 6*x + x^^^2) + 1 / (3 - x)";
28.814 - val SOME (t',_) = common_nominator_ thy t;
28.815 - val SOME (t'',_) = add_fraction_ thy t;
28.816 - term2str t';
28.817 - term2str t'';
28.818 - "(9 - x ^^^ 2) / ((3 - x) * (3 - x)) + 1 * (3 - x) / ((3 - x) * (3 - x))";
28.819 - "(4 + x) / (3 - x)";
28.820 -
28.821 - (*WN.16.10.02 hinzugef"ugt -----vv---*)
28.822 - val t=(term_of o the o(parse thy))
28.823 - "(9 - x^^^2) / (9 - 6*x + x^^^2) + 1";
28.824 - val SOME (t',_) = common_nominator_ thy t;
28.825 - val SOME (t'',_) = add_fraction_ thy t;
28.826 - term2str t';
28.827 - term2str t'';
28.828 - "(9 - x ^^^ 2) / (9 - 6 * x + x ^^^ 2) +\
28.829 - \1 * (9 - 6 * x + x ^^^ 2) / (9 - 6 * x + x ^^^ 2)";
28.830 - "6 / (3 - x)";
28.831 -
28.832 - val t=(term_of o the o(parse thy))
28.833 - "1 + (9 - x^^^2) / (9 - 6*x + x^^^2)";
28.834 - val SOME (t',_) = common_nominator_ thy t;
28.835 - val SOME (t'',_) = add_fraction_ thy t;
28.836 - term2str t';
28.837 - term2str t'';
28.838 - "1 * (9 - 6 * x + x ^^^ 2) / (9 - 6 * x + x ^^^ 2) +\
28.839 - \(9 - x ^^^ 2) / (9 - 6 * x + x ^^^ 2)";
28.840 - "6 / (3 - x)";
28.841 - (*WN.16.10.02 hinzugef"ugt -----^^---*)
28.842 -
28.843 - val t=(term_of o the o (parse thy))
28.844 - "(y^^^2 - x^^^2)/(y^^^2 - 2*y*x + x^^^2)";
28.845 - val SOME (t',_) = factout_ thy t;
28.846 - val SOME (t'',_) = cancel_ thy t;
28.847 - term2str t';
28.848 - term2str t'';
28.849 - "(y + x) * (y - x) / ((y - x) * (y - x))";
28.850 - "(y + x) / (y - x)";
28.851 -
28.852 - val t=(term_of o the o (parse thy))
28.853 - "(y^^^2 - x^^^2)/(y^^^2 - 2*y*x + x^^^2) + 1 / (y - x)";
28.854 - val SOME (t',_) = common_nominator_ thy t;
28.855 - val SOME (t'',_) = add_fraction_ thy t;
28.856 - term2str t';
28.857 - term2str t'';
28.858 - "((-1) * x ^^^ 2 + y ^^^ 2) / (((-1) * x + y) * ((-1) * x + y)) +\
28.859 - \1 * ((-1) * x + y) / (((-1) * x + y) * ((-1) * x + y))";
28.860 - "((-1) - x - y) / (x - y)";
28.861 - (*WN.16.10.02 ^^^^^^^ Reihenfolge aus Angabe umgekehrt ?!*)
28.862 -
28.863 - val t=(term_of o the o (parse thy))
28.864 - "(x^^^2 - y^^^2)/(x^^^2 - 2*x*y + y^^^2) + 1 / (x - y)";
28.865 - val SOME (t',_) = common_nominator_ thy t;
28.866 - val SOME (t'',_) = add_fraction_ thy t;
28.867 - term2str t';
28.868 - term2str t'';
28.869 - "((-1) * y ^^^ 2 + x ^^^ 2) / (((-1) * y + x) * ((-1) * y + x)) +\
28.870 - \1 * ((-1) * y + x) / (((-1) * y + x) * ((-1) * y + x))";
28.871 - "((-1) - y - x) / (y - x)";
28.872 - (*WN.16.10.02 ^^^^^^^ lexicographische Ordnung ?!*)
28.873 -
28.874 - val t=(term_of o the o (parse thy))
28.875 - "(y^^^2 - x^^^2)/(y^^^2 - 2*y*x + x^^^2)";
28.876 - val SOME (t',_) = norm_expanded_rat_ thy t;
28.877 - term2str t';
28.878 - "(y + x) / (y - x)";
28.879 -(*val SOME (t'',_) = norm_rational_ thy t;
28.880 - term2str t'';
28.881 - *** RATIONALS_TERM2POLY_EXCEPTION: Invalid Polynomial
28.882 - WN.16.10.02 ?!*)
28.883 -
28.884 - val t=(term_of o the o (parse thy))
28.885 - "(9 - x^^^2)/(9 - 6*x + x^^^2) + (1)/(3 + x)";
28.886 - val SOME (t',_) = norm_expanded_rat_ thy t;
28.887 - term2str t';
28.888 - "(12 + 5 * x + x ^^^ 2) / (9 - x ^^^ 2)";
28.889 -(*val SOME (t'',_) = norm_rational_ thy t;
28.890 - term2str t'';
28.891 - *** RATIONALS_TERM2POLY_EXCEPTION: Invalid Polynomial
28.892 - WN.16.10.02 ?!*)
28.893 -
28.894 - val t=(term_of o the o (parse thy))
28.895 - "(9 + (-1)* x^^^2)/(9 + (-1)* 6*x + x^^^2) + (1)/(3 + x)";
28.896 - val SOME (t',_) = norm_expanded_rat_ thy t;
28.897 - val SOME (t'',_) = norm_rational_ thy t;
28.898 - term2str t';
28.899 - term2str t'';
28.900 - "(12 + 5 * x + x ^^^ 2) / (9 - x ^^^ 2)";
28.901 - "(12 + 5 * x + x ^^^ 2) / (9 + (-1) * x ^^^ 2)";
28.902 -(* WN kopiert 16.10.02 Rational.ML -> rational.sml-----^^^---*)
28.903 -
28.904 -
28.905 -
29.1 --- a/test/Tools/isac/IsacKnowledge/rational.sml Mon Aug 30 14:29:49 2010 +0200
29.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
29.3 @@ -1,2023 +0,0 @@
29.4 -(*.tests for rationals
29.5 - author: Stefan Karnel
29.6 - Copyright (c) Stefan Karnel 2002
29.7 - Use is subject to license terms.
29.8 -
29.9 -use"../smltest/IsacKnowledge/rational.sml";
29.10 -use"rational.sml";
29.11 -
29.12 -LEGEND WN070906
29.13 - nonterm.SK marks non-terminating examples
29.14 - ord.SK PARTIALLY marks crucial ordering examples
29.15 - *SK* of some (secondary) interest (on 070906)
29.16 -****************************************************************.*)
29.17 -
29.18 -(******************************************************************
29.19 -WN060104 transfer marked (*SR..*)examples to the exp-collection
29.20 - # exp_IsacCore_Simp_Rat_Cancel.xml from rational.sml (*SRC*) 10 exp
29.21 - # exp_IsacCore_Simp_Rat_Add.xml from rational.sml (*SRA*) 11 exp
29.22 - # exp_IsacCore_Simp_Rat_Mult.xml from rational.sml (*SRM*) 5 exp
29.23 - # exp_IsacCore_Simp_Rat_AddMult.xml from rational.sml (*SRAM*) 11 exp
29.24 - # exp_IsacCore_Simp_Rat_Double.xml from rational.sml (*SRD*) 12 exp
29.25 -*******************************************************************)
29.26 -"-----------------------------------------------------------------";
29.27 -"table of contents -----------------------------------------------";
29.28 -"-----------------------------------------------------------------";
29.29 -"~~~~~BEGIN: decomment structure RationalI : RATIONALI ~~~~~~~~~~~";
29.30 -"-------- ... missing WN060103 -----------------------------------";
29.31 -"-------- fun monom2term, fun poly2term' ------------------------";
29.32 -"~~~~~END: decomment structure RationalI : RATIONALI ~~~~~~~~~~~~~";
29.33 -"-------- cancel from: Mathematik 1 Schalk Reniets Verlag --------";
29.34 -"-------- common_nominator_p ---------------------------- --------";
29.35 -"-------- reverse rewrite ----------------------------------------";
29.36 -"-------- 'reverse-ruleset' cancel_p -----------------------------";
29.37 -"-------- norm_Rational ------------------------------------------";
29.38 -"-------- numeral rationals --------------------------------------";
29.39 -"-------- cancellation -------------------------------------------";
29.40 -"-------- common denominator -------------------------------------";
29.41 -"-------- multiply and cancel ------------------------------------";
29.42 -"-------- common denominator and multiplication ------------------";
29.43 -"-------- double fractions ---------------------------------------";
29.44 -"-------- me Schalk I No.186 -------------------------------------";
29.45 -"-------- interSteps ..Simp_Rat_Double_No-1.xml ------------------";
29.46 -"-------- interSteps ..Simp_Rat_Cancel_No-1.xml ------------------";
29.47 -"-------- investigate rulesets for cancel_p ----------------------";
29.48 -"-------- investigate format of factout_ and factout_p_ ----------";
29.49 -"-----------------------------------------------------------------";
29.50 -"-----------------------------------------------------------------";
29.51 -"-----------------------------------------------------------------";
29.52 -
29.53 -
29.54 -"~~~~~BEGIN: decomment structure RationalI : RATIONALI ~~~~~~~~~~~";
29.55 -(*.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29.56 - tests of internal functions: to make them work,
29.57 - out-comment (*!!!*) in knowledge/Rational.ML:
29.58 -(*##!!!
29.59 -structure RationalI : RATIONALI =
29.60 -struct
29.61 -!!!##*)
29.62 -
29.63 -(*##!!!
29.64 -end;(*struct*)
29.65 -open RationalI;
29.66 -!!!##*)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.*)
29.67 -
29.68 -(*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29.69 -print("\n\n********************* rational.sml - TESTS *************************\n\n");
29.70 -print("\n\n***** divide tests *****\n");
29.71 -val mv_pquot1 = (#1(mv_division([(1,[1,1,1]),(1,[1,1,0]),(1,[1,0,1]),(1,[0,0,0])],[(1,[1,1,0]),(1,[0,0,0])],LEX_)));
29.72 -(* result: [(1,[0,0,1]),(1,[0,0,0])] *)
29.73 -if mv_pquot1=[(1,[0,0,1]),(1,[0,0,0])] then () else raise error ("rational.sml: example failed");
29.74 -
29.75 -val mv_prest1 = (#2(mv_division([(1,[1,1,1]),(1,[1,1,0]),(1,[1,0,1]),(1,[0,0,0])],[(1,[1,1,0]),(1,[0,0,0])],LEX_)));
29.76 -(* result: [(1,[1,0,1]),(~1,[0,0,1])] *)
29.77 -if mv_prest1=[(1,[1,0,1]),(~1,[0,0,1])] then () else raise error ("rational.sml: example failed");
29.78 -
29.79 -val mv_pquot2 = (#1(mv_division([(4,[2]),(8,[1]),(16,[0])],[(1,[1]),(1,[0])],LEX_)));
29.80 -(* result: [(4,[1]),(4,[0])] *)
29.81 -if mv_pquot2=[(4,[1]),(4,[0])] then () else raise error ("rational.sml: example failed");
29.82 -
29.83 -val mv_prest2 = (#2(mv_division([(4,[2]),(8,[1]),(16,[0])],[(1,[1]),(1,[0])],LEX_)));
29.84 -(* result: [(12,[0]] *)
29.85 -if mv_prest2=[(12,[0])] then () else raise error ("rational.sml: example failed");
29.86 -
29.87 -val mv_pquot3 = (#1(mv_division([(4,[2]),(~4,[0])],[(2,[1]),(2,[0])],LEX_)));
29.88 -(* [(2,[1]),(~2,[0])] *)
29.89 -if mv_pquot3=[(2,[1]),(~2,[0])] then () else raise error ("rational.sml: example failed");
29.90 -
29.91 -val mv_prest3 = (#2(mv_division([(1,[2]),(~1,[0])],[(2,[1]),(2,[0])],LEX_)));
29.92 -(* [(1,[2]),(~1,[0])] *)
29.93 -if mv_prest3=[(1,[2]),(~1,[0])] then () else raise error ("rational.sml: example failed");
29.94 -
29.95 -val mv_pquot4 = (#1(mv_division([(3,[1,1,1]),(4,[1,0,1]),(3,[0,0,1])],[(2,[1,0,0]),(4,[0,0,1])],LEX_)));
29.96 -(* [(1,[0,1,1])] *)
29.97 -if mv_pquot4=[(1,[0,1,1])] then () else raise error ("rational.sml: example failed");
29.98 -
29.99 -val mv_prest4 = (#2(mv_division([(3,[1,1,1]),(4,[1,0,1]),(3,[0,0,1])],[(2,[1,0,0]),(4,[0,0,1])],GGO_)));
29.100 -(* [(1,[1,1,1]),(~4,[0,1,2]),(4,[1,0,1]),(3,[0,0,1])] *)
29.101 -if mv_prest4 =[(1,[1,1,1]),(~4,[0,1,2]),(4,[1,0,1]),(3,[0,0,1])] then () else raise error ("rational.sml: example failed");
29.102 -
29.103 -val mv_pquot5 = (#1(mv_division([(3,[1,1,1]),(4,[1,0,1]),(3,[0,0,1]),(6,[2,1,3]),(4,[0,4,1]),(1,[2,2,1])],[(1,[0,0,1])],LEX_)));
29.104 -(* [(1,[2,2,0]),(6,[2,1,2]),(3,[1,1,0]),(4,[1,0,0]),(4,[0,4,0]),(3,[0,0,0])]*)
29.105 -if mv_pquot5=[(1,[2,2,0]),(6,[2,1,2]),(3,[1,1,0]),(4,[1,0,0]),(4,[0,4,0]),(3,[0,0,0])] then () else raise error ("rational.sml: example failed");
29.106 -
29.107 -val mv_prest5 = (#2(mv_division([(3,[1,1,1]),(4,[1,0,1]),(3,[0,0,1]),(6,[2,1,3]),(4,[0,4,1]),(1,[2,2,1])],[(1,[0,0,1])],LEX_)));
29.108 -(* [] *)
29.109 -if mv_prest5=[] then () else raise error ("rational.sml: example failed");
29.110 -
29.111 -(* (x^2 + 2(a+1)x + (a^2+2a+1)) / (x+a+1) = x+a+1 *)
29.112 -val mv_pquot6 = (#1(mv_division([(1,[2,0,0]),(2,[1,1,0]),(2,[1,0,0]),(1,[0,2,0]),(2,[0,1,0]),(1,[0,0,0])],[(1,[1,0,0]),(1,[0,1,0]),(1,[0,0,0])],LEX_)));
29.113 -if mv_pquot6=[(1,[1,0,0]),(1,[0,1,0]),(1,[0,0,0])] then () else raise error ("rational.sml: example failed");
29.114 -
29.115 -val mv_prest6 = (#2(mv_division([(1,[2,0,0]),(2,[1,1,0]),(2,[1,0,0]),(1,[0,2,0]),(2,[0,1,0]),(1,[0,0,0])],[(1,[1,0,0]),(1,[0,1,0]),(1,[0,0,0])],LEX_)));
29.116 -if mv_prest6=[] then () else raise error ("rational.sml: example failed");
29.117 -
29.118 -
29.119 -print("\n\n***** MV_CONTENT-TESTS *****\n");
29.120 -val mv_cont1=mv_content([(1,[2,1]),(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,1]),(1,[0,0])]);
29.121 -(* [(1,[0,1]),(1,[0,0])] *)
29.122 -if mv_cont1=[(1,[0,1]),(1,[0,0])] then () else raise error ("rational.sml: example failed");
29.123 -
29.124 -val mv_pp1=mv_pp([(1,[1,1]),(1,[1,0]),(1,[0,1]),(1,[0,0])]);
29.125 -(*[(1,[1,0]),(1,[0,0])]*)
29.126 -if mv_pp1=[(1,[1,0]),(1,[0,0])] then () else raise error ("rational.sml: example failed");
29.127 -
29.128 -val mv_cont2=mv_content([(2,[1]),(4,[0])]);
29.129 -(* [(2,[0])] *)
29.130 -if mv_cont2=[(2,[0])] then () else raise error ("rational.sml: example failed");
29.131 -
29.132 -val mv_pp2=mv_pp([(2,[1]),(4,[0])]);
29.133 -(* [(1,[1]),(2,[0])] *)
29.134 -if mv_pp2=[(1,[1]),(2,[0])] then () else raise error ("rational.sml: example failed");
29.135 -
29.136 -val mv_cont3=mv_content[(8,[2,1,1]),(12,[1,0,2]),(10,[2,2,0]),(16,[1,1,1])];
29.137 -(* [(2,[0,0,0])] *)
29.138 -if mv_cont3=[(2,[0,0,0])] then () else raise error ("rational.sml: example failed");
29.139 -
29.140 -val mv_pp3=mv_pp[(8,[2,1,1]),(12,[1,0,2]),(10,[2,2,0]),(16,[1,1,1])];
29.141 -(* [(5,[2,2,0]),(4,[2,1,1]),(8,[1,1,1]),(6,[1,0,2])] *)
29.142 -if mv_pp3=[(5,[2,2,0]),(4,[2,1,1]),(8,[1,1,1]),(6,[1,0,2])] then () else raise error ("rational.sml: example failed");
29.143 -
29.144 -val mv_cont4=mv_content[(2,[2,1,0]),(3,[1,0,1]),(2,[1,1,0]),(3,[0,0,1])];
29.145 -(* [(1,[0,0,0])] *)
29.146 -if mv_cont4=[(1,[0,0,0])] then () else raise error ("rational.sml: example failed");
29.147 -
29.148 -val mv_pp4=mv_pp [(2,[2,1,0]),(3,[1,0,1]),(2,[1,1,0]),(3,[0,0,1])];
29.149 -(* [(2,[2,1,0]),(2,[1,1,0]),(3,[1,0,1]),(3,[0,0,1])] *)
29.150 -if mv_pp4=[(2,[2,1,0]),(2,[1,1,0]),(3,[1,0,1]),(3,[0,0,1])] then () else raise error ("rational.sml: example failed");
29.151 -
29.152 -val con1=mv_content([(9,[2,0]),(15,[1,1]),(12,[1,0]),(6,[0,2]),(12,[0,1])]);
29.153 -(* [(3,[0,0])] *)
29.154 -if con1=[(3,[0,0])] then () else raise error ("rational.sml: example failed");
29.155 -
29.156 -val pp1=mv_pp([(9,[2,0]),(15,[1,1]),(12,[1,0]),(6,[0,2]),(12,[0,1])]);
29.157 -(* [(3,[2,0]),(5,[1,1]),(4,[1,0]),(2,[0,2]),(4,[0,1])] *)
29.158 -if pp1=[(3,[2,0]),(5,[1,1]),(4,[1,0]),(2,[0,2]),(4,[0,1])] then () else raise error ("rational.sml: example failed");
29.159 -
29.160 -val con2=mv_content([(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,2]),(1,[0,1])]);
29.161 -(* [(1,[0,0])] *)
29.162 -if con2=[(1,[0,0])] then () else raise error ("rational.sml: example failed");
29.163 -
29.164 -val pp2 =mv_pp([(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,2]),(1,[0,1])]);
29.165 -(* [(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,2]),(1,[0,1])] *)
29.166 -if pp2=[(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,2]),(1,[0,1])] then () else raise error ("rational.sml: example failed");
29.167 -
29.168 -val cont1 = mv_content [(1,[2,1,0]),(2,[2,1,0])];
29.169 -(* [(3,[0,1,0])] *)
29.170 -if cont1=[(3,[0,1,0])] then () else raise error ("rational.sml: example failed");
29.171 -
29.172 -val pp1 = mv_pp [(1,[2,1,0]),(2,[2,1,0])];
29.173 -(* [(1,[2,0,0])] *)
29.174 -if pp1=[(1,[2,0,0])] then () else raise error ("rational.sml: example failed");
29.175 -
29.176 -val cont2 = mv_content [(4,[1,2,0]),(2,[2,1,0])];
29.177 -(* [(2,[0,1,0])] *)
29.178 -if cont2=[(2,[0,1,0])] then () else raise error ("rational.sml: example failed");
29.179 -
29.180 -val pp2 = mv_pp [(4,[1,2,0]),(2,[2,1,0])];
29.181 -(* [(1,[2,0,0]),(2,[1,1,0])] *)
29.182 -if pp2=[(1,[2,0,0]),(2,[1,1,0])] then () else raise error ("rational.sml: example failed");
29.183 -
29.184 -print("\n\n\n\n********************************************************\n\n");
29.185 -val cont3=mv_content [(65,[3,2,2]),(52,[3,2,1]),(26,[3,1,2]),(~95,[2,2,3]),(~76,[2,2,2]),(35,[2,2,1]),(28,[2,2,0]),(~38,[2,1,3]),(14,[2,1,1])];
29.186 -if cont3=[(5,[0,2,1]),(4,[0,2,0]),(2,[0,1,1])] then () else raise error ("rational.sml: example failed");
29.187 -val pp3=mv_pp [(65,[3,2,2]),(52,[3,2,1]),(26,[3,1,2]),(~95,[2,2,3]),(~76,[2,2,2]),(35,[2,2,1]),(28,[2,2,0]),(~38,[2,1,3]),(14,[2,1,1])];
29.188 -
29.189 -
29.190 -"-------- fun monom2term, fun poly2term' ------------------------";
29.191 -"-------- fun monom2term, fun poly2term' ------------------------";
29.192 -"-------- fun monom2term, fun poly2term' ------------------------";
29.193 -val t = monom2term ((3,[2,1,0]), ["c","b","a"](*reverse ???SK-*));
29.194 -term2str t = "3 * (c ^^^ 2 * b)" (*true*);
29.195 -
29.196 -val t = monom2term ((1,[1,0]), ["b","a"]);
29.197 -term2str t = "b" (*true*);
29.198 -
29.199 -val t = poly2term ([(1,[0,0,0]),(2,[1,0,0]),(3,[2,1,0]),(4,[3,2,1])],
29.200 - ["c","b","a"]);
29.201 -term2str t = "1 + 2 * c + 3 * (c ^^^ 2 * b) + 4 * (c ^^^ 3 * (b ^^^ 2 * a))";
29.202 -
29.203 -val t = poly2term ([(1,[1,0]),(1,[0,1])], ["b","a"]);
29.204 -term2str t = "a + b" (*true*);
29.205 -
29.206 -
29.207 -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*)
29.208 -"~~~~~END: decomment structure RationalI : RATIONALI ~~~~~~~~~~~~~";
29.209 -"~~~~~END: decomment structure RationalI : RATIONALI ~~~~~~~~~~~~~";
29.210 -"~~~~~END: decomment structure RationalI : RATIONALI ~~~~~~~~~~~~~";
29.211 -
29.212 -
29.213 -fun parse_rat str = (term_of o the o (parse thy)) str;
29.214 -
29.215 -print("\n\n***** mv_gcd-tests *****\n");
29.216 -val ggt1 = mv_gcd [(4,[2,2]),(8,[1,1]),(4,[0,0])] [(2,[1,1]),(2,[0,0])];
29.217 -(* [(2,[1,1]),(2,[0,0])] *)
29.218 -if ggt1=[(2,[1,1]),(2,[0,0])] then () else raise error ("rational.sml: example failed");
29.219 -
29.220 -val ggt2 = mv_gcd [(8,[2,1,1]),(12,[1,0,2]),(10,[2,2,0]),(15,[1,1,1])] [(2,[2,1,0]),(3,[1,0,1]),(2,[1,1,0]),(3,[0,0,1])];
29.221 -(* [(2,[1,1,0]),(3,[0,0,1])] *)
29.222 -if ggt2=[(2,[1,1,0]),(3,[0,0,1])] then () else raise error ("rational.sml: example failed");
29.223 -
29.224 -
29.225 -val ggt3 = mv_gcd [(1,[2,0]),(~2,[1,1]),(1,[0,2])] [(1,[1,0]),(~1,[0,1])];
29.226 -(* [(1,[1,0]),(~1,[0,1])] *)
29.227 -if ggt3=[(1,[1,0]),(~1,[0,1])] then () else raise error ("rational.sml: example failed");
29.228 -
29.229 -
29.230 -val ggt4 = mv_gcd [(1,[2,1,0]),(2,[2,1,0])] [(5,[1,0,0])];
29.231 -(* [(1,[1,0,0])] *)
29.232 -if ggt4=[(1,[1,0,0])] then () else raise error ("rational.sml: example failed");
29.233 -
29.234 -
29.235 -val ggt5 = mv_gcd [(4,[2,0]),(~8,[1,1]),(4,[0,2])] [(1,[2,0]),(~1,[0,2])];
29.236 -(* [(1,[1,0]),(~1,[0,1])] *)
29.237 -if ggt5=[(1,[1,0]),(~1,[0,1])] then () else raise error ("rational.sml: example failed");
29.238 -
29.239 -
29.240 -val ggt6 = mv_gcd [(10,[2,1,1]),(14,[1,1,0]),(3,[1,0,1]),(20,[1,2,1])] [(5,[1,1,1]),(7,[2,1,1])];
29.241 -(* [(1,[0,0,0])] *)
29.242 -if ggt6=[(1,[1,0,0])] then () else raise error ("rational.sml: example failed");
29.243 -
29.244 -print("\n\n***** kgv-tests *****\n");
29.245 -val kgv1=mv_lcm [(10,[])] [(15,[])];
29.246 -(* [(30,[])] *)
29.247 -if kgv1=[(30,[])] then () else raise error ("rational.sml: example failed");
29.248 -
29.249 -val kgv2=mv_lcm [(1,[2,0]),(~2,[1,1]),(1,[0,2])] [(1,[1,0]),(~1,[0,1])];
29.250 -(* [(1,[2,0]),(~2,[1,1]),(1,[0,2])] *)
29.251 -if kgv2=[(1,[2,0]),(~2,[1,1]),(1,[0,2])] then () else raise error ("rational.sml: example failed");
29.252 -
29.253 -val kgv3=mv_lcm [(4,[2,0]),(~8,[1,1]),(4,[0,2])] [(1,[2,0]),(~1,[0,2])];
29.254 -(* [(4,[3,0]),(~4,[2,1]),(~4,[1,2]),(4,[0,3])] *)
29.255 -if kgv3=[(4,[3,0]),(~4,[2,1]),(~4,[1,2]),(4,[0,3])] then () else raise error ("rational.sml: example failed");
29.256 -
29.257 -(*!!!--------
29.258 -print("\n\n***** STEP_CANCEL_TESTS: *****\n");
29.259 -
29.260 -val term2 = (term_of o the o (parse thy)) " (9 * a^^^2 * b) / (6 * a * c)";
29.261 -val div2 = term2str (step_cancel term2);
29.262 -if div2 = "3 * (a * b) * (3 * a) / (2 * c * (3 * a))" then () else raise error ("rational.sml: example failed");
29.263 -
29.264 -
29.265 -val term1 = (term_of o the o (parse thy)) "(10 * a^^^2 * b * c + 14 * a * b + 3 * a * c + 20 * a * b^^^2 * c) / a";
29.266 -val div1 = term2str(step_cancel term1);
29.267 -if div1 = "(3 * c + 14 * b + 20 * (b ^^^ 2 * c) + 10 * (a * (b * c))) * a / (1 * a)" then () else raise error ("rational.sml: example failed");
29.268 -
29.269 -val term3 = (term_of o the o (parse thy)) "(10 * a^^^2 * b * c) / (1 * x * y * z) ";
29.270 -val div3 = term2str(step_cancel term3);
29.271 -if div3="10 * a ^^^ 2 * b * c / (1 * x * y * z)" then () else raise error ("rational.sml: example failed");
29.272 -
29.273 ---------------------------------------------------------------------------!!!*)
29.274 -
29.275 -(*-----versuche 13.3.03-----
29.276 - val t = str2term "1 - x^^^2 - 5 * x^^^5";
29.277 - val vs=(((map free2str) o vars) t);
29.278 - val SOME ml = expanded2poly t vs;
29.279 - poly2term (ml, vs);
29.280 - poly2term'(rev(sort (mv_geq LEX_) (ml)),vs);
29.281 - poly2term'([(~5,[5]),(~1,[2]),(1,[0])], vs);
29.282 - monom2term((~5,[5]),vs);
29.283 - monom2term((~1,[2]),vs);
29.284 - val t' = monom2term((1,[0]),vs);(*uncaught exception LIST*)
29.285 -
29.286 - val (i,is) = (~1,[2]);
29.287 - val ttt = Const ("op *", [HOLogic.realT,HOLogic.realT]---> HOLogic.realT) $
29.288 - (Const ("uminus", HOLogic.realT --> HOLogic.realT) $
29.289 - Free ((str_of_int o abs) i, HOLogic.realT)) $
29.290 - powerproduct2term(is, vs);
29.291 - term2str ttt;
29.292 --------versuche 13.3.03-----*)
29.293 -
29.294 - val t = str2term "1 - x^^^2 - 5 * x^^^5";
29.295 - val SOME t' = expanded2polynomial t; term2str t';
29.296 -"1 + - 1 * x ^^^ 2 + - 5 * x ^^^ 5";
29.297 - val t = str2term "1 - x";
29.298 - val SOME t' = expanded2polynomial t; term2str t';
29.299 -"1 + - 1 * x";
29.300 - val t = str2term "1 + (-1) * x";
29.301 - val SOME t' = expanded2polynomial t; term2str t';
29.302 -"1 + - 1 * x";
29.303 - val t = (term_of o the o (parse thy)) "1 + (-1) * x ^^^ 2 + (-5) * x ^^^5";
29.304 - val SOME t' = polynomial2expanded t; term2str t';
29.305 -"1 - x ^^^ 2 - 5 * x ^^^ 5";
29.306 -
29.307 -
29.308 -" external calculating functions test ";
29.309 -" external calculating functions test ";
29.310 -" external calculating functions test ";
29.311 -
29.312 -val t1 = (term_of o the o (parse thy)) "((3 * x^^^2 + 6 *x + 3) / (2*x + 2))";
29.313 -val SOME (t1',asm)= factout_p_ thy t1;
29.314 -term2str t1'; terms2str asm;
29.315 -"(3 + 3 * x) * (1 + 1 * x) / (2 * (1 + 1 * x))";
29.316 -"[]";
29.317 -val SOME (t1',asm)= cancel_p_ thy t1;
29.318 -term2str t1'; terms2str asm;
29.319 -"(3 + 3 * x) / 2";
29.320 -"[\"1 + 1 * x ~= 0\"]";
29.321 -
29.322 -val t = (term_of o the o (parse thy)) "((-3 * x^^^2 + 6 *x - 3) / (2*x - 2))";
29.323 -val SOME (t',asm)= cancel_ thy t;
29.324 -term2str t'; terms2str asm;
29.325 -"(3 - 3 * x) / 2";
29.326 -"[\"-1 + x ~= 0\"]";
29.327 -val SOME (t',asm)= factout_ thy t;
29.328 -term2str t'; terms2str asm;
29.329 -"(3 - 3 * x) * (-1 + x) / (2 * (-1 + x))";
29.330 -"[]";
29.331 -
29.332 -val t = str2term "((x+ (-1)) / (x + 1)) + ((x + 1) / (x + (-1)))";
29.333 -val SOME (t',asm) = add_fraction_p_ thy t;
29.334 -term2str t'; terms2str asm;
29.335 -"(2 + 2 * x ^^^ 2) / (-1 + 1 * x ^^^ 2)";
29.336 -"[]";
29.337 -val SOME (t',asm) = common_nominator_p_ thy t;
29.338 -term2str t'; terms2str asm;
29.339 -"(-1 + 1 * x) * (-1 + 1 * x) / ((1 + 1 * x) * (-1 + 1 * x)) +\n(1 + 1 * x) * (1 + 1 * x) / ((1 + 1 * x) * (-1 + 1 * x))";
29.340 -"[]";
29.341 -
29.342 -val t = str2term "((x - 1) / (x + 1)) + ((x + 1) / (x - 1))";
29.343 -val SOME (t',asm) = add_fraction_ thy t;
29.344 -term2str t'; terms2str asm;
29.345 -"(2 + 2 * x ^^^ 2) / (-1 + x ^^^ 2)";
29.346 -"[]";
29.347 -val SOME (t',asm) = common_nominator_ thy t;
29.348 -term2str t'; terms2str asm;
29.349 -"(-1 + x) * (-1 + x) / ((1 + x) * (-1 + x)) +\n(1 + x) * (1 + x) / ((1 + x) * (-1 + x))";
29.350 -"[]";
29.351 -
29.352 -val t = str2term "((1) / (2*x + 2)) + ((1) / (2*x + (-2))) + ((1) / ( x^^^2 + (-1)))+((1) / (x^^^2 + (-2)*x + 1))";
29.353 -val SOME (t',asm) = common_nominator_p_ thy t;
29.354 -term2str t'; terms2str asm;
29.355 -"1 * (1 + -2 * x + 1 * x ^^^ 2) /\n((-1 + 1 * x) * (2 * ((-1 + 1 * x) * (1 + 1 * x)))) +\n(1 * (-1 + 1 * x ^^^ 2) /\n ((-1 + 1 * x) * (2 * ((-1 + 1 * x) * (1 + 1 * x)))) +\n (1 * (-2 + 2 * x) / ((-1 + 1 * x) * (2 * ((-1 + 1 * x) * (1 + 1 * x)))) +\n 1 * (#";
29.356 -"[]";
29.357 -val SOME (t',asm) = add_fraction_p_ thy t;
29.358 -term2str t'; terms2str asm;
29.359 -"1 * x / (1 + -2 * x + 1 * x ^^^ 2)";
29.360 -"[\"1 + 1 * x ~= 0\"]";
29.361 -val SOME(t',asm) = norm_rational_ thy t;
29.362 -term2str t'; terms2str asm;
29.363 -"1 * x / (1 + -2 * x + 1 * x ^^^ 2)";
29.364 -"[\"1 + 1 * x ~= 0\"]";
29.365 -
29.366 -val t3 = (term_of o the o (parse thy)) "((1) / (2*x + 2)) + ((1) / (2*x - 2)) + ((1) / ( x^^^2 - 1))+((1) / (x^^^2 - 2 * x + 1))";
29.367 -val SOME (t3',_) = common_nominator_ thy t3;
29.368 -val SOME (t3'',_) = add_fraction_ thy t3;
29.369 -(term2str t3');
29.370 -(term2str t3'');
29.371 -
29.372 -val SOME(t4,t5) = norm_expanded_rat_ thy t3;
29.373 -term2str t4;
29.374 -term2str (hd(t5));
29.375 -
29.376 -
29.377 -
29.378 - val t=(term_of o the o (parse thy)) "(9 - x^^^2)/(9 - 6*x + x^^^2)";
29.379 - val SOME (t',_) = factout_ thy t;
29.380 - val SOME (t'',_) = cancel_ thy t;
29.381 - term2str t';
29.382 - term2str t'';
29.383 - "(3 + x) * (3 - x) / ((3 - x) * (3 - x))";
29.384 - "(3 + x) / (3 - x)";
29.385 -
29.386 - val t=(term_of o the o (parse thy))
29.387 - "(9 - x^^^2) / (9 - 6*x + x^^^2) + 1 / (3 - x)";
29.388 - val SOME (t',_) = common_nominator_ thy t;
29.389 - val SOME (t'',_) = add_fraction_ thy t;
29.390 - term2str t';
29.391 - term2str t'';
29.392 - "(9 - x ^^^ 2) / ((3 - x) * (3 - x)) + 1 * (3 - x) / ((3 - x) * (3 - x))";
29.393 - "(4 + x) / (3 - x)";
29.394 -
29.395 -(*WN021016 added -----vv---*)
29.396 -val t = str2term "(9 - x^^^2) / (9 - 6*x + x^^^2) + 1";
29.397 -val SOME (t',_) = common_nominator_ thy t;
29.398 -val SOME (t'',_) = add_fraction_ thy t;
29.399 -term2str t' = "(9 - x ^^^ 2) / (9 - 6 * x + x ^^^ 2) +\n1\
29.400 - \ * (9 - 6 * x + x ^^^ 2) / (9 - 6 * x + x ^^^ 2)" (*true*);
29.401 -term2str t'' = "6 / (3 - x)" (*true*);
29.402 -
29.403 -val t = str2term "1 + (9 - x^^^2) / (9 - 6*x + x^^^2)";
29.404 -val SOME (t',_) = common_nominator_ thy t;
29.405 -val SOME (t'',_) = add_fraction_ thy t;
29.406 -term2str t' = "1 * (9 - 6 * x + x ^^^ 2) / (9 - 6 * x + x ^^^ 2) +\n\
29.407 - \(9 - x ^^^ 2) / (9 - 6 * x + x ^^^ 2)" (*true*);
29.408 -term2str t'' = "6 / (3 - x)" (*true*);
29.409 -(*WN021016 added -----^^---*)
29.410 -(*WN030602 added -----vv--- no rewrite -> NONE !*)
29.411 -val t = str2term "1 / a";
29.412 -val NONE = cancel_p_ thy t;
29.413 -val NONE = rewrite_set_ thy false cancel_p t;
29.414 -(*WN.2.6.03 added -------^^---*)
29.415 -
29.416 -val t = str2term "(y^^^2 - x^^^2)/(y^^^2 - 2*y*x + x^^^2)";
29.417 -val SOME (t',_) = factout_ thy t;
29.418 -val SOME (t'',_) = cancel_ thy t;
29.419 -term2str t' = "(y + x) * (y - x) / ((y - x) * (y - x))"(*true*);
29.420 -term2str t'' = "(y + x) / (y - x)";
29.421 -
29.422 -val t = str2term "(y^^^2 - x^^^2)/(y^^^2 - 2*y*x + x^^^2) + 1 / (y - x)";
29.423 -val SOME (t',_) = common_nominator_ thy t;
29.424 -val SOME (t'',_) = add_fraction_ thy t;
29.425 -term2str t' =
29.426 -"(-1 * x ^^^ 2 + y ^^^ 2) / ((-1 * x + y) * (-1 * x + y)) +\n1\
29.427 -\ * (-1 * x + y) / ((-1 * x + y) * (-1 * x + y))" (*true*);
29.428 -term2str t'' = "(-1 - x - y) / (x - y)" (*true*);
29.429 -
29.430 -val t = str2term "(x^^^2 - y^^^2)/(x^^^2 - 2*x*y + y^^^2) + 1 / (x - y)";
29.431 -val SOME (t',_) = common_nominator_ thy t;
29.432 -val SOME (t'',_) = add_fraction_ thy t;
29.433 -if term2str t' = "(-1 * y ^^^ 2 + x ^^^ 2) / ((-1 * y + x) * (-1 * y + x))\
29.434 -\ +\n1 * (-1 * y + x) / ((-1 * y + x) * (-1 * y + x))" then ()
29.435 -else raise error "rational.sml lex-ord 1";
29.436 -if term2str t'' = "(-1 - y - x) / (y - x)" then ()
29.437 -else raise error "rational.sml lex-ord 2";
29.438 -(*WN.16.10.02 WN070905 lexicographische Ordnung erhalten ! SK.ord*)
29.439 -
29.440 -
29.441 -val t = str2term "(x^^^2 - y^^^2)/(x^^^2 - 2*x*y + y^^^2)";
29.442 -val SOME (t',_) = norm_expanded_rat_ thy t;
29.443 -if term2str t' = "(x + y) / (x - y)" then ()
29.444 -else raise error "rational.sml term2poly: invalid x ^^^ 2 - y ^^^ 2 1";
29.445 -(*val SOME (t'',_) = norm_rational_ thy t;
29.446 - *** RATIONALS_TERM2POLY_EXCEPTION: Invalid Polynomial
29.447 -WN.16.10.02 ?! + WN060831???SK4
29.448 -WN070905 *** term2poly: invalid = x ^^^ 2 - y ^^^ 2*)
29.449 -
29.450 -
29.451 -val t = str2term "(9 - x^^^2)/(9 - 6*x + x^^^2) + (1)/(3 + x)";
29.452 -val SOME (t',_) = norm_expanded_rat_ thy t;
29.453 -if term2str t' = "(12 + 5 * x + x ^^^ 2) / (9 - x ^^^ 2)" then ()
29.454 -else raise error "rational.sml (9 - x^^^2)/(9 - 6*x + x^^^2) +...";
29.455 -(*val SOME (t'',_) = norm_rational_ thy t;
29.456 - *** RATIONALS_TERM2POLY_EXCEPTION: Invalid Polynomial WN.16.10.02 ?!
29.457 -WN070906 *** term2poly: invalid = 9 - x ^^^ 2 SK.term2poly*)
29.458 -
29.459 - val t=(term_of o the o (parse thy))
29.460 - "(9 + (-1)* x^^^2)/(9 + (-1)* 6*x + x^^^2) + (1)/(3 + x)";
29.461 - val SOME (t',_) = norm_expanded_rat_ thy t;
29.462 - val SOME (t'',_) = norm_rational_ thy t;
29.463 - term2str t';
29.464 - term2str t'';
29.465 - "(12 + 5 * x + x ^^^ 2) / (9 - x ^^^ 2)";
29.466 - "(12 + 5 * x + x ^^^ 2) / (9 + (-1) * x ^^^ 2)";
29.467 -
29.468 -
29.469 -" examples from: Mathematik 1 Schalk Reniets Verlag ";
29.470 -" examples from: Mathematik 1 Schalk Reniets Verlag ";
29.471 -" examples from: Mathematik 1 Schalk Reniets Verlag ";
29.472 -
29.473 -
29.474 -"-------- cancel from: Mathematik 1 Schalk Reniets Verlag --------";
29.475 -"-------- cancel from: Mathematik 1 Schalk Reniets Verlag --------";
29.476 -"-------- cancel from: Mathematik 1 Schalk Reniets Verlag --------";
29.477 -val thy' = "Rational.thy";
29.478 -val rls' = "cancel";
29.479 -val mp = "make_polynomial";
29.480 -
29.481 -print("\n\nexample 186:\n");
29.482 -print("a)\n");
29.483 -val e186a'="(14 * x * y) / ( x * y )";(*SRC*)
29.484 -val e186a = the (rewrite_set thy' false "cancel" e186a');
29.485 - is_expanded (parse_rat "14 * x * y");
29.486 - is_expanded (parse_rat "x * y");
29.487 -
29.488 -print("b)\n");
29.489 -val e186b'="(60 * a * b) / ( 15 * a * b )";
29.490 -val e186b = the (rewrite_set thy' false "cancel" e186b');
29.491 -print("c)\n");
29.492 -val e186c'="(144 * a^^^2 * b * c) / (12 * a * b * c )";
29.493 -val e186c = (the (rewrite_set thy' false "cancel" e186c'))
29.494 - handle e => print_exn e;
29.495 -val t = (term_of o the o (parse thy)) e186c';
29.496 -atomt t;
29.497 -
29.498 -print("\n\nexample 187:\n");
29.499 -print("a)\n");
29.500 -val e187a'="(12 * x * y) / (8 * y^^^2 )";(*SRC*)
29.501 -val e187a = the (rewrite_set thy' false "cancel" e187a');
29.502 -print("b)\n");
29.503 -val e187b'="(8 * x^^^2 * y * z ) / (18 * x * y^^^2 * z )";
29.504 -val e187b = the (rewrite_set thy' false "cancel" e187b');
29.505 -print("c)\n");
29.506 -val e187c'="(9 * x^^^5 * y^^^2 * z^^^4) / (15 * x^^^6 * y^^^3 * z )";(*SRC*)
29.507 -val e187c = the (rewrite_set thy' false "cancel" e187c');
29.508 -
29.509 -"example 188:";
29.510 -val e188a'="(-8 + 8 * x) / (-9 + 9 * x)";(*SRC*)
29.511 -val e188a = the (rewrite_set thy' false "cancel" e188a');
29.512 - is_expanded (parse_rat "8 * x + -8");
29.513 -(* e188a = ("8 / 9",["not ((-1) + x = 0)"]) then () 13.3.03*)
29.514 -if e188a = ("8 / 9",["-1 + x ~= 0"]) then ()
29.515 -else raise error "rational.sml: e188a new behaviour";
29.516 -val SOME (t,_) = rewrite_set thy' false mp
29.517 - "(8*((-1) + x))/(9*((-1) + x))";
29.518 -print("b)\n");
29.519 -val e188b'="(-15 + 5 * x) / (-18 + 6 * x)";(*SRC*)
29.520 -val SOME (t,_) = rewrite_set thy' false "cancel" e188b';
29.521 -t = "5 / 6" (*true*);
29.522 -print("c)\n");
29.523 -
29.524 -val e188c'="( a + -1 * b ) / ( b + -1 * a )";
29.525 -val e188c = the (rewrite_set thy' false "cancel_p" e188c');
29.526 -(*is_expanded (parse_rat "a + -1 * b");*)
29.527 -val SOME (t,_) =
29.528 - rewrite_set thy' false mp "((-1)*(b + (-1) * a))/(1*(b + (-1) * a))";
29.529 -if t= "(a + -1 * b) / (-1 * a + b)" then()
29.530 -else raise error "rational.sml: e188c new behaviour";
29.531 -
29.532 -print("\n\nexample 190:\n");
29.533 -print("c)\n");
29.534 -val e190c'="( 27 * a^^^3 + 9 * a^^^2 + 3 * a + 1 ) / ( 27 * a^^^3 + 18 * a^^^2 + 3 * a )";
29.535 -val e190c = the (rewrite_set thy' false "cancel" e190c');
29.536 -val SOME (t,_) = rewrite_set thy' false mp "((1 + 9 * a ^^^ 2)*(1 + 3 * a))/((3 * a + 9 * a ^^^ 2)*(1 + 3 * a))";
29.537 -if t = "(1 + 3 * a + 9 * a ^^^ 2 + 27 * a ^^^ 3) /\n(3 * a + 18 * a ^^^ 2 + 27 * a ^^^ 3)" then ()
29.538 -else raise error "rational.sml: e190c new behaviour";
29.539 -
29.540 -print("\n\nexample 191:\n");
29.541 -print("a)\n");
29.542 -val e191a'="( x^^^2 + -1 * y^^^2 ) / ( x + y )";
29.543 -(*WN.23.10.02-------
29.544 -val e191a = the (rewrite_set thy' false "cancel" e191a');
29.545 - is_expanded (parse_rat "x^^^2 + -1 * y^^^2");
29.546 - false;
29.547 - is_expanded (parse_rat "x + y");
29.548 - true; -----------*)
29.549 -val SOME (t,_) = rewrite_set thy' false mp "((x + (-1) * y)*(x + y))/((1)*(x + y))";
29.550 -(* t="(x ^^^ 2 + -1 * y ^^^ 2) / (x + y)" then() WN.13.3.03*)
29.551 -if t="(x ^^^ 2 + -1 * y ^^^ 2) / (x + y)" then()
29.552 -else raise error "rational.sml: e191a new behaviour";
29.553 -
29.554 -print("c)\n");
29.555 -val e191c'="( 9 * x^^^2 + -30 * x + 25 ) / ( 9 * x^^^2 + -25 )";
29.556 -(*WN.23.10.02-------
29.557 -val e191c = the (rewrite_set thy' false "cancel" e191c');
29.558 - is_expanded (parse_rat "9 * x^^^2 + -30 * x + 25");
29.559 - false;
29.560 - is_expanded (parse_rat "25 + -30*x + 9*x^^^2");
29.561 - false;
29.562 - is_expanded (parse_rat "-25 + 9*x^^^2");
29.563 - true;------------*)
29.564 -val SOME (t,_) = rewrite_set thy' false mp "(((-5) + 3 * x)*((-5) + 3 * x))/((5 + 3 * x)*((-5) + 3 * x))";
29.565 -(* t="(25 + ((-30) * x + 9 * x ^^^ 2)) / ((-25) + 9 * x ^^^ 2)"then() 13.3.03*)
29.566 -if t= "(25 + -30 * x + 9 * x ^^^ 2) / (-25 + 9 * x ^^^ 2)" then()
29.567 -else raise error "rational.sml: 'e191c' new behaviour";
29.568 -
29.569 -
29.570 -print("\n\nexample 192:\n");
29.571 -print("b)\n");
29.572 -val e192b'="( 7 * x^^^3 + -1 * x^^^2 * y ) / ( 7 * x * y^^^2 + -1 * y^^^3 )";
29.573 -(*WN.23.10.02-------
29.574 -val e192b = the (rewrite_set thy' false "cancel" e192b');
29.575 --------------------*)
29.576 -val SOME (t',_) = rewrite_set thy' false mp "((x ^^^ 2)*(7 * x + (-1) * y))/((y ^^^ 2)*(7 * x + (-1) * y))";
29.577 -if t' = "(7 * x ^^^ 3 + -1 * x ^^^ 2 * y) / (7 * x * y ^^^ 2 + -1 * y ^^^ 3)"
29.578 -(*"(-1 * y * x ^^^ 2 + 7 * x ^^^ 3) / (-1 * y ^^^ 3 + 7 * x * y ^^^ 2)"WN050929*)
29.579 -then () else raise error "rational.sml: 'e192b' new behaviour";
29.580 -(*^^^ works with MG's simplifier vvv*)
29.581 -val t =str2term"((x ^^^ 2)*(7 * x + (-1) * y))/((y ^^^ 2)*(7 * x + (-1) * y))";
29.582 -val SOME (t',_) = rewrite_set_ Isac.thy false make_polynomial t;
29.583 -if term2str t' = "(7 * x ^^^ 3 + -1 * x ^^^ 2 * y) / (7 * x * y ^^^ 2 + -1 * y ^^^ 3)" then () else raise error "rational.sml: 'e192b'MG new behaviour";
29.584 -
29.585 -
29.586 -print("\n\nexample 193:\n");
29.587 -print("a)\n");
29.588 -val e193a'="( x^^^2 + -6 * x + 9 ) / ( x^^^2 + -9 )";
29.589 -(*WN.23.10.02-------
29.590 -val e193a = the (rewrite_set thy' false "cancel" e193a');
29.591 --------------------*)
29.592 -print("b)\n");
29.593 -val e193b'="( x^^^2 + -8 * x + 16 ) / ( 2 * x^^^2 + -32 )";
29.594 -(*WN.23.10.02-------
29.595 -val e193b = the (rewrite_set thy' false "cancel" e193b');
29.596 -print("c)\n");
29.597 -val e193c'="( 2 * x + -50 * x^^^3 ) / ( 25 * x^^^2 + -10 * x + 1 )";
29.598 -val SOME(t,_) = rewrite_set thy' false "cancel" e193c';
29.599 --------------------*)
29.600 -
29.601 -val wn01 = "(-25 + 9*x^^^2)/(5 + 3*x)";
29.602 -val SOME (t,_) = rewrite_set thy' false "cancel" wn01;
29.603 -(* t = "((-5) + 3 * x) / 1" then () WN.13.3.03*)
29.604 -if t = "(-5 + 3 * x) / 1" then ()
29.605 -else raise error "rational.sml: new behav. in cancel wn01";
29.606 -
29.607 -
29.608 -"-------- common_nominator_p ---------------------------- --------";
29.609 -"-------- common_nominator_p ---------------------------- --------";
29.610 -"-------- common_nominator_p ---------------------------- --------";
29.611 -val rls' = "common_nominator_p";
29.612 -
29.613 -print("\n\nexample 204:\n");
29.614 -print("a)\n");
29.615 -val e204a'="((5 * x) / 9) + ((3 * x) / 9) + (x / 9)";
29.616 -val e204a = the (rewrite_set thy' false "common_nominator_p" e204a');
29.617 -print("b)\n");
29.618 -val e204b'="5 / x + -3 / x + -1 / x";
29.619 -val e204b = the (rewrite_set thy' false "common_nominator_p" e204b');
29.620 -
29.621 -print("\n\nexample 205:\n");
29.622 -print("a)\n");
29.623 -val e205a'="((4 * x + 7) / 8) + ((4 * x + 3) / 8)";
29.624 -val e205a = the (rewrite_set thy' false "common_nominator_p" e205a');
29.625 -print("b)\n");
29.626 -val e205b'="((5 * x + 2) / 3) + ((-2 * x + 1) / 3)";
29.627 -val e205b = the (rewrite_set thy' false "common_nominator_p" e205b');
29.628 -
29.629 -print("\n\nexample 206:\n");
29.630 -print("a)\n");
29.631 -val e206a'="((5 * x + 4) / (2 * x + -1)) + ((9 * x + 5) / (2 * x + -1))";
29.632 -val e206a = the (rewrite_set thy' false "common_nominator_p" e206a');
29.633 -print("b)\n");
29.634 -val e206b'="((17 * x + -23) / (5 * x + 4)) + ((-25 + -17 * x) / (5 * x + 4))";
29.635 -val e206b = the (rewrite_set thy' false "common_nominator_p" e206b');
29.636 -
29.637 -print("\n\nexample 207:\n");
29.638 -val e207'="((3 * x * y + 3 * y) / (x * y)) + ((5 * x * y + 7 * y) / (x * y)) + ((9 * x * y + -2 * y) / (x * y)) + ((x * y + 4 * y) / (x * y)) ";
29.639 -val e207 = the (rewrite_set thy' false "common_nominator_p" e207');
29.640 -
29.641 -print("\n\nexample 208:\n");
29.642 -val e208'="((3 * x + 2) / (x + 2)) + ((5 * x + -1) / (x + 2)) + ((-7 * x + -3) / (x + 2)) + ((-1 * x + -3) / (x + 2)) ";
29.643 -val e208 = the (rewrite_set thy' false "common_nominator_p" e208');
29.644 -
29.645 -print("\n\nexample 209:\n");
29.646 -val e209'="((3 * x + -7 * y + 3 * z) / (4)) + ((2 * x + 17 * y + 10 * z) / (4)) + ((-1 * x + 2 * y + z) / (4)) ";
29.647 -val e209 = the (rewrite_set thy' false "common_nominator_p" e209');
29.648 -
29.649 -print("\n\nexample 210:\n");
29.650 -val e210'="((2 * x + 3 + -1 * x^^^2) / (5 * x)) + ((5 * x^^^2 + -2 * x + 1) / (5 * x)) + ((-3 * x^^^2 + -2 * x + 1) / (5 * x)) + ((-1 * x^^^2 + -3 * x + -5) / (5 * x)) ";
29.651 -val e210 = the (rewrite_set thy' false "common_nominator_p" e210');
29.652 -
29.653 -print("\n\nexample 211:\n");
29.654 -print("a)\n");
29.655 -val e211a'="((b) / (a + -1 * b)) + ((-1 * a) / (a + -1 * b))";
29.656 -val e211a = the (rewrite_set thy' false "common_nominator_p" e211a');
29.657 -print("b)\n");
29.658 -val e211b'="((b) / (b^^^2 + -1 * a^^^2)) + ((-1 * a) / (b^^^2 + -1 * a^^^2))";
29.659 -val e211b = the (rewrite_set thy' false "common_nominator_p" e211b');
29.660 -
29.661 -print("\n\nexample 212:\n");
29.662 -print("a)\n");
29.663 -val e212a'="((4) / (x)) + ((-3) / (y)) + -1";
29.664 -val e212a = the (rewrite_set thy' false "common_nominator_p" e212a');
29.665 -print("b)\n");
29.666 -val e212b'="((4) / (x)) + ((-5) / (y)) + ((6) / (x*y))";
29.667 -val e212b = the (rewrite_set thy' false "common_nominator_p" e212b');
29.668 -
29.669 -print("\n\nexample 213:\n");
29.670 -print("a)\n");
29.671 -val e213a'="((5 * x) / (3 * y^^^2)) + ((19 * z) / (6 * x * y)) + ((-2 * x) / (3 * y^^^2)) + ((7 * y^^^2) / (6 * x^^^2)) ";
29.672 -val e213a = the (rewrite_set thy' false "common_nominator_p" e213a');
29.673 -print("b)\n");
29.674 -val e213b'="((2 * b) / (3 * a^^^2)) + ((3 * c) / (7 * a * b)) + ((4 * b) / (3 * a^^^2)) + ((3 * a) / (7 * b^^^2))";
29.675 -val e213b = the (rewrite_set thy' false "common_nominator_p" e213b');
29.676 -
29.677 -print("\n\nexample 214:\n");
29.678 -print("a)\n");
29.679 -val e214a'="((3 * x + 2 * y + 2 * z) / (4)) + ((-5 * x + -3 * y) / (3)) + ((x + y + -2 * z) / (2))";
29.680 -val e214a = the (rewrite_set thy' false "common_nominator_p" e214a');
29.681 -print("b)\n");
29.682 -val e214b'="((5 * x + 2 * y + z) / (2)) + ((-7 * x + -3 * y) / (3)) + ((3 * x + 6 * y + -1 * z) / (12))";
29.683 -val e214b = the (rewrite_set thy' false "common_nominator_p" e214b');
29.684 -
29.685 -print("\n\nexample 216:\n");
29.686 -print("a)\n");
29.687 -val e216a'="((2 * b + 3 * c) / (a * c)) + ((3 * a + b) / (a * b)) + ((-2 * b^^^2 + -3 * a * c) / (a * b * c))";
29.688 -val e216a = the (rewrite_set thy' false "common_nominator_p" e216a');
29.689 -print("b)\n");
29.690 -val e216b'="((2 * a + 3 * b) / (b * c)) + ((3 * c + a) / (a * c)) + ((-2 * a^^^2 + -3 * b * c) / (a * b * c))";
29.691 -val e216b = the (rewrite_set thy' false "common_nominator_p" e216b');
29.692 -
29.693 -print("\n\nexample 217:\n");
29.694 -val e217'="((z + -1) / (z)) + ((3 * z ^^^2 + -6 * z + 5) / (z^^^2)) + ((-4 * z^^^3 + 7 * z^^^2 + -5 * z + 5) / (z^^^3))";
29.695 -val e217 = the (rewrite_set thy' false "common_nominator_p" e217');
29.696 -
29.697 -
29.698 -val rls' = "common_nominator";
29.699 -print("\n\nexample 218:\n");
29.700 -val e218'="((9 * a^^^3 - 5 * a^^^2 + 2 * a + 8) / (108 * a^^^4)) + ((-5 * a + 3 * a^^^2 + 4) / (8 * a^^^3)) + ((-261 * a^^^3 + 19 * a^^^2 + -112 * a + 16) / (216 * a^^^4))";
29.701 -val e218 = the (rewrite_set thy' false "common_nominator" e218');
29.702 -
29.703 -print("\n\nexample 219:\n");
29.704 -print("a)\n");
29.705 -val e219a'="((1) / (y + 1)) + ((1) / (y + 2)) + ((1) / (y + 3))";
29.706 -val e219a = the (rewrite_set thy' false "common_nominator" e219a');
29.707 -print("b)\n");
29.708 -val e219b'="((1) / (x + 1)) + ((1) / (x + 2)) + ((-2) / (x + 3))";
29.709 -val e219b = the (rewrite_set thy' false "common_nominator" e219b');
29.710 -
29.711 -print("\n\nexample 220:\n");
29.712 -print("a)\n");
29.713 -val e220a'="((17) / (5 * r + -2)) + ((-13) / (2 * r + 3)) + ((4) / (3 * r + -5))";
29.714 -val e220a = the (rewrite_set thy' false "common_nominator" e220a');
29.715 -print("b)\n");
29.716 -val e220b'="((20 * a) / (a + -3)) + ((-19 * a) / (a + -4)) + ((a) / (a + -5))";
29.717 -val e220b = the (rewrite_set thy' false "common_nominator" e220b');
29.718 -
29.719 -print("\n\nexample 221:\n");
29.720 -print("a)\n");
29.721 -val e221a'="((a + b) / (a + -1 * b)) + ((a + -1 * b) / (a + b))";
29.722 -val e221a = the (rewrite_set thy' false "common_nominator" e221a');
29.723 -print("b)\n");
29.724 -val e221b'="((x + -1 * y) / (x + y)) + ((x + y) / (x + -1 * y)) ";
29.725 -val e221b = the (rewrite_set thy' false "common_nominator" e221b');
29.726 -
29.727 -print("\n\nexample 222:\n");
29.728 -print("a)\n");
29.729 -val e222a'="((1 + -1 * x) / (1 + x)) + ((-1 + -1 * x) / (1 + -1 * x)) + ((4 * x) / (1 + -1 * x^^^2))";
29.730 -val e222a = the (rewrite_set thy' false "common_nominator" e222a');
29.731 -print("b)\n");
29.732 -val e222b'="((1 + x ) / (1 + -1 * x)) + ((-1 + x) / (1 + x)) + ((2 * x) / (1 + -1 * x^^^2))";
29.733 -val e222b = the (rewrite_set thy' false "common_nominator" e222b');
29.734 -
29.735 -print("\n\nexample 225:\n");
29.736 -print("a)\n");
29.737 -val e225a'="((6 * a) / (a^^^2 + -64)) + ((a + 2) / (2 * a + 16)) + ((-1) / (2))";
29.738 -val e225a = the (rewrite_set thy' false "common_nominator" e225a');
29.739 -print("b)\n");
29.740 -val e225b'="((a + 2 ) / (2 * a + 12)) + ((4 * a) / (a^^^2 + -36)) + ((-1) / (2))";
29.741 -val e225b = the (rewrite_set thy' false "common_nominator" e225b');
29.742 -
29.743 -print("\n\nexample 226:\n");
29.744 -print("a)\n");
29.745 -val e226a'="((35 * z) / (49 * z^^^2 + -4)) + -1 + ((14 * z + -1) / (14 * z + 4)) ";
29.746 -val e226a = the (rewrite_set thy' false "common_nominator" e226a');
29.747 -print("b)\n");
29.748 -val e226b'="((45 * a * b) / (25 * a^^^2 + -9 * b^^^2)) + ((20 * a + 3 * b) / (10 * a + 6 * b)) + -2";
29.749 -val e226b = the (rewrite_set thy' false "common_nominator" e226b');
29.750 -
29.751 -print("\n\nexample 227:\n");
29.752 -print("a)\n");
29.753 -val e227a'="((6 * z + 11) / (6 * z + 14)) + ((9 * z ) / (9 * z^^^2 + -49)) + -1 ";
29.754 -val e227a = the (rewrite_set thy' false "common_nominator" e227a');
29.755 -print("b)\n");
29.756 -val e227b'="((16 * a + 37 * b) / (4 * a + 10 * b)) + ((6 * a * b) / (4 * a^^^2 + -25 * b^^^2)) + -4 ";
29.757 -val e227b = the (rewrite_set thy' false "common_nominator" e227b');
29.758 -
29.759 -print("\n\nexample 228:\n");
29.760 -print("a)\n");
29.761 -val e228a'="((7 * a + 11) / (3 * a^^^2 + -3)) + ((-2 * a + -1) / (a^^^2 + -1 * a)) + ((-1) / (3 * a + 3))";
29.762 -val e228a = the (rewrite_set thy' false "common_nominator" e228a');
29.763 -print("b)\n");
29.764 -val e228b'="((11 * z + 2 * b) / (4 * b * z + -8 * b^^^2)) + ((-8 * z) / (z^^^2 + -4 * b^^^2)) + ((-9 * z + -2 * b) / (4 * b * z + 8 * b^^^2))";
29.765 -val e228b = the (rewrite_set thy' false "common_nominator" e228b');
29.766 -
29.767 -
29.768 -print("\n\nexample 229:\n");
29.769 -print("a)\n");
29.770 -val e229a'="((5 * x^^^2 + y) / (x + 2 * y)) + ((-8 * x^^^3 + 4 * x^^^2 * y + 3 * x * y) / (x^^^2 + -4 * y^^^2)) + ((3 * x^^^2 + -4 * y) / (x + -2 * y))";
29.771 -val e229a = the (rewrite_set thy' false "common_nominator" e229a');
29.772 -print("b)\n");
29.773 -val e229b'="((7 * x^^^2 + y) / (x + 3 * y)) + ((-24 * x^^^2 * y + 5 * x * y + 21 * y^^^2) / (x^^^2 + -9 * y^^^2)) + ((4 * x^^^2 + -6 * y) / (x + -3 * y))";
29.774 -val e229b = the (rewrite_set thy' false "common_nominator" e229b');
29.775 -
29.776 -print("\n\nexample 230:\n");
29.777 -print("a)\n");
29.778 -val e230a'="((5 * x^^^2 + y) / (2 * x + y)) + ((-16 * x^^^3 + 2 * x^^^2 * y + 6 * x * y) / (4 * x^^^2 + -1 * y^^^2)) + ((3 * x^^^2 + -4 * y) / (2 * x + -1 * y))";
29.779 -val e230a = the (rewrite_set thy' false "common_nominator" e230a');
29.780 -print("b)\n");
29.781 -val e230b'="((7 * x^^^2 + y) / (3 * x + y)) + ((-3 * x^^^3 + 15 * x * y + -7 * x^^^2 * y + 7 * y^^^2) / (9 * x^^^2 + -1 * y^^^2)) + ((4 * x^^^2 + -6 * y) / (3 * x + -1 * y))";
29.782 -val e230b = the (rewrite_set thy' false "common_nominator" e230b');
29.783 -
29.784 -print("\n\nexample 231:\n");
29.785 -print("a)\n");
29.786 -val e231a'="((2 * x + 5 * y) / (x)) + ((2 * x^^^3 + -5 * y^^^3 + 3 * x * y^^^2) / (x^^^3 + -2 * x^^^2 * y + x * y^^^2)) + ((-3 * x + -6 * y) / (x + -1 * y))";
29.787 -val e231a = the (rewrite_set thy' false "common_nominator" e231a');
29.788 -print("b)\n");
29.789 -val e231b'="((6 * x + 2 * y) / (x)) + ((6 * x^^^2 * y + -4 * x * y^^^2 + -2 * y^^^3) / (x^^^3 + -2 * x^^^2 * y + x * y^^^2)) + ((-5 * x + -3 * y) / (x + -1 * y))";
29.790 -val e231b = the (rewrite_set thy' false "common_nominator" e231b');
29.791 -
29.792 -print("\n\nexample 232:\n");
29.793 -print("a)\n");
29.794 -val e232a'="((2 * x + 3 * y) / (x)) + ((4 * x^^^3 + -1 * x * y^^^2 + -3 * y^^^3) / (x^^^3 + -2 * x^^^2 * y + x * y^^^2)) + ((-5 * x + -6 * y) / (x + -1 * y))";
29.795 -val e232a = the (rewrite_set thy' false "common_nominator" e232a');
29.796 -print("b)\n");
29.797 -val e232b'="((5 * x + 2 * y) / (x)) + ((2 * x^^^3 + -3 * x * y^^^2 + 3 * x^^^2 * y + -2 * y^^^3) / (x^^^3 + -2 * x^^^2 * y + x * y^^^2)) + ((-6 * x + -3 * y) / (x + -1 * y))";
29.798 -val e232b = the (rewrite_set thy' false "common_nominator" e232b');
29.799 -
29.800 -print("\n\nexample 233:\n");
29.801 -print("a)\n");
29.802 -val e233a'="((5 * x + 6 * y) / (x)) + ((5 * x * y^^^2 + -6 * y^^^3 + -2 * x^^^3 + 3 * x^^^2 * y) / (x^^^3 + -2 * x^^^2 * y + x * y^^^2)) + ((-2 * x + -3 * y) / (x + -1 * y))";
29.803 -val e233a = the (rewrite_set thy' false "common_nominator" e233a');
29.804 -print("b)\n");
29.805 -val e233b'="((6 * x + 5 * y) / (x)) + ((4 * x^^^2 * y + 3 * x * y^^^2 + -5 * y^^^3 + -2 * x^^^3) / (x^^^3 + -2 * x^^^2 * y + x * y^^^2)) + ((-3 * x + -2 * y) / (x + -1 * y))";
29.806 -val e233b = the (rewrite_set thy' false "common_nominator" e233b');
29.807 -
29.808 -print("\n\nexample 234:\n");
29.809 -print("a)\n");
29.810 -val e234a'="((5 * a + b) / (2 * a * b + -2 * b^^^2)) + ((-3 * a + -1 * b) / (2 * a * b + 2 * b^^^2)) + ((-2 * a) / (a^^^2 + -1 * b^^^2))";
29.811 -val e234a = the (rewrite_set thy' false "common_nominator" e234a');
29.812 -print("b)\n");
29.813 -val e234b'="((5 * a + 3 * b) / (6 * a * b + -18 * b^^^2)) + ((-3 * a + -3 * b) / (6 * a * b + 18 * b^^^2)) + ((-2 * a) / (a^^^2 + -9 * b^^^2)) ";
29.814 -val e234b = the (rewrite_set thy' false "common_nominator" e234b');
29.815 -
29.816 -print("\n\nexample 235:\n");
29.817 -print("a)\n");
29.818 -val e235a'="((10 * x + 3 * y) / (12 * x * y + -18 * y^^^2)) + ((-6 * x + -3 * y) / (12 * x * y + 18 * y^^^2)) + ((-4 * x) / (4 * x^^^2 + -9 * y^^^2))";
29.819 -val e235a = the (rewrite_set thy' false "common_nominator" e235a');
29.820 -print("b)\n");
29.821 -val e235b'="((8 * a + b) / (4 * a * b + -2 * b^^^2)) + ((-4 * a + -1 * b) / (4 * a * b + 2 * b^^^2)) + ((-2 * a) / (4 * a^^^2 + -1 * b^^^2)) ";
29.822 -val e235b = the (rewrite_set thy' false "common_nominator" e235b');
29.823 -
29.824 -print("\n\nexample 236:\n");
29.825 -print("a)\n");
29.826 -val e236a'="((8 * a + 5 * b) / (20 * a * b + -50 * b^^^2)) + ((-4 * a + -5 * b) / (20 * a * b + 50 * b^^^2)) + ((-2 * a) / (4 * a^^^2 + -25 * b^^^2))";
29.827 -val e236a = the (rewrite_set thy' false "common_nominator" e236a');
29.828 -print("b)\n");
29.829 -val e236b'="((24 * x + y) / (6 * x * y + -2 * y^^^2)) + ((-18 * x + -1 * y) / (6 * x * y + 2 * y^^^2)) + ((-15 * x) / (9 * x^^^2 + -1 * y^^^2)) ";
29.830 -val e236b = the (rewrite_set thy' false "common_nominator" e236b');
29.831 -
29.832 -
29.833 -val rls' = "cancel";
29.834 -print("\n\nexample heuberger:\n");
29.835 -val eheu'="(x^^^4 + x * y + x^^^3 * y + y^^^2) / (x + 5 * x^^^2 + y + 5 * x * y + x^^^2 * y^^^3 + x * y^^^4)";
29.836 -val eheu = the (rewrite_set thy' false "cancel" eheu');
29.837 -
29.838 -val rls' = "common_nominator_p";
29.839 -print("\n\nexample stiefel:\n");
29.840 -val est1'="(7) / (-14) + (-2) / (4)";
29.841 -val est1 = the (rewrite_set thy' false "common_nominator_p" est1');
29.842 -if est1 = ("-1 / 1",[]) then ()
29.843 -else raise error "new behaviour in rational.sml: est1'";
29.844 -
29.845 -val t = (term_of o the o (parse thy))
29.846 -"(9 - x ^^^ 2) / (9 - 6 * x + x ^^^ 2)";
29.847 -val SOME (t',_) = factout_ thy t;
29.848 -term2str t';
29.849 -"(3 + x) * (3 - x) / ((3 - x) * (3 - x))";
29.850 -
29.851 -
29.852 -"-------- reverse rewrite ----------------------------------------";
29.853 -"-------- reverse rewrite ----------------------------------------";
29.854 -"-------- reverse rewrite ----------------------------------------";
29.855 -
29.856 -(*WN.28.8.02: tests for the 'reverse-rewrite' functions:
29.857 - these are defined in Rationals.ML and stored in
29.858 - the 'reverse-ruleset' cancel*)
29.859 -
29.860 -(*the term for which reverse rewriting is demonstrated*)
29.861 - val t = (term_of o the o (parse thy))
29.862 - "(9 - x ^^^ 2) / (9 + 6 * x + x ^^^ 2)";
29.863 - val Rrls {scr=Rfuns {init_state=ini,locate_rule=loc,
29.864 - next_rule=nex,normal_form=nor,...},...} = cancel;
29.865 -
29.866 -(*normal_form produces the result in ONE step*)
29.867 - val SOME (t',_) = nor t;
29.868 - term2str t';
29.869 -
29.870 -(*initialize the interpreter state used by the 'me'*)
29.871 - val (t,_,revsets,_) = ini t;
29.872 -
29.873 -(*find the rule 'r' to apply to term 't'*)
29.874 - val SOME r = nex revsets t;
29.875 - (*val r = Thm ("sym_#mult_2_3","6 = 2 * 3") : rule*)
29.876 -
29.877 -(*check, if the rule 'r' applied by the user to 't' belongs to the ruleset;
29.878 - if the rule is OK, the term resulting from applying the rule is returned,too;
29.879 - there might be several rule applications inbetween,
29.880 - which are listed after the head in reverse order*)
29.881 - val (r,(t,asm))::_ = loc revsets t r;
29.882 - term2str t;
29.883 - "(9 - x ^^^ 2) / (3 ^^^ 2 + 6 * x + x ^^^ 2)";
29.884 -
29.885 -(*find the next rule to apply*)
29.886 - val SOME r = nex revsets t;
29.887 - (*val r = Thm ("sym_#power_3_2","9 = 3 ^^^ 2") : rule*)
29.888 -
29.889 -(*check the next rule*)
29.890 - val (r,(t,asm))::_ = loc revsets t r;
29.891 - term2str t;
29.892 - "(3 ^^^ 2 - x ^^^ 2) / (3 ^^^ 2 + 6 * x + x ^^^ 2)";
29.893 -
29.894 -(*find and check the next rules, rewrite*)
29.895 - val SOME r = nex revsets t;
29.896 - val (r,(t,asm))::_ = loc revsets t r;
29.897 - term2str t;
29.898 - "(3 ^^^ 2 - x ^^^ 2) / (3 ^^^ 2 + 2 * 3 * x + x ^^^ 2)";
29.899 -
29.900 - val SOME r = nex revsets t;
29.901 - val (r,(t,asm))::_ = loc revsets t r;
29.902 - term2str t;
29.903 - "(3 - x) * (3 + x) / (3 ^^^ 2 + 2 * 3 * x + x ^^^ 2)";
29.904 -
29.905 - val SOME r = nex revsets t;
29.906 - val (r,(t,asm))::_ = loc revsets t r;
29.907 - term2str t;
29.908 - "(3 - x) * (3 + x) / ((3 + x) * (3 + x))";
29.909 -
29.910 - val SOME r = nex revsets t;
29.911 - val (r,(t,asm))::_ = loc revsets t r;
29.912 - val ss = term2str t;
29.913 - if ss = "(3 - x) / (3 + x)" then ()
29.914 - else raise error "rational.sml: new behav. in rev-set cancel";
29.915 - terms2str asm;
29.916 -
29.917 -
29.918 -"-------- 'reverse-ruleset' cancel_p -----------------------------";
29.919 -"-------- 'reverse-ruleset' cancel_p -----------------------------";
29.920 -"-------- 'reverse-ruleset' cancel_p -----------------------------";
29.921 -(*WN.11.9.02: the 'reverse-ruleset' cancel_p*)
29.922 -
29.923 -(*the term for which reverse rewriting is demonstrated*)
29.924 -val t = str2term "(9 + (-1)*x^^^2) / (9 + ((-6)*x + x^^^2))";
29.925 -val Rrls {scr=Rfuns {init_state=ini,locate_rule=loc,
29.926 - next_rule=nex,normal_form=nor,...},...} = cancel_p;
29.927 -
29.928 -(*normal_form produces the result in ONE step*)
29.929 -val SOME (t',_) = nor t;
29.930 -term2str t' = "(3 + 1 * x) / (3 + -1 * x)";
29.931 -
29.932 -(*initialize the interpreter state used by the 'me'*)
29.933 -val SOME (t', asm) = cancel_p_ thy t;
29.934 -term2str t' = "(3 + x) / (3 + -1 * x)" (*true*);
29.935 -terms2str asm = "[\"3 + -1 * x ~= 0\"]" (*true*);
29.936 -val (t,_,revsets,_) = ini t;
29.937 -
29.938 -(* WN.10.10.02: dieser Fall terminiert nicht
29.939 - (make_polynomial enth"alt zu viele rules)
29.940 -WN060823 'init_state' requires rewriting on specified location in the term
29.941 -print_depth 99; Rfuns; print_depth 3;
29.942 -WN060831 cycling "sym_order_mult_rls_" "sym_real_mult_assoc"
29.943 - as was with make_polynomial before ?!?*)
29.944 -
29.945 -val SOME r = nex revsets t;
29.946 -eq_Thm (r, Thm ("sym_#power_Float ((3,0), (0,0)) __ ((2,0), (0,0))",
29.947 - mk_thm Rational.thy "9 = 3 ^^^ 2"));
29.948 -(*WN060831 *** id_of_thm
29.949 - Exception- ERROR raised ...
29.950 -val (r,(t,asm))::_ = loc revsets t r;
29.951 -term2str t;
29.952 -
29.953 - val SOME r = nex revsets t;
29.954 - val (r,(t,asm))::_ = loc revsets t r;
29.955 - term2str t;
29.956 -*)
29.957 -
29.958 -print "\n\n\n****************** all tests successfull *************************\n";
29.959 -
29.960 -
29.961 -
29.962 -(*WN.17.3.03 =========================================================vvv---*)
29.963 -"-------- norm_Rational ------------------------------------------";
29.964 -"-------- norm_Rational ------------------------------------------";
29.965 -"-------- norm_Rational ------------------------------------------";
29.966 -val t = str2term "(3*x+5)/18 - x/2 - -(3*x - 2)/9 = 0";
29.967 -val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t';
29.968 -if term2str t' = "1 / 18 = 0" then () else raise error "rational.sml 1";
29.969 -
29.970 -val t = str2term "(17*x - 51)/9 - (-(13*x - 3)/6) + 11 - (9*x - 7)/4 = 0";
29.971 -val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t';
29.972 -if term2str t' = "(237 + 65 * x) / 36 = 0" then ()
29.973 -else raise error "rational.sml 2";
29.974 -
29.975 -val t = str2term "(1/2 + (5*x)/2)^^^2 - ((13*x)/2 - 5/2)^^^2 - (6*x)^^^2 + 29";
29.976 -val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t';
29.977 -(*before 040209:if term2str t' = "(23 + (35 * x + -72 * x ^^^ 2)) / 1"then()*)
29.978 -if term2str t' = "23 + 35 * x + -72 * x ^^^ 2" then ()
29.979 -else raise error "rational.sml 3";
29.980 -(*trace_rewrite:=true;*)
29.981 -val t = str2term "Not (6*x is_atom)";
29.982 -val SOME (t',_) = rewrite_set_ thy false powers_erls t; term2str t';
29.983 -"True";
29.984 -val t = str2term "1 < 2";
29.985 -val SOME (t',_) = rewrite_set_ thy false powers_erls t; term2str t';
29.986 -"True";
29.987 -val t = str2term "(6*x)^^^2";
29.988 -val SOME (t',_) = rewrite_ thy dummy_ord powers_erls false
29.989 - (num_str realpow_def_atom) t;
29.990 -term2str t';
29.991 -trace_rewrite:=false;
29.992 -
29.993 -val t = str2term "-1 * (-2 * (5 / 2 * (13 * x / 2)))";
29.994 -val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t';
29.995 -if term2str t' = "65 * x / 2" then () else raise error "rational.sml 4";
29.996 -
29.997 -val t = str2term "1 - ((13*x)/2 - 5/2)^^^2";
29.998 -val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t';
29.999 -(*bef.040209: if term2str t' = "(-21 + (130 * x + -169 * x ^^^ 2)) / 4"then()*)
29.1000 -if term2str t' = "(-21 + 130 * x + -169 * x ^^^ 2) / 4" then ()
29.1001 -else raise error "rational.sml 5";
29.1002 -
29.1003 -(*SRAM Schalk I, p.92 Nr. 609a*)
29.1004 -val t = str2term "2*(3 - x/5)/3 - 4*(1 - x/3) - x/3 - 2*(x/2 - 1/4)/27 +5/54";
29.1005 -val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t';
29.1006 -if term2str t' = "(-255 + 112 * x) / 135" then ()
29.1007 -else raise error "rational.sml 6";
29.1008 -
29.1009 -(*SRAM Schalk I, p.92 Nr. 610c*)
29.1010 -val t = str2term "((x- 1)/(x+1) + 1) / ((x- 1)/(x+1) - (x+1)/(x- 1)) - 2";
29.1011 -val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t';
29.1012 -if term2str t' = "(-3 + -1 * x) / 2" then () else raise error "rational.sml 7";
29.1013 -
29.1014 -(*SRAM Schalk I, p.92 Nr. 476a*)
29.1015 -val t = str2term "(x^^^2/(1 - x^^^2) + 1)/(x/(1 - x) + 1) *\
29.1016 - \ (1 + x)";(*. a/b : c/d translated to a/b * d/c .*)
29.1017 -val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t';
29.1018 -(*if term2str t' = "1 / 1" then () else raise error "rational.sml 8";3.6.03*)
29.1019 -if term2str t' = "1" then () else raise error "rational.sml 8";
29.1020 -
29.1021 -(*............................vvv---TODO: sollte gehen mit poly_order *)
29.1022 -(*Schalk I, p.92 Nr. 472a*)
29.1023 -val t = str2term "((8*x^^^2 - 32*y^^^2)/(2*x + 4*y))/((4*x - 8*y)/(x + y))";
29.1024 -val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t';
29.1025 -if term2str t' = "x + y" then () else raise error "rational.sml p.92 Nr. 472a";
29.1026 -
29.1027 -(*Schalk I, p.70 Nr. 480b; a/b : c/d translated to a/b * d/c*)
29.1028 -val t = str2term "((12*x*y/(9*x^^^2 - y^^^2))/\
29.1029 - \(1/(3*x - y)^^^2 - 1/(3*x + y)^^^2)) *\
29.1030 - \(1/(x - 5*y)^^^2 - 1/(x + 5*y)^^^2)/\
29.1031 - \(20*x*y/(x^^^2 - 25*y^^^2))";
29.1032 -(*... nicht simpl, zerlegt ...*)
29.1033 -val t = str2term "((12*x*y/(9*x^^^2 - y^^^2))/\
29.1034 - \(1/(3*x - y)^^^2 - 1/(3*x + y)^^^2))";
29.1035 -val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t';
29.1036 -"(-12 * (x * y ^^^ 3) + 108 * (x * (y * x ^^^ 2))) / (12 * (x * y))";
29.1037 -(* ~~~~~~~~~~ poly_order notwendig!*)
29.1038 -val t = str2term "(1/(x - 5*y)^^^2 - 1/(x + 5*y)^^^2)/\
29.1039 - \(20*x*y/(x^^^2 - 25*y^^^2))";
29.1040 -val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t';
29.1041 -"(-500 * (x * y ^^^ 3) /\n (x ^^^ 4 + (625 * y ^^^ 4 + -50 * (x ^^^ 2 * y ^^^ 2))) +\n 20 * (x * (y * x ^^^ 2)) /\n (x ^^^ 4 + (625 * y ^^^ 4 + -50 * (x ^^^ 2 * y ^^^ 2)))) /\n(20 * (x * y))";
29.1042 -trace_rewrite:=true;
29.1043 -trace_rewrite:=false;
29.1044 -
29.1045 -"nonterm.SK6 ----- SK060904-2a non-termination of add_fraction_p_";
29.1046 -(*WN.2.6.03 from rlang.sml 56a
29.1047 -val t = str2term "(a + b * x) / (a + -1 * (b * x)) + (-1 * a + b * x) / (a + b * x) = 4 * (a * b) / (a ^^^ 2 + -1 * b ^^^ 2)";
29.1048 -val NONE = rewrite_set_ thy false common_nominator_p t;
29.1049 -
29.1050 -WN060831 nonterm.SK7
29.1051 -val t = str2term "(a + b * x) / (a + -1 * (b * x)) + (-1 * a + b * x) / (a + b * x)";
29.1052 -val NONE = add_fraction_p_ thy t;
29.1053 -*)
29.1054 -
29.1055 -
29.1056 -(* ------------------------------------------------------------------- *)
29.1057 -(*---------vvv------------ MG: ab 1.7.03 ----------------vvv-----------*)
29.1058 -(* Simplifier fuer beliebige Buchterme *)
29.1059 -(* ------------------------------------------------------------------- *)
29.1060 -(*----------------------- norm_Rational_mg ----------------------------*)
29.1061 -(* ------------------------------------------------------------------- *)
29.1062 -
29.1063 -"-------- numeral rationals --------------------------------------";
29.1064 -"-------- numeral rationals --------------------------------------";
29.1065 -"-------- numeral rationals --------------------------------------";
29.1066 -
29.1067 -(*SRA Schalk I, p.40 Nr. 164b *)
29.1068 -val t = str2term "(47/6 - 76/9 + 13/4)/(35/12)";
29.1069 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1070 -term2str t;
29.1071 -if (term2str t) = "19 / 21" then ()
29.1072 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 1";
29.1073 -
29.1074 -(*SRA Schalk I, p.40 Nr. 166a *)
29.1075 -val t = str2term "((5/4)/(4+22/7) + 37/20)*(110/3 - 110/9 * 23/11)";
29.1076 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1077 -term2str t;
29.1078 -if (term2str t) = "45 / 2" then ()
29.1079 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 2";
29.1080 -
29.1081 -
29.1082 -"-------- cancellation -------------------------------------------";
29.1083 -"-------- cancellation -------------------------------------------";
29.1084 -"-------- cancellation -------------------------------------------";
29.1085 -
29.1086 -(* e190c Stefan K.*)
29.1087 -val t = str2term
29.1088 -"((1 + 9 * a ^^^ 2)*(1 + 3 * a))/((3 * a + 9 * a ^^^ 2)*(1 + 3 * a))";
29.1089 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1090 -term2str t;
29.1091 -if (term2str t) =
29.1092 -"(1 + 9 * a ^^^ 2) / (3 * a + 9 * a ^^^ 2)"
29.1093 -then ()
29.1094 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 3";
29.1095 -
29.1096 -(* e192b Stefan K.*)
29.1097 -val t = str2term
29.1098 -"((x ^^^ 2)*(7 * x + (-1) * y))/((y ^^^ 2)*(7 * x + (-1) * y))";
29.1099 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1100 -term2str t;
29.1101 -if (term2str t) =
29.1102 -"x ^^^ 2 / y ^^^ 2"
29.1103 -then ()
29.1104 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 4";
29.1105 -
29.1106 -(*SRC Schalk I, p.66 Nr. 379c *)
29.1107 -val t = str2term
29.1108 -"(a - b)/(b - a)";
29.1109 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1110 -term2str t;
29.1111 -if (term2str t) =
29.1112 -"-1"
29.1113 -then ()
29.1114 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 5";
29.1115 -
29.1116 -(*SRC Schalk I, p.66 Nr. 380b *)
29.1117 -val t = str2term
29.1118 -"15*(3*x+3)*(4*x+9)/(12*(2*x+7)*(5*x+5))";
29.1119 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1120 -term2str t;
29.1121 -if (term2str t) =
29.1122 -"(27 + 12 * x) / (28 + 8 * x)"
29.1123 -then ()
29.1124 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 6";
29.1125 -
29.1126 -(*Schalk I, p.60 Nr. 215c *)
29.1127 -(* Falsches Ergebnis: rechnet lange und cancel_p kann nicht weiter krzen!!!*)
29.1128 -(* WN060831????MG1
29.1129 -val t = str2term "(a+b)^^^4*(x - y)/((x - y)^^^3*(a+b)^^^2)";
29.1130 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1131 -term2str t;
29.1132 -if (term2str t) =
29.1133 -"(a ^^^ 4 * x + -1 * a ^^^ 4 * y + 4 * a ^^^ 3 * b * x + -4 * a ^^^ 3 * b * y + 6 * a ^^^ 2 * b ^^^ 2 * x + -6 * a ^^^ 2 * b ^^^ 2 * y + 4 * a * b ^^^ 3 * x + -4 * a * b ^^^ 3 * y + b ^^^ 4 * x + -1 * b ^^^ 4 * y) /(a ^^^ 2 * x ^^^ 3 + -3 * a ^^^ 2 * x ^^^ 2 * y + 3 * a ^^^ 2 * x * y ^^^ 2 + -1 * a ^^^ 2 * y ^^^ 3 + 2 * a * b * x ^^^ 3 + -6 * a * b * x ^^^ 2 * y + 6 * a * b * x * y ^^^ 2 + -2 * a * b * y ^^^ 3 + b ^^^ 2 * x ^^^ 3 + -3 * b ^^^ 2 * x ^^^ 2 * y + 3 * b ^^^ 2 * x * y ^^^ 2 + -1 * b ^^^ 2 * y ^^^ 3)"
29.1134 -then ()
29.1135 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 7";
29.1136 -*)
29.1137 -(*val t = str2term
29.1138 -"(a ^^^ 4 * x + -1 * a ^^^ 4 * y + 4 * a ^^^ 3 * b * x + -4 * a ^^^ 3 * b * y + 6 * a ^^^ 2 * b ^^^ 2 * x + -6 * a ^^^ 2 * b ^^^ 2 * y + 4 * a * b ^^^ 3 * x + -4 * a * b ^^^ 3 * y + b ^^^ 4 * x + -1 * b ^^^ 4 * y) /(a ^^^ 2 * x ^^^ 3 + -3 * a ^^^ 2 * x ^^^ 2 * y + 3 * a ^^^ 2 * x * y ^^^ 2 + -1 * a ^^^ 2 * y ^^^ 3 + 2 * a * b * x ^^^ 3 + -6 * a * b * x ^^^ 2 * y + 6 * a * b * x * y ^^^ 2 + -2 * a * b * y ^^^ 3 + b ^^^ 2 * x ^^^ 3 + -3 * b ^^^ 2 * x ^^^ 2 * y + 3 * b ^^^ 2 * x * y ^^^ 2 + -1 * b ^^^ 2 * y ^^^ 3)"
29.1139 -val SOME (t,_) = rewrite_set_ thy false cancel_p t;
29.1140 -term2str t;*)
29.1141 -(* uncaught exception nonexhaustive binding failure
29.1142 - raised at: stdIn:93.1-93.51 *)
29.1143 -
29.1144 -(*Schalk I, p.66 Nr. 381a *)
29.1145 -(* ACHTUNG: rechnet ca. 2 Minuten !!! *)
29.1146 -(* WN060831???MG2
29.1147 -val t = str2term "18*(a+b)^^^3*(a - b)^^^2/(72*(a - b)^^^3*(a+b)^^^2)";
29.1148 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1149 -term2str t;
29.1150 -if (term2str t) =
29.1151 -"(a + b) / (4 * a + -4 * b)"
29.1152 -then () else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 8";
29.1153 -*)
29.1154 -
29.1155 -(*SRC Schalk I, p.66 Nr. 381b *)
29.1156 -val t = str2term
29.1157 -"(4*x^^^2 - 20*x + 25)/(2*x - 5)^^^3";
29.1158 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1159 -term2str t;
29.1160 -if (term2str t) =
29.1161 -"-1 / (5 + -2 * x)"
29.1162 -then ()
29.1163 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 9";
29.1164 -
29.1165 -(*SRC Schalk I, p.66 Nr. 381c *)
29.1166 -val t = str2term
29.1167 -"(27*a^^^3+9*a^^^2+3*a+1)/(27*a^^^3+18*a^^^2+3*a)";
29.1168 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1169 -term2str t;
29.1170 -if (term2str t) =
29.1171 -"(1 + 9 * a ^^^ 2) / (3 * a + 9 * a ^^^ 2)"
29.1172 -then ()
29.1173 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 10";
29.1174 -
29.1175 -(*SRC Schalk I, p.66 Nr. 383a *)
29.1176 -val t = str2term
29.1177 -"(5*a^^^2 - 5*a*b)/(a - b)^^^2";
29.1178 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1179 -term2str t;
29.1180 -if (term2str t) =
29.1181 -"5 * a / (a + -1 * b)"
29.1182 -then ()
29.1183 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 11";
29.1184 -
29.1185 -"-------- common denominator -------------------------------------";
29.1186 -"-------- common denominator -------------------------------------";
29.1187 -"-------- common denominator -------------------------------------";
29.1188 -
29.1189 -(*SRA Schalk I, p.67 Nr. 403a *)
29.1190 -val t = str2term
29.1191 -"4/x - 3/y - 1";
29.1192 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1193 -term2str t;
29.1194 -if (term2str t) =
29.1195 -"(-3 * x + 4 * y + -1 * x * y) / (x * y)"
29.1196 -then ()
29.1197 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 12";
29.1198 -
29.1199 -(*SRA Schalk I, p.67 Nr. 407b *)
29.1200 -val t = str2term
29.1201 -"(2*a+3*b)/(b*c) + (3*c+a)/(a*c) - (2*a^^^2+3*b*c)/(a*b*c)";
29.1202 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1203 -term2str t;
29.1204 -if (term2str t) =
29.1205 -"4 / c"
29.1206 -then ()
29.1207 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 13";
29.1208 -
29.1209 -(*SRA Schalk I, p.67 Nr. 410b *)
29.1210 -val t = str2term
29.1211 -"1/(x+1) + 1/(x+2) - 2/(x+3)";
29.1212 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1213 -term2str t;
29.1214 -if (term2str t) =
29.1215 -"(5 + 3 * x) / (6 + 11 * x + 6 * x ^^^ 2 + x ^^^ 3)"
29.1216 -then ()
29.1217 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 14";
29.1218 -
29.1219 -(*SRA Schalk I, p.67 Nr. 413b *)
29.1220 -val t = str2term
29.1221 -"(1+x)/(1 - x) - (1 - x)/(1+x) + 2*x/(1 - x^^^2)";
29.1222 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1223 -term2str t;
29.1224 -if (term2str t) =
29.1225 -"6 * x / (1 + -1 * x ^^^ 2)"
29.1226 -then ()
29.1227 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 15";
29.1228 -
29.1229 -(*SRA Schalk I, p.68 Nr. 414a *)
29.1230 -val t = str2term
29.1231 -"(x + 2)/(x - 1) + (x - 3)/(x - 2) - (x + 1)/((x - 1)*(x - 2))";
29.1232 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1233 -term2str t;
29.1234 -if (term2str t) =
29.1235 -"(-2 + -5 * x + 2 * x ^^^ 2) / (2 + -3 * x + x ^^^ 2)"
29.1236 -then ()
29.1237 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 16";
29.1238 -
29.1239 -(*SRA Schalk I, p.68 Nr. 423a *)
29.1240 -val t = str2term
29.1241 -"(2*x+3*y)/x + (4*x^^^3 - x*y^^^2 - 3*y^^^3)/(x^^^3 - 2*x^^^2*y+x*y^^^2) - (5*x+6*y)/(x - y)";
29.1242 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1243 -term2str t;
29.1244 -if (term2str t) =
29.1245 -"1"
29.1246 -then ()
29.1247 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 17";
29.1248 -
29.1249 -(*SRA Schalk I, p.68 Nr. 428b *)
29.1250 -val t = str2term
29.1251 -"1/(a - b)^^^2 + 1/(a+b)^^^2 - 2/(a^^^2 - b^^^2) - 4*(b^^^2 - 1)/(a^^^2 - b^^^2)^^^2";
29.1252 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1253 -term2str t;
29.1254 -if (term2str t) =
29.1255 -"4 / (a ^^^ 4 + -2 * a ^^^ 2 * b ^^^ 2 + b ^^^ 4)"
29.1256 -then ()
29.1257 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 18";
29.1258 -
29.1259 -(*SRA Schalk I, p.68 Nr. 430b *)
29.1260 -val t = str2term
29.1261 -"a^^^2/(a - 3*b) - 108*a*b^^^3/((a+3*b)*(a^^^2 - 9*b^^^2)) - 9*b^^^2*(a - 3*b)/(a+3*b)^^^2";
29.1262 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1263 -term2str t;
29.1264 -if (term2str t) =
29.1265 -"a + 3 * b"
29.1266 -then ()
29.1267 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 19";
29.1268 -
29.1269 -
29.1270 -(*SRA Schalk I, p.68 Nr. 432 *)
29.1271 -val t = str2term
29.1272 -"(a^^^2+a*b)/(a^^^2 - b^^^2) - (b^^^2 - a*b)/(b^^^2 - a^^^2) + a^^^2*(a - b)/(a^^^3 - a^^^2*b) - 2*a*(a^^^2 - b^^^2)/(a^^^3 - a*b^^^2) - 2*b^^^2/(a^^^2 - b^^^2)";
29.1273 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1274 -term2str t;
29.1275 -if (term2str t) =
29.1276 -"0"
29.1277 -then ()
29.1278 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 20";
29.1279 -
29.1280 -(*Eigenes*)
29.1281 -val t = str2term
29.1282 -"3*a/(a*b) + x/y";
29.1283 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1284 -term2str t;
29.1285 -if (term2str t) =
29.1286 -"(3 * y + b * x) / (b * y)"
29.1287 -then ()
29.1288 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 21";
29.1289 -
29.1290 -
29.1291 -"-------- multiply and cancel ------------------------------------";
29.1292 -"-------- multiply and cancel ------------------------------------";
29.1293 -"-------- multiply and cancel ------------------------------------";
29.1294 -
29.1295 -(*SRM Schalk I, p.68 Nr. 436a *)
29.1296 -val t = str2term
29.1297 -"3*(x+y)/(15*(x - y)) * 25*(x - y)^^^2/(18*(x+y)^^^2)";
29.1298 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1299 -term2str t;
29.1300 -if (term2str t) =
29.1301 -"(5 * x + -5 * y) / (18 * x + 18 * y)"
29.1302 -then ()
29.1303 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 22";
29.1304 -
29.1305 -(*SRM.test Schalk I, p.68 Nr. 436b *)
29.1306 -(*WN060420???MG3 crashes with method 'simplify' in
29.1307 - IsacCore > Simplification > Rational Terms > Multiplication > No.2*)
29.1308 -val t = str2term "5*a*(a - b)^^^2*(a + b)^^^3/(7*b*(a - b)^^^3) * 7*b/(a + b)^^^3";
29.1309 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1310 -term2str t;
29.1311 -if (term2str t) =
29.1312 -"5 * a / (a + -1 * b)"
29.1313 -then ()
29.1314 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 23";
29.1315 -
29.1316 -(*Schalk I, p.68 Nr. 437a *)
29.1317 -val t = str2term "(3*a - 4*b)/(4*c+3*e) * (3*a+4*b)/(9*a^^^2 - 16*b^^^2)";
29.1318 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1319 -if (term2str t) = "1 / (4 * c + 3 * e)" then ()
29.1320 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 24";
29.1321 -
29.1322 -"----- S.K. corrected non-termination 060904";
29.1323 -val t = str2term "(3*a - 4*b) * (3*a+4*b)/((4*c+3*e)*(9*a^^^2 - 16*b^^^2))";
29.1324 -val SOME (t',_) = rewrite_set_ thy false make_polynomial t;
29.1325 -if term2str t' = "(9 * a ^^^ 2 + -16 * b ^^^ 2) /\n(36 * a ^^^ 2 * c + 27 * a ^^^ 2 * e + -64 * b ^^^ 2 * c +\n -48 * b ^^^ 2 * e)" then ()
29.1326 -else raise error "rational.sml.sml: S.K.8..corrected 060904-6";
29.1327 -
29.1328 -"----- S.K. corrected non-termination of cancel_p_";
29.1329 -val t'' = str2term "(9 * a ^^^ 2 + -16 * b ^^^ 2) /\
29.1330 -\(36 * a^^^2 * c + (27 * a^^^2 * e + (-64 * b^^^2 * c + -48 * b^^^2 * e)))";
29.1331 -val SOME (t',_) = rewrite_set_ thy false cancel_p t'';
29.1332 -if term2str t' = "1 / (4 * c + 3 * e)" then ()
29.1333 -else raise error "rational.sml.sml: diff.behav. in cancel_p S.K.8";
29.1334 -
29.1335 -(**)
29.1336 -
29.1337 -(*Schalk I, p.68 Nr. 437b *)
29.1338 -(* nonterm.SK9 loops: cancel_p kann nicht weiter kuerzen!!! *)
29.1339 -val t'' = str2term "(a + b)/(x^^^2 - y^^^2) * ((x - y)^^^2/(a^^^2 - b^^^2))";
29.1340 -(* val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t'';
29.1341 - *)
29.1342 -
29.1343 -(*a casual output from above*)
29.1344 -val t = str2term
29.1345 -"(a * x ^^^ 2 + -2 * a * x * y + a * y ^^^ 2 + b * x ^^^ 2 + -2 * b * x * y + b * y ^^^ 2) /(a ^^^ 2 * x ^^^ 2 + -1 * a ^^^ 2 * y ^^^ 2 + -1 * b ^^^ 2 * x ^^^ 2 + b ^^^ 2 * y ^^^ 2)";
29.1346 -(* WN060831 nonterm.SK10
29.1347 -val SOME (t,_) = rewrite_set_ thy false cancel_p t;
29.1348 -term2str t;
29.1349 -*)
29.1350 -
29.1351 -(*SRM Schalk I, p.68 Nr. 438a *)
29.1352 -val t = str2term
29.1353 -"x*y/(x*y - y^^^2)*(x^^^2 - x*y)";
29.1354 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1355 -term2str t;
29.1356 -if (term2str t) =
29.1357 -"x ^^^ 2"
29.1358 -then ()
29.1359 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 24";
29.1360 -
29.1361 -(*SRM Schalk I, p.68 Nr. 439b *)
29.1362 -val t = str2term
29.1363 -"(4*x^^^2+4*x+1)*((x^^^2 - 2*x^^^3)/(4*x^^^2+2*x))";
29.1364 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1365 -term2str t;
29.1366 -if (term2str t) =
29.1367 -"(x + -4 * x ^^^ 3) / 2"
29.1368 -then ()
29.1369 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 25";
29.1370 -
29.1371 -(*SRM Schalk I, p.68 Nr. 440a *)
29.1372 -val t = str2term
29.1373 -"(x^^^2 - 2*x)/(x^^^2 - 3*x) * (x - 3)^^^2/(x^^^2 - 4)";
29.1374 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1375 -term2str t;
29.1376 -if (term2str t) =
29.1377 -"(-3 + x) / (2 + x)"
29.1378 -then ()
29.1379 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 26";
29.1380 -
29.1381 -"----- Schalk I, p.68 Nr. 440b SK11 works since 0707xx";
29.1382 -val t = str2term
29.1383 -"(a^^^3 - 9*a)/(a^^^3*b - a*b^^^3)*(a^^^2*b+a*b^^^2)/(a+3)";
29.1384 -val SOME (t,_) = rewrite_set_ thy false norm_Rational t;
29.1385 -if term2str t = "(-3 * a + a ^^^ 2) / (a + -1 * b)" then ()
29.1386 -else raise error "rational.sml.sml: diff.behav. in norm_Rational 27";
29.1387 -
29.1388 -"----- SK12 works since 0707xx";
29.1389 -val t = str2term "(a^^^3 - 9*a)*(a^^^2*b+a*b^^^2)/((a^^^3*b - a*b^^^3)*(a+3))";
29.1390 -val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t';
29.1391 -if term2str t' = "(-3 * a + a ^^^ 2) / (a + -1 * b)" then ()
29.1392 -else raise error "rational.sml.sml: diff.behav. in norm_Rational 28";
29.1393 -
29.1394 -
29.1395 -"-------- common denominator and multiplication ------------------";
29.1396 -"-------- common denominator and multiplication ------------------";
29.1397 -"-------- common denominator and multiplication ------------------";
29.1398 -
29.1399 -(*----------------------------------------------------------------------*)
29.1400 -(*--------- Gemeinsamer Nenner und Multiplikation von Bruechen ---------*)
29.1401 -(*----------------------------------------------------------------------*)
29.1402 -
29.1403 -
29.1404 -(*SRAM Schalk I, p.69 Nr. 441b *)
29.1405 -val t = str2term "(4*a/3 + 3*b^^^2/a^^^3 + b/(4*a))*(4*b/(3*a))";
29.1406 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1407 -term2str t;
29.1408 -if (term2str t) =
29.1409 -"(36 * b ^^^ 3 + 3 * a ^^^ 2 * b ^^^ 2 + 16 * a ^^^ 4 * b) / (9 * a ^^^ 4)"
29.1410 -then ()
29.1411 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 28";
29.1412 -
29.1413 -(*SRAM Schalk I, p.69 Nr. 442b *)
29.1414 -val t = str2term "(15*a^^^2/x^^^3 - 5*b^^^4/x^^^2 + 25*c^^^2/x)*(x^^^3/(5*a*b^^^3*c^^^3)) + 1/c^^^3 * (b*x/a - 3*a/b^^^3)";
29.1415 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1416 -term2str t;
29.1417 -if (term2str t) =
29.1418 -"5 * x ^^^ 2 / (a * b ^^^ 3 * c)"
29.1419 -then ()
29.1420 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 29";
29.1421 -
29.1422 -(*SRAM Schalk I, p.69 Nr. 443b *)
29.1423 -val t = str2term "(a/2 + b/3)*(b/3 - a/2)";
29.1424 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1425 -term2str t;
29.1426 -if (term2str t) =
29.1427 -"(-9 * a ^^^ 2 + 4 * b ^^^ 2) / 36"
29.1428 -then ()
29.1429 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 30";
29.1430 -
29.1431 -(*SRAM Schalk I, p.69 Nr. 445b *)
29.1432 -val t = str2term "(a^^^2/9 + 2*a/(3*b) + 4/b^^^2)*(a/3 - 2/b) + 8/b^^^3";
29.1433 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1434 -term2str t;
29.1435 -if (term2str t) =
29.1436 -"a ^^^ 3 / 27"
29.1437 -then ()
29.1438 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 31";
29.1439 -
29.1440 -(*SRAM Schalk I, p.69 Nr. 446b *)
29.1441 -val t = str2term "(x/(5*x + 4*y) - y/(5*x - 4*y) + 1)*(25*x^^^2 - 16*y^^^2)";
29.1442 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1443 -term2str t;
29.1444 -if (term2str t) =
29.1445 -"30 * x ^^^ 2 + -9 * x * y + -20 * y ^^^ 2"
29.1446 -then ()
29.1447 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 32";
29.1448 -
29.1449 -(*SRAM Schalk I, p.69 Nr. 449a *)(*Achtung: rechnet ca 8 Sekunden*)
29.1450 -val t = str2term
29.1451 -"(2*x^^^2/(3*y)+x/y^^^2)*(4*x^^^4/(9*y^^^2)+x^^^2/y^^^4)*(2*x^^^2/(3*y) - x/y^^^2)";
29.1452 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1453 -term2str t;
29.1454 -if (term2str t) =
29.1455 -"(-81 * x ^^^ 4 + 16 * x ^^^ 8 * y ^^^ 4) / (81 * y ^^^ 8)"
29.1456 -then ()
29.1457 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 33";
29.1458 -
29.1459 -(*SRAM Schalk I, p.69 Nr. 450a *)
29.1460 -val t = str2term
29.1461 -"(4*x/(3*y)+2*y/(3*x))^^^2 - (2*y/(3*x) - 2*x/y)*(2*y/(3*x)+2*x/y)";
29.1462 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1463 -term2str t;
29.1464 -if (term2str t) =
29.1465 -"(52 * x ^^^ 2 + 16 * y ^^^ 2) / (9 * y ^^^ 2)"
29.1466 -then ()
29.1467 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 34";
29.1468 -
29.1469 -"-------- double fractions ---------------------------------------";
29.1470 -"-------- double fractions ---------------------------------------";
29.1471 -"-------- double fractions ---------------------------------------";
29.1472 -
29.1473 -(*SRD Schalk I, p.69 Nr. 454b *)
29.1474 -val t = str2term
29.1475 -"((2 - x)/(2*a)) / (2*a/(x - 2))";
29.1476 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1477 -term2str t;
29.1478 -if (term2str t) =
29.1479 -"(-4 + 4 * x + -1 * x ^^^ 2) / (4 * a ^^^ 2)"
29.1480 -then ()
29.1481 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 35";
29.1482 -
29.1483 -(*SRD Schalk I, p.69 Nr. 455a *)
29.1484 -val t = str2term
29.1485 -"(a^^^2 + 1)/(a^^^2 - 1) / ((a+1)/(a - 1))";
29.1486 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1487 -term2str t;
29.1488 -if (term2str t) =
29.1489 -"(1 + a ^^^ 2) / (1 + 2 * a + a ^^^ 2)" then ()
29.1490 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 36";
29.1491 -
29.1492 -
29.1493 -"----- Schalk I, p.69 Nr. 455b";
29.1494 -val t = str2term "(x^^^2 - 4)/(y^^^2 - 9)/((2+x)/(3 - y))";
29.1495 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1496 -if term2str t = "(2 + -1 * x) / (3 + y)" then ()
29.1497 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 37";
29.1498 -
29.1499 -"----- SK060904-1a non-termination of cancel_p_ ?: worked before 0707xx";
29.1500 -val t = str2term "(x^^^2 - 4)*(3 - y)/((y^^^2 - 9)*(2+x))";
29.1501 -val SOME (t,_) = rewrite_set_ thy false norm_Rational t;
29.1502 -if term2str t = "(2 + -1 * x) / (3 + y)" then ()
29.1503 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 37b";
29.1504 -
29.1505 -"----- ?: worked before 0707xx";
29.1506 -val t = str2term "(3 + -1 * y) / (-9 + y ^^^ 2)";
29.1507 -val SOME (t,_) = rewrite_set_ thy false norm_Rational t;
29.1508 -if term2str t = "-1 / (3 + y)" then ()
29.1509 -else raise error "rational.sml: -1 / (3 + y) norm_Rational";
29.1510 -
29.1511 -(*SRD Schalk I, p.69 Nr. 456b *)
29.1512 -val t = str2term
29.1513 -"(b^^^3 - b^^^2)/(b^^^2+b)/(b^^^2 - 1)";
29.1514 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1515 -term2str t;
29.1516 -if (term2str t) = "b / (1 + 2 * b + b ^^^ 2)" then ()
29.1517 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 38";
29.1518 -
29.1519 -(*SRD Schalk I, p.69 Nr. 457b *)
29.1520 -val t = str2term
29.1521 -"(16*a^^^2 - 9*b^^^2)/(2*a+3*a*b) / ((4*a+3*b)/(4*a^^^2 - 9*a^^^2*b^^^2))";
29.1522 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1523 -term2str t;
29.1524 -if (term2str t) =
29.1525 -"8 * a ^^^ 2 + -6 * a * b + -12 * a ^^^ 2 * b + 9 * a * b ^^^ 2"
29.1526 -then ()
29.1527 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 39";
29.1528 -
29.1529 -"----- Schalk I, p.69 Nr. 458b works since 0707";
29.1530 -val t = str2term
29.1531 -"(2*a^^^2*x - a^^^2)/(a*x - b*x) / (b^^^2*(2*x - 1)/(x*(a - b)))";
29.1532 -val SOME (t,_) = rewrite_set_ thy false norm_Rational t;
29.1533 -if term2str t = "a ^^^ 2 / b ^^^ 2" then ()
29.1534 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 39b";
29.1535 -
29.1536 -(*SRD Schalk I, p.69 Nr. 459b *)
29.1537 -val t = str2term "(a^^^2 - b^^^2)/(a*b) / (4*(a+b)^^^2/a)";
29.1538 -val SOME (t,_) = rewrite_set_ thy false norm_Rational t;
29.1539 -if term2str t = "(a + -1 * b) / (4 * a * b + 4 * b ^^^ 2)" then ()
29.1540 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 41";
29.1541 -
29.1542 -
29.1543 -(*Schalk I, p.69 Nr. 460b nonterm.SK
29.1544 -val t = str2term
29.1545 -"(9*(x^^^2 - 8*x+16)/(4*(y^^^2 - 2*y+1)))/((3*x - 12)/(16*y - 16))";
29.1546 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1547 -if term2str t =
29.1548 -then ()
29.1549 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 42";
29.1550 -
29.1551 -val t = str2term
29.1552 -"9*(x^^^2 - 8*x+16)*(16*y - 16)/(4*(y^^^2 - 2*y+1)*(3*x - 12))";
29.1553 -val SOME (t',_) = rewrite_set_ thy false norm_Rational t;
29.1554 -... non terminating.
29.1555 -val SOME (t',_) = rewrite_set_ thy false make_polynomial t;
29.1556 -"(-2304 + 1152 * x + 2304 * y + -144 * x ^^^ 2 + -1152 * x * y + 144 * x ^^^ 2 * y) /(-48 + 12 * x + 96 * y + -24 * x * y + -48 * y ^^^ 2 + 12 * x * y ^^^ 2)";
29.1557 -val SOME (t,_) = rewrite_set_ thy false cancel_p t';
29.1558 -... non terminating.*)
29.1559 -
29.1560 -(*SRD Schalk I, p.70 Nr. 472a *)
29.1561 -val t = str2term "((8*x^^^2 - 32*y^^^2)/(2*x + 4*y))/\
29.1562 - \((4*x - 8*y)/(x + y))";
29.1563 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1564 -term2str t;
29.1565 -if (term2str t) =
29.1566 -"x + y"
29.1567 -then ()
29.1568 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 43";
29.1569 -
29.1570 -
29.1571 -(*----------------------------------------------------------------------*)
29.1572 -(*---------------------- Einfache Dppelbrche --------------------------*)
29.1573 -(*----------------------------------------------------------------------*)
29.1574 -
29.1575 -(*SRD Schalk I, p.69 Nr. 461a *)
29.1576 -val t = str2term
29.1577 -"(2/(x+3) + 2/(x - 3)) / (8*x/(x^^^2 - 9))";
29.1578 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1579 -term2str t;
29.1580 -if (term2str t) =
29.1581 -"1 / 2"
29.1582 -then ()
29.1583 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 44";
29.1584 -
29.1585 -(*SRD Schalk I, p.69 Nr. 464b *)
29.1586 -val t = str2term
29.1587 -"(a - a/(a - 2)) / (a + a/(a - 2))";
29.1588 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1589 -term2str t;
29.1590 -if (term2str t) =
29.1591 -"(3 + -1 * a) / (1 + -1 * a)"
29.1592 -then ()
29.1593 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 45";
29.1594 -
29.1595 -(*SRD Schalk I, p.69 Nr. 465b *)
29.1596 -val t = str2term
29.1597 -"((x+3*y)/9 + (4*y^^^2 - 9*z^^^2)/(16*x)) /(x/9+y/6+z/4)";
29.1598 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1599 -term2str t;
29.1600 -if (term2str t) =
29.1601 -"(4 * x + 6 * y + -9 * z) / (4 * x)"
29.1602 -then ()
29.1603 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 46";
29.1604 -
29.1605 -(*SRD Schalk I, p.69 Nr. 466b *)
29.1606 -val t = str2term
29.1607 -"((1 - 7*(x - 2)/(x^^^2 - 4)) / (6/(x+2))) / (3/(x+5)+30/(x^^^2 - 25))";
29.1608 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1609 -term2str t;
29.1610 -if (term2str t) =
29.1611 -"(25 + -10 * x + x ^^^ 2) / 18"
29.1612 -then ()
29.1613 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 47";
29.1614 -
29.1615 -(*SRD Schalk I, p.70 Nr. 469 *)
29.1616 -val t = str2term
29.1617 -"3*b^^^2/(4*a^^^2 - 8*a*b + 4*b^^^2)/(a/(a^^^2*b - b^^^3) + (a - b)/(4*a*b^^^2+4*b^^^3) - 1/(4*b^^^2))";
29.1618 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1619 -term2str t;
29.1620 -if (term2str t) =
29.1621 -"3 * b ^^^ 3 / (2 * a + -2 * b)"
29.1622 -then ()
29.1623 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 48";
29.1624 -
29.1625 -(*----------------------------------------------------------------------*)
29.1626 -(*---------------------- Mehrfache Dppelbrueche ------------------------*)
29.1627 -(*----------------------------------------------------------------------*)
29.1628 -
29.1629 -(*SRD.test Schalk I, p.70 Nr. 476b *) (* Rechenzeit: 10 sec *)
29.1630 -(*WN060419 crashes with method 'simplify' ????SK*)
29.1631 -val t = str2term
29.1632 -"((a^^^2 - b^^^2)/(2*a*b)+2*a*b/(a^^^2 - b^^^2))/((a^^^2+b^^^2)/(2*a*b)+1) / ((a^^^2+b^^^2)^^^2/(a+b)^^^2)";
29.1633 -val SOME (t,_) = rewrite_set_ thy false norm_Rational t;
29.1634 -if term2str t = "1 / (a ^^^ 2 + -1 * b ^^^ 2)" then ()
29.1635 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 49";
29.1636 -
29.1637 -"----- Schalk I, p.70 Nr. 477a";
29.1638 -(* MG Achtung: terme explodieren; Bsp zu komplex;
29.1639 - L???ung sollte (ziemlich grosser) Faktorisierter Ausdruck sein
29.1640 -val t = str2term "b*y/(b - 2*y)/((b^^^2 - y^^^2)/(b+2*y)) /\
29.1641 - \(b^^^2*y+b*y^^^2)*(a+x)^^^2/((b^^^2 - 4*y^^^2)*(a+2*x)^^^2)";
29.1642 -val SOME (t',_) = rewrite_set_ thy false norm_Rational t;
29.1643 -
29.1644 -
29.1645 -val t = str2term "b*y*(b+2*y)*(b^^^2 - 4*y^^^2)*(a+2*x)^^^2 / \
29.1646 - \((b - 2*y)*(b^^^2 - y^^^2)*(b^^^2*y+b*y^^^2)*(a+x)^^^2)";
29.1647 -val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
29.1648 -????SK ???MG*)
29.1649 -
29.1650 -
29.1651 -"----- Schalk I, p.70 Nr. 478b ----- Rechenzeit: 5 sec";
29.1652 -val t = str2term "(a - (a*b+b^^^2)/(a+b))/(b+(a - b)/(1+(a+b)/(a - b))) / \
29.1653 - \((a - a^^^2/(a+b))/(a+(a*b)/(a - b)))";
29.1654 -val SOME (t',_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1655 -if term2str t' =
29.1656 -"(2 * a ^^^ 3 + 2 * a ^^^ 2 * b) / (a ^^^ 2 * b + b ^^^ 3)"
29.1657 -then ()
29.1658 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 51";
29.1659 -
29.1660 -(* TODO.new_c:WN050820 STOP_REW_SUB introduced gave ...
29.1661 -if term2str t' = "(a ^^^ 4 + -1 * a ^^^ 2 * b ^^^ 2) /\n(a * b * (b + (a * (a + -1 * b) + -1 * b * (a + -1 * b)) / (2 * a)) *\n (a + -1 * b))" then ()
29.1662 -else raise error "rational.sml: works again";
29.1663 -re-outcommented with TODO.new_c: cvs before 071227, 11:50*)
29.1664 -
29.1665 -
29.1666 -
29.1667 -(*Schalk I, p.70 Nr. 480a *)
29.1668 -(* Achtung: rechnet ewig; cancel_p kann nicht krzen: WN060831 nonterm.SK00
29.1669 -val t = str2term
29.1670 -"(1/x+1/y+1/z)/(1/x - 1/y - 1/z) / (2*x^^^2/(x^^^2 - z^^^2)/(x/(x+z)+x/(x - z)))";
29.1671 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1672 -term2str t;
29.1673 -if (term2str t) =
29.1674 -
29.1675 -then ()
29.1676 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 52";
29.1677 -
29.1678 -(*MG Berechne Zwischenergebnisse: WN060831 nonterm.SK00*)
29.1679 -val t = str2term
29.1680 -"(1/x+1/y+1/z)/(1/x - 1/y - 1/z)";
29.1681 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1682 -term2str t;
29.1683 -"(x ^^^ 2 * y ^^^ 2 * z + x ^^^ 2 * y * z ^^^ 2 + x * y ^^^ 2 * z ^^^ 2) /
29.1684 -(-1 * x ^^^ 2 * y ^^^ 2 * z + -1 * x ^^^ 2 * y * z ^^^ 2 + x * y ^^^ 2 * z ^^^ 2)";
29.1685 -val t = str2term
29.1686 -"2*x^^^2/(x^^^2 - z^^^2)/(x/(x+z)+x/(x - z))";
29.1687 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1688 -term2str t;
29.1689 -"1"
29.1690 -
29.1691 -(* SK 1. Ausdruck kann nicht weiter gekrzt werden; cancel_p !!!*)
29.1692 -### rls: cancel_p on:
29.1693 -(x ^^^ 2 * (y ^^^ 2 * z) + x ^^^ 2 * (y * z ^^^ 2) + x * (y ^^^ 2 * z ^^^ 2)) /
29.1694 -(-1 * (x ^^^ 2 * (y ^^^ 2 * z)) + -1 * (x ^^^ 2 * (y * z ^^^ 2)) + x * (y ^^^ 2 * z ^^^ 2))
29.1695 -GC #3.61.81.101.197.17503: (0 ms)
29.1696 -*** RATIONALS_DIRECT_CANCEL_EXCEPTION: Invalid fraction
29.1697 -
29.1698 -val t = str2term
29.1699 -"(x^^^2 * (y^^^2 * z) + x^^^2 * (y * z^^^2) + x * (y^^^2 * z^^^2)) / (-1 * (x^^^2 * (y^^^2 * z)) + -1 * (x^^^2 * (y * z^^^2)) + x * (y^^^2 * z^^^2))";
29.1700 -val SOME (t,_) = rewrite_set_ thy false cancel_p t;
29.1701 -term2str t;
29.1702 -(*uncaught exception nonexhaustive binding failure*)
29.1703 -
29.1704 -(* Das kann er aber krzen !!????: *)
29.1705 -val t = str2term
29.1706 -"(x^^^2 * (y^^^2 * z) + x * (y^^^2 * z^^^2)) / (-1 * (x^^^2 * (y * z^^^2)) + x * (y^^^2 * z^^^2))";
29.1707 -val SOME (t,_) = rewrite_set_ thy false cancel_p t;
29.1708 -term2str t;
29.1709 -"(-1 * (y * x) + -1 * (z * y)) / (1 * (z * x) + -1 * (z * y))";
29.1710 -*)
29.1711 -
29.1712 -
29.1713 -
29.1714 -
29.1715 -
29.1716 -
29.1717 -(*--------------------------------------------------------------------*)
29.1718 -(*----------------------- Problem-Beispiele --------------------------*)
29.1719 -(*--------------------------------------------------------------------*)
29.1720 -
29.1721 -(*Schalk I, p.60 Nr. 215d *)
29.1722 -(* Achtung: rechnet ewig ...
29.1723 -val t = str2term "(a-b)^^^3 * (x+y)^^^4 / ((x+y)^^^2 * (a-b)^^^5)";
29.1724 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1725 -term2str t; noterm.SK
29.1726 -*)
29.1727 -
29.1728 -(* Kein Wunder, denn Z???ler und Nenner extra als Polynom dargestellt ergibt:*)
29.1729 -(*
29.1730 -val t = str2term "(a-b)^^^3 * (x+y)^^^4";
29.1731 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1732 -term2str t;
29.1733 -"a^^^3 * x^^^4 + 4 * a^^^3 * x^^^3 * y +\n6 * a^^^3 * x^^^2 * y^^^2 +\n4 * a^^^3 * x * y^^^3 +\na^^^3 * y^^^4 +\n-3 * a^^^2 * b * x^^^4 +\n-12 * a^^^2 * b * x^^^3 * y +\n-18 * a^^^2 * b * x^^^2 * y^^^2 +\n-12 * a^^^2 * b * x * y^^^3 +\n-3 * a^^^2 * b * y^^^4 +\n3 * a * b^^^2 * x^^^4 +\n12 * a * b^^^2 * x^^^3 * y +\n18 * a * b^^^2 * x^^^2 * y^^^2 +\n12 * a * b^^^2 * x * y^^^3 +\n3 * a * b^^^2 * y^^^4 +\n-1 * b^^^3 * x^^^4 +\n-4 * b^^^3 * x^^^3 * y +\n-6 * b^^^3 * x^^^2 * y^^^2 +\n-4 * b^^^3 * x * y^^^3 +\n-1 * b^^^3 * y^^^4";
29.1734 -val t = str2term "((x+y)^^^2 * (a-b)^^^5)";
29.1735 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1736 -term2str t;
29.1737 -"a^^^5 * x^^^2 + 2 * a^^^5 * x * y + a^^^5 * y^^^2 +\n-5 * a^^^4 * b * x^^^2 +\n-10 * a^^^4 * b * x * y +\n-5 * a^^^4 * b * y^^^2 +\n10 * a^^^3 * b^^^2 * x^^^2 +\n20 * a^^^3 * b^^^2 * x * y +\n10 * a^^^3 * b^^^2 * y^^^2 +\n-10 * a^^^2 * b^^^3 * x^^^2 +\n-20 * a^^^2 * b^^^3 * x * y +\n-10 * a^^^2 * b^^^3 * y^^^2 +\n5 * a * b^^^4 * x^^^2 +\n10 * a * b^^^4 * x * y +\n5 * a * b^^^4 * y^^^2 +\n-1 * b^^^5 * x^^^2 +\n-2 * b^^^5 * x * y +\n-1 * b^^^5 * y^^^2";
29.1738 -*)
29.1739 -(*anscheinend macht dem Rechner das Krzen diese Bruches keinen Spass mehr ...*)
29.1740 -
29.1741 -(*--------------------------------------------------------------------*)
29.1742 -(*Schalk I, p.70 Nr. 480b
29.1743 -val t = str2term "((12*x*y/(9*x^^^2 - y^^^2))/\
29.1744 - \(1/(3*x - y)^^^2 - 1/(3*x + y)^^^2)) *\
29.1745 - \(1/(x - 5*y)^^^2 - 1/(x + 5*y)^^^2)/\
29.1746 - \(20*x*y/(x^^^2 - 25*y^^^2))";
29.1747 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1748 -SK.nonterm
29.1749 -Kann nicht weiter vereinfacht werden !!!!?? *)
29.1750 -
29.1751 -(*--------------------------------------------------------------------*)
29.1752 -"---- MGs test set";
29.1753 -val t = str2term " (1 + x^^^5) / (y + x) + x^^^3 / x ";
29.1754 -val SOME (t,_) = rewrite_set_ thy false common_nominator_p t;
29.1755 -if term2str t = "(1 + x ^^^ 3 + x ^^^ 5 + y * x ^^^ 2) / (x + y)" then()
29.1756 -else raise error "";
29.1757 -
29.1758 -(*--------------------------------------------------------------------*)
29.1759 -(* cancel_p liefert nicht immer Polynomnormalform (2): WN060831???SK3b
29.1760 - ---> Sortierung FALSCH !! *)
29.1761 -val t = str2term "b^^^3 * a^^^5/a ";
29.1762 -val SOME (t,_) = rewrite_set_ thy false cancel_p t;
29.1763 -term2str t;
29.1764 -"1 * (a^^^4 * b^^^3) / 1"; (*OK*)
29.1765 -
29.1766 -val t = str2term "b^^^3 * a^^^5/b ";
29.1767 -val SOME (t,_) = rewrite_set_ thy false cancel_p t;
29.1768 -term2str t;
29.1769 -"1 * (b^^^2 * a^^^5) / 1"; (*cancel_p sortiert hier falsch um!*)
29.1770 -
29.1771 -(* Problem liegt NICHT bei ord_make_polynomial! (siehe folgende Bsple) *)
29.1772 -(*
29.1773 -val x = str2term "x"; val bdv = str2term "bdv";
29.1774 -val t1 = str2term "b^^^2 * a^^^5";
29.1775 -val t2 = str2term "a^^^5 * b^^^2 ";
29.1776 -ord_make_polynomial false Rational.thy [(x,bdv)] (t1,t2); (*false*)
29.1777 -*)
29.1778 -(* ==> "b^^^2 * a^^^5" > "a^^^5 * b^^^2 " ... OK!*)
29.1779 -
29.1780 -(*--------------------------------------------------------------------*)
29.1781 -(* cancel_p liefert nicht immer Polynomnormalform (2): WN060831???SK3c
29.1782 - ---> erzeugt berflssige "1 * ..."
29.1783 -
29.1784 -val t = str2term "-1 / (3 + y)";
29.1785 -(*~~ *)
29.1786 -val SOME (t,_) = rewrite_set_ thy false cancel_p t;
29.1787 -term2str t;
29.1788 -"-1 / (3 + 1 * y)";
29.1789 -(********* Das ist das PROBLEM !!!!!!!??? *******************)
29.1790 -(* -1 im Z???ler der Angabe verursacht das Problem !*)
29.1791 -*)
29.1792 -
29.1793 -(* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *)
29.1794 -"----- MGs test set";
29.1795 -val t = str2term "(a^^^2 + -1)/(a+1)";
29.1796 -val SOME (t',_) = rewrite_set_ thy false cancel_p t;
29.1797 -if term2str t' = "(-1 + a) / 1" then ()
29.1798 -else raise error "rational.sml MG tests 3d";
29.1799 -
29.1800 -"----- NOT TERMINATING ?: worked before 0707xx";
29.1801 -val t = str2term "(a^^^2 - 1)*(b + 1) / ((b^^^2 - 1)*(a+1))";
29.1802 -val SOME (t'',_) = rewrite_set_ thy false norm_Rational t;
29.1803 -if term2str t'' = "(1 + -1 * a) / (1 + -1 * b)" then ()
29.1804 -else raise error "rational.sml MG tests 3e";
29.1805 -
29.1806 -"----- corrected SK060905";
29.1807 -val t = str2term "(4*x^^^2 - 20*x + 25)/(2*x - 5)^^^3";
29.1808 -val SOME (t',_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1809 -if term2str t' = "-1 / (5 + -2 * x)" then ()
29.1810 -else raise error "rational.sml corrected SK060905";
29.1811 -
29.1812 -
29.1813 -"--------------------------------------------------------------------";
29.1814 -"----------------------- Muster-Beispiele fuer DA -------------------";
29.1815 -"--------------------------------------------------------------------";
29.1816 -
29.1817 -(*SRAM Schalk I, p.69 Nr. 442b --- abgewandelt*)
29.1818 -val t = str2term
29.1819 -"(15*a^^^4/(a*x^^^3) - 5*a*((b^^^4 - 5*c^^^2*x)/x^^^2))*(x^^^3/(5*a*b^^^3*c^^^3)) + a/c^^^3 * (x*(b/a) - 3*b*(a/b^^^4))";
29.1820 -val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
29.1821 -term2str t;
29.1822 -if (term2str t) =
29.1823 -"5 * x ^^^ 2 / (b ^^^ 3 * c)"
29.1824 -then ()
29.1825 -else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 53";
29.1826 -
29.1827 -"-------- me Schalk I No.186 -------------------------------------";
29.1828 -"-------- me Schalk I No.186 -------------------------------------";
29.1829 -"-------- me Schalk I No.186 -------------------------------------";
29.1830 -val fmz = ["term ((14 * x * y) / ( x * y ))",
29.1831 - "normalform N"];
29.1832 -val (dI',pI',mI') =
29.1833 - ("Rational.thy",["rational","simplification"],
29.1834 - ["simplification","of_rationals"]);
29.1835 -val p = e_pos'; val c = [];
29.1836 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
29.1837 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
29.1838 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
29.1839 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
29.1840 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
29.1841 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
29.1842 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
29.1843 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
29.1844 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
29.1845 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
29.1846 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;(*++ for explicit script*)
29.1847 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;(*++ for explicit script*)
29.1848 -case (f2str f, nxt) of
29.1849 - ("14", ("End_Proof'", _)) => ()
29.1850 - | _ => raise error "rational.sml diff.behav. in me Schalk I No.186";
29.1851 -
29.1852 -
29.1853 -"-------- interSteps ..Simp_Rat_Double_No-1.xml ------------------";
29.1854 -"-------- interSteps ..Simp_Rat_Double_No-1.xml ------------------";
29.1855 -"-------- interSteps ..Simp_Rat_Double_No-1.xml ------------------";
29.1856 -states:=[];
29.1857 -CalcTree
29.1858 -[(["term (((2 - x)/(2*a)) / (2*a/(x - 2)))", "normalform N"],
29.1859 - ("Rational.thy",["rational","simplification"],
29.1860 - ["simplification","of_rationals"]))];
29.1861 -Iterator 1;
29.1862 -moveActiveRoot 1;
29.1863 -autoCalculate 1 CompleteCalc;
29.1864 -val ((pt,p),_) = get_calc 1; show_pt pt;
29.1865 -
29.1866 -interSteps 1 ([1],Res);
29.1867 -val ((pt,p),_) = get_calc 1; show_pt pt;
29.1868 -
29.1869 -
29.1870 -"-------- interSteps ..Simp_Rat_Cancel_No-1.xml ------------------";
29.1871 -"-------- interSteps ..Simp_Rat_Cancel_No-1.xml ------------------";
29.1872 -"-------- interSteps ..Simp_Rat_Cancel_No-1.xml ------------------";
29.1873 -states:=[];
29.1874 -CalcTree
29.1875 -[(["term ((a^2 + -1*b^2) / (a^2 + -2*a*b + b^2))", "normalform N"],
29.1876 - ("Rational.thy",["rational","simplification"],
29.1877 - ["simplification","of_rationals"]))];
29.1878 -Iterator 1;
29.1879 -moveActiveRoot 1;
29.1880 -autoCalculate 1 CompleteCalc;
29.1881 -val ((pt,p),_) = get_calc 1; show_pt pt;
29.1882 -(*with explicit script done already... and removed [1,..] at below...
29.1883 -interSteps 1 ([1],Res);
29.1884 -val ((pt,p),_) = get_calc 1; show_pt pt;
29.1885 -*)
29.1886 -interSteps 1 ([2],Res);
29.1887 -val ((pt,p),_) = get_calc 1; show_pt pt;
29.1888 -
29.1889 -interSteps 1 ([2,1],Res);
29.1890 -val ((pt,p),_) = get_calc 1; show_pt pt;
29.1891 -val newnds = children (get_nd pt [2,1]) (*see "fun detailrls"*);
29.1892 -(*if length newnds = 12 then () WN060905*)
29.1893 -if length newnds = 13 then ()
29.1894 -else raise error "rational.sml: interSteps cancel_p rev_rew_p";
29.1895 -
29.1896 -val p = ([2,1,9],Res);
29.1897 -getTactic 1 p;
29.1898 -val (_, tac, _) = pt_extract (pt, p);
29.1899 -(*case tac of SOME (Rewrite ("sym_real_plus_binom_times1", _)) => ()
29.1900 -WN060905*)
29.1901 -case tac of SOME (Rewrite ("sym_real_add_mult_distrib2", _)) => ()
29.1902 -| _ => raise error "rational.sml: getTactic, sym_real_plus_binom_times1";
29.1903 -
29.1904 -
29.1905 -"-------- investigate rulesets for cancel_p ----------------------";
29.1906 -"-------- investigate rulesets for cancel_p ----------------------";
29.1907 -"-------- investigate rulesets for cancel_p ----------------------";
29.1908 -val thy = Rational.thy;
29.1909 -"---------------- (a^^^2 + -1*b^^^2) / (a^^^2 + -2*a*b + b^^^2)";
29.1910 -val t = str2term "(a^^^2 + -1*b^^^2) / (a^^^2 + -2*a*b + b^^^2)";
29.1911 -val tt = str2term "(1 * a + 1 * b) * (1 * a + -1 * b)"(*numerator only*);
29.1912 -"----- with rewrite_set_";
29.1913 -val SOME (tt',asm) = rewrite_set_ thy false make_polynomial tt;
29.1914 -term2str tt'= "a ^^^ 2 + -1 * b ^^^ 2" (*true*);
29.1915 -val tt = str2term "((1 * a + -1 * b) * (1 * a + -1 * b))"(*denominator only*);
29.1916 -val SOME (tt',asm) = rewrite_set_ thy false make_polynomial tt;
29.1917 -term2str tt' = "a ^^^ 2 + -2 * a * b + b ^^^ 2" (*true*);
29.1918 -
29.1919 -"----- with make_deriv";
29.1920 -val SOME (tt, _) = factout_p_ Isac.thy t; term2str tt =
29.1921 -"(1 * a + 1 * b) * (1 * a + -1 * b) / ((1 * a + -1 * b) * (1 * a + -1 * b))";
29.1922 -(*
29.1923 -"--- with ruleset as before 060829";
29.1924 -val {rules, rew_ord=(_,ro),...} =
29.1925 - rep_rls (assoc_rls "make_polynomial");
29.1926 -val der = make_deriv thy Atools_erls rules ro NONE tt;
29.1927 -print_depth 99; map (term2str o #1) der; print_depth 3;
29.1928 -print_depth 99; map (rule2str o #2) der; print_depth 3;
29.1929 -... did not terminate"*)
29.1930 -"--- with simpler ruleset";
29.1931 -val {rules, rew_ord=(_,ro),...} =
29.1932 - rep_rls (assoc_rls "rev_rew_p");
29.1933 -val der = make_deriv thy Atools_erls rules ro NONE tt;
29.1934 -print_depth 99; writeln (deriv2str der); print_depth 3;
29.1935 -
29.1936 -print_depth 99; map (term2str o #1) der; print_depth 3;
29.1937 -"...,(-1 * b ^^^ 2 + a ^^^ 2) / (-2 * (a * b) + a ^^^ 2 + (-1 * b) ^^^ 2) ]";
29.1938 -print_depth 99; map (rule2str o #2) der; print_depth 3;
29.1939 -print_depth 99; map (term2str o #1 o #3) der; print_depth 3;
29.1940 -
29.1941 -val der = make_deriv thy Atools_erls rules ro NONE
29.1942 - (str2term "(1 * a + 1 * b) * (1 * a + -1 * b)");
29.1943 -print_depth 99; writeln (deriv2str der); print_depth 3;
29.1944 -
29.1945 -val {rules, rew_ord=(_,ro),...} =
29.1946 - rep_rls (assoc_rls "rev_rew_p");
29.1947 -val der = make_deriv thy Atools_erls rules ro NONE
29.1948 - (str2term "(1 * a + -1 * b) * (1 * a + -1 * b)");
29.1949 -print_depth 99; writeln (deriv2str der); print_depth 3;
29.1950 -print_depth 99; map (term2str o #1) der; print_depth 3;
29.1951 -(*WN060829 ...postponed*)
29.1952 -
29.1953 -
29.1954 -"-------- investigate format of factout_ and factout_p_ ----------";
29.1955 -"-------- investigate format of factout_ and factout_p_ ----------";
29.1956 -"-------- investigate format of factout_ and factout_p_ ----------";
29.1957 -val {rules, rew_ord = (_,ro),...} = rep_rls (assoc_rls "make_polynomial");
29.1958 -val (thy, eval_rls) = (Rational.thy, Atools_erls)(*see 'fun init_state'*);
29.1959 -val Rrls {scr = Rfuns {init_state,...},...} = assoc_rls "cancel_p";
29.1960 -
29.1961 -"----- see Rational.ML, local cancel_p, fun init_state";
29.1962 -val t = str2term "(a^^^2 + (-1)*b^^^2) / (a^^^2 + (-2)*a*b + b^^^2)";
29.1963 -val SOME (t',_) = factout_p_ thy t; term2str t';
29.1964 -(*
29.1965 -val rtas = reverse_deriv thy eval_rls rules ro NONE t';
29.1966 -writeln(trtas2str rst);
29.1967 -*)
29.1968 -
29.1969 -
29.1970 -"----- see Rational.ML, local cancel_p, fun init_state";
29.1971 -val t = str2term "a^^^2 / a";
29.1972 -val SOME (t',_) = factout_p_ thy t;
29.1973 -term2str t' = "a * a / (1 * a)" (*true*);
29.1974 -(*... can be canceled with
29.1975 -real_mult_div_cancel2 ?k ~= 0 ==> ?m * ?k / (?n * ?k) = ?m / ?n"*)
29.1976 -(* sml/ME/rewtools.sml:
29.1977 -val rtas = reverse_deriv thy Atools_erls rules ro NONE t';
29.1978 -writeln (deri2str rtas);
29.1979 -*)
29.1980 -
29.1981 -
29.1982 -
29.1983 -"-------- SK 060904 ----------------------------------------------";
29.1984 -"-------- SK 060904 ----------------------------------------------";
29.1985 -"-------- SK 060904 ----------------------------------------------";
29.1986 -"----- order on polynomials -- input + output";
29.1987 -val thy = Isac.thy;
29.1988 -val t = str2term "(a + -1 * b) / (-1 * a + b)";
29.1989 -val SOME (t', _) = factout_p_ thy t; term2str t';
29.1990 -val SOME (t', _) = cancel_p_ thy t; term2str t';
29.1991 -
29.1992 -val t = str2term "a*b*c*d / (d*e*f*g)";
29.1993 -val SOME (t', _) = cancel_p_ thy t; term2str t';
29.1994 -
29.1995 -val t = str2term "a*(b*(c*d)) / (b*(e*(f*g)))";
29.1996 -val SOME (t', _) = cancel_p_ thy t; term2str t';
29.1997 -(*???order.SK ???*)
29.1998 -
29.1999 -"----- SK060904-1a non-termination of cancel_p_ ? worked before 0707xx";
29.2000 -val t = str2term "(x^^^2 - 4)*(3 - y) / ((y^^^2 - 9)*(2+x))";
29.2001 -val SOME (t',_) = rewrite_set_ thy false norm_Rational t;
29.2002 -if term2str t' = "(2 + -1 * x) / (3 + y)" then ()
29.2003 -else raise error "rational.sml SK060904-1a worked since 0707xx";
29.2004 -
29.2005 -"----- SK060904-1b non-termination of cancel_p_ ... worked before 0707xx";
29.2006 -val t = str2term "(9 * a ^^^ 2 + -16 * b ^^^ 2) /\
29.2007 -\(36 * a^^^2 * c + (27 * a^^^2 * e + (-64 * b^^^2 * c + -48 * b^^^2 * e)))";
29.2008 -val SOME (t',_) = cancel_p_ thy t;
29.2009 -if term2str t' = "1 / (4 * c + 3 * e)" then ()
29.2010 -else raise error "rational.sml SK060904-1b";
29.2011 -
29.2012 -
29.2013 -"----- SK060904-2a non-termination of add_fraction_p_";
29.2014 -val t = str2term " (a + b * x) / (a + -1 * (b * x)) + \
29.2015 - \ (-1 * a + b * x) / (a + b * x) ";
29.2016 -(* nonterm.SK
29.2017 -val SOME (t',_) = rewrite_set_ thy false common_nominator_p t;
29.2018 -
29.2019 -common_nominator_p_ thy t;
29.2020 -" (a + b * x)*(a + b * x) / ((a + -1 * (b * x))*(a + -1 * (b * x))) + \
29.2021 -\ (-1 * a + b * x)*(a + -1 * (b * x)) / ((a + b * x)*(-1 * a + b * x)) ";
29.2022 -
29.2023 -add_fraction_p_ thy t;
29.2024 -" ((a + b * x)*(a + b * x) + (-1 * a + b * x)*(a + -1 * (b * x))) /\
29.2025 -\ ((a + b * x)*(-1 * a + b * x)) ";
29.2026 -*)
29.2027 \ No newline at end of file
30.1 --- a/test/Tools/isac/IsacKnowledge/rlang.sml Mon Aug 30 14:29:49 2010 +0200
30.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
30.3 @@ -1,1883 +0,0 @@
30.4 -(* use"../smltest/IsacKnowledge/rlang.sml";
30.5 - use"rlang.sml";
30.6 - *)
30.7 -
30.8 -(******************************************************************
30.9 -WN.060104 transfer marked (*E..*)examples to the exp-collection
30.10 - # exp_IsacCore_Equ_Uni_Poly.xml from rlang.sml (*EP*) exp
30.11 - # exp_IsacCore_Equ_Uni_Rat.xml from rlang.sml (*ER*) exp
30.12 - # exp_IsacCore_Equ_Uni_Root.xml from rlang.sml (*EO*) exp
30.13 -*******************************************************************)
30.14 -
30.15 -
30.16 -
30.17 -(*WN.12.6.03: for TODOs search 'writeln', for simplification search MG*)
30.18 -(* use"kbtest/rlang.sml";
30.19 - use"rlang.sml";
30.20 - (c) Richard Lang 2003
30.21 - tests over all equations implemented in his diploma thesis
30.22 - Elementare Gleichungen der Mittelschulmathematik in der ISAC Wissensbasis,
30.23 - Master's thesis, University of Technology, Graz, Austria, March 2003.
30.24 - created: 030228
30.25 - by: rlang
30.26 - last change: 030603
30.27 -*)
30.28 -(*@Book{bSchalk1,
30.29 - author = {Schalk, Heinz-Christian and Binder, Christian and Fertl, Walter and
30.30 - Firneis, Friedrich and Gems, Werner and Lehner, Dieter and
30.31 - Plihal, Andreas and Würl,Manfred},
30.32 - title = {Mathematik für höhere technische Lehranstalten Band I},
30.33 - publisher = {Reniets Verlag},
30.34 - year = {1986},
30.35 - note = {Schulbuch-Nr. 942},
30.36 -}
30.37 -
30.38 -@Book{bSchalk2,
30.39 - author = {Schalk, Heinz-Christian and Baumgartner, Gerhard and Binder, Christian and
30.40 - Eder, Hans Gerhard and Fertl, Walter and Firneis, Friedrich and
30.41 - Konstantiniuk, Peter and Plihal, Andreas and Rümmele, Goswin and
30.42 - Steinwender, Andreas and Zangerl, Nikolaus},
30.43 - title = {Mathematik für höhere technische Lehranstalten Band II},
30.44 - publisher = {Reniets Verlag},
30.45 - year = {1987},
30.46 - note = {Schulbuch-Nr. 1682},
30.47 -}
30.48 -*)
30.49 -
30.50 -(* Compiler.Control.Print.printDepth:=5; (*4 default*)
30.51 -trace_rewrite:=true;
30.52 - trace_rewrite:=false;
30.53 - refine fmz ["univariate","equation"];
30.54 -*)
30.55 -"---- rlang.sml begin-----------------------------------";
30.56 -(*----------------- Schalk I s.86 Bsp 5 ------------------------*)
30.57 -"Schalk I s.86 Bsp 5 (3*x - 1 - (5*x - (2 - 4*x)) = -11)";
30.58 -"Schalk I s.86 Bsp 5 (3*x - 1 - (5*x - (2 - 4*x)) = -11)";
30.59 -"Schalk I s.86 Bsp 5 (3*x - 1 - (5*x - (2 - 4*x)) = -11)";
30.60 -(*EP*)
30.61 -val fmz = ["equality (3*x - 1 - (5*x - (2 - 4*x)) = -11)",
30.62 - "solveFor x","solutions L"];
30.63 -val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
30.64 -(*val p = e_pos';
30.65 -val c = [];
30.66 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
30.67 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
30.68 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.69 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.70 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.71 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.72 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.73 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.74 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.75 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.76 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.77 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.78 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.79 -
30.80 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.81 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.82 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.83 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.84 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 2]")) => ()
30.85 - | _ => raise error "rlang.sml: diff.behav. in Schalk I s.86 Bsp 5 [x = 2]";
30.86 -
30.87 -(*----------------- Schalk I s.86 Bsp 19 ------------------------*)
30.88 -"Schalk I s.86 Bsp 19 (x - 5)*(10 - x) = (3 - x)*(2 + x) + 2*(x + 20)";
30.89 -"Schalk I s.86 Bsp 19 (x - 5)*(10 - x) = (3 - x)*(2 + x) + 2*(x + 20)";
30.90 -"Schalk I s.86 Bsp 19 (x - 5)*(10 - x) = (3 - x)*(2 + x) + 2*(x + 20)";
30.91 -(*EP*)
30.92 -val fmz = ["equality ((x - 5)*(10 - x) = (3 - x)*(2 + x) + 2*(x + 20))",
30.93 - "solveFor x","solutions L"];
30.94 -val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
30.95 -(*val p = e_pos';
30.96 -val c = [];
30.97 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
30.98 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
30.99 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.100 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.101 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.102 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.103 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.104 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.105 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.106 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.107 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.108 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.109 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.110 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.111 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.112 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.113 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.114 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 8]")) => ()
30.115 - | _ => raise error "rlang.sml: diff.behav. in Schalk I s.86 Bsp 19 [x = 8]";
30.116 -
30.117 -(*----------------- Schalk I s.86 Bsp 23 ------------------------*)
30.118 -"Schalk I s.86 Bsp 19 ((2*x+5)^^^2+(3*x+4)^^^2=(13*x+2)*(x+1)+2*(15+14*x))";
30.119 -"Schalk I s.86 Bsp 19 ((2*x+5)^^^2+(3*x+4)^^^2=(13*x+2)*(x+1)+2*(15+14*x))";
30.120 -"Schalk I s.86 Bsp 19 ((2*x+5)^^^2+(3*x+4)^^^2=(13*x+2)*(x+1)+2*(15+14*x))";
30.121 -(*EP*)
30.122 -val fmz = ["equality ((2*x+5)^^^2+(3*x+4)^^^2=(13*x+2)*(x+1)+2*(15+14*x))",
30.123 - "solveFor x","solutions L"];
30.124 -val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
30.125 -(*val p = e_pos';
30.126 -val c = [];
30.127 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
30.128 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
30.129 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.130 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.131 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.132 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.133 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.134 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.135 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.136 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.137 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.138 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.139 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.140 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.141 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.142 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.143 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.144 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = -9]")) => ()
30.145 - | _ => raise error "rlang.sml: diff.behav. in Schalk I s.86 Bsp 23 [x = -9]";
30.146 -
30.147 -(*----------------- Schalk I s.86 Bsp 25 ------------------------*)
30.148 -"Schalk I s.86 Bsp 25 ((2*x+1)^^^3+(x+1)^^^3=(2*x+1)^^^2*2*x+(x+2)^^^3+x^^^2)";
30.149 -"Schalk I s.86 Bsp 25 ((2*x+1)^^^3+(x+1)^^^3=(2*x+1)^^^2*2*x+(x+2)^^^3+x^^^2)";
30.150 -"Schalk I s.86 Bsp 25 ((2*x+1)^^^3+(x+1)^^^3=(2*x+1)^^^2*2*x+(x+2)^^^3+x^^^2)";
30.151 -(*EP*)
30.152 -val fmz = ["equality ((2*x+1)^^^3+(x+1)^^^3=(2*x+1)^^^2*2*x+(x+2)^^^3+x^^^2)",
30.153 - "solveFor x","solutions L"];
30.154 -val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
30.155 -(*val p = e_pos';
30.156 -val c = [];
30.157 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
30.158 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
30.159 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.160 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.161 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.162 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.163 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.164 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.165 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.166 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.167 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.168 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.169 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.170 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.171 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.172 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.173 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.174 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = -6 / 5]")) => ()
30.175 - | _ => raise error "rlang.sml: diff.behav. in Schalk I s.86 Bsp 25 [x = -6 / 5]";
30.176 -
30.177 -(*----------------- Schalk I s.86 Bsp 28b ------------------------*)
30.178 -"Schalk I s.86 Bsp 28b ((3*x+5)/18 - x/2 = -((3*x - 2)/9))";
30.179 -"Schalk I s.86 Bsp 28b ((3*x+5)/18 - x/2 = -((3*x - 2)/9))";
30.180 -"Schalk I s.86 Bsp 28b ((3*x+5)/18 - x/2 = -((3*x - 2)/9))";
30.181 -(*ER-2*)
30.182 -val fmz = ["equality ((3*x+5)/18 - x/2 = -((3*x - 2)/9))",
30.183 - "solveFor x","solutions L"];
30.184 -val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
30.185 -(*val p = e_pos'; val c = [];
30.186 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
30.187 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
30.188 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.189 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.190 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.191 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.192 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.193 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.194 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.195 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.196 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.197 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.198 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.199 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.200 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.201 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt; f2str f;
30.202 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[]")) => ()
30.203 - | _ => raise error "rlang.sml: diff.behav. in Schalk I s.86 Bsp 28b []";
30.204 -
30.205 -(*WN---v *)
30.206 -val bdv= (term_of o the o (parse thy)) "bdv";
30.207 -val v = (term_of o the o (parse thy)) "x";
30.208 -val t = (term_of o the o (parse thy)) "3 * x / 5";
30.209 -val SOME (t',_) = rewrite_set_inst_ PolyEq.thy true
30.210 - [(bdv, v)] make_ratpoly_in t;
30.211 -if term2str t' = "3 / 5 * x" then () else raise error "rlang.sml: 1";
30.212 -
30.213 -val t = str2term "(3*x+5)/18 - x/2 - -(3*x - 2)/9 = 0";
30.214 -val subst = [(str2term "bdv", str2term "x")];
30.215 -val SOME (t',_) = rewrite_set_inst_ thy false subst make_ratpoly_in t;
30.216 -if term2str t' = "1 / 18 = 0" then () else raise error "rlang.sml: 2";
30.217 -(*WN---^ *)
30.218 -
30.219 -(*----------------- Schalk I s.87 Bsp 36b ------------------------*)
30.220 -"Schalk I s.87 Bsp 36b ((17*x - 51)/9 - (-(13*x - 3)/6) + 11 -(9*x- 7)/4 = 0)";
30.221 -"Schalk I s.87 Bsp 36b ((17*x - 51)/9 - (-(13*x - 3)/6) + 11 -(9*x- 7)/4 = 0)";
30.222 -"Schalk I s.87 Bsp 36b ((17*x - 51)/9 - (-(13*x - 3)/6) + 11 -(9*x- 7)/4 = 0)";
30.223 -(*ER-1*)
30.224 -val fmz = ["equality ((17*x - 51)/9 - (-(13*x - 3)/6) + 11 - (9*x - 7)/4 = 0)",
30.225 - "solveFor x","solutions L"];
30.226 -val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
30.227 -(*val p = e_pos';
30.228 -val c = [];
30.229 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
30.230 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
30.231 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.232 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.233 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.234 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.235 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.236 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.237 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.238 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.239 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.240 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.241 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.242 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.243 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.244 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.245 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = -237 / 65]")) => ()
30.246 - | _ => raise error "rlang.sml: diff.behav. in Schalk I s.86 Bsp 36b [x = -237 / 65]";
30.247 -
30.248 -
30.249 -(*WN---v *)
30.250 -val t = str2term "(17*x - 51)/9 - (-(13*x - 3)/6) + 11 - (9*x - 7)/4 = 0";
30.251 -val subst = [(str2term "bdv", str2term "x")];
30.252 -val SOME (t',_) = rewrite_set_inst_ thy false subst make_ratpoly_in t;
30.253 -term2str t';
30.254 -if term2str t' = "79 / 12 + 65 / 36 * x = 0" then ()
30.255 -else raise error "rlang.sml: 3";
30.256 -(*WN---^ *)
30.257 -
30.258 -
30.259 -(*----------------- Schalk I s.87 Bsp 38b ------------------------*)
30.260 -"Schalk I s.87 Bsp 38b (-(2/x) + 3/(2*x) - 4/(3*x) + 5/(4*x) + 6/(5*x) =65/8)";
30.261 -"Schalk I s.87 Bsp 38b (-(2/x) + 3/(2*x) - 4/(3*x) + 5/(4*x) + 6/(5*x) =65/8)";
30.262 -"Schalk I s.87 Bsp 38b (-(2/x) + 3/(2*x) - 4/(3*x) + 5/(4*x) + 6/(5*x) =65/8)";
30.263 -(*ER-3*)
30.264 -val fmz = ["equality (-2/x + 3/(2*x) - 4/(3*x) + 5/(4*x) + 6/(5*x) = 65/8)",
30.265 - "solveFor x","solutions L"];
30.266 -val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
30.267 -(*val p = e_pos';
30.268 -val c = [];
30.269 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
30.270 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
30.271 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.272 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.273 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.274 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.275 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.276 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.277 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.278 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.279 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.280 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.281 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.282 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.283 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.284 -if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "296 + -3900 * x = 0")) then ()
30.285 -else raise error "rlang.sml: diff.behav. in Schalk I s.87 Bsp 38b";
30.286 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.287 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.288 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.289 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.290 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.291 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.292 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.293 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.294 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.295 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.296 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 74 / 975]")) => ()
30.297 - | _ => raise error "rlang.sml: diff.behav. in Schalk I s.86 Bsp 38b [x = 74 / 975]";
30.298 -
30.299 -(*----------------- Schalk I s.87 Bsp 40b ------------------------*)
30.300 -"Schalk I s.87 Bsp 40b ((x+3)/(2*x - 4)=3)";
30.301 -"Schalk I s.87 Bsp 40b ((x+3)/(2*x - 4)=3)";
30.302 -"Schalk I s.87 Bsp 40b ((x+3)/(2*x - 4)=3)";
30.303 -(*ER-4*)
30.304 -val fmz = ["equality ((x+3)/(2*x - 4)=3)",
30.305 - "solveFor x","solutions L"];
30.306 -val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
30.307 -(*val p = e_pos';
30.308 -val c = [];
30.309 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
30.310 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
30.311 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.312 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.313 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.314 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.315 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.316 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.317 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.318 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.319 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.320 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.321 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.322 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.323 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt; f2str f;
30.324 -(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.325 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;*)
30.326 -if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "15 + -5 * x = 0")) then ()
30.327 -else raise error "rlang.sml: diff.behav. in Schalk I s.87 Bsp 40b";
30.328 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.329 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.330 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.331 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.332 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.333 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.334 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.335 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.336 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.337 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 3]")) => ()
30.338 - | _ => raise error "rlang.sml: diff.behav. in Schalk I s.87 Bsp 40b [x = 3]";
30.339 -
30.340 -
30.341 -(*----------------- Schalk I s.87 Bsp 44a ------------------------*)
30.342 -"Schalk I s.87 Bsp 44a ((1/2+(5*x)/2)^^^2 -((13*x)/2- 5/2)^^^2 -(6*x)^^^2+29)";
30.343 -"Schalk I s.87 Bsp 44a ((1/2+(5*x)/2)^^^2 -((13*x)/2- 5/2)^^^2 -(6*x)^^^2+29)";
30.344 -"Schalk I s.87 Bsp 44a ((1/2+(5*x)/2)^^^2 -((13*x)/2- 5/2)^^^2 -(6*x)^^^2+29)";
30.345 -(*ER-5*)
30.346 -val fmz = ["equality ((1/2 + (5*x)/2)^^^2 - ((13*x)/2 - 5/2)^^^2 = -1*(6*x)^^^2 + 29)",
30.347 - "solveFor x","solutions L"];
30.348 -val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
30.349 -(*val p = e_pos';
30.350 -val c = [];
30.351 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
30.352 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
30.353 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.354 -(*trace_rewrite:=true;
30.355 -*)
30.356 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.357 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.358 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.359 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.360 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.361 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.362 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.363 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.364 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.365 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.366 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.367 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.368 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.369 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.370 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 1]")) => ()
30.371 - | _ => raise error "rlang.sml: diff.behav. in Schalk I s.87 Bsp 44a [x = 1]";
30.372 -
30.373 -(*WN---v *)
30.374 -val t = str2term "(1/2 + (5*x)/2)^^^2 - ((13*x)/2 - 5/2)^^^2 - (6*x)^^^2 + 29";
30.375 -val subst = [(str2term "bdv", str2term "x")];
30.376 -val SOME (t',_) = rewrite_set_inst_ thy false subst make_ratpoly_in t;
30.377 -if term2str t' = "23 + 35 * x + -72 * x ^^^ 2" then ()
30.378 -else raise error "rlang.sml: 4";
30.379 -
30.380 -val t = str2term "(1/2 + (5*x)/2)^^^2 - ((13*x)/2 - 5/2)^^^2 + (6*x)^^^2 - 29";
30.381 -val subst = [(str2term "bdv", str2term "x")];
30.382 -val SOME (t',_) = rewrite_set_inst_ thy false subst make_ratpoly_in t;
30.383 -if term2str t' = "-35 + 35 * x" then ()
30.384 -else raise error "rlang.sml: 4.1";
30.385 -(*WN---^ *)
30.386 -
30.387 -(*----------------- Schalk I s.87 Bsp 52a ------------------------*)
30.388 -"Schalk I s.87 Bsp 52a ((5*x)/(x - 2) - x/(x+2)=4)";
30.389 -"Schalk I s.87 Bsp 52a ((5*x)/(x - 2) - x/(x+2)=4)";
30.390 -"Schalk I s.87 Bsp 52a ((5*x)/(x - 2) - x/(x+2)=4)";
30.391 -(*ER-6*)
30.392 -val fmz = ["equality ((5*x)/(x - 2) - x/(x+2)=4)",
30.393 - "solveFor x","solutions L"];
30.394 -val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
30.395 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.396 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.397 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.398 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.399 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.400 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.401 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.402 - (*"12 * x + 4 * x ^^^ 2 = 4 * (-4 + x ^^^ 2)",Subproblem["normalize", "poly*)
30.403 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.404 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.405 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.406 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.407 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.408 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.409 -if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "16 + 12 * x = 0")) then ()
30.410 -else raise error "rlang.sml: diff.behav. in Schalk I s.87 Bsp 52a";
30.411 - (*Subproblem["degree_1", "polynomial", "univariate", "equation"]*)
30.412 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.413 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.414 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.415 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.416 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.417 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.418 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.419 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.420 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.421 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = -4 / 3]")) => ()
30.422 - | _ => raise error "rlang.sml: diff.behav. in Schalk I s.87 Bsp 52a [x = -4 / 3]";
30.423 -
30.424 -(*----------------- Schalk I s.87 Bsp 55b ------------------------*)
30.425 -"Schalk I s.87 Bsp 55b (x/(x^^^2 - 6*x+9) - 1/(x^^^2 - 3*x) =1/x)";
30.426 -"Schalk I s.87 Bsp 55b (x/(x^^^2 - 6*x+9) - 1/(x^^^2 - 3*x) =1/x)";
30.427 -"Schalk I s.87 Bsp 55b (x/(x^^^2 - 6*x+9) - 1/(x^^^2 - 3*x) =1/x)";
30.428 -(*ER-7*)
30.429 -val fmz = ["equality (x/(x^^^2 - 6*x+9) - 1/(x^^^2 - 3*x) =1/x)",
30.430 - "solveFor x","solutions L"];
30.431 -val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
30.432 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.433 -(*val nxt = ("Model_Problem",Model_Problem["rational","univariate","equation"*)
30.434 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.435 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.436 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.437 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.438 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.439 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.440 -(*//me's dropped !val it = ["9 * x + -6 * x ^^^ 2 + 1 * x ^^^ 3 ~= 0","x ~= 0"]
30.441 -"(3 + -1 * x + 1 * x ^^^ 2) * x = 1 * (9 * x + -6 * x ^^^ 2 + 1 * x ^^^3)"))
30.442 -WN: Grad hoeher ~~~~~~~~~~~~ als notwendig ~~~~~~~~*)
30.443 -(* nxt =Model_Problem ["normalize","polynomial","univariate","equation"])*)
30.444 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.445 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.446 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.447 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.448 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.449 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.450 -(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt; 040209 MGs norm_Rational*)
30.451 -(* val nxt = Subproblem ("PolyEq.thy",["polynomial","univariate","equation"])*)
30.452 -if f= Form' (FormKF (~1, EdUndef, 0, Nundef, "-6 * x + 5 * x ^^^ 2 = 0"))then()
30.453 -else raise error "rlang.sml: diff.behav. in Schalk I s.87 Bsp 55b";
30.454 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.455 -(*nxt=Model_Problem["bdv_only","degree_2","polynomial","univariate","equation*)
30.456 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.457 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.458 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.459 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.460 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.461 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.462 -(*val f = Form' (FormKF (~1,EdUndef,3,Nundef,"x = 0 | x = 6 / 5")) : mout
30.463 -val nxt = ("Or_to_List",Or_to_List) *)
30.464 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.465 -(*val f = Form' (FormKF (~1,EdUndef,3,Nundef,"[x = 0, x = 6 / 5]")) : mout
30.466 -val nxt = ("Check_elementwise",Check_elementwise "Assumptions")
30.467 -get_assumptions pt (fst p);
30.468 -val it = [] : string list ... correct for this subproblem !*)
30.469 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.470 -(*val p = ([6,5,5],Res) : pos'
30.471 -val f = Form' (FormKF (~1,EdUndef,3,Nundef,"[x = 0, x = 6 / 5]")) : mout
30.472 -nxt=Check_Postcond ["bdv_only","degree_2","polynomial","univariate","equation*)
30.473 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.474 -(*val p = ([6,5],Res) : pos'
30.475 -val f = Form' (FormKF (~1,EdUndef,2,Nundef,"[x = 0, x = 6 / 5]")) : mout
30.476 -val nxt =Check_Postcond ["normalize","polynomial","univariate","equation"])*)
30.477 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.478 -(*val p = ([6],Res) : pos'
30.479 -val f = Form' (FormKF (~1,EdUndef,1,Nundef,"[x = 0, x = 6 / 5]")) : mout
30.480 -val nxt = ("Check_elementwise",Check_elementwise "Assumptions")*)
30.481 -val [(aaa,ppp)] = get_assumptions_ pt p;
30.482 -if term2str aaa = "9 * x + -6 * x ^^^ 2 + x ^^^ 3 ~= 0" then ()
30.483 -else raise error "rlang.sml: diff.behav. in I s.87 Bsp 55b [x = 6 / 5], asms";
30.484 -(*WN060717 unintentionally changed some rls/ord while
30.485 - completing knowl. for thes2file...
30.486 -if term2str aaa = "9 * x + (x ^^^ 3 + -6 * x ^^^ 2) ~= 0" then ()
30.487 -else raise error "rlang.sml: diff.behav. in I s.87 Bsp 55b [x = 6 / 5], asms";
30.488 -.... but it became even better*)
30.489 -
30.490 -(*22.10.03:
30.491 -val it = "9 * x + (x ^^^ 3 + -6 * x ^^^ 2) ~= 0" : string;
30.492 - before 22.10.03:
30.493 -val it = ["9 * x + -6 * x ^^^ 2 + 1 * x ^^^ 3 ~= 0","x ~= 0"]
30.494 -> val subs = [(str2term "x", str2term "0")];
30.495 -> val pred = str2term "9 * x + -6 * x ^^^ 2 + 1 * x ^^^ 3 ~= 0 & x ~= 0";
30.496 -> eval_true thy [subst_atomic subs pred] rateq_erls;
30.497 -val it = false : bool
30.498 -> val subs = [(str2term "x", str2term "6 / 5")];
30.499 -> val pred = str2term "9 * x + -6 * x ^^^ 2 + 1 * x ^^^ 3 ~= 0 & x ~= 0";
30.500 -> eval_true thy [subst_atomic subs pred] rateq_erls;
30.501 -val it = true : bool*)
30.502 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.503 -(*val p = ([7],Res) : pos'
30.504 -val f = Form' (FormKF (~1,EdUndef,1,Nundef,"[x = 6 / 5]")) : mout
30.505 -val nxt =Check_Postcond ["rational","univariate","equation"]) *)
30.506 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.507 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 6 / 5]")) => ()
30.508 - | _ => raise error "rlang.sml: diff.behav. in Schalk I s.87 Bsp 55b [x = 6 / 5]";
30.509 -
30.510 -(*----------------- Schalk I s.88 Bsp 64c ------------------------*)
30.511 -"Schalk I s.88 Bsp 64c (((x - 1)/(x+1)+1)/((x - 1)/(x+1) - (x+1)/(x - 1))=2)";
30.512 -"Schalk I s.88 Bsp 64c (((x - 1)/(x+1)+1)/((x - 1)/(x+1) - (x+1)/(x - 1))=2)";
30.513 -"Schalk I s.88 Bsp 64c (((x - 1)/(x+1)+1)/((x - 1)/(x+1) - (x+1)/(x - 1))=2)";
30.514 -(*ER-8*)
30.515 -val fmz = ["equality (((x - 1)/(x+1)+1)/((x - 1)/(x+1) - (x+1)/(x - 1))=2)",
30.516 - "solveFor x","solutions L"];
30.517 -val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
30.518 -
30.519 -(*val p = e_pos'; val c = [];
30.520 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
30.521 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
30.522 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.523 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.524 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.525 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.526 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.527 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.528 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.529 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.530 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.531 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.532 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.533 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.534 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt; f2str f;
30.535 -if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "-3 + -1 * x = 0")) then ()
30.536 -else raise error "rlangsml: diff.behav. in Schalk I s.88 Bsp 64c";
30.537 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.538 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.539 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.540 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.541 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.542 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.543 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.544 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.545 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.546 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.547 -case f of Form' (FormKF (_,_,0,_,"[x = -3]")) => ()
30.548 - | _ => raise error "rlang.sml: diff.behav. in Schalk I s.88 Bsp 64c [x = -3]";
30.549 -
30.550 -(*----------------- Schalk I s.88 Bsp 79a (2) ------------------------*)
30.551 -"Schalk I s.88 Bsp 79a (2) (m1*v1+m2*v2=0)";
30.552 -"Schalk I s.88 Bsp 79a (2) (m1*v1+m2*v2=0)";
30.553 -"Schalk I s.88 Bsp 79a (2) (m1*v1+m2*v2=0)";
30.554 -(*ER-10*)
30.555 -val fmz = ["equality (m1*v1+m2*v2=0)",
30.556 - "solveFor m1","solutions L"];
30.557 -val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
30.558 -
30.559 -(*val p = e_pos'; val c = [];
30.560 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
30.561 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
30.562 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.563 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.564 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.565 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.566 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.567 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.568 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.569 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.570 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.571 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.572 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.573 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.574 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.575 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.576 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[m1 = -1 * m2 * v2 / v1]")) => ()
30.577 - | _ => raise error "rlang.sml: diff.behav. in Schalk I s.88 Bsp 79a (2) [m1 = -1 * m2 * v2 / v1]";
30.578 -
30.579 -(*----------------- Schalk I s.89 Bsp 90a(1) ------------------------*)
30.580 -"Schalk I s.89 Bsp 90a (1) (f=((w+u)/(w+v))*v0)";
30.581 -"Schalk I s.89 Bsp 90a (1) (f=((w+u)/(w+v))*v0)";
30.582 -"Schalk I s.89 Bsp 90a (1) (f=((w+u)/(w+v))*v0)";
30.583 -(*ER-11*)
30.584 -val fmz = ["equality (f=((w+u)/(w+v))*v0)",
30.585 - "solveFor v","solutions L"];
30.586 -val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
30.587 -
30.588 -(*val p = e_pos'; val c = [];
30.589 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
30.590 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
30.591 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.592 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.593 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.594 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.595 -(*val nxt = Specify_Problem ["rational","univariate","equation"]) *)
30.596 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.597 -(*val nxt = Specify_Method ["RatEq","solve_rat_equation"]) *)
30.598 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.599 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.600 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.601 -(*nxt = Subproblem ("RatEq.thy",["univariate","equation"])) *)
30.602 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.603 -(*val nxt =Model_Problem ["normalize","polynomial","univariate","equation"])*)
30.604 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.605 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.606 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.607 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.608 -(*val nxt = ("Apply_Method",Apply_Method ["PolyEq","normalize_poly"])*)
30.609 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.610 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.611 -(*val nxt =Subproblem ("PolyEq.thy",["polynomial","univariate","equation"]))*)
30.612 -if f = Form'
30.613 - (FormKF
30.614 - (~1,
30.615 - EdUndef,
30.616 - 0,
30.617 - Nundef,
30.618 - "f * w + -1 * u * v0 + -1 * v0 * w + f * v = 0")) then ()
30.619 -else raise error "rlang.sml: diff.behav. in Schalk I s.89 Bsp 90a";
30.620 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.621 -(*val nxt = Model_Problem ["degree_1","polynomial","univariate","equation"])*)
30.622 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.623 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.624 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.625 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.626 -(*val nxt = ("Apply_Method",Apply_Method ["PolyEq","solve_d1_poly_equation"])*)
30.627 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.628 -(*val f = "v = -1 * (f * w + -1 * u * v0 + -1 * v0 * w) / f")) : mout
30.629 -val nxt = ("Or_to_List",Or_to_List) : string * tac *)
30.630 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.631 -(*val f = "[v = -1 * (f * w + -1 * u * v0 + -1 * v0 * w) / f]")) : mout
30.632 -val nxt = ("Check_elementwise",Check_elementwise "Assumptions") *)
30.633 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.634 -(*val f = "[v = -1 * (f * w + -1 * u * v0 + -1 * v0 * w) / f]")) : mout
30.635 -val nxt = Check_Postcond ["degree_1","polynomial","univariate","equation"])*)
30.636 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.637 -(*val f = "[v = -1 * (f * w + -1 * u * v0 + -1 * v0 * w) / f]")) : mout
30.638 -val nxt = Check_Postcond ["normalize","polynomial","univariate","equation"])*)
30.639 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.640 -(*val f = "[v = -1 * (f * w + -1 * u * v0 + -1 * v0 * w) / f]")) : mout
30.641 -val nxt = ("Check_elementwise",Check_elementwise "Assumptions")*)
30.642 -
30.643 -get_assumptions_ pt p;
30.644 -(*it = ["v + w ~= 0"] ... goes to the solution as an assumption*)
30.645 -
30.646 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.647 -(*val f = Form' (FormKF (~1,EdUndef,1,Nundef,"[]")) : mout
30.648 -val nxt = Check_Postcond ["rational","univariate","equation"]) *)
30.649 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.650 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,
30.651 - "[v = (u * v0 + v0 * w + -1 * f * w) / f]")) => ()
30.652 - | _ => raise error "rlang.sml: diff.behav. in Schalk I s.89 Bsp 90a (1) [v=...]";
30.653 -if get_assumptions_ pt p =
30.654 - [(str2term"(u * v0 + v0 * w + -1 * f * w) / f + w ~= 0",[])] then ()
30.655 -else raise error "rlang.sml: diff.behav. in I s.89 Bsp 90a (1) [v=...] asm";
30.656 -
30.657 -
30.658 -(*----------------- Schalk I s.89 Bsp 90a(2) ------------------------*)
30.659 -"Schalk I s.89 Bsp 90a (2) (f=((w+u)/(w+v))*v0)";
30.660 -"Schalk I s.89 Bsp 90a (2) (f=((w+u)/(w+v))*v0)";
30.661 -"Schalk I s.89 Bsp 90a (2) (f=((w+u)/(w+v))*v0)";
30.662 -(*ER-12*)
30.663 -val fmz = ["equality (f=((w+u)/(w+v))*v0)",
30.664 - "solveFor w","solutions L"];
30.665 -val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
30.666 -(*val p = e_pos';val c = [];
30.667 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
30.668 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
30.669 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.670 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.671 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.672 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.673 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.674 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.675 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.676 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.677 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.678 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.679 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.680 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.681 -if f = Form'
30.682 - (FormKF
30.683 - (~1,
30.684 - EdUndef,
30.685 - 0,
30.686 - Nundef,
30.687 - "f * v + -1 * u * v0 + (f + -1 * v0) * w = 0")) then ()
30.688 -else raise error "rlang.sml: diff.behav. in Schalk I s.89 Bsp 90a (2)";
30.689 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.690 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.691 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.692 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.693 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.694 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.695 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.696 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.697 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.698 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[w = (u * v0 + -1 * f * v) / (f + -1 * v0)]")) => ()
30.699 - | _ => raise error "rlang.sml: diff.behav. in Schalk I Bsp 90a(2)";
30.700 -if get_assumptions_ pt p =
30.701 -[(str2term"v + (u * v0 + -1 * f * v) / (f + -1 * v0) ~= 0",[]),
30.702 - (str2term"f + -1 * v0 ~= 0",[])]
30.703 -then writeln "asm should be simplified ???"
30.704 -else raise error "rlang.sml: diff.behav. in Schalk I Bsp 90a(2) asm";
30.705 -
30.706 -(*----------------- Schalk I s.89 Bsp 98a(1) ------------------------*)
30.707 -"Schalk I s.89 Bsp 98a (1) (1/R=1/R1+1/R2)";
30.708 -"Schalk I s.89 Bsp 98a (1) (1/R=1/R1+1/R2)";
30.709 -"Schalk I s.89 Bsp 98a (1) (1/R=1/R1+1/R2)";
30.710 -(*ER-9*)
30.711 -val fmz = ["equality (1/R=1/R1+1/R2)",
30.712 - "solveFor R1","solutions L"];
30.713 -val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
30.714 -(*val p = e_pos'; val c = [];
30.715 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
30.716 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
30.717 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.718 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.719 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.720 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.721 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.722 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.723 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.724 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.725 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.726 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.727 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.728 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.729 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.730 -if f = Form'
30.731 - (FormKF
30.732 - (~1, EdUndef, 0, Nundef, "-1 * R * R2 + (R2 + -1 * R) * R1 = 0"))then()
30.733 -else raise error "rlang.sml: diff.behav. in Schalk I s.89 Bsp 98a (1)";
30.734 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.735 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.736 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.737 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.738 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.739 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.740 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.741 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.742 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.743 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[R1 = R * R2 / (R2 + -1 * R)]")) => ()
30.744 - | _ => raise error "rlang.sml: diff.behav. in 98a(1) [R1 = ...]";
30.745 -if get_assumptions_ pt p = [(str2term"R * R2 * R2 ~= (R2 + -1 * R) * 0",[]),
30.746 - (str2term"R2 + -1 * R ~= 0",[]),
30.747 - (str2term"R2 + -1 * R ~= 0",[])]
30.748 - then writeln "asm should be simplified"
30.749 -else raise error "rlang.sml: diff.behav. in 98a(1) asm";
30.750 -
30.751 -(*----------------- Schalk I s.89 Bsp 104a(1) ------------------------*)
30.752 -"Schalk I s.89 Bsp 104a (1) (y^^^2=2*p*x)";
30.753 -"Schalk I s.89 Bsp 104a (1) (y^^^2=2*p*x)";
30.754 -"Schalk I s.89 Bsp 104a (1) (y^^^2=2*p*x)";
30.755 -(*ER-13 + EO-11 ?!?*)
30.756 -val fmz = ["equality (y^^^2=2*p*x)",
30.757 - "solveFor p","solutions L"];
30.758 -val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
30.759 -(*val p = e_pos'; val c = [];
30.760 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
30.761 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
30.762 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.763 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.764 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.765 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.766 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.767 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.768 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.769 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.770 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.771 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.772 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.773 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.774 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.775 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.776 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.777 -case f of Form' (FormKF (_,_,0,_,"[p = y ^^^ 2 / (2 * x)]")) => ()
30.778 - | _ => raise error "rlang.sml: diff.behav. in Schalk I s.89 Bsp 104a (1) [p = y^2/(2*x)]";
30.779 -if get_assumptions_ pt p = [(str2term"-2 * x ~= 0",[])]
30.780 -then writeln"should be x ~= 0\nshould be x ~= 0\nshould be x ~= 0\n"
30.781 -else raise error "rlang.sml: diff.behav. in I s.89 Bsp 104a(1) asm";
30.782 -
30.783 -
30.784 -(*----------------- Schalk I s.89 Bsp 104a(2) ------------------------*)
30.785 -"Schalk I s.89 Bsp 104a (2) (y^^^2=2*p*x)";
30.786 -"Schalk I s.89 Bsp 104a (2) (y^^^2=2*p*x)";
30.787 -"Schalk I s.89 Bsp 104a (2) (y^^^2=2*p*x)";
30.788 -(*EO ??*)
30.789 -val fmz = ["equality (y^^^2=2*p*x)",
30.790 - "solveFor y","solutions L"];
30.791 -val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
30.792 -(*val p = e_pos';
30.793 -val c = [];
30.794 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
30.795 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
30.796 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.797 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.798 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.799 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.800 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.801 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.802 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.803 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.804 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.805 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.806 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.807 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.808 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.809 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.810 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.811 -case f of Form' (FormKF (_,_,0,_,"[y = sqrt (2 * p * x), y = -1 * sqrt (2 * p * x)]")) => ()
30.812 -| _ => raise error "rlang.sml: diff.behav. Schalk I s.89 Bsp 104a(2) [x = ]";
30.813 -if get_assumptions_ pt p = [(str2term"0 <= -1 * (-2 * p * x)",[]),(str2term"0 <= -1 * (-2 * p * x)",[])] then writeln "asm should be simplified\nshould be simplified"
30.814 -else raise error "rlang.sml: diff.behav. in I s.89 Bsp 104a(2) asm";
30.815 -
30.816 -
30.817 -(*----------------- Schalk I s.90 Bsp 118a (1) ------------------------*)
30.818 -"Schalk I s.90 Bsp 118a (1) (b^^^2*x^^^2 + a^^^2*y^^^2 = a^^^2*b^^^2)";
30.819 -"Schalk I s.90 Bsp 118a (1) (b^^^2*x^^^2 + a^^^2*y^^^2 = a^^^2*b^^^2)";
30.820 -"Schalk I s.90 Bsp 118a (1) (b^^^2*x^^^2 + a^^^2*y^^^2 = a^^^2*b^^^2)";
30.821 -(*EO-8*)
30.822 -val fmz = ["equality (b^^^2*x^^^2 + a^^^2*y^^^2 = a^^^2*b^^^2)",
30.823 - "solveFor x","solutions L"];
30.824 -val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
30.825 -(*val p = e_pos';
30.826 -val c = [];
30.827 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
30.828 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
30.829 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.830 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.831 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.832 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.833 -
30.834 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.835 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;
30.836 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;
30.837 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;
30.838 -
30.839 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.840 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.841 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.842 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.843 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.844 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.845 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.846 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.847 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;
30.848 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;get_asm (fst p, fst p) pt;
30.849 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;get_asm (fst p, fst p) pt;
30.850 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;get_asm (fst p, fst p) pt;
30.851 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;get_asm (fst p, fst p) pt;
30.852 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;asms2str (get_asm (fst p, fst p) pt);
30.853 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;asms2str (get_asm (fst p, fst p) pt);
30.854 -
30.855 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;get_asm (fst p, fst p) pt;
30.856 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;get_asm (fst p, fst p) pt;
30.857 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = sqrt ((a ^^^ 2 * b ^^^ 2 + -1 * a ^^^ 2 * y ^^^ 2) / b ^^^ 2),\n x = -1 * sqrt ((a ^^^ 2 * b ^^^ 2 + -1 * a ^^^ 2 * y ^^^ 2) / b ^^^ 2)]")) => writeln"should be simplified MG"
30.858 -| _ => raise error "rlang.sml: diff.behav. in Schalk I s.89 Bsp 118a(2) [x = ]";
30.859 -val asms = get_assumptions_ pt p;
30.860 -if asms = [(str2term"0 * b ^^^ 2 <= -1 * (a ^^^ 2 * y ^^^ 2 + -1 * a ^^^ 2 * b ^^^ 2)", []),
30.861 - (str2term"b ^^^ 2 ~= 0", []),
30.862 - (str2term"0 * b ^^^ 2 <= -1 * (a ^^^ 2 * y ^^^ 2 + -1 * a ^^^ 2 * b ^^^ 2)", []),
30.863 - (str2term"b ^^^ 2 ~= 0", [])
30.864 - ] then writeln"should be simplified MG"
30.865 -else raise error "rlang.sml: diff.behav. in Schalk I s.89 Bsp 118a(2) asms";
30.866 -
30.867 -(*----------------- Schalk I s.102 Bsp 268(1) ------------------------*)
30.868 -"Schalk I s.102 Bsp 268(1) (A = (1/2)*(x1*(y2-y3)+x2*(y3 - y1)+x3*(y1 - y2)))";
30.869 -"Schalk I s.102 Bsp 268(1) (A = (1/2)*(x1*(y2-y3)+x2*(y3 - y1)+x3*(y1 - y2)))";
30.870 -"Schalk I s.102 Bsp 268(1) (A = (1/2)*(x1*(y2-y3)+x2*(y3 - y1)+x3*(y1 - y2)))";
30.871 -(*ER-14*)
30.872 -val fmz = ["equality (A = (1/2)*(x1*(y2 - y3)+x2*(y3 - y1)+x3*(y1 - y2)))",
30.873 - "solveFor x2","solutions L"];
30.874 -val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
30.875 -(*val p = e_pos';
30.876 -val c = [];
30.877 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
30.878 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
30.879 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.880 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.881 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.882 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.883 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.884 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.885 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.886 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.887 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.888 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.889 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.890 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.891 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.892 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.893 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.894 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x2 =\n (-2 * A + x1 * y2 + x3 * y1 + -1 * x1 * y3 + -1 * x3 * y2) /\n (y1 + -1 * y3)]")) => ()
30.895 -| _ => raise error "rlang.sml: diff.behav. Schalk I s.102 Bsp 268(1) [x2=...]";
30.896 -if get_assumptions_ pt p = [(str2term"y1 / 2 + -1 * y3 / 2 ~= 0",[])] then ()
30.897 -else raise error "rlang.sml: diff.behav. in I s.102 Bsp 268(1) asm";
30.898 -
30.899 -(*-------------------- Schalk II ----------------------------*)
30.900 -(*-------------------- Schalk II ----------------------------*)
30.901 -(*-------------------- Schalk II ----------------------------*)
30.902 -(*-------------------- Schalk II ----------------------------*)
30.903 -(*-------------------- Schalk II ----------------------------*)
30.904 -
30.905 -
30.906 -(*----------------- Schalk II s.56 Bsp 67b ------------------------*)
30.907 -"Schalk II s.56 Bsp 67b (4*sqrt(4*x+1)=3*sqrt(7*x+2))";
30.908 -"Schalk II s.56 Bsp 67b (4*sqrt(4*x+1)=3*sqrt(7*x+2))";
30.909 -"Schalk II s.56 Bsp 67b (4*sqrt(4*x+1)=3*sqrt(7*x+2))";
30.910 -(*EO*)
30.911 -val fmz = ["equality (4*sqrt(4*x+1)=3*sqrt(7*x+2))",
30.912 - "solveFor x","solutions L"];
30.913 -val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
30.914 -(*val p = e_pos';
30.915 -val c = [];
30.916 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
30.917 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
30.918 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.919 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.920 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.921 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.922 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.923 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.924 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.925 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.926 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.927 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.928 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.929 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.930 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt; f2str f;
30.931 -if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "-2 + x = 0")) then ()
30.932 -else raise error "rlang.sml: diff.behav. in Schalk II s.56 Bsp 67b";
30.933 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.934 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.935 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.936 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.937 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.938 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.939 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.940 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.941 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.942 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 2]")) => ()
30.943 - | _ => raise error "rlang.sml: diff.behav. in Schalk II s.56 Bsp 67b [x=2]";
30.944 -
30.945 -(*----------------- Schalk II s.56 Bsp 68a ------------------------*)
30.946 -"Schalk II s.56 Bsp 68a (5*sqrt(x) - 1 = 7*sqrt(x) - 5)";
30.947 -"Schalk II s.56 Bsp 68a (5*sqrt(x) - 1 = 7*sqrt(x) - 5)";
30.948 -"Schalk II s.56 Bsp 68a (5*sqrt(x) - 1 = 7*sqrt(x) - 5)";
30.949 -val fmz = ["equality (5*sqrt(x) - 1 = 7*sqrt(x) - 5)",
30.950 - "solveFor x","solutions L"];
30.951 -val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
30.952 -(*val p = e_pos';
30.953 -val c = [];
30.954 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
30.955 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
30.956 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.957 -(* val nxt = ("Model_Problem",Model_Problem ["normalize","root","univariate","equation"])*)
30.958 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.959 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.960 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.961 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.962 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.963 -(* val nxt = ("Model_Problem",Model_Problem ["sq","root","univariate","equation"]) *)
30.964 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.965 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.966 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.967 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.968 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.969 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.970 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.971 -(* val nxt = ("Model_Problem",Model_Problem ["sq","root","univariate","equation"]) *)
30.972 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.973 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.974 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.975 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.976 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.977 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.978 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.979 -get_assumptions_ pt p;
30.980 -(* val nxt = ("Model_Problem", Model_Problem ["normalize","polynomial","univariate","equation"])*)
30.981 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.982 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.983 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.984 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.985 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.986 -if f = Form'
30.987 - (FormKF
30.988 - (~1, EdUndef, 0, Nundef, "256 + -2368 * x + 576 * x ^^^ 2 = 0"))then()
30.989 -else raise error "rlang.sml: diff.behav. in Schalk II s.56 Bsp 68a";
30.990 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.991 -get_assumptions_ pt p;
30.992 -(* val nxt = ("Model_Problem", Model_Problem
30.993 - ["abcFormula","degree_2","polynomial","univariate","equation"])*)
30.994 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.995 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.996 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.997 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.998 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.999 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1000 -get_assumptions_ pt p;
30.1001 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1002 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1003 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1004 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1005 -if f = Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 4, x = 1 / 9]"))
30.1006 -then writeln "only [x = 4] !\nonly [x = 4] !\nonly [x = 4] !\n"
30.1007 -else raise error "rlang.sml: diff.behav. in II 68a";
30.1008 -val asms = get_assumptions_ pt p;
30.1009 -if asms2str asms =
30.1010 -"[(0 <= (25 * (1 / 9) + -1 * (16 + 49 * (1 / 9))) * -56, []),\
30.1011 - \(0 <= 1 / 9, []),\
30.1012 - \(0 <= 1 / 9, []),\
30.1013 - \(0 <= (-5 + 7 * sqrt (1 / 9) + 1) * 5, []),\
30.1014 - \(0 <= 1 / 9, []),\
30.1015 - \(0 <= (25 * (1 / 9) + -1 * (16 + 49 * (1 / 9))) * -56, []),\
30.1016 - \(0 <= 1 / 9, [])]"
30.1017 -(*WN050916 before correction 'rewrite__set_ called with 'Erls' for ..'
30.1018 - thus: maybe the rls for the asms is Erls ??:
30.1019 - [(str2term"0 <= (25 * (1 / 9) + -1 * (16 + 49 * (1 / 9))) * -56", []),
30.1020 - (str2term"9 ~= 0", []),
30.1021 - (str2term"0 <= (-5 + 7 * sqrt (1 / 9) + 1) * 5", []),
30.1022 - (str2term"9 ~= 0", []),
30.1023 - (str2term"0 <= (25 * (1 / 9) + -1 * (16 + 49 * (1 / 9))) * -56", [])]*)
30.1024 - then "should get True * False!!!"
30.1025 -else raise error "rlang.sml: diff.behav. in II 68a asms";
30.1026 -
30.1027 -(*----------------- Schalk II s.56 Bsp 73b ------------------------*)
30.1028 -"Schalk II s.56 Bsp 73b (sqrt(x+1)+sqrt(4*x+4)=sqrt(9*x+9))";
30.1029 -"Schalk II s.56 Bsp 73b (sqrt(x+1)+sqrt(4*x+4)=sqrt(9*x+9))";
30.1030 -"Schalk II s.56 Bsp 73b (sqrt(x+1)+sqrt(4*x+4)=sqrt(9*x+9))";
30.1031 -(*EO-2*)
30.1032 -val fmz = ["equality (sqrt(x+1)+sqrt(4*x+4)=sqrt(9*x+9))",
30.1033 - "solveFor x","solutions L"];
30.1034 -val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
30.1035 -
30.1036 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.1037 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1038 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1039 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1040 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1041 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1042 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1043 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1044 -(*"13 + 13 * x + -2 * sqrt ((4 + 4 * x) * (9 + 9 * x)) = 1 + x"
30.1045 --> Subproblem ("RootEq.thy", ["univariate", ...])*)
30.1046 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1047 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1048 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1049 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1050 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1051 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1052 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1053 -(*"144 + 288 * x + 144 * x ^^^ 2 = 144 + x ^^^ 2 + 288 * x + 143 * x ^^^ 2"
30.1054 --> Subproblem ("RootEq.thy", ["univariate", ...])*)
30.1055 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1056 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1057 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1058 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1059 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1060 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1061 -if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "0 = 0")) then ()
30.1062 -else raise error "rlang.sml: diff.behav. in Schalk II s.56 Bsp 73b";
30.1063 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1064 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1065 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1066 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1067 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1068 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1069 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1070 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1071 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1072 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1073 -val asm = get_assumptions_ pt p;
30.1074 -if asm=[] andalso f = Form' (FormKF (~1,EdUndef,0,Nundef,"UniversalList")) andalso nxt = ("End_Proof'",End_Proof') then ()
30.1075 -else raise error "rlang.sml: diff.behav. in UniversalList 2";
30.1076 -
30.1077 -(*----------------- Schalk II s.56 Bsp 74a ------------------------*)
30.1078 -"Schalk II s.56 Bsp 74a (sqrt(4*x+1) - sqrt(x+3) = sqrt(x - 2))";
30.1079 -"Schalk II s.56 Bsp 74a (sqrt(4*x+1) - sqrt(x+3) = sqrt(x - 2))";
30.1080 -"Schalk II s.56 Bsp 74a (sqrt(4*x+1) - sqrt(x+3) = sqrt(x - 2))";
30.1081 -(*EO-3*)
30.1082 -val fmz = ["equality (sqrt(4*x+1) - sqrt(x+3) = sqrt(x - 2))",
30.1083 - "solveFor x","solutions L"];
30.1084 -val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
30.1085 -
30.1086 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.1087 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1088 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1089 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1090 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1091 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1092 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1093 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1094 -(*4 + 5 * x + -2 * sqrt (3 + 13 * x + 4 * x ^^^ 2) = -2 + x"
30.1095 --> Subproblem ("RootEq.thy", ["univariate", ...])*)
30.1096 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1097 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1098 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1099 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1100 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1101 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1102 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1103 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1104 -(*"12 + 52 * x + 16 * x ^^^ 2 = 36 + x ^^^ 2 + 48 * x + 15 * x ^^^ 2"
30.1105 --> Subproblem ("RootEq.thy", ["univariate", ...])*)
30.1106 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1107 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1108 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1109 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1110 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1111 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1112 -if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "-24 + 4 * x = 0")) then ()
30.1113 -else raise error "rlang.sml: diff.behav. in Schalk II s.56 Bsp 74a";
30.1114 -(*-> ubproblem ("PolyEq.thy", ["degree_1", ...]*)
30.1115 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1116 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1117 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1118 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1119 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1120 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1121 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1122 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1123 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1124 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1125 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 6]")) => ()
30.1126 - | _ => raise error "rlang.sml: diff.behav. in Schalk II s.56 Bsp 74a [x = 6]";
30.1127 -
30.1128 -
30.1129 -(*----------------- Schalk II s.56 Bsp 77b ------------------------*)
30.1130 -"Schalk II s.56 Bsp 77b (sqrt(x+12)+sqrt(x - 3) = sqrt(x + 32) - sqrt(5+x))";
30.1131 -"Schalk II s.56 Bsp 77b (sqrt(x+12)+sqrt(x - 3) = sqrt(x + 32) - sqrt(5+x))";
30.1132 -"Schalk II s.56 Bsp 77b (sqrt(x+12)+sqrt(x - 3) = sqrt(x + 32) - sqrt(5+x))";
30.1133 -(*EO-4*)
30.1134 -val fmz = ["equality (sqrt(x+12)+sqrt(x - 3) = sqrt(x + 32) - sqrt(5+x))",
30.1135 - "solveFor x","solutions L"];
30.1136 -val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
30.1137 -
30.1138 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.1139 -(* val nxt = ("Model_Problem",Model_Problem ["sq","root","univariate","equation"]) *)
30.1140 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1141 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1142 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1143 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1144 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1145 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1146 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1147 -(* val nxt = ("Model_Problem",Model_Problem ["sq","root","univariate","equation"]) *)
30.1148 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1149 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1150 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1151 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1152 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1153 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1154 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt; f2str f;
30.1155 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1156 -(* val nxt = ("Model_Problem",Model_Problem ["sq","root","univariate","equation"]) *)
30.1157 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1158 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1159 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1160 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1161 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1162 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1163 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1164 -(*val nxt = ("Model_Problem",
30.1165 - Model_Problem ["normalize","polynomial","univariate","equation"])*)
30.1166 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1167 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1168 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1169 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1170 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1171 -(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt; since MGs norm_Rational*)
30.1172 -if f = Form'(FormKF (~1, EdUndef, 0, Nundef, "451584 + -112896 * x = 0"))then()
30.1173 -else raise error "rlang.sml: diff.behav. in Schalk II s.56 Bsp 77b";
30.1174 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1175 -(* val nxt = ("Model_Problem",
30.1176 - Model_Problem ["degree_1","polynomial","univariate","equation"])*)
30.1177 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1178 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1179 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1180 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1181 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1182 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1183 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1184 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1185 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1186 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[]")) => ()
30.1187 - | _ => raise error "rlang.sml: diff.behav. in Schalk II s.56 Bsp 77b []";
30.1188 -(*added 040209 at introducing MGs norm_Rational ?!*)
30.1189 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1190 -
30.1191 -
30.1192 -(*----------------- Schalk II s.66 Bsp 4 ------------------------*)
30.1193 -"Schalk II s.66 Bsp 4 ((6*x - 9)*(5*x+7) - (4*x+7)*(3*x - 6) = 429)";
30.1194 -"Schalk II s.66 Bsp 4 ((6*x - 9)*(5*x+7) - (4*x+7)*(3*x - 6) = 429)";
30.1195 -"Schalk II s.66 Bsp 4 ((6*x - 9)*(5*x+7) - (4*x+7)*(3*x - 6) = 429)";
30.1196 -(*EP*)
30.1197 -val fmz = ["equality ((6*x - 9)*(5*x+7) - (4*x+7)*(3*x - 6) = 429)",
30.1198 - "solveFor x","solutions L"];
30.1199 -val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
30.1200 -(*val p = e_pos';
30.1201 -val c = [];
30.1202 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
30.1203 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
30.1204 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.1205 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1206 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1207 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1208 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1209 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1210 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1211 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1212 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1213 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1214 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1215 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1216 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1217 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1218 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1219 -case f of Form' (FormKF (_,_,0,_,"[x = 5, x = -5]")) => ()
30.1220 - | _ => raise error "rlang.sml: diff.behav. in Schalk II s.66 Bsp 4 []";
30.1221 -
30.1222 -
30.1223 -(*----------------- Schalk II s.66 Bsp 8a ------------------------*)
30.1224 -"Schalk II s.66 Bsp 8a ((x - 4)/(x+4) = (1 - x)/(1+x))";
30.1225 -(*ER-15*)
30.1226 -val fmz = ["equality ((x - 4)/(x+4) = (1 - x)/(1+x))",
30.1227 - "solveFor x","solutions L"];
30.1228 -val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
30.1229 -
30.1230 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.1231 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1232 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1233 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1234 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1235 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1236 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1237 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt; f2str f;
30.1238 -(*"(-4 + x) * (1 + x) = (1 + -1 * x) * (4 + x)"
30.1239 --> Subproblem ("RatEq.thy", ["univariate", ...])*)
30.1240 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1241 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1242 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1243 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1244 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1245 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1246 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1247 -if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "-8 + 2 * x ^^^ 2 = 0")) then ()
30.1248 -else raise error "rlang.sml: diff.behav. in Schalk II s.66 Bsp 8a";
30.1249 -(*-> Subproblem ("PolyEq.thy", ["polynomial", ...])*)
30.1250 -(*
30.1251 - val Form' (FormKF (~1, EdUndef, 0, Nundef, str)) = f;
30.1252 - *)
30.1253 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1254 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1255 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1256 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1257 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1258 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1259 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1260 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1261 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1262 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 2, x = -2]")) => ()
30.1263 - | _ => raise error "rlang.sml: diff.behav. in Schalk II s.66 Bsp 8a [x = 2, x = -2]";
30.1264 -
30.1265 -(*----------------- Schalk II s.66 Bsp 10b ------------------------*)
30.1266 -"Schalk II s.66 Bsp 10b (1/(x^^^2 - 9)+(2*x+3)/(x+3)=(3*x+4)/(x - 3))";
30.1267 -"Schalk II s.66 Bsp 10b (1/(x^^^2 - 9)+(2*x+3)/(x+3)=(3*x+4)/(x - 3))";
30.1268 -"Schalk II s.66 Bsp 10b (1/(x^^^2 - 9)+(2*x+3)/(x+3)=(3*x+4)/(x - 3))";
30.1269 -val fmz = ["equality (1/(x^^^2 - 9)+(2*x+3)/(x+3)=(3*x+4)/(x - 3))",
30.1270 - "solveFor x","solutions L"];
30.1271 -val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
30.1272 -(*val p = e_pos';
30.1273 -val c = [];
30.1274 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
30.1275 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
30.1276 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.1277 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1278 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1279 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1280 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1281 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1282 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1283 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1284 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1285 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1286 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1287 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1288 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1289 -if f = Form'
30.1290 - (FormKF
30.1291 - (~1,
30.1292 - EdUndef,
30.1293 - 0,
30.1294 - Nundef,
30.1295 - "60 + 28 * x + -13 * x ^^^ 2 + -1 * x ^^^ 3 = 0")) then ()
30.1296 -else raise error "rlang.sml: diff.behav. in Schalk II s.66 Bsp 10b";
30.1297 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1298 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1299 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1300 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1301 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1302 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1303 -(*60 + 28 * x + -13 * x ^^^ 2 + -1 * x ^^^ 3 = 0 ... degree 3 not solvable*)
30.1304 -
30.1305 -
30.1306 -(*----------------- Schalk II s.66 Bsp 20a ------------------------*)
30.1307 -(*EO-6*)
30.1308 -"Schalk II s.66 Bsp 20a (sqrt(29 - sqrt (x^^^2 - 9))=5)";
30.1309 -"Schalk II s.66 Bsp 20a (sqrt(29 - sqrt (x^^^2 - 9))=5)";
30.1310 -"Schalk II s.66 Bsp 20a (sqrt(29 - sqrt (x^^^2 - 9))=5)";
30.1311 -val fmz = ["equality (sqrt(29 - sqrt(x^^^2 - 9))=5)",
30.1312 - "solveFor x","solutions L"];
30.1313 -val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
30.1314 -(*val p = e_pos';
30.1315 -val c = [];
30.1316 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
30.1317 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
30.1318 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.1319 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1320 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1321 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1322 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1323 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1324 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1325 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1326 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1327 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1328 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1329 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1330 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1331 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1332 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1333 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1334 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1335 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1336 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1337 -if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "-25 + x ^^^ 2 = 0")) then ()
30.1338 -else raise error "rlang.sml: diff.behav. in Schalk II s.66 Bsp 20a";
30.1339 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1340 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1341 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1342 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1343 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1344 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1345 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1346 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1347 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1348 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1349 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1350 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 5, x = -5]")) => ()
30.1351 - | _ => raise error "rlang.sml: diff.behav. in Schalk II s.66 Bsp 20a [x = 5, x = -5]";
30.1352 -
30.1353 -(*----------------- Schalk II s.66 Bsp 23b ------------------------*)
30.1354 -"Schalk II s.66 Bsp 23b (2*sqrt(261 - x) - sqrt(2+2*x)=sqrt(2)*sqrt(5 - 3*x))";
30.1355 -"Schalk II s.66 Bsp 23b (2*sqrt(261 - x) - sqrt(2+2*x)=sqrt(2)*sqrt(5 - 3*x))";
30.1356 -"Schalk II s.66 Bsp 23b (2*sqrt(261 - x) - sqrt(2+2*x)=sqrt(2)*sqrt(5 - 3*x))";
30.1357 -(*EO WN060310 something wrong:
30.1358 -([6, 6, 3, 1], Frm) "-1064944 + 32 * x + -48 * x ^^^ 2 = 0"
30.1359 - ### or2list False
30.1360 -([6, 6, 3, 1], Res) "False"
30.1361 -*)
30.1362 -val fmz = ["equality (2*sqrt(261 - x) - sqrt(2+2*x)=sqrt(2)*sqrt(5 - 3*x))",
30.1363 - "solveFor x","solutions L"];
30.1364 -val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
30.1365 -
30.1366 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.1367 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1368 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1369 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1370 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1371 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1372 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1373 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1374 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1375 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1376 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1377 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1378 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1379 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1380 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1381 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1382 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1383 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1384 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1385 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1386 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt; f2str f;
30.1387 -if f = Form'
30.1388 - (FormKF
30.1389 - (~1, EdUndef, 0, Nundef, "-1064944 + 32 * x + -48 * x ^^^ 2 = 0"))then()
30.1390 -else raise error "rlang.sml: diff.behav. in Schalk II s.66 Bsp 23b";
30.1391 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1392 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1393 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1394 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1395 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1396 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1397 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1398 -case f of Form' (FormKF (~1,EdUndef,_,Nundef,"[]")) => ()
30.1399 - | _ => raise error "rlang.sml: diff.behav. in Schalk II s.66 Bsp 23b []";
30.1400 -
30.1401 -(*----------------- Schalk II s.66 Bsp 28a ------------------------*)
30.1402 -"Schalk II s.66 Bsp 28a (A=(c/d)*sqrt(4*a^^^2 - c^^^2))";
30.1403 -"Schalk II s.66 Bsp 28a (A=(c/d)*sqrt(4*a^^^2 - c^^^2))";
30.1404 -"Schalk II s.66 Bsp 28a (A=(c/d)*sqrt(4*a^^^2 - c^^^2))";
30.1405 -val fmz = ["equality (A=(c/d)*sqrt(4*a^^^2 - c^^^2))",
30.1406 - "solveFor a","solutions L"];
30.1407 -val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
30.1408 -(*val p = e_pos';
30.1409 -val c = [];
30.1410 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
30.1411 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
30.1412 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.1413 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1414 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1415 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1416 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1417 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1418 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1419 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1420 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1421 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1422 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1423 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1424 -(*if f = Form'
30.1425 - (FormKF
30.1426 - (~1,
30.1427 - EdUndef,
30.1428 - 0,
30.1429 - Nundef,
30.1430 - "c ^^^ 4 / d ^^^ 2 + A ^^^ 2 * d ^^^ 2 / d ^^^ 2 +\n-4 * c ^^^ 2 / d ^^^ 2 * a ^^^ 2 =\n0")) then ()*)
30.1431 -if f2str f =
30.1432 - "c ^^^ 4 / d ^^^ 2 + A ^^^ 2 / 1 + -4 * c ^^^ 2 / d ^^^ 2 * a ^^^ 2 = 0"
30.1433 -then () else raise error "rlang.sml: diff.behav. in Schalk II s.66 Bsp 28a";
30.1434 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1435 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1436 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1437 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1438 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1439 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1440 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1441 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1442 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1443 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[a = sqrt ((c ^^^ 4 + A ^^^ 2 * d ^^^ 2) / (4 * c ^^^ 2)),\n a = -1 * sqrt ((c ^^^ 4 + A ^^^ 2 * d ^^^ 2) / (4 * c ^^^ 2))]")) => ()
30.1444 -| _ => raise error "rlang.sml: diff.behav. in Schalk II s.66 Bsp 28a [a=...]";
30.1445 -
30.1446 -
30.1447 -
30.1448 -(*----------------- Schalk II s.68 Bsp 52b ------------------------*)
30.1449 -"Schalk II s.68 Bsp 52b (1/(x - a+b)=1/x - 1/a + 1/b)";
30.1450 -val fmz = ["equality (1/(x - a+b)=1/x - 1/a + 1/b)",
30.1451 - "solveFor x","solutions L"];
30.1452 -val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
30.1453 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.1454 -(* val nxt = ("Model_Problem",Model_Problem ["rational","univariate","equation"])*)
30.1455 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1456 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1457 -(*val nxt = ("Specify_Theory",Specify_Theory "RatEq.thy")*)
30.1458 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1459 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1460 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1461 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1462 -(*val p = ([3],Res)
30.1463 -val f="1 * (a * (b * x)) = (a * b + (a * x + -1 * (b * x))) * (b + (x + -1 * a)
30.1464 -val nxt = Subproblem ("RatEq.thy",["univariate","equation"]))*)
30.1465 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1466 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1467 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1468 -(*val nxt = ("Specify_Theory",Specify_Theory "PolyEq.thy")*)
30.1469 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1470 -(* nxt = Specify_Problem ["normalize","polynomial","univariate","equation"])*)
30.1471 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1472 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1473 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1474 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1475 -(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt; at introducing of MGs norm_Rational*)
30.1476 -(*val p = ([4,5],Res) val f ="b * a ^^^ 2 + -1 * a * b ^^^ 2 + (a ^^^ 2 + b ^^^ 2 + -2 * a * b) * x +\n(b + -1 * a) * x ^^^ 2 =\n0"))
30.1477 -val nxt = Subproblem ("PolyEq.thy",["polynomial","univariate","equation"]))*)
30.1478 -if f = Form'
30.1479 - (FormKF
30.1480 - (~1,
30.1481 - EdUndef,
30.1482 - 0,
30.1483 - Nundef,
30.1484 - "b * a ^^^ 2 + -1 * a * b ^^^ 2 + (a ^^^ 2 + b ^^^ 2 + -2 * a * b) * x +\n(b + -1 * a) * x ^^^ 2 =\n0")) then ()
30.1485 -else raise error "rlang.sml: diff.behav. in chalk I s.87 Bsp 38b";
30.1486 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1487 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1488 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1489 -(*val nxt = ("Specify_Theory",Specify_Theory "PolyEq.thy")*)
30.1490 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1491 -(*Specify_Problem["abcFormula","degree_2","polynomial","univariate","equation*)
30.1492 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1493 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1494 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1495 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1496 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1497 -(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt;introducing MGs norm_Rational*)
30.1498 -(*val p = ([4,6,5],Res) val f ="[x =\n (2 * a * b + -1 * a ^^^ 2 + -1 * b ^^^ 2 +\n sqrt\n (a ^^^ 4 + b ^^^ 4 + -4 * a * a * b ^^^ 2 + -4 * a * b * a ^^^ 2 +\n -4 * b * b * a ^^^ 2 +\n 4 * a * a * b ^^^ 2 +\n 4 * a * b * a ^^^ 2 +\n 2 * a ^^^ 2 * b ^^^ 2)) /\n (-2 * a + 2 * #"
30.1499 -nx Check_Postcond["abcFormula","degree_2","polynomial","univariate","equation*)
30.1500 -(*9.9.03: -"- ["normalize","polynomial","univar...*)
30.1501 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1502 -(*val p = ([4,6],Res)
30.1503 -val nxt =Check_Postcond ["normalize","polynomial","univariate","equation"])*)
30.1504 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1505 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;(*1 additional for MGs norm_Rational*)
30.1506 -if p = ([],Res) andalso f = Form' (FormKF (~1,EdUndef,0,Nundef,
30.1507 -"[x =\n (2 * a * b + -1 * a ^^^ 2 + -1 * b ^^^ 2 +\n sqrt\n (a ^^^ 4 + b ^^^ 4 + -4 * a * a * b ^^^ 2 + -4 * a * b * a ^^^ 2 +\n -4 * b * b * a ^^^ 2 +\n 4 * a * a * b ^^^ 2 +\n 4 * a * b * a ^^^ 2 +\n 2 * a ^^^ 2 * b ^^^ 2)) /\n (-2 * a + 2 * b),\n x =\n (2 * a * b + -1 * a ^^^ 2 + -1 * b ^^^ 2 +\n -1 *\n sqrt\n (a ^^^ 4 + b ^^^ 4 + -4 * a * a * b ^^^ 2 + -4 * a * b * a ^^^ 2 +\n -4 * b * b * a ^^^ 2 +\n 4 * a * a * b ^^^ 2 +\n 4 * a * b * a ^^^ 2 +\n 2 * a ^^^ 2 * b ^^^ 2)) /\n (-2 * a + 2 * b)]")) andalso nxt = ("End_Proof'",End_Proof') then writeln"simplify MG"
30.1508 -else raise error "rlang.sml: diff.behav. in rational-a-b";
30.1509 -
30.1510 -(*----------------- Schalk II s.68 Bsp 56a ------------------------*)
30.1511 -"Schalk II s.68 Bsp 56a ((a+b*x)/(a-b*x) - (a - b*x)/(a+b*x)= (4*a*b)/(a^^^2 - b^^^2))";
30.1512 -val fmz = ["equality ((a+b*x)/(a-b*x) - (a - b*x)/(a+b*x)= (4*a*b)/(a^^^2 - b^^^2))","solveFor x","solutions L"];
30.1513 -val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
30.1514 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.1515 -(* val nxt = ("Model_Problem",Model_Problem ["rational","univariate","equation"]) *)
30.1516 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1517 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1518 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1519 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1520 -(*SK loops with poly:
30.1521 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1522 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1523 -
30.1524 -... with sml-nj:
30.1525 - (a + b * x) / (a + -1 * (b * x)) + (-1 * a + b * x) / (a + b * x) =
30.1526 - 4 * (a * b) / (a ^^^ 2 + -1 * b ^^^ 2)
30.1527 -common_nominator_p wird nicht angewendet, weil ...
30.1528 -add_fract terminiert nicht: 030603
30.1529 -siehe Rational.ML rational.sml
30.1530 -*)
30.1531 -
30.1532 -(*
30.1533 -"(a + b * x) / (a + -1 * (b * x)) + -1 * (a + -1 * (b * x)) / (a + b * x) =\n4 * a * b / (a ^^^ 2 + -1 * b ^^^ 2)"
30.1534 -
30.1535 -val nxt = ("Rewrite_Set",Rewrite_Set "make_ratpoly") : string * tac
30.1536 -"(a + b * x) / (a + -1 * b * x) + (-1 * a + b * x) / (a + b * x) =\n4 *
30.1537 -a * b / (a ^^^ 2 + -1 * b ^^^ 2)"
30.1538 -
30.1539 -
30.1540 -val t = str2term"(a + b * x) / (a + -1 * (b * x)) + -1 * (a + -1 * (b * x)) / (a + b * x) =\n4 * a * b / (a ^^^ 2 + -1 * b ^^^ 2)";
30.1541 -trace_rewrite:=true;
30.1542 -val SOME (t',asm) = rewrite_set_ thy false norm_Rational t;
30.1543 -term2str t';
30.1544 -trace_rewrite:=false;
30.1545 -
30.1546 -# rls: norm_Rational on: (a + b * x) / (a + -1 * (b * x)) + -1 * (a + -1 * (b * x)) / (a + b * x) = 4 * a * b / (a ^^^ 2 + -1 * b ^^^ 2)
30.1547 -
30.1548 -## rls: discard_minus on:
30.1549 -## rls: powers on:
30.1550 -## rls: rat_mult_divide on:
30.1551 -## rls: expand on:
30.1552 -## rls: reduce_0_1_2 on:
30.1553 -## rls: order_add_mult on:
30.1554 -### try thm: real_mult_commute
30.1555 -=== rewrites to: (a + b * x) / (a + -1 * (b * x)) + (-1 * a + -1 * (-1 * (b * x))) / (a + b * x) = b * (4 * a) / (a ^^^ 2 + -1 * b ^^^ 2)
30.1556 -
30.1557 -### try thm: real_mult_left_commute
30.1558 -=== rewrites to: (a + b * x) / (a + -1 * (b * x)) + (-1 * a + -1 * (-1 * (b * x))) / (a + b * x) = 4 * (b * a) / (a ^^^ 2 + -1 * b ^^^ 2)
30.1559 -
30.1560 -### try thm: real_mult_commute
30.1561 -=== rewrites to: (a + b * x) / (a + -1 * (b * x)) + (-1 * a + -1 * (-1 * (b * x))) / (a + b * x) = 4 * (a * b) / (a ^^^ 2 + -1 * b ^^^ 2)
30.1562 -
30.1563 -### try calc: op *'
30.1564 -=== calc. to: (a + b * x) / (a + -1 * (b * x)) + (-1 * a + 1 * (b * x)) / (a +b * x) = 4 * (a * b) / (a ^^^ 2 + -1 * b ^^^ 2)
30.1565 -
30.1566 -## rls: common_nominator_p on: (a + b * x) / (a + -1 * (b * x)) + (-1 * a + 1 * (b * x)) / (a + b * x) =
30.1567 - 4 * (a * b) / (a ^^^ 2 + -1 * b ^^^ 2)
30.1568 -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!GC
30.1569 -
30.1570 -## rls: discard_minus on:
30.1571 -## rls: powers on:
30.1572 -## rls: rat_mult_divide on:
30.1573 -## rls: expand on:
30.1574 -## rls: reduce_0_1_2 on:
30.1575 -### try thm: real_mult_1
30.1576 -=== rewrites to: (a + b * x) / (a + -1 * (b * x)) + (-1 * a + b * x) / (a + b * x) = 4 * (a * b) / (a ^^^ 2 + -1 * b ^^^ 2)
30.1577 -
30.1578 -## rls: order_add_mult on:
30.1579 -
30.1580 -## rls: common_nominator_p on: (a + b * x) / (a + -1 * (b * x)) + (-1 * a + b * x) / (a + b * x) =
30.1581 - 4 * (a * b) / (a ^^^ 2 + -1 * b ^^^ 2)
30.1582 -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!GC
30.1583 -
30.1584 -## rls: discard_minus on:
30.1585 -## rls: powers on:
30.1586 -## rls: rat_mult_divide on:
30.1587 -## rls: expand on:
30.1588 -## rls: reduce_0_1_2 on:
30.1589 -## rls: order_add_mult on:
30.1590 -## rls: collect_numerals on:
30.1591 -## rls: common_nominator_p on: (a + b * x) / (a + -1 * (b * x)) + (-1 * a + b * x) / (a + b * x) =
30.1592 -4 * (a * b) / (a ^^^ 2 + -1 * b ^^^ 2)
30.1593 -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!GC
30.1594 -*)
30.1595 -
30.1596 -
30.1597 -(*----------------- Schalk II s.68 Bsp 61b ------------------------*)
30.1598 -"Schalk II s.68 Bsp 61b (sqrt(x+a)+sqrt(b - x)=sqrt(a+b))";
30.1599 -val fmz = ["equality (sqrt(x+a)+sqrt(b - x)=sqrt(a+b))",
30.1600 - "solveFor x","solutions L"];
30.1601 -val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
30.1602 -
30.1603 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.1604 -(* val nxt = ("Model_Problem",Model_Problem ["sq","root","univariate","equation"])*)
30.1605 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1606 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1607 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1608 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1609 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1610 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1611 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1612 -(* val nxt = ("Model_Problem",Model_Problem ["sq","root","univariate","equation"])*)
30.1613 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1614 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1615 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1616 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1617 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1618 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1619 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1620 -(*val nxt = ("Model_Problem",
30.1621 - Model_Problem ["normalize","polynomial","univariate","equation"])*)
30.1622 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1623 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1624 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1625 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1626 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1627 -if f = Form'
30.1628 - (FormKF
30.1629 - (~1,
30.1630 - EdUndef,
30.1631 - 0,
30.1632 - Nundef,
30.1633 - (*"-4 * b ^^^ 2 + -4 * a * b + 4 * b ^^^ 2 + 8 * a * b +\n(-2 * a + -4 * a + -4 * b + 2 * a + 8 * b) * x +\n-4 * x ^^^ 2 =\n0" before MG*)
30.1634 - "4 * a * b + (-4 * a + 4 * b) * x + -4 * x ^^^ 2 = 0")) then ()
30.1635 -else raise error "rlang.sml: diff.behav. in Schalk II s.68 Bsp 61b";
30.1636 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1637 -(*val nxt = ("Model_Problem", Model_Problem
30.1638 - ["abcFormula","degree_2","polynomial","univariate","equation"])*)
30.1639 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1640 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1641 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1642 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1643 -(* f= ... "-4 * b ^^^ 2 + -4 * a * b + 4 * b ^^^ 2 + 8 * a * b +
30.1644 - (-2 * a + -4 * a + -4 * b + 2 * a + 8 * b) * x + -4 * x ^^^ 2 =0"*)
30.1645 -(*val nxt = ("Rewrite_Set_Inst",Rewrite_Set_Inst ([#],"d2_polyeq_abcFormula_simplify"))*)
30.1646 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1647 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1648 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1649 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1650 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1651 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1652 -(*if f = Form' (FormKF (~1,EdUndef,0,Nundef, with norm_Rational before MG
30.1653 -"[x =\n (-2 * a + -4 * b + 6 * a +\n sqrt\n (32 * a * b + -16 * a ^^^ 2 + -48 * b ^^^ 2 + 24 * a ^^^ 2 +\n 64 * b ^^^ 2 +\n 8 * a ^^^ 2)) /\n -8,\n x =\n (-2 * a + -4 * b + 6 * a +\n -1 *\n sqrt\n (32 * a * b + -16 * a ^^^ 2 + -48 * b ^^^ 2 + 24 * a ^^^ 2 +\n 64 * b ^^^ 2 +\n 8 * a ^^^ 2)) /\n -8]")) then writeln"simplify MG"*)
30.1654 -if f = Form' (FormKF (~1,EdUndef,0,Nundef,"[x =\n (-4 * b + 4 * a + sqrt (32 * a * b + 16 * a ^^^ 2 + 16 * b ^^^ 2)) / -8,\n x =\n (-4 * b + 4 * a + -1 * sqrt (32 * a * b + 16 * a ^^^ 2 + 16 * b ^^^ 2)) /\n -8]")) then ()
30.1655 -else raise error "rlang.sml: diff.behav. Bsp 61b";
30.1656 -(*WN.18.12.03: extreme run-time !!!*)
30.1657 -
30.1658 -
30.1659 -(*----------------- Schalk II s.68 Bsp 62b ------------------------*)
30.1660 -"Schalk II s.68 Bsp 62b (sqrt((x+a)^^^2+(x - 2*b)^^^2)=a+2*b)";
30.1661 -val fmz = ["equality (sqrt((x+a)^^^2+(x - 2*b)^^^2)=a+2*b)",
30.1662 - "solveFor x","solutions L"];
30.1663 -val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
30.1664 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.1665 -(*val nxt = ("Model_Problem",Model_Problem ["sq","root","univariate","equation"]) *)
30.1666 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1667 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1668 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1669 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1670 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1671 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1672 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1673 -(* val nxt = ("Model_Problem",
30.1674 - Model_Problem ["normalize","polynomial","univariate","equation"])*)
30.1675 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1676 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1677 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1678 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1679 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1680 -if f = Form'
30.1681 - (FormKF
30.1682 - (~1,
30.1683 - EdUndef,
30.1684 - 0,
30.1685 - Nundef,
30.1686 - "-4 * a * b + (-4 * b + 2 * a) * x + 2 * x ^^^ 2 = 0")) then ()
30.1687 -else raise error "rlang.sml: diff.behav. in Schalk II s.68 Bsp 62b";
30.1688 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1689 -(*val nxt = ("Model_Problem", Model_Problem
30.1690 - ["abcFormula","degree_2","polynomial","univariate","equation"])*)
30.1691 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1692 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1693 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1694 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1695 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1696 -(*val f = ... "-4 * a * b + (-4 * b + 2 * a) * x + 2 * x ^^^ 2 = 0" *)
30.1697 -(*val nxt = ("Rewrite_Set_Inst",Rewrite_Set_Inst ([#],"d2_polyeq_abcFormula_simplify"))*)
30.1698 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1699 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1700 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1701 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1702 -(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt;introduc.MGs norm_Rational*)
30.1703 -if f = Form' (FormKF (~1,EdUndef,0,Nundef,
30.1704 - "[x = (-2 * a + 4 * b + sqrt (16 * a * b + 16 * b ^^^ 2 + 4 * a ^^^ 2)) / 4,\n x =\n (-2 * a + 4 * b + -1 * sqrt (16 * a * b + 16 * b ^^^ 2 + 4 * a ^^^ 2)) / 4]")) then writeln "simplify MG"
30.1705 -else raise error "rlang.sml: diff.behav. in II 62b [x=...]";
30.1706 -val asms = get_assumptions_ pt p;
30.1707 -if asms = [(str2term"0 <= ((-2 * a + 4 * b + sqrt (16 * a * b + 16 * b ^^^ 2 + 4 * a ^^^ 2)) / 4 + a) ^^^ 2 + ((-2 * a + 4 * b + sqrt (16 * a * b + 16 * b ^^^ 2 + 4 * a ^^^ 2)) / 4 - 2 * b) ^^^ 2", []),
30.1708 - (str2term"0 <= a + 2 * b", []),
30.1709 - (str2term"8 * (-4 * a * b) <= (-4 * b + 2 * a) ^^^ 2", []),
30.1710 - (str2term"8 * (-4 * a * b) <= (-4 * b + 2 * a) ^^^ 2", []),
30.1711 - (str2term"0 <= ((-2 * a + 4 * b + -1 * sqrt (16 * a * b + 16 * b ^^^ 2 + 4 * a ^^^ 2)) / 4 + a) ^^^ 2 + ((-2 * a + 4 * b + -1 * sqrt (16 * a * b + 16 * b ^^^ 2 + 4 * a ^^^ 2)) / 4 - 2 * b) ^^^ 2", []),
30.1712 - (str2term"0 <= a + 2 * b", []),
30.1713 - (str2term"8 * (-4 * a * b) <= (-4 * b + 2 * a) ^^^ 2", []),
30.1714 - (str2term"8 * (-4 * a * b) <= (-4 * b + 2 * a) ^^^ 2", [])]
30.1715 -then writeln "should be simplified MG"
30.1716 -else raise error "rlang.sml: diff.behav. in II 62b asms";
30.1717 -
30.1718 -"------ WN.TEST---------------------------------";
30.1719 -"------ WN.TEST---------------------------------";
30.1720 -"------ WN.TEST---------------------------------";
30.1721 -(*EO-7*)
30.1722 -val fmz = ["equality ((2*x+1)*x^^^2 = 0)",
30.1723 - "solveFor x","solutions L"];
30.1724 -val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
30.1725 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.1726 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1727 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1728 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1729 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1730 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1731 -(*
30.1732 -val f = Form' (FormKF (~1,EdUndef,1,Nundef,"(2 * x + 1) * x ^^^ 2 = 0"))
30.1733 -normiert nicht ... korr.WN:
30.1734 -val t = str2term "(2*x+1)*x^^^2 = 0";
30.1735 -val subst = [(str2term "bdv", str2term "x")];
30.1736 -val SOME (t',_) = rewrite_set_inst_ thy false subst make_ratpoly_in t;
30.1737 -if term2str t' = "x ^^^ 2 + 2 * x ^^^ 3 = 0" then ()
30.1738 -else raise error "rlang.sml: 7";
30.1739 -*)
30.1740 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1741 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1742 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1743 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1744 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1745 -
30.1746 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1747 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1748 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1749 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1750 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.1751 -if f = Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 0, x = 0, x = -1 / 2]")) then()
30.1752 -else raise error "rlang.sml WN.TEST new behaviour";
30.1753 -
30.1754 -"------ rlang.sml end---------------------------------";
30.1755 -
30.1756 -(*------------------------------vvv-Rewrite_Set "rat_eliminate"---------
30.1757 -> trace_rewrite:=true;
30.1758 -> val t = str2term
30.1759 - "(3 + -1 * x + 1 * x ^^^ 2) / (9 * x + -6 * x ^^^ 2 + 1 * x ^^^ 3) = 1 / x";
30.1760 -> val SOME (t',asm) =
30.1761 - rewrite_ thy dummy_ord rateq_erls true rat_mult_denominator_both t;
30.1762 -> term2str t'; terms2str asm;
30.1763 -"(3 + -1 * x + 1 * x ^^^ 2) * x = 1 * (9 * x + -6 * x ^^^ 2 + 1 * x ^^^ 3)"
30.1764 -"[\"9 * x + -6 * x ^^^ 2 + 1 * x ^^^ 3 ~= 0\",\"x ~= 0\"]"
30.1765 -> trace_rewrite:=false;
30.1766 - ------------------------------^^^-Rewrite_Set "rat_eliminate"---------*)
30.1767 -
30.1768 -
30.1769 -"-------------------- WN.15.5.03: Pythagoras -------------------------------";
30.1770 -"-------------------- WN.15.5.03: Pythagoras -------------------------------";
30.1771 -"-------------------- WN.15.5.03: Pythagoras -------------------------------";
30.1772 -(*EO-9*)
30.1773 -val fmz = ["equality ((a/2)^^^2 + (b/2)^^^2 = r^^^2)",
30.1774 - "solveFor a","solutions L"];
30.1775 -val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
30.1776 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.1777 -(* Model_Problem ["normalize","polynomial","univariate","equation"])*)
30.1778 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1779 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1780 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1781 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1782 -(*val nxt = ("Apply_Method",Apply_Method ["PolyEq","normalize_poly"])*)
30.1783 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1784 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1785 -(*val nxt = Subproblem ("PolyEq.thy",["polynomial","univariate","equation"])*)
30.1786 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1787 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1788 -(*val nxt =Model_Problem ["sq_only","degree_2","polynomial","univariate","equation"])*)
30.1789 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1790 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1791 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1792 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1793 -(*val nxt = Apply_Method ["PolyEq","solve_d2_polyeq_sqonly_equation"])*)
30.1794 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1795 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1796 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1797 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1798 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1799 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1800 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1801 -if f = Form' (FormKF (~1,EdUndef,0,Nundef,
30.1802 -"[a = sqrt ((-1 * b ^^^ 2 + 4 * r ^^^ 2) / 1),\n a = -1 * sqrt ((-1 * b ^^^ 2 + 4 * r ^^^ 2) / 1)]")) andalso nxt = ("End_Proof'",End_Proof')
30.1803 -then writeln"simplify result\nsimplify result\nsimplify result"
30.1804 -else raise error "rlang.sml: diff.behav. in Pythagoras";
30.1805 -val asms = get_assumptions_ pt p;
30.1806 -(*if asms = [(str2term"0 <= -4 * (b ^^^ 2 / 4 + -4 * r ^^^ 2 / 4)", []),
30.1807 - (str2term"0 <= -4 * (b ^^^ 2 / 4 + -4 * r ^^^ 2 / 4)", [])]*)
30.1808 -if asms2str asms =
30.1809 - "[(0 <= -4 * (b ^^^ 2 / 4 + -1 * r ^^^ 2 / 1), []),\
30.1810 - \(0 <= -4 * (b ^^^ 2 / 4 + -1 * r ^^^ 2 / 1), [])]"
30.1811 -then writeln"simplify result\nsimplify result\nsimplify result"
30.1812 -else raise error "rlang.sml: diff.behav. in Pythagoras asms";
30.1813 -
30.1814 -
30.1815 -"-------------------- WN.15.5.03: equation within the maximum example ------";
30.1816 -"-------------------- WN.15.5.03: equation within the maximum example ------";
30.1817 -"-------------------- WN.15.5.03: equation within the maximum example ------";
30.1818 -(*EO-10*)
30.1819 -val fmz = ["equality (2*sqrt(r^^^2 - (u/2)^^^2) - u^^^2/(2*sqrt(r^^^2 - (u/2)^^^2))= 0)",
30.1820 - "solveFor u","solutions L"];
30.1821 -val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
30.1822 -
30.1823 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
30.1824 -(* Model_Problem ["normalize","root","univariate","equation"])*)
30.1825 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1826 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1827 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1828 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1829 -(*val nxt = Apply_Method ["RootEq","norm_sq_root_equation"]) *)
30.1830 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1831 -(*val nxt = Subproblem ("RootEq.thy",["univariate","equation"]))*)
30.1832 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1833 -(*val nxt = Model_Problem ["sq","root","univariate","equation"]) *)
30.1834 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1835 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1836 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1837 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1838 -(*val nxt = Apply_Method ["RootEq","solve_sq_root_equation"]) *)
30.1839 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1840 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1841 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1842 -(*val nxt = Subproblem ("RootEq.thy",["univariate","equation"]))*)
30.1843 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1844 -(*val nxt = Model_Problem ["rational","univariate","equation"]) *)
30.1845 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1846 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1847 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1848 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1849 -(*val nxt = Apply_Method ["RootEq","solve_rat_equation"]) *)
30.1850 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1851 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1852 -(*val nxt = Subproblem ("RootEq.thy",["univariate","equation"]))*)
30.1853 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1854 -(*val nxt = Model_Problem ["normalize","polynomial","univariate","equation"]) *)
30.1855 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1856 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1857 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1858 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1859 -(*val nxt = Apply_Method ["PolyEq","normalize_poly"]) *)
30.1860 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1861 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1862 -(*val nxt = Subproblem ("PolyEq.thy",["polynomial","univariate","equation"]))*)
30.1863 -if f = Form'
30.1864 - (FormKF
30.1865 - (~1,
30.1866 - EdUndef,
30.1867 - 0,
30.1868 - Nundef,
30.1869 - "-16 * r ^^^ 4 + 8 * r ^^^ 2 * u ^^^ 2 = 0")) then ()
30.1870 -else raise error "rlang.sml: diff.behav. in Schalk I s.87 Bsp 38b";
30.1871 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1872 -(*val nxt = Model_Problem ["sq_only","degree_2","polynomial","univariate","equation"]) *)
30.1873 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1874 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1875 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1876 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1877 -(*val nxt = Apply_Method ["PolyEq","solve_d2_polyeq_sqonly_equation"]) *)
30.1878 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1879 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1880 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1881 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1882 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1883 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1884 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
30.1885 -if f = Form' (FormKF (~1,EdUndef,0,Nundef,"[u = sqrt (2 * r ^^^ 2 / 1), u = -1 * sqrt (2 * r ^^^ 2 / 1)]")) then()
30.1886 -else raise error "rlang.sml WN.TEST new behaviour in max-rooteq";
31.1 --- a/test/Tools/isac/IsacKnowledge/root.sml Mon Aug 30 14:29:49 2010 +0200
31.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
31.3 @@ -1,15 +0,0 @@
31.4 -(* testexamples for Root, radicals
31.5 - *)
31.6 -
31.7 -val thy = Root.thy;
31.8 -
31.9 -val t = str2term "sqrt 1";
31.10 -val SOME (t',_) = rewrite_set_ thy false Root_erls t;
31.11 -if term2str t' = "1" then () else raise error "root.sml: diff.behav. sqrt 1";
31.12 -val t = str2term "sqrt -1";
31.13 -val NONE = rewrite_set_ thy false Root_erls t;
31.14 -
31.15 -val t = str2term "sqrt 0";
31.16 -val SOME (t',_) = rewrite_set_ thy false Root_erls t;
31.17 -term2str t';
31.18 -if term2str t' = "0" then () else raise error "root.sml: diff.behav. sqrt 1";
32.1 --- a/test/Tools/isac/IsacKnowledge/rooteq.sml Mon Aug 30 14:29:49 2010 +0200
32.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
32.3 @@ -1,470 +0,0 @@
32.4 -(* RL 10.02
32.5 - use"../kbtest/rooteq.sml";
32.6 - use"rooteq.sml";
32.7 - testexamples for RootEq, equations with fractions
32.8 -
32.9 - Compiler.Control.Print.printDepth:=10; (*4 default*)
32.10 - Compiler.Control.Print.printDepth:=5; (*4 default*)
32.11 - trace_rewrite:=true;
32.12 -*)
32.13 -"----------- rooteq.sml begin--------";
32.14 -"--------------(1/sqrt(x)=5)---------------------------------------";
32.15 -"--------------(4*sqrt(4*x+2)=3*sqrt(2*x+24))----------------------";
32.16 -"--------------(sqrt(x+1)=5)---------------------------------------";
32.17 -"--------------(sqrt(x+1)+sqrt(4*x+4)=sqrt(9*x+9))-----------------";
32.18 -"--------------(3*sqrt(x+3)+sqrt(x+6)=sqrt(4*x+33))----------------";
32.19 -"--------------(sqrt(x+1)+sqrt(4*x+4)=sqrt(9*x+9))-----------------";
32.20 -
32.21 -val t = (term_of o the o (parse RootEq.thy)) "(sqrt(2+x+3)) is_rootTerm_in x";
32.22 -val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
32.23 -val result = term2str t_;
32.24 -if result <> "True" then raise error "rooteq.sml: new behaviour:" else ();
32.25 -
32.26 -val t = (term_of o the o (parse RootEq.thy)) "(sqrt(2+x+3)) is_rootTerm_in x";
32.27 -val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
32.28 -val result = term2str t_;
32.29 -if result <> "True" then raise error "rooteq.sml: new behaviour:" else ();
32.30 -
32.31 -val t = (term_of o the o (parse RootEq.thy)) "(nroot 5 (x+4)) is_rootTerm_in x";
32.32 -val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
32.33 -val result = term2str t_;
32.34 -if result <> "True" then raise error "rooteq.sml: new behaviour:" else ();
32.35 -
32.36 -val t = (term_of o the o (parse RootEq.thy)) "(sqrt(2+x+3)) is_sqrtTerm_in x";
32.37 -val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
32.38 -val result = term2str t_;
32.39 -if result <> "True" then raise error "rooteq.sml: new behaviour:" else ();
32.40 -
32.41 -val t = (term_of o the o (parse RootEq.thy)) "(sqrt(25)) is_sqrtTerm_in x";
32.42 -val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
32.43 -val result = term2str t_;
32.44 -if result <> "False" then raise error "rooteq.sml: new behaviour:" else ();
32.45 -
32.46 -val t = (term_of o the o (parse RootEq.thy)) "sqrt(1 + x) is_normSqrtTerm_in x";
32.47 -val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
32.48 -val result = term2str t_;
32.49 -if result <> "True" then raise error "rooteq.sml: new behaviour:" else ();
32.50 -
32.51 -val t = (term_of o the o (parse RootEq.thy)) "(3+3*sqrt(x)) is_normSqrtTerm_in x";
32.52 -val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
32.53 -val result = term2str t_;
32.54 -if result <> "True" then raise error "rooteq.sml: new behaviour:" else ();
32.55 -
32.56 -val t = (term_of o the o (parse RootEq.thy)) "(sqrt(x+1)+1) is_normSqrtTerm_in x";
32.57 -val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
32.58 -val result = term2str t_;
32.59 -if result <> "False" then raise error "rooteq.sml: new behaviour:" else ();
32.60 -
32.61 -val t = (term_of o the o (parse RootEq.thy)) "(1 - u/(sqrt(r - u))) is_normSqrtTerm_in u";
32.62 -val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
32.63 -val result = term2str t_;
32.64 -if result <> "False" then raise error "rooteq.sml: new behaviour:" else ();
32.65 -
32.66 -val t = (term_of o the o (parse RootEq.thy)) "(x*(1+x)/(sqrt(x+1))) is_normSqrtTerm_in x";
32.67 -val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
32.68 -val result = term2str t_;
32.69 -if result <> "True" then raise error "rooteq.sml: new behaviour:" else ();
32.70 -
32.71 -val t = (term_of o the o (parse RootEq.thy)) "(1 - (sqrt(2+x+3)^^^3)) is_normSqrtTerm_in x";
32.72 -val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
32.73 -val result = term2str t_;
32.74 -if result <> "False" then raise error "rooteq.sml: new behaviour:" else ();
32.75 -
32.76 -val t = (term_of o the o (parse RootEq.thy)) "(1 + (sqrt(2+x+3)^^^3)) is_normSqrtTerm_in x";
32.77 -val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
32.78 -val result = term2str t_;
32.79 -if result <> "True" then raise error "rooteq.sml: new behaviour:" else ();
32.80 -
32.81 -
32.82 -
32.83 -val result = match_pbl ["equality (sqrt(x)=1)","solveFor x","solutions L"]
32.84 - (get_pbt ["root","univariate","equation"]);
32.85 -case result of Matches' _ => () | _ => raise error "rooteq.sml: new behaviour:";
32.86 -
32.87 -val result = match_pbl ["equality (sqrt(25)=1)","solveFor x","solutions L"]
32.88 - (get_pbt ["root","univariate","equation"]);
32.89 -case result of NoMatch' _ => () | _ => raise error "rooteq.sml: new behaviour:";
32.90 -
32.91 -(*---------rooteq---- 23.8.02 ---------------------*)
32.92 -"---------(1/sqrt(x)=5)---------------------";
32.93 -val fmz = ["equality (1/sqrt(x)=5)","solveFor x","solutions L"];
32.94 -val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
32.95 -
32.96 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.97 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.98 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.99 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.100 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.101 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.102 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.103 -(*"1 / x = 25" -> Subproblem ("RootEq.thy", ["univariate", ...]) *)
32.104 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.105 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.106 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.107 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.108 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.109 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.110 -(*"1 = 25 * x" -> Subproblem ("RatEq.thy", ["univariate", ...])*)
32.111 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.112 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.113 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.114 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.115 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.116 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.117 -if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "1 + -25 * x = 0")) then ()
32.118 -else raise error "rooteq.sml: diff.behav.poly in (1/sqrt(x)=5)";
32.119 -(*-> Subproblem ("PolyEq.thy", ["polynomial", ...])*)
32.120 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.121 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.122 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.123 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.124 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.125 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.126 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.127 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.128 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.129 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.130 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.131 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 1 / 25]")) => ()
32.132 - | _ => raise error "rooteq.sml: diff.behav. [x = 1 / 25]";
32.133 -if asms2str (get_assumptions_ pt p) = "[(0 <= 1 / 25, [])]"
32.134 -(*WN050916 before correction 'rewrite__set_ called with 'Erls' for ..:
32.135 - [(str2term"25 ~= 0",[])] *)
32.136 -then writeln "should be True\n\
32.137 - \should be True\n\
32.138 - \should be True\n"
32.139 -else raise error "rooteq.sml: diff.behav. with 25 ~= 0";
32.140 -
32.141 -"---------(sqrt(x+1)=5)---------------------";
32.142 -val fmz = ["equality (sqrt(x+1)=5)","solveFor x","solutions L"];
32.143 -val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
32.144 -(*val p = e_pos';
32.145 -val c = [];
32.146 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
32.147 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
32.148 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.149 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.150 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.151 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.152 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.153 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.154 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.155 -(*-> Subproblem ("RootEq.thy", ["univariate", ...])*)
32.156 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.157 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.158 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.159 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.160 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.161 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.162 -if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "-24 + x = 0")) then ()
32.163 -else raise error "rooteq.sml: diff.behav.poly in sqrt(x+1)=5";
32.164 -(*-> Subproblem ("PolyEq.thy", ["polynomial", ...])*)
32.165 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.166 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.167 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.168 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.169 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.170 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.171 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.172 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.173 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.174 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 24]")) => ()
32.175 - | _ => raise error "rooteq.sml: diff.behav. [x = 24]";
32.176 -
32.177 -"-------------(4*sqrt(4*x+2)=3*sqrt(2*x+24))-----------------";
32.178 -val fmz = ["equality (4*sqrt(4*x+2)=3*sqrt(2*x+24))","solveFor x","solutions L"];
32.179 -val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
32.180 -
32.181 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.182 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.183 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.184 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.185 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.186 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.187 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.188 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.189 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.190 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.191 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.192 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.193 -if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "-184 + 46 * x = 0")) then ()
32.194 -else raise error "rooteq.sml: diff.behav.poly in 4*sqrt(4*x+2)=3*sqrt(2*x+24)";
32.195 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.196 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.197 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.198 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.199 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.200 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.201 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.202 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.203 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
32.204 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 4]")) => ()
32.205 - | _ => raise error "rooteq.sml: diff.behav. [x = 4]";
32.206 -if get_assumptions_ pt p = [(str2term"0 <= 12 * sqrt 2 * 4",[])]
32.207 -then writeln "should be True\nshould be True\nshould be True\n\
32.208 - \should be True\nshould be True\nshould be True\n"
32.209 -else raise error "rooteq.sml: diff.behav. with 0 <= 12 * sqrt 2 * 4";
32.210 -
32.211 -"--------------(sqrt(x+1)+sqrt(4*x+4)=sqrt(9*x+9))----------------";
32.212 -val fmz = ["equality (sqrt(x+1)+sqrt(4*x+4)=sqrt(9*x+9))","solveFor x","solutions L"];
32.213 -val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
32.214 -
32.215 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.216 -(*val nxt = Model_Problem ["sq","root","univariate","equation"]) *)
32.217 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.218 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.219 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.220 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.221 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.222 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.223 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.224 -(*"13 + 13 * x + -2 * sqrt ((4 + 4 * x) * (9 + 9 * x)) = 1 + x"))
32.225 -val nxt = ("Subproblem",Subproblem ("RootEq.thy",["univariate","equation"]))*)
32.226 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.227 -(*val nxt = Model_Problem ["sq","root","univariate","equation"]) *)
32.228 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.229 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.230 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.231 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.232 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.233 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.234 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.235 -(*"144 + 288 * x + 144 * x ^^^ 2 = 144 + x ^^^ 2 + 288 * x + 143 * x ^^^ 2"))
32.236 -val nxt = ("Subproblem",Subproblem ("RootEq.thy",["univariate","equation"]))*)
32.237 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.238 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.239 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.240 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.241 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.242 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.243 -if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "0 = 0")) then ()
32.244 -else raise error "rooteq.sml: diff.behav.poly in (sqrt(x+1)+sqrt(4*x+4)=sqr..";
32.245 -(*-> Subproblem ("PolyEq.thy", ["degree_0", ...])*)
32.246 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.247 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.248 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.249 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.250 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.251 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.252 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.253 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.254 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.255 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.256 -val asm = get_assumptions_ pt p;
32.257 -if f = Form' (FormKF (~1,EdUndef,0,Nundef,"UniversalList")) andalso asm = []
32.258 -then () else raise error "rooteq.sml: diff.behav. in UniversalList 1";
32.259 -
32.260 -
32.261 -
32.262 -"--------------(sqrt(x+1)+sqrt(4*x+4)=sqrt(9*x+9))---------- SUBPBL.2.------";
32.263 -val fmz =
32.264 - ["equality (13 + 13 * x + -2 * sqrt ((4 + 4 * x) * (9 + 9 * x)) = 1 + x)",
32.265 - "solveFor x","solutions L"];
32.266 -val (dI',pI',mI') = ("RootEq.thy",["sq","root","univariate","equation"],
32.267 - ["RootEq","solve_sq_root_equation"]);
32.268 -(*val p = e_pos'; val c = [];
32.269 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
32.270 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
32.271 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.272 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.273 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.274 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.275 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.276 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.277 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.278 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.279 -(*"144 + 288 * x + 144 * x ^^^ 2 = 144 + x ^^^ 2 + 288 * x + 143 * x ^^^ 2"))
32.280 -val nxt = ("Subproblem",Subproblem ("RootEq.thy",["univariate","equation"])) *)
32.281 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.282 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.283 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.284 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.285 -(*val p = ([6],Pbl)val nxt = Specify_Method ["PolyEq","normalize_poly"])*)
32.286 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.287 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.288 -(*val p = ([6,2],Res) val f = Form' (FormKF (~1,EdUndef,2,Nundef,"0 = 0"))
32.289 -val nxt = Subproblem ("PolyEq.thy",["polynomial","univariate","equation"]))*)
32.290 -if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "0 = 0")) then ()
32.291 -else raise error "rooteq.sml: diff.behav.poly in sqrt(x+1)+sqrt(4*x+4)=sqrt..";
32.292 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.293 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.294 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.295 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.296 -(*val nxt = Specify_Method ["PolyEq","solve_d0_polyeq_equation"]) *)
32.297 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.298 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.299 -(*val p = ([6,3,1],Res) val f = Form' (FormKF (~1,EdUndef,3,Nundef,"True"))
32.300 -val nxt = ("Or_to_List",Or_to_List) : string * tac*)
32.301 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.302 -(*val p = ([6,3,2],Res) val f = (~1,EdUndef,3,Nundef,"UniversalList"))
32.303 -val nxt = Check_Postcond ["degree_0","polynomial","univariate","equation"])*)
32.304 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.305 -(*val p = ([6,3],Res) val f =(~1,EdUndef,2,Nundef,"UniversalList"))
32.306 -val nxt = Check_Postcond ["normalize","polynomial","univariate","equation"])*)
32.307 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.308 -if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "UniversalList")) then ()
32.309 -else raise error "rooteq.sml: diff.behav.poly in sqrt(x+1)+sqrt(4*x+4)=sqrt..";
32.310 -(* val Form' (FormKF (~1, EdUndef, 0, Nundef, str)) = f;
32.311 - *)
32.312 -
32.313 -(*same error as full expl #######*)
32.314 -
32.315 -"--------------(sqrt(x+1)+sqrt(4*x+4)=sqrt(9*x+9))---------- OKversion----";
32.316 -val fmz = ["equality (sqrt(x) = 1)","solveFor x","solutions L"];
32.317 -val (dI',pI',mI') = ("RootEq.thy",["sq","root","univariate","equation"],
32.318 - ["RootEq","solve_sq_root_equation"]);
32.319 -(*val p = e_pos'; val c = [];
32.320 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
32.321 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
32.322 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.323 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.324 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.325 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.326 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.327 -(*val p = ([],Pbl)val nxt = Specify_Method ["RootEq","solve_sq_root_equation"*)
32.328 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.329 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.330 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.331 -(* val p = ([2],Res) val f = Form' (FormKF (~1,EdUndef,1,Nundef,"x = 1"))
32.332 -val nxt = ("Subproblem",Subproblem ("RootEq.thy",["univariate","equation"]))*)
32.333 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.334 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.335 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.336 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.337 -(*val nxt = ("Specify_Method",Specify_Method ["PolyEq","normalize_poly"])*)
32.338 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.339 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.340 -(*val p = ([3,2],Res)val f = Form' (FormKF (~1,EdUndef,2,Nundef,"-1 + x = 0"))
32.341 -val nxt = Subproblem ("PolyEq.thy",["polynomial","univariate","equation"]))*)
32.342 -if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "-1 + x = 0")) then ()
32.343 -else raise error "rooteq.sml: diff.behav.poly in sqrt(x+1)+sqrt(4*x+4)=sqrt..";
32.344 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.345 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.346 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.347 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.348 -(*val nxt = Specify_Method ["PolyEq","solve_d1_polyeq_equation"]) *)
32.349 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.350 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.351 -(*val p = ([3,3,2],Res) val f = Form' (FormKF (~1,EdUndef,3,Nundef,"x = 1"))
32.352 -val nxt = ("Or_to_List",Or_to_List) *)
32.353 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.354 -(*val p = ([3,3,3],Res) val f = Form' (FormKF (~1,EdUndef,3,Nundef,"[x = 1]"))
32.355 -val nxt = ("Check_elementwise",Check_elementwise "Assumptions")*)
32.356 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.357 -(*val p = ([3,3,4],Res) val f = Form' (FormKF (~1,EdUndef,3,Nundef,"[x = 1]"))
32.358 -val nxt = Check_Postcond ["degree_1","polynomial","univariate","equation"])*)
32.359 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.360 -(*val p = ([3,3],Res) val f = Form' (FormKF (~1,EdUndef,2,Nundef,"[x = 1]"))
32.361 -val nxt = Check_Postcond ["normalize","polynomial","univariate","equation"])*)
32.362 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.363 -
32.364 -(*val p = ([3],Res) val f = Form' (FormKF (~1,EdUndef,1,Nundef,"[x = 1]"))
32.365 -val nxt = ("Check_elementwise",Check_elementwise "Assumptions")
32.366 - --------------------------------*)
32.367 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.368 -(*val p = ([4],Res) val f = Form' (FormKF (~1,EdUndef,1,Nundef,"[x = 1]"))
32.369 -val nxt = Check_Postcond ["sq","root","univariate","equation"]) *)
32.370 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.371 -if p = ([],Res) andalso f = Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 1]"))
32.372 -then () else raise error "diff.behav. in rooteq.sml: sqrt(x) = 1";
32.373 -
32.374 -
32.375 -"--------------(sqrt(x+1)+sqrt(4*x+4)=sqrt(9*x+9))---------- SHORTEST.1.----\
32.376 -\ with same error";
32.377 -val fmz = ["equality (sqrt x = sqrt x)","solveFor x","solutions L"];
32.378 -val (dI',pI',mI') = ("RootEq.thy",["sq","root","univariate","equation"],
32.379 - ["RootEq","solve_sq_root_equation"]);
32.380 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.381 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.382 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.383 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.384 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.385 -(*val p = ([],Pbl)val nxt = Specify_Method ["RootEq","solve_sq_root_equation"*)
32.386 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.387 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.388 -(*val p = ([1],Res) val f = Form' (FormKF (~1,EdUndef,1,Nundef,"x = x"))
32.389 -val nxt = ("Subproblem",Subproblem ("RootEq.thy",["univariate","equation"]))*)
32.390 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.391 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.392 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.393 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.394 -(*val p = ([2],Pbl) val nxt = Specify_Method ["PolyEq","normalize_poly"])*)
32.395 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.396 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.397 -(*val p = ([2,2],Res) val f = Form' (FormKF (~1,EdUndef,2,Nundef,"0 = 0"))
32.398 -val nxt = Subproblem ("PolyEq.thy",["polynomial","univariate","equation"]))*)
32.399 -if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "0 = 0")) then ()
32.400 -else raise error "rooteq.sml: diff.behav.poly in sqrt(x+1)+sqrt(4*x+4)=sqrt..";
32.401 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.402 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.403 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.404 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.405 -(*val p = ([2,3],Pbl)nxt=Specify_Method ["PolyEq","solve_d0_polyeq_equation"]*)
32.406 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.407 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.408 -(*val p = ([2,3,2],Res) val f = (FormKF (~1,EdUndef,3,Nundef,"UniversalList"))
32.409 -val nxt = Check_Postcond ["degree_0","polynomial","univariate","equation"])*)
32.410 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.411 -(*val p = ([2,3],Res) val f = (FormKF (~1,EdUndef,2,Nundef,"UniversalList"))
32.412 -val nxt = Check_Postcond ["normalize","polynomial","univariate","equation"])*)
32.413 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.414 -(*val p = ([2],Res) val f = (FormKF (~1,EdUndef,1,Nundef,"UniversalList"))
32.415 -val nxt = Check_elementwise "Assumptions"*)
32.416 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.417 -(*val p = ([3],Res) val f = (FormKF (~1,EdUndef,1,Nundef,"UniversalList"))
32.418 -val nxt = Check_Postcond ["sq","root","univariate","equation"]) *)
32.419 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.420 -if p = ([],Res) andalso f = Form'(FormKF (~1,EdUndef,0,Nundef,"UniversalList"))
32.421 -then () else raise error "new behav. in rooteq.sml: sqrt x = sqrt x";
32.422 -
32.423 -
32.424 -"--------------(3*sqrt(x+3)+sqrt(x+6)=sqrt(4*x+33))----------------";
32.425 -val fmz = ["equality (3*sqrt(x+3)+sqrt(x+6)=sqrt(4*x+33))","solveFor x","solutions L"];
32.426 -val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
32.427 -
32.428 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.429 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.430 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.431 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.432 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.433 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.434 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.435 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.436 -(* "6 + x = 60 + 13 * x + -6 * sqrt ((3 + x) * (33 + 4 * x))")) : mout
32.437 -val nxt = ("Subproblem",Subproblem ("RootEq.thy",["univariate","equation"]))*)
32.438 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.439 -(*val nxt = Model_Problem ["sq","root","univariate","equation"]) *)
32.440 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.441 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.442 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.443 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.444 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.445 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.446 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.447 -(*"2916 + x ^^^ 2 + 1296 * x + 143 * x ^^^ 2 = 3564 + 1620 * x + 144 * x ^^^ 2"))
32.448 -val nxt = ("Subproblem",Subproblem ("RootEq.thy",["univariate","equation"]))*)
32.449 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.450 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.451 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.452 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.453 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.454 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.455 -if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "-648 + -324 * x = 0")) then ()
32.456 -else raise error "rooteq.sml: diff.behav.poly in 3*sqrt(x+3)+sqrt(x+6)=sqrt..";
32.457 -(*-> Subproblem ("PolyEq.thy", ["degree_1", ...])*)
32.458 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.459 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.460 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.461 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.462 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.463 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.464 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.465 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.466 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.467 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.468 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = -2]")) => ()
32.469 - | _ => raise error "rooteq.sml: diff.behav. [x = -2]";
32.470 -
32.471 -"----------- rooteq.sml end--------";
32.472 -
32.473 -
33.1 --- a/test/Tools/isac/IsacKnowledge/rootrateq.sml Mon Aug 30 14:29:49 2010 +0200
33.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
33.3 @@ -1,229 +0,0 @@
33.4 -(* testexamples for RootratEq, equations mixing fractions and roots
33.5 - use"rootrateq.sml";
33.6 - *)
33.7 -
33.8 -val thy = Isac.thy;
33.9 -
33.10 -"--------------------- tests on predicates -------------------------------";
33.11 -"--------------------- tests on predicates -------------------------------";
33.12 -"--------------------- tests on predicates -------------------------------";
33.13 -(*
33.14 - Compiler.Control.Print.printDepth:=5; (*4 default*)
33.15 - trace_rewrite:=true;
33.16 - trace_rewrite:=false;
33.17 -*)
33.18 -val t1 = (term_of o the o (parse thy)) "(-8 - sqrt(x) + x^^^2) is_rootRatAddTerm_in x";
33.19 -val SOME (t,_) = rewrite_set_ RootRatEq.thy false RootRatEq_prls t1;
33.20 -if (term2str t) = "False" then ()
33.21 - else raise error "rootrateq.sml: diff.behav. 1 in is_rootRatAddTerm_in";
33.22 -
33.23 -val t1 = (term_of o the o (parse thy)) "(1/x) is_rootRatAddTerm_in x";
33.24 -val SOME (t,_) = rewrite_set_ RootRatEq.thy false RootRatEq_prls t1;
33.25 -if (term2str t) = "False" then ()
33.26 - else raise error "rootrateq.sml: diff.behav. 2 in is_rootRatAddTerm_in";
33.27 -
33.28 -val t1 = (term_of o the o (parse thy)) "(1/sqrt(x)) is_rootRatAddTerm_in x";
33.29 -val SOME (t,_) = rewrite_set_ RootRatEq.thy false RootRatEq_prls t1;
33.30 -if (term2str t) = "False" then ()
33.31 - else raise error "rootrateq.sml: diff.behav. 3 in is_rootRatAddTerm_in";
33.32 -
33.33 -val t1 = (term_of o the o (parse thy)) "(1/(sqrt(x)+1)) is_rootRatAddTerm_in x";
33.34 -val SOME (t,_) = rewrite_set_ RootRatEq.thy false RootRatEq_prls t1;
33.35 -if (term2str t) = "True" then ()
33.36 - else raise error "rootrateq.sml: diff.behav. 4 in is_rootRatAddTerm_in";
33.37 -
33.38 -val t1 = (term_of o the o (parse thy)) "(3 + 1/(1+sqrt(x))) is_rootRatAddTerm_in x";
33.39 -val SOME (t,_) = rewrite_set_ RootRatEq.thy false RootRatEq_prls t1;
33.40 -if (term2str t) = "True" then ()
33.41 - else raise error "rootrateq.sml: diff.behav. 5 in is_rootRatAddTerm_in";
33.42 -
33.43 -val t1 = (term_of o the o (parse thy)) "(1/(1+sqrt(y)) + 3 + 1/(1+sqrt(x))) is_rootRatAddTerm_in x";
33.44 -val SOME (t,_) = rewrite_set_ RootRatEq.thy false RootRatEq_prls t1;
33.45 -if (term2str t) = "True" then ()
33.46 - else raise error "rootrateq.sml: diff.behav. 6 in is_rootRatAddTerm_in";
33.47 -
33.48 -val t1 = (term_of o the o (parse thy)) "(1/(1+sqrt(x)) + 3 + 1/(1+sqrt(y))) is_rootRatAddTerm_in x";
33.49 -val SOME (t,_) = rewrite_set_ RootRatEq.thy false RootRatEq_prls t1;
33.50 -if (term2str t) = "True" then ()
33.51 - else raise error "rootrateq.sml: diff.behav. 7 in is_rootRatAddTerm_in";
33.52 -
33.53 -
33.54 -"--------------------- test thm rootrat_equation_left_1 ---------------------";
33.55 -val fmz = ["equality ( -2 + 1/(1 - sqrt(x))= 0)", "solveFor x","solutions L"];
33.56 -val (dI',pI',mI') = ("RootRatEq.thy",["univariate","equation"],["no_met"]);
33.57 -
33.58 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
33.59 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.60 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.61 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.62 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.63 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.64 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.65 -(*-> Subproblem ("RootEq.thy", ["univariate", ...])*)
33.66 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.67 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.68 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.69 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.70 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.71 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.72 -(*-> Subproblem ("RootEq.thy", ["univariate", ...])*)
33.73 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.74 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.75 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.76 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.77 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.78 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.79 -(*-> Subproblem ("RootEq.thy", ["univariate", ...])*)
33.80 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.81 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.82 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.83 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.84 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.85 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.86 -if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "1 + -4 * x = 0")) then ()
33.87 -else raise error "rootrateq.sml: diff.behav. in rootrat_equation_left_1";
33.88 -(*-> Subproblem ("RootEq.thy", ["polynomial", ...])*)
33.89 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.90 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.91 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.92 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.93 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.94 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.95 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.96 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.97 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.98 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.99 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 1 / 4]")) => ()
33.100 - | _ => raise error "rootrateq.sml: diff.behav. in -2 + 1/(1 - sqrt(x))= 0 -> [x = 1/4]";
33.101 -
33.102 -"--------------------- test thm rootrat_equation_left_2 ---------------------";
33.103 -val fmz = ["equality (3/(1+sqrt(x))= 1)", "solveFor x","solutions L"];
33.104 -val (dI',pI',mI') = ("RootRatEq.thy",["univariate","equation"],["no_met"]);
33.105 -
33.106 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
33.107 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.108 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.109 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.110 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.111 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.112 -(*-> Subproblem ("RootEq.thy", ["univariate", ...])*)
33.113 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.114 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.115 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.116 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.117 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.118 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.119 -(*-> Subproblem ("RootEq.thy", ["univariate", ...])*)
33.120 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.121 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.122 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.123 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.124 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.125 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.126 -(*-> Subproblem ("RootEq.thy", ["univariate", ...])*)
33.127 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.128 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.129 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.130 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.131 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.132 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.133 -if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "4 + -1 * x = 0")) then ()
33.134 -else raise error "rootrateq.sml: diff.behav. in rootrat_equation_left_2";
33.135 -(*-> Subproblem ("PolyEq.thy", ["polynomial", ...])*)
33.136 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.137 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.138 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.139 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.140 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.141 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.142 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.143 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.144 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.145 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.146 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 4]")) => ()
33.147 - | _ => raise error "rootrateq.sml: diff.behav. in 3/(1+sqrt(x))= 1 -> [x = 4]";
33.148 -
33.149 -"--------------------- test thm rootrat_equation_right_1 ---------------";
33.150 -val fmz = ["equality ( 0= -2 + 1/(1 - sqrt(x)))", "solveFor x","solutions L"];
33.151 -val (dI',pI',mI') = ("RootRatEq.thy",["univariate","equation"],["no_met"]);
33.152 -
33.153 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
33.154 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.155 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.156 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.157 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.158 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.159 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.160 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.161 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.162 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.163 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.164 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.165 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.166 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.167 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.168 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.169 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.170 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.171 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.172 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.173 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.174 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.175 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.176 -if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "-1 + 4 * x = 0")) then ()
33.177 -else raise error "rootrateq.sml: diff.behav.ppoly in rootrat_equation_right_1";
33.178 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.179 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.180 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.181 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.182 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.183 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.184 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.185 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.186 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.187 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.188 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.189 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 1 / 4]")) => ()
33.190 - | _ => raise error "rootrateq.sml: diff.behav. in -2 + 1/(1 - sqrt(x))= 0 -> [x = 1/4]";
33.191 -
33.192 -"--------------------- test thm rootrat_equation_right_2 --------------------";
33.193 -val fmz = ["equality (1 = 3/(1+sqrt(x)))", "solveFor x","solutions L"];
33.194 -val (dI',pI',mI') = ("RootRatEq.thy",["univariate","equation"],["no_met"]);
33.195 -
33.196 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
33.197 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.198 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.199 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.200 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.201 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.202 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.203 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.204 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.205 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.206 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.207 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.208 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.209 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.210 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.211 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.212 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.213 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.214 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.215 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.216 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.217 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.218 -if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "-4 + x = 0")) then ()
33.219 -else raise error "rootrateq.sml: diff.behav. in rootrat_equation_right_2";
33.220 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.221 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.222 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.223 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.224 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.225 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.226 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.227 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.228 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.229 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.230 -val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
33.231 -case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 4]")) => ()
33.232 - | _ => raise error "rootrateq.sml: diff.behav. in 3/(1+sqrt(x))= 1 -> [x = 4]";
34.1 --- a/test/Tools/isac/IsacKnowledge/simplify.sml Mon Aug 30 14:29:49 2010 +0200
34.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
34.3 @@ -1,57 +0,0 @@
34.4 -(* tests on simplification
34.5 - author: Walther Neuper
34.6 - 061019
34.7 - (c) due to copyright terms
34.8 -
34.9 -use"../smltest/IsacKnowledge/simplify.sml";
34.10 -use"simplify.sml";
34.11 -*)
34.12 -val thy = Simplify.thy;
34.13 -
34.14 -"-----------------------------------------------------------------";
34.15 -"table of contents -----------------------------------------------";
34.16 -"-----------------------------------------------------------------";
34.17 -"----------- CAS-command Simplify --------------------------------";
34.18 -"----------- append inform with final result ---------------------";
34.19 -"-----------------------------------------------------------------";
34.20 -"-----------------------------------------------------------------";
34.21 -"-----------------------------------------------------------------";
34.22 -
34.23 -
34.24 -
34.25 -"----------- CAS-command Simplify --------------------------------";
34.26 -"----------- CAS-command Simplify --------------------------------";
34.27 -"----------- CAS-command Simplify --------------------------------";
34.28 -states:=[];
34.29 -CalcTree [([], ("e_domID", ["e_pblID"], ["e_metID"]))];
34.30 -Iterator 1;
34.31 -moveActiveRoot 1;
34.32 -replaceFormula 1 "Simplify (2*a + 3*a)";
34.33 -autoCalculate 1 (Step 1);
34.34 -autoCalculate 1 CompleteCalc;
34.35 -val ((pt,p),_) = get_calc 1;
34.36 -val Form res = (#1 o pt_extract) (pt, ([],Res));
34.37 -show_pt pt;
34.38 -if p = ([], Res) andalso term2str res = "5 * a" then ()
34.39 -else raise error "simplify.sml: diff.behav. CAScmd: Simplify (2*a + 3*a)";
34.40 -
34.41 -
34.42 -"----------- append inform with final result ---------------------";
34.43 -"----------- append inform with final result ---------------------";
34.44 -"----------- append inform with final result ---------------------";
34.45 -states:=[];
34.46 -CalcTree [(["term ((14 * x * y) / ( x * y ))", "normalform N"],
34.47 - ("Rational.thy",["rational","simplification"],
34.48 - ["simplification","of_rationals"]))];
34.49 -Iterator 1;
34.50 -moveActiveRoot 1;
34.51 -autoCalculate 1 CompleteCalcHead;
34.52 -autoCalculate 1 (Step 1);
34.53 -appendFormula 1 "14";
34.54 -val ((pt,p),_) = get_calc 1; show_pt pt;
34.55 -
34.56 -autoCalculate 1 (Step 1);
34.57 -val ((pt,p),_) = get_calc 1; show_pt pt;
34.58 -val Form res = (#1 o pt_extract) (pt, ([],Res));
34.59 -if p = ([], Res) andalso term2str res = "14" then ()
34.60 -else raise error "simplify.sml: append inform with final result ?!?";
35.1 --- a/test/Tools/isac/IsacKnowledge/system.sml Mon Aug 30 14:29:49 2010 +0200
35.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
35.3 @@ -1,103 +0,0 @@
35.4 -(* tests on systems of equations over the reals
35.5 - author: Walther Neuper 050905
35.6 - (c) due to copyright terms
35.7 -
35.8 -use"../smltest/IsacKnowledge/system.sml";
35.9 -*)
35.10 -val thy = EqSystem.thy;
35.11 -
35.12 -"-----------------------------------------------------------------";
35.13 -"table of contents -----------------------------------------------";
35.14 -"-----------------------------------------------------------------";
35.15 -"----------- normalize system ------------------------------------";
35.16 -"----------- me --------------------------------------------------";
35.17 -"-----------------------------------------------------------------";
35.18 -"-----------------------------------------------------------------";
35.19 -"-----------------------------------------------------------------";
35.20 -
35.21 -
35.22 -"----------- normalize system ------------------------------------";
35.23 -"----------- normalize system ------------------------------------";
35.24 -"----------- normalize system ------------------------------------";
35.25 -val t = str2term "[0 = c*0 + -1*q_0*(0^^^2 / 2) + c_2,\
35.26 - \ 0 = c*L + -1*q_0*(L^^^2 / 2) + c_2]";
35.27 -val SOME (t,_) = rewrite_set_ thy false norm_Poly t;
35.28 -if term2str t =
35.29 -"[0 = -1 * q_0 * (0 / 2) + c_2, 0 = L * c + -1 * q_0 * (L ^^^ 2 / 2) + c_2]"
35.30 -then () else raise error "system.sml, diff.behav. in norm_Poly";
35.31 -
35.32 -val t = str2term "[0 = c*0 + -1*q_0*(0^^^2 / 2) + c_2,\
35.33 - \ 0 = c*L + -1*q_0*(L^^^2 / 2) + c_2]";
35.34 -val SOME (t,_) = rewrite_set_ thy false norm_Rational t;
35.35 -if term2str t =
35.36 -"[0 = c_2, 0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2]"
35.37 -then () else raise error "system.sml, diff.behav. in norm_Rational";
35.38 -
35.39 -
35.40 -val t = str2term "nth_ 1 [0 = c*0 + -1*q_0*(0^^^2 / 2) + c_2,\
35.41 - \ 0 = c*L + -1*q_0*(L^^^2 / 2) + c_2]";
35.42 -val SOME (t,_) = rewrite_set_ thy false list_rls t;
35.43 -if term2str t = "0 = c * 0 + -1 * q_0 * (0 ^^^ 2 / 2) + c_2"
35.44 -then () else raise error "system.sml, list_rls";
35.45 -
35.46 -
35.47 -"----------- me --------------------------------------------------";
35.48 -"----------- me --------------------------------------------------";
35.49 -"----------- me --------------------------------------------------";
35.50 -val fmz = ["equalities [0 = c_2 + c * 0 + -1 * q_0 / 2 * 0 ^^^ 2, 0 = c_2 + c * L + -1 * q_0 / 2 * L ^^^ 2]",
35.51 - "solveForVars [c, c_2]", "solution ss___"];
35.52 -val (dI',pI',mI') =
35.53 - ("Biegelinie.thy",["normalize","2x2","linear","system"],
35.54 - ["EqSystem","normalize","2x2"]);
35.55 -val p = e_pos'; val c = [];
35.56 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
35.57 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
35.58 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
35.59 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
35.60 -case nxt of (_, Specify_Theory "Biegelinie.thy") => ()
35.61 - | _ => raise error "system.sml diff.behav.in me --1";
35.62 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
35.63 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
35.64 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
35.65 -case nxt of (_, Apply_Method ["EqSystem", "normalize", "2x2"]) => ()
35.66 - | _ => raise error "system.sml diff.behav.in me --2";
35.67 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
35.68 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
35.69 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
35.70 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
35.71 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
35.72 -
35.73 -case nxt of (_, Subproblem ("Biegelinie.thy", ["triangular", "2x2",
35.74 - "linear", "system"])) => ()
35.75 - | _ => raise error "system.sml diff.behav.in me --3";
35.76 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
35.77 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
35.78 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
35.79 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
35.80 -case nxt of (_, Specify_Theory "Biegelinie.thy") => ()
35.81 - | _ => raise error "system.sml diff.behav.in me --1";
35.82 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
35.83 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
35.84 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
35.85 -case nxt of (_, Apply_Method ["EqSystem", "normalize", "2x2"]) => ()
35.86 - | _ => raise error "system.sml diff.behav.in me --2";
35.87 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
35.88 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
35.89 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
35.90 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
35.91 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
35.92 -
35.93 -
35.94 -(*---
35.95 -WN060421 stopped as soon as exp_IsacCore_Equ_Sys_Lin_No-1.xml worked ...
35.96 -
35.97 -if f2str f = "" then ()
35.98 -else raise error "system.sml diff.behav.in me --99";
35.99 -case nxt of ("End_Proof'", End_Proof') => ()
35.100 - | _ => raise error "system.sml diff.behav.in me --99";
35.101 -
35.102 -print_depth 11;nxt;print_depth 3;
35.103 ----*)
35.104 -(*
35.105 -use"../smltest/IsacKnowledge/system.sml";
35.106 -*)
36.1 --- a/test/Tools/isac/IsacKnowledge/termorder.sml Mon Aug 30 14:29:49 2010 +0200
36.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
36.3 @@ -1,192 +0,0 @@
36.4 - (* tests on rewrite orders
36.5 - author Matthias Goldgruber 2003
36.6 -
36.7 - WN0509 do not use this file anymore, since orders require thy:
36.8 - do tests in the smltest/IsacKnowledge/file.sml
36.9 - where file.ML defines the respective order !
36.10 -
36.11 -use"../smltest/IsacKnowledge/termorder.sml";
36.12 -*)
36.13 -
36.14 -
36.15 - (*MK die ersten Tests*)
36.16 - val substa = [(e_term, (term_of o the o (parse thy)) "a")];
36.17 - val substb = [(e_term, (term_of o the o (parse thy)) "b")];
36.18 - val substx = [(e_term, (term_of o the o (parse thy)) "x")];
36.19 -
36.20 - val x1 = (term_of o the o (parse thy)) "a + b + x";
36.21 - val x2 = (term_of o the o (parse thy)) "a + x + b";
36.22 - val x3 = (term_of o the o (parse thy)) "a + x + b";
36.23 - val x4 = (term_of o the o (parse thy)) "x + a + b";
36.24 -
36.25 -if ord_make_polynomial_in true thy substx (x1,x2) = true(*LESS *) then ()
36.26 -else raise error "termorder.sml diff.behav ord_make_polynomial_in #1";
36.27 -
36.28 -if ord_make_polynomial_in true thy substa (x1,x2) = true(*LESS *) then ()
36.29 -else raise error "termorder.sml diff.behav ord_make_polynomial_in #2";
36.30 -
36.31 -if ord_make_polynomial_in true thy substb (x1,x2) = false(*GREATER*) then ()
36.32 -else raise error "termorder.sml diff.behav ord_make_polynomial_in #3";
36.33 -
36.34 - val aa = (term_of o the o (parse thy)) "-1 * a * x";
36.35 - val bb = (term_of o the o (parse thy)) "x^^^3";
36.36 - ord_make_polynomial_in true thy substx (aa, bb);
36.37 - true; (* => LESS *)
36.38 -
36.39 - val aa = (term_of o the o (parse thy)) "-1 * a * x";
36.40 - val bb = (term_of o the o (parse thy)) "x^^^3";
36.41 - ord_make_polynomial_in true thy substa (aa, bb);
36.42 - false; (* => GREATER *)
36.43 -
36.44 - (*und nach dem Re-engineering der Termorders in den 'rulesets'
36.45 - kannst Du die 'gr"osste' Variable frei w"ahlen: *)
36.46 - val bdv= (term_of o the o (parse thy)) "bdv";
36.47 - val x = (term_of o the o (parse thy)) "x";
36.48 - val a = (term_of o the o (parse thy)) "a";
36.49 - val b = (term_of o the o (parse thy)) "b";
36.50 - val SOME (t',_) =
36.51 - rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in x2;
36.52 -if term2str t' = "b + x + a" then ()
36.53 -else raise error "termorder.sml diff.behav ord_make_polynomial_in #11";
36.54 -
36.55 - val NONE =
36.56 - rewrite_set_inst_ thy false [(bdv,b)] make_polynomial_in x2;
36.57 - term2str t';
36.58 - "a + x + b";
36.59 -
36.60 - val SOME (t',_) =
36.61 - rewrite_set_inst_ thy false [(bdv,x)] make_polynomial_in x2;
36.62 -if term2str t' = "a + b + x" then ()
36.63 -else raise error "termorder.sml diff.behav ord_make_polynomial_in #13";
36.64 -
36.65 -
36.66 -
36.67 - val ppp' = "-6 + -5*x + x^^^3 + -1*x^^^2 + -1*x^^^3 + -14*x^^^2";
36.68 - val ppp = (term_of o the o (parse thy)) ppp';
36.69 - val SOME (t',_) =
36.70 - rewrite_set_inst_ thy false [(bdv,x)] make_polynomial_in ppp;
36.71 -(*MG 2003...
36.72 - term2str t';
36.73 - "(-6) + (-5 * x + (-15 * x ^^^ 2))";*)
36.74 -if term2str t' = "-6 + -5 * x + -15 * x ^^^ 2 + 0" then ()
36.75 -else raise error "termorder.sml diff.behav ord_make_polynomial_in #14";
36.76 -
36.77 - val SOME (t',_) =
36.78 - rewrite_set_inst "Isac.thy"false [("bdv","x")] "make_polynomial_in" ppp';
36.79 -(*MG 2003...
36.80 - "(-6) + (-5 * x + (-15) * x ^^^ 2)";*)
36.81 -if t' = "-6 + -5 * x + -15 * x ^^^ 2 + 0" then ()
36.82 -else raise error "termorder.sml diff.behav ord_make_polynomial_in #15";
36.83 -
36.84 - val ttt' = "(3*x + 5)/18";
36.85 - val ttt = (term_of o the o (parse thy)) ttt';
36.86 - val SOME (uuu,_) =
36.87 - rewrite_set_inst_ thy false [(bdv,x)] make_polynomial_in ttt;
36.88 -if term2str uuu = "(5 + 3 * x) / 18" then ()
36.89 -else raise error "termorder.sml diff.behav ord_make_polynomial_in #16";
36.90 -
36.91 - val SOME (uuu,_) =
36.92 - rewrite_set_ thy false make_polynomial ttt;
36.93 -if term2str uuu = "(5 + 3 * x) / 18" then ()
36.94 -else raise error "termorder.sml diff.behav ord_make_polynomial_in #16";
36.95 -
36.96 -
36.97 -
36.98 -
36.99 -(*-----------28.2.03: war nicht upgedatet (und ausgeklammert in ROOT.ML
36.100 -
36.101 - (*Aufgabe zum Einstieg in die Arbeit...*)
36.102 - val t = (term_of o the o (parse thy)) "a*b - (a+b)*x + x^^^2 = 0";
36.103 - (*ein 'ruleset' aus Poly.ML wird angewandt...*)
36.104 - val SOME (t,_) = rewrite_set_ thy Poly_erls false make_polynomial t;
36.105 - term2str t;
36.106 - "a * b + (-1 * (a * x) + (-1 * (b * x) + x ^^^ 2)) = 0";
36.107 - val SOME (t,_) =
36.108 - rewrite_set_inst_ thy Poly_erls false [("bdv","a")] make_polynomial_in t;
36.109 - term2str t;
36.110 - "x ^^^ 2 + (-1 * (b * x) + (-1 * (x * a) + b * a)) = 0";
36.111 -(* bei Verwendung von "size_of-term" nach MG :*)
36.112 -(*"x ^^^ 2 + (-1 * (b * x) + (b * a + -1 * (x * a))) = 0" !!! *)
36.113 -
36.114 - (*wir holen 'a' wieder aus der Klammerung heraus...*)
36.115 - val SOME (t,_) = rewrite_set_ thy Poly_erls false discard_parentheses t;
36.116 - term2str t;
36.117 - "x ^^^ 2 + -1 * b * x + -1 * x * a + b * a = 0";
36.118 -(* "x ^^^ 2 + -1 * b * x + b * a + -1 * x * a = 0" !!! *)
36.119 -
36.120 - val SOME (t,_) =
36.121 - rewrite_set_inst_ thy Poly_erls false [("bdv","a")] make_polynomial_in t;
36.122 - term2str t;
36.123 - "x ^^^ 2 + (-1 * (b * x) + a * (b + -1 * x)) = 0";
36.124 - (*da sind wir fast am Ziel: make_polynomial_in 'a' sollte ergeben
36.125 - "x ^^^ 2 + (-1 * (b * x)) + (b + -1 * x) * a = 0"*)
36.126 -
36.127 - (*das rewriting l"asst sich beobachten mit
36.128 - trace_rewrite:=true;
36.129 - *)
36.130 -
36.131 -
36.132 -
36.133 -"------15.11.02 --------------------------";
36.134 - val t = (term_of o the o (parse thy)) "1 + a * x + b * x";
36.135 - val bdv = (term_of o the o (parse thy)) "bdv";
36.136 - val a = (term_of o the o (parse thy)) "a";
36.137 -
36.138 - trace_rewrite:=true;
36.139 - (* Anwenden einer Regelmenge aus Termorder.ML: *)
36.140 - val SOME (t,_) =
36.141 - rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
36.142 - term2str t;
36.143 - val SOME (t,_) =
36.144 - rewrite_set_ thy false discard_parentheses t;
36.145 - term2str t;
36.146 -"1 + b * x + x * a";
36.147 -
36.148 - val t = (term_of o the o (parse thy)) "1 + a * (x + b * x) + a^^^2";
36.149 - val SOME (t,_) =
36.150 - rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
36.151 - term2str t;
36.152 - val SOME (t,_) =
36.153 - rewrite_set_ thy false discard_parentheses t;
36.154 - term2str t;
36.155 -"1 + (x + b * x) * a + a ^^^ 2";
36.156 -
36.157 - val t = (term_of o the o (parse thy)) "1 + a ^^^2 * x + b * a + 7*a^^^2";
36.158 - val SOME (t,_) =
36.159 - rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
36.160 - term2str t;
36.161 - val SOME (t,_) =
36.162 - rewrite_set_ thy false discard_parentheses t;
36.163 - term2str t;
36.164 -"1 + b * a + (7 + x) * a ^^^ 2";
36.165 -
36.166 -(* MG2003
36.167 - Atools.thy grundlegende Algebra
36.168 - Poly.thy Polynome
36.169 - Rational.thy Br"uche
36.170 - Root.thy Wurzeln
36.171 - RootRat.thy Wurzen + Br"uche
36.172 - Termorder.thy BITTE NUR HIERHER SCHREIBEN (...WN03)
36.173 -
36.174 - cd"knowledge";
36.175 - remove_thy"Termorder";
36.176 - use_thy"Isac";
36.177 -
36.178 - get_thm Termorder.thy "bdv_n_collect";
36.179 - get_thm Isac.thy "bdv_n_collect";
36.180 -
36.181 -*)
36.182 - val t = (term_of o the o (parse thy)) "a ^^^2 * x + 7 * a^^^2";
36.183 - val SOME (t,_) =
36.184 - rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
36.185 - term2str t;
36.186 - val SOME (t,_) =
36.187 - rewrite_set_ thy false discard_parentheses t;
36.188 - term2str t;
36.189 -"(7 + x) * a ^^^ 2";
36.190 -
36.191 - val t = (term_of o the o (parse Termorder.thy)) "Pi";
36.192 -
36.193 - val t = (term_of o the o (parseold thy)) "7";
36.194 -
36.195 -----------------------------------------------------------------------*)
37.1 --- a/test/Tools/isac/IsacKnowledge/trig.sml Mon Aug 30 14:29:49 2010 +0200
37.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
37.3 @@ -1,2 +0,0 @@
37.4 -(* testexamples for Trig, trigonometry
37.5 - *)
37.6 \ No newline at end of file
38.1 --- a/test/Tools/isac/IsacKnowledge/vect.sml Mon Aug 30 14:29:49 2010 +0200
38.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
38.3 @@ -1,2 +0,0 @@
38.4 -(* testexamples for Vect, vector spaces
38.5 - *)
38.6 \ No newline at end of file
39.1 --- a/test/Tools/isac/IsacKnowledge/wn.sml Mon Aug 30 14:29:49 2010 +0200
39.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
39.3 @@ -1,12 +0,0 @@
39.4 -(* use"kbtest/wn.sml";
39.5 - use"wn.sml";
39.6 -
39.7 - various test dependent on IsacKnowledge/ outside Test.thy, Test.ML*)
39.8 -
39.9 -
39.10 - val t = str2term "solve (a*x + b = c, x)";
39.11 - atomty t;
39.12 -(*
39.13 -"\n*** -------------"
39.14 -"\n*** Const ( Equation.solve, bool * real => bool list)"
39.15 -... ~~~~~ ~~~~~~~~*)
39.16 \ No newline at end of file
40.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
40.2 +++ b/test/Tools/isac/Knowledge/algein.sml Mon Aug 30 14:35:51 2010 +0200
40.3 @@ -0,0 +1,158 @@
40.4 +(* tests on AlgEin, Algebra Einf"uhrung, , Unterrichtsversuch IMST-Projekt
40.5 + author: Walther Neuper 2007
40.6 + (c) due to copyright terms
40.7 +
40.8 +use"../smltest/IsacKnowledge/algein.sml";
40.9 +use"algein.sml";
40.10 +*)
40.11 +val thy = AlgEin.thy;
40.12 +
40.13 +"-----------------------------------------------------------------";
40.14 +"table of contents -----------------------------------------------";
40.15 +"-----------------------------------------------------------------";
40.16 +"----------- build method 'Berechnung' 'erstSymbolisch' ----------";
40.17 +"----------- me 'Berechnung' 'erstNumerisch' ---------------------";
40.18 +"----------- auto 'Berechnung' 'erstSymbolisch' ------------------";
40.19 +"----------- Widerspruch 3 = 777 ---------------------------------";
40.20 +"-----------------------------------------------------------------";
40.21 +"-----------------------------------------------------------------";
40.22 +"-----------------------------------------------------------------";
40.23 +
40.24 +
40.25 +
40.26 +(* use"../smltest/IsacKnowledge/algein.sml";
40.27 + *)
40.28 +
40.29 +"----------- build method 'Berechnung' 'erstSymbolisch' ----------";
40.30 +"----------- build method 'Berechnung' 'erstSymbolisch' ----------";
40.31 +"----------- build method 'Berechnung' 'erstSymbolisch' ----------";
40.32 +val str =
40.33 +"Script RechnenSymbolScript (k_::bool) (q__::bool) \
40.34 +\(u_::bool list) (s_::bool list) (o_::bool list) (l_::real) =\
40.35 +\ (let t_ = (l_ = 1)\
40.36 +\ in t_)"
40.37 +;
40.38 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
40.39 +(*---^^^-OK-----------------------------------------------------------------*)
40.40 +val str =
40.41 +"Script RechnenSymbolScript (k_::bool) (q__::bool) \
40.42 +\(u_::bool list) (s_::bool list) (o_::bool list) (l_::real) =\
40.43 +\ (let t_ = Take (l_ = Oben + Senkrecht + Unten); \
40.44 +\ sum_ = boollist2sum o_;\
40.45 +\ t_ = Substitute [Oben = sum_] t_;\
40.46 +\ t_ = Substitute o_ t_;\
40.47 +\ t_ = Substitute [k_, q__] t_;\
40.48 +\ t_ = Repeat (Try (Rewrite_Set norm_Poly False)) t_\
40.49 +\ in t_)"
40.50 +;
40.51 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
40.52 +(*---vvv-NOTok--------------------------------------------------------------*)
40.53 +
40.54 +
40.55 +
40.56 +atomty sc;
40.57 +atomt sc;
40.58 +
40.59 +
40.60 +"----------- me 'Berechnung' 'erstNumerisch' ---------------------";
40.61 +"----------- me 'Berechnung' 'erstNumerisch' ---------------------";
40.62 +"----------- me 'Berechnung' 'erstNumerisch' ---------------------";
40.63 +val fmz =
40.64 + ["KantenLaenge (k=10)","Querschnitt (q=1)",
40.65 + "KantenUnten [b1 = k - 2*q, b2 = k - 2*q, b3 = k - 2*q, b4 = k - 2*q ]",
40.66 + "KantenSenkrecht [v1 = k, v2 = k, v3 = k, v4 = k]",
40.67 + "KantenOben [t1 = k - 2*q, t2 = k - 2*q, t3 = k - 2*q, t4 = k - 2*q ]",
40.68 + "GesamtLaenge L"];
40.69 +val (dI',pI',mI') =
40.70 + ("Isac.thy",["numerischSymbolische", "Berechnung"],
40.71 + ["Berechnung","erstNumerisch"]);
40.72 +val p = e_pos'; val c = [];
40.73 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))](*nxt = ("Model_Pr*);
40.74 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "KantenLaenge (k = 10)"*);
40.75 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "Querschnitt (q = 1)"*);
40.76 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "KantenUnten [b1 = k - 2*q]"*);
40.77 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*..KantenUnten [b2 = k - 2 * q, b3=..b4*);
40.78 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "KantenSenkrecht [v1 = k]"*);
40.79 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*..KantenSenkrecht [v2 = k, v3 = k, v4]*);
40.80 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "KantenOben [b1 = k - 2 *q])*);
40.81 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*..KantenOben [b2 = k - 2 * q, b3 =, b4*);
40.82 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Find "GesamtLaenge L"*);
40.83 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*Specify_Theory "AlgEin.thy"*);
40.84 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*Specify_Problem ["numerischSymbolis,Be*);
40.85 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*Specify_Method ["Berechnung", "erstSym*);
40.86 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*Apply_Method*);
40.87 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*Substitute["Oben = boollist2sum [b1 =*);
40.88 +f2str f;
40.89 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*Substitute ["t1 = k - 2 * q", *);f2str f;
40.90 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*Substitute ["k = 10", "q = 1"]*);f2str f;
40.91 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*Rewrite_Set "norm_Rational"*);f2str f;
40.92 +val (p,_,f,nxt,_,pt) = me nxt p c pt(**);
40.93 +if f2str f = "L = 32 + senkrecht + unten" then ()
40.94 +else raise error "algein.sml diff.behav. in erstSymbolisch 1";
40.95 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val(p,_,f,nxt,_,pt)=me nxt p c pt;f2str f;
40.96 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val(p,_,f,nxt,_,pt)=me nxt p c pt;f2str f;
40.97 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val(p,_,f,nxt,_,pt)=me nxt p c pt;f2str f;
40.98 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val(p,_,f,nxt,_,pt)=me nxt p c pt;f2str f;
40.99 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
40.100 +if f2str f = "L = 104" andalso nxt = ("End_Proof'", End_Proof') then ()
40.101 +else raise error "algein.sml diff.behav. in erstSymbolisch 99";
40.102 +
40.103 +
40.104 +"----------- auto 'Berechnung' 'erstSymbolisch' ------------------";
40.105 +"----------- auto 'Berechnung' 'erstSymbolisch' ------------------";
40.106 +"----------- auto 'Berechnung' 'erstSymbolisch' ------------------";
40.107 +states:=[];
40.108 +CalcTree
40.109 +[(["KantenLaenge (k=10)","Querschnitt (q=1)",
40.110 + "KantenUnten [b1 = k - 2*q, b2 = k - 2*q, b3 = k - 2*q, b4 = k - 2*q ]",
40.111 + "KantenSenkrecht [v1 = k, v2 = k, v3 = k, v4 = k]",
40.112 + "KantenOben [t1 = k - 2*q, t2 = k - 2*q, t3 = k - 2*q, t4 = k - 2*q ]",
40.113 + "GesamtLaenge L"],
40.114 + ("Isac.thy",["numerischSymbolische", "Berechnung"],
40.115 + ["Berechnung","erstSymbolisch"]))];
40.116 +Iterator 1;
40.117 +moveActiveRoot 1;
40.118 +autoCalculate 1 CompleteCalc;
40.119 +val ((pt,p),_) = get_calc 1; show_pt pt;
40.120 +if p = ([], Res) andalso term2str (get_obj g_res pt (fst p)) = "L = 104" then()
40.121 +else raise error "algein.sml: 'Berechnung' 'erstSymbolisch' changed";
40.122 +
40.123 +(*
40.124 +show_pt pt;
40.125 +trace_rewrite:=true;
40.126 +trace_rewrite:=false;
40.127 +trace_script:=true;
40.128 +trace_script:=false;
40.129 +*)
40.130 +
40.131 +"----------- Widerspruch 3 = 777 ---------------------------------";
40.132 +"----------- Widerspruch 3 = 777 ---------------------------------";
40.133 +"----------- Widerspruch 3 = 777 ---------------------------------";
40.134 +val thy = Isac.thy;
40.135 +val rew_ord = dummy_ord;
40.136 +val erls = Erls;
40.137 +
40.138 +val thm = assoc_thm' thy ("sym_real_mult_0_right","");
40.139 +val t = str2term "0 = 0";
40.140 +val SOME (t',_) = rewrite_ thy rew_ord erls false thm t;
40.141 +term2str t';
40.142 +(********"0 = ?z1 * 0"*)
40.143 +
40.144 +(*testing code in ME/appl.sml*)
40.145 +val sube = ["?z1 = 3"];
40.146 +val subte = sube2subte sube;
40.147 +val subst = sube2subst thy sube;
40.148 +foldl and_ (true, map contains_Var subte);
40.149 +
40.150 +val t'' = subst_atomic subst t';
40.151 +term2str t'';
40.152 +(********"0 = 3 * 0"*)
40.153 +
40.154 +val thm = assoc_thm' thy ("sym","");
40.155 +(*----- GOON Widerspruch 3 = 777: sym contains "==>" instead of "=" !!!
40.156 +val SOME (t''',_) = rewrite_ thy rew_ord erls false thm t'';
40.157 +*)
40.158 +
40.159 +(* use"../smltest/IsacKnowledge/algein.sml";
40.160 + *)
40.161 +
41.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
41.2 +++ b/test/Tools/isac/Knowledge/atools.sml Mon Aug 30 14:35:51 2010 +0200
41.3 @@ -0,0 +1,131 @@
41.4 +(* tests on Atools.thy and Atools.ML
41.5 + author: Walther Neuper
41.6 + 050814, 08:51
41.7 + (c) due to copyright terms
41.8 +
41.9 +use"../smltest/IsacKnowledge/atools.sml";
41.10 +use"atools.sml";
41.11 +*)
41.12 +
41.13 +"-----------------------------------------------------------------";
41.14 +"table of contents -----------------------------------------------";
41.15 +"-----------------------------------------------------------------";
41.16 +"----------- occurs_in -------------------------------------------";
41.17 +"----------- argument_of -----------------------------------------";
41.18 +"----------- sameFunId -------------------------------------------";
41.19 +"----------- filter_sameFunId ------------------------------------";
41.20 +"----------- boollist2sum ----------------------------------------";
41.21 +"-----------------------------------------------------------------";
41.22 +
41.23 +
41.24 +val thy = Atools.thy;
41.25 +
41.26 +"----------- occurs_in -------------------------------------------";
41.27 +"----------- occurs_in -------------------------------------------";
41.28 +"----------- occurs_in -------------------------------------------";
41.29 +fun str2term str = (term_of o the o (parse thy )) str;
41.30 +fun term2s t = Syntax.string_of_term (thy2ctxt thy) t;
41.31 +val t = str2term "x";
41.32 +if occurs_in t t then "OK" else raise error "atools.sml: occurs_in x x -> f";
41.33 +
41.34 +val t = str2term "x occurs_in x";
41.35 +val SOME (str, t') = eval_occurs_in 0 "Atools.occurs'_in" t 0;
41.36 +if (term2s t') = "x occurs_in x = True" then ()
41.37 +else raise error "atools.sml: x occurs_in x = True ???";
41.38 +
41.39 +"------- some_occur_in";
41.40 +some_occur_in [str2term"c",str2term"c_2"] (str2term"a + b + c");
41.41 +val t = str2term "some_of [c, c_2, c_3, c_4] occur_in \
41.42 + \-1 * q_0 * L ^^^ 2 / 2 + L * c + c_2";
41.43 +val SOME (str,t') = eval_some_occur_in 0 "Atools.some'_occur'_in" t 0;
41.44 +if term2str t' =
41.45 + "some_of [c, c_2, c_3, c_4] occur_in -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2 =\nTrue" then ()
41.46 +else raise error "atools.sml: some_occur_in true";
41.47 +
41.48 +val t = str2term "some_of [c_3, c_4] occur_in \
41.49 + \-1 * q_0 * L ^^^ 2 / 2 + L * c + c_2";
41.50 +val SOME (str,t') = eval_some_occur_in 0 "Atools.some'_occur'_in" t 0;
41.51 +if term2str t' =
41.52 + "some_of [c_3, c_4] occur_in -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2 = False" then ()
41.53 +else raise error "atools.sml: some_occur_in false";
41.54 +
41.55 +
41.56 +"----------- argument_of -----------------------------------------";
41.57 +"----------- argument_of -----------------------------------------";
41.58 +"----------- argument_of -----------------------------------------";
41.59 +val t = str2term "argument_in (M_b x)";
41.60 +val SOME (str, t') = eval_argument_in 0 "Atools.argument'_in" t 0;
41.61 +if term2s t' = "(argument_in M_b x) = x" then ()
41.62 +else raise error "atools.sml:(argument_in M_b x) = x ???";
41.63 +
41.64 +"----------- sameFunId -------------------------------------------";
41.65 +"----------- sameFunId -------------------------------------------";
41.66 +"----------- sameFunId -------------------------------------------";
41.67 +val t = str2term "M_b L"; atomty t;
41.68 +val t as f1 $ _ = str2term "M_b L";
41.69 +val t as Const ("op =", _) $ (f2 $ _) $ _ = str2term "M_b x = c + L*x";
41.70 +f1 = f2 (*true*);
41.71 +val (p as Const ("Atools.sameFunId",_) $
41.72 + (f1 $ _) $
41.73 + (Const ("op =", _) $ (f2 $ _) $ _)) =
41.74 + str2term "sameFunId (M_b L) (M_b x = c + L*x)";
41.75 +f1 = f2 (*true*);
41.76 +eval_sameFunId "" "Atools.sameFunId"
41.77 + (str2term "sameFunId (M_b L) (M_b x = c + L*x)")""(*true*);
41.78 +eval_sameFunId "" "Atools.sameFunId"
41.79 + (str2term "sameFunId (M_b L) ( y' x = c + L*x)")""(*false*);
41.80 +eval_sameFunId "" "Atools.sameFunId"
41.81 + (str2term "sameFunId (M_b L) ( y x = c + L*x)")""(*false*);
41.82 +eval_sameFunId "" "Atools.sameFunId"
41.83 + (str2term "sameFunId ( y L) (M_b x = c + L*x)")""(*false*);
41.84 +eval_sameFunId "" "Atools.sameFunId"
41.85 + (str2term "sameFunId ( y L) ( y x = c + L*x)")""(*true*);
41.86 +
41.87 +"----------- filter_sameFunId ------------------------------------";
41.88 +"----------- filter_sameFunId ------------------------------------";
41.89 +"----------- filter_sameFunId ------------------------------------";
41.90 +val flhs as (fid $ _) = str2term "y' L";
41.91 +val fs = str2term "[M_b x = c + L*x, y' x = c + L*x, y x = c + L*x]";
41.92 +val (p as Const ("Atools.filter'_sameFunId",_) $ (fid $ _) $ fs) =
41.93 + str2term "filter_sameFunId (y' L) \
41.94 + \[M_b x = c + L*x, y' x = c + L*x, y x = c + L*x]";
41.95 +val SOME (str, es) = eval_filter_sameFunId "" "Atools.filter'_sameFunId" p "";
41.96 +if term2str es = "(filter_sameFunId y' L [M_b x = c + L * x, y' x = c + L * x,\n y x = c + L * x]) =\n[y' x = c + L * x]" then ()
41.97 +else raise error "atools.slm diff.behav. in filter_sameFunId";
41.98 +
41.99 +
41.100 +"----------- boollist2sum ----------------------------------------";
41.101 +"----------- boollist2sum ----------------------------------------";
41.102 +"----------- boollist2sum ----------------------------------------";
41.103 +val u_ = str2term "[]";
41.104 +val u_ = str2term "[b1 = k - 2*q]";
41.105 +val u_ = str2term "[b1 = k - 2*q, b2 = k - 2*q, b3 = k - 2*q, b4 = k - 2*q]";
41.106 +val ut_ = isalist2list u_;
41.107 +val sum_ = map lhs ut_;
41.108 +val t = list2sum sum_;
41.109 +term2str t;
41.110 +
41.111 +val t = str2term
41.112 + "boollist2sum [b1 = k - 2*q, b2 = k - 2*q, b3 = k - 2*q, b4 = k - 2*q]";
41.113 +
41.114 +val p as Const ("Atools.boollist2sum", _) $ (Const ("List.list.Cons", _) $
41.115 + _ $ _) = t;
41.116 +
41.117 +
41.118 +val SOME (str, pred) = eval_boollist2sum "" "Atools.boollist2sum" t "";
41.119 +if term2str pred = "boollist2sum\n [b1 = k - 2 * q, b2 = k - 2 * q, b3 = k - 2 * q, b4 = k - 2 * q] =\nb1 + b2 + b3 + b4" then ()
41.120 +else raise error "atools.sml diff.behav. in eval_boollist2sum";
41.121 +
41.122 +trace_rewrite:=true;
41.123 +val srls_ = append_rls "srls_..Berechnung-erstSymbolisch" e_rls
41.124 + [Calc ("Atools.boollist2sum", eval_boollist2sum "")];
41.125 +val t = str2term
41.126 + "boollist2sum [b1 = k - 2*q, b2 = k - 2*q, b3 = k - 2*q, b4 = k - 2*q]";
41.127 +case rewrite_set_ thy false srls_ t of SOME _ => ()
41.128 +| _ => raise error "atools.sml diff.rewrite boollist2sum";
41.129 +trace_rewrite:=false;
41.130 +
41.131 +
41.132 +(* use"IsacKnowledge/Atools.ML";
41.133 + use"../smltest/IsacKnowledge/atools.sml";
41.134 + *)
41.135 \ No newline at end of file
42.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
42.2 +++ b/test/Tools/isac/Knowledge/biegelinie.sml Mon Aug 30 14:35:51 2010 +0200
42.3 @@ -0,0 +1,1040 @@
42.4 +(* tests on biegelinie
42.5 + author: Walther Neuper 050826
42.6 + (c) due to copyright terms
42.7 +
42.8 +use"../smltest/IsacKnowledge/biegelinie.sml";
42.9 +use"biegelinie.sml";
42.10 +*)
42.11 +val thy = Biegelinie.thy;
42.12 +
42.13 +"-----------------------------------------------------------------";
42.14 +"table of contents -----------------------------------------------";
42.15 +"-----------------------------------------------------------------";
42.16 +"----------- the rules -------------------------------------------";
42.17 +"----------- Script [IntegrierenUndKonstanteBestimmen] -----------";
42.18 +"----------- IntegrierenUndKonstanteBestimmen by rewriting -------";
42.19 +"----------- simplify_leaf for this script -----------------------";
42.20 +"----------- Bsp 7.27 me -----------------------------------------";
42.21 +"----------- Bsp 7.27 autoCalculate ------------------------------";
42.22 +"----------- SubProblem (_,[vonBelastungZu,Biegelinien] ----------";
42.23 +"----------- SubProblem (_,[setzeRandbedingungen,Biegelinien] ----";
42.24 +"----------- method [Biegelinien,setzeRandbedingungenEin] + exec -";
42.25 +"----------- method [Biegelinien,setzeRandbedingungenEin]FAST ----";
42.26 +"----------- IntegrierenUndKonstanteBestimmen2: Bsp.7.70. --------";
42.27 +"----------- investigate normalforms in biegelinien --------------";
42.28 +"-----------------------------------------------------------------";
42.29 +"-----------------------------------------------------------------";
42.30 +"-----------------------------------------------------------------";
42.31 +
42.32 +
42.33 +"----------- the rules -------------------------------------------";
42.34 +"----------- the rules -------------------------------------------";
42.35 +"----------- the rules -------------------------------------------";
42.36 +fun str2term str = (term_of o the o (parse Biegelinie.thy)) str;
42.37 +fun term2s t = Syntax.string_of_term (thy2ctxt' "Biegelinie") t;
42.38 +fun rewrit thm str =
42.39 + fst (the (rewrite_ Biegelinie.thy tless_true e_rls true thm str));
42.40 +
42.41 +val t = rewrit Belastung_Querkraft (str2term "- q_ x = - q_0"); term2s t;
42.42 +if term2s t = "Q' x = - q_0" then ()
42.43 +else raise error "/biegelinie.sml: Belastung_Querkraft";
42.44 +
42.45 +val t = rewrit Querkraft_Moment (str2term "Q x = - q_0 * x + c"); term2s t;
42.46 +if term2s t = "M_b' x = - q_0 * x + c" then ()
42.47 +else raise error "/biegelinie.sml: Querkraft_Moment";
42.48 +
42.49 +val t = rewrit Moment_Neigung (str2term "M_b x = -q_0 * x^^^2/2 + q_0/2 *L*x");
42.50 + term2s t;
42.51 +if term2s t = "- EI * y'' x = - q_0 * x ^^^ 2 / 2 + q_0 / 2 * L * x" then ()
42.52 +else raise error "biegelinie.sml: Moment_Neigung";
42.53 +
42.54 +
42.55 +"----------- Script [IntegrierenUndKonstanteBestimmen] -----------";
42.56 +"----------- Script [IntegrierenUndKonstanteBestimmen] -----------";
42.57 +"----------- Script [IntegrierenUndKonstanteBestimmen] -----------";
42.58 +val str =
42.59 +"Script BiegelinieScript \
42.60 +\(l_::real) (q__::real) (v_::real) (b_::real=>real) \
42.61 +\(rb_::bool list) (rm_::bool list) = \
42.62 +\ (let q___ = Take (q_ v_ = q__); \
42.63 +\ q___ = ((Rewrite sym_real_minus_eq_cancel True) @@ \
42.64 +\ (Rewrite Belastung_Querkraft True)) q___; \
42.65 +\ (Q__:: bool) = \
42.66 +\ (SubProblem (Biegelinie_,[named,integrate,function], \
42.67 +\ [diff,integration,named]) \
42.68 +\ [real_ (rhs q___), real_ v_, real_real_ Q]); \
42.69 +\ Q__ = Rewrite Querkraft_Moment True Q__; \
42.70 +\ (M__::bool) = \
42.71 +\ (SubProblem (Biegelinie_,[named,integrate,function], \
42.72 +\ [diff,integration,named]) \
42.73 +\ [real_ (rhs Q__), real_ v_, real_real_ M_b]); \
42.74 +\ e1__ = nth_ 1 rm_; \
42.75 +\ (x1__::real) = argument_in (lhs e1__); \
42.76 +\ (M1__::bool) = (Substitute [v_ = x1__]) M__; \
42.77 +\ M1__ = (Substitute [e1__]) M1__ ; \
42.78 +\ M2__ = Take M__; "^
42.79 +(*without this Take 'Substitute [v_ = x2__]' takes _last formula from ctree_*)
42.80 +" e2__ = nth_ 2 rm_; \
42.81 +\ (x2__::real) = argument_in (lhs e2__); \
42.82 +\ (M2__::bool) = ((Substitute [v_ = x2__]) @@ \
42.83 +\ (Substitute [e2__])) M2__; \
42.84 +\ (c_1_2__::bool list) = \
42.85 +\ (SubProblem (Biegelinie_,[linear,system],[no_met]) \
42.86 +\ [booll_ [M1__, M2__], reall [c,c_2]]); \
42.87 +\ M__ = Take M__; \
42.88 +\ M__ = ((Substitute c_1_2__) @@ \
42.89 +\ (Try (Rewrite_Set_Inst [(bdv_1, c),(bdv_2, c_2)]\
42.90 +\ simplify_System False)) @@ \
42.91 +\ (Rewrite Moment_Neigung False) @@ \
42.92 +\ (Rewrite make_fun_explicit False)) M__; "^
42.93 +(*----------------------- and the same once more ------------------------*)
42.94 +" (N__:: bool) = \
42.95 +\ (SubProblem (Biegelinie_,[named,integrate,function], \
42.96 +\ [diff,integration,named]) \
42.97 +\ [real_ (rhs M__), real_ v_, real_real_ y']); \
42.98 +\ (B__:: bool) = \
42.99 +\ (SubProblem (Biegelinie_,[named,integrate,function], \
42.100 +\ [diff,integration,named]) \
42.101 +\ [real_ (rhs N__), real_ v_, real_real_ y]); \
42.102 +\ e1__ = nth_ 1 rb_; \
42.103 +\ (x1__::real) = argument_in (lhs e1__); \
42.104 +\ (B1__::bool) = (Substitute [v_ = x1__]) B__; \
42.105 +\ B1__ = (Substitute [e1__]) B1__ ; \
42.106 +\ B2__ = Take B__; \
42.107 +\ e2__ = nth_ 2 rb_; \
42.108 +\ (x2__::real) = argument_in (lhs e2__); \
42.109 +\ (B2__::bool) = ((Substitute [v_ = x2__]) @@ \
42.110 +\ (Substitute [e2__])) B2__; \
42.111 +\ (c_1_2__::bool list) = \
42.112 +\ (SubProblem (Biegelinie_,[linear,system],[no_met]) \
42.113 +\ [booll_ [B1__, B2__], reall [c,c_2]]); \
42.114 +\ B__ = Take B__; \
42.115 +\ B__ = ((Substitute c_1_2__) @@ \
42.116 +\ (Rewrite_Set_Inst [(bdv, x)] make_ratpoly_in False)) B__ \
42.117 +\ in B__)"
42.118 +;
42.119 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
42.120 +(*---^^^-OK-----------------------------------------------------------------*)
42.121 +(*---vvv-NOTok--------------------------------------------------------------*)
42.122 +atomty sc;
42.123 +atomt sc;
42.124 +
42.125 +(* use"../smltest/IsacKnowledge/biegelinie.sml";
42.126 + *)
42.127 +
42.128 +"----------- IntegrierenUndKonstanteBestimmen by rewriting -------";
42.129 +"----------- IntegrierenUndKonstanteBestimmen by rewriting -------";
42.130 +"----------- IntegrierenUndKonstanteBestimmen by rewriting -------";
42.131 +val t = str2term "M_b x = L * q_0 * x / 2 + -1 * q_0 * x ^^^ 2 / 2";
42.132 +val t = rewrit Moment_Neigung t; term2s t;
42.133 +(*was "EI * ?y'' x = L * q_0 * x / 2 + -1 * q_0 * x ^^^ 2 / 2"
42.134 + ### before declaring "y''" as a constant *)
42.135 +val t = rewrit make_fun_explicit t; term2s t;
42.136 +
42.137 +
42.138 +"----------- simplify_leaf for this script -----------------------";
42.139 +"----------- simplify_leaf for this script -----------------------";
42.140 +"----------- simplify_leaf for this script -----------------------";
42.141 +val srls = Rls {id="srls_IntegrierenUnd..",
42.142 + preconds = [],
42.143 + rew_ord = ("termlessI",termlessI),
42.144 + erls = append_rls "erls_in_srls_IntegrierenUnd.." e_rls
42.145 + [(*for asm in nth_Cons_ ...*)
42.146 + Calc ("op <",eval_equ "#less_"),
42.147 + (*2nd nth_Cons_ pushes n+-1 into asms*)
42.148 + Calc("op +", eval_binop "#add_")
42.149 + ],
42.150 + srls = Erls, calc = [],
42.151 + rules = [Thm ("nth_Cons_",num_str nth_Cons_),
42.152 + Calc("op +", eval_binop "#add_"),
42.153 + Thm ("nth_Nil_",num_str nth_Nil_),
42.154 + Calc("Tools.lhs", eval_lhs"eval_lhs_"),
42.155 + Calc("Tools.rhs", eval_rhs"eval_rhs_"),
42.156 + Calc("Atools.argument'_in",
42.157 + eval_argument_in "Atools.argument'_in")
42.158 + ],
42.159 + scr = EmptyScr};
42.160 +val rm_ = str2term"[M_b 0 = 0, M_b L = 0]";
42.161 +val M__ = str2term"M_b x = -1 * x ^^^ 2 / 2 + x * c + c_2";
42.162 +val SOME (e1__,_) =
42.163 + rewrite_set_ thy false srls
42.164 + (str2term"(nth_::[real,bool list]=>bool) 1 " $ rm_);
42.165 +if term2str e1__ = "M_b 0 = 0" then ()
42.166 +else raise error "biegelinie.sml simplify nth_ 1 rm_";
42.167 +
42.168 +val SOME (x1__,_) =
42.169 + rewrite_set_ thy false srls
42.170 + (str2term"argument_in (lhs (M_b 0 = 0))");
42.171 +if term2str x1__ = "0" then ()
42.172 +else raise error "biegelinie.sml simplify argument_in (lhs (M_b 0 = 0)";
42.173 +
42.174 +trace_rewrite:=true;
42.175 +trace_rewrite:=false;
42.176 +
42.177 +
42.178 +
42.179 +"----------- Bsp 7.27 me -----------------------------------------";
42.180 +"----------- Bsp 7.27 me -----------------------------------------";
42.181 +"----------- Bsp 7.27 me -----------------------------------------";
42.182 +val fmz = ["Traegerlaenge L","Streckenlast q_0","Biegelinie y",
42.183 + "RandbedingungenBiegung [y 0 = 0, y L = 0]",
42.184 + "RandbedingungenMoment [M_b 0 = 0, M_b L = 0]",
42.185 + "FunktionsVariable x"];
42.186 +val (dI',pI',mI') =
42.187 + ("Biegelinie.thy",["MomentBestimmte","Biegelinien"],
42.188 + ["IntegrierenUndKonstanteBestimmen"]);
42.189 +val p = e_pos'; val c = [];
42.190 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
42.191 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.192 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.193 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.194 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.195 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.196 +
42.197 +val pits = get_obj g_pbl pt (fst p);writeln (itms2str_ ctxt pits);
42.198 +(*if itms2str_ ctxt pits = ... all 5 model-items*)
42.199 +val mits = get_obj g_met pt (fst p); writeln (itms2str_ ctxt mits);
42.200 +if itms2str_ ctxt mits = "[]" then ()
42.201 +else raise error "biegelinie.sml: Bsp 7.27 #2";
42.202 +
42.203 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.204 +case nxt of (_,Add_Given "FunktionsVariable x") => ()
42.205 + | _ => raise error "biegelinie.sml: Bsp 7.27 #4a";
42.206 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.207 +val mits = get_obj g_met pt (fst p);writeln (itms2str_ ctxt mits);
42.208 +(*if itms2str_ ctxt mits = ... all 6 guard-items*)
42.209 +case nxt of (_, Apply_Method ["IntegrierenUndKonstanteBestimmen"]) => ()
42.210 + | _ => raise error "biegelinie.sml: Bsp 7.27 #4b";
42.211 +
42.212 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.213 +case pt of Nd (PblObj _, [Nd _]) => ((*Apply_Method + Take*))
42.214 + | _ => raise error "biegelinie.sml: Bsp 7.27 #4c";
42.215 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.216 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.217 +
42.218 +case nxt of
42.219 + (_,Subproblem ("Biegelinie.thy", ["named", "integrate", "function"])) => ()
42.220 + | _ => raise error "biegelinie.sml: Bsp 7.27 #4c";
42.221 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.222 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.223 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.224 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.225 +case nxt of (_, Apply_Method ["diff", "integration", "named"]) => ()
42.226 + | _ => raise error "biegelinie.sml: Bsp 7.27 #5";
42.227 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.228 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.229 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.230 +case nxt of
42.231 + ("Check_Postcond", Check_Postcond ["named", "integrate", "function"]) => ()
42.232 + | _ => raise error "biegelinie.sml: Bsp 7.27 #5a";
42.233 +
42.234 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.235 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.236 +case nxt of
42.237 + (_, Subproblem ("Biegelinie.thy", ["named", "integrate", "function"]))=>()
42.238 + | _ => raise error "biegelinie.sml: Bsp 7.27 #5b";
42.239 +
42.240 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.241 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.242 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.243 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.244 +case nxt of (_, Apply_Method ["diff", "integration","named"]) => ()
42.245 + | _ => raise error "biegelinie.sml: Bsp 7.27 #6";
42.246 +
42.247 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.248 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*nxt = Check_Postcond ["named", "int..*);
42.249 +f2str f;
42.250 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.251 +case nxt of (_, Substitute ["x = 0"]) => ()
42.252 + | _ => raise error "biegelinie.sml: Bsp 7.27 #7";
42.253 +
42.254 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.255 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.256 +if f2str f = "0 = c_2 + c * 0 + -1 * q_0 / 2 * 0 ^^^ 2" then ()
42.257 +else raise error "biegelinie.sml: Bsp 7.27 #8";
42.258 +
42.259 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.260 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.261 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.262 +if f2str f = "0 = c_2 + c * L + -1 * q_0 / 2 * L ^^^ 2" then ()
42.263 +else raise error "biegelinie.sml: Bsp 7.27 #9";
42.264 +
42.265 +(*val nxt = (+, Subproblem ("Biegelinie.thy", ["normalize", ..lin..sys]))*)
42.266 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.267 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.268 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.269 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.270 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.271 +case nxt of (_, Apply_Method ["EqSystem", "normalize", "2x2"]) => ()
42.272 + | _ => raise error "biegelinie.sml: Bsp 7.27 #10";
42.273 +
42.274 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.275 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.276 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.277 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.278 +(*val nxt = Subproblem ["triangular", "2x2", "linear", "system"]*)
42.279 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.280 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.281 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.282 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.283 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.284 +case nxt of (_, Apply_Method["EqSystem", "top_down_substitution", "2x2"]) => ()
42.285 + | _ => raise error "biegelinie.sml: Bsp 7.27 #11";
42.286 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.287 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.288 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.289 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.290 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.291 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.292 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.293 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.294 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.295 +case nxt of (_, Check_Postcond ["normalize", "2x2", "linear", "system"]) => ()
42.296 + | _ => raise error "biegelinie.sml: Bsp 7.27 #12";
42.297 +
42.298 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.299 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.300 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.301 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.302 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.303 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.304 +case nxt of
42.305 + (_, Subproblem ("Biegelinie.thy", ["named", "integrate", "function"]))=>()
42.306 + | _ => raise error "biegelinie.sml: Bsp 7.27 #13";
42.307 +
42.308 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.309 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.310 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.311 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.312 +case nxt of (_, Apply_Method ["diff", "integration", "named"]) => ()
42.313 + | _ => raise error "biegelinie.sml: Bsp 7.27 #14";
42.314 +
42.315 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.316 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.317 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.318 +case nxt of
42.319 + (_, Check_Postcond ["named", "integrate", "function"]) => ()
42.320 + | _ => raise error "biegelinie.sml: Bsp 7.27 #15";
42.321 +
42.322 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.323 +if f2str f =
42.324 + "y' x = c + 1 / (-1 * EI) * (L * q_0 / 4 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3)"
42.325 +then () else raise error "biegelinie.sml: Bsp 7.27 #16 f";
42.326 +case nxt of
42.327 + (_, Subproblem ("Biegelinie.thy", ["named", "integrate", "function"]))=>()
42.328 + | _ => raise error "biegelinie.sml: Bsp 7.27 #16";
42.329 +
42.330 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.331 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.332 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.333 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.334 +case nxt of (_, Apply_Method ["diff", "integration", "named"]) => ()
42.335 + | _ => raise error "biegelinie.sml: Bsp 7.27 #17";
42.336 +
42.337 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.338 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.339 +if f2str f =
42.340 + "y x =\nc_2 + c * x +\n\
42.341 + \1 / (-1 * EI) * (L * q_0 / 12 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)"
42.342 +then () else raise error "biegelinie.sml: Bsp 7.27 #18 f";
42.343 +case nxt of
42.344 + (_, Check_Postcond ["named", "integrate", "function"]) => ()
42.345 + | _ => raise error "biegelinie.sml: Bsp 7.27 #18";
42.346 +
42.347 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.348 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.349 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.350 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.351 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.352 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.353 +case nxt of
42.354 + (_, Subproblem
42.355 + ("Biegelinie.thy", ["normalize", "2x2", "linear", "system"])) => ()
42.356 + | _ => raise error "biegelinie.sml: Bsp 7.27 #19";
42.357 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.358 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.359 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.360 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.361 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.362 +case nxt of (_, Apply_Method ["EqSystem", "normalize", "2x2"]) => ()
42.363 + | _ => raise error "biegelinie.sml: Bsp 7.27 #20";
42.364 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.365 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.366 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.367 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.368 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.369 +if f2str f = "[c_2 = 0, L * c + c_2 = -1 * q_0 * L ^^^ 4 / (-24 * EI)]" then ()
42.370 +else raise error "biegelinie.sml: Bsp 7.27 #21 f";
42.371 +case nxt of
42.372 + (_, Subproblem
42.373 + ("Biegelinie.thy", ["triangular", "2x2", "linear", "system"])) =>()
42.374 + | _ => raise error "biegelinie.sml: Bsp 7.27 #21";
42.375 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.376 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.377 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.378 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.379 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.380 +case nxt of (_, Apply_Method["EqSystem", "top_down_substitution", "2x2"]) => ()
42.381 + | _ => raise error "biegelinie.sml: Bsp 7.27 #22";
42.382 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.383 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.384 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.385 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.386 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.387 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.388 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.389 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.390 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.391 +case nxt of (_, Check_Postcond ["normalize", "2x2", "linear", "system"]) => ()
42.392 + | _ => raise error "biegelinie.sml: Bsp 7.27 #23";
42.393 +
42.394 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.395 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.396 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.397 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.398 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.399 +if f2str f =
42.400 +"y x =\n-1 * q_0 * L ^^^ 4 / (-24 * EI * L) * x +\n\
42.401 + \(2 * L * q_0 / (-1 * 24 * EI) * x ^^^ 3 +\n\
42.402 + \ -1 * q_0 / (-1 * 24 * EI) * x ^^^ 4)" then ()
42.403 +else raise error "biegelinie.sml: Bsp 7.27 #24 f";
42.404 +case nxt of ("End_Proof'", End_Proof') => ()
42.405 + | _ => raise error "biegelinie.sml: Bsp 7.27 #24";
42.406 +
42.407 +(* use"../smltest/IsacKnowledge/biegelinie.sml";
42.408 + *)
42.409 +show_pt pt;
42.410 +(*(([], Frm), Problem (Biegelinie.thy, [MomentBestimmte, Biegelinien])),
42.411 +(([1], Frm), q_ x = q_0),
42.412 +(([1], Res), - q_ x = - q_0),
42.413 +(([2], Res), Q' x = - q_0),
42.414 +(([3], Pbl), Integrate (- q_0, x)),
42.415 +(([3,1], Frm), Q x = Integral - q_0 D x),
42.416 +(([3,1], Res), Q x = -1 * q_0 * x + c),
42.417 +(([3], Res), Q x = -1 * q_0 * x + c),
42.418 +(([4], Res), M_b' x = -1 * q_0 * x + c),
42.419 +(([5], Pbl), Integrate (-1 * q_0 * x + c, x)),
42.420 +(([5,1], Frm), M_b x = Integral -1 * q_0 * x + c D x),
42.421 +(([5,1], Res), M_b x = -1 * q_0 * x ^^^ 2 / 2 + x * c + c_2),
42.422 +(([5], Res), M_b x = -1 * q_0 * x ^^^ 2 / 2 + x * c + c_2),
42.423 +(([6], Res), M_b 0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2),
42.424 +(([7], Res), 0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2),
42.425 +(([8], Res), M_b L = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2),
42.426 +(([9], Res), 0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2),
42.427 +(([10], Pbl), solveSystem [0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2] [c_2]),
42.428 +(([10,1], Frm), [0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2,
42.429 + 0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2]),
42.430 +(([10,1], Res), [0 = c_2, 0 = -1 * (q_0 * L ^^^ 2) / 2 + (L * c + c_2)]),
42.431 +(([10,2], Res), [c_2 = 0, L * c + c_2 = 0 + -1 * (-1 * (q_0 * L ^^^ 2) / 2)]),
42.432 +(([10,3], Res), [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]),
42.433 +(([10,4], Pbl), solveSystem [L * c + c_2 = q_0 * L ^^^ 2 / 2] [c_2]),
42.434 +(([10,4,1], Frm), L * c + c_2 = q_0 * L ^^^ 2 / 2),
42.435 +(([10,4,1], Res), L * c + 0 = q_0 * L ^^^ 2 / 2),
42.436 +(([10,4,2], Res), L * c = q_0 * L ^^^ 2 / 2),
42.437 +(([10,4,3], Res), c = q_0 * L ^^^ 2 / 2 / L),
42.438 +(([10,4,4], Res), c = L * q_0 / 2),
42.439 +(([10,4,5], Res), [c = L * q_0 / 2, c_2 = 0]),
42.440 +(([10,4], Res), [c = L * q_0 / 2, c_2 = 0]),
42.441 +(([10], Res), [c = L * q_0 / 2, c_2 = 0]),
42.442 +(([11], Res), M_b x = -1 * q_0 * x ^^^ 2 / 2 + x * (L * q_0 / 2) + 0),
42.443 +(([12], Res), M_b x = L * q_0 * x / 2 + -1 * q_0 * x ^^^ 2 / 2),
42.444 +(([13], Res), EI * y'' x = L * q_0 * x / 2 + -1 * q_0 * x ^^^ 2 / 2),
42.445 +(([14], Res), y'' x = 1 / EI * (L * q_0 * x / 2 + -1 * q_0 * x ^^^ 2 / 2)),
42.446 +(([15], Pbl), Integrate (1 / EI * (L * q_0 * x / 2 + -1 * q_0 * x ^^^ 2 / 2), x)),
42.447 +(([15,1], Frm), y' x = Integral 1 / EI * (L * q_0 * x / 2 + -1 * q_0 * x ^^^ 2 / 2) D x),
42.448 +(([15,1], Res), y' x =
42.449 +(Integral L * q_0 * x / 2 D x + Integral -1 * q_0 * x ^^^ 2 / 2 D x) / EI +
42.450 +c)]*)
42.451 +
42.452 +"----------- Bsp 7.27 autoCalculate ------------------------------";
42.453 +"----------- Bsp 7.27 autoCalculate ------------------------------";
42.454 +"----------- Bsp 7.27 autoCalculate ------------------------------";
42.455 + states:=[];
42.456 + CalcTree [(["Traegerlaenge L","Streckenlast q_0","Biegelinie y",
42.457 + "RandbedingungenBiegung [y 0 = 0, y L = 0]",
42.458 + "RandbedingungenMoment [M_b 0 = 0, M_b L = 0]",
42.459 + "FunktionsVariable x"],
42.460 + ("Biegelinie.thy",
42.461 + ["MomentBestimmte","Biegelinien"],
42.462 + ["IntegrierenUndKonstanteBestimmen"]))];
42.463 + moveActiveRoot 1;
42.464 + autoCalculate 1 CompleteCalcHead;
42.465 +
42.466 + fetchProposedTactic 1 (*->"Apply_Method" IntegrierenUndKonstanteBestimmen*);
42.467 +(*
42.468 +> val (_,Apply_Method' (_, NONE, ScrState is), _)::_ = tacis;
42.469 +> is = e_scrstate;
42.470 +val it = true : bool
42.471 +*)
42.472 + autoCalculate 1 (Step 1) (*->GENERATED ([1], Frm)*);
42.473 + val ((pt,_),_) = get_calc 1;
42.474 + case pt of Nd (PblObj _, [Nd _]) => ((*Apply_Method + Take*))
42.475 + | _ => raise error "biegelinie.sml: Bsp 7.27 autoCalculate#4c";
42.476 +
42.477 + autoCalculate 1 CompleteCalc;
42.478 +val ((pt,p),_) = get_calc 1;
42.479 +if p = ([], Res) andalso length (children pt) = 23 andalso
42.480 +term2str (get_obj g_res pt (fst p)) =
42.481 +"y x =\n-1 * q_0 * L ^^^ 4 / (-24 * EI * L) * x +\n(2 * L * q_0 / (-1 * 24 * EI) * x ^^^ 3 +\n -1 * q_0 / (-1 * 24 * EI) * x ^^^ 4)"
42.482 +then () else raise error "biegelinie.sml: 1st biegelin.7.27 changed";
42.483 +
42.484 + val (unc, del, gen) = (([],Pbl), ([],Pbl), ([],Res));
42.485 + getFormulaeFromTo 1 unc gen 1 (*only level 1*) false;
42.486 + show_pt pt;
42.487 +
42.488 +(*check all formulae for getTactic*)
42.489 + getTactic 1 ([1],Frm) (*see smltest/../reverse-rew.sml*);
42.490 + getTactic 1 ([5],Res) (*tac2xml: not impl. for Substitute ["x = 0"]*);
42.491 + getTactic 1 ([6],Res) (* ---"--- ["M_b 0 = 0"]*);
42.492 + getTactic 1 ([7],Res) (*!!!!!Take!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*);
42.493 + getTactic 1 ([8],Frm) (*tac2xml: not impl. for Substitute ["x = L"]*);
42.494 + getTactic 1 ([8],Res) (* ---"--- ["M_b L = 0"]*);
42.495 +
42.496 +
42.497 +"----------- SubProblem (_,[vonBelastungZu,Biegelinien] ----------";
42.498 +"----------- SubProblem (_,[vonBelastungZu,Biegelinien] ----------";
42.499 +"----------- SubProblem (_,[vonBelastungZu,Biegelinien] ----------";
42.500 +val fmz =
42.501 + ["Streckenlast q_0","FunktionsVariable x",
42.502 + "Funktionen [Q x = c + -1 * q_0 * x, \
42.503 + \M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2,\
42.504 + \ y' x = c_3 + 1 / (-1 * EI) * (c_2 * x + c / 2 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3),\
42.505 + \ y x = c_4 + c_3 * x + 1 / (-1 * EI) * (c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)]"];
42.506 +val (dI',pI',mI') = ("Biegelinie.thy", ["vonBelastungZu","Biegelinien"],
42.507 + ["Biegelinien","ausBelastung"]);
42.508 +val p = e_pos'; val c = [];
42.509 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
42.510 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.511 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.512 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.513 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.514 +if nxt = ("Apply_Method", Apply_Method ["Biegelinien", "ausBelastung"])
42.515 +then () else raise error "biegelinie.sml met2 b";
42.516 +
42.517 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "q_ x = q_0";
42.518 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "- q_ x = - q_0";
42.519 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "Q' x = - q_0";
42.520 +case nxt of (_, Subproblem (_, ["named", "integrate", "function"])) => ()
42.521 +| _ => raise error "biegelinie.sml met2 c";
42.522 +
42.523 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.524 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.525 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.526 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.527 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.528 +
42.529 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "Q x = c + -1 * q_0 * x";
42.530 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "Q x = c + -1 * q_0 * x";
42.531 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "M_b' x = c + -1 * q_0 * x";
42.532 +case nxt of (_,Subproblem (_, ["named", "integrate", "function"])) => ()
42.533 +| _ => raise error "biegelinie.sml met2 d";
42.534 +
42.535 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.536 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.537 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.538 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.539 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
42.540 + "M_b x = Integral c + -1 * q_0 * x D x";
42.541 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
42.542 + "M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2";
42.543 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
42.544 + "M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2";
42.545 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
42.546 + "- EI * y'' x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2";
42.547 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
42.548 + "y'' x = 1 / - EI * (c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2)";
42.549 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.550 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.551 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.552 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.553 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
42.554 + "y' x = Integral 1 / - EI * (c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2) D x";
42.555 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
42.556 +"y' x = Integral 1 / (-1 * EI) * (c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2) D x";
42.557 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
42.558 +"y' x =\nc_3 + 1 / (-1 * EI) * (c_2 * x + c / 2 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3)";
42.559 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
42.560 +"y' x =\nc_3 + 1 / (-1 * EI) * (c_2 * x + c / 2 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3)";
42.561 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.562 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.563 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.564 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.565 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
42.566 +"y x =\nIntegral c_3 +\n 1 / (-1 * EI) *\n (c_2 * x + c / 2 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3) D x";
42.567 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
42.568 +"y x =\nc_4 + c_3 * x +\n1 / (-1 * EI) *\n(c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)";
42.569 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
42.570 + "y x =\nc_4 + c_3 * x +\n1 / (-1 * EI) *\n(c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)";
42.571 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.572 +if nxt = ("End_Proof'", End_Proof') andalso f2str f =
42.573 + "[Q x = c + -1 * q_0 * x, M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2,\n y' x =\n c_3 + 1 / (-1 * EI) * (c_2 * x + c / 2 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3),\n y x =\n c_4 + c_3 * x +\n 1 / (-1 * EI) *\n (c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)]" then ()
42.574 +else raise error "biegelinie.sml met2 e";
42.575 +
42.576 +
42.577 +
42.578 +"----------- SubProblem (_,[setzeRandbedingungen,Biegelinien] ----";
42.579 +"----------- SubProblem (_,[setzeRandbedingungen,Biegelinien] ----";
42.580 +"----------- SubProblem (_,[setzeRandbedingungen,Biegelinien] ----";
42.581 +val str =
42.582 +"Script Function2Equality (fun_::bool) (sub_::bool) =\
42.583 +\(equ___::bool)"
42.584 +;
42.585 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
42.586 +val str =
42.587 +"Script Function2Equality (fun_::bool) (sub_::bool) =\
42.588 +\ (let v_ = argument_in (lhs fun_)\
42.589 +\ in (equ___::bool))"
42.590 +;
42.591 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
42.592 +val str =
42.593 +"Script Function2Equality (fun_::bool) (sub_::bool) =\
42.594 +\ (let v_ = argument_in (lhs fun_);\
42.595 +\ (equ_) = (Substitute [sub_]) fun_\
42.596 +\ in (equ_::bool))"
42.597 +;
42.598 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
42.599 +val str =
42.600 +"Script Function2Equality (fun_::bool) (sub_::bool) =\
42.601 +\ (let v_ = argument_in (lhs fun_);\
42.602 +\ equ_ = (Substitute [sub_]) fun_\
42.603 +\ in (Rewrite_Set_Inst [(bdv, v_)] make_ratpoly_in False) equ_)"
42.604 +;
42.605 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
42.606 +(*---^^^-OK-----------------------------------------------------------------*)
42.607 +val str =
42.608 +(*(M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2) (M_b L = 0) -->
42.609 + 0 = c_2 + c * L + -1 * q_0 / 2 * L ^^^ 2*)
42.610 +"Script Function2Equality (fun_::bool) (sub_::bool) =\
42.611 +\ (let bdv_ = argument_in (lhs fun_);\
42.612 +\ val_ = argument_in (lhs sub_);\
42.613 +\ equ_ = (Substitute [bdv_ = val_]) fun_;\
42.614 +\ equ_ = (Substitute [sub_]) fun_\
42.615 +\ in (Rewrite_Set_Inst [(bdv_, v_)] make_ratpoly_in False) equ_)"
42.616 +;
42.617 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
42.618 +(*---vvv-NOTok--------------------------------------------------------------*)
42.619 +atomty sc;
42.620 +
42.621 +val fmz = ["functionEq (M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2)",
42.622 + "substitution (M_b L = 0)",
42.623 + "equality equ___"];
42.624 +val (dI',pI',mI') = ("Biegelinie.thy", ["makeFunctionTo","equation"],
42.625 + ["Equation","fromFunction"]);
42.626 +val p = e_pos'; val c = [];
42.627 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
42.628 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.629 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.630 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.631 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.632 +
42.633 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
42.634 + "M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2";
42.635 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
42.636 + "M_b L = c_2 + c * L + -1 * q_0 / 2 * L ^^^ 2";
42.637 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
42.638 + "0 = c_2 + c * L + -1 * q_0 / 2 * L ^^^ 2";
42.639 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.640 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.641 +if nxt = ("End_Proof'", End_Proof') andalso
42.642 +(* f2str f = "0 = c_2 + L * c + -1 * q_0 / 2 * L ^^^ 2"
42.643 +CHANGE NOT considered, already on leave*)
42.644 + f2str f = "0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2"
42.645 +then () else raise error "biegelinie.sml: SubProblem (_,[setzeRandbed";
42.646 +
42.647 +
42.648 +"----------- method [Biegelinien,setzeRandbedingungenEin] + exec -";
42.649 +"----------- method [Biegelinien,setzeRandbedingungenEin] + exec -";
42.650 +"----------- method [Biegelinien,setzeRandbedingungenEin] + exec -";
42.651 +"----- check the scripts syntax";
42.652 +val str =
42.653 +"Script SetzeRandbedScript (funs_::bool list) (beds_::bool list) =\
42.654 +\ (let b1 = Take (nth_ 1 beds_)\
42.655 +\ in (equs_::bool list))"
42.656 +;
42.657 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
42.658 +val str =
42.659 +"Script SetzeRandbedScript (funs_::bool list) (beds_::bool list) =\
42.660 +\ (let b1_ = Take (nth_ 1 beds_); \
42.661 +\ fs_ = filter (sameFunId (lhs b1_)) funs_; \
42.662 +\ f1_ = hd fs_ \
42.663 +\ in (equs_::bool list))"
42.664 +;
42.665 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
42.666 +
42.667 +val ttt = str2term "sameFunId (lhs b1_) fun___"; atomty ttt;
42.668 +val ttt = str2term "filter"; atomty ttt;
42.669 +val ttt = str2term "filter::[real => bool, real list] => real list";atomty ttt;
42.670 +val ttt = str2term "filter::[bool => bool, bool list] => bool list";
42.671 +val ttt = str2term "filter (sameFunId (lhs b1_)) funs_"; atomty ttt;
42.672 +
42.673 +val str =
42.674 +"Script SetzeRandbedScript (funs_::bool list) (rb_::bool list) =\
42.675 +\ (let beds_ = rev beds_; \
42.676 +\ b1_ = Take (nth_ 1 beds_); \
42.677 +\ fs_ = filter (sameFunId (lhs b1_)) funs_; \
42.678 +\ f1_ = hd fs_ \
42.679 +\ in (equs_::bool list))"
42.680 +;
42.681 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
42.682 +val str =
42.683 +"Script SetzeRandbedScript (funs_::bool list) (rb_::bool list) =\
42.684 +\ (let b1_ = Take (nth_ 1 rb_); \
42.685 +\ fs_ = filter (sameFunId (lhs b1_)) funs_; \
42.686 +\ (equ_::bool) = \
42.687 +\ (SubProblem (Biegelinie_,[makeFunctionTo,equation],\
42.688 +\ [Equation,fromFunction]) \
42.689 +\ [bool_ (hd fs_), bool_ b1_]) \
42.690 +\ in [equ_])"
42.691 +;
42.692 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
42.693 +val str =
42.694 +"Script SetzeRandbedScript (funs_::bool list) (rb_::bool list) =\
42.695 +\ (let b1_ = Take (nth_ 1 rb_); \
42.696 +\ fs_ = filter (sameFunId (lhs b1_)) funs_; \
42.697 +\ (e1_::bool) = \
42.698 +\ (SubProblem (Biegelinie_,[makeFunctionTo,equation],\
42.699 +\ [Equation,fromFunction]) \
42.700 +\ [bool_ (hd fs_), bool_ b1_]); \
42.701 +\ b2_ = Take (nth_ 2 rb_); \
42.702 +\ fs_ = filter (sameFunId (lhs b2_)) funs_; \
42.703 +\ (e2_::bool) = \
42.704 +\ (SubProblem (Biegelinie_,[makeFunctionTo,equation],\
42.705 +\ [Equation,fromFunction]) \
42.706 +\ [bool_ (hd fs_), bool_ b2_]) \
42.707 +\ in [e1_,e1_])"
42.708 +;
42.709 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
42.710 +(*---vvv-NOTok--------------------------------------------------------------*)
42.711 +(*---^^^-OK-----------------------------------------------------------------*)
42.712 +atomty sc;
42.713 +
42.714 +"----- execute script by manual rewriting";
42.715 +(*show_types := true;*)
42.716 +val funs_ = str2term "funs_::bool list";
42.717 +val funs = str2term
42.718 + "[Q x = c + -1 * q_0 * x,\
42.719 + \M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2,\
42.720 + \y' x = c_3 + 1 / (-1 * EI) * (c_2 * x + c / 2 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3),\
42.721 + \y x = c_4 + c_3 * x + 1 / (-1 * EI) * (c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)]";
42.722 +val rb_ = str2term "rb_::bool list";
42.723 +val rb = str2term "[y 0 = 0, y L = 0, M_b 0 = 0, M_b L = 0]";
42.724 +
42.725 +"--- script expression 1";
42.726 +val screxp1_ = str2term "Take (nth_ 1 (rb_::bool list))";
42.727 +val screxp1 = subst_atomic [(rb_, rb)] screxp1_; term2str screxp1;
42.728 +val SOME (b1,_) = rewrite_set_ Isac.thy false srls2 screxp1; term2str b1;
42.729 +if term2str b1 = "Take (y 0 = 0)" then ()
42.730 +else raise error "biegelinie.sml: rew. Bieglie2 --1";
42.731 +val b1 = str2term "(y 0 = 0)";
42.732 +
42.733 +"--- script expression 2";
42.734 +val screxp2_ = str2term "filter (sameFunId (lhs b1_)) funs_";
42.735 +val b1_ = str2term "b1_::bool";
42.736 +val screxp2 = subst_atomic [(b1_,b1),(funs_,funs)] screxp2_; term2str screxp2;
42.737 +val SOME (fs,_) = rewrite_set_ Isac.thy false srls2 screxp2; term2str fs;
42.738 +if term2str fs = "[y x =\n c_4 + c_3 * x +\n 1 / (-1 * EI) *\n (c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)]" then ()
42.739 +else raise error "biegelinie.sml: rew. Bieglie2 --2";
42.740 +
42.741 +"--- script expression 3";
42.742 +val screxp3_ = str2term "SubProblem (Biegelinie_,[makeFunctionTo,equation],\
42.743 +\ [Equation,fromFunction]) \
42.744 +\ [bool_ (hd fs_), bool_ b1_]";
42.745 +val fs_ = str2term "fs_::bool list";
42.746 +val screxp3 = subst_atomic [(fs_,fs),(b1_,b1)] screxp3_;
42.747 +writeln (term2str screxp3);
42.748 +val SOME (equ,_) = rewrite_set_ Isac.thy false srls2 screxp3;
42.749 +if term2str equ = "SubProblem\n (Biegelinie_, [makeFunctionTo, equation], [Equation, fromFunction])\n [bool_\n (y x =\n c_4 + c_3 * x +\n 1 / (-1 * EI) *\n (c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)),\n bool_ (y 0 = 0)]" then ()
42.750 +else raise error "biegelinie.sml: rew. Bieglie2 --3";
42.751 +writeln (term2str equ);
42.752 +(*SubProblem
42.753 + (Biegelinie_, [makeFunctionTo, equation], [Equation, fromFunction])
42.754 + [bool_
42.755 + (y x =
42.756 + c_4 + c_3 * x +
42.757 + 1 / (-1 * EI) *
42.758 + (c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)),
42.759 + bool_ (y 0 = 0)]*)
42.760 +show_types := false;
42.761 +
42.762 +
42.763 +"----- execute script by interpreter: setzeRandbedingungenEin";
42.764 +val fmz = ["Funktionen [Q x = c + -1 * q_0 * x,\
42.765 + \M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2,\
42.766 + \y' x = c_3 + 1 / (-1 * EI) * (c_2 * x + c / 2 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3),\
42.767 + \y x = c_4 + c_3 * x + 1 / (-1 * EI) * (c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)]",
42.768 + "Randbedingungen [y 0 = 0, y L = 0, M_b 0 = 0, M_b L = 0]",
42.769 + "Gleichungen equs___"];
42.770 +val (dI',pI',mI') = ("Biegelinie.thy", ["setzeRandbedingungen","Biegelinien"],
42.771 + ["Biegelinien","setzeRandbedingungenEin"]);
42.772 +val p = e_pos'; val c = [];
42.773 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
42.774 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.775 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.776 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.777 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.778 +
42.779 +"--- before 1.subpbl [Equation, fromFunction]";
42.780 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.781 +case nxt of (_, Apply_Method ["Biegelinien", "setzeRandbedingungenEin"])=>()
42.782 +| _ => raise error "biegelinie.sml: met setzeRandbed*Ein aa";
42.783 +"----- Randbedingung y 0 = 0 in SUBpbl with met [Equation, fromFunction]";
42.784 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.785 +if (#1 o (get_obj g_fmz pt)) (fst p) =
42.786 + ["functionEq\n (y x =\n c_4 + c_3 * x +\n 1 / (-1 * EI) *\n (c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4))",
42.787 + "substitution (y 0 = 0)", "equality equ___"] then ()
42.788 +else raise error "biegelinie.sml met setzeRandbed*Ein bb";
42.789 +(writeln o istate2str) (get_istate pt p);
42.790 +"--- after 1.subpbl [Equation, fromFunction]";
42.791 +
42.792 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.793 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.794 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.795 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.796 +case nxt of (_, Apply_Method["Equation", "fromFunction"]) => ()
42.797 +| _ => raise error "biegelinie.sml met2 ff";
42.798 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f =
42.799 + "y x =\nc_4 + c_3 * x +\n1 / (-1 * EI) *\n(c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)";
42.800 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.801 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.802 +case nxt of (_, Check_Postcond ["makeFunctionTo", "equation"]) => ()
42.803 +| _ => raise error "biegelinie.sml met2 gg";
42.804 +
42.805 +"--- before 2.subpbl [Equation, fromFunction]";
42.806 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "0 = c_4 + 0 / (-1 * EI)" ;
42.807 +case nxt of (_,Subproblem (_, ["makeFunctionTo", "equation"])) => ()
42.808 +| _ => raise error "biegelinie.sml met2 hh";
42.809 +"--- after 1st arrival at 2.subpbl [Equation, fromFunction]";
42.810 +
42.811 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.812 +if (#1 o (get_obj g_fmz pt)) (fst p) =
42.813 + ["functionEq\n (y x =\n c_4 + c_3 * x +\n 1 / (-1 * EI) *\n (c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4))",
42.814 + "substitution (y L = 0)", "equality equ___"] then ()
42.815 +else raise error "biegelinie.sml metsetzeRandbed*Ein bb ";
42.816 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.817 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.818 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.819 +
42.820 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.821 +case nxt of (_, Apply_Method["Equation", "fromFunction"]) => ()
42.822 +| _ => raise error "biegelinie.sml met2 ii";
42.823 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "y x =\nc_4 + c_3 * x +\n1 / (-1 * EI) *\n(c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)";
42.824 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "y L =\nc_4 + c_3 * L +\n1 / (-1 * EI) *\n(c_2 / 2 * L ^^^ 2 + c / 6 * L ^^^ 3 + -1 * q_0 / 24 * L ^^^ 4)";
42.825 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "0 =\nc_4 + c_3 * L +\n1 / (-1 * EI) *\n(c_2 / 2 * L ^^^ 2 + c / 6 * L ^^^ 3 + -1 * q_0 / 24 * L ^^^ 4)";
42.826 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "0 =\nc_4 + L * c_3 +\n(12 * L ^^^ 2 * c_2 + 4 * L ^^^ 3 * c + -1 * L ^^^ 4 * q_0) / (-24 * EI)" ;
42.827 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "0 =\nc_4 + L * c_3 +\n(12 * L ^^^ 2 * c_2 + 4 * L ^^^ 3 * c + -1 * L ^^^ 4 * q_0) / (-24 * EI)";
42.828 +case nxt of (_,Subproblem (_, ["makeFunctionTo", "equation"])) => ()
42.829 +| _ => raise error "biegelinie.sml met2 jj";
42.830 +
42.831 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.832 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.833 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.834 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.835 +case nxt of (_, Apply_Method ["Equation", "fromFunction"])=>()
42.836 +| _ => raise error "biegelinie.sml met2 kk";
42.837 +
42.838 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2"(*true*);
42.839 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "0 = c_2 + c * 0 + -1 * q_0 / 2 * 0 ^^^ 2";
42.840 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "0 = c_2";
42.841 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "0 = c_2";
42.842 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.843 +case nxt of (_,Subproblem (_, ["makeFunctionTo", "equation"])) => ()
42.844 +| _ => raise error "biegelinie.sml met2 ll";
42.845 +
42.846 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.847 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.848 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.849 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.850 +case nxt of (_, Apply_Method ["Equation", "fromFunction"])=>()
42.851 +| _ => raise error "biegelinie.sml met2 mm";
42.852 +
42.853 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2";
42.854 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "M_b L = c_2 + c * L + -1 * q_0 / 2 * L ^^^ 2";
42.855 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "0 = c_2 + c * L + -1 * q_0 / 2 * L ^^^ 2";
42.856 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2";
42.857 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f = "0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2";
42.858 +case nxt of (_, Check_Postcond ["setzeRandbedingungen", "Biegelinien"]) => ()
42.859 +| _ => raise error "biegelinie.sml met2 nn";
42.860 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.861 +if nxt = ("End_Proof'", End_Proof') andalso f2str f =
42.862 +(* "[0 = c_4,\n 0 =\n c_4 + L * c_3 +\n (12 * L ^^^ 2 * c_2 + 4 * L ^^^ 3 * c + -1 * L ^^^ 4 * q_0) / (-24 * EI),\n 0 = c_2, 0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2]" *)
42.863 +"[0 = c_4,\n 0 =\n c_4 + L * c_3 +\n (12 * L ^^^ 2 * c_2 + 4 * L ^^^ 3 * c + -1 * L ^^^ 4 * q_0) /\n (-1 * EI * 24),\n 0 = c_2, 0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2]"
42.864 +then () else raise error "biegelinie.sml met2 oo";
42.865 +
42.866 +(*
42.867 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
42.868 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.869 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.870 +*)
42.871 +
42.872 +"----------- method [Biegelinien,setzeRandbedingungenEin]FAST ----";
42.873 +"----------- method [Biegelinien,setzeRandbedingungenEin]FAST ----";
42.874 +"----------- method [Biegelinien,setzeRandbedingungenEin]FAST ----";
42.875 +(*---^^^-OK-----------------------------------------------------------------*)
42.876 +(*---vvv-NOTok--------------------------------------------------------------*)
42.877 +val str =
42.878 +"Script SetzeRandbedScript (funs_::bool list) (rb_::bool list) = \
42.879 +\ (let b1_ = nth_ 1 rb_; \
42.880 +\ (fs_::bool list) = filter_sameFunId (lhs b1_) funs_; \
42.881 +\ (e1_::bool) = \
42.882 +\ (SubProblem (Biegelinie_,[makeFunctionTo,equation],\
42.883 +\ [Equation,fromFunction]) \
42.884 +\ [bool_ (hd fs_), bool_ b1_]) \
42.885 +\ in [e1_,e2_,e3_,e4_])"
42.886 +;
42.887 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
42.888 +(*---vvv-NOTok--------------------------------------------------------------*)
42.889 +val str =
42.890 +"Script SetzeRandbedScript (funs_::bool list) (rb_::bool list) = \
42.891 +\ (let b1_ = nth_ 1 rb_; \
42.892 +\ fs_ = filter_sameFunId (lhs b1_) funs_; \
42.893 +\ (e1_::bool) = \
42.894 +\ (SubProblem (Biegelinie_,[makeFunctionTo,equation],\
42.895 +\ [Equation,fromFunction]) \
42.896 +\ [bool_ (hd fs_), bool_ b1_]); \
42.897 +\ b2_ = nth_ 2 rb_; \
42.898 +\ fs_ = filter_sameFunId (lhs b2_) funs_; \
42.899 +\ (e2_::bool) = \
42.900 +\ (SubProblem (Biegelinie_,[makeFunctionTo,equation],\
42.901 +\ [Equation,fromFunction]) \
42.902 +\ [bool_ (hd fs_), bool_ b2_]); \
42.903 +\ b3_ = nth_ 3 rb_; \
42.904 +\ fs_ = filter_sameFunId (lhs b3_) funs_; \
42.905 +\ (e3_::bool) = \
42.906 +\ (SubProblem (Biegelinie_,[makeFunctionTo,equation],\
42.907 +\ [Equation,fromFunction]) \
42.908 +\ [bool_ (hd fs_), bool_ b3_]); \
42.909 +\ b4_ = nth_ 4 rb_; \
42.910 +\ fs_ = filter_sameFunId (lhs b4_) funs_; \
42.911 +\ (e4_::bool) = \
42.912 +\ (SubProblem (Biegelinie_,[makeFunctionTo,equation],\
42.913 +\ [Equation,fromFunction]) \
42.914 +\ [bool_ (hd fs_), bool_ b4_]) \
42.915 +\ in [e1_,e2_,e3_,e4_])"
42.916 +;
42.917 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
42.918 +
42.919 +
42.920 +
42.921 +"----------- IntegrierenUndKonstanteBestimmen2: Bsp.7.70. --------";
42.922 +"----------- IntegrierenUndKonstanteBestimmen2: Bsp.7.70. --------";
42.923 +"----------- IntegrierenUndKonstanteBestimmen2: Bsp.7.70. --------";
42.924 +"----- script ";
42.925 +val str =
42.926 +"Script Belastung2BiegelScript (q__::real) (v_::real) = \
42.927 +\ (let q___ = Take (q_ v_ = q__); \
42.928 +\ q___ = ((Rewrite sym_real_minus_eq_cancel True) @@ \
42.929 +\ (Rewrite Belastung_Querkraft True)) q___; \
42.930 +\ (Q__:: bool) = \
42.931 +\ (SubProblem (Biegelinie_,[named,integrate,function], \
42.932 +\ [diff,integration,named]) \
42.933 +\ [real_ (rhs q___), real_ v_, real_real_ Q]); \
42.934 +\ M__ = Rewrite Querkraft_Moment True Q__; \
42.935 +\ (M__::bool) = \
42.936 +\ (SubProblem (Biegelinie_,[named,integrate,function], \
42.937 +\ [diff,integration,named]) \
42.938 +\ [real_ (rhs M__), real_ v_, real_real_ M_b]); \
42.939 +\ N__ = ((Rewrite Moment_Neigung False) @@ \
42.940 +\ (Rewrite make_fun_explicit False)) M__; \
42.941 +\ (N__:: bool) = \
42.942 +\ (SubProblem (Biegelinie_,[named,integrate,function], \
42.943 +\ [diff,integration,named]) \
42.944 +\ [real_ (rhs N__), real_ v_, real_real_ y']); \
42.945 +\ (B__:: bool) = \
42.946 +\ (SubProblem (Biegelinie_,[named,integrate,function], \
42.947 +\ [diff,integration,named]) \
42.948 +\ [real_ (rhs N__), real_ v_, real_real_ y]) \
42.949 +\ in [Q__, M__, N__, B__])"
42.950 +;
42.951 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
42.952 +(*---^^^-OK-----------------------------------------------------------------*)
42.953 +(*---vvv-NOTok--------------------------------------------------------------*)
42.954 +
42.955 +
42.956 +"----- Bsp 7.70 with me";
42.957 +val fmz = ["Traegerlaenge L","Streckenlast q_0","Biegelinie y",
42.958 + "Randbedingungen [y 0 = 0, y L = 0, M_b 0 = 0, M_b L = 0]",
42.959 + "FunktionsVariable x"];
42.960 +val (dI',pI',mI') = ("Biegelinie.thy", ["Biegelinien"],
42.961 + ["IntegrierenUndKonstanteBestimmen2"]);
42.962 +val p = e_pos'; val c = [];
42.963 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
42.964 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.965 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.966 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.967 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.968 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.969 +if nxt = ("Apply_Method", Apply_Method ["IntegrierenUndKonstanteBestimmen2"])
42.970 +then () else raise error "biegelinie.sml met2 a";
42.971 +
42.972 +(*** actual arg(s) missing for '["(#Find, (Funktionen, funs_))"]' i.e. should be 'copy-named' by '*_._'
42.973 +... THIS MEANS:
42.974 +#a# "Script Biegelinie2Script ..
42.975 +\ ... (SubProblem (Biegelinie_,[vonBelastungZu,Biegelinien], \
42.976 +\ [Biegelinien,ausBelastung]) \
42.977 +\ [real_ q__, real_ v_]); \
42.978 +
42.979 +#b# prep_met ... (["Biegelinien","ausBelastung"],
42.980 + ... ("#Given" ,["Streckenlast q__","FunktionsVariable v_"]),
42.981 + "Script Belastung2BiegelScript (q__::real) (v_::real) = \
42.982 +
42.983 +#a#b# BOTH HAVE 2 ARGUMENTS q__ and v_ ...OK
42.984 +##########################################################################
42.985 +BUT THE (#Find, (Funktionen, funs_)) IS NOT COPYNAMED BY funs___ !!!3*_!!!
42.986 +##########################################################################*)
42.987 +"further 'me' see ----- SubProblem (_,[vonBelastungZu,Biegelinien] -------\
42.988 +\ ----- SubProblem (_,[setzeRandbedingungen,Biegelinien] -";
42.989 +
42.990 +"----- Bsp 7.70 with autoCalculate";
42.991 +states:=[];
42.992 +CalcTree [(["Traegerlaenge L","Streckenlast q_0","Biegelinie y",
42.993 + "Randbedingungen [Q 0 = q_0 * L, M_b L = 0, y 0 = 0, y' 0 = 0]",
42.994 + "FunktionsVariable x"],
42.995 + ("Biegelinie.thy", ["Biegelinien"],
42.996 + ["IntegrierenUndKonstanteBestimmen2"]))];
42.997 +moveActiveRoot 1;
42.998 +autoCalculate 1 CompleteCalc;
42.999 +val ((pt,p),_) = get_calc 1; show_pt pt;
42.1000 +if p = ([], Res) andalso term2str (get_obj g_res pt (fst p)) =
42.1001 +"y x =\n-6 * q_0 * L ^^^ 2 / (-24 * EI) * x ^^^ 2 +\n4 * L * q_0 / (-24 * EI) * x ^^^ 3 +\n-1 * q_0 / (-24 * EI) * x ^^^ 4" then ()
42.1002 +else raise error "biegelinie.sml: diff.behav.7.70 with autoCalculate";
42.1003 +
42.1004 +val is = get_istate pt ([],Res); writeln (istate2str is);
42.1005 +val t = str2term " last \
42.1006 +\[Q x = L * q_0 + -1 * q_0 * x, \
42.1007 +\ M_b x = -1 * q_0 * L ^^^ 2 / 2 + q_0 * L / 1 * x + -1 * q_0 / 2 * x ^^^ 2,\
42.1008 +\ y' x = \
42.1009 +\ -3 * q_0 * L ^^^ 2 / (-6 * EI) * x + 3 * L * q_0 / (-6 * EI) * x ^^^ 2 +\
42.1010 +\ -1 * q_0 / (-6 * EI) * x ^^^ 3, \
42.1011 +\ y x = \
42.1012 +\ -6 * q_0 * L ^^^ 2 / (-24 * EI) * x ^^^ 2 + \
42.1013 +\ 4 * L * q_0 / (-24 * EI) * x ^^^ 3 + \
42.1014 +\ -1 * q_0 / (-24 * EI) * x ^^^ 4]";
42.1015 +val srls = append_rls "erls_IntegrierenUndK.." e_rls
42.1016 + [Calc("Tools.rhs", eval_rhs"eval_rhs_"),
42.1017 + Calc ("Atools.ident",eval_ident "#ident_"),
42.1018 + Thm ("last_thmI",num_str last_thmI),
42.1019 + Thm ("if_True",num_str if_True),
42.1020 + Thm ("if_False",num_str if_False)
42.1021 + ]
42.1022 + ;
42.1023 +val t = str2term "last [1,2,3,4]";
42.1024 +trace_rewrite := true;
42.1025 +val SOME (e1__,_) = rewrite_set_ thy false srls t;
42.1026 +trace_rewrite := false;
42.1027 +term2str e1__;
42.1028 +
42.1029 +trace_script := true;
42.1030 +trace_script := false;
42.1031 +
42.1032 +
42.1033 +"----------- investigate normalforms in biegelinien --------------";
42.1034 +"----------- investigate normalforms in biegelinien --------------";
42.1035 +"----------- investigate normalforms in biegelinien --------------";
42.1036 +"----- coming from integration:";
42.1037 +val Q = str2term "Q x = c + -1 * q_0 * x";
42.1038 +val M_b = str2term "M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2";
42.1039 +val y' = str2term "y' x = c_3 + 1 / (-1 * EI) * (c_2 * x + c / 2 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3)";
42.1040 +val y = str2term "y x = c_4 + c_3 * x +\n1 / (-1 * EI) * (c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)";
42.1041 +(*^^^ 1 / (-1 * EI) NOT distributed - ok! ^^^^^^^^^^^^^^^^^^^^^^^*)
42.1042 +
42.1043 +"----- functions comming from:";
43.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
43.2 +++ b/test/Tools/isac/Knowledge/complex.sml Mon Aug 30 14:35:51 2010 +0200
43.3 @@ -0,0 +1,37 @@
43.4 +(* tests for Complex.thy
43.5 +
43.6 +use"../smltest/IsacKnowledge/complex.sml";
43.7 +use"complex.sml";
43.8 +*)
43.9 +
43.10 +val thy = Isac.thy;
43.11 +subthy (Float.thy, ComplexI.thy);
43.12 +
43.13 + val t = (term_of o the o (parse ComplexI.thy)) "I__";
43.14 + atomt t;
43.15 + val t = str2term "I__";
43.16 + atomt t;
43.17 + val t = str2term "1 + 2 * I__";
43.18 + atomt t;
43.19 + val t = str2term "1 + 2 * I__ + 3 + 4 * I__ * (5 + 6 * I__) / (7 + 8 * I__)";
43.20 + atomt t;
43.21 +(*andere konkrete Syntax ???*)
43.22 +
43.23 + val t = str2term "Float ((1,2),(0,0)) * I__";
43.24 + atomt t;
43.25 + term2str t;
43.26 + val t = str2term "Float ((1,2),(0,0)) + Float ((3,4),(0,0)) * I__";
43.27 + atomt t;
43.28 + term2str t;
43.29 +
43.30 + (*--- (1.1 + 2.2 I) * (3.3 + 4.4 I) = - 6.05 + 12 I ---*)
43.31 + val t = str2term "(Float ((11,-1),(0,0)) + Float ((22,-1),(0,0)) * I__) *\
43.32 + \(Float ((33,-1),(0,0)) + Float ((44,-1),(0,0)) * I__)";
43.33 + val SOME (t',_) =
43.34 + rewrite_set_ thy false
43.35 + (append_rls "simpl_complex" make_polynomial
43.36 + [Thm ("square_I", num_str square_I)]) t;
43.37 + term2str t';
43.38 + "Float ((363, -2), 0, 0) + I__ * Float ((484, -2), 0, 0) +\
43.39 + \I__ * Float ((726, -2), 0, 0) + -1 * Float ((968, -2), 0, 0)"
43.40 + (*--- mit dem rls make_polynomial geht ja schon allerhand !!!---*)
43.41 \ No newline at end of file
44.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
44.2 +++ b/test/Tools/isac/Knowledge/diff.sml Mon Aug 30 14:35:51 2010 +0200
44.3 @@ -0,0 +1,692 @@
44.4 +(*
44.5 +
44.6 +use"../smltest/IsacKnowledge/diff.sml";
44.7 +use"diff.sml";
44.8 +*)
44.9 +
44.10 +"-----------------------------------------------------------------";
44.11 +"table of contents -----------------------------------------------";
44.12 +"-----------------------------------------------------------------";
44.13 +" _________________ problemtype _________________ ";
44.14 +"----------- for correction of diff_const ------------------------";
44.15 +" _________________ for correction of diff_quot _________________ ";
44.16 +" _________________ differentiate by rewrite _________________ ";
44.17 +" ______________ differentiate: me (*+ tacs input*) ______________ ";
44.18 +" ________________ differentiate stdin: student active________________ ";
44.19 +" _________________ differentiate stdin: tutor active_________________ ";
44.20 +"---------------------1.5.02 me from script ---------------------";
44.21 +"----------- primed id -------------------------------------------";
44.22 +"----------- diff_conv, sym_diff_conv ----------------------------";
44.23 +"----------- autoCalculate differentiate_on_R 2/x^2 --------------";
44.24 +"----------- autoCalculate diff after_simplification -------------";
44.25 +"----------- autoCalculate differentiate_equality ----------------";
44.26 +"----------- tests for examples ----------------------------------";
44.27 +"------------inform for x^2+x+1 ----------------------------------";
44.28 +"-----------------------------------------------------------------";
44.29 +"-----------------------------------------------------------------";
44.30 +"-----------------------------------------------------------------";
44.31 +
44.32 +
44.33 +val thy = Diff.thy;
44.34 +
44.35 +" _________________ problemtype _________________ ";
44.36 +" _________________ problemtype _________________ ";
44.37 +" _________________ problemtype _________________ ";
44.38 +val pbt = {Given =["functionTerm f_", "differentiateFor v_"],
44.39 + Where =[],
44.40 + Find =["derivative f_'_"],
44.41 + With =[],
44.42 + Relate=[]}:string ppc;
44.43 +val chkpbt = ((map (the o (parse Diff.thy))) o ppc2list) pbt;
44.44 +
44.45 +val org = ["functionTerm (d_d x (x ^^^ 2 + 3 * x + 4))",
44.46 + "differentiateFor x","derivative f_'_"];
44.47 +val chkorg = map (the o (parse Diff.thy)) org;
44.48 +
44.49 +get_pbt ["derivative_of","function"];
44.50 +get_met ["diff","differentiate_on_R"];
44.51 +
44.52 +(*erls should not be in ruleset'! Here only for tests*)
44.53 +ruleset' :=
44.54 +overwritelthy thy
44.55 + (!ruleset',
44.56 + [("erls",
44.57 + Rls {id = "erls",preconds = [], rew_ord = ("termlessI",termlessI),
44.58 + erls = e_rls, srls = Erls, calc = [], (*asm_thm = [],*)
44.59 + rules = [Thm ("refl",num_str refl),
44.60 + Thm ("le_refl",num_str le_refl),
44.61 + Thm ("radd_left_cancel_le",num_str radd_left_cancel_le),
44.62 + Thm ("not_true",num_str not_true),
44.63 + Thm ("not_false",num_str not_false),
44.64 + Thm ("and_true",and_true),
44.65 + Thm ("and_false",and_false),
44.66 + Thm ("or_true",or_true),
44.67 + Thm ("or_false",or_false),
44.68 + Thm ("and_commute",num_str and_commute),
44.69 + Thm ("or_commute",num_str or_commute),
44.70 +
44.71 + Calc ("Atools.is'_const",eval_const "#is_const_"),
44.72 + Calc ("Atools.occurs'_in", eval_occurs_in ""),
44.73 + Calc ("Tools.matches",eval_matches ""),
44.74 +
44.75 + Calc ("op +",eval_binop "#add_"),
44.76 + Calc ("op *",eval_binop "#mult_"),
44.77 + Calc ("Atools.pow" ,eval_binop "#power_"),
44.78 +
44.79 + Calc ("op <",eval_equ "#less_"),
44.80 + Calc ("op <=",eval_equ "#less_equal_"),
44.81 +
44.82 + Calc ("Atools.ident",eval_ident "#ident_")],
44.83 + scr = Script ((term_of o the o (parse thy))
44.84 + "empty_script")
44.85 + }:rls
44.86 + )]);
44.87 +
44.88 +"----------- for correction of diff_const ------------------------";
44.89 +"----------- for correction of diff_const ------------------------";
44.90 +"----------- for correction of diff_const ------------------------";
44.91 +(*re-evaluate this file, otherwise > *** ME_Isa: 'erls' not known*)
44.92 +val thy' = "Diff.thy";
44.93 +val ct = "Not (x =!= a)";
44.94 +rewrite_set thy' false "erls" ct;
44.95 +val ct = "2 is_const";
44.96 +rewrite_set thy' false "erls" ct;
44.97 +
44.98 +val thm = ("diff_const","");
44.99 +val ct = "d_d x x";
44.100 +val NONE =
44.101 + (rewrite_inst thy' "tless_true" "erls" false [("bdv","x")] thm ct);
44.102 +val ct = "d_d x 2";
44.103 +val SOME (ctt,_) =
44.104 + (rewrite_inst thy' "tless_true" "erls" false [("bdv","x")] thm ct);
44.105 +"----- for 'd_d s a' we got 'a is_const' --> False --------vvv-----";
44.106 +trace_rewrite := true;
44.107 +val ct = "d_d s a";
44.108 + (rewrite_inst thy' "tless_true" "erls" false [("bdv","s")] thm ct);
44.109 +(*got: NONE instead SOME*)
44.110 +eval_true Isac.thy [str2term "a is_const"] (assoc_rls"erls");
44.111 +(*got: false instead true; ~~~~~~~~~~~ replaced by 'is_atom'*)
44.112 +val SOME (ctt,_) =
44.113 + (rewrite_inst thy' "tless_true" "erls" false [("bdv","s")] thm ct);
44.114 +if ctt = "0" then () else raise error "diff.sml: thm 'diff_const' diff.behav.";
44.115 +trace_rewrite := false;
44.116 +"----- for 'd_d s a' we had 'a is_const' --> False --------^^^-----";
44.117 +
44.118 +val thm = ("diff_var","");
44.119 +val ct = "d_d x x";
44.120 +val SOME (ctt,_) =
44.121 + (rewrite_inst thy' "tless_true" "erls" false [("bdv","x")] thm ct);
44.122 +val ct = "d_d x a";
44.123 +val NONE =
44.124 + (rewrite_inst thy' "tless_true" "erls" false [("bdv","x")] thm ct);
44.125 +val ct = "d_d x (x+x)";
44.126 +val NONE =
44.127 +(rewrite_inst thy' "tless_true" "erls" false [("bdv","x")] thm ct);
44.128 +
44.129 +
44.130 +" _________________ for correction of diff_quot _________________ ";
44.131 +" _________________ for correction of diff_quot _________________ ";
44.132 +" _________________ for correction of diff_quot _________________ ";
44.133 +val thy' = "Diff.thy";
44.134 +val ct = "Not (x = 0)";
44.135 +rewrite_set thy' false "erls" ct;
44.136 +
44.137 +val ct = "d_d x ((x+1) / (x - 1))";
44.138 +val thm = ("diff_quot","");
44.139 +val SOME (ctt,_) =
44.140 + (rewrite_inst thy' "tless_true" "erls" true [("bdv","x")] thm ct);
44.141 +
44.142 +
44.143 +
44.144 +
44.145 +
44.146 +
44.147 +
44.148 +" _________________ differentiate by rewrite _________________ ";
44.149 +" _________________ differentiate by rewrite _________________ ";
44.150 +" _________________ differentiate by rewrite _________________ ";
44.151 +val thy' = "Diff.thy";
44.152 +val ct = "d_d x (x ^^^ 2 + 3 * x + 4)";
44.153 +"--- 1 ---";
44.154 +val thm = ("diff_sum","");
44.155 +val (ct,_) = the (rewrite_inst thy' "tless_true" "erls" true
44.156 + [("bdv","x::real")] thm ct);
44.157 +"--- 2 ---";
44.158 +val (ct,_) = the (rewrite_inst thy' "tless_true" "erls" true
44.159 + [("bdv","x::real")] thm ct);
44.160 +"--- 3 ---";
44.161 +val thm = ("diff_prod_const","");
44.162 +val (ct,_) = the (rewrite_inst thy' "tless_true" "erls" true
44.163 + [("bdv","x::real")] thm ct);
44.164 +"--- 4 ---";
44.165 +val thm = ("diff_pow","");
44.166 +val (ct,_) = the (rewrite_inst thy' "tless_true" "erls" true
44.167 + [("bdv","x::real")] thm ct);
44.168 +"--- 5 ---";
44.169 +val thm = ("diff_const","");
44.170 +val (ct,_) = the (rewrite_inst thy' "tless_true" "erls" true
44.171 + [("bdv","x::real")] thm ct);
44.172 +"--- 6 ---";
44.173 +val thm = ("diff_var","");
44.174 +val (ct,_) = the (rewrite_inst thy' "tless_true" "erls" true
44.175 + [("bdv","x::real")] thm ct);
44.176 +if ct = "2 * x ^^^ (2 - 1) + 3 * 1 + 0" then ()
44.177 +else raise error "diff.sml diff.behav. in rewrite 1";
44.178 +"--- 7 ---";
44.179 +val rls = ("Test_simplify");
44.180 +val (ct,_) = the (rewrite_set thy' false rls ct);
44.181 +if ct="3 + 2 * x" then () else raise error "new behaviour in test-example";
44.182 +
44.183 +val ct = "2 * x ^^^ (2 - 1) + 3 * 1 + 0";
44.184 +val (ct,_) = the (rewrite_set thy' true rls ct);
44.185 +
44.186 +
44.187 +(*---
44.188 +val t = str2term "x ^^^ (2 - 1)";
44.189 +val SOME (t',_) = rewrite_set_ thy false Test_simplify t;
44.190 +term2str t';
44.191 +
44.192 +val t = str2term "-1 * 1";
44.193 +val SOME (thmID,thm) = get_calculation_ thy (the(assoc(calclist,"times"))) t;
44.194 +*)
44.195 +
44.196 +
44.197 +" ______________ differentiate: me (*+ tacs input*) ______________ ";
44.198 +" ______________ differentiate: me (*+ tacs input*) ______________ ";
44.199 +" ______________ differentiate: me (*+ tacs input*) ______________ ";
44.200 +val fmz = ["functionTerm (x ^^^ 2 + 3 * x + 4)",
44.201 + "differentiateFor x","derivative f_'_"];
44.202 +val (dI',pI',mI') =
44.203 + ("Diff.thy",["derivative_of","function"],
44.204 + ["diff","diff_simpl"]);
44.205 +val p = e_pos'; val c = [];
44.206 +"--- s1 ---";
44.207 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
44.208 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.209 +"--- s2 ---";
44.210 +(*val nxt = ("Add_Given",
44.211 +Add_Given "functionTerm (d_d x (x ^^^ #2 + #3 * x + #4))");*)
44.212 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.213 +"--- s3 ---";
44.214 +(*val nxt = ("Add_Given",Add_Given "differentiateFor x");*)
44.215 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.216 +"--- s4 ---";
44.217 +(*val nxt = ("Add_Find",Add_Find "derivative f_'_");*)
44.218 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.219 +"--- s5 ---";
44.220 +(*val nxt = ("Specify_Theory",Specify_Theory dI');*)
44.221 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.222 +"--- s6 ---";
44.223 +(*val nxt = ("Specify_Problem",Specify_Problem pI');*)
44.224 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.225 +"--- s7 ---";
44.226 +(*val nxt = ("Specify_Method",Specify_Method mI');*)
44.227 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.228 +"--- s8 ---";
44.229 +(*val nxt = ("Apply_Method",Apply_Method mI');*)
44.230 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.231 +"--- 1 ---";
44.232 +(*val nxt = ("Rewrite_Inst",Rewrite_Inst (["(bdv,x)"],("diff_sum","")));*)
44.233 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.234 +"--- 2 ---";
44.235 +(*val nxt = ("Rewrite_Inst",Rewrite_Inst (["(bdv,x)"],("diff_sum","")));*)
44.236 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.237 +(*val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.238 +val (p,_,f,nxt,_,pt) = me nxt p c pt;*)
44.239 +"--- 3 ---";
44.240 +(*val nxt = ("Rewrite_Inst",Rewrite_Inst (["(bdv,x)"],("diff_prod_const",...;*)
44.241 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.242 +(*val (p,_,f,nxt,_,pt) = me nxt p c pt;*)
44.243 +"--- 4 ---";
44.244 +(*val nxt = ("Rewrite_Inst",Rewrite_Inst (["(bdv,x)"],("diff_pow","")));*)
44.245 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.246 +(*val (p,_,f,nxt,_,pt) = me nxt p c pt;*)
44.247 +"--- 5 ---";
44.248 +(*val nxt = ("Rewrite_Inst",Rewrite_Inst (["(bdv,x)"],("diff_prod_const",...;*)
44.249 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.250 +(*val (p,_,f,nxt,_,pt) = me nxt p c pt;*)
44.251 +"--- 6 ---";
44.252 +(*val nxt = ("Rewrite_Inst",Rewrite_Inst (["(bdv,x)"],("diff_var","")));*)
44.253 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.254 +if f2str f = "2 * x ^^^ (2 - 1) + 3 * 1 + 0" then ()
44.255 +else raise error "diff.sml: diff.behav. in d_d x ^^^ 2 + 3 * x + 4";
44.256 +"--- 7 ---";
44.257 +(*------------------------------11.3.03--------------------
44.258 + trace_rewrite:=true;
44.259 + val (_,_,f,_,_,_) = me nxt p c pt;
44.260 + val Form' (FormKF (_,_,_,_,res)) = f;
44.261 + trace_rewrite:=false;
44.262 +
44.263 + val ct = "2 * x ^^^ (2 - 1) + 3 * 1 + 0";
44.264 + val SOME (ct',_) = rewrite_set "Isac.thy" false "make_polynomial" ct;
44.265 +
44.266 + trace_rewrite:=true;
44.267 + val t = str2term ct;
44.268 + term2str t;
44.269 + val SOME (t',_) = rewrite_set_ Isac.thy false make_polynomial t;
44.270 + term2str t';
44.271 + trace_rewrite:=false;
44.272 +
44.273 + val SOME (t'',_) = rewrite_set_ Isac.thy false make_polynomial t';
44.274 + term2str t'';
44.275 +
44.276 + val thm = num_str realpow_eq_oneI;
44.277 + case string_of_thm thm of
44.278 +
44.279 +
44.280 + val Rewrite_Set' ("Diff.thy",false,"make_polynomial",ff,(ff',[])) = m;
44.281 + term2str ff; term2str ff';
44.282 +
44.283 +
44.284 +
44.285 +--------------------------------11.3.03--------------------*)
44.286 +
44.287 +(*val nxt = ("Rewrite_Set",Rewrite_Set "make_polynomial");*)
44.288 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.289 +"--- 8 ---";
44.290 +(*val nxt =
44.291 +("Check_Postcond",Check_Postcond ("Diff.thy","differentiate_on_R"));*)
44.292 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.293 +"--- 9 ---";
44.294 +(*val nxt = ("End_Proof'",End_Proof');*)
44.295 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
44.296 +if nxt = ("End_Proof'",End_Proof') andalso f2str f = "3 + 2 * x" then ()
44.297 +else raise error "diff.sml: new.behav. in me (*+ tacs input*)";
44.298 +(*if f = EmptyMout then () else raise error "new behaviour in + tacs input";
44.299 +meNEW extracts Form once more*)
44.300 +
44.301 +
44.302 +
44.303 +
44.304 +(*---------------- 1.5.02 -----------------------------------------
44.305 +
44.306 +" _________________ script-eval corrected _________________ ";
44.307 +" _________________ script-eval corrected _________________ ";
44.308 +" _________________ script-eval corrected _________________ ";
44.309 +val scr = Script (((inst_abs (assoc_thy "Test.thy")) o
44.310 + term_of o the o (parse Diff.thy))
44.311 + "Script Differentiate (f_::real) (v_::real) = \
44.312 + \(let f_ = Try (Repeat (Rewrite frac_conv False f_)); \
44.313 + \ f_ = Try (Repeat (Rewrite root_conv False f_)); \
44.314 + \ f_ = Repeat \
44.315 + \ ((Repeat (Rewrite_Inst [(bdv,v_)] diff_sum False f_)) Or \
44.316 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_prod_const False f_)) Or \
44.317 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_prod False f_)) Or \
44.318 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_quot False f_)) Or \
44.319 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_sin False f_)) Or \
44.320 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_sin_chain False f_)) Or \
44.321 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_cos False f_)) Or \
44.322 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_cos_chain False f_)) Or \
44.323 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_pow False f_)) Or \
44.324 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_pow_chain False f_)) Or \
44.325 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_ln False f_)) Or \
44.326 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_ln_chain False f_)) Or \
44.327 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_exp False f_)) Or \
44.328 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_exp_chain False f_)) Or \
44.329 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_const False f_)) Or \
44.330 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_var False f_)) Or \
44.331 + \ (Repeat (Rewrite_Set Test_simplify False f_))); \
44.332 + \ f_ = Try (Repeat (Rewrite sym_frac_conv False f_)) \
44.333 + \ in Try (Repeat (Rewrite sym_root_conv False f_)))");
44.334 +val d = e_rls;
44.335 +val (dI',pI',mI') =
44.336 + ("Diff.thy",e_pblID,
44.337 + ("Diff.thy","differentiate_on_R"));
44.338 +val p = e_pos'; val c = [];
44.339 +val (mI,m) = ("Init_Proof",Init_Proof ([], (dI',pI',mI')));
44.340 +val (p,_,_,_,_,pt) = me (mI,m) p c EmptyPtree;
44.341 +val nxt = ("Specify_Theory",Specify_Theory dI');
44.342 +val (p,_,_,_,_,pt) = me nxt p c pt;
44.343 +val nxt = ("Specify_Method",Specify_Method mI');
44.344 +val (p,_,_,_,_,pt) = me nxt p c pt;
44.345 +val p = ([1],Frm):pos';
44.346 +
44.347 +
44.348 +val parseee = (term_of o the o (parse Diff.thy));
44.349 +val ct = "d_d x (x ^^^ #2 + #3 * x + #4)";
44.350 +val envvv = [(parseee"f_",parseee ct),(parseee"v_",parseee"x")];
44.351 +val ets0=[([],(Tac'(Script.thy,"BS","",""),envvv,envvv,empty,empty,Safe)),
44.352 + ([],(User', [], [], empty, empty,Sundef))]:ets;
44.353 +val l0 = [];
44.354 +" --------------- 1. ---------------------------------------------";
44.355 +val (pt,_) = cappend_atomic pt[1]e_loc ct (Rewrite("test","")) ct Complete;
44.356 +val Appl m'=applicable_in p pt (Rewrite_Inst (["(bdv,x)"],("diff_sum","")));
44.357 +
44.358 +val NextStep(l1,m') = nxt_tac "Diff.thy" (pt,p) scr ets0 l0;
44.359 +(*("diff_sum","")*)
44.360 +val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets1)] =
44.361 + locate_gen "Diff.thy" m' (pt,p) (scr,d) ets0 l0;
44.362 +val ets1 = (drop_last ets0) @ ets1;val pt = update_ets pt [] [(1,ets1)];
44.363 +" --------------- 2. ---------------------------------------------";
44.364 +val Appl m'=applicable_in p pt (Rewrite_Inst (["(bdv,x)"],("diff_sum","")));
44.365 +val NextStep(l2,m') = nxt_tac "Diff.thy" (pt,p) scr ets1 l1;
44.366 +(*("diff_sum","")*)
44.367 +val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets2)] =
44.368 + locate_gen "Diff.thy" m' (pt,p) (scr,d) ets1 l1;
44.369 +val ets2 = (drop_last ets1) @ ets2;val pt = update_ets pt [] [(1,ets2)];
44.370 +" --------------- 3. ---------------------------------------------";
44.371 +val Appl m'=applicable_in p pt (Rewrite_Inst (["(bdv,x)"],("diff_prod_const","")));
44.372 +val NextStep(l3,m') = nxt_tac "Diff.thy" (pt,p) scr ets2 l2;
44.373 +(*("diff_prod_const","")*)
44.374 +val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets3)] =
44.375 + locate_gen "Diff.thy" m' (pt,p) (scr,d) ets2 l2;
44.376 +val ets3 = (drop_last ets2) @ ets3; val pt = update_ets pt [] [(1,ets3)];
44.377 +" --------------- 4. ---------------------------------------------";
44.378 +val Appl m'=applicable_in p pt (Rewrite_Inst (["(bdv,x)"],("diff_pow","")));
44.379 +val NextStep(l4,m') = nxt_tac "Diff.thy" (pt,p) scr ets3 l3;
44.380 +(*("diff_pow","")*)
44.381 +val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets4)] =
44.382 + locate_gen "Diff.thy" m' (pt,p) (scr,d) ets3 l3;
44.383 +val ets4 = (drop_last ets3) @ ets4; val pt = update_ets pt [] [(1,ets4)];
44.384 +" --------------- 5. ---------------------------------------------";
44.385 +val Appl m'=applicable_in p pt (Rewrite_Inst (["(bdv,x)"],("diff_const","")));
44.386 +val NextStep(l5,m') = nxt_tac "Diff.thy" (pt,p) scr ets4 l4;
44.387 +(*("diff_const","")*)
44.388 +val Steps[ (Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets5)] =
44.389 + locate_gen "Diff.thy" m' (pt,p) (scr,d) ets4 l4;
44.390 +val ets5 = (drop_last ets4) @ ets5; val pt = update_ets pt [] [(1,ets5)];
44.391 +" --------------- 6. ---------------------------------------------";
44.392 +val Appl m'=applicable_in p pt (Rewrite_Inst (["(bdv,x)"],("diff_var","")));
44.393 +val NextStep(l6,m') = nxt_tac "Diff.thy" (pt,p) scr ets5 l5;
44.394 +(*("diff_var","")ok; here was("diff_const","")because of wrong rule in *.thy*)
44.395 +val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets6)] =
44.396 + locate_gen "Diff.thy" m' (pt,p) (scr,d) ets5 l5;
44.397 +val ets6 = (drop_last ets5) @ ets6; val pt = update_ets pt [] [(1,ets6)];
44.398 +" --------------- 7. ---------------------------------------------";
44.399 +val Appl m'=applicable_in p pt (Rewrite_Set "Test_simplify");
44.400 +
44.401 +
44.402 + ---------------- 1.5.02 -----------------------------------------*)
44.403 +
44.404 +
44.405 +
44.406 +
44.407 +" ________________ differentiate stdin: student active________________ ";
44.408 +" ________________ differentiate stdin: student active________________ ";
44.409 +" ________________ differentiate stdin: student active________________ ";
44.410 +(*
44.411 +proofs:= []; dials:=([],[],[]);
44.412 +StdinSML 0 0 0 0 New_User;
44.413 +set_dstate 1 test_hide 4 1;(*SelRule,St..PutRuleRes,TskipS..*)
44.414 +StdinSML 1 0 0 0 New_Proof;
44.415 +val fmz = ["functionTerm (d_d x (x ^^^ 2 + 3 * x + 4))",
44.416 + "differentiateFor x","derivative f_'_"];
44.417 +val (dI',pI',mI') =
44.418 + ("Diff.thy",["derivative_of","function"],
44.419 + ["diff","differentiate_on_R"]);
44.420 +*)
44.421 +
44.422 +
44.423 +" _________________ differentiate stdin: tutor active_________________ ";
44.424 +" _________________ differentiate stdin: tutor active_________________ ";
44.425 +" _________________ differentiate stdin: tutor active_________________ ";
44.426 +(*proofs:= []; dials:=([],[],[]);
44.427 +StdinSML 0 0 0 0 New_User;
44.428 +set_dstate 1 test_hide 0 2;(*PutRule,TskipS..PutRuleRes,Tt..*)
44.429 +StdinSML 1 0 0 0 New_Proof;
44.430 +val fmz = ["functionTerm (d_d x (x ^^^ 2 + 3 * x + 4))",
44.431 + "differentiateFor x","derivative f_'_"];
44.432 +val (dI',pI',mI') =
44.433 + ("Diff.thy",["derivative_of","function"],
44.434 + ["diff","differentiate_on_R"]);
44.435 +*)
44.436 +
44.437 +
44.438 +"---------------------1.5.02 me from script ---------------------";
44.439 +"---------------------1.5.02 me from script ---------------------";
44.440 +"---------------------1.5.02 me from script ---------------------";
44.441 +(*exp_Diff_No-1.xml*)
44.442 +val fmz = ["functionTerm (x ^^^ 2 + 3 * x + 4)",
44.443 + "differentiateFor x","derivative f_'_"];
44.444 +val (dI',pI',mI') =
44.445 + ("Diff.thy",["derivative_of","function"],
44.446 + ["diff","diff_simpl"]);
44.447 +(*val p = e_pos'; val c = [];
44.448 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
44.449 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
44.450 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
44.451 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.452 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.453 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.454 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.455 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.456 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.457 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.458 +(*nxt = ("Apply_Method",Apply_Method ("Diff.thy","differentiate_on_R*)
44.459 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.460 +
44.461 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.462 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.463 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.464 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.465 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.466 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.467 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.468 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
44.469 +if nxt = ("End_Proof'",End_Proof') then ()
44.470 +else raise error "new behaviour in tests/differentiate, 1.5.02 me from script";
44.471 +
44.472 +"----------- primed id -------------------------------------------";
44.473 +"----------- primed id -------------------------------------------";
44.474 +"----------- primed id -------------------------------------------";
44.475 +
44.476 +val f_ = str2term "f_::bool";
44.477 +val f = str2term "A = s * (a - s)";
44.478 +val v_ = str2term "v_";
44.479 +val v = str2term "s";
44.480 +val screxp0 = str2term "Take ((primed (lhs f_)) = d_d v_ (rhs f_))";
44.481 +atomty screxp0;
44.482 +
44.483 +val screxp1 = subst_atomic [(f_, f), (v_, v)] screxp0;
44.484 +term2str screxp1;
44.485 +atomty screxp1;
44.486 +
44.487 +val SOME (f'_,_) = rewrite_set_ Isac.thy false srls_diff screxp1;
44.488 +if term2str f'_= "Take (A' = d_d s (s * (a - s)))" then ()
44.489 +else raise error "diff.sml: diff.behav. in 'primed'";
44.490 +atomty f'_;
44.491 +
44.492 +val str = "Script DiffEqScr (f_::bool) (v_::real) = \
44.493 +\ (let f'_ = Take ((primed (lhs f_)) = d_d v_ (rhs f_)) \
44.494 +\ in (((Try (Repeat (Rewrite frac_conv False))) @@ \
44.495 + \ (Try (Repeat (Rewrite root_conv False))) @@ \
44.496 + \ (Try (Repeat (Rewrite realpow_pow False))) @@ \
44.497 + \ (Repeat \
44.498 + \ ((Repeat (Rewrite_Inst [(bdv,v_)] diff_sum False)) Or \
44.499 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_prod_const False)) Or \
44.500 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_prod False)) Or \
44.501 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_quot True )) Or \
44.502 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_sin False)) Or \
44.503 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_sin_chain False)) Or \
44.504 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_cos False)) Or \
44.505 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_cos_chain False)) Or \
44.506 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_pow False)) Or \
44.507 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_pow_chain False)) Or \
44.508 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_ln False)) Or \
44.509 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_ln_chain False)) Or \
44.510 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_exp False)) Or \
44.511 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_exp_chain False)) Or \
44.512 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_sqrt False)) Or \
44.513 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_sqrt_chain False)) Or \
44.514 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_const False)) Or \
44.515 + \ (Repeat (Rewrite_Inst [(bdv,v_)] diff_var False)) Or \
44.516 + \ (Repeat (Rewrite_Set make_polynomial False)))) @@ \
44.517 + \ (Try (Repeat (Rewrite sym_frac_conv False))) @@ \
44.518 + \ (Try (Repeat (Rewrite sym_root_conv False))))) f'_)"
44.519 +;
44.520 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
44.521 +
44.522 +
44.523 +"----------- diff_conv, sym_diff_conv ----------------------------";
44.524 +"----------- diff_conv, sym_diff_conv ----------------------------";
44.525 +"----------- diff_conv, sym_diff_conv ----------------------------";
44.526 +val subs = [(str2term "bdv", str2term "x")];
44.527 +val rls = diff_conv;
44.528 +
44.529 +val t = str2term "2/x^^^2";
44.530 +val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; term2str t;
44.531 +if term2str t = "2 * x ^^^ -2" then () else raise error "diff.sml 1/x";
44.532 +
44.533 +val t = str2term "sqrt (x^^^3)";
44.534 +val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; term2str t;
44.535 +if term2str t = "x ^^^ (3 / 2)" then () else raise error "diff.sml x^1/2";
44.536 +
44.537 +val t = str2term "2 / sqrt x^^^3";
44.538 +val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; term2str t;
44.539 +if term2str t = "2 * x ^^^ (-3 / 2)" then () else raise error"diff.sml x^-1/2";
44.540 +(* trace_rewrite := true;
44.541 + trace_rewrite := false;
44.542 + *)
44.543 +val rls = diff_sym_conv;
44.544 +
44.545 +val t = str2term "2 * x ^^^ -2";
44.546 +val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; term2str t;
44.547 +if term2str t = "2 / x ^^^ 2" then () else raise error "diff.sml sym 1/x";
44.548 +
44.549 +
44.550 +val t = str2term "x ^^^ (3 / 2)";
44.551 +val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; term2str t;
44.552 +if term2str t = "sqrt (x ^^^ 3)" then () else raise error"diff.sml sym x^1/x";
44.553 +
44.554 +val t = str2term "2 * x ^^^ (-3 / 2)";
44.555 +val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; term2str t;
44.556 +if term2str t ="2 / sqrt (x ^^^ 3)"then()else raise error"diff.sml sym x^-1/x";
44.557 +
44.558 +
44.559 +(* trace_rewrite:=true;
44.560 + *)
44.561 +(* trace_rewrite:=false;
44.562 + *)
44.563 +(*@@@@*)
44.564 +
44.565 +
44.566 +"----------- autoCalculate differentiate_on_R 2/x^2 --------------";
44.567 +"----------- autoCalculate differentiate_on_R 2/x^2 --------------";
44.568 +"----------- autoCalculate differentiate_on_R 2/x^2 --------------";
44.569 +states:=[];
44.570 +CalcTree
44.571 +[(["functionTerm (x^2 + x+ 1/x + 2/x^2)",
44.572 + (*"functionTerm ((x^3)^5)",*)
44.573 + "differentiateFor x", "derivative f_'_"],
44.574 + ("Isac.thy", ["derivative_of","function"],
44.575 + ["diff","differentiate_on_R"]))];
44.576 +Iterator 1;
44.577 +moveActiveRoot 1;
44.578 +autoCalculate 1 CompleteCalc;
44.579 +val ((pt,p),_) = get_calc 1; show_pt pt;
44.580 +if p = ([], Res) andalso term2str (get_obj g_res pt (fst p)) =
44.581 + "1 + 2 * x + -1 / x ^^^ 2 + -4 / x ^^^ 3" then ()
44.582 +else raise error "diff.sml: differentiate_on_R 2/x^2 changed";
44.583 +
44.584 +"-----------------------------------------------------------------";
44.585 +states:=[];
44.586 +CalcTree
44.587 +[(["functionTerm (x^3 * x^5)",
44.588 + "differentiateFor x", "derivative f_'_"],
44.589 + ("Isac.thy", ["derivative_of","function"],
44.590 + ["diff","differentiate_on_R"]))];
44.591 +Iterator 1;
44.592 +moveActiveRoot 1;
44.593 +(* trace_rewrite := true;
44.594 + trace_script := true;
44.595 + *)
44.596 +autoCalculate 1 CompleteCalc;
44.597 +(* trace_rewrite := false;
44.598 + trace_script := false;
44.599 + *)
44.600 +val ((pt,p),_) = get_calc 1; show_pt pt;
44.601 +
44.602 +if p = ([], Res) andalso term2str (get_obj g_res pt (fst p)) =
44.603 + "8 * x ^^^ 7" then ()
44.604 +else raise error "diff.sml: differentiate_on_R (x^3 * x^5) changed";
44.605 +
44.606 +
44.607 +"----------- autoCalculate diff after_simplification -------------";
44.608 +"----------- autoCalculate diff after_simplification -------------";
44.609 +"----------- autoCalculate diff after_simplification -------------";
44.610 +states:=[];
44.611 +CalcTree
44.612 +[(["functionTerm (x^3 * x^5)",
44.613 + "differentiateFor x", "derivative f_'_"],
44.614 + ("Isac.thy", ["derivative_of","function"],
44.615 + ["diff","after_simplification"]))];
44.616 +Iterator 1;
44.617 +moveActiveRoot 1;
44.618 +(* trace_rewrite := true;
44.619 + trace_script := true;
44.620 + *)
44.621 +autoCalculate 1 CompleteCalc;
44.622 +(* trace_rewrite := false;
44.623 + trace_script := false;
44.624 + *)
44.625 +val ((pt,p),_) = get_calc 1; show_pt pt;
44.626 +if p = ([], Res) andalso term2str (get_obj g_res pt (fst p)) = "8 * x ^^^ 7"
44.627 +then () else raise error "biegelinie.sml: 1st biegelin.7.27 changed";
44.628 +
44.629 +"-----------------------------------------------------------------";
44.630 +states:=[];
44.631 +CalcTree
44.632 +[(["functionTerm ((x^3)^5)",
44.633 + "differentiateFor x", "derivative f_'_"],
44.634 + ("Isac.thy", ["derivative_of","function"],
44.635 + ["diff","after_simplification"]))];
44.636 +Iterator 1;
44.637 +moveActiveRoot 1;
44.638 +autoCalculate 1 CompleteCalc;
44.639 +val ((pt,p),_) = get_calc 1; show_pt pt;
44.640 +if p = ([], Res) andalso term2str (get_obj g_res pt (fst p)) = "15 * x ^^^ 14"
44.641 +then () else raise error "biegelinie.sml: 1st biegelin.7.27 changed";
44.642 +
44.643 +
44.644 +
44.645 +"----------- autoCalculate differentiate_equality ----------------";
44.646 +"----------- autoCalculate differentiate_equality ----------------";
44.647 +"----------- autoCalculate differentiate_equality ----------------";
44.648 +states:=[];
44.649 +CalcTree
44.650 +[(["functionEq (A = s * (a - s))", "differentiateFor s", "derivativeEq f_'_"],
44.651 + ("Isac.thy", ["named","derivative_of","function"],
44.652 + ["diff","differentiate_equality"]))];
44.653 +Iterator 1;
44.654 +moveActiveRoot 1;
44.655 +autoCalculate 1 CompleteCalc;
44.656 +val ((pt,p),_) = get_calc 1; show_pt pt;
44.657 +
44.658 +
44.659 +"----------- tests for examples ----------------------------------";
44.660 +"----------- tests for examples ----------------------------------";
44.661 +"----------- tests for examples ----------------------------------";
44.662 +"----- parse errors";
44.663 +(*str2term "F = sqrt( y^2 - O) * (z + O^2)";
44.664 +str2term "O";*)
44.665 +str2term "OO";
44.666 +
44.667 +"----- thm 'diff_prod_const'";
44.668 +val subs = [(str2term "bdv", str2term "l")];
44.669 +val f = str2term "G' = d_d l (l * sqrt (7 * s ^ 2 - l ^ 2))";
44.670 +(*
44.671 +trace_rewrite := true;
44.672 +rewrite_inst_ Isac.thy tless_true erls_diff true subs diff_prod_const f;
44.673 +trace_rewrite := false;
44.674 +*)
44.675 +
44.676 +"------------inform for x^2+x+1 ----------------------------------";
44.677 +"------------inform for x^2+x+1 ----------------------------------";
44.678 +"------------inform for x^2+x+1 ----------------------------------";
44.679 +states:=[];
44.680 +CalcTree
44.681 +[(["functionTerm (x^2 + x + 1)",
44.682 + "differentiateFor x", "derivative f_'_"],
44.683 + ("Isac.thy", ["derivative_of","function"],
44.684 + ["diff","differentiate_on_R"]))];
44.685 +Iterator 1;
44.686 +moveActiveRoot 1;
44.687 +autoCalculate 1 CompleteCalcHead;
44.688 +autoCalculate 1 (Step 1);
44.689 +autoCalculate 1 (Step 1);
44.690 +autoCalculate 1 (Step 1);
44.691 +val ((pt,p),_) = get_calc 1; show_pt pt;
44.692 +appendFormula 1 "2*x + d_d x x + d_d x 1";
44.693 +val ((pt,p),_) = get_calc 1; show_pt pt;
44.694 +if existpt' ([3], Res) pt then ()
44.695 +else raise error "diff.sml: inform d_d x (x^2 + x + 1) doesnt work";
45.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
45.2 +++ b/test/Tools/isac/Knowledge/diffapp.sml Mon Aug 30 14:35:51 2010 +0200
45.3 @@ -0,0 +1,752 @@
45.4 +(* tests for IsacKnowledge/DiffApp
45.5 + author Walther Neuper 000301
45.6 + (c) due to copyright terms
45.7 +
45.8 + use"../smltest/IsacKnowledge/diffapp.sml";
45.9 + use"diffapp.sml";
45.10 +*)
45.11 +
45.12 +"Contents----------------------------------------------";
45.13 +" Specify_Problem (match_itms_oris) ";
45.14 +" test specify, fmz <> [] ";
45.15 +" test specify, fmz = [] ";
45.16 +" problemtypes + formalizations ";
45.17 +"-------------------- ptree of {(a,b). is-max ... ----------------";
45.18 +"--------- me .. scripts for maximum-example ---------------------";
45.19 +"--------- autoCalc .. scripts for maximum-example ---------------";
45.20 +
45.21 +"--------------------- 30.4.03: maximum .. rewrite_set_ list_rls ---------";
45.22 +"---------------------- 1.5.03: Make_fun_by_explicit ---------------------";
45.23 +"---------------------- 2.5.03: Make_fun_by_new_variable -----------------";
45.24 +
45.25 +
45.26 +
45.27 +
45.28 +
45.29 +" #################################################### ";
45.30 +" problemtypes + formalizations ";
45.31 +" #################################################### ";
45.32 +" -------------- [maximum_of,function] --------------- ";
45.33 +val pbt =
45.34 + ["fixedValues fix_","maximum m_","valuesFor vs_","relations rs_"];
45.35 +map (the o (parseold thy)) pbt;
45.36 +val fmz =
45.37 + ["fixedValues [r=Arbfix]","maximum A",
45.38 + "valuesFor [a,b]",
45.39 + "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
45.40 + "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
45.41 + "relations [A=a*b, a/2=r*sin alpha, b/2=r*cos alpha]",
45.42 +
45.43 + "boundVariable a","boundVariable b","boundVariable alpha",
45.44 + "interval {x::real. 0 <= x & x <= 2*r}",
45.45 + "interval {x::real. 0 <= x & x <= 2*r}",
45.46 + "interval {x::real. 0 <= x & x <= pi}",
45.47 + "errorBound (eps=(0::real))"];
45.48 +map (the o (parseold thy)) fmz;
45.49 +" -------------- [make,function] -------------- ";
45.50 +val pbt =
45.51 + ["functionOf f_","boundVariable v_","equalities eqs_",
45.52 + "functionTerm f_0_"];
45.53 +map (the o (parseold thy)) pbt;
45.54 +val fmz12 =
45.55 + ["functionOf A","boundVariable a","boundVariable b",
45.56 + "equalities [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
45.57 + (*28.11.00: "functionTerm (A_0=Undef)"*)"functionTerm (Undef)"];
45.58 +map (the o (parseold thy)) fmz12;
45.59 +val fmz3 =
45.60 + ["functionOf A","boundVariable a","boundVariable b",
45.61 + "equalities [A=a*b, a/2=r*sin alpha, b/2=r*cos alpha]",
45.62 + (*28.11.00: "functionTerm (A_0=Undef)"*)"functionTerm (Undef)"];
45.63 +map (the o (parseold thy)) fmz3;
45.64 +" --------- [univar,equation] --------- ";
45.65 +val pbt =
45.66 + ["equality e_","solveFor v_","solutions v_i_"];
45.67 +map (the o (parseold thy)) pbt;
45.68 +val fmz =
45.69 + ["equality ((a/2)^^^2 + (b/2)^^^2 = r^^^2)",
45.70 + "solveFor b","solutions b_i"];
45.71 +map (the o (parseold thy)) fmz;
45.72 +" ---- [on_interval,maximum_of,function] ---- ";
45.73 +val pbt =
45.74 + ["functionTerm t_","boundVariable v_","interval itv_",
45.75 + "errorBound err_","maxArgument v_0_"];
45.76 +map (the o (parseold thy)) pbt;
45.77 +val fmz12 =
45.78 + [(*28.11.00: "functionTerm (A_0 = a*sqrt(#4*r^^^#2 - a^^^#2))",*)
45.79 + "functionTerm (a*sqrt(4*r^^^2 - a^^^2))",
45.80 + (*28.11.00: "functionTerm (A_0 = b*sqrt(#4*r^^^#2 - b^^^#2))",*)
45.81 + "functionTerm (b*sqrt(4*r^^^2 - b^^^2))",
45.82 + "boundVariable a","boundVariable b",
45.83 + "interval {x::real. 0 <= x & x <= 2*r}",
45.84 + "errorBound (eps=0)","maxArgument (a_0=Undef)"];
45.85 +map (the o (parseold thy)) fmz12;
45.86 +val fmz3 =
45.87 + [(*28.11.00: "functionTerm (A_0 = (#2*r*sin alpha)*(#2*r*cos alpha))",*)
45.88 + "functionTerm ((2*r*sin alpha)*(2*r*cos alpha))",
45.89 + "boundVariable alpha",
45.90 + "interval {x::real. 0 <= x & x <= pi}",
45.91 + "errorBound (eps=0)","maxArgument (a_0=Undef)"];
45.92 +map (the o (parseold thy)) fmz3;
45.93 +" --------- [derivative_of,function] --------- ";
45.94 +val pbt =
45.95 + ["functionTerm f_","boundVariable v_","derivative f_'_"];
45.96 +map (the o (parseold thy)) pbt;
45.97 +val fmz =
45.98 + [(*28.11.00: "functionTerm (A_0=a*#2*sqrt r^^^#2 - (a//#2)^^^#2)",*)
45.99 + "functionTerm (a*2*sqrt r^^^2 - (a/2)^^^2)",
45.100 + "boundVariable a",
45.101 + (*28.11.00: "derivative (A_0'=Undef)"*)"derivative (Undef)"];
45.102 +map (the o (parseold thy)) fmz;
45.103 +" --------- [find_values,tool] --------- ";
45.104 +val pbt =
45.105 + ["maxArgument ma_","functionTerm f_","boundVariable v_",
45.106 + "valuesFor vls_","additionalRels rs_"];
45.107 +map (the o (parseold thy)) pbt;
45.108 +val fmz1 =
45.109 + ["maxArgument (a_0=(srqt 2)*r)",
45.110 + (*28.11.00: "functionTerm (A_0=a*#2*sqrt r^^^#2 - (a//#2)^^^#2)",*)
45.111 + "functionTerm (a*2*sqrt r^^^2 - (a/2)^^^2)",
45.112 + "boundVariable a",
45.113 + "valuesFor [a,b]","maximum A",
45.114 + "additionalRels [(a/2)^^^2 + (b/2)^^^2 = r^^^2]"];
45.115 +map (the o (parseold thy)) fmz1;
45.116 +
45.117 +
45.118 +
45.119 +"-------------------- ptree of {(a,b). is-max ... --------------------------";
45.120 +"-------------------- ptree of {(a,b). is-max ... --------------------------";
45.121 +"-------------------- ptree of {(a,b). is-max ... --------------------------";
45.122 +
45.123 +(* Teil von max-on-surface.sml,
45.124 + der nach Init_Proof -> prep_ori wieder l"auft
45.125 + (f"ur tests mit neuer pos')
45.126 + use"test-max-surf1.sml";
45.127 +
45.128 + Compiler.Control.Print.printDepth:=7; (*4 is default*)
45.129 + Compiler.Control.Print.printDepth:=4; (*4 is default*)
45.130 + *)
45.131 +
45.132 +(* --vvv-- ausgeliehen von test-root-equ/sml *)
45.133 +val loc = e_istate;
45.134 +val (dI',pI',mI') =
45.135 + ("Script.thy",["sqroot-test","univariate","equation"],
45.136 + ["Script","squ-equ-test2"]);
45.137 +val fmz = ["equality (sqrt(9+4*x)=sqrt x + sqrt(5+x))",
45.138 + "solveFor x","errorBound (eps=0)",
45.139 + "solutions L"];
45.140 +(*
45.141 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
45.142 +val ((p,p_),_,_,_,_,(_,pt,_)) = do_ (mI,m) e_pos'[1](e_scr,EmptyPtree,[]);
45.143 + --^^^-- ausgeliehen von test-root-equ/sml *)
45.144 +(*-------------- 9.6.03 --- cappend_ ... term -------irreparabler test
45.145 +val (pt,_) =
45.146 + cappend_problem EmptyPtree [] loc ([],(dI',pI',mI'));
45.147 +val pos = (lev_on o lev_dn) [];
45.148 +(* val pos = ([1]) *)
45.149 +val (pt,_) = cappend_parent pt pos loc "{(a,b). is-max ..."
45.150 + Empty_Tac TransitiveB;
45.151 +val pos = (lev_on o lev_dn) pos;
45.152 +(*val pos = ([1,1])*)
45.153 +val (pt,_) = cappend_atomic pt pos loc "{(a,b). is-max ..."
45.154 + Empty_Tac ("[1,1]:{(a,b). is-extremum ...",[]) Complete;
45.155 +val pos = lev_on pos;
45.156 +(*val pos = ([1,2])*)
45.157 +val (pt,_) = cappend_atomic pt pos loc "{(a,b). is-extremum ..."
45.158 + Empty_Tac ("[1,2]:{(a,b). f_x(a,b) ...",[]) Complete;
45.159 +val pos = lev_up pos;
45.160 +(*val pos = ([1])*)
45.161 +val (pt,_) = append_result pt pos e_istate ("[1#]:{(a,b). f_x(a,b) ...",[])
45.162 + Complete;
45.163 +
45.164 +val pos = lev_on pos;
45.165 +(*val pos = ([2]) *)
45.166 +val (pt,_) = cappend_atomic pt pos loc "{(a,b). f_x(a,b) ..."
45.167 + Empty_Tac ("[2]:{(a,b). f_x & f_xx &...",[]) Complete;
45.168 +val pos = lev_on pos;
45.169 +(*al pos = [3] : pos*)
45.170 +val (pt,_) = cappend_parent pt pos loc "{(a,b). f_x & f_xx &..."
45.171 + Empty_Tac TransitiveB;
45.172 +val pos = (lev_on o lev_dn) pos;
45.173 +(*pos = ([3,1]) *)
45.174 +val (pt,_) = cappend_atomic pt pos loc "{(a,b). f_x & f_xx & ..."
45.175 + Empty_Tac ("[3,1]:{(a,b). f_x & f_xx } cup ...",[]) Complete;
45.176 +val pos = lev_on pos;
45.177 +(*pos = ([3,2]) *)
45.178 +val (pt,_) = cappend_atomic pt pos loc "{(a,b). f_x & f_xx } cup.."
45.179 + Empty_Tac ("[3,2]:{(a,b). f_x ..} cup ...",[]) Complete;
45.180 +
45.181 +val pos = lev_up pos;
45.182 +(*pos = ([3]) *)
45.183 +val (pt,_) = append_result pt pos e_istate ("[3#]:{(a,b). f_x ..} cup..",[])
45.184 + Complete;
45.185 +val pos = lev_on pos;
45.186 +(*val pos = [4] : pos *)
45.187 +val (pt,_) = cappend_parent pt pos loc "{(a,b). f_x ..} cup ..."
45.188 + Empty_Tac IntersectB;
45.189 +val pos = (lev_on o lev_dn) pos;
45.190 +(*val pos = ([4,1]) *)
45.191 +val (pt,_) = cappend_parent pt pos loc "set_1 = ..."
45.192 + Empty_Tac SequenceB;
45.193 +
45.194 +
45.195 +val pos = (lev_on o lev_dn) pos;
45.196 +(*val pos = ([4,1,1]) *)
45.197 +val (pt,_) = cappend_parent(*pbl*) pt pos loc"f_x = d/dx x^3 ..."
45.198 + Empty_Tac TransitiveB;
45.199 +val pos = (lev_on o lev_dn) pos;
45.200 +(*val pos = ([4,1,1,1]) *)
45.201 +val (pt,_) = cappend_parent pt pos loc "d/dx x^3 ..."
45.202 + Empty_Tac TransitiveB;
45.203 +val pos = (lev_on o lev_dn) pos;
45.204 +(*val pos = ([4,1,1,1,1]) *)
45.205 +val (pt,_) = cappend_atomic pt pos loc "d/dx x^3 ..."
45.206 + Empty_Tac ("[4,1,1,1,1]:3x^2 + d/dx ...",[]) Complete;
45.207 +val pos = lev_on pos;
45.208 +(*val pos = ([4,1,1,1,2]) *)
45.209 +val (pt,_) = cappend_atomic pt pos loc "3x^2 + d/dx ..."
45.210 + Empty_Tac ("[4,1,1,1,2]:3x^2 + 0 + d/dx ...",[]) Complete;
45.211 +val pos = lev_on pos;
45.212 +(*pos = ([4,1,1,1,3]) *)
45.213 +val (pt,_) = cappend_atomic pt pos loc "3x^2 + 0 + d/dx ..."
45.214 + Empty_Tac ("[4,1,1,1,3]:3x^2 + 0 -3 ...",[]) Complete;
45.215 +"--- 1 ---";
45.216 +val pos = lev_up pos;
45.217 +(*pos = ([4,1,1,1]) *)
45.218 +val (pt,_) = append_result pt pos e_istate ("[4,1,1,1#]:3x^2 -3.",[])Complete;
45.219 +"--- 2 ---";
45.220 +val pos = lev_up pos;
45.221 +(*val pos = ([4,1,1]) *)
45.222 +val (pt,_) = append_result pt pos e_istate ("[4,1,1#]:found 3x^2 -3 ...",[])
45.223 + Complete;
45.224 +"--- 3 ---";
45.225 +val pos = lev_on pos;
45.226 +(*val pos = ([4,1,2]+) *)
45.227 +val (pt,_) = cappend_parent(*pbl*) pt pos loc "f_y = d/dy x^3 ..."
45.228 + Empty_Tac TransitiveB;
45.229 +"--- 4 ---";
45.230 +writeln (pr_ptree pr_short pt);
45.231 +
45.232 +(*
45.233 +. ----- pblobj -----
45.234 +1. {(a,b). is-max ...
45.235 +1.1. {(a,b). is-max ...
45.236 +1.2. {(a,b). is-extremum ...
45.237 +2. {(a,b). f_x(a,b) ...
45.238 +3. {(a,b). f_x & f_xx &...
45.239 +3.1. {(a,b). f_x & f_xx & ...
45.240 +3.2. {(a,b). f_x & f_xx } cup..
45.241 +4. {(a,b). f_x ..} cup ...
45.242 +4.1. set_1 = ...
45.243 +4.1.1. f_x = d/dx x^3 ...
45.244 +4.1.1.1. d/dx x^3 ...
45.245 +4.1.1.1.1. d/dx x^3 ...
45.246 +4.1.1.1.2. 3x^2 + d/dx ...
45.247 +4.1.1.1.3. 3x^2 + 0 + d/dx ...
45.248 +4.1.2. f_y = d/dy x^3 ...
45.249 +
45.250 + use"test-max-surf1.sml";
45.251 + *)
45.252 +-------------- 9.6.03 --- cappend_ ... term -------irreparabler test---*)
45.253 +
45.254 +
45.255 +"--------- me .. scripts for maximum-example ---------------------";
45.256 +"--------- me .. scripts for maximum-example ---------------------";
45.257 +"--------- me .. scripts for maximum-example ---------------------";
45.258 +
45.259 +val fmz =
45.260 + ["fixedValues [r=Arbfix]","maximum A",
45.261 + "valuesFor [a,b]",
45.262 + "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
45.263 + "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
45.264 + "relations [A=a*b, a/2=r*sin alpha, b/2=r*cos alpha]",
45.265 +
45.266 + "boundVariable a","boundVariable b","boundVariable alpha",
45.267 + "interval {x::real. 0 <= x & x <= 2*r}",
45.268 + "interval {x::real. 0 <= x & x <= 2*r}",
45.269 + "interval {x::real. 0 <= x & x <= pi}",
45.270 + "errorBound (eps=(0::real))"];
45.271 +val (dI',pI',mI') =
45.272 + ("DiffApp.thy",["maximum_of","function"],
45.273 + ["DiffApp","max_by_calculus"]);
45.274 +
45.275 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
45.276 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.277 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.278 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.279 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.280 +val (p,_,f,nxt,_,pt) = (me nxt p c pt) handle e => print_exn e;
45.281 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.282 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.283 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.284 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.285 +case nxt of (_, Specify_Method ["DiffApp","max_by_calculus"]) => ()
45.286 + | _ => raise error "diffapp.sml: max-exp me, nxt = Specify_Method";
45.287 +
45.288 +val oris = fst3 (get_obj g_origin pt (fst p)); writeln(oris2str oris);
45.289 +val pits = get_obj g_pbl pt (fst p); writeln(itms2str_ ctxt pits);
45.290 +
45.291 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.292 +val mits = get_obj g_met pt (fst p); writeln(itms2str_ ctxt mits);
45.293 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.294 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.295 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.296 +case nxt of (_,Apply_Method ["DiffApp","max_by_calculus"] ) => ()
45.297 + | _ => raise error "diffapp.sml: max-exp me, nxt = Apply_Method";
45.298 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.299 +
45.300 +(*since 0508 Apply_Method does the 1st step, if NONE init_form -------------
45.301 +(*val nxt = ("Subproblem",Subproblem ("DiffApp.thy",["make","function"]))*)
45.302 +val (p,_,f,nxt,_,pt) = (me nxt p c pt) handle e => print_exn_G e;
45.303 +(*val nxt = ("Refine_Tacitly",Refine_Tacitly ["make","function"])*)
45.304 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.305 +(*val nxt = ("Model_Problem",Model_Problem ["by_explicit","make","function"])*)
45.306 +----------------------------------------------------------------------------*)
45.307 +case nxt of (_, Model_Problem(*["by_explicit", "make", "function"]*)) => ()
45.308 + | _ => raise error "diffapp.sml: max-exp me, nxt = Model_Problem";
45.309 +
45.310 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.311 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.312 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.313 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.314 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.315 +
45.316 +val oris = fst3 (get_obj g_origin pt (fst p));writeln(oris2str oris);
45.317 +val pits = get_obj g_pbl pt (fst p);writeln(itms2str_ ctxt pits);
45.318 +
45.319 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.320 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.321 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.322 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.323 +case nxt of (_, Apply_Method ["DiffApp", "make_fun_by_explicit"]) => ()
45.324 + | _ => raise error "diffapp.sml: max-exp Apply_Method ([1], Met) ";
45.325 +
45.326 +(*----since WN050901 (ie. corr. mathengine#nxt_specify_ ..nxt_spec Pbl->p_
45.327 +we get at ...
45.328 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.329 +...
45.330 +### assod: NotAss m= Subproblem' ,
45.331 + stac= Substitute
45.332 + [(b, (rhs o hd)
45.333 + (Subproblem (thy, [normalize, polynomial, univariate, equation])))]
45.334 + (hd (filterVar A [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]))
45.335 +*** stac2tac_ TODO: no match for Substitute
45.336 +*** [(b, (rhs o hd)
45.337 +*** (Subproblem (thy, [normalize, polynomial, univariate, equation])))]
45.338 +*** (hd (filterVar A [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]))
45.339 +Exception- ERROR raised
45.340 +
45.341 +############################################################################
45.342 +# presumerably didnt work before either, but not detected due to Emtpy_Tac #
45.343 +############################################################################
45.344 +
45.345 +(*val nxt = Subproblem ("DiffApp.thy",["univariate","equation"])) *)
45.346 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.347 +(*val nxt = Refine_Tacitly ["univariate","equation"])*)
45.348 +
45.349 +val oris = fst3 (get_obj g_origin pt (fst p));writeln(oris2str oris);
45.350 +val pits = get_obj g_pbl pt (fst p);writeln(itms2str_ ctxt pits);
45.351 +
45.352 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.353 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.354 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.355 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.356 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.357 +(*val nxt = ("Apply_Method",Apply_Method ["PolyEq","normalize_poly"])*)
45.358 +
45.359 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.360 +(*val f = Form' (FormKF (~1,EdUndef,3,Nundef,"A = a * b"))*)
45.361 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.362 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.363 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.364 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.365 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.366 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.367 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.368 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.369 +(*val f = Form' (FormKF (~1,EdUndef,4,Nundef,"[b = A / a]"))*)
45.370 +
45.371 +------------------------------------------------------------------------*)
45.372 +
45.373 +(*val f =
45.374 +Error' (Error_ "Refine_Tacitly [\"univariate\",\"equation\"] not applicable")*)
45.375 +
45.376 +
45.377 +(*----postponed.15.5.03 run scripts for maximum-example: univariate equation
45.378 +
45.379 +val (p,_,f,nxt,_,pt) = (me nxt p c pt) handle e => print_exn e;
45.380 +
45.381 +val oris = fst3 (get_obj g_origin pt (fst p));writeln(oris2str oris);
45.382 +
45.383 +val pits = get_obj g_pbl pt (fst p);writeln(itms2str_ ctxt pits);
45.384 +val pits = get_obj g_pbl pt [];writeln(itms2str_ ctxt pits);
45.385 +
45.386 +val mits = get_obj g_met pt (fst p);writeln(itms2str_ ctxt mits);
45.387 +val mits = get_obj g_met pt [];writeln(itms2str_ ctxt mits);
45.388 +
45.389 +itms2args thy ["DiffApp","max_by_calculus"] mits;
45.390 +
45.391 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.392 +
45.393 +---*)
45.394 +
45.395 +"--------- autoCalc .. scripts for maximum-example ---------------";
45.396 +"--------- autoCalc .. scripts for maximum-example ---------------";
45.397 +"--------- autoCalc .. scripts for maximum-example ---------------";
45.398 +(*++++++++ see systest/inform.sml 'complete_metitms' ++++++++*)
45.399 + states:=[];
45.400 +val fmz =
45.401 + ["fixedValues [r=Arbfix]","maximum A",
45.402 + "valuesFor [a,b]",
45.403 + "relations [A=a*b, (a/2)^2 + (b/2)^2 = r^2]",
45.404 + "relations [A=a*b, (a/2)^2 + (b/2)^2 = r^2]",
45.405 + "relations [A=a*b, a/2=r*sin alpha, b/2=r*cos alpha]",
45.406 +
45.407 + "boundVariable a","boundVariable b","boundVariable alpha",
45.408 + "interval {x::real. 0 <= x & x <= 2*r}",
45.409 + "interval {x::real. 0 <= x & x <= 2*r}",
45.410 + "interval {x::real. 0 <= x & x <= pi}",
45.411 + "errorBound (eps=(0::real))"];
45.412 +val (dI',pI',mI') =
45.413 + ("DiffApp.thy",["maximum_of","function"],
45.414 + ["DiffApp","max_by_calculus"]);
45.415 +
45.416 + CalcTree [(fmz, (dI',pI',mI'))];
45.417 + Iterator 1; moveActiveRoot 1;
45.418 + autoCalculate 1 CompleteCalcHead;
45.419 + refFormula 1 (get_pos 1 1);
45.420 +
45.421 + fetchProposedTactic 1;
45.422 + autoCalculate 1 (Step 1);
45.423 +
45.424 + fetchProposedTactic 1;
45.425 + autoCalculate 1 (Step 1);
45.426 + (*Subproblem on_interval maximum_of function*)
45.427 + autoCalculate 1 CompleteCalcHead;
45.428 +
45.429 + fetchProposedTactic 1;
45.430 + val ((pt,p),_) = get_calc 1;
45.431 + val mits = get_obj g_met pt (fst p);
45.432 + writeln (itms2str_ ctxt mits);
45.433 +(*
45.434 + if itms2str_ ctxt mits = "[\n(1 ,[1] ,true ,#Given ,Cor functionEq (hd rs_) ,(t_, [hd rs_])),\n(2 ,[1] ,true ,#Given ,Cor boundVariable v_ ,(v_, [v_])),\n(3 ,[1] ,true ,#Given ,Cor interval itv_ ,(itv_, [itv_])),\n(4 ,[1] ,true ,#Find ,Cor maxArgument v__0 ,(v_0_, [v__0]))]" then ()
45.435 + else raise error "diffapp.sml: diff.behav. in autoCalc .. scripts for max 1";
45.436 +*)
45.437 + (*FIXME: the environments contain identifers, and NOT values ?!?!?*)
45.438 +(* WN051209 while extending 'fun step' for initac, this became better ...
45.439 + if itms2str_ ctxt mits = "[\n(1 ,[1,2,3] ,true ,#Given ,Cor fixedValues [r = Arbfix] ,(fix_, [[r = Arbfix]])),\n(2 ,[1,2,3] ,true ,#Find ,Cor maximum A ,(m_, [A])),\n(3 ,[1,2,3] ,true ,#Find ,Cor valuesFor [a, b] ,(vs_, [[a],[b]])),\n(4 ,[1,2] ,true ,#Relate ,Cor relations [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2] ,(rs_, [[A = a * b],[(a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]])),\n(6 ,[1] ,true ,#undef ,Cor boundVariable a ,(v_, [a])),\n(9 ,[1,2] ,true ,#undef ,Cor interval {x. 0 <= x & x <= 2 * r} ,(itv_, [{x. 0 <= x & x <= 2 * r}])),\n(11 ,[1,2,3] ,true ,#undef ,Cor errorBound (eps = 0) ,(err_, [eps = 0]))]" then ()
45.440 + else raise error "diffapp.sml: diff.behav. in autoCalc .. scripts for max 1";
45.441 +*)
45.442 +
45.443 +
45.444 +
45.445 +"--------------------- 30.4.03: maximum .. rewrite_set_ list_rls ---------";
45.446 +"--------------------- 30.4.03: maximum .. rewrite_set_ list_rls ---------";
45.447 +"--------------------- 30.4.03: maximum .. rewrite_set_ list_rls ---------";
45.448 +str2term
45.449 + "Script Maximum_value(fix_::bool list)(m_::real) (rs_::bool list)\
45.450 + \ (v_::real) (itv_::real set) (err_::bool) = \
45.451 + \ (let e_ = (hd o (filterVar m_)) rs_; \
45.452 + \ t_ = (if 1 < length_ rs_ \
45.453 + \ then (SubProblem (Reals_,[make,function],[no_met])\
45.454 + \ [real_ m_, real_ v_, bool_list_ rs_])\
45.455 + \ else (hd rs_)); \
45.456 + \ (mx_::real) = SubProblem (Reals_,[on_interval,max_of,function], \
45.457 + \ [Isac,maximum_on_interval])\
45.458 + \ [bool_ t_, real_ v_, real_set_ itv_]\
45.459 + \ in ((SubProblem (Reals_,[find_values,tool],[Isac,find_values]) \
45.460 + \ [real_ mx_, real_ (Rhs t_), real_ v_, real_ m_, \
45.461 + \ bool_list_ (dropWhile (ident e_) rs_)])::bool list))";
45.462 +
45.463 +val fix_ = (str2term "fix_::bool list",
45.464 + str2term "[r=Arbfix]");
45.465 +val m_ = (str2term "m_::real",
45.466 + str2term "A");
45.467 +val rs_ = (str2term "rs_::bool list",
45.468 + str2term "[A = a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]");
45.469 +val v_ = (str2term "v_::real",
45.470 + str2term "b");
45.471 +val itv_ = (str2term "itv_::real set",
45.472 + str2term "{x::real. 0 <= x & x <= 2*r}");
45.473 +val err_ = (str2term "err_::bool",
45.474 + str2term "eps=0");
45.475 +val env = [fix_, m_, rs_ ,v_, itv_, err_];
45.476 +
45.477 +(*--- 1.line in script ---*)
45.478 +val t = str2term "(hd o (filterVar m_)) (rs_::bool list)";
45.479 +val s = subst_atomic env t;
45.480 +term2str s;
45.481 +"(hd o filterVar A) [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]";
45.482 +val SOME (s',_) = rewrite_set_ thy false list_rls s;
45.483 +val s'' = term2str s';
45.484 +if s''="A = a * b" then () else raise error "new behaviour with list_rls 1.1.";
45.485 +val env = env @ [(str2term "e_::bool",str2term "A = a * b")];
45.486 +
45.487 +(*--- 2.line: condition alone ---*)
45.488 +val t = str2term "1 < length_ (rs_::bool list)";
45.489 +val s = subst_atomic env t;
45.490 +term2str s;
45.491 +"1 < length_ [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]";
45.492 +val SOME (s',_) = rewrite_set_ thy false list_rls s;
45.493 +val s'' = term2str s';
45.494 +if s''="True" then () else raise error "new behaviour with list_rls 1.2.";
45.495 +
45.496 +(*--- 2.line in script ---*)
45.497 +val t = str2term
45.498 + "(if 1 < length_ rs_ \
45.499 + \ then (SubProblem (Reals_,[make,function],[no_met])\
45.500 + \ [real_ m_, real_ v_, bool_list_ rs_])\
45.501 + \ else (hd rs_))";
45.502 +val s = subst_atomic env t;
45.503 +term2str s;
45.504 +"if 1 < length_ [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]\
45.505 +\then SubProblem (Reals_, [make, function], [no_met])\
45.506 +\ [real_ A, real_ b,\
45.507 +\ bool_list_ [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]]\
45.508 +\else hd [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]";
45.509 +val SOME (s',_) = rewrite_set_ thy false list_rls s;
45.510 +val s'' = term2str s';
45.511 +if s'' =
45.512 +"SubProblem (Reals_, [make, function], [no_met])\n\
45.513 +\ [real_ A, real_ b,\n\
45.514 +\ bool_list_ [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]]" then ()
45.515 +else raise error "new behaviour with list_rls 1.3.";
45.516 +val env = env @ [(str2term "t_::bool",
45.517 + str2term "A = (2*sqrt(r^^^2-(b/2)^^^2)) * b")];
45.518 +
45.519 +
45.520 +
45.521 +"---------------------- 1.5.03: Make_fun_by_explicit ---------------------";
45.522 +"---------------------- 1.5.03: Make_fun_by_explicit ---------------------";
45.523 +"---------------------- 1.5.03: Make_fun_by_explicit ---------------------";
45.524 +str2term
45.525 + "Script Make_fun_by_explicit (f_::real) (v_::real) \
45.526 + \ (eqs_::bool list) = \
45.527 + \ (let h_ = (hd o (filterVar f_)) eqs_; \
45.528 + \ e_1 = hd (dropWhile (ident h_) eqs_); \
45.529 + \ vs_ = dropWhile (ident f_) (Vars h_); \
45.530 + \ v_1 = hd (dropWhile (ident v_) vs_); \
45.531 + \ (s_1::bool list)=(SubProblem(Reals_,[univar,equation],[no_met])\
45.532 + \ [bool_ e_1, real_ v_1])\
45.533 + \ in Substitute [(v_1 = (rhs o hd) s_1)] h_)";
45.534 +val f_ = (str2term "f_::real",
45.535 + str2term "A");
45.536 +val v_ = (str2term "v_::real",
45.537 + str2term "b");
45.538 +val eqs_=(str2term "eqs_::bool list",
45.539 + str2term "[A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]");
45.540 +val env = [f_, v_, eqs_];
45.541 +
45.542 +(*--- 1.line in script ---*)
45.543 +val t = str2term "(hd o (filterVar v_)) (eqs_::bool list)";
45.544 +val s = subst_atomic env t;
45.545 +term2str s;
45.546 +val t = str2term
45.547 + "(hd o filterVar b) [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]";
45.548 +val SOME (t',_) = rewrite_set_ thy false list_rls t;
45.549 +val s' = term2str t';
45.550 +if s' = "A = a * b" then () else raise error "new behaviour with list_rls 2.1";
45.551 +val env = env @ [(str2term "h_::bool", str2term s')];
45.552 +
45.553 +(*--- 2.line in script ---*)
45.554 +val t = str2term "hd (dropWhile (ident h_) (eqs_::bool list))";
45.555 +val s = subst_atomic env t;
45.556 +term2str s;
45.557 +val t = str2term
45.558 + "hd (dropWhile (ident (A = a * b))\
45.559 + \ [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2])";
45.560 +mem_rls "dropWhile_Cons" list_rls;
45.561 +mem_rls "Atools.ident" list_rls;
45.562 +val SOME (t',_) = rewrite_set_ thy false list_rls t;
45.563 +val s' = term2str t';
45.564 +if s' = "(a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2" then ()
45.565 +else raise error "new behaviour with list_rls 2.2";
45.566 +val env = env @ [(str2term "e_1::bool", str2term s')];
45.567 +
45.568 +(*--- 3.line in script ---*)
45.569 +val t = str2term "dropWhile (ident f_) (Vars (h_::bool))";
45.570 +val s = subst_atomic env t;
45.571 +term2str s;
45.572 +val t = str2term "dropWhile (ident A) (Vars (A = a * b))";
45.573 +val SOME (t',_) = rewrite_set_ thy false list_rls t;
45.574 +val s' = term2str t';
45.575 +if s' = "[a, b]" then () else raise error "new behaviour with list_rls 2.3";
45.576 +val env = env @ [(str2term "vs_::real list", str2term s')];
45.577 +
45.578 +(*--- 4.line in script ---*)
45.579 +val t = str2term "hd (dropWhile (ident v_) vs_)";
45.580 +val s = subst_atomic env t;
45.581 +term2str s;
45.582 +val t = str2term "hd (dropWhile (ident b) [a, b])";
45.583 +val SOME (t',_) = rewrite_set_ thy false list_rls t;
45.584 +val s' = term2str t';
45.585 +if s' = "a" then () else raise error "new behaviour with list_rls 2.4.";
45.586 +val env = env @ [(str2term "v_1::real", str2term s')];
45.587 +
45.588 +(*--- 5.line in script ---*)
45.589 +val t = str2term "(SubProblem(Reals_,[univar,equation],[no_met])\
45.590 + \ [bool_ e_1, real_ v_1])";
45.591 +val s = subst_atomic env t;
45.592 +term2str s;
45.593 +"SubProblem (Reals_, [univar, equation], [no_met])\n\
45.594 +\ [bool_ ((a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2), real_ a]";
45.595 +val env = env @ [(str2term "s_1::bool list",
45.596 + str2term "[a = 2 * sqrt (r^^^2 - (b/2)^^^2)]")];
45.597 +
45.598 +(*--- 6.line in script ---*)
45.599 +val t = str2term "Substitute [(v_1 = (rhs o hd) (s_1::bool list))] (h_::bool)";
45.600 +val s = subst_atomic env t;
45.601 +term2str s;
45.602 +val t = str2term
45.603 +"Substitute [(a = (rhs o hd) [a = 2 * sqrt (r ^^^ 2 - (b / 2) ^^^ 2)])]\n\
45.604 +\ (A = a * b)";
45.605 +mem_rls "Tools.rhs" list_rls;
45.606 +val SOME (t',_) = rewrite_set_ thy false list_rls t;
45.607 +val s' = term2str t';
45.608 +if s' = "Substitute [a = 2 * sqrt (r ^^^ 2 - (b / 2) ^^^ 2)] (A = a * b)"
45.609 +then () else raise error "new behaviour with list_rls 2.6.";
45.610 +
45.611 +
45.612 +"---------------------- 2.5.03: Make_fun_by_new_variable -----------------";
45.613 +"---------------------- 2.5.03: Make_fun_by_new_variable -----------------";
45.614 +"---------------------- 2.5.03: Make_fun_by_new_variable -----------------";
45.615 +str2term
45.616 + "Script Make_fun_by_new_variable (f_::real) (v_::real) \
45.617 + \ (eqs_::bool list) = \
45.618 + \(let h_ = (hd o (filterVar f_)) eqs_; \
45.619 + \ es_ = dropWhile (ident h_) eqs_; \
45.620 + \ vs_ = dropWhile (ident f_) (Vars h_); \
45.621 + \ v_1 = nth_ 1 vs_; \
45.622 + \ v_2 = nth_ 2 vs_; \
45.623 + \ e_1 = (hd o (filterVar v_1)) es_; \
45.624 + \ e_2 = (hd o (filterVar v_2)) es_; \
45.625 + \ (s_1::bool list) = (SubProblem (Reals_,[univar,equation],[no_met])\
45.626 + \ [bool_ e_1, real_ v_1]);\
45.627 + \ (s_2::bool list) = (SubProblem (Reals_,[univar,equation],[no_met])\
45.628 + \ [bool_ e_2, real_ v_2])\
45.629 + \in Substitute [(v_1 = (rhs o hd) s_1),(v_2 = (rhs o hd) s_2)] h_)";
45.630 +val f_ = (str2term "f_::real",
45.631 + str2term "A");
45.632 +val v_ = (str2term "v_::real",
45.633 + str2term "alpha");
45.634 +val eqs_=(str2term "eqs_::bool list",
45.635 + str2term "[A=a*b, a/2=r*sin alpha, b/2=r*cos alpha]");
45.636 +val env = [f_, v_, eqs_];
45.637 +
45.638 +(*--- 1.line in script ---*)
45.639 +val t = str2term "(hd o (filterVar (f_::real))) (eqs_::bool list)";
45.640 +val s = subst_atomic env t;
45.641 +term2str s;
45.642 +val t = str2term
45.643 +"(hd o filterVar A) [A = a * b, a / 2 = r * sin alpha, b / 2 = r * cos alpha]";
45.644 +trace_rewrite:=true;
45.645 +val SOME (t',_) = rewrite_set_ thy false list_rls t;
45.646 +trace_rewrite:=false;
45.647 +val s' = term2str t';
45.648 +if s' = "A = a * b" then() else raise error "new behaviour with list_rls 3.1.";
45.649 +val env = env @ [(str2term "h_::bool", str2term s')];
45.650 +
45.651 +(*--- 2.line in script ---*)
45.652 +val t = str2term "dropWhile (ident (h_::bool)) (eqs_::bool list)";
45.653 +val s = subst_atomic env t;
45.654 +term2str s;
45.655 +val t = str2term
45.656 +"dropWhile (ident (A = a * b))\
45.657 +\ [A = a * b, a / 2 = r * sin alpha, b / 2 = r * cos alpha]";
45.658 +val SOME (t',_) = rewrite_set_ thy false list_rls t;
45.659 +val s' = term2str t';
45.660 +if s' = "[a / 2 = r * sin alpha, b / 2 = r * cos alpha]"
45.661 +then () else raise error "new behaviour with list_rls 3.2.";
45.662 +val env = env @ [(str2term "es_::bool list", str2term s')];
45.663 +
45.664 +(*--- 3.line in script ---*)
45.665 +val t = str2term "dropWhile (ident (f_::real)) (Vars (h_::bool))";
45.666 +val s = subst_atomic env t;
45.667 +term2str s;
45.668 +val t = str2term "dropWhile (ident A) (Vars (A = a * b))";
45.669 +val SOME (t',_) = rewrite_set_ thy false list_rls t;
45.670 +val s' = term2str t';
45.671 +if s' = "[a, b]" then () else raise error "new behaviour with list_rls 3.3.";
45.672 +val env = env @ [(str2term "vs_::real list", str2term s')];
45.673 +
45.674 +(*--- 4.line in script ---*)
45.675 +val t = str2term "nth_ 1 vs_";
45.676 +val s = subst_atomic env t;
45.677 +term2str s;
45.678 +val t = str2term "nth_ 1 [a, b]";
45.679 +val SOME (t',_) = rewrite_set_ thy false list_rls t;
45.680 +val s' = term2str t';
45.681 +if s' = "a" then () else raise error "new behaviour with list_rls 3.4.";
45.682 +val env = env @ [(str2term "v_1", str2term s')];
45.683 +
45.684 +(*--- 5.line in script ---*)
45.685 +val t = str2term "nth_ 2 vs_";
45.686 +val s = subst_atomic env t;
45.687 +term2str s;
45.688 +val t = str2term "nth_ 2 [a, b]";
45.689 +val SOME (t',_) = rewrite_set_ thy false list_rls t;
45.690 +val s' = term2str t';
45.691 +if s' = "b" then () else raise error "new behaviour with list_rls 3.5.";
45.692 +val env = env @ [(str2term "v_2", str2term s')];
45.693 +
45.694 +(*--- 6.line in script ---*)
45.695 +val t = str2term "(hd o (filterVar v_1)) (es_::bool list)";
45.696 +val s = subst_atomic env t;
45.697 +term2str s;
45.698 +val t = str2term
45.699 + "(hd o filterVar a) [a / 2 = r * sin alpha, b / 2 = r * cos alpha]";
45.700 +val SOME (t',_) = rewrite_set_ thy false list_rls t;
45.701 +val s' = term2str t';
45.702 +if s' = "a / 2 = r * sin alpha" then ()
45.703 +else raise error "new behaviour with list_rls 3.6.";
45.704 +val e_1 = str2term "e_1::bool";
45.705 +val env = env @ [(e_1, str2term s')];
45.706 +
45.707 +(*--- 7.line in script ---*)
45.708 +val t = str2term "(hd o (filterVar v_2)) (es_::bool list)";
45.709 +val s = subst_atomic env t;
45.710 +term2str s;
45.711 +val t = str2term
45.712 + "(hd o filterVar b) [a / 2 = r * sin alpha, b / 2 = r * cos alpha]";
45.713 +val SOME (t',_) = rewrite_set_ thy false list_rls t;
45.714 +val s' = term2str t';
45.715 +if s' = "b / 2 = r * cos alpha" then ()
45.716 +else raise error "new behaviour with list_rls 3.7.";
45.717 +val env = env @ [(str2term "e_2::bool", str2term s')];
45.718 +
45.719 +(*--- 8.line in script ---*)
45.720 +val t = str2term "(SubProblem (Reals_,[univar,equation],[no_met])\
45.721 + \ [bool_ e_1, real_ v_1])";
45.722 +val s = subst_atomic env t;
45.723 +term2str s;
45.724 +"SubProblem (Reals_, [univar, equation], [no_met])\
45.725 + \ [bool_ (a / 2 = r * sin alpha), real_ a]";
45.726 +val s_1 = str2term "[a = 2*r*sin alpha]";
45.727 +val env = env @ [(str2term "s_1::bool list", s_1)];
45.728 +
45.729 +(*--- 9.line in script ---*)
45.730 +val t = str2term "(SubProblem (Reals_,[univar,equation],[no_met])\
45.731 + \ [bool_ e_2, real_ v_2])";
45.732 +val s = subst_atomic env t;
45.733 +term2str s;
45.734 +"SubProblem (Reals_, [univar, equation], [no_met])\
45.735 + \ [bool_ (b / 2 = r * cos alpha), real_ b]";
45.736 +val s_2 = str2term "[b = 2*r*cos alpha]";
45.737 +val env = env @ [(str2term "s_2::bool list", s_2)];
45.738 +
45.739 +(*--- 10.line in script ---*)
45.740 +val t = str2term
45.741 +"Substitute [(v_1 = (rhs o hd) s_1),(v_2 = (rhs o hd) s_2)] (h_::bool)";
45.742 +val s = subst_atomic env t;
45.743 +term2str s;
45.744 +"Substitute\n [(a = (rhs o hd) [a = 2 * r * sin alpha]),\
45.745 +\ (b = (rhs o hd) [b = 2 * r * cos alpha])] (A = a * b)";
45.746 +val SOME (s',_) = rewrite_set_ thy false list_rls s;
45.747 +val s'' = term2str s';
45.748 +if s'' =
45.749 +"Substitute [a = 2 * r * sin alpha, b = 2 * r * cos alpha] (A = a * b)"
45.750 +then () else raise error "new behaviour with list_rls 3.10.";
45.751 +
45.752 +
45.753 +
45.754 +
45.755 +
46.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
46.2 +++ b/test/Tools/isac/Knowledge/eqsystem.sml Mon Aug 30 14:35:51 2010 +0200
46.3 @@ -0,0 +1,1445 @@
46.4 +(* tests on systems of equations
46.5 + author: Walther Neuper
46.6 + 050826,
46.7 + (c) due to copyright terms
46.8 +
46.9 +use"../smltest/IsacKnowledge/eqsystem.sml";
46.10 +use"eqsystem.sml";
46.11 +*)
46.12 +val thy = EqSystem.thy;
46.13 +
46.14 +"-----------------------------------------------------------------";
46.15 +"table of contents -----------------------------------------------";
46.16 +"-----------------------------------------------------------------";
46.17 +"----------- occur_exactly_in ------------------------------------";
46.18 +"----------- problems --------------------------------------------";
46.19 +"----------- rewrite-order ord_simplify_System -------------------";
46.20 +"----------- rewrite in [EqSystem,normalize,2x2] -----------------";
46.21 +"----------- rewrite example from 2nd [EqSystem,normalize,2x2] ---";
46.22 +"----------- rewrite in [EqSystem,top_down_substitution,2x2] -----";
46.23 +"----------- rewrite in [EqSystem,normalize,4x4] -----------------";
46.24 +"----------- script [EqSystem,normalize,2x2] ---------------------";
46.25 +"----------- script [EqSystem,top_down_substitution,2x2] Vers.1 --";
46.26 +"----------- script [EqSystem,top_down_substitution,2x2] Vers.2 --";
46.27 +"----------- refine [linear,system]-------------------------------";
46.28 +"----------- refine [2x2,linear,system] search error--------------";
46.29 +"----------- me [EqSystem,normalize,2x2] -------------------------";
46.30 +"----------- me [linear,system] ..normalize..top_down_sub..-------";
46.31 +"----------- all systems from Biegelinie -------------------------";
46.32 +"----------- 4x4 systems from Biegelinie -------------------------";
46.33 +"-----------------------------------------------------------------";
46.34 +"-----------------------------------------------------------------";
46.35 +"-----------------------------------------------------------------";
46.36 +
46.37 +
46.38 +"----------- occur_exactly_in ------------------------------------";
46.39 +"----------- occur_exactly_in ------------------------------------";
46.40 +"----------- occur_exactly_in ------------------------------------";
46.41 +val all = [str2term"c", str2term"c_2", str2term"c_3"];
46.42 +val t = str2term"0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2";
46.43 +
46.44 +if occur_exactly_in [str2term"c", str2term"c_2"] all t
46.45 +then () else raise error "eqsystem.sml occur_exactly_in 1";
46.46 +
46.47 +if not (occur_exactly_in [str2term"c", str2term"c_2", str2term"c_3"] all t)
46.48 +then () else raise error "eqsystem.sml occur_exactly_in 2";
46.49 +
46.50 +if not (occur_exactly_in [str2term"c_2"] all t)
46.51 +then () else raise error "eqsystem.sml occur_exactly_in 3";
46.52 +
46.53 +
46.54 +val t = str2term"[c,c_2] from_ [c,c_2,c_3] occur_exactly_in \
46.55 + \-1 * q_0 * L ^^^ 2 / 2 + L * c + c_2";
46.56 +val SOME (str, t') = eval_occur_exactly_in 0 "EqSystem.occur'_exactly'_in" t 0;
46.57 +if str = "[c, c_2] from_ [c, c_2,\n c_3] occur_exactly_in -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2 = True" then ()
46.58 +else raise error "eval_occur_exactly_in [c, c_2]";
46.59 +
46.60 +val t = str2term"[c,c_2,c_3] from_ [c,c_2,c_3] occur_exactly_in \
46.61 + \-1 * q_0 * L ^^^ 2 / 2 + L * c + c_2";
46.62 +val SOME (str, t') = eval_occur_exactly_in 0 "EqSystem.occur'_exactly'_in" t 0;
46.63 +if str = "[c, c_2,\n c_3] from_ [c, c_2,\n c_3] occur_exactly_in -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2 = False" then ()
46.64 +else raise error "eval_occur_exactly_in [c, c_2, c_3]";
46.65 +
46.66 +val t = str2term"[c_2] from_ [c,c_2,c_3] occur_exactly_in \
46.67 + \-1 * q_0 * L ^^^ 2 / 2 + L * c + c_2";
46.68 +val SOME (str, t') = eval_occur_exactly_in 0 "EqSystem.occur'_exactly'_in" t 0;
46.69 +if str = "[c_2] from_ [c, c_2,\n c_3] occur_exactly_in -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2 = False" then ()
46.70 +else raise error "eval_occur_exactly_in [c, c_2, c_3]";
46.71 +
46.72 +val t = str2term"[] from_ [c,c_2,c_3] occur_exactly_in 0";
46.73 +val SOME (str, t') = eval_occur_exactly_in 0 "EqSystem.occur'_exactly'_in" t 0;
46.74 +if str = "[] from_ [c, c_2, c_3] occur_exactly_in 0 = True" then ()
46.75 +else raise error "eval_occur_exactly_in [c, c_2, c_3]";
46.76 +
46.77 +val t =
46.78 + str2term
46.79 + "[] from_ [c, c_2, c_3, c_4] occur_exactly_in -1 * (q_0 * L ^^^ 2) /2";
46.80 +val SOME (str, t') = eval_occur_exactly_in 0 "EqSystem.occur'_exactly'_in" t 0;
46.81 +if str = "[] from_ [c, c_2, c_3, c_4] occur_exactly_in \
46.82 + \-1 * (q_0 * L ^^^ 2) / 2 = True" then ()
46.83 +else raise error "eval_occur_exactly_in [c, c_2, c_3, c_4]";
46.84 +
46.85 +
46.86 +"----------- problems --------------------------------------------";
46.87 +"----------- problems --------------------------------------------";
46.88 +"----------- problems --------------------------------------------";
46.89 +val t = str2term "length_ [x+y=1,y=2] = 2";
46.90 +atomty t;
46.91 +val testrls = append_rls "testrls" e_rls
46.92 + [(Thm ("length_Nil_",num_str length_Nil_)),
46.93 + (Thm ("length_Cons_",num_str length_Cons_)),
46.94 + Calc ("op +", eval_binop "#add_"),
46.95 + Calc ("op =",eval_equal "#equal_")
46.96 + ];
46.97 +val SOME (t',_) = rewrite_set_ thy false testrls t;
46.98 +if term2str t' = "True" then ()
46.99 +else raise error "eqsystem.sml: length_ [x+y=1,y=2] = 2";
46.100 +
46.101 +val SOME t = parse EqSystem.thy "solution L";
46.102 +atomty (term_of t);
46.103 +val SOME t = parse Biegelinie.thy "solution L";
46.104 +atomty (term_of t);
46.105 +
46.106 +val t = str2term
46.107 +"(tl (tl (tl vs_))) from_ vs_ occur_exactly_in (nth_ 1 (es_::bool list))";
46.108 +atomty t;
46.109 +val t = str2term
46.110 +"(tl (tl (tl [c,c_2,c_3,c_4]))) from_ [c,c_2,c_3,c_4] occur_exactly_in \
46.111 +\(nth_ 1 [c_4 = 1, 2=2,3=3,4=4])";
46.112 +val SOME (t,_) =
46.113 + rewrite_set_ thy true
46.114 + (append_rls "prls_" e_rls
46.115 + [Thm ("nth_Cons_",num_str nth_Cons_),
46.116 + Thm ("nth_Nil_",num_str nth_Nil_),
46.117 + Thm ("tl_Cons",num_str tl_Cons),
46.118 + Thm ("tl_Nil",num_str tl_Nil),
46.119 + Calc ("EqSystem.occur'_exactly'_in",
46.120 + eval_occur_exactly_in
46.121 + "#eval_occur_exactly_in_")
46.122 + ]) t;
46.123 +if t = HOLogic.true_const then ()
46.124 +else raise error "eqsystem.sml ..occur_exactly_in (nth_ 1 [c_4..";
46.125 +
46.126 +
46.127 +"----------- rewrite-order ord_simplify_System -------------------";
46.128 +"----------- rewrite-order ord_simplify_System -------------------";
46.129 +"----------- rewrite-order ord_simplify_System -------------------";
46.130 +"M_b x = c * x + -1 * q_0 * (x ^^^ 2 / 2) + c_2";
46.131 +"--- add_commute ---";
46.132 +if ord_simplify_System false thy [] (str2term"-1 * q_0 * (x ^^^ 2 / 2)",
46.133 + str2term"c * x") then ()
46.134 +else raise error "integrate.sml, (-1 * q_0 * (x ^^^ 2 / 2)) < (c * x) not#1";
46.135 +
46.136 +if ord_simplify_System false thy [] (str2term"-1 * q_0 * (x ^^^ 2 / 2)",
46.137 + str2term"c_2") then ()
46.138 +else raise error "integrate.sml, (-1 * q_0 * (x ^^^ 2 / 2)) < (c_2) not#2";
46.139 +
46.140 +if ord_simplify_System false thy [] (str2term"c * x",
46.141 + str2term"c_2") then ()
46.142 +else raise error "integrate.sml, (c * x) < (c_2) not#3";
46.143 +
46.144 +"--- mult_commute ---";
46.145 +if ord_simplify_System false thy [] (str2term"x * c",
46.146 + str2term"c * x") then ()
46.147 +else raise error "integrate.sml, (x * c) < (c * x) not#4";
46.148 +
46.149 +if ord_simplify_System false thy [] (str2term"-1 * q_0 * (x ^^^ 2 / 2) * c",
46.150 + str2term"-1 * q_0 * c * (x ^^^ 2 / 2)")
46.151 +then () else raise error "integrate.sml, (. * .) < (. * .) not#5";
46.152 +
46.153 +if ord_simplify_System false thy [] (str2term"-1 * q_0 * (x ^^^ 2 / 2) * c",
46.154 + str2term"c * -1 * q_0 * (x ^^^ 2 / 2)")
46.155 +then () else raise error "integrate.sml, (. * .) < (. * .) not#6";
46.156 +
46.157 +
46.158 +"----------- rewrite in [EqSystem,normalize,2x2] -----------------";
46.159 +"----------- rewrite in [EqSystem,normalize,2x2] -----------------";
46.160 +"----------- rewrite in [EqSystem,normalize,2x2] -----------------";
46.161 +val t = str2term"[0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2,\
46.162 + \0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2]";
46.163 +val bdvs = [(str2term"bdv_1",str2term"c"),
46.164 + (str2term"bdv_2",str2term"c_2")];
46.165 +val SOME(t,_)= rewrite_set_inst_ thy true bdvs simplify_System_parenthesized t;
46.166 +if term2str t = "[0 = -1 * q_0 * L ^^^ 2 / 2 + (L * c + c_2), 0 = c_2]"
46.167 +then () else raise error "eqsystem.sml rewrite in 2x2 simplify_System_par.1";
46.168 +
46.169 +val SOME (t,_) = rewrite_set_inst_ thy true bdvs isolate_bdvs t;
46.170 +if term2str t = "[L * c + c_2 = 0 + -1 * (-1 * q_0 * L ^^^ 2 / 2), c_2 = 0]"
46.171 +then () else raise error "eqsystem.sml rewrite in 2x2 isolate_bdvs";
46.172 +
46.173 +val SOME(t,_)= rewrite_set_inst_ thy true bdvs simplify_System t;
46.174 +if term2str t = "[L * c + c_2 = q_0 * L ^^^ 2 / 2, c_2 = 0]"
46.175 +then () else raise error "eqsystem.sml rewrite in 2x2 simplify_System_par.2";
46.176 +
46.177 +val SOME (t,_) = rewrite_set_ thy true order_system t;
46.178 +if term2str t = "[c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]"
46.179 +then () else raise error "eqsystem.sml rewrite in 2x2 simplify_System_par.3";
46.180 +
46.181 +
46.182 +"----------- rewrite example from 2nd [EqSystem,normalize,2x2] ---";
46.183 +"----------- rewrite example from 2nd [EqSystem,normalize,2x2] ---";
46.184 +"----------- rewrite example from 2nd [EqSystem,normalize,2x2] ---";
46.185 +val thy = Isac.thy (*because of Undeclared constant "Biegelinie.EI*);
46.186 +val t =
46.187 + str2term"[0 = c_2 + c * 0 + 1 / EI * (L * q_0 / 12 * 0 ^^^ 3 + \
46.188 + \ -1 * q_0 / 24 * 0 ^^^ 4),\
46.189 + \ 0 = c_2 + c * L + 1 / EI * (L * q_0 / 12 * L ^^^ 3 + \
46.190 + \ -1 * q_0 / 24 * L ^^^ 4)]";
46.191 +val SOME (t,_) = rewrite_set_ thy true norm_Rational t;
46.192 +if term2str t="[0 = c_2, 0 = c_2 + L * c + L ^^^ 4 * q_0 / (EI * 24)]"
46.193 +then () else raise error "eqsystem.sml rewrite in 2x2 simplify_System_par.0b";
46.194 +
46.195 +val SOME(t,_)= rewrite_set_inst_ thy true bdvs simplify_System_parenthesized t;
46.196 +if term2str t = "[0 = c_2, 0 = q_0 * L ^^^ 4 / (24 * EI) + (L * c + c_2)]"
46.197 +then () else raise error "eqsystem.sml rewrite in 2x2 simplify_System_par.1b";
46.198 +
46.199 +val SOME (t,_) = rewrite_set_inst_ thy true bdvs isolate_bdvs t;
46.200 +if term2str t = "[c_2 = 0, L * c + c_2 = 0 + -1 * (q_0 * L ^^^ 4 / (24 * EI))]"
46.201 +then () else raise error "eqsystem.sml rewrite in 2x2 isolate_bdvs b";
46.202 +
46.203 +val SOME(t,_)= rewrite_set_inst_ thy true bdvs simplify_System t;
46.204 +if term2str t = "[c_2 = 0, L * c + c_2 = -1 * q_0 * L ^^^ 4 / (24 * EI)]"
46.205 +then () else raise error "eqsystem.sml rewrite in 2x2 simplify_System.2b";
46.206 +
46.207 +val xxx = rewrite_set_ thy true order_system t;
46.208 +if is_none xxx
46.209 +then () else raise error "eqsystem.sml rewrite in 2x2 simplify_System.3b";
46.210 +
46.211 +
46.212 +"----------- rewrite in [EqSystem,top_down_substitution,2x2] -----";
46.213 +"----------- rewrite in [EqSystem,top_down_substitution,2x2] -----";
46.214 +"----------- rewrite in [EqSystem,top_down_substitution,2x2] -----";
46.215 +val e1__ = str2term "c_2 = 77";
46.216 +val e2__ = str2term "L * c + c_2 = q_0 * L ^^^ 2 / 2";
46.217 +val bdvs = [(str2term"bdv_1",str2term"c"),
46.218 + (str2term"bdv_2",str2term"c_2")];
46.219 +val SOME (e2__,_) = rewrite_terms_ thy dummy_ord Erls [e1__] e2__;
46.220 +if term2str e2__ = "L * c + 77 = q_0 * L ^^^ 2 / 2" then ()
46.221 +else raise error "eqsystem.sml top_down_substitution,2x2] subst";
46.222 +
46.223 +val SOME (e2__,_) =
46.224 + rewrite_set_inst_ thy true bdvs simplify_System_parenthesized e2__;
46.225 +if term2str e2__ = "77 + L * c = q_0 * L ^^^ 2 / 2" then ()
46.226 +else raise error "eqsystem.sml top_down_substitution,2x2] simpl_par";
46.227 +
46.228 +val SOME (e2__,_) = rewrite_set_inst_ thy true bdvs isolate_bdvs e2__;
46.229 +if term2str e2__ = "c = (q_0 * L ^^^ 2 / 2 + -1 * 77) / L" then ()
46.230 +else raise error "eqsystem.sml top_down_substitution,2x2] isolate";
46.231 +
46.232 +val t = str2term "[c_2 = 77, c = (q_0 * L ^^^ 2 / 2 + -1 * 77) / L]";
46.233 +val SOME (t,_) = rewrite_set_ thy true order_system t;
46.234 +if term2str t = "[c = (q_0 * L ^^^ 2 / 2 + -1 * 77) / L, c_2 = 77]" then ()
46.235 +else raise error "eqsystem.sml top_down_substitution,2x2] order_system";
46.236 +
46.237 +if not (ord_simplify_System
46.238 + false thy []
46.239 + (str2term"[c_2 = 77, c = (q_0 * L ^^^ 2 / 2 + -1 * 77) / L]",
46.240 + str2term"[c = (q_0 * L ^^^ 2 / 2 + -1 * 77) / L, c_2 = 77]"))
46.241 +then () else raise error "eqsystem.sml, order_result rew_ord";
46.242 +
46.243 +trace_rewrite:=true;
46.244 +trace_rewrite:=false;
46.245 +
46.246 +
46.247 +"----------- rewrite in [EqSystem,normalize,4x4] -----------------";
46.248 +"----------- rewrite in [EqSystem,normalize,4x4] -----------------";
46.249 +"----------- rewrite in [EqSystem,normalize,4x4] -----------------";
46.250 +(*GOON??: revise rewrite in [EqSystem,normalize,4x4] from before 0609*)
46.251 +val t = str2term"[0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c_3 + c_4,\
46.252 + \0 = -1 * q_0 * L ^^^ 2 / 2 + L * c_3 + c_4,\
46.253 + \c + c_2 + c_3 + c_4 = 0,\
46.254 + \c_2 + c_3 + c_4 = 0]";
46.255 +val bdvs = [(str2term"bdv_1",str2term"c"),
46.256 + (str2term"bdv_2",str2term"c_2"),
46.257 + (str2term"bdv_3",str2term"c_3"),
46.258 + (str2term"bdv_4",str2term"c_4")];
46.259 +val SOME (t,_) =
46.260 + rewrite_set_inst_ thy true bdvs simplify_System_parenthesized t;
46.261 +if term2str t = "[0 = c_4, 0 = -1 * q_0 * L ^^^ 2 / 2 + (L * c_3 + c_4),\n\
46.262 + \ c + (c_2 + (c_3 + c_4)) = 0, c_2 + (c_3 + c_4) = 0]"
46.263 +then () else raise error "eqsystem.sml rewrite in 4x4 simplify_System_paren";
46.264 +
46.265 +val SOME (t,_) = rewrite_set_inst_ thy true bdvs isolate_bdvs t;
46.266 +if term2str t = "[c_4 = 0, \
46.267 + \L * c_3 + c_4 = 0 + -1 * (-1 * q_0 * L ^^^ 2 / 2),\n \
46.268 + \c + (c_2 + (c_3 + c_4)) = 0, c_2 + (c_3 + c_4) = 0]"
46.269 +then () else raise error "eqsystem.sml rewrite in 4x4 isolate_bdvs";
46.270 +
46.271 +val SOME(t,_)= rewrite_set_inst_ thy true bdvs simplify_System_parenthesized t;
46.272 +if term2str t = "[c_4 = 0,\
46.273 + \ L * c_3 + c_4 = q_0 * L ^^^ 2 / 2,\
46.274 + \ c + (c_2 + (c_3 + c_4)) = 0,\n\
46.275 + \ c_2 + (c_3 + c_4) = 0]"
46.276 +then () else raise error "eqsystem.sml rewrite in 4x4 simplify_System_p..2";
46.277 +
46.278 +val SOME (t,_) = rewrite_set_ thy true order_system t;
46.279 +if term2str t = "[c_4 = 0,\
46.280 + \ L * c_3 + c_4 = q_0 * L ^^^ 2 / 2,\
46.281 + \ c_2 + (c_3 + c_4) = 0,\n\
46.282 + \ c + (c_2 + (c_3 + c_4)) = 0]"
46.283 +then () else raise error "eqsystem.sml rewrite in 4x4 order_system";
46.284 +
46.285 +
46.286 +"----------- script [EqSystem,normalize,2x2] ---------------------";
46.287 +"----------- script [EqSystem,normalize,2x2] ---------------------";
46.288 +"----------- script [EqSystem,normalize,2x2] ---------------------";
46.289 +val str =
46.290 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.291 +\ (let es__ = (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.292 +\ simplify_System_parenthesized False) es_ \
46.293 +\ in ([]))";
46.294 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.295 +val str =
46.296 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.297 +\ (let es__ = (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.298 +\ simplify_System_parenthesized False) es_ \
46.299 +\ in (SubProblem (Biegelinie_,[linear,system],[no_met])\
46.300 +\ []))";
46.301 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.302 +val str =
46.303 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.304 +\ (let es__ = (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.305 +\ simplify_System_parenthesized False) es_ \
46.306 +\ in (SubProblem (Biegelinie_,[linear,system],[no_met])\
46.307 +\ [bool_list_ es__, real_list_ vs_]))"
46.308 +;
46.309 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.310 +val str =
46.311 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.312 +\ (let es__ = Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.313 +\ simplify_System_parenthesized False) es_ \
46.314 +\ in (SubProblem (Biegelinie_,[linear,system],[no_met])\
46.315 +\ [bool_list_ es__, real_list_ vs_]))"
46.316 +;
46.317 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.318 +val str =
46.319 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.320 +\ (let es__ = (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.321 +\ simplify_System_parenthesized False)) es_ \
46.322 +\ in (SubProblem (Biegelinie_,[linear,system],[no_met])\
46.323 +\ [bool_list_ es__, real_list_ vs_]))"
46.324 +;
46.325 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.326 +val str =
46.327 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.328 +\ (let es__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.329 +\ simplify_System_parenthesized False)) @@\
46.330 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.331 +\ simplify_System_parenthesized False))) es_\
46.332 +\ in (SubProblem (Biegelinie_,[linear,system],[no_met])\
46.333 +\ [bool_list_ es__, real_list_ vs_]))"
46.334 +;
46.335 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.336 +val str =
46.337 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.338 +\ (let es__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.339 +\ simplify_System_parenthesized False)) @@\
46.340 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.341 +\ simplify_System_parenthesized False)) @@\
46.342 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.343 +\ simplify_System_parenthesized False))) es_\
46.344 +\ in (SubProblem (Biegelinie_,[linear,system],[no_met])\
46.345 +\ [bool_list_ es__, real_list_ vs_]))"
46.346 +;
46.347 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.348 +val str =
46.349 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.350 +\ (let es__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.351 +\ simplify_System_parenthesized False)) @@\
46.352 +\ (Try (Rewrite_Set_Inst [] isolate_bdvs False)) @@\
46.353 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.354 +\ simplify_System_parenthesized False)) @@\
46.355 +\ (Try (Rewrite_Set order_system False))) es_\
46.356 +\ in (SubProblem (Biegelinie_,[linear,system],[no_met])\
46.357 +\ [bool_list_ es__, real_list_ vs_]))"
46.358 +;
46.359 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.360 +val str =
46.361 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.362 +\ (let es__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.363 +\ simplify_System_parenthesized False)) @@\
46.364 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_)]\
46.365 +\ isolate_bdvs False)) @@\
46.366 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.367 +\ simplify_System_parenthesized False)) @@\
46.368 +\ (Try (Rewrite_Set order_system False))) es_\
46.369 +\ in (SubProblem (Biegelinie_,[linear,system],[no_met])\
46.370 +\ [bool_list_ es__, real_list_ vs_]))"
46.371 +;
46.372 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.373 +val str =
46.374 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.375 +\ (let es__ = ((Try (Rewrite_Set simplify_System_parenthesized False)) @@\
46.376 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.377 +\ isolate_bdvs False)) @@\
46.378 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.379 +\ simplify_System_parenthesized False)) @@\
46.380 +\ (Try (Rewrite_Set order_system False))) es_\
46.381 +\ in (SubProblem (Biegelinie_,[linear,system],[no_met])\
46.382 +\ [bool_list_ es__, real_list_ vs_]))"
46.383 +;
46.384 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.385 +(*---^^^-OK-----------------------------------------------------------------*)
46.386 +(*---vvv-NOT ok-------------------------------------------------------------*)
46.387 +
46.388 +
46.389 +"----------- script [EqSystem,top_down_substitution,2x2] Vers.1 --";
46.390 +"----------- script [EqSystem,top_down_substitution,2x2] Vers.1 --";
46.391 +"----------- script [EqSystem,top_down_substitution,2x2] Vers.1 --";
46.392 +val str =
46.393 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.394 +\ (let es__ = (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.395 +\ simplify_System_parenthesized False) es_ \
46.396 +\ in ([]))";
46.397 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.398 +val str =
46.399 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.400 +\ (let e1__ = Take (hd es_) \
46.401 +\ in ([]))";
46.402 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.403 +val str =
46.404 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.405 +\ (let e1__ = Take (hd es_); \
46.406 +\ e1__ = Take (hd es_) \
46.407 +\ in ([]))";
46.408 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.409 +val str =
46.410 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.411 +\ (let e1__ = Take (hd es_); \
46.412 +\ e1__ = (Take (hd es_))\
46.413 +\ in ([]))";
46.414 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.415 +val str =
46.416 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.417 +\ (let e1__ = Take (hd es_); \
46.418 +\ e1__ = ((Rewrite_Set order_system False)) e1__\
46.419 +\ in ([]))";
46.420 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.421 +(*--------------------------------------------------------------------------*)
46.422 +val str =
46.423 +"(Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.424 +\ isolate_bdvs False) (e1__::bool)";
46.425 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.426 +(*--------------------------------------------------------------------------*)
46.427 +val str =
46.428 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.429 +\ (let e1__ = Take (hd es_); \
46.430 +\ e1__ = ((Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.431 +\ isolate_bdvs False)) e1__\
46.432 +\ in ([]))";
46.433 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.434 +val str =
46.435 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.436 +\ (let e1__ = Take (hd es_); \
46.437 +\ e1__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.438 +\ isolate_bdvs False)) @@\
46.439 +\ (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.440 +\ simplify_System False)) e1__\
46.441 +\ in ([]))";
46.442 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.443 +val str =
46.444 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.445 +\ (let e1__ = Take (hd es_); \
46.446 +\ e1__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.447 +\ isolate_bdvs False)) @@\
46.448 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.449 +\ simplify_System False))) e1__\
46.450 +\ in ([]))";
46.451 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.452 +val str =
46.453 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.454 +\ (let e1__ = Take (hd es_); \
46.455 +\ e1__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.456 +\ isolate_bdvs False)) @@ \
46.457 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.458 +\ simplify_System False))) e1__; \
46.459 +\ e2__ = Take (hd (tl es_)) \
46.460 +\ in ([]))";
46.461 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.462 +val str =
46.463 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.464 +\ (let e1__ = Take (hd es_); \
46.465 +\ e1__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.466 +\ isolate_bdvs False)) @@ \
46.467 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.468 +\ simplify_System False))) e1__; \
46.469 +\ e2__ = Take (hd (tl es_)); \
46.470 +\ e2__ = Substitute [e1__] e2__ \
46.471 +\ in ([]))";
46.472 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.473 +val str =
46.474 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.475 +\ (let e1__ = Take (hd es_); \
46.476 +\ e1__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.477 +\ isolate_bdvs False)) @@ \
46.478 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.479 +\ simplify_System False))) e1__; \
46.480 +\ e2__ = Take (hd (tl es_)); \
46.481 +\ e2__ = ((Substitute [e1__])) e2__ \
46.482 +\ in ([]))";
46.483 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.484 +val str =
46.485 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.486 +\ (let e1__ = Take (hd es_); \
46.487 +\ e1__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.488 +\ isolate_bdvs False)) @@ \
46.489 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.490 +\ simplify_System False))) e1__; \
46.491 +\ e2__ = Take (hd (tl es_)); \
46.492 +\ e2__ = ((Substitute [e1__]) @@ \
46.493 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.494 +\ isolate_bdvs False)) @@ \
46.495 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.496 +\ simplify_System False))) e2__ \
46.497 +\ in [e1__, e2__])"
46.498 +;
46.499 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.500 +val str =
46.501 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.502 +\ (let e1__ = Take (hd es_); \
46.503 +\ e1__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.504 +\ isolate_bdvs False)) @@ \
46.505 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.506 +\ simplify_System False))) e1__; \
46.507 +\ e2__ = Take (hd (tl es_)); \
46.508 +\ e2__ = ((Substitute [e1__]) @@ \
46.509 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.510 +\ simplify_System_parenthesized False)) @@ \
46.511 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.512 +\ isolate_bdvs False)) @@ \
46.513 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.514 +\ simplify_System False)) @@ \
46.515 +\ (Try (Rewrite_Set order_system False))) e2__ \
46.516 +\ in [e1__, e2__])"
46.517 +;
46.518 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.519 +(*---^^^-OK-----------------------------------------------------------------*)
46.520 +val str =
46.521 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.522 +\ (let e1__ = Take (hd es_); \
46.523 +\ e1__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.524 +\ isolate_bdvs False)) @@ \
46.525 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.526 +\ simplify_System False))) e1__; \
46.527 +\ e2__ = Take (hd (tl es_)); \
46.528 +\ e2__ = ((Substitute [e1__]) @@ \
46.529 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.530 +\ simplify_System_parenthesized False)) @@ \
46.531 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.532 +\ isolate_bdvs False)) @@ \
46.533 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.534 +\ simplify_System False))) e2__; \
46.535 +\ es__ = Take [e1__, e2__]\
46.536 +\ in (Try (Rewrite_Set order_system False)) es__)"
46.537 +;
46.538 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.539 +(*---vvv-NOT ok-------------------------------------------------------------*)
46.540 +atomty sc;
46.541 +
46.542 +"----------- script [EqSystem,top_down_substitution,2x2] Vers.2 --";
46.543 +"----------- script [EqSystem,top_down_substitution,2x2] Vers.2 --";
46.544 +"----------- script [EqSystem,top_down_substitution,2x2] Vers.2 --";
46.545 +val str =
46.546 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.547 +\ (let es__ = Take es_; \
46.548 +\ e1__ = hd es__\
46.549 +\ in ([]))"
46.550 +;
46.551 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.552 +val str =
46.553 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.554 +\ (let es__ = Take es_; \
46.555 +\ e1__ = hd es__; \
46.556 +\ e2__ = hd (tl es__)\
46.557 +\ in ([]))"
46.558 +;
46.559 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.560 +val str =
46.561 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.562 +\ (let es__ = Take es_; \
46.563 +\ e1__ = hd es__; \
46.564 +\ e2__ = hd (tl es__);\
46.565 +\ es__ = [1=2,3=4]\
46.566 +\ in ([]))"
46.567 +;
46.568 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.569 +val str =
46.570 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.571 +\ (let es__ = Take es_; \
46.572 +\ e1__ = hd es__; \
46.573 +\ e2__ = hd (tl es__);\
46.574 +\ es__ = [e1__,e2__]\
46.575 +\ in ([]))"
46.576 +;
46.577 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.578 +val str =
46.579 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.580 +\ (let es__ = Take es_; \
46.581 +\ e1__ = hd es__; \
46.582 +\ e2__ = hd (tl es__);\
46.583 +\ es__ = [e1__, Substitute [e1__] e2__];\
46.584 +\ es__ = (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.585 +\ simplify_System False)) es__ \
46.586 +\ in ([]))"
46.587 +;
46.588 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.589 +val str =
46.590 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.591 +\ (let es__ = Take es_; \
46.592 +\ e1__ = hd es__; \
46.593 +\ e2__ = hd (tl es__);\
46.594 +\ es__ = [e1__, Substitute [e1__] e2__];\
46.595 +\ es__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.596 +\ isolate_bdvs False)) @@ \
46.597 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.598 +\ simplify_System False))) es__ \
46.599 +\ in ([]))"
46.600 +;
46.601 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.602 +val str =
46.603 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.604 +\ (let es__ = Take es_; \
46.605 +\ e1__ = hd es__; \
46.606 +\ e2__ = hd (tl es__);\
46.607 +\ es__ = [e1__, Substitute [e1__] e2__];\
46.608 +\ es__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.609 +\ simplify_System_parenthesized False)) @@ \
46.610 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.611 +\ isolate_bdvs False)) @@ \
46.612 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.613 +\ simplify_System False))) es__ \
46.614 +\ in ([]))"
46.615 +;
46.616 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.617 +val str =
46.618 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.619 +\ (let es__ = Take es_; \
46.620 +\ e1__ = hd es__; \
46.621 +\ e2__ = hd (tl es__); \
46.622 +\ es__ = [e1__, Substitute [e1__] e2__]; \
46.623 +\ es__ = ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.624 +\ simplify_System_parenthesized False)) @@ \
46.625 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.626 +\ isolate_bdvs False)) @@ \
46.627 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.628 +\ simplify_System False))) es__ \
46.629 +\ in es__)"
46.630 +;
46.631 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.632 +val str =
46.633 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.634 +\ (let es__ = Take es_; \
46.635 +\ e1__ = hd es__; \
46.636 +\ e2__ = hd (tl es__); \
46.637 +\ es__ = [e1__, Substitute [e1__] e2__] \
46.638 +\ in ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.639 +\ simplify_System_parenthesized False)) @@ \
46.640 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))] \
46.641 +\ isolate_bdvs False)) @@ \
46.642 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.643 +\ simplify_System False))) es__)"
46.644 +;
46.645 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.646 +(*---^^^-OK-----------------------------------------------------------------*)
46.647 +val str =
46.648 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.649 +\ (let es__ = Take es_; \
46.650 +\ e1__ = hd es__; \
46.651 +\ e2__ = hd (tl es__); \
46.652 +\ es__ = [e1__, Substitute [e1__] e2__] "^
46.653 +(* this ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ is a script-'Expr'
46.654 + which is not yet searched for 'STac's; thus this script does not yet work*)
46.655 +" in ((Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.656 +\ simplify_System_parenthesized False)) @@ \
46.657 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))] \
46.658 +\ isolate_bdvs False)) @@ \
46.659 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.660 +\ simplify_System False))) es__)"
46.661 +;
46.662 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.663 +(*---vvv-NOT ok-------------------------------------------------------------*)
46.664 +atomty sc;
46.665 +
46.666 +
46.667 +"----------- refine [linear,system]-------------------------------";
46.668 +"----------- refine [linear,system]-------------------------------";
46.669 +"----------- refine [linear,system]-------------------------------";
46.670 +val fmz = ["equalities [0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2,\
46.671 + \0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2]",
46.672 + "solveForVars [c, c_2]", "solution L"];
46.673 +val matches = refine fmz ["linear","system"];
46.674 +case matches of [_,_,_,
46.675 + Matches (["normalize", "2x2", "linear", "system"],
46.676 + {Find = [Correct "solution L"],
46.677 + With = [],
46.678 + Given =
46.679 + [Correct
46.680 + "equalities\n [0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2,\n 0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2]",
46.681 + Correct "solveForVars [c, c_2]"],
46.682 + Where = [],
46.683 + Relate = []})] => ()
46.684 + | _ => raise error "eqsystem.sml refine ['normalize','2x2'...]";
46.685 +
46.686 +
46.687 +val fmz = ["equalities [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]",
46.688 + "solveForVars [c, c_2]", "solution L"];
46.689 +val matches = refine fmz ["linear","system"];
46.690 +case matches of [_,_,
46.691 + Matches
46.692 + (["triangular", "2x2", "linear", "system"],
46.693 + {Find = [Correct "solution L"],
46.694 + With = [],
46.695 + Given =
46.696 + [Correct
46.697 + "equalities [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]",
46.698 + Correct "solveForVars [c, c_2]"],
46.699 + Where =
46.700 + [Correct
46.701 + "tl [c, c_2] from_ [c, c_2] occur_exactly_in nth_ 1\n [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]",
46.702 + Correct
46.703 + "[c, c_2] from_ [c, c_2] occur_exactly_in nth_ 2\n [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]"],
46.704 + Relate = []})] => ()
46.705 + | _ => raise error "eqsystem.sml refine ['triangular','2x2'...]";
46.706 +
46.707 +
46.708 +(*WN051014----------------------------------------------------------------
46.709 + the above 'val matches = refine fmz ["linear","system"]'
46.710 + didn't work anymore; we investigated in these steps:*)
46.711 +val fmz = ["equalities [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]",
46.712 + "solveForVars [c, c_2]", "solution L"];
46.713 +val matches = refine fmz ["triangular", "2x2", "linear","system"];
46.714 +(*... resulted in
46.715 + False "[c, c_2] from_ [c, c_2] occur_exactly_in nth_ 2\n
46.716 + [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]"]*)
46.717 +
46.718 +val t = str2term"[c, c_2] from_ [c, c_2] occur_exactly_in nth_ 2\
46.719 + \[c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]";
46.720 +trace_rewrite:=true;
46.721 +val SOME (t',_) = rewrite_set_ thy false prls_triangular t;
46.722 +(*found:...
46.723 +## try thm: nth_Cons_
46.724 +### eval asms: 1 < 2 + - 1
46.725 +==> nth_ (2 + - 1) [L * c + c_2 = q_0 * L ^^^ 2 / 2] =
46.726 + nth_ (2 + - 1 + - 1) []
46.727 +#### rls: erls_prls_triangular on: 1 < 2 + - 1
46.728 +##### try calc: op <'
46.729 +### asms accepted: ["1 < 2 + - 1"] stored: ["1 < 2 + -1"]
46.730 +
46.731 +... i.e Calc ("op +", eval_binop "#add_") was missing in erls_prls_triangular*)
46.732 +trace_rewrite:=false;
46.733 +(*WN051014------------------------------------------------------------------*)
46.734 +
46.735 +"----- relaxed preconditions for triangular system";
46.736 +val fmz = ["equalities [L * q_0 = c, \
46.737 + \ 0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2,\
46.738 + \ 0 = c_4, \
46.739 + \ 0 = c_3]",
46.740 + "solveForVars [c, c_2, c_3, c_4]", "solution L"];
46.741 +val matches = refine fmz ["linear","system"];
46.742 +(* trace_rewrite := true;
46.743 + trace_rewrite := false;
46.744 + *)
46.745 +(*print_depth 6; matches; print_depth 3;*)
46.746 +case matches of
46.747 + [Matches (["linear", "system"], _),
46.748 + NoMatch (["2x2", "linear", "system"], _),
46.749 + NoMatch (["3x3", "linear", "system"], _),
46.750 + Matches (["4x4", "linear", "system"], _),
46.751 + NoMatch (["triangular", "4x4", "linear", "system"], _),
46.752 + Matches (["normalize", "4x4", "linear", "system"], _)] => ()
46.753 + | _ => raise error "eqsystem.sml: refine relaxed triangular sys NoMatch";
46.754 +(*WN060914 does NOT match, because 3rd and 4th equ are not ordered*)
46.755 +
46.756 +val fmz = ["equalities [L * q_0 = c, \
46.757 + \ 0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2,\
46.758 + \ 0 = c_3, \
46.759 + \ 0 = c_4]",
46.760 + "solveForVars [c, c_2, c_3, c_4]", "solution L"];
46.761 +val matches = refine fmz ["triangular", "4x4", "linear","system"];
46.762 +(* print_depth 11; matches; print_depth 3;
46.763 + *)
46.764 +case matches of
46.765 + [Matches (["triangular", "4x4", "linear", "system"], _)] => ()
46.766 + | _ => raise error "eqsystem.sml: refine relaxed triangular sys Matches";
46.767 +val matches = refine fmz ["linear","system"];
46.768 +
46.769 +
46.770 +"----------- refine [2x2,linear,system] search error--------------";
46.771 +"----------- refine [2x2,linear,system] search error--------------";
46.772 +"----------- refine [2x2,linear,system] search error--------------";
46.773 +(*didn't go into ["2x2", "linear", "system"];
46.774 + we investigated in these steps:*)
46.775 +val fmz = ["equalities [0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2,\
46.776 + \0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2]",
46.777 + "solveForVars [c, c_2]", "solution L"];
46.778 +trace_rewrite:=true;
46.779 +val matches = refine fmz ["2x2", "linear","system"];
46.780 +trace_rewrite:=false;
46.781 +print_depth 11; matches; print_depth 3;
46.782 +(*brought: 'False "length_ es_ = 2"'*)
46.783 +
46.784 +(*-----fun refin' (pblRD:pblRD) fmz pbls ((Ptyp (pI,[py],[])):pbt ptyp) =
46.785 +(* val ((pblRD:pblRD), fmz, pbls, ((Ptyp (pI,[py],[])):pbt ptyp)) =
46.786 + (rev ["linear","system"], fmz, [(*match list*)],
46.787 + ((Ptyp ("2x2",[get_pbt ["2x2","linear","system"]],[])):pbt ptyp));
46.788 + *)
46.789 +> show_types:=true; term2str (hd where_); show_types:=false;
46.790 +val it = "length_ (es_::real list) = (2::real)" : string
46.791 +
46.792 +=========================================================================\
46.793 +-------fun prep_pbt
46.794 +(* val (thy, (pblID, dsc_dats: (string * (string list)) list,
46.795 + ev:rls, ca: string option, metIDs:metID list)) =
46.796 + (EqSystem.thy, (["system"],
46.797 + [("#Given" ,["equalities es_", "solveForVars vs_"]),
46.798 + ("#Find" ,["solution ss___"](*___ is copy-named*))
46.799 + ],
46.800 + append_rls "e_rls" e_rls [(*for preds in where_*)],
46.801 + SOME "solveSystem es_ vs_",
46.802 + []));
46.803 + *)
46.804 +> val [("#Given", [equalities_es_, "solveForVars vs_"])] = gi;
46.805 +val equalities_es_ = "equalities es_" : string
46.806 +> val (dd, ii) = (split_did o term_of o the o (parse thy)) equalities_es_;
46.807 +> show_types:=true; term2str ii; show_types:=false;
46.808 +val it = "es_::bool list" : string
46.809 +~~~~~~~~~~~~~~~^^^^^^^^^ OK~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46.810 +
46.811 +> val {where_,...} = get_pbt ["2x2", "linear","system"];
46.812 +> show_types:=true; term2str (hd where_); show_types:=false;
46.813 +
46.814 +=========================================================================/
46.815 +
46.816 +
46.817 +
46.818 +-----fun refin' ff:
46.819 +> (writeln o (itms2str_ (thy2ctxt "Isac"))) itms;
46.820 +[
46.821 +(1 ,[1] ,true ,#Given ,Cor equalities
46.822 + [0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2,
46.823 + 0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2] ,(es_, [[0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2,
46.824 + 0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2]])),
46.825 +(2 ,[1] ,true ,#Given ,Cor solveForVars [c, c_2] ,(vs_, [[c, c_2]])),
46.826 +(3 ,[1] ,true ,#Find ,Cor solution L ,(ss___, [L]))]
46.827 +
46.828 +> (writeln o pres2str) pre';
46.829 +[
46.830 +(false, length_ es_ = 2),
46.831 +(true, length_ [c, c_2] = 2)]
46.832 +
46.833 +----- fun match_oris':
46.834 +> (writeln o (itms2str_ (thy2ctxt "Isac"))) itms;
46.835 +> (writeln o pres2str) pre';
46.836 +..as in refin'
46.837 +
46.838 +----- fun check_preconds'
46.839 +> (writeln o env2str) env;
46.840 +["
46.841 +(es_, [0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2,
46.842 + 0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2])","
46.843 +(vs_, [c, c_2])","
46.844 +(ss___, L)"]
46.845 +
46.846 +> val es_ = (fst o hd) env;
46.847 +val es_ = Free ("es_", "bool List.list") : Term.term
46.848 +
46.849 +> val pre1 = hd pres;
46.850 +atomty pre1;
46.851 +***
46.852 +*** Const (op =, [real, real] => bool)
46.853 +*** . Const (ListG.length_, real list => real)
46.854 +*** . . Free (es_, real list)
46.855 +~~~~~~~~~~~~~~~~~~~^^^^^^^^^ should be bool list~~~~~~~~~~~~~~~~~~~
46.856 +*** . Free (2, real)
46.857 +***
46.858 +
46.859 +THE REASON WAS A non-type-constrained variable IN #WHERE OF PROBLEM
46.860 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46.861 +*)
46.862 +
46.863 +
46.864 +"----------- me [EqSystem,normalize,2x2] -------------------------";
46.865 +"----------- me [EqSystem,normalize,2x2] -------------------------";
46.866 +"----------- me [EqSystem,normalize,2x2] -------------------------";
46.867 +val fmz = ["equalities [0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2,\
46.868 + \0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2]",
46.869 + "solveForVars [c, c_2]", "solution L"];
46.870 +val (dI',pI',mI') =
46.871 + ("Biegelinie.thy",["normalize", "2x2", "linear", "system"],
46.872 + ["EqSystem","normalize","2x2"]);
46.873 +val p = e_pos'; val c = [];
46.874 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
46.875 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.876 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.877 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.878 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.879 +case nxt of ("Specify_Method",_) => ()
46.880 + | _ => raise error "eqsystem.sml [EqSystem,normalize,2x2] specify";
46.881 +
46.882 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.883 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.884 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f(*["(bdv_1, c)", "(bdv_2, hd (tl [c, c_2] ... corrected srls; ran only AFTER use"RCODE-root.sml", store_met was NOT SUFFICIENT*);
46.885 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.886 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.887 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.888 +case nxt of
46.889 + (_, Subproblem ("Biegelinie.thy", ["triangular", "2x2", "linear",_])) => ()
46.890 + | _ => raise error "eqsystem.sml me [EqSystem,normalize,2x2] SubProblem";
46.891 +
46.892 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.893 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.894 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.895 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.896 +case nxt of
46.897 + (_, Specify_Method ["EqSystem", "top_down_substitution", "2x2"]) => ()
46.898 + | _ => raise error "eqsystem.sml me [EqSys...2x2] top_down_substitution";
46.899 +
46.900 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.901 +val PblObj {probl,...} = get_obj I pt [5];
46.902 + (writeln o (itms2str_ (thy2ctxt "Isac"))) probl;
46.903 +(*[
46.904 +(1 ,[1] ,true ,#Given ,Cor equalities [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2] ,(es_, [[c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]])),
46.905 +(2 ,[1] ,true ,#Given ,Cor solveForVars [c, c_2] ,(vs_, [[c, c_2]])),
46.906 +(3 ,[1] ,true ,#Find ,Cor solution ss___ ,(ss___, [ss___]))]
46.907 +*)
46.908 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.909 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.910 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.911 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.912 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.913 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.914 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.915 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.916 +case nxt of
46.917 + (_, Check_Postcond ["triangular", "2x2", "linear", "system"]) => ()
46.918 + | _ => raise error "eqsystem.sml me Subpbl .[EqSys...2x2] finished";
46.919 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.920 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.921 +if f2str f = "[c = L * q_0 / 2, c_2 = 0]" then ()
46.922 +else raise error "eqsystem.sml me [EqSys...2x2] finished f2str f";
46.923 +case nxt of
46.924 + (_, End_Proof') => ()
46.925 + | _ => raise error "eqsystem.sml me [EqSys...2x2] finished End_Proof'";
46.926 +
46.927 +
46.928 +"----------- me [linear,system] ..normalize..top_down_sub..-------";
46.929 +"----------- me [linear,system] ..normalize..top_down_sub..-------";
46.930 +"----------- me [linear,system] ..normalize..top_down_sub..-------";
46.931 +val fmz =
46.932 + ["equalities\
46.933 + \[0 = c_2 + c * 0 + 1 / EI * (L * q_0 / 12 * 0 ^^^ 3 + \
46.934 + \ -1 * q_0 / 24 * 0 ^^^ 4),\
46.935 + \ 0 = c_2 + c * L + 1 / EI * (L * q_0 / 12 * L ^^^ 3 + \
46.936 + \ -1 * q_0 / 24 * L ^^^ 4)]",
46.937 + "solveForVars [c, c_2]", "solution L"];
46.938 +val (dI',pI',mI') =
46.939 + ("Biegelinie.thy",["linear", "system"], ["no_met"]);
46.940 +val p = e_pos'; val c = [];
46.941 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
46.942 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.943 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.944 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.945 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.946 +case nxt of (_,Specify_Method ["EqSystem", "normalize", "2x2"]) => ()
46.947 + | _ => raise error "eqsystem.sml [linear,system] specify b";
46.948 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.949 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.950 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.951 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.952 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.953 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.954 +if f2str f =
46.955 +"[c_2 = 0, L * c + c_2 = -1 * q_0 * L ^^^ 4 / (24 * EI)]"
46.956 +then () else raise error "eqsystem.sml me simpl. before SubProblem b";
46.957 +case nxt of
46.958 + (_, Subproblem ("Biegelinie.thy", ["triangular", "2x2", "linear",_])) => ()
46.959 + | _ => raise error "eqsystem.sml me [linear,system] SubProblem b";
46.960 +
46.961 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.962 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.963 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.964 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.965 +case nxt of
46.966 + (_, Specify_Method ["EqSystem", "top_down_substitution", "2x2"]) => ()
46.967 + | _ => raise error "eqsystem.sml me [EqSys...2x2] top_down_substitution b";
46.968 +
46.969 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.970 +val PblObj {probl,...} = get_obj I pt [5];
46.971 + (writeln o (itms2str_ (thy2ctxt "Isac"))) probl;
46.972 +(*[
46.973 +(1 ,[1] ,true ,#Given ,Cor equalities [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2] ,(es_, [[c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]])),
46.974 +(2 ,[1] ,true ,#Given ,Cor solveForVars [c, c_2] ,(vs_, [[c, c_2]])),
46.975 +(3 ,[1] ,true ,#Find ,Cor solution ss___ ,(ss___, [ss___]))]
46.976 +*)
46.977 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.978 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.979 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.980 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.981 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.982 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.983 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.984 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.985 +case nxt of
46.986 + (_, Check_Postcond ["triangular", "2x2", "linear", "system"]) => ()
46.987 + | _ => raise error "eqsystem.sml me Subpbl .[EqSys...2x2] finished b";
46.988 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.989 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
46.990 +if f2str f =
46.991 +"[c = -1 * q_0 * L ^^^ 4 / (24 * EI * L), c_2 = 0]"
46.992 +then () else raise error "eqsystem.sml me [EqSys...2x2] finished f2str f b";
46.993 +case nxt of
46.994 + (_, End_Proof') => ()
46.995 + | _ => raise error "eqsystem.sml me [EqSys...2x2] finished End_Proof'" b;
46.996 +
46.997 +
46.998 +"----------- all systems from Biegelinie -------------------------";
46.999 +"----------- all systems from Biegelinie -------------------------";
46.1000 +"----------- all systems from Biegelinie -------------------------";
46.1001 +val subst = [(str2term "bdv_1", str2term "c"),
46.1002 + (str2term "bdv_2", str2term "c_2"),
46.1003 + (str2term "bdv_3", str2term "c_3"),
46.1004 + (str2term "bdv_4", str2term "c_4")];
46.1005 +"------- Bsp 7.27";
46.1006 +states:=[];
46.1007 +CalcTree [(["Traegerlaenge L","Streckenlast q_0","Biegelinie y",
46.1008 + "Randbedingungen [y 0 = 0, y L = 0, M_b 0 = 0, M_b L = 0]",
46.1009 + "FunktionsVariable x"],
46.1010 + ("Biegelinie.thy", ["Biegelinien"],
46.1011 + ["IntegrierenUndKonstanteBestimmen2"]))];
46.1012 +moveActiveRoot 1;
46.1013 +(*
46.1014 +trace_script := true; autoCalculate 1 CompleteCalc; trace_script := false;
46.1015 +##7.27## ordered substs
46.1016 + c_4 c_2
46.1017 +c c_2 c_3 c_4 c c_2 1->2: c
46.1018 + c_2 c_4
46.1019 +c c_2 c c_2 c_3 c_4 [2':c, 1:c_2, 3:c_4] -> 4:c_3*)
46.1020 +val t = str2term"[0 = c_4, \
46.1021 +\ 0 = c_4 + L * c_3 +(12 * L ^^^ 2 * c_2 + 4 * L ^^^ 3 * c + -1 * L ^^^ 4 * q_0) / (-24 * EI), \
46.1022 +\ 0 = c_2, \
46.1023 +\ 0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2]";
46.1024 +val SOME (t',_) = rewrite_set_ thy false isolate_bdvs_4x4 t;
46.1025 +term2str t';
46.1026 +"[c_4 = 0,\n (12 * L ^^^ 2 * c_2 + 4 * L ^^^ 3 * c + -1 * L ^^^ 4 * q_0) / (-24 * EI) =\n 0 + -1 * (c_4 + L * c_3),\n c_2 = 0, (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2 = 0]";
46.1027 +
46.1028 +
46.1029 +"----- 7.27 go through the rewrites in met_eqsys_norm_4x4";
46.1030 +val t = str2term "0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2";
46.1031 +val NONE = rewrite_set_ thy false norm_Rational t;
46.1032 +val SOME (t,_) =
46.1033 + rewrite_set_inst_ thy false subst simplify_System_parenthesized t;
46.1034 +term2str t = "0 = -1 * q_0 * L ^^^ 2 / 2 + (L * c + c_2)";
46.1035 +"--- isolate_bdvs_4x4";
46.1036 +(*
46.1037 +val SOME (t,_) = rewrite_set_inst_ thy false subst isolate_bdvs_4x4 t;
46.1038 +term2str t;
46.1039 +val SOME (t,_) = rewrite_set_inst_ thy false subst simplify_System t;
46.1040 +term2str t;
46.1041 +val SOME (t,_) = rewrite_set_ thy false order_system t;
46.1042 +term2str t;
46.1043 +*)
46.1044 +
46.1045 +"------- Bsp 7.28 ---------------vvvvvvvvvvvvv Momentenlinie postponed";
46.1046 +states:=[];
46.1047 +CalcTree [(["Traegerlaenge L","Momentenlinie (-q_0 / L * x^3 / 6)",
46.1048 + "Biegelinie y",
46.1049 + "Randbedingungen [y L = 0, y' L = 0]",
46.1050 + "FunktionsVariable x"],
46.1051 + ("Biegelinie.thy", ["vonMomentenlinieZu","Biegelinien"],
46.1052 + ["Biegelinien", "AusMomentenlinie"]))];
46.1053 +moveActiveRoot 1;
46.1054 +(*
46.1055 +trace_script := true; autoCalculate 1 CompleteCalc; trace_script := false;
46.1056 +*)
46.1057 +
46.1058 +"------- Bsp 7.69";
46.1059 +states:=[];
46.1060 +CalcTree [(["Traegerlaenge L","Streckenlast q_0","Biegelinie y",
46.1061 + "Randbedingungen [y 0 = 0, y L = 0, y' 0 = 0, y' L = 0]",
46.1062 + "FunktionsVariable x"],
46.1063 + ("Biegelinie.thy", ["Biegelinien"],
46.1064 + ["IntegrierenUndKonstanteBestimmen2"] ))];
46.1065 +moveActiveRoot 1;
46.1066 +(*
46.1067 +trace_script := true; autoCalculate 1 CompleteCalc; trace_script := false;
46.1068 +##7.69## ordered subst 2x2
46.1069 + c_4 c_3
46.1070 +c c_2 c_3 c_4 c c_2 c_3 1:c_3 -> 2:c c_2 2: c c_2
46.1071 + c_3 c_4
46.1072 +c c_2 c_3 c c_2 c_3 c_4 3:c_4 -> 4:c c_2 c_3 1:c_3 -> 4:c c_2*)
46.1073 +val t = str2term"[0 = c_4 + 0 / (-1 * EI), \
46.1074 +\ 0 = c_4 + L * c_3 + (12 * L ^^^ 2 * c_2 + 4 * L ^^^ 3 * c + -1 * L ^^^ 4 * q_0) / (-24 * EI), \
46.1075 +\ 0 = c_3 + 0 / (-1 * EI), \
46.1076 +\ 0 = c_3 + (6 * L * c_2 + 3 * L ^^^ 2 * c + -1 * L ^^^ 3 * q_0) / (-6 * EI)]";
46.1077 +
46.1078 +"------- Bsp 7.70";
46.1079 +states:=[];
46.1080 +CalcTree [(["Traegerlaenge L","Streckenlast q_0","Biegelinie y",
46.1081 + "Randbedingungen [Q 0 = q_0 * L, M_b L = 0, y 0 = 0, y' 0 = 0]",
46.1082 + "FunktionsVariable x"],
46.1083 + ("Biegelinie.thy", ["Biegelinien"],
46.1084 + ["IntegrierenUndKonstanteBestimmen2"] ))];
46.1085 +moveActiveRoot 1;
46.1086 +(*
46.1087 +trace_script := true; autoCalculate 1 CompleteCalc; trace_script := false;
46.1088 +##7.70## |subst
46.1089 +c |
46.1090 +c c_2 |1:c -> 2:c_2
46.1091 + c_3 |
46.1092 + c_4 | GOON test methods @@@@@@@@@@@@@@@@@@@@@@@@@@@*)
46.1093 +
46.1094 +"----- 7.70 go through the rewrites in met_eqsys_norm_4x4";
46.1095 +val t = str2term"[L * q_0 = c, \
46.1096 + \ 0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2,\
46.1097 + \ 0 = c_4, \
46.1098 + \ 0 = c_3]";
46.1099 +val SOME (t,_) =
46.1100 + rewrite_ thy e_rew_ord e_rls false (num_str commute_0_equality) t;
46.1101 +val SOME (t,_) =
46.1102 + rewrite_ thy e_rew_ord e_rls false (num_str commute_0_equality) t;
46.1103 +val SOME (t,_) =
46.1104 + rewrite_ thy e_rew_ord e_rls false (num_str commute_0_equality) t;
46.1105 +term2str t =
46.1106 + "[L * q_0 = c, (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2 = 0, c_4 = 0,\n c_3 = 0]";
46.1107 +val SOME (t,_) =
46.1108 + rewrite_set_inst_ thy false subst simplify_System_parenthesized t;
46.1109 +term2str t =
46.1110 +"[L * q_0 = c, -1 * q_0 * L ^^^ 2 / 2 + (L * c + c_2) = 0, c_4 = 0, c_3 = 0]";
46.1111 +val SOME (t,_) = rewrite_set_inst_ thy false subst isolate_bdvs_4x4 t;
46.1112 +term2str t =
46.1113 + "[c = (-1 * (L * q_0) + 0) / -1,\n L * c + c_2 = -1 * (-1 * q_0 * L ^^^ 2 / 2) + 0, c_4 = 0, c_3 = 0]";
46.1114 +val SOME (t,_) =
46.1115 + rewrite_set_inst_ thy false subst simplify_System_parenthesized t;
46.1116 +
46.1117 +term2str t ="[c = L * q_0, L * c + c_2 = q_0 * L ^^^ 2 / 2, c_4 = 0, c_3 = 0]";
46.1118 +val SOME (t,_) = rewrite_set_ thy false order_system t;
46.1119 +if term2str t ="[c = L * q_0, L * c + c_2 = q_0 * L ^^^ 2 / 2, c_3 = 0, c_4 = 0]" then ()
46.1120 +else raise error "eqsystem.sml: exp 7.70 normalize 4x4 by rewrite changed";
46.1121 +
46.1122 +
46.1123 +"----- 7.70 with met normalize: ";
46.1124 +val fmz = ["equalities \
46.1125 + \[L * q_0 = c, \
46.1126 + \ 0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2,\
46.1127 + \ 0 = c_4, \
46.1128 + \ 0 = c_3]",
46.1129 + "solveForVars [c, c_2, c_3, c_4]", "solution L"];
46.1130 +val (dI',pI',mI') =
46.1131 + ("Biegelinie.thy",["linear", "system"],["no_met"]);
46.1132 +val p = e_pos'; val c = [];
46.1133 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
46.1134 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.1135 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.1136 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.1137 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.1138 +case nxt of (_,Apply_Method ["EqSystem", "normalize", "4x4"]) => ()
46.1139 + | _ => raise error "eqsystem.sml [EqSystem,normalize,4x4] specify";
46.1140 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
46.1141 +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbb outcommented vvvvvvvvvvvvvvvvvvvvvv";
46.1142 +(*vvvWN080102 Exception- Match raised
46.1143 + since assod Rewrite .. Rewrite'_Set
46.1144 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
46.1145 +
46.1146 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
46.1147 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
46.1148 +
46.1149 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
46.1150 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
46.1151 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
46.1152 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
46.1153 +if f2str f ="[c = L * q_0, L * c + c_2 = q_0 * L ^^^ 2 / 2, c_3 = 0, c_4 = 0]"
46.1154 +then () else raise error "eqsystem.sml: exp 7.70 normalize 4x4 by met changed";
46.1155 +--------------------------------------------------------------------------*)
46.1156 +
46.1157 +"----- 7.70 with met top_down_: ";
46.1158 +"--- scr [EqSystem,top_down_substitution,4x4] -- a saved trial";
46.1159 +(*---vvv-this script failed with if ?!?-------------------------------------*)
46.1160 +val str =
46.1161 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.1162 +\ (let e1_ = hd es_; \
46.1163 +\ v1_ = hd vs_; \
46.1164 +\ xxx = if lhs e1_ =!= v1_ \
46.1165 +\ then 0=0 \
46.1166 +\ else let e1_ = Take e1_; \
46.1167 +\ e1_ = (Rewrite_Set_Inst [(bdv_1, hd vs_), \
46.1168 +\ (bdv_2, hd (tl vs_))] \
46.1169 +\ isolate_bdvs False) e1_; \
46.1170 +\ e2_ = Take (hd (tl es_)); \
46.1171 +\ e2_ = (Substitute [e1__]) e2_ \
46.1172 +\ in [e1_, e2_])";
46.1173 +(*val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;*)
46.1174 +val str =
46.1175 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.1176 +\ (let e1_ = hd es_; \
46.1177 +\ v1_ = hd vs_; \
46.1178 +\ e2_ = Take (hd (tl es_)); \
46.1179 +\ e2_ = (Substitute [e1__]) e2_ \
46.1180 +\ in [e1_, e2_])";
46.1181 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.1182 +(*---^^^-OK-----------------------------------------------------------------*)
46.1183 +(*---vvv-NOT ok-------------------------------------------------------------*)
46.1184 +val str =
46.1185 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.1186 +\ (let e1_ = hd es_; \
46.1187 +\ v1_ = hd vs_; \
46.1188 +\ xxx = if ((lhs e1_) =!= v1_) then 1 else 2; \
46.1189 +\ e2_ = Take (hd (tl es_)); \
46.1190 +\ e2_ = (Substitute [e1__]) e2_ \
46.1191 +\ in [e1_, e2_])";
46.1192 +(*val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;*)
46.1193 +val str = "if lhs e1_ =!= v1_ then 1 else 2";
46.1194 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.1195 +
46.1196 +val str = "let xxx = (if lhs e1_ =!= v1_ then 1 else 2) in xxx";
46.1197 +(*val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;*)
46.1198 +atomty sc; term2str sc;
46.1199 +
46.1200 +"--- scr [EqSystem,top_down_substitution,4x4] -- adapted only to 7.70";
46.1201 +val str =
46.1202 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.1203 +\ (let e2__ = Take (hd (tl es_)); \
46.1204 +\ e2__ = ((Substitute [e1__]) @@ \
46.1205 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.1206 +\ simplify_System_parenthesized False)) @@ \
46.1207 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.1208 +\ isolate_bdvs False)) @@ \
46.1209 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.1210 +\ simplify_System False))) e2__;\
46.1211 +\ es__ = Take [e1__, e2__] \
46.1212 +\ in (Try (Rewrite_Set order_system False)) es__)"
46.1213 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.1214 +val str =
46.1215 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.1216 +\ (let e2__ = Take (nth_ 2 es_); \
46.1217 +\ e2__ = ((Substitute [e1__]) @@ \
46.1218 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.1219 +\ simplify_System_parenthesized False)) @@ \
46.1220 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.1221 +\ isolate_bdvs False)) @@ \
46.1222 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, hd (tl vs_))]\
46.1223 +\ simplify_System False))) e2__;\
46.1224 +\ es__ = Take [e1__, e2__] \
46.1225 +\ in (Try (Rewrite_Set order_system False)) es__)"
46.1226 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.1227 +val str =
46.1228 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.1229 +\ (let e2__ = Take (nth_ 2 es_); \
46.1230 +\ e2__ = ((Substitute [e1__]) @@ \
46.1231 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, nth_ 2 vs_)] \
46.1232 +\ simplify_System_parenthesized False)) @@ \
46.1233 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, nth_ 2 vs_)]\
46.1234 +\ isolate_bdvs False)) @@ \
46.1235 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, nth_ 2 vs_)]\
46.1236 +\ simplify_System False))) e2__;\
46.1237 +\ es__ = Take [e1__, e2__] \
46.1238 +\ in (Try (Rewrite_Set order_system False)) es__)"
46.1239 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.1240 +val str =
46.1241 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.1242 +\ (let e2__ = Take (nth_ 2 es_); \
46.1243 +\ e2__ = ((Substitute [e1__]) @@ \
46.1244 +\ (Try (Rewrite_Set_Inst [(bdv_1,nth_ 1 vs_),(bdv_2,nth_ 2 vs_),\
46.1245 +\ (bdv_3,nth_ 3 vs_),(bdv_4,nth_ 4 vs_)]\
46.1246 +\ simplify_System_parenthesized False)) @@ \
46.1247 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, nth_ 2 vs_)] \
46.1248 +\ isolate_bdvs False)) @@ \
46.1249 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, nth_ 2 vs_)] \
46.1250 +\ norm_Rational False))) e2__; \
46.1251 +\ es__ = Take [e1__, e2__] \
46.1252 +\ in [])"
46.1253 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.1254 +val str =
46.1255 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.1256 +\ (let e2_ = Take (nth_ 2 es_); \
46.1257 +\ e2_ = ((Substitute [e1_]) @@ \
46.1258 +\ (Try (Rewrite_Set_Inst [(bdv_1,nth_ 1 vs_),(bdv_2,nth_ 2 vs_),\
46.1259 +\ (bdv_3,nth_ 3 vs_),(bdv_4,nth_ 4 vs_)]\
46.1260 +\ simplify_System_parenthesized False)) @@ \
46.1261 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, nth_ 2 vs_)] \
46.1262 +\ isolate_bdvs False)) @@ \
46.1263 +\ (Try (Rewrite_Set_Inst [(bdv_1, hd vs_),(bdv_2, nth_ 2 vs_)] \
46.1264 +\ norm_Rational False))) e2_; \
46.1265 +\ es_ = Take [e1_, e2_] \
46.1266 +\ in [e1_, e2_,e3_, e4_])"
46.1267 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.1268 +val str =
46.1269 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.1270 +\ (let e2_ = Take (nth_ 2 es_); \
46.1271 +\ e2_ = ((Substitute [e1_]) @@ \
46.1272 +\ (Try (Rewrite_Set_Inst [(bdv_1,nth_ 1 vs_),(bdv_2,nth_ 2 vs_),\
46.1273 +\ (bdv_3,nth_ 3 vs_),(bdv_4,nth_ 4 vs_)]\
46.1274 +\ simplify_System_parenthesized False)) @@ \
46.1275 +\ (Try (Rewrite_Set_Inst [(bdv_1,nth_ 1 vs_),(bdv_2,nth_ 2 vs_),\
46.1276 +\ (bdv_3,nth_ 3 vs_),(bdv_4,nth_ 4 vs_)]\
46.1277 +\ isolate_bdvs False)) @@ \
46.1278 +\ (Try (Rewrite_Set_Inst [(bdv_1,nth_ 1 vs_),(bdv_2,nth_ 2 vs_),\
46.1279 +\ (bdv_3,nth_ 3 vs_),(bdv_4,nth_ 4 vs_)]\
46.1280 +\ norm_Rational False))) e2_; \
46.1281 +\ es_ = Take [e1_, e2_] \
46.1282 +\ in [e1_, e2_,e3_, e4_])"
46.1283 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.1284 +(*---^^^-OK-----------------------------------------------------------------*)
46.1285 +val str =
46.1286 +"Script SolveSystemScript (es_::bool list) (vs_::real list) = \
46.1287 +\ (let e2_ = Take (nth_ 2 es_); \
46.1288 +\ e2_ = ((Substitute [e1_]) @@ \
46.1289 +\ (Try (Rewrite_Set_Inst [(bdv_1,nth_ 1 vs_),(bdv_2,nth_ 2 vs_),\
46.1290 +\ (bdv_3,nth_ 3 vs_),(bdv_4,nth_ 4 vs_)]\
46.1291 +\ simplify_System_parenthesized False)) @@ \
46.1292 +\ (Try (Rewrite_Set_Inst [(bdv_1,nth_ 1 vs_),(bdv_2,nth_ 2 vs_),\
46.1293 +\ (bdv_3,nth_ 3 vs_),(bdv_4,nth_ 4 vs_)]\
46.1294 +\ isolate_bdvs False)) @@ \
46.1295 +\ (Try (Rewrite_Set_Inst [(bdv_1,nth_ 1 vs_),(bdv_2,nth_ 2 vs_),\
46.1296 +\ (bdv_3,nth_ 3 vs_),(bdv_4,nth_ 4 vs_)]\
46.1297 +\ norm_Rational False))) e2_ \
46.1298 +\ in [e1_, e2_, nth_ 3 es_, nth_ 4 es_])"
46.1299 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
46.1300 +(*---vvv-NOT ok-------------------------------------------------------------*)
46.1301 +atomty sc; term2str sc;
46.1302 +
46.1303 +
46.1304 +"----- 7.70 with met top_down_: me";
46.1305 +val fmz = ["equalities \
46.1306 + \[c = L * q_0, L * c + c_2 = q_0 * L ^^^ 2 / 2, c_3 = 0, c_4 = 0]",
46.1307 + "solveForVars [c, c_2, c_3, c_4]", "solution L"];
46.1308 +val (dI',pI',mI') =
46.1309 + ("Biegelinie.thy",["linear", "system"],["no_met"]);
46.1310 +val p = e_pos'; val c = [];
46.1311 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
46.1312 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.1313 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.1314 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.1315 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.1316 +case nxt of (_,Apply_Method ["EqSystem", "top_down_substitution", "4x4"]) => ()
46.1317 + | _ => raise error "eqsystem.sml [EqSystem,top_down_,4x4] specify";
46.1318 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
46.1319 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
46.1320 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
46.1321 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
46.1322 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
46.1323 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
46.1324 +if nxt = ("End_Proof'", End_Proof') andalso
46.1325 + f2str f = "[c = L * q_0, c_2 = -1 * L ^^^ 2 * q_0 / 2, c_3 = 0, c_4 = 0]"
46.1326 +then () else raise error "eqsystem.sml: 7.70 with met top_down_: me";
46.1327 +
46.1328 +
46.1329 +"------- Bsp 7.71";
46.1330 +states:=[];
46.1331 +CalcTree [(["Traegerlaenge L","Streckenlast q_0","Biegelinie y",
46.1332 + "Randbedingungen [M_b L = 0, y 0 = 0, y L = 0, y' 0 = 0]",
46.1333 + "FunktionsVariable x"],
46.1334 + ("Biegelinie.thy", ["Biegelinien"],
46.1335 + ["IntegrierenUndKonstanteBestimmen2"] ))];
46.1336 +moveActiveRoot 1;
46.1337 +(*
46.1338 +trace_script := true; autoCalculate 1 CompleteCalc; trace_script := false;
46.1339 +##7.71## |ordered |subst.singles (recurs) |2x2 |diagonal
46.1340 +c c_2 |c c_2 |1' |1': c c_2 |
46.1341 + c_4 | c_3 |2:c_3 -> 4' :c c_2 c_4 | |
46.1342 +c c_2 c_3 c_4 | c_4 |3' | |
46.1343 + c_3 |c c_2 c_3 c_4 |3:c_4 -> 4'':c c_2 |4'':c c_2 | *)
46.1344 +val t = str2term"[0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2, \
46.1345 +\ 0 = c_4 + 0 / (-1 * EI), \
46.1346 +\ 0 = c_4 + L * c_3 +(12 * L ^^^ 2 * c_2 + 4 * L ^^^ 3 * c + -1 * L ^^^ 4 * q_0) /(-24 * EI),\
46.1347 +\ 0 = c_3 + 0 / (-1 * EI)]";
46.1348 +
46.1349 +"------- Bsp 7.72a ---------------vvvvvvvvvvvvv Momentenlinie postponed";
46.1350 +states:=[];
46.1351 +CalcTree [(["Traegerlaenge L",
46.1352 + "Momentenlinie ((q_0 * L)/ 6 * x - q_0 /(6 * L) * x^3)",
46.1353 + "Biegelinie y",
46.1354 + "Randbedingungen [y 0 = 0, y L = 0]",
46.1355 + "FunktionsVariable x"],
46.1356 + ("Biegelinie.thy", ["vonMomentenlinieZu","Biegelinien"],
46.1357 + ["Biegelinien", "AusMomentenlinie"]))];
46.1358 +moveActiveRoot 1;
46.1359 +(*
46.1360 +trace_script := true; autoCalculate 1 CompleteCalc; trace_script := false;
46.1361 +*)
46.1362 +
46.1363 +"------- Bsp 7.72b";
46.1364 +states:=[];
46.1365 +CalcTree [(["Traegerlaenge L","Streckenlast (q_0 / L * x)","Biegelinie y",
46.1366 + "Randbedingungen [M_b 0 = 0, M_b L = 0, y 0 = 0, y L = 0]",
46.1367 + "FunktionsVariable x"],
46.1368 + ("Biegelinie.thy", ["Biegelinien"],
46.1369 + ["IntegrierenUndKonstanteBestimmen2"] ))];
46.1370 +moveActiveRoot 1;
46.1371 +(*
46.1372 +trace_script := true; autoCalculate 1 CompleteCalc; trace_script := false;
46.1373 +##7.72b## |ord. |subst.singles |ord.triang.
46.1374 + c_2 | | |c_2
46.1375 +c c_2 | |1:c_2 -> 2':c |c_2 c
46.1376 + c_4 | | |
46.1377 +c c_2 c_3 c_4 | |3:c_4 -> 4':c c_2 c_3 |c_2 c c_3*)
46.1378 +val t = str2term"[0 = c_2, \
46.1379 +\ 0 = (6 * c_2 + 6 * L * c + -1 * L ^^^ 2 * q_0) / 6, \
46.1380 +\ 0 = c_4 + 0 / (-1 * EI), \
46.1381 +\ 0 = c_4 + L * c_3 + (60 * L ^^^ 2 * c_2 + 20 * L ^^^ 3 * c + -1 * L ^^^ 4 * q_0) / (-120 * EI)]";
46.1382 +
46.1383 +"------- Bsp 7.73 ---------------vvvvvvvvvvvvv Momentenlinie postponed";
46.1384 +states:=[];
46.1385 +CalcTree [(["Traegerlaenge L","Momentenlinie ???",(*description unclear*)
46.1386 + "Biegelinie y",
46.1387 + "Randbedingungen [y L = 0, y' L = 0]",
46.1388 + "FunktionsVariable x"],
46.1389 + ("Biegelinie.thy", ["vonMomentenlinieZu","Biegelinien"],
46.1390 + ["Biegelinien", "AusMomentenlinie"]))];
46.1391 +moveActiveRoot 1;
46.1392 +(*
46.1393 +trace_script := true; autoCalculate 1 CompleteCalc; trace_script := false;
46.1394 +*)
46.1395 +
46.1396 +
46.1397 +"----------- 4x4 systems from Biegelinie -------------------------";
46.1398 +"----------- 4x4 systems from Biegelinie -------------------------";
46.1399 +"----------- 4x4 systems from Biegelinie -------------------------";
46.1400 +(*GOON replace this test with 7.70 *)
46.1401 +"----- Bsp 7.27";
46.1402 +val fmz = ["equalities \
46.1403 + \[0 = c_4, \
46.1404 + \ 0 = c_4 + L * c_3 +(12 * L ^^^ 2 * c_2 + 4 * L ^^^ 3 * c + -1 * L ^^^ 4 * q_0) / (-24 * EI), \
46.1405 + \ 0 = c_2, \
46.1406 + \ 0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2]",
46.1407 + "solveForVars [c, c_2, c_3, c_4]", "solution L"];
46.1408 +val (dI',pI',mI') =
46.1409 + ("Biegelinie.thy",["normalize", "4x4", "linear", "system"],
46.1410 + ["EqSystem","normalize","4x4"]);
46.1411 +val p = e_pos'; val c = [];
46.1412 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
46.1413 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.1414 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.1415 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.1416 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
46.1417 +"------------------------------------------- Apply_Method...";
46.1418 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
46.1419 +"[0 = c_4, \
46.1420 +\ 0 = c_4 + L * c_3 +\n (12 * L ^^^ 2 * c_2 + 4 * L ^^^ 3 * c + -1 * L ^^^ 4 * q_0) / (-24 * EI), \
46.1421 +\ 0 = c_2, \
46.1422 +\ 0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2]";
46.1423 +(*vvvWN080102 Exception- Match raised
46.1424 + since assod Rewrite .. Rewrite'_Set
46.1425 +"------------------------------------------- simplify_System_parenthesized...";
46.1426 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
46.1427 +"[0 = c_4, \
46.1428 +\ 0 = -1 * q_0 * L ^^^ 4 / (-24 * EI) + \
46.1429 +\ (4 * L ^^^ 3 * c / (-24 * EI) + \
46.1430 +\ (12 * L ^^^ 2 * c_2 / (-24 * EI) + \
46.1431 +\ (L * c_3 + c_4))), \
46.1432 +\ 0 = c_2, \
46.1433 +\ 0 = -1 * q_0 * L ^^^ 2 / 2 + (L * c + c_2)]";
46.1434 +(*? "(4 * L ^^^ 3 / (-24 * EI) * c" statt "(4 * L ^^^ 3 * c / (-24 * EI)" ?*)
46.1435 +"------------------------------------------- isolate_bdvs...";
46.1436 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
46.1437 +"[c_4 = 0,\
46.1438 +\ c_4 = 0 + -1 * (-1 * q_0 * L ^^^ 4 / (-24 * EI)) + -1 * (4 * L ^^^ 3 * c / (-24 * EI)) + -1 * (12 * L ^^^ 2 * c_2 / (-24 * EI)) + -1 * (L * c_3),\
46.1439 +\ c_2 = 0, \
46.1440 +\ c_2 = 0 + -1 * (-1 * q_0 * L ^^^ 2 / 2) + -1 * (L * c)]";
46.1441 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
46.1442 +
46.1443 +---------------------------------------------------------------------*)
46.1444 +
46.1445 +(*
46.1446 +use"../smltest/IsacKnowledge/eqsystem.sml";
46.1447 +use"eqsystem.sml";
46.1448 +*)
47.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
47.2 +++ b/test/Tools/isac/Knowledge/equation.sml Mon Aug 30 14:35:51 2010 +0200
47.3 @@ -0,0 +1,33 @@
47.4 +(* tests on the equation solver
47.5 + author: Walther Neuper
47.6 + 070703
47.7 + (c) due to copyright terms
47.8 +
47.9 +use"../smltest/IsacKnowledge/equation.sml";
47.10 +use"equation.sml";
47.11 +*)
47.12 +val thy = Isac.thy;
47.13 +
47.14 +"-----------------------------------------------------------------";
47.15 +"table of contents -----------------------------------------------";
47.16 +"-----------------------------------------------------------------";
47.17 +"----------- CAS input -------------------------------------------";
47.18 +"-----------------------------------------------------------------";
47.19 +"-----------------------------------------------------------------";
47.20 +"-----------------------------------------------------------------";
47.21 +
47.22 +
47.23 +"----------- CAS input -------------------------------------------";
47.24 +"----------- CAS input -------------------------------------------";
47.25 +"----------- CAS input -------------------------------------------";
47.26 +states:=[];
47.27 +CalcTree [([], ("e_domID", ["e_pblID"], ["e_metID"]))];
47.28 +Iterator 1;
47.29 +moveActiveRoot 1;
47.30 +replaceFormula 1 "solve (x+1=2, x)";
47.31 +autoCalculate 1 CompleteCalc;
47.32 +val ((pt,p),_) = get_calc 1;
47.33 +val Form res = (#1 o pt_extract) (pt, ([],Res));
47.34 +show_pt pt;
47.35 +if p = ([], Res) andalso term2str res = "[x = 1]" then ()
47.36 +else raise error "equation.sml behav.changed for CAS solve (x+1=2, x))";
48.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
48.2 +++ b/test/Tools/isac/Knowledge/inssort.sml Mon Aug 30 14:35:51 2010 +0200
48.3 @@ -0,0 +1,138 @@
48.4 +(* use"test-inssort.sml";
48.5 + W.N.17.6.00
48.6 +*)
48.7 +
48.8 +(* insertion sort, would need lists different from script-lists WN.11.00
48.9 +WN.7.6.03: -"- started with someList :: 'a list => unl, fun dest_list *)
48.10 +
48.11 +"--------------- sort [1,4,3,2] by rewrite_set ----------------";
48.12 +val thy' = "InsSort.thy";
48.13 +val ct = "sort [1,4,3,2]";
48.14 +"--- 1 ---";
48.15 +val rls = "ins_sort";
48.16 +val (ct,_) = the (rewrite_set thy' "eval_rls" false rls ct);
48.17 +if ct="[1, 2, 3, 4]" then "sort [1,4,3,2] OK"
48.18 +else raise error "sort [1,4,3,2] didn't work";
48.19 +
48.20 +
48.21 +"---------------- sort [1,3,2] by rewrite stepwise ----------------";
48.22 +val thy' = "InsSort.thy";
48.23 +val ct = "sort [1,3,2]";
48.24 +"--- 1 ---";
48.25 +val thm = ("sort_def","");
48.26 +val (ct,_) = the (rewrite thy' "tless_true" "eval_rls" false thm ct);
48.27 +(*val ct = "foldr ins [#1::real, #3::real, #2::real] []"*)
48.28 +"--- 2 ---";
48.29 +val thm = ("foldr_rec","");
48.30 +val (ct,_) = the (rewrite thy' "tless_true" "eval_rls" false thm ct);
48.31 +(*val ct = "foldr ins [#3, #2] (ins [] #1)"*)
48.32 +"--- 3 ---";
48.33 +val thm = ("ins_base","");
48.34 +val (ct,_) = the (rewrite thy' "tless_true" "eval_rls" false thm ct);
48.35 +(*val ct = "foldr ins [#3, #2] [#1]"*)
48.36 +"--- 4 ---";
48.37 +val thm = ("foldr_rec","");
48.38 +val (ct,_) = the (rewrite thy' "tless_true" "eval_rls" false thm ct);
48.39 +(*val ct = "foldr ins [#2] (ins [#1] #3)"*)
48.40 +"--- 5 ---";
48.41 +val thm = ("ins_rec","");
48.42 +val (ct,_) = the (rewrite thy' "tless_true" "eval_rls" false thm ct);
48.43 +(*val ct = "foldr ins [#2] (if #1 < #3 then #1 # ins [] #3 else [#3, #1])"*)
48.44 +"--- 6 ---";
48.45 +val op_ = "le";
48.46 +val (ct,_) = the (calculate thy' op_ ct);
48.47 +(*val ct = "foldr ins [#2] (if True then #1 # ins [] #3 else [#3, #1])"*)
48.48 +"--- 7 ---";
48.49 +val thm = ("if_True","");
48.50 +val (ct,_) = the (rewrite thy' "tless_true" "eval_rls" false thm ct);
48.51 +(*val ct = "foldr ins [#2] (#1 # ins [] #3)"*)
48.52 +"--- 8 ---";
48.53 +val thm = ("ins_base","");
48.54 +val (ct,_) = the (rewrite thy' "tless_true" "eval_rls" false thm ct);
48.55 +(*val ct = "foldr ins [#2] [#1, #3]"*)
48.56 +"--- 9 ---";
48.57 +val thm = ("foldr_rec","");
48.58 +val (ct,_) = the (rewrite thy' "tless_true" "eval_rls" false thm ct);
48.59 +(*val ct = "foldr ins [] (ins [#1, #3] #2)"*)
48.60 +"--- 10 ---";
48.61 +val thm = ("ins_rec","");
48.62 +val (ct,_) = the (rewrite thy' "tless_true" "eval_rls" false thm ct);
48.63 +(*val ct = "foldr ins [] (if #1 < #2 then #1 # ins [#3] #2 else [#2, #1, #3])"*)
48.64 +"--- 11 ---";
48.65 +val op_ = "le";
48.66 +val (ct,_) = the (calculate thy' op_ ct);
48.67 +(*val ct = "foldr ins [] (if True then #1 # ins [#3] #2 else [#2, #1, #3])"*)
48.68 +"--- 12 ---";
48.69 +val thm = ("if_True","");
48.70 +val (ct,_) = the (rewrite thy' "tless_true" "eval_rls" false thm ct);
48.71 +(*"foldr ins [] (#1 # ins [#3] #2)"*)
48.72 +"--- 13 ---";
48.73 +val thm = ("ins_rec","");
48.74 +val (ct,_) = the (rewrite thy' "tless_true" "eval_rls" false thm ct);
48.75 +(*"foldr ins [] (#1 # (if #3 < #2 then #3 # ins [] #2 else [#2, #3]))"*)
48.76 +"--- 14 ---";
48.77 +val op_ = "le";
48.78 +val (ct,_) = the (calculate thy' op_ ct);
48.79 +(*val ct = "foldr ins [] (#1 # (if False then #3 # ins [] #2 else [#2, #3]))"*)
48.80 +"--- 15 ---";
48.81 +val thm = ("if_False","");
48.82 +val (ct,_) = the (rewrite thy' "tless_true" "eval_rls" false thm ct);
48.83 +(*val ct = "foldr ins [] [#1, #2, #3]"*)
48.84 +"--- 16 ---";
48.85 +val thm = ("foldr_base","");
48.86 +val (ct,_) = the (rewrite thy' "tless_true" "eval_rls" false thm ct);
48.87 +(*val ct = "[#1, #2, #3]"*)
48.88 +if ct="[1, 2, 3]" then "sort [1,3,2] OK"
48.89 +else raise error "sort [1,3,2] didn't work";
48.90 +
48.91 +
48.92 +"---------------- sort [1,3,2] from script ----------------";
48.93 +val fmz = ["unsorted [1,3,2]", "sorted S"];
48.94 +val (dI',pI',mI') =
48.95 + ("InsSort.thy", ["inssort","functional"], ("InsSort.thy","inssort"));
48.96 +val p = e_pos'; val c = [];
48.97 +
48.98 +
48.99 +
48.100 +(* ------- 17.6.00: mit kleinen problemen aufgegeben
48.101 +val scr=Script ((term_of o the o (parse thy))
48.102 + "Script Sort (u_::'a list) = \
48.103 + \ Rewrite_Set ins_sort False u_");
48.104 +
48.105 +val scr=Script ((term_of o the o (parse thy))
48.106 + "Script Ins_sort (u_::real list) = \
48.107 + \ (let u_ = Rewrite sort_def False u_; \
48.108 + \ u_ = Rewrite foldr_rec False u_; \
48.109 + \ u_ = Rewrite ins_base False u_; \
48.110 + \ u_ = Rewrite foldr_rec False u_; \
48.111 + \ u_ = Rewrite ins_rec False u_; \
48.112 + \ u_ = Calculate le u_; \
48.113 + \ u_ = Rewrite if_True False u_; \
48.114 + \ u_ = Rewrite ins_base False u_; \
48.115 + \ u_ = Rewrite foldr_rec False u_; \
48.116 + \ u_ = Rewrite ins_rec False u_; \
48.117 + \ u_ = Calculate le u_; \
48.118 + \ u_ = Rewrite if_True False u_; \
48.119 + \ u_ = Rewrite ins_rec False u_; \
48.120 + \ u_ = Calculate le u_; \
48.121 + \ u_ = Rewrite if_False False u_; \
48.122 + \ u_ = Rewrite foldr_base False u_ \
48.123 + \ in u_)");
48.124 +val scr=parse thy
48.125 + "Script Ins_sort (u_::real list) = \
48.126 + \ (let u_ = Rewrite sort_def False u_; \
48.127 + \ u_ = Rewrite foldr_rec False u_; \
48.128 + \ u_ = Rewrite ins_base False u_; \
48.129 + \ u_ = Rewrite foldr_rec False u_; \
48.130 + \ u_ = Rewrite ins_rec False u_; \
48.131 + \ u_ = Calculate le u_; \
48.132 + \ u_ = Rewrite if_True False u_; \
48.133 + \ u_ = Rewrite ins_base False u_; \
48.134 + \ u_ = Rewrite foldr_rec False u_; \
48.135 + \ u_ = Rewrite ins_rec False u_; \
48.136 + \ u_ = u_ \
48.137 + \ in u_)";
48.138 +
48.139 +atomty (term_of (the scr));
48.140 +
48.141 +------- *)
48.142 \ No newline at end of file
49.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
49.2 +++ b/test/Tools/isac/Knowledge/integrate.sml Mon Aug 30 14:35:51 2010 +0200
49.3 @@ -0,0 +1,579 @@
49.4 +(* tests on integration over the reals
49.5 + author: Walther Neuper
49.6 + 050814, 08:51
49.7 + (c) due to copyright terms
49.8 +
49.9 +use"../smltest/IsacKnowledge/integrate.sml";
49.10 +use"integrate.sml";
49.11 +*)
49.12 +val thy = Integrate.thy;
49.13 +
49.14 +"-----------------------------------------------------------------";
49.15 +"table of contents -----------------------------------------------";
49.16 +"-----------------------------------------------------------------";
49.17 +"----------- parsing ---------------------------------------------";
49.18 +"----------- integrate by rewriting ------------------------------";
49.19 +"----------- test add_new_c, is_f_x ------------------------------";
49.20 +"----------- simplify by ruleset reducing make_ratpoly_in --------";
49.21 +"----------- simplify by ruleset extending make_polynomial_in ----";
49.22 +"----------- integrate by ruleset --------------------------------";
49.23 +"----------- rewrite 3rd integration in 7.27 ---------------------";
49.24 +"----------- check probem type -----------------------------------";
49.25 +"----------- check Scripts ---------------------------------------";
49.26 +"----------- me method [diff,integration] ------------------------";
49.27 +"----------- me method [diff,integration,named] ------------------";
49.28 +"----------- me method [diff,integration,named] Biegelinie.Q -----";
49.29 +"----------- interSteps [diff,integration] -----------------------";
49.30 +"----------- method analog to rls 'integration' ------------------";
49.31 +"----------- Ambiguous input: Integral ?u + ?v D ?bdv = ..--------";
49.32 +"----------- CAS input -------------------------------------------";
49.33 +"-----------------------------------------------------------------";
49.34 +"-----------------------------------------------------------------";
49.35 +"-----------------------------------------------------------------";
49.36 +
49.37 +
49.38 +
49.39 +"----------- parsing ---------------------------------------------";
49.40 +"----------- parsing ---------------------------------------------";
49.41 +"----------- parsing ---------------------------------------------";
49.42 +fun str2term str = (term_of o the o (parse Integrate.thy)) str;
49.43 +fun term2s t = Syntax.string_of_term (thy2ctxt' "Integrate") t;
49.44 +
49.45 +val t = str2term "Integral x D x";
49.46 +val t = str2term "Integral x^^^2 D x";
49.47 +atomty t;
49.48 +
49.49 +val t = str2term "ff x is_f_x";
49.50 +case t of Const ("Integrate.is'_f'_x", _) $ _ => ()
49.51 + | _ => raise error "integrate.sml: parsing: ff x is_f_x";
49.52 +
49.53 +
49.54 +"----------- integrate by rewriting ------------------------------";
49.55 +"----------- integrate by rewriting ------------------------------";
49.56 +"----------- integrate by rewriting ------------------------------";
49.57 +val conditions_in_integration_rules =
49.58 +Rls {id="conditions_in_integration_rules",
49.59 + preconds = [],
49.60 + rew_ord = ("termlessI",termlessI),
49.61 + erls = Erls,
49.62 + srls = Erls, calc = [],
49.63 + rules = [(*for rewriting conditions in Thm's*)
49.64 + Calc ("Atools.occurs'_in",
49.65 + eval_occurs_in "#occurs_in_"),
49.66 + Thm ("not_true",num_str not_true),
49.67 + Thm ("not_false",not_false)
49.68 + ],
49.69 + scr = EmptyScr};
49.70 +val subs = [(str2term "bdv", str2term "x")];
49.71 +fun rewrit thm str =
49.72 + fst (the (rewrite_inst_ Integrate.thy tless_true
49.73 + conditions_in_integration_rules
49.74 + true subs thm str));
49.75 +val str = rewrit integral_const (str2term "Integral 1 D x"); term2s str;
49.76 +val str = rewrit integral_const (str2term "Integral M'/EJ D x"); term2s str;
49.77 +val str = (rewrit integral_const (str2term "Integral x D x"))
49.78 + handle OPTION => str2term "no_rewrite";
49.79 +
49.80 +val str = rewrit integral_var (str2term "Integral x D x"); term2s str;
49.81 +val str = (rewrit integral_var (str2term "Integral a D x"))
49.82 + handle OPTION => str2term "no_rewrite";
49.83 +
49.84 +val str = rewrit integral_add (str2term "Integral x + 1 D x"); term2s str;
49.85 +
49.86 +val str = rewrit integral_mult (str2term "Integral M'/EJ * x^^^3 D x");term2s str;
49.87 +val str = (rewrit integral_mult (str2term "Integral x * x D x"))
49.88 + handle OPTION => str2term "no_rewrite";
49.89 +
49.90 +val str = rewrit integral_pow (str2term "Integral x^^^3 D x"); term2s str;
49.91 +
49.92 +
49.93 +"----------- test add_new_c, is_f_x ------------------------------";
49.94 +"----------- test add_new_c, is_f_x ------------------------------";
49.95 +"----------- test add_new_c, is_f_x ------------------------------";
49.96 +val term = str2term "x^^^2*c + c_2";
49.97 +val cc = new_c term;
49.98 +if term2str cc = "c_3" then () else raise error "integrate.sml: new_c ???";
49.99 +
49.100 +val SOME (id,t') = eval_add_new_c "" "Integrate.add'_new'_c" term thy;
49.101 +if term2str t' = "x ^^^ 2 * c + c_2 = x ^^^ 2 * c + c_2 + c_3" then ()
49.102 +else raise error "intergrate.sml: diff. eval_add_new_c";
49.103 +
49.104 +val cc = ("Integrate.add'_new'_c", eval_add_new_c "add_new_c_");
49.105 +val SOME (thmstr, thm) = get_calculation1_ thy cc term;
49.106 +
49.107 +val SOME (t',_) = rewrite_set_ thy true add_new_c term;
49.108 +if term2str t' = "x ^^^ 2 * c + c_2 + c_3" then ()
49.109 +else raise error "intergrate.sml: diff. rewrite_set add_new_c 1";
49.110 +
49.111 +val term = str2term "ff x = x^^^2*c + c_2";
49.112 +val SOME (t',_) = rewrite_set_ thy true add_new_c term;
49.113 +if term2str t' = "ff x = x ^^^ 2 * c + c_2 + c_3" then ()
49.114 +else raise error "intergrate.sml: diff. rewrite_set add_new_c 2";
49.115 +
49.116 +
49.117 +(*WN080222 replace call_new_c with add_new_c----------------------
49.118 +val term = str2term "new_c (c * x^^^2 + c_2)";
49.119 +val SOME (_,t') = eval_new_c 0 0 term 0;
49.120 +if term2s t' = "new_c c * x ^^^ 2 + c_2 = c_3" then ()
49.121 +else raise error "integrate.sml: eval_new_c ???";
49.122 +
49.123 +val t = str2term "matches (?u + new_c ?v) (x ^^^ 2 / 2)";
49.124 +val SOME (_,t') = eval_matches "" "Tools.matches" t thy; term2s t';
49.125 +if term2s t' = "matches (?u + new_c ?v) (x ^^^ 2 / 2) = False" then ()
49.126 +else raise error "integrate.sml: matches new_c = False";
49.127 +
49.128 +val t = str2term "matches (?u + new_c ?v) (x ^^^ 2 / 2 + new_c x ^^^ 2 / 2)";
49.129 +val SOME (_,t') = eval_matches "" "Tools.matches" t thy; term2s t';
49.130 +if term2s t'="matches (?u + new_c ?v) (x ^^^ 2 / 2 + new_c x ^^^ 2 / 2) = True"
49.131 +then () else raise error "integrate.sml: matches new_c = True";
49.132 +
49.133 +val t = str2term "ff x is_f_x";
49.134 +val SOME (_,t') = eval_is_f_x "" "" t thy; term2s t';
49.135 +if term2s t' = "(ff x is_f_x) = True" then ()
49.136 +else raise error "integrate.sml: eval_is_f_x --> true";
49.137 +
49.138 +val t = str2term "q_0/2 * L * x is_f_x";
49.139 +val SOME (_,t') = eval_is_f_x "" "" t thy; term2s t';
49.140 +if term2s t' = "(q_0 / 2 * L * x is_f_x) = False" then ()
49.141 +else raise error "integrate.sml: eval_is_f_x --> false";
49.142 +
49.143 +val conditions_in_integration =
49.144 +Rls {id="conditions_in_integration",
49.145 + preconds = [],
49.146 + rew_ord = ("termlessI",termlessI),
49.147 + erls = Erls,
49.148 + srls = Erls, calc = [],
49.149 + rules = [Calc ("Tools.matches",eval_matches ""),
49.150 + Calc ("Integrate.is'_f'_x",
49.151 + eval_is_f_x "is_f_x_"),
49.152 + Thm ("not_true",num_str not_true),
49.153 + Thm ("not_false",num_str not_false)
49.154 + ],
49.155 + scr = EmptyScr};
49.156 +fun rewrit thm t =
49.157 + fst (the (rewrite_inst_ Integrate.thy tless_true
49.158 + conditions_in_integration true subs thm t));
49.159 +val t = rewrit call_for_new_c (str2term "x ^^^ 2 / 2"); term2s t;
49.160 +val t = (rewrit call_for_new_c t)
49.161 + handle OPTION => str2term "no_rewrite";
49.162 +
49.163 +val t = rewrit call_for_new_c
49.164 + (str2term "ff x = q_0/2 *L*x"); term2s t;
49.165 +val t = (rewrit call_for_new_c
49.166 + (str2term "ff x = q_0 / 2 * L * x + new_c q_0 / 2 * L * x"))
49.167 + handle OPTION => (*NOT: + new_c ..=..!!*)str2term "no_rewrite";
49.168 +--------------------------------------------------------------------*)
49.169 +
49.170 +
49.171 +"----------- simplify by ruleset reducing make_ratpoly_in --------";
49.172 +"----------- simplify by ruleset reducing make_ratpoly_in --------";
49.173 +"----------- simplify by ruleset reducing make_ratpoly_in --------";
49.174 +val thy = Isac.thy;
49.175 +val subs = [(str2term"bdv",str2term"x")];
49.176 +val t = str2term "1/EI * (L * q_0 * x / 2 + -1 * q_0 * x^^^2 / 2)";
49.177 +
49.178 +"----- stepwise from the rulesets in simplify_Integral and below-----";
49.179 +(*###*)val rls = norm_Rational_noadd_fractions;
49.180 +case rewrite_set_inst_ thy true subs rls t of
49.181 + SOME _ => raise error "integrate.sml simplify by ruleset norm_Rational_.#2"
49.182 + | NONE => ();
49.183 +(* WN051028 Rational.ML 'rat_mult_div_pow' with erls = e_rls
49.184 +applies 'rat_mult_poly_r'="?c is_polyexp ==> ?a / ?b * ?c = ?a * ?c / ?b"
49.185 +to "(L * q_0 * x / 2 + -1 * q_0 * x ^^^ 2 / 2) / EI"
49.186 +and keeps "..." is_polyexp" as an assumption.
49.187 +AFTER CORRECTION in Integrate.ML as above*)
49.188 +
49.189 +(*###*)val rls = order_add_mult_in;
49.190 +val SOME (t,[]) = rewrite_set_ thy true rls t;
49.191 +if term2str t = "1 / EI * (L * (q_0 * x) / 2 + -1 * (q_0 * x ^^^ 2) / 2)"then()
49.192 +else raise error "integrate.sml simplify by ruleset order_add_mult_in #2";
49.193 +
49.194 +(*###*)val rls = discard_parentheses;
49.195 +val SOME (t,[]) = rewrite_set_ thy true rls t;
49.196 +if term2str t = "1 / EI * (L * q_0 * x / 2 + -1 * q_0 * x ^^^ 2 / 2)" then ()
49.197 +else raise error "integrate.sml simplify by ruleset discard_parenth.. #3";
49.198 +
49.199 +(*###*)val rls =
49.200 + (append_rls "separate_bdv"
49.201 + collect_bdv
49.202 + [Thm ("separate_bdv", num_str separate_bdv),
49.203 + (*"?a * ?bdv / ?b = ?a / ?b * ?bdv"*)
49.204 + Thm ("separate_bdv_n", num_str separate_bdv_n),
49.205 + Thm ("separate_1_bdv", num_str separate_1_bdv),
49.206 + (*"?bdv / ?b = (1 / ?b) * ?bdv"*)
49.207 + Thm ("separate_1_bdv_n", num_str separate_1_bdv_n)
49.208 + ]);
49.209 +val SOME (t,[]) = rewrite_set_inst_ thy true subs rls t;
49.210 +if term2str t = "1 / EI * (L * q_0 / 2 * x + -1 * q_0 / 2 * x ^^^ 2)" then ()
49.211 +else raise error "integrate.sml simplify by ruleset separate_bdv.. #4";
49.212 +
49.213 +
49.214 +val t = str2term "1/EI * (L * q_0 * x / 2 + -1 * q_0 * x^^^2 / 2)";
49.215 +val rls = simplify_Integral;
49.216 +val SOME (t,[]) = rewrite_set_inst_ thy true subs rls t;
49.217 +if term2str t = "1 / EI * (L * q_0 / 2 * x + -1 * q_0 / 2 * x ^^^ 2)" then ()
49.218 +else raise error "integrate.sml, simplify_Integral #99";
49.219 +
49.220 +"........... 2nd integral ........................................";
49.221 +"........... 2nd integral ........................................";
49.222 +"........... 2nd integral ........................................";
49.223 +val t = str2term
49.224 + "Integral 1 / EI * (L * q_0 / 2 * (x ^^^ 2 / 2) + \
49.225 + \-1 * q_0 / 2 * (x ^^^ 3 / 3)) D x";
49.226 +val rls = simplify_Integral;
49.227 +val SOME (t,[]) = rewrite_set_inst_ thy true subs rls t;
49.228 +if term2str t =
49.229 + "Integral 1 / EI * (L * q_0 / 4 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3) D x"
49.230 +then () else raise error "integrate.sml, simplify_Integral #198";
49.231 +
49.232 +val rls = integration_rules;
49.233 +val SOME (t,[]) = rewrite_set_ thy true rls t;
49.234 +if term2str t =
49.235 + "1 / EI * (L * q_0 / 4 * (x ^^^ 3 / 3) + -1 * q_0 / 6 * (x ^^^ 4 / 4))"
49.236 +then () else raise error "integrate.sml, simplify_Integral #199";
49.237 +
49.238 +
49.239 +
49.240 +"----------- simplify by ruleset extending make_polynomial_in ----";
49.241 +"----------- simplify by ruleset extending make_polynomial_in ----";
49.242 +"----------- simplify by ruleset extending make_polynomial_in ----";
49.243 +trace_rewrite:=true;
49.244 +trace_rewrite:=false;
49.245 +(*postponed: see *)
49.246 +
49.247 +
49.248 +"----------- integrate by ruleset --------------------------------";
49.249 +"----------- integrate by ruleset --------------------------------";
49.250 +"----------- integrate by ruleset --------------------------------";
49.251 +val rls = "integration_rules";
49.252 +val subs = [("bdv","x::real")];
49.253 +fun rewrit_sinst subs rls str =
49.254 + fst (the (rewrite_set_inst "Integrate.thy" true subs rls str));
49.255 +(*~~~~~~~~~~~~~~~~~~~~~~~~~~~*)
49.256 +val str = rewrit_sinst subs rls "Integral x D x";
49.257 +val str = rewrit_sinst subs rls "Integral c * x ^^^ 2 + c_2 D x";
49.258 +if str = "c * (x ^^^ 3 / 3) + c_2 * x"
49.259 +then () else raise error "integrate.sml: diff.behav. in integration_rules";
49.260 +
49.261 +val rls = "add_new_c";
49.262 +val str = rewrit_sinst subs rls "c * (x ^^^ 3 / 3) + c_2 * x";
49.263 +if str = "c * (x ^^^ 3 / 3) + c_2 * x + c_3" then ()
49.264 +else raise error "integrate.sml: diff.behav. in add_new_c simpl.";
49.265 +
49.266 +val str = rewrit_sinst subs rls "F x = x ^^^ 3 / 3 + x";
49.267 +if str = "F x = x ^^^ 3 / 3 + x + c"(*not "F x + c =..."*) then ()
49.268 +else raise error "integrate.sml: diff.behav. in add_new_c equation";
49.269 +
49.270 +val rls = "simplify_Integral";
49.271 +(*~~~~~~~~~~~~~~~~~~~~~~~~~~~*)
49.272 +val str = "ff x = c * x + -1 * q_0 * (x ^^^ 2 / 2) + c_2";
49.273 +val str = rewrit_sinst subs rls str;
49.274 +if str = "ff x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2"
49.275 +then () else raise error "integrate.sml: diff.behav. in simplify_I #1";
49.276 +
49.277 +val rls = "integration";
49.278 +(*~~~~~~~~~~~~~~~~~~~~~~~~~~~*)
49.279 +val str = rewrit_sinst subs rls "Integral c * x ^^^ 2 + c_2 D x";
49.280 +if str = "c_3 + c_2 * x + c / 3 * x ^^^ 3"
49.281 +then () else raise error "integrate.sml: diff.behav. in integration #1";
49.282 +
49.283 +val str = rewrit_sinst subs rls "Integral 3*x^^^2 + 2*x + 1 D x";
49.284 +if str = "c + x + x ^^^ 2 + x ^^^ 3" then ()
49.285 +else raise error "integrate.sml: diff.behav. in integration #2";
49.286 +
49.287 +val str = rewrit_sinst subs rls
49.288 +"Integral 1 / EI * (L * q_0 / 2 * x + -1 * q_0 / 2 * x ^^^ 2) D x";
49.289 +if str =
49.290 + "c + 1 / EI * (L * q_0 / 4 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3)"
49.291 +then () else raise error "integrate.sml: diff.behav. in integration #3";
49.292 +
49.293 +val str = "Integral "^str^" D x";
49.294 +val str = rewrit_sinst subs rls str;
49.295 +if str =
49.296 + "c_2 + c * x + 1 / EI * (L * q_0 / 12 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)"
49.297 +then () else raise error "integrate.sml: diff.behav. in integration #4";
49.298 +
49.299 +
49.300 +"----------- rewrite 3rd integration in 7.27 ---------------------";
49.301 +"----------- rewrite 3rd integration in 7.27 ---------------------";
49.302 +"----------- rewrite 3rd integration in 7.27 ---------------------";
49.303 +val thy = Isac.thy (*because of Undeclared constant "Biegelinie.EI*);
49.304 +val bdv = [(str2term"bdv", str2term"x")];
49.305 +val t = str2term
49.306 + "Integral 1 / EI * ((L * q_0 * x + -1 * q_0 * x ^^^ 2) / 2) D x";
49.307 +val SOME(t,_)= rewrite_set_inst_ thy true bdv simplify_Integral t;
49.308 +if term2str t =
49.309 + "Integral 1 / EI * (L * q_0 / 2 * x + -1 * q_0 / 2 * x ^^^ 2) D x" then ()
49.310 +else raise error "integrate.sml 3rd integration in 7.27, simplify_Integral";
49.311 +
49.312 +val SOME(t,_)= rewrite_set_inst_ thy true bdv integration t;
49.313 +if term2str t = "c + 1 / EI * (L * q_0 / 4 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3)"
49.314 +then () else raise error "integrate.sml 3rd integration in 7.27, integration";
49.315 +
49.316 +
49.317 +"----------- check probem type -----------------------------------";
49.318 +"----------- check probem type -----------------------------------";
49.319 +"----------- check probem type -----------------------------------";
49.320 +val model = {Given =["functionTerm f_", "integrateBy v_"],
49.321 + Where =[],
49.322 + Find =["antiDerivative F_"],
49.323 + With =[],
49.324 + Relate=[]}:string ppc;
49.325 +val chkmodel = ((map (the o (parse Integrate.thy))) o ppc2list) model;
49.326 +val t1 = (term_of o hd) chkmodel;
49.327 +val t2 = (term_of o hd o tl) chkmodel;
49.328 +val t3 = (term_of o hd o tl o tl) chkmodel;
49.329 +case t3 of Const ("Integrate.antiDerivative", _) $ _ => ()
49.330 + | _ => raise error "integrate.sml: Integrate.antiDerivative ???";
49.331 +
49.332 +val model = {Given =["functionTerm f_", "integrateBy v_"],
49.333 + Where =[],
49.334 + Find =["antiDerivativeName F_"],
49.335 + With =[],
49.336 + Relate=[]}:string ppc;
49.337 +val chkmodel = ((map (the o (parse Integrate.thy))) o ppc2list) model;
49.338 +val t1 = (term_of o hd) chkmodel;
49.339 +val t2 = (term_of o hd o tl) chkmodel;
49.340 +val t3 = (term_of o hd o tl o tl) chkmodel;
49.341 +case t3 of Const ("Integrate.antiDerivativeName", _) $ _ => ()
49.342 + | _ => raise error "integrate.sml: Integrate.antiDerivativeName";
49.343 +
49.344 +"----- compare 'Find's from problem, script, formalization -------";
49.345 +val {ppc,...} = get_pbt ["named","integrate","function"];
49.346 +val ("#Find", (Const ("Integrate.antiDerivativeName", _),
49.347 + F1_ as Free ("F_", F1_type))) = last_elem ppc;
49.348 +val {scr = Script sc,... } = get_met ["diff","integration","named"];
49.349 +val [_,_, F2_] = formal_args sc;
49.350 +if F1_ = F2_ then () else raise error "integrate.sml: unequal find's";
49.351 +
49.352 +val ((dsc as Const ("Integrate.antiDerivativeName", _))
49.353 + $ Free ("ff", F3_type)) = str2term "antiDerivativeName ff";
49.354 +if is_dsc dsc then () else raise error "integrate.sml: no description";
49.355 +if F1_type = F3_type then ()
49.356 +else raise error "integrate.sml: unequal types in find's";
49.357 +
49.358 +show_ptyps();
49.359 +val pbl = get_pbt ["integrate","function"];
49.360 +case #cas pbl of SOME (Const ("Integrate.Integrate",_) $ _) => ()
49.361 + | _ => raise error "integrate.sml: Integrate.Integrate ???";
49.362 +
49.363 +
49.364 +"----------- check Scripts ---------------------------------------";
49.365 +"----------- check Scripts ---------------------------------------";
49.366 +"----------- check Scripts ---------------------------------------";
49.367 +val str =
49.368 +"Script IntegrationScript (f_::real) (v_::real) = \
49.369 +\ (let t_ = Take (Integral f_ D v_) \
49.370 +\ in (Rewrite_Set_Inst [(bdv,v_)] integration False) (t_::real))";
49.371 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
49.372 +atomty sc;
49.373 +
49.374 +val str =
49.375 +"Script NamedIntegrationScript (f_::real) (v_::real) (F_::real=>real) = \
49.376 +\ (let t_ = Take (F_ v_ = Integral f_ D v_) \
49.377 +\ in (Rewrite_Set_Inst [(bdv,v_)] integration False) t_)";
49.378 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
49.379 +atomty sc;
49.380 +show_mets();
49.381 +
49.382 +
49.383 +"----------- me method [diff,integration] ---------------------";
49.384 +"----------- me method [diff,integration] ---------------------";
49.385 +"----------- me method [diff,integration] ---------------------";
49.386 +(*exp_CalcInt_No-1.xml*)
49.387 +val fmz = ["functionTerm (x^^^2 + 1)",
49.388 + "integrateBy x","antiDerivative FF"];
49.389 +val (dI',pI',mI') =
49.390 + ("Integrate.thy",["integrate","function"],
49.391 + ["diff","integration"]);
49.392 +val p = e_pos'; val c = [];
49.393 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
49.394 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
49.395 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
49.396 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
49.397 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
49.398 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
49.399 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
49.400 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*nxt <- Apply_Method*);
49.401 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
49.402 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
49.403 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
49.404 +if f2str f = "c + x + 1 / 3 * x ^^^ 3" then ()
49.405 +else raise error "integrate.sml: method [diff,integration]";
49.406 +
49.407 +
49.408 +"----------- me method [diff,integration,named] ------------------";
49.409 +"----------- me method [diff,integration,named] ------------------";
49.410 +"----------- me method [diff,integration,named] ------------------";
49.411 +(*exp_CalcInt_No-2.xml*)
49.412 +val fmz = ["functionTerm (x^^^2 + 1)",
49.413 + "integrateBy x","antiDerivativeName F"];
49.414 +val (dI',pI',mI') =
49.415 + ("Integrate.thy",["named","integrate","function"],
49.416 + ["diff","integration","named"]);
49.417 +val p = e_pos'; val c = [];
49.418 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
49.419 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
49.420 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
49.421 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*nxt <- Add_Find *);
49.422 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
49.423 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
49.424 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
49.425 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*nxt <- Apply_Method*);
49.426 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
49.427 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
49.428 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
49.429 +if f2str f = "F x = c + x + 1 / 3 * x ^^^ 3" then()
49.430 +else raise error "integrate.sml: method [diff,integration,named]";
49.431 +
49.432 +
49.433 +"----------- me method [diff,integration,named] Biegelinie.Q -----";
49.434 +"----------- me method [diff,integration,named] Biegelinie.Q -----";
49.435 +"----------- me method [diff,integration,named] Biegelinie.Q -----";
49.436 +(*exp_CalcInt_No-3.xml*)
49.437 +val fmz = ["functionTerm (- q_0)",
49.438 + "integrateBy x","antiDerivativeName Q"];
49.439 +val (dI',pI',mI') =
49.440 + ("Biegelinie.thy",["named","integrate","function"],
49.441 + ["diff","integration","named"]);
49.442 +val p = e_pos'; val c = [];
49.443 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
49.444 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
49.445 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
49.446 +(*Error Tac Q not in ...*)
49.447 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*nxt <- Add_Find *);
49.448 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
49.449 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
49.450 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
49.451 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*nxt <- Apply_Method*);
49.452 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
49.453 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
49.454 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
49.455 +
49.456 +if f2str f = "Q x = c + -1 * q_0 * x" then()
49.457 +else raise error "integrate.sml: method [diff,integration,named] .Q";
49.458 +
49.459 +
49.460 +"----------- interSteps [diff,integration] -----------------------";
49.461 +"----------- interSteps [diff,integration] -----------------------";
49.462 +"----------- interSteps [diff,integration] -----------------------";
49.463 +states:=[];
49.464 +CalcTree
49.465 +[(["functionTerm (x^2 + 1)","integrateBy x","antiDerivative FF"],
49.466 + ("Integrate.thy",["integrate","function"],
49.467 + ["diff","integration"]))];
49.468 +Iterator 1;
49.469 +moveActiveRoot 1;
49.470 +autoCalculate 1 CompleteCalc;
49.471 +val ((pt,p),_) = get_calc 1; show_pt pt;
49.472 +
49.473 +interSteps 1 ([1],Res);
49.474 +val ((pt,p),_) = get_calc 1; show_pt pt;
49.475 +if existpt' ([1,3], Res) pt then ()
49.476 +else raise error "integrate.sml: interSteps on Rewrite_Set_Inst 1";
49.477 +
49.478 +
49.479 +"----------- method analog to rls 'integration' ------------------";
49.480 +"----------- method analog to rls 'integration' ------------------";
49.481 +"----------- method analog to rls 'integration' ------------------";
49.482 +store_met
49.483 + (prep_met Integrate.thy "met_testint" [] e_metID
49.484 + (["diff","integration","test"],
49.485 + [("#Given" ,["functionTerm f_", "integrateBy v_"]),
49.486 + ("#Find" ,["antiDerivative F_"])
49.487 + ],
49.488 + {rew_ord'="tless_true", rls'=Atools_erls, calc = [],
49.489 + srls = e_rls,
49.490 + prls=e_rls,
49.491 + crls = Atools_erls, nrls = e_rls},
49.492 +"Script IntegrationScript (f_::real) (v_::real) = \
49.493 +\ (((Rewrite_Set_Inst [(bdv,v_)] integration_rules False) @@ \
49.494 +\ (Rewrite_Set_Inst [(bdv,v_)] add_new_c False) @@ \
49.495 +\ (Rewrite_Set_Inst [(bdv,v_)] simplify_Integral False)) (f_::real))"
49.496 +));
49.497 +
49.498 +states:=[];
49.499 +CalcTree
49.500 +[(["functionTerm (Integral x^2 + 1 D x)","integrateBy x",
49.501 + "antiDerivative FF"],
49.502 + ("Integrate.thy",["integrate","function"],
49.503 + ["diff","integration","test"]))];
49.504 +Iterator 1;
49.505 +moveActiveRoot 1;
49.506 +autoCalculate 1 CompleteCalcHead;
49.507 +
49.508 +fetchProposedTactic 1 (*..Apply_Method*);
49.509 +autoCalculate 1 (Step 1);
49.510 +getTactic 1 ([1], Frm) (*still empty*);
49.511 +
49.512 +fetchProposedTactic 1 (*Rewrite_Set_Inst integration_rules*);
49.513 +autoCalculate 1 (Step 1);
49.514 +
49.515 +fetchProposedTactic 1 (*Rewrite_Set_Inst add_new_c*);
49.516 +autoCalculate 1 (Step 1);
49.517 +
49.518 +fetchProposedTactic 1 (*Rewrite_Set_Inst simplify_Integral*);
49.519 +autoCalculate 1 (Step 1);
49.520 +
49.521 +autoCalculate 1 CompleteCalc;
49.522 +val ((pt,p),_) = get_calc 1; show_pt pt;
49.523 +if existpt' ([3], Res) pt then ()
49.524 +else raise error "integrate.sml: test-script doesnt work";
49.525 +
49.526 +
49.527 +"----------- Ambiguous input: Integral ?u + ?v D ?bdv = ..--------";
49.528 +"----------- Ambiguous input: Integral ?u + ?v D ?bdv = ..--------";
49.529 +"----------- Ambiguous input: Integral ?u + ?v D ?bdv = ..--------";
49.530 +states:=[];
49.531 +CalcTree
49.532 +[(["functionTerm (x^2 + 1)","integrateBy x","antiDerivative FF"],
49.533 + ("Integrate.thy",["integrate","function"],
49.534 + ["diff","integration"]))];
49.535 +Iterator 1;
49.536 +moveActiveRoot 1;
49.537 +autoCalculate 1 CompleteCalc;
49.538 +val ((pt,p),_) = get_calc 1; show_pt pt;
49.539 +
49.540 +interSteps 1 ([1],Res);
49.541 +val ((pt,p),_) = get_calc 1; show_pt pt;
49.542 +interSteps 1 ([1,1],Res);
49.543 +val ((pt,p),_) = get_calc 1; show_pt pt;
49.544 +getTactic 1 ([1,1,1],Frm);
49.545 +
49.546 +val str = (unenclose o string_of_thm) integral_add;
49.547 +writeln str;
49.548 +(*
49.549 +read_cterm (sign_of thy) (str,(TVar(("DUMMY",0),[])));
49.550 +
49.551 +*** More than one term is type correct:
49.552 +*** ((Integral (?u + ?v) D ?bdv) =
49.553 +*** (Integral ?u D (?bdv + (Integral ?v D ?bdv))))
49.554 + ###^^^###
49.555 +*** ((Integral (?u + ?v) D ?bdv) =
49.556 +*** ((Integral ?u D ?bdv) + (Integral ?v D ?bdv)))
49.557 +*)
49.558 +
49.559 +if existpt' ([1,1,5], Res) pt then ()
49.560 +else raise error "integrate.sml: interSteps on Rewrite_Set_Inst 2";
49.561 +
49.562 +"----------- CAS input -------------------------------------------";
49.563 +"----------- CAS input -------------------------------------------";
49.564 +"----------- CAS input -------------------------------------------";
49.565 +val t = str2term "Integrate (x^^^2 + x + 1, x)";
49.566 +case t of Const ("Integrate.Integrate", _) $ _ => ()
49.567 + | _ => raise error "diff.sml behav.changed for Integrate (..., x)";
49.568 +atomty t;
49.569 +
49.570 +states:=[];
49.571 +CalcTree [([], ("e_domID", ["e_pblID"], ["e_metID"]))];
49.572 +Iterator 1;
49.573 +moveActiveRoot 1;
49.574 +replaceFormula 1 "Integrate (x^2 + x + 1, x)";
49.575 +autoCalculate 1 CompleteCalc;
49.576 +val ((pt,p),_) = get_calc 1;
49.577 +val Form res = (#1 o pt_extract) (pt, ([],Res));
49.578 +show_pt pt;
49.579 +(* WN070703 does not work like Diff due to error in next-pos
49.580 +if p = ([], Res) andalso term2str res = "5 * a" then ()
49.581 +else raise error "diff.sml behav.changed for Integrate (x^2 + x + 1, x)";
49.582 +*)
50.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
50.2 +++ b/test/Tools/isac/Knowledge/logexp.sml Mon Aug 30 14:35:51 2010 +0200
50.3 @@ -0,0 +1,61 @@
50.4 +(* testexamples for LogExp, logarithms and exponential functions and terms
50.5 +
50.6 +use"../smltest/IsacKnowledge/logexp.sml";
50.7 +*)
50.8 +
50.9 +val thy = LogExp.thy;
50.10 +"-----------------------------------------------------------------";
50.11 +"table of contents -----------------------------------------------";
50.12 +"-----------------------------------------------------------------";
50.13 +"----------- setup presentation innsbruck ------------------------";
50.14 +"-----------------------------------------------------------------";
50.15 +"-----------------------------------------------------------------";
50.16 +"-----------------------------------------------------------------";
50.17 +
50.18 +
50.19 +"----------- setup presentation innsbruck ------------------------";
50.20 +"----------- setup presentation innsbruck ------------------------";
50.21 +"----------- setup presentation innsbruck ------------------------";
50.22 +(*
50.23 +NOT INCLUDED IN ROOT.ML and RTEST-root.sml, since the pbl and met
50.24 +defined in IsacKnowledge/Test.ML are out-commented
50.25 +in order to allow for demonstration of authoring !
50.26 +
50.27 +equality_power;
50.28 +exp_invers_log;
50.29 +(* WN071203 ???... wrong thy ?!? because parsing with Isac.thy works ?
50.30 +refine ["equality ((2 log x) = 3)","solveFor x", "solutions L"]
50.31 + ["equation","test"];
50.32 +*)
50.33 +
50.34 +val t = str2term "(2 log x)";
50.35 +val t = str2term "(2 log x) = 3";
50.36 +val t = str2term "matches ((?a log x) = ?b) ((2 log x) = 3)";
50.37 +atomty t;
50.38 +
50.39 +
50.40 +val fmz = ["equality ((2 log x) = 3)","solveFor x", "solutions L"];
50.41 +val (dI',pI',mI') =
50.42 + ("Isac.thy",["logarithmic","univariate","equation","test"],
50.43 + ["Test","solve_log"]);
50.44 +val p = e_pos'; val c = [];
50.45 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
50.46 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
50.47 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
50.48 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
50.49 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
50.50 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
50.51 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
50.52 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
50.53 +case nxt of ("Apply_Method",_) => ()
50.54 + | _ => raise error "logexp.sml setup innsbruck";
50.55 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
50.56 +
50.57 +
50.58 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
50.59 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
50.60 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
50.61 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
50.62 +show_pt pt;
50.63 +
50.64 +*-------------------------------------------------------------------*)
51.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
51.2 +++ b/test/Tools/isac/Knowledge/poly.sml Mon Aug 30 14:35:51 2010 +0200
51.3 @@ -0,0 +1,423 @@
51.4 +(* testexamples for Poly, polynomials
51.5 + author: Matthias Goldgruber 2003
51.6 + (c) due to copyright terms
51.7 +
51.8 +use"../smltest/IsacKnowledge/poly.sml";
51.9 +use"poly.sml";
51.10 +****************************************************************.*)
51.11 +
51.12 +(******************************************************************
51.13 + WN060104 'SPB' came into 'exp_IsacCore_Simp_Poly_Book.xml'
51.14 + 'SPO' came into 'exp_IsacCore_Simp_Poly_Other.xml'
51.15 +*******************************************************************)
51.16 +"-----------------------------------------------------------------";
51.17 +"table of contents -----------------------------------------------";
51.18 +"-----------------------------------------------------------------";
51.19 +"-------- investigate new uniary minus ---------------------------";
51.20 +"-------- Bsple aus Schalk I -------------------------------------";
51.21 +"-------- Script 'simplification for_polynomials' ----------------";
51.22 +"-------- check pbl 'polynomial simplification' -----------------";
51.23 +"-------- me 'polynomial simplification' Schalk I p.63 No.267b ---";
51.24 +"-------- norm_Poly NOT COMPLETE ---------------------------------";
51.25 +"-------- ord_make_polynomial ------------------------------------";
51.26 +"-----------------------------------------------------------------";
51.27 +"-----------------------------------------------------------------";
51.28 +"-----------------------------------------------------------------";
51.29 +
51.30 +
51.31 +"-------- investigate new uniary minus ---------------------------";
51.32 +"-------- investigate new uniary minus ---------------------------";
51.33 +"-------- investigate new uniary minus ---------------------------";
51.34 +val t = (#prop o rep_thm) real_diff_0; (*"0 - ?x = - ?x"*)
51.35 +atomty t;
51.36 +(*** -------------
51.37 +*** Const ( Trueprop, bool => prop)
51.38 +*** . Const ( op =, [real, real] => bool)
51.39 +*** . . Const ( op -, [real, real] => real)
51.40 +*** . . . Const ( 0, real)
51.41 +*** . . . Var ((x, 0), real)
51.42 +*** . . Const ( uminus, real => real)
51.43 +*** . . . Var ((x, 0), real) *)
51.44 +
51.45 +val t = (term_of o the o (parse thy)) "-1";
51.46 +atomty t;
51.47 +(*** -------------
51.48 +*** Free ( -1, real) *)
51.49 +val t = (term_of o the o (parse thy)) "- 1";
51.50 +atomty t;
51.51 +(*** -------------
51.52 +*** Const ( uminus, real => real)
51.53 +*** . Free ( 1, real) *)
51.54 +
51.55 +val t = (term_of o the o (parse thy)) "-x"; (*1-x syntyx error !!!*)
51.56 +atomty t;
51.57 +(**** -------------
51.58 +*** Free ( -x, real)*)
51.59 +val t = (term_of o the o (parse thy)) "- x";
51.60 +atomty t;
51.61 +(**** -------------
51.62 +*** Free ( -x, real) !!!!!!!!!!!!!!!!!!!!!!!! is the same !!!*)
51.63 +val t = (term_of o the o (parse thy)) "-(x)";
51.64 +atomty t;
51.65 +(**** -------------
51.66 +*** Free ( -x, real)*)
51.67 +
51.68 +
51.69 +"-------- Bsple aus Schalk I -------------------------------------";
51.70 +"-------- Bsple aus Schalk I -------------------------------------";
51.71 +"-------- Bsple aus Schalk I -------------------------------------";
51.72 +(*SPB Schalk I p.63 No.267b*)
51.73 +val t = str2term
51.74 + "(5*x^^^2 + 3) * (2*x^^^7 + 3) - (3*x^^^5 + 8) * (6*x^^^4 - 1)";
51.75 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
51.76 +if (term2str t) =
51.77 +"17 + 15 * x ^^^ 2 + -48 * x ^^^ 4 + 3 * x ^^^ 5 + 6 * x ^^^ 7 + -8 * x ^^^ 9"
51.78 +then ()
51.79 +else raise error "poly.sml: diff.behav. in make_polynomial 1";
51.80 +
51.81 +(*SPB Schalk I p.63 No.275b*)
51.82 + val t = str2term
51.83 + "(3*x^^^2 - 2*x*y + y^^^2) * (x^^^2 - 2*y^^^2)";
51.84 + val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
51.85 + term2str t;
51.86 +if (term2str t) =
51.87 +"3 * x ^^^ 4 + -2 * x ^^^ 3 * y + -5 * x ^^^ 2 * y ^^^ 2 + \
51.88 +\4 * x * y ^^^ 3 +\n-2 * y ^^^ 4"
51.89 +then ()
51.90 +else raise error "poly.sml: diff.behav. in make_polynomial 2";
51.91 +
51.92 +(*SPB Schalk I p.63 No.279b*)
51.93 + val t = str2term
51.94 + "(x-a)*(x-b)*(x-c)*(x-d)";
51.95 + val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
51.96 + term2str t;
51.97 +(* Richtig! *)
51.98 +if (term2str t) =
51.99 +"a * b * c * d + -1 * a * b * c * x + -1 * a * b * d * x + a * b * x ^^^ 2 +\n-1 * a * c * d * x +\na * c * x ^^^ 2 +\na * d * x ^^^ 2 +\n-1 * a * x ^^^ 3 +\n-1 * b * c * d * x +\nb * c * x ^^^ 2 +\nb * d * x ^^^ 2 +\n-1 * b * x ^^^ 3 +\nc * d * x ^^^ 2 +\n-1 * c * x ^^^ 3 +\n-1 * d * x ^^^ 3 +\nx ^^^ 4"
51.100 +then ()
51.101 +else raise error "poly.sml: diff.behav. in make_polynomial 3";
51.102 +
51.103 +(*SPB Schalk I p.63 No.291*)
51.104 + val t = str2term
51.105 + "(5+96*x^^^3+8*x*(-4+(7- 3*x)*4*x))*(5*(2- 3*x)- (-15*x*(-8*x- 5)))";
51.106 + val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
51.107 + term2str t;
51.108 +if (term2str t) =
51.109 +"50 + -770 * x + 4520 * x ^^^ 2 + -16320 * x ^^^ 3 + -26880 * x ^^^ 4"
51.110 +then ()
51.111 +else raise error "poly.sml: diff.behav. in make_polynomial 4";
51.112 +
51.113 +(*SPB Schalk I p.64 No.295c*)
51.114 + val t = str2term
51.115 + "(13*a^^^4*b^^^9*c - 12*a^^^3*b^^^6*c^^^9)^^^2";
51.116 + val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
51.117 + term2str t;
51.118 +if (term2str t) =
51.119 +"169 * a ^^^ 8 * b ^^^ 18 * c ^^^ 2 + -312 * a ^^^ 7 * b ^^^ 15 * c ^^^ 10\
51.120 +\ +\n144 * a ^^^ 6 * b ^^^ 12 * c ^^^ 18"
51.121 +then ()
51.122 +else raise error "poly.sml: diff.behav. in make_polynomial 5";
51.123 +
51.124 +(*SPB Schalk I p.64 No.299a*)
51.125 + val t = str2term
51.126 + "(x - y)*(x + y)";
51.127 + val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
51.128 + term2str t;
51.129 +if (term2str t) =
51.130 +"x ^^^ 2 + -1 * y ^^^ 2"
51.131 +then ()
51.132 +else raise error "poly.sml: diff.behav. in make_polynomial 6";
51.133 +
51.134 +(*SPB Schalk I p.64 No.300c*)
51.135 + val t = str2term
51.136 + "(3*x^^^2*y - 1)*(3*x^^^2*y + 1)";
51.137 + val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
51.138 + term2str t;
51.139 +if (term2str t) =
51.140 +"-1 + 9 * x ^^^ 4 * y ^^^ 2"
51.141 +then ()
51.142 +else raise error "poly.sml: diff.behav. in make_polynomial 7";
51.143 +
51.144 +(*SPB Schalk I p.64 No.302*)
51.145 +val t = str2term
51.146 + "(13*x^^^2 + 5)*(13*x^^^2 - 5) - (5*x^^^2 + 3)*(5*x^^^2 - 3) - (12*x^^^2 + 4)*(12*x^^^2 - 4)";
51.147 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
51.148 +if term2str t = "0" then ()
51.149 +else raise error "poly.sml: diff.behav. in make_polynomial 8";
51.150 +(* Bei Berechnung sollte 3 mal real_plus_minus_binom1_p aus expand_poly verwendet werden *)
51.151 +
51.152 +
51.153 +(*SPB Schalk I p.64 No.306a*)
51.154 +val t = str2term "((x^^^2 + 1)*(x^^^2 - 1))^^^2";
51.155 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
51.156 +if (term2str t) = "1 + 2 * x ^^^ 4 + 2 * -2 * x ^^^ 4 + x ^^^ 8" then ()
51.157 +else raise error "poly.sml: diff.behav. in make_polynomial: not confluent \
51.158 + \2 * x ^^^ 4 + 2 * -2 * x ^^^ 4 = -2 * x ^^^ 4 works again";
51.159 +
51.160 +
51.161 +(*WN071729 when reducing "rls reduce_012_" for Schaerding,
51.162 +the above resulted in the term below ... but reduces from then correctly*)
51.163 +val t = str2term "1 + 2 * x ^^^ 4 + 2 * -2 * x ^^^ 4 + x ^^^ 8";
51.164 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
51.165 +if (term2str t) = "1 + -2 * x ^^^ 4 + x ^^^ 8" then ()
51.166 +else raise error "poly.sml: diff.behav. in make_polynomial 9b";
51.167 +
51.168 +(*SPB Schalk I p.64 No.296a*)
51.169 +val t = str2term "(x - a)^^^3";
51.170 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
51.171 +if (term2str t) = "-1 * a ^^^ 3 + 3 * a ^^^ 2 * x + -3 * a * x ^^^ 2 + x ^^^ 3"
51.172 +then () else raise error "poly.sml: diff.behav. in make_polynomial 10";
51.173 +
51.174 +(*SPB Schalk I p.64 No.296c*)
51.175 +val t = str2term "(-3*x - 4*y)^^^3";
51.176 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
51.177 +if (term2str t) =
51.178 +"-27 * x ^^^ 3 + -108 * x ^^^ 2 * y + -144 * x * y ^^^ 2 + -64 * y ^^^ 3"
51.179 +then () else raise error "poly.sml: diff.behav. in make_polynomial 11";
51.180 +
51.181 +(*SPB Schalk I p.62 No.242c*)
51.182 +val t = str2term "x^^^(-4)*(x^^^(-4)*y^^^(-2))^^^(-1)*y^^^(-2)";
51.183 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
51.184 +if (term2str t) = "1" then ()
51.185 +else raise error "poly.sml: diff.behav. in make_polynomial 12";
51.186 +
51.187 +(*SPB Schalk I p.60 No.209a*)
51.188 +val t = str2term "a^^^(7-x) * a^^^x";
51.189 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
51.190 +if term2str t = "a ^^^ 7" then ()
51.191 +else raise error "poly.sml: diff.behav. in make_polynomial 13";
51.192 +
51.193 +(*SPB Schalk I p.60 No.209d*)
51.194 +val t = str2term "d^^^x * d^^^(x+1) * d^^^(2 - 2*x)";
51.195 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
51.196 +if term2str t = "d ^^^ 3" then ()
51.197 +else raise error "poly.sml: diff.behav. in make_polynomial 14";
51.198 +
51.199 +
51.200 +(*---------------------------------------------------------------------*)
51.201 +(*------------------ Bsple bei denen es Probleme gibt------------------*)
51.202 +(*---------------------------------------------------------------------*)
51.203 +
51.204 +(*Schalk I p.64 No.303*)
51.205 +val t = str2term "(a + 2*b)*(a^^^2 + 4*b^^^2)*(a - 2*b) - (a - 6*b)*(a^^^2 + 36*b^^^2)*(a + 6*b)";
51.206 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
51.207 +if term2str t = "1280 * b ^^^ 4" then ()
51.208 +else raise error "poly.sml: diff.behav. in make_polynomial 14b";
51.209 +(* Richtig - aber Binomische Formel wurde nicht verwendet! *)
51.210 +
51.211 +
51.212 +(*--------------------------------------------------------------------*)
51.213 +(*----------------------- Eigene Beispiele ---------------------------*)
51.214 +(*--------------------------------------------------------------------*)
51.215 +(*SPO*)
51.216 +val t = str2term "a^^^2*a^^^(-2)";
51.217 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
51.218 +if term2str t = "1" then ()
51.219 +else raise error "poly.sml: diff.behav. in make_polynomial 15";
51.220 +(*SPO*)
51.221 +val t = str2term "a + a + a";
51.222 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
51.223 +if term2str t = "3 * a" then ()
51.224 +else raise error "poly.sml: diff.behav. in make_polynomial 16";
51.225 +(*SPO*)
51.226 +val t = str2term "a + b + b + b";
51.227 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
51.228 +if term2str t = "a + 3 * b" then ()
51.229 +else raise error "poly.sml: diff.behav. in make_polynomial 17";
51.230 +(*SPO*)
51.231 +val t = str2term "a^^^2*b*b^^^(-1)";
51.232 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
51.233 +if term2str t = "a ^^^ 2" then ()
51.234 +else raise error "poly.sml: diff.behav. in make_polynomial 18";
51.235 +(*SPO*)
51.236 +val t = str2term "a^^^2*a^^^(-2)";
51.237 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
51.238 +if (term2str t) = "1" then ()
51.239 +else raise error "poly.sml: diff.behav. in make_polynomial 19";
51.240 +(*SPO*)
51.241 +val t = str2term "b + a - b";
51.242 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
51.243 +if (term2str t) = "a" then ()
51.244 +else raise error "poly.sml: diff.behav. in make_polynomial 20";
51.245 +(*SPO*)
51.246 +val t = str2term "b * a * a";
51.247 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
51.248 +if term2str t = "a ^^^ 2 * b" then ()
51.249 +else raise error "poly.sml: diff.behav. in make_polynomial 21";
51.250 +(*SPO*)
51.251 +val t = str2term "(a^^^2)^^^3";
51.252 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
51.253 +if term2str t = "a ^^^ 6" then ()
51.254 +else raise error "poly.sml: diff.behav. in make_polynomial 22";
51.255 +(*SPO*)
51.256 +val t = str2term "x^^^2 * y^^^2 + x * x^^^2 * y";
51.257 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
51.258 +if term2str t = "x ^^^ 3 * y + x ^^^ 2 * y ^^^ 2" then ()
51.259 +else raise error "poly.sml: diff.behav. in make_polynomial 23";
51.260 +(*SPO*)
51.261 +val t = (term_of o the o (parse thy)) "a^^^2 * (-a)^^^2";
51.262 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
51.263 +if (term2str t) = "a ^^^ 4" then ()
51.264 +else raise error "poly.sml: diff.behav. in make_polynomial 24";
51.265 +(*SPO*)
51.266 +val t = str2term "a * b * b^^^(-1) + a";
51.267 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
51.268 +if (term2str t) = "2 * a" then ()
51.269 +else raise error "poly.sml: diff.behav. in make_polynomial 25";
51.270 +(*SPO*)
51.271 +val t = str2term "a*c*b^^^(2*n) + 3*a + 5*b^^^(2*n)*c*b";
51.272 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
51.273 +if (term2str t) = "3 * a + 5 * b ^^^ (1 + 2 * n) * c + a * b ^^^ (2 * n) * c"
51.274 +then () else raise error "poly.sml: diff.behav. in make_polynomial 26";
51.275 +
51.276 +
51.277 +(*MG.27.6.03 -------------vvv-: Verschachtelte Terme -----------*)
51.278 +(*SPO*)
51.279 +val t = str2term "(1 + (x*y*a) + x)^^^(1 + (x*y*a) + x)";
51.280 + val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
51.281 + term2str t;
51.282 +if term2str t = "(1 + x + a * x * y) ^^^ (1 + x + a * x * y)"
51.283 + then () else raise error "poly.sml: diff.behav. in make_polynomial 27";(*SPO*)
51.284 +val t = str2term "(1 + x*(y*z)*zz)^^^(1 + x*(y*z)*zz)";
51.285 + val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
51.286 + term2str t;
51.287 +if term2str t = "(1 + x * y * z * zz) ^^^ (1 + x * y * z * zz)"
51.288 + then () else raise error "poly.sml: diff.behav. in make_polynomial 28";
51.289 +
51.290 +"-------- Script 'simplification for_polynomials' ----------------";
51.291 +"-------- Script 'simplification for_polynomials' ----------------";
51.292 +"-------- Script 'simplification for_polynomials' ----------------";
51.293 +val str =
51.294 +"Script SimplifyScript (t_::real) = \
51.295 +\ ((Rewrite_Set norm_Poly False) t_)";
51.296 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
51.297 +atomty sc;
51.298 +
51.299 +
51.300 +"-------- check pbl 'polynomial simplification' -----------------";
51.301 +"-------- check pbl 'polynomial simplification' -----------------";
51.302 +"-------- check pbl 'polynomial simplification' -----------------";
51.303 +val fmz = ["term ((5*x^^^2 + 3) * (2*x^^^7 + 3) \
51.304 + \- (3*x^^^5 + 8) * (6*x^^^4 - 1))",
51.305 + "normalform N"];
51.306 +(*0*)
51.307 +case refine fmz ["polynomial","simplification"]of
51.308 + [Matches (["polynomial", "simplification"], _)] => ()
51.309 + | _ => raise error "poly.sml diff.behav. in check pbl, refine";
51.310 +(*...if there is an error, then ...*)
51.311 +
51.312 +(*1*)
51.313 +print_depth 7;
51.314 +val pbt = get_pbt ["polynomial","simplification"];
51.315 +print_depth 3;
51.316 +(*if there is ...
51.317 +> val NoMatch' {Given=gi, Where=wh, Find=fi,...} = match_pbl fmz pbt;
51.318 +... then trace_rewrite:*)
51.319 +
51.320 +(*2*)
51.321 +trace_rewrite:=true;
51.322 +match_pbl fmz pbt;
51.323 +trace_rewrite:=false;
51.324 +(*... if there is no rewrite, then there is something wrong with prls*)
51.325 +
51.326 +(*3*)
51.327 +print_depth 7;
51.328 +val prls = (#prls o get_pbt) ["polynomial","simplification"];
51.329 +print_depth 3;
51.330 +val t = str2term "((5*x^^^2 + 3) * (2*x^^^7 + 3) \
51.331 + \- (3*x^^^5 + 8) * (6*x^^^4 - 1)) is_polyexp";
51.332 +trace_rewrite:=true;
51.333 +val SOME (t',_) = rewrite_set_ thy false prls t;
51.334 +trace_rewrite:=false;
51.335 +if t' = HOLogic.true_const then ()
51.336 +else raise error "poly.sml: diff.behav. in check pbl 'polynomial..";
51.337 +(*... if this works, but (*1*) does still NOT work, check types:*)
51.338 +
51.339 +(*4*)
51.340 +show_types:=true;
51.341 +(*
51.342 +> val NoMatch' {Given=gi, Where=wh, Find=fi,...} = match_pbl fmz pbt;
51.343 +val wh = [False "(t_::real => real) (is_polyexp::real)"]
51.344 +......................^^^^^^^^^^^^...............^^^^*)
51.345 +val Matches' _ = match_pbl fmz pbt;
51.346 +show_types:=false;
51.347 +
51.348 +
51.349 +"-------- me 'polynomial simplification' Schalk I p.63 No.267b ---";
51.350 +"-------- me 'polynomial simplification' Schalk I p.63 No.267b ---";
51.351 +"-------- me 'polynomial simplification' Schalk I p.63 No.267b ---";
51.352 +val fmz = ["term ((5*x^^^2 + 3) * (2*x^^^7 + 3) \
51.353 + \- (3*x^^^5 + 8) * (6*x^^^4 - 1))",
51.354 + "normalform N"];
51.355 +val (dI',pI',mI') =
51.356 + ("Poly.thy",["polynomial","simplification"],
51.357 + ["simplification","for_polynomials"]);
51.358 +val p = e_pos'; val c = [];
51.359 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
51.360 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
51.361 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
51.362 +(writeln o (itms2str_ ctxt)) (get_obj g_pbl pt (fst p));
51.363 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
51.364 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
51.365 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
51.366 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
51.367 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
51.368 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
51.369 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
51.370 +if f2str f =
51.371 +"17 + 15 * x ^^^ 2 + -48 * x ^^^ 4 + 3 * x ^^^ 5 + 6 * x ^^^ 7 + -8 * x ^^^ 9"
51.372 +then () else raise error "poly.sml diff.behav. in me Schalk I p.63 No.267b";
51.373 +
51.374 +
51.375 +"-------- interSteps for Schalk 299a -----------------------------";
51.376 +"-------- interSteps for Schalk 299a -----------------------------";
51.377 +"-------- interSteps for Schalk 299a -----------------------------";
51.378 +states:=[];
51.379 +CalcTree
51.380 +[(["term ((x - y)*(x + y))", "normalform N"],
51.381 + ("Poly.thy",["polynomial","simplification"],
51.382 + ["simplification","for_polynomials"]))];
51.383 +Iterator 1;
51.384 +moveActiveRoot 1;
51.385 +autoCalculate 1 CompleteCalc;
51.386 +val ((pt,p),_) = get_calc 1; show_pt pt;
51.387 +
51.388 +interSteps 1 ([1],Res)(*<ERROR> syserror in detailstep </ERROR>*);
51.389 +val ((pt,p),_) = get_calc 1; show_pt pt;
51.390 +if existpt' ([1,1], Frm) pt then ()
51.391 +else raise error "poly.sml: interSteps doesnt work again 1";
51.392 +
51.393 +interSteps 1 ([1,1],Res)(*<ERROR> syserror in detailstep </ERROR>*);
51.394 +val ((pt,p),_) = get_calc 1; show_pt pt;
51.395 +if existpt' ([1,1,1], Frm) pt then ()
51.396 +else raise error "poly.sml: interSteps doesnt work again 2";
51.397 +
51.398 +
51.399 +"-------- norm_Poly NOT COMPLETE ---------------------------------";
51.400 +"-------- norm_Poly NOT COMPLETE ---------------------------------";
51.401 +"-------- norm_Poly NOT COMPLETE ---------------------------------";
51.402 +trace_rewrite:=true;
51.403 +val SOME (f',_) = rewrite_set_ thy false norm_Poly
51.404 +(str2term "L = k - 2 * q + (k - 2 * q) + (k - 2 * q) + (k - 2 * q) + senkrecht + oben")(*see poly.sml: -- norm_Poly NOT COMPLETE -- TODO MG*);
51.405 +trace_rewrite:=false;
51.406 +term2str f';
51.407 +
51.408 +"-------- ord_make_polynomial ------------------------------------";
51.409 +"-------- ord_make_polynomial ------------------------------------";
51.410 +"-------- ord_make_polynomial ------------------------------------";
51.411 +val t1 = str2term "2 * b + (3 * a + 3 * b)";
51.412 +val t2 = str2term "3 * a + 3 * b + 2 * b";
51.413 +
51.414 +if ord_make_polynomial true Poly.thy [] (t1, t2) then ()
51.415 +else raise error "poly.sml: diff.behav. in ord_make_polynomial";
51.416 +
51.417 +(*WN071202: ^^^ why then is there no rewriting ...*)
51.418 +val term = str2term "2*b + (3*a + 3*b)";
51.419 +val NONE = rewrite_set_ Isac.thy false order_add_mult term;
51.420 +
51.421 +(*or why is there no rewriting this way...*)
51.422 +val t1 = str2term "2 * b + (3 * a + 3 * b)";
51.423 +val t2 = str2term "3 * a + (2 * b + 3 * b)";
51.424 +
51.425 +
51.426 +
52.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
52.2 +++ b/test/Tools/isac/Knowledge/polyeq.sml Mon Aug 30 14:35:51 2010 +0200
52.3 @@ -0,0 +1,1178 @@
52.4 +(* testexamples for PolyEq, poynomial equations and equational systems
52.5 + author: Richard Lang
52.6 + 2003
52.7 + (c) due to copyright terms
52.8 +
52.9 +use"../smltest/IsacKnowledge/polyeq.sml";
52.10 +use"polyeq.sml";
52.11 +
52.12 +WN030609: some expls dont work due to unfinished handling of 'expanded terms';
52.13 + others marked with TODO have to be checked, too.
52.14 +*)
52.15 +
52.16 +"-----------------------------------------------------------------";
52.17 +"table of contents -----------------------------------------------";
52.18 +(*WN060608 some ----- are not in this table*)
52.19 +"-----------------------------------------------------------------";
52.20 +"----------- tests on predicates in problems ---------------------";
52.21 +"----------- test matching problems --------------------------0---";
52.22 +"----------- (-8 - 2*x + x^^^2 = 0), (*Schalk 2, S.67 Nr.31.b----";
52.23 +"----------- (-16 + 4*x + 2*x^^^2 = 0), --------------------------";
52.24 +"----------- (a*b - (a+b)*x + x^^^2 = 0), (*Schalk 2,S.68Nr.44.a*)";
52.25 +"----------- (-64 + x^^^2 = 0), (*Schalk 2, S.66 Nr.1.a~--------*)";
52.26 +"----------- (-147 + 3*x^^^2 = 0), (*Schalk 2, S.66 Nr.1.b------*)";
52.27 +"----------- (3*x - 1 - (5*x - (2 - 4*x)) = -11),(*Schalk Is86Bsp5";
52.28 +"----------- ((x+1)*(x+2) - (3*x - 2)^^^2=.. Schalk II s.68 Bsp 37";
52.29 +"----------- interSteps ([1],Res); on Schalk Is86Bsp5-------------";
52.30 +"-----------------------------------------------------------------";
52.31 +"-----------------------------------------------------------------";
52.32 +"-----------------------------------------------------------------";
52.33 +
52.34 +val c = [];
52.35 +
52.36 +"----------- tests on predicates in problems ---------------------";
52.37 +"----------- tests on predicates in problems ---------------------";
52.38 +"----------- tests on predicates in problems ---------------------";
52.39 +(*
52.40 + Compiler.Control.Print.printDepth:=5; (*4 default*)
52.41 + trace_rewrite:=true;
52.42 + trace_rewrite:=false;
52.43 +*)
52.44 + val t1 = (term_of o the o (parse thy)) "lhs (-8 - 2*x + x^^^2 = 0)";
52.45 + val SOME (t,_) = rewrite_set_ PolyEq.thy false PolyEq_prls t1;
52.46 + if ((term2str t) = "-8 - 2 * x + x ^^^ 2") then ()
52.47 + else raise error "polyeq.sml: diff.behav. in lhs";
52.48 +
52.49 +
52.50 + val t2 = (term_of o the o (parse thy)) "(-8 - 2*x + x^^^2) is_expanded_in x";
52.51 + val SOME (t,_) = rewrite_set_ PolyEq.thy false PolyEq_prls t2;
52.52 + if (term2str t) = "True" then ()
52.53 + else raise error "polyeq.sml: diff.behav. 1 in is_expended_in";
52.54 +
52.55 + val t0 = (term_of o the o (parse thy)) "(sqrt(x)) is_poly_in x";
52.56 + val SOME (t,_) = rewrite_set_ PolyEq.thy false PolyEq_prls t0;
52.57 + if (term2str t) = "False" then ()
52.58 + else raise error "polyeq.sml: diff.behav. 2 in is_poly_in";
52.59 +
52.60 +
52.61 + val t3 = (term_of o the o (parse thy)) "(-8 + (-1)*2*x + x^^^2) is_poly_in x";
52.62 + val SOME (t,_) = rewrite_set_ PolyEq.thy false PolyEq_prls t3;
52.63 + if (term2str t) = "True" then ()
52.64 + else raise error "polyeq.sml: diff.behav. 3 in is_poly_in";
52.65 +
52.66 +
52.67 + val t4 = (term_of o the o (parse thy)) "(lhs (-8 + (-1)*2*x + x^^^2 = 0)) is_expanded_in x";
52.68 + val SOME (t,_) = rewrite_set_ PolyEq.thy false PolyEq_prls t4;
52.69 + if (term2str t) = "True" then ()
52.70 + else raise error "polyeq.sml: diff.behav. 4 in is_expended_in";
52.71 +
52.72 +
52.73 + val t6 = (term_of o the o (parse thy)) "(lhs (-8 - 2*x + x^^^2 = 0)) is_expanded_in x";
52.74 + val SOME (t,_) = rewrite_set_ PolyEq.thy false PolyEq_prls t6;
52.75 + if (term2str t) = "True" then ()
52.76 + else raise error "polyeq.sml: diff.behav. 5 in is_expended_in";
52.77 +
52.78 + val t3 = (term_of o the o (parse thy))"((-8 - 2*x + x^^^2) has_degree_in x) = 2";
52.79 + val SOME (t,_) = rewrite_set_ PolyEq.thy false PolyEq_prls t3;
52.80 + if (term2str t) = "True" then ()
52.81 + else raise error "polyeq.sml: diff.behav. in has_degree_in_in";
52.82 +
52.83 +
52.84 + val t3 = (term_of o the o (parse thy)) "((sqrt(x)) has_degree_in x) = 2";
52.85 + val SOME (t,_) = rewrite_set_ PolyEq.thy false PolyEq_prls t3;
52.86 + if (term2str t) = "False" then ()
52.87 + else raise error "polyeq.sml: diff.behav. 6 in has_degree_in_in";
52.88 +
52.89 + val t4 = (term_of o the o (parse thy))
52.90 + "((-8 - 2*x + x^^^2) has_degree_in x) = 1";
52.91 + val SOME (t,_) = rewrite_set_ PolyEq.thy false PolyEq_prls t4;
52.92 + if (term2str t) = "False" then ()
52.93 + else raise error "polyeq.sml: diff.behav. 7 in has_degree_in_in";
52.94 +
52.95 +
52.96 + val t5 = (term_of o the o (parse thy))
52.97 + "((-8 - 2*x + x^^^2) has_degree_in x) = 2";
52.98 + val SOME (t,_) = rewrite_set_ PolyEq.thy false PolyEq_prls t5;
52.99 + if (term2str t) = "True" then ()
52.100 + else raise error "polyeq.sml: diff.behav. 8 in has_degree_in_in";
52.101 +
52.102 +
52.103 +"----------- test matching problems --------------------------0---";
52.104 +"----------- test matching problems --------------------------0---";
52.105 +"----------- test matching problems --------------------------0---";
52.106 + val fmz = ["equality (-8 - 2*x + x^^^2 = 0)", "solveFor x","solutions L"];
52.107 + val pbt as {thy = thy, where_ = pre, ppc = ppc,...} =
52.108 + get_pbt ["expanded","univariate","equation"];
52.109 +
52.110 + match_pbl fmz (get_pbt ["expanded","univariate","equation"]);
52.111 + (*Matches'
52.112 + {Find=[Correct "solutions L"],
52.113 + Given=[Correct "equality (-8 - 2 * x + x ^^^ 2 = 0)",
52.114 + Correct "solveFor x"],Relate=[],
52.115 + Where=[Correct "matches (?a = 0) (-8 - 2 * x + x ^^^ 2 = 0)",
52.116 + Correct "lhs (-8 - 2 * x + x ^^^ 2 = 0) is_expanded_in x"],With=[]}
52.117 + *)
52.118 + match_pbl fmz (get_pbt ["degree_2","expanded","univariate","equation"]);
52.119 + (*Matches'
52.120 + {Find=[Correct "solutions L"],
52.121 + Given=[Correct "equality (-8 - 2 * x + x ^^^ 2 = 0)",
52.122 + Correct "solveFor x"],Relate=[],
52.123 + Where=[Correct "lhs (-8 - 2 * x + x ^^^ 2 = 0) has_degree_in x =!= 2"],
52.124 + With=[]}*)
52.125 +
52.126 +"-------------------- test thm's degree_0 --------------------------------------";
52.127 +"-------------------- test thm's degree_0 --------------------------------------";
52.128 +"----- d0_false ------";
52.129 +(*EP*)
52.130 +val fmz = ["equality ( 1 = 0)", "solveFor x","solutions L"];
52.131 +val (dI',pI',mI') = ("PolyEq.thy",["degree_0","polynomial","univariate","equation"],
52.132 + ["PolyEq","solve_d0_polyeq_equation"]);
52.133 +(*val p = e_pos';
52.134 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.135 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.136 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.137 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.138 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.139 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.140 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.141 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.142 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.143 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[]")) => ()
52.144 + | _ => raise error "polyeq.sml: diff.behav. in 1 = 0 -> []";
52.145 +
52.146 +"----- d0_true ------";
52.147 +(*EP-7*)
52.148 +val fmz = ["equality ( 0 = 0)", "solveFor x","solutions L"];
52.149 +val (dI',pI',mI') = ("PolyEq.thy",["degree_0","polynomial","univariate","equation"],
52.150 + ["PolyEq","solve_d0_polyeq_equation"]);
52.151 +(*val p = e_pos'; val c = [];
52.152 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.153 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.154 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.155 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.156 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.157 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.158 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.159 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.160 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.161 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"UniversalList")) => ()
52.162 + | _ => raise error "polyeq.sml: diff.behav. in 0 = 0 -> UniversalList";
52.163 +
52.164 +"-------------------- test thm's degree_2 ------------------------------------------";
52.165 +"-------------------- test thm's degree_2 ------------------------------------------";
52.166 +
52.167 +"-------------------- test thm's d2_pq_formulsxx[_neg]-----";
52.168 +"-------------------- test thm's d2_pq_formulsxx[_neg]-----";
52.169 +"-------------------- test thm's d2_pq_formulsxx[_neg]-----";
52.170 +
52.171 +"----- d2_pqformula1 ------!!!!";
52.172 +val fmz = ["equality (-2 +(-1)*x + x^^^2 = 0)", "solveFor x","solutions L"];
52.173 +val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"], ["PolyEq","solve_d2_polyeq_pq_equation"]);
52.174 +(*val p = e_pos'; val c = [];
52.175 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.176 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.177 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.178 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.179 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.180 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.181 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.182 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.183 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.184 +(*### or2list _ | _
52.185 + ([3],Res) "x = 2 | x = -1" Or_to_List*)
52.186 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.187 +(*### or2list _ | _
52.188 + ### applicable_in Check_elementwise: --> ([x = 2, x = -1], [])
52.189 + ([4],Res) "[x = 2, x = -1]" Check_elementwise "Assumptions"*)
52.190 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.191 +(*### applicable_in Check_elementwise: --> ([x = 2, x = -1], [])
52.192 + ([5],Res) "[x = 2, x = -1]" Check_Postcond*)
52.193 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.194 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 2, x = -1]")) => ()
52.195 + | _ => raise error "polyeq.sml: diff.behav. in -2 + (-1)*x + x^2 = 0 -> [x = 2, x = -1]";
52.196 +
52.197 +"----- d2_pqformula1_neg ------";
52.198 +(*EP-8*)
52.199 +val fmz = ["equality ( 2 +(-1)*x + x^^^2 = 0)", "solveFor x","solutions L"];
52.200 +val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"], ["PolyEq","solve_d2_polyeq_pq_equation"]);
52.201 +(*val p = e_pos'; val c = [];
52.202 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.203 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.204 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.205 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.206 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.207 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.208 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.209 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.210 +(*### or2list False
52.211 + ([1],Res) False Or_to_List)*)
52.212 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.213 +(*### or2list False
52.214 + ([2],Res) [] Check_elementwise "Assumptions"*)
52.215 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.216 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.217 +val asm = get_assumptions_ pt p;
52.218 +if f = Form' (FormKF (~1,EdUndef,0,Nundef,"[]")) andalso asm = [] then ()
52.219 +else raise error "polyeq.sml: diff.behav. in 2 +(-1)*x + x^^^2 = 0";
52.220 +
52.221 +"----- d2_pqformula2 ------";
52.222 +val fmz = ["equality (-2 +(-1)*x + 1*x^^^2 = 0)", "solveFor x","solutions L"];
52.223 +val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
52.224 + ["PolyEq","solve_d2_polyeq_pq_equation"]);
52.225 +(*val p = e_pos'; val c = [];
52.226 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.227 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.228 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.229 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.230 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.231 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.232 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.233 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.234 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.235 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.236 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.237 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 2, x = -1]")) => ()
52.238 + | _ => raise error "polyeq.sml: diff.behav. in -2 + (-1)*x + x^2 = 0 -> [x = 2, x = -1]";
52.239 +
52.240 +
52.241 +"----- d2_pqformula2_neg ------";
52.242 +val fmz = ["equality ( 2 +(-1)*x + 1*x^^^2 = 0)", "solveFor x","solutions L"];
52.243 +val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
52.244 + ["PolyEq","solve_d2_polyeq_pq_equation"]);
52.245 +(*val p = e_pos'; val c = [];
52.246 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.247 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.248 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.249 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.250 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.251 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.252 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.253 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.254 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.255 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.256 +"TODO 2 +(-1)*x + 1*x^^^2 = 0";
52.257 +"TODO 2 +(-1)*x + 1*x^^^2 = 0";
52.258 +"TODO 2 +(-1)*x + 1*x^^^2 = 0";
52.259 +
52.260 +
52.261 +"----- d2_pqformula3 ------";
52.262 +(*EP-9*)
52.263 +val fmz = ["equality (-2 + x + x^^^2 = 0)", "solveFor x","solutions L"];
52.264 +val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
52.265 + ["PolyEq","solve_d2_polyeq_pq_equation"]);
52.266 +(*val p = e_pos'; val c = [];
52.267 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.268 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.269 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.270 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.271 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.272 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.273 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.274 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.275 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.276 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.277 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.278 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 1, x = -2]")) => ()
52.279 + | _ => raise error "polyeq.sml: diff.behav. in -2 + x + x^2 = 0-> [x = 1, x = -2]";
52.280 +
52.281 +"----- d2_pqformula3_neg ------";
52.282 +val fmz = ["equality ( 2 + x + x^^^2 = 0)", "solveFor x","solutions L"];
52.283 +val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
52.284 + ["PolyEq","solve_d2_polyeq_pq_equation"]);
52.285 +(*val p = e_pos'; val c = [];
52.286 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.287 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.288 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.289 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.290 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.291 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.292 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.293 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.294 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.295 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.296 +"TODO 2 + x + x^^^2 = 0";
52.297 +"TODO 2 + x + x^^^2 = 0";
52.298 +"TODO 2 + x + x^^^2 = 0";
52.299 +
52.300 +
52.301 +"----- d2_pqformula4 ------";
52.302 +val fmz = ["equality (-2 + x + 1*x^^^2 = 0)", "solveFor x","solutions L"];
52.303 +val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
52.304 + ["PolyEq","solve_d2_polyeq_pq_equation"]);
52.305 +(*val p = e_pos'; val c = [];
52.306 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.307 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.308 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.309 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.310 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.311 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.312 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.313 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.314 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.315 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.316 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.317 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 1, x = -2]")) => ()
52.318 + | _ => raise error "polyeq.sml: diff.behav. in -2 + x + 1*x^^^2 = 0 -> [x = 1, x = -2]";
52.319 +
52.320 +"----- d2_pqformula4_neg ------";
52.321 +val fmz = ["equality ( 2 + x + 1*x^^^2 = 0)", "solveFor x","solutions L"];
52.322 +val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
52.323 + ["PolyEq","solve_d2_polyeq_pq_equation"]);
52.324 +(*val p = e_pos'; val c = [];
52.325 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.326 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.327 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.328 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.329 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.330 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.331 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.332 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.333 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.334 +"TODO 2 + x + 1*x^^^2 = 0";
52.335 +"TODO 2 + x + 1*x^^^2 = 0";
52.336 +"TODO 2 + x + 1*x^^^2 = 0";
52.337 +
52.338 +"----- d2_pqformula5 ------";
52.339 +val fmz = ["equality (1*x + x^^^2 = 0)", "solveFor x","solutions L"];
52.340 +val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
52.341 + ["PolyEq","solve_d2_polyeq_pq_equation"]);
52.342 +(*val p = e_pos'; val c = [];
52.343 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.344 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.345 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.346 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.347 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.348 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.349 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.350 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.351 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.352 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.353 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.354 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 0, x = -1]")) => ()
52.355 + | _ => raise error "polyeq.sml: diff.behav. in 1*x + x^2 = 0 -> [x = 0, x = -1]";
52.356 +
52.357 +"----- d2_pqformula6 ------";
52.358 +val fmz = ["equality (1*x + 1*x^^^2 = 0)", "solveFor x","solutions L"];
52.359 +val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
52.360 + ["PolyEq","solve_d2_polyeq_pq_equation"]);
52.361 +(*val p = e_pos'; val c = [];
52.362 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.363 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.364 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.365 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.366 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.367 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.368 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.369 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.370 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.371 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.372 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.373 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 0, x = -1]")) => ()
52.374 + | _ => raise error "polyeq.sml: diff.behav. in 1*x + 1*x^2 = 0 -> [x = 0, x = -1]";
52.375 +
52.376 +"----- d2_pqformula7 ------";
52.377 +(*EP-10*)
52.378 +val fmz = ["equality ( x + x^^^2 = 0)", "solveFor x","solutions L"];
52.379 +val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
52.380 + ["PolyEq","solve_d2_polyeq_pq_equation"]);
52.381 +(*val p = e_pos'; val c = [];
52.382 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.383 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.384 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.385 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.386 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.387 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.388 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.389 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.390 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.391 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.392 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.393 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 0, x = -1]")) => ()
52.394 + | _ => raise error "polyeq.sml: diff.behav. in x + x^2 = 0 -> [x = 0, x = -1]";
52.395 +
52.396 +"----- d2_pqformula8 ------";
52.397 +val fmz = ["equality ( x + 1*x^^^2 = 0)", "solveFor x","solutions L"];
52.398 +val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
52.399 + ["PolyEq","solve_d2_polyeq_pq_equation"]);
52.400 +(*val p = e_pos'; val c = [];
52.401 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.402 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.403 +
52.404 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.405 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.406 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.407 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.408 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.409 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.410 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.411 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.412 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.413 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 0, x = -1]")) => ()
52.414 + | _ => raise error "polyeq.sml: diff.behav. in x + 1*x^2 = 0 -> [x = 0, x = -1]";
52.415 +
52.416 +"----- d2_pqformula9 ------";
52.417 +val fmz = ["equality (-4 + x^^^2 = 0)", "solveFor x","solutions L"];
52.418 +val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
52.419 + ["PolyEq","solve_d2_polyeq_pq_equation"]);
52.420 +(*val p = e_pos'; val c = [];
52.421 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.422 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.423 +
52.424 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.425 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.426 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.427 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.428 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.429 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.430 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.431 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.432 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 2, x = -2]")) => ()
52.433 + | _ => raise error "polyeq.sml: diff.behav. in -4 + x^2 = 0 -> [x = 2, x = -2]";
52.434 +
52.435 +
52.436 +"----- d2_pqformula10_neg ------";
52.437 +val fmz = ["equality (4 + x^^^2 = 0)", "solveFor x","solutions L"];
52.438 +val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
52.439 + ["PolyEq","solve_d2_polyeq_pq_equation"]);
52.440 +(*val p = e_pos'; val c = [];
52.441 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.442 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.443 +
52.444 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.445 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.446 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.447 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.448 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.449 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.450 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.451 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.452 +"TODO 4 + x^^^2 = 0";
52.453 +"TODO 4 + x^^^2 = 0";
52.454 +"TODO 4 + x^^^2 = 0";
52.455 +
52.456 +"----- d2_pqformula10 ------";
52.457 +val fmz = ["equality (-4 + 1*x^^^2 = 0)", "solveFor x","solutions L"];
52.458 +val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
52.459 + ["PolyEq","solve_d2_polyeq_pq_equation"]);
52.460 +(*val p = e_pos'; val c = [];
52.461 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.462 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.463 +
52.464 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.465 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.466 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.467 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.468 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.469 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.470 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.471 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.472 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 2, x = -2]")) => ()
52.473 + | _ => raise error "polyeq.sml: diff.behav. in -4 + 1*x^2 = 0 -> [x = 2, x = -2]";
52.474 +
52.475 +"----- d2_pqformula9_neg ------";
52.476 +val fmz = ["equality (4 + 1*x^^^2 = 0)", "solveFor x","solutions L"];
52.477 +val (dI',pI',mI') = ("PolyEq.thy",["pqFormula","degree_2","polynomial","univariate","equation"],
52.478 + ["PolyEq","solve_d2_polyeq_pq_equation"]);
52.479 +(*val p = e_pos'; val c = [];
52.480 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.481 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.482 +
52.483 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.484 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.485 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.486 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.487 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.488 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.489 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.490 +"TODO 4 + 1*x^^^2 = 0";
52.491 +"TODO 4 + 1*x^^^2 = 0";
52.492 +"TODO 4 + 1*x^^^2 = 0";
52.493 +
52.494 +"-------------------- test thm's d2_abc_formulsxx[_neg]-----";
52.495 +"-------------------- test thm's d2_abc_formulsxx[_neg]-----";
52.496 +"-------------------- test thm's d2_abc_formulsxx[_neg]-----";
52.497 +
52.498 +val fmz = ["equality (-1 +(-1)*x + 2*x^^^2 = 0)", "solveFor x","solutions L"];
52.499 +val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
52.500 + ["PolyEq","solve_d2_polyeq_abc_equation"]);
52.501 +(*val p = e_pos'; val c = [];
52.502 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.503 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.504 +
52.505 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.506 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.507 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.508 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.509 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.510 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.511 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.512 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.513 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 1, x = -1 / 2]")) => ()
52.514 + | _ => raise error "polyeq.sml: diff.behav. in -1 + (-1)*x + 2*x^2 = 0 -> [x = 1, x = -1/2]";
52.515 +
52.516 +val fmz = ["equality ( 1 +(-1)*x + 2*x^^^2 = 0)", "solveFor x","solutions L"];
52.517 +val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
52.518 + ["PolyEq","solve_d2_polyeq_abc_equation"]);
52.519 +(*val p = e_pos'; val c = [];
52.520 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.521 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.522 +
52.523 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.524 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.525 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.526 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.527 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.528 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.529 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.530 +"TODO 1 +(-1)*x + 2*x^^^2 = 0";
52.531 +"TODO 1 +(-1)*x + 2*x^^^2 = 0";
52.532 +"TODO 1 +(-1)*x + 2*x^^^2 = 0";
52.533 +
52.534 +(*EP-11*)
52.535 +val fmz = ["equality (-1 + x + 2*x^^^2 = 0)", "solveFor x","solutions L"];
52.536 +val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
52.537 + ["PolyEq","solve_d2_polyeq_abc_equation"]);
52.538 +(*val p = e_pos'; val c = [];
52.539 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.540 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.541 +
52.542 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.543 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.544 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.545 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.546 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.547 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.548 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.549 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.550 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 1 / 2, x = -1]")) => ()
52.551 + | _ => raise error "polyeq.sml: diff.behav. in -1 + x + 2*x^2 = 0 -> [x = 1/2, x = -1]";
52.552 +
52.553 +val fmz = ["equality ( 1 + x + 2*x^^^2 = 0)", "solveFor x","solutions L"];
52.554 +val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
52.555 + ["PolyEq","solve_d2_polyeq_abc_equation"]);
52.556 +(*val p = e_pos'; val c = [];
52.557 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.558 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.559 +
52.560 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.561 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.562 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.563 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.564 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.565 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.566 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.567 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.568 +"TODO 1 + x + 2*x^^^2 = 0";
52.569 +"TODO 1 + x + 2*x^^^2 = 0";
52.570 +"TODO 1 + x + 2*x^^^2 = 0";
52.571 +
52.572 +val fmz = ["equality (-2 + 1*x + x^^^2 = 0)", "solveFor x","solutions L"];
52.573 +val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
52.574 + ["PolyEq","solve_d2_polyeq_abc_equation"]);
52.575 +(*val p = e_pos'; val c = [];
52.576 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.577 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.578 +
52.579 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.580 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.581 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.582 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.583 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.584 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.585 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.586 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.587 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 1, x = -2]")) => ()
52.588 + | _ => raise error "polyeq.sml: diff.behav. in -2 + 1*x + x^2 = 0 -> [x = 1, x = -2]";
52.589 +
52.590 +val fmz = ["equality ( 2 + 1*x + x^^^2 = 0)", "solveFor x","solutions L"];
52.591 +val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
52.592 + ["PolyEq","solve_d2_polyeq_abc_equation"]);
52.593 +(*val p = e_pos'; val c = [];
52.594 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.595 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.596 +
52.597 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.598 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.599 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.600 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.601 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.602 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.603 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.604 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.605 +"TODO 2 + 1*x + x^^^2 = 0";
52.606 +"TODO 2 + 1*x + x^^^2 = 0";
52.607 +"TODO 2 + 1*x + x^^^2 = 0";
52.608 +
52.609 +(*EP-12*)
52.610 +val fmz = ["equality (-2 + x + x^^^2 = 0)", "solveFor x","solutions L"];
52.611 +val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
52.612 + ["PolyEq","solve_d2_polyeq_abc_equation"]);
52.613 +(*val p = e_pos'; val c = [];
52.614 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.615 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.616 +
52.617 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.618 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.619 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.620 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.621 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.622 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.623 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.624 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.625 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 1, x = -2]")) => ()
52.626 + | _ => raise error "polyeq.sml: diff.behav. in -2 + x + x^2 = 0 -> [x = 1, x = -2]";
52.627 +
52.628 +val fmz = ["equality ( 2 + x + x^^^2 = 0)", "solveFor x","solutions L"];
52.629 +val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
52.630 + ["PolyEq","solve_d2_polyeq_abc_equation"]);
52.631 +(*val p = e_pos'; val c = [];
52.632 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.633 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.634 +
52.635 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.636 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.637 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.638 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.639 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.640 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.641 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.642 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.643 +"TODO 2 + x + x^^^2 = 0";
52.644 +"TODO 2 + x + x^^^2 = 0";
52.645 +"TODO 2 + x + x^^^2 = 0";
52.646 +
52.647 +(*EP-13*)
52.648 +val fmz = ["equality (-8 + 2*x^^^2 = 0)", "solveFor x","solutions L"];
52.649 +val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
52.650 + ["PolyEq","solve_d2_polyeq_abc_equation"]);
52.651 +(*val p = e_pos'; val c = [];
52.652 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.653 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.654 +
52.655 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.656 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.657 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.658 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.659 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.660 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.661 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.662 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.663 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 2, x = -2]")) => ()
52.664 + | _ => raise error "polyeq.sml: diff.behav. in -8 + 2*x^2 = 0 -> [x = 2, x = -2]";
52.665 +
52.666 +val fmz = ["equality ( 8+ 2*x^^^2 = 0)", "solveFor x","solutions L"];
52.667 +val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
52.668 + ["PolyEq","solve_d2_polyeq_abc_equation"]);
52.669 +(*val p = e_pos'; val c = [];
52.670 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.671 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.672 +
52.673 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.674 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.675 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.676 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.677 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.678 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.679 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.680 +"TODO 8+ 2*x^^^2 = 0";
52.681 +"TODO 8+ 2*x^^^2 = 0";
52.682 +"TODO 8+ 2*x^^^2 = 0";
52.683 +
52.684 +(*EP-14*)
52.685 +val fmz = ["equality (-4 + x^^^2 = 0)", "solveFor x","solutions L"];
52.686 +val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"], ["PolyEq","solve_d2_polyeq_abc_equation"]);
52.687 +(*val p = e_pos'; val c = [];
52.688 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.689 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.690 +
52.691 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.692 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.693 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.694 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.695 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.696 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.697 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.698 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.699 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 2, x = -2]")) => ()
52.700 + | _ => raise error "polyeq.sml: diff.behav. in -4 + x^2 = 0 -> [x = 2, x = -2]";
52.701 +
52.702 +
52.703 +val fmz = ["equality ( 4+ x^^^2 = 0)", "solveFor x","solutions L"];
52.704 +val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"], ["PolyEq","solve_d2_polyeq_abc_equation"]);
52.705 +(*val p = e_pos'; val c = [];
52.706 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.707 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.708 +
52.709 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.710 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.711 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.712 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.713 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.714 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.715 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.716 +"TODO 4+ x^^^2 = 0";
52.717 +"TODO 4+ x^^^2 = 0";
52.718 +"TODO 4+ x^^^2 = 0";
52.719 +
52.720 +(*EP-15*)
52.721 +val fmz = ["equality (2*x + 2*x^^^2 = 0)", "solveFor x","solutions L"];
52.722 +val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
52.723 + ["PolyEq","solve_d2_polyeq_abc_equation"]);
52.724 +(*val p = e_pos'; val c = [];
52.725 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.726 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.727 +
52.728 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.729 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.730 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.731 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.732 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.733 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.734 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.735 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.736 +case f of Form' (FormKF (~1,EdUndef,_,Nundef,"[x = 0, x = -1]")) => ()
52.737 + | _ => raise error "polyeq.sml: diff.behav. in x + x^2 = 0 -> [x = 0, x = -1]";
52.738 +
52.739 +val fmz = ["equality (1*x + x^^^2 = 0)", "solveFor x","solutions L"];
52.740 +val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
52.741 + ["PolyEq","solve_d2_polyeq_abc_equation"]);
52.742 +(*val p = e_pos'; val c = [];
52.743 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.744 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.745 +
52.746 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.747 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.748 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.749 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.750 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.751 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.752 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.753 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.754 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 0, x = -1]")) => ()
52.755 + | _ => raise error "polyeq.sml: diff.behav. in x + x^2 = 0 -> [x = 0, x = -1]";
52.756 +
52.757 +(*EP-16*)
52.758 +val fmz = ["equality (x + 2*x^^^2 = 0)", "solveFor x","solutions L"];
52.759 +val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
52.760 + ["PolyEq","solve_d2_polyeq_abc_equation"]);
52.761 +(*val p = e_pos'; val c = [];
52.762 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.763 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.764 +
52.765 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.766 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.767 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.768 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.769 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.770 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.771 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.772 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.773 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 0, x = -1 / 2]")) => ()
52.774 + | _ => raise error "polyeq.sml: diff.behav. in x + x^2 = 0 -> [x = 0, x = -1 / 2]";
52.775 +
52.776 +(*EP-//*)
52.777 +val fmz = ["equality (x + x^^^2 = 0)", "solveFor x","solutions L"];
52.778 +val (dI',pI',mI') = ("PolyEq.thy",["abcFormula","degree_2","polynomial","univariate","equation"],
52.779 + ["PolyEq","solve_d2_polyeq_abc_equation"]);
52.780 +(*val p = e_pos'; val c = [];
52.781 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.782 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.783 +
52.784 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.785 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.786 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.787 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.788 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.789 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.790 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.791 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.792 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 0, x = -1]")) => ()
52.793 + | _ => raise error "polyeq.sml: diff.behav. in x + x^2 = 0 -> [x = 0, x = -1]";
52.794 +
52.795 +"----------- (-8 - 2*x + x^^^2 = 0), (*Schalk 2, S.67 Nr.31.b----";
52.796 +"----------- (-8 - 2*x + x^^^2 = 0), (*Schalk 2, S.67 Nr.31.b----";
52.797 +"----------- (-8 - 2*x + x^^^2 = 0), (*Schalk 2, S.67 Nr.31.b----";
52.798 + val fmz = ["equality (-8 - 2*x + x^^^2 = 0)", (*Schalk 2, S.67 Nr.31.b*)
52.799 + "solveFor x","solutions L"];
52.800 + val (dI',pI',mI') =
52.801 + ("PolyEq.thy",["degree_2","expanded","univariate","equation"],
52.802 + ["PolyEq","complete_square"]);
52.803 +(* val p = e_pos'; val c = [];
52.804 + val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.805 + val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.806 +
52.807 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.808 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.809 + val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.810 + val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.811 + val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.812 + (*Apply_Method ("PolyEq.thy","complete_square")*)
52.813 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.814 + (*"-8 - 2 * x + x ^^^ 2 = 0", nxt = Rewrite_Set_Inst ... "complete_square*)
52.815 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.816 + (*"-8 + (2 / 2 - x) ^^^ 2 = (2 / 2) ^^^ 2", nxt = Rewrite("square_explicit1"*)
52.817 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.818 + (*"(2 / 2 - x) ^^^ 2 = (2 / 2) ^^^ 2 - -8" nxt = Rewrite("root_plus_minus*)
52.819 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.820 + (*"2 / 2 - x = sqrt ((2 / 2) ^^^ 2 - -8) |
52.821 + 2 / 2 - x = - sqrt ((2 / 2) ^^^ 2 - -8)" nxt = Rewr_Inst("bdv_explicit2"*)
52.822 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.823 + (*"2 / 2 - x = sqrt ((2 / 2) ^^^ 2 - -8) |
52.824 + -1*x = - (2 / 2) + - sqrt ((2 / 2) ^^^ 2 - -8)"nxt = R_Inst("bdv_explt2"*)
52.825 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.826 + (*"-1 * x = - (2 / 2) + sqrt ((2 / 2) ^^^ 2 - -8) |
52.827 + -1 * x = (- (2 / 2) + - sqrt ((2 / 2) ^^^ 2 - -8))"nxt = bdv_explicit3*)
52.828 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.829 + (*"-1 * x = - (2 / 2) + sqrt ((2 / 2) ^^^ 2 - -8) |
52.830 + x = -1 * (- (2 / 2) + - sqrt ((2 / 2) ^^^ 2 - -8))" nxt = bdv_explicit3*)
52.831 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.832 + (*"x = -1 * (- (2 / 2) + sqrt ((2 / 2) ^^^ 2 - -8)) |
52.833 + x = -1 * (- (2 / 2) + - sqrt ((2 / 2) ^^^ 2 - -8))"nxt = calculate_Ration*)
52.834 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.835 + (*"x = -2 | x = 4" nxt = Or_to_List*)
52.836 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.837 + (*"[x = -2, x = 4]" nxt = Check_Postcond*)
52.838 + val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
52.839 +(* FIXXXME
52.840 + case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = -2, x = 4]")) => () TODO
52.841 + | _ => raise error "polyeq.sml: diff.behav. in [x = -2, x = 4]";
52.842 +*)
52.843 +if f2str f = "[x = -1 * -1 + -1 * sqrt (1 ^^^ 2 - -8),\n x = -1 * -1 + -1 * (-1 * sqrt (1 ^^^ 2 - -8))]" then ()
52.844 +else raise error "polyeq.sml corrected?behav. in [x = -2, x = 4]";
52.845 +
52.846 +
52.847 +"-------------------- (3 - 10*x + 3*x^^^2 = 0), ----------------------";
52.848 +"-------------------- (3 - 10*x + 3*x^^^2 = 0), ----------------------";
52.849 +"-------------------- (3 - 10*x + 3*x^^^2 = 0), ----------------------";
52.850 +"---- test the erls ----";
52.851 + val t1 = (term_of o the o (parse thy)) "0 <= (10/3/2)^^^2 - 1";
52.852 + val SOME (t,_) = rewrite_set_ PolyEq.thy false PolyEq_erls t1;
52.853 + val t' = term2str t;
52.854 + (*if t'= "True" then ()
52.855 + else raise error "polyeq.sml: diff.behav. in 'rewrite_set_.. PolyEq_erls";*)
52.856 +(* *)
52.857 + val fmz = ["equality (3 - 10*x + 3*x^^^2 = 0)",
52.858 + "solveFor x","solutions L"];
52.859 + val (dI',pI',mI') =
52.860 + ("PolyEq.thy",["degree_2","expanded","univariate","equation"],
52.861 + ["PolyEq","complete_square"]);
52.862 +(* val p = e_pos'; val c = [];
52.863 + val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.864 + val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.865 +
52.866 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.867 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.868 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.869 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.870 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.871 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.872 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.873 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.874 + (*Apply_Method ("PolyEq.thy","complete_square")*)
52.875 + val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
52.876 +
52.877 +"----------- (-16 + 4*x + 2*x^^^2 = 0), --------------------------";
52.878 +"----------- (-16 + 4*x + 2*x^^^2 = 0), --------------------------";
52.879 +"----------- (-16 + 4*x + 2*x^^^2 = 0), --------------------------";
52.880 + val fmz = ["equality (-16 + 4*x + 2*x^^^2 = 0)",
52.881 + "solveFor x","solutions L"];
52.882 + val (dI',pI',mI') =
52.883 + ("PolyEq.thy",["degree_2","expanded","univariate","equation"],
52.884 + ["PolyEq","complete_square"]);
52.885 +(* val p = e_pos'; val c = [];
52.886 + val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.887 + val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.888 +
52.889 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.890 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.891 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.892 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.893 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.894 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.895 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.896 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.897 + (*Apply_Method ("PolyEq.thy","complete_square")*)
52.898 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.899 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.900 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.901 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.902 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.903 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.904 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.905 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.906 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.907 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.908 +(* FIXXXXME n1.,
52.909 + case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 2, x = -4]")) => () TODO
52.910 + | _ => raise error "polyeq.sml: diff.behav. in [x = 2, x = -4]";
52.911 +*)
52.912 +
52.913 +"----------- (a*b - (a+b)*x + x^^^2 = 0), (*Schalk 2,S.68Nr.44.a*)";
52.914 +"----------- (a*b - (a+b)*x + x^^^2 = 0), (*Schalk 2,S.68Nr.44.a*)";
52.915 +"----------- (a*b - (a+b)*x + x^^^2 = 0), (*Schalk 2,S.68Nr.44.a*)";
52.916 + val fmz = ["equality (a*b - (a+b)*x + x^^^2 = 0)",
52.917 + "solveFor x","solutions L"];
52.918 + val (dI',pI',mI') =
52.919 + ("PolyEq.thy",["degree_2","expanded","univariate","equation"],
52.920 + ["PolyEq","complete_square"]);
52.921 +(* val p = e_pos'; val c = [];
52.922 + val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.923 + val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.924 +
52.925 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.926 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.927 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.928 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.929 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.930 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.931 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.932 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.933 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.934 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.935 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.936 +
52.937 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.938 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.939 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.940 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.941 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.942 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.943 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.944 + val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
52.945 +(*WN.2.5.03 TODO FIXME Matthias ?
52.946 + case f of
52.947 + Form'
52.948 + (FormKF
52.949 + (~1,EdUndef,0,Nundef,
52.950 + "[x = (a + b) / 2 + -1 * sqrt ((a + b) ^^^ 2 / 2 ^^^ 2 - a * b),\n x = (a + b) / 2 + sqrt ((a + b) ^^^ 2 / 2 ^^^ 2 - a * b)]"))
52.951 + => ()
52.952 + | _ => raise error "polyeq.sml: diff.behav. in a*b - (a+b)*x + x^^^2 = 0";
52.953 + this will be simplified [x = a, x = b] to by Factor.ML*)
52.954 +
52.955 +
52.956 +"----------- (-64 + x^^^2 = 0), (*Schalk 2, S.66 Nr.1.a~--------*)";
52.957 +"----------- (-64 + x^^^2 = 0), (*Schalk 2, S.66 Nr.1.a~--------*)";
52.958 +"----------- (-64 + x^^^2 = 0), (*Schalk 2, S.66 Nr.1.a~--------*)";
52.959 + val fmz = ["equality (-64 + x^^^2 = 0)",(*Schalk 2, S.66 Nr.1.a~*)
52.960 + "solveFor x","solutions L"];
52.961 + val (dI',pI',mI') =
52.962 + ("PolyEq.thy",["degree_2","expanded","univariate","equation"],
52.963 + ["PolyEq","complete_square"]);
52.964 +(* val p = e_pos'; val c = [];
52.965 + val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.966 + val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.967 +
52.968 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.969 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.970 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.971 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.972 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.973 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.974 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.975 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.976 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.977 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.978 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.979 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.980 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.981 + val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
52.982 +(*WN.2.5.03 TODO "[x = sqrt (0 - -64), x = -1 * sqrt (0 - -64)]"
52.983 + case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 8, x = -8]")) => ()
52.984 + | _ => raise error "polyeq.sml: diff.behav. in [x = 8, x = -8]";
52.985 +*)
52.986 +
52.987 +"----------- (-147 + 3*x^^^2 = 0), (*Schalk 2, S.66 Nr.1.b------*)";
52.988 +"----------- (-147 + 3*x^^^2 = 0), (*Schalk 2, S.66 Nr.1.b------*)";
52.989 +"----------- (-147 + 3*x^^^2 = 0), (*Schalk 2, S.66 Nr.1.b------*)";
52.990 + val fmz = ["equality (-147 + 3*x^^^2 = 0)",(*Schalk 2, S.66 Nr.1.b*)
52.991 + "solveFor x","solutions L"];
52.992 + val (dI',pI',mI') =
52.993 + ("PolyEq.thy",["degree_2","expanded","univariate","equation"],
52.994 + ["PolyEq","complete_square"]);
52.995 +(* val p = e_pos'; val c = [];
52.996 + val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.997 + val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.998 +
52.999 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.1000 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.1001 + val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.1002 + val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.1003 + val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.1004 + val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.1005 + val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.1006 + val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.1007 + val (p,_,f,nxt,_,pt) = me nxt p c pt;
52.1008 +(*WN.2.5.03 TODO "[x = sqrt (0 - -49), x = -1 * sqrt (0 - -49)]"
52.1009 + case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 7, x = -7]")) => ()
52.1010 + | _ => raise error "polyeq.sml: diff.behav. in [x = 7, x = -7]";
52.1011 +*)
52.1012 +if f2str f = "[x = sqrt (0 - -49), x = -1 * sqrt (0 - -49)]" then ()
52.1013 +else raise error "polyeq.sml CORRECTED?behav. in [x = 7, x = -7]";
52.1014 +
52.1015 +
52.1016 +"----------- (3*x - 1 - (5*x - (2 - 4*x)) = -11),(*Schalk Is86Bsp5";
52.1017 +"----------- (3*x - 1 - (5*x - (2 - 4*x)) = -11),(*Schalk Is86Bsp5";
52.1018 +"----------- (3*x - 1 - (5*x - (2 - 4*x)) = -11),(*Schalk Is86Bsp5";
52.1019 +(*EP-17 Schalk_I_p86_n5*)
52.1020 +val fmz = ["equality (3*x - 1 - (5*x - (2 - 4*x)) = -11)","solveFor x","solutions L"];
52.1021 +(* refine fmz ["univariate","equation"];
52.1022 +*)
52.1023 +val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
52.1024 +(*val p = e_pos';
52.1025 +val c = [];
52.1026 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.1027 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.1028 +
52.1029 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.1030 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1031 +(* val nxt =
52.1032 + ("Model_Problem",
52.1033 + Model_Problem ["normalize","polynomial","univariate","equation"])
52.1034 + : string * tac*)
52.1035 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1036 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1037 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1038 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1039 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1040 +(* val nxt =
52.1041 + ("Subproblem",
52.1042 + Subproblem ("PolyEq.thy",["polynomial","univariate","equation"]))
52.1043 + : string * tac *)
52.1044 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1045 +(*val nxt =
52.1046 + ("Model_Problem",
52.1047 + Model_Problem ["degree_1","polynomial","univariate","equation"])
52.1048 + : string * tac *)
52.1049 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1050 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1051 +
52.1052 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1053 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1054 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1055 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1056 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1057 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 2]")) => ()
52.1058 + | _ => raise error "polyeq.sml: diff.behav. in [x = 2]";
52.1059 +
52.1060 +
52.1061 +"----------- ((x+1)*(x+2) - (3*x - 2)^^^2=.. Schalk II s.68 Bsp 37";
52.1062 +"----------- ((x+1)*(x+2) - (3*x - 2)^^^2=.. Schalk II s.68 Bsp 37";
52.1063 +"----------- ((x+1)*(x+2) - (3*x - 2)^^^2=.. Schalk II s.68 Bsp 37";
52.1064 +(*is in rlang.sml, too*)
52.1065 +val fmz = ["equality ((x+1)*(x+2) - (3*x - 2)^^^2=(2*x - 1)^^^2+(3*x - 1)*(x+1))",
52.1066 + "solveFor x","solutions L"];
52.1067 +val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
52.1068 +
52.1069 +(*val p = e_pos'; val c = [];
52.1070 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.1071 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.1072 +
52.1073 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.1074 +(*val nxt = ("Refine_Tacitly",Refine_Tacitly ["univariate","equation"])*)
52.1075 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1076 +(* val nxt =
52.1077 + ("Model_Problem",
52.1078 + Model_Problem ["normalize","polynomial","univariate","equation"])
52.1079 + : string * tac *)
52.1080 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1081 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1082 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1083 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1084 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1085 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1086 +(* val nxt =
52.1087 + ("Subproblem",
52.1088 + Subproblem ("PolyEq.thy",["polynomial","univariate","equation"]))
52.1089 + : string * tac*)
52.1090 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1091 +(*val nxt =
52.1092 + ("Model_Problem",
52.1093 + Model_Problem ["abcFormula","degree_2","polynomial","univariate","equation"])
52.1094 + : string * tac*)
52.1095 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1096 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1097 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1098 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1099 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1100 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1101 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1102 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 2 / 15, x = 1]")) => ()
52.1103 + | _ => raise error "polyeq.sml: diff.behav. in [x = 2 / 15, x = 1]";
52.1104 +
52.1105 +
52.1106 +" -4 + x^^^2 =0 ";
52.1107 +" -4 + x^^^2 =0 ";
52.1108 +" -4 + x^^^2 =0 ";
52.1109 +val fmz = ["equality ( -4 + x^^^2 =0)", "solveFor x","solutions L"];
52.1110 +(* val fmz = ["equality (1 + x^^^2 =0)", "solveFor x","solutions L"];*)
52.1111 +(*val fmz = ["equality (0 =0)", "solveFor x","solutions L"];*)
52.1112 +val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
52.1113 +(*val p = e_pos';
52.1114 +val c = [];
52.1115 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
52.1116 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
52.1117 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
52.1118 +
52.1119 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1120 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1121 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1122 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1123 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1124 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1125 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
52.1126 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 2, x = -2]")) => ()
52.1127 + | _ => raise error "polyeq.sml: diff.behav. in [x = 2, x = -2]";
52.1128 +
52.1129 +"----------------- polyeq.sml end ------------------";
52.1130 +
52.1131 +(*Punkte aus dem TestBericht, die ich in rlang.sml nicht zuordnen konnte:*)
52.1132 +(*WN.19.3.03 ---v-*)
52.1133 +(*3(b)*)val (bdv,v) = (str2term "bdv", str2term "R1");
52.1134 +val t = str2term "-1 * (R * R2) + R2 * R1 + -1 * (R * R1) = 0";
52.1135 +val SOME (t',_) = rewrite_set_inst_ thy false [(bdv,v)] make_polynomial_in t;
52.1136 +term2str t';
52.1137 +"-1 * R * R2 + (R2 + -1 * R) * R1 = 0";
52.1138 +(*WN.19.3.03 ---^-*)
52.1139 +
52.1140 +(*3(c)*)val (bdv,v) = (str2term "bdv", str2term "p");
52.1141 +val t = str2term "y ^^^ 2 + -2 * (x * p) = 0";
52.1142 +val SOME (t',_) = rewrite_set_inst_ thy false [(bdv,v)] make_polynomial_in t;
52.1143 +term2str t';
52.1144 +"y ^^^ 2 + -2 * x * p = 0";
52.1145 +
52.1146 +(*3(d)*)val (bdv,v) = (str2term "bdv", str2term "x2");
52.1147 +val t = str2term
52.1148 +"A + x1 * (y3 * (1 / 2)) + x3 * (y2 * (1 / 2)) + -1 * (x1 * (y2 * (1 / 2))) + -1 * (x3 * (y1 * (1 / 2 ))) + y1 * (1 / 2 * x2) + -1 * (y3 * (1 / 2 * x2)) = 0";
52.1149 +val SOME (t',_) = rewrite_set_inst_ thy false [(bdv,v)] make_polynomial_in t;
52.1150 +term2str t';
52.1151 +"A + x1 * y3 * (1 / 2) + x3 * y2 * (1 / 2) + - x1 * y2 * (1 / 2) + - x3 * y1 * (1 / 2) + (y1 * (1 / 2) + - y3 * (1 / 2)) * x2 = 0";
52.1152 +val SOME (t',_) = rewrite_set_inst_ thy false [(bdv,v)] make_ratpoly_in t;
52.1153 +term2str t';
52.1154 +"A + x1 * y3 * (1 / 2) + x3 * y2 * (1 / 2) + -1 * x1 * y2 * (1 / 2) + -1 * x3 * y1 * (1 / 2) + (y1 * (1 / 2) + -1 * y3 * (1 / 2)) * x2 = 0";
52.1155 +
52.1156 +(*3(e)*)val (bdv,v) = (str2term "bdv", str2term "a");
52.1157 +val t = str2term
52.1158 +"A ^^^ 2 + c ^^^ 2 * (c / d) ^^^ 2 + (-4 * (c / d) ^^^ 2) * a ^^^ 2 = 0";
52.1159 +val NONE = rewrite_set_inst_ thy false [(bdv,v)] make_polynomial_in t;
52.1160 +(*die _unsichtbare_ Klammern sind genau wie gew"unscht*)
52.1161 +
52.1162 +
52.1163 +val t = str2term "(x + 1) * (x + 2) - (3 * x - 2) ^^^ 2 - ((2 * x - 1) ^^^ 2 + (3 * x - 1) * (x + 1)) = 0";
52.1164 +trace_rewrite:=true;
52.1165 +rewrite_set_ thy false expand_binoms t;
52.1166 +trace_rewrite:=false;
52.1167 +
52.1168 +
52.1169 +"----------- interSteps ([1],Res); on Schalk Is86Bsp5-------------";
52.1170 +"----------- interSteps ([1],Res); on Schalk Is86Bsp5-------------";
52.1171 +"----------- interSteps ([1],Res); on Schalk Is86Bsp5-------------";
52.1172 +states:=[];
52.1173 +CalcTree
52.1174 +[(["equality (3*x - 1 - (5*x - (2 - 4*x)) = -11)","solveFor x","solutions L"],
52.1175 + ("PolyEq.thy",["univariate","equation"],["no_met"]))];
52.1176 +Iterator 1;
52.1177 +moveActiveRoot 1;
52.1178 +autoCalculate 1 CompleteCalc;
52.1179 +val ((pt,p),_) = get_calc 1; show_pt pt;
52.1180 +
52.1181 +interSteps 1 ([1],Res) (*no Rewrite_Set...*);
53.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
53.2 +++ b/test/Tools/isac/Knowledge/polyminus.sml Mon Aug 30 14:35:51 2010 +0200
53.3 @@ -0,0 +1,598 @@
53.4 +(* tests on PolyMinus
53.5 + author: Walther Neuper
53.6 + WN071207,
53.7 + (c) due to copyright terms
53.8 +
53.9 +use"../smltest/IsacKnowledge/polyminus.sml";
53.10 +use"polyminus.sml";
53.11 +*)
53.12 +val thy = PolyMinus.thy;
53.13 +
53.14 +"-----------------------------------------------------------------";
53.15 +"table of contents -----------------------------------------------";
53.16 +"-----------------------------------------------------------------";
53.17 +"----------- fun eval_ist_monom ----------------------------------";
53.18 +"----------- watch order_add_mult -------------------------------";
53.19 +"----------- build predicate for +- ordering ---------------------";
53.20 +"----------- build fasse_zusammen --------------------------------";
53.21 +"----------- build verschoenere ----------------------------------";
53.22 +"----------- met simplification for_polynomials with_minus -------";
53.23 +"----------- pbl polynom vereinfachen p.33 -----------------------";
53.24 +"----------- met probe fuer_polynom ------------------------------";
53.25 +"----------- pbl polynom probe -----------------------------------";
53.26 +"----------- pbl klammer polynom vereinfachen p.34 ---------------";
53.27 +"----------- try fun applyTactics --------------------------------";
53.28 +"----------- pbl binom polynom vereinfachen p.39 -----------------";
53.29 +"----------- pbl binom polynom vereinfachen: cube ----------------";
53.30 +"----------- refine Vereinfache ----------------------------------";
53.31 +"-----------------------------------------------------------------";
53.32 +"-----------------------------------------------------------------";
53.33 +"-----------------------------------------------------------------";
53.34 +
53.35 +
53.36 +"----------- fun eval_ist_monom ----------------------------------";
53.37 +"----------- fun eval_ist_monom ----------------------------------";
53.38 +"----------- fun eval_ist_monom ----------------------------------";
53.39 +ist_monom (str2term "12");
53.40 +case eval_ist_monom 0 0 (str2term "12 ist_monom") 0 of
53.41 + SOME ("12 ist_monom = True", _) => ()
53.42 + | _ => raise error "polyminus.sml: 12 ist_monom = True";
53.43 +
53.44 +case eval_ist_monom 0 0 (str2term "a ist_monom") 0 of
53.45 + SOME ("a ist_monom = True", _) => ()
53.46 + | _ => raise error "polyminus.sml: a ist_monom = True";
53.47 +
53.48 +case eval_ist_monom 0 0 (str2term "(3*a) ist_monom") 0 of
53.49 + SOME ("3 * a ist_monom = True", _) => ()
53.50 + | _ => raise error "polyminus.sml: 3 * a ist_monom = True";
53.51 +
53.52 +case eval_ist_monom 0 0 (str2term "(a^^^2) ist_monom") 0 of
53.53 + SOME ("a ^^^ 2 ist_monom = True", _) => ()
53.54 + | _ => raise error "polyminus.sml: a^^^2 ist_monom = True";
53.55 +
53.56 +case eval_ist_monom 0 0 (str2term "(3*a^^^2) ist_monom") 0 of
53.57 + SOME ("3 * a ^^^ 2 ist_monom = True", _) => ()
53.58 + | _ => raise error "polyminus.sml: 3*a^^^2 ist_monom = True";
53.59 +
53.60 +case eval_ist_monom 0 0 (str2term "(a*b) ist_monom") 0 of
53.61 + SOME ("a * b ist_monom = True", _) => ()
53.62 + | _ => raise error "polyminus.sml: a*b ist_monom = True";
53.63 +
53.64 +case eval_ist_monom 0 0 (str2term "(3*a*b) ist_monom") 0 of
53.65 + SOME ("3 * a * b ist_monom = True", _) => ()
53.66 + | _ => raise error "polyminus.sml: 3*a*b ist_monom = True";
53.67 +
53.68 +
53.69 +"----------- watch order_add_mult -------------------------------";
53.70 +"----------- watch order_add_mult -------------------------------";
53.71 +"----------- watch order_add_mult -------------------------------";
53.72 +"----- with these simple variables it works...";
53.73 +trace_rewrite:=true;
53.74 +trace_rewrite:=false;
53.75 +val t = str2term "((a + d) + c) + b";
53.76 +val SOME (t,_) = rewrite_set_ thy false order_add_mult t; term2str t;
53.77 +if term2str t = "a + (b + (c + d))" then ()
53.78 +else raise error "polyminus.sml 1 watch order_add_mult";
53.79 +trace_rewrite:=false;
53.80 +
53.81 +"----- the same stepwise...";
53.82 +val od = ord_make_polynomial true Poly.thy;
53.83 +val t = str2term "((a + d) + c) + b";
53.84 +"((a + d) + c) + b";
53.85 +val SOME (t,_) = rewrite_ thy od e_rls true real_add_commute t; term2str t;
53.86 +"b + ((a + d) + c)";
53.87 +val SOME (t,_) = rewrite_ thy od e_rls true real_add_commute t; term2str t;
53.88 +"b + (c + (a + d))";
53.89 +val SOME (t,_) = rewrite_ thy od e_rls true real_add_left_commute t;term2str t;
53.90 +"b + (a + (c + d))";
53.91 +val SOME (t,_) = rewrite_ thy od e_rls true real_add_left_commute t;term2str t;
53.92 +"a + (b + (c + d))";
53.93 +if term2str t = "a + (b + (c + d))" then ()
53.94 +else raise error "polyminus.sml 2 watch order_add_mult";
53.95 +
53.96 +"----- if parentheses are right, left_commute is (almost) sufficient...";
53.97 +val t = str2term "a + (d + (c + b))";
53.98 +"a + (d + (c + b))";
53.99 +val SOME (t,_) = rewrite_ thy od e_rls true real_add_left_commute t;term2str t;
53.100 +"a + (c + (d + b))";
53.101 +val SOME (t,_) = rewrite_ thy od e_rls true real_add_commute t;term2str t;
53.102 +"a + (c + (b + d))";
53.103 +val SOME (t,_) = rewrite_ thy od e_rls true real_add_left_commute t;term2str t;
53.104 +"a + (b + (c + d))";
53.105 +
53.106 +"----- but we do not want the parentheses at right; thus: cond.rew.";
53.107 +"WN0712707 complicated monomials do not yet work ...";
53.108 +val t = str2term "((5*a + 4*d) + 3*c) + 2*b";
53.109 +val SOME (t,_) = rewrite_set_ thy false order_add_mult t; term2str t;
53.110 +if term2str t = "2 * b + (3 * c + (4 * d + 5 * a))" then ()
53.111 +else raise error "polyminus.sml: order_add_mult changed";
53.112 +
53.113 +"----- here we see rew_sub going into subterm with ord.rew....";
53.114 +val od = ord_make_polynomial false Poly.thy;
53.115 +val t = str2term "b + a + c + d";
53.116 +val SOME (t,_) = rewrite_ thy od e_rls false real_add_commute t; term2str t;
53.117 +val SOME (t,_) = rewrite_ thy od e_rls false real_add_commute t; term2str t;
53.118 +(*@@@ rew_sub gosub: t = d + (b + a + c)
53.119 + @@@ rew_sub begin: t = b + a + c*)
53.120 +
53.121 +
53.122 +"----------- build predicate for +- ordering ---------------------";
53.123 +"----------- build predicate for +- ordering ---------------------";
53.124 +"----------- build predicate for +- ordering ---------------------";
53.125 +"a" < "b";
53.126 +"ba" < "ab";
53.127 +"123" < "a"; (*unused due to ---vvv*)
53.128 +"12" < "3"; (*true !!!*)
53.129 +
53.130 +" a kleiner b ==> (b + a) = (a + b)";
53.131 +str2term "aaa";
53.132 +str2term "222 * aaa";
53.133 +(*
53.134 +case eval_kleiner 0 0 (str2term "123 kleiner 32") 0 of
53.135 + SOME ("12 kleiner 9 = False", _) => ()
53.136 + | _ => raise error "polyminus.sml: 12 kleiner 9 = False";
53.137 +*)
53.138 +case eval_kleiner 0 0 (str2term "a kleiner b") 0 of
53.139 + SOME ("a kleiner b = True", _) => ()
53.140 + | _ => raise error "polyminus.sml: a kleiner b = True";
53.141 +
53.142 +case eval_kleiner 0 0 (str2term "(10*g) kleiner f") 0 of
53.143 + SOME ("10 * g kleiner f = False", _) => ()
53.144 + | _ => raise error "polyminus.sml: 10 * g kleiner f = False";
53.145 +
53.146 +case eval_kleiner 0 0 (str2term "(a^^^2) kleiner b") 0 of
53.147 + SOME ("a ^^^ 2 kleiner b = True", _) => ()
53.148 + | _ => raise error "polyminus.sml: a ^^^ 2 kleiner b = True";
53.149 +
53.150 +case eval_kleiner 0 0 (str2term "(3*a^^^2) kleiner b") 0 of
53.151 + SOME ("3 * a ^^^ 2 kleiner b = True", _) => ()
53.152 + | _ => raise error "polyminus.sml: 3 * a ^^^ 2 kleiner b = True";
53.153 +
53.154 +case eval_kleiner 0 0 (str2term "(a*b) kleiner c") 0 of
53.155 + SOME ("a * b kleiner c = True", _) => ()
53.156 + | _ => raise error "polyminus.sml: a * b kleiner b = True";
53.157 +
53.158 +case eval_kleiner 0 0 (str2term "(3*a*b) kleiner c") 0 of
53.159 + SOME ("3 * a * b kleiner c = True", _) => ()
53.160 + | _ => raise error "polyminus.sml: 3 * a * b kleiner b = True";
53.161 +
53.162 +
53.163 +
53.164 +"----- compare tausche_plus with real_num_collect";
53.165 +val od = dummy_ord;
53.166 +
53.167 +val erls = erls_ordne_alphabetisch;
53.168 +val t = str2term "b + a";
53.169 +val SOME (t,_) = rewrite_ thy od erls false tausche_plus t; term2str t;
53.170 +if term2str t = "a + b" then ()
53.171 +else raise error "polyminus.sml: ordne_alphabetisch1 b + a";
53.172 +
53.173 +val erls = Atools_erls;
53.174 +val t = str2term "2*a + 3*a";
53.175 +val SOME (t,_) = rewrite_ thy od erls false real_num_collect t; term2str t;
53.176 +
53.177 +"----- test rewrite_, rewrite_set_";
53.178 +trace_rewrite:=true;
53.179 +val erls = erls_ordne_alphabetisch;
53.180 +val t = str2term "b + a";
53.181 +val SOME (t,_) = rewrite_set_ thy false ordne_alphabetisch t; term2str t;
53.182 +if term2str t = "a + b" then ()
53.183 +else raise error "polyminus.sml: ordne_alphabetisch a + b";
53.184 +
53.185 +val t = str2term "2*b + a";
53.186 +val SOME (t,_) = rewrite_set_ thy false ordne_alphabetisch t; term2str t;
53.187 +if term2str t = "a + 2 * b" then ()
53.188 +else raise error "polyminus.sml: ordne_alphabetisch a + 2 * b";
53.189 +
53.190 +val t = str2term "a + c + b";
53.191 +val SOME (t,_) = rewrite_set_ thy false ordne_alphabetisch t; term2str t;
53.192 +if term2str t = "a + b + c" then ()
53.193 +else raise error "polyminus.sml: ordne_alphabetisch a + b + c";
53.194 +
53.195 +"----- rewrite goes into subterms";
53.196 +val t = str2term "a + c + b + d";
53.197 +val SOME (t,_) = rewrite_ thy od erls false tausche_plus_plus t; term2str t;
53.198 +if term2str t = "a + b + c + d" then ()
53.199 +else raise error "polyminus.sml: ordne_alphabetisch1 a + b + c + d";
53.200 +
53.201 +val t = str2term "a + c + d + b";
53.202 +val SOME (t,_) = rewrite_set_ thy false ordne_alphabetisch t; term2str t;
53.203 +if term2str t = "a + b + c + d" then ()
53.204 +else raise error "polyminus.sml: ordne_alphabetisch2 a + b + c + d";
53.205 +
53.206 +"----- here we see rew_sub going into subterm with cond.rew....";
53.207 +val t = str2term "b + a + c + d";
53.208 +val SOME (t,_) = rewrite_ thy od erls false tausche_plus t; term2str t;
53.209 +if term2str t = "a + b + c + d" then ()
53.210 +else raise error "polyminus.sml: ordne_alphabetisch3 a + b + c + d";
53.211 +
53.212 +"----- compile rls for the most complicated terms";
53.213 +val t = str2term "5*e + 6*f - 8*g - 9 - 7*e - 4*f + 10*g + 12";
53.214 +"5 * e + 6 * f - 8 * g - 9 - 7 * e - 4 * f + 10 * g + 12";
53.215 +val SOME (t,_) = rewrite_set_ thy false ordne_alphabetisch t;
53.216 +if term2str t = "- 9 + 12 + 5 * e - 7 * e + 6 * f - 4 * f - 8 * g + 10 * g"
53.217 +then () else raise error "polyminus.sml: ordne_alphabetisch finished";
53.218 +
53.219 +
53.220 +"----------- build fasse_zusammen --------------------------------";
53.221 +"----------- build fasse_zusammen --------------------------------";
53.222 +"----------- build fasse_zusammen --------------------------------";
53.223 +val t = str2term "- 9 + 12 + 5 * e - 7 * e + 6 * f - 4 * f - 8 * g + 10 * g";
53.224 +val SOME (t,_) = rewrite_set_ thy false fasse_zusammen t;
53.225 +if term2str t = "3 + -2 * e + 2 * f + 2 * g" then ()
53.226 +else raise error "polyminus.sml: fasse_zusammen finished";
53.227 +
53.228 +"----------- build verschoenere ----------------------------------";
53.229 +"----------- build verschoenere ----------------------------------";
53.230 +"----------- build verschoenere ----------------------------------";
53.231 +val t = str2term "3 + -2 * e + 2 * f + 2 * g";
53.232 +val SOME (t,_) = rewrite_set_ thy false verschoenere t;
53.233 +if term2str t = "3 - 2 * e + 2 * f + 2 * g" then ()
53.234 +else raise error "polyminus.sml: verschoenere 3 + -2 * e ...";
53.235 +
53.236 +trace_rewrite:=true;
53.237 +trace_rewrite:=false;
53.238 +
53.239 +"----------- met simplification for_polynomials with_minus -------";
53.240 +"----------- met simplification for_polynomials with_minus -------";
53.241 +"----------- met simplification for_polynomials with_minus -------";
53.242 +val str =
53.243 +"Script SimplifyScript (t_::real) = \
53.244 +\ (((Try (Rewrite_Set ordne_alphabetisch False)) @@ \
53.245 +\ (Try (Rewrite_Set fasse_zusammen False)) @@ \
53.246 +\ (Try (Rewrite_Set verschoenere False))) t_)"
53.247 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
53.248 +atomty sc;
53.249 +
53.250 +
53.251 +"----------- pbl polynom vereinfachen p.33 -----------------------";
53.252 +"----------- pbl polynom vereinfachen p.33 -----------------------";
53.253 +"----------- pbl polynom vereinfachen p.33 -----------------------";
53.254 +"----------- 140 c ---";
53.255 +states:=[];
53.256 +CalcTree [(["term (5*e + 6*f - 8*g - 9 - 7*e - 4*f + 10*g + 12)",
53.257 + "normalform N"],
53.258 + ("PolyMinus.thy",["plus_minus","polynom","vereinfachen"],
53.259 + ["simplification","for_polynomials","with_minus"]))];
53.260 +moveActiveRoot 1;
53.261 +autoCalculate 1 CompleteCalc;
53.262 +val ((pt,p),_) = get_calc 1; show_pt pt;
53.263 +if p = ([], Res) andalso
53.264 + term2str (get_obj g_res pt (fst p)) = "3 - 2 * e + 2 * f + 2 * g"
53.265 +then () else raise error "polyminus.sml: Vereinfache (3 - 2 * e + 2 * f...";
53.266 +
53.267 +"----------- 140 d ---";
53.268 +states:=[];
53.269 +CalcTree [(["term (-r - 2*s - 3*t + 5 + 4*r + 8*s - 5*t - 2)",
53.270 + "normalform N"],
53.271 + ("PolyMinus.thy",["plus_minus","polynom","vereinfachen"],
53.272 + ["simplification","for_polynomials","with_minus"]))];
53.273 +moveActiveRoot 1;
53.274 +autoCalculate 1 CompleteCalc;
53.275 +val ((pt,p),_) = get_calc 1; show_pt pt;
53.276 +if p = ([], Res) andalso
53.277 + term2str (get_obj g_res pt (fst p)) = "3 + 3 * r + 6 * s - 8 * t"
53.278 +then () else raise error "polyminus.sml: Vereinfache 140 d)";
53.279 +
53.280 +
53.281 +"----------- 139 c ---";
53.282 +states:=[];
53.283 +CalcTree [(["term (3*e - 6*f - 8*e - 4*f + 5*e + 7*f)",
53.284 + "normalform N"],
53.285 + ("PolyMinus.thy",["plus_minus","polynom","vereinfachen"],
53.286 + ["simplification","for_polynomials","with_minus"]))];
53.287 +moveActiveRoot 1;
53.288 +autoCalculate 1 CompleteCalc;
53.289 +val ((pt,p),_) = get_calc 1; show_pt pt;
53.290 +if p = ([], Res) andalso
53.291 + term2str (get_obj g_res pt (fst p)) = "- (3 * f)"
53.292 +then () else raise error "polyminus.sml: Vereinfache 139 c)";
53.293 +
53.294 +"----------- 139 b ---";
53.295 +states:=[];
53.296 +CalcTree [(["term (8*u - 5*v - 5*u + 7*v - 6*u - 3*v)",
53.297 + "normalform N"],
53.298 + ("PolyMinus.thy",["plus_minus","polynom","vereinfachen"],
53.299 + ["simplification","for_polynomials","with_minus"]))];
53.300 +moveActiveRoot 1;
53.301 +autoCalculate 1 CompleteCalc;
53.302 +val ((pt,p),_) = get_calc 1; show_pt pt;
53.303 +if p = ([], Res) andalso
53.304 + term2str (get_obj g_res pt (fst p)) = "-3 * u - v"
53.305 +then () else raise error "polyminus.sml: Vereinfache 139 b)";
53.306 +
53.307 +"----------- 138 a ---";
53.308 +states:=[];
53.309 +CalcTree [(["term (2*u - 3*v - 6*u + 5*v)",
53.310 + "normalform N"],
53.311 + ("PolyMinus.thy",["plus_minus","polynom","vereinfachen"],
53.312 + ["simplification","for_polynomials","with_minus"]))];
53.313 +moveActiveRoot 1;
53.314 +autoCalculate 1 CompleteCalc;
53.315 +val ((pt,p),_) = get_calc 1; show_pt pt;
53.316 +if p = ([], Res) andalso
53.317 + term2str (get_obj g_res pt (fst p)) = "-4 * u + 2 * v"
53.318 +then () else raise error "polyminus.sml: Vereinfache 138 a)";
53.319 +
53.320 +
53.321 +"----------- met probe fuer_polynom ------------------------------";
53.322 +"----------- met probe fuer_polynom ------------------------------";
53.323 +"----------- met probe fuer_polynom ------------------------------";
53.324 +val str =
53.325 +"Script ProbeScript (e_::bool) (ws_::bool list) =\
53.326 +\ (let e_ = Take e_; \
53.327 +\ e_ = Substitute ws_ e_ \
53.328 +\ in (Repeat((Try (Repeat (Calculate times))) @@ \
53.329 +\ (Try (Repeat (Calculate plus ))) @@ \
53.330 +\ (Try (Repeat (Calculate minus))))) e_)"
53.331 +val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
53.332 +atomty sc;
53.333 +
53.334 +
53.335 +"----------- pbl polynom probe -----------------------------------";
53.336 +"----------- pbl polynom probe -----------------------------------";
53.337 +"----------- pbl polynom probe -----------------------------------";
53.338 +states:=[];
53.339 +CalcTree [(["Pruefe (5*e + 6*f - 8*g - 9 - 7*e - 4*f + 10*g + 12 =\
53.340 + \3 - 2 * e + 2 * f + 2 * g)",
53.341 + "mitWert [e = 1, f = 2, g = 3]",
53.342 + "Geprueft b"],
53.343 + ("PolyMinus.thy",["polynom","probe"],
53.344 + ["probe","fuer_polynom"]))];
53.345 +moveActiveRoot 1;
53.346 +autoCalculate 1 CompleteCalc;
53.347 +(* autoCalculate 1 CompleteCalcHead;
53.348 + autoCalculate 1 (Step 1);
53.349 + autoCalculate 1 (Step 1);
53.350 + val ((pt,p),_) = get_calc 1; term2str (get_obj g_res pt (fst p));
53.351 +@@@@@WN081114 gives "??.empty", all "Pruefe" are the same,
53.352 +although analogies work in interface.sml: FIXME.WN081114 in "Pruefe"*)
53.353 +val ((pt,p),_) = get_calc 1;
53.354 +if p = ([], Res) andalso term2str (get_obj g_res pt (fst p)) = "11 = 11"
53.355 +then () else raise error "polyminus.sml: Probe 11 = 11";
53.356 +show_pt pt;
53.357 +
53.358 +
53.359 +"----------- pbl klammer polynom vereinfachen p.34 ---------------";
53.360 +"----------- pbl klammer polynom vereinfachen p.34 ---------------";
53.361 +"----------- pbl klammer polynom vereinfachen p.34 ---------------";
53.362 +states:=[];
53.363 +CalcTree [(["term (2*u - 5 - (3 - 4*u) + (8*u + 9))",
53.364 + "normalform N"],
53.365 + ("PolyMinus.thy",["klammer","polynom","vereinfachen"],
53.366 + ["simplification","for_polynomials","with_parentheses"]))];
53.367 +moveActiveRoot 1;
53.368 +autoCalculate 1 CompleteCalc;
53.369 +val ((pt,p),_) = get_calc 1;
53.370 +if p = ([], Res) andalso
53.371 + term2str (get_obj g_res pt (fst p)) = "1 + 14 * u"
53.372 +then () else raise error "polyminus.sml: Vereinfache (2*u - 5 - (3 - ...";
53.373 +show_pt pt;
53.374 +
53.375 +"----- probe p.34 -----";
53.376 +states:=[];
53.377 +CalcTree [(["Pruefe (2*u - 5 - (3 - 4*u) + (8*u + 9) = 1 + 14 * u)",
53.378 + "mitWert [u = 2]",
53.379 + "Geprueft b"],
53.380 + ("PolyMinus.thy",["polynom","probe"],
53.381 + ["probe","fuer_polynom"]))];
53.382 +moveActiveRoot 1;
53.383 +autoCalculate 1 CompleteCalc;
53.384 +val ((pt,p),_) = get_calc 1;
53.385 +if p = ([], Res) andalso term2str (get_obj g_res pt (fst p)) = "29 = 29"
53.386 +then () else raise error "polyminus.sml: Probe 29 = 29";
53.387 +show_pt pt;
53.388 +
53.389 +
53.390 +"----------- try fun applyTactics --------------------------------";
53.391 +"----------- try fun applyTactics --------------------------------";
53.392 +"----------- try fun applyTactics --------------------------------";
53.393 +states:=[];
53.394 +CalcTree [(["term (5*e + 6*f - 8*g - 9 - 7*e - 4*f + 10*g + 12)",
53.395 + "normalform N"],
53.396 + ("PolyMinus.thy",["plus_minus","polynom","vereinfachen"],
53.397 + ["simplification","for_polynomials","with_minus"]))];
53.398 +moveActiveRoot 1;
53.399 +autoCalculate 1 CompleteCalcHead;
53.400 +autoCalculate 1 (Step 1);
53.401 +autoCalculate 1 (Step 1);
53.402 +val ((pt,p),_) = get_calc 1; show_pt pt;
53.403 +"----- 1 ^^^";
53.404 +fetchApplicableTactics 1 0 p;
53.405 +val appltacs = sel_appl_atomic_tacs pt p;
53.406 +applyTactic 1 p (hd appltacs) (*addiere_x_plus_minus*);
53.407 +val ((pt,p),_) = get_calc 1; show_pt pt;
53.408 +"----- 2 ^^^";
53.409 +trace_rewrite := true;
53.410 +val erls = erls_ordne_alphabetisch;
53.411 +val t = str2term "- 9 + 12 + 5 * e - 7 * e + (6 - 4) * f - 8 * g + 10 * g";
53.412 +val SOME (t',_) =
53.413 + rewrite_ Isac.thy e_rew_ord erls false tausche_minus t;
53.414 +term2str t'; "- 9 + 12 + 5 * e - 7 * e + (- 4 + 6) * f - 8 * g + 10 * g";
53.415 +
53.416 +val t = str2term "- 9 + 12 + 5 * e - 7 * e + (6 - 4) * f - 8 * g + 10 * g";
53.417 +val NONE =
53.418 + rewrite_ Isac.thy e_rew_ord erls false tausche_minus_plus t;
53.419 +
53.420 +val t = str2term "- 9 + 12 + 5 * e - 7 * e + (6 - 4) * f - 8 * g + 10 * g";
53.421 +val SOME (t',_) =
53.422 + rewrite_set_ Isac.thy false ordne_alphabetisch t;
53.423 +term2str t'; "- 9 + 12 + 5 * e - 7 * e - 8 * g + 10 * g + (- 4 + 6) * f";
53.424 +trace_rewrite := false;
53.425 +
53.426 +
53.427 +applyTactic 1 p (hd (sel_appl_atomic_tacs pt p)) (*tausche_minus*);
53.428 +val ((pt,p),_) = get_calc 1; show_pt pt;
53.429 +"----- 3 ^^^";
53.430 +applyTactic 1 p (hd (sel_appl_atomic_tacs pt p)) (**);
53.431 +val ((pt,p),_) = get_calc 1; show_pt pt;
53.432 +"----- 4 ^^^";
53.433 +applyTactic 1 p (hd (sel_appl_atomic_tacs pt p)) (**);
53.434 +val ((pt,p),_) = get_calc 1; show_pt pt;
53.435 +"----- 5 ^^^";
53.436 +applyTactic 1 p (hd (sel_appl_atomic_tacs pt p)) (**);
53.437 +val ((pt,p),_) = get_calc 1; show_pt pt;
53.438 +"----- 6 ^^^";
53.439 +
53.440 +(*<CALCMESSAGE> failure </CALCMESSAGE>
53.441 +applyTactic 1 p (hd (sel_appl_atomic_tacs pt p)) (**);
53.442 +val ((pt,p),_) = get_calc 1; show_pt pt;
53.443 +"----- 7 ^^^";
53.444 +*)
53.445 +
53.446 +autoCalculate 1 CompleteCalc;
53.447 +val ((pt,p),_) = get_calc 1; show_pt pt;
53.448 +(*independent from failure above: met_simp_poly_minus not confluent:
53.449 +(([9], Res), - (8 * g) + 10 * g + (3 - 2 * e + 2 * f)),
53.450 +(([], Res), - (8 * g) + 10 * g + (3 - 2 * e + 2 * f))]
53.451 +~~~~~~~~~~~###~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*)
53.452 +
53.453 +states:=[];
53.454 +CalcTree [(["term (- (8 * g) + 10 * g + h)",
53.455 + "normalform N"],
53.456 + ("PolyMinus.thy",["plus_minus","polynom","vereinfachen"],
53.457 + ["simplification","for_polynomials","with_minus"]))];
53.458 +moveActiveRoot 1;
53.459 +autoCalculate 1 CompleteCalc;
53.460 +val ((pt,p),_) = get_calc 1; show_pt pt;
53.461 +if p = ([], Res) andalso term2str (get_obj g_res pt (fst p)) = "2 * g + h"
53.462 +then () else raise error "polyminus.sml: addiere_vor_minus";
53.463 +
53.464 +
53.465 +states:=[];
53.466 +CalcTree [(["term (- (8 * g) + 10 * g + f)",
53.467 + "normalform N"],
53.468 + ("PolyMinus.thy",["plus_minus","polynom","vereinfachen"],
53.469 + ["simplification","for_polynomials","with_minus"]))];
53.470 +moveActiveRoot 1;
53.471 +autoCalculate 1 CompleteCalc;
53.472 +val ((pt,p),_) = get_calc 1; show_pt pt;
53.473 +if p = ([], Res) andalso term2str (get_obj g_res pt (fst p)) = "f + 2 * g"
53.474 +then () else raise error "polyminus.sml: tausche_vor_plus";
53.475 +
53.476 +
53.477 +"----------- pbl binom polynom vereinfachen p.39 -----------------";
53.478 +"----------- pbl binom polynom vereinfachen p.39 -----------------";
53.479 +"----------- pbl binom polynom vereinfachen p.39 -----------------";
53.480 +val rls = klammern_ausmultiplizieren;
53.481 +val t = str2term "(3 * a + 2) * (4 * a - 1)";
53.482 +val SOME (t,_) = rewrite_set_ thy false rls t; term2str t;
53.483 +"3 * a * (4 * a) - 3 * a * 1 + (2 * (4 * a) - 2 * 1)";
53.484 +val rls = discard_parentheses;
53.485 +val SOME (t,_) = rewrite_set_ thy false rls t; term2str t;
53.486 +"3 * a * 4 * a - 3 * a * 1 + (2 * 4 * a - 2 * 1)";
53.487 +val rls = ordne_monome;
53.488 +val SOME (t,_) = rewrite_set_ thy false rls t; term2str t;
53.489 +"3 * 4 * a * a - 1 * 3 * a + (2 * 4 * a - 1 * 2)";
53.490 +(*
53.491 +val t = str2term "3 * a * 4 * a";
53.492 +val rls = ordne_monome;
53.493 +val SOME (t,_) = rewrite_set_ thy false rls t; term2str t;
53.494 +*)
53.495 +val rls = klammern_aufloesen;
53.496 +val SOME (t,_) = rewrite_set_ thy false rls t; term2str t;
53.497 +"3 * 4 * a * a - 1 * 3 * a + 2 * 4 * a - 1 * 2";
53.498 +val rls = ordne_alphabetisch;
53.499 +(*TODO: make is_monom more general, a*a=a^2, ...*)
53.500 +val SOME (t,_) = rewrite_set_ thy false rls t; term2str t;
53.501 +"3 * 4 * a * a - 1 * 2 - 1 * 3 * a + 2 * 4 * a";
53.502 +(*GOON.WN080104
53.503 +val rls = fasse_zusammen;
53.504 +val SOME (t,_) = rewrite_set_ thy false rls t; term2str t;
53.505 +val rls = verschoenere;
53.506 +val SOME (t,_) = rewrite_set_ thy false rls t; term2str t;
53.507 +*)
53.508 +
53.509 +
53.510 +trace_rewrite := true;
53.511 +trace_rewrite := false;
53.512 +
53.513 +(*@@@@@@@*)
53.514 +states:=[];
53.515 +CalcTree [(["term ((3*a + 2) * (4*a - 1))",
53.516 + "normalform N"],
53.517 + ("PolyMinus.thy",["binom_klammer","polynom","vereinfachen"],
53.518 + ["simplification","for_polynomials","with_parentheses_mult"]))];
53.519 +moveActiveRoot 1;
53.520 +autoCalculate 1 CompleteCalc;
53.521 +val ((pt,p),_) = get_calc 1; show_pt pt;
53.522 +
53.523 +(*
53.524 +if p = ([], Res) andalso
53.525 + term2str (get_obj g_res pt (fst p)) = "1 + 14 * u"
53.526 +then () else raise error "polyminus.sml: Vereinfache (2*u - 5 - (3 - ...";
53.527 +*)
53.528 +
53.529 +
53.530 +"----------- pbl binom polynom vereinfachen: cube ----------------";
53.531 +"----------- pbl binom polynom vereinfachen: cube ----------------";
53.532 +"----------- pbl binom polynom vereinfachen: cube ----------------";
53.533 +states:=[];
53.534 +CalcTree [(["term (8*(a - q) + a - 2*q + 3*(a - 2*q))",
53.535 + "normalform N"],
53.536 + ("PolyMinus.thy",["binom_klammer","polynom","vereinfachen"],
53.537 + ["simplification","for_polynomials","with_parentheses_mult"]))];
53.538 +moveActiveRoot 1;
53.539 +autoCalculate 1 CompleteCalc;
53.540 +val ((pt,p),_) = get_calc 1; show_pt pt;
53.541 +
53.542 +
53.543 +"----------- refine Vereinfache ----------------------------------";
53.544 +"----------- refine Vereinfache ----------------------------------";
53.545 +"----------- refine Vereinfache ----------------------------------";
53.546 +val fmz = ["term (8*(a - q) + a - 2*q + 3*(a - 2*q))",
53.547 + "normalform N"];
53.548 +print_depth 11;
53.549 +val matches = refine fmz ["vereinfachen"];
53.550 +print_depth 3;
53.551 +
53.552 +"----- go into details, if it seems not to work -----";
53.553 +"--- does the predicate evaluate correctly ?";
53.554 +val t = str2term
53.555 + "matchsub (?a * (?b - ?c)) (8 * (a - q) + a - 2 * q + \
53.556 + \3 * (a - 2 * q))";
53.557 +val ma = eval_matchsub "" "Tools.matchsub" t thy;
53.558 +case ma of
53.559 + SOME ("matchsub (?a * (?b - ?c)) (8 * (a - q) + \
53.560 + \a - 2 * q + 3 * (a - 2 * q)) = True", _) => ()
53.561 + | _ => raise error "polyminus.sml matchsub (?a * (?b - ?c)...A";
53.562 +
53.563 +"--- does the respective prls rewrite ?";
53.564 +val prls = append_rls "prls_pbl_vereinf_poly" e_rls
53.565 + [Calc ("Poly.is'_polyexp", eval_is_polyexp ""),
53.566 + Calc ("Tools.matchsub", eval_matchsub ""),
53.567 + Thm ("or_true",or_true),
53.568 + (*"(?a | True) = True"*)
53.569 + Thm ("or_false",or_false),
53.570 + (*"(?a | False) = ?a"*)
53.571 + Thm ("not_true",num_str not_true),
53.572 + (*"(~ True) = False"*)
53.573 + Thm ("not_false",num_str not_false)
53.574 + (*"(~ False) = True"*)];
53.575 +trace_rewrite := true;
53.576 +val SOME (t', _) = rewrite_set_ thy false prls t;
53.577 +trace_rewrite := false;
53.578 +
53.579 +"--- does the respective prls rewrite the whole predicate ?";
53.580 +val t = str2term
53.581 + "Not (matchsub (?a * (?b + ?c)) (8 * (a - q) + a - 2 * q) | \
53.582 + \ matchsub (?a * (?b - ?c)) (8 * (a - q) + a - 2 * q) | \
53.583 + \ matchsub ((?b + ?c) * ?a) (8 * (a - q) + a - 2 * q) | \
53.584 + \ matchsub ((?b - ?c) * ?a) (8 * (a - q) + a - 2 * q) )";
53.585 +trace_rewrite := true;
53.586 +val SOME (t', _) = rewrite_set_ thy false prls t;
53.587 +trace_rewrite := false;
53.588 +if term2str t' = "False" then ()
53.589 +else raise error "polyminus.sml Not (matchsub (?a * (?b + ?c)) (8 ...";
53.590 +
53.591 +
53.592 +
53.593 +
53.594 +
53.595 +
53.596 +
53.597 +
53.598 +(*
53.599 +use"../smltest/IsacKnowledge/polyminus.sml";
53.600 +use"polyminus.sml";
53.601 + *)
54.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
54.2 +++ b/test/Tools/isac/Knowledge/rateq.sml Mon Aug 30 14:35:51 2010 +0200
54.3 @@ -0,0 +1,145 @@
54.4 +(* RL 09.02
54.5 + testexamples for RatEq, equations with fractions
54.6 +
54.7 + Compiler.Control.Print.printDepth:=10; (*4 default*)
54.8 + Compiler.Control.Print.printDepth:=5; (*4 default*)
54.9 + trace_rewrite:=true;
54.10 +
54.11 + use"kbtest/rateq.sml";
54.12 + *)
54.13 +"----------- rateq.sml begin--------";
54.14 +"---------(1/x=5) ---------------------";
54.15 +"--------- S.68, Bsp.: 40, ((x)/(x - 8) + (x - 8)/(x) = 26/5)---------------------";
54.16 +
54.17 +val t = (term_of o the o (parse RatEq.thy)) "(1/b+1/x=1) is_ratequation_in x";
54.18 +val SOME(t_, _) = rewrite_set_ RatEq.thy false RatEq_prls t;
54.19 +val result = term2str t_;
54.20 +if result <> "True" then raise error "rateq.sml: new behaviour 1:" else ();
54.21 +
54.22 +val t = (term_of o the o (parse RatEq.thy)) "(sqrt(x)=1) is_ratequation_in x";
54.23 +val SOME(t_, _) = rewrite_set_ RatEq.thy false RatEq_prls t;
54.24 +val result = term2str t_;
54.25 +if result <> "False" then raise error "rateq.sml: new behaviour 2:" else ();
54.26 +
54.27 +val t = (term_of o the o (parse RatEq.thy)) "(x=-1) is_ratequation_in x";
54.28 +val SOME(t_,_) = rewrite_set_ RatEq.thy false RatEq_prls t;
54.29 +val result = term2str t_;
54.30 +if result <> "False" then raise error "rateq.sml: new behaviour 3:" else ();
54.31 +
54.32 +val t = (term_of o the o (parse RatEq.thy)) "(3 + x^^^2 + 1/(x^^^2+3)=1) is_ratequation_in x";
54.33 +val SOME(t_,_) = rewrite_set_ RatEq.thy false RatEq_prls t;
54.34 +val result = term2str t_;
54.35 +if result <> "True" then raise error "rateq.sml: new behaviour 4:" else ();
54.36 +
54.37 +val result = match_pbl ["equality (x=1)","solveFor x","solutions L"]
54.38 + (get_pbt ["rational","univariate","equation"]);
54.39 +case result of NoMatch' _ => () | _ => raise error "rateq.sml: new behaviour: 5";
54.40 +
54.41 +val result = match_pbl ["equality (3 + x^^^2 + 1/(x^^^2+3)=1)","solveFor x","solutions L"]
54.42 + (get_pbt ["rational","univariate","equation"]);
54.43 +case result of Matches' _ => () | _ => raise error "rateq.sml: new behaviour: 6";
54.44 +
54.45 +
54.46 +(*---------rateq---- 23.8.02 ---------------------*)
54.47 +"---------(1/x=5) ---------------------";
54.48 +val fmz = ["equality (1/x=5)","solveFor x","solutions L"];
54.49 +(* refine fmz ["univariate","equation"];
54.50 + *)
54.51 +
54.52 +val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
54.53 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
54.54 +(* val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.55 + --------------------------------------- Refine_Tacitly*)
54.56 +(* nxt = ("Model_Problem",Model_Problem ["rational","univariate","equation"]) *)
54.57 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.58 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.59 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.60 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.61 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.62 +(* val nxt = ("Subproblem",Subproblem ("RatEq.thy",["univariate","equation"])*)
54.63 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.64 +(* val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.65 + --------------------------------------- Refine_Tacitly*)
54.66 +(*val nxt = ("Model_Problem", Model_Problem ["normalize","polynomial","univariate","equation"])*)
54.67 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.68 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.69 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.70 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.71 +(*val nxt = Apply_Method ["PolyEq", "normalize_poly"])*)
54.72 +
54.73 +(* get_obj g_fmz pt [2];
54.74 + *)
54.75 +
54.76 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.77 +(**** assoc_thm': 'all_left' not in 'RatEq.thy' (and parents)*)
54.78 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.79 +(* val nxt = ("Subproblem", Subproblem ("PolyEq.thy",["polynomial","univariate","equation"]))*)
54.80 +
54.81 +
54.82 +
54.83 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.84 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.85 +(* ("Model_Problem", Model_Problem ["degree_1","polynomial","univariate","equation"])*)
54.86 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.87 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.88 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.89 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.90 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.91 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.92 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.93 +(* "x = 1 / 5" *)
54.94 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.95 +if mout2str(f) = "Form' FormKF (~1,EdUndef,0,Nundef,([x = 1 / 5])" then ()
54.96 +else raise error "rateq.sml: new behaviour: [x = 1 / 5]";
54.97 +
54.98 +
54.99 +
54.100 +(*---------((x)/(x - 8) + (x - 8)/(x) = 26/5)---------------------*)
54.101 +"--------- S.68, Bsp.: 40, ((x)/(x - 8) + (x - 8)/(x) = 26/5)---------------------";
54.102 +(*EP Schalk_II_p68_n40*)
54.103 +val fmz = ["equality ((x)/(x - 8) + (x - 8)/(x) = 26/5)","solveFor x","solutions L"];
54.104 +(* val fmz = ["equality (3+x= 9*x^^^4+((1+2*x)/x^^^2)^^^2 + 6*(x^^^2*((1+2*x)/x^^^2)))",
54.105 + "solveFor x","solutions L"];*)
54.106 +
54.107 +(* refine fmz ["univariate","equation"];
54.108 +*)
54.109 +
54.110 +val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
54.111 +(*val p = e_pos';
54.112 +val c = [];
54.113 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
54.114 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
54.115 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
54.116 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.117 +(* nxt = ("Model_Problem",Model_Problem ["rational","univariate","equation"])*)
54.118 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.119 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.120 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.121 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.122 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.123 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.124 +(* nxt = ("Subproblem",Subproblem ("RatEq.thy",["univariate","equation"]))*)
54.125 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.126 +(* nxt = ("Model_Problem", Model_Problem ["normalize","polynomial","univariate","equation"])*)
54.127 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.128 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.129 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.130 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.131 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.132 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.133 +(* ("Subproblem", Subproblem ("PolyEq.thy",["polynomial","univariate","equation"])) *)
54.134 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.135 +(* nxt = ("Model_Problem", Model_Problem
54.136 + ["abcFormula","degree_2","polynomial","univariate","equation"])*)
54.137 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.138 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.139 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.140 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.141 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.142 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.143 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
54.144 +(* "x = -2, x = 10" *)
54.145 +if mout2str(f) = "Form' FormKF (~1,EdUndef,0,Nundef,([x = -2, x = 10])" then()
54.146 +else raise error "rateq.sml: new behaviour: [x = -2, x = 10]";
54.147 +
54.148 +"----------- rateq.sml end--------";
55.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
55.2 +++ b/test/Tools/isac/Knowledge/rational-old.sml Mon Aug 30 14:35:51 2010 +0200
55.3 @@ -0,0 +1,902 @@
55.4 +(* tests for rationals
55.5 + Stefan Karnel
55.6 + 2002
55.7 + use"../kbtest/rational.sml";
55.8 + use"kbtest/rational.sml";
55.9 + use"rational.sml";
55.10 +*)
55.11 +
55.12 +(*--------------------------------15.10.02---
55.13 +(* tests*)
55.14 +print("\n\n********************* tests *************************\n\n");
55.15 +print("\n\n***** divide tests *****\n");
55.16 +val mv_pquot1 = (#1(mv_division([(1,[1,1,1]),(1,[1,1,0]),(1,[1,0,1]),(1,[0,0,0])],[(1,[1,1,0]),(1,[0,0,0])],LEX_)));
55.17 +(* result: [(1,[0,0,1]),(1,[0,0,0])] *)
55.18 +if mv_pquot1=[(1,[0,0,1]),(1,[0,0,0])] then () else raise error ("Test failed");
55.19 +
55.20 +val mv_prest1 = (#2(mv_division([(1,[1,1,1]),(1,[1,1,0]),(1,[1,0,1]),(1,[0,0,0])],[(1,[1,1,0]),(1,[0,0,0])],LEX_)));
55.21 +(* result: [(1,[1,0,1]),(~1,[0,0,1])] *)
55.22 +if mv_prest1=[(1,[1,0,1]),(~1,[0,0,1])] then () else raise error ("Test failed");
55.23 +
55.24 +val mv_pquot2 = (#1(mv_division([(4,[2]),(8,[1]),(16,[0])],[(1,[1]),(1,[0])],LEX_)));
55.25 +(* result: [(4,[1]),(4,[0])] *)
55.26 +if mv_pquot2=[(4,[1]),(4,[0])] then () else raise error ("Test failed");
55.27 +
55.28 +val mv_prest2 = (#2(mv_division([(4,[2]),(8,[1]),(16,[0])],[(1,[1]),(1,[0])],LEX_)));
55.29 +(* result: [(12,[0]] *)
55.30 +if mv_prest2=[(12,[0])] then () else raise error ("Test failed");
55.31 +
55.32 +val mv_pquot3 = (#1(mv_division([(4,[2]),(~4,[0])],[(2,[1]),(2,[0])],LEX_)));
55.33 +(* [(2,[1]),(~2,[0])] *)
55.34 +if mv_pquot3=[(2,[1]),(~2,[0])] then () else raise error ("Test failed");
55.35 +
55.36 +val mv_prest3 = (#2(mv_division([(1,[2]),(~1,[0])],[(2,[1]),(2,[0])],LEX_)));
55.37 +(* [(1,[2]),(~1,[0])] *)
55.38 +if mv_prest3=[(1,[2]),(~1,[0])] then () else raise error ("Test failed");
55.39 +
55.40 +val mv_pquot4 = (#1(mv_division([(3,[1,1,1]),(4,[1,0,1]),(3,[0,0,1])],[(2,[1,0,0]),(4,[0,0,1])],LEX_)));
55.41 +(* [(1,[0,1,1])] *)
55.42 +if mv_pquot4=[(1,[0,1,1])] then () else raise error ("Test failed");
55.43 +
55.44 +val mv_prest4 = (#2(mv_division([(3,[1,1,1]),(4,[1,0,1]),(3,[0,0,1])],[(2,[1,0,0]),(4,[0,0,1])],GGO_)));
55.45 +(* [(1,[1,1,1]),(~4,[0,1,2]),(4,[1,0,1]),(3,[0,0,1])] *)
55.46 +if mv_prest4 =[(1,[1,1,1]),(~4,[0,1,2]),(4,[1,0,1]),(3,[0,0,1])] then () else raise error ("Test failed");
55.47 +
55.48 +val mv_pquot5 = (#1(mv_division([(3,[1,1,1]),(4,[1,0,1]),(3,[0,0,1]),(6,[2,1,3]),(4,[0,4,1]),(1,[2,2,1])],[(1,[0,0,1])],LEX_)));
55.49 +(* [(1,[2,2,0]),(6,[2,1,2]),(3,[1,1,0]),(4,[1,0,0]),(4,[0,4,0]),(3,[0,0,0])]*)
55.50 +if mv_pquot5=[(1,[2,2,0]),(6,[2,1,2]),(3,[1,1,0]),(4,[1,0,0]),(4,[0,4,0]),(3,[0,0,0])] then () else raise error ("Test failed");
55.51 +
55.52 +val mv_prest5 = (#2(mv_division([(3,[1,1,1]),(4,[1,0,1]),(3,[0,0,1]),(6,[2,1,3]),(4,[0,4,1]),(1,[2,2,1])],[(1,[0,0,1])],LEX_)));
55.53 +(* [] *)
55.54 +if mv_prest5=[] then () else raise error ("Test failed");
55.55 +
55.56 +(* (x^2 + 2(a+1)x + (a^2+2a+1)) / (x+a+1) = x+a+1 *)
55.57 +val mv_pquot6 = (#1(mv_division([(1,[2,0,0]),(2,[1,1,0]),(2,[1,0,0]),(1,[0,2,0]),(2,[0,1,0]),(1,[0,0,0])],[(1,[1,0,0]),(1,[0,1,0]),(1,[0,0,0])],LEX_)));
55.58 +if mv_pquot6=[(1,[1,0,0]),(1,[0,1,0]),(1,[0,0,0])] then () else raise error ("Test failed");
55.59 +
55.60 +val mv_prest6 = (#2(mv_division([(1,[2,0,0]),(2,[1,1,0]),(2,[1,0,0]),(1,[0,2,0]),(2,[0,1,0]),(1,[0,0,0])],[(1,[1,0,0]),(1,[0,1,0]),(1,[0,0,0])],LEX_)));
55.61 +if mv_prest6=[] then () else raise error ("Test failed");
55.62 +
55.63 +(* Exception tests *)
55.64 +(* mv_division ([(1,[0,0,0])],[(0,[1,2,3])],LEX_); *)
55.65 +
55.66 +print("\n\n***** MV_CONTENT-TESTS *****\n");
55.67 +val mv_cont1=mv_content([(1,[2,1]),(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,1]),(1,[0,0])]);
55.68 +(* [(1,[0,1]),(1,[0,0])] *)
55.69 +if mv_cont1=[(1,[0,1]),(1,[0,0])] then () else raise error ("Test failed");
55.70 +
55.71 +val mv_pp1=mv_pp([(1,[1,1]),(1,[1,0]),(1,[0,1]),(1,[0,0])]);
55.72 +(*[(1,[1,0]),(1,[0,0])]*)
55.73 +if mv_pp1=[(1,[1,0]),(1,[0,0])] then () else raise error ("Test failed");
55.74 +
55.75 +val mv_cont2=mv_content([(2,[1]),(4,[0])]);
55.76 +(* [(2,[0])] *)
55.77 +if mv_cont2=[(2,[0])] then () else raise error ("Test failed");
55.78 +
55.79 +val mv_pp2=mv_pp([(2,[1]),(4,[0])]);
55.80 +(* [(1,[1]),(2,[0])] *)
55.81 +if mv_pp2=[(1,[1]),(2,[0])] then () else raise error ("Test failed");
55.82 +
55.83 +val mv_cont3=mv_content[(8,[2,1,1]),(12,[1,0,2]),(10,[2,2,0]),(16,[1,1,1])];
55.84 +(* [(2,[0,0,0])] *)
55.85 +if mv_cont3=[(2,[0,0,0])] then () else raise error ("Test failed");
55.86 +
55.87 +val mv_pp3=mv_pp[(8,[2,1,1]),(12,[1,0,2]),(10,[2,2,0]),(16,[1,1,1])];
55.88 +(* [(5,[2,2,0]),(4,[2,1,1]),(8,[1,1,1]),(6,[1,0,2])] *)
55.89 +if mv_pp3=[(5,[2,2,0]),(4,[2,1,1]),(8,[1,1,1]),(6,[1,0,2])] then () else raise error ("Test failed");
55.90 +
55.91 +val mv_cont4=mv_content[(2,[2,1,0]),(3,[1,0,1]),(2,[1,1,0]),(3,[0,0,1])];
55.92 +(* [(1,[0,0,0])] *)
55.93 +if mv_cont4=[(1,[0,0,0])] then () else raise error ("Test failed");
55.94 +
55.95 +val mv_pp4=mv_pp [(2,[2,1,0]),(3,[1,0,1]),(2,[1,1,0]),(3,[0,0,1])];
55.96 +(* [(2,[2,1,0]),(2,[1,1,0]),(3,[1,0,1]),(3,[0,0,1])] *)
55.97 +if mv_pp4=[(2,[2,1,0]),(2,[1,1,0]),(3,[1,0,1]),(3,[0,0,1])] then () else raise error ("Test failed");
55.98 +
55.99 +val con1=mv_content([(9,[2,0]),(15,[1,1]),(12,[1,0]),(6,[0,2]),(12,[0,1])]);
55.100 +(* [(3,[0,0])] *)
55.101 +if con1=[(3,[0,0])] then () else raise error ("Test failed");
55.102 +
55.103 +val pp1=mv_pp([(9,[2,0]),(15,[1,1]),(12,[1,0]),(6,[0,2]),(12,[0,1])]);
55.104 +(* [(3,[2,0]),(5,[1,1]),(4,[1,0]),(2,[0,2]),(4,[0,1])] *)
55.105 +if pp1=[(3,[2,0]),(5,[1,1]),(4,[1,0]),(2,[0,2]),(4,[0,1])] then () else raise error ("Test failed");
55.106 +
55.107 +val con2=mv_content([(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,2]),(1,[0,1])]);
55.108 +(* [(1,[0,0])] *)
55.109 +if con2=[(1,[0,0])] then () else raise error ("Test failed");
55.110 +
55.111 +val pp2 =mv_pp([(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,2]),(1,[0,1])]);
55.112 +(* [(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,2]),(1,[0,1])] *)
55.113 +if pp2=[(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,2]),(1,[0,1])] then () else raise error ("Test failed");
55.114 +
55.115 +val cont1 = mv_content [(1,[2,1,0]),(2,[2,1,0])];
55.116 +(* [(3,[0,1,0])] *)
55.117 +if cont1=[(3,[0,1,0])] then () else raise error ("Test failed");
55.118 +
55.119 +val pp1 = mv_pp [(1,[2,1,0]),(2,[2,1,0])];
55.120 +(* [(1,[2,0,0])] *)
55.121 +if pp1=[(1,[2,0,0])] then () else raise error ("Test failed");
55.122 +
55.123 +val cont2 = mv_content [(4,[1,2,0]),(2,[2,1,0])];
55.124 +(* [(2,[0,1,0])] *)
55.125 +if cont2=[(2,[0,1,0])] then () else raise error ("Test failed");
55.126 +
55.127 +val pp2 = mv_pp [(4,[1,2,0]),(2,[2,1,0])];
55.128 +(* [(1,[2,0,0]),(2,[1,1,0])] *)
55.129 +if pp2=[(1,[2,0,0]),(2,[1,1,0])] then () else raise error ("Test failed");
55.130 +
55.131 +print("\n\n\n\n********************************************************\n\n");
55.132 +val cont3=mv_content [(65,[3,2,2]),(52,[3,2,1]),(26,[3,1,2]),(~95,[2,2,3]),(~76,[2,2,2]),(35,[2,2,1]),(28,[2,2,0]),(~38,[2,1,3]),(14,[2,1,1])];
55.133 +(*if cont3=[(1,[0,1,0])] then () else raise error ("Test failed"); *)
55.134 +val pp3=mv_pp [(65,[3,2,2]),(52,[3,2,1]),(26,[3,1,2]),(~95,[2,2,3]),(~76,[2,2,2]),(35,[2,2,1]),(28,[2,2,0]),(~38,[2,1,3]),(14,[2,1,1])];
55.135 +
55.136 +
55.137 +print("\n\n***** gcd-tests *****\n");
55.138 +val ggt1 = gcd_poly [(4,[2,2]),(8,[1,1]),(4,[0,0])] [(2,[1,1]),(2,[0,0])];
55.139 +(* [(2,[1,1]),(2,[0,0])] *)
55.140 +if ggt1=[(2,[1,1]),(2,[0,0])] then () else raise error ("Test failed");
55.141 +
55.142 +val ggt2 = gcd_poly [(8,[2,1,1]),(12,[1,0,2]),(10,[2,2,0]),(15,[1,1,1])] [(2,[2,1,0]),(3,[1,0,1]),(2,[1,1,0]),(3,[0,0,1])];
55.143 +(* [(2,[1,1,0]),(3,[0,0,1])] *)
55.144 +if ggt2=[(2,[1,1,0]),(3,[0,0,1])] then () else raise error ("Test failed");
55.145 +
55.146 +val ggt3 = gcd_poly [(1,[2,0,0]),(~2,[1,0,1]),(1,[0,0,2])] [(1,[1,0,0]),(~1,[0,0,1])];
55.147 +(* [(1,[1,0,0]),(~1,[0,0,1])] *)
55.148 +if ggt3=[(1,[1,0,0]),(~1,[0,0,1])] then () else raise error ("Test failed");
55.149 +
55.150 +val ggt4 = gcd_poly [(1,[2,1,0]),(2,[2,1,0])] [(5,[1,0,0])];
55.151 +(* [(1,[1,0,0])] *)
55.152 +if ggt4=[(1,[1,0,0])] then () else raise error ("Test failed");
55.153 +
55.154 +val ggt5 = gcd_poly [(4,[2,0,0]),(~8,[1,0,1]),(4,[0,0,2])] [(1,[2,0,0]),(~1,[0,0,2])];
55.155 +(* [(1,[1,0,0]),(~1,[0,0,1])] *)
55.156 +if ggt5=[(1,[1,0,0]),(~1,[0,0,1])] then () else raise error ("Test failed");
55.157 +
55.158 +val ggt6 = gcd_poly [(10,[2,1,1]),(14,[1,1,0]),(3,[1,0,1]),(20,[1,2,1])] [(5,[1,1,1]),(7,[2,1,1])];
55.159 +(* [(1,[0,0,0])] *)
55.160 +if ggt6=[(1,[1,0,0])] then () else raise error ("Test failed");
55.161 +
55.162 +val ggt7 = gcd_poly [(~169,[4,3,3]),(273,[4,2,2]),(247,[3,3,4]),(~91,[3,3,2]),(78,[3,3,1]),(~399,[3,2,3]),(147,[3,2,1]),(~114,[2,3,2]),(42,[2,3,0])] [(65,[3,2,2]),(52,[3,2,1]),(26,[3,1,2]),(~95,[2,2,3]),(~76,[2,2,2]),(35,[2,2,1]),(28,[2,2,0]),(~38,[2,1,3]),(14,[2,1,1])];
55.163 +(* [(13,[3,1,1]),(~19,[2,1,2]),(7,[2,1,0])] *)
55.164 +if ggt7=[(13,[3,1,1]),(~19,[2,1,2]),(7,[2,1,0])] then () else raise error ("Test failed");
55.165 +
55.166 +print("\n\n***** kgv-tests *****\n");
55.167 +val kgv1=lcm_poly [(10,[])] [(15,[])];
55.168 +(* [(30,[])] *)
55.169 +if kgv1=[(30,[])] then () else raise error ("Test failed");
55.170 +
55.171 +val kgv2=lcm_poly [(1,[2,0,0]),(~2,[1,0,1]),(1,[0,0,2])] [(1,[1,0,0]),(~1,[0,0,1])];
55.172 +(* [(1,[2,0,0]),(~2,[1,0,1]),(1,[0,0,2])] *)
55.173 +if kgv2=[(1,[2,0,0]),(~2,[1,0,1]),(1,[0,0,2])] then () else raise error ("Test failed");
55.174 +
55.175 +val kgv3=lcm_poly [(4,[2,0,0]),(~8,[1,0,1]),(4,[0,0,2])] [(1,[2,0,0]),(~1,[0,0,2])];
55.176 +(* [(4,[3,0,0]),(~4,[2,0,1]),(~4,[1,0,2]),(4,[0,0,3])] *)
55.177 +if kgv3=[(4,[3,0,0]),(~4,[2,0,1]),(~4,[1,0,2]),(4,[0,0,3])] then () else raise error ("Test failed");
55.178 +
55.179 +(*
55.180 +print("***** TERM2POLY-TESTS *****\n");
55.181 +val t0 = (term_of o the o (parse thy)) "3 * 4";
55.182 +val t1 = (term_of o the o (parse thy)) "27";
55.183 +val t11= (term_of o the o (parse thy)) "27 * c";
55.184 +val t2 = (term_of o the o (parse thy)) "b";
55.185 +val t23= (term_of o the o (parse thy)) "c^^^7";
55.186 +val t24= (term_of o the o (parse thy)) "5 * c^^^7";
55.187 +val t26= (term_of o the o (parse thy)) "a * b";
55.188 +val t3 = (term_of o the o (parse thy)) "2 + a";
55.189 +val t4 = (term_of o the o (parse thy)) "b + a";
55.190 +val t5 = (term_of o the o (parse thy)) "2 + a^^^3";*)
55.191 +val t6 = (term_of o the o (parse thy)) "5*a^^^2*b^^^3*c+4*a^^^4*b+2*a*c";
55.192 +val t7 = (term_of o the o (parse thy)) "a-b";
55.193 +(*
55.194 +(the o term2poly) t0;
55.195 +(the o term2poly) t1;
55.196 +(the o term2poly) t11;
55.197 +(the o term2poly) t2;
55.198 +(the o term2poly) t23;
55.199 +(the o term2poly) t24;
55.200 +(the o term2poly) t26;
55.201 +(the o term2poly) t3;
55.202 +(the o term2poly) t4;
55.203 +(the o term2poly) t5;
55.204 +(the o term2poly) t6;
55.205 +(the o term2poly) t7;*)
55.206 +
55.207 +
55.208 +print("\n\n***** STEP_CANCEL_TESTS: *****\n");
55.209 +(*
55.210 +val term2 = (term_of o the o (parse thy)) " (9 * a^^^2 * b) /// (6 * a * c)";
55.211 +val div2 = step_cancel term2;
55.212 +atomt div2;
55.213 +*)
55.214 +
55.215 +val term1 = (term_of o the o (parse thy)) "(10 * a^^^2 * b * c + 14 * a * b + 3 * a * c + 20 * a * b^^^2 * c) /// a";
55.216 +val div1 = step_cancel term1;
55.217 +(*if div1 = (term_of o the o (parse thy)) "((10 * a * b * c + 14 * b + 3 * c + 20 * b^^^2 * c) * a) /// (1 * a)" then () else raise raise error ("Test failed");*)
55.218 +
55.219 +val term2 = (term_of o the o (parse thy)) "(10 * a^^^2 * b * c + 14 * a * b + 3 * a * c + 20 * a * b^^^2 * c) /// (5 * a * b * c + 7 * a^^^2 * b * c) ";
55.220 +val div2 = step_cancel term2;
55.221 +(*if div2 = ([(10,[1,1,1]),(20,[0,2,1]),(14,[0,1,0]),(3,[0,0,1])],[(1,[1,0,0])],[(7,[1,1,1]),(5,[0,1,1])]) then () else raise raise error ("Test failed");*)
55.222 +
55.223 +
55.224 +val term3 = (term_of o the o (parse thy)) "(10 * a^^^2 * b * c) /// (1 * x * y * z) ";
55.225 +val div3 = step_cancel term3;
55.226 +
55.227 +
55.228 +
55.229 +(*val mul1=(term_of o the o (parse thy)) "(5*a*b*c+4*a*b+2*a*c)";
55.230 +val mul2=(the (term2poly((term_of o the o (parse thy)) "13*a^^^2*b*c+7*a*b-19*a*b*c^^^2")));
55.231 +val mul3=(the (term2poly((term_of o the o (parse thy)) "6*a*b^^^2-13*a^^^2*b^^^2*c^^^2+21*a^^^2*b*c")));
55.232 +val t1=mv_mul(mul1,mul2,LEX_);
55.233 +val t2=mv_mul(mul3,mul2,LEX_);
55.234 +val div3=step_cancel t1 t2;
55.235 +if div3=([(5,[0,1,1]),(4,[0,1,0]),(2,[0,0,1])],[(13,[3,1,1]),(~19,[2,1,2]),(7,[2,1,0])],[(~13,[1,2,2]),(21,[1,1,1]),(6,[0,2,0])]) then () else raise error ("Test failed");*)
55.236 +
55.237 +print("\n\n***** all tests successfull ;-) ******\n\n");
55.238 +
55.239 +
55.240 +
55.241 +val thy = Rational.thy;
55.242 +val rls = Prls {func=cancel};
55.243 +val t = (term_of o the o (parse thy))
55.244 + "(1 + 1 * a ^^^ 1)///(-2 + 2 * a ^^^ 2)";
55.245 +val (t,asm) = the (rewrite_set_ thy eval_rls false rls t);
55.246 +
55.247 +
55.248 +val thy' = "Rational.thy";
55.249 +val rls' = "cancel";
55.250 +val t' = "(1 + 1 * a ^^^ 1)///(-2 + 2 * a ^^^ 2)";
55.251 +val (t',asm') = the (rewrite_set thy' "eval_rls" false rls' t');
55.252 +(*if t' = "1 /// (-2 + 2 * a)" then ()
55.253 +else raise error "tests/rationals.sml(1): new behaviour";*)
55.254 +
55.255 +
55.256 +val thy' = "Rational.thy";
55.257 +val rls' = "cancel";
55.258 +val t' = "(10 * a^^^2 * b * c + 14 * a * b + 3 * a * c + 20 * a * b^^^2 * c) /// (5 * a * b * c + 7 * a^^^2 * b * c) ";
55.259 +val (t',asm') = the (rewrite_set thy' "eval_rls" false rls' t');
55.260 +
55.261 +val thy' = "Rational.thy";
55.262 +val rls' = "cancel";
55.263 +val t' = "(a^^^2 * b + 2 * a * b + b ) /// ( a^^^2 - 1 )";
55.264 +val (t',asm') = the (rewrite_set thy' "eval_rls" false rls' t');
55.265 +
55.266 +(*
55.267 +val term2 = (term_of o the o (parse thy)) "(a^^^2 * b + 2 * a * b + b ) /// ( a^^^2 - 1 )";
55.268 +val div2 = direct_cancel term2;
55.269 +val t = (term_of o the o (parse thy)) "(1 + 1 * a ^^^ 1)///(-2 + 2 * a ^^^ 2) = 0";*)
55.270 +
55.271 +
55.272 +
55.273 +(*WN folgendes aus examples he"uberkopiert ...*)
55.274 +
55.275 +(* examples from:
55.276 + Mathematik 1
55.277 + Schalk
55.278 + Reniets Verlag *)
55.279 +
55.280 +val thy' = "Rational.thy";
55.281 +val rls' = "cancel";
55.282 +val mp = "make_polynomial";
55.283 +
55.284 +(* page 63 *)
55.285 +
55.286 +print("\n\nexample 186:\n");
55.287 +print("a)\n");
55.288 +val e186a'="(14 * x * y) / ( x * y )";
55.289 +val e186a = the (rewrite_set thy' "rational_erls" false rls' e186a');
55.290 +print("b)\n");
55.291 +val e186b'="(60 * a * b) / ( 15 * a * b )";
55.292 +val e186b = the (rewrite_set thy' "rational_erls" false rls' e186b');
55.293 +print("c)\n");
55.294 +val e186c'="(144 * a^^^2 * b * c) / (12 * a * b * c )";
55.295 +val e186c = (the (rewrite_set thy' "rational_erls" false rls' e186c'))
55.296 + handle e => print_exn e;
55.297 +val t = (term_of o the o (parse thy)) e186c';
55.298 +atomt t;
55.299 +
55.300 +print("\n\nexample 187:\n");
55.301 +print("a)\n");
55.302 +val e187a'="(12 * x * y) / (8 * y^^^2 )";
55.303 +val e187a = the (rewrite_set thy' "rational_erls" false rls' e187a');
55.304 +print("b)\n");
55.305 +val e187b'="(8 * x^^^2 * y * z ) / (18 * x * y^^^2 * z )";
55.306 +val e187b = the (rewrite_set thy' "rational_erls" false rls' e187b');
55.307 +print("c)\n");
55.308 +val e187c'="(9 * x^^^5 * y^^^2 * z^^^4) / (15 * x^^^6 * y^^^3 * z )";
55.309 +val e187c = the (rewrite_set thy' "rational_erls" false rls' e187c');
55.310 +
55.311 +print("\n\nexample 188:\n");
55.312 +print("a)\n");
55.313 +val e188a'="(8 * x + -8) / (9 * x + -9 )";
55.314 +val e188a = the (rewrite_set thy' "rational_erls" false rls' e188a');
55.315 +val SOME (t,_) = rewrite_set thy' "rational_erls" false mp "(8*((-1) + x))/(9*((-1) + x))";
55.316 +if t="((-8) + 8 * x) / ((-9) + 9 * x)"then()
55.317 +else raise error "rationals.sml: e188a new behaviour";
55.318 +print("b)\n");
55.319 +val e188b'="(5 * x + -15) / (6 * x + -18 )";
55.320 +val e188b = the (rewrite_set thy' "rational_erls" false rls' e188b');
55.321 +print("c)\n");
55.322 +val e188c'="( a + -1 * b ) / ( b + -1 * a )";
55.323 +val e188c = the (rewrite_set thy' "rational_erls" false rls' e188c');
55.324 +val SOME (t,_) = rewrite_set thy' "rational_erls" false mp "((-1)*(b + (-1) * a))/(1*(b + (-1) * a))";
55.325 +if t="(a + -1 * b) / (b + -1 * a)"then()
55.326 +else raise error "rationals.sml: e188c new behaviour";
55.327 +
55.328 +print("\n\nexample 190:\n");
55.329 +print("c)\n");
55.330 +val e190c'="( 27 * a^^^3 + 9 * a^^^2 + 3 * a + 1 ) / ( 27 * a^^^3 + 18 * a^^^2 + 3 * a )";
55.331 +val e190c = the (rewrite_set thy' "rational_erls" false rls' e190c');
55.332 +val SOME (t,_) = rewrite_set thy' "rational_erls" false mp "((1 + 9 * a ^^^ 2)*(1 + 3 * a))/((3 * a + 9 * a ^^^ 2)*(1 + 3 * a))";
55.333 +if t="(1 + (3 * a + (27 * a ^^^ 3 + 9 * a ^^^ 2))) /\n(3 * a + (18 * a ^^^ 2 + 27 * a ^^^ 3))"then()
55.334 +(*TERMORDER ~~~~~~~ ~~~~~~~*)
55.335 +else raise error "rationals.sml: e190c new behaviour";
55.336 +
55.337 +print("\n\nexample 191:\n");
55.338 +print("a)\n");
55.339 +val e191a'="( x^^^2 + -1 * y^^^2 ) / ( x + y )";
55.340 +val e191a = the (rewrite_set thy' "rational_erls" false rls' e191a');
55.341 +val SOME (t,_) = rewrite_set thy' "rational_erls" false mp "((x + (-1) * y)*(x + y))/((1)*(x + y))";
55.342 +if t="(x ^^^ 2 + -1 * y ^^^ 2) / (x + y)"then()
55.343 +else raise error "rationals.sml: e191a new behaviour";
55.344 +print("c)\n");
55.345 +val e191c'="( 9 * x^^^2 + -30 * x + 25 ) / ( 9 * x^^^2 + -25 )";
55.346 +val e191c = the (rewrite_set thy' "rational_erls" false rls' e191c');
55.347 +val SOME (t,_) = rewrite_set thy' "rational_erls" false mp "(((-5) + 3 * x)*((-5) + 3 * x))/((5 + 3 * x)*((-5) + 3 * x))";
55.348 +if t="(25 + ((-30) * x + 9 * x ^^^ 2)) / ((-25) + 9 * x ^^^ 2)"then()
55.349 +else raise error "rationals.sml: 'e191c' new behaviour";
55.350 +
55.351 +print("\n\nexample 192:\n");
55.352 +print("b)\n");
55.353 +val e192b'="( 7 * x^^^3 + -1 * x^^^2 * y ) / ( 7 * x * y^^^2 + -1 * y^^^3 )";
55.354 +val e192b = the (rewrite_set thy' "rational_erls" false rls' e192b');
55.355 +val SOME (t,_) = rewrite_set thy' "rational_erls" false mp "((x ^^^ 2)*(7 * x + (-1) * y))/((y ^^^ 2)*(7 * x + (-1) * y))";
55.356 +if t="(7 * x ^^^ 3 + -1 * (y * x ^^^ 2)) / (-1 * y ^^^ 3 + 7 * (x * y ^^^ 2))"then()
55.357 +(*TERMORDER ~~~~~*)
55.358 +else raise error "rationals.sml: 'e192b' new behaviour";
55.359 +
55.360 +print("\n\nexample 193:\n");
55.361 +print("a)\n");
55.362 +val e193a'="( x^^^2 + -6 * x + 9 ) / ( x^^^2 + -9 )";
55.363 +val e193a = the (rewrite_set thy' "rational_erls" false rls' e193a');
55.364 +print("b)\n");
55.365 +val e193b'="( x^^^2 + -8 * x + 16 ) / ( 2 * x^^^2 + -32 )";
55.366 +val e193b = the (rewrite_set thy' "rational_erls" false rls' e193b');
55.367 +print("c)\n");
55.368 +val e193c'="( 2 * x + -50 * x^^^3 ) / ( 25 * x^^^2 + -10 * x + 1 )";
55.369 +val SOME(t,_) = rewrite_set thy' "rational_erls" false rls' e193c';
55.370 +--------------------------------15.10.02---*)
55.371 +
55.372 +
55.373 +(*---------- WN: 10.9.02:
55.374 +ML> val e204a = the (rewrite_set thy' "rational_erls" false rls' e204a');
55.375 +*** RATIONALS_STEP_CANCEL_EXCEPTION: Invalid fraction
55.376 +print("\n\nexample 204:\n");
55.377 +print("a)\n");
55.378 +val e204a'="((5 * x) / 9) + ((3 * x) / 9) + (x / 9)";
55.379 +val e204a = the (rewrite_set thy' "rational_erls" false rls' e204a');
55.380 +print("b)\n");
55.381 +val e204b'="5 / x + -3 / x + -1 / x";
55.382 +val e204b = the (rewrite_set thy' "rational_erls" false rls' e204b');
55.383 +
55.384 +print("\n\nexample 205:\n");
55.385 +print("a)\n");
55.386 +val e205a'="((4 * x + 7) / 8) + ((4 * x + 3) / 8)";
55.387 +val e205a = the (rewrite_set thy' "rational_erls" false rls' e205a');
55.388 +print("b)\n");
55.389 +val e205b'="((5 * x + 2) / 3) + ((-2 * x + 1) / 3)";
55.390 +val e205b = the (rewrite_set thy' "rational_erls" false rls' e205b');
55.391 +
55.392 +print("\n\nexample 206:\n");
55.393 +print("a)\n");
55.394 +val e206a'="((5 * x + 4) / (2 * x + -1)) + ((9 * x + 5) / (2 * x + -1))";
55.395 +val e206a = the (rewrite_set thy' "rational_erls" false rls' e206a');
55.396 +print("b)\n");
55.397 +val e206b'="((17 * x + -23) / (5 * x + 4)) + ((-25 + -17 * x) / (5 * x + 4))";
55.398 +val e206b = the (rewrite_set thy' "rational_erls" false rls' e206b');
55.399 +
55.400 +print("\n\nexample 207:\n");
55.401 +val e207'="((3 * x * y + 3 * y) / (x * y)) + ((5 * x * y + 7 * y) / (x * y)) + ((9 * x * y + -2 * y) / (x * y)) + ((x * y + 4 * y) / (x * y)) ";
55.402 +val e207 = the (rewrite_set thy' "rational_erls" false rls' e207');
55.403 +
55.404 +print("\n\nexample 208:\n");
55.405 +val e208'="((3 * x + 2) / (x + 2)) + ((5 * x + -1) / (x + 2)) + ((-7 * x + -3) / (x + 2)) + ((-1 * x + -3) / (x + 2)) ";
55.406 +val e208 = the (rewrite_set thy' "rational_erls" false rls' e208');
55.407 +
55.408 +print("\n\nexample 209:\n");
55.409 +val e209'="((3 * x + -7 * y + 3 * z) / (4)) + ((2 * x + 17 * y + 10 * z) / (4)) + ((-1 * x + 2 * y + z) / (4)) ";
55.410 +val e209 = the (rewrite_set thy' "rational_erls" false rls' e209');
55.411 +
55.412 +print("\n\nexample 210:\n");
55.413 +val e210'="((2 * x + 3 + -1 * x^^^2) / (5 * x)) + ((5 * x^^^2 + -2 * x + 1) / (5 * x)) + ((-3 * x^^^2 + -2 * x + 1) / (5 * x)) + ((-1 * x^^^2 + -3 * x + -5) / (5 * x)) ";
55.414 +val e210 = the (rewrite_set thy' "rational_erls" false rls' e210');
55.415 +
55.416 +print("\n\nexample 211:\n");
55.417 +print("a)\n");
55.418 +val e211a'="((b) / (a + -1 * b)) + ((-1 * a) / (a + -1 * b))";
55.419 +val e211a = the (rewrite_set thy' "rational_erls" false rls' e211a');
55.420 +print("b)\n");
55.421 +val e211b'="((b) / (b^^^2 + -1 * a^^^2)) + ((-1 * a) / (b^^^2 + -1 * a^^^2))";
55.422 +val e211b = the (rewrite_set thy' "rational_erls" false rls' e211b');
55.423 +
55.424 +print("\n\nexample 212:\n");
55.425 +print("a)\n");
55.426 +val e212a'="((4) / (x)) + ((-3) / (y)) + -1";
55.427 +val e212a = the (rewrite_set thy' "rational_erls" false rls' e212a');
55.428 +print("b)\n");
55.429 +val e212b'="((4) / (x)) + ((-5) / (y)) + ((6) / (x*y))";
55.430 +val e212b = the (rewrite_set thy' "rational_erls" false rls' e212b');
55.431 +
55.432 +print("\n\nexample 213:\n");
55.433 +print("a)\n");
55.434 +val e213a'="((5 * x) / (3 * y^^^2)) + ((19 * z) / (6 * x * y)) + ((-2 * x) / (3 * y^^^2)) + ((7 * y^^^2) / (6 * x^^^2)) ";
55.435 +val e213a = the (rewrite_set thy' "rational_erls" false rls' e213a');
55.436 +print("b)\n");
55.437 +val e213b'="((2 * b) / (3 * a^^^2)) + ((3 * c) / (7 * a * b)) + ((4 * b) / (3 * a^^^2)) + ((3 * a) / (7 * b^^^2))";
55.438 +val e213b = the (rewrite_set thy' "rational_erls" false rls' e213b');
55.439 +
55.440 +print("\n\nexample 214:\n");
55.441 +print("a)\n");
55.442 +val e214a'="((3 * x + 2 * y + 2 * z) / (4)) + ((-5 * x + -3 * y) / (3)) + ((x + y + -2 * z) / (2))";
55.443 +val e214a = the (rewrite_set thy' "rational_erls" false rls' e214a');
55.444 +print("b)\n");
55.445 +val e214b'="((5 * x + 2 * y + z) / (2)) + ((-7 * x + -3 * y) / (3)) + ((3 * x + 6 * y + -1 * z) / (12))";
55.446 +val e214b = the (rewrite_set thy' "rational_erls" false rls' e214b');
55.447 +
55.448 +print("\n\nexample 216:\n");
55.449 +print("a)\n");
55.450 +val e216a'="((2 * b + 3 * c) / (a * c)) + ((3 * a + b) / (a * b)) + ((-2 * b^^^2 + -3 * a * c) / (a * b * c))";
55.451 +val e216a = the (rewrite_set thy' "rational_erls" false rls' e216a');
55.452 +print("b)\n");
55.453 +val e216b'="((2 * a + 3 * b) / (b * c)) + ((3 * c + a) / (a * c)) + ((-2 * a^^^2 + -3 * b * c) / (a * b * c))";
55.454 +val e216b = the (rewrite_set thy' "rational_erls" false rls' e216b');
55.455 +
55.456 +print("\n\nexample 217:\n");
55.457 +val e217'="((z + -1) / (z)) + ((3 * z ^^^2 + -6 * z + 5) / (z^^^2)) + ((-4 * z^^^3 + 7 * z^^^2 + -5 * z + 5) / (z^^^3))";
55.458 +val e217 = the (rewrite_set thy' "rational_erls" false rls' e217');
55.459 +
55.460 +print("\n\nexample 218:\n");
55.461 +val e218'="((9 * a^^^3 - 5 * a^^^2 + 2 * a + 8) / (108 * a^^^4)) + ((-5 * a + 3 * a^^^2 + 4) / (8 * a^^^3)) + ((-261 * a^^^3 + 19 * a^^^2 + -112 * a + 16) / (216 * a^^^4))";
55.462 +val e218 = the (rewrite_set thy' "rational_erls" false rls' e218');
55.463 +
55.464 +print("\n\nexample 219:\n");
55.465 +print("a)\n");
55.466 +val e219a'="((1) / (y + 1)) + ((1) / (y + 2)) + ((1) / (y + 3))";
55.467 +val e219a = the (rewrite_set thy' "rational_erls" false rls' e219a');
55.468 +print("b)\n");
55.469 +val e219b'="((1) / (x + 1)) + ((1) / (x + 2)) + ((-2) / (x + 3))";
55.470 +val e219b = the (rewrite_set thy' "rational_erls" false rls' e219b');
55.471 +
55.472 +print("\n\nexample 220:\n");
55.473 +print("a)\n");
55.474 +val e220a'="((17) / (5 * r + -2)) + ((-13) / (2 * r + 3)) + ((4) / (3 * r + -5))";
55.475 +val e220a = the (rewrite_set thy' "rational_erls" false rls' e220a');
55.476 +print("b)\n");
55.477 +val e220b'="((20 * a) / (a + -3)) + ((-19 * a) / (a + -4)) + ((a) / (a + -5))";
55.478 +val e220b = the (rewrite_set thy' "rational_erls" false rls' e220b');
55.479 +
55.480 +print("\n\nexample 221:\n");
55.481 +print("a)\n");
55.482 +val e221a'="((a + b) / (a + -1 * b)) + ((a + -1 * b) / (a + b))";
55.483 +val e221a = the (rewrite_set thy' "rational_erls" false rls' e221a');
55.484 +print("b)\n");
55.485 +val e221b'="((x + -1 * y) / (x + y)) + ((x + y) / (x + -1 * y)) ";
55.486 +val e221b = the (rewrite_set thy' "rational_erls" false rls' e221b');
55.487 +
55.488 +print("\n\nexample 222:\n");
55.489 +print("a)\n");
55.490 +val e222a'="((1 + -1 * x) / (1 + x)) + ((-1 + -1 * x) / (1 + -1 * x)) + ((4 * x) / (1 + -1 * x^^^2))";
55.491 +val e222a = the (rewrite_set thy' "rational_erls" false rls' e222a');
55.492 +print("b)\n");
55.493 +val e222b'="((1 + x ) / (1 + -1 * x)) + ((-1 + x) / (1 + x)) + ((2 * x) / (1 + -1 * x^^^2))";
55.494 +val e222b = the (rewrite_set thy' "rational_erls" false rls' e222b');
55.495 +
55.496 +print("\n\nexample 225:\n");
55.497 +print("a)\n");
55.498 +val e225a'="((6 * a) / (a^^^2 + -64)) + ((a + 2) / (2 * a + 16)) + ((-1) / (2))";
55.499 +val e225a = the (rewrite_set thy' "rational_erls" false rls' e225a');
55.500 +print("b)\n");
55.501 +val e225b'="((a + 2 ) / (2 * a + 12)) + ((4 * a) / (a^^^2 + -36)) + ((-1) / (2))";
55.502 +val e225b = the (rewrite_set thy' "rational_erls" false rls' e225b');
55.503 +
55.504 +print("\n\nexample 226:\n");
55.505 +print("a)\n");
55.506 +val e226a'="((35 * z) / (49 * z^^^2 + -4)) + -1 + ((14 * z + -1) / (14 * z + 4)) ";
55.507 +val e226a = the (rewrite_set thy' "rational_erls" false rls' e226a');
55.508 +print("b)\n");
55.509 +val e226b'="((45 * a * b) / (25 * a^^^2 + -9 * b^^^2)) + ((20 * a + 3 * b) / (10 * a + 6 * b)) + -2";
55.510 +val e226b = the (rewrite_set thy' "rational_erls" false rls' e226b');
55.511 +
55.512 +print("\n\nexample 227:\n");
55.513 +print("a)\n");
55.514 +val e227a'="((6 * z + 11) / (6 * z + 14)) + ((9 * z ) / (9 * z^^^2 + -49)) + -1 ";
55.515 +val e227a = the (rewrite_set thy' "rational_erls" false rls' e227a');
55.516 +print("b)\n");
55.517 +val e227b'="((16 * a + 37 * b) / (4 * a + 10 * b)) + ((6 * a * b) / (4 * a^^^2 + -25 * b^^^2)) + -4 ";
55.518 +val e227b = the (rewrite_set thy' "rational_erls" false rls' e227b');
55.519 +
55.520 +print("\n\nexample 228:\n");
55.521 +print("a)\n");
55.522 +val e228a'="((7 * a + 11) / (3 * a^^^2 + -3)) + ((-2 * a + -1) / (a^^^2 + -1 * a)) + ((-1) / (3 * a + 3))";
55.523 +val e228a = the (rewrite_set thy' "rational_erls" false rls' e228a');
55.524 +print("b)\n");
55.525 +val e228b'="((11 * z + 2 * b) / (4 * b * z + -8 * b^^^2)) + ((-8 * z) / (z^^^2 + -4 * b^^^2)) + ((-9 * z + -2 * b) / (4 * b * z + 8 * b^^^2))";
55.526 +val e228b = the (rewrite_set thy' "rational_erls" false rls' e228b');
55.527 +
55.528 +
55.529 +print("\n\nexample 229:\n");
55.530 +print("a)\n");
55.531 +val e229a'="((5 * x^^^2 + y) / (x + 2 * y)) + ((-8 * x^^^3 + 4 * x^^^2 * y + 3 * x * y) / (x^^^2 + -4 * y^^^2)) + ((3 * x^^^2 + -4 * y) / (x + -2 * y))";
55.532 +val e229a = the (rewrite_set thy' "rational_erls" false rls' e229a');
55.533 +print("b)\n");
55.534 +val e229b'="((7 * x^^^2 + y) / (x + 3 * y)) + ((-24 * x^^^2 * y + 5 * x * y + 21 * y^^^2) / (x^^^2 + -9 * y^^^2)) + ((4 * x^^^2 + -6 * y) / (x + -3 * y))";
55.535 +val e229b = the (rewrite_set thy' "rational_erls" false rls' e229b');
55.536 +
55.537 +print("\n\nexample 230:\n");
55.538 +print("a)\n");
55.539 +val e230a'="((5 * x^^^2 + y) / (2 * x + y)) + ((-16 * x^^^3 + 2 * x^^^2 * y + 6 * x * y) / (4 * x^^^2 + -1 * y^^^2)) + ((3 * x^^^2 + -4 * y) / (2 * x + -1 * y))";
55.540 +val e230a = the (rewrite_set thy' "rational_erls" false rls' e230a');
55.541 +print("b)\n");
55.542 +val e230b'="((7 * x^^^2 + y) / (3 * x + y)) + ((-3 * x^^^3 + 15 * x * y + -7 * x^^^2 * y + 7 * y^^^2) / (9 * x^^^2 + -1 * y^^^2)) + ((4 * x^^^2 + -6 * y) / (3 * x + -1 * y))";
55.543 +val e230b = the (rewrite_set thy' "rational_erls" false rls' e230b');
55.544 +
55.545 +print("\n\nexample 231:\n");
55.546 +print("a)\n");
55.547 +val e231a'="((2 * x + 5 * y) / (x)) + ((2 * x^^^3 + -5 * y^^^3 + 3 * x * y^^^2) / (x^^^3 + -2 * x^^^2 * y + x * y^^^2)) + ((-3 * x + -6 * y) / (x + -1 * y))";
55.548 +val e231a = the (rewrite_set thy' "rational_erls" false rls' e231a');
55.549 +print("b)\n");
55.550 +val e231b'="((6 * x + 2 * y) / (x)) + ((6 * x^^^2 * y + -4 * x * y^^^2 + -2 * y^^^3) / (x^^^3 + -2 * x^^^2 * y + x * y^^^2)) + ((-5 * x + -3 * y) / (x + -1 * y))";
55.551 +val e231b = the (rewrite_set thy' "rational_erls" false rls' e231b');
55.552 +
55.553 +print("\n\nexample 232:\n");
55.554 +print("a)\n");
55.555 +val e232a'="((2 * x + 3 * y) / (x)) + ((4 * x^^^3 + -1 * x * y^^^2 + -3 * y^^^3) / (x^^^3 + -2 * x^^^2 * y + x * y^^^2)) + ((-5 * x + -6 * y) / (x + -1 * y))";
55.556 +val e232a = the (rewrite_set thy' "rational_erls" false rls' e232a');
55.557 +print("b)\n");
55.558 +val e232b'="((5 * x + 2 * y) / (x)) + ((2 * x^^^3 + -3 * x * y^^^2 + 3 * x^^^2 * y + -2 * y^^^3) / (x^^^3 + -2 * x^^^2 * y + x * y^^^2)) + ((-6 * x + -3 * y) / (x + -1 * y))";
55.559 +val e232b = the (rewrite_set thy' "rational_erls" false rls' e232b');
55.560 +
55.561 +print("\n\nexample 233:\n");
55.562 +print("a)\n");
55.563 +val e233a'="((5 * x + 6 * y) / (x)) + ((5 * x * y^^^2 + -6 * y^^^3 + -2 * x^^^3 + 3 * x^^^2 * y) / (x^^^3 + -2 * x^^^2 * y + x * y^^^2)) + ((-2 * x + -3 * y) / (x + -1 * y))";
55.564 +val e233a = the (rewrite_set thy' "rational_erls" false rls' e233a');
55.565 +print("b)\n");
55.566 +val e233b'="((6 * x + 5 * y) / (x)) + ((4 * x^^^2 * y + 3 * x * y^^^2 + -5 * y^^^3 + -2 * x^^^3) / (x^^^3 + -2 * x^^^2 * y + x * y^^^2)) + ((-3 * x + -2 * y) / (x + -1 * y))";
55.567 +val e233b = the (rewrite_set thy' "rational_erls" false rls' e233b');
55.568 +
55.569 +print("\n\nexample 234:\n");
55.570 +print("a)\n");
55.571 +val e234a'="((5 * a + b) / (2 * a * b + -2 * b^^^2)) + ((-3 * a + -1 * b) / (2 * a * b + 2 * b^^^2)) + ((-2 * a) / (a^^^2 + -1 * b^^^2))";
55.572 +val e234a = the (rewrite_set thy' "rational_erls" false rls' e234a');
55.573 +print("b)\n");
55.574 +val e234b'="((5 * a + 3 * b) / (6 * a * b + -18 * b^^^2)) + ((-3 * a + -3 * b) / (6 * a * b + 18 * b^^^2)) + ((-2 * a) / (a^^^2 + -9 * b^^^2)) ";
55.575 +val e234b = the (rewrite_set thy' "rational_erls" false rls' e234b');
55.576 +
55.577 +print("\n\nexample 235:\n");
55.578 +print("a)\n");
55.579 +val e235a'="((10 * x + 3 * y) / (12 * x * y + -18 * y^^^2)) + ((-6 * x + -3 * y) / (12 * x * y + 18 * y^^^2)) + ((-4 * x) / (4 * x^^^2 + -9 * y^^^2))";
55.580 +val e235a = the (rewrite_set thy' "rational_erls" false rls' e235a');
55.581 +print("b)\n");
55.582 +val e235b'="((8 * a + b) / (4 * a * b + -2 * b^^^2)) + ((-4 * a + -1 * b) / (4 * a * b + 2 * b^^^2)) + ((-2 * a) / (4 * a^^^2 + -1 * b^^^2)) ";
55.583 +val e235b = the (rewrite_set thy' "rational_erls" false rls' e235b');
55.584 +
55.585 +print("\n\nexample 236:\n");
55.586 +print("a)\n");
55.587 +val e236a'="((8 * a + 5 * b) / (20 * a * b + -50 * b^^^2)) + ((-4 * a + -5 * b) / (20 * a * b + 50 * b^^^2)) + ((-2 * a) / (4 * a^^^2 + -25 * b^^^2))";
55.588 +val e236a = the (rewrite_set thy' "rational_erls" false rls' e236a');
55.589 +print("b)\n");
55.590 +val e236b'="((24 * x + y) / (6 * x * y + -2 * y^^^2)) + ((-18 * x + -1 * y) / (6 * x * y + 2 * y^^^2)) + ((-15 * x) / (9 * x^^^2 + -1 * y^^^2)) ";
55.591 +val e236b = the (rewrite_set thy' "rational_erls" false rls' e236b');
55.592 +
55.593 +print("\n\nexample heuberger:\n");
55.594 +val eheu'="(x^^^4 + x * y + x^^^3 * y + y^^^2) / (x + 5 * x^^^2 + y + 5 * x * y + x^^^2 * y^^^3 + x * y^^^4)";
55.595 +val eheu = the (rewrite_set thy' "rational_erls" false rls' eheu');
55.596 +
55.597 +print("\n\nexample stiefel:\n");
55.598 +val est1'="(7) / (-14) + (-2) / (4)";
55.599 +val est1 = the (rewrite_set thy' "rational_erls" false rls' est1');
55.600 +if est1 = ("(-1) / 1",[]) then ()
55.601 +else raise error "new behaviour in rationals.sml: est1'";
55.602 +-------------------------------------------------------------------------*)
55.603 +
55.604 +
55.605 +(*
55.606 + val t = (term_of o the o (parse thy))
55.607 + "(9 - x ^^^ 2) / (9 - 6 * x + x ^^^ 2)";
55.608 + val SOME (t',_) = factor_expanded_ thy t;
55.609 + term2str t';
55.610 +
55.611 + "((-3) - x) * ((-3) + x) / (((-3) + x) * ((-3) + x))"
55.612 + "(3 + x) * (3 - x) / ((3 - x) * (3 - x))"
55.613 +*)
55.614 +
55.615 +
55.616 +
55.617 +(*WN.28.8.02: tests for the 'reverse-rewrite' functions:
55.618 + these are defined in Rationals.ML and stored in
55.619 + the 'reverse-ruleset' cancel*)
55.620 +
55.621 +(*the term for which reverse rewriting is demonstrated*)
55.622 + val t = (term_of o the o (parse thy))
55.623 + "(9 - x ^^^ 2) / (9 + 6 * x + x ^^^ 2)";
55.624 + val Rrls {scr=Rfuns {init_state=ini,locate_rule=loc,
55.625 + next_rule=nex,normal_form=nor,...},...} = cancel;
55.626 +
55.627 +(*normal_form produces the result in ONE step*)
55.628 + val SOME (t',_) = nor t;
55.629 + term2str t';
55.630 +
55.631 +(*initialize the interpreter state used by the 'me'*)
55.632 + val (t,_,revsets,_) = ini t;
55.633 +
55.634 +(*find the rule 'r' to apply to term 't'*)
55.635 + val SOME r = nex revsets t;
55.636 + (*val r = Thm ("sym_#mult_2_3","6 = 2 * 3") : rule*)
55.637 +
55.638 +(*check, if the rule 'r' applied by the user to 't' belongs to the ruleset;
55.639 + if the rule is OK, the term resulting from applying the rule is returned,too;
55.640 + there might be several rule applications inbetween,
55.641 + which are listed after the thead in reverse order*)
55.642 + val (r,(t,asm))::_ = loc revsets t r;
55.643 + term2str t;
55.644 + "(9 - x ^^^ 2) / (3 ^^^ 2 + 6 * x + x ^^^ 2)";
55.645 +
55.646 +(*find the next rule to apply*)
55.647 + val SOME r = nex revsets t;
55.648 + (*val r = Thm ("sym_#power_3_2","9 = 3 ^^^ 2") : rule*)
55.649 +
55.650 +(*check the next rule*)
55.651 + val (r,(t,asm))::_ = loc revsets t r;
55.652 + term2str t;
55.653 + "(3 ^^^ 2 - x ^^^ 2) / (3 ^^^ 2 + 6 * x + x ^^^ 2)";
55.654 +
55.655 +(*find and check the next rules, rewrite*)
55.656 + val SOME r = nex revsets t;
55.657 + val (r,(t,asm))::_ = loc revsets t r;
55.658 + term2str t;
55.659 + "(3 ^^^ 2 - x ^^^ 2) / (3 ^^^ 2 + 2 * 3 * x + x ^^^ 2)";
55.660 +
55.661 + val SOME r = nex revsets t;
55.662 + val (r,(t,asm))::_ = loc revsets t r;
55.663 + term2str t;
55.664 + "(3 - x) * (3 + x) / (3 ^^^ 2 + 2 * 3 * x + x ^^^ 2)";
55.665 +
55.666 + val SOME r = nex revsets t;
55.667 + val (r,(t,asm))::_ = loc revsets t r;
55.668 + term2str t;
55.669 + "(3 - x) * (3 + x) / ((3 + x) * (3 + x))";
55.670 +
55.671 + val SOME r = nex revsets t;
55.672 + val (r,(t,asm))::_ = loc revsets t r;
55.673 + val ss = term2str t;
55.674 + if ss = "(3 - x) / (3 + x)" then ()
55.675 + else raise error "rational.sml: new behav. in rev-set cancel";
55.676 + terms2str asm;
55.677 +
55.678 +
55.679 +
55.680 +(*WN.11.9.02: the 'reverse-ruleset' cancel*)
55.681 +
55.682 + (*the term for which reverse rewriting is demonstrated*)
55.683 + val t = (term_of o the o (parse thy))
55.684 + "(9 + (-1)*x^^^2) / (9 + ((-6)*x + x^^^2))";
55.685 + val Rrls {scr=Rfuns {init_state=ini,locate_rule=loc,
55.686 + next_rule=nex,normal_form=nor,...},...} = cancel;
55.687 + (*normal_form produces the result in ONE step*)
55.688 + val SOME (t',_) = nor t;
55.689 + term2str t';
55.690 + (*initialize the interpreter state used by the 'me'*)
55.691 + val (t,_,revsets,_) = ini t;
55.692 +(*
55.693 + val [rs] = revsets;
55.694 + filter_out (eq_Thms ["sym_real_add_zero_left",
55.695 + "sym_real_mult_0",
55.696 + "sym_real_mult_1"]) rs;
55.697 +
55.698 + 10.10.02: dieser Fall terminiert nicht (make_poly enth"alt zu viele rules)
55.699 + val SOME r = nex revsets t;
55.700 + val (r,(t,asm))::_ = loc revsets t r;
55.701 + term2str t;
55.702 +
55.703 + val SOME r = nex revsets t;
55.704 + val (r,(t,asm))::_ = loc revsets t r;
55.705 + term2str t;
55.706 +
55.707 + ------ revset ----------------------------------------------------
55.708 +/// [Thm ("sym_real_add_zero_left","?z = 0 + ?z"),
55.709 +/// Thm ("sym_real_mult_0","0 = 0 * ?z"),
55.710 +! Thm ("sym_#mult_2_(-3)","(-6) * x = 2 * ((-3) * x)"),
55.711 +! Thm ("sym_#add_(-3)_3","0 = (-3) + 3"),
55.712 +
55.713 +? Thm ("sym_real_num_collect_assoc",
55.714 + "[| ?l is_const; ?m is_const |]
55.715 + ==> (?l + ?m) * ?n + ?k = ?l * ?n + (?m * ?n + ?k)"),
55.716 +OK Thm ("sym_real_mult_2_assoc","2 * ?z1.0 + ?k = ?z1.0 + (?z1.0 + ?k)"),
55.717 +OK Thm ("sym_real_add_left_commute","?y + (?x + ?z) = ?x + (?y + ?z)"),
55.718 +/// Thm ("sym_real_mult_1","?z = 1 * ?z"),
55.719 +! Thm ("sym_#power_3_2","9 = 3 ^^^ 2"),
55.720 +! Thm ("sym_#mult_-1_-1","1 * x ^^^ 2 = -1 * (-1 * x ^^^ 2)"),
55.721 +! Thm ("sym_#mult_-1_3","(-3) * x = -1 * (3 * x)"),
55.722 +OK Thm ("realpow_twoI","?r1 ^^^ 2 = ?r1 * ?r1" [.]),
55.723 +OK Thm ("sym_real_add_assoc",
55.724 + "?z1.0 + (?z2.0 + ?z3.0) = ?z1.0 + ?z2.0 + ?z3.0"),
55.725 +OK Thm
55.726 + ("sym_real_mult_assoc","?z1.0 * (?z2.0 * ?z3.0) = ?z1.0 * ?z2.0 * ?z3.0"),
55.727 +OK Thm ("sym_real_mult_left_commute",
55.728 + "?z2.0 * (?z1.0 * ?z3.0) = ?z1.0 * (?z2.0 * ?z3.0)"),
55.729 +OK Thm ("sym_real_mult_commute","?w * ?z = ?z * ?w"),
55.730 +? Thm ("sym_real_add_mult_distrib2",
55.731 + "?w * ?z1.0 + ?w * ?z2.0 = ?w * (?z1.0 + ?z2.0)"),
55.732 +? Thm ("sym_real_add_mult_distrib",
55.733 + "?z1.0 * ?w + ?z2.0 * ?w = (?z1.0 + ?z2.0) * ?w"),
55.734 +OK Thm ("real_mult_div_cancel2","?k ~= 0 ==> ?m * ?k / (?n * ?k) = ?m / ?n")]
55.735 + -------- revset ----------------------------------------------------
55.736 +
55.737 + val t = (term_of o the o (parse thy)) "(-6) * x";
55.738 + val t = (term_of o the o (parse thy))
55.739 + "(9 + (-1)*x^^^2) / (9 + ((-6)*x + x^^^2))";
55.740 + val thm = (mk_thm thy "(-6) * x = 2 * ((-3) * x)")
55.741 + handle e => print_exn e;
55.742 + val SOME (t',_) = rewrite_ thy e_rew_ord e_rls false thm t;
55.743 + term2str t';
55.744 +----------------------------------------------------------------------*)
55.745 +
55.746 +
55.747 +
55.748 +(* SK: Testbeispiele --- WN kopiert Rational.ML -> rational.sml-----
55.749 +
55.750 +val t1 = (term_of o the o (parse thy)) "((3 * x^^^2 + 6 *x + 3) / (2*x + 2))";
55.751 +val SOME (t1',rest)= cancel_ thy t1;
55.752 +val SOME (t1'',_)= factor_out_gcd_ thy t1;
55.753 +print(term2str t1'^" + Einschr\"ankung: "^term2str (hd(rest)));
55.754 +term2str t1'';
55.755 +
55.756 +val t1 = (term_of o the o (parse thy)) "((-3 * x^^^2 + 6 *x - 3) / (2*x - 2))";
55.757 +val SOME (t1',_)= cancel_ thy t1;
55.758 +val SOME (t1'',_)= factor_expanded_ thy t1;
55.759 +term2str t1';
55.760 +term2str t1'';
55.761 +
55.762 +val t2 = (term_of o the o (parse thy)) "((x+ (-1)) / (x + 1)) + ((x + 1) / (x + (-1)))";
55.763 +val SOME (t2',_) = add_fractions_ thy t2;
55.764 +val SOME (t2'',_) = common_nominators_ thy t2;
55.765 +term2str t2';
55.766 +term2str t2'';
55.767 +
55.768 +val t2 = (term_of o the o (parse thy)) "((x - 1) / (x + 1)) + ((x + 1) / (x - 1))";
55.769 +val SOME (t2',_) = add_expanded_frac_ thy t2;
55.770 +val SOME (t2'',_) = common_expanded_nom_ thy t2;
55.771 +term2str t2';
55.772 +term2str t2'';
55.773 +
55.774 +
55.775 +val t3 = (term_of o the o (parse thy)) "((1) / (2*x + 2)) + ((1) / (2*x + (-2))) + ((1) / ( x^^^2 + (-1)))+((1) / (x^^^2 + (-2)*x + 1))";
55.776 +val SOME (t3',_) = common_nominators_ thy t3;
55.777 +val SOME (t3'',_) = add_fractions_ thy t3;
55.778 +(term2str t3');
55.779 +(term2str t3'');
55.780 +
55.781 +val t3 = (term_of o the o (parse thy)) "((1) / (2*x + 2)) + ((1) / (2*x - 2)) + ((1) / ( x^^^2 - 1))+((1) / (x^^^2 - 2 * x + 1))";
55.782 +val SOME (t3',_) = common_expanded_nom_ thy t3;
55.783 +val SOME (t3'',_) = add_expanded_frac_ thy t3;
55.784 +(term2str t3');
55.785 +(term2str t3'');
55.786 +-------------------------------*)
55.787 +
55.788 +(*
55.789 +val SOME(t4,t5) = norm_rational_ thy t3;
55.790 +term2str t4;
55.791 +term2str (hd(t5));*)
55.792 +
55.793 +(*val test1 = (term_of o the o (parse thy)) "1 - x^^^2 - 5 * x^^^5";
55.794 +val test2 = (term_of o the o (parse thy)) "1 + (-1) * x ^^^ 2 + (-5) * x ^^^ 5";
55.795 +val test2 = (term_of o the o (parse thy)) "1 - x";
55.796 +val test2 = (term_of o the o (parse thy)) "1 + (-1) * x";
55.797 +term2str(expanded2term(test1));
55.798 +term2str(term2expanded(test2)); *)
55.799 +
55.800 +
55.801 +
55.802 +(* WN kopiert 16.10.02 Rational.ML -> rational.sml-----vvv---*)
55.803 +
55.804 + val t=(term_of o the o (parse thy)) "(9 - x^^^2)/(9 - 6*x + x^^^2)";
55.805 + val SOME (t',_) = factout_ thy t;
55.806 + val SOME (t'',_) = cancel_ thy t;
55.807 + term2str t';
55.808 + term2str t'';
55.809 + "(3 + x) * (3 - x) / ((3 - x) * (3 - x))";
55.810 + "(3 + x) / (3 - x)";
55.811 +
55.812 + val t=(term_of o the o(parse thy))
55.813 + "(9 - x^^^2) / (9 - 6*x + x^^^2) + 1 / (3 - x)";
55.814 + val SOME (t',_) = common_nominator_ thy t;
55.815 + val SOME (t'',_) = add_fraction_ thy t;
55.816 + term2str t';
55.817 + term2str t'';
55.818 + "(9 - x ^^^ 2) / ((3 - x) * (3 - x)) + 1 * (3 - x) / ((3 - x) * (3 - x))";
55.819 + "(4 + x) / (3 - x)";
55.820 +
55.821 + (*WN.16.10.02 hinzugef"ugt -----vv---*)
55.822 + val t=(term_of o the o(parse thy))
55.823 + "(9 - x^^^2) / (9 - 6*x + x^^^2) + 1";
55.824 + val SOME (t',_) = common_nominator_ thy t;
55.825 + val SOME (t'',_) = add_fraction_ thy t;
55.826 + term2str t';
55.827 + term2str t'';
55.828 + "(9 - x ^^^ 2) / (9 - 6 * x + x ^^^ 2) +\
55.829 + \1 * (9 - 6 * x + x ^^^ 2) / (9 - 6 * x + x ^^^ 2)";
55.830 + "6 / (3 - x)";
55.831 +
55.832 + val t=(term_of o the o(parse thy))
55.833 + "1 + (9 - x^^^2) / (9 - 6*x + x^^^2)";
55.834 + val SOME (t',_) = common_nominator_ thy t;
55.835 + val SOME (t'',_) = add_fraction_ thy t;
55.836 + term2str t';
55.837 + term2str t'';
55.838 + "1 * (9 - 6 * x + x ^^^ 2) / (9 - 6 * x + x ^^^ 2) +\
55.839 + \(9 - x ^^^ 2) / (9 - 6 * x + x ^^^ 2)";
55.840 + "6 / (3 - x)";
55.841 + (*WN.16.10.02 hinzugef"ugt -----^^---*)
55.842 +
55.843 + val t=(term_of o the o (parse thy))
55.844 + "(y^^^2 - x^^^2)/(y^^^2 - 2*y*x + x^^^2)";
55.845 + val SOME (t',_) = factout_ thy t;
55.846 + val SOME (t'',_) = cancel_ thy t;
55.847 + term2str t';
55.848 + term2str t'';
55.849 + "(y + x) * (y - x) / ((y - x) * (y - x))";
55.850 + "(y + x) / (y - x)";
55.851 +
55.852 + val t=(term_of o the o (parse thy))
55.853 + "(y^^^2 - x^^^2)/(y^^^2 - 2*y*x + x^^^2) + 1 / (y - x)";
55.854 + val SOME (t',_) = common_nominator_ thy t;
55.855 + val SOME (t'',_) = add_fraction_ thy t;
55.856 + term2str t';
55.857 + term2str t'';
55.858 + "((-1) * x ^^^ 2 + y ^^^ 2) / (((-1) * x + y) * ((-1) * x + y)) +\
55.859 + \1 * ((-1) * x + y) / (((-1) * x + y) * ((-1) * x + y))";
55.860 + "((-1) - x - y) / (x - y)";
55.861 + (*WN.16.10.02 ^^^^^^^ Reihenfolge aus Angabe umgekehrt ?!*)
55.862 +
55.863 + val t=(term_of o the o (parse thy))
55.864 + "(x^^^2 - y^^^2)/(x^^^2 - 2*x*y + y^^^2) + 1 / (x - y)";
55.865 + val SOME (t',_) = common_nominator_ thy t;
55.866 + val SOME (t'',_) = add_fraction_ thy t;
55.867 + term2str t';
55.868 + term2str t'';
55.869 + "((-1) * y ^^^ 2 + x ^^^ 2) / (((-1) * y + x) * ((-1) * y + x)) +\
55.870 + \1 * ((-1) * y + x) / (((-1) * y + x) * ((-1) * y + x))";
55.871 + "((-1) - y - x) / (y - x)";
55.872 + (*WN.16.10.02 ^^^^^^^ lexicographische Ordnung ?!*)
55.873 +
55.874 + val t=(term_of o the o (parse thy))
55.875 + "(y^^^2 - x^^^2)/(y^^^2 - 2*y*x + x^^^2)";
55.876 + val SOME (t',_) = norm_expanded_rat_ thy t;
55.877 + term2str t';
55.878 + "(y + x) / (y - x)";
55.879 +(*val SOME (t'',_) = norm_rational_ thy t;
55.880 + term2str t'';
55.881 + *** RATIONALS_TERM2POLY_EXCEPTION: Invalid Polynomial
55.882 + WN.16.10.02 ?!*)
55.883 +
55.884 + val t=(term_of o the o (parse thy))
55.885 + "(9 - x^^^2)/(9 - 6*x + x^^^2) + (1)/(3 + x)";
55.886 + val SOME (t',_) = norm_expanded_rat_ thy t;
55.887 + term2str t';
55.888 + "(12 + 5 * x + x ^^^ 2) / (9 - x ^^^ 2)";
55.889 +(*val SOME (t'',_) = norm_rational_ thy t;
55.890 + term2str t'';
55.891 + *** RATIONALS_TERM2POLY_EXCEPTION: Invalid Polynomial
55.892 + WN.16.10.02 ?!*)
55.893 +
55.894 + val t=(term_of o the o (parse thy))
55.895 + "(9 + (-1)* x^^^2)/(9 + (-1)* 6*x + x^^^2) + (1)/(3 + x)";
55.896 + val SOME (t',_) = norm_expanded_rat_ thy t;
55.897 + val SOME (t'',_) = norm_rational_ thy t;
55.898 + term2str t';
55.899 + term2str t'';
55.900 + "(12 + 5 * x + x ^^^ 2) / (9 - x ^^^ 2)";
55.901 + "(12 + 5 * x + x ^^^ 2) / (9 + (-1) * x ^^^ 2)";
55.902 +(* WN kopiert 16.10.02 Rational.ML -> rational.sml-----^^^---*)
55.903 +
55.904 +
55.905 +
56.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
56.2 +++ b/test/Tools/isac/Knowledge/rational.sml Mon Aug 30 14:35:51 2010 +0200
56.3 @@ -0,0 +1,2023 @@
56.4 +(*.tests for rationals
56.5 + author: Stefan Karnel
56.6 + Copyright (c) Stefan Karnel 2002
56.7 + Use is subject to license terms.
56.8 +
56.9 +use"../smltest/IsacKnowledge/rational.sml";
56.10 +use"rational.sml";
56.11 +
56.12 +LEGEND WN070906
56.13 + nonterm.SK marks non-terminating examples
56.14 + ord.SK PARTIALLY marks crucial ordering examples
56.15 + *SK* of some (secondary) interest (on 070906)
56.16 +****************************************************************.*)
56.17 +
56.18 +(******************************************************************
56.19 +WN060104 transfer marked (*SR..*)examples to the exp-collection
56.20 + # exp_IsacCore_Simp_Rat_Cancel.xml from rational.sml (*SRC*) 10 exp
56.21 + # exp_IsacCore_Simp_Rat_Add.xml from rational.sml (*SRA*) 11 exp
56.22 + # exp_IsacCore_Simp_Rat_Mult.xml from rational.sml (*SRM*) 5 exp
56.23 + # exp_IsacCore_Simp_Rat_AddMult.xml from rational.sml (*SRAM*) 11 exp
56.24 + # exp_IsacCore_Simp_Rat_Double.xml from rational.sml (*SRD*) 12 exp
56.25 +*******************************************************************)
56.26 +"-----------------------------------------------------------------";
56.27 +"table of contents -----------------------------------------------";
56.28 +"-----------------------------------------------------------------";
56.29 +"~~~~~BEGIN: decomment structure RationalI : RATIONALI ~~~~~~~~~~~";
56.30 +"-------- ... missing WN060103 -----------------------------------";
56.31 +"-------- fun monom2term, fun poly2term' ------------------------";
56.32 +"~~~~~END: decomment structure RationalI : RATIONALI ~~~~~~~~~~~~~";
56.33 +"-------- cancel from: Mathematik 1 Schalk Reniets Verlag --------";
56.34 +"-------- common_nominator_p ---------------------------- --------";
56.35 +"-------- reverse rewrite ----------------------------------------";
56.36 +"-------- 'reverse-ruleset' cancel_p -----------------------------";
56.37 +"-------- norm_Rational ------------------------------------------";
56.38 +"-------- numeral rationals --------------------------------------";
56.39 +"-------- cancellation -------------------------------------------";
56.40 +"-------- common denominator -------------------------------------";
56.41 +"-------- multiply and cancel ------------------------------------";
56.42 +"-------- common denominator and multiplication ------------------";
56.43 +"-------- double fractions ---------------------------------------";
56.44 +"-------- me Schalk I No.186 -------------------------------------";
56.45 +"-------- interSteps ..Simp_Rat_Double_No-1.xml ------------------";
56.46 +"-------- interSteps ..Simp_Rat_Cancel_No-1.xml ------------------";
56.47 +"-------- investigate rulesets for cancel_p ----------------------";
56.48 +"-------- investigate format of factout_ and factout_p_ ----------";
56.49 +"-----------------------------------------------------------------";
56.50 +"-----------------------------------------------------------------";
56.51 +"-----------------------------------------------------------------";
56.52 +
56.53 +
56.54 +"~~~~~BEGIN: decomment structure RationalI : RATIONALI ~~~~~~~~~~~";
56.55 +(*.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
56.56 + tests of internal functions: to make them work,
56.57 + out-comment (*!!!*) in knowledge/Rational.ML:
56.58 +(*##!!!
56.59 +structure RationalI : RATIONALI =
56.60 +struct
56.61 +!!!##*)
56.62 +
56.63 +(*##!!!
56.64 +end;(*struct*)
56.65 +open RationalI;
56.66 +!!!##*)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.*)
56.67 +
56.68 +(*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
56.69 +print("\n\n********************* rational.sml - TESTS *************************\n\n");
56.70 +print("\n\n***** divide tests *****\n");
56.71 +val mv_pquot1 = (#1(mv_division([(1,[1,1,1]),(1,[1,1,0]),(1,[1,0,1]),(1,[0,0,0])],[(1,[1,1,0]),(1,[0,0,0])],LEX_)));
56.72 +(* result: [(1,[0,0,1]),(1,[0,0,0])] *)
56.73 +if mv_pquot1=[(1,[0,0,1]),(1,[0,0,0])] then () else raise error ("rational.sml: example failed");
56.74 +
56.75 +val mv_prest1 = (#2(mv_division([(1,[1,1,1]),(1,[1,1,0]),(1,[1,0,1]),(1,[0,0,0])],[(1,[1,1,0]),(1,[0,0,0])],LEX_)));
56.76 +(* result: [(1,[1,0,1]),(~1,[0,0,1])] *)
56.77 +if mv_prest1=[(1,[1,0,1]),(~1,[0,0,1])] then () else raise error ("rational.sml: example failed");
56.78 +
56.79 +val mv_pquot2 = (#1(mv_division([(4,[2]),(8,[1]),(16,[0])],[(1,[1]),(1,[0])],LEX_)));
56.80 +(* result: [(4,[1]),(4,[0])] *)
56.81 +if mv_pquot2=[(4,[1]),(4,[0])] then () else raise error ("rational.sml: example failed");
56.82 +
56.83 +val mv_prest2 = (#2(mv_division([(4,[2]),(8,[1]),(16,[0])],[(1,[1]),(1,[0])],LEX_)));
56.84 +(* result: [(12,[0]] *)
56.85 +if mv_prest2=[(12,[0])] then () else raise error ("rational.sml: example failed");
56.86 +
56.87 +val mv_pquot3 = (#1(mv_division([(4,[2]),(~4,[0])],[(2,[1]),(2,[0])],LEX_)));
56.88 +(* [(2,[1]),(~2,[0])] *)
56.89 +if mv_pquot3=[(2,[1]),(~2,[0])] then () else raise error ("rational.sml: example failed");
56.90 +
56.91 +val mv_prest3 = (#2(mv_division([(1,[2]),(~1,[0])],[(2,[1]),(2,[0])],LEX_)));
56.92 +(* [(1,[2]),(~1,[0])] *)
56.93 +if mv_prest3=[(1,[2]),(~1,[0])] then () else raise error ("rational.sml: example failed");
56.94 +
56.95 +val mv_pquot4 = (#1(mv_division([(3,[1,1,1]),(4,[1,0,1]),(3,[0,0,1])],[(2,[1,0,0]),(4,[0,0,1])],LEX_)));
56.96 +(* [(1,[0,1,1])] *)
56.97 +if mv_pquot4=[(1,[0,1,1])] then () else raise error ("rational.sml: example failed");
56.98 +
56.99 +val mv_prest4 = (#2(mv_division([(3,[1,1,1]),(4,[1,0,1]),(3,[0,0,1])],[(2,[1,0,0]),(4,[0,0,1])],GGO_)));
56.100 +(* [(1,[1,1,1]),(~4,[0,1,2]),(4,[1,0,1]),(3,[0,0,1])] *)
56.101 +if mv_prest4 =[(1,[1,1,1]),(~4,[0,1,2]),(4,[1,0,1]),(3,[0,0,1])] then () else raise error ("rational.sml: example failed");
56.102 +
56.103 +val mv_pquot5 = (#1(mv_division([(3,[1,1,1]),(4,[1,0,1]),(3,[0,0,1]),(6,[2,1,3]),(4,[0,4,1]),(1,[2,2,1])],[(1,[0,0,1])],LEX_)));
56.104 +(* [(1,[2,2,0]),(6,[2,1,2]),(3,[1,1,0]),(4,[1,0,0]),(4,[0,4,0]),(3,[0,0,0])]*)
56.105 +if mv_pquot5=[(1,[2,2,0]),(6,[2,1,2]),(3,[1,1,0]),(4,[1,0,0]),(4,[0,4,0]),(3,[0,0,0])] then () else raise error ("rational.sml: example failed");
56.106 +
56.107 +val mv_prest5 = (#2(mv_division([(3,[1,1,1]),(4,[1,0,1]),(3,[0,0,1]),(6,[2,1,3]),(4,[0,4,1]),(1,[2,2,1])],[(1,[0,0,1])],LEX_)));
56.108 +(* [] *)
56.109 +if mv_prest5=[] then () else raise error ("rational.sml: example failed");
56.110 +
56.111 +(* (x^2 + 2(a+1)x + (a^2+2a+1)) / (x+a+1) = x+a+1 *)
56.112 +val mv_pquot6 = (#1(mv_division([(1,[2,0,0]),(2,[1,1,0]),(2,[1,0,0]),(1,[0,2,0]),(2,[0,1,0]),(1,[0,0,0])],[(1,[1,0,0]),(1,[0,1,0]),(1,[0,0,0])],LEX_)));
56.113 +if mv_pquot6=[(1,[1,0,0]),(1,[0,1,0]),(1,[0,0,0])] then () else raise error ("rational.sml: example failed");
56.114 +
56.115 +val mv_prest6 = (#2(mv_division([(1,[2,0,0]),(2,[1,1,0]),(2,[1,0,0]),(1,[0,2,0]),(2,[0,1,0]),(1,[0,0,0])],[(1,[1,0,0]),(1,[0,1,0]),(1,[0,0,0])],LEX_)));
56.116 +if mv_prest6=[] then () else raise error ("rational.sml: example failed");
56.117 +
56.118 +
56.119 +print("\n\n***** MV_CONTENT-TESTS *****\n");
56.120 +val mv_cont1=mv_content([(1,[2,1]),(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,1]),(1,[0,0])]);
56.121 +(* [(1,[0,1]),(1,[0,0])] *)
56.122 +if mv_cont1=[(1,[0,1]),(1,[0,0])] then () else raise error ("rational.sml: example failed");
56.123 +
56.124 +val mv_pp1=mv_pp([(1,[1,1]),(1,[1,0]),(1,[0,1]),(1,[0,0])]);
56.125 +(*[(1,[1,0]),(1,[0,0])]*)
56.126 +if mv_pp1=[(1,[1,0]),(1,[0,0])] then () else raise error ("rational.sml: example failed");
56.127 +
56.128 +val mv_cont2=mv_content([(2,[1]),(4,[0])]);
56.129 +(* [(2,[0])] *)
56.130 +if mv_cont2=[(2,[0])] then () else raise error ("rational.sml: example failed");
56.131 +
56.132 +val mv_pp2=mv_pp([(2,[1]),(4,[0])]);
56.133 +(* [(1,[1]),(2,[0])] *)
56.134 +if mv_pp2=[(1,[1]),(2,[0])] then () else raise error ("rational.sml: example failed");
56.135 +
56.136 +val mv_cont3=mv_content[(8,[2,1,1]),(12,[1,0,2]),(10,[2,2,0]),(16,[1,1,1])];
56.137 +(* [(2,[0,0,0])] *)
56.138 +if mv_cont3=[(2,[0,0,0])] then () else raise error ("rational.sml: example failed");
56.139 +
56.140 +val mv_pp3=mv_pp[(8,[2,1,1]),(12,[1,0,2]),(10,[2,2,0]),(16,[1,1,1])];
56.141 +(* [(5,[2,2,0]),(4,[2,1,1]),(8,[1,1,1]),(6,[1,0,2])] *)
56.142 +if mv_pp3=[(5,[2,2,0]),(4,[2,1,1]),(8,[1,1,1]),(6,[1,0,2])] then () else raise error ("rational.sml: example failed");
56.143 +
56.144 +val mv_cont4=mv_content[(2,[2,1,0]),(3,[1,0,1]),(2,[1,1,0]),(3,[0,0,1])];
56.145 +(* [(1,[0,0,0])] *)
56.146 +if mv_cont4=[(1,[0,0,0])] then () else raise error ("rational.sml: example failed");
56.147 +
56.148 +val mv_pp4=mv_pp [(2,[2,1,0]),(3,[1,0,1]),(2,[1,1,0]),(3,[0,0,1])];
56.149 +(* [(2,[2,1,0]),(2,[1,1,0]),(3,[1,0,1]),(3,[0,0,1])] *)
56.150 +if mv_pp4=[(2,[2,1,0]),(2,[1,1,0]),(3,[1,0,1]),(3,[0,0,1])] then () else raise error ("rational.sml: example failed");
56.151 +
56.152 +val con1=mv_content([(9,[2,0]),(15,[1,1]),(12,[1,0]),(6,[0,2]),(12,[0,1])]);
56.153 +(* [(3,[0,0])] *)
56.154 +if con1=[(3,[0,0])] then () else raise error ("rational.sml: example failed");
56.155 +
56.156 +val pp1=mv_pp([(9,[2,0]),(15,[1,1]),(12,[1,0]),(6,[0,2]),(12,[0,1])]);
56.157 +(* [(3,[2,0]),(5,[1,1]),(4,[1,0]),(2,[0,2]),(4,[0,1])] *)
56.158 +if pp1=[(3,[2,0]),(5,[1,1]),(4,[1,0]),(2,[0,2]),(4,[0,1])] then () else raise error ("rational.sml: example failed");
56.159 +
56.160 +val con2=mv_content([(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,2]),(1,[0,1])]);
56.161 +(* [(1,[0,0])] *)
56.162 +if con2=[(1,[0,0])] then () else raise error ("rational.sml: example failed");
56.163 +
56.164 +val pp2 =mv_pp([(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,2]),(1,[0,1])]);
56.165 +(* [(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,2]),(1,[0,1])] *)
56.166 +if pp2=[(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,2]),(1,[0,1])] then () else raise error ("rational.sml: example failed");
56.167 +
56.168 +val cont1 = mv_content [(1,[2,1,0]),(2,[2,1,0])];
56.169 +(* [(3,[0,1,0])] *)
56.170 +if cont1=[(3,[0,1,0])] then () else raise error ("rational.sml: example failed");
56.171 +
56.172 +val pp1 = mv_pp [(1,[2,1,0]),(2,[2,1,0])];
56.173 +(* [(1,[2,0,0])] *)
56.174 +if pp1=[(1,[2,0,0])] then () else raise error ("rational.sml: example failed");
56.175 +
56.176 +val cont2 = mv_content [(4,[1,2,0]),(2,[2,1,0])];
56.177 +(* [(2,[0,1,0])] *)
56.178 +if cont2=[(2,[0,1,0])] then () else raise error ("rational.sml: example failed");
56.179 +
56.180 +val pp2 = mv_pp [(4,[1,2,0]),(2,[2,1,0])];
56.181 +(* [(1,[2,0,0]),(2,[1,1,0])] *)
56.182 +if pp2=[(1,[2,0,0]),(2,[1,1,0])] then () else raise error ("rational.sml: example failed");
56.183 +
56.184 +print("\n\n\n\n********************************************************\n\n");
56.185 +val cont3=mv_content [(65,[3,2,2]),(52,[3,2,1]),(26,[3,1,2]),(~95,[2,2,3]),(~76,[2,2,2]),(35,[2,2,1]),(28,[2,2,0]),(~38,[2,1,3]),(14,[2,1,1])];
56.186 +if cont3=[(5,[0,2,1]),(4,[0,2,0]),(2,[0,1,1])] then () else raise error ("rational.sml: example failed");
56.187 +val pp3=mv_pp [(65,[3,2,2]),(52,[3,2,1]),(26,[3,1,2]),(~95,[2,2,3]),(~76,[2,2,2]),(35,[2,2,1]),(28,[2,2,0]),(~38,[2,1,3]),(14,[2,1,1])];
56.188 +
56.189 +
56.190 +"-------- fun monom2term, fun poly2term' ------------------------";
56.191 +"-------- fun monom2term, fun poly2term' ------------------------";
56.192 +"-------- fun monom2term, fun poly2term' ------------------------";
56.193 +val t = monom2term ((3,[2,1,0]), ["c","b","a"](*reverse ???SK-*));
56.194 +term2str t = "3 * (c ^^^ 2 * b)" (*true*);
56.195 +
56.196 +val t = monom2term ((1,[1,0]), ["b","a"]);
56.197 +term2str t = "b" (*true*);
56.198 +
56.199 +val t = poly2term ([(1,[0,0,0]),(2,[1,0,0]),(3,[2,1,0]),(4,[3,2,1])],
56.200 + ["c","b","a"]);
56.201 +term2str t = "1 + 2 * c + 3 * (c ^^^ 2 * b) + 4 * (c ^^^ 3 * (b ^^^ 2 * a))";
56.202 +
56.203 +val t = poly2term ([(1,[1,0]),(1,[0,1])], ["b","a"]);
56.204 +term2str t = "a + b" (*true*);
56.205 +
56.206 +
56.207 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*)
56.208 +"~~~~~END: decomment structure RationalI : RATIONALI ~~~~~~~~~~~~~";
56.209 +"~~~~~END: decomment structure RationalI : RATIONALI ~~~~~~~~~~~~~";
56.210 +"~~~~~END: decomment structure RationalI : RATIONALI ~~~~~~~~~~~~~";
56.211 +
56.212 +
56.213 +fun parse_rat str = (term_of o the o (parse thy)) str;
56.214 +
56.215 +print("\n\n***** mv_gcd-tests *****\n");
56.216 +val ggt1 = mv_gcd [(4,[2,2]),(8,[1,1]),(4,[0,0])] [(2,[1,1]),(2,[0,0])];
56.217 +(* [(2,[1,1]),(2,[0,0])] *)
56.218 +if ggt1=[(2,[1,1]),(2,[0,0])] then () else raise error ("rational.sml: example failed");
56.219 +
56.220 +val ggt2 = mv_gcd [(8,[2,1,1]),(12,[1,0,2]),(10,[2,2,0]),(15,[1,1,1])] [(2,[2,1,0]),(3,[1,0,1]),(2,[1,1,0]),(3,[0,0,1])];
56.221 +(* [(2,[1,1,0]),(3,[0,0,1])] *)
56.222 +if ggt2=[(2,[1,1,0]),(3,[0,0,1])] then () else raise error ("rational.sml: example failed");
56.223 +
56.224 +
56.225 +val ggt3 = mv_gcd [(1,[2,0]),(~2,[1,1]),(1,[0,2])] [(1,[1,0]),(~1,[0,1])];
56.226 +(* [(1,[1,0]),(~1,[0,1])] *)
56.227 +if ggt3=[(1,[1,0]),(~1,[0,1])] then () else raise error ("rational.sml: example failed");
56.228 +
56.229 +
56.230 +val ggt4 = mv_gcd [(1,[2,1,0]),(2,[2,1,0])] [(5,[1,0,0])];
56.231 +(* [(1,[1,0,0])] *)
56.232 +if ggt4=[(1,[1,0,0])] then () else raise error ("rational.sml: example failed");
56.233 +
56.234 +
56.235 +val ggt5 = mv_gcd [(4,[2,0]),(~8,[1,1]),(4,[0,2])] [(1,[2,0]),(~1,[0,2])];
56.236 +(* [(1,[1,0]),(~1,[0,1])] *)
56.237 +if ggt5=[(1,[1,0]),(~1,[0,1])] then () else raise error ("rational.sml: example failed");
56.238 +
56.239 +
56.240 +val ggt6 = mv_gcd [(10,[2,1,1]),(14,[1,1,0]),(3,[1,0,1]),(20,[1,2,1])] [(5,[1,1,1]),(7,[2,1,1])];
56.241 +(* [(1,[0,0,0])] *)
56.242 +if ggt6=[(1,[1,0,0])] then () else raise error ("rational.sml: example failed");
56.243 +
56.244 +print("\n\n***** kgv-tests *****\n");
56.245 +val kgv1=mv_lcm [(10,[])] [(15,[])];
56.246 +(* [(30,[])] *)
56.247 +if kgv1=[(30,[])] then () else raise error ("rational.sml: example failed");
56.248 +
56.249 +val kgv2=mv_lcm [(1,[2,0]),(~2,[1,1]),(1,[0,2])] [(1,[1,0]),(~1,[0,1])];
56.250 +(* [(1,[2,0]),(~2,[1,1]),(1,[0,2])] *)
56.251 +if kgv2=[(1,[2,0]),(~2,[1,1]),(1,[0,2])] then () else raise error ("rational.sml: example failed");
56.252 +
56.253 +val kgv3=mv_lcm [(4,[2,0]),(~8,[1,1]),(4,[0,2])] [(1,[2,0]),(~1,[0,2])];
56.254 +(* [(4,[3,0]),(~4,[2,1]),(~4,[1,2]),(4,[0,3])] *)
56.255 +if kgv3=[(4,[3,0]),(~4,[2,1]),(~4,[1,2]),(4,[0,3])] then () else raise error ("rational.sml: example failed");
56.256 +
56.257 +(*!!!--------
56.258 +print("\n\n***** STEP_CANCEL_TESTS: *****\n");
56.259 +
56.260 +val term2 = (term_of o the o (parse thy)) " (9 * a^^^2 * b) / (6 * a * c)";
56.261 +val div2 = term2str (step_cancel term2);
56.262 +if div2 = "3 * (a * b) * (3 * a) / (2 * c * (3 * a))" then () else raise error ("rational.sml: example failed");
56.263 +
56.264 +
56.265 +val term1 = (term_of o the o (parse thy)) "(10 * a^^^2 * b * c + 14 * a * b + 3 * a * c + 20 * a * b^^^2 * c) / a";
56.266 +val div1 = term2str(step_cancel term1);
56.267 +if div1 = "(3 * c + 14 * b + 20 * (b ^^^ 2 * c) + 10 * (a * (b * c))) * a / (1 * a)" then () else raise error ("rational.sml: example failed");
56.268 +
56.269 +val term3 = (term_of o the o (parse thy)) "(10 * a^^^2 * b * c) / (1 * x * y * z) ";
56.270 +val div3 = term2str(step_cancel term3);
56.271 +if div3="10 * a ^^^ 2 * b * c / (1 * x * y * z)" then () else raise error ("rational.sml: example failed");
56.272 +
56.273 +--------------------------------------------------------------------------!!!*)
56.274 +
56.275 +(*-----versuche 13.3.03-----
56.276 + val t = str2term "1 - x^^^2 - 5 * x^^^5";
56.277 + val vs=(((map free2str) o vars) t);
56.278 + val SOME ml = expanded2poly t vs;
56.279 + poly2term (ml, vs);
56.280 + poly2term'(rev(sort (mv_geq LEX_) (ml)),vs);
56.281 + poly2term'([(~5,[5]),(~1,[2]),(1,[0])], vs);
56.282 + monom2term((~5,[5]),vs);
56.283 + monom2term((~1,[2]),vs);
56.284 + val t' = monom2term((1,[0]),vs);(*uncaught exception LIST*)
56.285 +
56.286 + val (i,is) = (~1,[2]);
56.287 + val ttt = Const ("op *", [HOLogic.realT,HOLogic.realT]---> HOLogic.realT) $
56.288 + (Const ("uminus", HOLogic.realT --> HOLogic.realT) $
56.289 + Free ((str_of_int o abs) i, HOLogic.realT)) $
56.290 + powerproduct2term(is, vs);
56.291 + term2str ttt;
56.292 +-------versuche 13.3.03-----*)
56.293 +
56.294 + val t = str2term "1 - x^^^2 - 5 * x^^^5";
56.295 + val SOME t' = expanded2polynomial t; term2str t';
56.296 +"1 + - 1 * x ^^^ 2 + - 5 * x ^^^ 5";
56.297 + val t = str2term "1 - x";
56.298 + val SOME t' = expanded2polynomial t; term2str t';
56.299 +"1 + - 1 * x";
56.300 + val t = str2term "1 + (-1) * x";
56.301 + val SOME t' = expanded2polynomial t; term2str t';
56.302 +"1 + - 1 * x";
56.303 + val t = (term_of o the o (parse thy)) "1 + (-1) * x ^^^ 2 + (-5) * x ^^^5";
56.304 + val SOME t' = polynomial2expanded t; term2str t';
56.305 +"1 - x ^^^ 2 - 5 * x ^^^ 5";
56.306 +
56.307 +
56.308 +" external calculating functions test ";
56.309 +" external calculating functions test ";
56.310 +" external calculating functions test ";
56.311 +
56.312 +val t1 = (term_of o the o (parse thy)) "((3 * x^^^2 + 6 *x + 3) / (2*x + 2))";
56.313 +val SOME (t1',asm)= factout_p_ thy t1;
56.314 +term2str t1'; terms2str asm;
56.315 +"(3 + 3 * x) * (1 + 1 * x) / (2 * (1 + 1 * x))";
56.316 +"[]";
56.317 +val SOME (t1',asm)= cancel_p_ thy t1;
56.318 +term2str t1'; terms2str asm;
56.319 +"(3 + 3 * x) / 2";
56.320 +"[\"1 + 1 * x ~= 0\"]";
56.321 +
56.322 +val t = (term_of o the o (parse thy)) "((-3 * x^^^2 + 6 *x - 3) / (2*x - 2))";
56.323 +val SOME (t',asm)= cancel_ thy t;
56.324 +term2str t'; terms2str asm;
56.325 +"(3 - 3 * x) / 2";
56.326 +"[\"-1 + x ~= 0\"]";
56.327 +val SOME (t',asm)= factout_ thy t;
56.328 +term2str t'; terms2str asm;
56.329 +"(3 - 3 * x) * (-1 + x) / (2 * (-1 + x))";
56.330 +"[]";
56.331 +
56.332 +val t = str2term "((x+ (-1)) / (x + 1)) + ((x + 1) / (x + (-1)))";
56.333 +val SOME (t',asm) = add_fraction_p_ thy t;
56.334 +term2str t'; terms2str asm;
56.335 +"(2 + 2 * x ^^^ 2) / (-1 + 1 * x ^^^ 2)";
56.336 +"[]";
56.337 +val SOME (t',asm) = common_nominator_p_ thy t;
56.338 +term2str t'; terms2str asm;
56.339 +"(-1 + 1 * x) * (-1 + 1 * x) / ((1 + 1 * x) * (-1 + 1 * x)) +\n(1 + 1 * x) * (1 + 1 * x) / ((1 + 1 * x) * (-1 + 1 * x))";
56.340 +"[]";
56.341 +
56.342 +val t = str2term "((x - 1) / (x + 1)) + ((x + 1) / (x - 1))";
56.343 +val SOME (t',asm) = add_fraction_ thy t;
56.344 +term2str t'; terms2str asm;
56.345 +"(2 + 2 * x ^^^ 2) / (-1 + x ^^^ 2)";
56.346 +"[]";
56.347 +val SOME (t',asm) = common_nominator_ thy t;
56.348 +term2str t'; terms2str asm;
56.349 +"(-1 + x) * (-1 + x) / ((1 + x) * (-1 + x)) +\n(1 + x) * (1 + x) / ((1 + x) * (-1 + x))";
56.350 +"[]";
56.351 +
56.352 +val t = str2term "((1) / (2*x + 2)) + ((1) / (2*x + (-2))) + ((1) / ( x^^^2 + (-1)))+((1) / (x^^^2 + (-2)*x + 1))";
56.353 +val SOME (t',asm) = common_nominator_p_ thy t;
56.354 +term2str t'; terms2str asm;
56.355 +"1 * (1 + -2 * x + 1 * x ^^^ 2) /\n((-1 + 1 * x) * (2 * ((-1 + 1 * x) * (1 + 1 * x)))) +\n(1 * (-1 + 1 * x ^^^ 2) /\n ((-1 + 1 * x) * (2 * ((-1 + 1 * x) * (1 + 1 * x)))) +\n (1 * (-2 + 2 * x) / ((-1 + 1 * x) * (2 * ((-1 + 1 * x) * (1 + 1 * x)))) +\n 1 * (#";
56.356 +"[]";
56.357 +val SOME (t',asm) = add_fraction_p_ thy t;
56.358 +term2str t'; terms2str asm;
56.359 +"1 * x / (1 + -2 * x + 1 * x ^^^ 2)";
56.360 +"[\"1 + 1 * x ~= 0\"]";
56.361 +val SOME(t',asm) = norm_rational_ thy t;
56.362 +term2str t'; terms2str asm;
56.363 +"1 * x / (1 + -2 * x + 1 * x ^^^ 2)";
56.364 +"[\"1 + 1 * x ~= 0\"]";
56.365 +
56.366 +val t3 = (term_of o the o (parse thy)) "((1) / (2*x + 2)) + ((1) / (2*x - 2)) + ((1) / ( x^^^2 - 1))+((1) / (x^^^2 - 2 * x + 1))";
56.367 +val SOME (t3',_) = common_nominator_ thy t3;
56.368 +val SOME (t3'',_) = add_fraction_ thy t3;
56.369 +(term2str t3');
56.370 +(term2str t3'');
56.371 +
56.372 +val SOME(t4,t5) = norm_expanded_rat_ thy t3;
56.373 +term2str t4;
56.374 +term2str (hd(t5));
56.375 +
56.376 +
56.377 +
56.378 + val t=(term_of o the o (parse thy)) "(9 - x^^^2)/(9 - 6*x + x^^^2)";
56.379 + val SOME (t',_) = factout_ thy t;
56.380 + val SOME (t'',_) = cancel_ thy t;
56.381 + term2str t';
56.382 + term2str t'';
56.383 + "(3 + x) * (3 - x) / ((3 - x) * (3 - x))";
56.384 + "(3 + x) / (3 - x)";
56.385 +
56.386 + val t=(term_of o the o (parse thy))
56.387 + "(9 - x^^^2) / (9 - 6*x + x^^^2) + 1 / (3 - x)";
56.388 + val SOME (t',_) = common_nominator_ thy t;
56.389 + val SOME (t'',_) = add_fraction_ thy t;
56.390 + term2str t';
56.391 + term2str t'';
56.392 + "(9 - x ^^^ 2) / ((3 - x) * (3 - x)) + 1 * (3 - x) / ((3 - x) * (3 - x))";
56.393 + "(4 + x) / (3 - x)";
56.394 +
56.395 +(*WN021016 added -----vv---*)
56.396 +val t = str2term "(9 - x^^^2) / (9 - 6*x + x^^^2) + 1";
56.397 +val SOME (t',_) = common_nominator_ thy t;
56.398 +val SOME (t'',_) = add_fraction_ thy t;
56.399 +term2str t' = "(9 - x ^^^ 2) / (9 - 6 * x + x ^^^ 2) +\n1\
56.400 + \ * (9 - 6 * x + x ^^^ 2) / (9 - 6 * x + x ^^^ 2)" (*true*);
56.401 +term2str t'' = "6 / (3 - x)" (*true*);
56.402 +
56.403 +val t = str2term "1 + (9 - x^^^2) / (9 - 6*x + x^^^2)";
56.404 +val SOME (t',_) = common_nominator_ thy t;
56.405 +val SOME (t'',_) = add_fraction_ thy t;
56.406 +term2str t' = "1 * (9 - 6 * x + x ^^^ 2) / (9 - 6 * x + x ^^^ 2) +\n\
56.407 + \(9 - x ^^^ 2) / (9 - 6 * x + x ^^^ 2)" (*true*);
56.408 +term2str t'' = "6 / (3 - x)" (*true*);
56.409 +(*WN021016 added -----^^---*)
56.410 +(*WN030602 added -----vv--- no rewrite -> NONE !*)
56.411 +val t = str2term "1 / a";
56.412 +val NONE = cancel_p_ thy t;
56.413 +val NONE = rewrite_set_ thy false cancel_p t;
56.414 +(*WN.2.6.03 added -------^^---*)
56.415 +
56.416 +val t = str2term "(y^^^2 - x^^^2)/(y^^^2 - 2*y*x + x^^^2)";
56.417 +val SOME (t',_) = factout_ thy t;
56.418 +val SOME (t'',_) = cancel_ thy t;
56.419 +term2str t' = "(y + x) * (y - x) / ((y - x) * (y - x))"(*true*);
56.420 +term2str t'' = "(y + x) / (y - x)";
56.421 +
56.422 +val t = str2term "(y^^^2 - x^^^2)/(y^^^2 - 2*y*x + x^^^2) + 1 / (y - x)";
56.423 +val SOME (t',_) = common_nominator_ thy t;
56.424 +val SOME (t'',_) = add_fraction_ thy t;
56.425 +term2str t' =
56.426 +"(-1 * x ^^^ 2 + y ^^^ 2) / ((-1 * x + y) * (-1 * x + y)) +\n1\
56.427 +\ * (-1 * x + y) / ((-1 * x + y) * (-1 * x + y))" (*true*);
56.428 +term2str t'' = "(-1 - x - y) / (x - y)" (*true*);
56.429 +
56.430 +val t = str2term "(x^^^2 - y^^^2)/(x^^^2 - 2*x*y + y^^^2) + 1 / (x - y)";
56.431 +val SOME (t',_) = common_nominator_ thy t;
56.432 +val SOME (t'',_) = add_fraction_ thy t;
56.433 +if term2str t' = "(-1 * y ^^^ 2 + x ^^^ 2) / ((-1 * y + x) * (-1 * y + x))\
56.434 +\ +\n1 * (-1 * y + x) / ((-1 * y + x) * (-1 * y + x))" then ()
56.435 +else raise error "rational.sml lex-ord 1";
56.436 +if term2str t'' = "(-1 - y - x) / (y - x)" then ()
56.437 +else raise error "rational.sml lex-ord 2";
56.438 +(*WN.16.10.02 WN070905 lexicographische Ordnung erhalten ! SK.ord*)
56.439 +
56.440 +
56.441 +val t = str2term "(x^^^2 - y^^^2)/(x^^^2 - 2*x*y + y^^^2)";
56.442 +val SOME (t',_) = norm_expanded_rat_ thy t;
56.443 +if term2str t' = "(x + y) / (x - y)" then ()
56.444 +else raise error "rational.sml term2poly: invalid x ^^^ 2 - y ^^^ 2 1";
56.445 +(*val SOME (t'',_) = norm_rational_ thy t;
56.446 + *** RATIONALS_TERM2POLY_EXCEPTION: Invalid Polynomial
56.447 +WN.16.10.02 ?! + WN060831???SK4
56.448 +WN070905 *** term2poly: invalid = x ^^^ 2 - y ^^^ 2*)
56.449 +
56.450 +
56.451 +val t = str2term "(9 - x^^^2)/(9 - 6*x + x^^^2) + (1)/(3 + x)";
56.452 +val SOME (t',_) = norm_expanded_rat_ thy t;
56.453 +if term2str t' = "(12 + 5 * x + x ^^^ 2) / (9 - x ^^^ 2)" then ()
56.454 +else raise error "rational.sml (9 - x^^^2)/(9 - 6*x + x^^^2) +...";
56.455 +(*val SOME (t'',_) = norm_rational_ thy t;
56.456 + *** RATIONALS_TERM2POLY_EXCEPTION: Invalid Polynomial WN.16.10.02 ?!
56.457 +WN070906 *** term2poly: invalid = 9 - x ^^^ 2 SK.term2poly*)
56.458 +
56.459 + val t=(term_of o the o (parse thy))
56.460 + "(9 + (-1)* x^^^2)/(9 + (-1)* 6*x + x^^^2) + (1)/(3 + x)";
56.461 + val SOME (t',_) = norm_expanded_rat_ thy t;
56.462 + val SOME (t'',_) = norm_rational_ thy t;
56.463 + term2str t';
56.464 + term2str t'';
56.465 + "(12 + 5 * x + x ^^^ 2) / (9 - x ^^^ 2)";
56.466 + "(12 + 5 * x + x ^^^ 2) / (9 + (-1) * x ^^^ 2)";
56.467 +
56.468 +
56.469 +" examples from: Mathematik 1 Schalk Reniets Verlag ";
56.470 +" examples from: Mathematik 1 Schalk Reniets Verlag ";
56.471 +" examples from: Mathematik 1 Schalk Reniets Verlag ";
56.472 +
56.473 +
56.474 +"-------- cancel from: Mathematik 1 Schalk Reniets Verlag --------";
56.475 +"-------- cancel from: Mathematik 1 Schalk Reniets Verlag --------";
56.476 +"-------- cancel from: Mathematik 1 Schalk Reniets Verlag --------";
56.477 +val thy' = "Rational.thy";
56.478 +val rls' = "cancel";
56.479 +val mp = "make_polynomial";
56.480 +
56.481 +print("\n\nexample 186:\n");
56.482 +print("a)\n");
56.483 +val e186a'="(14 * x * y) / ( x * y )";(*SRC*)
56.484 +val e186a = the (rewrite_set thy' false "cancel" e186a');
56.485 + is_expanded (parse_rat "14 * x * y");
56.486 + is_expanded (parse_rat "x * y");
56.487 +
56.488 +print("b)\n");
56.489 +val e186b'="(60 * a * b) / ( 15 * a * b )";
56.490 +val e186b = the (rewrite_set thy' false "cancel" e186b');
56.491 +print("c)\n");
56.492 +val e186c'="(144 * a^^^2 * b * c) / (12 * a * b * c )";
56.493 +val e186c = (the (rewrite_set thy' false "cancel" e186c'))
56.494 + handle e => print_exn e;
56.495 +val t = (term_of o the o (parse thy)) e186c';
56.496 +atomt t;
56.497 +
56.498 +print("\n\nexample 187:\n");
56.499 +print("a)\n");
56.500 +val e187a'="(12 * x * y) / (8 * y^^^2 )";(*SRC*)
56.501 +val e187a = the (rewrite_set thy' false "cancel" e187a');
56.502 +print("b)\n");
56.503 +val e187b'="(8 * x^^^2 * y * z ) / (18 * x * y^^^2 * z )";
56.504 +val e187b = the (rewrite_set thy' false "cancel" e187b');
56.505 +print("c)\n");
56.506 +val e187c'="(9 * x^^^5 * y^^^2 * z^^^4) / (15 * x^^^6 * y^^^3 * z )";(*SRC*)
56.507 +val e187c = the (rewrite_set thy' false "cancel" e187c');
56.508 +
56.509 +"example 188:";
56.510 +val e188a'="(-8 + 8 * x) / (-9 + 9 * x)";(*SRC*)
56.511 +val e188a = the (rewrite_set thy' false "cancel" e188a');
56.512 + is_expanded (parse_rat "8 * x + -8");
56.513 +(* e188a = ("8 / 9",["not ((-1) + x = 0)"]) then () 13.3.03*)
56.514 +if e188a = ("8 / 9",["-1 + x ~= 0"]) then ()
56.515 +else raise error "rational.sml: e188a new behaviour";
56.516 +val SOME (t,_) = rewrite_set thy' false mp
56.517 + "(8*((-1) + x))/(9*((-1) + x))";
56.518 +print("b)\n");
56.519 +val e188b'="(-15 + 5 * x) / (-18 + 6 * x)";(*SRC*)
56.520 +val SOME (t,_) = rewrite_set thy' false "cancel" e188b';
56.521 +t = "5 / 6" (*true*);
56.522 +print("c)\n");
56.523 +
56.524 +val e188c'="( a + -1 * b ) / ( b + -1 * a )";
56.525 +val e188c = the (rewrite_set thy' false "cancel_p" e188c');
56.526 +(*is_expanded (parse_rat "a + -1 * b");*)
56.527 +val SOME (t,_) =
56.528 + rewrite_set thy' false mp "((-1)*(b + (-1) * a))/(1*(b + (-1) * a))";
56.529 +if t= "(a + -1 * b) / (-1 * a + b)" then()
56.530 +else raise error "rational.sml: e188c new behaviour";
56.531 +
56.532 +print("\n\nexample 190:\n");
56.533 +print("c)\n");
56.534 +val e190c'="( 27 * a^^^3 + 9 * a^^^2 + 3 * a + 1 ) / ( 27 * a^^^3 + 18 * a^^^2 + 3 * a )";
56.535 +val e190c = the (rewrite_set thy' false "cancel" e190c');
56.536 +val SOME (t,_) = rewrite_set thy' false mp "((1 + 9 * a ^^^ 2)*(1 + 3 * a))/((3 * a + 9 * a ^^^ 2)*(1 + 3 * a))";
56.537 +if t = "(1 + 3 * a + 9 * a ^^^ 2 + 27 * a ^^^ 3) /\n(3 * a + 18 * a ^^^ 2 + 27 * a ^^^ 3)" then ()
56.538 +else raise error "rational.sml: e190c new behaviour";
56.539 +
56.540 +print("\n\nexample 191:\n");
56.541 +print("a)\n");
56.542 +val e191a'="( x^^^2 + -1 * y^^^2 ) / ( x + y )";
56.543 +(*WN.23.10.02-------
56.544 +val e191a = the (rewrite_set thy' false "cancel" e191a');
56.545 + is_expanded (parse_rat "x^^^2 + -1 * y^^^2");
56.546 + false;
56.547 + is_expanded (parse_rat "x + y");
56.548 + true; -----------*)
56.549 +val SOME (t,_) = rewrite_set thy' false mp "((x + (-1) * y)*(x + y))/((1)*(x + y))";
56.550 +(* t="(x ^^^ 2 + -1 * y ^^^ 2) / (x + y)" then() WN.13.3.03*)
56.551 +if t="(x ^^^ 2 + -1 * y ^^^ 2) / (x + y)" then()
56.552 +else raise error "rational.sml: e191a new behaviour";
56.553 +
56.554 +print("c)\n");
56.555 +val e191c'="( 9 * x^^^2 + -30 * x + 25 ) / ( 9 * x^^^2 + -25 )";
56.556 +(*WN.23.10.02-------
56.557 +val e191c = the (rewrite_set thy' false "cancel" e191c');
56.558 + is_expanded (parse_rat "9 * x^^^2 + -30 * x + 25");
56.559 + false;
56.560 + is_expanded (parse_rat "25 + -30*x + 9*x^^^2");
56.561 + false;
56.562 + is_expanded (parse_rat "-25 + 9*x^^^2");
56.563 + true;------------*)
56.564 +val SOME (t,_) = rewrite_set thy' false mp "(((-5) + 3 * x)*((-5) + 3 * x))/((5 + 3 * x)*((-5) + 3 * x))";
56.565 +(* t="(25 + ((-30) * x + 9 * x ^^^ 2)) / ((-25) + 9 * x ^^^ 2)"then() 13.3.03*)
56.566 +if t= "(25 + -30 * x + 9 * x ^^^ 2) / (-25 + 9 * x ^^^ 2)" then()
56.567 +else raise error "rational.sml: 'e191c' new behaviour";
56.568 +
56.569 +
56.570 +print("\n\nexample 192:\n");
56.571 +print("b)\n");
56.572 +val e192b'="( 7 * x^^^3 + -1 * x^^^2 * y ) / ( 7 * x * y^^^2 + -1 * y^^^3 )";
56.573 +(*WN.23.10.02-------
56.574 +val e192b = the (rewrite_set thy' false "cancel" e192b');
56.575 +-------------------*)
56.576 +val SOME (t',_) = rewrite_set thy' false mp "((x ^^^ 2)*(7 * x + (-1) * y))/((y ^^^ 2)*(7 * x + (-1) * y))";
56.577 +if t' = "(7 * x ^^^ 3 + -1 * x ^^^ 2 * y) / (7 * x * y ^^^ 2 + -1 * y ^^^ 3)"
56.578 +(*"(-1 * y * x ^^^ 2 + 7 * x ^^^ 3) / (-1 * y ^^^ 3 + 7 * x * y ^^^ 2)"WN050929*)
56.579 +then () else raise error "rational.sml: 'e192b' new behaviour";
56.580 +(*^^^ works with MG's simplifier vvv*)
56.581 +val t =str2term"((x ^^^ 2)*(7 * x + (-1) * y))/((y ^^^ 2)*(7 * x + (-1) * y))";
56.582 +val SOME (t',_) = rewrite_set_ Isac.thy false make_polynomial t;
56.583 +if term2str t' = "(7 * x ^^^ 3 + -1 * x ^^^ 2 * y) / (7 * x * y ^^^ 2 + -1 * y ^^^ 3)" then () else raise error "rational.sml: 'e192b'MG new behaviour";
56.584 +
56.585 +
56.586 +print("\n\nexample 193:\n");
56.587 +print("a)\n");
56.588 +val e193a'="( x^^^2 + -6 * x + 9 ) / ( x^^^2 + -9 )";
56.589 +(*WN.23.10.02-------
56.590 +val e193a = the (rewrite_set thy' false "cancel" e193a');
56.591 +-------------------*)
56.592 +print("b)\n");
56.593 +val e193b'="( x^^^2 + -8 * x + 16 ) / ( 2 * x^^^2 + -32 )";
56.594 +(*WN.23.10.02-------
56.595 +val e193b = the (rewrite_set thy' false "cancel" e193b');
56.596 +print("c)\n");
56.597 +val e193c'="( 2 * x + -50 * x^^^3 ) / ( 25 * x^^^2 + -10 * x + 1 )";
56.598 +val SOME(t,_) = rewrite_set thy' false "cancel" e193c';
56.599 +-------------------*)
56.600 +
56.601 +val wn01 = "(-25 + 9*x^^^2)/(5 + 3*x)";
56.602 +val SOME (t,_) = rewrite_set thy' false "cancel" wn01;
56.603 +(* t = "((-5) + 3 * x) / 1" then () WN.13.3.03*)
56.604 +if t = "(-5 + 3 * x) / 1" then ()
56.605 +else raise error "rational.sml: new behav. in cancel wn01";
56.606 +
56.607 +
56.608 +"-------- common_nominator_p ---------------------------- --------";
56.609 +"-------- common_nominator_p ---------------------------- --------";
56.610 +"-------- common_nominator_p ---------------------------- --------";
56.611 +val rls' = "common_nominator_p";
56.612 +
56.613 +print("\n\nexample 204:\n");
56.614 +print("a)\n");
56.615 +val e204a'="((5 * x) / 9) + ((3 * x) / 9) + (x / 9)";
56.616 +val e204a = the (rewrite_set thy' false "common_nominator_p" e204a');
56.617 +print("b)\n");
56.618 +val e204b'="5 / x + -3 / x + -1 / x";
56.619 +val e204b = the (rewrite_set thy' false "common_nominator_p" e204b');
56.620 +
56.621 +print("\n\nexample 205:\n");
56.622 +print("a)\n");
56.623 +val e205a'="((4 * x + 7) / 8) + ((4 * x + 3) / 8)";
56.624 +val e205a = the (rewrite_set thy' false "common_nominator_p" e205a');
56.625 +print("b)\n");
56.626 +val e205b'="((5 * x + 2) / 3) + ((-2 * x + 1) / 3)";
56.627 +val e205b = the (rewrite_set thy' false "common_nominator_p" e205b');
56.628 +
56.629 +print("\n\nexample 206:\n");
56.630 +print("a)\n");
56.631 +val e206a'="((5 * x + 4) / (2 * x + -1)) + ((9 * x + 5) / (2 * x + -1))";
56.632 +val e206a = the (rewrite_set thy' false "common_nominator_p" e206a');
56.633 +print("b)\n");
56.634 +val e206b'="((17 * x + -23) / (5 * x + 4)) + ((-25 + -17 * x) / (5 * x + 4))";
56.635 +val e206b = the (rewrite_set thy' false "common_nominator_p" e206b');
56.636 +
56.637 +print("\n\nexample 207:\n");
56.638 +val e207'="((3 * x * y + 3 * y) / (x * y)) + ((5 * x * y + 7 * y) / (x * y)) + ((9 * x * y + -2 * y) / (x * y)) + ((x * y + 4 * y) / (x * y)) ";
56.639 +val e207 = the (rewrite_set thy' false "common_nominator_p" e207');
56.640 +
56.641 +print("\n\nexample 208:\n");
56.642 +val e208'="((3 * x + 2) / (x + 2)) + ((5 * x + -1) / (x + 2)) + ((-7 * x + -3) / (x + 2)) + ((-1 * x + -3) / (x + 2)) ";
56.643 +val e208 = the (rewrite_set thy' false "common_nominator_p" e208');
56.644 +
56.645 +print("\n\nexample 209:\n");
56.646 +val e209'="((3 * x + -7 * y + 3 * z) / (4)) + ((2 * x + 17 * y + 10 * z) / (4)) + ((-1 * x + 2 * y + z) / (4)) ";
56.647 +val e209 = the (rewrite_set thy' false "common_nominator_p" e209');
56.648 +
56.649 +print("\n\nexample 210:\n");
56.650 +val e210'="((2 * x + 3 + -1 * x^^^2) / (5 * x)) + ((5 * x^^^2 + -2 * x + 1) / (5 * x)) + ((-3 * x^^^2 + -2 * x + 1) / (5 * x)) + ((-1 * x^^^2 + -3 * x + -5) / (5 * x)) ";
56.651 +val e210 = the (rewrite_set thy' false "common_nominator_p" e210');
56.652 +
56.653 +print("\n\nexample 211:\n");
56.654 +print("a)\n");
56.655 +val e211a'="((b) / (a + -1 * b)) + ((-1 * a) / (a + -1 * b))";
56.656 +val e211a = the (rewrite_set thy' false "common_nominator_p" e211a');
56.657 +print("b)\n");
56.658 +val e211b'="((b) / (b^^^2 + -1 * a^^^2)) + ((-1 * a) / (b^^^2 + -1 * a^^^2))";
56.659 +val e211b = the (rewrite_set thy' false "common_nominator_p" e211b');
56.660 +
56.661 +print("\n\nexample 212:\n");
56.662 +print("a)\n");
56.663 +val e212a'="((4) / (x)) + ((-3) / (y)) + -1";
56.664 +val e212a = the (rewrite_set thy' false "common_nominator_p" e212a');
56.665 +print("b)\n");
56.666 +val e212b'="((4) / (x)) + ((-5) / (y)) + ((6) / (x*y))";
56.667 +val e212b = the (rewrite_set thy' false "common_nominator_p" e212b');
56.668 +
56.669 +print("\n\nexample 213:\n");
56.670 +print("a)\n");
56.671 +val e213a'="((5 * x) / (3 * y^^^2)) + ((19 * z) / (6 * x * y)) + ((-2 * x) / (3 * y^^^2)) + ((7 * y^^^2) / (6 * x^^^2)) ";
56.672 +val e213a = the (rewrite_set thy' false "common_nominator_p" e213a');
56.673 +print("b)\n");
56.674 +val e213b'="((2 * b) / (3 * a^^^2)) + ((3 * c) / (7 * a * b)) + ((4 * b) / (3 * a^^^2)) + ((3 * a) / (7 * b^^^2))";
56.675 +val e213b = the (rewrite_set thy' false "common_nominator_p" e213b');
56.676 +
56.677 +print("\n\nexample 214:\n");
56.678 +print("a)\n");
56.679 +val e214a'="((3 * x + 2 * y + 2 * z) / (4)) + ((-5 * x + -3 * y) / (3)) + ((x + y + -2 * z) / (2))";
56.680 +val e214a = the (rewrite_set thy' false "common_nominator_p" e214a');
56.681 +print("b)\n");
56.682 +val e214b'="((5 * x + 2 * y + z) / (2)) + ((-7 * x + -3 * y) / (3)) + ((3 * x + 6 * y + -1 * z) / (12))";
56.683 +val e214b = the (rewrite_set thy' false "common_nominator_p" e214b');
56.684 +
56.685 +print("\n\nexample 216:\n");
56.686 +print("a)\n");
56.687 +val e216a'="((2 * b + 3 * c) / (a * c)) + ((3 * a + b) / (a * b)) + ((-2 * b^^^2 + -3 * a * c) / (a * b * c))";
56.688 +val e216a = the (rewrite_set thy' false "common_nominator_p" e216a');
56.689 +print("b)\n");
56.690 +val e216b'="((2 * a + 3 * b) / (b * c)) + ((3 * c + a) / (a * c)) + ((-2 * a^^^2 + -3 * b * c) / (a * b * c))";
56.691 +val e216b = the (rewrite_set thy' false "common_nominator_p" e216b');
56.692 +
56.693 +print("\n\nexample 217:\n");
56.694 +val e217'="((z + -1) / (z)) + ((3 * z ^^^2 + -6 * z + 5) / (z^^^2)) + ((-4 * z^^^3 + 7 * z^^^2 + -5 * z + 5) / (z^^^3))";
56.695 +val e217 = the (rewrite_set thy' false "common_nominator_p" e217');
56.696 +
56.697 +
56.698 +val rls' = "common_nominator";
56.699 +print("\n\nexample 218:\n");
56.700 +val e218'="((9 * a^^^3 - 5 * a^^^2 + 2 * a + 8) / (108 * a^^^4)) + ((-5 * a + 3 * a^^^2 + 4) / (8 * a^^^3)) + ((-261 * a^^^3 + 19 * a^^^2 + -112 * a + 16) / (216 * a^^^4))";
56.701 +val e218 = the (rewrite_set thy' false "common_nominator" e218');
56.702 +
56.703 +print("\n\nexample 219:\n");
56.704 +print("a)\n");
56.705 +val e219a'="((1) / (y + 1)) + ((1) / (y + 2)) + ((1) / (y + 3))";
56.706 +val e219a = the (rewrite_set thy' false "common_nominator" e219a');
56.707 +print("b)\n");
56.708 +val e219b'="((1) / (x + 1)) + ((1) / (x + 2)) + ((-2) / (x + 3))";
56.709 +val e219b = the (rewrite_set thy' false "common_nominator" e219b');
56.710 +
56.711 +print("\n\nexample 220:\n");
56.712 +print("a)\n");
56.713 +val e220a'="((17) / (5 * r + -2)) + ((-13) / (2 * r + 3)) + ((4) / (3 * r + -5))";
56.714 +val e220a = the (rewrite_set thy' false "common_nominator" e220a');
56.715 +print("b)\n");
56.716 +val e220b'="((20 * a) / (a + -3)) + ((-19 * a) / (a + -4)) + ((a) / (a + -5))";
56.717 +val e220b = the (rewrite_set thy' false "common_nominator" e220b');
56.718 +
56.719 +print("\n\nexample 221:\n");
56.720 +print("a)\n");
56.721 +val e221a'="((a + b) / (a + -1 * b)) + ((a + -1 * b) / (a + b))";
56.722 +val e221a = the (rewrite_set thy' false "common_nominator" e221a');
56.723 +print("b)\n");
56.724 +val e221b'="((x + -1 * y) / (x + y)) + ((x + y) / (x + -1 * y)) ";
56.725 +val e221b = the (rewrite_set thy' false "common_nominator" e221b');
56.726 +
56.727 +print("\n\nexample 222:\n");
56.728 +print("a)\n");
56.729 +val e222a'="((1 + -1 * x) / (1 + x)) + ((-1 + -1 * x) / (1 + -1 * x)) + ((4 * x) / (1 + -1 * x^^^2))";
56.730 +val e222a = the (rewrite_set thy' false "common_nominator" e222a');
56.731 +print("b)\n");
56.732 +val e222b'="((1 + x ) / (1 + -1 * x)) + ((-1 + x) / (1 + x)) + ((2 * x) / (1 + -1 * x^^^2))";
56.733 +val e222b = the (rewrite_set thy' false "common_nominator" e222b');
56.734 +
56.735 +print("\n\nexample 225:\n");
56.736 +print("a)\n");
56.737 +val e225a'="((6 * a) / (a^^^2 + -64)) + ((a + 2) / (2 * a + 16)) + ((-1) / (2))";
56.738 +val e225a = the (rewrite_set thy' false "common_nominator" e225a');
56.739 +print("b)\n");
56.740 +val e225b'="((a + 2 ) / (2 * a + 12)) + ((4 * a) / (a^^^2 + -36)) + ((-1) / (2))";
56.741 +val e225b = the (rewrite_set thy' false "common_nominator" e225b');
56.742 +
56.743 +print("\n\nexample 226:\n");
56.744 +print("a)\n");
56.745 +val e226a'="((35 * z) / (49 * z^^^2 + -4)) + -1 + ((14 * z + -1) / (14 * z + 4)) ";
56.746 +val e226a = the (rewrite_set thy' false "common_nominator" e226a');
56.747 +print("b)\n");
56.748 +val e226b'="((45 * a * b) / (25 * a^^^2 + -9 * b^^^2)) + ((20 * a + 3 * b) / (10 * a + 6 * b)) + -2";
56.749 +val e226b = the (rewrite_set thy' false "common_nominator" e226b');
56.750 +
56.751 +print("\n\nexample 227:\n");
56.752 +print("a)\n");
56.753 +val e227a'="((6 * z + 11) / (6 * z + 14)) + ((9 * z ) / (9 * z^^^2 + -49)) + -1 ";
56.754 +val e227a = the (rewrite_set thy' false "common_nominator" e227a');
56.755 +print("b)\n");
56.756 +val e227b'="((16 * a + 37 * b) / (4 * a + 10 * b)) + ((6 * a * b) / (4 * a^^^2 + -25 * b^^^2)) + -4 ";
56.757 +val e227b = the (rewrite_set thy' false "common_nominator" e227b');
56.758 +
56.759 +print("\n\nexample 228:\n");
56.760 +print("a)\n");
56.761 +val e228a'="((7 * a + 11) / (3 * a^^^2 + -3)) + ((-2 * a + -1) / (a^^^2 + -1 * a)) + ((-1) / (3 * a + 3))";
56.762 +val e228a = the (rewrite_set thy' false "common_nominator" e228a');
56.763 +print("b)\n");
56.764 +val e228b'="((11 * z + 2 * b) / (4 * b * z + -8 * b^^^2)) + ((-8 * z) / (z^^^2 + -4 * b^^^2)) + ((-9 * z + -2 * b) / (4 * b * z + 8 * b^^^2))";
56.765 +val e228b = the (rewrite_set thy' false "common_nominator" e228b');
56.766 +
56.767 +
56.768 +print("\n\nexample 229:\n");
56.769 +print("a)\n");
56.770 +val e229a'="((5 * x^^^2 + y) / (x + 2 * y)) + ((-8 * x^^^3 + 4 * x^^^2 * y + 3 * x * y) / (x^^^2 + -4 * y^^^2)) + ((3 * x^^^2 + -4 * y) / (x + -2 * y))";
56.771 +val e229a = the (rewrite_set thy' false "common_nominator" e229a');
56.772 +print("b)\n");
56.773 +val e229b'="((7 * x^^^2 + y) / (x + 3 * y)) + ((-24 * x^^^2 * y + 5 * x * y + 21 * y^^^2) / (x^^^2 + -9 * y^^^2)) + ((4 * x^^^2 + -6 * y) / (x + -3 * y))";
56.774 +val e229b = the (rewrite_set thy' false "common_nominator" e229b');
56.775 +
56.776 +print("\n\nexample 230:\n");
56.777 +print("a)\n");
56.778 +val e230a'="((5 * x^^^2 + y) / (2 * x + y)) + ((-16 * x^^^3 + 2 * x^^^2 * y + 6 * x * y) / (4 * x^^^2 + -1 * y^^^2)) + ((3 * x^^^2 + -4 * y) / (2 * x + -1 * y))";
56.779 +val e230a = the (rewrite_set thy' false "common_nominator" e230a');
56.780 +print("b)\n");
56.781 +val e230b'="((7 * x^^^2 + y) / (3 * x + y)) + ((-3 * x^^^3 + 15 * x * y + -7 * x^^^2 * y + 7 * y^^^2) / (9 * x^^^2 + -1 * y^^^2)) + ((4 * x^^^2 + -6 * y) / (3 * x + -1 * y))";
56.782 +val e230b = the (rewrite_set thy' false "common_nominator" e230b');
56.783 +
56.784 +print("\n\nexample 231:\n");
56.785 +print("a)\n");
56.786 +val e231a'="((2 * x + 5 * y) / (x)) + ((2 * x^^^3 + -5 * y^^^3 + 3 * x * y^^^2) / (x^^^3 + -2 * x^^^2 * y + x * y^^^2)) + ((-3 * x + -6 * y) / (x + -1 * y))";
56.787 +val e231a = the (rewrite_set thy' false "common_nominator" e231a');
56.788 +print("b)\n");
56.789 +val e231b'="((6 * x + 2 * y) / (x)) + ((6 * x^^^2 * y + -4 * x * y^^^2 + -2 * y^^^3) / (x^^^3 + -2 * x^^^2 * y + x * y^^^2)) + ((-5 * x + -3 * y) / (x + -1 * y))";
56.790 +val e231b = the (rewrite_set thy' false "common_nominator" e231b');
56.791 +
56.792 +print("\n\nexample 232:\n");
56.793 +print("a)\n");
56.794 +val e232a'="((2 * x + 3 * y) / (x)) + ((4 * x^^^3 + -1 * x * y^^^2 + -3 * y^^^3) / (x^^^3 + -2 * x^^^2 * y + x * y^^^2)) + ((-5 * x + -6 * y) / (x + -1 * y))";
56.795 +val e232a = the (rewrite_set thy' false "common_nominator" e232a');
56.796 +print("b)\n");
56.797 +val e232b'="((5 * x + 2 * y) / (x)) + ((2 * x^^^3 + -3 * x * y^^^2 + 3 * x^^^2 * y + -2 * y^^^3) / (x^^^3 + -2 * x^^^2 * y + x * y^^^2)) + ((-6 * x + -3 * y) / (x + -1 * y))";
56.798 +val e232b = the (rewrite_set thy' false "common_nominator" e232b');
56.799 +
56.800 +print("\n\nexample 233:\n");
56.801 +print("a)\n");
56.802 +val e233a'="((5 * x + 6 * y) / (x)) + ((5 * x * y^^^2 + -6 * y^^^3 + -2 * x^^^3 + 3 * x^^^2 * y) / (x^^^3 + -2 * x^^^2 * y + x * y^^^2)) + ((-2 * x + -3 * y) / (x + -1 * y))";
56.803 +val e233a = the (rewrite_set thy' false "common_nominator" e233a');
56.804 +print("b)\n");
56.805 +val e233b'="((6 * x + 5 * y) / (x)) + ((4 * x^^^2 * y + 3 * x * y^^^2 + -5 * y^^^3 + -2 * x^^^3) / (x^^^3 + -2 * x^^^2 * y + x * y^^^2)) + ((-3 * x + -2 * y) / (x + -1 * y))";
56.806 +val e233b = the (rewrite_set thy' false "common_nominator" e233b');
56.807 +
56.808 +print("\n\nexample 234:\n");
56.809 +print("a)\n");
56.810 +val e234a'="((5 * a + b) / (2 * a * b + -2 * b^^^2)) + ((-3 * a + -1 * b) / (2 * a * b + 2 * b^^^2)) + ((-2 * a) / (a^^^2 + -1 * b^^^2))";
56.811 +val e234a = the (rewrite_set thy' false "common_nominator" e234a');
56.812 +print("b)\n");
56.813 +val e234b'="((5 * a + 3 * b) / (6 * a * b + -18 * b^^^2)) + ((-3 * a + -3 * b) / (6 * a * b + 18 * b^^^2)) + ((-2 * a) / (a^^^2 + -9 * b^^^2)) ";
56.814 +val e234b = the (rewrite_set thy' false "common_nominator" e234b');
56.815 +
56.816 +print("\n\nexample 235:\n");
56.817 +print("a)\n");
56.818 +val e235a'="((10 * x + 3 * y) / (12 * x * y + -18 * y^^^2)) + ((-6 * x + -3 * y) / (12 * x * y + 18 * y^^^2)) + ((-4 * x) / (4 * x^^^2 + -9 * y^^^2))";
56.819 +val e235a = the (rewrite_set thy' false "common_nominator" e235a');
56.820 +print("b)\n");
56.821 +val e235b'="((8 * a + b) / (4 * a * b + -2 * b^^^2)) + ((-4 * a + -1 * b) / (4 * a * b + 2 * b^^^2)) + ((-2 * a) / (4 * a^^^2 + -1 * b^^^2)) ";
56.822 +val e235b = the (rewrite_set thy' false "common_nominator" e235b');
56.823 +
56.824 +print("\n\nexample 236:\n");
56.825 +print("a)\n");
56.826 +val e236a'="((8 * a + 5 * b) / (20 * a * b + -50 * b^^^2)) + ((-4 * a + -5 * b) / (20 * a * b + 50 * b^^^2)) + ((-2 * a) / (4 * a^^^2 + -25 * b^^^2))";
56.827 +val e236a = the (rewrite_set thy' false "common_nominator" e236a');
56.828 +print("b)\n");
56.829 +val e236b'="((24 * x + y) / (6 * x * y + -2 * y^^^2)) + ((-18 * x + -1 * y) / (6 * x * y + 2 * y^^^2)) + ((-15 * x) / (9 * x^^^2 + -1 * y^^^2)) ";
56.830 +val e236b = the (rewrite_set thy' false "common_nominator" e236b');
56.831 +
56.832 +
56.833 +val rls' = "cancel";
56.834 +print("\n\nexample heuberger:\n");
56.835 +val eheu'="(x^^^4 + x * y + x^^^3 * y + y^^^2) / (x + 5 * x^^^2 + y + 5 * x * y + x^^^2 * y^^^3 + x * y^^^4)";
56.836 +val eheu = the (rewrite_set thy' false "cancel" eheu');
56.837 +
56.838 +val rls' = "common_nominator_p";
56.839 +print("\n\nexample stiefel:\n");
56.840 +val est1'="(7) / (-14) + (-2) / (4)";
56.841 +val est1 = the (rewrite_set thy' false "common_nominator_p" est1');
56.842 +if est1 = ("-1 / 1",[]) then ()
56.843 +else raise error "new behaviour in rational.sml: est1'";
56.844 +
56.845 +val t = (term_of o the o (parse thy))
56.846 +"(9 - x ^^^ 2) / (9 - 6 * x + x ^^^ 2)";
56.847 +val SOME (t',_) = factout_ thy t;
56.848 +term2str t';
56.849 +"(3 + x) * (3 - x) / ((3 - x) * (3 - x))";
56.850 +
56.851 +
56.852 +"-------- reverse rewrite ----------------------------------------";
56.853 +"-------- reverse rewrite ----------------------------------------";
56.854 +"-------- reverse rewrite ----------------------------------------";
56.855 +
56.856 +(*WN.28.8.02: tests for the 'reverse-rewrite' functions:
56.857 + these are defined in Rationals.ML and stored in
56.858 + the 'reverse-ruleset' cancel*)
56.859 +
56.860 +(*the term for which reverse rewriting is demonstrated*)
56.861 + val t = (term_of o the o (parse thy))
56.862 + "(9 - x ^^^ 2) / (9 + 6 * x + x ^^^ 2)";
56.863 + val Rrls {scr=Rfuns {init_state=ini,locate_rule=loc,
56.864 + next_rule=nex,normal_form=nor,...},...} = cancel;
56.865 +
56.866 +(*normal_form produces the result in ONE step*)
56.867 + val SOME (t',_) = nor t;
56.868 + term2str t';
56.869 +
56.870 +(*initialize the interpreter state used by the 'me'*)
56.871 + val (t,_,revsets,_) = ini t;
56.872 +
56.873 +(*find the rule 'r' to apply to term 't'*)
56.874 + val SOME r = nex revsets t;
56.875 + (*val r = Thm ("sym_#mult_2_3","6 = 2 * 3") : rule*)
56.876 +
56.877 +(*check, if the rule 'r' applied by the user to 't' belongs to the ruleset;
56.878 + if the rule is OK, the term resulting from applying the rule is returned,too;
56.879 + there might be several rule applications inbetween,
56.880 + which are listed after the head in reverse order*)
56.881 + val (r,(t,asm))::_ = loc revsets t r;
56.882 + term2str t;
56.883 + "(9 - x ^^^ 2) / (3 ^^^ 2 + 6 * x + x ^^^ 2)";
56.884 +
56.885 +(*find the next rule to apply*)
56.886 + val SOME r = nex revsets t;
56.887 + (*val r = Thm ("sym_#power_3_2","9 = 3 ^^^ 2") : rule*)
56.888 +
56.889 +(*check the next rule*)
56.890 + val (r,(t,asm))::_ = loc revsets t r;
56.891 + term2str t;
56.892 + "(3 ^^^ 2 - x ^^^ 2) / (3 ^^^ 2 + 6 * x + x ^^^ 2)";
56.893 +
56.894 +(*find and check the next rules, rewrite*)
56.895 + val SOME r = nex revsets t;
56.896 + val (r,(t,asm))::_ = loc revsets t r;
56.897 + term2str t;
56.898 + "(3 ^^^ 2 - x ^^^ 2) / (3 ^^^ 2 + 2 * 3 * x + x ^^^ 2)";
56.899 +
56.900 + val SOME r = nex revsets t;
56.901 + val (r,(t,asm))::_ = loc revsets t r;
56.902 + term2str t;
56.903 + "(3 - x) * (3 + x) / (3 ^^^ 2 + 2 * 3 * x + x ^^^ 2)";
56.904 +
56.905 + val SOME r = nex revsets t;
56.906 + val (r,(t,asm))::_ = loc revsets t r;
56.907 + term2str t;
56.908 + "(3 - x) * (3 + x) / ((3 + x) * (3 + x))";
56.909 +
56.910 + val SOME r = nex revsets t;
56.911 + val (r,(t,asm))::_ = loc revsets t r;
56.912 + val ss = term2str t;
56.913 + if ss = "(3 - x) / (3 + x)" then ()
56.914 + else raise error "rational.sml: new behav. in rev-set cancel";
56.915 + terms2str asm;
56.916 +
56.917 +
56.918 +"-------- 'reverse-ruleset' cancel_p -----------------------------";
56.919 +"-------- 'reverse-ruleset' cancel_p -----------------------------";
56.920 +"-------- 'reverse-ruleset' cancel_p -----------------------------";
56.921 +(*WN.11.9.02: the 'reverse-ruleset' cancel_p*)
56.922 +
56.923 +(*the term for which reverse rewriting is demonstrated*)
56.924 +val t = str2term "(9 + (-1)*x^^^2) / (9 + ((-6)*x + x^^^2))";
56.925 +val Rrls {scr=Rfuns {init_state=ini,locate_rule=loc,
56.926 + next_rule=nex,normal_form=nor,...},...} = cancel_p;
56.927 +
56.928 +(*normal_form produces the result in ONE step*)
56.929 +val SOME (t',_) = nor t;
56.930 +term2str t' = "(3 + 1 * x) / (3 + -1 * x)";
56.931 +
56.932 +(*initialize the interpreter state used by the 'me'*)
56.933 +val SOME (t', asm) = cancel_p_ thy t;
56.934 +term2str t' = "(3 + x) / (3 + -1 * x)" (*true*);
56.935 +terms2str asm = "[\"3 + -1 * x ~= 0\"]" (*true*);
56.936 +val (t,_,revsets,_) = ini t;
56.937 +
56.938 +(* WN.10.10.02: dieser Fall terminiert nicht
56.939 + (make_polynomial enth"alt zu viele rules)
56.940 +WN060823 'init_state' requires rewriting on specified location in the term
56.941 +print_depth 99; Rfuns; print_depth 3;
56.942 +WN060831 cycling "sym_order_mult_rls_" "sym_real_mult_assoc"
56.943 + as was with make_polynomial before ?!?*)
56.944 +
56.945 +val SOME r = nex revsets t;
56.946 +eq_Thm (r, Thm ("sym_#power_Float ((3,0), (0,0)) __ ((2,0), (0,0))",
56.947 + mk_thm Rational.thy "9 = 3 ^^^ 2"));
56.948 +(*WN060831 *** id_of_thm
56.949 + Exception- ERROR raised ...
56.950 +val (r,(t,asm))::_ = loc revsets t r;
56.951 +term2str t;
56.952 +
56.953 + val SOME r = nex revsets t;
56.954 + val (r,(t,asm))::_ = loc revsets t r;
56.955 + term2str t;
56.956 +*)
56.957 +
56.958 +print "\n\n\n****************** all tests successfull *************************\n";
56.959 +
56.960 +
56.961 +
56.962 +(*WN.17.3.03 =========================================================vvv---*)
56.963 +"-------- norm_Rational ------------------------------------------";
56.964 +"-------- norm_Rational ------------------------------------------";
56.965 +"-------- norm_Rational ------------------------------------------";
56.966 +val t = str2term "(3*x+5)/18 - x/2 - -(3*x - 2)/9 = 0";
56.967 +val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t';
56.968 +if term2str t' = "1 / 18 = 0" then () else raise error "rational.sml 1";
56.969 +
56.970 +val t = str2term "(17*x - 51)/9 - (-(13*x - 3)/6) + 11 - (9*x - 7)/4 = 0";
56.971 +val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t';
56.972 +if term2str t' = "(237 + 65 * x) / 36 = 0" then ()
56.973 +else raise error "rational.sml 2";
56.974 +
56.975 +val t = str2term "(1/2 + (5*x)/2)^^^2 - ((13*x)/2 - 5/2)^^^2 - (6*x)^^^2 + 29";
56.976 +val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t';
56.977 +(*before 040209:if term2str t' = "(23 + (35 * x + -72 * x ^^^ 2)) / 1"then()*)
56.978 +if term2str t' = "23 + 35 * x + -72 * x ^^^ 2" then ()
56.979 +else raise error "rational.sml 3";
56.980 +(*trace_rewrite:=true;*)
56.981 +val t = str2term "Not (6*x is_atom)";
56.982 +val SOME (t',_) = rewrite_set_ thy false powers_erls t; term2str t';
56.983 +"True";
56.984 +val t = str2term "1 < 2";
56.985 +val SOME (t',_) = rewrite_set_ thy false powers_erls t; term2str t';
56.986 +"True";
56.987 +val t = str2term "(6*x)^^^2";
56.988 +val SOME (t',_) = rewrite_ thy dummy_ord powers_erls false
56.989 + (num_str realpow_def_atom) t;
56.990 +term2str t';
56.991 +trace_rewrite:=false;
56.992 +
56.993 +val t = str2term "-1 * (-2 * (5 / 2 * (13 * x / 2)))";
56.994 +val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t';
56.995 +if term2str t' = "65 * x / 2" then () else raise error "rational.sml 4";
56.996 +
56.997 +val t = str2term "1 - ((13*x)/2 - 5/2)^^^2";
56.998 +val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t';
56.999 +(*bef.040209: if term2str t' = "(-21 + (130 * x + -169 * x ^^^ 2)) / 4"then()*)
56.1000 +if term2str t' = "(-21 + 130 * x + -169 * x ^^^ 2) / 4" then ()
56.1001 +else raise error "rational.sml 5";
56.1002 +
56.1003 +(*SRAM Schalk I, p.92 Nr. 609a*)
56.1004 +val t = str2term "2*(3 - x/5)/3 - 4*(1 - x/3) - x/3 - 2*(x/2 - 1/4)/27 +5/54";
56.1005 +val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t';
56.1006 +if term2str t' = "(-255 + 112 * x) / 135" then ()
56.1007 +else raise error "rational.sml 6";
56.1008 +
56.1009 +(*SRAM Schalk I, p.92 Nr. 610c*)
56.1010 +val t = str2term "((x- 1)/(x+1) + 1) / ((x- 1)/(x+1) - (x+1)/(x- 1)) - 2";
56.1011 +val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t';
56.1012 +if term2str t' = "(-3 + -1 * x) / 2" then () else raise error "rational.sml 7";
56.1013 +
56.1014 +(*SRAM Schalk I, p.92 Nr. 476a*)
56.1015 +val t = str2term "(x^^^2/(1 - x^^^2) + 1)/(x/(1 - x) + 1) *\
56.1016 + \ (1 + x)";(*. a/b : c/d translated to a/b * d/c .*)
56.1017 +val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t';
56.1018 +(*if term2str t' = "1 / 1" then () else raise error "rational.sml 8";3.6.03*)
56.1019 +if term2str t' = "1" then () else raise error "rational.sml 8";
56.1020 +
56.1021 +(*............................vvv---TODO: sollte gehen mit poly_order *)
56.1022 +(*Schalk I, p.92 Nr. 472a*)
56.1023 +val t = str2term "((8*x^^^2 - 32*y^^^2)/(2*x + 4*y))/((4*x - 8*y)/(x + y))";
56.1024 +val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t';
56.1025 +if term2str t' = "x + y" then () else raise error "rational.sml p.92 Nr. 472a";
56.1026 +
56.1027 +(*Schalk I, p.70 Nr. 480b; a/b : c/d translated to a/b * d/c*)
56.1028 +val t = str2term "((12*x*y/(9*x^^^2 - y^^^2))/\
56.1029 + \(1/(3*x - y)^^^2 - 1/(3*x + y)^^^2)) *\
56.1030 + \(1/(x - 5*y)^^^2 - 1/(x + 5*y)^^^2)/\
56.1031 + \(20*x*y/(x^^^2 - 25*y^^^2))";
56.1032 +(*... nicht simpl, zerlegt ...*)
56.1033 +val t = str2term "((12*x*y/(9*x^^^2 - y^^^2))/\
56.1034 + \(1/(3*x - y)^^^2 - 1/(3*x + y)^^^2))";
56.1035 +val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t';
56.1036 +"(-12 * (x * y ^^^ 3) + 108 * (x * (y * x ^^^ 2))) / (12 * (x * y))";
56.1037 +(* ~~~~~~~~~~ poly_order notwendig!*)
56.1038 +val t = str2term "(1/(x - 5*y)^^^2 - 1/(x + 5*y)^^^2)/\
56.1039 + \(20*x*y/(x^^^2 - 25*y^^^2))";
56.1040 +val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t';
56.1041 +"(-500 * (x * y ^^^ 3) /\n (x ^^^ 4 + (625 * y ^^^ 4 + -50 * (x ^^^ 2 * y ^^^ 2))) +\n 20 * (x * (y * x ^^^ 2)) /\n (x ^^^ 4 + (625 * y ^^^ 4 + -50 * (x ^^^ 2 * y ^^^ 2)))) /\n(20 * (x * y))";
56.1042 +trace_rewrite:=true;
56.1043 +trace_rewrite:=false;
56.1044 +
56.1045 +"nonterm.SK6 ----- SK060904-2a non-termination of add_fraction_p_";
56.1046 +(*WN.2.6.03 from rlang.sml 56a
56.1047 +val t = str2term "(a + b * x) / (a + -1 * (b * x)) + (-1 * a + b * x) / (a + b * x) = 4 * (a * b) / (a ^^^ 2 + -1 * b ^^^ 2)";
56.1048 +val NONE = rewrite_set_ thy false common_nominator_p t;
56.1049 +
56.1050 +WN060831 nonterm.SK7
56.1051 +val t = str2term "(a + b * x) / (a + -1 * (b * x)) + (-1 * a + b * x) / (a + b * x)";
56.1052 +val NONE = add_fraction_p_ thy t;
56.1053 +*)
56.1054 +
56.1055 +
56.1056 +(* ------------------------------------------------------------------- *)
56.1057 +(*---------vvv------------ MG: ab 1.7.03 ----------------vvv-----------*)
56.1058 +(* Simplifier fuer beliebige Buchterme *)
56.1059 +(* ------------------------------------------------------------------- *)
56.1060 +(*----------------------- norm_Rational_mg ----------------------------*)
56.1061 +(* ------------------------------------------------------------------- *)
56.1062 +
56.1063 +"-------- numeral rationals --------------------------------------";
56.1064 +"-------- numeral rationals --------------------------------------";
56.1065 +"-------- numeral rationals --------------------------------------";
56.1066 +
56.1067 +(*SRA Schalk I, p.40 Nr. 164b *)
56.1068 +val t = str2term "(47/6 - 76/9 + 13/4)/(35/12)";
56.1069 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1070 +term2str t;
56.1071 +if (term2str t) = "19 / 21" then ()
56.1072 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 1";
56.1073 +
56.1074 +(*SRA Schalk I, p.40 Nr. 166a *)
56.1075 +val t = str2term "((5/4)/(4+22/7) + 37/20)*(110/3 - 110/9 * 23/11)";
56.1076 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1077 +term2str t;
56.1078 +if (term2str t) = "45 / 2" then ()
56.1079 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 2";
56.1080 +
56.1081 +
56.1082 +"-------- cancellation -------------------------------------------";
56.1083 +"-------- cancellation -------------------------------------------";
56.1084 +"-------- cancellation -------------------------------------------";
56.1085 +
56.1086 +(* e190c Stefan K.*)
56.1087 +val t = str2term
56.1088 +"((1 + 9 * a ^^^ 2)*(1 + 3 * a))/((3 * a + 9 * a ^^^ 2)*(1 + 3 * a))";
56.1089 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1090 +term2str t;
56.1091 +if (term2str t) =
56.1092 +"(1 + 9 * a ^^^ 2) / (3 * a + 9 * a ^^^ 2)"
56.1093 +then ()
56.1094 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 3";
56.1095 +
56.1096 +(* e192b Stefan K.*)
56.1097 +val t = str2term
56.1098 +"((x ^^^ 2)*(7 * x + (-1) * y))/((y ^^^ 2)*(7 * x + (-1) * y))";
56.1099 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1100 +term2str t;
56.1101 +if (term2str t) =
56.1102 +"x ^^^ 2 / y ^^^ 2"
56.1103 +then ()
56.1104 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 4";
56.1105 +
56.1106 +(*SRC Schalk I, p.66 Nr. 379c *)
56.1107 +val t = str2term
56.1108 +"(a - b)/(b - a)";
56.1109 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1110 +term2str t;
56.1111 +if (term2str t) =
56.1112 +"-1"
56.1113 +then ()
56.1114 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 5";
56.1115 +
56.1116 +(*SRC Schalk I, p.66 Nr. 380b *)
56.1117 +val t = str2term
56.1118 +"15*(3*x+3)*(4*x+9)/(12*(2*x+7)*(5*x+5))";
56.1119 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1120 +term2str t;
56.1121 +if (term2str t) =
56.1122 +"(27 + 12 * x) / (28 + 8 * x)"
56.1123 +then ()
56.1124 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 6";
56.1125 +
56.1126 +(*Schalk I, p.60 Nr. 215c *)
56.1127 +(* Falsches Ergebnis: rechnet lange und cancel_p kann nicht weiter krzen!!!*)
56.1128 +(* WN060831????MG1
56.1129 +val t = str2term "(a+b)^^^4*(x - y)/((x - y)^^^3*(a+b)^^^2)";
56.1130 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1131 +term2str t;
56.1132 +if (term2str t) =
56.1133 +"(a ^^^ 4 * x + -1 * a ^^^ 4 * y + 4 * a ^^^ 3 * b * x + -4 * a ^^^ 3 * b * y + 6 * a ^^^ 2 * b ^^^ 2 * x + -6 * a ^^^ 2 * b ^^^ 2 * y + 4 * a * b ^^^ 3 * x + -4 * a * b ^^^ 3 * y + b ^^^ 4 * x + -1 * b ^^^ 4 * y) /(a ^^^ 2 * x ^^^ 3 + -3 * a ^^^ 2 * x ^^^ 2 * y + 3 * a ^^^ 2 * x * y ^^^ 2 + -1 * a ^^^ 2 * y ^^^ 3 + 2 * a * b * x ^^^ 3 + -6 * a * b * x ^^^ 2 * y + 6 * a * b * x * y ^^^ 2 + -2 * a * b * y ^^^ 3 + b ^^^ 2 * x ^^^ 3 + -3 * b ^^^ 2 * x ^^^ 2 * y + 3 * b ^^^ 2 * x * y ^^^ 2 + -1 * b ^^^ 2 * y ^^^ 3)"
56.1134 +then ()
56.1135 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 7";
56.1136 +*)
56.1137 +(*val t = str2term
56.1138 +"(a ^^^ 4 * x + -1 * a ^^^ 4 * y + 4 * a ^^^ 3 * b * x + -4 * a ^^^ 3 * b * y + 6 * a ^^^ 2 * b ^^^ 2 * x + -6 * a ^^^ 2 * b ^^^ 2 * y + 4 * a * b ^^^ 3 * x + -4 * a * b ^^^ 3 * y + b ^^^ 4 * x + -1 * b ^^^ 4 * y) /(a ^^^ 2 * x ^^^ 3 + -3 * a ^^^ 2 * x ^^^ 2 * y + 3 * a ^^^ 2 * x * y ^^^ 2 + -1 * a ^^^ 2 * y ^^^ 3 + 2 * a * b * x ^^^ 3 + -6 * a * b * x ^^^ 2 * y + 6 * a * b * x * y ^^^ 2 + -2 * a * b * y ^^^ 3 + b ^^^ 2 * x ^^^ 3 + -3 * b ^^^ 2 * x ^^^ 2 * y + 3 * b ^^^ 2 * x * y ^^^ 2 + -1 * b ^^^ 2 * y ^^^ 3)"
56.1139 +val SOME (t,_) = rewrite_set_ thy false cancel_p t;
56.1140 +term2str t;*)
56.1141 +(* uncaught exception nonexhaustive binding failure
56.1142 + raised at: stdIn:93.1-93.51 *)
56.1143 +
56.1144 +(*Schalk I, p.66 Nr. 381a *)
56.1145 +(* ACHTUNG: rechnet ca. 2 Minuten !!! *)
56.1146 +(* WN060831???MG2
56.1147 +val t = str2term "18*(a+b)^^^3*(a - b)^^^2/(72*(a - b)^^^3*(a+b)^^^2)";
56.1148 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1149 +term2str t;
56.1150 +if (term2str t) =
56.1151 +"(a + b) / (4 * a + -4 * b)"
56.1152 +then () else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 8";
56.1153 +*)
56.1154 +
56.1155 +(*SRC Schalk I, p.66 Nr. 381b *)
56.1156 +val t = str2term
56.1157 +"(4*x^^^2 - 20*x + 25)/(2*x - 5)^^^3";
56.1158 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1159 +term2str t;
56.1160 +if (term2str t) =
56.1161 +"-1 / (5 + -2 * x)"
56.1162 +then ()
56.1163 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 9";
56.1164 +
56.1165 +(*SRC Schalk I, p.66 Nr. 381c *)
56.1166 +val t = str2term
56.1167 +"(27*a^^^3+9*a^^^2+3*a+1)/(27*a^^^3+18*a^^^2+3*a)";
56.1168 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1169 +term2str t;
56.1170 +if (term2str t) =
56.1171 +"(1 + 9 * a ^^^ 2) / (3 * a + 9 * a ^^^ 2)"
56.1172 +then ()
56.1173 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 10";
56.1174 +
56.1175 +(*SRC Schalk I, p.66 Nr. 383a *)
56.1176 +val t = str2term
56.1177 +"(5*a^^^2 - 5*a*b)/(a - b)^^^2";
56.1178 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1179 +term2str t;
56.1180 +if (term2str t) =
56.1181 +"5 * a / (a + -1 * b)"
56.1182 +then ()
56.1183 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 11";
56.1184 +
56.1185 +"-------- common denominator -------------------------------------";
56.1186 +"-------- common denominator -------------------------------------";
56.1187 +"-------- common denominator -------------------------------------";
56.1188 +
56.1189 +(*SRA Schalk I, p.67 Nr. 403a *)
56.1190 +val t = str2term
56.1191 +"4/x - 3/y - 1";
56.1192 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1193 +term2str t;
56.1194 +if (term2str t) =
56.1195 +"(-3 * x + 4 * y + -1 * x * y) / (x * y)"
56.1196 +then ()
56.1197 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 12";
56.1198 +
56.1199 +(*SRA Schalk I, p.67 Nr. 407b *)
56.1200 +val t = str2term
56.1201 +"(2*a+3*b)/(b*c) + (3*c+a)/(a*c) - (2*a^^^2+3*b*c)/(a*b*c)";
56.1202 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1203 +term2str t;
56.1204 +if (term2str t) =
56.1205 +"4 / c"
56.1206 +then ()
56.1207 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 13";
56.1208 +
56.1209 +(*SRA Schalk I, p.67 Nr. 410b *)
56.1210 +val t = str2term
56.1211 +"1/(x+1) + 1/(x+2) - 2/(x+3)";
56.1212 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1213 +term2str t;
56.1214 +if (term2str t) =
56.1215 +"(5 + 3 * x) / (6 + 11 * x + 6 * x ^^^ 2 + x ^^^ 3)"
56.1216 +then ()
56.1217 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 14";
56.1218 +
56.1219 +(*SRA Schalk I, p.67 Nr. 413b *)
56.1220 +val t = str2term
56.1221 +"(1+x)/(1 - x) - (1 - x)/(1+x) + 2*x/(1 - x^^^2)";
56.1222 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1223 +term2str t;
56.1224 +if (term2str t) =
56.1225 +"6 * x / (1 + -1 * x ^^^ 2)"
56.1226 +then ()
56.1227 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 15";
56.1228 +
56.1229 +(*SRA Schalk I, p.68 Nr. 414a *)
56.1230 +val t = str2term
56.1231 +"(x + 2)/(x - 1) + (x - 3)/(x - 2) - (x + 1)/((x - 1)*(x - 2))";
56.1232 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1233 +term2str t;
56.1234 +if (term2str t) =
56.1235 +"(-2 + -5 * x + 2 * x ^^^ 2) / (2 + -3 * x + x ^^^ 2)"
56.1236 +then ()
56.1237 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 16";
56.1238 +
56.1239 +(*SRA Schalk I, p.68 Nr. 423a *)
56.1240 +val t = str2term
56.1241 +"(2*x+3*y)/x + (4*x^^^3 - x*y^^^2 - 3*y^^^3)/(x^^^3 - 2*x^^^2*y+x*y^^^2) - (5*x+6*y)/(x - y)";
56.1242 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1243 +term2str t;
56.1244 +if (term2str t) =
56.1245 +"1"
56.1246 +then ()
56.1247 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 17";
56.1248 +
56.1249 +(*SRA Schalk I, p.68 Nr. 428b *)
56.1250 +val t = str2term
56.1251 +"1/(a - b)^^^2 + 1/(a+b)^^^2 - 2/(a^^^2 - b^^^2) - 4*(b^^^2 - 1)/(a^^^2 - b^^^2)^^^2";
56.1252 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1253 +term2str t;
56.1254 +if (term2str t) =
56.1255 +"4 / (a ^^^ 4 + -2 * a ^^^ 2 * b ^^^ 2 + b ^^^ 4)"
56.1256 +then ()
56.1257 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 18";
56.1258 +
56.1259 +(*SRA Schalk I, p.68 Nr. 430b *)
56.1260 +val t = str2term
56.1261 +"a^^^2/(a - 3*b) - 108*a*b^^^3/((a+3*b)*(a^^^2 - 9*b^^^2)) - 9*b^^^2*(a - 3*b)/(a+3*b)^^^2";
56.1262 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1263 +term2str t;
56.1264 +if (term2str t) =
56.1265 +"a + 3 * b"
56.1266 +then ()
56.1267 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 19";
56.1268 +
56.1269 +
56.1270 +(*SRA Schalk I, p.68 Nr. 432 *)
56.1271 +val t = str2term
56.1272 +"(a^^^2+a*b)/(a^^^2 - b^^^2) - (b^^^2 - a*b)/(b^^^2 - a^^^2) + a^^^2*(a - b)/(a^^^3 - a^^^2*b) - 2*a*(a^^^2 - b^^^2)/(a^^^3 - a*b^^^2) - 2*b^^^2/(a^^^2 - b^^^2)";
56.1273 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1274 +term2str t;
56.1275 +if (term2str t) =
56.1276 +"0"
56.1277 +then ()
56.1278 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 20";
56.1279 +
56.1280 +(*Eigenes*)
56.1281 +val t = str2term
56.1282 +"3*a/(a*b) + x/y";
56.1283 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1284 +term2str t;
56.1285 +if (term2str t) =
56.1286 +"(3 * y + b * x) / (b * y)"
56.1287 +then ()
56.1288 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 21";
56.1289 +
56.1290 +
56.1291 +"-------- multiply and cancel ------------------------------------";
56.1292 +"-------- multiply and cancel ------------------------------------";
56.1293 +"-------- multiply and cancel ------------------------------------";
56.1294 +
56.1295 +(*SRM Schalk I, p.68 Nr. 436a *)
56.1296 +val t = str2term
56.1297 +"3*(x+y)/(15*(x - y)) * 25*(x - y)^^^2/(18*(x+y)^^^2)";
56.1298 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1299 +term2str t;
56.1300 +if (term2str t) =
56.1301 +"(5 * x + -5 * y) / (18 * x + 18 * y)"
56.1302 +then ()
56.1303 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 22";
56.1304 +
56.1305 +(*SRM.test Schalk I, p.68 Nr. 436b *)
56.1306 +(*WN060420???MG3 crashes with method 'simplify' in
56.1307 + IsacCore > Simplification > Rational Terms > Multiplication > No.2*)
56.1308 +val t = str2term "5*a*(a - b)^^^2*(a + b)^^^3/(7*b*(a - b)^^^3) * 7*b/(a + b)^^^3";
56.1309 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1310 +term2str t;
56.1311 +if (term2str t) =
56.1312 +"5 * a / (a + -1 * b)"
56.1313 +then ()
56.1314 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 23";
56.1315 +
56.1316 +(*Schalk I, p.68 Nr. 437a *)
56.1317 +val t = str2term "(3*a - 4*b)/(4*c+3*e) * (3*a+4*b)/(9*a^^^2 - 16*b^^^2)";
56.1318 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1319 +if (term2str t) = "1 / (4 * c + 3 * e)" then ()
56.1320 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 24";
56.1321 +
56.1322 +"----- S.K. corrected non-termination 060904";
56.1323 +val t = str2term "(3*a - 4*b) * (3*a+4*b)/((4*c+3*e)*(9*a^^^2 - 16*b^^^2))";
56.1324 +val SOME (t',_) = rewrite_set_ thy false make_polynomial t;
56.1325 +if term2str t' = "(9 * a ^^^ 2 + -16 * b ^^^ 2) /\n(36 * a ^^^ 2 * c + 27 * a ^^^ 2 * e + -64 * b ^^^ 2 * c +\n -48 * b ^^^ 2 * e)" then ()
56.1326 +else raise error "rational.sml.sml: S.K.8..corrected 060904-6";
56.1327 +
56.1328 +"----- S.K. corrected non-termination of cancel_p_";
56.1329 +val t'' = str2term "(9 * a ^^^ 2 + -16 * b ^^^ 2) /\
56.1330 +\(36 * a^^^2 * c + (27 * a^^^2 * e + (-64 * b^^^2 * c + -48 * b^^^2 * e)))";
56.1331 +val SOME (t',_) = rewrite_set_ thy false cancel_p t'';
56.1332 +if term2str t' = "1 / (4 * c + 3 * e)" then ()
56.1333 +else raise error "rational.sml.sml: diff.behav. in cancel_p S.K.8";
56.1334 +
56.1335 +(**)
56.1336 +
56.1337 +(*Schalk I, p.68 Nr. 437b *)
56.1338 +(* nonterm.SK9 loops: cancel_p kann nicht weiter kuerzen!!! *)
56.1339 +val t'' = str2term "(a + b)/(x^^^2 - y^^^2) * ((x - y)^^^2/(a^^^2 - b^^^2))";
56.1340 +(* val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t'';
56.1341 + *)
56.1342 +
56.1343 +(*a casual output from above*)
56.1344 +val t = str2term
56.1345 +"(a * x ^^^ 2 + -2 * a * x * y + a * y ^^^ 2 + b * x ^^^ 2 + -2 * b * x * y + b * y ^^^ 2) /(a ^^^ 2 * x ^^^ 2 + -1 * a ^^^ 2 * y ^^^ 2 + -1 * b ^^^ 2 * x ^^^ 2 + b ^^^ 2 * y ^^^ 2)";
56.1346 +(* WN060831 nonterm.SK10
56.1347 +val SOME (t,_) = rewrite_set_ thy false cancel_p t;
56.1348 +term2str t;
56.1349 +*)
56.1350 +
56.1351 +(*SRM Schalk I, p.68 Nr. 438a *)
56.1352 +val t = str2term
56.1353 +"x*y/(x*y - y^^^2)*(x^^^2 - x*y)";
56.1354 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1355 +term2str t;
56.1356 +if (term2str t) =
56.1357 +"x ^^^ 2"
56.1358 +then ()
56.1359 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 24";
56.1360 +
56.1361 +(*SRM Schalk I, p.68 Nr. 439b *)
56.1362 +val t = str2term
56.1363 +"(4*x^^^2+4*x+1)*((x^^^2 - 2*x^^^3)/(4*x^^^2+2*x))";
56.1364 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1365 +term2str t;
56.1366 +if (term2str t) =
56.1367 +"(x + -4 * x ^^^ 3) / 2"
56.1368 +then ()
56.1369 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 25";
56.1370 +
56.1371 +(*SRM Schalk I, p.68 Nr. 440a *)
56.1372 +val t = str2term
56.1373 +"(x^^^2 - 2*x)/(x^^^2 - 3*x) * (x - 3)^^^2/(x^^^2 - 4)";
56.1374 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1375 +term2str t;
56.1376 +if (term2str t) =
56.1377 +"(-3 + x) / (2 + x)"
56.1378 +then ()
56.1379 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 26";
56.1380 +
56.1381 +"----- Schalk I, p.68 Nr. 440b SK11 works since 0707xx";
56.1382 +val t = str2term
56.1383 +"(a^^^3 - 9*a)/(a^^^3*b - a*b^^^3)*(a^^^2*b+a*b^^^2)/(a+3)";
56.1384 +val SOME (t,_) = rewrite_set_ thy false norm_Rational t;
56.1385 +if term2str t = "(-3 * a + a ^^^ 2) / (a + -1 * b)" then ()
56.1386 +else raise error "rational.sml.sml: diff.behav. in norm_Rational 27";
56.1387 +
56.1388 +"----- SK12 works since 0707xx";
56.1389 +val t = str2term "(a^^^3 - 9*a)*(a^^^2*b+a*b^^^2)/((a^^^3*b - a*b^^^3)*(a+3))";
56.1390 +val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t';
56.1391 +if term2str t' = "(-3 * a + a ^^^ 2) / (a + -1 * b)" then ()
56.1392 +else raise error "rational.sml.sml: diff.behav. in norm_Rational 28";
56.1393 +
56.1394 +
56.1395 +"-------- common denominator and multiplication ------------------";
56.1396 +"-------- common denominator and multiplication ------------------";
56.1397 +"-------- common denominator and multiplication ------------------";
56.1398 +
56.1399 +(*----------------------------------------------------------------------*)
56.1400 +(*--------- Gemeinsamer Nenner und Multiplikation von Bruechen ---------*)
56.1401 +(*----------------------------------------------------------------------*)
56.1402 +
56.1403 +
56.1404 +(*SRAM Schalk I, p.69 Nr. 441b *)
56.1405 +val t = str2term "(4*a/3 + 3*b^^^2/a^^^3 + b/(4*a))*(4*b/(3*a))";
56.1406 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1407 +term2str t;
56.1408 +if (term2str t) =
56.1409 +"(36 * b ^^^ 3 + 3 * a ^^^ 2 * b ^^^ 2 + 16 * a ^^^ 4 * b) / (9 * a ^^^ 4)"
56.1410 +then ()
56.1411 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 28";
56.1412 +
56.1413 +(*SRAM Schalk I, p.69 Nr. 442b *)
56.1414 +val t = str2term "(15*a^^^2/x^^^3 - 5*b^^^4/x^^^2 + 25*c^^^2/x)*(x^^^3/(5*a*b^^^3*c^^^3)) + 1/c^^^3 * (b*x/a - 3*a/b^^^3)";
56.1415 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1416 +term2str t;
56.1417 +if (term2str t) =
56.1418 +"5 * x ^^^ 2 / (a * b ^^^ 3 * c)"
56.1419 +then ()
56.1420 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 29";
56.1421 +
56.1422 +(*SRAM Schalk I, p.69 Nr. 443b *)
56.1423 +val t = str2term "(a/2 + b/3)*(b/3 - a/2)";
56.1424 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1425 +term2str t;
56.1426 +if (term2str t) =
56.1427 +"(-9 * a ^^^ 2 + 4 * b ^^^ 2) / 36"
56.1428 +then ()
56.1429 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 30";
56.1430 +
56.1431 +(*SRAM Schalk I, p.69 Nr. 445b *)
56.1432 +val t = str2term "(a^^^2/9 + 2*a/(3*b) + 4/b^^^2)*(a/3 - 2/b) + 8/b^^^3";
56.1433 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1434 +term2str t;
56.1435 +if (term2str t) =
56.1436 +"a ^^^ 3 / 27"
56.1437 +then ()
56.1438 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 31";
56.1439 +
56.1440 +(*SRAM Schalk I, p.69 Nr. 446b *)
56.1441 +val t = str2term "(x/(5*x + 4*y) - y/(5*x - 4*y) + 1)*(25*x^^^2 - 16*y^^^2)";
56.1442 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1443 +term2str t;
56.1444 +if (term2str t) =
56.1445 +"30 * x ^^^ 2 + -9 * x * y + -20 * y ^^^ 2"
56.1446 +then ()
56.1447 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 32";
56.1448 +
56.1449 +(*SRAM Schalk I, p.69 Nr. 449a *)(*Achtung: rechnet ca 8 Sekunden*)
56.1450 +val t = str2term
56.1451 +"(2*x^^^2/(3*y)+x/y^^^2)*(4*x^^^4/(9*y^^^2)+x^^^2/y^^^4)*(2*x^^^2/(3*y) - x/y^^^2)";
56.1452 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1453 +term2str t;
56.1454 +if (term2str t) =
56.1455 +"(-81 * x ^^^ 4 + 16 * x ^^^ 8 * y ^^^ 4) / (81 * y ^^^ 8)"
56.1456 +then ()
56.1457 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 33";
56.1458 +
56.1459 +(*SRAM Schalk I, p.69 Nr. 450a *)
56.1460 +val t = str2term
56.1461 +"(4*x/(3*y)+2*y/(3*x))^^^2 - (2*y/(3*x) - 2*x/y)*(2*y/(3*x)+2*x/y)";
56.1462 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1463 +term2str t;
56.1464 +if (term2str t) =
56.1465 +"(52 * x ^^^ 2 + 16 * y ^^^ 2) / (9 * y ^^^ 2)"
56.1466 +then ()
56.1467 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 34";
56.1468 +
56.1469 +"-------- double fractions ---------------------------------------";
56.1470 +"-------- double fractions ---------------------------------------";
56.1471 +"-------- double fractions ---------------------------------------";
56.1472 +
56.1473 +(*SRD Schalk I, p.69 Nr. 454b *)
56.1474 +val t = str2term
56.1475 +"((2 - x)/(2*a)) / (2*a/(x - 2))";
56.1476 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1477 +term2str t;
56.1478 +if (term2str t) =
56.1479 +"(-4 + 4 * x + -1 * x ^^^ 2) / (4 * a ^^^ 2)"
56.1480 +then ()
56.1481 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 35";
56.1482 +
56.1483 +(*SRD Schalk I, p.69 Nr. 455a *)
56.1484 +val t = str2term
56.1485 +"(a^^^2 + 1)/(a^^^2 - 1) / ((a+1)/(a - 1))";
56.1486 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1487 +term2str t;
56.1488 +if (term2str t) =
56.1489 +"(1 + a ^^^ 2) / (1 + 2 * a + a ^^^ 2)" then ()
56.1490 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 36";
56.1491 +
56.1492 +
56.1493 +"----- Schalk I, p.69 Nr. 455b";
56.1494 +val t = str2term "(x^^^2 - 4)/(y^^^2 - 9)/((2+x)/(3 - y))";
56.1495 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1496 +if term2str t = "(2 + -1 * x) / (3 + y)" then ()
56.1497 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 37";
56.1498 +
56.1499 +"----- SK060904-1a non-termination of cancel_p_ ?: worked before 0707xx";
56.1500 +val t = str2term "(x^^^2 - 4)*(3 - y)/((y^^^2 - 9)*(2+x))";
56.1501 +val SOME (t,_) = rewrite_set_ thy false norm_Rational t;
56.1502 +if term2str t = "(2 + -1 * x) / (3 + y)" then ()
56.1503 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 37b";
56.1504 +
56.1505 +"----- ?: worked before 0707xx";
56.1506 +val t = str2term "(3 + -1 * y) / (-9 + y ^^^ 2)";
56.1507 +val SOME (t,_) = rewrite_set_ thy false norm_Rational t;
56.1508 +if term2str t = "-1 / (3 + y)" then ()
56.1509 +else raise error "rational.sml: -1 / (3 + y) norm_Rational";
56.1510 +
56.1511 +(*SRD Schalk I, p.69 Nr. 456b *)
56.1512 +val t = str2term
56.1513 +"(b^^^3 - b^^^2)/(b^^^2+b)/(b^^^2 - 1)";
56.1514 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1515 +term2str t;
56.1516 +if (term2str t) = "b / (1 + 2 * b + b ^^^ 2)" then ()
56.1517 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 38";
56.1518 +
56.1519 +(*SRD Schalk I, p.69 Nr. 457b *)
56.1520 +val t = str2term
56.1521 +"(16*a^^^2 - 9*b^^^2)/(2*a+3*a*b) / ((4*a+3*b)/(4*a^^^2 - 9*a^^^2*b^^^2))";
56.1522 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1523 +term2str t;
56.1524 +if (term2str t) =
56.1525 +"8 * a ^^^ 2 + -6 * a * b + -12 * a ^^^ 2 * b + 9 * a * b ^^^ 2"
56.1526 +then ()
56.1527 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 39";
56.1528 +
56.1529 +"----- Schalk I, p.69 Nr. 458b works since 0707";
56.1530 +val t = str2term
56.1531 +"(2*a^^^2*x - a^^^2)/(a*x - b*x) / (b^^^2*(2*x - 1)/(x*(a - b)))";
56.1532 +val SOME (t,_) = rewrite_set_ thy false norm_Rational t;
56.1533 +if term2str t = "a ^^^ 2 / b ^^^ 2" then ()
56.1534 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 39b";
56.1535 +
56.1536 +(*SRD Schalk I, p.69 Nr. 459b *)
56.1537 +val t = str2term "(a^^^2 - b^^^2)/(a*b) / (4*(a+b)^^^2/a)";
56.1538 +val SOME (t,_) = rewrite_set_ thy false norm_Rational t;
56.1539 +if term2str t = "(a + -1 * b) / (4 * a * b + 4 * b ^^^ 2)" then ()
56.1540 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 41";
56.1541 +
56.1542 +
56.1543 +(*Schalk I, p.69 Nr. 460b nonterm.SK
56.1544 +val t = str2term
56.1545 +"(9*(x^^^2 - 8*x+16)/(4*(y^^^2 - 2*y+1)))/((3*x - 12)/(16*y - 16))";
56.1546 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1547 +if term2str t =
56.1548 +then ()
56.1549 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 42";
56.1550 +
56.1551 +val t = str2term
56.1552 +"9*(x^^^2 - 8*x+16)*(16*y - 16)/(4*(y^^^2 - 2*y+1)*(3*x - 12))";
56.1553 +val SOME (t',_) = rewrite_set_ thy false norm_Rational t;
56.1554 +... non terminating.
56.1555 +val SOME (t',_) = rewrite_set_ thy false make_polynomial t;
56.1556 +"(-2304 + 1152 * x + 2304 * y + -144 * x ^^^ 2 + -1152 * x * y + 144 * x ^^^ 2 * y) /(-48 + 12 * x + 96 * y + -24 * x * y + -48 * y ^^^ 2 + 12 * x * y ^^^ 2)";
56.1557 +val SOME (t,_) = rewrite_set_ thy false cancel_p t';
56.1558 +... non terminating.*)
56.1559 +
56.1560 +(*SRD Schalk I, p.70 Nr. 472a *)
56.1561 +val t = str2term "((8*x^^^2 - 32*y^^^2)/(2*x + 4*y))/\
56.1562 + \((4*x - 8*y)/(x + y))";
56.1563 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1564 +term2str t;
56.1565 +if (term2str t) =
56.1566 +"x + y"
56.1567 +then ()
56.1568 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 43";
56.1569 +
56.1570 +
56.1571 +(*----------------------------------------------------------------------*)
56.1572 +(*---------------------- Einfache Dppelbrche --------------------------*)
56.1573 +(*----------------------------------------------------------------------*)
56.1574 +
56.1575 +(*SRD Schalk I, p.69 Nr. 461a *)
56.1576 +val t = str2term
56.1577 +"(2/(x+3) + 2/(x - 3)) / (8*x/(x^^^2 - 9))";
56.1578 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1579 +term2str t;
56.1580 +if (term2str t) =
56.1581 +"1 / 2"
56.1582 +then ()
56.1583 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 44";
56.1584 +
56.1585 +(*SRD Schalk I, p.69 Nr. 464b *)
56.1586 +val t = str2term
56.1587 +"(a - a/(a - 2)) / (a + a/(a - 2))";
56.1588 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1589 +term2str t;
56.1590 +if (term2str t) =
56.1591 +"(3 + -1 * a) / (1 + -1 * a)"
56.1592 +then ()
56.1593 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 45";
56.1594 +
56.1595 +(*SRD Schalk I, p.69 Nr. 465b *)
56.1596 +val t = str2term
56.1597 +"((x+3*y)/9 + (4*y^^^2 - 9*z^^^2)/(16*x)) /(x/9+y/6+z/4)";
56.1598 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1599 +term2str t;
56.1600 +if (term2str t) =
56.1601 +"(4 * x + 6 * y + -9 * z) / (4 * x)"
56.1602 +then ()
56.1603 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 46";
56.1604 +
56.1605 +(*SRD Schalk I, p.69 Nr. 466b *)
56.1606 +val t = str2term
56.1607 +"((1 - 7*(x - 2)/(x^^^2 - 4)) / (6/(x+2))) / (3/(x+5)+30/(x^^^2 - 25))";
56.1608 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1609 +term2str t;
56.1610 +if (term2str t) =
56.1611 +"(25 + -10 * x + x ^^^ 2) / 18"
56.1612 +then ()
56.1613 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 47";
56.1614 +
56.1615 +(*SRD Schalk I, p.70 Nr. 469 *)
56.1616 +val t = str2term
56.1617 +"3*b^^^2/(4*a^^^2 - 8*a*b + 4*b^^^2)/(a/(a^^^2*b - b^^^3) + (a - b)/(4*a*b^^^2+4*b^^^3) - 1/(4*b^^^2))";
56.1618 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1619 +term2str t;
56.1620 +if (term2str t) =
56.1621 +"3 * b ^^^ 3 / (2 * a + -2 * b)"
56.1622 +then ()
56.1623 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 48";
56.1624 +
56.1625 +(*----------------------------------------------------------------------*)
56.1626 +(*---------------------- Mehrfache Dppelbrueche ------------------------*)
56.1627 +(*----------------------------------------------------------------------*)
56.1628 +
56.1629 +(*SRD.test Schalk I, p.70 Nr. 476b *) (* Rechenzeit: 10 sec *)
56.1630 +(*WN060419 crashes with method 'simplify' ????SK*)
56.1631 +val t = str2term
56.1632 +"((a^^^2 - b^^^2)/(2*a*b)+2*a*b/(a^^^2 - b^^^2))/((a^^^2+b^^^2)/(2*a*b)+1) / ((a^^^2+b^^^2)^^^2/(a+b)^^^2)";
56.1633 +val SOME (t,_) = rewrite_set_ thy false norm_Rational t;
56.1634 +if term2str t = "1 / (a ^^^ 2 + -1 * b ^^^ 2)" then ()
56.1635 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 49";
56.1636 +
56.1637 +"----- Schalk I, p.70 Nr. 477a";
56.1638 +(* MG Achtung: terme explodieren; Bsp zu komplex;
56.1639 + L???ung sollte (ziemlich grosser) Faktorisierter Ausdruck sein
56.1640 +val t = str2term "b*y/(b - 2*y)/((b^^^2 - y^^^2)/(b+2*y)) /\
56.1641 + \(b^^^2*y+b*y^^^2)*(a+x)^^^2/((b^^^2 - 4*y^^^2)*(a+2*x)^^^2)";
56.1642 +val SOME (t',_) = rewrite_set_ thy false norm_Rational t;
56.1643 +
56.1644 +
56.1645 +val t = str2term "b*y*(b+2*y)*(b^^^2 - 4*y^^^2)*(a+2*x)^^^2 / \
56.1646 + \((b - 2*y)*(b^^^2 - y^^^2)*(b^^^2*y+b*y^^^2)*(a+x)^^^2)";
56.1647 +val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
56.1648 +????SK ???MG*)
56.1649 +
56.1650 +
56.1651 +"----- Schalk I, p.70 Nr. 478b ----- Rechenzeit: 5 sec";
56.1652 +val t = str2term "(a - (a*b+b^^^2)/(a+b))/(b+(a - b)/(1+(a+b)/(a - b))) / \
56.1653 + \((a - a^^^2/(a+b))/(a+(a*b)/(a - b)))";
56.1654 +val SOME (t',_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1655 +if term2str t' =
56.1656 +"(2 * a ^^^ 3 + 2 * a ^^^ 2 * b) / (a ^^^ 2 * b + b ^^^ 3)"
56.1657 +then ()
56.1658 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 51";
56.1659 +
56.1660 +(* TODO.new_c:WN050820 STOP_REW_SUB introduced gave ...
56.1661 +if term2str t' = "(a ^^^ 4 + -1 * a ^^^ 2 * b ^^^ 2) /\n(a * b * (b + (a * (a + -1 * b) + -1 * b * (a + -1 * b)) / (2 * a)) *\n (a + -1 * b))" then ()
56.1662 +else raise error "rational.sml: works again";
56.1663 +re-outcommented with TODO.new_c: cvs before 071227, 11:50*)
56.1664 +
56.1665 +
56.1666 +
56.1667 +(*Schalk I, p.70 Nr. 480a *)
56.1668 +(* Achtung: rechnet ewig; cancel_p kann nicht krzen: WN060831 nonterm.SK00
56.1669 +val t = str2term
56.1670 +"(1/x+1/y+1/z)/(1/x - 1/y - 1/z) / (2*x^^^2/(x^^^2 - z^^^2)/(x/(x+z)+x/(x - z)))";
56.1671 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1672 +term2str t;
56.1673 +if (term2str t) =
56.1674 +
56.1675 +then ()
56.1676 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 52";
56.1677 +
56.1678 +(*MG Berechne Zwischenergebnisse: WN060831 nonterm.SK00*)
56.1679 +val t = str2term
56.1680 +"(1/x+1/y+1/z)/(1/x - 1/y - 1/z)";
56.1681 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1682 +term2str t;
56.1683 +"(x ^^^ 2 * y ^^^ 2 * z + x ^^^ 2 * y * z ^^^ 2 + x * y ^^^ 2 * z ^^^ 2) /
56.1684 +(-1 * x ^^^ 2 * y ^^^ 2 * z + -1 * x ^^^ 2 * y * z ^^^ 2 + x * y ^^^ 2 * z ^^^ 2)";
56.1685 +val t = str2term
56.1686 +"2*x^^^2/(x^^^2 - z^^^2)/(x/(x+z)+x/(x - z))";
56.1687 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1688 +term2str t;
56.1689 +"1"
56.1690 +
56.1691 +(* SK 1. Ausdruck kann nicht weiter gekrzt werden; cancel_p !!!*)
56.1692 +### rls: cancel_p on:
56.1693 +(x ^^^ 2 * (y ^^^ 2 * z) + x ^^^ 2 * (y * z ^^^ 2) + x * (y ^^^ 2 * z ^^^ 2)) /
56.1694 +(-1 * (x ^^^ 2 * (y ^^^ 2 * z)) + -1 * (x ^^^ 2 * (y * z ^^^ 2)) + x * (y ^^^ 2 * z ^^^ 2))
56.1695 +GC #3.61.81.101.197.17503: (0 ms)
56.1696 +*** RATIONALS_DIRECT_CANCEL_EXCEPTION: Invalid fraction
56.1697 +
56.1698 +val t = str2term
56.1699 +"(x^^^2 * (y^^^2 * z) + x^^^2 * (y * z^^^2) + x * (y^^^2 * z^^^2)) / (-1 * (x^^^2 * (y^^^2 * z)) + -1 * (x^^^2 * (y * z^^^2)) + x * (y^^^2 * z^^^2))";
56.1700 +val SOME (t,_) = rewrite_set_ thy false cancel_p t;
56.1701 +term2str t;
56.1702 +(*uncaught exception nonexhaustive binding failure*)
56.1703 +
56.1704 +(* Das kann er aber krzen !!????: *)
56.1705 +val t = str2term
56.1706 +"(x^^^2 * (y^^^2 * z) + x * (y^^^2 * z^^^2)) / (-1 * (x^^^2 * (y * z^^^2)) + x * (y^^^2 * z^^^2))";
56.1707 +val SOME (t,_) = rewrite_set_ thy false cancel_p t;
56.1708 +term2str t;
56.1709 +"(-1 * (y * x) + -1 * (z * y)) / (1 * (z * x) + -1 * (z * y))";
56.1710 +*)
56.1711 +
56.1712 +
56.1713 +
56.1714 +
56.1715 +
56.1716 +
56.1717 +(*--------------------------------------------------------------------*)
56.1718 +(*----------------------- Problem-Beispiele --------------------------*)
56.1719 +(*--------------------------------------------------------------------*)
56.1720 +
56.1721 +(*Schalk I, p.60 Nr. 215d *)
56.1722 +(* Achtung: rechnet ewig ...
56.1723 +val t = str2term "(a-b)^^^3 * (x+y)^^^4 / ((x+y)^^^2 * (a-b)^^^5)";
56.1724 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1725 +term2str t; noterm.SK
56.1726 +*)
56.1727 +
56.1728 +(* Kein Wunder, denn Z???ler und Nenner extra als Polynom dargestellt ergibt:*)
56.1729 +(*
56.1730 +val t = str2term "(a-b)^^^3 * (x+y)^^^4";
56.1731 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1732 +term2str t;
56.1733 +"a^^^3 * x^^^4 + 4 * a^^^3 * x^^^3 * y +\n6 * a^^^3 * x^^^2 * y^^^2 +\n4 * a^^^3 * x * y^^^3 +\na^^^3 * y^^^4 +\n-3 * a^^^2 * b * x^^^4 +\n-12 * a^^^2 * b * x^^^3 * y +\n-18 * a^^^2 * b * x^^^2 * y^^^2 +\n-12 * a^^^2 * b * x * y^^^3 +\n-3 * a^^^2 * b * y^^^4 +\n3 * a * b^^^2 * x^^^4 +\n12 * a * b^^^2 * x^^^3 * y +\n18 * a * b^^^2 * x^^^2 * y^^^2 +\n12 * a * b^^^2 * x * y^^^3 +\n3 * a * b^^^2 * y^^^4 +\n-1 * b^^^3 * x^^^4 +\n-4 * b^^^3 * x^^^3 * y +\n-6 * b^^^3 * x^^^2 * y^^^2 +\n-4 * b^^^3 * x * y^^^3 +\n-1 * b^^^3 * y^^^4";
56.1734 +val t = str2term "((x+y)^^^2 * (a-b)^^^5)";
56.1735 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1736 +term2str t;
56.1737 +"a^^^5 * x^^^2 + 2 * a^^^5 * x * y + a^^^5 * y^^^2 +\n-5 * a^^^4 * b * x^^^2 +\n-10 * a^^^4 * b * x * y +\n-5 * a^^^4 * b * y^^^2 +\n10 * a^^^3 * b^^^2 * x^^^2 +\n20 * a^^^3 * b^^^2 * x * y +\n10 * a^^^3 * b^^^2 * y^^^2 +\n-10 * a^^^2 * b^^^3 * x^^^2 +\n-20 * a^^^2 * b^^^3 * x * y +\n-10 * a^^^2 * b^^^3 * y^^^2 +\n5 * a * b^^^4 * x^^^2 +\n10 * a * b^^^4 * x * y +\n5 * a * b^^^4 * y^^^2 +\n-1 * b^^^5 * x^^^2 +\n-2 * b^^^5 * x * y +\n-1 * b^^^5 * y^^^2";
56.1738 +*)
56.1739 +(*anscheinend macht dem Rechner das Krzen diese Bruches keinen Spass mehr ...*)
56.1740 +
56.1741 +(*--------------------------------------------------------------------*)
56.1742 +(*Schalk I, p.70 Nr. 480b
56.1743 +val t = str2term "((12*x*y/(9*x^^^2 - y^^^2))/\
56.1744 + \(1/(3*x - y)^^^2 - 1/(3*x + y)^^^2)) *\
56.1745 + \(1/(x - 5*y)^^^2 - 1/(x + 5*y)^^^2)/\
56.1746 + \(20*x*y/(x^^^2 - 25*y^^^2))";
56.1747 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1748 +SK.nonterm
56.1749 +Kann nicht weiter vereinfacht werden !!!!?? *)
56.1750 +
56.1751 +(*--------------------------------------------------------------------*)
56.1752 +"---- MGs test set";
56.1753 +val t = str2term " (1 + x^^^5) / (y + x) + x^^^3 / x ";
56.1754 +val SOME (t,_) = rewrite_set_ thy false common_nominator_p t;
56.1755 +if term2str t = "(1 + x ^^^ 3 + x ^^^ 5 + y * x ^^^ 2) / (x + y)" then()
56.1756 +else raise error "";
56.1757 +
56.1758 +(*--------------------------------------------------------------------*)
56.1759 +(* cancel_p liefert nicht immer Polynomnormalform (2): WN060831???SK3b
56.1760 + ---> Sortierung FALSCH !! *)
56.1761 +val t = str2term "b^^^3 * a^^^5/a ";
56.1762 +val SOME (t,_) = rewrite_set_ thy false cancel_p t;
56.1763 +term2str t;
56.1764 +"1 * (a^^^4 * b^^^3) / 1"; (*OK*)
56.1765 +
56.1766 +val t = str2term "b^^^3 * a^^^5/b ";
56.1767 +val SOME (t,_) = rewrite_set_ thy false cancel_p t;
56.1768 +term2str t;
56.1769 +"1 * (b^^^2 * a^^^5) / 1"; (*cancel_p sortiert hier falsch um!*)
56.1770 +
56.1771 +(* Problem liegt NICHT bei ord_make_polynomial! (siehe folgende Bsple) *)
56.1772 +(*
56.1773 +val x = str2term "x"; val bdv = str2term "bdv";
56.1774 +val t1 = str2term "b^^^2 * a^^^5";
56.1775 +val t2 = str2term "a^^^5 * b^^^2 ";
56.1776 +ord_make_polynomial false Rational.thy [(x,bdv)] (t1,t2); (*false*)
56.1777 +*)
56.1778 +(* ==> "b^^^2 * a^^^5" > "a^^^5 * b^^^2 " ... OK!*)
56.1779 +
56.1780 +(*--------------------------------------------------------------------*)
56.1781 +(* cancel_p liefert nicht immer Polynomnormalform (2): WN060831???SK3c
56.1782 + ---> erzeugt berflssige "1 * ..."
56.1783 +
56.1784 +val t = str2term "-1 / (3 + y)";
56.1785 +(*~~ *)
56.1786 +val SOME (t,_) = rewrite_set_ thy false cancel_p t;
56.1787 +term2str t;
56.1788 +"-1 / (3 + 1 * y)";
56.1789 +(********* Das ist das PROBLEM !!!!!!!??? *******************)
56.1790 +(* -1 im Z???ler der Angabe verursacht das Problem !*)
56.1791 +*)
56.1792 +
56.1793 +(* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *)
56.1794 +"----- MGs test set";
56.1795 +val t = str2term "(a^^^2 + -1)/(a+1)";
56.1796 +val SOME (t',_) = rewrite_set_ thy false cancel_p t;
56.1797 +if term2str t' = "(-1 + a) / 1" then ()
56.1798 +else raise error "rational.sml MG tests 3d";
56.1799 +
56.1800 +"----- NOT TERMINATING ?: worked before 0707xx";
56.1801 +val t = str2term "(a^^^2 - 1)*(b + 1) / ((b^^^2 - 1)*(a+1))";
56.1802 +val SOME (t'',_) = rewrite_set_ thy false norm_Rational t;
56.1803 +if term2str t'' = "(1 + -1 * a) / (1 + -1 * b)" then ()
56.1804 +else raise error "rational.sml MG tests 3e";
56.1805 +
56.1806 +"----- corrected SK060905";
56.1807 +val t = str2term "(4*x^^^2 - 20*x + 25)/(2*x - 5)^^^3";
56.1808 +val SOME (t',_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1809 +if term2str t' = "-1 / (5 + -2 * x)" then ()
56.1810 +else raise error "rational.sml corrected SK060905";
56.1811 +
56.1812 +
56.1813 +"--------------------------------------------------------------------";
56.1814 +"----------------------- Muster-Beispiele fuer DA -------------------";
56.1815 +"--------------------------------------------------------------------";
56.1816 +
56.1817 +(*SRAM Schalk I, p.69 Nr. 442b --- abgewandelt*)
56.1818 +val t = str2term
56.1819 +"(15*a^^^4/(a*x^^^3) - 5*a*((b^^^4 - 5*c^^^2*x)/x^^^2))*(x^^^3/(5*a*b^^^3*c^^^3)) + a/c^^^3 * (x*(b/a) - 3*b*(a/b^^^4))";
56.1820 +val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t;
56.1821 +term2str t;
56.1822 +if (term2str t) =
56.1823 +"5 * x ^^^ 2 / (b ^^^ 3 * c)"
56.1824 +then ()
56.1825 +else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 53";
56.1826 +
56.1827 +"-------- me Schalk I No.186 -------------------------------------";
56.1828 +"-------- me Schalk I No.186 -------------------------------------";
56.1829 +"-------- me Schalk I No.186 -------------------------------------";
56.1830 +val fmz = ["term ((14 * x * y) / ( x * y ))",
56.1831 + "normalform N"];
56.1832 +val (dI',pI',mI') =
56.1833 + ("Rational.thy",["rational","simplification"],
56.1834 + ["simplification","of_rationals"]);
56.1835 +val p = e_pos'; val c = [];
56.1836 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
56.1837 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
56.1838 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
56.1839 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
56.1840 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
56.1841 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
56.1842 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
56.1843 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
56.1844 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
56.1845 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
56.1846 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;(*++ for explicit script*)
56.1847 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;(*++ for explicit script*)
56.1848 +case (f2str f, nxt) of
56.1849 + ("14", ("End_Proof'", _)) => ()
56.1850 + | _ => raise error "rational.sml diff.behav. in me Schalk I No.186";
56.1851 +
56.1852 +
56.1853 +"-------- interSteps ..Simp_Rat_Double_No-1.xml ------------------";
56.1854 +"-------- interSteps ..Simp_Rat_Double_No-1.xml ------------------";
56.1855 +"-------- interSteps ..Simp_Rat_Double_No-1.xml ------------------";
56.1856 +states:=[];
56.1857 +CalcTree
56.1858 +[(["term (((2 - x)/(2*a)) / (2*a/(x - 2)))", "normalform N"],
56.1859 + ("Rational.thy",["rational","simplification"],
56.1860 + ["simplification","of_rationals"]))];
56.1861 +Iterator 1;
56.1862 +moveActiveRoot 1;
56.1863 +autoCalculate 1 CompleteCalc;
56.1864 +val ((pt,p),_) = get_calc 1; show_pt pt;
56.1865 +
56.1866 +interSteps 1 ([1],Res);
56.1867 +val ((pt,p),_) = get_calc 1; show_pt pt;
56.1868 +
56.1869 +
56.1870 +"-------- interSteps ..Simp_Rat_Cancel_No-1.xml ------------------";
56.1871 +"-------- interSteps ..Simp_Rat_Cancel_No-1.xml ------------------";
56.1872 +"-------- interSteps ..Simp_Rat_Cancel_No-1.xml ------------------";
56.1873 +states:=[];
56.1874 +CalcTree
56.1875 +[(["term ((a^2 + -1*b^2) / (a^2 + -2*a*b + b^2))", "normalform N"],
56.1876 + ("Rational.thy",["rational","simplification"],
56.1877 + ["simplification","of_rationals"]))];
56.1878 +Iterator 1;
56.1879 +moveActiveRoot 1;
56.1880 +autoCalculate 1 CompleteCalc;
56.1881 +val ((pt,p),_) = get_calc 1; show_pt pt;
56.1882 +(*with explicit script done already... and removed [1,..] at below...
56.1883 +interSteps 1 ([1],Res);
56.1884 +val ((pt,p),_) = get_calc 1; show_pt pt;
56.1885 +*)
56.1886 +interSteps 1 ([2],Res);
56.1887 +val ((pt,p),_) = get_calc 1; show_pt pt;
56.1888 +
56.1889 +interSteps 1 ([2,1],Res);
56.1890 +val ((pt,p),_) = get_calc 1; show_pt pt;
56.1891 +val newnds = children (get_nd pt [2,1]) (*see "fun detailrls"*);
56.1892 +(*if length newnds = 12 then () WN060905*)
56.1893 +if length newnds = 13 then ()
56.1894 +else raise error "rational.sml: interSteps cancel_p rev_rew_p";
56.1895 +
56.1896 +val p = ([2,1,9],Res);
56.1897 +getTactic 1 p;
56.1898 +val (_, tac, _) = pt_extract (pt, p);
56.1899 +(*case tac of SOME (Rewrite ("sym_real_plus_binom_times1", _)) => ()
56.1900 +WN060905*)
56.1901 +case tac of SOME (Rewrite ("sym_real_add_mult_distrib2", _)) => ()
56.1902 +| _ => raise error "rational.sml: getTactic, sym_real_plus_binom_times1";
56.1903 +
56.1904 +
56.1905 +"-------- investigate rulesets for cancel_p ----------------------";
56.1906 +"-------- investigate rulesets for cancel_p ----------------------";
56.1907 +"-------- investigate rulesets for cancel_p ----------------------";
56.1908 +val thy = Rational.thy;
56.1909 +"---------------- (a^^^2 + -1*b^^^2) / (a^^^2 + -2*a*b + b^^^2)";
56.1910 +val t = str2term "(a^^^2 + -1*b^^^2) / (a^^^2 + -2*a*b + b^^^2)";
56.1911 +val tt = str2term "(1 * a + 1 * b) * (1 * a + -1 * b)"(*numerator only*);
56.1912 +"----- with rewrite_set_";
56.1913 +val SOME (tt',asm) = rewrite_set_ thy false make_polynomial tt;
56.1914 +term2str tt'= "a ^^^ 2 + -1 * b ^^^ 2" (*true*);
56.1915 +val tt = str2term "((1 * a + -1 * b) * (1 * a + -1 * b))"(*denominator only*);
56.1916 +val SOME (tt',asm) = rewrite_set_ thy false make_polynomial tt;
56.1917 +term2str tt' = "a ^^^ 2 + -2 * a * b + b ^^^ 2" (*true*);
56.1918 +
56.1919 +"----- with make_deriv";
56.1920 +val SOME (tt, _) = factout_p_ Isac.thy t; term2str tt =
56.1921 +"(1 * a + 1 * b) * (1 * a + -1 * b) / ((1 * a + -1 * b) * (1 * a + -1 * b))";
56.1922 +(*
56.1923 +"--- with ruleset as before 060829";
56.1924 +val {rules, rew_ord=(_,ro),...} =
56.1925 + rep_rls (assoc_rls "make_polynomial");
56.1926 +val der = make_deriv thy Atools_erls rules ro NONE tt;
56.1927 +print_depth 99; map (term2str o #1) der; print_depth 3;
56.1928 +print_depth 99; map (rule2str o #2) der; print_depth 3;
56.1929 +... did not terminate"*)
56.1930 +"--- with simpler ruleset";
56.1931 +val {rules, rew_ord=(_,ro),...} =
56.1932 + rep_rls (assoc_rls "rev_rew_p");
56.1933 +val der = make_deriv thy Atools_erls rules ro NONE tt;
56.1934 +print_depth 99; writeln (deriv2str der); print_depth 3;
56.1935 +
56.1936 +print_depth 99; map (term2str o #1) der; print_depth 3;
56.1937 +"...,(-1 * b ^^^ 2 + a ^^^ 2) / (-2 * (a * b) + a ^^^ 2 + (-1 * b) ^^^ 2) ]";
56.1938 +print_depth 99; map (rule2str o #2) der; print_depth 3;
56.1939 +print_depth 99; map (term2str o #1 o #3) der; print_depth 3;
56.1940 +
56.1941 +val der = make_deriv thy Atools_erls rules ro NONE
56.1942 + (str2term "(1 * a + 1 * b) * (1 * a + -1 * b)");
56.1943 +print_depth 99; writeln (deriv2str der); print_depth 3;
56.1944 +
56.1945 +val {rules, rew_ord=(_,ro),...} =
56.1946 + rep_rls (assoc_rls "rev_rew_p");
56.1947 +val der = make_deriv thy Atools_erls rules ro NONE
56.1948 + (str2term "(1 * a + -1 * b) * (1 * a + -1 * b)");
56.1949 +print_depth 99; writeln (deriv2str der); print_depth 3;
56.1950 +print_depth 99; map (term2str o #1) der; print_depth 3;
56.1951 +(*WN060829 ...postponed*)
56.1952 +
56.1953 +
56.1954 +"-------- investigate format of factout_ and factout_p_ ----------";
56.1955 +"-------- investigate format of factout_ and factout_p_ ----------";
56.1956 +"-------- investigate format of factout_ and factout_p_ ----------";
56.1957 +val {rules, rew_ord = (_,ro),...} = rep_rls (assoc_rls "make_polynomial");
56.1958 +val (thy, eval_rls) = (Rational.thy, Atools_erls)(*see 'fun init_state'*);
56.1959 +val Rrls {scr = Rfuns {init_state,...},...} = assoc_rls "cancel_p";
56.1960 +
56.1961 +"----- see Rational.ML, local cancel_p, fun init_state";
56.1962 +val t = str2term "(a^^^2 + (-1)*b^^^2) / (a^^^2 + (-2)*a*b + b^^^2)";
56.1963 +val SOME (t',_) = factout_p_ thy t; term2str t';
56.1964 +(*
56.1965 +val rtas = reverse_deriv thy eval_rls rules ro NONE t';
56.1966 +writeln(trtas2str rst);
56.1967 +*)
56.1968 +
56.1969 +
56.1970 +"----- see Rational.ML, local cancel_p, fun init_state";
56.1971 +val t = str2term "a^^^2 / a";
56.1972 +val SOME (t',_) = factout_p_ thy t;
56.1973 +term2str t' = "a * a / (1 * a)" (*true*);
56.1974 +(*... can be canceled with
56.1975 +real_mult_div_cancel2 ?k ~= 0 ==> ?m * ?k / (?n * ?k) = ?m / ?n"*)
56.1976 +(* sml/ME/rewtools.sml:
56.1977 +val rtas = reverse_deriv thy Atools_erls rules ro NONE t';
56.1978 +writeln (deri2str rtas);
56.1979 +*)
56.1980 +
56.1981 +
56.1982 +
56.1983 +"-------- SK 060904 ----------------------------------------------";
56.1984 +"-------- SK 060904 ----------------------------------------------";
56.1985 +"-------- SK 060904 ----------------------------------------------";
56.1986 +"----- order on polynomials -- input + output";
56.1987 +val thy = Isac.thy;
56.1988 +val t = str2term "(a + -1 * b) / (-1 * a + b)";
56.1989 +val SOME (t', _) = factout_p_ thy t; term2str t';
56.1990 +val SOME (t', _) = cancel_p_ thy t; term2str t';
56.1991 +
56.1992 +val t = str2term "a*b*c*d / (d*e*f*g)";
56.1993 +val SOME (t', _) = cancel_p_ thy t; term2str t';
56.1994 +
56.1995 +val t = str2term "a*(b*(c*d)) / (b*(e*(f*g)))";
56.1996 +val SOME (t', _) = cancel_p_ thy t; term2str t';
56.1997 +(*???order.SK ???*)
56.1998 +
56.1999 +"----- SK060904-1a non-termination of cancel_p_ ? worked before 0707xx";
56.2000 +val t = str2term "(x^^^2 - 4)*(3 - y) / ((y^^^2 - 9)*(2+x))";
56.2001 +val SOME (t',_) = rewrite_set_ thy false norm_Rational t;
56.2002 +if term2str t' = "(2 + -1 * x) / (3 + y)" then ()
56.2003 +else raise error "rational.sml SK060904-1a worked since 0707xx";
56.2004 +
56.2005 +"----- SK060904-1b non-termination of cancel_p_ ... worked before 0707xx";
56.2006 +val t = str2term "(9 * a ^^^ 2 + -16 * b ^^^ 2) /\
56.2007 +\(36 * a^^^2 * c + (27 * a^^^2 * e + (-64 * b^^^2 * c + -48 * b^^^2 * e)))";
56.2008 +val SOME (t',_) = cancel_p_ thy t;
56.2009 +if term2str t' = "1 / (4 * c + 3 * e)" then ()
56.2010 +else raise error "rational.sml SK060904-1b";
56.2011 +
56.2012 +
56.2013 +"----- SK060904-2a non-termination of add_fraction_p_";
56.2014 +val t = str2term " (a + b * x) / (a + -1 * (b * x)) + \
56.2015 + \ (-1 * a + b * x) / (a + b * x) ";
56.2016 +(* nonterm.SK
56.2017 +val SOME (t',_) = rewrite_set_ thy false common_nominator_p t;
56.2018 +
56.2019 +common_nominator_p_ thy t;
56.2020 +" (a + b * x)*(a + b * x) / ((a + -1 * (b * x))*(a + -1 * (b * x))) + \
56.2021 +\ (-1 * a + b * x)*(a + -1 * (b * x)) / ((a + b * x)*(-1 * a + b * x)) ";
56.2022 +
56.2023 +add_fraction_p_ thy t;
56.2024 +" ((a + b * x)*(a + b * x) + (-1 * a + b * x)*(a + -1 * (b * x))) /\
56.2025 +\ ((a + b * x)*(-1 * a + b * x)) ";
56.2026 +*)
56.2027 \ No newline at end of file
57.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
57.2 +++ b/test/Tools/isac/Knowledge/rlang.sml Mon Aug 30 14:35:51 2010 +0200
57.3 @@ -0,0 +1,1883 @@
57.4 +(* use"../smltest/IsacKnowledge/rlang.sml";
57.5 + use"rlang.sml";
57.6 + *)
57.7 +
57.8 +(******************************************************************
57.9 +WN.060104 transfer marked (*E..*)examples to the exp-collection
57.10 + # exp_IsacCore_Equ_Uni_Poly.xml from rlang.sml (*EP*) exp
57.11 + # exp_IsacCore_Equ_Uni_Rat.xml from rlang.sml (*ER*) exp
57.12 + # exp_IsacCore_Equ_Uni_Root.xml from rlang.sml (*EO*) exp
57.13 +*******************************************************************)
57.14 +
57.15 +
57.16 +
57.17 +(*WN.12.6.03: for TODOs search 'writeln', for simplification search MG*)
57.18 +(* use"kbtest/rlang.sml";
57.19 + use"rlang.sml";
57.20 + (c) Richard Lang 2003
57.21 + tests over all equations implemented in his diploma thesis
57.22 + Elementare Gleichungen der Mittelschulmathematik in der ISAC Wissensbasis,
57.23 + Master's thesis, University of Technology, Graz, Austria, March 2003.
57.24 + created: 030228
57.25 + by: rlang
57.26 + last change: 030603
57.27 +*)
57.28 +(*@Book{bSchalk1,
57.29 + author = {Schalk, Heinz-Christian and Binder, Christian and Fertl, Walter and
57.30 + Firneis, Friedrich and Gems, Werner and Lehner, Dieter and
57.31 + Plihal, Andreas and Würl,Manfred},
57.32 + title = {Mathematik für höhere technische Lehranstalten Band I},
57.33 + publisher = {Reniets Verlag},
57.34 + year = {1986},
57.35 + note = {Schulbuch-Nr. 942},
57.36 +}
57.37 +
57.38 +@Book{bSchalk2,
57.39 + author = {Schalk, Heinz-Christian and Baumgartner, Gerhard and Binder, Christian and
57.40 + Eder, Hans Gerhard and Fertl, Walter and Firneis, Friedrich and
57.41 + Konstantiniuk, Peter and Plihal, Andreas and Rümmele, Goswin and
57.42 + Steinwender, Andreas and Zangerl, Nikolaus},
57.43 + title = {Mathematik für höhere technische Lehranstalten Band II},
57.44 + publisher = {Reniets Verlag},
57.45 + year = {1987},
57.46 + note = {Schulbuch-Nr. 1682},
57.47 +}
57.48 +*)
57.49 +
57.50 +(* Compiler.Control.Print.printDepth:=5; (*4 default*)
57.51 +trace_rewrite:=true;
57.52 + trace_rewrite:=false;
57.53 + refine fmz ["univariate","equation"];
57.54 +*)
57.55 +"---- rlang.sml begin-----------------------------------";
57.56 +(*----------------- Schalk I s.86 Bsp 5 ------------------------*)
57.57 +"Schalk I s.86 Bsp 5 (3*x - 1 - (5*x - (2 - 4*x)) = -11)";
57.58 +"Schalk I s.86 Bsp 5 (3*x - 1 - (5*x - (2 - 4*x)) = -11)";
57.59 +"Schalk I s.86 Bsp 5 (3*x - 1 - (5*x - (2 - 4*x)) = -11)";
57.60 +(*EP*)
57.61 +val fmz = ["equality (3*x - 1 - (5*x - (2 - 4*x)) = -11)",
57.62 + "solveFor x","solutions L"];
57.63 +val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
57.64 +(*val p = e_pos';
57.65 +val c = [];
57.66 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
57.67 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
57.68 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.69 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.70 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.71 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.72 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.73 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.74 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.75 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.76 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.77 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.78 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.79 +
57.80 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.81 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.82 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.83 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.84 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 2]")) => ()
57.85 + | _ => raise error "rlang.sml: diff.behav. in Schalk I s.86 Bsp 5 [x = 2]";
57.86 +
57.87 +(*----------------- Schalk I s.86 Bsp 19 ------------------------*)
57.88 +"Schalk I s.86 Bsp 19 (x - 5)*(10 - x) = (3 - x)*(2 + x) + 2*(x + 20)";
57.89 +"Schalk I s.86 Bsp 19 (x - 5)*(10 - x) = (3 - x)*(2 + x) + 2*(x + 20)";
57.90 +"Schalk I s.86 Bsp 19 (x - 5)*(10 - x) = (3 - x)*(2 + x) + 2*(x + 20)";
57.91 +(*EP*)
57.92 +val fmz = ["equality ((x - 5)*(10 - x) = (3 - x)*(2 + x) + 2*(x + 20))",
57.93 + "solveFor x","solutions L"];
57.94 +val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
57.95 +(*val p = e_pos';
57.96 +val c = [];
57.97 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
57.98 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
57.99 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.100 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.101 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.102 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.103 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.104 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.105 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.106 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.107 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.108 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.109 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.110 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.111 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.112 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.113 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.114 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 8]")) => ()
57.115 + | _ => raise error "rlang.sml: diff.behav. in Schalk I s.86 Bsp 19 [x = 8]";
57.116 +
57.117 +(*----------------- Schalk I s.86 Bsp 23 ------------------------*)
57.118 +"Schalk I s.86 Bsp 19 ((2*x+5)^^^2+(3*x+4)^^^2=(13*x+2)*(x+1)+2*(15+14*x))";
57.119 +"Schalk I s.86 Bsp 19 ((2*x+5)^^^2+(3*x+4)^^^2=(13*x+2)*(x+1)+2*(15+14*x))";
57.120 +"Schalk I s.86 Bsp 19 ((2*x+5)^^^2+(3*x+4)^^^2=(13*x+2)*(x+1)+2*(15+14*x))";
57.121 +(*EP*)
57.122 +val fmz = ["equality ((2*x+5)^^^2+(3*x+4)^^^2=(13*x+2)*(x+1)+2*(15+14*x))",
57.123 + "solveFor x","solutions L"];
57.124 +val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
57.125 +(*val p = e_pos';
57.126 +val c = [];
57.127 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
57.128 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
57.129 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.130 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.131 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.132 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.133 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.134 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.135 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.136 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.137 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.138 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.139 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.140 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.141 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.142 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.143 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.144 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = -9]")) => ()
57.145 + | _ => raise error "rlang.sml: diff.behav. in Schalk I s.86 Bsp 23 [x = -9]";
57.146 +
57.147 +(*----------------- Schalk I s.86 Bsp 25 ------------------------*)
57.148 +"Schalk I s.86 Bsp 25 ((2*x+1)^^^3+(x+1)^^^3=(2*x+1)^^^2*2*x+(x+2)^^^3+x^^^2)";
57.149 +"Schalk I s.86 Bsp 25 ((2*x+1)^^^3+(x+1)^^^3=(2*x+1)^^^2*2*x+(x+2)^^^3+x^^^2)";
57.150 +"Schalk I s.86 Bsp 25 ((2*x+1)^^^3+(x+1)^^^3=(2*x+1)^^^2*2*x+(x+2)^^^3+x^^^2)";
57.151 +(*EP*)
57.152 +val fmz = ["equality ((2*x+1)^^^3+(x+1)^^^3=(2*x+1)^^^2*2*x+(x+2)^^^3+x^^^2)",
57.153 + "solveFor x","solutions L"];
57.154 +val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
57.155 +(*val p = e_pos';
57.156 +val c = [];
57.157 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
57.158 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
57.159 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.160 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.161 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.162 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.163 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.164 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.165 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.166 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.167 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.168 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.169 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.170 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.171 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.172 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.173 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.174 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = -6 / 5]")) => ()
57.175 + | _ => raise error "rlang.sml: diff.behav. in Schalk I s.86 Bsp 25 [x = -6 / 5]";
57.176 +
57.177 +(*----------------- Schalk I s.86 Bsp 28b ------------------------*)
57.178 +"Schalk I s.86 Bsp 28b ((3*x+5)/18 - x/2 = -((3*x - 2)/9))";
57.179 +"Schalk I s.86 Bsp 28b ((3*x+5)/18 - x/2 = -((3*x - 2)/9))";
57.180 +"Schalk I s.86 Bsp 28b ((3*x+5)/18 - x/2 = -((3*x - 2)/9))";
57.181 +(*ER-2*)
57.182 +val fmz = ["equality ((3*x+5)/18 - x/2 = -((3*x - 2)/9))",
57.183 + "solveFor x","solutions L"];
57.184 +val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
57.185 +(*val p = e_pos'; val c = [];
57.186 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
57.187 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
57.188 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.189 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.190 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.191 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.192 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.193 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.194 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.195 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.196 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.197 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.198 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.199 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.200 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.201 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt; f2str f;
57.202 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[]")) => ()
57.203 + | _ => raise error "rlang.sml: diff.behav. in Schalk I s.86 Bsp 28b []";
57.204 +
57.205 +(*WN---v *)
57.206 +val bdv= (term_of o the o (parse thy)) "bdv";
57.207 +val v = (term_of o the o (parse thy)) "x";
57.208 +val t = (term_of o the o (parse thy)) "3 * x / 5";
57.209 +val SOME (t',_) = rewrite_set_inst_ PolyEq.thy true
57.210 + [(bdv, v)] make_ratpoly_in t;
57.211 +if term2str t' = "3 / 5 * x" then () else raise error "rlang.sml: 1";
57.212 +
57.213 +val t = str2term "(3*x+5)/18 - x/2 - -(3*x - 2)/9 = 0";
57.214 +val subst = [(str2term "bdv", str2term "x")];
57.215 +val SOME (t',_) = rewrite_set_inst_ thy false subst make_ratpoly_in t;
57.216 +if term2str t' = "1 / 18 = 0" then () else raise error "rlang.sml: 2";
57.217 +(*WN---^ *)
57.218 +
57.219 +(*----------------- Schalk I s.87 Bsp 36b ------------------------*)
57.220 +"Schalk I s.87 Bsp 36b ((17*x - 51)/9 - (-(13*x - 3)/6) + 11 -(9*x- 7)/4 = 0)";
57.221 +"Schalk I s.87 Bsp 36b ((17*x - 51)/9 - (-(13*x - 3)/6) + 11 -(9*x- 7)/4 = 0)";
57.222 +"Schalk I s.87 Bsp 36b ((17*x - 51)/9 - (-(13*x - 3)/6) + 11 -(9*x- 7)/4 = 0)";
57.223 +(*ER-1*)
57.224 +val fmz = ["equality ((17*x - 51)/9 - (-(13*x - 3)/6) + 11 - (9*x - 7)/4 = 0)",
57.225 + "solveFor x","solutions L"];
57.226 +val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
57.227 +(*val p = e_pos';
57.228 +val c = [];
57.229 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
57.230 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
57.231 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.232 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.233 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.234 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.235 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.236 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.237 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.238 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.239 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.240 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.241 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.242 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.243 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.244 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.245 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = -237 / 65]")) => ()
57.246 + | _ => raise error "rlang.sml: diff.behav. in Schalk I s.86 Bsp 36b [x = -237 / 65]";
57.247 +
57.248 +
57.249 +(*WN---v *)
57.250 +val t = str2term "(17*x - 51)/9 - (-(13*x - 3)/6) + 11 - (9*x - 7)/4 = 0";
57.251 +val subst = [(str2term "bdv", str2term "x")];
57.252 +val SOME (t',_) = rewrite_set_inst_ thy false subst make_ratpoly_in t;
57.253 +term2str t';
57.254 +if term2str t' = "79 / 12 + 65 / 36 * x = 0" then ()
57.255 +else raise error "rlang.sml: 3";
57.256 +(*WN---^ *)
57.257 +
57.258 +
57.259 +(*----------------- Schalk I s.87 Bsp 38b ------------------------*)
57.260 +"Schalk I s.87 Bsp 38b (-(2/x) + 3/(2*x) - 4/(3*x) + 5/(4*x) + 6/(5*x) =65/8)";
57.261 +"Schalk I s.87 Bsp 38b (-(2/x) + 3/(2*x) - 4/(3*x) + 5/(4*x) + 6/(5*x) =65/8)";
57.262 +"Schalk I s.87 Bsp 38b (-(2/x) + 3/(2*x) - 4/(3*x) + 5/(4*x) + 6/(5*x) =65/8)";
57.263 +(*ER-3*)
57.264 +val fmz = ["equality (-2/x + 3/(2*x) - 4/(3*x) + 5/(4*x) + 6/(5*x) = 65/8)",
57.265 + "solveFor x","solutions L"];
57.266 +val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
57.267 +(*val p = e_pos';
57.268 +val c = [];
57.269 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
57.270 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
57.271 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.272 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.273 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.274 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.275 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.276 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.277 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.278 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.279 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.280 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.281 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.282 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.283 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.284 +if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "296 + -3900 * x = 0")) then ()
57.285 +else raise error "rlang.sml: diff.behav. in Schalk I s.87 Bsp 38b";
57.286 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.287 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.288 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.289 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.290 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.291 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.292 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.293 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.294 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.295 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.296 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 74 / 975]")) => ()
57.297 + | _ => raise error "rlang.sml: diff.behav. in Schalk I s.86 Bsp 38b [x = 74 / 975]";
57.298 +
57.299 +(*----------------- Schalk I s.87 Bsp 40b ------------------------*)
57.300 +"Schalk I s.87 Bsp 40b ((x+3)/(2*x - 4)=3)";
57.301 +"Schalk I s.87 Bsp 40b ((x+3)/(2*x - 4)=3)";
57.302 +"Schalk I s.87 Bsp 40b ((x+3)/(2*x - 4)=3)";
57.303 +(*ER-4*)
57.304 +val fmz = ["equality ((x+3)/(2*x - 4)=3)",
57.305 + "solveFor x","solutions L"];
57.306 +val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
57.307 +(*val p = e_pos';
57.308 +val c = [];
57.309 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
57.310 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
57.311 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.312 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.313 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.314 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.315 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.316 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.317 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.318 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.319 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.320 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.321 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.322 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.323 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt; f2str f;
57.324 +(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.325 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;*)
57.326 +if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "15 + -5 * x = 0")) then ()
57.327 +else raise error "rlang.sml: diff.behav. in Schalk I s.87 Bsp 40b";
57.328 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.329 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.330 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.331 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.332 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.333 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.334 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.335 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.336 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.337 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 3]")) => ()
57.338 + | _ => raise error "rlang.sml: diff.behav. in Schalk I s.87 Bsp 40b [x = 3]";
57.339 +
57.340 +
57.341 +(*----------------- Schalk I s.87 Bsp 44a ------------------------*)
57.342 +"Schalk I s.87 Bsp 44a ((1/2+(5*x)/2)^^^2 -((13*x)/2- 5/2)^^^2 -(6*x)^^^2+29)";
57.343 +"Schalk I s.87 Bsp 44a ((1/2+(5*x)/2)^^^2 -((13*x)/2- 5/2)^^^2 -(6*x)^^^2+29)";
57.344 +"Schalk I s.87 Bsp 44a ((1/2+(5*x)/2)^^^2 -((13*x)/2- 5/2)^^^2 -(6*x)^^^2+29)";
57.345 +(*ER-5*)
57.346 +val fmz = ["equality ((1/2 + (5*x)/2)^^^2 - ((13*x)/2 - 5/2)^^^2 = -1*(6*x)^^^2 + 29)",
57.347 + "solveFor x","solutions L"];
57.348 +val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
57.349 +(*val p = e_pos';
57.350 +val c = [];
57.351 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
57.352 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
57.353 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.354 +(*trace_rewrite:=true;
57.355 +*)
57.356 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.357 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.358 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.359 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.360 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.361 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.362 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.363 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.364 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.365 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.366 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.367 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.368 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.369 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.370 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 1]")) => ()
57.371 + | _ => raise error "rlang.sml: diff.behav. in Schalk I s.87 Bsp 44a [x = 1]";
57.372 +
57.373 +(*WN---v *)
57.374 +val t = str2term "(1/2 + (5*x)/2)^^^2 - ((13*x)/2 - 5/2)^^^2 - (6*x)^^^2 + 29";
57.375 +val subst = [(str2term "bdv", str2term "x")];
57.376 +val SOME (t',_) = rewrite_set_inst_ thy false subst make_ratpoly_in t;
57.377 +if term2str t' = "23 + 35 * x + -72 * x ^^^ 2" then ()
57.378 +else raise error "rlang.sml: 4";
57.379 +
57.380 +val t = str2term "(1/2 + (5*x)/2)^^^2 - ((13*x)/2 - 5/2)^^^2 + (6*x)^^^2 - 29";
57.381 +val subst = [(str2term "bdv", str2term "x")];
57.382 +val SOME (t',_) = rewrite_set_inst_ thy false subst make_ratpoly_in t;
57.383 +if term2str t' = "-35 + 35 * x" then ()
57.384 +else raise error "rlang.sml: 4.1";
57.385 +(*WN---^ *)
57.386 +
57.387 +(*----------------- Schalk I s.87 Bsp 52a ------------------------*)
57.388 +"Schalk I s.87 Bsp 52a ((5*x)/(x - 2) - x/(x+2)=4)";
57.389 +"Schalk I s.87 Bsp 52a ((5*x)/(x - 2) - x/(x+2)=4)";
57.390 +"Schalk I s.87 Bsp 52a ((5*x)/(x - 2) - x/(x+2)=4)";
57.391 +(*ER-6*)
57.392 +val fmz = ["equality ((5*x)/(x - 2) - x/(x+2)=4)",
57.393 + "solveFor x","solutions L"];
57.394 +val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
57.395 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.396 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.397 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.398 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.399 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.400 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.401 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.402 + (*"12 * x + 4 * x ^^^ 2 = 4 * (-4 + x ^^^ 2)",Subproblem["normalize", "poly*)
57.403 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.404 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.405 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.406 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.407 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.408 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.409 +if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "16 + 12 * x = 0")) then ()
57.410 +else raise error "rlang.sml: diff.behav. in Schalk I s.87 Bsp 52a";
57.411 + (*Subproblem["degree_1", "polynomial", "univariate", "equation"]*)
57.412 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.413 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.414 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.415 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.416 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.417 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.418 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.419 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.420 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.421 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = -4 / 3]")) => ()
57.422 + | _ => raise error "rlang.sml: diff.behav. in Schalk I s.87 Bsp 52a [x = -4 / 3]";
57.423 +
57.424 +(*----------------- Schalk I s.87 Bsp 55b ------------------------*)
57.425 +"Schalk I s.87 Bsp 55b (x/(x^^^2 - 6*x+9) - 1/(x^^^2 - 3*x) =1/x)";
57.426 +"Schalk I s.87 Bsp 55b (x/(x^^^2 - 6*x+9) - 1/(x^^^2 - 3*x) =1/x)";
57.427 +"Schalk I s.87 Bsp 55b (x/(x^^^2 - 6*x+9) - 1/(x^^^2 - 3*x) =1/x)";
57.428 +(*ER-7*)
57.429 +val fmz = ["equality (x/(x^^^2 - 6*x+9) - 1/(x^^^2 - 3*x) =1/x)",
57.430 + "solveFor x","solutions L"];
57.431 +val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
57.432 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.433 +(*val nxt = ("Model_Problem",Model_Problem["rational","univariate","equation"*)
57.434 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.435 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.436 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.437 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.438 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.439 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.440 +(*//me's dropped !val it = ["9 * x + -6 * x ^^^ 2 + 1 * x ^^^ 3 ~= 0","x ~= 0"]
57.441 +"(3 + -1 * x + 1 * x ^^^ 2) * x = 1 * (9 * x + -6 * x ^^^ 2 + 1 * x ^^^3)"))
57.442 +WN: Grad hoeher ~~~~~~~~~~~~ als notwendig ~~~~~~~~*)
57.443 +(* nxt =Model_Problem ["normalize","polynomial","univariate","equation"])*)
57.444 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.445 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.446 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.447 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.448 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.449 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.450 +(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt; 040209 MGs norm_Rational*)
57.451 +(* val nxt = Subproblem ("PolyEq.thy",["polynomial","univariate","equation"])*)
57.452 +if f= Form' (FormKF (~1, EdUndef, 0, Nundef, "-6 * x + 5 * x ^^^ 2 = 0"))then()
57.453 +else raise error "rlang.sml: diff.behav. in Schalk I s.87 Bsp 55b";
57.454 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.455 +(*nxt=Model_Problem["bdv_only","degree_2","polynomial","univariate","equation*)
57.456 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.457 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.458 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.459 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.460 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.461 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.462 +(*val f = Form' (FormKF (~1,EdUndef,3,Nundef,"x = 0 | x = 6 / 5")) : mout
57.463 +val nxt = ("Or_to_List",Or_to_List) *)
57.464 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.465 +(*val f = Form' (FormKF (~1,EdUndef,3,Nundef,"[x = 0, x = 6 / 5]")) : mout
57.466 +val nxt = ("Check_elementwise",Check_elementwise "Assumptions")
57.467 +get_assumptions pt (fst p);
57.468 +val it = [] : string list ... correct for this subproblem !*)
57.469 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.470 +(*val p = ([6,5,5],Res) : pos'
57.471 +val f = Form' (FormKF (~1,EdUndef,3,Nundef,"[x = 0, x = 6 / 5]")) : mout
57.472 +nxt=Check_Postcond ["bdv_only","degree_2","polynomial","univariate","equation*)
57.473 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.474 +(*val p = ([6,5],Res) : pos'
57.475 +val f = Form' (FormKF (~1,EdUndef,2,Nundef,"[x = 0, x = 6 / 5]")) : mout
57.476 +val nxt =Check_Postcond ["normalize","polynomial","univariate","equation"])*)
57.477 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.478 +(*val p = ([6],Res) : pos'
57.479 +val f = Form' (FormKF (~1,EdUndef,1,Nundef,"[x = 0, x = 6 / 5]")) : mout
57.480 +val nxt = ("Check_elementwise",Check_elementwise "Assumptions")*)
57.481 +val [(aaa,ppp)] = get_assumptions_ pt p;
57.482 +if term2str aaa = "9 * x + -6 * x ^^^ 2 + x ^^^ 3 ~= 0" then ()
57.483 +else raise error "rlang.sml: diff.behav. in I s.87 Bsp 55b [x = 6 / 5], asms";
57.484 +(*WN060717 unintentionally changed some rls/ord while
57.485 + completing knowl. for thes2file...
57.486 +if term2str aaa = "9 * x + (x ^^^ 3 + -6 * x ^^^ 2) ~= 0" then ()
57.487 +else raise error "rlang.sml: diff.behav. in I s.87 Bsp 55b [x = 6 / 5], asms";
57.488 +.... but it became even better*)
57.489 +
57.490 +(*22.10.03:
57.491 +val it = "9 * x + (x ^^^ 3 + -6 * x ^^^ 2) ~= 0" : string;
57.492 + before 22.10.03:
57.493 +val it = ["9 * x + -6 * x ^^^ 2 + 1 * x ^^^ 3 ~= 0","x ~= 0"]
57.494 +> val subs = [(str2term "x", str2term "0")];
57.495 +> val pred = str2term "9 * x + -6 * x ^^^ 2 + 1 * x ^^^ 3 ~= 0 & x ~= 0";
57.496 +> eval_true thy [subst_atomic subs pred] rateq_erls;
57.497 +val it = false : bool
57.498 +> val subs = [(str2term "x", str2term "6 / 5")];
57.499 +> val pred = str2term "9 * x + -6 * x ^^^ 2 + 1 * x ^^^ 3 ~= 0 & x ~= 0";
57.500 +> eval_true thy [subst_atomic subs pred] rateq_erls;
57.501 +val it = true : bool*)
57.502 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.503 +(*val p = ([7],Res) : pos'
57.504 +val f = Form' (FormKF (~1,EdUndef,1,Nundef,"[x = 6 / 5]")) : mout
57.505 +val nxt =Check_Postcond ["rational","univariate","equation"]) *)
57.506 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.507 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 6 / 5]")) => ()
57.508 + | _ => raise error "rlang.sml: diff.behav. in Schalk I s.87 Bsp 55b [x = 6 / 5]";
57.509 +
57.510 +(*----------------- Schalk I s.88 Bsp 64c ------------------------*)
57.511 +"Schalk I s.88 Bsp 64c (((x - 1)/(x+1)+1)/((x - 1)/(x+1) - (x+1)/(x - 1))=2)";
57.512 +"Schalk I s.88 Bsp 64c (((x - 1)/(x+1)+1)/((x - 1)/(x+1) - (x+1)/(x - 1))=2)";
57.513 +"Schalk I s.88 Bsp 64c (((x - 1)/(x+1)+1)/((x - 1)/(x+1) - (x+1)/(x - 1))=2)";
57.514 +(*ER-8*)
57.515 +val fmz = ["equality (((x - 1)/(x+1)+1)/((x - 1)/(x+1) - (x+1)/(x - 1))=2)",
57.516 + "solveFor x","solutions L"];
57.517 +val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
57.518 +
57.519 +(*val p = e_pos'; val c = [];
57.520 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
57.521 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
57.522 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.523 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.524 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.525 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.526 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.527 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.528 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.529 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.530 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.531 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.532 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.533 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.534 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt; f2str f;
57.535 +if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "-3 + -1 * x = 0")) then ()
57.536 +else raise error "rlangsml: diff.behav. in Schalk I s.88 Bsp 64c";
57.537 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.538 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.539 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.540 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.541 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.542 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.543 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.544 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.545 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.546 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.547 +case f of Form' (FormKF (_,_,0,_,"[x = -3]")) => ()
57.548 + | _ => raise error "rlang.sml: diff.behav. in Schalk I s.88 Bsp 64c [x = -3]";
57.549 +
57.550 +(*----------------- Schalk I s.88 Bsp 79a (2) ------------------------*)
57.551 +"Schalk I s.88 Bsp 79a (2) (m1*v1+m2*v2=0)";
57.552 +"Schalk I s.88 Bsp 79a (2) (m1*v1+m2*v2=0)";
57.553 +"Schalk I s.88 Bsp 79a (2) (m1*v1+m2*v2=0)";
57.554 +(*ER-10*)
57.555 +val fmz = ["equality (m1*v1+m2*v2=0)",
57.556 + "solveFor m1","solutions L"];
57.557 +val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
57.558 +
57.559 +(*val p = e_pos'; val c = [];
57.560 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
57.561 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
57.562 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.563 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.564 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.565 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.566 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.567 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.568 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.569 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.570 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.571 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.572 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.573 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.574 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.575 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.576 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[m1 = -1 * m2 * v2 / v1]")) => ()
57.577 + | _ => raise error "rlang.sml: diff.behav. in Schalk I s.88 Bsp 79a (2) [m1 = -1 * m2 * v2 / v1]";
57.578 +
57.579 +(*----------------- Schalk I s.89 Bsp 90a(1) ------------------------*)
57.580 +"Schalk I s.89 Bsp 90a (1) (f=((w+u)/(w+v))*v0)";
57.581 +"Schalk I s.89 Bsp 90a (1) (f=((w+u)/(w+v))*v0)";
57.582 +"Schalk I s.89 Bsp 90a (1) (f=((w+u)/(w+v))*v0)";
57.583 +(*ER-11*)
57.584 +val fmz = ["equality (f=((w+u)/(w+v))*v0)",
57.585 + "solveFor v","solutions L"];
57.586 +val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
57.587 +
57.588 +(*val p = e_pos'; val c = [];
57.589 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
57.590 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
57.591 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.592 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.593 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.594 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.595 +(*val nxt = Specify_Problem ["rational","univariate","equation"]) *)
57.596 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.597 +(*val nxt = Specify_Method ["RatEq","solve_rat_equation"]) *)
57.598 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.599 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.600 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.601 +(*nxt = Subproblem ("RatEq.thy",["univariate","equation"])) *)
57.602 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.603 +(*val nxt =Model_Problem ["normalize","polynomial","univariate","equation"])*)
57.604 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.605 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.606 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.607 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.608 +(*val nxt = ("Apply_Method",Apply_Method ["PolyEq","normalize_poly"])*)
57.609 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.610 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.611 +(*val nxt =Subproblem ("PolyEq.thy",["polynomial","univariate","equation"]))*)
57.612 +if f = Form'
57.613 + (FormKF
57.614 + (~1,
57.615 + EdUndef,
57.616 + 0,
57.617 + Nundef,
57.618 + "f * w + -1 * u * v0 + -1 * v0 * w + f * v = 0")) then ()
57.619 +else raise error "rlang.sml: diff.behav. in Schalk I s.89 Bsp 90a";
57.620 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.621 +(*val nxt = Model_Problem ["degree_1","polynomial","univariate","equation"])*)
57.622 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.623 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.624 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.625 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.626 +(*val nxt = ("Apply_Method",Apply_Method ["PolyEq","solve_d1_poly_equation"])*)
57.627 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.628 +(*val f = "v = -1 * (f * w + -1 * u * v0 + -1 * v0 * w) / f")) : mout
57.629 +val nxt = ("Or_to_List",Or_to_List) : string * tac *)
57.630 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.631 +(*val f = "[v = -1 * (f * w + -1 * u * v0 + -1 * v0 * w) / f]")) : mout
57.632 +val nxt = ("Check_elementwise",Check_elementwise "Assumptions") *)
57.633 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.634 +(*val f = "[v = -1 * (f * w + -1 * u * v0 + -1 * v0 * w) / f]")) : mout
57.635 +val nxt = Check_Postcond ["degree_1","polynomial","univariate","equation"])*)
57.636 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.637 +(*val f = "[v = -1 * (f * w + -1 * u * v0 + -1 * v0 * w) / f]")) : mout
57.638 +val nxt = Check_Postcond ["normalize","polynomial","univariate","equation"])*)
57.639 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.640 +(*val f = "[v = -1 * (f * w + -1 * u * v0 + -1 * v0 * w) / f]")) : mout
57.641 +val nxt = ("Check_elementwise",Check_elementwise "Assumptions")*)
57.642 +
57.643 +get_assumptions_ pt p;
57.644 +(*it = ["v + w ~= 0"] ... goes to the solution as an assumption*)
57.645 +
57.646 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.647 +(*val f = Form' (FormKF (~1,EdUndef,1,Nundef,"[]")) : mout
57.648 +val nxt = Check_Postcond ["rational","univariate","equation"]) *)
57.649 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.650 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,
57.651 + "[v = (u * v0 + v0 * w + -1 * f * w) / f]")) => ()
57.652 + | _ => raise error "rlang.sml: diff.behav. in Schalk I s.89 Bsp 90a (1) [v=...]";
57.653 +if get_assumptions_ pt p =
57.654 + [(str2term"(u * v0 + v0 * w + -1 * f * w) / f + w ~= 0",[])] then ()
57.655 +else raise error "rlang.sml: diff.behav. in I s.89 Bsp 90a (1) [v=...] asm";
57.656 +
57.657 +
57.658 +(*----------------- Schalk I s.89 Bsp 90a(2) ------------------------*)
57.659 +"Schalk I s.89 Bsp 90a (2) (f=((w+u)/(w+v))*v0)";
57.660 +"Schalk I s.89 Bsp 90a (2) (f=((w+u)/(w+v))*v0)";
57.661 +"Schalk I s.89 Bsp 90a (2) (f=((w+u)/(w+v))*v0)";
57.662 +(*ER-12*)
57.663 +val fmz = ["equality (f=((w+u)/(w+v))*v0)",
57.664 + "solveFor w","solutions L"];
57.665 +val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
57.666 +(*val p = e_pos';val c = [];
57.667 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
57.668 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
57.669 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.670 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.671 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.672 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.673 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.674 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.675 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.676 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.677 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.678 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.679 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.680 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.681 +if f = Form'
57.682 + (FormKF
57.683 + (~1,
57.684 + EdUndef,
57.685 + 0,
57.686 + Nundef,
57.687 + "f * v + -1 * u * v0 + (f + -1 * v0) * w = 0")) then ()
57.688 +else raise error "rlang.sml: diff.behav. in Schalk I s.89 Bsp 90a (2)";
57.689 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.690 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.691 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.692 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.693 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.694 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.695 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.696 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.697 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.698 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[w = (u * v0 + -1 * f * v) / (f + -1 * v0)]")) => ()
57.699 + | _ => raise error "rlang.sml: diff.behav. in Schalk I Bsp 90a(2)";
57.700 +if get_assumptions_ pt p =
57.701 +[(str2term"v + (u * v0 + -1 * f * v) / (f + -1 * v0) ~= 0",[]),
57.702 + (str2term"f + -1 * v0 ~= 0",[])]
57.703 +then writeln "asm should be simplified ???"
57.704 +else raise error "rlang.sml: diff.behav. in Schalk I Bsp 90a(2) asm";
57.705 +
57.706 +(*----------------- Schalk I s.89 Bsp 98a(1) ------------------------*)
57.707 +"Schalk I s.89 Bsp 98a (1) (1/R=1/R1+1/R2)";
57.708 +"Schalk I s.89 Bsp 98a (1) (1/R=1/R1+1/R2)";
57.709 +"Schalk I s.89 Bsp 98a (1) (1/R=1/R1+1/R2)";
57.710 +(*ER-9*)
57.711 +val fmz = ["equality (1/R=1/R1+1/R2)",
57.712 + "solveFor R1","solutions L"];
57.713 +val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
57.714 +(*val p = e_pos'; val c = [];
57.715 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
57.716 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
57.717 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.718 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.719 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.720 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.721 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.722 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.723 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.724 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.725 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.726 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.727 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.728 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.729 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.730 +if f = Form'
57.731 + (FormKF
57.732 + (~1, EdUndef, 0, Nundef, "-1 * R * R2 + (R2 + -1 * R) * R1 = 0"))then()
57.733 +else raise error "rlang.sml: diff.behav. in Schalk I s.89 Bsp 98a (1)";
57.734 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.735 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.736 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.737 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.738 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.739 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.740 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.741 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.742 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.743 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[R1 = R * R2 / (R2 + -1 * R)]")) => ()
57.744 + | _ => raise error "rlang.sml: diff.behav. in 98a(1) [R1 = ...]";
57.745 +if get_assumptions_ pt p = [(str2term"R * R2 * R2 ~= (R2 + -1 * R) * 0",[]),
57.746 + (str2term"R2 + -1 * R ~= 0",[]),
57.747 + (str2term"R2 + -1 * R ~= 0",[])]
57.748 + then writeln "asm should be simplified"
57.749 +else raise error "rlang.sml: diff.behav. in 98a(1) asm";
57.750 +
57.751 +(*----------------- Schalk I s.89 Bsp 104a(1) ------------------------*)
57.752 +"Schalk I s.89 Bsp 104a (1) (y^^^2=2*p*x)";
57.753 +"Schalk I s.89 Bsp 104a (1) (y^^^2=2*p*x)";
57.754 +"Schalk I s.89 Bsp 104a (1) (y^^^2=2*p*x)";
57.755 +(*ER-13 + EO-11 ?!?*)
57.756 +val fmz = ["equality (y^^^2=2*p*x)",
57.757 + "solveFor p","solutions L"];
57.758 +val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
57.759 +(*val p = e_pos'; val c = [];
57.760 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
57.761 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
57.762 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.763 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.764 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.765 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.766 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.767 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.768 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.769 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.770 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.771 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.772 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.773 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.774 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.775 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.776 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.777 +case f of Form' (FormKF (_,_,0,_,"[p = y ^^^ 2 / (2 * x)]")) => ()
57.778 + | _ => raise error "rlang.sml: diff.behav. in Schalk I s.89 Bsp 104a (1) [p = y^2/(2*x)]";
57.779 +if get_assumptions_ pt p = [(str2term"-2 * x ~= 0",[])]
57.780 +then writeln"should be x ~= 0\nshould be x ~= 0\nshould be x ~= 0\n"
57.781 +else raise error "rlang.sml: diff.behav. in I s.89 Bsp 104a(1) asm";
57.782 +
57.783 +
57.784 +(*----------------- Schalk I s.89 Bsp 104a(2) ------------------------*)
57.785 +"Schalk I s.89 Bsp 104a (2) (y^^^2=2*p*x)";
57.786 +"Schalk I s.89 Bsp 104a (2) (y^^^2=2*p*x)";
57.787 +"Schalk I s.89 Bsp 104a (2) (y^^^2=2*p*x)";
57.788 +(*EO ??*)
57.789 +val fmz = ["equality (y^^^2=2*p*x)",
57.790 + "solveFor y","solutions L"];
57.791 +val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
57.792 +(*val p = e_pos';
57.793 +val c = [];
57.794 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
57.795 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
57.796 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.797 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.798 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.799 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.800 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.801 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.802 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.803 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.804 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.805 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.806 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.807 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.808 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.809 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.810 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.811 +case f of Form' (FormKF (_,_,0,_,"[y = sqrt (2 * p * x), y = -1 * sqrt (2 * p * x)]")) => ()
57.812 +| _ => raise error "rlang.sml: diff.behav. Schalk I s.89 Bsp 104a(2) [x = ]";
57.813 +if get_assumptions_ pt p = [(str2term"0 <= -1 * (-2 * p * x)",[]),(str2term"0 <= -1 * (-2 * p * x)",[])] then writeln "asm should be simplified\nshould be simplified"
57.814 +else raise error "rlang.sml: diff.behav. in I s.89 Bsp 104a(2) asm";
57.815 +
57.816 +
57.817 +(*----------------- Schalk I s.90 Bsp 118a (1) ------------------------*)
57.818 +"Schalk I s.90 Bsp 118a (1) (b^^^2*x^^^2 + a^^^2*y^^^2 = a^^^2*b^^^2)";
57.819 +"Schalk I s.90 Bsp 118a (1) (b^^^2*x^^^2 + a^^^2*y^^^2 = a^^^2*b^^^2)";
57.820 +"Schalk I s.90 Bsp 118a (1) (b^^^2*x^^^2 + a^^^2*y^^^2 = a^^^2*b^^^2)";
57.821 +(*EO-8*)
57.822 +val fmz = ["equality (b^^^2*x^^^2 + a^^^2*y^^^2 = a^^^2*b^^^2)",
57.823 + "solveFor x","solutions L"];
57.824 +val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
57.825 +(*val p = e_pos';
57.826 +val c = [];
57.827 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
57.828 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
57.829 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.830 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.831 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.832 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.833 +
57.834 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.835 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;
57.836 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;
57.837 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;
57.838 +
57.839 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.840 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.841 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.842 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.843 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.844 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.845 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.846 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.847 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;
57.848 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;get_asm (fst p, fst p) pt;
57.849 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;get_asm (fst p, fst p) pt;
57.850 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;get_asm (fst p, fst p) pt;
57.851 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;get_asm (fst p, fst p) pt;
57.852 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;asms2str (get_asm (fst p, fst p) pt);
57.853 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;asms2str (get_asm (fst p, fst p) pt);
57.854 +
57.855 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;get_asm (fst p, fst p) pt;
57.856 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;f2str f;get_asm (fst p, fst p) pt;
57.857 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = sqrt ((a ^^^ 2 * b ^^^ 2 + -1 * a ^^^ 2 * y ^^^ 2) / b ^^^ 2),\n x = -1 * sqrt ((a ^^^ 2 * b ^^^ 2 + -1 * a ^^^ 2 * y ^^^ 2) / b ^^^ 2)]")) => writeln"should be simplified MG"
57.858 +| _ => raise error "rlang.sml: diff.behav. in Schalk I s.89 Bsp 118a(2) [x = ]";
57.859 +val asms = get_assumptions_ pt p;
57.860 +if asms = [(str2term"0 * b ^^^ 2 <= -1 * (a ^^^ 2 * y ^^^ 2 + -1 * a ^^^ 2 * b ^^^ 2)", []),
57.861 + (str2term"b ^^^ 2 ~= 0", []),
57.862 + (str2term"0 * b ^^^ 2 <= -1 * (a ^^^ 2 * y ^^^ 2 + -1 * a ^^^ 2 * b ^^^ 2)", []),
57.863 + (str2term"b ^^^ 2 ~= 0", [])
57.864 + ] then writeln"should be simplified MG"
57.865 +else raise error "rlang.sml: diff.behav. in Schalk I s.89 Bsp 118a(2) asms";
57.866 +
57.867 +(*----------------- Schalk I s.102 Bsp 268(1) ------------------------*)
57.868 +"Schalk I s.102 Bsp 268(1) (A = (1/2)*(x1*(y2-y3)+x2*(y3 - y1)+x3*(y1 - y2)))";
57.869 +"Schalk I s.102 Bsp 268(1) (A = (1/2)*(x1*(y2-y3)+x2*(y3 - y1)+x3*(y1 - y2)))";
57.870 +"Schalk I s.102 Bsp 268(1) (A = (1/2)*(x1*(y2-y3)+x2*(y3 - y1)+x3*(y1 - y2)))";
57.871 +(*ER-14*)
57.872 +val fmz = ["equality (A = (1/2)*(x1*(y2 - y3)+x2*(y3 - y1)+x3*(y1 - y2)))",
57.873 + "solveFor x2","solutions L"];
57.874 +val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
57.875 +(*val p = e_pos';
57.876 +val c = [];
57.877 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
57.878 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
57.879 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.880 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.881 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.882 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.883 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.884 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.885 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.886 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.887 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.888 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.889 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.890 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.891 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.892 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.893 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.894 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x2 =\n (-2 * A + x1 * y2 + x3 * y1 + -1 * x1 * y3 + -1 * x3 * y2) /\n (y1 + -1 * y3)]")) => ()
57.895 +| _ => raise error "rlang.sml: diff.behav. Schalk I s.102 Bsp 268(1) [x2=...]";
57.896 +if get_assumptions_ pt p = [(str2term"y1 / 2 + -1 * y3 / 2 ~= 0",[])] then ()
57.897 +else raise error "rlang.sml: diff.behav. in I s.102 Bsp 268(1) asm";
57.898 +
57.899 +(*-------------------- Schalk II ----------------------------*)
57.900 +(*-------------------- Schalk II ----------------------------*)
57.901 +(*-------------------- Schalk II ----------------------------*)
57.902 +(*-------------------- Schalk II ----------------------------*)
57.903 +(*-------------------- Schalk II ----------------------------*)
57.904 +
57.905 +
57.906 +(*----------------- Schalk II s.56 Bsp 67b ------------------------*)
57.907 +"Schalk II s.56 Bsp 67b (4*sqrt(4*x+1)=3*sqrt(7*x+2))";
57.908 +"Schalk II s.56 Bsp 67b (4*sqrt(4*x+1)=3*sqrt(7*x+2))";
57.909 +"Schalk II s.56 Bsp 67b (4*sqrt(4*x+1)=3*sqrt(7*x+2))";
57.910 +(*EO*)
57.911 +val fmz = ["equality (4*sqrt(4*x+1)=3*sqrt(7*x+2))",
57.912 + "solveFor x","solutions L"];
57.913 +val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
57.914 +(*val p = e_pos';
57.915 +val c = [];
57.916 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
57.917 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
57.918 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.919 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.920 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.921 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.922 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.923 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.924 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.925 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.926 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.927 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.928 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.929 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.930 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt; f2str f;
57.931 +if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "-2 + x = 0")) then ()
57.932 +else raise error "rlang.sml: diff.behav. in Schalk II s.56 Bsp 67b";
57.933 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.934 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.935 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.936 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.937 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.938 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.939 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.940 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.941 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.942 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 2]")) => ()
57.943 + | _ => raise error "rlang.sml: diff.behav. in Schalk II s.56 Bsp 67b [x=2]";
57.944 +
57.945 +(*----------------- Schalk II s.56 Bsp 68a ------------------------*)
57.946 +"Schalk II s.56 Bsp 68a (5*sqrt(x) - 1 = 7*sqrt(x) - 5)";
57.947 +"Schalk II s.56 Bsp 68a (5*sqrt(x) - 1 = 7*sqrt(x) - 5)";
57.948 +"Schalk II s.56 Bsp 68a (5*sqrt(x) - 1 = 7*sqrt(x) - 5)";
57.949 +val fmz = ["equality (5*sqrt(x) - 1 = 7*sqrt(x) - 5)",
57.950 + "solveFor x","solutions L"];
57.951 +val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
57.952 +(*val p = e_pos';
57.953 +val c = [];
57.954 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
57.955 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
57.956 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.957 +(* val nxt = ("Model_Problem",Model_Problem ["normalize","root","univariate","equation"])*)
57.958 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.959 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.960 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.961 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.962 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.963 +(* val nxt = ("Model_Problem",Model_Problem ["sq","root","univariate","equation"]) *)
57.964 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.965 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.966 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.967 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.968 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.969 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.970 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.971 +(* val nxt = ("Model_Problem",Model_Problem ["sq","root","univariate","equation"]) *)
57.972 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.973 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.974 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.975 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.976 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.977 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.978 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.979 +get_assumptions_ pt p;
57.980 +(* val nxt = ("Model_Problem", Model_Problem ["normalize","polynomial","univariate","equation"])*)
57.981 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.982 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.983 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.984 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.985 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.986 +if f = Form'
57.987 + (FormKF
57.988 + (~1, EdUndef, 0, Nundef, "256 + -2368 * x + 576 * x ^^^ 2 = 0"))then()
57.989 +else raise error "rlang.sml: diff.behav. in Schalk II s.56 Bsp 68a";
57.990 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.991 +get_assumptions_ pt p;
57.992 +(* val nxt = ("Model_Problem", Model_Problem
57.993 + ["abcFormula","degree_2","polynomial","univariate","equation"])*)
57.994 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.995 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.996 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.997 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.998 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.999 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1000 +get_assumptions_ pt p;
57.1001 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1002 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1003 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1004 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1005 +if f = Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 4, x = 1 / 9]"))
57.1006 +then writeln "only [x = 4] !\nonly [x = 4] !\nonly [x = 4] !\n"
57.1007 +else raise error "rlang.sml: diff.behav. in II 68a";
57.1008 +val asms = get_assumptions_ pt p;
57.1009 +if asms2str asms =
57.1010 +"[(0 <= (25 * (1 / 9) + -1 * (16 + 49 * (1 / 9))) * -56, []),\
57.1011 + \(0 <= 1 / 9, []),\
57.1012 + \(0 <= 1 / 9, []),\
57.1013 + \(0 <= (-5 + 7 * sqrt (1 / 9) + 1) * 5, []),\
57.1014 + \(0 <= 1 / 9, []),\
57.1015 + \(0 <= (25 * (1 / 9) + -1 * (16 + 49 * (1 / 9))) * -56, []),\
57.1016 + \(0 <= 1 / 9, [])]"
57.1017 +(*WN050916 before correction 'rewrite__set_ called with 'Erls' for ..'
57.1018 + thus: maybe the rls for the asms is Erls ??:
57.1019 + [(str2term"0 <= (25 * (1 / 9) + -1 * (16 + 49 * (1 / 9))) * -56", []),
57.1020 + (str2term"9 ~= 0", []),
57.1021 + (str2term"0 <= (-5 + 7 * sqrt (1 / 9) + 1) * 5", []),
57.1022 + (str2term"9 ~= 0", []),
57.1023 + (str2term"0 <= (25 * (1 / 9) + -1 * (16 + 49 * (1 / 9))) * -56", [])]*)
57.1024 + then "should get True * False!!!"
57.1025 +else raise error "rlang.sml: diff.behav. in II 68a asms";
57.1026 +
57.1027 +(*----------------- Schalk II s.56 Bsp 73b ------------------------*)
57.1028 +"Schalk II s.56 Bsp 73b (sqrt(x+1)+sqrt(4*x+4)=sqrt(9*x+9))";
57.1029 +"Schalk II s.56 Bsp 73b (sqrt(x+1)+sqrt(4*x+4)=sqrt(9*x+9))";
57.1030 +"Schalk II s.56 Bsp 73b (sqrt(x+1)+sqrt(4*x+4)=sqrt(9*x+9))";
57.1031 +(*EO-2*)
57.1032 +val fmz = ["equality (sqrt(x+1)+sqrt(4*x+4)=sqrt(9*x+9))",
57.1033 + "solveFor x","solutions L"];
57.1034 +val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
57.1035 +
57.1036 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.1037 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1038 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1039 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1040 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1041 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1042 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1043 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1044 +(*"13 + 13 * x + -2 * sqrt ((4 + 4 * x) * (9 + 9 * x)) = 1 + x"
57.1045 +-> Subproblem ("RootEq.thy", ["univariate", ...])*)
57.1046 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1047 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1048 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1049 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1050 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1051 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1052 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1053 +(*"144 + 288 * x + 144 * x ^^^ 2 = 144 + x ^^^ 2 + 288 * x + 143 * x ^^^ 2"
57.1054 +-> Subproblem ("RootEq.thy", ["univariate", ...])*)
57.1055 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1056 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1057 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1058 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1059 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1060 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1061 +if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "0 = 0")) then ()
57.1062 +else raise error "rlang.sml: diff.behav. in Schalk II s.56 Bsp 73b";
57.1063 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1064 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1065 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1066 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1067 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1068 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1069 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1070 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1071 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1072 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1073 +val asm = get_assumptions_ pt p;
57.1074 +if asm=[] andalso f = Form' (FormKF (~1,EdUndef,0,Nundef,"UniversalList")) andalso nxt = ("End_Proof'",End_Proof') then ()
57.1075 +else raise error "rlang.sml: diff.behav. in UniversalList 2";
57.1076 +
57.1077 +(*----------------- Schalk II s.56 Bsp 74a ------------------------*)
57.1078 +"Schalk II s.56 Bsp 74a (sqrt(4*x+1) - sqrt(x+3) = sqrt(x - 2))";
57.1079 +"Schalk II s.56 Bsp 74a (sqrt(4*x+1) - sqrt(x+3) = sqrt(x - 2))";
57.1080 +"Schalk II s.56 Bsp 74a (sqrt(4*x+1) - sqrt(x+3) = sqrt(x - 2))";
57.1081 +(*EO-3*)
57.1082 +val fmz = ["equality (sqrt(4*x+1) - sqrt(x+3) = sqrt(x - 2))",
57.1083 + "solveFor x","solutions L"];
57.1084 +val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
57.1085 +
57.1086 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.1087 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1088 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1089 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1090 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1091 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1092 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1093 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1094 +(*4 + 5 * x + -2 * sqrt (3 + 13 * x + 4 * x ^^^ 2) = -2 + x"
57.1095 +-> Subproblem ("RootEq.thy", ["univariate", ...])*)
57.1096 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1097 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1098 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1099 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1100 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1101 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1102 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1103 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1104 +(*"12 + 52 * x + 16 * x ^^^ 2 = 36 + x ^^^ 2 + 48 * x + 15 * x ^^^ 2"
57.1105 +-> Subproblem ("RootEq.thy", ["univariate", ...])*)
57.1106 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1107 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1108 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1109 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1110 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1111 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1112 +if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "-24 + 4 * x = 0")) then ()
57.1113 +else raise error "rlang.sml: diff.behav. in Schalk II s.56 Bsp 74a";
57.1114 +(*-> ubproblem ("PolyEq.thy", ["degree_1", ...]*)
57.1115 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1116 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1117 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1118 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1119 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1120 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1121 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1122 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1123 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1124 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1125 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 6]")) => ()
57.1126 + | _ => raise error "rlang.sml: diff.behav. in Schalk II s.56 Bsp 74a [x = 6]";
57.1127 +
57.1128 +
57.1129 +(*----------------- Schalk II s.56 Bsp 77b ------------------------*)
57.1130 +"Schalk II s.56 Bsp 77b (sqrt(x+12)+sqrt(x - 3) = sqrt(x + 32) - sqrt(5+x))";
57.1131 +"Schalk II s.56 Bsp 77b (sqrt(x+12)+sqrt(x - 3) = sqrt(x + 32) - sqrt(5+x))";
57.1132 +"Schalk II s.56 Bsp 77b (sqrt(x+12)+sqrt(x - 3) = sqrt(x + 32) - sqrt(5+x))";
57.1133 +(*EO-4*)
57.1134 +val fmz = ["equality (sqrt(x+12)+sqrt(x - 3) = sqrt(x + 32) - sqrt(5+x))",
57.1135 + "solveFor x","solutions L"];
57.1136 +val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
57.1137 +
57.1138 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.1139 +(* val nxt = ("Model_Problem",Model_Problem ["sq","root","univariate","equation"]) *)
57.1140 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1141 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1142 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1143 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1144 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1145 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1146 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1147 +(* val nxt = ("Model_Problem",Model_Problem ["sq","root","univariate","equation"]) *)
57.1148 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1149 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1150 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1151 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1152 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1153 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1154 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt; f2str f;
57.1155 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1156 +(* val nxt = ("Model_Problem",Model_Problem ["sq","root","univariate","equation"]) *)
57.1157 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1158 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1159 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1160 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1161 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1162 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1163 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1164 +(*val nxt = ("Model_Problem",
57.1165 + Model_Problem ["normalize","polynomial","univariate","equation"])*)
57.1166 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1167 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1168 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1169 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1170 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1171 +(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt; since MGs norm_Rational*)
57.1172 +if f = Form'(FormKF (~1, EdUndef, 0, Nundef, "451584 + -112896 * x = 0"))then()
57.1173 +else raise error "rlang.sml: diff.behav. in Schalk II s.56 Bsp 77b";
57.1174 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1175 +(* val nxt = ("Model_Problem",
57.1176 + Model_Problem ["degree_1","polynomial","univariate","equation"])*)
57.1177 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1178 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1179 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1180 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1181 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1182 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1183 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1184 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1185 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1186 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[]")) => ()
57.1187 + | _ => raise error "rlang.sml: diff.behav. in Schalk II s.56 Bsp 77b []";
57.1188 +(*added 040209 at introducing MGs norm_Rational ?!*)
57.1189 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1190 +
57.1191 +
57.1192 +(*----------------- Schalk II s.66 Bsp 4 ------------------------*)
57.1193 +"Schalk II s.66 Bsp 4 ((6*x - 9)*(5*x+7) - (4*x+7)*(3*x - 6) = 429)";
57.1194 +"Schalk II s.66 Bsp 4 ((6*x - 9)*(5*x+7) - (4*x+7)*(3*x - 6) = 429)";
57.1195 +"Schalk II s.66 Bsp 4 ((6*x - 9)*(5*x+7) - (4*x+7)*(3*x - 6) = 429)";
57.1196 +(*EP*)
57.1197 +val fmz = ["equality ((6*x - 9)*(5*x+7) - (4*x+7)*(3*x - 6) = 429)",
57.1198 + "solveFor x","solutions L"];
57.1199 +val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
57.1200 +(*val p = e_pos';
57.1201 +val c = [];
57.1202 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
57.1203 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
57.1204 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.1205 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1206 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1207 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1208 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1209 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1210 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1211 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1212 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1213 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1214 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1215 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1216 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1217 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1218 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1219 +case f of Form' (FormKF (_,_,0,_,"[x = 5, x = -5]")) => ()
57.1220 + | _ => raise error "rlang.sml: diff.behav. in Schalk II s.66 Bsp 4 []";
57.1221 +
57.1222 +
57.1223 +(*----------------- Schalk II s.66 Bsp 8a ------------------------*)
57.1224 +"Schalk II s.66 Bsp 8a ((x - 4)/(x+4) = (1 - x)/(1+x))";
57.1225 +(*ER-15*)
57.1226 +val fmz = ["equality ((x - 4)/(x+4) = (1 - x)/(1+x))",
57.1227 + "solveFor x","solutions L"];
57.1228 +val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
57.1229 +
57.1230 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.1231 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1232 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1233 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1234 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1235 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1236 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1237 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt; f2str f;
57.1238 +(*"(-4 + x) * (1 + x) = (1 + -1 * x) * (4 + x)"
57.1239 +-> Subproblem ("RatEq.thy", ["univariate", ...])*)
57.1240 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1241 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1242 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1243 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1244 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1245 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1246 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1247 +if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "-8 + 2 * x ^^^ 2 = 0")) then ()
57.1248 +else raise error "rlang.sml: diff.behav. in Schalk II s.66 Bsp 8a";
57.1249 +(*-> Subproblem ("PolyEq.thy", ["polynomial", ...])*)
57.1250 +(*
57.1251 + val Form' (FormKF (~1, EdUndef, 0, Nundef, str)) = f;
57.1252 + *)
57.1253 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1254 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1255 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1256 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1257 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1258 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1259 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1260 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1261 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1262 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 2, x = -2]")) => ()
57.1263 + | _ => raise error "rlang.sml: diff.behav. in Schalk II s.66 Bsp 8a [x = 2, x = -2]";
57.1264 +
57.1265 +(*----------------- Schalk II s.66 Bsp 10b ------------------------*)
57.1266 +"Schalk II s.66 Bsp 10b (1/(x^^^2 - 9)+(2*x+3)/(x+3)=(3*x+4)/(x - 3))";
57.1267 +"Schalk II s.66 Bsp 10b (1/(x^^^2 - 9)+(2*x+3)/(x+3)=(3*x+4)/(x - 3))";
57.1268 +"Schalk II s.66 Bsp 10b (1/(x^^^2 - 9)+(2*x+3)/(x+3)=(3*x+4)/(x - 3))";
57.1269 +val fmz = ["equality (1/(x^^^2 - 9)+(2*x+3)/(x+3)=(3*x+4)/(x - 3))",
57.1270 + "solveFor x","solutions L"];
57.1271 +val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
57.1272 +(*val p = e_pos';
57.1273 +val c = [];
57.1274 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
57.1275 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
57.1276 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.1277 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1278 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1279 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1280 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1281 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1282 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1283 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1284 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1285 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1286 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1287 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1288 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1289 +if f = Form'
57.1290 + (FormKF
57.1291 + (~1,
57.1292 + EdUndef,
57.1293 + 0,
57.1294 + Nundef,
57.1295 + "60 + 28 * x + -13 * x ^^^ 2 + -1 * x ^^^ 3 = 0")) then ()
57.1296 +else raise error "rlang.sml: diff.behav. in Schalk II s.66 Bsp 10b";
57.1297 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1298 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1299 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1300 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1301 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1302 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1303 +(*60 + 28 * x + -13 * x ^^^ 2 + -1 * x ^^^ 3 = 0 ... degree 3 not solvable*)
57.1304 +
57.1305 +
57.1306 +(*----------------- Schalk II s.66 Bsp 20a ------------------------*)
57.1307 +(*EO-6*)
57.1308 +"Schalk II s.66 Bsp 20a (sqrt(29 - sqrt (x^^^2 - 9))=5)";
57.1309 +"Schalk II s.66 Bsp 20a (sqrt(29 - sqrt (x^^^2 - 9))=5)";
57.1310 +"Schalk II s.66 Bsp 20a (sqrt(29 - sqrt (x^^^2 - 9))=5)";
57.1311 +val fmz = ["equality (sqrt(29 - sqrt(x^^^2 - 9))=5)",
57.1312 + "solveFor x","solutions L"];
57.1313 +val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
57.1314 +(*val p = e_pos';
57.1315 +val c = [];
57.1316 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
57.1317 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
57.1318 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.1319 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1320 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1321 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1322 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1323 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1324 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1325 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1326 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1327 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1328 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1329 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1330 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1331 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1332 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1333 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1334 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1335 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1336 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1337 +if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "-25 + x ^^^ 2 = 0")) then ()
57.1338 +else raise error "rlang.sml: diff.behav. in Schalk II s.66 Bsp 20a";
57.1339 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1340 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1341 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1342 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1343 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1344 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1345 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1346 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1347 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1348 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1349 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1350 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 5, x = -5]")) => ()
57.1351 + | _ => raise error "rlang.sml: diff.behav. in Schalk II s.66 Bsp 20a [x = 5, x = -5]";
57.1352 +
57.1353 +(*----------------- Schalk II s.66 Bsp 23b ------------------------*)
57.1354 +"Schalk II s.66 Bsp 23b (2*sqrt(261 - x) - sqrt(2+2*x)=sqrt(2)*sqrt(5 - 3*x))";
57.1355 +"Schalk II s.66 Bsp 23b (2*sqrt(261 - x) - sqrt(2+2*x)=sqrt(2)*sqrt(5 - 3*x))";
57.1356 +"Schalk II s.66 Bsp 23b (2*sqrt(261 - x) - sqrt(2+2*x)=sqrt(2)*sqrt(5 - 3*x))";
57.1357 +(*EO WN060310 something wrong:
57.1358 +([6, 6, 3, 1], Frm) "-1064944 + 32 * x + -48 * x ^^^ 2 = 0"
57.1359 + ### or2list False
57.1360 +([6, 6, 3, 1], Res) "False"
57.1361 +*)
57.1362 +val fmz = ["equality (2*sqrt(261 - x) - sqrt(2+2*x)=sqrt(2)*sqrt(5 - 3*x))",
57.1363 + "solveFor x","solutions L"];
57.1364 +val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
57.1365 +
57.1366 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.1367 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1368 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1369 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1370 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1371 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1372 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1373 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1374 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1375 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1376 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1377 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1378 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1379 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1380 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1381 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1382 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1383 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1384 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1385 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1386 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt; f2str f;
57.1387 +if f = Form'
57.1388 + (FormKF
57.1389 + (~1, EdUndef, 0, Nundef, "-1064944 + 32 * x + -48 * x ^^^ 2 = 0"))then()
57.1390 +else raise error "rlang.sml: diff.behav. in Schalk II s.66 Bsp 23b";
57.1391 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1392 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1393 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1394 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1395 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1396 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1397 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1398 +case f of Form' (FormKF (~1,EdUndef,_,Nundef,"[]")) => ()
57.1399 + | _ => raise error "rlang.sml: diff.behav. in Schalk II s.66 Bsp 23b []";
57.1400 +
57.1401 +(*----------------- Schalk II s.66 Bsp 28a ------------------------*)
57.1402 +"Schalk II s.66 Bsp 28a (A=(c/d)*sqrt(4*a^^^2 - c^^^2))";
57.1403 +"Schalk II s.66 Bsp 28a (A=(c/d)*sqrt(4*a^^^2 - c^^^2))";
57.1404 +"Schalk II s.66 Bsp 28a (A=(c/d)*sqrt(4*a^^^2 - c^^^2))";
57.1405 +val fmz = ["equality (A=(c/d)*sqrt(4*a^^^2 - c^^^2))",
57.1406 + "solveFor a","solutions L"];
57.1407 +val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
57.1408 +(*val p = e_pos';
57.1409 +val c = [];
57.1410 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
57.1411 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
57.1412 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.1413 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1414 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1415 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1416 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1417 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1418 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1419 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1420 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1421 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1422 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1423 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1424 +(*if f = Form'
57.1425 + (FormKF
57.1426 + (~1,
57.1427 + EdUndef,
57.1428 + 0,
57.1429 + Nundef,
57.1430 + "c ^^^ 4 / d ^^^ 2 + A ^^^ 2 * d ^^^ 2 / d ^^^ 2 +\n-4 * c ^^^ 2 / d ^^^ 2 * a ^^^ 2 =\n0")) then ()*)
57.1431 +if f2str f =
57.1432 + "c ^^^ 4 / d ^^^ 2 + A ^^^ 2 / 1 + -4 * c ^^^ 2 / d ^^^ 2 * a ^^^ 2 = 0"
57.1433 +then () else raise error "rlang.sml: diff.behav. in Schalk II s.66 Bsp 28a";
57.1434 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1435 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1436 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1437 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1438 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1439 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1440 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1441 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1442 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1443 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[a = sqrt ((c ^^^ 4 + A ^^^ 2 * d ^^^ 2) / (4 * c ^^^ 2)),\n a = -1 * sqrt ((c ^^^ 4 + A ^^^ 2 * d ^^^ 2) / (4 * c ^^^ 2))]")) => ()
57.1444 +| _ => raise error "rlang.sml: diff.behav. in Schalk II s.66 Bsp 28a [a=...]";
57.1445 +
57.1446 +
57.1447 +
57.1448 +(*----------------- Schalk II s.68 Bsp 52b ------------------------*)
57.1449 +"Schalk II s.68 Bsp 52b (1/(x - a+b)=1/x - 1/a + 1/b)";
57.1450 +val fmz = ["equality (1/(x - a+b)=1/x - 1/a + 1/b)",
57.1451 + "solveFor x","solutions L"];
57.1452 +val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
57.1453 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.1454 +(* val nxt = ("Model_Problem",Model_Problem ["rational","univariate","equation"])*)
57.1455 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1456 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1457 +(*val nxt = ("Specify_Theory",Specify_Theory "RatEq.thy")*)
57.1458 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1459 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1460 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1461 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1462 +(*val p = ([3],Res)
57.1463 +val f="1 * (a * (b * x)) = (a * b + (a * x + -1 * (b * x))) * (b + (x + -1 * a)
57.1464 +val nxt = Subproblem ("RatEq.thy",["univariate","equation"]))*)
57.1465 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1466 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1467 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1468 +(*val nxt = ("Specify_Theory",Specify_Theory "PolyEq.thy")*)
57.1469 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1470 +(* nxt = Specify_Problem ["normalize","polynomial","univariate","equation"])*)
57.1471 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1472 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1473 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1474 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1475 +(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt; at introducing of MGs norm_Rational*)
57.1476 +(*val p = ([4,5],Res) val f ="b * a ^^^ 2 + -1 * a * b ^^^ 2 + (a ^^^ 2 + b ^^^ 2 + -2 * a * b) * x +\n(b + -1 * a) * x ^^^ 2 =\n0"))
57.1477 +val nxt = Subproblem ("PolyEq.thy",["polynomial","univariate","equation"]))*)
57.1478 +if f = Form'
57.1479 + (FormKF
57.1480 + (~1,
57.1481 + EdUndef,
57.1482 + 0,
57.1483 + Nundef,
57.1484 + "b * a ^^^ 2 + -1 * a * b ^^^ 2 + (a ^^^ 2 + b ^^^ 2 + -2 * a * b) * x +\n(b + -1 * a) * x ^^^ 2 =\n0")) then ()
57.1485 +else raise error "rlang.sml: diff.behav. in chalk I s.87 Bsp 38b";
57.1486 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1487 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1488 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1489 +(*val nxt = ("Specify_Theory",Specify_Theory "PolyEq.thy")*)
57.1490 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1491 +(*Specify_Problem["abcFormula","degree_2","polynomial","univariate","equation*)
57.1492 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1493 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1494 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1495 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1496 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1497 +(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt;introducing MGs norm_Rational*)
57.1498 +(*val p = ([4,6,5],Res) val f ="[x =\n (2 * a * b + -1 * a ^^^ 2 + -1 * b ^^^ 2 +\n sqrt\n (a ^^^ 4 + b ^^^ 4 + -4 * a * a * b ^^^ 2 + -4 * a * b * a ^^^ 2 +\n -4 * b * b * a ^^^ 2 +\n 4 * a * a * b ^^^ 2 +\n 4 * a * b * a ^^^ 2 +\n 2 * a ^^^ 2 * b ^^^ 2)) /\n (-2 * a + 2 * #"
57.1499 +nx Check_Postcond["abcFormula","degree_2","polynomial","univariate","equation*)
57.1500 +(*9.9.03: -"- ["normalize","polynomial","univar...*)
57.1501 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1502 +(*val p = ([4,6],Res)
57.1503 +val nxt =Check_Postcond ["normalize","polynomial","univariate","equation"])*)
57.1504 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1505 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;(*1 additional for MGs norm_Rational*)
57.1506 +if p = ([],Res) andalso f = Form' (FormKF (~1,EdUndef,0,Nundef,
57.1507 +"[x =\n (2 * a * b + -1 * a ^^^ 2 + -1 * b ^^^ 2 +\n sqrt\n (a ^^^ 4 + b ^^^ 4 + -4 * a * a * b ^^^ 2 + -4 * a * b * a ^^^ 2 +\n -4 * b * b * a ^^^ 2 +\n 4 * a * a * b ^^^ 2 +\n 4 * a * b * a ^^^ 2 +\n 2 * a ^^^ 2 * b ^^^ 2)) /\n (-2 * a + 2 * b),\n x =\n (2 * a * b + -1 * a ^^^ 2 + -1 * b ^^^ 2 +\n -1 *\n sqrt\n (a ^^^ 4 + b ^^^ 4 + -4 * a * a * b ^^^ 2 + -4 * a * b * a ^^^ 2 +\n -4 * b * b * a ^^^ 2 +\n 4 * a * a * b ^^^ 2 +\n 4 * a * b * a ^^^ 2 +\n 2 * a ^^^ 2 * b ^^^ 2)) /\n (-2 * a + 2 * b)]")) andalso nxt = ("End_Proof'",End_Proof') then writeln"simplify MG"
57.1508 +else raise error "rlang.sml: diff.behav. in rational-a-b";
57.1509 +
57.1510 +(*----------------- Schalk II s.68 Bsp 56a ------------------------*)
57.1511 +"Schalk II s.68 Bsp 56a ((a+b*x)/(a-b*x) - (a - b*x)/(a+b*x)= (4*a*b)/(a^^^2 - b^^^2))";
57.1512 +val fmz = ["equality ((a+b*x)/(a-b*x) - (a - b*x)/(a+b*x)= (4*a*b)/(a^^^2 - b^^^2))","solveFor x","solutions L"];
57.1513 +val (dI',pI',mI') = ("RatEq.thy",["univariate","equation"],["no_met"]);
57.1514 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.1515 +(* val nxt = ("Model_Problem",Model_Problem ["rational","univariate","equation"]) *)
57.1516 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1517 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1518 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1519 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1520 +(*SK loops with poly:
57.1521 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1522 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1523 +
57.1524 +... with sml-nj:
57.1525 + (a + b * x) / (a + -1 * (b * x)) + (-1 * a + b * x) / (a + b * x) =
57.1526 + 4 * (a * b) / (a ^^^ 2 + -1 * b ^^^ 2)
57.1527 +common_nominator_p wird nicht angewendet, weil ...
57.1528 +add_fract terminiert nicht: 030603
57.1529 +siehe Rational.ML rational.sml
57.1530 +*)
57.1531 +
57.1532 +(*
57.1533 +"(a + b * x) / (a + -1 * (b * x)) + -1 * (a + -1 * (b * x)) / (a + b * x) =\n4 * a * b / (a ^^^ 2 + -1 * b ^^^ 2)"
57.1534 +
57.1535 +val nxt = ("Rewrite_Set",Rewrite_Set "make_ratpoly") : string * tac
57.1536 +"(a + b * x) / (a + -1 * b * x) + (-1 * a + b * x) / (a + b * x) =\n4 *
57.1537 +a * b / (a ^^^ 2 + -1 * b ^^^ 2)"
57.1538 +
57.1539 +
57.1540 +val t = str2term"(a + b * x) / (a + -1 * (b * x)) + -1 * (a + -1 * (b * x)) / (a + b * x) =\n4 * a * b / (a ^^^ 2 + -1 * b ^^^ 2)";
57.1541 +trace_rewrite:=true;
57.1542 +val SOME (t',asm) = rewrite_set_ thy false norm_Rational t;
57.1543 +term2str t';
57.1544 +trace_rewrite:=false;
57.1545 +
57.1546 +# rls: norm_Rational on: (a + b * x) / (a + -1 * (b * x)) + -1 * (a + -1 * (b * x)) / (a + b * x) = 4 * a * b / (a ^^^ 2 + -1 * b ^^^ 2)
57.1547 +
57.1548 +## rls: discard_minus on:
57.1549 +## rls: powers on:
57.1550 +## rls: rat_mult_divide on:
57.1551 +## rls: expand on:
57.1552 +## rls: reduce_0_1_2 on:
57.1553 +## rls: order_add_mult on:
57.1554 +### try thm: real_mult_commute
57.1555 +=== rewrites to: (a + b * x) / (a + -1 * (b * x)) + (-1 * a + -1 * (-1 * (b * x))) / (a + b * x) = b * (4 * a) / (a ^^^ 2 + -1 * b ^^^ 2)
57.1556 +
57.1557 +### try thm: real_mult_left_commute
57.1558 +=== rewrites to: (a + b * x) / (a + -1 * (b * x)) + (-1 * a + -1 * (-1 * (b * x))) / (a + b * x) = 4 * (b * a) / (a ^^^ 2 + -1 * b ^^^ 2)
57.1559 +
57.1560 +### try thm: real_mult_commute
57.1561 +=== rewrites to: (a + b * x) / (a + -1 * (b * x)) + (-1 * a + -1 * (-1 * (b * x))) / (a + b * x) = 4 * (a * b) / (a ^^^ 2 + -1 * b ^^^ 2)
57.1562 +
57.1563 +### try calc: op *'
57.1564 +=== calc. to: (a + b * x) / (a + -1 * (b * x)) + (-1 * a + 1 * (b * x)) / (a +b * x) = 4 * (a * b) / (a ^^^ 2 + -1 * b ^^^ 2)
57.1565 +
57.1566 +## rls: common_nominator_p on: (a + b * x) / (a + -1 * (b * x)) + (-1 * a + 1 * (b * x)) / (a + b * x) =
57.1567 + 4 * (a * b) / (a ^^^ 2 + -1 * b ^^^ 2)
57.1568 +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!GC
57.1569 +
57.1570 +## rls: discard_minus on:
57.1571 +## rls: powers on:
57.1572 +## rls: rat_mult_divide on:
57.1573 +## rls: expand on:
57.1574 +## rls: reduce_0_1_2 on:
57.1575 +### try thm: real_mult_1
57.1576 +=== rewrites to: (a + b * x) / (a + -1 * (b * x)) + (-1 * a + b * x) / (a + b * x) = 4 * (a * b) / (a ^^^ 2 + -1 * b ^^^ 2)
57.1577 +
57.1578 +## rls: order_add_mult on:
57.1579 +
57.1580 +## rls: common_nominator_p on: (a + b * x) / (a + -1 * (b * x)) + (-1 * a + b * x) / (a + b * x) =
57.1581 + 4 * (a * b) / (a ^^^ 2 + -1 * b ^^^ 2)
57.1582 +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!GC
57.1583 +
57.1584 +## rls: discard_minus on:
57.1585 +## rls: powers on:
57.1586 +## rls: rat_mult_divide on:
57.1587 +## rls: expand on:
57.1588 +## rls: reduce_0_1_2 on:
57.1589 +## rls: order_add_mult on:
57.1590 +## rls: collect_numerals on:
57.1591 +## rls: common_nominator_p on: (a + b * x) / (a + -1 * (b * x)) + (-1 * a + b * x) / (a + b * x) =
57.1592 +4 * (a * b) / (a ^^^ 2 + -1 * b ^^^ 2)
57.1593 +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!GC
57.1594 +*)
57.1595 +
57.1596 +
57.1597 +(*----------------- Schalk II s.68 Bsp 61b ------------------------*)
57.1598 +"Schalk II s.68 Bsp 61b (sqrt(x+a)+sqrt(b - x)=sqrt(a+b))";
57.1599 +val fmz = ["equality (sqrt(x+a)+sqrt(b - x)=sqrt(a+b))",
57.1600 + "solveFor x","solutions L"];
57.1601 +val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
57.1602 +
57.1603 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.1604 +(* val nxt = ("Model_Problem",Model_Problem ["sq","root","univariate","equation"])*)
57.1605 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1606 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1607 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1608 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1609 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1610 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1611 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1612 +(* val nxt = ("Model_Problem",Model_Problem ["sq","root","univariate","equation"])*)
57.1613 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1614 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1615 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1616 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1617 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1618 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1619 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1620 +(*val nxt = ("Model_Problem",
57.1621 + Model_Problem ["normalize","polynomial","univariate","equation"])*)
57.1622 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1623 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1624 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1625 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1626 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1627 +if f = Form'
57.1628 + (FormKF
57.1629 + (~1,
57.1630 + EdUndef,
57.1631 + 0,
57.1632 + Nundef,
57.1633 + (*"-4 * b ^^^ 2 + -4 * a * b + 4 * b ^^^ 2 + 8 * a * b +\n(-2 * a + -4 * a + -4 * b + 2 * a + 8 * b) * x +\n-4 * x ^^^ 2 =\n0" before MG*)
57.1634 + "4 * a * b + (-4 * a + 4 * b) * x + -4 * x ^^^ 2 = 0")) then ()
57.1635 +else raise error "rlang.sml: diff.behav. in Schalk II s.68 Bsp 61b";
57.1636 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1637 +(*val nxt = ("Model_Problem", Model_Problem
57.1638 + ["abcFormula","degree_2","polynomial","univariate","equation"])*)
57.1639 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1640 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1641 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1642 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1643 +(* f= ... "-4 * b ^^^ 2 + -4 * a * b + 4 * b ^^^ 2 + 8 * a * b +
57.1644 + (-2 * a + -4 * a + -4 * b + 2 * a + 8 * b) * x + -4 * x ^^^ 2 =0"*)
57.1645 +(*val nxt = ("Rewrite_Set_Inst",Rewrite_Set_Inst ([#],"d2_polyeq_abcFormula_simplify"))*)
57.1646 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1647 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1648 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1649 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1650 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1651 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1652 +(*if f = Form' (FormKF (~1,EdUndef,0,Nundef, with norm_Rational before MG
57.1653 +"[x =\n (-2 * a + -4 * b + 6 * a +\n sqrt\n (32 * a * b + -16 * a ^^^ 2 + -48 * b ^^^ 2 + 24 * a ^^^ 2 +\n 64 * b ^^^ 2 +\n 8 * a ^^^ 2)) /\n -8,\n x =\n (-2 * a + -4 * b + 6 * a +\n -1 *\n sqrt\n (32 * a * b + -16 * a ^^^ 2 + -48 * b ^^^ 2 + 24 * a ^^^ 2 +\n 64 * b ^^^ 2 +\n 8 * a ^^^ 2)) /\n -8]")) then writeln"simplify MG"*)
57.1654 +if f = Form' (FormKF (~1,EdUndef,0,Nundef,"[x =\n (-4 * b + 4 * a + sqrt (32 * a * b + 16 * a ^^^ 2 + 16 * b ^^^ 2)) / -8,\n x =\n (-4 * b + 4 * a + -1 * sqrt (32 * a * b + 16 * a ^^^ 2 + 16 * b ^^^ 2)) /\n -8]")) then ()
57.1655 +else raise error "rlang.sml: diff.behav. Bsp 61b";
57.1656 +(*WN.18.12.03: extreme run-time !!!*)
57.1657 +
57.1658 +
57.1659 +(*----------------- Schalk II s.68 Bsp 62b ------------------------*)
57.1660 +"Schalk II s.68 Bsp 62b (sqrt((x+a)^^^2+(x - 2*b)^^^2)=a+2*b)";
57.1661 +val fmz = ["equality (sqrt((x+a)^^^2+(x - 2*b)^^^2)=a+2*b)",
57.1662 + "solveFor x","solutions L"];
57.1663 +val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
57.1664 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.1665 +(*val nxt = ("Model_Problem",Model_Problem ["sq","root","univariate","equation"]) *)
57.1666 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1667 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1668 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1669 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1670 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1671 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1672 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1673 +(* val nxt = ("Model_Problem",
57.1674 + Model_Problem ["normalize","polynomial","univariate","equation"])*)
57.1675 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1676 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1677 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1678 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1679 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1680 +if f = Form'
57.1681 + (FormKF
57.1682 + (~1,
57.1683 + EdUndef,
57.1684 + 0,
57.1685 + Nundef,
57.1686 + "-4 * a * b + (-4 * b + 2 * a) * x + 2 * x ^^^ 2 = 0")) then ()
57.1687 +else raise error "rlang.sml: diff.behav. in Schalk II s.68 Bsp 62b";
57.1688 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1689 +(*val nxt = ("Model_Problem", Model_Problem
57.1690 + ["abcFormula","degree_2","polynomial","univariate","equation"])*)
57.1691 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1692 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1693 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1694 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1695 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1696 +(*val f = ... "-4 * a * b + (-4 * b + 2 * a) * x + 2 * x ^^^ 2 = 0" *)
57.1697 +(*val nxt = ("Rewrite_Set_Inst",Rewrite_Set_Inst ([#],"d2_polyeq_abcFormula_simplify"))*)
57.1698 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1699 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1700 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1701 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1702 +(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt;introduc.MGs norm_Rational*)
57.1703 +if f = Form' (FormKF (~1,EdUndef,0,Nundef,
57.1704 + "[x = (-2 * a + 4 * b + sqrt (16 * a * b + 16 * b ^^^ 2 + 4 * a ^^^ 2)) / 4,\n x =\n (-2 * a + 4 * b + -1 * sqrt (16 * a * b + 16 * b ^^^ 2 + 4 * a ^^^ 2)) / 4]")) then writeln "simplify MG"
57.1705 +else raise error "rlang.sml: diff.behav. in II 62b [x=...]";
57.1706 +val asms = get_assumptions_ pt p;
57.1707 +if asms = [(str2term"0 <= ((-2 * a + 4 * b + sqrt (16 * a * b + 16 * b ^^^ 2 + 4 * a ^^^ 2)) / 4 + a) ^^^ 2 + ((-2 * a + 4 * b + sqrt (16 * a * b + 16 * b ^^^ 2 + 4 * a ^^^ 2)) / 4 - 2 * b) ^^^ 2", []),
57.1708 + (str2term"0 <= a + 2 * b", []),
57.1709 + (str2term"8 * (-4 * a * b) <= (-4 * b + 2 * a) ^^^ 2", []),
57.1710 + (str2term"8 * (-4 * a * b) <= (-4 * b + 2 * a) ^^^ 2", []),
57.1711 + (str2term"0 <= ((-2 * a + 4 * b + -1 * sqrt (16 * a * b + 16 * b ^^^ 2 + 4 * a ^^^ 2)) / 4 + a) ^^^ 2 + ((-2 * a + 4 * b + -1 * sqrt (16 * a * b + 16 * b ^^^ 2 + 4 * a ^^^ 2)) / 4 - 2 * b) ^^^ 2", []),
57.1712 + (str2term"0 <= a + 2 * b", []),
57.1713 + (str2term"8 * (-4 * a * b) <= (-4 * b + 2 * a) ^^^ 2", []),
57.1714 + (str2term"8 * (-4 * a * b) <= (-4 * b + 2 * a) ^^^ 2", [])]
57.1715 +then writeln "should be simplified MG"
57.1716 +else raise error "rlang.sml: diff.behav. in II 62b asms";
57.1717 +
57.1718 +"------ WN.TEST---------------------------------";
57.1719 +"------ WN.TEST---------------------------------";
57.1720 +"------ WN.TEST---------------------------------";
57.1721 +(*EO-7*)
57.1722 +val fmz = ["equality ((2*x+1)*x^^^2 = 0)",
57.1723 + "solveFor x","solutions L"];
57.1724 +val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
57.1725 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.1726 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1727 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1728 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1729 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1730 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1731 +(*
57.1732 +val f = Form' (FormKF (~1,EdUndef,1,Nundef,"(2 * x + 1) * x ^^^ 2 = 0"))
57.1733 +normiert nicht ... korr.WN:
57.1734 +val t = str2term "(2*x+1)*x^^^2 = 0";
57.1735 +val subst = [(str2term "bdv", str2term "x")];
57.1736 +val SOME (t',_) = rewrite_set_inst_ thy false subst make_ratpoly_in t;
57.1737 +if term2str t' = "x ^^^ 2 + 2 * x ^^^ 3 = 0" then ()
57.1738 +else raise error "rlang.sml: 7";
57.1739 +*)
57.1740 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1741 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1742 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1743 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1744 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1745 +
57.1746 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1747 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1748 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1749 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1750 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
57.1751 +if f = Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 0, x = 0, x = -1 / 2]")) then()
57.1752 +else raise error "rlang.sml WN.TEST new behaviour";
57.1753 +
57.1754 +"------ rlang.sml end---------------------------------";
57.1755 +
57.1756 +(*------------------------------vvv-Rewrite_Set "rat_eliminate"---------
57.1757 +> trace_rewrite:=true;
57.1758 +> val t = str2term
57.1759 + "(3 + -1 * x + 1 * x ^^^ 2) / (9 * x + -6 * x ^^^ 2 + 1 * x ^^^ 3) = 1 / x";
57.1760 +> val SOME (t',asm) =
57.1761 + rewrite_ thy dummy_ord rateq_erls true rat_mult_denominator_both t;
57.1762 +> term2str t'; terms2str asm;
57.1763 +"(3 + -1 * x + 1 * x ^^^ 2) * x = 1 * (9 * x + -6 * x ^^^ 2 + 1 * x ^^^ 3)"
57.1764 +"[\"9 * x + -6 * x ^^^ 2 + 1 * x ^^^ 3 ~= 0\",\"x ~= 0\"]"
57.1765 +> trace_rewrite:=false;
57.1766 + ------------------------------^^^-Rewrite_Set "rat_eliminate"---------*)
57.1767 +
57.1768 +
57.1769 +"-------------------- WN.15.5.03: Pythagoras -------------------------------";
57.1770 +"-------------------- WN.15.5.03: Pythagoras -------------------------------";
57.1771 +"-------------------- WN.15.5.03: Pythagoras -------------------------------";
57.1772 +(*EO-9*)
57.1773 +val fmz = ["equality ((a/2)^^^2 + (b/2)^^^2 = r^^^2)",
57.1774 + "solveFor a","solutions L"];
57.1775 +val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
57.1776 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.1777 +(* Model_Problem ["normalize","polynomial","univariate","equation"])*)
57.1778 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1779 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1780 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1781 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1782 +(*val nxt = ("Apply_Method",Apply_Method ["PolyEq","normalize_poly"])*)
57.1783 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1784 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1785 +(*val nxt = Subproblem ("PolyEq.thy",["polynomial","univariate","equation"])*)
57.1786 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1787 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1788 +(*val nxt =Model_Problem ["sq_only","degree_2","polynomial","univariate","equation"])*)
57.1789 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1790 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1791 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1792 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1793 +(*val nxt = Apply_Method ["PolyEq","solve_d2_polyeq_sqonly_equation"])*)
57.1794 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1795 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1796 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1797 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1798 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1799 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1800 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1801 +if f = Form' (FormKF (~1,EdUndef,0,Nundef,
57.1802 +"[a = sqrt ((-1 * b ^^^ 2 + 4 * r ^^^ 2) / 1),\n a = -1 * sqrt ((-1 * b ^^^ 2 + 4 * r ^^^ 2) / 1)]")) andalso nxt = ("End_Proof'",End_Proof')
57.1803 +then writeln"simplify result\nsimplify result\nsimplify result"
57.1804 +else raise error "rlang.sml: diff.behav. in Pythagoras";
57.1805 +val asms = get_assumptions_ pt p;
57.1806 +(*if asms = [(str2term"0 <= -4 * (b ^^^ 2 / 4 + -4 * r ^^^ 2 / 4)", []),
57.1807 + (str2term"0 <= -4 * (b ^^^ 2 / 4 + -4 * r ^^^ 2 / 4)", [])]*)
57.1808 +if asms2str asms =
57.1809 + "[(0 <= -4 * (b ^^^ 2 / 4 + -1 * r ^^^ 2 / 1), []),\
57.1810 + \(0 <= -4 * (b ^^^ 2 / 4 + -1 * r ^^^ 2 / 1), [])]"
57.1811 +then writeln"simplify result\nsimplify result\nsimplify result"
57.1812 +else raise error "rlang.sml: diff.behav. in Pythagoras asms";
57.1813 +
57.1814 +
57.1815 +"-------------------- WN.15.5.03: equation within the maximum example ------";
57.1816 +"-------------------- WN.15.5.03: equation within the maximum example ------";
57.1817 +"-------------------- WN.15.5.03: equation within the maximum example ------";
57.1818 +(*EO-10*)
57.1819 +val fmz = ["equality (2*sqrt(r^^^2 - (u/2)^^^2) - u^^^2/(2*sqrt(r^^^2 - (u/2)^^^2))= 0)",
57.1820 + "solveFor u","solutions L"];
57.1821 +val (dI',pI',mI') = ("PolyEq.thy",["univariate","equation"],["no_met"]);
57.1822 +
57.1823 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
57.1824 +(* Model_Problem ["normalize","root","univariate","equation"])*)
57.1825 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1826 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1827 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1828 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1829 +(*val nxt = Apply_Method ["RootEq","norm_sq_root_equation"]) *)
57.1830 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1831 +(*val nxt = Subproblem ("RootEq.thy",["univariate","equation"]))*)
57.1832 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1833 +(*val nxt = Model_Problem ["sq","root","univariate","equation"]) *)
57.1834 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1835 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1836 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1837 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1838 +(*val nxt = Apply_Method ["RootEq","solve_sq_root_equation"]) *)
57.1839 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1840 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1841 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1842 +(*val nxt = Subproblem ("RootEq.thy",["univariate","equation"]))*)
57.1843 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1844 +(*val nxt = Model_Problem ["rational","univariate","equation"]) *)
57.1845 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1846 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1847 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1848 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1849 +(*val nxt = Apply_Method ["RootEq","solve_rat_equation"]) *)
57.1850 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1851 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1852 +(*val nxt = Subproblem ("RootEq.thy",["univariate","equation"]))*)
57.1853 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1854 +(*val nxt = Model_Problem ["normalize","polynomial","univariate","equation"]) *)
57.1855 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1856 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1857 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1858 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1859 +(*val nxt = Apply_Method ["PolyEq","normalize_poly"]) *)
57.1860 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1861 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1862 +(*val nxt = Subproblem ("PolyEq.thy",["polynomial","univariate","equation"]))*)
57.1863 +if f = Form'
57.1864 + (FormKF
57.1865 + (~1,
57.1866 + EdUndef,
57.1867 + 0,
57.1868 + Nundef,
57.1869 + "-16 * r ^^^ 4 + 8 * r ^^^ 2 * u ^^^ 2 = 0")) then ()
57.1870 +else raise error "rlang.sml: diff.behav. in Schalk I s.87 Bsp 38b";
57.1871 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1872 +(*val nxt = Model_Problem ["sq_only","degree_2","polynomial","univariate","equation"]) *)
57.1873 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1874 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1875 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1876 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1877 +(*val nxt = Apply_Method ["PolyEq","solve_d2_polyeq_sqonly_equation"]) *)
57.1878 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1879 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1880 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1881 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1882 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1883 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1884 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
57.1885 +if f = Form' (FormKF (~1,EdUndef,0,Nundef,"[u = sqrt (2 * r ^^^ 2 / 1), u = -1 * sqrt (2 * r ^^^ 2 / 1)]")) then()
57.1886 +else raise error "rlang.sml WN.TEST new behaviour in max-rooteq";
58.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
58.2 +++ b/test/Tools/isac/Knowledge/root.sml Mon Aug 30 14:35:51 2010 +0200
58.3 @@ -0,0 +1,15 @@
58.4 +(* testexamples for Root, radicals
58.5 + *)
58.6 +
58.7 +val thy = Root.thy;
58.8 +
58.9 +val t = str2term "sqrt 1";
58.10 +val SOME (t',_) = rewrite_set_ thy false Root_erls t;
58.11 +if term2str t' = "1" then () else raise error "root.sml: diff.behav. sqrt 1";
58.12 +val t = str2term "sqrt -1";
58.13 +val NONE = rewrite_set_ thy false Root_erls t;
58.14 +
58.15 +val t = str2term "sqrt 0";
58.16 +val SOME (t',_) = rewrite_set_ thy false Root_erls t;
58.17 +term2str t';
58.18 +if term2str t' = "0" then () else raise error "root.sml: diff.behav. sqrt 1";
59.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
59.2 +++ b/test/Tools/isac/Knowledge/rooteq.sml Mon Aug 30 14:35:51 2010 +0200
59.3 @@ -0,0 +1,470 @@
59.4 +(* RL 10.02
59.5 + use"../kbtest/rooteq.sml";
59.6 + use"rooteq.sml";
59.7 + testexamples for RootEq, equations with fractions
59.8 +
59.9 + Compiler.Control.Print.printDepth:=10; (*4 default*)
59.10 + Compiler.Control.Print.printDepth:=5; (*4 default*)
59.11 + trace_rewrite:=true;
59.12 +*)
59.13 +"----------- rooteq.sml begin--------";
59.14 +"--------------(1/sqrt(x)=5)---------------------------------------";
59.15 +"--------------(4*sqrt(4*x+2)=3*sqrt(2*x+24))----------------------";
59.16 +"--------------(sqrt(x+1)=5)---------------------------------------";
59.17 +"--------------(sqrt(x+1)+sqrt(4*x+4)=sqrt(9*x+9))-----------------";
59.18 +"--------------(3*sqrt(x+3)+sqrt(x+6)=sqrt(4*x+33))----------------";
59.19 +"--------------(sqrt(x+1)+sqrt(4*x+4)=sqrt(9*x+9))-----------------";
59.20 +
59.21 +val t = (term_of o the o (parse RootEq.thy)) "(sqrt(2+x+3)) is_rootTerm_in x";
59.22 +val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
59.23 +val result = term2str t_;
59.24 +if result <> "True" then raise error "rooteq.sml: new behaviour:" else ();
59.25 +
59.26 +val t = (term_of o the o (parse RootEq.thy)) "(sqrt(2+x+3)) is_rootTerm_in x";
59.27 +val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
59.28 +val result = term2str t_;
59.29 +if result <> "True" then raise error "rooteq.sml: new behaviour:" else ();
59.30 +
59.31 +val t = (term_of o the o (parse RootEq.thy)) "(nroot 5 (x+4)) is_rootTerm_in x";
59.32 +val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
59.33 +val result = term2str t_;
59.34 +if result <> "True" then raise error "rooteq.sml: new behaviour:" else ();
59.35 +
59.36 +val t = (term_of o the o (parse RootEq.thy)) "(sqrt(2+x+3)) is_sqrtTerm_in x";
59.37 +val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
59.38 +val result = term2str t_;
59.39 +if result <> "True" then raise error "rooteq.sml: new behaviour:" else ();
59.40 +
59.41 +val t = (term_of o the o (parse RootEq.thy)) "(sqrt(25)) is_sqrtTerm_in x";
59.42 +val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
59.43 +val result = term2str t_;
59.44 +if result <> "False" then raise error "rooteq.sml: new behaviour:" else ();
59.45 +
59.46 +val t = (term_of o the o (parse RootEq.thy)) "sqrt(1 + x) is_normSqrtTerm_in x";
59.47 +val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
59.48 +val result = term2str t_;
59.49 +if result <> "True" then raise error "rooteq.sml: new behaviour:" else ();
59.50 +
59.51 +val t = (term_of o the o (parse RootEq.thy)) "(3+3*sqrt(x)) is_normSqrtTerm_in x";
59.52 +val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
59.53 +val result = term2str t_;
59.54 +if result <> "True" then raise error "rooteq.sml: new behaviour:" else ();
59.55 +
59.56 +val t = (term_of o the o (parse RootEq.thy)) "(sqrt(x+1)+1) is_normSqrtTerm_in x";
59.57 +val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
59.58 +val result = term2str t_;
59.59 +if result <> "False" then raise error "rooteq.sml: new behaviour:" else ();
59.60 +
59.61 +val t = (term_of o the o (parse RootEq.thy)) "(1 - u/(sqrt(r - u))) is_normSqrtTerm_in u";
59.62 +val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
59.63 +val result = term2str t_;
59.64 +if result <> "False" then raise error "rooteq.sml: new behaviour:" else ();
59.65 +
59.66 +val t = (term_of o the o (parse RootEq.thy)) "(x*(1+x)/(sqrt(x+1))) is_normSqrtTerm_in x";
59.67 +val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
59.68 +val result = term2str t_;
59.69 +if result <> "True" then raise error "rooteq.sml: new behaviour:" else ();
59.70 +
59.71 +val t = (term_of o the o (parse RootEq.thy)) "(1 - (sqrt(2+x+3)^^^3)) is_normSqrtTerm_in x";
59.72 +val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
59.73 +val result = term2str t_;
59.74 +if result <> "False" then raise error "rooteq.sml: new behaviour:" else ();
59.75 +
59.76 +val t = (term_of o the o (parse RootEq.thy)) "(1 + (sqrt(2+x+3)^^^3)) is_normSqrtTerm_in x";
59.77 +val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
59.78 +val result = term2str t_;
59.79 +if result <> "True" then raise error "rooteq.sml: new behaviour:" else ();
59.80 +
59.81 +
59.82 +
59.83 +val result = match_pbl ["equality (sqrt(x)=1)","solveFor x","solutions L"]
59.84 + (get_pbt ["root","univariate","equation"]);
59.85 +case result of Matches' _ => () | _ => raise error "rooteq.sml: new behaviour:";
59.86 +
59.87 +val result = match_pbl ["equality (sqrt(25)=1)","solveFor x","solutions L"]
59.88 + (get_pbt ["root","univariate","equation"]);
59.89 +case result of NoMatch' _ => () | _ => raise error "rooteq.sml: new behaviour:";
59.90 +
59.91 +(*---------rooteq---- 23.8.02 ---------------------*)
59.92 +"---------(1/sqrt(x)=5)---------------------";
59.93 +val fmz = ["equality (1/sqrt(x)=5)","solveFor x","solutions L"];
59.94 +val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
59.95 +
59.96 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
59.97 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.98 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.99 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.100 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.101 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.102 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.103 +(*"1 / x = 25" -> Subproblem ("RootEq.thy", ["univariate", ...]) *)
59.104 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.105 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.106 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.107 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.108 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.109 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.110 +(*"1 = 25 * x" -> Subproblem ("RatEq.thy", ["univariate", ...])*)
59.111 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.112 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.113 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.114 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.115 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.116 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.117 +if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "1 + -25 * x = 0")) then ()
59.118 +else raise error "rooteq.sml: diff.behav.poly in (1/sqrt(x)=5)";
59.119 +(*-> Subproblem ("PolyEq.thy", ["polynomial", ...])*)
59.120 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.121 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.122 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.123 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.124 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.125 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.126 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.127 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.128 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.129 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.130 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.131 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 1 / 25]")) => ()
59.132 + | _ => raise error "rooteq.sml: diff.behav. [x = 1 / 25]";
59.133 +if asms2str (get_assumptions_ pt p) = "[(0 <= 1 / 25, [])]"
59.134 +(*WN050916 before correction 'rewrite__set_ called with 'Erls' for ..:
59.135 + [(str2term"25 ~= 0",[])] *)
59.136 +then writeln "should be True\n\
59.137 + \should be True\n\
59.138 + \should be True\n"
59.139 +else raise error "rooteq.sml: diff.behav. with 25 ~= 0";
59.140 +
59.141 +"---------(sqrt(x+1)=5)---------------------";
59.142 +val fmz = ["equality (sqrt(x+1)=5)","solveFor x","solutions L"];
59.143 +val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
59.144 +(*val p = e_pos';
59.145 +val c = [];
59.146 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
59.147 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
59.148 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
59.149 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.150 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.151 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.152 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.153 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.154 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.155 +(*-> Subproblem ("RootEq.thy", ["univariate", ...])*)
59.156 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.157 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.158 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.159 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.160 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.161 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.162 +if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "-24 + x = 0")) then ()
59.163 +else raise error "rooteq.sml: diff.behav.poly in sqrt(x+1)=5";
59.164 +(*-> Subproblem ("PolyEq.thy", ["polynomial", ...])*)
59.165 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.166 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.167 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.168 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.169 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.170 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.171 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.172 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.173 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.174 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 24]")) => ()
59.175 + | _ => raise error "rooteq.sml: diff.behav. [x = 24]";
59.176 +
59.177 +"-------------(4*sqrt(4*x+2)=3*sqrt(2*x+24))-----------------";
59.178 +val fmz = ["equality (4*sqrt(4*x+2)=3*sqrt(2*x+24))","solveFor x","solutions L"];
59.179 +val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
59.180 +
59.181 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
59.182 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.183 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.184 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.185 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.186 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.187 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.188 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.189 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.190 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.191 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.192 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.193 +if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "-184 + 46 * x = 0")) then ()
59.194 +else raise error "rooteq.sml: diff.behav.poly in 4*sqrt(4*x+2)=3*sqrt(2*x+24)";
59.195 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.196 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.197 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.198 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.199 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.200 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.201 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.202 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.203 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
59.204 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 4]")) => ()
59.205 + | _ => raise error "rooteq.sml: diff.behav. [x = 4]";
59.206 +if get_assumptions_ pt p = [(str2term"0 <= 12 * sqrt 2 * 4",[])]
59.207 +then writeln "should be True\nshould be True\nshould be True\n\
59.208 + \should be True\nshould be True\nshould be True\n"
59.209 +else raise error "rooteq.sml: diff.behav. with 0 <= 12 * sqrt 2 * 4";
59.210 +
59.211 +"--------------(sqrt(x+1)+sqrt(4*x+4)=sqrt(9*x+9))----------------";
59.212 +val fmz = ["equality (sqrt(x+1)+sqrt(4*x+4)=sqrt(9*x+9))","solveFor x","solutions L"];
59.213 +val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
59.214 +
59.215 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
59.216 +(*val nxt = Model_Problem ["sq","root","univariate","equation"]) *)
59.217 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.218 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.219 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.220 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.221 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.222 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.223 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.224 +(*"13 + 13 * x + -2 * sqrt ((4 + 4 * x) * (9 + 9 * x)) = 1 + x"))
59.225 +val nxt = ("Subproblem",Subproblem ("RootEq.thy",["univariate","equation"]))*)
59.226 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.227 +(*val nxt = Model_Problem ["sq","root","univariate","equation"]) *)
59.228 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.229 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.230 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.231 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.232 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.233 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.234 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.235 +(*"144 + 288 * x + 144 * x ^^^ 2 = 144 + x ^^^ 2 + 288 * x + 143 * x ^^^ 2"))
59.236 +val nxt = ("Subproblem",Subproblem ("RootEq.thy",["univariate","equation"]))*)
59.237 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.238 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.239 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.240 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.241 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.242 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.243 +if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "0 = 0")) then ()
59.244 +else raise error "rooteq.sml: diff.behav.poly in (sqrt(x+1)+sqrt(4*x+4)=sqr..";
59.245 +(*-> Subproblem ("PolyEq.thy", ["degree_0", ...])*)
59.246 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.247 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.248 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.249 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.250 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.251 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.252 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.253 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.254 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.255 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.256 +val asm = get_assumptions_ pt p;
59.257 +if f = Form' (FormKF (~1,EdUndef,0,Nundef,"UniversalList")) andalso asm = []
59.258 +then () else raise error "rooteq.sml: diff.behav. in UniversalList 1";
59.259 +
59.260 +
59.261 +
59.262 +"--------------(sqrt(x+1)+sqrt(4*x+4)=sqrt(9*x+9))---------- SUBPBL.2.------";
59.263 +val fmz =
59.264 + ["equality (13 + 13 * x + -2 * sqrt ((4 + 4 * x) * (9 + 9 * x)) = 1 + x)",
59.265 + "solveFor x","solutions L"];
59.266 +val (dI',pI',mI') = ("RootEq.thy",["sq","root","univariate","equation"],
59.267 + ["RootEq","solve_sq_root_equation"]);
59.268 +(*val p = e_pos'; val c = [];
59.269 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
59.270 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
59.271 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
59.272 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.273 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.274 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.275 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.276 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.277 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.278 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.279 +(*"144 + 288 * x + 144 * x ^^^ 2 = 144 + x ^^^ 2 + 288 * x + 143 * x ^^^ 2"))
59.280 +val nxt = ("Subproblem",Subproblem ("RootEq.thy",["univariate","equation"])) *)
59.281 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.282 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.283 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.284 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.285 +(*val p = ([6],Pbl)val nxt = Specify_Method ["PolyEq","normalize_poly"])*)
59.286 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.287 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.288 +(*val p = ([6,2],Res) val f = Form' (FormKF (~1,EdUndef,2,Nundef,"0 = 0"))
59.289 +val nxt = Subproblem ("PolyEq.thy",["polynomial","univariate","equation"]))*)
59.290 +if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "0 = 0")) then ()
59.291 +else raise error "rooteq.sml: diff.behav.poly in sqrt(x+1)+sqrt(4*x+4)=sqrt..";
59.292 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.293 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.294 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.295 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.296 +(*val nxt = Specify_Method ["PolyEq","solve_d0_polyeq_equation"]) *)
59.297 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.298 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.299 +(*val p = ([6,3,1],Res) val f = Form' (FormKF (~1,EdUndef,3,Nundef,"True"))
59.300 +val nxt = ("Or_to_List",Or_to_List) : string * tac*)
59.301 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.302 +(*val p = ([6,3,2],Res) val f = (~1,EdUndef,3,Nundef,"UniversalList"))
59.303 +val nxt = Check_Postcond ["degree_0","polynomial","univariate","equation"])*)
59.304 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.305 +(*val p = ([6,3],Res) val f =(~1,EdUndef,2,Nundef,"UniversalList"))
59.306 +val nxt = Check_Postcond ["normalize","polynomial","univariate","equation"])*)
59.307 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.308 +if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "UniversalList")) then ()
59.309 +else raise error "rooteq.sml: diff.behav.poly in sqrt(x+1)+sqrt(4*x+4)=sqrt..";
59.310 +(* val Form' (FormKF (~1, EdUndef, 0, Nundef, str)) = f;
59.311 + *)
59.312 +
59.313 +(*same error as full expl #######*)
59.314 +
59.315 +"--------------(sqrt(x+1)+sqrt(4*x+4)=sqrt(9*x+9))---------- OKversion----";
59.316 +val fmz = ["equality (sqrt(x) = 1)","solveFor x","solutions L"];
59.317 +val (dI',pI',mI') = ("RootEq.thy",["sq","root","univariate","equation"],
59.318 + ["RootEq","solve_sq_root_equation"]);
59.319 +(*val p = e_pos'; val c = [];
59.320 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
59.321 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
59.322 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
59.323 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.324 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.325 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.326 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.327 +(*val p = ([],Pbl)val nxt = Specify_Method ["RootEq","solve_sq_root_equation"*)
59.328 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.329 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.330 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.331 +(* val p = ([2],Res) val f = Form' (FormKF (~1,EdUndef,1,Nundef,"x = 1"))
59.332 +val nxt = ("Subproblem",Subproblem ("RootEq.thy",["univariate","equation"]))*)
59.333 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.334 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.335 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.336 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.337 +(*val nxt = ("Specify_Method",Specify_Method ["PolyEq","normalize_poly"])*)
59.338 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.339 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.340 +(*val p = ([3,2],Res)val f = Form' (FormKF (~1,EdUndef,2,Nundef,"-1 + x = 0"))
59.341 +val nxt = Subproblem ("PolyEq.thy",["polynomial","univariate","equation"]))*)
59.342 +if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "-1 + x = 0")) then ()
59.343 +else raise error "rooteq.sml: diff.behav.poly in sqrt(x+1)+sqrt(4*x+4)=sqrt..";
59.344 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.345 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.346 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.347 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.348 +(*val nxt = Specify_Method ["PolyEq","solve_d1_polyeq_equation"]) *)
59.349 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.350 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.351 +(*val p = ([3,3,2],Res) val f = Form' (FormKF (~1,EdUndef,3,Nundef,"x = 1"))
59.352 +val nxt = ("Or_to_List",Or_to_List) *)
59.353 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.354 +(*val p = ([3,3,3],Res) val f = Form' (FormKF (~1,EdUndef,3,Nundef,"[x = 1]"))
59.355 +val nxt = ("Check_elementwise",Check_elementwise "Assumptions")*)
59.356 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.357 +(*val p = ([3,3,4],Res) val f = Form' (FormKF (~1,EdUndef,3,Nundef,"[x = 1]"))
59.358 +val nxt = Check_Postcond ["degree_1","polynomial","univariate","equation"])*)
59.359 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.360 +(*val p = ([3,3],Res) val f = Form' (FormKF (~1,EdUndef,2,Nundef,"[x = 1]"))
59.361 +val nxt = Check_Postcond ["normalize","polynomial","univariate","equation"])*)
59.362 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.363 +
59.364 +(*val p = ([3],Res) val f = Form' (FormKF (~1,EdUndef,1,Nundef,"[x = 1]"))
59.365 +val nxt = ("Check_elementwise",Check_elementwise "Assumptions")
59.366 + --------------------------------*)
59.367 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.368 +(*val p = ([4],Res) val f = Form' (FormKF (~1,EdUndef,1,Nundef,"[x = 1]"))
59.369 +val nxt = Check_Postcond ["sq","root","univariate","equation"]) *)
59.370 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.371 +if p = ([],Res) andalso f = Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 1]"))
59.372 +then () else raise error "diff.behav. in rooteq.sml: sqrt(x) = 1";
59.373 +
59.374 +
59.375 +"--------------(sqrt(x+1)+sqrt(4*x+4)=sqrt(9*x+9))---------- SHORTEST.1.----\
59.376 +\ with same error";
59.377 +val fmz = ["equality (sqrt x = sqrt x)","solveFor x","solutions L"];
59.378 +val (dI',pI',mI') = ("RootEq.thy",["sq","root","univariate","equation"],
59.379 + ["RootEq","solve_sq_root_equation"]);
59.380 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
59.381 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.382 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.383 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.384 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.385 +(*val p = ([],Pbl)val nxt = Specify_Method ["RootEq","solve_sq_root_equation"*)
59.386 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.387 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.388 +(*val p = ([1],Res) val f = Form' (FormKF (~1,EdUndef,1,Nundef,"x = x"))
59.389 +val nxt = ("Subproblem",Subproblem ("RootEq.thy",["univariate","equation"]))*)
59.390 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.391 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.392 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.393 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.394 +(*val p = ([2],Pbl) val nxt = Specify_Method ["PolyEq","normalize_poly"])*)
59.395 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.396 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.397 +(*val p = ([2,2],Res) val f = Form' (FormKF (~1,EdUndef,2,Nundef,"0 = 0"))
59.398 +val nxt = Subproblem ("PolyEq.thy",["polynomial","univariate","equation"]))*)
59.399 +if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "0 = 0")) then ()
59.400 +else raise error "rooteq.sml: diff.behav.poly in sqrt(x+1)+sqrt(4*x+4)=sqrt..";
59.401 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.402 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.403 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.404 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.405 +(*val p = ([2,3],Pbl)nxt=Specify_Method ["PolyEq","solve_d0_polyeq_equation"]*)
59.406 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.407 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.408 +(*val p = ([2,3,2],Res) val f = (FormKF (~1,EdUndef,3,Nundef,"UniversalList"))
59.409 +val nxt = Check_Postcond ["degree_0","polynomial","univariate","equation"])*)
59.410 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.411 +(*val p = ([2,3],Res) val f = (FormKF (~1,EdUndef,2,Nundef,"UniversalList"))
59.412 +val nxt = Check_Postcond ["normalize","polynomial","univariate","equation"])*)
59.413 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.414 +(*val p = ([2],Res) val f = (FormKF (~1,EdUndef,1,Nundef,"UniversalList"))
59.415 +val nxt = Check_elementwise "Assumptions"*)
59.416 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.417 +(*val p = ([3],Res) val f = (FormKF (~1,EdUndef,1,Nundef,"UniversalList"))
59.418 +val nxt = Check_Postcond ["sq","root","univariate","equation"]) *)
59.419 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.420 +if p = ([],Res) andalso f = Form'(FormKF (~1,EdUndef,0,Nundef,"UniversalList"))
59.421 +then () else raise error "new behav. in rooteq.sml: sqrt x = sqrt x";
59.422 +
59.423 +
59.424 +"--------------(3*sqrt(x+3)+sqrt(x+6)=sqrt(4*x+33))----------------";
59.425 +val fmz = ["equality (3*sqrt(x+3)+sqrt(x+6)=sqrt(4*x+33))","solveFor x","solutions L"];
59.426 +val (dI',pI',mI') = ("RootEq.thy",["univariate","equation"],["no_met"]);
59.427 +
59.428 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
59.429 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.430 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.431 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.432 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.433 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.434 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.435 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.436 +(* "6 + x = 60 + 13 * x + -6 * sqrt ((3 + x) * (33 + 4 * x))")) : mout
59.437 +val nxt = ("Subproblem",Subproblem ("RootEq.thy",["univariate","equation"]))*)
59.438 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.439 +(*val nxt = Model_Problem ["sq","root","univariate","equation"]) *)
59.440 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.441 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.442 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.443 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.444 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.445 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.446 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.447 +(*"2916 + x ^^^ 2 + 1296 * x + 143 * x ^^^ 2 = 3564 + 1620 * x + 144 * x ^^^ 2"))
59.448 +val nxt = ("Subproblem",Subproblem ("RootEq.thy",["univariate","equation"]))*)
59.449 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.450 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.451 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.452 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.453 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.454 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.455 +if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "-648 + -324 * x = 0")) then ()
59.456 +else raise error "rooteq.sml: diff.behav.poly in 3*sqrt(x+3)+sqrt(x+6)=sqrt..";
59.457 +(*-> Subproblem ("PolyEq.thy", ["degree_1", ...])*)
59.458 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.459 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.460 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.461 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.462 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.463 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.464 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.465 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.466 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.467 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
59.468 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = -2]")) => ()
59.469 + | _ => raise error "rooteq.sml: diff.behav. [x = -2]";
59.470 +
59.471 +"----------- rooteq.sml end--------";
59.472 +
59.473 +
60.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
60.2 +++ b/test/Tools/isac/Knowledge/rootrateq.sml Mon Aug 30 14:35:51 2010 +0200
60.3 @@ -0,0 +1,229 @@
60.4 +(* testexamples for RootratEq, equations mixing fractions and roots
60.5 + use"rootrateq.sml";
60.6 + *)
60.7 +
60.8 +val thy = Isac.thy;
60.9 +
60.10 +"--------------------- tests on predicates -------------------------------";
60.11 +"--------------------- tests on predicates -------------------------------";
60.12 +"--------------------- tests on predicates -------------------------------";
60.13 +(*
60.14 + Compiler.Control.Print.printDepth:=5; (*4 default*)
60.15 + trace_rewrite:=true;
60.16 + trace_rewrite:=false;
60.17 +*)
60.18 +val t1 = (term_of o the o (parse thy)) "(-8 - sqrt(x) + x^^^2) is_rootRatAddTerm_in x";
60.19 +val SOME (t,_) = rewrite_set_ RootRatEq.thy false RootRatEq_prls t1;
60.20 +if (term2str t) = "False" then ()
60.21 + else raise error "rootrateq.sml: diff.behav. 1 in is_rootRatAddTerm_in";
60.22 +
60.23 +val t1 = (term_of o the o (parse thy)) "(1/x) is_rootRatAddTerm_in x";
60.24 +val SOME (t,_) = rewrite_set_ RootRatEq.thy false RootRatEq_prls t1;
60.25 +if (term2str t) = "False" then ()
60.26 + else raise error "rootrateq.sml: diff.behav. 2 in is_rootRatAddTerm_in";
60.27 +
60.28 +val t1 = (term_of o the o (parse thy)) "(1/sqrt(x)) is_rootRatAddTerm_in x";
60.29 +val SOME (t,_) = rewrite_set_ RootRatEq.thy false RootRatEq_prls t1;
60.30 +if (term2str t) = "False" then ()
60.31 + else raise error "rootrateq.sml: diff.behav. 3 in is_rootRatAddTerm_in";
60.32 +
60.33 +val t1 = (term_of o the o (parse thy)) "(1/(sqrt(x)+1)) is_rootRatAddTerm_in x";
60.34 +val SOME (t,_) = rewrite_set_ RootRatEq.thy false RootRatEq_prls t1;
60.35 +if (term2str t) = "True" then ()
60.36 + else raise error "rootrateq.sml: diff.behav. 4 in is_rootRatAddTerm_in";
60.37 +
60.38 +val t1 = (term_of o the o (parse thy)) "(3 + 1/(1+sqrt(x))) is_rootRatAddTerm_in x";
60.39 +val SOME (t,_) = rewrite_set_ RootRatEq.thy false RootRatEq_prls t1;
60.40 +if (term2str t) = "True" then ()
60.41 + else raise error "rootrateq.sml: diff.behav. 5 in is_rootRatAddTerm_in";
60.42 +
60.43 +val t1 = (term_of o the o (parse thy)) "(1/(1+sqrt(y)) + 3 + 1/(1+sqrt(x))) is_rootRatAddTerm_in x";
60.44 +val SOME (t,_) = rewrite_set_ RootRatEq.thy false RootRatEq_prls t1;
60.45 +if (term2str t) = "True" then ()
60.46 + else raise error "rootrateq.sml: diff.behav. 6 in is_rootRatAddTerm_in";
60.47 +
60.48 +val t1 = (term_of o the o (parse thy)) "(1/(1+sqrt(x)) + 3 + 1/(1+sqrt(y))) is_rootRatAddTerm_in x";
60.49 +val SOME (t,_) = rewrite_set_ RootRatEq.thy false RootRatEq_prls t1;
60.50 +if (term2str t) = "True" then ()
60.51 + else raise error "rootrateq.sml: diff.behav. 7 in is_rootRatAddTerm_in";
60.52 +
60.53 +
60.54 +"--------------------- test thm rootrat_equation_left_1 ---------------------";
60.55 +val fmz = ["equality ( -2 + 1/(1 - sqrt(x))= 0)", "solveFor x","solutions L"];
60.56 +val (dI',pI',mI') = ("RootRatEq.thy",["univariate","equation"],["no_met"]);
60.57 +
60.58 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
60.59 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.60 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.61 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.62 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.63 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.64 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.65 +(*-> Subproblem ("RootEq.thy", ["univariate", ...])*)
60.66 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.67 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.68 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.69 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.70 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.71 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.72 +(*-> Subproblem ("RootEq.thy", ["univariate", ...])*)
60.73 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.74 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.75 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.76 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.77 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.78 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.79 +(*-> Subproblem ("RootEq.thy", ["univariate", ...])*)
60.80 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.81 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.82 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.83 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.84 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.85 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.86 +if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "1 + -4 * x = 0")) then ()
60.87 +else raise error "rootrateq.sml: diff.behav. in rootrat_equation_left_1";
60.88 +(*-> Subproblem ("RootEq.thy", ["polynomial", ...])*)
60.89 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.90 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.91 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.92 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.93 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.94 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.95 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.96 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.97 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.98 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.99 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 1 / 4]")) => ()
60.100 + | _ => raise error "rootrateq.sml: diff.behav. in -2 + 1/(1 - sqrt(x))= 0 -> [x = 1/4]";
60.101 +
60.102 +"--------------------- test thm rootrat_equation_left_2 ---------------------";
60.103 +val fmz = ["equality (3/(1+sqrt(x))= 1)", "solveFor x","solutions L"];
60.104 +val (dI',pI',mI') = ("RootRatEq.thy",["univariate","equation"],["no_met"]);
60.105 +
60.106 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
60.107 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.108 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.109 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.110 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.111 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.112 +(*-> Subproblem ("RootEq.thy", ["univariate", ...])*)
60.113 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.114 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.115 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.116 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.117 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.118 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.119 +(*-> Subproblem ("RootEq.thy", ["univariate", ...])*)
60.120 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.121 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.122 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.123 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.124 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.125 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.126 +(*-> Subproblem ("RootEq.thy", ["univariate", ...])*)
60.127 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.128 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.129 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.130 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.131 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.132 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.133 +if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "4 + -1 * x = 0")) then ()
60.134 +else raise error "rootrateq.sml: diff.behav. in rootrat_equation_left_2";
60.135 +(*-> Subproblem ("PolyEq.thy", ["polynomial", ...])*)
60.136 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.137 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.138 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.139 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.140 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.141 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.142 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.143 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.144 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.145 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.146 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 4]")) => ()
60.147 + | _ => raise error "rootrateq.sml: diff.behav. in 3/(1+sqrt(x))= 1 -> [x = 4]";
60.148 +
60.149 +"--------------------- test thm rootrat_equation_right_1 ---------------";
60.150 +val fmz = ["equality ( 0= -2 + 1/(1 - sqrt(x)))", "solveFor x","solutions L"];
60.151 +val (dI',pI',mI') = ("RootRatEq.thy",["univariate","equation"],["no_met"]);
60.152 +
60.153 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
60.154 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.155 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.156 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.157 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.158 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.159 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.160 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.161 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.162 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.163 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.164 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.165 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.166 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.167 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.168 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.169 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.170 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.171 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.172 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.173 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.174 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.175 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.176 +if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "-1 + 4 * x = 0")) then ()
60.177 +else raise error "rootrateq.sml: diff.behav.ppoly in rootrat_equation_right_1";
60.178 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.179 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.180 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.181 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.182 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.183 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.184 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.185 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.186 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.187 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.188 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.189 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 1 / 4]")) => ()
60.190 + | _ => raise error "rootrateq.sml: diff.behav. in -2 + 1/(1 - sqrt(x))= 0 -> [x = 1/4]";
60.191 +
60.192 +"--------------------- test thm rootrat_equation_right_2 --------------------";
60.193 +val fmz = ["equality (1 = 3/(1+sqrt(x)))", "solveFor x","solutions L"];
60.194 +val (dI',pI',mI') = ("RootRatEq.thy",["univariate","equation"],["no_met"]);
60.195 +
60.196 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
60.197 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.198 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.199 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.200 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.201 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.202 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.203 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.204 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.205 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.206 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.207 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.208 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.209 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.210 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.211 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.212 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.213 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.214 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.215 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.216 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.217 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.218 +if f = Form' (FormKF (~1, EdUndef, 0, Nundef, "-4 + x = 0")) then ()
60.219 +else raise error "rootrateq.sml: diff.behav. in rootrat_equation_right_2";
60.220 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.221 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.222 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.223 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.224 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.225 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.226 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.227 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.228 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.229 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.230 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
60.231 +case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 4]")) => ()
60.232 + | _ => raise error "rootrateq.sml: diff.behav. in 3/(1+sqrt(x))= 1 -> [x = 4]";
61.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
61.2 +++ b/test/Tools/isac/Knowledge/simplify.sml Mon Aug 30 14:35:51 2010 +0200
61.3 @@ -0,0 +1,57 @@
61.4 +(* tests on simplification
61.5 + author: Walther Neuper
61.6 + 061019
61.7 + (c) due to copyright terms
61.8 +
61.9 +use"../smltest/IsacKnowledge/simplify.sml";
61.10 +use"simplify.sml";
61.11 +*)
61.12 +val thy = Simplify.thy;
61.13 +
61.14 +"-----------------------------------------------------------------";
61.15 +"table of contents -----------------------------------------------";
61.16 +"-----------------------------------------------------------------";
61.17 +"----------- CAS-command Simplify --------------------------------";
61.18 +"----------- append inform with final result ---------------------";
61.19 +"-----------------------------------------------------------------";
61.20 +"-----------------------------------------------------------------";
61.21 +"-----------------------------------------------------------------";
61.22 +
61.23 +
61.24 +
61.25 +"----------- CAS-command Simplify --------------------------------";
61.26 +"----------- CAS-command Simplify --------------------------------";
61.27 +"----------- CAS-command Simplify --------------------------------";
61.28 +states:=[];
61.29 +CalcTree [([], ("e_domID", ["e_pblID"], ["e_metID"]))];
61.30 +Iterator 1;
61.31 +moveActiveRoot 1;
61.32 +replaceFormula 1 "Simplify (2*a + 3*a)";
61.33 +autoCalculate 1 (Step 1);
61.34 +autoCalculate 1 CompleteCalc;
61.35 +val ((pt,p),_) = get_calc 1;
61.36 +val Form res = (#1 o pt_extract) (pt, ([],Res));
61.37 +show_pt pt;
61.38 +if p = ([], Res) andalso term2str res = "5 * a" then ()
61.39 +else raise error "simplify.sml: diff.behav. CAScmd: Simplify (2*a + 3*a)";
61.40 +
61.41 +
61.42 +"----------- append inform with final result ---------------------";
61.43 +"----------- append inform with final result ---------------------";
61.44 +"----------- append inform with final result ---------------------";
61.45 +states:=[];
61.46 +CalcTree [(["term ((14 * x * y) / ( x * y ))", "normalform N"],
61.47 + ("Rational.thy",["rational","simplification"],
61.48 + ["simplification","of_rationals"]))];
61.49 +Iterator 1;
61.50 +moveActiveRoot 1;
61.51 +autoCalculate 1 CompleteCalcHead;
61.52 +autoCalculate 1 (Step 1);
61.53 +appendFormula 1 "14";
61.54 +val ((pt,p),_) = get_calc 1; show_pt pt;
61.55 +
61.56 +autoCalculate 1 (Step 1);
61.57 +val ((pt,p),_) = get_calc 1; show_pt pt;
61.58 +val Form res = (#1 o pt_extract) (pt, ([],Res));
61.59 +if p = ([], Res) andalso term2str res = "14" then ()
61.60 +else raise error "simplify.sml: append inform with final result ?!?";
62.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
62.2 +++ b/test/Tools/isac/Knowledge/system.sml Mon Aug 30 14:35:51 2010 +0200
62.3 @@ -0,0 +1,103 @@
62.4 +(* tests on systems of equations over the reals
62.5 + author: Walther Neuper 050905
62.6 + (c) due to copyright terms
62.7 +
62.8 +use"../smltest/IsacKnowledge/system.sml";
62.9 +*)
62.10 +val thy = EqSystem.thy;
62.11 +
62.12 +"-----------------------------------------------------------------";
62.13 +"table of contents -----------------------------------------------";
62.14 +"-----------------------------------------------------------------";
62.15 +"----------- normalize system ------------------------------------";
62.16 +"----------- me --------------------------------------------------";
62.17 +"-----------------------------------------------------------------";
62.18 +"-----------------------------------------------------------------";
62.19 +"-----------------------------------------------------------------";
62.20 +
62.21 +
62.22 +"----------- normalize system ------------------------------------";
62.23 +"----------- normalize system ------------------------------------";
62.24 +"----------- normalize system ------------------------------------";
62.25 +val t = str2term "[0 = c*0 + -1*q_0*(0^^^2 / 2) + c_2,\
62.26 + \ 0 = c*L + -1*q_0*(L^^^2 / 2) + c_2]";
62.27 +val SOME (t,_) = rewrite_set_ thy false norm_Poly t;
62.28 +if term2str t =
62.29 +"[0 = -1 * q_0 * (0 / 2) + c_2, 0 = L * c + -1 * q_0 * (L ^^^ 2 / 2) + c_2]"
62.30 +then () else raise error "system.sml, diff.behav. in norm_Poly";
62.31 +
62.32 +val t = str2term "[0 = c*0 + -1*q_0*(0^^^2 / 2) + c_2,\
62.33 + \ 0 = c*L + -1*q_0*(L^^^2 / 2) + c_2]";
62.34 +val SOME (t,_) = rewrite_set_ thy false norm_Rational t;
62.35 +if term2str t =
62.36 +"[0 = c_2, 0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2]"
62.37 +then () else raise error "system.sml, diff.behav. in norm_Rational";
62.38 +
62.39 +
62.40 +val t = str2term "nth_ 1 [0 = c*0 + -1*q_0*(0^^^2 / 2) + c_2,\
62.41 + \ 0 = c*L + -1*q_0*(L^^^2 / 2) + c_2]";
62.42 +val SOME (t,_) = rewrite_set_ thy false list_rls t;
62.43 +if term2str t = "0 = c * 0 + -1 * q_0 * (0 ^^^ 2 / 2) + c_2"
62.44 +then () else raise error "system.sml, list_rls";
62.45 +
62.46 +
62.47 +"----------- me --------------------------------------------------";
62.48 +"----------- me --------------------------------------------------";
62.49 +"----------- me --------------------------------------------------";
62.50 +val fmz = ["equalities [0 = c_2 + c * 0 + -1 * q_0 / 2 * 0 ^^^ 2, 0 = c_2 + c * L + -1 * q_0 / 2 * L ^^^ 2]",
62.51 + "solveForVars [c, c_2]", "solution ss___"];
62.52 +val (dI',pI',mI') =
62.53 + ("Biegelinie.thy",["normalize","2x2","linear","system"],
62.54 + ["EqSystem","normalize","2x2"]);
62.55 +val p = e_pos'; val c = [];
62.56 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
62.57 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
62.58 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
62.59 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
62.60 +case nxt of (_, Specify_Theory "Biegelinie.thy") => ()
62.61 + | _ => raise error "system.sml diff.behav.in me --1";
62.62 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
62.63 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
62.64 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
62.65 +case nxt of (_, Apply_Method ["EqSystem", "normalize", "2x2"]) => ()
62.66 + | _ => raise error "system.sml diff.behav.in me --2";
62.67 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
62.68 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
62.69 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
62.70 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
62.71 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
62.72 +
62.73 +case nxt of (_, Subproblem ("Biegelinie.thy", ["triangular", "2x2",
62.74 + "linear", "system"])) => ()
62.75 + | _ => raise error "system.sml diff.behav.in me --3";
62.76 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
62.77 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
62.78 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
62.79 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
62.80 +case nxt of (_, Specify_Theory "Biegelinie.thy") => ()
62.81 + | _ => raise error "system.sml diff.behav.in me --1";
62.82 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
62.83 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
62.84 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
62.85 +case nxt of (_, Apply_Method ["EqSystem", "normalize", "2x2"]) => ()
62.86 + | _ => raise error "system.sml diff.behav.in me --2";
62.87 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
62.88 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
62.89 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
62.90 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
62.91 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
62.92 +
62.93 +
62.94 +(*---
62.95 +WN060421 stopped as soon as exp_IsacCore_Equ_Sys_Lin_No-1.xml worked ...
62.96 +
62.97 +if f2str f = "" then ()
62.98 +else raise error "system.sml diff.behav.in me --99";
62.99 +case nxt of ("End_Proof'", End_Proof') => ()
62.100 + | _ => raise error "system.sml diff.behav.in me --99";
62.101 +
62.102 +print_depth 11;nxt;print_depth 3;
62.103 +---*)
62.104 +(*
62.105 +use"../smltest/IsacKnowledge/system.sml";
62.106 +*)
63.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
63.2 +++ b/test/Tools/isac/Knowledge/termorder.sml Mon Aug 30 14:35:51 2010 +0200
63.3 @@ -0,0 +1,192 @@
63.4 + (* tests on rewrite orders
63.5 + author Matthias Goldgruber 2003
63.6 +
63.7 + WN0509 do not use this file anymore, since orders require thy:
63.8 + do tests in the smltest/IsacKnowledge/file.sml
63.9 + where file.ML defines the respective order !
63.10 +
63.11 +use"../smltest/IsacKnowledge/termorder.sml";
63.12 +*)
63.13 +
63.14 +
63.15 + (*MK die ersten Tests*)
63.16 + val substa = [(e_term, (term_of o the o (parse thy)) "a")];
63.17 + val substb = [(e_term, (term_of o the o (parse thy)) "b")];
63.18 + val substx = [(e_term, (term_of o the o (parse thy)) "x")];
63.19 +
63.20 + val x1 = (term_of o the o (parse thy)) "a + b + x";
63.21 + val x2 = (term_of o the o (parse thy)) "a + x + b";
63.22 + val x3 = (term_of o the o (parse thy)) "a + x + b";
63.23 + val x4 = (term_of o the o (parse thy)) "x + a + b";
63.24 +
63.25 +if ord_make_polynomial_in true thy substx (x1,x2) = true(*LESS *) then ()
63.26 +else raise error "termorder.sml diff.behav ord_make_polynomial_in #1";
63.27 +
63.28 +if ord_make_polynomial_in true thy substa (x1,x2) = true(*LESS *) then ()
63.29 +else raise error "termorder.sml diff.behav ord_make_polynomial_in #2";
63.30 +
63.31 +if ord_make_polynomial_in true thy substb (x1,x2) = false(*GREATER*) then ()
63.32 +else raise error "termorder.sml diff.behav ord_make_polynomial_in #3";
63.33 +
63.34 + val aa = (term_of o the o (parse thy)) "-1 * a * x";
63.35 + val bb = (term_of o the o (parse thy)) "x^^^3";
63.36 + ord_make_polynomial_in true thy substx (aa, bb);
63.37 + true; (* => LESS *)
63.38 +
63.39 + val aa = (term_of o the o (parse thy)) "-1 * a * x";
63.40 + val bb = (term_of o the o (parse thy)) "x^^^3";
63.41 + ord_make_polynomial_in true thy substa (aa, bb);
63.42 + false; (* => GREATER *)
63.43 +
63.44 + (*und nach dem Re-engineering der Termorders in den 'rulesets'
63.45 + kannst Du die 'gr"osste' Variable frei w"ahlen: *)
63.46 + val bdv= (term_of o the o (parse thy)) "bdv";
63.47 + val x = (term_of o the o (parse thy)) "x";
63.48 + val a = (term_of o the o (parse thy)) "a";
63.49 + val b = (term_of o the o (parse thy)) "b";
63.50 + val SOME (t',_) =
63.51 + rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in x2;
63.52 +if term2str t' = "b + x + a" then ()
63.53 +else raise error "termorder.sml diff.behav ord_make_polynomial_in #11";
63.54 +
63.55 + val NONE =
63.56 + rewrite_set_inst_ thy false [(bdv,b)] make_polynomial_in x2;
63.57 + term2str t';
63.58 + "a + x + b";
63.59 +
63.60 + val SOME (t',_) =
63.61 + rewrite_set_inst_ thy false [(bdv,x)] make_polynomial_in x2;
63.62 +if term2str t' = "a + b + x" then ()
63.63 +else raise error "termorder.sml diff.behav ord_make_polynomial_in #13";
63.64 +
63.65 +
63.66 +
63.67 + val ppp' = "-6 + -5*x + x^^^3 + -1*x^^^2 + -1*x^^^3 + -14*x^^^2";
63.68 + val ppp = (term_of o the o (parse thy)) ppp';
63.69 + val SOME (t',_) =
63.70 + rewrite_set_inst_ thy false [(bdv,x)] make_polynomial_in ppp;
63.71 +(*MG 2003...
63.72 + term2str t';
63.73 + "(-6) + (-5 * x + (-15 * x ^^^ 2))";*)
63.74 +if term2str t' = "-6 + -5 * x + -15 * x ^^^ 2 + 0" then ()
63.75 +else raise error "termorder.sml diff.behav ord_make_polynomial_in #14";
63.76 +
63.77 + val SOME (t',_) =
63.78 + rewrite_set_inst "Isac.thy"false [("bdv","x")] "make_polynomial_in" ppp';
63.79 +(*MG 2003...
63.80 + "(-6) + (-5 * x + (-15) * x ^^^ 2)";*)
63.81 +if t' = "-6 + -5 * x + -15 * x ^^^ 2 + 0" then ()
63.82 +else raise error "termorder.sml diff.behav ord_make_polynomial_in #15";
63.83 +
63.84 + val ttt' = "(3*x + 5)/18";
63.85 + val ttt = (term_of o the o (parse thy)) ttt';
63.86 + val SOME (uuu,_) =
63.87 + rewrite_set_inst_ thy false [(bdv,x)] make_polynomial_in ttt;
63.88 +if term2str uuu = "(5 + 3 * x) / 18" then ()
63.89 +else raise error "termorder.sml diff.behav ord_make_polynomial_in #16";
63.90 +
63.91 + val SOME (uuu,_) =
63.92 + rewrite_set_ thy false make_polynomial ttt;
63.93 +if term2str uuu = "(5 + 3 * x) / 18" then ()
63.94 +else raise error "termorder.sml diff.behav ord_make_polynomial_in #16";
63.95 +
63.96 +
63.97 +
63.98 +
63.99 +(*-----------28.2.03: war nicht upgedatet (und ausgeklammert in ROOT.ML
63.100 +
63.101 + (*Aufgabe zum Einstieg in die Arbeit...*)
63.102 + val t = (term_of o the o (parse thy)) "a*b - (a+b)*x + x^^^2 = 0";
63.103 + (*ein 'ruleset' aus Poly.ML wird angewandt...*)
63.104 + val SOME (t,_) = rewrite_set_ thy Poly_erls false make_polynomial t;
63.105 + term2str t;
63.106 + "a * b + (-1 * (a * x) + (-1 * (b * x) + x ^^^ 2)) = 0";
63.107 + val SOME (t,_) =
63.108 + rewrite_set_inst_ thy Poly_erls false [("bdv","a")] make_polynomial_in t;
63.109 + term2str t;
63.110 + "x ^^^ 2 + (-1 * (b * x) + (-1 * (x * a) + b * a)) = 0";
63.111 +(* bei Verwendung von "size_of-term" nach MG :*)
63.112 +(*"x ^^^ 2 + (-1 * (b * x) + (b * a + -1 * (x * a))) = 0" !!! *)
63.113 +
63.114 + (*wir holen 'a' wieder aus der Klammerung heraus...*)
63.115 + val SOME (t,_) = rewrite_set_ thy Poly_erls false discard_parentheses t;
63.116 + term2str t;
63.117 + "x ^^^ 2 + -1 * b * x + -1 * x * a + b * a = 0";
63.118 +(* "x ^^^ 2 + -1 * b * x + b * a + -1 * x * a = 0" !!! *)
63.119 +
63.120 + val SOME (t,_) =
63.121 + rewrite_set_inst_ thy Poly_erls false [("bdv","a")] make_polynomial_in t;
63.122 + term2str t;
63.123 + "x ^^^ 2 + (-1 * (b * x) + a * (b + -1 * x)) = 0";
63.124 + (*da sind wir fast am Ziel: make_polynomial_in 'a' sollte ergeben
63.125 + "x ^^^ 2 + (-1 * (b * x)) + (b + -1 * x) * a = 0"*)
63.126 +
63.127 + (*das rewriting l"asst sich beobachten mit
63.128 + trace_rewrite:=true;
63.129 + *)
63.130 +
63.131 +
63.132 +
63.133 +"------15.11.02 --------------------------";
63.134 + val t = (term_of o the o (parse thy)) "1 + a * x + b * x";
63.135 + val bdv = (term_of o the o (parse thy)) "bdv";
63.136 + val a = (term_of o the o (parse thy)) "a";
63.137 +
63.138 + trace_rewrite:=true;
63.139 + (* Anwenden einer Regelmenge aus Termorder.ML: *)
63.140 + val SOME (t,_) =
63.141 + rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
63.142 + term2str t;
63.143 + val SOME (t,_) =
63.144 + rewrite_set_ thy false discard_parentheses t;
63.145 + term2str t;
63.146 +"1 + b * x + x * a";
63.147 +
63.148 + val t = (term_of o the o (parse thy)) "1 + a * (x + b * x) + a^^^2";
63.149 + val SOME (t,_) =
63.150 + rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
63.151 + term2str t;
63.152 + val SOME (t,_) =
63.153 + rewrite_set_ thy false discard_parentheses t;
63.154 + term2str t;
63.155 +"1 + (x + b * x) * a + a ^^^ 2";
63.156 +
63.157 + val t = (term_of o the o (parse thy)) "1 + a ^^^2 * x + b * a + 7*a^^^2";
63.158 + val SOME (t,_) =
63.159 + rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
63.160 + term2str t;
63.161 + val SOME (t,_) =
63.162 + rewrite_set_ thy false discard_parentheses t;
63.163 + term2str t;
63.164 +"1 + b * a + (7 + x) * a ^^^ 2";
63.165 +
63.166 +(* MG2003
63.167 + Atools.thy grundlegende Algebra
63.168 + Poly.thy Polynome
63.169 + Rational.thy Br"uche
63.170 + Root.thy Wurzeln
63.171 + RootRat.thy Wurzen + Br"uche
63.172 + Termorder.thy BITTE NUR HIERHER SCHREIBEN (...WN03)
63.173 +
63.174 + cd"knowledge";
63.175 + remove_thy"Termorder";
63.176 + use_thy"Isac";
63.177 +
63.178 + get_thm Termorder.thy "bdv_n_collect";
63.179 + get_thm Isac.thy "bdv_n_collect";
63.180 +
63.181 +*)
63.182 + val t = (term_of o the o (parse thy)) "a ^^^2 * x + 7 * a^^^2";
63.183 + val SOME (t,_) =
63.184 + rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
63.185 + term2str t;
63.186 + val SOME (t,_) =
63.187 + rewrite_set_ thy false discard_parentheses t;
63.188 + term2str t;
63.189 +"(7 + x) * a ^^^ 2";
63.190 +
63.191 + val t = (term_of o the o (parse Termorder.thy)) "Pi";
63.192 +
63.193 + val t = (term_of o the o (parseold thy)) "7";
63.194 +
63.195 +----------------------------------------------------------------------*)
64.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
64.2 +++ b/test/Tools/isac/Knowledge/trig.sml Mon Aug 30 14:35:51 2010 +0200
64.3 @@ -0,0 +1,2 @@
64.4 +(* testexamples for Trig, trigonometry
64.5 + *)
64.6 \ No newline at end of file
65.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
65.2 +++ b/test/Tools/isac/Knowledge/vect.sml Mon Aug 30 14:35:51 2010 +0200
65.3 @@ -0,0 +1,2 @@
65.4 +(* testexamples for Vect, vector spaces
65.5 + *)
65.6 \ No newline at end of file
66.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
66.2 +++ b/test/Tools/isac/Knowledge/wn.sml Mon Aug 30 14:35:51 2010 +0200
66.3 @@ -0,0 +1,12 @@
66.4 +(* use"kbtest/wn.sml";
66.5 + use"wn.sml";
66.6 +
66.7 + various test dependent on IsacKnowledge/ outside Test.thy, Test.ML*)
66.8 +
66.9 +
66.10 + val t = str2term "solve (a*x + b = c, x)";
66.11 + atomty t;
66.12 +(*
66.13 +"\n*** -------------"
66.14 +"\n*** Const ( Equation.solve, bool * real => bool list)"
66.15 +... ~~~~~ ~~~~~~~~*)
66.16 \ No newline at end of file
67.1 --- a/test/Tools/isac/ME/calchead.sml Mon Aug 30 14:29:49 2010 +0200
67.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
67.3 @@ -1,413 +0,0 @@
67.4 -(* tests on calchead.sml
67.5 - author: Walther Neuper
67.6 - 051013,
67.7 - (c) due to copyright terms
67.8 -
67.9 -use"../smltest/ME/calchead.sml";
67.10 -use"calchead.sml";
67.11 -*)
67.12 -
67.13 -"-----------------------------------------------------------------";
67.14 -"table of contents -----------------------------------------------";
67.15 -"-----------------------------------------------------------------";
67.16 -"--------- get_interval after replace} other 2 -------------------";
67.17 -"--------- maximum example with 'specify' ------------------------";
67.18 -"--------- maximum example with 'specify', fmz <> [] -------------";
67.19 -"--------- maximum example with 'specify', fmz = [] --------------";
67.20 -"--------- match_ags, is_cp, cpy_nam +with EqSystem (!)-----------";
67.21 -"-----------------------------------------------------------------";
67.22 -"-----------------------------------------------------------------";
67.23 -"-----------------------------------------------------------------";
67.24 -
67.25 -
67.26 -"--------- get_interval after replace} other 2 -------------------";
67.27 -"--------- get_interval after replace} other 2 -------------------";
67.28 -"--------- get_interval after replace} other 2 -------------------";
67.29 - states:=[];
67.30 - CalcTree
67.31 - [(["equality (x+1=2)", "solveFor x","solutions L"],
67.32 - ("Test.thy",
67.33 - ["sqroot-test","univariate","equation","test"],
67.34 - ["Test","squ-equ-test-subpbl1"]))];
67.35 - Iterator 1;
67.36 - moveActiveRoot 1;
67.37 - autoCalculate 1 CompleteCalc;
67.38 - moveActiveFormula 1 ([2],Res); (*there is "-1 + x = 0"*)
67.39 - replaceFormula 1 "x = 1";
67.40 - (*... returns calcChangedEvent with ...*)
67.41 - val (unc, del, gen) = (([1],Res), ([4],Res), ([3,2],Res));
67.42 - val ((pt,_),_) = get_calc 1;
67.43 -
67.44 -print_depth 99;map fst (get_interval ([],Pbl) ([],Res) 9999 pt);print_depth 3;
67.45 -if map fst (get_interval ([],Pbl) ([],Res) 9999 pt) =
67.46 - [([], Pbl), ([1], Frm),([1], Res), ([2], Res), ([3], Pbl), ([3, 1], Frm),
67.47 - ([3, 1], Res), ([3, 2, 1], Frm), ([3, 2, 1], Res), ([3, 2, 2], Res),
67.48 - ([3, 2], Res)] then () else
67.49 -raise error "calchead.sml: diff.behav. get_interval after replace} other 2 a";
67.50 -
67.51 -print_depth 99;map fst (get_interval ([3, 2, 1], Res) ([],Res) 9999 pt);
67.52 -print_depth 3;
67.53 -if map fst (get_interval ([3, 2, 1], Res) ([],Res) 9999 pt) =
67.54 - [([3, 2, 1], Res), ([3, 2, 2], Res), ([3, 2], Res)] then () else
67.55 -raise error "modspec.sml: diff.behav. get_interval after replace} other 2 b";
67.56 -
67.57 -
67.58 -
67.59 -
67.60 -"--------- maximum example with 'specify' ------------------------";
67.61 -"--------- maximum example with 'specify' ------------------------";
67.62 -"--------- maximum example with 'specify' ------------------------";
67.63 -(*" Specify_Problem (match_itms_oris) ";*)
67.64 -val fmz =
67.65 - ["fixedValues [r=Arbfix]","maximum A",
67.66 - "valuesFor [a,b]",
67.67 - "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
67.68 - "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
67.69 - "relations [A=a*b, a/2=r*sin alpha, b/2=r*cos alpha]",
67.70 -
67.71 - "boundVariable a","boundVariable b","boundVariable alpha",
67.72 - "interval {x::real. 0 <= x & x <= 2*r}",
67.73 - "interval {x::real. 0 <= x & x <= 2*r}",
67.74 - "interval {x::real. 0 <= x & x <= pi}",
67.75 - "errorBound (eps=(0::real))"];
67.76 -val (dI',pI',mI') =
67.77 - ("DiffApp.thy",["maximum_of","function"],
67.78 - ["DiffApp","max_by_calculus"]);
67.79 -val c = []:cid;
67.80 -
67.81 -(*val nxt = Init_Proof' (fmz,(dI',pI',mI'));
67.82 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt e_pos' [] EmptyPtree;
67.83 -*)
67.84 -val (p,_,f,(_,nxt),_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
67.85 -val nxt = tac2tac_ pt p nxt;
67.86 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.87 -(*val nxt = Add_Given "fixedValues [(r::real) = Arbfix]" : tac*)
67.88 -
67.89 -val nxt = tac2tac_ pt p nxt;
67.90 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.91 -(**)
67.92 -
67.93 -(*---6.5.03
67.94 -val nxt = tac2tac_ pt p (Add_Find "valuesFor [(a::real)]");
67.95 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.96 -(*uncaught exception TYPE 6.5.03*)
67.97 -
67.98 -if ppc<>(Problem [],
67.99 - {Find=[Incompl "maximum",Incompl "valuesFor [a]"],
67.100 - Given=[Correct "fixedValues [r = Arbfix]"],
67.101 - Relate=[Incompl "relations []"], Where=[],With=[]})
67.102 -then raise error "test-maximum.sml: model stepwise - different behaviour"
67.103 -else (); (*different with show_types !!!*)
67.104 -6.5.03---*)
67.105 -
67.106 -(*-----appl_add should not create Error', but accept as Sup,Syn
67.107 -val nxt = tac2tac_ pt p (Add_Given "boundVariable a");
67.108 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.109 -(**)
67.110 -val nxt = tac2tac_ pt p (Add_Given "boundVariable a+");
67.111 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.112 -(**)---*)
67.113 -
67.114 -val m = Specify_Problem ["maximum_of","function"];
67.115 -val nxt = tac2tac_ pt p m;
67.116 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.117 -(**)
67.118 -
67.119 -if ppc<>(Problem ["maximum_of","function"],
67.120 - {Find=[Incompl "maximum",Incompl "valuesFor"],
67.121 - Given=[Correct "fixedValues [r = Arbfix]"],
67.122 - Relate=[Incompl "relations []"], Where=[],With=[]})
67.123 -then raise error "diffappl.sml: Specify_Problem different behaviour"
67.124 -else ();
67.125 -(* WN.3.9.03 (#391) Model_Specify did init_pbl newly
67.126 -if ppc<>(Problem ["maximum_of","function"],
67.127 - {Find=[Missing "maximum m_",Missing "valuesFor vs_"],
67.128 - Given=[Correct "fixedValues [r = Arbfix]"],
67.129 - Relate=[Missing "relations rs_"],Where=[],With=[]})
67.130 -then raise error "diffappl.sml: Specify_Problem different behaviour"
67.131 -else ();*)
67.132 -
67.133 -val nxt = tac2tac_ pt p(Specify_Method ["DiffApp","max_by_calculus"]);
67.134 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.135 -(**)
67.136 -
67.137 -if ppc<>(Method ["DiffApp","max_by_calculus"],
67.138 - {Find=[Incompl "maximum",Incompl "valuesFor"],
67.139 - Given=[Correct "fixedValues [r = Arbfix]",Missing "boundVariable v_",
67.140 - Missing "interval itv_",Missing "errorBound err_"],
67.141 - Relate=[Incompl "relations []"],Where=[],With=[]})
67.142 -then raise error "diffappl.sml: Specify_Method different behaviour"
67.143 -else ();
67.144 -(* WN.3.9.03 (#391) Model_Specify did init_pbl newly
67.145 -if ppc<>(Method ["DiffApp","max_by_calculus"],
67.146 - {Find=[Missing "maximum m_",Missing "valuesFor vs_"],
67.147 - Given=[Correct "fixedValues [r = Arbfix]",Missing "boundVariable v_",
67.148 - Missing "interval itv_",Missing "errorBound err_"],
67.149 - Relate=[Missing "relations rs_"],Where=[],With=[]})
67.150 -then raise error "diffappl.sml: Specify_Method different behaviour"
67.151 -else ();*)
67.152 -
67.153 -
67.154 -
67.155 -"--------- maximum example with 'specify', fmz <> [] -------------";
67.156 -"--------- maximum example with 'specify', fmz <> [] -------------";
67.157 -"--------- maximum example with 'specify', fmz <> [] -------------";
67.158 -val fmz =
67.159 - ["fixedValues [r=Arbfix]","maximum A",
67.160 - "valuesFor [a,b]",
67.161 - "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
67.162 - "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
67.163 - "relations [A=a*b, a/2=r*sin alpha, b/2=r*cos alpha]",
67.164 -
67.165 - "boundVariable a","boundVariable b","boundVariable alpha",
67.166 - "interval {x::real. 0 <= x & x <= 2*r}",
67.167 - "interval {x::real. 0 <= x & x <= 2*r}",
67.168 - "interval {x::real. 0 <= x & x <= pi}",
67.169 - "errorBound (eps=(0::real))"];
67.170 -val (dI',pI',mI') =
67.171 - ("DiffApp.thy",["maximum_of","function"],
67.172 - ["DiffApp","max_by_calculus"]);
67.173 -val c = []:cid;
67.174 -(*val nxt = Init_Proof' (fmz,(dI',pI',mI'));*)
67.175 -val (p,_,f,(_,nxt),_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
67.176 -
67.177 -val nxt = tac2tac_ pt p nxt;
67.178 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt e_pos' [] pt;
67.179 -val nxt = tac2tac_ pt p nxt;
67.180 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.181 -(*val nxt = Add_Given "fixedValues [(r::real) = Arbfix]" : tac*)
67.182 -
67.183 -val nxt = tac2tac_ pt p nxt;
67.184 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.185 -(*val nxt = Add_Find "maximum (A::bool)" : tac*)
67.186 -
67.187 -val nxt = tac2tac_ pt p nxt;
67.188 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.189 -(*val nxt = Add_Find "valuesFor [(a::real)]" : tac*)
67.190 -
67.191 -val nxt = tac2tac_ pt p nxt;
67.192 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.193 -(*val nxt = Add_Find "valuesFor [(b::real)]" : tac*)
67.194 -
67.195 -val nxt = tac2tac_ pt p nxt;
67.196 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.197 -(*val nxt = Add_Relation "relations [A = a * b]" *)
67.198 -
67.199 -val nxt = tac2tac_ pt p nxt;
67.200 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.201 -(*Add_Relation "relations\n [((a::real) // (#2::real)) ..."*)
67.202 -
67.203 -(*---------------------------- FIXXXXME.meNEW !!! partial Add-Relation !!!
67.204 - nxt_specif <> specify ?!
67.205 -
67.206 -if nxt<>(Add_Relation
67.207 - "relations [(a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]")
67.208 -then raise error "test specify, fmz <> []: nxt <> Add_Relation (a/2)^2.." else (); (*different with show_types !!!*)
67.209 -
67.210 -val nxt = tac2tac_ pt p nxt;
67.211 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.212 ------------------------------- FIXXXXME.meNEW !!! ---*)
67.213 -
67.214 -(*val nxt = Specify_Theory "DiffApp.thy" : tac*)
67.215 -
67.216 -val itms = get_obj g_pbl pt (fst p);writeln(itms2str_ ctxt itms);
67.217 -
67.218 -val nxt = tac2tac_ pt p nxt;
67.219 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.220 -(*val nxt = Specify_Problem ["maximum_of","function"]*)
67.221 -
67.222 -val nxt = tac2tac_ pt p nxt;
67.223 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.224 -(*val nxt = Specify_Method ("DiffApp.thy","max_by_calculus")*)
67.225 -
67.226 -val nxt = tac2tac_ pt p nxt;
67.227 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.228 -(*val nxt = Add_Given "boundVariable a" : tac*)
67.229 -
67.230 -val nxt = tac2tac_ pt p nxt;
67.231 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.232 -(*val nxt = Add_Given "interval {x. #0 <= x & x <= #2 * r}" : *)
67.233 -
67.234 -val nxt = tac2tac_ pt p nxt;
67.235 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.236 -(*val nxt = Add_Given "errorBound (eps = #0)" : tac*)
67.237 -
67.238 -val nxt = tac2tac_ pt p nxt;
67.239 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.240 -(*val nxt = Apply_Method ("DiffApp.thy","max_by_calculus") *)
67.241 -if nxt<>(Apply_Method ["DiffApp","max_by_calculus"])
67.242 -then raise error "test specify, fmz <> []: nxt <> Apply_Method max_by_calculus" else ();
67.243 -
67.244 -
67.245 -"--------- maximum example with 'specify', fmz = [] --------------";
67.246 -"--------- maximum example with 'specify', fmz = [] --------------";
67.247 -"--------- maximum example with 'specify', fmz = [] --------------";
67.248 -val fmz = [];
67.249 -val (dI',pI',mI') = empty_spec;
67.250 -val c = []:cid;
67.251 -
67.252 -val nxt = Init_Proof' (fmz,(dI',pI',mI'));(*!!!!!!!!*)
67.253 -(*val (p,_,f,(_,nxt),_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))]; !!!*)
67.254 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt e_pos' []
67.255 - EmptyPtree;
67.256 -val nxt = tac2tac_ pt p nxt;
67.257 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.258 -(*val nxt = Specify_Theory "e_domID" : tac*)
67.259 -
67.260 -val nxt = Specify_Theory "DiffApp.thy";
67.261 -val nxt = tac2tac_ pt p nxt;
67.262 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.263 -(*val nxt = Specify_Problem ["e_pblID"] : tac*)
67.264 -
67.265 -val nxt = Specify_Problem ["maximum_of","function"];
67.266 -val nxt = tac2tac_ pt p nxt;
67.267 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.268 -(*val nxt = Add_Given "fixedValues" : tac*)
67.269 -
67.270 -val nxt = Add_Given "fixedValues [r=Arbfix]";
67.271 -val nxt = tac2tac_ pt p nxt;
67.272 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.273 -(*val nxt = Add_Find "maximum" : tac*)
67.274 -
67.275 -val nxt = Add_Find "maximum A";
67.276 -val nxt = tac2tac_ pt p nxt;
67.277 -
67.278 -
67.279 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.280 -(*val nxt = Add_Find "valuesFor" : tac*)
67.281 -
67.282 -val nxt = Add_Find "valuesFor [a]";
67.283 -val nxt = tac2tac_ pt p nxt;
67.284 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.285 -(*val nxt = Add_Relation "relations" ---
67.286 - --- [b=Arbfix] KANN NICHT VERLANGT WERDEN !!!!*)
67.287 -
67.288 -(*30.8.01 ... funktioniert nicht mehr nach Einfuehrung env ....
67.289 -if nxt<>(Add_Relation "relations []")
67.290 -then raise error "test specify, fmz <> []: nxt <> Add_Relation.."
67.291 -else (); (*different with show_types !!!*)
67.292 -*)
67.293 -
67.294 -val nxt = Add_Relation "relations [(A=a+b)]";
67.295 -val nxt = tac2tac_ pt p nxt;
67.296 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.297 -(*val nxt = Specify_Method ("e_domID","e_metID") : tac*)
67.298 -
67.299 -val nxt = Specify_Method ["DiffApp","max_by_calculus"];
67.300 -val nxt = tac2tac_ pt p nxt;
67.301 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.302 -(*val nxt = Add_Given "boundVariable" : tac*)
67.303 -
67.304 -val nxt = Add_Given "boundVariable alpha";
67.305 -val nxt = tac2tac_ pt p nxt;
67.306 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.307 -(*val nxt = Add_Given "interval" : tac*)
67.308 -
67.309 -val nxt = Add_Given "interval {x. 2 <= x & x <= 3}";
67.310 -val nxt = tac2tac_ pt p nxt;
67.311 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.312 -(*val nxt = Add_Given "errorBound" : tac*)
67.313 -
67.314 -val nxt = Add_Given "errorBound (eps=999)";
67.315 -val nxt = tac2tac_ pt p nxt;
67.316 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt;
67.317 -(*val nxt = Apply_Method ("DiffApp","max_by_calculus") *)
67.318 -(*30.8.01 ... funktioniert nicht mehr nach Einfuehrung env ....
67.319 -if nxt<>(Apply_Method ("DiffApp.thy","max_by_calculus"))
67.320 -then raise error "test specify, fmz <> []: nxt <> Add_Relation.."
67.321 -else ();
67.322 -*)
67.323 -
67.324 -(* 2.4.00 nach Transfer specify -> hard_gen
67.325 -val nxt = Apply_Method ("DiffApp.thy","max_by_calculus");
67.326 -val(p,_,Form'(PpcKF(_,_,_,_,ppc)),nxt,_,pt) = specify nxt p [] pt; *)
67.327 -(*val nxt = Empty_Tac : tac*)
67.328 -
67.329 -
67.330 -"--------- match_ags, is_cp, cpy_nam +with EqSystem (!)-----------";
67.331 -"--------- match_ags, is_cp, cpy_nam +with EqSystem (!)-----------";
67.332 -"--------- match_ags, is_cp, cpy_nam +with EqSystem (!)-----------";
67.333 -val Const ("Script.SubProblem",_) $
67.334 - (Const ("Pair",_) $
67.335 - Free (dI',_) $
67.336 - (Const ("Pair",_) $ pI' $ mI')) $ ags' =
67.337 - (*...copied from stac2tac_*)
67.338 - str2term
67.339 - "SubProblem (EqSystem_, [linear, system], [no_met])\
67.340 - \ [bool_list_ [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2],\
67.341 - \ real_list_ [c, c_2]]";
67.342 -val ags = isalist2list ags';
67.343 -val pI = ["linear","system"];
67.344 -val pats = (#ppc o get_pbt) pI;
67.345 -case match_ags Isac.thy pats ags of
67.346 - [(1, [1], "#Given", Const ("Descript.equalities", _), _),
67.347 - (2, [1], "#Given", Const ("EqSystem.solveForVars", _),
67.348 - [ _ $ Free ("c", _) $ _, _ $ Free ("c_2", _) $ _]),
67.349 - (3, [1], "#Find", Const ("EqSystem.solution", _), [Free ("ss___", _)])]
67.350 - =>()
67.351 - | _ => raise error "calchead.sml match_ags 2 args OK -----------------";
67.352 -
67.353 -
67.354 -val Const ("Script.SubProblem",_) $
67.355 - (Const ("Pair",_) $
67.356 - Free (dI',_) $
67.357 - (Const ("Pair",_) $ pI' $ mI')) $ ags' =
67.358 - (*...copied from stac2tac_*)
67.359 - str2term
67.360 - "SubProblem (EqSystem_, [linear, system], [no_met])\
67.361 - \ [bool_list_ [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2],\
67.362 - \ real_list_ [c, c_2], bool_list_ ss___]";
67.363 -val ags = isalist2list ags';
67.364 -val pI = ["linear","system"];
67.365 -val pats = (#ppc o get_pbt) pI;
67.366 -case match_ags Isac.thy pats ags of
67.367 - [(1, [1], "#Given", Const ("Descript.equalities", _), _),
67.368 - (2, [1], "#Given", Const ("EqSystem.solveForVars", _),
67.369 - [_ $ Free ("c", _) $ _,
67.370 - _ $ Free ("c_2", _) $ _]),
67.371 - (3, [1], "#Find", Const ("EqSystem.solution", _), [Free ("ss___", _)])]
67.372 - (* type of Find: [Free ("ss___", "bool List.list")]*)
67.373 - =>()
67.374 - | _ => raise error "calchead.sml match_ags copy-named dropped --------";
67.375 -
67.376 -
67.377 -val stac as Const ("Script.SubProblem",_) $
67.378 - (Const ("Pair",_) $
67.379 - Free (dI',_) $
67.380 - (Const ("Pair",_) $ pI' $ mI')) $ ags' =
67.381 - (*...copied from stac2tac_*)
67.382 - str2term
67.383 - "SubProblem (EqSystem_, [linear, system], [no_met])\
67.384 - \ [real_list_ [c, c_2]]";
67.385 -val ags = isalist2list ags';
67.386 -val pI = ["linear","system"];
67.387 -val pats = (#ppc o get_pbt) pI;
67.388 -case ((match_ags Isac.thy pats ags)
67.389 - handle TYPE _ => []) of
67.390 - [] => match_ags_msg pI stac ags
67.391 - | _ => raise error "calchead.sml match_ags 1st arg missing --------";
67.392 -
67.393 -(*
67.394 -use"../smltest/ME/calchead.sml";
67.395 -*)
67.396 -
67.397 -val stac as Const ("Script.SubProblem",_) $
67.398 - (Const ("Pair",_) $
67.399 - Free (dI',_) $
67.400 - (Const ("Pair",_) $ pI' $ mI')) $ ags' =
67.401 - (*...copied from stac2tac_*)
67.402 - str2term
67.403 - "SubProblem (Test_,[univariate,equation,test],\
67.404 - \ [no_met]) [bool_ (x+1=2), real_ x]";
67.405 -val ags = isalist2list ags';
67.406 -val pI = ["univariate","equation","test"];
67.407 -val pats = (#ppc o get_pbt) pI;
67.408 -case match_ags Isac.thy pats ags of
67.409 - [(1, [1], "#Given",
67.410 - Const ("Descript.equality", _),
67.411 - [Const ("op =", _) $ (Const ("op +", _) $ Free ("x", _) $ _) $ _]),
67.412 - (2, [1], "#Given", Const ("Descript.solveFor", _), [Free ("x", _)]),
67.413 - (3, [1], "#Find", Const ("Descript.solutions", _), [Free ("x_i", _)])]
67.414 - (* type of Find: [Free ("x_i", "bool List.list")]*)
67.415 - => ()
67.416 - | _ => raise error "calchead.sml match_ags [univariate,equation,test]--";
68.1 --- a/test/Tools/isac/ME/ctree.sml Mon Aug 30 14:29:49 2010 +0200
68.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
68.3 @@ -1,1324 +0,0 @@
68.4 -(* tests for sml/ME/ctree.sml
68.5 - authors: Walther Neuper 060113
68.6 - (c) due to copyright terms
68.7 -
68.8 -use"../smltest/ME/ctree.sml";
68.9 -use"ctree.sml";
68.10 -*)
68.11 -
68.12 -"-----------------------------------------------------------------";
68.13 -"table of contents -----------------------------------------------";
68.14 -"-----------------------------------------------------------------";
68.15 -"-----------------------------------------------------------------";
68.16 -"-------------- build miniscript stepwise BEFORE ALL TESTS -------";
68.17 -"-------------- get_allpos' (from ptree above)--------------------";
68.18 -(**#####################################################################(**)
68.19 -"-------------- cut_level (from ptree above)----------------------";
68.20 -"-------------- cut_tree (from ptree above)-----------------------";
68.21 -"=====new ptree 1a miniscript with mini-subpbl ===================";
68.22 -"-------------- cut_level ( ,Frm) on Incomplete Nd ---------------";
68.23 -(**)#####################################################################**)
68.24 -"=====new ptree 2 miniscript with mini-subpbl ====================";
68.25 -"-------------- cut_tree (intermedi.ptree: 3rd level)-------------";
68.26 -"-------------- cappend (from ptree above)------------------------";
68.27 -"-------------- cappend minisubpbl -------------------------------";
68.28 -
68.29 -"=====new ptree 3 ================================================";
68.30 -"-------------- move_dn ------------------------------------------";
68.31 -"-------------- move_dn: Frm -> Res ------------------------------";
68.32 -"-------------- move_up ------------------------------------------";
68.33 -"------ move into detail -----------------------------------------";
68.34 -"=====new ptree 3a ===============================================";
68.35 -"-------------- move_dn in Incomplete ctree ----------------------";
68.36 -
68.37 -"=====new ptree 4: crooked by cut_level_'_ =======================";
68.38 -(*############## development stopped 0501 ########################*)
68.39 -(******************************************************************)
68.40 -(* val SAVE_get_trace = get_trace; *)
68.41 -(******************************************************************)
68.42 -"-------------- get_interval from ctree: incremental development--";
68.43 -(******************************************************************)
68.44 -(* val get_trace = SAVE_get_trace; *)
68.45 -(******************************************************************)
68.46 -(*############## development stopped 0501 ########################*)
68.47 -
68.48 -"=====new ptree 4 ratequation ====================================";
68.49 -"-------------- pt_extract form, tac, asm<>[] --------------------";
68.50 -"=====new ptree 5 minisubpbl =====================================";
68.51 -"-------------- pt_extract form, tac, asm ------------------------";
68.52 -
68.53 -(**#####################################################################(**)
68.54 -"=====new ptree 6 minisubpbl intersteps ==========================";
68.55 -"-------------- get_allpos' new ----------------------------------";
68.56 -"-------------- cut_tree new (from ptree above)-------------------";
68.57 -(**)#####################################################################**)
68.58 -
68.59 -"-----------------------------------------------------------------";
68.60 -"-----------------------------------------------------------------";
68.61 -"-----------------------------------------------------------------";
68.62 -
68.63 -
68.64 -"-------------- build miniscript stepwise BEFORE ALL TESTS -------";
68.65 -"-------------- build miniscript stepwise BEFORE ALL TESTS -------";
68.66 -"-------------- build miniscript stepwise BEFORE ALL TESTS -------";
68.67 -"this build should be detailed each time a test fails later \
68.68 -\i.e. all the tests should be caught here first \
68.69 -\and linked with a reference to the respective test environment";
68.70 -val fmz = ["equality (x+1=2)",
68.71 - "solveFor x","solutions L"];
68.72 -val (dI',pI',mI') =
68.73 - ("Test.thy",["sqroot-test","univariate","equation","test"],
68.74 - ["Test","squ-equ-test-subpbl1"]);
68.75 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
68.76 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
68.77 -(* nxt = Add_Given "equality (x + 1 = 2)"
68.78 - (writeln o (itms2str_ ctxt)) (get_obj g_pbl pt (fst p));
68.79 - *)
68.80 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
68.81 -(* (writeln o (itms2str_ ctxt)) (get_obj g_pbl pt (fst p));
68.82 - *)
68.83 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
68.84 -(* (writeln o (itms2str_ ctxt)) (get_obj g_pbl pt (fst p));
68.85 - *)
68.86 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
68.87 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
68.88 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
68.89 -"ctree.sml-------------- get_allpos' new ------------------------\"";
68.90 -val (PP, pp) = split_last [1];
68.91 -val ((pt', cuts), clevup) = cut_bottom (PP, pp) (get_nd pt PP);
68.92 -
68.93 -val cuts = get_allp [] ([], ([],Frm)) pt;
68.94 -val cuts2 = get_allps [] [1] (children pt);
68.95 -"ctree.sml-------------- cut_tree new (from ptree above)----------";
68.96 -val (pt', cuts) = cut_tree pt ([1],Frm);
68.97 -"ctree.sml-------------- cappend on complete ctree from above ----";
68.98 -val (pt', cuts) = cappend_form pt [1] e_istate (str2term "Inform[1]");
68.99 -"----------------------------------------------------------------/";
68.100 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt(*cappend_form: pos =[1]*);
68.101 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt(*cappend_atomic: pos =[1]*);
68.102 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt(*cappend_atomic: pos =[2]*);
68.103 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt(*cappend_problem: pos =[3]*);
68.104 -
68.105 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
68.106 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
68.107 -(*val nxt = ("Add_Given", Add_Given "equality (-1 + x = 0)").....*)
68.108 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
68.109 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
68.110 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
68.111 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
68.112 -(*val nxt = ("Apply_Method", Apply_Method ["Test", "solve_linear"])*)
68.113 -
68.114 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt(*cappend_form: pos =[3,1]*);
68.115 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt(*cappend_atomic: pos =[3,1]*);
68.116 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt(*cappend_atomic: pos =[3,2]*);
68.117 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt(*.append_result: pos =[3]*);
68.118 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt(*cappend_atomic: pos =[4]*);
68.119 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt(*.append_result: pos =[]*);
68.120 -val Form' (FormKF (~1,EdUndef,0,Nundef,res)) = f;
68.121 -if (snd nxt)=End_Proof' andalso res="[x = 1]" then ()
68.122 -else raise error "new behaviour in test: miniscript with mini-subpbl";
68.123 -
68.124 - show_pt pt;
68.125 -
68.126 -
68.127 -"-------------- get_allpos' (from ptree above)--------------------";
68.128 -"-------------- get_allpos' (from ptree above)--------------------";
68.129 -"-------------- get_allpos' (from ptree above)--------------------";
68.130 -if get_allpos' ([], 1) pt =
68.131 - [([], Frm),
68.132 - ([1], Frm),
68.133 - ([1], Res),
68.134 - ([2], Res),
68.135 - ([3], Frm),
68.136 - ([3, 1], Frm),
68.137 - ([3, 1], Res),
68.138 - ([3, 2], Res),
68.139 - ([3], Res),
68.140 - ([4], Res),
68.141 - ([], Res)]
68.142 -then () else raise error "ctree.sml: diff:behav. in get_allpos' 1";
68.143 -
68.144 -if get_allpos's ([], 1) (children pt) =
68.145 - [([1], Frm),
68.146 - ([1], Res),
68.147 - ([2], Res),
68.148 - ([3], Frm),
68.149 - ([3, 1], Frm),
68.150 - ([3, 1], Res),
68.151 - ([3, 2], Res),
68.152 - ([3], Res),
68.153 - ([4], Res)]
68.154 -then () else raise error "ctree.sml: diff:behav. in get_allpos' 2";
68.155 -
68.156 -if get_allpos's ([], 2) (takerest (1, children pt)) =
68.157 - [([2], Res),
68.158 - ([3], Frm),
68.159 - ([3, 1], Frm),
68.160 - ([3, 1], Res),
68.161 - ([3, 2], Res),
68.162 - ([3], Res),
68.163 - ([4], Res)]
68.164 -then () else raise error "ctree.sml: diff:behav. in get_allpos' 3";
68.165 -
68.166 -if get_allpos's ([], 3) (takerest (2, children pt)) =
68.167 - [([3], Frm),
68.168 - ([3, 1], Frm),
68.169 - ([3, 1], Res),
68.170 - ([3, 2], Res),
68.171 - ([3], Res),
68.172 - ([4], Res)]
68.173 -then () else raise error "ctree.sml: diff:behav. in get_allpos' 4";
68.174 -
68.175 -if get_allpos's ([3], 1) (children (nth 3 (children pt))) =
68.176 - [([3, 1], Frm),
68.177 - ([3, 1], Res),
68.178 - ([3, 2], Res)]
68.179 -then () else raise error "ctree.sml: diff:behav. in get_allpos' 5";
68.180 -
68.181 -if get_allpos' ([3], 1) (nth 3 (children pt)) =
68.182 - [([3], Frm),
68.183 - ([3, 1], Frm),
68.184 - ([3, 1], Res),
68.185 - ([3, 2], Res),
68.186 - ([3], Res)]
68.187 -then () else raise error "ctree.sml: diff:behav. in get_allpos' 6";
68.188 -
68.189 -
68.190 -(**##############################################################(**)
68.191 -
68.192 -"-------------- cut_level (from ptree above)----------------------";
68.193 -"-------------- cut_level (from ptree above)----------------------";
68.194 -"-------------- cut_level (from ptree above)----------------------";
68.195 -show_pt pt;
68.196 -show_pt pt';
68.197 -print_depth 99; cuts; print_depth 3;
68.198 -
68.199 -(*if cuts = [([2], Res),
68.200 - ([3], Frm),
68.201 - ([3, 1], Frm),
68.202 - ([3, 1], Res),
68.203 - ([3, 2], Res),
68.204 - ([3], Res),
68.205 - ([4], Res)]
68.206 -then () else raise error "ctree.sml: diff:behav. in cut_level 1a";
68.207 -val (res,asm) = get_obj g_result pt' [2];
68.208 -if res = e_term andalso asm = [] then () else
68.209 -raise error "ctree.sml: diff:behav. in cut_level 1aa" WN050219*);
68.210 -if not (existpt [2] pt') then () else
68.211 -raise error "ctree.sml: diff:behav. in cut_level 1aa2" (*WN050220*);
68.212 -
68.213 -val (res,asm) = get_obj g_result pt' [];
68.214 -if term2str res = "[x = 1]" (*WN050219 e_term in cut_tree!!!*) then () else
68.215 -raise error "ctree.sml: diff:behav. in cut_level 1ab";
68.216 -if map fst (get_interval ([],Frm) ([],Res) 9999 pt') =
68.217 - [([], Frm),
68.218 - ([1], Frm),
68.219 - ([1], Res),
68.220 - ([2], Res),(*, e_term in cut_tree!!!*)
68.221 - ([], Res)] then () else
68.222 -raise error "ctree.sml: diff:behav. in cut_level 1b";
68.223 -
68.224 -
68.225 -val (pt',cuts) = cut_level [] [] pt ([2],Res);
68.226 -if cuts = [([3], Frm),
68.227 - ([3, 1], Frm),
68.228 - ([3, 1], Res),
68.229 - ([3, 2], Res),
68.230 - ([3], Res),
68.231 - ([4], Res)]
68.232 -then () else raise error "ctree.sml: diff:behav. in cut_level 2a";
68.233 -
68.234 -if pr_ptree pr_short pt' = ". ----- pblobj -----\n1. x + 1 = 2\n2. x + 1 + -1 * 2 = 0\n"
68.235 -then () else raise error "ctree.sml: diff:behav. in cut_level 2b";
68.236 -
68.237 -val (pt',cuts) = cut_level [] [3] pt ([3,1],Frm);
68.238 -if cuts = [([3, 1], Res), ([3, 2], Res)]
68.239 -then () else raise error "ctree.sml: diff:behav. in cut_level 3a";
68.240 -if pr_ptree pr_short pt' = ". ----- pblobj -----\n1. x + 1 = 2\n2. x + 1 + -1 * 2 = 0\n3. ----- pblobj -----\n3.1. -1 + x = 0\n4. [x = 1]\n"
68.241 -then () else raise error "ctree.sml: diff:behav. in cut_level 3b";
68.242 -
68.243 -val (pt',cuts) = cut_level [] [3] pt ([3,1],Res);
68.244 -if cuts = [([3, 2], Res)]
68.245 -then () else raise error "ctree.sml: diff:behav. in cut_level 4a";
68.246 -if pr_ptree pr_short pt' = ". ----- pblobj -----\n1. x + 1 = 2\n2. x + 1 + -1 * 2 = 0\n3. ----- pblobj -----\n3.1. -1 + x = 0\n4. [x = 1]\n"
68.247 -then () else raise error "ctree.sml: diff:behav. in cut_level 4b";
68.248 -
68.249 -
68.250 -"-------------- cut_tree (from ptree above)-----------------------";
68.251 -"-------------- cut_tree (from ptree above)-----------------------";
68.252 -"-------------- cut_tree (from ptree above)-----------------------";
68.253 -val (pt', cuts) = cut_tree pt ([2],Frm);(*not created by move_dn -- not on WS*)
68.254 -if cuts = [([2], Res),
68.255 - ([3], Frm),
68.256 - ([3, 1], Frm),
68.257 - ([3, 1], Res),
68.258 - ([3, 2], Res),
68.259 - ([3], Res),
68.260 - ([4], Res),
68.261 - ([], Res)]
68.262 -then () else raise error "ctree.sml: diff:behav. in cut_tree 1a";
68.263 -
68.264 -val (res,asm) = get_obj g_result pt' [2];
68.265 -if res = e_term (*WN050219 done by cut_level*) then () else
68.266 -raise error "ctree.sml: diff:behav. in cut_tree 1aa";
68.267 -
68.268 -val form = get_obj g_form pt' [2];
68.269 -if term2str form = "x + 1 + -1 * 2 = 0" (*remained !!!*) then () else
68.270 -raise error "ctree.sml: diff:behav. in cut_tree 1ab";
68.271 -
68.272 -val (res,asm) = get_obj g_result pt' [];
68.273 -if res = e_term (*WN050219 done by cut_tree*) then () else
68.274 -raise error "ctree.sml: diff:behav. in cut_tree 1ac";
68.275 -
68.276 -if map fst (get_interval ([],Frm) ([],Res) 9999 pt') =
68.277 - [([], Frm),
68.278 - ([1], Frm),
68.279 - ([1], Res)] then () else
68.280 -raise error "ctree.sml: diff:behav. in cut_tree 1ad";
68.281 -
68.282 -val (pt', cuts) = cut_tree pt ([2],Res);
68.283 -if cuts = [([3], Frm),
68.284 - ([3, 1], Frm),
68.285 - ([3, 1], Res),
68.286 - ([3, 2], Res),
68.287 - ([3], Res),
68.288 - ([4], Res),
68.289 - ([], Res)]
68.290 -then () else raise error "ctree.sml: diff:behav. in cut_tree 2";
68.291 -
68.292 -val (pt', cuts) = cut_tree pt ([3,1],Frm);
68.293 -if cuts = [([3, 1], Res),
68.294 - ([3, 2], Res),
68.295 - ([3], Res),
68.296 - ([4], Res),
68.297 - ([], Res)]
68.298 -then () else raise error "ctree.sml: diff:behav. in cut_tree 3";
68.299 -
68.300 -val (pt', cuts) = cut_tree pt ([3,1],Res);
68.301 -if cuts = [([3, 2], Res),
68.302 - ([3], Res),
68.303 - ([4], Res),
68.304 - ([], Res)]
68.305 -then () else raise error "ctree.sml: diff:behav. in cut_tree 4";
68.306 -
68.307 -
68.308 -"=====new ptree 1a miniscript with mini-subpbl ===================";
68.309 -"=====new ptree 1a miniscript with mini-subpbl ===================";
68.310 -"=====new ptree 1a miniscript with mini-subpbl ===================";
68.311 -val fmz = ["equality (x+1=2)",
68.312 - "solveFor x","solutions L"];
68.313 -val (dI',pI',mI') =
68.314 - ("Test.thy",["sqroot-test","univariate","equation","test"],
68.315 - ["Test","squ-equ-test-subpbl1"]);
68.316 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
68.317 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
68.318 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
68.319 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
68.320 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
68.321 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
68.322 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
68.323 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
68.324 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
68.325 -show_pt pt;
68.326 -
68.327 -"-------------- cut_level ( ,Frm) on Incomplete Nd ---------------";
68.328 -"-------------- cut_level ( ,Frm) on Incomplete Nd ---------------";
68.329 -"-------------- cut_level ( ,Frm) on Incomplete Nd ---------------";
68.330 -
68.331 -val (pt',cuts) = cut_level [] [3] pt ([1],Frm);(*([1],Frm) is stored*)
68.332 -if cuts = [](*([1],Res) is not yet stored (Nd.ostate=Incomplete)*)
68.333 -then () else raise error "ctree.sml: diff:behav. in cut_tree 4a";
68.334 -
68.335 -val (pt', cuts) = cut_tree pt ([1],Frm);
68.336 -if cuts = []
68.337 -then () else raise error "ctree.sml: diff:behav. in cut_tree 4a";
68.338 -
68.339 -(*WN050219
68.340 -val pos as ([p],_) = ([1],Frm);
68.341 -val pt as Nd (b,_) = pt;
68.342 -
68.343 -
68.344 -show_pt pt;
68.345 -show_pt pt';
68.346 -print_depth 99;cuts;print_depth 3;
68.347 -print_depth 99;map fst (get_interval ([],Frm) ([],Res) 9999 pt');print_depth 3;
68.348 -####################################################################*)*)
68.349 -
68.350 -"=====new ptree 2 miniscript with mini-subpbl ====================";
68.351 -"=====new ptree 2 miniscript with mini-subpbl ====================";
68.352 -"=====new ptree 2 miniscript with mini-subpbl ====================";
68.353 - states:=[];
68.354 - CalcTree
68.355 - [(["equality (x+1=2)", "solveFor x","solutions L"],
68.356 - ("Test.thy",
68.357 - ["sqroot-test","univariate","equation","test"],
68.358 - ["Test","squ-equ-test-subpbl1"]))];
68.359 - Iterator 1; moveActiveRoot 1;
68.360 - autoCalculate 1 CompleteCalc;
68.361 -
68.362 - interSteps 1 ([3,2],Res);
68.363 -
68.364 - val ((pt,_),_) = get_calc 1;
68.365 - show_pt pt;
68.366 -
68.367 -"-------------- cut_tree (intermedi.ptree: 3rd level)-------------";
68.368 -"-------------- cut_tree (intermedi.ptree: 3rd level)-------------";
68.369 -"-------------- cut_tree (intermedi.ptree: 3rd level)-------------";
68.370 -(*WN050225 intermed. outcommented
68.371 - val (pt', cuts) = cut_tree pt ([3,2,1],Frm);
68.372 - if cuts = [([3, 2, 1], Res),
68.373 - ([3, 2, 2], Res),
68.374 - ([3, 2], Res),
68.375 - ([3], Res),
68.376 - ([4], Res)]
68.377 - then () else raise error "ctree.sml: diff:behav. in cut_tree 3rd level 1";
68.378 -
68.379 - val (pt', cuts) = cut_tree pt ([3,2,1],Res);
68.380 - if cuts = [([3, 2, 2], Res),
68.381 - ([3, 2], Res),
68.382 - ([3], Res),
68.383 - ([4], Res)]
68.384 - then () else raise error "ctree.sml: diff:behav. in cut_tree 3rd level 2";
68.385 -
68.386 -
68.387 -"-------------- cappend (from ptree above)------------------------";
68.388 -"-------------- cappend (from ptree above)------------------------";
68.389 -"-------------- cappend (from ptree above)------------------------";
68.390 -val (pt',cuts) = cappend_form pt [3,2,1] e_istate (str2term "newnew");
68.391 -if cuts = [([3, 2, 1], Res),
68.392 - ([3, 2, 2], Res),
68.393 - ([3, 2], Res),
68.394 - ([3], Res),
68.395 - ([4], Res),
68.396 - ([], Res)]
68.397 -then () else raise error "ctree.sml: diff:behav. in cappend_form";
68.398 -if term2str (get_obj g_form pt' [3,2,1]) = "newnew" andalso
68.399 - get_obj g_tac pt' [3,2,1] = Empty_Tac andalso
68.400 - term2str (fst (get_obj g_result pt' [3,2,1])) = "??.empty"
68.401 - then () else raise error "ctree.sml: diff:behav. in cappend 1";
68.402 -
68.403 -val (pt',cuts) = cappend_atomic pt [3,2,1] e_istate (str2term "newform")
68.404 - (Tac "test") (str2term "newresult",[]) Complete;
68.405 -if cuts = [([3, 2, 1], Res), (*?????????????*)
68.406 - ([3, 2, 2], Res),
68.407 - ([3, 2], Res),
68.408 - ([3], Res),
68.409 - ([4], Res),
68.410 - ([], Res)]
68.411 -then () else raise error "ctree.sml: diff:behav. in cappend_atomic";
68.412 -
68.413 -
68.414 -
68.415 -"-------------- cappend minisubpbl -------------------------------";
68.416 -"-------------- cappend minisubpbl -------------------------------";
68.417 -"-------------- cappend minisubpbl -------------------------------";
68.418 -"=====new ptree 1 miniscript with mini-subpbl ====================";
68.419 -val fmz = ["equality (x+1=2)",
68.420 - "solveFor x","solutions L"];
68.421 -val (dI',pI',mI') =
68.422 - ("Test.thy",["sqroot-test","univariate","equation","test"],
68.423 - ["Test","squ-equ-test-subpbl1"]);
68.424 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
68.425 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
68.426 -(* nxt = Add_Given "equality (x + 1 = 2)"
68.427 - (writeln o (itms2str_ ctxt)) (get_obj g_pbl pt (fst p));
68.428 - *)
68.429 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
68.430 -(* (writeln o (itms2str_ ctxt)) (get_obj g_pbl pt (fst p));
68.431 - *)
68.432 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
68.433 -(* (writeln o (itms2str_ ctxt)) (get_obj g_pbl pt (fst p));
68.434 - *)
68.435 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
68.436 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
68.437 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
68.438 -(*###cappend_form: pos =[1] ... while calculating nxt, which pt is dropped
68.439 -val nxt = ("Apply_Method", Apply_Method ["Test", "squ-equ-test-subpbl1"])*)
68.440 -
68.441 -(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt(**)cappend_form: pos =[1]*);
68.442 -val p = ([1], Frm);
68.443 -val (pt,cuts) = cappend_form pt (fst p) e_istate (str2term "x + 1 = 2");
68.444 -val form = get_obj g_form pt (fst p);
68.445 -val (res,_) = get_obj g_result pt (fst p);
68.446 -if term2str form = "x + 1 = 2" andalso res = e_term then () else
68.447 -raise error "ctree.sml, diff.behav. cappend minisubpbl ([1],Frm)";
68.448 -if not (existpt ((lev_on o fst) p) pt) then () else
68.449 -raise error "ctree.sml, diff.behav. cappend minisubpbl ([1],Frm) nxt";
68.450 -
68.451 -(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt(**)cappend_atomic: pos =[1]*);
68.452 -val p = ([1], Res);
68.453 -val (pt,cuts) =
68.454 - cappend_atomic pt (fst p) e_istate (str2term "x + 1 = 2")
68.455 - Empty_Tac (str2term "x + 1 + -1 * 2 = 0",[]) Incomplete;
68.456 -val form = get_obj g_form pt (fst p);
68.457 -val (res,_) = get_obj g_result pt (fst p);
68.458 -if term2str form = "x + 1 = 2" andalso term2str res = "x + 1 + -1 * 2 = 0"
68.459 -then () else raise error "ctree.sml, diff.behav. cappend minisubpbl ([1],Res)";
68.460 -if not (existpt ((lev_on o fst) p) pt) then () else
68.461 -raise error "ctree.sml, diff.behav. cappend minisubpbl ([1],Res) nxt";
68.462 -
68.463 -(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt(**)cappend_atomic: pos =[2]*);
68.464 -val p = ([2], Res);
68.465 -val (pt,cuts) =
68.466 - cappend_atomic pt (fst p) e_istate (str2term "x + 1 + -1 * 2 = 0")
68.467 - Empty_Tac (str2term "-1 + x = 0",[]) Incomplete;
68.468 -val form = get_obj g_form pt (fst p);
68.469 -val (res,_) = get_obj g_result pt (fst p);
68.470 -if term2str form = "x + 1 + -1 * 2 = 0" andalso term2str res = "-1 + x = 0"
68.471 -then () else raise error "ctree.sml, diff.behav. cappend minisubpbl ([2],Res)";
68.472 -if not (existpt ((lev_on o fst) p) pt) then () else
68.473 -raise error "ctree.sml, diff.behav. cappend minisubpbl ([2],Res) nxt";
68.474 -
68.475 -
68.476 -(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt;(**)cappend_problem: pos =[3]*)
68.477 -val p = ([3], Pbl);
68.478 -val (pt,cuts) = cappend_problem pt (fst p) e_istate e_fmz ([],e_spec,e_term);
68.479 -if is_pblobj (get_obj I pt (fst p)) then () else
68.480 -raise error "ctree.sml, diff.behav. cappend minisubpbl ([3],Pbl)";
68.481 -if not (existpt ((lev_on o fst) p) pt) then () else
68.482 -raise error "ctree.sml, diff.behav. cappend minisubpbl ([3],Pbl) nxt";
68.483 -
68.484 -(* ...complete calchead skipped...*)
68.485 -
68.486 -(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt(**)cappend_form: pos =[3,1]*);
68.487 -val p = ([3, 1], Frm);
68.488 -val (pt,cuts) = cappend_form pt (fst p) e_istate (str2term "-1 + x = 0");
68.489 -val form = get_obj g_form pt (fst p);
68.490 -val (res,_) = get_obj g_result pt (fst p);
68.491 -if term2str form = "-1 + x = 0" andalso res = e_term then () else
68.492 -raise error "ctree.sml, diff.behav. cappend minisubpbl ([3,1],Frm)";
68.493 -if not (existpt ((lev_on o fst) p) pt) then () else
68.494 -raise error "ctree.sml, diff.behav. cappend minisubpbl ([3,1],Frm) nxt";
68.495 -
68.496 -(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt;(**)cappend_atomic: pos =[3,1]*)
68.497 -val p = ([3, 1], Res);
68.498 -val (pt,cuts) =
68.499 - cappend_atomic pt (fst p) e_istate (str2term "-1 + x = 0")
68.500 - Empty_Tac (str2term "x = 0 + -1 * -1",[]) Incomplete;
68.501 -val form = get_obj g_form pt (fst p);
68.502 -val (res,_) = get_obj g_result pt (fst p);
68.503 -if term2str form = "-1 + x = 0" andalso term2str res = "x = 0 + -1 * -1" then()
68.504 -else raise error "ctree.sml, diff.behav. cappend minisubpbl ([3,1],Res)";
68.505 -if not (existpt ((lev_on o fst) p) pt) then () else
68.506 -raise error "ctree.sml, diff.behav. cappend minisubpbl ([3,1],Res) nxt";
68.507 -
68.508 -(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt(**)cappend_form: pos =[3,1]*);
68.509 -(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt(**)cappend_atomic: pos =[3,1]*);
68.510 -(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt(**)cappend_atomic: pos =[3,2]*);
68.511 -(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt(**).append_result: pos =[3]*);
68.512 -(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt(**)cappend_atomic: pos =[4]*);
68.513 -(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt(**).append_result: pos =[]*);
68.514 -
68.515 -WN050225 intermed. outcommented---*)
68.516 -
68.517 -"=====new ptree 3 ================================================";
68.518 -"=====new ptree 3 ================================================";
68.519 -"=====new ptree 3 ================================================";
68.520 - states:=[];
68.521 - CalcTree
68.522 - [(["equality (x+1=2)", "solveFor x","solutions L"],
68.523 - ("Test.thy",
68.524 - ["sqroot-test","univariate","equation","test"],
68.525 - ["Test","squ-equ-test-subpbl1"]))];
68.526 - Iterator 1; moveActiveRoot 1;
68.527 - autoCalculate 1 CompleteCalc;
68.528 -
68.529 - val ((pt,_),_) = get_calc 1;
68.530 - show_pt pt;
68.531 -
68.532 -"-------------- move_dn ------------------------------------------";
68.533 -"-------------- move_dn ------------------------------------------";
68.534 -"-------------- move_dn ------------------------------------------";
68.535 - val p = move_dn [] pt ([],Pbl) (*-> ([1],Frm)*);
68.536 - val p = move_dn [] pt p (*-> ([1],Res)*);
68.537 - val p = move_dn [] pt p (*-> ([2],Res)*);
68.538 - val p = move_dn [] pt p (*-> ([3],Pbl)*);
68.539 - val p = move_dn [] pt p (*-> ([3,1],Frm)*);
68.540 - val p = move_dn [] pt p (*-> ([3,1],Res)*);
68.541 - val p = move_dn [] pt p (*-> ([3,2],Res)*);
68.542 - val p = move_dn [] pt p (*-> ([3],Res)*);
68.543 -(* term2str (get_obj g_res pt [3]);
68.544 - term2str (get_obj g_form pt [4]);
68.545 - *)
68.546 - val p = move_dn [] pt p (*-> ([4],Res)*);
68.547 - val p = move_dn [] pt p (*-> ([],Res)*);
68.548 -(*
68.549 - val p = (move_dn [] pt p) handle e => print_exn_G e;
68.550 - Exception PTREE end of calculation*)
68.551 -if p=([],Res) then () else raise error "ctree.sml: diff:behav. in move_dn";
68.552 -
68.553 -
68.554 -"-------------- move_dn: Frm -> Res ------------------------------";
68.555 -"-------------- move_dn: Frm -> Res ------------------------------";
68.556 -"-------------- move_dn: Frm -> Res ------------------------------";
68.557 - states := [];
68.558 - CalcTree (*start of calculation, return No.1*)
68.559 - [(["equality (1+-1*2+x=0)", "solveFor x","solutions L"],
68.560 - ("Test.thy",
68.561 - ["linear","univariate","equation","test"],
68.562 - ["Test","solve_linear"]))];
68.563 - Iterator 1; moveActiveRoot 1;
68.564 - autoCalculate 1 CompleteCalcHead;
68.565 - autoCalculate 1 (Step 1);
68.566 - refFormula 1 (get_pos 1 1);
68.567 -
68.568 - moveActiveRoot 1;
68.569 - moveActiveDown 1;
68.570 - if get_pos 1 1 = ([1], Frm) then ()
68.571 - else raise error "ctree.sml: diff.behav. in move_dn: Frm -> Res (1)";
68.572 - moveActiveDown 1; (*<ERROR> pos does not exist </ERROR>*)
68.573 -
68.574 - autoCalculate 1 (Step 1);
68.575 - refFormula 1 (get_pos 1 1);
68.576 -
68.577 - moveActiveDown 1; (*<ERROR> pos does not exist </ERROR>*)
68.578 - if get_pos 1 1 = ([1], Res) then ()
68.579 - else raise error "ctree.sml: diff.behav. in move_dn: Frm -> Res (1)";
68.580 - moveActiveDown 1; (*<ERROR> pos does not exist </ERROR>*)
68.581 -
68.582 -
68.583 -"-------------- move_up ------------------------------------------";
68.584 -"-------------- move_up ------------------------------------------";
68.585 -"-------------- move_up ------------------------------------------";
68.586 - val p = move_up [] pt ([],Res); (*-> ([4],Res)*)
68.587 - val p = move_up [] pt p; (*-> ([3],Res)*)
68.588 - val p = move_up [] pt p; (*-> ([3,2],Res)*)
68.589 - val p = move_up [] pt p; (*-> ([3,1],Res)*)
68.590 - val p = move_up [] pt p; (*-> ([3,1],Frm)*)
68.591 - val p = move_up [] pt p; (*-> ([3],Pbl)*)
68.592 - val p = move_up [] pt p; (*-> ([2],Res)*)
68.593 - val p = move_up [] pt p; (*-> ([1],Res)*)
68.594 - val p = move_up [] pt p; (*-> ([1],Frm)*)
68.595 - val p = move_up [] pt p; (*-> ([],Pbl)*)
68.596 -(*val p = (move_up [] pt p) handle e => print_exn_G e;
68.597 - Exception PTREE begin of calculation*)
68.598 -if p=([],Pbl) then () else raise error "ctree.sml: diff.behav. in move_up";
68.599 -
68.600 -
68.601 -"------ move into detail -----------------------------------------";
68.602 -"------ move into detail -----------------------------------------";
68.603 -"------ move into detail -----------------------------------------";
68.604 - states:=[];
68.605 - CalcTree
68.606 - [(["equality (x+1=2)", "solveFor x","solutions L"],
68.607 - ("Test.thy",
68.608 - ["sqroot-test","univariate","equation","test"],
68.609 - ["Test","squ-equ-test-subpbl1"]))];
68.610 - Iterator 1; moveActiveRoot 1;
68.611 - autoCalculate 1 CompleteCalc;
68.612 - moveActiveRoot 1;
68.613 - moveActiveDown 1;
68.614 - moveActiveDown 1;
68.615 - moveActiveDown 1;
68.616 - refFormula 1 (get_pos 1 1) (* 2 Res, <ISA> -1 + x = 0 </ISA> *);
68.617 -
68.618 - interSteps 1 ([2],Res);
68.619 -
68.620 - val ((pt,_),_) = get_calc 1; show_pt pt;
68.621 - val p = get_pos 1 1;
68.622 -
68.623 - val p = move_up [] pt p; (*([2, 6], Res)*);
68.624 - val p = movelevel_up [] pt p;(*([2], Frm)*);
68.625 - val p = move_dn [] pt p; (*([2, 1], Frm)*);
68.626 - val p = move_dn [] pt p; (*([2, 1], Res)*);
68.627 - val p = move_dn [] pt p; (*([2, 2], Res)*);
68.628 - val p = move_dn [] pt p; (*([2, 3], Res)*);
68.629 - val p = move_dn [] pt p; (*([2, 4], Res)*);
68.630 - val p = move_dn [] pt p; (*([2, 5], Res)*);
68.631 - val p = move_dn [] pt p; (*([2, 6], Res)*);
68.632 - if p = ([2, 6], Res) then()
68.633 - else raise error "ctree.sml: diff.behav. in move into detail";
68.634 -
68.635 -"=====new ptree 3a ===============================================";
68.636 -"=====new ptree 3a ===============================================";
68.637 -"=====new ptree 3a ===============================================";
68.638 - states:=[];
68.639 - CalcTree
68.640 - [(["equality (x+1=2)", "solveFor x","solutions L"],
68.641 - ("Test.thy",
68.642 - ["sqroot-test","univariate","equation","test"],
68.643 - ["Test","squ-equ-test-subpbl1"]))];
68.644 - Iterator 1; moveActiveRoot 1;
68.645 - autoCalculate 1 CompleteCalcHead;
68.646 - autoCalculate 1 (Step 1);
68.647 - autoCalculate 1 (Step 1);
68.648 - autoCalculate 1 (Step 1);
68.649 - val ((pt,_),_) = get_calc 1;
68.650 - val p = move_dn [] pt ([],Pbl) (*-> ([1], Frm)*);
68.651 - val p = move_dn [] pt ([1], Frm) (*-> ([1], Res)*);
68.652 - val p = move_dn [] pt ([1], Res) (*-> ([2], Res)*);
68.653 - (*val p = move_dn [] pt ([2], Res) ->Exception- PTREE "[] not complete"*);
68.654 -
68.655 - moveDown 1 ([],Pbl) (*-> ([1], Frm)*);
68.656 - moveDown 1 ([1],Frm) (*-> ([1],Res)*);
68.657 - moveDown 1 ([1],Res) (*-> ([2],Res)*);
68.658 - moveDown 1 ([2],Res) (*-> pos does not exist*);
68.659 -(*
68.660 - get_obj g_ostate pt [1];
68.661 - show_pt pt;
68.662 -*)
68.663 -
68.664 -"-------------- move_dn in Incomplete ctree ----------------------";
68.665 -"-------------- move_dn in Incomplete ctree ----------------------";
68.666 -"-------------- move_dn in Incomplete ctree ----------------------";
68.667 -
68.668 -
68.669 -
68.670 -"=====new ptree 4: crooked by cut_level_'_ =======================";
68.671 -"=====new ptree 4: crooked by cut_level_'_ =======================";
68.672 -"=====new ptree 4: crooked by cut_level_'_ =======================";
68.673 -states:=[];
68.674 -CalcTree
68.675 -[(["equality (x/(x^2 - 6*x+9) - 1/(x^2 - 3*x) =1/x)",
68.676 - "solveFor x","solutions L"],
68.677 - ("RatEq.thy",["univariate","equation"],["no_met"]))];
68.678 -Iterator 1; moveActiveRoot 1;
68.679 -autoCalculate 1 CompleteCalc;
68.680 -
68.681 -getTactic 1 ([1],Res);(*Rewrite_Set RatEq_simplify*)
68.682 -getTactic 1 ([2],Res);(*Rewrite_Set norm_Rational*)
68.683 -getTactic 1 ([3],Res);(*Rewrite_Set RatEq_eliminate*)
68.684 -getTactic 1 ([4,1],Res);(*Rewrite all_left*)
68.685 -getTactic 1 ([4,2],Res);(*Rewrite_Set expand_binoms*)
68.686 -getTactic 1 ([4,3],Res);(*Rewrite_Set_Inst make_ratpoly_in*)
68.687 -
68.688 -moveActiveFormula 1 ([1],Res)(*1.1...1.4*);
68.689 -moveActiveFormula 1 ([2],Res)(**ME_Isa: 'expand' not known*);
68.690 -moveActiveFormula 1 ([3],Res)(*3.1.*);
68.691 -moveActiveFormula 1 ([4,2],Res)(*4.2.1.*);
68.692 -moveActiveFormula 1 ([4,3],Res)(**one_scr_arg: called by Script Stepwise t_=*);
68.693 -
68.694 -moveActiveFormula 1 ([1],Res)(*1.1...1.4*);
68.695 -interSteps 1 ([1],Res)(*..is activeFormula !?!*);
68.696 -
68.697 -getTactic 1 ([1,1],Res);(*Rewrite real_diff_minus*)
68.698 -getTactic 1 ([1,2],Res);(*Rewrite real_diff_minus*)
68.699 -getTactic 1 ([1,3],Res);(*Rewrite real_diff_minus*)
68.700 -getTactic 1 ([1,4],Res);(*Rewrite real_rat_mult_1*)
68.701 -
68.702 -moveActiveFormula 1 ([4,2],Res)(*4.2.1.*);
68.703 -interSteps 1 ([4,2],Res)(*..is activeFormula !?!*);
68.704 -val ((pt,_),_) = get_calc 1;
68.705 -writeln(pr_ptree pr_short pt);
68.706 -(*delete [4,1] in order to make pos [4],[4,4] for pblobjs differen [4],[4,3]:
68.707 - ###########################################################################*)
68.708 -val (pt, ppp) = cut_level_'_ [] [] pt ([4,1],Frm);
68.709 -writeln(pr_ptree pr_short pt);
68.710 -
68.711 -
68.712 -"-------------- get_interval from ctree: incremental development--";
68.713 -"-------------- get_interval from ctree: incremental development--";
68.714 -"-------------- get_interval from ctree: incremental development--";
68.715 -"--- level 1: get pos from start b to end p ----------------------";
68.716 -"--- level 1: get pos from start b to end p ----------------------";
68.717 -"--- level 1: get pos from start b to end p ----------------------";
68.718 -(******************************************************************)
68.719 -(**) val SAVE_get_trace = get_trace; (**)
68.720 -(******************************************************************)
68.721 -(*'getnds' below is structured as such:*)
68.722 -fun www _ [x] = "l+r-margin"
68.723 - | www true [x1,x2] = "l-margin, r-margin"
68.724 - | www _ [x1,x2] = "intern, r-margin"
68.725 - | www true (x::(xs as _::_)) = "l-margin " ^ www false xs
68.726 - | www _ (x::(xs as _::_)) = "intern " ^ www false xs;
68.727 -www true [1,2,3,4,5];
68.728 -(*val it = "from intern intern intern to" : string*)
68.729 -www true [1,2];
68.730 -(*val it = "from to" : string*)
68.731 -www true [1];
68.732 -(*val it = "from+to" : string*)
68.733 -
68.734 -local
68.735 -(*specific values of hd of pos p,q for simple handling take_fromto,
68.736 - from-pos p, to-pos q: take_fromto (hdp p) (hdq q) (children pt) ...
68.737 - ... can be used even for positions _below_ p or q*)
68.738 -fun hdp [] = 1 | hdp [0] = 1 | hdp x = hd x;(*start with first*)
68.739 -fun hdq [] = 99999 | hdq [0] = 99999 | hdq x = hd x;(*take until last*)
68.740 -(*analoguous for tl*)
68.741 -fun tlp [] = [0] | tlp [_] = [0] | tlp x = tl x;
68.742 -fun tlq [] = [99999] | tlq [_] = [99999] | tlq x = tl x;
68.743 -
68.744 -(*see modspec.sml#pt_form
68.745 -fun pt_form (PrfObj {form,...}) = term2str form
68.746 - | pt_form (PblObj {probl,spec,origin=(_,spec',_),...}) =
68.747 - let val (dI, pI, _) = get_somespec' spec spec'
68.748 - val {cas,...} = get_pbt pI
68.749 - in case cas of
68.750 - NONE => term2str (pblterm dI pI)
68.751 - | SOME t => term2str (subst_atomic (mk_env probl) t)
68.752 - end;
68.753 -*)
68.754 -(*.get an 'interval' from ptree down to a certain level
68.755 - by 'take_fromto children' of the nodes with specific 'from' and 'to';
68.756 - 'i > 0' suppresses output during recursive descent towards 'from'
68.757 - b: the 'from' incremented to the actual pos
68.758 - p,q: specific 'from','to' for simple use of 'take_fromto'*)
68.759 -fun getnd i (b,p) q (Nd (po, nds)) =
68.760 - (if i <= 0 then [(*[(b, pt_form po)]*) (**)[b](**)] else [])
68.761 -
68.762 - @ (writeln("getnd : b="^(ints2str' b)^", p="^
68.763 - (ints2str' p)^", q="^(ints2str' q));
68.764 -
68.765 - getnds (i-1) true (b@[hdp p], tlp p) (tlq q)
68.766 - (take_fromto (hdp p) (hdq q) nds))
68.767 -
68.768 -and getnds _ _ _ _ [] = [] (*no children*)
68.769 - | getnds i _ (b,p) q [nd] = (getnd i (b,p) q nd) (*l+r-margin*)
68.770 - | getnds i true (b,p) q [n1, n2] = (*l-margin, r-margin*)
68.771 - (writeln("getnds3: b="^ ints2str' b ^", p="^ ints2str' p ^
68.772 - ", q="^ ints2str' q);
68.773 - (getnd i ( b, p ) [99999] n1) @
68.774 - (getnd ~99999 (lev_on b,[0]) q n2))
68.775 - | getnds i _ (b,p) q [n1, n2] = (*intern, r-margin*)
68.776 - (writeln("getnds4: b="^ ints2str' b ^", p="^ ints2str' p ^
68.777 - ", q="^ ints2str' q);
68.778 - (getnd i ( b,[0]) [99999] n1) @
68.779 - (getnd ~99999 (lev_on b,[0]) q n2))
68.780 - | getnds i true (b,p) q (nd::(nds as _::_)) = (*l-margin, intern*)
68.781 - (writeln("getnds5: b="^ ints2str' b ^", p="^ ints2str' p ^
68.782 - ", q="^ ints2str' q);
68.783 - (getnd i ( b, p ) [99999] nd) @
68.784 - (getnds ~99999 false (lev_on b,[0]) q nds))
68.785 - | getnds i _ (b,p) q (nd::(nds as _::_)) = (*intern, ...*)
68.786 - (getnd i ( b,[0]) [99999] nd) @
68.787 - (getnds ~99999 false (lev_on b,[0]) q nds);
68.788 -in
68.789 -(*get an 'interval from to' from a ptree as 'intervals f t' of respective nodes
68.790 - where 'from' are pos, i.e. a key as int list, 'f' an int (to,t analoguous)
68.791 -(1) the 'f' are given
68.792 -(1a) by 'from' if 'f' = the respective element of 'from' (left margin)
68.793 -(1b) -inifinity, if 'f' > the respective element of 'from' (internal node)
68.794 -(2) the 't' ar given
68.795 -(2a) by 'to' if 't' = the respective element of 'to' (right margin)
68.796 -(2b) inifinity, if 't' < the respective element of 'to (internal node)'
68.797 -the 'f' and 't' are set by hdp,... *)
68.798 -fun get_trace pt p q =
68.799 - (flat o (getnds ((length p) -1) true ([hdp p], tlp p) (tlq q)))
68.800 - (take_fromto (hdp p) (hdq q) (children pt));
68.801 -end;
68.802 -
68.803 -writeln(pr_ptree pr_short pt);
68.804 -case get_trace pt [1,3] [4,1,1] of
68.805 - [[1,3],[1,4],[2],[3],[4],[4,1],[4,1,1]] => ()
68.806 - | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1a";
68.807 -case get_trace pt [2] [4,3,2] of
68.808 - [[2],[3],[4],[4,1],[4,1,1],[4,2],[4,3],[4,3,1],[4,3,2]] => ()
68.809 - | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1b";
68.810 -case get_trace pt [1,4] [4,3,1] of
68.811 - [[1,4],[2],[3],[4],[4,1],[4,1,1],[4,2],[4,3],[4,3,1]] => ()
68.812 - | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1c";
68.813 -case get_trace pt [4,2] [5] of
68.814 - (*[([4,2],_),([4,3],_),([4,4],_),([4,4,1],_),([4,4,2],_),([4,4,3],_),
68.815 - ([4,4,4],_),([4,4,5],_),([5],_)] => () ..with pt_form*)
68.816 - [[4,2],[4,3],[4,3,1],[4,3,2],[4,3,3],[4,3,4],[4,3,5],[5]]=>()
68.817 - | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1d";
68.818 -case get_trace pt [] [4,4,2] of
68.819 - [[1],[1,1],[1,2],[1,3],[1,4],[2],[3],[4],[4,1],[4,1,1],[4,2],
68.820 - [4,3],[4,3,1],[4,3,2]] => ()
68.821 - | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1e";
68.822 -case get_trace pt [] [] of
68.823 - [[1],[1,1],[1,2],[1,3],[1,4],[2],[3],[4],[4,1],[4,1,1],[4,2],
68.824 - [4,3],[4,3,1],[4,3,2],[4,3,3],[4,3,4],[4,3,5],[5]] => ()
68.825 - | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1f";
68.826 -case get_trace pt [4,3] [4,3] of
68.827 - [[4,3],[4,3,1],[4,3,2],[4,3,3],[4,3,4],[4,3,5]] => ()
68.828 - | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1g";
68.829 -
68.830 -"--- level 2: get pos' from start b to end p ---------------------";
68.831 -"--- level 2: get pos' from start b to end p ---------------------";
68.832 -"--- level 2: get pos' from start b to end p ---------------------";
68.833 -(*idea: pos_ is _ONLY_ relevant exactly at (endpoint of) from, to
68.834 - development stopped in favour of move_dn, see get_interval
68.835 - actually used (inefficient) version with move_dn: see modspec.sml
68.836 -*)
68.837 -(*
68.838 -case get_trace pt ([1,4],Res) ([4,4,1],Frm) of
68.839 - [[2],[3],[4],[4,1],[4,2],[4,2,1],[4,3],[4,4],[4,4,1]] => ()
68.840 - | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1b";
68.841 -case get_trace pt ([],Pbl) ([],Res) of
68.842 - [[1],[1,1],[1,2],[1,3],[1,4],[2],[3],[4],[4,1],[4,2],[4,2,1],[4,3],
68.843 - [4,4],[4,4,1],[4,4,2],[4,4,3],[4,4,4],[4,4,5],[5]] => ()
68.844 - | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1e";
68.845 -*)
68.846 -
68.847 -(******************************************************************)
68.848 -(**) val get_trace = SAVE_get_trace; (**)
68.849 -(******************************************************************)
68.850 -
68.851 -
68.852 -"=====new ptree 4 ratequation ====================================";
68.853 -"=====new ptree 4 ratequation ====================================";
68.854 -"=====new ptree 4 ratequation ====================================";
68.855 -states:=[];
68.856 -CalcTree
68.857 -[(["equality (x/(x^2 - 6*x+9) - 1/(x^2 - 3*x) =1/x)",
68.858 - "solveFor x","solutions L"],
68.859 - ("RatEq.thy",["univariate","equation"],["no_met"]))];
68.860 -Iterator 1; moveActiveRoot 1;
68.861 -autoCalculate 1 CompleteCalc;
68.862 -val ((pt,_),_) = get_calc 1;
68.863 -show_pt pt;
68.864 -
68.865 -
68.866 -"-------------- pt_extract form, tac, asm<>[] --------------------";
68.867 -"-------------- pt_extract form, tac, asm<>[] --------------------";
68.868 -"-------------- pt_extract form, tac, asm<>[] --------------------";
68.869 -val (Form form, SOME tac, asm) = pt_extract (pt, ([3], Res));
68.870 -case (term2str form, tac, terms2strs asm) of
68.871 - ("(3 + -1 * x + x ^^^ 2) * x = 1 * (9 * x + -6 * x ^^^ 2 + x ^^^ 3)",
68.872 - Subproblem
68.873 - ("PolyEq.thy",
68.874 - ["normalize", "polynomial", "univariate", "equation"]),
68.875 - ["9 * x + -6 * x ^^^ 2 + x ^^^ 3 ~= 0"]) => ()
68.876 - | _ => raise error "diff.behav.in ctree.sml: pt_extract asm<>[]";
68.877 -(*WN060717 unintentionally changed some rls/ord while
68.878 - completing knowl. for thes2file...
68.879 -
68.880 - case (term2str form, tac, terms2strs asm) of
68.881 - ((*"(3 + (-1 * x + x ^^^ 2)) * x = 1 * (9 * x + (x ^^^ 3 + -6 * x ^^^ 2))",
68.882 - *)Subproblem
68.883 - ("PolyEq.thy",
68.884 - ["normalize", "polynomial", "univariate", "equation"]),
68.885 - ["9 * x + (x ^^^ 3 + -6 * x ^^^ 2) ~= 0"]) => ()
68.886 - | _ => raise error "diff.behav.in ctree.sml: pt_extract asm<>[]";
68.887 -
68.888 -.... but it became even better*)
68.889 -
68.890 -
68.891 -
68.892 -"=====new ptree 5 minisubpbl =====================================";
68.893 -"=====new ptree 5 minisubpbl =====================================";
68.894 -"=====new ptree 5 minisubpbl =====================================";
68.895 -states:=[];
68.896 -CalcTree
68.897 - [(["equality (x+1=2)", "solveFor x","solutions L"],
68.898 - ("Test.thy",
68.899 - ["sqroot-test","univariate","equation","test"],
68.900 - ["Test","squ-equ-test-subpbl1"]))];
68.901 -Iterator 1; moveActiveRoot 1;
68.902 -autoCalculate 1 CompleteCalc;
68.903 -val ((pt,_),_) = get_calc 1;
68.904 -show_pt pt;
68.905 -
68.906 -"-------------- pt_extract form, tac, asm ------------------------";
68.907 -"-------------- pt_extract form, tac, asm ------------------------";
68.908 -"-------------- pt_extract form, tac, asm ------------------------";
68.909 -val (ModSpec (_,_,form,_,_,_), SOME tac, asm) = pt_extract (pt, ([], Frm));
68.910 -case (term2str form, tac, terms2strs asm) of
68.911 - ("solve (x + 1 = 2, x)",
68.912 - Apply_Method ["Test", "squ-equ-test-subpbl1"],
68.913 - []) => ()
68.914 - | _ => raise error "diff.behav.in ctree.sml: pt_extract ([], Pbl)";
68.915 -
68.916 -val (Form form, SOME tac, asm) = pt_extract (pt, ([1], Frm));
68.917 -case (term2str form, tac, terms2strs asm) of
68.918 - ("x + 1 = 2", Rewrite_Set "norm_equation", []) => ()
68.919 - | _ => raise error "diff.behav.in ctree.sml: pt_extract ([1], Frm)";
68.920 -
68.921 -val (Form form, SOME tac, asm) = pt_extract (pt, ([1], Res));
68.922 -case (term2str form, tac, terms2strs asm) of
68.923 - ("x + 1 + -1 * 2 = 0", Rewrite_Set "Test_simplify", []) => ()
68.924 - | _ => raise error "diff.behav.in ctree.sml: pt_extract ([1], Res)";
68.925 -
68.926 -val (Form form, SOME tac, asm) = pt_extract (pt, ([2], Res));
68.927 -case (term2str form, tac, terms2strs asm) of
68.928 - ("-1 + x = 0",
68.929 - Subproblem ("Test.thy", ["linear", "univariate", "equation", "test"]),
68.930 - []) => ()
68.931 - | _ => raise error "diff.behav.in ctree.sml: pt_extract ([2], Res)";
68.932 -
68.933 -val (ModSpec (_,_,form,_,_,_), SOME tac, asm) = pt_extract (pt, ([3], Pbl));
68.934 -case (term2str form, tac, terms2strs asm) of
68.935 - ("solve (-1 + x = 0, x)", Apply_Method ["Test", "solve_linear"], []) => ()
68.936 - | _ => raise error "diff.behav.in ctree.sml: pt_extract ([3], Pbl)";
68.937 -
68.938 -val (Form form, SOME tac, asm) = pt_extract (pt, ([3,1], Frm));
68.939 -case (term2str form, tac, terms2strs asm) of
68.940 - ("-1 + x = 0", Rewrite_Set_Inst (["(bdv, x)"], "isolate_bdv"), []) => ()
68.941 - | _ => raise error "diff.behav.in ctree.sml: pt_extract ([3,1], Frm)";
68.942 -
68.943 -val (Form form, SOME tac, asm) = pt_extract (pt, ([3,1], Res));
68.944 -case (term2str form, tac, terms2strs asm) of
68.945 - ("x = 0 + -1 * -1", Rewrite_Set "Test_simplify", []) => ()
68.946 - | _ => raise error "diff.behav.in ctree.sml: pt_extract ([3,1], Res)";
68.947 -
68.948 -val (Form form, SOME tac, asm) = pt_extract (pt, ([3,2], Res));
68.949 -case (term2str form, tac, terms2strs asm) of
68.950 - ("x = 1", Check_Postcond ["linear", "univariate", "equation", "test"],
68.951 - []) => ()
68.952 - | _ => raise error "diff.behav.in ctree.sml: pt_extract ([3,2], Res)";
68.953 -
68.954 -val (Form form, SOME tac, asm) = pt_extract (pt, ([3], Res));
68.955 -case (term2str form, tac, terms2strs asm) of
68.956 - ("[x = 1]", Check_elementwise "Assumptions", []) => ()
68.957 - | _ => raise error "diff.behav.in ctree.sml: pt_extract ([3], Res)";
68.958 -
68.959 -val (Form form, SOME tac, asm) = pt_extract (pt, ([4], Res));
68.960 -case (term2str form, tac, terms2strs asm) of
68.961 - ("[x = 1]",
68.962 - Check_Postcond ["sqroot-test", "univariate", "equation", "test"],
68.963 - []) => ()
68.964 - | _ => raise error "diff.behav.in ctree.sml: pt_extract ([4], Res)";
68.965 -
68.966 -val (Form form, tac, asm) = pt_extract (pt, ([], Res));
68.967 -case (term2str form, tac, terms2strs asm) of
68.968 - ("[x = 1]", NONE, []) => ()
68.969 - | _ => raise error "diff.behav.in ctree.sml: pt_extract ([], Res)";
68.970 -
68.971 -"=====new ptree 6 minisubpbl intersteps ==========================";
68.972 -"=====new ptree 6 minisubpbl intersteps ==========================";
68.973 -"=====new ptree 6 minisubpbl intersteps ==========================";
68.974 -states:=[];
68.975 -CalcTree
68.976 - [(["equality (x+1=2)", "solveFor x","solutions L"],
68.977 - ("Test.thy",
68.978 - ["sqroot-test","univariate","equation","test"],
68.979 - ["Test","squ-equ-test-subpbl1"]))];
68.980 -Iterator 1; moveActiveRoot 1;
68.981 -autoCalculate 1 CompleteCalc;
68.982 -interSteps 1 ([2],Res);
68.983 -interSteps 1 ([3,2],Res);
68.984 -val ((pt,_),_) = get_calc 1;
68.985 -show_pt pt;
68.986 -
68.987 -(**##############################################################**)
68.988 -"-------------- get_allpos' new ----------------------------------";
68.989 -"-------------- get_allpos' new ----------------------------------";
68.990 -"-------------- get_allpos' new ----------------------------------";
68.991 -"--- whole ctree";
68.992 -print_depth 99;
68.993 -val cuts = get_allp [] ([], ([],Frm)) pt;
68.994 -print_depth 3;
68.995 -if cuts =
68.996 - [(*never returns the first pos'*)
68.997 - ([1], Frm),
68.998 - ([1], Res),
68.999 - ([2, 1], Frm), ([2, 1], Res), ([2, 2], Res), ([2, 3], Res),
68.1000 - ([2, 4], Res), ([2, 5], Res), ([2, 6], Res),
68.1001 - ([2], Res),
68.1002 - ([3], Pbl),
68.1003 - ([3, 1], Frm), ([3, 1], Res),
68.1004 - ([3, 2, 1], Frm), ([3, 2, 1], Res), ([3, 2, 2], Res),
68.1005 - ([3, 2], Res),
68.1006 - ([3], Res),
68.1007 - ([4], Res),
68.1008 - ([], Res)] then () else
68.1009 -raise error "ctree.sml diff.behav. get_allp new []";
68.1010 -
68.1011 -print_depth 99;
68.1012 -val cuts2 = get_allps [] [1] (children pt);
68.1013 -print_depth 3;
68.1014 -if cuts = cuts2 @ [([], Res)] then () else
68.1015 -raise error "ctree.sml diff.behav. get_allps new []";
68.1016 -
68.1017 -"---(3) on S(606)..S(608)--------";
68.1018 -"--- nd [2] with 6 children---------------------------------";
68.1019 -val cuts = get_allp [] ([2], ([],Frm)) (get_nd pt [2]);
68.1020 -if cuts =
68.1021 - [([2, 1], Frm), ([2, 1], Res), ([2, 2], Res), ([2, 3], Res),
68.1022 - ([2, 4], Res), ([2, 5], Res), ([2, 6], Res),
68.1023 - ([2], Res)] then () else
68.1024 -raise error "ctree.sml diff.behav. get_allp new [2]";
68.1025 -
68.1026 -val cuts2 = get_allps [] [2,1] (children (get_nd pt [2]));
68.1027 -if cuts = cuts2 @ [([2], Res)] then () else
68.1028 -raise error "ctree.sml diff.behav. get_allps new [2]";
68.1029 -
68.1030 -
68.1031 -"---(4) on S(606)..S(608)--------";
68.1032 -"--- nd [3] subproblem--------------------------------------";
68.1033 -val cuts = get_allp [] ([3], ([],Frm)) (get_nd pt [3]);
68.1034 -if cuts =
68.1035 - [([3, 1], Frm),
68.1036 - ([3, 1], Res),
68.1037 - ([3, 2, 1], Frm), ([3, 2, 1], Res), ([3, 2, 2], Res),
68.1038 - ([3, 2], Res),
68.1039 - ([3], Res)] then () else
68.1040 -raise error "ctree.sml diff.behav. get_allp new [3]";
68.1041 -
68.1042 -val cuts2 = get_allps [] [3,1] (children (get_nd pt [3]));
68.1043 -if cuts = cuts2 @ [([3], Res)] then () else
68.1044 -raise error "ctree.sml diff.behav. get_allps new [3]";
68.1045 -
68.1046 -"--- nd [3,2] with 2 children--------------------------------";
68.1047 -val cuts = get_allp [] ([3,2], ([],Frm)) (get_nd pt [3,2]);
68.1048 -if cuts =
68.1049 - [([3, 2, 1], Frm), ([3, 2, 1], Res), ([3, 2, 2], Res),
68.1050 - ([3, 2], Res)] then () else
68.1051 -raise error "ctree.sml diff.behav. get_allp new [3,2]";
68.1052 -
68.1053 -val cuts2 = get_allps [] [3,2,1] (children (get_nd pt [3,2]));
68.1054 -if cuts = cuts2 @ [([3, 2], Res)] then () else
68.1055 -raise error "ctree.sml diff.behav. get_allps new [3,2]";
68.1056 -
68.1057 -"---(5a) on S(606)..S(608)--------";
68.1058 -"--- nd [3,2,1] with 0 children------------------------------";
68.1059 -val cuts = get_allp [] ([3,2,1], ([],Frm)) (get_nd pt [3,2,1]);
68.1060 -if cuts =
68.1061 - [] then () else
68.1062 -raise error "ctree.sml diff.behav. get_allp new [3,2,1]";
68.1063 -
68.1064 -val cuts2 = get_allps [] [3,2,1,1] (children (get_nd pt [3,2,1]));
68.1065 -if cuts = cuts2 @ [] then () else
68.1066 -raise error "ctree.sml diff.behav. get_allps new [3,2,1]";
68.1067 -
68.1068 -
68.1069 -(**#################################################################**)
68.1070 -"-------------- cut_tree new (from ptree above)-------------------";
68.1071 -"-------------- cut_tree new (from ptree above)-------------------";
68.1072 -"-------------- cut_tree new (from ptree above)-------------------";
68.1073 -show_pt pt;
68.1074 -val b = get_obj g_branch pt [];
68.1075 -if b = TransitiveB then () else
68.1076 -raise error ("ctree.sml diff.behav. in [] branch="^branch2str b);
68.1077 -val b = get_obj g_branch pt [3];
68.1078 -if b = TransitiveB then () else
68.1079 -raise error ("ctree.sml diff.behav. in [3] branch="^branch2str b);
68.1080 -
68.1081 -"---(2) on S(606)..S(608)--------";
68.1082 -val (pt', cuts) = cut_tree pt ([1],Res);
68.1083 -print_depth 99;
68.1084 -cuts;
68.1085 -print_depth 3;
68.1086 -if cuts = [([2, 1], Frm), ([2, 1], Res), ([2, 2], Res), ([2, 3], Res),
68.1087 - ([2, 4], Res), ([2, 5], Res), ([2, 6], Res), ([2], Res), ([3], Pbl),
68.1088 - ([3, 1], Frm), ([3, 1], Res), ([3, 2, 1], Frm), ([3, 2, 1], Res),
68.1089 - ([3, 2, 2], Res), ([3, 2], Res), ([3], Res), ([4], Res),
68.1090 -(*WN060727 after replacing cutlevup by test_trans:*)([], Res)] then () else
68.1091 -raise error "ctree.sml: diff.behav. cut_tree ([1],Res)";
68.1092 -
68.1093 -
68.1094 -"---(3) on S(606)..S(608)--------";
68.1095 -val (pt', cuts) = cut_tree pt ([2],Res);
68.1096 -print_depth 99;
68.1097 -cuts;
68.1098 -print_depth 3;
68.1099 -if cuts = [(*preceding step on WS was ([1]),Res*)
68.1100 - ([2, 1], Frm), ([2, 1], Res), ([2, 2], Res), ([2, 3], Res),
68.1101 - ([2, 4], Res), ([2, 5], Res), ([2, 6], Res),
68.1102 - ([2], Res),
68.1103 - ([3], Pbl),
68.1104 - ([3, 1], Frm),
68.1105 - ([3, 1], Res),
68.1106 - ([3, 2, 1], Frm), ([3, 2, 1], Res), ([3, 2, 2], Res),
68.1107 - ([3, 2], Res),
68.1108 - ([3], Res),
68.1109 - ([4], Res),
68.1110 -(*WN060727 added after replacing cutlevup by test_trans:*)([],Res)] then ()
68.1111 -else raise error "ctree.sml: diff.behav. cut_tree ([2],Res)";
68.1112 -
68.1113 -"---(4) on S(606)..S(608)--------";
68.1114 -val (pt', cuts) = cut_tree pt ([3],Pbl);
68.1115 -print_depth 99;
68.1116 -cuts;
68.1117 -print_depth 3;
68.1118 -if cuts = [([3], Pbl),
68.1119 - ([3, 1], Frm), ([3, 1], Res),
68.1120 - ([3, 2, 1], Frm), ([3, 2, 1], Res), ([3, 2, 2], Res),
68.1121 - ([3, 2], Res),
68.1122 - ([3], Res),
68.1123 - ([4], Res),
68.1124 -(*WN060727 added after replacing cutlevup by test_trans:*)([], Res)]
68.1125 -then () else raise error "ctree.sml: diff.behav. cut_tree ([3],Pbl)";
68.1126 -
68.1127 -"---(5a) on S(606)..S(608) cut_tree --------";
68.1128 -val (pt', cuts) = cut_tree pt ([3,2,1],Res);
68.1129 -print_depth 99;
68.1130 -cuts;
68.1131 -print_depth 1;
68.1132 -if cuts = [([3, 2, 2], Res), ([3, 2], Res),
68.1133 -(*WN060727 added after replacing cutlevup by test_trans:*)
68.1134 -([3], Res), ([4], Res),([],Res)] then ()
68.1135 -else raise error "ctree.sml: diff.behav. cut_tree ([3,2,1],Res)";
68.1136 -show_pt pt';
68.1137 -
68.1138 -
68.1139 -"-------------- cappend on complete ctree from above -------------";
68.1140 -"-------------- cappend on complete ctree from above -------------";
68.1141 -"-------------- cappend on complete ctree from above -------------";
68.1142 -show_pt pt;
68.1143 -
68.1144 -"---(2) on S(606)..S(608)--------";
68.1145 -val (pt', cuts) = cappend_atomic pt [1] e_istate (str2term "Inform[1]")
68.1146 - (Tac "test") (str2term "Inres[1]",[]) Complete;
68.1147 -print_depth 99;
68.1148 -cuts;
68.1149 -print_depth 3;
68.1150 -if cuts = [([2, 1], Frm), ([2, 1], Res), ([2, 2], Res), ([2, 3], Res),
68.1151 - ([2, 4], Res), ([2, 5], Res), ([2, 6], Res), ([2], Res), ([3], Pbl),
68.1152 - ([3, 1], Frm), ([3, 1], Res), ([3, 2, 1], Frm), ([3, 2, 1], Res),
68.1153 - ([3, 2, 2], Res), ([3, 2], Res), ([3], Res), ([4], Res),
68.1154 -(*WN060727 added after replacing cutlevup by test_trans:*) ([], Res)] then ()
68.1155 -else raise error "ctree.sml: diff:behav. in complete pt:append_atomic[1] cuts";
68.1156 -val afterins = get_allp [] ([], ([],Frm)) pt';
68.1157 -print_depth 99;
68.1158 -afterins;
68.1159 -print_depth 3;
68.1160 -if afterins = [([1], Frm), ([1], Res)
68.1161 -(*, WN060727 removed after replacing cutlevup by test_trans:([], Res)*)] then()
68.1162 -else raise error "ctree.sml: diff:behav. in complete pt: append_atomic[1] afterins";
68.1163 -show_pt pt';
68.1164 -
68.1165 -"---(3) on S(606)..S(608)--------";
68.1166 -show_pt pt;
68.1167 -val (pt', cuts) = cappend_atomic pt [2] e_istate (str2term "Inform[2]")
68.1168 - (Tac "test") (str2term "Inres[2]",[]) Complete;
68.1169 -print_depth 99;
68.1170 -cuts;
68.1171 -print_depth 3;
68.1172 -if cuts = [([2, 1], Frm), ([2, 1], Res), ([2, 2], Res), ([2, 3], Res),
68.1173 - ([2, 4], Res), ([2, 5], Res), ([2, 6], Res), ([2], Res), ([3], Pbl),
68.1174 - ([3, 1], Frm),([3, 1], Res), ([3, 2, 1], Frm), ([3, 2, 1], Res),
68.1175 - ([3, 2, 2], Res), ([3, 2], Res), ([3], Res), ([4], Res),
68.1176 -(*WN060727 added after replacing cutlevup by test_trans:*) ([], Res)] then ()
68.1177 -else raise error "ctree.sml: diff:behav.in complete pt: append_atomic[2] cuts";
68.1178 -val afterins = get_allp [] ([], ([],Frm)) pt';
68.1179 -print_depth 99;
68.1180 -afterins;
68.1181 -print_depth 3;
68.1182 -if afterins = [([1], Frm), ([1], Res), ([2], Frm), ([2], Res)
68.1183 -(*, WN060727 removed after replacing cutlevup by test_trans:([], Res)*)]
68.1184 -then () else
68.1185 -raise error "ctree.sml: diff:behav. in complete pt: append_atomic[2] afterins";
68.1186 -show_pt pt';
68.1187 -(*
68.1188 - val p = move_dn [] pt' ([],Pbl) (*-> ([1],Frm)*);
68.1189 - val p = move_dn [] pt' p (*-> ([1],Res)*);
68.1190 - val p = move_dn [] pt' p (*-> ([2],Frm)*);
68.1191 - val p = move_dn [] pt' p (*-> ([2],Res)*);
68.1192 -
68.1193 - term2str (get_obj g_form pt' [2]);
68.1194 - term2str (get_obj g_res pt' [2]);
68.1195 - ostate2str (get_obj g_ostate pt' [2]);
68.1196 - *)
68.1197 -
68.1198 -"---(4) on S(606)..S(608)--------";
68.1199 -val (pt', cuts) = cappend_problem pt [3] e_istate ([],e_spec)
68.1200 - ([],e_spec, str2term "Inhead[3]");
68.1201 -print_depth 99;
68.1202 -cuts;
68.1203 -print_depth 3;
68.1204 -if cuts = [([3], Pbl),
68.1205 - ([3, 1], Frm), ([3, 1], Res),
68.1206 - ([3, 2, 1], Frm), ([3, 2, 1], Res), ([3, 2, 2], Res),
68.1207 - ([3, 2], Res),
68.1208 - ([3], Res), ([4], Res),
68.1209 -(*WN060727 added after replacing cutlevup by test_trans*)([], Res)] then ()else
68.1210 -raise error "ctree.sml: diff:behav. in ccomplete pt: append_problem[3] cuts";
68.1211 -val afterins = get_allp [] ([], ([],Frm)) pt';
68.1212 -print_depth 99;
68.1213 -afterins;
68.1214 -print_depth 3;
68.1215 -if afterins =
68.1216 - [([1], Frm), ([1], Res),([2, 1], Frm), ([2, 1], Res), ([2, 2], Res),
68.1217 - ([2, 3], Res), ([2, 4], Res), ([2, 5], Res), ([2, 6], Res), ([2], Res),
68.1218 - ([3], Pbl)] then () else
68.1219 -raise error "ctree.sml: diff:behav.in complete pt: append_problem[3] afterins";
68.1220 -(* use"systest/ctree.sml";
68.1221 - use"ctree.sml";
68.1222 - *)
68.1223 -
68.1224 -"---(6-1) on S(606)..S(608)--------";
68.1225 -val (pt', cuts) = cappend_atomic pt [3,1] e_istate (str2term "Inform[3,1]")
68.1226 - (Tac "test") (str2term "Inres[3,1]",[]) Complete;
68.1227 -print_depth 99;
68.1228 -cuts;
68.1229 -print_depth 3;
68.1230 -if cuts = [([3, 2, 1], Frm), ([3, 2, 1], Res), ([3, 2, 2], Res),
68.1231 - ([3, 2], Res),
68.1232 -(*WN060727 added*)([3], Res), ([4], Res), ([], Res)] then () else
68.1233 -raise error "ctree.sml: diff:behav. in complete pt: append_atomic[3,1] cuts";
68.1234 -val afterins = get_allp [] ([], ([],Frm)) pt';
68.1235 -print_depth 99;
68.1236 -afterins;
68.1237 -print_depth 3;
68.1238 -(*WN060727 replaced after overwriting cutlevup by test_trans
68.1239 -if afterins = [([1], Frm), ([1], Res),
68.1240 - ([2, 1], Frm), ([2, 1], Res), ([2, 2], Res),
68.1241 - ([2, 3], Res), ([2, 4], Res), ([2, 5], Res), ([2, 6], Res),
68.1242 - ([2], Res),
68.1243 - ([3], Pbl),
68.1244 - ([3, 1], Frm), ([3, 1], Res)(*replaced*), (*([3, 2], Res) cut!*)
68.1245 - ([3], Res)(*cutlevup=false*),
68.1246 - ([4], Res),
68.1247 - ([], Res)(*cutlevup=false*)] then () else
68.1248 -raise error "ctree.sml: diff:behav. in complete pt: append_atomic[3,1] insrtd";
68.1249 -*)
68.1250 -if afterins = [([1], Frm), ([1], Res),
68.1251 - ([2, 1], Frm), ([2, 1], Res), ([2, 2], Res),
68.1252 - ([2, 3], Res), ([2, 4], Res), ([2, 5], Res), ([2, 6], Res),
68.1253 - ([2], Res),
68.1254 - ([3], Pbl),
68.1255 - ([3, 1], Frm), ([3, 1], Res)] then () else
68.1256 -raise error "ctree.sml: diff:behav. in complete pt: append_atomic[3,1] insrtd";
68.1257 -
68.1258 -if term2str (get_obj g_form pt' [3,1]) = "Inform [3, 1]" then () else
68.1259 -raise error "ctree.sml: diff:behav. in complete pt: append_atomic[3,1] Inform";
68.1260 -
68.1261 -"---(6) on S(606)..S(608)--------";
68.1262 -val (pt', cuts) = cappend_atomic pt [3,2] e_istate (str2term "Inform[3,2]")
68.1263 - (Tac "test") (str2term "Inres[3,2]",[]) Complete;
68.1264 -print_depth 99;
68.1265 -cuts;
68.1266 -print_depth 3;
68.1267 -if cuts = [(*just after is: cutlevup=false in [3]*)
68.1268 -(*WN060727 after test_trans instead cutlevup added:*)
68.1269 - ([3], Res), ([4], Res), ([], Res)] then () else
68.1270 -raise error "ctree.sml: diff:behav. in complete pt: append_atomic[3,2] cuts";
68.1271 -val afterins = get_allp [] ([], ([],Frm)) pt';
68.1272 -print_depth 99;
68.1273 -afterins;
68.1274 -print_depth 3;
68.1275 -(*WN060727 replaced after overwriting cutlevup by test_trans
68.1276 -if afterins = [([1], Frm), ([1], Res),
68.1277 - ([2, 1], Frm), ([2, 1], Res), ([2, 2], Res),
68.1278 - ([2, 3], Res), ([2, 4], Res), ([2, 5], Res), ([2, 6], Res),
68.1279 - ([2], Res),
68.1280 - ([3], Pbl),
68.1281 - ([3, 1], Frm), ([3, 1], Res), ([3, 2], Frm), ([3, 2], Res),
68.1282 - ([3], Res),
68.1283 - ([4], Res), ([], Res)] then () else
68.1284 -raise error "ctree.sml: diff:behav. in complete pt: append_atomic[3,2] insrtd";
68.1285 -*)
68.1286 -if afterins = [([1], Frm), ([1], Res),
68.1287 - ([2, 1], Frm), ([2, 1], Res), ([2, 2], Res),
68.1288 - ([2, 3], Res), ([2, 4], Res), ([2, 5], Res), ([2, 6], Res),
68.1289 - ([2], Res),
68.1290 - ([3], Pbl),
68.1291 - ([3, 1], Frm), ([3, 1], Res), ([3, 2], Frm), ([3, 2], Res)]
68.1292 -then () else
68.1293 -raise error "ctree.sml: diff:behav. in complete pt: append_atomic[3,2] insrtd";
68.1294 -
68.1295 -if term2str (get_obj g_form pt' [3,2]) = "Inform [3, 2]" then () else
68.1296 -raise error "ctree.sml: diff:behav. in complete pt: append_atomic[3,2] Inform";
68.1297 -
68.1298 -"---(6++) on S(606)..S(608)--------";
68.1299 -(**)
68.1300 -val (pt', cuts) = cappend_atomic pt [3,2,1] e_istate (str2term "Inform[3,2,1]")
68.1301 - (Tac "test") (str2term "Inres[3,2,1]",[]) Complete;
68.1302 -print_depth 99;
68.1303 -cuts;
68.1304 -print_depth 1;
68.1305 -if cuts = [([3, 2, 2], Res), ([3, 2], Res),
68.1306 -(*WN060727 {cutlevup->test_trans} added:*)([3], Res), ([4], Res), ([], Res)]
68.1307 -then () else
68.1308 -raise error "ctree.sml: diff:behav. in complete pt: append_atomic[3,2,1] cuts";
68.1309 -val afterins = get_allp [] ([], ([],Frm)) pt';
68.1310 -print_depth 99;
68.1311 -afterins;
68.1312 -print_depth 3;
68.1313 -if afterins = [([1], Frm), ([1], Res),
68.1314 - ([2, 1], Frm), ([2, 1], Res), ([2, 2], Res),
68.1315 - ([2, 3], Res), ([2, 4], Res), ([2, 5], Res), ([2, 6], Res),
68.1316 - ([2], Res),
68.1317 - ([3], Pbl),
68.1318 - ([3, 1], Frm), ([3, 1], Res),
68.1319 - ([3, 2, 1], Frm), ([3, 2, 1], Res)] then () else
68.1320 -raise error "ctree.sml: diff:behav. in complete pt: append_atom[3,2,1] insrtd";
68.1321 -if term2str (get_obj g_form pt' [3,2,1]) = "Inform [3, 2, 1]" then () else
68.1322 -raise error "ctree.sml: diff:behav. complete pt: append_atomic[3,2,1] Inform";
68.1323 -(*
68.1324 -show_pt pt';
68.1325 -show_pt pt;
68.1326 -*)
68.1327 -
69.1 --- a/test/Tools/isac/ME/inform.sml Mon Aug 30 14:29:49 2010 +0200
69.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
69.3 @@ -1,772 +0,0 @@
69.4 -(* tests on inform.sml
69.5 - author: Walther Neuper
69.6 - 060225,
69.7 - (c) due to copyright terms
69.8 -
69.9 -use"../smltest/ME/inform.sml";
69.10 -use"inform.sml";
69.11 -*)
69.12 -
69.13 -"-----------------------------------------------------------------";
69.14 -"table of contents -----------------------------------------------";
69.15 -"-----------------------------------------------------------------";
69.16 -"appendForm with miniscript with mini-subpbl:";
69.17 -"--------- appendFormula: on Res + equ_nrls ----------------------";
69.18 -"--------- appendFormula: on Frm + equ_nrls ----------------------";
69.19 -"--------- appendFormula: on Res + NO deriv ----------------------";
69.20 -"--------- appendFormula: on Res + late deriv --------------------";
69.21 -"--------- appendFormula: on Res + late deriv [x = 3 + -2]---///--";
69.22 -"replaceForm with miniscript with mini-subpbl:";
69.23 -"--------- replaceFormula: on Res + = ----------------------------";
69.24 -"--------- replaceFormula: on Res + = 1st Nd ---------------------";
69.25 -"--------- replaceFormula: on Frm + = 1st Nd ---------------------";
69.26 -"--------- replaceFormula: cut calculation -----------------------";
69.27 -"--------- replaceFormula: cut calculation -----------------------";
69.28 -(* 040307 copied from informtest.sml ... old versions
69.29 -"--------- maximum-example, UC: Modeling / modifyCalcHead --------";*)
69.30 -"--------- syntax error ------------------------------------------";
69.31 -"CAS-command:";
69.32 -"--------- CAS-command on ([],Pbl) -------------------------------";
69.33 -"--------- CAS-command on ([],Pbl) FE-interface ------------------";
69.34 -"--------- inform [rational,simplification] ----------------------";
69.35 -"--------- Take as 1st tac, start with <NEW> (CAS input) ---------";
69.36 -"--------- Take as 1st tac, start from exp -----------------------";
69.37 -"--------- init_form, start with <NEW> (CAS input) ---------------";
69.38 -"-----------------------------------------------------------------";
69.39 -"-----------------------------------------------------------------";
69.40 -"-----------------------------------------------------------------";
69.41 -
69.42 -
69.43 -
69.44 -
69.45 -
69.46 -
69.47 -"--------- appendFormula: on Res + equ_nrls ----------------------";
69.48 -"--------- appendFormula: on Res + equ_nrls ----------------------";
69.49 -"--------- appendFormula: on Res + equ_nrls ----------------------";
69.50 - val Script sc = (#scr o get_met) ["Test","squ-equ-test-subpbl1"];
69.51 - (writeln o term2str) sc;
69.52 - val Script sc = (#scr o get_met) ["Test","solve_linear"];
69.53 - (writeln o term2str) sc;
69.54 -
69.55 - states:=[];
69.56 - CalcTree [(["equality (x+1=2)", "solveFor x","solutions L"],
69.57 - ("Test.thy",
69.58 - ["sqroot-test","univariate","equation","test"],
69.59 - ["Test","squ-equ-test-subpbl1"]))];
69.60 - Iterator 1; moveActiveRoot 1;
69.61 - autoCalculate 1 CompleteCalcHead;
69.62 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
69.63 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
69.64 -
69.65 - appendFormula 1 "-2 * 1 + (1 + x) = 0"; refFormula 1 (get_pos 1 1);
69.66 - val ((pt,_),_) = get_calc 1;
69.67 - val str = pr_ptree pr_short pt;
69.68 - writeln str;
69.69 - if str = ". ----- pblobj -----\n1. x + 1 = 2\n2. x + 1 + -1 * 2 = 0\n2.1. x + 1 + -1 * 2 = 0\n2.2. -1 * 2 + (x + 1) = 0\n2.3. -1 * 2 + (1 + x) = 0\n2.4. 1 + (-1 * 2 + x) = 0\n2.5. 1 + (-2 + x) = 0\n2.6. 1 + (-2 * 1 + x) = 0\n" then ()
69.70 - else raise error "inform.sml: diff.behav.appendFormula: on Res + equ 1";
69.71 -
69.72 - moveDown 1 ([ ],Pbl); refFormula 1 ([1],Frm); (*x + 1 = 2*)
69.73 - moveDown 1 ([1],Frm); refFormula 1 ([1],Res); (*x + 1 + -1 * 2 = 0*)
69.74 -
69.75 - (*the seven steps of detailed derivation*)
69.76 - moveDown 1 ([1 ],Res); refFormula 1 ([2,1],Frm);
69.77 - moveDown 1 ([2,1],Frm); refFormula 1 ([2,1],Res);
69.78 - moveDown 1 ([2,1],Res); refFormula 1 ([2,2],Res);
69.79 - moveDown 1 ([2,2],Res); refFormula 1 ([2,3],Res);
69.80 - moveDown 1 ([2,3],Res); refFormula 1 ([2,4],Res);
69.81 - moveDown 1 ([2,4],Res); refFormula 1 ([2,5],Res);
69.82 - moveDown 1 ([2,5],Res); refFormula 1 ([2,6],Res);
69.83 - val ((pt,_),_) = get_calc 1;
69.84 - if "-2 * 1 + (1 + x) = 0" = term2str (fst (get_obj g_result pt [2,6])) then()
69.85 - else raise error "inform.sml: diff.behav.appendFormula: on Res + equ 2";
69.86 -
69.87 - fetchProposedTactic 1; (*takes Iterator 1 _1_*)
69.88 - val (_,(tac,_,_)::_) = get_calc 1;
69.89 - if tac = Rewrite_Set "Test_simplify" then ()
69.90 - else raise error "inform.sml: diff.behav.appendFormula: on Res + equ 3";
69.91 - autoCalculate 1 CompleteCalc;
69.92 - val ((pt,_),_) = get_calc 1;
69.93 - if "[x = 1]" = term2str (fst (get_obj g_result pt [])) then ()
69.94 - else raise error "inform.sml: diff.behav.appendFormula: on Res + equ 4";
69.95 - (* autoCalculate 1 CompleteCalc;
69.96 - val ((pt,p),_) = get_calc 1;
69.97 - (writeln o istates2str) (get_obj g_loc pt [ ]);
69.98 - (writeln o istates2str) (get_obj g_loc pt [1]);
69.99 - (writeln o istates2str) (get_obj g_loc pt [2]);
69.100 - (writeln o istates2str) (get_obj g_loc pt [3]);
69.101 - (writeln o istates2str) (get_obj g_loc pt [3,1]);
69.102 - (writeln o istates2str) (get_obj g_loc pt [3,2]);
69.103 - (writeln o istates2str) (get_obj g_loc pt [4]);
69.104 -
69.105 - *)
69.106 -"----------------------------------------------------------";
69.107 - val fod = make_deriv Isac.thy Atools_erls
69.108 - ((#rules o rep_rls) Test_simplify)
69.109 - (sqrt_right false (theory "Pure")) NONE
69.110 - (str2term "x + 1 + -1 * 2 = 0");
69.111 - (writeln o trtas2str) fod;
69.112 -
69.113 - val ifod = make_deriv Isac.thy Atools_erls
69.114 - ((#rules o rep_rls) Test_simplify)
69.115 - (sqrt_right false (theory "Pure")) NONE
69.116 - (str2term "-2 * 1 + (1 + x) = 0");
69.117 - (writeln o trtas2str) ifod;
69.118 - fun equal (_,_,(t1, _)) (_,_,(t2, _)) = t1=t2;
69.119 - val (fod', rifod') = dropwhile' equal (rev fod) (rev ifod);
69.120 - val der = fod' @ (map rev_deriv' rifod');
69.121 - (writeln o trtas2str) der;
69.122 - "----------------------------------------------------------";
69.123 -
69.124 -
69.125 -"--------- appendFormula: on Frm + equ_nrls ----------------------";
69.126 -"--------- appendFormula: on Frm + equ_nrls ----------------------";
69.127 -"--------- appendFormula: on Frm + equ_nrls ----------------------";
69.128 - states:=[];
69.129 - CalcTree [(["equality (x+1=2)", "solveFor x","solutions L"],
69.130 - ("Test.thy",
69.131 - ["sqroot-test","univariate","equation","test"],
69.132 - ["Test","squ-equ-test-subpbl1"]))];
69.133 - Iterator 1; moveActiveRoot 1;
69.134 - autoCalculate 1 CompleteCalcHead;
69.135 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*x + 1 = 2*);
69.136 -
69.137 - appendFormula 1 "2+ -1 + x = 2"; refFormula 1 (get_pos 1 1);
69.138 -
69.139 - moveDown 1 ([],Pbl); refFormula 1 ([1],Frm) (*x + 1 = 2*);
69.140 -
69.141 - moveDown 1 ([1 ],Frm); refFormula 1 ([1,1],Frm);
69.142 - moveDown 1 ([1,1],Frm); refFormula 1 ([1,1],Res);
69.143 - moveDown 1 ([1,1],Res); refFormula 1 ([1,2],Res);
69.144 - moveDown 1 ([1,2],Res); refFormula 1 ([1,3],Res);
69.145 - moveDown 1 ([1,3],Res); refFormula 1 ([1,4],Res);
69.146 - moveDown 1 ([1,4],Res); refFormula 1 ([1,5],Res);
69.147 - moveDown 1 ([1,5],Res); refFormula 1 ([1,6],Res);
69.148 - val ((pt,_),_) = get_calc 1;
69.149 - if "2 + -1 + x = 2" = term2str (fst (get_obj g_result pt [1,6])) then()
69.150 - else raise error "inform.sml: diff.behav.appendFormula: on Frm + equ 1";
69.151 -
69.152 - fetchProposedTactic 1; (*takes Iterator 1 _1_*)
69.153 - val (_,(tac,_,_)::_) = get_calc 1;
69.154 - if tac = Rewrite_Set "norm_equation" then ()
69.155 - else raise error "inform.sml: diff.behav.appendFormula: on Frm + equ 2";
69.156 - autoCalculate 1 CompleteCalc;
69.157 - val ((pt,_),_) = get_calc 1;
69.158 - if "[x = 1]" = term2str (fst (get_obj g_result pt [])) then ()
69.159 - else raise error "inform.sml: diff.behav.appendFormula: on Frm + equ 3";
69.160 -
69.161 -
69.162 -"--------- appendFormula: on Res + NO deriv ----------------------";
69.163 -"--------- appendFormula: on Res + NO deriv ----------------------";
69.164 -"--------- appendFormula: on Res + NO deriv ----------------------";
69.165 - states:=[];
69.166 - CalcTree [(["equality (x+1=2)", "solveFor x","solutions L"],
69.167 - ("Test.thy",
69.168 - ["sqroot-test","univariate","equation","test"],
69.169 - ["Test","squ-equ-test-subpbl1"]))];
69.170 - Iterator 1; moveActiveRoot 1;
69.171 - autoCalculate 1 CompleteCalcHead;
69.172 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
69.173 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
69.174 -
69.175 - appendFormula 1 "x = 2";
69.176 - val ((pt,p),_) = get_calc 1;
69.177 - val str = pr_ptree pr_short pt;
69.178 - writeln str;
69.179 - if str = ". ----- pblobj -----\n1. x + 1 = 2\n" andalso p = ([1], Res)
69.180 - then ()
69.181 - else raise error "inform.sml: diff.behav.appendFormula: Res + NOder 1";
69.182 -
69.183 - fetchProposedTactic 1;
69.184 - val (_,(tac,_,_)::_) = get_calc 1;
69.185 - if tac = Rewrite_Set "Test_simplify" then ()
69.186 - else raise error "inform.sml: diff.behav.appendFormula: Res + NOder 2";
69.187 - autoCalculate 1 CompleteCalc;
69.188 - val ((pt,_),_) = get_calc 1;
69.189 - if "[x = 1]" = term2str (fst (get_obj g_result pt [])) then ()
69.190 - else raise error "inform.sml: diff.behav.appendFormula: on Frm + equ 3";
69.191 -
69.192 -
69.193 -"--------- appendFormula: on Res + late deriv --------------------";
69.194 -"--------- appendFormula: on Res + late deriv --------------------";
69.195 -"--------- appendFormula: on Res + late deriv --------------------";
69.196 - states:=[];
69.197 - CalcTree [(["equality (x+1=2)", "solveFor x","solutions L"],
69.198 - ("Test.thy",
69.199 - ["sqroot-test","univariate","equation","test"],
69.200 - ["Test","squ-equ-test-subpbl1"]))];
69.201 - Iterator 1; moveActiveRoot 1;
69.202 - autoCalculate 1 CompleteCalcHead;
69.203 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
69.204 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
69.205 -
69.206 - appendFormula 1 "x = 1";
69.207 - val ((pt,p),_) = get_calc 1;
69.208 - val str = pr_ptree pr_short pt;
69.209 - writeln str;
69.210 - if str = ". ----- pblobj -----\n1. x + 1 = 2\n2. x + 1 + -1 * 2 = 0\n3. ----- pblobj -----\n3.1. -1 + x = 0\n3.2. x = 0 + -1 * -1\n3.2.1. x = 0 + -1 * -1\n3.2.2. x = 0 + 1\n" andalso p = ([3,2], Res)
69.211 - then () (*finds 1 step too early: ([3,2], Res) "x = 1" also by script !!!*)
69.212 - else raise error "inform.sml: diff.behav.appendFormula: Res + late d 1";
69.213 -
69.214 - fetchProposedTactic 1;
69.215 - val (_,(tac,_,_)::_) = get_calc 1;
69.216 - if tac = Check_Postcond ["linear", "univariate", "equation", "test"] then ()
69.217 - else raise error "inform.sml: diff.behav.appendFormula: Res + late d 2";
69.218 - autoCalculate 1 CompleteCalc;
69.219 - val ((pt,_),_) = get_calc 1;
69.220 - if "[x = 1]" = term2str (fst (get_obj g_result pt [])) then ()
69.221 - else raise error "inform.sml: diff.behav.appendFormula: Res + late d 3";
69.222 -
69.223 -
69.224 -"--------- appendFormula: on Res + late deriv [x = 3 + -2]---///--";
69.225 -"--------- appendFormula: on Res + late deriv [x = 3 + -2]---///--";
69.226 -"--------- appendFormula: on Res + late deriv [x = 3 + -2]---///--";
69.227 - states:=[];
69.228 - CalcTree [(["equality (x+1=2)", "solveFor x","solutions L"],
69.229 - ("Test.thy",
69.230 - ["sqroot-test","univariate","equation","test"],
69.231 - ["Test","squ-equ-test-subpbl1"]))];
69.232 - Iterator 1; moveActiveRoot 1;
69.233 - autoCalculate 1 CompleteCalcHead;
69.234 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
69.235 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
69.236 - appendFormula 1 "[x = 3 + -2*1]";
69.237 - val ((pt,p),_) = get_calc 1;
69.238 - val str = pr_ptree pr_short pt;
69.239 - writeln str;
69.240 - if str=". ----- pblobj -----\n1. x + 1 = 2\n2. x + 1 + -1 * 2 = 0\n3. ----- pblobj -----\n3.1. -1 + x = 0\n3.2. x = 0 + -1 * -1\n4. [x = 1]\n4.1. [x = 1]\n4.2. [x = -2 + 3]\n4.3. [x = 3 + -2]\n" then ()
69.241 - else raise error "inform.sml: diff.behav.appendFormula: Res + latEE 1";
69.242 - autoCalculate 1 CompleteCalc;
69.243 - val ((pt,p),_) = get_calc 1;
69.244 - if "[x = 3 + -2 * 1]" = term2str (fst (get_obj g_result pt [])) then ()
69.245 - (* ~~~~~~~~~~ simplify as last step in any script ?!*)
69.246 - else raise error "inform.sml: diff.behav.appendFormula: Res + latEE 2";
69.247 -
69.248 -
69.249 -
69.250 -"--------- replaceFormula: on Res + = ----------------------------";
69.251 -"--------- replaceFormula: on Res + = ----------------------------";
69.252 -"--------- replaceFormula: on Res + = ----------------------------";
69.253 - states:=[];
69.254 - CalcTree [(["equality (x+1=2)", "solveFor x","solutions L"],
69.255 - ("Test.thy",
69.256 - ["sqroot-test","univariate","equation","test"],
69.257 - ["Test","squ-equ-test-subpbl1"]))];
69.258 - Iterator 1; moveActiveRoot 1;
69.259 - autoCalculate 1 CompleteCalcHead;
69.260 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
69.261 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
69.262 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*-1 + x*);
69.263 -
69.264 - replaceFormula 1 "-2 * 1 + (1 + x) = 0"; refFormula 1 (get_pos 1 1);
69.265 - val ((pt,_),_) = get_calc 1;
69.266 - val str = pr_ptree pr_short pt;
69.267 - writeln str;
69.268 - if str=". ----- pblobj -----\n1. x + 1 = 2\n2. x + 1 + -1 * 2 = 0\n2.1. x + 1 + -1 * 2 = 0\n2.2. -1 * 2 + (x + 1) = 0\n2.3. -1 * 2 + (1 + x) = 0\n2.4. 1 + (-1 * 2 + x) = 0\n2.5. 1 + (-2 + x) = 0\n2.6. 1 + (-2 * 1 + x) = 0\n" then()
69.269 - else raise error "inform.sml: diff.behav.replaceFormula: on Res += 1";
69.270 - autoCalculate 1 CompleteCalc;
69.271 - val ((pt,pos as(p,_)),_) = get_calc 1;
69.272 - if pos=([],Res)andalso"[x = 1]"=(term2str o fst)(get_obj g_result pt p)then()
69.273 - else raise error "inform.sml: diff.behav.replaceFormula: on Res + = 2";
69.274 -
69.275 -
69.276 -"--------- replaceFormula: on Res + = 1st Nd ---------------------";
69.277 -"--------- replaceFormula: on Res + = 1st Nd ---------------------";
69.278 -"--------- replaceFormula: on Res + = 1st Nd ---------------------";
69.279 - states:=[];
69.280 - CalcTree [(["equality (x+1=2)", "solveFor x","solutions L"],
69.281 - ("Test.thy",
69.282 - ["sqroot-test","univariate","equation","test"],
69.283 - ["Test","squ-equ-test-subpbl1"]))];
69.284 - Iterator 1; moveActiveRoot 1;
69.285 - autoCalculate 1 CompleteCalcHead;
69.286 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
69.287 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
69.288 -
69.289 - replaceFormula 1 "x + 1 = 4 + -2"; refFormula 1 (get_pos 1 1);
69.290 - val ((pt,_),_) = get_calc 1;
69.291 - val str = pr_ptree pr_short pt;
69.292 - writeln str;
69.293 - if str=". ----- pblobj -----\n1. x + 1 = 2\n1.1. x + 1 = 2\n1.2. 1 + x = 2\n1.3. 1 + x = -2 + 4\n1.4. x + 1 = -2 + 4\n" then ()
69.294 - else raise error "inform.sml: diff.behav.replaceFormula: on Res 1 + = 1";
69.295 - autoCalculate 1 CompleteCalc;
69.296 - val ((pt,pos as(p,_)),_) = get_calc 1;
69.297 - if pos=([],Res)andalso"[x = 1]"=(term2str o fst)(get_obj g_result pt p)then()
69.298 - else raise error "inform.sml: diff.behav.replaceFormula: on Res + = 2";
69.299 -
69.300 -
69.301 -"--------- replaceFormula: on Frm + = 1st Nd ---------------------";
69.302 -"--------- replaceFormula: on Frm + = 1st Nd ---------------------";
69.303 -"--------- replaceFormula: on Frm + = 1st Nd ---------------------";
69.304 - states:=[];
69.305 - CalcTree [(["equality (x+1=2)", "solveFor x","solutions L"],
69.306 - ("Test.thy",
69.307 - ["sqroot-test","univariate","equation","test"],
69.308 - ["Test","squ-equ-test-subpbl1"]))];
69.309 - Iterator 1; moveActiveRoot 1;
69.310 - autoCalculate 1 CompleteCalcHead;
69.311 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
69.312 -
69.313 - replaceFormula 1 "x + 1 = 4 + -2"; refFormula 1 (get_pos 1 1);
69.314 - val ((pt,_),_) = get_calc 1;
69.315 - val str = pr_ptree pr_short pt;
69.316 - writeln str;
69.317 - if str=". ----- pblobj -----\n1. x + 1 = 2\n1.1. x + 1 = 2\n1.2. 1 + x = 2\n1.3. 1 + x = -2 + 4\n1.4. x + 1 = -2 + 4\n" then ()
69.318 - else raise error "inform.sml: diff.behav.replaceFormula: on Frm 1 + = 1";
69.319 - autoCalculate 1 CompleteCalc;
69.320 - val ((pt,pos as(p,_)),_) = get_calc 1;
69.321 - if pos=([],Res)andalso"[x = 1]"=(term2str o fst)(get_obj g_result pt p)then()
69.322 - else raise error "inform.sml: diff.behav.replaceFormula: on Frm 1 + = 2";
69.323 -
69.324 -
69.325 -"--------- replaceFormula: cut calculation -----------------------";
69.326 -"--------- replaceFormula: cut calculation -----------------------";
69.327 -"--------- replaceFormula: cut calculation -----------------------";
69.328 - states:=[];
69.329 - CalcTree [(["equality (x+1=2)", "solveFor x","solutions L"],
69.330 - ("Test.thy",
69.331 - ["sqroot-test","univariate","equation","test"],
69.332 - ["Test","squ-equ-test-subpbl1"]))];
69.333 - Iterator 1; moveActiveRoot 1;
69.334 - autoCalculate 1 CompleteCalc;
69.335 - moveActiveRoot 1; moveActiveDown 1;
69.336 - if get_pos 1 1 = ([1], Frm) then ()
69.337 - else raise error "inform.sml: diff.behav. cut calculation 1";
69.338 -
69.339 - replaceFormula 1 "x + 1 = 4 + -2"; refFormula 1 (get_pos 1 1);
69.340 - val ((pt,p),_) = get_calc 1;
69.341 - val str = pr_ptree pr_short pt;
69.342 - writeln str;
69.343 - if p = ([1], Res) then ()
69.344 - else raise error "inform.sml: diff.behav. cut calculation 2";
69.345 -
69.346 -
69.347 -
69.348 -(* 040307 copied from informtest.sml; ... old version
69.349 - "---------------- maximum-example, UC: Modeling / modifyCalcHead -";
69.350 - "---------------- maximum-example, UC: Modeling / modifyCalcHead -";
69.351 - "---------------- maximum-example, UC: Modeling / modifyCalcHead -";
69.352 -
69.353 - val p = ([],Pbl);
69.354 - val elems = ["fixedValues [r=Arbfix]","maximum A","valuesFor [a,b]",
69.355 - "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
69.356 - "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
69.357 - "relations [A=a*b, a/2=r*sin alpha, b/2=r*cos alpha]",
69.358 - (*^^^ these are the elements for the root-problem (in variants)*)
69.359 - (*vvv these are elements required for subproblems*)
69.360 - "boundVariable a","boundVariable b","boundVariable alpha",
69.361 - "interval {x::real. 0 <= x & x <= 2*r}",
69.362 - "interval {x::real. 0 <= x & x <= 2*r}",
69.363 - "interval {x::real. 0 <= x & x <= pi}",
69.364 - "errorBound (eps=(0::real))"]
69.365 - (*specifying is not interesting for this example*)
69.366 - val spec = ("DiffApp.thy", ["maximum_of","function"],
69.367 - ["DiffApp","max_by_calculus"]);
69.368 - (*the empty model with descriptions for user-guidance by Model_Problem*)
69.369 - val empty_model = [Given ["fixedValues []"],
69.370 - Find ["maximum", "valuesFor"],
69.371 - Relate ["relations []"]];
69.372 -
69.373 -
69.374 - (*!!!!!!!!!!!!!!!!! DON'T USE me FOR FINDING nxt !!!!!!!!!!!!!!!!!!*)
69.375 - val (p,_,f,nxt,_,pt) = CalcTreeTEST [(elems, spec)];
69.376 - (*val nxt = ("Model_Problem", ...*)
69.377 - val pbl = get_obj g_pbl pt (fst p); (writeln o (itms2str_ ctxt)) pbl;
69.378 -
69.379 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
69.380 - (*nxt = Add_Given "fixedValues [r = Arbfix]"*)
69.381 - val pbl = get_obj g_pbl pt (fst p); (writeln o (itms2str_ ctxt)) pbl;
69.382 -(*[
69.383 -(0 ,[] ,false ,#Given ,Inc fixedValues [] ,(??.empty, [])),
69.384 -(0 ,[] ,false ,#Find ,Inc maximum ,(??.empty, [])),
69.385 -(0 ,[] ,false ,#Find ,Inc valuesFor ,(??.empty, [])),
69.386 -(0 ,[] ,false ,#Relate ,Inc relations [] ,(??.empty, []))]*)
69.387 -
69.388 - (*the empty CalcHead is checked w.r.t the model and re-established as such*)
69.389 - val (b,pt,ocalhd) = input_icalhd pt (p,"", empty_model, Pbl, e_spec);
69.390 - val pbl = get_obj g_pbl pt (fst p); (writeln o (itms2str_ ctxt)) pbl;
69.391 - if ocalhd2str ocalhd = "(Pbl, ??.empty, [\n(0 ,[] ,false ,#Given ,Inc fixedValues [] ,(??.empty, [])),\n(0 ,[] ,false ,#Find ,Inc maximum ,(??.empty, [])),\n(0 ,[] ,false ,#Find ,Inc valuesFor ,(??.empty, [])),\n(0 ,[] ,false ,#Relate ,Inc relations [] ,(??.empty, []))], [], \n(\"e_domID\", [\"e_pblID\"], [\"e_metID\"]) )" then () else raise error "informtest.sml: diff.behav. max 1";
69.392 -
69.393 - (*there is one input to the model (could be more)*)
69.394 - val (b,pt,ocalhd) =
69.395 - input_icalhd pt (p,"", [Given ["fixedValues [r=Arbfix]"],
69.396 - Find ["maximum", "valuesFor"],
69.397 - Relate ["relations"]], Pbl, e_spec);
69.398 - val pbl = get_obj g_pbl pt (fst p); (writeln o (itms2str_ ctxt)) pbl;
69.399 - if ocalhd2str ocalhd = "(Pbl, ??.empty, [\n(1 ,[1,2,3] ,true ,#Given ,Cor fixedValues [r = Arbfix] ,(fix_, [[r = Arbfix]])),\n(0 ,[] ,false ,#Find ,Inc maximum ,(??.empty, [])),\n(0 ,[] ,false ,#Find ,Inc valuesFor ,(??.empty, [])),\n(0 ,[] ,false ,#Relate ,Inc relations [] ,(??.empty, []))], [], \n(\"e_domID\", [\"e_pblID\"], [\"e_metID\"]) )" then ()
69.400 - else raise error "informtest.sml: diff.behav. max 2";
69.401 -
69.402 - (*this input is complete in variant 3, but the ME doesn't recognize FIXXXXME
69.403 - val (b,pt''''',ocalhd) =
69.404 - input_icalhd pt (p,"", [Given ["fixedValues [r=Arbfix]"],
69.405 - Find ["maximum A", "valuesFor [a,b]"],
69.406 - Relate ["relations [A=a*b, a/2=r*sin alpha, \
69.407 - \b/2=r*cos alpha]"]], Pbl, e_spec);
69.408 - val pbl = get_obj g_pbl pt''''' (fst p); (writeln o (itms2str_ ctxt)) pbl;
69.409 - if ocalhd2str ocalhd = ------------^^^^^^^^^^ missing !!!*)
69.410 -
69.411 - (*this input is complete in variant 1 (variant 3 does not work yet)*)
69.412 - val (b,pt''''',ocalhd) =
69.413 - input_icalhd pt (p,"", [Given ["fixedValues [r=Arbfix]"],
69.414 - Find ["maximum A", "valuesFor [a,b]"],
69.415 - Relate ["relations [A=a*b, \
69.416 - \(a/2)^^^2 + (b/2)^^^2 = r^^^2]"]],
69.417 - Pbl, e_spec);
69.418 - val pbl = get_obj g_pbl pt''''' (fst p); (writeln o (itms2str_ ctxt)) pbl;
69.419 -
69.420 - modifycalcheadOK2xml 111 (bool2str b) ocalhd;
69.421 -*)
69.422 -
69.423 -"--------- syntax error ------------------------------------------";
69.424 -"--------- syntax error ------------------------------------------";
69.425 -"--------- syntax error ------------------------------------------";
69.426 - states:=[];
69.427 - CalcTree [(["equality (x+1=2)", "solveFor x","solutions L"],
69.428 - ("Test.thy",
69.429 - ["sqroot-test","univariate","equation","test"],
69.430 - ["Test","squ-equ-test-subpbl1"]))];
69.431 - Iterator 1; moveActiveRoot 1;
69.432 - autoCalculate 1 CompleteCalcHead;
69.433 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
69.434 - autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
69.435 -
69.436 - appendFormula 1 " x - "; (*<ERROR> syntax error in ' x - ' </ERROR>*)
69.437 - val ((pt,_),_) = get_calc 1;
69.438 - val str = pr_ptree pr_short pt;
69.439 - writeln str;
69.440 - if str = ". ----- pblobj -----\n1. x + 1 = 2\n" then ()
69.441 - else raise error "inform.sml: diff.behav.appendFormula: syntax error";
69.442 -
69.443 -
69.444 -"--------- CAS-command on ([],Pbl) -------------------------------";
69.445 -"--------- CAS-command on ([],Pbl) -------------------------------";
69.446 -"--------- CAS-command on ([],Pbl) -------------------------------";
69.447 -val (p,_,f,nxt,_,pt) =
69.448 - CalcTreeTEST [([], ("e_domID", ["e_pblID"], ["e_metID"]))];
69.449 -val ifo = "solve(x+1=2,x)";
69.450 -val (_,(_,c,(pt,p))) = inform ([],[],(pt,p)) "solve(x+1=2,x)";
69.451 -show_pt pt;
69.452 -val nxt = ("Apply_Method",Apply_Method ["Test","squ-equ-test-subpbl1"]);
69.453 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
69.454 -if p = ([1], Frm) andalso f2str f = "x + 1 = 2" then ()
69.455 -else raise error "inform.sml: diff.behav. CAScmd ([],Pbl)";
69.456 -
69.457 -
69.458 -"--------- CAS-command on ([],Pbl) FE-interface ------------------";
69.459 -"--------- CAS-command on ([],Pbl) FE-interface ------------------";
69.460 -"--------- CAS-command on ([],Pbl) FE-interface ------------------";
69.461 -states:=[];
69.462 -CalcTree [([], ("e_domID", ["e_pblID"], ["e_metID"]))];
69.463 -Iterator 1;
69.464 -moveActiveRoot 1;
69.465 -replaceFormula 1 "solve(x+1=2,x)";
69.466 -autoCalculate 1 CompleteCalc;
69.467 -val ((pt,p),_) = get_calc 1;
69.468 -show_pt pt;
69.469 -if p = ([], Res) then ()
69.470 -else raise error "inform.sml: diff.behav. CAScmd ([],Pbl) FE-interface";
69.471 -
69.472 -
69.473 -"--------- inform [rational,simplification] ----------------------";
69.474 -"--------- inform [rational,simplification] ----------------------";
69.475 -"--------- inform [rational,simplification] ----------------------";
69.476 -states:=[];
69.477 -CalcTree [(["term (4/x - 3/y - 1)", "normalform N"],
69.478 - ("Rational.thy",["rational","simplification"],
69.479 - ["simplification","of_rationals"]))];
69.480 -Iterator 1; moveActiveRoot 1;
69.481 -autoCalculate 1 CompleteCalcHead;
69.482 -autoCalculate 1 (Step 1);
69.483 -autoCalculate 1 (Step 1);
69.484 -autoCalculate 1 (Step 1);
69.485 -autoCalculate 1 (Step 1);
69.486 -"--- input the next formula that _should_ be presented by mat-engine";
69.487 -appendFormula 1 "(4 * y + -3 * x) / (x * y) + -1";
69.488 -val ((pt,p),_) = get_calc 1;
69.489 -if p = ([4], Res) andalso (length o children o (get_nd pt)) (fst p) = 2 then ()
69.490 -else raise error ("inform.sml: [rational,simplification] 1");
69.491 -
69.492 -"--- input the next formula that would be presented by mat-engine";
69.493 -(*autoCalculate 1 (Step 1);*)
69.494 -appendFormula 1 "(4 * y + -3 * x + -1 * (x * y)) / (x * y)";
69.495 -val ((pt,p),_) = get_calc 1;
69.496 -if p = ([5], Res) andalso (length o children o (get_nd pt)) (fst p) = 0 then ()
69.497 -else raise error ("inform.sml: [rational,simplification] 2");
69.498 -
69.499 -"--- input the exact final result";(*TODO: Exception- LIST "last_elem" raised*)
69.500 -appendFormula 1 "(-3 * x + 4 * y + -1 * x * y) / (x * y)";
69.501 -val ((pt,p),_) = get_calc 1;
69.502 -if p = ([6], Res) andalso (length o children o (get_nd pt)) (fst p) = 2 then ()
69.503 -else raise error ("inform.sml: [rational,simplification] 3");
69.504 -show_pt pt;
69.505 -
69.506 -"--------- Take as 1st tac, start with <NEW> (CAS input) ---------";
69.507 -"--------- Take as 1st tac, start with <NEW> (CAS input) ---------";
69.508 -"--------- Take as 1st tac, start with <NEW> (CAS input) ---------";
69.509 -val t = str2term "Diff (x^^^2 + x + 1, x)";
69.510 -case t of Const ("Diff.Diff", _) $ _ => ()
69.511 - | _ => raise
69.512 - error "diff.sml behav.changed for CAS Diff (..., x)";
69.513 -atomty t;
69.514 -"-----------------------------------------------------------------";
69.515 -(*1>*)states:=[];
69.516 -(*2>*)CalcTree [([], ("e_domID", ["e_pblID"], ["e_metID"]))];
69.517 -(*3>*)Iterator 1;moveActiveRoot 1;
69.518 -"----- here the Headline has been finished";
69.519 -(*4>*)moveActiveFormula 1 ([],Pbl);
69.520 -(*5>*)replaceFormula 1 "Diff (x^2 + x + 1, x)";
69.521 -val ((pt,_),_) = get_calc 1;
69.522 -val PblObj {probl, meth, spec, fmz, env, loc, ...} = get_obj I pt [];
69.523 -val NONE = env;
69.524 -val (SOME istate, NONE) = loc;
69.525 -print_depth 5;
69.526 -writeln"-----------------------------------------------------------";
69.527 -spec;
69.528 -writeln (itms2str_ ctxt probl);
69.529 -writeln (itms2str_ ctxt meth);
69.530 -writeln (istate2str istate);
69.531 -
69.532 -print_depth 3;
69.533 -
69.534 -refFormula 1 ([],Pbl) (*--> correct CalcHead*);
69.535 - (*081016 NOT necessary (but leave it in Java):*)
69.536 -(*6>*)(*completeCalcHead*)autoCalculate 1 CompleteCalcHead;
69.537 -"----- here the CalcHead has been completed --- ONCE MORE ?????";
69.538 -
69.539 -(***difference II***)
69.540 -val ((pt,p),_) = get_calc 1;
69.541 -(*val p = ([], Pbl)*)
69.542 -val PblObj {probl, meth, spec, fmz, env, loc, ...} = get_obj I pt [];
69.543 -val NONE = env;
69.544 -val (SOME istate, NONE) = loc;
69.545 -print_depth 5; writeln (istate2str istate); print_depth 3;
69.546 -(*ScrState ([],
69.547 - [], NONE,
69.548 - ??.empty, Sundef, false)*)
69.549 -print_depth 5; spec; print_depth 3;
69.550 -(*("Isac.thy",
69.551 - ["derivative_of", "function"],
69.552 - ["diff", "differentiate_on_R"]) : spec*)
69.553 -writeln (itms2str_ ctxt probl);
69.554 -(*[
69.555 -(1 ,[1] ,true ,#Given ,Cor functionTerm (x ^^^ 2 + x + 1) ,(f_, [x ^^^ 2 + x + 1])),
69.556 -(2 ,[1] ,true ,#Given ,Cor differentiateFor x ,(v_, [x])),
69.557 -(3 ,[1] ,true ,#Find ,Cor derivative f_'_ ,(f_'_, [f_'_]))]*)
69.558 -writeln (itms2str_ ctxt meth);
69.559 -(*[
69.560 -(1 ,[1] ,true ,#Given ,Cor functionTerm (x ^^^ 2 + x + 1) ,(f_, [x ^^^ 2 + x + 1])),
69.561 -(2 ,[1] ,true ,#Given ,Cor differentiateFor x ,(v_, [x])),
69.562 -(3 ,[1] ,true ,#Find ,Cor derivative f_'_ ,(f_'_, [f_'_]))]*)
69.563 -writeln"-----------------------------------------------------------";
69.564 -(*7>*)fetchProposedTactic 1 (*--> Apply_Method*);
69.565 -(*WN081028 fixed <ERROR> helpless </ERROR> by inform returning ...(.,Met)*)
69.566 -autoCalculate 1 CompleteCalc;
69.567 -val ((pt,p),_) = get_calc 1;
69.568 -val Form res = (#1 o pt_extract) (pt, ([],Res));
69.569 -show_pt pt;
69.570 -if p = ([], Res) andalso term2str res = "1 + 2 * x" then ()
69.571 -else raise error "diff.sml behav.changed for Diff (x^2 + x + 1, x)";
69.572 -
69.573 -
69.574 -"--------- Take as 1st tac, start from exp -----------------------";
69.575 -"--------- Take as 1st tac, start from exp -----------------------";
69.576 -"--------- Take as 1st tac, start from exp -----------------------";
69.577 -(*the following input is copied from BridgeLog Java <==> SML,
69.578 - omitting unnecessary inputs*)
69.579 -(*1>*)states:=[];
69.580 -(*2>*)CalcTree [(["functionTerm (x^2 + x + 1)", "differentiateFor x", "derivative f_'_"],("Isac.thy",["derivative_of","function"],["diff","differentiate_on_R"]))];
69.581 -(*3>*)Iterator 1; moveActiveRoot 1;
69.582 -
69.583 -(*6>*)(*completeCalcHead*)autoCalculate 1 CompleteCalcHead;
69.584 -
69.585 -(***difference II***)
69.586 -val ((pt,_),_) = get_calc 1;
69.587 -val PblObj {probl, meth, spec, fmz, env, loc, ...} = get_obj I pt [];
69.588 -val NONE = env;
69.589 -val (SOME istate, NONE) = loc;
69.590 -print_depth 5; writeln (istate2str istate); print_depth 3;
69.591 -(*ScrState ([],
69.592 - [], NONE,
69.593 - ??.empty, Sundef, false)*)
69.594 -print_depth 5; spec; print_depth 3;
69.595 -(*("Isac.thy",
69.596 - ["derivative_of", "function"],
69.597 - ["diff", "differentiate_on_R"]) : spec*)
69.598 -writeln (itms2str_ ctxt probl);
69.599 -(*[
69.600 -(1 ,[1] ,true ,#Given ,Cor functionTerm (x ^^^ 2 + x + 1) ,(f_, [x ^^^ 2 + x + 1])),
69.601 -(2 ,[1] ,true ,#Given ,Cor differentiateFor x ,(v_, [x])),
69.602 -(3 ,[1] ,true ,#Find ,Cor derivative f_'_ ,(f_'_, [f_'_]))]*)
69.603 -writeln (itms2str_ ctxt meth);
69.604 -(*[
69.605 -(1 ,[1] ,true ,#Given ,Cor functionTerm (x ^^^ 2 + x + 1) ,(f_, [x ^^^ 2 + x + 1])),
69.606 -(2 ,[1] ,true ,#Given ,Cor differentiateFor x ,(v_, [x])),
69.607 -(3 ,[1] ,true ,#Find ,Cor derivative f_'_ ,(f_'_, [f_'_]))]*)
69.608 -writeln"-----------------------------------------------------------";
69.609 -(*7>*)fetchProposedTactic 1 (*--> Apply_Method*);
69.610 -
69.611 -autoCalculate 1 (Step 1);
69.612 -val ((pt,p),_) = get_calc 1;
69.613 -val Form res = (#1 o pt_extract) (pt, p);
69.614 -if term2str res = "d_d x (x ^^^ 2 + x + 1)" then ()
69.615 -else raise error "diff.sml Diff (x^2 + x + 1, x) from exp";
69.616 -
69.617 -
69.618 -"--------- init_form, start with <NEW> (CAS input) ---------------";
69.619 -"--------- init_form, start with <NEW> (CAS input) ---------------";
69.620 -"--------- init_form, start with <NEW> (CAS input) ---------------";
69.621 -states:=[];
69.622 -CalcTree [([], ("e_domID", ["e_pblID"], ["e_metID"]))];
69.623 -(*[[from sml: > @@@@@begin@@@@@
69.624 -[[from sml: 1
69.625 -[[from sml: <CALCTREE>
69.626 -[[from sml: <CALCID> 1 </CALCID>
69.627 -[[from sml: </CALCTREE>
69.628 -[[from sml: @@@@@end@@@@@*)
69.629 -Iterator 1;
69.630 -(*[[from sml: > @@@@@begin@@@@@
69.631 -[[from sml: 1
69.632 -[[from sml: <ADDUSER>
69.633 -[[from sml: <CALCID> 1 </CALCID>
69.634 -[[from sml: <USERID> 1 </USERID>
69.635 -[[from sml: </ADDUSER>
69.636 -[[from sml: @@@@@end@@@@@*)
69.637 -moveActiveRoot 1;
69.638 -(*[[from sml: > @@@@@begin@@@@@
69.639 -[[from sml: 1
69.640 -[[from sml: <CALCITERATOR>
69.641 -[[from sml: <CALCID> 1 </CALCID>
69.642 -[[from sml: <POSITION>
69.643 -[[from sml: <INTLIST>
69.644 -[[from sml: </INTLIST>
69.645 -[[from sml: <POS> Pbl </POS>
69.646 -[[from sml: </POSITION>
69.647 -[[from sml: </CALCITERATOR>
69.648 -[[from sml: @@@@@end@@@@@*)
69.649 -getFormulaeFromTo 1 ([],Pbl) ([],Pbl) 0 false;
69.650 -(*[[from sml: > @@@@@begin@@@@@ STILL CORRECT
69.651 -[[from sml: 1
69.652 -[[from sml: <GETELEMENTSFROMTO>
69.653 -[[from sml: <CALCID> 1 </CALCID>
69.654 -[[from sml: <FORMHEADS>
69.655 -[[from sml: <CALCFORMULA>
69.656 -[[from sml: <POSITION>
69.657 -[[from sml: <INTLIST>
69.658 -[[from sml: </INTLIST>
69.659 -[[from sml: <POS> Pbl </POS>
69.660 -[[from sml: </POSITION>
69.661 -[[from sml: <FORMULA>
69.662 -[[from sml: <MATHML>
69.663 -[[from sml: <ISA> ________________________________________________ </ISA>
69.664 -[[from sml: </MATHML>
69.665 -[[from sml:
69.666 -[[from sml: </FORMULA>
69.667 -[[from sml: </CALCFORMULA>
69.668 -[[from sml: </FORMHEADS>
69.669 -[[from sml: </GETELEMENTSFROMTO>
69.670 -[[from sml: @@@@@end@@@@@*)
69.671 -refFormula 1 ([],Pbl);
69.672 -(*[[from sml: > @@@@@begin@@@@@ STILL CORRECT
69.673 -[[from sml: 1
69.674 -[[from sml: <REFFORMULA>
69.675 -[[from sml: <CALCID> 1 </CALCID>
69.676 -[[from sml: <CALCHEAD status = "incorrect">
69.677 -[[from sml: <POSITION>
69.678 -[[from sml: <INTLIST>
69.679 -[[from sml: </INTLIST>
69.680 -[[from sml: <POS> Pbl </POS>
69.681 -[[from sml: </POSITION>
69.682 -[[from sml: <HEAD>
69.683 -[[from sml: <MATHML>
69.684 -[[from sml: <ISA> Problem (e_domID, [e_pblID]) </ISA>
69.685 -[[from sml: </MATHML>
69.686 -[[from sml: </HEAD>
69.687 -[[from sml: <MODEL>
69.688 -[[from sml: <GIVEN> </GIVEN>
69.689 -[[from sml: <WHERE> </WHERE>
69.690 -[[from sml: <FIND> </FIND>
69.691 -[[from sml: <RELATE> </RELATE>
69.692 -[[from sml: </MODEL>
69.693 -[[from sml: <BELONGSTO> Pbl </BELONGSTO>
69.694 -[[from sml: <SPECIFICATION>
69.695 -[[from sml: <THEORYID> e_domID </THEORYID>
69.696 -[[from sml: <PROBLEMID>
69.697 -[[from sml: <STRINGLIST>
69.698 -[[from sml: <STRING> e_pblID </STRING>
69.699 -[[from sml: </STRINGLIST>
69.700 -[[from sml: </PROBLEMID>
69.701 -[[from sml: <METHODID>
69.702 -[[from sml: <STRINGLIST>
69.703 -[[from sml: <STRING> e_metID </STRING>
69.704 -[[from sml: </STRINGLIST>
69.705 -[[from sml: </METHODID>
69.706 -[[from sml: </SPECIFICATION>
69.707 -[[from sml: </CALCHEAD>
69.708 -[[from sml: </REFFORMULA>
69.709 -[[from sml: @@@@@end@@@@@*)
69.710 -moveActiveFormula 1 ([],Pbl);
69.711 -(*[[from sml: > @@@@@begin@@@@@
69.712 -[[from sml: 1
69.713 -[[from sml: <CALCITERATOR>
69.714 -[[from sml: <CALCID> 1 </CALCID>
69.715 -[[from sml: <POSITION>
69.716 -[[from sml: <INTLIST>
69.717 -[[from sml: </INTLIST>
69.718 -[[from sml: <POS> Pbl </POS>
69.719 -[[from sml: </POSITION>
69.720 -[[from sml: </CALCITERATOR>
69.721 -[[from sml: @@@@@end@@@@@*)
69.722 -replaceFormula 1 "Simplify (1+2)";
69.723 -(*[[from sml: > @@@@@begin@@@@@
69.724 -[[from sml: 1
69.725 -[[from sml: <REPLACEFORMULA>
69.726 -[[from sml: <CALCID> 1 </CALCID>
69.727 -[[from sml: <CALCCHANGED>
69.728 -[[from sml: <UNCHANGED>
69.729 -[[from sml: <INTLIST>
69.730 -[[from sml: </INTLIST>
69.731 -[[from sml: <POS> Pbl </POS>
69.732 -[[from sml: </UNCHANGED>
69.733 -[[from sml: <DELETED>
69.734 -[[from sml: <INTLIST>
69.735 -[[from sml: </INTLIST>
69.736 -[[from sml: <POS> Pbl </POS>
69.737 -[[from sml: </DELETED>
69.738 -[[from sml: <GENERATED>
69.739 -[[from sml: <INTLIST>
69.740 -[[from sml: </INTLIST>
69.741 -[[from sml: <POS> Met </POS> DIFFERENCE: Pbl
69.742 -[[from sml: </GENERATED>
69.743 -[[from sml: </CALCCHANGED>
69.744 -[[from sml: </REPLACEFORMULA>
69.745 -[[from sml: @@@@@end@@@@@*)
69.746 -getFormulaeFromTo 1 ([],Pbl) ([],Pbl) 0 false(* DIFFERENCE: Pbl*);
69.747 -(*@@@@@begin@@@@@
69.748 - 1
69.749 -<GETELEMENTSFROMTO>
69.750 - <CALCID> 1 </CALCID>
69.751 - <FORMHEADS>
69.752 - <CALCFORMULA>
69.753 - <POSITION>
69.754 - <INTLIST>
69.755 - </INTLIST>
69.756 - <POS> Pbl </POS>
69.757 - </POSITION>
69.758 - <FORMULA>
69.759 - <MATHML>
69.760 - <ISA> Simplify (1 + 2) </ISA> WORKS !!!!!
69.761 - </MATHML>
69.762 - </FORMULA>
69.763 - </CALCFORMULA>
69.764 - </FORMHEADS>
69.765 -</GETELEMENTSFROMTO>
69.766 -@@@@@end@@@@@*)
69.767 -getFormulaeFromTo 1 ([],Pbl) ([],Met) 0 false;
69.768 -(*[[from sml: > @@@@@begin@@@@@
69.769 -[[from sml: 1
69.770 -[[from sml: <SYSERROR>
69.771 -[[from sml: <CALCID> 1 </CALCID>
69.772 -[[from sml: <ERROR> error in getFormulaeFromTo </ERROR>
69.773 -[[from sml: </SYSERROR>
69.774 -[[from sml: @@@@@end@@@@@*)
69.775 -(*step into getFormulaeFromTo --- bug corrected...*)
70.1 --- a/test/Tools/isac/ME/mathengine.sml Mon Aug 30 14:29:49 2010 +0200
70.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
70.3 @@ -1,69 +0,0 @@
70.4 -(* test for sml/ME/mathengine.sml
70.5 - authors: Walther Neuper 2000, 2006
70.6 - (c) due to copyright terms
70.7 -
70.8 -use"../smltest/ME/mathengine.sml";
70.9 -use"mathengine.sml";
70.10 -*)
70.11 -
70.12 -"-----------------------------------------------------------------";
70.13 -"table of contents -----------------------------------------------";
70.14 -"-----------------------------------------------------------------";
70.15 -"----------- debugging setContext..pbl_ --------------------------";
70.16 -"----------- tryrefine -------------------------------------------";
70.17 -"-----------------------------------------------------------------";
70.18 -"-----------------------------------------------------------------";
70.19 -"-----------------------------------------------------------------";
70.20 -
70.21 -
70.22 -
70.23 -"----------- debugging setContext..pbl_ --------------------------";
70.24 -"----------- debugging setContext..pbl_ --------------------------";
70.25 -"----------- debugging setContext..pbl_ --------------------------";
70.26 -states:=[];
70.27 -CalcTree
70.28 -[(["equality (x+1=2)", "solveFor x","solutions L"],
70.29 - ("Test.thy",
70.30 - ["sqroot-test","univariate","equation","test"],
70.31 - ["Test","squ-equ-test-subpbl1"]))];
70.32 -Iterator 1;
70.33 -moveActiveRoot 1; modelProblem 1;
70.34 -
70.35 -val pos as (p,_) = ([],Pbl);
70.36 -val guh = "pbl_equ_univ";
70.37 -checkContext 1 pos guh;
70.38 -val ((pt,_),_) = get_calc 1;
70.39 -val pp = par_pblobj pt p;
70.40 -val keID = guh2kestoreID guh;
70.41 -case context_pbl keID pt pp of (true,["univariate", "equation"],_,_,_)=>()
70.42 -| _ => raise error "mathengine.sml: context_pbl .. pbl_equ_univ checked";
70.43 -
70.44 -case get_obj g_spec pt p of (_, ["e_pblID"], _) => ()
70.45 -| _ => raise error "mathengine.sml: context_pbl .. pbl still empty";
70.46 -setContext 1 pos guh;
70.47 -val ((pt,_),_) = get_calc 1;
70.48 -case get_obj g_spec pt p of (_, ["univariate", "equation"], _) => ()
70.49 -| _ => raise error "mathengine.sml: context_pbl .. pbl set";
70.50 -
70.51 -
70.52 -setContext 1 pos "met_eq_lin";
70.53 -val ((pt,_),_) = get_calc 1;
70.54 -case get_obj g_spec pt p of (_, _, ["LinEq", "solve_lineq_equation"]) => ()
70.55 -| _ => raise error "mathengine.sml: context_pbl .. pbl set";
70.56 -
70.57 -
70.58 -"----------- tryrefine -------------------------------------------";
70.59 -"----------- tryrefine -------------------------------------------";
70.60 -"----------- tryrefine -------------------------------------------";
70.61 -states:=[];
70.62 -CalcTree [(["equality (x/(x^2 - 6*x+9) - 1/(x^2 - 3*x) =1/x)",
70.63 - "solveFor x", "solutions L"],
70.64 - ("RatEq.thy",["univariate","equation"],["no_met"]))];
70.65 -Iterator 1;
70.66 -moveActiveRoot 1; autoCalculate 1 CompleteCalc;
70.67 -
70.68 -refineProblem 1 ([1],Res) "pbl_equ_univ"
70.69 -(*gives "pbl_equ_univ_rat" correct*);
70.70 -
70.71 -refineProblem 1 ([1],Res) (pblID2guh ["linear","univariate","equation"])
70.72 -(*ives "pbl_equ_univ_lin" incorrect*);
71.1 --- a/test/Tools/isac/ME/me.sml Mon Aug 30 14:29:49 2010 +0200
71.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
71.3 @@ -1,528 +0,0 @@
71.4 -(* tests on me.sml
71.5 - author: Walther Neuper
71.6 - 060225,
71.7 - (c) due to copyright terms
71.8 -
71.9 -use"../smltest/ME/me.sml";
71.10 -use"me.sml";
71.11 -*)
71.12 -
71.13 -"-----------------------------------------------------------------";
71.14 -"table of contents -----------------------------------------------";
71.15 -"-----------------------------------------------------------------";
71.16 -"=====new ptree 1: crippled by cut_level_'_ ======================";
71.17 -"-------------- get_interval from ctree with move_dn:modspec.sml -";
71.18 -"=====new ptree 2 without changes ================================";
71.19 -"-------------- getFormulaeFromTo --------------------------------";
71.20 -"autoCalculate";
71.21 -"--------- solve_linear as rootpbl AUTOCALCULATE CompleteModel ---";
71.22 -"--------- solve_linear as rootpbl AUTOCALCULATE CompleteCalcHead-";
71.23 -"--------- maximum-example: complete_metitms ---------------------";
71.24 -"--------- maximum-example: complete_mod -------------------------";
71.25 -"-----------------------------------------------------------------";
71.26 -"-----------------------------------------------------------------";
71.27 -"-----------------------------------------------------------------";
71.28 -
71.29 -
71.30 -
71.31 -"=====new ptree 1: crippled by cut_level_'_ ======================";
71.32 -"=====new ptree 1: crippled by cut_level_'_ ======================";
71.33 -"=====new ptree 1: crippled by cut_level_'_ ======================";
71.34 -states:=[];
71.35 -CalcTree
71.36 -[(["equality (x/(x^2 - 6*x+9) - 1/(x^2 - 3*x) =1/x)",
71.37 - "solveFor x","solutions L"],
71.38 - ("RatEq.thy",["univariate","equation"],["no_met"]))];
71.39 -Iterator 1; moveActiveRoot 1;
71.40 -autoCalculate 1 CompleteCalc;
71.41 -
71.42 -getTactic 1 ([1],Res);(*Rewrite_Set RatEq_simplify*)
71.43 -getTactic 1 ([2],Res);(*Rewrite_Set norm_Rational*)
71.44 -getTactic 1 ([3],Res);(*Rewrite_Set RatEq_eliminate*)
71.45 -getTactic 1 ([4,1],Res);(*Rewrite all_left*)
71.46 -getTactic 1 ([4,2],Res);(*Rewrite_Set expand_binoms*)
71.47 -getTactic 1 ([4,3],Res);(*Rewrite_Set_Inst make_ratpoly_in*)
71.48 -
71.49 -moveActiveFormula 1 ([1],Res)(*1.1...1.4*);
71.50 -moveActiveFormula 1 ([2],Res)(**ME_Isa: 'expand' not known*);
71.51 -moveActiveFormula 1 ([3],Res)(*3.1.*);
71.52 -moveActiveFormula 1 ([4,2],Res)(*4.2.1.*);
71.53 -moveActiveFormula 1 ([4,3],Res)(**one_scr_arg: called by Script Stepwise t_=*);
71.54 -
71.55 -moveActiveFormula 1 ([1],Res)(*1.1...1.4*);
71.56 -interSteps 1 ([1],Res)(*..is activeFormula !?!*);
71.57 -
71.58 -getTactic 1 ([1,1],Res);(*Rewrite real_diff_minus*)
71.59 -getTactic 1 ([1,2],Res);(*Rewrite real_diff_minus*)
71.60 -getTactic 1 ([1,3],Res);(*Rewrite real_diff_minus*)
71.61 -getTactic 1 ([1,4],Res);(*Rewrite real_rat_mult_1*)
71.62 -
71.63 -moveActiveFormula 1 ([4,2],Res)(*4.2.1.*);
71.64 -interSteps 1 ([4,2],Res)(*..is activeFormula !?!*);
71.65 -val ((pt,_),_) = get_calc 1;
71.66 -writeln(pr_ptree pr_short pt);
71.67 -(*delete [4,1] in order to make pos [4],[4,4] for pblobjs differen [4],[4,3]:
71.68 - ###########################################################################*)
71.69 -val (pt, _) = cut_level_'_ [] [] pt ([4,1],Frm); (*#*)
71.70 -(*##########################################################################*)
71.71 -writeln(pr_ptree pr_short pt);
71.72 -(*##########################################################################
71.73 - attention: the ctree in states is still the old (perfect) !!!
71.74 -############################################################################*)
71.75 -
71.76 -
71.77 -
71.78 -"-------------- get_interval from ctree with move_dn:modspec.sml -";
71.79 -"-------------- get_interval from ctree with move_dn:modspec.sml -";
71.80 -"-------------- get_interval from ctree with move_dn:modspec.sml -";
71.81 -writeln(pr_ptree pr_short pt);
71.82 -writeln(posterms2str (get_interval ([],Frm) ([],Res) 99999 pt));
71.83 -
71.84 -case map fst (get_interval ([],Frm) ([],Res) 99999 pt) of
71.85 - [([], Frm),
71.86 - ([1], Frm),
71.87 - ([1, 1], Frm),
71.88 - ([1, 1], Res),
71.89 - ([1, 2], Res),
71.90 - ([1, 3], Res),
71.91 - ([1, 4], Res),
71.92 - ([1], Res),
71.93 - ([2], Res),
71.94 - ([3], Res),
71.95 - ([4], Pbl),
71.96 - ([4, 1], Frm),
71.97 - ([4, 1, 1], Frm),
71.98 - ([4, 1, 1], Res),
71.99 - ([4, 1], Res),
71.100 - ([4, 2], Res),
71.101 - ([4, 3], Pbl),
71.102 - ([4, 3, 1], Frm),
71.103 - ([4, 3, 1], Res),
71.104 - ([4, 3, 2], Res),
71.105 - ([4, 3, 3], Res),
71.106 - ([4, 3, 4], Res),
71.107 - ([4, 3, 5], Res),
71.108 - ([4, 3], Res),
71.109 - ([4], Res),
71.110 - ([5], Res),
71.111 - ([], Res)] => ()
71.112 - | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1f";
71.113 -case map fst (get_interval ([],Frm) ([],Res) 1 pt) of
71.114 - [([], Frm),
71.115 - ([1], Frm),
71.116 - ([1], Res),
71.117 - ([2], Res),
71.118 - ([3], Res),
71.119 - ([4], Pbl),
71.120 - ([4], Res),
71.121 - ([5], Res),
71.122 - ([], Res)] => ()
71.123 - | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1f";
71.124 -case map fst (get_interval ([],Frm) ([],Res) 0 pt) of
71.125 - [([], Frm),
71.126 - ([], Res)] => ()
71.127 - | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1f";
71.128 -
71.129 -case map fst (get_interval ([1,3],Res) ([4,1,1],Frm) 99999 pt) of
71.130 - [([1, 3], Res),
71.131 - ([1, 4], Res),
71.132 - ([1], Res),
71.133 - ([2], Res),
71.134 - ([3], Res),
71.135 - ([4], Pbl),
71.136 - ([4, 1], Frm),
71.137 - ([4, 1, 1], Frm)] => ()
71.138 - | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1a";
71.139 -
71.140 -(*this pos' is not generated bu move_dn:......vvv: goes to end of calc*)
71.141 -case map fst (get_interval ([2],Res) ([4,3,2],Frm) 99999 pt) of
71.142 - [([2], Res),
71.143 - ([3], Res),
71.144 - ([4], Pbl),
71.145 - ([4, 1], Frm),
71.146 - ([4, 1, 1], Frm),
71.147 - ([4, 1, 1], Res),
71.148 - ([4, 1], Res),
71.149 - ([4, 2], Res),
71.150 - ([4, 3], Pbl),
71.151 - ([4, 3, 1], Frm),
71.152 - ([4, 3, 1], Res),
71.153 - ([4, 3, 2], Res),
71.154 - ([4, 3, 3], Res),(*this is beyond 'to'*)
71.155 - ([4, 3, 4], Res),(*this is beyond 'to'*)
71.156 - ([4, 3, 5], Res),(*this is beyond 'to'*)
71.157 - ([4, 3], Res), (*this is beyond 'to'*)
71.158 - ([4], Res), (*this is beyond 'to'*)
71.159 - ([5], Res), (*this is beyond 'to'*)
71.160 - ([], Res)] => () (*this is beyond 'to'*)
71.161 - | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1b";
71.162 -case map fst (get_interval ([1,4],Res) ([4,3,1],Frm) 99999 pt) of
71.163 - [([1, 4], Res),
71.164 - ([1], Res),
71.165 - ([2], Res),
71.166 - ([3], Res),
71.167 - ([4], Pbl),
71.168 - ([4, 1], Frm),
71.169 - ([4, 1, 1], Frm),
71.170 - ([4, 1, 1], Res),
71.171 - ([4, 1], Res),
71.172 - ([4, 2], Res),
71.173 - ([4, 3], Pbl),
71.174 - ([4, 3, 1], Frm)] => ()
71.175 - | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1c";
71.176 -case map fst (get_interval ([4,2],Res) ([5],Res) 99999 pt) of
71.177 - [([4, 2], Res),
71.178 - ([4, 3], Pbl),
71.179 - ([4, 3, 1], Frm),
71.180 - ([4, 3, 1], Res),
71.181 - ([4, 3, 2], Res),
71.182 - ([4, 3, 3], Res),
71.183 - ([4, 3, 4], Res),
71.184 - ([4, 3, 5], Res),
71.185 - ([4, 3], Res),
71.186 - ([4], Res),
71.187 - ([5], Res)]=>()
71.188 - | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1d";
71.189 -case map fst (get_interval ([],Frm) ([4,3,2],Res) 99999 pt) of
71.190 - [([], Frm),
71.191 - ([1], Frm),
71.192 - ([1, 1], Frm),
71.193 - ([1, 1], Res),
71.194 - ([1, 2], Res),
71.195 - ([1, 3], Res),
71.196 - ([1, 4], Res),
71.197 - ([1], Res),
71.198 - ([2], Res),
71.199 - ([3], Res),
71.200 - ([4], Pbl),
71.201 - ([4, 1], Frm),
71.202 - ([4, 1, 1], Frm),
71.203 - ([4, 1, 1], Res),
71.204 - ([4, 1], Res),
71.205 - ([4, 2], Res),
71.206 - ([4, 3], Pbl),
71.207 - ([4, 3, 1], Frm),
71.208 - ([4, 3, 1], Res),
71.209 - ([4, 3, 2], Res)] => ()
71.210 - | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1e";
71.211 -case map fst (get_interval ([4,3],Frm) ([4,3],Res) 99999 pt) of
71.212 - [([4, 3], Frm),
71.213 - ([4, 3, 1], Frm),
71.214 - ([4, 3, 1], Res),
71.215 - ([4, 3, 2], Res),
71.216 - ([4, 3, 3], Res),
71.217 - ([4, 3, 4], Res),
71.218 - ([4, 3, 5], Res),
71.219 - ([4, 3], Res)] => ()
71.220 - | _ => raise error "diff.behav.in ctree.sml: get_interval lev 1g";
71.221 -
71.222 -
71.223 -
71.224 -
71.225 -"=====new ptree 2 without changes ================================";
71.226 -"=====new ptree 2 without changes ================================";
71.227 -"=====new ptree 2 without changes ================================";
71.228 -states:=[];
71.229 -CalcTree
71.230 -[(["equality (x/(x^2 - 6*x+9) - 1/(x^2 - 3*x) =1/x)",
71.231 - "solveFor x","solutions L"],
71.232 - ("RatEq.thy",["univariate","equation"],["no_met"]))];
71.233 -Iterator 1; moveActiveRoot 1;
71.234 -autoCalculate 1 CompleteCalc;
71.235 -val ((pt,_),_) = get_calc 1;
71.236 -writeln(pr_ptree pr_short pt);
71.237 -
71.238 -
71.239 -"-------------- getFormulaeFromTo --------------------------------";
71.240 -"-------------- getFormulaeFromTo --------------------------------";
71.241 -"-------------- getFormulaeFromTo --------------------------------";
71.242 -getFormulaeFromTo 1 ([4, 2], Res) ([4, 4], Pbl) 000;
71.243 -(*
71.244 -"@@@@@begin@@@@@" //...................................................
71.245 -+ " 1" //..............................................................
71.246 -+ "<GETELEMENTSFROMTO>" //...................................................
71.247 -+ " <CALCID> 1 </CALCID>" //..........................................
71.248 -+ " <POSFORMHEADS>" //................................................
71.249 -+ " <POSFORM>" //...................................................
71.250 -+ " <GENERATED>" //...............................................
71.251 -+ " <INTLIST>" //...............................................
71.252 -+ " <INT> 4 </INT>" //........................................
71.253 -+ " <INT> 3 </INT>" //........................................
71.254 -+ " </INTLIST>" //..............................................
71.255 -+ " <POS> Res </POS>" //........................................
71.256 -+ " </GENERATED>" //..............................................
71.257 -+ " <FORMULA>" //.................................................
71.258 -+ " <MATHML>" //................................................
71.259 -+ " <ISA> -6 * x + 5 * x ^^^ 2 = 0 </ISA>" //.................
71.260 -+ " </MATHML>" //...............................................
71.261 -+ " </FORMULA>" //................................................
71.262 -+ " </POSFORM>" //..................................................
71.263 -+ " <POSHEAD>" //...................................................
71.264 -+ " <GENERATED>" //...............................................
71.265 -+ " <INTLIST>" //...............................................
71.266 -+ " <INT> 4 </INT>" //........................................
71.267 -+ " <INT> 4 </INT>" //........................................
71.268 -+ " </INTLIST>" //..............................................
71.269 -+ " <POS> Pbl </POS>" //........................................
71.270 -+ " </GENERATED>" //..............................................
71.271 -+ " <CALCHEAD status = "correct">" //.............................
71.272 -+ " <HEAD>" //...................................................
71.273 -+ " <MATHML>" //...............................................
71.274 -+ " <ISA> solve (-6 * x + 5 * x ^^^ 2 = 0, x) </ISA>" //.....
71.275 -+ " </MATHML>" //..............................................
71.276 -+ " </HEAD>" //..................................................
71.277 -+ " <MODEL>" //.................................................
71.278 -+ " <GIVEN>" //...............................................
71.279 -+ " <ITEM status="correct">" //.............................
71.280 -+ " <MATHML>" //..........................................
71.281 -+ " <ISA> equality (-6 * x + 5 * x ^^^ 2 = 0) </ISA>" //
71.282 -+ " </MATHML>" //.........................................
71.283 -+ " </ITEM>" //.............................................
71.284 -+ " <ITEM status="correct">" //.............................
71.285 -+ " <MATHML>" //..........................................
71.286 -+ " <ISA> solveFor x </ISA>" //.........................
71.287 -+ " </MATHML>" //.........................................
71.288 -+ " </ITEM>" //.............................................
71.289 -+ " </GIVEN>" //..............................................
71.290 -+ " <WHERE>" //...............................................
71.291 -+ " <ITEM status="correct">" //.............................
71.292 -+ " <MATHML>" //..........................................
71.293 -+ " <ISA> matches (?a * ?v_ + ?v_ ^^^ 2 = 0) (-6 * x + 5 * x ^^^ 2 = 0) |"
71.294 -+ "matches (?v_ + ?v_ ^^^ 2 = 0) (-6 * x + 5 * x ^^^ 2 = 0) |" //......
71.295 -+ "matches (?v_ + ?b * ?v_ ^^^ 2 = 0) (-6 * x + 5 * x ^^^ 2 = 0) |"
71.296 -+ "matches (?a * ?v_ + ?b * ?v_ ^^^ 2 = 0) (-6 * x + 5 * x ^^^ 2 = 0) |"
71.297 -+ "matches (?v_ ^^^ 2 = 0) (-6 * x + 5 * x ^^^ 2 = 0) |" //............
71.298 -+ "matches (?b * ?v_ ^^^ 2 = 0) (-6 * x + 5 * x ^^^ 2 = 0) </ISA>" //..
71.299 -+ " </MATHML>" //.........................................
71.300 -+ " </ITEM>" //.............................................
71.301 -+ " </WHERE>" //..............................................
71.302 -+ " <FIND>" //................................................
71.303 -+ " <ITEM status="correct">" //.............................
71.304 -+ " <MATHML>" //..........................................
71.305 -+ " <ISA> solutions x_i </ISA>" //......................
71.306 -+ " </MATHML>" //.........................................
71.307 -+ " </ITEM>" //.............................................
71.308 -+ " </FIND>" //...............................................
71.309 -+ " <RELATE> </RELATE>" //...................................
71.310 -+ " </MODEL>" //................................................
71.311 -+ " <BELONGSTO> Pbl </BELONGSTO>" //............................
71.312 -+ " <SPECIFICATION>" //.........................................
71.313 -+ " <THEORYID> PolyEq.thy </THEORYID>" //.....................
71.314 -+ " <PROBLEMID>" //...........................................
71.315 -+ " <STRINGLIST>" //........................................
71.316 -+ " <STRING> bdv_only </STRING>" //.......................
71.317 -+ " <STRING> degree_2 </STRING>" //.......................
71.318 -+ " <STRING> polynomial </STRING>" //.....................
71.319 -+ " <STRING> univariate </STRING>" //.....................
71.320 -+ " <STRING> equation </STRING>" //.......................
71.321 -+ " </STRINGLIST>" //.......................................
71.322 -+ " </PROBLEMID>" //..........................................
71.323 -+ " <METHODID>" //............................................
71.324 -+ " <STRINGLIST>" //........................................
71.325 -+ " <STRING> PolyEq </STRING>" //.........................
71.326 -+ " <STRING> solve_d2_polyeq_bdvonly_equation </STRING>"
71.327 -+ " </STRINGLIST>" //.......................................
71.328 -+ " </METHODID>" //...........................................
71.329 -+ " </SPECIFICATION>" //........................................
71.330 -+ " </CALCHEAD>" //...............................................
71.331 -+ " </POSHEAD>" //..................................................
71.332 -+ " <POSFORMHEADS>" //................................................
71.333 -+ "</GETELEMENTSFROMTO>" //..................................................
71.334 -+ "@@@@@end@@@@@"
71.335 -*)
71.336 -
71.337 -
71.338 -"--------- solve_linear as rootpbl AUTOCALCULATE CompleteModel ---";
71.339 -"--------- solve_linear as rootpbl AUTOCALCULATE CompleteModel ---";
71.340 -"--------- solve_linear as rootpbl AUTOCALCULATE CompleteModel ---";
71.341 - val c = [];
71.342 - val (p,_,f,nxt,_,pt) = CalcTreeTEST
71.343 - [(["equality (1+-1*2+x=0)", "solveFor x","solutions L"],
71.344 - ("Test.thy",
71.345 - ["linear","univariate","equation","test"],
71.346 - ["Test","solve_linear"]))];
71.347 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
71.348 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
71.349 - (*xt = Add_Given "solveFor x"*)
71.350 - writeln (itms2str_ ctxt (get_obj g_pbl pt (fst p)));
71.351 -(*[
71.352 -(0 ,[] ,false ,#Given ,Inc solveFor ,(??.empty, [])),
71.353 -(0 ,[] ,false ,#Find ,Inc solutions [] ,(??.empty, [])),
71.354 -(1 ,[1] ,true ,#Given ,Cor equality (1 + -1 * 2 + x = 0) ,(e_, [1 + -1 * 2 + x = 0]))]*)
71.355 - val (pt,p) = complete_mod (pt, p);
71.356 - if itms2str_ ctxt (get_obj g_pbl pt (fst p)) = "[\n(1 ,[1] ,true ,#Given ,Cor equality (1 + -1 * 2 + x = 0) ,(e_, [1 + -1 * 2 + x = 0])),\n(2 ,[1] ,true ,#Given ,Cor solveFor x ,(v_, [x])),\n(3 ,[1] ,true ,#Find ,Cor solutions L ,(v_i_, [L]))]" then ()
71.357 - else raise error "completetest.sml: new behav. in complete_mod 1";
71.358 - writeln (itms2str_ ctxt (get_obj g_pbl pt (fst p)));
71.359 -(*[
71.360 -(1 ,[1] ,true ,#Given ,Cor equality (1 + -1 * 2 + x = 0) ,(e_, [1 + -1 * 2 + x = 0])),
71.361 -(2 ,[1] ,true ,#Given ,Cor solveFor x ,(solveFor, [x])),
71.362 -(3 ,[1] ,true ,#Find ,Cor solutions L ,(solutions, [L]))]*)
71.363 - val mits = get_obj g_met pt (fst p);
71.364 - if itms2str_ ctxt mits = "[\n(1 ,[1] ,true ,#Given ,Cor equality (1 + -1 * 2 + x = 0) ,(e_, [1 + -1 * 2 + x = 0])),\n(2 ,[1] ,true ,#Given ,Cor solveFor x ,(v_, [x])),\n(3 ,[1] ,true ,#Find ,Cor solutions L ,(v_i_, [L]))]"
71.365 - then () else raise error "completetest.sml: new behav. in complete_mod 2";
71.366 - writeln (itms2str_ ctxt mits);
71.367 -(*[
71.368 -(1 ,[1] ,true ,#Given ,Cor equality (1 + -1 * 2 + x = 0) ,(e_, [1 + -1 * 2 + x = 0])),
71.369 -(2 ,[1] ,true ,#Given ,Cor solveFor x ,(solveFor, [x])),
71.370 -(3 ,[1] ,true ,#Find ,Cor solutions L ,(solutions, [L]))]*)
71.371 -
71.372 -
71.373 -
71.374 -"--------- solve_linear as rootpbl AUTOCALCULATE CompleteCalcHead-";
71.375 -"--------- solve_linear as rootpbl AUTOCALCULATE CompleteCalcHead-";
71.376 -"--------- solve_linear as rootpbl AUTOCALCULATE CompleteCalcHead-";
71.377 - states:=[];
71.378 - CalcTree (*start of calculation, return No.1*)
71.379 - [(["equality (1+-1*2+x=0)", "solveFor x","solutions L"],
71.380 - ("Test.thy",
71.381 - ["linear","univariate","equation","test"],
71.382 - ["Test","solve_linear"]))];
71.383 - Iterator 1; moveActiveRoot 1;
71.384 -
71.385 -(*
71.386 - autoCalculate 1 CompleteCalcHead;
71.387 - autoCalculate 1 (Step 1);
71.388 - refFormula 1 (get_pos 1 1);
71.389 -
71.390 -... works
71.391 -
71.392 - autoCalculate 1 CompleteCalcHead;
71.393 - fetchProposedTactic 1; (*-> Apply_Method*);
71.394 - setNextTactic 1 (Apply_Method ["Test","solve_linear"]);
71.395 - autoCalculate 1 (Step 1);
71.396 - refFormula 1 (get_pos 1 1);
71.397 -
71.398 -... works *)
71.399 -
71.400 - autoCalculate 1 (Step 1);
71.401 - refFormula 1 (get_pos 1 1);
71.402 -
71.403 - autoCalculate 1 CompleteModel;
71.404 - refFormula 1 (get_pos 1 1);
71.405 -
71.406 - autoCalculate 1 CompleteCalcHead;
71.407 -(* *** complete_mod: only impl.for Pbl, called with ([], Met) FIXXXXXXXXXXME*)
71.408 -
71.409 -
71.410 -
71.411 -"--------- maximum-example: complete_metitms ---------------------";
71.412 -"--------- maximum-example: complete_metitms ---------------------";
71.413 -"--------- maximum-example: complete_metitms ---------------------";
71.414 - val (p,_,f,nxt,_,pt) =
71.415 - CalcTreeTEST
71.416 - [(["fixedValues [r=Arbfix]","maximum A",
71.417 - "valuesFor [a,b]",
71.418 - "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
71.419 - "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
71.420 - "relations [A=a*b, a/2=r*sin alpha, b/2=r*cos alpha]",
71.421 -
71.422 - "boundVariable a","boundVariable b","boundVariable alpha",
71.423 - "interval {x::real. 0 <= x & x <= 2*r}",
71.424 - "interval {x::real. 0 <= x & x <= 2*r}",
71.425 - "interval {x::real. 0 <= x & x <= pi}",
71.426 - "errorBound (eps=(0::real))"],
71.427 - ("DiffApp.thy",["maximum_of","function"],["DiffApp","max_by_calculus"])
71.428 - )];
71.429 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
71.430 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
71.431 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
71.432 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
71.433 - val (p,_,f,nxt,_,pt) = (me nxt p c pt) handle e => print_exn e;
71.434 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
71.435 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
71.436 - (*nxt = Specify_Theory "DiffApp.thy"*)
71.437 - val (oris, _, _) = get_obj g_origin pt (fst p);
71.438 - writeln (oris2str oris);
71.439 -(*[
71.440 -(1, ["1","2","3"], #Given,fixedValues, ["[r = Arbfix]"]),
71.441 -(2, ["1","2","3"], #Find,maximum, ["A"]),
71.442 -(3, ["1","2","3"], #Find,valuesFor, ["[a]","[b]"]),
71.443 -(4, ["1","2"], #Relate,relations, ["[A = a * b]","[(a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]"]),
71.444 -(5, ["3"], #Relate,relations, ["[A = a * b]","[a / 2 = r * sin alpha]","[b / 2 = r * cos alpha]"]),
71.445 -(6, ["1"], #undef,boundVariable, ["a"]),
71.446 -(7, ["2"], #undef,boundVariable, ["b"]),
71.447 -(8, ["3"], #undef,boundVariable, ["alpha"]),
71.448 -(9, ["1","2"], #undef,interval, ["{x. 0 <= x & x <= 2 * r}"]),
71.449 -(10, ["3"], #undef,interval, ["{x. 0 <= x & x <= pi}"]),
71.450 -(11, ["1","2","3"], #undef,errorBound, ["eps = 0"])]*)
71.451 - val pits = get_obj g_pbl pt (fst p);
71.452 - writeln (itms2str_ ctxt pits);
71.453 -(*[
71.454 -(1 ,[1,2,3] ,true,#Given ,Cor fixedValues [r = Arbfix],(fix_, [[r = Arbfix]])),
71.455 -(2 ,[1,2,3] ,true,#Find ,Cor maximum A ,(m_, [A])),
71.456 -(3 ,[1,2,3] ,true,#Find ,Cor valuesFor [a, b] ,(vs_, [[a, b]])),
71.457 -(4 ,[1,2] ,true,#Relate ,Cor relations [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^
71.458 -2 = r ^^^ 2] ,(rs_, [[A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]]))]*)
71.459 - val mits = get_obj g_met pt (fst p);
71.460 - val mits = complete_metitms oris pits []
71.461 - ((#ppc o get_met) ["DiffApp","max_by_calculus"]);
71.462 - writeln (itms2str_ ctxt mits);
71.463 -(*[
71.464 -(1 ,[1,2,3] ,true ,#Given ,Cor fixedValues [r = Arbfix] ,(fix_, [[r = Arbfix]])),
71.465 -(2 ,[1,2,3] ,true ,#Find ,Cor maximum A ,(m_, [A])),
71.466 -(3 ,[1,2,3] ,true ,#Find ,Cor valuesFor [a, b] ,(vs_, [[a, b]])),
71.467 -(4 ,[1,2] ,true ,#Relate ,Cor relations [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^
71.468 -2 = r ^^^ 2] ,(rs_, [[A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]])),
71.469 -(6 ,[1] ,true ,#undef ,Cor boundVariable a ,(boundVariable, [a])),
71.470 -(9 ,[1,2] ,true ,#undef ,Cor interval {x. 0 <= x & x <= 2 * r} ,(interval, [{x.
71.471 -0 <= x & x <= 2 * r}])),
71.472 -(11 ,[1,2,3] ,true ,#undef ,Cor errorBound (eps = 0) ,(errorBound, [eps = 0]))]*)
71.473 - if itms2str_ ctxt mits = "[\n(1 ,[1,2,3] ,true ,#Given ,Cor fixedValues [r = Arbfix] ,(fix_, [[r = Arbfix]])),\n(2 ,[1,2,3] ,true ,#Find ,Cor maximum A ,(m_, [A])),\n(3 ,[1,2,3] ,true ,#Find ,Cor valuesFor [a, b] ,(vs_, [[a, b]])),\n(4 ,[1,2] ,true ,#Relate ,Cor relations [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2] ,(rs_, [[A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]])),\n(6 ,[1] ,true ,#undef ,Cor boundVariable a ,(v_, [a])),\n(9 ,[1,2] ,true ,#undef ,Cor interval {x. 0 <= x & x <= 2 * r} ,(itv_, [{x. 0 <= x & x <= 2 * r}])),\n(11 ,[1,2,3] ,true ,#undef ,Cor errorBound (eps = 0) ,(err_, [eps = 0]))]" then ()
71.474 - else raise error "completetest.sml: new behav. in complete_metitms 1";
71.475 -
71.476 -
71.477 -"--------- maximum-example: complete_mod -------------------------";
71.478 -"--------- maximum-example: complete_mod -------------------------";
71.479 -"--------- maximum-example: complete_mod -------------------------";
71.480 - val (p,_,f,nxt,_,pt) =
71.481 - CalcTreeTEST
71.482 - [(["fixedValues [r=Arbfix]","maximum A",
71.483 - "valuesFor [a,b]",
71.484 - "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
71.485 - "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
71.486 - "relations [A=a*b, a/2=r*sin alpha, b/2=r*cos alpha]",
71.487 -
71.488 - "boundVariable a","boundVariable b","boundVariable alpha",
71.489 - "interval {x::real. 0 <= x & x <= 2*r}",
71.490 - "interval {x::real. 0 <= x & x <= 2*r}",
71.491 - "interval {x::real. 0 <= x & x <= pi}",
71.492 - "errorBound (eps=(0::real))"],
71.493 - ("DiffApp.thy",["maximum_of","function"],["DiffApp","max_by_calculus"])
71.494 - )];
71.495 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
71.496 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
71.497 - val (p,_,f,nxt,_,pt) = me nxt p c pt;
71.498 - (*nxt = nxt = Add_Find "valuesFor [a]" FIXME.12.03 +handle Inc !*)
71.499 - val pits = get_obj g_pbl pt (fst p);
71.500 - writeln (itms2str_ ctxt pits);
71.501 -(*[
71.502 -(0 ,[] ,false ,#Find ,Inc valuesFor ,(??.empty, [])),
71.503 -(0 ,[] ,false ,#Relate ,Inc relations [] ,(??.empty, [])),
71.504 -(1 ,[1,2,3] ,true,#Given,Cor fixedValues [r = Arbfix] ,(fix_, [[r = Arbfix]])),
71.505 -(2 ,[1,2,3] ,true ,#Find ,Cor maximum A ,(m_, [A]))]*)
71.506 - val (pt,p) = complete_mod (pt,p);
71.507 - val pits = get_obj g_pbl pt (fst p);
71.508 - if itms2str_ ctxt pits = "[\n(1 ,[1,2,3] ,true ,#Given ,Cor fixedValues [r = Arbfix] ,(fix_, [[r = Arbfix]])),\n(2 ,[1,2,3] ,true ,#Find ,Cor maximum A ,(m_, [A])),\n(3 ,[1,2,3] ,true ,#Find ,Cor valuesFor [a, b] ,(vs_, [[a],[b]])),\n(4 ,[1,2] ,true ,#Relate ,Cor relations [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2] ,(rs_, [[A = a * b],[(a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]]))]"
71.509 - then () else raise error "completetest.sml: new behav. in complete_mod 3";
71.510 - writeln (itms2str_ ctxt pits);
71.511 -(*[
71.512 -(1 ,[1,2,3] ,true,#Given,Cor fixedValues [r = Arbfix] ,(fix_, [[r = Arbfix]])),
71.513 -(2 ,[1,2,3] ,true ,#Find ,Cor maximum A ,(m_, [A])),
71.514 -(3 ,[1,2,3] ,true ,#Find ,Cor valuesFor [a, b] ,(valuesFor, [[a],[b]])),
71.515 -(4 ,[1,2] ,true ,#Relate ,Cor relations [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^
71.516 -2 = r ^^^ 2] ,(relations, [[A = a * b],[(a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]]))]*)
71.517 - val mits = get_obj g_met pt (fst p);
71.518 - if itms2str_ ctxt mits = "[\n(1 ,[1,2,3] ,true ,#Given ,Cor fixedValues [r = Arbfix] ,(fix_, [[r = Arbfix]])),\n(2 ,[1,2,3] ,true ,#Find ,Cor maximum A ,(m_, [A])),\n(3 ,[1,2,3] ,true ,#Find ,Cor valuesFor [a, b] ,(vs_, [[a],[b]])),\n(4 ,[1,2] ,true ,#Relate ,Cor relations [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2] ,(rs_, [[A = a * b],[(a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]])),\n(6 ,[1] ,true ,#undef ,Cor boundVariable a ,(v_, [a])),\n(9 ,[1,2] ,true ,#undef ,Cor interval {x. 0 <= x & x <= 2 * r} ,(itv_, [{x. 0 <= x & x <= 2 * r}])),\n(11 ,[1,2,3] ,true ,#undef ,Cor errorBound (eps = 0) ,(err_, [eps = 0]))]"
71.519 - then () else raise error "completetest.sml: new behav. in complete_mod 3";
71.520 - writeln (itms2str_ ctxt mits);
71.521 -(*[
71.522 -(1 ,[1,2,3] ,true ,#Given ,Cor fixedValues [r = Arbfix] ,(fix_, [[r = Arbfix]])),
71.523 -(2 ,[1,2,3] ,true ,#Find ,Cor maximum A ,(m_, [A])),
71.524 -(3 ,[1,2,3] ,true ,#Find ,Cor valuesFor [a, b] ,(valuesFor, [[a],[b]])),
71.525 -(4 ,[1,2] ,true ,#Relate ,Cor relations [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^
71.526 -2 = r ^^^ 2] ,(relations, [[A = a * b],[(a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]])),
71.527 -(6 ,[1] ,true ,#undef ,Cor boundVariable a ,(boundVariable, [a])),
71.528 -(9 ,[1,2] ,true ,#undef ,Cor interval {x. 0 <= x & x <= 2 * r} ,(interval, [{x.
71.529 -0 <= x & x <= 2 * r}])),
71.530 -(11 ,[1,2,3] ,true ,#undef ,Cor errorBound (eps = 0) ,(errorBound, [eps = 0]))]*)
71.531 -
72.1 --- a/test/Tools/isac/ME/mstools.sml Mon Aug 30 14:29:49 2010 +0200
72.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
72.3 @@ -1,20 +0,0 @@
72.4 -(* tests on mstools.sml
72.5 - author: Walther Neuper
72.6 - 051019,
72.7 - (c) due to copyright terms
72.8 -
72.9 -use"../smltest/ME/mstools.sml";
72.10 -use"mstools.sml";
72.11 - *)
72.12 -
72.13 -"-----------------------------------------------------------------";
72.14 -"table of contents -----------------------------------------------";
72.15 -"-----------------------------------------------------------------";
72.16 -"--------- head_precond ------------------------------------------";
72.17 -"-----------------------------------------------------------------";
72.18 -
72.19 -
72.20 -
72.21 -"--------- head_precond ------------------------------------------";
72.22 -"--------- head_precond ------------------------------------------";
72.23 -"--------- head_precond ------------------------------------------";
73.1 --- a/test/Tools/isac/ME/ptyps.sml Mon Aug 30 14:29:49 2010 +0200
73.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
73.3 @@ -1,474 +0,0 @@
73.4 -(* tests for ME/ptyps.sml
73.5 - CAUTION: intermediately stores !ptyps THUS EVALUATE IN 1 GO
73.6 - author: Walther Neuper
73.7 - 010916,
73.8 - (c) due to copyright terms
73.9 -
73.10 -use"../smltest/ME/ptyps.sml";
73.11 -use"ptyps.sml";
73.12 -*)
73.13 -
73.14 -"-----------------------------------------------------------------";
73.15 -"table of contents -----------------------------------------------";
73.16 -"-----------------------------------------------------------------";
73.17 -"###### val intermediate_ptyps = !ptyps; #########################";
73.18 -"----------- store test-pbtyps -----------------------------------";
73.19 -"----------- refin test-pbtyps -----------------------------------";
73.20 -"----------- refine_ori test-pbtyps ------------------------------";
73.21 -"----------- refine test-pbtyps ----------------------------------";
73.22 -"###### ptyps:= intermediate_ptyps;###############################";
73.23 -"----------- Refine_Problem (aus subp-rooteq.sml) ----------------";
73.24 -"----------- fun coll_guhs ---------------------------------------";
73.25 -"----------- fun guh2kestoreID -----------------------------------";
73.26 -"-----------------------------------------------------------------";
73.27 -"-----------------------------------------------------------------";
73.28 -"-----------------------------------------------------------------";
73.29 -
73.30 -
73.31 -
73.32 -"###### val intermediate_ptyps = !ptyps; #########################";
73.33 -"###### val intermediate_ptyps = !ptyps; #########################";
73.34 -"###### val intermediate_ptyps = !ptyps; #########################";
73.35 -val intermediate_ptyps = !ptyps;
73.36 -
73.37 -"----------- store test-pbtyps -----------------------------------";
73.38 -"----------- store test-pbtyps -----------------------------------";
73.39 -"----------- store test-pbtyps -----------------------------------";
73.40 -ptyps:= ([]:ptyps);
73.41 -
73.42 -store_pbt
73.43 - (prep_pbt DiffApp.thy "pbl_pbla" [] e_pblID
73.44 - (["pbla"],
73.45 - [("#Given", ["fixedValues a_"])], e_rls, NONE, []));
73.46 -store_pbt
73.47 - (prep_pbt DiffApp.thy "pbl_pbla1" [] e_pblID
73.48 - (["pbla1","pbla"],
73.49 - [("#Given", ["fixedValues a_","maximum a1_"])], e_rls, NONE, []));
73.50 -store_pbt
73.51 - (prep_pbt DiffApp.thy "pbl_pbla2" [] e_pblID
73.52 - (["pbla2","pbla"],
73.53 - [("#Given", ["fixedValues a_","valuesFor a2_"])], e_rls, NONE, []));
73.54 -store_pbt
73.55 - (prep_pbt DiffApp.thy "pbl_pbla2x" [] e_pblID
73.56 - (["pbla2x","pbla2","pbla"],
73.57 - [("#Given", ["fixedValues a_","valuesFor a2_","functionOf a2x_"])],
73.58 - e_rls, NONE, []));
73.59 -store_pbt
73.60 - (prep_pbt DiffApp.thy "pbl_pbla2y" [] e_pblID
73.61 - (["pbla2y","pbla2","pbla"],
73.62 - [("#Given" ,["fixedValues a_","valuesFor a2_","boundVariable a2y_"])],
73.63 - e_rls, NONE, []));
73.64 -store_pbt
73.65 - (prep_pbt DiffApp.thy "pbl_pbla2z" [] e_pblID
73.66 - (["pbla2z","pbla2","pbla"],
73.67 - [("#Given" ,["fixedValues a_","valuesFor a2_","interval a2z_"])],
73.68 - e_rls, NONE, []));
73.69 -store_pbt
73.70 - (prep_pbt DiffApp.thy "pbl_pbla3" [] e_pblID
73.71 - (["pbla3","pbla"],
73.72 - [("#Given" ,["fixedValues a_","relations a3_"])],
73.73 - e_rls, NONE, []));
73.74 -
73.75 -show_ptyps();
73.76 -
73.77 -(*case 1: no refinement *)
73.78 -val thy = Isac.thy;
73.79 -val (d1,ts1) = split_dts thy ((term_of o the o (parse thy))
73.80 - "fixedValues [aaa=0]");
73.81 -val (d2,ts2) = split_dts thy ((term_of o the o (parse thy))
73.82 - "errorBound (ddd=0)");
73.83 -val ori1 = [(1,[1],"#Given",d1,ts1),
73.84 - (2,[1],"#Given",d2,ts2)]:ori list;
73.85 -
73.86 -
73.87 -(*case 2: refined to pbt without children *)
73.88 -val (d2,ts2) = split_dts thy ((term_of o the o (parse thy))
73.89 - "relations [aaa333]");
73.90 -val ori2 = [(1,[1],"#Given",d1,ts1),
73.91 - (2,[1],"#Given",d2,ts2)]:ori list;
73.92 -
73.93 -
73.94 -(*case 3: refined to pbt with children *)
73.95 -val (d2,ts2) = split_dts thy ((term_of o the o (parse thy))
73.96 - "valuesFor [aaa222]");
73.97 -val ori3 = [(1,[1],"#Given",d1,ts1),
73.98 - (2,[1],"#Given",d2,ts2)]:ori list;
73.99 -
73.100 -
73.101 -(*case 4: refined to children (without child)*)
73.102 -val (d3,ts3) = split_dts thy ((term_of o the o (parse thy))
73.103 - "boundVariable aaa222yyy");
73.104 -val ori4 = [(1,[1],"#Given",d1,ts1),
73.105 - (2,[1],"#Given",d2,ts2),
73.106 - (3,[1],"#Given",d3,ts3)]:ori list;
73.107 -
73.108 -"----------- refin test-pbtyps -----------------------------------";
73.109 -"----------- refin test-pbtyps -----------------------------------";
73.110 -"----------- refin test-pbtyps -----------------------------------";
73.111 -(*case 1: no refinement *)
73.112 -refin [] ori1 (hd (!ptyps));
73.113 -(*val it = SOME ["pbla"] : pblID option*)
73.114 -
73.115 -(*case 2: refined to pbt without children *)
73.116 -refin [] ori2 (hd (!ptyps));
73.117 -(*val it = SOME ["pbla","pbla3"] : pblID option*)
73.118 -
73.119 -(*case 3: refined to pbt with children *)
73.120 -refin [] ori3 (hd (!ptyps));
73.121 -(*val it = SOME ["pbla","pbla2"] : pblID option*)
73.122 -
73.123 -(*case 4: refined to children (without child)*)
73.124 -refin [] ori4 (hd (!ptyps));
73.125 -(*val it = SOME ["pbla","pbla2","pbla2y"] : pblID option*)
73.126 -
73.127 -(*case 5: start refinement somewhere in ptyps*)
73.128 -val [Ptyp ("pbla",_,[_, ppp as Ptyp ("pbla2",_,_), _])] = !ptyps;
73.129 -refin ["pbla"] ori4 ppp;
73.130 -(*val it = SOME ["pbla2","pbla2y"] : pblRD option*)
73.131 -
73.132 -
73.133 -"----------- refine_ori test-pbtyps ------------------------------";
73.134 -"----------- refine_ori test-pbtyps ------------------------------";
73.135 -"----------- refine_ori test-pbtyps ------------------------------";
73.136 -(*case 1: no refinement *)
73.137 -refine_ori ori1 ["pbla"];
73.138 -(*val it = NONE : pblID option !!!!*)
73.139 -
73.140 -(*case 2: refined to pbt without children *)
73.141 -refine_ori ori2 ["pbla"];
73.142 -(*val it = SOME ["pbla3","pbla"] : pblID option*)
73.143 -
73.144 -(*case 3: refined to pbt with children *)
73.145 -refine_ori ori3 ["pbla"];
73.146 -(*val it = SOME ["pbla2","pbla"] : pblID option*)
73.147 -
73.148 -(*case 4: refined to children (without child)*)
73.149 -val opt = refine_ori ori4 ["pbla"];
73.150 -if opt = SOME ["pbla2y","pbla2","pbla"] then ()
73.151 -else raise error "new behaviour in refine.sml case 4";
73.152 -
73.153 -(*case 5: start refinement somewhere in ptyps*)
73.154 -refine_ori ori4 ["pbla2","pbla"];
73.155 -(*val it = SOME ["pbla2y","pbla2","pbla"] : pblID option*)
73.156 -
73.157 -
73.158 -"----------- refine test-pbtyps ----------------------------------";
73.159 -"----------- refine test-pbtyps ----------------------------------";
73.160 -"----------- refine test-pbtyps ----------------------------------";
73.161 -val fmz1 = ["fixedValues [aaa=0]","errorBound (ddd=0)"];
73.162 -val fmz2 = ["fixedValues [aaa=0]","relations aaa333"];
73.163 -val fmz3 = ["fixedValues [aaa=0]","valuesFor [aaa222]"];
73.164 -val fmz4 = ["fixedValues [aaa=0]","valuesFor [aaa222]",
73.165 - "boundVariable aaa222yyy"];
73.166 -
73.167 -(*case 1: no refinement *)
73.168 -refine fmz1 ["pbla"];
73.169 -(*
73.170 -*** pass ["pbla"]
73.171 -*** pass ["pbla","pbla1"]
73.172 -*** pass ["pbla","pbla2"]
73.173 -*** pass ["pbla","pbla3"]
73.174 -val it =
73.175 - [Matches
73.176 - (["pbla"],
73.177 - {Find=[],
73.178 - Given=[Correct "fixedValues [aaa = #0]",
73.179 - Superfl "errorBound (ddd = #0)"],Relate=[],Where=[],With=[]}),
73.180 - NoMatch
73.181 - (["pbla1","pbla"],
73.182 - {Find=[],
73.183 - Given=[Correct "fixedValues [aaa = #0]",Missing "maximum a1_",
73.184 - Superfl "errorBound (ddd = #0)"],Relate=[],Where=[],With=[]}),
73.185 - NoMatch
73.186 - (["pbla2","pbla"],
73.187 - {Find=[],
73.188 - Given=[Correct "fixedValues [aaa = #0]",Missing "valuesFor a2_",
73.189 - Superfl "errorBound (ddd = #0)"],Relate=[],Where=[],With=[]}),
73.190 - NoMatch
73.191 - (["pbla3","pbla"],
73.192 - {Find=[],
73.193 - Given=[Correct "fixedValues [aaa = #0]",Missing "relations a3_",
73.194 - Superfl "errorBound (ddd = #0)"],Relate=[],Where=[],With=[]})]
73.195 - : match list*)
73.196 -
73.197 -(*case 2: refined to pbt without children *)
73.198 -refine fmz2 ["pbla"];
73.199 -(*
73.200 -*** pass ["pbla"]
73.201 -*** pass ["pbla","pbla1"]
73.202 -*** pass ["pbla","pbla2"]
73.203 -*** pass ["pbla","pbla3"]
73.204 -val it =
73.205 - [Matches
73.206 - (["pbla"],
73.207 - {Find=[],
73.208 - Given=[Correct "fixedValues [aaa = #0]",Superfl "relations aaa333"],
73.209 - Relate=[],Where=[],With=[]}),
73.210 - NoMatch
73.211 - (["pbla1","pbla"],
73.212 - {Find=[],
73.213 - Given=[Correct "fixedValues [aaa = #0]",Missing "maximum a1_",
73.214 - Superfl "relations aaa333"],Relate=[],Where=[],With=[]}),
73.215 - NoMatch
73.216 - (["pbla2","pbla"],
73.217 - {Find=[],
73.218 - Given=[Correct "fixedValues [aaa = #0]",Missing "valuesFor a2_",
73.219 - Superfl "relations aaa333"],Relate=[],Where=[],With=[]}),
73.220 - Matches
73.221 - (["pbla3","pbla"],
73.222 - {Find=[],
73.223 - Given=[Correct "fixedValues [aaa = #0]",Correct "relations aaa333"],
73.224 - Relate=[],Where=[],With=[]})] : match list*)
73.225 -
73.226 -(*case 3: refined to pbt with children *)
73.227 -refine fmz3 ["pbla"];
73.228 -(*
73.229 -*** pass ["pbla"]
73.230 -*** pass ["pbla","pbla1"]
73.231 -*** pass ["pbla","pbla2"]
73.232 -*** pass ["pbla","pbla2","pbla2x"]
73.233 -*** pass ["pbla","pbla2","pbla2y"]
73.234 -*** pass ["pbla","pbla2","pbla2z"]
73.235 -*** pass ["pbla","pbla3"]
73.236 -val it =
73.237 - [Matches
73.238 - (["pbla"],
73.239 - {Find=[],
73.240 - Given=[Correct "fixedValues [aaa = #0]",Superfl "valuesFor aaa222"],
73.241 - Relate=[],Where=[],With=[]}),
73.242 - NoMatch
73.243 - (["pbla1","pbla"],
73.244 - {Find=[],
73.245 - Given=[Correct "fixedValues [aaa = #0]",Missing "maximum a1_",
73.246 - Superfl "valuesFor aaa222"],Relate=[],Where=[],With=[]}),
73.247 - Matches
73.248 - (["pbla2","pbla"],
73.249 - {Find=[],
73.250 - Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222"],
73.251 - Relate=[],Where=[],With=[]}),
73.252 - NoMatch
73.253 - (["pbla2x","pbla2","pbla"],
73.254 - {Find=[],
73.255 - Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
73.256 - Missing "functionOf a2x_"],Relate=[],Where=[],With=[]}),
73.257 - NoMatch
73.258 - (["pbla2y","pbla2","pbla"],
73.259 - {Find=[],
73.260 - Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
73.261 - Missing "boundVariable a2y_"],Relate=[],Where=[],With=[]}),
73.262 - NoMatch
73.263 - (["pbla2z","pbla2","pbla"],
73.264 - {Find=[],
73.265 - Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
73.266 - Missing "interval a2z_"],Relate=[],Where=[],With=[]}),
73.267 - NoMatch
73.268 - (["pbla3","pbla"],
73.269 - {Find=[],
73.270 - Given=[Correct "fixedValues [aaa = #0]",Missing "relations a3_",
73.271 - Superfl "valuesFor aaa222"],Relate=[],Where=[],With=[]})]
73.272 - : match list*)
73.273 -
73.274 -(*case 4: refined to children (without child)*)
73.275 -refine fmz4 ["pbla"];
73.276 -(*
73.277 -*** pass ["pbla"]
73.278 -*** pass ["pbla","pbla1"]
73.279 -*** pass ["pbla","pbla2"]
73.280 -*** pass ["pbla","pbla2","pbla2x"]
73.281 -*** pass ["pbla","pbla2","pbla2y"]
73.282 -val it =
73.283 - [Matches
73.284 - (["pbla"],
73.285 - {Find=[],
73.286 - Given=[Correct "fixedValues [aaa = #0]",Superfl "valuesFor aaa222",
73.287 - Superfl "boundVariable aaa222yyy"],Relate=[],Where=[],With=[]}),
73.288 - NoMatch
73.289 - (["pbla1","pbla"],
73.290 - {Find=[],
73.291 - Given=[Correct "fixedValues [aaa = #0]",Missing "maximum a1_",
73.292 - Superfl "valuesFor aaa222",Superfl "boundVariable aaa222yyy"],
73.293 - Relate=[],Where=[],With=[]}),
73.294 - Matches
73.295 - (["pbla2","pbla"],
73.296 - {Find=[],
73.297 - Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
73.298 - Superfl "boundVariable aaa222yyy"],Relate=[],Where=[],With=[]}),
73.299 - NoMatch
73.300 - (["pbla2x","pbla2","pbla"],
73.301 - {Find=[],
73.302 - Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
73.303 - Missing "functionOf a2x_",Superfl "boundVariable aaa222yyy"],
73.304 - Relate=[],Where=[],With=[]}),
73.305 - Matches
73.306 - (["pbla2y","pbla2","pbla"],
73.307 - {Find=[],
73.308 - Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
73.309 - Correct "boundVariable aaa222yyy"],Relate=[],Where=[],With=[]})]
73.310 - : match list*)
73.311 -
73.312 -(*case 5: start refinement somewhere in ptyps*)
73.313 -refine fmz4 ["pbla2","pbla"];
73.314 -(*
73.315 -*** pass ["pbla","pbla2"]
73.316 -*** pass ["pbla","pbla2","pbla2x"]
73.317 -*** pass ["pbla","pbla2","pbla2y"]
73.318 -val it =
73.319 - [Matches
73.320 - (["pbla2","pbla"],
73.321 - {Find=[],
73.322 - Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
73.323 - Superfl "boundVariable aaa222yyy"],Relate=[],Where=[],With=[]}),
73.324 - NoMatch
73.325 - (["pbla2x","pbla2","pbla"],
73.326 - {Find=[],
73.327 - Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
73.328 - Missing "functionOf a2x_",Superfl "boundVariable aaa222yyy"],
73.329 - Relate=[],Where=[],With=[]}),
73.330 - Matches
73.331 - (["pbla2y","pbla2","pbla"],
73.332 - {Find=[],
73.333 - Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
73.334 - Correct "boundVariable aaa222yyy"],Relate=[],Where=[],With=[]})]
73.335 - : match list*)
73.336 -
73.337 -"###### ptyps:= intermediate_ptyps;###############################";
73.338 -"###### ptyps:= intermediate_ptyps;###############################";
73.339 -"###### ptyps:= intermediate_ptyps;###############################";
73.340 -ptyps:= intermediate_ptyps;
73.341 -show_ptyps();
73.342 -
73.343 -"----------- Refine_Problem (aus subp-rooteq.sml) ----------------";
73.344 -"----------- Refine_Problem (aus subp-rooteq.sml) ----------------";
73.345 -"----------- Refine_Problem (aus subp-rooteq.sml) ----------------";
73.346 -val fmz = ["equality ((x+1)*(x+2)=x^^^2+8)","solveFor x",
73.347 - "errorBound (eps=0)","solutions L"];
73.348 -val (dI',pI',mI') = ("Test.thy",["sqroot-test","univariate","equation","test"],
73.349 - ["Test","squ-equ-test-subpbl1"]);
73.350 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
73.351 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
73.352 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
73.353 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
73.354 -(*nxt = ("Add_Find", Add_Find "solutions L")*)
73.355 -
73.356 -val nxt = ("Specify_Problem",(*vvvv---specify a not-matching problem*)
73.357 - Specify_Problem ["linear","univariate","equation","test"]);
73.358 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
73.359 -(*ML> f;
73.360 -val it = Form' (PpcKF (0,EdUndef,0,Nundef,
73.361 - (Problem ["linear","univariate","equation","test"],
73.362 - {Find=[Incompl "solutions []"],
73.363 - Given=[Correct "equality ((x + #1) * (x + #2) = x ^^^ #2 + #8)",
73.364 - Correct "solveFor x"],Relate=[],
73.365 - Where=[False "matches (x = #0) ((x + #1) * (x + #2) = x ^^^ #2 + #8)
73.366 - |\nmatches (?b * x = #0) ((x + #1) * (x + #2) = x ^^^ #2 + #8)
73.367 - |\nmatches (?a + x = #0) ((x + #1) * (x + #2) = x ^^^ #2 + #8)
73.368 - |\nmatches (?a + ?b * x = #0) ((x + #1) * (x + #2) = x ^^^ #2 + #8)"],
73.369 - With=[]}))) : mout
73.370 -val nxt = ("Add_Find",Add_Find "solutions L") ????!!!!????*)
73.371 -
73.372 -val (p,_,f,nxt,_,pt) = (me nxt p c pt) handle e => print_exn e;
73.373 -val (p,_,f,nxt,_,pt) = me nxt p c pt(*NEW2*);
73.374 -(*val nxt = ("Empty_Tac",Empty_Tac)
73.375 -... Refine_Problem ["linear"..] fails internally 040312: works!?!*)
73.376 -
73.377 -val nxt = ("Refine_Problem",Refine_Problem ["univariate","equation","test"]);
73.378 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
73.379 -(*("Specify_Problem", Specify_Problem ["normalize", "univariate", ...])*)
73.380 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
73.381 -(*nxt = ("Specify_Theory", Specify_Theory "Test.thy")*)
73.382 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
73.383 -(*nxt = ("Specify_Method", Specify_Method ["Test", "squ-equ-test-subpbl1"]*)
73.384 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
73.385 -(*nxt = ("Apply_Method", *)
73.386 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
73.387 -(*nxt = ("Rewrite_Set", Rewrite_Set "norm_equation")*)
73.388 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
73.389 -(*nxt = ("Rewrite_Set", Rewrite_Set "Test_simplify")*)
73.390 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
73.391 -(*Subproblem ("Test.thy", ["linear", "univariate", "equation", "test"]*)
73.392 -
73.393 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
73.394 -(*nxt = Model_Problem ["linear","univariate","equation","test"]*)
73.395 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
73.396 -(*nxt = ("Add_Given", Add_Given "equality (-6 + 3 * x = 0)"*)
73.397 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
73.398 -(**)
73.399 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
73.400 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
73.401 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
73.402 -(*nxt = Specify_Problem ["linear","univariate","equation","test"])*)
73.403 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
73.404 -(*xt = ("Specify_Method", Specify_Method ["Test", "solve_linear"])*)
73.405 -val nxt = ("Refine_Problem",Refine_Problem ["univariate","equation","test"]);
73.406 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
73.407 -(*("Specify_Problem", Specify_Problem ["linear", "univariate", ...])*)
73.408 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
73.409 -(*val nxt = ("Specify_Method",Specify_Method ("Test","solve_linear"))*)
73.410 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
73.411 -(*val nxt = ("Apply_Method",Apply_Method ("Test","solve_linear"))*)
73.412 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
73.413 -(*val nxt = ("Rewrite_Set_Inst",Rewrite_Set_Inst ([#],"isolate_bdv"))*)
73.414 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
73.415 -(*val nxt = ("Rewrite_Set",Rewrite_Set "Test_simplify")*)
73.416 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
73.417 -(*val nxt = ("Check_Postcond",Check_Postcond ["linear","univariate","eq*)
73.418 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
73.419 -(*val nxt = ("Check_elementwise",Check_elementwise "Assumptions")*)
73.420 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
73.421 -(*Check_Postcond ["normalize","univariate","equation","test"])*)
73.422 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
73.423 -val Form' (FormKF (~1,EdUndef,_,Nundef,res)) = f;
73.424 -if (snd nxt)=End_Proof' andalso res="[x = 2]" then ()
73.425 -else raise error "new behaviour in test:refine.sml:miniscript with mini-subpb";
73.426 -
73.427 -
73.428 -"----------- fun coll_guhs ---------------------------------------";
73.429 -"----------- fun coll_guhs ---------------------------------------";
73.430 -"----------- fun coll_guhs ---------------------------------------";
73.431 -val n = e_pbt;
73.432 -(#guh : pbt -> guh) e_pbt;
73.433 -
73.434 -fun XXXnode coll (Ptyp (_,[n],ns)) =
73.435 - [(#guh : pbt -> guh) n]
73.436 -and XXXnodes coll [] = coll
73.437 - | XXXnodes coll (n::ns : pbt ptyp list) = (XXXnode coll n) @
73.438 - (XXXnodes coll ns);
73.439 -(*^^^ this works, but not this ...
73.440 -fun node coll (Ptyp (_,[n],ns)) =
73.441 - [(#guh : 'a -> guh) n]
73.442 -and nodes coll [] = coll
73.443 - | nodes coll (n::ns : 'a ptyp list) = (node coll n) @ (nodes coll ns);
73.444 -
73.445 -Error:
73.446 -Can't unify {guh: 'a, ...} with 'b (Cannot unify with explicit type variable)
73.447 - Found near #guh : 'a -> guh
73.448 -
73.449 -i.e. there is no common fun for pbls and mets ?!?*)
73.450 -
73.451 -coll_pblguhs (!ptyps);
73.452 -sort string_ord (coll_pblguhs (!ptyps));
73.453 -show_pblguhs ();
73.454 -sort_pblguhs ();
73.455 -
73.456 -"----------- fun guh2kestoreID -----------------------------------";
73.457 -"----------- fun guh2kestoreID -----------------------------------";
73.458 -"----------- fun guh2kestoreID -----------------------------------";
73.459 -"----- we assumed the problem-hierarchy containing 3 elements on toplevel";
73.460 -val (Ptyp (id1,[n1 as {guh=guh1,...} : pbt], ns1)::
73.461 - Ptyp (id2,[n2 as {guh=guh2,...} : pbt], ns2):: _) = (!ptyps);
73.462 -(*
73.463 -nodes [] guh1 (!ptyps);
73.464 -nodes [] guh2 (!ptyps);
73.465 -*)
73.466 -val (Ptyp (id1,[n1 as {guh=guh1,...} : pbt], ns1)
73.467 - ::
73.468 - Ptyp (id2,[n2 as {guh=guh2,...} : pbt],
73.469 - (Ptyp (id21,[n21 as {guh=guh21,...} : pbt], ns21)) :: _ )
73.470 - ::
73.471 - Ptyp (id3,[n3 as {guh=guh3,...} : pbt], ns3)
73.472 - ::
73.473 - _ ) = (!ptyps);
73.474 -(*
73.475 -nodes [] guh3 (!ptyps);
73.476 -nodes [] guh21 (!ptyps);
73.477 -*)
73.478 \ No newline at end of file
74.1 --- a/test/Tools/isac/ME/rewtools.sml Mon Aug 30 14:29:49 2010 +0200
74.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
74.3 @@ -1,533 +0,0 @@
74.4 -(* test for sml/ME/rewtools.sml
74.5 - authors: Walther Neuper 2000, 2006
74.6 - (c) due to copyright terms
74.7 -
74.8 -use"../smltest/ME/rewtools.sml";
74.9 -use"rewtools.sml";
74.10 -*)
74.11 -
74.12 -"-----------------------------------------------------------------";
74.13 -"table of contents -----------------------------------------------";
74.14 -"-----------------------------------------------------------------";
74.15 -"----------- fun collect_isab_thys -------------------------------";
74.16 -"----------- fun thy_containing_thm ------------------------------";
74.17 -"----------- fun thy_containing_rls ------------------------------";
74.18 -"----------- fun thy_containing_cal ------------------------------";
74.19 -"----------- initContext Thy_ Integration-demo -------------------";
74.20 -"----------- initContext..Thy_, fun context_thm ------------------";
74.21 -"----------- initContext..Thy_, fun context_rls ------------------";
74.22 -"----------- checkContext..Thy_, fun context_thy -----------------";
74.23 -"----------- checkContext..Thy_, fun context_rls -----------------";
74.24 -"----------- checkContext..Thy_ on last formula ------------------";
74.25 -"----------- fun guh2theID ---------------------------------------";
74.26 -"----------- debugging on Tests/solve_linear_as_rootpbl ----------";
74.27 -"-----------------------------------------------------------------";
74.28 -"----------- fun string_of_thmI for_[.]_) ------------------------";
74.29 -"----------- (sym_real_minus_eq_cancel, (?b1 = ?a1) ..._[.]_)-----";
74.30 -"-----------------------------------------------------------------";
74.31 -"----------- fun filter_appl_rews --------------------------------";
74.32 -"----------- fun is_contained_in ---------------------------------";
74.33 -"-----------------------------------------------------------------";
74.34 -"-----------------------------------------------------------------";
74.35 -
74.36 -
74.37 -
74.38 -"----------- fun collect_isab_thys -------------------------------";
74.39 -"----------- fun collect_isab_thys -------------------------------";
74.40 -"----------- fun collect_isab_thys -------------------------------";
74.41 -val thy = first_isac_thy (*def. in Script/ListG.ML*);
74.42 -val {ancestors,...} = rep_theory thy;
74.43 -print_depth 99; map string_of_thy ancestors; print_depth 3;
74.44 -length ancestors;
74.45 -val ancestors = (#ancestors o rep_theory) first_isac_thy;
74.46 -length ancestors;
74.47 -print_depth 99; map theory2theory' ancestors; print_depth 3;
74.48 -val isabthms = (flat o (map PureThy.all_thms_of)) ancestors;
74.49 -length isabthms;
74.50 -
74.51 -val isacrules = (flat o (map (thms_of_rls o #2 o #2))) (!ruleset');
74.52 -(*thms from rulesets*)
74.53 -val isacrlsthms = ((map rep_thm_G') o flat o
74.54 - (map (PureThy.all_thms_of_rls o #2 o #2))) (!ruleset');
74.55 -length isacrlsthms;
74.56 -(*takes a few seconds...
74.57 -val isacrlsthms = gen_distinct eq_thmI isacrlsthms;
74.58 -length isacrlsthms;
74.59 -"----- theorems used in isac's rulesets -----vvvvvvvvvvvvvvvvvvvvv";
74.60 -print_depth 99; map #1 isacrlsthms; print_depth 3;
74.61 -"----- theorems used in isac's rulesets -----^^^^^^^^^^^^^^^^^^^^^";
74.62 -...*)
74.63 -
74.64 -(!theory');
74.65 -map #2 (!theory');
74.66 -map (PureThy.all_thms_of o #2) (!theory');
74.67 -val isacthms = (flat o (map (PureThy.all_thms_of o #2))) (!theory');
74.68 -(*takes a few seconds...
74.69 -val rlsthmsNOTisac = gen_diff eq_thmI (isacrlsthms, isacthms);
74.70 -length rlsthmsNOTisac;
74.71 -"----- theorems from rulesets NOT def. in isac -----vvvvvvvvvvvvvv";
74.72 -print_depth 99; map #1 rlsthmsNOTisac; print_depth 3;
74.73 -"----- theorems from rulesets NOT def. in isac -----^^^^^^^^^^^^^^";
74.74 -...*)
74.75 -
74.76 -"----- for 'fun make_isab_thm_thy'";
74.77 -inter eq_thmI isacrlsthms (PureThy.all_thms_of (nth 1 ancestors));
74.78 -inter eq_thmI;
74.79 -(inter eq_thmI);
74.80 -(inter eq_thmI) isacrlsthms;
74.81 -(*takes a few seconds...
74.82 -curry (inter eq_thmI) isacrlsthms (PureThy.all_thms_of (nth 9 ancestors));
74.83 -
74.84 -val thy = (nth 52 ancestors);
74.85 -val sec = ((inter eq_thmI) isacrlsthms o PureThy.all_thms_of) (nth 52 ancestors);
74.86 -length (PureThy.all_thms_of (nth 9 ancestors));
74.87 -length sec;
74.88 -...*)
74.89 -
74.90 -(*takes 1 minute...
74.91 -print_depth 99;
74.92 -map ((inter eq_thmI) rlsthmsNOTisac o PureThy.all_thms_of) ancestors;
74.93 -print_depth 3;
74.94 -*)
74.95 -
74.96 -(*takes some seconds...
74.97 -val isab_thm_thy = (flat o (map (make_isab_thm_thy rlsthmsNOTisac)))
74.98 - ((#ancestors o rep_theory) first_isac_thy);
74.99 -print_depth 99; isab_thm_thy; print_depth 3;
74.100 -*)
74.101 -
74.102 -
74.103 -"----------- fun thy_containing_thm ------------------------------";
74.104 -"----------- fun thy_containing_thm ------------------------------";
74.105 -"----------- fun thy_containing_thm ------------------------------";
74.106 -val (str, (thy', thy)) = ("real_diff_minus",("Root.thy", Root.thy));
74.107 -if thy_contains_thm str ("XXX",thy) then ()
74.108 -else raise error "rewtools.sml: NOT thy_contains_thm \
74.109 - \(real_diff_minus,(Root.thy,.";
74.110 -(rev (!theory'));
74.111 -dropuntil (curry op= thy');
74.112 -dropuntil ((curry op= thy') o (#1:theory' * theory -> theory'));
74.113 -val startsearch = dropuntil ((curry op= thy') o
74.114 - (#1:theory' * theory -> theory'))
74.115 - (rev (!theory'));
74.116 -if thy_containing_thm thy' str = ("IsacKnowledge", "Root.thy") then ()
74.117 -else raise error "rewtools.sml: NOT thy_containin_thm \
74.118 - \(real_diff_minus,(Root.thy,.";
74.119 -
74.120 -"----- search the same theorem somewhere further below in the list";
74.121 -if thy_contains_thm str ("XXX",Poly.thy) then ()
74.122 -else raise error "rewtools.sml: NOT thy_contains_thm \
74.123 - \(real_diff_minus,(Poly.thy,.";
74.124 -if thy_containing_thm "LinEq.thy" str = ("IsacKnowledge", "Poly.thy") then ()
74.125 -else raise error "rewtools.sml: NOT thy_containing_thm \
74.126 - \(real_diff_minus,(Poly.thy,.";
74.127 -
74.128 -"----- second test -------------------------------";
74.129 -show_thes();
74.130 -(*args vor thy_containing_thm...*)
74.131 -val (thy',str) = ("Test.thy", "radd_commute");
74.132 -val startsearch = dropuntil ((curry op= thy') o
74.133 - (#1:theory' * theory -> theory'))
74.134 - (rev (!theory'));
74.135 -length (!theory');
74.136 -length startsearch;
74.137 -if thy_containing_thm thy' str = ("IsacKnowledge", "Test.thy") then ()
74.138 -else raise error "rewtools.sml: diff.behav. in \
74.139 - \thy_containing_thm Test radd_commute";
74.140 -
74.141 -
74.142 -"----------- fun thy_containing_rls ------------------------------";
74.143 -"----------- fun thy_containing_rls ------------------------------";
74.144 -"----------- fun thy_containing_rls ------------------------------";
74.145 -val thy' = "Biegelinie.thy";
74.146 -val dropthys = takewhile [] (not o (curry op= thy') o
74.147 - (#1:theory' * theory -> theory'))
74.148 - (rev (!theory'));
74.149 -if length (!theory') <> length dropthys then ()
74.150 -else raise error "rewtools.sml: diff.behav. in thy_containing_rls 1";
74.151 -val dropthy's = map (get_thy o (#1 : (theory' * theory) -> theory'))
74.152 - dropthys;
74.153 -print_depth 99; dropthy's; print_depth 3;
74.154 -
74.155 -(*WN100819========================================================
74.156 -"Isac" mem dropthy's;
74.157 -op mem ("Isac", dropthy's);
74.158 -(op mem) o swap;
74.159 -((op mem) o swap) (dropthy's, "Isac");
74.160 -curry ((op mem) o swap);
74.161 -curry ((op mem) o swap) dropthy's "Isac";
74.162 -val startsearch = filter_out ((curry ((op mem) o swap) dropthy's) o
74.163 - ((#1 o #2) : rls' * (theory' * rls) -> theory'))
74.164 - (rev (!ruleset'));
74.165 -print_depth 99; map (#1 o #2) startsearch; print_depth 3;
74.166 -if length (!ruleset') <> length startsearch then ()
74.167 -else raise error "rewtools.sml: diff.behav. in thy_containing_rls 2";
74.168 -
74.169 -val rls' = "norm_Poly";
74.170 -case assoc (startsearch, rls') of
74.171 - SOME (thy', _) => thyID2theory' thy'
74.172 - | _ => raise error ("thy_containing_rls : rls '"^str^
74.173 - "' not in !rulset' und thy '"^thy'^"'");
74.174 -
74.175 -if thy_containing_rls thy' rls' = ("IsacKnowledge", "Poly.thy") then ()
74.176 -else raise error "rewtools.sml: diff.behav. in thy_containing_rls 3";
74.177 -
74.178 -
74.179 -"----------- fun thy_containing_cal ------------------------------";
74.180 -"----------- fun thy_containing_cal ------------------------------";
74.181 -"----------- fun thy_containing_cal ------------------------------";
74.182 -val thy' = "Atools.thy";
74.183 -val dropthys = takewhile [] (not o (curry op= thy') o
74.184 - (#1:theory' * theory -> theory'))
74.185 - (rev (!theory'));
74.186 -length dropthys <> length (!theory');
74.187 -val dropthy's = map (get_thy o (#1 : (theory' * theory) -> theory'))
74.188 - dropthys;
74.189 -
74.190 -(rev (!calclist'));
74.191 -map #1 (rev (!calclist'));
74.192 -map (#1 : calc -> string) (rev (!calclist'));
74.193 -val startsearch = filter_out ((curry ((op mem) o swap) dropthy's) o
74.194 - (#1 : calc -> string)) (rev (!calclist'));
74.195 -========================================================WN100819*)
74.196 -
74.197 -"----------- initContext Thy_ Integration-demo -------------------";
74.198 -"----------- initContext Thy_ Integration-demo -------------------";
74.199 -"----------- initContext Thy_ Integration-demo -------------------";
74.200 -states:=[];
74.201 -CalcTree
74.202 -[(["functionTerm (2 * x)","integrateBy x","antiDerivative FF"],
74.203 - ("Integrate.thy",["integrate","function"],
74.204 - ["diff","integration"]))];
74.205 -Iterator 1;
74.206 -moveActiveRoot 1;
74.207 -(*TODO.new_c: cvs before 071227, 11:50------------------
74.208 -autoCalculate 1 CompleteCalc;
74.209 -interSteps 1 ([1],Res);
74.210 -interSteps 1 ([1,1],Res);
74.211 -val ((pt,p),_) = get_calc 1; show_pt pt;
74.212 -if existpt' ([1,1,1], Frm) pt then ()
74.213 -else raise error "integrate.sml: interSteps on Rewrite_Set_Inst 1";
74.214 -
74.215 -initContext 1 Thy_ ([1,1,1], Frm);
74.216 ---------------------TODO.new_c: cvs before 071227, 11:50*)
74.217 -
74.218 -"----------- initContext..Thy_, fun context_thm ------------------";
74.219 -"----------- initContext..Thy_, fun context_thm ------------------";
74.220 -"----------- initContext..Thy_, fun context_thm ------------------";
74.221 -states:=[];
74.222 -CalcTree (*start of calculation, return No.1*)
74.223 -[(["equality (x+1=2)", "solveFor x","solutions L"],
74.224 - ("Test.thy",
74.225 - ["sqroot-test","univariate","equation","test"],
74.226 - ["Test","squ-equ-test-subpbl1"]))];
74.227 -Iterator 1; moveActiveRoot 1;
74.228 -autoCalculate 1 CompleteCalc;
74.229 -
74.230 -"----- no thy-context at result -----";
74.231 -val p = ([], Res);
74.232 -initContext 1 Thy_ p;
74.233 -
74.234 -
74.235 -interSteps 1 ([2], Res);
74.236 -interSteps 1 ([3,1], Res);
74.237 -val ((pt,_),_) = get_calc 1; show_pt pt;
74.238 -
74.239 -val p = ([2,4], Res);
74.240 -val tac = Rewrite ("radd_left_commute","");
74.241 -initContext 1 Thy_ p;
74.242 -(*Res->Res, Rewrite "radd_left_commute 1 + (-2 + x) = 0 -> -2 + (1 + x) = 0
74.243 - --- in initContext..Thy_ ---*)
74.244 -val ContThm {thm,result,...} = context_thy (pt,p) tac;
74.245 -if thm = "thy_isac_Test-thm-radd_left_commute"
74.246 - andalso term2str result = "-2 + (1 + x) = 0" then ()
74.247 -else raise error"rewtools.sml initContext..Th_ thy_Test-thm-radd_left_commute";
74.248 -
74.249 -val p = ([3,1,1], Frm);
74.250 -val tac = Rewrite_Inst (["(bdv, x)"],("risolate_bdv_add",""));
74.251 -initContext 1 Thy_ p;
74.252 -(*Frm->Res, Rewrite_Inst "risolate_bdv_add" -1 + x = 0 -> x = 0 + -1 * -1
74.253 - --- in initContext..Thy_ ---*)
74.254 -val ContThmInst {thm,result,...} = context_thy (pt,p) tac;
74.255 -if thm = "thy_isac_Test-thm-risolate_bdv_add"
74.256 - andalso term2str result = "x = 0 + -1 * -1" then ()
74.257 -else raise error "rewtools.sml initContext..Th_ thy_Test-thm-risolate_bdv_add";
74.258 -
74.259 -initContext 1 Thy_ ([2,5], Res);
74.260 -(*Res->Res, Calculate "plus" -2 + (1 + x) = 0 -> -1 + x = 0
74.261 - --- in initContext..Thy_ ---*)
74.262 -
74.263 -
74.264 -"----------- initContext..Thy_, fun context_rls ------------------";
74.265 -"----------- initContext..Thy_, fun context_rls ------------------";
74.266 -"----------- initContext..Thy_, fun context_rls ------------------";
74.267 -(*using pt from above*)
74.268 -val p = ([1], Res);
74.269 -val tac = Rewrite_Set "Test_simplify";
74.270 -initContext 1 Thy_ p;
74.271 -(*Res->Res, Rewrite_Set "Test_simplify" x + 1 + -1 * 2 = 0 -> -1 + x = 0
74.272 - --- in initContext..Thy_ ---*)
74.273 -val ContRls {rls,result,...} = context_thy (pt,p) tac;
74.274 -if rls = "thy_isac_Test-rls-Test_simplify"
74.275 - andalso term2str result = "-1 + x = 0" then ()
74.276 -else raise error "rewtools.sml initContext..Th_ thy_Test-thm-risolate_bdv_add";
74.277 -
74.278 -val p = ([3,1], Frm);
74.279 -val tac = Rewrite_Set_Inst (["(bdv, x)"],"isolate_bdv");
74.280 -initContext 1 Thy_ p;
74.281 -(*Frm->Res, Rewrite_Set_Inst "isolate_bdv" -1 + x = 0 -> x = 0 + -1 * -1
74.282 - --- in initContext..Thy_ ---*)
74.283 -val ContRlsInst {rls,result,...} = context_thy (pt,p) tac;
74.284 -if rls = "thy_isac_Test-rls-isolate_bdv"
74.285 - andalso term2str result = "x = 0 + -1 * -1" then ()
74.286 -else raise error "rewtools.sml initContext..Th_ thy_Test-thm-risolate_bdv_add";
74.287 -
74.288 -
74.289 -
74.290 -"----------- checkContext..Thy_, fun context_thy -----------------";
74.291 -"----------- checkContext..Thy_, fun context_thy -----------------";
74.292 -"----------- checkContext..Thy_, fun context_thy -----------------";
74.293 -(*using pt from above*)
74.294 -
74.295 -val p = ([2,4], Res);
74.296 -val tac = Rewrite ("radd_left_commute","");
74.297 -checkContext 1 p "thy_Test-thm-radd_left_commute";
74.298 -(* radd_left_commute: 1 + (-2 + x) = 0 -> -2 + (1 + x) = 0
74.299 - --- in checkContext..Thy_ ---*)
74.300 -val ContThm {thm,result,...} = context_thy (pt,p) tac;
74.301 -if thm = "thy_isac_Test-thm-radd_left_commute"
74.302 - andalso term2str result = "-2 + (1 + x) = 0" then ()
74.303 -else raise error "rewtools.sml checkContext.._ thy_Test-thm-radd_left_commute";
74.304 -
74.305 -val p = ([3,1,1], Frm);
74.306 -val tac = Rewrite_Inst (["(bdv,x)"],("risolate_bdv_add",""));
74.307 -checkContext 1 p "thy_Test-thm-risolate_bdv_add";
74.308 -(* risolate_bdv_add: -1 + x = 0 -> x = 0 + -1 * -1
74.309 - --- in checkContext..Thy_ ---*)
74.310 -val ContThmInst {thm,result,...} = context_thy (pt,p) tac;
74.311 -if thm = "thy_isac_Test-thm-risolate_bdv_add"
74.312 - andalso term2str result = "x = 0 + -1 * -1" then ()
74.313 -else raise error "rewtools.sml checkContext..T_ thy_Test-thm-risolate_bdv_add";
74.314 -
74.315 -val p = ([2,5], Res);
74.316 -val tac = Calculate "plus";
74.317 -(*checkContext..Thy_ 1 ([2,5], Res);*)
74.318 -(*FIXXXME #######################vvvvv kestoreID !!!!!!!!!!!!!!!!*)
74.319 -checkContext 1 p ;
74.320 -(* Calculate "plus" -2 + (1 + x) = 0 -> -1 + x = 0
74.321 - --- in checkContext..Thy_ ---*)
74.322 -
74.323 -
74.324 -"----------- checkContext..Thy_, fun context_rls -----------------";
74.325 -"----------- checkContext..Thy_, fun context_rls -----------------";
74.326 -"----------- checkContext..Thy_, fun context_rls -----------------";
74.327 -(*using pt from above*)
74.328 -show_pt pt;
74.329 -
74.330 -val p = ([1], Res);
74.331 -val tac = Rewrite_Set "Test_simplify";
74.332 -checkContext 1 p "thy_isac_Test-rls-Test_simplify";
74.333 -(*Res->Res, Rewrite_Set "Test_simplify" x + 1 + -1 * 2 = 0 -> -1 + x = 0
74.334 - --- in checkContext..Thy_ ---*)
74.335 -val ContRls {rls,result,...} = context_thy (pt,p) tac;
74.336 -if rls = "thy_isac_Test-rls-Test_simplify"
74.337 - andalso term2str result = "-1 + x = 0" then ()
74.338 -else raise error "rewtools.sml checkContext..Thy_ thy_Test-rls-Test_simplify";
74.339 -
74.340 -val p = ([3,1], Frm);
74.341 -val tac = Rewrite_Set_Inst (["(bdv, x)"],"isolate_bdv");
74.342 -checkContext 1 p "thy_Test-rls-isolate_bdv";
74.343 -val ContRlsInst {rls,result,...} = context_thy (pt,p) tac;
74.344 -if rls = "thy_isac_Test-rls-isolate_bdv"
74.345 - andalso term2str result = "x = 0 + -1 * -1" then ()
74.346 -else raise error "rewtools.sml checkContext..Thy_ thy_Test-thm-isolate_bdv";
74.347 -
74.348 -
74.349 -"----------- checkContext..Thy_ on last formula ------------------";
74.350 -"----------- checkContext..Thy_ on last formula ------------------";
74.351 -"----------- checkContext..Thy_ on last formula ------------------";
74.352 -states:=[];
74.353 -CalcTree (*start of calculation, return No.1*)
74.354 -[(["equality (x+1=2)", "solveFor x","solutions L"],
74.355 - ("Test.thy",
74.356 - ["sqroot-test","univariate","equation","test"],
74.357 - ["Test","squ-equ-test-subpbl1"]))];
74.358 -Iterator 1; moveActiveRoot 1;
74.359 -
74.360 -autoCalculate 1 CompleteCalcHead;
74.361 -autoCalculate 1 (Step 1);
74.362 -val (ptp as (pt,p), tacis) = get_calc 1; show_pt pt;
74.363 -initContext 1 Thy_ ([1], Frm);
74.364 -checkContext 1 ([1], Frm) "thy_isac_Test-thm-radd_left_commute";
74.365 -
74.366 -autoCalculate 1 (Step 1);
74.367 -val (ptp as (pt,p), tacis) = get_calc 1; show_pt pt;
74.368 -initContext 1 Thy_ ([1], Res);
74.369 -checkContext 1 ([1], Res) "thy_isac_Test-rls-Test_simplify";
74.370 -
74.371 -
74.372 -
74.373 -"----------- fun guh2theID ---------------------------------------";
74.374 -"----------- fun guh2theID ---------------------------------------";
74.375 -"----------- fun guh2theID ---------------------------------------";
74.376 -val guh = "thy_scri_ListG-thm-zip_Nil";
74.377 -
74.378 -take_fromto 1 4 (explode guh);
74.379 -take_fromto 5 9 (explode guh);
74.380 -val rest = takerest (9,(explode guh));
74.381 -
74.382 -separate "-" rest;
74.383 -space_implode "-" rest;
74.384 -commas rest;
74.385 -
74.386 -val delim = "-";
74.387 -val thyID = takewhile [] (not o (curry op= delim)) rest;
74.388 -val rest' = dropuntil (curry op= delim) rest;
74.389 -val setc = take_fromto 1 5 rest';
74.390 -val xstr = takerest (5, rest');
74.391 -
74.392 -if guh2theID guh = ["IsacScripts", "ListG", "Theorems", "zip_Nil"] then ()
74.393 -else raise error "rewtools.sml: guh2theID thy_scri_ListG-thm-zip_Nil changed";
74.394 -
74.395 -
74.396 -"----------- debugging on Tests/solve_linear_as_rootpbl ----------";
74.397 -"----------- debugging on Tests/solve_linear_as_rootpbl ----------";
74.398 -"----------- debugging on Tests/solve_linear_as_rootpbl ----------";
74.399 -"----- initContext -----";
74.400 -states:=[];
74.401 -CalcTree
74.402 - [(["equality (1+-1*2+x=0)", "solveFor x", "solutions L"],
74.403 - ("Test.thy",
74.404 - ["linear","univariate","equation","test"],
74.405 - ["Test","solve_linear"]))];
74.406 -Iterator 1; moveActiveRoot 1;
74.407 -autoCalculate 1 CompleteCalcHead;
74.408 -
74.409 -autoCalculate 1 (Step 1); val (ptp as (pt,p), tacis) = get_calc 1; show_pt pt;
74.410 -if is_curr_endof_calc pt ([1],Frm) then ()
74.411 -else raise error "rewtools.sml is_curr_endof_calc ([1],Frm)";
74.412 -
74.413 -autoCalculate 1 (Step 1); val (ptp as (pt,p), tacis) = get_calc 1; show_pt pt;
74.414 -if not (is_curr_endof_calc pt ([1],Frm)) then ()
74.415 -else raise error "rewtools.sml is_curr_endof_calc ([1],Frm) not";
74.416 -if is_curr_endof_calc pt ([1],Res) then ()
74.417 -else raise error "rewtools.sml is_curr_endof_calc ([1],Res)";
74.418 -
74.419 -initContext 1 Thy_ ([1],Res);
74.420 -
74.421 -"----- checkContext -----";
74.422 -states:=[];
74.423 -CalcTree
74.424 - [(["equality (1+-1*2+x=0)", "solveFor x", "solutions L"],
74.425 - ("Test.thy",
74.426 - ["linear","univariate","equation","test"],
74.427 - ["Test","solve_linear"]))];
74.428 -Iterator 1; moveActiveRoot 1;
74.429 -autoCalculate 1 CompleteCalc;
74.430 -interSteps 1 ([1],Res);
74.431 -val (ptp as (pt,p), tacis) = get_calc 1; show_pt pt;
74.432 -
74.433 -checkContext 1 ([1],Res) "thy_isac_Test-rls-Test_simplify";
74.434 -
74.435 -interSteps 1 ([2],Res);
74.436 -val (ptp as (pt,p), tacis) = get_calc 1; show_pt pt;
74.437 -
74.438 -checkContext 1 ([2,1],Res) "thy_isac_Test-rls-Test_simplify";
74.439 -checkContext 1 ([2,2],Res) "thy_isac_Test-rls-Test_simplify";
74.440 -
74.441 -
74.442 -"----------- fun string_of_thmI for_[.]_) ------------------------";
74.443 -"----------- fun string_of_thmI for_[.]_) ------------------------";
74.444 -"----------- fun string_of_thmI for_[.]_) ------------------------";
74.445 -"----- these work ?!?";
74.446 -val th = sym_thm real_minus_eq_cancel;
74.447 -val Th = sym_Thm (Thm ("real_minus_eq_cancel", real_minus_eq_cancel));
74.448 -val th'= mk_thm Isac.thy ((de_quote o string_of_thm) real_minus_eq_cancel);
74.449 -val th'= mk_thm Biegelinie.thy((de_quote o string_of_thm)real_minus_eq_cancel);
74.450 -
74.451 -"----- DIFFERENCE TO ABOVE ?!?: this is still ok, when called in next_tac...";
74.452 -val ((pt,(p,p_)), _) = get_calc 1; show_pt pt;
74.453 -val Appl (Rewrite' (_,_,_,_,thm',_,_)) =
74.454 - applicable_in (p,p_) pt (Rewrite ("sym_real_minus_eq_cancel",""));
74.455 -"- compose stac as done in | appy (*leaf*) by handle_leaf";
74.456 -val (th, sr, E, a, v, t) =
74.457 - ("Biegelinie.thy",
74.458 - (#srls o get_met) ["IntegrierenUndKonstanteBestimmen"],
74.459 - [(str2term "q__::bool", str2term "q x = q_0")],
74.460 - SOME (str2term "q x = q_0"),
74.461 - str2term "q__::bool",
74.462 - str2term "(Rewrite sym_real_minus_eq_cancel False) (q__::bool)");
74.463 -val (a', STac stac) = handle_leaf "next " th sr E a v t;
74.464 -term2str stac;
74.465 -"--- but this \"m\" is already corrupted";
74.466 -val (m,_) = stac2tac_ EmptyPtree (assoc_thy th) stac;
74.467 -"- because in assoc_thm'...";
74.468 -val (thy, (thmid, ct')) = (Biegelinie.thy, ("sym_real_minus_eq_cancel",""));
74.469 -val "s"::"y"::"m"::"_"::id = explode thmid;
74.470 -((num_str o (get_thm thy)) (implode id)) RS sym;
74.471 -((get_thm thy) (implode id)) RS sym;
74.472 -"... this creates [.]";
74.473 -((get_thm thy) (implode id));
74.474 -"... while this has _NO_ [.]";
74.475 -
74.476 -"----- thus we repair the [.] in string_of_thmI...";
74.477 -val thm = ((num_str o (get_thm thy)) (implode id)) RS sym;
74.478 -if string_of_thmI thm = "(?b1 = ?a1) = (- ?b1 = - ?a1)" then ()
74.479 -else raise error ("rewtools.sml: string_of_thmI " ^ string_of_thm thm ^
74.480 - " = " ^ string_of_thmI thm);
74.481 -
74.482 -
74.483 -"----------- (sym_real_minus_eq_cancel, (?b1 = ?a1) ..._[.]_)-----";
74.484 -"----------- (sym_real_minus_eq_cancel, (?b1 = ?a1) ..._[.]_)-----";
74.485 -"----------- (sym_real_minus_eq_cancel, (?b1 = ?a1) ..._[.]_)-----";
74.486 -states:=[];
74.487 -CalcTree [(["Traegerlaenge L","Streckenlast q_0","Biegelinie y",
74.488 - "RandbedingungenBiegung [y 0 = 0, y L = 0]",
74.489 - "RandbedingungenMoment [M_b 0 = 0, M_b L = 0]",
74.490 - "FunktionsVariable x"],
74.491 - ("Biegelinie.thy",
74.492 - ["MomentBestimmte","Biegelinien"],
74.493 - ["IntegrierenUndKonstanteBestimmen"]))];
74.494 -moveActiveRoot 1;
74.495 -autoCalculate 1 CompleteCalcHead;
74.496 -autoCalculate 1 (Step 1) (*Apply_Method*);
74.497 -autoCalculate 1 (Step 1) (*->GENERATED ([1], Frm)*);
74.498 -"--- this was corrupted before 'fun string_of_thmI'";
74.499 -val ((pt,(p,p_)), _) = get_calc 1; show_pt pt;
74.500 -if get_obj g_tac pt p = Rewrite ("sym_real_minus_eq_cancel",
74.501 - "(?b1 = ?a1) = (- ?b1 = - ?a1)") then ()
74.502 -else raise error "rewtools.sml: string_of_thmI ?!?";
74.503 -
74.504 -getTactic 1 ([1],Frm);
74.505 -
74.506 -"----------- fun filter_appl_rews --------------------------------";
74.507 -"----------- fun filter_appl_rews --------------------------------";
74.508 -"----------- fun filter_appl_rews --------------------------------";
74.509 -val f = str2term "a + z + 2*a + 3*z + 5 + 6";
74.510 -val thy = assoc_thy "Isac.thy";
74.511 -val subst = [(*TODO.WN071231 test Rewrite_Inst*)];
74.512 -val rls = Test_simplify;
74.513 -(* val rls = rls_p_33; filter_appl_rews ---> length 2
74.514 - val rls = norm_Poly; filter_appl_rews ---> length 1
74.515 - *)
74.516 -if filter_appl_rews thy subst f rls =
74.517 - [Rewrite ("radd_commute", "?m + ?n = ?n + ?m"),
74.518 - Rewrite ("radd_assoc", "?m + ?n + ?k = ?m + (?n + ?k)"),
74.519 - Calculate "plus"] then ()
74.520 -else raise error "rewtools.sml filter_appl_rews a + z + 2*a + 3*z + 5 + 6";
74.521 -
74.522 -
74.523 -"----------- fun is_contained_in ---------------------------------";
74.524 -"----------- fun is_contained_in ---------------------------------";
74.525 -"----------- fun is_contained_in ---------------------------------";
74.526 -val r1 = Thm ("real_diff_minus",num_str real_diff_minus);
74.527 -if contains_rule r1 Test_simplify then ()
74.528 -else raise error "rewtools.sml contains_rule Thm";
74.529 -
74.530 -val r1 = Calc ("op +", eval_binop "#add_");
74.531 -if contains_rule r1 Test_simplify then ()
74.532 -else raise error "rewtools.sml contains_rule Calc";
74.533 -
74.534 -val r1 = Calc ("op -", eval_binop "#add_");
74.535 -if not (contains_rule r1 Test_simplify) then ()
74.536 -else raise error "rewtools.sml contains_rule Calc";
75.1 --- a/test/Tools/isac/ME/script.sml Mon Aug 30 14:29:49 2010 +0200
75.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
75.3 @@ -1,250 +0,0 @@
75.4 -(* tests for ME/script.sml
75.5 - TODO.WN0509 collect typical tests from systest here !!!!!
75.6 - author: Walther Neuper 050908
75.7 - (c) copyright due to lincense terms.
75.8 -
75.9 -use"../smltest/ME/script.sml";
75.10 -use"script.sml";
75.11 -*)
75.12 -"-----------------------------------------------------------------";
75.13 -"table of contents -----------------------------------------------";
75.14 -"-----------------------------------------------------------------";
75.15 -"----------- WN0509 why does next_tac doesnt find Substitute -----";
75.16 -"----------- WN0509 Substitute 2nd part --------------------------";
75.17 -"----------- fun sel_appl_atomic_tacs ----------------------------";
75.18 -"-----------------------------------------------------------------";
75.19 -"-----------------------------------------------------------------";
75.20 -"-----------------------------------------------------------------";
75.21 -
75.22 -
75.23 -"----------- WN0509 why does next_tac doesnt find Substitute -----";
75.24 -"----------- WN0509 why does next_tac doesnt find Substitute -----";
75.25 -"----------- WN0509 why does next_tac doesnt find Substitute -----";
75.26 -
75.27 -(*replace met 'IntegrierenUndKonstanteBestimmen' with this script...*)
75.28 -val str = (*#1#*)
75.29 -"Script BiegelinieScript \
75.30 -\(l_::real) (q__::real) (v_::real) (b_::real=>real) \
75.31 -\(rb_::bool list) (rm_::bool list) = \
75.32 -\ (let q___ = Take (M_b v_ = q__); \
75.33 -\ (M1__::bool) = ((Substitute [v_ = 0])) q___ \
75.34 -\ in True)";
75.35 -val sc' = ((inst_abs thy) o term_of o the o (parse thy)) str;
75.36 -
75.37 -val str = (*#2#*)
75.38 -"Script BiegelinieScript \
75.39 -\(l_::real) (q__::real) (v_::real) (b_::real=>real) \
75.40 -\(rb_::bool list) (rm_::bool list) = \
75.41 -\ (let q___ = Take (q_ v_ = q__); \
75.42 -\ (M1__::bool) = ((Substitute [v_ = 0]) @@ \
75.43 -\ (Substitute [M_b 0 = 0])) q___ \
75.44 -\ in True)";(*..doesnt find Substitute with ..@@ !!!!!!!!!!!!!!!!!!!!!*)
75.45 -
75.46 -val str = (*#3#*)
75.47 -"Script BiegelinieScript \
75.48 -\(l_::real) (q__::real) (v_::real) (b_::real=>real) \
75.49 -\(rb_::bool list) (rm_::bool list) = \
75.50 -\ (let q___ = Take (q_ v_ = q__); \
75.51 -\ (M1__::bool) = Substitute [v_ = 0] q___ ; \
75.52 -\ M1__ = Substitute [M_b 0 = 0] M1__ \
75.53 -\ in True)"
75.54 -;
75.55 -val str = (*#4#*)
75.56 -"Script BiegelinieScript \
75.57 -\(l_::real) (q__::real) (v_::real) (b_::real=>real) \
75.58 -\(rb_::bool list) (rm_::bool list) = \
75.59 -\ (let q___ = Take (q_ v_ = q__); \
75.60 -\ (M1__::bool) = Substitute [v_ = 0] q___ ; \
75.61 -\ M1__ = Substitute [v_ = 1] q___ ; \
75.62 -\ M1__ = Substitute [v_ = 2] q___ ; \
75.63 -\ M1__ = Substitute [v_ = 3] q___ ; \
75.64 -\ M1__ = Substitute [M_b 0 = 0] M1__ \
75.65 -\ in True)"
75.66 -;
75.67 -val str = (*#5#*)
75.68 -"Script BiegelinieScript \
75.69 -\(l_::real) (q__::real) (v_::real) (b_::real=>real) \
75.70 -\(rb_::bool list) (rm_::bool list) = \
75.71 -\ (let q___ = Take (M_b v_ = q__); \
75.72 -\ (M1__::bool) = Substitute [v_ = 0] q___ ; \
75.73 -\ M2__ = Take q___ ; \
75.74 -\ M2__ = Substitute [v_ = 2] q___ \
75.75 -\ in True)"
75.76 -;
75.77 -val sc' = ((inst_abs thy) o term_of o the o (parse thy)) str;
75.78 -atomty sc';
75.79 -val {scr=Script sc,...} = get_met ["IntegrierenUndKonstanteBestimmen"];
75.80 -(*---------------------------------------------------------------------
75.81 -if sc = sc' then () else raise error"script.sml, doesnt find Substitute #1";
75.82 ----------------------------------------------------------------------*)
75.83 -
75.84 -val fmz = ["Traegerlaenge L",
75.85 - "Streckenlast (- q_0 * x^^^2 / 2 + x * c + c_2)",
75.86 - "Biegelinie y",
75.87 - "RandbedingungenBiegung [y 0 = 0, y L = 0]",
75.88 - "RandbedingungenMoment [M_b 0 = 0, M_b L = 0]",
75.89 - "FunktionsVariable x"];
75.90 -val (dI',pI',mI') =
75.91 - ("Biegelinie.thy",["MomentBestimmte","Biegelinien"],
75.92 - ["IntegrierenUndKonstanteBestimmen"]);
75.93 -val p = e_pos'; val c = [];
75.94 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
75.95 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
75.96 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
75.97 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
75.98 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
75.99 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
75.100 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
75.101 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
75.102 -case nxt of (_, Apply_Method ["IntegrierenUndKonstanteBestimmen"]) => ()
75.103 - | _ => raise error "script.sml, doesnt find Substitute #2";
75.104 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
75.105 -(* *** generate1: not impl.for Substitute' !!!!!!!!!!(*#1#*)!!!!!!!!!!!*)
75.106 -(* val nxt = ("Check_Postcond",.. !!!!!!!!!!!!!!!!!!!(*#2#*)!!!!!!!!!!!*)
75.107 -
75.108 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
75.109 -(* *** generate1: not impl.for Empty_Tac_ !!!!!!!!!!(*#3#*)!!!!!!!!!!!*)
75.110 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
75.111 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
75.112 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
75.113 -(*---------------------------------------------------------------------*)
75.114 -case nxt of (_, End_Proof') => ()
75.115 - | _ => raise error "script.sml, doesnt find Substitute #3";
75.116 -(*---------------------------------------------------------------------*)
75.117 -(*the reason, that next_tac didnt find the 2nd Substitute, was that
75.118 - the Take inbetween was missing, and thus the 2nd Substitute was applied
75.119 - the last formula in ctree, and not to argument from script*)
75.120 -
75.121 -
75.122 -"----------- WN0509 Substitute 2nd part --------------------------";
75.123 -"----------- WN0509 Substitute 2nd part --------------------------";
75.124 -"----------- WN0509 Substitute 2nd part --------------------------";
75.125 -(*replace met 'IntegrierenUndKonstanteBestimmen' with this script...*)
75.126 -val str = (*Substitute ; Substitute works*)
75.127 -"Script BiegelinieScript \
75.128 -\(l_::real) (q__::real) (v_::real) (b_::real=>real) \
75.129 -\(rb_::bool list) (rm_::bool list) = "^
75.130 -(*begin after the 2nd integrate*)
75.131 -" (let M__ = Take (M_b v_ = q__); \
75.132 -\ e1__ = nth_ 1 rm_ ; \
75.133 -\ (x1__::real) = argument_in (lhs e1__); \
75.134 -\ (M1__::bool) = Substitute [v_ = x1__] M__; \
75.135 -\ M1__ = Substitute [e1__] M1__ \
75.136 -\ in True)"
75.137 -;
75.138 -(*---^^^-OK-----------------------------------------------------------------*)
75.139 -val sc' = ((inst_abs thy) o term_of o the o (parse thy)) str;
75.140 -atomty sc';
75.141 -(*---vvv-NOT ok-------------------------------------------------------------*)
75.142 -val str = (*Substitute @@ Substitute does NOT work???*)
75.143 -"Script BiegelinieScript \
75.144 -\(l_::real) (q__::real) (v_::real) (b_::real=>real) \
75.145 -\(rb_::bool list) (rm_::bool list) = "^
75.146 -(*begin after the 2nd integrate*)
75.147 -" (let M__ = Take (M_b v_ = q__); \
75.148 -\ e1__ = nth_ 1 rm_ ; \
75.149 -\ (x1__::real) = argument_in (lhs e1__); \
75.150 -\ (M1__::bool) = ((Substitute [v_ = x1__]) @@ \
75.151 -\ (Substitute [e1__])) M__ \
75.152 -\ in True)"
75.153 -;
75.154 -
75.155 -val {scr=Script sc,...} = get_met ["IntegrierenUndKonstanteBestimmen"];
75.156 -(*---------------------------------------------------------------------
75.157 -if sc = sc' then () else raise error"script.sml, doesnt find Substitute #1";
75.158 ----------------------------------------------------------------------*)
75.159 -val fmz = ["Traegerlaenge L",
75.160 - "Streckenlast (- q_0 * x^^^2 / 2 + x * c + c_2)",
75.161 - "Biegelinie y",
75.162 - "RandbedingungenBiegung [y 0 = 0, y L = 0]",
75.163 - "RandbedingungenMoment [M_b 0 = 0, M_b L = 0]",
75.164 - "FunktionsVariable x"];
75.165 -val (dI',pI',mI') =
75.166 - ("Biegelinie.thy",["MomentBestimmte","Biegelinien"],
75.167 - ["IntegrierenUndKonstanteBestimmen"]);
75.168 -val p = e_pos'; val c = [];
75.169 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
75.170 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
75.171 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
75.172 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
75.173 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
75.174 -val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
75.175 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
75.176 -val (p,_,f,nxt,_,pt) = me nxt p c pt;
75.177 -case nxt of (_, Apply_Method ["IntegrierenUndKonstanteBestimmen"]) => ()
75.178 - | _ => raise error "script.sml, doesnt find Substitute #2";
75.179 -trace_rewrite:=true;
75.180 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f(*------------------------*);
75.181 -trace_rewrite:=false;
75.182 -(*Exception TYPE raised:
75.183 -Illegal type for constant "op =" :: "[real, bool] => bool"
75.184 -Atools.argument'_in (Tools.lhs (ListG.nth_ (1 + -1 + -1) [])) =
75.185 -ListG.nth_ (1 + -1 + -1) []
75.186 -Exception-
75.187 - TYPE
75.188 - ("Illegal type for constant \"op =\" :: \"[real, bool] => bool\"",
75.189 - [],
75.190 - [Const ("Trueprop", "bool => prop") $
75.191 - (Const ("op =", "[RealDef.real, bool] => bool") $ ... $ ...)])
75.192 - raised
75.193 -... this was because eval_argument_in took "argument_in (lhs (M_b 0 = 0))"
75.194 -ie. the argument had not been simplified before ^^^^^^^^^^^^^^^
75.195 -thus corrected eval_argument_in OK*)
75.196 -
75.197 -val {srls,...} = get_met ["IntegrierenUndKonstanteBestimmen"];
75.198 -val e1__ = str2term"nth_ 1 [M_b 0 = 0, M_b L = 0]";
75.199 -val e1__ = eval_listexpr_ Biegelinie.thy srls e1__; term2str e1__;
75.200 -if term2str e1__ = "M_b 0 = 0" then () else
75.201 -raise error"script.sml diff.beh. eval_listexpr_ nth_ 1 [...";
75.202 -
75.203 -(*TODO.WN050913 ??? doesnt eval_listexpr_ go into subterms ???...
75.204 -val x1__ = str2term"argument_in (lhs (M_b 0 = 0))";
75.205 -val x1__ = eval_listexpr_ Biegelinie.thy srls x1__; term2str x1__;
75.206 -(*no rewrite*)
75.207 -calculate_ Biegelinie.thy ("Tools.lhs", eval_rhs"eval_lhs_") x1__;
75.208 -val SOME (str, t) = eval_lhs 0 "Tools.lhs" (str2term"lhs (M_b 0 = 0)") 0;*)
75.209 -
75.210 -val l__ = str2term"lhs (M_b 0 = 0)";
75.211 -val l__ = eval_listexpr_ Biegelinie.thy srls l__; term2str l__;
75.212 -val SOME (str, t) = eval_lhs 0 "Tools.lhs" (str2term"lhs (M_b 0 = 0)") 0;
75.213 -
75.214 -
75.215 -trace_rewrite:=true;
75.216 -val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f(*------------------------*);
75.217 -trace_rewrite:=false;
75.218 -
75.219 -show_mets();
75.220 -
75.221 -"----------- fun sel_appl_atomic_tacs ----------------------------";
75.222 -"----------- fun sel_appl_atomic_tacs ----------------------------";
75.223 -"----------- fun sel_appl_atomic_tacs ----------------------------";
75.224 -states:=[];
75.225 -CalcTree
75.226 -[(["equality (x+1=2)", "solveFor x","solutions L"],
75.227 - ("Test.thy",
75.228 - ["sqroot-test","univariate","equation","test"],
75.229 - ["Test","squ-equ-test-subpbl1"]))];
75.230 -Iterator 1;
75.231 -moveActiveRoot 1;
75.232 -autoCalculate 1 CompleteCalcHead;
75.233 -autoCalculate 1 (Step 1);
75.234 -autoCalculate 1 (Step 1);
75.235 -val ((pt, p), _) = get_calc 1; show_pt pt;
75.236 -val appltacs = sel_appl_atomic_tacs pt p;
75.237 -if appltacs =
75.238 - [Rewrite ("radd_commute", "?m + ?n = ?n + ?m"),
75.239 - Rewrite ("radd_assoc", "?m + ?n + ?k = ?m + (?n + ?k)"),
75.240 - Calculate "times"] then ()
75.241 -else raise error "script.sml fun sel_appl_atomic_tacs diff.behav.";
75.242 -
75.243 -trace_script := true;
75.244 -trace_script := false;
75.245 -applyTactic 1 p (hd appltacs);
75.246 -val ((pt, p), _) = get_calc 1; show_pt pt;
75.247 -val appltacs = sel_appl_atomic_tacs pt p;
75.248 -
75.249 -"----- WN080102 these vvv do not work, because locatetac starts the search\
75.250 - \1 stac too low";
75.251 -applyTactic 1 p (hd appltacs);
75.252 -autoCalculate 1 CompleteCalc;
75.253 -
76.1 --- a/test/Tools/isac/ME/solve.sml Mon Aug 30 14:29:49 2010 +0200
76.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
76.3 @@ -1,537 +0,0 @@
76.4 -(* tests on solve.sml
76.5 - author: Walther Neuper
76.6 - 060508,
76.7 - (c) due to copyright terms
76.8 -
76.9 -is NOT ONLY dependent on Test, but on other thys:
76.10 -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
76.11 -uses from Rational.ML: Rrls cancel_p, Rrls cancel
76.12 -which in turn
76.13 -uses from Poly.ML: Rls make_polynomial, Rls expand_binom
76.14 -
76.15 -use"../smltest/ME/solve.sml";
76.16 -use"solve.sml";
76.17 -*)
76.18 -
76.19 -"-----------------------------------------------------------------";
76.20 -"table of contents -----------------------------------------------";
76.21 -"-----------------------------------------------------------------";
76.22 -"--------- interSteps on norm_Rational ---------------------------";
76.23 -(*---vvv NOT working after meNEW.04mmdd*)
76.24 -"###### val intermediate_ptyps = !ptyps;val intermediate_mets = !mets";
76.25 -"--------- prepare pbl, met --------------------------------------";
76.26 -"-------- cancel, without detail ------------------------------";
76.27 -"-------- cancel, detail rev-rew (cancel) afterwards ----------";
76.28 -"-------------- cancel_p, without detail ------------------------------";
76.29 -"-------------- cancel_p, detail rev-rew (cancel) afterwards ----------";
76.30 -(*---^^^ NOT working*)
76.31 -"on 'miniscript with mini-subpbl':";
76.32 -"------ interSteps'donesteps': on 'miniscript with mini-subpbl'---";
76.33 -"------ interSteps'detailrls' after CompleteCalc -----------------";
76.34 -"------ interSteps after appendFormula ---------------------------";
76.35 -(*---vvv not brought to work 0403*)
76.36 -"------ Detail_Set -----------------------------------------------";
76.37 -"###### ptyps:= intermediate_ptyps;met:= intermediate_mets;#######";
76.38 -"-----------------------------------------------------------------";
76.39 -"-----------------------------------------------------------------";
76.40 -"-----------------------------------------------------------------";
76.41 -
76.42 -
76.43 -"--------- interSteps on norm_Rational ---------------------------";
76.44 -"--------- interSteps on norm_Rational ---------------------------";
76.45 -"--------- interSteps on norm_Rational ---------------------------";
76.46 -states:=[];(*exp_IsacCore_Simp_Rat_Double_No-7.xml*)
76.47 -CalcTree [(["term ((2/(x+3) + 2/(x - 3)) / (8*x/(x^2 - 9)))","normalform N"],
76.48 - ("Rational.thy",
76.49 - ["rational","simplification"],
76.50 - ["simplification","of_rationals"]))];
76.51 -moveActiveRoot 1;
76.52 -autoCalculate 1 CompleteCalc;
76.53 -val ((pt,_),_) = get_calc 1; show_pt pt;
76.54 -
76.55 -(*with "Script SimplifyScript (t_::real) = -----------------
76.56 - \ ((Rewrite_Set norm_Rational False) t_)"
76.57 -case pt of Nd (PblObj _, [Nd _]) => ((*met only applies norm_Rational*))
76.58 - | _ => raise error "solve.sml: interSteps on norm_Rational 1";
76.59 -interSteps 1 ([1], Res);
76.60 -getFormulaeFromTo 1 ([1], Frm) ([1,12], Res) 99999 false;
76.61 -interSteps 1 ([1,3], Res);
76.62 -
76.63 -getTactic 1 ([1,4], Res) (*here get the tactic, and ...*);
76.64 -interSteps 1 ([1,5], Res) (*... here get the intermediate steps above*);
76.65 -
76.66 -getTactic 1 ([1,5,1], Frm);
76.67 -val ((pt,_),_) = get_calc 1; show_pt pt;
76.68 -
76.69 -getTactic 1 ([1,8], Res) (*Rewrite_Set "common_nominator_p" *);
76.70 -interSteps 1 ([1,9], Res)(*TODO.WN060606 reverse rew*);
76.71 ---------------------------------------------------------------------*)
76.72 -
76.73 -case pt of Nd (PblObj _, [Nd _, Nd _, Nd _, Nd _, Nd _, Nd _]) => ()
76.74 - | _ => raise error "solve.sml: interSteps on norm_Rational 1";
76.75 -(*these have been done now by the script ^^^ immediately...
76.76 -interSteps 1 ([1], Res);
76.77 -getFormulaeFromTo 1 ([1], Frm) ([1,12], Res) 99999 false;
76.78 -*)
76.79 -interSteps 1 ([6], Res);
76.80 -
76.81 -getTactic 1 ([6,1], Frm) (*here get the tactic, and ...*);
76.82 -interSteps 1 ([6,1], Res) (*... here get the intermediate steps above*);
76.83 -
76.84 -getTactic 1 ([3,4,1], Frm);
76.85 -val ((pt,_),_) = get_calc 1; show_pt pt;
76.86 -val (Form form, SOME tac, asm) = pt_extract (pt, ([6], Res));
76.87 -case (term2str form, tac, terms2strs asm) of
76.88 - ("1 / 2", Check_Postcond ["rational", "simplification"],
76.89 - ["-36 * x + 4 * x ^^^ 3 ~= 0"]) => ()
76.90 - | _ => raise error "solve.sml: interSteps on norm_Rational 2";
76.91 -
76.92 -
76.93 -
76.94 -"###### val intermediate_ptyps = !ptyps;val intermediate_mets = !mets";
76.95 -"###### val intermediate_ptyps = !ptyps;val intermediate_mets = !mets";
76.96 -"###### val intermediate_ptyps = !ptyps;val intermediate_mets = !mets";
76.97 -val intermediate_ptyps = !ptyps;
76.98 -val intermediate_mets = !mets;
76.99 -
76.100 -"--------- prepare pbl, met --------------------------------------";
76.101 -"--------- prepare pbl, met --------------------------------------";
76.102 -"--------- prepare pbl, met --------------------------------------";
76.103 -store_pbt
76.104 - (prep_pbt Test.thy "pbl_ttestt" [] e_pblID
76.105 - (["test"],
76.106 - [],
76.107 - e_rls, NONE, []));
76.108 -store_pbt
76.109 - (prep_pbt Test.thy "pbl_ttestt_detail" [] e_pblID
76.110 - (["detail","test"],
76.111 - [("#Given" ,["realTestGiven t_"]),
76.112 - ("#Find" ,["realTestFind s_"])
76.113 - ],
76.114 - e_rls, NONE, [["Test","test_detail"]]));
76.115 -
76.116 -store_met
76.117 - (prep_met Test.thy "met_detbin" [] e_metID
76.118 - (["Test","test_detail_binom"]:metID,
76.119 - [("#Given" ,["realTestGiven t_"]),
76.120 - ("#Find" ,["realTestFind s_"])
76.121 - ],
76.122 - {rew_ord'="sqrt_right",rls'=tval_rls,calc = [],srls=e_rls,prls=e_rls,
76.123 - crls=tval_rls, nrls=e_rls(*,
76.124 - asm_rls=[],asm_thm=[("real_mult_div_cancel2","")]*)},
76.125 - "Script Testterm (g_::real) = \
76.126 - \(((Rewrite_Set expand_binoms False) @@\
76.127 - \ (Rewrite_Set cancel False)) g_)"
76.128 - ));
76.129 -store_met
76.130 - (prep_met Test.thy "met_detpoly" [] e_metID
76.131 - (["Test","test_detail_poly"]:metID,
76.132 - [("#Given" ,["realTestGiven t_"]),
76.133 - ("#Find" ,["realTestFind s_"])
76.134 - ],
76.135 - {rew_ord'="sqrt_right",rls'=tval_rls,calc=[],srls=e_rls,prls=e_rls,
76.136 - crls=tval_rls, nrls=e_rls(*,
76.137 - asm_rls=[],asm_thm=[("real_mult_div_cancel2","")]*)},
76.138 - "Script Testterm (g_::real) = \
76.139 - \(((Rewrite_Set make_polynomial False) @@\
76.140 - \ (Rewrite_Set cancel_p False)) g_)"
76.141 - ));
76.142 -
76.143 -(*---- funktionieren mit Rationals.ML: dummy-Funktionen(1)--------*)
76.144 -
76.145 -"-------- cancel, without detail ------------------------------";
76.146 -"-------- cancel, without detail ------------------------------";
76.147 -"-------- cancel, without detail ------------------------------";
76.148 -val fmz = ["realTestGiven (((3 + x) * (3 - x)) / ((3 + x) * (3 + x)))",
76.149 - "realTestFind s"];
76.150 -val (dI',pI',mI') =
76.151 - ("Test.thy",["detail","test"],["Test","test_detail_binom"]);
76.152 -
76.153 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
76.154 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.155 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.156 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.157 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.158 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.159 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.160 -(*nxt = ("Apply_Method",Apply_Method ("Test.thy","test_detail"))*)
76.161 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.162 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.163 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.164 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.165 -(*"(3 + -1 * x) / (3 + x)"*)
76.166 -if nxt = ("End_Proof'",End_Proof') then ()
76.167 -else raise error "details.sml, changed behaviour in: without detail";
76.168 -
76.169 - val str = pr_ptree pr_short pt;
76.170 - writeln str;
76.171 -
76.172 -
76.173 -"-------- cancel, detail rev-rew (cancel) afterwards ----------";
76.174 -"-------- cancel, detail rev-rew (cancel) afterwards ----------";
76.175 -"-------- cancel, detail rev-rew (cancel) afterwards ----------";
76.176 - val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
76.177 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.178 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.179 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.180 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.181 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.182 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.183 - (*nxt = ("Apply_Method",Apply_Method ("Test.thy","test_detail"))*)
76.184 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.185 - (*val nxt = ("Rewrite_Set",Rewrite_Set "expand_binoms")*)
76.186 - val (p,_,f,nxt,_,pt) = me nxt p [] pt; (* rewrite must exist for Detail*)
76.187 -(* val nxt = ("Detail",Detail);"----------------------";*)
76.188 -
76.189 -
76.190 -(*WN.11.9.03: after meNEW not yet implemented -------------------------*)
76.191 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.192 -(*FIXXXXXME.040216 #####################################################
76.193 -# val nxt = ("Detail", Detail) : string * tac
76.194 -val it = "----------------------" : string
76.195 -> val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.196 -val f = Form' (FormKF (~1, EdUndef, ...)) : mout
76.197 -val nxt = ("Empty_Tac", Empty_Tac) : string * tac
76.198 -val p = ([2, 1], Res) : pos'
76.199 -#########################################################################
76.200 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.201 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.202 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.203 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.204 - (*val nxt = ("End_Detail",End_Detail)*)
76.205 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.206 - (*val nxt = ("Rewrite_Set",Rewrite_Set "cancel")*)
76.207 - val (p,_,f,nxt,_,pt) = me nxt p [] pt; (* rewrite must exist for Detail*)
76.208 - val nxt = ("Detail",Detail);"----------------------";
76.209 - val (p,_,f,nxt,_,pt) = (me nxt p [] pt) handle e => print_exn e;
76.210 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.211 -(*15.10.02*)
76.212 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.213 -(*
76.214 -rewrite "Rationals.thy" "tless_true""e_rls"true("sym_real_plus_minus_binom","")
76.215 - "3 ^^^ 2 - x ^^^ 2";
76.216 -*)
76.217 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.218 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.219 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.220 - val (p,_,f,nxt,_,pt) = (me nxt p [] pt) handle e => print_exn e;
76.221 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.222 -if f = Form' (FormKF (~1,EdUndef,0,Nundef,"(3 - x) / (3 + x)"))
76.223 - andalso nxt = ("End_Proof'",End_Proof') then ()
76.224 -else raise error "new behaviour in details.sml, \
76.225 - \cancel, rev-rew (cancel) afterwards";
76.226 -FIXXXXXME.040216 #####################################################*)
76.227 -
76.228 -(*---- funktionieren mit Rationals.ML: dummy-Funktionen(1)--------*)
76.229 -
76.230 -"-------------- cancel_p, without detail ------------------------------";
76.231 -"-------------- cancel_p, without detail ------------------------------";
76.232 -"-------------- cancel_p, without detail ------------------------------";
76.233 -val fmz = ["realTestGiven (((3 + x)*(3+(-1)*x)) / ((3+x) * (3+x)))",
76.234 - "realTestFind s"];
76.235 -val (dI',pI',mI') =
76.236 - ("Test.thy",["detail","test"],["Test","test_detail_poly"]);
76.237 -
76.238 -(*val p = e_pos'; val c = [];
76.239 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
76.240 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
76.241 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
76.242 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.243 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.244 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.245 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.246 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.247 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.248 -(*nxt = ("Apply_Method",Apply_Method ("Test.thy","test_detail"))*)
76.249 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.250 -"(3 + x) * (3 + -1 * x) / ((3 + x) * (3 + x))";
76.251 -
76.252 - (*14.3.03*)
76.253 -(*---------------WN060614?!?---
76.254 - val t = str2term "(3 + x) * (3 + -1 * x) / ((3 + x) * (3 + x))";
76.255 - val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
76.256 - "(9 + - (x ^^^ 2)) / (9 + 6 * x + x ^^^ 2)";
76.257 - val SOME (t,_) = rewrite_set_ thy false cancel_p t; term2str t;
76.258 - cancel_p_ thy t;
76.259 -(---------------WN060614?!?---*)
76.260 -
76.261 - val t = str2term "(3 + x) * (3 + -1 * x)";
76.262 - val SOME (t,_) = rewrite_set_ thy false expand_poly t; term2str t;
76.263 - "3 * 3 + 3 * (-1 * x) + (x * 3 + x * (-1 * x))";
76.264 - val SOME (t,_) = rewrite_set_ thy false order_add_mult t; term2str t;
76.265 - "3 * 3 + (3 * x + (-1 * (3 * x) + -1 * (x * x)))";
76.266 - val SOME (t,_) = rewrite_set_ thy false simplify_power t; term2str t;
76.267 - "3 ^^^ 2 + (3 * x + (-1 * (3 * x) + -1 * x ^^^ 2))";
76.268 - val SOME (t,_) = rewrite_set_ thy false collect_numerals t; term2str t;
76.269 - "9 + (0 * x + -1 * x ^^^ 2)";
76.270 - val SOME (t,_) = rewrite_set_ thy false reduce_012 t; term2str t;
76.271 - "9 + - (x ^^^ 2)";
76.272 - (*14.3.03*)
76.273 -
76.274 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.275 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.276 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.277 -(*"(3 + -1 * x) / (3 + x)"*)
76.278 -if nxt = ("End_Proof'",End_Proof') then ()
76.279 -else raise error "details.sml, changed behaviour in: cancel_p, without detail";
76.280 -
76.281 -"-------------- cancel_p, detail rev-rew (cancel) afterwards ----------";
76.282 -"-------------- cancel_p, detail rev-rew (cancel) afterwards ----------";
76.283 -"-------------- cancel_p, detail rev-rew (cancel) afterwards ----------";
76.284 -(* val p = e_pos'; val c = [];
76.285 - val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
76.286 - val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
76.287 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
76.288 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.289 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.290 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.291 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.292 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.293 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.294 - (*nxt = ("Apply_Method",Apply_Method ("Test.thy","test_detail_poly"))*)
76.295 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.296 - (*val nxt = ("Rewrite_Set",Rewrite_Set "make_polynomial")*)
76.297 - val (p,_,f,nxt,_,pt) = me nxt p [] pt; (* rewrite must exist for Detail*)
76.298 -
76.299 -(*14.3.03.FIXXXXXME since Isa02/reverse-rew.sml:
76.300 - fun make_deriv ... Rls_ not yet impl. (| Thm | Calc)
76.301 - Rls_ needed for make_polynomial ----------------------
76.302 - val nxt = ("Detail",Detail);"----------------------";
76.303 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.304 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.305 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.306 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.307 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.308 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.309 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.310 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.311 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.312 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.313 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.314 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.315 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.316 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.317 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.318 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.319 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.320 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.321 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.322 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.323 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.324 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.325 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.326 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.327 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.328 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.329 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.330 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.331 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.332 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.333 - if nxt = ("End_Detail",End_Detail) then ()
76.334 - else raise error "details.sml: new behav. in Detail make_polynomial";
76.335 -----------------------------------------------------------------------*)
76.336 -
76.337 -(*---------------
76.338 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.339 - (*val nxt = ("Rewrite_Set",Rewrite_Set "cancel_p")*)
76.340 - val (p,_,f,nxt,_,pt) = me nxt p [] pt; (* rewrite must exist for Detail*)
76.341 - val nxt = ("Detail",Detail);"----------------------";
76.342 - val (p,_,f,nxt,_,pt) = (me nxt p [] pt) handle e => print_exn e;
76.343 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.344 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.345 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.346 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.347 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.348 - val (p,_,f,nxt,_,pt) = (me nxt p [] pt) handle e => print_exn e;
76.349 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.350 -if f = Form' (FormKF (~1,EdUndef,0,Nundef,"(3 + x) / (3 - x)"))
76.351 - andalso nxt = ("End_Proof'",End_Proof') then ()
76.352 -else raise error "new behaviour in details.sml, cancel_p afterwards";
76.353 -
76.354 -----------------*)
76.355 -
76.356 -
76.357 -
76.358 -
76.359 -
76.360 -val fmz = ["realTestGiven ((x+3)+(-1)*(2+6*x))",
76.361 - "realTestFind s"];
76.362 -val (dI',pI',mI') =
76.363 - ("Test.thy",["detail","test"],["Test","test_detail_poly"]);
76.364 -
76.365 -(* val p = e_pos'; val c = [];
76.366 - val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
76.367 - val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
76.368 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
76.369 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.370 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.371 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.372 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.373 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.374 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.375 - (*nxt = ("Apply_Method",Apply_Method ("Test.thy","test_detail_poly"))*)
76.376 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.377 -(*16.10.02 --- kommt auf POLY_EXCEPTION ?!??? ----------------------------
76.378 - (*val nxt = ("Rewrite_Set",Rewrite_Set "make_polynomial")*)
76.379 - val (p,_,f,nxt,_,pt) = me nxt p [] pt; (* rewrite must exist for Detail*)
76.380 - val nxt = ("Detail",Detail);"----------------------";
76.381 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.382 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.383 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.384 - val (p,_,f,nxt,_,pt) = me nxt p [] pt;
76.385 --------------------------------------------------------------------------*)
76.386 -
76.387 -
76.388 -"------ interSteps'donesteps': on 'miniscript with mini-subpbl'---";
76.389 -"------ interSteps'donesteps': on 'miniscript with mini-subpbl'---";
76.390 -"------ interSteps'donesteps': on 'miniscript with mini-subpbl'---";
76.391 - states:=[];
76.392 - CalcTree
76.393 - [(["equality (x+1=2)", "solveFor x","solutions L"],
76.394 - ("Test.thy",
76.395 - ["sqroot-test","univariate","equation","test"],
76.396 - ["Test","squ-equ-test-subpbl1"]))];
76.397 - Iterator 1;
76.398 - moveActiveRoot 1;
76.399 - autoCalculate 1 CompleteCalc;
76.400 - moveActiveRoot 1;
76.401 -
76.402 - interSteps 1 ([],Res);
76.403 - val [(_,(((pt,_),_),[(_,ip)]))] = !states;
76.404 - val ("donesteps",_(*,ss*), lastpos) = detailstep pt ip;
76.405 - (*case ss of [(_,_,t1),(_,_,t2),(_,_,t3),(_,_,t4),(_,_,t5),(_,_,t6)] =>
76.406 - (writeln o terms2str) [t1,t2,t3,t4,t5,t6]
76.407 - | _ => raise error "details.sml: diff.behav. in detail miniscript";*) if lastpos = ([4], Res) then ()
76.408 - else raise error "details.sml: diff.behav. in interSteps'donesteps' 1";
76.409 -
76.410 - moveActiveDown 1;
76.411 - moveActiveDown 1;
76.412 - moveActiveDown 1;
76.413 - moveActiveDown 1;
76.414 -
76.415 - interSteps 1 ([3],Pbl) (*subproblem*);
76.416 - val [(_,(((pt,_),_),[(_,ip)]))] = !states;
76.417 - val ("donesteps",_(*,ss*), lastpos) = detailstep pt ip;
76.418 - (*case ss of [(_,_,t1),(_,_,t2),(_,_,t3)] =>
76.419 - (writeln o terms2str) [t1,t2,t3]
76.420 - | _ => raise error "details.sml: diff.behav. in detail miniscript";*) if lastpos = ([3, 2], Res) then ()
76.421 - else raise error "details.sml: diff.behav. in interSteps'donesteps' 1";
76.422 -
76.423 -
76.424 -(* val [(_,(((pt,_),_),[(_,ip)]))] = !states;
76.425 - writeln (pr_ptree pr_short pt);
76.426 - get_obj g_tac pt [4];
76.427 - *)
76.428 -
76.429 -
76.430 -"------ interSteps'detailrls' after CompleteCalc -----------------";
76.431 -"------ interSteps'detailrls' after CompleteCalc -----------------";
76.432 -"------ interSteps'detailrls' after CompleteCalc -----------------";
76.433 - states:=[];
76.434 - CalcTree
76.435 - [(["equality (x+1=2)", "solveFor x","solutions L"],
76.436 - ("Test.thy",
76.437 - ["sqroot-test","univariate","equation","test"],
76.438 - ["Test","squ-equ-test-subpbl1"]))];
76.439 - Iterator 1;
76.440 - moveActiveRoot 1;
76.441 - autoCalculate 1 CompleteCalc;
76.442 - interSteps 1 ([],Res);
76.443 - moveActiveRoot 1;
76.444 - moveActiveDown 1;
76.445 - moveActiveDown 1;
76.446 - moveActiveDown 1;
76.447 - refFormula 1 (get_pos 1 1); (* 2 Res, <ISA> -1 + x = 0 </ISA> *)
76.448 -
76.449 - interSteps 1 ([2],Res);
76.450 - val [(_,(((pt,_),_),[(_,(p,_))]))] = !states;
76.451 - if length (children (get_nd pt p)) = 6 then ()
76.452 - else raise error "details.sml: diff.behav. in interSteps'detailrls' 1";
76.453 -
76.454 - moveActiveDown 1;
76.455 - moveActiveDown 1; refFormula 1 (get_pos 1 1); (* 3,1 Frm, <ISA> -1 + x = 0 </ISA> *);
76.456 -
76.457 - interSteps 1 ([3,1],Frm) (*<ERROR> first formula on level has NO detail </E*);
76.458 - val [(_,(((pt,_),_),[(_,(p,_))]))] = !states;
76.459 - if length (children (get_nd pt p)) = 0 then () (*NO detail at ([xxx,1],Frm)*)
76.460 - else raise error "details.sml: diff.behav. in interSteps'detailrls' 2";
76.461 -
76.462 - moveActiveDown 1;
76.463 - refFormula 1 (get_pos 1 1); (* 3,1 Res, <ISA> x = 0 + -1 * -1 </ISA> *)
76.464 -
76.465 - interSteps 1 ([3,1],Res);
76.466 - val ((pt,p),_) = get_calc 1; show_pt pt;
76.467 - term2str (get_obj g_res pt [3,1,1]);(*"x = 0 + -1 * -1" ok*)
76.468 - term2str (get_obj g_form pt [3,2]); (*"x = 0 + -1 * -1" ok*)
76.469 - get_obj g_tac pt [3,1,1]; (*Rewrite_Inst.."risolate_bdv_add ok*)
76.470 -
76.471 - moveActiveDown 1;
76.472 - refFormula 1 (get_pos 1 1); (* 3,2 Res, <ISA> x = 1 </ISA> *)
76.473 -
76.474 - interSteps 1 ([3,2],Res);
76.475 - val [(_,(((pt,_),_),[(_,(p,_))]))] = !states;
76.476 - if length (children (get_nd pt p)) = 2 then ()
76.477 - else raise error "details.sml: diff.behav. in interSteps'detailrls' 3";
76.478 -
76.479 - val ((pt,p),_) = get_calc 1; show_pt pt;
76.480 -
76.481 -
76.482 -"------ interSteps after appendFormula ---------------------------";
76.483 -"------ interSteps after appendFormula ---------------------------";
76.484 -"------ interSteps after appendFormula ---------------------------";
76.485 -states:=[];
76.486 -CalcTree
76.487 -[(["equality (x+1=2)", "solveFor x","solutions L"],
76.488 - ("Test.thy",
76.489 - ["sqroot-test","univariate","equation","test"],
76.490 - ["Test","squ-equ-test-subpbl1"]))];
76.491 -Iterator 1;
76.492 -moveActiveRoot 1;
76.493 -autoCalculate 1 CompleteCalcHead;
76.494 -autoCalculate 1 (Step 1);
76.495 -autoCalculate 1 (Step 1);
76.496 -appendFormula 1 "x - 1 = 0"(*generates intermediate steps*);
76.497 -(*these are not shown, because the resulting formula is on the same
76.498 - level as the previous formula*)
76.499 -interSteps 1 ([2],Res) (*error: last unchanged was ([2, 9], Res)*);
76.500 -(*...and these are the internals*)
76.501 -val ((pt,p),_) = get_calc 1; show_pt pt;
76.502 -val (_,_,lastpos) =detailstep pt p;
76.503 -if p = ([2], Res) andalso lastpos = ([2, 9], Res) then ()
76.504 -else raise error "solve.sml: diff.beh. after appendFormula x - 1 = 0";
76.505 -
76.506 -
76.507 -"------ Detail_Set -----------------------------------------------";
76.508 -"------ Detail_Set -----------------------------------------------";
76.509 -"------ Detail_Set -----------------------------------------------";
76.510 - states:=[];
76.511 - CalcTree (*start of calculation, return No.1*)
76.512 - [(["equality (x+1=2)", "solveFor x","solutions L"],
76.513 - ("Test.thy",
76.514 - ["sqroot-test","univariate","equation","test"],
76.515 - ["Test","squ-equ-test-subpbl1"]))];
76.516 - Iterator 1; moveActiveRoot 1;
76.517 - autoCalculate 1 CompleteCalcHead;
76.518 - autoCalculate 1 (Step 1);
76.519 - autoCalculate 1 (Step 1);
76.520 -
76.521 - fetchProposedTactic 1 (*DG decides to do this tactic in detail*);
76.522 - (*TODO ...*)
76.523 - setNextTactic 1 (Detail_Set "Test_simplify");
76.524 -
76.525 -
76.526 - val ((pt,p),tacis) = get_calc 1;
76.527 - val str = pr_ptree pr_short pt;
76.528 - writeln str;
76.529 -
76.530 - print_depth 3;
76.531 - term2str (fst (get_obj g_result pt [1]));
76.532 -
76.533 -
76.534 -
76.535 -
76.536 -"###### ptyps:= intermediate_ptyps;met:= intermediate_mets;#######";
76.537 -"###### ptyps:= intermediate_ptyps;met:= intermediate_mets;#######";
76.538 -"###### ptyps:= intermediate_ptyps;met:= intermediate_mets;#######";
76.539 -ptyps:= intermediate_ptyps;
76.540 -mets:= intermediate_mets;
77.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
77.2 +++ b/test/Tools/isac/ProgLang/calculate-float.sml Mon Aug 30 14:35:51 2010 +0200
77.3 @@ -0,0 +1,147 @@
77.4 +(* (c) Stefan Rath 2005
77.5 + tests for sml/Scripts/calculate.sml
77.6 +
77.7 + use"~/proto2/isac/src/smltest/Scripts/calculate-float.sml";
77.8 + use"calculate-float.sml";
77.9 + *)
77.10 +
77.11 +
77.12 +(*WN.28.3.03 fuer Matthias*)
77.13 +(*Floatingpointnumbers, direkte Darstellung der abstrakten Syntax:*)
77.14 + val thy = Float.thy;
77.15 + val t = str2term "Float ((1,2),(0,0))";
77.16 + atomt t;
77.17 + val t = (term_of o the o (parse thy))
77.18 + "Float ((1,2),(0,0)) + Float ((3,4),(0,0)) * \
77.19 + \Float ((5,6),(0,0)) / Float ((7,8),(0,0))";
77.20 + atomt t;
77.21 +(*die konkrete Syntax wird noch verschoenert*)
77.22 +
77.23 + val thy = "Test.thy";
77.24 + val op_ = "divide_";
77.25 + val ct = "-6 / 3";
77.26 + val SOME (ct,_) = calculate thy (the (assoc (calclist, op_))) ct;
77.27 +
77.28 +(*-----WN050315------------------------------------------------------*)
77.29 +(*..*)
77.30 +val t = str2term "Float ((1,2),(0,0))";
77.31 +atomty t;
77.32 +val Const ("Float.Float",_) $
77.33 + (Const ("Pair",_) $
77.34 + (Const ("Pair",_) $ Free (i1,_) $ Free (i2,_)) $ _) = t;
77.35 +
77.36 +val t = str2term "Float ((1,2),(0,0)) + Float ((3,4),(0,0))";
77.37 +atomty t;
77.38 +(*-----WN050315------------------------------------------------------*)
77.39 +
77.40 +
77.41 +val thy = Float.thy;
77.42 +
77.43 +(*.calculate the value of a pair of floats.*)
77.44 +val ((a,b),(c,d)) = calc "op +" ((~1,0),(0,0)) ((2,0),(0,0));
77.45 +
77.46 +
77.47 +(*.build the term.*)
77.48 +term_of_float HOLogic.realT ((~1,0),(0,0));
77.49 +term_of_float HOLogic.realT ((~1,11),(0,0));
77.50 +
77.51 +(*--18.3.05-------------------------*)
77.52 +val t = Free ("sdfsdfsdf", HOLogic.realT);
77.53 +val t = Free ("-123,456", HOLogic.realT);
77.54 +val t = Free ("0,123456", HOLogic.realT);
77.55 +term2str t;
77.56 +(*----(1)------------------------------*)
77.57 +val t = str2term "IFloat (1, 2, 3)";
77.58 +val t = str2term "CFloat (1, 2)";
77.59 +atomt t;
77.60 +atomty t;
77.61 +val SOME ct = parse Float.thy "IFloat (1, 2, 3)";
77.62 +val SOME ct = parse Float.thy "CFloat (1, 2)";
77.63 +atomt (term_of ct);
77.64 +atomty (term_of ct);
77.65 +(*----(2)------------------------------*)
77.66 +val SOME ct = parse Float.thy "IFloat (-1, 2, 3)";
77.67 +val t = (term_of ct);
77.68 +atomty t;
77.69 +(*#######################################################################3
77.70 +val Const
77.71 + ("Float.IFloat", _) $
77.72 + (Const
77.73 + ("Pair", _) $
77.74 + Free (no, _) $
77.75 + (Const
77.76 + ("Pair", _) $
77.77 + Free (commas, _) $ Free (exp, _))) = t;
77.78 +
77.79 +fun IFloat2CFloat
77.80 + (Const
77.81 + ("Float.IFloat", _) $
77.82 + (Const
77.83 + ("Pair", _) $
77.84 + Free (no, _) $
77.85 + (Const
77.86 + ("Pair", _) $
77.87 + Free (commas, _) $ Free (exp, _)))) =
77.88 + Const ("Float.CFloat", HOLogic.realT(*wrong type*)) $
77.89 + (Const
77.90 + ("Pair", HOLogic.realT(*wrong type*)) $
77.91 + Free (no^"."^commas, HOLogic.realT)
77.92 + $ Free ("accuracy", HOLogic.realT))
77.93 +
77.94 + | IFloat2CFloat t =
77.95 + raise error ("IFloat2CFloat: invalid argument "^term2str t);
77.96 +
77.97 +val cf = IFloat2CFloat t;
77.98 +term2str cf;
77.99 +
77.100 +(*in IsacKnowledge/Float.ML: fun pairt -> Pair-term*)
77.101 +
77.102 +fun CFloat2Free (Const ("Float.CFloat", _) $
77.103 + (Const ("Pair", _) $ Free (no_commas, _) $ _)) =
77.104 + Free (no_commas, HOLogic.realT);
77.105 +
77.106 +val t' = CFloat2Free cf;
77.107 +term2str t';
77.108 +
77.109 +fun CFloat2sml (Const ("Float.CFloat", _) $
77.110 + (Const ("Pair", _) $ Free (float, _) $ _(**))) =
77.111 + float;
77.112 +CFloat2sml cf;
77.113 +
77.114 +(*--18.3.05-------------------------*)
77.115 +
77.116 +
77.117 +(*.the function evaluating a binary operator.*)
77.118 +val t = str2term "Float ((1,2),(0,0)) + Float ((3,4),(0,0))";
77.119 +val SOME (thmid, t) = eval_binop "#add_" "op +" t thy;
77.120 +term2str t;
77.121 +
77.122 +
77.123 +(*.scan a term for a pair of floats.*)
77.124 + val SOME (thmid,t') = get_pair thy op_ eval_fn t;
77.125 +
77.126 +
77.127 +(*.use 'calculate' explicitly.*)
77.128 + val thy = Test.thy;
77.129 + val op_ = "divide_";
77.130 + val t = str2term "sqrt (x ^^^ 2 + -3 * x) =\
77.131 + \Float ((5,6),(0,0)) / Float ((7,8),(0,0))";
77.132 + val SOME (t',_) = calculate_ thy (the (assoc (calclist, op_))) t;
77.133 + term2str t';
77.134 +
77.135 +
77.136 +(*.rewrite with ruleset TEST...simplify (calling calculate internally.*)
77.137 +val t = str2term "a + Float ((1,2),(0,0)) + a + Float ((3,4),(0,0)) * \
77.138 + \Float ((5,6),(0,0)) / Float ((7,8),(0,0))";
77.139 +val SOME (t',_) = rewrite_set_ thy false norm_Rational(*///*) t; term2str t';
77.140 +(*Float ((...,...) + 2*a*)
77.141 +
77.142 +
77.143 +(*. parse a float as seen by the user .*)
77.144 +val SOME t = parse Float.thy "123.456";
77.145 +val SOME t = parse Float.thy "-123.456";
77.146 +val SOME t = parse Float.thy "123.456 E6789";
77.147 +val SOME t = parse Float.thy "123.456 E-6789";
77.148 +val SOME t = parse Float.thy "-123.456 E-6789";
77.149 +
77.150 +################################################################*)
78.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
78.2 +++ b/test/Tools/isac/ProgLang/calculate.sml Mon Aug 30 14:35:51 2010 +0200
78.3 @@ -0,0 +1,471 @@
78.4 +(* test calculation of values for function constants
78.5 + (c) Walther Neuper 2000
78.6 +
78.7 +use"../smltest/Scripts/calculate.sml";
78.8 +use"calculate.sml";
78.9 +*)
78.10 +
78.11 +" ================= calculate.sml: calculate_ ======================== ";
78.12 +" ================= calculate.sml: aus script ======================== ";
78.13 +" ================= calculate.sml: 2.8.02 check test-root-equ ======== ";
78.14 +"--------------(4): check bottom up: ---------------------------";
78.15 +" ================= calculate.sml:10.8.02 2002:///->/ ======== ";
78.16 +" ================= calculate.sml: calculate_ 2002 =================== ";
78.17 +"----------- get_pair with 3 args --------------------------------";
78.18 +" ================= eval_binop Float =================== ";
78.19 +"------------------ 3.6.03 (2 * x is_const) ---------------------------";
78.20 +
78.21 +(* [("Vars",("Tools.Vars",fn)),("Length",("Tools.Length",fn)),
78.22 + ("Nth",("Tools.Nth",fn)),
78.23 + ("power_",("Atools.pow",fn)),("plus",("op +",fn)),("times",("op *",fn)),
78.24 + ("is_const",("Atools.is'_const",fn)),
78.25 + ("le",("op <",fn)),("leq",("op <=",fn)),
78.26 + ("ident",("Atools.ident",fn))] *)
78.27 +
78.28 +val thy' = "Isac.thy";
78.29 +
78.30 +" ================= calculate.sml: calculate_ ======================== ";
78.31 +" ================= calculate.sml: calculate_ ======================== ";
78.32 +" ================= calculate.sml: calculate_ ======================== ";
78.33 +
78.34 +
78.35 +val thy = Test.thy;
78.36 +val t = (term_of o the o (parse thy)) "1+2";
78.37 +val SOME (thmID,thm) = get_calculation_ thy (the(assoc(calclist,"plus"))) t;
78.38 +
78.39 +val t = (term_of o the o (parse thy)) "((1+2)*4/3)^^^2";
78.40 +val SOME (thmID,thm) = get_calculation_ thy (the(assoc(calclist,"plus"))) t;
78.41 +val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
78.42 +Syntax.string_of_term (thy2ctxt thy) t;
78.43 +(*val it = "(#3 * #4 // #3) ^^^ #2" : string*)
78.44 +val SOME (thmID,thm) = get_calculation_ thy (the(assoc(calclist,"times"))) t;
78.45 +val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
78.46 +Syntax.string_of_term (thy2ctxt thy) t;
78.47 +(*val it = "(#12 // #3) ^^^ #2" : string*)
78.48 +val SOME (thmID,thm) = get_calculation_ thy(the(assoc(calclist,"divide_")))t;
78.49 +val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
78.50 +Syntax.string_of_term (thy2ctxt thy) t;
78.51 +(*it = "#4 ^^^ #2" : string*)
78.52 +val SOME (thmID,thm) = get_calculation_ thy(the(assoc(calclist,"power_")))t;
78.53 +val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
78.54 +Syntax.string_of_term (thy2ctxt thy) t;
78.55 +(*val it = "#16" : string*)
78.56 +if it <> "16" then raise error "calculate.sml: new behaviour in calculate_"
78.57 +else ();
78.58 +
78.59 +" ================= calculate.sml: aus script ======================== ";
78.60 +" ================= calculate.sml: aus script ======================== ";
78.61 +" ================= calculate.sml: aus script ======================== ";
78.62 +
78.63 +store_pbt
78.64 + (prep_pbt Test.thy "pbl_ttest" [] e_pblID
78.65 + (["test"],
78.66 + [],
78.67 + e_rls, NONE, []));
78.68 +store_pbt
78.69 + (prep_pbt Test.thy "pbl_ttest_calc" [] e_pblID
78.70 + (["calculate","test"],
78.71 + [("#Given" ,["realTestGiven t_"]),
78.72 + ("#Find" ,["realTestFind s_"])
78.73 + ],
78.74 + e_rls, NONE, [["Test","test_calculate"]]));
78.75 +
78.76 +store_met
78.77 + (prep_met Test.thy "met_testcal" [] e_metID
78.78 + (["Test","test_calculate"]:metID,
78.79 + [("#Given" ,["realTestGiven t_"]),
78.80 + ("#Find" ,["realTestFind s_"])
78.81 + ],
78.82 + {rew_ord'="sqrt_right",rls'=tval_rls,srls=e_rls,prls=e_rls,
78.83 + calc=[("plus" ,("op +" ,eval_binop "#add_")),
78.84 + ("times" ,("op *" ,eval_binop "#mult_")),
78.85 + ("divide_" ,("HOL.divide" ,eval_cancel "#divide_")),
78.86 + ("power_" ,("Atools.pow" ,eval_binop "#power_"))],
78.87 + crls=tval_rls, nrls=e_rls(*,
78.88 + asm_rls=[],asm_thm=[]*)},
78.89 + "Script STest_simplify (t_::real) = \
78.90 + \(Repeat \
78.91 + \ ((Try (Repeat (Calculate plus))) @@ \
78.92 + \ (Try (Repeat (Calculate times))) @@ \
78.93 + \ (Try (Repeat (Calculate divide_))) @@ \
78.94 + \ (Try (Repeat (Calculate power_))))) t_"
78.95 + ));
78.96 +
78.97 +val fmz = ["realTestGiven (((1+2)*4/3)^^^2)","realTestFind s"];
78.98 +val (dI',pI',mI') =
78.99 + ("Test.thy",["calculate","test"],["Test","test_calculate"]);
78.100 +(*val p = e_pos'; val c = [];
78.101 +val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
78.102 +val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
78.103 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
78.104 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
78.105 +(*nxt =("Add_Given",Add_Given "realTestGiven (((#1 + #2) * #4 // #3) ^^^#2)")*)
78.106 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
78.107 +(*nxt = ("Add_Find",Add_Find "realTestFind s") : string * tac*)
78.108 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
78.109 +(*nxt = ("Specify_Theory",Specify_Theory "Test.thy") : string * tac*)
78.110 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
78.111 +(*nxt = ("Specify_Problem",Specify_Problem ["calculate","test"])*)
78.112 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
78.113 +(*nxt = ("Specify_Method",Specify_Method ("Test.thy","test_calculate"))*)
78.114 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
78.115 +(*nxt = ("Apply_Method",Apply_Method ("Test.thy","test_calculate"))*)
78.116 +
78.117 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
78.118 +(*nxt = ("Calculate",Calculate "plus")*)
78.119 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
78.120 +(*nxt = ("Calculate",Calculate "times")*)
78.121 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
78.122 +(*nxt = ("Calculate",Calculate "divide_")*)
78.123 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
78.124 +(*nxt = ("Calculate",Calculate "power_")*)
78.125 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
78.126 +(*nxt = ("Check_Postcond",Check_Postcond ["calculate","test"])*)
78.127 +val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
78.128 +(*nxt = ("End_Proof'",End_Proof')*)
78.129 +if f = Form' (FormKF (~1,EdUndef,0,Nundef,"16")) then ()
78.130 +else raise error "calculate.sml: script test_calculate changed behaviour";
78.131 +
78.132 +
78.133 +
78.134 +
78.135 +" ================= calculate.sml: 2.8.02 check test-root-equ ======== ";
78.136 +" ================= calculate.sml: 2.8.02 check test-root-equ ======== ";
78.137 +" ================= calculate.sml: 2.8.02 check test-root-equ ======== ";
78.138 +(*(1): 2nd Test_simplify didn't work:
78.139 +val ct =
78.140 + "sqrt (x ^^^ 2 + -3 * x) = (-3 + 2 * x + -1 * (9 + 4 * x)) / (-1 * 2)"
78.141 +> val rls = ("Test_simplify");
78.142 +> val (ct,_) = the (rewrite_set thy' ("tval_rls") false rls ct);
78.143 +val ct = "sqrt (x ^^^ 2 + -3 * x) =
78.144 +(-9) / (-2) + (-3 / (-2) + (x * ((-4) / (-2)) + x * (2 / (-2))))";
78.145 +ie. cancel does not work properly
78.146 +*)
78.147 + val thy = "Test.thy";
78.148 + val op_ = "divide_";
78.149 + val ct = "sqrt (x ^^^ 2 + -3 * x) =\
78.150 + \(-9) / (-2) + (-3 / (-2) + (x * ((-4) / (-2)) + x * (2 / (-2))))";
78.151 + val SOME (ct,_) = calculate thy (the(assoc(calclist,op_))) ct;
78.152 + writeln ct;
78.153 +(*
78.154 + sqrt (x ^^^ 2 + -3 * x) =\
78.155 + \(-9) / (-2) + (-3 / (-2) + (x * ((-4) / (-2)) + x * (2 / (-2))))
78.156 +............... does not work *)
78.157 +
78.158 +(*--------------(2): does divide work in Test_simplify ?: ------*)
78.159 + val thy = Test.thy;
78.160 + val t = (term_of o the o (parse thy)) "6 / 2";
78.161 + val rls = Test_simplify;
78.162 + val (t,_) = the (rewrite_set_ thy false rls t);
78.163 +(*val t = Free ("3","RealDef.real") : term*)
78.164 +
78.165 + val thy = "Test.thy";
78.166 + val t = "6 / 2";
78.167 + val rls = "Test_simplify";
78.168 + val (t,_) = the (rewrite_set thy false rls t);
78.169 +(*val t = "3" : string
78.170 + ....... works, thus: which rule in SqRoot_simplify works differently ?*)
78.171 +
78.172 +
78.173 +(*--------------(3): is_const works ?: -------------------------------------*)
78.174 + val t = (term_of o the o (parse Test.thy)) "2 is_const";
78.175 + atomty t;
78.176 + rewrite_set_ Test.thy false tval_rls t;
78.177 +(*val it = SOME (Const ("True","bool"),[]) ... works*)
78.178 +
78.179 + val t = str2term "2 * x is_const";
78.180 + val SOME (str,t') = eval_const "" "" t Isac.thy;
78.181 + term2str t';
78.182 +
78.183 +
78.184 +
78.185 +
78.186 +"--------------(4): check bottom up: ---------------------------";
78.187 +(*-------------- eval_cancel works: *)
78.188 + trace_rewrite:=true;
78.189 + val thy = Test.thy;
78.190 + val t = (term_of o the o (parse thy)) "(-4) / 2";
78.191 + val SOME (_,t) = eval_cancel "xxx" "HOL.divide" t thy;
78.192 + term2str t;
78.193 +"-4 / 2 = (-2)";
78.194 +(*-------------- but ... *)
78.195 + val ct = "x + (-4) / 2";
78.196 + val (ct,_) = the (rewrite_set thy' false rls ct);
78.197 +"(-2) + x";
78.198 +(*-------------- while ... *)
78.199 + val ct = "(-4) / 2";
78.200 + val (ct,_) = the (rewrite_set thy' false rls ct);
78.201 +"-2";
78.202 +
78.203 +(*--------------(5): reproduce (1) with simpler term: ------------*)
78.204 + val thy = "Test.thy";
78.205 + val t = "(3+5)/2";
78.206 + val (t,_) = the (rewrite_set thy false rls t);
78.207 +(*val t = "4" ... works*)
78.208 +
78.209 + val t = "(3+1+2*x)/2";
78.210 + val (t,_) = the (rewrite_set thy false rls t);
78.211 +(*val t = "2 + x" ... works*)
78.212 +
78.213 + trace_rewrite:=true; (*3.6.03*)
78.214 + val thy = "Test.thy";
78.215 + val rls = "Test_simplify";
78.216 + val t = "(3+(1+2*x))/2";
78.217 + val (t,_) = the (rewrite_set thy false rls t);
78.218 +(*val t = "2 + x" ... works: give up----------------------------------------*)
78.219 + trace_rewrite:=false;
78.220 +
78.221 + trace_rewrite:=true; (*3.6.03*)
78.222 + val thy = Test.thy;
78.223 + val rls = Test_simplify;
78.224 + val t = str2term "(3+(1+2*x))/2";
78.225 + val SOME (t',asm) = rewrite_set_ thy false rls t;
78.226 + term2str t';
78.227 +(*val t = "2 + x" ... works: give up----------------------------------------*)
78.228 + trace_rewrite:=false;
78.229 +
78.230 +
78.231 +
78.232 +
78.233 +(*--- trace_rewrite before correction of ... --------------------
78.234 + val ct = "(-3 + 2 * x + -1) / 2";
78.235 + val (ct,_) = the (rewrite_set thy' false rls ct);
78.236 +:
78.237 +### trying thm 'root_ge0_2'
78.238 +### rewrite_set_: x + (-1 + -3) / 2
78.239 +### trying thm 'radd_real_const_eq'
78.240 +### trying thm 'radd_real_const'
78.241 +### rewrite_set_: x + (-4) / 2
78.242 +### trying thm 'rcollect_right'
78.243 +:
78.244 +"x + (-4) / 2"
78.245 +-------------------------------------while before Isabelle20002:
78.246 + val ct = "(#-3 + #2 * x + #-1) // #2";
78.247 + val (ct,_) = the (rewrite_set thy' false rls ct);
78.248 +:
78.249 +### trying thm 'root_ge0_2'
78.250 +### rewrite_set_: x + (#-1 + #-3) // #2
78.251 +### trying thm 'radd_real_const_eq'
78.252 +### trying thm 'radd_real_const'
78.253 +### rewrite_set_: x + #-4 // #2
78.254 +### rewrite_set_: x + #-2
78.255 +### trying thm 'rcollect_right'
78.256 +:
78.257 +"#-2 + x"
78.258 +-----------------------------------------------------------------*)
78.259 +
78.260 +
78.261 + toggle trace_rewrite;
78.262 +(*===================*)
78.263 + trace_rewrite:=true;
78.264 + val thy' = "Test.thy";
78.265 + val rls = "Test_simplify";
78.266 + val ct = "x + (-1 + -3) / 2";
78.267 + val (ct,_) = the (rewrite_set thy' false rls ct);
78.268 +"x + (-4) / 2";
78.269 +(*
78.270 +### trying calc. 'cancel'
78.271 +@@@ get_pair: binop, t = x + (-4) / 2
78.272 +@@@ get_pair: t else
78.273 +@@@ get_pair: t else -> NONE
78.274 +@@@ get_pair: binop, t = (-4) / 2
78.275 +@@@ get_pair: then 1
78.276 +@@@ get_pair: t -> NONE
78.277 +@@@ get_pair: t1 -> NONE
78.278 +@@@ get_calculation: NONE
78.279 +### trying calc. 'pow'
78.280 +*)
78.281 +
78.282 + trace_rewrite:=true;
78.283 + val thy' = "Test.thy";
78.284 + val rls = "Test_simplify";
78.285 + val ct = "x + (-4) / 2";
78.286 + val (ct,_) = the (rewrite_set thy' false rls ct);
78.287 +"(-2) + x";
78.288 +(*
78.289 +### trying calc. 'cancel'
78.290 +@@@ get_pair: binop, t = x + -4 / 2
78.291 +@@@ get_pair: t else
78.292 +@@@ get_pair: t else -> NONE
78.293 +@@@ get_pair: binop, t = -4 / 2
78.294 +@@@ get_pair: then 1
78.295 +@@@ get_calculation: SOME #cancel_-4_2
78.296 +### calc. to: x + (-2)
78.297 +### trying calc. 'cancel'
78.298 +*)
78.299 + trace_rewrite:=false;
78.300 +
78.301 +" ================= calculate.sml:10.8.02 2002:///->/ ======== ";
78.302 +" ================= calculate.sml:10.8.02 2002:///->/ ======== ";
78.303 +" ================= calculate.sml:10.8.02 2002:///->/ ======== ";
78.304 +" ----------------- rewriting works ? -----------------------";
78.305 + val thy = Isac.thy;
78.306 + val prop = (#prop o rep_thm) real_divide_1;
78.307 + atomty prop;
78.308 +(*** -------------
78.309 +*** Const ( Trueprop, bool => prop)
78.310 +*** . Const ( op =, [real, real] => bool)
78.311 +*** . . Const ( HOL.divide, [real, real] => real)
78.312 +*** . . . Var ((x, 0), real)
78.313 +*** . . . Const ( 1, real)
78.314 +*** . . Var ((x, 0), real) *)
78.315 + val prop' = (#prop o rep_thm o num_str) real_divide_1;
78.316 + atomty prop';
78.317 +(*** -------------
78.318 +*** Const ( Trueprop, bool => prop)
78.319 +*** . Const ( op =, [real, real] => bool)
78.320 +*** . . Const ( HOL.divide, [real, real] => real)
78.321 +*** . . . Var ((x, 0), real)
78.322 +*** . . . Free ( 1, real) (*app_num_tr'*)
78.323 +*** . . Var ((x, 0), real)*)
78.324 + val t = (term_of o the o (parseold thy)) "aaa/1";
78.325 + atomty t;
78.326 +(*** -------------
78.327 +*** Const ( HOL.divide, ['a, 'a] => 'a)
78.328 +*** . Free ( aaa, 'a)
78.329 +*** . Free ( 1, 'a) *)
78.330 + val t = (term_of o the o (parse thy)) "aaa/1";
78.331 + atomty t;
78.332 +(*** -------------
78.333 +*** Const ( HOL.divide, [real, real] => real)
78.334 +*** . Free ( aaa, real)
78.335 +*** . Free ( 1, real) *)
78.336 + val thm = num_str real_divide_1;
78.337 + val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
78.338 +(*val t = Free ("aaa","RealDef.real") : term*)
78.339 +
78.340 +
78.341 + val prop = (#prop o rep_thm) realpow_eq_one;
78.342 + atomty prop;
78.343 +(*** -------------
78.344 +*** Const ( Trueprop, bool => prop)
78.345 +*** . Const ( op =, [real, real] => bool)
78.346 +*** . . Const ( Nat.power, [real, nat] => real)
78.347 +*** . . . Const ( 1, real)
78.348 +*** . . . Var ((n, 0), nat)
78.349 +*** . . Const ( 1, real) *)
78.350 + val prop' = (#prop o rep_thm o num_str) realpow_eq_one;
78.351 + atomty prop';
78.352 +(*** -------------
78.353 +*** Const ( Trueprop, bool => prop)
78.354 +*** . Const ( op =, [real, real] => bool)
78.355 +*** . . Const ( Nat.power, [real, nat] => real)
78.356 +*** . . . Free ( 1, real)
78.357 +*** . . . Var ((n, 0), nat)
78.358 +*** . . Free ( 1, real)*)
78.359 + val t = (term_of o the o (parseold thy)) "1 ^ aaa";
78.360 + atomty t;
78.361 +(*** -------------
78.362 +*** Const ( Nat.power, ['a, nat] => 'a)
78.363 +*** . Free ( 1, 'a)
78.364 +*** . Free ( aaa, nat) *)
78.365 + val t = (term_of o the o (parse thy)) "1 ^ aaa";
78.366 + atomty t;
78.367 +(*** -------------
78.368 +*** Const ( Nat.power, [real, nat] => real)
78.369 +*** . Free ( 1, real)
78.370 +*** . Free ( aaa, nat) .......................... nat !!! *)
78.371 + val thm = num_str realpow_eq_one;
78.372 + val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
78.373 +(*val t = Free ("1","RealDef.real") : term*)
78.374 +
78.375 +" ================= calculate.sml: calculate_ 2002 =================== ";
78.376 +" ================= calculate.sml: calculate_ 2002 =================== ";
78.377 +" ================= calculate.sml: calculate_ 2002 =================== ";
78.378 +
78.379 +val thy = Test.thy;
78.380 +val t = (term_of o the o (parse thy)) "12 / 3";
78.381 +val SOME (thmID,thm) = get_calculation_ thy(the(assoc(calclist,"divide_")))t;
78.382 +val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
78.383 +"12 / 3 = 4";
78.384 +val thy = Test.thy;
78.385 +val t = (term_of o the o (parse thy)) "4 ^^^ 2";
78.386 +val SOME (thmID,thm) = get_calculation_ thy(the(assoc(calclist,"power_"))) t;
78.387 +val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
78.388 +"4 ^ 2 = 16";
78.389 +
78.390 + val t = (term_of o the o (parse thy)) "((1 + 2) * 4 / 3) ^^^ 2";
78.391 + val SOME (thmID,thm) = get_calculation_ thy (the(assoc(calclist,"plus"))) t;
78.392 +"1 + 2 = 3";
78.393 + val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
78.394 + Syntax.string_of_term (thy2ctxt thy) t;
78.395 +"(3 * 4 / 3) ^^^ 2";
78.396 + val SOME (thmID,thm) = get_calculation_ thy (the(assoc(calclist,"times")))t;
78.397 +"3 * 4 = 12";
78.398 + val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
78.399 + Syntax.string_of_term (thy2ctxt thy) t;
78.400 +"(12 / 3) ^^^ 2";
78.401 + val SOME (thmID,thm) =get_calculation_ thy(the(assoc(calclist,"divide_")))t;
78.402 +"12 / 3 = 4";
78.403 + val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
78.404 + Syntax.string_of_term (thy2ctxt thy) t;
78.405 +"4 ^^^ 2";
78.406 + val SOME (thmID,thm) = get_calculation_ thy(the(assoc(calclist,"power_")))t;
78.407 +"4 ^^^ 2 = 16";
78.408 + val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
78.409 + Syntax.string_of_term (thy2ctxt thy) t;
78.410 +"16";
78.411 + if it <> "16" then raise error "calculate.sml: new behaviour in calculate_"
78.412 + else ();
78.413 +
78.414 +(*13.9.02 *** calc: operator = pow not defined*)
78.415 + val t = (term_of o the o (parse thy)) "3^^^2";
78.416 + val SOME (thmID,thm) =
78.417 + get_calculation_ thy (the(assoc(calclist,"power_"))) t;
78.418 +(*** calc: operator = pow not defined*)
78.419 +
78.420 + val (op_, eval_fn) = the (assoc(calclist,"power_"));
78.421 + (*
78.422 +val op_ = "Atools.pow" : string
78.423 +val eval_fn = fn : string -> term -> theory -> (string * term) option*)
78.424 +
78.425 + val SOME (thmid,t') = get_pair thy op_ eval_fn t;
78.426 +(*** calc: operator = pow not defined*)
78.427 +
78.428 + val SOME (id,t') = eval_fn op_ t thy;
78.429 +(*** calc: operator = pow not defined*)
78.430 +
78.431 + val (thmid, (Const (op0,t0) $ Free (n1,t1) $ Free(n2,t2))) = (op_, t);
78.432 + val SOME (id,t') = eval_binop thmid op_ t thy;
78.433 +(*** calc: operator = pow not defined*)
78.434 +
78.435 +
78.436 +"----------- get_pair with 3 args --------------------------------";
78.437 +"----------- get_pair with 3 args --------------------------------";
78.438 +"----------- get_pair with 3 args --------------------------------";
78.439 +val (thy, op_, ef, arg) =
78.440 + (thy, "EqSystem.occur'_exactly'_in",
78.441 + snd (the (assoc(!calclist',"occur_exactly_in"))),
78.442 + str2term
78.443 + "[] from_ [c, c_2, c_3, c_4] occur_exactly_in -1 * (q_0 * L ^^^ 2) / 2"
78.444 + );
78.445 +val SOME (str, simpl) = get_pair thy op_ ef arg;
78.446 +if str =
78.447 +"[] from_ [c, c_2, c_3, c_4] occur_exactly_in -1 * (q_0 * L ^^^ 2) / 2 = True"
78.448 +then () else raise error "calculate.sml get_pair with 3 args:occur_exactly_in";
78.449 +
78.450 +
78.451 +
78.452 +" ================= eval_binop Float =================== ";
78.453 +val t = str2term "Float ((1,2),(0,0))";
78.454 +atomty t;
78.455 +val Const ("Float.Float",_) $
78.456 + (Const ("Pair",_) $
78.457 + (Const ("Pair",_) $ Free (i1,_) $ Free (i2,_)) $ _) = t;
78.458 +
78.459 +val t = str2term "Float ((1,2),(0,0)) * Float ((3,4),(0,0))";
78.460 +atomty t;
78.461 +(*WN.10.4.03 eval_binop Float *)
78.462 +
78.463 +
78.464 +"------------------ 3.6.03 (2 * x is_const) ---------------------------";
78.465 +"------------------ 3.6.03 (2 * x is_const) ---------------------------";
78.466 +"------------------ 3.6.03 (2 * x is_const) ---------------------------";
78.467 +val t = str2term "2 * x is_const";
78.468 +val SOME (str, t') = eval_const "" "" t Test.thy;
78.469 +term2str t';
78.470 +"(2 * x is_const) = False";
78.471 +
78.472 +val SOME (t',_) = rewrite_set_ Test.thy false tval_rls t;
78.473 +term2str t';
78.474 +"False";
79.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
79.2 +++ b/test/Tools/isac/ProgLang/listg.sml Mon Aug 30 14:35:51 2010 +0200
79.3 @@ -0,0 +1,73 @@
79.4 +(* tests for ListG
79.5 + author: Walther Neuper 1.5.03
79.6 +
79.7 +use"../smltest/Scripts/listg.sml";
79.8 +use"listg.sml";
79.9 +*)
79.10 +
79.11 +
79.12 +
79.13 +"--------------------- nth_ ----------------------------------------------";
79.14 +"--------------------- nth_ ----------------------------------------------";
79.15 +"--------------------- nth_ ----------------------------------------------";
79.16 +val t = str2term "nth_ 3 [a,b,c,d,e]";
79.17 +atomty t;
79.18 +val thm = (#prop o rep_thm o num_str) nth_Cons_;
79.19 +atomty thm;
79.20 +val SOME (t',_) = rewrite_ thy dummy_ord Poly_erls false (num_str nth_Cons_) t;
79.21 +if term2str t' = "nth_ (3 + - 1) [b, c, d, e]" then ()
79.22 +else raise error "list_rls.sml, nth_ (3 + - 1) [b, c, d, e]";
79.23 +
79.24 +val t = str2term "nth_ 1 [a,b,c,d,e]";
79.25 +atomty t;
79.26 +val thm = (#prop o rep_thm o num_str) nth_Nil_;
79.27 +atomty thm;
79.28 +val SOME (t',_) = rewrite_ thy dummy_ord Poly_erls false (num_str nth_Nil_) t;
79.29 +term2str t';
79.30 +"a";
79.31 +
79.32 +val t = str2term "nth_ 3 [a,b,c,d,e]";
79.33 +atomty t;
79.34 +trace_rewrite:=true;
79.35 +val SOME (t',_) = rewrite_set_ thy false list_rls t;
79.36 +trace_rewrite:=false;
79.37 +term2str t';
79.38 +"c";
79.39 +
79.40 +(*-------------------------------------------------------------------*)
79.41 +val SOME (Thm (_,thm)) = rls_get_thm list_rls "nth_Nil_";
79.42 +val ttt = (#prop o rep_thm) thm;
79.43 +atomty ttt;
79.44 +(*Free ( 1, real) ...OK, Var ((x, 0), ?'a) OK*)
79.45 +
79.46 +
79.47 +
79.48 +"--------------------- length_ -------------------------------------------";
79.49 +"--------------------- length_ -------------------------------------------";
79.50 +"--------------------- length_ -------------------------------------------";
79.51 +val thy' = "ListG.thy";
79.52 +val ct = "length_ [1,1,1]";
79.53 +val thm = ("length_Cons_","");
79.54 +val (ct,asm) = the (rewrite thy' "tless_true" ("tval_rls") false thm ct);
79.55 +val (ct,asm) = the (rewrite thy' "tless_true" ("tval_rls") false thm ct);
79.56 +val (ct,asm) = the (rewrite thy' "tless_true" ("tval_rls") false thm ct);
79.57 +val thm = ("length_Nil_","");
79.58 +val (ct,asm) = the (rewrite thy' "tless_true" ("tval_rls") false thm ct);
79.59 +if ct="1 + (1 + (1 + 0))"then()
79.60 +else raise error ("list_rls.sml 1: behaviour of test-expl changed: "^ct);
79.61 +
79.62 +
79.63 +val ct = "length_ [1,1,1]";
79.64 +val rls = "list_rls";
79.65 +val (ct,asm) = the (rewrite_set thy' false rls ct);
79.66 +if ct="3"then()
79.67 +else raise error ("list_rls.sml 2: behaviour of test-expl changed: "^ct);
79.68 +
79.69 +
79.70 +val ct = "length_ [1,1,1]";
79.71 +val t = (term_of o the o (parse ListG.thy)) ct;
79.72 +val t = eval_listexpr_ ListG.thy list_rls t;
79.73 +case t of Free ("3",_) => ()
79.74 +| _ => raise error ("list-rls.sml 3: behaviour of test-expl changed: "^ct);
79.75 +
79.76 +
80.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
80.2 +++ b/test/Tools/isac/ProgLang/rewrite.sml Mon Aug 30 14:35:51 2010 +0200
80.3 @@ -0,0 +1,201 @@
80.4 +(* tests for ME/rewrite.sml
80.5 + TODO.WN0509 collect typical tests from systest here !!!!!
80.6 + author: Walther Neuper 050908
80.7 + (c) copyright due to lincense terms.
80.8 +
80.9 +use"../smltest/Scripts/rewrite.sml";
80.10 +use"rewrite.sml";
80.11 +*)
80.12 +
80.13 +"-----------------------------------------------------------------";
80.14 +"table of contents -----------------------------------------------";
80.15 +"-----------------------------------------------------------------";
80.16 +"----------- assemble rewrite ------------------------------------";
80.17 +"----------- test rewriting without Isac's thys ------------------";
80.18 +"----------- conditional rewriting without Isac's thys -----------";
80.19 +"----------- rewrite_terms_ -------------------------------------";
80.20 +"----------- rewrite_inst_ bdvs ----------------------------------";
80.21 +"-----------------------------------------------------------------";
80.22 +"-----------------------------------------------------------------";
80.23 +"-----------------------------------------------------------------";
80.24 +
80.25 +"----------- assemble rewrite ------------------------------------";
80.26 +"----------- assemble rewrite ------------------------------------";
80.27 +"----------- assemble rewrite ------------------------------------";
80.28 +(*ML {**)
80.29 +"===== rewriting by thm with 'a";
80.30 +show_types := true;
80.31 +val thy = @{theory Complex_Main};
80.32 +val ctxt = @{context};
80.33 +val thm = @{thm add_commute};
80.34 +val t = (term_of o the) (parse thy "((r + u) + t) + s");
80.35 +"----- from old: fun rewrite__";
80.36 +val bdv = [];
80.37 +val r = (((inst_bdv bdv) o norm o #prop o rep_thm) thm);
80.38 +"----- from old: and rew_sub";
80.39 +val (lhs,rhs) = (dest_equals' o strip_trueprop
80.40 + o Logic.strip_imp_concl) r;
80.41 +(* old
80.42 +val insts = Pattern.match thy (lhs,t) (Vartab.empty, Vartab.empty);*)
80.43 +"----- fun match_rew in Pure/pattern.ML";
80.44 +val rtm = the_default rhs (Term.rename_abs lhs t rhs);
80.45 +
80.46 +tracing(Syntax.string_of_term ctxt rtm);
80.47 +tracing(Syntax.string_of_term ctxt lhs);
80.48 +tracing(Syntax.string_of_term ctxt t);
80.49 +
80.50 +(Pattern.match thy (lhs, t) (Vartab.empty, Vartab.empty));
80.51 +val (rew, rhs) = (Envir.subst_term
80.52 + (Pattern.match thy (lhs, t) (Vartab.empty, Vartab.empty)) rtm, rtm);
80.53 +(*lookup in isabelle?trace?response...*)
80.54 +writeln(Syntax.string_of_term ctxt rew);
80.55 +writeln(Syntax.string_of_term ctxt rhs);
80.56 +(*}
80.57 +ML {*)
80.58 +"===== rewriting: prep insertion into rew_sub";
80.59 +val thy = @{theory Complex_Main};
80.60 +val ctxt = @{context};
80.61 +val thm = @{thm nonzero_mult_divide_cancel_right};
80.62 +val r = Thm.prop_of thm;
80.63 +val tm = @{term "x*2 / 2::real"};
80.64 +"----- and rew_sub";
80.65 +val (lhs, rhs) = (HOLogic.dest_eq o HOLogic.dest_Trueprop
80.66 + o Logic.strip_imp_concl) r;
80.67 +val r' = Envir.subst_term (Pattern.match thy (lhs, tm)
80.68 + (Vartab.empty, Vartab.empty)) r;
80.69 +val p' = (fst o Logic.strip_prems) (Logic.count_prems r', [], r');
80.70 +val t' = (snd o HOLogic.dest_eq o HOLogic.dest_Trueprop
80.71 + o Logic.strip_imp_concl) r';
80.72 +
80.73 +(*is displayed on top of <response> buffer...*)
80.74 +Pretty.writeln (ProofContext.pretty_term_abbrev @{context} r');
80.75 +Pretty.writeln (ProofContext.pretty_term_abbrev @{context} t');
80.76 +(*}*)
80.77 +
80.78 +"----------- test rewriting without Isac's thys ------------------";
80.79 +"----------- test rewriting without Isac's thys ------------------";
80.80 +"----------- test rewriting without Isac's thys ------------------";
80.81 +(*ML {*)
80.82 +"===== rewriting with Isabelle2009-1 only, i.e without isac-hacks";
80.83 +val thy = @{theory Complex_Main};
80.84 +val ctxt = @{context};
80.85 +val thm = @{thm add_commute};
80.86 +val tm = @{term "x + y*z::real"};
80.87 +
80.88 +val SOME (r,_) = (rewrite_ thy dummy_ord e_rls false thm tm)
80.89 + handle _ => error "rewrite.sml diff.behav. in rewriting with Isabelle2009-1 only";
80.90 +(*is displayed on _TOP_ of <response> buffer...*)
80.91 +Pretty.writeln (ProofContext.pretty_term_abbrev @{context} r);
80.92 +
80.93 +"----- rewriting a subterm";
80.94 +val tm = @{term "w*(x + y*z)::real"};
80.95 +
80.96 +val SOME (r,_) = (rewrite_ thy dummy_ord e_rls false thm tm)
80.97 + handle _ => error "rewrite.sml diff.behav. in rew_sub with Isabelle2009-1 only";
80.98 +
80.99 +"----- ordered rewriting";
80.100 +fun tord (_:subst) pp = TermOrd.termless pp;
80.101 +if tord [] (@{term "x + y*z::real"}, @{term "y*z + x::real"}) then ()
80.102 +else error "rewrite.sml diff.behav. in ord.rewr. with Isabelle2009-1 only";
80.103 +
80.104 +val NONE = (rewrite_ thy tord e_rls false thm tm)
80.105 + handle _ => error "rewrite.sml diff.behav. in rewriting with Isabelle2009-1 only";
80.106 +(*is displayed on _TOP_ of <response> buffer...*)
80.107 +Pretty.writeln (ProofContext.pretty_term_abbrev @{context} r);
80.108 +
80.109 +val tm = @{term "x*y + z::real"};
80.110 +val SOME (r,_) = (rewrite_ thy tord e_rls false thm tm)
80.111 + handle _ => error "rewrite.sml diff.behav. in rewriting with Isabelle2009-1 only";
80.112 +
80.113 +
80.114 +(*}*)
80.115 +
80.116 +"----------- conditional rewriting without Isac's thys -----------";
80.117 +"----------- conditional rewriting without Isac's thys -----------";
80.118 +"----------- conditional rewriting without Isac's thys -----------";
80.119 +(*ML {*)
80.120 +"===== prepr cond.rew. with Pattern.match";
80.121 +val thy = @{theory Complex_Main};
80.122 +val ctxt = @{context};
80.123 +val thm = @{thm nonzero_mult_divide_cancel_right};
80.124 +val rule = Thm.prop_of thm;
80.125 +val tm = @{term "x*2 / 2::real"};
80.126 +
80.127 +val prem = Logic.strip_imp_prems rule;
80.128 +val nps = Logic.count_prems rule;
80.129 +val prems = Logic.strip_prems (nps, [], rule);
80.130 +
80.131 +val eq = Logic.strip_imp_concl rule;
80.132 +val (lhs, rhs) = (HOLogic.dest_eq o HOLogic.dest_Trueprop) eq;
80.133 +
80.134 +val mtcs = Pattern.match thy (lhs, tm) (Vartab.empty, Vartab.empty);
80.135 +val rule' = Envir.subst_term mtcs rule;
80.136 +
80.137 +val prems' = (fst o Logic.strip_prems)
80.138 + (Logic.count_prems rule', [], rule');
80.139 +val rhs' = (snd o HOLogic.dest_eq o HOLogic.dest_Trueprop
80.140 + o Logic.strip_imp_concl) rule';
80.141 +
80.142 +"----- conditional rewriting creating an assumption";
80.143 +"----- conditional rewriting creating an assumption";
80.144 +val tm = @{term "x*y / y::real"};
80.145 +val SOME (rew,asm) = (rewrite_ thy dummy_ord e_rls false thm tm)
80.146 + handle _ => error "rewrite.sml diff.behav. in cond.rew. with Isabelle2009-1 only a";
80.147 +
80.148 +if rew = @{term "x::real"} then ()
80.149 +else error "rewrite.sml diff.behav. in cond.rew. with Isabelle2009-1 only b";
80.150 +
80.151 +if HOLogic.dest_Trueprop (hd asm) = @{term "~ y = (0::real)"} then ()
80.152 +else error "rewrite.sml diff.behav. in cond.rew. with Isabelle2009-1 only c";
80.153 +
80.154 +"----- conditional rewriting immediately: can only be done with Isabelle numerals\
80.155 +\because erls cannot handle them yet.";
80.156 +(*}*)
80.157 +
80.158 +
80.159 +"----------- rewrite_terms_ -------------------------------------";
80.160 +"----------- rewrite_terms_ -------------------------------------";
80.161 +"----------- rewrite_terms_ -------------------------------------";
80.162 +val subte = [str2term"x = 0"];
80.163 +val t = str2term"M_b x = -1 * q_0 * x ^^^ 2 / 2 + x * c + c_2";
80.164 +val SOME (t',_) = rewrite_terms_ thy dummy_ord Erls subte t;
80.165 +if term2str t' = "M_b 0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2" then ()
80.166 +else raise error "rewrite.sml rewrite_terms_ [x = 0]";
80.167 +
80.168 +val subte = [str2term"M_b 0 = 0"];
80.169 +val t = str2term"M_b 0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2";
80.170 +val SOME (t',_) = rewrite_terms_ thy dummy_ord Erls subte t;
80.171 +if term2str t' = "0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2" then ()
80.172 +else raise error "rewrite.sml rewrite_terms_ [M_b 0 = 0]";
80.173 +
80.174 +val subte = [str2term"x = 0", str2term"M_b 0 = 0"];
80.175 +val t = str2term"M_b x = -1 * q_0 * x ^^^ 2 / 2 + x * c + c_2";
80.176 +val SOME (t',_) = rewrite_terms_ thy dummy_ord Erls subte t;
80.177 +if term2str t' = "0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2" then ()
80.178 +else raise error "rewrite.sml rewrite_terms_ [x = 0, M_b 0 = 0]";
80.179 +
80.180 +
80.181 +"----------- rewrite_inst_ bdvs ----------------------------------";
80.182 +"----------- rewrite_inst_ bdvs ----------------------------------";
80.183 +"----------- rewrite_inst_ bdvs ----------------------------------";
80.184 +(*see smltest/Scripts/term_G.sml: inst_bdv 2*)
80.185 +val t = str2term"-1 * (q_0 * L ^^^ 2) / 2 + (L * c_3 + c_4) = 0";
80.186 +val bdvs = [(str2term"bdv_1",str2term"c"),
80.187 + (str2term"bdv_2",str2term"c_2"),
80.188 + (str2term"bdv_3",str2term"c_3"),
80.189 + (str2term"bdv_4",str2term"c_4")];
80.190 +(*------------ outcommented WN071210, after inclusion into ROOT.ML
80.191 +val SOME (t,_) =
80.192 + rewrite_inst_ thy e_rew_ord
80.193 + (append_rls "erls_isolate_bdvs" e_rls
80.194 + [(Calc ("EqSystem.occur'_exactly'_in",
80.195 + eval_occur_exactly_in
80.196 + "#eval_occur_exactly_in_"))
80.197 + ])
80.198 + false bdvs (num_str separate_bdvs_add) t;
80.199 +(writeln o term2str) t;
80.200 +if term2str t = "L * c_3 + c_4 = 0 + -1 * (-1 * (q_0 * L ^^^ 2) / 2)"
80.201 +then () else raise error "rewrite.sml rewrite_inst_ bdvs";
80.202 +trace_rewrite:=true;
80.203 +trace_rewrite:=false;--------------------------------------------*)
80.204 +
81.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
81.2 +++ b/test/Tools/isac/ProgLang/scrtools.sml Mon Aug 30 14:35:51 2010 +0200
81.3 @@ -0,0 +1,193 @@
81.4 +(* tests on tools for scripts
81.5 + author: Walther Neuper
81.6 + 060605,
81.7 + (c) due to copyright terms
81.8 +
81.9 +use"../smltest/Scripts/scrtools.sml";
81.10 +use"scrtools.sml";
81.11 +*)
81.12 +"-----------------------------------------------------------------";
81.13 +"table of contents -----------------------------------------------";
81.14 +"-----------------------------------------------------------------";
81.15 +"-------- test auto-generated script '(Repeat (Calculate times))'-";
81.16 +"-------- test the same called by interSteps norm_Poly -----------";
81.17 +"-------- test the same called by interSteps norm_Rational -------";
81.18 +"-------- check auto-gen.script for Rewrite_Set_Inst -------------";
81.19 +"-----------------------------------------------------------------";
81.20 +"-----------------------------------------------------------------";
81.21 +"-----------------------------------------------------------------";
81.22 +
81.23 +
81.24 +"-------- test auto-generated script '(Repeat (Calculate times))'-";
81.25 +"-------- test auto-generated script '(Repeat (Calculate times))'-";
81.26 +"-------- test auto-generated script '(Repeat (Calculate times))'-";
81.27 +val Seq {scr = Script auto_script,...} = assoc_rls "norm_Poly";
81.28 +writeln(term2str auto_script);
81.29 +atomty auto_script;
81.30 +
81.31 +store_met
81.32 + (prep_met Test.thy "met_testinter" [] e_metID
81.33 + (["Test","test_interSteps_1"]:metID,
81.34 + [("#Given" ,["term t_"]),
81.35 + ("#Find" ,["normalform n_"])
81.36 + ],
81.37 + {rew_ord'="dummy_ord",rls'=tval_rls,calc=[],srls=e_rls,prls=e_rls,
81.38 + crls=tval_rls, nrls=e_rls},
81.39 +"Script Stepwise t_ = \
81.40 + \(Try (Rewrite_Set discard_minus_ False) @@ \
81.41 + \ Try (Rewrite_Set expand_poly_ False) @@ \
81.42 + \ Try (Repeat (Calculate times)) @@ \
81.43 + \ Try (Rewrite_Set order_mult_rls_ False) @@ \
81.44 + \ Try (Rewrite_Set simplify_power_ False) @@ \
81.45 + \ Try (Rewrite_Set calc_add_mult_pow_ False) @@\
81.46 + \ Try (Rewrite_Set reduce_012_mult_ False) @@ \
81.47 + \ Try (Rewrite_Set order_add_rls_ False) @@ \
81.48 + \ Try (Rewrite_Set collect_numerals_ False) @@ \
81.49 + \ Try (Rewrite_Set reduce_012_ False) @@ \
81.50 + \ Try (Rewrite_Set discard_parentheses_ False))\
81.51 + \ t_"
81.52 +(*presently this script cannot become equal in types to auto_script, because:
81.53 + this t_ must be either 'real' or 'bool' #1#,
81.54 + while the auto_script must be 'z and type-instantiated before usage*)
81.55 + ));
81.56 +show_mets();
81.57 +val {scr = Script parsed_script,...} = get_met ["Test","test_interSteps_1"];
81.58 +writeln(term2str parsed_script);
81.59 +atomty parsed_script;
81.60 +
81.61 +(*the structure of the auto-gen. script is interpreted correctly*)
81.62 +states:=[];
81.63 +CalcTree
81.64 +[(["term (b + a - b)",(*this is Schalk 299b*)
81.65 + "normalform N"],
81.66 + ("Poly.thy",["polynomial","simplification"],
81.67 + ["Test","test_interSteps_1"]))];
81.68 +Iterator 1;
81.69 +moveActiveRoot 1;
81.70 +autoCalculate 1 CompleteCalcHead;
81.71 +
81.72 +fetchProposedTactic 1 (*..Apply_Method*);
81.73 +autoCalculate 1 (Step 1);
81.74 +getTactic 1 ([1], Frm) (*still empty*);
81.75 +
81.76 +fetchProposedTactic 1 (*discard_minus_*);
81.77 +autoCalculate 1 (Step 1);
81.78 +
81.79 +fetchProposedTactic 1 (*order_add_rls_*);
81.80 +autoCalculate 1 (Step 1);
81.81 +
81.82 +fetchProposedTactic 1 (*collect_numerals_*);
81.83 +autoCalculate 1 (Step 1);
81.84 +
81.85 +autoCalculate 1 CompleteCalc;
81.86 +
81.87 +val ((pt,p),_) = get_calc 1; show_pt pt;
81.88 +if existpt' ([1], Frm) pt then ()
81.89 +else raise error "scrtools.sml: test-script test_interSteps_1 doesnt work";
81.90 +
81.91 +
81.92 +"-------- test the same called by interSteps norm_Poly -----------";
81.93 +"-------- test the same called by interSteps norm_Poly -----------";
81.94 +"-------- test the same called by interSteps norm_Poly -----------";
81.95 +val Seq {scr = Script auto_script,...} = assoc_rls "norm_Poly";
81.96 +writeln(term2str auto_script);
81.97 +atomty auto_script;
81.98 +
81.99 +states:=[];
81.100 +CalcTree
81.101 +[(["term (b + a - b)", "normalform N"],
81.102 + ("Poly.thy",["polynomial","simplification"],
81.103 + ["simplification","for_polynomials"]))];
81.104 +Iterator 1;
81.105 +moveActiveRoot 1;
81.106 +autoCalculate 1 CompleteCalc;
81.107 +
81.108 +interSteps 1 ([], Res);
81.109 +val ((pt,p),_) = get_calc 1; show_pt pt;
81.110 +
81.111 +interSteps 1 ([1], Res);
81.112 +val ((pt,p),_) = get_calc 1; show_pt pt;
81.113 +if existpt' ([1,4], Res) pt then ()
81.114 +else raise error "scrtools.sml: auto-generated norm_Poly doesnt work";
81.115 +
81.116 +
81.117 +
81.118 +"-------- test the same called by interSteps norm_Rational -------";
81.119 +"-------- test the same called by interSteps norm_Rational -------";
81.120 +"-------- test the same called by interSteps norm_Rational -------";
81.121 +val Seq {scr = Script auto_script,...} = assoc_rls "norm_Rational";
81.122 +writeln(term2str auto_script);
81.123 +atomty auto_script;
81.124 +(***
81.125 +*** Const (Script.Stepwise, ['z, 'z] => 'z)
81.126 +*** . Free (t_, 'z)
81.127 +*** . Const (Script.Seq, ['a => 'a, 'a => 'a, 'a] => 'a)
81.128 +*** . . Const (Script.Try, ['a => 'a, 'a] => 'a)
81.129 +*** . . . Const (Script.Rewrite'_Set, [Script.ID, bool, 'a] => 'a)
81.130 +*** . . . . Free (discard_minus_, Script.ID)
81.131 +*** . . . . Const (False, bool)
81.132 +*** . . Const (Script.Seq, ['a => 'a, 'a => 'a, 'a] => 'a)
81.133 +*** . . . Const (Script.Try, ['a => 'a, 'a] => 'a)
81.134 +*** . . . . Const (Script.Rewrite'_Set, [Script.ID, bool, 'a] => 'a)
81.135 +*** . . . . . Free (rat_mult_poly, Script.ID)
81.136 +*** . . . . . Const (False, bool)
81.137 +*** . . . Const (Script.Seq, ['a => 'a, 'a => 'a, 'a] => 'a)
81.138 +*** . . . . Const (Script.Try, ['a => 'a, 'a] => 'a)
81.139 +*** . . . . . Const (Script.Rewrite'_Set, [Script.ID, bool, 'a] => 'a)
81.140 +*** . . . . . . Free (make_rat_poly_with_parentheses, Script.ID)
81.141 +*** . . . . . . Const (False, bool)
81.142 +*** . . . . Const (Script.Seq, ['a => 'a, 'a => 'a, 'a] => 'a)
81.143 +*** . . . . . Const (Script.Try, ['a => 'a, 'a] => 'a)
81.144 +*** . . . . . . Const (Script.Rewrite'_Set, [Script.ID, bool, 'a] => 'a)
81.145 +*** . . . . . . . Free (cancel_p_rls, Script.ID)
81.146 +*** . . . . . . . Const (False, bool)
81.147 +*** . . . . . Const (Script.Seq, ['a => 'a, 'a => 'a, 'a] => 'a)
81.148 +*** . . . . . . Const (Script.Try, ['a => 'a, 'a] => 'a)
81.149 +*** . . . . . . . Const (Script.Rewrite'_Set, [Script.ID, bool, 'a] => 'a)
81.150 +*** . . . . . . . . Free (norm_Rational_rls, Script.ID)
81.151 +*** . . . . . . . . Const (False, bool)
81.152 +*** . . . . . . Const (Script.Try, ['a => 'a, 'a] => 'a)
81.153 +*** . . . . . . . Const (Script.Rewrite'_Set, [Script.ID, bool, 'a] => 'a)
81.154 +*** . . . . . . . . Free (discard_parentheses_, Script.ID)
81.155 +*** . . . . . . . . Const (False, bool)
81.156 +*** . . Free (t_, 'a)
81.157 +***)
81.158 +states:=[];
81.159 +CalcTree
81.160 +[(["term (b + a - b)", "normalform N"],
81.161 + ("Poly.thy",["polynomial","simplification"],
81.162 + ["simplification","of_rationals"]))];
81.163 +Iterator 1;
81.164 +moveActiveRoot 1;
81.165 +autoCalculate 1 CompleteCalc;
81.166 +
81.167 +interSteps 1 ([], Res);
81.168 +val ((pt,p),_) = get_calc 1; show_pt pt;
81.169 +
81.170 +interSteps 1 ([1], Res);
81.171 +val ((pt,p),_) = get_calc 1; show_pt pt;
81.172 +
81.173 +(*with "Script SimplifyScript (t_::real) = \
81.174 + \ ((Rewrite_Set norm_Rational False) t_)"
81.175 +val (Form form, SOME tac, asm) = pt_extract (pt, ([1], Res));
81.176 +*)
81.177 +val (Form form, SOME tac, asm) = pt_extract (pt, ([2], Res));
81.178 +case (term2str form, tac, terms2strs asm) of
81.179 + ("a", Check_Postcond ["polynomial", "simplification"], []) => ()
81.180 + | _ => raise error "scrtools.sml: auto-generated norm_Rational doesnt work";
81.181 +
81.182 +
81.183 +
81.184 +"-------- check auto-gen.script for Rewrite_Set_Inst -------------";
81.185 +"-------- check auto-gen.script for Rewrite_Set_Inst -------------";
81.186 +"-------- check auto-gen.script for Rewrite_Set_Inst -------------";
81.187 +val rls = assoc_rls "integration";
81.188 +val Seq {scr = Script auto_script,...} = rls;
81.189 +writeln(term2str auto_script);
81.190 +
81.191 +if contain_bdv (get_rules rls) then ()
81.192 +else raise error "scrtools.sml: contain_bdv doesnt work for 'integration'";
81.193 +
81.194 +two_scr_arg auto_script;
81.195 +init_istate (Rewrite_Set_Inst (["(bdv, x)"], "integration_rules"))
81.196 + (str2term "someTermWithBdv");
82.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
82.2 +++ b/test/Tools/isac/ProgLang/term_G.sml Mon Aug 30 14:35:51 2010 +0200
82.3 @@ -0,0 +1,168 @@
82.4 +(* tests on Scripts/term_G.sml
82.5 + author: Walther Neuper
82.6 + 051006,
82.7 + (c) due to copyright terms
82.8 +
82.9 +use"../smltest/Scripts/term_G.sml";
82.10 +use"term_G.sml";
82.11 +*)
82.12 +
82.13 +"-----------------------------------------------------------------";
82.14 +"table of contents -----------------------------------------------";
82.15 +"-----------------------------------------------------------------";
82.16 +"----------- inst_bdv --------------------------------------------";
82.17 +"----------- subst_atomic_all ------------------------------------";
82.18 +"----------- Pattern.match ---------------------------------------";
82.19 +"----------- fun matches -----------------------------------------";
82.20 +"------------parse------------------------------------------------";
82.21 +"----------- uminus_to_string ------------------------------------";
82.22 +"-----------------------------------------------------------------";
82.23 +"-----------------------------------------------------------------";
82.24 +
82.25 +
82.26 +"----------- inst_bdv --------------------------------------------";
82.27 +"----------- inst_bdv --------------------------------------------";
82.28 +"----------- inst_bdv --------------------------------------------";
82.29 +if string_of_thm (num_str d1_isolate_add2) =
82.30 + "\"~ ?bdv occurs_in ?a ==> (?a + ?bdv = 0) = (?bdv = -1 * ?a)\"" then ()
82.31 +else raise error "term_G.sml d1_isolate_add2";
82.32 +val subst = [(str2term "bdv", str2term "x")];
82.33 +val t = (norm o #prop o rep_thm) (num_str d1_isolate_add2);
82.34 +val t' = inst_bdv subst t;
82.35 +if term2str t' = "~ x occurs_in ?a ==> (?a + x = 0) = (x = -1 * ?a)" then ()
82.36 +else raise error "term_G.sml inst_bdv 1";
82.37 +
82.38 +if string_of_thm (num_str separate_bdvs_add) =
82.39 + "\"[] from_ [?bdv_1.0, ?bdv_2.0, ?bdv_3.0, ?bdv_4.0] occur_exactly_in ?a\n\
82.40 + \ ==> (?a + ?b = ?c) = (?b = ?c + -1 * ?a)\"" then ()
82.41 +else raise error "term_G.sml separate_bdvs_add";
82.42 +val subst = [(str2term"bdv_1",str2term"c"),
82.43 + (str2term"bdv_2",str2term"c_2"),
82.44 + (str2term"bdv_3",str2term"c_3"),
82.45 + (str2term"bdv_4",str2term"c_4")];
82.46 +val t = (norm o #prop o rep_thm) (num_str separate_bdvs_add);
82.47 +val t' = inst_bdv subst t;
82.48 +if term2str t' = "[] from_ [c, c_2, c_3, c_4] occur_exactly_in ?a\n\
82.49 + \==> (?a + ?b = ?c) = (?b = ?c + -1 * ?a)" then ()
82.50 +else raise error "term_G.sml inst_bdv 2";
82.51 +
82.52 +
82.53 +"----------- subst_atomic_all ------------------------------------";
82.54 +"----------- subst_atomic_all ------------------------------------";
82.55 +"----------- subst_atomic_all ------------------------------------";
82.56 +val t = str2term"(tl vs_) from_ vs_ occur_exactly_in (nth_ 1(es_::bool list))";
82.57 +val env = [(str2term"vs_::real list",str2term"[c, c_2]"),
82.58 + (str2term"es_::bool list",str2term"[c_2=0, c+c_2=1]")];
82.59 +val (all_Free_subst, t') = subst_atomic_all env t;
82.60 +if all_Free_subst andalso
82.61 + term2str t' = "tl [c, c_2] from_ [c, c_2] occur_exactly_in nth_ 1 [c_2 = 0, c + c_2 = 1]" then ()
82.62 +else raise error "term_G.sml subst_atomic_all should be 'true'";
82.63 +
82.64 +
82.65 +val (all_Free_subst, t') = subst_atomic_all (tl env) t;
82.66 +if not all_Free_subst andalso
82.67 + term2str t' = "tl vs_ from_ vs_ occur_exactly_in nth_ 1 [c_2 = 0, c + c_2 = 1]" then ()
82.68 +else raise error "term_G.sml subst_atomic_all should be 'false'";
82.69 +
82.70 +
82.71 +"----------- Pattern.match ---------------------------------------";
82.72 +"----------- Pattern.match ---------------------------------------";
82.73 +"----------- Pattern.match ---------------------------------------";
82.74 +val t = (term_of o the o (parse thy)) "3 * x^^^2 = 1";
82.75 +val pat = (free2var o term_of o the o (parse thy)) "a * b^^^2 = c";
82.76 +(* !^^^^^^^^!... necessary for Pattern.match*)
82.77 +val insts = Pattern.match (Sign.tsig_of (sign_of thy)) (pat, t);
82.78 +(*val insts =
82.79 + ([],
82.80 + [(("c",0),Free ("1","RealDef.real")),(("b",0),Free ("x","RealDef.real")),
82.81 + (("a",0),Free ("3","RealDef.real"))])
82.82 + : (indexname * typ) list * (indexname * term) list*)
82.83 +
82.84 +"----- throws exn MATCH...";
82.85 +val t = str2term "x";
82.86 +(Pattern.match (Sign.tsig_of (sign_of thy)) (pat, t))
82.87 +handle MATCH => ([(* (Term.indexname * Term.typ) *)],
82.88 + [(* (Term.indexname * Term.term) *)]);
82.89 +Pattern.MATCH;
82.90 +
82.91 +(*ML {**)
82.92 +val thy = @{theory Complex_Main};
82.93 +val PARSE = Syntax.read_term_global thy;
82.94 +val (pa, tm) = (PARSE "a + b::real", PARSE "x + 2*z::real");
82.95 +"-------";
82.96 +val (tye, tme) =
82.97 + (Vartab.empty : Type.tyenv, Vartab.empty : Envir.tenv);
82.98 +"-------";
82.99 +val (tye, tme) = Pattern.match thy (Logic.varify pa, tm) (Vartab.empty,
82.100 + Vartab.empty);
82.101 +"-------";
82.102 +val (tyenv, tenv) = Pattern.match thy (Logic.varify pa, tm)
82.103 + (Vartab.empty, Vartab.empty);
82.104 +Vartab.dest tenv;
82.105 +match thy tm (Logic.varify pa);
82.106 +
82.107 +(**}*)
82.108 +
82.109 +"----------- fun matches -----------------------------------------";
82.110 +"----------- fun matches -----------------------------------------";
82.111 +"----------- fun matches -----------------------------------------";
82.112 +(*smltest/IsacKnowledge/polyeq.sml:
82.113 + Where=[Correct "matches (?a = 0) (-8 - 2 * x + x ^^^ 2 = 0)"*)
82.114 +(*smltest/ME/ptyps.sml:
82.115 + |\nmatches (?a + ?b * x = #0) ((x + #1) * (x + #2) = x ^^^ #2 + #8)"],*)
82.116 +(*ML {**)
82.117 +val thy = @{theory Complex_Main};
82.118 +"----- test 1";
82.119 +val pa = Logic.varify @{term "a = (0::real)"};
82.120 +"----- test 1 true";
82.121 +val tm = @{term "-8 - 2 * x + x ^ 2 = (0::real)"};
82.122 +if matches thy tm pa then ()
82.123 + else error "term_G.sml diff.behav. in matches true";
82.124 +"----- test 2 false";
82.125 +val tm = @{term "-8 - 2 * x + x ^ 2 = (3::real)"};
82.126 +if matches thy tm pa then error "term_G.sml diff.behav. in matches false"
82.127 + else ();
82.128 +(**}*)
82.129 +
82.130 +"------------parse------------------------------------------------";
82.131 +"------------parse------------------------------------------------";
82.132 +"------------parse------------------------------------------------";
82.133 +(*ML {**)
82.134 +Toplevel.debug := true;
82.135 +(* literal types:
82.136 +PolyML.addPrettyPrinter
82.137 + (fn _ => fn _ => ml_pretty o Pretty.to_ML o raw_pp_typ);
82.138 +*)(* pretty types:
82.139 +PolyML.addPrettyPrinter
82.140 + (fn _ => fn _ => ml_pretty o Pretty.to_ML o Proof_Display.pp_typ Pure.thy);
82.141 +print_depth 99;
82.142 +*)
82.143 +val thy = @{theory Complex_Main};
82.144 +val str = "x + z";
82.145 +parse thy str;
82.146 +"---------------";
82.147 +val str = "x + 2*z";
82.148 +val t = (Syntax.read_term_global thy str);
82.149 +val t = numbers_to_string (Syntax.read_term_global thy str);
82.150 +val t = (typ_a2real o numbers_to_string) (Syntax.read_term_global thy str);
82.151 +cterm_of thy t;
82.152 +val t = (the (parse thy str)) handle _ => error "term_G.sml parsing 'x + 2*z' failed";
82.153 +(**}*)
82.154 +(*Makarius.1003
82.155 +ML {* @{term "2::int"} *}
82.156 +
82.157 +term "(1.24444) :: real"
82.158 +
82.159 +ML {* numbers_to_string @{term "%x. (-9993::int) + x + 1"} *}
82.160 +*)
82.161 +
82.162 +
82.163 +"----------- uminus_to_string ------------------------------------";
82.164 +"----------- uminus_to_string ------------------------------------";
82.165 +"----------- uminus_to_string ------------------------------------";
82.166 +(*ML {*)
82.167 +val t1 = numbers_to_string @{term "-2::real"};
82.168 +val t2 = numbers_to_string @{term "- 2::real"};
82.169 +if uminus_to_string t2 = t1 then ()
82.170 +else error "term_G.sml diff.behav. in uminus_to_string";
82.171 +(*}*)
83.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
83.2 +++ b/test/Tools/isac/ProgLang/tools.sml Mon Aug 30 14:35:51 2010 +0200
83.3 @@ -0,0 +1,27 @@
83.4 +(* tests on Tools
83.5 + author: Walther Neuper
83.6 + WN071229,
83.7 + (c) due to copyright terms
83.8 +
83.9 +use"../smltest/Scripts/tools.sml";
83.10 +use"tools.sml";
83.11 +*)
83.12 +val thy = Real.thy;
83.13 +
83.14 +"-----------------------------------------------------------------";
83.15 +"table of contents -----------------------------------------------";
83.16 +"-----------------------------------------------------------------";
83.17 +"----------- fun matchsub ----------------------------------------";
83.18 +"-----------------------------------------------------------------";
83.19 +"-----------------------------------------------------------------";
83.20 +"-----------------------------------------------------------------";
83.21 +
83.22 +
83.23 +"----------- fun matchsub ----------------------------------------";
83.24 +"----------- fun matchsub ----------------------------------------";
83.25 +"----------- fun matchsub ----------------------------------------";
83.26 +if matchsub thy (str2term "(a + (b + c))") (str2term "?x + (?y + ?z)")
83.27 +then () else raise error "tools.sml matchsub a + (b + c)";
83.28 +
83.29 +if matchsub thy (str2term "(a + (b + c)) + d") (str2term "?x + (?y + ?z)")
83.30 +then () else raise error "tools.sml matchsub (a + (b + c)) + d";
84.1 --- a/test/Tools/isac/Scripts/calculate-float.sml Mon Aug 30 14:29:49 2010 +0200
84.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
84.3 @@ -1,147 +0,0 @@
84.4 -(* (c) Stefan Rath 2005
84.5 - tests for sml/Scripts/calculate.sml
84.6 -
84.7 - use"~/proto2/isac/src/smltest/Scripts/calculate-float.sml";
84.8 - use"calculate-float.sml";
84.9 - *)
84.10 -
84.11 -
84.12 -(*WN.28.3.03 fuer Matthias*)
84.13 -(*Floatingpointnumbers, direkte Darstellung der abstrakten Syntax:*)
84.14 - val thy = Float.thy;
84.15 - val t = str2term "Float ((1,2),(0,0))";
84.16 - atomt t;
84.17 - val t = (term_of o the o (parse thy))
84.18 - "Float ((1,2),(0,0)) + Float ((3,4),(0,0)) * \
84.19 - \Float ((5,6),(0,0)) / Float ((7,8),(0,0))";
84.20 - atomt t;
84.21 -(*die konkrete Syntax wird noch verschoenert*)
84.22 -
84.23 - val thy = "Test.thy";
84.24 - val op_ = "divide_";
84.25 - val ct = "-6 / 3";
84.26 - val SOME (ct,_) = calculate thy (the (assoc (calclist, op_))) ct;
84.27 -
84.28 -(*-----WN050315------------------------------------------------------*)
84.29 -(*..*)
84.30 -val t = str2term "Float ((1,2),(0,0))";
84.31 -atomty t;
84.32 -val Const ("Float.Float",_) $
84.33 - (Const ("Pair",_) $
84.34 - (Const ("Pair",_) $ Free (i1,_) $ Free (i2,_)) $ _) = t;
84.35 -
84.36 -val t = str2term "Float ((1,2),(0,0)) + Float ((3,4),(0,0))";
84.37 -atomty t;
84.38 -(*-----WN050315------------------------------------------------------*)
84.39 -
84.40 -
84.41 -val thy = Float.thy;
84.42 -
84.43 -(*.calculate the value of a pair of floats.*)
84.44 -val ((a,b),(c,d)) = calc "op +" ((~1,0),(0,0)) ((2,0),(0,0));
84.45 -
84.46 -
84.47 -(*.build the term.*)
84.48 -term_of_float HOLogic.realT ((~1,0),(0,0));
84.49 -term_of_float HOLogic.realT ((~1,11),(0,0));
84.50 -
84.51 -(*--18.3.05-------------------------*)
84.52 -val t = Free ("sdfsdfsdf", HOLogic.realT);
84.53 -val t = Free ("-123,456", HOLogic.realT);
84.54 -val t = Free ("0,123456", HOLogic.realT);
84.55 -term2str t;
84.56 -(*----(1)------------------------------*)
84.57 -val t = str2term "IFloat (1, 2, 3)";
84.58 -val t = str2term "CFloat (1, 2)";
84.59 -atomt t;
84.60 -atomty t;
84.61 -val SOME ct = parse Float.thy "IFloat (1, 2, 3)";
84.62 -val SOME ct = parse Float.thy "CFloat (1, 2)";
84.63 -atomt (term_of ct);
84.64 -atomty (term_of ct);
84.65 -(*----(2)------------------------------*)
84.66 -val SOME ct = parse Float.thy "IFloat (-1, 2, 3)";
84.67 -val t = (term_of ct);
84.68 -atomty t;
84.69 -(*#######################################################################3
84.70 -val Const
84.71 - ("Float.IFloat", _) $
84.72 - (Const
84.73 - ("Pair", _) $
84.74 - Free (no, _) $
84.75 - (Const
84.76 - ("Pair", _) $
84.77 - Free (commas, _) $ Free (exp, _))) = t;
84.78 -
84.79 -fun IFloat2CFloat
84.80 - (Const
84.81 - ("Float.IFloat", _) $
84.82 - (Const
84.83 - ("Pair", _) $
84.84 - Free (no, _) $
84.85 - (Const
84.86 - ("Pair", _) $
84.87 - Free (commas, _) $ Free (exp, _)))) =
84.88 - Const ("Float.CFloat", HOLogic.realT(*wrong type*)) $
84.89 - (Const
84.90 - ("Pair", HOLogic.realT(*wrong type*)) $
84.91 - Free (no^"."^commas, HOLogic.realT)
84.92 - $ Free ("accuracy", HOLogic.realT))
84.93 -
84.94 - | IFloat2CFloat t =
84.95 - raise error ("IFloat2CFloat: invalid argument "^term2str t);
84.96 -
84.97 -val cf = IFloat2CFloat t;
84.98 -term2str cf;
84.99 -
84.100 -(*in IsacKnowledge/Float.ML: fun pairt -> Pair-term*)
84.101 -
84.102 -fun CFloat2Free (Const ("Float.CFloat", _) $
84.103 - (Const ("Pair", _) $ Free (no_commas, _) $ _)) =
84.104 - Free (no_commas, HOLogic.realT);
84.105 -
84.106 -val t' = CFloat2Free cf;
84.107 -term2str t';
84.108 -
84.109 -fun CFloat2sml (Const ("Float.CFloat", _) $
84.110 - (Const ("Pair", _) $ Free (float, _) $ _(**))) =
84.111 - float;
84.112 -CFloat2sml cf;
84.113 -
84.114 -(*--18.3.05-------------------------*)
84.115 -
84.116 -
84.117 -(*.the function evaluating a binary operator.*)
84.118 -val t = str2term "Float ((1,2),(0,0)) + Float ((3,4),(0,0))";
84.119 -val SOME (thmid, t) = eval_binop "#add_" "op +" t thy;
84.120 -term2str t;
84.121 -
84.122 -
84.123 -(*.scan a term for a pair of floats.*)
84.124 - val SOME (thmid,t') = get_pair thy op_ eval_fn t;
84.125 -
84.126 -
84.127 -(*.use 'calculate' explicitly.*)
84.128 - val thy = Test.thy;
84.129 - val op_ = "divide_";
84.130 - val t = str2term "sqrt (x ^^^ 2 + -3 * x) =\
84.131 - \Float ((5,6),(0,0)) / Float ((7,8),(0,0))";
84.132 - val SOME (t',_) = calculate_ thy (the (assoc (calclist, op_))) t;
84.133 - term2str t';
84.134 -
84.135 -
84.136 -(*.rewrite with ruleset TEST...simplify (calling calculate internally.*)
84.137 -val t = str2term "a + Float ((1,2),(0,0)) + a + Float ((3,4),(0,0)) * \
84.138 - \Float ((5,6),(0,0)) / Float ((7,8),(0,0))";
84.139 -val SOME (t',_) = rewrite_set_ thy false norm_Rational(*///*) t; term2str t';
84.140 -(*Float ((...,...) + 2*a*)
84.141 -
84.142 -
84.143 -(*. parse a float as seen by the user .*)
84.144 -val SOME t = parse Float.thy "123.456";
84.145 -val SOME t = parse Float.thy "-123.456";
84.146 -val SOME t = parse Float.thy "123.456 E6789";
84.147 -val SOME t = parse Float.thy "123.456 E-6789";
84.148 -val SOME t = parse Float.thy "-123.456 E-6789";
84.149 -
84.150 -################################################################*)
85.1 --- a/test/Tools/isac/Scripts/calculate.sml Mon Aug 30 14:29:49 2010 +0200
85.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
85.3 @@ -1,471 +0,0 @@
85.4 -(* test calculation of values for function constants
85.5 - (c) Walther Neuper 2000
85.6 -
85.7 -use"../smltest/Scripts/calculate.sml";
85.8 -use"calculate.sml";
85.9 -*)
85.10 -
85.11 -" ================= calculate.sml: calculate_ ======================== ";
85.12 -" ================= calculate.sml: aus script ======================== ";
85.13 -" ================= calculate.sml: 2.8.02 check test-root-equ ======== ";
85.14 -"--------------(4): check bottom up: ---------------------------";
85.15 -" ================= calculate.sml:10.8.02 2002:///->/ ======== ";
85.16 -" ================= calculate.sml: calculate_ 2002 =================== ";
85.17 -"----------- get_pair with 3 args --------------------------------";
85.18 -" ================= eval_binop Float =================== ";
85.19 -"------------------ 3.6.03 (2 * x is_const) ---------------------------";
85.20 -
85.21 -(* [("Vars",("Tools.Vars",fn)),("Length",("Tools.Length",fn)),
85.22 - ("Nth",("Tools.Nth",fn)),
85.23 - ("power_",("Atools.pow",fn)),("plus",("op +",fn)),("times",("op *",fn)),
85.24 - ("is_const",("Atools.is'_const",fn)),
85.25 - ("le",("op <",fn)),("leq",("op <=",fn)),
85.26 - ("ident",("Atools.ident",fn))] *)
85.27 -
85.28 -val thy' = "Isac.thy";
85.29 -
85.30 -" ================= calculate.sml: calculate_ ======================== ";
85.31 -" ================= calculate.sml: calculate_ ======================== ";
85.32 -" ================= calculate.sml: calculate_ ======================== ";
85.33 -
85.34 -
85.35 -val thy = Test.thy;
85.36 -val t = (term_of o the o (parse thy)) "1+2";
85.37 -val SOME (thmID,thm) = get_calculation_ thy (the(assoc(calclist,"plus"))) t;
85.38 -
85.39 -val t = (term_of o the o (parse thy)) "((1+2)*4/3)^^^2";
85.40 -val SOME (thmID,thm) = get_calculation_ thy (the(assoc(calclist,"plus"))) t;
85.41 -val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
85.42 -Syntax.string_of_term (thy2ctxt thy) t;
85.43 -(*val it = "(#3 * #4 // #3) ^^^ #2" : string*)
85.44 -val SOME (thmID,thm) = get_calculation_ thy (the(assoc(calclist,"times"))) t;
85.45 -val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
85.46 -Syntax.string_of_term (thy2ctxt thy) t;
85.47 -(*val it = "(#12 // #3) ^^^ #2" : string*)
85.48 -val SOME (thmID,thm) = get_calculation_ thy(the(assoc(calclist,"divide_")))t;
85.49 -val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
85.50 -Syntax.string_of_term (thy2ctxt thy) t;
85.51 -(*it = "#4 ^^^ #2" : string*)
85.52 -val SOME (thmID,thm) = get_calculation_ thy(the(assoc(calclist,"power_")))t;
85.53 -val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
85.54 -Syntax.string_of_term (thy2ctxt thy) t;
85.55 -(*val it = "#16" : string*)
85.56 -if it <> "16" then raise error "calculate.sml: new behaviour in calculate_"
85.57 -else ();
85.58 -
85.59 -" ================= calculate.sml: aus script ======================== ";
85.60 -" ================= calculate.sml: aus script ======================== ";
85.61 -" ================= calculate.sml: aus script ======================== ";
85.62 -
85.63 -store_pbt
85.64 - (prep_pbt Test.thy "pbl_ttest" [] e_pblID
85.65 - (["test"],
85.66 - [],
85.67 - e_rls, NONE, []));
85.68 -store_pbt
85.69 - (prep_pbt Test.thy "pbl_ttest_calc" [] e_pblID
85.70 - (["calculate","test"],
85.71 - [("#Given" ,["realTestGiven t_"]),
85.72 - ("#Find" ,["realTestFind s_"])
85.73 - ],
85.74 - e_rls, NONE, [["Test","test_calculate"]]));
85.75 -
85.76 -store_met
85.77 - (prep_met Test.thy "met_testcal" [] e_metID
85.78 - (["Test","test_calculate"]:metID,
85.79 - [("#Given" ,["realTestGiven t_"]),
85.80 - ("#Find" ,["realTestFind s_"])
85.81 - ],
85.82 - {rew_ord'="sqrt_right",rls'=tval_rls,srls=e_rls,prls=e_rls,
85.83 - calc=[("plus" ,("op +" ,eval_binop "#add_")),
85.84 - ("times" ,("op *" ,eval_binop "#mult_")),
85.85 - ("divide_" ,("HOL.divide" ,eval_cancel "#divide_")),
85.86 - ("power_" ,("Atools.pow" ,eval_binop "#power_"))],
85.87 - crls=tval_rls, nrls=e_rls(*,
85.88 - asm_rls=[],asm_thm=[]*)},
85.89 - "Script STest_simplify (t_::real) = \
85.90 - \(Repeat \
85.91 - \ ((Try (Repeat (Calculate plus))) @@ \
85.92 - \ (Try (Repeat (Calculate times))) @@ \
85.93 - \ (Try (Repeat (Calculate divide_))) @@ \
85.94 - \ (Try (Repeat (Calculate power_))))) t_"
85.95 - ));
85.96 -
85.97 -val fmz = ["realTestGiven (((1+2)*4/3)^^^2)","realTestFind s"];
85.98 -val (dI',pI',mI') =
85.99 - ("Test.thy",["calculate","test"],["Test","test_calculate"]);
85.100 -(*val p = e_pos'; val c = [];
85.101 -val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
85.102 -val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
85.103 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
85.104 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
85.105 -(*nxt =("Add_Given",Add_Given "realTestGiven (((#1 + #2) * #4 // #3) ^^^#2)")*)
85.106 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
85.107 -(*nxt = ("Add_Find",Add_Find "realTestFind s") : string * tac*)
85.108 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
85.109 -(*nxt = ("Specify_Theory",Specify_Theory "Test.thy") : string * tac*)
85.110 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
85.111 -(*nxt = ("Specify_Problem",Specify_Problem ["calculate","test"])*)
85.112 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
85.113 -(*nxt = ("Specify_Method",Specify_Method ("Test.thy","test_calculate"))*)
85.114 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
85.115 -(*nxt = ("Apply_Method",Apply_Method ("Test.thy","test_calculate"))*)
85.116 -
85.117 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
85.118 -(*nxt = ("Calculate",Calculate "plus")*)
85.119 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
85.120 -(*nxt = ("Calculate",Calculate "times")*)
85.121 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
85.122 -(*nxt = ("Calculate",Calculate "divide_")*)
85.123 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
85.124 -(*nxt = ("Calculate",Calculate "power_")*)
85.125 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
85.126 -(*nxt = ("Check_Postcond",Check_Postcond ["calculate","test"])*)
85.127 -val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
85.128 -(*nxt = ("End_Proof'",End_Proof')*)
85.129 -if f = Form' (FormKF (~1,EdUndef,0,Nundef,"16")) then ()
85.130 -else raise error "calculate.sml: script test_calculate changed behaviour";
85.131 -
85.132 -
85.133 -
85.134 -
85.135 -" ================= calculate.sml: 2.8.02 check test-root-equ ======== ";
85.136 -" ================= calculate.sml: 2.8.02 check test-root-equ ======== ";
85.137 -" ================= calculate.sml: 2.8.02 check test-root-equ ======== ";
85.138 -(*(1): 2nd Test_simplify didn't work:
85.139 -val ct =
85.140 - "sqrt (x ^^^ 2 + -3 * x) = (-3 + 2 * x + -1 * (9 + 4 * x)) / (-1 * 2)"
85.141 -> val rls = ("Test_simplify");
85.142 -> val (ct,_) = the (rewrite_set thy' ("tval_rls") false rls ct);
85.143 -val ct = "sqrt (x ^^^ 2 + -3 * x) =
85.144 -(-9) / (-2) + (-3 / (-2) + (x * ((-4) / (-2)) + x * (2 / (-2))))";
85.145 -ie. cancel does not work properly
85.146 -*)
85.147 - val thy = "Test.thy";
85.148 - val op_ = "divide_";
85.149 - val ct = "sqrt (x ^^^ 2 + -3 * x) =\
85.150 - \(-9) / (-2) + (-3 / (-2) + (x * ((-4) / (-2)) + x * (2 / (-2))))";
85.151 - val SOME (ct,_) = calculate thy (the(assoc(calclist,op_))) ct;
85.152 - writeln ct;
85.153 -(*
85.154 - sqrt (x ^^^ 2 + -3 * x) =\
85.155 - \(-9) / (-2) + (-3 / (-2) + (x * ((-4) / (-2)) + x * (2 / (-2))))
85.156 -............... does not work *)
85.157 -
85.158 -(*--------------(2): does divide work in Test_simplify ?: ------*)
85.159 - val thy = Test.thy;
85.160 - val t = (term_of o the o (parse thy)) "6 / 2";
85.161 - val rls = Test_simplify;
85.162 - val (t,_) = the (rewrite_set_ thy false rls t);
85.163 -(*val t = Free ("3","RealDef.real") : term*)
85.164 -
85.165 - val thy = "Test.thy";
85.166 - val t = "6 / 2";
85.167 - val rls = "Test_simplify";
85.168 - val (t,_) = the (rewrite_set thy false rls t);
85.169 -(*val t = "3" : string
85.170 - ....... works, thus: which rule in SqRoot_simplify works differently ?*)
85.171 -
85.172 -
85.173 -(*--------------(3): is_const works ?: -------------------------------------*)
85.174 - val t = (term_of o the o (parse Test.thy)) "2 is_const";
85.175 - atomty t;
85.176 - rewrite_set_ Test.thy false tval_rls t;
85.177 -(*val it = SOME (Const ("True","bool"),[]) ... works*)
85.178 -
85.179 - val t = str2term "2 * x is_const";
85.180 - val SOME (str,t') = eval_const "" "" t Isac.thy;
85.181 - term2str t';
85.182 -
85.183 -
85.184 -
85.185 -
85.186 -"--------------(4): check bottom up: ---------------------------";
85.187 -(*-------------- eval_cancel works: *)
85.188 - trace_rewrite:=true;
85.189 - val thy = Test.thy;
85.190 - val t = (term_of o the o (parse thy)) "(-4) / 2";
85.191 - val SOME (_,t) = eval_cancel "xxx" "HOL.divide" t thy;
85.192 - term2str t;
85.193 -"-4 / 2 = (-2)";
85.194 -(*-------------- but ... *)
85.195 - val ct = "x + (-4) / 2";
85.196 - val (ct,_) = the (rewrite_set thy' false rls ct);
85.197 -"(-2) + x";
85.198 -(*-------------- while ... *)
85.199 - val ct = "(-4) / 2";
85.200 - val (ct,_) = the (rewrite_set thy' false rls ct);
85.201 -"-2";
85.202 -
85.203 -(*--------------(5): reproduce (1) with simpler term: ------------*)
85.204 - val thy = "Test.thy";
85.205 - val t = "(3+5)/2";
85.206 - val (t,_) = the (rewrite_set thy false rls t);
85.207 -(*val t = "4" ... works*)
85.208 -
85.209 - val t = "(3+1+2*x)/2";
85.210 - val (t,_) = the (rewrite_set thy false rls t);
85.211 -(*val t = "2 + x" ... works*)
85.212 -
85.213 - trace_rewrite:=true; (*3.6.03*)
85.214 - val thy = "Test.thy";
85.215 - val rls = "Test_simplify";
85.216 - val t = "(3+(1+2*x))/2";
85.217 - val (t,_) = the (rewrite_set thy false rls t);
85.218 -(*val t = "2 + x" ... works: give up----------------------------------------*)
85.219 - trace_rewrite:=false;
85.220 -
85.221 - trace_rewrite:=true; (*3.6.03*)
85.222 - val thy = Test.thy;
85.223 - val rls = Test_simplify;
85.224 - val t = str2term "(3+(1+2*x))/2";
85.225 - val SOME (t',asm) = rewrite_set_ thy false rls t;
85.226 - term2str t';
85.227 -(*val t = "2 + x" ... works: give up----------------------------------------*)
85.228 - trace_rewrite:=false;
85.229 -
85.230 -
85.231 -
85.232 -
85.233 -(*--- trace_rewrite before correction of ... --------------------
85.234 - val ct = "(-3 + 2 * x + -1) / 2";
85.235 - val (ct,_) = the (rewrite_set thy' false rls ct);
85.236 -:
85.237 -### trying thm 'root_ge0_2'
85.238 -### rewrite_set_: x + (-1 + -3) / 2
85.239 -### trying thm 'radd_real_const_eq'
85.240 -### trying thm 'radd_real_const'
85.241 -### rewrite_set_: x + (-4) / 2
85.242 -### trying thm 'rcollect_right'
85.243 -:
85.244 -"x + (-4) / 2"
85.245 --------------------------------------while before Isabelle20002:
85.246 - val ct = "(#-3 + #2 * x + #-1) // #2";
85.247 - val (ct,_) = the (rewrite_set thy' false rls ct);
85.248 -:
85.249 -### trying thm 'root_ge0_2'
85.250 -### rewrite_set_: x + (#-1 + #-3) // #2
85.251 -### trying thm 'radd_real_const_eq'
85.252 -### trying thm 'radd_real_const'
85.253 -### rewrite_set_: x + #-4 // #2
85.254 -### rewrite_set_: x + #-2
85.255 -### trying thm 'rcollect_right'
85.256 -:
85.257 -"#-2 + x"
85.258 ------------------------------------------------------------------*)
85.259 -
85.260 -
85.261 - toggle trace_rewrite;
85.262 -(*===================*)
85.263 - trace_rewrite:=true;
85.264 - val thy' = "Test.thy";
85.265 - val rls = "Test_simplify";
85.266 - val ct = "x + (-1 + -3) / 2";
85.267 - val (ct,_) = the (rewrite_set thy' false rls ct);
85.268 -"x + (-4) / 2";
85.269 -(*
85.270 -### trying calc. 'cancel'
85.271 -@@@ get_pair: binop, t = x + (-4) / 2
85.272 -@@@ get_pair: t else
85.273 -@@@ get_pair: t else -> NONE
85.274 -@@@ get_pair: binop, t = (-4) / 2
85.275 -@@@ get_pair: then 1
85.276 -@@@ get_pair: t -> NONE
85.277 -@@@ get_pair: t1 -> NONE
85.278 -@@@ get_calculation: NONE
85.279 -### trying calc. 'pow'
85.280 -*)
85.281 -
85.282 - trace_rewrite:=true;
85.283 - val thy' = "Test.thy";
85.284 - val rls = "Test_simplify";
85.285 - val ct = "x + (-4) / 2";
85.286 - val (ct,_) = the (rewrite_set thy' false rls ct);
85.287 -"(-2) + x";
85.288 -(*
85.289 -### trying calc. 'cancel'
85.290 -@@@ get_pair: binop, t = x + -4 / 2
85.291 -@@@ get_pair: t else
85.292 -@@@ get_pair: t else -> NONE
85.293 -@@@ get_pair: binop, t = -4 / 2
85.294 -@@@ get_pair: then 1
85.295 -@@@ get_calculation: SOME #cancel_-4_2
85.296 -### calc. to: x + (-2)
85.297 -### trying calc. 'cancel'
85.298 -*)
85.299 - trace_rewrite:=false;
85.300 -
85.301 -" ================= calculate.sml:10.8.02 2002:///->/ ======== ";
85.302 -" ================= calculate.sml:10.8.02 2002:///->/ ======== ";
85.303 -" ================= calculate.sml:10.8.02 2002:///->/ ======== ";
85.304 -" ----------------- rewriting works ? -----------------------";
85.305 - val thy = Isac.thy;
85.306 - val prop = (#prop o rep_thm) real_divide_1;
85.307 - atomty prop;
85.308 -(*** -------------
85.309 -*** Const ( Trueprop, bool => prop)
85.310 -*** . Const ( op =, [real, real] => bool)
85.311 -*** . . Const ( HOL.divide, [real, real] => real)
85.312 -*** . . . Var ((x, 0), real)
85.313 -*** . . . Const ( 1, real)
85.314 -*** . . Var ((x, 0), real) *)
85.315 - val prop' = (#prop o rep_thm o num_str) real_divide_1;
85.316 - atomty prop';
85.317 -(*** -------------
85.318 -*** Const ( Trueprop, bool => prop)
85.319 -*** . Const ( op =, [real, real] => bool)
85.320 -*** . . Const ( HOL.divide, [real, real] => real)
85.321 -*** . . . Var ((x, 0), real)
85.322 -*** . . . Free ( 1, real) (*app_num_tr'*)
85.323 -*** . . Var ((x, 0), real)*)
85.324 - val t = (term_of o the o (parseold thy)) "aaa/1";
85.325 - atomty t;
85.326 -(*** -------------
85.327 -*** Const ( HOL.divide, ['a, 'a] => 'a)
85.328 -*** . Free ( aaa, 'a)
85.329 -*** . Free ( 1, 'a) *)
85.330 - val t = (term_of o the o (parse thy)) "aaa/1";
85.331 - atomty t;
85.332 -(*** -------------
85.333 -*** Const ( HOL.divide, [real, real] => real)
85.334 -*** . Free ( aaa, real)
85.335 -*** . Free ( 1, real) *)
85.336 - val thm = num_str real_divide_1;
85.337 - val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
85.338 -(*val t = Free ("aaa","RealDef.real") : term*)
85.339 -
85.340 -
85.341 - val prop = (#prop o rep_thm) realpow_eq_one;
85.342 - atomty prop;
85.343 -(*** -------------
85.344 -*** Const ( Trueprop, bool => prop)
85.345 -*** . Const ( op =, [real, real] => bool)
85.346 -*** . . Const ( Nat.power, [real, nat] => real)
85.347 -*** . . . Const ( 1, real)
85.348 -*** . . . Var ((n, 0), nat)
85.349 -*** . . Const ( 1, real) *)
85.350 - val prop' = (#prop o rep_thm o num_str) realpow_eq_one;
85.351 - atomty prop';
85.352 -(*** -------------
85.353 -*** Const ( Trueprop, bool => prop)
85.354 -*** . Const ( op =, [real, real] => bool)
85.355 -*** . . Const ( Nat.power, [real, nat] => real)
85.356 -*** . . . Free ( 1, real)
85.357 -*** . . . Var ((n, 0), nat)
85.358 -*** . . Free ( 1, real)*)
85.359 - val t = (term_of o the o (parseold thy)) "1 ^ aaa";
85.360 - atomty t;
85.361 -(*** -------------
85.362 -*** Const ( Nat.power, ['a, nat] => 'a)
85.363 -*** . Free ( 1, 'a)
85.364 -*** . Free ( aaa, nat) *)
85.365 - val t = (term_of o the o (parse thy)) "1 ^ aaa";
85.366 - atomty t;
85.367 -(*** -------------
85.368 -*** Const ( Nat.power, [real, nat] => real)
85.369 -*** . Free ( 1, real)
85.370 -*** . Free ( aaa, nat) .......................... nat !!! *)
85.371 - val thm = num_str realpow_eq_one;
85.372 - val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
85.373 -(*val t = Free ("1","RealDef.real") : term*)
85.374 -
85.375 -" ================= calculate.sml: calculate_ 2002 =================== ";
85.376 -" ================= calculate.sml: calculate_ 2002 =================== ";
85.377 -" ================= calculate.sml: calculate_ 2002 =================== ";
85.378 -
85.379 -val thy = Test.thy;
85.380 -val t = (term_of o the o (parse thy)) "12 / 3";
85.381 -val SOME (thmID,thm) = get_calculation_ thy(the(assoc(calclist,"divide_")))t;
85.382 -val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
85.383 -"12 / 3 = 4";
85.384 -val thy = Test.thy;
85.385 -val t = (term_of o the o (parse thy)) "4 ^^^ 2";
85.386 -val SOME (thmID,thm) = get_calculation_ thy(the(assoc(calclist,"power_"))) t;
85.387 -val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
85.388 -"4 ^ 2 = 16";
85.389 -
85.390 - val t = (term_of o the o (parse thy)) "((1 + 2) * 4 / 3) ^^^ 2";
85.391 - val SOME (thmID,thm) = get_calculation_ thy (the(assoc(calclist,"plus"))) t;
85.392 -"1 + 2 = 3";
85.393 - val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
85.394 - Syntax.string_of_term (thy2ctxt thy) t;
85.395 -"(3 * 4 / 3) ^^^ 2";
85.396 - val SOME (thmID,thm) = get_calculation_ thy (the(assoc(calclist,"times")))t;
85.397 -"3 * 4 = 12";
85.398 - val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
85.399 - Syntax.string_of_term (thy2ctxt thy) t;
85.400 -"(12 / 3) ^^^ 2";
85.401 - val SOME (thmID,thm) =get_calculation_ thy(the(assoc(calclist,"divide_")))t;
85.402 -"12 / 3 = 4";
85.403 - val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
85.404 - Syntax.string_of_term (thy2ctxt thy) t;
85.405 -"4 ^^^ 2";
85.406 - val SOME (thmID,thm) = get_calculation_ thy(the(assoc(calclist,"power_")))t;
85.407 -"4 ^^^ 2 = 16";
85.408 - val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
85.409 - Syntax.string_of_term (thy2ctxt thy) t;
85.410 -"16";
85.411 - if it <> "16" then raise error "calculate.sml: new behaviour in calculate_"
85.412 - else ();
85.413 -
85.414 -(*13.9.02 *** calc: operator = pow not defined*)
85.415 - val t = (term_of o the o (parse thy)) "3^^^2";
85.416 - val SOME (thmID,thm) =
85.417 - get_calculation_ thy (the(assoc(calclist,"power_"))) t;
85.418 -(*** calc: operator = pow not defined*)
85.419 -
85.420 - val (op_, eval_fn) = the (assoc(calclist,"power_"));
85.421 - (*
85.422 -val op_ = "Atools.pow" : string
85.423 -val eval_fn = fn : string -> term -> theory -> (string * term) option*)
85.424 -
85.425 - val SOME (thmid,t') = get_pair thy op_ eval_fn t;
85.426 -(*** calc: operator = pow not defined*)
85.427 -
85.428 - val SOME (id,t') = eval_fn op_ t thy;
85.429 -(*** calc: operator = pow not defined*)
85.430 -
85.431 - val (thmid, (Const (op0,t0) $ Free (n1,t1) $ Free(n2,t2))) = (op_, t);
85.432 - val SOME (id,t') = eval_binop thmid op_ t thy;
85.433 -(*** calc: operator = pow not defined*)
85.434 -
85.435 -
85.436 -"----------- get_pair with 3 args --------------------------------";
85.437 -"----------- get_pair with 3 args --------------------------------";
85.438 -"----------- get_pair with 3 args --------------------------------";
85.439 -val (thy, op_, ef, arg) =
85.440 - (thy, "EqSystem.occur'_exactly'_in",
85.441 - snd (the (assoc(!calclist',"occur_exactly_in"))),
85.442 - str2term
85.443 - "[] from_ [c, c_2, c_3, c_4] occur_exactly_in -1 * (q_0 * L ^^^ 2) / 2"
85.444 - );
85.445 -val SOME (str, simpl) = get_pair thy op_ ef arg;
85.446 -if str =
85.447 -"[] from_ [c, c_2, c_3, c_4] occur_exactly_in -1 * (q_0 * L ^^^ 2) / 2 = True"
85.448 -then () else raise error "calculate.sml get_pair with 3 args:occur_exactly_in";
85.449 -
85.450 -
85.451 -
85.452 -" ================= eval_binop Float =================== ";
85.453 -val t = str2term "Float ((1,2),(0,0))";
85.454 -atomty t;
85.455 -val Const ("Float.Float",_) $
85.456 - (Const ("Pair",_) $
85.457 - (Const ("Pair",_) $ Free (i1,_) $ Free (i2,_)) $ _) = t;
85.458 -
85.459 -val t = str2term "Float ((1,2),(0,0)) * Float ((3,4),(0,0))";
85.460 -atomty t;
85.461 -(*WN.10.4.03 eval_binop Float *)
85.462 -
85.463 -
85.464 -"------------------ 3.6.03 (2 * x is_const) ---------------------------";
85.465 -"------------------ 3.6.03 (2 * x is_const) ---------------------------";
85.466 -"------------------ 3.6.03 (2 * x is_const) ---------------------------";
85.467 -val t = str2term "2 * x is_const";
85.468 -val SOME (str, t') = eval_const "" "" t Test.thy;
85.469 -term2str t';
85.470 -"(2 * x is_const) = False";
85.471 -
85.472 -val SOME (t',_) = rewrite_set_ Test.thy false tval_rls t;
85.473 -term2str t';
85.474 -"False";
86.1 --- a/test/Tools/isac/Scripts/listg.sml Mon Aug 30 14:29:49 2010 +0200
86.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
86.3 @@ -1,73 +0,0 @@
86.4 -(* tests for ListG
86.5 - author: Walther Neuper 1.5.03
86.6 -
86.7 -use"../smltest/Scripts/listg.sml";
86.8 -use"listg.sml";
86.9 -*)
86.10 -
86.11 -
86.12 -
86.13 -"--------------------- nth_ ----------------------------------------------";
86.14 -"--------------------- nth_ ----------------------------------------------";
86.15 -"--------------------- nth_ ----------------------------------------------";
86.16 -val t = str2term "nth_ 3 [a,b,c,d,e]";
86.17 -atomty t;
86.18 -val thm = (#prop o rep_thm o num_str) nth_Cons_;
86.19 -atomty thm;
86.20 -val SOME (t',_) = rewrite_ thy dummy_ord Poly_erls false (num_str nth_Cons_) t;
86.21 -if term2str t' = "nth_ (3 + - 1) [b, c, d, e]" then ()
86.22 -else raise error "list_rls.sml, nth_ (3 + - 1) [b, c, d, e]";
86.23 -
86.24 -val t = str2term "nth_ 1 [a,b,c,d,e]";
86.25 -atomty t;
86.26 -val thm = (#prop o rep_thm o num_str) nth_Nil_;
86.27 -atomty thm;
86.28 -val SOME (t',_) = rewrite_ thy dummy_ord Poly_erls false (num_str nth_Nil_) t;
86.29 -term2str t';
86.30 -"a";
86.31 -
86.32 -val t = str2term "nth_ 3 [a,b,c,d,e]";
86.33 -atomty t;
86.34 -trace_rewrite:=true;
86.35 -val SOME (t',_) = rewrite_set_ thy false list_rls t;
86.36 -trace_rewrite:=false;
86.37 -term2str t';
86.38 -"c";
86.39 -
86.40 -(*-------------------------------------------------------------------*)
86.41 -val SOME (Thm (_,thm)) = rls_get_thm list_rls "nth_Nil_";
86.42 -val ttt = (#prop o rep_thm) thm;
86.43 -atomty ttt;
86.44 -(*Free ( 1, real) ...OK, Var ((x, 0), ?'a) OK*)
86.45 -
86.46 -
86.47 -
86.48 -"--------------------- length_ -------------------------------------------";
86.49 -"--------------------- length_ -------------------------------------------";
86.50 -"--------------------- length_ -------------------------------------------";
86.51 -val thy' = "ListG.thy";
86.52 -val ct = "length_ [1,1,1]";
86.53 -val thm = ("length_Cons_","");
86.54 -val (ct,asm) = the (rewrite thy' "tless_true" ("tval_rls") false thm ct);
86.55 -val (ct,asm) = the (rewrite thy' "tless_true" ("tval_rls") false thm ct);
86.56 -val (ct,asm) = the (rewrite thy' "tless_true" ("tval_rls") false thm ct);
86.57 -val thm = ("length_Nil_","");
86.58 -val (ct,asm) = the (rewrite thy' "tless_true" ("tval_rls") false thm ct);
86.59 -if ct="1 + (1 + (1 + 0))"then()
86.60 -else raise error ("list_rls.sml 1: behaviour of test-expl changed: "^ct);
86.61 -
86.62 -
86.63 -val ct = "length_ [1,1,1]";
86.64 -val rls = "list_rls";
86.65 -val (ct,asm) = the (rewrite_set thy' false rls ct);
86.66 -if ct="3"then()
86.67 -else raise error ("list_rls.sml 2: behaviour of test-expl changed: "^ct);
86.68 -
86.69 -
86.70 -val ct = "length_ [1,1,1]";
86.71 -val t = (term_of o the o (parse ListG.thy)) ct;
86.72 -val t = eval_listexpr_ ListG.thy list_rls t;
86.73 -case t of Free ("3",_) => ()
86.74 -| _ => raise error ("list-rls.sml 3: behaviour of test-expl changed: "^ct);
86.75 -
86.76 -
87.1 --- a/test/Tools/isac/Scripts/rewrite.sml Mon Aug 30 14:29:49 2010 +0200
87.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
87.3 @@ -1,201 +0,0 @@
87.4 -(* tests for ME/rewrite.sml
87.5 - TODO.WN0509 collect typical tests from systest here !!!!!
87.6 - author: Walther Neuper 050908
87.7 - (c) copyright due to lincense terms.
87.8 -
87.9 -use"../smltest/Scripts/rewrite.sml";
87.10 -use"rewrite.sml";
87.11 -*)
87.12 -
87.13 -"-----------------------------------------------------------------";
87.14 -"table of contents -----------------------------------------------";
87.15 -"-----------------------------------------------------------------";
87.16 -"----------- assemble rewrite ------------------------------------";
87.17 -"----------- test rewriting without Isac's thys ------------------";
87.18 -"----------- conditional rewriting without Isac's thys -----------";
87.19 -"----------- rewrite_terms_ -------------------------------------";
87.20 -"----------- rewrite_inst_ bdvs ----------------------------------";
87.21 -"-----------------------------------------------------------------";
87.22 -"-----------------------------------------------------------------";
87.23 -"-----------------------------------------------------------------";
87.24 -
87.25 -"----------- assemble rewrite ------------------------------------";
87.26 -"----------- assemble rewrite ------------------------------------";
87.27 -"----------- assemble rewrite ------------------------------------";
87.28 -(*ML {**)
87.29 -"===== rewriting by thm with 'a";
87.30 -show_types := true;
87.31 -val thy = @{theory Complex_Main};
87.32 -val ctxt = @{context};
87.33 -val thm = @{thm add_commute};
87.34 -val t = (term_of o the) (parse thy "((r + u) + t) + s");
87.35 -"----- from old: fun rewrite__";
87.36 -val bdv = [];
87.37 -val r = (((inst_bdv bdv) o norm o #prop o rep_thm) thm);
87.38 -"----- from old: and rew_sub";
87.39 -val (lhs,rhs) = (dest_equals' o strip_trueprop
87.40 - o Logic.strip_imp_concl) r;
87.41 -(* old
87.42 -val insts = Pattern.match thy (lhs,t) (Vartab.empty, Vartab.empty);*)
87.43 -"----- fun match_rew in Pure/pattern.ML";
87.44 -val rtm = the_default rhs (Term.rename_abs lhs t rhs);
87.45 -
87.46 -tracing(Syntax.string_of_term ctxt rtm);
87.47 -tracing(Syntax.string_of_term ctxt lhs);
87.48 -tracing(Syntax.string_of_term ctxt t);
87.49 -
87.50 -(Pattern.match thy (lhs, t) (Vartab.empty, Vartab.empty));
87.51 -val (rew, rhs) = (Envir.subst_term
87.52 - (Pattern.match thy (lhs, t) (Vartab.empty, Vartab.empty)) rtm, rtm);
87.53 -(*lookup in isabelle?trace?response...*)
87.54 -writeln(Syntax.string_of_term ctxt rew);
87.55 -writeln(Syntax.string_of_term ctxt rhs);
87.56 -(*}
87.57 -ML {*)
87.58 -"===== rewriting: prep insertion into rew_sub";
87.59 -val thy = @{theory Complex_Main};
87.60 -val ctxt = @{context};
87.61 -val thm = @{thm nonzero_mult_divide_cancel_right};
87.62 -val r = Thm.prop_of thm;
87.63 -val tm = @{term "x*2 / 2::real"};
87.64 -"----- and rew_sub";
87.65 -val (lhs, rhs) = (HOLogic.dest_eq o HOLogic.dest_Trueprop
87.66 - o Logic.strip_imp_concl) r;
87.67 -val r' = Envir.subst_term (Pattern.match thy (lhs, tm)
87.68 - (Vartab.empty, Vartab.empty)) r;
87.69 -val p' = (fst o Logic.strip_prems) (Logic.count_prems r', [], r');
87.70 -val t' = (snd o HOLogic.dest_eq o HOLogic.dest_Trueprop
87.71 - o Logic.strip_imp_concl) r';
87.72 -
87.73 -(*is displayed on top of <response> buffer...*)
87.74 -Pretty.writeln (ProofContext.pretty_term_abbrev @{context} r');
87.75 -Pretty.writeln (ProofContext.pretty_term_abbrev @{context} t');
87.76 -(*}*)
87.77 -
87.78 -"----------- test rewriting without Isac's thys ------------------";
87.79 -"----------- test rewriting without Isac's thys ------------------";
87.80 -"----------- test rewriting without Isac's thys ------------------";
87.81 -(*ML {*)
87.82 -"===== rewriting with Isabelle2009-1 only, i.e without isac-hacks";
87.83 -val thy = @{theory Complex_Main};
87.84 -val ctxt = @{context};
87.85 -val thm = @{thm add_commute};
87.86 -val tm = @{term "x + y*z::real"};
87.87 -
87.88 -val SOME (r,_) = (rewrite_ thy dummy_ord e_rls false thm tm)
87.89 - handle _ => error "rewrite.sml diff.behav. in rewriting with Isabelle2009-1 only";
87.90 -(*is displayed on _TOP_ of <response> buffer...*)
87.91 -Pretty.writeln (ProofContext.pretty_term_abbrev @{context} r);
87.92 -
87.93 -"----- rewriting a subterm";
87.94 -val tm = @{term "w*(x + y*z)::real"};
87.95 -
87.96 -val SOME (r,_) = (rewrite_ thy dummy_ord e_rls false thm tm)
87.97 - handle _ => error "rewrite.sml diff.behav. in rew_sub with Isabelle2009-1 only";
87.98 -
87.99 -"----- ordered rewriting";
87.100 -fun tord (_:subst) pp = TermOrd.termless pp;
87.101 -if tord [] (@{term "x + y*z::real"}, @{term "y*z + x::real"}) then ()
87.102 -else error "rewrite.sml diff.behav. in ord.rewr. with Isabelle2009-1 only";
87.103 -
87.104 -val NONE = (rewrite_ thy tord e_rls false thm tm)
87.105 - handle _ => error "rewrite.sml diff.behav. in rewriting with Isabelle2009-1 only";
87.106 -(*is displayed on _TOP_ of <response> buffer...*)
87.107 -Pretty.writeln (ProofContext.pretty_term_abbrev @{context} r);
87.108 -
87.109 -val tm = @{term "x*y + z::real"};
87.110 -val SOME (r,_) = (rewrite_ thy tord e_rls false thm tm)
87.111 - handle _ => error "rewrite.sml diff.behav. in rewriting with Isabelle2009-1 only";
87.112 -
87.113 -
87.114 -(*}*)
87.115 -
87.116 -"----------- conditional rewriting without Isac's thys -----------";
87.117 -"----------- conditional rewriting without Isac's thys -----------";
87.118 -"----------- conditional rewriting without Isac's thys -----------";
87.119 -(*ML {*)
87.120 -"===== prepr cond.rew. with Pattern.match";
87.121 -val thy = @{theory Complex_Main};
87.122 -val ctxt = @{context};
87.123 -val thm = @{thm nonzero_mult_divide_cancel_right};
87.124 -val rule = Thm.prop_of thm;
87.125 -val tm = @{term "x*2 / 2::real"};
87.126 -
87.127 -val prem = Logic.strip_imp_prems rule;
87.128 -val nps = Logic.count_prems rule;
87.129 -val prems = Logic.strip_prems (nps, [], rule);
87.130 -
87.131 -val eq = Logic.strip_imp_concl rule;
87.132 -val (lhs, rhs) = (HOLogic.dest_eq o HOLogic.dest_Trueprop) eq;
87.133 -
87.134 -val mtcs = Pattern.match thy (lhs, tm) (Vartab.empty, Vartab.empty);
87.135 -val rule' = Envir.subst_term mtcs rule;
87.136 -
87.137 -val prems' = (fst o Logic.strip_prems)
87.138 - (Logic.count_prems rule', [], rule');
87.139 -val rhs' = (snd o HOLogic.dest_eq o HOLogic.dest_Trueprop
87.140 - o Logic.strip_imp_concl) rule';
87.141 -
87.142 -"----- conditional rewriting creating an assumption";
87.143 -"----- conditional rewriting creating an assumption";
87.144 -val tm = @{term "x*y / y::real"};
87.145 -val SOME (rew,asm) = (rewrite_ thy dummy_ord e_rls false thm tm)
87.146 - handle _ => error "rewrite.sml diff.behav. in cond.rew. with Isabelle2009-1 only a";
87.147 -
87.148 -if rew = @{term "x::real"} then ()
87.149 -else error "rewrite.sml diff.behav. in cond.rew. with Isabelle2009-1 only b";
87.150 -
87.151 -if HOLogic.dest_Trueprop (hd asm) = @{term "~ y = (0::real)"} then ()
87.152 -else error "rewrite.sml diff.behav. in cond.rew. with Isabelle2009-1 only c";
87.153 -
87.154 -"----- conditional rewriting immediately: can only be done with Isabelle numerals\
87.155 -\because erls cannot handle them yet.";
87.156 -(*}*)
87.157 -
87.158 -
87.159 -"----------- rewrite_terms_ -------------------------------------";
87.160 -"----------- rewrite_terms_ -------------------------------------";
87.161 -"----------- rewrite_terms_ -------------------------------------";
87.162 -val subte = [str2term"x = 0"];
87.163 -val t = str2term"M_b x = -1 * q_0 * x ^^^ 2 / 2 + x * c + c_2";
87.164 -val SOME (t',_) = rewrite_terms_ thy dummy_ord Erls subte t;
87.165 -if term2str t' = "M_b 0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2" then ()
87.166 -else raise error "rewrite.sml rewrite_terms_ [x = 0]";
87.167 -
87.168 -val subte = [str2term"M_b 0 = 0"];
87.169 -val t = str2term"M_b 0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2";
87.170 -val SOME (t',_) = rewrite_terms_ thy dummy_ord Erls subte t;
87.171 -if term2str t' = "0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2" then ()
87.172 -else raise error "rewrite.sml rewrite_terms_ [M_b 0 = 0]";
87.173 -
87.174 -val subte = [str2term"x = 0", str2term"M_b 0 = 0"];
87.175 -val t = str2term"M_b x = -1 * q_0 * x ^^^ 2 / 2 + x * c + c_2";
87.176 -val SOME (t',_) = rewrite_terms_ thy dummy_ord Erls subte t;
87.177 -if term2str t' = "0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2" then ()
87.178 -else raise error "rewrite.sml rewrite_terms_ [x = 0, M_b 0 = 0]";
87.179 -
87.180 -
87.181 -"----------- rewrite_inst_ bdvs ----------------------------------";
87.182 -"----------- rewrite_inst_ bdvs ----------------------------------";
87.183 -"----------- rewrite_inst_ bdvs ----------------------------------";
87.184 -(*see smltest/Scripts/term_G.sml: inst_bdv 2*)
87.185 -val t = str2term"-1 * (q_0 * L ^^^ 2) / 2 + (L * c_3 + c_4) = 0";
87.186 -val bdvs = [(str2term"bdv_1",str2term"c"),
87.187 - (str2term"bdv_2",str2term"c_2"),
87.188 - (str2term"bdv_3",str2term"c_3"),
87.189 - (str2term"bdv_4",str2term"c_4")];
87.190 -(*------------ outcommented WN071210, after inclusion into ROOT.ML
87.191 -val SOME (t,_) =
87.192 - rewrite_inst_ thy e_rew_ord
87.193 - (append_rls "erls_isolate_bdvs" e_rls
87.194 - [(Calc ("EqSystem.occur'_exactly'_in",
87.195 - eval_occur_exactly_in
87.196 - "#eval_occur_exactly_in_"))
87.197 - ])
87.198 - false bdvs (num_str separate_bdvs_add) t;
87.199 -(writeln o term2str) t;
87.200 -if term2str t = "L * c_3 + c_4 = 0 + -1 * (-1 * (q_0 * L ^^^ 2) / 2)"
87.201 -then () else raise error "rewrite.sml rewrite_inst_ bdvs";
87.202 -trace_rewrite:=true;
87.203 -trace_rewrite:=false;--------------------------------------------*)
87.204 -
88.1 --- a/test/Tools/isac/Scripts/scrtools.sml Mon Aug 30 14:29:49 2010 +0200
88.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
88.3 @@ -1,193 +0,0 @@
88.4 -(* tests on tools for scripts
88.5 - author: Walther Neuper
88.6 - 060605,
88.7 - (c) due to copyright terms
88.8 -
88.9 -use"../smltest/Scripts/scrtools.sml";
88.10 -use"scrtools.sml";
88.11 -*)
88.12 -"-----------------------------------------------------------------";
88.13 -"table of contents -----------------------------------------------";
88.14 -"-----------------------------------------------------------------";
88.15 -"-------- test auto-generated script '(Repeat (Calculate times))'-";
88.16 -"-------- test the same called by interSteps norm_Poly -----------";
88.17 -"-------- test the same called by interSteps norm_Rational -------";
88.18 -"-------- check auto-gen.script for Rewrite_Set_Inst -------------";
88.19 -"-----------------------------------------------------------------";
88.20 -"-----------------------------------------------------------------";
88.21 -"-----------------------------------------------------------------";
88.22 -
88.23 -
88.24 -"-------- test auto-generated script '(Repeat (Calculate times))'-";
88.25 -"-------- test auto-generated script '(Repeat (Calculate times))'-";
88.26 -"-------- test auto-generated script '(Repeat (Calculate times))'-";
88.27 -val Seq {scr = Script auto_script,...} = assoc_rls "norm_Poly";
88.28 -writeln(term2str auto_script);
88.29 -atomty auto_script;
88.30 -
88.31 -store_met
88.32 - (prep_met Test.thy "met_testinter" [] e_metID
88.33 - (["Test","test_interSteps_1"]:metID,
88.34 - [("#Given" ,["term t_"]),
88.35 - ("#Find" ,["normalform n_"])
88.36 - ],
88.37 - {rew_ord'="dummy_ord",rls'=tval_rls,calc=[],srls=e_rls,prls=e_rls,
88.38 - crls=tval_rls, nrls=e_rls},
88.39 -"Script Stepwise t_ = \
88.40 - \(Try (Rewrite_Set discard_minus_ False) @@ \
88.41 - \ Try (Rewrite_Set expand_poly_ False) @@ \
88.42 - \ Try (Repeat (Calculate times)) @@ \
88.43 - \ Try (Rewrite_Set order_mult_rls_ False) @@ \
88.44 - \ Try (Rewrite_Set simplify_power_ False) @@ \
88.45 - \ Try (Rewrite_Set calc_add_mult_pow_ False) @@\
88.46 - \ Try (Rewrite_Set reduce_012_mult_ False) @@ \
88.47 - \ Try (Rewrite_Set order_add_rls_ False) @@ \
88.48 - \ Try (Rewrite_Set collect_numerals_ False) @@ \
88.49 - \ Try (Rewrite_Set reduce_012_ False) @@ \
88.50 - \ Try (Rewrite_Set discard_parentheses_ False))\
88.51 - \ t_"
88.52 -(*presently this script cannot become equal in types to auto_script, because:
88.53 - this t_ must be either 'real' or 'bool' #1#,
88.54 - while the auto_script must be 'z and type-instantiated before usage*)
88.55 - ));
88.56 -show_mets();
88.57 -val {scr = Script parsed_script,...} = get_met ["Test","test_interSteps_1"];
88.58 -writeln(term2str parsed_script);
88.59 -atomty parsed_script;
88.60 -
88.61 -(*the structure of the auto-gen. script is interpreted correctly*)
88.62 -states:=[];
88.63 -CalcTree
88.64 -[(["term (b + a - b)",(*this is Schalk 299b*)
88.65 - "normalform N"],
88.66 - ("Poly.thy",["polynomial","simplification"],
88.67 - ["Test","test_interSteps_1"]))];
88.68 -Iterator 1;
88.69 -moveActiveRoot 1;
88.70 -autoCalculate 1 CompleteCalcHead;
88.71 -
88.72 -fetchProposedTactic 1 (*..Apply_Method*);
88.73 -autoCalculate 1 (Step 1);
88.74 -getTactic 1 ([1], Frm) (*still empty*);
88.75 -
88.76 -fetchProposedTactic 1 (*discard_minus_*);
88.77 -autoCalculate 1 (Step 1);
88.78 -
88.79 -fetchProposedTactic 1 (*order_add_rls_*);
88.80 -autoCalculate 1 (Step 1);
88.81 -
88.82 -fetchProposedTactic 1 (*collect_numerals_*);
88.83 -autoCalculate 1 (Step 1);
88.84 -
88.85 -autoCalculate 1 CompleteCalc;
88.86 -
88.87 -val ((pt,p),_) = get_calc 1; show_pt pt;
88.88 -if existpt' ([1], Frm) pt then ()
88.89 -else raise error "scrtools.sml: test-script test_interSteps_1 doesnt work";
88.90 -
88.91 -
88.92 -"-------- test the same called by interSteps norm_Poly -----------";
88.93 -"-------- test the same called by interSteps norm_Poly -----------";
88.94 -"-------- test the same called by interSteps norm_Poly -----------";
88.95 -val Seq {scr = Script auto_script,...} = assoc_rls "norm_Poly";
88.96 -writeln(term2str auto_script);
88.97 -atomty auto_script;
88.98 -
88.99 -states:=[];
88.100 -CalcTree
88.101 -[(["term (b + a - b)", "normalform N"],
88.102 - ("Poly.thy",["polynomial","simplification"],
88.103 - ["simplification","for_polynomials"]))];
88.104 -Iterator 1;
88.105 -moveActiveRoot 1;
88.106 -autoCalculate 1 CompleteCalc;
88.107 -
88.108 -interSteps 1 ([], Res);
88.109 -val ((pt,p),_) = get_calc 1; show_pt pt;
88.110 -
88.111 -interSteps 1 ([1], Res);
88.112 -val ((pt,p),_) = get_calc 1; show_pt pt;
88.113 -if existpt' ([1,4], Res) pt then ()
88.114 -else raise error "scrtools.sml: auto-generated norm_Poly doesnt work";
88.115 -
88.116 -
88.117 -
88.118 -"-------- test the same called by interSteps norm_Rational -------";
88.119 -"-------- test the same called by interSteps norm_Rational -------";
88.120 -"-------- test the same called by interSteps norm_Rational -------";
88.121 -val Seq {scr = Script auto_script,...} = assoc_rls "norm_Rational";
88.122 -writeln(term2str auto_script);
88.123 -atomty auto_script;
88.124 -(***
88.125 -*** Const (Script.Stepwise, ['z, 'z] => 'z)
88.126 -*** . Free (t_, 'z)
88.127 -*** . Const (Script.Seq, ['a => 'a, 'a => 'a, 'a] => 'a)
88.128 -*** . . Const (Script.Try, ['a => 'a, 'a] => 'a)
88.129 -*** . . . Const (Script.Rewrite'_Set, [Script.ID, bool, 'a] => 'a)
88.130 -*** . . . . Free (discard_minus_, Script.ID)
88.131 -*** . . . . Const (False, bool)
88.132 -*** . . Const (Script.Seq, ['a => 'a, 'a => 'a, 'a] => 'a)
88.133 -*** . . . Const (Script.Try, ['a => 'a, 'a] => 'a)
88.134 -*** . . . . Const (Script.Rewrite'_Set, [Script.ID, bool, 'a] => 'a)
88.135 -*** . . . . . Free (rat_mult_poly, Script.ID)
88.136 -*** . . . . . Const (False, bool)
88.137 -*** . . . Const (Script.Seq, ['a => 'a, 'a => 'a, 'a] => 'a)
88.138 -*** . . . . Const (Script.Try, ['a => 'a, 'a] => 'a)
88.139 -*** . . . . . Const (Script.Rewrite'_Set, [Script.ID, bool, 'a] => 'a)
88.140 -*** . . . . . . Free (make_rat_poly_with_parentheses, Script.ID)
88.141 -*** . . . . . . Const (False, bool)
88.142 -*** . . . . Const (Script.Seq, ['a => 'a, 'a => 'a, 'a] => 'a)
88.143 -*** . . . . . Const (Script.Try, ['a => 'a, 'a] => 'a)
88.144 -*** . . . . . . Const (Script.Rewrite'_Set, [Script.ID, bool, 'a] => 'a)
88.145 -*** . . . . . . . Free (cancel_p_rls, Script.ID)
88.146 -*** . . . . . . . Const (False, bool)
88.147 -*** . . . . . Const (Script.Seq, ['a => 'a, 'a => 'a, 'a] => 'a)
88.148 -*** . . . . . . Const (Script.Try, ['a => 'a, 'a] => 'a)
88.149 -*** . . . . . . . Const (Script.Rewrite'_Set, [Script.ID, bool, 'a] => 'a)
88.150 -*** . . . . . . . . Free (norm_Rational_rls, Script.ID)
88.151 -*** . . . . . . . . Const (False, bool)
88.152 -*** . . . . . . Const (Script.Try, ['a => 'a, 'a] => 'a)
88.153 -*** . . . . . . . Const (Script.Rewrite'_Set, [Script.ID, bool, 'a] => 'a)
88.154 -*** . . . . . . . . Free (discard_parentheses_, Script.ID)
88.155 -*** . . . . . . . . Const (False, bool)
88.156 -*** . . Free (t_, 'a)
88.157 -***)
88.158 -states:=[];
88.159 -CalcTree
88.160 -[(["term (b + a - b)", "normalform N"],
88.161 - ("Poly.thy",["polynomial","simplification"],
88.162 - ["simplification","of_rationals"]))];
88.163 -Iterator 1;
88.164 -moveActiveRoot 1;
88.165 -autoCalculate 1 CompleteCalc;
88.166 -
88.167 -interSteps 1 ([], Res);
88.168 -val ((pt,p),_) = get_calc 1; show_pt pt;
88.169 -
88.170 -interSteps 1 ([1], Res);
88.171 -val ((pt,p),_) = get_calc 1; show_pt pt;
88.172 -
88.173 -(*with "Script SimplifyScript (t_::real) = \
88.174 - \ ((Rewrite_Set norm_Rational False) t_)"
88.175 -val (Form form, SOME tac, asm) = pt_extract (pt, ([1], Res));
88.176 -*)
88.177 -val (Form form, SOME tac, asm) = pt_extract (pt, ([2], Res));
88.178 -case (term2str form, tac, terms2strs asm) of
88.179 - ("a", Check_Postcond ["polynomial", "simplification"], []) => ()
88.180 - | _ => raise error "scrtools.sml: auto-generated norm_Rational doesnt work";
88.181 -
88.182 -
88.183 -
88.184 -"-------- check auto-gen.script for Rewrite_Set_Inst -------------";
88.185 -"-------- check auto-gen.script for Rewrite_Set_Inst -------------";
88.186 -"-------- check auto-gen.script for Rewrite_Set_Inst -------------";
88.187 -val rls = assoc_rls "integration";
88.188 -val Seq {scr = Script auto_script,...} = rls;
88.189 -writeln(term2str auto_script);
88.190 -
88.191 -if contain_bdv (get_rules rls) then ()
88.192 -else raise error "scrtools.sml: contain_bdv doesnt work for 'integration'";
88.193 -
88.194 -two_scr_arg auto_script;
88.195 -init_istate (Rewrite_Set_Inst (["(bdv, x)"], "integration_rules"))
88.196 - (str2term "someTermWithBdv");
89.1 --- a/test/Tools/isac/Scripts/term_G.sml Mon Aug 30 14:29:49 2010 +0200
89.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
89.3 @@ -1,168 +0,0 @@
89.4 -(* tests on Scripts/term_G.sml
89.5 - author: Walther Neuper
89.6 - 051006,
89.7 - (c) due to copyright terms
89.8 -
89.9 -use"../smltest/Scripts/term_G.sml";
89.10 -use"term_G.sml";
89.11 -*)
89.12 -
89.13 -"-----------------------------------------------------------------";
89.14 -"table of contents -----------------------------------------------";
89.15 -"-----------------------------------------------------------------";
89.16 -"----------- inst_bdv --------------------------------------------";
89.17 -"----------- subst_atomic_all ------------------------------------";
89.18 -"----------- Pattern.match ---------------------------------------";
89.19 -"----------- fun matches -----------------------------------------";
89.20 -"------------parse------------------------------------------------";
89.21 -"----------- uminus_to_string ------------------------------------";
89.22 -"-----------------------------------------------------------------";
89.23 -"-----------------------------------------------------------------";
89.24 -
89.25 -
89.26 -"----------- inst_bdv --------------------------------------------";
89.27 -"----------- inst_bdv --------------------------------------------";
89.28 -"----------- inst_bdv --------------------------------------------";
89.29 -if string_of_thm (num_str d1_isolate_add2) =
89.30 - "\"~ ?bdv occurs_in ?a ==> (?a + ?bdv = 0) = (?bdv = -1 * ?a)\"" then ()
89.31 -else raise error "term_G.sml d1_isolate_add2";
89.32 -val subst = [(str2term "bdv", str2term "x")];
89.33 -val t = (norm o #prop o rep_thm) (num_str d1_isolate_add2);
89.34 -val t' = inst_bdv subst t;
89.35 -if term2str t' = "~ x occurs_in ?a ==> (?a + x = 0) = (x = -1 * ?a)" then ()
89.36 -else raise error "term_G.sml inst_bdv 1";
89.37 -
89.38 -if string_of_thm (num_str separate_bdvs_add) =
89.39 - "\"[] from_ [?bdv_1.0, ?bdv_2.0, ?bdv_3.0, ?bdv_4.0] occur_exactly_in ?a\n\
89.40 - \ ==> (?a + ?b = ?c) = (?b = ?c + -1 * ?a)\"" then ()
89.41 -else raise error "term_G.sml separate_bdvs_add";
89.42 -val subst = [(str2term"bdv_1",str2term"c"),
89.43 - (str2term"bdv_2",str2term"c_2"),
89.44 - (str2term"bdv_3",str2term"c_3"),
89.45 - (str2term"bdv_4",str2term"c_4")];
89.46 -val t = (norm o #prop o rep_thm) (num_str separate_bdvs_add);
89.47 -val t' = inst_bdv subst t;
89.48 -if term2str t' = "[] from_ [c, c_2, c_3, c_4] occur_exactly_in ?a\n\
89.49 - \==> (?a + ?b = ?c) = (?b = ?c + -1 * ?a)" then ()
89.50 -else raise error "term_G.sml inst_bdv 2";
89.51 -
89.52 -
89.53 -"----------- subst_atomic_all ------------------------------------";
89.54 -"----------- subst_atomic_all ------------------------------------";
89.55 -"----------- subst_atomic_all ------------------------------------";
89.56 -val t = str2term"(tl vs_) from_ vs_ occur_exactly_in (nth_ 1(es_::bool list))";
89.57 -val env = [(str2term"vs_::real list",str2term"[c, c_2]"),
89.58 - (str2term"es_::bool list",str2term"[c_2=0, c+c_2=1]")];
89.59 -val (all_Free_subst, t') = subst_atomic_all env t;
89.60 -if all_Free_subst andalso
89.61 - term2str t' = "tl [c, c_2] from_ [c, c_2] occur_exactly_in nth_ 1 [c_2 = 0, c + c_2 = 1]" then ()
89.62 -else raise error "term_G.sml subst_atomic_all should be 'true'";
89.63 -
89.64 -
89.65 -val (all_Free_subst, t') = subst_atomic_all (tl env) t;
89.66 -if not all_Free_subst andalso
89.67 - term2str t' = "tl vs_ from_ vs_ occur_exactly_in nth_ 1 [c_2 = 0, c + c_2 = 1]" then ()
89.68 -else raise error "term_G.sml subst_atomic_all should be 'false'";
89.69 -
89.70 -
89.71 -"----------- Pattern.match ---------------------------------------";
89.72 -"----------- Pattern.match ---------------------------------------";
89.73 -"----------- Pattern.match ---------------------------------------";
89.74 -val t = (term_of o the o (parse thy)) "3 * x^^^2 = 1";
89.75 -val pat = (free2var o term_of o the o (parse thy)) "a * b^^^2 = c";
89.76 -(* !^^^^^^^^!... necessary for Pattern.match*)
89.77 -val insts = Pattern.match (Sign.tsig_of (sign_of thy)) (pat, t);
89.78 -(*val insts =
89.79 - ([],
89.80 - [(("c",0),Free ("1","RealDef.real")),(("b",0),Free ("x","RealDef.real")),
89.81 - (("a",0),Free ("3","RealDef.real"))])
89.82 - : (indexname * typ) list * (indexname * term) list*)
89.83 -
89.84 -"----- throws exn MATCH...";
89.85 -val t = str2term "x";
89.86 -(Pattern.match (Sign.tsig_of (sign_of thy)) (pat, t))
89.87 -handle MATCH => ([(* (Term.indexname * Term.typ) *)],
89.88 - [(* (Term.indexname * Term.term) *)]);
89.89 -Pattern.MATCH;
89.90 -
89.91 -(*ML {**)
89.92 -val thy = @{theory Complex_Main};
89.93 -val PARSE = Syntax.read_term_global thy;
89.94 -val (pa, tm) = (PARSE "a + b::real", PARSE "x + 2*z::real");
89.95 -"-------";
89.96 -val (tye, tme) =
89.97 - (Vartab.empty : Type.tyenv, Vartab.empty : Envir.tenv);
89.98 -"-------";
89.99 -val (tye, tme) = Pattern.match thy (Logic.varify pa, tm) (Vartab.empty,
89.100 - Vartab.empty);
89.101 -"-------";
89.102 -val (tyenv, tenv) = Pattern.match thy (Logic.varify pa, tm)
89.103 - (Vartab.empty, Vartab.empty);
89.104 -Vartab.dest tenv;
89.105 -match thy tm (Logic.varify pa);
89.106 -
89.107 -(**}*)
89.108 -
89.109 -"----------- fun matches -----------------------------------------";
89.110 -"----------- fun matches -----------------------------------------";
89.111 -"----------- fun matches -----------------------------------------";
89.112 -(*smltest/IsacKnowledge/polyeq.sml:
89.113 - Where=[Correct "matches (?a = 0) (-8 - 2 * x + x ^^^ 2 = 0)"*)
89.114 -(*smltest/ME/ptyps.sml:
89.115 - |\nmatches (?a + ?b * x = #0) ((x + #1) * (x + #2) = x ^^^ #2 + #8)"],*)
89.116 -(*ML {**)
89.117 -val thy = @{theory Complex_Main};
89.118 -"----- test 1";
89.119 -val pa = Logic.varify @{term "a = (0::real)"};
89.120 -"----- test 1 true";
89.121 -val tm = @{term "-8 - 2 * x + x ^ 2 = (0::real)"};
89.122 -if matches thy tm pa then ()
89.123 - else error "term_G.sml diff.behav. in matches true";
89.124 -"----- test 2 false";
89.125 -val tm = @{term "-8 - 2 * x + x ^ 2 = (3::real)"};
89.126 -if matches thy tm pa then error "term_G.sml diff.behav. in matches false"
89.127 - else ();
89.128 -(**}*)
89.129 -
89.130 -"------------parse------------------------------------------------";
89.131 -"------------parse------------------------------------------------";
89.132 -"------------parse------------------------------------------------";
89.133 -(*ML {**)
89.134 -Toplevel.debug := true;
89.135 -(* literal types:
89.136 -PolyML.addPrettyPrinter
89.137 - (fn _ => fn _ => ml_pretty o Pretty.to_ML o raw_pp_typ);
89.138 -*)(* pretty types:
89.139 -PolyML.addPrettyPrinter
89.140 - (fn _ => fn _ => ml_pretty o Pretty.to_ML o Proof_Display.pp_typ Pure.thy);
89.141 -print_depth 99;
89.142 -*)
89.143 -val thy = @{theory Complex_Main};
89.144 -val str = "x + z";
89.145 -parse thy str;
89.146 -"---------------";
89.147 -val str = "x + 2*z";
89.148 -val t = (Syntax.read_term_global thy str);
89.149 -val t = numbers_to_string (Syntax.read_term_global thy str);
89.150 -val t = (typ_a2real o numbers_to_string) (Syntax.read_term_global thy str);
89.151 -cterm_of thy t;
89.152 -val t = (the (parse thy str)) handle _ => error "term_G.sml parsing 'x + 2*z' failed";
89.153 -(**}*)
89.154 -(*Makarius.1003
89.155 -ML {* @{term "2::int"} *}
89.156 -
89.157 -term "(1.24444) :: real"
89.158 -
89.159 -ML {* numbers_to_string @{term "%x. (-9993::int) + x + 1"} *}
89.160 -*)
89.161 -
89.162 -
89.163 -"----------- uminus_to_string ------------------------------------";
89.164 -"----------- uminus_to_string ------------------------------------";
89.165 -"----------- uminus_to_string ------------------------------------";
89.166 -(*ML {*)
89.167 -val t1 = numbers_to_string @{term "-2::real"};
89.168 -val t2 = numbers_to_string @{term "- 2::real"};
89.169 -if uminus_to_string t2 = t1 then ()
89.170 -else error "term_G.sml diff.behav. in uminus_to_string";
89.171 -(*}*)
90.1 --- a/test/Tools/isac/Scripts/tools.sml Mon Aug 30 14:29:49 2010 +0200
90.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
90.3 @@ -1,27 +0,0 @@
90.4 -(* tests on Tools
90.5 - author: Walther Neuper
90.6 - WN071229,
90.7 - (c) due to copyright terms
90.8 -
90.9 -use"../smltest/Scripts/tools.sml";
90.10 -use"tools.sml";
90.11 -*)
90.12 -val thy = Real.thy;
90.13 -
90.14 -"-----------------------------------------------------------------";
90.15 -"table of contents -----------------------------------------------";
90.16 -"-----------------------------------------------------------------";
90.17 -"----------- fun matchsub ----------------------------------------";
90.18 -"-----------------------------------------------------------------";
90.19 -"-----------------------------------------------------------------";
90.20 -"-----------------------------------------------------------------";
90.21 -
90.22 -
90.23 -"----------- fun matchsub ----------------------------------------";
90.24 -"----------- fun matchsub ----------------------------------------";
90.25 -"----------- fun matchsub ----------------------------------------";
90.26 -if matchsub thy (str2term "(a + (b + c))") (str2term "?x + (?y + ?z)")
90.27 -then () else raise error "tools.sml matchsub a + (b + c)";
90.28 -
90.29 -if matchsub thy (str2term "(a + (b + c)) + d") (str2term "?x + (?y + ?z)")
90.30 -then () else raise error "tools.sml matchsub (a + (b + c)) + d";