src/Tools/isac/MathEngBasic/model-def.sml
author Walther Neuper <walther.neuper@jku.at>
Wed, 13 May 2020 11:34:05 +0200
changeset 59971 2909d58a5c5d
parent 59957 d63363c45af6
child 59976 950922a768ca
permissions -rw-r--r--
shift code from struct.Specify to appropriate locations
walther@59937
     1
(* Title:  MathEngBasic/calc-tree-elem.sml
walther@59937
     2
   Author: Walther Neuper 191026
walther@59937
     3
   (c) due to copyright terms
walther@59952
     4
walther@59952
     5
Definitions for Tactic.T and Ctree.
walther@59937
     6
*)
walther@59937
     7
signature MODEL_DEFINITION =
walther@59937
     8
sig
walther@59952
     9
walther@59941
    10
  type form_T
walther@59941
    11
  type form_model
walther@59952
    12
  type form_spec
walther@59952
    13
  val form_empty : form_T
walther@59941
    14
walther@59952
    15
  type variants
walther@59952
    16
  type m_field = Model_Pattern.m_field
walther@59952
    17
  type descriptor = Model_Pattern.descriptor
walther@59941
    18
walther@59940
    19
  type o_model
walther@59940
    20
  type o_model_single
walther@59957
    21
  val o_model_to_string : o_model -> string
walther@59957
    22
  val o_model_single_to_string : o_model_single -> string
walther@59940
    23
  val o_model_empty : o_model_single
walther@59940
    24
walther@59952
    25
  type i_model
walther@59952
    26
  type i_model_single
walther@59940
    27
  datatype i_model_feedback = Cor of (term * (term list)) * (term * (term list))
walther@59940
    28
    | Syn of TermC.as_string | Typ of TermC.as_string | Inc of (term * (term list))	* (term * (term list))
walther@59940
    29
    | Sup of (term * (term list)) | Mis of (term * term) | Par of TermC.as_string
walther@59940
    30
  val i_model_empty : i_model_single
walther@59937
    31
end
walther@59937
    32
walther@59937
    33
(**)                   
walther@59941
    34
structure Model_Def(**): MODEL_DEFINITION(**) =        
walther@59937
    35
struct
walther@59937
    36
(**)
walther@59937
    37
walther@59952
    38
type m_field = Model_Pattern.m_field;
walther@59952
    39
type descriptor = Model_Pattern.descriptor;
walther@59952
    40
walther@59952
    41
(** definitions for Formalise.T **)
walther@59952
    42
walther@59941
    43
type form_model = TermC.as_string list;
walther@59941
    44
type form_spec = Spec.T;
walther@59941
    45
type form_T = form_model * form_spec;
walther@59941
    46
val form_empty = ([], Spec.empty);
walther@59941
    47
walther@59937
    48
walther@59952
    49
type variants = int list; (* variants given by Formalise.T *)
walther@59952
    50
walther@59952
    51
(** definitions for O_Model.T **)
walther@59952
    52
walther@59940
    53
type o_model_single =
walther@59952
    54
  (int *           (* sequence of input, 0 = untouched, drop with PIDE *)
walther@59952
    55
	variants * (* pointers to variants given in Formalise.T        *)
walther@59952
    56
	m_field *  (* #Given | #Find | #Relat                          *)
walther@59952
    57
	term *     (* descriptor, see Input_Descript.thy               *)
walther@59952
    58
	term list  (* isalist2list t | [t]                             *)
walther@59937
    59
	);
walther@59940
    60
type o_model = o_model_single list;
walther@59940
    61
val o_model_empty = (0, [], "", TermC.empty, [TermC.empty]) : o_model_single;
walther@59937
    62
walther@59957
    63
fun o_model_single_to_string (i, vs, fi, t, ts) = 
walther@59937
    64
  "(" ^ string_of_int i ^ ", " ^ (strs2str o (map string_of_int)) vs ^ ", " ^ fi ^ "," ^
walther@59937
    65
  UnparseC.term t ^ ", " ^ (strs2str o (map UnparseC.term)) ts ^ ")";
walther@59957
    66
val o_model_to_string = strs2str' o (map (linefeed o o_model_single_to_string));
walther@59937
    67
walther@59937
    68
walther@59952
    69
(** definitions for I_Model.T **)
walther@59952
    70
walther@59940
    71
datatype i_model_feedback = 
walther@59952
    72
  Cor of (term *   (* correct input: descriptor, see Input_Descript.thy    *)
walther@59952
    73
    (term list)) *            (* set as list for element-wise input        *)
walther@59952
    74
   (term * (term list))       (* elem of penv -?- penv delayed to future   *)
walther@59952
    75
| Syn of TermC.as_string      (* syntax error: drop with PIDE ?            *)
walther@59952
    76
| Typ of TermC.as_string      (* type error: drop with PIDE ?              *)
walther@59952
    77
| Inc of (term * (term list))	* (term * (term list)) (* penv -?-           *)
walther@59952
    78
| Sup of (term * (term list)) (* superfluous; input not found in O_Model.T *)
walther@59952
    79
| Mis of (term * term)        (* missing; for feedback                     *)
walther@59952
    80
| Par of TermC.as_string;     (* internal state from fun parsitm           *)
walther@59937
    81
walther@59940
    82
type i_model_single = 
walther@59952
    83
  int *             (* sequence of input, 0 = untouched, drop with PIDE ?  *)
walther@59952
    84
  variants *        (* pointers to variants given in Formalise.T           *)
walther@59952
    85
  bool *            (* input on this item is not/complete                  *)
walther@59952
    86
  m_field *         (* #Given | #Find | #Relate                            *)
walther@59952
    87
  i_model_feedback; (* see above                                           *)
walther@59971
    88
type i_model = i_model_single list;
walther@59940
    89
val i_model_empty = (0, [], false, "i_model_empty", Syn "i_model_empty");
walther@59937
    90
walther@59937
    91
(**)end(**)