test/Tools/isac/ProgLang/calculate.sml
author Walther Neuper <wneuper@ist.tugraz.at>
Sat, 24 Feb 2018 16:09:24 +0100
changeset 59382 364ce4699452
parent 59361 76b3141b73ab
child 59384 d92ff7591a11
permissions -rw-r--r--
Rewrite is broken; intermediate state for repair
neuper@38022
     1
(* Title:  test calculation of values for function constants
neuper@38022
     2
   Author: Walther Neuper 2000
neuper@38022
     3
   (c) copyright due to lincense terms.
neuper@37906
     4
neuper@38022
     5
12345678901234567890123456789012345678901234567890123456789012345678901234567890
neuper@38022
     6
        10        20        30        40        50        60        70        80
neuper@37906
     7
*)
neuper@37906
     8
neuper@38022
     9
"--------------------------------------------------------";
neuper@38022
    10
"table of contents --------------------------------------";
neuper@38022
    11
"--------------------------------------------------------";
neuper@55366
    12
"-calculate.thy: provides 'setup' -----------------------";
neuper@41924
    13
"----------- fun norm -----------------------------------";
wneuper@59255
    14
"----------- check return value of adhoc_thm  ----";
neuper@38032
    15
"----------- fun calculate_ -----------------------------";
neuper@55366
    16
"----------- calculate from script --requires 'setup'----";
neuper@38032
    17
"----------- calculate check test-root-equ --------------";
wneuper@59253
    18
"----------- check calcul,ate bottom up -----------------";
neuper@42223
    19
"----------- Atools.pow Power.power_class.power ---------";
neuper@41934
    20
" ================= calculate.sml: calculate_ 2002 ======";
neuper@38032
    21
"----------- get_pair with 3 args -----------------------";
neuper@38032
    22
"----------- calculate (2 * x is_const) -----------------";
neuper@38022
    23
"--------------------------------------------------------";
neuper@38022
    24
"--------------------------------------------------------";
neuper@38022
    25
"--------------------------------------------------------";
neuper@37906
    26
wneuper@59255
    27
"----------- check return value of adhoc_thm  ----";
wneuper@59255
    28
"----------- check return value of adhoc_thm  ----";
wneuper@59255
    29
"----------- check return value of adhoc_thm  ----";
neuper@41924
    30
val thy = @{theory "Poly"};
s1210629013@52153
    31
