test/Tools/isac/Knowledge/diff.sml
author Walther Neuper <walther.neuper@jku.at>
Wed, 20 May 2020 12:52:09 +0200
changeset 59997 46fe5a8c3911
parent 59989 31f54ab9b2ce
child 60154 2ab0d1523731
permissions -rw-r--r--
standard format for string lists
neuper@37906
     1
(* 
neuper@37906
     2
neuper@37906
     3
use"../smltest/IsacKnowledge/diff.sml";
neuper@37906
     4
use"diff.sml";
neuper@37906
     5
*)
neuper@37906
     6
neuper@38081
     7
"--------------------------------------------------------";
neuper@38081
     8
"--------------------------------------------------------";
neuper@38081
     9
"table of contents --------------------------------------";
neuper@38081
    10
"--------------------------------------------------------";
neuper@38081
    11
"----------- problemtype --------------------------------";
neuper@38081
    12
"----------- for correction of diff_const ---------------";
neuper@38081
    13
"----------- for correction of diff_quot ----------------";
neuper@38081
    14
"----------- differentiate by rewrite -------------------";
neuper@38081
    15
"----------- differentiate: me (*+ tacs input*) ---------";
neuper@38081
    16
"----------- 1.5.02 me from script ----------------------";
neuper@38081
    17
"----------- primed id ----------------------------------";
neuper@38081
    18
"----------- diff_conv, sym_diff_conv -------------------";
wneuper@59248
    19
"----------- autoCalculate differentiate_on_R 2/x^2 -----";
wneuper@59248
    20
"----------- autoCalculate diff after_simplification ----";
wneuper@59248
    21
"----------- autoCalculate differentiate_equality -------";
neuper@38081
    22
"----------- tests for examples -------------------------";
wneuper@59562
    23
"------------inform for x^2+x+1 -------------------------";
neuper@38081
    24
"--------------------------------------------------------";
neuper@38081
    25
"--------------------------------------------------------";
neuper@38081
    26
"--------------------------------------------------------";
neuper@37906
    27
neuper@37906
    28
neuper@41929
    29
val thy = @{theory "Diff"};
neuper@37906
    30
neuper@38081
    31
"----------- problemtype --------------------------------";
neuper@38081
    32
"----------- problemtype --------------------------------";
neuper@38081
    33
"----------- problemtype --------------------------------";
neuper@37994
    34
val pbt = {Given =["functionTerm f_f", "differentiateFor v_v"],
neuper@37906
    35
	   Where =[],
neuper@37994
    36
	   Find  =["derivative f_f'"],
neuper@37906
    37
	   With  =[],
neuper@37906
    38
	   Relate=[]}:string ppc;
walther@59989
    39
val chkpbt = ((map (the o (parse thy))) o P_Model.to_list) pbt;
neuper@37906
    40
neuper@37906
    41
val org = ["functionTerm (d_d x (x ^^^ 2 + 3 * x + 4))", 
walther@59997
    42
	   "differentiateFor x", "derivative f_f'"];
neuper@38081
    43
val chkorg = map (the o (parse thy)) org;
neuper@37906
    44
walther@59997
    45
Problem.from_store ["derivative_of", "function"];
walther@59997
    46
Method.from_store ["diff", "differentiate_on_R"];
neuper@37906
    47
neuper@38081
    48
"----------- for correction of diff_const ---------------";
neuper@38081
    49
"----------- for correction of diff_const ---------------";
neuper@38081
    50
"----------- for correction of diff_const ---------------";
neuper@37906
    51
(*re-evaluate this file, otherwise > *** ME_Isa: 'erls' not known*)
wneuper@59384
    52
val t = (Thm.term_of o the o (parse thy)) "Not (x =!= a)";
wneuper@59384
    53
case rewrite_set_ thy false erls_diff t of
wneuper@59384
    54
  SOME (Const ("HOL.True", _), []) => ()
wneuper@59384
    55
| _ => error "rewrite_set_  Not (x =!= a)  changed";
neuper@37906
    56
wneuper@59384
    57
val t =(Thm.term_of o the o (parse thy)) "2 is_const";
wneuper@59384
    58
