test/Tools/isac/Knowledge/simplify.sml
author Mathias Lehnfeld <s1210629013@students.fh-hagenberg.at>
Mon, 10 Mar 2014 21:07:35 +0100
changeset 55402 d580d7fc9b8e
parent 52105 2786cc9704c8
child 55445 33b0f6db720c
permissions -rw-r--r--
user session management now parallel

appendFormula uses futures.
     1 (* tests on simplification
     2    author: Walther Neuper
     3    061019
     4    (c) due to copyright terms
     5 
     6 use"../smltest/IsacKnowledge/simplify.sml";
     7 use"simplify.sml";
     8 *)
     9 
    10 "--------------------------------------------------------";
    11 "--------------------------------------------------------";
    12 "table of contents --------------------------------------";
    13 "--------------------------------------------------------";
    14 "----------- CAS-command Simplify -----------------------";
    15 "----------- append inform with final result ------------";
    16 "--------------------------------------------------------";
    17 "--------------------------------------------------------";
    18 "--------------------------------------------------------";
    19 
    20 val thy = @{theory "Simplify"};
    21 
    22 "----------- CAS-command Simplify -----------------------";
    23 "----------- CAS-command Simplify -----------------------";
    24 "----------- CAS-command Simplify -----------------------";
    25 (*============ inhibit exn WN120321 ==============================================
    26 WN120321.TODO reanimate test/../simplify.sml: CAS-command Simplify
    27 
    28 states:=[];
    29 CalcTree [([], ("e_domID", ["e_pblID"], ["e_metID"]))];
    30 Iterator 1;
    31 moveActiveRoot 1;
    32 replaceFormula 1 "Simplify (2*a + 3*a)";
    33 autoCalculate 1 (Step 1);
    34 autoCalculate 1 CompleteCalc;
    35 val ((pt,p),_) = get_calc 1;
    36 val Form res = (#1 o pt_extract) (pt, ([],Res)); show_pt pt; term2str res;
    37 if p = ([], Res) andalso term2str res = "5 * a" then ()
    38 else error "simplify.sml: diff.behav. CAScmd: Simplify (2*a + 3*a)";
    39 ============ inhibit exn WN120321 ==============================================*)
    40 
    41 
    42 "----------- append inform with final result ------------";
    43 "----------- append inform with final result ------------";
    44 "----------- append inform with final result ------------";
    45 states:=[];
    46 CalcTree [(["Term ((14 * x * y) / ( x * y ))", "normalform N"],
    47 	("Rational", ["rational","simplification"], ["simplification","of_rationals"]))];
    48 Iterator 1;
    49 moveActiveRoot 1;
    50 autoCalculate 1 CompleteCalcHead;
    51 val ((pt,p),_) = get_calc 1; show_pt pt; 
    52 (*[
    53 (([], Frm), Simplify (14 * x * y / (x * y)))] *)
    54 pt_extract (pt, p); (*determines SOME (Apply_Method ["simplification", "of_rationals"])*)
    55 
    56 autoCalculate 1 (Step 1);
    57 val ((pt,p),_) = get_calc 1; show_pt pt;
    58 (*[
    59 (([], Frm), Simplify (14 * x * y / (x * y))),
    60 (([1], Frm), 14 * x * y / (x * y))] *)
    61 
    62 appendFormula 1 "14" |> Future.join;
    63 val ((pt,p),_) = get_calc 1; show_pt pt;
    64 (*[
    65 (([], Frm), Simplify (14 * x * y / (x * y))),
    66 (([1], Frm), 14 * x * y / (x * y)),
    67 (([1,1], Frm), 14 * x * y / (x * y)),
    68 (([1,1], Res), 14 * (x * y) / (x * y)),
    69 (([1,2], Res), 14 / 1),
    70 (([1,3], Res), 14),
    71 (([1], Res), 14)]*)
    72 
    73 autoCalculate 1 (Step 1);
    74 val ((pt,p),_) = get_calc 1; show_pt pt;
    75 (*[
    76 (([], Frm), Simplify (14 * x * y / (x * y))),
    77 (([1], Frm), 14 * x * y / (x * y)),
    78 (([1,1], Frm), 14 * x * y / (x * y)),
    79 (([1,1], Res), 14 * (x * y) / (x * y)),
    80 (([1,2], Res), 14 / 1),
    81 (([1,3], Res), 14),
    82 (([1], Res), 14),
    83 (([], Res), 14)] *)
    84 val Form res = (#1 o pt_extract) (pt, ([],Res));
    85 if p = ([], Res) andalso term2str res = "14" then ()
    86 else error "simplify.sml: append inform with final result changed";
    87