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