case rewrite_set_ thy false erls_diff t of
wneuper@59384
    59
  SOME (Const ("HOL.True", _), []) => ()
wneuper@59384
    60
| _ => error "rewrite_set_   2 is_const   changed";
neuper@37906
    61
walther@59965
    62
val thm = @{thm diff_const};
wneuper@59384
    63
val ct = (Thm.term_of o the o (parse thy)) "d_d x x";
walther@59656
    64
val subst = [(@{term "bdv::real"}, @{term "x::real"})];
wneuper@59384
    65
val NONE = (rewrite_inst_ thy tless_true erls_diff false subst thm ct);
neuper@37906
    66
neuper@38081
    67
"----------- for correction of diff_quot ----------------";
neuper@38081
    68
"----------- for correction of diff_quot ----------------";
neuper@38081
    69
"----------- for correction of diff_quot ----------------";
wneuper@59384
    70
val thy = @{theory "Diff"};
wneuper@59384
    71
val ct = (Thm.term_of o the o (parse thy)) "Not (x = 0)";
wneuper@59384
    72
rewrite_set_ thy false erls_diff ct;
neuper@37906
    73
wneuper@59384
    74
val ct = (Thm.term_of o the o (parse thy)) "d_d x ((x+1) / (x - 1))";
wneuper@59384
    75
val thm = @{thm diff_quot};
neuper@37926
    76
val SOME (ctt,_) =
wneuper@59384
    77
    (rewrite_inst_ thy tless_true erls_diff true subst thm ct);
neuper@37906
    78
neuper@38081
    79
"----------- differentiate by rewrite -------------------";
neuper@38081
    80
"----------- differentiate by rewrite -------------------";
neuper@38081
    81
"----------- differentiate by rewrite -------------------";
wneuper@59384
    82
val thy = @{theory "Diff"};
wneuper@59384
    83
val ct = (Thm.term_of o the o (parse thy)) "d_d x (x ^^^ 2 + 3 * x + 4)";
neuper@37906
    84
"--- 1 ---";
wneuper@59384
    85
val thm = @{thm "diff_sum"};
wneuper@59384
    86
val (ct, _) = the (rewrite_inst_ thy tless_true erls_diff true subst thm ct);
neuper@37906
    87
"--- 2 ---";
wneuper@59384
    88
val (ct, _) = the (rewrite_inst_ thy tless_true erls_diff true subst thm ct);
neuper@37906
    89
"--- 3 ---";
wneuper@59384
    90
val thm = @{thm "diff_prod_const"};
wneuper@59384
    91
val (ct, _) = the (rewrite_inst_ thy tless_true erls_diff true subst thm ct);
neuper@37906
    92
"--- 4 ---";
wneuper@59384
    93
val thm = @{thm "diff_pow"};
wneuper@59384
    94
val (ct, _) = the (rewrite_inst_ thy tless_true erls_diff true subst thm ct);
neuper@37906
    95
"--- 5 ---";
wneuper@59384
    96
val thm = @{thm "diff_const"};
wneuper@59384
    97
val (ct, _) = the (rewrite_inst_ thy tless_true erls_diff true subst thm ct);
neuper@37906
    98
"--- 6 ---";
wneuper@59384
    99
val thm = @{thm "diff_var"};
wneuper@59384
   100
val (ct, _) = the (rewrite_inst_ thy tless_true erls_diff true subst thm ct);
walther@59868
   101
if UnparseC.term ct = "2 * x ^^^ (2 - 1) + 3 * 1 + 0" then ()
neuper@38031
   102
else error "diff.sml diff.behav. in rewrite 1";
neuper@37906
   103
"--- 7 ---";
wneuper@59384
   104
"--- 7 ---";
wneuper@59384
   105
val rls = Test_simplify;
wneuper@59384
   106
val ct = (Thm.term_of o the o (parse thy)) "2 * x ^^^ (2 - 1) + 3 * 1 + 0";
wneuper@59384
   107
val (ct, _) = the (rewrite_set_ thy true rls ct);
walther@59868
   108
if UnparseC.term ct = "3 + 2 * x" then () else error "rewrite_set_ Test_simplify 2 changed";
neuper@37906
   109
neuper@38081
   110
