test/Tools/isac/Knowledge/diophanteq.sml
author Walther Neuper <neuper@ist.tugraz.at>
Fri, 18 Mar 2011 17:24:56 +0100
branchdecompose-isar
changeset 41936 c12d6f2a11aa
parent 41934 95407f7fe14a
child 41949 c1859b72ae8d
permissions -rw-r--r--
intermed. usecase Diophant
neuper@41931
     1
(* Title:  tests on DiophantEq.thy
neuper@41931
     2
   Author: Mathias Lehnfeld 2011
neuper@41931
     3
   (c) due to copyright terms
neuper@41931
     4
12345678901234567890123456789012345678901234567890123456789012345678901234567890
neuper@41931
     5
        10        20        30        40        50        60        70        80
neuper@41931
     6
*)
neuper@41931
     7
"--------------------------------------------------------";
neuper@41931
     8
"table of contents --------------------------------------";
neuper@41931
     9
"--------------------------------------------------------";
neuper@41931
    10
"----------- rewriting for usecase1 ---------------------";
neuper@41931
    11
"----------- mathengine with usecase1 -------------------";
neuper@41936
    12
"----------- rewriting for usecase2 ---------------------";
neuper@41936
    13
"----------- mathengine with usecase2 -------------------";
neuper@41931
    14
"--------------------------------------------------------";
neuper@41931
    15
"--------------------------------------------------------";
neuper@41931
    16
"--------------------------------------------------------";
neuper@41931
    17
neuper@41936
    18
(*there seemed to be no way to do these tests within DiophantEq.thy:
neuper@41931
    19
val thy = @{theory};(**** ME_Isa: thy 'DiophantEq' not in system
neuper@41931
    20
  from CalcTreeTest*)
neuper@41932
    21
(*val thy = @{theory "Isac"};toplevel error from store_met?!?*)
neuper@41931
    22
*)
neuper@41931
    23
val thy = @{theory "DiophantEq"};
neuper@41931
    24
val ctxt = ProofContext.init_global thy;
neuper@41931
    25
neuper@41931
    26
"----------- rewriting for usecase1 ---------------------";
neuper@41931
    27
"----------- rewriting for usecase1 ---------------------";
neuper@41931
    28
"----------- rewriting for usecase1 ---------------------";
neuper@41931
    29
val subst = [(parseNEW ctxt "bdv::int", parseNEW ctxt "xxx::int")];
neuper@41931
    30
val t = parseNEW ctxt "xxx + 111 = abc + (123::int)";
neuper@41931
    31
neuper@41931
    32
val SOME (t,_) = rewrite_inst_ thy e_rew_ord e_rls true subst 
neuper@41931
    33
  (num_str @{thm "int_isolate_add"}) t; term2str t;
neuper@41931
    34
neuper@41931
    35
val SOME (thmID,thm) = get_calculation_ thy (the(assoc(calclist,"TIMES"))) t; 
neuper@41931
    36
val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t; term2str t;
neuper@41931
    37
neuper@41931
    38
val SOME (thmID,thm) = get_calculation_ thy (the(assoc(calclist,"PLUS"))) t; 
neuper@41931
    39
val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t; term2str t;
neuper@41931
    40
neuper@41931
    41
"----------- mathengine with usecase1 -------------------";
neuper@41931
    42
"----------- mathengine with usecase1 -------------------";
neuper@41931
    43
"----------- mathengine with usecase1 -------------------";
neuper@41934
    44
val p = e_pos'; val c = [];
neuper@41934
    45
val (fmz, (thy, pbl, met)) = 
neuper@41936
    46
  (["boolTestGiven (xxx + 111 = abc + (123::int))", "intTestGiven xxx", 
neuper@41936
    47
    "intTestFind sss"],
neuper@41934
    48
   (Context.theory_name thy, ["diophantine", "equation"], 
neuper@41934
    49
    ["Test", "solve_diophant"]));
