separate structure TermC : TERMC
authorWalther Neuper <wneuper@ist.tugraz.at>
Fri, 02 Mar 2018 14:19:59 +0100
changeset 59389627d25067f2f
parent 59388 47877d6fa35a
child 59390 f6374c995ac5
separate structure TermC : TERMC
src/Tools/isac/Build_Isac.thy
src/Tools/isac/Interpret/appl.sml
src/Tools/isac/Interpret/calchead.sml
src/Tools/isac/Interpret/generate.sml
src/Tools/isac/Interpret/inform.sml
src/Tools/isac/Interpret/model.sml
src/Tools/isac/Interpret/mstools.sml
src/Tools/isac/Interpret/ptyps.sml
src/Tools/isac/Interpret/rewtools.sml
src/Tools/isac/Interpret/script.sml
src/Tools/isac/Interpret/specification-elems.sml
src/Tools/isac/Knowledge/Atools.thy
src/Tools/isac/Knowledge/Biegelinie.thy
src/Tools/isac/Knowledge/Delete.thy
src/Tools/isac/Knowledge/Diff.thy
src/Tools/isac/Knowledge/DiffApp.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/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.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/ProgLang/ListC.thy
src/Tools/isac/ProgLang/Tools.thy
src/Tools/isac/ProgLang/calculate.sml
src/Tools/isac/ProgLang/rewrite.sml
src/Tools/isac/ProgLang/scrtools.sml
src/Tools/isac/ProgLang/termC.sml
src/Tools/isac/xmlsrc/datatypes.sml
src/Tools/isac/xmlsrc/mathml.sml
src/Tools/isac/xmlsrc/pbl-met-hierarchy.sml
     1.1 --- a/src/Tools/isac/Build_Isac.thy	Sun Feb 25 16:31:17 2018 +0100
     1.2 +++ b/src/Tools/isac/Build_Isac.thy	Fri Mar 02 14:19:59 2018 +0100
     1.3 @@ -84,7 +84,7 @@
     1.4  *} ML {*
     1.5  (*--------------(2): does divide work in Test_simplify ?: ------*)
     1.6   val thy = @{theory Test};
     1.7 - val t = (Thm.term_of o the o (parse thy)) "6 / 2";
     1.8 + val t = (Thm.term_of o the o (TermC.parse thy)) "6 / 2";
     1.9   val rls = Test_simplify;
    1.10  *} ML {*
    1.11   val (t,_) = the (Rewrite.rewrite_set_ thy false rls t);
    1.12 @@ -92,7 +92,7 @@
    1.13  *} ML {*
    1.14  
    1.15  (*--------------(3): is_const works ?: -------------------------------------*)
    1.16 - val t = (Thm.term_of o the o (parse @{theory})) "2 is_const";
    1.17 + val t = (Thm.term_of o the o (TermC.parse @{theory})) "2 is_const";
    1.18  *} ML {*
    1.19   Rewrite.rewrite_set_ @{theory Test} false tval_rls t;
    1.20  
     2.1 --- a/src/Tools/isac/Interpret/appl.sml	Sun Feb 25 16:31:17 2018 +0100
     2.2 +++ b/src/Tools/isac/Interpret/appl.sml	Fri Mar 02 14:19:59 2018 +0100
     2.3 @@ -76,13 +76,13 @@
     2.4  (*for Check_elementwise in applicable_in: [x=1,..] Assumptions -> (x,0<=x&..)*)
     2.5  fun mk_set _(*thy*) _ _ (Const ("List.list.Nil", _)) _ = (e_term, [])
     2.6    | mk_set _ pt p (Const ("Tools.UniversalList", _)) pred =
     2.7 -    (e_term, if pred <> Const ("Script.Assumptions", bool)
     2.8 +    (e_term, if pred <> Const ("Script.Assumptions", TermC.bool)
     2.9  	     then [pred] 
    2.10  	     else get_assumptions_ pt (p, Res))
    2.11    | mk_set _ pt p (Const ("List.list.Cons",_) $ eq $ _) pred =
    2.12      let
    2.13        val (bdv,_) = HOLogic.dest_eq eq;
    2.14 -      val pred = if pred <> Const ("Script.Assumptions",bool)
    2.15 +      val pred = if pred <> Const ("Script.Assumptions", TermC.bool)
    2.16    		  then [pred] 
    2.17    	    else get_assumptions_ pt (p, Res)
    2.18      in (bdv, pred) end
    2.19 @@ -98,13 +98,13 @@
    2.20  		    (asm', true) => ([HOLogic.mk_eq sub], asm')
    2.21  		  | (_, false) => ([],[])
    2.22  	    end;
    2.23 -  	val c' = isalist2list all_results
    2.24 +  	val c' = TermC.isalist2list all_results
    2.25    	val c'' = map (snd o HOLogic.dest_eq) c' (*assumes [x=1,x=2,..]*)
    2.26    	val subs = map (pair bdv) c''
    2.27    in
    2.28      if asm = []
    2.29      then (all_results, [])
    2.30 -    else ((apfst ((list2isalist bool) o flat)) o (apsnd flat) o split_list o (map check)) subs
    2.31 +    else ((apfst ((TermC.list2isalist TermC.bool) o flat)) o (apsnd flat) o split_list o (map check)) subs
    2.32    end;
    2.33  
    2.34  (* for Tac-dummies in root-equ only: skip str until "("*)
    2.35 @@ -238,7 +238,7 @@
    2.36        if member op = [Pbl, Met] p_                  
    2.37        then Chead.Notappl ((Tac.tac2str (Tac.Check_Postcond pI)) ^ " not for pos " ^ pos'2str (p, p_))
    2.38        else Chead.Appl (Tac.Check_Postcond' (pI, (e_term, [(*fun solve assigns returnvalue of scr*)])))
    2.39 -  | applicable_in _ _ (Tac.Take str) = Chead.Appl (Tac.Take' (str2term str)) (* always applicable ?*)
    2.40 +  | applicable_in _ _ (Tac.Take str) = Chead.Appl (Tac.Take' (TermC.str2term str)) (* always applicable ?*)
    2.41    | applicable_in _ _ (Tac.Free_Solve) = Chead.Appl (Tac.Free_Solve')        (* always applicable *)
    2.42    | applicable_in (p, p_) pt (m as Tac.Rewrite_Inst (subs, thm'')) = 
    2.43      if member op = [Pbl, Met] p_ 
    2.44 @@ -411,7 +411,7 @@
    2.45  		      val subst = Selem.sube2subst thy sube
    2.46  		      val ro = assoc_rew_ord rew_ord'
    2.47  		    in
    2.48 -		      if foldl and_ (true, map contains_Var subte)
    2.49 +		      if foldl and_ (true, map TermC.contains_Var subte)
    2.50  		      then (*1*)
    2.51  		        let val f' = subst_atomic subst f
    2.52  		        in if f = f'
    2.53 @@ -486,7 +486,7 @@
    2.54            Frm => (get_obj g_form pt p , [])
    2.55          | Res => get_obj g_result pt p
    2.56          | _ => error ("applicable_in: call by " ^ pos'2str (p, p_));
    2.57 -        val vp = (thy2ctxt thy, pred) |-> parseNEW |> the |> mk_set thy pt p f;
    2.58 +        val vp = (thy2ctxt thy, pred) |-> TermC.parseNEW |> the |> mk_set thy pt p f;
    2.59        in case f of
    2.60          Const ("List.list.Cons",_) $ _ $ _ =>
    2.61            Chead.Appl (Tac.Check_elementwise' (f, pred, check_elementwise thy crls f vp))
    2.62 @@ -524,7 +524,7 @@
    2.63        | _ => error ("applicable_in: call by " ^ pos'2str (p, p_));
    2.64      in case id of
    2.65        "subproblem_equation_dummy" =>
    2.66 -  	  if is_expliceq f
    2.67 +  	  if TermC.is_expliceq f
    2.68    	  then Chead.Appl (Tac.Tac_ (thy, term2str f, id, "subproblem_equation_dummy (" ^ term2str f ^ ")"))
    2.69    	  else Chead.Notappl "applicable only to equations made explicit"
    2.70      | "solve_equation_dummy" =>
    2.71 @@ -532,7 +532,7 @@
    2.72    	  in
    2.73    	    if id' <> "subproblem_equation_dummy"
    2.74    	    then Chead.Notappl "no subproblem"
    2.75 -  	    else if (thy2ctxt thy, f') |-> parseNEW |> the |> is_expliceq
    2.76 +  	    else if (thy2ctxt thy, f') |-> TermC.parseNEW |> the |> TermC.is_expliceq
    2.77    		    then Chead.Appl (Tac.Tac_ (thy, term2str f, id, "[" ^ f' ^ "]"))
    2.78    		    else error ("applicable_in: f= " ^ f')
    2.79        end
     3.1 --- a/src/Tools/isac/Interpret/calchead.sml	Sun Feb 25 16:31:17 2018 +0100
     3.2 +++ b/src/Tools/isac/Interpret/calchead.sml	Fri Mar 02 14:19:59 2018 +0100
     3.3 @@ -396,9 +396,9 @@
     3.4    let
     3.5      val _ = tracing ("RM is_known: t=" ^ term2str t)
     3.6      val ots = (distinct o flat o (map #5)) ori
     3.7 -    val oids = ((map (fst o dest_Free)) o distinct o flat o (map vars)) ots
     3.8 +    val oids = ((map (fst o dest_Free)) o distinct o flat o (map TermC.vars)) ots
     3.9      val (d, ts) = Model.split_dts t
    3.10 -    val ids = map (fst o dest_Free) ((distinct o (flat o (map vars))) ts)
    3.11 +    val ids = map (fst o dest_Free) ((distinct o (flat o (map TermC.vars))) ts)
    3.12    in
    3.13      if (subtract op = oids ids) <> []
    3.14      then (("identifiers "^(strs2str' (subtract op = oids ids)) ^ " not in example"), Model.e_ori, [])
    3.15 @@ -433,7 +433,7 @@
    3.16      let
    3.17        val i = 1 + (if ppc = [] then 0 else map #1 ppc |> maxl)
    3.18        in 
    3.19 -        case parseNEW ctxt ct of
    3.20 +        case TermC.parseNEW ctxt ct of
    3.21            NONE => Add (i, [], false, sel, Model.Syn ct)
    3.22          | SOME t =>
    3.23              let val (d, ts) = Model.split_dts t
    3.24 @@ -460,7 +460,7 @@
    3.25              end
    3.26      end
    3.27    | appl_add ctxt sel oris ppc pbt str =
    3.28 -    case parseNEW ctxt str of
    3.29 +    case TermC.parseNEW ctxt str of
    3.30        NONE => Err ("appl_add: syntax error in '" ^ str ^ "'")
    3.31      | SOME t => 
    3.32          case is_known ctxt sel oris t of
    3.33 @@ -479,7 +479,7 @@
    3.34  	  (tracing ((strs2str o (rev o Symbol.explode)) "is_copy_named_idstr: " ^ str ^ " T"); true)
    3.35    | _ =>
    3.36      (tracing ((strs2str o (rev o Symbol.explode)) "is_copy_named_idstr: " ^ str ^ " F"); false)
    3.37 -fun is_copy_named (_, (_, t)) = (is_copy_named_idstr o free2str) t
    3.38 +fun is_copy_named (_, (_, t)) = (is_copy_named_idstr o TermC.free2str) t
    3.39  
    3.40  (* should this formal argument (of a model-pattern) create a new identifier? *)
    3.41  fun is_copy_named_generating_idstr str =
    3.42 @@ -489,7 +489,7 @@
    3.43  	    "'" :: "'" :: "'" :: _ => false
    3.44      | _ => true
    3.45    else false
    3.46 -fun is_copy_named_generating (_, (_, t)) = (is_copy_named_generating_idstr o free2str) t
    3.47 +fun is_copy_named_generating (_, (_, t)) = (is_copy_named_generating_idstr o TermC.free2str) t
    3.48  
    3.49  (* split type-wrapper from scr-arg and build part of an ori;
    3.50     an type-error is reported immediately, raises an exn, 
    3.51 @@ -503,9 +503,9 @@
    3.52  	        ^ "*** ERROR while creating the items for the model of the ->problem\n"
    3.53  	        ^ "*** from the ->stac with ->typeconstructor in arglist:\n"
    3.54  	        ^ "*** item (->description ->value): " ^ term2str dsc ^ " " ^ term2str var ^ "\n"
    3.55 -	        ^ "*** description: " ^ term_detail2str dsc
    3.56 -	        ^ "*** value: " ^ term_detail2str var
    3.57 -	        ^ "*** typeconstructor in script: " ^ term_detail2str ty
    3.58 +	        ^ "*** description: " ^ TermC.term_detail2str dsc
    3.59 +	        ^ "*** value: " ^ TermC.term_detail2str var
    3.60 +	        ^ "*** typeconstructor in script: " ^ TermC.term_detail2str ty
    3.61  	        ^ "*** checked by theory: " ^ theory2str thy ^ "\n"
    3.62  	        ^ "*** " ^ dots 66);
    3.63            writeln (@{make_string} e);
    3.64 @@ -520,7 +520,7 @@
    3.65      (tracing (dashs 70);
    3.66       error ("actual arg(s) missing for '" ^ pats2str pbt ^ "' i.e. should be 'copy-named' by '*_._'"))
    3.67    | matc thy ((p as (_, (_, t))) :: pbt) (a :: ags) oris =
    3.68 -    (*del?..*)if (is_copy_named_idstr o free2str) t then oris
    3.69 +    (*del?..*)if (is_copy_named_idstr o TermC.free2str) t then oris
    3.70      else(*..del?*)
    3.71        let val opt = mtc thy p a
    3.72        in
    3.73 @@ -537,12 +537,12 @@
    3.74    (if is_copy_named_generating p
    3.75     then (*WN051014 kept strange old code ...*)
    3.76       let fun sel (_,_,d,ts) = Model.comp_ts (d, ts) 
    3.77 -       val cy' = (implode o (drop_last_n 3) o Symbol.explode o free2str) t
    3.78 -       val ext = (last_elem o drop_last o Symbol.explode o free2str) t
    3.79 -       val vars' = map (free2str o snd o snd) pbt (*cpy-nam filtered_out*)
    3.80 +       val cy' = (implode o (drop_last_n 3) o Symbol.explode o TermC.free2str) t
    3.81 +       val ext = (last_elem o drop_last o Symbol.explode o TermC.free2str) t
    3.82 +       val vars' = map (TermC.free2str o snd o snd) pbt (*cpy-nam filtered_out*)
    3.83         val vals = map sel oris
    3.84 -       val cy_ext = (free2str o the) (assoc (vars' ~~ vals, cy')) ^ "_" ^ ext
    3.85 -     in ([1], field, dsc, [mk_free (type_of t) cy_ext]) end
    3.86 +       val cy_ext = (TermC.free2str o the) (assoc (vars' ~~ vals, cy')) ^ "_" ^ ext
    3.87 +     in ([1], field, dsc, [TermC.mk_free (type_of t) cy_ext]) end
    3.88     else ([1], field, dsc, [t])
    3.89  	) handle _ => error ("cpy_nam: for "^(term2str t))
    3.90  
    3.91 @@ -1154,7 +1154,7 @@
    3.92  (* check pbltypes, announces one failure a time *)
    3.93  fun chk_vars ctppc = 
    3.94    let
    3.95 -    val {Given = gi, Where = wh, Find = fi, Relate = re, ...} = Specify.appc flat (Specify.mappc vars ctppc)
    3.96 +    val {Given = gi, Where = wh, Find = fi, Relate = re, ...} = Specify.appc flat (Specify.mappc TermC.vars ctppc)
    3.97      val chked = subtract op = gi wh
    3.98    in
    3.99      if chked <> [] then ("wh\\gi", chked)
   3.100 @@ -1170,7 +1170,7 @@
   3.101  (* check a new pbltype: variables (Free) unbound by given, find*) 
   3.102  fun unbound_ppc ctppc =
   3.103    let
   3.104 -    val {Given = gi, Find = fi, Relate = re, ...} = Specify.appc flat (Specify.mappc vars ctppc)
   3.105 +    val {Given = gi, Find = fi, Relate = re, ...} = Specify.appc flat (Specify.mappc TermC.vars ctppc)
   3.106    in
   3.107      distinct (subtract op = (union op = gi fi) re)
   3.108    end
     4.1 --- a/src/Tools/isac/Interpret/generate.sml	Sun Feb 25 16:31:17 2018 +0100
     4.2 +++ b/src/Tools/isac/Interpret/generate.sml	Fri Mar 02 14:19:59 2018 +0100
     4.3 @@ -350,7 +350,7 @@
     4.4          end
     4.5    | generate1 _ (Tac.Tac_ (_, f, id, f')) l (p, _) pt =
     4.6        let
     4.7 -        val (pt, c) = cappend_atomic pt p l (str2term f) (Tac.Tac id) (str2term f', []) Complete
     4.8 +        val (pt, c) = cappend_atomic pt p l (TermC.str2term f) (Tac.Tac id) (TermC.str2term f', []) Complete
     4.9        in
    4.10          ((p,Res), c, FormKF f', pt)
    4.11        end
     5.1 --- a/src/Tools/isac/Interpret/inform.sml	Sun Feb 25 16:31:17 2018 +0100
     5.2 +++ b/src/Tools/isac/Interpret/inform.sml	Fri Mar 02 14:19:59 2018 +0100
     5.3 @@ -133,11 +133,11 @@
     5.4      in itm end
     5.5      handle _ => (i, v, false, f, Model.Syn (term2str e_term (*t  ..(t) has not been declared*))))
     5.6    | parsitm dI (i, v, b, f, Model.Syn str) =
     5.7 -    (let val _ = (Thm.term_of o the o (parse dI)) str
     5.8 +    (let val _ = (Thm.term_of o the o (TermC.parse dI)) str
     5.9      in (i, v, b ,f, Model.Par str) end
    5.10      handle _ => (i, v, b, f, Model.Syn str))
    5.11    | parsitm dI (i, v, b, f, Model.Typ str) =
    5.12 -    (let val _ = (Thm.term_of o the o (parse dI)) str
    5.13 +    (let val _ = (Thm.term_of o the o (TermC.parse dI)) str
    5.14       in (i, v, b, f, Model.Par str) end
    5.15       handle _ => (i, v, b, f, Model.Syn str))
    5.16    | parsitm dI (itm as (i, v, _, f, Model.Inc ((d, ts), _))) =
    5.17 @@ -183,7 +183,7 @@
    5.18    let 
    5.19       val ctxt = assoc_thy dI |> thy2ctxt;
    5.20    in
    5.21 -    case parseNEW ctxt ct of
    5.22 +    case TermC.parseNEW ctxt ct of
    5.23  	    NONE => (0, [], false, sel, Model.Syn ct)
    5.24  	  | SOME t =>
    5.25  	    (case Chead.is_known ctxt sel oris t of
    5.26 @@ -201,7 +201,7 @@
    5.27  fun eq7 (f, d) (f', (d', _)) = f = f' andalso d = d';
    5.28  fun fstr2itm_ thy pbt (f, str) =
    5.29    let
    5.30 -    val topt = parse thy str
    5.31 +    val topt = TermC.parse thy str
    5.32    in
    5.33      case topt of
    5.34        NONE => ([], false, f, Model.Syn str)
    5.35 @@ -269,7 +269,7 @@
    5.36  		      spec = sspec as (sdI, spI, smI), probl, meth, ...}
    5.37          => (fmz, fmz_, oris, ospec, hdf', sspec, sdI, spI, smI, probl, meth)
    5.38        | _ => error "input_icalhd: uncovered case of get_obj I pt p"
    5.39 -    in if is_casinput hdf fmz then the (cas_input (str2term hdf)) 
    5.40 +    in if is_casinput hdf fmz then the (cas_input (TermC.str2term hdf)) 
    5.41         else        (*hacked WN0602 ~~~            ~~~~~~~~~,   ..dropped !*)
    5.42           let val (pos_, pits, mits) = 
    5.43  	         if dI <> sdI
    5.44 @@ -413,7 +413,7 @@
    5.45  fun check_err_patt (res, inf) (subst: subst) (errpatID: errpatID, pat) rls =
    5.46    let 
    5.47      val (res', _, _, rewritten) =
    5.48 -      Rewrite.rew_sub (Isac()) 1 subst e_rew_ord e_rls false [] (Trueprop $ pat) res;
    5.49 +      Rewrite.rew_sub (Isac()) 1 subst e_rew_ord e_rls false [] (TermC.Trueprop $ pat) res;
    5.50    in
    5.51      if rewritten
    5.52      then 
    5.53 @@ -456,7 +456,7 @@
    5.54     if "no derivation found" then check_error_patterns.
    5.55     ALTERNATIVE: check_error_patterns _within_ compare_step seems too expensive.*)
    5.56  fun inform (cs as (_, _, (pt, pos as (p, _))): Chead.calcstate') istr =
    5.57 -  case parse (assoc_thy "Isac") istr of
    5.58 +  case TermC.parse (assoc_thy "Isac") istr of
    5.59  	  SOME f_in =>
    5.60  	    let
    5.61  	      val f_in = Thm.term_of f_in
    5.62 @@ -499,7 +499,7 @@
    5.63  fun get_fillform (subs_opt, subst) (thm, form) errpatID ((fillpatID, pat, erpaID): fillpat) =
    5.64    let
    5.65      val (form', _, _, rewritten) =
    5.66 -      Rewrite.rew_sub (Isac()) 1 subst e_rew_ord e_rls false [] (Trueprop $ pat) form;
    5.67 +      Rewrite.rew_sub (Isac()) 1 subst e_rew_ord e_rls false [] (TermC.Trueprop $ pat) form;
    5.68    in (*the fillpat of the thm must be dedicated to errpatID*)
    5.69      if errpatID = erpaID andalso rewritten
    5.70      then SOME (fillpatID, HOLogic.mk_eq (form, form'), thm, subs_opt) 
    5.71 @@ -537,7 +537,7 @@
    5.72  (* check if an input formula is exactly equal the rewrite from a rule
    5.73     which is stored at the pos where the input is stored of "ok". *)
    5.74  fun is_exactly_equal (pt, pos as (p, _)) istr =
    5.75 -  case parseNEW (assoc_thy "Isac" |> thy2ctxt) istr of
    5.76 +  case TermC.parseNEW (assoc_thy "Isac" |> thy2ctxt) istr of
    5.77      NONE => ("syntax error in '" ^ istr ^ "'", Tac.Tac "")
    5.78    | SOME ifo => 
    5.79        let
     6.1 --- a/src/Tools/isac/Interpret/model.sml	Sun Feb 25 16:31:17 2018 +0100
     6.2 +++ b/src/Tools/isac/Interpret/model.sml	Fri Mar 02 14:19:59 2018 +0100
     6.3 @@ -109,36 +109,36 @@
     6.4        (b) 
     6.5  ==========================================================================*)
     6.6  
     6.7 -val script_parse = the o (@{theory Script} |> thy2ctxt |> parseNEW);
     6.8 +val script_parse = the o (@{theory Script} |> thy2ctxt |> TermC.parseNEW);
     6.9  val e_listReal = script_parse "[]::(real list)";
    6.10  val e_listBool = script_parse "[]::(bool list)";
    6.11  
    6.12  (* take list-term apart w.r.t. handling elementwise input: @{term "[a, b]"} \<rightarrow> ["[a]","[b]"] *)
    6.13  fun take_apart t =
    6.14 -  let val elems = isalist2list t
    6.15 -  in map ((list2isalist (type_of (hd elems))) o single) elems end;
    6.16 +  let val elems = TermC.isalist2list t
    6.17 +  in map ((TermC.list2isalist (type_of (hd elems))) o single) elems end;
    6.18  fun take_apart_inv ts = (* t = (take_apart_inv o take_apart) t *)
    6.19 -  let val elems = (flat o (map isalist2list)) ts;
    6.20 -  in list2isalist (type_of (hd elems)) elems end;
    6.21 +  let val elems = (flat o (map TermC.isalist2list)) ts;
    6.22 +  in TermC.list2isalist (type_of (hd elems)) elems end;
    6.23  
    6.24  fun is_var (Free _) = true
    6.25    | is_var _ = false;
    6.26  
    6.27  (* this may decompose an object-language isa-list;
    6.28     use only, if description is not available, eg. not input ?WN:14.5.03 ??!?*)
    6.29 -fun dest_list' t = if is_list t then isalist2list t  else [t];
    6.30 +fun dest_list' t = if TermC.is_list t then TermC.isalist2list t  else [t];
    6.31  (* special handling for lists. ?WN:14.5.03 ??!? *)
    6.32  fun dest_list (d, ts) = 
    6.33    let fun dest t = 
    6.34      if LTool.is_list_dsc d andalso not (LTool.is_unl d) andalso not (is_var t) (*..for pbt*)
    6.35 -    then isalist2list t
    6.36 +    then TermC.isalist2list t
    6.37      else [t]
    6.38    in (flat o (map dest)) ts end;
    6.39  
    6.40  (* revert split_dts only for ts; compare comp_dts *)
    6.41  fun comp_ts (d, ts) = 
    6.42    if LTool.is_list_dsc d
    6.43 -  then if is_list (hd ts)
    6.44 +  then if TermC.is_list (hd ts)
    6.45  	  then if LTool.is_unl d
    6.46  	    then (hd ts)             (* e.g. someList [1,3,2] *)
    6.47  	    else (take_apart_inv ts) (* [ [a], [b] ] -> [a,b] *)
    6.48 @@ -169,7 +169,7 @@
    6.49      and the value for the problem-environment; inv to comp_dts   *)
    6.50  fun split_dts (t as d $ arg) =
    6.51      if LTool.is_dsc d
    6.52 -    then if LTool.is_list_dsc d andalso is_list arg andalso LTool.is_unl d |> not
    6.53 +    then if LTool.is_list_dsc d andalso TermC.is_list arg andalso LTool.is_unl d |> not
    6.54        then (d, take_apart arg)
    6.55        else (d, [arg])
    6.56      else (e_term, dest_list' t)
    6.57 @@ -184,7 +184,7 @@
    6.58  fun split_dts' (d, arg) = 
    6.59      if LTool.is_dsc d
    6.60      then if LTool.is_list_dsc d
    6.61 -      then if is_list arg
    6.62 +      then if TermC.is_list arg
    6.63  	      then if LTool.is_unl d
    6.64  	        then ([arg])           (* e.g. someList [1,3,2]                 *)
    6.65  		      else (take_apart arg)  (* [a,b] --> SML[ [a], [b] ]SML          *)
    6.66 @@ -247,7 +247,7 @@
    6.67     make the result of split_* a value of problem-environment *)
    6.68  fun mkval _(*dsc*) [] = error "mkval called with []"
    6.69    | mkval _ [t] = t
    6.70 -  | mkval _ ts = list2isalist ((type_of o hd) ts) ts;
    6.71 +  | mkval _ ts = TermC.list2isalist ((type_of o hd) ts) ts;
    6.72  fun mkval' x = mkval e_term x;
    6.73  
    6.74  (* the internal representation of a models' item
    6.75 @@ -349,7 +349,7 @@
    6.76    >> Formal names should never be hardwired as ML string constants.  Use
    6.77    >> @{type_name nat} above, or better @{typ nat} for the whole type  *)
    6.78  fun pbl_ids ctxt (Const(_, Type ("fun", [_, Type ("Tools.nam", _)]))) v =
    6.79 -    if is_list v 
    6.80 +    if TermC.is_list v 
    6.81      then [v]      (*eg. [r=Arbfix]*)
    6.82      else
    6.83        (case v of  (*eg. eps=#0*) (Const ("HOL.eq", _) $ l $ r) => [r, l]
    6.84 @@ -480,7 +480,7 @@
    6.85    | ts_in _ = error "ts_in: uncovered case in fun.def.";
    6.86  (*WN050629 unused*)
    6.87  fun all_ts_in itm_s = (flat o (map ts_in)) itm_s;
    6.88 -val unique = (Thm.term_of o the o (parse @{theory "Real"} )) "UnIqE_tErM";
    6.89 +val unique = (Thm.term_of o the o (TermC.parse @{theory "Real"} )) "UnIqE_tErM";
    6.90  fun d_in (Cor ((d ,_), _)) = d
    6.91    | d_in (Syn c) = (tracing ("*** d_in: Syn ("^c^")"); unique)
    6.92    | d_in (Typ c) = (tracing ("*** d_in: Typ ("^c^")"); unique)
     7.1 --- a/src/Tools/isac/Interpret/mstools.sml	Sun Feb 25 16:31:17 2018 +0100
     7.2 +++ b/src/Tools/isac/Interpret/mstools.sml	Fri Mar 02 14:19:59 2018 +0100
     7.3 @@ -90,11 +90,11 @@
     7.4    | check_preconds' prls pres pbl _ (* FIXME.WN0308 mvat re-introduce *) =
     7.5      let
     7.6        val env = Model.mk_env pbl;
     7.7 -      val pres' = map (subst_atomic_all env) pres;
     7.8 +      val pres' = map (TermC.subst_atomic_all env) pres;
     7.9      in map (evalprecond prls) pres' end;
    7.10  
    7.11  fun check_preconds _(*thy*) prls pres pbl = check_preconds' prls pres pbl (Model.max_vt pbl);
    7.12 -fun declare_constraints' ts ctxt = fold Variable.declare_constraints (flat (map vars ts)) ctxt;
    7.13 +fun declare_constraints' ts ctxt = fold Variable.declare_constraints (flat (map TermC.vars ts)) ctxt;
    7.14  
    7.15  (*WN110613 fun declare_constraints' shall replace fun declare_constraints*)
    7.16  fun declare_constraints t ctxt =
    7.17 @@ -116,10 +116,10 @@
    7.18     WN110520 redo (1) take declare_constraints (2) with combinators*)
    7.19  fun transfer_asms_from_to from_ctxt to_ctxt =
    7.20    let
    7.21 -    val to_vars = get_assumptions to_ctxt |> map vars |> flat
    7.22 +    val to_vars = get_assumptions to_ctxt |> map TermC.vars |> flat
    7.23      fun transfer [] to_ctxt = to_ctxt
    7.24          | transfer (from_asm :: fas) to_ctxt =
    7.25 -            if inter op = (vars from_asm) to_vars = []
    7.26 +            if inter op = (TermC.vars from_asm) to_vars = []
    7.27              then transfer fas to_ctxt
    7.28              else transfer fas (insert_assumptions [from_asm] to_ctxt)
    7.29    in transfer (get_assumptions from_ctxt) to_ctxt end
     8.1 --- a/src/Tools/isac/Interpret/ptyps.sml	Sun Feb 25 16:31:17 2018 +0100
     8.2 +++ b/src/Tools/isac/Interpret/ptyps.sml	Fri Mar 02 14:19:59 2018 +0100
     8.3 @@ -67,7 +67,7 @@
     8.4  open Model
     8.5  
     8.6  type field = string * (term * term)
     8.7 -val dsc_unknown = (Thm.term_of o the o (parseold @{theory Script})) "unknown::'a => unknow";
     8.8 +val dsc_unknown = (Thm.term_of o the o (TermC.parseold @{theory Script})) "unknown::'a => unknow";
     8.9  
    8.10  fun itm_2item (_: theory) (Model.Cor ((d, ts), _)) = Model.Correct (term2str (Model.comp_dts (d, ts)))
    8.11    | itm_2item _ (Model.Syn c) = Model.SyntaxE c
    8.12 @@ -192,7 +192,7 @@
    8.13    | prep_ori fmz thy pbt =
    8.14      let
    8.15        val ctxt = Proof_Context.init_global thy |> fold Stool.declare_constraints fmz;
    8.16 -      val ori = map (add_field thy pbt o Model.split_dts o the o parseNEW ctxt) fmz |> add_variants;
    8.17 +      val ori = map (add_field thy pbt o Model.split_dts o the o TermC.parseNEW ctxt) fmz |> add_variants;
    8.18        val maxv = map fst ori |> max;
    8.19        val maxv = if maxv = 0 then 1 else maxv;
    8.20        val oris = coll_variants ori
    8.21 @@ -201,8 +201,8 @@
    8.22          |> map flattup;
    8.23      in (oris, ctxt) end;
    8.24  
    8.25 -val e_errpat = ("e_errpatID", [parse_patt @{theory} "?a = ?b"], [@{thm refl}]): errpat
    8.26 -val e_fillpat = ("e_fillpatID", parse_patt @{theory} "?a = _", "e_errpatID")
    8.27 +val e_errpat = ("e_errpatID", [TermC.parse_patt @{theory} "?a = ?b"], [@{thm refl}]): errpat
    8.28 +val e_fillpat = ("e_fillpatID", TermC.parse_patt @{theory} "?a = _", "e_errpatID")
    8.29  
    8.30  (** breadth-first search on hierarchy of problem-types **)
    8.31  
    8.32 @@ -261,7 +261,7 @@
    8.33        val gi = filter (eq "#Given") dsc_dats;
    8.34        val gi = (case gi of
    8.35  		    [] => []
    8.36 -		  | ((_, gi') :: []) => (map (split_did o Thm.term_of o the o (parse thy)) gi'
    8.37 +		  | ((_, gi') :: []) => (map (split_did o Thm.term_of o the o (TermC.parse thy)) gi'
    8.38  		      handle _ => error ("prep_pbt: syntax error in '#Given' of " ^ strs2str pblID))
    8.39  		  | _ => error ("prep_pbt: more than one '#Given' in " ^ strs2str pblID));
    8.40  		  val gi = map (pair "#Given") gi;
    8.41 @@ -269,7 +269,7 @@
    8.42  		  val fi = filter (eq "#Find") dsc_dats;
    8.43  		  val fi = (case fi of
    8.44  		    [] => []
    8.45 -		  | ((_, fi') :: []) => (map (split_did o Thm.term_of o the o (parse thy)) fi'
    8.46 +		  | ((_, fi') :: []) => (map (split_did o Thm.term_of o the o (TermC.parse thy)) fi'
    8.47  		      handle _ => error ("prep_pbt: syntax error in '#Find' of " ^ strs2str pblID))
    8.48  		  | _ => error ("prep_pbt: more than one '#Find' in " ^ strs2str pblID));
    8.49  		  val fi = map (pair "#Find") fi;
    8.50 @@ -277,7 +277,7 @@
    8.51  		  val re = filter (eq "#Relate") dsc_dats;
    8.52  		  val re = (case re of
    8.53  		    [] => []
    8.54 -		  | ((_, re') :: []) => (map (split_did o Thm.term_of o the o (parse thy)) re'
    8.55 +		  | ((_, re') :: []) => (map (split_did o Thm.term_of o the o (TermC.parse thy)) re'
    8.56  		      handle _ => error ("prep_pbt: syntax error in '#Relate' of " ^ strs2str pblID))
    8.57  		  | _ => error ("prep_pbt: more than one '#Relate' in " ^ strs2str pblID));
    8.58  		  val re = map (pair "#Relate") re;
    8.59 @@ -285,14 +285,14 @@
    8.60  		  val wh = filter (eq "#Where") dsc_dats;
    8.61  		  val wh = (case wh of
    8.62  		    [] => []
    8.63 -		  | ((_, wh') :: []) => (map (parse_patt thy) wh'
    8.64 +		  | ((_, wh') :: []) => (map (TermC.parse_patt thy) wh'
    8.65  		      handle _ => error ("prep_pbt: syntax error in '#Where' of " ^ strs2str pblID))
    8.66  		  | _ => error ("prep_pbt: more than one '#Where' in " ^ strs2str pblID));
    8.67      in
    8.68        ({guh = guh, mathauthors = maa, init = init, thy = thy,
    8.69          cas= case ca of
    8.70            NONE => NONE
    8.71 -			  | SOME s => SOME ((Thm.term_of o the o (parse thy)) s),
    8.72 +			  | SOME s => SOME ((Thm.term_of o the o (TermC.parse thy)) s),
    8.73  			  prls = ev, where_ = wh, ppc = gi @ fi @ re, met = metIDs}, pblID): pbt * pblID
    8.74      end;
    8.75  
    8.76 @@ -306,7 +306,7 @@
    8.77        val gi = filter (eq "#Given") ppc;
    8.78        val gi = (case gi of
    8.79  		    [] => (writeln ("prep_met: in " ^ guh ^ " #Given is empty ?!?"); [])
    8.80 -		  | ((_, gi') :: []) => (map (split_did o Thm.term_of o the o (parse thy)) gi'
    8.81 +		  | ((_, gi') :: []) => (map (split_did o Thm.term_of o the o (TermC.parse thy)) gi'
    8.82  		      handle _ => error ("prep_pbt: syntax error in '#Given' of " ^ strs2str metID))
    8.83  		  | _ => error ("prep_pbt: more than one '#Given' in " ^ strs2str metID));
    8.84  		  val gi = map (pair "#Given") gi;
    8.85 @@ -314,7 +314,7 @@
    8.86  		  val fi = filter (eq "#Find") ppc;
    8.87  		  val fi = (case fi of
    8.88  		    [] => (writeln ("prep_met: in " ^ guh ^ " #Find is empty ?!?"); [])
    8.89 -		  | ((_, fi') :: []) =>  (map (split_did o Thm.term_of o the o (parse thy)) fi'
    8.90 +		  | ((_, fi') :: []) =>  (map (split_did o Thm.term_of o the o (TermC.parse thy)) fi'
    8.91  		      handle _ => error ("prep_pbt: syntax error in '#Find' of " ^ strs2str metID))
    8.92  		  | _ => error ("prep_pbt: more than one '#Find' in " ^ strs2str metID));
    8.93  		  val fi = map (pair "#Find") fi;
    8.94 @@ -322,7 +322,7 @@
    8.95  		  val re = filter (eq "#Relate") ppc;
    8.96  		  val re = (case re of
    8.97  		    [] => (writeln ("prep_met: in " ^ guh ^ " #Relate is empty ?!?"); [])
    8.98 -		  | ((_,re') :: []) => (map (split_did o Thm.term_of o the o (parse thy)) re'
    8.99 +		  | ((_,re') :: []) => (map (split_did o Thm.term_of o the o (TermC.parse thy)) re'
   8.100  		      handle _ => error ("prep_pbt: syntax error in '#Relate' of " ^ strs2str metID))
   8.101  		  | _ => error ("prep_pbt: more than one '#Relate' in " ^ strs2str metID));
   8.102  		  val re = map (pair "#Relate") re;
   8.103 @@ -330,10 +330,10 @@
   8.104  		  val wh = filter (eq "#Where") ppc;
   8.105  		  val wh = (case wh of
   8.106  		    [] => (writeln ("prep_met: in " ^ guh ^ " #Where is empty ?!?"); [])
   8.107 -		  | ((_, wh') :: []) => (map (parse_patt thy) wh'
   8.108 +		  | ((_, wh') :: []) => (map (TermC.parse_patt thy) wh'
   8.109  		      handle _ => error ("prep_pbt: syntax error in '#Where' of " ^ strs2str metID))
   8.110  		  | _ => error ("prep_pbt: more than one '#Where' in " ^ strs2str metID));
   8.111 -		  val sc = (((inst_abs thy) o Thm.term_of o the o (parse thy)) scr)
   8.112 +		  val sc = (((TermC.inst_abs thy) o Thm.term_of o the o (TermC.parse thy)) scr)
   8.113  		  val calc = if scr = "empty_script" then [] else LTool.get_calcs thy sc
   8.114      in
   8.115        ({guh = guh, mathauthors = maa, init = init, ppc = gi @ fi @ re, pre = wh, rew_ord' = ro,
     9.1 --- a/src/Tools/isac/Interpret/rewtools.sml	Sun Feb 25 16:31:17 2018 +0100
     9.2 +++ b/src/Tools/isac/Interpret/rewtools.sml	Fri Mar 02 14:19:59 2018 +0100
     9.3 @@ -104,19 +104,19 @@
     9.4      val (deriv,
     9.5        {cert = cert, tags = tags, maxidx = maxidx, shyps = shyps, hyps = hyps, tpairs = tpairs, 
     9.6        prop = prop}) = Thm.rep_thm_G thm
     9.7 -    val (lhs, rhs) = (dest_equals' o strip_trueprop o Logic.strip_imp_concl) prop
     9.8 -    val prop' = case strip_imp_prems' prop of
     9.9 -        NONE => Trueprop $ (mk_equality (rhs, lhs))
    9.10 -      | SOME cs => ins_concl cs (Trueprop $ (mk_equality (rhs, lhs)))
    9.11 +    val (lhs, rhs) = (TermC.dest_equals' o TermC.strip_trueprop o Logic.strip_imp_concl) prop
    9.12 +    val prop' = case TermC.strip_imp_prems' prop of
    9.13 +        NONE => TermC.Trueprop $ (TermC.mk_equality (rhs, lhs))
    9.14 +      | SOME cs => TermC.ins_concl cs (TermC.Trueprop $ (TermC.mk_equality (rhs, lhs)))
    9.15    in Thm.assbl_thm deriv cert tags maxidx shyps hyps tpairs prop' end
    9.16  
    9.17  (* WN100910 weaker than fun sym_thm for Theory.axioms_of in isa02 *)
    9.18  fun sym_trm trm =
    9.19    let
    9.20 -    val (lhs, rhs) = (dest_equals' o strip_trueprop o Logic.strip_imp_concl) trm
    9.21 -    val trm' = case strip_imp_prems' trm of
    9.22 -	      NONE => mk_equality (rhs, lhs)
    9.23 -	    | SOME cs => ins_concl cs (mk_equality (rhs, lhs))
    9.24 +    val (lhs, rhs) = (TermC.dest_equals' o TermC.strip_trueprop o Logic.strip_imp_concl) trm
    9.25 +    val trm' = case TermC.strip_imp_prems' trm of
    9.26 +	      NONE => TermC.mk_equality (rhs, lhs)
    9.27 +	    | SOME cs => TermC.ins_concl cs (TermC.mk_equality (rhs, lhs))
    9.28    in trm' end
    9.29  
    9.30  (* derive normalform of a rls, or derive until SOME goal,
    9.31 @@ -167,7 +167,7 @@
    9.32          | Calc (c as (op_, _)) => 
    9.33            let 
    9.34              val _ = if not (! trace_rewrite) then () else tracing ("### trying calc. \"" ^ op_^"\"")
    9.35 -            val t = uminus_to_string t
    9.36 +            val t = TermC.uminus_to_string t
    9.37            in 
    9.38              case Calc.adhoc_thm thy c t of
    9.39                NONE => rew_once lim rts t apno rs'
    9.40 @@ -377,7 +377,7 @@
    9.41  	     Chead.Appl (Tac.Rewrite_Inst' (thy', ord', erls, _, subst, _, f, (res, asm))) =>
    9.42  	       let
    9.43             val thm_deriv = Thm.get_name_hint thm
    9.44 -           val thminst = inst_bdv subst ((Calc.norm o #prop o Thm.rep_thm) thm)
    9.45 +           val thminst = TermC.inst_bdv subst ((Calc.norm o #prop o Thm.rep_thm) thm)
    9.46  	       in
    9.47  	         ContThmInst
    9.48  	          {thyID = theory'2thyID thy',
    9.49 @@ -394,7 +394,7 @@
    9.50             val pp = Ctree.par_pblobj pt p
    9.51             val thy' = Ctree.get_obj Ctree.g_domID pt pp
    9.52             val subst = Selem.subs2subst (assoc_thy thy') subs
    9.53 -           val thminst = inst_bdv subst ((Calc.norm o #prop o Thm.rep_thm) thm)
    9.54 +           val thminst = TermC.inst_bdv subst ((Calc.norm o #prop o Thm.rep_thm) thm)
    9.55             val f = case p_ of
    9.56                 Ctree.Frm => Ctree.get_obj Ctree.g_form pt p
    9.57               | Ctree.Res => (fst o (Ctree.get_obj Ctree.g_result pt)) p 
    9.58 @@ -584,7 +584,7 @@
    9.59              if LTool.contains_bdv thm
    9.60              then
    9.61                let
    9.62 -                val formal_arg = str2term "v_"
    9.63 +                val formal_arg = TermC.str2term "v_"
    9.64                  val value = subst_atomic env formal_arg
    9.65                in ["(bdv," ^ term2str value ^ ")"] : Selem.subs end
    9.66              else []
    9.67 @@ -596,7 +596,7 @@
    9.68            if LTool.contain_bdv rules
    9.69            then
    9.70              let
    9.71 -              val formal_arg = str2term "v_"
    9.72 +              val formal_arg = TermC.str2term "v_"
    9.73                val value = subst_atomic env formal_arg
    9.74              in ["(bdv," ^ term2str value ^ ")"] : Selem.subs end
    9.75            else []
    9.76 @@ -614,14 +614,14 @@
    9.77        | scan (Var _) = NONE
    9.78        | scan (Bound _) = NONE
    9.79        | scan (t as Const ("List.list.Cons", _) $ (Const ("Product_Type.Pair", _) $ Free _$ _) $ _) =
    9.80 -        if is_bdv_subst t then SOME t else NONE
    9.81 +        if TermC.is_bdv_subst t then SOME t else NONE
    9.82        | scan (Abs (_, _, body)) = scan body
    9.83        | scan (t1 $ t2) = case scan t1 of NONE => scan t2 | SOME subst => SOME subst
    9.84    in
    9.85      case scan prog of
    9.86        NONE => (NONE: Selem.subs option, []: subst)
    9.87      | SOME tm =>
    9.88 -        let val subst = tm |> subst_atomic env |> isalist2list |> map isapair2pair
    9.89 +        let val subst = tm |> subst_atomic env |> TermC.isalist2list |> map TermC.isapair2pair
    9.90            (* "[(bdv,v_v)]": term
    9.91                            |> "[(bdv,x)]": term |> ["(bdv,x)"]: term list
    9.92                                                           |> [("bdv","x")]: (term * term) list *)
    10.1 --- a/src/Tools/isac/Interpret/script.sml	Sun Feb 25 16:31:17 2018 +0100
    10.2 +++ b/src/Tools/isac/Interpret/script.sml	Fri Mar 02 14:19:59 2018 +0100
    10.3 @@ -221,7 +221,7 @@
    10.4      in (Tac.Rewrite (tid, Rewrite.assoc_thm'' thy tid), Tac.Empty_Tac_) end
    10.5    | stac2tac_ _ thy (Const ("Script.Rewrite'_Inst", _) $ sub $ Free (thmID, _) $ _ $ _) =
    10.6      let
    10.7 -      val subML = ((map isapair2pair) o isalist2list) sub
    10.8 +      val subML = ((map TermC.isapair2pair) o TermC.isalist2list) sub
    10.9        val subStr = Selem.subst2subs subML
   10.10        val tid = (de_esc_underscore o strip_thy) thmID (*4.10.02 unnoetig*)
   10.11      in (Tac.Rewrite_Inst (subStr, (tid, Rewrite.assoc_thm'' thy tid)), Tac.Empty_Tac_) end
   10.12 @@ -229,13 +229,13 @@
   10.13       (Tac.Rewrite_Set ((de_esc_underscore o strip_thy) rls), Tac.Empty_Tac_)
   10.14    | stac2tac_ _ _ (Const ("Script.Rewrite'_Set'_Inst", _) $ sub $ Free (rls, _) $ _ $ _) =
   10.15      let
   10.16 -      val subML = ((map isapair2pair) o isalist2list) sub;
   10.17 +      val subML = ((map TermC.isapair2pair) o TermC.isalist2list) sub;
   10.18        val subStr = Selem.subst2subs subML;
   10.19      in (Tac.Rewrite_Set_Inst (subStr, rls), Tac.Empty_Tac_) end
   10.20    | stac2tac_ _ _ (Const ("Script.Calculate", _) $ Free (op_, _) $ _) = (Tac.Calculate op_, Tac.Empty_Tac_)
   10.21    | stac2tac_ _ _ (Const ("Script.Take", _) $ t) = (Tac.Take (term2str t), Tac.Empty_Tac_)
   10.22    | stac2tac_ _ _ (Const ("Script.Substitute", _) $ isasub $ _) =
   10.23 -    (Tac.Substitute ((Selem.subte2sube o isalist2list) isasub), Tac.Empty_Tac_)
   10.24 +    (Tac.Substitute ((Selem.subte2sube o TermC.isalist2list) isasub), Tac.Empty_Tac_)
   10.25    | stac2tac_ _ thy (Const("Script.Check'_elementwise", _) $ _ $ 
   10.26      (Const ("Set.Collect", _) $ Abs (_, _, pred))) =
   10.27        (Tac.Check_elementwise (term_to_string''' thy pred), Tac.Empty_Tac_)
   10.28 @@ -250,9 +250,9 @@
   10.29      let
   10.30        val dI = ((implode o drop_last(*.."'"*) o Symbol.explode) dI')(*^""*);
   10.31        val thy = maxthy (assoc_thy dI) (rootthy pt);
   10.32 -	    val pI = ((map (de_esc_underscore o free2str)) o isalist2list) pI';
   10.33 -	    val mI = ((map (de_esc_underscore o free2str)) o isalist2list) mI';
   10.34 -	    val ags = isalist2list ags';
   10.35 +	    val pI = ((map (de_esc_underscore o TermC.free2str)) o TermC.isalist2list) pI';
   10.36 +	    val mI = ((map (de_esc_underscore o TermC.free2str)) o TermC.isalist2list) mI';
   10.37 +	    val ags = TermC.isalist2list ags';
   10.38  	    val (pI, pors, mI) = 
   10.39  	      if mI = ["no_met"] 
   10.40  	      then
   10.41 @@ -391,7 +391,7 @@
   10.42    | assod _ _ (m as Tac.Substitute' (ro, erls, subte, f, f')) (Const ("Script.Substitute", _) $ _ $ t) =
   10.43  	  if f = t then Ass (m, f')
   10.44  	  else (*compare | applicable_in (p,p_) pt (m as Substitute sube)*)
   10.45 -		  if foldl and_ (true, map contains_Var subte)
   10.46 +		  if foldl and_ (true, map TermC.contains_Var subte)
   10.47  		  then
   10.48  		    let val t' = subst_atomic (map HOLogic.dest_eq subte (*TODO subte2subst*)) t
   10.49  		    in if t = t' then error "assod: Substitute' not applicable to val of Expr"
   10.50 @@ -402,7 +402,7 @@
   10.51  		       | NONE => error "assod: Substitute' not applicable to val of Expr")
   10.52    | assod _ _ (m as Tac.Tac_ (thy, _, id, f')) (Const ("Script.Tac",_) $ Free (id', _)) =
   10.53      if id = id'
   10.54 -    then Ass (m, ((Thm.term_of o the o (parse thy)) f'))
   10.55 +    then Ass (m, ((Thm.term_of o the o (TermC.parse thy)) f'))
   10.56      else NotAss
   10.57  
   10.58      (*compare "| stac2tac_ thy (Const ("Script.SubProblem",_)"*)
   10.59 @@ -412,9 +412,9 @@
   10.60      let 
   10.61        val dI = ((implode o drop_last(*.."'"*) o Symbol.explode) dI')(*^""*);
   10.62        val thy = maxthy (assoc_thy dI) (rootthy pt);
   10.63 -	    val pI = ((map (de_esc_underscore o free2str)) o isalist2list) pI';
   10.64 -	    val mI = ((map (de_esc_underscore o free2str)) o isalist2list) mI';
   10.65 -	    val ags = isalist2list ags';
   10.66 +	    val pI = ((map (de_esc_underscore o TermC.free2str)) o TermC.isalist2list) pI';
   10.67 +	    val mI = ((map (de_esc_underscore o TermC.free2str)) o TermC.isalist2list) mI';
   10.68 +	    val ags = TermC.isalist2list ags';
   10.69  	    val (pI, pors, mI) = 
   10.70  	      if mI = ["no_met"] 
   10.71  	      then
   10.72 @@ -487,16 +487,16 @@
   10.73  val idT = Type ("Script.ID", []);
   10.74  
   10.75  fun make_rule thy t =
   10.76 -  let val ct = Thm.global_cterm_of thy (Trueprop $ t)
   10.77 +  let val ct = Thm.global_cterm_of thy (TermC.Trueprop $ t)
   10.78    in Thm (term_to_string''' thy (Thm.term_of ct), Thm.make_thm ct) end;
   10.79  
   10.80  fun rep_tac_ (Tac.Rewrite_Inst' (thy', _, _, put, subs, (thmID, _), f, (f', _))) = 
   10.81      let val fT = type_of f;
   10.82        val b = if put then @{term True} else @{term False};
   10.83        val sT = (type_of o fst o hd) subs;
   10.84 -      val subs' = list2isalist (HOLogic.mk_prodT (sT, sT)) (map HOLogic.mk_prod subs);
   10.85 +      val subs' = TermC.list2isalist (HOLogic.mk_prodT (sT, sT)) (map HOLogic.mk_prod subs);
   10.86        val sT' = type_of subs';
   10.87 -      val lhs = Const ("Script.Rewrite'_Inst", [sT', idT, bool, fT] ---> fT) 
   10.88 +      val lhs = Const ("Script.Rewrite'_Inst", [sT', idT, TermC.bool, fT] ---> fT) 
   10.89          $ subs' $ Free (thmID, idT) $ b $ f;
   10.90      in (((make_rule (assoc_thy thy')) o HOLogic.mk_eq) (lhs, f'), (lhs, f')) end
   10.91    | rep_tac_ (Tac.Rewrite' (thy', _, _, put, (thmID, _), f, (f', _)))=
   10.92 @@ -511,7 +511,7 @@
   10.93      let 
   10.94        val fT = type_of f;
   10.95        val b = if put then @{term True} else @{term False};
   10.96 -      val lhs = Const ("Script.Rewrite'_Set", [idT, bool, fT] ---> fT) 
   10.97 +      val lhs = Const ("Script.Rewrite'_Set", [idT, TermC.bool, fT] ---> fT) 
   10.98          $ Free (id_rls rls, idT) $ b $ f;
   10.99      in (((make_rule (assoc_thy thy')) o HOLogic.mk_eq) (lhs,f'),(lhs,f')) end
  10.100    | rep_tac_ (Tac.Calculate' (thy', op_, f, (f', _)))=
  10.101 @@ -597,12 +597,12 @@
  10.102      (case assy ya ((E , l @ [L, R], a,v,S,b),ss) e of
  10.103         NasApp ((E',l,a,v,S,_),ss) => 
  10.104           let
  10.105 -           val id' = mk_Free (id, T);
  10.106 +           val id' = TermC.mk_Free (id, T);
  10.107             val E' = LTool.upd_env E' (id', v);
  10.108           in assy ya ((E', l @ [R, D], a,v,S,b),ss) body end
  10.109       | NasNap (v,E) =>
  10.110           let
  10.111 -           val id' = mk_Free (id, T);
  10.112 +           val id' = TermC.mk_Free (id, T);
  10.113             val E' = LTool.upd_env E (id', v);
  10.114           in assy ya ((E', l @ [R, D], a,v,S,b),ss) body end
  10.115       | ay => ay)
  10.116 @@ -699,7 +699,7 @@
  10.117          (case go l sc of
  10.118             Const ("HOL.Let",_) $ _ $ (Abs (i, T, body)) => (i, T, body)
  10.119           | t => error ("ass_up..HOL.Let $ _ with " ^ term2str t))
  10.120 -      val i = mk_Free (i, T);
  10.121 +      val i = TermC.mk_Free (i, T);
  10.122        val E = LTool.upd_env E (i, v);
  10.123      in case assy (y,ctxt,s,d,Aundef) ((E, l @ [R, D], a,v,S,b),ss) body of
  10.124  	       Assoc iss => Assoc iss
  10.125 @@ -946,7 +946,7 @@
  10.126            (case go up sc of
  10.127               Const ("HOL.Let",_) $ _ $ (Abs aa) => aa
  10.128             | t => error ("nxt_up..HOL.Let $ _ with " ^ term2str t))
  10.129 -        val i = mk_Free (i, T)
  10.130 +        val i = TermC.mk_Free (i, T)
  10.131          val E = LTool.upd_env E (i, v)
  10.132        in
  10.133          case appy thy ptp E (up @ [R,D]) body a v  of
    11.1 --- a/src/Tools/isac/Interpret/specification-elems.sml	Sun Feb 25 16:31:17 2018 +0100
    11.2 +++ b/src/Tools/isac/Interpret/specification-elems.sml	Fri Mar 02 14:19:59 2018 +0100
    11.3 @@ -122,9 +122,9 @@
    11.4  val subst2subs = map (pair2str o (apfst term2str) o (apsnd term2str));
    11.5  fun subst2sube subst = map term2str (map HOLogic.mk_eq subst)
    11.6  val subst2subs' = map ((apfst term2str) o (apsnd term2str));
    11.7 -fun subs2subst thy s = map (isapair2pair o (parse_patt thy)) s;
    11.8 -fun sube2subst thy s = map (dest_equals' o (parse_patt thy)) s;
    11.9 -val sube2subte = map str2term;
   11.10 +fun subs2subst thy s = map (TermC.isapair2pair o (TermC.parse_patt thy)) s;
   11.11 +fun sube2subst thy s = map (TermC.dest_equals' o (TermC.parse_patt thy)) s;
   11.12 +val sube2subte = map TermC.str2term;
   11.13  val subte2subst = map HOLogic.dest_eq;
   11.14  val e_ctxt = Proof_Context.init_global @{theory "Pure"};
   11.15  
    12.1 --- a/src/Tools/isac/Knowledge/Atools.thy	Sun Feb 25 16:31:17 2018 +0100
    12.2 +++ b/src/Tools/isac/Knowledge/Atools.thy	Fri Mar 02 14:19:59 2018 +0100
    12.3 @@ -128,7 +128,7 @@
    12.4  (*-------------------------functions---------------------*)
    12.5  local (* rlang 09.02 *)
    12.6      (*.a 'c is coefficient of v' if v does occur in c.*)
    12.7 -    fun coeff_in v c = member op = (vars c) v;
    12.8 +    fun coeff_in v c = member op = (TermC.vars c) v;
    12.9  in
   12.10      fun occurs_in v t = coeff_in v t;
   12.11  end;
   12.12 @@ -140,9 +140,9 @@
   12.13       tracing("@@@ eval_occurs_in: t= "^(term2str t));*)
   12.14       if occurs_in v t
   12.15      then SOME ((term2str p) ^ " = True",
   12.16 -	  Trueprop $ (mk_equality (p, @{term True})))
   12.17 +	  TermC.Trueprop $ (TermC.mk_equality (p, @{term True})))
   12.18      else SOME ((term2str p) ^ " = False",
   12.19 -	  Trueprop $ (mk_equality (p, @{term False}))))
   12.20 +	  TermC.Trueprop $ (TermC.mk_equality (p, @{term False}))))
   12.21    | eval_occurs_in _ _ _ _ = NONE;
   12.22  
   12.23  (*some of the (bound) variables (eg. in an eqsys) "vs" occur in term "t"*)   
   12.24 @@ -155,11 +155,11 @@
   12.25  fun eval_some_occur_in _ "Atools.some'_occur'_in"
   12.26  			  (p as (Const ("Atools.some'_occur'_in",_) 
   12.27  				       $ vs $ t)) _ =
   12.28 -    if some_occur_in (isalist2list vs) t
   12.29 +    if some_occur_in (TermC.isalist2list vs) t
   12.30      then SOME ((term2str p) ^ " = True",
   12.31 -	       Trueprop $ (mk_equality (p, @{term True})))
   12.32 +	       TermC.Trueprop $ (TermC.mk_equality (p, @{term True})))
   12.33      else SOME ((term2str p) ^ " = False",
   12.34 -	       Trueprop $ (mk_equality (p, @{term False})))
   12.35 +	       TermC.Trueprop $ (TermC.mk_equality (p, @{term False})))
   12.36    | eval_some_occur_in _ _ _ _ = NONE;
   12.37  
   12.38  
   12.39 @@ -170,10 +170,10 @@
   12.40  fun eval_is_atom (thmid:string) "Atools.is'_atom"
   12.41  		 (t as (Const(op0,_) $ arg)) thy = 
   12.42      (case arg of 
   12.43 -	 Free (n,_) => SOME (mk_thmid thmid op0 n "", 
   12.44 -			      Trueprop $ (mk_equality (t, @{term True})))
   12.45 -       | _ => SOME (mk_thmid thmid op0 "" "", 
   12.46 -		    Trueprop $ (mk_equality (t, @{term False}))))
   12.47 +	 Free (n,_) => SOME (TermC.mk_thmid thmid op0 n "", 
   12.48 +			      TermC.Trueprop $ (TermC.mk_equality (t, @{term True})))
   12.49 +       | _ => SOME (TermC.mk_thmid thmid op0 "" "", 
   12.50 +		    TermC.Trueprop $ (TermC.mk_equality (t, @{term False}))))
   12.51    | eval_is_atom _ _ _ _ = NONE;
   12.52  
   12.53  (*evaluate 'is_even'*)
   12.54 @@ -183,12 +183,12 @@
   12.55  		 (t as (Const(op0,_) $ arg)) thy = 
   12.56      (case arg of 
   12.57  	Free (n,_) =>
   12.58 -	 (case int_of_str n of
   12.59 +	 (case TermC.int_of_str n of
   12.60  	      SOME i =>
   12.61 -	      if even i then SOME (mk_thmid thmid op0 n "", 
   12.62 -				   Trueprop $ (mk_equality (t, @{term True})))
   12.63 -	      else SOME (mk_thmid thmid op0 "" "", 
   12.64 -			 Trueprop $ (mk_equality (t, @{term False})))
   12.65 +	      if even i then SOME (TermC.mk_thmid thmid op0 n "", 
   12.66 +				   TermC.Trueprop $ (TermC.mk_equality (t, @{term True})))
   12.67 +	      else SOME (TermC.mk_thmid thmid op0 "" "", 
   12.68 +			 TermC.Trueprop $ (TermC.mk_equality (t, @{term False})))
   12.69  	    | _ => NONE)
   12.70         | _ => NONE)
   12.71    | eval_is_even _ _ _ _ = NONE; 
   12.72 @@ -200,20 +200,20 @@
   12.73      (*eval_const FIXXXXXME.WN.16.5.03 still forgets ComplexI*)
   12.74      (case arg of 
   12.75         Const (n1,_) =>
   12.76 -	 SOME (mk_thmid thmid op0 n1 "", 
   12.77 -	       Trueprop $ (mk_equality (t, @{term False})))
   12.78 +	 SOME (TermC.mk_thmid thmid op0 n1 "", 
   12.79 +	       TermC.Trueprop $ (TermC.mk_equality (t, @{term False})))
   12.80       | Free (n1,_) =>
   12.81 -	 if is_numeral n1
   12.82 -	   then SOME (mk_thmid thmid op0 n1 "", 
   12.83 -		      Trueprop $ (mk_equality (t, @{term True})))
   12.84 -	 else SOME (mk_thmid thmid op0 n1 "", 
   12.85 -		    Trueprop $ (mk_equality (t, @{term False})))
   12.86 +	 if TermC.is_numeral n1
   12.87 +	   then SOME (TermC.mk_thmid thmid op0 n1 "", 
   12.88 +		      TermC.Trueprop $ (TermC.mk_equality (t, @{term True})))
   12.89 +	 else SOME (TermC.mk_thmid thmid op0 n1 "", 
   12.90 +		    TermC.Trueprop $ (TermC.mk_equality (t, @{term False})))
   12.91       | Const ("Float.Float",_) =>
   12.92 -       SOME (mk_thmid thmid op0 (term2str arg) "", 
   12.93 -	     Trueprop $ (mk_equality (t, @{term True})))
   12.94 +       SOME (TermC.mk_thmid thmid op0 (term2str arg) "", 
   12.95 +	     TermC.Trueprop $ (TermC.mk_equality (t, @{term True})))
   12.96       | _ => (*NONE*)
   12.97 -       SOME (mk_thmid thmid op0 (term2str arg) "", 
   12.98 -		    Trueprop $ (mk_equality (t, @{term False}))))
   12.99 +       SOME (TermC.mk_thmid thmid op0 (term2str arg) "", 
  12.100 +		    TermC.Trueprop $ (TermC.mk_equality (t, @{term False}))))
  12.101    | eval_const _ _ _ _ = NONE; 
  12.102  
  12.103  (*. evaluate binary, associative, commutative operators: *,+,^ .*)
  12.104 @@ -233,14 +233,14 @@
  12.105  
  12.106  (*.convert int and float to internal floatingpoint prepresentation.*)
  12.107  fun numeral (Free (str, T)) = 
  12.108 -    (case int_of_str str of
  12.109 +    (case TermC.int_of_str str of
  12.110  	 SOME i => SOME ((i, 0), (0, 0))
  12.111         | NONE => NONE)
  12.112    | numeral (Const ("Float.Float", _) $
  12.113  		   (Const ("Product_Type.Pair", _) $
  12.114  			  (Const ("Product_Type.Pair", T) $ Free (v1, _) $ Free (v2,_)) $
  12.115  			  (Const ("Product_Type.Pair", _) $ Free (p1, _) $ Free (p2,_))))=
  12.116 -    (case (int_of_str v1, int_of_str v2, int_of_str p1, int_of_str p2) of
  12.117 +    (case (TermC.int_of_str v1, TermC.int_of_str v2, TermC.int_of_str p1, TermC.int_of_str p2) of
  12.118  	(SOME v1', SOME v2', SOME p1', SOME p2') =>
  12.119  	SOME ((v1', v2'), (p1', p2'))
  12.120        | _ => NONE)
  12.121 @@ -253,12 +253,12 @@
  12.122        case (numeral t1, numeral t2) of
  12.123          (SOME n1, SOME n2) =>
  12.124            let 
  12.125 -            val (T1, _, _) = dest_binop_typ t0
  12.126 +            val (T1, _, _) = TermC.dest_binop_typ t0
  12.127              val res = 
  12.128                calcul (if op0 = "Groups.minus_class.minus" then "Groups.plus_class.plus" else op0)n1 n2
  12.129                (*WN071229 "Rings.divide_class.divide" never tried*)
  12.130              val rhs = var_op_float v op_ t0 T1 res
  12.131 -            val prop = Trueprop $ (mk_equality (t, rhs))
  12.132 +            val prop = TermC.Trueprop $ (TermC.mk_equality (t, rhs))
  12.133            in SOME ("#: " ^ term2str prop, prop) end
  12.134        | _ => NONE
  12.135      else NONE
  12.136 @@ -269,10 +269,10 @@
  12.137          (SOME n1, SOME n2) =>
  12.138            if op0 = "Groups.minus_class.minus" then NONE 
  12.139            else let 
  12.140 -            val (T1, _, _) = dest_binop_typ t0
  12.141 +            val (T1, _, _) = TermC.dest_binop_typ t0
  12.142              val res = calcul op0 n1 n2
  12.143              val rhs = float_op_var v op_ t0 T1 res
  12.144 -            val prop = Trueprop $ (mk_equality (t, rhs))
  12.145 +            val prop = TermC.Trueprop $ (TermC.mk_equality (t, rhs))
  12.146            in SOME ("#: " ^ term2str prop, prop) end
  12.147        | _ => NONE
  12.148      else NONE
  12.149 @@ -280,10 +280,10 @@
  12.150      (case (numeral t1, numeral t2) of
  12.151        (SOME n1, SOME n2) =>
  12.152          let 
  12.153 -          val (_, _, Trange) = dest_binop_typ t0;
  12.154 +          val (_, _, Trange) = TermC.dest_binop_typ t0;
  12.155            val res = calcul op0 n1 n2;
  12.156            val rhs = term_of_float Trange res;
  12.157 -          val prop = Trueprop $ (mk_equality (t, rhs));
  12.158 +          val prop = TermC.Trueprop $ (TermC.mk_equality (t, rhs));
  12.159          in SOME ("#: " ^ term2str prop, prop) end
  12.160      | _ => NONE)
  12.161    | eval_binop _ _ _ _ = NONE; 
  12.162 @@ -303,13 +303,13 @@
  12.163    ("leq"     ,("Orderings.ord_class.less_eq"       ,eval_equ "#less_equal_"))*)
  12.164  fun eval_equ (thmid:string) (op_:string) (t as 
  12.165  	       (Const (op0,t0) $ Free (n1,t1) $ Free(n2,t2))) thy = 
  12.166 -    (case (int_of_str n1, int_of_str n2) of
  12.167 +    (case (TermC.int_of_str n1, TermC.int_of_str n2) of
  12.168  	 (SOME n1', SOME n2') =>
  12.169 -  if calc_equ (strip_thy op0) (n1', n2')
  12.170 -    then SOME (mk_thmid thmid op0 n1 n2, 
  12.171 -	  Trueprop $ (mk_equality (t, @{term True})))
  12.172 -  else SOME (mk_thmid thmid op0 n1 n2,  
  12.173 -	  Trueprop $ (mk_equality (t, @{term False})))
  12.174 +  if TermC.calc_equ (strip_thy op0) (n1', n2')
  12.175 +    then SOME (TermC.mk_thmid thmid op0 n1 n2, 
  12.176 +	  TermC.Trueprop $ (TermC.mk_equality (t, @{term True})))
  12.177 +  else SOME (TermC.mk_thmid thmid op0 n1 n2,  
  12.178 +	  TermC.Trueprop $ (TermC.mk_equality (t, @{term False})))
  12.179         | _ => NONE)
  12.180      
  12.181    | eval_equ _ _ _ _ = NONE;
  12.182 @@ -344,14 +344,14 @@
  12.183  fun eval_ident (thmid:string) "Atools.ident" (t as 
  12.184  	       (Const (op0,t0) $ t1 $ t2 )) thy = 
  12.185    if t1 = t2
  12.186 -  then SOME (mk_thmid thmid op0 
  12.187 +  then SOME (TermC.mk_thmid thmid op0 
  12.188  	              ("(" ^ (term_to_string''' thy t1) ^ ")")
  12.189  	              ("(" ^ (term_to_string''' thy t2) ^ ")"), 
  12.190 -	     Trueprop $ (mk_equality (t, @{term True})))
  12.191 -  else SOME (mk_thmid thmid op0  
  12.192 +	     TermC.Trueprop $ (TermC.mk_equality (t, @{term True})))
  12.193 +  else SOME (TermC.mk_thmid thmid op0  
  12.194  	              ("(" ^ (term_to_string''' thy t1) ^ ")")
  12.195  	              ("(" ^ (term_to_string''' thy t2) ^ ")"),  
  12.196 -	     Trueprop $ (mk_equality (t, @{term False})))
  12.197 +	     TermC.Trueprop $ (TermC.mk_equality (t, @{term False})))
  12.198    | eval_ident _ _ _ _ = NONE;
  12.199  (* TODO
  12.200  > val t = str2term "x =!= 0";
  12.201 @@ -376,16 +376,16 @@
  12.202  (*("equal"   ,("HOL.eq",eval_equal "#equal_")):calc*)
  12.203  fun eval_equal (thmid : string) "HOL.eq" (t as (Const (op0,t0) $ t1 $ t2 )) thy = 
  12.204    if t1 = t2
  12.205 -  then SOME (mk_thmid thmid op0 
  12.206 +  then SOME (TermC.mk_thmid thmid op0 
  12.207                  ("(" ^ term_to_string''' thy t1 ^ ")")
  12.208                  ("(" ^ term_to_string''' thy t2 ^ ")"), 
  12.209 -       Trueprop $ (mk_equality (t, @{term True})))
  12.210 -  else (case (is_atom t1, is_atom t2) of
  12.211 +       TermC.Trueprop $ (TermC.mk_equality (t, @{term True})))
  12.212 +  else (case (TermC.is_atom t1, TermC.is_atom t2) of
  12.213        (true, true) => 
  12.214 -      SOME (mk_thmid thmid op0  
  12.215 +      SOME (TermC.mk_thmid thmid op0  
  12.216           ("(" ^ term_to_string''' thy t1 ^ ")")
  12.217           ("(" ^ term_to_string''' thy t2 ^ ")"),
  12.218 -      Trueprop $ (mk_equality (t, @{term False})))
  12.219 +      TermC.Trueprop $ (TermC.mk_equality (t, @{term False})))
  12.220      | _ => NONE)                             (* NOT is_atom t1,t2 --> rew_sub *)
  12.221    | eval_equal _ _ _ _ = NONE;                                  (* error-exit *)
  12.222  (*
  12.223 @@ -423,21 +423,21 @@
  12.224  (*("DIVIDE" ,("Rings.divide_class.divide"  ,eval_cancel "#divide_e"))*)
  12.225  fun eval_cancel (thmid:string) "Rings.divide_class.divide" (t as 
  12.226  	       (Const (op0,t0) $ Free (n1,t1) $ Free(n2,t2))) thy = 
  12.227 -    (case (int_of_str n1, int_of_str n2) of
  12.228 +    (case (TermC.int_of_str n1, TermC.int_of_str n2) of
  12.229  	 (SOME n1', SOME n2') =>
  12.230    let 
  12.231 -    val sg = sign2 n1' n2';
  12.232 -    val (T1,T2,Trange) = dest_binop_typ t0;
  12.233 -    val gcd' = gcd (abs n1') (abs n2');
  12.234 +    val sg = TermC.sign2 n1' n2';
  12.235 +    val (T1,T2,Trange) = TermC.dest_binop_typ t0;
  12.236 +    val gcd' = TermC.gcd (abs n1') (abs n2');
  12.237    in if gcd' = abs n2' 
  12.238 -     then let val rhs = term_of_num Trange (sg * (abs n1') div gcd')
  12.239 -	      val prop = Trueprop $ (mk_equality (t, rhs))
  12.240 -	  in SOME (mk_thmid thmid op0 n1 n2, prop) end     
  12.241 +     then let val rhs = TermC.term_of_num Trange (sg * (abs n1') div gcd')
  12.242 +	      val prop = TermC.Trueprop $ (TermC.mk_equality (t, rhs))
  12.243 +	  in SOME (TermC.mk_thmid thmid op0 n1 n2, prop) end     
  12.244       else if 0 < n2' andalso gcd' = 1 then NONE
  12.245 -     else let val rhs = num_op_num T1 T2 (op0,t0) (sg * (abs n1') div gcd')
  12.246 +     else let val rhs = TermC.num_op_num T1 T2 (op0,t0) (sg * (abs n1') div gcd')
  12.247  				   ((abs n2') div gcd')
  12.248 -	      val prop = Trueprop $ (mk_equality (t, rhs))
  12.249 -	  in SOME (mk_thmid thmid op0 n1 n2, prop) end
  12.250 +	      val prop = TermC.Trueprop $ (TermC.mk_equality (t, rhs))
  12.251 +	  in SOME (TermC.mk_thmid thmid op0 n1 n2, prop) end
  12.252    end
  12.253         | _ => ((*tracing"@@@ eval_cancel NONE";*)NONE))
  12.254  
  12.255 @@ -450,7 +450,7 @@
  12.256  		     (t as (Const ("Atools.argument'_in", _) $ (f $ arg))) _ =
  12.257      if is_Free arg (*could be something to be simplified before*)
  12.258      then SOME (term2str t ^ " = " ^ term2str arg,
  12.259 -	       Trueprop $ (mk_equality (t, arg)))
  12.260 +	       TermC.Trueprop $ (TermC.mk_equality (t, arg)))
  12.261      else NONE
  12.262    | eval_argument_in _ _ _ _ = NONE;
  12.263  
  12.264 @@ -464,9 +464,9 @@
  12.265  			(Const ("HOL.eq", _) $ (f2 $ _) $ _)) _ =
  12.266      if f1 = f2 
  12.267      then SOME ((term2str p) ^ " = True",
  12.268 -	       Trueprop $ (mk_equality (p, @{term True})))
  12.269 +	       TermC.Trueprop $ (TermC.mk_equality (p, @{term True})))
  12.270      else SOME ((term2str p) ^ " = False",
  12.271 -	       Trueprop $ (mk_equality (p, @{term False})))
  12.272 +	       TermC.Trueprop $ (TermC.mk_equality (p, @{term False})))
  12.273  | eval_sameFunId _ _ _ _ = NONE;
  12.274  
  12.275  
  12.276 @@ -482,10 +482,10 @@
  12.277  fun eval_filter_sameFunId _ "Atools.filter'_sameFunId" 
  12.278  		     (p as Const ("Atools.filter'_sameFunId",_) $ 
  12.279  			(fid $ _) $ fs) _ =
  12.280 -    let val fs' = ((list2isalist HOLogic.boolT) o 
  12.281 -		   (filter (same_funid fid))) (isalist2list fs)
  12.282 -    in SOME (term2str (mk_equality (p, fs')),
  12.283 -	       Trueprop $ (mk_equality (p, fs'))) end
  12.284 +    let val fs' = ((TermC.list2isalist HOLogic.boolT) o 
  12.285 +		   (filter (same_funid fid))) (TermC.isalist2list fs)
  12.286 +    in SOME (term2str (TermC.mk_equality (p, fs')),
  12.287 +	       TermC.Trueprop $ (TermC.mk_equality (p, fs'))) end
  12.288  | eval_filter_sameFunId _ _ _ _ = NONE;
  12.289  
  12.290  
  12.291 @@ -506,11 +506,11 @@
  12.292  fun eval_boollist2sum _ "Atools.boollist2sum" 
  12.293  		      (p as Const ("Atools.boollist2sum", _) $ 
  12.294  			 (l as Const ("List.list.Cons", _) $ _ $ _)) _ =
  12.295 -    let val isal = isalist2list l
  12.296 +    let val isal = TermC.isalist2list l
  12.297  	val lhss = map lhs isal
  12.298  	val sum = list2sum lhss
  12.299      in SOME ((term2str p) ^ " = " ^ (term2str sum),
  12.300 -	  Trueprop $ (mk_equality (p, sum)))
  12.301 +	  TermC.Trueprop $ (TermC.mk_equality (p, sum)))
  12.302      end
  12.303  | eval_boollist2sum _ _ _ _ = NONE;
  12.304  
  12.305 @@ -539,8 +539,8 @@
  12.306         
  12.307  		Calc ("Tools.Vars",eval_var "#Vars_"),
  12.308  		
  12.309 -		Thm ("if_True",num_str @{thm if_True}),
  12.310 -		Thm ("if_False",num_str @{thm if_False})
  12.311 +		Thm ("if_True",TermC.num_str @{thm if_True}),
  12.312 +		Thm ("if_False",TermC.num_str @{thm if_False})
  12.313  		];
  12.314  *}
  12.315  ML {*
  12.316 @@ -558,7 +558,7 @@
  12.317  		Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"),
  12.318  		Calc ("HOL.eq",eval_equal "#equal_"),
  12.319  
  12.320 -		Thm  ("real_unari_minus",num_str @{thm real_unari_minus}),
  12.321 +		Thm  ("real_unari_minus",TermC.num_str @{thm real_unari_minus}),
  12.322  		Calc ("Groups.plus_class.plus",eval_binop "#add_"),
  12.323  		Calc ("Groups.minus_class.minus",eval_binop "#sub_"),
  12.324  		Calc ("Groups.times_class.times",eval_binop "#mult_")
  12.325 @@ -572,25 +572,25 @@
  12.326  val Atools_erls = 
  12.327      append_rls "Atools_erls" e_rls
  12.328                 [Calc ("HOL.eq",eval_equal "#equal_"),
  12.329 -                Thm ("not_true",num_str @{thm not_true}),
  12.330 +                Thm ("not_true",TermC.num_str @{thm not_true}),
  12.331  		(*"(~ True) = False"*)
  12.332 -		Thm ("not_false",num_str @{thm not_false}),
  12.333 +		Thm ("not_false",TermC.num_str @{thm not_false}),
  12.334  		(*"(~ False) = True"*)
  12.335 -		Thm ("and_true",num_str @{thm and_true}),
  12.336 +		Thm ("and_true",TermC.num_str @{thm and_true}),
  12.337  		(*"(?a & True) = ?a"*)
  12.338 -		Thm ("and_false",num_str @{thm and_false}),
  12.339 +		Thm ("and_false",TermC.num_str @{thm and_false}),
  12.340  		(*"(?a & False) = False"*)
  12.341 -		Thm ("or_true",num_str @{thm or_true}),
  12.342 +		Thm ("or_true",TermC.num_str @{thm or_true}),
  12.343  		(*"(?a | True) = True"*)
  12.344 -		Thm ("or_false",num_str @{thm or_false}),
  12.345 +		Thm ("or_false",TermC.num_str @{thm or_false}),
  12.346  		(*"(?a | False) = ?a"*)
  12.347                 
  12.348 -		Thm ("rat_leq1",num_str @{thm rat_leq1}),
  12.349 -		Thm ("rat_leq2",num_str @{thm rat_leq2}),
  12.350 -		Thm ("rat_leq3",num_str @{thm rat_leq3}),
  12.351 -                Thm ("refl",num_str @{thm refl}),
  12.352 -		Thm ("order_refl",num_str @{thm order_refl}),
  12.353 -		Thm ("radd_left_cancel_le",num_str @{thm radd_left_cancel_le}),
  12.354 +		Thm ("rat_leq1",TermC.num_str @{thm rat_leq1}),
  12.355 +		Thm ("rat_leq2",TermC.num_str @{thm rat_leq2}),
  12.356 +		Thm ("rat_leq3",TermC.num_str @{thm rat_leq3}),
  12.357 +                Thm ("refl",TermC.num_str @{thm refl}),
  12.358 +		Thm ("order_refl",TermC.num_str @{thm order_refl}),
  12.359 +		Thm ("radd_left_cancel_le",TermC.num_str @{thm radd_left_cancel_le}),
  12.360  		
  12.361  		Calc ("Orderings.ord_class.less",eval_equ "#less_"),
  12.362  		Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"),
  12.363 @@ -607,19 +607,19 @@
  12.364  val Atools_crls = 
  12.365      append_rls "Atools_crls" e_rls
  12.366                 [Calc ("HOL.eq",eval_equal "#equal_"),
  12.367 -                Thm ("not_true",num_str @{thm not_true}),
  12.368 -		Thm ("not_false",num_str @{thm not_false}),
  12.369 -		Thm ("and_true",num_str @{thm and_true}),
  12.370 -		Thm ("and_false",num_str @{thm and_false}),
  12.371 -		Thm ("or_true",num_str @{thm or_true}),
  12.372 -		Thm ("or_false",num_str @{thm or_false}),
  12.373 +                Thm ("not_true",TermC.num_str @{thm not_true}),
  12.374 +		Thm ("not_false",TermC.num_str @{thm not_false}),
  12.375 +		Thm ("and_true",TermC.num_str @{thm and_true}),
  12.376 +		Thm ("and_false",TermC.num_str @{thm and_false}),
  12.377 +		Thm ("or_true",TermC.num_str @{thm or_true}),
  12.378 +		Thm ("or_false",TermC.num_str @{thm or_false}),
  12.379                 
  12.380 -		Thm ("rat_leq1",num_str @{thm rat_leq1}),
  12.381 -		Thm ("rat_leq2",num_str @{thm rat_leq2}),
  12.382 -		Thm ("rat_leq3",num_str @{thm rat_leq3}),
  12.383 -                Thm ("refl",num_str @{thm refl}),
  12.384 -		Thm ("order_refl",num_str @{thm order_refl}),
  12.385 -		Thm ("radd_left_cancel_le",num_str @{thm radd_left_cancel_le}),
  12.386 +		Thm ("rat_leq1",TermC.num_str @{thm rat_leq1}),
  12.387 +		Thm ("rat_leq2",TermC.num_str @{thm rat_leq2}),
  12.388 +		Thm ("rat_leq3",TermC.num_str @{thm rat_leq3}),
  12.389 +                Thm ("refl",TermC.num_str @{thm refl}),
  12.390 +		Thm ("order_refl",TermC.num_str @{thm order_refl}),
  12.391 +		Thm ("radd_left_cancel_le",TermC.num_str @{thm radd_left_cancel_le}),
  12.392  		
  12.393  		Calc ("Orderings.ord_class.less",eval_equ "#less_"),
  12.394  		Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"),
    13.1 --- a/src/Tools/isac/Knowledge/Biegelinie.thy	Sun Feb 25 16:31:17 2018 +0100
    13.2 +++ b/src/Tools/isac/Knowledge/Biegelinie.thy	Fri Mar 02 14:19:59 2018 +0100
    13.3 @@ -146,9 +146,9 @@
    13.4  				   Calc("Groups.plus_class.plus", eval_binop "#add_")
    13.5  				   ], 
    13.6  		srls = Erls, calc = [], errpatts = [],
    13.7 -		rules = [Thm ("NTH_CONS",num_str @{thm NTH_CONS}),
    13.8 +		rules = [Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
    13.9  			 Calc("Groups.plus_class.plus", eval_binop "#add_"),
   13.10 -			 Thm ("NTH_NIL",num_str @{thm NTH_NIL}),
   13.11 +			 Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}),
   13.12  			 Calc("Tools.lhs", eval_lhs"eval_lhs_"),
   13.13  			 Calc("Tools.rhs", eval_rhs"eval_rhs_"),
   13.14  			 Calc("Atools.argument'_in",
   13.15 @@ -167,19 +167,19 @@
   13.16  			    Calc("Groups.plus_class.plus", eval_binop "#add_")
   13.17  			    ], 
   13.18  	 srls = Erls, calc = [], errpatts = [],
   13.19 -	 rules = [Thm ("NTH_CONS",num_str @{thm NTH_CONS}),
   13.20 +	 rules = [Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
   13.21  		  Calc("Groups.plus_class.plus", eval_binop "#add_"),
   13.22 -		  Thm ("NTH_NIL", num_str @{thm NTH_NIL}),
   13.23 +		  Thm ("NTH_NIL", TermC.num_str @{thm NTH_NIL}),
   13.24  		  Calc("Tools.lhs", eval_lhs "eval_lhs_"),
   13.25  		  Calc("Atools.filter'_sameFunId",
   13.26  		       eval_filter_sameFunId "Atools.filter'_sameFunId"),
   13.27  		  (*WN070514 just for smltest/../biegelinie.sml ...*)
   13.28  		  Calc("Atools.sameFunId", eval_sameFunId "Atools.sameFunId"),
   13.29 -		  Thm ("filter_Cons", num_str @{thm filter_Cons}),
   13.30 -		  Thm ("filter_Nil", num_str @{thm filter_Nil}),
   13.31 -		  Thm ("if_True", num_str @{thm if_True}),
   13.32 -		  Thm ("if_False", num_str @{thm if_False}),
   13.33 -		  Thm ("hd_thm", num_str @{thm hd_thm})
   13.34 +		  Thm ("filter_Cons", TermC.num_str @{thm filter_Cons}),
   13.35 +		  Thm ("filter_Nil", TermC.num_str @{thm filter_Nil}),
   13.36 +		  Thm ("if_True", TermC.num_str @{thm if_True}),
   13.37 +		  Thm ("if_False", TermC.num_str @{thm if_False}),
   13.38 +		  Thm ("hd_thm", TermC.num_str @{thm hd_thm})
   13.39  		  ],
   13.40  	 scr = EmptyScr};
   13.41  *}
   13.42 @@ -194,8 +194,8 @@
   13.43  	    {rew_ord'="tless_true",
   13.44          rls' = append_rls "erls_IntegrierenUndK.." e_rls 
   13.45  				    [Calc ("Atools.ident",eval_ident "#ident_"),
   13.46 -				      Thm ("not_true",num_str @{thm not_true}),
   13.47 -				      Thm ("not_false",num_str @{thm not_false})], 
   13.48 +				      Thm ("not_true",TermC.num_str @{thm not_true}),
   13.49 +				      Thm ("not_false",TermC.num_str @{thm not_false})], 
   13.50  				calc = [], srls = srls, prls = Erls, crls = Atools_erls, errpats = [], nrls = Erls},
   13.51          "Script BiegelinieScript                                                 " ^
   13.52            "(l_l::real) (q__q::real) (v_v::real) (b_b::real=>real)                  " ^
   13.53 @@ -270,15 +270,15 @@
   13.54  	      {rew_ord'="tless_true", 
   13.55  	        rls' = append_rls "erls_IntegrierenUndK.." e_rls 
   13.56  				      [Calc ("Atools.ident",eval_ident "#ident_"),
   13.57 -				        Thm ("not_true",num_str @{thm not_true}),
   13.58 -				        Thm ("not_false",num_str @{thm not_false})], 
   13.59 +				        Thm ("not_true",TermC.num_str @{thm not_true}),
   13.60 +				        Thm ("not_false",TermC.num_str @{thm not_false})], 
   13.61  				  calc = [], 
   13.62  				  srls = append_rls "erls_IntegrierenUndK.." e_rls 
   13.63  				      [Calc("Tools.rhs", eval_rhs"eval_rhs_"),
   13.64  				        Calc ("Atools.ident",eval_ident "#ident_"),
   13.65 -				        Thm ("last_thmI",num_str @{thm last_thmI}),
   13.66 -				        Thm ("if_True",num_str @{thm if_True}),
   13.67 -				        Thm ("if_False",num_str @{thm if_False})],
   13.68 +				        Thm ("last_thmI",TermC.num_str @{thm last_thmI}),
   13.69 +				        Thm ("if_True",TermC.num_str @{thm if_True}),
   13.70 +				        Thm ("if_False",TermC.num_str @{thm if_False})],
   13.71  				  prls = Erls, crls = Atools_erls, errpats = [], nrls = Erls},
   13.72          "Script Biegelinie2Script                                                  " ^
   13.73            "(l_l::real) (q__q::real) (v_v::real) (b_b::real=>real) (r_b::bool list) = " ^
   13.74 @@ -325,8 +325,8 @@
   13.75  	      {rew_ord'="tless_true", 
   13.76  	        rls' = append_rls "erls_ausBelastung" e_rls 
   13.77  				      [Calc ("Atools.ident", eval_ident "#ident_"),
   13.78 -				        Thm ("not_true", num_str @{thm not_true}),
   13.79 -				        Thm ("not_false", num_str @{thm not_false})], 
   13.80 +				        Thm ("not_true", TermC.num_str @{thm not_true}),
   13.81 +				        Thm ("not_false", TermC.num_str @{thm not_false})], 
   13.82  				  calc = [], 
   13.83  				  srls = append_rls "srls_ausBelastung" e_rls 
   13.84  				      [Calc ("Tools.rhs", eval_rhs "eval_rhs_")], 
    14.1 --- a/src/Tools/isac/Knowledge/Delete.thy	Sun Feb 25 16:31:17 2018 +0100
    14.2 +++ b/src/Tools/isac/Knowledge/Delete.thy	Fri Mar 02 14:19:59 2018 +0100
    14.3 @@ -23,8 +23,8 @@
    14.4     integer numerals n are ((n,0),(0,0)) i.e. precision is (0,0)*)
    14.5  fun calcul "Groups.plus_class.plus" ((a, b), _:int * int) ((c, d), _:int * int)  = (*FIXME.WN1008 drop Float.calc, var_op_float, float_op_var, term_of_float*)
    14.6      if b < d 
    14.7 -    then ((a + c * power 10 (d - b), b), (0, 0))(*FIXXXME precision*)
    14.8 -    else ((a * power 10 (b - d) + c, d), (0, 0))(*FIXXXME precision*)
    14.9 +    then ((a + c * TermC.power 10 (d - b), b), (0, 0))(*FIXXXME precision*)
   14.10 +    else ((a * TermC.power 10 (b - d) + c, d), (0, 0))(*FIXXXME precision*)
   14.11    | calcul "Groups.minus_class.minus" ((a, 0), _) ((c, 0), _) =       (*FIXXXME float + prec.*)
   14.12      ((a - c,0),(0,0))
   14.13    | calcul "Groups.times_class.times" ((a, b), _) ((c, d), _) =       (*FIXXXME precision*)
   14.14 @@ -32,7 +32,7 @@
   14.15    | calcul "Rings.divide_class.divide" ((a, 0), _) ((c, 0), _) = (*FIXXXME float + prec.*)
   14.16      ((a div c, 0), (0, 0))
   14.17    | calcul "Atools.pow" ((a, b), _) ((c, d), _) = (*FIXXXME float + prec.*)
   14.18 -    ((power a c, 0), (0, 0))
   14.19 +    ((TermC.power a c, 0), (0, 0))
   14.20    | calcul op_ ((a, b), (p11, p12)) ((c, d), (p21, p22)) = 
   14.21      error ("calcul: not impl. for Float (("^
   14.22  		 (string_of_int a  )^","^(string_of_int b  )^"), ("^
   14.23 @@ -44,14 +44,14 @@
   14.24  
   14.25  (*.convert internal floatingpoint prepresentation to int and float.*)
   14.26  fun term_of_float T ((val1,    0), (         0,          0)) =
   14.27 -    term_of_num T val1
   14.28 +    TermC.term_of_num T val1
   14.29    | term_of_float T ((val1, val2), (precision1, precision2)) =
   14.30 -    let val pT = pairT T T
   14.31 -    in Const ("Float.Float", (pairT pT pT) --> T)
   14.32 -	     $ (pairt (pairt (Free (str_of_int val1, T))
   14.33 -			     (Free (str_of_int val2, T)))
   14.34 -		      (pairt (Free (str_of_int precision1, T))
   14.35 -			     (Free (str_of_int precision2, T))))
   14.36 +    let val pT = TermC.pairT T T
   14.37 +    in Const ("Float.Float", (TermC.pairT pT pT) --> T)
   14.38 +	     $ (TermC.pairt (TermC.pairt (Free (TermC.str_of_int val1, T))
   14.39 +			     (Free (TermC.str_of_int val2, T)))
   14.40 +		      (TermC.pairt (Free (TermC.str_of_int precision1, T))
   14.41 +			     (Free (TermC.str_of_int precision2, T))))
   14.42      end;
   14.43  (*> val t = str2term "Float ((1,2),(0,0))";
   14.44  > val Const ("Float.Float", fT) $ _ = t;
   14.45 @@ -67,15 +67,15 @@
   14.46  
   14.47  (*.assoc. convert internal floatingpoint prepresentation to int and float.*)
   14.48  fun var_op_float v op_ optype ntyp ((v1, 0), (0, 0)) =
   14.49 -    var_op_num v op_ optype ntyp v1
   14.50 +    TermC.var_op_num v op_ optype ntyp v1
   14.51    | var_op_float v op_ optype T ((v1, v2), (p1, p2)) =
   14.52 -    let val pT = pairT T T
   14.53 +    let val pT = TermC.pairT T T
   14.54      in Const (op_, optype) $ v $ 
   14.55 -	     (Const ("Float.Float", (pairT pT pT) --> T)
   14.56 -		    $ (pairt (pairt (Free (str_of_int v1, T))
   14.57 -				    (Free (str_of_int v2, T)))
   14.58 -			     (pairt (Free (str_of_int p1, T))
   14.59 -				    (Free (str_of_int p2, T)))))
   14.60 +	     (Const ("Float.Float", (TermC.pairT pT pT) --> T)
   14.61 +		    $ (TermC.pairt (TermC.pairt (Free (TermC.str_of_int v1, T))
   14.62 +				    (Free (TermC.str_of_int v2, T)))
   14.63 +			     (TermC.pairt (Free (TermC.str_of_int p1, T))
   14.64 +				    (Free (TermC.str_of_int p2, T)))))
   14.65      end;
   14.66  (*> val t = str2term "a + b";
   14.67  > val Const ("Groups.plus_class.plus", optype) $ _ $ _ = t;
   14.68 @@ -85,15 +85,15 @@
   14.69  
   14.70  (*.assoc. convert internal floatingpoint prepresentation to int and float.*)
   14.71  fun float_op_var v op_ optype ntyp ((v1, 0), (0, 0)) =
   14.72 -    num_op_var v op_ optype ntyp v1
   14.73 +    TermC.num_op_var v op_ optype ntyp v1
   14.74    | float_op_var v op_ optype T ((v1, v2), (p1, p2)) =
   14.75 -    let val pT = pairT T T
   14.76 -    in Const (op_,optype) $ 
   14.77 -	     (Const ("Float.Float", (pairT pT pT) --> T)
   14.78 -		    $ (pairt (pairt (Free (str_of_int v1, T))
   14.79 -				    (Free (str_of_int v2, T)))
   14.80 -			     (pairt (Free (str_of_int p1, T))
   14.81 -				    (Free (str_of_int p2, T))))) $ v
   14.82 +    let val pT = TermC.pairT T T
   14.83 +    in Const (op_, optype) $ 
   14.84 +	     (Const ("Float.Float", (TermC.pairT pT pT) --> T)
   14.85 +		    $ (TermC.pairt (TermC.pairt (Free (TermC.str_of_int v1, T))
   14.86 +				    (Free (TermC.str_of_int v2, T)))
   14.87 +			     (TermC.pairt (Free (TermC.str_of_int p1, T))
   14.88 +				    (Free (TermC.str_of_int p2, T))))) $ v
   14.89      end;
   14.90  (*> val t = str2term "a + b";
   14.91  > val Const ("Groups.plus_class.plus", optype) $ _ $ _ = t;
    15.1 --- a/src/Tools/isac/Knowledge/Diff.thy	Sun Feb 25 16:31:17 2018 +0100
    15.2 +++ b/src/Tools/isac/Knowledge/Diff.thy	Fri Mar 02 14:19:59 2018 +0100
    15.3 @@ -105,7 +105,7 @@
    15.4  (*("primed", ("Diff.primed", eval_primed "#primed"))*)
    15.5  fun eval_primed _ _ (p as (Const ("Diff.primed",_) $ t)) _ =
    15.6      SOME ((term2str p) ^ " = " ^ term2str (primed t),
    15.7 -	  Trueprop $ (mk_equality (p, primed t)))
    15.8 +	  TermC.Trueprop $ (TermC.mk_equality (p, primed t)))
    15.9    | eval_primed _ _ _ _ = NONE;
   15.10  *}
   15.11  setup {* KEStore_Elems.add_calcs
   15.12 @@ -120,32 +120,32 @@
   15.13  	 rew_ord = ("termlessI",termlessI), 
   15.14  	 erls = append_rls "erls_diff_conv" e_rls 
   15.15  			   [Calc ("Atools.occurs'_in", eval_occurs_in ""),
   15.16 -			    Thm ("not_true",num_str @{thm not_true}),
   15.17 -			    Thm ("not_false",num_str @{thm not_false}),
   15.18 +			    Thm ("not_true",TermC.num_str @{thm not_true}),
   15.19 +			    Thm ("not_false",TermC.num_str @{thm not_false}),
   15.20  			    Calc ("Orderings.ord_class.less",eval_equ "#less_"),
   15.21 -			    Thm ("and_true",num_str @{thm and_true}),
   15.22 -			    Thm ("and_false",num_str @{thm and_false})
   15.23 +			    Thm ("and_true",TermC.num_str @{thm and_true}),
   15.24 +			    Thm ("and_false",TermC.num_str @{thm and_false})
   15.25  			    ], 
   15.26  	 srls = Erls, calc = [], errpatts = [],
   15.27  	 rules =
   15.28 -  [Thm ("frac_conv", num_str @{thm frac_conv}),
   15.29 +  [Thm ("frac_conv", TermC.num_str @{thm frac_conv}),
   15.30       (*"?bdv occurs_in ?b \<Longrightarrow> 0 < ?n \<Longrightarrow> ?a / ?b ^^^ ?n = ?a * ?b ^^^ - ?n"*)
   15.31 -		   Thm ("sqrt_conv_bdv", num_str @{thm sqrt_conv_bdv}),
   15.32 +		   Thm ("sqrt_conv_bdv", TermC.num_str @{thm sqrt_conv_bdv}),
   15.33  		     (*"sqrt ?bdv = ?bdv ^^^ (1 / 2)"*)
   15.34 -		   Thm ("sqrt_conv_bdv_n", num_str @{thm sqrt_conv_bdv_n}),
   15.35 +		   Thm ("sqrt_conv_bdv_n", TermC.num_str @{thm sqrt_conv_bdv_n}),
   15.36  		     (*"sqrt (?bdv ^^^ ?n) = ?bdv ^^^ (?n / 2)"*)
   15.37 -		   Thm ("sqrt_conv", num_str @{thm sqrt_conv}),
   15.38 +		   Thm ("sqrt_conv", TermC.num_str @{thm sqrt_conv}),
   15.39  		     (*"?bdv occurs_in ?u \<Longrightarrow> sqrt ?u = ?u ^^^ (1 / 2)"*)
   15.40 -		   Thm ("root_conv", num_str @{thm root_conv}),
   15.41 +		   Thm ("root_conv", TermC.num_str @{thm root_conv}),
   15.42  		     (*"?bdv occurs_in ?u \<Longrightarrow> nroot ?n ?u = ?u ^^^ (1 / ?n)"*)
   15.43 -		   Thm ("realpow_pow_bdv", num_str @{thm realpow_pow_bdv}),
   15.44 +		   Thm ("realpow_pow_bdv", TermC.num_str @{thm realpow_pow_bdv}),
   15.45  		     (* "(?bdv ^^^ ?b) ^^^ ?c = ?bdv ^^^ (?b * ?c)"*)
   15.46  		   Calc ("Groups.times_class.times", eval_binop "#mult_"),
   15.47 -		   Thm ("rat_mult",num_str @{thm rat_mult}),
   15.48 +		   Thm ("rat_mult",TermC.num_str @{thm rat_mult}),
   15.49  		     (*a / b * (c / d) = a * c / (b * d)*)
   15.50 -		   Thm ("times_divide_eq_right",num_str @{thm times_divide_eq_right}),
   15.51 +		   Thm ("times_divide_eq_right",TermC.num_str @{thm times_divide_eq_right}),
   15.52  		     (*?x * (?y / ?z) = ?x * ?y / ?z*)
   15.53 -		   Thm ("times_divide_eq_left",num_str @{thm times_divide_eq_left})
   15.54 +		   Thm ("times_divide_eq_left",TermC.num_str @{thm times_divide_eq_left})
   15.55  		     (*?y / ?z * ?x = ?y * ?x / ?z*)
   15.56  		 ],
   15.57  	 scr = EmptyScr};
   15.58 @@ -160,17 +160,17 @@
   15.59  			   [Calc ("Orderings.ord_class.less",eval_equ "#less_")
   15.60  			    ], 
   15.61  	 srls = Erls, calc = [], errpatts = [],
   15.62 -	 rules = [Thm ("frac_sym_conv", num_str @{thm frac_sym_conv}),
   15.63 -		  Thm ("sqrt_sym_conv", num_str @{thm sqrt_sym_conv}),
   15.64 -		  Thm ("root_sym_conv", num_str @{thm root_sym_conv}),
   15.65 +	 rules = [Thm ("frac_sym_conv", TermC.num_str @{thm frac_sym_conv}),
   15.66 +		  Thm ("sqrt_sym_conv", TermC.num_str @{thm sqrt_sym_conv}),
   15.67 +		  Thm ("root_sym_conv", TermC.num_str @{thm root_sym_conv}),
   15.68  		  Thm ("sym_real_mult_minus1",
   15.69 -		       num_str (@{thm real_mult_minus1} RS @{thm sym})),
   15.70 +		       TermC.num_str (@{thm real_mult_minus1} RS @{thm sym})),
   15.71  		      (*- ?z = "-1 * ?z"*)
   15.72 -		  Thm ("rat_mult",num_str @{thm rat_mult}),
   15.73 +		  Thm ("rat_mult",TermC.num_str @{thm rat_mult}),
   15.74  		  (*a / b * (c / d) = a * c / (b * d)*)
   15.75 -		  Thm ("times_divide_eq_right",num_str @{thm times_divide_eq_right}),
   15.76 +		  Thm ("times_divide_eq_right",TermC.num_str @{thm times_divide_eq_right}),
   15.77  		  (*?x * (?y / ?z) = ?x * ?y / ?z*)
   15.78 -		  Thm ("times_divide_eq_left",num_str @{thm times_divide_eq_left}),
   15.79 +		  Thm ("times_divide_eq_left",TermC.num_str @{thm times_divide_eq_left}),
   15.80  		  (*?y / ?z * ?x = ?y * ?x / ?z*)
   15.81  		  Calc ("Groups.times_class.times", eval_binop "#mult_")
   15.82  		 ],
   15.83 @@ -193,8 +193,8 @@
   15.84  (*..*)
   15.85  val erls_diff = 
   15.86      append_rls "erls_differentiate.." e_rls
   15.87 -               [Thm ("not_true",num_str @{thm not_true}),
   15.88 -		Thm ("not_false",num_str @{thm not_false}),
   15.89 +               [Thm ("not_true",TermC.num_str @{thm not_true}),
   15.90 +		Thm ("not_false",TermC.num_str @{thm not_false}),
   15.91  		
   15.92  		Calc ("Atools.ident",eval_ident "#ident_"),    
   15.93  		Calc ("Atools.is'_atom",eval_is_atom "#is_atom_"),
   15.94 @@ -206,27 +206,27 @@
   15.95  val diff_rules =
   15.96      Rls {id="diff_rules", preconds = [], rew_ord = ("termlessI",termlessI), 
   15.97  	 erls = erls_diff, srls = Erls, calc = [], errpatts = [],
   15.98 -	 rules = [Thm ("diff_sum",num_str @{thm diff_sum}),
   15.99 -		  Thm ("diff_dif",num_str @{thm diff_dif}),
  15.100 -		  Thm ("diff_prod_const",num_str @{thm diff_prod_const}),
  15.101 -		  Thm ("diff_prod",num_str @{thm diff_prod}),
  15.102 -		  Thm ("diff_quot",num_str @{thm diff_quot}),
  15.103 -		  Thm ("diff_sin",num_str @{thm diff_sin}),
  15.104 -		  Thm ("diff_sin_chain",num_str @{thm diff_sin_chain}),
  15.105 -		  Thm ("diff_cos",num_str @{thm diff_cos}),
  15.106 -		  Thm ("diff_cos_chain",num_str @{thm diff_cos_chain}),
  15.107 -		  Thm ("diff_pow",num_str @{thm diff_pow}),
  15.108 -		  Thm ("diff_pow_chain",num_str @{thm diff_pow_chain}),
  15.109 -		  Thm ("diff_ln",num_str @{thm diff_ln}),
  15.110 -		  Thm ("diff_ln_chain",num_str @{thm diff_ln_chain}),
  15.111 -		  Thm ("diff_exp",num_str @{thm diff_exp}),
  15.112 -		  Thm ("diff_exp_chain",num_str @{thm diff_exp_chain}),
  15.113 +	 rules = [Thm ("diff_sum",TermC.num_str @{thm diff_sum}),
  15.114 +		  Thm ("diff_dif",TermC.num_str @{thm diff_dif}),
  15.115 +		  Thm ("diff_prod_const",TermC.num_str @{thm diff_prod_const}),
  15.116 +		  Thm ("diff_prod",TermC.num_str @{thm diff_prod}),
  15.117 +		  Thm ("diff_quot",TermC.num_str @{thm diff_quot}),
  15.118 +		  Thm ("diff_sin",TermC.num_str @{thm diff_sin}),
  15.119 +		  Thm ("diff_sin_chain",TermC.num_str @{thm diff_sin_chain}),
  15.120 +		  Thm ("diff_cos",TermC.num_str @{thm diff_cos}),
  15.121 +		  Thm ("diff_cos_chain",TermC.num_str @{thm diff_cos_chain}),
  15.122 +		  Thm ("diff_pow",TermC.num_str @{thm diff_pow}),
  15.123 +		  Thm ("diff_pow_chain",TermC.num_str @{thm diff_pow_chain}),
  15.124 +		  Thm ("diff_ln",TermC.num_str @{thm diff_ln}),
  15.125 +		  Thm ("diff_ln_chain",TermC.num_str @{thm diff_ln_chain}),
  15.126 +		  Thm ("diff_exp",TermC.num_str @{thm diff_exp}),
  15.127 +		  Thm ("diff_exp_chain",TermC.num_str @{thm diff_exp_chain}),
  15.128  (*
  15.129 -		  Thm ("diff_sqrt",num_str @{thm diff_sqrt}),
  15.130 -		  Thm ("diff_sqrt_chain",num_str @{thm diff_sqrt_chain}),
  15.131 +		  Thm ("diff_sqrt",TermC.num_str @{thm diff_sqrt}),
  15.132 +		  Thm ("diff_sqrt_chain",TermC.num_str @{thm diff_sqrt_chain}),
  15.133  *)
  15.134 -		  Thm ("diff_const",num_str @{thm diff_const}),
  15.135 -		  Thm ("diff_var",num_str @{thm diff_var})
  15.136 +		  Thm ("diff_const",TermC.num_str @{thm diff_const}),
  15.137 +		  Thm ("diff_var",TermC.num_str @{thm diff_var})
  15.138  		  ],
  15.139  	 scr = EmptyScr};
  15.140  *}
  15.141 @@ -273,10 +273,10 @@
  15.142     val [Const ("Product_Type.Pair", _) $ t $ bdv] = pairl;
  15.143     *)
  15.144  fun argl2dtss [Const ("Product_Type.Pair", _) $ t $ bdv] =
  15.145 -    [((Thm.term_of o the o (parse thy)) "functionTerm", [t]),
  15.146 -     ((Thm.term_of o the o (parse thy)) "differentiateFor", [bdv]),
  15.147 -     ((Thm.term_of o the o (parse thy)) "derivative", 
  15.148 -      [(Thm.term_of o the o (parse thy)) "f_f'"])
  15.149 +    [((Thm.term_of o the o (TermC.parse thy)) "functionTerm", [t]),
  15.150 +     ((Thm.term_of o the o (TermC.parse thy)) "differentiateFor", [bdv]),
  15.151 +     ((Thm.term_of o the o (TermC.parse thy)) "derivative", 
  15.152 +      [(Thm.term_of o the o (TermC.parse thy)) "f_f'"])
  15.153       ]
  15.154    | argl2dtss _ = error "Diff.ML: wrong argument for argl2dtss";
  15.155  *}
  15.156 @@ -386,7 +386,7 @@
  15.157            "     (Try (Rewrite_Set norm_Rational False))) f_f')")]
  15.158  *}
  15.159  setup {* KEStore_Elems.add_cas
  15.160 -  [((Thm.term_of o the o (parse thy)) "Diff",
  15.161 +  [((Thm.term_of o the o (TermC.parse thy)) "Diff",
  15.162  	      (("Isac", ["derivative_of","function"], ["no_met"]), argl2dtss))] *}
  15.163  ML {*
  15.164  
  15.165 @@ -395,15 +395,15 @@
  15.166     val [Const ("Product_Type.Pair", _) $ t $ bdv] = pairl;
  15.167     *)
  15.168  fun argl2dtss [Const ("Product_Type.Pair", _) $ t $ bdv] =
  15.169 -    [((Thm.term_of o the o (parse thy)) "functionEq", [t]),
  15.170 -     ((Thm.term_of o the o (parse thy)) "differentiateFor", [bdv]),
  15.171 -     ((Thm.term_of o the o (parse thy)) "derivativeEq", 
  15.172 -      [(Thm.term_of o the o (parse thy)) "f_f'::bool"])
  15.173 +    [((Thm.term_of o the o (TermC.parse thy)) "functionEq", [t]),
  15.174 +     ((Thm.term_of o the o (TermC.parse thy)) "differentiateFor", [bdv]),
  15.175 +     ((Thm.term_of o the o (TermC.parse thy)) "derivativeEq", 
  15.176 +      [(Thm.term_of o the o (TermC.parse thy)) "f_f'::bool"])
  15.177       ]
  15.178    | argl2dtss _ = error "Diff.ML: wrong argument for argl2dtss";
  15.179  *}
  15.180  setup {* KEStore_Elems.add_cas
  15.181 -  [((Thm.term_of o the o (parse thy)) "Differentiate",  
  15.182 +  [((Thm.term_of o the o (TermC.parse thy)) "Differentiate",  
  15.183  	      (("Isac", ["named","derivative_of","function"], ["no_met"]), argl2dtss))] *}
  15.184  	      
  15.185  end
    16.1 --- a/src/Tools/isac/Knowledge/DiffApp.thy	Sun Feb 25 16:31:17 2018 +0100
    16.2 +++ b/src/Tools/isac/Knowledge/DiffApp.thy	Fri Mar 02 14:19:59 2018 +0100
    16.3 @@ -51,17 +51,17 @@
    16.4  val eval_rls = prep_rls' (
    16.5    Rls {id = "eval_rls", preconds = [], rew_ord = ("termlessI", termlessI), 
    16.6      erls = e_rls, srls = Erls, calc = [], errpatts = [],
    16.7 -    rules = [Thm ("refl", num_str @{thm refl}),
    16.8 -      Thm ("order_refl", num_str @{thm order_refl}),
    16.9 -      Thm ("radd_left_cancel_le", num_str @{thm radd_left_cancel_le}),
   16.10 -      Thm ("not_true", num_str @{thm not_true}),
   16.11 -      Thm ("not_false", num_str @{thm not_false}),
   16.12 -      Thm ("and_true", num_str @{thm and_true}),
   16.13 -      Thm ("and_false", num_str @{thm and_false}),
   16.14 -      Thm ("or_true", num_str @{thm or_true}),
   16.15 -      Thm ("or_false", num_str @{thm or_false}),
   16.16 -      Thm ("and_commute", num_str @{thm and_commute}),
   16.17 -      Thm ("or_commute", num_str @{thm or_commute}),
   16.18 +    rules = [Thm ("refl", TermC.num_str @{thm refl}),
   16.19 +      Thm ("order_refl", TermC.num_str @{thm order_refl}),
   16.20 +      Thm ("radd_left_cancel_le", TermC.num_str @{thm radd_left_cancel_le}),
   16.21 +      Thm ("not_true", TermC.num_str @{thm not_true}),
   16.22 +      Thm ("not_false", TermC.num_str @{thm not_false}),
   16.23 +      Thm ("and_true", TermC.num_str @{thm and_true}),
   16.24 +      Thm ("and_false", TermC.num_str @{thm and_false}),
   16.25 +      Thm ("or_true", TermC.num_str @{thm or_true}),
   16.26 +      Thm ("or_false", TermC.num_str @{thm or_false}),
   16.27 +      Thm ("and_commute", TermC.num_str @{thm and_commute}),
   16.28 +      Thm ("or_commute", TermC.num_str @{thm or_commute}),
   16.29        
   16.30        Calc ("Orderings.ord_class.less", eval_equ "#less_"),
   16.31        Calc ("Orderings.ord_class.less_eq", eval_equ "#less_equal_"),
   16.32 @@ -70,7 +70,7 @@
   16.33        Calc ("Atools.is'_const", eval_const "#is_const_"),
   16.34        Calc ("Atools.occurs'_in", eval_occurs_in ""),    
   16.35        Calc ("Tools.matches", eval_matches "")],
   16.36 -    scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
   16.37 +    scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
   16.38      }:rls);
   16.39  *}
   16.40  setup {* KEStore_Elems.add_rlss [("eval_rls", (Context.theory_name @{theory}, eval_rls))] *}
   16.41 @@ -197,8 +197,8 @@
   16.42  *}
   16.43  ML {*
   16.44  val list_rls = append_rls "list_rls" list_rls
   16.45 -  [Thm ("filterVar_Const", num_str @{thm filterVar_Const}),
   16.46 -   Thm ("filterVar_Nil", num_str @{thm filterVar_Nil})];
   16.47 +  [Thm ("filterVar_Const", TermC.num_str @{thm filterVar_Const}),
   16.48 +   Thm ("filterVar_Nil", TermC.num_str @{thm filterVar_Nil})];
   16.49  *}
   16.50  setup {* KEStore_Elems.add_rlss [("list_rls", (Context.theory_name @{theory}, list_rls))] *}
   16.51  
    17.1 --- a/src/Tools/isac/Knowledge/EqSystem.thy	Sun Feb 25 16:31:17 2018 +0100
    17.2 +++ b/src/Tools/isac/Knowledge/EqSystem.thy	Fri Mar 02 14:19:59 2018 +0100
    17.3 @@ -76,11 +76,11 @@
    17.4  fun eval_occur_exactly_in _ "EqSystem.occur'_exactly'_in"
    17.5  			  (p as (Const ("EqSystem.occur'_exactly'_in",_) 
    17.6  				       $ vs $ all $ t)) _ =
    17.7 -    if occur_exactly_in (isalist2list vs) (isalist2list all) t
    17.8 +    if occur_exactly_in (TermC.isalist2list vs) (TermC.isalist2list all) t
    17.9      then SOME ((term2str p) ^ " = True",
   17.10 -	       Trueprop $ (mk_equality (p, @{term True})))
   17.11 +	       TermC.Trueprop $ (TermC.mk_equality (p, @{term True})))
   17.12      else SOME ((term2str p) ^ " = False",
   17.13 -	       Trueprop $ (mk_equality (p, @{term False})))
   17.14 +	       TermC.Trueprop $ (TermC.mk_equality (p, @{term False})))
   17.15    | eval_occur_exactly_in _ _ _ _ = NONE;
   17.16  *}
   17.17  setup {* KEStore_Elems.add_calcs
   17.18 @@ -118,7 +118,7 @@
   17.19  fun size_of_term' (Free (ccc, _)) =
   17.20      (case Symbol.explode ccc of (*WN0510 hack for the bound variables*)
   17.21  	"c"::[] => 1000
   17.22 -      | "c"::"_"::is => 1000 * ((str2int o implode) is)
   17.23 +      | "c"::"_"::is => 1000 * ((TermC.str2int o implode) is)
   17.24        | _ => 1)
   17.25    | size_of_term' (Abs (_,_,body)) = 1 + size_of_term' body
   17.26    | size_of_term' (f$t) = size_of_term' f  +  size_of_term' t
   17.27 @@ -179,17 +179,17 @@
   17.28        rew_ord = ("ord_simplify_System",
   17.29  		 ord_simplify_System false @{theory "Integrate"}),
   17.30        erls = e_rls,srls = Erls, calc = [], errpatts = [],
   17.31 -      rules = [Thm ("mult_commute",num_str @{thm mult.commute}),
   17.32 +      rules = [Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
   17.33  	       (* z * w = w * z *)
   17.34 -	       Thm ("real_mult_left_commute",num_str @{thm real_mult_left_commute}),
   17.35 +	       Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
   17.36  	       (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*)
   17.37 -	       Thm ("mult_assoc",num_str @{thm mult.assoc}),		
   17.38 +	       Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),		
   17.39  	       (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*)
   17.40 -	       Thm ("add_commute",num_str @{thm add.commute}),	
   17.41 +	       Thm ("add_commute",TermC.num_str @{thm add.commute}),	
   17.42  	       (*z + w = w + z*)
   17.43 -	       Thm ("add_left_commute",num_str @{thm add.left_commute}),
   17.44 +	       Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}),
   17.45  	       (*x + (y + z) = y + (x + z)*)
   17.46 -	       Thm ("add_assoc",num_str @{thm add.assoc})	               
   17.47 +	       Thm ("add_assoc",TermC.num_str @{thm add.assoc})	               
   17.48  	       (*z1.0 + z2.0 + z3.0 = z1.0 + (z2.0 + z3.0)*)
   17.49  	       ], 
   17.50        scr = EmptyScr}:rls;
   17.51 @@ -213,7 +213,7 @@
   17.52  		(*Rls_ add_fractions_p, #2*)
   17.53  		Rls_ cancel_p
   17.54  		],
   17.55 -       scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
   17.56 +       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
   17.57         }:rls;
   17.58  *}
   17.59  ML {*
   17.60 @@ -234,7 +234,7 @@
   17.61  		Rls_ add_fractions_p,
   17.62  		Rls_ cancel_p
   17.63  		],
   17.64 -       scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
   17.65 +       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
   17.66         }:rls;
   17.67  *}
   17.68  ML {*
   17.69 @@ -251,15 +251,15 @@
   17.70    Seq {id = "simplify_System_parenthesized", preconds = []:term list, 
   17.71         rew_ord = ("dummy_ord", dummy_ord),
   17.72        erls = Atools_erls, srls = Erls, calc = [], errpatts = [],
   17.73 -      rules = [Thm ("distrib_right",num_str @{thm distrib_right}),
   17.74 +      rules = [Thm ("distrib_right",TermC.num_str @{thm distrib_right}),
   17.75   	       (*"(?z1.0 + ?z2.0) * ?w = ?z1.0 * ?w + ?z2.0 * ?w"*)
   17.76 -	       Thm ("add_divide_distrib",num_str @{thm add_divide_distrib}),
   17.77 +	       Thm ("add_divide_distrib",TermC.num_str @{thm add_divide_distrib}),
   17.78   	       (*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"*)
   17.79  	       (*^^^^^ *0* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*)
   17.80  	       Rls_ norm_Rational_noadd_fractions(**2**),
   17.81  	       Rls_ (*order_add_mult_in*) norm_System_noadd_fractions (**1**),
   17.82  	       Thm ("sym_mult_assoc",
   17.83 -                     num_str (@{thm mult.assoc} RS @{thm sym}))
   17.84 +                     TermC.num_str (@{thm mult.assoc} RS @{thm sym}))
   17.85  	       (*Rls_ discard_parentheses *3**),
   17.86  	       Rls_ collect_bdv, (*from make_polynomial_in WN051031 welldone?*)
   17.87  	       Rls_ separate_bdv2,
   17.88 @@ -288,7 +288,7 @@
   17.89  val simplify_System = 
   17.90      append_rls "simplify_System" simplify_System_parenthesized
   17.91  	       [Thm ("sym_add_assoc",
   17.92 -                      num_str (@{thm add.assoc} RS @{thm sym}))];
   17.93 +                      TermC.num_str (@{thm add.assoc} RS @{thm sym}))];
   17.94  *)
   17.95  *}
   17.96  ML {*
   17.97 @@ -302,9 +302,9 @@
   17.98  			    ], 
   17.99  			   srls = Erls, calc = [], errpatts = [],
  17.100  	      rules = 
  17.101 -             [Thm ("commute_0_equality", num_str @{thm commute_0_equality}),
  17.102 -	      Thm ("separate_bdvs_add", num_str @{thm separate_bdvs_add}),
  17.103 -	      Thm ("separate_bdvs_mult", num_str @{thm separate_bdvs_mult})],
  17.104 +             [Thm ("commute_0_equality", TermC.num_str @{thm commute_0_equality}),
  17.105 +	      Thm ("separate_bdvs_add", TermC.num_str @{thm separate_bdvs_add}),
  17.106 +	      Thm ("separate_bdvs_mult", TermC.num_str @{thm separate_bdvs_mult})],
  17.107  	      scr = EmptyScr};
  17.108  *}
  17.109  ML {*
  17.110 @@ -318,15 +318,15 @@
  17.111  		     Calc ("Atools.ident",eval_ident "#ident_"),
  17.112  		     Calc ("Atools.some'_occur'_in", 
  17.113  			   eval_some_occur_in "#some_occur_in_"),
  17.114 -                     Thm ("not_true",num_str @{thm not_true}),
  17.115 -		     Thm ("not_false",num_str @{thm not_false})
  17.116 +                     Thm ("not_true",TermC.num_str @{thm not_true}),
  17.117 +		     Thm ("not_false",TermC.num_str @{thm not_false})
  17.118  			    ], 
  17.119  	 srls = Erls, calc = [], errpatts = [],
  17.120 -	 rules = [Thm ("commute_0_equality", num_str @{thm commute_0_equality}),
  17.121 -		  Thm ("separate_bdvs0", num_str @{thm separate_bdvs0}),
  17.122 -		  Thm ("separate_bdvs_add1", num_str @{thm separate_bdvs_add1}),
  17.123 -		  Thm ("separate_bdvs_add1", num_str @{thm separate_bdvs_add2}),
  17.124 -		  Thm ("separate_bdvs_mult", num_str @{thm separate_bdvs_mult})
  17.125 +	 rules = [Thm ("commute_0_equality", TermC.num_str @{thm commute_0_equality}),
  17.126 +		  Thm ("separate_bdvs0", TermC.num_str @{thm separate_bdvs0}),
  17.127 +		  Thm ("separate_bdvs_add1", TermC.num_str @{thm separate_bdvs_add1}),
  17.128 +		  Thm ("separate_bdvs_add1", TermC.num_str @{thm separate_bdvs_add2}),
  17.129 +		  Thm ("separate_bdvs_mult", TermC.num_str @{thm separate_bdvs_mult})
  17.130                   ], scr = EmptyScr};
  17.131  
  17.132  *}
  17.133 @@ -339,7 +339,7 @@
  17.134  	 rew_ord = ("ord_simplify_System", 
  17.135  		    ord_simplify_System false thy), 
  17.136  	 erls = Erls, srls = Erls, calc = [], errpatts = [],
  17.137 -	 rules = [Thm ("order_system_NxN", num_str @{thm order_system_NxN})
  17.138 +	 rules = [Thm ("order_system_NxN", TermC.num_str @{thm order_system_NxN})
  17.139  		  ],
  17.140  	 scr = EmptyScr};
  17.141  
  17.142 @@ -357,11 +357,11 @@
  17.143  			      ],
  17.144  		     scr = EmptyScr}, 
  17.145  	 srls = Erls, calc = [], errpatts = [],
  17.146 -	 rules = [Thm ("NTH_CONS",num_str @{thm NTH_CONS}),
  17.147 +	 rules = [Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
  17.148  		  Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  17.149 -		  Thm ("NTH_NIL",num_str @{thm NTH_NIL}),
  17.150 -		  Thm ("tl_Cons",num_str @{thm tl_Cons}),
  17.151 -		  Thm ("tl_Nil",num_str @{thm tl_Nil}),
  17.152 +		  Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}),
  17.153 +		  Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}),
  17.154 +		  Thm ("tl_Nil",TermC.num_str @{thm tl_Nil}),
  17.155  		  Calc ("EqSystem.occur'_exactly'_in", 
  17.156  			eval_occur_exactly_in 
  17.157  			    "#eval_occur_exactly_in_")
  17.158 @@ -386,11 +386,11 @@
  17.159  			      ],
  17.160  		     scr = EmptyScr}, 
  17.161  	 srls = Erls, calc = [], errpatts = [],
  17.162 -	 rules = [Thm ("NTH_CONS",num_str @{thm NTH_CONS}),
  17.163 +	 rules = [Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
  17.164  		  Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  17.165 -		  Thm ("NTH_NIL",num_str @{thm NTH_NIL}),
  17.166 -		  Thm ("tl_Cons",num_str @{thm tl_Cons}),
  17.167 -		  Thm ("tl_Nil",num_str @{thm tl_Nil}),
  17.168 +		  Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}),
  17.169 +		  Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}),
  17.170 +		  Thm ("tl_Nil",TermC.num_str @{thm tl_Nil}),
  17.171  		  Calc ("EqSystem.occur'_exactly'_in", 
  17.172  			eval_occur_exactly_in 
  17.173  			    "#eval_occur_exactly_in_")
  17.174 @@ -430,8 +430,8 @@
  17.175            ("#Where"  ,["LENGTH (e_s:: bool list) = 2", "LENGTH v_s = 2"]),
  17.176            ("#Find"  ,["solution ss'''"])],
  17.177          append_rls "prls_2x2_linear_system" e_rls 
  17.178 -			    [Thm ("LENGTH_CONS",num_str @{thm LENGTH_CONS}),
  17.179 -			      Thm ("LENGTH_NIL",num_str @{thm LENGTH_NIL}),
  17.180 +			    [Thm ("LENGTH_CONS",TermC.num_str @{thm LENGTH_CONS}),
  17.181 +			      Thm ("LENGTH_NIL",TermC.num_str @{thm LENGTH_NIL}),
  17.182  			      Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  17.183  			      Calc ("HOL.eq",eval_equal "#equal_")], 
  17.184          SOME "solveSystem e_s v_s", [])),
  17.185 @@ -457,8 +457,8 @@
  17.186            ("#Where"  ,["LENGTH (e_s:: bool list) = 3", "LENGTH v_s = 3"]),
  17.187            ("#Find"  ,["solution ss'''"])],
  17.188          append_rls "prls_3x3_linear_system" e_rls 
  17.189 -			    [Thm ("LENGTH_CONS",num_str @{thm LENGTH_CONS}),
  17.190 -			      Thm ("LENGTH_NIL",num_str @{thm LENGTH_NIL}),
  17.191 +			    [Thm ("LENGTH_CONS",TermC.num_str @{thm LENGTH_CONS}),
  17.192 +			      Thm ("LENGTH_NIL",TermC.num_str @{thm LENGTH_NIL}),
  17.193  			      Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  17.194  			      Calc ("HOL.eq",eval_equal "#equal_")],
  17.195          SOME "solveSystem e_s v_s", [])),
  17.196 @@ -469,8 +469,8 @@
  17.197            ("#Where"  ,["LENGTH (e_s:: bool list) = 4", "LENGTH v_s = 4"]),
  17.198            ("#Find"  ,["solution ss'''"])],
  17.199          append_rls "prls_4x4_linear_system" e_rls 
  17.200 -			    [Thm ("LENGTH_CONS",num_str @{thm LENGTH_CONS}),
  17.201 -			      Thm ("LENGTH_NIL",num_str @{thm LENGTH_NIL}),
  17.202 +			    [Thm ("LENGTH_CONS",TermC.num_str @{thm LENGTH_CONS}),
  17.203 +			      Thm ("LENGTH_NIL",TermC.num_str @{thm LENGTH_NIL}),
  17.204  			      Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  17.205  			      Calc ("HOL.eq",eval_equal "#equal_")],
  17.206          SOME "solveSystem e_s v_s", [])),
  17.207 @@ -508,9 +508,9 @@
  17.208  				   Calc("Groups.plus_class.plus", eval_binop "#add_")
  17.209  				   ], 
  17.210  		srls = Erls, calc = [], errpatts = [],
  17.211 -		rules = [Thm ("NTH_CONS",num_str @{thm NTH_CONS}),
  17.212 +		rules = [Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
  17.213  			 Calc("Groups.plus_class.plus", eval_binop "#add_"),
  17.214 -			 Thm ("NTH_NIL",num_str @{thm NTH_NIL})],
  17.215 +			 Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL})],
  17.216  		scr = EmptyScr};
  17.217  *}
  17.218  
  17.219 @@ -535,9 +535,9 @@
  17.220            ("#Find"  ,["solution ss'''"])],
  17.221  	      {rew_ord'="ord_simplify_System", rls' = Erls, calc = [], 
  17.222  	        srls = append_rls "srls_top_down_2x2" e_rls
  17.223 -				      [Thm ("hd_thm",num_str @{thm hd_thm}),
  17.224 -				        Thm ("tl_Cons",num_str @{thm tl_Cons}),
  17.225 -				        Thm ("tl_Nil",num_str @{thm tl_Nil})], 
  17.226 +				      [Thm ("hd_thm",TermC.num_str @{thm hd_thm}),
  17.227 +				        Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}),
  17.228 +				        Thm ("tl_Nil",TermC.num_str @{thm tl_Nil})], 
  17.229  	        prls = prls_triangular, crls = Erls, errpats = [], nrls = Erls},
  17.230  	      "Script SolveSystemScript (e_s::bool list) (v_s::real list) =                " ^
  17.231            "  (let e_1 = Take (hd e_s);                                                " ^
  17.232 @@ -583,9 +583,9 @@
  17.233  		      ("#Find"  ,["solution ss'''"])],
  17.234  	      {rew_ord'="tless_true", rls' = Erls, calc = [], 
  17.235  	        srls = append_rls "srls_normalise_2x2" e_rls
  17.236 -				      [Thm ("hd_thm",num_str @{thm hd_thm}),
  17.237 -				        Thm ("tl_Cons",num_str @{thm tl_Cons}),
  17.238 -				        Thm ("tl_Nil",num_str @{thm tl_Nil})], 
  17.239 +				      [Thm ("hd_thm",TermC.num_str @{thm hd_thm}),
  17.240 +				        Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}),
  17.241 +				        Thm ("tl_Nil",TermC.num_str @{thm tl_Nil})], 
  17.242  		      prls = Erls, crls = Erls, errpats = [], nrls = Erls},
  17.243  		    "Script SolveSystemScript (e_s::bool list) (v_s::real list) =                " ^
  17.244            "  (let e__s = ((Try (Rewrite_Set norm_Rational False)) @@                   " ^
  17.245 @@ -604,9 +604,9 @@
  17.246  	         ("#Find"  ,["solution ss'''"])],
  17.247  	       {rew_ord'="tless_true", rls' = Erls, calc = [], 
  17.248  	         srls = append_rls "srls_normalise_4x4" srls
  17.249 -	             [Thm ("hd_thm",num_str @{thm hd_thm}),
  17.250 -	               Thm ("tl_Cons",num_str @{thm tl_Cons}),
  17.251 -	               Thm ("tl_Nil",num_str @{thm tl_Nil})], 
  17.252 +	             [Thm ("hd_thm",TermC.num_str @{thm hd_thm}),
  17.253 +	               Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}),
  17.254 +	               Thm ("tl_Nil",TermC.num_str @{thm tl_Nil})], 
  17.255  		       prls = Erls, crls = Erls, errpats = [], nrls = Erls},
  17.256  		     (*STOPPED.WN06? met ["EqSystem","normalise","4x4"] @@@@@@@@@@@@@@@@@@@@@@@@@@@*)
  17.257  		     "Script SolveSystemScript (e_s::bool list) (v_s::real list) =                " ^
    18.1 --- a/src/Tools/isac/Knowledge/Equation.thy	Sun Feb 25 16:31:17 2018 +0100
    18.2 +++ b/src/Tools/isac/Knowledge/Equation.thy	Fri Mar 02 14:19:59 2018 +0100
    18.3 @@ -71,17 +71,17 @@
    18.4  				  "solveTest (x+1=2, x)");
    18.5     *)
    18.6  fun argl2dtss [Const ("Product_Type.Pair", _) $ eq $ bdv] =
    18.7 -    [((the o (parseNEW ctxt)) "equality", [eq]),
    18.8 -     ((the o (parseNEW ctxt)) "solveFor", [bdv]),
    18.9 -     ((the o (parseNEW ctxt)) "solutions", 
   18.10 -      [(the o (parseNEW ctxt)) "L"])
   18.11 +    [((the o (TermC.parseNEW ctxt)) "equality", [eq]),
   18.12 +     ((the o (TermC.parseNEW ctxt)) "solveFor", [bdv]),
   18.13 +     ((the o (TermC.parseNEW ctxt)) "solutions", 
   18.14 +      [(the o (TermC.parseNEW ctxt)) "L"])
   18.15       ]
   18.16    | argl2dtss _ = error "Equation.ML: wrong argument for argl2dtss";
   18.17  *}
   18.18  setup {* KEStore_Elems.add_cas
   18.19 -  [((Thm.term_of o the o (parse thy)) "solveTest", 
   18.20 +  [((Thm.term_of o the o (TermC.parse thy)) "solveTest", 
   18.21        (("Test", ["univariate","equation","test"], ["no_met"]), argl2dtss)),
   18.22 -    ((Thm.term_of o the o (parse thy)) "solve",
   18.23 +    ((Thm.term_of o the o (TermC.parse thy)) "solve",
   18.24        (("Isac", ["univariate","equation"], ["no_met"]), argl2dtss))]*}
   18.25  
   18.26  
    19.1 --- a/src/Tools/isac/Knowledge/InsSort.thy	Sun Feb 25 16:31:17 2018 +0100
    19.2 +++ b/src/Tools/isac/Knowledge/InsSort.thy	Fri Mar 02 14:19:59 2018 +0100
    19.3 @@ -63,7 +63,7 @@
    19.4  	    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) *)),
    19.5  	    Thm ("if_True", @{thm if_True} (* "(if True then x else y) = x" *)),
    19.6  	    Thm ("if_False", @{thm if_False} (* "(if False then x else y) = y" *))],
    19.7 -	  errpatts = [], scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")};      
    19.8 +	  errpatts = [], scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")};      
    19.9  *}
   19.10  setup {* KEStore_Elems.add_rlss [("ins_sort", (Context.theory_name @{theory}, ins_sort))] *}
   19.11  
    20.1 --- a/src/Tools/isac/Knowledge/Integrate.thy	Sun Feb 25 16:31:17 2018 +0100
    20.2 +++ b/src/Tools/isac/Knowledge/Integrate.thy	Fri Mar 02 14:19:59 2018 +0100
    20.3 @@ -58,14 +58,14 @@
    20.4      let fun selc var = 
    20.5  	    case (Symbol.explode o id_of) var of
    20.6  		"c"::[] => true
    20.7 -	      |	"c"::"_"::is => (case (int_of_str o implode) is of
    20.8 +	      |	"c"::"_"::is => (case (TermC.int_of_str o implode) is of
    20.9  				     SOME _ => true
   20.10  				   | NONE => false)
   20.11                | _ => false;
   20.12  	fun get_coeff c = case (Symbol.explode o id_of) c of
   20.13 -	      		      "c"::"_"::is => (the o int_of_str o implode) is
   20.14 +	      		      "c"::"_"::is => (the o TermC.int_of_str o implode) is
   20.15  			    | _ => 0;
   20.16 -        val cs = filter selc (vars term);
   20.17 +        val cs = filter selc (TermC.vars term);
   20.18      in 
   20.19  	case cs of
   20.20  	    [] => c
   20.21 @@ -90,10 +90,10 @@
   20.22  fun eval_add_new_c (_:string) "Integrate.add'_new'_c" p (_:theory) =
   20.23      let val p' = case p of
   20.24  		     Const ("HOL.eq", T) $ lh $ rh => 
   20.25 -		     Const ("HOL.eq", T) $ lh $ mk_add rh (new_c rh)
   20.26 -		   | p => mk_add p (new_c p)
   20.27 +		     Const ("HOL.eq", T) $ lh $ TermC.mk_add rh (new_c rh)
   20.28 +		   | p => TermC.mk_add p (new_c p)
   20.29      in SOME ((term2str p) ^ " = " ^ term2str p',
   20.30 -	  Trueprop $ (mk_equality (p, p')))
   20.31 +	  TermC.Trueprop $ (TermC.mk_equality (p, p')))
   20.32      end
   20.33    | eval_add_new_c _ _ _ _ = NONE;
   20.34  
   20.35 @@ -101,11 +101,11 @@
   20.36  (*("is_f_x", ("Integrate.is'_f'_x", eval_is_f_x "is_f_x_"))*)
   20.37  fun eval_is_f_x _ _(p as (Const ("Integrate.is'_f'_x", _)
   20.38  					   $ arg)) _ =
   20.39 -    if is_f_x arg
   20.40 +    if TermC.is_f_x arg
   20.41      then SOME ((term2str p) ^ " = True",
   20.42 -	       Trueprop $ (mk_equality (p, @{term True})))
   20.43 +	       TermC.Trueprop $ (TermC.mk_equality (p, @{term True})))
   20.44      else SOME ((term2str p) ^ " = False",
   20.45 -	       Trueprop $ (mk_equality (p, @{term False})))
   20.46 +	       TermC.Trueprop $ (TermC.mk_equality (p, @{term False})))
   20.47    | eval_is_f_x _ _ _ _ = NONE;
   20.48  *}
   20.49  setup {* KEStore_Elems.add_calcs
   20.50 @@ -126,17 +126,17 @@
   20.51  		     rules = [(*for rewriting conditions in Thm's*)
   20.52  			      Calc ("Atools.occurs'_in", 
   20.53  				    eval_occurs_in "#occurs_in_"),
   20.54 -			      Thm ("not_true",num_str @{thm not_true}),
   20.55 +			      Thm ("not_true", @{thm not_true}),
   20.56  			      Thm ("not_false",@{thm not_false})
   20.57  			      ],
   20.58  		     scr = EmptyScr}, 
   20.59  	 srls = Erls, calc = [], errpatts = [],
   20.60  	 rules = [
   20.61 -		  Thm ("integral_const",num_str @{thm integral_const}),
   20.62 -		  Thm ("integral_var",num_str @{thm integral_var}),
   20.63 -		  Thm ("integral_add",num_str @{thm integral_add}),
   20.64 -		  Thm ("integral_mult",num_str @{thm integral_mult}),
   20.65 -		  Thm ("integral_pow",num_str @{thm integral_pow}),
   20.66 +		  Thm ("integral_const", @{thm integral_const}),
   20.67 +		  Thm ("integral_var", @{thm integral_var}),
   20.68 +		  Thm ("integral_add", @{thm integral_add}),
   20.69 +		  Thm ("integral_mult", @{thm integral_mult}),
   20.70 +		  Thm ("integral_pow", @{thm integral_pow}),
   20.71  		  Calc ("Groups.plus_class.plus", eval_binop "#add_")(*for n+1*)
   20.72  		  ],
   20.73  	 scr = EmptyScr};
   20.74 @@ -153,12 +153,12 @@
   20.75  		     rules = [Calc ("Tools.matches", eval_matches""),
   20.76  			      Calc ("Integrate.is'_f'_x", 
   20.77  				    eval_is_f_x "is_f_x_"),
   20.78 -			      Thm ("not_true",num_str @{thm not_true}),
   20.79 -			      Thm ("not_false",num_str @{thm not_false})
   20.80 +			      Thm ("not_true", @{thm not_true}),
   20.81 +			      Thm ("not_false", @{thm not_false})
   20.82  			      ],
   20.83  		     scr = EmptyScr}, 
   20.84  	 srls = Erls, calc = [], errpatts = [],
   20.85 -	 rules = [ (*Thm ("call_for_new_c", num_str @{thm call_for_new_c}),*)
   20.86 +	 rules = [ (*Thm ("call_for_new_c",  @{thm call_for_new_c}),*)
   20.87  		   Cal1 ("Integrate.add'_new'_c", eval_add_new_c "new_c_")
   20.88  		   ],
   20.89  	 scr = EmptyScr};
   20.90 @@ -181,34 +181,34 @@
   20.91  				  [Calc ("Poly.is'_polyexp", 
   20.92  					 eval_is_polyexp "")],
   20.93  				  srls = Erls, calc = [], errpatts = [],
   20.94 -				  rules = [Thm ("rat_mult",num_str @{thm rat_mult}),
   20.95 +				  rules = [Thm ("rat_mult", @{thm rat_mult}),
   20.96  	       (*"?a / ?b * (?c / ?d) = ?a * ?c / (?b * ?d)"*)
   20.97 -	       Thm ("rat_mult_poly_l",num_str @{thm rat_mult_poly_l}),
   20.98 +	       Thm ("rat_mult_poly_l", @{thm rat_mult_poly_l}),
   20.99  	       (*"?c is_polyexp ==> ?c * (?a / ?b) = ?c * ?a / ?b"*)
  20.100 -	       Thm ("rat_mult_poly_r",num_str @{thm rat_mult_poly_r}),
  20.101 +	       Thm ("rat_mult_poly_r", @{thm rat_mult_poly_r}),
  20.102  	       (*"?c is_polyexp ==> ?a / ?b * ?c = ?a * ?c / ?b"*)
  20.103  
  20.104  	       Thm ("real_divide_divide1_mg",
  20.105 -                     num_str @{thm real_divide_divide1_mg}),
  20.106 +                      @{thm real_divide_divide1_mg}),
  20.107  	       (*"y ~= 0 ==> (u / v) / (y / z) = (u * z) / (y * v)"*)
  20.108  	       Thm ("divide_divide_eq_right", 
  20.109 -                     num_str @{thm divide_divide_eq_right}),
  20.110 +                      @{thm divide_divide_eq_right}),
  20.111  	       (*"?x / (?y / ?z) = ?x * ?z / ?y"*)
  20.112  	       Thm ("divide_divide_eq_left",
  20.113 -                     num_str @{thm divide_divide_eq_left}),
  20.114 +                      @{thm divide_divide_eq_left}),
  20.115  	       (*"?x / ?y / ?z = ?x / (?y * ?z)"*)
  20.116  	       Calc ("Rings.divide_class.divide"  ,eval_cancel "#divide_e"),
  20.117  	      
  20.118 -	       Thm ("rat_power", num_str @{thm rat_power})
  20.119 +	       Thm ("rat_power",  @{thm rat_power})
  20.120  		(*"(?a / ?b) ^^^ ?n = ?a ^^^ ?n / ?b ^^^ ?n"*)
  20.121  	       ],
  20.122 -      scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
  20.123 +      scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  20.124        }),
  20.125  		Rls_ make_rat_poly_with_parentheses,
  20.126  		Rls_ cancel_p_rls,(*FIXME:cancel_p does NOT order sometimes*)
  20.127  		Rls_ rat_reduce_1
  20.128  		],
  20.129 -       scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
  20.130 +       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  20.131         }:rls;
  20.132  
  20.133  (*.for simplify_Integral adapted from 'norm_Rational'.*)
  20.134 @@ -223,7 +223,7 @@
  20.135  		Rls_ norm_Rational_rls_noadd_fractions,(* the main rls (#)   *)
  20.136  		Rls_ discard_parentheses1 (* mult only                       *)
  20.137  		],
  20.138 -       scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
  20.139 +       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  20.140         }:rls;
  20.141  
  20.142  (*.simplify terms before and after Integration such that  
  20.143 @@ -235,15 +235,15 @@
  20.144  val separate_bdv2 =
  20.145      append_rls "separate_bdv2"
  20.146  	       collect_bdv
  20.147 -	       [Thm ("separate_bdv", num_str @{thm separate_bdv}),
  20.148 +	       [Thm ("separate_bdv",  @{thm separate_bdv}),
  20.149  		(*"?a * ?bdv / ?b = ?a / ?b * ?bdv"*)
  20.150 -		Thm ("separate_bdv_n", num_str @{thm separate_bdv_n}),
  20.151 -		Thm ("separate_1_bdv", num_str @{thm separate_1_bdv}),
  20.152 +		Thm ("separate_bdv_n",  @{thm separate_bdv_n}),
  20.153 +		Thm ("separate_1_bdv",  @{thm separate_1_bdv}),
  20.154  		(*"?bdv / ?b = (1 / ?b) * ?bdv"*)
  20.155 -		Thm ("separate_1_bdv_n", num_str @{thm separate_1_bdv_n})(*,
  20.156 +		Thm ("separate_1_bdv_n",  @{thm separate_1_bdv_n})(*,
  20.157  			  (*"?bdv ^^^ ?n / ?b = 1 / ?b * ?bdv ^^^ ?n"*)
  20.158  			  *****Thm ("add_divide_distrib", 
  20.159 -			  *****num_str @{thm add_divide_distrib})
  20.160 +			  ***** @{thm add_divide_distrib})
  20.161  			  (*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"*)----------*)
  20.162  		];
  20.163  val simplify_Integral = 
  20.164 @@ -251,9 +251,9 @@
  20.165         rew_ord = ("dummy_ord", dummy_ord),
  20.166        erls = Atools_erls, srls = Erls,
  20.167        calc = [],  errpatts = [],
  20.168 -      rules = [Thm ("distrib_right",num_str @{thm distrib_right}),
  20.169 +      rules = [Thm ("distrib_right", @{thm distrib_right}),
  20.170   	       (*"(?z1.0 + ?z2.0) * ?w = ?z1.0 * ?w + ?z2.0 * ?w"*)
  20.171 -	       Thm ("add_divide_distrib",num_str @{thm add_divide_distrib}),
  20.172 +	       Thm ("add_divide_distrib", @{thm add_divide_distrib}),
  20.173   	       (*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"*)
  20.174  	       (*^^^^^ *1* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*)
  20.175  	       Rls_ norm_Rational_noadd_fractions,
  20.176 @@ -282,21 +282,21 @@
  20.177  * 	       Rls_ simplify_power,
  20.178  * 	       Rls_ collect_numerals,
  20.179  * 	       Rls_ reduce_012,
  20.180 -* 	       Thm ("realpow_oneI",num_str @{thm realpow_oneI}),
  20.181 +* 	       Thm ("realpow_oneI", @{thm realpow_oneI}),
  20.182  * 	       Rls_ discard_parentheses,
  20.183  * 	       Rls_ collect_bdv,
  20.184  * 	       (*below inserted from 'make_ratpoly_in'*)
  20.185  * 	       Rls_ (append_rls "separate_bdv"
  20.186  * 			 collect_bdv
  20.187 -* 			 [Thm ("separate_bdv", num_str @{thm separate_bdv}),
  20.188 +* 			 [Thm ("separate_bdv",  @{thm separate_bdv}),
  20.189  * 			  (*"?a * ?bdv / ?b = ?a / ?b * ?bdv"*)
  20.190 -* 			  Thm ("separate_bdv_n", num_str @{thm separate_bdv_n}),
  20.191 -* 			  Thm ("separate_1_bdv", num_str @{thm separate_1_bdv}),
  20.192 +* 			  Thm ("separate_bdv_n",  @{thm separate_bdv_n}),
  20.193 +* 			  Thm ("separate_1_bdv",  @{thm separate_1_bdv}),
  20.194  * 			  (*"?bdv / ?b = (1 / ?b) * ?bdv"*)
  20.195 -* 			  Thm ("separate_1_bdv_n", num_str @{thm separate_1_bdv_n})(*,
  20.196 +* 			  Thm ("separate_1_bdv_n",  @{thm separate_1_bdv_n})(*,
  20.197  * 			  (*"?bdv ^^^ ?n / ?b = 1 / ?b * ?bdv ^^^ ?n"*)
  20.198  * 			  Thm ("add_divide_distrib", 
  20.199 -* 				 num_str @{thm add_divide_distrib})
  20.200 +* 				  @{thm add_divide_distrib})
  20.201  * 			   (*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"*)*)
  20.202  * 			  ]),
  20.203  * 	       Calc ("Rings.divide_class.divide"  ,eval_cancel "#divide_e")
    21.1 --- a/src/Tools/isac/Knowledge/Inverse_Z_Transform.thy	Sun Feb 25 16:31:17 2018 +0100
    21.2 +++ b/src/Tools/isac/Knowledge/Inverse_Z_Transform.thy	Fri Mar 02 14:19:59 2018 +0100
    21.3 @@ -32,7 +32,7 @@
    21.4  	  erls = Erls, srls = Erls, calc = [], errpatts = [],
    21.5  	  rules = 
    21.6  	   [
    21.7 -    Thm ("rule4",num_str @{thm rule4})
    21.8 +    Thm ("rule4", @{thm rule4})
    21.9  	   ], 
   21.10  	 scr = EmptyScr}:rls);
   21.11  *}
   21.12 @@ -188,9 +188,9 @@
   21.13                      (*2nd NTH_CONS pushes n+-1 into asms*)
   21.14                      Calc("Groups.plus_class.plus", eval_binop "#add_")], 
   21.15                srls = Erls, calc = [], errpatts = [],
   21.16 -              rules = [Thm ("NTH_CONS",num_str @{thm NTH_CONS}),
   21.17 +              rules = [Thm ("NTH_CONS", @{thm NTH_CONS}),
   21.18                    Calc ("Groups.plus_class.plus", eval_binop "#add_"),
   21.19 -                  Thm ("NTH_NIL",num_str @{thm NTH_NIL}),
   21.20 +                  Thm ("NTH_NIL", @{thm NTH_NIL}),
   21.21                    Calc ("Tools.lhs", eval_lhs "eval_lhs_"),
   21.22                    Calc ("Tools.rhs", eval_rhs"eval_rhs_"),
   21.23                    Calc ("Atools.argument'_in", eval_argument_in "Atools.argument'_in"),
    22.1 --- a/src/Tools/isac/Knowledge/LinEq.thy	Sun Feb 25 16:31:17 2018 +0100
    22.2 +++ b/src/Tools/isac/Knowledge/LinEq.thy	Fri Mar 02 14:19:59 2018 +0100
    22.3 @@ -41,17 +41,17 @@
    22.4   	      Calc ("Poly.is'_polyrat'_in",eval_is_polyrat_in ""),
    22.5  	      Calc ("Atools.occurs'_in",eval_occurs_in ""),    
    22.6  	      Calc ("Atools.ident",eval_ident "#ident_"),
    22.7 -	      Thm ("not_true",num_str @{thm not_true}),
    22.8 -	      Thm ("not_false",num_str @{thm not_false}),
    22.9 -	      Thm ("and_true",num_str @{thm and_true}),
   22.10 -	      Thm ("and_false",num_str @{thm and_false}),
   22.11 -	      Thm ("or_true",num_str @{thm or_true}),
   22.12 -	      Thm ("or_false",num_str @{thm or_false})
   22.13 +	      Thm ("not_true",TermC.num_str @{thm not_true}),
   22.14 +	      Thm ("not_false",TermC.num_str @{thm not_false}),
   22.15 +	      Thm ("and_true",TermC.num_str @{thm and_true}),
   22.16 +	      Thm ("and_false",TermC.num_str @{thm and_false}),
   22.17 +	      Thm ("or_true",TermC.num_str @{thm or_true}),
   22.18 +	      Thm ("or_false",TermC.num_str @{thm or_false})
   22.19                ];
   22.20  (* ----- erls ----- *)
   22.21  val LinEq_crls = 
   22.22     append_rls "LinEq_crls" poly_crls
   22.23 -   [Thm  ("real_assoc_1",num_str @{thm real_assoc_1})
   22.24 +   [Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1})
   22.25      (*		
   22.26       Don't use
   22.27       Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),
   22.28 @@ -62,7 +62,7 @@
   22.29  (* ----- crls ----- *)
   22.30  val LinEq_erls = 
   22.31     append_rls "LinEq_erls" Poly_erls
   22.32 -   [Thm  ("real_assoc_1",num_str @{thm real_assoc_1})
   22.33 +   [Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1})
   22.34      (*		
   22.35       Don't use
   22.36       Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),
   22.37 @@ -81,7 +81,7 @@
   22.38         srls = Erls, 
   22.39         calc = [], errpatts = [],
   22.40         rules = [
   22.41 -		Thm  ("real_assoc_1",num_str @{thm real_assoc_1}),
   22.42 +		Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1}),
   22.43  		Calc ("Groups.plus_class.plus",eval_binop "#add_"),
   22.44  		Calc ("Groups.minus_class.minus",eval_binop "#sub_"),
   22.45  		Calc ("Groups.times_class.times",eval_binop "#mult_"),
   22.46 @@ -105,11 +105,11 @@
   22.47       srls = Erls,
   22.48       calc = [], errpatts = [],
   22.49       rules = [
   22.50 -	      Thm("lin_isolate_add1",num_str @{thm lin_isolate_add1}), 
   22.51 +	      Thm("lin_isolate_add1",TermC.num_str @{thm lin_isolate_add1}), 
   22.52  	      (* a+bx=0 -> bx=-a *)
   22.53 -	      Thm("lin_isolate_add2",num_str @{thm lin_isolate_add2}), 
   22.54 +	      Thm("lin_isolate_add2",TermC.num_str @{thm lin_isolate_add2}), 
   22.55  	      (* a+ x=0 ->  x=-a *)
   22.56 -	      Thm("lin_isolate_div",num_str @{thm lin_isolate_div})    
   22.57 +	      Thm("lin_isolate_div",TermC.num_str @{thm lin_isolate_div})    
   22.58  	      (*   bx=c -> x=c/b *)  
   22.59  	      ],
   22.60       scr = EmptyScr}:rls);
    23.1 --- a/src/Tools/isac/Knowledge/Partial_Fractions.thy	Sun Feb 25 16:31:17 2018 +0100
    23.2 +++ b/src/Tools/isac/Knowledge/Partial_Fractions.thy	Fri Mar 02 14:19:59 2018 +0100
    23.3 @@ -59,8 +59,8 @@
    23.4  fun eval_factors_from_solution (thmid:string) _
    23.5       (t as Const ("Partial_Fractions.factors_from_solution", _) $ sol) thy =
    23.6         ((let val prod = factors_from_solution sol
    23.7 -         in SOME (mk_thmid thmid "" (term_to_string''' thy prod) "",
    23.8 -              Trueprop $ (mk_equality (t, prod)))
    23.9 +         in SOME (TermC.mk_thmid thmid "" (term_to_string''' thy prod) "",
   23.10 +              TermC.Trueprop $ (TermC.mk_equality (t, prod)))
   23.11           end)
   23.12         handle _ => NONE)
   23.13   | eval_factors_from_solution _ _ _ _ = NONE;
   23.14 @@ -71,12 +71,12 @@
   23.15  (*("drop_questionmarks", ("Partial_Fractions.drop_questionmarks", eval_drop_questionmarks ""))*)
   23.16  fun eval_drop_questionmarks (thmid:string) _
   23.17       (t as Const ("Partial_Fractions.drop_questionmarks", _) $ tm) thy =
   23.18 -        if contains_Var tm
   23.19 +        if TermC.contains_Var tm
   23.20          then
   23.21            let
   23.22 -            val tm' = var2free tm
   23.23 -            in SOME (mk_thmid thmid "" (term_to_string''' thy tm') "",
   23.24 -                 Trueprop $ (mk_equality (t, tm')))
   23.25 +            val tm' = TermC.var2free tm
   23.26 +            in SOME (TermC.mk_thmid thmid "" (term_to_string''' thy tm') "",
   23.27 +                 TermC.Trueprop $ (TermC.mk_equality (t, tm')))
   23.28              end
   23.29          else NONE
   23.30    | eval_drop_questionmarks _ _ _ _ = NONE;
   23.31 @@ -128,8 +128,8 @@
   23.32    Rls {id = "ansatz_rls", preconds = [], rew_ord = ("dummy_ord",dummy_ord), 
   23.33  	  erls = Erls, srls = Erls, calc = [], errpatts = [],
   23.34  	  rules = 
   23.35 -	   [Thm ("ansatz_2nd_order",num_str @{thm ansatz_2nd_order}),
   23.36 -	    Thm ("ansatz_3rd_order",num_str @{thm ansatz_3rd_order})
   23.37 +	   [Thm ("ansatz_2nd_order",TermC.num_str @{thm ansatz_2nd_order}),
   23.38 +	    Thm ("ansatz_3rd_order",TermC.num_str @{thm ansatz_3rd_order})
   23.39  	   ], 
   23.40  	 scr = EmptyScr}:rls);
   23.41  
   23.42 @@ -137,8 +137,8 @@
   23.43    Rls {id = "equival_trans", preconds = [], rew_ord = ("dummy_ord",dummy_ord), 
   23.44  	  erls = Erls, srls = Erls, calc = [], errpatts = [],
   23.45  	  rules = 
   23.46 -	   [Thm ("equival_trans_2nd_order",num_str @{thm equival_trans_2nd_order}),
   23.47 -	    Thm ("equival_trans_3rd_order",num_str @{thm equival_trans_3rd_order})
   23.48 +	   [Thm ("equival_trans_2nd_order",TermC.num_str @{thm equival_trans_2nd_order}),
   23.49 +	    Thm ("equival_trans_3rd_order",TermC.num_str @{thm equival_trans_3rd_order})
   23.50  	   ], 
   23.51  	 scr = EmptyScr}:rls);
   23.52  
   23.53 @@ -147,7 +147,7 @@
   23.54  	  erls = Erls,
   23.55  	  srls = Erls, calc = [], errpatts = [],
   23.56  	  rules = 
   23.57 -	   [Thm ("multiply_2nd_order",num_str @{thm multiply_2nd_order})
   23.58 +	   [Thm ("multiply_2nd_order",TermC.num_str @{thm multiply_2nd_order})
   23.59  	   ], 
   23.60  	 scr = EmptyScr}:rls);
   23.61  *}
   23.62 @@ -196,9 +196,9 @@
   23.63         Calc("Groups.plus_class.plus", eval_binop "#add_")], 
   23.64      srls = Erls, calc = [], errpatts = [],
   23.65      rules = [
   23.66 -       Thm ("NTH_CONS",num_str @{thm NTH_CONS}),
   23.67 +       Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
   23.68         Calc("Groups.plus_class.plus", eval_binop "#add_"),
   23.69 -       Thm ("NTH_NIL",num_str @{thm NTH_NIL}),
   23.70 +       Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}),
   23.71         Calc("Tools.lhs", eval_lhs "eval_lhs_"),
   23.72         Calc("Tools.rhs", eval_rhs"eval_rhs_"),
   23.73         Calc("Atools.argument'_in", eval_argument_in "Atools.argument'_in"),
   23.74 @@ -214,11 +214,11 @@
   23.75  *}
   23.76  ML {*
   23.77  val ctxt = Proof_Context.init_global @{theory};
   23.78 -val SOME t = parseNEW ctxt "eqr = drop_questionmarks eqr";
   23.79 +val SOME t = TermC.parseNEW ctxt "eqr = drop_questionmarks eqr";
   23.80  *}
   23.81  ML {*
   23.82 -parseNEW ctxt "decomposedFunction p_p'''";
   23.83 -parseNEW ctxt "decomposedFunction";
   23.84 +TermC.parseNEW ctxt "decomposedFunction p_p'''";
   23.85 +TermC.parseNEW ctxt "decomposedFunction";
   23.86  *}
   23.87  
   23.88  (* current version, error outcommented *)
    24.1 --- a/src/Tools/isac/Knowledge/Poly.thy	Sun Feb 25 16:31:17 2018 +0100
    24.2 +++ b/src/Tools/isac/Knowledge/Poly.thy	Fri Mar 02 14:19:59 2018 +0100
    24.3 @@ -173,7 +173,7 @@
    24.4  
    24.5  (* is_polyrat_in becomes true, if no bdv is in the denominator of a fraction*)
    24.6  fun is_polyrat_in t v = 
    24.7 -    let fun coeff_in c v = member op = (vars c) v;
    24.8 +    let fun coeff_in c v = member op = (TermC.vars c) v;
    24.9     	fun finddivide (_ $ _ $ _ $ _) v = error("is_polyrat_in:")
   24.10  	    (* at the moment there is no term like this, but ....*)
   24.11  	  | finddivide (t as (Const ("Rings.divide_class.divide",_) $ _ $ b)) v = 
   24.12 @@ -187,14 +187,14 @@
   24.13  fun eval_is_polyrat_in _ _(p as (Const ("Poly.is'_polyrat'_in",_) $ t $ v)) _  =
   24.14      if is_polyrat_in t v 
   24.15      then SOME ((term2str p) ^ " = True",
   24.16 -	        Trueprop $ (mk_equality (p, @{term True})))
   24.17 +	        TermC.Trueprop $ (TermC.mk_equality (p, @{term True})))
   24.18      else SOME ((term2str p) ^ " = True",
   24.19 -	        Trueprop $ (mk_equality (p, @{term False})))
   24.20 +	        TermC.Trueprop $ (TermC.mk_equality (p, @{term False})))
   24.21    | eval_is_polyrat_in _ _ _ _ = ((*tracing"### no matches";*) NONE);
   24.22  
   24.23  local
   24.24      (*.a 'c is coefficient of v' if v does NOT occur in c.*)
   24.25 -    fun coeff_in c v = not (member op = (vars c) v);
   24.26 +    fun coeff_in c v = not (member op = (TermC.vars c) v);
   24.27      (* FIXME.WN100826 shift this into test--------------
   24.28       val v = (Thm.term_of o the o (parse thy)) "x";
   24.29       val t = (Thm.term_of o the o (parse thy)) "1";
   24.30 @@ -214,9 +214,9 @@
   24.31      fun factor_right_deg (*case 2*)
   24.32      	    (t as Const ("Groups.times_class.times",_) $ t1 $ 
   24.33      	       (Const ("Atools.pow",_) $ vv $ Free (d,_))) v =
   24.34 -    	if ((vv = v) andalso (coeff_in t1 v)) then SOME (int_of_str' d) else NONE
   24.35 +    	if ((vv = v) andalso (coeff_in t1 v)) then SOME (TermC.int_of_str' d) else NONE
   24.36        | factor_right_deg (t as Const ("Atools.pow",_) $ vv $ Free (d,_)) v =
   24.37 -    	if (vv = v) then SOME (int_of_str' d) else NONE
   24.38 +    	if (vv = v) then SOME (TermC.int_of_str' d) else NONE
   24.39        | factor_right_deg (t as Const ("Groups.times_class.times",_) $ t1 $ vv) v = 
   24.40      	if ((vv = v) andalso (coeff_in t1 v))then SOME 1 else NONE
   24.41        | factor_right_deg vv v =
   24.42 @@ -342,9 +342,9 @@
   24.43         (p as (Const ("Poly.is'_expanded'_in",_) $ t $ v)) _ =
   24.44      if is_expanded_in t v
   24.45      then SOME ((term2str p) ^ " = True",
   24.46 -	        Trueprop $ (mk_equality (p, @{term True})))
   24.47 +	        TermC.Trueprop $ (TermC.mk_equality (p, @{term True})))
   24.48      else SOME ((term2str p) ^ " = True",
   24.49 -	        Trueprop $ (mk_equality (p, @{term False})))
   24.50 +	        TermC.Trueprop $ (TermC.mk_equality (p, @{term False})))
   24.51    | eval_is_expanded_in _ _ _ _ = NONE;
   24.52  (*
   24.53   val t = (Thm.term_of o the o (parse thy)) "(-8 - 2*x + x^^^2) is_expanded_in x";
   24.54 @@ -359,9 +359,9 @@
   24.55         (p as (Const ("Poly.is'_poly'_in",_) $ t $ v)) _ =
   24.56      if is_poly_in t v
   24.57      then SOME ((term2str p) ^ " = True",
   24.58 -	        Trueprop $ (mk_equality (p, @{term True})))
   24.59 +	        TermC.Trueprop $ (TermC.mk_equality (p, @{term True})))
   24.60      else SOME ((term2str p) ^ " = True",
   24.61 -	        Trueprop $ (mk_equality (p, @{term False})))
   24.62 +	        TermC.Trueprop $ (TermC.mk_equality (p, @{term False})))
   24.63    | eval_is_poly_in _ _ _ _ = NONE;
   24.64  (*
   24.65   val t = (Thm.term_of o the o (parse thy)) "(8 + 2*x + x^^^2) is_poly_in x";
   24.66 @@ -375,9 +375,9 @@
   24.67  fun eval_has_degree_in _ _ 
   24.68  	     (p as (Const ("Poly.has'_degree'_in",_) $ t $ v)) _ =
   24.69      let val d = has_degree_in t v
   24.70 -	val d' = term_of_num HOLogic.realT d
   24.71 +	val d' = TermC.term_of_num HOLogic.realT d
   24.72      in SOME ((term2str p) ^ " = " ^ (string_of_int d),
   24.73 -	      Trueprop $ (mk_equality (p, d')))
   24.74 +	      TermC.Trueprop $ (TermC.mk_equality (p, d')))
   24.75      end
   24.76    | eval_has_degree_in _ _ _ _ = NONE;
   24.77  (*
   24.78 @@ -396,7 +396,7 @@
   24.79  (*.for evaluation of conditions in rewrite rules.*)
   24.80  val Poly_erls = append_rls "Poly_erls" Atools_erls
   24.81    [Calc ("HOL.eq", eval_equal "#equal_"),
   24.82 -  Thm  ("real_unari_minus", num_str @{thm real_unari_minus}),
   24.83 +  Thm  ("real_unari_minus", TermC.num_str @{thm real_unari_minus}),
   24.84    Calc ("Groups.plus_class.plus", eval_binop "#add_"),
   24.85    Calc ("Groups.minus_class.minus", eval_binop "#sub_"),
   24.86    Calc ("Groups.times_class.times", eval_binop "#mult_"),
   24.87 @@ -404,7 +404,7 @@
   24.88  
   24.89  val poly_crls = append_rls "poly_crls" Atools_crls
   24.90    [Calc ("HOL.eq", eval_equal "#equal_"),
   24.91 -  Thm ("real_unari_minus", num_str @{thm real_unari_minus}),
   24.92 +  Thm ("real_unari_minus", TermC.num_str @{thm real_unari_minus}),
   24.93    Calc ("Groups.plus_class.plus", eval_binop "#add_"),
   24.94    Calc ("Groups.minus_class.minus", eval_binop "#sub_"),
   24.95    Calc ("Groups.times_class.times", eval_binop "#mult_"),
   24.96 @@ -428,7 +428,7 @@
   24.97    | dest_hd' (Abs (_, T, _)) = ((("", 0), T), 4);
   24.98  
   24.99  fun get_order_pow (t $ (Free(order,_))) = (* RL FIXXXME:geht zufaellig?WN*)
  24.100 -    	(case int_of_str (order) of
  24.101 +    	(case TermC.int_of_str (order) of
  24.102  	             SOME d => d
  24.103  		   | NONE   => 0)
  24.104    | get_order_pow _ = 0;
  24.105 @@ -485,9 +485,9 @@
  24.106  val expand =
  24.107    Rls{id = "expand", preconds = [], rew_ord = ("dummy_ord", dummy_ord),
  24.108        erls = e_rls,srls = Erls, calc = [], errpatts = [],
  24.109 -      rules = [Thm ("distrib_right" ,num_str @{thm distrib_right}),
  24.110 +      rules = [Thm ("distrib_right" , TermC.num_str @{thm distrib_right}),
  24.111  	       (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  24.112 -	       Thm ("distrib_left",num_str @{thm distrib_left})
  24.113 +	       Thm ("distrib_left", TermC.num_str @{thm distrib_left})
  24.114  	       (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  24.115  	       ], scr = EmptyScr}:rls;
  24.116  
  24.117 @@ -499,9 +499,9 @@
  24.118    Rls {id = "discard_minus", preconds = [], rew_ord = ("dummy_ord", dummy_ord),
  24.119        erls = e_rls, srls = Erls, calc = [], errpatts = [],
  24.120        rules =
  24.121 -       [Thm ("real_diff_minus", num_str @{thm real_diff_minus}),
  24.122 +       [Thm ("real_diff_minus", TermC.num_str @{thm real_diff_minus}),
  24.123            (*"a - b = a + -1 * b"*)
  24.124 -	        Thm ("sym_real_mult_minus1", num_str (@{thm real_mult_minus1} RS @{thm sym}))
  24.125 +	        Thm ("sym_real_mult_minus1", TermC.num_str (@{thm real_mult_minus1} RS @{thm sym}))
  24.126  	          (*- ?z = "-1 * ?z"*)],
  24.127  	      scr = EmptyScr}:rls;
  24.128  
  24.129 @@ -511,31 +511,31 @@
  24.130        erls = e_rls,srls = Erls,
  24.131        calc = [], errpatts = [],
  24.132        rules =
  24.133 -        [Thm ("real_plus_binom_pow4",num_str @{thm real_plus_binom_pow4}),
  24.134 +        [Thm ("real_plus_binom_pow4", TermC.num_str @{thm real_plus_binom_pow4}),
  24.135  	           (*"(a + b)^^^4 = ... "*)
  24.136 -	         Thm ("real_plus_binom_pow5",num_str @{thm real_plus_binom_pow5}),
  24.137 +	         Thm ("real_plus_binom_pow5",TermC.num_str @{thm real_plus_binom_pow5}),
  24.138  	           (*"(a + b)^^^5 = ... "*)
  24.139 -	         Thm ("real_plus_binom_pow3",num_str @{thm real_plus_binom_pow3}),
  24.140 +	         Thm ("real_plus_binom_pow3",TermC.num_str @{thm real_plus_binom_pow3}),
  24.141  	           (*"(a + b)^^^3 = a^^^3 + 3*a^^^2*b + 3*a*b^^^2 + b^^^3" *)
  24.142  	         (*WN071229 changed/removed for Schaerding -----vvv*)
  24.143 -	         (*Thm ("real_plus_binom_pow2",num_str @{thm real_plus_binom_pow2}),*)
  24.144 +	         (*Thm ("real_plus_binom_pow2",TermC.num_str @{thm real_plus_binom_pow2}),*)
  24.145  	           (*"(a + b)^^^2 = a^^^2 + 2*a*b + b^^^2"*)
  24.146 -	         Thm ("real_plus_binom_pow2",num_str @{thm real_plus_binom_pow2}),
  24.147 +	         Thm ("real_plus_binom_pow2",TermC.num_str @{thm real_plus_binom_pow2}),
  24.148  	           (*"(a + b)^^^2 = (a + b) * (a + b)"*)
  24.149 -	         (*Thm ("real_plus_minus_binom1_p_p", num_str @{thm real_plus_minus_binom1_p_p}),*)
  24.150 +	         (*Thm ("real_plus_minus_binom1_p_p", TermC.num_str @{thm real_plus_minus_binom1_p_p}),*)
  24.151  	           (*"(a + b)*(a + -1 * b) = a^^^2 + -1*b^^^2"*)
  24.152 -	         (*Thm ("real_plus_minus_binom2_p_p", num_str @{thm real_plus_minus_binom2_p_p}),*)
  24.153 +	         (*Thm ("real_plus_minus_binom2_p_p", TermC.num_str @{thm real_plus_minus_binom2_p_p}),*)
  24.154  	           (*"(a + -1 * b)*(a + b) = a^^^2 + -1*b^^^2"*)
  24.155  	         (*WN071229 changed/removed for Schaerding -----^^^*)
  24.156  	      
  24.157 -	         Thm ("distrib_right" ,num_str @{thm distrib_right}),
  24.158 +	         Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),
  24.159  	           (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  24.160 -	         Thm ("distrib_left",num_str @{thm distrib_left}),
  24.161 +	         Thm ("distrib_left",TermC.num_str @{thm distrib_left}),
  24.162  	           (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  24.163  	       
  24.164 -	         Thm ("realpow_multI", num_str @{thm realpow_multI}),
  24.165 +	         Thm ("realpow_multI", TermC.num_str @{thm realpow_multI}),
  24.166  	           (*"(r * s) ^^^ n = r ^^^ n * s ^^^ n"*)
  24.167 -	         Thm ("realpow_pow",num_str @{thm realpow_pow})
  24.168 +	         Thm ("realpow_pow",TermC.num_str @{thm realpow_pow})
  24.169  	           (*"(a ^^^ b) ^^^ c = a ^^^ (b * c)"*)
  24.170  	       ], scr = EmptyScr}:rls;
  24.171  
  24.172 @@ -560,10 +560,10 @@
  24.173  fun eval_is_polyexp (thmid:string) _ 
  24.174  		       (t as (Const("Poly.is'_polyexp", _) $ arg)) thy = 
  24.175      if is_polyexp arg
  24.176 -    then SOME (mk_thmid thmid "" (term_to_string''' thy arg) "", 
  24.177 -	         Trueprop $ (mk_equality (t, @{term True})))
  24.178 -    else SOME (mk_thmid thmid "" (term_to_string''' thy arg) "", 
  24.179 -	         Trueprop $ (mk_equality (t, @{term False})))
  24.180 +    then SOME (TermC.mk_thmid thmid "" (term_to_string''' thy arg) "", 
  24.181 +	         TermC.Trueprop $ (TermC.mk_equality (t, @{term True})))
  24.182 +    else SOME (TermC.mk_thmid thmid "" (term_to_string''' thy arg) "", 
  24.183 +	         TermC.Trueprop $ (TermC.mk_equality (t, @{term False})))
  24.184    | eval_is_polyexp _ _ _ _ = NONE; 
  24.185  
  24.186  val expand_poly_rat_ = 
  24.187 @@ -575,32 +575,32 @@
  24.188        srls = Erls,
  24.189        calc = [], errpatts = [],
  24.190        rules = 
  24.191 -        [Thm ("real_plus_binom_pow4_poly", num_str @{thm real_plus_binom_pow4_poly}),
  24.192 +        [Thm ("real_plus_binom_pow4_poly", TermC.num_str @{thm real_plus_binom_pow4_poly}),
  24.193  	     (*"[| a is_polyexp; b is_polyexp |] ==> (a + b)^^^4 = ... "*)
  24.194 -	 Thm ("real_plus_binom_pow5_poly", num_str @{thm real_plus_binom_pow5_poly}),
  24.195 +	 Thm ("real_plus_binom_pow5_poly", TermC.num_str @{thm real_plus_binom_pow5_poly}),
  24.196  	     (*"[| a is_polyexp; b is_polyexp |] ==> (a + b)^^^5 = ... "*)
  24.197 -	 Thm ("real_plus_binom_pow2_poly",num_str @{thm real_plus_binom_pow2_poly}),
  24.198 +	 Thm ("real_plus_binom_pow2_poly",TermC.num_str @{thm real_plus_binom_pow2_poly}),
  24.199  	     (*"[| a is_polyexp; b is_polyexp |] ==>
  24.200  		            (a + b)^^^2 = a^^^2 + 2*a*b + b^^^2"*)
  24.201 -	 Thm ("real_plus_binom_pow3_poly",num_str @{thm real_plus_binom_pow3_poly}),
  24.202 +	 Thm ("real_plus_binom_pow3_poly",TermC.num_str @{thm real_plus_binom_pow3_poly}),
  24.203  	     (*"[| a is_polyexp; b is_polyexp |] ==> 
  24.204  			(a + b)^^^3 = a^^^3 + 3*a^^^2*b + 3*a*b^^^2 + b^^^3" *)
  24.205 -	 Thm ("real_plus_minus_binom1_p_p",num_str @{thm real_plus_minus_binom1_p_p}),
  24.206 +	 Thm ("real_plus_minus_binom1_p_p",TermC.num_str @{thm real_plus_minus_binom1_p_p}),
  24.207  	     (*"(a + b)*(a + -1 * b) = a^^^2 + -1*b^^^2"*)
  24.208 -	 Thm ("real_plus_minus_binom2_p_p",num_str @{thm real_plus_minus_binom2_p_p}),
  24.209 +	 Thm ("real_plus_minus_binom2_p_p",TermC.num_str @{thm real_plus_minus_binom2_p_p}),
  24.210  	     (*"(a + -1 * b)*(a + b) = a^^^2 + -1*b^^^2"*)
  24.211  	      
  24.212  	 Thm ("real_add_mult_distrib_poly",
  24.213 -               num_str @{thm real_add_mult_distrib_poly}),
  24.214 +               TermC.num_str @{thm real_add_mult_distrib_poly}),
  24.215  	       (*"w is_polyexp ==> (z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  24.216  	 Thm("real_add_mult_distrib2_poly",
  24.217 -              num_str @{thm real_add_mult_distrib2_poly}),
  24.218 +              TermC.num_str @{thm real_add_mult_distrib2_poly}),
  24.219  	     (*"w is_polyexp ==> w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  24.220  	       
  24.221 -	 Thm ("realpow_multI_poly", num_str @{thm realpow_multI_poly}),
  24.222 +	 Thm ("realpow_multI_poly", TermC.num_str @{thm realpow_multI_poly}),
  24.223  	     (*"[| r is_polyexp; s is_polyexp |] ==> 
  24.224  		            (r * s) ^^^ n = r ^^^ n * s ^^^ n"*)
  24.225 -	  Thm ("realpow_pow",num_str @{thm realpow_pow})
  24.226 +	  Thm ("realpow_pow",TermC.num_str @{thm realpow_pow})
  24.227  	      (*"(a ^^^ b) ^^^ c = a ^^^ (b * c)"*)
  24.228  	 ], scr = EmptyScr}:rls;
  24.229  
  24.230 @@ -612,30 +612,30 @@
  24.231        rules = [(*MG: Reihenfolge der folgenden 2 Thm muss so bleiben, wegen
  24.232  		a*(a*a) --> a*a^^^2 und nicht a*(a*a) --> a^^^2*a *)
  24.233  	       Thm ("sym_realpow_twoI",
  24.234 -                     num_str (@{thm realpow_twoI} RS @{thm sym})),	
  24.235 +                     TermC.num_str (@{thm realpow_twoI} RS @{thm sym})),	
  24.236  	       (*"r * r = r ^^^ 2"*)
  24.237 -	       Thm ("realpow_twoI_assoc_l",num_str @{thm realpow_twoI_assoc_l}),
  24.238 +	       Thm ("realpow_twoI_assoc_l",TermC.num_str @{thm realpow_twoI_assoc_l}),
  24.239  	       (*"r * (r * s) = r ^^^ 2 * s"*)
  24.240  
  24.241 -	       Thm ("realpow_plus_1",num_str @{thm realpow_plus_1}),		
  24.242 +	       Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),		
  24.243  	       (*"r * r ^^^ n = r ^^^ (n + 1)"*)
  24.244  	       Thm ("realpow_plus_1_assoc_l",
  24.245 -                     num_str @{thm realpow_plus_1_assoc_l}),
  24.246 +                     TermC.num_str @{thm realpow_plus_1_assoc_l}),
  24.247  	       (*"r * (r ^^^ m * s) = r ^^^ (1 + m) * s"*)
  24.248  	       (*MG 9.7.03: neues Thm wegen a*(a*(a*b)) --> a^^^2*(a*b) *)
  24.249  	       Thm ("realpow_plus_1_assoc_l2",
  24.250 -                     num_str @{thm realpow_plus_1_assoc_l2}),
  24.251 +                     TermC.num_str @{thm realpow_plus_1_assoc_l2}),
  24.252  	       (*"r ^^^ m * (r * s) = r ^^^ (1 + m) * s"*)
  24.253  
  24.254  	       Thm ("sym_realpow_addI",
  24.255 -               num_str (@{thm realpow_addI} RS @{thm sym})),
  24.256 +               TermC.num_str (@{thm realpow_addI} RS @{thm sym})),
  24.257  	       (*"r ^^^ n * r ^^^ m = r ^^^ (n + m)"*)
  24.258 -	       Thm ("realpow_addI_assoc_l",num_str @{thm realpow_addI_assoc_l}),
  24.259 +	       Thm ("realpow_addI_assoc_l",TermC.num_str @{thm realpow_addI_assoc_l}),
  24.260  	       (*"r ^^^ n * (r ^^^ m * s) = r ^^^ (n + m) * s"*)
  24.261  	       
  24.262  	       (* ist in expand_poly - wird hier aber auch gebraucht, wegen: 
  24.263  		  "r * r = r ^^^ 2" wenn r=a^^^b*)
  24.264 -	       Thm ("realpow_pow",num_str @{thm realpow_pow})
  24.265 +	       Thm ("realpow_pow",TermC.num_str @{thm realpow_pow})
  24.266  	       (*"(a ^^^ b) ^^^ c = a ^^^ (b * c)"*)
  24.267  	       ], scr = EmptyScr}:rls;
  24.268  
  24.269 @@ -659,13 +659,13 @@
  24.270        erls = e_rls,srls = Erls,
  24.271        calc = [], errpatts = [],
  24.272        rules = [(* MG: folgende Thm müssen hier stehen bleiben: *)
  24.273 -               Thm ("mult_1_right",num_str @{thm mult_1_right}),
  24.274 +               Thm ("mult_1_right",TermC.num_str @{thm mult_1_right}),
  24.275  	       (*"z * 1 = z"*) (*wegen "a * b * b^^^(-1) + a"*) 
  24.276 -	       Thm ("realpow_zeroI",num_str @{thm realpow_zeroI}),
  24.277 +	       Thm ("realpow_zeroI",TermC.num_str @{thm realpow_zeroI}),
  24.278  	       (*"r ^^^ 0 = 1"*) (*wegen "a*a^^^(-1)*c + b + c"*)
  24.279 -	       Thm ("realpow_oneI",num_str @{thm realpow_oneI}),
  24.280 +	       Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}),
  24.281  	       (*"r ^^^ 1 = r"*)
  24.282 -	       Thm ("realpow_eq_oneI",num_str @{thm realpow_eq_oneI})
  24.283 +	       Thm ("realpow_eq_oneI",TermC.num_str @{thm realpow_eq_oneI})
  24.284  	       (*"1 ^^^ n = 1"*)
  24.285  	       ], scr = EmptyScr}:rls;
  24.286  
  24.287 @@ -676,23 +676,23 @@
  24.288        calc = [("PLUS"  , ("Groups.plus_class.plus", eval_binop "#add_"))
  24.289  	      ], errpatts = [],
  24.290        rules = 
  24.291 -        [Thm ("real_num_collect",num_str @{thm real_num_collect}), 
  24.292 +        [Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  24.293  	     (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
  24.294 -	 Thm ("real_num_collect_assoc_r",num_str @{thm real_num_collect_assoc_r}),
  24.295 +	 Thm ("real_num_collect_assoc_r",TermC.num_str @{thm real_num_collect_assoc_r}),
  24.296  	     (*"[| l is_const; m is_const |] ==>  \
  24.297  					\(k + m * n) + l * n = k + (l + m)*n"*)
  24.298 -	 Thm ("real_one_collect",num_str @{thm real_one_collect}),	
  24.299 +	 Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),	
  24.300  	     (*"m is_const ==> n + m * n = (1 + m) * n"*)
  24.301 -	 Thm ("real_one_collect_assoc_r",num_str @{thm real_one_collect_assoc_r}), 
  24.302 +	 Thm ("real_one_collect_assoc_r",TermC.num_str @{thm real_one_collect_assoc_r}), 
  24.303  	     (*"m is_const ==> (k + n) + m * n = k + (m + 1) * n"*)
  24.304  
  24.305           Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  24.306  
  24.307  	 (*MG: Reihenfolge der folgenden 2 Thm muss so bleiben, wegen
  24.308  		     (a+a)+a --> a + 2*a --> 3*a and not (a+a)+a --> 2*a + a *)
  24.309 -         Thm ("real_mult_2_assoc_r",num_str @{thm real_mult_2_assoc_r}),
  24.310 +         Thm ("real_mult_2_assoc_r",TermC.num_str @{thm real_mult_2_assoc_r}),
  24.311  	     (*"(k + z1) + z1 = k + 2 * z1"*)
  24.312 -	 Thm ("sym_real_mult_2",num_str (@{thm real_mult_2} RS @{thm sym}))
  24.313 +	 Thm ("sym_real_mult_2",TermC.num_str (@{thm real_mult_2} RS @{thm sym}))
  24.314  	     (*"z1 + z1 = 2 * z1"*)
  24.315  	], scr = EmptyScr}:rls;
  24.316  
  24.317 @@ -700,30 +700,30 @@
  24.318    Rls{id = "reduce_012_", preconds = [], 
  24.319        rew_ord = ("dummy_ord", dummy_ord),
  24.320        erls = e_rls,srls = Erls, calc = [], errpatts = [],
  24.321 -      rules = [Thm ("mult_1_left",num_str @{thm mult_1_left}),                 
  24.322 +      rules = [Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),                 
  24.323  	       (*"1 * z = z"*)
  24.324 -	       Thm ("mult_zero_left",num_str @{thm mult_zero_left}),        
  24.325 +	       Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),        
  24.326  	       (*"0 * z = 0"*)
  24.327 -	       Thm ("mult_zero_right",num_str @{thm mult_zero_right}),
  24.328 +	       Thm ("mult_zero_right",TermC.num_str @{thm mult_zero_right}),
  24.329  	       (*"z * 0 = 0"*)
  24.330 -	       Thm ("add_0_left",num_str @{thm add_0_left}),
  24.331 +	       Thm ("add_0_left",TermC.num_str @{thm add_0_left}),
  24.332  	       (*"0 + z = z"*)
  24.333 -	       Thm ("add_0_right",num_str @{thm add_0_right}),
  24.334 +	       Thm ("add_0_right",TermC.num_str @{thm add_0_right}),
  24.335  	       (*"z + 0 = z"*) (*wegen a+b-b --> a+(1-1)*b --> a+0 --> a*)
  24.336  
  24.337 -	       (*Thm ("realpow_oneI",num_str @{thm realpow_oneI})*)
  24.338 +	       (*Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI})*)
  24.339  	       (*"?r ^^^ 1 = ?r"*)
  24.340 -	       Thm ("division_ring_divide_zero",num_str @{thm division_ring_divide_zero})
  24.341 +	       Thm ("division_ring_divide_zero",TermC.num_str @{thm division_ring_divide_zero})
  24.342  	       (*"0 / ?x = 0"*)
  24.343  	       ], scr = EmptyScr}:rls;
  24.344  
  24.345  val discard_parentheses1 = 
  24.346      append_rls "discard_parentheses1" e_rls 
  24.347  	       [Thm ("sym_mult_assoc",
  24.348 -                      num_str (@{thm mult.assoc} RS @{thm sym}))
  24.349 +                      TermC.num_str (@{thm mult.assoc} RS @{thm sym}))
  24.350  		(*"?z1.1 * (?z2.1 * ?z3.1) = ?z1.1 * ?z2.1 * ?z3.1"*)
  24.351  		(*Thm ("sym_add_assoc",
  24.352 -                        num_str (@{thm add_assoc} RS @{thm sym}))*)
  24.353 +                        TermC.num_str (@{thm add_assoc} RS @{thm sym}))*)
  24.354  		(*"?z1.1 + (?z2.1 + ?z3.1) = ?z1.1 + ?z2.1 + ?z3.1"*)
  24.355  		 ];
  24.356  
  24.357 @@ -739,23 +739,23 @@
  24.358  	      ("POWER", ("Atools.pow", eval_binop "#power_"))
  24.359  	      ],
  24.360        errpatts = [],
  24.361 -      rules = [Thm ("real_num_collect",num_str @{thm real_num_collect}), 
  24.362 +      rules = [Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  24.363  	       (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
  24.364 -	       Thm ("real_num_collect_assoc",num_str @{thm real_num_collect_assoc}),
  24.365 +	       Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),
  24.366  	       (*"[| l is_const; m is_const |] ==>  
  24.367  				l * n + (m * n + k) =  (l + m) * n + k"*)
  24.368 -	       Thm ("real_one_collect",num_str @{thm real_one_collect}),	
  24.369 +	       Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),	
  24.370  	       (*"m is_const ==> n + m * n = (1 + m) * n"*)
  24.371 -	       Thm ("real_one_collect_assoc",num_str @{thm real_one_collect_assoc}), 
  24.372 +	       Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), 
  24.373  	       (*"m is_const ==> n + (m * n + k) = (1 + m) * n + k"*)
  24.374  	       
  24.375  	       Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  24.376  
  24.377  	       (*MG am 2.5.03: 2 Theoreme aus reduce_012 hierher verschoben*)
  24.378  	       Thm ("sym_real_mult_2",
  24.379 -                     num_str (@{thm real_mult_2} RS @{thm sym})),	
  24.380 +                     TermC.num_str (@{thm real_mult_2} RS @{thm sym})),	
  24.381  	       (*"z1 + z1 = 2 * z1"*)
  24.382 -	       Thm ("real_mult_2_assoc",num_str @{thm real_mult_2_assoc})
  24.383 +	       Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc})
  24.384  	       (*"z1 + (z1 + k) = 2 * z1 + k"*)
  24.385  	       ], scr = EmptyScr}:rls;*)
  24.386  
  24.387 @@ -765,36 +765,36 @@
  24.388        erls = e_rls,srls = Erls,
  24.389        calc = [], errpatts = [],
  24.390        (*asm_thm = [],*)
  24.391 -      rules = [Thm ("distrib_right" ,num_str @{thm distrib_right}),
  24.392 +      rules = [Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),
  24.393  	       (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  24.394 -	       Thm ("distrib_left",num_str @{thm distrib_left}),
  24.395 +	       Thm ("distrib_left",TermC.num_str @{thm distrib_left}),
  24.396  	       (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  24.397 -	       (*Thm ("distrib_right1",num_str @{thm distrib_right}1),
  24.398 +	       (*Thm ("distrib_right1",TermC.num_str @{thm distrib_right}1),
  24.399  		....... 18.3.03 undefined???*)
  24.400  
  24.401 -	       Thm ("real_plus_binom_pow2",num_str @{thm real_plus_binom_pow2}),
  24.402 +	       Thm ("real_plus_binom_pow2",TermC.num_str @{thm real_plus_binom_pow2}),
  24.403  	       (*"(a + b)^^^2 = a^^^2 + 2*a*b + b^^^2"*)
  24.404 -	       Thm ("real_minus_binom_pow2_p",num_str @{thm real_minus_binom_pow2_p}),
  24.405 +	       Thm ("real_minus_binom_pow2_p",TermC.num_str @{thm real_minus_binom_pow2_p}),
  24.406  	       (*"(a - b)^^^2 = a^^^2 + -2*a*b + b^^^2"*)
  24.407  	       Thm ("real_plus_minus_binom1_p",
  24.408 -		    num_str @{thm real_plus_minus_binom1_p}),
  24.409 +		    TermC.num_str @{thm real_plus_minus_binom1_p}),
  24.410  	       (*"(a + b)*(a - b) = a^^^2 + -1*b^^^2"*)
  24.411  	       Thm ("real_plus_minus_binom2_p",
  24.412 -		    num_str @{thm real_plus_minus_binom2_p}),
  24.413 +		    TermC.num_str @{thm real_plus_minus_binom2_p}),
  24.414  	       (*"(a - b)*(a + b) = a^^^2 + -1*b^^^2"*)
  24.415  
  24.416 -	       Thm ("minus_minus",num_str @{thm minus_minus}),
  24.417 +	       Thm ("minus_minus",TermC.num_str @{thm minus_minus}),
  24.418  	       (*"- (- ?z) = ?z"*)
  24.419 -	       Thm ("real_diff_minus",num_str @{thm real_diff_minus}),
  24.420 +	       Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}),
  24.421  	       (*"a - b = a + -1 * b"*)
  24.422  	       Thm ("sym_real_mult_minus1",
  24.423 -                     num_str (@{thm real_mult_minus1} RS @{thm sym}))
  24.424 +                     TermC.num_str (@{thm real_mult_minus1} RS @{thm sym}))
  24.425  	       (*- ?z = "-1 * ?z"*)
  24.426  
  24.427  	       (*Thm ("real_minus_add_distrib",
  24.428 -		      num_str @{thm real_minus_add_distrib}),*)
  24.429 +		      TermC.num_str @{thm real_minus_add_distrib}),*)
  24.430  	       (*"- (?x + ?y) = - ?x + - ?y"*)
  24.431 -	       (*Thm ("real_diff_plus",num_str @{thm real_diff_plus})*)
  24.432 +	       (*Thm ("real_diff_plus",TermC.num_str @{thm real_diff_plus})*)
  24.433  	       (*"a - b = a + -b"*)
  24.434  	       ], scr = EmptyScr}:rls;
  24.435  
  24.436 @@ -803,22 +803,22 @@
  24.437        rew_ord = ("dummy_ord", dummy_ord),
  24.438        erls = e_rls, srls = Erls,
  24.439        calc = [], errpatts = [],
  24.440 -      rules = [Thm ("realpow_multI", num_str @{thm realpow_multI}),
  24.441 +      rules = [Thm ("realpow_multI", TermC.num_str @{thm realpow_multI}),
  24.442  	       (*"(r * s) ^^^ n = r ^^^ n * s ^^^ n"*)
  24.443  	       
  24.444  	       Thm ("sym_realpow_twoI",
  24.445 -                     num_str( @{thm realpow_twoI} RS @{thm sym})),	
  24.446 +                     TermC.num_str( @{thm realpow_twoI} RS @{thm sym})),	
  24.447  	       (*"r1 * r1 = r1 ^^^ 2"*)
  24.448 -	       Thm ("realpow_plus_1",num_str @{thm realpow_plus_1}),		
  24.449 +	       Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),		
  24.450  	       (*"r * r ^^^ n = r ^^^ (n + 1)"*)
  24.451 -	       Thm ("realpow_pow",num_str @{thm realpow_pow}),
  24.452 +	       Thm ("realpow_pow",TermC.num_str @{thm realpow_pow}),
  24.453  	       (*"(a ^^^ b) ^^^ c = a ^^^ (b * c)"*)
  24.454  	       Thm ("sym_realpow_addI",
  24.455 -                     num_str (@{thm realpow_addI} RS @{thm sym})),
  24.456 +                     TermC.num_str (@{thm realpow_addI} RS @{thm sym})),
  24.457  	       (*"r ^^^ n * r ^^^ m = r ^^^ (n + m)"*)
  24.458 -	       Thm ("realpow_oneI",num_str @{thm realpow_oneI}),
  24.459 +	       Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}),
  24.460  	       (*"r ^^^ 1 = r"*)
  24.461 -	       Thm ("realpow_eq_oneI",num_str @{thm realpow_eq_oneI})
  24.462 +	       Thm ("realpow_eq_oneI",TermC.num_str @{thm realpow_eq_oneI})
  24.463  	       (*"1 ^^^ n = 1"*)
  24.464  	       ], scr = EmptyScr}:rls;
  24.465  (*MG.0401: termorders for multivariate polys dropped due to principal problems:
  24.466 @@ -828,17 +828,17 @@
  24.467        rew_ord = ("ord_make_polynomial",ord_make_polynomial false thy),
  24.468        erls = e_rls,srls = Erls,
  24.469        calc = [], errpatts = [],
  24.470 -      rules = [Thm ("mult_commute",num_str @{thm mult.commute}),
  24.471 +      rules = [Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
  24.472  	       (* z * w = w * z *)
  24.473 -	       Thm ("real_mult_left_commute",num_str @{thm real_mult_left_commute}),
  24.474 +	       Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
  24.475  	       (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*)
  24.476 -	       Thm ("mult_assoc",num_str @{thm mult.assoc}),		
  24.477 +	       Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),		
  24.478  	       (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*)
  24.479 -	       Thm ("add_commute",num_str @{thm add.commute}),	
  24.480 +	       Thm ("add_commute",TermC.num_str @{thm add.commute}),	
  24.481  	       (*z + w = w + z*)
  24.482 -	       Thm ("add_left_commute",num_str @{thm add.left_commute}),
  24.483 +	       Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}),
  24.484  	       (*x + (y + z) = y + (x + z)*)
  24.485 -	       Thm ("add_assoc",num_str @{thm add.assoc})	               
  24.486 +	       Thm ("add_assoc",TermC.num_str @{thm add.assoc})	               
  24.487  	       (*z1.0 + z2.0 + z3.0 = z1.0 + (z2.0 + z3.0)*)
  24.488  	       ], scr = EmptyScr}:rls;
  24.489  (*MG.0401: termorders for multivariate polys dropped due to principal problems:
  24.490 @@ -848,11 +848,11 @@
  24.491        rew_ord = ("ord_make_polynomial",ord_make_polynomial false thy),
  24.492        erls = e_rls,srls = Erls,
  24.493        calc = [], errpatts = [],
  24.494 -      rules = [Thm ("mult_commute",num_str @{thm mult.commute}),
  24.495 +      rules = [Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
  24.496  	       (* z * w = w * z *)
  24.497 -	       Thm ("real_mult_left_commute",num_str @{thm real_mult_left_commute}),
  24.498 +	       Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
  24.499  	       (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*)
  24.500 -	       Thm ("mult_assoc",num_str @{thm mult.assoc})	
  24.501 +	       Thm ("mult_assoc",TermC.num_str @{thm mult.assoc})	
  24.502  	       (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*)
  24.503  	       ], scr = EmptyScr}:rls;
  24.504  *}
  24.505 @@ -866,14 +866,14 @@
  24.506  	      ("TIMES" , ("Groups.times_class.times", eval_binop "#mult_")),
  24.507  	      ("POWER", ("Atools.pow", eval_binop "#power_"))
  24.508  	      ], errpatts = [],
  24.509 -      rules = [Thm ("real_num_collect",num_str @{thm real_num_collect}), 
  24.510 +      rules = [Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  24.511  	       (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
  24.512 -	       Thm ("real_num_collect_assoc",num_str @{thm real_num_collect_assoc}),
  24.513 +	       Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),
  24.514  	       (*"[| l is_const; m is_const |] ==>  
  24.515  				l * n + (m * n + k) =  (l + m) * n + k"*)
  24.516 -	       Thm ("real_one_collect",num_str @{thm real_one_collect}),	
  24.517 +	       Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),	
  24.518  	       (*"m is_const ==> n + m * n = (1 + m) * n"*)
  24.519 -	       Thm ("real_one_collect_assoc",num_str @{thm real_one_collect_assoc}), 
  24.520 +	       Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), 
  24.521  	       (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  24.522  	       Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  24.523  	       Calc ("Groups.times_class.times", eval_binop "#mult_"),
  24.524 @@ -884,35 +884,35 @@
  24.525        rew_ord = ("dummy_ord", dummy_ord),
  24.526        erls = e_rls,srls = Erls,
  24.527        calc = [], errpatts = [],
  24.528 -      rules = [Thm ("mult_1_left",num_str @{thm mult_1_left}),                 
  24.529 +      rules = [Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),                 
  24.530  	       (*"1 * z = z"*)
  24.531 -	       (*Thm ("real_mult_minus1",num_str @{thm real_mult_minus1}),14.3.03*)
  24.532 +	       (*Thm ("real_mult_minus1",TermC.num_str @{thm real_mult_minus1}),14.3.03*)
  24.533  	       (*"-1 * z = - z"*)
  24.534  	       Thm ("minus_mult_left", 
  24.535 -		    num_str (@{thm minus_mult_left} RS @{thm sym})),
  24.536 +		    TermC.num_str (@{thm minus_mult_left} RS @{thm sym})),
  24.537  	       (*- (?x * ?y) = "- ?x * ?y"*)
  24.538  	       (*Thm ("real_minus_mult_cancel",
  24.539 -                       num_str @{thm real_minus_mult_cancel}),
  24.540 +                       TermC.num_str @{thm real_minus_mult_cancel}),
  24.541  	       (*"- ?x * - ?y = ?x * ?y"*)---*)
  24.542 -	       Thm ("mult_zero_left",num_str @{thm mult_zero_left}),        
  24.543 +	       Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),        
  24.544  	       (*"0 * z = 0"*)
  24.545 -	       Thm ("add_0_left",num_str @{thm add_0_left}),
  24.546 +	       Thm ("add_0_left",TermC.num_str @{thm add_0_left}),
  24.547  	       (*"0 + z = z"*)
  24.548 -	       Thm ("right_minus",num_str @{thm right_minus}),
  24.549 +	       Thm ("right_minus",TermC.num_str @{thm right_minus}),
  24.550  	       (*"?z + - ?z = 0"*)
  24.551  	       Thm ("sym_real_mult_2",
  24.552 -                     num_str (@{thm real_mult_2} RS @{thm sym})),	
  24.553 +                     TermC.num_str (@{thm real_mult_2} RS @{thm sym})),	
  24.554  	       (*"z1 + z1 = 2 * z1"*)
  24.555 -	       Thm ("real_mult_2_assoc",num_str @{thm real_mult_2_assoc})
  24.556 +	       Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc})
  24.557  	       (*"z1 + (z1 + k) = 2 * z1 + k"*)
  24.558  	       ], scr = EmptyScr}:rls;
  24.559  
  24.560  val discard_parentheses = 
  24.561      append_rls "discard_parentheses" e_rls 
  24.562  	       [Thm ("sym_mult_assoc",
  24.563 -                      num_str (@{thm mult.assoc} RS @{thm sym})),
  24.564 +                      TermC.num_str (@{thm mult.assoc} RS @{thm sym})),
  24.565  		Thm ("sym_add_assoc",
  24.566 -                      num_str (@{thm add.assoc} RS @{thm sym}))];
  24.567 +                      TermC.num_str (@{thm add.assoc} RS @{thm sym}))];
  24.568  
  24.569  val scr_make_polynomial = 
  24.570  "Script Expand_binoms t_t =                                  " ^
  24.571 @@ -962,7 +962,7 @@
  24.572  	       Rls_ simplify_power,   (*realpow_eq_oneI, eg. x^1 --> x *)
  24.573  	       Rls_ collect_numerals, (*eg. x^(2+ -1) --> x^1          *)
  24.574  	       Rls_ reduce_012,
  24.575 -	       Thm ("realpow_oneI",num_str @{thm realpow_oneI}),(*in --^*) 
  24.576 +	       Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}),(*in --^*) 
  24.577  	       Rls_ discard_parentheses
  24.578  	       ],
  24.579        scr = EmptyScr
  24.580 @@ -1010,96 +1010,96 @@
  24.581  	      ("POWER", ("Atools.pow", eval_binop "#power_"))
  24.582  	      ], errpatts = [],
  24.583        rules = [Thm ("real_plus_binom_pow2",
  24.584 -                     num_str @{thm real_plus_binom_pow2}),     
  24.585 +                     TermC.num_str @{thm real_plus_binom_pow2}),     
  24.586  	       (*"(a + b) ^^^ 2 = a ^^^ 2 + 2 * a * b + b ^^^ 2"*)
  24.587  	       Thm ("real_plus_binom_times",
  24.588 -                     num_str @{thm real_plus_binom_times}),    
  24.589 +                     TermC.num_str @{thm real_plus_binom_times}),    
  24.590  	      (*"(a + b)*(a + b) = ...*)
  24.591  	       Thm ("real_minus_binom_pow2",
  24.592 -                     num_str @{thm real_minus_binom_pow2}),   
  24.593 +                     TermC.num_str @{thm real_minus_binom_pow2}),   
  24.594  	       (*"(a - b) ^^^ 2 = a ^^^ 2 - 2 * a * b + b ^^^ 2"*)
  24.595  	       Thm ("real_minus_binom_times",
  24.596 -                     num_str @{thm real_minus_binom_times}),   
  24.597 +                     TermC.num_str @{thm real_minus_binom_times}),   
  24.598  	       (*"(a - b)*(a - b) = ...*)
  24.599  	       Thm ("real_plus_minus_binom1",
  24.600 -                     num_str @{thm real_plus_minus_binom1}),   
  24.601 +                     TermC.num_str @{thm real_plus_minus_binom1}),   
  24.602  		(*"(a + b) * (a - b) = a ^^^ 2 - b ^^^ 2"*)
  24.603  	       Thm ("real_plus_minus_binom2",
  24.604 -                     num_str @{thm real_plus_minus_binom2}),   
  24.605 +                     TermC.num_str @{thm real_plus_minus_binom2}),   
  24.606  		(*"(a - b) * (a + b) = a ^^^ 2 - b ^^^ 2"*)
  24.607  	       (*RL 020915*)
  24.608 -	       Thm ("real_pp_binom_times",num_str @{thm real_pp_binom_times}), 
  24.609 +	       Thm ("real_pp_binom_times",TermC.num_str @{thm real_pp_binom_times}), 
  24.610  		(*(a + b)*(c + d) = a*c + a*d + b*c + b*d*)
  24.611 -               Thm ("real_pm_binom_times",num_str @{thm real_pm_binom_times}), 
  24.612 +               Thm ("real_pm_binom_times",TermC.num_str @{thm real_pm_binom_times}), 
  24.613  		(*(a + b)*(c - d) = a*c - a*d + b*c - b*d*)
  24.614 -               Thm ("real_mp_binom_times",num_str @{thm real_mp_binom_times}), 
  24.615 +               Thm ("real_mp_binom_times",TermC.num_str @{thm real_mp_binom_times}), 
  24.616  		(*(a - b)*(c + d) = a*c + a*d - b*c - b*d*)
  24.617 -               Thm ("real_mm_binom_times",num_str @{thm real_mm_binom_times}), 
  24.618 +               Thm ("real_mm_binom_times",TermC.num_str @{thm real_mm_binom_times}), 
  24.619  		(*(a - b)*(c - d) = a*c - a*d - b*c + b*d*)
  24.620 -	       Thm ("realpow_multI",num_str @{thm realpow_multI}),
  24.621 +	       Thm ("realpow_multI",TermC.num_str @{thm realpow_multI}),
  24.622  		(*(a*b)^^^n = a^^^n * b^^^n*)
  24.623 -	       Thm ("real_plus_binom_pow3",num_str @{thm real_plus_binom_pow3}),
  24.624 +	       Thm ("real_plus_binom_pow3",TermC.num_str @{thm real_plus_binom_pow3}),
  24.625  	        (* (a + b)^^^3 = a^^^3 + 3*a^^^2*b + 3*a*b^^^2 + b^^^3 *)
  24.626  	       Thm ("real_minus_binom_pow3",
  24.627 -                     num_str @{thm real_minus_binom_pow3}),
  24.628 +                     TermC.num_str @{thm real_minus_binom_pow3}),
  24.629  	        (* (a - b)^^^3 = a^^^3 - 3*a^^^2*b + 3*a*b^^^2 - b^^^3 *)
  24.630  
  24.631  
  24.632 -              (*Thm ("distrib_right" ,num_str @{thm distrib_right}),	
  24.633 +              (*Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),	
  24.634  		(*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  24.635 -	       Thm ("distrib_left",num_str @{thm distrib_left}),	
  24.636 +	       Thm ("distrib_left",TermC.num_str @{thm distrib_left}),	
  24.637  	       (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  24.638 -	       Thm ("left_diff_distrib" ,num_str @{thm left_diff_distrib}),	
  24.639 +	       Thm ("left_diff_distrib" ,TermC.num_str @{thm left_diff_distrib}),	
  24.640  	       (*"(z1.0 - z2.0) * w = z1.0 * w - z2.0 * w"*)
  24.641 -	       Thm ("right_diff_distrib",num_str @{thm right_diff_distrib}),	
  24.642 +	       Thm ("right_diff_distrib",TermC.num_str @{thm right_diff_distrib}),	
  24.643  	       (*"w * (z1.0 - z2.0) = w * z1.0 - w * z2.0"*)
  24.644  	      *)
  24.645 -	       Thm ("mult_1_left",num_str @{thm mult_1_left}),
  24.646 +	       Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),
  24.647                 (*"1 * z = z"*)
  24.648 -	       Thm ("mult_zero_left",num_str @{thm mult_zero_left}),
  24.649 +	       Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),
  24.650                 (*"0 * z = 0"*)
  24.651 -	       Thm ("add_0_left",num_str @{thm add_0_left}),(*"0 + z = z"*)
  24.652 +	       Thm ("add_0_left",TermC.num_str @{thm add_0_left}),(*"0 + z = z"*)
  24.653  
  24.654  	       Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  24.655  	       Calc ("Groups.times_class.times", eval_binop "#mult_"),
  24.656  	       Calc ("Atools.pow", eval_binop "#power_"),
  24.657 -              (*Thm ("mult_commute",num_str @{thm mult_commute}),
  24.658 +              (*Thm ("mult_commute",TermC.num_str @{thm mult_commute}),
  24.659  		(*AC-rewriting*)
  24.660  	       Thm ("real_mult_left_commute",
  24.661 -                     num_str @{thm real_mult_left_commute}),
  24.662 -	       Thm ("mult_assoc",num_str @{thm mult.assoc}),
  24.663 -	       Thm ("add_commute",num_str @{thm add.commute}),
  24.664 -	       Thm ("add_left_commute",num_str @{thm add.left_commute}),
  24.665 -	       Thm ("add_assoc",num_str @{thm add.assoc}),
  24.666 +                     TermC.num_str @{thm real_mult_left_commute}),
  24.667 +	       Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),
  24.668 +	       Thm ("add_commute",TermC.num_str @{thm add.commute}),
  24.669 +	       Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}),
  24.670 +	       Thm ("add_assoc",TermC.num_str @{thm add.assoc}),
  24.671  	      *)
  24.672  	       Thm ("sym_realpow_twoI",
  24.673 -                     num_str (@{thm realpow_twoI} RS @{thm sym})),
  24.674 +                     TermC.num_str (@{thm realpow_twoI} RS @{thm sym})),
  24.675  	       (*"r1 * r1 = r1 ^^^ 2"*)
  24.676 -	       Thm ("realpow_plus_1",num_str @{thm realpow_plus_1}),			
  24.677 +	       Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),			
  24.678  	       (*"r * r ^^^ n = r ^^^ (n + 1)"*)
  24.679  	       (*Thm ("sym_real_mult_2",
  24.680 -                       num_str (@{thm real_mult_2} RS @{thm sym})),		
  24.681 +                       TermC.num_str (@{thm real_mult_2} RS @{thm sym})),		
  24.682  	       (*"z1 + z1 = 2 * z1"*)*)
  24.683 -	       Thm ("real_mult_2_assoc",num_str @{thm real_mult_2_assoc}),		
  24.684 +	       Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),		
  24.685  	       (*"z1 + (z1 + k) = 2 * z1 + k"*)
  24.686  
  24.687 -	       Thm ("real_num_collect",num_str @{thm real_num_collect}), 
  24.688 +	       Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  24.689  	       (*"[| l is_const; m is_const |] ==>l * n + m * n = (l + m) * n"*)
  24.690  	       Thm ("real_num_collect_assoc",
  24.691 -                     num_str @{thm real_num_collect_assoc}),	
  24.692 +                     TermC.num_str @{thm real_num_collect_assoc}),	
  24.693  	       (*"[| l is_const; m is_const |] ==>  
  24.694                                         l * n + (m * n + k) =  (l + m) * n + k"*)
  24.695 -	       Thm ("real_one_collect",num_str @{thm real_one_collect}),
  24.696 +	       Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),
  24.697  	       (*"m is_const ==> n + m * n = (1 + m) * n"*)
  24.698  	       Thm ("real_one_collect_assoc",
  24.699 -                     num_str @{thm real_one_collect_assoc}), 
  24.700 +                     TermC.num_str @{thm real_one_collect_assoc}), 
  24.701  	       (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  24.702  
  24.703  	       Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  24.704  	       Calc ("Groups.times_class.times", eval_binop "#mult_"),
  24.705  	       Calc ("Atools.pow", eval_binop "#power_")
  24.706  	       ],
  24.707 -      scr = Prog ((Thm.term_of o the o (parse thy)) scr_expand_binoms)
  24.708 +      scr = Prog ((Thm.term_of o the o (TermC.parse thy)) scr_expand_binoms)
  24.709        }:rls;      
  24.710  
  24.711  
  24.712 @@ -1164,11 +1164,11 @@
  24.713  (* liefert True, falls der Term (Liste von Termen) nur Zahlen 
  24.714     (keine Variablen) enthaelt *)
  24.715  fun filter_num [] = true
  24.716 -  | filter_num [Free x] = if (is_num (Free x)) then true
  24.717 +  | filter_num [Free x] = if (TermC.is_num (Free x)) then true
  24.718  				else false
  24.719    | filter_num ((Free _)::_) = false
  24.720    | filter_num ts =
  24.721 -    (filter_num o (filter_out is_num) o flat o (map args)) ts;
  24.722 +    (filter_num o (filter_out TermC.is_num) o flat o (map args)) ts;
  24.723  
  24.724  (* liefert True, falls der Term nur Zahlen (keine Variablen) enthaelt 
  24.725     dh. er ist ein numerischer Wert und entspricht einem Koeffizienten *)
  24.726 @@ -1184,7 +1184,7 @@
  24.727  	    (case x of 
  24.728  		 (Const ("Atools.pow", _) $ Free (str_b, _) $ Free (str_h, T)) => 
  24.729  		     if (is_nums (Free (str_h, T))) then
  24.730 -			 counter (n + (the (int_of_str str_h)), xs)
  24.731 +			 counter (n + (the (TermC.int_of_str str_h)), xs)
  24.732  		     else counter (n + 1000, xs) (*FIXME.MG?!*)
  24.733  	       | (Const ("Atools.pow", _) $ Free (str_b, _) $ _ ) => 
  24.734  		     counter (n + 1000, xs) (*FIXME.MG?!*)
  24.735 @@ -1309,10 +1309,10 @@
  24.736  fun eval_is_multUnordered (thmid:string) _ 
  24.737  		       (t as (Const("Poly.is'_multUnordered", _) $ arg)) thy = 
  24.738      if is_multUnordered arg
  24.739 -    then SOME (mk_thmid thmid "" (term_to_string''' thy arg) "", 
  24.740 -	         Trueprop $ (mk_equality (t, @{term True})))
  24.741 -    else SOME (mk_thmid thmid "" (term_to_string''' thy arg) "", 
  24.742 -	         Trueprop $ (mk_equality (t, @{term False})))
  24.743 +    then SOME (TermC.mk_thmid thmid "" (term_to_string''' thy arg) "", 
  24.744 +	         TermC.Trueprop $ (TermC.mk_equality (t, @{term True})))
  24.745 +    else SOME (TermC.mk_thmid thmid "" (term_to_string''' thy arg) "", 
  24.746 +	         TermC.Trueprop $ (TermC.mk_equality (t, @{term False})))
  24.747    | eval_is_multUnordered _ _ _ _ = NONE; 
  24.748  
  24.749  fun attach_form (_:rule list list) (_:term) (_:term) = (*still missing*)
  24.750 @@ -1328,8 +1328,8 @@
  24.751  	  prepat = 
  24.752            (* ?p matched with the current term gives an environment,
  24.753               which evaluates (the instantiated) "?p is_multUnordered" to true *)
  24.754 -	  [([parse_patt thy "?p is_multUnordered"], 
  24.755 -             parse_patt thy "?p :: real")],
  24.756 +	  [([TermC.parse_patt thy "?p is_multUnordered"], 
  24.757 +             TermC.parse_patt thy "?p :: real")],
  24.758  	  rew_ord = ("dummy_ord", dummy_ord),
  24.759  	  erls = append_rls "e_rls-is_multUnordered" e_rls
  24.760  			    [Calc ("Poly.is'_multUnordered", 
  24.761 @@ -1362,10 +1362,10 @@
  24.762  fun eval_is_addUnordered (thmid:string) _ 
  24.763  		       (t as (Const("Poly.is'_addUnordered", _) $ arg)) thy = 
  24.764      if is_addUnordered arg
  24.765 -    then SOME (mk_thmid thmid "" (term_to_string''' thy arg) "", 
  24.766 -	         Trueprop $ (mk_equality (t, @{term True})))
  24.767 -    else SOME (mk_thmid thmid "" (term_to_string''' thy arg) "", 
  24.768 -	         Trueprop $ (mk_equality (t, @{term False})))
  24.769 +    then SOME (TermC.mk_thmid thmid "" (term_to_string''' thy arg) "", 
  24.770 +	         TermC.Trueprop $ (TermC.mk_equality (t, @{term True})))
  24.771 +    else SOME (TermC.mk_thmid thmid "" (term_to_string''' thy arg) "", 
  24.772 +	         TermC.Trueprop $ (TermC.mk_equality (t, @{term False})))
  24.773    | eval_is_addUnordered _ _ _ _ = NONE; 
  24.774  
  24.775  fun attach_form (_:rule list list) (_:term) (_:term) = (*still missing*)
  24.776 @@ -1380,8 +1380,8 @@
  24.777      Rrls {id = "order_add_", 
  24.778  	  prepat = (*WN.18.6.03 Preconditions und Pattern,
  24.779  		    die beide passen muessen, damit das Rrls angewandt wird*)
  24.780 -	  [([parse_patt @{theory} "?p is_addUnordered"], 
  24.781 -	     parse_patt @{theory} "?p :: real" 
  24.782 +	  [([TermC.parse_patt @{theory} "?p is_addUnordered"], 
  24.783 +	     TermC.parse_patt @{theory} "?p :: real" 
  24.784  	    (*WN.18.6.03 also KEIN pattern, dieses erzeugt nur das Environment 
  24.785  	      fuer die Evaluation der Precondition "p is_addUnordered"*))],
  24.786  	  rew_ord = ("dummy_ord", dummy_ord),
  24.787 @@ -1492,21 +1492,21 @@
  24.788  	    ("TIMES" , ("Groups.times_class.times", eval_binop "#mult_")),
  24.789  	    ("POWER", ("Atools.pow", eval_binop "#power_"))*)
  24.790  	    ], errpatts = [],
  24.791 -    rules = [Thm ("real_plus_binom_times" ,num_str @{thm real_plus_binom_times}),
  24.792 +    rules = [Thm ("real_plus_binom_times" ,TermC.num_str @{thm real_plus_binom_times}),
  24.793  	     (*"(a + b)*(a + b) = a ^ 2 + 2 * a * b + b ^ 2*)
  24.794 -	     Thm ("real_plus_binom_times1" ,num_str @{thm real_plus_binom_times1}),
  24.795 +	     Thm ("real_plus_binom_times1" ,TermC.num_str @{thm real_plus_binom_times1}),
  24.796  	     (*"(a +  1*b)*(a + -1*b) = a^^^2 + -1*b^^^2"*)
  24.797 -	     Thm ("real_plus_binom_times2" ,num_str @{thm real_plus_binom_times2}),
  24.798 +	     Thm ("real_plus_binom_times2" ,TermC.num_str @{thm real_plus_binom_times2}),
  24.799  	     (*"(a + -1*b)*(a +  1*b) = a^^^2 + -1*b^^^2"*)
  24.800  
  24.801 -	     Thm ("mult_1_left",num_str @{thm mult_1_left}),(*"1 * z = z"*)
  24.802 +	     Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),(*"1 * z = z"*)
  24.803  
  24.804 -             Thm ("distrib_right" ,num_str @{thm distrib_right}),
  24.805 +             Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),
  24.806  	     (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  24.807 -	     Thm ("distrib_left",num_str @{thm distrib_left}),
  24.808 +	     Thm ("distrib_left",TermC.num_str @{thm distrib_left}),
  24.809  	     (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  24.810  	       
  24.811 -	     Thm ("mult_assoc", num_str @{thm mult.assoc}),
  24.812 +	     Thm ("mult_assoc", TermC.num_str @{thm mult.assoc}),
  24.813  	     (*"?z1.1 * ?z2.1 * ?z3. =1 ?z1.1 * (?z2.1 * ?z3.1)"*)
  24.814  	     Rls_ order_mult_rls_,
  24.815  	     (*Rls_ order_add_rls_,*)
  24.816 @@ -1516,34 +1516,34 @@
  24.817  	     Calc ("Atools.pow", eval_binop "#power_"),
  24.818  	     
  24.819  	     Thm ("sym_realpow_twoI",
  24.820 -                   num_str (@{thm realpow_twoI} RS @{thm sym})),
  24.821 +                   TermC.num_str (@{thm realpow_twoI} RS @{thm sym})),
  24.822  	     (*"r1 * r1 = r1 ^^^ 2"*)
  24.823  	     Thm ("sym_real_mult_2",
  24.824 -                   num_str (@{thm real_mult_2} RS @{thm sym})),
  24.825 +                   TermC.num_str (@{thm real_mult_2} RS @{thm sym})),
  24.826  	     (*"z1 + z1 = 2 * z1"*)
  24.827 -	     Thm ("real_mult_2_assoc",num_str @{thm real_mult_2_assoc}),
  24.828 +	     Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),
  24.829  	     (*"z1 + (z1 + k) = 2 * z1 + k"*)
  24.830  
  24.831 -	     Thm ("real_num_collect",num_str @{thm real_num_collect}), 
  24.832 +	     Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  24.833  	     (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
  24.834 -	     Thm ("real_num_collect_assoc",num_str @{thm real_num_collect_assoc}),
  24.835 +	     Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),
  24.836  	     (*"[| l is_const; m is_const |] ==>  
  24.837                                       l * n + (m * n + k) =  (l + m) * n + k"*)
  24.838 -	     Thm ("real_one_collect",num_str @{thm real_one_collect}),
  24.839 +	     Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),
  24.840  	     (*"m is_const ==> n + m * n = (1 + m) * n"*)
  24.841 -	     Thm ("real_one_collect_assoc",num_str @{thm real_one_collect_assoc}), 
  24.842 +	     Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), 
  24.843  	     (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  24.844  
  24.845 -	     Thm ("realpow_multI", num_str @{thm realpow_multI}),
  24.846 +	     Thm ("realpow_multI", TermC.num_str @{thm realpow_multI}),
  24.847  	     (*"(r * s) ^^^ n = r ^^^ n * s ^^^ n"*)
  24.848  
  24.849  	     Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  24.850  	     Calc ("Groups.times_class.times", eval_binop "#mult_"),
  24.851  	     Calc ("Atools.pow", eval_binop "#power_"),
  24.852  
  24.853 -	     Thm ("mult_1_left",num_str @{thm mult_1_left}),(*"1 * z = z"*)
  24.854 -	     Thm ("mult_zero_left",num_str @{thm mult_zero_left}),(*"0 * z = 0"*)
  24.855 -	     Thm ("add_0_left",num_str @{thm add_0_left})(*0 + z = z*)
  24.856 +	     Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),(*"1 * z = z"*)
  24.857 +	     Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),(*"0 * z = 0"*)
  24.858 +	     Thm ("add_0_left",TermC.num_str @{thm add_0_left})(*0 + z = z*)
  24.859  
  24.860  	     (*Rls_ order_add_rls_*)
  24.861  	     ],
    25.1 --- a/src/Tools/isac/Knowledge/PolyEq.thy	Sun Feb 25 16:31:17 2018 +0100
    25.2 +++ b/src/Tools/isac/Knowledge/PolyEq.thy	Fri Mar 02 14:19:59 2018 +0100
    25.3 @@ -390,34 +390,34 @@
    25.4  	      Calc ("HOL.eq",eval_equal "#equal_"),
    25.5                Calc ("RootEq.is'_rootTerm'_in",eval_is_rootTerm_in ""),
    25.6  	      Calc ("RatEq.is'_ratequation'_in",eval_is_ratequation_in ""),
    25.7 -	      Thm ("not_true",num_str @{thm not_true}),
    25.8 -	      Thm ("not_false",num_str @{thm not_false}),
    25.9 -	      Thm ("and_true",num_str @{thm and_true}),
   25.10 -	      Thm ("and_false",num_str @{thm and_false}),
   25.11 -	      Thm ("or_true",num_str @{thm or_true}),
   25.12 -	      Thm ("or_false",num_str @{thm or_false})
   25.13 +	      Thm ("not_true",TermC.num_str @{thm not_true}),
   25.14 +	      Thm ("not_false",TermC.num_str @{thm not_false}),
   25.15 +	      Thm ("and_true",TermC.num_str @{thm and_true}),
   25.16 +	      Thm ("and_false",TermC.num_str @{thm and_false}),
   25.17 +	      Thm ("or_true",TermC.num_str @{thm or_true}),
   25.18 +	      Thm ("or_false",TermC.num_str @{thm or_false})
   25.19  	       ];
   25.20  
   25.21  val PolyEq_erls = 
   25.22      merge_rls "PolyEq_erls" LinEq_erls
   25.23      (append_rls "ops_preds" calculate_Rational
   25.24  		[Calc ("HOL.eq",eval_equal "#equal_"),
   25.25 -		 Thm ("plus_leq", num_str @{thm plus_leq}),
   25.26 -		 Thm ("minus_leq", num_str @{thm minus_leq}),
   25.27 -		 Thm ("rat_leq1", num_str @{thm rat_leq1}),
   25.28 -		 Thm ("rat_leq2", num_str @{thm rat_leq2}),
   25.29 -		 Thm ("rat_leq3", num_str @{thm rat_leq3})
   25.30 +		 Thm ("plus_leq", TermC.num_str @{thm plus_leq}),
   25.31 +		 Thm ("minus_leq", TermC.num_str @{thm minus_leq}),
   25.32 +		 Thm ("rat_leq1", TermC.num_str @{thm rat_leq1}),
   25.33 +		 Thm ("rat_leq2", TermC.num_str @{thm rat_leq2}),
   25.34 +		 Thm ("rat_leq3", TermC.num_str @{thm rat_leq3})
   25.35  		 ]);
   25.36  
   25.37  val PolyEq_crls = 
   25.38      merge_rls "PolyEq_crls" LinEq_crls
   25.39      (append_rls "ops_preds" calculate_Rational
   25.40  		[Calc ("HOL.eq",eval_equal "#equal_"),
   25.41 -		 Thm ("plus_leq", num_str @{thm plus_leq}),
   25.42 -		 Thm ("minus_leq", num_str @{thm minus_leq}),
   25.43 -		 Thm ("rat_leq1", num_str @{thm rat_leq1}),
   25.44 -		 Thm ("rat_leq2", num_str @{thm rat_leq2}),
   25.45 -		 Thm ("rat_leq3", num_str @{thm rat_leq3})
   25.46 +		 Thm ("plus_leq", TermC.num_str @{thm plus_leq}),
   25.47 +		 Thm ("minus_leq", TermC.num_str @{thm minus_leq}),
   25.48 +		 Thm ("rat_leq1", TermC.num_str @{thm rat_leq1}),
   25.49 +		 Thm ("rat_leq2", TermC.num_str @{thm rat_leq2}),
   25.50 +		 Thm ("rat_leq3", TermC.num_str @{thm rat_leq3})
   25.51  		 ]);
   25.52  
   25.53  val cancel_leading_coeff = prep_rls'(
   25.54 @@ -425,20 +425,20 @@
   25.55         rew_ord = ("e_rew_ord",e_rew_ord),
   25.56        erls = PolyEq_erls, srls = Erls, calc = [], errpatts = [],
   25.57        rules = 
   25.58 -      [Thm ("cancel_leading_coeff1",num_str @{thm cancel_leading_coeff1}),
   25.59 -       Thm ("cancel_leading_coeff2",num_str @{thm cancel_leading_coeff2}),
   25.60 -       Thm ("cancel_leading_coeff3",num_str @{thm cancel_leading_coeff3}),
   25.61 -       Thm ("cancel_leading_coeff4",num_str @{thm cancel_leading_coeff4}),
   25.62 -       Thm ("cancel_leading_coeff5",num_str @{thm cancel_leading_coeff5}),
   25.63 -       Thm ("cancel_leading_coeff6",num_str @{thm cancel_leading_coeff6}),
   25.64 -       Thm ("cancel_leading_coeff7",num_str @{thm cancel_leading_coeff7}),
   25.65 -       Thm ("cancel_leading_coeff8",num_str @{thm cancel_leading_coeff8}),
   25.66 -       Thm ("cancel_leading_coeff9",num_str @{thm cancel_leading_coeff9}),
   25.67 -       Thm ("cancel_leading_coeff10",num_str @{thm cancel_leading_coeff10}),
   25.68 -       Thm ("cancel_leading_coeff11",num_str @{thm cancel_leading_coeff11}),
   25.69 -       Thm ("cancel_leading_coeff12",num_str @{thm cancel_leading_coeff12}),
   25.70 -       Thm ("cancel_leading_coeff13",num_str @{thm cancel_leading_coeff13})
   25.71 -       ],scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")}:rls);
   25.72 +      [Thm ("cancel_leading_coeff1",TermC.num_str @{thm cancel_leading_coeff1}),
   25.73 +       Thm ("cancel_leading_coeff2",TermC.num_str @{thm cancel_leading_coeff2}),
   25.74 +       Thm ("cancel_leading_coeff3",TermC.num_str @{thm cancel_leading_coeff3}),
   25.75 +       Thm ("cancel_leading_coeff4",TermC.num_str @{thm cancel_leading_coeff4}),
   25.76 +       Thm ("cancel_leading_coeff5",TermC.num_str @{thm cancel_leading_coeff5}),
   25.77 +       Thm ("cancel_leading_coeff6",TermC.num_str @{thm cancel_leading_coeff6}),
   25.78 +       Thm ("cancel_leading_coeff7",TermC.num_str @{thm cancel_leading_coeff7}),
   25.79 +       Thm ("cancel_leading_coeff8",TermC.num_str @{thm cancel_leading_coeff8}),
   25.80 +       Thm ("cancel_leading_coeff9",TermC.num_str @{thm cancel_leading_coeff9}),
   25.81 +       Thm ("cancel_leading_coeff10",TermC.num_str @{thm cancel_leading_coeff10}),
   25.82 +       Thm ("cancel_leading_coeff11",TermC.num_str @{thm cancel_leading_coeff11}),
   25.83 +       Thm ("cancel_leading_coeff12",TermC.num_str @{thm cancel_leading_coeff12}),
   25.84 +       Thm ("cancel_leading_coeff13",TermC.num_str @{thm cancel_leading_coeff13})
   25.85 +       ],scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")}:rls);
   25.86  
   25.87  val prep_rls' = LTool.prep_rls @{theory};
   25.88  *}
   25.89 @@ -447,13 +447,13 @@
   25.90    Rls {id = "complete_square", preconds = [], 
   25.91         rew_ord = ("e_rew_ord",e_rew_ord),
   25.92        erls = PolyEq_erls, srls = Erls, calc = [],  errpatts = [],
   25.93 -      rules = [Thm ("complete_square1",num_str @{thm complete_square1}),
   25.94 -	       Thm ("complete_square2",num_str @{thm complete_square2}),
   25.95 -	       Thm ("complete_square3",num_str @{thm complete_square3}),
   25.96 -	       Thm ("complete_square4",num_str @{thm complete_square4}),
   25.97 -	       Thm ("complete_square5",num_str @{thm complete_square5})
   25.98 +      rules = [Thm ("complete_square1",TermC.num_str @{thm complete_square1}),
   25.99 +	       Thm ("complete_square2",TermC.num_str @{thm complete_square2}),
  25.100 +	       Thm ("complete_square3",TermC.num_str @{thm complete_square3}),
  25.101 +	       Thm ("complete_square4",TermC.num_str @{thm complete_square4}),
  25.102 +	       Thm ("complete_square5",TermC.num_str @{thm complete_square5})
  25.103  	       ],
  25.104 -      scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
  25.105 +      scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  25.106        }:rls);
  25.107  
  25.108  val polyeq_simplify = prep_rls'(
  25.109 @@ -462,11 +462,11 @@
  25.110         erls = PolyEq_erls, 
  25.111         srls = Erls, 
  25.112         calc = [], errpatts = [],
  25.113 -       rules = [Thm  ("real_assoc_1",num_str @{thm real_assoc_1}),
  25.114 -		Thm  ("real_assoc_2",num_str @{thm real_assoc_2}),
  25.115 -		Thm  ("real_diff_minus",num_str @{thm real_diff_minus}),
  25.116 -		Thm  ("real_unari_minus",num_str @{thm real_unari_minus}),
  25.117 -		Thm  ("realpow_multI",num_str @{thm realpow_multI}),
  25.118 +       rules = [Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1}),
  25.119 +		Thm  ("real_assoc_2",TermC.num_str @{thm real_assoc_2}),
  25.120 +		Thm  ("real_diff_minus",TermC.num_str @{thm real_diff_minus}),
  25.121 +		Thm  ("real_unari_minus",TermC.num_str @{thm real_unari_minus}),
  25.122 +		Thm  ("realpow_multI",TermC.num_str @{thm realpow_multI}),
  25.123  		Calc ("Groups.plus_class.plus",eval_binop "#add_"),
  25.124  		Calc ("Groups.minus_class.minus",eval_binop "#sub_"),
  25.125  		Calc ("Groups.times_class.times",eval_binop "#mult_"),
  25.126 @@ -475,7 +475,7 @@
  25.127  		Calc ("Atools.pow" ,eval_binop "#power_"),
  25.128                  Rls_ reduce_012
  25.129                  ],
  25.130 -       scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
  25.131 +       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  25.132         }:rls);
  25.133  *}
  25.134  setup {* KEStore_Elems.add_rlss 
  25.135 @@ -494,10 +494,10 @@
  25.136         erls = PolyEq_erls,
  25.137         srls = Erls, 
  25.138         calc = [], errpatts = [],
  25.139 -       rules = [Thm("d0_true",num_str @{thm d0_true}),
  25.140 -		Thm("d0_false",num_str @{thm  d0_false})
  25.141 +       rules = [Thm("d0_true",TermC.num_str @{thm d0_true}),
  25.142 +		Thm("d0_false",TermC.num_str @{thm  d0_false})
  25.143  		],
  25.144 -       scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
  25.145 +       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  25.146         }:rls);
  25.147  
  25.148  (* -- d1 -- *)
  25.149 @@ -509,14 +509,14 @@
  25.150         srls = Erls, 
  25.151         calc = [], errpatts = [],
  25.152         rules = [
  25.153 -		Thm("d1_isolate_add1",num_str @{thm d1_isolate_add1}), 
  25.154 +		Thm("d1_isolate_add1",TermC.num_str @{thm d1_isolate_add1}), 
  25.155  		(* a+bx=0 -> bx=-a *)
  25.156 -		Thm("d1_isolate_add2",num_str @{thm d1_isolate_add2}), 
  25.157 +		Thm("d1_isolate_add2",TermC.num_str @{thm d1_isolate_add2}), 
  25.158  		(* a+ x=0 ->  x=-a *)
  25.159 -		Thm("d1_isolate_div",num_str @{thm d1_isolate_div})    
  25.160 +		Thm("d1_isolate_div",TermC.num_str @{thm d1_isolate_div})    
  25.161  		(*   bx=c -> x=c/b *)  
  25.162  		],
  25.163 -       scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
  25.164 +       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  25.165         }:rls);
  25.166  
  25.167  *}
  25.168 @@ -528,18 +528,18 @@
  25.169    Rls {id = "d2_polyeq_bdv_only_simplify", preconds = [], rew_ord = ("e_rew_ord",e_rew_ord),
  25.170      erls = PolyEq_erls, srls = Erls, calc = [], errpatts = [],
  25.171      rules =
  25.172 -      [Thm ("d2_prescind1", num_str @{thm d2_prescind1}), (*   ax+bx^2=0 -> x(a+bx)=0 *)
  25.173 -       Thm ("d2_prescind2", num_str @{thm d2_prescind2}), (*   ax+ x^2=0 -> x(a+ x)=0 *)
  25.174 -       Thm ("d2_prescind3", num_str @{thm d2_prescind3}), (*    x+bx^2=0 -> x(1+bx)=0 *)
  25.175 -       Thm ("d2_prescind4", num_str @{thm d2_prescind4}), (*    x+ x^2=0 -> x(1+ x)=0 *)
  25.176 -       Thm ("d2_sqrt_equation1", num_str @{thm d2_sqrt_equation1}),    (* x^2=c   -> x=+-sqrt(c) *)
  25.177 -       Thm ("d2_sqrt_equation1_neg", num_str @{thm d2_sqrt_equation1_neg}), (* [0<c] x^2=c  -> []*)
  25.178 -       Thm ("d2_sqrt_equation2", num_str @{thm d2_sqrt_equation2}),    (*  x^2=0 ->    x=0       *)
  25.179 -       Thm ("d2_reduce_equation1", num_str @{thm d2_reduce_equation1}),(* x(a+bx)=0 -> x=0 |a+bx=0*)
  25.180 -       Thm ("d2_reduce_equation2", num_str @{thm d2_reduce_equation2}),(* x(a+ x)=0 -> x=0 |a+ x=0*)
  25.181 -       Thm ("d2_isolate_div", num_str @{thm d2_isolate_div})           (* bx^2=c -> x^2=c/b      *)
  25.182 +      [Thm ("d2_prescind1", TermC.num_str @{thm d2_prescind1}), (*   ax+bx^2=0 -> x(a+bx)=0 *)
  25.183 +       Thm ("d2_prescind2", TermC.num_str @{thm d2_prescind2}), (*   ax+ x^2=0 -> x(a+ x)=0 *)
  25.184 +       Thm ("d2_prescind3", TermC.num_str @{thm d2_prescind3}), (*    x+bx^2=0 -> x(1+bx)=0 *)
  25.185 +       Thm ("d2_prescind4", TermC.num_str @{thm d2_prescind4}), (*    x+ x^2=0 -> x(1+ x)=0 *)
  25.186 +       Thm ("d2_sqrt_equation1", TermC.num_str @{thm d2_sqrt_equation1}),    (* x^2=c   -> x=+-sqrt(c) *)
  25.187 +       Thm ("d2_sqrt_equation1_neg", TermC.num_str @{thm d2_sqrt_equation1_neg}), (* [0<c] x^2=c  -> []*)
  25.188 +       Thm ("d2_sqrt_equation2", TermC.num_str @{thm d2_sqrt_equation2}),    (*  x^2=0 ->    x=0       *)
  25.189 +       Thm ("d2_reduce_equation1", TermC.num_str @{thm d2_reduce_equation1}),(* x(a+bx)=0 -> x=0 |a+bx=0*)
  25.190 +       Thm ("d2_reduce_equation2", TermC.num_str @{thm d2_reduce_equation2}),(* x(a+ x)=0 -> x=0 |a+ x=0*)
  25.191 +       Thm ("d2_isolate_div", TermC.num_str @{thm d2_isolate_div})           (* bx^2=c -> x^2=c/b      *)
  25.192         ],
  25.193 -       scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
  25.194 +       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  25.195         }:rls);
  25.196  *}
  25.197  ML{*
  25.198 @@ -553,20 +553,20 @@
  25.199         calc = [], errpatts = [],
  25.200         (*asm_thm = [("d2_sqrt_equation1",""),("d2_sqrt_equation1_neg",""),
  25.201                    ("d2_isolate_div","")],*)
  25.202 -       rules = [Thm("d2_isolate_add1",num_str @{thm d2_isolate_add1}),
  25.203 +       rules = [Thm("d2_isolate_add1",TermC.num_str @{thm d2_isolate_add1}),
  25.204                  (* a+   bx^2=0 -> bx^2=(-1)a*)
  25.205 -		Thm("d2_isolate_add2",num_str @{thm d2_isolate_add2}),
  25.206 +		Thm("d2_isolate_add2",TermC.num_str @{thm d2_isolate_add2}),
  25.207                  (* a+    x^2=0 ->  x^2=(-1)a*)
  25.208 -		Thm("d2_sqrt_equation2",num_str @{thm d2_sqrt_equation2}),
  25.209 +		Thm("d2_sqrt_equation2",TermC.num_str @{thm d2_sqrt_equation2}),
  25.210                  (*  x^2=0 ->    x=0    *)
  25.211 -		Thm("d2_sqrt_equation1",num_str @{thm d2_sqrt_equation1}),
  25.212 +		Thm("d2_sqrt_equation1",TermC.num_str @{thm d2_sqrt_equation1}),
  25.213                  (* x^2=c   -> x=+-sqrt(c)*)
  25.214 -		Thm("d2_sqrt_equation1_neg",num_str @{thm d2_sqrt_equation1_neg}),
  25.215 +		Thm("d2_sqrt_equation1_neg",TermC.num_str @{thm d2_sqrt_equation1_neg}),
  25.216                  (* [c<0] x^2=c  -> x=[] *)
  25.217 -		Thm("d2_isolate_div",num_str @{thm d2_isolate_div})
  25.218 +		Thm("d2_isolate_div",TermC.num_str @{thm d2_isolate_div})
  25.219                   (* bx^2=c -> x^2=c/b*)
  25.220  		],
  25.221 -       scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
  25.222 +       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  25.223         }:rls);
  25.224  *}
  25.225  ML{*
  25.226 @@ -576,43 +576,43 @@
  25.227    Rls {id = "d2_polyeq_pqFormula_simplify", preconds = [],
  25.228         rew_ord = ("e_rew_ord",e_rew_ord), erls = PolyEq_erls,
  25.229         srls = Erls, calc = [], errpatts = [],
  25.230 -       rules = [Thm("d2_pqformula1",num_str @{thm d2_pqformula1}),
  25.231 +       rules = [Thm("d2_pqformula1",TermC.num_str @{thm d2_pqformula1}),
  25.232                  (* q+px+ x^2=0 *)
  25.233 -		Thm("d2_pqformula1_neg",num_str @{thm d2_pqformula1_neg}),
  25.234 +		Thm("d2_pqformula1_neg",TermC.num_str @{thm d2_pqformula1_neg}),
  25.235                  (* q+px+ x^2=0 *)
  25.236 -		Thm("d2_pqformula2",num_str @{thm d2_pqformula2}), 
  25.237 +		Thm("d2_pqformula2",TermC.num_str @{thm d2_pqformula2}), 
  25.238                  (* q+px+1x^2=0 *)
  25.239 -		Thm("d2_pqformula2_neg",num_str @{thm d2_pqformula2_neg}),
  25.240 +		Thm("d2_pqformula2_neg",TermC.num_str @{thm d2_pqformula2_neg}),
  25.241                  (* q+px+1x^2=0 *)
  25.242 -		Thm("d2_pqformula3",num_str @{thm d2_pqformula3}),
  25.243 +		Thm("d2_pqformula3",TermC.num_str @{thm d2_pqformula3}),
  25.244                  (* q+ x+ x^2=0 *)
  25.245 -		Thm("d2_pqformula3_neg",num_str @{thm d2_pqformula3_neg}), 
  25.246 +		Thm("d2_pqformula3_neg",TermC.num_str @{thm d2_pqformula3_neg}), 
  25.247                  (* q+ x+ x^2=0 *)
  25.248 -		Thm("d2_pqformula4",num_str @{thm d2_pqformula4}),
  25.249 +		Thm("d2_pqformula4",TermC.num_str @{thm d2_pqformula4}),
  25.250                  (* q+ x+1x^2=0 *)
  25.251 -		Thm("d2_pqformula4_neg",num_str @{thm d2_pqformula4_neg}),
  25.252 +		Thm("d2_pqformula4_neg",TermC.num_str @{thm d2_pqformula4_neg}),
  25.253                  (* q+ x+1x^2=0 *)
  25.254 -		Thm("d2_pqformula5",num_str @{thm d2_pqformula5}),
  25.255 +		Thm("d2_pqformula5",TermC.num_str @{thm d2_pqformula5}),
  25.256                  (*   qx+ x^2=0 *)
  25.257 -		Thm("d2_pqformula6",num_str @{thm d2_pqformula6}),
  25.258 +		Thm("d2_pqformula6",TermC.num_str @{thm d2_pqformula6}),
  25.259                  (*   qx+1x^2=0 *)
  25.260 -		Thm("d2_pqformula7",num_str @{thm d2_pqformula7}),
  25.261 +		Thm("d2_pqformula7",TermC.num_str @{thm d2_pqformula7}),
  25.262                  (*    x+ x^2=0 *)
  25.263 -		Thm("d2_pqformula8",num_str @{thm d2_pqformula8}),
  25.264 +		Thm("d2_pqformula8",TermC.num_str @{thm d2_pqformula8}),
  25.265                  (*    x+1x^2=0 *)
  25.266 -		Thm("d2_pqformula9",num_str @{thm d2_pqformula9}),
  25.267 +		Thm("d2_pqformula9",TermC.num_str @{thm d2_pqformula9}),
  25.268                  (* q   +1x^2=0 *)
  25.269 -		Thm("d2_pqformula9_neg",num_str @{thm d2_pqformula9_neg}),
  25.270 +		Thm("d2_pqformula9_neg",TermC.num_str @{thm d2_pqformula9_neg}),
  25.271                  (* q   +1x^2=0 *)
  25.272 -		Thm("d2_pqformula10",num_str @{thm d2_pqformula10}),
  25.273 +		Thm("d2_pqformula10",TermC.num_str @{thm d2_pqformula10}),
  25.274                  (* q   + x^2=0 *)
  25.275 -		Thm("d2_pqformula10_neg",num_str @{thm d2_pqformula10_neg}),
  25.276 +		Thm("d2_pqformula10_neg",TermC.num_str @{thm d2_pqformula10_neg}),
  25.277                  (* q   + x^2=0 *)
  25.278 -		Thm("d2_sqrt_equation2",num_str @{thm d2_sqrt_equation2}),
  25.279 +		Thm("d2_sqrt_equation2",TermC.num_str @{thm d2_sqrt_equation2}),
  25.280                  (*       x^2=0 *)
  25.281 -		Thm("d2_sqrt_equation3",num_str @{thm d2_sqrt_equation3})
  25.282 +		Thm("d2_sqrt_equation3",TermC.num_str @{thm d2_sqrt_equation3})
  25.283                 (*      1x^2=0 *)
  25.284 -	       ],scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
  25.285 +	       ],scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  25.286         }:rls);
  25.287  *}
  25.288  ML{*
  25.289 @@ -622,44 +622,44 @@
  25.290    Rls {id = "d2_polyeq_abcFormula_simplify", preconds = [],
  25.291         rew_ord = ("e_rew_ord",e_rew_ord), erls = PolyEq_erls,
  25.292         srls = Erls, calc = [], errpatts = [],
  25.293 -       rules = [Thm("d2_abcformula1",num_str @{thm d2_abcformula1}),
  25.294 +       rules = [Thm("d2_abcformula1",TermC.num_str @{thm d2_abcformula1}),
  25.295                  (*c+bx+cx^2=0 *)
  25.296 -		Thm("d2_abcformula1_neg",num_str @{thm d2_abcformula1_neg}),
  25.297 +		Thm("d2_abcformula1_neg",TermC.num_str @{thm d2_abcformula1_neg}),
  25.298                  (*c+bx+cx^2=0 *)
  25.299 -		Thm("d2_abcformula2",num_str @{thm d2_abcformula2}),
  25.300 +		Thm("d2_abcformula2",TermC.num_str @{thm d2_abcformula2}),
  25.301                  (*c+ x+cx^2=0 *)
  25.302 -		Thm("d2_abcformula2_neg",num_str @{thm d2_abcformula2_neg}),
  25.303 +		Thm("d2_abcformula2_neg",TermC.num_str @{thm d2_abcformula2_neg}),
  25.304                  (*c+ x+cx^2=0 *)
  25.305 -		Thm("d2_abcformula3",num_str @{thm d2_abcformula3}), 
  25.306 +		Thm("d2_abcformula3",TermC.num_str @{thm d2_abcformula3}), 
  25.307                  (*c+bx+ x^2=0 *)
  25.308 -		Thm("d2_abcformula3_neg",num_str @{thm d2_abcformula3_neg}),
  25.309 +		Thm("d2_abcformula3_neg",TermC.num_str @{thm d2_abcformula3_neg}),
  25.310                  (*c+bx+ x^2=0 *)
  25.311 -		Thm("d2_abcformula4",num_str @{thm d2_abcformula4}),
  25.312 +		Thm("d2_abcformula4",TermC.num_str @{thm d2_abcformula4}),
  25.313                  (*c+ x+ x^2=0 *)
  25.314 -		Thm("d2_abcformula4_neg",num_str @{thm d2_abcformula4_neg}),
  25.315 +		Thm("d2_abcformula4_neg",TermC.num_str @{thm d2_abcformula4_neg}),
  25.316                  (*c+ x+ x^2=0 *)
  25.317 -		Thm("d2_abcformula5",num_str @{thm d2_abcformula5}),
  25.318 +		Thm("d2_abcformula5",TermC.num_str @{thm d2_abcformula5}),
  25.319                  (*c+   cx^2=0 *)
  25.320 -		Thm("d2_abcformula5_neg",num_str @{thm d2_abcformula5_neg}),
  25.321 +		Thm("d2_abcformula5_neg",TermC.num_str @{thm d2_abcformula5_neg}),
  25.322                  (*c+   cx^2=0 *)
  25.323 -		Thm("d2_abcformula6",num_str @{thm d2_abcformula6}),
  25.324 +		Thm("d2_abcformula6",TermC.num_str @{thm d2_abcformula6}),
  25.325                  (*c+    x^2=0 *)
  25.326 -		Thm("d2_abcformula6_neg",num_str @{thm d2_abcformula6_neg}),
  25.327 +		Thm("d2_abcformula6_neg",TermC.num_str @{thm d2_abcformula6_neg}),
  25.328                  (*c+    x^2=0 *)
  25.329 -		Thm("d2_abcformula7",num_str @{thm d2_abcformula7}),
  25.330 +		Thm("d2_abcformula7",TermC.num_str @{thm d2_abcformula7}),
  25.331                  (*  bx+ax^2=0 *)
  25.332 -		Thm("d2_abcformula8",num_str @{thm d2_abcformula8}),
  25.333 +		Thm("d2_abcformula8",TermC.num_str @{thm d2_abcformula8}),
  25.334                  (*  bx+ x^2=0 *)
  25.335 -		Thm("d2_abcformula9",num_str @{thm d2_abcformula9}),
  25.336 +		Thm("d2_abcformula9",TermC.num_str @{thm d2_abcformula9}),
  25.337                  (*   x+ax^2=0 *)
  25.338 -		Thm("d2_abcformula10",num_str @{thm d2_abcformula10}),
  25.339 +		Thm("d2_abcformula10",TermC.num_str @{thm d2_abcformula10}),
  25.340                  (*   x+ x^2=0 *)
  25.341 -		Thm("d2_sqrt_equation2",num_str @{thm d2_sqrt_equation2}),
  25.342 +		Thm("d2_sqrt_equation2",TermC.num_str @{thm d2_sqrt_equation2}),
  25.343                  (*      x^2=0 *)  
  25.344 -		Thm("d2_sqrt_equation3",num_str @{thm d2_sqrt_equation3})
  25.345 +		Thm("d2_sqrt_equation3",TermC.num_str @{thm d2_sqrt_equation3})
  25.346                 (*     bx^2=0 *)  
  25.347  	       ],
  25.348 -       scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
  25.349 +       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  25.350         }:rls);
  25.351  *}
  25.352  ML{*
  25.353 @@ -670,56 +670,56 @@
  25.354    Rls {id = "d2_polyeq_simplify", preconds = [],
  25.355         rew_ord = ("e_rew_ord",e_rew_ord), erls = PolyEq_erls,
  25.356         srls = Erls, calc = [], errpatts = [],
  25.357 -       rules = [Thm("d2_pqformula1",num_str @{thm d2_pqformula1}),
  25.358 +       rules = [Thm("d2_pqformula1",TermC.num_str @{thm d2_pqformula1}),
  25.359                  (* p+qx+ x^2=0 *)
  25.360 -		Thm("d2_pqformula1_neg",num_str @{thm d2_pqformula1_neg}),
  25.361 +		Thm("d2_pqformula1_neg",TermC.num_str @{thm d2_pqformula1_neg}),
  25.362                  (* p+qx+ x^2=0 *)
  25.363 -		Thm("d2_pqformula2",num_str @{thm d2_pqformula2}),
  25.364 +		Thm("d2_pqformula2",TermC.num_str @{thm d2_pqformula2}),
  25.365                  (* p+qx+1x^2=0 *)
  25.366 -		Thm("d2_pqformula2_neg",num_str @{thm d2_pqformula2_neg}),
  25.367 +		Thm("d2_pqformula2_neg",TermC.num_str @{thm d2_pqformula2_neg}),
  25.368                  (* p+qx+1x^2=0 *)
  25.369 -		Thm("d2_pqformula3",num_str @{thm d2_pqformula3}),
  25.370 +		Thm("d2_pqformula3",TermC.num_str @{thm d2_pqformula3}),
  25.371                  (* p+ x+ x^2=0 *)
  25.372 -		Thm("d2_pqformula3_neg",num_str @{thm d2_pqformula3_neg}),
  25.373 +		Thm("d2_pqformula3_neg",TermC.num_str @{thm d2_pqformula3_neg}),
  25.374                  (* p+ x+ x^2=0 *)
  25.375 -		Thm("d2_pqformula4",num_str @{thm d2_pqformula4}), 
  25.376 +		Thm("d2_pqformula4",TermC.num_str @{thm d2_pqformula4}), 
  25.377                  (* p+ x+1x^2=0 *)
  25.378 -		Thm("d2_pqformula4_neg",num_str @{thm d2_pqformula4_neg}),
  25.379 +		Thm("d2_pqformula4_neg",TermC.num_str @{thm d2_pqformula4_neg}),
  25.380                  (* p+ x+1x^2=0 *)
  25.381 -		Thm("d2_abcformula1",num_str @{thm d2_abcformula1}),
  25.382 +		Thm("d2_abcformula1",TermC.num_str @{thm d2_abcformula1}),
  25.383                  (* c+bx+cx^2=0 *)
  25.384 -		Thm("d2_abcformula1_neg",num_str @{thm d2_abcformula1_neg}),
  25.385 +		Thm("d2_abcformula1_neg",TermC.num_str @{thm d2_abcformula1_neg}),
  25.386                  (* c+bx+cx^2=0 *)
  25.387 -		Thm("d2_abcformula2",num_str @{thm d2_abcformula2}),
  25.388 +		Thm("d2_abcformula2",TermC.num_str @{thm d2_abcformula2}),
  25.389                  (* c+ x+cx^2=0 *)
  25.390 -		Thm("d2_abcformula2_neg",num_str @{thm d2_abcformula2_neg}),
  25.391 +		Thm("d2_abcformula2_neg",TermC.num_str @{thm d2_abcformula2_neg}),
  25.392                  (* c+ x+cx^2=0 *)
  25.393 -		Thm("d2_prescind1",num_str @{thm d2_prescind1}),
  25.394 +		Thm("d2_prescind1",TermC.num_str @{thm d2_prescind1}),
  25.395                  (*   ax+bx^2=0 -> x(a+bx)=0 *)
  25.396 -		Thm("d2_prescind2",num_str @{thm d2_prescind2}),
  25.397 +		Thm("d2_prescind2",TermC.num_str @{thm d2_prescind2}),
  25.398                  (*   ax+ x^2=0 -> x(a+ x)=0 *)
  25.399 -		Thm("d2_prescind3",num_str @{thm d2_prescind3}),
  25.400 +		Thm("d2_prescind3",TermC.num_str @{thm d2_prescind3}),
  25.401                  (*    x+bx^2=0 -> x(1+bx)=0 *)
  25.402 -		Thm("d2_prescind4",num_str @{thm d2_prescind4}),
  25.403 +		Thm("d2_prescind4",TermC.num_str @{thm d2_prescind4}),
  25.404                  (*    x+ x^2=0 -> x(1+ x)=0 *)
  25.405 -		Thm("d2_isolate_add1",num_str @{thm d2_isolate_add1}),
  25.406 +		Thm("d2_isolate_add1",TermC.num_str @{thm d2_isolate_add1}),
  25.407                  (* a+   bx^2=0 -> bx^2=(-1)a*)
  25.408 -		Thm("d2_isolate_add2",num_str @{thm d2_isolate_add2}),
  25.409 +		Thm("d2_isolate_add2",TermC.num_str @{thm d2_isolate_add2}),
  25.410                  (* a+    x^2=0 ->  x^2=(-1)a*)
  25.411 -		Thm("d2_sqrt_equation1",num_str @{thm d2_sqrt_equation1}),
  25.412 +		Thm("d2_sqrt_equation1",TermC.num_str @{thm d2_sqrt_equation1}),
  25.413                  (* x^2=c   -> x=+-sqrt(c)*)
  25.414 -		Thm("d2_sqrt_equation1_neg",num_str @{thm d2_sqrt_equation1_neg}),
  25.415 +		Thm("d2_sqrt_equation1_neg",TermC.num_str @{thm d2_sqrt_equation1_neg}),
  25.416                  (* [c<0] x^2=c   -> x=[]*)
  25.417 -		Thm("d2_sqrt_equation2",num_str @{thm d2_sqrt_equation2}),
  25.418 +		Thm("d2_sqrt_equation2",TermC.num_str @{thm d2_sqrt_equation2}),
  25.419                  (*  x^2=0 ->    x=0    *)
  25.420 -		Thm("d2_reduce_equation1",num_str @{thm d2_reduce_equation1}),
  25.421 +		Thm("d2_reduce_equation1",TermC.num_str @{thm d2_reduce_equation1}),
  25.422                  (* x(a+bx)=0 -> x=0 | a+bx=0*)
  25.423 -		Thm("d2_reduce_equation2",num_str @{thm d2_reduce_equation2}),
  25.424 +		Thm("d2_reduce_equation2",TermC.num_str @{thm d2_reduce_equation2}),
  25.425                  (* x(a+ x)=0 -> x=0 | a+ x=0*)
  25.426 -		Thm("d2_isolate_div",num_str @{thm d2_isolate_div})
  25.427 +		Thm("d2_isolate_div",TermC.num_str @{thm d2_isolate_div})
  25.428                 (* bx^2=c -> x^2=c/b*)
  25.429  	       ],
  25.430 -       scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
  25.431 +       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  25.432        }:rls);
  25.433  *}
  25.434  ML{*
  25.435 @@ -731,68 +731,68 @@
  25.436         rew_ord = ("e_rew_ord",e_rew_ord), erls = PolyEq_erls,
  25.437         srls = Erls, calc = [], errpatts = [],
  25.438         rules = 
  25.439 -       [Thm("d3_reduce_equation1",num_str @{thm d3_reduce_equation1}),
  25.440 +       [Thm("d3_reduce_equation1",TermC.num_str @{thm d3_reduce_equation1}),
  25.441  	(*a*bdv + b*bdv^^^2 + c*bdv^^^3=0) = 
  25.442          (bdv=0 | (a + b*bdv + c*bdv^^^2=0)*)
  25.443 -	Thm("d3_reduce_equation2",num_str @{thm d3_reduce_equation2}),
  25.444 +	Thm("d3_reduce_equation2",TermC.num_str @{thm d3_reduce_equation2}),
  25.445  	(*  bdv + b*bdv^^^2 + c*bdv^^^3=0) = 
  25.446          (bdv=0 | (1 + b*bdv + c*bdv^^^2=0)*)
  25.447 -	Thm("d3_reduce_equation3",num_str @{thm d3_reduce_equation3}),
  25.448 +	Thm("d3_reduce_equation3",TermC.num_str @{thm d3_reduce_equation3}),
  25.449  	(*a*bdv +   bdv^^^2 + c*bdv^^^3=0) = 
  25.450          (bdv=0 | (a +   bdv + c*bdv^^^2=0)*)
  25.451 -	Thm("d3_reduce_equation4",num_str @{thm d3_reduce_equation4}),
  25.452 +	Thm("d3_reduce_equation4",TermC.num_str @{thm d3_reduce_equation4}),
  25.453  	(*  bdv +   bdv^^^2 + c*bdv^^^3=0) = 
  25.454          (bdv=0 | (1 +   bdv + c*bdv^^^2=0)*)
  25.455 -	Thm("d3_reduce_equation5",num_str @{thm d3_reduce_equation5}),
  25.456 +	Thm("d3_reduce_equation5",TermC.num_str @{thm d3_reduce_equation5}),
  25.457  	(*a*bdv + b*bdv^^^2 +   bdv^^^3=0) = 
  25.458          (bdv=0 | (a + b*bdv +   bdv^^^2=0)*)
  25.459 -	Thm("d3_reduce_equation6",num_str @{thm d3_reduce_equation6}),
  25.460 +	Thm("d3_reduce_equation6",TermC.num_str @{thm d3_reduce_equation6}),
  25.461  	(*  bdv + b*bdv^^^2 +   bdv^^^3=0) = 
  25.462          (bdv=0 | (1 + b*bdv +   bdv^^^2=0)*)
  25.463 -	Thm("d3_reduce_equation7",num_str @{thm d3_reduce_equation7}),
  25.464 +	Thm("d3_reduce_equation7",TermC.num_str @{thm d3_reduce_equation7}),
  25.465  	     (*a*bdv +   bdv^^^2 +   bdv^^^3=0) = 
  25.466               (bdv=0 | (1 +   bdv +   bdv^^^2=0)*)
  25.467 -	Thm("d3_reduce_equation8",num_str @{thm d3_reduce_equation8}),
  25.468 +	Thm("d3_reduce_equation8",TermC.num_str @{thm d3_reduce_equation8}),
  25.469  	     (*  bdv +   bdv^^^2 +   bdv^^^3=0) = 
  25.470               (bdv=0 | (1 +   bdv +   bdv^^^2=0)*)
  25.471 -	Thm("d3_reduce_equation9",num_str @{thm d3_reduce_equation9}),
  25.472 +	Thm("d3_reduce_equation9",TermC.num_str @{thm d3_reduce_equation9}),
  25.473  	     (*a*bdv             + c*bdv^^^3=0) = 
  25.474               (bdv=0 | (a         + c*bdv^^^2=0)*)
  25.475 -	Thm("d3_reduce_equation10",num_str @{thm d3_reduce_equation10}),
  25.476 +	Thm("d3_reduce_equation10",TermC.num_str @{thm d3_reduce_equation10}),
  25.477  	     (*  bdv             + c*bdv^^^3=0) = 
  25.478               (bdv=0 | (1         + c*bdv^^^2=0)*)
  25.479 -	Thm("d3_reduce_equation11",num_str @{thm d3_reduce_equation11}),
  25.480 +	Thm("d3_reduce_equation11",TermC.num_str @{thm d3_reduce_equation11}),
  25.481  	     (*a*bdv             +   bdv^^^3=0) = 
  25.482               (bdv=0 | (a         +   bdv^^^2=0)*)
  25.483 -	Thm("d3_reduce_equation12",num_str @{thm d3_reduce_equation12}),
  25.484 +	Thm("d3_reduce_equation12",TermC.num_str @{thm d3_reduce_equation12}),
  25.485  	     (*  bdv             +   bdv^^^3=0) = 
  25.486               (bdv=0 | (1         +   bdv^^^2=0)*)
  25.487 -	Thm("d3_reduce_equation13",num_str @{thm d3_reduce_equation13}),
  25.488 +	Thm("d3_reduce_equation13",TermC.num_str @{thm d3_reduce_equation13}),
  25.489  	     (*        b*bdv^^^2 + c*bdv^^^3=0) = 
  25.490               (bdv=0 | (    b*bdv + c*bdv^^^2=0)*)
  25.491 -	Thm("d3_reduce_equation14",num_str @{thm d3_reduce_equation14}),
  25.492 +	Thm("d3_reduce_equation14",TermC.num_str @{thm d3_reduce_equation14}),
  25.493  	     (*          bdv^^^2 + c*bdv^^^3=0) = 
  25.494               (bdv=0 | (      bdv + c*bdv^^^2=0)*)
  25.495 -	Thm("d3_reduce_equation15",num_str @{thm d3_reduce_equation15}),
  25.496 +	Thm("d3_reduce_equation15",TermC.num_str @{thm d3_reduce_equation15}),
  25.497  	     (*        b*bdv^^^2 +   bdv^^^3=0) = 
  25.498               (bdv=0 | (    b*bdv +   bdv^^^2=0)*)
  25.499 -	Thm("d3_reduce_equation16",num_str @{thm d3_reduce_equation16}),
  25.500 +	Thm("d3_reduce_equation16",TermC.num_str @{thm d3_reduce_equation16}),
  25.501  	     (*          bdv^^^2 +   bdv^^^3=0) = 
  25.502               (bdv=0 | (      bdv +   bdv^^^2=0)*)
  25.503 -	Thm("d3_isolate_add1",num_str @{thm d3_isolate_add1}),
  25.504 +	Thm("d3_isolate_add1",TermC.num_str @{thm d3_isolate_add1}),
  25.505  	     (*[|Not(bdv occurs_in a)|] ==> (a + b*bdv^^^3=0) = 
  25.506                (bdv=0 | (b*bdv^^^3=a)*)
  25.507 -	Thm("d3_isolate_add2",num_str @{thm d3_isolate_add2}),
  25.508 +	Thm("d3_isolate_add2",TermC.num_str @{thm d3_isolate_add2}),
  25.509               (*[|Not(bdv occurs_in a)|] ==> (a +   bdv^^^3=0) = 
  25.510                (bdv=0 | (  bdv^^^3=a)*)
  25.511 -	Thm("d3_isolate_div",num_str @{thm d3_isolate_div}),
  25.512 +	Thm("d3_isolate_div",TermC.num_str @{thm d3_isolate_div}),
  25.513          (*[|Not(b=0)|] ==> (b*bdv^^^3=c) = (bdv^^^3=c/b*)
  25.514 -        Thm("d3_root_equation2",num_str @{thm d3_root_equation2}),
  25.515 +        Thm("d3_root_equation2",TermC.num_str @{thm d3_root_equation2}),
  25.516          (*(bdv^^^3=0) = (bdv=0) *)
  25.517 -	Thm("d3_root_equation1",num_str @{thm d3_root_equation1})
  25.518 +	Thm("d3_root_equation1",TermC.num_str @{thm d3_root_equation1})
  25.519         (*bdv^^^3=c) = (bdv = nroot 3 c*)
  25.520         ],
  25.521 -       scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
  25.522 +       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  25.523        }:rls);
  25.524  *}
  25.525  ML{*
  25.526 @@ -804,10 +804,10 @@
  25.527         rew_ord = ("e_rew_ord",e_rew_ord), erls = PolyEq_erls,
  25.528         srls = Erls, calc = [], errpatts = [],
  25.529         rules = 
  25.530 -       [Thm("d4_sub_u1",num_str @{thm d4_sub_u1})  
  25.531 +       [Thm("d4_sub_u1",TermC.num_str @{thm d4_sub_u1})  
  25.532         (* ax^4+bx^2+c=0 -> x=+-sqrt(ax^2+bx^+c) *)
  25.533         ],
  25.534 -       scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
  25.535 +       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  25.536        }:rls);
  25.537  *}
  25.538  setup {* KEStore_Elems.add_rlss 
  25.539 @@ -963,7 +963,7 @@
  25.540      "          (Try (Repeat (Rewrite_Set polyeq_simplify  False)))) e_e " ^
  25.541      " in (SubProblem (PolyEq',[polynomial,univariate,equation], [no_met])   " ^
  25.542      "                 [BOOL e_e, REAL v_v]))";
  25.543 -parse thy scr;
  25.544 +TermC.parse thy scr;
  25.545  *}
  25.546  
  25.547  text {* "-------------------------methods-----------------------" *}
  25.548 @@ -1167,7 +1167,7 @@
  25.549  fun size_of_term' x (Const ("Atools.pow",_) $ Free (var,_) $ Free (pot,_)) =
  25.550      (case x of                                                          (*WN*)
  25.551  	    (Free (xstr,_)) => 
  25.552 -		(if xstr = var then 1000*(the (int_of_str pot)) else 3)
  25.553 +		(if xstr = var then 1000*(the (TermC.int_of_str pot)) else 3)
  25.554  	  | _ => error ("size_of_term' called with subst = "^
  25.555  			      (term2str x)))
  25.556    | size_of_term' x (Free (subst,_)) =
  25.557 @@ -1233,17 +1233,17 @@
  25.558  		 ord_make_polynomial_in false @{theory "Poly"}),
  25.559        erls = e_rls,srls = Erls,
  25.560        calc = [], errpatts = [],
  25.561 -      rules = [Thm ("mult_commute",num_str @{thm mult.commute}),
  25.562 +      rules = [Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
  25.563  	       (* z * w = w * z *)
  25.564 -	       Thm ("real_mult_left_commute",num_str @{thm real_mult_left_commute}),
  25.565 +	       Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
  25.566  	       (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*)
  25.567 -	       Thm ("mult_assoc",num_str @{thm mult.assoc}),		
  25.568 +	       Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),		
  25.569  	       (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*)
  25.570 -	       Thm ("add_commute",num_str @{thm add.commute}),	
  25.571 +	       Thm ("add_commute",TermC.num_str @{thm add.commute}),	
  25.572  	       (*z + w = w + z*)
  25.573 -	       Thm ("add_left_commute",num_str @{thm add.left_commute}),
  25.574 +	       Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}),
  25.575  	       (*x + (y + z) = y + (x + z)*)
  25.576 -	       Thm ("add_assoc",num_str @{thm add.assoc})	               
  25.577 +	       Thm ("add_assoc",TermC.num_str @{thm add.assoc})	               
  25.578  	       (*z1.0 + z2.0 + z3.0 = z1.0 + (z2.0 + z3.0)*)
  25.579  	       ], scr = EmptyScr}:rls);
  25.580  
  25.581 @@ -1254,30 +1254,30 @@
  25.582        rew_ord = ("dummy_ord", dummy_ord),
  25.583        erls = e_rls,srls = Erls,
  25.584        calc = [], errpatts = [],
  25.585 -      rules = [Thm ("bdv_collect_1",num_str @{thm bdv_collect_1}),
  25.586 -	       Thm ("bdv_collect_2",num_str @{thm bdv_collect_2}),
  25.587 -	       Thm ("bdv_collect_3",num_str @{thm bdv_collect_3}),
  25.588 +      rules = [Thm ("bdv_collect_1",TermC.num_str @{thm bdv_collect_1}),
  25.589 +	       Thm ("bdv_collect_2",TermC.num_str @{thm bdv_collect_2}),
  25.590 +	       Thm ("bdv_collect_3",TermC.num_str @{thm bdv_collect_3}),
  25.591  
  25.592 -	       Thm ("bdv_collect_assoc1_1",num_str @{thm bdv_collect_assoc1_1}),
  25.593 -	       Thm ("bdv_collect_assoc1_2",num_str @{thm bdv_collect_assoc1_2}),
  25.594 -	       Thm ("bdv_collect_assoc1_3",num_str @{thm bdv_collect_assoc1_3}),
  25.595 +	       Thm ("bdv_collect_assoc1_1",TermC.num_str @{thm bdv_collect_assoc1_1}),
  25.596 +	       Thm ("bdv_collect_assoc1_2",TermC.num_str @{thm bdv_collect_assoc1_2}),
  25.597 +	       Thm ("bdv_collect_assoc1_3",TermC.num_str @{thm bdv_collect_assoc1_3}),
  25.598  
  25.599 -	       Thm ("bdv_collect_assoc2_1",num_str @{thm bdv_collect_assoc2_1}),
  25.600 -	       Thm ("bdv_collect_assoc2_2",num_str @{thm bdv_collect_assoc2_2}),
  25.601 -	       Thm ("bdv_collect_assoc2_3",num_str @{thm bdv_collect_assoc2_3}),
  25.602 +	       Thm ("bdv_collect_assoc2_1",TermC.num_str @{thm bdv_collect_assoc2_1}),
  25.603 +	       Thm ("bdv_collect_assoc2_2",TermC.num_str @{thm bdv_collect_assoc2_2}),
  25.604 +	       Thm ("bdv_collect_assoc2_3",TermC.num_str @{thm bdv_collect_assoc2_3}),
  25.605  
  25.606  
  25.607 -	       Thm ("bdv_n_collect_1",num_str @{thm bdv_n_collect_1}),
  25.608 -	       Thm ("bdv_n_collect_2",num_str @{thm bdv_n_collect_2}),
  25.609 -	       Thm ("bdv_n_collect_3",num_str @{thm bdv_n_collect_3}),
  25.610 +	       Thm ("bdv_n_collect_1",TermC.num_str @{thm bdv_n_collect_1}),
  25.611 +	       Thm ("bdv_n_collect_2",TermC.num_str @{thm bdv_n_collect_2}),
  25.612 +	       Thm ("bdv_n_collect_3",TermC.num_str @{thm bdv_n_collect_3}),
  25.613  
  25.614 -	       Thm ("bdv_n_collect_assoc1_1",num_str @{thm bdv_n_collect_assoc1_1}),
  25.615 -	       Thm ("bdv_n_collect_assoc1_2",num_str @{thm bdv_n_collect_assoc1_2}),
  25.616 -	       Thm ("bdv_n_collect_assoc1_3",num_str @{thm bdv_n_collect_assoc1_3}),
  25.617 +	       Thm ("bdv_n_collect_assoc1_1",TermC.num_str @{thm bdv_n_collect_assoc1_1}),
  25.618 +	       Thm ("bdv_n_collect_assoc1_2",TermC.num_str @{thm bdv_n_collect_assoc1_2}),
  25.619 +	       Thm ("bdv_n_collect_assoc1_3",TermC.num_str @{thm bdv_n_collect_assoc1_3}),
  25.620  
  25.621 -	       Thm ("bdv_n_collect_assoc2_1",num_str @{thm bdv_n_collect_assoc2_1}),
  25.622 -	       Thm ("bdv_n_collect_assoc2_2",num_str @{thm bdv_n_collect_assoc2_2}),
  25.623 -	       Thm ("bdv_n_collect_assoc2_3",num_str @{thm bdv_n_collect_assoc2_3})
  25.624 +	       Thm ("bdv_n_collect_assoc2_1",TermC.num_str @{thm bdv_n_collect_assoc2_1}),
  25.625 +	       Thm ("bdv_n_collect_assoc2_2",TermC.num_str @{thm bdv_n_collect_assoc2_2}),
  25.626 +	       Thm ("bdv_n_collect_assoc2_3",TermC.num_str @{thm bdv_n_collect_assoc2_3})
  25.627  	       ], scr = EmptyScr}:rls);
  25.628  
  25.629  *}
  25.630 @@ -1294,7 +1294,7 @@
  25.631  	       Rls_ simplify_power,
  25.632  	       Rls_ collect_numerals,
  25.633  	       Rls_ reduce_012,
  25.634 -	       Thm ("realpow_oneI",num_str @{thm realpow_oneI}),
  25.635 +	       Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}),
  25.636  	       Rls_ discard_parentheses,
  25.637  	       Rls_ collect_bdv
  25.638  	       ],
  25.639 @@ -1306,15 +1306,15 @@
  25.640  val separate_bdvs = 
  25.641      append_rls "separate_bdvs"
  25.642  	       collect_bdv
  25.643 -	       [Thm ("separate_bdv", num_str @{thm separate_bdv}),
  25.644 +	       [Thm ("separate_bdv", TermC.num_str @{thm separate_bdv}),
  25.645  		(*"?a * ?bdv / ?b = ?a / ?b * ?bdv"*)
  25.646 -		Thm ("separate_bdv_n", num_str @{thm separate_bdv_n}),
  25.647 -		Thm ("separate_1_bdv", num_str @{thm separate_1_bdv}),
  25.648 +		Thm ("separate_bdv_n", TermC.num_str @{thm separate_bdv_n}),
  25.649 +		Thm ("separate_1_bdv", TermC.num_str @{thm separate_1_bdv}),
  25.650  		(*"?bdv / ?b = (1 / ?b) * ?bdv"*)
  25.651 -		Thm ("separate_1_bdv_n", num_str @{thm separate_1_bdv_n}),
  25.652 +		Thm ("separate_1_bdv_n", TermC.num_str @{thm separate_1_bdv_n}),
  25.653  		(*"?bdv ^^^ ?n / ?b = 1 / ?b * ?bdv ^^^ ?n"*)
  25.654  		Thm ("add_divide_distrib", 
  25.655 -		     num_str @{thm add_divide_distrib})
  25.656 +		     TermC.num_str @{thm add_divide_distrib})
  25.657  		(*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"
  25.658  		      WN051031 DOES NOT BELONG TO HERE*)
  25.659  		];
    26.1 --- a/src/Tools/isac/Knowledge/PolyMinus.thy	Sun Feb 25 16:31:17 2018 +0100
    26.2 +++ b/src/Tools/isac/Knowledge/PolyMinus.thy	Fri Mar 02 14:19:59 2018 +0100
    26.3 @@ -121,57 +121,57 @@
    26.4    | identifier (Const ("Groups.times_class.times", _) $                          (* 3*a*b    *)
    26.5  		     (Const ("Groups.times_class.times", _) $
    26.6  			    Free (num, _) $ Free _) $ Free (id, _)) = 
    26.7 -    if is_numeral num then id
    26.8 +    if TermC.is_numeral num then id
    26.9      else "|||||||||||||"
   26.10    | identifier (Const ("Atools.pow", _) $ Free (base, _) $ Free (exp, _)) =
   26.11 -    if is_numeral base then "|||||||||||||"                  (* a^2      *)
   26.12 +    if TermC.is_numeral base then "|||||||||||||"                  (* a^2      *)
   26.13      else (*increase*) base
   26.14    | identifier (Const ("Groups.times_class.times", _) $ Free (num, _) $          (* 3*a^2    *)
   26.15  		     (Const ("Atools.pow", _) $
   26.16  			    Free (base, _) $ Free (exp, _))) = 
   26.17 -    if is_numeral num andalso not (is_numeral base) then (*increase*) base
   26.18 +    if TermC.is_numeral num andalso not (TermC.is_numeral base) then (*increase*) base
   26.19      else "|||||||||||||"
   26.20    | identifier _ = "|||||||||||||"(*the "largest" string*);
   26.21  
   26.22  (*("kleiner", ("PolyMinus.kleiner", eval_kleiner ""))*)
   26.23  (* order "by alphabet" w.r.t. var: num < (var | num*var) > (var*var | ..) *)
   26.24  fun eval_kleiner _ _ (p as (Const ("PolyMinus.kleiner",_) $ a $ b)) _  =
   26.25 -     if is_num b then
   26.26 -	 if is_num a then (*123 kleiner 32 = True !!!*)
   26.27 -	     if int_of_Free a < int_of_Free b then 
   26.28 +     if TermC.is_num b then
   26.29 +	 if TermC.is_num a then (*123 kleiner 32 = True !!!*)
   26.30 +	     if TermC.int_of_Free a < TermC.int_of_Free b then 
   26.31  		 SOME ((term2str p) ^ " = True",
   26.32 -		       Trueprop $ (mk_equality (p, @{term True})))
   26.33 +		       TermC.Trueprop $ (TermC.mk_equality (p, @{term True})))
   26.34  	     else SOME ((term2str p) ^ " = False",
   26.35 -			Trueprop $ (mk_equality (p, @{term False})))
   26.36 +			TermC.Trueprop $ (TermC.mk_equality (p, @{term False})))
   26.37  	 else (* -1 * -2 kleiner 0 *)
   26.38  	     SOME ((term2str p) ^ " = False",
   26.39 -		   Trueprop $ (mk_equality (p, @{term False})))
   26.40 +		   TermC.Trueprop $ (TermC.mk_equality (p, @{term False})))
   26.41      else
   26.42  	if identifier a < identifier b then 
   26.43  	     SOME ((term2str p) ^ " = True",
   26.44 -		  Trueprop $ (mk_equality (p, @{term True})))
   26.45 +		  TermC.Trueprop $ (TermC.mk_equality (p, @{term True})))
   26.46  	else SOME ((term2str p) ^ " = False",
   26.47 -		   Trueprop $ (mk_equality (p, @{term False})))
   26.48 +		   TermC.Trueprop $ (TermC.mk_equality (p, @{term False})))
   26.49    | eval_kleiner _ _ _ _ =  NONE;
   26.50  
   26.51  fun ist_monom (Free (id,_)) = true
   26.52    | ist_monom (Const ("Groups.times_class.times", _) $ Free (num, _) $ Free (id, _)) = 
   26.53 -    if is_numeral num then true else false
   26.54 +    if TermC.is_numeral num then true else false
   26.55    | ist_monom _ = false;
   26.56  (*. this function only accepts the most simple monoms       vvvvvvvvvv .*)
   26.57  fun ist_monom (Free (id,_)) = true                          (* 2,   a   *)
   26.58    | ist_monom (Const ("Groups.times_class.times", _) $ Free _ $ Free (id, _)) = (* 2*a, a*b *)
   26.59 -    if is_numeral id then false else true
   26.60 +    if TermC.is_numeral id then false else true
   26.61    | ist_monom (Const ("Groups.times_class.times", _) $                          (* 3*a*b    *)
   26.62  		     (Const ("Groups.times_class.times", _) $
   26.63  			    Free (num, _) $ Free _) $ Free (id, _)) =
   26.64 -    if is_numeral num andalso not (is_numeral id) then true else false
   26.65 +    if TermC.is_numeral num andalso not (TermC.is_numeral id) then true else false
   26.66    | ist_monom (Const ("Atools.pow", _) $ Free (base, _) $ Free (exp, _)) = 
   26.67      true                                                    (* a^2      *)
   26.68    | ist_monom (Const ("Groups.times_class.times", _) $ Free (num, _) $          (* 3*a^2    *)
   26.69  		     (Const ("Atools.pow", _) $
   26.70  			    Free (base, _) $ Free (exp, _))) = 
   26.71 -    if is_numeral num then true else false
   26.72 +    if TermC.is_numeral num then true else false
   26.73    | ist_monom _ = false;
   26.74  
   26.75  (* is this a univariate monomial ? *)
   26.76 @@ -179,9 +179,9 @@
   26.77  fun eval_ist_monom _ _ (p as (Const ("PolyMinus.ist'_monom",_) $ a)) _  =
   26.78      if ist_monom a  then 
   26.79  	SOME ((term2str p) ^ " = True",
   26.80 -	      Trueprop $ (mk_equality (p, @{term True})))
   26.81 +	      TermC.Trueprop $ (TermC.mk_equality (p, @{term True})))
   26.82      else SOME ((term2str p) ^ " = False",
   26.83 -	       Trueprop $ (mk_equality (p, @{term False})))
   26.84 +	       TermC.Trueprop $ (TermC.mk_equality (p, @{term False})))
   26.85    | eval_ist_monom _ _ _ _ =  NONE;
   26.86  
   26.87  
   26.88 @@ -199,21 +199,21 @@
   26.89    Rls{id = "ordne_alphabetisch", preconds = [], 
   26.90        rew_ord = ("dummy_ord", dummy_ord), srls = Erls, calc = [], errpatts = [],
   26.91        erls = erls_ordne_alphabetisch, 
   26.92 -      rules = [Thm ("tausche_plus",num_str @{thm tausche_plus}),
   26.93 +      rules = [Thm ("tausche_plus",TermC.num_str @{thm tausche_plus}),
   26.94  	       (*"b kleiner a ==> (b + a) = (a + b)"*)
   26.95 -	       Thm ("tausche_minus",num_str @{thm tausche_minus}),
   26.96 +	       Thm ("tausche_minus",TermC.num_str @{thm tausche_minus}),
   26.97  	       (*"b kleiner a ==> (b - a) = (-a + b)"*)
   26.98 -	       Thm ("tausche_vor_plus",num_str @{thm tausche_vor_plus}),
   26.99 +	       Thm ("tausche_vor_plus",TermC.num_str @{thm tausche_vor_plus}),
  26.100  	       (*"[| b ist_monom; a kleiner b  |] ==> (- b + a) = (a - b)"*)
  26.101 -	       Thm ("tausche_vor_minus",num_str @{thm tausche_vor_minus}),
  26.102 +	       Thm ("tausche_vor_minus",TermC.num_str @{thm tausche_vor_minus}),
  26.103  	       (*"[| b ist_monom; a kleiner b  |] ==> (- b - a) = (-a - b)"*)
  26.104 -	       Thm ("tausche_plus_plus",num_str @{thm tausche_plus_plus}),
  26.105 +	       Thm ("tausche_plus_plus",TermC.num_str @{thm tausche_plus_plus}),
  26.106  	       (*"c kleiner b ==> (a + c + b) = (a + b + c)"*)
  26.107 -	       Thm ("tausche_plus_minus",num_str @{thm tausche_plus_minus}),
  26.108 +	       Thm ("tausche_plus_minus",TermC.num_str @{thm tausche_plus_minus}),
  26.109  	       (*"c kleiner b ==> (a + c - b) = (a - b + c)"*)
  26.110 -	       Thm ("tausche_minus_plus",num_str @{thm tausche_minus_plus}),
  26.111 +	       Thm ("tausche_minus_plus",TermC.num_str @{thm tausche_minus_plus}),
  26.112  	       (*"c kleiner b ==> (a - c + b) = (a + b - c)"*)
  26.113 -	       Thm ("tausche_minus_minus",num_str @{thm tausche_minus_minus})
  26.114 +	       Thm ("tausche_minus_minus",TermC.num_str @{thm tausche_minus_minus})
  26.115  	       (*"c kleiner b ==> (a - c - b) = (a - b - c)"*)
  26.116  	       ], scr = EmptyScr}:rls;
  26.117  
  26.118 @@ -224,42 +224,42 @@
  26.119  			  [Calc ("Atools.is'_const",eval_const "#is_const_")], 
  26.120  	srls = Erls, calc = [], errpatts = [],
  26.121  	rules = 
  26.122 -	[Thm ("real_num_collect",num_str @{thm real_num_collect}), 
  26.123 +	[Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  26.124  	 (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
  26.125 -	 Thm ("real_num_collect_assoc_r",num_str @{thm real_num_collect_assoc_r}),
  26.126 +	 Thm ("real_num_collect_assoc_r",TermC.num_str @{thm real_num_collect_assoc_r}),
  26.127  	 (*"[| l is_const; m..|] ==>  (k + m * n) + l * n = k + (l + m)*n"*)
  26.128 -	 Thm ("real_one_collect",num_str @{thm real_one_collect}),	
  26.129 +	 Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),	
  26.130  	 (*"m is_const ==> n + m * n = (1 + m) * n"*)
  26.131 -	 Thm ("real_one_collect_assoc_r",num_str @{thm real_one_collect_assoc_r}), 
  26.132 +	 Thm ("real_one_collect_assoc_r",TermC.num_str @{thm real_one_collect_assoc_r}), 
  26.133  	 (*"m is_const ==> (k + n) + m * n = k + (m + 1) * n"*)
  26.134  
  26.135  
  26.136 -	 Thm ("subtrahiere",num_str @{thm subtrahiere}),
  26.137 +	 Thm ("subtrahiere",TermC.num_str @{thm subtrahiere}),
  26.138  	 (*"[| l is_const; m is_const |] ==> m * v - l * v = (m - l) * v"*)
  26.139 -	 Thm ("subtrahiere_von_1",num_str @{thm subtrahiere_von_1}),
  26.140 +	 Thm ("subtrahiere_von_1",TermC.num_str @{thm subtrahiere_von_1}),
  26.141  	 (*"[| l is_const |] ==> v - l * v = (1 - l) * v"*)
  26.142 -	 Thm ("subtrahiere_1",num_str @{thm subtrahiere_1}),
  26.143 +	 Thm ("subtrahiere_1",TermC.num_str @{thm subtrahiere_1}),
  26.144  	 (*"[| l is_const; m is_const |] ==> m * v - v = (m - 1) * v"*)
  26.145  
  26.146 -	 Thm ("subtrahiere_x_plus_minus",num_str @{thm subtrahiere_x_plus_minus}), 
  26.147 +	 Thm ("subtrahiere_x_plus_minus",TermC.num_str @{thm subtrahiere_x_plus_minus}), 
  26.148  	 (*"[| l is_const; m..|] ==> (k + m * n) - l * n = k + ( m - l) * n"*)
  26.149 -	 Thm ("subtrahiere_x_plus1_minus",num_str @{thm subtrahiere_x_plus1_minus}),
  26.150 +	 Thm ("subtrahiere_x_plus1_minus",TermC.num_str @{thm subtrahiere_x_plus1_minus}),
  26.151  	 (*"[| l is_const |] ==> (x + v) - l * v = x + (1 - l) * v"*)
  26.152 -	 Thm ("subtrahiere_x_plus_minus1",num_str @{thm subtrahiere_x_plus_minus1}),
  26.153 +	 Thm ("subtrahiere_x_plus_minus1",TermC.num_str @{thm subtrahiere_x_plus_minus1}),
  26.154  	 (*"[| m is_const |] ==> (x + m * v) - v = x + (m - 1) * v"*)
  26.155  
  26.156 -	 Thm ("subtrahiere_x_minus_plus",num_str @{thm subtrahiere_x_minus_plus}), 
  26.157 +	 Thm ("subtrahiere_x_minus_plus",TermC.num_str @{thm subtrahiere_x_minus_plus}), 
  26.158  	 (*"[| l is_const; m..|] ==> (k - m * n) + l * n = k + (-m + l) * n"*)
  26.159 -	 Thm ("subtrahiere_x_minus1_plus",num_str @{thm subtrahiere_x_minus1_plus}),
  26.160 +	 Thm ("subtrahiere_x_minus1_plus",TermC.num_str @{thm subtrahiere_x_minus1_plus}),
  26.161  	 (*"[| l is_const |] ==> (x - v) + l * v = x + (-1 + l) * v"*)
  26.162 -	 Thm ("subtrahiere_x_minus_plus1",num_str @{thm subtrahiere_x_minus_plus1}),
  26.163 +	 Thm ("subtrahiere_x_minus_plus1",TermC.num_str @{thm subtrahiere_x_minus_plus1}),
  26.164  	 (*"[| m is_const |] ==> (x - m * v) + v = x + (-m + 1) * v"*)
  26.165  
  26.166 -	 Thm ("subtrahiere_x_minus_minus",num_str @{thm subtrahiere_x_minus_minus}), 
  26.167 +	 Thm ("subtrahiere_x_minus_minus",TermC.num_str @{thm subtrahiere_x_minus_minus}), 
  26.168  	 (*"[| l is_const; m..|] ==> (k - m * n) - l * n = k + (-m - l) * n"*)
  26.169 -	 Thm ("subtrahiere_x_minus1_minus",num_str @{thm subtrahiere_x_minus1_minus}),
  26.170 +	 Thm ("subtrahiere_x_minus1_minus",TermC.num_str @{thm subtrahiere_x_minus1_minus}),
  26.171  	 (*"[| l is_const |] ==> (x - v) - l * v = x + (-1 - l) * v"*)
  26.172 -	 Thm ("subtrahiere_x_minus_minus1",num_str @{thm subtrahiere_x_minus_minus1}),
  26.173 +	 Thm ("subtrahiere_x_minus_minus1",TermC.num_str @{thm subtrahiere_x_minus_minus1}),
  26.174  	 (*"[| m is_const |] ==> (x - m * v) - v = x + (-m - 1) * v"*)
  26.175  	 
  26.176  	 Calc ("Groups.plus_class.plus", eval_binop "#add_"),
  26.177 @@ -267,18 +267,18 @@
  26.178  	 
  26.179  	 (*MG: Reihenfolge der folgenden 2 Thm muss so bleiben, wegen
  26.180             (a+a)+a --> a + 2*a --> 3*a and not (a+a)+a --> 2*a + a *)
  26.181 -	 Thm ("real_mult_2_assoc_r",num_str @{thm real_mult_2_assoc_r}),
  26.182 +	 Thm ("real_mult_2_assoc_r",TermC.num_str @{thm real_mult_2_assoc_r}),
  26.183  	 (*"(k + z1) + z1 = k + 2 * z1"*)
  26.184 -	 Thm ("sym_real_mult_2",num_str (@{thm real_mult_2} RS @{thm sym})),
  26.185 +	 Thm ("sym_real_mult_2",TermC.num_str (@{thm real_mult_2} RS @{thm sym})),
  26.186  	 (*"z1 + z1 = 2 * z1"*)
  26.187  
  26.188 -	 Thm ("addiere_vor_minus",num_str @{thm addiere_vor_minus}),
  26.189 +	 Thm ("addiere_vor_minus",TermC.num_str @{thm addiere_vor_minus}),
  26.190  	 (*"[| l is_const; m is_const |] ==> -(l * v) +  m * v = (-l + m) *v"*)
  26.191 -	 Thm ("addiere_eins_vor_minus",num_str @{thm addiere_eins_vor_minus}),
  26.192 +	 Thm ("addiere_eins_vor_minus",TermC.num_str @{thm addiere_eins_vor_minus}),
  26.193  	 (*"[| m is_const |] ==> -  v +  m * v = (-1 + m) * v"*)
  26.194 -	 Thm ("subtrahiere_vor_minus",num_str @{thm subtrahiere_vor_minus}),
  26.195 +	 Thm ("subtrahiere_vor_minus",TermC.num_str @{thm subtrahiere_vor_minus}),
  26.196  	 (*"[| l is_const; m is_const |] ==> -(l * v) -  m * v = (-l - m) *v"*)
  26.197 -	 Thm ("subtrahiere_eins_vor_minus",num_str @{thm subtrahiere_eins_vor_minus})
  26.198 +	 Thm ("subtrahiere_eins_vor_minus",TermC.num_str @{thm subtrahiere_eins_vor_minus})
  26.199  	 (*"[| m is_const |] ==> -  v -  m * v = (-1 - m) * v"*)
  26.200  	 
  26.201  	 ], scr = EmptyScr}:rls;
  26.202 @@ -288,29 +288,29 @@
  26.203        rew_ord = ("dummy_ord", dummy_ord), srls = Erls, calc = [], errpatts = [],
  26.204        erls = append_rls "erls_verschoenere" e_rls 
  26.205  			[Calc ("PolyMinus.kleiner", eval_kleiner "")], 
  26.206 -      rules = [Thm ("vorzeichen_minus_weg1",num_str @{thm vorzeichen_minus_weg1}),
  26.207 +      rules = [Thm ("vorzeichen_minus_weg1",TermC.num_str @{thm vorzeichen_minus_weg1}),
  26.208  	       (*"l kleiner 0 ==> a + l * b = a - -l * b"*)
  26.209 -	       Thm ("vorzeichen_minus_weg2",num_str @{thm vorzeichen_minus_weg2}),
  26.210 +	       Thm ("vorzeichen_minus_weg2",TermC.num_str @{thm vorzeichen_minus_weg2}),
  26.211  	       (*"l kleiner 0 ==> a - l * b = a + -l * b"*)
  26.212 -	       Thm ("vorzeichen_minus_weg3",num_str @{thm vorzeichen_minus_weg3}),
  26.213 +	       Thm ("vorzeichen_minus_weg3",TermC.num_str @{thm vorzeichen_minus_weg3}),
  26.214  	       (*"l kleiner 0 ==> k + a - l * b = k + a + -l * b"*)
  26.215 -	       Thm ("vorzeichen_minus_weg4",num_str @{thm vorzeichen_minus_weg4}),
  26.216 +	       Thm ("vorzeichen_minus_weg4",TermC.num_str @{thm vorzeichen_minus_weg4}),
  26.217  	       (*"l kleiner 0 ==> k - a - l * b = k - a + -l * b"*)
  26.218  
  26.219  	       Calc ("Groups.times_class.times", eval_binop "#mult_"),
  26.220  
  26.221 -	       Thm ("mult_zero_left",num_str @{thm mult_zero_left}),    
  26.222 +	       Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),    
  26.223  	       (*"0 * z = 0"*)
  26.224 -	       Thm ("mult_1_left",num_str @{thm mult_1_left}),     
  26.225 +	       Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),     
  26.226  	       (*"1 * z = z"*)
  26.227 -	       Thm ("add_0_left",num_str @{thm add_0_left}),
  26.228 +	       Thm ("add_0_left",TermC.num_str @{thm add_0_left}),
  26.229  	       (*"0 + z = z"*)
  26.230 -	       Thm ("null_minus",num_str @{thm null_minus}),
  26.231 +	       Thm ("null_minus",TermC.num_str @{thm null_minus}),
  26.232  	       (*"0 - a = -a"*)
  26.233 -	       Thm ("vor_minus_mal",num_str @{thm vor_minus_mal})
  26.234 +	       Thm ("vor_minus_mal",TermC.num_str @{thm vor_minus_mal})
  26.235  	       (*"- a * b = (-a) * b"*)
  26.236  
  26.237 -	       (*Thm ("",num_str @{}),*)
  26.238 +	       (*Thm ("",TermC.num_str @{}),*)
  26.239  	       (**)
  26.240  	       ], scr = EmptyScr}:rls (*end verschoenere*);
  26.241  
  26.242 @@ -318,30 +318,30 @@
  26.243    Rls{id = "klammern_aufloesen", preconds = [], 
  26.244        rew_ord = ("dummy_ord", dummy_ord), srls = Erls, calc = [], errpatts = [], erls = Erls, 
  26.245        rules = [Thm ("sym_add_assoc",
  26.246 -                     num_str (@{thm add.assoc} RS @{thm sym})),
  26.247 +                     TermC.num_str (@{thm add.assoc} RS @{thm sym})),
  26.248  	       (*"a + (b + c) = (a + b) + c"*)
  26.249 -	       Thm ("klammer_plus_minus",num_str @{thm klammer_plus_minus}),
  26.250 +	       Thm ("klammer_plus_minus",TermC.num_str @{thm klammer_plus_minus}),
  26.251  	       (*"a + (b - c) = (a + b) - c"*)
  26.252 -	       Thm ("klammer_minus_plus",num_str @{thm klammer_minus_plus}),
  26.253 +	       Thm ("klammer_minus_plus",TermC.num_str @{thm klammer_minus_plus}),
  26.254  	       (*"a - (b + c) = (a - b) - c"*)
  26.255 -	       Thm ("klammer_minus_minus",num_str @{thm klammer_minus_minus})
  26.256 +	       Thm ("klammer_minus_minus",TermC.num_str @{thm klammer_minus_minus})
  26.257  	       (*"a - (b - c) = (a - b) + c"*)
  26.258  	       ], scr = EmptyScr}:rls;
  26.259  
  26.260  val klammern_ausmultiplizieren = 
  26.261    Rls{id = "klammern_ausmultiplizieren", preconds = [], 
  26.262        rew_ord = ("dummy_ord", dummy_ord), srls = Erls, calc = [], errpatts = [], erls = Erls, 
  26.263 -      rules = [Thm ("distrib_right" ,num_str @{thm distrib_right}),
  26.264 +      rules = [Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),
  26.265  	       (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  26.266 -	       Thm ("distrib_left",num_str @{thm distrib_left}),
  26.267 +	       Thm ("distrib_left",TermC.num_str @{thm distrib_left}),
  26.268  	       (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  26.269  	       
  26.270 -	       Thm ("klammer_mult_minus",num_str @{thm klammer_mult_minus}),
  26.271 +	       Thm ("klammer_mult_minus",TermC.num_str @{thm klammer_mult_minus}),
  26.272  	       (*"a * (b - c) = a * b - a * c"*)
  26.273 -	       Thm ("klammer_minus_mult",num_str @{thm klammer_minus_mult})
  26.274 +	       Thm ("klammer_minus_mult",TermC.num_str @{thm klammer_minus_mult})
  26.275  	       (*"(b - c) * a = b * a - c * a"*)
  26.276  
  26.277 -	       (*Thm ("",num_str @{}),
  26.278 +	       (*Thm ("",TermC.num_str @{}),
  26.279  	       (*""*)*)
  26.280  	       ], scr = EmptyScr}:rls;
  26.281  
  26.282 @@ -352,16 +352,16 @@
  26.283  	       [Calc ("PolyMinus.kleiner", eval_kleiner ""),
  26.284  		Calc ("Atools.is'_atom", eval_is_atom "")
  26.285  		], 
  26.286 -      rules = [Thm ("tausche_mal",num_str @{thm tausche_mal}),
  26.287 +      rules = [Thm ("tausche_mal",TermC.num_str @{thm tausche_mal}),
  26.288  	       (*"[| b is_atom; a kleiner b  |] ==> (b * a) = (a * b)"*)
  26.289 -	       Thm ("tausche_vor_mal",num_str @{thm tausche_vor_mal}),
  26.290 +	       Thm ("tausche_vor_mal",TermC.num_str @{thm tausche_vor_mal}),
  26.291  	       (*"[| b is_atom; a kleiner b  |] ==> (-b * a) = (-a * b)"*)
  26.292 -	       Thm ("tausche_mal_mal",num_str @{thm tausche_mal_mal}),
  26.293 +	       Thm ("tausche_mal_mal",TermC.num_str @{thm tausche_mal_mal}),
  26.294  	       (*"[| c is_atom; b kleiner c  |] ==> (a * c * b) = (a * b *c)"*)
  26.295 -	       Thm ("x_quadrat",num_str @{thm x_quadrat})
  26.296 +	       Thm ("x_quadrat",TermC.num_str @{thm x_quadrat})
  26.297  	       (*"(x * a) * a = x * a ^^^ 2"*)
  26.298  
  26.299 -	       (*Thm ("",num_str @{}),
  26.300 +	       (*Thm ("",TermC.num_str @{}),
  26.301  	       (*""*)*)
  26.302  	       ], scr = EmptyScr}:rls;
  26.303  
  26.304 @@ -415,13 +415,13 @@
  26.305          append_rls "prls_pbl_vereinf_poly" e_rls 
  26.306  	        [Calc ("Poly.is'_polyexp", eval_is_polyexp ""),
  26.307  	          Calc ("Tools.matchsub", eval_matchsub ""),
  26.308 -	          Thm ("or_true", num_str @{thm or_true}),
  26.309 +	          Thm ("or_true", TermC.num_str @{thm or_true}),
  26.310              (*"(?a | True) = True"*)
  26.311 -            Thm ("or_false", num_str @{thm or_false}),
  26.312 +            Thm ("or_false", TermC.num_str @{thm or_false}),
  26.313              (*"(?a | False) = ?a"*)
  26.314 -            Thm ("not_true",num_str @{thm not_true}),
  26.315 +            Thm ("not_true",TermC.num_str @{thm not_true}),
  26.316              (*"(~ True) = False"*)
  26.317 -            Thm ("not_false",num_str @{thm not_false})
  26.318 +            Thm ("not_false",TermC.num_str @{thm not_false})
  26.319              (*"(~ False) = True"*)], 
  26.320         SOME "Vereinfache t_t", [["simplification","for_polynomials","with_minus"]])),
  26.321      (Specify.prep_pbt thy "pbl_vereinf_poly_klammer" [] e_pblID
  26.322 @@ -436,13 +436,13 @@
  26.323          append_rls "prls_pbl_vereinf_poly_klammer" e_rls
  26.324            [Calc ("Poly.is'_polyexp", eval_is_polyexp ""),
  26.325  	           Calc ("Tools.matchsub", eval_matchsub ""),
  26.326 -             Thm ("or_true", num_str @{thm or_true}),
  26.327 +             Thm ("or_true", TermC.num_str @{thm or_true}),
  26.328               (*"(?a | True) = True"*)
  26.329 -             Thm ("or_false", num_str @{thm or_false}),
  26.330 +             Thm ("or_false", TermC.num_str @{thm or_false}),
  26.331               (*"(?a | False) = ?a"*)
  26.332 -             Thm ("not_true",num_str @{thm not_true}),
  26.333 +             Thm ("not_true",TermC.num_str @{thm not_true}),
  26.334               (*"(~ True) = False"*)
  26.335 -             Thm ("not_false",num_str @{thm not_false})
  26.336 +             Thm ("not_false",TermC.num_str @{thm not_false})
  26.337               (*"(~ False) = True"*)], 
  26.338          SOME "Vereinfache t_t", 
  26.339          [["simplification","for_polynomials","with_parentheses"]])),
  26.340 @@ -489,13 +489,13 @@
  26.341  	        prls = append_rls "prls_met_simp_poly_minus" e_rls 
  26.342  				      [Calc ("Poly.is'_polyexp", eval_is_polyexp ""),
  26.343  				        Calc ("Tools.matchsub", eval_matchsub ""),
  26.344 -				        Thm ("and_true",num_str @{thm and_true}),
  26.345 +				        Thm ("and_true",TermC.num_str @{thm and_true}),
  26.346                  (*"(?a & True) = ?a"*)
  26.347 -                Thm ("and_false",num_str @{thm and_false}),
  26.348 +                Thm ("and_false",TermC.num_str @{thm and_false}),
  26.349                  (*"(?a & False) = False"*)
  26.350 -                Thm ("not_true",num_str @{thm not_true}),
  26.351 +                Thm ("not_true",TermC.num_str @{thm not_true}),
  26.352                  (*"(~ True) = False"*)
  26.353 -                Thm ("not_false",num_str @{thm not_false})
  26.354 +                Thm ("not_false",TermC.num_str @{thm not_false})
  26.355                  (*"(~ False) = True"*)],
  26.356            crls = e_rls, errpats = [], nrls = rls_p_33},
  26.357            "Script SimplifyScript (t_t::real) =                   " ^
    27.1 --- a/src/Tools/isac/Knowledge/RatEq.thy	Sun Feb 25 16:31:17 2018 +0100
    27.2 +++ b/src/Tools/isac/Knowledge/RatEq.thy	Fri Mar 02 14:19:59 2018 +0100
    27.3 @@ -60,7 +60,7 @@
    27.4  (* is_rateqation_in becomes true, if a bdv is in the denominator of a fraction*)
    27.5  fun is_rateqation_in t v = 
    27.6      let 
    27.7 -	fun coeff_in c v = member op = (vars c) v;
    27.8 +	fun coeff_in c v = member op = (TermC.vars c) v;
    27.9     	fun finddivide (_ $ _ $ _ $ _) v = error("is_rateqation_in:")
   27.10  	    (* at the moment there is no term like this, but ....*)
   27.11  	  | finddivide (t as (Const ("Rings.divide_class.divide",_) $ _ $ b)) v = coeff_in b v
   27.12 @@ -76,9 +76,9 @@
   27.13         (p as (Const ("RatEq.is'_ratequation'_in",_) $ t $ v)) _  =
   27.14      if is_rateqation_in t v then 
   27.15  	SOME ((term2str p) ^ " = True",
   27.16 -	      Trueprop $ (mk_equality (p, @{term True})))
   27.17 +	      TermC.Trueprop $ (TermC.mk_equality (p, @{term True})))
   27.18      else SOME ((term2str p) ^ " = True",
   27.19 -	       Trueprop $ (mk_equality (p, @{term False})))
   27.20 +	       TermC.Trueprop $ (TermC.mk_equality (p, @{term False})))
   27.21    | eval_is_ratequation_in _ _ _ _ = ((*tracing"### nichts matcht";*) NONE);
   27.22  
   27.23  (*-------------------------rulse-----------------------*)
   27.24 @@ -90,12 +90,12 @@
   27.25  	      Calc ("Tools.rhs"    ,eval_rhs ""),
   27.26  	      Calc ("RatEq.is'_ratequation'_in",eval_is_ratequation_in ""),
   27.27  	      Calc ("HOL.eq",eval_equal "#equal_"),
   27.28 -	      Thm ("not_true",num_str @{thm not_true}),
   27.29 -	      Thm ("not_false",num_str @{thm not_false}),
   27.30 -	      Thm ("and_true",num_str @{thm and_true}),
   27.31 -	      Thm ("and_false",num_str @{thm and_false}),
   27.32 -	      Thm ("or_true",num_str @{thm or_true}),
   27.33 -	      Thm ("or_false",num_str @{thm or_false})
   27.34 +	      Thm ("not_true",TermC.num_str @{thm not_true}),
   27.35 +	      Thm ("not_false",TermC.num_str @{thm not_false}),
   27.36 +	      Thm ("and_true",TermC.num_str @{thm and_true}),
   27.37 +	      Thm ("and_false",TermC.num_str @{thm and_false}),
   27.38 +	      Thm ("or_true",TermC.num_str @{thm or_true}),
   27.39 +	      Thm ("or_false",TermC.num_str @{thm or_false})
   27.40  	      ];
   27.41  
   27.42  
   27.43 @@ -110,8 +110,8 @@
   27.44  			       eval_is_ratequation_in "")
   27.45  
   27.46  			 ]))
   27.47 -	[Thm ("and_commute",num_str @{thm and_commute}), (*WN: ein Hack*)
   27.48 -	 Thm ("or_commute",num_str @{thm or_commute})    (*WN: ein Hack*)
   27.49 +	[Thm ("and_commute",TermC.num_str @{thm and_commute}), (*WN: ein Hack*)
   27.50 +	 Thm ("or_commute",TermC.num_str @{thm or_commute})    (*WN: ein Hack*)
   27.51  	 ];
   27.52  *}
   27.53  setup {* KEStore_Elems.add_rlss [("rateq_erls", (Context.theory_name @{theory}, rateq_erls))] *}
   27.54 @@ -126,8 +126,8 @@
   27.55  			 Calc ("RatEq.is'_ratequation'_in",
   27.56  			       eval_is_ratequation_in "")
   27.57  			 ]))
   27.58 -	[Thm ("and_commute",num_str @{thm and_commute}), (*WN: ein Hack*)
   27.59 -	 Thm ("or_commute",num_str @{thm or_commute})    (*WN: ein Hack*)
   27.60 +	[Thm ("and_commute",TermC.num_str @{thm and_commute}), (*WN: ein Hack*)
   27.61 +	 Thm ("or_commute",TermC.num_str @{thm or_commute})    (*WN: ein Hack*)
   27.62  	 ];
   27.63  
   27.64  val RatEq_eliminate = prep_rls'(
   27.65 @@ -135,14 +135,14 @@
   27.66         rew_ord = ("termlessI", termlessI), erls = rateq_erls, srls = Erls, 
   27.67         calc = [], errpatts = [],
   27.68         rules = [
   27.69 -	    Thm("rat_mult_denominator_both",num_str @{thm rat_mult_denominator_both}), 
   27.70 +	    Thm("rat_mult_denominator_both",TermC.num_str @{thm rat_mult_denominator_both}), 
   27.71  	     (* a/b=c/d -> ad=cb *)
   27.72 -	    Thm("rat_mult_denominator_left",num_str @{thm rat_mult_denominator_left}), 
   27.73 +	    Thm("rat_mult_denominator_left",TermC.num_str @{thm rat_mult_denominator_left}), 
   27.74  	     (* a  =c/d -> ad=c  *)
   27.75 -	    Thm("rat_mult_denominator_right",num_str @{thm rat_mult_denominator_right})
   27.76 +	    Thm("rat_mult_denominator_right",TermC.num_str @{thm rat_mult_denominator_right})
   27.77  	     (* a/b=c   ->  a=cb *)
   27.78  	    ],
   27.79 -    scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
   27.80 +    scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
   27.81      }:rls);
   27.82  *}
   27.83  setup {* KEStore_Elems.add_rlss [("RatEq_eliminate",
   27.84 @@ -153,24 +153,24 @@
   27.85    Rls {id = "RatEq_simplify", preconds = [], rew_ord = ("termlessI", termlessI),
   27.86        erls = rateq_erls, srls = Erls, calc = [], errpatts = [],
   27.87      rules = [
   27.88 -	     Thm("real_rat_mult_1",num_str @{thm real_rat_mult_1}),
   27.89 +	     Thm("real_rat_mult_1",TermC.num_str @{thm real_rat_mult_1}),
   27.90  	     (*a*(b/c) = (a*b)/c*)
   27.91 -	     Thm("real_rat_mult_2",num_str @{thm real_rat_mult_2}),
   27.92 +	     Thm("real_rat_mult_2",TermC.num_str @{thm real_rat_mult_2}),
   27.93  	     (*(a/b)*(c/d) = (a*c)/(b*d)*)
   27.94 -             Thm("real_rat_mult_3",num_str @{thm real_rat_mult_3}),
   27.95 +             Thm("real_rat_mult_3",TermC.num_str @{thm real_rat_mult_3}),
   27.96               (* (a/b)*c = (a*c)/b*)
   27.97 -	     Thm("real_rat_pow",num_str @{thm real_rat_pow}),
   27.98 +	     Thm("real_rat_pow",TermC.num_str @{thm real_rat_pow}),
   27.99  	     (*(a/b)^^^2 = a^^^2/b^^^2*)
  27.100 -	     Thm("real_diff_minus",num_str @{thm real_diff_minus}),
  27.101 +	     Thm("real_diff_minus",TermC.num_str @{thm real_diff_minus}),
  27.102  	     (* a - b = a + (-1) * b *)
  27.103 -             Thm("rat_double_rat_1",num_str @{thm rat_double_rat_1}),
  27.104 +             Thm("rat_double_rat_1",TermC.num_str @{thm rat_double_rat_1}),
  27.105               (* (a / (c/d) = (a*d) / c) *)
  27.106 -             Thm("rat_double_rat_2",num_str @{thm rat_double_rat_2}), 
  27.107 +             Thm("rat_double_rat_2",TermC.num_str @{thm rat_double_rat_2}), 
  27.108               (* ((a/b) / (c/d) = (a*d) / (b*c)) *)
  27.109 -             Thm("rat_double_rat_3",num_str @{thm rat_double_rat_3}) 
  27.110 +             Thm("rat_double_rat_3",TermC.num_str @{thm rat_double_rat_3}) 
  27.111               (* ((a/b) / c = a / (b*c) ) *)
  27.112  	     ],
  27.113 -    scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
  27.114 +    scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  27.115      }:rls);
  27.116  *}
  27.117  setup {* KEStore_Elems.add_rlss [("RatEq_simplify",
    28.1 --- a/src/Tools/isac/Knowledge/Rational.thy	Sun Feb 25 16:31:17 2018 +0100
    28.2 +++ b/src/Tools/isac/Knowledge/Rational.thy	Fri Mar 02 14:19:59 2018 +0100
    28.3 @@ -43,10 +43,10 @@
    28.4  fun eval_is_ratpolyexp (thmid:string) _ 
    28.5  		       (t as (Const("Rational.is'_ratpolyexp", _) $ arg)) thy =
    28.6      if is_ratpolyexp arg
    28.7 -    then SOME (mk_thmid thmid "" (term_to_string''' thy arg) "", 
    28.8 -	         Trueprop $ (mk_equality (t, @{term True})))
    28.9 -    else SOME (mk_thmid thmid "" (term_to_string''' thy arg) "", 
   28.10 -	         Trueprop $ (mk_equality (t, @{term False})))
   28.11 +    then SOME (TermC.mk_thmid thmid "" (term_to_string''' thy arg) "", 
   28.12 +	         TermC.Trueprop $ (TermC.mk_equality (t, @{term True})))
   28.13 +    else SOME (TermC.mk_thmid thmid "" (term_to_string''' thy arg) "", 
   28.14 +	         TermC.Trueprop $ (TermC.mk_equality (t, @{term False})))
   28.15    | eval_is_ratpolyexp _ _ _ _ = NONE; 
   28.16  
   28.17  (*("get_denominator", ("Rational.get_denominator", eval_get_denominator ""))*)
   28.18 @@ -54,8 +54,8 @@
   28.19  		      (t as Const ("Rational.get_denominator", _) $
   28.20                (Const ("Rings.divide_class.divide", _) $ num $
   28.21                  denom)) thy = 
   28.22 -      SOME (mk_thmid thmid "" (term_to_string''' thy denom) "", 
   28.23 -	            Trueprop $ (mk_equality (t, denom)))
   28.24 +      SOME (TermC.mk_thmid thmid "" (term_to_string''' thy denom) "", 
   28.25 +	            TermC.Trueprop $ (TermC.mk_equality (t, denom)))
   28.26    | eval_get_denominator _ _ _ _ = NONE; 
   28.27  
   28.28  (*("get_numerator", ("Rational.get_numerator", eval_get_numerator ""))*)
   28.29 @@ -63,8 +63,8 @@
   28.30        (t as Const ("Rational.get_numerator", _) $
   28.31            (Const ("Rings.divide_class.divide", _) $num
   28.32              $denom )) thy = 
   28.33 -    SOME (mk_thmid thmid "" (term_to_string''' thy num) "", 
   28.34 -	    Trueprop $ (mk_equality (t, num)))
   28.35 +    SOME (TermC.mk_thmid thmid "" (term_to_string''' thy num) "", 
   28.36 +	    TermC.Trueprop $ (TermC.mk_equality (t, num)))
   28.37    | eval_get_numerator _ _ _ _ = NONE; 
   28.38  *}
   28.39  
   28.40 @@ -122,11 +122,11 @@
   28.41  subsubsection {* Convert a term to the internal representation of a multivariate polynomial *}
   28.42  ML {*
   28.43  fun monom_of_term  vs (c, es) (Free (id, _)) =
   28.44 -    if is_numeral id 
   28.45 -    then (id |> int_of_str |> the |> curry op * c, es) (*several numerals in one monom*)
   28.46 +    if TermC.is_numeral id 
   28.47 +    then (id |> TermC.int_of_str |> the |> curry op * c, es) (*several numerals in one monom*)
   28.48      else (c, list_update es (find_index (curry op = id) vs) 1)
   28.49    | monom_of_term  vs (c, es) (Const ("Atools.pow", _) $ Free (id, _) $ Free (e, _)) =
   28.50 -    (c, list_update es (find_index (curry op = id) vs) (the (int_of_str e)))
   28.51 +    (c, list_update es (find_index (curry op = id) vs) (the (TermC.int_of_str e)))
   28.52    | monom_of_term vs (c, es) (Const ("Groups.times_class.times", _) $ m1 $ m2) =
   28.53      let val (c', es') = monom_of_term vs (c, es) m1
   28.54      in monom_of_term vs (c', es') m2 end
   28.55 @@ -161,7 +161,7 @@
   28.56  
   28.57  fun is_poly t =
   28.58    let 
   28.59 -    val vs = t |> vars |> map str_of_free_opt (* tolerate Var in simplification *)
   28.60 +    val vs = t |> TermC.vars |> map TermC.str_of_free_opt (* tolerate Var in simplification *)
   28.61        |> filter is_some |> map the |> sort string_ord
   28.62    in 
   28.63      case poly_of_term vs t of SOME _ => true | NONE => false
   28.64 @@ -179,7 +179,7 @@
   28.65      [(Free (v, baseT))] @ term_of_es baseT expT vs es
   28.66    | term_of_es baseT expT (v :: vs) (e :: es) =
   28.67      [Const ("Atools.pow", [baseT, expT] ---> baseT) $ 
   28.68 -      (Free (v, baseT)) $  (Free (isastr_of_int e, expT))]
   28.69 +      (Free (v, baseT)) $  (Free (TermC.isastr_of_int e, expT))]
   28.70      @ term_of_es baseT expT vs es
   28.71  
   28.72  fun term_of_monom baseT expT vs ((c, es): monom) =
   28.73 @@ -188,9 +188,9 @@
   28.74        if c = 1 
   28.75        then 
   28.76          if es' = [] (*if es = [0,0,0,...]*)
   28.77 -        then Free (isastr_of_int c, baseT)
   28.78 +        then Free (TermC.isastr_of_int c, baseT)
   28.79          else foldl (HOLogic.mk_binop "Groups.times_class.times") (hd es', tl es')
   28.80 -      else foldl (HOLogic.mk_binop "Groups.times_class.times") (Free (isastr_of_int c, baseT), es') 
   28.81 +      else foldl (HOLogic.mk_binop "Groups.times_class.times") (Free (TermC.isastr_of_int c, baseT), es') 
   28.82      end
   28.83  
   28.84  fun term_of_poly baseT expT vs p =
   28.85 @@ -205,7 +205,7 @@
   28.86      (Const ("HOL.eq", [baseT, baseT] ---> HOLogic.boolT) $ t $ Free ("0", HOLogic.realT))
   28.87  
   28.88  fun mk_asms baseT ts =
   28.89 -  let val as' = filter_out is_num ts (* asm like "2 ~= 0" is needless *)
   28.90 +  let val as' = filter_out TermC.is_num ts (* asm like "2 ~= 0" is needless *)
   28.91    in map (mk_noteq_0 baseT) as' end
   28.92  *}
   28.93  
   28.94 @@ -225,7 +225,7 @@
   28.95        NONE => NONE
   28.96      | SOME (numerator, denominator) =>
   28.97        let 
   28.98 -        val vs = t |> vars |> map str_of_free_opt (* tolerate Var in simplification *)
   28.99 +        val vs = t |> TermC.vars |> map TermC.str_of_free_opt (* tolerate Var in simplification *)
  28.100            |> filter is_some |> map the |> sort string_ord
  28.101          val baseT = type_of numerator
  28.102          val expT = HOLogic.realT
  28.103 @@ -271,7 +271,7 @@
  28.104        NONE => NONE
  28.105      | SOME (numerator, denominator) =>
  28.106        let 
  28.107 -        val vs = t |> vars |> map str_of_free_opt (* tolerate Var in simplification *)
  28.108 +        val vs = t |> TermC.vars |> map TermC.str_of_free_opt (* tolerate Var in simplification *)
  28.109            |> filter is_some |> map the |> sort string_ord
  28.110          val baseT = type_of numerator
  28.111          val expT = HOLogic.realT
  28.112 @@ -328,7 +328,7 @@
  28.113        NONE => NONE
  28.114      | SOME ((n1, d1), (n2, d2)) =>
  28.115        let 
  28.116 -        val vs = t |> vars |> map str_of_free_opt (* tolerate Var in simplification *)
  28.117 +        val vs = t |> TermC.vars |> map TermC.str_of_free_opt (* tolerate Var in simplification *)
  28.118            |> filter is_some |> map the |> sort string_ord
  28.119        in
  28.120          case (poly_of_term vs d1, poly_of_term vs d2) of
  28.121 @@ -370,7 +370,7 @@
  28.122      NONE => NONE
  28.123    | SOME ((n1, d1), (n2, d2)) =>
  28.124      let 
  28.125 -      val vs = t |> vars |> map str_of_free_opt (* tolerate Var in simplification *)
  28.126 +      val vs = t |> TermC.vars |> map TermC.str_of_free_opt (* tolerate Var in simplification *)
  28.127          |> filter is_some |> map the |> sort string_ord
  28.128      in
  28.129        case (poly_of_term vs n1, poly_of_term vs d1, poly_of_term vs n2, poly_of_term vs d2) of
  28.130 @@ -399,8 +399,8 @@
  28.131        rules = 
  28.132          [Calc ("HOL.eq", eval_equal "#equal_"),
  28.133          Calc ("Atools.is'_const", eval_const "#is_const_"),
  28.134 -        Thm ("not_true", num_str @{thm not_true}),
  28.135 -        Thm ("not_false", num_str @{thm not_false})], 
  28.136 +        Thm ("not_true", TermC.num_str @{thm not_true}),
  28.137 +        Thm ("not_false", TermC.num_str @{thm not_false})], 
  28.138        scr = EmptyScr});
  28.139  
  28.140  (* simplifies expressions with numerals;
  28.141 @@ -414,39 +414,39 @@
  28.142        rules = 
  28.143          [Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),
  28.144  
  28.145 -        Thm ("minus_divide_left", num_str (@{thm minus_divide_left} RS @{thm sym})),
  28.146 +        Thm ("minus_divide_left", TermC.num_str (@{thm minus_divide_left} RS @{thm sym})),
  28.147            (*SYM - ?x / ?y = - (?x / ?y)  may come from subst*)
  28.148 -        Thm ("rat_add", num_str @{thm rat_add}),
  28.149 +        Thm ("rat_add", TermC.num_str @{thm rat_add}),
  28.150            (*"[| a is_const; b is_const; c is_const; d is_const |] ==> \
  28.151            \a / c + b / d = (a * d) / (c * d) + (b * c ) / (d * c)"*)
  28.152 -        Thm ("rat_add1", num_str @{thm rat_add1}),
  28.153 +        Thm ("rat_add1", TermC.num_str @{thm rat_add1}),
  28.154            (*"[| a is_const; b is_const; c is_const |] ==> a / c + b / c = (a + b) / c"*)
  28.155 -        Thm ("rat_add2", num_str @{thm rat_add2}),
  28.156 +        Thm ("rat_add2", TermC.num_str @{thm rat_add2}),
  28.157            (*"[| ?a is_const; ?b is_const; ?c is_const |] ==> ?a / ?c + ?b = (?a + ?b * ?c) / ?c"*)
  28.158 -        Thm ("rat_add3", num_str @{thm rat_add3}),
  28.159 +        Thm ("rat_add3", TermC.num_str @{thm rat_add3}),
  28.160            (*"[| a is_const; b is_const; c is_const |] ==> a + b / c = (a * c) / c + b / c"\
  28.161            .... is_const to be omitted here FIXME*)
  28.162          
  28.163 -        Thm ("rat_mult", num_str @{thm rat_mult}), 
  28.164 +        Thm ("rat_mult", TermC.num_str @{thm rat_mult}), 
  28.165            (*a / b * (c / d) = a * c / (b * d)*)
  28.166 -        Thm ("times_divide_eq_right", num_str @{thm times_divide_eq_right}),
  28.167 +        Thm ("times_divide_eq_right", TermC.num_str @{thm times_divide_eq_right}),
  28.168            (*?x * (?y / ?z) = ?x * ?y / ?z*)
  28.169 -        Thm ("times_divide_eq_left", num_str @{thm times_divide_eq_left}),
  28.170 +        Thm ("times_divide_eq_left", TermC.num_str @{thm times_divide_eq_left}),
  28.171            (*?y / ?z * ?x = ?y * ?x / ?z*)
  28.172          
  28.173 -        Thm ("real_divide_divide1", num_str @{thm real_divide_divide1}),
  28.174 +        Thm ("real_divide_divide1", TermC.num_str @{thm real_divide_divide1}),
  28.175            (*"?y ~= 0 ==> ?u / ?v / (?y / ?z) = ?u / ?v * (?z / ?y)"*)
  28.176 -        Thm ("divide_divide_eq_left", num_str @{thm divide_divide_eq_left}),
  28.177 +        Thm ("divide_divide_eq_left", TermC.num_str @{thm divide_divide_eq_left}),
  28.178            (*"?x / ?y / ?z = ?x / (?y * ?z)"*)
  28.179          
  28.180 -        Thm ("rat_power", num_str @{thm rat_power}),
  28.181 +        Thm ("rat_power", TermC.num_str @{thm rat_power}),
  28.182            (*"(?a / ?b) ^^^ ?n = ?a ^^^ ?n / ?b ^^^ ?n"*)
  28.183          
  28.184 -        Thm ("mult_cross", num_str @{thm mult_cross}),
  28.185 +        Thm ("mult_cross", TermC.num_str @{thm mult_cross}),
  28.186            (*"[| b ~= 0; d ~= 0 |] ==> (a / b = c / d) = (a * d = b * c)*)
  28.187 -        Thm ("mult_cross1", num_str @{thm mult_cross1}),
  28.188 +        Thm ("mult_cross1", TermC.num_str @{thm mult_cross1}),
  28.189            (*"   b ~= 0            ==> (a / b = c    ) = (a     = b * c)*)
  28.190 -        Thm ("mult_cross2", num_str @{thm mult_cross2})
  28.191 +        Thm ("mult_cross2", TermC.num_str @{thm mult_cross2})
  28.192            (*"           d ~= 0    ==> (a     = c / d) = (a * d =     c)*)], 
  28.193        scr = EmptyScr})
  28.194      calculate_Poly);
  28.195 @@ -455,10 +455,10 @@
  28.196  fun eval_is_expanded (thmid:string) _ 
  28.197  		       (t as (Const("Rational.is'_expanded", _) $ arg)) thy = 
  28.198      if is_expanded arg
  28.199 -    then SOME (mk_thmid thmid "" (term_to_string''' thy arg) "", 
  28.200 -	         Trueprop $ (mk_equality (t, @{term True})))
  28.201 -    else SOME (mk_thmid thmid "" (term_to_string''' thy arg) "", 
  28.202 -	         Trueprop $ (mk_equality (t, @{term False})))
  28.203 +    then SOME (TermC.mk_thmid thmid "" (term_to_string''' thy arg) "", 
  28.204 +	         TermC.Trueprop $ (TermC.mk_equality (t, @{term True})))
  28.205 +    else SOME (TermC.mk_thmid thmid "" (term_to_string''' thy arg) "", 
  28.206 +	         TermC.Trueprop $ (TermC.mk_equality (t, @{term False})))
  28.207    | eval_is_expanded _ _ _ _ = NONE;
  28.208  *}
  28.209  setup {* KEStore_Elems.add_calcs
  28.210 @@ -482,7 +482,7 @@
  28.211      val SOME (t'', asm) = cancel_p_ thy t;
  28.212      val der = Rtools.reverse_deriv thy eval_rls rules ro NONE t';
  28.213      val der = der @ 
  28.214 -      [(Thm ("real_mult_div_cancel2", num_str @{thm real_mult_div_cancel2}), (t'', asm))]
  28.215 +      [(Thm ("real_mult_div_cancel2", TermC.num_str @{thm real_mult_div_cancel2}), (t'', asm))]
  28.216      val rs = (Rtools.distinct_Thm o (map #1)) der
  28.217    	val rs = filter_out (Rtools.eq_Thms 
  28.218    	  ["sym_real_add_zero_left", "sym_real_mult_0", "sym_real_mult_1"]) rs
  28.219 @@ -543,7 +543,7 @@
  28.220      val SOME (t'', asm) = add_fraction_p_ thy t;
  28.221      val der = Rtools.reverse_deriv thy eval_rls rules ro NONE t';
  28.222      val der = der @ 
  28.223 -      [(Thm ("real_mult_div_cancel2", num_str @{thm real_mult_div_cancel2}), (t'',asm))]
  28.224 +      [(Thm ("real_mult_div_cancel2", TermC.num_str @{thm real_mult_div_cancel2}), (t'',asm))]
  28.225      val rs = (Rtools.distinct_Thm o (map #1)) der;
  28.226      val rs = filter_out (Rtools.eq_Thms 
  28.227        ["sym_real_add_zero_left", "sym_real_mult_0", "sym_real_mult_1"]) rs;
  28.228 @@ -571,9 +571,9 @@
  28.229      end
  28.230    | next_rule _ _ _ _ _ = error ("next_rule: doesnt match rev-sets in istate");
  28.231  
  28.232 -val pat0 = parse_patt thy "?r/?s+?u/?v :: real";
  28.233 -val pat1 = parse_patt thy "?r/?s+?u    :: real";
  28.234 -val pat2 = parse_patt thy "?r   +?u/?v :: real";
  28.235 +val pat0 = TermC.parse_patt thy "?r/?s+?u/?v :: real";
  28.236 +val pat1 = TermC.parse_patt thy "?r/?s+?u    :: real";
  28.237 +val pat2 = TermC.parse_patt thy "?r   +?u/?v :: real";
  28.238  val prepat = [([@{term True}], pat0),
  28.239  	      ([@{term True}], pat1),
  28.240  	      ([@{term True}], pat2)];
  28.241 @@ -615,8 +615,8 @@
  28.242        rules = [Calc ("Atools.is'_atom",eval_is_atom "#is_atom_"),
  28.243  	       Calc ("Atools.is'_even",eval_is_even "#is_even_"),
  28.244  	       Calc ("Orderings.ord_class.less",eval_equ "#less_"),
  28.245 -	       Thm ("not_false", num_str @{thm not_false}),
  28.246 -	       Thm ("not_true", num_str @{thm not_true}),
  28.247 +	       Thm ("not_false", TermC.num_str @{thm not_false}),
  28.248 +	       Thm ("not_true", TermC.num_str @{thm not_true}),
  28.249  	       Calc ("Groups.plus_class.plus",eval_binop "#add_")
  28.250  	       ],
  28.251        scr = EmptyScr
  28.252 @@ -626,29 +626,29 @@
  28.253  val powers = prep_rls'(
  28.254    Rls {id = "powers", preconds = [], rew_ord = ("dummy_ord",dummy_ord), 
  28.255        erls = powers_erls, srls = Erls, calc = [], errpatts = [],
  28.256 -      rules = [Thm ("realpow_multI", num_str @{thm realpow_multI}),
  28.257 +      rules = [Thm ("realpow_multI", TermC.num_str @{thm realpow_multI}),
  28.258  	       (*"(r * s) ^^^ n = r ^^^ n * s ^^^ n"*)
  28.259 -	       Thm ("realpow_pow",num_str @{thm realpow_pow}),
  28.260 +	       Thm ("realpow_pow",TermC.num_str @{thm realpow_pow}),
  28.261  	       (*"(a ^^^ b) ^^^ c = a ^^^ (b * c)"*)
  28.262 -	       Thm ("realpow_oneI",num_str @{thm realpow_oneI}),
  28.263 +	       Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}),
  28.264  	       (*"r ^^^ 1 = r"*)
  28.265 -	       Thm ("realpow_minus_even",num_str @{thm realpow_minus_even}),
  28.266 +	       Thm ("realpow_minus_even",TermC.num_str @{thm realpow_minus_even}),
  28.267  	       (*"n is_even ==> (- r) ^^^ n = r ^^^ n" ?-->discard_minus?*)
  28.268 -	       Thm ("realpow_minus_odd",num_str @{thm realpow_minus_odd}),
  28.269 +	       Thm ("realpow_minus_odd",TermC.num_str @{thm realpow_minus_odd}),
  28.270  	       (*"Not (n is_even) ==> (- r) ^^^ n = -1 * r ^^^ n"*)
  28.271  	       
  28.272  	       (*----- collect atoms over * -----*)
  28.273 -	       Thm ("realpow_two_atom",num_str @{thm realpow_two_atom}),	
  28.274 +	       Thm ("realpow_two_atom",TermC.num_str @{thm realpow_two_atom}),	
  28.275  	       (*"r is_atom ==> r * r = r ^^^ 2"*)
  28.276 -	       Thm ("realpow_plus_1",num_str @{thm realpow_plus_1}),		
  28.277 +	       Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),		
  28.278  	       (*"r is_atom ==> r * r ^^^ n = r ^^^ (n + 1)"*)
  28.279 -	       Thm ("realpow_addI_atom",num_str @{thm realpow_addI_atom}),
  28.280 +	       Thm ("realpow_addI_atom",TermC.num_str @{thm realpow_addI_atom}),
  28.281  	       (*"r is_atom ==> r ^^^ n * r ^^^ m = r ^^^ (n + m)"*)
  28.282  
  28.283  	       (*----- distribute none-atoms -----*)
  28.284 -	       Thm ("realpow_def_atom",num_str @{thm realpow_def_atom}),
  28.285 +	       Thm ("realpow_def_atom",TermC.num_str @{thm realpow_def_atom}),
  28.286  	       (*"[| 1 < n; not(r is_atom) |]==>r ^^^ n = r * r ^^^ (n + -1)"*)
  28.287 -	       Thm ("realpow_eq_oneI",num_str @{thm realpow_eq_oneI}),
  28.288 +	       Thm ("realpow_eq_oneI",TermC.num_str @{thm realpow_eq_oneI}),
  28.289  	       (*"1 ^^^ n = 1"*)
  28.290  	       Calc ("Groups.plus_class.plus",eval_binop "#add_")
  28.291  	       ],
  28.292 @@ -659,20 +659,20 @@
  28.293    Rls {id = "rat_mult_divide", preconds = [], 
  28.294        rew_ord = ("dummy_ord", dummy_ord), 
  28.295        erls = e_rls, srls = Erls, calc = [], errpatts = [],
  28.296 -      rules = [Thm ("rat_mult",num_str @{thm rat_mult}),
  28.297 +      rules = [Thm ("rat_mult",TermC.num_str @{thm rat_mult}),
  28.298  	       (*(1)"?a / ?b * (?c / ?d) = ?a * ?c / (?b * ?d)"*)
  28.299 -	       Thm ("times_divide_eq_right",num_str @{thm times_divide_eq_right}),
  28.300 +	       Thm ("times_divide_eq_right",TermC.num_str @{thm times_divide_eq_right}),
  28.301  	       (*(2)"?a * (?c / ?d) = ?a * ?c / ?d" must be [2],
  28.302  	       otherwise inv.to a / b / c = ...*)
  28.303 -	       Thm ("times_divide_eq_left",num_str @{thm times_divide_eq_left}),
  28.304 +	       Thm ("times_divide_eq_left",TermC.num_str @{thm times_divide_eq_left}),
  28.305  	       (*"?a / ?b * ?c = ?a * ?c / ?b" order weights x^^^n too much
  28.306  		     and does not commute a / b * c ^^^ 2 !*)
  28.307  	       
  28.308  	       Thm ("divide_divide_eq_right", 
  28.309 -                     num_str @{thm divide_divide_eq_right}),
  28.310 +                     TermC.num_str @{thm divide_divide_eq_right}),
  28.311  	       (*"?x / (?y / ?z) = ?x * ?z / ?y"*)
  28.312  	       Thm ("divide_divide_eq_left",
  28.313 -                     num_str @{thm divide_divide_eq_left}),
  28.314 +                     TermC.num_str @{thm divide_divide_eq_left}),
  28.315  	       (*"?x / ?y / ?z = ?x / (?y * ?z)"*)
  28.316  	       Calc ("Rings.divide_class.divide"  ,eval_cancel "#divide_e")
  28.317  	       ],
  28.318 @@ -683,29 +683,29 @@
  28.319  val reduce_0_1_2 = prep_rls'(
  28.320    Rls{id = "reduce_0_1_2", preconds = [], rew_ord = ("dummy_ord", dummy_ord),
  28.321        erls = e_rls, srls = Erls, calc = [], errpatts = [],
  28.322 -      rules = [(*Thm ("divide_1",num_str @{thm divide_1}),
  28.323 +      rules = [(*Thm ("divide_1",TermC.num_str @{thm divide_1}),
  28.324  		 "?x / 1 = ?x" unnecess.for normalform*)
  28.325 -	       Thm ("mult_1_left",num_str @{thm mult_1_left}),                 
  28.326 +	       Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),                 
  28.327  	       (*"1 * z = z"*)
  28.328 -	       (*Thm ("real_mult_minus1",num_str @{thm real_mult_minus1}),
  28.329 +	       (*Thm ("real_mult_minus1",TermC.num_str @{thm real_mult_minus1}),
  28.330  	       "-1 * z = - z"*)
  28.331 -	       (*Thm ("real_minus_mult_cancel",num_str @{thm real_minus_mult_cancel}),
  28.332 +	       (*Thm ("real_minus_mult_cancel",TermC.num_str @{thm real_minus_mult_cancel}),
  28.333  	       "- ?x * - ?y = ?x * ?y"*)
  28.334  
  28.335 -	       Thm ("mult_zero_left",num_str @{thm mult_zero_left}),        
  28.336 +	       Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),        
  28.337  	       (*"0 * z = 0"*)
  28.338 -	       Thm ("add_0_left",num_str @{thm add_0_left}),
  28.339 +	       Thm ("add_0_left",TermC.num_str @{thm add_0_left}),
  28.340  	       (*"0 + z = z"*)
  28.341 -	       (*Thm ("right_minus",num_str @{thm right_minus}),
  28.342 +	       (*Thm ("right_minus",TermC.num_str @{thm right_minus}),
  28.343  	       "?z + - ?z = 0"*)
  28.344  
  28.345  	       Thm ("sym_real_mult_2",
  28.346 -                     num_str (@{thm real_mult_2} RS @{thm sym})),	
  28.347 +                     TermC.num_str (@{thm real_mult_2} RS @{thm sym})),	
  28.348  	       (*"z1 + z1 = 2 * z1"*)
  28.349 -	       Thm ("real_mult_2_assoc",num_str @{thm real_mult_2_assoc}),
  28.350 +	       Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),
  28.351  	       (*"z1 + (z1 + k) = 2 * z1 + k"*)
  28.352  
  28.353 -	       Thm ("division_ring_divide_zero",num_str @{thm division_ring_divide_zero})
  28.354 +	       Thm ("division_ring_divide_zero",TermC.num_str @{thm division_ring_divide_zero})
  28.355  	       (*"0 / ?x = 0"*)
  28.356  	       ], scr = EmptyScr}:rls);
  28.357  
  28.358 @@ -750,20 +750,20 @@
  28.359  val simplify_rational = 
  28.360      merge_rls "simplify_rational" expand_binoms
  28.361      (append_rls "divide" calculate_Rational
  28.362 -		[Thm ("div_by_1",num_str @{thm div_by_1}),
  28.363 +		[Thm ("div_by_1",TermC.num_str @{thm div_by_1}),
  28.364  		 (*"?x / 1 = ?x"*)
  28.365 -		 Thm ("rat_mult",num_str @{thm rat_mult}),
  28.366 +		 Thm ("rat_mult",TermC.num_str @{thm rat_mult}),
  28.367  		 (*(1)"?a / ?b * (?c / ?d) = ?a * ?c / (?b * ?d)"*)
  28.368 -		 Thm ("times_divide_eq_right",num_str @{thm times_divide_eq_right}),
  28.369 +		 Thm ("times_divide_eq_right",TermC.num_str @{thm times_divide_eq_right}),
  28.370  		 (*(2)"?a * (?c / ?d) = ?a * ?c / ?d" must be [2],
  28.371  		 otherwise inv.to a / b / c = ...*)
  28.372 -		 Thm ("times_divide_eq_left",num_str @{thm times_divide_eq_left}),
  28.373 +		 Thm ("times_divide_eq_left",TermC.num_str @{thm times_divide_eq_left}),
  28.374  		 (*"?a / ?b * ?c = ?a * ?c / ?b"*)
  28.375 -		 Thm ("add_minus",num_str @{thm add_minus}),
  28.376 +		 Thm ("add_minus",TermC.num_str @{thm add_minus}),
  28.377  		 (*"?a + ?b - ?b = ?a"*)
  28.378 -		 Thm ("add_minus1",num_str @{thm add_minus1}),
  28.379 +		 Thm ("add_minus1",TermC.num_str @{thm add_minus1}),
  28.380  		 (*"?a - ?b + ?b = ?a"*)
  28.381 -		 Thm ("divide_minus1",num_str @{thm divide_minus1})
  28.382 +		 Thm ("divide_minus1",TermC.num_str @{thm divide_minus1})
  28.383  		 (*"?x / -1 = - ?x"*)
  28.384  		 ]);
  28.385  *}
  28.386 @@ -789,9 +789,9 @@
  28.387  	  erls = append_rls "e_rls-is_polyexp" e_rls [Calc ("Poly.is'_polyexp", eval_is_polyexp "")], 
  28.388  	  srls = Erls, calc = [], errpatts = [],
  28.389  	  rules = 
  28.390 -	    [Thm ("rat_mult_poly_l",num_str @{thm rat_mult_poly_l}),
  28.391 +	    [Thm ("rat_mult_poly_l",TermC.num_str @{thm rat_mult_poly_l}),
  28.392  	    (*"?c is_polyexp ==> ?c * (?a / ?b) = ?c * ?a / ?b"*)
  28.393 -	    Thm ("rat_mult_poly_r",num_str @{thm rat_mult_poly_r})
  28.394 +	    Thm ("rat_mult_poly_r",TermC.num_str @{thm rat_mult_poly_r})
  28.395  	    (*"?c is_polyexp ==> ?a / ?b * ?c = ?a * ?c / ?b"*) ], 
  28.396  	  scr = EmptyScr});
  28.397  
  28.398 @@ -803,22 +803,22 @@
  28.399  val rat_mult_div_pow = prep_rls'(
  28.400    Rls {id = "rat_mult_div_pow", preconds = [], rew_ord = ("dummy_ord",dummy_ord), 
  28.401      erls = e_rls, srls = Erls, calc = [], errpatts = [],
  28.402 -    rules = [Thm ("rat_mult", num_str @{thm rat_mult}),
  28.403 +    rules = [Thm ("rat_mult", TermC.num_str @{thm rat_mult}),
  28.404        (*"?a / ?b * (?c / ?d) = ?a * ?c / (?b * ?d)"*)
  28.405 -      Thm ("rat_mult_poly_l", num_str @{thm rat_mult_poly_l}),
  28.406 +      Thm ("rat_mult_poly_l", TermC.num_str @{thm rat_mult_poly_l}),
  28.407        (*"?c is_polyexp ==> ?c * (?a / ?b) = ?c * ?a / ?b"*)
  28.408 -      Thm ("rat_mult_poly_r", num_str @{thm rat_mult_poly_r}),
  28.409 +      Thm ("rat_mult_poly_r", TermC.num_str @{thm rat_mult_poly_r}),
  28.410        (*"?c is_polyexp ==> ?a / ?b * ?c = ?a * ?c / ?b"*)
  28.411        
  28.412 -      Thm ("real_divide_divide1_mg", num_str @{thm real_divide_divide1_mg}),
  28.413 +      Thm ("real_divide_divide1_mg", TermC.num_str @{thm real_divide_divide1_mg}),
  28.414        (*"y ~= 0 ==> (u / v) / (y / z) = (u * z) / (y * v)"*)
  28.415 -      Thm ("divide_divide_eq_right", num_str @{thm divide_divide_eq_right}),
  28.416 +      Thm ("divide_divide_eq_right", TermC.num_str @{thm divide_divide_eq_right}),
  28.417        (*"?x / (?y / ?z) = ?x * ?z / ?y"*)
  28.418 -      Thm ("divide_divide_eq_left", num_str @{thm divide_divide_eq_left}),
  28.419 +      Thm ("divide_divide_eq_left", TermC.num_str @{thm divide_divide_eq_left}),
  28.420        (*"?x / ?y / ?z = ?x / (?y * ?z)"*)
  28.421        Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),
  28.422        
  28.423 -      Thm ("rat_power", num_str @{thm rat_power})
  28.424 +      Thm ("rat_power", TermC.num_str @{thm rat_power})
  28.425        (*"(?a / ?b) ^^^ ?n = ?a ^^^ ?n / ?b ^^^ ?n"*)
  28.426        ],
  28.427      scr = EmptyScr}:rls);
  28.428 @@ -827,9 +827,9 @@
  28.429    Rls {id = "rat_reduce_1", preconds = [], rew_ord = ("dummy_ord", dummy_ord), 
  28.430      erls = e_rls, srls = Erls, calc = [], errpatts = [], 
  28.431      rules = 
  28.432 -      [Thm ("div_by_1", num_str @{thm div_by_1}),
  28.433 +      [Thm ("div_by_1", TermC.num_str @{thm div_by_1}),
  28.434        (*"?x / 1 = ?x"*)
  28.435 -      Thm ("mult_1_left", num_str @{thm mult_1_left})           
  28.436 +      Thm ("mult_1_left", TermC.num_str @{thm mult_1_left})           
  28.437        (*"1 * z = z"*)
  28.438        ],
  28.439      scr = EmptyScr}:rls);
    29.1 --- a/src/Tools/isac/Knowledge/Root.thy	Sun Feb 25 16:31:17 2018 +0100
    29.2 +++ b/src/Tools/isac/Knowledge/Root.thy	Fri Mar 02 14:19:59 2018 +0100
    29.3 @@ -50,25 +50,25 @@
    29.4  	       (Const(op0,t0) $ arg)) thy = 
    29.5      (case arg of 
    29.6  	Free (n1,t1) =>
    29.7 -	(case int_of_str n1 of
    29.8 +	(case TermC.int_of_str n1 of
    29.9  	     SOME ni => 
   29.10  	     if ni < 0 then NONE
   29.11  	     else
   29.12 -		 let val fact = squfact ni;
   29.13 +		 let val fact = TermC.squfact ni;
   29.14  		 in if fact*fact = ni 
   29.15  		    then SOME ("#sqrt #"^(string_of_int ni)^" = #"
   29.16  			       ^(string_of_int (if ni = 0 then 0
   29.17  						else ni div fact)),
   29.18 -			       Trueprop $ mk_equality (t, term_of_num t1 fact))
   29.19 +			       TermC.Trueprop $ TermC.mk_equality (t, TermC.term_of_num t1 fact))
   29.20  		    else if fact = 1 then NONE
   29.21  		    else SOME ("#sqrt #"^(string_of_int ni)^" = sqrt (#"
   29.22  			       ^(string_of_int fact)^" * #"
   29.23  			       ^(string_of_int fact)^" * #"
   29.24  			       ^(string_of_int (ni div (fact*fact))^")"),
   29.25 -			       Trueprop $ 
   29.26 -					(mk_equality 
   29.27 +			       TermC.Trueprop $ 
   29.28 +					(TermC.mk_equality 
   29.29  					     (t, 
   29.30 -					      (mk_factroot op0 t1 fact 
   29.31 +					      (TermC.mk_factroot op0 t1 fact 
   29.32  						(ni div (fact*fact))))))
   29.33  	         end
   29.34  	   | NONE => NONE)
   29.35 @@ -163,7 +163,7 @@
   29.36  (*-------------------------rulse-------------------------*)
   29.37  val Root_crls = 
   29.38        append_rls "Root_crls" Atools_erls 
   29.39 -       [Thm  ("real_unari_minus",num_str @{thm real_unari_minus}),
   29.40 +       [Thm  ("real_unari_minus",TermC.num_str @{thm real_unari_minus}),
   29.41          Calc ("NthRoot.sqrt" ,eval_sqrt "#sqrt_"),
   29.42          Calc ("Rings.divide_class.divide",eval_cancel "#divide_e"),
   29.43          Calc ("Atools.pow" ,eval_binop "#power_"),
   29.44 @@ -175,7 +175,7 @@
   29.45  
   29.46  val Root_erls = 
   29.47        append_rls "Root_erls" Atools_erls 
   29.48 -       [Thm  ("real_unari_minus",num_str @{thm real_unari_minus}),
   29.49 +       [Thm  ("real_unari_minus",TermC.num_str @{thm real_unari_minus}),
   29.50          Calc ("NthRoot.sqrt" ,eval_sqrt "#sqrt_"),
   29.51          Calc ("Rings.divide_class.divide",eval_cancel "#divide_e"),
   29.52          Calc ("Atools.pow" ,eval_binop "#power_"),
   29.53 @@ -193,64 +193,64 @@
   29.54        rew_ord = ("sqrt_right", sqrt_right false thy),
   29.55        erls = Atools_erls, srls = Erls,
   29.56        calc = [], errpatts = [],
   29.57 -      rules = [Thm ("real_diff_minus",num_str @{thm real_diff_minus}),			
   29.58 +      rules = [Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}),			
   29.59  	       (*"a - b = a + (-1) * b"*)
   29.60  
   29.61 -	       Thm ("distrib_right" ,num_str @{thm distrib_right}),	
   29.62 +	       Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),	
   29.63  	       (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
   29.64 -	       Thm ("distrib_left",num_str @{thm distrib_left}),	
   29.65 +	       Thm ("distrib_left",TermC.num_str @{thm distrib_left}),	
   29.66  	       (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
   29.67 -	       Thm ("left_diff_distrib" ,num_str @{thm left_diff_distrib}),	
   29.68 +	       Thm ("left_diff_distrib" ,TermC.num_str @{thm left_diff_distrib}),	
   29.69  	       (*"(z1.0 - z2.0) * w = z1.0 * w - z2.0 * w"*)
   29.70 -	       Thm ("right_diff_distrib",num_str @{thm right_diff_distrib}),	
   29.71 +	       Thm ("right_diff_distrib",TermC.num_str @{thm right_diff_distrib}),	
   29.72  	       (*"w * (z1.0 - z2.0) = w * z1.0 - w * z2.0"*)
   29.73  
   29.74 -	       Thm ("mult_1_left",num_str @{thm mult_1_left}),                         
   29.75 +	       Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),                         
   29.76  	       (*"1 * z = z"*)
   29.77 -	       Thm ("mult_zero_left",num_str @{thm mult_zero_left}),                         
   29.78 +	       Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),                         
   29.79  	       (*"0 * z = 0"*)
   29.80 -	       Thm ("add_0_left",num_str @{thm add_0_left}),		
   29.81 +	       Thm ("add_0_left",TermC.num_str @{thm add_0_left}),		
   29.82  	       (*"0 + z = z"*)
   29.83   
   29.84 -	       Thm ("mult_commute",num_str @{thm mult.commute}),
   29.85 +	       Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
   29.86  		(*AC-rewriting*)
   29.87 -	       Thm ("real_mult_left_commute",num_str @{thm real_mult_left_commute}),
   29.88 +	       Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
   29.89           	(**)
   29.90 -	       Thm ("mult_assoc",num_str @{thm mult.assoc}),
   29.91 +	       Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),
   29.92  	        (**)
   29.93 -	       Thm ("add_commute",num_str @{thm add.commute}),
   29.94 +	       Thm ("add_commute",TermC.num_str @{thm add.commute}),
   29.95  		(**)
   29.96 -	       Thm ("add_left_commute",num_str @{thm add.left_commute}),
   29.97 +	       Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}),
   29.98  	        (**)
   29.99 -	       Thm ("add_assoc",num_str @{thm add.assoc}),
  29.100 +	       Thm ("add_assoc",TermC.num_str @{thm add.assoc}),
  29.101  	        (**)
  29.102  
  29.103  	       Thm ("sym_realpow_twoI",
  29.104 -                     num_str (@{thm realpow_twoI} RS @{thm sym})),
  29.105 +                     TermC.num_str (@{thm realpow_twoI} RS @{thm sym})),
  29.106  	       (*"r1 * r1 = r1 ^^^ 2"*)
  29.107 -	       Thm ("realpow_plus_1",num_str @{thm realpow_plus_1}),			
  29.108 +	       Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),			
  29.109  	       (*"r * r ^^^ n = r ^^^ (n + 1)"*)
  29.110  	       Thm ("sym_real_mult_2",
  29.111 -                     num_str (@{thm real_mult_2} RS @{thm sym})),
  29.112 +                     TermC.num_str (@{thm real_mult_2} RS @{thm sym})),
  29.113  	       (*"z1 + z1 = 2 * z1"*)
  29.114 -	       Thm ("real_mult_2_assoc",num_str @{thm real_mult_2_assoc}),		
  29.115 +	       Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),		
  29.116  	       (*"z1 + (z1 + k) = 2 * z1 + k"*)
  29.117  
  29.118 -	       Thm ("real_num_collect",num_str @{thm real_num_collect}), 
  29.119 +	       Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  29.120  	       (*"[| l is_const; m is_const |]==> l * n + m * n = (l + m) * n"*)
  29.121 -	       Thm ("real_num_collect_assoc",num_str @{thm real_num_collect_assoc}),	
  29.122 +	       Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),	
  29.123  	       (*"[| l is_const; m is_const |] ==>  
  29.124                                     l * n + (m * n + k) =  (l + m) * n + k"*)
  29.125 -	       Thm ("real_one_collect",num_str @{thm real_one_collect}),		
  29.126 +	       Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),		
  29.127  	       (*"m is_const ==> n + m * n = (1 + m) * n"*)
  29.128 -	       Thm ("real_one_collect_assoc",num_str @{thm real_one_collect_assoc}), 
  29.129 +	       Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), 
  29.130  	       (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  29.131  
  29.132  	       Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  29.133  	       Calc ("Groups.times_class.times", eval_binop "#mult_"),
  29.134  	       Calc ("Atools.pow", eval_binop "#power_")
  29.135  	       ],
  29.136 -      scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
  29.137 +      scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  29.138        }:rls);      
  29.139  *}
  29.140  setup {* KEStore_Elems.add_rlss [("make_rooteq", (Context.theory_name @{theory}, make_rooteq))] *}
  29.141 @@ -263,33 +263,33 @@
  29.142        rew_ord = ("termlessI",termlessI),
  29.143        erls = Atools_erls, srls = Erls,
  29.144        calc = [], errpatts = [],
  29.145 -      rules = [Thm ("real_plus_binom_pow2"  ,num_str @{thm real_plus_binom_pow2}),     
  29.146 +      rules = [Thm ("real_plus_binom_pow2"  ,TermC.num_str @{thm real_plus_binom_pow2}),     
  29.147  	       (*"(a + b) ^^^ 2 = a ^^^ 2 + 2 * a * b + b ^^^ 2"*)
  29.148 -	       Thm ("real_plus_binom_times" ,num_str @{thm real_plus_binom_times}),    
  29.149 +	       Thm ("real_plus_binom_times" ,TermC.num_str @{thm real_plus_binom_times}),    
  29.150  	       (*"(a + b)*(a + b) = ...*)
  29.151 -	       Thm ("real_minus_binom_pow2" ,num_str @{thm real_minus_binom_pow2}),    
  29.152 +	       Thm ("real_minus_binom_pow2" ,TermC.num_str @{thm real_minus_binom_pow2}),    
  29.153  		(*"(a - b) ^^^ 2 = a ^^^ 2 - 2 * a * b + b ^^^ 2"*)
  29.154 -	       Thm ("real_minus_binom_times",num_str @{thm real_minus_binom_times}),   
  29.155 +	       Thm ("real_minus_binom_times",TermC.num_str @{thm real_minus_binom_times}),   
  29.156  	       (*"(a - b)*(a - b) = ...*)
  29.157 -	       Thm ("real_plus_minus_binom1",num_str @{thm real_plus_minus_binom1}),   
  29.158 +	       Thm ("real_plus_minus_binom1",TermC.num_str @{thm real_plus_minus_binom1}),   
  29.159  		(*"(a + b) * (a - b) = a ^^^ 2 - b ^^^ 2"*)
  29.160 -	       Thm ("real_plus_minus_binom2",num_str @{thm real_plus_minus_binom2}),   
  29.161 +	       Thm ("real_plus_minus_binom2",TermC.num_str @{thm real_plus_minus_binom2}),   
  29.162  		(*"(a - b) * (a + b) = a ^^^ 2 - b ^^^ 2"*)
  29.163  	       (*RL 020915*)
  29.164 -	       Thm ("real_pp_binom_times",num_str @{thm real_pp_binom_times}), 
  29.165 +	       Thm ("real_pp_binom_times",TermC.num_str @{thm real_pp_binom_times}), 
  29.166  		(*(a + b)*(c + d) = a*c + a*d + b*c + b*d*)
  29.167 -               Thm ("real_pm_binom_times",num_str @{thm real_pm_binom_times}), 
  29.168 +               Thm ("real_pm_binom_times",TermC.num_str @{thm real_pm_binom_times}), 
  29.169  		(*(a + b)*(c - d) = a*c - a*d + b*c - b*d*)
  29.170 -               Thm ("real_mp_binom_times",num_str @{thm real_mp_binom_times}), 
  29.171 +               Thm ("real_mp_binom_times",TermC.num_str @{thm real_mp_binom_times}), 
  29.172  		(*(a - b)*(c p d) = a*c + a*d - b*c - b*d*)
  29.173 -               Thm ("real_mm_binom_times",num_str @{thm real_mm_binom_times}), 
  29.174 +               Thm ("real_mm_binom_times",TermC.num_str @{thm real_mm_binom_times}), 
  29.175  		(*(a - b)*(c p d) = a*c - a*d - b*c + b*d*)
  29.176 -	       Thm ("realpow_mul",num_str @{thm realpow_mul}),                 
  29.177 +	       Thm ("realpow_mul",TermC.num_str @{thm realpow_mul}),                 
  29.178  		(*(a*b)^^^n = a^^^n * b^^^n*)
  29.179  
  29.180 -	       Thm ("mult_1_left",num_str @{thm mult_1_left}),         (*"1 * z = z"*)
  29.181 -	       Thm ("mult_zero_left",num_str @{thm mult_zero_left}),         (*"0 * z = 0"*)
  29.182 -	       Thm ("add_0_left",num_str @{thm add_0_left}), 
  29.183 +	       Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),         (*"1 * z = z"*)
  29.184 +	       Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),         (*"0 * z = 0"*)
  29.185 +	       Thm ("add_0_left",TermC.num_str @{thm add_0_left}), 
  29.186                   (*"0 + z = z"*)
  29.187  
  29.188  	       Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  29.189 @@ -300,21 +300,21 @@
  29.190  	       Calc ("Atools.pow", eval_binop "#power_"),
  29.191  
  29.192  	       Thm ("sym_realpow_twoI",
  29.193 -                     num_str (@{thm realpow_twoI} RS @{thm sym})),
  29.194 +                     TermC.num_str (@{thm realpow_twoI} RS @{thm sym})),
  29.195  	       (*"r1 * r1 = r1 ^^^ 2"*)
  29.196 -	       Thm ("realpow_plus_1",num_str @{thm realpow_plus_1}),			
  29.197 +	       Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),			
  29.198  	       (*"r * r ^^^ n = r ^^^ (n + 1)"*)
  29.199 -	       Thm ("real_mult_2_assoc",num_str @{thm real_mult_2_assoc}),		
  29.200 +	       Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),		
  29.201  	       (*"z1 + (z1 + k) = 2 * z1 + k"*)
  29.202  
  29.203 -	       Thm ("real_num_collect",num_str @{thm real_num_collect}), 
  29.204 +	       Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  29.205  	       (*"[| l is_const; m is_const |] ==>l * n + m * n = (l + m) * n"*)
  29.206 -	       Thm ("real_num_collect_assoc",num_str @{thm real_num_collect_assoc}),	
  29.207 +	       Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),	
  29.208  	       (*"[| l is_const; m is_const |] ==>
  29.209                    l * n + (m * n + k) =  (l + m) * n + k"*)
  29.210 -	       Thm ("real_one_collect",num_str @{thm real_one_collect}),		
  29.211 +	       Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),		
  29.212  	       (*"m is_const ==> n + m * n = (1 + m) * n"*)
  29.213 -	       Thm ("real_one_collect_assoc",num_str @{thm real_one_collect_assoc}), 
  29.214 +	       Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), 
  29.215  	       (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  29.216  
  29.217  	       Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  29.218 @@ -324,7 +324,7 @@
  29.219  	       Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"),
  29.220  	       Calc ("Atools.pow", eval_binop "#power_")
  29.221  	       ],
  29.222 -      scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
  29.223 +      scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  29.224         }:rls);      
  29.225  *}
  29.226  setup {* KEStore_Elems.add_rlss
    30.1 --- a/src/Tools/isac/Knowledge/RootEq.thy	Sun Feb 25 16:31:17 2018 +0100
    30.2 +++ b/src/Tools/isac/Knowledge/RootEq.thy	Fri Mar 02 14:19:59 2018 +0100
    30.3 @@ -130,7 +130,7 @@
    30.4  (* true if bdv is under sqrt of a Equation*)
    30.5  fun is_rootTerm_in t v = 
    30.6      let 
    30.7 -	fun coeff_in c v = member op = (vars c) v;
    30.8 +	fun coeff_in c v = member op = (TermC.vars c) v;
    30.9     	fun findroot (_ $ _ $ _ $ _) v = error("is_rootTerm_in:")
   30.10  	  (* at the moment there is no term like this, but ....*)
   30.11  	  | findroot (t as (Const ("Root.nroot",_) $ _ $ t3)) v = coeff_in t3 v
   30.12 @@ -144,7 +144,7 @@
   30.13  
   30.14   fun is_sqrtTerm_in t v = 
   30.15      let 
   30.16 -	fun coeff_in c v = member op = (vars c) v;
   30.17 +	fun coeff_in c v = member op = (TermC.vars c) v;
   30.18     	fun findsqrt (_ $ _ $ _ $ _) v = error("is_sqrteqation_in:")
   30.19  	  (* at the moment there is no term like this, but ....*)
   30.20  	  | findsqrt (_ $ t1 $ t2) v = (findsqrt t1 v) orelse (findsqrt t2 v)
   30.21 @@ -159,7 +159,7 @@
   30.22  and the subterm ist connected with + or * --> is normalised*)
   30.23   fun is_normSqrtTerm_in t v =
   30.24       let
   30.25 -	fun coeff_in c v = member op = (vars c) v;
   30.26 +	fun coeff_in c v = member op = (TermC.vars c) v;
   30.27          fun isnorm (_ $ _ $ _ $ _) v = error("is_normSqrtTerm_in:")
   30.28  	  (* at the moment there is no term like this, but ....*)
   30.29            | isnorm (Const ("Groups.plus_class.plus",_) $ _ $ t2) v = is_sqrtTerm_in t2 v
   30.30 @@ -178,27 +178,27 @@
   30.31         (p as (Const ("RootEq.is'_rootTerm'_in",_) $ t $ v)) _  =
   30.32      if is_rootTerm_in t v then 
   30.33  	SOME ((term2str p) ^ " = True",
   30.34 -	      Trueprop $ (mk_equality (p, @{term True})))
   30.35 +	      TermC.Trueprop $ (TermC.mk_equality (p, @{term True})))
   30.36      else SOME ((term2str p) ^ " = True",
   30.37 -	       Trueprop $ (mk_equality (p, @{term False})))
   30.38 +	       TermC.Trueprop $ (TermC.mk_equality (p, @{term False})))
   30.39    | eval_is_rootTerm_in _ _ _ _ = ((*tracing"### nichts matcht";*) NONE);
   30.40  
   30.41  fun eval_is_sqrtTerm_in _ _ 
   30.42         (p as (Const ("RootEq.is'_sqrtTerm'_in",_) $ t $ v)) _  =
   30.43      if is_sqrtTerm_in t v then 
   30.44  	SOME ((term2str p) ^ " = True",
   30.45 -	      Trueprop $ (mk_equality (p, @{term True})))
   30.46 +	      TermC.Trueprop $ (TermC.mk_equality (p, @{term True})))
   30.47      else SOME ((term2str p) ^ " = True",
   30.48 -	       Trueprop $ (mk_equality (p, @{term False})))
   30.49 +	       TermC.Trueprop $ (TermC.mk_equality (p, @{term False})))
   30.50    | eval_is_sqrtTerm_in _ _ _ _ = ((*tracing"### nichts matcht";*) NONE);
   30.51  
   30.52  fun eval_is_normSqrtTerm_in _ _ 
   30.53         (p as (Const ("RootEq.is'_normSqrtTerm'_in",_) $ t $ v)) _  =
   30.54      if is_normSqrtTerm_in t v then 
   30.55  	SOME ((term2str p) ^ " = True",
   30.56 -	      Trueprop $ (mk_equality (p, @{term True})))
   30.57 +	      TermC.Trueprop $ (TermC.mk_equality (p, @{term True})))
   30.58      else SOME ((term2str p) ^ " = True",
   30.59 -	       Trueprop $ (mk_equality (p, @{term False})))
   30.60 +	       TermC.Trueprop $ (TermC.mk_equality (p, @{term False})))
   30.61    | eval_is_normSqrtTerm_in _ _ _ _ = ((*tracing"### nichts matcht";*) NONE);
   30.62  
   30.63  (*-------------------------rulse-------------------------*)
   30.64 @@ -212,22 +212,22 @@
   30.65  	      Calc ("RootEq.is'_rootTerm'_in",eval_is_rootTerm_in ""),
   30.66  	      Calc ("RootEq.is'_normSqrtTerm'_in",eval_is_normSqrtTerm_in ""),
   30.67  	      Calc ("HOL.eq",eval_equal "#equal_"),
   30.68 -	      Thm ("not_true",num_str @{thm not_true}),
   30.69 -	      Thm ("not_false",num_str @{thm not_false}),
   30.70 -	      Thm ("and_true",num_str @{thm and_true}),
   30.71 -	      Thm ("and_false",num_str @{thm and_false}),
   30.72 -	      Thm ("or_true",num_str @{thm or_true}),
   30.73 -	      Thm ("or_false",num_str @{thm or_false})
   30.74 +	      Thm ("not_true",TermC.num_str @{thm not_true}),
   30.75 +	      Thm ("not_false",TermC.num_str @{thm not_false}),
   30.76 +	      Thm ("and_true",TermC.num_str @{thm and_true}),
   30.77 +	      Thm ("and_false",TermC.num_str @{thm and_false}),
   30.78 +	      Thm ("or_true",TermC.num_str @{thm or_true}),
   30.79 +	      Thm ("or_false",TermC.num_str @{thm or_false})
   30.80  	      ];
   30.81  
   30.82  val RootEq_erls =
   30.83       append_rls "RootEq_erls" Root_erls
   30.84 -          [Thm ("divide_divide_eq_left",num_str @{thm divide_divide_eq_left})
   30.85 +          [Thm ("divide_divide_eq_left",TermC.num_str @{thm divide_divide_eq_left})
   30.86             ];
   30.87  
   30.88  val RootEq_crls = 
   30.89       append_rls "RootEq_crls" Root_crls
   30.90 -          [Thm ("divide_divide_eq_left",num_str @{thm divide_divide_eq_left})
   30.91 +          [Thm ("divide_divide_eq_left",TermC.num_str @{thm divide_divide_eq_left})
   30.92             ];
   30.93  
   30.94  val rooteq_srls = 
   30.95 @@ -247,97 +247,97 @@
   30.96    Rls {id = "sqrt_isolate", preconds = [], rew_ord = ("termlessI",termlessI), 
   30.97         erls = RootEq_erls, srls = Erls, calc = [], errpatts = [],
   30.98         rules = [
   30.99 -       Thm("sqrt_square_1",num_str @{thm sqrt_square_1}),
  30.100 +       Thm("sqrt_square_1",TermC.num_str @{thm sqrt_square_1}),
  30.101                       (* (sqrt a)^^^2 -> a *)
  30.102 -       Thm("sqrt_square_2",num_str @{thm sqrt_square_2}),
  30.103 +       Thm("sqrt_square_2",TermC.num_str @{thm sqrt_square_2}),
  30.104                       (* sqrt (a^^^2) -> a *)
  30.105 -       Thm("sqrt_times_root_1",num_str @{thm sqrt_times_root_1}),
  30.106 +       Thm("sqrt_times_root_1",TermC.num_str @{thm sqrt_times_root_1}),
  30.107              (* sqrt a sqrt b -> sqrt(ab) *)
  30.108 -       Thm("sqrt_times_root_2",num_str @{thm sqrt_times_root_2}),
  30.109 +       Thm("sqrt_times_root_2",TermC.num_str @{thm sqrt_times_root_2}),
  30.110              (* a sqrt b sqrt c -> a sqrt(bc) *)
  30.111         Thm("sqrt_square_equation_both_1",
  30.112 -           num_str @{thm sqrt_square_equation_both_1}),
  30.113 +           TermC.num_str @{thm sqrt_square_equation_both_1}),
  30.114         (* (sqrt a + sqrt b  = sqrt c + sqrt d) -> 
  30.115              (a+2*sqrt(a)*sqrt(b)+b) = c+2*sqrt(c)*sqrt(d)+d) *)
  30.116         Thm("sqrt_square_equation_both_2",
  30.117 -            num_str @{thm sqrt_square_equation_both_2}),
  30.118 +            TermC.num_str @{thm sqrt_square_equation_both_2}),
  30.119         (* (sqrt a - sqrt b  = sqrt c + sqrt d) -> 
  30.120              (a-2*sqrt(a)*sqrt(b)+b) = c+2*sqrt(c)*sqrt(d)+d) *)
  30.121         Thm("sqrt_square_equation_both_3",
  30.122 -            num_str @{thm sqrt_square_equation_both_3}),
  30.123 +            TermC.num_str @{thm sqrt_square_equation_both_3}),
  30.124         (* (sqrt a + sqrt b  = sqrt c - sqrt d) -> 
  30.125              (a+2*sqrt(a)*sqrt(b)+b) = c-2*sqrt(c)*sqrt(d)+d) *)
  30.126         Thm("sqrt_square_equation_both_4",
  30.127 -            num_str @{thm sqrt_square_equation_both_4}),
  30.128 +            TermC.num_str @{thm sqrt_square_equation_both_4}),
  30.129         (* (sqrt a - sqrt b  = sqrt c - sqrt d) -> 
  30.130              (a-2*sqrt(a)*sqrt(b)+b) = c-2*sqrt(c)*sqrt(d)+d) *)
  30.131         Thm("sqrt_isolate_l_add1",
  30.132 -            num_str @{thm sqrt_isolate_l_add1}), 
  30.133 +            TermC.num_str @{thm sqrt_isolate_l_add1}), 
  30.134         (* a+b*sqrt(x)=d -> b*sqrt(x) = d-a *)
  30.135         Thm("sqrt_isolate_l_add2",
  30.136 -            num_str @{thm sqrt_isolate_l_add2}), 
  30.137 +            TermC.num_str @{thm sqrt_isolate_l_add2}), 
  30.138         (* a+  sqrt(x)=d ->   sqrt(x) = d-a *)
  30.139         Thm("sqrt_isolate_l_add3",
  30.140 -            num_str @{thm sqrt_isolate_l_add3}), 
  30.141 +            TermC.num_str @{thm sqrt_isolate_l_add3}), 
  30.142         (* a+b*c/sqrt(x)=d->b*c/sqrt(x)=d-a *)
  30.143         Thm("sqrt_isolate_l_add4",
  30.144 -            num_str @{thm sqrt_isolate_l_add4}), 
  30.145 +            TermC.num_str @{thm sqrt_isolate_l_add4}), 
  30.146         (* a+c/sqrt(x)=d -> c/sqrt(x) = d-a *)
  30.147         Thm("sqrt_isolate_l_add5",
  30.148 -            num_str @{thm sqrt_isolate_l_add5}), 
  30.149 +            TermC.num_str @{thm sqrt_isolate_l_add5}), 
  30.150         (* a+b*c/f*sqrt(x)=d->b*c/f*sqrt(x)=d-a *)
  30.151         Thm("sqrt_isolate_l_add6",
  30.152 -            num_str @{thm sqrt_isolate_l_add6}), 
  30.153 +            TermC.num_str @{thm sqrt_isolate_l_add6}), 
  30.154         (* a+c/f*sqrt(x)=d -> c/f*sqrt(x) = d-a *)
  30.155 -       (*Thm("sqrt_isolate_l_div",num_str @{thm sqrt_isolate_l_div}),*)
  30.156 +       (*Thm("sqrt_isolate_l_div",TermC.num_str @{thm sqrt_isolate_l_div}),*)
  30.157           (* b*sqrt(x) = d sqrt(x) d/b *)
  30.158         Thm("sqrt_isolate_r_add1",
  30.159 -            num_str @{thm sqrt_isolate_r_add1}),
  30.160 +            TermC.num_str @{thm sqrt_isolate_r_add1}),
  30.161         (* a= d+e*sqrt(x) -> a-d=e*sqrt(x) *)
  30.162         Thm("sqrt_isolate_r_add2",
  30.163 -            num_str @{thm sqrt_isolate_r_add2}),
  30.164 +            TermC.num_str @{thm sqrt_isolate_r_add2}),
  30.165         (* a= d+  sqrt(x) -> a-d=  sqrt(x) *)
  30.166         Thm("sqrt_isolate_r_add3",
  30.167 -            num_str @{thm sqrt_isolate_r_add3}),
  30.168 +            TermC.num_str @{thm sqrt_isolate_r_add3}),
  30.169         (* a=d+e*g/sqrt(x)->a-d=e*g/sqrt(x)*)
  30.170         Thm("sqrt_isolate_r_add4",
  30.171 -            num_str @{thm sqrt_isolate_r_add4}),
  30.172 +            TermC.num_str @{thm sqrt_isolate_r_add4}),
  30.173         (* a= d+g/sqrt(x) -> a-d=g/sqrt(x) *)
  30.174         Thm("sqrt_isolate_r_add5",
  30.175 -            num_str @{thm sqrt_isolate_r_add5}),
  30.176 +            TermC.num_str @{thm sqrt_isolate_r_add5}),
  30.177         (* a=d+e*g/h*sqrt(x)->a-d=e*g/h*sqrt(x)*)
  30.178         Thm("sqrt_isolate_r_add6",
  30.179 -            num_str @{thm sqrt_isolate_r_add6}),
  30.180 +            TermC.num_str @{thm sqrt_isolate_r_add6}),
  30.181         (* a= d+g/h*sqrt(x) -> a-d=g/h*sqrt(x) *)
  30.182 -       (*Thm("sqrt_isolate_r_div",num_str @{thm sqrt_isolate_r_div}),*)
  30.183 +       (*Thm("sqrt_isolate_r_div",TermC.num_str @{thm sqrt_isolate_r_div}),*)
  30.184           (* a=e*sqrt(x) -> a/e = sqrt(x) *)
  30.185         Thm("sqrt_square_equation_left_1",
  30.186 -            num_str @{thm sqrt_square_equation_left_1}),   
  30.187 +            TermC.num_str @{thm sqrt_square_equation_left_1}),   
  30.188         (* sqrt(x)=b -> x=b^2 *)
  30.189         Thm("sqrt_square_equation_left_2",
  30.190 -            num_str @{thm sqrt_square_equation_left_2}),   
  30.191 +            TermC.num_str @{thm sqrt_square_equation_left_2}),   
  30.192         (* c*sqrt(x)=b -> c^2*x=b^2 *)
  30.193 -       Thm("sqrt_square_equation_left_3",num_str @{thm sqrt_square_equation_left_3}),  
  30.194 +       Thm("sqrt_square_equation_left_3",TermC.num_str @{thm sqrt_square_equation_left_3}),  
  30.195  	      (* c/sqrt(x)=b -> c^2/x=b^2 *)
  30.196 -       Thm("sqrt_square_equation_left_4",num_str @{thm sqrt_square_equation_left_4}),
  30.197 +       Thm("sqrt_square_equation_left_4",TermC.num_str @{thm sqrt_square_equation_left_4}),
  30.198  	      (* c*d/sqrt(x)=b -> c^2*d^2/x=b^2 *)
  30.199 -       Thm("sqrt_square_equation_left_5",num_str @{thm sqrt_square_equation_left_5}),
  30.200 +       Thm("sqrt_square_equation_left_5",TermC.num_str @{thm sqrt_square_equation_left_5}),
  30.201  	      (* c/d*sqrt(x)=b -> c^2/d^2x=b^2 *)
  30.202 -       Thm("sqrt_square_equation_left_6",num_str @{thm sqrt_square_equation_left_6}),
  30.203 +       Thm("sqrt_square_equation_left_6",TermC.num_str @{thm sqrt_square_equation_left_6}),
  30.204  	      (* c*d/g*sqrt(x)=b -> c^2*d^2/g^2x=b^2 *)
  30.205 -       Thm("sqrt_square_equation_right_1",num_str @{thm sqrt_square_equation_right_1}),
  30.206 +       Thm("sqrt_square_equation_right_1",TermC.num_str @{thm sqrt_square_equation_right_1}),
  30.207  	      (* a=sqrt(x) ->a^2=x *)
  30.208 -       Thm("sqrt_square_equation_right_2",num_str @{thm sqrt_square_equation_right_2}),
  30.209 +       Thm("sqrt_square_equation_right_2",TermC.num_str @{thm sqrt_square_equation_right_2}),
  30.210  	      (* a=c*sqrt(x) ->a^2=c^2*x *)
  30.211 -       Thm("sqrt_square_equation_right_3",num_str @{thm sqrt_square_equation_right_3}),
  30.212 +       Thm("sqrt_square_equation_right_3",TermC.num_str @{thm sqrt_square_equation_right_3}),
  30.213  	      (* a=c/sqrt(x) ->a^2=c^2/x *)
  30.214 -       Thm("sqrt_square_equation_right_4",num_str @{thm sqrt_square_equation_right_4}),
  30.215 +       Thm("sqrt_square_equation_right_4",TermC.num_str @{thm sqrt_square_equation_right_4}),
  30.216  	      (* a=c*d/sqrt(x) ->a^2=c^2*d^2/x *)
  30.217 -       Thm("sqrt_square_equation_right_5",num_str @{thm sqrt_square_equation_right_5}),
  30.218 +       Thm("sqrt_square_equation_right_5",TermC.num_str @{thm sqrt_square_equation_right_5}),
  30.219  	      (* a=c/e*sqrt(x) ->a^2=c^2/e^2x *)
  30.220 -       Thm("sqrt_square_equation_right_6",num_str @{thm sqrt_square_equation_right_6})
  30.221 +       Thm("sqrt_square_equation_right_6",TermC.num_str @{thm sqrt_square_equation_right_6})
  30.222  	      (* a=c*d/g*sqrt(x) ->a^2=c^2*d^2/g^2*x *)
  30.223 -       ],scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
  30.224 +       ],scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  30.225        }:rls);
  30.226  *}
  30.227  setup {* KEStore_Elems.add_rlss
  30.228 @@ -350,42 +350,42 @@
  30.229  	  rew_ord = ("termlessI",termlessI), 
  30.230            erls = RootEq_erls, srls = Erls, calc = [], errpatts = [],
  30.231       rules = [
  30.232 -     Thm("sqrt_square_1",num_str @{thm sqrt_square_1}),
  30.233 +     Thm("sqrt_square_1",TermC.num_str @{thm sqrt_square_1}),
  30.234                              (* (sqrt a)^^^2 -> a *)
  30.235 -     Thm("sqrt_square_2",num_str @{thm sqrt_square_2}),
  30.236 +     Thm("sqrt_square_2",TermC.num_str @{thm sqrt_square_2}),
  30.237                              (* sqrt (a^^^2) -> a *)
  30.238 -     Thm("sqrt_times_root_1",num_str @{thm sqrt_times_root_1}),
  30.239 +     Thm("sqrt_times_root_1",TermC.num_str @{thm sqrt_times_root_1}),
  30.240              (* sqrt a sqrt b -> sqrt(ab) *)
  30.241 -     Thm("sqrt_times_root_2",num_str @{thm sqrt_times_root_2}),
  30.242 +     Thm("sqrt_times_root_2",TermC.num_str @{thm sqrt_times_root_2}),
  30.243          (* a sqrt b sqrt c -> a sqrt(bc) *)
  30.244 -     Thm("sqrt_isolate_l_add1",num_str @{thm sqrt_isolate_l_add1}),
  30.245 +     Thm("sqrt_isolate_l_add1",TermC.num_str @{thm sqrt_isolate_l_add1}),
  30.246          (* a+b*sqrt(x)=d -> b*sqrt(x) = d-a *)
  30.247 -     Thm("sqrt_isolate_l_add2",num_str @{thm sqrt_isolate_l_add2}),
  30.248 +     Thm("sqrt_isolate_l_add2",TermC.num_str @{thm sqrt_isolate_l_add2}),
  30.249          (* a+  sqrt(x)=d ->   sqrt(x) = d-a *)
  30.250 -     Thm("sqrt_isolate_l_add3",num_str @{thm sqrt_isolate_l_add3}),
  30.251 +     Thm("sqrt_isolate_l_add3",TermC.num_str @{thm sqrt_isolate_l_add3}),
  30.252          (* a+b*c/sqrt(x)=d->b*c/sqrt(x)=d-a *)
  30.253 -     Thm("sqrt_isolate_l_add4",num_str @{thm sqrt_isolate_l_add4}),
  30.254 +     Thm("sqrt_isolate_l_add4",TermC.num_str @{thm sqrt_isolate_l_add4}),
  30.255          (* a+c/sqrt(x)=d -> c/sqrt(x) = d-a *)
  30.256 -     Thm("sqrt_isolate_l_add5",num_str @{thm sqrt_isolate_l_add5}),
  30.257 +     Thm("sqrt_isolate_l_add5",TermC.num_str @{thm sqrt_isolate_l_add5}),
  30.258          (* a+b*c/f*sqrt(x)=d->b*c/f*sqrt(x)=d-a *)
  30.259 -     Thm("sqrt_isolate_l_add6",num_str @{thm sqrt_isolate_l_add6}),
  30.260 +     Thm("sqrt_isolate_l_add6",TermC.num_str @{thm sqrt_isolate_l_add6}),
  30.261          (* a+c/f*sqrt(x)=d -> c/f*sqrt(x) = d-a *)
  30.262 -   (*Thm("sqrt_isolate_l_div",num_str @{thm sqrt_isolate_l_div}),*)
  30.263 +   (*Thm("sqrt_isolate_l_div",TermC.num_str @{thm sqrt_isolate_l_div}),*)
  30.264          (* b*sqrt(x) = d sqrt(x) d/b *)
  30.265 -     Thm("sqrt_square_equation_left_1",num_str @{thm sqrt_square_equation_left_1}),
  30.266 +     Thm("sqrt_square_equation_left_1",TermC.num_str @{thm sqrt_square_equation_left_1}),
  30.267  	      (* sqrt(x)=b -> x=b^2 *)
  30.268 -     Thm("sqrt_square_equation_left_2",num_str @{thm sqrt_square_equation_left_2}),
  30.269 +     Thm("sqrt_square_equation_left_2",TermC.num_str @{thm sqrt_square_equation_left_2}),
  30.270  	      (* a*sqrt(x)=b -> a^2*x=b^2*)
  30.271 -     Thm("sqrt_square_equation_left_3",num_str @{thm sqrt_square_equation_left_3}),   
  30.272 +     Thm("sqrt_square_equation_left_3",TermC.num_str @{thm sqrt_square_equation_left_3}),   
  30.273  	      (* c/sqrt(x)=b -> c^2/x=b^2 *)
  30.274 -     Thm("sqrt_square_equation_left_4",num_str @{thm sqrt_square_equation_left_4}),   
  30.275 +     Thm("sqrt_square_equation_left_4",TermC.num_str @{thm sqrt_square_equation_left_4}),   
  30.276  	      (* c*d/sqrt(x)=b -> c^2*d^2/x=b^2 *)
  30.277 -     Thm("sqrt_square_equation_left_5",num_str @{thm sqrt_square_equation_left_5}),   
  30.278 +     Thm("sqrt_square_equation_left_5",TermC.num_str @{thm sqrt_square_equation_left_5}),   
  30.279  	      (* c/d*sqrt(x)=b -> c^2/d^2x=b^2 *)
  30.280 -     Thm("sqrt_square_equation_left_6",num_str @{thm sqrt_square_equation_left_6})  
  30.281 +     Thm("sqrt_square_equation_left_6",TermC.num_str @{thm sqrt_square_equation_left_6})  
  30.282  	      (* c*d/g*sqrt(x)=b -> c^2*d^2/g^2x=b^2 *)
  30.283      ],
  30.284 -    scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
  30.285 +    scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  30.286     }:rls);
  30.287  *}
  30.288  setup {* KEStore_Elems.add_rlss
  30.289 @@ -399,42 +399,42 @@
  30.290  	  rew_ord = ("termlessI",termlessI), 
  30.291            erls = RootEq_erls, srls = Erls, calc = [], errpatts = [],
  30.292       rules = [
  30.293 -     Thm("sqrt_square_1",num_str @{thm sqrt_square_1}),
  30.294 +     Thm("sqrt_square_1",TermC.num_str @{thm sqrt_square_1}),
  30.295                             (* (sqrt a)^^^2 -> a *)
  30.296 -     Thm("sqrt_square_2",num_str @{thm sqrt_square_2}), 
  30.297 +     Thm("sqrt_square_2",TermC.num_str @{thm sqrt_square_2}), 
  30.298                             (* sqrt (a^^^2) -> a *)
  30.299 -     Thm("sqrt_times_root_1",num_str @{thm sqrt_times_root_1}),
  30.300 +     Thm("sqrt_times_root_1",TermC.num_str @{thm sqrt_times_root_1}),
  30.301             (* sqrt a sqrt b -> sqrt(ab) *)
  30.302 -     Thm("sqrt_times_root_2",num_str @{thm sqrt_times_root_2}),
  30.303 +     Thm("sqrt_times_root_2",TermC.num_str @{thm sqrt_times_root_2}),
  30.304         (* a sqrt b sqrt c -> a sqrt(bc) *)
  30.305 -     Thm("sqrt_isolate_r_add1",num_str @{thm sqrt_isolate_r_add1}),
  30.306 +     Thm("sqrt_isolate_r_add1",TermC.num_str @{thm sqrt_isolate_r_add1}),
  30.307         (* a= d+e*sqrt(x) -> a-d=e*sqrt(x) *)
  30.308 -     Thm("sqrt_isolate_r_add2",num_str @{thm sqrt_isolate_r_add2}),
  30.309 +     Thm("sqrt_isolate_r_add2",TermC.num_str @{thm sqrt_isolate_r_add2}),
  30.310         (* a= d+  sqrt(x) -> a-d=  sqrt(x) *)
  30.311 -     Thm("sqrt_isolate_r_add3",num_str @{thm sqrt_isolate_r_add3}),
  30.312 +     Thm("sqrt_isolate_r_add3",TermC.num_str @{thm sqrt_isolate_r_add3}),
  30.313         (* a=d+e*g/sqrt(x)->a-d=e*g/sqrt(x)*)
  30.314 -     Thm("sqrt_isolate_r_add4",num_str @{thm sqrt_isolate_r_add4}),
  30.315 +     Thm("sqrt_isolate_r_add4",TermC.num_str @{thm sqrt_isolate_r_add4}),
  30.316         (* a= d+g/sqrt(x) -> a-d=g/sqrt(x) *)
  30.317 -     Thm("sqrt_isolate_r_add5",num_str @{thm sqrt_isolate_r_add5}),
  30.318 +     Thm("sqrt_isolate_r_add5",TermC.num_str @{thm sqrt_isolate_r_add5}),
  30.319         (* a=d+e*g/h*sqrt(x)->a-d=e*g/h*sqrt(x)*)
  30.320 -     Thm("sqrt_isolate_r_add6",num_str @{thm sqrt_isolate_r_add6}),
  30.321 +     Thm("sqrt_isolate_r_add6",TermC.num_str @{thm sqrt_isolate_r_add6}),
  30.322         (* a= d+g/h*sqrt(x) -> a-d=g/h*sqrt(x) *)
  30.323 -   (*Thm("sqrt_isolate_r_div",num_str @{thm sqrt_isolate_r_div}),*)
  30.324 +   (*Thm("sqrt_isolate_r_div",TermC.num_str @{thm sqrt_isolate_r_div}),*)
  30.325         (* a=e*sqrt(x) -> a/e = sqrt(x) *)
  30.326 -     Thm("sqrt_square_equation_right_1",num_str @{thm sqrt_square_equation_right_1}),
  30.327 +     Thm("sqrt_square_equation_right_1",TermC.num_str @{thm sqrt_square_equation_right_1}),
  30.328  	      (* a=sqrt(x) ->a^2=x *)
  30.329 -     Thm("sqrt_square_equation_right_2",num_str @{thm sqrt_square_equation_right_2}),
  30.330 +     Thm("sqrt_square_equation_right_2",TermC.num_str @{thm sqrt_square_equation_right_2}),
  30.331  	      (* a=c*sqrt(x) ->a^2=c^2*x *)
  30.332 -     Thm("sqrt_square_equation_right_3",num_str @{thm sqrt_square_equation_right_3}),
  30.333 +     Thm("sqrt_square_equation_right_3",TermC.num_str @{thm sqrt_square_equation_right_3}),
  30.334  	      (* a=c/sqrt(x) ->a^2=c^2/x *)
  30.335 -     Thm("sqrt_square_equation_right_4",num_str @{thm sqrt_square_equation_right_4}), 
  30.336 +     Thm("sqrt_square_equation_right_4",TermC.num_str @{thm sqrt_square_equation_right_4}), 
  30.337  	      (* a=c*d/sqrt(x) ->a^2=c^2*d^2/x *)
  30.338 -     Thm("sqrt_square_equation_right_5",num_str @{thm sqrt_square_equation_right_5}),
  30.339 +     Thm("sqrt_square_equation_right_5",TermC.num_str @{thm sqrt_square_equation_right_5}),
  30.340  	      (* a=c/e*sqrt(x) ->a^2=c^2/e^2x *)
  30.341 -     Thm("sqrt_square_equation_right_6",num_str @{thm sqrt_square_equation_right_6})
  30.342 +     Thm("sqrt_square_equation_right_6",TermC.num_str @{thm sqrt_square_equation_right_6})
  30.343  	      (* a=c*d/g*sqrt(x) ->a^2=c^2*d^2/g^2*x *)
  30.344      ],
  30.345 -    scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
  30.346 +    scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  30.347     }:rls);
  30.348  *}
  30.349  setup {* KEStore_Elems.add_rlss
  30.350 @@ -446,9 +446,9 @@
  30.351         preconds = [], rew_ord = ("termlessI",termlessI), 
  30.352         erls = RootEq_erls, srls = Erls, calc = [], errpatts = [],
  30.353         (*asm_thm = [("sqrt_square_1","")],*)
  30.354 -       rules = [Thm  ("real_assoc_1",num_str @{thm real_assoc_1}),
  30.355 +       rules = [Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1}),
  30.356                               (* a+(b+c) = a+b+c *)
  30.357 -                Thm  ("real_assoc_2",num_str @{thm real_assoc_2}),
  30.358 +                Thm  ("real_assoc_2",TermC.num_str @{thm real_assoc_2}),
  30.359                               (* a*(b*c) = a*b*c *)
  30.360                  Calc ("Groups.plus_class.plus",eval_binop "#add_"),
  30.361                  Calc ("Groups.minus_class.minus",eval_binop "#sub_"),
  30.362 @@ -456,20 +456,20 @@
  30.363                  Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),
  30.364                  Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"),
  30.365                  Calc ("Atools.pow" ,eval_binop "#power_"),
  30.366 -                Thm("real_plus_binom_pow2",num_str @{thm real_plus_binom_pow2}),
  30.367 -                Thm("real_minus_binom_pow2",num_str @{thm real_minus_binom_pow2}),
  30.368 -                Thm("realpow_mul",num_str @{thm realpow_mul}),    
  30.369 +                Thm("real_plus_binom_pow2",TermC.num_str @{thm real_plus_binom_pow2}),
  30.370 +                Thm("real_minus_binom_pow2",TermC.num_str @{thm real_minus_binom_pow2}),
  30.371 +                Thm("realpow_mul",TermC.num_str @{thm realpow_mul}),    
  30.372                       (* (a * b)^n = a^n * b^n*)
  30.373 -                Thm("sqrt_times_root_1",num_str @{thm sqrt_times_root_1}), 
  30.374 +                Thm("sqrt_times_root_1",TermC.num_str @{thm sqrt_times_root_1}), 
  30.375                       (* sqrt b * sqrt c = sqrt(b*c) *)
  30.376 -                Thm("sqrt_times_root_2",num_str @{thm sqrt_times_root_2}),
  30.377 +                Thm("sqrt_times_root_2",TermC.num_str @{thm sqrt_times_root_2}),
  30.378                       (* a * sqrt a * sqrt b = a * sqrt(a*b) *)
  30.379 -                Thm("sqrt_square_2",num_str @{thm sqrt_square_2}),
  30.380 +                Thm("sqrt_square_2",TermC.num_str @{thm sqrt_square_2}),
  30.381                              (* sqrt (a^^^2) = a *)
  30.382 -                Thm("sqrt_square_1",num_str @{thm sqrt_square_1}) 
  30.383 +                Thm("sqrt_square_1",TermC.num_str @{thm sqrt_square_1}) 
  30.384                              (* sqrt a ^^^ 2 = a *)
  30.385                  ],
  30.386 -       scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
  30.387 +       scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  30.388      }:rls);
  30.389  *}
  30.390  setup {* KEStore_Elems.add_rlss
    31.1 --- a/src/Tools/isac/Knowledge/RootRat.thy	Sun Feb 25 16:31:17 2018 +0100
    31.2 +++ b/src/Tools/isac/Knowledge/RootRat.thy	Fri Mar 02 14:19:59 2018 +0100
    31.3 @@ -16,11 +16,11 @@
    31.4  (*.calculate numeral groundterms.*)
    31.5  val calculate_RootRat = 
    31.6    append_rls "calculate_RootRat" calculate_Rational
    31.7 -	    [Thm ("distrib_left",num_str @{thm distrib_left}),
    31.8 +	    [Thm ("distrib_left",TermC.num_str @{thm distrib_left}),
    31.9  		      (* w*(z1.0 + z2.0) = w * z1.0 + w * z2.0 *)
   31.10 -		     Thm ("mult_1_left",num_str @{thm mult_1_left}),
   31.11 +		     Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),
   31.12  		      (* 1 * z = z *)
   31.13 -		     Thm ("sym_real_mult_minus1",num_str (@{thm real_mult_minus1} RS @{thm sym})),
   31.14 +		     Thm ("sym_real_mult_minus1",TermC.num_str (@{thm real_mult_minus1} RS @{thm sym})),
   31.15  		       (* "- z1 = -1 * z1"  *)
   31.16  		     Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_")
   31.17  		     ];
    32.1 --- a/src/Tools/isac/Knowledge/RootRatEq.thy	Sun Feb 25 16:31:17 2018 +0100
    32.2 +++ b/src/Tools/isac/Knowledge/RootRatEq.thy	Fri Mar 02 14:19:59 2018 +0100
    32.3 @@ -47,7 +47,7 @@
    32.4     if false then (term)^2 contains no (sq)root *)
    32.5  fun is_rootRatAddTerm_in t v = 
    32.6      let 
    32.7 -	fun coeff_in c v = member op = (vars c) v;
    32.8 +	fun coeff_in c v = member op = (TermC.vars c) v;
    32.9  	fun rootadd (t as (Const ("Groups.plus_class.plus",_) $ t2 $ t3)) v = 
   32.10              (is_rootTerm_in t2 v) orelse (is_rootTerm_in t3 v)
   32.11  	  | rootadd (t as (Const ("Groups.minus_class.minus",_) $ t2 $ t3)) v = 
   32.12 @@ -69,9 +69,9 @@
   32.13             (p as (Const ("RootRatEq.is'_rootRatAddTerm'_in",_) $ t $ v)) _  =
   32.14      if is_rootRatAddTerm_in t v then 
   32.15  	SOME ((term2str p) ^ " = True",
   32.16 -	      Trueprop $ (mk_equality (p, @{term True})))
   32.17 +	      TermC.Trueprop $ (TermC.mk_equality (p, @{term True})))
   32.18      else SOME ((term2str p) ^ " = True",
   32.19 -	       Trueprop $ (mk_equality (p, @{term False})))
   32.20 +	      TermC.Trueprop $ (TermC.mk_equality (p, @{term False})))
   32.21    | eval_is_rootRatAddTerm_in _ _ _ _ = ((*tracing"### nichts matcht";*) NONE);
   32.22  *}
   32.23  ML {*
   32.24 @@ -86,12 +86,12 @@
   32.25                   Calc ("RootRatEq.is'_rootRatAddTerm'_in", 
   32.26                         eval_is_rootRatAddTerm_in ""),
   32.27                   Calc ("HOL.eq",eval_equal "#equal_"),
   32.28 -                 Thm ("not_true",num_str @{thm not_true}),
   32.29 -                 Thm ("not_false",num_str @{thm not_false}),
   32.30 -                 Thm ("and_true",num_str @{thm and_true}),
   32.31 -                 Thm ("and_false",num_str @{thm and_false}),
   32.32 -                 Thm ("or_true",num_str @{thm or_true}),
   32.33 -                 Thm ("or_false",num_str @{thm or_false})
   32.34 +                 Thm ("not_true",TermC.num_str @{thm not_true}),
   32.35 +                 Thm ("not_false",TermC.num_str @{thm not_false}),
   32.36 +                 Thm ("and_true",TermC.num_str @{thm and_true}),
   32.37 +                 Thm ("and_false",TermC.num_str @{thm and_false}),
   32.38 +                 Thm ("or_true",TermC.num_str @{thm or_true}),
   32.39 +                 Thm ("or_false",TermC.num_str @{thm or_false})
   32.40  		 ];
   32.41  
   32.42  val RooRatEq_erls = 
   32.43 @@ -117,17 +117,17 @@
   32.44  	  rew_ord = ("termlessI",termlessI), 
   32.45       erls = e_rls, srls = Erls, calc = [], errpatts = [],
   32.46       rules = 
   32.47 -     [Thm("rootrat_equation_left_1", num_str @{thm rootrat_equation_left_1}),   
   32.48 +     [Thm("rootrat_equation_left_1", TermC.num_str @{thm rootrat_equation_left_1}),   
   32.49  	        (* [|c is_rootTerm_in bdv|] ==> 
   32.50                                      ( (a + b/c = d) = ( b = (d - a) * c )) *)
   32.51 -      Thm("rootrat_equation_left_2",num_str @{thm rootrat_equation_left_2}),
   32.52 +      Thm("rootrat_equation_left_2",TermC.num_str @{thm rootrat_equation_left_2}),
   32.53  	        (* [|c is_rootTerm_in bdv|] ==> ( (b/c = d) = ( b = d * c )) *)
   32.54 -      Thm("rootrat_equation_right_1",num_str @{thm rootrat_equation_right_1}),
   32.55 +      Thm("rootrat_equation_right_1",TermC.num_str @{thm rootrat_equation_right_1}),
   32.56  		(* [|f is_rootTerm_in bdv|] ==> 
   32.57                                      ( (a = d + e/f) = ( (a - d) * f = e )) *)
   32.58 -      Thm("rootrat_equation_right_2",num_str @{thm rootrat_equation_right_2})
   32.59 +      Thm("rootrat_equation_right_2",TermC.num_str @{thm rootrat_equation_right_2})
   32.60  		(* [|f is_rootTerm_in bdv|] ==> ( (a =  e/f) = ( a  * f = e ))*)
   32.61 -      ], scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")}:rls);
   32.62 +      ], scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")}:rls);
   32.63  *}
   32.64  setup {* KEStore_Elems.add_rlss
   32.65    [("rootrat_solve", (Context.theory_name @{theory}, rootrat_solve))] *}
    33.1 --- a/src/Tools/isac/Knowledge/Simplify.thy	Sun Feb 25 16:31:17 2018 +0100
    33.2 +++ b/src/Tools/isac/Knowledge/Simplify.thy	Fri Mar 02 14:19:59 2018 +0100
    33.3 @@ -62,16 +62,16 @@
    33.4  				  "Simplify (2*a + 3*a)");
    33.5     *)
    33.6  fun argl2dtss t =
    33.7 -    [((Thm.term_of o the o (parse thy)) "Term", t),
    33.8 -     ((Thm.term_of o the o (parse thy)) "normalform", 
    33.9 -      [(Thm.term_of o the o (parse thy)) "N"])
   33.10 +    [((Thm.term_of o the o (TermC.parse thy)) "Term", t),
   33.11 +     ((Thm.term_of o the o (TermC.parse thy)) "normalform", 
   33.12 +      [(Thm.term_of o the o (TermC.parse thy)) "N"])
   33.13       ]
   33.14    (*| argl2dtss _ = error "Simplify.ML: wrong argument for argl2dtss"*);
   33.15  *}
   33.16  setup {* KEStore_Elems.add_cas
   33.17 -  [((Thm.term_of o the o (parse thy)) "Simplify",  
   33.18 +  [((Thm.term_of o the o (TermC.parse thy)) "Simplify",  
   33.19      (("Isac", ["simplification"], ["no_met"]), argl2dtss)),
   33.20 -   ((Thm.term_of o the o (parse thy)) "Vereinfache",  
   33.21 +   ((Thm.term_of o the o (TermC.parse thy)) "Vereinfache",  
   33.22       (("Isac", ["vereinfachen"], ["no_met"]), argl2dtss))]*}
   33.23  
   33.24  end
   33.25 \ No newline at end of file
    34.1 --- a/src/Tools/isac/Knowledge/Test.thy	Sun Feb 25 16:31:17 2018 +0100
    34.2 +++ b/src/Tools/isac/Knowledge/Test.thy	Fri Mar 02 14:19:59 2018 +0100
    34.3 @@ -172,33 +172,33 @@
    34.4  fun eval_root_free (thmid:string) _ (t as (Const (op0, t0) $ arg)) thy = 
    34.5    if strip_thy op0 <> "is'_root'_free" 
    34.6      then error ("eval_root_free: wrong " ^ op0)
    34.7 -  else if const_in (strip_thy op0) arg
    34.8 -  then SOME (mk_thmid thmid "" (term_to_string''' thy arg)"",
    34.9 -	       Trueprop $ (mk_equality (t, @{term False})))
   34.10 -  else SOME (mk_thmid thmid "" (term_to_string''' thy arg)"",
   34.11 -	       Trueprop $ (mk_equality (t, @{term True})))
   34.12 +  else if TermC.const_in (strip_thy op0) arg
   34.13 +  then SOME (TermC.mk_thmid thmid "" (term_to_string''' thy arg)"",
   34.14 +	       TermC.Trueprop $ (TermC.mk_equality (t, @{term False})))
   34.15 +  else SOME (TermC.mk_thmid thmid "" (term_to_string''' thy arg)"",
   34.16 +	       TermC.Trueprop $ (TermC.mk_equality (t, @{term True})))
   34.17  | eval_root_free _ _ _ _ = NONE; 
   34.18  
   34.19  (*does a term contain a root ?*)
   34.20  fun eval_contains_root (thmid:string) _ 
   34.21  		       (t as (Const("Test.contains'_root",t0) $ arg)) thy = 
   34.22    if member op = (ids_of arg) "sqrt"
   34.23 -  then SOME (mk_thmid thmid "" (term_to_string''' thy arg)"",
   34.24 -	       Trueprop $ (mk_equality (t, @{term True})))
   34.25 -  else SOME (mk_thmid thmid "" (term_to_string''' thy arg)"",
   34.26 -	       Trueprop $ (mk_equality (t, @{term False})))
   34.27 +  then SOME (TermC.mk_thmid thmid "" (term_to_string''' thy arg)"",
   34.28 +	       TermC.Trueprop $ (TermC.mk_equality (t, @{term True})))
   34.29 +  else SOME (TermC.mk_thmid thmid "" (term_to_string''' thy arg)"",
   34.30 +	       TermC.Trueprop $ (TermC.mk_equality (t, @{term False})))
   34.31  | eval_contains_root _ _ _ _ = NONE; 
   34.32  
   34.33  (*dummy precondition for root-met of x+1=2*)
   34.34  fun eval_precond_rootmet (thmid:string) _ (t as (Const ("Test.precond'_rootmet", _) $ arg)) thy = 
   34.35 -    SOME (mk_thmid thmid "" (term_to_string''' thy arg)"",
   34.36 -      Trueprop $ (mk_equality (t, @{term True})))
   34.37 +    SOME (TermC.mk_thmid thmid "" (term_to_string''' thy arg)"",
   34.38 +      TermC.Trueprop $ (TermC.mk_equality (t, @{term True})))
   34.39    | eval_precond_rootmet _ _ _ _ = NONE; 
   34.40  
   34.41  (*dummy precondition for root-pbl of x+1=2*)
   34.42  fun eval_precond_rootpbl (thmid:string) _ (t as (Const ("Test.precond'_rootpbl", _) $ arg)) thy = 
   34.43 -    SOME (mk_thmid thmid "" (term_to_string''' thy arg) "",
   34.44 -	    Trueprop $ (mk_equality (t, @{term True})))
   34.45 +    SOME (TermC.mk_thmid thmid "" (term_to_string''' thy arg) "",
   34.46 +	    TermC.Trueprop $ (TermC.mk_equality (t, @{term True})))
   34.47  	| eval_precond_rootpbl _ _ _ _ = NONE;
   34.48  *}
   34.49  setup {* KEStore_Elems.add_calcs
   34.50 @@ -217,17 +217,17 @@
   34.51    Rls {id = "testerls", preconds = [], rew_ord = ("termlessI",termlessI), 
   34.52        erls = e_rls, srls = Erls, 
   34.53        calc = [], errpatts = [], 
   34.54 -      rules = [Thm ("refl",num_str @{thm refl}),
   34.55 -	       Thm ("order_refl",num_str @{thm order_refl}),
   34.56 -	       Thm ("radd_left_cancel_le",num_str @{thm radd_left_cancel_le}),
   34.57 -	       Thm ("not_true",num_str @{thm not_true}),
   34.58 -	       Thm ("not_false",num_str @{thm not_false}),
   34.59 -	       Thm ("and_true",num_str @{thm and_true}),
   34.60 -	       Thm ("and_false",num_str @{thm and_false}),
   34.61 -	       Thm ("or_true",num_str @{thm or_true}),
   34.62 -	       Thm ("or_false",num_str @{thm or_false}),
   34.63 -	       Thm ("and_commute",num_str @{thm and_commute}),
   34.64 -	       Thm ("or_commute",num_str @{thm or_commute}),
   34.65 +      rules = [Thm ("refl",TermC.num_str @{thm refl}),
   34.66 +	       Thm ("order_refl",TermC.num_str @{thm order_refl}),
   34.67 +	       Thm ("radd_left_cancel_le",TermC.num_str @{thm radd_left_cancel_le}),
   34.68 +	       Thm ("not_true",TermC.num_str @{thm not_true}),
   34.69 +	       Thm ("not_false",TermC.num_str @{thm not_false}),
   34.70 +	       Thm ("and_true",TermC.num_str @{thm and_true}),
   34.71 +	       Thm ("and_false",TermC.num_str @{thm and_false}),
   34.72 +	       Thm ("or_true",TermC.num_str @{thm or_true}),
   34.73 +	       Thm ("or_false",TermC.num_str @{thm or_false}),
   34.74 +	       Thm ("and_commute",TermC.num_str @{thm and_commute}),
   34.75 +	       Thm ("or_commute",TermC.num_str @{thm or_commute}),
   34.76  
   34.77  	       Calc ("Atools.is'_const",eval_const "#is_const_"),
   34.78  	       Calc ("Tools.matches",eval_matches ""),
   34.79 @@ -240,7 +240,7 @@
   34.80  	       Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"),
   34.81  	     	    
   34.82  	       Calc ("Atools.ident",eval_ident "#ident_")],
   34.83 -      scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
   34.84 +      scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
   34.85        }:rls;      
   34.86  *}
   34.87  ML {*
   34.88 @@ -251,24 +251,24 @@
   34.89        rew_ord = ("sqrt_right",sqrt_right false @{theory "Pure"}), 
   34.90        erls=testerls,srls = e_rls, 
   34.91        calc=[], errpatts = [],
   34.92 -      rules = [Thm ("refl",num_str @{thm refl}),
   34.93 -	       Thm ("order_refl",num_str @{thm order_refl}),
   34.94 -	       Thm ("radd_left_cancel_le",num_str @{thm radd_left_cancel_le}),
   34.95 -	       Thm ("not_true",num_str @{thm not_true}),
   34.96 -	       Thm ("not_false",num_str @{thm not_false}),
   34.97 -	       Thm ("and_true",num_str @{thm and_true}),
   34.98 -	       Thm ("and_false",num_str @{thm and_false}),
   34.99 -	       Thm ("or_true",num_str @{thm or_true}),
  34.100 -	       Thm ("or_false",num_str @{thm or_false}),
  34.101 -	       Thm ("and_commute",num_str @{thm and_commute}),
  34.102 -	       Thm ("or_commute",num_str @{thm or_commute}),
  34.103 +      rules = [Thm ("refl",TermC.num_str @{thm refl}),
  34.104 +	       Thm ("order_refl",TermC.num_str @{thm order_refl}),
  34.105 +	       Thm ("radd_left_cancel_le",TermC.num_str @{thm radd_left_cancel_le}),
  34.106 +	       Thm ("not_true",TermC.num_str @{thm not_true}),
  34.107 +	       Thm ("not_false",TermC.num_str @{thm not_false}),
  34.108 +	       Thm ("and_true",TermC.num_str @{thm and_true}),
  34.109 +	       Thm ("and_false",TermC.num_str @{thm and_false}),
  34.110 +	       Thm ("or_true",TermC.num_str @{thm or_true}),
  34.111 +	       Thm ("or_false",TermC.num_str @{thm or_false}),
  34.112 +	       Thm ("and_commute",TermC.num_str @{thm and_commute}),
  34.113 +	       Thm ("or_commute",TermC.num_str @{thm or_commute}),
  34.114  
  34.115 -	       Thm ("real_diff_minus",num_str @{thm real_diff_minus}),
  34.116 +	       Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}),
  34.117  
  34.118 -	       Thm ("root_ge0",num_str @{thm root_ge0}),
  34.119 -	       Thm ("root_add_ge0",num_str @{thm root_add_ge0}),
  34.120 -	       Thm ("root_ge0_1",num_str @{thm root_ge0_1}),
  34.121 -	       Thm ("root_ge0_2",num_str @{thm root_ge0_2}),
  34.122 +	       Thm ("root_ge0",TermC.num_str @{thm root_ge0}),
  34.123 +	       Thm ("root_add_ge0",TermC.num_str @{thm root_add_ge0}),
  34.124 +	       Thm ("root_ge0_1",TermC.num_str @{thm root_ge0_1}),
  34.125 +	       Thm ("root_ge0_2",TermC.num_str @{thm root_ge0_2}),
  34.126  
  34.127  	       Calc ("Atools.is'_const",eval_const "#is_const_"),
  34.128  	       Calc ("Test.is'_root'_free",eval_root_free "#is_root_free_e"),
  34.129 @@ -285,7 +285,7 @@
  34.130  	       Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"),
  34.131  	     	    
  34.132  	       Calc ("Atools.ident",eval_ident "#ident_")],
  34.133 -      scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
  34.134 +      scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  34.135        }:rls;      
  34.136  *}
  34.137  setup {* KEStore_Elems.add_rlss [("testerls", (Context.theory_name @{theory}, prep_rls' testerls))] *}
  34.138 @@ -297,31 +297,31 @@
  34.139        rew_ord = ("e_rew_ord",e_rew_ord), 
  34.140        erls = e_rls, srls = e_rls, calc = [], errpatts = [],
  34.141        rules = 
  34.142 -      [Thm ("sym_add_assoc",num_str (@{thm add.assoc} RS @{thm sym})),
  34.143 -       Thm ("sym_rmult_assoc",num_str (@{thm rmult_assoc} RS @{thm sym}))],
  34.144 -      scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
  34.145 +      [Thm ("sym_add_assoc",TermC.num_str (@{thm add.assoc} RS @{thm sym})),
  34.146 +       Thm ("sym_rmult_assoc",TermC.num_str (@{thm rmult_assoc} RS @{thm sym}))],
  34.147 +      scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  34.148        }:rls;      
  34.149  
  34.150  val ac_plus_times =
  34.151    Rls{id = "ac_plus_times", preconds = [], rew_ord = ("term_order",term_order),
  34.152        erls = e_rls, srls = e_rls, calc = [], errpatts = [],
  34.153        rules = 
  34.154 -      [Thm ("radd_commute",num_str @{thm radd_commute}),
  34.155 -       Thm ("radd_left_commute",num_str @{thm radd_left_commute}),
  34.156 -       Thm ("add_assoc",num_str @{thm add.assoc}),
  34.157 -       Thm ("rmult_commute",num_str @{thm rmult_commute}),
  34.158 -       Thm ("rmult_left_commute",num_str @{thm rmult_left_commute}),
  34.159 -       Thm ("rmult_assoc",num_str @{thm rmult_assoc})],
  34.160 -      scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
  34.161 +      [Thm ("radd_commute",TermC.num_str @{thm radd_commute}),
  34.162 +       Thm ("radd_left_commute",TermC.num_str @{thm radd_left_commute}),
  34.163 +       Thm ("add_assoc",TermC.num_str @{thm add.assoc}),
  34.164 +       Thm ("rmult_commute",TermC.num_str @{thm rmult_commute}),
  34.165 +       Thm ("rmult_left_commute",TermC.num_str @{thm rmult_left_commute}),
  34.166 +       Thm ("rmult_assoc",TermC.num_str @{thm rmult_assoc})],
  34.167 +      scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  34.168        }:rls;      
  34.169  
  34.170 -(*todo: replace by Rewrite("rnorm_equation_add",num_str @{thm rnorm_equation_add)*)
  34.171 +(*todo: replace by Rewrite("rnorm_equation_add",TermC.num_str @{thm rnorm_equation_add)*)
  34.172  val norm_equation =
  34.173    Rls{id = "norm_equation", preconds = [], rew_ord = ("e_rew_ord",e_rew_ord),
  34.174        erls = tval_rls, srls = e_rls, calc = [], errpatts = [],
  34.175 -      rules = [Thm ("rnorm_equation_add",num_str @{thm rnorm_equation_add})
  34.176 +      rules = [Thm ("rnorm_equation_add",TermC.num_str @{thm rnorm_equation_add})
  34.177  	       ],
  34.178 -      scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
  34.179 +      scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  34.180        }:rls;      
  34.181  *}
  34.182  ML {*
  34.183 @@ -383,22 +383,22 @@
  34.184        erls = tval_rls, srls = e_rls, 
  34.185        calc=[(*since 040209 filled by prep_rls'*)], errpatts = [],
  34.186        rules = [
  34.187 -	       Thm ("real_diff_minus",num_str @{thm real_diff_minus}),
  34.188 -	       Thm ("radd_mult_distrib2",num_str @{thm radd_mult_distrib2}),
  34.189 -	       Thm ("rdistr_right_assoc",num_str @{thm rdistr_right_assoc}),
  34.190 -	       Thm ("rdistr_right_assoc_p",num_str @{thm rdistr_right_assoc_p}),
  34.191 -	       Thm ("rdistr_div_right",num_str @{thm rdistr_div_right}),
  34.192 -	       Thm ("rbinom_power_2",num_str @{thm rbinom_power_2}),	       
  34.193 +	       Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}),
  34.194 +	       Thm ("radd_mult_distrib2",TermC.num_str @{thm radd_mult_distrib2}),
  34.195 +	       Thm ("rdistr_right_assoc",TermC.num_str @{thm rdistr_right_assoc}),
  34.196 +	       Thm ("rdistr_right_assoc_p",TermC.num_str @{thm rdistr_right_assoc_p}),
  34.197 +	       Thm ("rdistr_div_right",TermC.num_str @{thm rdistr_div_right}),
  34.198 +	       Thm ("rbinom_power_2",TermC.num_str @{thm rbinom_power_2}),	       
  34.199  
  34.200 -               Thm ("radd_commute",num_str @{thm radd_commute}), 
  34.201 -	       Thm ("radd_left_commute",num_str @{thm radd_left_commute}),
  34.202 -	       Thm ("add_assoc",num_str @{thm add.assoc}),
  34.203 -	       Thm ("rmult_commute",num_str @{thm rmult_commute}),
  34.204 -	       Thm ("rmult_left_commute",num_str @{thm rmult_left_commute}),
  34.205 -	       Thm ("rmult_assoc",num_str @{thm rmult_assoc}),
  34.206 +               Thm ("radd_commute",TermC.num_str @{thm radd_commute}), 
  34.207 +	       Thm ("radd_left_commute",TermC.num_str @{thm radd_left_commute}),
  34.208 +	       Thm ("add_assoc",TermC.num_str @{thm add.assoc}),
  34.209 +	       Thm ("rmult_commute",TermC.num_str @{thm rmult_commute}),
  34.210 +	       Thm ("rmult_left_commute",TermC.num_str @{thm rmult_left_commute}),
  34.211 +	       Thm ("rmult_assoc",TermC.num_str @{thm rmult_assoc}),
  34.212  
  34.213 -	       Thm ("radd_real_const_eq",num_str @{thm radd_real_const_eq}),
  34.214 -	       Thm ("radd_real_const",num_str @{thm radd_real_const}),
  34.215 +	       Thm ("radd_real_const_eq",TermC.num_str @{thm radd_real_const_eq}),
  34.216 +	       Thm ("radd_real_const",TermC.num_str @{thm radd_real_const}),
  34.217  	       (* these 2 rules are invers to distr_div_right wrt. termination.
  34.218  		  thus they MUST be done IMMEDIATELY before calc *)
  34.219  	       Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  34.220 @@ -406,29 +406,29 @@
  34.221  	       Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),
  34.222  	       Calc ("Atools.pow", eval_binop "#power_"),
  34.223  
  34.224 -	       Thm ("rcollect_right",num_str @{thm rcollect_right}),
  34.225 -	       Thm ("rcollect_one_left",num_str @{thm rcollect_one_left}),
  34.226 -	       Thm ("rcollect_one_left_assoc",num_str @{thm rcollect_one_left_assoc}),
  34.227 -	       Thm ("rcollect_one_left_assoc_p",num_str @{thm rcollect_one_left_assoc_p}),
  34.228 +	       Thm ("rcollect_right",TermC.num_str @{thm rcollect_right}),
  34.229 +	       Thm ("rcollect_one_left",TermC.num_str @{thm rcollect_one_left}),
  34.230 +	       Thm ("rcollect_one_left_assoc",TermC.num_str @{thm rcollect_one_left_assoc}),
  34.231 +	       Thm ("rcollect_one_left_assoc_p",TermC.num_str @{thm rcollect_one_left_assoc_p}),
  34.232  
  34.233 -	       Thm ("rshift_nominator",num_str @{thm rshift_nominator}),
  34.234 -	       Thm ("rcancel_den",num_str @{thm rcancel_den}),
  34.235 -	       Thm ("rroot_square_inv",num_str @{thm rroot_square_inv}),
  34.236 -	       Thm ("rroot_times_root",num_str @{thm rroot_times_root}),
  34.237 -	       Thm ("rroot_times_root_assoc_p",num_str @{thm rroot_times_root_assoc_p}),
  34.238 -	       Thm ("rsqare",num_str @{thm rsqare}),
  34.239 -	       Thm ("power_1",num_str @{thm power_1}),
  34.240 -	       Thm ("rtwo_of_the_same",num_str @{thm rtwo_of_the_same}),
  34.241 -	       Thm ("rtwo_of_the_same_assoc_p",num_str @{thm rtwo_of_the_same_assoc_p}),
  34.242 +	       Thm ("rshift_nominator",TermC.num_str @{thm rshift_nominator}),
  34.243 +	       Thm ("rcancel_den",TermC.num_str @{thm rcancel_den}),
  34.244 +	       Thm ("rroot_square_inv",TermC.num_str @{thm rroot_square_inv}),
  34.245 +	       Thm ("rroot_times_root",TermC.num_str @{thm rroot_times_root}),
  34.246 +	       Thm ("rroot_times_root_assoc_p",TermC.num_str @{thm rroot_times_root_assoc_p}),
  34.247 +	       Thm ("rsqare",TermC.num_str @{thm rsqare}),
  34.248 +	       Thm ("power_1",TermC.num_str @{thm power_1}),
  34.249 +	       Thm ("rtwo_of_the_same",TermC.num_str @{thm rtwo_of_the_same}),
  34.250 +	       Thm ("rtwo_of_the_same_assoc_p",TermC.num_str @{thm rtwo_of_the_same_assoc_p}),
  34.251  
  34.252 -	       Thm ("rmult_1",num_str @{thm rmult_1}),
  34.253 -	       Thm ("rmult_1_right",num_str @{thm rmult_1_right}),
  34.254 -	       Thm ("rmult_0",num_str @{thm rmult_0}),
  34.255 -	       Thm ("rmult_0_right",num_str @{thm rmult_0_right}),
  34.256 -	       Thm ("radd_0",num_str @{thm radd_0}),
  34.257 -	       Thm ("radd_0_right",num_str @{thm radd_0_right})
  34.258 +	       Thm ("rmult_1",TermC.num_str @{thm rmult_1}),
  34.259 +	       Thm ("rmult_1_right",TermC.num_str @{thm rmult_1_right}),
  34.260 +	       Thm ("rmult_0",TermC.num_str @{thm rmult_0}),
  34.261 +	       Thm ("rmult_0_right",TermC.num_str @{thm rmult_0_right}),
  34.262 +	       Thm ("radd_0",TermC.num_str @{thm radd_0}),
  34.263 +	       Thm ("radd_0_right",TermC.num_str @{thm radd_0_right})
  34.264  	       ],
  34.265 -      scr = Prog ((Thm.term_of o the o (parse thy)) "empty_script")
  34.266 +      scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
  34.267  		    (*since 040209 filled by prep_rls': STest_simplify*)
  34.268        }:rls;      
  34.269  *}
  34.270 @@ -442,13 +442,13 @@
  34.271  val isolate_root =
  34.272    Rls{id = "isolate_root", preconds = [], rew_ord = ("e_rew_ord",e_rew_ord), 
  34.273        erls=tval_rls,srls = e_rls, calc=[], errpatts = [],
  34.274 -      rules = [Thm ("rroot_to_lhs",num_str @{thm rroot_to_lhs}),
  34.275 -	       Thm ("rroot_to_lhs_mult",num_str @{thm rroot_to_lhs_mult}),
  34.276 -	       Thm ("rroot_to_lhs_add_mult",num_str @{thm rroot_to_lhs_add_mult}),
  34.277 -	       Thm ("risolate_root_add",num_str @{thm risolate_root_add}),
  34.278 -	       Thm ("risolate_root_mult",num_str @{thm risolate_root_mult}),
  34.279 -	       Thm ("risolate_root_div",num_str @{thm risolate_root_div})       ],
  34.280 -      scr = Prog ((Thm.term_of o the o (parse thy)) 
  34.281 +      rules = [Thm ("rroot_to_lhs",TermC.num_str @{thm rroot_to_lhs}),
  34.282 +	       Thm ("rroot_to_lhs_mult",TermC.num_str @{thm rroot_to_lhs_mult}),
  34.283 +	       Thm ("rroot_to_lhs_add_mult",TermC.num_str @{thm rroot_to_lhs_add_mult}),
  34.284 +	       Thm ("risolate_root_add",TermC.num_str @{thm risolate_root_add}),
  34.285 +	       Thm ("risolate_root_mult",TermC.num_str @{thm risolate_root_mult}),
  34.286 +	       Thm ("risolate_root_div",TermC.num_str @{thm risolate_root_div})       ],
  34.287 +      scr = Prog ((Thm.term_of o the o (TermC.parse thy)) 
  34.288        "empty_script")
  34.289        }:rls;
  34.290  
  34.291 @@ -457,14 +457,14 @@
  34.292      Rls{id = "isolate_bdv", preconds = [], rew_ord = ("e_rew_ord",e_rew_ord),
  34.293  	erls=tval_rls,srls = e_rls, calc= [], errpatts = [],
  34.294  	rules = 
  34.295 -	[Thm ("risolate_bdv_add",num_str @{thm risolate_bdv_add}),
  34.296 -	 Thm ("risolate_bdv_mult_add",num_str @{thm risolate_bdv_mult_add}),
  34.297 -	 Thm ("risolate_bdv_mult",num_str @{thm risolate_bdv_mult}),
  34.298 -	 Thm ("mult_square",num_str @{thm mult_square}),
  34.299 -	 Thm ("constant_square",num_str @{thm constant_square}),
  34.300 -	 Thm ("constant_mult_square",num_str @{thm constant_mult_square})
  34.301 +	[Thm ("risolate_bdv_add",TermC.num_str @{thm risolate_bdv_add}),
  34.302 +	 Thm ("risolate_bdv_mult_add",TermC.num_str @{thm risolate_bdv_mult_add}),
  34.303 +	 Thm ("risolate_bdv_mult",TermC.num_str @{thm risolate_bdv_mult}),
  34.304 +	 Thm ("mult_square",TermC.num_str @{thm mult_square}),
  34.305 +	 Thm ("constant_square",TermC.num_str @{thm constant_square}),
  34.306 +	 Thm ("constant_mult_square",TermC.num_str @{thm constant_mult_square})
  34.307  	 ],
  34.308 -	scr = Prog ((Thm.term_of o the o (parse thy)) 
  34.309 +	scr = Prog ((Thm.term_of o the o (TermC.parse thy)) 
  34.310  			  "empty_script")
  34.311  	}:rls;      
  34.312  *}
  34.313 @@ -626,7 +626,7 @@
  34.314    | atom _                                 = false;
  34.315  
  34.316  fun varids (Const  (s,Type (_,[])))         = [strip_thy s]
  34.317 -  | varids (Free   (s,Type (_,[])))         = if is_no s then []
  34.318 +  | varids (Free   (s,Type (_,[])))         = if TermC.is_no s then []
  34.319  					      else [strip_thy s]
  34.320    | varids (Var((s,_),Type (_,[])))         = [strip_thy s]
  34.321  (*| varids (_      (s,"?DUMMY"   ))         =   ..ML-error *)
  34.322 @@ -1057,7 +1057,7 @@
  34.323    | dest_hd' (Abs (_, T, _)) = ((("", 0), T), 4);
  34.324  (* RL *)
  34.325  fun get_order_pow (t $ (Free(order,_))) = 
  34.326 -    	(case int_of_str (order) of
  34.327 +    	(case TermC.int_of_str (order) of
  34.328  	             SOME d => d
  34.329  		   | NONE   => 0)
  34.330    | get_order_pow _ = 0;
  34.331 @@ -1158,56 +1158,56 @@
  34.332  	      ("TIMES" , ("Groups.times_class.times", eval_binop "#mult_")),
  34.333  	      ("POWER", ("Atools.pow", eval_binop "#power_"))
  34.334  	      ], errpatts = [],
  34.335 -      rules = [Thm ("real_diff_minus",num_str @{thm real_diff_minus}),
  34.336 +      rules = [Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}),
  34.337  	       (*"a - b = a + (-1) * b"*)
  34.338 -	       Thm ("distrib_right" ,num_str @{thm distrib_right}),
  34.339 +	       Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),
  34.340  	       (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  34.341 -	       Thm ("distrib_left",num_str @{thm distrib_left}),
  34.342 +	       Thm ("distrib_left",TermC.num_str @{thm distrib_left}),
  34.343  	       (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  34.344 -	       Thm ("left_diff_distrib" ,num_str @{thm left_diff_distrib}),
  34.345 +	       Thm ("left_diff_distrib" ,TermC.num_str @{thm left_diff_distrib}),
  34.346  	       (*"(z1.0 - z2.0) * w = z1.0 * w - z2.0 * w"*)
  34.347 -	       Thm ("right_diff_distrib",num_str @{thm right_diff_distrib}),
  34.348 +	       Thm ("right_diff_distrib",TermC.num_str @{thm right_diff_distrib}),
  34.349  	       (*"w * (z1.0 - z2.0) = w * z1.0 - w * z2.0"*)
  34.350 -	       Thm ("mult_1_left",num_str @{thm mult_1_left}),                 
  34.351 +	       Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),                 
  34.352  	       (*"1 * z = z"*)
  34.353 -	       Thm ("mult_zero_left",num_str @{thm mult_zero_left}),        
  34.354 +	       Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),        
  34.355  	       (*"0 * z = 0"*)
  34.356 -	       Thm ("add_0_left",num_str @{thm add_0_left}),
  34.357 +	       Thm ("add_0_left",TermC.num_str @{thm add_0_left}),
  34.358  	       (*"0 + z = z"*)
  34.359  
  34.360  	       (*AC-rewriting*)
  34.361 -	       Thm ("mult_commute",num_str @{thm mult.commute}),
  34.362 +	       Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
  34.363  	       (* z * w = w * z *)
  34.364 -	       Thm ("real_mult_left_commute",num_str @{thm real_mult_left_commute}),
  34.365 +	       Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
  34.366  	       (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*)
  34.367 -	       Thm ("mult_assoc",num_str @{thm mult.assoc}),		
  34.368 +	       Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),		
  34.369  	       (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*)
  34.370 -	       Thm ("add_commute",num_str @{thm add.commute}),	
  34.371 +	       Thm ("add_commute",TermC.num_str @{thm add.commute}),	
  34.372  	       (*z + w = w + z*)
  34.373 -	       Thm ("add_left_commute",num_str @{thm add.left_commute}),
  34.374 +	       Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}),
  34.375  	       (*x + (y + z) = y + (x + z)*)
  34.376 -	       Thm ("add_assoc",num_str @{thm add.assoc}),	               
  34.377 +	       Thm ("add_assoc",TermC.num_str @{thm add.assoc}),	               
  34.378  	       (*z1.0 + z2.0 + z3.0 = z1.0 + (z2.0 + z3.0)*)
  34.379  
  34.380  	       Thm ("sym_realpow_twoI",
  34.381 -                     num_str (@{thm realpow_twoI} RS @{thm sym})),	
  34.382 +                     TermC.num_str (@{thm realpow_twoI} RS @{thm sym})),	
  34.383  	       (*"r1 * r1 = r1 ^^^ 2"*)
  34.384 -	       Thm ("realpow_plus_1",num_str @{thm realpow_plus_1}),		
  34.385 +	       Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),		
  34.386  	       (*"r * r ^^^ n = r ^^^ (n + 1)"*)
  34.387  	       Thm ("sym_real_mult_2",
  34.388 -                     num_str (@{thm real_mult_2} RS @{thm sym})),	
  34.389 +                     TermC.num_str (@{thm real_mult_2} RS @{thm sym})),	
  34.390  	       (*"z1 + z1 = 2 * z1"*)
  34.391 -	       Thm ("real_mult_2_assoc",num_str @{thm real_mult_2_assoc}),	
  34.392 +	       Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),	
  34.393  	       (*"z1 + (z1 + k) = 2 * z1 + k"*)
  34.394  
  34.395 -	       Thm ("real_num_collect",num_str @{thm real_num_collect}), 
  34.396 +	       Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  34.397  	       (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
  34.398 -	       Thm ("real_num_collect_assoc",num_str @{thm real_num_collect_assoc}),
  34.399 +	       Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),
  34.400  	       (*"[| l is_const; m is_const |] ==>  
  34.401  				l * n + (m * n + k) =  (l + m) * n + k"*)
  34.402 -	       Thm ("real_one_collect",num_str @{thm real_one_collect}),	
  34.403 +	       Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),	
  34.404  	       (*"m is_const ==> n + m * n = (1 + m) * n"*)
  34.405 -	       Thm ("real_one_collect_assoc",num_str @{thm real_one_collect_assoc}), 
  34.406 +	       Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), 
  34.407  	       (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  34.408  
  34.409  	       Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  34.410 @@ -1264,83 +1264,83 @@
  34.411  	      ("POWER", ("Atools.pow", eval_binop "#power_"))
  34.412  	      ], errpatts = [],
  34.413        rules = 
  34.414 -      [Thm ("real_plus_binom_pow2"  ,num_str @{thm real_plus_binom_pow2}),     
  34.415 +      [Thm ("real_plus_binom_pow2"  ,TermC.num_str @{thm real_plus_binom_pow2}),     
  34.416  	       (*"(a + b) ^^^ 2 = a ^^^ 2 + 2 * a * b + b ^^^ 2"*)
  34.417 -       Thm ("real_plus_binom_times" ,num_str @{thm real_plus_binom_times}),    
  34.418 +       Thm ("real_plus_binom_times" ,TermC.num_str @{thm real_plus_binom_times}),    
  34.419  	      (*"(a + b)*(a + b) = ...*)
  34.420 -       Thm ("real_minus_binom_pow2" ,num_str @{thm real_minus_binom_pow2}),   
  34.421 +       Thm ("real_minus_binom_pow2" ,TermC.num_str @{thm real_minus_binom_pow2}),   
  34.422         (*"(a - b) ^^^ 2 = a ^^^ 2 - 2 * a * b + b ^^^ 2"*)
  34.423 -       Thm ("real_minus_binom_times",num_str @{thm real_minus_binom_times}),   
  34.424 +       Thm ("real_minus_binom_times",TermC.num_str @{thm real_minus_binom_times}),   
  34.425         (*"(a - b)*(a - b) = ...*)
  34.426 -       Thm ("real_plus_minus_binom1",num_str @{thm real_plus_minus_binom1}),   
  34.427 +       Thm ("real_plus_minus_binom1",TermC.num_str @{thm real_plus_minus_binom1}),   
  34.428          (*"(a + b) * (a - b) = a ^^^ 2 - b ^^^ 2"*)
  34.429 -       Thm ("real_plus_minus_binom2",num_str @{thm real_plus_minus_binom2}),   
  34.430 +       Thm ("real_plus_minus_binom2",TermC.num_str @{thm real_plus_minus_binom2}),   
  34.431          (*"(a - b) * (a + b) = a ^^^ 2 - b ^^^ 2"*)
  34.432         (*RL 020915*)
  34.433 -       Thm ("real_pp_binom_times",num_str @{thm real_pp_binom_times}), 
  34.434 +       Thm ("real_pp_binom_times",TermC.num_str @{thm real_pp_binom_times}), 
  34.435          (*(a + b)*(c + d) = a*c + a*d + b*c + b*d*)
  34.436 -       Thm ("real_pm_binom_times",num_str @{thm real_pm_binom_times}), 
  34.437 +       Thm ("real_pm_binom_times",TermC.num_str @{thm real_pm_binom_times}), 
  34.438          (*(a + b)*(c - d) = a*c - a*d + b*c - b*d*)
  34.439 -       Thm ("real_mp_binom_times",num_str @{thm real_mp_binom_times}), 
  34.440 +       Thm ("real_mp_binom_times",TermC.num_str @{thm real_mp_binom_times}), 
  34.441          (*(a - b)*(c p d) = a*c + a*d - b*c - b*d*)
  34.442 -       Thm ("real_mm_binom_times",num_str @{thm real_mm_binom_times}), 
  34.443 +       Thm ("real_mm_binom_times",TermC.num_str @{thm real_mm_binom_times}), 
  34.444          (*(a - b)*(c p d) = a*c - a*d - b*c + b*d*)
  34.445 -       Thm ("realpow_multI",num_str @{thm realpow_multI}),                
  34.446 +       Thm ("realpow_multI",TermC.num_str @{thm realpow_multI}),                
  34.447          (*(a*b)^^^n = a^^^n * b^^^n*)
  34.448 -       Thm ("real_plus_binom_pow3",num_str @{thm real_plus_binom_pow3}),
  34.449 +       Thm ("real_plus_binom_pow3",TermC.num_str @{thm real_plus_binom_pow3}),
  34.450          (* (a + b)^^^3 = a^^^3 + 3*a^^^2*b + 3*a*b^^^2 + b^^^3 *)
  34.451 -       Thm ("real_minus_binom_pow3",num_str @{thm real_minus_binom_pow3}),
  34.452 +       Thm ("real_minus_binom_pow3",TermC.num_str @{thm real_minus_binom_pow3}),
  34.453          (* (a - b)^^^3 = a^^^3 - 3*a^^^2*b + 3*a*b^^^2 - b^^^3 *)
  34.454  
  34.455  
  34.456 -     (*  Thm ("distrib_right" ,num_str @{thm distrib_right}),	
  34.457 +     (*  Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),	
  34.458  	 (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  34.459 -	Thm ("distrib_left",num_str @{thm distrib_left}),	
  34.460 +	Thm ("distrib_left",TermC.num_str @{thm distrib_left}),	
  34.461  	(*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  34.462 -	Thm ("left_diff_distrib" ,num_str @{thm left_diff_distrib}),	
  34.463 +	Thm ("left_diff_distrib" ,TermC.num_str @{thm left_diff_distrib}),	
  34.464  	(*"(z1.0 - z2.0) * w = z1.0 * w - z2.0 * w"*)
  34.465 -	Thm ("right_diff_distrib",num_str @{thm right_diff_distrib}),	
  34.466 +	Thm ("right_diff_distrib",TermC.num_str @{thm right_diff_distrib}),	
  34.467  	(*"w * (z1.0 - z2.0) = w * z1.0 - w * z2.0"*)
  34.468  	*)
  34.469  	
  34.470 -	Thm ("mult_1_left",num_str @{thm mult_1_left}),              
  34.471 +	Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),              
  34.472           (*"1 * z = z"*)
  34.473 -	Thm ("mult_zero_left",num_str @{thm mult_zero_left}),              
  34.474 +	Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),              
  34.475           (*"0 * z = 0"*)
  34.476 -	Thm ("add_0_left",num_str @{thm add_0_left}),
  34.477 +	Thm ("add_0_left",TermC.num_str @{thm add_0_left}),
  34.478           (*"0 + z = z"*)
  34.479  
  34.480  	Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
  34.481  	Calc ("Groups.times_class.times", eval_binop "#mult_"),
  34.482  	Calc ("Atools.pow", eval_binop "#power_"),
  34.483          (*	       
  34.484 -	 Thm ("mult_commute",num_str @{thm mult_commute}),		
  34.485 +	 Thm ("mult_commute",TermC.num_str @{thm mult_commute}),		
  34.486          (*AC-rewriting*)
  34.487 -	Thm ("real_mult_left_commute",num_str @{thm real_mult_left_commute}),
  34.488 -	Thm ("mult_assoc",num_str @{thm mult.assoc}),
  34.489 -	Thm ("add_commute",num_str @{thm add_commute}),	
  34.490 -	Thm ("add_left_commute",num_str @{thm add_left_commute}),
  34.491 -	Thm ("add_assoc",num_str @{thm add_assoc}),
  34.492 +	Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
  34.493 +	Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),
  34.494 +	Thm ("add_commute",TermC.num_str @{thm add_commute}),	
  34.495 +	Thm ("add_left_commute",TermC.num_str @{thm add_left_commute}),
  34.496 +	Thm ("add_assoc",TermC.num_str @{thm add_assoc}),
  34.497  	*)
  34.498  	
  34.499  	Thm ("sym_realpow_twoI",
  34.500 -              num_str (@{thm realpow_twoI} RS @{thm sym})),
  34.501 +              TermC.num_str (@{thm realpow_twoI} RS @{thm sym})),
  34.502  	(*"r1 * r1 = r1 ^^^ 2"*)
  34.503 -	Thm ("realpow_plus_1",num_str @{thm realpow_plus_1}),			
  34.504 +	Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),			
  34.505  	(*"r * r ^^^ n = r ^^^ (n + 1)"*)
  34.506  	(*Thm ("sym_real_mult_2",
  34.507 -                num_str (@{thm real_mult_2} RS @{thm sym})),
  34.508 +                TermC.num_str (@{thm real_mult_2} RS @{thm sym})),
  34.509  	(*"z1 + z1 = 2 * z1"*)*)
  34.510 -	Thm ("real_mult_2_assoc",num_str @{thm real_mult_2_assoc}),		
  34.511 +	Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),		
  34.512  	(*"z1 + (z1 + k) = 2 * z1 + k"*)
  34.513  
  34.514 -	Thm ("real_num_collect",num_str @{thm real_num_collect}), 
  34.515 +	Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  34.516  	(*"[| l is_const; m is_const |] ==> l * n + m * n = (l + m) * n"*)
  34.517 -	Thm ("real_num_collect_assoc",num_str @{thm real_num_collect_assoc}),	
  34.518 +	Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),	
  34.519  	(*"[| l is_const; m is_const |] ==>  l * n + (m * n + k) =  (l + m) * n + k"*)
  34.520 -	Thm ("real_one_collect",num_str @{thm real_one_collect}),		
  34.521 +	Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),		
  34.522  	(*"m is_const ==> n + m * n = (1 + m) * n"*)
  34.523 -	Thm ("real_one_collect_assoc",num_str @{thm real_one_collect_assoc}), 
  34.524 +	Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), 
  34.525  	(*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  34.526  
  34.527  	Calc ("Groups.plus_class.plus", eval_binop "#add_"), 
    35.1 --- a/src/Tools/isac/ProgLang/ListC.thy	Sun Feb 25 16:31:17 2018 +0100
    35.2 +++ b/src/Tools/isac/ProgLang/ListC.thy	Fri Mar 02 14:19:59 2018 +0100
    35.3 @@ -12,6 +12,11 @@
    35.4  ML_file "~~/src/Tools/isac/ProgLang/rewrite.sml"
    35.5  ML {*
    35.6  *} ML {*
    35.7 +TermC.list_implies                                                                  
    35.8 +*} ML {*
    35.9 +*} ML {*
   35.10 +*} ML {*
   35.11 +*} ML {*
   35.12  *} 
   35.13  
   35.14  subsection {* Notes on Isac's programming language *}
   35.15 @@ -135,49 +140,49 @@
   35.16  val list_rls = 
   35.17    Rls{id = "list_rls", preconds = [], rew_ord = ("dummy_ord", dummy_ord), 
   35.18      erls = Erls, srls = Erls, calc = [], errpatts = [],
   35.19 -    rules = [Thm ("refl", num_str @{thm refl}),  (*'a<>b -> FALSE' by fun eval_equal*)
   35.20 -       Thm ("o_apply", num_str @{thm o_apply}),
   35.21 +    rules = [Thm ("refl", TermC.num_str @{thm refl}),  (*'a<>b -> FALSE' by fun eval_equal*)
   35.22 +       Thm ("o_apply", TermC.num_str @{thm o_apply}),
   35.23  
   35.24 -       Thm ("NTH_CONS",num_str @{thm NTH_CONS}),(*erls for cond. in Atools.ML*)
   35.25 -       Thm ("NTH_NIL",num_str @{thm NTH_NIL}),
   35.26 -       Thm ("append_Cons",num_str @{thm append_Cons}),
   35.27 -       Thm ("append_Nil",num_str @{thm append_Nil}),
   35.28 +       Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),(*erls for cond. in Atools.ML*)
   35.29 +       Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}),
   35.30 +       Thm ("append_Cons",TermC.num_str @{thm append_Cons}),
   35.31 +       Thm ("append_Nil",TermC.num_str @{thm append_Nil}),
   35.32  (*       Thm ("butlast_Cons",num_str @{thm butlast_Cons}),
   35.33         Thm ("butlast_Nil",num_str @{thm butlast_Nil}),*)
   35.34 -       Thm ("concat_Cons",num_str @{thm concat_Cons}),
   35.35 -       Thm ("concat_Nil",num_str @{thm concat_Nil}),
   35.36 +       Thm ("concat_Cons",TermC.num_str @{thm concat_Cons}),
   35.37 +       Thm ("concat_Nil",TermC.num_str @{thm concat_Nil}),
   35.38  (*       Thm ("del_base",num_str @{thm del_base}),
   35.39         Thm ("del_rec",num_str @{thm del_rec}), *)
   35.40  
   35.41 -       Thm ("distinct_Cons",num_str @{thm distinct_Cons}),
   35.42 -       Thm ("distinct_Nil",num_str @{thm distinct_Nil}),
   35.43 -       Thm ("dropWhile_Cons",num_str @{thm dropWhile_Cons}),
   35.44 -       Thm ("dropWhile_Nil",num_str @{thm dropWhile_Nil}),
   35.45 -       Thm ("filter_Cons",num_str @{thm filter_Cons}),
   35.46 -       Thm ("filter_Nil",num_str @{thm filter_Nil}),
   35.47 -       Thm ("foldr_Cons",num_str @{thm foldr_Cons}),
   35.48 -       Thm ("foldr_Nil",num_str @{thm foldr_Nil}),
   35.49 -       Thm ("hd_thm",num_str @{thm hd_thm}),
   35.50 -       Thm ("LAST",num_str @{thm LAST}),
   35.51 -       Thm ("LENGTH_CONS",num_str @{thm LENGTH_CONS}),
   35.52 -       Thm ("LENGTH_NIL",num_str @{thm LENGTH_NIL}),
   35.53 +       Thm ("distinct_Cons",TermC.num_str @{thm distinct_Cons}),
   35.54 +       Thm ("distinct_Nil",TermC.num_str @{thm distinct_Nil}),
   35.55 +       Thm ("dropWhile_Cons",TermC.num_str @{thm dropWhile_Cons}),
   35.56 +       Thm ("dropWhile_Nil",TermC.num_str @{thm dropWhile_Nil}),
   35.57 +       Thm ("filter_Cons",TermC.num_str @{thm filter_Cons}),
   35.58 +       Thm ("filter_Nil",TermC.num_str @{thm filter_Nil}),
   35.59 +       Thm ("foldr_Cons",TermC.num_str @{thm foldr_Cons}),
   35.60 +       Thm ("foldr_Nil",TermC.num_str @{thm foldr_Nil}),
   35.61 +       Thm ("hd_thm",TermC.num_str @{thm hd_thm}),
   35.62 +       Thm ("LAST",TermC.num_str @{thm LAST}),
   35.63 +       Thm ("LENGTH_CONS",TermC.num_str @{thm LENGTH_CONS}),
   35.64 +       Thm ("LENGTH_NIL",TermC.num_str @{thm LENGTH_NIL}),
   35.65  (*       Thm ("list_diff_def",num_str @{thm list_diff_def}),*)
   35.66 -       Thm ("map_Cons",num_str @{thm map_Cons}),
   35.67 -       Thm ("map_Nil",num_str @{thm map_Cons}),
   35.68 -(*       Thm ("mem_Cons",num_str @{thm mem_Cons}),
   35.69 -       Thm ("mem_Nil",num_str @{thm mem_Nil}), *)
   35.70 -(*       Thm ("null_Cons",num_str @{thm null_Cons}),
   35.71 -       Thm ("null_Nil",num_str @{thm null_Nil}),*)
   35.72 -       Thm ("remdups_Cons",num_str @{thm remdups_Cons}),
   35.73 -       Thm ("remdups_Nil",num_str @{thm remdups_Nil}),
   35.74 -       Thm ("rev_Cons",num_str @{thm rev_Cons}),
   35.75 -       Thm ("rev_Nil",num_str @{thm rev_Nil}),
   35.76 -       Thm ("take_Nil",num_str @{thm take_Nil}),
   35.77 -       Thm ("take_Cons",num_str @{thm take_Cons}),
   35.78 -       Thm ("tl_Cons",num_str @{thm tl_Cons}),
   35.79 -       Thm ("tl_Nil",num_str @{thm tl_Nil}),
   35.80 -       Thm ("zip_Cons",num_str @{thm zip_Cons}),
   35.81 -       Thm ("zip_Nil",num_str @{thm zip_Nil})],
   35.82 +       Thm ("map_Cons",TermC.num_str @{thm map_Cons}),
   35.83 +       Thm ("map_Nil",TermC.num_str @{thm map_Cons}),
   35.84 +(*       Thm ("mem_Cons",TermC.num_str @{thm mem_Cons}),
   35.85 +       Thm ("mem_Nil",TermC.num_str @{thm mem_Nil}), *)
   35.86 +(*       Thm ("null_Cons",TermC.num_str @{thm null_Cons}),
   35.87 +       Thm ("null_Nil",TermC.num_str @{thm null_Nil}),*)
   35.88 +       Thm ("remdups_Cons",TermC.num_str @{thm remdups_Cons}),
   35.89 +       Thm ("remdups_Nil",TermC.num_str @{thm remdups_Nil}),
   35.90 +       Thm ("rev_Cons",TermC.num_str @{thm rev_Cons}),
   35.91 +       Thm ("rev_Nil",TermC.num_str @{thm rev_Nil}),
   35.92 +       Thm ("take_Nil",TermC.num_str @{thm take_Nil}),
   35.93 +       Thm ("take_Cons",TermC.num_str @{thm take_Cons}),
   35.94 +       Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}),
   35.95 +       Thm ("tl_Nil",TermC.num_str @{thm tl_Nil}),
   35.96 +       Thm ("zip_Cons",TermC.num_str @{thm zip_Cons}),
   35.97 +       Thm ("zip_Nil",TermC.num_str @{thm zip_Nil})],
   35.98      scr = EmptyScr}:rls;
   35.99  *}
  35.100  setup {* KEStore_Elems.add_rlss [("list_rls", (Context.theory_name @{theory}, list_rls))] *}
    36.1 --- a/src/Tools/isac/ProgLang/Tools.thy	Sun Feb 25 16:31:17 2018 +0100
    36.2 +++ b/src/Tools/isac/ProgLang/Tools.thy	Fri Mar 02 14:19:59 2018 +0100
    36.3 @@ -51,21 +51,21 @@
    36.4  ML {* (*the former Tools.ML*)
    36.5  (* auxiliary functions for scripts  WN.9.00*)
    36.6  (*11.02: for equation solving only*)
    36.7 -val UniversalList = (Thm.term_of o the o (parse @{theory})) "UniversalList";
    36.8 -val EmptyList = (Thm.term_of o the o (parse @{theory}))  "[]::bool list";     
    36.9 +val UniversalList = (Thm.term_of o the o (TermC.parse @{theory})) "UniversalList";
   36.10 +val EmptyList = (Thm.term_of o the o (TermC.parse @{theory}))  "[]::bool list";     
   36.11  
   36.12  (*+ for Or_to_List +*)
   36.13  fun or2list (Const ("HOL.True",_)) = (tracing"### or2list True";UniversalList)
   36.14    | or2list (Const ("HOL.False",_)) = (tracing"### or2list False";EmptyList)
   36.15    | or2list (t as Const ("HOL.eq",_) $ _ $ _) = 
   36.16 -    (tracing"### or2list _ = _";list2isalist bool [t])
   36.17 +    (tracing"### or2list _ = _"; TermC.list2isalist TermC.bool [t])
   36.18    | or2list ors =
   36.19      (tracing"### or2list _ | _";
   36.20      let fun get ls (Const ("HOL.disj",_) $ o1 $ o2) =
   36.21  	    case o2 of
   36.22  		Const ("HOL.disj",_) $ _ $ _ => get (ls @ [o1]) o2
   36.23  	      | _ => ls @ [o1, o2] 
   36.24 -    in (((list2isalist bool) o (get [])) ors)
   36.25 +    in (((TermC.list2isalist TermC.bool) o (get [])) ors)
   36.26         handle _ => error ("or2list: no ORs= "^(term2str ors)) end
   36.27  	);
   36.28  (*>val t = @{term True};
   36.29 @@ -92,14 +92,14 @@
   36.30  (*("matches",("Tools.matches",eval_matches "#matches_")):calc*)
   36.31  fun eval_matches (thmid:string) "Tools.matches"
   36.32  		  (t as Const ("Tools.matches",_) $ pat $ tst) thy = 
   36.33 -    if matches thy tst pat
   36.34 +    if TermC.matches thy tst pat
   36.35      then 
   36.36        let
   36.37 -        val prop = Trueprop $ (mk_equality (t, @{term True}))
   36.38 +        val prop = TermC.Trueprop $ (TermC.mk_equality (t, @{term True}))
   36.39  	    in SOME (term_to_string''' thy prop, prop) end
   36.40      else 
   36.41        let 
   36.42 -        val prop = Trueprop $ (mk_equality (t, @{term False}))
   36.43 +        val prop = TermC.Trueprop $ (TermC.mk_equality (t, @{term False}))
   36.44  	    in SOME (term_to_string''' thy prop, prop) end
   36.45    | eval_matches _ _ _ _ = NONE; 
   36.46  (*
   36.47 @@ -158,14 +158,14 @@
   36.48  (*.does a pattern match some subterm ?.*)
   36.49  fun matchsub thy t pat =  
   36.50    let
   36.51 -    fun matchs (t as Const _) = matches thy t pat
   36.52 -	      | matchs (t as Free _) = matches thy t pat
   36.53 -	      | matchs (t as Var _) = matches thy t pat
   36.54 +    fun matchs (t as Const _) = TermC.matches thy t pat
   36.55 +	      | matchs (t as Free _) = TermC.matches thy t pat
   36.56 +	      | matchs (t as Var _) = TermC.matches thy t pat
   36.57  	      | matchs (Bound _) = false
   36.58  	      | matchs (t as Abs (_, _, body)) = 
   36.59 -	          if matches thy t pat then true else matches thy body pat
   36.60 +	          if TermC.matches thy t pat then true else TermC.matches thy body pat
   36.61  	      | matchs (t as f1 $ f2) =
   36.62 -	          if matches thy t pat then true 
   36.63 +	          if TermC.matches thy t pat then true 
   36.64  	            else if matchs f1 then true else matchs f2
   36.65    in matchs t end;
   36.66  
   36.67 @@ -174,10 +174,10 @@
   36.68  		  (t as Const ("Tools.matchsub",_) $ pat $ tst) thy = 
   36.69      if matchsub thy tst pat
   36.70      then 
   36.71 -      let val prop = Trueprop $ (mk_equality (t, @{term True}))
   36.72 +      let val prop = TermC.Trueprop $ (TermC.mk_equality (t, @{term True}))
   36.73        in SOME (term_to_string''' thy prop, prop) end
   36.74      else 
   36.75 -      let val prop = Trueprop $ (mk_equality (t, @{term False}))
   36.76 +      let val prop = TermC.Trueprop $ (TermC.mk_equality (t, @{term False}))
   36.77        in SOME (term_to_string''' thy prop, prop) end
   36.78    | eval_matchsub _ _ _ _ = NONE; 
   36.79  
   36.80 @@ -185,9 +185,9 @@
   36.81  (*("Vars"    ,("Tools.Vars"    ,eval_var "#Vars_")):calc*)
   36.82  fun eval_var (thmid:string) "Tools.Vars" (t as (Const(op0,t0) $ arg)) thy = 
   36.83      let 
   36.84 -      val t' = ((list2isalist HOLogic.realT) o vars) t;
   36.85 +      val t' = ((TermC.list2isalist HOLogic.realT) o TermC.vars) t;
   36.86        val thmId = thmid ^ term_to_string''' thy arg;
   36.87 -    in SOME (thmId, Trueprop $ (mk_equality (t, t'))) end
   36.88 +    in SOME (thmId, TermC.Trueprop $ (TermC.mk_equality (t, t'))) end
   36.89    | eval_var _ _ _ _ = NONE;
   36.90  
   36.91  fun lhs (Const ("HOL.eq",_) $ l $ _) = l
   36.92 @@ -196,7 +196,7 @@
   36.93  fun eval_lhs _ "Tools.lhs"
   36.94  	     (t as (Const ("Tools.lhs",_) $ (Const ("HOL.eq",_) $ l $ _))) _ = 
   36.95      SOME ((term2str t) ^ " = " ^ (term2str l),
   36.96 -	  Trueprop $ (mk_equality (t, l)))
   36.97 +	  TermC.Trueprop $ (TermC.mk_equality (t, l)))
   36.98    | eval_lhs _ _ _ _ = NONE;
   36.99  (*
  36.100  > val t = (Thm.term_of o the o (parse thy)) "lhs (1 * x ^^^ 2 = 0)";
  36.101 @@ -212,7 +212,7 @@
  36.102  fun eval_rhs _ "Tools.rhs"
  36.103  	     (t as (Const ("Tools.rhs",_) $ (Const ("HOL.eq",_) $ _ $ r))) _ = 
  36.104      SOME ((term2str t) ^ " = " ^ (term2str r),
  36.105 -	  Trueprop $ (mk_equality (t, r)))
  36.106 +	  TermC.Trueprop $ (TermC.mk_equality (t, r)))
  36.107    | eval_rhs _ _ _ _ = NONE;
  36.108  
  36.109  
    37.1 --- a/src/Tools/isac/ProgLang/calculate.sml	Sun Feb 25 16:31:17 2018 +0100
    37.2 +++ b/src/Tools/isac/ProgLang/calculate.sml	Fri Mar 02 14:19:59 2018 +0100
    37.3 @@ -110,8 +110,8 @@
    37.4  
    37.5  (** for ordered and conditional rewriting **)
    37.6  
    37.7 -fun mk_rule (prems,l,r) = 
    37.8 -    Trueprop $ (list_implies (prems, mk_equality (l,r)));
    37.9 +fun mk_rule (prems, l, r) = 
   37.10 +    TermC.Trueprop $ (TermC.list_implies (prems, TermC.mk_equality (l, r)));
   37.11  
   37.12  (* 'norms' a rule, e.g.
   37.13  (*1*) from a = 1 ==> a*(b+c) = b+c 
   37.14 @@ -122,10 +122,10 @@
   37.15        to   [| k < l; m + l = k + n |] ==> m < n = True !! *)
   37.16  fun norm rule =
   37.17    let
   37.18 -    val (prems,concl)=(map strip_trueprop(Logic.strip_imp_prems rule),
   37.19 -		       (strip_trueprop o  Logic.strip_imp_concl)rule)
   37.20 -  in if is_equality concl then 
   37.21 -      let val (l,r) = dest_equals' concl
   37.22 +    val (prems,concl)=(map TermC.strip_trueprop(Logic.strip_imp_prems rule),
   37.23 +		       (TermC.strip_trueprop o  Logic.strip_imp_concl)rule)
   37.24 +  in if TermC.is_equality concl then 
   37.25 +      let val (l,r) = TermC.dest_equals' concl
   37.26        in if l = r then 
   37.27  	 (*2*) mk_rule(prems,concl,@{term True})
   37.28  	 else (*1*) rule end
    38.1 --- a/src/Tools/isac/ProgLang/rewrite.sml	Sun Feb 25 16:31:17 2018 +0100
    38.2 +++ b/src/Tools/isac/ProgLang/rewrite.sml	Fri Mar 02 14:19:59 2018 +0100
    38.3 @@ -43,7 +43,7 @@
    38.4  fun rewrite__ thy i bdv tless rls put_asm thm ct =
    38.5    let
    38.6      val(t', asms, _ (*lrd*), rew) = rew_sub thy i bdv tless rls put_asm [(*root of the term*)]
    38.7 -		  (((inst_bdv bdv) o Calc.norm o #prop o Thm.rep_thm) thm) ct
    38.8 +		  (((TermC.inst_bdv bdv) o Calc.norm o #prop o Thm.rep_thm) thm) ct
    38.9    in if rew then SOME (t', distinct asms) else NONE end
   38.10    (* one rewrite (possibly conditional, ordered) EXOR exn EXOR go into subterms *)
   38.11  and rew_sub thy i bdv tless rls put_asm lrd r t = 
   38.12 @@ -74,7 +74,7 @@
   38.13            raise STOP_REW_SUB (* don't go into subterms of cond *))
   38.14  	    end
   38.15      in
   38.16 -      if perm lhs rhs andalso not (tless bdv (t', t))                        (*ordered rewriting*)
   38.17 +      if TermC.perm lhs rhs andalso not (tless bdv (t', t))                        (*ordered rewriting*)
   38.18        then (if ! trace_rewrite andalso i < ! depth 
   38.19    	    then tracing (idt"#"i ^ " not: \"" ^ t2str thy t ^ "\" > \"" ^ t2str thy t' ^ "\"")
   38.20    	    else (); 
   38.21 @@ -141,7 +141,7 @@
   38.22                  rew_once ruls (union (op =) asm asm') ct' Appl (rul::thms)))
   38.23            | Calc (cc as (op_, _)) => 
   38.24              let val _= trace1 i (" try calc: " ^ op_ ^ "'")
   38.25 -              val ct = uminus_to_string ct
   38.26 +              val ct = TermC.uminus_to_string ct
   38.27              in case Calc.adhoc_thm thy cc ct of
   38.28                  NONE => rew_once ruls asm ct apno thms
   38.29                | SOME (_, thm') => 
   38.30 @@ -155,7 +155,7 @@
   38.31              end
   38.32            | Cal1 (cc as (op_, _)) => 
   38.33              let val _= trace1 i (" try cal1: " ^ op_ ^ "'");
   38.34 -              val ct = uminus_to_string ct
   38.35 +              val ct = TermC.uminus_to_string ct
   38.36              in case Calc.adhoc_thm1_ thy cc ct of
   38.37                  NONE => (ct, asm)
   38.38                | SOME (_, thm') =>
   38.39 @@ -242,7 +242,7 @@
   38.40  	  fun rew_ (t', asm') [] _ = (t', asm')
   38.41  	    | rew_ (t', asm') (rules as r::rs) t =
   38.42  	        let
   38.43 -	          val (t'', asm'', _(*lrd*), rew) = rew_sub thy 1 [] ord erls false [] (Trueprop $ r) t
   38.44 +	          val (t'', asm'', _(*lrd*), rew) = rew_sub thy 1 [] ord erls false [] (TermC.Trueprop $ r) t
   38.45  	        in 
   38.46  	          if rew 
   38.47  	          then rew_ (t'', asm' @ asm'') rules t''
   38.48 @@ -254,7 +254,7 @@
   38.49  
   38.50  (* search ct for adjacent numerals and calculate them by operator isa_fn *)
   38.51  fun calculate_ thy isa_fn ct =
   38.52 -  let val ct = uminus_to_string ct
   38.53 +  let val ct = TermC.uminus_to_string ct
   38.54      in case Calc.adhoc_thm thy isa_fn ct of
   38.55  	   NONE => NONE
   38.56  	 | SOME (thmID, thm) =>
   38.57 @@ -268,10 +268,10 @@
   38.58  (* Thm.make_thm added to Pure/thm.ML *)
   38.59  fun mk_thm thy str = 
   38.60    let
   38.61 -    val t = (Thm.term_of o the o (parse thy)) str
   38.62 +    val t = (Thm.term_of o the o (TermC.parse thy)) str
   38.63      val t' = case t of
   38.64          Const ("Pure.imp", _) $ _ $ _ => t
   38.65 -      | _ => Trueprop $ t
   38.66 +      | _ => TermC.Trueprop $ t
   38.67    in Thm.make_thm (Thm.global_cterm_of thy t') end;
   38.68  
   38.69  (* "metaview" as seen from programs and from user input (both are parsed like terms presently) *)
   38.70 @@ -294,19 +294,19 @@
   38.71  fun assoc_thm'' thy thmid =
   38.72    case Symbol.explode thmid of
   38.73      "s"::"y"::"m"::"_"::"#"::_ => error ("assoc_thm'' not impl.for " ^ thmid)
   38.74 -  | "s"::"y"::"m"::"_"::id => ((num_str o (Global_Theory.get_thm thy)) (implode id)) RS sym
   38.75 +  | "s"::"y"::"m"::"_"::id => ((TermC.num_str o (Global_Theory.get_thm thy)) (implode id)) RS sym
   38.76    | "#"::_ => error ("assoc_thm'' not impl.for " ^ thmid)
   38.77 -  | _ => thmid |> convert_metaview_to_thmid thy |> num_str
   38.78 +  | _ => thmid |> convert_metaview_to_thmid thy |> TermC.num_str
   38.79  fun assoc_thm' thy (thmid, ct') =
   38.80    (case Symbol.explode thmid of
   38.81      "s"::"y"::"m"::"_"::id => 
   38.82        if hd id = "#" 
   38.83        then mk_thm thy ct'
   38.84 -      else ((num_str o (Global_Theory.get_thm thy)) (implode id)) RS sym
   38.85 +      else ((TermC.num_str o (Global_Theory.get_thm thy)) (implode id)) RS sym
   38.86    | id =>
   38.87      if hd id = "#" 
   38.88      then mk_thm thy ct'
   38.89 -    else thmid |> convert_metaview_to_thmid thy |> num_str
   38.90 +    else thmid |> convert_metaview_to_thmid thy |> TermC.num_str
   38.91    ) handle _ (*TODO: find exn behind ERROR: Undefined fact: "add_commute"*) => 
   38.92      error ("assoc_thm': \"" ^ thmid ^ "\" not in \"" ^ theory2domID thy ^ "\" (and parents)")
   38.93  
    39.1 --- a/src/Tools/isac/ProgLang/scrtools.sml	Sun Feb 25 16:31:17 2018 +0100
    39.2 +++ b/src/Tools/isac/ProgLang/scrtools.sml	Fri Mar 02 14:19:59 2018 +0100
    39.3 @@ -67,17 +67,17 @@
    39.4  (* make the term 'Subproblem (domID, pblID)' to a formula for frontend;
    39.5    needs to be here after def. Subproblem in Script.thy *)
    39.6  val subpbl_t $ (pair_t $ Free (_, _) $ _) = 
    39.7 -  (Thm.term_of o the o (parse @{theory Script})) "Subproblem (Isac,[equation,univar])"
    39.8 +  (Thm.term_of o the o (TermC.parse @{theory Script})) "Subproblem (Isac,[equation,univar])"
    39.9  val pbl_t $ _ = 
   39.10 -  (Thm.term_of o the o (parse @{theory Script})) "Problem (Isac,[equation,univar])"
   39.11 -val Free (_, ID_type) = (Thm.term_of o the o (parse @{theory Script})) "xxx::ID"
   39.12 +  (Thm.term_of o the o (TermC.parse @{theory Script})) "Problem (Isac,[equation,univar])"
   39.13 +val Free (_, ID_type) = (Thm.term_of o the o (TermC.parse @{theory Script})) "xxx::ID"
   39.14  
   39.15  fun subpbl domID pblID =
   39.16    subpbl_t $ (pair_t $ Free (domID, ID_type) $ 
   39.17 -    (((list2isalist ID_type) o (map (mk_free ID_type))) pblID));
   39.18 +    (((TermC.list2isalist ID_type) o (map (TermC.mk_free ID_type))) pblID));
   39.19  fun pblterm (domID:domID) (pblID:pblID) =
   39.20    pbl_t $ (pair_t $ Free (domID,ID_type) $ 
   39.21 -	  (((list2isalist ID_type) o (map (mk_free ID_type))) pblID));
   39.22 +	  (((TermC.list2isalist ID_type) o (map (TermC.mk_free ID_type))) pblID));
   39.23  
   39.24  (* construct scr-env from scr(created automatically) and Rewrite_Set *)
   39.25  fun one_scr_arg (Const _ $ arg $ _) = arg
   39.26 @@ -211,7 +211,7 @@
   39.27  (** build up a program from rules **)
   39.28  
   39.29  (* transform type rule to a term *)
   39.30 -val ScrStep $ _ $ _ = ((inst_abs @{theory}) o Thm.term_of o the o (parse @{theory}))
   39.31 +val ScrStep $ _ $ _ = ((TermC.inst_abs @{theory}) o Thm.term_of o the o (TermC.parse @{theory}))
   39.32    (*'z not affected by parse: 'a --> real*)
   39.33  	"Script Stepwise (t_t::'z) =\
   39.34          \(Repeat\
   39.35 @@ -220,7 +220,7 @@
   39.36  	\   (Try (Repeat (Rewrite mult_commute False))))  \
   39.37  	\  t_t)";
   39.38  (*WN060605 script-arg (t_::'z) and "Free (t_, 'a)" at end of body are inconsistent !!!*)
   39.39 -val ScrStep_inst $ Term $ Bdv $ _= ((inst_abs @{theory}) o Thm.term_of o the o (parse @{theory}))
   39.40 +val ScrStep_inst $ Term $ Bdv $ _= ((TermC.inst_abs @{theory}) o Thm.term_of o the o (TermC.parse @{theory}))
   39.41    (*'z not affected by parse: 'a --> real*)
   39.42  	"Script Stepwise_inst (t_t::'z) (v::real) =\
   39.43          \(Repeat\
   39.44 @@ -228,23 +228,23 @@
   39.45  	\   (Try (Repeat (Rewrite_Inst [(bdv,v)] add_commute False))) @@\
   39.46  	\   (Try (Repeat (Rewrite_Inst [(bdv,v)] mult_commute False)))) \
   39.47  	\  t_t)"; 
   39.48 -val Repeat $ _ = ((inst_abs @{theory}) o Thm.term_of o the o (parseN @{theory})) 
   39.49 +val Repeat $ _ = ((TermC.inst_abs @{theory}) o Thm.term_of o the o (TermC.parseN @{theory})) 
   39.50  	"Repeat (Rewrite real_diff_minus False t)";
   39.51 -val Try $ _ = ((inst_abs @{theory}) o Thm.term_of o the o (parseN @{theory})) 
   39.52 +val Try $ _ = ((TermC.inst_abs @{theory}) o Thm.term_of o the o (TermC.parseN @{theory})) 
   39.53  	"Try (Rewrite real_diff_minus False t)";
   39.54 -val Cal $ _ = ((inst_abs @{theory}) o Thm.term_of o the o (parseN @{theory})) 
   39.55 +val Cal $ _ = ((TermC.inst_abs @{theory}) o Thm.term_of o the o (TermC.parseN @{theory})) 
   39.56  	"Calculate PLUS";
   39.57 -val Ca1 $ _ = ((inst_abs @{theory}) o Thm.term_of o the o (parseN @{theory})) 
   39.58 +val Ca1 $ _ = ((TermC.inst_abs @{theory}) o Thm.term_of o the o (TermC.parseN @{theory})) 
   39.59  	"Calculate1 PLUS";
   39.60 -val Rew $ (Free (_, IDtype)) $ _ $ _ = ((inst_abs @{theory}) o Thm.term_of o the o (parseN @{theory})) 
   39.61 +val Rew $ (Free (_, IDtype)) $ _ $ _ = ((TermC.inst_abs @{theory}) o Thm.term_of o the o (TermC.parseN @{theory})) 
   39.62  	"Rewrite real_diff_minus False t";
   39.63 -val Rew_Inst $ Subs $ _ $ _ = ((inst_abs @{theory}) o Thm.term_of o the o (parseN @{theory})) 
   39.64 +val Rew_Inst $ Subs $ _ $ _ = ((TermC.inst_abs @{theory}) o Thm.term_of o the o (TermC.parseN @{theory})) 
   39.65  	"Rewrite_Inst [(bdv,v)] real_diff_minus False";
   39.66 -val Rew_Set $ _ $ _ = ((inst_abs @{theory}) o Thm.term_of o the o (parseN @{theory})) 
   39.67 +val Rew_Set $ _ $ _ = ((TermC.inst_abs @{theory}) o Thm.term_of o the o (TermC.parseN @{theory})) 
   39.68  	"Rewrite_Set real_diff_minus False";
   39.69 -val Rew_Set_Inst $ _ $ _ $ _ = ((inst_abs @{theory}) o Thm.term_of o the o (parseN @{theory})) 
   39.70 +val Rew_Set_Inst $ _ $ _ $ _ = ((TermC.inst_abs @{theory}) o Thm.term_of o the o (TermC.parseN @{theory})) 
   39.71  	"Rewrite_Set_Inst [(bdv,v)] real_diff_minus False";
   39.72 -val SEq $ _ $ _ $ _ = ((inst_abs @{theory}) o Thm.term_of o the o (parseN @{theory})) 
   39.73 +val SEq $ _ $ _ $ _ = ((TermC.inst_abs @{theory}) o Thm.term_of o the o (TermC.parseN @{theory})) 
   39.74  	"  ((Try (Repeat (Rewrite real_diff_minus False))) @@  \
   39.75          \   (Try (Repeat (Rewrite add_commute False))) @@ \
   39.76          \   (Try (Repeat (Rewrite mult_commute False)))) t";
   39.77 @@ -277,7 +277,7 @@
   39.78        s3 :: s2 :: ss => op @@@ (SEq $ s2 $ s3) ss
   39.79      | ts => raise ERROR ("fun @@ not applicable to \"" ^ terms2str ts ^ "\"")
   39.80  
   39.81 -val contains_bdv = (not o null o (filter is_bdv) o ids2str o #prop o Thm.rep_thm);
   39.82 +val contains_bdv = (not o null o (filter TermC.is_bdv) o TermC.ids2str o #prop o Thm.rep_thm);
   39.83  
   39.84  (* does a rule contain a 'bdv'; descend recursively into Rls_ *)
   39.85  fun contain_bdv [] = false
    40.1 --- a/src/Tools/isac/ProgLang/termC.sml	Sun Feb 25 16:31:17 2018 +0100
    40.2 +++ b/src/Tools/isac/ProgLang/termC.sml	Fri Mar 02 14:19:59 2018 +0100
    40.3 @@ -2,6 +2,147 @@
    40.4     Author: Walther Neuper 1999, Mathias Lehnfeld
    40.5     (c) due to copyright terms
    40.6  *)
    40.7 +                                          
    40.8 +signature TERMC =
    40.9 +  sig
   40.10 +    val bool: typ
   40.11 +    val calc_equ: string -> int * int -> bool
   40.12 +    val const_in: string -> term -> bool
   40.13 +    val contains_Var: term -> bool
   40.14 +    val dest_binop_typ: typ -> typ * typ * typ
   40.15 +    val dest_equals': term -> term * term
   40.16 +    val free2str: term -> string
   40.17 +    val gcd: int -> int -> int
   40.18 +    val ids2str: term -> string list
   40.19 +    val ins_concl: term -> term -> term
   40.20 +    val inst_abs: 'a -> term -> term
   40.21 +    val inst_bdv: (term * term) list -> term -> term
   40.22 +    val int_of_Free: term -> int
   40.23 +    val int_of_str: string -> int option
   40.24 +    val int_of_str': string -> int
   40.25 +    val isalist2list: term -> term list
   40.26 +    val isapair2pair: term -> term * term
   40.27 +    val isastr_of_int: int -> string
   40.28 +    val is_atom: term -> bool
   40.29 +    val is_bdv: string -> bool
   40.30 +    val is_bdv_subst: term -> bool
   40.31 +    val is_equality: term -> bool
   40.32 +    val is_expliceq: term -> bool
   40.33 +    val is_f_x: term -> bool
   40.34 +    val is_list: term -> bool
   40.35 +    val is_no: string -> bool
   40.36 +    val is_num: term -> bool
   40.37 +    val is_numeral: string -> bool
   40.38 +    val list_implies: term list * term -> term
   40.39 +    val list2isalist: typ -> term list -> term
   40.40 +    val mk_add: term -> term -> term
   40.41 +    val mk_free: typ -> string -> term
   40.42 +    val matches: theory -> term -> term -> bool
   40.43 +    val mk_equality: term * term -> term
   40.44 +    val mk_factroot: string -> typ -> int -> int -> term
   40.45 +    val mk_Free: string * typ -> term
   40.46 +    val mk_thmid: string -> 'a -> string -> string -> string
   40.47 +    val num_op_num: typ -> typ -> string * typ -> int -> int -> term
   40.48 +    val num_op_var: term -> string -> typ -> typ -> int -> term
   40.49 +    val num_str: thm -> thm
   40.50 +    val pairt: term -> term -> term
   40.51 +    val pairT: typ -> typ -> typ
   40.52 +    val parse: theory -> string -> cterm option
   40.53 +    val parseN: theory -> string -> cterm option
   40.54 +    val parseNEW: Proof.context -> string -> term option
   40.55 +    val parseold: theory -> string -> cterm option
   40.56 +    val parse_patt: theory -> string -> term
   40.57 +    val perm: term -> term -> bool
   40.58 +    val power: int -> int -> int
   40.59 +    val sign2: int -> int -> int
   40.60 +    val squfact: int -> int
   40.61 +    val str_of_free_opt: term -> string option
   40.62 +    val str_of_int: int -> string
   40.63 +    val str2int: string -> int
   40.64 +    val str2term: string -> term
   40.65 +    val strip_imp_prems': term -> term option
   40.66 +    val strip_trueprop: term -> term
   40.67 +    val subst_atomic_all: (term * term) list -> term -> bool * term
   40.68 +    val term_detail2str: term -> string
   40.69 +    val term_of_num: typ -> int -> term
   40.70 +    val Trueprop: term
   40.71 +    val uminus_to_string: term -> term
   40.72 +    val var2free: term -> term
   40.73 +    val var_op_num: term -> string -> typ -> typ -> int -> term
   40.74 +    val vars: term -> term list
   40.75 +(* ---- for tests only: shifted from below to remove the Warning "unused" at fun.def. --------- *)
   40.76 +  (* NONE *)
   40.77 +(*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\* )
   40.78 +    val --->: typ list * typ -> typ
   40.79 +    val -->: typ * typ -> typ
   40.80 +    val PairT: typ -> typ -> typ
   40.81 +    val T_a2real: typ -> typ
   40.82 +    val add_term_vars: term * term list -> term list
   40.83 +    val atless: term * term -> bool
   40.84 +    val atomt: term -> unit
   40.85 +    val atomthm: thm -> unit
   40.86 +    val atomty: term -> unit
   40.87 +    val atomty_thy: thyID -> term -> unit
   40.88 +    val atomtyp: typ -> unit
   40.89 +    val atomw: term -> unit
   40.90 +    val atomwy: term -> unit
   40.91 +    val contains_term: term -> term -> bool
   40.92 +    val dest_type: typ -> string
   40.93 +    val divisors: int -> int list
   40.94 +    val doubles: ''a list -> ''a list
   40.95 +    val dummyT: typ
   40.96 +    val dvd: int * int -> bool
   40.97 +    val eq_set_term: term list * term list -> bool
   40.98 +    val false_as_cterm: cterm
   40.99 +    val free2int: term -> int
  40.100 +    val free2var: term -> term
  40.101 +    val get_thm': xstring -> rule
  40.102 +    val get_types: term -> (string * typ) list
  40.103 +    val insert_aterm: term * term list -> term list
  40.104 +    val is_Free: term -> bool
  40.105 +    val is_bdv_: term -> bool
  40.106 +    val is_fun_id: term -> bool
  40.107 +    val lhs_: term -> term
  40.108 +    val listType: typ
  40.109 +    val list_const: typ -> term
  40.110 +    val match_bvs: term * term * (string * string) list -> (string * string) list
  40.111 +    val mem_term: term * term list -> bool
  40.112 +    val mk_listT: typ -> typ
  40.113 +    val mk_prop: term -> term
  40.114 +    val mk_subs: ((string * int) * (typ * term)) list -> (term * term) list
  40.115 +    val num_of_term: term -> int
  40.116 +    val numbers_to_string: term -> term
  40.117 +    val raw_pp_typ: typ -> Pretty.T
  40.118 +    val ren_inst: ((indexname * typ) list * (indexname * term) list) * term * term * term -> term
  40.119 +    val rhs_: term -> term
  40.120 +    val scala_of_term: term -> string
  40.121 +    val scala_of_typ: typ -> string
  40.122 +    val set_types: (string * typ) list -> term -> term
  40.123 +    val sign: int -> int
  40.124 +    val sqrt: int -> int
  40.125 +    val str2termN: string -> term
  40.126 +    val str2term_: theory -> string -> term
  40.127 +    val str_of_int: int -> string
  40.128 +    val strs2terms: string list -> term list
  40.129 +    val subset_term: term list * term list -> bool
  40.130 +    val subst_bound: term * term -> term
  40.131 +    val term_detail2str_thy: thyID -> term -> string
  40.132 +    val term_of_num: typ -> int -> term
  40.133 +    val term_str: 'a -> term -> string
  40.134 +    val term_vars: term -> term list
  40.135 +    val true_as_cterm: cterm
  40.136 +    val typ_a2real: term -> term
  40.137 +    val var_perm: term * term -> bool
  40.138 +    val vars_str: term -> string list
  40.139 +    val vperm: term * term -> bool
  40.140 +    val xless: (string * int) * indexname -> bool
  40.141 +( *\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*)
  40.142 +  end
  40.143 +
  40.144 +(**)
  40.145 +structure TermC(**): TERMC(**) =
  40.146 +struct
  40.147 +(**)
  40.148  
  40.149  fun isastr_of_int i = if i >= 0 then string_of_int i else "-" ^ string_of_int (abs i)
  40.150  
  40.151 @@ -569,10 +710,12 @@
  40.152  	 else pdiv ds (d+1) n
  40.153    in pdiv [] 2 n end;
  40.154  
  40.155 +(*
  40.156  divisors 30;
  40.157  divisors 32;
  40.158  divisors 60;
  40.159  divisors 11;
  40.160 +*)
  40.161  
  40.162  fun doubles ds = (* ds is ordered *)
  40.163    let fun dbls ds [] = ds
  40.164 @@ -1225,3 +1368,5 @@
  40.165      in if T1 <> T2 then raise TYPE ("mk_add gets ",[T1, T2],[t1,t2])
  40.166         else (Const ("Groups.plus_class.plus", [T1, T2] ---> T1) $ t1 $ t2)
  40.167      end;
  40.168 +
  40.169 +end
  40.170 \ No newline at end of file
    41.1 --- a/src/Tools/isac/xmlsrc/datatypes.sml	Sun Feb 25 16:31:17 2018 +0100
    41.2 +++ b/src/Tools/isac/xmlsrc/datatypes.sml	Fri Mar 02 14:19:59 2018 +0100
    41.3 @@ -197,7 +197,7 @@
    41.4      if term = e_term 
    41.5      then indt j ^"<SCRIPT>  </SCRIPT>\n"
    41.6      else indt j ^"<SCRIPT>\n"^ 
    41.7 -	 term2xml j (inst_abs (assoc_thy "Isac") term) ^ "\n" ^
    41.8 +	 term2xml j (TermC.inst_abs (assoc_thy "Isac") term) ^ "\n" ^
    41.9  	 indt j ^"</SCRIPT>\n"
   41.10    | scr2xml j (Rfuns _) =
   41.11      indt j ^"<REVERSREWRITE> reverse rewrite functions </REVERSREWRITE>\n";
   41.12 @@ -308,7 +308,7 @@
   41.13    XML.Elem (("INTLIST", []), map xml_of_int is)
   41.14  
   41.15  fun xml_to_int (XML.Elem (("INT", []), [XML.Text i])) = 
   41.16 -      (case int_of_str i of SOME i => i | _ => error "xml_to_int: int_of_str \<Rightarrow> NONE")
   41.17 +      (case TermC.int_of_str i of SOME i => i | _ => error "xml_to_int: int_of_str \<Rightarrow> NONE")
   41.18    | xml_to_int tree = raise ERROR ("xml_to_int: wrong XML.tree \n" ^ xmlstr 0 tree)
   41.19  fun xml_to_ints (XML.Elem (("INTLIST", []), is)) = map xml_to_int is
   41.20    | xml_to_ints tree = raise ERROR ("xml_to_ints: wrong XML.tree \n" ^ xmlstr 0 tree)
   41.21 @@ -331,7 +331,7 @@
   41.22    | xml_of_auto CompleteSubpbl = XML.Elem (("AUTO", []), [XML.Text "CompleteSubpbl"])
   41.23    | xml_of_auto CompleteCalc = XML.Elem (("AUTO", []), [XML.Text "CompleteCalc"])
   41.24  fun xml_to_auto (XML.Elem (("AUTO", []), [
   41.25 -      XML.Elem (("STEP", []), [XML.Text i])])) = Solve.Step (int_of_str i |> the)
   41.26 +      XML.Elem (("STEP", []), [XML.Text i])])) = Solve.Step (TermC.int_of_str i |> the)
   41.27    | xml_to_auto (XML.Elem (("AUTO", []), [XML.Text "CompleteModel"])) = Solve.CompleteModel
   41.28    | xml_to_auto (XML.Elem (("AUTO", []), [XML.Text "CompleteCalcHead"])) = Solve.CompleteCalcHead
   41.29    | xml_to_auto (XML.Elem (("AUTO", []), [XML.Text "CompleteToSubpbl"])) = Solve.CompleteToSubpbl
   41.30 @@ -513,7 +513,7 @@
   41.31    | xml_of_src (Prog term) =
   41.32      XML.Elem (("CODE", []), [
   41.33        if term = e_term then xml_of_src EmptyScr
   41.34 -      else xml_of_term (inst_abs (assoc_thy "Isac") term)])
   41.35 +      else xml_of_term (TermC.inst_abs (assoc_thy "Isac") term)])
   41.36    | xml_of_src (Rfuns _) =
   41.37      XML.Elem (("NOCODE", []), [XML.Text "reverse rewrite functions"])
   41.38  
   41.39 @@ -641,7 +641,7 @@
   41.40        ("name", "Specify_Problem")]), [ct])) = Tac.Specify_Problem (xml_to_strs ct)
   41.41    | xml_to_tac x = raise ERROR ("xml_to_tac: not impl. for " ^ xmlstr 0 x);
   41.42  
   41.43 -val e_pblterm = (Thm.term_of o the o (parse @{theory Script})) 
   41.44 +val e_pblterm = (Thm.term_of o the o (TermC.parse @{theory Script})) 
   41.45  		    ("Problem (" ^ e_domID ^ "," ^ strs2str' e_pblID ^ ")");
   41.46  
   41.47  (*WN051224 minimal adaption to exporting Formulae _only_ by getFormulaeFromTo*)
    42.1 --- a/src/Tools/isac/xmlsrc/mathml.sml	Sun Feb 25 16:31:17 2018 +0100
    42.2 +++ b/src/Tools/isac/xmlsrc/mathml.sml	Fri Mar 02 14:19:59 2018 +0100
    42.3 @@ -86,11 +86,11 @@
    42.4  fun xml_of_terms ts = map xml_of_term ts
    42.5  fun xml_to_term 
    42.6      ((XML.Elem (("MATHML", []), [
    42.7 -        XML.Elem (("ISA", []), [XML.Text str])]))) = str |> encode |> str2term
    42.8 +        XML.Elem (("ISA", []), [XML.Text str])]))) = str |> encode |> TermC.str2term
    42.9    | xml_to_term xx = raise ERROR ("xml_to_term wrong arg: " ^ xmlstr 0 xx)
   42.10  fun xml_to_term_NEW 
   42.11      ((XML.Elem (("FORMULA", []), [
   42.12 -        XML.Elem (("ISA", []), [XML.Text str])]))) = str |> encode |> str2term
   42.13 +        XML.Elem (("ISA", []), [XML.Text str])]))) = str |> encode |> TermC.str2term
   42.14    | xml_to_term_NEW xx = raise ERROR ("xml_to_term_NEW wrong arg: " ^ xmlstr 0 xx)
   42.15  fun xml_to_terms ts = map xml_to_term ts
   42.16  fun xml_to_terms_NEW ts = map xml_to_term_NEW ts
    43.1 --- a/src/Tools/isac/xmlsrc/pbl-met-hierarchy.sml	Sun Feb 25 16:31:17 2018 +0100
    43.2 +++ b/src/Tools/isac/xmlsrc/pbl-met-hierarchy.sml	Fri Mar 02 14:19:59 2018 +0100
    43.3 @@ -108,7 +108,7 @@
    43.4     requires elements (rls, calc, ...) to be reorganized.*)
    43.5  (*######## ATTENTION: THIS IS not THE ACTUAL VERSION ################*)
    43.6  fun pbl2term thy (pblRD: Specify.pblRD) = (*WN120405.TODO.txt*)
    43.7 -  str2term ("Problem (" ^ (get_thy o theory2domID) thy ^ "', " ^ (strs2str' o rev) pblRD ^ ")");
    43.8 +  TermC.str2term ("Problem (" ^ (get_thy o theory2domID) thy ^ "', " ^ (strs2str' o rev) pblRD ^ ")");
    43.9  (* term2str (pbl2term (Thy_Info_get_theory "Isac") ["equations","univariate","normalise"]);
   43.10  val it = "Problem (Isac, [normalise, univariate, equations])" : string
   43.11  *)