test/Tools/isac/Knowledge/algein.sml
author wneuper <Walther.Neuper@jku.at>
Wed, 11 Jan 2023 11:38:01 +0100
changeset 60650 06ec8abfd3bc
parent 60586 007ef64dbb08
child 60660 c4b24621077e
permissions -rw-r--r--
eliminate use of Thy_Info 12: TermC partially
neuper@37906
     1
(* tests on AlgEin, Algebra Einf"uhrung, , Unterrichtsversuch IMST-Projekt
neuper@37906
     2
   author: Walther Neuper 2007
neuper@37906
     3
   (c) due to copyright terms
neuper@37906
     4
*)
neuper@37906
     5
neuper@37906
     6
"-----------------------------------------------------------------";
neuper@37906
     7
"table of contents -----------------------------------------------";
neuper@37906
     8
"-----------------------------------------------------------------";
neuper@37906
     9
"----------- build method 'Berechnung' 'erstSymbolisch' ----------";
neuper@37906
    10
"----------- me 'Berechnung' 'erstNumerisch' ---------------------";
neuper@37906
    11
"----------- auto 'Berechnung' 'erstSymbolisch' ------------------";
neuper@37906
    12
"----------- Widerspruch 3 = 777 ---------------------------------";
neuper@37906
    13
"-----------------------------------------------------------------";
neuper@37906
    14
"-----------------------------------------------------------------";
neuper@37906
    15
"-----------------------------------------------------------------";
neuper@37906
    16
t@42166
    17
val thy = @{theory "AlgEin"};
Walther@60424
    18
val ctxt = Proof_Context.init_global thy;
neuper@37906
    19
neuper@37906
    20
"----------- build method 'Berechnung' 'erstSymbolisch' ----------";
neuper@37906
    21
"----------- build method 'Berechnung' 'erstSymbolisch' ----------";
neuper@37906
    22
"----------- build method 'Berechnung' 'erstSymbolisch' ----------";
neuper@37906
    23
val str =
wneuper@59585
    24
"Program RechnenSymbolScript (k_k::bool) (q__q::bool) \
neuper@42385
    25
\(u_u::bool list) (s_s::bool list) (o_o::bool list) (l_l::real) =\
neuper@42385
    26
\ (let t_t = (l_l = 1)\
neuper@42385
    27
\ in t_t)"
neuper@37906
    28
;
Walther@60424
    29
val sc = (inst_abs o (TermC.parseNEW' ctxt)) str;
Walther@60650
    30
TermC.atom_trace_detail @{context} sc;
Walther@60650
    31
TermC.atom_trace @{context} sc;
neuper@37906
    32
neuper@37906
    33
"----------- me 'Berechnung' 'erstNumerisch' ---------------------";
neuper@37906
    34
"----------- me 'Berechnung' 'erstNumerisch' ---------------------";
neuper@37906
    35
"----------- me 'Berechnung' 'erstNumerisch' ---------------------";
neuper@37906
    36
val fmz = 
walther@59997
    37
    ["KantenLaenge (k=(10::real))", "Querschnitt (q=(1::real))",
neuper@42385
    38
     "KantenUnten [b1 = k - 2*(q::real), b2 = k - 2*(q::real), b3 = k - 2*(q::real), b4 = k - 2*(q::real) ]", 
neuper@42385
    39
     "KantenSenkrecht [v1 = (k::real), v2 = (k::real), v3 = (k::real), v4 = (k::real)]", 
neuper@42385
    40
     "KantenOben  [t1 = k - 2*(q::real), t2 = k - 2*(q::real), t3 = k - 2*(q::real), t4 = k - 2*(q::real) ]",
neuper@37906
    41
     "GesamtLaenge L"];
neuper@37906
    42
val (dI',pI',mI') =
wneuper@59592
    43
  ("Isac_Knowledge",["numerischSymbolische", "Berechnung"],
walther@59997
    44
   ["Berechnung", "erstNumerisch"]);
neuper@37906
    45
val p = e_pos'; val c = [];
Walther@60571
    46
val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))](*nxt = ("Model_Pr*);
neuper@37906
    47
val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "KantenLaenge (k = 10)"*);
neuper@37906
    48
val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "Querschnitt (q = 1)"*);
neuper@37906
    49
