src/Tools/isac/BaseDefinitions/problem-def.sml
author Walther Neuper <walther.neuper@jku.at>
Wed, 29 Apr 2020 09:03:01 +0200
changeset 59919 3a7fb975af9d
parent 59914 ab5bd5c37e13
child 59945 bdc420a363d8
permissions -rw-r--r--
comments on relation between files.

note: higher order functions might allow for re-union.
walther@59892
     1
(* Title:  BaseDefinitions/problem-def.sml
walther@59882
     2
   Author: Walther Neuper
walther@59882
     3
   (c) due to copyright terms
walther@59882
     4
walther@59919
     5
Here is a minimum of code required for Know_Store.thy.
walther@59919
     6
For main code see structure Problem.
walther@59892
     7
*)
walther@59893
     8
signature PROBLEM_DEFINITION =
walther@59882
     9
sig
walther@59903
    10
  type id = Spec.id
walther@59903
    11
  val id_empty: id
walther@59903
    12
  val id_to_string: id -> string
walther@59894
    13
(*type pbt*)
walther@59894
    14
  type T
walther@59897
    15
(*val e_Ptyp: T Store.node*)
walther@59897
    16
  val empty_store: T Store.node
walther@59904
    17
(*val check_pblguh_unique: Check_Unique.id -> T Store.T -> unit*)
walther@59904
    18
  val check_unique: Check_Unique.id -> T Store.T -> unit
walther@59894
    19
walther@59882
    20
(* ---- for tests only: shifted from below to remove the Warning "unused" at fun.def. --------- *)
walther@59894
    21
(*type ptyps*)
walther@59894
    22
  type store
walther@59894
    23
(*val e_pbt: T*)
walther@59894
    24
  val empty: T
walther@59894
    25
(*val pbts2str: T list -> string*)
walther@59894
    26
  val s_to_string: T list -> string
walther@59886
    27
(*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\* )
walther@59882
    28
  (*NONE*)
walther@59886
    29
( *\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*)
walther@59882
    30
end
walther@59882
    31
walther@59882
    32
(**)
walther@59893
    33
structure Probl_Def(**): PROBLEM_DEFINITION(**) =
walther@59882
    34
struct
walther@59882
    35
(**)
walther@59882
    36
walther@59903
    37
type id = Spec.id;
walther@59903
    38
val id_empty = Spec.empty_probl_id;
walther@59903
    39
val id_to_string = Spec.id_to_string;
walther@59903
    40
walther@59894
    41
type T = 
walther@59904
    42
  {guh : Check_Unique.id,         (* unique within this isac-knowledge                               *)
walther@59884
    43
  mathauthors : string list, (* copyright                                                *)
walther@59903
    44
  init : Spec.id,       (* to start refinement with                                        *)
walther@59894
    45
  thy  : theory,      (* which allows to compile that T
walther@59884
    46
                        TODO: search generalized for subthy (ref.p.69*)
walther@59884
    47
                        (*^^^ WN050912 NOT used during application of the problem,
walther@59884
    48
                        because applied terms may be from 'subthy' as well as from super;
walther@59884
    49
                        thus we take 'maxthy'; see match_ags !                           *)
walther@59884
    50
  cas : term option,  (* 'CAS-command'                                                   *)
walther@59903
    51
  met : Spec.id list,   (* methods solving the T                                         *)
walther@59884
    52
(*TODO: abstract to ?pre_model?...*)
walther@59884
    53
  prls : Rule_Set.T,    (* for preds in where_                                             *)
walther@59884
    54
  where_ : term list, (* where - predicates                                              *)
walther@59884
    55
  ppc : Celem4.pat list      (* this is the model-pattern; 
walther@59884
    56
                         it contains "#Given","#Where","#Find","#Relate"-patterns
walther@59884
    57
                         for constraints on identifiers see "fun cpy_nam"                *)
walther@59884
    58
}   
walther@59903
    59
val empty = {guh = "pbl_empty", mathauthors = [], init = id_empty, thy = Thy_Info.get_theory "Pure",
walther@59894
    60
  cas = NONE, prls = Rule_Set.Empty, where_ = [], ppc = [], met = []} : T
walther@59884
    61
fun pbt2str ({cas = cas', guh = guh', init = init', mathauthors = ma', met = met', ppc = ppc',
walther@59894
    62
      prls = prls', thy = thy', where_ = w'} : T)
walther@59884
    63
    = "{cas = " ^ (UnparseC.term_opt cas') ^  ", guh = \"" ^ guh'  ^ "\", init = "
walther@59884
    64
      ^ (strs2str init') ^ ", mathauthors = " ^ (strs2str ma' |> quote) ^ ", met = "
walther@59884
    65
      ^ (strslist2strs met') ^ ", ppc = " ^ Celem4.pats2str ppc' ^ ", prls = "
walther@59884
    66
      ^ (Rule_Set.id prls' |> quote) ^ ", thy = {" ^ Context.theory_name thy' ^ "}, where_ = "
walther@59884
    67
      ^ (UnparseC.terms w') ^ "}" |> linefeed;
walther@59894
    68
fun s_to_string pbts = map pbt2str pbts |> list2str;
walther@59914
    69
walther@59903
    70
val empty_store = Store.Node ("empty_probl_id", [empty], [])
walther@59897
    71
type store = (T Store.node) list
walther@59882
    72
walther@59894
    73
val check_unique =
walther@59904
    74
  Check_Unique.message (Check_Unique.collect (#guh : T -> Check_Unique.id));
walther@59892
    75
walther@59882
    76
(**)end(**)