separate structure Celem: CALC_ELEMENT, finished on src/
authorWalther Neuper <wneuper@ist.tugraz.at>
Thu, 15 Mar 2018 12:42:04 +0100
changeset 59406509d70b507e5
parent 59405 49d7d410b83c
child 59407 f2eeb932eb26
separate structure Celem: CALC_ELEMENT, finished on src/
src/Tools/isac/Build_Isac.thy
src/Tools/isac/Isac_Protocol.thy
src/Tools/isac/Knowledge/AlgEin.thy
src/Tools/isac/Knowledge/Atools.thy
src/Tools/isac/Knowledge/Biegelinie.thy
src/Tools/isac/Knowledge/Build_Thydata.thy
src/Tools/isac/Knowledge/Diff.thy
src/Tools/isac/Knowledge/DiffApp-scrpbl.sml
src/Tools/isac/Knowledge/DiffApp.sml
src/Tools/isac/Knowledge/DiffApp.thy
src/Tools/isac/Knowledge/DiophantEq.thy
src/Tools/isac/Knowledge/EqSystem.thy
src/Tools/isac/Knowledge/Equation.thy
src/Tools/isac/Knowledge/InsSort.thy
src/Tools/isac/Knowledge/Integrate.thy
src/Tools/isac/Knowledge/Inverse_Z_Transform.thy
src/Tools/isac/Knowledge/LinEq.thy
src/Tools/isac/Knowledge/LogExp.thy
src/Tools/isac/Knowledge/Partial_Fractions.thy
src/Tools/isac/Knowledge/Poly.thy
src/Tools/isac/Knowledge/PolyEq.thy
src/Tools/isac/Knowledge/PolyMinus.thy
src/Tools/isac/Knowledge/RatEq.thy
src/Tools/isac/Knowledge/Rational-WN.sml
src/Tools/isac/Knowledge/Rational.thy
src/Tools/isac/Knowledge/Root.thy
src/Tools/isac/Knowledge/RootEq.thy
src/Tools/isac/Knowledge/RootRat.thy
src/Tools/isac/Knowledge/RootRatEq.thy
src/Tools/isac/Knowledge/Simplify.thy
src/Tools/isac/Knowledge/Test.thy
src/Tools/isac/calcelems.sml
     1.1 --- a/src/Tools/isac/Build_Isac.thy	Thu Mar 15 10:17:44 2018 +0100
     1.2 +++ b/src/Tools/isac/Build_Isac.thy	Thu Mar 15 12:42:04 2018 +0100
     1.3 @@ -115,7 +115,7 @@
     1.4  ML {* @{thm last_thmI} (*from Atools.thy*) *}
     1.5  ML {*@{thm Querkraft_Belastung}*}
     1.6  
     1.7 -ML {* check_guhs_unique := false; *}
     1.8 +ML {* Celem.check_guhs_unique := false; *}
     1.9  ML {* writeln "**** isac kernel = math-engine + Knowledge complete ******" *}
    1.10  ML {* @{theory "Isac"} *}
    1.11  ML {* (*get_the ["IsacKnowledge", "Diff", "Theorems", "diff_sin_chain"]
     2.1 --- a/src/Tools/isac/Isac_Protocol.thy	Thu Mar 15 10:17:44 2018 +0100
     2.2 +++ b/src/Tools/isac/Isac_Protocol.thy	Thu Mar 15 12:42:04 2018 +0100
     2.3 @@ -9,7 +9,7 @@
     2.4  	   val (calcid, cterm') = case intree of
     2.5         XML.Elem (("APPENDFORMULA", []), [
     2.6           XML.Elem (("CALCID", []), [XML.Text ci]),
     2.7 -         form]) => (ci |> TermC.int_of_str, form |> xml_to_term_NEW |> term2str)
     2.8 +         form]) => (ci |> TermC.int_of_str, form |> xml_to_term_NEW |> Celem.term2str)
     2.9       | x => raise ERROR ("append_form: WRONG intree = " ^ xmlstr 0 x)
    2.10       val result = Kernel.appendFormula calcid cterm'
    2.11  	 in result end)
    2.12 @@ -550,7 +550,7 @@
    2.13  	   val (calcid, cterm') = case intree of
    2.14         XML.Elem (("REPLACEFORMULA", []), [
    2.15           XML.Elem (("CALCID", []), [XML.Text ci]), form]) 
    2.16 -       => (ci |> TermC.int_of_str, form |> xml_to_term_NEW |> term2str)
    2.17 +       => (ci |> TermC.int_of_str, form |> xml_to_term_NEW |> Celem.term2str)
    2.18       | tree => raise ERROR ("replace_form: WRONG intree = " ^ xmlstr 0 tree)
    2.19       val result = Kernel.replaceFormula calcid cterm'
    2.20  	 in result end)
     3.1 --- a/src/Tools/isac/Knowledge/AlgEin.thy	Thu Mar 15 10:17:44 2018 +0100
     3.2 +++ b/src/Tools/isac/Knowledge/AlgEin.thy	Thu Mar 15 12:42:04 2018 +0100
     3.3 @@ -26,35 +26,35 @@
     3.4  *}
     3.5  (** problems **)
     3.6  setup {* KEStore_Elems.add_pbts
     3.7 -  [(Specify.prep_pbt thy "pbl_algein" [] e_pblID (["Berechnung"], [], e_rls, NONE, [])),
     3.8 -    (Specify.prep_pbt thy "pbl_algein_numsym" [] e_pblID
     3.9 +  [(Specify.prep_pbt thy "pbl_algein" [] Celem.e_pblID (["Berechnung"], [], Celem.e_rls, NONE, [])),
    3.10 +    (Specify.prep_pbt thy "pbl_algein_numsym" [] Celem.e_pblID
    3.11        (["numerischSymbolische", "Berechnung"],
    3.12          [("#Given",
    3.13              ["KantenLaenge k_k","Querschnitt q__q"(*q_ in Biegelinie.thy*), "KantenUnten u_u",
    3.14                "KantenSenkrecht s_s", "KantenOben o_o"]),
    3.15            ("#Find", ["GesamtLaenge l_l"])],
    3.16 -        e_rls, NONE, [["Berechnung","erstNumerisch"], ["Berechnung","erstSymbolisch"]]))]; *}
    3.17 +        Celem.e_rls, NONE, [["Berechnung","erstNumerisch"], ["Berechnung","erstSymbolisch"]]))]; *}
    3.18  
    3.19  setup {* KEStore_Elems.add_mets
    3.20 -  [Specify.prep_met thy "met_algein" [] e_metID
    3.21 +  [Specify.prep_met thy "met_algein" [] Celem.e_metID
    3.22  	    (["Berechnung"], [],
    3.23 -	      {rew_ord'="tless_true", rls'= Erls, calc = [], srls = Erls, prls = Erls, crls =Erls,
    3.24 -          errpats = [], nrls = Erls},
    3.25 +	      {rew_ord'="tless_true", rls'= Celem.Erls, calc = [], srls = Celem.Erls, prls = Celem.Erls, crls =Celem.Erls,
    3.26 +          errpats = [], nrls = Celem.Erls},
    3.27          "empty_script"),
    3.28 -    Specify.prep_met thy "met_algein_numsym" [] e_metID
    3.29 +    Specify.prep_met thy "met_algein_numsym" [] Celem.e_metID
    3.30  	    (["Berechnung","erstNumerisch"], [],
    3.31 -	      {rew_ord'="tless_true", rls'= Erls, calc = [], srls = Erls, prls = Erls, crls =Erls,
    3.32 -	        errpats = [], nrls = Erls},
    3.33 +	      {rew_ord'="tless_true", rls'= Celem.Erls, calc = [], srls = Celem.Erls, prls = Celem.Erls, crls =Celem.Erls,
    3.34 +	        errpats = [], nrls = Celem.Erls},
    3.35  	      "empty_script"),
    3.36 -    Specify.prep_met thy "met_algein_numsym" [] e_metID
    3.37 +    Specify.prep_met thy "met_algein_numsym" [] Celem.e_metID
    3.38  	    (["Berechnung","erstNumerisch"],
    3.39  	       [("#Given" ,["KantenLaenge k_k","Querschnitt q__q", "KantenUnten u_u",
    3.40  	           "KantenSenkrecht s_s", "KantenOben o_o"]),
    3.41  	         ("#Find"  ,["GesamtLaenge l_l"])],
    3.42 -	       {rew_ord'="tless_true", rls'= e_rls, calc = [],
    3.43 -           srls = append_rls "srls_..Berechnung-erstSymbolisch" e_rls 
    3.44 -				       [Calc ("Atools.boollist2sum", eval_boollist2sum "")], 
    3.45 -		       prls = e_rls, crls =e_rls , errpats = [], nrls = norm_Rational},
    3.46 +	       {rew_ord'="tless_true", rls'= Celem.e_rls, calc = [],
    3.47 +           srls = Celem.append_rls "srls_..Berechnung-erstSymbolisch" Celem.e_rls 
    3.48 +				       [Celem.Calc ("Atools.boollist2sum", eval_boollist2sum "")], 
    3.49 +		       prls = Celem.e_rls, crls =Celem.e_rls , errpats = [], nrls = norm_Rational},
    3.50           "Script RechnenSymbolScript (k_k::bool) (q__q::bool)           " ^
    3.51             "(u_u::bool list) (s_s::bool list) (o_o::bool list) (l_l::real) =" ^
    3.52             " (let t_t = Take (l_l = oben + senkrecht + unten);            " ^
    3.53 @@ -74,15 +74,15 @@
    3.54             "      t_t = Substitute [k_k, q__q] t_t;                         " ^
    3.55             "      t_t = (Repeat (Try (Rewrite_Set norm_Poly False))) t_t  " ^
    3.56             " in (Try (Rewrite_Set norm_Poly False)) t_t)                  "),
    3.57 -    Specify.prep_met thy "met_algein_symnum" [] e_metID
    3.58 +    Specify.prep_met thy "met_algein_symnum" [] Celem.e_metID
    3.59  	    (["Berechnung","erstSymbolisch"],
    3.60  	        [("#Given" ,["KantenLaenge k_k","Querschnitt q__q", "KantenUnten u_u",
    3.61                  "KantenSenkrecht s_s", "KantenOben o_o"]),
    3.62  		        ("#Find"  ,["GesamtLaenge l_l"])],
    3.63 -	        {rew_ord'="tless_true", rls'= e_rls, calc = [], 
    3.64 -	          srls = append_rls "srls_..Berechnung-erstSymbolisch" e_rls 
    3.65 -				        [Calc ("Atools.boollist2sum", eval_boollist2sum "")], 
    3.66 -				    prls = e_rls, crls =e_rls , errpats = [], nrls = norm_Rational},
    3.67 +	        {rew_ord'="tless_true", rls'= Celem.e_rls, calc = [], 
    3.68 +	          srls = Celem.append_rls "srls_..Berechnung-erstSymbolisch" Celem.e_rls 
    3.69 +				        [Celem.Calc ("Atools.boollist2sum", eval_boollist2sum "")], 
    3.70 +				    prls = Celem.e_rls, crls =Celem.e_rls , errpats = [], nrls = norm_Rational},
    3.71              "Script RechnenSymbolScript (k_k::bool) (q__q::bool)           " ^
    3.72                "(u_u::bool list) (s_s::bool list) (o_o::bool list) (l_l::real) =" ^
    3.73                " (let t_t = Take (l_l = oben + senkrecht + unten);            " ^
     4.1 --- a/src/Tools/isac/Knowledge/Atools.thy	Thu Mar 15 10:17:44 2018 +0100
     4.2 +++ b/src/Tools/isac/Knowledge/Atools.thy	Thu Mar 15 12:42:04 2018 +0100
     4.3 @@ -118,7 +118,7 @@
     4.4  \item [*\_srls] 
     4.5  
     4.6  \end{description}
     4.7 -{\tt append_rls, merge_rls, remove_rls} TODO
     4.8 +{\tt Celem.append_rls, Celem.merge_rls, remove_rls} TODO
     4.9  *}
    4.10  
    4.11  ML {*
    4.12 @@ -136,12 +136,12 @@
    4.13  (*("occurs_in", ("Atools.occurs'_in", eval_occurs_in ""))*)
    4.14  fun eval_occurs_in _ "Atools.occurs'_in"
    4.15  	     (p as (Const ("Atools.occurs'_in",_) $ v $ t)) _ =
    4.16 -    ((*tracing("@@@ eval_occurs_in: v= "^(term2str v));
    4.17 -     tracing("@@@ eval_occurs_in: t= "^(term2str t));*)
    4.18 +    ((*tracing("@@@ eval_occurs_in: v= "^(Celem.term2str v));
    4.19 +     tracing("@@@ eval_occurs_in: t= "^(Celem.term2str t));*)
    4.20       if occurs_in v t
    4.21 -    then SOME ((term2str p) ^ " = True",
    4.22 +    then SOME ((Celem.term2str p) ^ " = True",
    4.23  	  HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
    4.24 -    else SOME ((term2str p) ^ " = False",
    4.25 +    else SOME ((Celem.term2str p) ^ " = False",
    4.26  	  HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False}))))
    4.27    | eval_occurs_in _ _ _ _ = NONE;
    4.28  
    4.29 @@ -156,9 +156,9 @@
    4.30  			  (p as (Const ("Atools.some'_occur'_in",_) 
    4.31  				       $ vs $ t)) _ =
    4.32      if some_occur_in (TermC.isalist2list vs) t
    4.33 -    then SOME ((term2str p) ^ " = True",
    4.34 +    then SOME ((Celem.term2str p) ^ " = True",
    4.35  	       HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
    4.36 -    else SOME ((term2str p) ^ " = False",
    4.37 +    else SOME ((Celem.term2str p) ^ " = False",
    4.38  	       HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
    4.39    | eval_some_occur_in _ _ _ _ = NONE;
    4.40  
    4.41 @@ -209,10 +209,10 @@
    4.42  	 else SOME (TermC.mk_thmid thmid n1 "", 
    4.43  		    HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False})))
    4.44       | Const ("Float.Float",_) =>
    4.45 -       SOME (TermC.mk_thmid thmid (term2str arg) "", 
    4.46 +       SOME (TermC.mk_thmid thmid (Celem.term2str arg) "", 
    4.47  	     HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True})))
    4.48       | _ => (*NONE*)
    4.49 -       SOME (TermC.mk_thmid thmid (term2str arg) "", 
    4.50 +       SOME (TermC.mk_thmid thmid (Celem.term2str arg) "", 
    4.51  		    HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False}))))
    4.52    | eval_const _ _ _ _ = NONE; 
    4.53  
    4.54 @@ -259,7 +259,7 @@
    4.55                (*WN071229 "Rings.divide_class.divide" never tried*)
    4.56              val rhs = var_op_float v op_ t0 T1 res
    4.57              val prop = HOLogic.Trueprop $ (TermC.mk_equality (t, rhs))
    4.58 -          in SOME ("#: " ^ term2str prop, prop) end
    4.59 +          in SOME ("#: " ^ Celem.term2str prop, prop) end
    4.60        | _ => NONE
    4.61      else NONE
    4.62    | eval_binop (thmid : string) (op_ : string) 
    4.63 @@ -273,7 +273,7 @@
    4.64              val res = calcul op0 n1 n2
    4.65              val rhs = float_op_var v op_ t0 T1 res
    4.66              val prop = HOLogic.Trueprop $ (TermC.mk_equality (t, rhs))
    4.67 -          in SOME ("#: " ^ term2str prop, prop) end
    4.68 +          in SOME ("#: " ^ Celem.term2str prop, prop) end
    4.69        | _ => NONE
    4.70      else NONE
    4.71    | eval_binop (thmid : string) _ (t as (Const (op0, t0) $ t1 $ t2)) _ =   (* binary . n1.n2 *)
    4.72 @@ -284,16 +284,16 @@
    4.73            val res = calcul op0 n1 n2;
    4.74            val rhs = term_of_float Trange res;
    4.75            val prop = HOLogic.Trueprop $ (TermC.mk_equality (t, rhs));
    4.76 -        in SOME ("#: " ^ term2str prop, prop) end
    4.77 +        in SOME ("#: " ^ Celem.term2str prop, prop) end
    4.78      | _ => NONE)
    4.79    | eval_binop _ _ _ _ = NONE; 
    4.80  (*
    4.81  > val SOME (thmid, t) = eval_binop "#add_" "Groups.plus_class.plus" (str2term "-1 + 2") thy;
    4.82 -> term2str t;
    4.83 +> Celem.term2str t;
    4.84  val it = "-1 + 2 = 1"
    4.85  > val t = str2term "-1 * (-1 * a)";
    4.86  > val SOME (thmid, t) = eval_binop "#mult_" "Groups.times_class.times" t thy;
    4.87 -> term2str t;
    4.88 +> Celem.term2str t;
    4.89  val it = "-1 * (-1 * a) = 1 * a"*)
    4.90  
    4.91  
    4.92 @@ -319,18 +319,18 @@
    4.93  > reflI;
    4.94  val it = "(?t = ?t) = True"
    4.95  > val t = str2term "x = 0";
    4.96 -> val NONE = rewrite_ thy dummy_ord e_rls false reflI t;
    4.97 +> val NONE = rewrite_ thy Celem.dummy_ord Celem.e_rls false reflI t;
    4.98  
    4.99  > val t = str2term "1 = 0";
   4.100 -> val NONE = rewrite_ thy dummy_ord e_rls false reflI t;
   4.101 ------------ thus needs Calc !
   4.102 +> val NONE = rewrite_ thy Celem.dummy_ord Celem.e_rls false reflI t;
   4.103 +----------- thus needs Celem.Calc !
   4.104  > val t = str2term "0 = 0";
   4.105 -> val SOME (t',_) = rewrite_ thy dummy_ord e_rls false reflI t;
   4.106 -> term2str t';
   4.107 +> val SOME (t',_) = rewrite_ thy Celem.dummy_ord Celem.e_rls false reflI t;
   4.108 +> Celem.term2str t';
   4.109  val it = "HOL.True"
   4.110  
   4.111  val t = str2term "Not (x = 0)";
   4.112 -atomt t; term2str t;
   4.113 +atomt t; Celem.term2str t;
   4.114  *** -------------
   4.115  *** Const ( Not)
   4.116  *** . Const ( op =)
   4.117 @@ -345,28 +345,28 @@
   4.118  	       (Const (op0,t0) $ t1 $ t2 )) thy = 
   4.119    if t1 = t2
   4.120    then SOME (TermC.mk_thmid thmid 
   4.121 -	              ("(" ^ (term_to_string''' thy t1) ^ ")")
   4.122 -	              ("(" ^ (term_to_string''' thy t2) ^ ")"), 
   4.123 +	              ("(" ^ (Celem.term_to_string''' thy t1) ^ ")")
   4.124 +	              ("(" ^ (Celem.term_to_string''' thy t2) ^ ")"), 
   4.125  	     HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True})))
   4.126    else SOME (TermC.mk_thmid thmid  
   4.127 -	              ("(" ^ (term_to_string''' thy t1) ^ ")")
   4.128 -	              ("(" ^ (term_to_string''' thy t2) ^ ")"),  
   4.129 +	              ("(" ^ (Celem.term_to_string''' thy t1) ^ ")")
   4.130 +	              ("(" ^ (Celem.term_to_string''' thy t2) ^ ")"),  
   4.131  	     HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False})))
   4.132    | eval_ident _ _ _ _ = NONE;
   4.133  (* TODO
   4.134  > val t = str2term "x =!= 0";
   4.135  > val SOME (str, t') = eval_ident "ident_" "b" t thy;
   4.136 -> term2str t';
   4.137 +> Celem.term2str t';
   4.138  val str = "ident_(x)_(0)" : string
   4.139  val it = "(x =!= 0) = False" : string                                
   4.140  > val t = str2term "1 =!= 0";
   4.141  > val SOME (str, t') = eval_ident "ident_" "b" t thy;
   4.142 -> term2str t';
   4.143 +> Celem.term2str t';
   4.144  val str = "ident_(1)_(0)" : string 
   4.145  val it = "(1 =!= 0) = False" : string                                       
   4.146  > val t = str2term "0 =!= 0";
   4.147  > val SOME (str, t') = eval_ident "ident_" "b" t thy;
   4.148 -> term2str t';
   4.149 +> Celem.term2str t';
   4.150  val str = "ident_(0)_(0)" : string
   4.151  val it = "(0 =!= 0) = True" : string
   4.152  *)
   4.153 @@ -377,14 +377,14 @@
   4.154  fun eval_equal (thmid : string) "HOL.eq" (t as (Const (op0,t0) $ t1 $ t2 )) thy = 
   4.155    if t1 = t2
   4.156    then SOME (TermC.mk_thmid thmid 
   4.157 -                ("(" ^ term_to_string''' thy t1 ^ ")")
   4.158 -                ("(" ^ term_to_string''' thy t2 ^ ")"), 
   4.159 +                ("(" ^ Celem.term_to_string''' thy t1 ^ ")")
   4.160 +                ("(" ^ Celem.term_to_string''' thy t2 ^ ")"), 
   4.161         HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True})))
   4.162    else (case (TermC.is_atom t1, TermC.is_atom t2) of
   4.163        (true, true) => 
   4.164        SOME (TermC.mk_thmid thmid  
   4.165 -         ("(" ^ term_to_string''' thy t1 ^ ")")
   4.166 -         ("(" ^ term_to_string''' thy t2 ^ ")"),
   4.167 +         ("(" ^ Celem.term_to_string''' thy t1 ^ ")")
   4.168 +         ("(" ^ Celem.term_to_string''' thy t2 ^ ")"),
   4.169        HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False})))
   4.170      | _ => NONE)                             (* NOT is_atom t1,t2 --> rew_sub *)
   4.171    | eval_equal _ _ _ _ = NONE;                                  (* error-exit *)
   4.172 @@ -395,7 +395,7 @@
   4.173  
   4.174  > val t = str2term "(x + 1) = (x + 1)";
   4.175  > val SOME (str, t') = eval_equal "equal_" "b" t thy;
   4.176 -> term2str t';
   4.177 +> Celem.term2str t';
   4.178  val str = "equal_(x + 1)_(x + 1)" : string
   4.179  val it = "(x + 1 = x + 1) = True" : string
   4.180  > val t = str2term "x = 0";
   4.181 @@ -403,12 +403,12 @@
   4.182  
   4.183  > val t = str2term "1 = 0";
   4.184  > val SOME (str, t') = eval_equal "equal_" "b" t thy;
   4.185 -> term2str t';
   4.186 +> Celem.term2str t';
   4.187  val str = "equal_(1)_(0)" : string 
   4.188  val it = "(1 = 0) = False" : string
   4.189  > val t = str2term "0 = 0";
   4.190  > val SOME (str, t') = eval_equal "equal_" "b" t thy;
   4.191 -> term2str t';
   4.192 +> Celem.term2str t';
   4.193  val str = "equal_(0)_(0)" : string
   4.194  val it = "(0 = 0) = True" : string
   4.195  *)
   4.196 @@ -449,7 +449,7 @@
   4.197  fun eval_argument_in _ "Atools.argument'_in" 
   4.198  		     (t as (Const ("Atools.argument'_in", _) $ (f $ arg))) _ =
   4.199      if is_Free arg (*could be something to be simplified before*)
   4.200 -    then SOME (term2str t ^ " = " ^ term2str arg,
   4.201 +    then SOME (Celem.term2str t ^ " = " ^ Celem.term2str arg,
   4.202  	       HOLogic.Trueprop $ (TermC.mk_equality (t, arg)))
   4.203      else NONE
   4.204    | eval_argument_in _ _ _ _ = NONE;
   4.205 @@ -463,9 +463,9 @@
   4.206  			(f1 $ _) $ 
   4.207  			(Const ("HOL.eq", _) $ (f2 $ _) $ _)) _ =
   4.208      if f1 = f2 
   4.209 -    then SOME ((term2str p) ^ " = True",
   4.210 +    then SOME ((Celem.term2str p) ^ " = True",
   4.211  	       HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
   4.212 -    else SOME ((term2str p) ^ " = False",
   4.213 +    else SOME ((Celem.term2str p) ^ " = False",
   4.214  	       HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
   4.215  | eval_sameFunId _ _ _ _ = NONE;
   4.216  
   4.217 @@ -476,7 +476,7 @@
   4.218     this is, because Isabelles filter takes more than 1 sec.*)
   4.219  fun same_funid f1 (Const ("HOL.eq", _) $ (f2 $ _) $ _) = f1 = f2
   4.220    | same_funid f1 t = error ("same_funid called with t = ("
   4.221 -				   ^term2str f1^") ("^term2str t^")");
   4.222 +				   ^Celem.term2str f1^") ("^Celem.term2str t^")");
   4.223  (*("filter_sameFunId" ,("Atools.filter'_sameFunId",
   4.224  		   eval_filter_sameFunId "Atools.filter'_sameFunId"))*)
   4.225  fun eval_filter_sameFunId _ "Atools.filter'_sameFunId" 
   4.226 @@ -484,7 +484,7 @@
   4.227  			(fid $ _) $ fs) _ =
   4.228      let val fs' = ((TermC.list2isalist HOLogic.boolT) o 
   4.229  		   (filter (same_funid fid))) (TermC.isalist2list fs)
   4.230 -    in SOME (term2str (TermC.mk_equality (p, fs')),
   4.231 +    in SOME (Celem.term2str (TermC.mk_equality (p, fs')),
   4.232  	       HOLogic.Trueprop $ (TermC.mk_equality (p, fs'))) end
   4.233  | eval_filter_sameFunId _ _ _ _ = NONE;
   4.234  
   4.235 @@ -509,7 +509,7 @@
   4.236      let val isal = TermC.isalist2list l
   4.237  	val lhss = map lhs isal
   4.238  	val sum = list2sum lhss
   4.239 -    in SOME ((term2str p) ^ " = " ^ (term2str sum),
   4.240 +    in SOME ((Celem.term2str p) ^ " = " ^ (Celem.term2str sum),
   4.241  	  HOLogic.Trueprop $ (TermC.mk_equality (p, sum)))
   4.242      end
   4.243  | eval_boollist2sum _ _ _ _ = NONE;
   4.244 @@ -521,47 +521,47 @@
   4.245  open Term;
   4.246  
   4.247  in
   4.248 -fun termlessI (_:subst) uv = Term_Ord.termless uv;
   4.249 -fun term_ordI (_:subst) uv = Term_Ord.term_ord uv;
   4.250 +fun termlessI (_: Celem.subst) uv = Term_Ord.termless uv;
   4.251 +fun term_ordI (_: Celem.subst) uv = Term_Ord.term_ord uv;
   4.252  end;
   4.253  
   4.254  
   4.255  (** rule set, for evaluating list-expressions in scripts 8.01.02 **)
   4.256  
   4.257  
   4.258 -val list_rls = append_rls "list_rls" list_rls
   4.259 -	 [Calc ("Groups.times_class.times",eval_binop "#mult_"),
   4.260 -		Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
   4.261 -		Calc ("Orderings.ord_class.less",eval_equ "#less_"),
   4.262 -		Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"),
   4.263 -		Calc ("Atools.ident",eval_ident "#ident_"),
   4.264 -		Calc ("HOL.eq",eval_equal "#equal_"),(*atom <> atom -> False*)
   4.265 +val list_rls = Celem.append_rls "list_rls" list_rls
   4.266 +	 [Celem.Calc ("Groups.times_class.times",eval_binop "#mult_"),
   4.267 +		Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
   4.268 +		Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"),
   4.269 +		Celem.Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"),
   4.270 +		Celem.Calc ("Atools.ident",eval_ident "#ident_"),
   4.271 +		Celem.Calc ("HOL.eq",eval_equal "#equal_"),(*atom <> atom -> False*)
   4.272         
   4.273 -		Calc ("Tools.Vars",eval_var "#Vars_"),
   4.274 +		Celem.Calc ("Tools.Vars",eval_var "#Vars_"),
   4.275  		
   4.276 -		Thm ("if_True",TermC.num_str @{thm if_True}),
   4.277 -		Thm ("if_False",TermC.num_str @{thm if_False})
   4.278 +		Celem.Thm ("if_True",TermC.num_str @{thm if_True}),
   4.279 +		Celem.Thm ("if_False",TermC.num_str @{thm if_False})
   4.280  		];
   4.281  *}
   4.282  ML {*
   4.283  
   4.284 -(*TODO.WN0509 reduce ids: tless_true = e_rew_ord' = e_rew_ord = dummy_ord*)
   4.285 -val tless_true = dummy_ord;
   4.286 -rew_ord' := overwritel (!rew_ord',
   4.287 +(*TODO.WN0509 reduce ids: tless_true = e_rew_ord' = Celem.e_rew_ord = Celem.dummy_ord*)
   4.288 +val tless_true = Celem.dummy_ord;
   4.289 +Celem.rew_ord' := overwritel (! Celem.rew_ord',
   4.290  			[("tless_true", tless_true),
   4.291  			 ("e_rew_ord'", tless_true),
   4.292 -			 ("dummy_ord", dummy_ord)]);
   4.293 +			 ("dummy_ord", Celem.dummy_ord)]);
   4.294  
   4.295  val calculate_Atools = 
   4.296 -    append_rls "calculate_Atools" e_rls
   4.297 -               [Calc ("Orderings.ord_class.less",eval_equ "#less_"),
   4.298 -		Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"),
   4.299 -		Calc ("HOL.eq",eval_equal "#equal_"),
   4.300 +    Celem.append_rls "calculate_Atools" Celem.e_rls
   4.301 +               [Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"),
   4.302 +		Celem.Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"),
   4.303 +		Celem.Calc ("HOL.eq",eval_equal "#equal_"),
   4.304  
   4.305 -		Thm  ("real_unari_minus",TermC.num_str @{thm real_unari_minus}),
   4.306 -		Calc ("Groups.plus_class.plus",eval_binop "#add_"),
   4.307 -		Calc ("Groups.minus_class.minus",eval_binop "#sub_"),
   4.308 -		Calc ("Groups.times_class.times",eval_binop "#mult_")
   4.309 +		Celem.Thm  ("real_unari_minus",TermC.num_str @{thm real_unari_minus}),
   4.310 +		Celem.Calc ("Groups.plus_class.plus",eval_binop "#add_"),
   4.311 +		Celem.Calc ("Groups.minus_class.minus",eval_binop "#sub_"),
   4.312 +		Celem.Calc ("Groups.times_class.times",eval_binop "#mult_")
   4.313  		];
   4.314  
   4.315  *}
   4.316 @@ -570,101 +570,101 @@
   4.317  
   4.318  ML {*
   4.319  val Atools_erls = 
   4.320 -    append_rls "Atools_erls" e_rls
   4.321 -               [Calc ("HOL.eq",eval_equal "#equal_"),
   4.322 -                Thm ("not_true",TermC.num_str @{thm not_true}),
   4.323 +    Celem.append_rls "Atools_erls" Celem.e_rls
   4.324 +               [Celem.Calc ("HOL.eq",eval_equal "#equal_"),
   4.325 +                Celem.Thm ("not_true",TermC.num_str @{thm not_true}),
   4.326  		(*"(~ True) = False"*)
   4.327 -		Thm ("not_false",TermC.num_str @{thm not_false}),
   4.328 +		Celem.Thm ("not_false",TermC.num_str @{thm not_false}),
   4.329  		(*"(~ False) = True"*)
   4.330 -		Thm ("and_true",TermC.num_str @{thm and_true}),
   4.331 +		Celem.Thm ("and_true",TermC.num_str @{thm and_true}),
   4.332  		(*"(?a & True) = ?a"*)
   4.333 -		Thm ("and_false",TermC.num_str @{thm and_false}),
   4.334 +		Celem.Thm ("and_false",TermC.num_str @{thm and_false}),
   4.335  		(*"(?a & False) = False"*)
   4.336 -		Thm ("or_true",TermC.num_str @{thm or_true}),
   4.337 +		Celem.Thm ("or_true",TermC.num_str @{thm or_true}),
   4.338  		(*"(?a | True) = True"*)
   4.339 -		Thm ("or_false",TermC.num_str @{thm or_false}),
   4.340 +		Celem.Thm ("or_false",TermC.num_str @{thm or_false}),
   4.341  		(*"(?a | False) = ?a"*)
   4.342                 
   4.343 -		Thm ("rat_leq1",TermC.num_str @{thm rat_leq1}),
   4.344 -		Thm ("rat_leq2",TermC.num_str @{thm rat_leq2}),
   4.345 -		Thm ("rat_leq3",TermC.num_str @{thm rat_leq3}),
   4.346 -                Thm ("refl",TermC.num_str @{thm refl}),
   4.347 -		Thm ("order_refl",TermC.num_str @{thm order_refl}),
   4.348 -		Thm ("radd_left_cancel_le",TermC.num_str @{thm radd_left_cancel_le}),
   4.349 +		Celem.Thm ("rat_leq1",TermC.num_str @{thm rat_leq1}),
   4.350 +		Celem.Thm ("rat_leq2",TermC.num_str @{thm rat_leq2}),
   4.351 +		Celem.Thm ("rat_leq3",TermC.num_str @{thm rat_leq3}),
   4.352 +                Celem.Thm ("refl",TermC.num_str @{thm refl}),
   4.353 +		Celem.Thm ("order_refl",TermC.num_str @{thm order_refl}),
   4.354 +		Celem.Thm ("radd_left_cancel_le",TermC.num_str @{thm radd_left_cancel_le}),
   4.355  		
   4.356 -		Calc ("Orderings.ord_class.less",eval_equ "#less_"),
   4.357 -		Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"),
   4.358 +		Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"),
   4.359 +		Celem.Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"),
   4.360  		
   4.361 -		Calc ("Atools.ident",eval_ident "#ident_"),    
   4.362 -		Calc ("Atools.is'_const",eval_const "#is_const_"),
   4.363 -		Calc ("Atools.occurs'_in",eval_occurs_in ""),    
   4.364 -		Calc ("Tools.matches",eval_matches "")
   4.365 +		Celem.Calc ("Atools.ident",eval_ident "#ident_"),    
   4.366 +		Celem.Calc ("Atools.is'_const",eval_const "#is_const_"),
   4.367 +		Celem.Calc ("Atools.occurs'_in",eval_occurs_in ""),    
   4.368 +		Celem.Calc ("Tools.matches",eval_matches "")
   4.369  		];
   4.370  
   4.371  *}
   4.372  
   4.373  ML {*
   4.374  val Atools_crls = 
   4.375 -    append_rls "Atools_crls" e_rls
   4.376 -               [Calc ("HOL.eq",eval_equal "#equal_"),
   4.377 -                Thm ("not_true",TermC.num_str @{thm not_true}),
   4.378 -		Thm ("not_false",TermC.num_str @{thm not_false}),
   4.379 -		Thm ("and_true",TermC.num_str @{thm and_true}),
   4.380 -		Thm ("and_false",TermC.num_str @{thm and_false}),
   4.381 -		Thm ("or_true",TermC.num_str @{thm or_true}),
   4.382 -		Thm ("or_false",TermC.num_str @{thm or_false}),
   4.383 +    Celem.append_rls "Atools_crls" Celem.e_rls
   4.384 +               [Celem.Calc ("HOL.eq",eval_equal "#equal_"),
   4.385 +                Celem.Thm ("not_true",TermC.num_str @{thm not_true}),
   4.386 +		Celem.Thm ("not_false",TermC.num_str @{thm not_false}),
   4.387 +		Celem.Thm ("and_true",TermC.num_str @{thm and_true}),
   4.388 +		Celem.Thm ("and_false",TermC.num_str @{thm and_false}),
   4.389 +		Celem.Thm ("or_true",TermC.num_str @{thm or_true}),
   4.390 +		Celem.Thm ("or_false",TermC.num_str @{thm or_false}),
   4.391                 
   4.392 -		Thm ("rat_leq1",TermC.num_str @{thm rat_leq1}),
   4.393 -		Thm ("rat_leq2",TermC.num_str @{thm rat_leq2}),
   4.394 -		Thm ("rat_leq3",TermC.num_str @{thm rat_leq3}),
   4.395 -                Thm ("refl",TermC.num_str @{thm refl}),
   4.396 -		Thm ("order_refl",TermC.num_str @{thm order_refl}),
   4.397 -		Thm ("radd_left_cancel_le",TermC.num_str @{thm radd_left_cancel_le}),
   4.398 +		Celem.Thm ("rat_leq1",TermC.num_str @{thm rat_leq1}),
   4.399 +		Celem.Thm ("rat_leq2",TermC.num_str @{thm rat_leq2}),
   4.400 +		Celem.Thm ("rat_leq3",TermC.num_str @{thm rat_leq3}),
   4.401 +                Celem.Thm ("refl",TermC.num_str @{thm refl}),
   4.402 +		Celem.Thm ("order_refl",TermC.num_str @{thm order_refl}),
   4.403 +		Celem.Thm ("radd_left_cancel_le",TermC.num_str @{thm radd_left_cancel_le}),
   4.404  		
   4.405 -		Calc ("Orderings.ord_class.less",eval_equ "#less_"),
   4.406 -		Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"),
   4.407 +		Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"),
   4.408 +		Celem.Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"),
   4.409  		
   4.410 -		Calc ("Atools.ident",eval_ident "#ident_"),    
   4.411 -		Calc ("Atools.is'_const",eval_const "#is_const_"),
   4.412 -		Calc ("Atools.occurs'_in",eval_occurs_in ""),    
   4.413 -		Calc ("Tools.matches",eval_matches "")
   4.414 +		Celem.Calc ("Atools.ident",eval_ident "#ident_"),    
   4.415 +		Celem.Calc ("Atools.is'_const",eval_const "#is_const_"),
   4.416 +		Celem.Calc ("Atools.occurs'_in",eval_occurs_in ""),    
   4.417 +		Celem.Calc ("Tools.matches",eval_matches "")
   4.418  		];
   4.419  
   4.420  (*val atools_erls = ... waere zu testen ...
   4.421 -    merge_rls calculate_Atools
   4.422 -	      (append_rls Atools_erls (*i.A. zu viele rules*)
   4.423 -			  [Calc ("Atools.ident",eval_ident "#ident_"),    
   4.424 -			   Calc ("Atools.is'_const",eval_const "#is_const_"),
   4.425 -			   Calc ("Atools.occurs'_in",
   4.426 +    Celem.merge_rls calculate_Atools
   4.427 +	      (Celem.append_rls Atools_erls (*i.A. zu viele rules*)
   4.428 +			  [Celem.Calc ("Atools.ident",eval_ident "#ident_"),    
   4.429 +			   Celem.Calc ("Atools.is'_const",eval_const "#is_const_"),
   4.430 +			   Celem.Calc ("Atools.occurs'_in",
   4.431  				 eval_occurs_in "#occurs_in"),    
   4.432 -			   Calc ("Tools.matches",eval_matches "#matches")
   4.433 +			   Celem.Calc ("Tools.matches",eval_matches "#matches")
   4.434  			   ] (*i.A. zu viele rules*)
   4.435  			  );*)
   4.436  (* val atools_erls = prep_rls'(     (*outcommented*)
   4.437 -  Rls {id="atools_erls",preconds = [], rew_ord = ("termlessI",termlessI), 
   4.438 -      erls = e_rls, srls = Erls, calc = [], errpatts = [],
   4.439 -      rules = [Thm ("refl",num_str @{thm refl}),
   4.440 -		Thm ("order_refl",num_str @{thm order_refl}),
   4.441 -		Thm ("radd_left_cancel_le",num_str @{thm radd_left_cancel_le}),
   4.442 -		Thm ("not_true",num_str @{thm not_true}),
   4.443 -		Thm ("not_false",num_str @{thm not_false}),
   4.444 -		Thm ("and_true",num_str @{thm and_true}),
   4.445 -		Thm ("and_false",num_str @{thm and_false}),
   4.446 -		Thm ("or_true",num_str @{thm or_true}),
   4.447 -		Thm ("or_false",num_str @{thm or_false}),
   4.448 -		Thm ("and_commute",num_str @{thm and_commute}),
   4.449 -		Thm ("or_commute",num_str @{thm or_commute}),
   4.450 +  Celem.Rls {id="atools_erls",preconds = [], rew_ord = ("termlessI",termlessI), 
   4.451 +      erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [],
   4.452 +      rules = [Celem.Thm ("refl",num_str @{thm refl}),
   4.453 +		Celem.Thm ("order_refl",num_str @{thm order_refl}),
   4.454 +		Celem.Thm ("radd_left_cancel_le",num_str @{thm radd_left_cancel_le}),
   4.455 +		Celem.Thm ("not_true",num_str @{thm not_true}),
   4.456 +		Celem.Thm ("not_false",num_str @{thm not_false}),
   4.457 +		Celem.Thm ("and_true",num_str @{thm and_true}),
   4.458 +		Celem.Thm ("and_false",num_str @{thm and_false}),
   4.459 +		Celem.Thm ("or_true",num_str @{thm or_true}),
   4.460 +		Celem.Thm ("or_false",num_str @{thm or_false}),
   4.461 +		Celem.Thm ("and_commute",num_str @{thm and_commute}),
   4.462 +		Celem.Thm ("or_commute",num_str @{thm or_commute}),
   4.463  		
   4.464 -		Calc ("Orderings.ord_class.less",eval_equ "#less_"),
   4.465 -		Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"),
   4.466 +		Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"),
   4.467 +		Celem.Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"),
   4.468  		
   4.469 -		Calc ("Atools.ident",eval_ident "#ident_"),    
   4.470 -		Calc ("Atools.is'_const",eval_const "#is_const_"),
   4.471 -		Calc ("Atools.occurs'_in",eval_occurs_in ""),    
   4.472 -		Calc ("Tools.matches",eval_matches "")
   4.473 +		Celem.Calc ("Atools.ident",eval_ident "#ident_"),    
   4.474 +		Celem.Calc ("Atools.is'_const",eval_const "#is_const_"),
   4.475 +		Celem.Calc ("Atools.occurs'_in",eval_occurs_in ""),    
   4.476 +		Celem.Calc ("Tools.matches",eval_matches "")
   4.477  	       ],
   4.478 -      scr = Prog ((Thm.term_of o the o (parse @{theory})) "empty_script")
   4.479 -      }:rls);
   4.480 +      scr = Celem.Prog ((Thm.term_of o the o (parse @{theory})) "empty_script")
   4.481 +      });
   4.482  *)
   4.483  "******* Atools.ML end *******";
   4.484  *}
   4.485 @@ -686,16 +686,16 @@
   4.486      ("POWER"   ,("Atools.pow", eval_binop "#power_")),
   4.487      ("boollist2sum",("Atools.boollist2sum", eval_boollist2sum ""))] *}
   4.488  ML {*
   4.489 -val list_rls = LTool.prep_rls @{theory} (merge_rls "list_erls"
   4.490 -	(Rls {id = "replaced", preconds = [], rew_ord = ("termlessI", termlessI),
   4.491 -    erls = Rls {id = "list_elrs", preconds = [], rew_ord = ("termlessI", termlessI), 
   4.492 -      erls = e_rls, srls = Erls, calc = [], errpatts = [],
   4.493 -      rules = [Calc ("Groups.plus_class.plus", eval_binop "#add_"),
   4.494 -        Calc ("Orderings.ord_class.less", eval_equ "#less_")
   4.495 +val list_rls = LTool.prep_rls @{theory} (Celem.merge_rls "list_erls"
   4.496 +	(Celem.Rls {id = "replaced", preconds = [], rew_ord = ("termlessI", termlessI),
   4.497 +    erls = Celem.Rls {id = "list_elrs", preconds = [], rew_ord = ("termlessI", termlessI), 
   4.498 +      erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [],
   4.499 +      rules = [Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"),
   4.500 +        Celem.Calc ("Orderings.ord_class.less", eval_equ "#less_")
   4.501          (*    ~~~~~~ for nth_Cons_*)],
   4.502 -      scr = EmptyScr},
   4.503 -    srls = Erls, calc = [], errpatts = [],
   4.504 -    rules = [], scr = EmptyScr})
   4.505 +      scr = Celem.EmptyScr},
   4.506 +    srls = Celem.Erls, calc = [], errpatts = [],
   4.507 +    rules = [], scr = Celem.EmptyScr})
   4.508    list_rls);
   4.509  *}
   4.510  setup {* KEStore_Elems.add_rlss
     5.1 --- a/src/Tools/isac/Knowledge/Biegelinie.thy	Thu Mar 15 10:17:44 2018 +0100
     5.2 +++ b/src/Tools/isac/Knowledge/Biegelinie.thy	Thu Mar 15 12:42:04 2018 +0100
     5.3 @@ -94,109 +94,109 @@
     5.4  
     5.5  (** problems **)
     5.6  setup {* KEStore_Elems.add_pbts
     5.7 -  [(Specify.prep_pbt @{theory} "pbl_bieg" [] e_pblID
     5.8 +  [(Specify.prep_pbt @{theory} "pbl_bieg" [] Celem.e_pblID
     5.9        (["Biegelinien"],
    5.10          [("#Given" ,["Traegerlaenge l_l", "Streckenlast q_q"]),
    5.11            (*("#Where",["0 < l_l"]), ...wait for &lt; and handling Arbfix*)
    5.12            ("#Find"  ,["Biegelinie b_b"]),
    5.13            ("#Relate",["Randbedingungen r_b"])],
    5.14 -        append_rls "e_rls" e_rls [], NONE, [["IntegrierenUndKonstanteBestimmen2"]])),
    5.15 -    (Specify.prep_pbt @{theory} "pbl_bieg_mom" [] e_pblID
    5.16 +        Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [], NONE, [["IntegrierenUndKonstanteBestimmen2"]])),
    5.17 +    (Specify.prep_pbt @{theory} "pbl_bieg_mom" [] Celem.e_pblID
    5.18        (["MomentBestimmte","Biegelinien"],
    5.19          [("#Given" ,["Traegerlaenge l_l", "Streckenlast q_q"]),
    5.20            (*("#Where",["0 < l_l"]), ...wait for &lt; and handling Arbfix*)
    5.21            ("#Find"  ,["Biegelinie b_b"]),
    5.22            ("#Relate",["RandbedingungenBiegung r_b","RandbedingungenMoment r_m"])
    5.23          ],
    5.24 -        append_rls "e_rls" e_rls [], NONE, [["IntegrierenUndKonstanteBestimmen"]])),
    5.25 -    (Specify.prep_pbt @{theory} "pbl_bieg_momg" [] e_pblID
    5.26 -      (["MomentGegebene","Biegelinien"], [], append_rls "e_rls" e_rls [], NONE,
    5.27 +        Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [], NONE, [["IntegrierenUndKonstanteBestimmen"]])),
    5.28 +    (Specify.prep_pbt @{theory} "pbl_bieg_momg" [] Celem.e_pblID
    5.29 +      (["MomentGegebene","Biegelinien"], [], Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [], NONE,
    5.30          [["IntegrierenUndKonstanteBestimmen","2xIntegrieren"]])),
    5.31 -    (Specify.prep_pbt @{theory} "pbl_bieg_einf" [] e_pblID
    5.32 -      (["einfache","Biegelinien"], [], append_rls "e_rls" e_rls [], NONE,
    5.33 +    (Specify.prep_pbt @{theory} "pbl_bieg_einf" [] Celem.e_pblID
    5.34 +      (["einfache","Biegelinien"], [], Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [], NONE,
    5.35          [["IntegrierenUndKonstanteBestimmen","4x4System"]])),
    5.36 -    (Specify.prep_pbt @{theory} "pbl_bieg_momquer" [] e_pblID
    5.37 -      (["QuerkraftUndMomentBestimmte","Biegelinien"], [], append_rls "e_rls" e_rls [], NONE,
    5.38 +    (Specify.prep_pbt @{theory} "pbl_bieg_momquer" [] Celem.e_pblID
    5.39 +      (["QuerkraftUndMomentBestimmte","Biegelinien"], [], Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [], NONE,
    5.40          [["IntegrierenUndKonstanteBestimmen","1xIntegrieren"]])),
    5.41 -    (Specify.prep_pbt @{theory} "pbl_bieg_vonq" [] e_pblID
    5.42 +    (Specify.prep_pbt @{theory} "pbl_bieg_vonq" [] Celem.e_pblID
    5.43        (["vonBelastungZu","Biegelinien"],
    5.44            [("#Given" ,["Streckenlast q_q","FunktionsVariable v_v"]),
    5.45              ("#Find"  ,["Funktionen funs'''"])],
    5.46 -        append_rls "e_rls" e_rls [], NONE, [["Biegelinien","ausBelastung"]])),
    5.47 -    (Specify.prep_pbt @{theory} "pbl_bieg_randbed" [] e_pblID
    5.48 +        Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [], NONE, [["Biegelinien","ausBelastung"]])),
    5.49 +    (Specify.prep_pbt @{theory} "pbl_bieg_randbed" [] Celem.e_pblID
    5.50        (["setzeRandbedingungen","Biegelinien"],
    5.51            [("#Given" ,["Funktionen fun_s","Randbedingungen r_b"]),
    5.52              ("#Find"  ,["Gleichungen equs'''"])],
    5.53 -        append_rls "e_rls" e_rls [], NONE, [["Biegelinien","setzeRandbedingungenEin"]])),
    5.54 -    (Specify.prep_pbt @{theory} "pbl_equ_fromfun" [] e_pblID
    5.55 +        Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [], NONE, [["Biegelinien","setzeRandbedingungenEin"]])),
    5.56 +    (Specify.prep_pbt @{theory} "pbl_equ_fromfun" [] Celem.e_pblID
    5.57        (["makeFunctionTo","equation"],
    5.58            [("#Given" ,["functionEq fu_n","substitution su_b"]),
    5.59              ("#Find"  ,["equality equ'''"])],
    5.60 -        append_rls "e_rls" e_rls [], NONE, [["Equation","fromFunction"]]))] *}
    5.61 +        Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [], NONE, [["Equation","fromFunction"]]))] *}
    5.62  ML {*
    5.63  (** methods **)
    5.64  
    5.65 -val srls = Rls {id="srls_IntegrierenUnd..", 
    5.66 +val srls = Celem.Rls {id="srls_IntegrierenUnd..", 
    5.67  		preconds = [], 
    5.68  		rew_ord = ("termlessI",termlessI), 
    5.69 -		erls = append_rls "erls_in_srls_IntegrierenUnd.." e_rls
    5.70 +		erls = Celem.append_rls "erls_in_srls_IntegrierenUnd.." Celem.e_rls
    5.71  				  [(*for asm in NTH_CONS ...*)
    5.72 -				   Calc ("Orderings.ord_class.less",eval_equ "#less_"),
    5.73 +				   Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"),
    5.74  				   (*2nd NTH_CONS pushes n+-1 into asms*)
    5.75 -				   Calc("Groups.plus_class.plus", eval_binop "#add_")
    5.76 +				   Celem.Calc("Groups.plus_class.plus", eval_binop "#add_")
    5.77  				   ], 
    5.78 -		srls = Erls, calc = [], errpatts = [],
    5.79 -		rules = [Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
    5.80 -			 Calc("Groups.plus_class.plus", eval_binop "#add_"),
    5.81 -			 Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}),
    5.82 -			 Calc("Tools.lhs", eval_lhs"eval_lhs_"),
    5.83 -			 Calc("Tools.rhs", eval_rhs"eval_rhs_"),
    5.84 -			 Calc("Atools.argument'_in",
    5.85 +		srls = Celem.Erls, calc = [], errpatts = [],
    5.86 +		rules = [Celem.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
    5.87 +			 Celem.Calc("Groups.plus_class.plus", eval_binop "#add_"),
    5.88 +			 Celem.Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}),
    5.89 +			 Celem.Calc("Tools.lhs", eval_lhs"eval_lhs_"),
    5.90 +			 Celem.Calc("Tools.rhs", eval_rhs"eval_rhs_"),
    5.91 +			 Celem.Calc("Atools.argument'_in",
    5.92  			      eval_argument_in "Atools.argument'_in")
    5.93  			 ],
    5.94 -		scr = EmptyScr};
    5.95 +		scr = Celem.EmptyScr};
    5.96      
    5.97  val srls2 = 
    5.98 -    Rls {id="srls_IntegrierenUnd..", 
    5.99 +    Celem.Rls {id="srls_IntegrierenUnd..", 
   5.100  	 preconds = [], 
   5.101  	 rew_ord = ("termlessI",termlessI), 
   5.102 -	 erls = append_rls "erls_in_srls_IntegrierenUnd.." e_rls
   5.103 +	 erls = Celem.append_rls "erls_in_srls_IntegrierenUnd.." Celem.e_rls
   5.104  			   [(*for asm in NTH_CONS ...*)
   5.105 -			    Calc ("Orderings.ord_class.less",eval_equ "#less_"),
   5.106 +			    Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"),
   5.107  			    (*2nd NTH_CONS pushes n+-1 into asms*)
   5.108 -			    Calc("Groups.plus_class.plus", eval_binop "#add_")
   5.109 +			    Celem.Calc("Groups.plus_class.plus", eval_binop "#add_")
   5.110  			    ], 
   5.111 -	 srls = Erls, calc = [], errpatts = [],
   5.112 -	 rules = [Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
   5.113 -		  Calc("Groups.plus_class.plus", eval_binop "#add_"),
   5.114 -		  Thm ("NTH_NIL", TermC.num_str @{thm NTH_NIL}),
   5.115 -		  Calc("Tools.lhs", eval_lhs "eval_lhs_"),
   5.116 -		  Calc("Atools.filter'_sameFunId",
   5.117 +	 srls = Celem.Erls, calc = [], errpatts = [],
   5.118 +	 rules = [Celem.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
   5.119 +		  Celem.Calc("Groups.plus_class.plus", eval_binop "#add_"),
   5.120 +		  Celem.Thm ("NTH_NIL", TermC.num_str @{thm NTH_NIL}),
   5.121 +		  Celem.Calc("Tools.lhs", eval_lhs "eval_lhs_"),
   5.122 +		  Celem.Calc("Atools.filter'_sameFunId",
   5.123  		       eval_filter_sameFunId "Atools.filter'_sameFunId"),
   5.124  		  (*WN070514 just for smltest/../biegelinie.sml ...*)
   5.125 -		  Calc("Atools.sameFunId", eval_sameFunId "Atools.sameFunId"),
   5.126 -		  Thm ("filter_Cons", TermC.num_str @{thm filter_Cons}),
   5.127 -		  Thm ("filter_Nil", TermC.num_str @{thm filter_Nil}),
   5.128 -		  Thm ("if_True", TermC.num_str @{thm if_True}),
   5.129 -		  Thm ("if_False", TermC.num_str @{thm if_False}),
   5.130 -		  Thm ("hd_thm", TermC.num_str @{thm hd_thm})
   5.131 +		  Celem.Calc("Atools.sameFunId", eval_sameFunId "Atools.sameFunId"),
   5.132 +		  Celem.Thm ("filter_Cons", TermC.num_str @{thm filter_Cons}),
   5.133 +		  Celem.Thm ("filter_Nil", TermC.num_str @{thm filter_Nil}),
   5.134 +		  Celem.Thm ("if_True", TermC.num_str @{thm if_True}),
   5.135 +		  Celem.Thm ("if_False", TermC.num_str @{thm if_False}),
   5.136 +		  Celem.Thm ("hd_thm", TermC.num_str @{thm hd_thm})
   5.137  		  ],
   5.138 -	 scr = EmptyScr};
   5.139 +	 scr = Celem.EmptyScr};
   5.140  *}
   5.141  
   5.142  setup {* KEStore_Elems.add_mets
   5.143 -  [Specify.prep_met @{theory} "met_biege" [] e_metID 
   5.144 +  [Specify.prep_met @{theory} "met_biege" [] Celem.e_metID 
   5.145  	    (["IntegrierenUndKonstanteBestimmen"],
   5.146  	      [("#Given" ,["Traegerlaenge l_l", "Streckenlast q__q", "FunktionsVariable v_v"]),
   5.147  		      (*("#Where",["0 < l_l"]), ...wait for &lt; and handling Arbfix*)
   5.148  		      ("#Find"  ,["Biegelinie b_b"]),
   5.149  		      ("#Relate",["RandbedingungenBiegung r_b", "RandbedingungenMoment r_m"])],
   5.150  	    {rew_ord'="tless_true",
   5.151 -        rls' = append_rls "erls_IntegrierenUndK.." e_rls 
   5.152 -				    [Calc ("Atools.ident",eval_ident "#ident_"),
   5.153 -				      Thm ("not_true",TermC.num_str @{thm not_true}),
   5.154 -				      Thm ("not_false",TermC.num_str @{thm not_false})], 
   5.155 -				calc = [], srls = srls, prls = Erls, crls = Atools_erls, errpats = [], nrls = Erls},
   5.156 +        rls' = Celem.append_rls "erls_IntegrierenUndK.." Celem.e_rls 
   5.157 +				    [Celem.Calc ("Atools.ident",eval_ident "#ident_"),
   5.158 +				      Celem.Thm ("not_true",TermC.num_str @{thm not_true}),
   5.159 +				      Celem.Thm ("not_false",TermC.num_str @{thm not_false})], 
   5.160 +				calc = [], srls = srls, prls = Celem.Erls, crls = Atools_erls, errpats = [], nrls = Celem.Erls},
   5.161          "Script BiegelinieScript                                                 " ^
   5.162            "(l_l::real) (q__q::real) (v_v::real) (b_b::real=>real)                  " ^
   5.163            "(r_b::bool list) (r_m::bool list) =                                     " ^
   5.164 @@ -261,25 +261,25 @@
   5.165            "       B__B = ((Substitute c_1_2) @@                                    " ^
   5.166            "              (Rewrite_Set_Inst [(bdv, x)] make_ratpoly_in False)) B__B " ^
   5.167            " in B__B)"),
   5.168 -    Specify.prep_met @{theory} "met_biege_2" [] e_metID
   5.169 +    Specify.prep_met @{theory} "met_biege_2" [] Celem.e_metID
   5.170  	    (["IntegrierenUndKonstanteBestimmen2"],
   5.171  	      [("#Given" ,["Traegerlaenge l_l", "Streckenlast q__q", "FunktionsVariable v_v"]),
   5.172  		      (*("#Where",["0 < l_l"]), ...wait for &lt; and handling Arbfix*)
   5.173  		      ("#Find"  ,["Biegelinie b_b"]),
   5.174  		      ("#Relate",["Randbedingungen r_b"])],
   5.175  	      {rew_ord'="tless_true", 
   5.176 -	        rls' = append_rls "erls_IntegrierenUndK.." e_rls 
   5.177 -				      [Calc ("Atools.ident",eval_ident "#ident_"),
   5.178 -				        Thm ("not_true",TermC.num_str @{thm not_true}),
   5.179 -				        Thm ("not_false",TermC.num_str @{thm not_false})], 
   5.180 +	        rls' = Celem.append_rls "erls_IntegrierenUndK.." Celem.e_rls 
   5.181 +				      [Celem.Calc ("Atools.ident",eval_ident "#ident_"),
   5.182 +				        Celem.Thm ("not_true",TermC.num_str @{thm not_true}),
   5.183 +				        Celem.Thm ("not_false",TermC.num_str @{thm not_false})], 
   5.184  				  calc = [], 
   5.185 -				  srls = append_rls "erls_IntegrierenUndK.." e_rls 
   5.186 -				      [Calc("Tools.rhs", eval_rhs"eval_rhs_"),
   5.187 -				        Calc ("Atools.ident",eval_ident "#ident_"),
   5.188 -				        Thm ("last_thmI",TermC.num_str @{thm last_thmI}),
   5.189 -				        Thm ("if_True",TermC.num_str @{thm if_True}),
   5.190 -				        Thm ("if_False",TermC.num_str @{thm if_False})],
   5.191 -				  prls = Erls, crls = Atools_erls, errpats = [], nrls = Erls},
   5.192 +				  srls = Celem.append_rls "erls_IntegrierenUndK.." Celem.e_rls 
   5.193 +				      [Celem.Calc("Tools.rhs", eval_rhs"eval_rhs_"),
   5.194 +				        Celem.Calc ("Atools.ident",eval_ident "#ident_"),
   5.195 +				        Celem.Thm ("last_thmI",TermC.num_str @{thm last_thmI}),
   5.196 +				        Celem.Thm ("if_True",TermC.num_str @{thm if_True}),
   5.197 +				        Celem.Thm ("if_False",TermC.num_str @{thm if_False})],
   5.198 +				  prls = Celem.Erls, crls = Atools_erls, errpats = [], nrls = Celem.Erls},
   5.199          "Script Biegelinie2Script                                                  " ^
   5.200            "(l_l::real) (q__q::real) (v_v::real) (b_b::real=>real) (r_b::bool list) = " ^
   5.201            "  (let                                                                    " ^
   5.202 @@ -298,39 +298,39 @@
   5.203            "       B_B = ((Substitute con_s) @@                                       " ^
   5.204            "              (Rewrite_Set_Inst [(bdv, v_v)] make_ratpoly_in False)) B_B  " ^
   5.205            " in B_B)"),
   5.206 -    Specify.prep_met @{theory} "met_biege_intconst_2" [] e_metID
   5.207 +    Specify.prep_met @{theory} "met_biege_intconst_2" [] Celem.e_metID
   5.208  	    (["IntegrierenUndKonstanteBestimmen","2xIntegrieren"], [],
   5.209 -	      {rew_ord'="tless_true", rls'=Erls, calc = [], srls = e_rls, prls=e_rls, crls = Atools_erls,
   5.210 -          errpats = [], nrls = e_rls},
   5.211 +	      {rew_ord'="tless_true", rls'=Celem.Erls, calc = [], srls = Celem.e_rls, prls=Celem.e_rls, crls = Atools_erls,
   5.212 +          errpats = [], nrls = Celem.e_rls},
   5.213          "empty_script"),
   5.214 -    Specify.prep_met @{theory} "met_biege_intconst_4" [] e_metID
   5.215 +    Specify.prep_met @{theory} "met_biege_intconst_4" [] Celem.e_metID
   5.216  	    (["IntegrierenUndKonstanteBestimmen","4x4System"], [],
   5.217 -	      {rew_ord'="tless_true", rls'=Erls, calc = [], srls = e_rls, prls=e_rls, crls = Atools_erls,
   5.218 -          errpats = [], nrls = e_rls},
   5.219 +	      {rew_ord'="tless_true", rls'=Celem.Erls, calc = [], srls = Celem.e_rls, prls=Celem.e_rls, crls = Atools_erls,
   5.220 +          errpats = [], nrls = Celem.e_rls},
   5.221          "empty_script"),
   5.222 -    Specify.prep_met @{theory} "met_biege_intconst_1" [] e_metID
   5.223 +    Specify.prep_met @{theory} "met_biege_intconst_1" [] Celem.e_metID
   5.224  	    (["IntegrierenUndKonstanteBestimmen","1xIntegrieren"], [],
   5.225 -        {rew_ord'="tless_true", rls'=Erls, calc = [], srls = e_rls, prls=e_rls, crls = Atools_erls,
   5.226 -          errpats = [], nrls = e_rls},
   5.227 +        {rew_ord'="tless_true", rls'=Celem.Erls, calc = [], srls = Celem.e_rls, prls=Celem.e_rls, crls = Atools_erls,
   5.228 +          errpats = [], nrls = Celem.e_rls},
   5.229          "empty_script"),
   5.230 -    Specify.prep_met @{theory} "met_biege2" [] e_metID
   5.231 +    Specify.prep_met @{theory} "met_biege2" [] Celem.e_metID
   5.232  	    (["Biegelinien"], [],
   5.233 -	      {rew_ord'="tless_true", rls'=Erls, calc = [], srls = e_rls, prls=e_rls, crls = Atools_erls,
   5.234 -          errpats = [], nrls = e_rls},
   5.235 +	      {rew_ord'="tless_true", rls'=Celem.Erls, calc = [], srls = Celem.e_rls, prls=Celem.e_rls, crls = Atools_erls,
   5.236 +          errpats = [], nrls = Celem.e_rls},
   5.237          "empty_script"),
   5.238 -    Specify.prep_met @{theory} "met_biege_ausbelast" [] e_metID
   5.239 +    Specify.prep_met @{theory} "met_biege_ausbelast" [] Celem.e_metID
   5.240  	    (["Biegelinien", "ausBelastung"],
   5.241  	      [("#Given" ,["Streckenlast q__q", "FunktionsVariable v_v"]),
   5.242  	        ("#Find"  ,["Funktionen fun_s"])],
   5.243  	      {rew_ord'="tless_true", 
   5.244 -	        rls' = append_rls "erls_ausBelastung" e_rls 
   5.245 -				      [Calc ("Atools.ident", eval_ident "#ident_"),
   5.246 -				        Thm ("not_true", TermC.num_str @{thm not_true}),
   5.247 -				        Thm ("not_false", TermC.num_str @{thm not_false})], 
   5.248 +	        rls' = Celem.append_rls "erls_ausBelastung" Celem.e_rls 
   5.249 +				      [Celem.Calc ("Atools.ident", eval_ident "#ident_"),
   5.250 +				        Celem.Thm ("not_true", TermC.num_str @{thm not_true}),
   5.251 +				        Celem.Thm ("not_false", TermC.num_str @{thm not_false})], 
   5.252  				  calc = [], 
   5.253 -				  srls = append_rls "srls_ausBelastung" e_rls 
   5.254 -				      [Calc ("Tools.rhs", eval_rhs "eval_rhs_")], 
   5.255 -				  prls = e_rls, crls = Atools_erls, errpats = [], nrls = e_rls},
   5.256 +				  srls = Celem.append_rls "srls_ausBelastung" Celem.e_rls 
   5.257 +				      [Celem.Calc ("Tools.rhs", eval_rhs "eval_rhs_")], 
   5.258 +				  prls = Celem.e_rls, crls = Atools_erls, errpats = [], nrls = Celem.e_rls},
   5.259          "Script Belastung2BiegelScript (q__q::real) (v_v::real) =               " ^
   5.260            "  (let q___q = Take (qq v_v = q__q);                                  " ^
   5.261            "       q___q = ((Rewrite sym_neg_equal_iff_equal True) @@              " ^
   5.262 @@ -355,12 +355,12 @@
   5.263            "                          [diff,integration,named])                    " ^
   5.264            "                          [REAL (rhs N__N), REAL v_v, REAL_REAL y])    " ^
   5.265            " in [Q__Q, M__M, N__N, B__B])"),
   5.266 -    Specify.prep_met @{theory} "met_biege_setzrand" [] e_metID
   5.267 +    Specify.prep_met @{theory} "met_biege_setzrand" [] Celem.e_metID
   5.268  	    (["Biegelinien", "setzeRandbedingungenEin"],
   5.269  	      [("#Given" , ["Funktionen fun_s", "Randbedingungen r_b"]),
   5.270  	        ("#Find"  , ["Gleichungen equs'''"])],
   5.271 -	      {rew_ord'="tless_true", rls'=Erls, calc = [], srls = srls2, prls=e_rls, crls = Atools_erls,
   5.272 -          errpats = [], nrls = e_rls},
   5.273 +	      {rew_ord'="tless_true", rls'=Celem.Erls, calc = [], srls = srls2, prls=Celem.e_rls, crls = Atools_erls,
   5.274 +          errpats = [], nrls = Celem.e_rls},
   5.275          "Script SetzeRandbedScript (fun_s::bool list) (r_b::bool list) = " ^
   5.276            " (let b_1 = NTH 1 r_b;                                         " ^
   5.277            "      f_s = filter_sameFunId (lhs b_1) fun_s;                   " ^
   5.278 @@ -414,15 +414,15 @@
   5.279            "                          [Equation,fromFunction])              " ^
   5.280            "                          [BOOL (hd f_s), BOOL b_4])          " ^
   5.281            " in [e_1,e_2,e_3,e_4])"*)),
   5.282 -    Specify.prep_met @{theory} "met_equ_fromfun" [] e_metID
   5.283 +    Specify.prep_met @{theory} "met_equ_fromfun" [] Celem.e_metID
   5.284  	    (["Equation","fromFunction"],
   5.285  	      [("#Given" ,["functionEq fu_n","substitution su_b"]),
   5.286  	        ("#Find"  ,["equality equ'''"])],
   5.287 -	      {rew_ord'="tless_true", rls'=Erls, calc = [],
   5.288 -          srls = append_rls "srls_in_EquationfromFunc" e_rls
   5.289 -				      [Calc("Tools.lhs", eval_lhs"eval_lhs_"),
   5.290 -				        Calc("Atools.argument'_in", eval_argument_in "Atools.argument'_in")], 
   5.291 -				  prls=e_rls, crls = Atools_erls, errpats = [], nrls = e_rls},
   5.292 +	      {rew_ord'="tless_true", rls'=Celem.Erls, calc = [],
   5.293 +          srls = Celem.append_rls "srls_in_EquationfromFunc" Celem.e_rls
   5.294 +				      [Celem.Calc("Tools.lhs", eval_lhs"eval_lhs_"),
   5.295 +				        Celem.Calc("Atools.argument'_in", eval_argument_in "Atools.argument'_in")], 
   5.296 +				  prls=Celem.e_rls, crls = Atools_erls, errpats = [], nrls = Celem.e_rls},
   5.297          (*(M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2) (M_b L = 0) -->
   5.298                 0 = c_2 + c * L + -1 * q_0 / 2 * L ^^^ 2*)
   5.299          "Script Function2Equality (fu_n::bool) (su_b::bool) =" ^
     6.1 --- a/src/Tools/isac/Knowledge/Build_Thydata.thy	Thu Mar 15 10:17:44 2018 +0100
     6.2 +++ b/src/Tools/isac/Knowledge/Build_Thydata.thy	Thu Mar 15 12:42:04 2018 +0100
     6.3 @@ -43,12 +43,12 @@
     6.4  subsubsection {* From rule-sets collect theorems, which have been taken from Isabelle *}
     6.5  ML {*
     6.6    val isacrlsthms =                      (*length = 460*)
     6.7 -    thms_of_rlss @{theory} (KEStore_Elems.get_rlss knowledge_parent) : (thmID * thm) list
     6.8 +    thms_of_rlss @{theory} (KEStore_Elems.get_rlss knowledge_parent) : (Celem.thmID * thm) list
     6.9  
    6.10    val rlsthmsNOTisac = isacrlsthms       (*length =  36*)
    6.11      |> filter (fn (deriv, _) => 
    6.12 -      member op= (map Context.theory_name isabthys') (thyID_of_derivation_name deriv))
    6.13 -    : (thmID * thm) list
    6.14 +      member op= (map Context.theory_name isabthys') (Celem.thyID_of_derivation_name deriv))
    6.15 +    : (Celem.thmID * thm) list
    6.16  *} 
    6.17  
    6.18  subsubsection {* Collect data in a (key, data) list and insert data into the tree *}
    6.19 @@ -62,7 +62,7 @@
    6.20    collect_part       "IsacKnowledge" knowledge_parent knowthys' @
    6.21    (map (collect_isab "Isabelle") rlsthmsNOTisac) @
    6.22    collect_part       "IsacScripts" proglang_parent progthys'
    6.23 -: (theID * thydata) list
    6.24 +: (Celem.theID * Celem.thydata) list
    6.25  *}
    6.26  setup {* KEStore_Elems.add_thes (map (fn (a, b) => (b, a)) thydata_list) *}
    6.27  
    6.28 @@ -94,7 +94,7 @@
    6.29      ("fill-inner-deriv",
    6.30        TermC.parse_patt @{theory Diff} "d_d ?bdv (sin ?u) = cos ?u * _", "chain-rule-diff-both"),
    6.31      ("fill-all",
    6.32 -      TermC.parse_patt @{theory Diff} "d_d ?bdv (sin ?u) = _", "chain-rule-diff-both")]: fillpat list))
    6.33 +      TermC.parse_patt @{theory Diff} "d_d ?bdv (sin ?u) = _", "chain-rule-diff-both")]: Celem.fillpat list))
    6.34    ]
    6.35  *}
    6.36  
     7.1 --- a/src/Tools/isac/Knowledge/Diff.thy	Thu Mar 15 10:17:44 2018 +0100
     7.2 +++ b/src/Tools/isac/Knowledge/Diff.thy	Thu Mar 15 12:42:04 2018 +0100
     7.3 @@ -100,11 +100,11 @@
     7.4  
     7.5  fun primed (Const (id, T)) = Const (id ^ "'", T)
     7.6    | primed (Free (id, T)) = Free (id ^ "'", T)
     7.7 -  | primed t = error ("primed called with arg = '"^ term2str t ^"'");
     7.8 +  | primed t = error ("primed called with arg = '"^ Celem.term2str t ^"'");
     7.9  
    7.10  (*("primed", ("Diff.primed", eval_primed "#primed"))*)
    7.11  fun eval_primed _ _ (p as (Const ("Diff.primed",_) $ t)) _ =
    7.12 -    SOME ((term2str p) ^ " = " ^ term2str (primed t),
    7.13 +    SOME ((Celem.term2str p) ^ " = " ^ Celem.term2str (primed t),
    7.14  	  HOLogic.Trueprop $ (TermC.mk_equality (p, primed t)))
    7.15    | eval_primed _ _ _ _ = NONE;
    7.16  *}
    7.17 @@ -115,129 +115,129 @@
    7.18  
    7.19  (*.converts a term such that differentiation works optimally.*)
    7.20  val diff_conv =   
    7.21 -    Rls {id="diff_conv", 
    7.22 +    Celem.Rls {id="diff_conv", 
    7.23  	 preconds = [], 
    7.24  	 rew_ord = ("termlessI",termlessI), 
    7.25 -	 erls = append_rls "erls_diff_conv" e_rls 
    7.26 -			   [Calc ("Atools.occurs'_in", eval_occurs_in ""),
    7.27 -			    Thm ("not_true",TermC.num_str @{thm not_true}),
    7.28 -			    Thm ("not_false",TermC.num_str @{thm not_false}),
    7.29 -			    Calc ("Orderings.ord_class.less",eval_equ "#less_"),
    7.30 -			    Thm ("and_true",TermC.num_str @{thm and_true}),
    7.31 -			    Thm ("and_false",TermC.num_str @{thm and_false})
    7.32 +	 erls = Celem.append_rls "erls_diff_conv" Celem.e_rls 
    7.33 +			   [Celem.Calc ("Atools.occurs'_in", eval_occurs_in ""),
    7.34 +			    Celem.Thm ("not_true",TermC.num_str @{thm not_true}),
    7.35 +			    Celem.Thm ("not_false",TermC.num_str @{thm not_false}),
    7.36 +			    Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"),
    7.37 +			    Celem.Thm ("and_true",TermC.num_str @{thm and_true}),
    7.38 +			    Celem.Thm ("and_false",TermC.num_str @{thm and_false})
    7.39  			    ], 
    7.40 -	 srls = Erls, calc = [], errpatts = [],
    7.41 +	 srls = Celem.Erls, calc = [], errpatts = [],
    7.42  	 rules =
    7.43 -  [Thm ("frac_conv", TermC.num_str @{thm frac_conv}),
    7.44 +  [Celem.Thm ("frac_conv", TermC.num_str @{thm frac_conv}),
    7.45       (*"?bdv occurs_in ?b \<Longrightarrow> 0 < ?n \<Longrightarrow> ?a / ?b ^^^ ?n = ?a * ?b ^^^ - ?n"*)
    7.46 -		   Thm ("sqrt_conv_bdv", TermC.num_str @{thm sqrt_conv_bdv}),
    7.47 +		   Celem.Thm ("sqrt_conv_bdv", TermC.num_str @{thm sqrt_conv_bdv}),
    7.48  		     (*"sqrt ?bdv = ?bdv ^^^ (1 / 2)"*)
    7.49 -		   Thm ("sqrt_conv_bdv_n", TermC.num_str @{thm sqrt_conv_bdv_n}),
    7.50 +		   Celem.Thm ("sqrt_conv_bdv_n", TermC.num_str @{thm sqrt_conv_bdv_n}),
    7.51  		     (*"sqrt (?bdv ^^^ ?n) = ?bdv ^^^ (?n / 2)"*)
    7.52 -		   Thm ("sqrt_conv", TermC.num_str @{thm sqrt_conv}),
    7.53 +		   Celem.Thm ("sqrt_conv", TermC.num_str @{thm sqrt_conv}),
    7.54  		     (*"?bdv occurs_in ?u \<Longrightarrow> sqrt ?u = ?u ^^^ (1 / 2)"*)
    7.55 -		   Thm ("root_conv", TermC.num_str @{thm root_conv}),
    7.56 +		   Celem.Thm ("root_conv", TermC.num_str @{thm root_conv}),
    7.57  		     (*"?bdv occurs_in ?u \<Longrightarrow> nroot ?n ?u = ?u ^^^ (1 / ?n)"*)
    7.58 -		   Thm ("realpow_pow_bdv", TermC.num_str @{thm realpow_pow_bdv}),
    7.59 +		   Celem.Thm ("realpow_pow_bdv", TermC.num_str @{thm realpow_pow_bdv}),
    7.60  		     (* "(?bdv ^^^ ?b) ^^^ ?c = ?bdv ^^^ (?b * ?c)"*)
    7.61 -		   Calc ("Groups.times_class.times", eval_binop "#mult_"),
    7.62 -		   Thm ("rat_mult",TermC.num_str @{thm rat_mult}),
    7.63 +		   Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
    7.64 +		   Celem.Thm ("rat_mult",TermC.num_str @{thm rat_mult}),
    7.65  		     (*a / b * (c / d) = a * c / (b * d)*)
    7.66 -		   Thm ("times_divide_eq_right",TermC.num_str @{thm times_divide_eq_right}),
    7.67 +		   Celem.Thm ("times_divide_eq_right",TermC.num_str @{thm times_divide_eq_right}),
    7.68  		     (*?x * (?y / ?z) = ?x * ?y / ?z*)
    7.69 -		   Thm ("times_divide_eq_left",TermC.num_str @{thm times_divide_eq_left})
    7.70 +		   Celem.Thm ("times_divide_eq_left",TermC.num_str @{thm times_divide_eq_left})
    7.71  		     (*?y / ?z * ?x = ?y * ?x / ?z*)
    7.72  		 ],
    7.73 -	 scr = EmptyScr};
    7.74 +	 scr = Celem.EmptyScr};
    7.75  *}
    7.76  ML {*
    7.77  (*.beautifies a term after differentiation.*)
    7.78  val diff_sym_conv =   
    7.79 -    Rls {id="diff_sym_conv", 
    7.80 +    Celem.Rls {id="diff_sym_conv", 
    7.81  	 preconds = [], 
    7.82  	 rew_ord = ("termlessI",termlessI), 
    7.83 -	 erls = append_rls "erls_diff_sym_conv" e_rls 
    7.84 -			   [Calc ("Orderings.ord_class.less",eval_equ "#less_")
    7.85 +	 erls = Celem.append_rls "erls_diff_sym_conv" Celem.e_rls 
    7.86 +			   [Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_")
    7.87  			    ], 
    7.88 -	 srls = Erls, calc = [], errpatts = [],
    7.89 -	 rules = [Thm ("frac_sym_conv", TermC.num_str @{thm frac_sym_conv}),
    7.90 -		  Thm ("sqrt_sym_conv", TermC.num_str @{thm sqrt_sym_conv}),
    7.91 -		  Thm ("root_sym_conv", TermC.num_str @{thm root_sym_conv}),
    7.92 -		  Thm ("sym_real_mult_minus1",
    7.93 +	 srls = Celem.Erls, calc = [], errpatts = [],
    7.94 +	 rules = [Celem.Thm ("frac_sym_conv", TermC.num_str @{thm frac_sym_conv}),
    7.95 +		  Celem.Thm ("sqrt_sym_conv", TermC.num_str @{thm sqrt_sym_conv}),
    7.96 +		  Celem.Thm ("root_sym_conv", TermC.num_str @{thm root_sym_conv}),
    7.97 +		  Celem.Thm ("sym_real_mult_minus1",
    7.98  		       TermC.num_str (@{thm real_mult_minus1} RS @{thm sym})),
    7.99  		      (*- ?z = "-1 * ?z"*)
   7.100 -		  Thm ("rat_mult",TermC.num_str @{thm rat_mult}),
   7.101 +		  Celem.Thm ("rat_mult",TermC.num_str @{thm rat_mult}),
   7.102  		  (*a / b * (c / d) = a * c / (b * d)*)
   7.103 -		  Thm ("times_divide_eq_right",TermC.num_str @{thm times_divide_eq_right}),
   7.104 +		  Celem.Thm ("times_divide_eq_right",TermC.num_str @{thm times_divide_eq_right}),
   7.105  		  (*?x * (?y / ?z) = ?x * ?y / ?z*)
   7.106 -		  Thm ("times_divide_eq_left",TermC.num_str @{thm times_divide_eq_left}),
   7.107 +		  Celem.Thm ("times_divide_eq_left",TermC.num_str @{thm times_divide_eq_left}),
   7.108  		  (*?y / ?z * ?x = ?y * ?x / ?z*)
   7.109 -		  Calc ("Groups.times_class.times", eval_binop "#mult_")
   7.110 +		  Celem.Calc ("Groups.times_class.times", eval_binop "#mult_")
   7.111  		 ],
   7.112 -	 scr = EmptyScr};
   7.113 +	 scr = Celem.EmptyScr};
   7.114  
   7.115  (*..*)
   7.116  val srls_diff = 
   7.117 -    Rls {id="srls_differentiate..", 
   7.118 +    Celem.Rls {id="srls_differentiate..", 
   7.119  	 preconds = [], 
   7.120  	 rew_ord = ("termlessI",termlessI), 
   7.121 -	 erls = e_rls, 
   7.122 -	 srls = Erls, calc = [], errpatts = [],
   7.123 -	 rules = [Calc("Tools.lhs", eval_lhs "eval_lhs_"),
   7.124 -		  Calc("Tools.rhs", eval_rhs "eval_rhs_"),
   7.125 -		  Calc("Diff.primed", eval_primed "Diff.primed")
   7.126 +	 erls = Celem.e_rls, 
   7.127 +	 srls = Celem.Erls, calc = [], errpatts = [],
   7.128 +	 rules = [Celem.Calc("Tools.lhs", eval_lhs "eval_lhs_"),
   7.129 +		  Celem.Calc("Tools.rhs", eval_rhs "eval_rhs_"),
   7.130 +		  Celem.Calc("Diff.primed", eval_primed "Diff.primed")
   7.131  		  ],
   7.132 -	 scr = EmptyScr};
   7.133 +	 scr = Celem.EmptyScr};
   7.134  *}
   7.135  ML {*
   7.136  (*..*)
   7.137  val erls_diff = 
   7.138 -    append_rls "erls_differentiate.." e_rls
   7.139 -               [Thm ("not_true",TermC.num_str @{thm not_true}),
   7.140 -		Thm ("not_false",TermC.num_str @{thm not_false}),
   7.141 +    Celem.append_rls "erls_differentiate.." Celem.e_rls
   7.142 +               [Celem.Thm ("not_true",TermC.num_str @{thm not_true}),
   7.143 +		Celem.Thm ("not_false",TermC.num_str @{thm not_false}),
   7.144  		
   7.145 -		Calc ("Atools.ident",eval_ident "#ident_"),    
   7.146 -		Calc ("Atools.is'_atom",eval_is_atom "#is_atom_"),
   7.147 -		Calc ("Atools.occurs'_in",eval_occurs_in ""),
   7.148 -		Calc ("Atools.is'_const",eval_const "#is_const_")
   7.149 +		Celem.Calc ("Atools.ident",eval_ident "#ident_"),    
   7.150 +		Celem.Calc ("Atools.is'_atom",eval_is_atom "#is_atom_"),
   7.151 +		Celem.Calc ("Atools.occurs'_in",eval_occurs_in ""),
   7.152 +		Celem.Calc ("Atools.is'_const",eval_const "#is_const_")
   7.153  		];
   7.154  
   7.155  (*.rules for differentiation, _no_ simplification.*)
   7.156  val diff_rules =
   7.157 -    Rls {id="diff_rules", preconds = [], rew_ord = ("termlessI",termlessI), 
   7.158 -	 erls = erls_diff, srls = Erls, calc = [], errpatts = [],
   7.159 -	 rules = [Thm ("diff_sum",TermC.num_str @{thm diff_sum}),
   7.160 -		  Thm ("diff_dif",TermC.num_str @{thm diff_dif}),
   7.161 -		  Thm ("diff_prod_const",TermC.num_str @{thm diff_prod_const}),
   7.162 -		  Thm ("diff_prod",TermC.num_str @{thm diff_prod}),
   7.163 -		  Thm ("diff_quot",TermC.num_str @{thm diff_quot}),
   7.164 -		  Thm ("diff_sin",TermC.num_str @{thm diff_sin}),
   7.165 -		  Thm ("diff_sin_chain",TermC.num_str @{thm diff_sin_chain}),
   7.166 -		  Thm ("diff_cos",TermC.num_str @{thm diff_cos}),
   7.167 -		  Thm ("diff_cos_chain",TermC.num_str @{thm diff_cos_chain}),
   7.168 -		  Thm ("diff_pow",TermC.num_str @{thm diff_pow}),
   7.169 -		  Thm ("diff_pow_chain",TermC.num_str @{thm diff_pow_chain}),
   7.170 -		  Thm ("diff_ln",TermC.num_str @{thm diff_ln}),
   7.171 -		  Thm ("diff_ln_chain",TermC.num_str @{thm diff_ln_chain}),
   7.172 -		  Thm ("diff_exp",TermC.num_str @{thm diff_exp}),
   7.173 -		  Thm ("diff_exp_chain",TermC.num_str @{thm diff_exp_chain}),
   7.174 +    Celem.Rls {id="diff_rules", preconds = [], rew_ord = ("termlessI",termlessI), 
   7.175 +	 erls = erls_diff, srls = Celem.Erls, calc = [], errpatts = [],
   7.176 +	 rules = [Celem.Thm ("diff_sum",TermC.num_str @{thm diff_sum}),
   7.177 +		  Celem.Thm ("diff_dif",TermC.num_str @{thm diff_dif}),
   7.178 +		  Celem.Thm ("diff_prod_const",TermC.num_str @{thm diff_prod_const}),
   7.179 +		  Celem.Thm ("diff_prod",TermC.num_str @{thm diff_prod}),
   7.180 +		  Celem.Thm ("diff_quot",TermC.num_str @{thm diff_quot}),
   7.181 +		  Celem.Thm ("diff_sin",TermC.num_str @{thm diff_sin}),
   7.182 +		  Celem.Thm ("diff_sin_chain",TermC.num_str @{thm diff_sin_chain}),
   7.183 +		  Celem.Thm ("diff_cos",TermC.num_str @{thm diff_cos}),
   7.184 +		  Celem.Thm ("diff_cos_chain",TermC.num_str @{thm diff_cos_chain}),
   7.185 +		  Celem.Thm ("diff_pow",TermC.num_str @{thm diff_pow}),
   7.186 +		  Celem.Thm ("diff_pow_chain",TermC.num_str @{thm diff_pow_chain}),
   7.187 +		  Celem.Thm ("diff_ln",TermC.num_str @{thm diff_ln}),
   7.188 +		  Celem.Thm ("diff_ln_chain",TermC.num_str @{thm diff_ln_chain}),
   7.189 +		  Celem.Thm ("diff_exp",TermC.num_str @{thm diff_exp}),
   7.190 +		  Celem.Thm ("diff_exp_chain",TermC.num_str @{thm diff_exp_chain}),
   7.191  (*
   7.192 -		  Thm ("diff_sqrt",TermC.num_str @{thm diff_sqrt}),
   7.193 -		  Thm ("diff_sqrt_chain",TermC.num_str @{thm diff_sqrt_chain}),
   7.194 +		  Celem.Thm ("diff_sqrt",TermC.num_str @{thm diff_sqrt}),
   7.195 +		  Celem.Thm ("diff_sqrt_chain",TermC.num_str @{thm diff_sqrt_chain}),
   7.196  *)
   7.197 -		  Thm ("diff_const",TermC.num_str @{thm diff_const}),
   7.198 -		  Thm ("diff_var",TermC.num_str @{thm diff_var})
   7.199 +		  Celem.Thm ("diff_const",TermC.num_str @{thm diff_const}),
   7.200 +		  Celem.Thm ("diff_var",TermC.num_str @{thm diff_var})
   7.201  		  ],
   7.202 -	 scr = EmptyScr};
   7.203 +	 scr = Celem.EmptyScr};
   7.204  *}
   7.205  ML {*
   7.206  (*.normalisation for checking user-input.*)
   7.207  val norm_diff = 
   7.208 -  Rls
   7.209 +  Celem.Rls
   7.210      {id="norm_diff", preconds = [], rew_ord = ("termlessI",termlessI), 
   7.211 -     erls = Erls, srls = Erls, calc = [], errpatts = [],
   7.212 -     rules = [Rls_ diff_rules, Rls_ norm_Poly ],
   7.213 -     scr = EmptyScr};
   7.214 +     erls = Celem.Erls, srls = Celem.Erls, calc = [], errpatts = [],
   7.215 +     rules = [Celem.Rls_ diff_rules, Celem.Rls_ norm_Poly ],
   7.216 +     scr = Celem.EmptyScr};
   7.217  *}
   7.218  setup {* KEStore_Elems.add_rlss 
   7.219    [("erls_diff", (Context.theory_name @{theory}, prep_rls' erls_diff)), 
   7.220 @@ -248,20 +248,20 @@
   7.221  
   7.222  (** problem types **)
   7.223  setup {* KEStore_Elems.add_pbts
   7.224 -  [(Specify.prep_pbt thy "pbl_fun" [] e_pblID (["function"], [], e_rls, NONE, [])),
   7.225 -    (Specify.prep_pbt thy "pbl_fun_deriv" [] e_pblID
   7.226 +  [(Specify.prep_pbt thy "pbl_fun" [] Celem.e_pblID (["function"], [], Celem.e_rls, NONE, [])),
   7.227 +    (Specify.prep_pbt thy "pbl_fun_deriv" [] Celem.e_pblID
   7.228        (["derivative_of","function"],
   7.229          [("#Given" ,["functionTerm f_f","differentiateFor v_v"]),
   7.230            ("#Find"  ,["derivative f_f'"])],
   7.231 -        append_rls "e_rls" e_rls [],
   7.232 +        Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [],
   7.233          SOME "Diff (f_f, v_v)", [["diff","differentiate_on_R"],
   7.234  			  ["diff","after_simplification"]])),
   7.235      (*here "named" is used differently from Integration"*)
   7.236 -    (Specify.prep_pbt thy "pbl_fun_deriv_nam" [] e_pblID
   7.237 +    (Specify.prep_pbt thy "pbl_fun_deriv_nam" [] Celem.e_pblID
   7.238        (["named","derivative_of","function"],
   7.239          [("#Given" ,["functionEq f_f","differentiateFor v_v"]),
   7.240            ("#Find"  ,["derivativeEq f_f'"])],
   7.241 -        append_rls "e_rls" e_rls [],
   7.242 +        Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [],
   7.243          SOME "Differentiate (f_f, v_v)",
   7.244          [["diff","differentiate_equality"]]))] *}
   7.245  
   7.246 @@ -281,16 +281,16 @@
   7.247    | argl2dtss _ = error "Diff.ML: wrong argument for argl2dtss";
   7.248  *}
   7.249  setup {* KEStore_Elems.add_mets
   7.250 -  [Specify.prep_met thy "met_diff" [] e_metID
   7.251 +  [Specify.prep_met thy "met_diff" [] Celem.e_metID
   7.252        (["diff"], [],
   7.253 -        {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = e_rls, prls=e_rls,
   7.254 +        {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = Celem.e_rls, prls=Celem.e_rls,
   7.255            crls = Atools_erls, errpats = [], nrls = norm_diff},
   7.256          "empty_script"),
   7.257 -    Specify.prep_met thy "met_diff_onR" [] e_metID
   7.258 +    Specify.prep_met thy "met_diff_onR" [] Celem.e_metID
   7.259        (["diff","differentiate_on_R"],
   7.260          [("#Given" ,["functionTerm f_f","differentiateFor v_v"]),
   7.261            ("#Find"  ,["derivative f_f'"])],
   7.262 -        {rew_ord'="tless_true", rls' = erls_diff, calc = [], srls = e_rls, prls=e_rls,
   7.263 +        {rew_ord'="tless_true", rls' = erls_diff, calc = [], srls = Celem.e_rls, prls=Celem.e_rls,
   7.264            crls = Atools_erls, errpats = [], nrls = norm_diff},
   7.265          "Script DiffScr (f_f::real) (v_v::real) =                          " ^
   7.266            " (let f_f' = Take (d_d v_v f_f)                                    " ^
   7.267 @@ -314,11 +314,11 @@
   7.268            "    (Repeat (Rewrite_Inst [(bdv,v_v)] diff_var        False)) Or " ^
   7.269            "    (Repeat (Rewrite_Set             make_polynomial False)))) @@ " ^
   7.270            " (Try (Rewrite_Set_Inst [(bdv,v_v)] diff_sym_conv False)))) f_f')"),
   7.271 -    Specify.prep_met thy "met_diff_simpl" [] e_metID
   7.272 +    Specify.prep_met thy "met_diff_simpl" [] Celem.e_metID
   7.273        (["diff","diff_simpl"],
   7.274          [("#Given", ["functionTerm f_f","differentiateFor v_v"]),
   7.275           ("#Find" , ["derivative f_f'"])],
   7.276 -        {rew_ord'="tless_true", rls' = erls_diff, calc = [], srls = e_rls, prls=e_rls,
   7.277 +        {rew_ord'="tless_true", rls' = erls_diff, calc = [], srls = Celem.e_rls, prls=Celem.e_rls,
   7.278            crls = Atools_erls, errpats = [], nrls = norm_diff},
   7.279          "Script DiffScr (f_f::real) (v_v::real) =                           " ^
   7.280            " (let f_f' = Take (d_d v_v f_f)                                  " ^
   7.281 @@ -342,11 +342,11 @@
   7.282            "    (Repeat (Rewrite_Inst [(bdv,v_v)] diff_var        False)) Or " ^
   7.283            "    (Repeat (Rewrite_Set              make_polynomial False))))  " ^
   7.284            " )) f_f')"),
   7.285 -    Specify.prep_met thy "met_diff_equ" [] e_metID
   7.286 +    Specify.prep_met thy "met_diff_equ" [] Celem.e_metID
   7.287        (["diff","differentiate_equality"],
   7.288          [("#Given" ,["functionEq f_f","differentiateFor v_v"]),
   7.289            ("#Find"  ,["derivativeEq f_f'"])],
   7.290 -        {rew_ord'="tless_true", rls' = erls_diff, calc = [], srls = srls_diff, prls=e_rls,
   7.291 +        {rew_ord'="tless_true", rls' = erls_diff, calc = [], srls = srls_diff, prls=Celem.e_rls,
   7.292            crls=Atools_erls, errpats = [], nrls = norm_diff},
   7.293          "Script DiffEqScr (f_f::bool) (v_v::real) =                          " ^
   7.294            " (let f_f' = Take ((primed (lhs f_f)) = d_d v_v (rhs f_f))            " ^
   7.295 @@ -371,11 +371,11 @@
   7.296            "    (Repeat (Rewrite_Inst [(bdv,v_v)] diff_var        False)) Or   " ^
   7.297            "    (Repeat (Rewrite_Set             make_polynomial False)))) @@ " ^
   7.298            " (Try (Rewrite_Set_Inst [(bdv,v_v)] diff_sym_conv False)))) f_f')"),
   7.299 -    Specify.prep_met thy "met_diff_after_simp" [] e_metID
   7.300 +    Specify.prep_met thy "met_diff_after_simp" [] Celem.e_metID
   7.301        (["diff","after_simplification"],
   7.302          [("#Given" ,["functionTerm f_f","differentiateFor v_v"]),
   7.303            ("#Find"  ,["derivative f_f'"])],
   7.304 -        {rew_ord'="tless_true", rls' = e_rls, calc = [], srls = e_rls, prls=e_rls,
   7.305 +        {rew_ord'="tless_true", rls' = Celem.e_rls, calc = [], srls = Celem.e_rls, prls=Celem.e_rls,
   7.306            crls=Atools_erls, errpats = [], nrls = norm_Rational},
   7.307          "Script DiffScr (f_f::real) (v_v::real) =                          " ^
   7.308            " (let f_f' = Take (d_d v_v f_f)                                    " ^
     8.1 --- a/src/Tools/isac/Knowledge/DiffApp-scrpbl.sml	Thu Mar 15 10:17:44 2018 +0100
     8.2 +++ b/src/Tools/isac/Knowledge/DiffApp-scrpbl.sml	Thu Mar 15 12:42:04 2018 +0100
     8.3 @@ -315,7 +315,7 @@
     8.4   "additionalRels [A=#2*a*b - a^^^#2,(a//#2)^^^#2 + (b//#2)^^^#2 =R^^^#2]",
     8.5   "additionalRels [A=#2*a*b - a^^^#2,a=#2*R*sin alpha, b=#2*R*cos alpha]"];
     8.6  val (dI',pI',mI')=
     8.7 -  ("DiffAppl",["Script","maximum_of","function"],e_metID);
     8.8 +  ("DiffAppl",["Script","maximum_of","function"],Celem.e_metID);
     8.9  val c = []:cid;
    8.10  
    8.11  (*
    8.12 @@ -416,14 +416,14 @@
    8.13  	   "additionalRels [(a//#2)^^^#2 + (b//#2)^^^#2 =R^^^#2]",
    8.14  	   "additionalRels [a=#2*R*sin alpha, b=#2*R*cos alpha]"];
    8.15  val (dI',pI',mI')=
    8.16 -  ("DiffAppl",["DiffAppl","test_maximum"],e_metID);
    8.17 +  ("DiffAppl",["DiffAppl","test_maximum"],Celem.e_metID);
    8.18  val p = e_pos'; val c = []; 
    8.19  
    8.20  val (mI,m) = ("Init_Proof",Init_Proof (cts, (dI',pI',mI')));
    8.21 -val (pst as (sc,pt,cl):pstate) = (EmptyScr, e_ctree, []);
    8.22 +val (pst as (sc,pt,cl):pstate) = (Celem.EmptyScr, e_ctree, []);
    8.23  val (p,_,f,nxt,_,(_,pt,_)) = do_ (mI,m) p c pst;
    8.24  (*val nxt = ("Add_Given",Add_Given "fixedValues [R = R]")*)
    8.25  
    8.26  val (p,_,Form' (PpcKF (_,_,ppc)),nxt,_,(_,pt,_)) = 
    8.27 -  do_ nxt p c (EmptyScr,pt,[]);
    8.28 +  do_ nxt p c (Celem.EmptyScr,pt,[]);
    8.29  (*val nxt = ("Add_Given",Add_Given "boundVariable a") *)
     9.1 --- a/src/Tools/isac/Knowledge/DiffApp.sml	Thu Mar 15 10:17:44 2018 +0100
     9.2 +++ b/src/Tools/isac/Knowledge/DiffApp.sml	Thu Mar 15 12:42:04 2018 +0100
     9.3 @@ -24,7 +24,7 @@
     9.4    ]),
     9.5  
     9.6   prep_pbt DiffAppl.thy
     9.7 - (["DiffAppl","make","function"]:pblID,
     9.8 + (["DiffAppl","make","function"],
     9.9    [("#Given" ,"functionOf f_f"),
    9.10     ("#Given" ,"boundVariable v_v"),
    9.11     ("#Given" ,"equalities eqs"),
    9.12 @@ -32,7 +32,7 @@
    9.13    ]),
    9.14  
    9.15   prep_pbt DiffAppl.thy
    9.16 - (["DiffAppl","on_interval","maximum_of","function"]:pblID,
    9.17 + (["DiffAppl","on_interval","maximum_of","function"],
    9.18    [("#Given" ,"functionTerm t_"),
    9.19     ("#Given" ,"boundVariable v_v"),
    9.20     ("#Given" ,"interval itv_"),
    9.21 @@ -40,7 +40,7 @@
    9.22    ]),
    9.23  
    9.24   prep_pbt DiffAppl.thy
    9.25 - (["DiffAppl","find_values","tool"]:pblID,
    9.26 + (["DiffAppl","find_values","tool"],
    9.27    [("#Given" ,"maxArgument ma_"),
    9.28     ("#Given" ,"functionTerm f_f"),
    9.29     ("#Given" ,"boundVariable v_v"),
    9.30 @@ -52,7 +52,7 @@
    9.31  
    9.32  methods:= overwritel (!methods,
    9.33  [
    9.34 - (("DiffAppl","max_by_calculus"):metID,
    9.35 + (("DiffAppl","max_by_calculus"),
    9.36    {ppc = prep_met DiffAppl.thy
    9.37     [("#Given" ,"fixedValues f_ix"),
    9.38      ("#Given" ,"boundVariable v_v"),
    9.39 @@ -63,9 +63,9 @@
    9.40      ("#Relate","relations r_s")
    9.41      ],
    9.42     rew_ord'="tless_true",rls'="eval_rls",asm_rls=[],asm_thm=[],
    9.43 -   scr=EmptyScr} : met),
    9.44 +   scr=Celem.EmptyScr} : met),
    9.45  
    9.46 - (("DiffAppl","make_fun_by_new_variable"):metID,
    9.47 + (("DiffAppl","make_fun_by_new_variable"),
    9.48    {ppc = prep_met DiffAppl.thy
    9.49     [("#Given" ,"functionOf f_f"),
    9.50      ("#Given" ,"boundVariable v_v"),
    9.51 @@ -73,9 +73,9 @@
    9.52      ("#Find"  ,"functionTerm f_0_")
    9.53      ],
    9.54     rew_ord'="tless_true",rls'="eval_rls",asm_rls=[],asm_thm=[],
    9.55 -   scr=EmptyScr} : met),
    9.56 +   scr=Celem.EmptyScr} : met),
    9.57  
    9.58 - (("DiffAppl","make_fun_by_explicit"):metID,
    9.59 + (("DiffAppl","make_fun_by_explicit"),
    9.60    {ppc = prep_met DiffAppl.thy
    9.61     [("#Given" ,"functionOf f_f"),
    9.62      ("#Given" ,"boundVariable v_v"),
    9.63 @@ -83,9 +83,9 @@
    9.64      ("#Find"  ,"functionTerm f_0_")
    9.65      ],
    9.66     rew_ord'="tless_true",rls'="eval_rls",asm_rls=[],asm_thm=[],
    9.67 -   scr=EmptyScr} : met),
    9.68 +   scr=Celem.EmptyScr} : met),
    9.69    
    9.70 - (("DiffAppl","max_on_interval_by_calculus"):metID,
    9.71 + (("DiffAppl","max_on_interval_by_calculus"),
    9.72    {ppc = prep_met DiffAppl.thy
    9.73     [("#Given" ,"functionTerm t_"),
    9.74      ("#Given" ,"boundVariable v_v"),
    9.75 @@ -94,11 +94,11 @@
    9.76      ("#Find"  ,"maxArgument v_0")
    9.77      ],
    9.78     rew_ord'="tless_true",rls'="eval_rls",asm_rls=[],asm_thm=[],
    9.79 -   scr=EmptyScr} : met),
    9.80 +   scr=Celem.EmptyScr} : met),
    9.81  
    9.82 - (("DiffAppl","find_values"):metID,
    9.83 + (("DiffAppl","find_values"),
    9.84    {ppc = prep_met DiffAppl.thy
    9.85     [],
    9.86     rew_ord'="tless_true",rls'="eval_rls",asm_rls=[],asm_thm=[],
    9.87 -   scr=EmptyScr} : met)
    9.88 +   scr=Celem.EmptyScr} : met)
    9.89  ]);
    10.1 --- a/src/Tools/isac/Knowledge/DiffApp.thy	Thu Mar 15 10:17:44 2018 +0100
    10.2 +++ b/src/Tools/isac/Knowledge/DiffApp.thy	Thu Mar 15 12:42:04 2018 +0100
    10.3 @@ -49,86 +49,86 @@
    10.4  val thy = @{theory};
    10.5  
    10.6  val eval_rls = prep_rls' (
    10.7 -  Rls {id = "eval_rls", preconds = [], rew_ord = ("termlessI", termlessI), 
    10.8 -    erls = e_rls, srls = Erls, calc = [], errpatts = [],
    10.9 -    rules = [Thm ("refl", TermC.num_str @{thm refl}),
   10.10 -      Thm ("order_refl", TermC.num_str @{thm order_refl}),
   10.11 -      Thm ("radd_left_cancel_le", TermC.num_str @{thm radd_left_cancel_le}),
   10.12 -      Thm ("not_true", TermC.num_str @{thm not_true}),
   10.13 -      Thm ("not_false", TermC.num_str @{thm not_false}),
   10.14 -      Thm ("and_true", TermC.num_str @{thm and_true}),
   10.15 -      Thm ("and_false", TermC.num_str @{thm and_false}),
   10.16 -      Thm ("or_true", TermC.num_str @{thm or_true}),
   10.17 -      Thm ("or_false", TermC.num_str @{thm or_false}),
   10.18 -      Thm ("and_commute", TermC.num_str @{thm and_commute}),
   10.19 -      Thm ("or_commute", TermC.num_str @{thm or_commute}),
   10.20 +  Celem.Rls {id = "eval_rls", preconds = [], rew_ord = ("termlessI", termlessI), 
   10.21 +    erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [],
   10.22 +    rules = [Celem.Thm ("refl", TermC.num_str @{thm refl}),
   10.23 +      Celem.Thm ("order_refl", TermC.num_str @{thm order_refl}),
   10.24 +      Celem.Thm ("radd_left_cancel_le", TermC.num_str @{thm radd_left_cancel_le}),
   10.25 +      Celem.Thm ("not_true", TermC.num_str @{thm not_true}),
   10.26 +      Celem.Thm ("not_false", TermC.num_str @{thm not_false}),
   10.27 +      Celem.Thm ("and_true", TermC.num_str @{thm and_true}),
   10.28 +      Celem.Thm ("and_false", TermC.num_str @{thm and_false}),
   10.29 +      Celem.Thm ("or_true", TermC.num_str @{thm or_true}),
   10.30 +      Celem.Thm ("or_false", TermC.num_str @{thm or_false}),
   10.31 +      Celem.Thm ("and_commute", TermC.num_str @{thm and_commute}),
   10.32 +      Celem.Thm ("or_commute", TermC.num_str @{thm or_commute}),
   10.33        
   10.34 -      Calc ("Orderings.ord_class.less", eval_equ "#less_"),
   10.35 -      Calc ("Orderings.ord_class.less_eq", eval_equ "#less_equal_"),
   10.36 +      Celem.Calc ("Orderings.ord_class.less", eval_equ "#less_"),
   10.37 +      Celem.Calc ("Orderings.ord_class.less_eq", eval_equ "#less_equal_"),
   10.38        
   10.39 -      Calc ("Atools.ident", eval_ident "#ident_"),    
   10.40 -      Calc ("Atools.is'_const", eval_const "#is_const_"),
   10.41 -      Calc ("Atools.occurs'_in", eval_occurs_in ""),    
   10.42 -      Calc ("Tools.matches", eval_matches "")],
   10.43 -    scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
   10.44 -    }:rls);
   10.45 +      Celem.Calc ("Atools.ident", eval_ident "#ident_"),    
   10.46 +      Celem.Calc ("Atools.is'_const", eval_const "#is_const_"),
   10.47 +      Celem.Calc ("Atools.occurs'_in", eval_occurs_in ""),    
   10.48 +      Celem.Calc ("Tools.matches", eval_matches "")],
   10.49 +    scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
   10.50 +    });
   10.51  *}
   10.52  setup {* KEStore_Elems.add_rlss [("eval_rls", (Context.theory_name @{theory}, eval_rls))] *}
   10.53  
   10.54  (** problem types **)
   10.55  setup {* KEStore_Elems.add_pbts
   10.56 -  [(Specify.prep_pbt thy "pbl_fun_max" [] e_pblID
   10.57 +  [(Specify.prep_pbt thy "pbl_fun_max" [] Celem.e_pblID
   10.58        (["maximum_of","function"],
   10.59          [("#Given" ,["fixedValues f_ix"]),
   10.60            ("#Find"  ,["maximum m_m","valuesFor v_s"]),
   10.61            ("#Relate",["relations r_s"])],
   10.62 -        e_rls, NONE, [])),
   10.63 -    (Specify.prep_pbt thy "pbl_fun_make" [] e_pblID
   10.64 -      (["make","function"]:pblID,
   10.65 +        Celem.e_rls, NONE, [])),
   10.66 +    (Specify.prep_pbt thy "pbl_fun_make" [] Celem.e_pblID
   10.67 +      (["make","function"],
   10.68          [("#Given" ,["functionOf f_f","boundVariable v_v","equalities eqs"]),
   10.69            ("#Find"  ,["functionEq f_1"])],
   10.70 -        e_rls, NONE, [])),
   10.71 -    (Specify.prep_pbt thy "pbl_fun_max_expl" [] e_pblID
   10.72 -      (["by_explicit","make","function"]:pblID,
   10.73 +        Celem.e_rls, NONE, [])),
   10.74 +    (Specify.prep_pbt thy "pbl_fun_max_expl" [] Celem.e_pblID
   10.75 +      (["by_explicit","make","function"],
   10.76          [("#Given" ,["functionOf f_f","boundVariable v_v","equalities eqs"]),
   10.77            ("#Find"  ,["functionEq f_1"])],
   10.78 -      e_rls, NONE, [["DiffApp","make_fun_by_explicit"]])),
   10.79 -    (Specify.prep_pbt thy "pbl_fun_max_newvar" [] e_pblID
   10.80 -      (["by_new_variable","make","function"]:pblID,
   10.81 +      Celem.e_rls, NONE, [["DiffApp","make_fun_by_explicit"]])),
   10.82 +    (Specify.prep_pbt thy "pbl_fun_max_newvar" [] Celem.e_pblID
   10.83 +      (["by_new_variable","make","function"],
   10.84          [("#Given" ,["functionOf f_f","boundVariable v_v","equalities eqs"]),
   10.85            (*WN.12.5.03: precond for distinction still missing*)
   10.86            ("#Find"  ,["functionEq f_1"])],
   10.87 -      e_rls, NONE, [["DiffApp","make_fun_by_new_variable"]])),
   10.88 -    (Specify.prep_pbt thy "pbl_fun_max_interv" [] e_pblID
   10.89 -      (["on_interval","maximum_of","function"]:pblID,
   10.90 +      Celem.e_rls, NONE, [["DiffApp","make_fun_by_new_variable"]])),
   10.91 +    (Specify.prep_pbt thy "pbl_fun_max_interv" [] Celem.e_pblID
   10.92 +      (["on_interval","maximum_of","function"],
   10.93          [("#Given" ,["functionEq t_t","boundVariable v_v","interval i_tv"]),
   10.94            (*WN.12.5.03: precond for distinction still missing*)
   10.95            ("#Find"  ,["maxArgument v_0"])],
   10.96 -      e_rls, NONE, [])),
   10.97 -    (Specify.prep_pbt thy "pbl_tool" [] e_pblID
   10.98 -      (["tool"]:pblID, [], e_rls, NONE, [])),
   10.99 -    (Specify.prep_pbt thy "pbl_tool_findvals" [] e_pblID
  10.100 -      (["find_values","tool"]:pblID,
  10.101 +      Celem.e_rls, NONE, [])),
  10.102 +    (Specify.prep_pbt thy "pbl_tool" [] Celem.e_pblID
  10.103 +      (["tool"], [], Celem.e_rls, NONE, [])),
  10.104 +    (Specify.prep_pbt thy "pbl_tool_findvals" [] Celem.e_pblID
  10.105 +      (["find_values","tool"],
  10.106          [("#Given" ,["maxArgument m_ax","functionEq f_f","boundVariable v_v"]),
  10.107            ("#Find"  ,["valuesFor v_ls"]),
  10.108            ("#Relate",["additionalRels r_s"])],
  10.109 -      e_rls, NONE, []))] *}
  10.110 +      Celem.e_rls, NONE, []))] *}
  10.111  
  10.112  
  10.113  (** methods, scripts not yet implemented **)
  10.114  setup {* KEStore_Elems.add_mets
  10.115 -  [Specify.prep_met thy "met_diffapp" [] e_metID
  10.116 +  [Specify.prep_met thy "met_diffapp" [] Celem.e_metID
  10.117        (["DiffApp"], [],
  10.118 -        {rew_ord'="tless_true", rls'=Atools_erls,calc = [], srls = e_rls, prls = e_rls,
  10.119 +        {rew_ord'="tless_true", rls'=Atools_erls,calc = [], srls = Celem.e_rls, prls = Celem.e_rls,
  10.120            crls = Atools_erls, errpats = [], nrls = norm_Rational (*, asm_rls=[],asm_thm=[]*)},
  10.121          "empty_script"),
  10.122 -    Specify.prep_met thy "met_diffapp_max" [] e_metID
  10.123 -      (["DiffApp","max_by_calculus"]:metID,
  10.124 +    Specify.prep_met thy "met_diffapp_max" [] Celem.e_metID
  10.125 +      (["DiffApp","max_by_calculus"],
  10.126          [("#Given" ,["fixedValues f_ix","maximum m_m","relations r_s", "boundVariable v_v",
  10.127                "interval i_tv","errorBound e_rr"]),
  10.128            ("#Find"  ,["valuesFor v_s"]),
  10.129            ("#Relate",[])],
  10.130 -      {rew_ord'="tless_true",rls'=eval_rls,calc=[],srls=list_rls,prls=e_rls, crls = eval_rls,
  10.131 +      {rew_ord'="tless_true",rls'=eval_rls,calc=[],srls=list_rls,prls=Celem.e_rls, crls = eval_rls,
  10.132          errpats = [], nrls = norm_Rational (*,  asm_rls=[],asm_thm=[]*)},
  10.133          "Script Maximum_value(f_ix::bool list)(m_m::real) (r_s::bool list)       " ^
  10.134            "      (v_v::real) (itv_v::real set) (e_rr::bool) =                       " ^ 
  10.135 @@ -144,11 +144,11 @@
  10.136            " in ((SubProblem (DiffApp',[find_values,tool],[Isac,find_values])      " ^
  10.137            "      [REAL m_x, REAL (Rhs t_t), REAL v_v, REAL m_m,                  " ^
  10.138            "       BOOL_LIST (dropWhile (ident e_e) r_s)])::bool list))            "),
  10.139 -    Specify.prep_met thy "met_diffapp_funnew" [] e_metID
  10.140 -      (["DiffApp","make_fun_by_new_variable"]:metID,
  10.141 +    Specify.prep_met thy "met_diffapp_funnew" [] Celem.e_metID
  10.142 +      (["DiffApp","make_fun_by_new_variable"],
  10.143          [("#Given" ,["functionOf f_f","boundVariable v_v","equalities eqs"]),
  10.144            ("#Find"  ,["functionEq f_1"])],
  10.145 -        {rew_ord'="tless_true",rls'=eval_rls,srls=list_rls,prls=e_rls, calc=[], crls = eval_rls,
  10.146 +        {rew_ord'="tless_true",rls'=eval_rls,srls=list_rls,prls=Celem.e_rls, calc=[], crls = eval_rls,
  10.147            errpats = [], nrls = norm_Rational(*,asm_rls=[],asm_thm=[]*)},
  10.148          "Script Make_fun_by_new_variable (f_f::real) (v_v::real)                " ^
  10.149            "      (eqs::bool list) =                                            " ^
  10.150 @@ -166,11 +166,11 @@
  10.151            "                (SubProblem (DiffApp',[univariate,equation],[no_met])" ^
  10.152            "                    [BOOL e_2, REAL v_2])" ^
  10.153            "in Substitute [(v_1 = (rhs o hd) s_1),(v_2 = (rhs o hd) s_2)] h_h)"),
  10.154 -    Specify.prep_met thy "met_diffapp_funexp" [] e_metID
  10.155 -      (["DiffApp","make_fun_by_explicit"]:metID,
  10.156 +    Specify.prep_met thy "met_diffapp_funexp" [] Celem.e_metID
  10.157 +      (["DiffApp","make_fun_by_explicit"],
  10.158          [("#Given" ,["functionOf f_f","boundVariable v_v","equalities eqs"]),
  10.159            ("#Find"  ,["functionEq f_1"])],
  10.160 -        {rew_ord'="tless_true",rls'=eval_rls,calc=[],srls=list_rls,prls=e_rls, crls = eval_rls,
  10.161 +        {rew_ord'="tless_true",rls'=eval_rls,calc=[],srls=list_rls,prls=Celem.e_rls, crls = eval_rls,
  10.162            errpats = [], nrls = norm_Rational (*, asm_rls=[],asm_thm=[]*)},
  10.163          "Script Make_fun_by_explicit (f_f::real) (v_v::real)                 " ^
  10.164            "      (eqs::bool list) =                                         " ^
  10.165 @@ -182,23 +182,23 @@
  10.166            "              (SubProblem(DiffApp',[univariate,equation],[no_met])" ^
  10.167            "                          [BOOL e_1, REAL v_1])                 " ^
  10.168            " in Substitute [(v_1 = (rhs o hd) s_1)] h_h)                       "),
  10.169 -    Specify.prep_met thy "met_diffapp_max_oninterval" [] e_metID
  10.170 -      (["DiffApp","max_on_interval_by_calculus"]:metID,
  10.171 +    Specify.prep_met thy "met_diffapp_max_oninterval" [] Celem.e_metID
  10.172 +      (["DiffApp","max_on_interval_by_calculus"],
  10.173          [("#Given" ,["functionEq t_t","boundVariable v_v","interval i_tv"(*, "errorBound e_rr"*)]),
  10.174            ("#Find"  ,["maxArgument v_0"])],
  10.175 -      {rew_ord'="tless_true",rls'=eval_rls,calc=[],srls = e_rls,prls=e_rls, crls = eval_rls,
  10.176 +      {rew_ord'="tless_true",rls'=eval_rls,calc=[],srls = Celem.e_rls,prls=Celem.e_rls, crls = eval_rls,
  10.177          errpats = [], nrls = norm_Rational (*, asm_rls=[],asm_thm=[]*)},
  10.178        "empty_script"),
  10.179 -    Specify.prep_met thy "met_diffapp_findvals" [] e_metID
  10.180 -      (["DiffApp","find_values"]:metID, [],
  10.181 -        {rew_ord'="tless_true",rls'=eval_rls,calc=[],srls = e_rls,prls=e_rls, crls = eval_rls,
  10.182 +    Specify.prep_met thy "met_diffapp_findvals" [] Celem.e_metID
  10.183 +      (["DiffApp","find_values"], [],
  10.184 +        {rew_ord'="tless_true",rls'=eval_rls,calc=[],srls = Celem.e_rls,prls=Celem.e_rls, crls = eval_rls,
  10.185            errpats = [], nrls = norm_Rational(*, asm_rls = [], asm_thm = []*)},
  10.186          "empty_script")]
  10.187  *}
  10.188  ML {*
  10.189 -val list_rls = append_rls "list_rls" list_rls
  10.190 -  [Thm ("filterVar_Const", TermC.num_str @{thm filterVar_Const}),
  10.191 -   Thm ("filterVar_Nil", TermC.num_str @{thm filterVar_Nil})];
  10.192 +val list_rls = Celem.append_rls "list_rls" list_rls
  10.193 +  [Celem.Thm ("filterVar_Const", TermC.num_str @{thm filterVar_Const}),
  10.194 +   Celem.Thm ("filterVar_Nil", TermC.num_str @{thm filterVar_Nil})];
  10.195  *}
  10.196  setup {* KEStore_Elems.add_rlss [("list_rls", (Context.theory_name @{theory}, list_rls))] *}
  10.197  
    11.1 --- a/src/Tools/isac/Knowledge/DiophantEq.thy	Thu Mar 15 10:17:44 2018 +0100
    11.2 +++ b/src/Tools/isac/Knowledge/DiophantEq.thy	Thu Mar 15 12:42:04 2018 +0100
    11.3 @@ -20,23 +20,23 @@
    11.4  
    11.5  text {*problemclass for the usecase*}
    11.6  setup {* KEStore_Elems.add_pbts
    11.7 -  [(Specify.prep_pbt thy "pbl_equ_dio" [] e_pblID
    11.8 +  [(Specify.prep_pbt thy "pbl_equ_dio" [] Celem.e_pblID
    11.9        (["diophantine","equation"],
   11.10          [("#Given" ,["boolTestGiven e_e","intTestGiven (v_v::int)"]),
   11.11            (*                                      TODO: drop ^^^^^*)
   11.12            ("#Where" ,[]),
   11.13            ("#Find"  ,["boolTestFind s_s"])],
   11.14 -        e_rls, SOME "solve (e_e::bool, v_v::int)", [["LinEq","solve_lineq_equation"]]))] *}
   11.15 +        Celem.e_rls, SOME "solve (e_e::bool, v_v::int)", [["LinEq","solve_lineq_equation"]]))] *}
   11.16  
   11.17  text {*method solving the usecase*}
   11.18  setup {* KEStore_Elems.add_mets
   11.19 -  [Specify.prep_met thy "met_test_diophant" [] e_metID
   11.20 -      (["Test","solve_diophant"]:metID,
   11.21 +  [Specify.prep_met thy "met_test_diophant" [] Celem.e_metID
   11.22 +      (["Test","solve_diophant"],
   11.23          [("#Given" ,["boolTestGiven e_e","intTestGiven (v_v::int)"]),
   11.24            (*                                      TODO: drop ^^^^^*)
   11.25            ("#Where" ,[]),
   11.26            ("#Find"  ,["boolTestFind s_s"])],
   11.27 -        {rew_ord' = "e_rew_ord", rls' = tval_rls, srls = e_rls, prls = e_rls, calc = [],
   11.28 +        {rew_ord' = "xxxe_rew_ordxxx", rls' = tval_rls, srls = Celem.e_rls, prls = Celem.e_rls, calc = [],
   11.29            crls = tval_rls, errpats = [], nrls = Test_simplify},
   11.30          "Script Diophant_equation (e_e::bool) (v_v::int)=                  " ^
   11.31            "(Repeat                                                          " ^
    12.1 --- a/src/Tools/isac/Knowledge/EqSystem.thy	Thu Mar 15 10:17:44 2018 +0100
    12.2 +++ b/src/Tools/isac/Knowledge/EqSystem.thy	Thu Mar 15 12:42:04 2018 +0100
    12.3 @@ -77,9 +77,9 @@
    12.4  			  (p as (Const ("EqSystem.occur'_exactly'_in",_) 
    12.5  				       $ vs $ all $ t)) _ =
    12.6      if occur_exactly_in (TermC.isalist2list vs) (TermC.isalist2list all) t
    12.7 -    then SOME ((term2str p) ^ " = True",
    12.8 +    then SOME ((Celem.term2str p) ^ " = True",
    12.9  	       HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
   12.10 -    else SOME ((term2str p) ^ " = False",
   12.11 +    else SOME ((Celem.term2str p) ^ " = False",
   12.12  	       HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
   12.13    | eval_occur_exactly_in _ _ _ _ = NONE;
   12.14  *}
   12.15 @@ -131,10 +131,10 @@
   12.16       then 
   12.17         let
   12.18           val (f, ts) = strip_comb t and (g, us) = strip_comb u;
   12.19 -         val _ = tracing ("t= f@ts= \"" ^ term_to_string''' thy f ^ "\" @ \"[" ^
   12.20 -           commas (map (term_to_string''' thy) ts) ^ "]\"");
   12.21 -         val _ = tracing ("u= g@us= \"" ^ term_to_string''' thy g ^ "\" @ \"[" ^
   12.22 -           commas (map (term_to_string''' thy) us) ^ "]\"");
   12.23 +         val _ = tracing ("t= f@ts= \"" ^ Celem.term_to_string''' thy f ^ "\" @ \"[" ^
   12.24 +           commas (map (Celem.term_to_string''' thy) ts) ^ "]\"");
   12.25 +         val _ = tracing ("u= g@us= \"" ^ Celem.term_to_string''' thy g ^ "\" @ \"[" ^
   12.26 +           commas (map (Celem.term_to_string''' thy) us) ^ "]\"");
   12.27           val _ = tracing ("size_of_term(t,u)= (" ^ string_of_int (size_of_term' t) ^ ", " ^
   12.28             string_of_int (size_of_term' u) ^ ")");
   12.29           val _ = tracing ("hd_ord(f,g)      = " ^ ((pr_ord o hd_ord) (f,g)));
   12.30 @@ -152,7 +152,7 @@
   12.31  	 | ord => ord)
   12.32  and hd_ord (f, g) =                                        (* ~ term.ML *)
   12.33    prod_ord (prod_ord Term_Ord.indexname_ord Term_Ord.typ_ord) int_ord (dest_hd' f, dest_hd' g)
   12.34 -and terms_ord str pr (ts, us) = list_ord (term_ord' pr (assoc_thy "Isac"))(ts, us);
   12.35 +and terms_ord str pr (ts, us) = list_ord (term_ord' pr (Celem.assoc_thy "Isac"))(ts, us);
   12.36  (**)
   12.37  in
   12.38  (**)
   12.39 @@ -166,7 +166,7 @@
   12.40  (**)
   12.41  end;
   12.42  (**)
   12.43 -rew_ord' := overwritel (!rew_ord',
   12.44 +Celem.rew_ord' := overwritel (! Celem.rew_ord',
   12.45  [("ord_simplify_System", ord_simplify_System false thy)
   12.46   ]);
   12.47  *}
   12.48 @@ -175,67 +175,67 @@
   12.49  
   12.50  (*.adapted from 'order_add_mult_in' by just replacing the rew_ord.*)
   12.51  val order_add_mult_System = 
   12.52 -  Rls{id = "order_add_mult_System", preconds = [], 
   12.53 +  Celem.Rls{id = "order_add_mult_System", preconds = [], 
   12.54        rew_ord = ("ord_simplify_System",
   12.55  		 ord_simplify_System false @{theory "Integrate"}),
   12.56 -      erls = e_rls,srls = Erls, calc = [], errpatts = [],
   12.57 -      rules = [Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
   12.58 +      erls = Celem.e_rls,srls = Celem.Erls, calc = [], errpatts = [],
   12.59 +      rules = [Celem.Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
   12.60  	       (* z * w = w * z *)
   12.61 -	       Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
   12.62 +	       Celem.Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
   12.63  	       (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*)
   12.64 -	       Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),		
   12.65 +	       Celem.Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),		
   12.66  	       (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*)
   12.67 -	       Thm ("add_commute",TermC.num_str @{thm add.commute}),	
   12.68 +	       Celem.Thm ("add_commute",TermC.num_str @{thm add.commute}),	
   12.69  	       (*z + w = w + z*)
   12.70 -	       Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}),
   12.71 +	       Celem.Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}),
   12.72  	       (*x + (y + z) = y + (x + z)*)
   12.73 -	       Thm ("add_assoc",TermC.num_str @{thm add.assoc})	               
   12.74 +	       Celem.Thm ("add_assoc",TermC.num_str @{thm add.assoc})	               
   12.75  	       (*z1.0 + z2.0 + z3.0 = z1.0 + (z2.0 + z3.0)*)
   12.76  	       ], 
   12.77 -      scr = EmptyScr}:rls;
   12.78 +      scr = Celem.EmptyScr};
   12.79  *}
   12.80  ML {*
   12.81  (*.adapted from 'norm_Rational' by
   12.82    #1 using 'ord_simplify_System' in 'order_add_mult_System'
   12.83    #2 NOT using common_nominator_p                          .*)
   12.84  val norm_System_noadd_fractions = 
   12.85 -  Rls {id = "norm_System_noadd_fractions", preconds = [], 
   12.86 -       rew_ord = ("dummy_ord",dummy_ord), 
   12.87 -       erls = norm_rat_erls, srls = Erls, calc = [], errpatts = [],
   12.88 +  Celem.Rls {id = "norm_System_noadd_fractions", preconds = [], 
   12.89 +       rew_ord = ("dummy_ord",Celem.dummy_ord), 
   12.90 +       erls = norm_rat_erls, srls = Celem.Erls, calc = [], errpatts = [],
   12.91         rules = [(*sequence given by operator precedence*)
   12.92 -		Rls_ discard_minus,
   12.93 -		Rls_ powers,
   12.94 -		Rls_ rat_mult_divide,
   12.95 -		Rls_ expand,
   12.96 -		Rls_ reduce_0_1_2,
   12.97 -		Rls_ (*order_add_mult #1*) order_add_mult_System,
   12.98 -		Rls_ collect_numerals,
   12.99 -		(*Rls_ add_fractions_p, #2*)
  12.100 -		Rls_ cancel_p
  12.101 +		Celem.Rls_ discard_minus,
  12.102 +		Celem.Rls_ powers,
  12.103 +		Celem.Rls_ rat_mult_divide,
  12.104 +		Celem.Rls_ expand,
  12.105 +		Celem.Rls_ reduce_0_1_2,
  12.106 +		Celem.Rls_ (*order_add_mult #1*) order_add_mult_System,
  12.107 +		Celem.Rls_ collect_numerals,
  12.108 +		(*Celem.Rls_ add_fractions_p, #2*)
  12.109 +		Celem.Rls_ cancel_p
  12.110  		],
  12.111 -       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  12.112 -       }:rls;
  12.113 +       scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  12.114 +       };
  12.115  *}
  12.116  ML {*
  12.117  (*.adapted from 'norm_Rational' by
  12.118    *1* using 'ord_simplify_System' in 'order_add_mult_System'.*)
  12.119  val norm_System = 
  12.120 -  Rls {id = "norm_System", preconds = [], 
  12.121 -       rew_ord = ("dummy_ord",dummy_ord), 
  12.122 -       erls = norm_rat_erls, srls = Erls, calc = [], errpatts = [],
  12.123 +  Celem.Rls {id = "norm_System", preconds = [], 
  12.124 +       rew_ord = ("dummy_ord",Celem.dummy_ord), 
  12.125 +       erls = norm_rat_erls, srls = Celem.Erls, calc = [], errpatts = [],
  12.126         rules = [(*sequence given by operator precedence*)
  12.127 -		Rls_ discard_minus,
  12.128 -		Rls_ powers,
  12.129 -		Rls_ rat_mult_divide,
  12.130 -		Rls_ expand,
  12.131 -		Rls_ reduce_0_1_2,
  12.132 -		Rls_ (*order_add_mult *1*) order_add_mult_System,
  12.133 -		Rls_ collect_numerals,
  12.134 -		Rls_ add_fractions_p,
  12.135 -		Rls_ cancel_p
  12.136 +		Celem.Rls_ discard_minus,
  12.137 +		Celem.Rls_ powers,
  12.138 +		Celem.Rls_ rat_mult_divide,
  12.139 +		Celem.Rls_ expand,
  12.140 +		Celem.Rls_ reduce_0_1_2,
  12.141 +		Celem.Rls_ (*order_add_mult *1*) order_add_mult_System,
  12.142 +		Celem.Rls_ collect_numerals,
  12.143 +		Celem.Rls_ add_fractions_p,
  12.144 +		Celem.Rls_ cancel_p
  12.145  		],
  12.146 -       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  12.147 -       }:rls;
  12.148 +       scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  12.149 +       };
  12.150  *}
  12.151  ML {*
  12.152  (*.simplify an equational system BEFORE solving it such that parentheses are
  12.153 @@ -248,24 +248,24 @@
  12.154     *3* discard_parentheses only for (.*(.*.))
  12.155     analoguous to simplify_Integral                                       .*)
  12.156  val simplify_System_parenthesized = 
  12.157 -  Seq {id = "simplify_System_parenthesized", preconds = []:term list, 
  12.158 -       rew_ord = ("dummy_ord", dummy_ord),
  12.159 -      erls = Atools_erls, srls = Erls, calc = [], errpatts = [],
  12.160 -      rules = [Thm ("distrib_right",TermC.num_str @{thm distrib_right}),
  12.161 +  Celem.Seq {id = "simplify_System_parenthesized", preconds = []:term list, 
  12.162 +       rew_ord = ("dummy_ord", Celem.dummy_ord),
  12.163 +      erls = Atools_erls, srls = Celem.Erls, calc = [], errpatts = [],
  12.164 +      rules = [Celem.Thm ("distrib_right",TermC.num_str @{thm distrib_right}),
  12.165   	       (*"(?z1.0 + ?z2.0) * ?w = ?z1.0 * ?w + ?z2.0 * ?w"*)
  12.166 -	       Thm ("add_divide_distrib",TermC.num_str @{thm add_divide_distrib}),
  12.167 +	       Celem.Thm ("add_divide_distrib",TermC.num_str @{thm add_divide_distrib}),
  12.168   	       (*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"*)
  12.169  	       (*^^^^^ *0* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*)
  12.170 -	       Rls_ norm_Rational_noadd_fractions(**2**),
  12.171 -	       Rls_ (*order_add_mult_in*) norm_System_noadd_fractions (**1**),
  12.172 -	       Thm ("sym_mult_assoc",
  12.173 +	       Celem.Rls_ norm_Rational_noadd_fractions(**2**),
  12.174 +	       Celem.Rls_ (*order_add_mult_in*) norm_System_noadd_fractions (**1**),
  12.175 +	       Celem.Thm ("sym_mult_assoc",
  12.176                       TermC.num_str (@{thm mult.assoc} RS @{thm sym}))
  12.177 -	       (*Rls_ discard_parentheses *3**),
  12.178 -	       Rls_ collect_bdv, (*from make_polynomial_in WN051031 welldone?*)
  12.179 -	       Rls_ separate_bdv2,
  12.180 -	       Calc ("Rings.divide_class.divide"  ,eval_cancel "#divide_e")
  12.181 +	       (*Celem.Rls_ discard_parentheses *3**),
  12.182 +	       Celem.Rls_ collect_bdv, (*from make_polynomial_in WN051031 welldone?*)
  12.183 +	       Celem.Rls_ separate_bdv2,
  12.184 +	       Celem.Calc ("Rings.divide_class.divide"  ,eval_cancel "#divide_e")
  12.185  	       ],
  12.186 -      scr = EmptyScr}:rls;      
  12.187 +      scr = Celem.EmptyScr};      
  12.188  *}
  12.189  ML {*
  12.190  (*.simplify an equational system AFTER solving it;
  12.191 @@ -273,61 +273,61 @@
  12.192     *1* ord_simplify_System instead of termlessI           .*)
  12.193  (*TODO.WN051031 ^^^^^^^^^^ should be in EACH rls contained *)
  12.194  val simplify_System = 
  12.195 -  Seq {id = "simplify_System", preconds = []:term list, 
  12.196 -       rew_ord = ("dummy_ord", dummy_ord),
  12.197 -      erls = Atools_erls, srls = Erls, calc = [], errpatts = [],
  12.198 -      rules = [Rls_ norm_Rational,
  12.199 -	       Rls_ (*order_add_mult_in*) norm_System (**1**),
  12.200 -	       Rls_ discard_parentheses,
  12.201 -	       Rls_ collect_bdv, (*from make_polynomial_in WN051031 welldone?*)
  12.202 -	       Rls_ separate_bdv2,
  12.203 -	       Calc ("Rings.divide_class.divide"  ,eval_cancel "#divide_e")
  12.204 +  Celem.Seq {id = "simplify_System", preconds = []:term list, 
  12.205 +       rew_ord = ("dummy_ord", Celem.dummy_ord),
  12.206 +      erls = Atools_erls, srls = Celem.Erls, calc = [], errpatts = [],
  12.207 +      rules = [Celem.Rls_ norm_Rational,
  12.208 +	       Celem.Rls_ (*order_add_mult_in*) norm_System (**1**),
  12.209 +	       Celem.Rls_ discard_parentheses,
  12.210 +	       Celem.Rls_ collect_bdv, (*from make_polynomial_in WN051031 welldone?*)
  12.211 +	       Celem.Rls_ separate_bdv2,
  12.212 +	       Celem.Calc ("Rings.divide_class.divide"  ,eval_cancel "#divide_e")
  12.213  	       ],
  12.214 -      scr = EmptyScr}:rls;      
  12.215 +      scr = Celem.EmptyScr};      
  12.216  (*
  12.217  val simplify_System = 
  12.218 -    append_rls "simplify_System" simplify_System_parenthesized
  12.219 -	       [Thm ("sym_add_assoc",
  12.220 +    Celem.append_rls "simplify_System" simplify_System_parenthesized
  12.221 +	       [Celem.Thm ("sym_add_assoc",
  12.222                        TermC.num_str (@{thm add.assoc} RS @{thm sym}))];
  12.223  *)
  12.224  *}
  12.225  ML {*
  12.226  val isolate_bdvs = 
  12.227 -    Rls {id="isolate_bdvs", preconds = [], 
  12.228 -	 rew_ord = ("e_rew_ord", e_rew_ord), 
  12.229 -	 erls = append_rls "erls_isolate_bdvs" e_rls 
  12.230 -			   [(Calc ("EqSystem.occur'_exactly'_in", 
  12.231 +    Celem.Rls {id="isolate_bdvs", preconds = [], 
  12.232 +	 rew_ord = ("xxxe_rew_ordxxx", Celem.e_rew_ord), 
  12.233 +	 erls = Celem.append_rls "erls_isolate_bdvs" Celem.e_rls 
  12.234 +			   [(Celem.Calc ("EqSystem.occur'_exactly'_in", 
  12.235  				   eval_occur_exactly_in 
  12.236  				       "#eval_occur_exactly_in_"))
  12.237  			    ], 
  12.238 -			   srls = Erls, calc = [], errpatts = [],
  12.239 +			   srls = Celem.Erls, calc = [], errpatts = [],
  12.240  	      rules = 
  12.241 -             [Thm ("commute_0_equality", TermC.num_str @{thm commute_0_equality}),
  12.242 -	      Thm ("separate_bdvs_add", TermC.num_str @{thm separate_bdvs_add}),
  12.243 -	      Thm ("separate_bdvs_mult", TermC.num_str @{thm separate_bdvs_mult})],
  12.244 -	      scr = EmptyScr};
  12.245 +             [Celem.Thm ("commute_0_equality", TermC.num_str @{thm commute_0_equality}),
  12.246 +	      Celem.Thm ("separate_bdvs_add", TermC.num_str @{thm separate_bdvs_add}),
  12.247 +	      Celem.Thm ("separate_bdvs_mult", TermC.num_str @{thm separate_bdvs_mult})],
  12.248 +	      scr = Celem.EmptyScr};
  12.249  *}
  12.250  ML {*
  12.251  val isolate_bdvs_4x4 = 
  12.252 -    Rls {id="isolate_bdvs_4x4", preconds = [], 
  12.253 -	 rew_ord = ("e_rew_ord", e_rew_ord), 
  12.254 -	 erls = append_rls 
  12.255 -		    "erls_isolate_bdvs_4x4" e_rls 
  12.256 -		    [Calc ("EqSystem.occur'_exactly'_in", 
  12.257 +    Celem.Rls {id="isolate_bdvs_4x4", preconds = [], 
  12.258 +	 rew_ord = ("xxxe_rew_ordxxx", Celem.e_rew_ord), 
  12.259 +	 erls = Celem.append_rls 
  12.260 +		    "erls_isolate_bdvs_4x4" Celem.e_rls 
  12.261 +		    [Celem.Calc ("EqSystem.occur'_exactly'_in", 
  12.262  			   eval_occur_exactly_in "#eval_occur_exactly_in_"),
  12.263 -		     Calc ("Atools.ident",eval_ident "#ident_"),
  12.264 -		     Calc ("Atools.some'_occur'_in", 
  12.265 +		     Celem.Calc ("Atools.ident",eval_ident "#ident_"),
  12.266 +		     Celem.Calc ("Atools.some'_occur'_in", 
  12.267  			   eval_some_occur_in "#some_occur_in_"),
  12.268 -                     Thm ("not_true",TermC.num_str @{thm not_true}),
  12.269 -		     Thm ("not_false",TermC.num_str @{thm not_false})
  12.270 +                     Celem.Thm ("not_true",TermC.num_str @{thm not_true}),
  12.271 +		     Celem.Thm ("not_false",TermC.num_str @{thm not_false})
  12.272  			    ], 
  12.273 -	 srls = Erls, calc = [], errpatts = [],
  12.274 -	 rules = [Thm ("commute_0_equality", TermC.num_str @{thm commute_0_equality}),
  12.275 -		  Thm ("separate_bdvs0", TermC.num_str @{thm separate_bdvs0}),
  12.276 -		  Thm ("separate_bdvs_add1", TermC.num_str @{thm separate_bdvs_add1}),
  12.277 -		  Thm ("separate_bdvs_add1", TermC.num_str @{thm separate_bdvs_add2}),
  12.278 -		  Thm ("separate_bdvs_mult", TermC.num_str @{thm separate_bdvs_mult})
  12.279 -                 ], scr = EmptyScr};
  12.280 +	 srls = Celem.Erls, calc = [], errpatts = [],
  12.281 +	 rules = [Celem.Thm ("commute_0_equality", TermC.num_str @{thm commute_0_equality}),
  12.282 +		  Celem.Thm ("separate_bdvs0", TermC.num_str @{thm separate_bdvs0}),
  12.283 +		  Celem.Thm ("separate_bdvs_add1", TermC.num_str @{thm separate_bdvs_add1}),
  12.284 +		  Celem.Thm ("separate_bdvs_add1", TermC.num_str @{thm separate_bdvs_add2}),
  12.285 +		  Celem.Thm ("separate_bdvs_mult", TermC.num_str @{thm separate_bdvs_mult})
  12.286 +                 ], scr = Celem.EmptyScr};
  12.287  
  12.288  *}
  12.289  ML {*
  12.290 @@ -335,67 +335,67 @@
  12.291  (*.order the equations in a system such, that a triangular system (if any)
  12.292     appears as [..c_4 = .., ..., ..., ..c_1 + ..c_2 + ..c_3 ..c_4 = ..].*)
  12.293  val order_system = 
  12.294 -    Rls {id="order_system", preconds = [], 
  12.295 +    Celem.Rls {id="order_system", preconds = [], 
  12.296  	 rew_ord = ("ord_simplify_System", 
  12.297  		    ord_simplify_System false thy), 
  12.298 -	 erls = Erls, srls = Erls, calc = [], errpatts = [],
  12.299 -	 rules = [Thm ("order_system_NxN", TermC.num_str @{thm order_system_NxN})
  12.300 +	 erls = Celem.Erls, srls = Celem.Erls, calc = [], errpatts = [],
  12.301 +	 rules = [Celem.Thm ("order_system_NxN", TermC.num_str @{thm order_system_NxN})
  12.302  		  ],
  12.303 -	 scr = EmptyScr};
  12.304 +	 scr = Celem.EmptyScr};
  12.305  
  12.306  val prls_triangular = 
  12.307 -    Rls {id="prls_triangular", preconds = [], 
  12.308 -	 rew_ord = ("e_rew_ord", e_rew_ord), 
  12.309 -	 erls = Rls {id="erls_prls_triangular", preconds = [], 
  12.310 -		     rew_ord = ("e_rew_ord", e_rew_ord), 
  12.311 -		     erls = Erls, srls = Erls, calc = [], errpatts = [],
  12.312 +    Celem.Rls {id="prls_triangular", preconds = [], 
  12.313 +	 rew_ord = ("xxxe_rew_ordxxx", Celem.e_rew_ord), 
  12.314 +	 erls = Celem.Rls {id="erls_prls_triangular", preconds = [], 
  12.315 +		     rew_ord = ("xxxe_rew_ordxxx", Celem.e_rew_ord), 
  12.316 +		     erls = Celem.Erls, srls = Celem.Erls, calc = [], errpatts = [],
  12.317  		     rules = [(*for precond NTH_CONS ...*)
  12.318 -			      Calc ("Orderings.ord_class.less",eval_equ "#less_"),
  12.319 -			      Calc ("Groups.plus_class.plus", eval_binop "#add_")
  12.320 +			      Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"),
  12.321 +			      Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_")
  12.322  			      (*immediately repeated rewrite pushes
  12.323  					    '+' into precondition !*)
  12.324  			      ],
  12.325 -		     scr = EmptyScr}, 
  12.326 -	 srls = Erls, calc = [], errpatts = [],
  12.327 -	 rules = [Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
  12.328 -		  Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  12.329 -		  Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}),
  12.330 -		  Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}),
  12.331 -		  Thm ("tl_Nil",TermC.num_str @{thm tl_Nil}),
  12.332 -		  Calc ("EqSystem.occur'_exactly'_in", 
  12.333 +		     scr = Celem.EmptyScr}, 
  12.334 +	 srls = Celem.Erls, calc = [], errpatts = [],
  12.335 +	 rules = [Celem.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
  12.336 +		  Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  12.337 +		  Celem.Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}),
  12.338 +		  Celem.Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}),
  12.339 +		  Celem.Thm ("tl_Nil",TermC.num_str @{thm tl_Nil}),
  12.340 +		  Celem.Calc ("EqSystem.occur'_exactly'_in", 
  12.341  			eval_occur_exactly_in 
  12.342  			    "#eval_occur_exactly_in_")
  12.343  		  ],
  12.344 -	 scr = EmptyScr};
  12.345 +	 scr = Celem.EmptyScr};
  12.346  *}
  12.347  ML {*
  12.348  
  12.349  (*WN060914 quickly created for 4x4; 
  12.350   more similarity to prls_triangular desirable*)
  12.351  val prls_triangular4 = 
  12.352 -    Rls {id="prls_triangular4", preconds = [], 
  12.353 -	 rew_ord = ("e_rew_ord", e_rew_ord), 
  12.354 -	 erls = Rls {id="erls_prls_triangular4", preconds = [], 
  12.355 -		     rew_ord = ("e_rew_ord", e_rew_ord), 
  12.356 -		     erls = Erls, srls = Erls, calc = [], errpatts = [],
  12.357 +    Celem.Rls {id="prls_triangular4", preconds = [], 
  12.358 +	 rew_ord = ("xxxe_rew_ordxxx", Celem.e_rew_ord), 
  12.359 +	 erls = Celem.Rls {id="erls_prls_triangular4", preconds = [], 
  12.360 +		     rew_ord = ("xxxe_rew_ordxxx", Celem.e_rew_ord), 
  12.361 +		     erls = Celem.Erls, srls = Celem.Erls, calc = [], errpatts = [],
  12.362  		     rules = [(*for precond NTH_CONS ...*)
  12.363 -			      Calc ("Orderings.ord_class.less",eval_equ "#less_"),
  12.364 -			      Calc ("Groups.plus_class.plus", eval_binop "#add_")
  12.365 +			      Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"),
  12.366 +			      Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_")
  12.367  			      (*immediately repeated rewrite pushes
  12.368  					    '+' into precondition !*)
  12.369  			      ],
  12.370 -		     scr = EmptyScr}, 
  12.371 -	 srls = Erls, calc = [], errpatts = [],
  12.372 -	 rules = [Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
  12.373 -		  Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  12.374 -		  Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}),
  12.375 -		  Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}),
  12.376 -		  Thm ("tl_Nil",TermC.num_str @{thm tl_Nil}),
  12.377 -		  Calc ("EqSystem.occur'_exactly'_in", 
  12.378 +		     scr = Celem.EmptyScr}, 
  12.379 +	 srls = Celem.Erls, calc = [], errpatts = [],
  12.380 +	 rules = [Celem.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
  12.381 +		  Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  12.382 +		  Celem.Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}),
  12.383 +		  Celem.Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}),
  12.384 +		  Celem.Thm ("tl_Nil",TermC.num_str @{thm tl_Nil}),
  12.385 +		  Celem.Calc ("EqSystem.occur'_exactly'_in", 
  12.386  			eval_occur_exactly_in 
  12.387  			    "#eval_occur_exactly_in_")
  12.388  		  ],
  12.389 -	 scr = EmptyScr};
  12.390 +	 scr = Celem.EmptyScr};
  12.391  *}
  12.392  
  12.393  setup {* KEStore_Elems.add_rlss 
  12.394 @@ -412,30 +412,30 @@
  12.395  
  12.396  (** problems **)
  12.397  setup {* KEStore_Elems.add_pbts
  12.398 -  [(Specify.prep_pbt thy "pbl_equsys" [] e_pblID
  12.399 +  [(Specify.prep_pbt thy "pbl_equsys" [] Celem.e_pblID
  12.400        (["system"],
  12.401          [("#Given" ,["equalities e_s", "solveForVars v_s"]),
  12.402            ("#Find"  ,["solution ss'''"](*''' is copy-named*))],
  12.403 -        append_rls "e_rls" e_rls [(*for preds in where_*)], SOME "solveSystem e_s v_s", [])),
  12.404 -    (Specify.prep_pbt thy "pbl_equsys_lin" [] e_pblID
  12.405 +        Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*)], SOME "solveSystem e_s v_s", [])),
  12.406 +    (Specify.prep_pbt thy "pbl_equsys_lin" [] Celem.e_pblID
  12.407        (["LINEAR", "system"],
  12.408          [("#Given" ,["equalities e_s", "solveForVars v_s"]),
  12.409            (*TODO.WN050929 check linearity*)
  12.410            ("#Find"  ,["solution ss'''"])],
  12.411 -        append_rls "e_rls" e_rls [(*for preds in where_*)], SOME "solveSystem e_s v_s", [])),
  12.412 -    (Specify.prep_pbt thy "pbl_equsys_lin_2x2" [] e_pblID
  12.413 +        Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*)], SOME "solveSystem e_s v_s", [])),
  12.414 +    (Specify.prep_pbt thy "pbl_equsys_lin_2x2" [] Celem.e_pblID
  12.415        (["2x2", "LINEAR", "system"],
  12.416        (*~~~~~~~~~~~~~~~~~~~~~~~~~*)
  12.417          [("#Given" ,["equalities e_s", "solveForVars v_s"]),
  12.418            ("#Where"  ,["LENGTH (e_s:: bool list) = 2", "LENGTH v_s = 2"]),
  12.419            ("#Find"  ,["solution ss'''"])],
  12.420 -        append_rls "prls_2x2_linear_system" e_rls 
  12.421 -			    [Thm ("LENGTH_CONS",TermC.num_str @{thm LENGTH_CONS}),
  12.422 -			      Thm ("LENGTH_NIL",TermC.num_str @{thm LENGTH_NIL}),
  12.423 -			      Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  12.424 -			      Calc ("HOL.eq",eval_equal "#equal_")], 
  12.425 +        Celem.append_rls "prls_2x2_linear_system" Celem.e_rls 
  12.426 +			    [Celem.Thm ("LENGTH_CONS",TermC.num_str @{thm LENGTH_CONS}),
  12.427 +			      Celem.Thm ("LENGTH_NIL",TermC.num_str @{thm LENGTH_NIL}),
  12.428 +			      Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  12.429 +			      Celem.Calc ("HOL.eq",eval_equal "#equal_")], 
  12.430          SOME "solveSystem e_s v_s", [])),
  12.431 -    (Specify.prep_pbt thy "pbl_equsys_lin_2x2_tri" [] e_pblID
  12.432 +    (Specify.prep_pbt thy "pbl_equsys_lin_2x2_tri" [] Celem.e_pblID
  12.433        (["triangular", "2x2", "LINEAR", "system"],
  12.434          [("#Given" ,["equalities e_s", "solveForVars v_s"]),
  12.435            ("#Where",
  12.436 @@ -443,38 +443,38 @@
  12.437                "    v_s  from v_s occur_exactly_in (NTH 2 (e_s::bool list))"]),
  12.438            ("#Find"  ,["solution ss'''"])],
  12.439          prls_triangular, SOME "solveSystem e_s v_s", [["EqSystem","top_down_substitution","2x2"]])),
  12.440 -    (Specify.prep_pbt thy "pbl_equsys_lin_2x2_norm" [] e_pblID
  12.441 +    (Specify.prep_pbt thy "pbl_equsys_lin_2x2_norm" [] Celem.e_pblID
  12.442        (["normalise", "2x2", "LINEAR", "system"],
  12.443          [("#Given" ,["equalities e_s", "solveForVars v_s"]),
  12.444            ("#Find"  ,["solution ss'''"])],
  12.445 -      append_rls "e_rls" e_rls [(*for preds in where_*)], 
  12.446 +      Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*)], 
  12.447        SOME "solveSystem e_s v_s", 
  12.448        [["EqSystem","normalise","2x2"]])),
  12.449 -    (Specify.prep_pbt thy "pbl_equsys_lin_3x3" [] e_pblID
  12.450 +    (Specify.prep_pbt thy "pbl_equsys_lin_3x3" [] Celem.e_pblID
  12.451        (["3x3", "LINEAR", "system"],
  12.452          (*~~~~~~~~~~~~~~~~~~~~~~~~~*)
  12.453          [("#Given" ,["equalities e_s", "solveForVars v_s"]),
  12.454            ("#Where"  ,["LENGTH (e_s:: bool list) = 3", "LENGTH v_s = 3"]),
  12.455            ("#Find"  ,["solution ss'''"])],
  12.456 -        append_rls "prls_3x3_linear_system" e_rls 
  12.457 -			    [Thm ("LENGTH_CONS",TermC.num_str @{thm LENGTH_CONS}),
  12.458 -			      Thm ("LENGTH_NIL",TermC.num_str @{thm LENGTH_NIL}),
  12.459 -			      Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  12.460 -			      Calc ("HOL.eq",eval_equal "#equal_")],
  12.461 +        Celem.append_rls "prls_3x3_linear_system" Celem.e_rls 
  12.462 +			    [Celem.Thm ("LENGTH_CONS",TermC.num_str @{thm LENGTH_CONS}),
  12.463 +			      Celem.Thm ("LENGTH_NIL",TermC.num_str @{thm LENGTH_NIL}),
  12.464 +			      Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  12.465 +			      Celem.Calc ("HOL.eq",eval_equal "#equal_")],
  12.466          SOME "solveSystem e_s v_s", [])),
  12.467 -    (Specify.prep_pbt thy "pbl_equsys_lin_4x4" [] e_pblID
  12.468 +    (Specify.prep_pbt thy "pbl_equsys_lin_4x4" [] Celem.e_pblID
  12.469        (["4x4", "LINEAR", "system"],
  12.470          (*~~~~~~~~~~~~~~~~~~~~~~~~~*)
  12.471          [("#Given" ,["equalities e_s", "solveForVars v_s"]),
  12.472            ("#Where"  ,["LENGTH (e_s:: bool list) = 4", "LENGTH v_s = 4"]),
  12.473            ("#Find"  ,["solution ss'''"])],
  12.474 -        append_rls "prls_4x4_linear_system" e_rls 
  12.475 -			    [Thm ("LENGTH_CONS",TermC.num_str @{thm LENGTH_CONS}),
  12.476 -			      Thm ("LENGTH_NIL",TermC.num_str @{thm LENGTH_NIL}),
  12.477 -			      Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  12.478 -			      Calc ("HOL.eq",eval_equal "#equal_")],
  12.479 +        Celem.append_rls "prls_4x4_linear_system" Celem.e_rls 
  12.480 +			    [Celem.Thm ("LENGTH_CONS",TermC.num_str @{thm LENGTH_CONS}),
  12.481 +			      Celem.Thm ("LENGTH_NIL",TermC.num_str @{thm LENGTH_NIL}),
  12.482 +			      Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  12.483 +			      Celem.Calc ("HOL.eq",eval_equal "#equal_")],
  12.484          SOME "solveSystem e_s v_s", [])),
  12.485 -    (Specify.prep_pbt thy "pbl_equsys_lin_4x4_tri" [] e_pblID
  12.486 +    (Specify.prep_pbt thy "pbl_equsys_lin_4x4_tri" [] Celem.e_pblID
  12.487        (["triangular", "4x4", "LINEAR", "system"],
  12.488          [("#Given" ,["equalities e_s", "solveForVars v_s"]),
  12.489            ("#Where" , (*accepts missing variables up to diagional form*)
  12.490 @@ -483,62 +483,62 @@
  12.491                "(NTH 3 (v_s::real list)) occurs_in (NTH 3 (e_s::bool list))",
  12.492                "(NTH 4 (v_s::real list)) occurs_in (NTH 4 (e_s::bool list))"]),
  12.493            ("#Find"  ,["solution ss'''"])],
  12.494 -      append_rls "prls_tri_4x4_lin_sys" prls_triangular
  12.495 -	      [Calc ("Atools.occurs'_in",eval_occurs_in "")], 
  12.496 +      Celem.append_rls "prls_tri_4x4_lin_sys" prls_triangular
  12.497 +	      [Celem.Calc ("Atools.occurs'_in",eval_occurs_in "")], 
  12.498        SOME "solveSystem e_s v_s", 
  12.499        [["EqSystem","top_down_substitution","4x4"]])),
  12.500 -    (Specify.prep_pbt thy "pbl_equsys_lin_4x4_norm" [] e_pblID
  12.501 +    (Specify.prep_pbt thy "pbl_equsys_lin_4x4_norm" [] Celem.e_pblID
  12.502        (["normalise", "4x4", "LINEAR", "system"],
  12.503          [("#Given" ,["equalities e_s", "solveForVars v_s"]),
  12.504            (*LENGTH is checked 1 level above*)
  12.505            ("#Find"  ,["solution ss'''"])],
  12.506 -        append_rls "e_rls" e_rls [(*for preds in where_*)], 
  12.507 +        Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*)], 
  12.508          SOME "solveSystem e_s v_s", 
  12.509          [["EqSystem","normalise","4x4"]]))] *}
  12.510  
  12.511  ML {*
  12.512  (*this is for NTH only*)
  12.513 -val srls = Rls {id="srls_normalise_4x4", 
  12.514 +val srls = Celem.Rls {id="srls_normalise_4x4", 
  12.515  		preconds = [], 
  12.516  		rew_ord = ("termlessI",termlessI), 
  12.517 -		erls = append_rls "erls_in_srls_IntegrierenUnd.." e_rls
  12.518 +		erls = Celem.append_rls "erls_in_srls_IntegrierenUnd.." Celem.e_rls
  12.519  				  [(*for asm in NTH_CONS ...*)
  12.520 -				   Calc ("Orderings.ord_class.less",eval_equ "#less_"),
  12.521 +				   Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"),
  12.522  				   (*2nd NTH_CONS pushes n+-1 into asms*)
  12.523 -				   Calc("Groups.plus_class.plus", eval_binop "#add_")
  12.524 +				   Celem.Calc("Groups.plus_class.plus", eval_binop "#add_")
  12.525  				   ], 
  12.526 -		srls = Erls, calc = [], errpatts = [],
  12.527 -		rules = [Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
  12.528 -			 Calc("Groups.plus_class.plus", eval_binop "#add_"),
  12.529 -			 Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL})],
  12.530 -		scr = EmptyScr};
  12.531 +		srls = Celem.Erls, calc = [], errpatts = [],
  12.532 +		rules = [Celem.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
  12.533 +			 Celem.Calc("Groups.plus_class.plus", eval_binop "#add_"),
  12.534 +			 Celem.Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL})],
  12.535 +		scr = Celem.EmptyScr};
  12.536  *}
  12.537  
  12.538  (**methods**)
  12.539  setup {* KEStore_Elems.add_mets
  12.540 -  [Specify.prep_met thy "met_eqsys" [] e_metID
  12.541 +  [Specify.prep_met thy "met_eqsys" [] Celem.e_metID
  12.542  	    (["EqSystem"], [],
  12.543 -	      {rew_ord'="tless_true", rls' = Erls, calc = [], srls = Erls, prls = Erls, crls = Erls,
  12.544 -          errpats = [], nrls = Erls},
  12.545 +	      {rew_ord'="tless_true", rls' = Celem.Erls, calc = [], srls = Celem.Erls, prls = Celem.Erls, crls = Celem.Erls,
  12.546 +          errpats = [], nrls = Celem.Erls},
  12.547  	      "empty_script"),
  12.548 -    Specify.prep_met thy "met_eqsys_topdown" [] e_metID
  12.549 +    Specify.prep_met thy "met_eqsys_topdown" [] Celem.e_metID
  12.550        (["EqSystem","top_down_substitution"], [],
  12.551 -        {rew_ord'="tless_true", rls' = Erls, calc = [], srls = Erls, prls = Erls, crls = Erls,
  12.552 -          errpats = [], nrls = Erls},
  12.553 +        {rew_ord'="tless_true", rls' = Celem.Erls, calc = [], srls = Celem.Erls, prls = Celem.Erls, crls = Celem.Erls,
  12.554 +          errpats = [], nrls = Celem.Erls},
  12.555         "empty_script"),
  12.556 -    Specify.prep_met thy "met_eqsys_topdown_2x2" [] e_metID
  12.557 +    Specify.prep_met thy "met_eqsys_topdown_2x2" [] Celem.e_metID
  12.558        (["EqSystem", "top_down_substitution", "2x2"],
  12.559          [("#Given", ["equalities e_s", "solveForVars v_s"]),
  12.560            ("#Where",
  12.561              ["(tl v_s) from v_s occur_exactly_in (NTH 1 (e_s::bool list))",
  12.562                "    v_s  from v_s occur_exactly_in (NTH 2 (e_s::bool list))"]),
  12.563            ("#Find"  ,["solution ss'''"])],
  12.564 -	      {rew_ord'="ord_simplify_System", rls' = Erls, calc = [], 
  12.565 -	        srls = append_rls "srls_top_down_2x2" e_rls
  12.566 -				      [Thm ("hd_thm",TermC.num_str @{thm hd_thm}),
  12.567 -				        Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}),
  12.568 -				        Thm ("tl_Nil",TermC.num_str @{thm tl_Nil})], 
  12.569 -	        prls = prls_triangular, crls = Erls, errpats = [], nrls = Erls},
  12.570 +	      {rew_ord'="ord_simplify_System", rls' = Celem.Erls, calc = [], 
  12.571 +	        srls = Celem.append_rls "srls_top_down_2x2" Celem.e_rls
  12.572 +				      [Celem.Thm ("hd_thm",TermC.num_str @{thm hd_thm}),
  12.573 +				        Celem.Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}),
  12.574 +				        Celem.Thm ("tl_Nil",TermC.num_str @{thm tl_Nil})], 
  12.575 +	        prls = prls_triangular, crls = Celem.Erls, errpats = [], nrls = Celem.Erls},
  12.576  	      "Script SolveSystemScript (e_s::bool list) (v_s::real list) =                " ^
  12.577            "  (let e_1 = Take (hd e_s);                                                " ^
  12.578            "       e_1 = ((Try (Rewrite_Set_Inst [(bdv_1, hd v_s),(bdv_2, hd (tl v_s))]" ^
  12.579 @@ -572,21 +572,21 @@
  12.580            "       (Try (Rewrite_Set_Inst [(bdv_1, hd v_s),(bdv_2, hd (tl v_s))]" ^
  12.581            "                                  simplify_System False))) e__s)"
  12.582            ---------------------------------------------------------------------------*)),
  12.583 -    Specify.prep_met thy "met_eqsys_norm" [] e_metID
  12.584 +    Specify.prep_met thy "met_eqsys_norm" [] Celem.e_metID
  12.585  	    (["EqSystem", "normalise"], [],
  12.586 -	      {rew_ord'="tless_true", rls' = Erls, calc = [], srls = Erls, prls = Erls, crls = Erls,
  12.587 -          errpats = [], nrls = Erls},
  12.588 +	      {rew_ord'="tless_true", rls' = Celem.Erls, calc = [], srls = Celem.Erls, prls = Celem.Erls, crls = Celem.Erls,
  12.589 +          errpats = [], nrls = Celem.Erls},
  12.590  	      "empty_script"),
  12.591 -    Specify.prep_met thy "met_eqsys_norm_2x2" [] e_metID
  12.592 +    Specify.prep_met thy "met_eqsys_norm_2x2" [] Celem.e_metID
  12.593  	    (["EqSystem","normalise","2x2"],
  12.594  	      [("#Given" ,["equalities e_s", "solveForVars v_s"]),
  12.595  		      ("#Find"  ,["solution ss'''"])],
  12.596 -	      {rew_ord'="tless_true", rls' = Erls, calc = [], 
  12.597 -	        srls = append_rls "srls_normalise_2x2" e_rls
  12.598 -				      [Thm ("hd_thm",TermC.num_str @{thm hd_thm}),
  12.599 -				        Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}),
  12.600 -				        Thm ("tl_Nil",TermC.num_str @{thm tl_Nil})], 
  12.601 -		      prls = Erls, crls = Erls, errpats = [], nrls = Erls},
  12.602 +	      {rew_ord'="tless_true", rls' = Celem.Erls, calc = [], 
  12.603 +	        srls = Celem.append_rls "srls_normalise_2x2" Celem.e_rls
  12.604 +				      [Celem.Thm ("hd_thm",TermC.num_str @{thm hd_thm}),
  12.605 +				        Celem.Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}),
  12.606 +				        Celem.Thm ("tl_Nil",TermC.num_str @{thm tl_Nil})], 
  12.607 +		      prls = Celem.Erls, crls = Celem.Erls, errpats = [], nrls = Celem.Erls},
  12.608  		    "Script SolveSystemScript (e_s::bool list) (v_s::real list) =                " ^
  12.609            "  (let e__s = ((Try (Rewrite_Set norm_Rational False)) @@                   " ^
  12.610            "               (Try (Rewrite_Set_Inst [(bdv_1, hd v_s),(bdv_2, hd (tl v_s))]" ^
  12.611 @@ -598,16 +598,16 @@
  12.612            "               (Try (Rewrite_Set order_system False))) e_s                  " ^
  12.613            "   in (SubProblem (EqSystem',[LINEAR,system],[no_met])                      " ^
  12.614            "                  [BOOL_LIST e__s, REAL_LIST v_s]))"),
  12.615 -    Specify.prep_met thy "met_eqsys_norm_4x4" [] e_metID
  12.616 +    Specify.prep_met thy "met_eqsys_norm_4x4" [] Celem.e_metID
  12.617  	      (["EqSystem","normalise","4x4"],
  12.618  	       [("#Given" ,["equalities e_s", "solveForVars v_s"]),
  12.619  	         ("#Find"  ,["solution ss'''"])],
  12.620 -	       {rew_ord'="tless_true", rls' = Erls, calc = [], 
  12.621 -	         srls = append_rls "srls_normalise_4x4" srls
  12.622 -	             [Thm ("hd_thm",TermC.num_str @{thm hd_thm}),
  12.623 -	               Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}),
  12.624 -	               Thm ("tl_Nil",TermC.num_str @{thm tl_Nil})], 
  12.625 -		       prls = Erls, crls = Erls, errpats = [], nrls = Erls},
  12.626 +	       {rew_ord'="tless_true", rls' = Celem.Erls, calc = [], 
  12.627 +	         srls = Celem.append_rls "srls_normalise_4x4" srls
  12.628 +	             [Celem.Thm ("hd_thm",TermC.num_str @{thm hd_thm}),
  12.629 +	               Celem.Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}),
  12.630 +	               Celem.Thm ("tl_Nil",TermC.num_str @{thm tl_Nil})], 
  12.631 +		       prls = Celem.Erls, crls = Celem.Erls, errpats = [], nrls = Celem.Erls},
  12.632  		     (*STOPPED.WN06? met ["EqSystem","normalise","4x4"] @@@@@@@@@@@@@@@@@@@@@@@@@@@*)
  12.633  		     "Script SolveSystemScript (e_s::bool list) (v_s::real list) =                " ^
  12.634             "  (let e__s =                                                               " ^
  12.635 @@ -625,7 +625,7 @@
  12.636             "      (Try (Rewrite_Set order_system False)))                           e_s " ^
  12.637             "   in (SubProblem (EqSystem',[LINEAR,system],[no_met])                      " ^
  12.638             "                  [BOOL_LIST e__s, REAL_LIST v_s]))"),
  12.639 -    Specify.prep_met thy "met_eqsys_topdown_4x4" [] e_metID
  12.640 +    Specify.prep_met thy "met_eqsys_topdown_4x4" [] Celem.e_metID
  12.641  	    (["EqSystem","top_down_substitution","4x4"],
  12.642  	      [("#Given" ,["equalities e_s", "solveForVars v_s"]),
  12.643  	        ("#Where" , (*accepts missing variables up to diagonal form*)
  12.644 @@ -634,11 +634,11 @@
  12.645                "(NTH 3 (v_s::real list)) occurs_in (NTH 3 (e_s::bool list))",
  12.646                "(NTH 4 (v_s::real list)) occurs_in (NTH 4 (e_s::bool list))"]),
  12.647  	        ("#Find", ["solution ss'''"])],
  12.648 -	    {rew_ord'="ord_simplify_System", rls' = Erls, calc = [], 
  12.649 -	      srls = append_rls "srls_top_down_4x4" srls [], 
  12.650 -	      prls = append_rls "prls_tri_4x4_lin_sys" prls_triangular
  12.651 -			      [Calc ("Atools.occurs'_in",eval_occurs_in "")], 
  12.652 -	      crls = Erls, errpats = [], nrls = Erls},
  12.653 +	    {rew_ord'="ord_simplify_System", rls' = Celem.Erls, calc = [], 
  12.654 +	      srls = Celem.append_rls "srls_top_down_4x4" srls [], 
  12.655 +	      prls = Celem.append_rls "prls_tri_4x4_lin_sys" prls_triangular
  12.656 +			      [Celem.Calc ("Atools.occurs'_in",eval_occurs_in "")], 
  12.657 +	      crls = Celem.Erls, errpats = [], nrls = Celem.Erls},
  12.658  	    (*FIXXXXME.WN060916: this script works ONLY for exp 7.79 @@@@@@@@@@@@@@@@@@@@*)
  12.659  	    "Script SolveSystemScript (e_s::bool list) (v_s::real list) =                " ^
  12.660          "  (let e_1 = NTH 1 e_s;                                                    " ^
    13.1 --- a/src/Tools/isac/Knowledge/Equation.thy	Thu Mar 15 10:17:44 2018 +0100
    13.2 +++ b/src/Tools/isac/Knowledge/Equation.thy	Thu Mar 15 12:42:04 2018 +0100
    13.3 @@ -39,23 +39,23 @@
    13.4  
    13.5  ML {*
    13.6  val thy = @{theory};
    13.7 -val ctxt = thy2ctxt thy;
    13.8 +val ctxt = Celem.thy2ctxt thy;
    13.9  
   13.10  val univariate_equation_prls = 
   13.11 -    append_rls "univariate_equation_prls" e_rls 
   13.12 -	       [Calc ("Tools.matches",eval_matches "")];
   13.13 +    Celem.append_rls "univariate_equation_prls" Celem.e_rls 
   13.14 +	       [Celem.Calc ("Tools.matches",eval_matches "")];
   13.15  *}
   13.16  setup {* KEStore_Elems.add_rlss [("univariate_equation_prls",
   13.17    (Context.theory_name @{theory}, LTool.prep_rls @{theory} univariate_equation_prls))] *}
   13.18  setup {* KEStore_Elems.add_pbts
   13.19 -  [(Specify.prep_pbt thy "pbl_equ" [] e_pblID
   13.20 +  [(Specify.prep_pbt thy "pbl_equ" [] Celem.e_pblID
   13.21        (["equation"],
   13.22          [("#Given" ,["equality e_e","solveFor v_v"]),
   13.23            ("#Where" ,["matches (?a = ?b) e_e"]),
   13.24            ("#Find"  ,["solutions v_v'i'"])],
   13.25 -        append_rls "equation_prls" e_rls  [Calc ("Tools.matches",eval_matches "")],
   13.26 +        Celem.append_rls "equation_prls" Celem.e_rls  [Celem.Calc ("Tools.matches",eval_matches "")],
   13.27          SOME "solve (e_e::bool, v_v)", [])),
   13.28 -    (Specify.prep_pbt thy "pbl_equ_univ" [] e_pblID
   13.29 +    (Specify.prep_pbt thy "pbl_equ_univ" [] Celem.e_pblID
   13.30        (["univariate","equation"],
   13.31          [("#Given" ,["equality e_e","solveFor v_v"]),
   13.32            ("#Where" ,["matches (?a = ?b) e_e"]),
   13.33 @@ -86,10 +86,10 @@
   13.34  
   13.35  
   13.36  setup {* KEStore_Elems.add_mets
   13.37 -  [Specify.prep_met thy "met_equ" [] e_metID
   13.38 +  [Specify.prep_met thy "met_equ" [] Celem.e_metID
   13.39  	    (["Equation"], [],
   13.40 -	      {rew_ord'="tless_true", rls'=Erls, calc = [], srls = e_rls, prls=e_rls, crls = Atools_erls,
   13.41 -          errpats = [], nrls = e_rls},
   13.42 +	      {rew_ord'="tless_true", rls'=Celem.Erls, calc = [], srls = Celem.e_rls, prls=Celem.e_rls, crls = Atools_erls,
   13.43 +          errpats = [], nrls = Celem.e_rls},
   13.44          "empty_script")]
   13.45  *}
   13.46  
    14.1 --- a/src/Tools/isac/Knowledge/InsSort.thy	Thu Mar 15 10:17:44 2018 +0100
    14.2 +++ b/src/Tools/isac/Knowledge/InsSort.thy	Thu Mar 15 12:42:04 2018 +0100
    14.3 @@ -44,67 +44,67 @@
    14.4  subsection {* rulesets *}
    14.5  ML {*
    14.6  val ins_sort = 
    14.7 -  Rls {
    14.8 -    id = "ins_sort", preconds = [], rew_ord = ("tless_true", tless_true), erls = e_rls,
    14.9 -    srls = e_rls, calc = [], rules = [
   14.10 -      Thm ("xfoldr_Nil",(*num_str*) @{thm xfoldr_Nil} (* foldr ?f [] = id *)),
   14.11 -	    Thm ("xfoldr_Cons", @{thm xfoldr_Cons} (* foldr ?f (?x # ?xs) = ?f ?x \<circ> foldr ?f ?xs *)),
   14.12 +  Celem.Rls {
   14.13 +    id = "ins_sort", preconds = [], rew_ord = ("tless_true", tless_true), erls = Celem.e_rls,
   14.14 +    srls = Celem.e_rls, calc = [], rules = [
   14.15 +      Celem.Thm ("xfoldr_Nil",(*num_str*) @{thm xfoldr_Nil} (* foldr ?f [] = id *)),
   14.16 +	    Celem.Thm ("xfoldr_Cons", @{thm xfoldr_Cons} (* foldr ?f (?x # ?xs) = ?f ?x \<circ> foldr ?f ?xs *)),
   14.17  
   14.18 -	    Thm ("ins_Nil", @{thm ins_Nil} (* ins ?i [] = [?i] *)),
   14.19 -	    Thm ("ins_Cons", @{thm ins_Cons} (* ins ?i (?x # ?xs) = (if ?i < ?x then ?i # ?x # ?xs else ?x # ins ?i ?xs) *)),
   14.20 -	    Thm ("sort_deff", @{thm sort_deff} (* InsSort.sort ?xs = foldr ins ?xs [] *)),
   14.21 +	    Celem.Thm ("ins_Nil", @{thm ins_Nil} (* ins ?i [] = [?i] *)),
   14.22 +	    Celem.Thm ("ins_Cons", @{thm ins_Cons} (* ins ?i (?x # ?xs) = (if ?i < ?x then ?i # ?x # ?xs else ?x # ins ?i ?xs) *)),
   14.23 +	    Celem.Thm ("sort_deff", @{thm sort_deff} (* InsSort.sort ?xs = foldr ins ?xs [] *)),
   14.24  
   14.25 -	    Thm ("o_id", @{thm o_id} (* ?f \<circ> id = ?f *)),
   14.26 -	    Thm ("o_assoc", @{thm o_assoc} (* ?f \<circ> (?g \<circ> ?h) = ?f \<circ> ?g \<circ> ?h *)),
   14.27 -	    Thm ("o_apply", @{thm o_apply} (* (?f \<circ> ?g) ?x = ?f (?g ?x) *)),
   14.28 -	    Thm ("id_apply", @{thm id_apply} (* id ?x = ?x *)),
   14.29 +	    Celem.Thm ("o_id", @{thm o_id} (* ?f \<circ> id = ?f *)),
   14.30 +	    Celem.Thm ("o_assoc", @{thm o_assoc} (* ?f \<circ> (?g \<circ> ?h) = ?f \<circ> ?g \<circ> ?h *)),
   14.31 +	    Celem.Thm ("o_apply", @{thm o_apply} (* (?f \<circ> ?g) ?x = ?f (?g ?x) *)),
   14.32 +	    Celem.Thm ("id_apply", @{thm id_apply} (* id ?x = ?x *)),
   14.33        
   14.34 -	    Calc ("Orderings.ord_class.less", eval_equ "#less_"),
   14.35 -	    Thm ("If_def", @{thm If_def} (* if ?P then ?x else ?y \<equiv> THE z. (?P = True \<longrightarrow> z = ?x) \<and> (?P = False \<longrightarrow> z = ?y) *)),
   14.36 -	    Thm ("if_True", @{thm if_True} (* "(if True then x else y) = x" *)),
   14.37 -	    Thm ("if_False", @{thm if_False} (* "(if False then x else y) = y" *))],
   14.38 -	  errpatts = [], scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")};      
   14.39 +	    Celem.Calc ("Orderings.ord_class.less", eval_equ "#less_"),
   14.40 +	    Celem.Thm ("If_def", @{thm If_def} (* if ?P then ?x else ?y \<equiv> THE z. (?P = True \<longrightarrow> z = ?x) \<and> (?P = False \<longrightarrow> z = ?y) *)),
   14.41 +	    Celem.Thm ("if_True", @{thm if_True} (* "(if True then x else y) = x" *)),
   14.42 +	    Celem.Thm ("if_False", @{thm if_False} (* "(if False then x else y) = y" *))],
   14.43 +	  errpatts = [], scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")};      
   14.44  *}
   14.45  setup {* KEStore_Elems.add_rlss [("ins_sort", (Context.theory_name @{theory}, ins_sort))] *}
   14.46  
   14.47  subsection {* problems *}
   14.48  setup {* KEStore_Elems.add_pbts
   14.49 -  [(Specify.prep_pbt @{theory} "pbl_Programming" [] e_pblID 
   14.50 -     (["Programming"], [], e_rls, NONE, [])),
   14.51 -   (Specify.prep_pbt @{theory} "pbl_Prog_sort" [] e_pblID 
   14.52 -     (["SORT","Programming"], [], e_rls, NONE, [])),
   14.53 -   (Specify.prep_pbt @{theory} "pbl_Prog_sort_ins" [] e_pblID
   14.54 +  [(Specify.prep_pbt @{theory} "pbl_Programming" [] Celem.e_pblID 
   14.55 +     (["Programming"], [], Celem.e_rls, NONE, [])),
   14.56 +   (Specify.prep_pbt @{theory} "pbl_Prog_sort" [] Celem.e_pblID 
   14.57 +     (["SORT","Programming"], [], Celem.e_rls, NONE, [])),
   14.58 +   (Specify.prep_pbt @{theory} "pbl_Prog_sort_ins" [] Celem.e_pblID
   14.59       (["insertion","SORT","Programming"], 
   14.60       [("#Given", ["unsorted u_u"]), ("#Find", ["sorted s_s"])], 
   14.61 -     e_rls, 
   14.62 +     Celem.e_rls, 
   14.63       SOME "Sort u_u", [["Programming","SORT","insertion_steps"]]))] *}
   14.64  
   14.65  subsection {* methods *}
   14.66  (* TODO: implementation needs extra object-level lists ?!?*)
   14.67  setup {* KEStore_Elems.add_mets
   14.68 -  [ Specify.prep_met @{theory} "met_Programming" [] e_metID
   14.69 +  [ Specify.prep_met @{theory} "met_Programming" [] Celem.e_metID
   14.70        (["Programming"], [],
   14.71 -        {rew_ord'="tless_true",rls' = e_rls, calc = [], srls = e_rls, prls = e_rls,
   14.72 -          crls = e_rls, errpats = [], nrls = e_rls}, "empty_script"),
   14.73 -    Specify.prep_met @{theory} "met_Prog_sort" [] e_metID
   14.74 +        {rew_ord'="tless_true",rls' = Celem.e_rls, calc = [], srls = Celem.e_rls, prls = Celem.e_rls,
   14.75 +          crls = Celem.e_rls, errpats = [], nrls = Celem.e_rls}, "empty_script"),
   14.76 +    Specify.prep_met @{theory} "met_Prog_sort" [] Celem.e_metID
   14.77        (["Programming","SORT"], [],
   14.78 -        {rew_ord'="tless_true",rls' = e_rls, calc = [], srls = e_rls, prls = e_rls,
   14.79 -          crls = e_rls, errpats = [], nrls = e_rls},
   14.80 +        {rew_ord'="tless_true",rls' = Celem.e_rls, calc = [], srls = Celem.e_rls, prls = Celem.e_rls,
   14.81 +          crls = Celem.e_rls, errpats = [], nrls = Celem.e_rls},
   14.82          "empty_script"),
   14.83 -    Specify.prep_met @{theory} "met_Prog_sort_ins" [] e_metID
   14.84 +    Specify.prep_met @{theory} "met_Prog_sort_ins" [] Celem.e_metID
   14.85        (["Programming","SORT","insertion"], 
   14.86        [("#Given", ["unsorted u_u"]), ("#Find", ["sorted s_s"])],
   14.87 -        {rew_ord'="tless_true",rls' = Atools_erls, calc = [], srls = e_rls, prls = e_rls,
   14.88 +        {rew_ord'="tless_true",rls' = Atools_erls, calc = [], srls = Celem.e_rls, prls = Celem.e_rls,
   14.89            crls = Atools_crls, errpats = [], nrls = norm_Rational},
   14.90          "Script Sortprog (unso :: int xlist) = " ^
   14.91          "  (let uns = Take (sort unso) " ^
   14.92          "  in " ^
   14.93          "    (Rewrite_Set ins_sort False) uns" ^
   14.94          "  )"),
   14.95 -    Specify.prep_met @{theory} "met_Prog_sort_ins_steps" [] e_metID
   14.96 +    Specify.prep_met @{theory} "met_Prog_sort_ins_steps" [] Celem.e_metID
   14.97        (["Programming","SORT","insertion_steps"], 
   14.98        [("#Given", ["unsorted u_u"]), ("#Find", ["sorted s_s"])],
   14.99 -        {rew_ord'="tless_true",rls' = Atools_erls, calc = [], srls = e_rls, prls = e_rls,
  14.100 +        {rew_ord'="tless_true",rls' = Atools_erls, calc = [], srls = Celem.e_rls, prls = Celem.e_rls,
  14.101            crls = Atools_crls, errpats = [], nrls = norm_Rational},
  14.102          "Script Sortprog (unso :: int xlist) =           " ^
  14.103          "  (let uns = Take (sort unso)                   " ^
    15.1 --- a/src/Tools/isac/Knowledge/Integrate.thy	Thu Mar 15 10:17:44 2018 +0100
    15.2 +++ b/src/Tools/isac/Knowledge/Integrate.thy	Thu Mar 15 12:42:04 2018 +0100
    15.3 @@ -50,7 +50,7 @@
    15.4  (** eval functions **)
    15.5  
    15.6  val c = Free ("c", HOLogic.realT);
    15.7 -(*.create a new unique variable 'c..' in a term; for use by Calc in a rls;
    15.8 +(*.create a new unique variable 'c..' in a term; for use by Celem.Calc in a rls;
    15.9     an alternative to do this would be '(Try (Calculate new_c_) (new_c es__))'
   15.10     in the script; this will be possible if currying doesnt take the value
   15.11     from a variable, but the value '(new_c es__)' itself.*)
   15.12 @@ -78,7 +78,7 @@
   15.13  (*WN080222
   15.14  (*("new_c", ("Integrate.new'_c", eval_new_c "#new_c_"))*)
   15.15  fun eval_new_c _ _ (p as (Const ("Integrate.new'_c",_) $ t)) _ =
   15.16 -     SOME ((term2str p) ^ " = " ^ term2str (new_c p),
   15.17 +     SOME ((Celem.term2str p) ^ " = " ^ Celem.term2str (new_c p),
   15.18  	  Trueprop $ (mk_equality (p, new_c p)))
   15.19    | eval_new_c _ _ _ _ = NONE;
   15.20  *)
   15.21 @@ -92,7 +92,7 @@
   15.22  		     Const ("HOL.eq", T) $ lh $ rh => 
   15.23  		     Const ("HOL.eq", T) $ lh $ TermC.mk_add rh (new_c rh)
   15.24  		   | p => TermC.mk_add p (new_c p)
   15.25 -    in SOME ((term2str p) ^ " = " ^ term2str p',
   15.26 +    in SOME ((Celem.term2str p) ^ " = " ^ Celem.term2str p',
   15.27  	  HOLogic.Trueprop $ (TermC.mk_equality (p, p')))
   15.28      end
   15.29    | eval_add_new_c _ _ _ _ = NONE;
   15.30 @@ -102,9 +102,9 @@
   15.31  fun eval_is_f_x _ _(p as (Const ("Integrate.is'_f'_x", _)
   15.32  					   $ arg)) _ =
   15.33      if TermC.is_f_x arg
   15.34 -    then SOME ((term2str p) ^ " = True",
   15.35 +    then SOME ((Celem.term2str p) ^ " = True",
   15.36  	       HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
   15.37 -    else SOME ((term2str p) ^ " = False",
   15.38 +    else SOME ((Celem.term2str p) ^ " = False",
   15.39  	       HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
   15.40    | eval_is_f_x _ _ _ _ = NONE;
   15.41  *}
   15.42 @@ -116,52 +116,52 @@
   15.43  
   15.44  (*.rulesets for integration.*)
   15.45  val integration_rules = 
   15.46 -    Rls {id="integration_rules", preconds = [], 
   15.47 +    Celem.Rls {id="integration_rules", preconds = [], 
   15.48  	 rew_ord = ("termlessI",termlessI), 
   15.49 -	 erls = Rls {id="conditions_in_integration_rules", 
   15.50 +	 erls = Celem.Rls {id="conditions_in_integration_rules", 
   15.51  		     preconds = [], 
   15.52  		     rew_ord = ("termlessI",termlessI), 
   15.53 -		     erls = Erls, 
   15.54 -		     srls = Erls, calc = [], errpatts = [],
   15.55 +		     erls = Celem.Erls, 
   15.56 +		     srls = Celem.Erls, calc = [], errpatts = [],
   15.57  		     rules = [(*for rewriting conditions in Thm's*)
   15.58 -			      Calc ("Atools.occurs'_in", 
   15.59 +			      Celem.Calc ("Atools.occurs'_in", 
   15.60  				    eval_occurs_in "#occurs_in_"),
   15.61 -			      Thm ("not_true", TermC.num_str @{thm not_true}),
   15.62 -			      Thm ("not_false",@{thm not_false})
   15.63 +			      Celem.Thm ("not_true", TermC.num_str @{thm not_true}),
   15.64 +			      Celem.Thm ("not_false",@{thm not_false})
   15.65  			      ],
   15.66 -		     scr = EmptyScr}, 
   15.67 -	 srls = Erls, calc = [], errpatts = [],
   15.68 +		     scr = Celem.EmptyScr}, 
   15.69 +	 srls = Celem.Erls, calc = [], errpatts = [],
   15.70  	 rules = [
   15.71 -		  Thm ("integral_const", TermC.num_str @{thm integral_const}),
   15.72 -		  Thm ("integral_var", TermC.num_str @{thm integral_var}),
   15.73 -		  Thm ("integral_add", TermC.num_str @{thm integral_add}),
   15.74 -		  Thm ("integral_mult", TermC.num_str @{thm integral_mult}),
   15.75 -		  Thm ("integral_pow", TermC.num_str @{thm integral_pow}),
   15.76 -		  Calc ("Groups.plus_class.plus", eval_binop "#add_")(*for n+1*)
   15.77 +		  Celem.Thm ("integral_const", TermC.num_str @{thm integral_const}),
   15.78 +		  Celem.Thm ("integral_var", TermC.num_str @{thm integral_var}),
   15.79 +		  Celem.Thm ("integral_add", TermC.num_str @{thm integral_add}),
   15.80 +		  Celem.Thm ("integral_mult", TermC.num_str @{thm integral_mult}),
   15.81 +		  Celem.Thm ("integral_pow", TermC.num_str @{thm integral_pow}),
   15.82 +		  Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_")(*for n+1*)
   15.83  		  ],
   15.84 -	 scr = EmptyScr};
   15.85 +	 scr = Celem.EmptyScr};
   15.86  *}
   15.87  ML {*
   15.88  val add_new_c = 
   15.89 -    Seq {id="add_new_c", preconds = [], 
   15.90 +    Celem.Seq {id="add_new_c", preconds = [], 
   15.91  	 rew_ord = ("termlessI",termlessI), 
   15.92 -	 erls = Rls {id="conditions_in_add_new_c", 
   15.93 +	 erls = Celem.Rls {id="conditions_in_add_new_c", 
   15.94  		     preconds = [], 
   15.95  		     rew_ord = ("termlessI",termlessI), 
   15.96 -		     erls = Erls, 
   15.97 -		     srls = Erls, calc = [], errpatts = [],
   15.98 -		     rules = [Calc ("Tools.matches", eval_matches""),
   15.99 -			      Calc ("Integrate.is'_f'_x", 
  15.100 +		     erls = Celem.Erls, 
  15.101 +		     srls = Celem.Erls, calc = [], errpatts = [],
  15.102 +		     rules = [Celem.Calc ("Tools.matches", eval_matches""),
  15.103 +			      Celem.Calc ("Integrate.is'_f'_x", 
  15.104  				    eval_is_f_x "is_f_x_"),
  15.105 -			      Thm ("not_true", TermC.num_str @{thm not_true}),
  15.106 -			      Thm ("not_false", TermC.num_str @{thm not_false})
  15.107 +			      Celem.Thm ("not_true", TermC.num_str @{thm not_true}),
  15.108 +			      Celem.Thm ("not_false", TermC.num_str @{thm not_false})
  15.109  			      ],
  15.110 -		     scr = EmptyScr}, 
  15.111 -	 srls = Erls, calc = [], errpatts = [],
  15.112 -	 rules = [ (*Thm ("call_for_new_c", TermC.num_str @{thm call_for_new_c}),*)
  15.113 -		   Cal1 ("Integrate.add'_new'_c", eval_add_new_c "new_c_")
  15.114 +		     scr = Celem.EmptyScr}, 
  15.115 +	 srls = Celem.Erls, calc = [], errpatts = [],
  15.116 +	 rules = [ (*Celem.Thm ("call_for_new_c", TermC.num_str @{thm call_for_new_c}),*)
  15.117 +		   Celem.Cal1 ("Integrate.add'_new'_c", eval_add_new_c "new_c_")
  15.118  		   ],
  15.119 -	 scr = EmptyScr};
  15.120 +	 scr = Celem.EmptyScr};
  15.121  *}
  15.122  ML {*
  15.123  
  15.124 @@ -169,62 +169,62 @@
  15.125  
  15.126  (*.for simplify_Integral adapted from 'norm_Rational_rls'.*)
  15.127  val norm_Rational_rls_noadd_fractions = 
  15.128 -Rls {id = "norm_Rational_rls_noadd_fractions", preconds = [], 
  15.129 -     rew_ord = ("dummy_ord",dummy_ord), 
  15.130 -     erls = norm_rat_erls, srls = Erls, calc = [], errpatts = [],
  15.131 -     rules = [(*Rls_ add_fractions_p_rls,!!!*)
  15.132 -	      Rls_ (*rat_mult_div_pow original corrected WN051028*)
  15.133 -		  (Rls {id = "rat_mult_div_pow", preconds = [], 
  15.134 -		       rew_ord = ("dummy_ord",dummy_ord), 
  15.135 -		       erls = (*FIXME.WN051028 e_rls,*)
  15.136 -		       append_rls "e_rls-is_polyexp" e_rls
  15.137 -				  [Calc ("Poly.is'_polyexp", 
  15.138 +Celem.Rls {id = "norm_Rational_rls_noadd_fractions", preconds = [], 
  15.139 +     rew_ord = ("dummy_ord",Celem.dummy_ord), 
  15.140 +     erls = norm_rat_erls, srls = Celem.Erls, calc = [], errpatts = [],
  15.141 +     rules = [(*Celem.Rls_ add_fractions_p_rls,!!!*)
  15.142 +	      Celem.Rls_ (*rat_mult_div_pow original corrected WN051028*)
  15.143 +		  (Celem.Rls {id = "rat_mult_div_pow", preconds = [], 
  15.144 +		       rew_ord = ("dummy_ord",Celem.dummy_ord), 
  15.145 +		       erls = (*FIXME.WN051028 Celem.e_rls,*)
  15.146 +		       Celem.append_rls "Celem.e_rls-is_polyexp" Celem.e_rls
  15.147 +				  [Celem.Calc ("Poly.is'_polyexp", 
  15.148  					 eval_is_polyexp "")],
  15.149 -				  srls = Erls, calc = [], errpatts = [],
  15.150 -				  rules = [Thm ("rat_mult", TermC.num_str @{thm rat_mult}),
  15.151 +				  srls = Celem.Erls, calc = [], errpatts = [],
  15.152 +				  rules = [Celem.Thm ("rat_mult", TermC.num_str @{thm rat_mult}),
  15.153  	       (*"?a / ?b * (?c / ?d) = ?a * ?c / (?b * ?d)"*)
  15.154 -	       Thm ("rat_mult_poly_l", TermC.num_str @{thm rat_mult_poly_l}),
  15.155 +	       Celem.Thm ("rat_mult_poly_l", TermC.num_str @{thm rat_mult_poly_l}),
  15.156  	       (*"?c is_polyexp ==> ?c * (?a / ?b) = ?c * ?a / ?b"*)
  15.157 -	       Thm ("rat_mult_poly_r", TermC.num_str @{thm rat_mult_poly_r}),
  15.158 +	       Celem.Thm ("rat_mult_poly_r", TermC.num_str @{thm rat_mult_poly_r}),
  15.159  	       (*"?c is_polyexp ==> ?a / ?b * ?c = ?a * ?c / ?b"*)
  15.160  
  15.161 -	       Thm ("real_divide_divide1_mg",
  15.162 +	       Celem.Thm ("real_divide_divide1_mg",
  15.163                       TermC.num_str @{thm real_divide_divide1_mg}),
  15.164  	       (*"y ~= 0 ==> (u / v) / (y / z) = (u * z) / (y * v)"*)
  15.165 -	       Thm ("divide_divide_eq_right", 
  15.166 +	       Celem.Thm ("divide_divide_eq_right", 
  15.167                       TermC.num_str @{thm divide_divide_eq_right}),
  15.168  	       (*"?x / (?y / ?z) = ?x * ?z / ?y"*)
  15.169 -	       Thm ("divide_divide_eq_left",
  15.170 +	       Celem.Thm ("divide_divide_eq_left",
  15.171                       TermC.num_str @{thm divide_divide_eq_left}),
  15.172  	       (*"?x / ?y / ?z = ?x / (?y * ?z)"*)
  15.173 -	       Calc ("Rings.divide_class.divide"  ,eval_cancel "#divide_e"),
  15.174 +	       Celem.Calc ("Rings.divide_class.divide"  ,eval_cancel "#divide_e"),
  15.175  	      
  15.176 -	       Thm ("rat_power", TermC.num_str @{thm rat_power})
  15.177 +	       Celem.Thm ("rat_power", TermC.num_str @{thm rat_power})
  15.178  		(*"(?a / ?b) ^^^ ?n = ?a ^^^ ?n / ?b ^^^ ?n"*)
  15.179  	       ],
  15.180 -      scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  15.181 +      scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  15.182        }),
  15.183 -		Rls_ make_rat_poly_with_parentheses,
  15.184 -		Rls_ cancel_p_rls,(*FIXME:cancel_p does NOT order sometimes*)
  15.185 -		Rls_ rat_reduce_1
  15.186 +		Celem.Rls_ make_rat_poly_with_parentheses,
  15.187 +		Celem.Rls_ cancel_p_rls,(*FIXME:cancel_p does NOT order sometimes*)
  15.188 +		Celem.Rls_ rat_reduce_1
  15.189  		],
  15.190 -       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  15.191 -       }:rls;
  15.192 +       scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  15.193 +       };
  15.194  
  15.195  (*.for simplify_Integral adapted from 'norm_Rational'.*)
  15.196  val norm_Rational_noadd_fractions = 
  15.197 -   Seq {id = "norm_Rational_noadd_fractions", preconds = [], 
  15.198 -       rew_ord = ("dummy_ord",dummy_ord), 
  15.199 -       erls = norm_rat_erls, srls = Erls, calc = [], errpatts = [],
  15.200 -       rules = [Rls_ discard_minus,
  15.201 -		Rls_ rat_mult_poly,(* removes double fractions like a/b/c    *)
  15.202 -		Rls_ make_rat_poly_with_parentheses, (*WN0510 also in(#)below*)
  15.203 -		Rls_ cancel_p_rls, (*FIXME.MG:cancel_p does NOT order sometim*)
  15.204 -		Rls_ norm_Rational_rls_noadd_fractions,(* the main rls (#)   *)
  15.205 -		Rls_ discard_parentheses1 (* mult only                       *)
  15.206 +   Celem.Seq {id = "norm_Rational_noadd_fractions", preconds = [], 
  15.207 +       rew_ord = ("dummy_ord",Celem.dummy_ord), 
  15.208 +       erls = norm_rat_erls, srls = Celem.Erls, calc = [], errpatts = [],
  15.209 +       rules = [Celem.Rls_ discard_minus,
  15.210 +		Celem.Rls_ rat_mult_poly,(* removes double fractions like a/b/c    *)
  15.211 +		Celem.Rls_ make_rat_poly_with_parentheses, (*WN0510 also in(#)below*)
  15.212 +		Celem.Rls_ cancel_p_rls, (*FIXME.MG:cancel_p does NOT order sometim*)
  15.213 +		Celem.Rls_ norm_Rational_rls_noadd_fractions,(* the main rls (#)   *)
  15.214 +		Celem.Rls_ discard_parentheses1 (* mult only                       *)
  15.215  		],
  15.216 -       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  15.217 -       }:rls;
  15.218 +       scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  15.219 +       };
  15.220  
  15.221  (*.simplify terms before and after Integration such that  
  15.222     ..a.x^2/2 + b.x^3/3.. is made to ..a/2.x^2 + b/3.x^3.. (and NO
  15.223 @@ -233,37 +233,37 @@
  15.224     *1* expand the term, ie. distribute * and / over +
  15.225  .*)
  15.226  val separate_bdv2 =
  15.227 -    append_rls "separate_bdv2"
  15.228 +    Celem.append_rls "separate_bdv2"
  15.229  	       collect_bdv
  15.230 -	       [Thm ("separate_bdv", TermC.num_str @{thm separate_bdv}),
  15.231 +	       [Celem.Thm ("separate_bdv", TermC.num_str @{thm separate_bdv}),
  15.232  		(*"?a * ?bdv / ?b = ?a / ?b * ?bdv"*)
  15.233 -		Thm ("separate_bdv_n", TermC.num_str @{thm separate_bdv_n}),
  15.234 -		Thm ("separate_1_bdv",  TermC.num_str @{thm separate_1_bdv}),
  15.235 +		Celem.Thm ("separate_bdv_n", TermC.num_str @{thm separate_bdv_n}),
  15.236 +		Celem.Thm ("separate_1_bdv",  TermC.num_str @{thm separate_1_bdv}),
  15.237  		(*"?bdv / ?b = (1 / ?b) * ?bdv"*)
  15.238 -		Thm ("separate_1_bdv_n",  TermC.num_str @{thm separate_1_bdv_n})(*,
  15.239 +		Celem.Thm ("separate_1_bdv_n",  TermC.num_str @{thm separate_1_bdv_n})(*,
  15.240  			  (*"?bdv ^^^ ?n / ?b = 1 / ?b * ?bdv ^^^ ?n"*)
  15.241 -			  *****Thm ("add_divide_distrib", 
  15.242 +			  *****Celem.Thm ("add_divide_distrib", 
  15.243  			  ***** TermC.num_str @{thm add_divide_distrib})
  15.244  			  (*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"*)----------*)
  15.245  		];
  15.246  val simplify_Integral = 
  15.247 -  Seq {id = "simplify_Integral", preconds = []:term list, 
  15.248 -       rew_ord = ("dummy_ord", dummy_ord),
  15.249 -      erls = Atools_erls, srls = Erls,
  15.250 +  Celem.Seq {id = "simplify_Integral", preconds = []:term list, 
  15.251 +       rew_ord = ("dummy_ord", Celem.dummy_ord),
  15.252 +      erls = Atools_erls, srls = Celem.Erls,
  15.253        calc = [],  errpatts = [],
  15.254 -      rules = [Thm ("distrib_right", TermC.num_str @{thm distrib_right}),
  15.255 +      rules = [Celem.Thm ("distrib_right", TermC.num_str @{thm distrib_right}),
  15.256   	       (*"(?z1.0 + ?z2.0) * ?w = ?z1.0 * ?w + ?z2.0 * ?w"*)
  15.257 -	       Thm ("add_divide_distrib", TermC.num_str @{thm add_divide_distrib}),
  15.258 +	       Celem.Thm ("add_divide_distrib", TermC.num_str @{thm add_divide_distrib}),
  15.259   	       (*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"*)
  15.260  	       (*^^^^^ *1* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*)
  15.261 -	       Rls_ norm_Rational_noadd_fractions,
  15.262 -	       Rls_ order_add_mult_in,
  15.263 -	       Rls_ discard_parentheses,
  15.264 -	       (*Rls_ collect_bdv, from make_polynomial_in*)
  15.265 -	       Rls_ separate_bdv2,
  15.266 -	       Calc ("Rings.divide_class.divide"  ,eval_cancel "#divide_e")
  15.267 +	       Celem.Rls_ norm_Rational_noadd_fractions,
  15.268 +	       Celem.Rls_ order_add_mult_in,
  15.269 +	       Celem.Rls_ discard_parentheses,
  15.270 +	       (*Celem.Rls_ collect_bdv, from make_polynomial_in*)
  15.271 +	       Celem.Rls_ separate_bdv2,
  15.272 +	       Celem.Calc ("Rings.divide_class.divide"  ,eval_cancel "#divide_e")
  15.273  	       ],
  15.274 -      scr = EmptyScr}:rls;      
  15.275 +      scr = Celem.EmptyScr};      
  15.276  
  15.277  
  15.278  (*simplify terms before and after Integration such that  
  15.279 @@ -273,54 +273,54 @@
  15.280     'make_ratpoly_in' 
  15.281  THIS IS KEPT FOR COMPARISON ............................................   
  15.282  * val simplify_Integral = prep_rls'(
  15.283 -*   Seq {id = "", preconds = []:term list, 
  15.284 -*        rew_ord = ("dummy_ord", dummy_ord),
  15.285 -*       erls = Atools_erls, srls = Erls,
  15.286 +*   Celem.Seq {id = "", preconds = []:term list, 
  15.287 +*        rew_ord = ("dummy_ord", Celem.dummy_ord),
  15.288 +*       erls = Atools_erls, srls = Celem.Erls,
  15.289  *       calc = [], (*asm_thm = [],*)
  15.290 -*       rules = [Rls_ expand_poly,
  15.291 -* 	       Rls_ order_add_mult_in,
  15.292 -* 	       Rls_ simplify_power,
  15.293 -* 	       Rls_ collect_numerals,
  15.294 -* 	       Rls_ reduce_012,
  15.295 -* 	       Thm ("realpow_oneI", TermC.num_str @{thm realpow_oneI}),
  15.296 -* 	       Rls_ discard_parentheses,
  15.297 -* 	       Rls_ collect_bdv,
  15.298 +*       rules = [Celem.Rls_ expand_poly,
  15.299 +* 	       Celem.Rls_ order_add_mult_in,
  15.300 +* 	       Celem.Rls_ simplify_power,
  15.301 +* 	       Celem.Rls_ collect_numerals,
  15.302 +* 	       Celem.Rls_ reduce_012,
  15.303 +* 	       Celem.Thm ("realpow_oneI", TermC.num_str @{thm realpow_oneI}),
  15.304 +* 	       Celem.Rls_ discard_parentheses,
  15.305 +* 	       Celem.Rls_ collect_bdv,
  15.306  * 	       (*below inserted from 'make_ratpoly_in'*)
  15.307 -* 	       Rls_ (append_rls "separate_bdv"
  15.308 +* 	       Celem.Rls_ (Celem.append_rls "separate_bdv"
  15.309  * 			 collect_bdv
  15.310 -* 			 [Thm ("separate_bdv", TermC.num_str @{thm separate_bdv}),
  15.311 +* 			 [Celem.Thm ("separate_bdv", TermC.num_str @{thm separate_bdv}),
  15.312  * 			  (*"?a * ?bdv / ?b = ?a / ?b * ?bdv"*)
  15.313 -* 			  Thm ("separate_bdv_n", TermC.num_str @{thm separate_bdv_n}),
  15.314 -* 			  Thm ("separate_1_bdv", TermC.num_str @{thm separate_1_bdv}),
  15.315 +* 			  Celem.Thm ("separate_bdv_n", TermC.num_str @{thm separate_bdv_n}),
  15.316 +* 			  Celem.Thm ("separate_1_bdv", TermC.num_str @{thm separate_1_bdv}),
  15.317  * 			  (*"?bdv / ?b = (1 / ?b) * ?bdv"*)
  15.318 -* 			  Thm ("separate_1_bdv_n", TermC.num_str @{thm separate_1_bdv_n})(*,
  15.319 +* 			  Celem.Thm ("separate_1_bdv_n", TermC.num_str @{thm separate_1_bdv_n})(*,
  15.320  * 			  (*"?bdv ^^^ ?n / ?b = 1 / ?b * ?bdv ^^^ ?n"*)
  15.321 -* 			  Thm ("add_divide_distrib", 
  15.322 +* 			  Celem.Thm ("add_divide_distrib", 
  15.323  * 				  TermC.num_str @{thm add_divide_distrib})
  15.324  * 			   (*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"*)*)
  15.325  * 			  ]),
  15.326 -* 	       Calc ("Rings.divide_class.divide"  ,eval_cancel "#divide_e")
  15.327 +* 	       Celem.Calc ("Rings.divide_class.divide"  ,eval_cancel "#divide_e")
  15.328  * 	       ],
  15.329 -*       scr = EmptyScr
  15.330 -*       }:rls); 
  15.331 +*       scr = Celem.EmptyScr
  15.332 +*       }); 
  15.333  .......................................................................*)
  15.334  
  15.335  val integration = 
  15.336 -    Seq {id="integration", preconds = [], 
  15.337 +    Celem.Seq {id="integration", preconds = [], 
  15.338  	 rew_ord = ("termlessI",termlessI), 
  15.339 -	 erls = Rls {id="conditions_in_integration", 
  15.340 +	 erls = Celem.Rls {id="conditions_in_integration", 
  15.341  		     preconds = [], 
  15.342  		     rew_ord = ("termlessI",termlessI), 
  15.343 -		     erls = Erls, 
  15.344 -		     srls = Erls, calc = [], errpatts = [],
  15.345 +		     erls = Celem.Erls, 
  15.346 +		     srls = Celem.Erls, calc = [], errpatts = [],
  15.347  		     rules = [],
  15.348 -		     scr = EmptyScr}, 
  15.349 -	 srls = Erls, calc = [], errpatts = [],
  15.350 -	 rules = [ Rls_ integration_rules,
  15.351 -		   Rls_ add_new_c,
  15.352 -		   Rls_ simplify_Integral
  15.353 +		     scr = Celem.EmptyScr}, 
  15.354 +	 srls = Celem.Erls, calc = [], errpatts = [],
  15.355 +	 rules = [ Celem.Rls_ integration_rules,
  15.356 +		   Celem.Rls_ add_new_c,
  15.357 +		   Celem.Rls_ simplify_Integral
  15.358  		   ],
  15.359 -	 scr = EmptyScr};
  15.360 +	 scr = Celem.EmptyScr};
  15.361  
  15.362  val prep_rls' = LTool.prep_rls @{theory};
  15.363  *}
  15.364 @@ -338,38 +338,38 @@
  15.365  
  15.366  (** problems **)
  15.367  setup {* KEStore_Elems.add_pbts
  15.368 -  [(Specify.prep_pbt thy "pbl_fun_integ" [] e_pblID
  15.369 +  [(Specify.prep_pbt thy "pbl_fun_integ" [] Celem.e_pblID
  15.370        (["integrate","function"],
  15.371          [("#Given" ,["functionTerm f_f", "integrateBy v_v"]),
  15.372            ("#Find"  ,["antiDerivative F_F"])],
  15.373 -        append_rls "e_rls" e_rls [(*for preds in where_*)], 
  15.374 +        Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*)], 
  15.375          SOME "Integrate (f_f, v_v)", 
  15.376          [["diff","integration"]])),
  15.377      (*here "named" is used differently from Differentiation"*)
  15.378 -    (Specify.prep_pbt thy "pbl_fun_integ_nam" [] e_pblID
  15.379 +    (Specify.prep_pbt thy "pbl_fun_integ_nam" [] Celem.e_pblID
  15.380        (["named","integrate","function"],
  15.381          [("#Given" ,["functionTerm f_f", "integrateBy v_v"]),
  15.382            ("#Find"  ,["antiDerivativeName F_F"])],
  15.383 -        append_rls "e_rls" e_rls [(*for preds in where_*)], 
  15.384 +        Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*)], 
  15.385          SOME "Integrate (f_f, v_v)", 
  15.386          [["diff","integration","named"]]))] *}
  15.387  
  15.388  (** methods **)
  15.389  setup {* KEStore_Elems.add_mets
  15.390 -  [Specify.prep_met thy "met_diffint" [] e_metID
  15.391 +  [Specify.prep_met thy "met_diffint" [] Celem.e_metID
  15.392  	    (["diff","integration"],
  15.393  	      [("#Given" ,["functionTerm f_f", "integrateBy v_v"]), ("#Find"  ,["antiDerivative F_F"])],
  15.394 -	      {rew_ord'="tless_true", rls'=Atools_erls, calc = [], srls = e_rls, prls=e_rls,
  15.395 -	        crls = Atools_erls, errpats = [], nrls = e_rls},
  15.396 +	      {rew_ord'="tless_true", rls'=Atools_erls, calc = [], srls = Celem.e_rls, prls=Celem.e_rls,
  15.397 +	        crls = Atools_erls, errpats = [], nrls = Celem.e_rls},
  15.398  	      "Script IntegrationScript (f_f::real) (v_v::real) =                " ^
  15.399            "  (let t_t = Take (Integral f_f D v_v)                             " ^
  15.400            "   in (Rewrite_Set_Inst [(bdv,v_v)] integration False) (t_t::real))"),
  15.401 -    Specify.prep_met thy "met_diffint_named" [] e_metID
  15.402 +    Specify.prep_met thy "met_diffint_named" [] Celem.e_metID
  15.403  	    (["diff","integration","named"],
  15.404  	      [("#Given" ,["functionTerm f_f", "integrateBy v_v"]),
  15.405  	        ("#Find"  ,["antiDerivativeName F_F"])],
  15.406 -	      {rew_ord'="tless_true", rls'=Atools_erls, calc = [], srls = e_rls, prls=e_rls,
  15.407 -          crls = Atools_erls, errpats = [], nrls = e_rls},
  15.408 +	      {rew_ord'="tless_true", rls'=Atools_erls, calc = [], srls = Celem.e_rls, prls=Celem.e_rls,
  15.409 +          crls = Atools_erls, errpats = [], nrls = Celem.e_rls},
  15.410          "Script NamedIntegrationScript (f_f::real) (v_v::real) (F_F::real=>real) = " ^
  15.411            "  (let t_t = Take (F_F v_v = Integral f_f D v_v)                            " ^
  15.412            "   in ((Try (Rewrite_Set_Inst [(bdv,v_v)] simplify_Integral False)) @@  " ^
    16.1 --- a/src/Tools/isac/Knowledge/Inverse_Z_Transform.thy	Thu Mar 15 10:17:44 2018 +0100
    16.2 +++ b/src/Tools/isac/Knowledge/Inverse_Z_Transform.thy	Thu Mar 15 12:42:04 2018 +0100
    16.3 @@ -28,13 +28,13 @@
    16.4  
    16.5  ML {*
    16.6  val inverse_z = prep_rls'(
    16.7 -  Rls {id = "inverse_z", preconds = [], rew_ord = ("dummy_ord",dummy_ord), 
    16.8 -	  erls = Erls, srls = Erls, calc = [], errpatts = [],
    16.9 +  Celem.Rls {id = "inverse_z", preconds = [], rew_ord = ("dummy_ord",Celem.dummy_ord), 
   16.10 +	  erls = Celem.Erls, srls = Celem.Erls, calc = [], errpatts = [],
   16.11  	  rules = 
   16.12  	   [
   16.13 -    Thm ("rule4", @{thm rule4})
   16.14 +    Celem.Thm ("rule4", @{thm rule4})
   16.15  	   ], 
   16.16 -	 scr = EmptyScr}:rls);
   16.17 +	 scr = Celem.EmptyScr});
   16.18  *}
   16.19  
   16.20  
   16.21 @@ -47,22 +47,22 @@
   16.22  val thy = @{theory};
   16.23  *}
   16.24  setup {* KEStore_Elems.add_pbts
   16.25 -  [(Specify.prep_pbt thy "pbl_SP" [] e_pblID (["SignalProcessing"], [], e_rls, NONE, [])),
   16.26 -    (Specify.prep_pbt thy "pbl_SP_Ztrans" [] e_pblID
   16.27 -      (["Z_Transform","SignalProcessing"], [], e_rls, NONE, [])),
   16.28 -    (Specify.prep_pbt thy "pbl_SP_Ztrans_inv" [] e_pblID
   16.29 +  [(Specify.prep_pbt thy "pbl_SP" [] Celem.e_pblID (["SignalProcessing"], [], Celem.e_rls, NONE, [])),
   16.30 +    (Specify.prep_pbt thy "pbl_SP_Ztrans" [] Celem.e_pblID
   16.31 +      (["Z_Transform","SignalProcessing"], [], Celem.e_rls, NONE, [])),
   16.32 +    (Specify.prep_pbt thy "pbl_SP_Ztrans_inv" [] Celem.e_pblID
   16.33        (["Inverse", "Z_Transform", "SignalProcessing"],
   16.34          (*^ capital letter breaks coding standard
   16.35            because "inverse" = Const ("Rings.inverse_class.inverse", ..*)
   16.36          [("#Given" ,["filterExpression (X_eq::bool)"]),
   16.37            ("#Find"  ,["stepResponse (n_eq::bool)"])],
   16.38 -        append_rls "e_rls" e_rls [(*for preds in where_*)], NONE, 
   16.39 +        Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*)], NONE, 
   16.40          [["SignalProcessing","Z_Transform","Inverse"]])),
   16.41 -    (Specify.prep_pbt thy "pbl_SP_Ztrans_inv" [] e_pblID
   16.42 +    (Specify.prep_pbt thy "pbl_SP_Ztrans_inv" [] Celem.e_pblID
   16.43        (["Inverse", "Z_Transform", "SignalProcessing"],
   16.44          [("#Given" ,["filterExpression X_eq"]),
   16.45            ("#Find"  ,["stepResponse n_eq"])],
   16.46 -        append_rls "e_rls" e_rls [(*for preds in where_*)], NONE, 
   16.47 +        Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*)], NONE, 
   16.48          [["SignalProcessing","Z_Transform","Inverse"]]))] *}
   16.49  
   16.50  subsection {*Define Name and Signature for the Method*}
   16.51 @@ -73,20 +73,20 @@
   16.52  subsection {*Setup Parent Nodes in Hierarchy of Method*}
   16.53  ML {* val thy = @{theory}; (*latest version of thy required*) *}
   16.54  setup {* KEStore_Elems.add_mets
   16.55 -  [Specify.prep_met thy "met_SP" [] e_metID
   16.56 +  [Specify.prep_met thy "met_SP" [] Celem.e_metID
   16.57        (["SignalProcessing"], [],
   16.58 -        {rew_ord'="tless_true", rls'= e_rls, calc = [], srls = e_rls, prls = e_rls, crls = e_rls,
   16.59 -          errpats = [], nrls = e_rls}, "empty_script"),
   16.60 -    Specify.prep_met thy "met_SP_Ztrans" [] e_metID
   16.61 +        {rew_ord'="tless_true", rls'= Celem.e_rls, calc = [], srls = Celem.e_rls, prls = Celem.e_rls, crls = Celem.e_rls,
   16.62 +          errpats = [], nrls = Celem.e_rls}, "empty_script"),
   16.63 +    Specify.prep_met thy "met_SP_Ztrans" [] Celem.e_metID
   16.64        (["SignalProcessing", "Z_Transform"], [],
   16.65 -        {rew_ord'="tless_true", rls'= e_rls, calc = [], srls = e_rls, prls = e_rls, crls = e_rls,
   16.66 -          errpats = [], nrls = e_rls}, "empty_script"),
   16.67 -    Specify.prep_met thy "met_SP_Ztrans_inv" [] e_metID
   16.68 +        {rew_ord'="tless_true", rls'= Celem.e_rls, calc = [], srls = Celem.e_rls, prls = Celem.e_rls, crls = Celem.e_rls,
   16.69 +          errpats = [], nrls = Celem.e_rls}, "empty_script"),
   16.70 +    Specify.prep_met thy "met_SP_Ztrans_inv" [] Celem.e_metID
   16.71        (["SignalProcessing", "Z_Transform", "Inverse"], 
   16.72          [("#Given" ,["filterExpression (X_eq::bool)"]),
   16.73            ("#Find"  ,["stepResponse (n_eq::bool)"])],
   16.74 -        {rew_ord'="tless_true", rls'= e_rls, calc = [], srls = e_rls, prls = e_rls, crls = e_rls,
   16.75 -          errpats = [], nrls = e_rls},
   16.76 +        {rew_ord'="tless_true", rls'= Celem.e_rls, calc = [], srls = Celem.e_rls, prls = Celem.e_rls, crls = Celem.e_rls,
   16.77 +          errpats = [], nrls = Celem.e_rls},
   16.78          "Script InverseZTransform (X_eq::bool) =" ^ (*(1/z) instead of z ^^^ -1*)
   16.79            " (let X = Take X_eq;" ^
   16.80            "      X' = Rewrite ruleZY False X;" ^ (*z * denominator*)
   16.81 @@ -102,12 +102,12 @@
   16.82            "                         [Test,solve_linear])              " ^
   16.83            "                        [BOOL equ, REAL z])              " ^
   16.84            "  in X)"),
   16.85 -    Specify.prep_met thy "met_SP_Ztrans_inv" [] e_metID
   16.86 +    Specify.prep_met thy "met_SP_Ztrans_inv" [] Celem.e_metID
   16.87        (["SignalProcessing", "Z_Transform", "Inverse"], 
   16.88          [("#Given" ,["filterExpression X_eq"]),
   16.89            ("#Find"  ,["stepResponse n_eq"])],
   16.90 -        {rew_ord'="tless_true", rls'= e_rls, calc = [], srls = srls_partial_fraction, prls = e_rls,
   16.91 -          crls = e_rls, errpats = [], nrls = e_rls},
   16.92 +        {rew_ord'="tless_true", rls'= Celem.e_rls, calc = [], srls = srls_partial_fraction, prls = Celem.e_rls,
   16.93 +          crls = Celem.e_rls, errpats = [], nrls = Celem.e_rls},
   16.94          "Script InverseZTransform (X_eq::bool) =                        "^
   16.95             (*(1/z) instead of z ^^^ -1*)
   16.96             "(let X = Take X_eq;                                            "^
   16.97 @@ -175,32 +175,32 @@
   16.98             "      (n_eq::bool) = (Rewrite_Set inverse_z False) X_z;        "^
   16.99             "      n_eq = drop_questionmarks n_eq                           "^
  16.100             "in n_eq)"),
  16.101 -    Specify.prep_met thy "met_SP_Ztrans_inv_sub" [] e_metID
  16.102 +    Specify.prep_met thy "met_SP_Ztrans_inv_sub" [] Celem.e_metID
  16.103        (["SignalProcessing", "Z_Transform", "Inverse_sub"], 
  16.104          [("#Given" ,["filterExpression X_eq"]),
  16.105            ("#Find"  ,["stepResponse n_eq"])],
  16.106 -        {rew_ord'="tless_true", rls'= e_rls, calc = [],
  16.107 -          srls = Rls {id="srls_partial_fraction", 
  16.108 +        {rew_ord'="tless_true", rls'= Celem.e_rls, calc = [],
  16.109 +          srls = Celem.Rls {id="srls_partial_fraction", 
  16.110                preconds = [], rew_ord = ("termlessI",termlessI),
  16.111 -              erls = append_rls "erls_in_srls_partial_fraction" e_rls
  16.112 +              erls = Celem.append_rls "erls_in_srls_partial_fraction" Celem.e_rls
  16.113                    [(*for asm in NTH_CONS ...*)
  16.114 -                    Calc ("Orderings.ord_class.less",eval_equ "#less_"),
  16.115 +                    Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"),
  16.116                      (*2nd NTH_CONS pushes n+-1 into asms*)
  16.117 -                    Calc("Groups.plus_class.plus", eval_binop "#add_")], 
  16.118 -              srls = Erls, calc = [], errpatts = [],
  16.119 -              rules = [Thm ("NTH_CONS", @{thm NTH_CONS}),
  16.120 -                  Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  16.121 -                  Thm ("NTH_NIL", @{thm NTH_NIL}),
  16.122 -                  Calc ("Tools.lhs", eval_lhs "eval_lhs_"),
  16.123 -                  Calc ("Tools.rhs", eval_rhs"eval_rhs_"),
  16.124 -                  Calc ("Atools.argument'_in", eval_argument_in "Atools.argument'_in"),
  16.125 -                  Calc ("Rational.get_denominator", eval_get_denominator "#get_denominator"),
  16.126 -                  Calc ("Rational.get_numerator", eval_get_numerator "#get_numerator"),
  16.127 -                  Calc ("Partial_Fractions.factors_from_solution",
  16.128 +                    Celem.Calc("Groups.plus_class.plus", eval_binop "#add_")], 
  16.129 +              srls = Celem.Erls, calc = [], errpatts = [],
  16.130 +              rules = [Celem.Thm ("NTH_CONS", @{thm NTH_CONS}),
  16.131 +                  Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  16.132 +                  Celem.Thm ("NTH_NIL", @{thm NTH_NIL}),
  16.133 +                  Celem.Calc ("Tools.lhs", eval_lhs "eval_lhs_"),
  16.134 +                  Celem.Calc ("Tools.rhs", eval_rhs"eval_rhs_"),
  16.135 +                  Celem.Calc ("Atools.argument'_in", eval_argument_in "Atools.argument'_in"),
  16.136 +                  Celem.Calc ("Rational.get_denominator", eval_get_denominator "#get_denominator"),
  16.137 +                  Celem.Calc ("Rational.get_numerator", eval_get_numerator "#get_numerator"),
  16.138 +                  Celem.Calc ("Partial_Fractions.factors_from_solution",
  16.139                      eval_factors_from_solution "#factors_from_solution"),
  16.140 -                  Calc("Partial_Fractions.drop_questionmarks", eval_drop_questionmarks "#drop_?")],
  16.141 -              scr = EmptyScr},
  16.142 -          prls = e_rls, crls = e_rls, errpats = [], nrls = norm_Rational},
  16.143 +                  Celem.Calc("Partial_Fractions.drop_questionmarks", eval_drop_questionmarks "#drop_?")],
  16.144 +              scr = Celem.EmptyScr},
  16.145 +          prls = Celem.e_rls, crls = Celem.e_rls, errpats = [], nrls = norm_Rational},
  16.146          (*([], Frm), Problem (Isac, [Inverse, Z_Transform, SignalProcessing])*)
  16.147          "Script InverseZTransform (X_eq::bool) =            "^
  16.148            (*([1], Frm), X z = 3 / (z - 1 / 4 + -1 / 8 * (1 / z))*)
    17.1 --- a/src/Tools/isac/Knowledge/LinEq.thy	Thu Mar 15 10:17:44 2018 +0100
    17.2 +++ b/src/Tools/isac/Knowledge/LinEq.thy	Thu Mar 15 12:42:04 2018 +0100
    17.3 @@ -32,41 +32,41 @@
    17.4  val thy = @{theory};
    17.5  
    17.6  val LinEq_prls = (*3.10.02:just the following order due to subterm evaluation*)
    17.7 -  append_rls "LinEq_prls" e_rls 
    17.8 -	     [Calc ("HOL.eq",eval_equal "#equal_"),
    17.9 -	      Calc ("Tools.matches",eval_matches ""),
   17.10 -	      Calc ("Tools.lhs"    ,eval_lhs ""),
   17.11 -	      Calc ("Tools.rhs"    ,eval_rhs ""),
   17.12 -	      Calc ("Poly.has'_degree'_in",eval_has_degree_in ""),
   17.13 - 	      Calc ("Poly.is'_polyrat'_in",eval_is_polyrat_in ""),
   17.14 -	      Calc ("Atools.occurs'_in",eval_occurs_in ""),    
   17.15 -	      Calc ("Atools.ident",eval_ident "#ident_"),
   17.16 -	      Thm ("not_true",TermC.num_str @{thm not_true}),
   17.17 -	      Thm ("not_false",TermC.num_str @{thm not_false}),
   17.18 -	      Thm ("and_true",TermC.num_str @{thm and_true}),
   17.19 -	      Thm ("and_false",TermC.num_str @{thm and_false}),
   17.20 -	      Thm ("or_true",TermC.num_str @{thm or_true}),
   17.21 -	      Thm ("or_false",TermC.num_str @{thm or_false})
   17.22 +  Celem.append_rls "LinEq_prls" Celem.e_rls 
   17.23 +	     [Celem.Calc ("HOL.eq",eval_equal "#equal_"),
   17.24 +	      Celem.Calc ("Tools.matches",eval_matches ""),
   17.25 +	      Celem.Calc ("Tools.lhs"    ,eval_lhs ""),
   17.26 +	      Celem.Calc ("Tools.rhs"    ,eval_rhs ""),
   17.27 +	      Celem.Calc ("Poly.has'_degree'_in",eval_has_degree_in ""),
   17.28 + 	      Celem.Calc ("Poly.is'_polyrat'_in",eval_is_polyrat_in ""),
   17.29 +	      Celem.Calc ("Atools.occurs'_in",eval_occurs_in ""),    
   17.30 +	      Celem.Calc ("Atools.ident",eval_ident "#ident_"),
   17.31 +	      Celem.Thm ("not_true",TermC.num_str @{thm not_true}),
   17.32 +	      Celem.Thm ("not_false",TermC.num_str @{thm not_false}),
   17.33 +	      Celem.Thm ("and_true",TermC.num_str @{thm and_true}),
   17.34 +	      Celem.Thm ("and_false",TermC.num_str @{thm and_false}),
   17.35 +	      Celem.Thm ("or_true",TermC.num_str @{thm or_true}),
   17.36 +	      Celem.Thm ("or_false",TermC.num_str @{thm or_false})
   17.37                ];
   17.38  (* ----- erls ----- *)
   17.39  val LinEq_crls = 
   17.40 -   append_rls "LinEq_crls" poly_crls
   17.41 -   [Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1})
   17.42 +   Celem.append_rls "LinEq_crls" poly_crls
   17.43 +   [Celem.Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1})
   17.44      (*		
   17.45       Don't use
   17.46 -     Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),
   17.47 -     Calc ("Atools.pow" ,eval_binop "#power_"),
   17.48 +     Celem.Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),
   17.49 +     Celem.Calc ("Atools.pow" ,eval_binop "#power_"),
   17.50       *)
   17.51      ];
   17.52  
   17.53  (* ----- crls ----- *)
   17.54  val LinEq_erls = 
   17.55 -   append_rls "LinEq_erls" Poly_erls
   17.56 -   [Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1})
   17.57 +   Celem.append_rls "LinEq_erls" Poly_erls
   17.58 +   [Celem.Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1})
   17.59      (*		
   17.60       Don't use
   17.61 -     Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),
   17.62 -     Calc ("Atools.pow" ,eval_binop "#power_"),
   17.63 +     Celem.Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),
   17.64 +     Celem.Calc ("Atools.pow" ,eval_binop "#power_"),
   17.65       *)
   17.66      ];
   17.67  *}
   17.68 @@ -75,23 +75,23 @@
   17.69  ML {*
   17.70      
   17.71  val LinPoly_simplify = prep_rls'(
   17.72 -  Rls {id = "LinPoly_simplify", preconds = [], 
   17.73 +  Celem.Rls {id = "LinPoly_simplify", preconds = [], 
   17.74         rew_ord = ("termlessI",termlessI), 
   17.75         erls = LinEq_erls, 
   17.76 -       srls = Erls, 
   17.77 +       srls = Celem.Erls, 
   17.78         calc = [], errpatts = [],
   17.79         rules = [
   17.80 -		Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1}),
   17.81 -		Calc ("Groups.plus_class.plus",eval_binop "#add_"),
   17.82 -		Calc ("Groups.minus_class.minus",eval_binop "#sub_"),
   17.83 -		Calc ("Groups.times_class.times",eval_binop "#mult_"),
   17.84 +		Celem.Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1}),
   17.85 +		Celem.Calc ("Groups.plus_class.plus",eval_binop "#add_"),
   17.86 +		Celem.Calc ("Groups.minus_class.minus",eval_binop "#sub_"),
   17.87 +		Celem.Calc ("Groups.times_class.times",eval_binop "#mult_"),
   17.88  		(*  Dont use  
   17.89 -		 Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),		
   17.90 -		 Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"),
   17.91 +		 Celem.Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),		
   17.92 +		 Celem.Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"),
   17.93  		 *)
   17.94 -		Calc ("Atools.pow" ,eval_binop "#power_")
   17.95 +		Celem.Calc ("Atools.pow" ,eval_binop "#power_")
   17.96  		],
   17.97 -       scr = EmptyScr}:rls);
   17.98 +       scr = Celem.EmptyScr});
   17.99  *}
  17.100  setup {* KEStore_Elems.add_rlss 
  17.101    [("LinPoly_simplify", (Context.theory_name @{theory}, LinPoly_simplify))] *}
  17.102 @@ -99,20 +99,20 @@
  17.103  
  17.104  (*isolate the bound variable in an linear equation; 'bdv' is a meta-constant*)
  17.105  val LinEq_simplify = prep_rls'(
  17.106 -Rls {id = "LinEq_simplify", preconds = [],
  17.107 -     rew_ord = ("e_rew_ord",e_rew_ord),
  17.108 +Celem.Rls {id = "LinEq_simplify", preconds = [],
  17.109 +     rew_ord = ("xxxe_rew_ordxxx", Celem.e_rew_ord),
  17.110       erls = LinEq_erls,
  17.111 -     srls = Erls,
  17.112 +     srls = Celem.Erls,
  17.113       calc = [], errpatts = [],
  17.114       rules = [
  17.115 -	      Thm("lin_isolate_add1",TermC.num_str @{thm lin_isolate_add1}), 
  17.116 +	      Celem.Thm("lin_isolate_add1",TermC.num_str @{thm lin_isolate_add1}), 
  17.117  	      (* a+bx=0 -> bx=-a *)
  17.118 -	      Thm("lin_isolate_add2",TermC.num_str @{thm lin_isolate_add2}), 
  17.119 +	      Celem.Thm("lin_isolate_add2",TermC.num_str @{thm lin_isolate_add2}), 
  17.120  	      (* a+ x=0 ->  x=-a *)
  17.121 -	      Thm("lin_isolate_div",TermC.num_str @{thm lin_isolate_div})    
  17.122 +	      Celem.Thm("lin_isolate_div",TermC.num_str @{thm lin_isolate_div})    
  17.123  	      (*   bx=c -> x=c/b *)  
  17.124  	      ],
  17.125 -     scr = EmptyScr}:rls);
  17.126 +     scr = Celem.EmptyScr});
  17.127  *}
  17.128  setup {* KEStore_Elems.add_rlss 
  17.129    [("LinEq_simplify", (Context.theory_name @{theory}, LinEq_simplify))] *}
  17.130 @@ -120,7 +120,7 @@
  17.131  (*----------------------------- problem types --------------------------------*)
  17.132  (* ---------linear----------- *)
  17.133  setup {* KEStore_Elems.add_pbts
  17.134 -  [(Specify.prep_pbt thy "pbl_equ_univ_lin" [] e_pblID
  17.135 +  [(Specify.prep_pbt thy "pbl_equ_univ_lin" [] Celem.e_pblID
  17.136        (["LINEAR", "univariate", "equation"],
  17.137          [("#Given" ,["equality e_e", "solveFor v_v"]),
  17.138            ("#Where" ,["HOL.False", (*WN0509 just detected: this pbl can never be used?!?*)
  17.139 @@ -133,18 +133,18 @@
  17.140  
  17.141  (*-------------- methods------------------------------------------------------*)
  17.142  setup {* KEStore_Elems.add_mets
  17.143 -  [Specify.prep_met thy "met_eqlin" [] e_metID
  17.144 +  [Specify.prep_met thy "met_eqlin" [] Celem.e_metID
  17.145        (["LinEq"], [],
  17.146 -        {rew_ord' = "tless_true",rls' = Atools_erls,calc = [], srls = e_rls, prls = e_rls,
  17.147 +        {rew_ord' = "tless_true",rls' = Atools_erls,calc = [], srls = Celem.e_rls, prls = Celem.e_rls,
  17.148            crls = LinEq_crls, errpats = [], nrls = norm_Poly},
  17.149          "empty_script"),
  17.150      (* ansprechen mit ["LinEq","solve_univar_equation"] *)
  17.151 -    Specify.prep_met thy "met_eq_lin" [] e_metID
  17.152 +    Specify.prep_met thy "met_eq_lin" [] Celem.e_metID
  17.153        (["LinEq","solve_lineq_equation"],
  17.154          [("#Given", ["equality e_e", "solveFor v_v"]),
  17.155            ("#Where", ["Not ((lhs e_e) is_polyrat_in v_v)", "((lhs e_e)  has_degree_in v_v) = 1"]),
  17.156            ("#Find",  ["solutions v_v'i'"])],
  17.157 -        {rew_ord' = "termlessI", rls' = LinEq_erls, srls = e_rls, prls = LinEq_prls, calc = [],
  17.158 +        {rew_ord' = "termlessI", rls' = LinEq_erls, srls = Celem.e_rls, prls = LinEq_prls, calc = [],
  17.159            crls = LinEq_crls, errpats = [], nrls = norm_Poly},
  17.160          "Script Solve_lineq_equation (e_e::bool) (v_v::real) =                 " ^
  17.161            "(let e_e =((Try         (Rewrite      all_left           False)) @@   " ^ 
    18.1 --- a/src/Tools/isac/Knowledge/LogExp.thy	Thu Mar 15 10:17:44 2018 +0100
    18.2 +++ b/src/Tools/isac/Knowledge/LogExp.thy	Thu Mar 15 12:42:04 2018 +0100
    18.3 @@ -29,7 +29,7 @@
    18.4  *}
    18.5  (** problems **)
    18.6  setup {* KEStore_Elems.add_pbts
    18.7 -  [(Specify.prep_pbt thy "pbl_test_equ_univ_log" [] e_pblID
    18.8 +  [(Specify.prep_pbt thy "pbl_test_equ_univ_log" [] Celem.e_pblID
    18.9        (["logarithmic","univariate","equation"],
   18.10          [("#Given",["equality e_e","solveFor v_v"]),
   18.11            ("#Where",["matches ((?a log ?v_v) = ?b) e_e"]),
   18.12 @@ -40,12 +40,12 @@
   18.13  
   18.14  (** methods **)
   18.15  setup {* KEStore_Elems.add_mets
   18.16 -  [Specify.prep_met thy "met_equ_log" [] e_metID
   18.17 +  [Specify.prep_met thy "met_equ_log" [] Celem.e_metID
   18.18        (["Equation","solve_log"],
   18.19          [("#Given" ,["equality e_e","solveFor v_v"]),
   18.20            ("#Where" ,["matches ((?a log ?v_v) = ?b) e_e"]),
   18.21            ("#Find"  ,["solutions v_v'i'"])],
   18.22 -        {rew_ord' = "termlessI", rls' = PolyEq_erls, srls = e_rls, prls = PolyEq_prls, calc = [],
   18.23 +        {rew_ord' = "termlessI", rls' = PolyEq_erls, srls = Celem.e_rls, prls = PolyEq_prls, calc = [],
   18.24            crls = PolyEq_crls, errpats = [], nrls = norm_Rational},
   18.25          "Script Solve_log (e_e::bool) (v_v::real) =     " ^
   18.26          "(let e_e = ((Rewrite equality_power False) @@ " ^
    19.1 --- a/src/Tools/isac/Knowledge/Partial_Fractions.thy	Thu Mar 15 10:17:44 2018 +0100
    19.2 +++ b/src/Tools/isac/Knowledge/Partial_Fractions.thy	Thu Mar 15 12:42:04 2018 +0100
    19.3 @@ -38,11 +38,11 @@
    19.4    in HOLogic.mk_binop "Groups.minus_class.minus" (lhs, rhs) end;
    19.5  
    19.6  fun mk_prod prod [] =
    19.7 -      if prod = e_term then error "mk_prod called with []" else prod
    19.8 +      if prod = Celem.e_term then error "mk_prod called with []" else prod
    19.9    | mk_prod prod (t :: []) =
   19.10 -      if prod = e_term then t else HOLogic.mk_binop "Groups.times_class.times" (prod, t)
   19.11 +      if prod = Celem.e_term then t else HOLogic.mk_binop "Groups.times_class.times" (prod, t)
   19.12    | mk_prod prod (t1 :: t2 :: ts) =
   19.13 -        if prod = e_term 
   19.14 +        if prod = Celem.e_term 
   19.15          then 
   19.16             let val p = HOLogic.mk_binop "Groups.times_class.times" (t1, t2)
   19.17             in mk_prod p ts end 
   19.18 @@ -52,14 +52,14 @@
   19.19  
   19.20  fun factors_from_solution sol = 
   19.21    let val ts = HOLogic.dest_list sol
   19.22 -  in mk_prod e_term (map fac_from_sol ts) end;
   19.23 +  in mk_prod Celem.e_term (map fac_from_sol ts) end;
   19.24  
   19.25  (*("factors_from_solution", ("Partial_Fractions.factors_from_solution", 
   19.26       eval_factors_from_solution ""))*)
   19.27  fun eval_factors_from_solution (thmid:string) _
   19.28       (t as Const ("Partial_Fractions.factors_from_solution", _) $ sol) thy =
   19.29         ((let val prod = factors_from_solution sol
   19.30 -         in SOME (TermC.mk_thmid thmid (term_to_string''' thy prod) "",
   19.31 +         in SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy prod) "",
   19.32                HOLogic.Trueprop $ (TermC.mk_equality (t, prod)))
   19.33           end)
   19.34         handle _ => NONE)
   19.35 @@ -75,7 +75,7 @@
   19.36          then
   19.37            let
   19.38              val tm' = TermC.var2free tm
   19.39 -            in SOME (TermC.mk_thmid thmid (term_to_string''' thy tm') "",
   19.40 +            in SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy tm') "",
   19.41                   HOLogic.Trueprop $ (TermC.mk_equality (t, tm')))
   19.42              end
   19.43          else NONE
   19.44 @@ -125,31 +125,31 @@
   19.45  
   19.46  ML {*
   19.47  val ansatz_rls = prep_rls'(
   19.48 -  Rls {id = "ansatz_rls", preconds = [], rew_ord = ("dummy_ord",dummy_ord), 
   19.49 -	  erls = Erls, srls = Erls, calc = [], errpatts = [],
   19.50 +  Celem.Rls {id = "ansatz_rls", preconds = [], rew_ord = ("dummy_ord",Celem.dummy_ord), 
   19.51 +	  erls = Celem.Erls, srls = Celem.Erls, calc = [], errpatts = [],
   19.52  	  rules = 
   19.53 -	   [Thm ("ansatz_2nd_order",TermC.num_str @{thm ansatz_2nd_order}),
   19.54 -	    Thm ("ansatz_3rd_order",TermC.num_str @{thm ansatz_3rd_order})
   19.55 +	   [Celem.Thm ("ansatz_2nd_order",TermC.num_str @{thm ansatz_2nd_order}),
   19.56 +	    Celem.Thm ("ansatz_3rd_order",TermC.num_str @{thm ansatz_3rd_order})
   19.57  	   ], 
   19.58 -	 scr = EmptyScr}:rls);
   19.59 +	 scr = Celem.EmptyScr});
   19.60  
   19.61  val equival_trans = prep_rls'(
   19.62 -  Rls {id = "equival_trans", preconds = [], rew_ord = ("dummy_ord",dummy_ord), 
   19.63 -	  erls = Erls, srls = Erls, calc = [], errpatts = [],
   19.64 +  Celem.Rls {id = "equival_trans", preconds = [], rew_ord = ("dummy_ord",Celem.dummy_ord), 
   19.65 +	  erls = Celem.Erls, srls = Celem.Erls, calc = [], errpatts = [],
   19.66  	  rules = 
   19.67 -	   [Thm ("equival_trans_2nd_order",TermC.num_str @{thm equival_trans_2nd_order}),
   19.68 -	    Thm ("equival_trans_3rd_order",TermC.num_str @{thm equival_trans_3rd_order})
   19.69 +	   [Celem.Thm ("equival_trans_2nd_order",TermC.num_str @{thm equival_trans_2nd_order}),
   19.70 +	    Celem.Thm ("equival_trans_3rd_order",TermC.num_str @{thm equival_trans_3rd_order})
   19.71  	   ], 
   19.72 -	 scr = EmptyScr}:rls);
   19.73 +	 scr = Celem.EmptyScr});
   19.74  
   19.75  val multiply_ansatz = prep_rls'(
   19.76 -  Rls {id = "multiply_ansatz", preconds = [], rew_ord = ("dummy_ord",dummy_ord), 
   19.77 -	  erls = Erls,
   19.78 -	  srls = Erls, calc = [], errpatts = [],
   19.79 +  Celem.Rls {id = "multiply_ansatz", preconds = [], rew_ord = ("dummy_ord",Celem.dummy_ord), 
   19.80 +	  erls = Celem.Erls,
   19.81 +	  srls = Celem.Erls, calc = [], errpatts = [],
   19.82  	  rules = 
   19.83 -	   [Thm ("multiply_2nd_order",TermC.num_str @{thm multiply_2nd_order})
   19.84 +	   [Celem.Thm ("multiply_2nd_order",TermC.num_str @{thm multiply_2nd_order})
   19.85  	   ], 
   19.86 -	 scr = EmptyScr}:rls);
   19.87 +	 scr = Celem.EmptyScr});
   19.88  *}
   19.89  
   19.90  text {*store the rule set for math engine*}
   19.91 @@ -164,10 +164,10 @@
   19.92    decomposedFunction :: "real => una"
   19.93  
   19.94  ML {*
   19.95 -check_guhs_unique := false; (*WN120307 REMOVE after editing*)
   19.96 +Celem.check_guhs_unique := false; (*WN120307 REMOVE after editing*)
   19.97  *}
   19.98  setup {* KEStore_Elems.add_pbts
   19.99 -  [(Specify.prep_pbt @{theory} "pbl_simp_rat_partfrac" [] e_pblID
  19.100 +  [(Specify.prep_pbt @{theory} "pbl_simp_rat_partfrac" [] Celem.e_pblID
  19.101        (["partial_fraction", "rational", "simplification"],
  19.102          [("#Given" ,["functionTerm t_t", "solveFor v_v"]),
  19.103            (* TODO: call this sub-problem with appropriate functionTerm: 
  19.104 @@ -175,7 +175,7 @@
  19.105              ("#Where" ,["((get_numerator t_t) has_degree_in v_v) < 
  19.106                 ((get_denominator t_t) has_degree_in v_v)"]), TODO*)
  19.107            ("#Find"  ,["decomposedFunction p_p'''"])],
  19.108 -        append_rls "e_rls" e_rls [(*for preds in where_ TODO*)], 
  19.109 +        Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_ TODO*)], 
  19.110          NONE, 
  19.111          [["simplification","of_rationals","to_partial_fraction"]]))] *}
  19.112  
  19.113 @@ -186,28 +186,28 @@
  19.114  
  19.115  text {* rule set for functions called in the Script *}
  19.116  ML {*
  19.117 -  val srls_partial_fraction = Rls {id="srls_partial_fraction", 
  19.118 +  val srls_partial_fraction = Celem.Rls {id="srls_partial_fraction", 
  19.119      preconds = [],
  19.120      rew_ord = ("termlessI",termlessI),
  19.121 -    erls = append_rls "erls_in_srls_partial_fraction" e_rls
  19.122 +    erls = Celem.append_rls "erls_in_srls_partial_fraction" Celem.e_rls
  19.123        [(*for asm in NTH_CONS ...*)
  19.124 -       Calc ("Orderings.ord_class.less",eval_equ "#less_"),
  19.125 +       Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"),
  19.126         (*2nd NTH_CONS pushes n+-1 into asms*)
  19.127 -       Calc("Groups.plus_class.plus", eval_binop "#add_")], 
  19.128 -    srls = Erls, calc = [], errpatts = [],
  19.129 +       Celem.Calc("Groups.plus_class.plus", eval_binop "#add_")], 
  19.130 +    srls = Celem.Erls, calc = [], errpatts = [],
  19.131      rules = [
  19.132 -       Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
  19.133 -       Calc("Groups.plus_class.plus", eval_binop "#add_"),
  19.134 -       Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}),
  19.135 -       Calc("Tools.lhs", eval_lhs "eval_lhs_"),
  19.136 -       Calc("Tools.rhs", eval_rhs"eval_rhs_"),
  19.137 -       Calc("Atools.argument'_in", eval_argument_in "Atools.argument'_in"),
  19.138 -       Calc("Rational.get_denominator", eval_get_denominator "#get_denominator"),
  19.139 -       Calc("Rational.get_numerator", eval_get_numerator "#get_numerator"),
  19.140 -       Calc("Partial_Fractions.factors_from_solution",
  19.141 +       Celem.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
  19.142 +       Celem.Calc("Groups.plus_class.plus", eval_binop "#add_"),
  19.143 +       Celem.Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}),
  19.144 +       Celem.Calc("Tools.lhs", eval_lhs "eval_lhs_"),
  19.145 +       Celem.Calc("Tools.rhs", eval_rhs"eval_rhs_"),
  19.146 +       Celem.Calc("Atools.argument'_in", eval_argument_in "Atools.argument'_in"),
  19.147 +       Celem.Calc("Rational.get_denominator", eval_get_denominator "#get_denominator"),
  19.148 +       Celem.Calc("Rational.get_numerator", eval_get_numerator "#get_numerator"),
  19.149 +       Celem.Calc("Partial_Fractions.factors_from_solution",
  19.150           eval_factors_from_solution "#factors_from_solution"),
  19.151 -       Calc("Partial_Fractions.drop_questionmarks", eval_drop_questionmarks "#drop_?")],
  19.152 -    scr = EmptyScr};
  19.153 +       Celem.Calc("Partial_Fractions.drop_questionmarks", eval_drop_questionmarks "#drop_?")],
  19.154 +    scr = Celem.EmptyScr};
  19.155  *}
  19.156  ML {*
  19.157  eval_drop_questionmarks;
  19.158 @@ -223,15 +223,15 @@
  19.159  
  19.160  (* current version, error outcommented *)
  19.161  setup {* KEStore_Elems.add_mets
  19.162 -  [Specify.prep_met @{theory} "met_partial_fraction" [] e_metID
  19.163 +  [Specify.prep_met @{theory} "met_partial_fraction" [] Celem.e_metID
  19.164        (["simplification","of_rationals","to_partial_fraction"], 
  19.165          [("#Given" ,["functionTerm t_t", "solveFor v_v"]),
  19.166            (*("#Where" ,["((get_numerator t_t) has_degree_in v_v) < 
  19.167              ((get_denominator t_t) has_degree_in v_v)"]), TODO*)
  19.168            ("#Find"  ,["decomposedFunction p_p'''"])],
  19.169          (*f_f = 3 / (z * (z - 1 / 4 + -1 / 8 * (1 / z)), zzz: z*)
  19.170 -        {rew_ord'="tless_true", rls'= e_rls, calc = [], srls = srls_partial_fraction, prls = e_rls,
  19.171 -          crls = e_rls, errpats = [], nrls = e_rls},
  19.172 +        {rew_ord'="tless_true", rls'= Celem.e_rls, calc = [], srls = srls_partial_fraction, prls = Celem.e_rls,
  19.173 +          crls = Celem.e_rls, errpats = [], nrls = Celem.e_rls},
  19.174          (*([], Frm), Problem (Partial_Fractions, [partial_fraction, rational, simplification])*)
  19.175          "Script PartFracScript (f_f::real) (zzz::real) =   " ^
  19.176            (*([1], Frm), 3 / (z * (z - 1 / 4 + -1 / 8 * (1 / z)))*)
    20.1 --- a/src/Tools/isac/Knowledge/Poly.thy	Thu Mar 15 10:17:44 2018 +0100
    20.2 +++ b/src/Tools/isac/Knowledge/Poly.thy	Thu Mar 15 12:42:04 2018 +0100
    20.3 @@ -186,9 +186,9 @@
    20.4      
    20.5  fun eval_is_polyrat_in _ _(p as (Const ("Poly.is'_polyrat'_in",_) $ t $ v)) _  =
    20.6      if is_polyrat_in t v 
    20.7 -    then SOME ((term2str p) ^ " = True",
    20.8 +    then SOME ((Celem.term2str p) ^ " = True",
    20.9  	        HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
   20.10 -    else SOME ((term2str p) ^ " = True",
   20.11 +    else SOME ((Celem.term2str p) ^ " = True",
   20.12  	        HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
   20.13    | eval_is_polyrat_in _ _ _ _ = ((*tracing"### no matches";*) NONE);
   20.14  
   20.15 @@ -341,16 +341,16 @@
   20.16  fun eval_is_expanded_in _ _ 
   20.17         (p as (Const ("Poly.is'_expanded'_in",_) $ t $ v)) _ =
   20.18      if is_expanded_in t v
   20.19 -    then SOME ((term2str p) ^ " = True",
   20.20 +    then SOME ((Celem.term2str p) ^ " = True",
   20.21  	        HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
   20.22 -    else SOME ((term2str p) ^ " = True",
   20.23 +    else SOME ((Celem.term2str p) ^ " = True",
   20.24  	        HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
   20.25    | eval_is_expanded_in _ _ _ _ = NONE;
   20.26  (*
   20.27   val t = (Thm.term_of o the o (parse thy)) "(-8 - 2*x + x^^^2) is_expanded_in x";
   20.28   val SOME (id, t') = eval_is_expanded_in 0 0 t 0;
   20.29   (*val id = "Poly.is'_expanded'_in (-8 - 2 * x + x ^^^ 2) x = True"*)
   20.30 - term2str t';
   20.31 + Celem.term2str t';
   20.32   (*val it = "Poly.is'_expanded'_in (-8 - 2 * x + x ^^^ 2) x = True"*)
   20.33  *)
   20.34  
   20.35 @@ -358,16 +358,16 @@
   20.36  fun eval_is_poly_in _ _ 
   20.37         (p as (Const ("Poly.is'_poly'_in",_) $ t $ v)) _ =
   20.38      if is_poly_in t v
   20.39 -    then SOME ((term2str p) ^ " = True",
   20.40 +    then SOME ((Celem.term2str p) ^ " = True",
   20.41  	        HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
   20.42 -    else SOME ((term2str p) ^ " = True",
   20.43 +    else SOME ((Celem.term2str p) ^ " = True",
   20.44  	        HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
   20.45    | eval_is_poly_in _ _ _ _ = NONE;
   20.46  (*
   20.47   val t = (Thm.term_of o the o (parse thy)) "(8 + 2*x + x^^^2) is_poly_in x";
   20.48   val SOME (id, t') = eval_is_poly_in 0 0 t 0;
   20.49   (*val id = "Poly.is'_poly'_in (8 + 2 * x + x ^^^ 2) x = True"*)
   20.50 - term2str t';
   20.51 + Celem.term2str t';
   20.52   (*val it = "Poly.is'_poly'_in (8 + 2 * x + x ^^^ 2) x = True"*)
   20.53  *)
   20.54  
   20.55 @@ -376,7 +376,7 @@
   20.56  	     (p as (Const ("Poly.has'_degree'_in",_) $ t $ v)) _ =
   20.57      let val d = has_degree_in t v
   20.58  	val d' = TermC.term_of_num HOLogic.realT d
   20.59 -    in SOME ((term2str p) ^ " = " ^ (string_of_int d),
   20.60 +    in SOME ((Celem.term2str p) ^ " = " ^ (string_of_int d),
   20.61  	      HOLogic.Trueprop $ (TermC.mk_equality (p, d')))
   20.62      end
   20.63    | eval_has_degree_in _ _ _ _ = NONE;
   20.64 @@ -384,31 +384,31 @@
   20.65  > val t = (Thm.term_of o the o (parse thy)) "(-8 - 2*x + x^^^2) has_degree_in x";
   20.66  > val SOME (id, t') = eval_has_degree_in 0 0 t 0;
   20.67  val id = "Poly.has'_degree'_in (-8 - 2 * x + x ^^^ 2) x = 2" : string
   20.68 -> term2str t';
   20.69 +> Celem.term2str t';
   20.70  val it = "Poly.has'_degree'_in (-8 - 2 * x + x ^^^ 2) x = 2" : string
   20.71  *)
   20.72  
   20.73  (*..*)
   20.74  val calculate_Poly =
   20.75 -    append_rls "calculate_PolyFIXXXME.not.impl." e_rls
   20.76 +    Celem.append_rls "calculate_PolyFIXXXME.not.impl." Celem.e_rls
   20.77  	       [];
   20.78  
   20.79  (*.for evaluation of conditions in rewrite rules.*)
   20.80 -val Poly_erls = append_rls "Poly_erls" Atools_erls
   20.81 -  [Calc ("HOL.eq", eval_equal "#equal_"),
   20.82 -  Thm  ("real_unari_minus", TermC.num_str @{thm real_unari_minus}),
   20.83 -  Calc ("Groups.plus_class.plus", eval_binop "#add_"),
   20.84 -  Calc ("Groups.minus_class.minus", eval_binop "#sub_"),
   20.85 -  Calc ("Groups.times_class.times", eval_binop "#mult_"),
   20.86 -  Calc ("Atools.pow", eval_binop "#power_")];
   20.87 +val Poly_erls = Celem.append_rls "Poly_erls" Atools_erls
   20.88 +  [Celem.Calc ("HOL.eq", eval_equal "#equal_"),
   20.89 +  Celem.Thm  ("real_unari_minus", TermC.num_str @{thm real_unari_minus}),
   20.90 +  Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"),
   20.91 +  Celem.Calc ("Groups.minus_class.minus", eval_binop "#sub_"),
   20.92 +  Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
   20.93 +  Celem.Calc ("Atools.pow", eval_binop "#power_")];
   20.94  
   20.95 -val poly_crls = append_rls "poly_crls" Atools_crls
   20.96 -  [Calc ("HOL.eq", eval_equal "#equal_"),
   20.97 -  Thm ("real_unari_minus", TermC.num_str @{thm real_unari_minus}),
   20.98 -  Calc ("Groups.plus_class.plus", eval_binop "#add_"),
   20.99 -  Calc ("Groups.minus_class.minus", eval_binop "#sub_"),
  20.100 -  Calc ("Groups.times_class.times", eval_binop "#mult_"),
  20.101 -  Calc ("Atools.pow" ,eval_binop "#power_")];
  20.102 +val poly_crls = Celem.append_rls "poly_crls" Atools_crls
  20.103 +  [Celem.Calc ("HOL.eq", eval_equal "#equal_"),
  20.104 +  Celem.Thm ("real_unari_minus", TermC.num_str @{thm real_unari_minus}),
  20.105 +  Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  20.106 +  Celem.Calc ("Groups.minus_class.minus", eval_binop "#sub_"),
  20.107 +  Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
  20.108 +  Celem.Calc ("Atools.pow" ,eval_binop "#power_")];
  20.109  
  20.110  local (*. for make_polynomial .*)
  20.111  
  20.112 @@ -445,10 +445,10 @@
  20.113      (if pr then 
  20.114  	   let
  20.115         val (f, ts) = strip_comb t and (g, us) = strip_comb u;
  20.116 -       val _ = tracing ("t= f@ts= \"" ^ term_to_string''' thy f ^ "\" @ \"[" ^
  20.117 -         commas (map (term_to_string''' thy) ts) ^ "]\"");
  20.118 -       val _ = tracing("u= g@us= \"" ^ term_to_string''' thy g ^ "\" @ \"[" ^
  20.119 -         commas (map (term_to_string''' thy) us) ^ "]\"");
  20.120 +       val _ = tracing ("t= f@ts= \"" ^ Celem.term_to_string''' thy f ^ "\" @ \"[" ^
  20.121 +         commas (map (Celem.term_to_string''' thy) ts) ^ "]\"");
  20.122 +       val _ = tracing("u= g@us= \"" ^ Celem.term_to_string''' thy g ^ "\" @ \"[" ^
  20.123 +         commas (map (Celem.term_to_string''' thy) us) ^ "]\"");
  20.124         val _ = tracing ("size_of_term(t,u)= (" ^ string_of_int (size_of_term' t) ^ ", " ^
  20.125           string_of_int (size_of_term' u) ^ ")");
  20.126         val _ = tracing ("hd_ord(f,g)      = " ^ (pr_ord o hd_ord) (f,g));
  20.127 @@ -466,78 +466,78 @@
  20.128  and hd_ord (f, g) =                                        (* ~ term.ML *)
  20.129    prod_ord (prod_ord Term_Ord.indexname_ord Term_Ord.typ_ord) int_ord (dest_hd' f, dest_hd' g)
  20.130  and terms_ord str pr (ts, us) = 
  20.131 -    list_ord (term_ord' pr (assoc_thy "Isac"))(ts, us);
  20.132 +    list_ord (term_ord' pr (Celem.assoc_thy "Isac"))(ts, us);
  20.133  
  20.134  in
  20.135  
  20.136 -fun ord_make_polynomial (pr:bool) thy (_:subst) tu = 
  20.137 +fun ord_make_polynomial (pr:bool) thy (_: Celem.subst) tu = 
  20.138      (term_ord' pr thy(***) tu = LESS );
  20.139  
  20.140  end;(*local*)
  20.141  
  20.142  
  20.143 -rew_ord' := overwritel (!rew_ord',
  20.144 +Celem.rew_ord' := overwritel (! Celem.rew_ord',
  20.145  [("termlessI", termlessI),
  20.146   ("ord_make_polynomial", ord_make_polynomial false thy)
  20.147   ]);
  20.148  
  20.149  
  20.150  val expand =
  20.151 -  Rls{id = "expand", preconds = [], rew_ord = ("dummy_ord", dummy_ord),
  20.152 -      erls = e_rls,srls = Erls, calc = [], errpatts = [],
  20.153 -      rules = [Thm ("distrib_right" , TermC.num_str @{thm distrib_right}),
  20.154 +  Celem.Rls {id = "expand", preconds = [], rew_ord = ("dummy_ord", Celem.dummy_ord),
  20.155 +      erls = Celem.e_rls,srls = Celem.Erls, calc = [], errpatts = [],
  20.156 +      rules = [Celem.Thm ("distrib_right" , TermC.num_str @{thm distrib_right}),
  20.157  	       (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  20.158 -	       Thm ("distrib_left", TermC.num_str @{thm distrib_left})
  20.159 +	       Celem.Thm ("distrib_left", TermC.num_str @{thm distrib_left})
  20.160  	       (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  20.161 -	       ], scr = EmptyScr}:rls;
  20.162 +	       ], scr = Celem.EmptyScr};
  20.163  
  20.164  (*----------------- Begin: rulesets for make_polynomial_ -----------------
  20.165    'rlsIDs' redefined by MG as 'rlsIDs_' 
  20.166                                      ^^^*)
  20.167  
  20.168  val discard_minus =
  20.169 -  Rls {id = "discard_minus", preconds = [], rew_ord = ("dummy_ord", dummy_ord),
  20.170 -      erls = e_rls, srls = Erls, calc = [], errpatts = [],
  20.171 +  Celem.Rls {id = "discard_minus", preconds = [], rew_ord = ("dummy_ord", Celem.dummy_ord),
  20.172 +      erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [],
  20.173        rules =
  20.174 -       [Thm ("real_diff_minus", TermC.num_str @{thm real_diff_minus}),
  20.175 +       [Celem.Thm ("real_diff_minus", TermC.num_str @{thm real_diff_minus}),
  20.176            (*"a - b = a + -1 * b"*)
  20.177 -	        Thm ("sym_real_mult_minus1", TermC.num_str (@{thm real_mult_minus1} RS @{thm sym}))
  20.178 +	        Celem.Thm ("sym_real_mult_minus1", TermC.num_str (@{thm real_mult_minus1} RS @{thm sym}))
  20.179  	          (*- ?z = "-1 * ?z"*)],
  20.180 -	      scr = EmptyScr}:rls;
  20.181 +	      scr = Celem.EmptyScr};
  20.182  
  20.183  val expand_poly_ = 
  20.184 -  Rls{id = "expand_poly_", preconds = [], 
  20.185 -      rew_ord = ("dummy_ord", dummy_ord),
  20.186 -      erls = e_rls,srls = Erls,
  20.187 +  Celem.Rls{id = "expand_poly_", preconds = [], 
  20.188 +      rew_ord = ("dummy_ord", Celem.dummy_ord),
  20.189 +      erls = Celem.e_rls,srls = Celem.Erls,
  20.190        calc = [], errpatts = [],
  20.191        rules =
  20.192 -        [Thm ("real_plus_binom_pow4", TermC.num_str @{thm real_plus_binom_pow4}),
  20.193 +        [Celem.Thm ("real_plus_binom_pow4", TermC.num_str @{thm real_plus_binom_pow4}),
  20.194  	           (*"(a + b)^^^4 = ... "*)
  20.195 -	         Thm ("real_plus_binom_pow5",TermC.num_str @{thm real_plus_binom_pow5}),
  20.196 +	         Celem.Thm ("real_plus_binom_pow5",TermC.num_str @{thm real_plus_binom_pow5}),
  20.197  	           (*"(a + b)^^^5 = ... "*)
  20.198 -	         Thm ("real_plus_binom_pow3",TermC.num_str @{thm real_plus_binom_pow3}),
  20.199 +	         Celem.Thm ("real_plus_binom_pow3",TermC.num_str @{thm real_plus_binom_pow3}),
  20.200  	           (*"(a + b)^^^3 = a^^^3 + 3*a^^^2*b + 3*a*b^^^2 + b^^^3" *)
  20.201  	         (*WN071229 changed/removed for Schaerding -----vvv*)
  20.202 -	         (*Thm ("real_plus_binom_pow2",TermC.num_str @{thm real_plus_binom_pow2}),*)
  20.203 +	         (*Celem.Thm ("real_plus_binom_pow2",TermC.num_str @{thm real_plus_binom_pow2}),*)
  20.204  	           (*"(a + b)^^^2 = a^^^2 + 2*a*b + b^^^2"*)
  20.205 -	         Thm ("real_plus_binom_pow2",TermC.num_str @{thm real_plus_binom_pow2}),
  20.206 +	         Celem.Thm ("real_plus_binom_pow2",TermC.num_str @{thm real_plus_binom_pow2}),
  20.207  	           (*"(a + b)^^^2 = (a + b) * (a + b)"*)
  20.208 -	         (*Thm ("real_plus_minus_binom1_p_p", TermC.num_str @{thm real_plus_minus_binom1_p_p}),*)
  20.209 +	         (*Celem.Thm ("real_plus_minus_binom1_p_p", TermC.num_str @{thm real_plus_minus_binom1_p_p}),*)
  20.210  	           (*"(a + b)*(a + -1 * b) = a^^^2 + -1*b^^^2"*)
  20.211 -	         (*Thm ("real_plus_minus_binom2_p_p", TermC.num_str @{thm real_plus_minus_binom2_p_p}),*)
  20.212 +	         (*Celem.Thm ("real_plus_minus_binom2_p_p", TermC.num_str @{thm real_plus_minus_binom2_p_p}),*)
  20.213  	           (*"(a + -1 * b)*(a + b) = a^^^2 + -1*b^^^2"*)
  20.214  	         (*WN071229 changed/removed for Schaerding -----^^^*)
  20.215  	      
  20.216 -	         Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),
  20.217 +	         Celem.Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),
  20.218  	           (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  20.219 -	         Thm ("distrib_left",TermC.num_str @{thm distrib_left}),
  20.220 +	         Celem.Thm ("distrib_left",TermC.num_str @{thm distrib_left}),
  20.221  	           (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  20.222  	       
  20.223 -	         Thm ("realpow_multI", TermC.num_str @{thm realpow_multI}),
  20.224 +	         Celem.Thm ("realpow_multI", TermC.num_str @{thm realpow_multI}),
  20.225  	           (*"(r * s) ^^^ n = r ^^^ n * s ^^^ n"*)
  20.226 -	         Thm ("realpow_pow",TermC.num_str @{thm realpow_pow})
  20.227 +	         Celem.Thm ("realpow_pow",TermC.num_str @{thm realpow_pow})
  20.228  	           (*"(a ^^^ b) ^^^ c = a ^^^ (b * c)"*)
  20.229 -	       ], scr = EmptyScr}:rls;
  20.230 +	       ], scr = Celem.EmptyScr};
  20.231  
  20.232  (*.the expression contains + - * ^ only ?
  20.233     this is weaker than 'is_polynomial' !.*)
  20.234 @@ -560,169 +560,169 @@
  20.235  fun eval_is_polyexp (thmid:string) _ 
  20.236  		       (t as (Const("Poly.is'_polyexp", _) $ arg)) thy = 
  20.237      if is_polyexp arg
  20.238 -    then SOME (TermC.mk_thmid thmid (term_to_string''' thy arg) "", 
  20.239 +    then SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg) "", 
  20.240  	         HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True})))
  20.241 -    else SOME (TermC.mk_thmid thmid (term_to_string''' thy arg) "", 
  20.242 +    else SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg) "", 
  20.243  	         HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False})))
  20.244    | eval_is_polyexp _ _ _ _ = NONE; 
  20.245  
  20.246  val expand_poly_rat_ = 
  20.247 -  Rls{id = "expand_poly_rat_", preconds = [], 
  20.248 -      rew_ord = ("dummy_ord", dummy_ord),
  20.249 -      erls =  append_rls "e_rls-is_polyexp" e_rls
  20.250 -	        [Calc ("Poly.is'_polyexp", eval_is_polyexp "")
  20.251 +  Celem.Rls{id = "expand_poly_rat_", preconds = [], 
  20.252 +      rew_ord = ("dummy_ord", Celem.dummy_ord),
  20.253 +      erls =  Celem.append_rls "Celem.e_rls-is_polyexp" Celem.e_rls
  20.254 +	        [Celem.Calc ("Poly.is'_polyexp", eval_is_polyexp "")
  20.255  		 ],
  20.256 -      srls = Erls,
  20.257 +      srls = Celem.Erls,
  20.258        calc = [], errpatts = [],
  20.259        rules = 
  20.260 -        [Thm ("real_plus_binom_pow4_poly", TermC.num_str @{thm real_plus_binom_pow4_poly}),
  20.261 +        [Celem.Thm ("real_plus_binom_pow4_poly", TermC.num_str @{thm real_plus_binom_pow4_poly}),
  20.262  	     (*"[| a is_polyexp; b is_polyexp |] ==> (a + b)^^^4 = ... "*)
  20.263 -	 Thm ("real_plus_binom_pow5_poly", TermC.num_str @{thm real_plus_binom_pow5_poly}),
  20.264 +	 Celem.Thm ("real_plus_binom_pow5_poly", TermC.num_str @{thm real_plus_binom_pow5_poly}),
  20.265  	     (*"[| a is_polyexp; b is_polyexp |] ==> (a + b)^^^5 = ... "*)
  20.266 -	 Thm ("real_plus_binom_pow2_poly",TermC.num_str @{thm real_plus_binom_pow2_poly}),
  20.267 +	 Celem.Thm ("real_plus_binom_pow2_poly",TermC.num_str @{thm real_plus_binom_pow2_poly}),
  20.268  	     (*"[| a is_polyexp; b is_polyexp |] ==>
  20.269  		            (a + b)^^^2 = a^^^2 + 2*a*b + b^^^2"*)
  20.270 -	 Thm ("real_plus_binom_pow3_poly",TermC.num_str @{thm real_plus_binom_pow3_poly}),
  20.271 +	 Celem.Thm ("real_plus_binom_pow3_poly",TermC.num_str @{thm real_plus_binom_pow3_poly}),
  20.272  	     (*"[| a is_polyexp; b is_polyexp |] ==> 
  20.273  			(a + b)^^^3 = a^^^3 + 3*a^^^2*b + 3*a*b^^^2 + b^^^3" *)
  20.274 -	 Thm ("real_plus_minus_binom1_p_p",TermC.num_str @{thm real_plus_minus_binom1_p_p}),
  20.275 +	 Celem.Thm ("real_plus_minus_binom1_p_p",TermC.num_str @{thm real_plus_minus_binom1_p_p}),
  20.276  	     (*"(a + b)*(a + -1 * b) = a^^^2 + -1*b^^^2"*)
  20.277 -	 Thm ("real_plus_minus_binom2_p_p",TermC.num_str @{thm real_plus_minus_binom2_p_p}),
  20.278 +	 Celem.Thm ("real_plus_minus_binom2_p_p",TermC.num_str @{thm real_plus_minus_binom2_p_p}),
  20.279  	     (*"(a + -1 * b)*(a + b) = a^^^2 + -1*b^^^2"*)
  20.280  	      
  20.281 -	 Thm ("real_add_mult_distrib_poly",
  20.282 +	 Celem.Thm ("real_add_mult_distrib_poly",
  20.283                 TermC.num_str @{thm real_add_mult_distrib_poly}),
  20.284  	       (*"w is_polyexp ==> (z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  20.285 -	 Thm("real_add_mult_distrib2_poly",
  20.286 +	 Celem.Thm("real_add_mult_distrib2_poly",
  20.287                TermC.num_str @{thm real_add_mult_distrib2_poly}),
  20.288  	     (*"w is_polyexp ==> w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  20.289  	       
  20.290 -	 Thm ("realpow_multI_poly", TermC.num_str @{thm realpow_multI_poly}),
  20.291 +	 Celem.Thm ("realpow_multI_poly", TermC.num_str @{thm realpow_multI_poly}),
  20.292  	     (*"[| r is_polyexp; s is_polyexp |] ==> 
  20.293  		            (r * s) ^^^ n = r ^^^ n * s ^^^ n"*)
  20.294 -	  Thm ("realpow_pow",TermC.num_str @{thm realpow_pow})
  20.295 +	  Celem.Thm ("realpow_pow",TermC.num_str @{thm realpow_pow})
  20.296  	      (*"(a ^^^ b) ^^^ c = a ^^^ (b * c)"*)
  20.297 -	 ], scr = EmptyScr}:rls;
  20.298 +	 ], scr = Celem.EmptyScr};
  20.299  
  20.300  val simplify_power_ = 
  20.301 -  Rls{id = "simplify_power_", preconds = [], 
  20.302 -      rew_ord = ("dummy_ord", dummy_ord),
  20.303 -      erls = e_rls, srls = Erls,
  20.304 +  Celem.Rls{id = "simplify_power_", preconds = [], 
  20.305 +      rew_ord = ("dummy_ord", Celem.dummy_ord),
  20.306 +      erls = Celem.e_rls, srls = Celem.Erls,
  20.307        calc = [], errpatts = [],
  20.308 -      rules = [(*MG: Reihenfolge der folgenden 2 Thm muss so bleiben, wegen
  20.309 +      rules = [(*MG: Reihenfolge der folgenden 2 Celem.Thm muss so bleiben, wegen
  20.310  		a*(a*a) --> a*a^^^2 und nicht a*(a*a) --> a^^^2*a *)
  20.311 -	       Thm ("sym_realpow_twoI",
  20.312 +	       Celem.Thm ("sym_realpow_twoI",
  20.313                       TermC.num_str (@{thm realpow_twoI} RS @{thm sym})),	
  20.314  	       (*"r * r = r ^^^ 2"*)
  20.315 -	       Thm ("realpow_twoI_assoc_l",TermC.num_str @{thm realpow_twoI_assoc_l}),
  20.316 +	       Celem.Thm ("realpow_twoI_assoc_l",TermC.num_str @{thm realpow_twoI_assoc_l}),
  20.317  	       (*"r * (r * s) = r ^^^ 2 * s"*)
  20.318  
  20.319 -	       Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),		
  20.320 +	       Celem.Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),		
  20.321  	       (*"r * r ^^^ n = r ^^^ (n + 1)"*)
  20.322 -	       Thm ("realpow_plus_1_assoc_l",
  20.323 +	       Celem.Thm ("realpow_plus_1_assoc_l",
  20.324                       TermC.num_str @{thm realpow_plus_1_assoc_l}),
  20.325  	       (*"r * (r ^^^ m * s) = r ^^^ (1 + m) * s"*)
  20.326 -	       (*MG 9.7.03: neues Thm wegen a*(a*(a*b)) --> a^^^2*(a*b) *)
  20.327 -	       Thm ("realpow_plus_1_assoc_l2",
  20.328 +	       (*MG 9.7.03: neues Celem.Thm wegen a*(a*(a*b)) --> a^^^2*(a*b) *)
  20.329 +	       Celem.Thm ("realpow_plus_1_assoc_l2",
  20.330                       TermC.num_str @{thm realpow_plus_1_assoc_l2}),
  20.331  	       (*"r ^^^ m * (r * s) = r ^^^ (1 + m) * s"*)
  20.332  
  20.333 -	       Thm ("sym_realpow_addI",
  20.334 +	       Celem.Thm ("sym_realpow_addI",
  20.335                 TermC.num_str (@{thm realpow_addI} RS @{thm sym})),
  20.336  	       (*"r ^^^ n * r ^^^ m = r ^^^ (n + m)"*)
  20.337 -	       Thm ("realpow_addI_assoc_l",TermC.num_str @{thm realpow_addI_assoc_l}),
  20.338 +	       Celem.Thm ("realpow_addI_assoc_l",TermC.num_str @{thm realpow_addI_assoc_l}),
  20.339  	       (*"r ^^^ n * (r ^^^ m * s) = r ^^^ (n + m) * s"*)
  20.340  	       
  20.341  	       (* ist in expand_poly - wird hier aber auch gebraucht, wegen: 
  20.342  		  "r * r = r ^^^ 2" wenn r=a^^^b*)
  20.343 -	       Thm ("realpow_pow",TermC.num_str @{thm realpow_pow})
  20.344 +	       Celem.Thm ("realpow_pow",TermC.num_str @{thm realpow_pow})
  20.345  	       (*"(a ^^^ b) ^^^ c = a ^^^ (b * c)"*)
  20.346 -	       ], scr = EmptyScr}:rls;
  20.347 +	       ], scr = Celem.EmptyScr};
  20.348  
  20.349  val calc_add_mult_pow_ = 
  20.350 -  Rls{id = "calc_add_mult_pow_", preconds = [], 
  20.351 -      rew_ord = ("dummy_ord", dummy_ord),
  20.352 -      erls = Atools_erls(*erls3.4.03*),srls = Erls,
  20.353 +  Celem.Rls{id = "calc_add_mult_pow_", preconds = [], 
  20.354 +      rew_ord = ("dummy_ord", Celem.dummy_ord),
  20.355 +      erls = Atools_erls(*erls3.4.03*),srls = Celem.Erls,
  20.356        calc = [("PLUS"  , ("Groups.plus_class.plus", eval_binop "#add_")), 
  20.357  	      ("TIMES" , ("Groups.times_class.times", eval_binop "#mult_")),
  20.358  	      ("POWER", ("Atools.pow", eval_binop "#power_"))
  20.359  	      ],
  20.360        errpatts = [],
  20.361 -      rules = [Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  20.362 -	       Calc ("Groups.times_class.times", eval_binop "#mult_"),
  20.363 -	       Calc ("Atools.pow", eval_binop "#power_")
  20.364 -	       ], scr = EmptyScr}:rls;
  20.365 +      rules = [Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  20.366 +	       Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
  20.367 +	       Celem.Calc ("Atools.pow", eval_binop "#power_")
  20.368 +	       ], scr = Celem.EmptyScr};
  20.369  
  20.370  val reduce_012_mult_ = 
  20.371 -  Rls{id = "reduce_012_mult_", preconds = [], 
  20.372 -      rew_ord = ("dummy_ord", dummy_ord),
  20.373 -      erls = e_rls,srls = Erls,
  20.374 +  Celem.Rls{id = "reduce_012_mult_", preconds = [], 
  20.375 +      rew_ord = ("dummy_ord", Celem.dummy_ord),
  20.376 +      erls = Celem.e_rls,srls = Celem.Erls,
  20.377        calc = [], errpatts = [],
  20.378 -      rules = [(* MG: folgende Thm müssen hier stehen bleiben: *)
  20.379 -               Thm ("mult_1_right",TermC.num_str @{thm mult_1_right}),
  20.380 +      rules = [(* MG: folgende Celem.Thm müssen hier stehen bleiben: *)
  20.381 +               Celem.Thm ("mult_1_right",TermC.num_str @{thm mult_1_right}),
  20.382  	       (*"z * 1 = z"*) (*wegen "a * b * b^^^(-1) + a"*) 
  20.383 -	       Thm ("realpow_zeroI",TermC.num_str @{thm realpow_zeroI}),
  20.384 +	       Celem.Thm ("realpow_zeroI",TermC.num_str @{thm realpow_zeroI}),
  20.385  	       (*"r ^^^ 0 = 1"*) (*wegen "a*a^^^(-1)*c + b + c"*)
  20.386 -	       Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}),
  20.387 +	       Celem.Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}),
  20.388  	       (*"r ^^^ 1 = r"*)
  20.389 -	       Thm ("realpow_eq_oneI",TermC.num_str @{thm realpow_eq_oneI})
  20.390 +	       Celem.Thm ("realpow_eq_oneI",TermC.num_str @{thm realpow_eq_oneI})
  20.391  	       (*"1 ^^^ n = 1"*)
  20.392 -	       ], scr = EmptyScr}:rls;
  20.393 +	       ], scr = Celem.EmptyScr};
  20.394  
  20.395  val collect_numerals_ = 
  20.396 -  Rls{id = "collect_numerals_", preconds = [], 
  20.397 -      rew_ord = ("dummy_ord", dummy_ord),
  20.398 -      erls = Atools_erls, srls = Erls,
  20.399 +  Celem.Rls{id = "collect_numerals_", preconds = [], 
  20.400 +      rew_ord = ("dummy_ord", Celem.dummy_ord),
  20.401 +      erls = Atools_erls, srls = Celem.Erls,
  20.402        calc = [("PLUS"  , ("Groups.plus_class.plus", eval_binop "#add_"))
  20.403  	      ], errpatts = [],
  20.404        rules = 
  20.405 -        [Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  20.406 +        [Celem.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  20.407  	     (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
  20.408 -	 Thm ("real_num_collect_assoc_r",TermC.num_str @{thm real_num_collect_assoc_r}),
  20.409 +	 Celem.Thm ("real_num_collect_assoc_r",TermC.num_str @{thm real_num_collect_assoc_r}),
  20.410  	     (*"[| l is_const; m is_const |] ==>  \
  20.411  					\(k + m * n) + l * n = k + (l + m)*n"*)
  20.412 -	 Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),	
  20.413 +	 Celem.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),	
  20.414  	     (*"m is_const ==> n + m * n = (1 + m) * n"*)
  20.415 -	 Thm ("real_one_collect_assoc_r",TermC.num_str @{thm real_one_collect_assoc_r}), 
  20.416 +	 Celem.Thm ("real_one_collect_assoc_r",TermC.num_str @{thm real_one_collect_assoc_r}), 
  20.417  	     (*"m is_const ==> (k + n) + m * n = k + (m + 1) * n"*)
  20.418  
  20.419 -         Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  20.420 +         Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  20.421  
  20.422 -	 (*MG: Reihenfolge der folgenden 2 Thm muss so bleiben, wegen
  20.423 +	 (*MG: Reihenfolge der folgenden 2 Celem.Thm muss so bleiben, wegen
  20.424  		     (a+a)+a --> a + 2*a --> 3*a and not (a+a)+a --> 2*a + a *)
  20.425 -         Thm ("real_mult_2_assoc_r",TermC.num_str @{thm real_mult_2_assoc_r}),
  20.426 +         Celem.Thm ("real_mult_2_assoc_r",TermC.num_str @{thm real_mult_2_assoc_r}),
  20.427  	     (*"(k + z1) + z1 = k + 2 * z1"*)
  20.428 -	 Thm ("sym_real_mult_2",TermC.num_str (@{thm real_mult_2} RS @{thm sym}))
  20.429 +	 Celem.Thm ("sym_real_mult_2",TermC.num_str (@{thm real_mult_2} RS @{thm sym}))
  20.430  	     (*"z1 + z1 = 2 * z1"*)
  20.431 -	], scr = EmptyScr}:rls;
  20.432 +	], scr = Celem.EmptyScr};
  20.433  
  20.434  val reduce_012_ = 
  20.435 -  Rls{id = "reduce_012_", preconds = [], 
  20.436 -      rew_ord = ("dummy_ord", dummy_ord),
  20.437 -      erls = e_rls,srls = Erls, calc = [], errpatts = [],
  20.438 -      rules = [Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),                 
  20.439 +  Celem.Rls{id = "reduce_012_", preconds = [], 
  20.440 +      rew_ord = ("dummy_ord", Celem.dummy_ord),
  20.441 +      erls = Celem.e_rls,srls = Celem.Erls, calc = [], errpatts = [],
  20.442 +      rules = [Celem.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),                 
  20.443  	       (*"1 * z = z"*)
  20.444 -	       Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),        
  20.445 +	       Celem.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),        
  20.446  	       (*"0 * z = 0"*)
  20.447 -	       Thm ("mult_zero_right",TermC.num_str @{thm mult_zero_right}),
  20.448 +	       Celem.Thm ("mult_zero_right",TermC.num_str @{thm mult_zero_right}),
  20.449  	       (*"z * 0 = 0"*)
  20.450 -	       Thm ("add_0_left",TermC.num_str @{thm add_0_left}),
  20.451 +	       Celem.Thm ("add_0_left",TermC.num_str @{thm add_0_left}),
  20.452  	       (*"0 + z = z"*)
  20.453 -	       Thm ("add_0_right",TermC.num_str @{thm add_0_right}),
  20.454 +	       Celem.Thm ("add_0_right",TermC.num_str @{thm add_0_right}),
  20.455  	       (*"z + 0 = z"*) (*wegen a+b-b --> a+(1-1)*b --> a+0 --> a*)
  20.456  
  20.457 -	       (*Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI})*)
  20.458 +	       (*Celem.Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI})*)
  20.459  	       (*"?r ^^^ 1 = ?r"*)
  20.460 -	       Thm ("division_ring_divide_zero",TermC.num_str @{thm division_ring_divide_zero})
  20.461 +	       Celem.Thm ("division_ring_divide_zero",TermC.num_str @{thm division_ring_divide_zero})
  20.462  	       (*"0 / ?x = 0"*)
  20.463 -	       ], scr = EmptyScr}:rls;
  20.464 +	       ], scr = Celem.EmptyScr};
  20.465  
  20.466  val discard_parentheses1 = 
  20.467 -    append_rls "discard_parentheses1" e_rls 
  20.468 -	       [Thm ("sym_mult_assoc",
  20.469 +    Celem.append_rls "discard_parentheses1" Celem.e_rls 
  20.470 +	       [Celem.Thm ("sym_mult_assoc",
  20.471                        TermC.num_str (@{thm mult.assoc} RS @{thm sym}))
  20.472  		(*"?z1.1 * (?z2.1 * ?z3.1) = ?z1.1 * ?z2.1 * ?z3.1"*)
  20.473 -		(*Thm ("sym_add_assoc",
  20.474 +		(*Celem.Thm ("sym_add_assoc",
  20.475                          TermC.num_str (@{thm add_assoc} RS @{thm sym}))*)
  20.476  		(*"?z1.1 + (?z2.1 + ?z3.1) = ?z1.1 + ?z2.1 + ?z3.1"*)
  20.477  		 ];
  20.478 @@ -731,187 +731,187 @@
  20.479  
  20.480  (*MG.0401 ev. for use in rls with ordered rewriting ?
  20.481  val collect_numerals_left = 
  20.482 -  Rls{id = "collect_numerals", preconds = [], 
  20.483 -      rew_ord = ("dummy_ord", dummy_ord),
  20.484 -      erls = Atools_erls(*erls3.4.03*),srls = Erls,
  20.485 +  Celem.Rls{id = "collect_numerals", preconds = [], 
  20.486 +      rew_ord = ("dummy_ord", Celem.dummy_ord),
  20.487 +      erls = Atools_erls(*erls3.4.03*),srls = Celem.Erls,
  20.488        calc = [("PLUS"  , ("Groups.plus_class.plus", eval_binop "#add_")), 
  20.489  	      ("TIMES" , ("Groups.times_class.times", eval_binop "#mult_")),
  20.490  	      ("POWER", ("Atools.pow", eval_binop "#power_"))
  20.491  	      ],
  20.492        errpatts = [],
  20.493 -      rules = [Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  20.494 +      rules = [Celem.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  20.495  	       (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
  20.496 -	       Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),
  20.497 +	       Celem.Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),
  20.498  	       (*"[| l is_const; m is_const |] ==>  
  20.499  				l * n + (m * n + k) =  (l + m) * n + k"*)
  20.500 -	       Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),	
  20.501 +	       Celem.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),	
  20.502  	       (*"m is_const ==> n + m * n = (1 + m) * n"*)
  20.503 -	       Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), 
  20.504 +	       Celem.Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), 
  20.505  	       (*"m is_const ==> n + (m * n + k) = (1 + m) * n + k"*)
  20.506  	       
  20.507 -	       Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  20.508 +	       Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  20.509  
  20.510  	       (*MG am 2.5.03: 2 Theoreme aus reduce_012 hierher verschoben*)
  20.511 -	       Thm ("sym_real_mult_2",
  20.512 +	       Celem.Thm ("sym_real_mult_2",
  20.513                       TermC.num_str (@{thm real_mult_2} RS @{thm sym})),	
  20.514  	       (*"z1 + z1 = 2 * z1"*)
  20.515 -	       Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc})
  20.516 +	       Celem.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc})
  20.517  	       (*"z1 + (z1 + k) = 2 * z1 + k"*)
  20.518 -	       ], scr = EmptyScr}:rls;*)
  20.519 +	       ], scr = Celem.EmptyScr};*)
  20.520  
  20.521  val expand_poly = 
  20.522 -  Rls{id = "expand_poly", preconds = [], 
  20.523 -      rew_ord = ("dummy_ord", dummy_ord),
  20.524 -      erls = e_rls,srls = Erls,
  20.525 +  Celem.Rls{id = "expand_poly", preconds = [], 
  20.526 +      rew_ord = ("dummy_ord", Celem.dummy_ord),
  20.527 +      erls = Celem.e_rls,srls = Celem.Erls,
  20.528        calc = [], errpatts = [],
  20.529        (*asm_thm = [],*)
  20.530 -      rules = [Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),
  20.531 +      rules = [Celem.Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),
  20.532  	       (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  20.533 -	       Thm ("distrib_left",TermC.num_str @{thm distrib_left}),
  20.534 +	       Celem.Thm ("distrib_left",TermC.num_str @{thm distrib_left}),
  20.535  	       (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  20.536 -	       (*Thm ("distrib_right1",TermC.num_str @{thm distrib_right}1),
  20.537 +	       (*Celem.Thm ("distrib_right1",TermC.num_str @{thm distrib_right}1),
  20.538  		....... 18.3.03 undefined???*)
  20.539  
  20.540 -	       Thm ("real_plus_binom_pow2",TermC.num_str @{thm real_plus_binom_pow2}),
  20.541 +	       Celem.Thm ("real_plus_binom_pow2",TermC.num_str @{thm real_plus_binom_pow2}),
  20.542  	       (*"(a + b)^^^2 = a^^^2 + 2*a*b + b^^^2"*)
  20.543 -	       Thm ("real_minus_binom_pow2_p",TermC.num_str @{thm real_minus_binom_pow2_p}),
  20.544 +	       Celem.Thm ("real_minus_binom_pow2_p",TermC.num_str @{thm real_minus_binom_pow2_p}),
  20.545  	       (*"(a - b)^^^2 = a^^^2 + -2*a*b + b^^^2"*)
  20.546 -	       Thm ("real_plus_minus_binom1_p",
  20.547 +	       Celem.Thm ("real_plus_minus_binom1_p",
  20.548  		    TermC.num_str @{thm real_plus_minus_binom1_p}),
  20.549  	       (*"(a + b)*(a - b) = a^^^2 + -1*b^^^2"*)
  20.550 -	       Thm ("real_plus_minus_binom2_p",
  20.551 +	       Celem.Thm ("real_plus_minus_binom2_p",
  20.552  		    TermC.num_str @{thm real_plus_minus_binom2_p}),
  20.553  	       (*"(a - b)*(a + b) = a^^^2 + -1*b^^^2"*)
  20.554  
  20.555 -	       Thm ("minus_minus",TermC.num_str @{thm minus_minus}),
  20.556 +	       Celem.Thm ("minus_minus",TermC.num_str @{thm minus_minus}),
  20.557  	       (*"- (- ?z) = ?z"*)
  20.558 -	       Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}),
  20.559 +	       Celem.Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}),
  20.560  	       (*"a - b = a + -1 * b"*)
  20.561 -	       Thm ("sym_real_mult_minus1",
  20.562 +	       Celem.Thm ("sym_real_mult_minus1",
  20.563                       TermC.num_str (@{thm real_mult_minus1} RS @{thm sym}))
  20.564  	       (*- ?z = "-1 * ?z"*)
  20.565  
  20.566 -	       (*Thm ("real_minus_add_distrib",
  20.567 +	       (*Celem.Thm ("real_minus_add_distrib",
  20.568  		      TermC.num_str @{thm real_minus_add_distrib}),*)
  20.569  	       (*"- (?x + ?y) = - ?x + - ?y"*)
  20.570 -	       (*Thm ("real_diff_plus",TermC.num_str @{thm real_diff_plus})*)
  20.571 +	       (*Celem.Thm ("real_diff_plus",TermC.num_str @{thm real_diff_plus})*)
  20.572  	       (*"a - b = a + -b"*)
  20.573 -	       ], scr = EmptyScr}:rls;
  20.574 +	       ], scr = Celem.EmptyScr};
  20.575  
  20.576  val simplify_power = 
  20.577 -  Rls{id = "simplify_power", preconds = [], 
  20.578 -      rew_ord = ("dummy_ord", dummy_ord),
  20.579 -      erls = e_rls, srls = Erls,
  20.580 +  Celem.Rls{id = "simplify_power", preconds = [], 
  20.581 +      rew_ord = ("dummy_ord", Celem.dummy_ord),
  20.582 +      erls = Celem.e_rls, srls = Celem.Erls,
  20.583        calc = [], errpatts = [],
  20.584 -      rules = [Thm ("realpow_multI", TermC.num_str @{thm realpow_multI}),
  20.585 +      rules = [Celem.Thm ("realpow_multI", TermC.num_str @{thm realpow_multI}),
  20.586  	       (*"(r * s) ^^^ n = r ^^^ n * s ^^^ n"*)
  20.587  	       
  20.588 -	       Thm ("sym_realpow_twoI",
  20.589 +	       Celem.Thm ("sym_realpow_twoI",
  20.590                       TermC.num_str( @{thm realpow_twoI} RS @{thm sym})),	
  20.591  	       (*"r1 * r1 = r1 ^^^ 2"*)
  20.592 -	       Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),		
  20.593 +	       Celem.Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),		
  20.594  	       (*"r * r ^^^ n = r ^^^ (n + 1)"*)
  20.595 -	       Thm ("realpow_pow",TermC.num_str @{thm realpow_pow}),
  20.596 +	       Celem.Thm ("realpow_pow",TermC.num_str @{thm realpow_pow}),
  20.597  	       (*"(a ^^^ b) ^^^ c = a ^^^ (b * c)"*)
  20.598 -	       Thm ("sym_realpow_addI",
  20.599 +	       Celem.Thm ("sym_realpow_addI",
  20.600                       TermC.num_str (@{thm realpow_addI} RS @{thm sym})),
  20.601  	       (*"r ^^^ n * r ^^^ m = r ^^^ (n + m)"*)
  20.602 -	       Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}),
  20.603 +	       Celem.Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}),
  20.604  	       (*"r ^^^ 1 = r"*)
  20.605 -	       Thm ("realpow_eq_oneI",TermC.num_str @{thm realpow_eq_oneI})
  20.606 +	       Celem.Thm ("realpow_eq_oneI",TermC.num_str @{thm realpow_eq_oneI})
  20.607  	       (*"1 ^^^ n = 1"*)
  20.608 -	       ], scr = EmptyScr}:rls;
  20.609 +	       ], scr = Celem.EmptyScr};
  20.610  (*MG.0401: termorders for multivariate polys dropped due to principal problems:
  20.611    (total-degree-)ordering of monoms NOT possible with size_of_term GIVEN*)
  20.612  val order_add_mult = 
  20.613 -  Rls{id = "order_add_mult", preconds = [], 
  20.614 +  Celem.Rls{id = "order_add_mult", preconds = [], 
  20.615        rew_ord = ("ord_make_polynomial",ord_make_polynomial false thy),
  20.616 -      erls = e_rls,srls = Erls,
  20.617 +      erls = Celem.e_rls,srls = Celem.Erls,
  20.618        calc = [], errpatts = [],
  20.619 -      rules = [Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
  20.620 +      rules = [Celem.Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
  20.621  	       (* z * w = w * z *)
  20.622 -	       Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
  20.623 +	       Celem.Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
  20.624  	       (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*)
  20.625 -	       Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),		
  20.626 +	       Celem.Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),		
  20.627  	       (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*)
  20.628 -	       Thm ("add_commute",TermC.num_str @{thm add.commute}),	
  20.629 +	       Celem.Thm ("add_commute",TermC.num_str @{thm add.commute}),	
  20.630  	       (*z + w = w + z*)
  20.631 -	       Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}),
  20.632 +	       Celem.Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}),
  20.633  	       (*x + (y + z) = y + (x + z)*)
  20.634 -	       Thm ("add_assoc",TermC.num_str @{thm add.assoc})	               
  20.635 +	       Celem.Thm ("add_assoc",TermC.num_str @{thm add.assoc})	               
  20.636  	       (*z1.0 + z2.0 + z3.0 = z1.0 + (z2.0 + z3.0)*)
  20.637 -	       ], scr = EmptyScr}:rls;
  20.638 +	       ], scr = Celem.EmptyScr};
  20.639  (*MG.0401: termorders for multivariate polys dropped due to principal problems:
  20.640    (total-degree-)ordering of monoms NOT possible with size_of_term GIVEN*)
  20.641  val order_mult = 
  20.642 -  Rls{id = "order_mult", preconds = [], 
  20.643 +  Celem.Rls{id = "order_mult", preconds = [], 
  20.644        rew_ord = ("ord_make_polynomial",ord_make_polynomial false thy),
  20.645 -      erls = e_rls,srls = Erls,
  20.646 +      erls = Celem.e_rls,srls = Celem.Erls,
  20.647        calc = [], errpatts = [],
  20.648 -      rules = [Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
  20.649 +      rules = [Celem.Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
  20.650  	       (* z * w = w * z *)
  20.651 -	       Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
  20.652 +	       Celem.Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
  20.653  	       (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*)
  20.654 -	       Thm ("mult_assoc",TermC.num_str @{thm mult.assoc})	
  20.655 +	       Celem.Thm ("mult_assoc",TermC.num_str @{thm mult.assoc})	
  20.656  	       (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*)
  20.657 -	       ], scr = EmptyScr}:rls;
  20.658 +	       ], scr = Celem.EmptyScr};
  20.659  *}
  20.660  
  20.661  ML {*
  20.662  val collect_numerals = 
  20.663 -  Rls{id = "collect_numerals", preconds = [], 
  20.664 -      rew_ord = ("dummy_ord", dummy_ord),
  20.665 -      erls = Atools_erls(*erls3.4.03*),srls = Erls,
  20.666 +  Celem.Rls{id = "collect_numerals", preconds = [], 
  20.667 +      rew_ord = ("dummy_ord", Celem.dummy_ord),
  20.668 +      erls = Atools_erls(*erls3.4.03*),srls = Celem.Erls,
  20.669        calc = [("PLUS"  , ("Groups.plus_class.plus", eval_binop "#add_")), 
  20.670  	      ("TIMES" , ("Groups.times_class.times", eval_binop "#mult_")),
  20.671  	      ("POWER", ("Atools.pow", eval_binop "#power_"))
  20.672  	      ], errpatts = [],
  20.673 -      rules = [Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  20.674 +      rules = [Celem.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  20.675  	       (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
  20.676 -	       Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),
  20.677 +	       Celem.Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),
  20.678  	       (*"[| l is_const; m is_const |] ==>  
  20.679  				l * n + (m * n + k) =  (l + m) * n + k"*)
  20.680 -	       Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),	
  20.681 +	       Celem.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),	
  20.682  	       (*"m is_const ==> n + m * n = (1 + m) * n"*)
  20.683 -	       Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), 
  20.684 +	       Celem.Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), 
  20.685  	       (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  20.686 -	       Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  20.687 -	       Calc ("Groups.times_class.times", eval_binop "#mult_"),
  20.688 -	       Calc ("Atools.pow", eval_binop "#power_")
  20.689 -	       ], scr = EmptyScr}:rls;
  20.690 +	       Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  20.691 +	       Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
  20.692 +	       Celem.Calc ("Atools.pow", eval_binop "#power_")
  20.693 +	       ], scr = Celem.EmptyScr};
  20.694  val reduce_012 = 
  20.695 -  Rls{id = "reduce_012", preconds = [], 
  20.696 -      rew_ord = ("dummy_ord", dummy_ord),
  20.697 -      erls = e_rls,srls = Erls,
  20.698 +  Celem.Rls{id = "reduce_012", preconds = [], 
  20.699 +      rew_ord = ("dummy_ord", Celem.dummy_ord),
  20.700 +      erls = Celem.e_rls,srls = Celem.Erls,
  20.701        calc = [], errpatts = [],
  20.702 -      rules = [Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),                 
  20.703 +      rules = [Celem.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),                 
  20.704  	       (*"1 * z = z"*)
  20.705 -	       (*Thm ("real_mult_minus1",TermC.num_str @{thm real_mult_minus1}),14.3.03*)
  20.706 +	       (*Celem.Thm ("real_mult_minus1",TermC.num_str @{thm real_mult_minus1}),14.3.03*)
  20.707  	       (*"-1 * z = - z"*)
  20.708 -	       Thm ("minus_mult_left", 
  20.709 +	       Celem.Thm ("minus_mult_left", 
  20.710  		    TermC.num_str (@{thm minus_mult_left} RS @{thm sym})),
  20.711  	       (*- (?x * ?y) = "- ?x * ?y"*)
  20.712 -	       (*Thm ("real_minus_mult_cancel",
  20.713 +	       (*Celem.Thm ("real_minus_mult_cancel",
  20.714                         TermC.num_str @{thm real_minus_mult_cancel}),
  20.715  	       (*"- ?x * - ?y = ?x * ?y"*)---*)
  20.716 -	       Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),        
  20.717 +	       Celem.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),        
  20.718  	       (*"0 * z = 0"*)
  20.719 -	       Thm ("add_0_left",TermC.num_str @{thm add_0_left}),
  20.720 +	       Celem.Thm ("add_0_left",TermC.num_str @{thm add_0_left}),
  20.721  	       (*"0 + z = z"*)
  20.722 -	       Thm ("right_minus",TermC.num_str @{thm right_minus}),
  20.723 +	       Celem.Thm ("right_minus",TermC.num_str @{thm right_minus}),
  20.724  	       (*"?z + - ?z = 0"*)
  20.725 -	       Thm ("sym_real_mult_2",
  20.726 +	       Celem.Thm ("sym_real_mult_2",
  20.727                       TermC.num_str (@{thm real_mult_2} RS @{thm sym})),	
  20.728  	       (*"z1 + z1 = 2 * z1"*)
  20.729 -	       Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc})
  20.730 +	       Celem.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc})
  20.731  	       (*"z1 + (z1 + k) = 2 * z1 + k"*)
  20.732 -	       ], scr = EmptyScr}:rls;
  20.733 +	       ], scr = Celem.EmptyScr};
  20.734  
  20.735  val discard_parentheses = 
  20.736 -    append_rls "discard_parentheses" e_rls 
  20.737 -	       [Thm ("sym_mult_assoc",
  20.738 +    Celem.append_rls "discard_parentheses" Celem.e_rls 
  20.739 +	       [Celem.Thm ("sym_mult_assoc",
  20.740                        TermC.num_str (@{thm mult.assoc} RS @{thm sym})),
  20.741 -		Thm ("sym_add_assoc",
  20.742 +		Celem.Thm ("sym_add_assoc",
  20.743                        TermC.num_str (@{thm add.assoc} RS @{thm sym}))];
  20.744  
  20.745  val scr_make_polynomial = 
  20.746 @@ -953,20 +953,20 @@
  20.747  
  20.748  (*version used by MG.02/03, overwritten by version AG in 04 below
  20.749  val make_polynomial = prep_rls'(
  20.750 -  Seq{id = "make_polynomial", preconds = []:term list, 
  20.751 -      rew_ord = ("dummy_ord", dummy_ord),
  20.752 -      erls = Atools_erls, srls = Erls,
  20.753 +  Celem.Seq{id = "make_polynomial", preconds = []:term list, 
  20.754 +      rew_ord = ("dummy_ord", Celem.dummy_ord),
  20.755 +      erls = Atools_erls, srls = Celem.Erls,
  20.756        calc = [], errpatts = [],
  20.757 -      rules = [Rls_ expand_poly,
  20.758 -	       Rls_ order_add_mult,
  20.759 -	       Rls_ simplify_power,   (*realpow_eq_oneI, eg. x^1 --> x *)
  20.760 -	       Rls_ collect_numerals, (*eg. x^(2+ -1) --> x^1          *)
  20.761 -	       Rls_ reduce_012,
  20.762 -	       Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}),(*in --^*) 
  20.763 -	       Rls_ discard_parentheses
  20.764 +      rules = [Celem.Rls_ expand_poly,
  20.765 +	       Celem.Rls_ order_add_mult,
  20.766 +	       Celem.Rls_ simplify_power,   (*realpow_eq_oneI, eg. x^1 --> x *)
  20.767 +	       Celem.Rls_ collect_numerals, (*eg. x^(2+ -1) --> x^1          *)
  20.768 +	       Celem.Rls_ reduce_012,
  20.769 +	       Celem.Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}),(*in --^*) 
  20.770 +	       Celem.Rls_ discard_parentheses
  20.771  	       ],
  20.772 -      scr = EmptyScr
  20.773 -      }:rls);   *)
  20.774 +      scr = Celem.EmptyScr
  20.775 +      });   *)
  20.776  
  20.777  val scr_expand_binoms =
  20.778  "Script Expand_binoms t_t =" ^
  20.779 @@ -1003,104 +1003,104 @@
  20.780  " t_t)";
  20.781  
  20.782  val expand_binoms = 
  20.783 -  Rls{id = "expand_binoms", preconds = [], rew_ord = ("termlessI",termlessI),
  20.784 -      erls = Atools_erls, srls = Erls,
  20.785 +  Celem.Rls{id = "expand_binoms", preconds = [], rew_ord = ("termlessI",termlessI),
  20.786 +      erls = Atools_erls, srls = Celem.Erls,
  20.787        calc = [("PLUS"  , ("Groups.plus_class.plus", eval_binop "#add_")), 
  20.788  	      ("TIMES" , ("Groups.times_class.times", eval_binop "#mult_")),
  20.789  	      ("POWER", ("Atools.pow", eval_binop "#power_"))
  20.790  	      ], errpatts = [],
  20.791 -      rules = [Thm ("real_plus_binom_pow2",
  20.792 +      rules = [Celem.Thm ("real_plus_binom_pow2",
  20.793                       TermC.num_str @{thm real_plus_binom_pow2}),     
  20.794  	       (*"(a + b) ^^^ 2 = a ^^^ 2 + 2 * a * b + b ^^^ 2"*)
  20.795 -	       Thm ("real_plus_binom_times",
  20.796 +	       Celem.Thm ("real_plus_binom_times",
  20.797                       TermC.num_str @{thm real_plus_binom_times}),    
  20.798  	      (*"(a + b)*(a + b) = ...*)
  20.799 -	       Thm ("real_minus_binom_pow2",
  20.800 +	       Celem.Thm ("real_minus_binom_pow2",
  20.801                       TermC.num_str @{thm real_minus_binom_pow2}),   
  20.802  	       (*"(a - b) ^^^ 2 = a ^^^ 2 - 2 * a * b + b ^^^ 2"*)
  20.803 -	       Thm ("real_minus_binom_times",
  20.804 +	       Celem.Thm ("real_minus_binom_times",
  20.805                       TermC.num_str @{thm real_minus_binom_times}),   
  20.806  	       (*"(a - b)*(a - b) = ...*)
  20.807 -	       Thm ("real_plus_minus_binom1",
  20.808 +	       Celem.Thm ("real_plus_minus_binom1",
  20.809                       TermC.num_str @{thm real_plus_minus_binom1}),   
  20.810  		(*"(a + b) * (a - b) = a ^^^ 2 - b ^^^ 2"*)
  20.811 -	       Thm ("real_plus_minus_binom2",
  20.812 +	       Celem.Thm ("real_plus_minus_binom2",
  20.813                       TermC.num_str @{thm real_plus_minus_binom2}),   
  20.814  		(*"(a - b) * (a + b) = a ^^^ 2 - b ^^^ 2"*)
  20.815  	       (*RL 020915*)
  20.816 -	       Thm ("real_pp_binom_times",TermC.num_str @{thm real_pp_binom_times}), 
  20.817 +	       Celem.Thm ("real_pp_binom_times",TermC.num_str @{thm real_pp_binom_times}), 
  20.818  		(*(a + b)*(c + d) = a*c + a*d + b*c + b*d*)
  20.819 -               Thm ("real_pm_binom_times",TermC.num_str @{thm real_pm_binom_times}), 
  20.820 +               Celem.Thm ("real_pm_binom_times",TermC.num_str @{thm real_pm_binom_times}), 
  20.821  		(*(a + b)*(c - d) = a*c - a*d + b*c - b*d*)
  20.822 -               Thm ("real_mp_binom_times",TermC.num_str @{thm real_mp_binom_times}), 
  20.823 +               Celem.Thm ("real_mp_binom_times",TermC.num_str @{thm real_mp_binom_times}), 
  20.824  		(*(a - b)*(c + d) = a*c + a*d - b*c - b*d*)
  20.825 -               Thm ("real_mm_binom_times",TermC.num_str @{thm real_mm_binom_times}), 
  20.826 +               Celem.Thm ("real_mm_binom_times",TermC.num_str @{thm real_mm_binom_times}), 
  20.827  		(*(a - b)*(c - d) = a*c - a*d - b*c + b*d*)
  20.828 -	       Thm ("realpow_multI",TermC.num_str @{thm realpow_multI}),
  20.829 +	       Celem.Thm ("realpow_multI",TermC.num_str @{thm realpow_multI}),
  20.830  		(*(a*b)^^^n = a^^^n * b^^^n*)
  20.831 -	       Thm ("real_plus_binom_pow3",TermC.num_str @{thm real_plus_binom_pow3}),
  20.832 +	       Celem.Thm ("real_plus_binom_pow3",TermC.num_str @{thm real_plus_binom_pow3}),
  20.833  	        (* (a + b)^^^3 = a^^^3 + 3*a^^^2*b + 3*a*b^^^2 + b^^^3 *)
  20.834 -	       Thm ("real_minus_binom_pow3",
  20.835 +	       Celem.Thm ("real_minus_binom_pow3",
  20.836                       TermC.num_str @{thm real_minus_binom_pow3}),
  20.837  	        (* (a - b)^^^3 = a^^^3 - 3*a^^^2*b + 3*a*b^^^2 - b^^^3 *)
  20.838  
  20.839  
  20.840 -              (*Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),	
  20.841 +              (*Celem.Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),	
  20.842  		(*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  20.843 -	       Thm ("distrib_left",TermC.num_str @{thm distrib_left}),	
  20.844 +	       Celem.Thm ("distrib_left",TermC.num_str @{thm distrib_left}),	
  20.845  	       (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  20.846 -	       Thm ("left_diff_distrib" ,TermC.num_str @{thm left_diff_distrib}),	
  20.847 +	       Celem.Thm ("left_diff_distrib" ,TermC.num_str @{thm left_diff_distrib}),	
  20.848  	       (*"(z1.0 - z2.0) * w = z1.0 * w - z2.0 * w"*)
  20.849 -	       Thm ("right_diff_distrib",TermC.num_str @{thm right_diff_distrib}),	
  20.850 +	       Celem.Thm ("right_diff_distrib",TermC.num_str @{thm right_diff_distrib}),	
  20.851  	       (*"w * (z1.0 - z2.0) = w * z1.0 - w * z2.0"*)
  20.852  	      *)
  20.853 -	       Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),
  20.854 +	       Celem.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),
  20.855                 (*"1 * z = z"*)
  20.856 -	       Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),
  20.857 +	       Celem.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),
  20.858                 (*"0 * z = 0"*)
  20.859 -	       Thm ("add_0_left",TermC.num_str @{thm add_0_left}),(*"0 + z = z"*)
  20.860 +	       Celem.Thm ("add_0_left",TermC.num_str @{thm add_0_left}),(*"0 + z = z"*)
  20.861  
  20.862 -	       Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  20.863 -	       Calc ("Groups.times_class.times", eval_binop "#mult_"),
  20.864 -	       Calc ("Atools.pow", eval_binop "#power_"),
  20.865 -              (*Thm ("mult_commute",TermC.num_str @{thm mult_commute}),
  20.866 +	       Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  20.867 +	       Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
  20.868 +	       Celem.Calc ("Atools.pow", eval_binop "#power_"),
  20.869 +              (*Celem.Thm ("mult_commute",TermC.num_str @{thm mult_commute}),
  20.870  		(*AC-rewriting*)
  20.871 -	       Thm ("real_mult_left_commute",
  20.872 +	       Celem.Thm ("real_mult_left_commute",
  20.873                       TermC.num_str @{thm real_mult_left_commute}),
  20.874 -	       Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),
  20.875 -	       Thm ("add_commute",TermC.num_str @{thm add.commute}),
  20.876 -	       Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}),
  20.877 -	       Thm ("add_assoc",TermC.num_str @{thm add.assoc}),
  20.878 +	       Celem.Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),
  20.879 +	       Celem.Thm ("add_commute",TermC.num_str @{thm add.commute}),
  20.880 +	       Celem.Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}),
  20.881 +	       Celem.Thm ("add_assoc",TermC.num_str @{thm add.assoc}),
  20.882  	      *)
  20.883 -	       Thm ("sym_realpow_twoI",
  20.884 +	       Celem.Thm ("sym_realpow_twoI",
  20.885                       TermC.num_str (@{thm realpow_twoI} RS @{thm sym})),
  20.886  	       (*"r1 * r1 = r1 ^^^ 2"*)
  20.887 -	       Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),			
  20.888 +	       Celem.Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),			
  20.889  	       (*"r * r ^^^ n = r ^^^ (n + 1)"*)
  20.890 -	       (*Thm ("sym_real_mult_2",
  20.891 +	       (*Celem.Thm ("sym_real_mult_2",
  20.892                         TermC.num_str (@{thm real_mult_2} RS @{thm sym})),		
  20.893  	       (*"z1 + z1 = 2 * z1"*)*)
  20.894 -	       Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),		
  20.895 +	       Celem.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),		
  20.896  	       (*"z1 + (z1 + k) = 2 * z1 + k"*)
  20.897  
  20.898 -	       Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  20.899 +	       Celem.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  20.900  	       (*"[| l is_const; m is_const |] ==>l * n + m * n = (l + m) * n"*)
  20.901 -	       Thm ("real_num_collect_assoc",
  20.902 +	       Celem.Thm ("real_num_collect_assoc",
  20.903                       TermC.num_str @{thm real_num_collect_assoc}),	
  20.904  	       (*"[| l is_const; m is_const |] ==>  
  20.905                                         l * n + (m * n + k) =  (l + m) * n + k"*)
  20.906 -	       Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),
  20.907 +	       Celem.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),
  20.908  	       (*"m is_const ==> n + m * n = (1 + m) * n"*)
  20.909 -	       Thm ("real_one_collect_assoc",
  20.910 +	       Celem.Thm ("real_one_collect_assoc",
  20.911                       TermC.num_str @{thm real_one_collect_assoc}), 
  20.912  	       (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  20.913  
  20.914 -	       Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  20.915 -	       Calc ("Groups.times_class.times", eval_binop "#mult_"),
  20.916 -	       Calc ("Atools.pow", eval_binop "#power_")
  20.917 +	       Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  20.918 +	       Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
  20.919 +	       Celem.Calc ("Atools.pow", eval_binop "#power_")
  20.920  	       ],
  20.921 -      scr = Prog ((Thm.term_of o the o (TermC.parse thy)) scr_expand_binoms)
  20.922 -      }:rls;      
  20.923 +      scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) scr_expand_binoms)
  20.924 +      };      
  20.925  
  20.926  
  20.927  (**. MG.03: make_polynomial_ ... uses SML-fun for ordering .**)
  20.928 @@ -1122,7 +1122,7 @@
  20.929    | get_basStr (Free (str, _)) = str
  20.930    | get_basStr t = "|||"; (* gross gewichtet; für Brüch ect. *)
  20.931  (*| get_basStr t = 
  20.932 -    error("get_basStr: called with t= "^(term2str t));*)
  20.933 +    error("get_basStr: called with t= "^(Celem.term2str t));*)
  20.934  
  20.935  (* liefert Hochzahl (String) einer Variablen bzw Gewichtstring (zum Sortieren) *)
  20.936  fun get_potStr (Const ("Atools.pow",_) $ Free _ $ Free (str, _)) = str
  20.937 @@ -1130,7 +1130,7 @@
  20.938    | get_potStr (Free (str, _)) = "---" (* keine Hochzahl --> kleinst gewichtet *)
  20.939    | get_potStr t = "||||||"; (* gross gewichtet; für Brüch ect. *)
  20.940  (*| get_potStr t = 
  20.941 -    error("get_potStr: called with t= "^(term2str t));*)
  20.942 +    error("get_potStr: called with t= "^(Celem.term2str t));*)
  20.943  
  20.944  (* Umgekehrte string_ord *)
  20.945  val string_ord_rev =  rev_order o string_ord;
  20.946 @@ -1189,7 +1189,7 @@
  20.947  	       | (Const ("Atools.pow", _) $ Free (str_b, _) $ _ ) => 
  20.948  		     counter (n + 1000, xs) (*FIXME.MG?!*)
  20.949  	       | (Free (str, _)) => counter (n + 1, xs)
  20.950 -	     (*| _ => error("monom_degree: called with factor: "^(term2str x)))*)
  20.951 +	     (*| _ => error("monom_degree: called with factor: "^(Celem.term2str x)))*)
  20.952  	       | _ => counter (n + 10000, xs)) (*FIXME.MG?! ... Brüche ect.*)
  20.953  in  
  20.954      fun monom_degree l = counter (0, l) 
  20.955 @@ -1309,49 +1309,49 @@
  20.956  fun eval_is_multUnordered (thmid:string) _ 
  20.957  		       (t as (Const("Poly.is'_multUnordered", _) $ arg)) thy = 
  20.958      if is_multUnordered arg
  20.959 -    then SOME (TermC.mk_thmid thmid (term_to_string''' thy arg) "", 
  20.960 +    then SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg) "", 
  20.961  	         HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True})))
  20.962 -    else SOME (TermC.mk_thmid thmid (term_to_string''' thy arg) "", 
  20.963 +    else SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg) "", 
  20.964  	         HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False})))
  20.965    | eval_is_multUnordered _ _ _ _ = NONE; 
  20.966  
  20.967 -fun attach_form (_:rule list list) (_:term) (_:term) = (*still missing*)
  20.968 -    []:(rule * (term * term list)) list;
  20.969 -fun init_state (_:term) = e_rrlsstate;
  20.970 -fun locate_rule (_:rule list list) (_:term) (_:rule) =
  20.971 -    ([]:(rule * (term * term list)) list);
  20.972 -fun next_rule (_:rule list list) (_:term) = (NONE:rule option);
  20.973 -fun normal_form t = SOME (sort_variables t,[]:term list);
  20.974 +fun attach_form (_: Celem.rule list list) (_: term) (_: term) = (*still missing*)
  20.975 +    []:(Celem.rule * (term * term list)) list;
  20.976 +fun init_state (_: term) = Celem.e_rrlsstate;
  20.977 +fun locate_rule (_: Celem.rule list list) (_: term) (_: Celem.rule) =
  20.978 +    ([]:(Celem.rule * (term * term list)) list);
  20.979 +fun next_rule (_: Celem.rule list list) (_: term) = (NONE: Celem.rule option);
  20.980 +fun normal_form t = SOME (sort_variables t, []: term list);
  20.981  
  20.982  val order_mult_ =
  20.983 -    Rrls {id = "order_mult_", 
  20.984 +    Celem.Rrls {id = "order_mult_", 
  20.985  	  prepat = 
  20.986            (* ?p matched with the current term gives an environment,
  20.987               which evaluates (the instantiated) "?p is_multUnordered" to true *)
  20.988  	  [([TermC.parse_patt thy "?p is_multUnordered"], 
  20.989               TermC.parse_patt thy "?p :: real")],
  20.990 -	  rew_ord = ("dummy_ord", dummy_ord),
  20.991 -	  erls = append_rls "e_rls-is_multUnordered" e_rls
  20.992 -			    [Calc ("Poly.is'_multUnordered", 
  20.993 +	  rew_ord = ("dummy_ord", Celem.dummy_ord),
  20.994 +	  erls = Celem.append_rls "Celem.e_rls-is_multUnordered" Celem.e_rls
  20.995 +			    [Celem.Calc ("Poly.is'_multUnordered", 
  20.996                                      eval_is_multUnordered "")],
  20.997  	  calc = [("PLUS"  , ("Groups.plus_class.plus", eval_binop "#add_")),
  20.998  		  ("TIMES" , ("Groups.times_class.times", eval_binop "#mult_")),
  20.999  		  ("DIVIDE", ("Rings.divide_class.divide", 
 20.1000  		              eval_cancel "#divide_e")),
 20.1001  		  ("POWER" , ("Atools.pow", eval_binop "#power_"))],
 20.1002 -  errpatts = [],
 20.1003 -	  scr=Rfuns {init_state  = init_state,
 20.1004 +    errpatts = [],
 20.1005 +	  scr = Celem.Rfuns {init_state  = init_state,
 20.1006  		     normal_form = normal_form,
 20.1007  		     locate_rule = locate_rule,
 20.1008  		     next_rule   = next_rule,
 20.1009  		     attach_form = attach_form}};
 20.1010  val order_mult_rls_ = 
 20.1011 -  Rls{id = "order_mult_rls_", preconds = [], 
 20.1012 -      rew_ord = ("dummy_ord", dummy_ord),
 20.1013 -      erls = e_rls,srls = Erls,
 20.1014 +  Celem.Rls {id = "order_mult_rls_", preconds = [], 
 20.1015 +      rew_ord = ("dummy_ord", Celem.dummy_ord),
 20.1016 +      erls = Celem.e_rls,srls = Celem.Erls,
 20.1017        calc = [], errpatts = [],
 20.1018 -      rules = [Rls_ order_mult_
 20.1019 -	       ], scr = EmptyScr}:rls;
 20.1020 +      rules = [Celem.Rls_ order_mult_
 20.1021 +	       ], scr = Celem.EmptyScr};
 20.1022  *}
 20.1023  ML {*
 20.1024  
 20.1025 @@ -1362,31 +1362,32 @@
 20.1026  fun eval_is_addUnordered (thmid:string) _ 
 20.1027  		       (t as (Const("Poly.is'_addUnordered", _) $ arg)) thy = 
 20.1028      if is_addUnordered arg
 20.1029 -    then SOME (TermC.mk_thmid thmid (term_to_string''' thy arg) "", 
 20.1030 +    then SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg) "", 
 20.1031  	         HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True})))
 20.1032 -    else SOME (TermC.mk_thmid thmid (term_to_string''' thy arg) "", 
 20.1033 +    else SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg) "", 
 20.1034  	         HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False})))
 20.1035    | eval_is_addUnordered _ _ _ _ = NONE; 
 20.1036  
 20.1037 -fun attach_form (_:rule list list) (_:term) (_:term) = (*still missing*)
 20.1038 -    []:(rule * (term * term list)) list;
 20.1039 -fun init_state (_:term) = e_rrlsstate;
 20.1040 -fun locate_rule (_:rule list list) (_:term) (_:rule) =
 20.1041 -    ([]:(rule * (term * term list)) list);
 20.1042 -fun next_rule (_:rule list list) (_:term) = (NONE:rule option);
 20.1043 -fun normal_form t = SOME (sort_monoms t,[]:term list);
 20.1044 +fun attach_form (_: Celem.rule list list) (_: term) (_: term) = (*still missing*)
 20.1045 +    []: (Celem.rule * (term * term list)) list;
 20.1046 +fun init_state (_: term) = Celem.e_rrlsstate;
 20.1047 +fun locate_rule (_: Celem.rule list list) (_: term) (_: Celem.rule) =
 20.1048 +    ([]: (Celem.rule * (term * term list)) list);
 20.1049 +fun next_rule (_: Celem.rule list list) (_: term) = (NONE: Celem.rule option);
 20.1050 +fun normal_form t = SOME (sort_monoms t,[]: term list);
 20.1051  
 20.1052 +*} ML {*
 20.1053  val order_add_ =
 20.1054 -    Rrls {id = "order_add_", 
 20.1055 +    Celem.Rrls {id = "order_add_", 
 20.1056  	  prepat = (*WN.18.6.03 Preconditions und Pattern,
 20.1057 -		    die beide passen muessen, damit das Rrls angewandt wird*)
 20.1058 +		    die beide passen muessen, damit das Celem.Rrls angewandt wird*)
 20.1059  	  [([TermC.parse_patt @{theory} "?p is_addUnordered"], 
 20.1060  	     TermC.parse_patt @{theory} "?p :: real" 
 20.1061  	    (*WN.18.6.03 also KEIN pattern, dieses erzeugt nur das Environment 
 20.1062  	      fuer die Evaluation der Precondition "p is_addUnordered"*))],
 20.1063 -	  rew_ord = ("dummy_ord", dummy_ord),
 20.1064 -	  erls = append_rls "e_rls-is_addUnordered" e_rls(*MG: poly_erls*)
 20.1065 -			    [Calc ("Poly.is'_addUnordered",
 20.1066 +	  rew_ord = ("dummy_ord", Celem.dummy_ord),
 20.1067 +	  erls = Celem.append_rls "Celem.e_rls-is_addUnordered" Celem.e_rls(*MG: poly_erls*)
 20.1068 +			    [Celem.Calc ("Poly.is'_addUnordered",
 20.1069                                     eval_is_addUnordered "")],
 20.1070  	  calc = [("PLUS"  ,("Groups.plus_class.plus", eval_binop "#add_")),
 20.1071  		  ("TIMES" ,("Groups.times_class.times", eval_binop "#mult_")),
 20.1072 @@ -1394,19 +1395,19 @@
 20.1073                                eval_cancel "#divide_e")),
 20.1074  		  ("POWER" ,("Atools.pow"  ,eval_binop "#power_"))],
 20.1075  	  errpatts = [],
 20.1076 -	  scr=Rfuns {init_state  = init_state,
 20.1077 +	  scr = Celem.Rfuns {init_state  = init_state,
 20.1078  		     normal_form = normal_form,
 20.1079  		     locate_rule = locate_rule,
 20.1080  		     next_rule   = next_rule,
 20.1081  		     attach_form = attach_form}};
 20.1082  
 20.1083 -val order_add_rls_ = 
 20.1084 -  Rls{id = "order_add_rls_", preconds = [], 
 20.1085 -      rew_ord = ("dummy_ord", dummy_ord),
 20.1086 -      erls = e_rls,srls = Erls,
 20.1087 +val order_add_rls_ =
 20.1088 +  Celem.Rls {id = "order_add_rls_", preconds = [], 
 20.1089 +      rew_ord = ("dummy_ord", Celem.dummy_ord),
 20.1090 +      erls = Celem.e_rls,srls = Celem.Erls,
 20.1091        calc = [], errpatts = [],
 20.1092 -      rules = [Rls_ order_add_
 20.1093 -	       ], scr = EmptyScr}:rls;
 20.1094 +      rules = [Celem.Rls_ order_add_
 20.1095 +	       ], scr = Celem.EmptyScr};
 20.1096  *}
 20.1097  
 20.1098  text {* rule-set make_polynomial also named norm_Poly:
 20.1099 @@ -1421,134 +1422,134 @@
 20.1100  (*. see MG-DA.p.52ff .*)
 20.1101  val make_polynomial(*MG.03, overwrites version from above, 
 20.1102      previously 'make_polynomial_'*) =
 20.1103 -  Seq {id = "make_polynomial", preconds = []:term list, 
 20.1104 -      rew_ord = ("dummy_ord", dummy_ord),
 20.1105 -      erls = Atools_erls, srls = Erls,calc = [], errpatts = [],
 20.1106 -      rules = [Rls_ discard_minus,
 20.1107 -	       Rls_ expand_poly_,
 20.1108 -	       Calc ("Groups.times_class.times", eval_binop "#mult_"),
 20.1109 -	       Rls_ order_mult_rls_,
 20.1110 -	       Rls_ simplify_power_, 
 20.1111 -	       Rls_ calc_add_mult_pow_, 
 20.1112 -	       Rls_ reduce_012_mult_,
 20.1113 -	       Rls_ order_add_rls_,
 20.1114 -	       Rls_ collect_numerals_, 
 20.1115 -	       Rls_ reduce_012_,
 20.1116 -	       Rls_ discard_parentheses1
 20.1117 +  Celem.Seq {id = "make_polynomial", preconds = []:term list, 
 20.1118 +      rew_ord = ("dummy_ord", Celem.dummy_ord),
 20.1119 +      erls = Atools_erls, srls = Celem.Erls,calc = [], errpatts = [],
 20.1120 +      rules = [Celem.Rls_ discard_minus,
 20.1121 +	       Celem.Rls_ expand_poly_,
 20.1122 +	       Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
 20.1123 +	       Celem.Rls_ order_mult_rls_,
 20.1124 +	       Celem.Rls_ simplify_power_, 
 20.1125 +	       Celem.Rls_ calc_add_mult_pow_, 
 20.1126 +	       Celem.Rls_ reduce_012_mult_,
 20.1127 +	       Celem.Rls_ order_add_rls_,
 20.1128 +	       Celem.Rls_ collect_numerals_, 
 20.1129 +	       Celem.Rls_ reduce_012_,
 20.1130 +	       Celem.Rls_ discard_parentheses1
 20.1131  	       ],
 20.1132 -      scr = EmptyScr
 20.1133 -      }:rls;
 20.1134 +      scr = Celem.EmptyScr
 20.1135 +      };
 20.1136  *}
 20.1137  ML {*
 20.1138  val norm_Poly(*=make_polynomial*) = 
 20.1139 -  Seq {id = "norm_Poly", preconds = []:term list, 
 20.1140 -      rew_ord = ("dummy_ord", dummy_ord),
 20.1141 -      erls = Atools_erls, srls = Erls, calc = [], errpatts = [],
 20.1142 -      rules = [Rls_ discard_minus,
 20.1143 -	       Rls_ expand_poly_,
 20.1144 -	       Calc ("Groups.times_class.times", eval_binop "#mult_"),
 20.1145 -	       Rls_ order_mult_rls_,
 20.1146 -	       Rls_ simplify_power_, 
 20.1147 -	       Rls_ calc_add_mult_pow_, 
 20.1148 -	       Rls_ reduce_012_mult_,
 20.1149 -	       Rls_ order_add_rls_,
 20.1150 -	       Rls_ collect_numerals_, 
 20.1151 -	       Rls_ reduce_012_,
 20.1152 -	       Rls_ discard_parentheses1
 20.1153 +  Celem.Seq {id = "norm_Poly", preconds = []:term list, 
 20.1154 +      rew_ord = ("dummy_ord", Celem.dummy_ord),
 20.1155 +      erls = Atools_erls, srls = Celem.Erls, calc = [], errpatts = [],
 20.1156 +      rules = [Celem.Rls_ discard_minus,
 20.1157 +	       Celem.Rls_ expand_poly_,
 20.1158 +	       Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
 20.1159 +	       Celem.Rls_ order_mult_rls_,
 20.1160 +	       Celem.Rls_ simplify_power_, 
 20.1161 +	       Celem.Rls_ calc_add_mult_pow_, 
 20.1162 +	       Celem.Rls_ reduce_012_mult_,
 20.1163 +	       Celem.Rls_ order_add_rls_,
 20.1164 +	       Celem.Rls_ collect_numerals_, 
 20.1165 +	       Celem.Rls_ reduce_012_,
 20.1166 +	       Celem.Rls_ discard_parentheses1
 20.1167  	       ],
 20.1168 -      scr = EmptyScr
 20.1169 -      }:rls;
 20.1170 +      scr = Celem.EmptyScr
 20.1171 +      };
 20.1172  *}
 20.1173  ML {*
 20.1174 -(* MG:03 Like make_polynomial_ but without Rls_ discard_parentheses1 
 20.1175 +(* MG:03 Like make_polynomial_ but without Celem.Rls_ discard_parentheses1 
 20.1176     and expand_poly_rat_ instead of expand_poly_, see MG-DA.p.56ff*)
 20.1177  (* MG necessary  for termination of norm_Rational(*_mg*) in Rational.ML*)
 20.1178  val make_rat_poly_with_parentheses =
 20.1179 -  Seq{id = "make_rat_poly_with_parentheses", preconds = []:term list, 
 20.1180 -      rew_ord = ("dummy_ord", dummy_ord),
 20.1181 -      erls = Atools_erls, srls = Erls, calc = [], errpatts = [],
 20.1182 -      rules = [Rls_ discard_minus,
 20.1183 -	       Rls_ expand_poly_rat_,(*ignors rationals*)
 20.1184 -	       Calc ("Groups.times_class.times", eval_binop "#mult_"),
 20.1185 -	       Rls_ order_mult_rls_,
 20.1186 -	       Rls_ simplify_power_, 
 20.1187 -	       Rls_ calc_add_mult_pow_, 
 20.1188 -	       Rls_ reduce_012_mult_,
 20.1189 -	       Rls_ order_add_rls_,
 20.1190 -	       Rls_ collect_numerals_, 
 20.1191 -	       Rls_ reduce_012_
 20.1192 -	       (*Rls_ discard_parentheses1 *)
 20.1193 +  Celem.Seq{id = "make_rat_poly_with_parentheses", preconds = []:term list, 
 20.1194 +      rew_ord = ("dummy_ord", Celem.dummy_ord),
 20.1195 +      erls = Atools_erls, srls = Celem.Erls, calc = [], errpatts = [],
 20.1196 +      rules = [Celem.Rls_ discard_minus,
 20.1197 +	       Celem.Rls_ expand_poly_rat_,(*ignors rationals*)
 20.1198 +	       Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
 20.1199 +	       Celem.Rls_ order_mult_rls_,
 20.1200 +	       Celem.Rls_ simplify_power_, 
 20.1201 +	       Celem.Rls_ calc_add_mult_pow_, 
 20.1202 +	       Celem.Rls_ reduce_012_mult_,
 20.1203 +	       Celem.Rls_ order_add_rls_,
 20.1204 +	       Celem.Rls_ collect_numerals_, 
 20.1205 +	       Celem.Rls_ reduce_012_
 20.1206 +	       (*Celem.Rls_ discard_parentheses1 *)
 20.1207  	       ],
 20.1208 -      scr = EmptyScr
 20.1209 -      }:rls;
 20.1210 +      scr = Celem.EmptyScr
 20.1211 +      };
 20.1212  *}
 20.1213  ML {*
 20.1214  (*.a minimal ruleset for reverse rewriting of factions [2];
 20.1215     compare expand_binoms.*)
 20.1216  val rev_rew_p = 
 20.1217 -Seq{id = "rev_rew_p", preconds = [], rew_ord = ("termlessI",termlessI),
 20.1218 -    erls = Atools_erls, srls = Erls,
 20.1219 +Celem.Seq{id = "rev_rew_p", preconds = [], rew_ord = ("termlessI",termlessI),
 20.1220 +    erls = Atools_erls, srls = Celem.Erls,
 20.1221      calc = [(*("PLUS"  , ("Groups.plus_class.plus", eval_binop "#add_")), 
 20.1222  	    ("TIMES" , ("Groups.times_class.times", eval_binop "#mult_")),
 20.1223  	    ("POWER", ("Atools.pow", eval_binop "#power_"))*)
 20.1224  	    ], errpatts = [],
 20.1225 -    rules = [Thm ("real_plus_binom_times" ,TermC.num_str @{thm real_plus_binom_times}),
 20.1226 +    rules = [Celem.Thm ("real_plus_binom_times" ,TermC.num_str @{thm real_plus_binom_times}),
 20.1227  	     (*"(a + b)*(a + b) = a ^ 2 + 2 * a * b + b ^ 2*)
 20.1228 -	     Thm ("real_plus_binom_times1" ,TermC.num_str @{thm real_plus_binom_times1}),
 20.1229 +	     Celem.Thm ("real_plus_binom_times1" ,TermC.num_str @{thm real_plus_binom_times1}),
 20.1230  	     (*"(a +  1*b)*(a + -1*b) = a^^^2 + -1*b^^^2"*)
 20.1231 -	     Thm ("real_plus_binom_times2" ,TermC.num_str @{thm real_plus_binom_times2}),
 20.1232 +	     Celem.Thm ("real_plus_binom_times2" ,TermC.num_str @{thm real_plus_binom_times2}),
 20.1233  	     (*"(a + -1*b)*(a +  1*b) = a^^^2 + -1*b^^^2"*)
 20.1234  
 20.1235 -	     Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),(*"1 * z = z"*)
 20.1236 +	     Celem.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),(*"1 * z = z"*)
 20.1237  
 20.1238 -             Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),
 20.1239 +             Celem.Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),
 20.1240  	     (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
 20.1241 -	     Thm ("distrib_left",TermC.num_str @{thm distrib_left}),
 20.1242 +	     Celem.Thm ("distrib_left",TermC.num_str @{thm distrib_left}),
 20.1243  	     (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
 20.1244  	       
 20.1245 -	     Thm ("mult_assoc", TermC.num_str @{thm mult.assoc}),
 20.1246 +	     Celem.Thm ("mult_assoc", TermC.num_str @{thm mult.assoc}),
 20.1247  	     (*"?z1.1 * ?z2.1 * ?z3. =1 ?z1.1 * (?z2.1 * ?z3.1)"*)
 20.1248 -	     Rls_ order_mult_rls_,
 20.1249 -	     (*Rls_ order_add_rls_,*)
 20.1250 +	     Celem.Rls_ order_mult_rls_,
 20.1251 +	     (*Celem.Rls_ order_add_rls_,*)
 20.1252  
 20.1253 -	     Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
 20.1254 -	     Calc ("Groups.times_class.times", eval_binop "#mult_"),
 20.1255 -	     Calc ("Atools.pow", eval_binop "#power_"),
 20.1256 +	     Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
 20.1257 +	     Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
 20.1258 +	     Celem.Calc ("Atools.pow", eval_binop "#power_"),
 20.1259  	     
 20.1260 -	     Thm ("sym_realpow_twoI",
 20.1261 +	     Celem.Thm ("sym_realpow_twoI",
 20.1262                     TermC.num_str (@{thm realpow_twoI} RS @{thm sym})),
 20.1263  	     (*"r1 * r1 = r1 ^^^ 2"*)
 20.1264 -	     Thm ("sym_real_mult_2",
 20.1265 +	     Celem.Thm ("sym_real_mult_2",
 20.1266                     TermC.num_str (@{thm real_mult_2} RS @{thm sym})),
 20.1267  	     (*"z1 + z1 = 2 * z1"*)
 20.1268 -	     Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),
 20.1269 +	     Celem.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),
 20.1270  	     (*"z1 + (z1 + k) = 2 * z1 + k"*)
 20.1271  
 20.1272 -	     Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
 20.1273 +	     Celem.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
 20.1274  	     (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
 20.1275 -	     Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),
 20.1276 +	     Celem.Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),
 20.1277  	     (*"[| l is_const; m is_const |] ==>  
 20.1278                                       l * n + (m * n + k) =  (l + m) * n + k"*)
 20.1279 -	     Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),
 20.1280 +	     Celem.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),
 20.1281  	     (*"m is_const ==> n + m * n = (1 + m) * n"*)
 20.1282 -	     Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), 
 20.1283 +	     Celem.Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), 
 20.1284  	     (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
 20.1285  
 20.1286 -	     Thm ("realpow_multI", TermC.num_str @{thm realpow_multI}),
 20.1287 +	     Celem.Thm ("realpow_multI", TermC.num_str @{thm realpow_multI}),
 20.1288  	     (*"(r * s) ^^^ n = r ^^^ n * s ^^^ n"*)
 20.1289  
 20.1290 -	     Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
 20.1291 -	     Calc ("Groups.times_class.times", eval_binop "#mult_"),
 20.1292 -	     Calc ("Atools.pow", eval_binop "#power_"),
 20.1293 +	     Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
 20.1294 +	     Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
 20.1295 +	     Celem.Calc ("Atools.pow", eval_binop "#power_"),
 20.1296  
 20.1297 -	     Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),(*"1 * z = z"*)
 20.1298 -	     Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),(*"0 * z = 0"*)
 20.1299 -	     Thm ("add_0_left",TermC.num_str @{thm add_0_left})(*0 + z = z*)
 20.1300 +	     Celem.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),(*"1 * z = z"*)
 20.1301 +	     Celem.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),(*"0 * z = 0"*)
 20.1302 +	     Celem.Thm ("add_0_left",TermC.num_str @{thm add_0_left})(*0 + z = z*)
 20.1303  
 20.1304 -	     (*Rls_ order_add_rls_*)
 20.1305 +	     (*Celem.Rls_ order_add_rls_*)
 20.1306  	     ],
 20.1307  
 20.1308 -    scr = EmptyScr}:rls;      
 20.1309 +    scr = Celem.EmptyScr};      
 20.1310  *}
 20.1311  
 20.1312  ML {* val prep_rls' = LTool.prep_rls @{theory} *}
 20.1313 @@ -1595,27 +1596,27 @@
 20.1314  
 20.1315  (** problems **)
 20.1316  setup {* KEStore_Elems.add_pbts
 20.1317 -  [(Specify.prep_pbt thy "pbl_simp_poly" [] e_pblID
 20.1318 +  [(Specify.prep_pbt thy "pbl_simp_poly" [] Celem.e_pblID
 20.1319        (["polynomial","simplification"],
 20.1320          [("#Given" ,["Term t_t"]),
 20.1321            ("#Where" ,["t_t is_polyexp"]),
 20.1322            ("#Find"  ,["normalform n_n"])],
 20.1323 -        append_rls "e_rls" e_rls [(*for preds in where_*)
 20.1324 -			  Calc ("Poly.is'_polyexp", eval_is_polyexp "")], 
 20.1325 +        Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*)
 20.1326 +			  Celem.Calc ("Poly.is'_polyexp", eval_is_polyexp "")], 
 20.1327          SOME "Simplify t_t", 
 20.1328          [["simplification","for_polynomials"]]))] *}
 20.1329  (** methods **)
 20.1330  setup {* KEStore_Elems.add_mets
 20.1331 -  [Specify.prep_met thy "met_simp_poly" [] e_metID
 20.1332 +  [Specify.prep_met thy "met_simp_poly" [] Celem.e_metID
 20.1333  	    (["simplification","for_polynomials"],
 20.1334  	      [("#Given" ,["Term t_t"]),
 20.1335  	        ("#Where" ,["t_t is_polyexp"]),
 20.1336  	        ("#Find"  ,["normalform n_n"])],
 20.1337 -	      {rew_ord'="tless_true", rls' = e_rls, calc = [], srls = e_rls, 
 20.1338 -	        prls = append_rls "simplification_for_polynomials_prls" e_rls 
 20.1339 +	      {rew_ord'="tless_true", rls' = Celem.e_rls, calc = [], srls = Celem.e_rls, 
 20.1340 +	        prls = Celem.append_rls "simplification_for_polynomials_prls" Celem.e_rls 
 20.1341  				    [(*for preds in where_*)
 20.1342 -				      Calc ("Poly.is'_polyexp",eval_is_polyexp"")],
 20.1343 -				  crls = e_rls, errpats = [], nrls = norm_Poly},
 20.1344 +				      Celem.Calc ("Poly.is'_polyexp",eval_is_polyexp"")],
 20.1345 +				  crls = Celem.e_rls, errpats = [], nrls = norm_Poly},
 20.1346  	      "Script SimplifyScript (t_t::real) =                " ^
 20.1347  	        "  ((Rewrite_Set norm_Poly False) t_t)")]
 20.1348  *}
    21.1 --- a/src/Tools/isac/Knowledge/PolyEq.thy	Thu Mar 15 10:17:44 2018 +0100
    21.2 +++ b/src/Tools/isac/Knowledge/PolyEq.thy	Thu Mar 15 12:42:04 2018 +0100
    21.3 @@ -376,107 +376,107 @@
    21.4  
    21.5  (*-------------------------rulse-------------------------*)
    21.6  val PolyEq_prls = (*3.10.02:just the following order due to subterm evaluation*)
    21.7 -  append_rls "PolyEq_prls" e_rls 
    21.8 -	     [Calc ("Atools.ident",eval_ident "#ident_"),
    21.9 -	      Calc ("Tools.matches",eval_matches ""),
   21.10 -	      Calc ("Tools.lhs"    ,eval_lhs ""),
   21.11 -	      Calc ("Tools.rhs"    ,eval_rhs ""),
   21.12 -	      Calc ("Poly.is'_expanded'_in",eval_is_expanded_in ""),
   21.13 -	      Calc ("Poly.is'_poly'_in",eval_is_poly_in ""),
   21.14 -	      Calc ("Poly.has'_degree'_in",eval_has_degree_in ""),    
   21.15 -              Calc ("Poly.is'_polyrat'_in",eval_is_polyrat_in ""),
   21.16 -	      (*Calc ("Atools.occurs'_in",eval_occurs_in ""),   *) 
   21.17 -	      (*Calc ("Atools.is'_const",eval_const "#is_const_"),*)
   21.18 -	      Calc ("HOL.eq",eval_equal "#equal_"),
   21.19 -              Calc ("RootEq.is'_rootTerm'_in",eval_is_rootTerm_in ""),
   21.20 -	      Calc ("RatEq.is'_ratequation'_in",eval_is_ratequation_in ""),
   21.21 -	      Thm ("not_true",TermC.num_str @{thm not_true}),
   21.22 -	      Thm ("not_false",TermC.num_str @{thm not_false}),
   21.23 -	      Thm ("and_true",TermC.num_str @{thm and_true}),
   21.24 -	      Thm ("and_false",TermC.num_str @{thm and_false}),
   21.25 -	      Thm ("or_true",TermC.num_str @{thm or_true}),
   21.26 -	      Thm ("or_false",TermC.num_str @{thm or_false})
   21.27 +  Celem.append_rls "PolyEq_prls" Celem.e_rls 
   21.28 +	     [Celem.Calc ("Atools.ident",eval_ident "#ident_"),
   21.29 +	      Celem.Calc ("Tools.matches",eval_matches ""),
   21.30 +	      Celem.Calc ("Tools.lhs"    ,eval_lhs ""),
   21.31 +	      Celem.Calc ("Tools.rhs"    ,eval_rhs ""),
   21.32 +	      Celem.Calc ("Poly.is'_expanded'_in",eval_is_expanded_in ""),
   21.33 +	      Celem.Calc ("Poly.is'_poly'_in",eval_is_poly_in ""),
   21.34 +	      Celem.Calc ("Poly.has'_degree'_in",eval_has_degree_in ""),    
   21.35 +              Celem.Calc ("Poly.is'_polyrat'_in",eval_is_polyrat_in ""),
   21.36 +	      (*Celem.Calc ("Atools.occurs'_in",eval_occurs_in ""),   *) 
   21.37 +	      (*Celem.Calc ("Atools.is'_const",eval_const "#is_const_"),*)
   21.38 +	      Celem.Calc ("HOL.eq",eval_equal "#equal_"),
   21.39 +              Celem.Calc ("RootEq.is'_rootTerm'_in",eval_is_rootTerm_in ""),
   21.40 +	      Celem.Calc ("RatEq.is'_ratequation'_in",eval_is_ratequation_in ""),
   21.41 +	      Celem.Thm ("not_true",TermC.num_str @{thm not_true}),
   21.42 +	      Celem.Thm ("not_false",TermC.num_str @{thm not_false}),
   21.43 +	      Celem.Thm ("and_true",TermC.num_str @{thm and_true}),
   21.44 +	      Celem.Thm ("and_false",TermC.num_str @{thm and_false}),
   21.45 +	      Celem.Thm ("or_true",TermC.num_str @{thm or_true}),
   21.46 +	      Celem.Thm ("or_false",TermC.num_str @{thm or_false})
   21.47  	       ];
   21.48  
   21.49  val PolyEq_erls = 
   21.50 -    merge_rls "PolyEq_erls" LinEq_erls
   21.51 -    (append_rls "ops_preds" calculate_Rational
   21.52 -		[Calc ("HOL.eq",eval_equal "#equal_"),
   21.53 -		 Thm ("plus_leq", TermC.num_str @{thm plus_leq}),
   21.54 -		 Thm ("minus_leq", TermC.num_str @{thm minus_leq}),
   21.55 -		 Thm ("rat_leq1", TermC.num_str @{thm rat_leq1}),
   21.56 -		 Thm ("rat_leq2", TermC.num_str @{thm rat_leq2}),
   21.57 -		 Thm ("rat_leq3", TermC.num_str @{thm rat_leq3})
   21.58 +    Celem.merge_rls "PolyEq_erls" LinEq_erls
   21.59 +    (Celem.append_rls "ops_preds" calculate_Rational
   21.60 +		[Celem.Calc ("HOL.eq",eval_equal "#equal_"),
   21.61 +		 Celem.Thm ("plus_leq", TermC.num_str @{thm plus_leq}),
   21.62 +		 Celem.Thm ("minus_leq", TermC.num_str @{thm minus_leq}),
   21.63 +		 Celem.Thm ("rat_leq1", TermC.num_str @{thm rat_leq1}),
   21.64 +		 Celem.Thm ("rat_leq2", TermC.num_str @{thm rat_leq2}),
   21.65 +		 Celem.Thm ("rat_leq3", TermC.num_str @{thm rat_leq3})
   21.66  		 ]);
   21.67  
   21.68  val PolyEq_crls = 
   21.69 -    merge_rls "PolyEq_crls" LinEq_crls
   21.70 -    (append_rls "ops_preds" calculate_Rational
   21.71 -		[Calc ("HOL.eq",eval_equal "#equal_"),
   21.72 -		 Thm ("plus_leq", TermC.num_str @{thm plus_leq}),
   21.73 -		 Thm ("minus_leq", TermC.num_str @{thm minus_leq}),
   21.74 -		 Thm ("rat_leq1", TermC.num_str @{thm rat_leq1}),
   21.75 -		 Thm ("rat_leq2", TermC.num_str @{thm rat_leq2}),
   21.76 -		 Thm ("rat_leq3", TermC.num_str @{thm rat_leq3})
   21.77 +    Celem.merge_rls "PolyEq_crls" LinEq_crls
   21.78 +    (Celem.append_rls "ops_preds" calculate_Rational
   21.79 +		[Celem.Calc ("HOL.eq",eval_equal "#equal_"),
   21.80 +		 Celem.Thm ("plus_leq", TermC.num_str @{thm plus_leq}),
   21.81 +		 Celem.Thm ("minus_leq", TermC.num_str @{thm minus_leq}),
   21.82 +		 Celem.Thm ("rat_leq1", TermC.num_str @{thm rat_leq1}),
   21.83 +		 Celem.Thm ("rat_leq2", TermC.num_str @{thm rat_leq2}),
   21.84 +		 Celem.Thm ("rat_leq3", TermC.num_str @{thm rat_leq3})
   21.85  		 ]);
   21.86  
   21.87  val cancel_leading_coeff = prep_rls'(
   21.88 -  Rls {id = "cancel_leading_coeff", preconds = [], 
   21.89 -       rew_ord = ("e_rew_ord",e_rew_ord),
   21.90 -      erls = PolyEq_erls, srls = Erls, calc = [], errpatts = [],
   21.91 +  Celem.Rls {id = "cancel_leading_coeff", preconds = [], 
   21.92 +       rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord),
   21.93 +      erls = PolyEq_erls, srls = Celem.Erls, calc = [], errpatts = [],
   21.94        rules = 
   21.95 -      [Thm ("cancel_leading_coeff1",TermC.num_str @{thm cancel_leading_coeff1}),
   21.96 -       Thm ("cancel_leading_coeff2",TermC.num_str @{thm cancel_leading_coeff2}),
   21.97 -       Thm ("cancel_leading_coeff3",TermC.num_str @{thm cancel_leading_coeff3}),
   21.98 -       Thm ("cancel_leading_coeff4",TermC.num_str @{thm cancel_leading_coeff4}),
   21.99 -       Thm ("cancel_leading_coeff5",TermC.num_str @{thm cancel_leading_coeff5}),
  21.100 -       Thm ("cancel_leading_coeff6",TermC.num_str @{thm cancel_leading_coeff6}),
  21.101 -       Thm ("cancel_leading_coeff7",TermC.num_str @{thm cancel_leading_coeff7}),
  21.102 -       Thm ("cancel_leading_coeff8",TermC.num_str @{thm cancel_leading_coeff8}),
  21.103 -       Thm ("cancel_leading_coeff9",TermC.num_str @{thm cancel_leading_coeff9}),
  21.104 -       Thm ("cancel_leading_coeff10",TermC.num_str @{thm cancel_leading_coeff10}),
  21.105 -       Thm ("cancel_leading_coeff11",TermC.num_str @{thm cancel_leading_coeff11}),
  21.106 -       Thm ("cancel_leading_coeff12",TermC.num_str @{thm cancel_leading_coeff12}),
  21.107 -       Thm ("cancel_leading_coeff13",TermC.num_str @{thm cancel_leading_coeff13})
  21.108 -       ],scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")}:rls);
  21.109 +      [Celem.Thm ("cancel_leading_coeff1",TermC.num_str @{thm cancel_leading_coeff1}),
  21.110 +       Celem.Thm ("cancel_leading_coeff2",TermC.num_str @{thm cancel_leading_coeff2}),
  21.111 +       Celem.Thm ("cancel_leading_coeff3",TermC.num_str @{thm cancel_leading_coeff3}),
  21.112 +       Celem.Thm ("cancel_leading_coeff4",TermC.num_str @{thm cancel_leading_coeff4}),
  21.113 +       Celem.Thm ("cancel_leading_coeff5",TermC.num_str @{thm cancel_leading_coeff5}),
  21.114 +       Celem.Thm ("cancel_leading_coeff6",TermC.num_str @{thm cancel_leading_coeff6}),
  21.115 +       Celem.Thm ("cancel_leading_coeff7",TermC.num_str @{thm cancel_leading_coeff7}),
  21.116 +       Celem.Thm ("cancel_leading_coeff8",TermC.num_str @{thm cancel_leading_coeff8}),
  21.117 +       Celem.Thm ("cancel_leading_coeff9",TermC.num_str @{thm cancel_leading_coeff9}),
  21.118 +       Celem.Thm ("cancel_leading_coeff10",TermC.num_str @{thm cancel_leading_coeff10}),
  21.119 +       Celem.Thm ("cancel_leading_coeff11",TermC.num_str @{thm cancel_leading_coeff11}),
  21.120 +       Celem.Thm ("cancel_leading_coeff12",TermC.num_str @{thm cancel_leading_coeff12}),
  21.121 +       Celem.Thm ("cancel_leading_coeff13",TermC.num_str @{thm cancel_leading_coeff13})
  21.122 +       ],scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")});
  21.123  
  21.124  val prep_rls' = LTool.prep_rls @{theory};
  21.125  *}
  21.126  ML{*
  21.127  val complete_square = prep_rls'(
  21.128 -  Rls {id = "complete_square", preconds = [], 
  21.129 -       rew_ord = ("e_rew_ord",e_rew_ord),
  21.130 -      erls = PolyEq_erls, srls = Erls, calc = [],  errpatts = [],
  21.131 -      rules = [Thm ("complete_square1",TermC.num_str @{thm complete_square1}),
  21.132 -	       Thm ("complete_square2",TermC.num_str @{thm complete_square2}),
  21.133 -	       Thm ("complete_square3",TermC.num_str @{thm complete_square3}),
  21.134 -	       Thm ("complete_square4",TermC.num_str @{thm complete_square4}),
  21.135 -	       Thm ("complete_square5",TermC.num_str @{thm complete_square5})
  21.136 +  Celem.Rls {id = "complete_square", preconds = [], 
  21.137 +       rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord),
  21.138 +      erls = PolyEq_erls, srls = Celem.Erls, calc = [],  errpatts = [],
  21.139 +      rules = [Celem.Thm ("complete_square1",TermC.num_str @{thm complete_square1}),
  21.140 +	       Celem.Thm ("complete_square2",TermC.num_str @{thm complete_square2}),
  21.141 +	       Celem.Thm ("complete_square3",TermC.num_str @{thm complete_square3}),
  21.142 +	       Celem.Thm ("complete_square4",TermC.num_str @{thm complete_square4}),
  21.143 +	       Celem.Thm ("complete_square5",TermC.num_str @{thm complete_square5})
  21.144  	       ],
  21.145 -      scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  21.146 -      }:rls);
  21.147 +      scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  21.148 +      });
  21.149  
  21.150  val polyeq_simplify = prep_rls'(
  21.151 -  Rls {id = "polyeq_simplify", preconds = [], 
  21.152 +  Celem.Rls {id = "polyeq_simplify", preconds = [], 
  21.153         rew_ord = ("termlessI",termlessI), 
  21.154         erls = PolyEq_erls, 
  21.155 -       srls = Erls, 
  21.156 +       srls = Celem.Erls, 
  21.157         calc = [], errpatts = [],
  21.158 -       rules = [Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1}),
  21.159 -		Thm  ("real_assoc_2",TermC.num_str @{thm real_assoc_2}),
  21.160 -		Thm  ("real_diff_minus",TermC.num_str @{thm real_diff_minus}),
  21.161 -		Thm  ("real_unari_minus",TermC.num_str @{thm real_unari_minus}),
  21.162 -		Thm  ("realpow_multI",TermC.num_str @{thm realpow_multI}),
  21.163 -		Calc ("Groups.plus_class.plus",eval_binop "#add_"),
  21.164 -		Calc ("Groups.minus_class.minus",eval_binop "#sub_"),
  21.165 -		Calc ("Groups.times_class.times",eval_binop "#mult_"),
  21.166 -		Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),
  21.167 -		Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"),
  21.168 -		Calc ("Atools.pow" ,eval_binop "#power_"),
  21.169 -                Rls_ reduce_012
  21.170 +       rules = [Celem.Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1}),
  21.171 +		Celem.Thm  ("real_assoc_2",TermC.num_str @{thm real_assoc_2}),
  21.172 +		Celem.Thm  ("real_diff_minus",TermC.num_str @{thm real_diff_minus}),
  21.173 +		Celem.Thm  ("real_unari_minus",TermC.num_str @{thm real_unari_minus}),
  21.174 +		Celem.Thm  ("realpow_multI",TermC.num_str @{thm realpow_multI}),
  21.175 +		Celem.Calc ("Groups.plus_class.plus",eval_binop "#add_"),
  21.176 +		Celem.Calc ("Groups.minus_class.minus",eval_binop "#sub_"),
  21.177 +		Celem.Calc ("Groups.times_class.times",eval_binop "#mult_"),
  21.178 +		Celem.Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),
  21.179 +		Celem.Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"),
  21.180 +		Celem.Calc ("Atools.pow" ,eval_binop "#power_"),
  21.181 +                Celem.Rls_ reduce_012
  21.182                  ],
  21.183 -       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  21.184 -       }:rls);
  21.185 +       scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  21.186 +       });
  21.187  *}
  21.188  setup {* KEStore_Elems.add_rlss 
  21.189    [("cancel_leading_coeff", (Context.theory_name @{theory}, cancel_leading_coeff)), 
  21.190 @@ -489,35 +489,35 @@
  21.191  (* -- d0 -- *)
  21.192  (*isolate the bound variable in an d0 equation; 'bdv' is a meta-constant*)
  21.193  val d0_polyeq_simplify = prep_rls'(
  21.194 -  Rls {id = "d0_polyeq_simplify", preconds = [],
  21.195 -       rew_ord = ("e_rew_ord",e_rew_ord),
  21.196 +  Celem.Rls {id = "d0_polyeq_simplify", preconds = [],
  21.197 +       rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord),
  21.198         erls = PolyEq_erls,
  21.199 -       srls = Erls, 
  21.200 +       srls = Celem.Erls, 
  21.201         calc = [], errpatts = [],
  21.202 -       rules = [Thm("d0_true",TermC.num_str @{thm d0_true}),
  21.203 -		Thm("d0_false",TermC.num_str @{thm  d0_false})
  21.204 +       rules = [Celem.Thm("d0_true",TermC.num_str @{thm d0_true}),
  21.205 +		Celem.Thm("d0_false",TermC.num_str @{thm  d0_false})
  21.206  		],
  21.207 -       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  21.208 -       }:rls);
  21.209 +       scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  21.210 +       });
  21.211  
  21.212  (* -- d1 -- *)
  21.213  (*isolate the bound variable in an d1 equation; 'bdv' is a meta-constant*)
  21.214  val d1_polyeq_simplify = prep_rls'(
  21.215 -  Rls {id = "d1_polyeq_simplify", preconds = [],
  21.216 -       rew_ord = ("e_rew_ord",e_rew_ord),
  21.217 +  Celem.Rls {id = "d1_polyeq_simplify", preconds = [],
  21.218 +       rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord),
  21.219         erls = PolyEq_erls,
  21.220 -       srls = Erls, 
  21.221 +       srls = Celem.Erls, 
  21.222         calc = [], errpatts = [],
  21.223         rules = [
  21.224 -		Thm("d1_isolate_add1",TermC.num_str @{thm d1_isolate_add1}), 
  21.225 +		Celem.Thm("d1_isolate_add1",TermC.num_str @{thm d1_isolate_add1}), 
  21.226  		(* a+bx=0 -> bx=-a *)
  21.227 -		Thm("d1_isolate_add2",TermC.num_str @{thm d1_isolate_add2}), 
  21.228 +		Celem.Thm("d1_isolate_add2",TermC.num_str @{thm d1_isolate_add2}), 
  21.229  		(* a+ x=0 ->  x=-a *)
  21.230 -		Thm("d1_isolate_div",TermC.num_str @{thm d1_isolate_div})    
  21.231 +		Celem.Thm("d1_isolate_div",TermC.num_str @{thm d1_isolate_div})    
  21.232  		(*   bx=c -> x=c/b *)  
  21.233  		],
  21.234 -       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  21.235 -       }:rls);
  21.236 +       scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  21.237 +       });
  21.238  
  21.239  *}
  21.240  subsection {* degree 2 *}
  21.241 @@ -525,290 +525,290 @@
  21.242  (* isolate the bound variable in an d2 equation with bdv only;
  21.243    "bdv" is a meta-constant substituted for the "x" below by isac's rewriter. *)
  21.244  val d2_polyeq_bdv_only_simplify = prep_rls'(
  21.245 -  Rls {id = "d2_polyeq_bdv_only_simplify", preconds = [], rew_ord = ("e_rew_ord",e_rew_ord),
  21.246 -    erls = PolyEq_erls, srls = Erls, calc = [], errpatts = [],
  21.247 +  Celem.Rls {id = "d2_polyeq_bdv_only_simplify", preconds = [], rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord),
  21.248 +    erls = PolyEq_erls, srls = Celem.Erls, calc = [], errpatts = [],
  21.249      rules =
  21.250 -      [Thm ("d2_prescind1", TermC.num_str @{thm d2_prescind1}), (*   ax+bx^2=0 -> x(a+bx)=0 *)
  21.251 -       Thm ("d2_prescind2", TermC.num_str @{thm d2_prescind2}), (*   ax+ x^2=0 -> x(a+ x)=0 *)
  21.252 -       Thm ("d2_prescind3", TermC.num_str @{thm d2_prescind3}), (*    x+bx^2=0 -> x(1+bx)=0 *)
  21.253 -       Thm ("d2_prescind4", TermC.num_str @{thm d2_prescind4}), (*    x+ x^2=0 -> x(1+ x)=0 *)
  21.254 -       Thm ("d2_sqrt_equation1", TermC.num_str @{thm d2_sqrt_equation1}),    (* x^2=c   -> x=+-sqrt(c) *)
  21.255 -       Thm ("d2_sqrt_equation1_neg", TermC.num_str @{thm d2_sqrt_equation1_neg}), (* [0<c] x^2=c  -> []*)
  21.256 -       Thm ("d2_sqrt_equation2", TermC.num_str @{thm d2_sqrt_equation2}),    (*  x^2=0 ->    x=0       *)
  21.257 -       Thm ("d2_reduce_equation1", TermC.num_str @{thm d2_reduce_equation1}),(* x(a+bx)=0 -> x=0 |a+bx=0*)
  21.258 -       Thm ("d2_reduce_equation2", TermC.num_str @{thm d2_reduce_equation2}),(* x(a+ x)=0 -> x=0 |a+ x=0*)
  21.259 -       Thm ("d2_isolate_div", TermC.num_str @{thm d2_isolate_div})           (* bx^2=c -> x^2=c/b      *)
  21.260 +      [Celem.Thm ("d2_prescind1", TermC.num_str @{thm d2_prescind1}), (*   ax+bx^2=0 -> x(a+bx)=0 *)
  21.261 +       Celem.Thm ("d2_prescind2", TermC.num_str @{thm d2_prescind2}), (*   ax+ x^2=0 -> x(a+ x)=0 *)
  21.262 +       Celem.Thm ("d2_prescind3", TermC.num_str @{thm d2_prescind3}), (*    x+bx^2=0 -> x(1+bx)=0 *)
  21.263 +       Celem.Thm ("d2_prescind4", TermC.num_str @{thm d2_prescind4}), (*    x+ x^2=0 -> x(1+ x)=0 *)
  21.264 +       Celem.Thm ("d2_sqrt_equation1", TermC.num_str @{thm d2_sqrt_equation1}),    (* x^2=c   -> x=+-sqrt(c) *)
  21.265 +       Celem.Thm ("d2_sqrt_equation1_neg", TermC.num_str @{thm d2_sqrt_equation1_neg}), (* [0<c] x^2=c  -> []*)
  21.266 +       Celem.Thm ("d2_sqrt_equation2", TermC.num_str @{thm d2_sqrt_equation2}),    (*  x^2=0 ->    x=0       *)
  21.267 +       Celem.Thm ("d2_reduce_equation1", TermC.num_str @{thm d2_reduce_equation1}),(* x(a+bx)=0 -> x=0 |a+bx=0*)
  21.268 +       Celem.Thm ("d2_reduce_equation2", TermC.num_str @{thm d2_reduce_equation2}),(* x(a+ x)=0 -> x=0 |a+ x=0*)
  21.269 +       Celem.Thm ("d2_isolate_div", TermC.num_str @{thm d2_isolate_div})           (* bx^2=c -> x^2=c/b      *)
  21.270         ],
  21.271 -       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  21.272 -       }:rls);
  21.273 +       scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  21.274 +       });
  21.275  *}
  21.276  ML{*
  21.277  (* isolate the bound variable in an d2 equation with sqrt only; 
  21.278     'bdv' is a meta-constant*)
  21.279  val d2_polyeq_sq_only_simplify = prep_rls'(
  21.280 -  Rls {id = "d2_polyeq_sq_only_simplify", preconds = [],
  21.281 -       rew_ord = ("e_rew_ord",e_rew_ord),
  21.282 +  Celem.Rls {id = "d2_polyeq_sq_only_simplify", preconds = [],
  21.283 +       rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord),
  21.284         erls = PolyEq_erls,
  21.285 -       srls = Erls, 
  21.286 +       srls = Celem.Erls, 
  21.287         calc = [], errpatts = [],
  21.288         (*asm_thm = [("d2_sqrt_equation1",""),("d2_sqrt_equation1_neg",""),
  21.289                    ("d2_isolate_div","")],*)
  21.290 -       rules = [Thm("d2_isolate_add1",TermC.num_str @{thm d2_isolate_add1}),
  21.291 +       rules = [Celem.Thm("d2_isolate_add1",TermC.num_str @{thm d2_isolate_add1}),
  21.292                  (* a+   bx^2=0 -> bx^2=(-1)a*)
  21.293 -		Thm("d2_isolate_add2",TermC.num_str @{thm d2_isolate_add2}),
  21.294 +		Celem.Thm("d2_isolate_add2",TermC.num_str @{thm d2_isolate_add2}),
  21.295                  (* a+    x^2=0 ->  x^2=(-1)a*)
  21.296 -		Thm("d2_sqrt_equation2",TermC.num_str @{thm d2_sqrt_equation2}),
  21.297 +		Celem.Thm("d2_sqrt_equation2",TermC.num_str @{thm d2_sqrt_equation2}),
  21.298                  (*  x^2=0 ->    x=0    *)
  21.299 -		Thm("d2_sqrt_equation1",TermC.num_str @{thm d2_sqrt_equation1}),
  21.300 +		Celem.Thm("d2_sqrt_equation1",TermC.num_str @{thm d2_sqrt_equation1}),
  21.301                  (* x^2=c   -> x=+-sqrt(c)*)
  21.302 -		Thm("d2_sqrt_equation1_neg",TermC.num_str @{thm d2_sqrt_equation1_neg}),
  21.303 +		Celem.Thm("d2_sqrt_equation1_neg",TermC.num_str @{thm d2_sqrt_equation1_neg}),
  21.304                  (* [c<0] x^2=c  -> x=[] *)
  21.305 -		Thm("d2_isolate_div",TermC.num_str @{thm d2_isolate_div})
  21.306 +		Celem.Thm("d2_isolate_div",TermC.num_str @{thm d2_isolate_div})
  21.307                   (* bx^2=c -> x^2=c/b*)
  21.308  		],
  21.309 -       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  21.310 -       }:rls);
  21.311 +       scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  21.312 +       });
  21.313  *}
  21.314  ML{*
  21.315  (* isolate the bound variable in an d2 equation with pqFormula;
  21.316     'bdv' is a meta-constant*)
  21.317  val d2_polyeq_pqFormula_simplify = prep_rls'(
  21.318 -  Rls {id = "d2_polyeq_pqFormula_simplify", preconds = [],
  21.319 -       rew_ord = ("e_rew_ord",e_rew_ord), erls = PolyEq_erls,
  21.320 -       srls = Erls, calc = [], errpatts = [],
  21.321 -       rules = [Thm("d2_pqformula1",TermC.num_str @{thm d2_pqformula1}),
  21.322 +  Celem.Rls {id = "d2_polyeq_pqFormula_simplify", preconds = [],
  21.323 +       rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord), erls = PolyEq_erls,
  21.324 +       srls = Celem.Erls, calc = [], errpatts = [],
  21.325 +       rules = [Celem.Thm("d2_pqformula1",TermC.num_str @{thm d2_pqformula1}),
  21.326                  (* q+px+ x^2=0 *)
  21.327 -		Thm("d2_pqformula1_neg",TermC.num_str @{thm d2_pqformula1_neg}),
  21.328 +		Celem.Thm("d2_pqformula1_neg",TermC.num_str @{thm d2_pqformula1_neg}),
  21.329                  (* q+px+ x^2=0 *)
  21.330 -		Thm("d2_pqformula2",TermC.num_str @{thm d2_pqformula2}), 
  21.331 +		Celem.Thm("d2_pqformula2",TermC.num_str @{thm d2_pqformula2}), 
  21.332                  (* q+px+1x^2=0 *)
  21.333 -		Thm("d2_pqformula2_neg",TermC.num_str @{thm d2_pqformula2_neg}),
  21.334 +		Celem.Thm("d2_pqformula2_neg",TermC.num_str @{thm d2_pqformula2_neg}),
  21.335                  (* q+px+1x^2=0 *)
  21.336 -		Thm("d2_pqformula3",TermC.num_str @{thm d2_pqformula3}),
  21.337 +		Celem.Thm("d2_pqformula3",TermC.num_str @{thm d2_pqformula3}),
  21.338                  (* q+ x+ x^2=0 *)
  21.339 -		Thm("d2_pqformula3_neg",TermC.num_str @{thm d2_pqformula3_neg}), 
  21.340 +		Celem.Thm("d2_pqformula3_neg",TermC.num_str @{thm d2_pqformula3_neg}), 
  21.341                  (* q+ x+ x^2=0 *)
  21.342 -		Thm("d2_pqformula4",TermC.num_str @{thm d2_pqformula4}),
  21.343 +		Celem.Thm("d2_pqformula4",TermC.num_str @{thm d2_pqformula4}),
  21.344                  (* q+ x+1x^2=0 *)
  21.345 -		Thm("d2_pqformula4_neg",TermC.num_str @{thm d2_pqformula4_neg}),
  21.346 +		Celem.Thm("d2_pqformula4_neg",TermC.num_str @{thm d2_pqformula4_neg}),
  21.347                  (* q+ x+1x^2=0 *)
  21.348 -		Thm("d2_pqformula5",TermC.num_str @{thm d2_pqformula5}),
  21.349 +		Celem.Thm("d2_pqformula5",TermC.num_str @{thm d2_pqformula5}),
  21.350                  (*   qx+ x^2=0 *)
  21.351 -		Thm("d2_pqformula6",TermC.num_str @{thm d2_pqformula6}),
  21.352 +		Celem.Thm("d2_pqformula6",TermC.num_str @{thm d2_pqformula6}),
  21.353                  (*   qx+1x^2=0 *)
  21.354 -		Thm("d2_pqformula7",TermC.num_str @{thm d2_pqformula7}),
  21.355 +		Celem.Thm("d2_pqformula7",TermC.num_str @{thm d2_pqformula7}),
  21.356                  (*    x+ x^2=0 *)
  21.357 -		Thm("d2_pqformula8",TermC.num_str @{thm d2_pqformula8}),
  21.358 +		Celem.Thm("d2_pqformula8",TermC.num_str @{thm d2_pqformula8}),
  21.359                  (*    x+1x^2=0 *)
  21.360 -		Thm("d2_pqformula9",TermC.num_str @{thm d2_pqformula9}),
  21.361 +		Celem.Thm("d2_pqformula9",TermC.num_str @{thm d2_pqformula9}),
  21.362                  (* q   +1x^2=0 *)
  21.363 -		Thm("d2_pqformula9_neg",TermC.num_str @{thm d2_pqformula9_neg}),
  21.364 +		Celem.Thm("d2_pqformula9_neg",TermC.num_str @{thm d2_pqformula9_neg}),
  21.365                  (* q   +1x^2=0 *)
  21.366 -		Thm("d2_pqformula10",TermC.num_str @{thm d2_pqformula10}),
  21.367 +		Celem.Thm("d2_pqformula10",TermC.num_str @{thm d2_pqformula10}),
  21.368                  (* q   + x^2=0 *)
  21.369 -		Thm("d2_pqformula10_neg",TermC.num_str @{thm d2_pqformula10_neg}),
  21.370 +		Celem.Thm("d2_pqformula10_neg",TermC.num_str @{thm d2_pqformula10_neg}),
  21.371                  (* q   + x^2=0 *)
  21.372 -		Thm("d2_sqrt_equation2",TermC.num_str @{thm d2_sqrt_equation2}),
  21.373 +		Celem.Thm("d2_sqrt_equation2",TermC.num_str @{thm d2_sqrt_equation2}),
  21.374                  (*       x^2=0 *)
  21.375 -		Thm("d2_sqrt_equation3",TermC.num_str @{thm d2_sqrt_equation3})
  21.376 +		Celem.Thm("d2_sqrt_equation3",TermC.num_str @{thm d2_sqrt_equation3})
  21.377                 (*      1x^2=0 *)
  21.378 -	       ],scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  21.379 -       }:rls);
  21.380 +	       ],scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  21.381 +       });
  21.382  *}
  21.383  ML{*
  21.384  (* isolate the bound variable in an d2 equation with abcFormula; 
  21.385     'bdv' is a meta-constant*)
  21.386  val d2_polyeq_abcFormula_simplify = prep_rls'(
  21.387 -  Rls {id = "d2_polyeq_abcFormula_simplify", preconds = [],
  21.388 -       rew_ord = ("e_rew_ord",e_rew_ord), erls = PolyEq_erls,
  21.389 -       srls = Erls, calc = [], errpatts = [],
  21.390 -       rules = [Thm("d2_abcformula1",TermC.num_str @{thm d2_abcformula1}),
  21.391 +  Celem.Rls {id = "d2_polyeq_abcFormula_simplify", preconds = [],
  21.392 +       rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord), erls = PolyEq_erls,
  21.393 +       srls = Celem.Erls, calc = [], errpatts = [],
  21.394 +       rules = [Celem.Thm("d2_abcformula1",TermC.num_str @{thm d2_abcformula1}),
  21.395                  (*c+bx+cx^2=0 *)
  21.396 -		Thm("d2_abcformula1_neg",TermC.num_str @{thm d2_abcformula1_neg}),
  21.397 +		Celem.Thm("d2_abcformula1_neg",TermC.num_str @{thm d2_abcformula1_neg}),
  21.398                  (*c+bx+cx^2=0 *)
  21.399 -		Thm("d2_abcformula2",TermC.num_str @{thm d2_abcformula2}),
  21.400 +		Celem.Thm("d2_abcformula2",TermC.num_str @{thm d2_abcformula2}),
  21.401                  (*c+ x+cx^2=0 *)
  21.402 -		Thm("d2_abcformula2_neg",TermC.num_str @{thm d2_abcformula2_neg}),
  21.403 +		Celem.Thm("d2_abcformula2_neg",TermC.num_str @{thm d2_abcformula2_neg}),
  21.404                  (*c+ x+cx^2=0 *)
  21.405 -		Thm("d2_abcformula3",TermC.num_str @{thm d2_abcformula3}), 
  21.406 +		Celem.Thm("d2_abcformula3",TermC.num_str @{thm d2_abcformula3}), 
  21.407                  (*c+bx+ x^2=0 *)
  21.408 -		Thm("d2_abcformula3_neg",TermC.num_str @{thm d2_abcformula3_neg}),
  21.409 +		Celem.Thm("d2_abcformula3_neg",TermC.num_str @{thm d2_abcformula3_neg}),
  21.410                  (*c+bx+ x^2=0 *)
  21.411 -		Thm("d2_abcformula4",TermC.num_str @{thm d2_abcformula4}),
  21.412 +		Celem.Thm("d2_abcformula4",TermC.num_str @{thm d2_abcformula4}),
  21.413                  (*c+ x+ x^2=0 *)
  21.414 -		Thm("d2_abcformula4_neg",TermC.num_str @{thm d2_abcformula4_neg}),
  21.415 +		Celem.Thm("d2_abcformula4_neg",TermC.num_str @{thm d2_abcformula4_neg}),
  21.416                  (*c+ x+ x^2=0 *)
  21.417 -		Thm("d2_abcformula5",TermC.num_str @{thm d2_abcformula5}),
  21.418 +		Celem.Thm("d2_abcformula5",TermC.num_str @{thm d2_abcformula5}),
  21.419                  (*c+   cx^2=0 *)
  21.420 -		Thm("d2_abcformula5_neg",TermC.num_str @{thm d2_abcformula5_neg}),
  21.421 +		Celem.Thm("d2_abcformula5_neg",TermC.num_str @{thm d2_abcformula5_neg}),
  21.422                  (*c+   cx^2=0 *)
  21.423 -		Thm("d2_abcformula6",TermC.num_str @{thm d2_abcformula6}),
  21.424 +		Celem.Thm("d2_abcformula6",TermC.num_str @{thm d2_abcformula6}),
  21.425                  (*c+    x^2=0 *)
  21.426 -		Thm("d2_abcformula6_neg",TermC.num_str @{thm d2_abcformula6_neg}),
  21.427 +		Celem.Thm("d2_abcformula6_neg",TermC.num_str @{thm d2_abcformula6_neg}),
  21.428                  (*c+    x^2=0 *)
  21.429 -		Thm("d2_abcformula7",TermC.num_str @{thm d2_abcformula7}),
  21.430 +		Celem.Thm("d2_abcformula7",TermC.num_str @{thm d2_abcformula7}),
  21.431                  (*  bx+ax^2=0 *)
  21.432 -		Thm("d2_abcformula8",TermC.num_str @{thm d2_abcformula8}),
  21.433 +		Celem.Thm("d2_abcformula8",TermC.num_str @{thm d2_abcformula8}),
  21.434                  (*  bx+ x^2=0 *)
  21.435 -		Thm("d2_abcformula9",TermC.num_str @{thm d2_abcformula9}),
  21.436 +		Celem.Thm("d2_abcformula9",TermC.num_str @{thm d2_abcformula9}),
  21.437                  (*   x+ax^2=0 *)
  21.438 -		Thm("d2_abcformula10",TermC.num_str @{thm d2_abcformula10}),
  21.439 +		Celem.Thm("d2_abcformula10",TermC.num_str @{thm d2_abcformula10}),
  21.440                  (*   x+ x^2=0 *)
  21.441 -		Thm("d2_sqrt_equation2",TermC.num_str @{thm d2_sqrt_equation2}),
  21.442 +		Celem.Thm("d2_sqrt_equation2",TermC.num_str @{thm d2_sqrt_equation2}),
  21.443                  (*      x^2=0 *)  
  21.444 -		Thm("d2_sqrt_equation3",TermC.num_str @{thm d2_sqrt_equation3})
  21.445 +		Celem.Thm("d2_sqrt_equation3",TermC.num_str @{thm d2_sqrt_equation3})
  21.446                 (*     bx^2=0 *)  
  21.447  	       ],
  21.448 -       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  21.449 -       }:rls);
  21.450 +       scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  21.451 +       });
  21.452  *}
  21.453  ML{*
  21.454  
  21.455  (* isolate the bound variable in an d2 equation; 
  21.456     'bdv' is a meta-constant*)
  21.457  val d2_polyeq_simplify = prep_rls'(
  21.458 -  Rls {id = "d2_polyeq_simplify", preconds = [],
  21.459 -       rew_ord = ("e_rew_ord",e_rew_ord), erls = PolyEq_erls,
  21.460 -       srls = Erls, calc = [], errpatts = [],
  21.461 -       rules = [Thm("d2_pqformula1",TermC.num_str @{thm d2_pqformula1}),
  21.462 +  Celem.Rls {id = "d2_polyeq_simplify", preconds = [],
  21.463 +       rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord), erls = PolyEq_erls,
  21.464 +       srls = Celem.Erls, calc = [], errpatts = [],
  21.465 +       rules = [Celem.Thm("d2_pqformula1",TermC.num_str @{thm d2_pqformula1}),
  21.466                  (* p+qx+ x^2=0 *)
  21.467 -		Thm("d2_pqformula1_neg",TermC.num_str @{thm d2_pqformula1_neg}),
  21.468 +		Celem.Thm("d2_pqformula1_neg",TermC.num_str @{thm d2_pqformula1_neg}),
  21.469                  (* p+qx+ x^2=0 *)
  21.470 -		Thm("d2_pqformula2",TermC.num_str @{thm d2_pqformula2}),
  21.471 +		Celem.Thm("d2_pqformula2",TermC.num_str @{thm d2_pqformula2}),
  21.472                  (* p+qx+1x^2=0 *)
  21.473 -		Thm("d2_pqformula2_neg",TermC.num_str @{thm d2_pqformula2_neg}),
  21.474 +		Celem.Thm("d2_pqformula2_neg",TermC.num_str @{thm d2_pqformula2_neg}),
  21.475                  (* p+qx+1x^2=0 *)
  21.476 -		Thm("d2_pqformula3",TermC.num_str @{thm d2_pqformula3}),
  21.477 +		Celem.Thm("d2_pqformula3",TermC.num_str @{thm d2_pqformula3}),
  21.478                  (* p+ x+ x^2=0 *)
  21.479 -		Thm("d2_pqformula3_neg",TermC.num_str @{thm d2_pqformula3_neg}),
  21.480 +		Celem.Thm("d2_pqformula3_neg",TermC.num_str @{thm d2_pqformula3_neg}),
  21.481                  (* p+ x+ x^2=0 *)
  21.482 -		Thm("d2_pqformula4",TermC.num_str @{thm d2_pqformula4}), 
  21.483 +		Celem.Thm("d2_pqformula4",TermC.num_str @{thm d2_pqformula4}), 
  21.484                  (* p+ x+1x^2=0 *)
  21.485 -		Thm("d2_pqformula4_neg",TermC.num_str @{thm d2_pqformula4_neg}),
  21.486 +		Celem.Thm("d2_pqformula4_neg",TermC.num_str @{thm d2_pqformula4_neg}),
  21.487                  (* p+ x+1x^2=0 *)
  21.488 -		Thm("d2_abcformula1",TermC.num_str @{thm d2_abcformula1}),
  21.489 +		Celem.Thm("d2_abcformula1",TermC.num_str @{thm d2_abcformula1}),
  21.490                  (* c+bx+cx^2=0 *)
  21.491 -		Thm("d2_abcformula1_neg",TermC.num_str @{thm d2_abcformula1_neg}),
  21.492 +		Celem.Thm("d2_abcformula1_neg",TermC.num_str @{thm d2_abcformula1_neg}),
  21.493                  (* c+bx+cx^2=0 *)
  21.494 -		Thm("d2_abcformula2",TermC.num_str @{thm d2_abcformula2}),
  21.495 +		Celem.Thm("d2_abcformula2",TermC.num_str @{thm d2_abcformula2}),
  21.496                  (* c+ x+cx^2=0 *)
  21.497 -		Thm("d2_abcformula2_neg",TermC.num_str @{thm d2_abcformula2_neg}),
  21.498 +		Celem.Thm("d2_abcformula2_neg",TermC.num_str @{thm d2_abcformula2_neg}),
  21.499                  (* c+ x+cx^2=0 *)
  21.500 -		Thm("d2_prescind1",TermC.num_str @{thm d2_prescind1}),
  21.501 +		Celem.Thm("d2_prescind1",TermC.num_str @{thm d2_prescind1}),
  21.502                  (*   ax+bx^2=0 -> x(a+bx)=0 *)
  21.503 -		Thm("d2_prescind2",TermC.num_str @{thm d2_prescind2}),
  21.504 +		Celem.Thm("d2_prescind2",TermC.num_str @{thm d2_prescind2}),
  21.505                  (*   ax+ x^2=0 -> x(a+ x)=0 *)
  21.506 -		Thm("d2_prescind3",TermC.num_str @{thm d2_prescind3}),
  21.507 +		Celem.Thm("d2_prescind3",TermC.num_str @{thm d2_prescind3}),
  21.508                  (*    x+bx^2=0 -> x(1+bx)=0 *)
  21.509 -		Thm("d2_prescind4",TermC.num_str @{thm d2_prescind4}),
  21.510 +		Celem.Thm("d2_prescind4",TermC.num_str @{thm d2_prescind4}),
  21.511                  (*    x+ x^2=0 -> x(1+ x)=0 *)
  21.512 -		Thm("d2_isolate_add1",TermC.num_str @{thm d2_isolate_add1}),
  21.513 +		Celem.Thm("d2_isolate_add1",TermC.num_str @{thm d2_isolate_add1}),
  21.514                  (* a+   bx^2=0 -> bx^2=(-1)a*)
  21.515 -		Thm("d2_isolate_add2",TermC.num_str @{thm d2_isolate_add2}),
  21.516 +		Celem.Thm("d2_isolate_add2",TermC.num_str @{thm d2_isolate_add2}),
  21.517                  (* a+    x^2=0 ->  x^2=(-1)a*)
  21.518 -		Thm("d2_sqrt_equation1",TermC.num_str @{thm d2_sqrt_equation1}),
  21.519 +		Celem.Thm("d2_sqrt_equation1",TermC.num_str @{thm d2_sqrt_equation1}),
  21.520                  (* x^2=c   -> x=+-sqrt(c)*)
  21.521 -		Thm("d2_sqrt_equation1_neg",TermC.num_str @{thm d2_sqrt_equation1_neg}),
  21.522 +		Celem.Thm("d2_sqrt_equation1_neg",TermC.num_str @{thm d2_sqrt_equation1_neg}),
  21.523                  (* [c<0] x^2=c   -> x=[]*)
  21.524 -		Thm("d2_sqrt_equation2",TermC.num_str @{thm d2_sqrt_equation2}),
  21.525 +		Celem.Thm("d2_sqrt_equation2",TermC.num_str @{thm d2_sqrt_equation2}),
  21.526                  (*  x^2=0 ->    x=0    *)
  21.527 -		Thm("d2_reduce_equation1",TermC.num_str @{thm d2_reduce_equation1}),
  21.528 +		Celem.Thm("d2_reduce_equation1",TermC.num_str @{thm d2_reduce_equation1}),
  21.529                  (* x(a+bx)=0 -> x=0 | a+bx=0*)
  21.530 -		Thm("d2_reduce_equation2",TermC.num_str @{thm d2_reduce_equation2}),
  21.531 +		Celem.Thm("d2_reduce_equation2",TermC.num_str @{thm d2_reduce_equation2}),
  21.532                  (* x(a+ x)=0 -> x=0 | a+ x=0*)
  21.533 -		Thm("d2_isolate_div",TermC.num_str @{thm d2_isolate_div})
  21.534 +		Celem.Thm("d2_isolate_div",TermC.num_str @{thm d2_isolate_div})
  21.535                 (* bx^2=c -> x^2=c/b*)
  21.536  	       ],
  21.537 -       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  21.538 -      }:rls);
  21.539 +       scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  21.540 +      });
  21.541  *}
  21.542  ML{*
  21.543  
  21.544  (* -- d3 -- *)
  21.545  (* isolate the bound variable in an d3 equation; 'bdv' is a meta-constant *)
  21.546  val d3_polyeq_simplify = prep_rls'(
  21.547 -  Rls {id = "d3_polyeq_simplify", preconds = [],
  21.548 -       rew_ord = ("e_rew_ord",e_rew_ord), erls = PolyEq_erls,
  21.549 -       srls = Erls, calc = [], errpatts = [],
  21.550 +  Celem.Rls {id = "d3_polyeq_simplify", preconds = [],
  21.551 +       rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord), erls = PolyEq_erls,
  21.552 +       srls = Celem.Erls, calc = [], errpatts = [],
  21.553         rules = 
  21.554 -       [Thm("d3_reduce_equation1",TermC.num_str @{thm d3_reduce_equation1}),
  21.555 +       [Celem.Thm("d3_reduce_equation1",TermC.num_str @{thm d3_reduce_equation1}),
  21.556  	(*a*bdv + b*bdv^^^2 + c*bdv^^^3=0) = 
  21.557          (bdv=0 | (a + b*bdv + c*bdv^^^2=0)*)
  21.558 -	Thm("d3_reduce_equation2",TermC.num_str @{thm d3_reduce_equation2}),
  21.559 +	Celem.Thm("d3_reduce_equation2",TermC.num_str @{thm d3_reduce_equation2}),
  21.560  	(*  bdv + b*bdv^^^2 + c*bdv^^^3=0) = 
  21.561          (bdv=0 | (1 + b*bdv + c*bdv^^^2=0)*)
  21.562 -	Thm("d3_reduce_equation3",TermC.num_str @{thm d3_reduce_equation3}),
  21.563 +	Celem.Thm("d3_reduce_equation3",TermC.num_str @{thm d3_reduce_equation3}),
  21.564  	(*a*bdv +   bdv^^^2 + c*bdv^^^3=0) = 
  21.565          (bdv=0 | (a +   bdv + c*bdv^^^2=0)*)
  21.566 -	Thm("d3_reduce_equation4",TermC.num_str @{thm d3_reduce_equation4}),
  21.567 +	Celem.Thm("d3_reduce_equation4",TermC.num_str @{thm d3_reduce_equation4}),
  21.568  	(*  bdv +   bdv^^^2 + c*bdv^^^3=0) = 
  21.569          (bdv=0 | (1 +   bdv + c*bdv^^^2=0)*)
  21.570 -	Thm("d3_reduce_equation5",TermC.num_str @{thm d3_reduce_equation5}),
  21.571 +	Celem.Thm("d3_reduce_equation5",TermC.num_str @{thm d3_reduce_equation5}),
  21.572  	(*a*bdv + b*bdv^^^2 +   bdv^^^3=0) = 
  21.573          (bdv=0 | (a + b*bdv +   bdv^^^2=0)*)
  21.574 -	Thm("d3_reduce_equation6",TermC.num_str @{thm d3_reduce_equation6}),
  21.575 +	Celem.Thm("d3_reduce_equation6",TermC.num_str @{thm d3_reduce_equation6}),
  21.576  	(*  bdv + b*bdv^^^2 +   bdv^^^3=0) = 
  21.577          (bdv=0 | (1 + b*bdv +   bdv^^^2=0)*)
  21.578 -	Thm("d3_reduce_equation7",TermC.num_str @{thm d3_reduce_equation7}),
  21.579 +	Celem.Thm("d3_reduce_equation7",TermC.num_str @{thm d3_reduce_equation7}),
  21.580  	     (*a*bdv +   bdv^^^2 +   bdv^^^3=0) = 
  21.581               (bdv=0 | (1 +   bdv +   bdv^^^2=0)*)
  21.582 -	Thm("d3_reduce_equation8",TermC.num_str @{thm d3_reduce_equation8}),
  21.583 +	Celem.Thm("d3_reduce_equation8",TermC.num_str @{thm d3_reduce_equation8}),
  21.584  	     (*  bdv +   bdv^^^2 +   bdv^^^3=0) = 
  21.585               (bdv=0 | (1 +   bdv +   bdv^^^2=0)*)
  21.586 -	Thm("d3_reduce_equation9",TermC.num_str @{thm d3_reduce_equation9}),
  21.587 +	Celem.Thm("d3_reduce_equation9",TermC.num_str @{thm d3_reduce_equation9}),
  21.588  	     (*a*bdv             + c*bdv^^^3=0) = 
  21.589               (bdv=0 | (a         + c*bdv^^^2=0)*)
  21.590 -	Thm("d3_reduce_equation10",TermC.num_str @{thm d3_reduce_equation10}),
  21.591 +	Celem.Thm("d3_reduce_equation10",TermC.num_str @{thm d3_reduce_equation10}),
  21.592  	     (*  bdv             + c*bdv^^^3=0) = 
  21.593               (bdv=0 | (1         + c*bdv^^^2=0)*)
  21.594 -	Thm("d3_reduce_equation11",TermC.num_str @{thm d3_reduce_equation11}),
  21.595 +	Celem.Thm("d3_reduce_equation11",TermC.num_str @{thm d3_reduce_equation11}),
  21.596  	     (*a*bdv             +   bdv^^^3=0) = 
  21.597               (bdv=0 | (a         +   bdv^^^2=0)*)
  21.598 -	Thm("d3_reduce_equation12",TermC.num_str @{thm d3_reduce_equation12}),
  21.599 +	Celem.Thm("d3_reduce_equation12",TermC.num_str @{thm d3_reduce_equation12}),
  21.600  	     (*  bdv             +   bdv^^^3=0) = 
  21.601               (bdv=0 | (1         +   bdv^^^2=0)*)
  21.602 -	Thm("d3_reduce_equation13",TermC.num_str @{thm d3_reduce_equation13}),
  21.603 +	Celem.Thm("d3_reduce_equation13",TermC.num_str @{thm d3_reduce_equation13}),
  21.604  	     (*        b*bdv^^^2 + c*bdv^^^3=0) = 
  21.605               (bdv=0 | (    b*bdv + c*bdv^^^2=0)*)
  21.606 -	Thm("d3_reduce_equation14",TermC.num_str @{thm d3_reduce_equation14}),
  21.607 +	Celem.Thm("d3_reduce_equation14",TermC.num_str @{thm d3_reduce_equation14}),
  21.608  	     (*          bdv^^^2 + c*bdv^^^3=0) = 
  21.609               (bdv=0 | (      bdv + c*bdv^^^2=0)*)
  21.610 -	Thm("d3_reduce_equation15",TermC.num_str @{thm d3_reduce_equation15}),
  21.611 +	Celem.Thm("d3_reduce_equation15",TermC.num_str @{thm d3_reduce_equation15}),
  21.612  	     (*        b*bdv^^^2 +   bdv^^^3=0) = 
  21.613               (bdv=0 | (    b*bdv +   bdv^^^2=0)*)
  21.614 -	Thm("d3_reduce_equation16",TermC.num_str @{thm d3_reduce_equation16}),
  21.615 +	Celem.Thm("d3_reduce_equation16",TermC.num_str @{thm d3_reduce_equation16}),
  21.616  	     (*          bdv^^^2 +   bdv^^^3=0) = 
  21.617               (bdv=0 | (      bdv +   bdv^^^2=0)*)
  21.618 -	Thm("d3_isolate_add1",TermC.num_str @{thm d3_isolate_add1}),
  21.619 +	Celem.Thm("d3_isolate_add1",TermC.num_str @{thm d3_isolate_add1}),
  21.620  	     (*[|Not(bdv occurs_in a)|] ==> (a + b*bdv^^^3=0) = 
  21.621                (bdv=0 | (b*bdv^^^3=a)*)
  21.622 -	Thm("d3_isolate_add2",TermC.num_str @{thm d3_isolate_add2}),
  21.623 +	Celem.Thm("d3_isolate_add2",TermC.num_str @{thm d3_isolate_add2}),
  21.624               (*[|Not(bdv occurs_in a)|] ==> (a +   bdv^^^3=0) = 
  21.625                (bdv=0 | (  bdv^^^3=a)*)
  21.626 -	Thm("d3_isolate_div",TermC.num_str @{thm d3_isolate_div}),
  21.627 +	Celem.Thm("d3_isolate_div",TermC.num_str @{thm d3_isolate_div}),
  21.628          (*[|Not(b=0)|] ==> (b*bdv^^^3=c) = (bdv^^^3=c/b*)
  21.629 -        Thm("d3_root_equation2",TermC.num_str @{thm d3_root_equation2}),
  21.630 +        Celem.Thm("d3_root_equation2",TermC.num_str @{thm d3_root_equation2}),
  21.631          (*(bdv^^^3=0) = (bdv=0) *)
  21.632 -	Thm("d3_root_equation1",TermC.num_str @{thm d3_root_equation1})
  21.633 +	Celem.Thm("d3_root_equation1",TermC.num_str @{thm d3_root_equation1})
  21.634         (*bdv^^^3=c) = (bdv = nroot 3 c*)
  21.635         ],
  21.636 -       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  21.637 -      }:rls);
  21.638 +       scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  21.639 +      });
  21.640  *}
  21.641  ML{*
  21.642  
  21.643  (* -- d4 -- *)
  21.644  (*isolate the bound variable in an d4 equation; 'bdv' is a meta-constant*)
  21.645  val d4_polyeq_simplify = prep_rls'(
  21.646 -  Rls {id = "d4_polyeq_simplify", preconds = [],
  21.647 -       rew_ord = ("e_rew_ord",e_rew_ord), erls = PolyEq_erls,
  21.648 -       srls = Erls, calc = [], errpatts = [],
  21.649 +  Celem.Rls {id = "d4_polyeq_simplify", preconds = [],
  21.650 +       rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord), erls = PolyEq_erls,
  21.651 +       srls = Celem.Erls, calc = [], errpatts = [],
  21.652         rules = 
  21.653 -       [Thm("d4_sub_u1",TermC.num_str @{thm d4_sub_u1})  
  21.654 +       [Celem.Thm("d4_sub_u1",TermC.num_str @{thm d4_sub_u1})  
  21.655         (* ax^4+bx^2+c=0 -> x=+-sqrt(ax^2+bx^+c) *)
  21.656         ],
  21.657 -       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  21.658 -      }:rls);
  21.659 +       scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  21.660 +      });
  21.661  *}
  21.662  setup {* KEStore_Elems.add_rlss 
  21.663    [("d0_polyeq_simplify", (Context.theory_name @{theory}, d0_polyeq_simplify)), 
  21.664 @@ -831,7 +831,7 @@
  21.665  *)
  21.666  *}
  21.667  setup {* KEStore_Elems.add_pbts
  21.668 -  [(Specify.prep_pbt thy "pbl_equ_univ_poly" [] e_pblID
  21.669 +  [(Specify.prep_pbt thy "pbl_equ_univ_poly" [] Celem.e_pblID
  21.670        (["polynomial","univariate","equation"],
  21.671          [("#Given" ,["equality e_e","solveFor v_v"]),
  21.672            ("#Where" ,["~((e_e::bool) is_ratequation_in (v_v::real))",
  21.673 @@ -840,7 +840,7 @@
  21.674            ("#Find"  ,["solutions v_v'i'"])],
  21.675          PolyEq_prls, SOME "solve (e_e::bool, v_v)", [])),
  21.676      (*--- d0 ---*)
  21.677 -    (Specify.prep_pbt thy "pbl_equ_univ_poly_deg0" [] e_pblID
  21.678 +    (Specify.prep_pbt thy "pbl_equ_univ_poly_deg0" [] Celem.e_pblID
  21.679        (["degree_0","polynomial","univariate","equation"],
  21.680          [("#Given" ,["equality e_e","solveFor v_v"]),
  21.681            ("#Where" ,["matches (?a = 0) e_e",
  21.682 @@ -849,7 +849,7 @@
  21.683            ("#Find"  ,["solutions v_v'i'"])],
  21.684          PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","solve_d0_polyeq_equation"]])),
  21.685      (*--- d1 ---*)
  21.686 -    (Specify.prep_pbt thy "pbl_equ_univ_poly_deg1" [] e_pblID
  21.687 +    (Specify.prep_pbt thy "pbl_equ_univ_poly_deg1" [] Celem.e_pblID
  21.688        (["degree_1","polynomial","univariate","equation"],
  21.689          [("#Given" ,["equality e_e","solveFor v_v"]),
  21.690            ("#Where" ,["matches (?a = 0) e_e",
  21.691 @@ -858,7 +858,7 @@
  21.692            ("#Find"  ,["solutions v_v'i'"])],
  21.693          PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","solve_d1_polyeq_equation"]])),
  21.694      (*--- d2 ---*)
  21.695 -    (Specify.prep_pbt thy "pbl_equ_univ_poly_deg2" [] e_pblID
  21.696 +    (Specify.prep_pbt thy "pbl_equ_univ_poly_deg2" [] Celem.e_pblID
  21.697        (["degree_2","polynomial","univariate","equation"],
  21.698          [("#Given" ,["equality e_e","solveFor v_v"]),
  21.699            ("#Where" ,["matches (?a = 0) e_e",
  21.700 @@ -866,7 +866,7 @@
  21.701  	          "((lhs e_e) has_degree_in v_v ) = 2"]),
  21.702            ("#Find"  ,["solutions v_v'i'"])],
  21.703          PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","solve_d2_polyeq_equation"]])),
  21.704 -    (Specify.prep_pbt thy "pbl_equ_univ_poly_deg2_sqonly" [] e_pblID
  21.705 +    (Specify.prep_pbt thy "pbl_equ_univ_poly_deg2_sqonly" [] Celem.e_pblID
  21.706        (["sq_only","degree_2","polynomial","univariate","equation"],
  21.707          [("#Given" ,["equality e_e","solveFor v_v"]),
  21.708            ("#Where" ,["matches ( ?a +    ?v_^^^2 = 0) e_e | " ^
  21.709 @@ -884,7 +884,7 @@
  21.710            ("#Find"  ,["solutions v_v'i'"])],
  21.711          PolyEq_prls, SOME "solve (e_e::bool, v_v)",
  21.712          [["PolyEq","solve_d2_polyeq_sqonly_equation"]])),
  21.713 -    (Specify.prep_pbt thy "pbl_equ_univ_poly_deg2_bdvonly" [] e_pblID
  21.714 +    (Specify.prep_pbt thy "pbl_equ_univ_poly_deg2_bdvonly" [] Celem.e_pblID
  21.715        (["bdv_only","degree_2","polynomial","univariate","equation"],
  21.716          [("#Given", ["equality e_e","solveFor v_v"]),
  21.717            ("#Where", ["matches (?a*?v_ +    ?v_^^^2 = 0) e_e | " ^
  21.718 @@ -896,14 +896,14 @@
  21.719            ("#Find", ["solutions v_v'i'"])],
  21.720          PolyEq_prls, SOME "solve (e_e::bool, v_v)",
  21.721          [["PolyEq","solve_d2_polyeq_bdvonly_equation"]])),
  21.722 -    (Specify.prep_pbt thy "pbl_equ_univ_poly_deg2_pq" [] e_pblID
  21.723 +    (Specify.prep_pbt thy "pbl_equ_univ_poly_deg2_pq" [] Celem.e_pblID
  21.724        (["pqFormula","degree_2","polynomial","univariate","equation"],
  21.725          [("#Given", ["equality e_e","solveFor v_v"]),
  21.726            ("#Where", ["matches (?a + 1*?v_^^^2 = 0) e_e | " ^
  21.727  	          "matches (?a +   ?v_^^^2 = 0) e_e"]),
  21.728            ("#Find", ["solutions v_v'i'"])],
  21.729          PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","solve_d2_polyeq_pq_equation"]])),
  21.730 -    (Specify.prep_pbt thy "pbl_equ_univ_poly_deg2_abc" [] e_pblID
  21.731 +    (Specify.prep_pbt thy "pbl_equ_univ_poly_deg2_abc" [] Celem.e_pblID
  21.732        (["abcFormula","degree_2","polynomial","univariate","equation"],
  21.733          [("#Given", ["equality e_e","solveFor v_v"]),
  21.734            ("#Where", ["matches (?a +    ?v_^^^2 = 0) e_e | " ^
  21.735 @@ -911,7 +911,7 @@
  21.736            ("#Find", ["solutions v_v'i'"])],
  21.737          PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","solve_d2_polyeq_abc_equation"]])),
  21.738      (*--- d3 ---*)
  21.739 -    (Specify.prep_pbt thy "pbl_equ_univ_poly_deg3" [] e_pblID
  21.740 +    (Specify.prep_pbt thy "pbl_equ_univ_poly_deg3" [] Celem.e_pblID
  21.741        (["degree_3","polynomial","univariate","equation"],
  21.742          [("#Given", ["equality e_e","solveFor v_v"]),
  21.743            ("#Where", ["matches (?a = 0) e_e",
  21.744 @@ -920,7 +920,7 @@
  21.745            ("#Find", ["solutions v_v'i'"])],
  21.746          PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","solve_d3_polyeq_equation"]])),
  21.747      (*--- d4 ---*)
  21.748 -    (Specify.prep_pbt thy "pbl_equ_univ_poly_deg4" [] e_pblID
  21.749 +    (Specify.prep_pbt thy "pbl_equ_univ_poly_deg4" [] Celem.e_pblID
  21.750        (["degree_4","polynomial","univariate","equation"],
  21.751          [("#Given", ["equality e_e","solveFor v_v"]),
  21.752            ("#Where", ["matches (?a = 0) e_e",
  21.753 @@ -929,7 +929,7 @@
  21.754            ("#Find", ["solutions v_v'i'"])],
  21.755          PolyEq_prls, SOME "solve (e_e::bool, v_v)", [(*["PolyEq","solve_d4_polyeq_equation"]*)])),
  21.756      (*--- normalise ---*)
  21.757 -    (Specify.prep_pbt thy "pbl_equ_univ_poly_norm" [] e_pblID
  21.758 +    (Specify.prep_pbt thy "pbl_equ_univ_poly_norm" [] Celem.e_pblID
  21.759        (["normalise","polynomial","univariate","equation"],
  21.760          [("#Given", ["equality e_e","solveFor v_v"]),
  21.761            ("#Where", ["(Not((matches (?a = 0 ) e_e ))) |" ^
  21.762 @@ -937,7 +937,7 @@
  21.763            ("#Find", ["solutions v_v'i'"])],
  21.764          PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","normalise_poly"]])),
  21.765      (*-------------------------expanded-----------------------*)
  21.766 -    (Specify.prep_pbt thy "pbl_equ_univ_expand" [] e_pblID
  21.767 +    (Specify.prep_pbt thy "pbl_equ_univ_expand" [] Celem.e_pblID
  21.768        (["expanded","univariate","equation"],
  21.769          [("#Given", ["equality e_e","solveFor v_v"]),
  21.770            ("#Where", ["matches (?a = 0) e_e",
  21.771 @@ -945,7 +945,7 @@
  21.772            ("#Find", ["solutions v_v'i'"])],
  21.773          PolyEq_prls, SOME "solve (e_e::bool, v_v)", [])),
  21.774      (*--- d2 ---*)
  21.775 -    (Specify.prep_pbt thy "pbl_equ_univ_expand_deg2" [] e_pblID
  21.776 +    (Specify.prep_pbt thy "pbl_equ_univ_expand_deg2" [] Celem.e_pblID
  21.777        (["degree_2","expanded","univariate","equation"],
  21.778          [("#Given", ["equality e_e","solveFor v_v"]),
  21.779            ("#Where", ["((lhs e_e) has_degree_in v_v) = 2"]),
  21.780 @@ -968,17 +968,17 @@
  21.781  
  21.782  text {* "-------------------------methods-----------------------" *}
  21.783  setup {* KEStore_Elems.add_mets
  21.784 -  [Specify.prep_met thy "met_polyeq" [] e_metID
  21.785 +  [Specify.prep_met thy "met_polyeq" [] Celem.e_metID
  21.786        (["PolyEq"], [],
  21.787 -        {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = e_rls, prls=e_rls,
  21.788 +        {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = Celem.e_rls, prls=Celem.e_rls,
  21.789            crls=PolyEq_crls, errpats = [], nrls = norm_Rational},
  21.790          "empty_script"),
  21.791 -    Specify.prep_met thy "met_polyeq_norm" [] e_metID
  21.792 +    Specify.prep_met thy "met_polyeq_norm" [] Celem.e_metID
  21.793        (["PolyEq","normalise_poly"],
  21.794          [("#Given" ,["equality e_e","solveFor v_v"]),
  21.795            ("#Where" ,["(Not((matches (?a = 0 ) e_e ))) |(Not(((lhs e_e) is_poly_in v_v)))"]),
  21.796            ("#Find"  ,["solutions v_v'i'"])],
  21.797 -        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=e_rls, prls=PolyEq_prls, calc=[],
  21.798 +        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Celem.e_rls, prls=PolyEq_prls, calc=[],
  21.799            crls=PolyEq_crls, errpats = [], nrls = norm_Rational},
  21.800          "Script Normalize_poly (e_e::bool) (v_v::real) =                     " ^
  21.801            "(let e_e =((Try         (Rewrite     all_left          False)) @@  " ^ 
  21.802 @@ -989,24 +989,24 @@
  21.803            "          (Try (Repeat (Rewrite_Set polyeq_simplify  False)))) e_e " ^
  21.804            " in (SubProblem (PolyEq',[polynomial,univariate,equation], [no_met])   " ^
  21.805            "                 [BOOL e_e, REAL v_v]))"),
  21.806 -    Specify.prep_met thy "met_polyeq_d0" [] e_metID
  21.807 +    Specify.prep_met thy "met_polyeq_d0" [] Celem.e_metID
  21.808        (["PolyEq","solve_d0_polyeq_equation"],
  21.809          [("#Given" ,["equality e_e","solveFor v_v"]),
  21.810            ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 0"]),
  21.811            ("#Find"  ,["solutions v_v'i'"])],
  21.812 -        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=e_rls, prls=PolyEq_prls,
  21.813 +        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Celem.e_rls, prls=PolyEq_prls,
  21.814            calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [],
  21.815            nrls = norm_Rational},
  21.816          "Script Solve_d0_polyeq_equation  (e_e::bool) (v_v::real)  = " ^
  21.817            "(let e_e =  ((Try (Rewrite_Set_Inst [(bdv,v_v::real)]      " ^
  21.818            "                  d0_polyeq_simplify  False))) e_e        " ^
  21.819            " in ((Or_to_List e_e)::bool list))"),
  21.820 -    Specify.prep_met thy "met_polyeq_d1" [] e_metID
  21.821 +    Specify.prep_met thy "met_polyeq_d1" [] Celem.e_metID
  21.822        (["PolyEq","solve_d1_polyeq_equation"],
  21.823          [("#Given" ,["equality e_e","solveFor v_v"]),
  21.824            ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 1"]),
  21.825            ("#Find"  ,["solutions v_v'i'"])],
  21.826 -        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=e_rls, prls=PolyEq_prls,
  21.827 +        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Celem.e_rls, prls=PolyEq_prls,
  21.828            calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [],
  21.829            nrls = norm_Rational},
  21.830          "Script Solve_d1_polyeq_equation  (e_e::bool) (v_v::real)  =   " ^
  21.831 @@ -1016,12 +1016,12 @@
  21.832            "            (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e;" ^
  21.833            " (L_L::bool list) = ((Or_to_List e_e)::bool list)            " ^
  21.834            " in Check_elementwise L_L {(v_v::real). Assumptions} )"),
  21.835 -    Specify.prep_met thy "met_polyeq_d22" [] e_metID
  21.836 +    Specify.prep_met thy "met_polyeq_d22" [] Celem.e_metID
  21.837        (["PolyEq","solve_d2_polyeq_equation"],
  21.838          [("#Given" ,["equality e_e","solveFor v_v"]),
  21.839            ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 2"]),
  21.840            ("#Find"  ,["solutions v_v'i'"])],
  21.841 -        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=e_rls, prls=PolyEq_prls,
  21.842 +        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Celem.e_rls, prls=PolyEq_prls,
  21.843            calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [],
  21.844            nrls = norm_Rational},
  21.845            "Script Solve_d2_polyeq_equation  (e_e::bool) (v_v::real) =      " ^
  21.846 @@ -1034,12 +1034,12 @@
  21.847              "            (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e;" ^
  21.848              " (L_L::bool list) = ((Or_to_List e_e)::bool list)              " ^
  21.849              " in Check_elementwise L_L {(v_v::real). Assumptions} )"),
  21.850 -    Specify.prep_met thy "met_polyeq_d2_bdvonly" [] e_metID
  21.851 +    Specify.prep_met thy "met_polyeq_d2_bdvonly" [] Celem.e_metID
  21.852        (["PolyEq","solve_d2_polyeq_bdvonly_equation"],
  21.853          [("#Given" ,["equality e_e","solveFor v_v"]),
  21.854            ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 2"]),
  21.855            ("#Find"  ,["solutions v_v'i'"])],
  21.856 -        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=e_rls, prls=PolyEq_prls,
  21.857 +        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Celem.e_rls, prls=PolyEq_prls,
  21.858            calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [],
  21.859            nrls = norm_Rational},
  21.860            "Script Solve_d2_polyeq_bdvonly_equation  (e_e::bool) (v_v::real) =" ^
  21.861 @@ -1052,12 +1052,12 @@
  21.862              "            (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e;" ^
  21.863              " (L_L::bool list) = ((Or_to_List e_e)::bool list)              " ^
  21.864              " in Check_elementwise L_L {(v_v::real). Assumptions} )"),
  21.865 -    Specify.prep_met thy "met_polyeq_d2_sqonly" [] e_metID
  21.866 +    Specify.prep_met thy "met_polyeq_d2_sqonly" [] Celem.e_metID
  21.867        (["PolyEq","solve_d2_polyeq_sqonly_equation"],
  21.868          [("#Given" ,["equality e_e","solveFor v_v"]),
  21.869            ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 2"]),
  21.870            ("#Find"  ,["solutions v_v'i'"])],
  21.871 -        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=e_rls, prls=PolyEq_prls,
  21.872 +        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Celem.e_rls, prls=PolyEq_prls,
  21.873            calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [],
  21.874            nrls = norm_Rational},
  21.875            "Script Solve_d2_polyeq_sqonly_equation  (e_e::bool) (v_v::real) =" ^
  21.876 @@ -1067,12 +1067,12 @@
  21.877              "            (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e; " ^
  21.878              " (L_L::bool list) = ((Or_to_List e_e)::bool list)               " ^
  21.879              " in Check_elementwise L_L {(v_v::real). Assumptions} )"),
  21.880 -    Specify.prep_met thy "met_polyeq_d2_pq" [] e_metID
  21.881 +    Specify.prep_met thy "met_polyeq_d2_pq" [] Celem.e_metID
  21.882        (["PolyEq","solve_d2_polyeq_pq_equation"],
  21.883          [("#Given" ,["equality e_e","solveFor v_v"]),
  21.884            ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 2"]),
  21.885            ("#Find"  ,["solutions v_v'i'"])],
  21.886 -        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=e_rls, prls=PolyEq_prls,
  21.887 +        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Celem.e_rls, prls=PolyEq_prls,
  21.888            calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [],
  21.889            nrls = norm_Rational},
  21.890            "Script Solve_d2_polyeq_pq_equation  (e_e::bool) (v_v::real) =   " ^
  21.891 @@ -1082,12 +1082,12 @@
  21.892              "            (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e;" ^
  21.893              " (L_L::bool list) = ((Or_to_List e_e)::bool list)              " ^
  21.894              " in Check_elementwise L_L {(v_v::real). Assumptions} )"),
  21.895 -    Specify.prep_met thy "met_polyeq_d2_abc" [] e_metID
  21.896 +    Specify.prep_met thy "met_polyeq_d2_abc" [] Celem.e_metID
  21.897        (["PolyEq","solve_d2_polyeq_abc_equation"],
  21.898          [("#Given" ,["equality e_e","solveFor v_v"]),
  21.899            ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 2"]),
  21.900            ("#Find"  ,["solutions v_v'i'"])],
  21.901 -        {rew_ord'="termlessI", rls'=PolyEq_erls,srls=e_rls, prls=PolyEq_prls,
  21.902 +        {rew_ord'="termlessI", rls'=PolyEq_erls,srls=Celem.e_rls, prls=PolyEq_prls,
  21.903            calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [],
  21.904            nrls = norm_Rational},
  21.905            "Script Solve_d2_polyeq_abc_equation  (e_e::bool) (v_v::real) =   " ^
  21.906 @@ -1097,12 +1097,12 @@
  21.907              "            (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e;" ^
  21.908              " (L_L::bool list) = ((Or_to_List e_e)::bool list)               " ^
  21.909              " in Check_elementwise L_L {(v_v::real). Assumptions} )"),
  21.910 -    Specify.prep_met thy "met_polyeq_d3" [] e_metID
  21.911 +    Specify.prep_met thy "met_polyeq_d3" [] Celem.e_metID
  21.912        (["PolyEq","solve_d3_polyeq_equation"],
  21.913          [("#Given" ,["equality e_e","solveFor v_v"]),
  21.914            ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 3"]),
  21.915            ("#Find"  ,["solutions v_v'i'"])],
  21.916 -        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=e_rls, prls=PolyEq_prls,
  21.917 +        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Celem.e_rls, prls=PolyEq_prls,
  21.918            calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [],
  21.919            nrls = norm_Rational},
  21.920          "Script Solve_d3_polyeq_equation  (e_e::bool) (v_v::real) =     " ^
  21.921 @@ -1121,12 +1121,12 @@
  21.922      (*.solves all expanded (ie. normalised) terms of degree 2.*) 
  21.923      (*Oct.02 restriction: 'eval_true 0 =< discriminant' ony for integer values
  21.924        by 'PolyEq_erls'; restricted until Float.thy is implemented*)
  21.925 -    Specify.prep_met thy "met_polyeq_complsq" [] e_metID
  21.926 +    Specify.prep_met thy "met_polyeq_complsq" [] Celem.e_metID
  21.927        (["PolyEq","complete_square"],
  21.928          [("#Given" ,["equality e_e","solveFor v_v"]),
  21.929            ("#Where" ,["matches (?a = 0) e_e", "((lhs e_e) has_degree_in v_v) = 2"]),
  21.930            ("#Find"  ,["solutions v_v'i'"])],
  21.931 -        {rew_ord'="termlessI",rls'=PolyEq_erls,srls=e_rls,prls=PolyEq_prls,
  21.932 +        {rew_ord'="termlessI",rls'=PolyEq_erls,srls=Celem.e_rls,prls=PolyEq_prls,
  21.933            calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [],
  21.934            nrls = norm_Rational},
  21.935          "Script Complete_square (e_e::bool) (v_v::real) =                         " ^
  21.936 @@ -1169,12 +1169,12 @@
  21.937  	    (Free (xstr,_)) => 
  21.938  		(if xstr = var then 1000*(the (TermC.int_of_str_opt pot)) else 3)
  21.939  	  | _ => error ("size_of_term' called with subst = "^
  21.940 -			      (term2str x)))
  21.941 +			      (Celem.term2str x)))
  21.942    | size_of_term' x (Free (subst,_)) =
  21.943      (case x of
  21.944  	    (Free (xstr,_)) => (if xstr = subst then 1000 else 1)
  21.945  	  | _ => error ("size_of_term' called with subst = "^
  21.946 -			  (term2str x)))
  21.947 +			  (Celem.term2str x)))
  21.948    | size_of_term' x (Abs (_,_,body)) = 1 + size_of_term' x body
  21.949    | size_of_term' x (f$t) = size_of_term' x f  +  size_of_term' x t
  21.950    | size_of_term' x _ = 1;
  21.951 @@ -1186,10 +1186,10 @@
  21.952       then 
  21.953         let
  21.954           val (f, ts) = strip_comb t and (g, us) = strip_comb u;
  21.955 -         val _ = tracing ("t= f@ts= \"" ^ term_to_string''' thy f ^ "\" @ \"[" ^
  21.956 -           commas (map (term_to_string''' thy) ts) ^ "]\"");
  21.957 -         val _ = tracing ("u= g@us= \"" ^ term_to_string''' thy g ^ "\" @ \"[" ^
  21.958 -           commas(map (term_to_string''' thy) us) ^ "]\"");
  21.959 +         val _ = tracing ("t= f@ts= \"" ^ Celem.term_to_string''' thy f ^ "\" @ \"[" ^
  21.960 +           commas (map (Celem.term_to_string''' thy) ts) ^ "]\"");
  21.961 +         val _ = tracing ("u= g@us= \"" ^ Celem.term_to_string''' thy g ^ "\" @ \"[" ^
  21.962 +           commas(map (Celem.term_to_string''' thy) us) ^ "]\"");
  21.963           val _ = tracing ("size_of_term(t,u)= (" ^ string_of_int (size_of_term' x t) ^ ", " ^
  21.964             string_of_int (size_of_term' x u) ^ ")");
  21.965           val _ = tracing ("hd_ord(f,g)      = " ^ (pr_ord o (hd_ord x)) (f,g));
  21.966 @@ -1210,110 +1210,110 @@
  21.967    prod_ord (prod_ord Term_Ord.indexname_ord Term_Ord.typ_ord) 
  21.968              int_ord (dest_hd' x f, dest_hd' x g)
  21.969  and terms_ord x str pr (ts, us) = 
  21.970 -    list_ord (term_ord' x pr (assoc_thy "Isac"))(ts, us);
  21.971 +    list_ord (term_ord' x pr (Celem.assoc_thy "Isac"))(ts, us);
  21.972  
  21.973  in
  21.974  
  21.975  fun ord_make_polynomial_in (pr:bool) thy subst tu = 
  21.976      let
  21.977 -	(* val _=tracing("*** subs variable is: "^(subst2str subst)); *)
  21.978 +	(* val _=tracing("*** subs variable is: "^(Celem.subst2str subst)); *)
  21.979      in
  21.980  	case subst of
  21.981  	    (_,x)::_ => (term_ord' x pr thy tu = LESS)
  21.982  	  | _ => error ("ord_make_polynomial_in called with subst = "^
  21.983 -			  (subst2str subst))
  21.984 +			  (Celem.subst2str subst))
  21.985      end;
  21.986  end;(*local*)
  21.987  
  21.988  *}
  21.989  ML{*
  21.990  val order_add_mult_in = prep_rls'(
  21.991 -  Rls{id = "order_add_mult_in", preconds = [], 
  21.992 +  Celem.Rls{id = "order_add_mult_in", preconds = [], 
  21.993        rew_ord = ("ord_make_polynomial_in",
  21.994  		 ord_make_polynomial_in false @{theory "Poly"}),
  21.995 -      erls = e_rls,srls = Erls,
  21.996 +      erls = Celem.e_rls,srls = Celem.Erls,
  21.997        calc = [], errpatts = [],
  21.998 -      rules = [Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
  21.999 +      rules = [Celem.Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
 21.1000  	       (* z * w = w * z *)
 21.1001 -	       Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
 21.1002 +	       Celem.Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
 21.1003  	       (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*)
 21.1004 -	       Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),		
 21.1005 +	       Celem.Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),		
 21.1006  	       (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*)
 21.1007 -	       Thm ("add_commute",TermC.num_str @{thm add.commute}),	
 21.1008 +	       Celem.Thm ("add_commute",TermC.num_str @{thm add.commute}),	
 21.1009  	       (*z + w = w + z*)
 21.1010 -	       Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}),
 21.1011 +	       Celem.Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}),
 21.1012  	       (*x + (y + z) = y + (x + z)*)
 21.1013 -	       Thm ("add_assoc",TermC.num_str @{thm add.assoc})	               
 21.1014 +	       Celem.Thm ("add_assoc",TermC.num_str @{thm add.assoc})	               
 21.1015  	       (*z1.0 + z2.0 + z3.0 = z1.0 + (z2.0 + z3.0)*)
 21.1016 -	       ], scr = EmptyScr}:rls);
 21.1017 +	       ], scr = Celem.EmptyScr});
 21.1018  
 21.1019  *}
 21.1020  ML{*
 21.1021  val collect_bdv = prep_rls'(
 21.1022 -  Rls{id = "collect_bdv", preconds = [], 
 21.1023 -      rew_ord = ("dummy_ord", dummy_ord),
 21.1024 -      erls = e_rls,srls = Erls,
 21.1025 +  Celem.Rls{id = "collect_bdv", preconds = [], 
 21.1026 +      rew_ord = ("dummy_ord", Celem.dummy_ord),
 21.1027 +      erls = Celem.e_rls,srls = Celem.Erls,
 21.1028        calc = [], errpatts = [],
 21.1029 -      rules = [Thm ("bdv_collect_1",TermC.num_str @{thm bdv_collect_1}),
 21.1030 -	       Thm ("bdv_collect_2",TermC.num_str @{thm bdv_collect_2}),
 21.1031 -	       Thm ("bdv_collect_3",TermC.num_str @{thm bdv_collect_3}),
 21.1032 +      rules = [Celem.Thm ("bdv_collect_1",TermC.num_str @{thm bdv_collect_1}),
 21.1033 +	       Celem.Thm ("bdv_collect_2",TermC.num_str @{thm bdv_collect_2}),
 21.1034 +	       Celem.Thm ("bdv_collect_3",TermC.num_str @{thm bdv_collect_3}),
 21.1035  
 21.1036 -	       Thm ("bdv_collect_assoc1_1",TermC.num_str @{thm bdv_collect_assoc1_1}),
 21.1037 -	       Thm ("bdv_collect_assoc1_2",TermC.num_str @{thm bdv_collect_assoc1_2}),
 21.1038 -	       Thm ("bdv_collect_assoc1_3",TermC.num_str @{thm bdv_collect_assoc1_3}),
 21.1039 +	       Celem.Thm ("bdv_collect_assoc1_1",TermC.num_str @{thm bdv_collect_assoc1_1}),
 21.1040 +	       Celem.Thm ("bdv_collect_assoc1_2",TermC.num_str @{thm bdv_collect_assoc1_2}),
 21.1041 +	       Celem.Thm ("bdv_collect_assoc1_3",TermC.num_str @{thm bdv_collect_assoc1_3}),
 21.1042  
 21.1043 -	       Thm ("bdv_collect_assoc2_1",TermC.num_str @{thm bdv_collect_assoc2_1}),
 21.1044 -	       Thm ("bdv_collect_assoc2_2",TermC.num_str @{thm bdv_collect_assoc2_2}),
 21.1045 -	       Thm ("bdv_collect_assoc2_3",TermC.num_str @{thm bdv_collect_assoc2_3}),
 21.1046 +	       Celem.Thm ("bdv_collect_assoc2_1",TermC.num_str @{thm bdv_collect_assoc2_1}),
 21.1047 +	       Celem.Thm ("bdv_collect_assoc2_2",TermC.num_str @{thm bdv_collect_assoc2_2}),
 21.1048 +	       Celem.Thm ("bdv_collect_assoc2_3",TermC.num_str @{thm bdv_collect_assoc2_3}),
 21.1049  
 21.1050  
 21.1051 -	       Thm ("bdv_n_collect_1",TermC.num_str @{thm bdv_n_collect_1}),
 21.1052 -	       Thm ("bdv_n_collect_2",TermC.num_str @{thm bdv_n_collect_2}),
 21.1053 -	       Thm ("bdv_n_collect_3",TermC.num_str @{thm bdv_n_collect_3}),
 21.1054 +	       Celem.Thm ("bdv_n_collect_1",TermC.num_str @{thm bdv_n_collect_1}),
 21.1055 +	       Celem.Thm ("bdv_n_collect_2",TermC.num_str @{thm bdv_n_collect_2}),
 21.1056 +	       Celem.Thm ("bdv_n_collect_3",TermC.num_str @{thm bdv_n_collect_3}),
 21.1057  
 21.1058 -	       Thm ("bdv_n_collect_assoc1_1",TermC.num_str @{thm bdv_n_collect_assoc1_1}),
 21.1059 -	       Thm ("bdv_n_collect_assoc1_2",TermC.num_str @{thm bdv_n_collect_assoc1_2}),
 21.1060 -	       Thm ("bdv_n_collect_assoc1_3",TermC.num_str @{thm bdv_n_collect_assoc1_3}),
 21.1061 +	       Celem.Thm ("bdv_n_collect_assoc1_1",TermC.num_str @{thm bdv_n_collect_assoc1_1}),
 21.1062 +	       Celem.Thm ("bdv_n_collect_assoc1_2",TermC.num_str @{thm bdv_n_collect_assoc1_2}),
 21.1063 +	       Celem.Thm ("bdv_n_collect_assoc1_3",TermC.num_str @{thm bdv_n_collect_assoc1_3}),
 21.1064  
 21.1065 -	       Thm ("bdv_n_collect_assoc2_1",TermC.num_str @{thm bdv_n_collect_assoc2_1}),
 21.1066 -	       Thm ("bdv_n_collect_assoc2_2",TermC.num_str @{thm bdv_n_collect_assoc2_2}),
 21.1067 -	       Thm ("bdv_n_collect_assoc2_3",TermC.num_str @{thm bdv_n_collect_assoc2_3})
 21.1068 -	       ], scr = EmptyScr}:rls);
 21.1069 +	       Celem.Thm ("bdv_n_collect_assoc2_1",TermC.num_str @{thm bdv_n_collect_assoc2_1}),
 21.1070 +	       Celem.Thm ("bdv_n_collect_assoc2_2",TermC.num_str @{thm bdv_n_collect_assoc2_2}),
 21.1071 +	       Celem.Thm ("bdv_n_collect_assoc2_3",TermC.num_str @{thm bdv_n_collect_assoc2_3})
 21.1072 +	       ], scr = Celem.EmptyScr});
 21.1073  
 21.1074  *}
 21.1075  ML{*
 21.1076  (*.transforms an arbitrary term without roots to a polynomial [4] 
 21.1077     according to knowledge/Poly.sml.*) 
 21.1078  val make_polynomial_in = prep_rls'(
 21.1079 -  Seq {id = "make_polynomial_in", preconds = []:term list, 
 21.1080 -       rew_ord = ("dummy_ord", dummy_ord),
 21.1081 -      erls = Atools_erls, srls = Erls,
 21.1082 +  Celem.Seq {id = "make_polynomial_in", preconds = []:term list, 
 21.1083 +       rew_ord = ("dummy_ord", Celem.dummy_ord),
 21.1084 +      erls = Atools_erls, srls = Celem.Erls,
 21.1085        calc = [], errpatts = [],
 21.1086 -      rules = [Rls_ expand_poly,
 21.1087 -	       Rls_ order_add_mult_in,
 21.1088 -	       Rls_ simplify_power,
 21.1089 -	       Rls_ collect_numerals,
 21.1090 -	       Rls_ reduce_012,
 21.1091 -	       Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}),
 21.1092 -	       Rls_ discard_parentheses,
 21.1093 -	       Rls_ collect_bdv
 21.1094 +      rules = [Celem.Rls_ expand_poly,
 21.1095 +	       Celem.Rls_ order_add_mult_in,
 21.1096 +	       Celem.Rls_ simplify_power,
 21.1097 +	       Celem.Rls_ collect_numerals,
 21.1098 +	       Celem.Rls_ reduce_012,
 21.1099 +	       Celem.Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}),
 21.1100 +	       Celem.Rls_ discard_parentheses,
 21.1101 +	       Celem.Rls_ collect_bdv
 21.1102  	       ],
 21.1103 -      scr = EmptyScr
 21.1104 -      }:rls);     
 21.1105 +      scr = Celem.EmptyScr
 21.1106 +      });     
 21.1107  
 21.1108  *}
 21.1109  ML{*
 21.1110  val separate_bdvs = 
 21.1111 -    append_rls "separate_bdvs"
 21.1112 +    Celem.append_rls "separate_bdvs"
 21.1113  	       collect_bdv
 21.1114 -	       [Thm ("separate_bdv", TermC.num_str @{thm separate_bdv}),
 21.1115 +	       [Celem.Thm ("separate_bdv", TermC.num_str @{thm separate_bdv}),
 21.1116  		(*"?a * ?bdv / ?b = ?a / ?b * ?bdv"*)
 21.1117 -		Thm ("separate_bdv_n", TermC.num_str @{thm separate_bdv_n}),
 21.1118 -		Thm ("separate_1_bdv", TermC.num_str @{thm separate_1_bdv}),
 21.1119 +		Celem.Thm ("separate_bdv_n", TermC.num_str @{thm separate_bdv_n}),
 21.1120 +		Celem.Thm ("separate_1_bdv", TermC.num_str @{thm separate_1_bdv}),
 21.1121  		(*"?bdv / ?b = (1 / ?b) * ?bdv"*)
 21.1122 -		Thm ("separate_1_bdv_n", TermC.num_str @{thm separate_1_bdv_n}),
 21.1123 +		Celem.Thm ("separate_1_bdv_n", TermC.num_str @{thm separate_1_bdv_n}),
 21.1124  		(*"?bdv ^^^ ?n / ?b = 1 / ?b * ?bdv ^^^ ?n"*)
 21.1125 -		Thm ("add_divide_distrib", 
 21.1126 +		Celem.Thm ("add_divide_distrib", 
 21.1127  		     TermC.num_str @{thm add_divide_distrib})
 21.1128  		(*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"
 21.1129  		      WN051031 DOES NOT BELONG TO HERE*)
 21.1130 @@ -1321,19 +1321,19 @@
 21.1131  *}
 21.1132  ML{*
 21.1133  val make_ratpoly_in = prep_rls'(
 21.1134 -  Seq {id = "make_ratpoly_in", preconds = []:term list, 
 21.1135 -       rew_ord = ("dummy_ord", dummy_ord),
 21.1136 -      erls = Atools_erls, srls = Erls,
 21.1137 +  Celem.Seq {id = "make_ratpoly_in", preconds = []:term list, 
 21.1138 +       rew_ord = ("dummy_ord", Celem.dummy_ord),
 21.1139 +      erls = Atools_erls, srls = Celem.Erls,
 21.1140        calc = [], errpatts = [],
 21.1141 -      rules = [Rls_ norm_Rational,
 21.1142 -	       Rls_ order_add_mult_in,
 21.1143 -	       Rls_ discard_parentheses,
 21.1144 -	       Rls_ separate_bdvs,
 21.1145 -	       (* Rls_ rearrange_assoc, WN060916 why does cancel_p not work?*)
 21.1146 -	       Rls_ cancel_p
 21.1147 -	       (*Calc ("Rings.divide_class.divide"  ,eval_cancel "#divide_e") too weak!*)
 21.1148 +      rules = [Celem.Rls_ norm_Rational,
 21.1149 +	       Celem.Rls_ order_add_mult_in,
 21.1150 +	       Celem.Rls_ discard_parentheses,
 21.1151 +	       Celem.Rls_ separate_bdvs,
 21.1152 +	       (* Celem.Rls_ rearrange_assoc, WN060916 why does cancel_p not work?*)
 21.1153 +	       Celem.Rls_ cancel_p
 21.1154 +	       (*Celem.Calc ("Rings.divide_class.divide"  ,eval_cancel "#divide_e") too weak!*)
 21.1155  	       ],
 21.1156 -      scr = EmptyScr}:rls);      
 21.1157 +      scr = Celem.EmptyScr});      
 21.1158  *}
 21.1159  setup {* KEStore_Elems.add_rlss 
 21.1160    [("order_add_mult_in", (Context.theory_name @{theory}, order_add_mult_in)), 
    22.1 --- a/src/Tools/isac/Knowledge/PolyMinus.thy	Thu Mar 15 10:17:44 2018 +0100
    22.2 +++ b/src/Tools/isac/Knowledge/PolyMinus.thy	Thu Mar 15 12:42:04 2018 +0100
    22.3 @@ -139,18 +139,18 @@
    22.4       if TermC.is_num b then
    22.5  	 if TermC.is_num a then (*123 kleiner 32 = True !!!*)
    22.6  	     if TermC.num_of_term a < TermC.num_of_term b then 
    22.7 -		 SOME ((term2str p) ^ " = True",
    22.8 +		 SOME ((Celem.term2str p) ^ " = True",
    22.9  		       HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
   22.10 -	     else SOME ((term2str p) ^ " = False",
   22.11 +	     else SOME ((Celem.term2str p) ^ " = False",
   22.12  			HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
   22.13  	 else (* -1 * -2 kleiner 0 *)
   22.14 -	     SOME ((term2str p) ^ " = False",
   22.15 +	     SOME ((Celem.term2str p) ^ " = False",
   22.16  		   HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
   22.17      else
   22.18  	if identifier a < identifier b then 
   22.19 -	     SOME ((term2str p) ^ " = True",
   22.20 +	     SOME ((Celem.term2str p) ^ " = True",
   22.21  		  HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
   22.22 -	else SOME ((term2str p) ^ " = False",
   22.23 +	else SOME ((Celem.term2str p) ^ " = False",
   22.24  		   HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
   22.25    | eval_kleiner _ _ _ _ =  NONE;
   22.26  
   22.27 @@ -178,9 +178,9 @@
   22.28  (*("ist_monom", ("PolyMinus.ist'_monom", eval_ist_monom ""))*)
   22.29  fun eval_ist_monom _ _ (p as (Const ("PolyMinus.ist'_monom",_) $ a)) _  =
   22.30      if ist_monom a  then 
   22.31 -	SOME ((term2str p) ^ " = True",
   22.32 +	SOME ((Celem.term2str p) ^ " = True",
   22.33  	      HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
   22.34 -    else SOME ((term2str p) ^ " = False",
   22.35 +    else SOME ((Celem.term2str p) ^ " = False",
   22.36  	       HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
   22.37    | eval_ist_monom _ _ _ _ =  NONE;
   22.38  
   22.39 @@ -190,200 +190,200 @@
   22.40  (** rulesets **)
   22.41  
   22.42  val erls_ordne_alphabetisch =
   22.43 -    append_rls "erls_ordne_alphabetisch" e_rls
   22.44 -	       [Calc ("PolyMinus.kleiner", eval_kleiner ""),
   22.45 -		Calc ("PolyMinus.ist'_monom", eval_ist_monom "")
   22.46 +    Celem.append_rls "erls_ordne_alphabetisch" Celem.e_rls
   22.47 +	       [Celem.Calc ("PolyMinus.kleiner", eval_kleiner ""),
   22.48 +		Celem.Calc ("PolyMinus.ist'_monom", eval_ist_monom "")
   22.49  		];
   22.50  
   22.51  val ordne_alphabetisch = 
   22.52 -  Rls{id = "ordne_alphabetisch", preconds = [], 
   22.53 -      rew_ord = ("dummy_ord", dummy_ord), srls = Erls, calc = [], errpatts = [],
   22.54 +  Celem.Rls{id = "ordne_alphabetisch", preconds = [], 
   22.55 +      rew_ord = ("dummy_ord", Celem.dummy_ord), srls = Celem.Erls, calc = [], errpatts = [],
   22.56        erls = erls_ordne_alphabetisch, 
   22.57 -      rules = [Thm ("tausche_plus",TermC.num_str @{thm tausche_plus}),
   22.58 +      rules = [Celem.Thm ("tausche_plus",TermC.num_str @{thm tausche_plus}),
   22.59  	       (*"b kleiner a ==> (b + a) = (a + b)"*)
   22.60 -	       Thm ("tausche_minus",TermC.num_str @{thm tausche_minus}),
   22.61 +	       Celem.Thm ("tausche_minus",TermC.num_str @{thm tausche_minus}),
   22.62  	       (*"b kleiner a ==> (b - a) = (-a + b)"*)
   22.63 -	       Thm ("tausche_vor_plus",TermC.num_str @{thm tausche_vor_plus}),
   22.64 +	       Celem.Thm ("tausche_vor_plus",TermC.num_str @{thm tausche_vor_plus}),
   22.65  	       (*"[| b ist_monom; a kleiner b  |] ==> (- b + a) = (a - b)"*)
   22.66 -	       Thm ("tausche_vor_minus",TermC.num_str @{thm tausche_vor_minus}),
   22.67 +	       Celem.Thm ("tausche_vor_minus",TermC.num_str @{thm tausche_vor_minus}),
   22.68  	       (*"[| b ist_monom; a kleiner b  |] ==> (- b - a) = (-a - b)"*)
   22.69 -	       Thm ("tausche_plus_plus",TermC.num_str @{thm tausche_plus_plus}),
   22.70 +	       Celem.Thm ("tausche_plus_plus",TermC.num_str @{thm tausche_plus_plus}),
   22.71  	       (*"c kleiner b ==> (a + c + b) = (a + b + c)"*)
   22.72 -	       Thm ("tausche_plus_minus",TermC.num_str @{thm tausche_plus_minus}),
   22.73 +	       Celem.Thm ("tausche_plus_minus",TermC.num_str @{thm tausche_plus_minus}),
   22.74  	       (*"c kleiner b ==> (a + c - b) = (a - b + c)"*)
   22.75 -	       Thm ("tausche_minus_plus",TermC.num_str @{thm tausche_minus_plus}),
   22.76 +	       Celem.Thm ("tausche_minus_plus",TermC.num_str @{thm tausche_minus_plus}),
   22.77  	       (*"c kleiner b ==> (a - c + b) = (a + b - c)"*)
   22.78 -	       Thm ("tausche_minus_minus",TermC.num_str @{thm tausche_minus_minus})
   22.79 +	       Celem.Thm ("tausche_minus_minus",TermC.num_str @{thm tausche_minus_minus})
   22.80  	       (*"c kleiner b ==> (a - c - b) = (a - b - c)"*)
   22.81 -	       ], scr = EmptyScr}:rls;
   22.82 +	       ], scr = Celem.EmptyScr};
   22.83  
   22.84  val fasse_zusammen = 
   22.85 -    Rls{id = "fasse_zusammen", preconds = [], 
   22.86 -	rew_ord = ("dummy_ord", dummy_ord),
   22.87 -	erls = append_rls "erls_fasse_zusammen" e_rls 
   22.88 -			  [Calc ("Atools.is'_const",eval_const "#is_const_")], 
   22.89 -	srls = Erls, calc = [], errpatts = [],
   22.90 +    Celem.Rls{id = "fasse_zusammen", preconds = [], 
   22.91 +	rew_ord = ("dummy_ord", Celem.dummy_ord),
   22.92 +	erls = Celem.append_rls "erls_fasse_zusammen" Celem.e_rls 
   22.93 +			  [Celem.Calc ("Atools.is'_const",eval_const "#is_const_")], 
   22.94 +	srls = Celem.Erls, calc = [], errpatts = [],
   22.95  	rules = 
   22.96 -	[Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
   22.97 +	[Celem.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
   22.98  	 (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
   22.99 -	 Thm ("real_num_collect_assoc_r",TermC.num_str @{thm real_num_collect_assoc_r}),
  22.100 +	 Celem.Thm ("real_num_collect_assoc_r",TermC.num_str @{thm real_num_collect_assoc_r}),
  22.101  	 (*"[| l is_const; m..|] ==>  (k + m * n) + l * n = k + (l + m)*n"*)
  22.102 -	 Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),	
  22.103 +	 Celem.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),	
  22.104  	 (*"m is_const ==> n + m * n = (1 + m) * n"*)
  22.105 -	 Thm ("real_one_collect_assoc_r",TermC.num_str @{thm real_one_collect_assoc_r}), 
  22.106 +	 Celem.Thm ("real_one_collect_assoc_r",TermC.num_str @{thm real_one_collect_assoc_r}), 
  22.107  	 (*"m is_const ==> (k + n) + m * n = k + (m + 1) * n"*)
  22.108  
  22.109  
  22.110 -	 Thm ("subtrahiere",TermC.num_str @{thm subtrahiere}),
  22.111 +	 Celem.Thm ("subtrahiere",TermC.num_str @{thm subtrahiere}),
  22.112  	 (*"[| l is_const; m is_const |] ==> m * v - l * v = (m - l) * v"*)
  22.113 -	 Thm ("subtrahiere_von_1",TermC.num_str @{thm subtrahiere_von_1}),
  22.114 +	 Celem.Thm ("subtrahiere_von_1",TermC.num_str @{thm subtrahiere_von_1}),
  22.115  	 (*"[| l is_const |] ==> v - l * v = (1 - l) * v"*)
  22.116 -	 Thm ("subtrahiere_1",TermC.num_str @{thm subtrahiere_1}),
  22.117 +	 Celem.Thm ("subtrahiere_1",TermC.num_str @{thm subtrahiere_1}),
  22.118  	 (*"[| l is_const; m is_const |] ==> m * v - v = (m - 1) * v"*)
  22.119  
  22.120 -	 Thm ("subtrahiere_x_plus_minus",TermC.num_str @{thm subtrahiere_x_plus_minus}), 
  22.121 +	 Celem.Thm ("subtrahiere_x_plus_minus",TermC.num_str @{thm subtrahiere_x_plus_minus}), 
  22.122  	 (*"[| l is_const; m..|] ==> (k + m * n) - l * n = k + ( m - l) * n"*)
  22.123 -	 Thm ("subtrahiere_x_plus1_minus",TermC.num_str @{thm subtrahiere_x_plus1_minus}),
  22.124 +	 Celem.Thm ("subtrahiere_x_plus1_minus",TermC.num_str @{thm subtrahiere_x_plus1_minus}),
  22.125  	 (*"[| l is_const |] ==> (x + v) - l * v = x + (1 - l) * v"*)
  22.126 -	 Thm ("subtrahiere_x_plus_minus1",TermC.num_str @{thm subtrahiere_x_plus_minus1}),
  22.127 +	 Celem.Thm ("subtrahiere_x_plus_minus1",TermC.num_str @{thm subtrahiere_x_plus_minus1}),
  22.128  	 (*"[| m is_const |] ==> (x + m * v) - v = x + (m - 1) * v"*)
  22.129  
  22.130 -	 Thm ("subtrahiere_x_minus_plus",TermC.num_str @{thm subtrahiere_x_minus_plus}), 
  22.131 +	 Celem.Thm ("subtrahiere_x_minus_plus",TermC.num_str @{thm subtrahiere_x_minus_plus}), 
  22.132  	 (*"[| l is_const; m..|] ==> (k - m * n) + l * n = k + (-m + l) * n"*)
  22.133 -	 Thm ("subtrahiere_x_minus1_plus",TermC.num_str @{thm subtrahiere_x_minus1_plus}),
  22.134 +	 Celem.Thm ("subtrahiere_x_minus1_plus",TermC.num_str @{thm subtrahiere_x_minus1_plus}),
  22.135  	 (*"[| l is_const |] ==> (x - v) + l * v = x + (-1 + l) * v"*)
  22.136 -	 Thm ("subtrahiere_x_minus_plus1",TermC.num_str @{thm subtrahiere_x_minus_plus1}),
  22.137 +	 Celem.Thm ("subtrahiere_x_minus_plus1",TermC.num_str @{thm subtrahiere_x_minus_plus1}),
  22.138  	 (*"[| m is_const |] ==> (x - m * v) + v = x + (-m + 1) * v"*)
  22.139  
  22.140 -	 Thm ("subtrahiere_x_minus_minus",TermC.num_str @{thm subtrahiere_x_minus_minus}), 
  22.141 +	 Celem.Thm ("subtrahiere_x_minus_minus",TermC.num_str @{thm subtrahiere_x_minus_minus}), 
  22.142  	 (*"[| l is_const; m..|] ==> (k - m * n) - l * n = k + (-m - l) * n"*)
  22.143 -	 Thm ("subtrahiere_x_minus1_minus",TermC.num_str @{thm subtrahiere_x_minus1_minus}),
  22.144 +	 Celem.Thm ("subtrahiere_x_minus1_minus",TermC.num_str @{thm subtrahiere_x_minus1_minus}),
  22.145  	 (*"[| l is_const |] ==> (x - v) - l * v = x + (-1 - l) * v"*)
  22.146 -	 Thm ("subtrahiere_x_minus_minus1",TermC.num_str @{thm subtrahiere_x_minus_minus1}),
  22.147 +	 Celem.Thm ("subtrahiere_x_minus_minus1",TermC.num_str @{thm subtrahiere_x_minus_minus1}),
  22.148  	 (*"[| m is_const |] ==> (x - m * v) - v = x + (-m - 1) * v"*)
  22.149  	 
  22.150 -	 Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  22.151 -	 Calc ("Groups.minus_class.minus", eval_binop "#subtr_"),
  22.152 +	 Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  22.153 +	 Celem.Calc ("Groups.minus_class.minus", eval_binop "#subtr_"),
  22.154  	 
  22.155 -	 (*MG: Reihenfolge der folgenden 2 Thm muss so bleiben, wegen
  22.156 +	 (*MG: Reihenfolge der folgenden 2 Celem.Thm muss so bleiben, wegen
  22.157             (a+a)+a --> a + 2*a --> 3*a and not (a+a)+a --> 2*a + a *)
  22.158 -	 Thm ("real_mult_2_assoc_r",TermC.num_str @{thm real_mult_2_assoc_r}),
  22.159 +	 Celem.Thm ("real_mult_2_assoc_r",TermC.num_str @{thm real_mult_2_assoc_r}),
  22.160  	 (*"(k + z1) + z1 = k + 2 * z1"*)
  22.161 -	 Thm ("sym_real_mult_2",TermC.num_str (@{thm real_mult_2} RS @{thm sym})),
  22.162 +	 Celem.Thm ("sym_real_mult_2",TermC.num_str (@{thm real_mult_2} RS @{thm sym})),
  22.163  	 (*"z1 + z1 = 2 * z1"*)
  22.164  
  22.165 -	 Thm ("addiere_vor_minus",TermC.num_str @{thm addiere_vor_minus}),
  22.166 +	 Celem.Thm ("addiere_vor_minus",TermC.num_str @{thm addiere_vor_minus}),
  22.167  	 (*"[| l is_const; m is_const |] ==> -(l * v) +  m * v = (-l + m) *v"*)
  22.168 -	 Thm ("addiere_eins_vor_minus",TermC.num_str @{thm addiere_eins_vor_minus}),
  22.169 +	 Celem.Thm ("addiere_eins_vor_minus",TermC.num_str @{thm addiere_eins_vor_minus}),
  22.170  	 (*"[| m is_const |] ==> -  v +  m * v = (-1 + m) * v"*)
  22.171 -	 Thm ("subtrahiere_vor_minus",TermC.num_str @{thm subtrahiere_vor_minus}),
  22.172 +	 Celem.Thm ("subtrahiere_vor_minus",TermC.num_str @{thm subtrahiere_vor_minus}),
  22.173  	 (*"[| l is_const; m is_const |] ==> -(l * v) -  m * v = (-l - m) *v"*)
  22.174 -	 Thm ("subtrahiere_eins_vor_minus",TermC.num_str @{thm subtrahiere_eins_vor_minus})
  22.175 +	 Celem.Thm ("subtrahiere_eins_vor_minus",TermC.num_str @{thm subtrahiere_eins_vor_minus})
  22.176  	 (*"[| m is_const |] ==> -  v -  m * v = (-1 - m) * v"*)
  22.177  	 
  22.178 -	 ], scr = EmptyScr}:rls;
  22.179 +	 ], scr = Celem.EmptyScr};
  22.180      
  22.181  val verschoenere = 
  22.182 -  Rls{id = "verschoenere", preconds = [], 
  22.183 -      rew_ord = ("dummy_ord", dummy_ord), srls = Erls, calc = [], errpatts = [],
  22.184 -      erls = append_rls "erls_verschoenere" e_rls 
  22.185 -			[Calc ("PolyMinus.kleiner", eval_kleiner "")], 
  22.186 -      rules = [Thm ("vorzeichen_minus_weg1",TermC.num_str @{thm vorzeichen_minus_weg1}),
  22.187 +  Celem.Rls{id = "verschoenere", preconds = [], 
  22.188 +      rew_ord = ("dummy_ord", Celem.dummy_ord), srls = Celem.Erls, calc = [], errpatts = [],
  22.189 +      erls = Celem.append_rls "erls_verschoenere" Celem.e_rls 
  22.190 +			[Celem.Calc ("PolyMinus.kleiner", eval_kleiner "")], 
  22.191 +      rules = [Celem.Thm ("vorzeichen_minus_weg1",TermC.num_str @{thm vorzeichen_minus_weg1}),
  22.192  	       (*"l kleiner 0 ==> a + l * b = a - -l * b"*)
  22.193 -	       Thm ("vorzeichen_minus_weg2",TermC.num_str @{thm vorzeichen_minus_weg2}),
  22.194 +	       Celem.Thm ("vorzeichen_minus_weg2",TermC.num_str @{thm vorzeichen_minus_weg2}),
  22.195  	       (*"l kleiner 0 ==> a - l * b = a + -l * b"*)
  22.196 -	       Thm ("vorzeichen_minus_weg3",TermC.num_str @{thm vorzeichen_minus_weg3}),
  22.197 +	       Celem.Thm ("vorzeichen_minus_weg3",TermC.num_str @{thm vorzeichen_minus_weg3}),
  22.198  	       (*"l kleiner 0 ==> k + a - l * b = k + a + -l * b"*)
  22.199 -	       Thm ("vorzeichen_minus_weg4",TermC.num_str @{thm vorzeichen_minus_weg4}),
  22.200 +	       Celem.Thm ("vorzeichen_minus_weg4",TermC.num_str @{thm vorzeichen_minus_weg4}),
  22.201  	       (*"l kleiner 0 ==> k - a - l * b = k - a + -l * b"*)
  22.202  
  22.203 -	       Calc ("Groups.times_class.times", eval_binop "#mult_"),
  22.204 +	       Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
  22.205  
  22.206 -	       Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),    
  22.207 +	       Celem.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),    
  22.208  	       (*"0 * z = 0"*)
  22.209 -	       Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),     
  22.210 +	       Celem.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),     
  22.211  	       (*"1 * z = z"*)
  22.212 -	       Thm ("add_0_left",TermC.num_str @{thm add_0_left}),
  22.213 +	       Celem.Thm ("add_0_left",TermC.num_str @{thm add_0_left}),
  22.214  	       (*"0 + z = z"*)
  22.215 -	       Thm ("null_minus",TermC.num_str @{thm null_minus}),
  22.216 +	       Celem.Thm ("null_minus",TermC.num_str @{thm null_minus}),
  22.217  	       (*"0 - a = -a"*)
  22.218 -	       Thm ("vor_minus_mal",TermC.num_str @{thm vor_minus_mal})
  22.219 +	       Celem.Thm ("vor_minus_mal",TermC.num_str @{thm vor_minus_mal})
  22.220  	       (*"- a * b = (-a) * b"*)
  22.221  
  22.222 -	       (*Thm ("",TermC.num_str @{}),*)
  22.223 +	       (*Celem.Thm ("",TermC.num_str @{}),*)
  22.224  	       (**)
  22.225 -	       ], scr = EmptyScr}:rls (*end verschoenere*);
  22.226 +	       ], scr = Celem.EmptyScr} (*end verschoenere*);
  22.227  
  22.228  val klammern_aufloesen = 
  22.229 -  Rls{id = "klammern_aufloesen", preconds = [], 
  22.230 -      rew_ord = ("dummy_ord", dummy_ord), srls = Erls, calc = [], errpatts = [], erls = Erls, 
  22.231 -      rules = [Thm ("sym_add_assoc",
  22.232 +  Celem.Rls{id = "klammern_aufloesen", preconds = [], 
  22.233 +      rew_ord = ("dummy_ord", Celem.dummy_ord), srls = Celem.Erls, calc = [], errpatts = [], erls = Celem.Erls, 
  22.234 +      rules = [Celem.Thm ("sym_add_assoc",
  22.235                       TermC.num_str (@{thm add.assoc} RS @{thm sym})),
  22.236  	       (*"a + (b + c) = (a + b) + c"*)
  22.237 -	       Thm ("klammer_plus_minus",TermC.num_str @{thm klammer_plus_minus}),
  22.238 +	       Celem.Thm ("klammer_plus_minus",TermC.num_str @{thm klammer_plus_minus}),
  22.239  	       (*"a + (b - c) = (a + b) - c"*)
  22.240 -	       Thm ("klammer_minus_plus",TermC.num_str @{thm klammer_minus_plus}),
  22.241 +	       Celem.Thm ("klammer_minus_plus",TermC.num_str @{thm klammer_minus_plus}),
  22.242  	       (*"a - (b + c) = (a - b) - c"*)
  22.243 -	       Thm ("klammer_minus_minus",TermC.num_str @{thm klammer_minus_minus})
  22.244 +	       Celem.Thm ("klammer_minus_minus",TermC.num_str @{thm klammer_minus_minus})
  22.245  	       (*"a - (b - c) = (a - b) + c"*)
  22.246 -	       ], scr = EmptyScr}:rls;
  22.247 +	       ], scr = Celem.EmptyScr};
  22.248  
  22.249  val klammern_ausmultiplizieren = 
  22.250 -  Rls{id = "klammern_ausmultiplizieren", preconds = [], 
  22.251 -      rew_ord = ("dummy_ord", dummy_ord), srls = Erls, calc = [], errpatts = [], erls = Erls, 
  22.252 -      rules = [Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),
  22.253 +  Celem.Rls{id = "klammern_ausmultiplizieren", preconds = [], 
  22.254 +      rew_ord = ("dummy_ord", Celem.dummy_ord), srls = Celem.Erls, calc = [], errpatts = [], erls = Celem.Erls, 
  22.255 +      rules = [Celem.Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),
  22.256  	       (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  22.257 -	       Thm ("distrib_left",TermC.num_str @{thm distrib_left}),
  22.258 +	       Celem.Thm ("distrib_left",TermC.num_str @{thm distrib_left}),
  22.259  	       (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  22.260  	       
  22.261 -	       Thm ("klammer_mult_minus",TermC.num_str @{thm klammer_mult_minus}),
  22.262 +	       Celem.Thm ("klammer_mult_minus",TermC.num_str @{thm klammer_mult_minus}),
  22.263  	       (*"a * (b - c) = a * b - a * c"*)
  22.264 -	       Thm ("klammer_minus_mult",TermC.num_str @{thm klammer_minus_mult})
  22.265 +	       Celem.Thm ("klammer_minus_mult",TermC.num_str @{thm klammer_minus_mult})
  22.266  	       (*"(b - c) * a = b * a - c * a"*)
  22.267  
  22.268 -	       (*Thm ("",TermC.num_str @{}),
  22.269 +	       (*Celem.Thm ("",TermC.num_str @{}),
  22.270  	       (*""*)*)
  22.271 -	       ], scr = EmptyScr}:rls;
  22.272 +	       ], scr = Celem.EmptyScr};
  22.273  
  22.274  val ordne_monome = 
  22.275 -  Rls{id = "ordne_monome", preconds = [], 
  22.276 -      rew_ord = ("dummy_ord", dummy_ord), srls = Erls, calc = [], errpatts = [], 
  22.277 -      erls = append_rls "erls_ordne_monome" e_rls
  22.278 -	       [Calc ("PolyMinus.kleiner", eval_kleiner ""),
  22.279 -		Calc ("Atools.is'_atom", eval_is_atom "")
  22.280 +  Celem.Rls{id = "ordne_monome", preconds = [], 
  22.281 +      rew_ord = ("dummy_ord", Celem.dummy_ord), srls = Celem.Erls, calc = [], errpatts = [], 
  22.282 +      erls = Celem.append_rls "erls_ordne_monome" Celem.e_rls
  22.283 +	       [Celem.Calc ("PolyMinus.kleiner", eval_kleiner ""),
  22.284 +		Celem.Calc ("Atools.is'_atom", eval_is_atom "")
  22.285  		], 
  22.286 -      rules = [Thm ("tausche_mal",TermC.num_str @{thm tausche_mal}),
  22.287 +      rules = [Celem.Thm ("tausche_mal",TermC.num_str @{thm tausche_mal}),
  22.288  	       (*"[| b is_atom; a kleiner b  |] ==> (b * a) = (a * b)"*)
  22.289 -	       Thm ("tausche_vor_mal",TermC.num_str @{thm tausche_vor_mal}),
  22.290 +	       Celem.Thm ("tausche_vor_mal",TermC.num_str @{thm tausche_vor_mal}),
  22.291  	       (*"[| b is_atom; a kleiner b  |] ==> (-b * a) = (-a * b)"*)
  22.292 -	       Thm ("tausche_mal_mal",TermC.num_str @{thm tausche_mal_mal}),
  22.293 +	       Celem.Thm ("tausche_mal_mal",TermC.num_str @{thm tausche_mal_mal}),
  22.294  	       (*"[| c is_atom; b kleiner c  |] ==> (a * c * b) = (a * b *c)"*)
  22.295 -	       Thm ("x_quadrat",TermC.num_str @{thm x_quadrat})
  22.296 +	       Celem.Thm ("x_quadrat",TermC.num_str @{thm x_quadrat})
  22.297  	       (*"(x * a) * a = x * a ^^^ 2"*)
  22.298  
  22.299 -	       (*Thm ("",TermC.num_str @{}),
  22.300 +	       (*Celem.Thm ("",TermC.num_str @{}),
  22.301  	       (*""*)*)
  22.302 -	       ], scr = EmptyScr}:rls;
  22.303 +	       ], scr = Celem.EmptyScr};
  22.304  
  22.305  
  22.306  val rls_p_33 = 
  22.307 -    append_rls "rls_p_33" e_rls
  22.308 -	       [Rls_ ordne_alphabetisch,
  22.309 -		Rls_ fasse_zusammen,
  22.310 -		Rls_ verschoenere
  22.311 +    Celem.append_rls "rls_p_33" Celem.e_rls
  22.312 +	       [Celem.Rls_ ordne_alphabetisch,
  22.313 +		Celem.Rls_ fasse_zusammen,
  22.314 +		Celem.Rls_ verschoenere
  22.315  		];
  22.316  val rls_p_34 = 
  22.317 -    append_rls "rls_p_34" e_rls
  22.318 -	       [Rls_ klammern_aufloesen,
  22.319 -		Rls_ ordne_alphabetisch,
  22.320 -		Rls_ fasse_zusammen,
  22.321 -		Rls_ verschoenere
  22.322 +    Celem.append_rls "rls_p_34" Celem.e_rls
  22.323 +	       [Celem.Rls_ klammern_aufloesen,
  22.324 +		Celem.Rls_ ordne_alphabetisch,
  22.325 +		Celem.Rls_ fasse_zusammen,
  22.326 +		Celem.Rls_ verschoenere
  22.327  		];
  22.328  val rechnen = 
  22.329 -    append_rls "rechnen" e_rls
  22.330 -	       [Calc ("Groups.times_class.times", eval_binop "#mult_"),
  22.331 -		Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  22.332 -		Calc ("Groups.minus_class.minus", eval_binop "#subtr_")
  22.333 +    Celem.append_rls "rechnen" Celem.e_rls
  22.334 +	       [Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
  22.335 +		Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  22.336 +		Celem.Calc ("Groups.minus_class.minus", eval_binop "#subtr_")
  22.337  		];
  22.338  *}
  22.339  setup {* KEStore_Elems.add_rlss 
  22.340 @@ -397,9 +397,9 @@
  22.341  
  22.342  (** problems **)
  22.343  setup {* KEStore_Elems.add_pbts
  22.344 -  [(Specify.prep_pbt thy "pbl_vereinf_poly" [] e_pblID
  22.345 -      (["polynom","vereinfachen"], [], Erls, NONE, [])),
  22.346 -    (Specify.prep_pbt thy "pbl_vereinf_poly_minus" [] e_pblID
  22.347 +  [(Specify.prep_pbt thy "pbl_vereinf_poly" [] Celem.e_pblID
  22.348 +      (["polynom","vereinfachen"], [], Celem.Erls, NONE, [])),
  22.349 +    (Specify.prep_pbt thy "pbl_vereinf_poly_minus" [] Celem.e_pblID
  22.350        (["plus_minus","polynom","vereinfachen"],
  22.351          [("#Given", ["Term t_t"]),
  22.352            ("#Where", ["t_t is_polyexp",
  22.353 @@ -412,19 +412,19 @@
  22.354              "     matchsub ((?b + ?c) * ?a) t_t | " ^
  22.355              "     matchsub ((?b - ?c) * ?a) t_t )"]),
  22.356            ("#Find", ["normalform n_n"])],
  22.357 -        append_rls "prls_pbl_vereinf_poly" e_rls 
  22.358 -	        [Calc ("Poly.is'_polyexp", eval_is_polyexp ""),
  22.359 -	          Calc ("Tools.matchsub", eval_matchsub ""),
  22.360 -	          Thm ("or_true", TermC.num_str @{thm or_true}),
  22.361 +        Celem.append_rls "prls_pbl_vereinf_poly" Celem.e_rls 
  22.362 +	        [Celem.Calc ("Poly.is'_polyexp", eval_is_polyexp ""),
  22.363 +	          Celem.Calc ("Tools.matchsub", eval_matchsub ""),
  22.364 +	          Celem.Thm ("or_true", TermC.num_str @{thm or_true}),
  22.365              (*"(?a | True) = True"*)
  22.366 -            Thm ("or_false", TermC.num_str @{thm or_false}),
  22.367 +            Celem.Thm ("or_false", TermC.num_str @{thm or_false}),
  22.368              (*"(?a | False) = ?a"*)
  22.369 -            Thm ("not_true",TermC.num_str @{thm not_true}),
  22.370 +            Celem.Thm ("not_true",TermC.num_str @{thm not_true}),
  22.371              (*"(~ True) = False"*)
  22.372 -            Thm ("not_false",TermC.num_str @{thm not_false})
  22.373 +            Celem.Thm ("not_false",TermC.num_str @{thm not_false})
  22.374              (*"(~ False) = True"*)], 
  22.375         SOME "Vereinfache t_t", [["simplification","for_polynomials","with_minus"]])),
  22.376 -    (Specify.prep_pbt thy "pbl_vereinf_poly_klammer" [] e_pblID
  22.377 +    (Specify.prep_pbt thy "pbl_vereinf_poly_klammer" [] Celem.e_pblID
  22.378        (["klammer","polynom","vereinfachen"],
  22.379          [("#Given" ,["Term t_t"]),
  22.380            ("#Where" ,["t_t is_polyexp",
  22.381 @@ -433,50 +433,50 @@
  22.382              "     matchsub ((?b + ?c) * ?a) t_t | " ^
  22.383              "     matchsub ((?b - ?c) * ?a) t_t )"]),
  22.384            ("#Find"  ,["normalform n_n"])],
  22.385 -        append_rls "prls_pbl_vereinf_poly_klammer" e_rls
  22.386 -          [Calc ("Poly.is'_polyexp", eval_is_polyexp ""),
  22.387 -	           Calc ("Tools.matchsub", eval_matchsub ""),
  22.388 -             Thm ("or_true", TermC.num_str @{thm or_true}),
  22.389 +        Celem.append_rls "prls_pbl_vereinf_poly_klammer" Celem.e_rls
  22.390 +          [Celem.Calc ("Poly.is'_polyexp", eval_is_polyexp ""),
  22.391 +	           Celem.Calc ("Tools.matchsub", eval_matchsub ""),
  22.392 +             Celem.Thm ("or_true", TermC.num_str @{thm or_true}),
  22.393               (*"(?a | True) = True"*)
  22.394 -             Thm ("or_false", TermC.num_str @{thm or_false}),
  22.395 +             Celem.Thm ("or_false", TermC.num_str @{thm or_false}),
  22.396               (*"(?a | False) = ?a"*)
  22.397 -             Thm ("not_true",TermC.num_str @{thm not_true}),
  22.398 +             Celem.Thm ("not_true",TermC.num_str @{thm not_true}),
  22.399               (*"(~ True) = False"*)
  22.400 -             Thm ("not_false",TermC.num_str @{thm not_false})
  22.401 +             Celem.Thm ("not_false",TermC.num_str @{thm not_false})
  22.402               (*"(~ False) = True"*)], 
  22.403          SOME "Vereinfache t_t", 
  22.404          [["simplification","for_polynomials","with_parentheses"]])),
  22.405 -    (Specify.prep_pbt thy "pbl_vereinf_poly_klammer_mal" [] e_pblID
  22.406 +    (Specify.prep_pbt thy "pbl_vereinf_poly_klammer_mal" [] Celem.e_pblID
  22.407        (["binom_klammer","polynom","vereinfachen"],
  22.408          [("#Given", ["Term t_t"]),
  22.409            ("#Where", ["t_t is_polyexp"]),
  22.410            ("#Find", ["normalform n_n"])],
  22.411 -        append_rls "e_rls" e_rls [(*for preds in where_*)
  22.412 -			      Calc ("Poly.is'_polyexp", eval_is_polyexp "")], 
  22.413 +        Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*)
  22.414 +			      Celem.Calc ("Poly.is'_polyexp", eval_is_polyexp "")], 
  22.415          SOME "Vereinfache t_t", 
  22.416          [["simplification","for_polynomials","with_parentheses_mult"]])),
  22.417 -    (Specify.prep_pbt thy "pbl_probe" [] e_pblID (["probe"], [], Erls, NONE, [])),
  22.418 -    (Specify.prep_pbt thy "pbl_probe_poly" [] e_pblID
  22.419 +    (Specify.prep_pbt thy "pbl_probe" [] Celem.e_pblID (["probe"], [], Celem.Erls, NONE, [])),
  22.420 +    (Specify.prep_pbt thy "pbl_probe_poly" [] Celem.e_pblID
  22.421        (["polynom","probe"],
  22.422          [("#Given", ["Pruefe e_e", "mitWert w_w"]),
  22.423            ("#Where", ["e_e is_polyexp"]),
  22.424            ("#Find", ["Geprueft p_p"])],
  22.425 -        append_rls "prls_pbl_probe_poly" e_rls [(*for preds in where_*)
  22.426 -		      Calc ("Poly.is'_polyexp", eval_is_polyexp "")], 
  22.427 +        Celem.append_rls "prls_pbl_probe_poly" Celem.e_rls [(*for preds in where_*)
  22.428 +		      Celem.Calc ("Poly.is'_polyexp", eval_is_polyexp "")], 
  22.429          SOME "Probe e_e w_w", 
  22.430          [["probe","fuer_polynom"]])),
  22.431 -    (Specify.prep_pbt thy "pbl_probe_bruch" [] e_pblID
  22.432 +    (Specify.prep_pbt thy "pbl_probe_bruch" [] Celem.e_pblID
  22.433        (["bruch","probe"],
  22.434          [("#Given" ,["Pruefe e_e", "mitWert w_w"]),
  22.435            ("#Where" ,["e_e is_ratpolyexp"]),
  22.436            ("#Find"  ,["Geprueft p_p"])],
  22.437 -        append_rls "prls_pbl_probe_bruch" e_rls [(*for preds in where_*)
  22.438 -		      Calc ("Rational.is'_ratpolyexp", eval_is_ratpolyexp "")], 
  22.439 +        Celem.append_rls "prls_pbl_probe_bruch" Celem.e_rls [(*for preds in where_*)
  22.440 +		      Celem.Calc ("Rational.is'_ratpolyexp", eval_is_ratpolyexp "")], 
  22.441          SOME "Probe e_e w_w", [["probe","fuer_bruch"]]))] *}
  22.442  
  22.443  (** methods **)
  22.444  setup {* KEStore_Elems.add_mets
  22.445 -  [Specify.prep_met thy "met_simp_poly_minus" [] e_metID
  22.446 +  [Specify.prep_met thy "met_simp_poly_minus" [] Celem.e_metID
  22.447  	    (["simplification","for_polynomials","with_minus"],
  22.448  	      [("#Given" ,["Term t_t"]),
  22.449  	        ("#Where" ,["t_t is_polyexp",
  22.450 @@ -485,44 +485,44 @@
  22.451  	            "     matchsub (?a - (?b + ?c)) t_t | " ^
  22.452  	            "     matchsub (?a + (?b - ?c)) t_t )"]),
  22.453  	        ("#Find"  ,["normalform n_n"])],
  22.454 -	      {rew_ord'="tless_true", rls' = e_rls, calc = [], srls = e_rls,
  22.455 -	        prls = append_rls "prls_met_simp_poly_minus" e_rls 
  22.456 -				      [Calc ("Poly.is'_polyexp", eval_is_polyexp ""),
  22.457 -				        Calc ("Tools.matchsub", eval_matchsub ""),
  22.458 -				        Thm ("and_true",TermC.num_str @{thm and_true}),
  22.459 +	      {rew_ord'="tless_true", rls' = Celem.e_rls, calc = [], srls = Celem.e_rls,
  22.460 +	        prls = Celem.append_rls "prls_met_simp_poly_minus" Celem.e_rls 
  22.461 +				      [Celem.Calc ("Poly.is'_polyexp", eval_is_polyexp ""),
  22.462 +				        Celem.Calc ("Tools.matchsub", eval_matchsub ""),
  22.463 +				        Celem.Thm ("and_true",TermC.num_str @{thm and_true}),
  22.464                  (*"(?a & True) = ?a"*)
  22.465 -                Thm ("and_false",TermC.num_str @{thm and_false}),
  22.466 +                Celem.Thm ("and_false",TermC.num_str @{thm and_false}),
  22.467                  (*"(?a & False) = False"*)
  22.468 -                Thm ("not_true",TermC.num_str @{thm not_true}),
  22.469 +                Celem.Thm ("not_true",TermC.num_str @{thm not_true}),
  22.470                  (*"(~ True) = False"*)
  22.471 -                Thm ("not_false",TermC.num_str @{thm not_false})
  22.472 +                Celem.Thm ("not_false",TermC.num_str @{thm not_false})
  22.473                  (*"(~ False) = True"*)],
  22.474 -          crls = e_rls, errpats = [], nrls = rls_p_33},
  22.475 +          crls = Celem.e_rls, errpats = [], nrls = rls_p_33},
  22.476            "Script SimplifyScript (t_t::real) =                   " ^
  22.477              "  ((Repeat((Try (Rewrite_Set ordne_alphabetisch False)) @@  " ^
  22.478              "           (Try (Rewrite_Set fasse_zusammen     False)) @@  " ^
  22.479              "           (Try (Rewrite_Set verschoenere       False)))) t_t)"),
  22.480 -    Specify.prep_met thy "met_simp_poly_parenth" [] e_metID
  22.481 +    Specify.prep_met thy "met_simp_poly_parenth" [] Celem.e_metID
  22.482  	    (["simplification","for_polynomials","with_parentheses"],
  22.483  	      [("#Given" ,["Term t_t"]),
  22.484  	        ("#Where" ,["t_t is_polyexp"]),
  22.485  	        ("#Find"  ,["normalform n_n"])],
  22.486 -	      {rew_ord'="tless_true", rls' = e_rls, calc = [], srls = e_rls, 
  22.487 -	        prls = append_rls "simplification_for_polynomials_prls" e_rls 
  22.488 -				    [(*for preds in where_*) Calc("Poly.is'_polyexp",eval_is_polyexp"")],
  22.489 -				  crls = e_rls, errpats = [], nrls = rls_p_34},
  22.490 +	      {rew_ord'="tless_true", rls' = Celem.e_rls, calc = [], srls = Celem.e_rls, 
  22.491 +	        prls = Celem.append_rls "simplification_for_polynomials_prls" Celem.e_rls 
  22.492 +				    [(*for preds in where_*) Celem.Calc("Poly.is'_polyexp",eval_is_polyexp"")],
  22.493 +				  crls = Celem.e_rls, errpats = [], nrls = rls_p_34},
  22.494  				"Script SimplifyScript (t_t::real) =                          " ^
  22.495            "  ((Repeat((Try (Rewrite_Set klammern_aufloesen False)) @@  " ^
  22.496            "           (Try (Rewrite_Set ordne_alphabetisch False)) @@  " ^
  22.497            "           (Try (Rewrite_Set fasse_zusammen     False)) @@  " ^
  22.498            "           (Try (Rewrite_Set verschoenere       False)))) t_t)"),
  22.499 -    Specify.prep_met thy "met_simp_poly_parenth_mult" [] e_metID
  22.500 +    Specify.prep_met thy "met_simp_poly_parenth_mult" [] Celem.e_metID
  22.501  	    (["simplification","for_polynomials","with_parentheses_mult"],
  22.502  	      [("#Given" ,["Term t_t"]), ("#Where" ,["t_t is_polyexp"]), ("#Find"  ,["normalform n_n"])],
  22.503 -	        {rew_ord'="tless_true", rls' = e_rls, calc = [], srls = e_rls, 
  22.504 -	          prls = append_rls "simplification_for_polynomials_prls" e_rls 
  22.505 -				      [(*for preds in where_*) Calc("Poly.is'_polyexp",eval_is_polyexp"")],
  22.506 -				    crls = e_rls, errpats = [], nrls = rls_p_34},
  22.507 +	        {rew_ord'="tless_true", rls' = Celem.e_rls, calc = [], srls = Celem.e_rls, 
  22.508 +	          prls = Celem.append_rls "simplification_for_polynomials_prls" Celem.e_rls 
  22.509 +				      [(*for preds in where_*) Celem.Calc("Poly.is'_polyexp",eval_is_polyexp"")],
  22.510 +				    crls = Celem.e_rls, errpats = [], nrls = rls_p_34},
  22.511  				  "Script SimplifyScript (t_t::real) =                          " ^
  22.512              "  ((Repeat((Try (Rewrite_Set klammern_ausmultiplizieren False)) @@ " ^
  22.513              "           (Try (Rewrite_Set discard_parentheses        False)) @@ " ^
  22.514 @@ -531,35 +531,35 @@
  22.515              "           (Try (Rewrite_Set ordne_alphabetisch         False)) @@ " ^
  22.516              "           (Try (Rewrite_Set fasse_zusammen             False)) @@ " ^
  22.517              "           (Try (Rewrite_Set verschoenere               False)))) t_t)"),
  22.518 -    Specify.prep_met thy "met_probe" [] e_metID
  22.519 +    Specify.prep_met thy "met_probe" [] Celem.e_metID
  22.520  	    (["probe"], [],
  22.521 -	      {rew_ord'="tless_true", rls' = e_rls, calc = [], srls = e_rls, prls = Erls, crls = e_rls,
  22.522 -	        errpats = [], nrls = Erls}, 
  22.523 +	      {rew_ord'="tless_true", rls' = Celem.e_rls, calc = [], srls = Celem.e_rls, prls = Celem.Erls, crls = Celem.e_rls,
  22.524 +	        errpats = [], nrls = Celem.Erls}, 
  22.525  	      "empty_script"),
  22.526 -    Specify.prep_met thy "met_probe_poly" [] e_metID
  22.527 +    Specify.prep_met thy "met_probe_poly" [] Celem.e_metID
  22.528  	    (["probe","fuer_polynom"],
  22.529  	      [("#Given" ,["Pruefe e_e", "mitWert w_w"]),
  22.530  	        ("#Where" ,["e_e is_polyexp"]),
  22.531  	        ("#Find"  ,["Geprueft p_p"])],
  22.532 -	      {rew_ord'="tless_true", rls' = e_rls, calc = [], srls = e_rls, 
  22.533 -	        prls = append_rls "prls_met_probe_bruch" e_rls
  22.534 -	            [(*for preds in where_*) Calc ("Rational.is'_ratpolyexp", eval_is_ratpolyexp "")], 
  22.535 -	        crls = e_rls, errpats = [], nrls = rechnen}, 
  22.536 +	      {rew_ord'="tless_true", rls' = Celem.e_rls, calc = [], srls = Celem.e_rls, 
  22.537 +	        prls = Celem.append_rls "prls_met_probe_bruch" Celem.e_rls
  22.538 +	            [(*for preds in where_*) Celem.Calc ("Rational.is'_ratpolyexp", eval_is_ratpolyexp "")], 
  22.539 +	        crls = Celem.e_rls, errpats = [], nrls = rechnen}, 
  22.540  	      "Script ProbeScript (e_e::bool) (w_w::bool list) = " ^
  22.541            " (let e_e = Take e_e;                              " ^
  22.542            "      e_e = Substitute w_w e_e                     " ^
  22.543            " in (Repeat((Try (Repeat (Calculate TIMES))) @@  " ^
  22.544            "            (Try (Repeat (Calculate PLUS ))) @@  " ^
  22.545            "            (Try (Repeat (Calculate MINUS))))) e_e)"),
  22.546 -    Specify.prep_met thy "met_probe_bruch" [] e_metID
  22.547 +    Specify.prep_met thy "met_probe_bruch" [] Celem.e_metID
  22.548  	    (["probe","fuer_bruch"],
  22.549  	      [("#Given" ,["Pruefe e_e", "mitWert w_w"]),
  22.550  	        ("#Where" ,["e_e is_ratpolyexp"]),
  22.551  	        ("#Find"  ,["Geprueft p_p"])],
  22.552 -	      {rew_ord'="tless_true", rls' = e_rls, calc = [], srls = e_rls, 
  22.553 -	        prls = append_rls "prls_met_probe_bruch" e_rls
  22.554 -	            [(*for preds in where_*) Calc ("Rational.is'_ratpolyexp", eval_is_ratpolyexp "")], 
  22.555 -	        crls = e_rls, errpats = [], nrls = Erls}, 
  22.556 +	      {rew_ord'="tless_true", rls' = Celem.e_rls, calc = [], srls = Celem.e_rls, 
  22.557 +	        prls = Celem.append_rls "prls_met_probe_bruch" Celem.e_rls
  22.558 +	            [(*for preds in where_*) Celem.Calc ("Rational.is'_ratpolyexp", eval_is_ratpolyexp "")], 
  22.559 +	        crls = Celem.e_rls, errpats = [], nrls = Celem.Erls}, 
  22.560  	      "empty_script")]
  22.561  *}
  22.562  
    23.1 --- a/src/Tools/isac/Knowledge/RatEq.thy	Thu Mar 15 10:17:44 2018 +0100
    23.2 +++ b/src/Tools/isac/Knowledge/RatEq.thy	Thu Mar 15 12:42:04 2018 +0100
    23.3 @@ -75,103 +75,103 @@
    23.4  fun eval_is_ratequation_in _ _ 
    23.5         (p as (Const ("RatEq.is'_ratequation'_in",_) $ t $ v)) _  =
    23.6      if is_rateqation_in t v then 
    23.7 -	SOME ((term2str p) ^ " = True",
    23.8 +	SOME ((Celem.term2str p) ^ " = True",
    23.9  	      HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
   23.10 -    else SOME ((term2str p) ^ " = True",
   23.11 +    else SOME ((Celem.term2str p) ^ " = True",
   23.12  	       HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
   23.13    | eval_is_ratequation_in _ _ _ _ = ((*tracing"### nichts matcht";*) NONE);
   23.14  
   23.15  (*-------------------------rulse-----------------------*)
   23.16  val RatEq_prls = (*15.10.02:just the following order due to subterm evaluation*)
   23.17 -  append_rls "RatEq_prls" e_rls 
   23.18 -	     [Calc ("Atools.ident",eval_ident "#ident_"),
   23.19 -	      Calc ("Tools.matches",eval_matches ""),
   23.20 -	      Calc ("Tools.lhs"    ,eval_lhs ""),
   23.21 -	      Calc ("Tools.rhs"    ,eval_rhs ""),
   23.22 -	      Calc ("RatEq.is'_ratequation'_in",eval_is_ratequation_in ""),
   23.23 -	      Calc ("HOL.eq",eval_equal "#equal_"),
   23.24 -	      Thm ("not_true",TermC.num_str @{thm not_true}),
   23.25 -	      Thm ("not_false",TermC.num_str @{thm not_false}),
   23.26 -	      Thm ("and_true",TermC.num_str @{thm and_true}),
   23.27 -	      Thm ("and_false",TermC.num_str @{thm and_false}),
   23.28 -	      Thm ("or_true",TermC.num_str @{thm or_true}),
   23.29 -	      Thm ("or_false",TermC.num_str @{thm or_false})
   23.30 +  Celem.append_rls "RatEq_prls" Celem.e_rls 
   23.31 +	     [Celem.Calc ("Atools.ident",eval_ident "#ident_"),
   23.32 +	      Celem.Calc ("Tools.matches",eval_matches ""),
   23.33 +	      Celem.Calc ("Tools.lhs"    ,eval_lhs ""),
   23.34 +	      Celem.Calc ("Tools.rhs"    ,eval_rhs ""),
   23.35 +	      Celem.Calc ("RatEq.is'_ratequation'_in",eval_is_ratequation_in ""),
   23.36 +	      Celem.Calc ("HOL.eq",eval_equal "#equal_"),
   23.37 +	      Celem.Thm ("not_true",TermC.num_str @{thm not_true}),
   23.38 +	      Celem.Thm ("not_false",TermC.num_str @{thm not_false}),
   23.39 +	      Celem.Thm ("and_true",TermC.num_str @{thm and_true}),
   23.40 +	      Celem.Thm ("and_false",TermC.num_str @{thm and_false}),
   23.41 +	      Celem.Thm ("or_true",TermC.num_str @{thm or_true}),
   23.42 +	      Celem.Thm ("or_false",TermC.num_str @{thm or_false})
   23.43  	      ];
   23.44  
   23.45  
   23.46 -(*rls = merge_rls erls Poly_erls *)
   23.47 +(*rls = Celem.merge_rls erls Poly_erls *)
   23.48  val rateq_erls = 
   23.49 -    remove_rls "rateq_erls"                                   (*WN: ein Hack*)
   23.50 -	(merge_rls "is_ratequation_in" calculate_Rational
   23.51 -		   (append_rls "is_ratequation_in"
   23.52 +    Celem.remove_rls "rateq_erls"                             (*WN: ein Hack*)
   23.53 +	(Celem.merge_rls "is_ratequation_in" calculate_Rational
   23.54 +		   (Celem.append_rls "is_ratequation_in"
   23.55  			Poly_erls
   23.56 -			[(*Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),*)
   23.57 -			 Calc ("RatEq.is'_ratequation'_in",
   23.58 +			[(*Celem.Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),*)
   23.59 +			 Celem.Calc ("RatEq.is'_ratequation'_in",
   23.60  			       eval_is_ratequation_in "")
   23.61  
   23.62  			 ]))
   23.63 -	[Thm ("and_commute",TermC.num_str @{thm and_commute}), (*WN: ein Hack*)
   23.64 -	 Thm ("or_commute",TermC.num_str @{thm or_commute})    (*WN: ein Hack*)
   23.65 +	[Celem.Thm ("and_commute",TermC.num_str @{thm and_commute}), (*WN: ein Hack*)
   23.66 +	 Celem.Thm ("or_commute",TermC.num_str @{thm or_commute})    (*WN: ein Hack*)
   23.67  	 ];
   23.68  *}
   23.69  setup {* KEStore_Elems.add_rlss [("rateq_erls", (Context.theory_name @{theory}, rateq_erls))] *}
   23.70  ML {*
   23.71  
   23.72  val RatEq_crls = 
   23.73 -    remove_rls "RatEq_crls"                                   (*WN: ein Hack*)
   23.74 -	(merge_rls "is_ratequation_in" calculate_Rational
   23.75 -		   (append_rls "is_ratequation_in"
   23.76 +    Celem.remove_rls "RatEq_crls"                              (*WN: ein Hack*)
   23.77 +	(Celem.merge_rls "is_ratequation_in" calculate_Rational
   23.78 +		   (Celem.append_rls "is_ratequation_in"
   23.79  			Poly_erls
   23.80 -			[(*Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),*)
   23.81 -			 Calc ("RatEq.is'_ratequation'_in",
   23.82 +			[(*Celem.Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),*)
   23.83 +			 Celem.Calc ("RatEq.is'_ratequation'_in",
   23.84  			       eval_is_ratequation_in "")
   23.85  			 ]))
   23.86 -	[Thm ("and_commute",TermC.num_str @{thm and_commute}), (*WN: ein Hack*)
   23.87 -	 Thm ("or_commute",TermC.num_str @{thm or_commute})    (*WN: ein Hack*)
   23.88 +	[Celem.Thm ("and_commute",TermC.num_str @{thm and_commute}), (*WN: ein Hack*)
   23.89 +	 Celem.Thm ("or_commute",TermC.num_str @{thm or_commute})    (*WN: ein Hack*)
   23.90  	 ];
   23.91  
   23.92  val RatEq_eliminate = prep_rls'(
   23.93 -  Rls {id = "RatEq_eliminate", preconds = [],
   23.94 -       rew_ord = ("termlessI", termlessI), erls = rateq_erls, srls = Erls, 
   23.95 +  Celem.Rls {id = "RatEq_eliminate", preconds = [],
   23.96 +       rew_ord = ("termlessI", termlessI), erls = rateq_erls, srls = Celem.Erls, 
   23.97         calc = [], errpatts = [],
   23.98         rules = [
   23.99 -	    Thm("rat_mult_denominator_both",TermC.num_str @{thm rat_mult_denominator_both}), 
  23.100 +	    Celem.Thm("rat_mult_denominator_both",TermC.num_str @{thm rat_mult_denominator_both}), 
  23.101  	     (* a/b=c/d -> ad=cb *)
  23.102 -	    Thm("rat_mult_denominator_left",TermC.num_str @{thm rat_mult_denominator_left}), 
  23.103 +	    Celem.Thm("rat_mult_denominator_left",TermC.num_str @{thm rat_mult_denominator_left}), 
  23.104  	     (* a  =c/d -> ad=c  *)
  23.105 -	    Thm("rat_mult_denominator_right",TermC.num_str @{thm rat_mult_denominator_right})
  23.106 +	    Celem.Thm("rat_mult_denominator_right",TermC.num_str @{thm rat_mult_denominator_right})
  23.107  	     (* a/b=c   ->  a=cb *)
  23.108  	    ],
  23.109 -    scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  23.110 -    }:rls);
  23.111 +    scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  23.112 +    });
  23.113  *}
  23.114  setup {* KEStore_Elems.add_rlss [("RatEq_eliminate",
  23.115    (Context.theory_name @{theory}, RatEq_eliminate))] *}
  23.116  ML {*
  23.117  
  23.118  val RatEq_simplify = prep_rls'(
  23.119 -  Rls {id = "RatEq_simplify", preconds = [], rew_ord = ("termlessI", termlessI),
  23.120 -      erls = rateq_erls, srls = Erls, calc = [], errpatts = [],
  23.121 +  Celem.Rls {id = "RatEq_simplify", preconds = [], rew_ord = ("termlessI", termlessI),
  23.122 +      erls = rateq_erls, srls = Celem.Erls, calc = [], errpatts = [],
  23.123      rules = [
  23.124 -	     Thm("real_rat_mult_1",TermC.num_str @{thm real_rat_mult_1}),
  23.125 +	     Celem.Thm("real_rat_mult_1",TermC.num_str @{thm real_rat_mult_1}),
  23.126  	     (*a*(b/c) = (a*b)/c*)
  23.127 -	     Thm("real_rat_mult_2",TermC.num_str @{thm real_rat_mult_2}),
  23.128 +	     Celem.Thm("real_rat_mult_2",TermC.num_str @{thm real_rat_mult_2}),
  23.129  	     (*(a/b)*(c/d) = (a*c)/(b*d)*)
  23.130 -             Thm("real_rat_mult_3",TermC.num_str @{thm real_rat_mult_3}),
  23.131 +             Celem.Thm("real_rat_mult_3",TermC.num_str @{thm real_rat_mult_3}),
  23.132               (* (a/b)*c = (a*c)/b*)
  23.133 -	     Thm("real_rat_pow",TermC.num_str @{thm real_rat_pow}),
  23.134 +	     Celem.Thm("real_rat_pow",TermC.num_str @{thm real_rat_pow}),
  23.135  	     (*(a/b)^^^2 = a^^^2/b^^^2*)
  23.136 -	     Thm("real_diff_minus",TermC.num_str @{thm real_diff_minus}),
  23.137 +	     Celem.Thm("real_diff_minus",TermC.num_str @{thm real_diff_minus}),
  23.138  	     (* a - b = a + (-1) * b *)
  23.139 -             Thm("rat_double_rat_1",TermC.num_str @{thm rat_double_rat_1}),
  23.140 +             Celem.Thm("rat_double_rat_1",TermC.num_str @{thm rat_double_rat_1}),
  23.141               (* (a / (c/d) = (a*d) / c) *)
  23.142 -             Thm("rat_double_rat_2",TermC.num_str @{thm rat_double_rat_2}), 
  23.143 +             Celem.Thm("rat_double_rat_2",TermC.num_str @{thm rat_double_rat_2}), 
  23.144               (* ((a/b) / (c/d) = (a*d) / (b*c)) *)
  23.145 -             Thm("rat_double_rat_3",TermC.num_str @{thm rat_double_rat_3}) 
  23.146 +             Celem.Thm("rat_double_rat_3",TermC.num_str @{thm rat_double_rat_3}) 
  23.147               (* ((a/b) / c = a / (b*c) ) *)
  23.148  	     ],
  23.149 -    scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  23.150 -    }:rls);
  23.151 +    scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  23.152 +    });
  23.153  *}
  23.154  setup {* KEStore_Elems.add_rlss [("RatEq_simplify",
  23.155    (Context.theory_name @{theory}, RatEq_simplify))] *}
  23.156 @@ -183,7 +183,7 @@
  23.157  *)
  23.158  *}
  23.159  setup {* KEStore_Elems.add_pbts
  23.160 -  [(Specify.prep_pbt thy "pbl_equ_univ_rat" [] e_pblID
  23.161 +  [(Specify.prep_pbt thy "pbl_equ_univ_rat" [] Celem.e_pblID
  23.162      (["rational","univariate","equation"],
  23.163        [("#Given", ["equality e_e","solveFor v_v"]),
  23.164          ("#Where", ["(e_e::bool) is_ratequation_in (v_v::real)"]),
  23.165 @@ -192,16 +192,16 @@
  23.166  
  23.167  (*-------------------------methods-----------------------*)
  23.168  setup {* KEStore_Elems.add_mets
  23.169 -  [Specify.prep_met thy "met_rateq" [] e_metID
  23.170 +  [Specify.prep_met thy "met_rateq" [] Celem.e_metID
  23.171        (["RatEq"], [],
  23.172 -        {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = e_rls, prls=e_rls,
  23.173 +        {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = Celem.e_rls, prls=Celem.e_rls,
  23.174            crls=RatEq_crls, errpats = [], nrls = norm_Rational}, "empty_script"),
  23.175 -    Specify.prep_met thy "met_rat_eq" [] e_metID
  23.176 +    Specify.prep_met thy "met_rat_eq" [] Celem.e_metID
  23.177        (["RatEq", "solve_rat_equation"],
  23.178          [("#Given" ,["equality e_e","solveFor v_v"]),
  23.179            ("#Where" ,["(e_e::bool) is_ratequation_in (v_v::real)"]),
  23.180            ("#Find"  ,["solutions v_v'i'"])],
  23.181 -        {rew_ord'="termlessI", rls'=rateq_erls, srls=e_rls, prls=RatEq_prls, calc=[],
  23.182 +        {rew_ord'="termlessI", rls'=rateq_erls, srls=Celem.e_rls, prls=RatEq_prls, calc=[],
  23.183            crls=RatEq_crls, errpats = [], nrls = norm_Rational},
  23.184          "Script Solve_rat_equation  (e_e::bool) (v_v::real) =                   " ^
  23.185            "(let e_e = ((Repeat(Try (Rewrite_Set RatEq_simplify      True))) @@  " ^
    24.1 --- a/src/Tools/isac/Knowledge/Rational-WN.sml	Thu Mar 15 10:17:44 2018 +0100
    24.2 +++ b/src/Tools/isac/Knowledge/Rational-WN.sml	Thu Mar 15 12:42:04 2018 +0100
    24.3 @@ -21,7 +21,7 @@
    24.4  
    24.5  
    24.6  (*diese vvv funktionen kommen nach src/Isa99/termC.sml -------------*)
    24.7 -fun term2str t =
    24.8 +fun Celem.term2str t =
    24.9      let fun ato (Const(a,T))     n = 
   24.10  	    "\n"^indent n^"Const ( "^a^")"
   24.11  	  | ato (Free (a,T))     n =  
   24.12 @@ -35,8 +35,8 @@
   24.13  	  | ato (f$t')           n = ato f n^ato t' (n+1)
   24.14      in "\n-------------"^ato t 0^"\n" end;
   24.15  fun free2int (t as Free (s, _)) = (((the o int_of_str) s)
   24.16 -    handle _ => error ("free2int: "^term2str t))
   24.17 -  | free2int t = error ("free2int: "^term2str t);
   24.18 +    handle _ => error ("free2int: "^Celem.term2str t))
   24.19 +  | free2int t = error ("free2int: "^Celem.term2str t);
   24.20  (*diese ^^^ funktionen kommen nach src/Isa99/termC.sml -------------*)
   24.21  
   24.22  
   24.23 @@ -56,12 +56,12 @@
   24.24  
   24.25  fun mono (Const ("RatArith.pow",_) $ t1 $ t2) v g =
   24.26      if t1 = v then ((replicate ((free2int t2) - g) 0) @ [1]) : poly 
   24.27 -    else error ("term2poly.1 "^term2str t1)
   24.28 +    else error ("term2poly.1 "^Celem.term2str t1)
   24.29    | mono (t as Const ("Groups.times_class.times",_) $ t1 $ 
   24.30  	    (Const ("RatArith.pow",_) $ t2 $ t3)) v g =
   24.31      if t2 = v then (replicate ((free2int t3) - g) 0) @ [free2int t1] 
   24.32 -    else error ("term2poly.2 "^term2str t)
   24.33 -  | mono t _ _ = error ("term2poly.3 "^term2str t);
   24.34 +    else error ("term2poly.2 "^Celem.term2str t)
   24.35 +  | mono t _ _ = error ("term2poly.3 "^Celem.term2str t);
   24.36  
   24.37  fun poly (Const ("Groups.plus_class.plus",_) $ t1 $ t2) v g = 
   24.38      let val l = mono t1 v g
   24.39 @@ -185,34 +185,34 @@
   24.40  "***************************************************************************";
   24.41  fun rewrite_set_' thy rls put_asm ruless ct =
   24.42      case ruless of
   24.43 -	Rrls _ => error "rewrite_set_' not for Rrls"
   24.44 -      | Rls _ =>
   24.45 +	Celem.Rrls _ => error "rewrite_set_' not for Celem.Rrls"
   24.46 +      | Celem.Rls _ =>
   24.47    let
   24.48      datatype switch = Appl | Noap;
   24.49      fun rew_once ruls asm ct Noap [] = (ct,asm)
   24.50        | rew_once ruls asm ct Appl [] = rew_once ruls asm ct Noap ruls
   24.51        | rew_once ruls asm ct apno (rul::thms) =
   24.52        case rul of
   24.53 -	Thm (thmid, thm) =>
   24.54 -	  (case rewrite_ thy ((snd o #rew_ord o rep_rls) ruless) 
   24.55 -	     rls put_asm (thm_of_thm rul) ct of
   24.56 +	Celem.Thm (thmid, thm) =>
   24.57 +	  (case rewrite_ thy ((snd o #rew_ord o Celem.rep_rls) ruless) 
   24.58 +	     rls put_asm (Celem.thm_of_thm rul) ct of
   24.59  	     NONE => rew_once ruls asm ct apno thms
   24.60  	   | SOME (ct',asm') => 
   24.61  	     rew_once ruls (asm union asm') ct' Appl (rul::thms))
   24.62 -      | Calc (cc as (op_,_)) => 
   24.63 +      | Celem.Calc (cc as (op_,_)) => 
   24.64  	  (case adhoc_thm thy cc ct of
   24.65  	       NONE => rew_once ruls asm ct apno thms
   24.66  	   | SOME (thmid, thm') => 
   24.67  	       let 
   24.68  		 val pairopt = 
   24.69 -		   rewrite_ thy ((snd o #rew_ord o rep_rls) ruless) 
   24.70 +		   rewrite_ thy ((snd o #rew_ord o Celem.rep_rls) ruless) 
   24.71  		   rls put_asm thm' ct;
   24.72  		 val _ = if pairopt <> NONE then () 
   24.73  			 else error("rewrite_set_, rewrite_ \""^
   24.74  			 (string_of_thmI thm')^"\" \""^
   24.75 -			 (Syntax.string_of_term (thy2ctxt thy) ct)^"\" = NONE")
   24.76 +			 (Syntax.string_of_term (Celem.thy2ctxt thy) ct)^"\" = NONE")
   24.77  	       in rew_once ruls asm ((fst o the) pairopt) Appl(rul::thms) end);
   24.78 -    val ruls = (#rules o rep_rls) ruless;
   24.79 +    val ruls = (#rules o Celem.rep_rls) ruless;
   24.80      val (ct',asm') = rew_once ruls [] ct Noap ruls;
   24.81    in if ct = ct' then NONE else SOME (ct',asm') end;
   24.82  
   24.83 @@ -221,34 +221,34 @@
   24.84  *)
   24.85  fun rewrite_set_' thy rls put_asm ruless ct =
   24.86      case ruless of
   24.87 -	Rrls _ => error "rewrite_set_' not for Rrls"
   24.88 -      | Rls _ =>
   24.89 +	Celem.Rrls _ => error "rewrite_set_' not for Celem.Rrls"
   24.90 +      | Celem.Rls _ =>
   24.91    let
   24.92      datatype switch = Appl | Noap;
   24.93      fun rew_once ruls asm ct Noap [] = (ct,asm)
   24.94        | rew_once ruls asm ct Appl [] = rew_once ruls asm ct Noap ruls
   24.95        | rew_once ruls asm ct apno (rul::thms) =
   24.96        case rul of
   24.97 -	Thm (thmid, thm) =>
   24.98 -	  (case rewrite_ thy ((snd o #rew_ord o rep_rls) ruless) 
   24.99 -	     rls put_asm (thm_of_thm rul) ct of
  24.100 +	Celem.Thm (thmid, thm) =>
  24.101 +	  (case rewrite_ thy ((snd o #rew_ord o Celem.rep_rls) ruless) 
  24.102 +	     rls put_asm (Celem.thm_of_thm rul) ct of
  24.103  	     NONE => rew_once ruls asm ct apno thms
  24.104  	   | SOME (ct',asm') => 
  24.105  	     rew_once ruls (asm union asm') ct' Appl (rul::thms))
  24.106 -      | Calc (cc as (op_,_)) => 
  24.107 +      | Celem.Calc (cc as (op_,_)) => 
  24.108  	  (case adhoc_thm thy cc ct of
  24.109  	       NONE => rew_once ruls asm ct apno thms
  24.110  	   | SOME (thmid, thm') => 
  24.111  	       let 
  24.112  		 val pairopt = 
  24.113 -		   rewrite_ thy ((snd o #rew_ord o rep_rls) ruless) 
  24.114 +		   rewrite_ thy ((snd o #rew_ord o Celem.rep_rls) ruless) 
  24.115  		   rls put_asm thm' ct;
  24.116  		 val _ = if pairopt <> NONE then () 
  24.117  			 else error("rewrite_set_, rewrite_ \""^
  24.118  			 (string_of_thmI thm')^"\" \""^
  24.119 -			 (Syntax.string_of_term (thy2ctxt thy) ct)^"\" = NONE")
  24.120 +			 (Syntax.string_of_term (Celem.thy2ctxt thy) ct)^"\" = NONE")
  24.121  	       in rew_once ruls asm ((fst o the) pairopt) Appl(rul::thms) end);
  24.122 -    val ruls = (#rules o rep_rls) ruless;
  24.123 +    val ruls = (#rules o Celem.rep_rls) ruless;
  24.124      val (ct',asm') = rew_once ruls [] ct Noap ruls;
  24.125    in if ct = ct' then NONE else SOME (ct',asm') end;
  24.126  
    25.1 --- a/src/Tools/isac/Knowledge/Rational.thy	Thu Mar 15 10:17:44 2018 +0100
    25.2 +++ b/src/Tools/isac/Knowledge/Rational.thy	Thu Mar 15 12:42:04 2018 +0100
    25.3 @@ -11,7 +11,7 @@
    25.4  imports Poly "~~/src/Tools/isac/Knowledge/GCD_Poly_ML"
    25.5  begin
    25.6  
    25.7 -section {* Constants for evaluation by "Calc" *}
    25.8 +section {* Constants for evaluation by "Celem.Calc" *}
    25.9  consts
   25.10  
   25.11    is'_expanded    :: "real => bool" ("_ is'_expanded")     (*RL->Poly.thy*)
   25.12 @@ -43,9 +43,9 @@
   25.13  fun eval_is_ratpolyexp (thmid:string) _ 
   25.14  		       (t as (Const("Rational.is'_ratpolyexp", _) $ arg)) thy =
   25.15      if is_ratpolyexp arg
   25.16 -    then SOME (TermC.mk_thmid thmid (term_to_string''' thy arg) "", 
   25.17 +    then SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg) "", 
   25.18  	         HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True})))
   25.19 -    else SOME (TermC.mk_thmid thmid (term_to_string''' thy arg) "", 
   25.20 +    else SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg) "", 
   25.21  	         HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False})))
   25.22    | eval_is_ratpolyexp _ _ _ _ = NONE; 
   25.23  
   25.24 @@ -54,7 +54,7 @@
   25.25  		      (t as Const ("Rational.get_denominator", _) $
   25.26                (Const ("Rings.divide_class.divide", _) $ num $
   25.27                  denom)) thy = 
   25.28 -      SOME (TermC.mk_thmid thmid (term_to_string''' thy denom) "", 
   25.29 +      SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy denom) "", 
   25.30  	            HOLogic.Trueprop $ (TermC.mk_equality (t, denom)))
   25.31    | eval_get_denominator _ _ _ _ = NONE; 
   25.32  
   25.33 @@ -63,7 +63,7 @@
   25.34        (t as Const ("Rational.get_numerator", _) $
   25.35            (Const ("Rings.divide_class.divide", _) $num
   25.36              $denom )) thy = 
   25.37 -    SOME (TermC.mk_thmid thmid (term_to_string''' thy num) "", 
   25.38 +    SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy num) "", 
   25.39  	    HOLogic.Trueprop $ (TermC.mk_equality (t, num)))
   25.40    | eval_get_numerator _ _ _ _ = NONE; 
   25.41  *}
   25.42 @@ -130,7 +130,7 @@
   25.43    | monom_of_term vs (c, es) (Const ("Groups.times_class.times", _) $ m1 $ m2) =
   25.44      let val (c', es') = monom_of_term vs (c, es) m1
   25.45      in monom_of_term vs (c', es') m2 end
   25.46 -  | monom_of_term _ _ t = raise ERROR ("poly malformed with " ^ term2str t)
   25.47 +  | monom_of_term _ _ t = raise ERROR ("poly malformed with " ^ Celem.term2str t)
   25.48  
   25.49  fun monoms_of_term vs (t as Free _) =
   25.50      [monom_of_term  vs (1, replicate (length vs) 0) t]
   25.51 @@ -140,7 +140,7 @@
   25.52      [monom_of_term  vs (1, replicate (length vs) 0) t]
   25.53    | monoms_of_term vs (Const ("Groups.plus_class.plus", _) $ ms1 $ ms2) =
   25.54      (monoms_of_term vs ms1) @ (monoms_of_term vs ms2)
   25.55 -  | monoms_of_term _ t = raise ERROR ("poly malformed with " ^ term2str t)
   25.56 +  | monoms_of_term _ t = raise ERROR ("poly malformed with " ^ Celem.term2str t)
   25.57  
   25.58  (* convert a term to the internal representation of a multivariate polynomial;
   25.59    the conversion is quite liberal, see test --- fun poly_of_term ---:
   25.60 @@ -394,70 +394,70 @@
   25.61  (* evaluates conditions in calculate_Rational *)
   25.62  val calc_rat_erls =
   25.63    prep_rls'
   25.64 -    (Rls {id = "calc_rat_erls", preconds = [], rew_ord = ("dummy_ord", dummy_ord), 
   25.65 -      erls = e_rls, srls = Erls, calc = [], errpatts = [],
   25.66 +    (Celem.Rls {id = "calc_rat_erls", preconds = [], rew_ord = ("dummy_ord", Celem.dummy_ord), 
   25.67 +      erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [],
   25.68        rules = 
   25.69 -        [Calc ("HOL.eq", eval_equal "#equal_"),
   25.70 -        Calc ("Atools.is'_const", eval_const "#is_const_"),
   25.71 -        Thm ("not_true", TermC.num_str @{thm not_true}),
   25.72 -        Thm ("not_false", TermC.num_str @{thm not_false})], 
   25.73 -      scr = EmptyScr});
   25.74 +        [Celem.Calc ("HOL.eq", eval_equal "#equal_"),
   25.75 +        Celem.Calc ("Atools.is'_const", eval_const "#is_const_"),
   25.76 +        Celem.Thm ("not_true", TermC.num_str @{thm not_true}),
   25.77 +        Celem.Thm ("not_false", TermC.num_str @{thm not_false})], 
   25.78 +      scr = Celem.EmptyScr});
   25.79  
   25.80  (* simplifies expressions with numerals;
   25.81     does NOT rearrange the term by AC-rewriting; thus terms with variables 
   25.82     need to have constants to be commuted together respectively           *)
   25.83  val calculate_Rational =
   25.84 -  prep_rls' (merge_rls "calculate_Rational"
   25.85 -    (Rls {id = "divide", preconds = [], rew_ord = ("dummy_ord", dummy_ord), 
   25.86 -      erls = calc_rat_erls, srls = Erls,
   25.87 +  prep_rls' (Celem.merge_rls "calculate_Rational"
   25.88 +    (Celem.Rls {id = "divide", preconds = [], rew_ord = ("dummy_ord", Celem.dummy_ord), 
   25.89 +      erls = calc_rat_erls, srls = Celem.Erls,
   25.90        calc = [], errpatts = [],
   25.91        rules = 
   25.92 -        [Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),
   25.93 +        [Celem.Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),
   25.94  
   25.95 -        Thm ("minus_divide_left", TermC.num_str (@{thm minus_divide_left} RS @{thm sym})),
   25.96 +        Celem.Thm ("minus_divide_left", TermC.num_str (@{thm minus_divide_left} RS @{thm sym})),
   25.97            (*SYM - ?x / ?y = - (?x / ?y)  may come from subst*)
   25.98 -        Thm ("rat_add", TermC.num_str @{thm rat_add}),
   25.99 +        Celem.Thm ("rat_add", TermC.num_str @{thm rat_add}),
  25.100            (*"[| a is_const; b is_const; c is_const; d is_const |] ==> \
  25.101            \a / c + b / d = (a * d) / (c * d) + (b * c ) / (d * c)"*)
  25.102 -        Thm ("rat_add1", TermC.num_str @{thm rat_add1}),
  25.103 +        Celem.Thm ("rat_add1", TermC.num_str @{thm rat_add1}),
  25.104            (*"[| a is_const; b is_const; c is_const |] ==> a / c + b / c = (a + b) / c"*)
  25.105 -        Thm ("rat_add2", TermC.num_str @{thm rat_add2}),
  25.106 +        Celem.Thm ("rat_add2", TermC.num_str @{thm rat_add2}),
  25.107            (*"[| ?a is_const; ?b is_const; ?c is_const |] ==> ?a / ?c + ?b = (?a + ?b * ?c) / ?c"*)
  25.108 -        Thm ("rat_add3", TermC.num_str @{thm rat_add3}),
  25.109 +        Celem.Thm ("rat_add3", TermC.num_str @{thm rat_add3}),
  25.110            (*"[| a is_const; b is_const; c is_const |] ==> a + b / c = (a * c) / c + b / c"\
  25.111            .... is_const to be omitted here FIXME*)
  25.112          
  25.113 -        Thm ("rat_mult", TermC.num_str @{thm rat_mult}), 
  25.114 +        Celem.Thm ("rat_mult", TermC.num_str @{thm rat_mult}), 
  25.115            (*a / b * (c / d) = a * c / (b * d)*)
  25.116 -        Thm ("times_divide_eq_right", TermC.num_str @{thm times_divide_eq_right}),
  25.117 +        Celem.Thm ("times_divide_eq_right", TermC.num_str @{thm times_divide_eq_right}),
  25.118            (*?x * (?y / ?z) = ?x * ?y / ?z*)
  25.119 -        Thm ("times_divide_eq_left", TermC.num_str @{thm times_divide_eq_left}),
  25.120 +        Celem.Thm ("times_divide_eq_left", TermC.num_str @{thm times_divide_eq_left}),
  25.121            (*?y / ?z * ?x = ?y * ?x / ?z*)
  25.122          
  25.123 -        Thm ("real_divide_divide1", TermC.num_str @{thm real_divide_divide1}),
  25.124 +        Celem.Thm ("real_divide_divide1", TermC.num_str @{thm real_divide_divide1}),
  25.125            (*"?y ~= 0 ==> ?u / ?v / (?y / ?z) = ?u / ?v * (?z / ?y)"*)
  25.126 -        Thm ("divide_divide_eq_left", TermC.num_str @{thm divide_divide_eq_left}),
  25.127 +        Celem.Thm ("divide_divide_eq_left", TermC.num_str @{thm divide_divide_eq_left}),
  25.128            (*"?x / ?y / ?z = ?x / (?y * ?z)"*)
  25.129          
  25.130 -        Thm ("rat_power", TermC.num_str @{thm rat_power}),
  25.131 +        Celem.Thm ("rat_power", TermC.num_str @{thm rat_power}),
  25.132            (*"(?a / ?b) ^^^ ?n = ?a ^^^ ?n / ?b ^^^ ?n"*)
  25.133          
  25.134 -        Thm ("mult_cross", TermC.num_str @{thm mult_cross}),
  25.135 +        Celem.Thm ("mult_cross", TermC.num_str @{thm mult_cross}),
  25.136            (*"[| b ~= 0; d ~= 0 |] ==> (a / b = c / d) = (a * d = b * c)*)
  25.137 -        Thm ("mult_cross1", TermC.num_str @{thm mult_cross1}),
  25.138 +        Celem.Thm ("mult_cross1", TermC.num_str @{thm mult_cross1}),
  25.139            (*"   b ~= 0            ==> (a / b = c    ) = (a     = b * c)*)
  25.140 -        Thm ("mult_cross2", TermC.num_str @{thm mult_cross2})
  25.141 +        Celem.Thm ("mult_cross2", TermC.num_str @{thm mult_cross2})
  25.142            (*"           d ~= 0    ==> (a     = c / d) = (a * d =     c)*)], 
  25.143 -      scr = EmptyScr})
  25.144 +      scr = Celem.EmptyScr})
  25.145      calculate_Poly);
  25.146  
  25.147  (*("is_expanded", ("Rational.is'_expanded", eval_is_expanded ""))*)
  25.148  fun eval_is_expanded (thmid:string) _ 
  25.149  		       (t as (Const("Rational.is'_expanded", _) $ arg)) thy = 
  25.150      if is_expanded arg
  25.151 -    then SOME (TermC.mk_thmid thmid (term_to_string''' thy arg) "", 
  25.152 +    then SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg) "", 
  25.153  	         HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True})))
  25.154 -    else SOME (TermC.mk_thmid thmid (term_to_string''' thy arg) "", 
  25.155 +    else SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg) "", 
  25.156  	         HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False})))
  25.157    | eval_is_expanded _ _ _ _ = NONE;
  25.158  *}
  25.159 @@ -465,16 +465,16 @@
  25.160    [("is_expanded", ("Rational.is'_expanded", eval_is_expanded ""))] *}
  25.161  ML {*
  25.162  val rational_erls = 
  25.163 -  merge_rls "rational_erls" calculate_Rational 
  25.164 -    (append_rls "is_expanded" Atools_erls 
  25.165 -      [Calc ("Rational.is'_expanded", eval_is_expanded "")]);
  25.166 +  Celem.merge_rls "rational_erls" calculate_Rational 
  25.167 +    (Celem.append_rls "is_expanded" Atools_erls 
  25.168 +      [Celem.Calc ("Rational.is'_expanded", eval_is_expanded "")]);
  25.169  *}
  25.170  
  25.171  subsection {* Embed cancellation into rewriting *}
  25.172  ML {*
  25.173  local (* cancel_p *)
  25.174  
  25.175 -val {rules = rules, rew_ord = (_, ro), ...} = rep_rls (assoc_rls' @{theory} "rev_rew_p");
  25.176 +val {rules = rules, rew_ord = (_, ro), ...} = Celem.rep_rls (assoc_rls' @{theory} "rev_rew_p");
  25.177  
  25.178  fun init_state thy eval_rls ro t =
  25.179    let
  25.180 @@ -482,22 +482,22 @@
  25.181      val SOME (t'', asm) = cancel_p_ thy t;
  25.182      val der = Rtools.reverse_deriv thy eval_rls rules ro NONE t';
  25.183      val der = der @ 
  25.184 -      [(Thm ("real_mult_div_cancel2", TermC.num_str @{thm real_mult_div_cancel2}), (t'', asm))]
  25.185 +      [(Celem.Thm ("real_mult_div_cancel2", TermC.num_str @{thm real_mult_div_cancel2}), (t'', asm))]
  25.186      val rs = (Rtools.distinct_Thm o (map #1)) der
  25.187    	val rs = filter_out (Rtools.eq_Thms 
  25.188    	  ["sym_real_add_zero_left", "sym_real_mult_0", "sym_real_mult_1"]) rs
  25.189    in (t, t'', [rs(*one in order to ease locate_rule*)], der) end;
  25.190  
  25.191  fun locate_rule thy eval_rls ro [rs] t r =
  25.192 -    if member op = ((map (id_of_thm)) rs) (id_of_thm r)
  25.193 +    if member op = ((map (Celem.id_of_thm)) rs) (Celem.id_of_thm r)
  25.194      then 
  25.195 -      let val ropt = Rewrite.rewrite_ thy ro eval_rls true (thm_of_thm r) t;
  25.196 +      let val ropt = Rewrite.rewrite_ thy ro eval_rls true (Celem.thm_of_thm r) t;
  25.197        in
  25.198          case ropt of SOME ta => [(r, ta)]
  25.199  	      | NONE => (tracing 
  25.200 -	          ("### locate_rule:  rewrite " ^ id_of_thm r ^ " " ^ term2str t ^ " = NONE"); []) 
  25.201 +	          ("### locate_rule:  rewrite " ^ Celem.id_of_thm r ^ " " ^ Celem.term2str t ^ " = NONE"); []) 
  25.202  			end
  25.203 -    else (tracing ("### locate_rule:  " ^ id_of_thm r ^ " not mem rrls"); [])
  25.204 +    else (tracing ("### locate_rule:  " ^ Celem.id_of_thm r ^ " not mem rrls"); [])
  25.205    | locate_rule _ _ _ _ _ _ = error "locate_rule: doesnt match rev-sets in istate";
  25.206  
  25.207  fun next_rule thy eval_rls ro [rs] t =
  25.208 @@ -506,13 +506,13 @@
  25.209      in case der of (_, r, _) :: _ => SOME r | _ => NONE end
  25.210    | next_rule _ _ _ _ _ = error ("next_rule: doesnt match rev-sets in istate");
  25.211  
  25.212 -fun attach_form (_:rule list list) (_:term) (_:term) = 
  25.213 -  [(*TODO*)]: (rule * (term * term list)) list;
  25.214 +fun attach_form (_: Celem.rule list list) (_: term) (_: term) = 
  25.215 +  [(*TODO*)]: ( Celem.rule * (term * term list)) list;
  25.216  
  25.217  in
  25.218  
  25.219  val cancel_p = 
  25.220 -  Rrls {id = "cancel_p", prepat = [],
  25.221 +  Celem.Rrls {id = "cancel_p", prepat = [],
  25.222  	rew_ord=("ord_make_polynomial", ord_make_polynomial false thy),
  25.223  	erls = rational_erls, 
  25.224  	calc = 
  25.225 @@ -522,7 +522,7 @@
  25.226  	  ("POWER", ("Atools.pow", eval_binop "#power_"))],
  25.227      errpatts = [],
  25.228  	scr =
  25.229 -	  Rfuns {init_state  = init_state thy Atools_erls ro,
  25.230 +	  Celem.Rfuns {init_state  = init_state thy Atools_erls ro,
  25.231  		normal_form = cancel_p_ thy, 
  25.232  		locate_rule = locate_rule thy Atools_erls ro,
  25.233  		next_rule   = next_rule thy Atools_erls ro,
  25.234 @@ -534,8 +534,8 @@
  25.235  ML {*
  25.236  local (* add_fractions_p *)
  25.237  
  25.238 -(*val {rules = rules, rew_ord = (_, ro), ...} = rep_rls (assoc_rls "make_polynomial");*)
  25.239 -val {rules, rew_ord=(_,ro),...} = rep_rls (assoc_rls' @{theory} "rev_rew_p");
  25.240 +(*val {rules = rules, rew_ord = (_, ro), ...} = Celem.rep_rls (assoc_rls "make_polynomial");*)
  25.241 +val {rules, rew_ord=(_,ro),...} = Celem.rep_rls (assoc_rls' @{theory} "rev_rew_p");
  25.242  
  25.243  fun init_state thy eval_rls ro t =
  25.244    let 
  25.245 @@ -543,23 +543,23 @@
  25.246      val SOME (t'', asm) = add_fraction_p_ thy t;
  25.247      val der = Rtools.reverse_deriv thy eval_rls rules ro NONE t';
  25.248      val der = der @ 
  25.249 -      [(Thm ("real_mult_div_cancel2", TermC.num_str @{thm real_mult_div_cancel2}), (t'',asm))]
  25.250 +      [(Celem.Thm ("real_mult_div_cancel2", TermC.num_str @{thm real_mult_div_cancel2}), (t'',asm))]
  25.251      val rs = (Rtools.distinct_Thm o (map #1)) der;
  25.252      val rs = filter_out (Rtools.eq_Thms 
  25.253        ["sym_real_add_zero_left", "sym_real_mult_0", "sym_real_mult_1"]) rs;
  25.254    in (t, t'', [rs(*here only _ONE_*)], der) end;
  25.255  
  25.256  fun locate_rule thy eval_rls ro [rs] t r =
  25.257 -    if member op = ((map (id_of_thm)) rs) (id_of_thm r)
  25.258 +    if member op = ((map (Celem.id_of_thm)) rs) (Celem.id_of_thm r)
  25.259      then 
  25.260 -      let val ropt = Rewrite.rewrite_ thy ro eval_rls true (thm_of_thm r) t;
  25.261 +      let val ropt = Rewrite.rewrite_ thy ro eval_rls true (Celem.thm_of_thm r) t;
  25.262        in 
  25.263          case ropt of
  25.264            SOME ta => [(r, ta)]
  25.265  	      | NONE => 
  25.266 -	        (tracing ("### locate_rule:  rewrite " ^ id_of_thm r ^ " " ^ term2str t ^ " = NONE");
  25.267 +	        (tracing ("### locate_rule:  rewrite " ^ Celem.id_of_thm r ^ " " ^ Celem.term2str t ^ " = NONE");
  25.268  	        []) end
  25.269 -    else (tracing ("### locate_rule:  " ^ id_of_thm r ^ " not mem rrls"); [])
  25.270 +    else (tracing ("### locate_rule:  " ^ Celem.id_of_thm r ^ " not mem rrls"); [])
  25.271    | locate_rule _ _ _ _ _ _ = error "locate_rule: doesnt match rev-sets in istate";
  25.272  
  25.273  fun next_rule thy eval_rls ro [rs] t =
  25.274 @@ -580,7 +580,7 @@
  25.275  in
  25.276  
  25.277  val add_fractions_p =
  25.278 -  Rrls {id = "add_fractions_p", prepat=prepat,
  25.279 +  Celem.Rrls {id = "add_fractions_p", prepat=prepat,
  25.280      rew_ord = ("ord_make_polynomial", ord_make_polynomial false thy),
  25.281      erls = rational_erls,
  25.282      calc = [("PLUS", ("Groups.plus_class.plus", eval_binop "#add_")),
  25.283 @@ -588,7 +588,7 @@
  25.284        ("DIVIDE", ("Rings.divide_class.divide", eval_cancel "#divide_e")),
  25.285        ("POWER", ("Atools.pow", eval_binop "#power_"))],
  25.286      errpatts = [],
  25.287 -    scr = Rfuns {init_state  = init_state thy Atools_erls ro,
  25.288 +    scr = Celem.Rfuns {init_state  = init_state thy Atools_erls ro,
  25.289        normal_form = add_fraction_p_ thy,
  25.290        locate_rule = locate_rule thy Atools_erls ro,
  25.291        next_rule   = next_rule thy Atools_erls ro,
  25.292 @@ -610,254 +610,254 @@
  25.293  
  25.294  (*erls for calculate_Rational; make local with FIXX@ME result:term *term list*)
  25.295  val powers_erls = prep_rls'(
  25.296 -  Rls {id = "powers_erls", preconds = [], rew_ord = ("dummy_ord",dummy_ord), 
  25.297 -      erls = e_rls, srls = Erls, calc = [], errpatts = [],
  25.298 -      rules = [Calc ("Atools.is'_atom",eval_is_atom "#is_atom_"),
  25.299 -	       Calc ("Atools.is'_even",eval_is_even "#is_even_"),
  25.300 -	       Calc ("Orderings.ord_class.less",eval_equ "#less_"),
  25.301 -	       Thm ("not_false", TermC.num_str @{thm not_false}),
  25.302 -	       Thm ("not_true", TermC.num_str @{thm not_true}),
  25.303 -	       Calc ("Groups.plus_class.plus",eval_binop "#add_")
  25.304 +  Celem.Rls {id = "powers_erls", preconds = [], rew_ord = ("dummy_ord",Celem.dummy_ord), 
  25.305 +      erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [],
  25.306 +      rules = [Celem.Calc ("Atools.is'_atom",eval_is_atom "#is_atom_"),
  25.307 +	       Celem.Calc ("Atools.is'_even",eval_is_even "#is_even_"),
  25.308 +	       Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"),
  25.309 +	       Celem.Thm ("not_false", TermC.num_str @{thm not_false}),
  25.310 +	       Celem.Thm ("not_true", TermC.num_str @{thm not_true}),
  25.311 +	       Celem.Calc ("Groups.plus_class.plus",eval_binop "#add_")
  25.312  	       ],
  25.313 -      scr = EmptyScr
  25.314 -      }:rls);
  25.315 +      scr = Celem.EmptyScr
  25.316 +      });
  25.317  (*.all powers over + distributed; atoms over * collected, other distributed
  25.318     contains absolute minimum of thms for context in norm_Rational .*)
  25.319  val powers = prep_rls'(
  25.320 -  Rls {id = "powers", preconds = [], rew_ord = ("dummy_ord",dummy_ord), 
  25.321 -      erls = powers_erls, srls = Erls, calc = [], errpatts = [],
  25.322 -      rules = [Thm ("realpow_multI", TermC.num_str @{thm realpow_multI}),
  25.323 +  Celem.Rls {id = "powers", preconds = [], rew_ord = ("dummy_ord",Celem.dummy_ord), 
  25.324 +      erls = powers_erls, srls = Celem.Erls, calc = [], errpatts = [],
  25.325 +      rules = [Celem.Thm ("realpow_multI", TermC.num_str @{thm realpow_multI}),
  25.326  	       (*"(r * s) ^^^ n = r ^^^ n * s ^^^ n"*)
  25.327 -	       Thm ("realpow_pow",TermC.num_str @{thm realpow_pow}),
  25.328 +	       Celem.Thm ("realpow_pow",TermC.num_str @{thm realpow_pow}),
  25.329  	       (*"(a ^^^ b) ^^^ c = a ^^^ (b * c)"*)
  25.330 -	       Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}),
  25.331 +	       Celem.Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}),
  25.332  	       (*"r ^^^ 1 = r"*)
  25.333 -	       Thm ("realpow_minus_even",TermC.num_str @{thm realpow_minus_even}),
  25.334 +	       Celem.Thm ("realpow_minus_even",TermC.num_str @{thm realpow_minus_even}),
  25.335  	       (*"n is_even ==> (- r) ^^^ n = r ^^^ n" ?-->discard_minus?*)
  25.336 -	       Thm ("realpow_minus_odd",TermC.num_str @{thm realpow_minus_odd}),
  25.337 +	       Celem.Thm ("realpow_minus_odd",TermC.num_str @{thm realpow_minus_odd}),
  25.338  	       (*"Not (n is_even) ==> (- r) ^^^ n = -1 * r ^^^ n"*)
  25.339  	       
  25.340  	       (*----- collect atoms over * -----*)
  25.341 -	       Thm ("realpow_two_atom",TermC.num_str @{thm realpow_two_atom}),	
  25.342 +	       Celem.Thm ("realpow_two_atom",TermC.num_str @{thm realpow_two_atom}),	
  25.343  	       (*"r is_atom ==> r * r = r ^^^ 2"*)
  25.344 -	       Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),		
  25.345 +	       Celem.Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),		
  25.346  	       (*"r is_atom ==> r * r ^^^ n = r ^^^ (n + 1)"*)
  25.347 -	       Thm ("realpow_addI_atom",TermC.num_str @{thm realpow_addI_atom}),
  25.348 +	       Celem.Thm ("realpow_addI_atom",TermC.num_str @{thm realpow_addI_atom}),
  25.349  	       (*"r is_atom ==> r ^^^ n * r ^^^ m = r ^^^ (n + m)"*)
  25.350  
  25.351  	       (*----- distribute none-atoms -----*)
  25.352 -	       Thm ("realpow_def_atom",TermC.num_str @{thm realpow_def_atom}),
  25.353 +	       Celem.Thm ("realpow_def_atom",TermC.num_str @{thm realpow_def_atom}),
  25.354  	       (*"[| 1 < n; not(r is_atom) |]==>r ^^^ n = r * r ^^^ (n + -1)"*)
  25.355 -	       Thm ("realpow_eq_oneI",TermC.num_str @{thm realpow_eq_oneI}),
  25.356 +	       Celem.Thm ("realpow_eq_oneI",TermC.num_str @{thm realpow_eq_oneI}),
  25.357  	       (*"1 ^^^ n = 1"*)
  25.358 -	       Calc ("Groups.plus_class.plus",eval_binop "#add_")
  25.359 +	       Celem.Calc ("Groups.plus_class.plus",eval_binop "#add_")
  25.360  	       ],
  25.361 -      scr = EmptyScr
  25.362 -      }:rls);
  25.363 +      scr = Celem.EmptyScr
  25.364 +      });
  25.365  (*.contains absolute minimum of thms for context in norm_Rational.*)
  25.366  val rat_mult_divide = prep_rls'(
  25.367 -  Rls {id = "rat_mult_divide", preconds = [], 
  25.368 -      rew_ord = ("dummy_ord", dummy_ord), 
  25.369 -      erls = e_rls, srls = Erls, calc = [], errpatts = [],
  25.370 -      rules = [Thm ("rat_mult",TermC.num_str @{thm rat_mult}),
  25.371 +  Celem.Rls {id = "rat_mult_divide", preconds = [], 
  25.372 +      rew_ord = ("dummy_ord", Celem.dummy_ord), 
  25.373 +      erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [],
  25.374 +      rules = [Celem.Thm ("rat_mult",TermC.num_str @{thm rat_mult}),
  25.375  	       (*(1)"?a / ?b * (?c / ?d) = ?a * ?c / (?b * ?d)"*)
  25.376 -	       Thm ("times_divide_eq_right",TermC.num_str @{thm times_divide_eq_right}),
  25.377 +	       Celem.Thm ("times_divide_eq_right",TermC.num_str @{thm times_divide_eq_right}),
  25.378  	       (*(2)"?a * (?c / ?d) = ?a * ?c / ?d" must be [2],
  25.379  	       otherwise inv.to a / b / c = ...*)
  25.380 -	       Thm ("times_divide_eq_left",TermC.num_str @{thm times_divide_eq_left}),
  25.381 +	       Celem.Thm ("times_divide_eq_left",TermC.num_str @{thm times_divide_eq_left}),
  25.382  	       (*"?a / ?b * ?c = ?a * ?c / ?b" order weights x^^^n too much
  25.383  		     and does not commute a / b * c ^^^ 2 !*)
  25.384  	       
  25.385 -	       Thm ("divide_divide_eq_right", 
  25.386 +	       Celem.Thm ("divide_divide_eq_right", 
  25.387                       TermC.num_str @{thm divide_divide_eq_right}),
  25.388  	       (*"?x / (?y / ?z) = ?x * ?z / ?y"*)
  25.389 -	       Thm ("divide_divide_eq_left",
  25.390 +	       Celem.Thm ("divide_divide_eq_left",
  25.391                       TermC.num_str @{thm divide_divide_eq_left}),
  25.392  	       (*"?x / ?y / ?z = ?x / (?y * ?z)"*)
  25.393 -	       Calc ("Rings.divide_class.divide"  ,eval_cancel "#divide_e")
  25.394 +	       Celem.Calc ("Rings.divide_class.divide"  ,eval_cancel "#divide_e")
  25.395  	       ],
  25.396 -      scr = EmptyScr
  25.397 -      }:rls);
  25.398 +      scr = Celem.EmptyScr
  25.399 +      });
  25.400  
  25.401  (*.contains absolute minimum of thms for context in norm_Rational.*)
  25.402  val reduce_0_1_2 = prep_rls'(
  25.403 -  Rls{id = "reduce_0_1_2", preconds = [], rew_ord = ("dummy_ord", dummy_ord),
  25.404 -      erls = e_rls, srls = Erls, calc = [], errpatts = [],
  25.405 -      rules = [(*Thm ("divide_1",TermC.num_str @{thm divide_1}),
  25.406 +  Celem.Rls{id = "reduce_0_1_2", preconds = [], rew_ord = ("dummy_ord", Celem.dummy_ord),
  25.407 +      erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [],
  25.408 +      rules = [(*Celem.Thm ("divide_1",TermC.num_str @{thm divide_1}),
  25.409  		 "?x / 1 = ?x" unnecess.for normalform*)
  25.410 -	       Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),                 
  25.411 +	       Celem.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),                 
  25.412  	       (*"1 * z = z"*)
  25.413 -	       (*Thm ("real_mult_minus1",TermC.num_str @{thm real_mult_minus1}),
  25.414 +	       (*Celem.Thm ("real_mult_minus1",TermC.num_str @{thm real_mult_minus1}),
  25.415  	       "-1 * z = - z"*)
  25.416 -	       (*Thm ("real_minus_mult_cancel",TermC.num_str @{thm real_minus_mult_cancel}),
  25.417 +	       (*Celem.Thm ("real_minus_mult_cancel",TermC.num_str @{thm real_minus_mult_cancel}),
  25.418  	       "- ?x * - ?y = ?x * ?y"*)
  25.419  
  25.420 -	       Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),        
  25.421 +	       Celem.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),        
  25.422  	       (*"0 * z = 0"*)
  25.423 -	       Thm ("add_0_left",TermC.num_str @{thm add_0_left}),
  25.424 +	       Celem.Thm ("add_0_left",TermC.num_str @{thm add_0_left}),
  25.425  	       (*"0 + z = z"*)
  25.426 -	       (*Thm ("right_minus",TermC.num_str @{thm right_minus}),
  25.427 +	       (*Celem.Thm ("right_minus",TermC.num_str @{thm right_minus}),
  25.428  	       "?z + - ?z = 0"*)
  25.429  
  25.430 -	       Thm ("sym_real_mult_2",
  25.431 +	       Celem.Thm ("sym_real_mult_2",
  25.432                       TermC.num_str (@{thm real_mult_2} RS @{thm sym})),	
  25.433  	       (*"z1 + z1 = 2 * z1"*)
  25.434 -	       Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),
  25.435 +	       Celem.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),
  25.436  	       (*"z1 + (z1 + k) = 2 * z1 + k"*)
  25.437  
  25.438 -	       Thm ("division_ring_divide_zero",TermC.num_str @{thm division_ring_divide_zero})
  25.439 +	       Celem.Thm ("division_ring_divide_zero",TermC.num_str @{thm division_ring_divide_zero})
  25.440  	       (*"0 / ?x = 0"*)
  25.441 -	       ], scr = EmptyScr}:rls);
  25.442 +	       ], scr = Celem.EmptyScr});
  25.443  
  25.444  (*erls for calculate_Rational; 
  25.445    make local with FIXX@ME result:term *term list WN0609???SKMG*)
  25.446  val norm_rat_erls = prep_rls'(
  25.447 -  Rls {id = "norm_rat_erls", preconds = [], rew_ord = ("dummy_ord",dummy_ord), 
  25.448 -      erls = e_rls, srls = Erls, calc = [], errpatts = [],
  25.449 -      rules = [Calc ("Atools.is'_const",eval_const "#is_const_")
  25.450 -	       ], scr = EmptyScr}:rls);
  25.451 +  Celem.Rls {id = "norm_rat_erls", preconds = [], rew_ord = ("dummy_ord",Celem.dummy_ord), 
  25.452 +      erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [],
  25.453 +      rules = [Celem.Calc ("Atools.is'_const",eval_const "#is_const_")
  25.454 +	       ], scr = Celem.EmptyScr});
  25.455  
  25.456  (* consists of rls containing the absolute minimum of thms *)
  25.457  (*040209: this version has been used by RL for his equations,
  25.458  which is now replaced by MGs version "norm_Rational" below *)
  25.459  val norm_Rational_min = prep_rls'(
  25.460 -  Rls {id = "norm_Rational_min", preconds = [], rew_ord = ("dummy_ord",dummy_ord), 
  25.461 -      erls = norm_rat_erls, srls = Erls, calc = [], errpatts = [],
  25.462 +  Celem.Rls {id = "norm_Rational_min", preconds = [], rew_ord = ("dummy_ord",Celem.dummy_ord), 
  25.463 +      erls = norm_rat_erls, srls = Celem.Erls, calc = [], errpatts = [],
  25.464        rules = [(*sequence given by operator precedence*)
  25.465 -	       Rls_ discard_minus,
  25.466 -	       Rls_ powers,
  25.467 -	       Rls_ rat_mult_divide,
  25.468 -	       Rls_ expand,
  25.469 -	       Rls_ reduce_0_1_2,
  25.470 -	       Rls_ order_add_mult,
  25.471 -	       Rls_ collect_numerals,
  25.472 -	       Rls_ add_fractions_p,
  25.473 -	       Rls_ cancel_p
  25.474 +	       Celem.Rls_ discard_minus,
  25.475 +	       Celem.Rls_ powers,
  25.476 +	       Celem.Rls_ rat_mult_divide,
  25.477 +	       Celem.Rls_ expand,
  25.478 +	       Celem.Rls_ reduce_0_1_2,
  25.479 +	       Celem.Rls_ order_add_mult,
  25.480 +	       Celem.Rls_ collect_numerals,
  25.481 +	       Celem.Rls_ add_fractions_p,
  25.482 +	       Celem.Rls_ cancel_p
  25.483  	       ],
  25.484 -      scr = EmptyScr}:rls);
  25.485 +      scr = Celem.EmptyScr});
  25.486  
  25.487  val norm_Rational_parenthesized = prep_rls'(
  25.488 -  Seq {id = "norm_Rational_parenthesized", preconds = []:term list, 
  25.489 -       rew_ord = ("dummy_ord", dummy_ord),
  25.490 -      erls = Atools_erls, srls = Erls,
  25.491 +  Celem.Seq {id = "norm_Rational_parenthesized", preconds = []:term list, 
  25.492 +       rew_ord = ("dummy_ord", Celem.dummy_ord),
  25.493 +      erls = Atools_erls, srls = Celem.Erls,
  25.494        calc = [], errpatts = [],
  25.495 -      rules = [Rls_  norm_Rational_min,
  25.496 -	       Rls_ discard_parentheses
  25.497 +      rules = [Celem.Rls_  norm_Rational_min,
  25.498 +	       Celem.Rls_ discard_parentheses
  25.499  	       ],
  25.500 -      scr = EmptyScr}:rls);      
  25.501 +      scr = Celem.EmptyScr});      
  25.502  
  25.503  (*WN030318???SK: simplifies all but cancel and common_nominator*)
  25.504  val simplify_rational = 
  25.505 -    merge_rls "simplify_rational" expand_binoms
  25.506 -    (append_rls "divide" calculate_Rational
  25.507 -		[Thm ("div_by_1",TermC.num_str @{thm div_by_1}),
  25.508 +    Celem.merge_rls "simplify_rational" expand_binoms
  25.509 +    (Celem.append_rls "divide" calculate_Rational
  25.510 +		[Celem.Thm ("div_by_1",TermC.num_str @{thm div_by_1}),
  25.511  		 (*"?x / 1 = ?x"*)
  25.512 -		 Thm ("rat_mult",TermC.num_str @{thm rat_mult}),
  25.513 +		 Celem.Thm ("rat_mult",TermC.num_str @{thm rat_mult}),
  25.514  		 (*(1)"?a / ?b * (?c / ?d) = ?a * ?c / (?b * ?d)"*)
  25.515 -		 Thm ("times_divide_eq_right",TermC.num_str @{thm times_divide_eq_right}),
  25.516 +		 Celem.Thm ("times_divide_eq_right",TermC.num_str @{thm times_divide_eq_right}),
  25.517  		 (*(2)"?a * (?c / ?d) = ?a * ?c / ?d" must be [2],
  25.518  		 otherwise inv.to a / b / c = ...*)
  25.519 -		 Thm ("times_divide_eq_left",TermC.num_str @{thm times_divide_eq_left}),
  25.520 +		 Celem.Thm ("times_divide_eq_left",TermC.num_str @{thm times_divide_eq_left}),
  25.521  		 (*"?a / ?b * ?c = ?a * ?c / ?b"*)
  25.522 -		 Thm ("add_minus",TermC.num_str @{thm add_minus}),
  25.523 +		 Celem.Thm ("add_minus",TermC.num_str @{thm add_minus}),
  25.524  		 (*"?a + ?b - ?b = ?a"*)
  25.525 -		 Thm ("add_minus1",TermC.num_str @{thm add_minus1}),
  25.526 +		 Celem.Thm ("add_minus1",TermC.num_str @{thm add_minus1}),
  25.527  		 (*"?a - ?b + ?b = ?a"*)
  25.528 -		 Thm ("divide_minus1",TermC.num_str @{thm divide_minus1})
  25.529 +		 Celem.Thm ("divide_minus1",TermC.num_str @{thm divide_minus1})
  25.530  		 (*"?x / -1 = - ?x"*)
  25.531  		 ]);
  25.532  *}
  25.533  ML {* 
  25.534  val add_fractions_p_rls = prep_rls'(
  25.535 -  Rls {id = "add_fractions_p_rls", preconds = [], rew_ord = ("dummy_ord", dummy_ord), 
  25.536 -	  erls = e_rls, srls = Erls, calc = [], errpatts = [],
  25.537 -	  rules = [Rls_ add_fractions_p], 
  25.538 -	  scr = EmptyScr});
  25.539 +  Celem.Rls {id = "add_fractions_p_rls", preconds = [], rew_ord = ("dummy_ord", Celem.dummy_ord), 
  25.540 +	  erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [],
  25.541 +	  rules = [Celem.Rls_ add_fractions_p], 
  25.542 +	  scr = Celem.EmptyScr});
  25.543  
  25.544 -(* "Rls" causes repeated application of cancel_p to one and the same term *)
  25.545 +(* "Celem.Rls" causes repeated application of cancel_p to one and the same term *)
  25.546  val cancel_p_rls = prep_rls'(
  25.547 -  Rls 
  25.548 -    {id = "cancel_p_rls", preconds = [], rew_ord = ("dummy_ord", dummy_ord), 
  25.549 -    erls = e_rls, srls = Erls, calc = [], errpatts = [],
  25.550 -    rules = [Rls_ cancel_p], 
  25.551 -	  scr = EmptyScr});
  25.552 +  Celem.Rls 
  25.553 +    {id = "cancel_p_rls", preconds = [], rew_ord = ("dummy_ord", Celem.dummy_ord), 
  25.554 +    erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [],
  25.555 +    rules = [Celem.Rls_ cancel_p], 
  25.556 +	  scr = Celem.EmptyScr});
  25.557  
  25.558  (*. makes 'normal' fractions; 'is_polyexp' inhibits double fractions;
  25.559      used in initial part norm_Rational_mg, see example DA-M02-main.p.60.*)
  25.560  val rat_mult_poly = prep_rls'(
  25.561 -  Rls {id = "rat_mult_poly", preconds = [], rew_ord = ("dummy_ord", dummy_ord), 
  25.562 -	  erls = append_rls "e_rls-is_polyexp" e_rls [Calc ("Poly.is'_polyexp", eval_is_polyexp "")], 
  25.563 -	  srls = Erls, calc = [], errpatts = [],
  25.564 +  Celem.Rls {id = "rat_mult_poly", preconds = [], rew_ord = ("dummy_ord", Celem.dummy_ord), 
  25.565 +	  erls = Celem.append_rls "Celem.e_rls-is_polyexp" Celem.e_rls [Celem.Calc ("Poly.is'_polyexp", eval_is_polyexp "")], 
  25.566 +	  srls = Celem.Erls, calc = [], errpatts = [],
  25.567  	  rules = 
  25.568 -	    [Thm ("rat_mult_poly_l",TermC.num_str @{thm rat_mult_poly_l}),
  25.569 +	    [Celem.Thm ("rat_mult_poly_l",TermC.num_str @{thm rat_mult_poly_l}),
  25.570  	    (*"?c is_polyexp ==> ?c * (?a / ?b) = ?c * ?a / ?b"*)
  25.571 -	    Thm ("rat_mult_poly_r",TermC.num_str @{thm rat_mult_poly_r})
  25.572 +	    Celem.Thm ("rat_mult_poly_r",TermC.num_str @{thm rat_mult_poly_r})
  25.573  	    (*"?c is_polyexp ==> ?a / ?b * ?c = ?a * ?c / ?b"*) ], 
  25.574 -	  scr = EmptyScr});
  25.575 +	  scr = Celem.EmptyScr});
  25.576  
  25.577  (*. makes 'normal' fractions; 'is_polyexp' inhibits double fractions;
  25.578      used in looping part norm_Rational_rls, see example DA-M02-main.p.60 
  25.579 -    .. WHERE THE LATTER DOES ALWAYS WORK, BECAUSE erls = e_rls, 
  25.580 -    I.E. THE RESPECTIVE ASSUMPTION IS STORED AND Thm APPLIED; WN051028 
  25.581 +    .. WHERE THE LATTER DOES ALWAYS WORK, BECAUSE erls = Celem.e_rls, 
  25.582 +    I.E. THE RESPECTIVE ASSUMPTION IS STORED AND Celem.Thm APPLIED; WN051028 
  25.583      ... WN0609???MG.*)
  25.584  val rat_mult_div_pow = prep_rls'(
  25.585 -  Rls {id = "rat_mult_div_pow", preconds = [], rew_ord = ("dummy_ord",dummy_ord), 
  25.586 -    erls = e_rls, srls = Erls, calc = [], errpatts = [],
  25.587 -    rules = [Thm ("rat_mult", TermC.num_str @{thm rat_mult}),
  25.588 +  Celem.Rls {id = "rat_mult_div_pow", preconds = [], rew_ord = ("dummy_ord",Celem.dummy_ord), 
  25.589 +    erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [],
  25.590 +    rules = [Celem.Thm ("rat_mult", TermC.num_str @{thm rat_mult}),
  25.591        (*"?a / ?b * (?c / ?d) = ?a * ?c / (?b * ?d)"*)
  25.592 -      Thm ("rat_mult_poly_l", TermC.num_str @{thm rat_mult_poly_l}),
  25.593 +      Celem.Thm ("rat_mult_poly_l", TermC.num_str @{thm rat_mult_poly_l}),
  25.594        (*"?c is_polyexp ==> ?c * (?a / ?b) = ?c * ?a / ?b"*)
  25.595 -      Thm ("rat_mult_poly_r", TermC.num_str @{thm rat_mult_poly_r}),
  25.596 +      Celem.Thm ("rat_mult_poly_r", TermC.num_str @{thm rat_mult_poly_r}),
  25.597        (*"?c is_polyexp ==> ?a / ?b * ?c = ?a * ?c / ?b"*)
  25.598        
  25.599 -      Thm ("real_divide_divide1_mg", TermC.num_str @{thm real_divide_divide1_mg}),
  25.600 +      Celem.Thm ("real_divide_divide1_mg", TermC.num_str @{thm real_divide_divide1_mg}),
  25.601        (*"y ~= 0 ==> (u / v) / (y / z) = (u * z) / (y * v)"*)
  25.602 -      Thm ("divide_divide_eq_right", TermC.num_str @{thm divide_divide_eq_right}),
  25.603 +      Celem.Thm ("divide_divide_eq_right", TermC.num_str @{thm divide_divide_eq_right}),
  25.604        (*"?x / (?y / ?z) = ?x * ?z / ?y"*)
  25.605 -      Thm ("divide_divide_eq_left", TermC.num_str @{thm divide_divide_eq_left}),
  25.606 +      Celem.Thm ("divide_divide_eq_left", TermC.num_str @{thm divide_divide_eq_left}),
  25.607        (*"?x / ?y / ?z = ?x / (?y * ?z)"*)
  25.608 -      Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),
  25.609 +      Celem.Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),
  25.610        
  25.611 -      Thm ("rat_power", TermC.num_str @{thm rat_power})
  25.612 +      Celem.Thm ("rat_power", TermC.num_str @{thm rat_power})
  25.613        (*"(?a / ?b) ^^^ ?n = ?a ^^^ ?n / ?b ^^^ ?n"*)
  25.614        ],
  25.615 -    scr = EmptyScr}:rls);
  25.616 +    scr = Celem.EmptyScr});
  25.617  
  25.618  val rat_reduce_1 = prep_rls'(
  25.619 -  Rls {id = "rat_reduce_1", preconds = [], rew_ord = ("dummy_ord", dummy_ord), 
  25.620 -    erls = e_rls, srls = Erls, calc = [], errpatts = [], 
  25.621 +  Celem.Rls {id = "rat_reduce_1", preconds = [], rew_ord = ("dummy_ord", Celem.dummy_ord), 
  25.622 +    erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [], 
  25.623      rules = 
  25.624 -      [Thm ("div_by_1", TermC.num_str @{thm div_by_1}),
  25.625 +      [Celem.Thm ("div_by_1", TermC.num_str @{thm div_by_1}),
  25.626        (*"?x / 1 = ?x"*)
  25.627 -      Thm ("mult_1_left", TermC.num_str @{thm mult_1_left})           
  25.628 +      Celem.Thm ("mult_1_left", TermC.num_str @{thm mult_1_left})           
  25.629        (*"1 * z = z"*)
  25.630        ],
  25.631 -    scr = EmptyScr}:rls);
  25.632 +    scr = Celem.EmptyScr});
  25.633  
  25.634  (* looping part of norm_Rational *)
  25.635  val norm_Rational_rls = prep_rls' (
  25.636 -  Rls {id = "norm_Rational_rls", preconds = [], rew_ord = ("dummy_ord",dummy_ord), 
  25.637 -    erls = norm_rat_erls, srls = Erls, calc = [], errpatts = [],
  25.638 -    rules = [Rls_ add_fractions_p_rls,
  25.639 -      Rls_ rat_mult_div_pow,
  25.640 -      Rls_ make_rat_poly_with_parentheses,
  25.641 -      Rls_ cancel_p_rls,
  25.642 -      Rls_ rat_reduce_1
  25.643 +  Celem.Rls {id = "norm_Rational_rls", preconds = [], rew_ord = ("dummy_ord",Celem.dummy_ord), 
  25.644 +    erls = norm_rat_erls, srls = Celem.Erls, calc = [], errpatts = [],
  25.645 +    rules = [Celem.Rls_ add_fractions_p_rls,
  25.646 +      Celem.Rls_ rat_mult_div_pow,
  25.647 +      Celem.Rls_ make_rat_poly_with_parentheses,
  25.648 +      Celem.Rls_ cancel_p_rls,
  25.649 +      Celem.Rls_ rat_reduce_1
  25.650        ],
  25.651 -    scr = EmptyScr}:rls);
  25.652 +    scr = Celem.EmptyScr});
  25.653  
  25.654  val norm_Rational = prep_rls' (
  25.655 -  Seq 
  25.656 -    {id = "norm_Rational", preconds = [], rew_ord = ("dummy_ord", dummy_ord), 
  25.657 -    erls = norm_rat_erls, srls = Erls, calc = [], errpatts = [],
  25.658 -    rules = [Rls_ discard_minus,
  25.659 -      Rls_ rat_mult_poly,             (* removes double fractions like a/b/c *)
  25.660 -      Rls_ make_rat_poly_with_parentheses,
  25.661 -      Rls_ cancel_p_rls,
  25.662 -      Rls_ norm_Rational_rls,         (* the main rls, looping (#) *)
  25.663 -      Rls_ discard_parentheses1       (* mult only *)
  25.664 +  Celem.Seq 
  25.665 +    {id = "norm_Rational", preconds = [], rew_ord = ("dummy_ord", Celem.dummy_ord), 
  25.666 +    erls = norm_rat_erls, srls = Celem.Erls, calc = [], errpatts = [],
  25.667 +    rules = [Celem.Rls_ discard_minus,
  25.668 +      Celem.Rls_ rat_mult_poly,             (* removes double fractions like a/b/c *)
  25.669 +      Celem.Rls_ make_rat_poly_with_parentheses,
  25.670 +      Celem.Rls_ cancel_p_rls,
  25.671 +      Celem.Rls_ norm_Rational_rls,         (* the main rls, looping (#) *)
  25.672 +      Celem.Rls_ discard_parentheses1       (* mult only *)
  25.673        ],
  25.674 -    scr = EmptyScr}:rls);
  25.675 +    scr = Celem.EmptyScr});
  25.676  *}
  25.677  
  25.678  setup {* KEStore_Elems.add_rlss 
  25.679 @@ -886,27 +886,27 @@
  25.680  
  25.681  section {* A problem for simplification of rationals *}
  25.682  setup {* KEStore_Elems.add_pbts
  25.683 -  [(Specify.prep_pbt thy "pbl_simp_rat" [] e_pblID
  25.684 +  [(Specify.prep_pbt thy "pbl_simp_rat" [] Celem.e_pblID
  25.685        (["rational","simplification"],
  25.686          [("#Given" ,["Term t_t"]),
  25.687            ("#Where" ,["t_t is_ratpolyexp"]),
  25.688            ("#Find"  ,["normalform n_n"])],
  25.689 -        append_rls "e_rls" e_rls [(*for preds in where_*)], 
  25.690 +        Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*)], 
  25.691          SOME "Simplify t_t", [["simplification","of_rationals"]]))] *}
  25.692  
  25.693  section {* A methods for simplification of rationals *}
  25.694  (*WN061025 this methods script is copied from (auto-generated) script
  25.695    of norm_Rational in order to ease repair on inform*)
  25.696  setup {* KEStore_Elems.add_mets
  25.697 -  [Specify.prep_met thy "met_simp_rat" [] e_metID
  25.698 +  [Specify.prep_met thy "met_simp_rat" [] Celem.e_metID
  25.699        (["simplification","of_rationals"],
  25.700          [("#Given" ,["Term t_t"]),
  25.701            ("#Where" ,["t_t is_ratpolyexp"]),
  25.702            ("#Find"  ,["normalform n_n"])],
  25.703 -	      {rew_ord'="tless_true", rls' = e_rls, calc = [], srls = e_rls, 
  25.704 -	        prls = append_rls "simplification_of_rationals_prls" e_rls 
  25.705 -				    [(*for preds in where_*) Calc ("Rational.is'_ratpolyexp", eval_is_ratpolyexp "")],
  25.706 -				  crls = e_rls, errpats = [], nrls = norm_Rational_rls},
  25.707 +	      {rew_ord'="tless_true", rls' = Celem.e_rls, calc = [], srls = Celem.e_rls, 
  25.708 +	        prls = Celem.append_rls "simplification_of_rationals_prls" Celem.e_rls 
  25.709 +				    [(*for preds in where_*) Celem.Calc ("Rational.is'_ratpolyexp", eval_is_ratpolyexp "")],
  25.710 +				  crls = Celem.e_rls, errpats = [], nrls = norm_Rational_rls},
  25.711  				  "Script SimplifyScript (t_t::real) =                             " ^
  25.712            "  ((Try (Rewrite_Set discard_minus False) @@                   " ^
  25.713            "    Try (Rewrite_Set rat_mult_poly False) @@                    " ^
    26.1 --- a/src/Tools/isac/Knowledge/Root.thy	Thu Mar 15 10:17:44 2018 +0100
    26.2 +++ b/src/Tools/isac/Knowledge/Root.thy	Thu Mar 15 12:42:04 2018 +0100
    26.3 @@ -113,10 +113,10 @@
    26.4      (if pr then 
    26.5  	 let
    26.6  	     val (f, ts) = strip_comb t and (g, us) = strip_comb u;
    26.7 -	     val _ = tracing ("t= f@ts= \"" ^ term2str f ^"\" @ \"[" ^
    26.8 -	                      commas (map term2str ts) ^ "]\"");
    26.9 -	     val _ = tracing ("u= g@us= \"" ^ term2str g ^"\" @ \"[" ^
   26.10 -	                      commas (map term2str us) ^ "]\"");
   26.11 +	     val _ = tracing ("t= f@ts= \"" ^ Celem.term2str f ^"\" @ \"[" ^
   26.12 +	                      commas (map Celem.term2str ts) ^ "]\"");
   26.13 +	     val _ = tracing ("u= g@us= \"" ^ Celem.term2str g ^"\" @ \"[" ^
   26.14 +	                      commas (map Celem.term2str us) ^ "]\"");
   26.15  	     val _ = tracing ("size_of_term(t,u)= (" ^
   26.16  	                      string_of_int(size_of_term' t) ^", " ^
   26.17  	                      string_of_int(size_of_term' u) ^")");
   26.18 @@ -137,7 +137,7 @@
   26.19    prod_ord (prod_ord Term_Ord.indexname_ord Term_Ord.typ_ord) int_ord 
   26.20              (dest_hd' f, dest_hd' g)
   26.21  and terms_ord str pr (ts, us) = 
   26.22 -    list_ord (term_ord' pr (assoc_thy "Isac"))(ts, us);
   26.23 +    list_ord (term_ord' pr (Celem.assoc_thy "Isac"))(ts, us);
   26.24  
   26.25  in
   26.26  (* associates a+(b+c) => (a+b)+c = a+b+c ... avoiding parentheses 
   26.27 @@ -151,107 +151,107 @@
   26.28     thy:
   26.29     subst: no bound variables, only Root.sqrt
   26.30     tu: the terms to compare (t1, t2) ... *)
   26.31 -fun sqrt_right (pr:bool) thy (_:subst) tu = 
   26.32 +fun sqrt_right (pr:bool) thy (_: Celem.subst) tu = 
   26.33      (term_ord' pr thy(***) tu = LESS );
   26.34  end;
   26.35  
   26.36 -rew_ord' := overwritel (!rew_ord',
   26.37 +Celem.rew_ord' := overwritel (! Celem.rew_ord',
   26.38  [("termlessI", termlessI),
   26.39   ("sqrt_right", sqrt_right false @{theory "Pure"})
   26.40   ]);
   26.41  
   26.42  (*-------------------------rulse-------------------------*)
   26.43  val Root_crls = 
   26.44 -      append_rls "Root_crls" Atools_erls 
   26.45 -       [Thm  ("real_unari_minus",TermC.num_str @{thm real_unari_minus}),
   26.46 -        Calc ("NthRoot.sqrt" ,eval_sqrt "#sqrt_"),
   26.47 -        Calc ("Rings.divide_class.divide",eval_cancel "#divide_e"),
   26.48 -        Calc ("Atools.pow" ,eval_binop "#power_"),
   26.49 -        Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
   26.50 -        Calc ("Groups.minus_class.minus", eval_binop "#sub_"),
   26.51 -        Calc ("Groups.times_class.times", eval_binop "#mult_"),
   26.52 -        Calc ("HOL.eq",eval_equal "#equal_") 
   26.53 +      Celem.append_rls "Root_crls" Atools_erls 
   26.54 +       [Celem.Thm  ("real_unari_minus",TermC.num_str @{thm real_unari_minus}),
   26.55 +        Celem.Calc ("NthRoot.sqrt" ,eval_sqrt "#sqrt_"),
   26.56 +        Celem.Calc ("Rings.divide_class.divide",eval_cancel "#divide_e"),
   26.57 +        Celem.Calc ("Atools.pow" ,eval_binop "#power_"),
   26.58 +        Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
   26.59 +        Celem.Calc ("Groups.minus_class.minus", eval_binop "#sub_"),
   26.60 +        Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
   26.61 +        Celem.Calc ("HOL.eq",eval_equal "#equal_") 
   26.62          ];
   26.63  
   26.64  val Root_erls = 
   26.65 -      append_rls "Root_erls" Atools_erls 
   26.66 -       [Thm  ("real_unari_minus",TermC.num_str @{thm real_unari_minus}),
   26.67 -        Calc ("NthRoot.sqrt" ,eval_sqrt "#sqrt_"),
   26.68 -        Calc ("Rings.divide_class.divide",eval_cancel "#divide_e"),
   26.69 -        Calc ("Atools.pow" ,eval_binop "#power_"),
   26.70 -        Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
   26.71 -        Calc ("Groups.minus_class.minus", eval_binop "#sub_"),
   26.72 -        Calc ("Groups.times_class.times", eval_binop "#mult_"),
   26.73 -        Calc ("HOL.eq",eval_equal "#equal_") 
   26.74 +      Celem.append_rls "Root_erls" Atools_erls 
   26.75 +       [Celem.Thm  ("real_unari_minus",TermC.num_str @{thm real_unari_minus}),
   26.76 +        Celem.Calc ("NthRoot.sqrt" ,eval_sqrt "#sqrt_"),
   26.77 +        Celem.Calc ("Rings.divide_class.divide",eval_cancel "#divide_e"),
   26.78 +        Celem.Calc ("Atools.pow" ,eval_binop "#power_"),
   26.79 +        Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
   26.80 +        Celem.Calc ("Groups.minus_class.minus", eval_binop "#sub_"),
   26.81 +        Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
   26.82 +        Celem.Calc ("HOL.eq",eval_equal "#equal_") 
   26.83          ];
   26.84  *}
   26.85  setup {* KEStore_Elems.add_rlss [("Root_erls", (Context.theory_name @{theory}, Root_erls))] *}
   26.86  ML {*
   26.87  
   26.88  val make_rooteq = prep_rls'(
   26.89 -  Rls{id = "make_rooteq", preconds = []:term list, 
   26.90 +  Celem.Rls{id = "make_rooteq", preconds = []:term list, 
   26.91        rew_ord = ("sqrt_right", sqrt_right false thy),
   26.92 -      erls = Atools_erls, srls = Erls,
   26.93 +      erls = Atools_erls, srls = Celem.Erls,
   26.94        calc = [], errpatts = [],
   26.95 -      rules = [Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}),			
   26.96 +      rules = [Celem.Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}),			
   26.97  	       (*"a - b = a + (-1) * b"*)
   26.98  
   26.99 -	       Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),	
  26.100 +	       Celem.Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),	
  26.101  	       (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  26.102 -	       Thm ("distrib_left",TermC.num_str @{thm distrib_left}),	
  26.103 +	       Celem.Thm ("distrib_left",TermC.num_str @{thm distrib_left}),	
  26.104  	       (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  26.105 -	       Thm ("left_diff_distrib" ,TermC.num_str @{thm left_diff_distrib}),	
  26.106 +	       Celem.Thm ("left_diff_distrib" ,TermC.num_str @{thm left_diff_distrib}),	
  26.107  	       (*"(z1.0 - z2.0) * w = z1.0 * w - z2.0 * w"*)
  26.108 -	       Thm ("right_diff_distrib",TermC.num_str @{thm right_diff_distrib}),	
  26.109 +	       Celem.Thm ("right_diff_distrib",TermC.num_str @{thm right_diff_distrib}),	
  26.110  	       (*"w * (z1.0 - z2.0) = w * z1.0 - w * z2.0"*)
  26.111  
  26.112 -	       Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),                         
  26.113 +	       Celem.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),                         
  26.114  	       (*"1 * z = z"*)
  26.115 -	       Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),                         
  26.116 +	       Celem.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),                         
  26.117  	       (*"0 * z = 0"*)
  26.118 -	       Thm ("add_0_left",TermC.num_str @{thm add_0_left}),		
  26.119 +	       Celem.Thm ("add_0_left",TermC.num_str @{thm add_0_left}),		
  26.120  	       (*"0 + z = z"*)
  26.121   
  26.122 -	       Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
  26.123 +	       Celem.Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
  26.124  		(*AC-rewriting*)
  26.125 -	       Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
  26.126 +	       Celem.Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
  26.127           	(**)
  26.128 -	       Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),
  26.129 +	       Celem.Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),
  26.130  	        (**)
  26.131 -	       Thm ("add_commute",TermC.num_str @{thm add.commute}),
  26.132 +	       Celem.Thm ("add_commute",TermC.num_str @{thm add.commute}),
  26.133  		(**)
  26.134 -	       Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}),
  26.135 +	       Celem.Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}),
  26.136  	        (**)
  26.137 -	       Thm ("add_assoc",TermC.num_str @{thm add.assoc}),
  26.138 +	       Celem.Thm ("add_assoc",TermC.num_str @{thm add.assoc}),
  26.139  	        (**)
  26.140  
  26.141 -	       Thm ("sym_realpow_twoI",
  26.142 +	       Celem.Thm ("sym_realpow_twoI",
  26.143                       TermC.num_str (@{thm realpow_twoI} RS @{thm sym})),
  26.144  	       (*"r1 * r1 = r1 ^^^ 2"*)
  26.145 -	       Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),			
  26.146 +	       Celem.Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),			
  26.147  	       (*"r * r ^^^ n = r ^^^ (n + 1)"*)
  26.148 -	       Thm ("sym_real_mult_2",
  26.149 +	       Celem.Thm ("sym_real_mult_2",
  26.150                       TermC.num_str (@{thm real_mult_2} RS @{thm sym})),
  26.151  	       (*"z1 + z1 = 2 * z1"*)
  26.152 -	       Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),		
  26.153 +	       Celem.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),		
  26.154  	       (*"z1 + (z1 + k) = 2 * z1 + k"*)
  26.155  
  26.156 -	       Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  26.157 +	       Celem.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  26.158  	       (*"[| l is_const; m is_const |]==> l * n + m * n = (l + m) * n"*)
  26.159 -	       Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),	
  26.160 +	       Celem.Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),	
  26.161  	       (*"[| l is_const; m is_const |] ==>  
  26.162                                     l * n + (m * n + k) =  (l + m) * n + k"*)
  26.163 -	       Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),		
  26.164 +	       Celem.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),		
  26.165  	       (*"m is_const ==> n + m * n = (1 + m) * n"*)
  26.166 -	       Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), 
  26.167 +	       Celem.Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), 
  26.168  	       (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  26.169  
  26.170 -	       Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  26.171 -	       Calc ("Groups.times_class.times", eval_binop "#mult_"),
  26.172 -	       Calc ("Atools.pow", eval_binop "#power_")
  26.173 +	       Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  26.174 +	       Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
  26.175 +	       Celem.Calc ("Atools.pow", eval_binop "#power_")
  26.176  	       ],
  26.177 -      scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  26.178 -      }:rls);      
  26.179 +      scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  26.180 +      });      
  26.181  *}
  26.182  setup {* KEStore_Elems.add_rlss [("make_rooteq", (Context.theory_name @{theory}, make_rooteq))] *}
  26.183  ML {*
  26.184 @@ -259,73 +259,73 @@
  26.185  val prep_rls' = LTool.prep_rls @{theory};
  26.186  
  26.187  val expand_rootbinoms = prep_rls'(
  26.188 -  Rls{id = "expand_rootbinoms", preconds = [], 
  26.189 +  Celem.Rls{id = "expand_rootbinoms", preconds = [], 
  26.190        rew_ord = ("termlessI",termlessI),
  26.191 -      erls = Atools_erls, srls = Erls,
  26.192 +      erls = Atools_erls, srls = Celem.Erls,
  26.193        calc = [], errpatts = [],
  26.194 -      rules = [Thm ("real_plus_binom_pow2"  ,TermC.num_str @{thm real_plus_binom_pow2}),     
  26.195 +      rules = [Celem.Thm ("real_plus_binom_pow2"  ,TermC.num_str @{thm real_plus_binom_pow2}),     
  26.196  	       (*"(a + b) ^^^ 2 = a ^^^ 2 + 2 * a * b + b ^^^ 2"*)
  26.197 -	       Thm ("real_plus_binom_times" ,TermC.num_str @{thm real_plus_binom_times}),    
  26.198 +	       Celem.Thm ("real_plus_binom_times" ,TermC.num_str @{thm real_plus_binom_times}),    
  26.199  	       (*"(a + b)*(a + b) = ...*)
  26.200 -	       Thm ("real_minus_binom_pow2" ,TermC.num_str @{thm real_minus_binom_pow2}),    
  26.201 +	       Celem.Thm ("real_minus_binom_pow2" ,TermC.num_str @{thm real_minus_binom_pow2}),    
  26.202  		(*"(a - b) ^^^ 2 = a ^^^ 2 - 2 * a * b + b ^^^ 2"*)
  26.203 -	       Thm ("real_minus_binom_times",TermC.num_str @{thm real_minus_binom_times}),   
  26.204 +	       Celem.Thm ("real_minus_binom_times",TermC.num_str @{thm real_minus_binom_times}),   
  26.205  	       (*"(a - b)*(a - b) = ...*)
  26.206 -	       Thm ("real_plus_minus_binom1",TermC.num_str @{thm real_plus_minus_binom1}),   
  26.207 +	       Celem.Thm ("real_plus_minus_binom1",TermC.num_str @{thm real_plus_minus_binom1}),   
  26.208  		(*"(a + b) * (a - b) = a ^^^ 2 - b ^^^ 2"*)
  26.209 -	       Thm ("real_plus_minus_binom2",TermC.num_str @{thm real_plus_minus_binom2}),   
  26.210 +	       Celem.Thm ("real_plus_minus_binom2",TermC.num_str @{thm real_plus_minus_binom2}),   
  26.211  		(*"(a - b) * (a + b) = a ^^^ 2 - b ^^^ 2"*)
  26.212  	       (*RL 020915*)
  26.213 -	       Thm ("real_pp_binom_times",TermC.num_str @{thm real_pp_binom_times}), 
  26.214 +	       Celem.Thm ("real_pp_binom_times",TermC.num_str @{thm real_pp_binom_times}), 
  26.215  		(*(a + b)*(c + d) = a*c + a*d + b*c + b*d*)
  26.216 -               Thm ("real_pm_binom_times",TermC.num_str @{thm real_pm_binom_times}), 
  26.217 +               Celem.Thm ("real_pm_binom_times",TermC.num_str @{thm real_pm_binom_times}), 
  26.218  		(*(a + b)*(c - d) = a*c - a*d + b*c - b*d*)
  26.219 -               Thm ("real_mp_binom_times",TermC.num_str @{thm real_mp_binom_times}), 
  26.220 +               Celem.Thm ("real_mp_binom_times",TermC.num_str @{thm real_mp_binom_times}), 
  26.221  		(*(a - b)*(c p d) = a*c + a*d - b*c - b*d*)
  26.222 -               Thm ("real_mm_binom_times",TermC.num_str @{thm real_mm_binom_times}), 
  26.223 +               Celem.Thm ("real_mm_binom_times",TermC.num_str @{thm real_mm_binom_times}), 
  26.224  		(*(a - b)*(c p d) = a*c - a*d - b*c + b*d*)
  26.225 -	       Thm ("realpow_mul",TermC.num_str @{thm realpow_mul}),                 
  26.226 +	       Celem.Thm ("realpow_mul",TermC.num_str @{thm realpow_mul}),                 
  26.227  		(*(a*b)^^^n = a^^^n * b^^^n*)
  26.228  
  26.229 -	       Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),         (*"1 * z = z"*)
  26.230 -	       Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),         (*"0 * z = 0"*)
  26.231 -	       Thm ("add_0_left",TermC.num_str @{thm add_0_left}), 
  26.232 +	       Celem.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),         (*"1 * z = z"*)
  26.233 +	       Celem.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),         (*"0 * z = 0"*)
  26.234 +	       Celem.Thm ("add_0_left",TermC.num_str @{thm add_0_left}), 
  26.235                   (*"0 + z = z"*)
  26.236  
  26.237 -	       Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  26.238 -	       Calc ("Groups.minus_class.minus", eval_binop "#sub_"), 
  26.239 -	       Calc ("Groups.times_class.times", eval_binop "#mult_"),
  26.240 -	       Calc ("Rings.divide_class.divide"  ,eval_cancel "#divide_e"),
  26.241 -	       Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"),
  26.242 -	       Calc ("Atools.pow", eval_binop "#power_"),
  26.243 +	       Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  26.244 +	       Celem.Calc ("Groups.minus_class.minus", eval_binop "#sub_"), 
  26.245 +	       Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
  26.246 +	       Celem.Calc ("Rings.divide_class.divide"  ,eval_cancel "#divide_e"),
  26.247 +	       Celem.Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"),
  26.248 +	       Celem.Calc ("Atools.pow", eval_binop "#power_"),
  26.249  
  26.250 -	       Thm ("sym_realpow_twoI",
  26.251 +	       Celem.Thm ("sym_realpow_twoI",
  26.252                       TermC.num_str (@{thm realpow_twoI} RS @{thm sym})),
  26.253  	       (*"r1 * r1 = r1 ^^^ 2"*)
  26.254 -	       Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),			
  26.255 +	       Celem.Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),			
  26.256  	       (*"r * r ^^^ n = r ^^^ (n + 1)"*)
  26.257 -	       Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),		
  26.258 +	       Celem.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),		
  26.259  	       (*"z1 + (z1 + k) = 2 * z1 + k"*)
  26.260  
  26.261 -	       Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  26.262 +	       Celem.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  26.263  	       (*"[| l is_const; m is_const |] ==>l * n + m * n = (l + m) * n"*)
  26.264 -	       Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),	
  26.265 +	       Celem.Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),	
  26.266  	       (*"[| l is_const; m is_const |] ==>
  26.267                    l * n + (m * n + k) =  (l + m) * n + k"*)
  26.268 -	       Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),		
  26.269 +	       Celem.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),		
  26.270  	       (*"m is_const ==> n + m * n = (1 + m) * n"*)
  26.271 -	       Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), 
  26.272 +	       Celem.Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), 
  26.273  	       (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  26.274  
  26.275 -	       Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  26.276 -	       Calc ("Groups.minus_class.minus", eval_binop "#sub_"), 
  26.277 -	       Calc ("Groups.times_class.times", eval_binop "#mult_"),
  26.278 -	       Calc ("Rings.divide_class.divide"  ,eval_cancel "#divide_e"),
  26.279 -	       Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"),
  26.280 -	       Calc ("Atools.pow", eval_binop "#power_")
  26.281 +	       Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  26.282 +	       Celem.Calc ("Groups.minus_class.minus", eval_binop "#sub_"), 
  26.283 +	       Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
  26.284 +	       Celem.Calc ("Rings.divide_class.divide"  ,eval_cancel "#divide_e"),
  26.285 +	       Celem.Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"),
  26.286 +	       Celem.Calc ("Atools.pow", eval_binop "#power_")
  26.287  	       ],
  26.288 -      scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  26.289 -       }:rls);      
  26.290 +      scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  26.291 +       });      
  26.292  *}
  26.293  setup {* KEStore_Elems.add_rlss
  26.294    [("expand_rootbinoms", (Context.theory_name @{theory}, expand_rootbinoms))] *}
    27.1 --- a/src/Tools/isac/Knowledge/RootEq.thy	Thu Mar 15 10:17:44 2018 +0100
    27.2 +++ b/src/Tools/isac/Knowledge/RootEq.thy	Thu Mar 15 12:42:04 2018 +0100
    27.3 @@ -177,64 +177,64 @@
    27.4  fun eval_is_rootTerm_in _ _ 
    27.5         (p as (Const ("RootEq.is'_rootTerm'_in",_) $ t $ v)) _  =
    27.6      if is_rootTerm_in t v then 
    27.7 -	SOME ((term2str p) ^ " = True",
    27.8 +	SOME ((Celem.term2str p) ^ " = True",
    27.9  	      HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
   27.10 -    else SOME ((term2str p) ^ " = True",
   27.11 +    else SOME ((Celem.term2str p) ^ " = True",
   27.12  	       HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
   27.13    | eval_is_rootTerm_in _ _ _ _ = ((*tracing"### nichts matcht";*) NONE);
   27.14  
   27.15  fun eval_is_sqrtTerm_in _ _ 
   27.16         (p as (Const ("RootEq.is'_sqrtTerm'_in",_) $ t $ v)) _  =
   27.17      if is_sqrtTerm_in t v then 
   27.18 -	SOME ((term2str p) ^ " = True",
   27.19 +	SOME ((Celem.term2str p) ^ " = True",
   27.20  	      HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
   27.21 -    else SOME ((term2str p) ^ " = True",
   27.22 +    else SOME ((Celem.term2str p) ^ " = True",
   27.23  	       HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
   27.24    | eval_is_sqrtTerm_in _ _ _ _ = ((*tracing"### nichts matcht";*) NONE);
   27.25  
   27.26  fun eval_is_normSqrtTerm_in _ _ 
   27.27         (p as (Const ("RootEq.is'_normSqrtTerm'_in",_) $ t $ v)) _  =
   27.28      if is_normSqrtTerm_in t v then 
   27.29 -	SOME ((term2str p) ^ " = True",
   27.30 +	SOME ((Celem.term2str p) ^ " = True",
   27.31  	      HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
   27.32 -    else SOME ((term2str p) ^ " = True",
   27.33 +    else SOME ((Celem.term2str p) ^ " = True",
   27.34  	       HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
   27.35    | eval_is_normSqrtTerm_in _ _ _ _ = ((*tracing"### nichts matcht";*) NONE);
   27.36  
   27.37  (*-------------------------rulse-------------------------*)
   27.38  val RootEq_prls =(*15.10.02:just the following order due to subterm evaluation*)
   27.39 -  append_rls "RootEq_prls" e_rls 
   27.40 -	     [Calc ("Atools.ident",eval_ident "#ident_"),
   27.41 -	      Calc ("Tools.matches",eval_matches ""),
   27.42 -	      Calc ("Tools.lhs"    ,eval_lhs ""),
   27.43 -	      Calc ("Tools.rhs"    ,eval_rhs ""),
   27.44 -	      Calc ("RootEq.is'_sqrtTerm'_in",eval_is_sqrtTerm_in ""),
   27.45 -	      Calc ("RootEq.is'_rootTerm'_in",eval_is_rootTerm_in ""),
   27.46 -	      Calc ("RootEq.is'_normSqrtTerm'_in",eval_is_normSqrtTerm_in ""),
   27.47 -	      Calc ("HOL.eq",eval_equal "#equal_"),
   27.48 -	      Thm ("not_true",TermC.num_str @{thm not_true}),
   27.49 -	      Thm ("not_false",TermC.num_str @{thm not_false}),
   27.50 -	      Thm ("and_true",TermC.num_str @{thm and_true}),
   27.51 -	      Thm ("and_false",TermC.num_str @{thm and_false}),
   27.52 -	      Thm ("or_true",TermC.num_str @{thm or_true}),
   27.53 -	      Thm ("or_false",TermC.num_str @{thm or_false})
   27.54 +  Celem.append_rls "RootEq_prls" Celem.e_rls 
   27.55 +	     [Celem.Calc ("Atools.ident",eval_ident "#ident_"),
   27.56 +	      Celem.Calc ("Tools.matches",eval_matches ""),
   27.57 +	      Celem.Calc ("Tools.lhs"    ,eval_lhs ""),
   27.58 +	      Celem.Calc ("Tools.rhs"    ,eval_rhs ""),
   27.59 +	      Celem.Calc ("RootEq.is'_sqrtTerm'_in",eval_is_sqrtTerm_in ""),
   27.60 +	      Celem.Calc ("RootEq.is'_rootTerm'_in",eval_is_rootTerm_in ""),
   27.61 +	      Celem.Calc ("RootEq.is'_normSqrtTerm'_in",eval_is_normSqrtTerm_in ""),
   27.62 +	      Celem.Calc ("HOL.eq",eval_equal "#equal_"),
   27.63 +	      Celem.Thm ("not_true",TermC.num_str @{thm not_true}),
   27.64 +	      Celem.Thm ("not_false",TermC.num_str @{thm not_false}),
   27.65 +	      Celem.Thm ("and_true",TermC.num_str @{thm and_true}),
   27.66 +	      Celem.Thm ("and_false",TermC.num_str @{thm and_false}),
   27.67 +	      Celem.Thm ("or_true",TermC.num_str @{thm or_true}),
   27.68 +	      Celem.Thm ("or_false",TermC.num_str @{thm or_false})
   27.69  	      ];
   27.70  
   27.71  val RootEq_erls =
   27.72 -     append_rls "RootEq_erls" Root_erls
   27.73 -          [Thm ("divide_divide_eq_left",TermC.num_str @{thm divide_divide_eq_left})
   27.74 +     Celem.append_rls "RootEq_erls" Root_erls
   27.75 +          [Celem.Thm ("divide_divide_eq_left",TermC.num_str @{thm divide_divide_eq_left})
   27.76             ];
   27.77  
   27.78  val RootEq_crls = 
   27.79 -     append_rls "RootEq_crls" Root_crls
   27.80 -          [Thm ("divide_divide_eq_left",TermC.num_str @{thm divide_divide_eq_left})
   27.81 +     Celem.append_rls "RootEq_crls" Root_crls
   27.82 +          [Celem.Thm ("divide_divide_eq_left",TermC.num_str @{thm divide_divide_eq_left})
   27.83             ];
   27.84  
   27.85  val rooteq_srls = 
   27.86 -     append_rls "rooteq_srls" e_rls
   27.87 -		[Calc ("RootEq.is'_sqrtTerm'_in",eval_is_sqrtTerm_in ""),
   27.88 -                 Calc ("RootEq.is'_normSqrtTerm'_in",eval_is_normSqrtTerm_in""),
   27.89 -                 Calc ("RootEq.is'_rootTerm'_in",eval_is_rootTerm_in "")
   27.90 +     Celem.append_rls "rooteq_srls" Celem.e_rls
   27.91 +		[Celem.Calc ("RootEq.is'_sqrtTerm'_in",eval_is_sqrtTerm_in ""),
   27.92 +                 Celem.Calc ("RootEq.is'_normSqrtTerm'_in",eval_is_normSqrtTerm_in""),
   27.93 +                 Celem.Calc ("RootEq.is'_rootTerm'_in",eval_is_rootTerm_in "")
   27.94  		 ];
   27.95  *}
   27.96  setup {* KEStore_Elems.add_rlss 
   27.97 @@ -244,101 +244,101 @@
   27.98  
   27.99  (*isolate the bound variable in an sqrt equation; 'bdv' is a meta-constant*)
  27.100   val sqrt_isolate = prep_rls'(
  27.101 -  Rls {id = "sqrt_isolate", preconds = [], rew_ord = ("termlessI",termlessI), 
  27.102 -       erls = RootEq_erls, srls = Erls, calc = [], errpatts = [],
  27.103 +  Celem.Rls {id = "sqrt_isolate", preconds = [], rew_ord = ("termlessI",termlessI), 
  27.104 +       erls = RootEq_erls, srls = Celem.Erls, calc = [], errpatts = [],
  27.105         rules = [
  27.106 -       Thm("sqrt_square_1",TermC.num_str @{thm sqrt_square_1}),
  27.107 +       Celem.Thm("sqrt_square_1",TermC.num_str @{thm sqrt_square_1}),
  27.108                       (* (sqrt a)^^^2 -> a *)
  27.109 -       Thm("sqrt_square_2",TermC.num_str @{thm sqrt_square_2}),
  27.110 +       Celem.Thm("sqrt_square_2",TermC.num_str @{thm sqrt_square_2}),
  27.111                       (* sqrt (a^^^2) -> a *)
  27.112 -       Thm("sqrt_times_root_1",TermC.num_str @{thm sqrt_times_root_1}),
  27.113 +       Celem.Thm("sqrt_times_root_1",TermC.num_str @{thm sqrt_times_root_1}),
  27.114              (* sqrt a sqrt b -> sqrt(ab) *)
  27.115 -       Thm("sqrt_times_root_2",TermC.num_str @{thm sqrt_times_root_2}),
  27.116 +       Celem.Thm("sqrt_times_root_2",TermC.num_str @{thm sqrt_times_root_2}),
  27.117              (* a sqrt b sqrt c -> a sqrt(bc) *)
  27.118 -       Thm("sqrt_square_equation_both_1",
  27.119 +       Celem.Thm("sqrt_square_equation_both_1",
  27.120             TermC.num_str @{thm sqrt_square_equation_both_1}),
  27.121         (* (sqrt a + sqrt b  = sqrt c + sqrt d) -> 
  27.122              (a+2*sqrt(a)*sqrt(b)+b) = c+2*sqrt(c)*sqrt(d)+d) *)
  27.123 -       Thm("sqrt_square_equation_both_2",
  27.124 +       Celem.Thm("sqrt_square_equation_both_2",
  27.125              TermC.num_str @{thm sqrt_square_equation_both_2}),
  27.126         (* (sqrt a - sqrt b  = sqrt c + sqrt d) -> 
  27.127              (a-2*sqrt(a)*sqrt(b)+b) = c+2*sqrt(c)*sqrt(d)+d) *)
  27.128 -       Thm("sqrt_square_equation_both_3",
  27.129 +       Celem.Thm("sqrt_square_equation_both_3",
  27.130              TermC.num_str @{thm sqrt_square_equation_both_3}),
  27.131         (* (sqrt a + sqrt b  = sqrt c - sqrt d) -> 
  27.132              (a+2*sqrt(a)*sqrt(b)+b) = c-2*sqrt(c)*sqrt(d)+d) *)
  27.133 -       Thm("sqrt_square_equation_both_4",
  27.134 +       Celem.Thm("sqrt_square_equation_both_4",
  27.135              TermC.num_str @{thm sqrt_square_equation_both_4}),
  27.136         (* (sqrt a - sqrt b  = sqrt c - sqrt d) -> 
  27.137              (a-2*sqrt(a)*sqrt(b)+b) = c-2*sqrt(c)*sqrt(d)+d) *)
  27.138 -       Thm("sqrt_isolate_l_add1",
  27.139 +       Celem.Thm("sqrt_isolate_l_add1",
  27.140              TermC.num_str @{thm sqrt_isolate_l_add1}), 
  27.141         (* a+b*sqrt(x)=d -> b*sqrt(x) = d-a *)
  27.142 -       Thm("sqrt_isolate_l_add2",
  27.143 +       Celem.Thm("sqrt_isolate_l_add2",
  27.144              TermC.num_str @{thm sqrt_isolate_l_add2}), 
  27.145         (* a+  sqrt(x)=d ->   sqrt(x) = d-a *)
  27.146 -       Thm("sqrt_isolate_l_add3",
  27.147 +       Celem.Thm("sqrt_isolate_l_add3",
  27.148              TermC.num_str @{thm sqrt_isolate_l_add3}), 
  27.149         (* a+b*c/sqrt(x)=d->b*c/sqrt(x)=d-a *)
  27.150 -       Thm("sqrt_isolate_l_add4",
  27.151 +       Celem.Thm("sqrt_isolate_l_add4",
  27.152              TermC.num_str @{thm sqrt_isolate_l_add4}), 
  27.153         (* a+c/sqrt(x)=d -> c/sqrt(x) = d-a *)
  27.154 -       Thm("sqrt_isolate_l_add5",
  27.155 +       Celem.Thm("sqrt_isolate_l_add5",
  27.156              TermC.num_str @{thm sqrt_isolate_l_add5}), 
  27.157         (* a+b*c/f*sqrt(x)=d->b*c/f*sqrt(x)=d-a *)
  27.158 -       Thm("sqrt_isolate_l_add6",
  27.159 +       Celem.Thm("sqrt_isolate_l_add6",
  27.160              TermC.num_str @{thm sqrt_isolate_l_add6}), 
  27.161         (* a+c/f*sqrt(x)=d -> c/f*sqrt(x) = d-a *)
  27.162 -       (*Thm("sqrt_isolate_l_div",TermC.num_str @{thm sqrt_isolate_l_div}),*)
  27.163 +       (*Celem.Thm("sqrt_isolate_l_div",TermC.num_str @{thm sqrt_isolate_l_div}),*)
  27.164           (* b*sqrt(x) = d sqrt(x) d/b *)
  27.165 -       Thm("sqrt_isolate_r_add1",
  27.166 +       Celem.Thm("sqrt_isolate_r_add1",
  27.167              TermC.num_str @{thm sqrt_isolate_r_add1}),
  27.168         (* a= d+e*sqrt(x) -> a-d=e*sqrt(x) *)
  27.169 -       Thm("sqrt_isolate_r_add2",
  27.170 +       Celem.Thm("sqrt_isolate_r_add2",
  27.171              TermC.num_str @{thm sqrt_isolate_r_add2}),
  27.172         (* a= d+  sqrt(x) -> a-d=  sqrt(x) *)
  27.173 -       Thm("sqrt_isolate_r_add3",
  27.174 +       Celem.Thm("sqrt_isolate_r_add3",
  27.175              TermC.num_str @{thm sqrt_isolate_r_add3}),
  27.176         (* a=d+e*g/sqrt(x)->a-d=e*g/sqrt(x)*)
  27.177 -       Thm("sqrt_isolate_r_add4",
  27.178 +       Celem.Thm("sqrt_isolate_r_add4",
  27.179              TermC.num_str @{thm sqrt_isolate_r_add4}),
  27.180         (* a= d+g/sqrt(x) -> a-d=g/sqrt(x) *)
  27.181 -       Thm("sqrt_isolate_r_add5",
  27.182 +       Celem.Thm("sqrt_isolate_r_add5",
  27.183              TermC.num_str @{thm sqrt_isolate_r_add5}),
  27.184         (* a=d+e*g/h*sqrt(x)->a-d=e*g/h*sqrt(x)*)
  27.185 -       Thm("sqrt_isolate_r_add6",
  27.186 +       Celem.Thm("sqrt_isolate_r_add6",
  27.187              TermC.num_str @{thm sqrt_isolate_r_add6}),
  27.188         (* a= d+g/h*sqrt(x) -> a-d=g/h*sqrt(x) *)
  27.189 -       (*Thm("sqrt_isolate_r_div",TermC.num_str @{thm sqrt_isolate_r_div}),*)
  27.190 +       (*Celem.Thm("sqrt_isolate_r_div",TermC.num_str @{thm sqrt_isolate_r_div}),*)
  27.191           (* a=e*sqrt(x) -> a/e = sqrt(x) *)
  27.192 -       Thm("sqrt_square_equation_left_1",
  27.193 +       Celem.Thm("sqrt_square_equation_left_1",
  27.194              TermC.num_str @{thm sqrt_square_equation_left_1}),   
  27.195         (* sqrt(x)=b -> x=b^2 *)
  27.196 -       Thm("sqrt_square_equation_left_2",
  27.197 +       Celem.Thm("sqrt_square_equation_left_2",
  27.198              TermC.num_str @{thm sqrt_square_equation_left_2}),   
  27.199         (* c*sqrt(x)=b -> c^2*x=b^2 *)
  27.200 -       Thm("sqrt_square_equation_left_3",TermC.num_str @{thm sqrt_square_equation_left_3}),  
  27.201 +       Celem.Thm("sqrt_square_equation_left_3",TermC.num_str @{thm sqrt_square_equation_left_3}),  
  27.202  	      (* c/sqrt(x)=b -> c^2/x=b^2 *)
  27.203 -       Thm("sqrt_square_equation_left_4",TermC.num_str @{thm sqrt_square_equation_left_4}),
  27.204 +       Celem.Thm("sqrt_square_equation_left_4",TermC.num_str @{thm sqrt_square_equation_left_4}),
  27.205  	      (* c*d/sqrt(x)=b -> c^2*d^2/x=b^2 *)
  27.206 -       Thm("sqrt_square_equation_left_5",TermC.num_str @{thm sqrt_square_equation_left_5}),
  27.207 +       Celem.Thm("sqrt_square_equation_left_5",TermC.num_str @{thm sqrt_square_equation_left_5}),
  27.208  	      (* c/d*sqrt(x)=b -> c^2/d^2x=b^2 *)
  27.209 -       Thm("sqrt_square_equation_left_6",TermC.num_str @{thm sqrt_square_equation_left_6}),
  27.210 +       Celem.Thm("sqrt_square_equation_left_6",TermC.num_str @{thm sqrt_square_equation_left_6}),
  27.211  	      (* c*d/g*sqrt(x)=b -> c^2*d^2/g^2x=b^2 *)
  27.212 -       Thm("sqrt_square_equation_right_1",TermC.num_str @{thm sqrt_square_equation_right_1}),
  27.213 +       Celem.Thm("sqrt_square_equation_right_1",TermC.num_str @{thm sqrt_square_equation_right_1}),
  27.214  	      (* a=sqrt(x) ->a^2=x *)
  27.215 -       Thm("sqrt_square_equation_right_2",TermC.num_str @{thm sqrt_square_equation_right_2}),
  27.216 +       Celem.Thm("sqrt_square_equation_right_2",TermC.num_str @{thm sqrt_square_equation_right_2}),
  27.217  	      (* a=c*sqrt(x) ->a^2=c^2*x *)
  27.218 -       Thm("sqrt_square_equation_right_3",TermC.num_str @{thm sqrt_square_equation_right_3}),
  27.219 +       Celem.Thm("sqrt_square_equation_right_3",TermC.num_str @{thm sqrt_square_equation_right_3}),
  27.220  	      (* a=c/sqrt(x) ->a^2=c^2/x *)
  27.221 -       Thm("sqrt_square_equation_right_4",TermC.num_str @{thm sqrt_square_equation_right_4}),
  27.222 +       Celem.Thm("sqrt_square_equation_right_4",TermC.num_str @{thm sqrt_square_equation_right_4}),
  27.223  	      (* a=c*d/sqrt(x) ->a^2=c^2*d^2/x *)
  27.224 -       Thm("sqrt_square_equation_right_5",TermC.num_str @{thm sqrt_square_equation_right_5}),
  27.225 +       Celem.Thm("sqrt_square_equation_right_5",TermC.num_str @{thm sqrt_square_equation_right_5}),
  27.226  	      (* a=c/e*sqrt(x) ->a^2=c^2/e^2x *)
  27.227 -       Thm("sqrt_square_equation_right_6",TermC.num_str @{thm sqrt_square_equation_right_6})
  27.228 +       Celem.Thm("sqrt_square_equation_right_6",TermC.num_str @{thm sqrt_square_equation_right_6})
  27.229  	      (* a=c*d/g*sqrt(x) ->a^2=c^2*d^2/g^2*x *)
  27.230 -       ],scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  27.231 -      }:rls);
  27.232 +       ],scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  27.233 +      });
  27.234  *}
  27.235  setup {* KEStore_Elems.add_rlss
  27.236    [("sqrt_isolate", (Context.theory_name @{theory}, sqrt_isolate))] *}
  27.237 @@ -346,47 +346,47 @@
  27.238  
  27.239  (*isolate the bound variable in an sqrt left equation; 'bdv' is a meta-constant*)
  27.240   val l_sqrt_isolate = prep_rls'(
  27.241 -     Rls {id = "l_sqrt_isolate", preconds = [], 
  27.242 +     Celem.Rls {id = "l_sqrt_isolate", preconds = [], 
  27.243  	  rew_ord = ("termlessI",termlessI), 
  27.244 -          erls = RootEq_erls, srls = Erls, calc = [], errpatts = [],
  27.245 +          erls = RootEq_erls, srls = Celem.Erls, calc = [], errpatts = [],
  27.246       rules = [
  27.247 -     Thm("sqrt_square_1",TermC.num_str @{thm sqrt_square_1}),
  27.248 +     Celem.Thm("sqrt_square_1",TermC.num_str @{thm sqrt_square_1}),
  27.249                              (* (sqrt a)^^^2 -> a *)
  27.250 -     Thm("sqrt_square_2",TermC.num_str @{thm sqrt_square_2}),
  27.251 +     Celem.Thm("sqrt_square_2",TermC.num_str @{thm sqrt_square_2}),
  27.252                              (* sqrt (a^^^2) -> a *)
  27.253 -     Thm("sqrt_times_root_1",TermC.num_str @{thm sqrt_times_root_1}),
  27.254 +     Celem.Thm("sqrt_times_root_1",TermC.num_str @{thm sqrt_times_root_1}),
  27.255              (* sqrt a sqrt b -> sqrt(ab) *)
  27.256 -     Thm("sqrt_times_root_2",TermC.num_str @{thm sqrt_times_root_2}),
  27.257 +     Celem.Thm("sqrt_times_root_2",TermC.num_str @{thm sqrt_times_root_2}),
  27.258          (* a sqrt b sqrt c -> a sqrt(bc) *)
  27.259 -     Thm("sqrt_isolate_l_add1",TermC.num_str @{thm sqrt_isolate_l_add1}),
  27.260 +     Celem.Thm("sqrt_isolate_l_add1",TermC.num_str @{thm sqrt_isolate_l_add1}),
  27.261          (* a+b*sqrt(x)=d -> b*sqrt(x) = d-a *)
  27.262 -     Thm("sqrt_isolate_l_add2",TermC.num_str @{thm sqrt_isolate_l_add2}),
  27.263 +     Celem.Thm("sqrt_isolate_l_add2",TermC.num_str @{thm sqrt_isolate_l_add2}),
  27.264          (* a+  sqrt(x)=d ->   sqrt(x) = d-a *)
  27.265 -     Thm("sqrt_isolate_l_add3",TermC.num_str @{thm sqrt_isolate_l_add3}),
  27.266 +     Celem.Thm("sqrt_isolate_l_add3",TermC.num_str @{thm sqrt_isolate_l_add3}),
  27.267          (* a+b*c/sqrt(x)=d->b*c/sqrt(x)=d-a *)
  27.268 -     Thm("sqrt_isolate_l_add4",TermC.num_str @{thm sqrt_isolate_l_add4}),
  27.269 +     Celem.Thm("sqrt_isolate_l_add4",TermC.num_str @{thm sqrt_isolate_l_add4}),
  27.270          (* a+c/sqrt(x)=d -> c/sqrt(x) = d-a *)
  27.271 -     Thm("sqrt_isolate_l_add5",TermC.num_str @{thm sqrt_isolate_l_add5}),
  27.272 +     Celem.Thm("sqrt_isolate_l_add5",TermC.num_str @{thm sqrt_isolate_l_add5}),
  27.273          (* a+b*c/f*sqrt(x)=d->b*c/f*sqrt(x)=d-a *)
  27.274 -     Thm("sqrt_isolate_l_add6",TermC.num_str @{thm sqrt_isolate_l_add6}),
  27.275 +     Celem.Thm("sqrt_isolate_l_add6",TermC.num_str @{thm sqrt_isolate_l_add6}),
  27.276          (* a+c/f*sqrt(x)=d -> c/f*sqrt(x) = d-a *)
  27.277 -   (*Thm("sqrt_isolate_l_div",TermC.num_str @{thm sqrt_isolate_l_div}),*)
  27.278 +   (*Celem.Thm("sqrt_isolate_l_div",TermC.num_str @{thm sqrt_isolate_l_div}),*)
  27.279          (* b*sqrt(x) = d sqrt(x) d/b *)
  27.280 -     Thm("sqrt_square_equation_left_1",TermC.num_str @{thm sqrt_square_equation_left_1}),
  27.281 +     Celem.Thm("sqrt_square_equation_left_1",TermC.num_str @{thm sqrt_square_equation_left_1}),
  27.282  	      (* sqrt(x)=b -> x=b^2 *)
  27.283 -     Thm("sqrt_square_equation_left_2",TermC.num_str @{thm sqrt_square_equation_left_2}),
  27.284 +     Celem.Thm("sqrt_square_equation_left_2",TermC.num_str @{thm sqrt_square_equation_left_2}),
  27.285  	      (* a*sqrt(x)=b -> a^2*x=b^2*)
  27.286 -     Thm("sqrt_square_equation_left_3",TermC.num_str @{thm sqrt_square_equation_left_3}),   
  27.287 +     Celem.Thm("sqrt_square_equation_left_3",TermC.num_str @{thm sqrt_square_equation_left_3}),   
  27.288  	      (* c/sqrt(x)=b -> c^2/x=b^2 *)
  27.289 -     Thm("sqrt_square_equation_left_4",TermC.num_str @{thm sqrt_square_equation_left_4}),   
  27.290 +     Celem.Thm("sqrt_square_equation_left_4",TermC.num_str @{thm sqrt_square_equation_left_4}),   
  27.291  	      (* c*d/sqrt(x)=b -> c^2*d^2/x=b^2 *)
  27.292 -     Thm("sqrt_square_equation_left_5",TermC.num_str @{thm sqrt_square_equation_left_5}),   
  27.293 +     Celem.Thm("sqrt_square_equation_left_5",TermC.num_str @{thm sqrt_square_equation_left_5}),   
  27.294  	      (* c/d*sqrt(x)=b -> c^2/d^2x=b^2 *)
  27.295 -     Thm("sqrt_square_equation_left_6",TermC.num_str @{thm sqrt_square_equation_left_6})  
  27.296 +     Celem.Thm("sqrt_square_equation_left_6",TermC.num_str @{thm sqrt_square_equation_left_6})  
  27.297  	      (* c*d/g*sqrt(x)=b -> c^2*d^2/g^2x=b^2 *)
  27.298      ],
  27.299 -    scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  27.300 -   }:rls);
  27.301 +    scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  27.302 +   });
  27.303  *}
  27.304  setup {* KEStore_Elems.add_rlss
  27.305    [("l_sqrt_isolate", (Context.theory_name @{theory}, l_sqrt_isolate))] *}
  27.306 @@ -395,82 +395,82 @@
  27.307  (* -- right 28.8.02--*)
  27.308  (*isolate the bound variable in an sqrt right equation; 'bdv' is a meta-constant*)
  27.309   val r_sqrt_isolate = prep_rls'(
  27.310 -     Rls {id = "r_sqrt_isolate", preconds = [], 
  27.311 +     Celem.Rls {id = "r_sqrt_isolate", preconds = [], 
  27.312  	  rew_ord = ("termlessI",termlessI), 
  27.313 -          erls = RootEq_erls, srls = Erls, calc = [], errpatts = [],
  27.314 +          erls = RootEq_erls, srls = Celem.Erls, calc = [], errpatts = [],
  27.315       rules = [
  27.316 -     Thm("sqrt_square_1",TermC.num_str @{thm sqrt_square_1}),
  27.317 +     Celem.Thm("sqrt_square_1",TermC.num_str @{thm sqrt_square_1}),
  27.318                             (* (sqrt a)^^^2 -> a *)
  27.319 -     Thm("sqrt_square_2",TermC.num_str @{thm sqrt_square_2}), 
  27.320 +     Celem.Thm("sqrt_square_2",TermC.num_str @{thm sqrt_square_2}), 
  27.321                             (* sqrt (a^^^2) -> a *)
  27.322 -     Thm("sqrt_times_root_1",TermC.num_str @{thm sqrt_times_root_1}),
  27.323 +     Celem.Thm("sqrt_times_root_1",TermC.num_str @{thm sqrt_times_root_1}),
  27.324             (* sqrt a sqrt b -> sqrt(ab) *)
  27.325 -     Thm("sqrt_times_root_2",TermC.num_str @{thm sqrt_times_root_2}),
  27.326 +     Celem.Thm("sqrt_times_root_2",TermC.num_str @{thm sqrt_times_root_2}),
  27.327         (* a sqrt b sqrt c -> a sqrt(bc) *)
  27.328 -     Thm("sqrt_isolate_r_add1",TermC.num_str @{thm sqrt_isolate_r_add1}),
  27.329 +     Celem.Thm("sqrt_isolate_r_add1",TermC.num_str @{thm sqrt_isolate_r_add1}),
  27.330         (* a= d+e*sqrt(x) -> a-d=e*sqrt(x) *)
  27.331 -     Thm("sqrt_isolate_r_add2",TermC.num_str @{thm sqrt_isolate_r_add2}),
  27.332 +     Celem.Thm("sqrt_isolate_r_add2",TermC.num_str @{thm sqrt_isolate_r_add2}),
  27.333         (* a= d+  sqrt(x) -> a-d=  sqrt(x) *)
  27.334 -     Thm("sqrt_isolate_r_add3",TermC.num_str @{thm sqrt_isolate_r_add3}),
  27.335 +     Celem.Thm("sqrt_isolate_r_add3",TermC.num_str @{thm sqrt_isolate_r_add3}),
  27.336         (* a=d+e*g/sqrt(x)->a-d=e*g/sqrt(x)*)
  27.337 -     Thm("sqrt_isolate_r_add4",TermC.num_str @{thm sqrt_isolate_r_add4}),
  27.338 +     Celem.Thm("sqrt_isolate_r_add4",TermC.num_str @{thm sqrt_isolate_r_add4}),
  27.339         (* a= d+g/sqrt(x) -> a-d=g/sqrt(x) *)
  27.340 -     Thm("sqrt_isolate_r_add5",TermC.num_str @{thm sqrt_isolate_r_add5}),
  27.341 +     Celem.Thm("sqrt_isolate_r_add5",TermC.num_str @{thm sqrt_isolate_r_add5}),
  27.342         (* a=d+e*g/h*sqrt(x)->a-d=e*g/h*sqrt(x)*)
  27.343 -     Thm("sqrt_isolate_r_add6",TermC.num_str @{thm sqrt_isolate_r_add6}),
  27.344 +     Celem.Thm("sqrt_isolate_r_add6",TermC.num_str @{thm sqrt_isolate_r_add6}),
  27.345         (* a= d+g/h*sqrt(x) -> a-d=g/h*sqrt(x) *)
  27.346 -   (*Thm("sqrt_isolate_r_div",TermC.num_str @{thm sqrt_isolate_r_div}),*)
  27.347 +   (*Celem.Thm("sqrt_isolate_r_div",TermC.num_str @{thm sqrt_isolate_r_div}),*)
  27.348         (* a=e*sqrt(x) -> a/e = sqrt(x) *)
  27.349 -     Thm("sqrt_square_equation_right_1",TermC.num_str @{thm sqrt_square_equation_right_1}),
  27.350 +     Celem.Thm("sqrt_square_equation_right_1",TermC.num_str @{thm sqrt_square_equation_right_1}),
  27.351  	      (* a=sqrt(x) ->a^2=x *)
  27.352 -     Thm("sqrt_square_equation_right_2",TermC.num_str @{thm sqrt_square_equation_right_2}),
  27.353 +     Celem.Thm("sqrt_square_equation_right_2",TermC.num_str @{thm sqrt_square_equation_right_2}),
  27.354  	      (* a=c*sqrt(x) ->a^2=c^2*x *)
  27.355 -     Thm("sqrt_square_equation_right_3",TermC.num_str @{thm sqrt_square_equation_right_3}),
  27.356 +     Celem.Thm("sqrt_square_equation_right_3",TermC.num_str @{thm sqrt_square_equation_right_3}),
  27.357  	      (* a=c/sqrt(x) ->a^2=c^2/x *)
  27.358 -     Thm("sqrt_square_equation_right_4",TermC.num_str @{thm sqrt_square_equation_right_4}), 
  27.359 +     Celem.Thm("sqrt_square_equation_right_4",TermC.num_str @{thm sqrt_square_equation_right_4}), 
  27.360  	      (* a=c*d/sqrt(x) ->a^2=c^2*d^2/x *)
  27.361 -     Thm("sqrt_square_equation_right_5",TermC.num_str @{thm sqrt_square_equation_right_5}),
  27.362 +     Celem.Thm("sqrt_square_equation_right_5",TermC.num_str @{thm sqrt_square_equation_right_5}),
  27.363  	      (* a=c/e*sqrt(x) ->a^2=c^2/e^2x *)
  27.364 -     Thm("sqrt_square_equation_right_6",TermC.num_str @{thm sqrt_square_equation_right_6})
  27.365 +     Celem.Thm("sqrt_square_equation_right_6",TermC.num_str @{thm sqrt_square_equation_right_6})
  27.366  	      (* a=c*d/g*sqrt(x) ->a^2=c^2*d^2/g^2*x *)
  27.367      ],
  27.368 -    scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  27.369 -   }:rls);
  27.370 +    scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  27.371 +   });
  27.372  *}
  27.373  setup {* KEStore_Elems.add_rlss
  27.374    [("r_sqrt_isolate", (Context.theory_name @{theory}, r_sqrt_isolate))] *}
  27.375  ML {*
  27.376  
  27.377  val rooteq_simplify = prep_rls'(
  27.378 -  Rls {id = "rooteq_simplify", 
  27.379 +  Celem.Rls {id = "rooteq_simplify", 
  27.380         preconds = [], rew_ord = ("termlessI",termlessI), 
  27.381 -       erls = RootEq_erls, srls = Erls, calc = [], errpatts = [],
  27.382 +       erls = RootEq_erls, srls = Celem.Erls, calc = [], errpatts = [],
  27.383         (*asm_thm = [("sqrt_square_1","")],*)
  27.384 -       rules = [Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1}),
  27.385 +       rules = [Celem.Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1}),
  27.386                               (* a+(b+c) = a+b+c *)
  27.387 -                Thm  ("real_assoc_2",TermC.num_str @{thm real_assoc_2}),
  27.388 +                Celem.Thm  ("real_assoc_2",TermC.num_str @{thm real_assoc_2}),
  27.389                               (* a*(b*c) = a*b*c *)
  27.390 -                Calc ("Groups.plus_class.plus",eval_binop "#add_"),
  27.391 -                Calc ("Groups.minus_class.minus",eval_binop "#sub_"),
  27.392 -                Calc ("Groups.times_class.times",eval_binop "#mult_"),
  27.393 -                Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),
  27.394 -                Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"),
  27.395 -                Calc ("Atools.pow" ,eval_binop "#power_"),
  27.396 -                Thm("real_plus_binom_pow2",TermC.num_str @{thm real_plus_binom_pow2}),
  27.397 -                Thm("real_minus_binom_pow2",TermC.num_str @{thm real_minus_binom_pow2}),
  27.398 -                Thm("realpow_mul",TermC.num_str @{thm realpow_mul}),    
  27.399 +                Celem.Calc ("Groups.plus_class.plus",eval_binop "#add_"),
  27.400 +                Celem.Calc ("Groups.minus_class.minus",eval_binop "#sub_"),
  27.401 +                Celem.Calc ("Groups.times_class.times",eval_binop "#mult_"),
  27.402 +                Celem.Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),
  27.403 +                Celem.Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"),
  27.404 +                Celem.Calc ("Atools.pow" ,eval_binop "#power_"),
  27.405 +                Celem.Thm("real_plus_binom_pow2",TermC.num_str @{thm real_plus_binom_pow2}),
  27.406 +                Celem.Thm("real_minus_binom_pow2",TermC.num_str @{thm real_minus_binom_pow2}),
  27.407 +                Celem.Thm("realpow_mul",TermC.num_str @{thm realpow_mul}),    
  27.408                       (* (a * b)^n = a^n * b^n*)
  27.409 -                Thm("sqrt_times_root_1",TermC.num_str @{thm sqrt_times_root_1}), 
  27.410 +                Celem.Thm("sqrt_times_root_1",TermC.num_str @{thm sqrt_times_root_1}), 
  27.411                       (* sqrt b * sqrt c = sqrt(b*c) *)
  27.412 -                Thm("sqrt_times_root_2",TermC.num_str @{thm sqrt_times_root_2}),
  27.413 +                Celem.Thm("sqrt_times_root_2",TermC.num_str @{thm sqrt_times_root_2}),
  27.414                       (* a * sqrt a * sqrt b = a * sqrt(a*b) *)
  27.415 -                Thm("sqrt_square_2",TermC.num_str @{thm sqrt_square_2}),
  27.416 +                Celem.Thm("sqrt_square_2",TermC.num_str @{thm sqrt_square_2}),
  27.417                              (* sqrt (a^^^2) = a *)
  27.418 -                Thm("sqrt_square_1",TermC.num_str @{thm sqrt_square_1}) 
  27.419 +                Celem.Thm("sqrt_square_1",TermC.num_str @{thm sqrt_square_1}) 
  27.420                              (* sqrt a ^^^ 2 = a *)
  27.421                  ],
  27.422 -       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  27.423 -    }:rls);
  27.424 +       scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  27.425 +    });
  27.426  *}
  27.427  setup {* KEStore_Elems.add_rlss
  27.428    [("rooteq_simplify", (Context.theory_name @{theory}, rooteq_simplify))] *}
  27.429 @@ -484,7 +484,7 @@
  27.430  *}
  27.431  setup {* KEStore_Elems.add_pbts
  27.432    (* ---------root----------- *)
  27.433 -  [(Specify.prep_pbt thy "pbl_equ_univ_root" [] e_pblID
  27.434 +  [(Specify.prep_pbt thy "pbl_equ_univ_root" [] Celem.e_pblID
  27.435        (["root'","univariate","equation"],
  27.436          [("#Given" ,["equality e_e","solveFor v_v"]),
  27.437            ("#Where" ,["(lhs e_e) is_rootTerm_in  (v_v::real) | " ^
  27.438 @@ -492,7 +492,7 @@
  27.439            ("#Find"  ,["solutions v_v'i'"])],
  27.440          RootEq_prls, SOME "solve (e_e::bool, v_v)", [])),
  27.441      (* ---------sqrt----------- *)
  27.442 -    (Specify.prep_pbt thy "pbl_equ_univ_root_sq" [] e_pblID
  27.443 +    (Specify.prep_pbt thy "pbl_equ_univ_root_sq" [] Celem.e_pblID
  27.444        (["sq","root'","univariate","equation"],
  27.445          [("#Given" ,["equality e_e","solveFor v_v"]),
  27.446            ("#Where" ,["( ((lhs e_e) is_sqrtTerm_in (v_v::real)) &" ^
  27.447 @@ -502,7 +502,7 @@
  27.448            ("#Find"  ,["solutions v_v'i'"])],
  27.449            RootEq_prls,  SOME "solve (e_e::bool, v_v)", [["RootEq","solve_sq_root_equation"]])),
  27.450      (* ---------normalise----------- *)
  27.451 -    (Specify.prep_pbt thy "pbl_equ_univ_root_norm" [] e_pblID
  27.452 +    (Specify.prep_pbt thy "pbl_equ_univ_root_norm" [] Celem.e_pblID
  27.453        (["normalise","root'","univariate","equation"],
  27.454          [("#Given" ,["equality e_e","solveFor v_v"]),
  27.455            ("#Where" ,["( ((lhs e_e) is_sqrtTerm_in (v_v::real)) &" ^
  27.456 @@ -516,12 +516,12 @@
  27.457  (*-------------------------methods-----------------------*)
  27.458  setup {* KEStore_Elems.add_mets
  27.459    [(* ---- root 20.8.02 ---*)
  27.460 -    Specify.prep_met thy "met_rooteq" [] e_metID
  27.461 +    Specify.prep_met thy "met_rooteq" [] Celem.e_metID
  27.462        (["RootEq"], [],
  27.463 -        {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = e_rls, prls=e_rls,
  27.464 +        {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = Celem.e_rls, prls=Celem.e_rls,
  27.465            crls=RootEq_crls, errpats = [], nrls = norm_Poly}, "empty_script"),
  27.466      (*-- normalise 20.10.02 --*)
  27.467 -    Specify.prep_met thy "met_rooteq_norm" [] e_metID
  27.468 +    Specify.prep_met thy "met_rooteq_norm" [] Celem.e_metID
  27.469        (["RootEq","norm_sq_root_equation"],
  27.470          [("#Given" ,["equality e_e","solveFor v_v"]),
  27.471            ("#Where" ,["( ((lhs e_e) is_sqrtTerm_in (v_v::real)) &" ^
  27.472 @@ -529,7 +529,7 @@
  27.473                "( ((rhs e_e) is_sqrtTerm_in (v_v::real)) &" ^
  27.474                "  Not((rhs e_e) is_normSqrtTerm_in (v_v::real)))"]),
  27.475            ("#Find"  ,["solutions v_v'i'"])],
  27.476 -        {rew_ord'="termlessI", rls'=RootEq_erls, srls=e_rls, prls=RootEq_prls, calc=[],
  27.477 +        {rew_ord'="termlessI", rls'=RootEq_erls, srls=Celem.e_rls, prls=RootEq_prls, calc=[],
  27.478            crls=RootEq_crls, errpats = [], nrls = norm_Poly},
  27.479          "Script Norm_sq_root_equation  (e_e::bool) (v_v::real)  =                " ^
  27.480            "(let e_e = ((Repeat(Try (Rewrite     makex1_x            False))) @@  " ^
  27.481 @@ -539,7 +539,7 @@
  27.482            "           (Try (Rewrite_Set rooteq_simplify              True))) e_e " ^
  27.483            " in ((SubProblem (RootEq',[univariate,equation],                     " ^
  27.484            "      [no_met]) [BOOL e_e, REAL v_v])))"),
  27.485 -    Specify.prep_met thy "met_rooteq_sq" [] e_metID
  27.486 +    Specify.prep_met thy "met_rooteq_sq" [] Celem.e_metID
  27.487        (["RootEq","solve_sq_root_equation"],
  27.488          [("#Given" ,["equality e_e", "solveFor v_v"]),
  27.489            ("#Where" ,["(((lhs e_e) is_sqrtTerm_in (v_v::real))     & " ^
  27.490 @@ -564,12 +564,12 @@
  27.491            "                     [BOOL e_e, REAL v_v]))                             " ^
  27.492            "in Check_elementwise L_L {(v_v::real). Assumptions})"),
  27.493      (*-- right 28.08.02 --*)
  27.494 -    Specify.prep_met thy "met_rooteq_sq_right" [] e_metID
  27.495 +    Specify.prep_met thy "met_rooteq_sq_right" [] Celem.e_metID
  27.496        (["RootEq","solve_right_sq_root_equation"],
  27.497          [("#Given" ,["equality e_e","solveFor v_v"]),
  27.498            ("#Where" ,["(rhs e_e) is_sqrtTerm_in v_v"]),
  27.499            ("#Find"  ,["solutions v_v'i'"])],
  27.500 -        {rew_ord' = "termlessI", rls' = RootEq_erls, srls = e_rls, prls = RootEq_prls, calc = [],
  27.501 +        {rew_ord' = "termlessI", rls' = RootEq_erls, srls = Celem.e_rls, prls = RootEq_prls, calc = [],
  27.502            crls = RootEq_crls, errpats = [], nrls = norm_Poly},
  27.503          "Script Solve_right_sq_root_equation  (e_e::bool) (v_v::real)  =           " ^
  27.504            "(let e_e =                                                               " ^
  27.505 @@ -584,12 +584,12 @@
  27.506            " else ((SubProblem (RootEq',[univariate,equation],                      " ^
  27.507            "        [no_met]) [BOOL e_e, REAL v_v])))"),
  27.508      (*-- left 28.08.02 --*)
  27.509 -    Specify.prep_met thy "met_rooteq_sq_left" [] e_metID
  27.510 +    Specify.prep_met thy "met_rooteq_sq_left" [] Celem.e_metID
  27.511        (["RootEq","solve_left_sq_root_equation"],
  27.512          [("#Given" ,["equality e_e","solveFor v_v"]),
  27.513            ("#Where" ,["(lhs e_e) is_sqrtTerm_in v_v"]),
  27.514            ("#Find"  ,["solutions v_v'i'"])],
  27.515 -        {rew_ord'="termlessI", rls'=RootEq_erls, srls=e_rls, prls=RootEq_prls, calc=[],
  27.516 +        {rew_ord'="termlessI", rls'=RootEq_erls, srls=Celem.e_rls, prls=RootEq_prls, calc=[],
  27.517            crls=RootEq_crls, errpats = [], nrls = norm_Poly},
  27.518          "Script Solve_left_sq_root_equation  (e_e::bool) (v_v::real)  =          " ^
  27.519            "(let e_e =                                                             " ^
    28.1 --- a/src/Tools/isac/Knowledge/RootRat.thy	Thu Mar 15 10:17:44 2018 +0100
    28.2 +++ b/src/Tools/isac/Knowledge/RootRat.thy	Thu Mar 15 12:42:04 2018 +0100
    28.3 @@ -9,20 +9,20 @@
    28.4  val thy = @{theory};
    28.5  
    28.6  val rootrat_erls = 
    28.7 -  merge_rls "rootrat_erls" Root_erls
    28.8 -    (merge_rls "" rational_erls
    28.9 -      (append_rls "" e_rls []));
   28.10 +  Celem.merge_rls "rootrat_erls" Root_erls
   28.11 +    (Celem.merge_rls "" rational_erls
   28.12 +      (Celem.append_rls "" Celem.e_rls []));
   28.13  
   28.14  (*.calculate numeral groundterms.*)
   28.15  val calculate_RootRat = 
   28.16 -  append_rls "calculate_RootRat" calculate_Rational
   28.17 -	    [Thm ("distrib_left",TermC.num_str @{thm distrib_left}),
   28.18 +  Celem.append_rls "calculate_RootRat" calculate_Rational
   28.19 +	    [Celem.Thm ("distrib_left",TermC.num_str @{thm distrib_left}),
   28.20  		      (* w*(z1.0 + z2.0) = w * z1.0 + w * z2.0 *)
   28.21 -		     Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),
   28.22 +		     Celem.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),
   28.23  		      (* 1 * z = z *)
   28.24 -		     Thm ("sym_real_mult_minus1",TermC.num_str (@{thm real_mult_minus1} RS @{thm sym})),
   28.25 +		     Celem.Thm ("sym_real_mult_minus1",TermC.num_str (@{thm real_mult_minus1} RS @{thm sym})),
   28.26  		       (* "- z1 = -1 * z1"  *)
   28.27 -		     Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_")
   28.28 +		     Celem.Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_")
   28.29  		     ];
   28.30  
   28.31  val prep_rls' = LTool.prep_rls @{theory};
    29.1 --- a/src/Tools/isac/Knowledge/RootRatEq.thy	Thu Mar 15 10:17:44 2018 +0100
    29.2 +++ b/src/Tools/isac/Knowledge/RootRatEq.thy	Thu Mar 15 12:42:04 2018 +0100
    29.3 @@ -68,44 +68,44 @@
    29.4  fun eval_is_rootRatAddTerm_in _ _ 
    29.5             (p as (Const ("RootRatEq.is'_rootRatAddTerm'_in",_) $ t $ v)) _  =
    29.6      if is_rootRatAddTerm_in t v then 
    29.7 -	SOME ((term2str p) ^ " = True",
    29.8 +	SOME ((Celem.term2str p) ^ " = True",
    29.9  	      HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True})))
   29.10 -    else SOME ((term2str p) ^ " = True",
   29.11 +    else SOME ((Celem.term2str p) ^ " = True",
   29.12  	      HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))
   29.13    | eval_is_rootRatAddTerm_in _ _ _ _ = ((*tracing"### nichts matcht";*) NONE);
   29.14  *}
   29.15  ML {*
   29.16  (*-------------------------rulse-------------------------*)
   29.17  val RootRatEq_prls = 
   29.18 -    append_rls "RootRatEq_prls" e_rls
   29.19 -		[Calc ("Atools.ident",eval_ident "#ident_"),
   29.20 -                 Calc ("Tools.matches",eval_matches ""),
   29.21 -                 Calc ("Tools.lhs"    ,eval_lhs ""),
   29.22 -                 Calc ("Tools.rhs"    ,eval_rhs ""),
   29.23 -                 Calc ("RootEq.is'_rootTerm'_in",eval_is_rootTerm_in ""),
   29.24 -                 Calc ("RootRatEq.is'_rootRatAddTerm'_in", 
   29.25 +    Celem.append_rls "RootRatEq_prls" Celem.e_rls
   29.26 +		[Celem.Calc ("Atools.ident",eval_ident "#ident_"),
   29.27 +                 Celem.Calc ("Tools.matches",eval_matches ""),
   29.28 +                 Celem.Calc ("Tools.lhs"    ,eval_lhs ""),
   29.29 +                 Celem.Calc ("Tools.rhs"    ,eval_rhs ""),
   29.30 +                 Celem.Calc ("RootEq.is'_rootTerm'_in",eval_is_rootTerm_in ""),
   29.31 +                 Celem.Calc ("RootRatEq.is'_rootRatAddTerm'_in", 
   29.32                         eval_is_rootRatAddTerm_in ""),
   29.33 -                 Calc ("HOL.eq",eval_equal "#equal_"),
   29.34 -                 Thm ("not_true",TermC.num_str @{thm not_true}),
   29.35 -                 Thm ("not_false",TermC.num_str @{thm not_false}),
   29.36 -                 Thm ("and_true",TermC.num_str @{thm and_true}),
   29.37 -                 Thm ("and_false",TermC.num_str @{thm and_false}),
   29.38 -                 Thm ("or_true",TermC.num_str @{thm or_true}),
   29.39 -                 Thm ("or_false",TermC.num_str @{thm or_false})
   29.40 +                 Celem.Calc ("HOL.eq",eval_equal "#equal_"),
   29.41 +                 Celem.Thm ("not_true",TermC.num_str @{thm not_true}),
   29.42 +                 Celem.Thm ("not_false",TermC.num_str @{thm not_false}),
   29.43 +                 Celem.Thm ("and_true",TermC.num_str @{thm and_true}),
   29.44 +                 Celem.Thm ("and_false",TermC.num_str @{thm and_false}),
   29.45 +                 Celem.Thm ("or_true",TermC.num_str @{thm or_true}),
   29.46 +                 Celem.Thm ("or_false",TermC.num_str @{thm or_false})
   29.47  		 ];
   29.48  
   29.49  val RooRatEq_erls = 
   29.50 -    merge_rls "RooRatEq_erls" rootrat_erls
   29.51 -    (merge_rls "" RootEq_erls
   29.52 -     (merge_rls "" rateq_erls
   29.53 -      (append_rls "" e_rls
   29.54 +    Celem.merge_rls "RooRatEq_erls" rootrat_erls
   29.55 +    (Celem.merge_rls "" RootEq_erls
   29.56 +     (Celem.merge_rls "" rateq_erls
   29.57 +      (Celem.append_rls "" Celem.e_rls
   29.58  		[])));
   29.59  
   29.60  val RootRatEq_crls = 
   29.61 -    merge_rls "RootRatEq_crls" rootrat_erls
   29.62 -    (merge_rls "" RootEq_erls
   29.63 -     (merge_rls "" rateq_erls
   29.64 -      (append_rls "" e_rls
   29.65 +    Celem.merge_rls "RootRatEq_crls" rootrat_erls
   29.66 +    (Celem.merge_rls "" RootEq_erls
   29.67 +     (Celem.merge_rls "" rateq_erls
   29.68 +      (Celem.append_rls "" Celem.e_rls
   29.69  		[])));
   29.70  *}
   29.71  setup {* KEStore_Elems.add_rlss
   29.72 @@ -113,21 +113,21 @@
   29.73  ML {*
   29.74  (* Solves a rootrat Equation *)
   29.75   val rootrat_solve = prep_rls'(
   29.76 -     Rls {id = "rootrat_solve", preconds = [], 
   29.77 +     Celem.Rls {id = "rootrat_solve", preconds = [], 
   29.78  	  rew_ord = ("termlessI",termlessI), 
   29.79 -     erls = e_rls, srls = Erls, calc = [], errpatts = [],
   29.80 +     erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [],
   29.81       rules = 
   29.82 -     [Thm("rootrat_equation_left_1", TermC.num_str @{thm rootrat_equation_left_1}),   
   29.83 +     [Celem.Thm("rootrat_equation_left_1", TermC.num_str @{thm rootrat_equation_left_1}),   
   29.84  	        (* [|c is_rootTerm_in bdv|] ==> 
   29.85                                      ( (a + b/c = d) = ( b = (d - a) * c )) *)
   29.86 -      Thm("rootrat_equation_left_2",TermC.num_str @{thm rootrat_equation_left_2}),
   29.87 +      Celem.Thm("rootrat_equation_left_2",TermC.num_str @{thm rootrat_equation_left_2}),
   29.88  	        (* [|c is_rootTerm_in bdv|] ==> ( (b/c = d) = ( b = d * c )) *)
   29.89 -      Thm("rootrat_equation_right_1",TermC.num_str @{thm rootrat_equation_right_1}),
   29.90 +      Celem.Thm("rootrat_equation_right_1",TermC.num_str @{thm rootrat_equation_right_1}),
   29.91  		(* [|f is_rootTerm_in bdv|] ==> 
   29.92                                      ( (a = d + e/f) = ( (a - d) * f = e )) *)
   29.93 -      Thm("rootrat_equation_right_2",TermC.num_str @{thm rootrat_equation_right_2})
   29.94 +      Celem.Thm("rootrat_equation_right_2",TermC.num_str @{thm rootrat_equation_right_2})
   29.95  		(* [|f is_rootTerm_in bdv|] ==> ( (a =  e/f) = ( a  * f = e ))*)
   29.96 -      ], scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")}:rls);
   29.97 +      ], scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")});
   29.98  *}
   29.99  setup {* KEStore_Elems.add_rlss
  29.100    [("rootrat_solve", (Context.theory_name @{theory}, rootrat_solve))] *}
  29.101 @@ -139,7 +139,7 @@
  29.102  *)
  29.103  *}
  29.104  setup {* KEStore_Elems.add_pbts
  29.105 -  [(Specify.prep_pbt thy "pbl_equ_univ_root_sq_rat" [] e_pblID
  29.106 +  [(Specify.prep_pbt thy "pbl_equ_univ_root_sq_rat" [] Celem.e_pblID
  29.107        (["rat","sq","root'","univariate","equation"],
  29.108          [("#Given" ,["equality e_e","solveFor v_v"]),
  29.109            ("#Where" ,["( (lhs e_e) is_rootRatAddTerm_in (v_v::real) )| " ^
  29.110 @@ -149,18 +149,18 @@
  29.111  
  29.112  (*-------------------------Methode-----------------------*)
  29.113  setup {* KEStore_Elems.add_mets
  29.114 -  [Specify.prep_met @{theory LinEq} "met_rootrateq" [] e_metID
  29.115 +  [Specify.prep_met @{theory LinEq} "met_rootrateq" [] Celem.e_metID
  29.116        (["RootRatEq"], [],
  29.117 -        {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = e_rls, prls=e_rls,
  29.118 +        {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = Celem.e_rls, prls=Celem.e_rls,
  29.119            crls=Atools_erls, errpats = [], nrls = norm_Rational}, "empty_script"),
  29.120      (*-- left 20.10.02 --*)
  29.121 -    Specify.prep_met thy "met_rootrateq_elim" [] e_metID
  29.122 +    Specify.prep_met thy "met_rootrateq_elim" [] Celem.e_metID
  29.123        (["RootRatEq","elim_rootrat_equation"],
  29.124          [("#Given" ,["equality e_e","solveFor v_v"]),
  29.125            ("#Where" ,["( (lhs e_e) is_rootRatAddTerm_in (v_v::real) ) | " ^
  29.126                "( (rhs e_e) is_rootRatAddTerm_in (v_v::real) )"]),
  29.127            ("#Find"  ,["solutions v_v'i'"])],
  29.128 -        {rew_ord'="termlessI", rls'=RooRatEq_erls, srls=e_rls, prls=RootRatEq_prls, calc=[],
  29.129 +        {rew_ord'="termlessI", rls'=RooRatEq_erls, srls=Celem.e_rls, prls=RootRatEq_prls, calc=[],
  29.130            crls=RootRatEq_crls, errpats = [], nrls = norm_Rational},
  29.131          "Script Elim_rootrat_equation  (e_e::bool) (v_v::real)  =      " ^
  29.132            "(let e_e = ((Try (Rewrite_Set expand_rootbinoms False)) @@  " ^ 
    30.1 --- a/src/Tools/isac/Knowledge/Simplify.thy	Thu Mar 15 10:17:44 2018 +0100
    30.2 +++ b/src/Tools/isac/Knowledge/Simplify.thy	Thu Mar 15 12:42:04 2018 +0100
    30.3 @@ -29,25 +29,25 @@
    30.4  *}
    30.5  (** problems **)
    30.6  setup {* KEStore_Elems.add_pbts
    30.7 -  [(Specify.prep_pbt thy "pbl_simp" [] e_pblID
    30.8 +  [(Specify.prep_pbt thy "pbl_simp" [] Celem.e_pblID
    30.9        (["simplification"],
   30.10          [("#Given" ,["Term t_t"]),
   30.11            ("#Find"  ,["normalform n_n"])],
   30.12 -        append_rls "e_rls" e_rls [(*for preds in where_*)], SOME "Simplify t_t", [])),
   30.13 -    (Specify.prep_pbt thy "pbl_vereinfache" [] e_pblID
   30.14 +        Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*)], SOME "Simplify t_t", [])),
   30.15 +    (Specify.prep_pbt thy "pbl_vereinfache" [] Celem.e_pblID
   30.16        (["vereinfachen"],
   30.17          [("#Given", ["Term t_t"]),
   30.18            ("#Find", ["normalform n_n"])],
   30.19 -        append_rls "e_rls" e_rls [(*for preds in where_*)], SOME "Vereinfache t_t", []))] *}
   30.20 +        Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*)], SOME "Vereinfache t_t", []))] *}
   30.21  
   30.22  (** methods **)
   30.23  setup {* KEStore_Elems.add_mets
   30.24 -  [Specify.prep_met thy "met_tsimp" [] e_metID
   30.25 +  [Specify.prep_met thy "met_tsimp" [] Celem.e_metID
   30.26  	    (["simplification"],
   30.27  	      [("#Given" ,["Term t_t"]),
   30.28  		      ("#Find"  ,["normalform n_n"])],
   30.29 -		    {rew_ord'="tless_true", rls'= e_rls, calc = [], srls = e_rls, prls=e_rls, crls = e_rls,
   30.30 -		      errpats = [], nrls = e_rls},
   30.31 +		    {rew_ord'="tless_true", rls'= Celem.e_rls, calc = [], srls = Celem.e_rls, prls=Celem.e_rls, crls = Celem.e_rls,
   30.32 +		      errpats = [], nrls = Celem.e_rls},
   30.33  	      "empty_script")]
   30.34  *}
   30.35  
    31.1 --- a/src/Tools/isac/Knowledge/Test.thy	Thu Mar 15 10:17:44 2018 +0100
    31.2 +++ b/src/Tools/isac/Knowledge/Test.thy	Thu Mar 15 12:42:04 2018 +0100
    31.3 @@ -172,21 +172,21 @@
    31.4  fun eval_contains_root (thmid:string) _ 
    31.5  		       (t as (Const("Test.contains'_root",t0) $ arg)) thy = 
    31.6    if member op = (ids_of arg) "sqrt"
    31.7 -  then SOME (TermC.mk_thmid thmid (term_to_string''' thy arg)"",
    31.8 +  then SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg)"",
    31.9  	       HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True})))
   31.10 -  else SOME (TermC.mk_thmid thmid (term_to_string''' thy arg)"",
   31.11 +  else SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg)"",
   31.12  	       HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False})))
   31.13  | eval_contains_root _ _ _ _ = NONE; 
   31.14  
   31.15  (*dummy precondition for root-met of x+1=2*)
   31.16  fun eval_precond_rootmet (thmid:string) _ (t as (Const ("Test.precond'_rootmet", _) $ arg)) thy = 
   31.17 -    SOME (TermC.mk_thmid thmid (term_to_string''' thy arg)"",
   31.18 +    SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg)"",
   31.19        HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True})))
   31.20    | eval_precond_rootmet _ _ _ _ = NONE; 
   31.21  
   31.22  (*dummy precondition for root-pbl of x+1=2*)
   31.23  fun eval_precond_rootpbl (thmid:string) _ (t as (Const ("Test.precond'_rootpbl", _) $ arg)) thy = 
   31.24 -    SOME (TermC.mk_thmid thmid (term_to_string''' thy arg) "",
   31.25 +    SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg) "",
   31.26  	    HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True})))
   31.27  	| eval_precond_rootpbl _ _ _ _ = NONE;
   31.28  *}
   31.29 @@ -197,120 +197,120 @@
   31.30          eval_precond_rootpbl"#Test.precond_rootpbl_"))] *}
   31.31  ML {*
   31.32  (** term order **)
   31.33 -fun term_order (_:subst) tu = (term_ordI [] tu = LESS);
   31.34 +fun term_order (_: Celem.subst) tu = (term_ordI [] tu = LESS);
   31.35  
   31.36  (** rule sets **)
   31.37  
   31.38  val testerls = 
   31.39 -  Rls {id = "testerls", preconds = [], rew_ord = ("termlessI",termlessI), 
   31.40 -      erls = e_rls, srls = Erls, 
   31.41 +  Celem.Rls {id = "testerls", preconds = [], rew_ord = ("termlessI",termlessI), 
   31.42 +      erls = Celem.e_rls, srls = Celem.Erls, 
   31.43        calc = [], errpatts = [], 
   31.44 -      rules = [Thm ("refl",TermC.num_str @{thm refl}),
   31.45 -	       Thm ("order_refl",TermC.num_str @{thm order_refl}),
   31.46 -	       Thm ("radd_left_cancel_le",TermC.num_str @{thm radd_left_cancel_le}),
   31.47 -	       Thm ("not_true",TermC.num_str @{thm not_true}),
   31.48 -	       Thm ("not_false",TermC.num_str @{thm not_false}),
   31.49 -	       Thm ("and_true",TermC.num_str @{thm and_true}),
   31.50 -	       Thm ("and_false",TermC.num_str @{thm and_false}),
   31.51 -	       Thm ("or_true",TermC.num_str @{thm or_true}),
   31.52 -	       Thm ("or_false",TermC.num_str @{thm or_false}),
   31.53 -	       Thm ("and_commute",TermC.num_str @{thm and_commute}),
   31.54 -	       Thm ("or_commute",TermC.num_str @{thm or_commute}),
   31.55 +      rules = [Celem.Thm ("refl",TermC.num_str @{thm refl}),
   31.56 +	       Celem.Thm ("order_refl",TermC.num_str @{thm order_refl}),
   31.57 +	       Celem.Thm ("radd_left_cancel_le",TermC.num_str @{thm radd_left_cancel_le}),
   31.58 +	       Celem.Thm ("not_true",TermC.num_str @{thm not_true}),
   31.59 +	       Celem.Thm ("not_false",TermC.num_str @{thm not_false}),
   31.60 +	       Celem.Thm ("and_true",TermC.num_str @{thm and_true}),
   31.61 +	       Celem.Thm ("and_false",TermC.num_str @{thm and_false}),
   31.62 +	       Celem.Thm ("or_true",TermC.num_str @{thm or_true}),
   31.63 +	       Celem.Thm ("or_false",TermC.num_str @{thm or_false}),
   31.64 +	       Celem.Thm ("and_commute",TermC.num_str @{thm and_commute}),
   31.65 +	       Celem.Thm ("or_commute",TermC.num_str @{thm or_commute}),
   31.66  
   31.67 -	       Calc ("Atools.is'_const",eval_const "#is_const_"),
   31.68 -	       Calc ("Tools.matches",eval_matches ""),
   31.69 +	       Celem.Calc ("Atools.is'_const",eval_const "#is_const_"),
   31.70 +	       Celem.Calc ("Tools.matches",eval_matches ""),
   31.71      
   31.72 -	       Calc ("Groups.plus_class.plus",eval_binop "#add_"),
   31.73 -	       Calc ("Groups.times_class.times",eval_binop "#mult_"),
   31.74 -	       Calc ("Atools.pow" ,eval_binop "#power_"),
   31.75 +	       Celem.Calc ("Groups.plus_class.plus",eval_binop "#add_"),
   31.76 +	       Celem.Calc ("Groups.times_class.times",eval_binop "#mult_"),
   31.77 +	       Celem.Calc ("Atools.pow" ,eval_binop "#power_"),
   31.78  		    
   31.79 -	       Calc ("Orderings.ord_class.less",eval_equ "#less_"),
   31.80 -	       Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"),
   31.81 +	       Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"),
   31.82 +	       Celem.Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"),
   31.83  	     	    
   31.84 -	       Calc ("Atools.ident",eval_ident "#ident_")],
   31.85 -      scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
   31.86 -      }:rls;      
   31.87 +	       Celem.Calc ("Atools.ident",eval_ident "#ident_")],
   31.88 +      scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
   31.89 +      };      
   31.90  *}
   31.91  ML {*
   31.92  (*.for evaluation of conditions in rewrite rules.*)
   31.93  (*FIXXXXXXME 10.8.02: handle like _simplify*)
   31.94  val tval_rls =  
   31.95 -  Rls{id = "tval_rls", preconds = [], 
   31.96 +  Celem.Rls{id = "tval_rls", preconds = [], 
   31.97        rew_ord = ("sqrt_right",sqrt_right false @{theory "Pure"}), 
   31.98 -      erls=testerls,srls = e_rls, 
   31.99 +      erls=testerls,srls = Celem.e_rls, 
  31.100        calc=[], errpatts = [],
  31.101 -      rules = [Thm ("refl",TermC.num_str @{thm refl}),
  31.102 -	       Thm ("order_refl",TermC.num_str @{thm order_refl}),
  31.103 -	       Thm ("radd_left_cancel_le",TermC.num_str @{thm radd_left_cancel_le}),
  31.104 -	       Thm ("not_true",TermC.num_str @{thm not_true}),
  31.105 -	       Thm ("not_false",TermC.num_str @{thm not_false}),
  31.106 -	       Thm ("and_true",TermC.num_str @{thm and_true}),
  31.107 -	       Thm ("and_false",TermC.num_str @{thm and_false}),
  31.108 -	       Thm ("or_true",TermC.num_str @{thm or_true}),
  31.109 -	       Thm ("or_false",TermC.num_str @{thm or_false}),
  31.110 -	       Thm ("and_commute",TermC.num_str @{thm and_commute}),
  31.111 -	       Thm ("or_commute",TermC.num_str @{thm or_commute}),
  31.112 +      rules = [Celem.Thm ("refl",TermC.num_str @{thm refl}),
  31.113 +	       Celem.Thm ("order_refl",TermC.num_str @{thm order_refl}),
  31.114 +	       Celem.Thm ("radd_left_cancel_le",TermC.num_str @{thm radd_left_cancel_le}),
  31.115 +	       Celem.Thm ("not_true",TermC.num_str @{thm not_true}),
  31.116 +	       Celem.Thm ("not_false",TermC.num_str @{thm not_false}),
  31.117 +	       Celem.Thm ("and_true",TermC.num_str @{thm and_true}),
  31.118 +	       Celem.Thm ("and_false",TermC.num_str @{thm and_false}),
  31.119 +	       Celem.Thm ("or_true",TermC.num_str @{thm or_true}),
  31.120 +	       Celem.Thm ("or_false",TermC.num_str @{thm or_false}),
  31.121 +	       Celem.Thm ("and_commute",TermC.num_str @{thm and_commute}),
  31.122 +	       Celem.Thm ("or_commute",TermC.num_str @{thm or_commute}),
  31.123  
  31.124 -	       Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}),
  31.125 +	       Celem.Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}),
  31.126  
  31.127 -	       Thm ("root_ge0",TermC.num_str @{thm root_ge0}),
  31.128 -	       Thm ("root_add_ge0",TermC.num_str @{thm root_add_ge0}),
  31.129 -	       Thm ("root_ge0_1",TermC.num_str @{thm root_ge0_1}),
  31.130 -	       Thm ("root_ge0_2",TermC.num_str @{thm root_ge0_2}),
  31.131 +	       Celem.Thm ("root_ge0",TermC.num_str @{thm root_ge0}),
  31.132 +	       Celem.Thm ("root_add_ge0",TermC.num_str @{thm root_add_ge0}),
  31.133 +	       Celem.Thm ("root_ge0_1",TermC.num_str @{thm root_ge0_1}),
  31.134 +	       Celem.Thm ("root_ge0_2",TermC.num_str @{thm root_ge0_2}),
  31.135  
  31.136 -	       Calc ("Atools.is'_const",eval_const "#is_const_"),
  31.137 -	       Calc ("Test.contains'_root",eval_contains_root "#eval_contains_root"),
  31.138 -	       Calc ("Tools.matches",eval_matches ""),
  31.139 -	       Calc ("Test.contains'_root",
  31.140 +	       Celem.Calc ("Atools.is'_const",eval_const "#is_const_"),
  31.141 +	       Celem.Calc ("Test.contains'_root",eval_contains_root "#eval_contains_root"),
  31.142 +	       Celem.Calc ("Tools.matches",eval_matches ""),
  31.143 +	       Celem.Calc ("Test.contains'_root",
  31.144  		     eval_contains_root"#contains_root_"),
  31.145      
  31.146 -	       Calc ("Groups.plus_class.plus",eval_binop "#add_"),
  31.147 -	       Calc ("Groups.times_class.times",eval_binop "#mult_"),
  31.148 -	       Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"),
  31.149 -	       Calc ("Atools.pow" ,eval_binop "#power_"),
  31.150 +	       Celem.Calc ("Groups.plus_class.plus",eval_binop "#add_"),
  31.151 +	       Celem.Calc ("Groups.times_class.times",eval_binop "#mult_"),
  31.152 +	       Celem.Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"),
  31.153 +	       Celem.Calc ("Atools.pow" ,eval_binop "#power_"),
  31.154  		    
  31.155 -	       Calc ("Orderings.ord_class.less",eval_equ "#less_"),
  31.156 -	       Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"),
  31.157 +	       Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"),
  31.158 +	       Celem.Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"),
  31.159  	     	    
  31.160 -	       Calc ("Atools.ident",eval_ident "#ident_")],
  31.161 -      scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  31.162 -      }:rls;      
  31.163 +	       Celem.Calc ("Atools.ident",eval_ident "#ident_")],
  31.164 +      scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  31.165 +      };      
  31.166  *}
  31.167  setup {* KEStore_Elems.add_rlss [("testerls", (Context.theory_name @{theory}, prep_rls' testerls))] *}
  31.168  
  31.169  ML {*
  31.170  (*make () dissappear*)   
  31.171  val rearrange_assoc =
  31.172 -  Rls{id = "rearrange_assoc", preconds = [], 
  31.173 -      rew_ord = ("e_rew_ord",e_rew_ord), 
  31.174 -      erls = e_rls, srls = e_rls, calc = [], errpatts = [],
  31.175 +  Celem.Rls{id = "rearrange_assoc", preconds = [], 
  31.176 +      rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord), 
  31.177 +      erls = Celem.e_rls, srls = Celem.e_rls, calc = [], errpatts = [],
  31.178        rules = 
  31.179 -      [Thm ("sym_add_assoc",TermC.num_str (@{thm add.assoc} RS @{thm sym})),
  31.180 -       Thm ("sym_rmult_assoc",TermC.num_str (@{thm rmult_assoc} RS @{thm sym}))],
  31.181 -      scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  31.182 -      }:rls;      
  31.183 +      [Celem.Thm ("sym_add_assoc",TermC.num_str (@{thm add.assoc} RS @{thm sym})),
  31.184 +       Celem.Thm ("sym_rmult_assoc",TermC.num_str (@{thm rmult_assoc} RS @{thm sym}))],
  31.185 +      scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  31.186 +      };      
  31.187  
  31.188  val ac_plus_times =
  31.189 -  Rls{id = "ac_plus_times", preconds = [], rew_ord = ("term_order",term_order),
  31.190 -      erls = e_rls, srls = e_rls, calc = [], errpatts = [],
  31.191 +  Celem.Rls{id = "ac_plus_times", preconds = [], rew_ord = ("term_order",term_order),
  31.192 +      erls = Celem.e_rls, srls = Celem.e_rls, calc = [], errpatts = [],
  31.193        rules = 
  31.194 -      [Thm ("radd_commute",TermC.num_str @{thm radd_commute}),
  31.195 -       Thm ("radd_left_commute",TermC.num_str @{thm radd_left_commute}),
  31.196 -       Thm ("add_assoc",TermC.num_str @{thm add.assoc}),
  31.197 -       Thm ("rmult_commute",TermC.num_str @{thm rmult_commute}),
  31.198 -       Thm ("rmult_left_commute",TermC.num_str @{thm rmult_left_commute}),
  31.199 -       Thm ("rmult_assoc",TermC.num_str @{thm rmult_assoc})],
  31.200 -      scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  31.201 -      }:rls;      
  31.202 +      [Celem.Thm ("radd_commute",TermC.num_str @{thm radd_commute}),
  31.203 +       Celem.Thm ("radd_left_commute",TermC.num_str @{thm radd_left_commute}),
  31.204 +       Celem.Thm ("add_assoc",TermC.num_str @{thm add.assoc}),
  31.205 +       Celem.Thm ("rmult_commute",TermC.num_str @{thm rmult_commute}),
  31.206 +       Celem.Thm ("rmult_left_commute",TermC.num_str @{thm rmult_left_commute}),
  31.207 +       Celem.Thm ("rmult_assoc",TermC.num_str @{thm rmult_assoc})],
  31.208 +      scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  31.209 +      };      
  31.210  
  31.211  (*todo: replace by Rewrite("rnorm_equation_add",TermC.num_str @{thm rnorm_equation_add)*)
  31.212  val norm_equation =
  31.213 -  Rls{id = "norm_equation", preconds = [], rew_ord = ("e_rew_ord",e_rew_ord),
  31.214 -      erls = tval_rls, srls = e_rls, calc = [], errpatts = [],
  31.215 -      rules = [Thm ("rnorm_equation_add",TermC.num_str @{thm rnorm_equation_add})
  31.216 +  Celem.Rls{id = "norm_equation", preconds = [], rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord),
  31.217 +      erls = tval_rls, srls = Celem.e_rls, calc = [], errpatts = [],
  31.218 +      rules = [Celem.Thm ("rnorm_equation_add",TermC.num_str @{thm rnorm_equation_add})
  31.219  	       ],
  31.220 -      scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  31.221 -      }:rls;      
  31.222 +      scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  31.223 +      };      
  31.224  *}
  31.225  ML {*
  31.226  (** rule sets **)
  31.227 @@ -366,59 +366,59 @@
  31.228  ML {*
  31.229  (* expects * distributed over + *)
  31.230  val Test_simplify =
  31.231 -  Rls{id = "Test_simplify", preconds = [], 
  31.232 +  Celem.Rls{id = "Test_simplify", preconds = [], 
  31.233        rew_ord = ("sqrt_right",sqrt_right false @{theory "Pure"}),
  31.234 -      erls = tval_rls, srls = e_rls, 
  31.235 +      erls = tval_rls, srls = Celem.e_rls, 
  31.236        calc=[(*since 040209 filled by prep_rls'*)], errpatts = [],
  31.237        rules = [
  31.238 -	       Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}),
  31.239 -	       Thm ("radd_mult_distrib2",TermC.num_str @{thm radd_mult_distrib2}),
  31.240 -	       Thm ("rdistr_right_assoc",TermC.num_str @{thm rdistr_right_assoc}),
  31.241 -	       Thm ("rdistr_right_assoc_p",TermC.num_str @{thm rdistr_right_assoc_p}),
  31.242 -	       Thm ("rdistr_div_right",TermC.num_str @{thm rdistr_div_right}),
  31.243 -	       Thm ("rbinom_power_2",TermC.num_str @{thm rbinom_power_2}),	       
  31.244 +	       Celem.Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}),
  31.245 +	       Celem.Thm ("radd_mult_distrib2",TermC.num_str @{thm radd_mult_distrib2}),
  31.246 +	       Celem.Thm ("rdistr_right_assoc",TermC.num_str @{thm rdistr_right_assoc}),
  31.247 +	       Celem.Thm ("rdistr_right_assoc_p",TermC.num_str @{thm rdistr_right_assoc_p}),
  31.248 +	       Celem.Thm ("rdistr_div_right",TermC.num_str @{thm rdistr_div_right}),
  31.249 +	       Celem.Thm ("rbinom_power_2",TermC.num_str @{thm rbinom_power_2}),	       
  31.250  
  31.251 -               Thm ("radd_commute",TermC.num_str @{thm radd_commute}), 
  31.252 -	       Thm ("radd_left_commute",TermC.num_str @{thm radd_left_commute}),
  31.253 -	       Thm ("add_assoc",TermC.num_str @{thm add.assoc}),
  31.254 -	       Thm ("rmult_commute",TermC.num_str @{thm rmult_commute}),
  31.255 -	       Thm ("rmult_left_commute",TermC.num_str @{thm rmult_left_commute}),
  31.256 -	       Thm ("rmult_assoc",TermC.num_str @{thm rmult_assoc}),
  31.257 +               Celem.Thm ("radd_commute",TermC.num_str @{thm radd_commute}), 
  31.258 +	       Celem.Thm ("radd_left_commute",TermC.num_str @{thm radd_left_commute}),
  31.259 +	       Celem.Thm ("add_assoc",TermC.num_str @{thm add.assoc}),
  31.260 +	       Celem.Thm ("rmult_commute",TermC.num_str @{thm rmult_commute}),
  31.261 +	       Celem.Thm ("rmult_left_commute",TermC.num_str @{thm rmult_left_commute}),
  31.262 +	       Celem.Thm ("rmult_assoc",TermC.num_str @{thm rmult_assoc}),
  31.263  
  31.264 -	       Thm ("radd_real_const_eq",TermC.num_str @{thm radd_real_const_eq}),
  31.265 -	       Thm ("radd_real_const",TermC.num_str @{thm radd_real_const}),
  31.266 +	       Celem.Thm ("radd_real_const_eq",TermC.num_str @{thm radd_real_const_eq}),
  31.267 +	       Celem.Thm ("radd_real_const",TermC.num_str @{thm radd_real_const}),
  31.268  	       (* these 2 rules are invers to distr_div_right wrt. termination.
  31.269  		  thus they MUST be done IMMEDIATELY before calc *)
  31.270 -	       Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  31.271 -	       Calc ("Groups.times_class.times", eval_binop "#mult_"),
  31.272 -	       Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),
  31.273 -	       Calc ("Atools.pow", eval_binop "#power_"),
  31.274 +	       Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  31.275 +	       Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
  31.276 +	       Celem.Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),
  31.277 +	       Celem.Calc ("Atools.pow", eval_binop "#power_"),
  31.278  
  31.279 -	       Thm ("rcollect_right",TermC.num_str @{thm rcollect_right}),
  31.280 -	       Thm ("rcollect_one_left",TermC.num_str @{thm rcollect_one_left}),
  31.281 -	       Thm ("rcollect_one_left_assoc",TermC.num_str @{thm rcollect_one_left_assoc}),
  31.282 -	       Thm ("rcollect_one_left_assoc_p",TermC.num_str @{thm rcollect_one_left_assoc_p}),
  31.283 +	       Celem.Thm ("rcollect_right",TermC.num_str @{thm rcollect_right}),
  31.284 +	       Celem.Thm ("rcollect_one_left",TermC.num_str @{thm rcollect_one_left}),
  31.285 +	       Celem.Thm ("rcollect_one_left_assoc",TermC.num_str @{thm rcollect_one_left_assoc}),
  31.286 +	       Celem.Thm ("rcollect_one_left_assoc_p",TermC.num_str @{thm rcollect_one_left_assoc_p}),
  31.287  
  31.288 -	       Thm ("rshift_nominator",TermC.num_str @{thm rshift_nominator}),
  31.289 -	       Thm ("rcancel_den",TermC.num_str @{thm rcancel_den}),
  31.290 -	       Thm ("rroot_square_inv",TermC.num_str @{thm rroot_square_inv}),
  31.291 -	       Thm ("rroot_times_root",TermC.num_str @{thm rroot_times_root}),
  31.292 -	       Thm ("rroot_times_root_assoc_p",TermC.num_str @{thm rroot_times_root_assoc_p}),
  31.293 -	       Thm ("rsqare",TermC.num_str @{thm rsqare}),
  31.294 -	       Thm ("power_1",TermC.num_str @{thm power_1}),
  31.295 -	       Thm ("rtwo_of_the_same",TermC.num_str @{thm rtwo_of_the_same}),
  31.296 -	       Thm ("rtwo_of_the_same_assoc_p",TermC.num_str @{thm rtwo_of_the_same_assoc_p}),
  31.297 +	       Celem.Thm ("rshift_nominator",TermC.num_str @{thm rshift_nominator}),
  31.298 +	       Celem.Thm ("rcancel_den",TermC.num_str @{thm rcancel_den}),
  31.299 +	       Celem.Thm ("rroot_square_inv",TermC.num_str @{thm rroot_square_inv}),
  31.300 +	       Celem.Thm ("rroot_times_root",TermC.num_str @{thm rroot_times_root}),
  31.301 +	       Celem.Thm ("rroot_times_root_assoc_p",TermC.num_str @{thm rroot_times_root_assoc_p}),
  31.302 +	       Celem.Thm ("rsqare",TermC.num_str @{thm rsqare}),
  31.303 +	       Celem.Thm ("power_1",TermC.num_str @{thm power_1}),
  31.304 +	       Celem.Thm ("rtwo_of_the_same",TermC.num_str @{thm rtwo_of_the_same}),
  31.305 +	       Celem.Thm ("rtwo_of_the_same_assoc_p",TermC.num_str @{thm rtwo_of_the_same_assoc_p}),
  31.306  
  31.307 -	       Thm ("rmult_1",TermC.num_str @{thm rmult_1}),
  31.308 -	       Thm ("rmult_1_right",TermC.num_str @{thm rmult_1_right}),
  31.309 -	       Thm ("rmult_0",TermC.num_str @{thm rmult_0}),
  31.310 -	       Thm ("rmult_0_right",TermC.num_str @{thm rmult_0_right}),
  31.311 -	       Thm ("radd_0",TermC.num_str @{thm radd_0}),
  31.312 -	       Thm ("radd_0_right",TermC.num_str @{thm radd_0_right})
  31.313 +	       Celem.Thm ("rmult_1",TermC.num_str @{thm rmult_1}),
  31.314 +	       Celem.Thm ("rmult_1_right",TermC.num_str @{thm rmult_1_right}),
  31.315 +	       Celem.Thm ("rmult_0",TermC.num_str @{thm rmult_0}),
  31.316 +	       Celem.Thm ("rmult_0_right",TermC.num_str @{thm rmult_0_right}),
  31.317 +	       Celem.Thm ("radd_0",TermC.num_str @{thm radd_0}),
  31.318 +	       Celem.Thm ("radd_0_right",TermC.num_str @{thm radd_0_right})
  31.319  	       ],
  31.320 -      scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  31.321 +      scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  31.322  		    (*since 040209 filled by prep_rls': STest_simplify*)
  31.323 -      }:rls;      
  31.324 +      };      
  31.325  *}
  31.326  ML {*
  31.327  
  31.328 @@ -428,33 +428,33 @@
  31.329  
  31.330  (*isolate the root in a root-equation*)
  31.331  val isolate_root =
  31.332 -  Rls{id = "isolate_root", preconds = [], rew_ord = ("e_rew_ord",e_rew_ord), 
  31.333 -      erls=tval_rls,srls = e_rls, calc=[], errpatts = [],
  31.334 -      rules = [Thm ("rroot_to_lhs",TermC.num_str @{thm rroot_to_lhs}),
  31.335 -	       Thm ("rroot_to_lhs_mult",TermC.num_str @{thm rroot_to_lhs_mult}),
  31.336 -	       Thm ("rroot_to_lhs_add_mult",TermC.num_str @{thm rroot_to_lhs_add_mult}),
  31.337 -	       Thm ("risolate_root_add",TermC.num_str @{thm risolate_root_add}),
  31.338 -	       Thm ("risolate_root_mult",TermC.num_str @{thm risolate_root_mult}),
  31.339 -	       Thm ("risolate_root_div",TermC.num_str @{thm risolate_root_div})       ],
  31.340 -      scr = Prog ((Thm.term_of o the o (TermC.parse thy)) 
  31.341 +  Celem.Rls{id = "isolate_root", preconds = [], rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord), 
  31.342 +      erls=tval_rls,srls = Celem.e_rls, calc=[], errpatts = [],
  31.343 +      rules = [Celem.Thm ("rroot_to_lhs",TermC.num_str @{thm rroot_to_lhs}),
  31.344 +	       Celem.Thm ("rroot_to_lhs_mult",TermC.num_str @{thm rroot_to_lhs_mult}),
  31.345 +	       Celem.Thm ("rroot_to_lhs_add_mult",TermC.num_str @{thm rroot_to_lhs_add_mult}),
  31.346 +	       Celem.Thm ("risolate_root_add",TermC.num_str @{thm risolate_root_add}),
  31.347 +	       Celem.Thm ("risolate_root_mult",TermC.num_str @{thm risolate_root_mult}),
  31.348 +	       Celem.Thm ("risolate_root_div",TermC.num_str @{thm risolate_root_div})       ],
  31.349 +      scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) 
  31.350        "empty_script")
  31.351 -      }:rls;
  31.352 +      };
  31.353  
  31.354  (*isolate the bound variable in an equation; 'bdv' is a meta-constant*)
  31.355  val isolate_bdv =
  31.356 -    Rls{id = "isolate_bdv", preconds = [], rew_ord = ("e_rew_ord",e_rew_ord),
  31.357 -	erls=tval_rls,srls = e_rls, calc= [], errpatts = [],
  31.358 +    Celem.Rls{id = "isolate_bdv", preconds = [], rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord),
  31.359 +	erls=tval_rls,srls = Celem.e_rls, calc= [], errpatts = [],
  31.360  	rules = 
  31.361 -	[Thm ("risolate_bdv_add",TermC.num_str @{thm risolate_bdv_add}),
  31.362 -	 Thm ("risolate_bdv_mult_add",TermC.num_str @{thm risolate_bdv_mult_add}),
  31.363 -	 Thm ("risolate_bdv_mult",TermC.num_str @{thm risolate_bdv_mult}),
  31.364 -	 Thm ("mult_square",TermC.num_str @{thm mult_square}),
  31.365 -	 Thm ("constant_square",TermC.num_str @{thm constant_square}),
  31.366 -	 Thm ("constant_mult_square",TermC.num_str @{thm constant_mult_square})
  31.367 +	[Celem.Thm ("risolate_bdv_add",TermC.num_str @{thm risolate_bdv_add}),
  31.368 +	 Celem.Thm ("risolate_bdv_mult_add",TermC.num_str @{thm risolate_bdv_mult_add}),
  31.369 +	 Celem.Thm ("risolate_bdv_mult",TermC.num_str @{thm risolate_bdv_mult}),
  31.370 +	 Celem.Thm ("mult_square",TermC.num_str @{thm mult_square}),
  31.371 +	 Celem.Thm ("constant_square",TermC.num_str @{thm constant_square}),
  31.372 +	 Celem.Thm ("constant_mult_square",TermC.num_str @{thm constant_mult_square})
  31.373  	 ],
  31.374 -	scr = Prog ((Thm.term_of o the o (TermC.parse thy)) 
  31.375 +	scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) 
  31.376  			  "empty_script")
  31.377 -	}:rls;      
  31.378 +	};      
  31.379  *}
  31.380  ML {*
  31.381  
  31.382 @@ -489,24 +489,24 @@
  31.383    ("isolate_root", (Context.theory_name @{theory}, prep_rls' isolate_root)), 
  31.384    ("isolate_bdv", (Context.theory_name @{theory}, prep_rls' isolate_bdv)), 
  31.385    ("matches", (Context.theory_name @{theory}, prep_rls'
  31.386 -    (append_rls "matches" testerls [Calc ("Tools.matches",eval_matches "#matches_")])))] *}
  31.387 +    (Celem.append_rls "matches" testerls [Celem.Calc ("Tools.matches",eval_matches "#matches_")])))] *}
  31.388  
  31.389  (** problem types **)
  31.390  setup {* KEStore_Elems.add_pbts
  31.391 -  [(Specify.prep_pbt thy "pbl_test" [] e_pblID (["test"], [], e_rls, NONE, [])),
  31.392 -    (Specify.prep_pbt thy "pbl_test_equ" [] e_pblID
  31.393 +  [(Specify.prep_pbt thy "pbl_test" [] Celem.e_pblID (["test"], [], Celem.e_rls, NONE, [])),
  31.394 +    (Specify.prep_pbt thy "pbl_test_equ" [] Celem.e_pblID
  31.395        (["equation","test"],
  31.396          [("#Given" ,["equality e_e","solveFor v_v"]),
  31.397             ("#Where" ,["matches (?a = ?b) e_e"]),
  31.398             ("#Find"  ,["solutions v_v'i'"])],
  31.399          assoc_rls' @{theory} "matches", SOME "solve (e_e::bool, v_v)", [])),
  31.400 -    (Specify.prep_pbt thy "pbl_test_uni" [] e_pblID
  31.401 +    (Specify.prep_pbt thy "pbl_test_uni" [] Celem.e_pblID
  31.402        (["univariate","equation","test"],
  31.403          [("#Given" ,["equality e_e","solveFor v_v"]),
  31.404             ("#Where" ,["matches (?a = ?b) e_e"]),
  31.405             ("#Find"  ,["solutions v_v'i'"])],
  31.406          assoc_rls' @{theory} "matches", SOME "solve (e_e::bool, v_v)", [])),
  31.407 -    (Specify.prep_pbt thy "pbl_test_uni_lin" [] e_pblID
  31.408 +    (Specify.prep_pbt thy "pbl_test_uni_lin" [] Celem.e_pblID
  31.409        (["LINEAR","univariate","equation","test"],
  31.410          [("#Given" ,["equality e_e","solveFor v_v"]),
  31.411             ("#Where" ,["(matches (   v_v = 0) e_e) | (matches (   ?b*v_v = 0) e_e) |" ^
  31.412 @@ -530,16 +530,16 @@
  31.413  
  31.414  (** methods **)
  31.415  setup {* KEStore_Elems.add_mets
  31.416 -  [Specify.prep_met @{theory "Diff"} "met_test" [] e_metID
  31.417 +  [Specify.prep_met @{theory "Diff"} "met_test" [] Celem.e_metID
  31.418        (["Test"], [],
  31.419 -        {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = e_rls, prls=e_rls,
  31.420 -          crls=Atools_erls, errpats = [], nrls = e_rls}, "empty_script"),
  31.421 -    Specify.prep_met thy "met_test_solvelin" [] e_metID
  31.422 -      (["Test","solve_linear"]:metID,
  31.423 +        {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = Celem.e_rls, prls=Celem.e_rls,
  31.424 +          crls=Atools_erls, errpats = [], nrls = Celem.e_rls}, "empty_script"),
  31.425 +    Specify.prep_met thy "met_test_solvelin" [] Celem.e_metID
  31.426 +      (["Test","solve_linear"],
  31.427          [("#Given" ,["equality e_e","solveFor v_v"]),
  31.428            ("#Where" ,["matches (?a = ?b) e_e"]),
  31.429            ("#Find"  ,["solutions v_v'i'"])],
  31.430 -        {rew_ord' = "e_rew_ord", rls' = tval_rls, srls = e_rls,
  31.431 +        {rew_ord' = "xxxe_rew_ordxxx", rls' = tval_rls, srls = Celem.e_rls,
  31.432            prls = assoc_rls' @{theory} "matches", calc = [], crls = tval_rls, errpats = [],
  31.433            nrls = Test_simplify},
  31.434          "Script Solve_linear (e_e::bool) (v_v::real)=                     " ^
  31.435 @@ -549,10 +549,10 @@
  31.436            "      (Rewrite_Set Test_simplify False))) e_e" ^
  31.437            " in [e_e::bool])")(*,
  31.438      Specify.prep_met thy (*test for equations*)
  31.439 -      (["Test","testeq"]:metID,
  31.440 +      (["Test","testeq"],
  31.441          [("#Given" ,["boolTestGiven g_g"]),
  31.442            ("#Find"  ,["boolTestFind f_f"])],
  31.443 -        {rew_ord'="e_rew_ord",rls'="tval_rls",asm_rls=[], asm_thm=[("square_equation_left","")]},
  31.444 +        {rew_ord'="xxxe_rew_ordxxx",rls'="tval_rls",asm_rls=[], asm_thm=[("square_equation_left","")]},
  31.445          "Script Testeq (e_q::bool) =                                         " ^
  31.446            "Repeat                                                            " ^
  31.447            " (let e_e = Try (Repeat (Rewrite rroot_square_inv False e_q));      " ^
  31.448 @@ -707,7 +707,7 @@
  31.449  *}
  31.450  (** problem types **)
  31.451  setup {* KEStore_Elems.add_pbts
  31.452 -  [(Specify.prep_pbt thy "pbl_test_uni_plain2" [] e_pblID
  31.453 +  [(Specify.prep_pbt thy "pbl_test_uni_plain2" [] Celem.e_pblID
  31.454      (["plain_square","univariate","equation","test"],
  31.455        [("#Given" ,["equality e_e","solveFor v_v"]),
  31.456          ("#Where" ,["(matches (?a + ?b*v_v ^^^2 = 0) e_e) |" ^
  31.457 @@ -740,71 +740,71 @@
  31.458  
  31.459  *)
  31.460  setup {* KEStore_Elems.add_pbts
  31.461 -  [(Specify.prep_pbt thy "pbl_test_uni_poly" [] e_pblID
  31.462 +  [(Specify.prep_pbt thy "pbl_test_uni_poly" [] Celem.e_pblID
  31.463        (["polynomial","univariate","equation","test"],
  31.464          [("#Given" ,["equality (v_v ^^^2 + p_p * v_v + q__q = 0)","solveFor v_v"]),
  31.465            ("#Where" ,["HOL.False"]),
  31.466            ("#Find"  ,["solutions v_v'i'"])],
  31.467 -        e_rls, SOME "solve (e_e::bool, v_v)", [])),
  31.468 -    (Specify.prep_pbt thy "pbl_test_uni_poly_deg2" [] e_pblID
  31.469 +        Celem.e_rls, SOME "solve (e_e::bool, v_v)", [])),
  31.470 +    (Specify.prep_pbt thy "pbl_test_uni_poly_deg2" [] Celem.e_pblID
  31.471        (["degree_two","polynomial","univariate","equation","test"],
  31.472          [("#Given" ,["equality (v_v ^^^2 + p_p * v_v + q__q = 0)","solveFor v_v"]),
  31.473            ("#Find"  ,["solutions v_v'i'"])],
  31.474 -        e_rls, SOME "solve (v_v ^^^2 + p_p * v_v + q__q = 0, v_v)", [])),
  31.475 -    (Specify.prep_pbt thy "pbl_test_uni_poly_deg2_pq" [] e_pblID
  31.476 +        Celem.e_rls, SOME "solve (v_v ^^^2 + p_p * v_v + q__q = 0, v_v)", [])),
  31.477 +    (Specify.prep_pbt thy "pbl_test_uni_poly_deg2_pq" [] Celem.e_pblID
  31.478        (["pq_formula","degree_two","polynomial","univariate","equation","test"],
  31.479          [("#Given" ,["equality (v_v ^^^2 + p_p * v_v + q__q = 0)","solveFor v_v"]),
  31.480            ("#Find"  ,["solutions v_v'i'"])],
  31.481 -        e_rls, SOME "solve (v_v ^^^2 + p_p * v_v + q__q = 0, v_v)", [])),
  31.482 -    (Specify.prep_pbt thy "pbl_test_uni_poly_deg2_abc" [] e_pblID
  31.483 +        Celem.e_rls, SOME "solve (v_v ^^^2 + p_p * v_v + q__q = 0, v_v)", [])),
  31.484 +    (Specify.prep_pbt thy "pbl_test_uni_poly_deg2_abc" [] Celem.e_pblID
  31.485        (["abc_formula","degree_two","polynomial","univariate","equation","test"],
  31.486          [("#Given" ,["equality (a_a * x ^^^2 + b_b * x + c_c = 0)","solveFor v_v"]),
  31.487            ("#Find"  ,["solutions v_v'i'"])],
  31.488 -        e_rls, SOME "solve (a_a * x ^^^2 + b_b * x + c_c = 0, v_v)", [])),
  31.489 -    (Specify.prep_pbt thy "pbl_test_uni_root" [] e_pblID
  31.490 +        Celem.e_rls, SOME "solve (a_a * x ^^^2 + b_b * x + c_c = 0, v_v)", [])),
  31.491 +    (Specify.prep_pbt thy "pbl_test_uni_root" [] Celem.e_pblID
  31.492        (["squareroot","univariate","equation","test"],
  31.493          [("#Given" ,["equality e_e","solveFor v_v"]),
  31.494            ("#Where" ,["precond_rootpbl v_v"]),
  31.495            ("#Find"  ,["solutions v_v'i'"])],
  31.496 -        append_rls "contains_root" e_rls [Calc ("Test.contains'_root",
  31.497 +        Celem.append_rls "contains_root" Celem.e_rls [Celem.Calc ("Test.contains'_root",
  31.498              eval_contains_root "#contains_root_")], 
  31.499          SOME "solve (e_e::bool, v_v)", [["Test","square_equation"]])),
  31.500 -    (Specify.prep_pbt thy "pbl_test_uni_norm" [] e_pblID
  31.501 +    (Specify.prep_pbt thy "pbl_test_uni_norm" [] Celem.e_pblID
  31.502        (["normalise","univariate","equation","test"],
  31.503          [("#Given" ,["equality e_e","solveFor v_v"]),
  31.504            ("#Where" ,[]),
  31.505            ("#Find"  ,["solutions v_v'i'"])],
  31.506 -        e_rls, SOME "solve (e_e::bool, v_v)", [["Test","norm_univar_equation"]])),
  31.507 -    (Specify.prep_pbt thy "pbl_test_uni_roottest" [] e_pblID
  31.508 +        Celem.e_rls, SOME "solve (e_e::bool, v_v)", [["Test","norm_univar_equation"]])),
  31.509 +    (Specify.prep_pbt thy "pbl_test_uni_roottest" [] Celem.e_pblID
  31.510        (["sqroot-test","univariate","equation","test"],
  31.511          [("#Given" ,["equality e_e","solveFor v_v"]),
  31.512            ("#Where" ,["precond_rootpbl v_v"]),
  31.513            ("#Find"  ,["solutions v_v'i'"])],
  31.514 -        e_rls, SOME "solve (e_e::bool, v_v)", [])),
  31.515 -    (Specify.prep_pbt thy "pbl_test_intsimp" [] e_pblID
  31.516 +        Celem.e_rls, SOME "solve (e_e::bool, v_v)", [])),
  31.517 +    (Specify.prep_pbt thy "pbl_test_intsimp" [] Celem.e_pblID
  31.518        (["inttype","test"],
  31.519          [("#Given" ,["intTestGiven t_t"]),
  31.520            ("#Where" ,[]),
  31.521            ("#Find"  ,["intTestFind s_s"])],
  31.522 -      e_rls, NONE, [["Test","intsimp"]]))] *}
  31.523 +      Celem.e_rls, NONE, [["Test","intsimp"]]))] *}
  31.524  (*
  31.525  show_ptyps();
  31.526  get_pbt ["inttype","test"];
  31.527  *)
  31.528  
  31.529  setup {* KEStore_Elems.add_mets
  31.530 -  [Specify.prep_met thy  "met_test_sqrt" [] e_metID
  31.531 +  [Specify.prep_met thy  "met_test_sqrt" [] Celem.e_metID
  31.532        (*root-equation, version for tests before 8.01.01*)
  31.533 -      (["Test","sqrt-equ-test"]:metID,
  31.534 +      (["Test","sqrt-equ-test"],
  31.535          [("#Given" ,["equality e_e","solveFor v_v"]),
  31.536            ("#Where" ,["contains_root (e_e::bool)"]),
  31.537            ("#Find"  ,["solutions v_v'i'"])],
  31.538 -        {rew_ord'="e_rew_ord",rls'=tval_rls,
  31.539 -          srls = append_rls "srls_contains_root" e_rls
  31.540 -              [Calc ("Test.contains'_root",eval_contains_root "")],
  31.541 -          prls = append_rls "prls_contains_root" e_rls 
  31.542 -              [Calc ("Test.contains'_root",eval_contains_root "")],
  31.543 -          calc=[], crls=tval_rls, errpats = [], nrls = e_rls (*,asm_rls=[],
  31.544 +        {rew_ord'="xxxe_rew_ordxxx",rls'=tval_rls,
  31.545 +          srls = Celem.append_rls "srls_contains_root" Celem.e_rls
  31.546 +              [Celem.Calc ("Test.contains'_root",eval_contains_root "")],
  31.547 +          prls = Celem.append_rls "prls_contains_root" Celem.e_rls 
  31.548 +              [Celem.Calc ("Test.contains'_root",eval_contains_root "")],
  31.549 +          calc=[], crls=tval_rls, errpats = [], nrls = Celem.e_rls (*,asm_rls=[],
  31.550            asm_thm=[("square_equation_left",""), ("square_equation_right","")]*)},
  31.551          "Script Solve_root_equation (e_e::bool) (v_v::real) =  " ^
  31.552            "(let e_e = " ^
  31.553 @@ -820,15 +820,15 @@
  31.554            "    (Try (Rewrite_Set Test_simplify False)))" ^
  31.555            "   e_e" ^
  31.556            " in [e_e::bool])"),
  31.557 -    Specify.prep_met thy  "met_test_sqrt2" [] e_metID
  31.558 +    Specify.prep_met thy  "met_test_sqrt2" [] Celem.e_metID
  31.559        (*root-equation ... for test-*.sml until 8.01*)
  31.560 -      (["Test","squ-equ-test2"]:metID,
  31.561 +      (["Test","squ-equ-test2"],
  31.562          [("#Given" ,["equality e_e","solveFor v_v"]),
  31.563            ("#Find"  ,["solutions v_v'i'"])],
  31.564 -        {rew_ord'="e_rew_ord",rls'=tval_rls,
  31.565 -          srls = append_rls "srls_contains_root" e_rls 
  31.566 -              [Calc ("Test.contains'_root",eval_contains_root"")],
  31.567 -          prls=e_rls,calc=[], crls=tval_rls, errpats = [], nrls = e_rls(*,asm_rls=[],
  31.568 +        {rew_ord'="xxxe_rew_ordxxx",rls'=tval_rls,
  31.569 +          srls = Celem.append_rls "srls_contains_root" Celem.e_rls 
  31.570 +              [Celem.Calc ("Test.contains'_root",eval_contains_root"")],
  31.571 +          prls=Celem.e_rls,calc=[], crls=tval_rls, errpats = [], nrls = Celem.e_rls(*,asm_rls=[],
  31.572            asm_thm=[("square_equation_left",""), ("square_equation_right","")]*)},
  31.573          "Script Solve_root_equation (e_e::bool) (v_v::real) =  " ^
  31.574            "(let e_e = " ^
  31.575 @@ -846,15 +846,15 @@
  31.576            "  (L_L::bool list) = Tac subproblem_equation_dummy;          " ^
  31.577            "  L_L = Tac solve_equation_dummy                             " ^
  31.578            "  in Check_elementwise L_L {(v_v::real). Assumptions})"),
  31.579 -    Specify.prep_met thy "met_test_squ_sub" [] e_metID
  31.580 +    Specify.prep_met thy "met_test_squ_sub" [] Celem.e_metID
  31.581        (*tests subproblem fixed linear*)
  31.582 -      (["Test","squ-equ-test-subpbl1"]:metID,
  31.583 +      (["Test","squ-equ-test-subpbl1"],
  31.584          [("#Given" ,["equality e_e","solveFor v_v"]),
  31.585            ("#Where" ,["precond_rootmet v_v"]),
  31.586            ("#Find"  ,["solutions v_v'i'"])],
  31.587 -        {rew_ord' = "e_rew_ord", rls' = tval_rls, srls = e_rls,
  31.588 -          prls = append_rls "prls_met_test_squ_sub" e_rls
  31.589 -              [Calc ("Test.precond'_rootmet", eval_precond_rootmet "")],
  31.590 +        {rew_ord' = "xxxe_rew_ordxxx", rls' = tval_rls, srls = Celem.e_rls,
  31.591 +          prls = Celem.append_rls "prls_met_test_squ_sub" Celem.e_rls
  31.592 +              [Celem.Calc ("Test.precond'_rootmet", eval_precond_rootmet "")],
  31.593            calc=[], crls=tval_rls, errpats = [], nrls = Test_simplify},
  31.594          "Script Solve_root_equation (e_e::bool) (v_v::real) =       " ^
  31.595          " (let e_e = ((Try (Rewrite_Set norm_equation False)) @@    " ^
  31.596 @@ -865,28 +865,28 @@
  31.597          "                         [Test,solve_linear])              " ^
  31.598          "                        [BOOL e_e, REAL v_v])              " ^
  31.599          "  in Check_elementwise L_L {(v_v::real). Assumptions})     "),
  31.600 -    Specify.prep_met thy "met_test_squ_sub2" [] e_metID
  31.601 +    Specify.prep_met thy "met_test_squ_sub2" [] Celem.e_metID
  31.602        (*tests subproblem fixed degree 2*)
  31.603 -      (["Test","squ-equ-test-subpbl2"]:metID,
  31.604 +      (["Test","squ-equ-test-subpbl2"],
  31.605          [("#Given" ,["equality e_e","solveFor v_v"]),
  31.606            ("#Find"  ,["solutions v_v'i'"])],
  31.607 -        {rew_ord'="e_rew_ord",rls'=tval_rls,srls=e_rls,prls=e_rls,calc=[], crls=tval_rls,
  31.608 -          errpats = [], nrls = e_rls (*, asm_rls=[],asm_thm=[("square_equation_left",""),
  31.609 +        {rew_ord'="xxxe_rew_ordxxx",rls'=tval_rls,srls=Celem.e_rls,prls=Celem.e_rls,calc=[], crls=tval_rls,
  31.610 +          errpats = [], nrls = Celem.e_rls (*, asm_rls=[],asm_thm=[("square_equation_left",""),
  31.611            ("square_equation_right","")]*)},
  31.612          "Script Solve_root_equation (e_e::bool) (v_v::real) =  " ^
  31.613          " (let e_e = Try (Rewrite_Set norm_equation False) e_e;              " ^
  31.614          "(L_L::bool list) = (SubProblem (Test',[LINEAR,univariate,equation,test]," ^
  31.615          "                    [Test,solve_by_pq_formula]) [BOOL e_e, REAL v_v])" ^
  31.616          "in Check_elementwise L_L {(v_v::real). Assumptions})"),
  31.617 -    Specify.prep_met thy "met_test_squ_nonterm" [] e_metID
  31.618 +    Specify.prep_met thy "met_test_squ_nonterm" [] Celem.e_metID
  31.619        (*root-equation: see foils..., but notTerminating*)
  31.620 -      (["Test","square_equation...notTerminating"]:metID,
  31.621 +      (["Test","square_equation...notTerminating"],
  31.622          [("#Given" ,["equality e_e","solveFor v_v"]),
  31.623            ("#Find"  ,["solutions v_v'i'"])],
  31.624 -        {rew_ord'="e_rew_ord",rls'=tval_rls,
  31.625 -          srls = append_rls "srls_contains_root" e_rls 
  31.626 -              [Calc ("Test.contains'_root",eval_contains_root"")],
  31.627 -          prls=e_rls,calc=[], crls=tval_rls, errpats = [], nrls = e_rls(*,asm_rls=[],
  31.628 +        {rew_ord'="xxxe_rew_ordxxx",rls'=tval_rls,
  31.629 +          srls = Celem.append_rls "srls_contains_root" Celem.e_rls 
  31.630 +              [Celem.Calc ("Test.contains'_root",eval_contains_root"")],
  31.631 +          prls=Celem.e_rls,calc=[], crls=tval_rls, errpats = [], nrls = Celem.e_rls(*,asm_rls=[],
  31.632            asm_thm=[("square_equation_left",""), ("square_equation_right","")]*)},
  31.633          "Script Solve_root_equation (e_e::bool) (v_v::real) =  " ^
  31.634            "(let e_e = " ^
  31.635 @@ -903,15 +903,15 @@
  31.636            "    (SubProblem (Test',[LINEAR,univariate,equation,test]," ^
  31.637            "                 [Test,solve_linear]) [BOOL e_e, REAL v_v])" ^
  31.638            "in Check_elementwise L_L {(v_v::real). Assumptions})"),
  31.639 -    Specify.prep_met thy  "met_test_eq1" [] e_metID
  31.640 +    Specify.prep_met thy  "met_test_eq1" [] Celem.e_metID
  31.641        (*root-equation1:*)
  31.642 -      (["Test","square_equation1"]:metID,
  31.643 +      (["Test","square_equation1"],
  31.644          [("#Given" ,["equality e_e","solveFor v_v"]),
  31.645            ("#Find"  ,["solutions v_v'i'"])],
  31.646 -        {rew_ord'="e_rew_ord",rls'=tval_rls,
  31.647 -          srls = append_rls "srls_contains_root" e_rls 
  31.648 -            [Calc ("Test.contains'_root",eval_contains_root"")], prls=e_rls, calc=[], crls=tval_rls,
  31.649 -              errpats = [], nrls = e_rls(*,asm_rls=[], asm_thm=[("square_equation_left",""),
  31.650 +        {rew_ord'="xxxe_rew_ordxxx",rls'=tval_rls,
  31.651 +          srls = Celem.append_rls "srls_contains_root" Celem.e_rls 
  31.652 +            [Celem.Calc ("Test.contains'_root",eval_contains_root"")], prls=Celem.e_rls, calc=[], crls=tval_rls,
  31.653 +              errpats = [], nrls = Celem.e_rls(*,asm_rls=[], asm_thm=[("square_equation_left",""),
  31.654                ("square_equation_right","")]*)},
  31.655          "Script Solve_root_equation (e_e::bool) (v_v::real) =  " ^
  31.656            "(let e_e = " ^
  31.657 @@ -927,15 +927,15 @@
  31.658            "  (L_L::bool list) = (SubProblem (Test',[LINEAR,univariate,equation,test]," ^
  31.659            "                    [Test,solve_linear]) [BOOL e_e, REAL v_v])" ^
  31.660            "  in Check_elementwise L_L {(v_v::real). Assumptions})"),
  31.661 -    Specify.prep_met thy "met_test_squ2" [] e_metID
  31.662 +    Specify.prep_met thy "met_test_squ2" [] Celem.e_metID
  31.663        (*root-equation2*)
  31.664 -        (["Test","square_equation2"]:metID,
  31.665 +        (["Test","square_equation2"],
  31.666            [("#Given" ,["equality e_e","solveFor v_v"]),
  31.667            ("#Find"  ,["solutions v_v'i'"])],
  31.668 -        {rew_ord'="e_rew_ord",rls'=tval_rls,
  31.669 -          srls = append_rls "srls_contains_root" e_rls 
  31.670 -              [Calc ("Test.contains'_root",eval_contains_root"")],
  31.671 -          prls=e_rls,calc=[], crls=tval_rls, errpats = [], nrls = e_rls(*,asm_rls=[],
  31.672 +        {rew_ord'="xxxe_rew_ordxxx",rls'=tval_rls,
  31.673 +          srls = Celem.append_rls "srls_contains_root" Celem.e_rls 
  31.674 +              [Celem.Calc ("Test.contains'_root",eval_contains_root"")],
  31.675 +          prls=Celem.e_rls,calc=[], crls=tval_rls, errpats = [], nrls = Celem.e_rls(*,asm_rls=[],
  31.676            asm_thm=[("square_equation_left",""), ("square_equation_right","")]*)},
  31.677          "Script Solve_root_equation (e_e::bool) (v_v::real)  =  " ^
  31.678          "(let e_e = " ^
  31.679 @@ -952,15 +952,15 @@
  31.680          "  (L_L::bool list) = (SubProblem (Test',[plain_square,univariate,equation,test]," ^
  31.681          "                    [Test,solve_plain_square]) [BOOL e_e, REAL v_v])" ^
  31.682          "  in Check_elementwise L_L {(v_v::real). Assumptions})"),
  31.683 -    Specify.prep_met thy "met_test_squeq" [] e_metID
  31.684 +    Specify.prep_met thy "met_test_squeq" [] Celem.e_metID
  31.685        (*root-equation*)
  31.686 -      (["Test","square_equation"]:metID,
  31.687 +      (["Test","square_equation"],
  31.688          [("#Given" ,["equality e_e","solveFor v_v"]),
  31.689            ("#Find"  ,["solutions v_v'i'"])],
  31.690 -        {rew_ord'="e_rew_ord",rls'=tval_rls,
  31.691 -          srls = append_rls "srls_contains_root" e_rls 
  31.692 -              [Calc ("Test.contains'_root",eval_contains_root"")],
  31.693 -          prls=e_rls,calc=[], crls=tval_rls, errpats = [], nrls = e_rls (*,asm_rls=[],
  31.694 +        {rew_ord'="xxxe_rew_ordxxx",rls'=tval_rls,
  31.695 +          srls = Celem.append_rls "srls_contains_root" Celem.e_rls 
  31.696 +              [Celem.Calc ("Test.contains'_root",eval_contains_root"")],
  31.697 +          prls=Celem.e_rls,calc=[], crls=tval_rls, errpats = [], nrls = Celem.e_rls (*,asm_rls=[],
  31.698            asm_thm=[("square_equation_left",""), ("square_equation_right","")]*)},
  31.699          "Script Solve_root_equation (e_e::bool) (v_v::real) =  " ^
  31.700            "(let e_e = " ^
  31.701 @@ -977,17 +977,17 @@
  31.702            "  (L_L::bool list) = (SubProblem (Test',[univariate,equation,test]," ^
  31.703            "                    [no_met]) [BOOL e_e, REAL v_v])" ^
  31.704            "  in Check_elementwise L_L {(v_v::real). Assumptions})"),
  31.705 -    Specify.prep_met thy "met_test_eq_plain" [] e_metID
  31.706 +    Specify.prep_met thy "met_test_eq_plain" [] Celem.e_metID
  31.707        (*solve_plain_square*)
  31.708 -      (["Test","solve_plain_square"]:metID,
  31.709 +      (["Test","solve_plain_square"],
  31.710          [("#Given",["equality e_e","solveFor v_v"]),
  31.711            ("#Where" ,["(matches (?a + ?b*v_v ^^^2 = 0) e_e) |" ^
  31.712                "(matches (     ?b*v_v ^^^2 = 0) e_e) |" ^
  31.713                "(matches (?a +    v_v ^^^2 = 0) e_e) |" ^
  31.714                "(matches (        v_v ^^^2 = 0) e_e)"]), 
  31.715            ("#Find"  ,["solutions v_v'i'"])],
  31.716 -        {rew_ord'="e_rew_ord",rls'=tval_rls,calc=[],srls=e_rls,
  31.717 -          prls = assoc_rls' @{theory} "matches", crls=tval_rls, errpats = [], nrls = e_rls(*,
  31.718 +        {rew_ord'="xxxe_rew_ordxxx",rls'=tval_rls,calc=[],srls=Celem.e_rls,
  31.719 +          prls = assoc_rls' @{theory} "matches", crls=tval_rls, errpats = [], nrls = Celem.e_rls(*,
  31.720            asm_rls=[],asm_thm=[]*)},
  31.721          "Script Solve_plain_square (e_e::bool) (v_v::real) =           " ^
  31.722            " (let e_e = ((Try (Rewrite_Set isolate_bdv False)) @@         " ^
  31.723 @@ -996,25 +996,25 @@
  31.724            "             (Rewrite square_equality True)) @@            " ^
  31.725            "            (Try (Rewrite_Set tval_rls False))) e_e             " ^
  31.726            "  in ((Or_to_List e_e)::bool list))"),
  31.727 -    Specify.prep_met thy "met_test_norm_univ" [] e_metID
  31.728 -      (["Test","norm_univar_equation"]:metID,
  31.729 +    Specify.prep_met thy "met_test_norm_univ" [] Celem.e_metID
  31.730 +      (["Test","norm_univar_equation"],
  31.731          [("#Given",["equality e_e","solveFor v_v"]),
  31.732            ("#Where" ,[]), 
  31.733            ("#Find"  ,["solutions v_v'i'"])],
  31.734 -        {rew_ord'="e_rew_ord",rls'=tval_rls,srls = e_rls,prls=e_rls, calc=[], crls=tval_rls,
  31.735 -          errpats = [], nrls = e_rls},
  31.736 +        {rew_ord'="xxxe_rew_ordxxx",rls'=tval_rls,srls = Celem.e_rls,prls=Celem.e_rls, calc=[], crls=tval_rls,
  31.737 +          errpats = [], nrls = Celem.e_rls},
  31.738          "Script Norm_univar_equation (e_e::bool) (v_v::real) =      " ^
  31.739            " (let e_e = ((Try (Rewrite rnorm_equation_add False)) @@   " ^
  31.740            "            (Try (Rewrite_Set Test_simplify False))) e_e   " ^
  31.741            "  in (SubProblem (Test',[univariate,equation,test],         " ^
  31.742            "                    [no_met]) [BOOL e_e, REAL v_v]))"),
  31.743      (*17.9.02 aus SqRoot.ML------------------------------^^^---*)  
  31.744 -    Specify.prep_met thy "met_test_intsimp" [] e_metID
  31.745 -      (["Test","intsimp"]:metID,
  31.746 +    Specify.prep_met thy "met_test_intsimp" [] Celem.e_metID
  31.747 +      (["Test","intsimp"],
  31.748          [("#Given" ,["intTestGiven t_t"]),
  31.749            ("#Where" ,[]),
  31.750            ("#Find"  ,["intTestFind s_s"])],
  31.751 -        {rew_ord' = "e_rew_ord", rls' = tval_rls, srls = e_rls,  prls = e_rls, calc = [],
  31.752 +        {rew_ord' = "xxxe_rew_ordxxx", rls' = tval_rls, srls = Celem.e_rls,  prls = Celem.e_rls, calc = [],
  31.753            crls = tval_rls, errpats = [], nrls = Test_simplify},
  31.754          "Script STest_simplify (t_t::int) =                  " ^
  31.755            "(Repeat                                                          " ^
  31.756 @@ -1061,10 +1061,10 @@
  31.757    | term_ord' pr thy (t, u) =
  31.758      (if pr then 
  31.759  	 let val (f, ts) = strip_comb t and (g, us) = strip_comb u;
  31.760 -	     val _ = tracing ("t= f@ts= \"" ^ term2str f ^ "\" @ \"[" ^
  31.761 -	                      commas(map term2str ts) ^ "]\"")
  31.762 -	     val _ = tracing ("u= g@us= \"" ^ term2str g ^"\" @ \"[" ^
  31.763 -	                      commas(map term2str us) ^"]\"")
  31.764 +	     val _ = tracing ("t= f@ts= \"" ^ Celem.term2str f ^ "\" @ \"[" ^
  31.765 +	                      commas(map Celem.term2str ts) ^ "]\"")
  31.766 +	     val _ = tracing ("u= g@us= \"" ^ Celem.term2str g ^"\" @ \"[" ^
  31.767 +	                      commas(map Celem.term2str us) ^"]\"")
  31.768  	     val _ = tracing ("size_of_term(t,u)= (" ^
  31.769  	                      string_of_int (size_of_term' t) ^ ", " ^
  31.770  	                      string_of_int (size_of_term' u) ^ ")")
  31.771 @@ -1084,17 +1084,17 @@
  31.772  and hd_ord (f, g) =                                        (* ~ term.ML *)
  31.773    prod_ord (prod_ord Term_Ord.indexname_ord Term_Ord.typ_ord) int_ord (dest_hd' f, dest_hd' g)
  31.774  and terms_ord str pr (ts, us) = 
  31.775 -    list_ord (term_ord' pr (assoc_thy "Isac"))(ts, us);
  31.776 +    list_ord (term_ord' pr (Celem.assoc_thy "Isac"))(ts, us);
  31.777  in
  31.778  
  31.779 -fun ord_make_polytest (pr:bool) thy (_:subst) tu = 
  31.780 +fun ord_make_polytest (pr:bool) thy (_: Celem.subst) tu = 
  31.781      (term_ord' pr thy(***) tu = LESS );
  31.782  
  31.783  end;(*local*)
  31.784  *}
  31.785  ML {*
  31.786  
  31.787 -rew_ord' := overwritel (!rew_ord',
  31.788 +Celem.rew_ord' := overwritel (! Celem.rew_ord',
  31.789  [("termlessI", termlessI),
  31.790   ("ord_make_polytest", ord_make_polytest false thy)
  31.791   ]);
  31.792 @@ -1139,72 +1139,72 @@
  31.793  -----------------------------------------------------*)
  31.794  
  31.795  val make_polytest =
  31.796 -  Rls{id = "make_polytest", preconds = []:term list, 
  31.797 +  Celem.Rls{id = "make_polytest", preconds = []:term list, 
  31.798        rew_ord = ("ord_make_polytest", ord_make_polytest false @{theory "Poly"}),
  31.799 -      erls = testerls, srls = Erls,
  31.800 +      erls = testerls, srls = Celem.Erls,
  31.801        calc = [("PLUS"  , ("Groups.plus_class.plus", eval_binop "#add_")), 
  31.802  	      ("TIMES" , ("Groups.times_class.times", eval_binop "#mult_")),
  31.803  	      ("POWER", ("Atools.pow", eval_binop "#power_"))
  31.804  	      ], errpatts = [],
  31.805 -      rules = [Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}),
  31.806 +      rules = [Celem.Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}),
  31.807  	       (*"a - b = a + (-1) * b"*)
  31.808 -	       Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),
  31.809 +	       Celem.Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),
  31.810  	       (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  31.811 -	       Thm ("distrib_left",TermC.num_str @{thm distrib_left}),
  31.812 +	       Celem.Thm ("distrib_left",TermC.num_str @{thm distrib_left}),
  31.813  	       (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  31.814 -	       Thm ("left_diff_distrib" ,TermC.num_str @{thm left_diff_distrib}),
  31.815 +	       Celem.Thm ("left_diff_distrib" ,TermC.num_str @{thm left_diff_distrib}),
  31.816  	       (*"(z1.0 - z2.0) * w = z1.0 * w - z2.0 * w"*)
  31.817 -	       Thm ("right_diff_distrib",TermC.num_str @{thm right_diff_distrib}),
  31.818 +	       Celem.Thm ("right_diff_distrib",TermC.num_str @{thm right_diff_distrib}),
  31.819  	       (*"w * (z1.0 - z2.0) = w * z1.0 - w * z2.0"*)
  31.820 -	       Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),                 
  31.821 +	       Celem.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),                 
  31.822  	       (*"1 * z = z"*)
  31.823 -	       Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),        
  31.824 +	       Celem.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),        
  31.825  	       (*"0 * z = 0"*)
  31.826 -	       Thm ("add_0_left",TermC.num_str @{thm add_0_left}),
  31.827 +	       Celem.Thm ("add_0_left",TermC.num_str @{thm add_0_left}),
  31.828  	       (*"0 + z = z"*)
  31.829  
  31.830  	       (*AC-rewriting*)
  31.831 -	       Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
  31.832 +	       Celem.Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
  31.833  	       (* z * w = w * z *)
  31.834 -	       Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
  31.835 +	       Celem.Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
  31.836  	       (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*)
  31.837 -	       Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),		
  31.838 +	       Celem.Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),		
  31.839  	       (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*)
  31.840 -	       Thm ("add_commute",TermC.num_str @{thm add.commute}),	
  31.841 +	       Celem.Thm ("add_commute",TermC.num_str @{thm add.commute}),	
  31.842  	       (*z + w = w + z*)
  31.843 -	       Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}),
  31.844 +	       Celem.Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}),
  31.845  	       (*x + (y + z) = y + (x + z)*)
  31.846 -	       Thm ("add_assoc",TermC.num_str @{thm add.assoc}),	               
  31.847 +	       Celem.Thm ("add_assoc",TermC.num_str @{thm add.assoc}),	               
  31.848  	       (*z1.0 + z2.0 + z3.0 = z1.0 + (z2.0 + z3.0)*)
  31.849  
  31.850 -	       Thm ("sym_realpow_twoI",
  31.851 +	       Celem.Thm ("sym_realpow_twoI",
  31.852                       TermC.num_str (@{thm realpow_twoI} RS @{thm sym})),	
  31.853  	       (*"r1 * r1 = r1 ^^^ 2"*)
  31.854 -	       Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),		
  31.855 +	       Celem.Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),		
  31.856  	       (*"r * r ^^^ n = r ^^^ (n + 1)"*)
  31.857 -	       Thm ("sym_real_mult_2",
  31.858 +	       Celem.Thm ("sym_real_mult_2",
  31.859                       TermC.num_str (@{thm real_mult_2} RS @{thm sym})),	
  31.860  	       (*"z1 + z1 = 2 * z1"*)
  31.861 -	       Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),	
  31.862 +	       Celem.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),	
  31.863  	       (*"z1 + (z1 + k) = 2 * z1 + k"*)
  31.864  
  31.865 -	       Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  31.866 +	       Celem.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  31.867  	       (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
  31.868 -	       Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),
  31.869 +	       Celem.Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),
  31.870  	       (*"[| l is_const; m is_const |] ==>  
  31.871  				l * n + (m * n + k) =  (l + m) * n + k"*)
  31.872 -	       Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),	
  31.873 +	       Celem.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),	
  31.874  	       (*"m is_const ==> n + m * n = (1 + m) * n"*)
  31.875 -	       Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), 
  31.876 +	       Celem.Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), 
  31.877  	       (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  31.878  
  31.879 -	       Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  31.880 -	       Calc ("Groups.times_class.times", eval_binop "#mult_"),
  31.881 -	       Calc ("Atools.pow", eval_binop "#power_")
  31.882 +	       Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  31.883 +	       Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
  31.884 +	       Celem.Calc ("Atools.pow", eval_binop "#power_")
  31.885  	       ],
  31.886 -      scr = EmptyScr(*Prog ((Thm.term_of o the o (parse thy)) 
  31.887 +      scr = Celem.EmptyScr(*Celem.Prog ((Thm.term_of o the o (parse thy)) 
  31.888        scr_make_polytest)*)
  31.889 -      }:rls; 
  31.890 +      }; 
  31.891  *}
  31.892  ML {*     
  31.893  (*WN060510 this was done before 'fun prep_rls ...------------------------
  31.894 @@ -1244,100 +1244,100 @@
  31.895  --------------------------------------------------------------------------*)
  31.896  
  31.897  val expand_binomtest =
  31.898 -  Rls{id = "expand_binomtest", preconds = [], 
  31.899 +  Celem.Rls{id = "expand_binomtest", preconds = [], 
  31.900        rew_ord = ("termlessI",termlessI),
  31.901 -      erls = testerls, srls = Erls,
  31.902 +      erls = testerls, srls = Celem.Erls,
  31.903        calc = [("PLUS"  , ("Groups.plus_class.plus", eval_binop "#add_")), 
  31.904  	      ("TIMES" , ("Groups.times_class.times", eval_binop "#mult_")),
  31.905  	      ("POWER", ("Atools.pow", eval_binop "#power_"))
  31.906  	      ], errpatts = [],
  31.907        rules = 
  31.908 -      [Thm ("real_plus_binom_pow2"  ,TermC.num_str @{thm real_plus_binom_pow2}),     
  31.909 +      [Celem.Thm ("real_plus_binom_pow2"  ,TermC.num_str @{thm real_plus_binom_pow2}),     
  31.910  	       (*"(a + b) ^^^ 2 = a ^^^ 2 + 2 * a * b + b ^^^ 2"*)
  31.911 -       Thm ("real_plus_binom_times" ,TermC.num_str @{thm real_plus_binom_times}),    
  31.912 +       Celem.Thm ("real_plus_binom_times" ,TermC.num_str @{thm real_plus_binom_times}),    
  31.913  	      (*"(a + b)*(a + b) = ...*)
  31.914 -       Thm ("real_minus_binom_pow2" ,TermC.num_str @{thm real_minus_binom_pow2}),   
  31.915 +       Celem.Thm ("real_minus_binom_pow2" ,TermC.num_str @{thm real_minus_binom_pow2}),   
  31.916         (*"(a - b) ^^^ 2 = a ^^^ 2 - 2 * a * b + b ^^^ 2"*)
  31.917 -       Thm ("real_minus_binom_times",TermC.num_str @{thm real_minus_binom_times}),   
  31.918 +       Celem.Thm ("real_minus_binom_times",TermC.num_str @{thm real_minus_binom_times}),   
  31.919         (*"(a - b)*(a - b) = ...*)
  31.920 -       Thm ("real_plus_minus_binom1",TermC.num_str @{thm real_plus_minus_binom1}),   
  31.921 +       Celem.Thm ("real_plus_minus_binom1",TermC.num_str @{thm real_plus_minus_binom1}),   
  31.922          (*"(a + b) * (a - b) = a ^^^ 2 - b ^^^ 2"*)
  31.923 -       Thm ("real_plus_minus_binom2",TermC.num_str @{thm real_plus_minus_binom2}),   
  31.924 +       Celem.Thm ("real_plus_minus_binom2",TermC.num_str @{thm real_plus_minus_binom2}),   
  31.925          (*"(a - b) * (a + b) = a ^^^ 2 - b ^^^ 2"*)
  31.926         (*RL 020915*)
  31.927 -       Thm ("real_pp_binom_times",TermC.num_str @{thm real_pp_binom_times}), 
  31.928 +       Celem.Thm ("real_pp_binom_times",TermC.num_str @{thm real_pp_binom_times}), 
  31.929          (*(a + b)*(c + d) = a*c + a*d + b*c + b*d*)
  31.930 -       Thm ("real_pm_binom_times",TermC.num_str @{thm real_pm_binom_times}), 
  31.931 +       Celem.Thm ("real_pm_binom_times",TermC.num_str @{thm real_pm_binom_times}), 
  31.932          (*(a + b)*(c - d) = a*c - a*d + b*c - b*d*)
  31.933 -       Thm ("real_mp_binom_times",TermC.num_str @{thm real_mp_binom_times}), 
  31.934 +       Celem.Thm ("real_mp_binom_times",TermC.num_str @{thm real_mp_binom_times}), 
  31.935          (*(a - b)*(c p d) = a*c + a*d - b*c - b*d*)
  31.936 -       Thm ("real_mm_binom_times",TermC.num_str @{thm real_mm_binom_times}), 
  31.937 +       Celem.Thm ("real_mm_binom_times",TermC.num_str @{thm real_mm_binom_times}), 
  31.938          (*(a - b)*(c p d) = a*c - a*d - b*c + b*d*)
  31.939 -       Thm ("realpow_multI",TermC.num_str @{thm realpow_multI}),                
  31.940 +       Celem.Thm ("realpow_multI",TermC.num_str @{thm realpow_multI}),                
  31.941          (*(a*b)^^^n = a^^^n * b^^^n*)
  31.942 -       Thm ("real_plus_binom_pow3",TermC.num_str @{thm real_plus_binom_pow3}),
  31.943 +       Celem.Thm ("real_plus_binom_pow3",TermC.num_str @{thm real_plus_binom_pow3}),
  31.944          (* (a + b)^^^3 = a^^^3 + 3*a^^^2*b + 3*a*b^^^2 + b^^^3 *)
  31.945 -       Thm ("real_minus_binom_pow3",TermC.num_str @{thm real_minus_binom_pow3}),
  31.946 +       Celem.Thm ("real_minus_binom_pow3",TermC.num_str @{thm real_minus_binom_pow3}),
  31.947          (* (a - b)^^^3 = a^^^3 - 3*a^^^2*b + 3*a*b^^^2 - b^^^3 *)
  31.948  
  31.949  
  31.950 -     (*  Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),	
  31.951 +     (*  Celem.Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),	
  31.952  	 (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  31.953 -	Thm ("distrib_left",TermC.num_str @{thm distrib_left}),	
  31.954 +	Celem.Thm ("distrib_left",TermC.num_str @{thm distrib_left}),	
  31.955  	(*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  31.956 -	Thm ("left_diff_distrib" ,TermC.num_str @{thm left_diff_distrib}),	
  31.957 +	Celem.Thm ("left_diff_distrib" ,TermC.num_str @{thm left_diff_distrib}),	
  31.958  	(*"(z1.0 - z2.0) * w = z1.0 * w - z2.0 * w"*)
  31.959 -	Thm ("right_diff_distrib",TermC.num_str @{thm right_diff_distrib}),	
  31.960 +	Celem.Thm ("right_diff_distrib",TermC.num_str @{thm right_diff_distrib}),	
  31.961  	(*"w * (z1.0 - z2.0) = w * z1.0 - w * z2.0"*)
  31.962  	*)
  31.963  	
  31.964 -	Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),              
  31.965 +	Celem.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),              
  31.966           (*"1 * z = z"*)
  31.967 -	Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),              
  31.968 +	Celem.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),              
  31.969           (*"0 * z = 0"*)
  31.970 -	Thm ("add_0_left",TermC.num_str @{thm add_0_left}),
  31.971 +	Celem.Thm ("add_0_left",TermC.num_str @{thm add_0_left}),
  31.972           (*"0 + z = z"*)
  31.973  
  31.974 -	Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  31.975 -	Calc ("Groups.times_class.times", eval_binop "#mult_"),
  31.976 -	Calc ("Atools.pow", eval_binop "#power_"),
  31.977 +	Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  31.978 +	Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
  31.979 +	Celem.Calc ("Atools.pow", eval_binop "#power_"),
  31.980          (*	       
  31.981 -	 Thm ("mult_commute",TermC.num_str @{thm mult_commute}),		
  31.982 +	 Celem.Thm ("mult_commute",TermC.num_str @{thm mult_commute}),		
  31.983          (*AC-rewriting*)
  31.984 -	Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
  31.985 -	Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),
  31.986 -	Thm ("add_commute",TermC.num_str @{thm add_commute}),	
  31.987 -	Thm ("add_left_commute",TermC.num_str @{thm add_left_commute}),
  31.988 -	Thm ("add_assoc",TermC.num_str @{thm add_assoc}),
  31.989 +	Celem.Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
  31.990 +	Celem.Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),
  31.991 +	Celem.Thm ("add_commute",TermC.num_str @{thm add_commute}),	
  31.992 +	Celem.Thm ("add_left_commute",TermC.num_str @{thm add_left_commute}),
  31.993 +	Celem.Thm ("add_assoc",TermC.num_str @{thm add_assoc}),
  31.994  	*)
  31.995  	
  31.996 -	Thm ("sym_realpow_twoI",
  31.997 +	Celem.Thm ("sym_realpow_twoI",
  31.998                TermC.num_str (@{thm realpow_twoI} RS @{thm sym})),
  31.999  	(*"r1 * r1 = r1 ^^^ 2"*)
 31.1000 -	Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),			
 31.1001 +	Celem.Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),			
 31.1002  	(*"r * r ^^^ n = r ^^^ (n + 1)"*)
 31.1003 -	(*Thm ("sym_real_mult_2",
 31.1004 +	(*Celem.Thm ("sym_real_mult_2",
 31.1005                  TermC.num_str (@{thm real_mult_2} RS @{thm sym})),
 31.1006  	(*"z1 + z1 = 2 * z1"*)*)
 31.1007 -	Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),		
 31.1008 +	Celem.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),		
 31.1009  	(*"z1 + (z1 + k) = 2 * z1 + k"*)
 31.1010  
 31.1011 -	Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
 31.1012 +	Celem.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
 31.1013  	(*"[| l is_const; m is_const |] ==> l * n + m * n = (l + m) * n"*)
 31.1014 -	Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),	
 31.1015 +	Celem.Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),	
 31.1016  	(*"[| l is_const; m is_const |] ==>  l * n + (m * n + k) =  (l + m) * n + k"*)
 31.1017 -	Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),		
 31.1018 +	Celem.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),		
 31.1019  	(*"m is_const ==> n + m * n = (1 + m) * n"*)
 31.1020 -	Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), 
 31.1021 +	Celem.Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), 
 31.1022  	(*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
 31.1023  
 31.1024 -	Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
 31.1025 -	Calc ("Groups.times_class.times", eval_binop "#mult_"),
 31.1026 -	Calc ("Atools.pow", eval_binop "#power_")
 31.1027 +	Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
 31.1028 +	Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
 31.1029 +	Celem.Calc ("Atools.pow", eval_binop "#power_")
 31.1030  	],
 31.1031 -      scr = EmptyScr
 31.1032 +      scr = Celem.EmptyScr
 31.1033  (*Script ((Thm.term_of o the o (parse thy)) scr_expand_binomtest)*)
 31.1034 -      }:rls;      
 31.1035 +      };      
 31.1036  *}
 31.1037  setup {* KEStore_Elems.add_rlss 
 31.1038    [("make_polytest", (Context.theory_name @{theory}, prep_rls' make_polytest)), 
    32.1 --- a/src/Tools/isac/calcelems.sml	Thu Mar 15 10:17:44 2018 +0100
    32.2 +++ b/src/Tools/isac/calcelems.sml	Thu Mar 15 12:42:04 2018 +0100
    32.3 @@ -190,6 +190,10 @@
    32.4      eqtype calcID
    32.5      val thm''_of_thm: thm -> thm''
    32.6      val rew_ord': (rew_ord' * (subst -> term * term -> bool)) list Unsynchronized.ref
    32.7 +    val merge_rls: string -> rls -> rls -> rls
    32.8 +    val e_rrlsstate: rrlsstate
    32.9 +    val thm_of_thm: rule -> thm
   32.10 +    val remove_rls: string -> rls -> rule list -> rls
   32.11  
   32.12  (*---------------------- ^^^ make public on a minimalist way down to Build?Isac -----------------
   32.13      val Html_default: theID -> thydata
   32.14 @@ -205,7 +209,6 @@
   32.15      val e_rew_ord': rew_ord'
   32.16      val e_rew_ord_: subst -> term * term -> bool
   32.17      val e_rfuns: scr
   32.18 -    val e_rrlsstate: rrlsstate
   32.19      val e_scr: scr
   32.20      val e_subst: (term * term) list
   32.21      val e_theID: string list
   32.22 @@ -225,14 +228,12 @@
   32.23      val memrls: rule -> rls -> bool
   32.24      val merge_ids: rls -> rls -> string
   32.25      val merge_ptyps': 'a ptyp list -> 'a ptyp list -> 'a ptyp list
   32.26 -    val merge_rls: string -> rls -> rls -> rls
   32.27      val overwritelthy: theory -> (rls' * (string * rls)) list * (rls' * rls) list -> (rls' * (string * rls)) list
   32.28      val partID: theory -> string
   32.29      val pat2str: pat -> string
   32.30      val pblID2str: string list -> string
   32.31      val pbt2str: pbt -> string
   32.32      val progthys: unit -> theory list
   32.33 -    val remove_rls: string -> rls -> rule list -> rls
   32.34      val rep_rrls:
   32.35         rls -> {attach_form: rule list list -> term -> term -> (rule * (term * term list)) list,
   32.36                 calc: calc list,
   32.37 @@ -255,7 +256,6 @@
   32.38      val theory2str': theory -> string
   32.39      val thm2str: thm -> string
   32.40      eqtype thmDeriv
   32.41 -    val thm_of_thm: rule -> thm
   32.42      val thy2ctxt: theory -> Proof.context
   32.43      val type_to_string': Proof.context -> typ -> string
   32.44      val type_to_string'': thyID -> typ -> string