val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "KantenUnten [b1 = k - 2*q]"*);
neuper@37906
    50
val (p,_,f,nxt,_,pt) = me nxt p c pt(*..KantenUnten [b2 = k - 2 * q, b3=..b4*);
neuper@37906
    51
val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "KantenSenkrecht [v1 = k]"*);
neuper@37906
    52
val (p,_,f,nxt,_,pt) = me nxt p c pt(*..KantenSenkrecht [v2 = k, v3 = k, v4]*);
neuper@37906
    53
val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "KantenOben [b1 = k - 2 *q])*);
neuper@37906
    54
val (p,_,f,nxt,_,pt) = me nxt p c pt(*..KantenOben [b2 = k - 2 * q, b3 =, b4*);
neuper@37906
    55
val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Find "GesamtLaenge L"*);
neuper@37991
    56
val (p,_,f,nxt,_,pt) = me nxt p c pt(*Specify_Theory "AlgEin"*);
neuper@37906
    57
val (p,_,f,nxt,_,pt) = me nxt p c pt(*Specify_Problem ["numerischSymbolis,Be*);
neuper@37906
    58
val (p,_,f,nxt,_,pt) = me nxt p c pt(*Specify_Method ["Berechnung", "erstSym*);
neuper@37906
    59
val (p,_,f,nxt,_,pt) = me nxt p c pt(*Apply_Method*);
neuper@37906
    60
val (p,_,f,nxt,_,pt) = me nxt p c pt(*Substitute["Oben = boollist2sum [b1 =*);
neuper@37906
    61
f2str f;
neuper@37906
    62
val (p,_,f,nxt,_,pt) = me nxt p c pt(*Substitute ["t1 = k - 2 * q", *);f2str f;
neuper@37906
    63
val (p,_,f,nxt,_,pt) = me nxt p c pt(*Substitute ["k = 10", "q = 1"]*);f2str f;
neuper@37906
    64
val (p,_,f,nxt,_,pt) = me nxt p c pt(*Rewrite_Set "norm_Rational"*);f2str f;
neuper@37906
    65
val (p,_,f,nxt,_,pt) = me nxt p c pt(**);
neuper@37906
    66
if f2str f = "L = 32 + senkrecht + unten" then ()
wneuper@59508
    67
else error "algein.sml diff.behav. in erstNumerisch 1";
neuper@37906
    68
val (p,_,f,nxt,_,pt) = me nxt p c pt;val(p,_,f,nxt,_,pt)=me nxt p c pt;f2str f;
neuper@37906
    69
val (p,_,f,nxt,_,pt) = me nxt p c pt;val(p,_,f,nxt,_,pt)=me nxt p c pt;f2str f;
neuper@37906
    70
val (p,_,f,nxt,_,pt) = me nxt p c pt;val(p,_,f,nxt,_,pt)=me nxt p c pt;f2str f;
neuper@37906
    71
val (p,_,f,nxt,_,pt) = me nxt p c pt;val(p,_,f,nxt,_,pt)=me nxt p c pt;f2str f;
neuper@37906
    72
val (p,_,f,nxt,_,pt) = me nxt p c pt;
wneuper@59253
    73
if f2str f = "L = 104"
walther@59749
    74
then case nxt of End_Proof' => ()
wneuper@59508
    75
  | _ => error "algein.sml diff.behav. in erstNumerisch 99 1"
wneuper@59508
    76
else error "algein.sml diff.behav. in erstNumerisch 99 2";
wneuper@59253
    77
DEconstrCalcTree 1;
neuper@37906
    78
neuper@37906
    79
"----------- auto 'Berechnung' 'erstSymbolisch' ------------------";
neuper@37906
    80
"----------- auto 'Berechnung' 'erstSymbolisch' ------------------";
neuper@37906
    81
"----------- auto 'Berechnung' 'erstSymbolisch' ------------------";
Walther@60571
    82
CalcTree @{context}
walther@59997
    83
[(["KantenLaenge (k=(10::real))", "Querschnitt (q=(1::real))",
neuper@42385
    84
     "KantenUnten [b1 = k - 2*(q::real), b2 = k - 2*(q::real), b3 = k - 2*(q::real), b4 = k - 2*(q::real) ]", 
neuper@42385
    85
     "KantenSenkrecht [v1 = (k::real), v2 = (k::real), v3 = (k::real), v4 = (k::real)]", 
neuper@42385
    86
     "KantenOben  [t1 = k - 2*(q::real), t2 = k - 2*(q::real), t3 = k - 2*(q::real), t4 = k - 2*(q::real) ]",
neuper@42385
    87
     "GesamtLaenge L"], 
wneuper@59592
    88
  ("Isac_Knowledge",["numerischSymbolische", "Berechnung"],
walther@59997
    89
   ["Berechnung", "erstSymbolisch"]))];
neuper@37906
    90
Iterator 1;
neuper@37906
    91
moveActiveRoot 1;
wneuper@59248
    92
autoCalculate 1 CompleteCalc;
Walther@60549
    93
val ((pt,p),_) = States.get_calc 1; Test_Tool.show_pt pt;
walther@59868
    94
if p = ([], Res) andalso UnparseC.term (get_obj g_res pt (fst p)) = "L = 104" then()
neuper@38031
    95
else error "algein.sml: 'Berechnung' 'erstSymbolisch' changed";
neuper@42385
    96
neuper@37906
    97
"----------- Widerspruch 3 = 777 ---------------------------------";
neuper@37906
    98
"----------- Widerspruch 3 = 777 ---------------------------------";
neuper@37906
    99
"----------- Widerspruch 3 = 777 ---------------------------------";
wneuper@59592
   100
val thy = @{theory "Isac_Knowledge"}; 
Walther@60500
   101
val ctxt = Proof_Context.init_global thy;
Walther@60509
   102
val rew_ord = Rewrite_Ord.function_empty;
Walther@60586
   103
val asm_rls = Rule_Set.Empty;
walther@59876
   104
val thm = ThmC.thm_from_thy thy "sym_mult_zero_right";
Walther@60565
   105
val t = TermC.parse_test @{context} "0 = (0::real)";
Walther@60586
   106
val SOME (t',_) = rewrite_ ctxt rew_ord asm_rls false thm t;
walther@59868
   107
UnparseC.term t' = "0 = ?a1 * 0"; (* = true*)
neuper@37906
   108
neuper@42385
   109
val sube = ["?a1 = (3::real)"];
Walther@60567
   110
(*----------------vvvvvvvvvvvvvv ERROR Unbound schematic variable: ?a1
Walther@60567
   111
  --------------- review together with development of Widerspruch 3 = 77* )
Walther@60567
   112
val subte = Subst.input_to_terms @{context} sube;
walther@59868
   113
UnparseC.terms_short subte = "[?a1 = 3]"; (* = true*)
walther@59912
   114
val subst = Subst.T_from_string_eqs thy sube;
walther@60230
   115
foldl and_ (true, map TermC.contains_Var subte);
neuper@37906
   116
neuper@37906
   117
val t'' = subst_atomic subst t';
walther@59868
   118
UnparseC.term t'' = "0 = 3 * 0"; (* = true*)
neuper@37906
   119
walther@59876
   120
val thm = ThmC.thm_from_thy thy "sym";
neuper@41977
   121
(*----- STOPPED.WN0x?: Widerspruch 3 = 777: sym contains "==>" instead of "=" !!!
Walther@60586
   122
val SOME (t''',_) = rewrite_ thy rew_ord asm_rls false thm t'';
neuper@37906
   123
*)
Walther@60567
   124
( *----------------^^^^^^^^^^^^^^ ERROR Unbound schematic variable: ?a1*)