test/Tools/isac/Knowledge/algein.sml
author Mathias Lehnfeld <s1210629013@students.fh-hagenberg.at>
Fri, 13 Jun 2014 12:42:15 +0200
changeset 55446 42c45d1241d7
parent 42385 b37adb659ffe
child 59188 c477d0f79ab9
permissions -rw-r--r--
autoCalculate now parallelized
     1 (* tests on AlgEin, Algebra Einf"uhrung, , Unterrichtsversuch IMST-Projekt
     2    author: Walther Neuper 2007
     3    (c) due to copyright terms
     4 *)
     5 
     6 "-----------------------------------------------------------------";
     7 "table of contents -----------------------------------------------";
     8 "-----------------------------------------------------------------";
     9 "----------- build method 'Berechnung' 'erstSymbolisch' ----------";
    10 "----------- me 'Berechnung' 'erstNumerisch' ---------------------";
    11 "----------- auto 'Berechnung' 'erstSymbolisch' ------------------";
    12 "----------- Widerspruch 3 = 777 ---------------------------------";
    13 "-----------------------------------------------------------------";
    14 "-----------------------------------------------------------------";
    15 "-----------------------------------------------------------------";
    16 
    17 val thy = @{theory "AlgEin"};
    18 
    19 
    20 (* use"../smltest/IsacKnowledge/algein.sml";
    21    *)
    22 
    23 "----------- build method 'Berechnung' 'erstSymbolisch' ----------";
    24 "----------- build method 'Berechnung' 'erstSymbolisch' ----------";
    25 "----------- build method 'Berechnung' 'erstSymbolisch' ----------";
    26 val str =
    27 "Script RechnenSymbolScript (k_k::bool) (q__q::bool) \
    28 \(u_u::bool list) (s_s::bool list) (o_o::bool list) (l_l::real) =\
    29 \ (let t_t = (l_l = 1)\
    30 \ in t_t)"
    31 ;
    32 val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
    33 atomty sc;
    34 atomt sc;
    35 
    36 "----------- me 'Berechnung' 'erstNumerisch' ---------------------";
    37 "----------- me 'Berechnung' 'erstNumerisch' ---------------------";
    38 "----------- me 'Berechnung' 'erstNumerisch' ---------------------";
    39 val fmz = 
    40     ["KantenLaenge (k=(10::real))","Querschnitt (q=(1::real))",
    41      "KantenUnten [b1 = k - 2*(q::real), b2 = k - 2*(q::real), b3 = k - 2*(q::real), b4 = k - 2*(q::real) ]", 
    42      "KantenSenkrecht [v1 = (k::real), v2 = (k::real), v3 = (k::real), v4 = (k::real)]", 
    43      "KantenOben  [t1 = k - 2*(q::real), t2 = k - 2*(q::real), t3 = k - 2*(q::real), t4 = k - 2*(q::real) ]",
    44      "GesamtLaenge L"];
    45 val (dI',pI',mI') =
    46   ("Isac",["numerischSymbolische", "Berechnung"],
    47    ["Berechnung","erstNumerisch"]);
    48 val p = e_pos'; val c = [];
    49 val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))](*nxt = ("Model_Pr*);
    50 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "KantenLaenge (k = 10)"*);
    51 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "Querschnitt (q = 1)"*);
    52 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "KantenUnten [b1 = k - 2*q]"*);
    53 val (p,_,f,nxt,_,pt) = me nxt p c pt(*..KantenUnten [b2 = k - 2 * q, b3=..b4*);
    54 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "KantenSenkrecht [v1 = k]"*);
    55 val (p,_,f,nxt,_,pt) = me nxt p c pt(*..KantenSenkrecht [v2 = k, v3 = k, v4]*);
    56 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "KantenOben [b1 = k - 2 *q])*);
    57 val (p,_,f,nxt,_,pt) = me nxt p c pt(*..KantenOben [b2 = k - 2 * q, b3 =, b4*);
    58 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Find "GesamtLaenge L"*);
    59 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Specify_Theory "AlgEin"*);
    60 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Specify_Problem ["numerischSymbolis,Be*);
    61 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Specify_Method ["Berechnung", "erstSym*);
    62 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Apply_Method*);
    63 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Substitute["Oben = boollist2sum [b1 =*);
    64 f2str f;
    65 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Substitute ["t1 = k - 2 * q", *);f2str f;
    66 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Substitute ["k = 10", "q = 1"]*);f2str f;
    67 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Rewrite_Set "norm_Rational"*);f2str f;
    68 val (p,_,f,nxt,_,pt) = me nxt p c pt(**);
    69 if f2str f = "L = 32 + senkrecht + unten" then ()
    70 else error "algein.sml diff.behav. in erstSymbolisch 1";
    71 val (p,_,f,nxt,_,pt) = me nxt p c pt;val(p,_,f,nxt,_,pt)=me nxt p c pt;f2str f;
    72 val (p,_,f,nxt,_,pt) = me nxt p c pt;val(p,_,f,nxt,_,pt)=me nxt p c pt;f2str f;
    73 val (p,_,f,nxt,_,pt) = me nxt p c pt;val(p,_,f,nxt,_,pt)=me nxt p c pt;f2str f;
    74 val (p,_,f,nxt,_,pt) = me nxt p c pt;val(p,_,f,nxt,_,pt)=me nxt p c pt;f2str f;
    75 val (p,_,f,nxt,_,pt) = me nxt p c pt;
    76 if f2str f = "L = 104" andalso nxt = ("End_Proof'", End_Proof') then ()
    77 else error "algein.sml diff.behav. in erstSymbolisch 99";
    78  DEconstrCalcTree 1;
    79 
    80 "----------- auto 'Berechnung' 'erstSymbolisch' ------------------";
    81 "----------- auto 'Berechnung' 'erstSymbolisch' ------------------";
    82 "----------- auto 'Berechnung' 'erstSymbolisch' ------------------";
    83 CalcTree
    84 [(["KantenLaenge (k=(10::real))","Querschnitt (q=(1::real))",
    85      "KantenUnten [b1 = k - 2*(q::real), b2 = k - 2*(q::real), b3 = k - 2*(q::real), b4 = k - 2*(q::real) ]", 
    86      "KantenSenkrecht [v1 = (k::real), v2 = (k::real), v3 = (k::real), v4 = (k::real)]", 
    87      "KantenOben  [t1 = k - 2*(q::real), t2 = k - 2*(q::real), t3 = k - 2*(q::real), t4 = k - 2*(q::real) ]",
    88      "GesamtLaenge L"], 
    89   ("Isac",["numerischSymbolische", "Berechnung"],
    90    ["Berechnung","erstSymbolisch"]))];
    91 Iterator 1;
    92 moveActiveRoot 1;
    93 autoCalculate' 1 CompleteCalc;
    94 val ((pt,p),_) = get_calc 1; show_pt pt;
    95 if p = ([], Res) andalso term2str (get_obj g_res pt (fst p)) = "L = 104" then()
    96 else error "algein.sml: 'Berechnung' 'erstSymbolisch' changed";
    97 
    98 "----------- Widerspruch 3 = 777 ---------------------------------";
    99 "----------- Widerspruch 3 = 777 ---------------------------------";
   100 "----------- Widerspruch 3 = 777 ---------------------------------";
   101 val thy = @{theory "Isac"}; 
   102 val rew_ord = dummy_ord;
   103 val erls = Erls;
   104 val thm = assoc_thm' thy ("sym_mult_zero_right","");
   105 val t = str2term "0 = (0::real)";
   106 val SOME (t',_) = rewrite_ thy rew_ord erls false thm t;
   107 term2str t' = "0 = ?a1 * 0"; (* = true*)
   108 
   109 (*testing code in ME/appl.sml*)
   110 val sube = ["?a1 = (3::real)"];
   111 val subte = sube2subte sube;
   112 terms2str' subte = "[?a1 = 3]"; (* = true*)
   113 val subst = sube2subst thy sube;
   114 foldl and_ (true, map contains_Var subte);
   115 
   116 val t'' = subst_atomic subst t';
   117 term2str t'' = "0 = 3 * 0"; (* = true*)
   118 
   119 val thm = assoc_thm' thy ("sym","");
   120 (*----- STOPPED.WN0x?: Widerspruch 3 = 777: sym contains "==>" instead of "=" !!!
   121 val SOME (t''',_) = rewrite_ thy rew_ord erls false thm t'';
   122 *)
   123