src/Tools/isac/BaseDefinitions/problem-def.sml
author wneuper <Walther.Neuper@jku.at>
Wed, 11 Jan 2023 11:38:01 +0100
changeset 60650 06ec8abfd3bc
parent 60586 007ef64dbb08
child 60655 f73460617c3d
permissions -rw-r--r--
eliminate use of Thy_Info 12: TermC partially
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@59985
    10
  type id = References_Def.id
walther@59903
    11
  val id_empty: id
walther@59903
    12
  val id_to_string: id -> string
Walther@60514
    13
walther@59894
    14
  type T
Walther@60514
    15
  val empty: T
Walther@60514
    16
Walther@60514
    17
  type store
walther@59897
    18
  val empty_store: T Store.node
Walther@60514
    19
walther@59904
    20
  val check_unique: Check_Unique.id -> T Store.T -> unit
walther@59894
    21
  val s_to_string: T list -> string
walther@59882
    22
end
walther@59882
    23
walther@59882
    24
(**)
walther@59893
    25
structure Probl_Def(**): PROBLEM_DEFINITION(**) =
walther@59882
    26
struct
walther@59882
    27
(**)
walther@59882
    28
walther@59985
    29
type id = References_Def.id;
walther@59985
    30
val id_empty = References_Def.empty_probl_id;
walther@59985
    31
val id_to_string = References_Def.id_to_string;
walther@59903
    32
walther@59894
    33
type T = 
walther@60022
    34
  {guh : Check_Unique.id,    (* unique within Isac_Knowledge, for html-presentation      *)
walther@60228
    35
  mathauthors : string list, (* copyright                                                *)
Walther@60585
    36
  start_refine : References_Def.id,  (* to start refinement with                         *)
Walther@60583
    37
  thy  : theory,      (* which allows to compile that T                                  *)
walther@59884
    38
                        (*^^^ WN050912 NOT used during application of the problem,
walther@59884
    39
                        because applied terms may be from 'subthy' as well as from super;
walther@59884
    40
                        thus we take 'maxthy'; see match_ags !                           *)
walther@60022
    41
  cas : term option,         (* CAS_Cmd                                                  *)
Walther@60585
    42
  solve_mets : References_Def.id list,   (* methods solving the T                               *)
Walther@60585
    43
  where_rls : Rule_Set.T,         (* for evaluation of preconditions in "#Where" on "#Given"  *)
walther@60022
    44
  where_ : term list,        (* ? DEL, as soon as they are input interactively ?         *)
Walther@60585
    45
  model : Model_Pattern.T      (* contains "#Given", "#Find", "#Relate"
Walther@60469
    46
                                for constraints on identifiers see "O_Model.copy_name"   *)
walther@59884
    47
}   
Walther@60585
    48
val empty = {guh = "pbl_empty", mathauthors = [], start_refine = id_empty, thy = @{theory "Pure"},
Walther@60585
    49
  cas = NONE, where_rls = Rule_Set.Empty, where_ = [], model = [], solve_mets = []} : T
Walther@60586
    50
fun pbt2str ({cas = cas', guh = guh', start_refine = init', mathauthors = ma', solve_mets = met', model = model',
Walther@60585
    51
      where_rls = prls', thy = thy', where_ = w'} : T)
Walther@60585
    52
    = "{cas = " ^ (UnparseC.term_opt cas') ^  ", guh = \"" ^ guh'  ^ "\", start_refine = "
Walther@60585
    53
      ^ (strs2str init') ^ ", mathauthors = " ^ (strs2str ma' |> quote) ^ ", solve_mets = "
Walther@60586
    54
      ^ (strslist2strs met') ^ ", model = " ^ Model_Pattern.to_string model' ^ ", where_rls = "
walther@59884
    55
      ^ (Rule_Set.id prls' |> quote) ^ ", thy = {" ^ Context.theory_name thy' ^ "}, where_ = "
walther@59884
    56
      ^ (UnparseC.terms w') ^ "}" |> linefeed;
walther@59894
    57
fun s_to_string pbts = map pbt2str pbts |> list2str;
walther@59914
    58
walther@59903
    59
val empty_store = Store.Node ("empty_probl_id", [empty], [])
walther@59897
    60
type store = (T Store.node) list
walther@59882
    61
walther@59894
    62
val check_unique =
walther@59904
    63
  Check_Unique.message (Check_Unique.collect (#guh : T -> Check_Unique.id));
walther@59892
    64
Walther@60556
    65
(**)end(*struct*)