src/Tools/isac/Specify/p-model.sml
author Walther Neuper <walther.neuper@jku.at>
Mon, 11 May 2020 11:07:19 +0200
changeset 59960 d0637de46bfa
parent 59959 0f0718c61f68
child 59962 6a59d252345d
permissions -rw-r--r--
separate struct.Refine, Pre_Conds.
walther@59960
     1
(* Title: Specify/p-model.sml
wneuper@59316
     2
   Author: Walther Neuper 170207
wneuper@59316
     3
   (c) due to copyright terms
walther@59959
     4
walther@59959
     5
This will be dropped at switch to Isabelle/PIDE.
wneuper@59316
     6
*)
wneuper@59316
     7
walther@59959
     8
signature PRESENTATION_MODEL =
wneuper@59316
     9
sig
wneuper@59316
    10
  datatype item
walther@59865
    11
  = Correct of TermC.as_string | False of TermC.as_string | Incompl of TermC.as_string | Missing of TermC.as_string | Superfl of string
wneuper@59316
    12
     | SyntaxE of string | TypeE of string
walther@59943
    13
wneuper@59316
    14
  type 'a ppc
wneuper@59316
    15
  val empty_ppc : item ppc
wneuper@59316
    16
  val ppc2str : {Find: string list, Given: string list, Relate: string list, Where: string list,
wneuper@59316
    17
    With: string list} -> string
wneuper@59316
    18
  val itemppc2str : item ppc -> string
wneuper@59316
    19
wneuper@59316
    20
  val mkval' : term list -> term
wneuper@59316
    21
wneuper@59316
    22
(* ---- for tests only: shifted from below to remove the Warning "unused" at fun.def. --------- *)
walther@59943
    23
  (* NONE *)
walther@59886
    24
(*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\* )
wneuper@59316
    25
  (* NONE *)
walther@59886
    26
( *\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*)
wneuper@59316
    27
end
wneuper@59316
    28
walther@59959
    29
structure P_Model(**) : PRESENTATION_MODEL(**) =
wneuper@59316
    30
struct
wneuper@59316
    31
wneuper@59316
    32
fun mkval _(*dsc*) [] = error "mkval called with []"
wneuper@59316
    33
  | mkval _ [t] = t
wneuper@59389
    34
  | mkval _ ts = TermC.list2isalist ((type_of o hd) ts) ts;
walther@59861
    35
fun mkval' x = mkval TermC.empty x;
wneuper@59316
    36
wneuper@59316
    37
(* for _output_ of the items of a Model *)
wneuper@59316
    38
datatype item = 
walther@59865
    39
    Correct of TermC.as_string (* labels a correct formula (type cterm') *)
wneuper@59316
    40
  | SyntaxE of string (**)
wneuper@59316
    41
  | TypeE   of string (**)
walther@59865
    42
  | False   of TermC.as_string (* WN050618 notexistent in itm_: only used in Where *)
walther@59865
    43
  | Incompl of TermC.as_string (**)
wneuper@59316
    44
  | Superfl of string (**)
walther@59865
    45
  | Missing of TermC.as_string;
walther@59937
    46
fun item2str (Correct  s) = "Correct " ^ s
walther@59937
    47
  | item2str (SyntaxE  s) = "SyntaxE " ^ s
walther@59937
    48
  | item2str (TypeE    s) = "TypeE " ^ s
walther@59937
    49
  | item2str (False    s) = "False " ^ s
walther@59937
    50
  | item2str (Incompl  s) = "Incompl " ^ s
walther@59937
    51
  | item2str (Superfl  s) = "Superfl " ^ s
walther@59937
    52
  | item2str (Missing  s) = "Missing " ^ s;
walther@59937
    53
wneuper@59316
    54
type 'a ppc = 
wneuper@59316
    55
  {Given : 'a list, Where: 'a list, Find  : 'a list, With : 'a list, Relate: 'a list};
wneuper@59316
    56
fun ppc2str {Given = Given, Where = Where, Find = Find, With = With, Relate = Relate}=
wneuper@59316
    57
  "{Given =" ^ strs2str Given ^ ",Where=" ^ strs2str Where ^ ",Find  =" ^ strs2str Find ^
wneuper@59316
    58
  ",With =" ^ strs2str With ^ ",Relate=" ^ strs2str Relate ^ "}";
wneuper@59316
    59
wneuper@59316
    60
fun itemppc2str ({Given=Given,Where=Where,
wneuper@59316
    61
		 Find=Find,With=With,Relate=Relate}:item ppc)=
wneuper@59316
    62
    ("{Given =" ^ ((strs2str' o (map item2str))	 Given ) ^
wneuper@59316
    63
     ",Where=" ^ ((strs2str' o (map item2str))	 Where) ^
wneuper@59316
    64
     ",Find  =" ^ ((strs2str' o (map item2str))	 Find  ) ^
wneuper@59316
    65
     ",With =" ^ ((strs2str' o (map item2str))	 With ) ^
wneuper@59316
    66
     ",Relate=" ^ ((strs2str' o (map item2str))	 Relate) ^ "}");
wneuper@59316
    67
wneuper@59316
    68
val empty_ppc = {Given = [], Where= [], Find  = [], With = [], Relate= []};
wneuper@59316
    69
walther@59938
    70
(**)end(**);