src/Tools/isac/BaseDefinitions/model-pattern.sml
author Walther Neuper <walther.neuper@jku.at>
Sun, 10 May 2020 13:16:56 +0200
changeset 59957 d63363c45af6
parent 59952 3d1c6f17edac
child 59987 73225ca9e0aa
permissions -rw-r--r--
investigate I_Model
walther@59945
     1
(* Title:  BaseDefinitions/model-pattern.sml
walther@59882
     2
   Author: Walther Neuper
walther@59882
     3
   (c) due to copyright terms
walther@59882
     4
walther@59945
     5
A pattern to be combined with a formalisation (Formalise.T) yielding an O_Model.T..
walther@59945
     6
*)
walther@59945
     7
signature MODEL_PATTERN =
walther@59882
     8
sig
walther@59945
     9
  type T
walther@59945
    10
  type single
walther@59945
    11
  val to_string: single list -> string
walther@59952
    12
  type m_field = string
walther@59952
    13
  type descriptor = term
walther@59884
    14
(* ---- for tests only: shifted from below to remove the Warning "unused" at fun.def. --------- *)
walther@59957
    15
  val to_string': T -> string
walther@59886
    16
(*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\* )
walther@59945
    17
  (*NONE*)                                                                      
walther@59886
    18
( *\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*)
walther@59882
    19
end
walther@59882
    20
walther@59882
    21
(**)
walther@59945
    22
structure Model_Pattern(**): MODEL_PATTERN(**) =
walther@59882
    23
struct
walther@59882
    24
(**)
walther@59882
    25
walther@59884
    26
(* the pattern for an item of a problems model or a methods guard *)
walther@59945
    27
type m_field = string;
walther@59952
    28
type descriptor = term;
walther@59945
    29
type single =
walther@59952
    30
  (m_field *      (* field Given, Find, Relate *)
walther@59952
    31
	  (descriptor * (* for snd term              *)
walther@59952
    32
	     term))     (* id | arbitrary term       *);
walther@59945
    33
type T = single list;
walther@59945
    34
walther@59945
    35
fun pat2str (field, (dsc, id)) = pair2str (field, pair2str (UnparseC.term dsc, UnparseC.term id));
walther@59945
    36
fun to_string pats = (strs2str o (map pat2str)) pats;
walther@59945
    37
fun pat2str' (field, (dsc, id)) = pair2str (field, pair2str (UnparseC.term dsc, UnparseC.term id)) ^ "\n";
walther@59945
    38
fun to_string' pats = (strs2str o (map pat2str')) pats;
walther@59882
    39
walther@59882
    40
(**)end(**)