src/Tools/isac/Knowledge/Simplify.thy
author Walther Neuper <wneuper@ist.tugraz.at>
Thu, 15 Mar 2018 12:42:04 +0100
changeset 59406 509d70b507e5
parent 59389 627d25067f2f
child 59411 3e241a6938ce
permissions -rw-r--r--
separate structure Celem: CALC_ELEMENT, finished on src/
     1 (* simplification of terms
     2    author: Walther Neuper 050912
     3    (c) due to copyright terms
     4 *)
     5 
     6 theory Simplify imports Atools begin
     7 
     8 consts
     9 
    10   (*descriptions in the related problem*)
    11   Term        :: "real => una"
    12 (*TERM -->   Const ("Pure.term", "RealDef.real => prop")  (*!!!*) $ 
    13                Free ("ttt", "RealDef.real")
    14   term -->   Free ("term", "RealDef.real => RealDef.real") $
    15                Free ("ttt", "RealDef.real")
    16     but 'term' is a keyword in *.thy*)
    17   normalform  :: "real => una"
    18 
    19   (*the CAS-command*)
    20   Simplify    :: "real => real"  (*"Simplify (1+2a+3+4a)*)
    21   Vereinfache :: "real => real"  (*"Vereinfache (1+2a+3+4a)*)
    22 
    23   (*Script-name*)
    24   SimplifyScript      :: "[real,  real] => real"
    25                   ("((Script SimplifyScript (_ =))// (_))" 9)
    26 
    27 ML {*
    28 val thy = @{theory};
    29 *}
    30 (** problems **)
    31 setup {* KEStore_Elems.add_pbts
    32   [(Specify.prep_pbt thy "pbl_simp" [] Celem.e_pblID
    33       (["simplification"],
    34         [("#Given" ,["Term t_t"]),
    35           ("#Find"  ,["normalform n_n"])],
    36         Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*)], SOME "Simplify t_t", [])),
    37     (Specify.prep_pbt thy "pbl_vereinfache" [] Celem.e_pblID
    38       (["vereinfachen"],
    39         [("#Given", ["Term t_t"]),
    40           ("#Find", ["normalform n_n"])],
    41         Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*)], SOME "Vereinfache t_t", []))] *}
    42 
    43 (** methods **)
    44 setup {* KEStore_Elems.add_mets
    45   [Specify.prep_met thy "met_tsimp" [] Celem.e_metID
    46 	    (["simplification"],
    47 	      [("#Given" ,["Term t_t"]),
    48 		      ("#Find"  ,["normalform n_n"])],
    49 		    {rew_ord'="tless_true", rls'= Celem.e_rls, calc = [], srls = Celem.e_rls, prls=Celem.e_rls, crls = Celem.e_rls,
    50 		      errpats = [], nrls = Celem.e_rls},
    51 	      "empty_script")]
    52 *}
    53 
    54 ML {*
    55 
    56 (** CAS-command **)
    57 
    58 (*.function for handling the cas-input "Simplify (2*a + 3*a)":
    59    make a model which is already in ctree-internal format.*)
    60 (* val (h,argl) = strip_comb (str2term "Simplify (2*a + 3*a)");
    61    val (h,argl) = strip_comb ((Thm.term_of o the o (parse (Thy_Info_get_theory "Simplify"))) 
    62 				  "Simplify (2*a + 3*a)");
    63    *)
    64 fun argl2dtss t =
    65     [((Thm.term_of o the o (TermC.parse thy)) "Term", t),
    66      ((Thm.term_of o the o (TermC.parse thy)) "normalform", 
    67       [(Thm.term_of o the o (TermC.parse thy)) "N"])
    68      ]
    69   (*| argl2dtss _ = error "Simplify.ML: wrong argument for argl2dtss"*);
    70 *}
    71 setup {* KEStore_Elems.add_cas
    72   [((Thm.term_of o the o (TermC.parse thy)) "Simplify",  
    73     (("Isac", ["simplification"], ["no_met"]), argl2dtss)),
    74    ((Thm.term_of o the o (TermC.parse thy)) "Vereinfache",  
    75      (("Isac", ["vereinfachen"], ["no_met"]), argl2dtss))]*}
    76 
    77 end