val cal = snd (assoc_calc' thy "is_polyexp");
neuper@38022
    32
val t = @{term "(x / x) is_polyexp"};
wneuper@59255
    33
val SOME (thmID, thm) = adhoc_thm thy cal t;
wneuper@59188
    34
(HOLogic.dest_Trueprop (Thm.prop_of thm); writeln "all thms wrapped by Trueprop")
neuper@38022
    35
handle TERM _ => 
wneuper@59255
    36
       error "calculate.sml: adhoc_thm must return Trueprop";
neuper@38022
    37
neuper@38033
    38
"----------- fun calculate_ -----------------------------";
neuper@38033
    39
"----------- fun calculate_ -----------------------------";
neuper@38033
    40
"----------- fun calculate_ -----------------------------";
neuper@41924
    41
val thy = @{theory "Test"};
neuper@38033
    42
"===== test 1";
wneuper@59188
    43
val t = (Thm.term_of o the o (parse thy)) "1+2";
wneuper@59255
    44
val SOME (thmID,thm) = adhoc_thm thy (the(assoc(calclist,"PLUS"))) t;
wneuper@59195
    45
term2str (Thm.prop_of thm) = "1 + 2 = 3";
neuper@38033
    46
neuper@38033
    47
"===== test 2";
wneuper@59188
    48
val t = (Thm.term_of o the o (parse thy)) "((1+2)*4/3)^^^2";
wneuper@59255
    49
val SOME (thmID,thm) = adhoc_thm thy (the(assoc(calclist,"PLUS"))) t;
neuper@38033
    50
val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
neuper@41931
    51
if term2str t = "(3 * 4 / 3) ^^^ 2" then ()
neuper@41931
    52
else error "calculate.sml: ((1+2)*4/3)^^^2 --> (3 * 4 / 3) ^^^ 2";
neuper@38033
    53
neuper@38033
    54
"===== test 3b -- 2 contiued";
wneuper@59255
    55
val SOME (thmID,thm) = adhoc_thm thy (the(assoc(calclist,"TIMES"))) t;
neuper@38033
    56
val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
neuper@38033
    57
term2str t;
neuper@38033
    58
(*val it = "(#12 // #3) ^^^ #2" : string*)
neuper@37906
    59
neuper@38033
    60
"===== test 4";
wneuper@59255
    61
val SOME (thmID,thm) = adhoc_thm thy(the(assoc(calclist,"DIVIDE")))t;
neuper@38032
    62
val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
neuper@38033
    63
term2str t;
neuper@38033
    64
(*it = "#4 ^^^ #2" : string*)
neuper@38033
    65
neuper@38033
    66
"===== test 5";
wneuper@59255
    67
val SOME (thmID,thm) = adhoc_thm thy(the(assoc(calclist,"POWER")))t;
neuper@38032
    68
val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
neuper@41931
    69
(*show_types := false;*)
neuper@38037
    70
if term2str t <> "16" then error "calculate.sml: new behaviour in calculate_"
neuper@37906
    71
else ();
neuper@37906
    72
neuper@37906
    73
neuper@37906
    74
val fmz = ["realTestGiven (((1+2)*4/3)^^^2)","realTestFind s"];
neuper@37906
    75
val (dI',pI',mI') =
neuper@38035
    76
  ("Test",["calculate","test"],["Test","test_calculate"]);
neuper@38035
    77
neuper@37906
    78
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
neuper@37906
    79
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
    80
(*nxt =("Add_Given",Add_Given "realTestGiven (((#1 + #2) * #4 // #3) ^^^#2)")*)
neuper@37906
    81
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
    82
(*nxt = ("Add_Find",Add_Find "realTestFind s") : string * tac*)
neuper@37906
    83
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@38035
    84
(*nxt = ("Specify_Theory",Specify_Theory "Test") : string * tac*)
neuper@37906
    85
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
    86
(*nxt = ("Specify_Problem",Specify_Problem ["calculate","test"])*)
neuper@37906
    87
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@38035
    88
(*nxt = ("Specify_Method",Specify_Method ("Test","test_calculate"))*)
neuper@37906
    89
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@38035
    90
(*nxt = ("Apply_Method",Apply_Method ("Test","test_calculate"))*)
neuper@37906
    91
neuper@37906
    92
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@38033
    93
(*nxt = ("Calculate",Calculate "PLUS")*)
neuper@37906
    94
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@38033
    95
(*nxt = ("Calculate",Calculate "TIMES")*)
neuper@37906
    96
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@38033
    97
(*nxt = ("Calculate",Calculate "DIVIDE")*)
neuper@37906
    98
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@38033
    99
(*nxt = ("Calculate",Calculate "POWER")*)
neuper@37906
   100
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
   101
(*nxt = ("Check_Postcond",Check_Postcond ["calculate","test"])*)
neuper@37906
   102
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
   103
(*nxt = ("End_Proof'",End_Proof')*)
wneuper@59267
   104
case f of FormKF "16" => () | _ =>
wneuper@59253
   105
error "calculate.sml: script test_calculate changed behaviour";
neuper@37906
   106
neuper@37906
   107
neuper@38032
   108
"----------- calculate check test-root-equ --------------";
neuper@38032
   109
"----------- calculate check test-root-equ --------------";
neuper@38032
   110
"----------- calculate check test-root-equ --------------";
neuper@37906
   111
(*(1): 2nd Test_simplify didn't work:
neuper@37906
   112
val ct =
neuper@37906
   113
  "sqrt (x ^^^ 2 + -3 * x) = (-3 + 2 * x + -1 * (9 + 4 * x)) / (-1 * 2)"
neuper@37906
   114
> val rls = ("Test_simplify");
neuper@37906
   115
> val (ct,_) = the (rewrite_set thy' ("tval_rls") false rls ct);
neuper@37906
   116
val ct = "sqrt (x ^^^ 2 + -3 * x) =
neuper@37906
   117
(-9) / (-2) + (-3 / (-2) + (x * ((-4) / (-2)) + x * (2 / (-2))))";
neuper@37906
   118
ie. cancel does not work properly
neuper@37906
   119
*)
wneuper@59382
   120
 val thy = @{theory "Test"};
wneuper@59382
   121
 val op_ = the (assoc (calclist, "DIVIDE"));
wneuper@59382
   122
 val ct = numbers_to_string @{term
wneuper@59382
   123
   "sqrt (x ^^^ 2 + -3 * x) = (-9) / (-2) + (-3 / (-2) + (x * ((-4) / (-2)) + x * (2 / (-2))))"};
wneuper@59382
   124
case calculate_ thy op_ ct of
wneuper@59382
   125
  SOME _ => ()
wneuper@59382
   126
| NONE => error "calculate_ test-root-equ changed";
neuper@37906
   127
(*
neuper@37906
   128
           sqrt (x ^^^ 2 + -3 * x) =\
neuper@37906
   129
 \(-9) / (-2) + (-3 / (-2) + (x * ((-4) / (-2)) + x * (2 / (-2))))
neuper@37906
   130
............... does not work *)
neuper@37906
   131
neuper@37906
   132
(*--------------(2): does divide work in Test_simplify ?: ------*)
akargl@42188
   133
 val thy = @{theory Test};
wneuper@59188
   134
 val t = (Thm.term_of o the o (parse thy)) "6 / 2";
neuper@37906
   135
 val rls = Test_simplify;
neuper@37906
   136
 val (t,_) = the (rewrite_set_ thy false rls t);
neuper@55279
   137
(*val t = Free ("3","Real.real") : term*)
neuper@37906
   138
neuper@37906
   139
(*--------------(3): is_const works ?: -------------------------------------*)
wneuper@59188
   140
 val t = (Thm.term_of o the o (parse @{theory Test})) "2 is_const";
neuper@37906
   141
 atomty t;
akargl@42188
   142
 rewrite_set_ @{theory Test} false tval_rls t;
neuper@41928
   143
(*val it = SOME (Const ("HOL.True","bool"),[]) ... works*)
neuper@37906
   144
neuper@37906
   145
 val t = str2term "2 * x is_const";
akargl@42188
   146
 val SOME (str,t') = eval_const "" "" t (@{theory "Isac"});
neuper@37906
   147
 term2str t';
neuper@37906
   148
 
neuper@37906
   149
neuper@38032
   150
"----------- check calculate bottom up ------------------";
neuper@38032
   151
"----------- check calculate bottom up ------------------";
neuper@38032
   152
"----------- check calculate bottom up ------------------";
neuper@37906
   153
(*-------------- eval_cancel works: *)
neuper@52070
   154
 trace_rewrite:=false;
akargl@42188
   155
 val thy = @{theory Test};
wneuper@59188
   156
 val t = (Thm.term_of o the o (parse thy)) "(-4) / 2";
akargl@42188
   157
wneuper@59360
   158
val SOME (_, t) = eval_cancel "xxx" "Rings.divide_class.divide" t thy;
akargl@42188
   159
neuper@37906
   160
(*--------------(5): reproduce (1) with simpler term: ------------*)
neuper@38035
   161
 val thy = "Test";
neuper@37906
   162
 val t = "(3+5)/2";
neuper@37906
   163
 val (t,_) = the (rewrite_set thy false rls t);
neuper@37906
   164
(*val t = "4" ... works*)
neuper@37906
   165
neuper@37906
   166
 val t = "(3+1+2*x)/2";
neuper@37906
   167
 val (t,_) = the (rewrite_set thy false rls t);
neuper@37906
   168
(*val t = "2 + x" ... works*)
neuper@37906
   169
neuper@52070
   170
 trace_rewrite:=false; (*=true3.6.03*)
akargl@42218
   171
neuper@38035
   172
 val thy = "Test";
neuper@37906
   173
 val rls = "Test_simplify";
neuper@37906
   174
 val t = "(3+(1+2*x))/2";
neuper@37906
   175
 val (t,_) = the (rewrite_set thy false rls t);
neuper@37906
   176
(*val t = "2 + x" ... works: give up----------------------------------------*)
neuper@37906
   177
 trace_rewrite:=false; 
neuper@37906
   178
neuper@52070
   179
 trace_rewrite:=false; (*=true3.6.03*)
akargl@42188
   180
 val thy = @{theory Test};
neuper@37906
   181
 val rls = Test_simplify;
neuper@37906
   182
 val t = str2term "(3+(1+2*x))/2";
neuper@38032
   183
 val SOME (t',asm) = rewrite_set_ thy false rls t;
neuper@37906
   184
 term2str t';
neuper@37906
   185
(*val t = "2 + x" ... works: give up----------------------------------------*)
neuper@37906
   186
 trace_rewrite:=false; 
neuper@37906
   187
neuper@37906
   188
neuper@37906
   189
neuper@37906
   190
neuper@37906
   191
(*--- trace_rewrite before correction of ... --------------------
neuper@37906
   192
 val ct = "(-3 + 2 * x + -1) / 2";
neuper@37906
   193
 val (ct,_) = the (rewrite_set thy'  false rls ct);
neuper@37906
   194
:
neuper@37906
   195
### trying thm 'root_ge0_2'
neuper@37906
   196
### rewrite_set_: x + (-1 + -3) / 2
neuper@37906
   197
### trying thm 'radd_real_const_eq'
neuper@37906
   198
### trying thm 'radd_real_const'
neuper@37906
   199
### rewrite_set_: x + (-4) / 2
neuper@37906
   200
### trying thm 'rcollect_right'
neuper@37906
   201
:
neuper@37906
   202
"x + (-4) / 2"
neuper@37906
   203
-------------------------------------while before Isabelle20002:
neuper@37906
   204
 val ct = "(#-3 + #2 * x + #-1) // #2";
neuper@37906
   205
 val (ct,_) = the (rewrite_set thy'  false rls ct);
neuper@37906
   206
:
neuper@37906
   207
### trying thm 'root_ge0_2'
neuper@37906
   208
### rewrite_set_: x + (#-1 + #-3) // #2
neuper@37906
   209
### trying thm 'radd_real_const_eq'
neuper@37906
   210
### trying thm 'radd_real_const'
neuper@37906
   211
### rewrite_set_: x + #-4 // #2
neuper@37906
   212
### rewrite_set_: x + #-2
neuper@37906
   213
### trying thm 'rcollect_right'
neuper@37906
   214
:
neuper@37906
   215
"#-2 + x"
neuper@37906
   216
-----------------------------------------------------------------*)
neuper@37906
   217
neuper@37906
   218
neuper@37906
   219
(*===================*)
neuper@52070
   220
 trace_rewrite:=false; (*WN130722: =true stopped Test_Isac.thy*)
neuper@38035
   221
 val thy' = "Test";
neuper@37906
   222
 val rls = "Test_simplify";		
neuper@37906
   223
 val ct = "x + (-1 + -3) / 2";
neuper@37906
   224
 val (ct,_) = the (rewrite_set thy'  false rls ct);	
neuper@37906
   225
"x + (-4) / 2";						
neuper@37906
   226
(*
neuper@37906
   227
### trying calc. 'cancel'
neuper@37906
   228
@@@ get_pair: binop, t = x + (-4) / 2
neuper@37906
   229
@@@ get_pair: t else
neuper@38032
   230
@@@ get_pair: t else -> NONE
neuper@37906
   231
@@@ get_pair: binop, t = (-4) / 2
neuper@37906
   232
@@@ get_pair: then 1
neuper@38032
   233
@@@ get_pair: t -> NONE
neuper@38032
   234
@@@ get_pair: t1 -> NONE
wneuper@59255
   235
@@@ adhoc_thm': NONE
neuper@37906
   236
### trying calc. 'pow'
neuper@37906
   237
*)
neuper@37906
   238
neuper@52070
   239
 trace_rewrite:=false; (*WN130722: =true stopped Test_Isac.thy*)
neuper@38035
   240
 val thy' = "Test";
neuper@37906
   241
 val rls = "Test_simplify";		
neuper@37906
   242
 val ct = "x + (-4) / 2";
neuper@37906
   243
 val (ct,_) = the (rewrite_set thy'  false rls ct);	
neuper@37906
   244
"(-2) + x";
neuper@37906
   245
(*
neuper@37906
   246
### trying calc. 'cancel'
neuper@37906
   247
@@@ get_pair: binop, t = x + -4 / 2
neuper@37906
   248
@@@ get_pair: t else
neuper@38032
   249
@@@ get_pair: t else -> NONE
neuper@37906
   250
@@@ get_pair: binop, t = -4 / 2
neuper@37906
   251
@@@ get_pair: then 1
wneuper@59255
   252
@@@ adhoc_thm': SOME #cancel_-4_2
neuper@37906
   253
### calc. to: x + (-2)
neuper@37906
   254
### trying calc. 'cancel'
neuper@37906
   255
*)
neuper@37906
   256
 trace_rewrite:=false;
neuper@37906
   257
neuper@42223
   258
"----------- Atools.pow Power.power_class.power ---------";
neuper@42223
   259
"----------- Atools.pow Power.power_class.power ---------";
neuper@42223
   260
"----------- Atools.pow Power.power_class.power ---------";
wneuper@59188
   261
val t = (Thm.term_of o the o (parseold thy)) "1 ^ aaa";
neuper@42223
   262
atomty t;
neuper@37906
   263
(*** -------------
neuper@37906
   264
*** Const ( Nat.power, ['a, nat] => 'a)
neuper@37906
   265
*** . Free ( 1, 'a)
neuper@37906
   266
*** . Free ( aaa, nat) *)
akargl@42218
   267
neuper@42223
   268
val t = str2term "1 ^^^ aaa";
neuper@42223
   269
atomty t;
neuper@42223
   270
(**** 
neuper@42223
   271
*** Const (Atools.pow, real => real => real)
neuper@42223
   272
*** . Free (1, real)
neuper@42223
   273
*** . Free (aaa, real)
neuper@42223
   274
*** *);
neuper@37906
   275
neuper@37906
   276
" ================= calculate.sml: calculate_ 2002 =================== ";
neuper@37906
   277
" ================= calculate.sml: calculate_ 2002 =================== ";
neuper@37906
   278
" ================= calculate.sml: calculate_ 2002 =================== ";
neuper@37906
   279
akargl@42188
   280
val thy = @{theory Test};
wneuper@59188
   281
val t = (Thm.term_of o the o (parse thy)) "12 / 3";
wneuper@59255
   282
val SOME (thmID,thm) = adhoc_thm thy(the(assoc(calclist,"DIVIDE")))t;
neuper@38032
   283
val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
neuper@37906
   284
"12 / 3 = 4";
akargl@42188
   285
val thy = @{theory Test};
wneuper@59188
   286
val t = (Thm.term_of o the o (parse thy)) "4 ^^^ 2";
wneuper@59255
   287
val SOME (thmID,thm) = adhoc_thm thy(the(assoc(calclist,"POWER"))) t;
neuper@38032
   288
val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
neuper@37906
   289
"4 ^ 2 = 16";
neuper@37906
   290
wneuper@59188
   291
 val t = (Thm.term_of o the o (parse thy)) "((1 + 2) * 4 / 3) ^^^ 2";
wneuper@59255
   292
 val SOME (thmID,thm) = adhoc_thm thy (the(assoc(calclist,"PLUS"))) t;
neuper@37906
   293
"1 + 2 = 3";
neuper@38032
   294
 val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
neuper@38033
   295
 term2str t;
neuper@37906
   296
"(3 * 4 / 3) ^^^ 2";
wneuper@59255
   297
 val SOME (thmID,thm) = adhoc_thm thy (the(assoc(calclist,"TIMES")))t;
neuper@37906
   298
"3 * 4 = 12";
neuper@38032
   299
 val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
neuper@38033
   300
 term2str t;
neuper@37906
   301
"(12 / 3) ^^^ 2";
wneuper@59255
   302
 val SOME (thmID,thm) =adhoc_thm thy(the(assoc(calclist,"DIVIDE")))t;
neuper@37906
   303
"12 / 3 = 4";
neuper@38032
   304
 val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
neuper@38033
   305
 term2str t;
neuper@37906
   306
"4 ^^^ 2";
wneuper@59255
   307
 val SOME (thmID,thm) = adhoc_thm thy(the(assoc(calclist,"POWER")))t;
neuper@37906
   308
"4 ^^^ 2 = 16";
neuper@38032
   309
 val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
neuper@38033
   310
 term2str t;
neuper@37906
   311
"16";
neuper@38031
   312
 if it <> "16" then error "calculate.sml: new behaviour in calculate_"
neuper@37906
   313
 else ();
neuper@37906
   314
neuper@37906
   315
(*13.9.02 *** calc: operator = pow not defined*)
wneuper@59188
   316
  val t = (Thm.term_of o the o (parse thy)) "3^^^2";
neuper@38032
   317
  val SOME (thmID,thm) = 
wneuper@59255
   318
      adhoc_thm thy (the(assoc(calclist,"POWER"))) t;
neuper@37906
   319
(*** calc: operator = pow not defined*)
neuper@37906
   320
neuper@38033
   321
  val (op_, eval_fn) = the (assoc(calclist,"POWER"));
neuper@37906
   322
  (*
neuper@37906
   323
val op_ = "Atools.pow" : string
neuper@37906
   324
val eval_fn = fn : string -> term -> theory -> (string * term) option*)
neuper@37906
   325
neuper@38032
   326
  val SOME (thmid,t') = get_pair thy op_ eval_fn t;
neuper@37906
   327
(*** calc: operator = pow not defined*)
neuper@37906
   328
neuper@38032
   329
  val SOME (id,t') = eval_fn op_ t thy;
neuper@37906
   330
(*** calc: operator = pow not defined*)
neuper@37906
   331
neuper@37906
   332
  val (thmid, (Const (op0,t0) $ Free (n1,t1) $ Free(n2,t2))) = (op_, t);
neuper@38032
   333
  val SOME (id,t') = eval_binop thmid op_ t thy;
neuper@37906
   334
(*** calc: operator = pow not defined*)
neuper@37906
   335
akargl@42188
   336
neuper@37906
   337
"----------- get_pair with 3 args --------------------------------";
neuper@37906
   338
"----------- get_pair with 3 args --------------------------------";
neuper@37906
   339
"----------- get_pair with 3 args --------------------------------";
neuper@37906
   340
val (thy, op_, ef, arg) =
neuper@37906
   341
    (thy, "EqSystem.occur'_exactly'_in", 
wneuper@59361
   342
     assoc_calc' (Thy_Info_get_theory "EqSystem") "occur_exactly_in" |> snd |> snd,
neuper@37906
   343
     str2term
akargl@42188
   344
      "[] from [c, c_2, c_3, c_4] occur_exactly_in -1 * (q_0 * L ^^^ 2) / 2"
neuper@37906
   345
      );
neuper@38032
   346
val SOME (str, simpl) = get_pair thy op_ ef arg;
neuper@37906
   347
if str = 
akargl@42188
   348
"[] from [c, c_2, c_3, c_4] occur_exactly_in -1 * (q_0 * L ^^^ 2) / 2 = True"
neuper@38031
   349
then () else error "calculate.sml get_pair with 3 args:occur_exactly_in";
neuper@37906
   350
neuper@37906
   351
neuper@38032
   352
"----------- calculate (2 * x is_const) -----------------";
neuper@38032
   353
"----------- calculate (2 * x is_const) -----------------";
neuper@38032
   354
"----------- calculate (2 * x is_const) -----------------";
neuper@37906
   355
val t = str2term "2 * x is_const";
akargl@42188
   356
val SOME (str, t') = eval_const "" "" t @{theory Test};
neuper@37906
   357
term2str t';
neuper@37906
   358
"(2 * x is_const) = False";
neuper@37906
   359
akargl@42188
   360
val SOME (t',_) = rewrite_set_ @{theory Test} false tval_rls t;
neuper@37906
   361
term2str t';
neuper@41928
   362
"HOL.False";