neuper@41934
    50
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (thy, pbl, met))];
neuper@41931
    51
val (p,_,f,nxt,_,pt) = me nxt p c pt; 
neuper@41936
    52
(*========== inhibit exn WN110318 ==============================================
neuper@41931
    53
val (p,_,f,nxt,_,pt) = me nxt p c pt; 
neuper@41931
    54
val (p,_,f,nxt,_,pt) = me nxt p c pt; 
neuper@41931
    55
val (p,_,f,nxt,_,pt) = me nxt p c pt; 
neuper@41931
    56
val (p,_,f,nxt,_,pt) = me nxt p c pt; 
neuper@41931
    57
val (p,_,f,nxt,_,pt) = me nxt p c pt; 
neuper@41933
    58
val (p,_,f,nxt,_,pt) = me nxt p c pt; 
neuper@41936
    59
============ inhibit exn WN110318 ============================================*)
neuper@41936
    60
neuper@41936
    61
"----------- rewriting for usecase2 ---------------------";
neuper@41936
    62
"----------- rewriting for usecase2 ---------------------";
neuper@41936
    63
val thy = @{theory "Test"};
neuper@41936
    64
"----------- rewriting for usecase2 ---------------------";
neuper@41936
    65
neuper@41936
    66
val t = parseNEW ctxt "xxx + abc + -1 * 111 + (123::int)";
neuper@41936
    67
neuper@41936
    68
val SOME (thmID,thm) = get_calculation_ thy (the(assoc(calclist,"TIMES"))) t; 
neuper@41936
    69
val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t; term2str t;
neuper@41936
    70
neuper@41936
    71
val SOME (thmID,thm) = get_calculation_ thy (the(assoc(calclist,"PLUS"))) t; 
neuper@41936
    72
val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t; term2str t;
neuper@41936
    73
neuper@41936
    74
neuper@41936
    75
"----------- mathengine with usecase2 -------------------";
neuper@41936
    76
"----------- mathengine with usecase2 -------------------";
neuper@41936
    77
"----------- mathengine with usecase2 -------------------";
neuper@41936
    78
val p = e_pos'; val c = [];
neuper@41936
    79
val (fmz, (thy, pbl, met)) = 
neuper@41936
    80
  (["intTestGiven (xxx + abc + -1 * 111 + (123::int))", "intTestFind sss"],
neuper@41936
    81
   (Context.theory_name thy, ["inttype","test"], ["Test","intsimp"]));
neuper@41936
    82
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (thy, pbl, met))];
neuper@41936
    83
(*nxt = ("Model_Problem", ...)*)
neuper@41936
    84
val (p,_,f,nxt,_,pt) = me nxt p c pt; 
neuper@41936
    85
(*nxt = ("Add_Given", Add_Given "intTestGiven (xxx + abc + -1 * 111 + 123)")*)
neuper@41936
    86
val (p,_,f,nxt,_,pt) = me nxt p c pt; 
neuper@41936
    87
(* Add_Find ###########################################*)
neuper@41936
    88
val (p,_,f,nxt,_,pt) = me nxt p c pt; 
neuper@41936
    89
(*nxt = ("Specify_Theory", ...)*)
neuper@41936
    90
val (p,_,f,nxt,_,pt) = me nxt p c pt; 
neuper@41936
    91
(*nxt = ("Specify_Problem", ...)*)
neuper@41936
    92
val (p,_,f,nxt,_,pt) = me nxt p c pt; 
neuper@41936
    93
(*nxt = ("Specify_Method", ...)*)
neuper@41936
    94
val (p,_,f,nxt,_,pt) = me nxt p c pt; 
neuper@41936
    95
(*nxt = ("Empty_Tac", ...) #############################*)
neuper@41936
    96
val (p,_,f,nxt,_,pt) = me nxt p c pt; 
neuper@41936
    97
(*========== inhibit exn WN110318 ==============================================
neuper@41936
    98
============ inhibit exn WN110318 ============================================*)