test/Tools/isac/Knowledge/algein.sml
author Walther Neuper <neuper@ist.tugraz.at>
Fri, 06 May 2011 11:18:07 +0200
branchdecompose-isar
changeset 41977 a3ce4017f41d
parent 41943 f33f6959948b
child 42166 911c49949ba9
permissions -rw-r--r--
intermed. ctxt ..: cleanup before start with Add_Given

uncommenting in src/../calchead.sm 2x "update_env" after "prep_ori"
marked with GOON.WN110506
causes errors in most test/../*, all with CalcTreeTEST; me; ..
     1 (* tests on AlgEin, Algebra Einf"uhrung, , Unterrichtsversuch IMST-Projekt
     2    author: Walther Neuper 2007
     3    (c) due to copyright terms
     4 
     5 use"../smltest/IsacKnowledge/algein.sml";
     6 use"algein.sml";
     7 *)
     8 
     9 "-----------------------------------------------------------------";
    10 "table of contents -----------------------------------------------";
    11 "-----------------------------------------------------------------";
    12 "----------- build method 'Berechnung' 'erstSymbolisch' ----------";
    13 "----------- me 'Berechnung' 'erstNumerisch' ---------------------";
    14 "----------- auto 'Berechnung' 'erstSymbolisch' ------------------";
    15 "----------- Widerspruch 3 = 777 ---------------------------------";
    16 "-----------------------------------------------------------------";
    17 "-----------------------------------------------------------------";
    18 "-----------------------------------------------------------------";
    19 
    20 (*=== inhibit exn ?=============================================================
    21 val thy = AlgEin.thy;
    22 
    23 
    24 (* use"../smltest/IsacKnowledge/algein.sml";
    25    *)
    26 
    27 "----------- build method 'Berechnung' 'erstSymbolisch' ----------";
    28 "----------- build method 'Berechnung' 'erstSymbolisch' ----------";
    29 "----------- build method 'Berechnung' 'erstSymbolisch' ----------";
    30 val str =
    31 "Script RechnenSymbolScript (k_::bool) (q__::bool) \
    32 \(u_::bool list) (s_::bool list) (o_::bool list) (l_::real) =\
    33 \ (let t_ = (l_ = 1)\
    34 \ in t_)"
    35 ;
    36 val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
    37 (*---^^^-OK-----------------------------------------------------------------*)
    38 val str =
    39 "Script RechnenSymbolScript (k_::bool) (q__::bool)           \
    40 \(u_::bool list) (s_::bool list) (o_::bool list) (l_::real) =\
    41 \ (let t_ = Take (l_ = Oben + Senkrecht + Unten);            \
    42 \      sum_ = boollist2sum o_;\
    43 \      t_ = Substitute [Oben = sum_] t_;\
    44 \      t_ = Substitute o_ t_;\
    45 \      t_ = Substitute [k_, q__] t_;\
    46 \      t_ = Repeat (Try (Rewrite_Set norm_Poly False)) t_\
    47 \ in t_)"
    48 ;
    49 val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
    50 (*---vvv-NOTok--------------------------------------------------------------*)
    51 
    52 
    53 
    54 atomty sc;
    55 atomt sc;
    56 
    57 
    58 "----------- me 'Berechnung' 'erstNumerisch' ---------------------";
    59 "----------- me 'Berechnung' 'erstNumerisch' ---------------------";
    60 "----------- me 'Berechnung' 'erstNumerisch' ---------------------";
    61 val fmz = 
    62     ["KantenLaenge (k=10)","Querschnitt (q=1)",
    63      "KantenUnten [b1 = k - 2*q, b2 = k - 2*q, b3 = k - 2*q, b4 = k - 2*q ]", 
    64      "KantenSenkrecht [v1 = k, v2 = k, v3 = k, v4 = k]", 
    65      "KantenOben  [t1 = k - 2*q, t2 = k - 2*q, t3 = k - 2*q, t4 = k - 2*q ]",
    66      "GesamtLaenge L"];
    67 val (dI',pI',mI') =
    68   ("Isac",["numerischSymbolische", "Berechnung"],
    69    ["Berechnung","erstNumerisch"]);
    70 val p = e_pos'; val c = [];
    71 val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))](*nxt = ("Model_Pr*);
    72 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "KantenLaenge (k = 10)"*);
    73 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "Querschnitt (q = 1)"*);
    74 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "KantenUnten [b1 = k - 2*q]"*);
    75 val (p,_,f,nxt,_,pt) = me nxt p c pt(*..KantenUnten [b2 = k - 2 * q, b3=..b4*);
    76 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "KantenSenkrecht [v1 = k]"*);
    77 val (p,_,f,nxt,_,pt) = me nxt p c pt(*..KantenSenkrecht [v2 = k, v3 = k, v4]*);
    78 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "KantenOben [b1 = k - 2 *q])*);
    79 val (p,_,f,nxt,_,pt) = me nxt p c pt(*..KantenOben [b2 = k - 2 * q, b3 =, b4*);
    80 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Find "GesamtLaenge L"*);
    81 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Specify_Theory "AlgEin"*);
    82 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Specify_Problem ["numerischSymbolis,Be*);
    83 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Specify_Method ["Berechnung", "erstSym*);
    84 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Apply_Method*);
    85 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Substitute["Oben = boollist2sum [b1 =*);
    86 f2str f;
    87 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Substitute ["t1 = k - 2 * q", *);f2str f;
    88 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Substitute ["k = 10", "q = 1"]*);f2str f;
    89 val (p,_,f,nxt,_,pt) = me nxt p c pt(*Rewrite_Set "norm_Rational"*);f2str f;
    90 val (p,_,f,nxt,_,pt) = me nxt p c pt(**);
    91 if f2str f = "L = 32 + senkrecht + unten" then ()
    92 else error "algein.sml diff.behav. in erstSymbolisch 1";
    93 val (p,_,f,nxt,_,pt) = me nxt p c pt;val(p,_,f,nxt,_,pt)=me nxt p c pt;f2str f;
    94 val (p,_,f,nxt,_,pt) = me nxt p c pt;val(p,_,f,nxt,_,pt)=me nxt p c pt;f2str f;
    95 val (p,_,f,nxt,_,pt) = me nxt p c pt;val(p,_,f,nxt,_,pt)=me nxt p c pt;f2str f;
    96 val (p,_,f,nxt,_,pt) = me nxt p c pt;val(p,_,f,nxt,_,pt)=me nxt p c pt;f2str f;
    97 val (p,_,f,nxt,_,pt) = me nxt p c pt;
    98 if f2str f = "L = 104" andalso nxt = ("End_Proof'", End_Proof') then ()
    99 else error "algein.sml diff.behav. in erstSymbolisch 99";
   100 
   101 
   102 "----------- auto 'Berechnung' 'erstSymbolisch' ------------------";
   103 "----------- auto 'Berechnung' 'erstSymbolisch' ------------------";
   104 "----------- auto 'Berechnung' 'erstSymbolisch' ------------------";
   105 states:=[];
   106 CalcTree
   107 [(["KantenLaenge (k=10)","Querschnitt (q=1)",
   108    "KantenUnten [b1 = k - 2*q, b2 = k - 2*q, b3 = k - 2*q, b4 = k - 2*q ]", 
   109    "KantenSenkrecht [v1 = k, v2 = k, v3 = k, v4 = k]", 
   110    "KantenOben  [t1 = k - 2*q, t2 = k - 2*q, t3 = k - 2*q, t4 = k - 2*q ]",
   111    "GesamtLaenge L"], 
   112   ("Isac",["numerischSymbolische", "Berechnung"],
   113    ["Berechnung","erstSymbolisch"]))];
   114 Iterator 1;
   115 moveActiveRoot 1;
   116 autoCalculate 1 CompleteCalc;
   117 val ((pt,p),_) = get_calc 1; show_pt pt;
   118 if p = ([], Res) andalso term2str (get_obj g_res pt (fst p)) = "L = 104" then()
   119 else error "algein.sml: 'Berechnung' 'erstSymbolisch' changed";
   120 
   121 (*
   122 show_pt pt;
   123 trace_rewrite:=true;
   124 trace_rewrite:=false;
   125 trace_script:=true;
   126 trace_script:=false;
   127 *)
   128 
   129 "----------- Widerspruch 3 = 777 ---------------------------------";
   130 "----------- Widerspruch 3 = 777 ---------------------------------";
   131 "----------- Widerspruch 3 = 777 ---------------------------------";
   132 val thy = (theory "Isac"); 
   133 val rew_ord = dummy_ord;
   134 val erls = Erls;
   135 
   136 val thm = assoc_thm' thy ("sym_real_mult_0_right","");
   137 val t = str2term "0 = 0";
   138 val SOME (t',_) = rewrite_ thy rew_ord erls false thm t;
   139 term2str t';
   140 (********"0 = ?z1 * 0"*)
   141 
   142 (*testing code in ME/appl.sml*)
   143 val sube = ["?z1 = 3"];
   144 val subte = sube2subte sube;
   145 val subst = sube2subst thy sube;
   146 foldl and_ (true, map contains_Var subte);
   147 
   148 val t'' = subst_atomic subst t';
   149 term2str t'';
   150 (********"0 = 3 * 0"*)
   151 
   152 val thm = assoc_thm' thy ("sym","");
   153 (*----- STOPPED.WN0x?: Widerspruch 3 = 777: sym contains "==>" instead of "=" !!!
   154 val SOME (t''',_) = rewrite_ thy rew_ord erls false thm t'';
   155 *)
   156 
   157 (* use"../smltest/IsacKnowledge/algein.sml";
   158    *)
   159 
   160 ===== inhibit exn ?===========================================================*)