intermed. context integration appl_add does not work
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
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 "--------------------------------------------------------";
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
21 (*val thy = @{theory "Isac"};toplevel error from store_met?!?*)
23 val thy = @{theory "DiophantEq"};
24 val ctxt = ProofContext.init_global thy;
26 "----------- rewriting for usecase1 ---------------------";
27 "----------- rewriting for usecase1 ---------------------";
28 "----------- rewriting for usecase1 ---------------------";
30 val pair = (parseNEW ctxt "bdv::int", parseNEW ctxt "xxx::int");
32 (SOME r, SOME s) => [(r,s)]
33 | _ => error "diophanteq.sml: syntax error in rewriting for usecase1"
35 val t = case parseNEW ctxt "xxx + 111 = abc + (123::int)" of
37 | NONE => error "diophanteq.sml: syntax error in rewriting for usecase1";
39 val SOME (t,_) = rewrite_inst_ thy e_rew_ord e_rls true subst
40 (num_str @{thm "int_isolate_add"}) t; term2str t;
42 val SOME (thmID,thm) = get_calculation_ thy (the(assoc(calclist,"TIMES"))) t;
43 val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t; term2str t;
45 val SOME (thmID,thm) = get_calculation_ thy (the(assoc(calclist,"PLUS"))) t;
46 val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t; term2str t;
48 "----------- mathengine with usecase1 -------------------";
49 "----------- mathengine with usecase1 -------------------";
50 "----------- mathengine with usecase1 -------------------";
51 val p = e_pos'; val c = [];
52 val (fmz, (thy, pbl, met)) =
53 (["boolTestGiven (xxx + 111 = abc + (123::int))", "intTestGiven xxx",
55 (Context.theory_name thy, ["diophantine", "equation"],
56 ["Test", "solve_diophant"]));
57 val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (thy, pbl, met))];
58 val (p,_,f,nxt,_,pt) = me nxt p c pt;
59 (*========== inhibit exn WN110318 ==============================================
60 val (p,_,f,nxt,_,pt) = me nxt p c pt;
61 val (p,_,f,nxt,_,pt) = me nxt p c pt;
62 val (p,_,f,nxt,_,pt) = me nxt p c pt;
63 val (p,_,f,nxt,_,pt) = me nxt p c pt;
64 val (p,_,f,nxt,_,pt) = me nxt p c pt;
65 val (p,_,f,nxt,_,pt) = me nxt p c pt;
66 ============ inhibit exn WN110318 ============================================*)
68 "----------- rewriting for usecase2 ---------------------";
69 "----------- rewriting for usecase2 ---------------------";
70 val thy = @{theory "Test"};
71 "----------- rewriting for usecase2 ---------------------";
73 val t = case parseNEW ctxt "xxx + abc + -1 * 111 + (123::int)" of
75 | NONE => error "diophanteq.sml: syntax error in rewriting for usecase2";
77 val SOME (thmID,thm) = get_calculation_ thy (the(assoc(calclist,"TIMES"))) t;
78 val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t; term2str t;
80 val SOME (thmID,thm) = get_calculation_ thy (the(assoc(calclist,"PLUS"))) t;
81 val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t; term2str t;
84 "----------- mathengine with usecase2 -------------------";
85 "----------- mathengine with usecase2 -------------------";
86 "----------- mathengine with usecase2 -------------------";
87 val p = e_pos'; val c = [];
88 val (fmz, (thy, pbl, met)) =
89 (["intTestGiven (xxx + abc + -1 * 111 + (123::int))", "intTestFind sss"],
90 (Context.theory_name thy, ["inttype","test"], ["Test","intsimp"]));
91 val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (thy, pbl, met))];
92 (*nxt = ("Model_Problem", ...)*)
93 val (p,_,f,nxt,_,pt) = me nxt p c pt;
94 (*nxt = ("Add_Given", Add_Given "intTestGiven (xxx + abc + -1 * 111 + 123)")*)
95 val (p,_,f,nxt,_,pt) = me nxt p c pt;
96 (* Add_Find ###########################################*)
97 val (p,_,f,nxt,_,pt) = me nxt p c pt;
98 (*nxt = ("Specify_Theory", ...)*)
99 val (p,_,f,nxt,_,pt) = me nxt p c pt;
100 (*nxt = ("Specify_Problem", ...)*)
101 val (p,_,f,nxt,_,pt) = me nxt p c pt;
102 (*nxt = ("Specify_Method", ...)*)
103 val (p,_,f,nxt,_,pt) = me nxt p c pt;
104 (*nxt = ("Empty_Tac", ...) #############################*)
105 val (p,_,f,nxt,_,pt) = me nxt p c pt;
106 (*========== inhibit exn WN110318 ==============================================
107 ============ inhibit exn WN110318 ============================================*)