neuper@41999
|
1 |
(* Title: test/../script.sml
|
neuper@41999
|
2 |
Author: Walther Neuper 050908
|
neuper@37906
|
3 |
(c) copyright due to lincense terms.
|
neuper@37906
|
4 |
*)
|
neuper@37906
|
5 |
"-----------------------------------------------------------------";
|
neuper@37906
|
6 |
"table of contents -----------------------------------------------";
|
neuper@37906
|
7 |
"-----------------------------------------------------------------";
|
neuper@37906
|
8 |
"----------- fun sel_appl_atomic_tacs ----------------------------";
|
neuper@41969
|
9 |
"----------- fun init_form, fun get_stac -------------------------";
|
neuper@41972
|
10 |
"----------- x+1=2 start SubProblem 'stac2tac_ TODO: no match for ";
|
neuper@42283
|
11 |
"----------- Take as 1st stac in script --------------------------";
|
neuper@42394
|
12 |
"----------- 'trace_script' from outside 'fun me '----------------";
|
neuper@42438
|
13 |
"----------- fun sel_rules ---------------------------------------";
|
neuper@42438
|
14 |
"----------- fun sel_appl_atomic_tacs ----------------------------";
|
wneuper@59257
|
15 |
"----------- fun de_esc_underscore -------------------------------";
|
wneuper@59257
|
16 |
"----------- fun go ----------------------------------------------";
|
wneuper@59257
|
17 |
"----------- fun formal_args -------------------------------------";
|
wneuper@59257
|
18 |
"----------- fun dsc_valT ----------------------------------------";
|
wneuper@59257
|
19 |
"----------- fun itms2args ---------------------------------------";
|
wneuper@59257
|
20 |
"----------- fun rep_tac_ ----------------------------------------";
|
wneuper@59539
|
21 |
"----------- fun init_scrstate -----------------------------------------------------------------";
|
neuper@37906
|
22 |
"-----------------------------------------------------------------";
|
neuper@37906
|
23 |
"-----------------------------------------------------------------";
|
neuper@37906
|
24 |
"-----------------------------------------------------------------";
|
neuper@37906
|
25 |
|
neuper@42438
|
26 |
val thy = @{theory Isac};
|
neuper@42281
|
27 |
|
neuper@37906
|
28 |
"----------- fun sel_appl_atomic_tacs ----------------------------";
|
neuper@37906
|
29 |
"----------- fun sel_appl_atomic_tacs ----------------------------";
|
neuper@37906
|
30 |
"----------- fun sel_appl_atomic_tacs ----------------------------";
|
akargl@42145
|
31 |
|
s1210629013@55445
|
32 |
reset_states ();
|
neuper@41970
|
33 |
CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"],
|
neuper@41970
|
34 |
("Test", ["sqroot-test","univariate","equation","test"],
|
neuper@37906
|
35 |
["Test","squ-equ-test-subpbl1"]))];
|
neuper@37906
|
36 |
Iterator 1;
|
neuper@37906
|
37 |
moveActiveRoot 1;
|
wneuper@59248
|
38 |
autoCalculate 1 CompleteCalcHead;
|
wneuper@59248
|
39 |
autoCalculate 1 (Step 1);
|
wneuper@59248
|
40 |
autoCalculate 1 (Step 1);
|
neuper@37906
|
41 |
val ((pt, p), _) = get_calc 1; show_pt pt;
|
neuper@37906
|
42 |
val appltacs = sel_appl_atomic_tacs pt p;
|
wneuper@59252
|
43 |
case appltacs of
|
wneuper@59252
|
44 |
[Rewrite ("radd_commute", radd_commute),
|
wneuper@59252
|
45 |
Rewrite ("add_assoc", add_assoc), Calculate "TIMES"]
|
wneuper@59253
|
46 |
=> if (term2str o Thm.prop_of) radd_commute = "?m + ?n = ?n + ?m" andalso
|
wneuper@59253
|
47 |
(term2str o Thm.prop_of) add_assoc = "?a + ?b + ?c = ?a + (?b + ?c)" then ()
|
wneuper@59252
|
48 |
else error "script.sml fun sel_appl_atomic_tacs diff.behav. 2"
|
wneuper@59252
|
49 |
| _ => error "script.sml fun sel_appl_atomic_tacs diff.behav. 1";
|
neuper@37906
|
50 |
|
neuper@37906
|
51 |
trace_script := true;
|
neuper@37906
|
52 |
trace_script := false;
|
neuper@37906
|
53 |
applyTactic 1 p (hd appltacs);
|
neuper@37906
|
54 |
val ((pt, p), _) = get_calc 1; show_pt pt;
|
neuper@37906
|
55 |
val appltacs = sel_appl_atomic_tacs pt p;
|
neuper@48895
|
56 |
(*applyTactic 1 p (hd appltacs); WAS assy: call by ([3], Pbl)*)
|
neuper@37906
|
57 |
|
akargl@42169
|
58 |
"~~~~~ fun applyTactic, args:"; val ((cI:calcID), ip, tac) = (1, p, (hd appltacs));
|
akargl@42169
|
59 |
val ((pt, _), _) = get_calc cI;
|
akargl@42169
|
60 |
val p = get_pos cI 1;
|
akargl@42169
|
61 |
locatetac;
|
akargl@42169
|
62 |
locatetac tac;
|
akargl@42169
|
63 |
|
akargl@42169
|
64 |
(*locatetac tac (pt, ip); (*WAS assy: call by ([3], Pbl)*)*)
|
akargl@42169
|
65 |
"~~~~~ fun locatetac, args:"; val (tac, (ptp as (pt, p))) = (tac, (pt, ip));
|
akargl@42169
|
66 |
val (mI,m) = mk_tac'_ tac;
|
akargl@42169
|
67 |
applicable_in p pt m ; (*Appl*)
|
akargl@42169
|
68 |
member op = specsteps mI; (*false*)
|
akargl@42169
|
69 |
(*loc_solve_ (mI,m) ptp; (*Argument: (mI, m) : string * tac Reason: Can't unify tac_ with tac*)*)
|
akargl@42169
|
70 |
loc_solve_; (*without _ ??? result is -> lOc writing error ???*)
|
wneuper@59279
|
71 |
(*val it = fn: string * tac_ -> ctree * (pos * pos_) -> lOc_*)
|
akargl@42169
|
72 |
(mI,m); (*string * tac*)
|
wneuper@59279
|
73 |
ptp (*ctree * pos'*);
|
akargl@42169
|
74 |
"~~~~~ fun loc_solve_, args:"; val (m ,(pt,pos)) = ((mI,m), ptp);
|
akargl@42169
|
75 |
(*val (msg, cs') = solve m (pt, pos);
|
akargl@42169
|
76 |
(*Argument: m : string * tac Reason: Can't unify tac_ with tac (Different type constructors)*)*)
|
akargl@42169
|
77 |
m;
|
akargl@42169
|
78 |
(pt, pos);
|
akargl@42169
|
79 |
"~~~~~ fun solve, args:"; val ((mI,m), (pt, po as (p,p_))) = (m, (pt, pos));
|
akargl@42169
|
80 |
(*solve has still p_!!!!!!!!!!!!!!!!!!!!!!!!!*)
|
akargl@42169
|
81 |
|
akargl@42169
|
82 |
e_metID = get_obj g_metID pt (par_pblobj pt p); (*false*)
|
akargl@42169
|
83 |
val ctxt = get_ctxt pt po;
|
akargl@42169
|
84 |
|
akargl@42169
|
85 |
(*generate1 (assoc_thy (get_obj g_domID pt (par_pblobj pt p))) m (e_istate, ctxt) (p,p_) pt;
|
akargl@42169
|
86 |
(*Argument: m : tac Reason: Can't unify tac_ with tac (Different type constructors)*)*)
|
akargl@42169
|
87 |
(assoc_thy (get_obj g_domID pt (par_pblobj pt p)));
|
akargl@42169
|
88 |
assoc_thy;
|
akargl@42169
|
89 |
|
wneuper@59248
|
90 |
autoCalculate 1 CompleteCalc;
|
neuper@37906
|
91 |
|
neuper@41969
|
92 |
"----------- fun init_form, fun get_stac -------------------------";
|
neuper@41969
|
93 |
"----------- fun init_form, fun get_stac -------------------------";
|
neuper@41969
|
94 |
"----------- fun init_form, fun get_stac -------------------------";
|
neuper@41969
|
95 |
val fmz = ["equality (x+1=(2::real))", "solveFor x", "solutions L"];
|
neuper@41969
|
96 |
val (dI',pI',mI') = ("Test",["sqroot-test","univariate","equation","test"],
|
neuper@41969
|
97 |
["Test","squ-equ-test-subpbl1"]);
|
neuper@41969
|
98 |
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
|
neuper@41969
|
99 |
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
|
neuper@41969
|
100 |
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
|
neuper@41969
|
101 |
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
|
neuper@41969
|
102 |
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
|
neuper@41969
|
103 |
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
|
neuper@41969
|
104 |
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
|
neuper@41969
|
105 |
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
|
neuper@41969
|
106 |
"~~~~~ fun me, args:"; val (_,tac) = nxt;
|
neuper@41969
|
107 |
"~~~~~ fun locatetac, args:"; val ptp as (pt, p) = (pt, p);
|
neuper@41969
|
108 |
val (mI,m) = mk_tac'_ tac;
|
neuper@41969
|
109 |
val Appl m = applicable_in p pt m;
|
neuper@41969
|
110 |
member op = specsteps mI; (*false*)
|
neuper@41969
|
111 |
"~~~~~ fun loc_solve_, args:"; val (m, (pt, pos) ) = ((mI, m), ptp);
|
neuper@41969
|
112 |
"~~~~~ fun solve, args:"; val (("Apply_Method", Apply_Method' (mI,_,_,_)), pos as (p,_)) = (m, pos);
|
neuper@41969
|
113 |
val {srls, ...} = get_met mI;
|
neuper@41969
|
114 |
val PblObj {meth=itms, ...} = get_obj I pt p;
|
neuper@41969
|
115 |
val thy' = get_obj g_domID pt p;
|
neuper@41969
|
116 |
val thy = assoc_thy thy';
|
neuper@41969
|
117 |
val (is as ScrState (env,_,_,_,_,_), ctxt, sc) = init_scrstate thy itms mI;
|
neuper@41969
|
118 |
val ini = init_form thy sc env;
|
neuper@48790
|
119 |
"----- fun init_form, args:"; val (Prog sc) = sc;
|
neuper@41969
|
120 |
"----- fun get_stac, args:"; val (y, h $ body) = (thy, sc);
|
neuper@41969
|
121 |
case get_stac thy sc of SOME (Free ("e_e", _)) => ()
|
neuper@41969
|
122 |
| _ => error "script: Const (?, ?) in script (as term) changed";;
|
neuper@41969
|
123 |
|
neuper@41972
|
124 |
|
neuper@41972
|
125 |
"----------- x+1=2 start SubProblem 'stac2tac_ TODO: no match for ";
|
neuper@41972
|
126 |
"----------- x+1=2 start SubProblem 'stac2tac_ TODO: no match for ";
|
neuper@41972
|
127 |
"----------- x+1=2 start SubProblem 'stac2tac_ TODO: no match for ";
|
neuper@41972
|
128 |
val fmz = ["equality (x+1=(2::real))", "solveFor x","solutions L"];
|
neuper@41972
|
129 |
val (dI',pI',mI') =
|
neuper@41972
|
130 |
("Test", ["sqroot-test","univariate","equation","test"],
|
neuper@41972
|
131 |
["Test","squ-equ-test-subpbl1"]);
|
neuper@41972
|
132 |
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
|
neuper@41972
|
133 |
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
|
neuper@41972
|
134 |
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
|
neuper@41972
|
135 |
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
|
neuper@41972
|
136 |
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
|
neuper@41972
|
137 |
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
|
neuper@41972
|
138 |
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
|
neuper@41972
|
139 |
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
|
neuper@41972
|
140 |
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
|
neuper@41972
|
141 |
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
|
neuper@41972
|
142 |
(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt; WAS: Empty_Tac, helpless*)
|
neuper@41972
|
143 |
show_pt pt;
|
neuper@41972
|
144 |
"~~~~~ fun me, args:"; val (_,tac) = nxt;
|
neuper@41973
|
145 |
val (pt, p) = case locatetac tac (pt,p) of
|
neuper@41973
|
146 |
("ok", (_, _, ptp)) => ptp | _ => error "script.sml locatetac";
|
neuper@41972
|
147 |
"~~~~~ fun step, args:"; val (ip as (_,p_), (ptp as (pt,p), tacis)) = (p, ((pt, e_pos'), []))
|
neuper@55279
|
148 |
val pIopt = get_pblID (pt,ip); (*SOME ["LINEAR", "univariate", "equation", "test"]*)
|
neuper@41972
|
149 |
tacis; (*= []*)
|
neuper@41972
|
150 |
member op = [Pbl,Met] p_ andalso is_none (get_obj g_env pt (fst p)); (*= false*)
|
neuper@41972
|
151 |
"~~~~~ fun nxt_solve_, args:"; val (ptp as (pt, pos as (p, p_))) = (pt, ip);
|
neuper@41972
|
152 |
(*WAS stac2tac_ TODO: no match for SubProblem*)
|
neuper@41972
|
153 |
val thy' = get_obj g_domID pt (par_pblobj pt p);
|
neuper@41972
|
154 |
val (srls, is, sc) = from_pblobj_or_detail' thy' (p,p_) pt;
|
wneuper@59279
|
155 |
"~~~~~ fun next_tac, args:"; val (thy, (ptp as (pt,(p,_)):ctree * pos'), (sc as Prog (h $ body)),
|
neuper@41972
|
156 |
(ScrState (E,l,a,v,s,b), ctxt)) = ((thy',srls), (pt,pos), sc, is);
|
neuper@41972
|
157 |
l; (*= [R, L, R, L, R, R]*)
|
neuper@41972
|
158 |
val Appy (m', scrst as (_,_,_,v,_,_)) = nstep_up thy ptp sc E l Skip_ a v;
|
neuper@41972
|
159 |
"~~~~~ dont like to go into nstep_up...";
|
neuper@41972
|
160 |
val t = str2term ("SubProblem" ^
|
wneuper@59498
|
161 |
"(''Test'', [''LINEAR'', ''univariate'', ''equation'', ''test''], [''Test'', ''solve_linear''])" ^
|
neuper@41972
|
162 |
"[BOOL (-1 + x = 0), REAL x]");
|
neuper@41972
|
163 |
val (tac, tac_) = stac2tac_ pt @{theory "Isac"} t; (*WAS stac2tac_ TODO: no match for SubProblem*)
|
neuper@41972
|
164 |
case tac_ of
|
neuper@41972
|
165 |
Subproblem' _ => ()
|
neuper@41972
|
166 |
| _ => error "script.sml x+1=2 start SubProblem from script";
|
neuper@41972
|
167 |
|
neuper@41972
|
168 |
|
neuper@42283
|
169 |
"----------- Take as 1st stac in script --------------------------";
|
neuper@42283
|
170 |
"----------- Take as 1st stac in script --------------------------";
|
neuper@42283
|
171 |
"----------- Take as 1st stac in script --------------------------";
|
neuper@42283
|
172 |
val p = e_pos'; val c = [];
|
neuper@42283
|
173 |
val (p,_,f,nxt,_,pt) =
|
neuper@42283
|
174 |
CalcTreeTEST
|
neuper@42283
|
175 |
[(["functionTerm (x^^^2 + 1)", "integrateBy x", "antiDerivative FF"],
|
neuper@42283
|
176 |
("Integrate", ["integrate","function"], ["diff","integration"]))];
|
neuper@42283
|
177 |
val (p,_,f,nxt,_,pt) = me nxt p c pt; (*nxt = ("Tac ", ...) --> Add_Given...*)
|
neuper@42283
|
178 |
val (p,_,f,nxt,_,pt) = me nxt p c pt;
|
neuper@42283
|
179 |
val (p,_,f,nxt,_,pt) = me nxt p c pt;
|
neuper@42283
|
180 |
val (p,_,f,nxt,_,pt) = me nxt p c pt;
|
neuper@42283
|
181 |
val (p,_,f,nxt,_,pt) = me nxt p c pt;
|
neuper@42283
|
182 |
val (p,_,f,nxt,_,pt) = me nxt p c pt;
|
neuper@42283
|
183 |
val (p,_,f,nxt,_,pt) = me nxt p c pt;
|
neuper@42283
|
184 |
case nxt of (_, Apply_Method ["diff", "integration"]) => ()
|
neuper@42283
|
185 |
| _ => error "integrate.sml -- me method [diff,integration] -- spec";
|
wneuper@59497
|
186 |
"----- step 8: returns nxt = Rewrite_Set_Inst ([\"(''bdv'', x)\"],\"integration\")";
|
neuper@42283
|
187 |
|
wneuper@59279
|
188 |
"~~~~~ fun me, args:"; val (((_,tac):tac'_), (p:pos'), _, (pt:ctree)) = (nxt, p, c, pt);
|
neuper@42283
|
189 |
"~~~~~ fun locatetac, args:"; val (tac, (ptp as (pt, p))) = (tac, (pt,p));
|
neuper@42283
|
190 |
val (mI,m) = mk_tac'_ tac;
|
neuper@42283
|
191 |
val Appl m = applicable_in p pt m;
|
neuper@42283
|
192 |
member op = specsteps mI (*false*);
|
neuper@42283
|
193 |
"~~~~~ fun loc_solve_, args:"; val (m, (pt,pos)) = ((mI,m), ptp);
|
neuper@42283
|
194 |
"~~~~~ fun solve, args:"; val ((_, m as Apply_Method' (mI, _, _, _)), (pt, (pos as (p,_)))) =
|
neuper@42283
|
195 |
(m, (pt, pos));
|
neuper@42283
|
196 |
val {srls, ...} = get_met mI;
|
neuper@42283
|
197 |
val PblObj {meth=itms, ...} = get_obj I pt p;
|
neuper@42283
|
198 |
val thy' = get_obj g_domID pt p;
|
neuper@42283
|
199 |
val thy = assoc_thy thy';
|
neuper@42283
|
200 |
val (is as ScrState (env,_,_,_,_,_), ctxt, sc) = init_scrstate thy itms mI;
|
neuper@42283
|
201 |
val ini = init_form thy sc env;
|
neuper@42283
|
202 |
val p = lev_dn p;
|
neuper@42283
|
203 |
ini = NONE; (*true*)
|
neuper@42283
|
204 |
val (m', (is', ctxt'), _) = next_tac (thy', srls) (pt, (p, Res)) sc (is, ctxt);
|
neuper@42283
|
205 |
val d = e_rls (*FIXME: get simplifier from domID*);
|
wneuper@59279
|
206 |
"~~~~~ fun locate_gen, args:"; val ((ts as (thy',srls)), (m:tac_), ((pt,p):ctree * pos'),
|
neuper@48790
|
207 |
(scr as Prog (h $ body),d), (ScrState (E,l,a,v,S,b), ctxt)) =
|
neuper@42283
|
208 |
((thy',srls), m', (pt,(p, Res)), (sc,d), (is', ctxt'));
|
neuper@42283
|
209 |
val thy = assoc_thy thy';
|
neuper@42283
|
210 |
l = [] orelse ((*init.in solve..Apply_Method...*)
|
neuper@42283
|
211 |
(last_elem o fst) p = 0 andalso snd p = Res); (*true*)
|
neuper@42283
|
212 |
"~~~~~ fun assy, args:"; val (ya, (is as (E,l,a,v,S,b),ss),
|
neuper@42283
|
213 |
(Const ("HOL.Let",_) $ e $ (Abs (id,T,body)))) =
|
neuper@42283
|
214 |
((thy',ctxt,srls,d,Aundef), ((E,[R],a,v,S,b), [(m,EmptyMout,pt,p,[])]), body);
|
neuper@42283
|
215 |
(*check: true*) term2str e = "Take (Integral f_f D v_v)";
|
neuper@42283
|
216 |
"~~~~~ fun assy, args:"; val ((thy',ctxt,sr,d,ap), (is as (E,l,a,v,S,b), (m,_,pt,(p,p_),c)::ss), t) =
|
neuper@42283
|
217 |
(ya, ((E , l@[L,R], a,v,S,b),ss), e);
|
neuper@42283
|
218 |
val (a', STac stac) = handle_leaf "locate" thy' sr E a v t;
|
neuper@42283
|
219 |
(* val ctxt = get_ctxt pt (p,p_)
|
neuper@42283
|
220 |
exception PTREE "get_obj: pos = [0] does not exist" raised
|
neuper@42283
|
221 |
(line 908 of "/usr/local/isabisac/src/Tools/isac/Interpret/ctree.sml")*)
|
neuper@42283
|
222 |
|
neuper@42283
|
223 |
|
neuper@42394
|
224 |
"----------- 'trace_script' from outside 'fun me '----------------";
|
neuper@42394
|
225 |
"----------- 'trace_script' from outside 'fun me '----------------";
|
neuper@42394
|
226 |
"----------- 'trace_script' from outside 'fun me '----------------";
|
neuper@42394
|
227 |
val fmz = ["equality (x+1=(2::real))", "solveFor x","solutions L"];
|
neuper@42394
|
228 |
val (dI',pI',mI') =
|
neuper@42394
|
229 |
("Test", ["sqroot-test","univariate","equation","test"],
|
neuper@42394
|
230 |
["Test","squ-equ-test-subpbl1"]);
|
neuper@42394
|
231 |
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
|
neuper@42394
|
232 |
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
|
neuper@42394
|
233 |
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
|
neuper@42394
|
234 |
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
|
neuper@42394
|
235 |
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
|
neuper@42394
|
236 |
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
|
neuper@42394
|
237 |
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
|
neuper@42394
|
238 |
val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Apply_Method ["Test", "squ-equ-test-subpbl1"]*)
|
neuper@42394
|
239 |
(*from_pblobj_or_detail': no istate = from_pblobj_or_detail' "Isac" p pt;*)
|
neuper@42394
|
240 |
|
neuper@42394
|
241 |
val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*---------------------------------------------------*)
|
neuper@42394
|
242 |
val (p'''', pt'''') = (p, pt);
|
wneuper@59253
|
243 |
f2str f = "x + 1 = 2"; case snd nxt of Rewrite_Set "norm_equation" => () | _ => error "CHANGED";
|
neuper@42394
|
244 |
val (p, p_) = p(* = ([1], Frm)*);
|
neuper@48790
|
245 |
val (srls, (ScrState scrstate, ctxt), Prog sc) = from_pblobj_or_detail' "Isac" (p, p_) pt;
|
neuper@42394
|
246 |
val (env, loc_, curry_arg, res, Safe, true) = scrstate;
|
neuper@42394
|
247 |
env2str env = "[\"\n(e_e, x + 1 = 2)\",\"\n(v_v, x)\"]";
|
neuper@42394
|
248 |
loc_ = [];
|
neuper@42394
|
249 |
curry_arg = NONE;
|
neuper@42394
|
250 |
term2str res = "??.empty"; (* scrstate before starting interpretation *)
|
neuper@48790
|
251 |
(*term2str (go loc_ sc) = "Prog Solve_root_equation e_e v_v = ...*)
|
neuper@42394
|
252 |
|
neuper@42394
|
253 |
val (p,_,f,nxt,_,pt) = me nxt p'''' [] pt''''; (*-------------------------------------------*)
|
neuper@42394
|
254 |
val (p'''', pt'''') = (p, pt);
|
wneuper@59253
|
255 |
f2str f = "x + 1 + -1 * 2 = 0";
|
wneuper@59253
|
256 |
case snd nxt of Rewrite_Set "Test_simplify" => () | _ => error "CHANGED";
|
neuper@42394
|
257 |
val (p, p_) = p(* = ([1], Res)*);
|
neuper@48790
|
258 |
val (srls, (ScrState scrstate, ctxt), Prog sc) = from_pblobj_or_detail' "Isac" (p, p_) pt;
|
neuper@42394
|
259 |
val (env, loc_, curry_arg, res, Safe, true) = scrstate;
|
neuper@42394
|
260 |
env2str env = "[\"\n(e_e, x + 1 = 2)\",\"\n(v_v, x)\"]";
|
neuper@42394
|
261 |
loc_ = [R, L, R, L, L, R, R];
|
neuper@42394
|
262 |
curry_arg = SOME (str2term "e_e::bool");
|
neuper@42394
|
263 |
term2str res = "x + 1 + -1 * 2 = 0";(* scrstate after norm_equation, before Test_simplify *)
|
neuper@42394
|
264 |
term2str (go loc_ sc) = "Rewrite_Set norm_equation False";
|
neuper@42394
|
265 |
|
neuper@42394
|
266 |
val (p,_,f,nxt,_,pt) = me nxt p'''' [] pt''''; (*-------------------------------------------*)
|
neuper@42394
|
267 |
val (p'''', pt'''') = (p, pt);
|
wneuper@59253
|
268 |
f2str f = "-1 + x = 0";
|
wneuper@59253
|
269 |
case snd nxt of Subproblem ("Test", ["LINEAR", "univariate", "equation", "test"]) => ()
|
wneuper@59253
|
270 |
| _ => error "CHANGED";
|
neuper@42394
|
271 |
val (p, p_) = p(* = ([2], Res)*);
|
neuper@48790
|
272 |
val (srls, (ScrState scrstate, ctxt), Prog sc) = from_pblobj_or_detail' "Isac" (p, p_) pt;
|
neuper@42394
|
273 |
val (env, loc_, curry_arg, res, Safe, false) = scrstate;
|
neuper@42394
|
274 |
env2str env = "[\"\n(e_e, x + 1 = 2)\",\"\n(v_v, x)\"]";
|
neuper@42394
|
275 |
loc_ = [R, L, R, L, R, R];
|
neuper@42394
|
276 |
curry_arg = SOME (str2term "e_e::bool");
|
neuper@42394
|
277 |
term2str res = "-1 + x = 0"; (* scrstate after Test_simplify, before Subproblem *)
|
neuper@42394
|
278 |
term2str (go loc_ sc) = "Rewrite_Set Test_simplify False";
|
neuper@42394
|
279 |
|
neuper@42394
|
280 |
val (p,_,f,nxt,_,pt) = me nxt p'''' [] pt''''; (*-------------------------------------------*)
|
neuper@42394
|
281 |
val (p'''', pt'''') = (p, pt); (*f2str f = exception Match; ...is a model, not a formula*)
|
neuper@42394
|
282 |
val (p,_,f,nxt,_,pt) = me nxt p'''' [] pt''''; (*-------------------------------------------*)
|
neuper@42394
|
283 |
val (p'''', pt'''') = (p, pt);
|
neuper@42394
|
284 |
val (p,_,f,nxt,_,pt) = me nxt p'''' [] pt''''; (*-------------------------------------------*)
|
neuper@42394
|
285 |
val (p'''', pt'''') = (p, pt);
|
neuper@42394
|
286 |
val (p,_,f,nxt,_,pt) = me nxt p'''' [] pt''''; (*-------------------------------------------*)
|
neuper@42394
|
287 |
val (p'''', pt'''') = (p, pt);
|
neuper@42394
|
288 |
val (p,_,f,nxt,_,pt) = me nxt p'''' [] pt''''; (*-------------------------------------------*)
|
neuper@42394
|
289 |
val (p'''', pt'''') = (p, pt);
|
neuper@42394
|
290 |
val (p,_,f,nxt,_,pt) = me nxt p'''' [] pt''''; (*-------------------------------------------*)
|
neuper@42394
|
291 |
val (p'''', pt'''') = (p, pt);
|
neuper@42394
|
292 |
val (p,_,f,nxt,_,pt) = me nxt p'''' [] pt''''; (*-------------------------------------------*)
|
neuper@42394
|
293 |
val (p'''', pt'''') = (p, pt);
|
neuper@42394
|
294 |
val (p,_,f,nxt,_,pt) = me nxt p'''' [] pt''''; (*nxt = Apply_Method ["Test", "solve_linear"]*)
|
neuper@42394
|
295 |
(*from_pblobj_or_detail': no istate = from_pblobj_or_detail' "Isac" p pt;*)
|
neuper@42394
|
296 |
|
neuper@42394
|
297 |
val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*---------------------------------------------------*)
|
neuper@42394
|
298 |
val (p'''', pt'''') = (p, pt);
|
wneuper@59253
|
299 |
f2str f = "-1 + x = 0";
|
wneuper@59497
|
300 |
case snd nxt of Rewrite_Set_Inst (["(''bdv'', x)"], "isolate_bdv") => () | _ => error "CHANGED";
|
neuper@42394
|
301 |
val (p, p_) = p(* = ([3, 1], Frm)*);
|
neuper@48790
|
302 |
val (srls, (ScrState scrstate, ctxt), Prog sc) = from_pblobj_or_detail' "Isac" (p, p_) pt;
|
neuper@42394
|
303 |
val (env, loc_, curry_arg, res, Safe, true) = scrstate;
|
neuper@42394
|
304 |
env2str env = "[\"\n(e_e, -1 + x = 0)\",\"\n(v_v, x)\"]";
|
neuper@42394
|
305 |
loc_ = [];
|
neuper@42394
|
306 |
curry_arg = NONE;
|
neuper@42394
|
307 |
term2str res = "??.empty"; (* scrstate before starting interpretation *)
|
neuper@48790
|
308 |
(*term2str (go loc_ sc) = "Prog Solve_linear e_e v_v = ...*)
|
neuper@42394
|
309 |
|
neuper@42394
|
310 |
val (p,_,f,nxt,_,pt) = me nxt p'''' [] pt''''; (*-------------------------------------------*)
|
neuper@42394
|
311 |
val (p'''', pt'''') = (p, pt);
|
wneuper@59253
|
312 |
f2str f = "x = 0 + -1 * -1";
|
wneuper@59253
|
313 |
case snd nxt of Rewrite_Set "Test_simplify" => () | _ => error "CHANGED";
|
neuper@42394
|
314 |
val (p, p_) = p(* = ([3, 1], Res)*);
|
neuper@48790
|
315 |
val (srls, (ScrState scrstate, ctxt), Prog sc) = from_pblobj_or_detail' "Isac" (p, p_) pt;
|
neuper@42394
|
316 |
val (env, loc_, curry_arg, res, Safe, true) = scrstate;
|
neuper@42394
|
317 |
env2str env = "[\"\n(e_e, -1 + x = 0)\",\"\n(v_v, x)\"]";
|
neuper@42394
|
318 |
loc_ = [R, L, R, L, R, L, R];
|
neuper@42394
|
319 |
curry_arg = SOME (str2term "e_e::bool");
|
neuper@42394
|
320 |
term2str res = "x = 0 + -1 * -1";(* scrstate after isolate_bdv, before Test_simplify *)
|
wneuper@59497
|
321 |
term2str (go loc_ sc) = "Rewrite_Set_Inst [(''bdv'', v_v)] isolate_bdv False";
|
neuper@42394
|
322 |
|
neuper@42438
|
323 |
"----------- fun sel_rules ---------------------------------------";
|
neuper@42438
|
324 |
"----------- fun sel_rules ---------------------------------------";
|
neuper@42438
|
325 |
"----------- fun sel_rules ---------------------------------------";
|
neuper@42438
|
326 |
(* compare test/../interface.sml
|
neuper@42438
|
327 |
"--------- getTactic, fetchApplicableTactics ------------";
|
neuper@42438
|
328 |
*)
|
s1210629013@55445
|
329 |
reset_states ();
|
neuper@42438
|
330 |
CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"],
|
neuper@42438
|
331 |
("Test", ["sqroot-test","univariate","equation","test"],
|
neuper@42438
|
332 |
["Test","squ-equ-test-subpbl1"]))];
|
neuper@42438
|
333 |
Iterator 1;
|
neuper@42438
|
334 |
moveActiveRoot 1;
|
wneuper@59248
|
335 |
autoCalculate 1 CompleteCalc;
|
neuper@42438
|
336 |
val ((pt,_),_) = get_calc 1;
|
neuper@42438
|
337 |
show_pt pt;
|
neuper@42394
|
338 |
|
neuper@42438
|
339 |
(*UC\label{SOLVE:MANUAL:TACTIC:listall} UC 30.3.2.2 p.175*)
|
neuper@42438
|
340 |
val tacs = sel_rules pt ([],Pbl);
|
wneuper@59253
|
341 |
case tacs of [Apply_Method ["Test", "squ-equ-test-subpbl1"]] => ()
|
wneuper@59253
|
342 |
| _ => error "script.sml: diff.behav. in sel_rules ([],Pbl)";
|
neuper@42438
|
343 |
|
neuper@42438
|
344 |
val tacs = sel_rules pt ([1],Res);
|
wneuper@59253
|
345 |
case tacs of [Rewrite_Set "norm_equation", Rewrite_Set "Test_simplify",
|
neuper@55279
|
346 |
Subproblem ("Test", ["LINEAR", "univariate", "equation", "test"]),
|
wneuper@59253
|
347 |
Check_elementwise "Assumptions"] => ()
|
wneuper@59253
|
348 |
| _ => error "script.sml: diff.behav. in sel_rules ([1],Res)";
|
neuper@42438
|
349 |
|
neuper@42438
|
350 |
val tacs = sel_rules pt ([3],Pbl);
|
wneuper@59253
|
351 |
case tacs of [Apply_Method ["Test", "solve_linear"]] => ()
|
wneuper@59253
|
352 |
| _ => error "script.sml: diff.behav. in sel_rules ([3],Pbl)";
|
neuper@42438
|
353 |
|
neuper@42438
|
354 |
val tacs = sel_rules pt ([3,1],Res);
|
wneuper@59497
|
355 |
case tacs of [Rewrite_Set_Inst (["(''bdv'', x)"], "isolate_bdv"), Rewrite_Set "Test_simplify"] => ()
|
wneuper@59253
|
356 |
| _ => error "script.sml: diff.behav. in sel_rules ([3,1],Res)";
|
neuper@42438
|
357 |
|
neuper@42438
|
358 |
val tacs = sel_rules pt ([3],Res);
|
wneuper@59253
|
359 |
case tacs of [Rewrite_Set "norm_equation", Rewrite_Set "Test_simplify",
|
neuper@55279
|
360 |
Subproblem ("Test", ["LINEAR", "univariate", "equation", "test"]),
|
wneuper@59253
|
361 |
Check_elementwise "Assumptions"] => ()
|
wneuper@59253
|
362 |
| _ => error "script.sml: diff.behav. in sel_rules ([3],Res)";
|
neuper@42438
|
363 |
|
neuper@42438
|
364 |
val tacs = (sel_rules pt ([],Res)) handle PTREE str => [Tac str];
|
wneuper@59253
|
365 |
case tacs of [Tac "no tactics applicable at the end of a calculation"] => ()
|
wneuper@59253
|
366 |
| _ => error "script.sml: diff.behav. in sel_rules ([],Res)";
|
neuper@42438
|
367 |
|
neuper@42438
|
368 |
"----------- fun sel_appl_atomic_tacs ----------------------------";
|
neuper@42438
|
369 |
"----------- fun sel_appl_atomic_tacs ----------------------------";
|
neuper@42438
|
370 |
"----------- fun sel_appl_atomic_tacs ----------------------------";
|
s1210629013@55445
|
371 |
reset_states ();
|
neuper@42438
|
372 |
CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"],
|
neuper@42438
|
373 |
("Test", ["sqroot-test","univariate","equation","test"],
|
neuper@42438
|
374 |
["Test","squ-equ-test-subpbl1"]))];
|
neuper@42438
|
375 |
Iterator 1;
|
neuper@42438
|
376 |
moveActiveRoot 1;
|
wneuper@59248
|
377 |
autoCalculate 1 CompleteCalc;
|
neuper@42438
|
378 |
|
neuper@42438
|
379 |
(*UC\label{SOLVE:MANUAL:TACTIC:listall} UC 30.3.2.2 p.175*)
|
neuper@42438
|
380 |
fetchApplicableTactics 1 99999 ([],Pbl);
|
neuper@42438
|
381 |
|
neuper@42438
|
382 |
fetchApplicableTactics 1 99999 ([1],Res);
|
neuper@42438
|
383 |
"~~~~~ fun fetchApplicableTactics, args:"; val (cI, (scope:int), (p:pos')) = (1, 99999, ([1],Res));
|
neuper@42438
|
384 |
val ((pt, _), _) = get_calc cI;
|
neuper@42438
|
385 |
(*version 1:*)
|
wneuper@59253
|
386 |
case sel_rules pt p of [Rewrite_Set "norm_equation", Rewrite_Set "Test_simplify",
|
neuper@55279
|
387 |
Subproblem ("Test", ["LINEAR", "univariate", "equation", "test"]),
|
wneuper@59253
|
388 |
Check_elementwise "Assumptions"] => ()
|
wneuper@59253
|
389 |
| _ => error "fetchApplicableTactics ([1],Res) changed";
|
neuper@42438
|
390 |
(*version 2:*)
|
neuper@42438
|
391 |
(*WAS:
|
neuper@42438
|
392 |
sel_appl_atomic_tacs pt p;
|
neuper@42438
|
393 |
...
|
neuper@55279
|
394 |
### atomic_appl_tacs: not impl. for tac='Subproblem(Test,["LINEAR","univariate","equation","test"])'
|
neuper@42438
|
395 |
### atomic_appl_tacs: not impl. for tac = 'Check_elementwise "Assumptions"'
|
neuper@42438
|
396 |
*)
|
neuper@42438
|
397 |
|
neuper@42438
|
398 |
"~~~~~ fun sel_appl_atomic_tacs, args:"; val (pt, (p,p_)) = (pt, p);
|
neuper@42438
|
399 |
is_spec_pos p_ = false;
|
neuper@42438
|
400 |
val pp = par_pblobj pt p
|
neuper@42438
|
401 |
val thy' = (get_obj g_domID pt pp):theory'
|
neuper@42438
|
402 |
val thy = assoc_thy thy'
|
neuper@42438
|
403 |
val metID = get_obj g_metID pt pp
|
neuper@42438
|
404 |
val metID' =
|
neuper@42438
|
405 |
if metID = e_metID
|
neuper@42438
|
406 |
then (thd3 o snd3) (get_obj g_origin pt pp)
|
neuper@42438
|
407 |
else metID
|
neuper@48790
|
408 |
val {scr=Prog sc,srls,erls,rew_ord'=ro,...} = get_met metID'
|
neuper@42438
|
409 |
val ScrState (env,_,a,v,_,_) = get_istate pt (p,p_)
|
neuper@42438
|
410 |
val alltacs = (*we expect at least 1 stac in a script*)
|
neuper@42438
|
411 |
map ((stac2tac pt thy) o rep_stacexpr o #2 o
|
neuper@42438
|
412 |
(handle_leaf "selrul" thy' srls env a v)) (stacpbls sc)
|
neuper@42438
|
413 |
val f =
|
neuper@42438
|
414 |
case p_ of
|
neuper@42438
|
415 |
Frm => get_obj g_form pt p
|
wneuper@59257
|
416 |
| Res => (fst o (get_obj g_result pt)) p;
|
neuper@42438
|
417 |
(*WN120611 stopped and took version 1 again for fetchApplicableTactics !
|
neuper@42438
|
418 |
(distinct o flat o (map (atomic_appl_tacs thy ro erls f))) alltacs
|
neuper@42438
|
419 |
...
|
neuper@55279
|
420 |
### atomic_appl_tacs: not impl. for tac='Subproblem(Test,["LINEAR","univariate","equation","test"])'
|
neuper@42438
|
421 |
### atomic_appl_tacs: not impl. for tac = 'Check_elementwise "Assumptions"'
|
neuper@42438
|
422 |
*)
|
neuper@42438
|
423 |
|
wneuper@59257
|
424 |
"----------- fun de_esc_underscore -------------------------------";
|
wneuper@59257
|
425 |
"----------- fun de_esc_underscore -------------------------------";
|
wneuper@59257
|
426 |
"----------- fun de_esc_underscore -------------------------------";
|
wneuper@59257
|
427 |
(*
|
wneuper@59257
|
428 |
> val str = "Rewrite_Set_Inst";
|
wneuper@59257
|
429 |
> val esc = esc_underscore str;
|
wneuper@59257
|
430 |
val it = "Rewrite'_Set'_Inst" : string
|
wneuper@59257
|
431 |
> val des = de_esc_underscore esc;
|
wneuper@59257
|
432 |
val des = de_esc_underscore esc;*)
|
wneuper@59257
|
433 |
|
wneuper@59257
|
434 |
"----------- fun go ----------------------------------------------";
|
wneuper@59257
|
435 |
"----------- fun go ----------------------------------------------";
|
wneuper@59257
|
436 |
"----------- fun go ----------------------------------------------";
|
wneuper@59257
|
437 |
(*
|
wneuper@59257
|
438 |
> val t = (Thm.term_of o the o (parse thy)) "a+b";
|
wneuper@59257
|
439 |
val it = Const (#,#) $ Free (#,#) $ Free ("b","RealDef.real") : term
|
wneuper@59257
|
440 |
> val plus_a = go [L] t;
|
wneuper@59257
|
441 |
> val b = go [R] t;
|
wneuper@59257
|
442 |
> val plus = go [L,L] t;
|
wneuper@59257
|
443 |
> val a = go [L,R] t;
|
wneuper@59257
|
444 |
|
wneuper@59257
|
445 |
> val t = (Thm.term_of o the o (parse thy)) "a+b+c";
|
wneuper@59257
|
446 |
val t = Const (#,#) $ (# $ # $ Free #) $ Free ("c","RealDef.real") : term
|
wneuper@59257
|
447 |
> val pl_pl_a_b = go [L] t;
|
wneuper@59257
|
448 |
> val c = go [R] t;
|
wneuper@59257
|
449 |
> val a = go [L,R,L,R] t;
|
wneuper@59257
|
450 |
> val b = go [L,R,R] t;
|
wneuper@59257
|
451 |
*)
|
wneuper@59257
|
452 |
|
wneuper@59257
|
453 |
"----------- fun formal_args -------------------------------------";
|
wneuper@59257
|
454 |
"----------- fun formal_args -------------------------------------";
|
wneuper@59257
|
455 |
"----------- fun formal_args -------------------------------------";
|
wneuper@59257
|
456 |
(*
|
wneuper@59257
|
457 |
> formal_args scr;
|
wneuper@59257
|
458 |
[Free ("f_","RealDef.real"),Free ("v_","RealDef.real"),
|
wneuper@59257
|
459 |
Free ("eqs_","bool List.list")] : term list
|
wneuper@59257
|
460 |
*)
|
wneuper@59257
|
461 |
"----------- fun dsc_valT ----------------------------------------";
|
wneuper@59257
|
462 |
"----------- fun dsc_valT ----------------------------------------";
|
wneuper@59257
|
463 |
"----------- fun dsc_valT ----------------------------------------";
|
wneuper@59257
|
464 |
(*> val t = (Thm.term_of o the o (parse thy)) "equality";
|
wneuper@59257
|
465 |
> val T = type_of t;
|
wneuper@59257
|
466 |
val T = "bool => Tools.una" : typ
|
wneuper@59257
|
467 |
> val dsc = dsc_valT t;
|
wneuper@59257
|
468 |
val dsc = "una" : string
|
wneuper@59257
|
469 |
|
wneuper@59257
|
470 |
> val t = (Thm.term_of o the o (parse thy)) "fixedValues";
|
wneuper@59257
|
471 |
> val T = type_of t;
|
wneuper@59257
|
472 |
val T = "bool List.list => Tools.nam" : typ
|
wneuper@59257
|
473 |
> val dsc = dsc_valT t;
|
wneuper@59257
|
474 |
val dsc = "nam" : string*)
|
wneuper@59257
|
475 |
"----------- fun itms2args ---------------------------------------";
|
wneuper@59257
|
476 |
"----------- fun itms2args ---------------------------------------";
|
wneuper@59257
|
477 |
"----------- fun itms2args ---------------------------------------";
|
wneuper@59257
|
478 |
(*
|
wneuper@59257
|
479 |
> val sc = ... Solve_root_equation ...
|
wneuper@59257
|
480 |
> val mI = ("Script","sqrt-equ-test");
|
wneuper@59257
|
481 |
> val PblObj{meth={ppc=itms,...},...} = get_obj I pt [];
|
wneuper@59257
|
482 |
> val ts = itms2args thy mI itms;
|
wneuper@59257
|
483 |
> map (term_to_string''' thy) ts;
|
wneuper@59257
|
484 |
["sqrt (#9 + #4 * x) = sqrt x + sqrt (#5 + x)","x","#0"] : string list
|
wneuper@59257
|
485 |
*)
|
wneuper@59257
|
486 |
"----------- fun rep_tac_ ----------------------------------------";
|
wneuper@59257
|
487 |
"----------- fun rep_tac_ ----------------------------------------";
|
wneuper@59257
|
488 |
"----------- fun rep_tac_ ----------------------------------------";
|
wneuper@59257
|
489 |
(***************fun rep_tac_ (Rewrite_Inst' (thy', rod, rls, put, subs, (thmID, _), f, (f', _))) =
|
wneuper@59257
|
490 |
Fehlersuche 25.4.01
|
wneuper@59257
|
491 |
(a)----- als String zusammensetzen:
|
wneuper@59257
|
492 |
ML> term2str f;
|
wneuper@59257
|
493 |
val it = "d_d x #4 + d_d x (x ^^^ #2 + #3 * x)" : string
|
wneuper@59257
|
494 |
ML> term2str f';
|
wneuper@59257
|
495 |
val it = "#0 + d_d x (x ^^^ #2 + #3 * x)" : string
|
wneuper@59257
|
496 |
ML> subs;
|
wneuper@59257
|
497 |
val it = [(Free ("bdv","RealDef.real"),Free ("x","RealDef.real"))] : subst
|
wneuper@59257
|
498 |
> val tt = (Thm.term_of o the o (parse thy))
|
wneuper@59497
|
499 |
"(Rewrite_Inst[(''bdv'',x)]diff_const False(d_d x #4 + d_d x (x ^^^ #2 + #3 * x)))=(#0 + d_d x (x ^^^ #2 + #3 * x))";
|
wneuper@59257
|
500 |
> atomty tt;
|
wneuper@59257
|
501 |
ML> tracing (term2str tt);
|
wneuper@59497
|
502 |
(Rewrite_Inst [(''bdv'',x)] diff_const False d_d x #4 + d_d x (x ^^^ #2 + #3 * x)) =
|
wneuper@59257
|
503 |
#0 + d_d x (x ^^^ #2 + #3 * x)
|
wneuper@59257
|
504 |
|
wneuper@59257
|
505 |
(b)----- laut rep_tac_:
|
wneuper@59257
|
506 |
> val ttt=HOLogic.mk_eq (lhs,f');
|
wneuper@59257
|
507 |
> atomty ttt;
|
wneuper@59257
|
508 |
|
wneuper@59257
|
509 |
|
wneuper@59257
|
510 |
(*Fehlersuche 1-2Monate vor 4.01:*)
|
wneuper@59257
|
511 |
> val tt = (Thm.term_of o the o (parse thy))
|
wneuper@59497
|
512 |
"Rewrite_Inst[(''bdv'',x)]square_equation_left True(x=#1+#2)";
|
wneuper@59257
|
513 |
> atomty tt;
|
wneuper@59257
|
514 |
|
wneuper@59257
|
515 |
> val f = (Thm.term_of o the o (parse thy)) "x=#1+#2";
|
wneuper@59257
|
516 |
> val f' = (Thm.term_of o the o (parse thy)) "x=#3";
|
wneuper@59257
|
517 |
> val subs = [((Thm.term_of o the o (parse thy)) "bdv",
|
wneuper@59257
|
518 |
(Thm.term_of o the o (parse thy)) "x")];
|
wneuper@59257
|
519 |
> val sT = (type_of o fst o hd) subs;
|
wneuper@59257
|
520 |
> val subs' = list2isalist (HOLogic.mk_prodT (sT, sT))
|
wneuper@59257
|
521 |
(map HOLogic.mk_prod subs);
|
wneuper@59257
|
522 |
> val sT' = type_of subs';
|
wneuper@59257
|
523 |
> val lhs = Const ("Script.Rewrite'_Inst",[sT',idT,fT,fT] ---> fT)
|
wneuper@59257
|
524 |
$ subs' $ Free (thmID,idT) $ @{term True} $ f;
|
wneuper@59257
|
525 |
> lhs = tt;
|
wneuper@59257
|
526 |
val it = true : bool
|
wneuper@59257
|
527 |
> rep_tac_ (Rewrite_Inst'
|
wneuper@59257
|
528 |
("Script","tless_true","eval_rls",false,subs,
|
wneuper@59257
|
529 |
("square_equation_left",""),f,(f',[])));
|
wneuper@59257
|
530 |
*)
|
wneuper@59257
|
531 |
(****************************| rep_tac_ (Rewrite' (thy', _, _, put, (thmID, _), f, (f', _)))=
|
wneuper@59257
|
532 |
> val tt = (Thm.term_of o the o (parse thy)) (*____ ____..test*)
|
wneuper@59257
|
533 |
"Rewrite square_equation_left True (x=#1+#2) = (x=#3)";
|
wneuper@59257
|
534 |
|
wneuper@59257
|
535 |
> val f = (Thm.term_of o the o (parse thy)) "x=#1+#2";
|
wneuper@59257
|
536 |
> val f' = (Thm.term_of o the o (parse thy)) "x=#3";
|
wneuper@59257
|
537 |
> val Thm (id,thm) =
|
wneuper@59257
|
538 |
rep_tac_ (Rewrite'
|
wneuper@59257
|
539 |
("Script","tless_true","eval_rls",false,
|
wneuper@59257
|
540 |
("square_equation_left",""),f,(f',[])));
|
wneuper@59257
|
541 |
> val SOME ct = parse thy
|
wneuper@59257
|
542 |
"Rewrite square_equation_left True (x=#1+#2)";
|
wneuper@59257
|
543 |
> rewrite_ Script.thy tless_true eval_rls true thm ct;
|
wneuper@59257
|
544 |
val it = SOME ("x = #3",[]) : (cterm * cterm list) option
|
wneuper@59257
|
545 |
*)
|
wneuper@59257
|
546 |
(**************************************** | rep_tac_ (Rewrite_Set_Inst'
|
wneuper@59257
|
547 |
WN050824: type error ...
|
wneuper@59257
|
548 |
let val fT = type_of f;
|
wneuper@59257
|
549 |
val sT = (type_of o fst o hd) subs;
|
wneuper@59257
|
550 |
val subs' = list2isalist (HOLogic.mk_prodT (sT, sT))
|
wneuper@59257
|
551 |
(map HOLogic.mk_prod subs);
|
wneuper@59257
|
552 |
val sT' = type_of subs';
|
wneuper@59257
|
553 |
val b = if put then @{term True} else @{term False}
|
wneuper@59257
|
554 |
val lhs = Const ("Script.Rewrite'_Set'_Inst",
|
wneuper@59257
|
555 |
[sT',idT,fT,fT] ---> fT)
|
wneuper@59257
|
556 |
$ subs' $ Free (id_rls rls,idT) $ b $ f;
|
wneuper@59257
|
557 |
in (((make_rule (assoc_thy thy')) o HOLogic.mk_eq) (lhs,f'),(lhs,f')) end*)
|
wneuper@59257
|
558 |
(* ... vals from Rewrite_Inst' ...
|
wneuper@59257
|
559 |
> rep_tac_ (Rewrite_Set_Inst'
|
wneuper@59257
|
560 |
("Script",false,subs,
|
wneuper@59257
|
561 |
"isolate_bdv",f,(f',[])));
|
wneuper@59257
|
562 |
*)
|
wneuper@59257
|
563 |
(* val (Rewrite_Set' (thy',put,rls,f,(f',asm)))=m;
|
wneuper@59257
|
564 |
*)
|
wneuper@59257
|
565 |
(************************************** | rep_tac_ (Rewrite_Set' (thy',put,rls,f,(f',asm)))=
|
wneuper@59257
|
566 |
13.3.01:
|
wneuper@59257
|
567 |
val thy = assoc_thy thy';
|
wneuper@59257
|
568 |
val t = HOLogic.mk_eq (lhs,f');
|
wneuper@59257
|
569 |
make_rule thy t;
|
wneuper@59257
|
570 |
--------------------------------------------------
|
wneuper@59257
|
571 |
val lll = (Thm.term_of o the o (parse thy))
|
wneuper@59257
|
572 |
"Rewrite_Set SqRoot_simplify False (d_d x (x ^^^ #2 + #3 * x) + d_d x #4)";
|
wneuper@59257
|
573 |
|
wneuper@59257
|
574 |
--------------------------------------------------
|
wneuper@59257
|
575 |
> val f = (Thm.term_of o the o (parse thy)) "x=#1+#2";
|
wneuper@59257
|
576 |
> val f' = (Thm.term_of o the o (parse thy)) "x=#3";
|
wneuper@59257
|
577 |
> val Thm (id,thm) =
|
wneuper@59257
|
578 |
rep_tac_ (Rewrite_Set'
|
wneuper@59257
|
579 |
("Script",false,"SqRoot_simplify",f,(f',[])));
|
wneuper@59257
|
580 |
val id = "(Rewrite_Set SqRoot_simplify True x = #1 + #2) = (x = #3)" : string
|
wneuper@59257
|
581 |
val thm = "(Rewrite_Set SqRoot_simplify True x = #1 + #2) = (x = #3)" : thm
|
wneuper@59257
|
582 |
*)
|
wneuper@59257
|
583 |
(***************************************** | rep_tac_ (Calculate' (thy',op_,f,(f',thm')))=
|
wneuper@59257
|
584 |
> val lhs'=(Thm.term_of o the o (parse thy))"Calculate plus (#1+#2)";
|
wneuper@59257
|
585 |
... test-root-equ.sml: calculate ...
|
wneuper@59257
|
586 |
> val Appl m'=applicable_in p pt (Calculate "PLUS");
|
wneuper@59257
|
587 |
> val (lhs,_)=tac_2etac m';
|
wneuper@59257
|
588 |
> lhs'=lhs;
|
wneuper@59257
|
589 |
val it = true : bool*)
|
wneuper@59539
|
590 |
|
wneuper@59539
|
591 |
"----------- fun init_scrstate -----------------------------------------------------------------";
|
wneuper@59539
|
592 |
"----------- fun init_scrstate -----------------------------------------------------------------";
|
wneuper@59539
|
593 |
"----------- fun init_scrstate -----------------------------------------------------------------";
|
wneuper@59539
|
594 |
val fmz = ["Traegerlaenge L","Streckenlast q_0","Biegelinie y",
|
wneuper@59539
|
595 |
"Randbedingungen [y 0 = 0, y L = 0, M_b 0 = 0, M_b L = 0]",
|
wneuper@59540
|
596 |
"FunktionsVariable x", "GleichungsVariablen [c, c_2, c_3, c_4]",
|
wneuper@59540
|
597 |
"AbleitungBiegelinie dy"];
|
wneuper@59539
|
598 |
val (dI',pI',mI') = ("Biegelinie", ["Biegelinien"],
|
wneuper@59539
|
599 |
["IntegrierenUndKonstanteBestimmen2"]);
|
wneuper@59539
|
600 |
val p = e_pos'; val c = [];
|
wneuper@59539
|
601 |
(*[], Pbl*)val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))]; (*nxt = Model_Problem*)
|
wneuper@59539
|
602 |
(*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; (*nxt = Add_Given "Traegerlaenge L"*)
|
wneuper@59539
|
603 |
(*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; (*nxt = Add_Given "Streckenlast q_0"*)
|
wneuper@59539
|
604 |
(*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; (*nxt = Add_Find "Biegelinie y"*)
|
wneuper@59539
|
605 |
(*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; (*nxt = Add_Relation "Randbedingungen [y 0 = 0]", ERROR MISSING step: M_b 0 = 0*)
|
wneuper@59539
|
606 |
(*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; (*nxt = Add_Relation "Randbedingungen [y L = 0, M_b 0 = 0, M_b L = 0]"*)
|
wneuper@59539
|
607 |
(*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; (*nxt = Specify_Theory "Biegelinie"*)
|
wneuper@59539
|
608 |
(*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; (*nxt = Specify_Problem ["Biegelinien"]*)
|
wneuper@59539
|
609 |
(*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; (*nxt = Specify_Method ["IntegrierenUndKonstanteBestimmen2"]*)
|
wneuper@59539
|
610 |
(*[], Met*)val (p,_,f,nxt,_,pt) = me nxt p c pt; (*nxt = Add_Given "FunktionsVariable x"*)
|
wneuper@59539
|
611 |
(*[], Met*)val (p,_,f,nxt,_,pt) = me nxt p c pt; (*nxt = Add_Given "GleichungsVariablen [c, c_2, c_3, c_4]"*)
|
wneuper@59540
|
612 |
(*[], Met*)val (p,_,f,nxt,_,pt) = me nxt p c pt; (*nxt = Add_Given "AbleitungBiegelinie dy"*)
|
wneuper@59539
|
613 |
(*[], Met*)val (p''''',_,f,nxt''''',_,pt''''') = me nxt p c pt; (*nxt''''' = Apply_Method ["IntegrierenUndKonstanteBestimmen2"*)
|
wneuper@59539
|
614 |
|
wneuper@59539
|
615 |
val PblObj {meth, spec = (thy, _ , metID), ...} = get_obj I pt''''' (fst p''''');
|
wneuper@59539
|
616 |
"~~~~~ fun init_scrstate , args:"; val (thy, itms, metID) = (assoc_thy thy, meth, metID);
|
wneuper@59539
|
617 |
val (ScrState st, ctxt, Prog _) = init_scrstate thy itms metID;
|
wneuper@59539
|
618 |
if scrstate2str st =
|
wneuper@59549
|
619 |
"([\"\n(l, L)\",\"\n(q, q_0)\",\"\n(v, x)\",\"\n(b, dy)\",\"\n(s, [y 0 = 0, y L = 0, M_b 0 = 0, M_b L = 0])\",\"\n(vs, [c, c_2, c_3, c_4])\",\"\n(id_abl, y)\"], [], NONE, \n??.empty, Safe, true)"
|
wneuper@59539
|
620 |
then () else error "init_scrstate changed for Biegelinie";
|
wneuper@59539
|
621 |
|
wneuper@59539
|
622 |
(*[1], Pbl*)val (p,_,f,nxt,_,pt) = me nxt''''' p''''' c pt'''''; (*nxt = Model_Problem*)
|
wneuper@59539
|
623 |
if p = ([1], Pbl) andalso (fst nxt) = "Model_Problem" then ()
|
wneuper@59539
|
624 |
else error "modeling root-problem of Biegelinie 7.70 changed";
|