160 val {ppc,...} = get_pbt pI |
160 val {ppc,...} = get_pbt pI |
161 val its_ = map (dtss2itm_ ppc) dtss (*([1],true,"#Given",Cor (...))*) |
161 val its_ = map (dtss2itm_ ppc) dtss (*([1],true,"#Given",Cor (...))*) |
162 val its = add_id its_ |
162 val its = add_id its_ |
163 val pits = map flattup2 its |
163 val pits = map flattup2 its |
164 val (pI, mI) = if mI <> ["no_met"] then (pI, mI) |
164 val (pI, mI) = if mI <> ["no_met"] then (pI, mI) |
165 else let val Some (pI,_) = refine_pbl thy pI pits |
165 else let val SOME (pI,_) = refine_pbl thy pI pits |
166 in (pI, (hd o #met o get_pbt) pI) end |
166 in (pI, (hd o #met o get_pbt) pI) end |
167 val {ppc,pre,prls,...} = get_met mI |
167 val {ppc,pre,prls,...} = get_met mI |
168 val its_ = map (dtss2itm_ ppc) dtss (*([1],true,"#Given",Cor (...))*) |
168 val its_ = map (dtss2itm_ ppc) dtss (*([1],true,"#Given",Cor (...))*) |
169 val its = add_id its_ |
169 val its = add_id its_ |
170 val mits = map flattup2 its |
170 val mits = map flattup2 its |
179 val its_ = map (dtss2itm_ ppc) dtss (*([1],true,"#Given",Cor (...))*) |
179 val its_ = map (dtss2itm_ ppc) dtss (*([1],true,"#Given",Cor (...))*) |
180 val its = add_id its_ |
180 val its = add_id its_ |
181 val pits = map flattup2 its |
181 val pits = map flattup2 its |
182 val (pI, mI) = if mI <> ["no_met"] then (pI, mI) |
182 val (pI, mI) = if mI <> ["no_met"] then (pI, mI) |
183 else case refine_pbl thy pI pits of |
183 else case refine_pbl thy pI pits of |
184 Some (pI,_) => (pI, (hd o #met o get_pbt) pI) |
184 SOME (pI,_) => (pI, (hd o #met o get_pbt) pI) |
185 | None => (pI, (hd o #met o get_pbt) pI) |
185 | NONE => (pI, (hd o #met o get_pbt) pI) |
186 val {ppc,pre,prls,...} = get_met mI |
186 val {ppc,pre,prls,...} = get_met mI |
187 val its_ = map (dtss2itm_ ppc) dtss (*([1],true,"#Given",Cor (...))*) |
187 val its_ = map (dtss2itm_ ppc) dtss (*([1],true,"#Given",Cor (...))*) |
188 val its = add_id its_ |
188 val its = add_id its_ |
189 val mits = map flattup2 its |
189 val mits = map flattup2 its |
190 val pre = check_preconds thy prls pre mits |
190 val pre = check_preconds thy prls pre mits |
196 (* val hdt = ifo; |
196 (* val hdt = ifo; |
197 *) |
197 *) |
198 fun cas_input hdt = |
198 fun cas_input hdt = |
199 let val (h,argl) = strip_comb hdt |
199 let val (h,argl) = strip_comb hdt |
200 in case assoc (!castab, h) of |
200 in case assoc (!castab, h) of |
201 None => None |
201 NONE => NONE |
202 (*let val (pt,_) = |
202 (*let val (pt,_) = |
203 cappend_problem e_ptree [] e_istate |
203 cappend_problem e_ptree [] e_istate |
204 ([], e_spec) ([], e_spec, e_term) |
204 ([], e_spec) ([], e_spec, e_term) |
205 in (pt, (false, Pbl, e_term(*FIXXME031:'not found'*), |
205 in (pt, (false, Pbl, e_term(*FIXXME031:'not found'*), |
206 [], [], e_spec)) end*) |
206 [], [], e_spec)) end*) |
207 | Some (spec as (dI,_,_), argl2dtss) => |
207 | SOME (spec as (dI,_,_), argl2dtss) => |
208 (* val Some (spec as (dI,_,_), argl2dtss ) = assoc (!castab, h); |
208 (* val SOME (spec as (dI,_,_), argl2dtss ) = assoc (!castab, h); |
209 *) |
209 *) |
210 let val dtss = argl2dtss argl |
210 let val dtss = argl2dtss argl |
211 val (pI, pits, mI, mits, pre) = cas_input_ spec dtss |
211 val (pI, pits, mI, mits, pre) = cas_input_ spec dtss |
212 val spec = (dI, pI, mI) |
212 val spec = (dI, pI, mI) |
213 val (pt,_) = |
213 val (pt,_) = |
214 cappend_problem e_ptree [] e_istate ([], e_spec) |
214 cappend_problem e_ptree [] e_istate ([], e_spec) |
215 ([], e_spec, hdt) |
215 ([], e_spec, hdt) |
216 val pt = update_spec pt [] spec |
216 val pt = update_spec pt [] spec |
217 val pt = update_pbl pt [] pits |
217 val pt = update_pbl pt [] pits |
218 val pt = update_met pt [] mits |
218 val pt = update_met pt [] mits |
219 in Some (pt, (true, Met, hdt, mits, pre, spec):ocalhd) end |
219 in SOME (pt, (true, Met, hdt, mits, pre, spec):ocalhd) end |
220 end; |
220 end; |
221 |
221 |
222 (*lazy evaluation for Isac.thy*) |
222 (*lazy evaluation for Isac.thy*) |
223 fun Isac _ = assoc_thy "Isac.thy"; |
223 fun Isac _ = assoc_thy "Isac.thy"; |
224 |
224 |
279 *) |
279 *) |
280 fun appl_add' dI oris ppc pbt (sel, ct) = |
280 fun appl_add' dI oris ppc pbt (sel, ct) = |
281 let |
281 let |
282 val thy = assoc_thy dI; |
282 val thy = assoc_thy dI; |
283 in case parse thy ct of |
283 in case parse thy ct of |
284 None => (0,[],false,sel, Syn ct):itm |
284 NONE => (0,[],false,sel, Syn ct):itm |
285 | Some ct => (* val Some ct = parse thy ct; |
285 | SOME ct => (* val SOME ct = parse thy ct; |
286 *) |
286 *) |
287 (case is_known thy sel oris (term_of ct) of |
287 (case is_known thy sel oris (term_of ct) of |
288 (* val ("",ori'(*ts='ct'*), all) = is_known thy sel oris (term_of ct); |
288 (* val ("",ori'(*ts='ct'*), all) = is_known thy sel oris (term_of ct); |
289 *) |
289 *) |
290 ("",ori'(*ts='ct'*), all) => |
290 ("",ori'(*ts='ct'*), all) => |
307 *) |
307 *) |
308 fun eq7 (f, d) (f', (d', _)) = f=f' andalso d=d'; |
308 fun eq7 (f, d) (f', (d', _)) = f=f' andalso d=d'; |
309 fun fstr2itm_ thy pbt (f, str) = |
309 fun fstr2itm_ thy pbt (f, str) = |
310 let val topt = parse thy str |
310 let val topt = parse thy str |
311 in case topt of |
311 in case topt of |
312 None => ([], false, f, Syn str) |
312 NONE => ([], false, f, Syn str) |
313 | Some ct => |
313 | SOME ct => |
314 (* val Some ct = parse thy str; |
314 (* val SOME ct = parse thy str; |
315 *) |
315 *) |
316 let val (d,ts) = ((split_dts thy) o term_of) ct |
316 let val (d,ts) = ((split_dts thy) o term_of) ct |
317 val popt = find_first (eq7 (f,d)) pbt |
317 val popt = find_first (eq7 (f,d)) pbt |
318 in case popt of |
318 in case popt of |
319 None => ([1](*??*), true(*??*), f, Sup (d,ts)) |
319 NONE => ([1](*??*), true(*??*), f, Sup (d,ts)) |
320 | Some (f, (d, id)) => ([1], true, f, Cor ((d,ts), (id, ts))) |
320 | SOME (f, (d, id)) => ([1], true, f, Cor ((d,ts), (id, ts))) |
321 end |
321 end |
322 end; |
322 end; |
323 |
323 |
324 |
324 |
325 (*.input into empty PblObj, i.e. empty fmz+origin (unknown example).*) |
325 (*.input into empty PblObj, i.e. empty fmz+origin (unknown example).*) |
607 (*fo = ifo excluded already in inform*) |
607 (*fo = ifo excluded already in inform*) |
608 fun concat_deriv rew_ord erls rules fo ifo = |
608 fun concat_deriv rew_ord erls rules fo ifo = |
609 let fun derivat ([]:(term * rule * (term * term list)) list) = e_term |
609 let fun derivat ([]:(term * rule * (term * term list)) list) = e_term |
610 | derivat dt = (#1 o #3 o last_elem) dt |
610 | derivat dt = (#1 o #3 o last_elem) dt |
611 fun equal (_,_,(t1, _)) (_,_,(t2, _)) = t1=t2 |
611 fun equal (_,_,(t1, _)) (_,_,(t2, _)) = t1=t2 |
612 val fod = make_deriv (Isac"") erls rules (snd rew_ord) None fo |
612 val fod = make_deriv (Isac"") erls rules (snd rew_ord) NONE fo |
613 val ifod = make_deriv (Isac"") erls rules (snd rew_ord) None ifo |
613 val ifod = make_deriv (Isac"") erls rules (snd rew_ord) NONE ifo |
614 in case (fod, ifod) of |
614 in case (fod, ifod) of |
615 ([], []) => if fo = ifo then (true, []) |
615 ([], []) => if fo = ifo then (true, []) |
616 else (false, []) |
616 else (false, []) |
617 | (fod, []) => if derivat fod = ifo |
617 | (fod, []) => if derivat fod = ifo |
618 then (true, fod) (*ifo is normal form*) |
618 then (true, fod) (*ifo is normal form*) |
677 val cs' as (tacis, c'', ptp) = |
677 val cs' as (tacis, c'', ptp) = |
678 case tacis of |
678 case tacis of |
679 ((Subproblem _, _, _)::_) => |
679 ((Subproblem _, _, _)::_) => |
680 let val ptp as (pt, (p,_)) = all_modspec ptp |
680 let val ptp as (pt, (p,_)) = all_modspec ptp |
681 val mI = get_obj g_metID pt p |
681 val mI = get_obj g_metID pt p |
682 in nxt_solv (Apply_Method' (mI, None, e_istate)) |
682 in nxt_solv (Apply_Method' (mI, NONE, e_istate)) |
683 e_istate ptp end |
683 e_istate ptp end |
684 | _ => cs'; |
684 | _ => cs'; |
685 in compare_step (tacis, c @ c' @ c'', ptp) ifo end |
685 in compare_step (tacis, c @ c' @ c'', ptp) ifo end |
686 end; |
686 end; |
687 (* writeln (trtas2str der); |
687 (* writeln (trtas2str der); |
704 val ((cs as (_, _, ptp as (pt, pos as (p, p_))): calcstate'), istr) = |
704 val ((cs as (_, _, ptp as (pt, pos as (p, p_))): calcstate'), istr) = |
705 (([],[],(pt,p)), (encode ifo)); |
705 (([],[],(pt,p)), (encode ifo)); |
706 *) |
706 *) |
707 fun inform (cs as (_, _, ptp as (pt, pos as (p, p_))): calcstate') istr = |
707 fun inform (cs as (_, _, ptp as (pt, pos as (p, p_))): calcstate') istr = |
708 case parse (assoc_thy "Isac.thy") istr of |
708 case parse (assoc_thy "Isac.thy") istr of |
709 (* val Some ifo = parse (assoc_thy "Isac.thy") istr; |
709 (* val SOME ifo = parse (assoc_thy "Isac.thy") istr; |
710 *) |
710 *) |
711 Some ifo => |
711 SOME ifo => |
712 let val ifo = term_of ifo |
712 let val ifo = term_of ifo |
713 val fo = case p_ of Frm => get_obj g_form pt p |
713 val fo = case p_ of Frm => get_obj g_form pt p |
714 | Res => (fst o (get_obj g_result pt)) p |
714 | Res => (fst o (get_obj g_result pt)) p |
715 | _ => #3 (get_obj g_origin pt p) |
715 | _ => #3 (get_obj g_origin pt p) |
716 in if fo = ifo |
716 in if fo = ifo |
717 then ("same-formula", cs) |
717 then ("same-formula", cs) |
718 (*thus ctree not cut with replaceFormula!*) |
718 (*thus ctree not cut with replaceFormula!*) |
719 else case cas_input ifo of |
719 else case cas_input ifo of |
720 (* val Some (pt, _) = cas_input ifo; |
720 (* val SOME (pt, _) = cas_input ifo; |
721 *) |
721 *) |
722 Some (pt, _) => ("ok",([],[],(pt, (p, Met)))) |
722 SOME (pt, _) => ("ok",([],[],(pt, (p, Met)))) |
723 | None => |
723 | NONE => |
724 compare_step ([],[],(pt, |
724 compare_step ([],[],(pt, |
725 (*last step re-calc in compare_step TODO*) |
725 (*last step re-calc in compare_step TODO*) |
726 lev_back pos)) ifo |
726 lev_back pos)) ifo |
727 end |
727 end |
728 | None => ("syntax error in '"^istr^"'", e_calcstate'); |
728 | NONE => ("syntax error in '"^istr^"'", e_calcstate'); |
729 |
729 |
730 |
730 |
731 (*------------------------------------------------------------------(**) |
731 (*------------------------------------------------------------------(**) |
732 end |
732 end |
733 open inform; |
733 open inform; |