test/Tools/isac/Knowledge/algein.sml
author Thomas Leh <t.leh@gmx.at>
Fri, 22 Jul 2011 14:01:09 +0200
branchdecompose-isar
changeset 42166 911c49949ba9
parent 41977 a3ce4017f41d
child 42195 ac2c5fb8fedd
permissions -rw-r--r--
tuned
     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 val thy = @{theory "AlgEin"};
    21 
    22 
    23 (* use"../smltest/IsacKnowledge/algein.sml";
    24    *)
    25 
    26 "----------- build method 'Berechnung' 'erstSymbolisch' ----------";
    27 "----------- build method 'Berechnung' 'erstSymbolisch' ----------";
    28 "----------- build method 'Berechnung' 'erstSymbolisch' ----------";
    29 val str =
    30 "Script RechnenSymbolScript (k_::bool) (q__::bool) \
    31 \(u_::bool list) (s_::bool list) (o_::bool list) (l_::real) =\
    32 \ (let t_ = (l_ = 1)\
    33 \ in t_)"
    34 ;
    35 (*=== inhibit exn 110722=============================================================
    36 val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
    37 === inhibit exn 110722=============================================================*)
    38 
    39 val str =
    40 "Script RechnenSymbolScript (k_::bool) (q__::bool)           \
    41 \(u_::bool list) (s_::bool list) (o_::bool list) (l_::real) =\
    42 \ (let t_ = Take (l_ = Oben + Senkrecht + Unten);            \
    43 \      sum_ = boollist2sum o_;\
    44 \      t_ = Substitute [Oben = sum_] t_;\
    45 \      t_ = Substitute o_ t_;\
    46 \      t_ = Substitute [k_, q__] t_;\
    47 \      t_ = Repeat (Try (Rewrite_Set norm_Poly False)) t_\
    48 \ in t_)"
    49 ;
    50 (*=== inhibit exn 110722=============================================================
    51 val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
    52 
    53 atomty sc;
    54 atomt sc;
    55 === inhibit exn 110722=============================================================*)
    56 
    57 "----------- me 'Berechnung' 'erstNumerisch' ---------------------";
    58 "----------- me 'Berechnung' 'erstNumerisch' ---------------------";
    59 "----------- me 'Berechnung' 'erstNumerisch' ---------------------";
    60 val fmz = 
    61     ["KantenLaenge (k=10)","Querschnitt (q=1)",
    62      "KantenUnten [b1 = k - 2*q, b2 = k - 2*q, b3 = k - 2*q, b4 = k - 2*q ]", 
    63      "KantenSenkrecht [v1 = k, v2 = k, v3 = k, v4 = k]", 
    64      "KantenOben  [t1 = k - 2*q, t2 = k - 2*q, t3 = k - 2*q, t4 = k - 2*q ]",
    65      "GesamtLaenge L"];
    66 val (dI',pI',mI') =
    67   ("Isac",["numerischSymbolische", "Berechnung"],
    68    ["Berechnung","erstNumerisch"]);
    69 val p = e_pos'; val c = [];
    70 (*=== inhibit exn 110722=============================================================
    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  DEconstrCalcTree 1;
   101 === inhibit exn 110722=============================================================*)
   102 
   103 "----------- auto 'Berechnung' 'erstSymbolisch' ------------------";
   104 "----------- auto 'Berechnung' 'erstSymbolisch' ------------------";
   105 "----------- auto 'Berechnung' 'erstSymbolisch' ------------------";
   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 (*=== inhibit exn 110722=============================================================
   119 if p = ([], Res) andalso term2str (get_obj g_res pt (fst p)) = "L = 104" then()
   120 else error "algein.sml: 'Berechnung' 'erstSymbolisch' changed";
   121 ===== inhibit exn 110722===========================================================*)
   122 (*
   123 show_pt pt;
   124 trace_rewrite:=true;
   125 trace_rewrite:=false;
   126 trace_script:=true;
   127 trace_script:=false;
   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 (*===== inhibit exn 110722===========================================================
   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 ===== inhibit exn 110722===========================================================*)
   152 
   153 val thm = assoc_thm' thy ("sym","");
   154 (*----- STOPPED.WN0x?: Widerspruch 3 = 777: sym contains "==>" instead of "=" !!!
   155 val SOME (t''',_) = rewrite_ thy rew_ord erls false thm t'';
   156 *)
   157 
   158 (* use"../smltest/IsacKnowledge/algein.sml";
   159    *)
   160