src/Tools/isac/BaseDefinitions/error-pattern-def.sml
author Walther Neuper <walther.neuper@jku.at>
Wed, 29 Apr 2020 09:03:01 +0200
changeset 59919 3a7fb975af9d
parent 59909 821f038df564
child 60557 0be383bdb883
permissions -rw-r--r--
comments on relation between files.

note: higher order functions might allow for re-union.
     1 (* Title:  BaseDefinitions/error-pattern-def.sml
     2    Author: Walther Neuper
     3    (c) due to copyright terms
     4 
     5 Here is a minimum of code required for theory Know_Store,
     6 further code see structure Error_Pattern.
     7 *)
     8 signature ERROR_PATTERN_DEFINITION =
     9 sig
    10   eqtype id
    11   type T = id * term list * thm list
    12   val s_to_string : T list -> string
    13 
    14   type fill_in_id
    15   type fill_in
    16 end
    17 
    18 (**)
    19 structure Error_Pattern_Def(**): ERROR_PATTERN_DEFINITION(**) =
    20 struct
    21 (**)
    22 
    23 type id = Rule_Def.errpatID
    24 
    25 type T =
    26   id          (* one identifier for a list of patterns                    *)
    27   * term list (* error patterns                                           *)
    28   * thm list  (* thms related to error patterns; note that respective lhs 
    29                  do not match (which reflects student's error).
    30                  fillpatterns are stored with these thms.                 *)
    31 fun errpat2str (id, tms, thms) =
    32   "(\"" ^ id ^ "\",\n" ^ UnparseC.terms tms ^ ",\n" ^ ThmC_Def.string_of_thms thms
    33 fun s_to_string errpats = (strs2str' o (map errpat2str)) errpats
    34 
    35 (* for (at least) 2 kinds of access:
    36   (1) given an id, find the respective fill_in's (e.g. in fun find_fill_patterns)
    37   (2) given a thm, find respective fill_in's *)
    38 type fill_in_id = string
    39 type fill_in =
    40   fill_in_id  (* DESIGN ?TODO: give an order w.r.t difficulty ? *)
    41   * term      (* the pattern with fill-in gaps                  *)
    42   * id;       (* which the fill_in would be a help for          
    43                  DESIGN ?TODO: list for several patterns ?      *)
    44 
    45 (**)end(**)