45 Matches of pblID * item ppc |
47 Matches of pblID * item ppc |
46 | NoMatch of pblID * item ppc |
48 | NoMatch of pblID * item ppc |
47 val match2str : match -> string |
49 val match2str : match -> string |
48 datatype |
50 datatype |
49 match_ = |
51 match_ = |
50 Match_ of pblID * (itm list * (bool * Term.term) list) |
52 Match_ of pblID * (itm list * (bool * term) list) |
51 | NoMatch_ |
53 | NoMatch_ |
52 val matchs2str : match list -> string |
54 val matchs2str : match list -> string |
53 type ori |
55 type ori |
54 val ori2str : ori -> string |
56 val ori2str : ori -> string |
55 val oris2str : ori list -> string |
57 val oris2str : ori list -> string |
56 type preori |
58 type preori |
57 val preori2str : preori -> string |
59 val preori2str : preori -> string |
58 val preoris2str : preori list -> string |
60 val preoris2str : preori list -> string |
59 type penv |
61 type penv |
60 (* val penv2str : Theory.theory -> penv -> string *) |
62 (* val penv2str_ : Proof.context -> penv -> string *) |
61 type vats |
63 type vats |
62 (*----------------------------------------------------------------------*) |
64 (*----------------------------------------------------------------------*) |
63 val all_ts_in : itm_ list -> Term.term list |
65 val all_ts_in : itm_ list -> term list |
64 val check_preconds : |
66 val check_preconds : |
65 'a -> |
67 'a -> |
66 rls -> |
68 rls -> |
67 Term.term list -> itm list -> (bool * Term.term) list |
69 term list -> itm list -> (bool * term) list |
68 val check_preconds' : |
70 val check_preconds' : |
69 rls -> |
71 rls -> |
70 Term.term list -> |
72 term list -> |
71 itm list -> 'a -> (bool * Term.term) list |
73 itm list -> 'a -> (bool * term) list |
72 (* val chkpre2item : rls -> Term.term -> bool * item *) |
74 (* val chkpre2item : rls -> term -> bool * item *) |
73 val pres2str : (bool * Term.term) list -> string |
75 val pres2str : (bool * term) list -> string |
74 (* val evalprecond : rls -> Term.term -> bool * Term.term *) |
76 (* val evalprecond : rls -> term -> bool * term *) |
75 (* val cnt : itm list -> int -> int * int *) |
77 (* val cnt : itm list -> int -> int * int *) |
76 val comp_dts : Theory.theory -> Term.term * Term.term list -> Thm.cterm |
78 val comp_dts : theory -> term * term list -> term |
77 val comp_dts' : Term.term * Term.term list -> Term.term |
79 val comp_dts' : term * term list -> term |
78 val comp_dts'' : Term.term * Term.term list -> string |
80 val comp_dts'' : term * term list -> string |
79 val comp_ts : Term.term * Term.term list -> Term.term |
81 val comp_ts : term * term list -> term |
80 val d_in : itm_ -> Term.term |
82 val d_in : itm_ -> term |
81 val de_item : item -> cterm' |
83 val de_item : item -> cterm' |
82 val dest_list : Term.term * Term.term list -> Term.term list (* for testing *) |
84 val dest_list : term * term list -> term list (* for testing *) |
83 val dest_list' : Term.term -> Term.term list |
85 val dest_list' : term -> term list |
84 val dts2str : Term.term * Term.term list -> string |
86 val dts2str : term * term list -> string |
85 val e_itm : itm |
87 val e_itm : itm |
86 (* val e_listBool : Term.term *) |
88 (* val e_listBool : term *) |
87 (* val e_listReal : Term.term *) |
89 (* val e_listReal : term *) |
88 val e_ori : ori |
90 val e_ori : ori |
89 val e_ori_ : ori |
91 val e_ori_ : ori |
90 val empty_ppc : item ppc |
92 val empty_ppc : item ppc |
91 (* val empty_ppc_ct' : cterm' ppc *) |
93 (* val empty_ppc_ct' : cterm' ppc *) |
92 (* val getval : Term.term * Term.term list -> Term.term * Term.term *) |
94 (* val getval : term * term list -> term * term *) |
93 (*val head_precond : |
95 (*val head_precond : |
94 domID * pblID * 'a -> |
96 domID * pblID * 'a -> |
95 Term.term Library.option -> |
97 term option -> |
96 rls -> |
98 rls -> |
97 Term.term list -> |
99 term list -> |
98 itm list -> 'b -> Term.term * (bool * Term.term) list*) |
100 itm list -> 'b -> term * (bool * term) list*) |
99 (* val init_item : string -> item *) |
101 (* val init_item : string -> item *) |
100 (* val is_matches : match -> bool *) |
102 (* val is_matches : match -> bool *) |
101 (* val is_matches_ : match_ -> bool *) |
103 (* val is_matches_ : match_ -> bool *) |
102 val is_var : Term.term -> bool |
104 val is_var : term -> bool |
103 (* val item_ppc : |
105 (* val item_ppc : |
104 string ppc -> item ppc *) |
106 string ppc -> item ppc *) |
105 val itemppc2str : item ppc -> string |
107 val itemppc2str : item ppc -> string |
106 val linefeed : string -> string |
|
107 (* val matches_pblID : match -> pblID *) |
108 (* val matches_pblID : match -> pblID *) |
108 val max2 : ('a * int) list -> 'a * int |
109 val max2 : ('a * int) list -> 'a * int |
109 val max_vt : itm list -> int |
110 val max_vt : itm list -> int |
110 val mk_e : itm_ -> (Term.term * Term.term) list |
111 val mk_e : itm_ -> (term * term) list |
111 val mk_en : int -> itm -> (Term.term * Term.term) list |
112 val mk_en : int -> itm -> (term * term) list |
112 val mk_env : itm list -> (Term.term * Term.term) list |
113 val mk_env : itm list -> (term * term) list |
113 val mkval : 'a -> Term.term list -> Term.term |
114 val mkval : 'a -> term list -> term |
114 val mkval' : Term.term list -> Term.term |
115 val mkval' : term list -> term |
115 (* val pblID_of_match : match -> pblID *) |
116 (* val pblID_of_match : match -> pblID *) |
116 val pbl_ids : Theory.theory -> Term.term -> Term.term -> Term.term list |
117 val pbl_ids : Proof.context -> term -> term -> term list |
117 val pbl_ids' : 'a -> Term.term -> Term.term list -> Term.term list |
118 val pbl_ids' : 'a -> term -> term list -> term list |
118 (* val pen2str : Theory.theory -> Term.term * Term.term list -> string *) |
119 (* val pen2str : theory -> term * term list -> string *) |
119 val penvval_in : itm_ -> Term.term list |
120 val penvval_in : itm_ -> term list |
120 val refined : match list -> pblID |
121 val refined : match list -> pblID |
121 val refined_ : |
122 val refined_ : |
122 match_ list -> match_ Library.option |
123 match_ list -> match_ option |
123 (* val refined_IDitms : |
124 (* val refined_IDitms : |
124 match list -> match Library.option *) |
125 match list -> match option *) |
125 val split_dts : 'a -> Term.term -> Term.term * Term.term list |
126 val split_dts : 'a -> term -> term * term list |
126 val split_dts' : Term.term * Term.term -> Term.term list |
127 val split_dts' : term * term -> term list |
127 (* val take_apart : Term.term -> Term.term list *) |
128 (* val take_apart : term -> term list *) |
128 (* val take_apart_inv : Term.term list -> Term.term *) |
129 (* val take_apart_inv : term list -> term *) |
129 val ts_in : itm_ -> Term.term list |
130 val ts_in : itm_ -> term list |
130 (* val unique : Term.term *) |
131 (* val unique : term *) |
131 val untouched : itm list -> bool |
132 val untouched : itm list -> bool |
132 val upd : |
133 val upd : |
133 Theory.theory -> |
134 Proof.context -> |
134 (''a * (''b * Term.term list) list) list -> |
135 (''a * (''b * term list) list) list -> |
135 Term.term -> |
136 term -> |
136 ''b * Term.term -> ''a -> ''a * (''b * Term.term list) list |
137 ''b * term -> ''a -> ''a * (''b * term list) list |
137 val upd_envv : |
138 val upd_envv : |
138 Theory.theory -> |
139 Proof.context -> |
139 envv -> |
140 envv -> |
140 vats -> |
141 vats -> |
141 Term.term -> Term.term -> Term.term -> envv |
142 term -> term -> term -> envv |
142 val upd_penv : |
143 val upd_penv : |
143 Theory.theory -> |
144 Proof.context -> |
144 (''a * Term.term list) list -> |
145 (''a * term list) list -> |
145 Term.term -> ''a * Term.term -> (''a * Term.term list) list |
146 term -> ''a * term -> (''a * term list) list |
146 (* val upds_envv : |
147 (* val upds_envv : |
147 Theory.theory -> |
148 Proof.context -> |
148 envv -> |
149 envv -> |
149 (vats * Term.term * Term.term * Term.term) list -> |
150 (vats * term * term * term) list -> |
150 envv *) |
151 envv *) |
151 val vts_cnt : int list -> itm list -> (int * int) list |
152 val vts_cnt : int list -> itm list -> (int * int) list |
152 val vts_in : itm list -> int list |
153 val vts_in : itm list -> int list |
153 (* val w_itms2str : Theory.theory -> itm list -> unit *) |
154 (* val w_itms2str_ : Proof.context -> itm list -> unit *) |
154 end |
155 end |
155 |
156 |
156 (*----------------------------------------------------------*) |
157 (*----------------------------------------------------------*) |
157 structure SpecifyTools : SPECIFY_TOOLS = |
158 structure SpecifyTools : SPECIFY_TOOLS = |
158 struct |
159 struct |
159 (*----------------------------------------------------------*) |
160 (*----------------------------------------------------------*) |
160 val e_listReal = (term_of o the o (parse Script.thy)) "[]::(real list)"; |
161 val e_listReal = (term_of o the o (parse (theory "Script"))) "[]::(real list)"; |
161 val e_listBool = (term_of o the o (parse Script.thy)) "[]::(bool list)"; |
162 val e_listBool = (term_of o the o (parse (theory "Script"))) "[]::(bool list)"; |
162 |
163 |
163 (*.take list-term apart w.r.t. handling elementwise input.*) |
164 (*.take list-term apart w.r.t. handling elementwise input.*) |
164 fun take_apart t = |
165 fun take_apart t = |
165 let val elems = isalist2list t |
166 let val elems = isalist2list t |
166 in map ((list2isalist (type_of (hd elems))) o single) elems end; |
167 in map ((list2isalist (type_of (hd elems))) o single) elems end; |
195 else (hd ts); |
196 else (hd ts); |
196 (*.revert split_. |
197 (*.revert split_. |
197 WN050903 we do NOT know which is from subtheory, description or term; |
198 WN050903 we do NOT know which is from subtheory, description or term; |
198 typecheck thus may lead to TYPE-error 'unknown constant'; |
199 typecheck thus may lead to TYPE-error 'unknown constant'; |
199 solution: typecheck with Isac.thy; i.e. arg 'thy' superfluous*) |
200 solution: typecheck with Isac.thy; i.e. arg 'thy' superfluous*) |
200 fun comp_dts thy (d,[]) = |
201 (*fun comp_dts thy (d,[]) = |
201 cterm_of ((sign_of o assoc_thy) "Isac.thy") |
202 cterm_of (*(sign_of o assoc_thy) "Isac.thy"*) |
|
203 (theory "Isac") |
202 (*comp_dts:FIXXME stay with term for efficiency !!!*) |
204 (*comp_dts:FIXXME stay with term for efficiency !!!*) |
203 (if is_reall_dsc d then (d $ e_listReal) |
205 (if is_reall_dsc d then (d $ e_listReal) |
204 else if is_booll_dsc d then (d $ e_listBool) |
206 else if is_booll_dsc d then (d $ e_listBool) |
205 else d) |
207 else d) |
206 | comp_dts thy (d,ts) = |
208 | comp_dts thy (d,ts) = |
207 (cterm_of ((sign_of o assoc_thy) "Isac.thy") |
209 (cterm_of (*(sign_of o assoc_thy) "Isac.thy"*) |
|
210 (theory "Isac") |
208 (*comp_dts:FIXXME stay with term for efficiency !!*) |
211 (*comp_dts:FIXXME stay with term for efficiency !!*) |
209 (d $ (comp_ts (d, ts))) |
212 (d $ (comp_ts (d, ts))) |
210 handle _ => raise error ("comp_dts: "^(term2str d)^ |
213 handle _ => raise error ("comp_dts: "^(term2str d)^ |
211 " $ "^(term2str (hd ts)))); |
214 " $ "^(term2str (hd ts))));*) |
|
215 fun comp_dts thy (d,[]) = |
|
216 (if is_reall_dsc d then (d $ e_listReal) |
|
217 else if is_booll_dsc d then (d $ e_listBool) |
|
218 else d) |
|
219 | comp_dts thy (d,ts) = |
|
220 (d $ (comp_ts (d, ts))) |
|
221 handle _ => raise error ("comp_dts: "^(term2str d)^ |
|
222 " $ "^(term2str (hd ts))); |
212 (*25.8.03*) |
223 (*25.8.03*) |
213 fun comp_dts' (d,[]) = |
224 fun comp_dts' (d,[]) = |
214 if is_reall_dsc d then (d $ e_listReal) |
225 if is_reall_dsc d then (d $ e_listReal) |
215 else if is_booll_dsc d then (d $ e_listBool) |
226 else if is_booll_dsc d then (d $ e_listBool) |
216 else d |
227 else d |
578 val preoris2str = (strs2str' o (map (linefeed o preori2str))); |
589 val preoris2str = (strs2str' o (map (linefeed o preori2str))); |
579 |
590 |
580 (*. given the input value (from split_dts) |
591 (*. given the input value (from split_dts) |
581 make the value in a problem-env according to description-type .*) |
592 make the value in a problem-env according to description-type .*) |
582 (*28.8.01: .nam and .una impl. properly, others copied .. TODO*) |
593 (*28.8.01: .nam and .una impl. properly, others copied .. TODO*) |
583 (*9.5.03 penv-concept postponed *) |
594 fun pbl_ids ctxt (Const(_,Type("fun",[_,Type("Tools.nam",_)]))) v = |
584 fun pbl_ids thy (Const(_,Type("fun",[_,Type("Tools.nam",_)]))) v = |
|
585 if is_list v |
595 if is_list v |
586 then [v] (*eg. [r=Arbfix]*) |
596 then [v] (*eg. [r=Arbfix]*) |
587 else (case v of (*eg. eps=#0*) |
597 else (case v of (*eg. eps=#0*) |
588 (Const ("op =",_) $ l $ r) => [r,l] |
598 (Const ("op =",_) $ l $ r) => [r,l] |
589 | _ => raise error ("pbl_ids Tools.nam: no equality " |
599 | _ => raise error ("pbl_ids Tools.nam: no equality " |
590 ^(Sign.string_of_term (sign_of thy) v))) |
600 ^(Syntax.string_of_term ctxt v))) |
591 | pbl_ids thy (Const(_,Type("fun",[_,Type("Tools.una",_)]))) v = [v] |
601 | pbl_ids ctxt (Const(_,Type("fun",[_,Type("Tools.una",_)]))) v = [v] |
592 | pbl_ids thy (Const(_,Type("fun",[_,Type("Tools.unl",_)]))) v = [v] |
602 | pbl_ids ctxt (Const(_,Type("fun",[_,Type("Tools.unl",_)]))) v = [v] |
593 | pbl_ids thy (Const(_,Type("fun",[_,Type("Tools.str",_)]))) v = [v] |
603 | pbl_ids ctxt (Const(_,Type("fun",[_,Type("Tools.str",_)]))) v = [v] |
594 | pbl_ids thy (Const(_,Type("fun",[_,Type("Tools.toreal",_)]))) v = [v] |
604 | pbl_ids ctxt (Const(_,Type("fun",[_,Type("Tools.toreal",_)]))) v = [v] |
595 | pbl_ids thy (Const(_,Type("fun",[_,Type("Tools.toreall",_)])))v = [v] |
605 | pbl_ids ctxt (Const(_,Type("fun",[_,Type("Tools.toreall",_)])))v = [v] |
596 | pbl_ids thy (Const(_,Type("fun",[_,Type("Tools.unknown",_)])))v = [v] |
606 | pbl_ids ctxt (Const(_,Type("fun",[_,Type("Tools.unknown",_)])))v = [v] |
597 | pbl_ids thy _ v = raise error ("pbl_ids: not implemented for " |
607 | pbl_ids ctxt _ v = raise error ("pbl_ids: not implemented for " |
598 ^(Sign.string_of_term (sign_of thy) v)); |
608 ^(Syntax.string_of_term ctxt v)); |
599 (* |
609 (* |
600 val t as t1 $ t2 = str2term "antiDerivativeName M_b"; |
610 val t as t1 $ t2 = str2term "antiDerivativeName M_b"; |
601 pbl_ids thy t1 t2; |
611 pbl_ids ctxt t1 t2; |
602 |
612 |
603 val t = (term_of o the o (parse thy)) "fixedValues [r=Arbfix]"; |
613 val t = (term_of o the o (parse thy)) "fixedValues [r=Arbfix]"; |
604 val (d,argl) = strip_comb t; |
614 val (d,argl) = strip_comb t; |
605 is_dsc d; (*see split_dts*) |
615 is_dsc d; (*see split_dts*) |
606 dest_list (d,argl); |
616 dest_list (d,argl); |
607 val (_ $ v) = t; |
617 val (_ $ v) = t; |
608 is_list v; |
618 is_list v; |
609 pbl_ids thy d v; |
619 pbl_ids ctxt d v; |
610 [Const ("List.list.Cons","[bool, bool List.list] => bool List.list") $ |
620 [Const ("List.list.Cons","[bool, bool List.list] => bool List.list") $ |
611 (Const # $ Free # $ Const (#,#)) $ Const ("List.list.Nil","bool List.. |
621 (Const # $ Free # $ Const (#,#)) $ Const ("List.list.Nil","bool List.. |
612 |
622 |
613 val (dsc,vl) = (split_dts o term_of o the o (parse thy)) "solveFor x"; |
623 val (dsc,vl) = (split_dts o term_of o the o (parse thy)) "solveFor x"; |
614 val dsc = Const ("Descript.solveFor","RealDef.real => Tools.una") : term |
624 val dsc = Const ("Descript.solveFor","RealDef.real => Tools.una") : term |
615 val vl = Free ("x","RealDef.real") : term |
625 val vl = Free ("x","RealDef.real") : term |
616 |
626 |
617 val (dsc,id) = (split_did o term_of o the o (parse thy)) "solveFor v_"; |
627 val (dsc,id) = (split_did o term_of o the o (parse thy)) "solveFor v_"; |
618 pbl_ids thy dsc vl; |
628 pbl_ids ctxt dsc vl; |
619 val it = [Free ("x","RealDef.real")] : term list |
629 val it = [Free ("x","RealDef.real")] : term list |
620 |
630 |
621 val (dsc,vl) = (split_dts o term_of o the o(parse thy)) |
631 val (dsc,vl) = (split_dts o term_of o the o(parse thy)) |
622 "errorBound (eps=#0)"; |
632 "errorBound (eps=#0)"; |
623 val (dsc,id) = (split_did o term_of o the o(parse thy)) "errorBound err_"; |
633 val (dsc,id) = (split_did o term_of o the o(parse thy)) "errorBound err_"; |
624 pbl_ids thy dsc vl; |
634 pbl_ids ctxt dsc vl; |
625 val it = [Free ("#0","RealDef.real"),Free ("eps","RealDef.real")] : term list *) |
635 val it = [Free ("#0","RealDef.real"),Free ("eps","RealDef.real")] : term list *) |
626 |
636 |
627 (*. given an already input itm, ((14.9.01: no difference to pbl_ids jet!!)) |
637 (*. given an already input itm, ((14.9.01: no difference to pbl_ids jet!!)) |
628 make the value in a problem-env according to description-type .*) |
638 make the value in a problem-env according to description-type .*) |
629 (*28.8.01: .nam and .una impl. properly, others copied .. TODO*) |
639 (*28.8.01: .nam and .una impl. properly, others copied .. TODO*) |
631 (case vs of |
641 (case vs of |
632 [] => raise error ("pbl_ids' Tools.nam called with []") |
642 [] => raise error ("pbl_ids' Tools.nam called with []") |
633 | [t] => (case t of (*eg. eps=#0*) |
643 | [t] => (case t of (*eg. eps=#0*) |
634 (Const ("op =",_) $ l $ r) => [r,l] |
644 (Const ("op =",_) $ l $ r) => [r,l] |
635 | _ => raise error ("pbl_ids' Tools.nam: no equality " |
645 | _ => raise error ("pbl_ids' Tools.nam: no equality " |
636 ^(Sign.string_of_term (sign_of thy) t))) |
646 ^(Syntax.string_of_term (ctxt_Isac"")t))) |
637 | vs' => vs (*14.9.01: ???TODO *)) |
647 | vs' => vs (*14.9.01: ???TODO *)) |
638 | pbl_ids' (Const(_,Type("fun",[_,Type("Tools.una",_)]))) vs = vs |
648 | pbl_ids' (Const(_,Type("fun",[_,Type("Tools.una",_)]))) vs = vs |
639 | pbl_ids' (Const(_,Type("fun",[_,Type("Tools.unl",_)]))) vs = vs |
649 | pbl_ids' (Const(_,Type("fun",[_,Type("Tools.unl",_)]))) vs = vs |
640 | pbl_ids' (Const(_,Type("fun",[_,Type("Tools.str",_)]))) vs = vs |
650 | pbl_ids' (Const(_,Type("fun",[_,Type("Tools.str",_)]))) vs = vs |
641 | pbl_ids' (Const(_,Type("fun",[_,Type("Tools.toreal",_)]))) vs = vs |
651 | pbl_ids' (Const(_,Type("fun",[_,Type("Tools.toreal",_)]))) vs = vs |
775 | TypeE of string (**) |
785 | TypeE of string (**) |
776 | False of cterm' (*WN050618 notexistent in itm_: only used in Where*) |
786 | False of cterm' (*WN050618 notexistent in itm_: only used in Where*) |
777 | Incompl of cterm' (**) |
787 | Incompl of cterm' (**) |
778 | Superfl of string (**) |
788 | Superfl of string (**) |
779 | Missing of cterm'; |
789 | Missing of cterm'; |
780 fun item2str (Correct s) ="Correct "^s |
790 fun item2str (Correct s) ="Correct " ^ s |
781 | item2str (SyntaxE s) ="SyntaxE "^s |
791 | item2str (SyntaxE s) ="SyntaxE " ^ s |
782 | item2str (TypeE s) ="TypeE "^s |
792 | item2str (TypeE s) ="TypeE " ^ s |
783 | item2str (False s) ="False "^s |
793 | item2str (False s) ="False " ^ s |
784 | item2str (Incompl s) ="Incompl "^s |
794 | item2str (Incompl s) ="Incompl " ^ s |
785 | item2str (Superfl s) ="Superfl "^s |
795 | item2str (Superfl s) ="Superfl " ^ s |
786 | item2str (Missing s) ="Missing "^s; |
796 | item2str (Missing s) ="Missing " ^ s; |
787 (*make string for error-msgs*) |
797 (*make string for error-msgs*) |
788 fun itm__2str thy (Cor ((d,ts), penv)) = |
798 fun itm_2str_ ctxt (Cor ((d,ts), penv)) = |
789 "Cor " ^ string_of_cterm (comp_dts thy(d,ts)) ^" ,"^ pen2str thy penv |
799 "Cor " ^ Syntax.string_of_term ctxt (comp_dts ctxt (d,ts)) ^ " ," |
790 | itm__2str thy (Syn c) = "Syn "^c |
800 ^ pen2str ctxt penv |
791 | itm__2str thy (Typ c) = "Typ "^c |
801 | itm_2str_ ctxt (Syn c) = "Syn " ^ c |
792 | itm__2str thy (Inc ((d,ts), penv)) = |
802 | itm_2str_ ctxt (Typ c) = "Typ " ^ c |
793 "Inc " ^ string_of_cterm (comp_dts thy(d,ts)) ^" ,"^ pen2str thy penv |
803 | itm_2str_ ctxt (Inc ((d,ts), penv)) = |
794 | itm__2str thy (Sup (d,ts)) = "Sup "^(string_of_cterm (comp_dts thy(d,ts))) |
804 "Inc " ^ Syntax.string_of_term ctxt (comp_dts ctxt (d,ts)) ^ " ," |
795 | itm__2str thy (Mis (d,pid))= |
805 ^ pen2str ctxt penv |
796 "Mis "^ Sign.string_of_term (sign_of thy) d ^ |
806 | itm_2str_ ctxt (Sup (d,ts)) = |
797 " "^ Sign.string_of_term (sign_of thy) pid |
807 "Sup " ^ Syntax.string_of_term ctxt (comp_dts ctxt (d,ts)) |
798 | itm__2str thy (Par s) = "Trm "^s; |
808 | itm_2str_ ctxt (Mis (d,pid))= |
799 fun itm_2str t = itm__2str (assoc_thy "Isac.thy") t; |
809 "Mis "^ Syntax.string_of_term ctxt d ^ |
800 fun itm2str thy ((i,is,b,s,itm_):itm) = |
810 " "^ Syntax.string_of_term ctxt pid |
|
811 | itm_2str_ ctxt (Par s) = "Trm "^s; |
|
812 fun itm_2str t = itm_2str_ (thy2ctxt "Isac") t; |
|
813 fun itm2str_ ctxt ((i,is,b,s,itm_):itm) = |
801 "("^(string_of_int i)^" ,"^(ints2str' is)^" ,"^(bool2str b)^" ,"^ |
814 "("^(string_of_int i)^" ,"^(ints2str' is)^" ,"^(bool2str b)^" ,"^ |
802 s^" ,"^(itm__2str thy itm_)^")"; |
815 s^" ,"^(itm_2str_ ctxt itm_)^")"; |
803 val linefeed = (curry op^) "\n"; |
816 fun itms2str_ ctxt itms = strs2str' (map (linefeed o (itm2str_ ctxt)) itms); |
804 fun itms2str thy itms = strs2str' (map (linefeed o (itm2str thy)) itms); |
817 fun w_itms2str_ ctxt itms = writeln (itms2str_ ctxt itms); |
805 fun w_itms2str thy itms = writeln (itms2str thy itms); |
|
806 |
818 |
807 fun init_item str = SyntaxE str; |
819 fun init_item str = SyntaxE str; |
808 |
820 |
809 |
821 |
810 |
822 |
967 fun vt_and_dsc d' ((i,v,f,d,ts):ori) = |
979 fun vt_and_dsc d' ((i,v,f,d,ts):ori) = |
968 vt mem v andalso d'= d |
980 vt mem v andalso d'= d |
969 fun cpy its [] (f, (d, id)) = |
981 fun cpy its [] (f, (d, id)) = |
970 if length its = 0 (*no dsc found in pbl*) |
982 if length its = 0 (*no dsc found in pbl*) |
971 then case find_first (vt_and_dsc d) oris |
983 then case find_first (vt_and_dsc d) oris |
972 of Some (i,v,_,_,ts) => |
984 of SOME (i,v,_,_,ts) => |
973 [(i,v,true,f, Cor ((d,ts), (id,pbl_ids' thy d ts)))] |
985 [(i,v,true,f, Cor ((d,ts), (id,pbl_ids' thy d ts)))] |
974 | None => [(0,[],false,f,Mis (d, id))] |
986 | NONE => [(0,[],false,f,Mis (d, id))] |
975 else its |
987 else its |
976 | cpy its ((it as (i, vs, b, f, itm_))::itms) (pb as (x, (d, id))) = |
988 | cpy its ((it as (i, vs, b, f, itm_))::itms) (pb as (x, (d, id))) = |
977 if d = d_in itm_ andalso i<>0 (*already touched by user*) |
989 if d = d_in itm_ andalso i<>0 (*already touched by user*) |
978 then cpy (its @ [it]) itms pb else cpy its itms pb; |
990 then cpy (its @ [it]) itms pb else cpy its itms pb; |
979 in ((flat o (map (cpy [] pbl))) met):itm list end; |
991 in ((flat o (map (cpy [] pbl))) met):itm list end; |
1016 (* val (pbl, met) = (itms, pbt); |
1028 (* val (pbl, met) = (itms, pbt); |
1017 *) |
1029 *) |
1018 fun copy_pbl (pbl:itm list) met oris = |
1030 fun copy_pbl (pbl:itm list) met oris = |
1019 let fun eqdsc_pbt_itm ((_,(d,_))) ((_,_,_,_,itm_):itm) = d = d_in itm_; |
1031 let fun eqdsc_pbt_itm ((_,(d,_))) ((_,_,_,_,itm_):itm) = d = d_in itm_; |
1020 fun notmem pbl pbt1 = case find_first (eqdsc_pbt_itm pbt1) pbl of |
1032 fun notmem pbl pbt1 = case find_first (eqdsc_pbt_itm pbt1) pbl of |
1021 Some _ => false | None => true; |
1033 SOME _ => false | NONE => true; |
1022 (*1*)val mis = ((map (cons2 (fst, fst o snd))) o (filter (notmem pbl))) met; |
1034 (*1*)val mis = ((map (cons2 (fst, fst o snd))) o (filter (notmem pbl))) met; |
1023 |
1035 |
1024 fun eqdsc_ori d ((_,_,_,d',_):ori) = d = d'; |
1036 fun eqdsc_ori d ((_,_,_,d',_):ori) = d = d'; |
1025 fun ori2itmMis f ((i,v,_,d,ts):ori) = (i,v,false,f,Mis (d,ts)):itm; |
1037 fun ori2itmMis f ((i,v,_,d,ts):ori) = (i,v,false,f,Mis (d,ts)):itm; |
1026 fun oris2itms oris mis1 = ((map (ori2itmMis (fst mis1))) |
1038 fun oris2itms oris mis1 = ((map (ori2itmMis (fst mis1))) |