src/Tools/isac/Interpret/model.sml
changeset 59405 49d7d410b83c
parent 59389 627d25067f2f
child 59416 229e5c9cf78b
equal deleted inserted replaced
59404:6a2753b8d70c 59405:49d7d410b83c
    10 sig
    10 sig
    11   type ori
    11   type ori
    12   val oris2str : ori list -> string
    12   val oris2str : ori list -> string
    13   val e_ori : ori
    13   val e_ori : ori
    14   datatype item
    14   datatype item
    15   = Correct of cterm' | False of cterm' | Incompl of cterm' | Missing of cterm' | Superfl of string
    15   = Correct of Celem.cterm' | False of Celem.cterm' | Incompl of Celem.cterm' | Missing of Celem.cterm' | Superfl of string
    16      | SyntaxE of string | TypeE of string
    16      | SyntaxE of string | TypeE of string
    17   datatype itm_ = Cor of (term * (term list)) * (term * (term list))
    17   datatype itm_ = Cor of (term * (term list)) * (term * (term list))
    18   | Syn of cterm' | Typ of cterm' | Inc of (term * (term list))	* (term * (term list))
    18   | Syn of Celem.cterm' | Typ of Celem.cterm' | Inc of (term * (term list))	* (term * (term list))
    19   | Sup of (term * (term list)) | Mis of (term * term) | Par of cterm'
    19   | Sup of (term * (term list)) | Mis of (term * term) | Par of Celem.cterm'
    20   val itm_2str : itm_ -> string
    20   val itm_2str : itm_ -> string
    21   val itm_2str_ : Proof.context -> itm_ -> string
    21   val itm_2str_ : Proof.context -> itm_ -> string
    22   type itm
    22   type itm
    23   val itm2str_ : Proof.context -> itm -> string
    23   val itm2str_ : Proof.context -> itm -> string
    24   val itms2str_ : Proof.context -> itm list -> string
    24   val itms2str_ : Proof.context -> itm list -> string
   107       wenn Problem pbt v"ollig neue, dann w"are eigentlich n"otig ????:
   107       wenn Problem pbt v"ollig neue, dann w"are eigentlich n"otig ????:
   108       (a) (_,_,d1,ts,_):ori + pbt -> (i,vt,d2,ts,pid)  dh.vt neu  ????
   108       (a) (_,_,d1,ts,_):ori + pbt -> (i,vt,d2,ts,pid)  dh.vt neu  ????
   109       (b) 
   109       (b) 
   110 ==========================================================================*)
   110 ==========================================================================*)
   111 
   111 
   112 val script_parse = the o (@{theory Script} |> thy2ctxt |> TermC.parseNEW);
   112 val script_parse = the o (@{theory Script} |> Celem.thy2ctxt |> TermC.parseNEW);
   113 val e_listReal = script_parse "[]::(real list)";
   113 val e_listReal = script_parse "[]::(real list)";
   114 val e_listBool = script_parse "[]::(bool list)";
   114 val e_listBool = script_parse "[]::(bool list)";
   115 
   115 
   116 (* take list-term apart w.r.t. handling elementwise input: @{term "[a, b]"} \<rightarrow> ["[a]","[b]"] *)
   116 (* take list-term apart w.r.t. handling elementwise input: @{term "[a, b]"} \<rightarrow> ["[a]","[b]"] *)
   117 fun take_apart t =
   117 fun take_apart t =
   147 fun comp_dts (d, []) = 
   147 fun comp_dts (d, []) = 
   148   	if LTool.is_reall_dsc d
   148   	if LTool.is_reall_dsc d
   149   	then (d $ e_listReal)
   149   	then (d $ e_listReal)
   150   	else if LTool.is_booll_dsc d then (d $ e_listBool) else d
   150   	else if LTool.is_booll_dsc d then (d $ e_listBool) else d
   151   | comp_dts (d, ts) = (d $ (comp_ts (d, ts)))
   151   | comp_dts (d, ts) = (d $ (comp_ts (d, ts)))
   152     handle _ => error ("comp_dts: " ^ term2str d ^ " $ " ^ term2str (hd ts)); 
   152     handle _ => error ("comp_dts: " ^ Celem.term2str d ^ " $ " ^ Celem.term2str (hd ts)); 
   153 fun comp_dts' (d, []) = 
   153 fun comp_dts' (d, []) = 
   154     if LTool.is_reall_dsc d
   154     if LTool.is_reall_dsc d
   155     then (d $ e_listReal)
   155     then (d $ e_listReal)
   156     else if LTool.is_booll_dsc d then (d $ e_listBool) else d
   156     else if LTool.is_booll_dsc d then (d $ e_listBool) else d
   157   | comp_dts' (d, ts) = (d $ (comp_ts (d, ts)))
   157   | comp_dts' (d, ts) = (d $ (comp_ts (d, ts)))
   158     handle _ => error ("comp_dts': " ^ term2str d ^ " $ " ^ term2str (hd ts)); 
   158     handle _ => error ("comp_dts': " ^ Celem.term2str d ^ " $ " ^ Celem.term2str (hd ts)); 
   159 fun comp_dts'' (d, []) = 
   159 fun comp_dts'' (d, []) = 
   160     if LTool.is_reall_dsc d
   160     if LTool.is_reall_dsc d
   161     then term2str (d $ e_listReal)
   161     then Celem.term2str (d $ e_listReal)
   162     else if LTool.is_booll_dsc d
   162     else if LTool.is_booll_dsc d
   163       then term2str (d $ e_listBool)
   163       then Celem.term2str (d $ e_listBool)
   164       else term2str d
   164       else Celem.term2str d
   165   | comp_dts'' (d, ts) = term2str (d $ (comp_ts (d, ts)))
   165   | comp_dts'' (d, ts) = Celem.term2str (d $ (comp_ts (d, ts)))
   166     handle _ => error ("comp_dts'': " ^ term2str d ^ " $ " ^ term2str (hd ts)); 
   166     handle _ => error ("comp_dts'': " ^ Celem.term2str d ^ " $ " ^ Celem.term2str (hd ts)); 
   167 
   167 
   168 (* decompose an input into description, terms (ev. elems of lists),
   168 (* decompose an input into description, terms (ev. elems of lists),
   169     and the value for the problem-environment; inv to comp_dts   *)
   169     and the value for the problem-environment; inv to comp_dts   *)
   170 fun split_dts (t as d $ arg) =
   170 fun split_dts (t as d $ arg) =
   171     if LTool.is_dsc d
   171     if LTool.is_dsc d
   172     then if LTool.is_list_dsc d andalso TermC.is_list arg andalso LTool.is_unl d |> not
   172     then if LTool.is_list_dsc d andalso TermC.is_list arg andalso LTool.is_unl d |> not
   173       then (d, take_apart arg)
   173       then (d, take_apart arg)
   174       else (d, [arg])
   174       else (d, [arg])
   175     else (e_term, dest_list' t)
   175     else (Celem.e_term, dest_list' t)
   176   | split_dts t =
   176   | split_dts t =
   177     let val t' as (h, _) = strip_comb t;
   177     let val t' as (h, _) = strip_comb t;
   178     in
   178     in
   179       if LTool.is_dsc h
   179       if LTool.is_dsc h
   180       then (h, dest_list t')
   180       then (h, dest_list t')
   181       else (e_term, dest_list' t)
   181       else (Celem.e_term, dest_list' t)
   182     end;
   182     end;
   183 (* version returning ts only *)
   183 (* version returning ts only *)
   184 fun split_dts' (d, arg) = 
   184 fun split_dts' (d, arg) = 
   185     if LTool.is_dsc d
   185     if LTool.is_dsc d
   186     then if LTool.is_list_dsc d
   186     then if LTool.is_list_dsc d
   226 type penv = (* problem-environment *)
   226 type penv = (* problem-environment *)
   227   (term           (* err_                              *)
   227   (term           (* err_                              *)
   228 	 * (term list)  (* [#0, epsilon] 9.5.03 outcommented *)
   228 	 * (term list)  (* [#0, epsilon] 9.5.03 outcommented *)
   229 	) list;
   229 	) list;
   230 fun pen2str ctxt (t, ts) =
   230 fun pen2str ctxt (t, ts) =
   231   pair2str (term_to_string'  ctxt t, (strs2str' o map (term_to_string'  ctxt)) ts);
   231   pair2str (Celem.term_to_string' ctxt t, (strs2str' o map (Celem.term_to_string'  ctxt)) ts);
   232 fun penv2str_ thy penv = (strs2str' o (map (pen2str thy))) penv;
   232 fun penv2str_ thy penv = (strs2str' o (map (pen2str thy))) penv;
   233 
   233 
   234 (* get the constant value from a penv *)
   234 (* get the constant value from a penv *)
   235 fun getval (id, values) = 
   235 fun getval (id, values) = 
   236   case values of
   236   case values of
   237 	  [] => error ("penv_value: no values in '" ^ term2str id)
   237 	  [] => error ("penv_value: no values in '" ^ Celem.term2str id)
   238   | [v] => (id, v)
   238   | [v] => (id, v)
   239   | (v1 :: v2 :: _) => (case v1 of 
   239   | (v1 :: v2 :: _) => (case v1 of 
   240 	      Const ("Script.Arbfix",_) => (id, v2)
   240 	      Const ("Script.Arbfix",_) => (id, v2)
   241 	    | _ => (id, v1));
   241 	    | _ => (id, v1));
   242 
   242 
   246 (* 14.9.01: not used after putting penv-values into itm_
   246 (* 14.9.01: not used after putting penv-values into itm_
   247    make the result of split_* a value of problem-environment *)
   247    make the result of split_* a value of problem-environment *)
   248 fun mkval _(*dsc*) [] = error "mkval called with []"
   248 fun mkval _(*dsc*) [] = error "mkval called with []"
   249   | mkval _ [t] = t
   249   | mkval _ [t] = t
   250   | mkval _ ts = TermC.list2isalist ((type_of o hd) ts) ts;
   250   | mkval _ ts = TermC.list2isalist ((type_of o hd) ts) ts;
   251 fun mkval' x = mkval e_term x;
   251 fun mkval' x = mkval Celem.e_term x;
   252 
   252 
   253 (* the internal representation of a models' item
   253 (* the internal representation of a models' item
   254   4.9.01: not consistent:
   254   4.9.01: not consistent:
   255   after Init_Proof 'Inc', but after copy_probl 'Mis' - for same situation
   255   after Init_Proof 'Inc', but after copy_probl 'Mis' - for same situation
   256   (involves 'is_error');
   256   (involves 'is_error');
   257   bool in itm really necessary ???*)
   257   bool in itm really necessary ???*)
   258 datatype itm_ = 
   258 datatype itm_ = 
   259   Cor of (term *              (* description                                                     *)
   259   Cor of (term *              (* description                                                     *)
   260     (term list)) *            (* for list: elem-wise input                                       *) 
   260     (term list)) *            (* for list: elem-wise input                                       *) 
   261    (term * (term list))       (* elem of penv ---- penv delayed to future                        *)
   261    (term * (term list))       (* elem of penv ---- penv delayed to future                        *)
   262 | Syn of cterm'
   262 | Syn of Celem.cterm'
   263 | Typ of cterm'
   263 | Typ of Celem.cterm'
   264 | Inc of (term * (term list))	* (term * (term list)) (*lists,
   264 | Inc of (term * (term list))	* (term * (term list)) (*lists,
   265 			+ init_pbl WN.11.03 FIXXME: empty penv .. bad; init_pbl should return Mis !!!              *)
   265 			+ init_pbl WN.11.03 FIXXME: empty penv .. bad; init_pbl should return Mis !!!              *)
   266 | Sup of (term * (term list)) (* user-input not found in pbt(+?oris?11.03)*)
   266 | Sup of (term * (term list)) (* user-input not found in pbt(+?oris?11.03)*)
   267 | Mis of (term * term)        (* after re-specification pbt-item not found in pbl: only dsc, pid_*)
   267 | Mis of (term * term)        (* after re-specification pbt-item not found in pbl: only dsc, pid_*)
   268 | Par of cterm';              (* internal state from fun parsitm                                 *)
   268 | Par of Celem.cterm';              (* internal state from fun parsitm                                 *)
   269 
   269 
   270 type vats = int list; (* variants in formalizations *)
   270 type vats = int list; (* variants in formalizations *)
   271 
   271 
   272 (* data-type for working on pbl/met-ppc:
   272 (* data-type for working on pbl/met-ppc:
   273   in pbl initially holds descriptions (only) for user guidance *)
   273   in pbl initially holds descriptions (only) for user guidance *)
   324 	vats *     (* variants 21.3.02: related to pbt..discard ?                             *)
   324 	vats *     (* variants 21.3.02: related to pbt..discard ?                             *)
   325 	string *   (* #Given | #Find | #Relate 21.3.02: discard ?                             *)
   325 	string *   (* #Given | #Find | #Relate 21.3.02: discard ?                             *)
   326 	term *     (* description                                                             *)
   326 	term *     (* description                                                             *)
   327 	term list  (* isalist2list t | [t]                                                    *)
   327 	term list  (* isalist2list t | [t]                                                    *)
   328 	);
   328 	);
   329 val e_ori = (0, [], "", e_term, [e_term]) : ori;
   329 val e_ori = (0, [], "", Celem.e_term, [Celem.e_term]) : ori;
   330 
   330 
   331 fun ori2str (i, vs, fi, t, ts) = 
   331 fun ori2str (i, vs, fi, t, ts) = 
   332   "(" ^ string_of_int i ^ ", " ^ (strs2str o (map string_of_int)) vs ^ ", " ^ fi ^ "," ^
   332   "(" ^ string_of_int i ^ ", " ^ (strs2str o (map string_of_int)) vs ^ ", " ^ fi ^ "," ^
   333   term2str t ^ ", " ^ (strs2str o (map term2str)) ts ^ ")";
   333   Celem.term2str t ^ ", " ^ (strs2str o (map Celem.term2str)) ts ^ ")";
   334 val oris2str = strs2str' o (map (linefeed o ori2str));
   334 val oris2str = strs2str' o (map (Celem.linefeed o ori2str));
   335 
   335 
   336 (* an or without leading integer *)
   336 (* an or without leading integer *)
   337 type preori = (vats * string * term * term list);
   337 type preori = (vats * string * term * term list);
   338 fun preori2str (vs, fi, t, ts) = 
   338 fun preori2str (vs, fi, t, ts) = 
   339   "(" ^ (strs2str o (map string_of_int)) vs ^ ", " ^ fi ^ ", " ^
   339   "(" ^ (strs2str o (map string_of_int)) vs ^ ", " ^ fi ^ ", " ^
   340   term2str t ^ ", " ^ (strs2str o (map term2str)) ts ^ ")";
   340   Celem.term2str t ^ ", " ^ (strs2str o (map Celem.term2str)) ts ^ ")";
   341 val preoris2str = (strs2str' o (map (linefeed o preori2str)));
   341 val preoris2str = (strs2str' o (map (Celem.linefeed o preori2str)));
   342 
   342 
   343 (* given the input value (from split_dts)
   343 (* given the input value (from split_dts)
   344    make the value in a problem-env according to description-type
   344    make the value in a problem-env according to description-type
   345   28.8.01: .nam and .una impl. properly, others copied .. TODO.
   345   28.8.01: .nam and .una impl. properly, others copied .. TODO.
   346   19/03/15 17:33, Makarius wrote:
   346   19/03/15 17:33, Makarius wrote:
   351 fun pbl_ids ctxt (Const(_, Type ("fun", [_, Type ("Tools.nam", _)]))) v =
   351 fun pbl_ids ctxt (Const(_, Type ("fun", [_, Type ("Tools.nam", _)]))) v =
   352     if TermC.is_list v 
   352     if TermC.is_list v 
   353     then [v]      (*eg. [r=Arbfix]*)
   353     then [v]      (*eg. [r=Arbfix]*)
   354     else
   354     else
   355       (case v of  (*eg. eps=#0*) (Const ("HOL.eq", _) $ l $ r) => [r, l]
   355       (case v of  (*eg. eps=#0*) (Const ("HOL.eq", _) $ l $ r) => [r, l]
   356 	    | _ => error ("pbl_ids Tools.nam: no equality " ^ term_to_string' ctxt v))
   356 	    | _ => error ("pbl_ids Tools.nam: no equality " ^ Celem.term_to_string' ctxt v))
   357   | pbl_ids _ (Const (_, Type ("fun", [_,Type ("Tools.una", _)]))) v = [v]
   357   | pbl_ids _ (Const (_, Type ("fun", [_,Type ("Tools.una", _)]))) v = [v]
   358   | pbl_ids _ (Const (_, Type ("fun", [_,Type ("Tools.unl", _)]))) v = [v]
   358   | pbl_ids _ (Const (_, Type ("fun", [_,Type ("Tools.unl", _)]))) v = [v]
   359   | pbl_ids _ (Const (_, Type ("fun", [_,Type ("Tools.str", _)]))) v = [v]
   359   | pbl_ids _ (Const (_, Type ("fun", [_,Type ("Tools.str", _)]))) v = [v]
   360   | pbl_ids _ (Const (_, Type ("fun", [_,Type ("Tools.toreal", _)]))) v = [v] 
   360   | pbl_ids _ (Const (_, Type ("fun", [_,Type ("Tools.toreal", _)]))) v = [v] 
   361   | pbl_ids _ (Const (_, Type ("fun", [_,Type ("Tools.toreall", _)])))v = [v] 
   361   | pbl_ids _ (Const (_, Type ("fun", [_,Type ("Tools.toreall", _)])))v = [v] 
   362   | pbl_ids _ (Const (_, Type ("fun", [_,Type ("Tools.unknown" ,_)])))v = [v] 
   362   | pbl_ids _ (Const (_, Type ("fun", [_,Type ("Tools.unknown" ,_)])))v = [v] 
   363   | pbl_ids _ _ v = error ("pbl_ids: not implemented for " ^ term2str v);
   363   | pbl_ids _ _ v = error ("pbl_ids: not implemented for " ^ Celem.term2str v);
   364 
   364 
   365 (* given an already input itm, ((14.9.01: no difference to pbl_ids jet!!))
   365 (* given an already input itm, ((14.9.01: no difference to pbl_ids jet!!))
   366    make the value in a problem-env according to description-type.
   366    make the value in a problem-env according to description-type.
   367    28.8.01: .nam and .una impl. properly, others copied .. TODO
   367    28.8.01: .nam and .una impl. properly, others copied .. TODO
   368 fun pbl_ids' (Const(_, Type ("fun", [_, Type ("Tools.nam", _)]))) vs =
   368 fun pbl_ids' (Const(_, Type ("fun", [_, Type ("Tools.nam", _)]))) vs =
   417   | upds_envv thy envv ((vs, dsc, id, vl) :: ps) = 
   417   | upds_envv thy envv ((vs, dsc, id, vl) :: ps) = 
   418     upds_envv thy (upd_envv thy envv vs dsc id vl) ps;
   418     upds_envv thy (upd_envv thy envv vs dsc id vl) ps;
   419 
   419 
   420 (* for _output_ of the items of a Model *)
   420 (* for _output_ of the items of a Model *)
   421 datatype item = 
   421 datatype item = 
   422     Correct of cterm' (* labels a correct formula (type cterm') *)
   422     Correct of Celem.cterm' (* labels a correct formula (type cterm') *)
   423   | SyntaxE of string (**)
   423   | SyntaxE of string (**)
   424   | TypeE   of string (**)
   424   | TypeE   of string (**)
   425   | False   of cterm' (* WN050618 notexistent in itm_: only used in Where *)
   425   | False   of Celem.cterm' (* WN050618 notexistent in itm_: only used in Where *)
   426   | Incompl of cterm' (**)
   426   | Incompl of Celem.cterm' (**)
   427   | Superfl of string (**)
   427   | Superfl of string (**)
   428   | Missing of cterm';
   428   | Missing of Celem.cterm';
   429 fun item2str (Correct  s) ="Correct " ^ s
   429 fun item2str (Correct  s) ="Correct " ^ s
   430   | item2str (SyntaxE  s) ="SyntaxE " ^ s
   430   | item2str (SyntaxE  s) ="SyntaxE " ^ s
   431   | item2str (TypeE    s) ="TypeE " ^ s
   431   | item2str (TypeE    s) ="TypeE " ^ s
   432   | item2str (False    s) ="False " ^ s
   432   | item2str (False    s) ="False " ^ s
   433   | item2str (Incompl  s) ="Incompl " ^ s
   433   | item2str (Incompl  s) ="Incompl " ^ s
   434   | item2str (Superfl  s) ="Superfl " ^ s
   434   | item2str (Superfl  s) ="Superfl " ^ s
   435   | item2str (Missing  s) ="Missing " ^ s;
   435   | item2str (Missing  s) ="Missing " ^ s;
   436 (*make string for error-msgs*)
   436 (*make string for error-msgs*)
   437 fun itm_2str_ ctxt (Cor ((d, ts), penv)) = 
   437 fun itm_2str_ ctxt (Cor ((d, ts), penv)) = 
   438     "Cor " ^ term_to_string'  ctxt (comp_dts (d, ts)) ^ " ," ^ pen2str ctxt penv
   438     "Cor " ^ Celem.term_to_string'  ctxt (comp_dts (d, ts)) ^ " ," ^ pen2str ctxt penv
   439   | itm_2str_ _ (Syn c) = "Syn " ^ c
   439   | itm_2str_ _ (Syn c) = "Syn " ^ c
   440   | itm_2str_ _ (Typ c) = "Typ " ^ c
   440   | itm_2str_ _ (Typ c) = "Typ " ^ c
   441   | itm_2str_ ctxt (Inc ((d, ts), penv)) = 
   441   | itm_2str_ ctxt (Inc ((d, ts), penv)) = 
   442     "Inc " ^ term_to_string'  ctxt (comp_dts (d, ts)) ^ " ," ^ pen2str ctxt penv
   442     "Inc " ^ Celem.term_to_string'  ctxt (comp_dts (d, ts)) ^ " ," ^ pen2str ctxt penv
   443   | itm_2str_ ctxt (Sup (d, ts)) = 
   443   | itm_2str_ ctxt (Sup (d, ts)) = 
   444     "Sup " ^ term_to_string'  ctxt (comp_dts (d, ts))
   444     "Sup " ^ Celem.term_to_string'  ctxt (comp_dts (d, ts))
   445   | itm_2str_ ctxt (Mis (d, pid)) = 
   445   | itm_2str_ ctxt (Mis (d, pid)) = 
   446     "Mis "^ term_to_string'  ctxt d ^ " " ^ term_to_string'  ctxt pid
   446     "Mis "^ Celem.term_to_string'  ctxt d ^ " " ^ Celem.term_to_string'  ctxt pid
   447   | itm_2str_ _ (Par s) = "Trm "^s;
   447   | itm_2str_ _ (Par s) = "Trm "^s;
   448 fun itm_2str t = itm_2str_ (thy2ctxt' "Isac") t;
   448 fun itm_2str t = itm_2str_ (Celem.thy2ctxt' "Isac") t;
   449 fun itm2str_ ctxt ((i, is, b, s, itm_):itm) = 
   449 fun itm2str_ ctxt ((i, is, b, s, itm_):itm) = 
   450   "(" ^ string_of_int i ^ " ," ^ ints2str' is ^ " ," ^ bool2str b ^ " ," ^
   450   "(" ^ string_of_int i ^ " ," ^ ints2str' is ^ " ," ^ bool2str b ^ " ," ^
   451   s ^ " ," ^ itm_2str_ ctxt itm_ ^ ")";
   451   s ^ " ," ^ itm_2str_ ctxt itm_ ^ ")";
   452 fun itms2str_ ctxt itms = strs2str' (map (linefeed o (itm2str_ ctxt)) itms);
   452 fun itms2str_ ctxt itms = strs2str' (map (Celem.linefeed o (itm2str_ ctxt)) itms);
   453 fun init_item str = SyntaxE str;
   453 fun init_item str = SyntaxE str;
   454 
   454 
   455 type 'a ppc = 
   455 type 'a ppc = 
   456   {Given : 'a list, Where: 'a list, Find  : 'a list, With : 'a list, Relate: 'a list};
   456   {Given : 'a list, Where: 'a list, Find  : 'a list, With : 'a list, Relate: 'a list};
   457 fun ppc2str {Given = Given, Where = Where, Find = Find, With = With, Relate = Relate}=
   457 fun ppc2str {Given = Given, Where = Where, Find = Find, With = With, Relate = Relate}=
   487   | d_in (Inc ((d, _), _)) = d
   487   | d_in (Inc ((d, _), _)) = d
   488   | d_in (Sup (d, _)) = d
   488   | d_in (Sup (d, _)) = d
   489   | d_in (Mis (d, _)) = d
   489   | d_in (Mis (d, _)) = d
   490   | d_in _ = error "d_in: uncovered case in fun.def.";
   490   | d_in _ = error "d_in: uncovered case in fun.def.";
   491 
   491 
   492 fun dts2str (d, ts) = pair2str (term2str d, terms2str ts);
   492 fun dts2str (d, ts) = pair2str (Celem.term2str d, Celem.terms2str ts);
   493 fun penvval_in (Cor ((d, _), (_, ts))) = [comp_ts (d,ts)]
   493 fun penvval_in (Cor ((d, _), (_, ts))) = [comp_ts (d,ts)]
   494   | penvval_in (Syn  (c)) = (tracing("*** penvval_in: Syn ("^c^")"); [])
   494   | penvval_in (Syn  (c)) = (tracing("*** penvval_in: Syn ("^c^")"); [])
   495   | penvval_in (Typ  (c)) = (tracing("*** penvval_in: Typ ("^c^")"); [])
   495   | penvval_in (Typ  (c)) = (tracing("*** penvval_in: Typ ("^c^")"); [])
   496   | penvval_in (Inc (_, (_, ts))) = ts
   496   | penvval_in (Inc (_, (_, ts))) = ts
   497   | penvval_in (Sup dts) = (tracing ("*** penvval_in: Sup "^(dts2str dts)); [])
   497   | penvval_in (Sup dts) = (tracing ("*** penvval_in: Sup "^(dts2str dts)); [])
   498   | penvval_in (Mis (d, t)) = (tracing ("*** penvval_in: Mis " ^
   498   | penvval_in (Mis (d, t)) = (tracing ("*** penvval_in: Mis " ^
   499 			pair2str(term2str d, term2str t)); [])
   499 			pair2str(Celem.term2str d, Celem.term2str t)); [])
   500 	| penvval_in _ = error "penvval_in: uncovered case in fun.def.";
   500 	| penvval_in _ = error "penvval_in: uncovered case in fun.def.";
   501 
   501 
   502 (* check a predicate labelled with indication of incomplete substitution;
   502 (* check a predicate labelled with indication of incomplete substitution;
   503   rls ->    (* for eval_true                                               *)
   503   rls ->    (* for eval_true                                               *)
   504   bool * 	  (* have _all_ variables(Free) from the model-pattern 
   504   bool * 	  (* have _all_ variables(Free) from the model-pattern 
   505                been substituted by a value from the pattern's environment ?*)
   505                been substituted by a value from the pattern's environment ?*)
   506   term ->   (* the precondition                                            *)
   506   term ->   (* the precondition                                            *)
   507   bool * 	  (* has the precondition evaluated to true                      *)
   507   bool * 	  (* has the precondition evaluated to true                      *)
   508   term      (* the precondition (for map)                                  *)
   508   term      (* the precondition (for map)                                  *)
   509 *)
   509 *)
   510 fun pre2str (b, t) = pair2str(bool2str b, term2str t);
   510 fun pre2str (b, t) = pair2str(bool2str b, Celem.term2str t);
   511 fun pres2str pres = strs2str' (map (linefeed o pre2str) pres);
   511 fun pres2str pres = strs2str' (map (Celem.linefeed o pre2str) pres);
   512 
   512 
   513 end;
   513 end;