"----------- differentiate: me (*+ tacs input*) ---------";
neuper@38081
   111
"----------- differentiate: me (*+ tacs input*) ---------";
neuper@38081
   112
"----------- differentiate: me (*+ tacs input*) ---------";
neuper@37906
   113
val fmz = ["functionTerm (x ^^^ 2 + 3 * x + 4)", 
walther@59997
   114
	   "differentiateFor x", "derivative f_f'"];
neuper@37906
   115
val (dI',pI',mI') =
walther@59997
   116
  ("Diff",["derivative_of", "function"],
walther@59997
   117
   ["diff", "diff_simpl"]);
neuper@37906
   118
val p = e_pos'; val c = []; 
neuper@37906
   119
"--- s1 ---";
neuper@37906
   120
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
neuper@37906
   121
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   122
"--- s2 ---";
neuper@37906
   123
(*val nxt = ("Add_Given",
neuper@37906
   124
Add_Given "functionTerm (d_d x (x ^^^ #2 + #3 * x + #4))");*)
neuper@37906
   125
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   126
"--- s3 ---";
neuper@37906
   127
(*val nxt = ("Add_Given",Add_Given "differentiateFor x");*)
neuper@37906
   128
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   129
"--- s4 ---";
neuper@37994
   130
(*val nxt = ("Add_Find",Add_Find "derivative f_f'");*)
neuper@37906
   131
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   132
"--- s5 ---";
neuper@37906
   133
(*val nxt = ("Specify_Theory",Specify_Theory dI');*)
neuper@37906
   134
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   135
"--- s6 ---";
neuper@37906
   136
(*val nxt = ("Specify_Problem",Specify_Problem pI');*)
neuper@37906
   137
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   138
"--- s7 ---";
neuper@37906
   139
(*val nxt = ("Specify_Method",Specify_Method mI');*)
neuper@37906
   140
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   141
"--- s8 ---";
neuper@37906
   142
(*val nxt = ("Apply_Method",Apply_Method mI');*)
neuper@37906
   143
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   144
"--- 1 ---";
walther@59997
   145
(*val nxt = ("Rewrite_Inst",Rewrite_Inst (["(''bdv'',x)"],("diff_sum", "")));*)
neuper@37906
   146
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   147
"--- 2 ---";
walther@59997
   148
(*val nxt = ("Rewrite_Inst",Rewrite_Inst (["(''bdv'',x)"],("diff_sum", "")));*)
neuper@37906
   149
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   150
(*val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   151
val (p,_,f,nxt,_,pt) = me nxt p c pt;*)
neuper@37906
   152
"--- 3 ---";
wneuper@59497
   153
(*val nxt = ("Rewrite_Inst",Rewrite_Inst (["(''bdv'',x)"],("diff_prod_const",...;*)
neuper@37906
   154
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   155
(*val (p,_,f,nxt,_,pt) = me nxt p c pt;*)
neuper@37906
   156
"--- 4 ---";
walther@59997
   157
(*val nxt = ("Rewrite_Inst",Rewrite_Inst (["(''bdv'',x)"],("diff_pow", "")));*)
neuper@37906
   158
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   159
(*val (p,_,f,nxt,_,pt) = me nxt p c pt;*)
neuper@37906
   160
"--- 5 ---";
wneuper@59497
   161
(*val nxt = ("Rewrite_Inst",Rewrite_Inst (["(''bdv'',x)"],("diff_prod_const",...;*)
neuper@37906
   162
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   163
(*val (p,_,f,nxt,_,pt) = me nxt p c pt;*)
neuper@37906
   164
"--- 6 ---";
walther@59997
   165
(*val nxt = ("Rewrite_Inst",Rewrite_Inst (["(''bdv'',x)"],("diff_var", "")));*)
neuper@37906
   166
val (p,_,f,nxt,_,pt) = me nxt p c pt; 
neuper@37906
   167
if f2str f =  "2 * x ^^^ (2 - 1) + 3 * 1 + 0" then () 
neuper@38031
   168
else error "diff.sml: diff.behav. in d_d x ^^^ 2 + 3 * x + 4";
neuper@37906
   169
"--- 7 ---";
neuper@37906
   170
(*val nxt = ("Rewrite_Set",Rewrite_Set "make_polynomial");*)
neuper@37906
   171
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   172
"--- 8 ---";
walther@59997
   173
(*val nxt = ("Check_Postcond",Check_Postcond ("Diff", "differentiate_on_R"));*)
neuper@37906
   174
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   175
"--- 9 ---";
neuper@37906
   176
(*val nxt = ("End_Proof'",End_Proof');*)
neuper@37906
   177
val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
wneuper@59253
   178
if f2str f = "3 + 2 * x"
walther@59749
   179
  then case nxt of End_Proof' => ()
wneuper@59253
   180
  | _ => error "diff.sml: new.behav. in me (*+ tacs input*) 1"
wneuper@59253
   181
else error "diff.sml: new.behav. in me (*+ tacs input*) 2";
walther@59814
   182
(*if f = EmptyMout then () else error "new behaviour in + tacs input"*)
neuper@37906
   183
neuper@38081
   184
"----------- 1.5.02 me from script ----------------------";
neuper@38081
   185
"----------- 1.5.02 me from script ----------------------";
neuper@38081
   186
"----------- 1.5.02 me from script ----------------------";
neuper@37906
   187
(*exp_Diff_No-1.xml*)
neuper@37906
   188
val fmz = ["functionTerm (x ^^^ 2 + 3 * x + 4)", 
walther@59997
   189
	   "differentiateFor x", "derivative f_f'"];
neuper@37906
   190
val (dI',pI',mI') =
walther@59997
   191
  ("Diff",["derivative_of", "function"],
walther@59997
   192
   ["diff", "diff_simpl"]);
neuper@37906
   193
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
neuper@37906
   194
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   195
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   196
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   197
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   198
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   199
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   200
val (p,_,f,nxt,_,pt) = me nxt p c pt;
walther@59997
   201
(*nxt = ("Apply_Method",Apply_Method ("Diff", "differentiate_on_R*)
neuper@37906
   202
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   203
neuper@37906
   204
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   205
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   206
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   207
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   208
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   209
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   210
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   211
val (p,_,f,nxt,_,pt) = me nxt p c pt;
walther@59749
   212
case nxt of End_Proof' => ()
wneuper@59253
   213
| _ => error "new behaviour in tests/differentiate, 1.5.02 me from script";
neuper@37906
   214
neuper@38081
   215
"----------- primed id ----------------------------------";
neuper@38081
   216
"----------- primed id ----------------------------------";
neuper@38081
   217
"----------- primed id ----------------------------------";
neuper@37994
   218
val f_ = str2term "f_f::bool";
neuper@37906
   219
val f  = str2term "A = s * (a - s)";
neuper@38081
   220
val v_ = str2term "v_v";
neuper@37906
   221
val v  = str2term "s";
neuper@38081
   222
val screxp0 = str2term "Take ((primed (lhs f_f)) = d_d v_v (rhs f_f))";
neuper@37906
   223
atomty screxp0;
neuper@37906
   224
neuper@38081
   225
val screxp1 = subst_atomic [(f_, f), (v_, v)] screxp0;
walther@59868
   226
UnparseC.term screxp1;
neuper@37906
   227
atomty screxp1;
neuper@37906
   228
wneuper@59592
   229
val SOME (f'_,_) = rewrite_set_ (@{theory "Isac_Knowledge"}) false srls_diff screxp1; 
walther@59868
   230
if UnparseC.term f'_= "Take (A' = d_d s (s * (a - s)))" then ()
neuper@38031
   231
else error "diff.sml: diff.behav. in 'primed'";
neuper@37906
   232
atomty f'_;
neuper@37906
   233
wneuper@59585
   234
val str = "Program DiffEqScr (f_f::bool) (v_v::real) =                         \
neuper@38081
   235
\ (let f_f' = Take ((primed (lhs f_f)) = d_d v_v (rhs f_f))           \
walther@59637
   236
\ in (((Try (Repeat (Rewrite frac_conv))) #>              \
walther@59637
   237
 \ (Try (Repeat (Rewrite root_conv))) #>                  \
walther@59637
   238
 \ (Try (Repeat (Rewrite realpow_pow))) #>                  \
neuper@37906
   239
 \ (Repeat                                                        \
walther@59635
   240
 \   ((Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_sum        )) Or \
walther@59635
   241
 \    (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_prod_const )) Or \
walther@59635
   242
 \    (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_prod       )) Or \
walther@59635
   243
 \    (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_quot       )) Or \
walther@59635
   244
 \    (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_sin        )) Or \
walther@59635
   245
 \    (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_sin_chain  )) Or \
walther@59635
   246
 \    (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_cos        )) Or \
walther@59635
   247
 \    (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_cos_chain  )) Or \
walther@59635
   248
 \    (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_pow        )) Or \
walther@59635
   249
 \    (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_pow_chain  )) Or \
walther@59635
   250
 \    (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_ln         )) Or \
walther@59635
   251
 \    (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_ln_chain   )) Or \
walther@59635
   252
 \    (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_exp        )) Or \
walther@59635
   253
 \    (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_exp_chain  )) Or \
walther@59635
   254
 \    (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_sqrt       )) Or \
walther@59635
   255
 \    (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_sqrt_chain )) Or \
walther@59635
   256
 \    (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_const      )) Or \
walther@59635
   257
 \    (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_var        )) Or \
walther@59637
   258
 \    (Repeat (Rewrite_Set             make_polynomial)))) #> \
walther@59637
   259
 \ (Try (Repeat (Rewrite sym_frac_conv))) #>              \
walther@59635
   260
 \ (Try (Repeat (Rewrite sym_root_conv))))) f_f')"
neuper@37906
   261
;
wneuper@59395
   262
val sc = (inst_abs o Thm.term_of o the o (parse thy)) str;
neuper@37906
   263
neuper@37906
   264
neuper@38081
   265
"----------- diff_conv, sym_diff_conv -------------------";
neuper@38081
   266
"----------- diff_conv, sym_diff_conv -------------------";
neuper@38081
   267
"----------- diff_conv, sym_diff_conv -------------------";
neuper@37906
   268
val subs = [(str2term "bdv", str2term "x")];
neuper@37906
   269
val rls = diff_conv;
neuper@37906
   270
neuper@37906
   271
val t = str2term "2/x^^^2"; 
walther@59868
   272
val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; UnparseC.term t;
walther@59868
   273
if UnparseC.term t = "2 * x ^^^ -2" then () else error "diff.sml 1/x";
neuper@37906
   274
neuper@37906
   275
val t = str2term "sqrt (x^^^3)";
walther@59868
   276
val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; UnparseC.term t;
walther@59868
   277
if UnparseC.term t = "x ^^^ (3 / 2)" then () else error "diff.sml x^1/2";
neuper@37906
   278
neuper@37906
   279
val t = str2term "2 / sqrt x^^^3";
walther@59868
   280
val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; UnparseC.term t;
walther@59868
   281
if UnparseC.term t = "2 * x ^^^ (-3 / 2)" then () else error"diff.sml x^-1/2";
neuper@37906
   282
val rls = diff_sym_conv; 
neuper@37906
   283
neuper@37906
   284
val t = str2term "2 * x ^^^ -2";
walther@59868
   285
val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; UnparseC.term t;
walther@59868
   286
if UnparseC.term t = "2 / x ^^^ 2" then () else error "diff.sml sym 1/x";
neuper@37906
   287
neuper@37906
   288
neuper@37906
   289
val t = str2term "x ^^^ (3 / 2)";
walther@59868
   290
val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; UnparseC.term t;
walther@59868
   291
if UnparseC.term t = "sqrt (x ^^^ 3)" then () else error"diff.sml sym x^1/x";
neuper@37906
   292
neuper@37906
   293
val t = str2term "2 * x ^^^ (-3 / 2)";
walther@59868
   294
val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; UnparseC.term t;
walther@59868
   295
if UnparseC.term t ="2 / sqrt (x ^^^ 3)"then()else error"diff.sml sym x^-1/x";
neuper@37906
   296
neuper@37906
   297
wneuper@59248
   298
"----------- autoCalculate differentiate_on_R 2/x^2 -----";
wneuper@59248
   299
"----------- autoCalculate differentiate_on_R 2/x^2 -----";
wneuper@59248
   300
"----------- autoCalculate differentiate_on_R 2/x^2 -----";
s1210629013@55445
   301
reset_states ();
neuper@37906
   302
CalcTree
neuper@37906
   303
[(["functionTerm (x^2 + x+ 1/x + 2/x^2)",
neuper@37906
   304
   (*"functionTerm ((x^3)^5)",*)
neuper@37994
   305
   "differentiateFor x", "derivative f_f'"], 
walther@59997
   306
  ("Isac_Knowledge", ["derivative_of", "function"],
walther@59997
   307
  ["diff", "differentiate_on_R"]))];
neuper@37906
   308
Iterator 1;
neuper@37906
   309
moveActiveRoot 1;
wneuper@59248
   310
autoCalculate 1 CompleteCalc;
walther@59983
   311
val ((pt,p),_) = get_calc 1; Test_Tool.show_pt pt;
walther@59868
   312
if p = ([], Res) andalso UnparseC.term (get_obj g_res pt (fst p)) = 
neuper@37906
   313
			  "1 + 2 * x + -1 / x ^^^ 2 + -4 / x ^^^ 3" then ()
neuper@38031
   314
else error "diff.sml: differentiate_on_R 2/x^2 changed";
neuper@37906
   315
neuper@38081
   316
"---------------------------------------------------------";
s1210629013@55445
   317
reset_states ();
neuper@37906
   318
CalcTree
neuper@37906
   319
[(["functionTerm (x^3 * x^5)",
neuper@37994
   320
   "differentiateFor x", "derivative f_f'"], 
walther@59997
   321
  ("Isac_Knowledge", ["derivative_of", "function"],
walther@59997
   322
  ["diff", "differentiate_on_R"]))];
neuper@37906
   323
Iterator 1;
neuper@37906
   324
moveActiveRoot 1;
walther@59627
   325
autoCalculate 1 CompleteCalc;
walther@59901
   326
(* Rewrite.trace_on := true;
walther@59901
   327
   LItool.trace_on := false;
neuper@37906
   328
   *)
walther@59983
   329
val ((pt,p),_) = get_calc 1; Test_Tool.show_pt pt;
neuper@37906
   330
walther@59868
   331
if p = ([], Res) andalso UnparseC.term (get_obj g_res pt (fst p)) = 
neuper@37906
   332
			 "8 * x ^^^ 7" then () 
neuper@38031
   333
else error "diff.sml: differentiate_on_R (x^3 * x^5) changed";
neuper@37906
   334
wneuper@59248
   335
"----------- autoCalculate diff after_simplification ----";
wneuper@59248
   336
"----------- autoCalculate diff after_simplification ----";
wneuper@59248
   337
"----------- autoCalculate diff after_simplification ----";
s1210629013@55445
   338
reset_states ();
neuper@37906
   339
CalcTree
neuper@37906
   340
[(["functionTerm (x^3 * x^5)",
neuper@37994
   341
   "differentiateFor x", "derivative f_f'"], 
walther@59997
   342
  ("Isac_Knowledge", ["derivative_of", "function"],
walther@59997
   343
  ["diff", "after_simplification"]))];
neuper@37906
   344
Iterator 1;
neuper@37906
   345
moveActiveRoot 1;
walther@59901
   346
(* Rewrite.trace_on := true;
walther@59901
   347
   LItool.trace_on := true;
neuper@37906
   348
   *)
wneuper@59248
   349
autoCalculate 1 CompleteCalc;
walther@59901
   350
(* Rewrite.trace_on := false;
walther@59901
   351
   LItool.trace_on := false;
neuper@37906
   352
   *)
walther@59983
   353
val ((pt,p),_) = get_calc 1; Test_Tool.show_pt pt;
walther@59868
   354
if p = ([], Res) andalso UnparseC.term (get_obj g_res pt (fst p)) =  "8 * x ^^^ 7"
neuper@38031
   355
then () else error "biegelinie.sml: 1st biegelin.7.27 changed";
neuper@37906
   356
neuper@38081
   357
"--------------------------------------------------------";
s1210629013@55445
   358
reset_states ();
neuper@37906
   359
CalcTree
neuper@37906
   360
[(["functionTerm ((x^3)^5)",
neuper@37994
   361
   "differentiateFor x", "derivative f_f'"], 
walther@59997
   362
  ("Isac_Knowledge", ["derivative_of", "function"],
walther@59997
   363
  ["diff", "after_simplification"]))];
neuper@37906
   364
Iterator 1;
neuper@37906
   365
moveActiveRoot 1;
wneuper@59248
   366
autoCalculate 1 CompleteCalc;
walther@59983
   367
val ((pt,p),_) = get_calc 1; Test_Tool.show_pt pt;
walther@59868
   368
if p = ([], Res) andalso UnparseC.term (get_obj g_res pt (fst p)) = "15 * x ^^^ 14"
neuper@38031
   369
then () else error "biegelinie.sml: 1st biegelin.7.27 changed";
neuper@37906
   370
wneuper@59248
   371
"----------- autoCalculate differentiate_equality -------";
wneuper@59248
   372
"----------- autoCalculate differentiate_equality -------";
wneuper@59248
   373
"----------- autoCalculate differentiate_equality -------";
s1210629013@55445
   374
reset_states ();
neuper@37906
   375
CalcTree
neuper@42393
   376
[(["functionEq (A = s * (a - (s::real)))", "differentiateFor s", "derivativeEq f_f'"], 
walther@59997
   377
  ("Isac_Knowledge", ["named", "derivative_of", "function"],
walther@59997
   378
  ["diff", "differentiate_equality"]))];
neuper@37906
   379
Iterator 1;
neuper@37906
   380
moveActiveRoot 1;
wneuper@59248
   381
autoCalculate 1 CompleteCalc;
walther@59983
   382
val ((pt,p),_) = get_calc 1; Test_Tool.show_pt pt;
neuper@37906
   383
neuper@38081
   384
"----------- tests for examples -------------------------";
neuper@38081
   385
"----------- tests for examples -------------------------";
neuper@38081
   386
"----------- tests for examples -------------------------";
neuper@37906
   387
"----- parse errors";
neuper@38081
   388
(*str2term "F  =  sqrt( y^^^2 - O) * (z + O^^^2)";
neuper@38081
   389
str2term "O";
neuper@38081
   390
str2term "OO"; ---errors*)
neuper@38081
   391
str2term "OOO";
neuper@37906
   392
neuper@37906
   393
"----- thm 'diff_prod_const'";
neuper@37906
   394
val subs = [(str2term "bdv", str2term "l")];
neuper@38081
   395
val f = str2term "G' = d_d l (l * sqrt (7 * s ^^^ 2 - l ^^^ 2))";
neuper@37906
   396
wneuper@59562
   397
"------------inform for x^2+x+1 -------------------------";
wneuper@59562
   398
"------------inform for x^2+x+1 -------------------------";
wneuper@59562
   399
"------------inform for x^2+x+1 -------------------------";
s1210629013@55445
   400
reset_states ();
neuper@37906
   401
CalcTree
neuper@37906
   402
[(["functionTerm (x^2 + x + 1)",
neuper@37994
   403
   "differentiateFor x", "derivative f_f'"], 
walther@59997
   404
  ("Isac_Knowledge", ["derivative_of", "function"],
walther@59997
   405
  ["diff", "differentiate_on_R"]))];
neuper@37906
   406
Iterator 1;
neuper@37906
   407
moveActiveRoot 1;
wneuper@59248
   408
autoCalculate 1 CompleteCalcHead;
walther@59747
   409
autoCalculate 1 (Steps 1);
walther@59747
   410
autoCalculate 1 (Steps 1);
walther@59747
   411
autoCalculate 1 (Steps 1);
walther@59983
   412
val ((pt,p),_) = get_calc 1; Test_Tool.show_pt pt;
wneuper@59123
   413
appendFormula 1 "2*x + d_d x x + d_d x 1" (*|> Future.join*);
walther@59983
   414
val ((pt,p),_) = get_calc 1; Test_Tool.show_pt pt;
neuper@37906
   415
if existpt' ([3], Res) pt then ()
neuper@38031
   416
else error  "diff.sml: inform d_d x (x^2 + x + 1) doesnt work";
neuper@38081
   417