test/Tools/isac/Knowledge/diophanteq.sml
author wneuper <Walther.Neuper@jku.at>
Thu, 04 Aug 2022 12:48:37 +0200
changeset 60509 2e0b7ca391dc
parent 60500 59a3af532717
child 60519 70b30d910fd5
permissions -rw-r--r--
polish naming in Rewrite_Order
     1 (* Title:  tests on DiophantEq.thy
     2    Author: Mathias Lehnfeld 2011
     3    (c) due to copyright terms
     4 12345678901234567890123456789012345678901234567890123456789012345678901234567890
     5         10        20        30        40        50        60        70        80
     6 *)
     7 "--------------------------------------------------------";
     8 "table of contents --------------------------------------";
     9 "--------------------------------------------------------";
    10 "----------- rewriting for usecase1 ---------------------";
    11 "----------- mathengine with usecase1 -------------------";
    12 "----------- rewriting for usecase2 ---------------------";
    13 "----------- mathengine with usecase2 -------------------";
    14 "--------------------------------------------------------";
    15 "--------------------------------------------------------";
    16 "--------------------------------------------------------";
    17 
    18 (*there seemed to be no way to do these tests within DiophantEq.thy:
    19 val thy = @{theory};(**** ME_Isa: thy 'DiophantEq' not in system
    20   from CalcTreeTest*)
    21 (*val thy = @{theory "Isac_Knowledge"};toplevel error from store_met?!?*)
    22 *)
    23 val thy = @{theory "DiophantEq"};
    24 val ctxt = Proof_Context.init_global thy;
    25 
    26 "----------- rewriting for usecase1 ---------------------";
    27 "----------- rewriting for usecase1 ---------------------";
    28 "----------- rewriting for usecase1 ---------------------";
    29 val subst = case (parseNEW ctxt "bdv::int", parseNEW ctxt "xxx::int") of
    30       (SOME r, SOME s) => [(r,s)]
    31     | _ => error "diophanteq.sml: syntax error in rewriting for usecase1"
    32 val t = case parseNEW ctxt "xxx + 111 = abc + (123::int)" of
    33       SOME t' => t'
    34     | NONE => error "diophanteq.sml: syntax error in rewriting for usecase1";
    35 
    36 val SOME (t,_) = rewrite_inst_ ctxt Rewrite_Ord.function_empty Rule_Set.empty true subst 
    37   @{thm "int_isolate_add"} t; UnparseC.term t;
    38 
    39 val SOME (thmID,thm) = adhoc_thm thy (the(LibraryC.assoc(KEStore_Elems.get_calcs @{theory},"TIMES"))) t; 
    40 val SOME (t,_) = rewrite_ ctxt tless_true tval_rls true thm t; UnparseC.term t;
    41 
    42 val SOME (thmID,thm) = adhoc_thm thy (the(LibraryC.assoc(KEStore_Elems.get_calcs @{theory},"PLUS"))) t; 
    43 val SOME (t,_) = rewrite_ ctxt tless_true tval_rls true thm t; UnparseC.term t;
    44 
    45 "----------- mathengine with usecase1 -------------------";
    46 "----------- mathengine with usecase1 -------------------";
    47 "----------- mathengine with usecase1 -------------------";
    48 val p = e_pos'; val c = [];
    49 val (fmz, (thy, pbl, met)) = 
    50   (["boolTestGiven (xxx + 111 = abc + (123::int))", "intTestGiven xxx", 
    51     "intTestFind sss"],
    52    (Context.theory_name thy, ["diophantine", "equation"], 
    53     ["Test", "solve_diophant"]));
    54 val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (thy, pbl, met))];
    55 val (p,_,f,nxt,_,pt) = me nxt p c pt; 
    56 val (p,_,f,nxt,_,pt) = me nxt p c pt; 
    57 val (p,_,f,nxt,_,pt) = me nxt p c pt; 
    58 val (p,_,f,nxt,_,pt) = me nxt p c pt; 
    59 val (p,_,f,nxt,_,pt) = me nxt p c pt;
    60 (* BROKEN WITH 62e72f77e695 excluded "ERROR in creating the environment.." FROM "helpless"
    61 val (p,_,f,nxt,_,pt) = me nxt p c pt; 
    62 val (p,_,f,nxt,_,pt) = me nxt p c pt;
    63 *)
    64 
    65 "----------- rewriting for usecase2 ---------------------";
    66 "----------- rewriting for usecase2 ---------------------";
    67 val thy = @{theory "Test"};
    68 "----------- rewriting for usecase2 ---------------------";
    69 
    70 val t = case parseNEW ctxt "xxx + abc + - 1 * 111 + (123::int)" of
    71       SOME t' => t'
    72     | NONE => error "diophanteq.sml: syntax error in rewriting for usecase2";
    73 
    74 val SOME (thmID,thm) = adhoc_thm thy (the(LibraryC.assoc(KEStore_Elems.get_calcs @{theory},"TIMES"))) t; 
    75 val SOME (t,_) = rewrite_ ctxt tless_true tval_rls true thm t; UnparseC.term t;
    76 
    77 val SOME (thmID,thm) = adhoc_thm thy (the(LibraryC.assoc(KEStore_Elems.get_calcs @{theory},"PLUS"))) t; 
    78 val SOME (t,_) = rewrite_ ctxt tless_true tval_rls true thm t; UnparseC.term t;
    79 
    80 
    81 "----------- mathengine with usecase2 -------------------";
    82 "----------- mathengine with usecase2 -------------------";
    83 "----------- mathengine with usecase2 -------------------";
    84 val p = e_pos'; val c = [];
    85 val (fmz, (thy, pbl, met)) = 
    86   (["intTestGiven (xxx + abc + - 1 * 111 + (123::int))", "intTestFind sss"],
    87    (Context.theory_name thy, ["inttype", "test"], ["Test", "intsimp"]));
    88 val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (thy, pbl, met))];
    89 (*nxt = ("Model_Problem", ...)*)
    90 val (p,_,f,nxt,_,pt) = me nxt p c pt; 
    91 (*nxt = ("Add_Given", Add_Given "intTestGiven (xxx + abc + - 1 * 111 + 123)")*)
    92 val (p,_,f,nxt,_,pt) = me nxt p c pt; 
    93 (* Add_Find ###########################################*)
    94 val (p,_,f,nxt,_,pt) = me nxt p c pt; 
    95 (*nxt = ("Specify_Theory", ...)*)
    96 val (p,_,f,nxt,_,pt) = me nxt p c pt; 
    97 (* BROKEN WITH 62e72f77e695 excluded "ERROR in creating the environment.." FROM "helpless"
    98 (*nxt = ("Specify_Problem", ...)*)
    99 val (p,_,f,nxt,_,pt) = me nxt p c pt; 
   100 (*nxt = ("Specify_Method", ...)*)
   101 val (p,_,f,nxt,_,pt) = me nxt p c pt; 
   102 (*nxt = ("Empty_Tac", ...) #############################*)
   103 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   104 *)
   105