7 *) |
7 *) |
8 |
8 |
9 signature MATH_ENGINE = |
9 signature MATH_ENGINE = |
10 sig |
10 sig |
11 type NEW (* TODO: refactor "fun me" with calcstate and remove *) |
11 type NEW (* TODO: refactor "fun me" with calcstate and remove *) |
12 val me : Solve.tac'_ -> pos' -> NEW -> ptree -> pos' * NEW * Generate.mout * Solve.tac'_ * safe * ptree |
12 val me : Solve.tac'_ -> Ctree.pos' -> NEW -> Ctree.ptree -> Ctree.pos' * NEW * Generate.mout * Solve.tac'_ * Ctree.safe * Ctree.ptree |
13 val autocalc : |
13 val autocalc : |
14 pos' list -> pos' -> (ptree * pos') * Generate.taci list -> Solve.auto -> string * pos' list * (ptree * pos') |
14 Ctree.pos' list -> Ctree.pos' -> (Ctree.ptree * Ctree.pos') * Generate.taci list -> Solve.auto -> string * Ctree.pos' list * (Ctree.ptree * Ctree.pos') |
15 val locatetac : |
15 val locatetac : |
16 tac -> ptree * (posel list * pos_) -> string * (Generate.taci list * pos' list * (ptree * pos')) |
16 Ctree.tac -> Ctree.ptree * Ctree.pos' -> string * (Generate.taci list * Ctree.pos' list * (Ctree.ptree * Ctree.pos')) |
17 val step : pos' -> Chead.calcstate -> string * Chead.calcstate' |
17 val step : Ctree.pos' -> Chead.calcstate -> string * Chead.calcstate' |
18 val detailstep : |
18 val detailstep : |
19 ptree -> pos' -> string * ptree * pos' val get_pblID : ptree * pos' -> pblID option |
19 Ctree.ptree -> Ctree.pos' -> string * Ctree.ptree * Ctree.pos' |
20 |
20 val get_pblID : Ctree.ptree * Ctree.pos' -> pblID option |
21 val initcontext_met : ptree -> pos' -> bool * string list * scr * itm list * (bool * term) list |
21 |
22 val initcontext_pbl : ptree -> pos' -> bool * string list * term * itm list * (bool * term) list |
22 val initcontext_met : Ctree.ptree -> Ctree.pos' -> bool * string list * scr * itm list * (bool * term) list |
23 val context_met : metID -> ptree -> pos -> bool * metID * scr * itm list * (bool * term) list |
23 val initcontext_pbl : Ctree.ptree -> Ctree.pos' -> bool * string list * term * itm list * (bool * term) list |
24 val context_pbl : pblID -> ptree -> pos -> bool * pblID * term * itm list * (bool * term) list |
24 val context_met : metID -> Ctree.ptree -> Ctree.pos -> bool * metID * scr * itm list * (bool * term) list |
25 val set_method : metID -> ptree * pos' -> ptree * ocalhd |
25 val context_pbl : pblID -> Ctree.ptree -> Ctree.pos -> bool * pblID * term * itm list * (bool * term) list |
26 val set_problem : pblID -> ptree * pos' -> ptree * ocalhd |
26 val set_method : metID -> Ctree.ptree * Ctree.pos' -> Ctree.ptree * Ctree.ocalhd |
27 val set_theory : thyID -> ptree * pos' -> ptree * ocalhd |
27 val set_problem : pblID -> Ctree.ptree * Ctree.pos' -> Ctree.ptree * Ctree.ocalhd |
28 val tryrefine : pblID -> ptree -> pos' -> bool * pblID * term * itm list * (bool * term) list |
28 val set_theory : thyID -> Ctree.ptree * Ctree.pos' -> Ctree.ptree * Ctree.ocalhd |
|
29 val tryrefine : pblID -> Ctree.ptree -> Ctree.pos' -> bool * pblID * term * itm list * (bool * term) list |
29 |
30 |
30 (*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\* ) |
31 (*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\* ) |
31 type nxt_ |
32 type nxt_ |
32 type lOc_ |
33 type lOc_ |
33 val CalcTreeTEST : fmz list -> pos' * NEW * Generate.mout * (string * tac) * safe * ptree |
34 val CalcTreeTEST : Ctree.fmz list -> Ctree.pos' * NEW * Generate.mout * (string * Ctree.tac) * Ctree.safe * Ctree.ptree |
34 val f2str : Generate.mout -> cterm' |
35 val f2str : Generate.mout -> cterm' |
35 val loc_solve_ : string * tac_ -> ptree * (pos * pos_) -> lOc_ |
36 val loc_solve_ : string * Ctree.tac_ -> Ctree.ptree * Ctree.pos' -> lOc_ |
|
37 val loc_specify_ : Ctree.tac_ -> Ctree.ptree * Ctree.pos' -> lOc_ |
36 ( *\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*) |
38 ( *\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*) |
37 end |
39 end |
38 |
40 |
39 (**) |
41 (**) |
40 structure Math_Engine(**): MATH_ENGINE(**) = |
42 structure Math_Engine(**): MATH_ENGINE(**) = |
41 struct |
43 struct |
42 (**) |
44 (**) |
43 |
45 |
44 fun get_pblID (pt, (p, _):pos') = |
46 fun get_pblID (pt, (p, _): Ctree.pos') = |
45 let val p' = par_pblobj pt p |
47 let val p' = Ctree.par_pblobj pt p |
46 val (_, pI, _) = get_obj g_spec pt p' |
48 val (_, pI, _) = Ctree.get_obj Ctree.g_spec pt p' |
47 val (_, (_, oI, _), _) = get_obj g_origin pt p' |
49 val (_, (_, oI, _), _) = Ctree.get_obj Ctree.g_origin pt p' |
48 in |
50 in |
49 if pI <> e_pblID |
51 if pI <> e_pblID |
50 then SOME pI |
52 then SOME pI |
51 else |
53 else |
52 if oI <> e_pblID then SOME oI else NONE end; |
54 if oI <> e_pblID then SOME oI else NONE end; |
53 |
55 |
54 (* introduced for test only *) |
56 (* introduced for test only *) |
55 val e_tac_ = Tac_ (Pure.thy, "", "", ""); |
57 val e_tac_ = Ctree.Tac_ (Pure.thy, "", "", ""); |
56 datatype lOc_ = |
58 datatype lOc_ = |
57 ERror of string (*after loc_specify, loc_solve*) |
59 ERror of string (*after loc_specify, loc_solve*) |
58 | UNsafe of Chead.calcstate' (*after loc_specify, loc_solve*) |
60 | UNsafe of Chead.calcstate' (*after loc_specify, loc_solve*) |
59 | Updated of Chead.calcstate' (*after loc_specify, loc_solve*) |
61 | Updated of Chead.calcstate' (*after loc_specify, loc_solve*) |
60 |
62 |
94 case x of |
96 case x of |
95 ERror _ => ("failure", ([], [], ptp)) |
97 ERror _ => ("failure", ([], [], ptp)) |
96 (*FIXXXXXME: loc_specify_, loc_solve_ TOGETHER with dropping meOLD+detail.sml*) |
98 (*FIXXXXXME: loc_specify_, loc_solve_ TOGETHER with dropping meOLD+detail.sml*) |
97 | UNsafe cs' => ("unsafe-ok", cs') |
99 | UNsafe cs' => ("unsafe-ok", cs') |
98 | Updated (cs' as (_, _, (_, p'))) => (*ev.SEVER.tacs like Begin_Trans*) |
100 | Updated (cs' as (_, _, (_, p'))) => (*ev.SEVER.tacs like Begin_Trans*) |
99 (if p' = ([],Res) then "end-of-calculation" else "ok", cs') |
101 (if p' = ([], Ctree.Res) then "end-of-calculation" else "ok", cs') |
100 (*for SEVER.tacs user to ask ? *) |
102 (*for SEVER.tacs user to ask ? *) |
101 end |
103 end |
102 end |
104 end |
103 |
105 |
104 (* iterated by nxt_me; there (the resulting) ptp dropped |
106 (* iterated by nxt_me; there (the resulting) ptp dropped |
105 may call nxt_solve Apply_Method --- thus evaluated here after solve.sml *) |
107 may call nxt_solve Apply_Method --- thus evaluated here after solve.sml *) |
106 fun nxt_specify_ (ptp as (pt, (p, p_))) = |
108 fun nxt_specify_ (ptp as (pt, (p, p_))) = |
107 let |
109 let |
108 val (pblobj, meth, origin, oris, dI', pI', mI', probl, dI, pI, mI) = |
110 val (pblobj, meth, origin, oris, dI', pI', mI', probl, dI, pI, mI) = |
109 case get_obj I pt p of |
111 case Ctree.get_obj I pt p of |
110 pblobj as (PblObj {meth, origin = origin as (oris, (dI', pI', mI'), _), |
112 pblobj as (Ctree.PblObj {meth, origin = origin as (oris, (dI', pI', mI'), _), |
111 probl, spec = (dI, pI, mI), ...}) => (pblobj, meth, origin, oris, dI', pI', mI', probl, dI, pI, mI) |
113 probl, spec = (dI, pI, mI), ...}) => (pblobj, meth, origin, oris, dI', pI', mI', probl, dI, pI, mI) |
112 | PrfObj _ => error "nxt_specify_: not on PrfObj" |
114 | Ctree.PrfObj _ => error "nxt_specify_: not on PrfObj" |
113 in |
115 in |
114 if just_created_ pblobj (*by Subproblem*) andalso origin <> e_origin |
116 if Ctree.just_created_ pblobj (*by Subproblem*) andalso origin <> Ctree.e_origin |
115 then |
117 then |
116 case mI' of |
118 case mI' of |
117 ["no_met"] => Chead.nxt_specif (Refine_Tacitly pI') (pt, (p, Pbl)) |
119 ["no_met"] => Chead.nxt_specif (Ctree.Refine_Tacitly pI') (pt, (p, Ctree.Pbl)) |
118 | _ => Chead.nxt_specif Model_Problem (pt, (p,Pbl)) |
120 | _ => Chead.nxt_specif Ctree.Model_Problem (pt, (p, Ctree.Pbl)) |
119 else |
121 else |
120 let |
122 let |
121 val cpI = if pI = e_pblID then pI' else pI; |
123 val cpI = if pI = e_pblID then pI' else pI; |
122 val cmI = if mI = e_metID then mI' else mI; |
124 val cmI = if mI = e_metID then mI' else mI; |
123 val {ppc, prls, where_, ...} = Specify.get_pbt cpI; |
125 val {ppc, prls, where_, ...} = Specify.get_pbt cpI; |
126 (*FIXME.WN0308: ~~~~~: just check true in itms of pbl/met?*) |
128 (*FIXME.WN0308: ~~~~~: just check true in itms of pbl/met?*) |
127 val (_, tac) = |
129 val (_, tac) = |
128 Chead.nxt_spec p_ pb oris (dI', pI', mI') (probl, meth) (ppc, (#ppc o Specify.get_met) cmI) (dI, pI, mI) |
130 Chead.nxt_spec p_ pb oris (dI', pI', mI') (probl, meth) (ppc, (#ppc o Specify.get_met) cmI) (dI, pI, mI) |
129 in |
131 in |
130 case tac of |
132 case tac of |
131 Apply_Method mI => |
133 Ctree.Apply_Method mI => |
132 Solve.nxt_solv (Apply_Method' (mI, NONE, e_istate, e_ctxt)) (e_istate, e_ctxt) ptp |
134 Solve.nxt_solv (Ctree.Apply_Method' (mI, NONE, Ctree.e_istate, Ctree.e_ctxt)) (Ctree.e_istate, Ctree.e_ctxt) ptp |
133 | _ => Chead.nxt_specif tac ptp |
135 | _ => Chead.nxt_specif tac ptp |
134 end |
136 end |
135 end |
137 end |
136 |
138 |
137 (* specify a new method; WN0512 impl.incomplete, see 'nxt_specif (Specify_Method ' *) |
139 (* specify a new method; WN0512 impl.incomplete, see 'nxt_specif (Specify_Method ' *) |
138 fun set_method (mI:metID) ptp = |
140 fun set_method mI ptp = |
139 let |
141 let |
140 val (mits, pt, p) = |
142 val (mits, pt, p) = |
141 case Chead.nxt_specif (Specify_Method mI) ptp of |
143 case Chead.nxt_specif (Ctree.Specify_Method mI) ptp of |
142 ([(_, Specify_Method' (_, _, mits), _)], [], (pt, (p,_))) => (mits, pt, p) |
144 ([(_, Ctree.Specify_Method' (_, _, mits), _)], [], (pt, (p,_))) => (mits, pt, p) |
143 | _ => error "set_method: case 1 uncovered" |
145 | _ => error "set_method: case 1 uncovered" |
144 val pre = [] (*...from Specify_Method'*) |
146 val pre = [] (*...from Specify_Method'*) |
145 val complete = true (*...from Specify_Method'*) |
147 val complete = true (*...from Specify_Method'*) |
146 (*from Specify_Method' ? vvv, vvv ?*) |
148 (*from Specify_Method' ? vvv, vvv ?*) |
147 val (hdf, spec) = |
149 val (hdf, spec) = |
148 case get_obj I pt p of |
150 case Ctree.get_obj I pt p of |
149 PblObj {origin = (_, _, hdf), spec, ...} => (hdf, spec) |
151 Ctree.PblObj {origin = (_, _, hdf), spec, ...} => (hdf, spec) |
150 | PrfObj _ => error "set_method: case 2 uncovered" |
152 | Ctree.PrfObj _ => error "set_method: case 2 uncovered" |
151 in |
153 in |
152 (pt, (complete, Met, hdf, mits, pre, spec) : ocalhd) |
154 (pt, (complete, Ctree.Met, hdf, mits, pre, spec) : Ctree.ocalhd) |
153 end |
155 end |
154 |
156 |
155 (* specify a new problem; WN0512 impl.incomplete, see 'nxt_specif (Specify_Problem ' *) |
157 (* specify a new problem; WN0512 impl.incomplete, see 'nxt_specif (Specify_Problem ' *) |
156 fun set_problem pI (ptp: ptree * pos') = |
158 fun set_problem pI ptp = |
157 let |
159 let |
158 val (complete, pits, pre, pt, p) = |
160 val (complete, pits, pre, pt, p) = |
159 case Chead.nxt_specif (Specify_Problem pI) ptp of |
161 case Chead.nxt_specif (Ctree.Specify_Problem pI) ptp of |
160 ([(_, Specify_Problem' (_, (complete, (pits, pre))),_)], _, (pt, (p,_))) |
162 ([(_, Ctree.Specify_Problem' (_, (complete, (pits, pre))),_)], _, (pt, (p,_))) |
161 => (complete, pits, pre, pt, p) |
163 => (complete, pits, pre, pt, p) |
162 | _ => error "set_problem: case 1 uncovered" |
164 | _ => error "set_problem: case 1 uncovered" |
163 (*from Specify_Problem' ? vvv, vvv ?*) |
165 (*from Specify_Problem' ? vvv, vvv ?*) |
164 val (hdf, spec) = |
166 val (hdf, spec) = |
165 case get_obj I pt p of |
167 case Ctree.get_obj I pt p of |
166 PblObj {origin = (_, _, hdf), spec, ...} => (hdf, spec) |
168 Ctree.PblObj {origin = (_, _, hdf), spec, ...} => (hdf, spec) |
167 | PrfObj _ => error "set_problem: case 2 uncovered" |
169 | Ctree.PrfObj _ => error "set_problem: case 2 uncovered" |
168 in |
170 in |
169 (pt, (complete, Pbl, hdf, pits, pre, spec) : ocalhd) |
171 (pt, (complete, Ctree.Pbl, hdf, pits, pre, spec) : Ctree.ocalhd) |
170 end |
172 end |
171 |
173 |
172 fun set_theory (tI:thyID) (ptp: ptree * pos') = |
174 fun set_theory tI ptp = |
173 let |
175 let |
174 val (complete, pits, pre, pt, p) = |
176 val (complete, pits, pre, pt, p) = |
175 case Chead.nxt_specif (Specify_Theory tI) ptp of |
177 case Chead.nxt_specif (Ctree.Specify_Theory tI) ptp of |
176 ([(_, Specify_Problem' (_, (complete, (pits, pre))), _)], _, (pt, (p, _))) |
178 ([(_, Ctree.Specify_Problem' (_, (complete, (pits, pre))), _)], _, (pt, (p, _))) |
177 => (complete, pits, pre, pt, p) |
179 => (complete, pits, pre, pt, p) |
178 | _ => error "set_theory: case 1 uncovered" |
180 | _ => error "set_theory: case 1 uncovered" |
179 (*from Specify_Theory' ? vvv, vvv ?*) |
181 (*from Specify_Theory' ? vvv, vvv ?*) |
180 val (hdf, spec) = |
182 val (hdf, spec) = |
181 case get_obj I pt p of |
183 case Ctree.get_obj I pt p of |
182 PblObj {origin = (_, _, hdf), spec, ...} => (hdf, spec) |
184 Ctree.PblObj {origin = (_, _, hdf), spec, ...} => (hdf, spec) |
183 | PrfObj _ => error "set_theory: case 2 uncovered" |
185 | Ctree.PrfObj _ => error "set_theory: case 2 uncovered" |
184 in (pt, (complete, Pbl, hdf, pits, pre, spec) : ocalhd) end; |
186 in (pt, (complete, Ctree.Pbl, hdf, pits, pre, spec) : Ctree.ocalhd) end; |
185 |
187 |
186 (* does a step forward; returns tactic used, ctree updated. |
188 (* does a step forward; returns tactic used, ctree updated. |
187 TODO.WN0512 redesign after specify-phase became more separated from solve-phase *) |
189 TODO.WN0512 redesign after specify-phase became more separated from solve-phase *) |
188 fun step ((ip as (_,p_)):pos') ((ptp as (pt,p), tacis): Chead.calcstate) = |
190 fun step (ip as (_, p_)) (ptp as (pt,p), tacis) = |
189 let val pIopt = get_pblID (pt,ip); |
191 let val pIopt = get_pblID (pt,ip); |
190 in |
192 in |
191 if ip = ([],Res) |
193 if ip = ([], Ctree.Res) |
192 then ("end-of-calculation", (tacis, [], ptp): Chead.calcstate') |
194 then ("end-of-calculation", (tacis, [], ptp): Chead.calcstate') |
193 else |
195 else |
194 case tacis of |
196 case tacis of |
195 (_::_) => |
197 (_::_) => |
196 if ip = p (*the request is done where ptp waits for*) |
198 if ip = p (*the request is done where ptp waits for*) |
197 then |
199 then |
198 let val (pt',c',p') = Generate.generate tacis (pt,[],p) |
200 let val (pt',c',p') = Generate.generate tacis (pt,[],p) |
199 in ("ok", (tacis, c', (pt', p'))) end |
201 in ("ok", (tacis, c', (pt', p'))) end |
200 else (case (if member op = [Pbl, Met] p_ |
202 else (case (if member op = [Ctree.Pbl, Ctree.Met] p_ |
201 then nxt_specify_ (pt, ip) else Solve.nxt_solve_ (pt, ip)) |
203 then nxt_specify_ (pt, ip) else Solve.nxt_solve_ (pt, ip)) |
202 handle ERROR msg => (writeln ("*** " ^ msg); |
204 handle ERROR msg => (writeln ("*** " ^ msg); |
203 ([], [], ptp)) (*e.g. Add_Given "equality///"*) of |
205 ([], [], ptp)) (*e.g. Add_Given "equality///"*) of |
204 cs as ([],_,_) => ("helpless", cs) |
206 cs as ([],_,_) => ("helpless", cs) |
205 | cs => ("ok", cs)) |
207 | cs => ("ok", cs)) |
206 | _ => (case pIopt of |
208 | _ => (case pIopt of |
207 NONE => ("no-fmz-spec", ([], [], ptp)) |
209 NONE => ("no-fmz-spec", ([], [], ptp)) |
208 | SOME _ => (*vvvvvv: Apply_Method without init_form*) |
210 | SOME _ => (*vvvvvv: Apply_Method without init_form*) |
209 (case if member op = [Pbl,Met] p_ andalso is_none (get_obj g_env pt (fst p)) |
211 (case if member op = [Ctree.Pbl, Ctree.Met] p_ andalso is_none (Ctree.get_obj Ctree.g_env pt (fst p)) |
210 then nxt_specify_ (pt, ip) |
212 then nxt_specify_ (pt, ip) |
211 else (Solve.nxt_solve_ (pt,ip)) |
213 else (Solve.nxt_solve_ (pt,ip)) |
212 handle ERROR msg => (writeln ("*** " ^ msg); |
214 handle ERROR msg => (writeln ("*** " ^ msg); |
213 ([],[],ptp)) (*e.g. Add_Given "equality///"*) of |
215 ([],[],ptp)) (*e.g. Add_Given "equality///"*) of |
214 cs as ([],_,_) =>("helpless", cs) (*FIXXME del.handle*) |
216 cs as ([],_,_) =>("helpless", cs) (*FIXXME del.handle*) |
286 end |
288 end |
287 |
289 |
288 fun initcontext_met pt (p,_) = |
290 fun initcontext_met pt (p,_) = |
289 let |
291 let |
290 val (meth, os, mI, mI') = |
292 val (meth, os, mI, mI') = |
291 case get_obj I pt p of |
293 case Ctree.get_obj I pt p of |
292 PblObj {meth, origin = (os, (_, _, mI), _), spec=(_, _, mI'), ...} => (meth, os, mI, mI') |
294 Ctree.PblObj {meth, origin = (os, (_, _, mI), _), spec=(_, _, mI'), ...} => (meth, os, mI, mI') |
293 | PrfObj _ => error "initcontext_met: uncovered case" |
295 | Ctree.PrfObj _ => error "initcontext_met: uncovered case" |
294 val metID = if mI' = e_metID |
296 val metID = if mI' = e_metID |
295 then (*TODO.WN051125 (#init o get_pbt) pI *) takelast (2, mI) |
297 then (*TODO.WN051125 (#init o get_pbt) pI *) takelast (2, mI) |
296 else mI' |
298 else mI' |
297 val {ppc, pre, prls, scr, ...} = Specify.get_met metID |
299 val {ppc, pre, prls, scr, ...} = Specify.get_met metID |
298 val (model_ok, (pbl, pre)) = Specify.match_itms_oris (assoc_thy "Isac") meth (ppc,pre,prls) os |
300 val (model_ok, (pbl, pre)) = Specify.match_itms_oris (assoc_thy "Isac") meth (ppc,pre,prls) os |
299 in |
301 in |
300 (model_ok, metID, scr, pbl, pre) |
302 (model_ok, metID, scr, pbl, pre) |
301 end |
303 end |
302 |
304 |
303 (* match the model of a problem at pos p with the model-pattern of the problem with pblID *) |
305 (* match the model of a problem at pos p with the model-pattern of the problem with pblID *) |
304 fun context_pbl pI pt (p:pos) = |
306 fun context_pbl pI pt p = |
305 let |
307 let |
306 val (probl, os, hdl) = |
308 val (probl, os, hdl) = |
307 case get_obj I pt p of |
309 case Ctree.get_obj I pt p of |
308 PblObj {probl,origin = (os, _, hdl),...} => (probl, os, hdl) |
310 Ctree.PblObj {probl,origin = (os, _, hdl),...} => (probl, os, hdl) |
309 | PrfObj _ => error "context_pbl: uncovered case" |
311 | Ctree.PrfObj _ => error "context_pbl: uncovered case" |
310 val {ppc,where_,prls,...} = Specify.get_pbt pI |
312 val {ppc,where_,prls,...} = Specify.get_pbt pI |
311 val (model_ok, (pbl, pre)) = Specify.match_itms_oris (assoc_thy "Isac") probl (ppc,where_,prls) os |
313 val (model_ok, (pbl, pre)) = Specify.match_itms_oris (assoc_thy "Isac") probl (ppc,where_,prls) os |
312 in |
314 in |
313 (model_ok, pI, hdl, pbl, pre) |
315 (model_ok, pI, hdl, pbl, pre) |
314 end |
316 end |
315 |
317 |
316 fun context_met mI pt (p:pos) = |
318 fun context_met mI pt p = |
317 let |
319 let |
318 val (meth, os) = |
320 val (meth, os) = |
319 case get_obj I pt p of |
321 case Ctree.get_obj I pt p of |
320 PblObj {meth, origin = (os, _, _),...} => (meth, os) |
322 Ctree.PblObj {meth, origin = (os, _, _),...} => (meth, os) |
321 | PrfObj _ => error "context_met: uncovered case" |
323 | Ctree.PrfObj _ => error "context_met: uncovered case" |
322 val {ppc,pre,prls,scr,...} = Specify.get_met mI |
324 val {ppc,pre,prls,scr,...} = Specify.get_met mI |
323 val (model_ok, (pbl, pre)) = Specify.match_itms_oris (assoc_thy "Isac") meth (ppc,pre,prls) os |
325 val (model_ok, (pbl, pre)) = Specify.match_itms_oris (assoc_thy "Isac") meth (ppc,pre,prls) os |
324 in |
326 in |
325 (model_ok, mI, scr, pbl, pre) |
327 (model_ok, mI, scr, pbl, pre) |
326 end |
328 end |
327 |
329 |
328 fun tryrefine pI pt (p,_) = |
330 fun tryrefine pI pt (p,_) = |
329 let |
331 let |
330 val (probl, os, hdl) = |
332 val (probl, os, hdl) = |
331 case get_obj I pt p of |
333 case Ctree.get_obj I pt p of |
332 PblObj {probl, origin = (os, _, hdl), ...} => (probl, os, hdl) |
334 Ctree.PblObj {probl, origin = (os, _, hdl), ...} => (probl, os, hdl) |
333 | PrfObj _ => error "context_met: uncovered case" |
335 | Ctree.PrfObj _ => error "context_met: uncovered case" |
334 in |
336 in |
335 case Specify.refine_pbl (assoc_thy "Isac") pI probl of |
337 case Specify.refine_pbl (assoc_thy "Isac") pI probl of |
336 NONE => (*copy from context_pbl*) |
338 NONE => (*copy from context_pbl*) |
337 let |
339 let |
338 val {ppc,where_,prls,...} = Specify.get_pbt pI |
340 val {ppc,where_,prls,...} = Specify.get_pbt pI |
404 | ("not-applicable",_) => (pt, p) |
406 | ("not-applicable",_) => (pt, p) |
405 | ("end-of-calculation", (_, _, ptp)) => ptp |
407 | ("end-of-calculation", (_, _, ptp)) => ptp |
406 | ("failure", _) => error "sys-error" |
408 | ("failure", _) => error "sys-error" |
407 | _ => error "me: uncovered case" |
409 | _ => error "me: uncovered case" |
408 val (_, ts) = |
410 val (_, ts) = |
409 (case step p ((pt, e_pos'),[]) of |
411 (case step p ((pt, Ctree.e_pos'),[]) of |
410 ("ok", (ts as (_, _, _) :: _, _, _)) => ("", ts) |
412 ("ok", (ts as (_, _, _) :: _, _, _)) => ("", ts) |
411 | ("helpless", _) => ("helpless: cannot propose tac", []) |
413 | ("helpless", _) => ("helpless: cannot propose tac", []) |
412 | ("no-fmz-spec", _) => error "no-fmz-spec" |
414 | ("no-fmz-spec", _) => error "no-fmz-spec" |
413 | ("end-of-calculation", (ts, _, _)) => ("", ts) |
415 | ("end-of-calculation", (ts, _, _)) => ("", ts) |
414 | _ => error "me: uncovered case") |
416 | _ => error "me: uncovered case") |
415 handle ERROR msg => raise ERROR msg |
417 handle ERROR msg => raise ERROR msg |
416 val tac = |
418 val tac = |
417 case ts of |
419 case ts of |
418 tacis as (_::_) => let val (tac, _, _) = last_elem tacis in tac end |
420 tacis as (_::_) => let val (tac, _, _) = last_elem tacis in tac end |
419 | _ => if p = ([], Res) then End_Proof' else Empty_Tac; |
421 | _ => if p = ([], Ctree.Res) then Ctree.End_Proof' else Ctree.Empty_Tac; |
420 in (p, [] : NEW, TESTg_form (pt, p) (* form output comes from locatetac *), |
422 in (p, [] : NEW, TESTg_form (pt, p) (* form output comes from locatetac *), |
421 (tac2IDstr tac, tac): Solve.tac'_, Sundef, pt) |
423 (Ctree.tac2IDstr tac, tac), Ctree.Sundef, pt) |
422 end |
424 end |
423 |
425 |
424 (* for quick test-print-out, until 'type inout' is removed *) |
426 (* for quick test-print-out, until 'type inout' is removed *) |
425 fun f2str (Generate.FormKF cterm') = cterm'; |
427 fun f2str (Generate.FormKF cterm') = cterm'; |
426 |
428 |