test/Tools/isac/Frontend/use-cases.sml
changeset 59253 f0bb15a046ae
parent 59252 7d3dbc1171ff
child 59254 0d84c462dd7e
equal deleted inserted replaced
59252:7d3dbc1171ff 59253:f0bb15a046ae
    79 "exported from struct --------------------------------------------";
    79 "exported from struct --------------------------------------------";
    80 "exported from struct --------------------------------------------";
    80 "exported from struct --------------------------------------------";
    81 
    81 
    82 
    82 
    83 (*------------ set at startup of the Kernel ----------------------*)
    83 (*------------ set at startup of the Kernel ----------------------*)
    84 reset_states ();  (*resets all state information in Kernel           *)
    84 reset_states ();  (*resets all state information in Kernel        *)
    85 (*----------------------------------------------------------------*)
    85 (*----------------------------------------------------------------*)
    86 
    86 
    87 "--------- empty rootpbl --------------------------------";
    87 "--------- empty rootpbl --------------------------------";
    88 "--------- empty rootpbl --------------------------------";
    88 "--------- empty rootpbl --------------------------------";
    89 "--------- empty rootpbl --------------------------------";
    89 "--------- empty rootpbl --------------------------------";
   205 "--------- miniscript with mini-subpbl ------------------";
   205 "--------- miniscript with mini-subpbl ------------------";
   206 "--------- miniscript with mini-subpbl ------------------";
   206 "--------- miniscript with mini-subpbl ------------------";
   207 "--------- miniscript with mini-subpbl ------------------";
   207 "--------- miniscript with mini-subpbl ------------------";
   208 (*WN120210?not ME:\label{SOLVE:MANUAL:TACTIC:enter} UC 30.3.2.1 p.175 !!!!!NOT IMPL IN FE*)
   208 (*WN120210?not ME:\label{SOLVE:MANUAL:TACTIC:enter} UC 30.3.2.1 p.175 !!!!!NOT IMPL IN FE*)
   209 "=== this sequence of fun-calls resembles fun me ===";
   209 "=== this sequence of fun-calls resembles fun me ===";
   210  reset_states (); (*start of calculation, return No.1*)
       
   211  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   210  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   212    ("Test", ["sqroot-test","univariate","equation","test"],
   211    ("Test", ["sqroot-test","univariate","equation","test"],
   213     ["Test","squ-equ-test-subpbl1"]))];
   212     ["Test","squ-equ-test-subpbl1"]))];
   214  Iterator 1;
   213  Iterator 1;
   215 
   214 
   449  val ((pt,_),_) = get_calc 1;
   448  val ((pt,_),_) = get_calc 1;
   450  val p = get_pos 1 1;
   449  val p = get_pos 1 1;
   451  val (Form f, tac, asms) = pt_extract (pt, p);
   450  val (Form f, tac, asms) = pt_extract (pt, p);
   452  if term2str f = "[x = 1]" andalso p = ([], Res) then () else 
   451  if term2str f = "[x = 1]" andalso p = ([], Res) then () else 
   453  error "FE-interface.sml: diff.behav. in mini-subpbl AUTOCALCULATE 6";
   452  error "FE-interface.sml: diff.behav. in mini-subpbl AUTOCALCULATE 6";
   454 DEconstrCalcTree 1;
   453  DEconstrCalcTree 1;
   455 
   454 
   456 "--------- mini-subpbl AUTO CompleteCalcHead ------------";
   455 "--------- mini-subpbl AUTO CompleteCalcHead ------------";
   457 "--------- mini-subpbl AUTO CompleteCalcHead ------------";
   456 "--------- mini-subpbl AUTO CompleteCalcHead ------------";
   458 "--------- mini-subpbl AUTO CompleteCalcHead ------------";
   457 "--------- mini-subpbl AUTO CompleteCalcHead ------------";
   459  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   458  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   510  val ((pt,_),_) = get_calc 1;
   509  val ((pt,_),_) = get_calc 1;
   511  val p = get_pos 1 1;
   510  val p = get_pos 1 1;
   512  val (Form f, tac, asms) = pt_extract (pt, p);
   511  val (Form f, tac, asms) = pt_extract (pt, p);
   513  if term2str f = "[x = 1]" andalso p = ([], Res) then () else 
   512  if term2str f = "[x = 1]" andalso p = ([], Res) then () else 
   514  error "FE-interface.sml: diff.behav. in mini-subpbl AUTOCALCULATE 6";
   513  error "FE-interface.sml: diff.behav. in mini-subpbl AUTOCALCULATE 6";
   515 DEconstrCalcTree 1;
   514  DEconstrCalcTree 1;
   516 
   515 
   517 "--------- setContext..Thy ------------------------------";
   516 "--------- setContext..Thy ------------------------------";
   518 "--------- setContext..Thy ------------------------------";
   517 "--------- setContext..Thy ------------------------------";
   519 "--------- setContext..Thy ------------------------------";
   518 "--------- setContext..Thy ------------------------------";
   520  reset_states ();
       
   521  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   519  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   522   ("Test", ["sqroot-test","univariate","equation","test"],
   520   ("Test", ["sqroot-test","univariate","equation","test"],
   523    ["Test","squ-equ-test-subpbl1"]))];
   521    ["Test","squ-equ-test-subpbl1"]))];
   524  Iterator 1; moveActiveRoot 1;
   522  Iterator 1; moveActiveRoot 1;
   525  autoCalculate 1 CompleteCalcHead;
   523  autoCalculate 1 CompleteCalcHead;
   575  val p = get_pos 1 1;
   573  val p = get_pos 1 1;
   576 
   574 
   577  val (Form f, tac, asms) = pt_extract (pt, p);
   575  val (Form f, tac, asms) = pt_extract (pt, p);
   578  if term2str f = "[x = 1]" andalso p = ([], Res) then () else 
   576  if term2str f = "[x = 1]" andalso p = ([], Res) then () else 
   579  error "FE-interface.sml: diff.behav. in mini-subpbl CompleteToSubpbl 1";
   577  error "FE-interface.sml: diff.behav. in mini-subpbl CompleteToSubpbl 1";
   580 DEconstrCalcTree 1;
   578  DEconstrCalcTree 1;
   581 
   579 
   582 "--------- rat-eq + subpbl: no_met, NO solution dropped -";
   580 "--------- rat-eq + subpbl: no_met, NO solution dropped -";
   583 "--------- rat-eq + subpbl: no_met, NO solution dropped -";
   581 "--------- rat-eq + subpbl: no_met, NO solution dropped -";
   584 "--------- rat-eq + subpbl: no_met, NO solution dropped -";
   582 "--------- rat-eq + subpbl: no_met, NO solution dropped -";
   585  CalcTree
   583  CalcTree
   619  autoCalculate 1 (Step 1); fetchProposedTactic 1;
   617  autoCalculate 1 (Step 1); fetchProposedTactic 1;
   620  setNextTactic 1 (Specify_Method ["PolyEq","normalize_poly"]);
   618  setNextTactic 1 (Specify_Method ["PolyEq","normalize_poly"]);
   621  autoCalculate 1 (Step 1); fetchProposedTactic 1;
   619  autoCalculate 1 (Step 1); fetchProposedTactic 1;
   622  setNextTactic 1 (Apply_Method ["PolyEq","normalize_poly"]);
   620  setNextTactic 1 (Apply_Method ["PolyEq","normalize_poly"]);
   623  autoCalculate 1 (Step 1); fetchProposedTactic 1;
   621  autoCalculate 1 (Step 1); fetchProposedTactic 1;
   624  setNextTactic 1 (Rewrite ("all_left", Thm.prop_of @{thm all_left}));
   622  setNextTactic 1 (Rewrite ("all_left", @{thm all_left}));
   625  autoCalculate 1 (Step 1); fetchProposedTactic 1;
   623  autoCalculate 1 (Step 1); fetchProposedTactic 1;
   626  setNextTactic 1 (Rewrite_Set_Inst (["(bdv,x)"], "make_ratpoly_in"));
   624  setNextTactic 1 (Rewrite_Set_Inst (["(bdv,x)"], "make_ratpoly_in"));
   627  autoCalculate 1 (Step 1); fetchProposedTactic 1;
   625  autoCalculate 1 (Step 1); fetchProposedTactic 1;
   628  (*               __________ for "16 + 12 * x = 0"*)
   626  (*               __________ for "16 + 12 * x = 0"*)
   629  setNextTactic 1 (Subproblem ("PolyEq",
   627  setNextTactic 1 (Subproblem ("PolyEq",
   659  setNextTactic 1 (Check_Postcond ["rational","univariate","equation"]);
   657  setNextTactic 1 (Check_Postcond ["rational","univariate","equation"]);
   660  val (ptp,_) = get_calc 1;
   658  val (ptp,_) = get_calc 1;
   661  val (Form t,_,_) = pt_extract ptp;
   659  val (Form t,_,_) = pt_extract ptp;
   662  if get_pos 1 1 = ([], Res) andalso term2str t = "[x = -4 / 3]" then ()
   660  if get_pos 1 1 = ([], Res) andalso term2str t = "[x = -4 / 3]" then ()
   663  else writeln "FE-inteface.sml: diff.behav. in rat-eq + subpbl: no_met, NO ..";
   661  else writeln "FE-inteface.sml: diff.behav. in rat-eq + subpbl: no_met, NO ..";
   664 DEconstrCalcTree 1;
   662  DEconstrCalcTree 1;
   665 
   663 
   666 "--------- tryMatchProblem, tryRefineProblem ------------";
   664 "--------- tryMatchProblem, tryRefineProblem ------------";
   667 "--------- tryMatchProblem, tryRefineProblem ------------";
   665 "--------- tryMatchProblem, tryRefineProblem ------------";
   668 "--------- tryMatchProblem, tryRefineProblem ------------";
   666 "--------- tryMatchProblem, tryRefineProblem ------------";
   669 (*{\bf\UC{Having \isac{} Refine the Problem
   667 (*{\bf\UC{Having \isac{} Refine the Problem
   779  show_pt pt;
   777  show_pt pt;
   780  val p = get_pos 1 1;
   778  val p = get_pos 1 1;
   781  val (Form f, tac, asms) = pt_extract (pt, p);
   779  val (Form f, tac, asms) = pt_extract (pt, p);
   782  if term2str f = "[x = -1, x = -3]" andalso p = ([], Res) then () else 
   780  if term2str f = "[x = -1, x = -3]" andalso p = ([], Res) then () else 
   783  error "FE-interface.sml: diff.behav. in tryMatchProblem, tryRefine";
   781  error "FE-interface.sml: diff.behav. in tryMatchProblem, tryRefine";
   784 
   782  DEconstrCalcTree 1;
   785 DEconstrCalcTree 1;
       
   786 
   783 
   787 "--------- modifyCalcHead, resetCalcHead, modelProblem --";
   784 "--------- modifyCalcHead, resetCalcHead, modelProblem --";
   788 "--------- modifyCalcHead, resetCalcHead, modelProblem --";
   785 "--------- modifyCalcHead, resetCalcHead, modelProblem --";
   789 "--------- modifyCalcHead, resetCalcHead, modelProblem --";
   786 "--------- modifyCalcHead, resetCalcHead, modelProblem --";
   790  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   787  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
  1354 DEconstrCalcTree 1;
  1351 DEconstrCalcTree 1;
  1355 
  1352 
  1356 "--------- UC errpat chain-rule-diff-both, fillpat by input ------";
  1353 "--------- UC errpat chain-rule-diff-both, fillpat by input ------";
  1357 "--------- UC errpat chain-rule-diff-both, fillpat by input ------";
  1354 "--------- UC errpat chain-rule-diff-both, fillpat by input ------";
  1358 "--------- UC errpat chain-rule-diff-both, fillpat by input ------";
  1355 "--------- UC errpat chain-rule-diff-both, fillpat by input ------";
  1359 reset_states ();
       
  1360 CalcTree
  1356 CalcTree
  1361 [(["functionTerm (x ^ 2 + sin (x ^ 4))", "differentiateFor x", "derivative f_f'"], 
  1357 [(["functionTerm (x ^ 2 + sin (x ^ 4))", "differentiateFor x", "derivative f_f'"], 
  1362   ("Isac", ["derivative_of","function"], ["diff","differentiate_on_R"]))];
  1358   ("Isac", ["derivative_of","function"], ["diff","differentiate_on_R"]))];
  1363 Iterator 1;
  1359 Iterator 1;
  1364 moveActiveRoot 1;
  1360 moveActiveRoot 1;
  1372   instead of <CALCMESSAGE> no derivation found </CALCMESSAGE> *)
  1368   instead of <CALCMESSAGE> no derivation found </CALCMESSAGE> *)
  1373   val ((pt,pos), _) = get_calc 1;
  1369   val ((pt,pos), _) = get_calc 1;
  1374   val p = get_pos 1 1;
  1370   val p = get_pos 1 1;
  1375   val (Form f, _, asms) = pt_extract (pt, p);
  1371   val (Form f, _, asms) = pt_extract (pt, p);
  1376 
  1372 
  1377   if p = ([1], Res) andalso term2str f = "d_d x (x ^^^ 2) + d_d x (sin (x ^^^ 4))" andalso
  1373   if p = ([2], Res) andalso term2str f = "d_d x (x ^^^ 2) + d_d x (sin (x ^^^ 4))"
  1378     get_obj g_tac pt (fst p) = Rewrite_Inst (["(bdv, x)"],
  1374   then case get_obj g_tac pt (fst p) of Rewrite_Inst (["(bdv, x)"],
  1379       ("diff_sum", str2term "d_d ?bdv (?u + ?v) = d_d ?bdv ?u + d_d ?bdv ?v"))
  1375       ("diff_sum", thm)) => () | _ => error "embed fun get_fillform changed 0"
  1380   then () else error "embed fun get_fillform changed 1";
  1376   | _ => error "embed fun get_fillform changed 1"
       
  1377 else error "embed fun get_fillform changed 2";
       
  1378 ============ inhibit exn WN161019 TODO ========================================================*)
  1381 
  1379 
  1382 (*========== inhibit exn WN1130621 Isabelle2012-->13 !thehier! ====================
  1380 (*========== inhibit exn WN1130621 Isabelle2012-->13 !thehier! ====================
  1383 findFillpatterns 1 "chain-rule-diff-both"; (*<<<<<<<=================================*)
  1381 findFillpatterns 1 "chain-rule-diff-both"; (*<<<<<<<=================================*)
  1384 (*<CALCMESSAGE> fill patterns #fill-d_d-arg#d_d x (x ^^^ 2) + d_d x (sin (x ^^^ 4)) =
  1382 (*<CALCMESSAGE> fill patterns #fill-d_d-arg#d_d x (x ^^^ 2) + d_d x (sin (x ^^^ 4)) =
  1385   d_d x (x ^^^ 2) + cos (x ^^^ 4) * d_d x ?_dummy_1#fill-both-args#...#...#... *)
  1383   d_d x (x ^^^ 2) + cos (x ^^^ 4) * d_d x ?_dummy_1#fill-both-args#...#...#... *)
  1431 (([3], Res), d_d x (x ^^^ 2) + cos (x ^^^ 4) * (4 * x ^^^ (4 - 1))),
  1429 (([3], Res), d_d x (x ^^^ 2) + cos (x ^^^ 4) * (4 * x ^^^ (4 - 1))),
  1432 (([4], Res), 2 * x ^^^ (2 - 1) + cos (x ^^^ 4) * (4 * x ^^^ (4 - 1))),
  1430 (([4], Res), 2 * x ^^^ (2 - 1) + cos (x ^^^ 4) * (4 * x ^^^ (4 - 1))),
  1433 (([5], Res), 2 * x + cos (x ^^^ 4) * 4 * x ^^^ 3),
  1431 (([5], Res), 2 * x + cos (x ^^^ 4) * 4 * x ^^^ 3),
  1434 (([], Res), 2 * x + cos (x ^^^ 4) * 4 * x ^^^ 3)] *)
  1432 (([], Res), 2 * x + cos (x ^^^ 4) * 4 * x ^^^ 3)] *)
  1435 ============ inhibit exn WN1130621 Isabelle2012-->13 !thehier! ==================*)
  1433 ============ inhibit exn WN1130621 Isabelle2012-->13 !thehier! ==================*)
       
  1434 DEconstrCalcTree 1;
  1436 
  1435 
  1437 "--------- UC errpat add-fraction, fillpat by input --------------";
  1436 "--------- UC errpat add-fraction, fillpat by input --------------";
  1438 "--------- UC errpat add-fraction, fillpat by input --------------";
  1437 "--------- UC errpat add-fraction, fillpat by input --------------";
  1439 "--------- UC errpat add-fraction, fillpat by input --------------";
  1438 "--------- UC errpat add-fraction, fillpat by input --------------";
  1440 (*cp from BridgeLog Java <=> SML*)
  1439 (*cp from BridgeLog Java <=> SML*)
  1441 reset_states ();
  1440 =CalcTree [([], ("e_domID", ["e_pblID"], ["e_metID"]))];
  1442 CalcTree [([], ("e_domID", ["e_pblID"], ["e_metID"]))];
       
  1443 Iterator 1;
  1441 Iterator 1;
  1444 moveActiveRoot 1;
  1442 moveActiveRoot 1;
  1445 moveActiveFormula 1 ([],Pbl);
  1443 moveActiveFormula 1 ([],Pbl);
  1446 replaceFormula 1 "Simplify (5 * x / (4 * y) + 3 * x / (4 * y))";
  1444 replaceFormula 1 "Simplify (5 * x / (4 * y) + 3 * x / (4 * y))";
  1447 autoCalculate 1 CompleteCalcHead;
  1445 autoCalculate 1 CompleteCalcHead;
  1448 autoCalculate 1 (Step 1);
  1446 autoCalculate 1 (Step 1);
  1449 appendFormula 1 "8 * x / (8 * y)" (*|> Future.join*);
  1447 appendFormula 1 "8 * x / (8 * y)" (*|> Future.join*);
  1450 (*<CALCMESSAGE> no derivation found </CALCMESSAGE> 
  1448 (*<CALCMESSAGE> no derivation found </CALCMESSAGE> 
  1451 --- but in BridgeLog Java <=> SML:
  1449 --- but in BridgeLog Java <=> SML:
  1452 <CALCMESSAGE> error pattern #addition-of-fractions# </CALCMESSAGE>*)
  1450 <CALCMESSAGE> error pattern #addition-of-fractions# </CALCMESSAGE>*)
       
  1451 DEconstrCalcTree 1;
  1453 
  1452 
  1454 "--------- UC errpat, fillpat step to Rewrite --------------------";
  1453 "--------- UC errpat, fillpat step to Rewrite --------------------";
  1455 "--------- UC errpat, fillpat step to Rewrite --------------------";
  1454 "--------- UC errpat, fillpat step to Rewrite --------------------";
  1456 "--------- UC errpat, fillpat step to Rewrite --------------------";
  1455 "--------- UC errpat, fillpat step to Rewrite --------------------";
  1457 (*TODO*)
  1456 (*TODO*)
  1458 reset_states ();
  1457 =CalcTree
  1459 CalcTree
       
  1460 [(["functionTerm ((x ^ 2) ^ 3 + sin (x ^ 4))",
  1458 [(["functionTerm ((x ^ 2) ^ 3 + sin (x ^ 4))",
  1461    "differentiateFor x", "derivative f_f'"], 
  1459    "differentiateFor x", "derivative f_f'"], 
  1462   ("Isac", ["derivative_of","function"],
  1460   ("Isac", ["derivative_of","function"],
  1463   ["diff","differentiate_on_R"]))]; (*<<<======= EP is directly in script*)
  1461   ["diff","differentiate_on_R"]))]; (*<<<======= EP is directly in script*)
  1464 Iterator 1;
  1462 Iterator 1;
  1465 moveActiveRoot 1;
  1463 moveActiveRoot 1;
  1466 autoCalculate 1 CompleteCalc;
  1464 autoCalculate 1 CompleteCalc;
  1467 val ((pt,p),_) = get_calc 1; show_pt pt;
  1465 val ((pt,p),_) = get_calc 1; show_pt pt;
       
  1466 DEconstrCalcTree 1;
  1468 
  1467 
  1469 "--------- UC errpat, fillpat step to Rewrite_Set ----------------";
  1468 "--------- UC errpat, fillpat step to Rewrite_Set ----------------";
  1470 "--------- UC errpat, fillpat step to Rewrite_Set ----------------";
  1469 "--------- UC errpat, fillpat step to Rewrite_Set ----------------";
  1471 "--------- UC errpat, fillpat step to Rewrite_Set ----------------";
  1470 "--------- UC errpat, fillpat step to Rewrite_Set ----------------";
  1472 reset_states ();
       
  1473 CalcTree
  1471 CalcTree
  1474 [(["functionTerm ((x ^ 2) ^ 3 + sin (x ^ 4))",
  1472 [(["functionTerm ((x ^ 2) ^ 3 + sin (x ^ 4))",
  1475    "differentiateFor x", "derivative f_f'"], 
  1473    "differentiateFor x", "derivative f_f'"], 
  1476   ("Isac", ["derivative_of","function"],
  1474   ("Isac", ["derivative_of","function"],
  1477   ["diff","after_simplification"]))]; (*<<<======= EP is in a ruleset*)
  1475   ["diff","after_simplification"]))]; (*<<<======= EP is in a ruleset*)
  1515 (* then --- UC errpat, fillpat by input ---*)
  1513 (* then --- UC errpat, fillpat by input ---*)
  1516 *)
  1514 *)
  1517 autoCalculate 1 CompleteCalc;
  1515 autoCalculate 1 CompleteCalc;
  1518 val ((pt,p),_) = get_calc 1; show_pt pt;
  1516 val ((pt,p),_) = get_calc 1; show_pt pt;
  1519 (*WN1208 postponed due to efforts required for stepToErrorPatterns (NEW rewrite_set_)*)
  1517 (*WN1208 postponed due to efforts required for stepToErrorPatterns (NEW rewrite_set_)*)
  1520 
  1518 DEconstrCalcTree 1;
       
  1519