reorganise struct. ThmC, part 1
authorWalther Neuper <walther.neuper@jku.at>
Mon, 13 Apr 2020 15:31:23 +0200
changeset 5987182428ca0d23e
parent 59870 0042fe0bc764
child 59872 cea2815f65ed
reorganise struct. ThmC, part 1
src/Tools/isac/BaseDefinitions/BaseDefinitions.thy
src/Tools/isac/BaseDefinitions/KEStore.thy
src/Tools/isac/BaseDefinitions/termC.sml
src/Tools/isac/BaseDefinitions/thmC-def.sml
src/Tools/isac/Knowledge/Base_Tools.thy
src/Tools/isac/Knowledge/Biegelinie.thy
src/Tools/isac/Knowledge/Diff.thy
src/Tools/isac/Knowledge/DiffApp.thy
src/Tools/isac/Knowledge/EqSystem.thy
src/Tools/isac/Knowledge/Integrate.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/Test.thy
src/Tools/isac/MathEngBasic/rewrite.sml
src/Tools/isac/MathEngBasic/thmC.sml
src/Tools/isac/ProgLang/ListC.thy
src/Tools/isac/ProgLang/Prog_Expr.thy
src/Tools/isac/ProgLang/Program.thy
src/Tools/isac/ProgLang/calculate.sml
test/Tools/isac/ADDTESTS/course/CADGME/example_2.thy
test/Tools/isac/ADDTESTS/course/SignalProcess/Build_Inverse_Z_Transform.thy
test/Tools/isac/ADDTESTS/course/phst11/T2_Rewriting.thy
test/Tools/isac/BaseDefinitions/termC.sml
test/Tools/isac/BridgeLibisabelle/thy-hierarchy.sml
test/Tools/isac/BridgeLibisabelle/use-cases.sml
test/Tools/isac/Interpret/rewtools.sml
test/Tools/isac/Knowledge/biegelinie-1.sml
test/Tools/isac/Knowledge/diophanteq.sml
test/Tools/isac/Knowledge/eqsystem.sml
test/Tools/isac/Knowledge/integrate.sml
test/Tools/isac/Knowledge/partial_fractions.sml
test/Tools/isac/Knowledge/polyeq-1.sml
test/Tools/isac/Knowledge/polyeq-2.sml
test/Tools/isac/Knowledge/polyminus.sml
test/Tools/isac/Knowledge/rational.sml
test/Tools/isac/Knowledge/rootrat.sml
test/Tools/isac/MathEngBasic/rewrite.sml
test/Tools/isac/OLDTESTS/root-equ.sml
test/Tools/isac/ProgLang/auto_prog.sml
test/Tools/isac/ProgLang/listC.sml
     1.1 --- a/src/Tools/isac/BaseDefinitions/BaseDefinitions.thy	Mon Apr 13 13:27:55 2020 +0200
     1.2 +++ b/src/Tools/isac/BaseDefinitions/BaseDefinitions.thy	Mon Apr 13 15:31:23 2020 +0200
     1.3 @@ -2,10 +2,7 @@
     1.4     Author: Walther Neuper 190823
     1.5     (c) due to copyright terms
     1.6  
     1.7 -KEStore holds Theory_Data (problems, methods, etc).
     1.8 -The directory BaseDefinitions/ holds definitions (in "*-def.sml") required for KEStore;
     1.9 -many of these files have respective "*.sml" files with further code,
    1.10 -located at appropriate positions in the code.
    1.11 +KEStore holds Theory_Data (problems, methods, etc) and requires respective definitions.
    1.12  *)
    1.13  theory BaseDefinitions imports KEStore
    1.14  begin
     2.1 --- a/src/Tools/isac/BaseDefinitions/KEStore.thy	Mon Apr 13 13:27:55 2020 +0200
     2.2 +++ b/src/Tools/isac/BaseDefinitions/KEStore.thy	Mon Apr 13 15:31:23 2020 +0200
     2.3 @@ -1,5 +1,13 @@
     2.4  (*  Title:      src/Tools/isac/KEStore.thy
     2.5      Author:     Mathias Lehnfeld
     2.6 +
     2.7 +The files (in "xxxxx-def.sml") contain definitions required for KEStore;
     2.8 +they also include minimal code required for other "xxxxx-def.sml" files.
     2.9 +These files have companion files "xxxxx.sml" with all further code,
    2.10 +located at appropriate positions in the file structure.
    2.11 +
    2.12 +The separation of "xxxxx-def.sml" from "xxxxx.sml" should be overcome by
    2.13 +appropriate use of polymorphic high order functions.
    2.14  *)
    2.15  
    2.16  theory KEStore imports Complex_Main
     3.1 --- a/src/Tools/isac/BaseDefinitions/termC.sml	Mon Apr 13 13:27:55 2020 +0200
     3.2 +++ b/src/Tools/isac/BaseDefinitions/termC.sml	Mon Apr 13 15:31:23 2020 +0200
     3.3 @@ -83,9 +83,9 @@
     3.4    val raise_type_conflicts: term list -> unit
     3.5    val strip_trueprop: term -> term
     3.6  
     3.7 -  val num_str: thm -> thm
     3.8    val numbers_to_string: term -> term
     3.9    val uminus_to_string: term -> term
    3.10 +
    3.11    val var2free: term -> term
    3.12    val vars: term -> term list  (* recognises numverals, should replace "fun vars_of" *)
    3.13    val vars_of: term -> term list
    3.14 @@ -234,14 +234,9 @@
    3.15    if n < 0 then "-" ^ ((string_of_int o abs) n)
    3.16    else string_of_int n;
    3.17  val int_of_str = Value.parse_int;
    3.18 -fun int_of_str_opt str = 
    3.19 -  let
    3.20 -    val ss = Symbol.explode str
    3.21 -    val ss' = case ss of "(" :: s => drop_last s | _ => ss
    3.22 -    val (sign, istr) = case ss' of "-" :: istr => (~1, istr) | _ => (1, ss')
    3.23 -  in
    3.24 -    case Library.read_int istr of (i, []) => SOME (sign * i) | _ => NONE
    3.25 -  end;
    3.26 +
    3.27 +val int_of_str_opt = ThmC_Def.int_of_str_opt
    3.28 +
    3.29  fun is_num' str = case int_of_str_opt str of SOME _ => true | NONE => false;
    3.30  fun is_num (Free (s, _)) = if is_num' s then true else false | is_num _ = false;
    3.31  fun term_of_num ntyp n = Free (str_of_int n, ntyp);
    3.32 @@ -442,44 +437,8 @@
    3.33    end;
    3.34  
    3.35  (** transform binary numeralsstrings **)
    3.36 -(*Makarius 100308, hacked by WN*)
    3.37 -val numbers_to_string =
    3.38 -  let
    3.39 -    fun dest_num t =
    3.40 -      (case try HOLogic.dest_number t of
    3.41 -        SOME (T, i) =>
    3.42 -          (*if T = @{typ int} orelse T = @{typ real} then WN*)
    3.43 -            SOME (Free (signed_string_of_int i, T))
    3.44 -          (*else NONE  WN*)
    3.45 -      | NONE => NONE);
    3.46 -    fun to_str (Abs (x, T, b)) = Abs (x, T, to_str b)
    3.47 -      | to_str (t as (u1 $ u2)) =
    3.48 -          (case dest_num t of
    3.49 -            SOME t' => t'
    3.50 -          | NONE => to_str u1 $ to_str u2)
    3.51 -      | to_str t = perhaps dest_num t;
    3.52 -  in to_str end
    3.53 -val uminus_to_string =
    3.54 -  let
    3.55 -	  fun dest_num t =
    3.56 -	    case t of
    3.57 -	      (Const ("Groups.uminus_class.uminus", _) $ Free (s, T)) => 
    3.58 -	        (case int_of_str_opt s of
    3.59 -	          SOME i => SOME (Free (signed_string_of_int (~1 * i), T))
    3.60 -	        | NONE => NONE)
    3.61 -	    | _ => NONE;
    3.62 -    fun to_str (Abs (x, T, b)) = Abs (x, T, to_str b)
    3.63 -      | to_str (t as (u1 $ u2)) =
    3.64 -          (case dest_num t of SOME t' => t' | NONE => to_str u1 $ to_str u2)
    3.65 -      | to_str t = perhaps dest_num t;
    3.66 -  in to_str end;
    3.67 -fun num_str thm =
    3.68 -  let
    3.69 -    val (deriv, 
    3.70 -	   {cert = cert, tags = tags, maxidx = maxidx, shyps = shyps, 
    3.71 -	    hyps = hyps, tpairs = tpairs, prop = prop}) = Thm.rep_thm_G thm
    3.72 -    val prop' = numbers_to_string prop;
    3.73 -  in Thm.assbl_thm deriv cert tags maxidx shyps hyps tpairs prop' end;
    3.74 +val numbers_to_string = ThmC_Def.numbers_to_string
    3.75 +val uminus_to_string = ThmC_Def.numbers_to_string
    3.76  
    3.77  fun mk_Free (s,T) = Free (s, T);
    3.78  fun mk_free T s =  Free (s, T);
     4.1 --- a/src/Tools/isac/BaseDefinitions/thmC-def.sml	Mon Apr 13 13:27:55 2020 +0200
     4.2 +++ b/src/Tools/isac/BaseDefinitions/thmC-def.sml	Mon Apr 13 15:31:23 2020 +0200
     4.3 @@ -17,6 +17,12 @@
     4.4    val thm''_of_thm: thm -> thm''
     4.5    val thm_of_thm: Rule_Def.rule -> thm
     4.6  
     4.7 +(* required only for ProgLang/ListC *)
     4.8 +  val numerals_to_Free: thm -> thm          (* belongs to ThmC  *)
     4.9 +  val int_of_str_opt: string -> int option  (* belongs to TermC *)
    4.10 +  val numbers_to_string: term -> term       (* belongs to TermC *)
    4.11 +  val uminus_to_string: term -> term        (* belongs to TermC *)
    4.12 +
    4.13  (* ---- for tests only: shifted from below to remove the Warning "unused" at fun.def. --------- *)
    4.14    val thm2str: thm -> string
    4.15    val thms2str : thm list -> string
    4.16 @@ -40,7 +46,7 @@
    4.17  revise funs      : id_of_thm, thm_of_thm, rep_thm_G', eq_thmI, eq_thmI', thm''_of_thm thm.
    4.18  activate         : thmID_of_derivation_name'
    4.19  *)
    4.20 -type thmID = string;    (* identifier for a thm (the shortest possible identifier)       *)
    4.21 +type thmID = string;    (* identifier for a thm (the shortest string possible, without points)       *)
    4.22  (*
    4.23    ad thm': there are two kinds of theorems ...
    4.24    (1) defined in isabelle
    4.25 @@ -49,7 +55,8 @@
    4.26    and thus outside isa we ALWAYS transport both (thmID, ThmC_Def.string_of_thmI)
    4.27    and have a special assoc_thm / assoc_rls in this interface
    4.28  *)
    4.29 -type thm' = thmID * UnparseC.term_as_string;(*WN060610 deprecated in favour of thm''; WN180324: used in TODO review:
    4.30 +type thm' = thmID * UnparseC.term_as_string;(*WN060610 deprecated in favour of thm'';
    4.31 +WN180324: used in TODO review:
    4.32  val thm'2xml : int -> ThmC_Def.thm' -> Celem.xml
    4.33  val assoc_thm': theory -> ThmC_Def.thm' -> thm
    4.34  | Calculate' of ThyC.theory' * string * term * (term * ThmC_Def.thm')
    4.35 @@ -84,13 +91,63 @@
    4.36      | _ => str
    4.37    end
    4.38  
    4.39 -fun id_of_thm (Rule_Def.Thm (id, _)) = id  (* TODO re-arrange code for to_string *)
    4.40 +fun id_of_thm (Rule_Def.Thm (id, _)) = id
    4.41    | id_of_thm _ = raise ERROR ("id_of_thm: uncovered case " (* ^ to_string r *))
    4.42  
    4.43  fun thmID_of_derivation_name dn = last_elem (space_explode "." dn);
    4.44  fun thmID_of_derivation_name' thm = (thmID_of_derivation_name o Thm.get_name_hint) thm
    4.45 -fun thm_of_thm (Rule_Def.Thm (_, thm)) = thm  (* TODO re-arrange code for to_string *)
    4.46 +fun thm_of_thm (Rule_Def.Thm (_, thm)) = thm
    4.47    | thm_of_thm _ = raise ERROR ("thm_of_thm: uncovered case " (* ^ to_string r *))
    4.48  fun thm''_of_thm thm = (thmID_of_derivation_name' thm, thm) : thm''
    4.49  
    4.50 +fun int_of_str_opt str = 
    4.51 +  let
    4.52 +    val ss = Symbol.explode str
    4.53 +    val ss' = case ss of "(" :: s => drop_last s | _ => ss
    4.54 +    val (sign, istr) = case ss' of "-" :: istr => (~1, istr) | _ => (1, ss')
    4.55 +  in
    4.56 +    case Library.read_int istr of (i, []) => SOME (sign * i) | _ => NONE
    4.57 +  end;
    4.58 +
    4.59 +(** transform binary numeralsstrings **)
    4.60 +
    4.61 +(*Makarius 100308, hacked by WN*)
    4.62 +val numbers_to_string =
    4.63 +  let
    4.64 +    fun dest_num t =
    4.65 +      (case try HOLogic.dest_number t of
    4.66 +        SOME (T, i) =>
    4.67 +          (*if T = @{typ int} orelse T = @{typ real} then WN*)
    4.68 +            SOME (Free (signed_string_of_int i, T))
    4.69 +          (*else NONE  WN*)
    4.70 +      | NONE => NONE);
    4.71 +    fun to_str (Abs (x, T, b)) = Abs (x, T, to_str b)
    4.72 +      | to_str (t as (u1 $ u2)) =
    4.73 +          (case dest_num t of
    4.74 +            SOME t' => t'
    4.75 +          | NONE => to_str u1 $ to_str u2)
    4.76 +      | to_str t = perhaps dest_num t;
    4.77 +  in to_str end
    4.78 +val uminus_to_string =
    4.79 +  let
    4.80 +	  fun dest_num t =
    4.81 +	    case t of
    4.82 +	      (Const ("Groups.uminus_class.uminus", _) $ Free (s, T)) => 
    4.83 +	        (case int_of_str_opt s of
    4.84 +	          SOME i => SOME (Free (signed_string_of_int (~1 * i), T))
    4.85 +	        | NONE => NONE)
    4.86 +	    | _ => NONE;
    4.87 +    fun to_str (Abs (x, T, b)) = Abs (x, T, to_str b)
    4.88 +      | to_str (t as (u1 $ u2)) =
    4.89 +          (case dest_num t of SOME t' => t' | NONE => to_str u1 $ to_str u2)
    4.90 +      | to_str t = perhaps dest_num t;
    4.91 +  in to_str end;
    4.92 +fun numerals_to_Free thm =
    4.93 +  let
    4.94 +    val (deriv, 
    4.95 +	   {cert = cert, tags = tags, maxidx = maxidx, shyps = shyps, 
    4.96 +	    hyps = hyps, tpairs = tpairs, prop = prop}) = Thm.rep_thm_G thm
    4.97 +    val prop' = numbers_to_string prop;
    4.98 +  in Thm.assbl_thm deriv cert tags maxidx shyps hyps tpairs prop' end;
    4.99 +
   4.100  (**)end(**)
     5.1 --- a/src/Tools/isac/Knowledge/Base_Tools.thy	Mon Apr 13 13:27:55 2020 +0200
     5.2 +++ b/src/Tools/isac/Knowledge/Base_Tools.thy	Mon Apr 13 15:31:23 2020 +0200
     5.3 @@ -59,25 +59,25 @@
     5.4  \<close> ML \<open>
     5.5  val Atools_erls = Rule_Set.append_rules "Atools_erls" Rule_Set.empty
     5.6    [ Rule.Num_Calc ("HOL.eq", Prog_Expr.eval_equal "#equal_"),
     5.7 -    Rule.Thm ("not_true", TermC.num_str @{thm not_true}),
     5.8 +    Rule.Thm ("not_true", ThmC.numerals_to_Free @{thm not_true}),
     5.9  		(*"(~ True) = False"*)
    5.10 -		Rule.Thm ("not_false", TermC.num_str @{thm not_false}),
    5.11 +		Rule.Thm ("not_false", ThmC.numerals_to_Free @{thm not_false}),
    5.12  		(*"(~ False) = True"*)
    5.13 -		Rule.Thm ("and_true", TermC.num_str @{thm and_true}),
    5.14 +		Rule.Thm ("and_true", ThmC.numerals_to_Free @{thm and_true}),
    5.15  		(*"(?a & True) = ?a"*)
    5.16 -		Rule.Thm ("and_false", TermC.num_str @{thm and_false}),
    5.17 +		Rule.Thm ("and_false", ThmC.numerals_to_Free @{thm and_false}),
    5.18  		(*"(?a & False) = False"*)
    5.19 -		Rule.Thm ("or_true", TermC.num_str @{thm or_true}),
    5.20 +		Rule.Thm ("or_true", ThmC.numerals_to_Free @{thm or_true}),
    5.21  		(*"(?a | True) = True"*)
    5.22 -		Rule.Thm ("or_false", TermC.num_str @{thm or_false}),
    5.23 +		Rule.Thm ("or_false", ThmC.numerals_to_Free @{thm or_false}),
    5.24  		(*"(?a | False) = ?a"*)
    5.25                 
    5.26 -		Rule.Thm ("rat_leq1", TermC.num_str @{thm rat_leq1}),
    5.27 -		Rule.Thm ("rat_leq2", TermC.num_str @{thm rat_leq2}),
    5.28 -		Rule.Thm ("rat_leq3", TermC.num_str @{thm rat_leq3}),
    5.29 -      Rule.Thm ("refl", TermC.num_str @{thm refl}),
    5.30 -		Rule.Thm ("order_refl", TermC.num_str @{thm order_refl}),
    5.31 -		Rule.Thm ("radd_left_cancel_le", TermC.num_str @{thm radd_left_cancel_le}),
    5.32 +		Rule.Thm ("rat_leq1", ThmC.numerals_to_Free @{thm rat_leq1}),
    5.33 +		Rule.Thm ("rat_leq2", ThmC.numerals_to_Free @{thm rat_leq2}),
    5.34 +		Rule.Thm ("rat_leq3", ThmC.numerals_to_Free @{thm rat_leq3}),
    5.35 +      Rule.Thm ("refl", ThmC.numerals_to_Free @{thm refl}),
    5.36 +		Rule.Thm ("order_refl", ThmC.numerals_to_Free @{thm order_refl}),
    5.37 +		Rule.Thm ("radd_left_cancel_le", ThmC.numerals_to_Free @{thm radd_left_cancel_le}),
    5.38  		
    5.39  		Rule.Num_Calc ("Orderings.ord_class.less", Prog_Expr.eval_equ "#less_"),
    5.40  		Rule.Num_Calc ("Orderings.ord_class.less_eq", Prog_Expr.eval_equ "#less_equal_"),
    5.41 @@ -91,19 +91,19 @@
    5.42  ML \<open>
    5.43  val Atools_crls = Rule_Set.append_rules "Atools_crls" Rule_Set.empty
    5.44    [ Rule.Num_Calc ("HOL.eq", Prog_Expr.eval_equal "#equal_"),
    5.45 -    Rule.Thm ("not_true", TermC.num_str @{thm not_true}),
    5.46 -		Rule.Thm ("not_false", TermC.num_str @{thm not_false}),
    5.47 -		Rule.Thm ("and_true", TermC.num_str @{thm and_true}),
    5.48 -		Rule.Thm ("and_false", TermC.num_str @{thm and_false}),
    5.49 -		Rule.Thm ("or_true", TermC.num_str @{thm or_true}),
    5.50 -		Rule.Thm ("or_false", TermC.num_str @{thm or_false}),
    5.51 +    Rule.Thm ("not_true", ThmC.numerals_to_Free @{thm not_true}),
    5.52 +		Rule.Thm ("not_false", ThmC.numerals_to_Free @{thm not_false}),
    5.53 +		Rule.Thm ("and_true", ThmC.numerals_to_Free @{thm and_true}),
    5.54 +		Rule.Thm ("and_false", ThmC.numerals_to_Free @{thm and_false}),
    5.55 +		Rule.Thm ("or_true", ThmC.numerals_to_Free @{thm or_true}),
    5.56 +		Rule.Thm ("or_false", ThmC.numerals_to_Free @{thm or_false}),
    5.57                 
    5.58 -		Rule.Thm ("rat_leq1", TermC.num_str @{thm rat_leq1}),
    5.59 -		Rule.Thm ("rat_leq2", TermC.num_str @{thm rat_leq2}),
    5.60 -		Rule.Thm ("rat_leq3", TermC.num_str @{thm rat_leq3}),
    5.61 -		Rule.Thm ("refl", TermC.num_str @{thm refl}),
    5.62 -		Rule.Thm ("order_refl", TermC.num_str @{thm order_refl}),
    5.63 -		Rule.Thm ("radd_left_cancel_le", TermC.num_str @{thm radd_left_cancel_le}),
    5.64 +		Rule.Thm ("rat_leq1", ThmC.numerals_to_Free @{thm rat_leq1}),
    5.65 +		Rule.Thm ("rat_leq2", ThmC.numerals_to_Free @{thm rat_leq2}),
    5.66 +		Rule.Thm ("rat_leq3", ThmC.numerals_to_Free @{thm rat_leq3}),
    5.67 +		Rule.Thm ("refl", ThmC.numerals_to_Free @{thm refl}),
    5.68 +		Rule.Thm ("order_refl", ThmC.numerals_to_Free @{thm order_refl}),
    5.69 +		Rule.Thm ("radd_left_cancel_le", ThmC.numerals_to_Free @{thm radd_left_cancel_le}),
    5.70  		
    5.71  		Rule.Num_Calc ("Orderings.ord_class.less", Prog_Expr.eval_equ "#less_"),
    5.72  		Rule.Num_Calc ("Orderings.ord_class.less_eq", Prog_Expr.eval_equ "#less_equal_"),
    5.73 @@ -127,8 +127,8 @@
    5.74         
    5.75  		Rule.Num_Calc ("Prog_Expr.Vars",Prog_Expr.eval_var "#Vars_"),
    5.76  		
    5.77 -		Rule.Thm ("if_True",TermC.num_str @{thm if_True}),
    5.78 -		Rule.Thm ("if_False",TermC.num_str @{thm if_False})];
    5.79 +		Rule.Thm ("if_True",ThmC.numerals_to_Free @{thm if_True}),
    5.80 +		Rule.Thm ("if_False",ThmC.numerals_to_Free @{thm if_False})];
    5.81  
    5.82  val prog_expr = Auto_Prog.prep_rls @{theory} (Rule_Set.merge "list_erls"
    5.83  	(Rule_Def.Repeat {id = "replaced", preconds = [], rew_ord = ("termlessI", termlessI),
     6.1 --- a/src/Tools/isac/Knowledge/Biegelinie.thy	Mon Apr 13 13:27:55 2020 +0200
     6.2 +++ b/src/Tools/isac/Knowledge/Biegelinie.thy	Mon Apr 13 15:31:23 2020 +0200
     6.3 @@ -124,9 +124,9 @@
     6.4  				   Rule.Num_Calc("Groups.plus_class.plus", (**)eval_binop "#add_")
     6.5  				   ], 
     6.6  		srls = Rule_Set.Empty, calc = [], errpatts = [],
     6.7 -		rules = [Rule.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
     6.8 +		rules = [Rule.Thm ("NTH_CONS",ThmC.numerals_to_Free @{thm NTH_CONS}),
     6.9  			 Rule.Num_Calc("Groups.plus_class.plus", (**)eval_binop "#add_"),
    6.10 -			 Rule.Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}),
    6.11 +			 Rule.Thm ("NTH_NIL",ThmC.numerals_to_Free @{thm NTH_NIL}),
    6.12  			 Rule.Num_Calc("Prog_Expr.lhs", Prog_Expr.eval_lhs"eval_lhs_"),
    6.13  			 Rule.Num_Calc("Prog_Expr.rhs", Prog_Expr.eval_rhs"eval_rhs_"),
    6.14  			 Rule.Num_Calc("Prog_Expr.argument'_in", Prog_Expr.eval_argument_in "Prog_Expr.argument'_in")
    6.15 @@ -144,18 +144,18 @@
    6.16  			    Rule.Num_Calc("Groups.plus_class.plus", (**)eval_binop "#add_")
    6.17  			    ], 
    6.18  	 srls = Rule_Set.Empty, calc = [], errpatts = [],
    6.19 -	 rules = [Rule.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
    6.20 +	 rules = [Rule.Thm ("NTH_CONS",ThmC.numerals_to_Free @{thm NTH_CONS}),
    6.21  		  Rule.Num_Calc("Groups.plus_class.plus", (**)eval_binop "#add_"),
    6.22 -		  Rule.Thm ("NTH_NIL", TermC.num_str @{thm NTH_NIL}),
    6.23 +		  Rule.Thm ("NTH_NIL", ThmC.numerals_to_Free @{thm NTH_NIL}),
    6.24  		  Rule.Num_Calc("Prog_Expr.lhs", Prog_Expr.eval_lhs "eval_lhs_"),
    6.25  		  Rule.Num_Calc("Prog_Expr.filter'_sameFunId", Prog_Expr.eval_filter_sameFunId "Prog_Expr.filter'_sameFunId"),
    6.26  		  (*WN070514 just for smltest/../biegelinie.sml ...*)
    6.27  		  Rule.Num_Calc("Prog_Expr.sameFunId", Prog_Expr.eval_sameFunId "Prog_Expr.sameFunId"),
    6.28 -		  Rule.Thm ("filter_Cons", TermC.num_str @{thm filter_Cons}),
    6.29 -		  Rule.Thm ("filter_Nil", TermC.num_str @{thm filter_Nil}),
    6.30 -		  Rule.Thm ("if_True", TermC.num_str @{thm if_True}),
    6.31 -		  Rule.Thm ("if_False", TermC.num_str @{thm if_False}),
    6.32 -		  Rule.Thm ("hd_thm", TermC.num_str @{thm hd_thm})
    6.33 +		  Rule.Thm ("filter_Cons", ThmC.numerals_to_Free @{thm filter_Cons}),
    6.34 +		  Rule.Thm ("filter_Nil", ThmC.numerals_to_Free @{thm filter_Nil}),
    6.35 +		  Rule.Thm ("if_True", ThmC.numerals_to_Free @{thm if_True}),
    6.36 +		  Rule.Thm ("if_False", ThmC.numerals_to_Free @{thm if_False}),
    6.37 +		  Rule.Thm ("hd_thm", ThmC.numerals_to_Free @{thm hd_thm})
    6.38  		  ],
    6.39  	 scr = Rule.EmptyScr};
    6.40  \<close>
    6.41 @@ -196,15 +196,15 @@
    6.42  	      {rew_ord'="tless_true", 
    6.43  	        rls' = Rule_Set.append_rules "erls_IntegrierenUndK.." Rule_Set.empty 
    6.44  				      [Rule.Num_Calc ("Prog_Expr.ident", Prog_Expr.eval_ident "#ident_"),
    6.45 -				        Rule.Thm ("not_true",TermC.num_str @{thm not_true}),
    6.46 -				        Rule.Thm ("not_false",TermC.num_str @{thm not_false})], 
    6.47 +				        Rule.Thm ("not_true",ThmC.numerals_to_Free @{thm not_true}),
    6.48 +				        Rule.Thm ("not_false",ThmC.numerals_to_Free @{thm not_false})], 
    6.49  				  calc = [], 
    6.50  				  srls = Rule_Set.append_rules "erls_IntegrierenUndK.." Rule_Set.empty 
    6.51  				      [Rule.Num_Calc("Prog_Expr.rhs", Prog_Expr.eval_rhs"eval_rhs_"),
    6.52  				        Rule.Num_Calc ("Prog_Expr.ident", Prog_Expr.eval_ident "#ident_"),
    6.53 -				        Rule.Thm ("last_thmI",TermC.num_str @{thm last_thmI}),
    6.54 -				        Rule.Thm ("if_True",TermC.num_str @{thm if_True}),
    6.55 -				        Rule.Thm ("if_False",TermC.num_str @{thm if_False})],
    6.56 +				        Rule.Thm ("last_thmI",ThmC.numerals_to_Free @{thm last_thmI}),
    6.57 +				        Rule.Thm ("if_True",ThmC.numerals_to_Free @{thm if_True}),
    6.58 +				        Rule.Thm ("if_False",ThmC.numerals_to_Free @{thm if_False})],
    6.59  				  prls = Rule_Set.Empty, crls = Atools_erls, errpats = [], nrls = Rule_Set.Empty},
    6.60          @{thm biegelinie.simps})]
    6.61  \<close>
    6.62 @@ -262,8 +262,8 @@
    6.63  	      {rew_ord'="tless_true", 
    6.64  	        rls' = Rule_Set.append_rules "erls_ausBelastung" Rule_Set.empty 
    6.65  				      [Rule.Num_Calc ("Prog_Expr.ident", Prog_Expr.eval_ident "#ident_"),
    6.66 -				        Rule.Thm ("not_true", TermC.num_str @{thm not_true}),
    6.67 -				        Rule.Thm ("not_false", TermC.num_str @{thm not_false})], 
    6.68 +				        Rule.Thm ("not_true", ThmC.numerals_to_Free @{thm not_true}),
    6.69 +				        Rule.Thm ("not_false", ThmC.numerals_to_Free @{thm not_false})], 
    6.70  				  calc = [], 
    6.71  				  srls = Rule_Set.append_rules "srls_ausBelastung" Rule_Set.empty 
    6.72  				      [Rule.Num_Calc ("Prog_Expr.rhs", Prog_Expr.eval_rhs "eval_rhs_")], 
     7.1 --- a/src/Tools/isac/Knowledge/Diff.thy	Mon Apr 13 13:27:55 2020 +0200
     7.2 +++ b/src/Tools/isac/Knowledge/Diff.thy	Mon Apr 13 15:31:23 2020 +0200
     7.3 @@ -111,32 +111,32 @@
     7.4  	 rew_ord = ("termlessI",termlessI), 
     7.5  	 erls = Rule_Set.append_rules "erls_diff_conv" Rule_Set.empty 
     7.6  			   [Rule.Num_Calc ("Prog_Expr.occurs'_in", Prog_Expr.eval_occurs_in ""),
     7.7 -			    Rule.Thm ("not_true",TermC.num_str @{thm not_true}),
     7.8 -			    Rule.Thm ("not_false",TermC.num_str @{thm not_false}),
     7.9 +			    Rule.Thm ("not_true",ThmC.numerals_to_Free @{thm not_true}),
    7.10 +			    Rule.Thm ("not_false",ThmC.numerals_to_Free @{thm not_false}),
    7.11  			    Rule.Num_Calc ("Orderings.ord_class.less", Prog_Expr.eval_equ "#less_"),
    7.12 -			    Rule.Thm ("and_true",TermC.num_str @{thm and_true}),
    7.13 -			    Rule.Thm ("and_false",TermC.num_str @{thm and_false})
    7.14 +			    Rule.Thm ("and_true",ThmC.numerals_to_Free @{thm and_true}),
    7.15 +			    Rule.Thm ("and_false",ThmC.numerals_to_Free @{thm and_false})
    7.16  			    ], 
    7.17  	 srls = Rule_Set.Empty, calc = [], errpatts = [],
    7.18  	 rules =
    7.19 -  [Rule.Thm ("frac_conv", TermC.num_str @{thm frac_conv}),
    7.20 +  [Rule.Thm ("frac_conv", ThmC.numerals_to_Free @{thm frac_conv}),
    7.21       (*"?bdv occurs_in ?b \<Longrightarrow> 0 < ?n \<Longrightarrow> ?a / ?b ^^^ ?n = ?a * ?b ^^^ - ?n"*)
    7.22 -		   Rule.Thm ("sqrt_conv_bdv", TermC.num_str @{thm sqrt_conv_bdv}),
    7.23 +		   Rule.Thm ("sqrt_conv_bdv", ThmC.numerals_to_Free @{thm sqrt_conv_bdv}),
    7.24  		     (*"sqrt ?bdv = ?bdv ^^^ (1 / 2)"*)
    7.25 -		   Rule.Thm ("sqrt_conv_bdv_n", TermC.num_str @{thm sqrt_conv_bdv_n}),
    7.26 +		   Rule.Thm ("sqrt_conv_bdv_n", ThmC.numerals_to_Free @{thm sqrt_conv_bdv_n}),
    7.27  		     (*"sqrt (?bdv ^^^ ?n) = ?bdv ^^^ (?n / 2)"*)
    7.28 -		   Rule.Thm ("sqrt_conv", TermC.num_str @{thm sqrt_conv}),
    7.29 +		   Rule.Thm ("sqrt_conv", ThmC.numerals_to_Free @{thm sqrt_conv}),
    7.30  		     (*"?bdv occurs_in ?u \<Longrightarrow> sqrt ?u = ?u ^^^ (1 / 2)"*)
    7.31 -		   Rule.Thm ("root_conv", TermC.num_str @{thm root_conv}),
    7.32 +		   Rule.Thm ("root_conv", ThmC.numerals_to_Free @{thm root_conv}),
    7.33  		     (*"?bdv occurs_in ?u \<Longrightarrow> nroot ?n ?u = ?u ^^^ (1 / ?n)"*)
    7.34 -		   Rule.Thm ("realpow_pow_bdv", TermC.num_str @{thm realpow_pow_bdv}),
    7.35 +		   Rule.Thm ("realpow_pow_bdv", ThmC.numerals_to_Free @{thm realpow_pow_bdv}),
    7.36  		     (* "(?bdv ^^^ ?b) ^^^ ?c = ?bdv ^^^ (?b * ?c)"*)
    7.37  		   Rule.Num_Calc ("Groups.times_class.times", (**)eval_binop "#mult_"),
    7.38 -		   Rule.Thm ("rat_mult",TermC.num_str @{thm rat_mult}),
    7.39 +		   Rule.Thm ("rat_mult",ThmC.numerals_to_Free @{thm rat_mult}),
    7.40  		     (*a / b * (c / d) = a * c / (b * d)*)
    7.41 -		   Rule.Thm ("times_divide_eq_right",TermC.num_str @{thm times_divide_eq_right}),
    7.42 +		   Rule.Thm ("times_divide_eq_right",ThmC.numerals_to_Free @{thm times_divide_eq_right}),
    7.43  		     (*?x * (?y / ?z) = ?x * ?y / ?z*)
    7.44 -		   Rule.Thm ("times_divide_eq_left",TermC.num_str @{thm times_divide_eq_left})
    7.45 +		   Rule.Thm ("times_divide_eq_left",ThmC.numerals_to_Free @{thm times_divide_eq_left})
    7.46  		     (*?y / ?z * ?x = ?y * ?x / ?z*)
    7.47  		 ],
    7.48  	 scr = Rule.EmptyScr};
    7.49 @@ -151,17 +151,17 @@
    7.50  			   [Rule.Num_Calc ("Orderings.ord_class.less", Prog_Expr.eval_equ "#less_")
    7.51  			    ], 
    7.52  	 srls = Rule_Set.Empty, calc = [], errpatts = [],
    7.53 -	 rules = [Rule.Thm ("frac_sym_conv", TermC.num_str @{thm frac_sym_conv}),
    7.54 -		  Rule.Thm ("sqrt_sym_conv", TermC.num_str @{thm sqrt_sym_conv}),
    7.55 -		  Rule.Thm ("root_sym_conv", TermC.num_str @{thm root_sym_conv}),
    7.56 +	 rules = [Rule.Thm ("frac_sym_conv", ThmC.numerals_to_Free @{thm frac_sym_conv}),
    7.57 +		  Rule.Thm ("sqrt_sym_conv", ThmC.numerals_to_Free @{thm sqrt_sym_conv}),
    7.58 +		  Rule.Thm ("root_sym_conv", ThmC.numerals_to_Free @{thm root_sym_conv}),
    7.59  		  Rule.Thm ("sym_real_mult_minus1",
    7.60 -		       TermC.num_str (@{thm real_mult_minus1} RS @{thm sym})),
    7.61 +		       ThmC.numerals_to_Free (@{thm real_mult_minus1} RS @{thm sym})),
    7.62  		      (*- ?z = "-1 * ?z"*)
    7.63 -		  Rule.Thm ("rat_mult",TermC.num_str @{thm rat_mult}),
    7.64 +		  Rule.Thm ("rat_mult",ThmC.numerals_to_Free @{thm rat_mult}),
    7.65  		  (*a / b * (c / d) = a * c / (b * d)*)
    7.66 -		  Rule.Thm ("times_divide_eq_right",TermC.num_str @{thm times_divide_eq_right}),
    7.67 +		  Rule.Thm ("times_divide_eq_right",ThmC.numerals_to_Free @{thm times_divide_eq_right}),
    7.68  		  (*?x * (?y / ?z) = ?x * ?y / ?z*)
    7.69 -		  Rule.Thm ("times_divide_eq_left",TermC.num_str @{thm times_divide_eq_left}),
    7.70 +		  Rule.Thm ("times_divide_eq_left",ThmC.numerals_to_Free @{thm times_divide_eq_left}),
    7.71  		  (*?y / ?z * ?x = ?y * ?x / ?z*)
    7.72  		  Rule.Num_Calc ("Groups.times_class.times", (**)eval_binop "#mult_")
    7.73  		 ],
    7.74 @@ -184,8 +184,8 @@
    7.75  (*..*)
    7.76  val erls_diff = 
    7.77      Rule_Set.append_rules "erls_differentiate.." Rule_Set.empty
    7.78 -               [Rule.Thm ("not_true",TermC.num_str @{thm not_true}),
    7.79 -		Rule.Thm ("not_false",TermC.num_str @{thm not_false}),
    7.80 +               [Rule.Thm ("not_true",ThmC.numerals_to_Free @{thm not_true}),
    7.81 +		Rule.Thm ("not_false",ThmC.numerals_to_Free @{thm not_false}),
    7.82  		
    7.83  		Rule.Num_Calc ("Prog_Expr.ident", Prog_Expr.eval_ident "#ident_"),    
    7.84  		Rule.Num_Calc ("Prog_Expr.is'_atom", Prog_Expr.eval_is_atom "#is_atom_"),
    7.85 @@ -197,27 +197,27 @@
    7.86  val diff_rules =
    7.87      Rule_Def.Repeat {id="diff_rules", preconds = [], rew_ord = ("termlessI",termlessI), 
    7.88  	 erls = erls_diff, srls = Rule_Set.Empty, calc = [], errpatts = [],
    7.89 -	 rules = [Rule.Thm ("diff_sum",TermC.num_str @{thm diff_sum}),
    7.90 -		  Rule.Thm ("diff_dif",TermC.num_str @{thm diff_dif}),
    7.91 -		  Rule.Thm ("diff_prod_const",TermC.num_str @{thm diff_prod_const}),
    7.92 -		  Rule.Thm ("diff_prod",TermC.num_str @{thm diff_prod}),
    7.93 -		  Rule.Thm ("diff_quot",TermC.num_str @{thm diff_quot}),
    7.94 -		  Rule.Thm ("diff_sin",TermC.num_str @{thm diff_sin}),
    7.95 -		  Rule.Thm ("diff_sin_chain",TermC.num_str @{thm diff_sin_chain}),
    7.96 -		  Rule.Thm ("diff_cos",TermC.num_str @{thm diff_cos}),
    7.97 -		  Rule.Thm ("diff_cos_chain",TermC.num_str @{thm diff_cos_chain}),
    7.98 -		  Rule.Thm ("diff_pow",TermC.num_str @{thm diff_pow}),
    7.99 -		  Rule.Thm ("diff_pow_chain",TermC.num_str @{thm diff_pow_chain}),
   7.100 -		  Rule.Thm ("diff_ln",TermC.num_str @{thm diff_ln}),
   7.101 -		  Rule.Thm ("diff_ln_chain",TermC.num_str @{thm diff_ln_chain}),
   7.102 -		  Rule.Thm ("diff_exp",TermC.num_str @{thm diff_exp}),
   7.103 -		  Rule.Thm ("diff_exp_chain",TermC.num_str @{thm diff_exp_chain}),
   7.104 +	 rules = [Rule.Thm ("diff_sum",ThmC.numerals_to_Free @{thm diff_sum}),
   7.105 +		  Rule.Thm ("diff_dif",ThmC.numerals_to_Free @{thm diff_dif}),
   7.106 +		  Rule.Thm ("diff_prod_const",ThmC.numerals_to_Free @{thm diff_prod_const}),
   7.107 +		  Rule.Thm ("diff_prod",ThmC.numerals_to_Free @{thm diff_prod}),
   7.108 +		  Rule.Thm ("diff_quot",ThmC.numerals_to_Free @{thm diff_quot}),
   7.109 +		  Rule.Thm ("diff_sin",ThmC.numerals_to_Free @{thm diff_sin}),
   7.110 +		  Rule.Thm ("diff_sin_chain",ThmC.numerals_to_Free @{thm diff_sin_chain}),
   7.111 +		  Rule.Thm ("diff_cos",ThmC.numerals_to_Free @{thm diff_cos}),
   7.112 +		  Rule.Thm ("diff_cos_chain",ThmC.numerals_to_Free @{thm diff_cos_chain}),
   7.113 +		  Rule.Thm ("diff_pow",ThmC.numerals_to_Free @{thm diff_pow}),
   7.114 +		  Rule.Thm ("diff_pow_chain",ThmC.numerals_to_Free @{thm diff_pow_chain}),
   7.115 +		  Rule.Thm ("diff_ln",ThmC.numerals_to_Free @{thm diff_ln}),
   7.116 +		  Rule.Thm ("diff_ln_chain",ThmC.numerals_to_Free @{thm diff_ln_chain}),
   7.117 +		  Rule.Thm ("diff_exp",ThmC.numerals_to_Free @{thm diff_exp}),
   7.118 +		  Rule.Thm ("diff_exp_chain",ThmC.numerals_to_Free @{thm diff_exp_chain}),
   7.119  (*
   7.120 -		  Rule.Thm ("diff_sqrt",TermC.num_str @{thm diff_sqrt}),
   7.121 -		  Rule.Thm ("diff_sqrt_chain",TermC.num_str @{thm diff_sqrt_chain}),
   7.122 +		  Rule.Thm ("diff_sqrt",ThmC.numerals_to_Free @{thm diff_sqrt}),
   7.123 +		  Rule.Thm ("diff_sqrt_chain",ThmC.numerals_to_Free @{thm diff_sqrt_chain}),
   7.124  *)
   7.125 -		  Rule.Thm ("diff_const",TermC.num_str @{thm diff_const}),
   7.126 -		  Rule.Thm ("diff_var",TermC.num_str @{thm diff_var})
   7.127 +		  Rule.Thm ("diff_const",ThmC.numerals_to_Free @{thm diff_const}),
   7.128 +		  Rule.Thm ("diff_var",ThmC.numerals_to_Free @{thm diff_var})
   7.129  		  ],
   7.130  	 scr = Rule.EmptyScr};
   7.131  \<close>
     8.1 --- a/src/Tools/isac/Knowledge/DiffApp.thy	Mon Apr 13 13:27:55 2020 +0200
     8.2 +++ b/src/Tools/isac/Knowledge/DiffApp.thy	Mon Apr 13 15:31:23 2020 +0200
     8.3 @@ -37,17 +37,17 @@
     8.4  val eval_rls = prep_rls' (
     8.5    Rule_Def.Repeat {id = "eval_rls", preconds = [], rew_ord = ("termlessI", termlessI), 
     8.6      erls = Rule_Set.empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
     8.7 -    rules = [Rule.Thm ("refl", TermC.num_str @{thm refl}),
     8.8 -      Rule.Thm ("order_refl", TermC.num_str @{thm order_refl}),
     8.9 -      Rule.Thm ("radd_left_cancel_le", TermC.num_str @{thm radd_left_cancel_le}),
    8.10 -      Rule.Thm ("not_true", TermC.num_str @{thm not_true}),
    8.11 -      Rule.Thm ("not_false", TermC.num_str @{thm not_false}),
    8.12 -      Rule.Thm ("and_true", TermC.num_str @{thm and_true}),
    8.13 -      Rule.Thm ("and_false", TermC.num_str @{thm and_false}),
    8.14 -      Rule.Thm ("or_true", TermC.num_str @{thm or_true}),
    8.15 -      Rule.Thm ("or_false", TermC.num_str @{thm or_false}),
    8.16 -      Rule.Thm ("and_commute", TermC.num_str @{thm and_commute}),
    8.17 -      Rule.Thm ("or_commute", TermC.num_str @{thm or_commute}),
    8.18 +    rules = [Rule.Thm ("refl", ThmC.numerals_to_Free @{thm refl}),
    8.19 +      Rule.Thm ("order_refl", ThmC.numerals_to_Free @{thm order_refl}),
    8.20 +      Rule.Thm ("radd_left_cancel_le", ThmC.numerals_to_Free @{thm radd_left_cancel_le}),
    8.21 +      Rule.Thm ("not_true", ThmC.numerals_to_Free @{thm not_true}),
    8.22 +      Rule.Thm ("not_false", ThmC.numerals_to_Free @{thm not_false}),
    8.23 +      Rule.Thm ("and_true", ThmC.numerals_to_Free @{thm and_true}),
    8.24 +      Rule.Thm ("and_false", ThmC.numerals_to_Free @{thm and_false}),
    8.25 +      Rule.Thm ("or_true", ThmC.numerals_to_Free @{thm or_true}),
    8.26 +      Rule.Thm ("or_false", ThmC.numerals_to_Free @{thm or_false}),
    8.27 +      Rule.Thm ("and_commute", ThmC.numerals_to_Free @{thm and_commute}),
    8.28 +      Rule.Thm ("or_commute", ThmC.numerals_to_Free @{thm or_commute}),
    8.29        
    8.30        Rule.Num_Calc ("Orderings.ord_class.less", Prog_Expr.eval_equ "#less_"),
    8.31        Rule.Num_Calc ("Orderings.ord_class.less_eq", Prog_Expr.eval_equ "#less_equal_"),
    8.32 @@ -196,8 +196,8 @@
    8.33  \<close>
    8.34  ML \<open>
    8.35  val prog_expr = Rule_Set.append_rules "prog_expr" prog_expr
    8.36 -  [Rule.Thm ("filterVar_Const", TermC.num_str @{thm filterVar_Const}),
    8.37 -   Rule.Thm ("filterVar_Nil", TermC.num_str @{thm filterVar_Nil})];
    8.38 +  [Rule.Thm ("filterVar_Const", ThmC.numerals_to_Free @{thm filterVar_Const}),
    8.39 +   Rule.Thm ("filterVar_Nil", ThmC.numerals_to_Free @{thm filterVar_Nil})];
    8.40  \<close>
    8.41  setup \<open>KEStore_Elems.add_rlss [("prog_expr", (Context.theory_name @{theory}, prog_expr))]\<close>
    8.42  
     9.1 --- a/src/Tools/isac/Knowledge/EqSystem.thy	Mon Apr 13 13:27:55 2020 +0200
     9.2 +++ b/src/Tools/isac/Knowledge/EqSystem.thy	Mon Apr 13 15:31:23 2020 +0200
     9.3 @@ -174,17 +174,17 @@
     9.4        rew_ord = ("ord_simplify_System",
     9.5  		 ord_simplify_System false @{theory "Integrate"}),
     9.6        erls = Rule_Set.empty,srls = Rule_Set.Empty, calc = [], errpatts = [],
     9.7 -      rules = [Rule.Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
     9.8 +      rules = [Rule.Thm ("mult_commute",ThmC.numerals_to_Free @{thm mult.commute}),
     9.9  	       (* z * w = w * z *)
    9.10 -	       Rule.Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
    9.11 +	       Rule.Thm ("real_mult_left_commute",ThmC.numerals_to_Free @{thm real_mult_left_commute}),
    9.12  	       (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*)
    9.13 -	       Rule.Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),		
    9.14 +	       Rule.Thm ("mult_assoc",ThmC.numerals_to_Free @{thm mult.assoc}),		
    9.15  	       (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*)
    9.16 -	       Rule.Thm ("add_commute",TermC.num_str @{thm add.commute}),	
    9.17 +	       Rule.Thm ("add_commute",ThmC.numerals_to_Free @{thm add.commute}),	
    9.18  	       (*z + w = w + z*)
    9.19 -	       Rule.Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}),
    9.20 +	       Rule.Thm ("add_left_commute",ThmC.numerals_to_Free @{thm add.left_commute}),
    9.21  	       (*x + (y + z) = y + (x + z)*)
    9.22 -	       Rule.Thm ("add_assoc",TermC.num_str @{thm add.assoc})	               
    9.23 +	       Rule.Thm ("add_assoc",ThmC.numerals_to_Free @{thm add.assoc})	               
    9.24  	       (*z1.0 + z2.0 + z3.0 = z1.0 + (z2.0 + z3.0)*)
    9.25  	       ], 
    9.26        scr = Rule.EmptyScr};
    9.27 @@ -246,15 +246,15 @@
    9.28    Rule_Set.Seqence {id = "simplify_System_parenthesized", preconds = []:term list, 
    9.29         rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
    9.30        erls = Atools_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
    9.31 -      rules = [Rule.Thm ("distrib_right",TermC.num_str @{thm distrib_right}),
    9.32 +      rules = [Rule.Thm ("distrib_right",ThmC.numerals_to_Free @{thm distrib_right}),
    9.33   	       (*"(?z1.0 + ?z2.0) * ?w = ?z1.0 * ?w + ?z2.0 * ?w"*)
    9.34 -	       Rule.Thm ("add_divide_distrib",TermC.num_str @{thm add_divide_distrib}),
    9.35 +	       Rule.Thm ("add_divide_distrib",ThmC.numerals_to_Free @{thm add_divide_distrib}),
    9.36   	       (*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"*)
    9.37  	       (*^^^^^ *0* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*)
    9.38  	       Rule.Rls_ norm_Rational_noadd_fractions(**2**),
    9.39  	       Rule.Rls_ (*order_add_mult_in*) norm_System_noadd_fractions (**1**),
    9.40  	       Rule.Thm ("sym_mult_assoc",
    9.41 -                     TermC.num_str (@{thm mult.assoc} RS @{thm sym}))
    9.42 +                     ThmC.numerals_to_Free (@{thm mult.assoc} RS @{thm sym}))
    9.43  	       (*Rule.Rls_ discard_parentheses *3**),
    9.44  	       Rule.Rls_ collect_bdv, (*from make_polynomial_in WN051031 welldone?*)
    9.45  	       Rule.Rls_ separate_bdv2,
    9.46 @@ -283,7 +283,7 @@
    9.47  val simplify_System = 
    9.48      Rule_Set.append_rules "simplify_System" simplify_System_parenthesized
    9.49  	       [Rule.Thm ("sym_add_assoc",
    9.50 -                      TermC.num_str (@{thm add.assoc} RS @{thm sym}))];
    9.51 +                      ThmC.numerals_to_Free (@{thm add.assoc} RS @{thm sym}))];
    9.52  *)
    9.53  \<close>
    9.54  ML \<open>
    9.55 @@ -297,9 +297,9 @@
    9.56  			    ], 
    9.57  			   srls = Rule_Set.Empty, calc = [], errpatts = [],
    9.58  	      rules = 
    9.59 -             [Rule.Thm ("commute_0_equality", TermC.num_str @{thm commute_0_equality}),
    9.60 -	      Rule.Thm ("separate_bdvs_add", TermC.num_str @{thm separate_bdvs_add}),
    9.61 -	      Rule.Thm ("separate_bdvs_mult", TermC.num_str @{thm separate_bdvs_mult})],
    9.62 +             [Rule.Thm ("commute_0_equality", ThmC.numerals_to_Free @{thm commute_0_equality}),
    9.63 +	      Rule.Thm ("separate_bdvs_add", ThmC.numerals_to_Free @{thm separate_bdvs_add}),
    9.64 +	      Rule.Thm ("separate_bdvs_mult", ThmC.numerals_to_Free @{thm separate_bdvs_mult})],
    9.65  	      scr = Rule.EmptyScr};
    9.66  \<close>
    9.67  ML \<open>
    9.68 @@ -312,15 +312,15 @@
    9.69  			   eval_occur_exactly_in "#eval_occur_exactly_in_"),
    9.70  		     Rule.Num_Calc ("Prog_Expr.ident", Prog_Expr.eval_ident "#ident_"),
    9.71  		     Rule.Num_Calc ("Prog_Expr.some'_occur'_in", Prog_Expr.eval_some_occur_in "#some_occur_in_"),
    9.72 -         Rule.Thm ("not_true",TermC.num_str @{thm not_true}),
    9.73 -		     Rule.Thm ("not_false",TermC.num_str @{thm not_false})
    9.74 +         Rule.Thm ("not_true",ThmC.numerals_to_Free @{thm not_true}),
    9.75 +		     Rule.Thm ("not_false",ThmC.numerals_to_Free @{thm not_false})
    9.76  			    ], 
    9.77  	 srls = Rule_Set.Empty, calc = [], errpatts = [],
    9.78 -	 rules = [Rule.Thm ("commute_0_equality", TermC.num_str @{thm commute_0_equality}),
    9.79 -		  Rule.Thm ("separate_bdvs0", TermC.num_str @{thm separate_bdvs0}),
    9.80 -		  Rule.Thm ("separate_bdvs_add1", TermC.num_str @{thm separate_bdvs_add1}),
    9.81 -		  Rule.Thm ("separate_bdvs_add1", TermC.num_str @{thm separate_bdvs_add2}),
    9.82 -		  Rule.Thm ("separate_bdvs_mult", TermC.num_str @{thm separate_bdvs_mult})
    9.83 +	 rules = [Rule.Thm ("commute_0_equality", ThmC.numerals_to_Free @{thm commute_0_equality}),
    9.84 +		  Rule.Thm ("separate_bdvs0", ThmC.numerals_to_Free @{thm separate_bdvs0}),
    9.85 +		  Rule.Thm ("separate_bdvs_add1", ThmC.numerals_to_Free @{thm separate_bdvs_add1}),
    9.86 +		  Rule.Thm ("separate_bdvs_add1", ThmC.numerals_to_Free @{thm separate_bdvs_add2}),
    9.87 +		  Rule.Thm ("separate_bdvs_mult", ThmC.numerals_to_Free @{thm separate_bdvs_mult})
    9.88                   ], scr = Rule.EmptyScr};
    9.89  
    9.90  \<close>
    9.91 @@ -333,7 +333,7 @@
    9.92  	 rew_ord = ("ord_simplify_System", 
    9.93  		    ord_simplify_System false thy), 
    9.94  	 erls = Rule_Set.Empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
    9.95 -	 rules = [Rule.Thm ("order_system_NxN", TermC.num_str @{thm order_system_NxN})
    9.96 +	 rules = [Rule.Thm ("order_system_NxN", ThmC.numerals_to_Free @{thm order_system_NxN})
    9.97  		  ],
    9.98  	 scr = Rule.EmptyScr};
    9.99  
   9.100 @@ -351,11 +351,11 @@
   9.101  			      ],
   9.102  		     scr = Rule.EmptyScr}, 
   9.103  	 srls = Rule_Set.Empty, calc = [], errpatts = [],
   9.104 -	 rules = [Rule.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
   9.105 +	 rules = [Rule.Thm ("NTH_CONS",ThmC.numerals_to_Free @{thm NTH_CONS}),
   9.106  		  Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"),
   9.107 -		  Rule.Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}),
   9.108 -		  Rule.Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}),
   9.109 -		  Rule.Thm ("tl_Nil",TermC.num_str @{thm tl_Nil}),
   9.110 +		  Rule.Thm ("NTH_NIL",ThmC.numerals_to_Free @{thm NTH_NIL}),
   9.111 +		  Rule.Thm ("tl_Cons",ThmC.numerals_to_Free @{thm tl_Cons}),
   9.112 +		  Rule.Thm ("tl_Nil",ThmC.numerals_to_Free @{thm tl_Nil}),
   9.113  		  Rule.Num_Calc ("EqSystem.occur'_exactly'_in", 
   9.114  			eval_occur_exactly_in 
   9.115  			    "#eval_occur_exactly_in_")
   9.116 @@ -380,11 +380,11 @@
   9.117  			      ],
   9.118  		     scr = Rule.EmptyScr}, 
   9.119  	 srls = Rule_Set.Empty, calc = [], errpatts = [],
   9.120 -	 rules = [Rule.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
   9.121 +	 rules = [Rule.Thm ("NTH_CONS",ThmC.numerals_to_Free @{thm NTH_CONS}),
   9.122  		  Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"),
   9.123 -		  Rule.Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}),
   9.124 -		  Rule.Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}),
   9.125 -		  Rule.Thm ("tl_Nil",TermC.num_str @{thm tl_Nil}),
   9.126 +		  Rule.Thm ("NTH_NIL",ThmC.numerals_to_Free @{thm NTH_NIL}),
   9.127 +		  Rule.Thm ("tl_Cons",ThmC.numerals_to_Free @{thm tl_Cons}),
   9.128 +		  Rule.Thm ("tl_Nil",ThmC.numerals_to_Free @{thm tl_Nil}),
   9.129  		  Rule.Num_Calc ("EqSystem.occur'_exactly'_in", 
   9.130  			eval_occur_exactly_in 
   9.131  			    "#eval_occur_exactly_in_")
   9.132 @@ -424,8 +424,8 @@
   9.133            ("#Where"  ,["LENGTH (e_s:: bool list) = 2", "LENGTH v_s = 2"]),
   9.134            ("#Find"  ,["solution ss'''"])],
   9.135          Rule_Set.append_rules "prls_2x2_linear_system" Rule_Set.empty 
   9.136 -			    [Rule.Thm ("LENGTH_CONS",TermC.num_str @{thm LENGTH_CONS}),
   9.137 -			      Rule.Thm ("LENGTH_NIL",TermC.num_str @{thm LENGTH_NIL}),
   9.138 +			    [Rule.Thm ("LENGTH_CONS",ThmC.numerals_to_Free @{thm LENGTH_CONS}),
   9.139 +			      Rule.Thm ("LENGTH_NIL",ThmC.numerals_to_Free @{thm LENGTH_NIL}),
   9.140  			      Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"),
   9.141  			      Rule.Num_Calc ("HOL.eq", Prog_Expr.eval_equal "#equal_")], 
   9.142          SOME "solveSystem e_s v_s", [])),
   9.143 @@ -451,8 +451,8 @@
   9.144            ("#Where"  ,["LENGTH (e_s:: bool list) = 3", "LENGTH v_s = 3"]),
   9.145            ("#Find"  ,["solution ss'''"])],
   9.146          Rule_Set.append_rules "prls_3x3_linear_system" Rule_Set.empty 
   9.147 -			    [Rule.Thm ("LENGTH_CONS",TermC.num_str @{thm LENGTH_CONS}),
   9.148 -			      Rule.Thm ("LENGTH_NIL",TermC.num_str @{thm LENGTH_NIL}),
   9.149 +			    [Rule.Thm ("LENGTH_CONS",ThmC.numerals_to_Free @{thm LENGTH_CONS}),
   9.150 +			      Rule.Thm ("LENGTH_NIL",ThmC.numerals_to_Free @{thm LENGTH_NIL}),
   9.151  			      Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"),
   9.152  			      Rule.Num_Calc ("HOL.eq", Prog_Expr.eval_equal "#equal_")],
   9.153          SOME "solveSystem e_s v_s", [])),
   9.154 @@ -463,8 +463,8 @@
   9.155            ("#Where"  ,["LENGTH (e_s:: bool list) = 4", "LENGTH v_s = 4"]),
   9.156            ("#Find"  ,["solution ss'''"])],
   9.157          Rule_Set.append_rules "prls_4x4_linear_system" Rule_Set.empty 
   9.158 -			    [Rule.Thm ("LENGTH_CONS",TermC.num_str @{thm LENGTH_CONS}),
   9.159 -			      Rule.Thm ("LENGTH_NIL",TermC.num_str @{thm LENGTH_NIL}),
   9.160 +			    [Rule.Thm ("LENGTH_CONS",ThmC.numerals_to_Free @{thm LENGTH_CONS}),
   9.161 +			      Rule.Thm ("LENGTH_NIL",ThmC.numerals_to_Free @{thm LENGTH_NIL}),
   9.162  			      Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"),
   9.163  			      Rule.Num_Calc ("HOL.eq", Prog_Expr.eval_equal "#equal_")],
   9.164          SOME "solveSystem e_s v_s", [])),
   9.165 @@ -502,9 +502,9 @@
   9.166  				   Rule.Num_Calc("Groups.plus_class.plus", (**)eval_binop "#add_")
   9.167  				   ], 
   9.168  		srls = Rule_Set.Empty, calc = [], errpatts = [],
   9.169 -		rules = [Rule.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
   9.170 +		rules = [Rule.Thm ("NTH_CONS",ThmC.numerals_to_Free @{thm NTH_CONS}),
   9.171  			 Rule.Num_Calc("Groups.plus_class.plus", (**)eval_binop "#add_"),
   9.172 -			 Rule.Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL})],
   9.173 +			 Rule.Thm ("NTH_NIL",ThmC.numerals_to_Free @{thm NTH_NIL})],
   9.174  		scr = Rule.EmptyScr};
   9.175  \<close>
   9.176  
   9.177 @@ -551,9 +551,9 @@
   9.178            ("#Find"  ,["solution ss'''"])],
   9.179  	      {rew_ord'="ord_simplify_System", rls' = Rule_Set.Empty, calc = [], 
   9.180  	        srls = Rule_Set.append_rules "srls_top_down_2x2" Rule_Set.empty
   9.181 -				      [Rule.Thm ("hd_thm",TermC.num_str @{thm hd_thm}),
   9.182 -				        Rule.Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}),
   9.183 -				        Rule.Thm ("tl_Nil",TermC.num_str @{thm tl_Nil})], 
   9.184 +				      [Rule.Thm ("hd_thm",ThmC.numerals_to_Free @{thm hd_thm}),
   9.185 +				        Rule.Thm ("tl_Cons",ThmC.numerals_to_Free @{thm tl_Cons}),
   9.186 +				        Rule.Thm ("tl_Nil",ThmC.numerals_to_Free @{thm tl_Nil})], 
   9.187  	        prls = prls_triangular, crls = Rule_Set.Empty, errpats = [], nrls = Rule_Set.Empty},
   9.188  	      @{thm solve_system.simps})]
   9.189  \<close>
   9.190 @@ -586,9 +586,9 @@
   9.191  		      ("#Find"  ,["solution ss'''"])],
   9.192  	      {rew_ord'="tless_true", rls' = Rule_Set.Empty, calc = [], 
   9.193  	        srls = Rule_Set.append_rules "srls_normalise_2x2" Rule_Set.empty
   9.194 -				      [Rule.Thm ("hd_thm",TermC.num_str @{thm hd_thm}),
   9.195 -				        Rule.Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}),
   9.196 -				        Rule.Thm ("tl_Nil",TermC.num_str @{thm tl_Nil})], 
   9.197 +				      [Rule.Thm ("hd_thm",ThmC.numerals_to_Free @{thm hd_thm}),
   9.198 +				        Rule.Thm ("tl_Cons",ThmC.numerals_to_Free @{thm tl_Cons}),
   9.199 +				        Rule.Thm ("tl_Nil",ThmC.numerals_to_Free @{thm tl_Nil})], 
   9.200  		      prls = Rule_Set.Empty, crls = Rule_Set.Empty, errpats = [], nrls = Rule_Set.Empty},
   9.201  		    @{thm solve_system2.simps})]
   9.202  \<close>
   9.203 @@ -618,9 +618,9 @@
   9.204  	         ("#Find"  ,["solution ss'''"])],
   9.205  	       {rew_ord'="tless_true", rls' = Rule_Set.Empty, calc = [], 
   9.206  	         srls = Rule_Set.append_rules "srls_normalise_4x4" srls
   9.207 -	             [Rule.Thm ("hd_thm",TermC.num_str @{thm hd_thm}),
   9.208 -	               Rule.Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}),
   9.209 -	               Rule.Thm ("tl_Nil",TermC.num_str @{thm tl_Nil})], 
   9.210 +	             [Rule.Thm ("hd_thm",ThmC.numerals_to_Free @{thm hd_thm}),
   9.211 +	               Rule.Thm ("tl_Cons",ThmC.numerals_to_Free @{thm tl_Cons}),
   9.212 +	               Rule.Thm ("tl_Nil",ThmC.numerals_to_Free @{thm tl_Nil})], 
   9.213  		       prls = Rule_Set.Empty, crls = Rule_Set.Empty, errpats = [], nrls = Rule_Set.Empty},
   9.214  		     (*STOPPED.WN06? met ["EqSystem","normalise","4x4"] #>#>#>#>#>#>#>#>#>#>#>#>#>@*)
   9.215  		     @{thm solve_system3.simps})]
    10.1 --- a/src/Tools/isac/Knowledge/Integrate.thy	Mon Apr 13 13:27:55 2020 +0200
    10.2 +++ b/src/Tools/isac/Knowledge/Integrate.thy	Mon Apr 13 15:31:23 2020 +0200
    10.3 @@ -119,17 +119,17 @@
    10.4  		     srls = Rule_Set.Empty, calc = [], errpatts = [],
    10.5  		     rules = [(*for rewriting conditions in Thm's*)
    10.6  			      Rule.Num_Calc ("Prog_Expr.occurs'_in", Prog_Expr.eval_occurs_in "#occurs_in_"),
    10.7 -			      Rule.Thm ("not_true", TermC.num_str @{thm not_true}),
    10.8 +			      Rule.Thm ("not_true", ThmC.numerals_to_Free @{thm not_true}),
    10.9  			      Rule.Thm ("not_false",@{thm not_false})
   10.10  			      ],
   10.11  		     scr = Rule.EmptyScr}, 
   10.12  	 srls = Rule_Set.Empty, calc = [], errpatts = [],
   10.13  	 rules = [
   10.14 -		  Rule.Thm ("integral_const", TermC.num_str @{thm integral_const}),
   10.15 -		  Rule.Thm ("integral_var", TermC.num_str @{thm integral_var}),
   10.16 -		  Rule.Thm ("integral_add", TermC.num_str @{thm integral_add}),
   10.17 -		  Rule.Thm ("integral_mult", TermC.num_str @{thm integral_mult}),
   10.18 -		  Rule.Thm ("integral_pow", TermC.num_str @{thm integral_pow}),
   10.19 +		  Rule.Thm ("integral_const", ThmC.numerals_to_Free @{thm integral_const}),
   10.20 +		  Rule.Thm ("integral_var", ThmC.numerals_to_Free @{thm integral_var}),
   10.21 +		  Rule.Thm ("integral_add", ThmC.numerals_to_Free @{thm integral_add}),
   10.22 +		  Rule.Thm ("integral_mult", ThmC.numerals_to_Free @{thm integral_mult}),
   10.23 +		  Rule.Thm ("integral_pow", ThmC.numerals_to_Free @{thm integral_pow}),
   10.24  		  Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_")(*for n+1*)
   10.25  		  ],
   10.26  	 scr = Rule.EmptyScr};
   10.27 @@ -146,12 +146,12 @@
   10.28  		     rules = [Rule.Num_Calc ("Prog_Expr.matches", Prog_Expr.eval_matches""),
   10.29  			      Rule.Num_Calc ("Integrate.is'_f'_x", 
   10.30  				    eval_is_f_x "is_f_x_"),
   10.31 -			      Rule.Thm ("not_true", TermC.num_str @{thm not_true}),
   10.32 -			      Rule.Thm ("not_false", TermC.num_str @{thm not_false})
   10.33 +			      Rule.Thm ("not_true", ThmC.numerals_to_Free @{thm not_true}),
   10.34 +			      Rule.Thm ("not_false", ThmC.numerals_to_Free @{thm not_false})
   10.35  			      ],
   10.36  		     scr = Rule.EmptyScr}, 
   10.37  	 srls = Rule_Set.Empty, calc = [], errpatts = [],
   10.38 -	 rules = [ (*Rule.Thm ("call_for_new_c", TermC.num_str @{thm call_for_new_c}),*)
   10.39 +	 rules = [ (*Rule.Thm ("call_for_new_c", ThmC.numerals_to_Free @{thm call_for_new_c}),*)
   10.40  		   Rule.Cal1 ("Integrate.add'_new'_c", eval_add_new_c "new_c_")
   10.41  		   ],
   10.42  	 scr = Rule.EmptyScr};
   10.43 @@ -174,25 +174,25 @@
   10.44  				  [Rule.Num_Calc ("Poly.is'_polyexp", 
   10.45  					 eval_is_polyexp "")],
   10.46  				  srls = Rule_Set.Empty, calc = [], errpatts = [],
   10.47 -				  rules = [Rule.Thm ("rat_mult", TermC.num_str @{thm rat_mult}),
   10.48 +				  rules = [Rule.Thm ("rat_mult", ThmC.numerals_to_Free @{thm rat_mult}),
   10.49  	       (*"?a / ?b * (?c / ?d) = ?a * ?c / (?b * ?d)"*)
   10.50 -	       Rule.Thm ("rat_mult_poly_l", TermC.num_str @{thm rat_mult_poly_l}),
   10.51 +	       Rule.Thm ("rat_mult_poly_l", ThmC.numerals_to_Free @{thm rat_mult_poly_l}),
   10.52  	       (*"?c is_polyexp ==> ?c * (?a / ?b) = ?c * ?a / ?b"*)
   10.53 -	       Rule.Thm ("rat_mult_poly_r", TermC.num_str @{thm rat_mult_poly_r}),
   10.54 +	       Rule.Thm ("rat_mult_poly_r", ThmC.numerals_to_Free @{thm rat_mult_poly_r}),
   10.55  	       (*"?c is_polyexp ==> ?a / ?b * ?c = ?a * ?c / ?b"*)
   10.56  
   10.57  	       Rule.Thm ("real_divide_divide1_mg",
   10.58 -                     TermC.num_str @{thm real_divide_divide1_mg}),
   10.59 +                     ThmC.numerals_to_Free @{thm real_divide_divide1_mg}),
   10.60  	       (*"y ~= 0 ==> (u / v) / (y / z) = (u * z) / (y * v)"*)
   10.61  	       Rule.Thm ("divide_divide_eq_right", 
   10.62 -                     TermC.num_str @{thm divide_divide_eq_right}),
   10.63 +                     ThmC.numerals_to_Free @{thm divide_divide_eq_right}),
   10.64  	       (*"?x / (?y / ?z) = ?x * ?z / ?y"*)
   10.65  	       Rule.Thm ("divide_divide_eq_left",
   10.66 -                     TermC.num_str @{thm divide_divide_eq_left}),
   10.67 +                     ThmC.numerals_to_Free @{thm divide_divide_eq_left}),
   10.68  	       (*"?x / ?y / ?z = ?x / (?y * ?z)"*)
   10.69  	       Rule.Num_Calc ("Rings.divide_class.divide", Prog_Expr.eval_cancel "#divide_e"),
   10.70  	      
   10.71 -	       Rule.Thm ("rat_power", TermC.num_str @{thm rat_power})
   10.72 +	       Rule.Thm ("rat_power", ThmC.numerals_to_Free @{thm rat_power})
   10.73  		(*"(?a / ?b) ^^^ ?n = ?a ^^^ ?n / ?b ^^^ ?n"*)
   10.74  	       ],
   10.75        scr = Rule.EmptyScr
   10.76 @@ -228,15 +228,15 @@
   10.77  val separate_bdv2 =
   10.78      Rule_Set.append_rules "separate_bdv2"
   10.79  	       collect_bdv
   10.80 -	       [Rule.Thm ("separate_bdv", TermC.num_str @{thm separate_bdv}),
   10.81 +	       [Rule.Thm ("separate_bdv", ThmC.numerals_to_Free @{thm separate_bdv}),
   10.82  		(*"?a * ?bdv / ?b = ?a / ?b * ?bdv"*)
   10.83 -		Rule.Thm ("separate_bdv_n", TermC.num_str @{thm separate_bdv_n}),
   10.84 -		Rule.Thm ("separate_1_bdv",  TermC.num_str @{thm separate_1_bdv}),
   10.85 +		Rule.Thm ("separate_bdv_n", ThmC.numerals_to_Free @{thm separate_bdv_n}),
   10.86 +		Rule.Thm ("separate_1_bdv",  ThmC.numerals_to_Free @{thm separate_1_bdv}),
   10.87  		(*"?bdv / ?b = (1 / ?b) * ?bdv"*)
   10.88 -		Rule.Thm ("separate_1_bdv_n",  TermC.num_str @{thm separate_1_bdv_n})(*,
   10.89 +		Rule.Thm ("separate_1_bdv_n",  ThmC.numerals_to_Free @{thm separate_1_bdv_n})(*,
   10.90  			  (*"?bdv ^^^ ?n / ?b = 1 / ?b * ?bdv ^^^ ?n"*)
   10.91  			  *****Rule.Thm ("add_divide_distrib", 
   10.92 -			  ***** TermC.num_str @{thm add_divide_distrib})
   10.93 +			  ***** ThmC.numerals_to_Free @{thm add_divide_distrib})
   10.94  			  (*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"*)----------*)
   10.95  		];
   10.96  val simplify_Integral = 
   10.97 @@ -244,9 +244,9 @@
   10.98         rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
   10.99        erls = Atools_erls, srls = Rule_Set.Empty,
  10.100        calc = [],  errpatts = [],
  10.101 -      rules = [Rule.Thm ("distrib_right", TermC.num_str @{thm distrib_right}),
  10.102 +      rules = [Rule.Thm ("distrib_right", ThmC.numerals_to_Free @{thm distrib_right}),
  10.103   	       (*"(?z1.0 + ?z2.0) * ?w = ?z1.0 * ?w + ?z2.0 * ?w"*)
  10.104 -	       Rule.Thm ("add_divide_distrib", TermC.num_str @{thm add_divide_distrib}),
  10.105 +	       Rule.Thm ("add_divide_distrib", ThmC.numerals_to_Free @{thm add_divide_distrib}),
  10.106   	       (*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"*)
  10.107  	       (*^^^^^ *1* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*)
  10.108  	       Rule.Rls_ norm_Rational_noadd_fractions,
  10.109 @@ -275,21 +275,21 @@
  10.110  * 	       Rule.Rls_ simplify_power,
  10.111  * 	       Rule.Rls_ collect_numerals,
  10.112  * 	       Rule.Rls_ reduce_012,
  10.113 -* 	       Rule.Thm ("realpow_oneI", TermC.num_str @{thm realpow_oneI}),
  10.114 +* 	       Rule.Thm ("realpow_oneI", ThmC.numerals_to_Free @{thm realpow_oneI}),
  10.115  * 	       Rule.Rls_ discard_parentheses,
  10.116  * 	       Rule.Rls_ collect_bdv,
  10.117  * 	       (*below inserted from 'make_ratpoly_in'*)
  10.118  * 	       Rule.Rls_ (Rule_Set.append_rules "separate_bdv"
  10.119  * 			 collect_bdv
  10.120 -* 			 [Rule.Thm ("separate_bdv", TermC.num_str @{thm separate_bdv}),
  10.121 +* 			 [Rule.Thm ("separate_bdv", ThmC.numerals_to_Free @{thm separate_bdv}),
  10.122  * 			  (*"?a * ?bdv / ?b = ?a / ?b * ?bdv"*)
  10.123 -* 			  Rule.Thm ("separate_bdv_n", TermC.num_str @{thm separate_bdv_n}),
  10.124 -* 			  Rule.Thm ("separate_1_bdv", TermC.num_str @{thm separate_1_bdv}),
  10.125 +* 			  Rule.Thm ("separate_bdv_n", ThmC.numerals_to_Free @{thm separate_bdv_n}),
  10.126 +* 			  Rule.Thm ("separate_1_bdv", ThmC.numerals_to_Free @{thm separate_1_bdv}),
  10.127  * 			  (*"?bdv / ?b = (1 / ?b) * ?bdv"*)
  10.128 -* 			  Rule.Thm ("separate_1_bdv_n", TermC.num_str @{thm separate_1_bdv_n})(*,
  10.129 +* 			  Rule.Thm ("separate_1_bdv_n", ThmC.numerals_to_Free @{thm separate_1_bdv_n})(*,
  10.130  * 			  (*"?bdv ^^^ ?n / ?b = 1 / ?b * ?bdv ^^^ ?n"*)
  10.131  * 			  Rule.Thm ("add_divide_distrib", 
  10.132 -* 				  TermC.num_str @{thm add_divide_distrib})
  10.133 +* 				  ThmC.numerals_to_Free @{thm add_divide_distrib})
  10.134  * 			   (*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"*)*)
  10.135  * 			  ]),
  10.136  * 	       Rule.Num_Calc ("Rings.divide_class.divide"  , eval_cancel "#divide_e")
    11.1 --- a/src/Tools/isac/Knowledge/LinEq.thy	Mon Apr 13 13:27:55 2020 +0200
    11.2 +++ b/src/Tools/isac/Knowledge/LinEq.thy	Mon Apr 13 15:31:23 2020 +0200
    11.3 @@ -35,17 +35,17 @@
    11.4   	      Rule.Num_Calc ("Poly.is'_polyrat'_in", eval_is_polyrat_in ""),
    11.5  	      Rule.Num_Calc ("Prog_Expr.occurs'_in", Prog_Expr.eval_occurs_in ""),    
    11.6  	      Rule.Num_Calc ("Prog_Expr.ident", Prog_Expr.eval_ident "#ident_"),
    11.7 -	      Rule.Thm ("not_true",TermC.num_str @{thm not_true}),
    11.8 -	      Rule.Thm ("not_false",TermC.num_str @{thm not_false}),
    11.9 -	      Rule.Thm ("and_true",TermC.num_str @{thm and_true}),
   11.10 -	      Rule.Thm ("and_false",TermC.num_str @{thm and_false}),
   11.11 -	      Rule.Thm ("or_true",TermC.num_str @{thm or_true}),
   11.12 -	      Rule.Thm ("or_false",TermC.num_str @{thm or_false})
   11.13 +	      Rule.Thm ("not_true",ThmC.numerals_to_Free @{thm not_true}),
   11.14 +	      Rule.Thm ("not_false",ThmC.numerals_to_Free @{thm not_false}),
   11.15 +	      Rule.Thm ("and_true",ThmC.numerals_to_Free @{thm and_true}),
   11.16 +	      Rule.Thm ("and_false",ThmC.numerals_to_Free @{thm and_false}),
   11.17 +	      Rule.Thm ("or_true",ThmC.numerals_to_Free @{thm or_true}),
   11.18 +	      Rule.Thm ("or_false",ThmC.numerals_to_Free @{thm or_false})
   11.19                ];
   11.20  (* ----- erls ----- *)
   11.21  val LinEq_crls = 
   11.22     Rule_Set.append_rules "LinEq_crls" poly_crls
   11.23 -   [Rule.Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1})
   11.24 +   [Rule.Thm  ("real_assoc_1",ThmC.numerals_to_Free @{thm real_assoc_1})
   11.25      (*		
   11.26       Don't use
   11.27       Rule.Num_Calc ("Rings.divide_class.divide", Prog_Expr.eval_cancel "#divide_e"),
   11.28 @@ -56,7 +56,7 @@
   11.29  (* ----- crls ----- *)
   11.30  val LinEq_erls = 
   11.31     Rule_Set.append_rules "LinEq_erls" Poly_erls
   11.32 -   [Rule.Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1})
   11.33 +   [Rule.Thm  ("real_assoc_1",ThmC.numerals_to_Free @{thm real_assoc_1})
   11.34      (*		
   11.35       Don't use
   11.36       Rule.Num_Calc ("Rings.divide_class.divide", Prog_Expr.eval_cancel "#divide_e"),
   11.37 @@ -75,7 +75,7 @@
   11.38         srls = Rule_Set.Empty, 
   11.39         calc = [], errpatts = [],
   11.40         rules = [
   11.41 -		Rule.Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1}),
   11.42 +		Rule.Thm  ("real_assoc_1",ThmC.numerals_to_Free @{thm real_assoc_1}),
   11.43  		Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"),
   11.44  		Rule.Num_Calc ("Groups.minus_class.minus", (**)eval_binop "#sub_"),
   11.45  		Rule.Num_Calc ("Groups.times_class.times", (**)eval_binop "#mult_"),
   11.46 @@ -99,11 +99,11 @@
   11.47       srls = Rule_Set.Empty,
   11.48       calc = [], errpatts = [],
   11.49       rules = [
   11.50 -	      Rule.Thm("lin_isolate_add1",TermC.num_str @{thm lin_isolate_add1}), 
   11.51 +	      Rule.Thm("lin_isolate_add1",ThmC.numerals_to_Free @{thm lin_isolate_add1}), 
   11.52  	      (* a+bx=0 -> bx=-a *)
   11.53 -	      Rule.Thm("lin_isolate_add2",TermC.num_str @{thm lin_isolate_add2}), 
   11.54 +	      Rule.Thm("lin_isolate_add2",ThmC.numerals_to_Free @{thm lin_isolate_add2}), 
   11.55  	      (* a+ x=0 ->  x=-a *)
   11.56 -	      Rule.Thm("lin_isolate_div",TermC.num_str @{thm lin_isolate_div})    
   11.57 +	      Rule.Thm("lin_isolate_div",ThmC.numerals_to_Free @{thm lin_isolate_div})    
   11.58  	      (*   bx=c -> x=c/b *)  
   11.59  	      ],
   11.60       scr = Rule.EmptyScr});
    12.1 --- a/src/Tools/isac/Knowledge/Partial_Fractions.thy	Mon Apr 13 13:27:55 2020 +0200
    12.2 +++ b/src/Tools/isac/Knowledge/Partial_Fractions.thy	Mon Apr 13 15:31:23 2020 +0200
    12.3 @@ -109,8 +109,8 @@
    12.4    Rule_Def.Repeat {id = "ansatz_rls", preconds = [], rew_ord = ("dummy_ord",Rewrite_Ord.dummy_ord), 
    12.5  	  erls = Rule_Set.Empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
    12.6  	  rules = 
    12.7 -	   [Rule.Thm ("ansatz_2nd_order",TermC.num_str @{thm ansatz_2nd_order}),
    12.8 -	    Rule.Thm ("ansatz_3rd_order",TermC.num_str @{thm ansatz_3rd_order})
    12.9 +	   [Rule.Thm ("ansatz_2nd_order",ThmC.numerals_to_Free @{thm ansatz_2nd_order}),
   12.10 +	    Rule.Thm ("ansatz_3rd_order",ThmC.numerals_to_Free @{thm ansatz_3rd_order})
   12.11  	   ], 
   12.12  	 scr = Rule.EmptyScr});
   12.13  
   12.14 @@ -118,8 +118,8 @@
   12.15    Rule_Def.Repeat {id = "equival_trans", preconds = [], rew_ord = ("dummy_ord",Rewrite_Ord.dummy_ord), 
   12.16  	  erls = Rule_Set.Empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
   12.17  	  rules = 
   12.18 -	   [Rule.Thm ("equival_trans_2nd_order",TermC.num_str @{thm equival_trans_2nd_order}),
   12.19 -	    Rule.Thm ("equival_trans_3rd_order",TermC.num_str @{thm equival_trans_3rd_order})
   12.20 +	   [Rule.Thm ("equival_trans_2nd_order",ThmC.numerals_to_Free @{thm equival_trans_2nd_order}),
   12.21 +	    Rule.Thm ("equival_trans_3rd_order",ThmC.numerals_to_Free @{thm equival_trans_3rd_order})
   12.22  	   ], 
   12.23  	 scr = Rule.EmptyScr});
   12.24  
   12.25 @@ -128,7 +128,7 @@
   12.26  	  erls = Rule_Set.Empty,
   12.27  	  srls = Rule_Set.Empty, calc = [], errpatts = [],
   12.28  	  rules = 
   12.29 -	   [Rule.Thm ("multiply_2nd_order",TermC.num_str @{thm multiply_2nd_order})
   12.30 +	   [Rule.Thm ("multiply_2nd_order",ThmC.numerals_to_Free @{thm multiply_2nd_order})
   12.31  	   ], 
   12.32  	 scr = Rule.EmptyScr});
   12.33  \<close>
   12.34 @@ -173,9 +173,9 @@
   12.35         Rule.Num_Calc("Groups.plus_class.plus", (**)eval_binop "#add_")], 
   12.36      srls = Rule_Set.Empty, calc = [], errpatts = [],
   12.37      rules = [
   12.38 -       Rule.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
   12.39 +       Rule.Thm ("NTH_CONS",ThmC.numerals_to_Free @{thm NTH_CONS}),
   12.40         Rule.Num_Calc("Groups.plus_class.plus", (**)eval_binop "#add_"),
   12.41 -       Rule.Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}),
   12.42 +       Rule.Thm ("NTH_NIL",ThmC.numerals_to_Free @{thm NTH_NIL}),
   12.43         Rule.Num_Calc("Prog_Expr.lhs", Prog_Expr.eval_lhs "eval_lhs_"),
   12.44         Rule.Num_Calc("Prog_Expr.rhs", Prog_Expr.eval_rhs"eval_rhs_"),
   12.45         Rule.Num_Calc("Prog_Expr.argument'_in", Prog_Expr.eval_argument_in "Prog_Expr.argument'_in"),
    13.1 --- a/src/Tools/isac/Knowledge/Poly.thy	Mon Apr 13 13:27:55 2020 +0200
    13.2 +++ b/src/Tools/isac/Knowledge/Poly.thy	Mon Apr 13 15:31:23 2020 +0200
    13.3 @@ -653,7 +653,7 @@
    13.4  (*.for evaluation of conditions in rewrite rules.*)
    13.5  val Poly_erls = Rule_Set.append_rules "Poly_erls" Atools_erls
    13.6    [Rule.Num_Calc ("HOL.eq", Prog_Expr.eval_equal "#equal_"),
    13.7 -  Rule.Thm  ("real_unari_minus", TermC.num_str @{thm real_unari_minus}),
    13.8 +  Rule.Thm  ("real_unari_minus", ThmC.numerals_to_Free @{thm real_unari_minus}),
    13.9    Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"),
   13.10    Rule.Num_Calc ("Groups.minus_class.minus", (**)eval_binop "#sub_"),
   13.11    Rule.Num_Calc ("Groups.times_class.times", (**)eval_binop "#mult_"),
   13.12 @@ -661,7 +661,7 @@
   13.13  
   13.14  val poly_crls = Rule_Set.append_rules "poly_crls" Atools_crls
   13.15    [Rule.Num_Calc ("HOL.eq", Prog_Expr.eval_equal "#equal_"),
   13.16 -  Rule.Thm ("real_unari_minus", TermC.num_str @{thm real_unari_minus}),
   13.17 +  Rule.Thm ("real_unari_minus", ThmC.numerals_to_Free @{thm real_unari_minus}),
   13.18    Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"),
   13.19    Rule.Num_Calc ("Groups.minus_class.minus", (**)eval_binop "#sub_"),
   13.20    Rule.Num_Calc ("Groups.times_class.times", (**)eval_binop "#mult_"),
   13.21 @@ -671,9 +671,9 @@
   13.22  val expand =
   13.23    Rule_Def.Repeat {id = "expand", preconds = [], rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
   13.24        erls = Rule_Set.empty,srls = Rule_Set.Empty, calc = [], errpatts = [],
   13.25 -      rules = [Rule.Thm ("distrib_right" , TermC.num_str @{thm distrib_right}),
   13.26 +      rules = [Rule.Thm ("distrib_right" , ThmC.numerals_to_Free @{thm distrib_right}),
   13.27  	       (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
   13.28 -	       Rule.Thm ("distrib_left", TermC.num_str @{thm distrib_left})
   13.29 +	       Rule.Thm ("distrib_left", ThmC.numerals_to_Free @{thm distrib_left})
   13.30  	       (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
   13.31  	       ], scr = Rule.EmptyScr};
   13.32  
   13.33 @@ -681,9 +681,9 @@
   13.34    Rule_Def.Repeat {id = "discard_minus", preconds = [], rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
   13.35        erls = Rule_Set.empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
   13.36        rules =
   13.37 -       [Rule.Thm ("real_diff_minus", TermC.num_str @{thm real_diff_minus}),
   13.38 +       [Rule.Thm ("real_diff_minus", ThmC.numerals_to_Free @{thm real_diff_minus}),
   13.39            (*"a - b = a + -1 * b"*)
   13.40 -	        Rule.Thm ("sym_real_mult_minus1", TermC.num_str (@{thm real_mult_minus1} RS @{thm sym}))
   13.41 +	        Rule.Thm ("sym_real_mult_minus1", ThmC.numerals_to_Free (@{thm real_mult_minus1} RS @{thm sym}))
   13.42  	          (*- ?z = "-1 * ?z"*)],
   13.43  	      scr = Rule.EmptyScr};
   13.44  
   13.45 @@ -693,31 +693,31 @@
   13.46        erls = Rule_Set.empty,srls = Rule_Set.Empty,
   13.47        calc = [], errpatts = [],
   13.48        rules =
   13.49 -        [Rule.Thm ("real_plus_binom_pow4", TermC.num_str @{thm real_plus_binom_pow4}),
   13.50 +        [Rule.Thm ("real_plus_binom_pow4", ThmC.numerals_to_Free @{thm real_plus_binom_pow4}),
   13.51  	           (*"(a + b)^^^4 = ... "*)
   13.52 -	         Rule.Thm ("real_plus_binom_pow5",TermC.num_str @{thm real_plus_binom_pow5}),
   13.53 +	         Rule.Thm ("real_plus_binom_pow5",ThmC.numerals_to_Free @{thm real_plus_binom_pow5}),
   13.54  	           (*"(a + b)^^^5 = ... "*)
   13.55 -	         Rule.Thm ("real_plus_binom_pow3",TermC.num_str @{thm real_plus_binom_pow3}),
   13.56 +	         Rule.Thm ("real_plus_binom_pow3",ThmC.numerals_to_Free @{thm real_plus_binom_pow3}),
   13.57  	           (*"(a + b)^^^3 = a^^^3 + 3*a^^^2*b + 3*a*b^^^2 + b^^^3" *)
   13.58  	         (*WN071229 changed/removed for Schaerding -----vvv*)
   13.59 -	         (*Rule.Thm ("real_plus_binom_pow2",TermC.num_str @{thm real_plus_binom_pow2}),*)
   13.60 +	         (*Rule.Thm ("real_plus_binom_pow2",ThmC.numerals_to_Free @{thm real_plus_binom_pow2}),*)
   13.61  	           (*"(a + b)^^^2 = a^^^2 + 2*a*b + b^^^2"*)
   13.62 -	         Rule.Thm ("real_plus_binom_pow2",TermC.num_str @{thm real_plus_binom_pow2}),
   13.63 +	         Rule.Thm ("real_plus_binom_pow2",ThmC.numerals_to_Free @{thm real_plus_binom_pow2}),
   13.64  	           (*"(a + b)^^^2 = (a + b) * (a + b)"*)
   13.65 -	         (*Rule.Thm ("real_plus_minus_binom1_p_p", TermC.num_str @{thm real_plus_minus_binom1_p_p}),*)
   13.66 +	         (*Rule.Thm ("real_plus_minus_binom1_p_p", ThmC.numerals_to_Free @{thm real_plus_minus_binom1_p_p}),*)
   13.67  	           (*"(a + b)*(a + -1 * b) = a^^^2 + -1*b^^^2"*)
   13.68 -	         (*Rule.Thm ("real_plus_minus_binom2_p_p", TermC.num_str @{thm real_plus_minus_binom2_p_p}),*)
   13.69 +	         (*Rule.Thm ("real_plus_minus_binom2_p_p", ThmC.numerals_to_Free @{thm real_plus_minus_binom2_p_p}),*)
   13.70  	           (*"(a + -1 * b)*(a + b) = a^^^2 + -1*b^^^2"*)
   13.71  	         (*WN071229 changed/removed for Schaerding -----^^^*)
   13.72  	      
   13.73 -	         Rule.Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),
   13.74 +	         Rule.Thm ("distrib_right" ,ThmC.numerals_to_Free @{thm distrib_right}),
   13.75  	           (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
   13.76 -	         Rule.Thm ("distrib_left",TermC.num_str @{thm distrib_left}),
   13.77 +	         Rule.Thm ("distrib_left",ThmC.numerals_to_Free @{thm distrib_left}),
   13.78  	           (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
   13.79  	       
   13.80 -	         Rule.Thm ("realpow_multI", TermC.num_str @{thm realpow_multI}),
   13.81 +	         Rule.Thm ("realpow_multI", ThmC.numerals_to_Free @{thm realpow_multI}),
   13.82  	           (*"(r * s) ^^^ n = r ^^^ n * s ^^^ n"*)
   13.83 -	         Rule.Thm ("realpow_pow",TermC.num_str @{thm realpow_pow})
   13.84 +	         Rule.Thm ("realpow_pow",ThmC.numerals_to_Free @{thm realpow_pow})
   13.85  	           (*"(a ^^^ b) ^^^ c = a ^^^ (b * c)"*)
   13.86  	       ], scr = Rule.EmptyScr};
   13.87  
   13.88 @@ -730,32 +730,32 @@
   13.89        srls = Rule_Set.Empty,
   13.90        calc = [], errpatts = [],
   13.91        rules = 
   13.92 -        [Rule.Thm ("real_plus_binom_pow4_poly", TermC.num_str @{thm real_plus_binom_pow4_poly}),
   13.93 +        [Rule.Thm ("real_plus_binom_pow4_poly", ThmC.numerals_to_Free @{thm real_plus_binom_pow4_poly}),
   13.94  	     (*"[| a is_polyexp; b is_polyexp |] ==> (a + b)^^^4 = ... "*)
   13.95 -	 Rule.Thm ("real_plus_binom_pow5_poly", TermC.num_str @{thm real_plus_binom_pow5_poly}),
   13.96 +	 Rule.Thm ("real_plus_binom_pow5_poly", ThmC.numerals_to_Free @{thm real_plus_binom_pow5_poly}),
   13.97  	     (*"[| a is_polyexp; b is_polyexp |] ==> (a + b)^^^5 = ... "*)
   13.98 -	 Rule.Thm ("real_plus_binom_pow2_poly",TermC.num_str @{thm real_plus_binom_pow2_poly}),
   13.99 +	 Rule.Thm ("real_plus_binom_pow2_poly",ThmC.numerals_to_Free @{thm real_plus_binom_pow2_poly}),
  13.100  	     (*"[| a is_polyexp; b is_polyexp |] ==>
  13.101  		            (a + b)^^^2 = a^^^2 + 2*a*b + b^^^2"*)
  13.102 -	 Rule.Thm ("real_plus_binom_pow3_poly",TermC.num_str @{thm real_plus_binom_pow3_poly}),
  13.103 +	 Rule.Thm ("real_plus_binom_pow3_poly",ThmC.numerals_to_Free @{thm real_plus_binom_pow3_poly}),
  13.104  	     (*"[| a is_polyexp; b is_polyexp |] ==> 
  13.105  			(a + b)^^^3 = a^^^3 + 3*a^^^2*b + 3*a*b^^^2 + b^^^3" *)
  13.106 -	 Rule.Thm ("real_plus_minus_binom1_p_p",TermC.num_str @{thm real_plus_minus_binom1_p_p}),
  13.107 +	 Rule.Thm ("real_plus_minus_binom1_p_p",ThmC.numerals_to_Free @{thm real_plus_minus_binom1_p_p}),
  13.108  	     (*"(a + b)*(a + -1 * b) = a^^^2 + -1*b^^^2"*)
  13.109 -	 Rule.Thm ("real_plus_minus_binom2_p_p",TermC.num_str @{thm real_plus_minus_binom2_p_p}),
  13.110 +	 Rule.Thm ("real_plus_minus_binom2_p_p",ThmC.numerals_to_Free @{thm real_plus_minus_binom2_p_p}),
  13.111  	     (*"(a + -1 * b)*(a + b) = a^^^2 + -1*b^^^2"*)
  13.112  	      
  13.113  	 Rule.Thm ("real_add_mult_distrib_poly",
  13.114 -               TermC.num_str @{thm real_add_mult_distrib_poly}),
  13.115 +               ThmC.numerals_to_Free @{thm real_add_mult_distrib_poly}),
  13.116  	       (*"w is_polyexp ==> (z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  13.117  	 Rule.Thm("real_add_mult_distrib2_poly",
  13.118 -              TermC.num_str @{thm real_add_mult_distrib2_poly}),
  13.119 +              ThmC.numerals_to_Free @{thm real_add_mult_distrib2_poly}),
  13.120  	     (*"w is_polyexp ==> w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  13.121  	       
  13.122 -	 Rule.Thm ("realpow_multI_poly", TermC.num_str @{thm realpow_multI_poly}),
  13.123 +	 Rule.Thm ("realpow_multI_poly", ThmC.numerals_to_Free @{thm realpow_multI_poly}),
  13.124  	     (*"[| r is_polyexp; s is_polyexp |] ==> 
  13.125  		            (r * s) ^^^ n = r ^^^ n * s ^^^ n"*)
  13.126 -	  Rule.Thm ("realpow_pow",TermC.num_str @{thm realpow_pow})
  13.127 +	  Rule.Thm ("realpow_pow",ThmC.numerals_to_Free @{thm realpow_pow})
  13.128  	      (*"(a ^^^ b) ^^^ c = a ^^^ (b * c)"*)
  13.129  	 ], scr = Rule.EmptyScr};
  13.130  
  13.131 @@ -767,30 +767,30 @@
  13.132        rules = [(*MG: Reihenfolge der folgenden 2 Rule.Thm muss so bleiben, wegen
  13.133  		a*(a*a) --> a*a^^^2 und nicht a*(a*a) --> a^^^2*a *)
  13.134  	       Rule.Thm ("sym_realpow_twoI",
  13.135 -                     TermC.num_str (@{thm realpow_twoI} RS @{thm sym})),	
  13.136 +                     ThmC.numerals_to_Free (@{thm realpow_twoI} RS @{thm sym})),	
  13.137  	       (*"r * r = r ^^^ 2"*)
  13.138 -	       Rule.Thm ("realpow_twoI_assoc_l",TermC.num_str @{thm realpow_twoI_assoc_l}),
  13.139 +	       Rule.Thm ("realpow_twoI_assoc_l",ThmC.numerals_to_Free @{thm realpow_twoI_assoc_l}),
  13.140  	       (*"r * (r * s) = r ^^^ 2 * s"*)
  13.141  
  13.142 -	       Rule.Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),		
  13.143 +	       Rule.Thm ("realpow_plus_1",ThmC.numerals_to_Free @{thm realpow_plus_1}),		
  13.144  	       (*"r * r ^^^ n = r ^^^ (n + 1)"*)
  13.145  	       Rule.Thm ("realpow_plus_1_assoc_l",
  13.146 -                     TermC.num_str @{thm realpow_plus_1_assoc_l}),
  13.147 +                     ThmC.numerals_to_Free @{thm realpow_plus_1_assoc_l}),
  13.148  	       (*"r * (r ^^^ m * s) = r ^^^ (1 + m) * s"*)
  13.149  	       (*MG 9.7.03: neues Rule.Thm wegen a*(a*(a*b)) --> a^^^2*(a*b) *)
  13.150  	       Rule.Thm ("realpow_plus_1_assoc_l2",
  13.151 -                     TermC.num_str @{thm realpow_plus_1_assoc_l2}),
  13.152 +                     ThmC.numerals_to_Free @{thm realpow_plus_1_assoc_l2}),
  13.153  	       (*"r ^^^ m * (r * s) = r ^^^ (1 + m) * s"*)
  13.154  
  13.155  	       Rule.Thm ("sym_realpow_addI",
  13.156 -               TermC.num_str (@{thm realpow_addI} RS @{thm sym})),
  13.157 +               ThmC.numerals_to_Free (@{thm realpow_addI} RS @{thm sym})),
  13.158  	       (*"r ^^^ n * r ^^^ m = r ^^^ (n + m)"*)
  13.159 -	       Rule.Thm ("realpow_addI_assoc_l",TermC.num_str @{thm realpow_addI_assoc_l}),
  13.160 +	       Rule.Thm ("realpow_addI_assoc_l",ThmC.numerals_to_Free @{thm realpow_addI_assoc_l}),
  13.161  	       (*"r ^^^ n * (r ^^^ m * s) = r ^^^ (n + m) * s"*)
  13.162  	       
  13.163  	       (* ist in expand_poly - wird hier aber auch gebraucht, wegen: 
  13.164  		  "r * r = r ^^^ 2" wenn r=a^^^b*)
  13.165 -	       Rule.Thm ("realpow_pow",TermC.num_str @{thm realpow_pow})
  13.166 +	       Rule.Thm ("realpow_pow",ThmC.numerals_to_Free @{thm realpow_pow})
  13.167  	       (*"(a ^^^ b) ^^^ c = a ^^^ (b * c)"*)
  13.168  	       ], scr = Rule.EmptyScr};
  13.169  
  13.170 @@ -814,13 +814,13 @@
  13.171        erls = Rule_Set.empty,srls = Rule_Set.Empty,
  13.172        calc = [], errpatts = [],
  13.173        rules = [(* MG: folgende Rule.Thm müssen hier stehen bleiben: *)
  13.174 -               Rule.Thm ("mult_1_right",TermC.num_str @{thm mult_1_right}),
  13.175 +               Rule.Thm ("mult_1_right",ThmC.numerals_to_Free @{thm mult_1_right}),
  13.176  	       (*"z * 1 = z"*) (*wegen "a * b * b^^^(-1) + a"*) 
  13.177 -	       Rule.Thm ("realpow_zeroI",TermC.num_str @{thm realpow_zeroI}),
  13.178 +	       Rule.Thm ("realpow_zeroI",ThmC.numerals_to_Free @{thm realpow_zeroI}),
  13.179  	       (*"r ^^^ 0 = 1"*) (*wegen "a*a^^^(-1)*c + b + c"*)
  13.180 -	       Rule.Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}),
  13.181 +	       Rule.Thm ("realpow_oneI",ThmC.numerals_to_Free @{thm realpow_oneI}),
  13.182  	       (*"r ^^^ 1 = r"*)
  13.183 -	       Rule.Thm ("realpow_eq_oneI",TermC.num_str @{thm realpow_eq_oneI})
  13.184 +	       Rule.Thm ("realpow_eq_oneI",ThmC.numerals_to_Free @{thm realpow_eq_oneI})
  13.185  	       (*"1 ^^^ n = 1"*)
  13.186  	       ], scr = Rule.EmptyScr};
  13.187  
  13.188 @@ -831,23 +831,23 @@
  13.189        calc = [("PLUS"  , ("Groups.plus_class.plus", (**)eval_binop "#add_"))
  13.190  	      ], errpatts = [],
  13.191        rules = 
  13.192 -        [Rule.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  13.193 +        [Rule.Thm ("real_num_collect",ThmC.numerals_to_Free @{thm real_num_collect}), 
  13.194  	     (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
  13.195 -	 Rule.Thm ("real_num_collect_assoc_r",TermC.num_str @{thm real_num_collect_assoc_r}),
  13.196 +	 Rule.Thm ("real_num_collect_assoc_r",ThmC.numerals_to_Free @{thm real_num_collect_assoc_r}),
  13.197  	     (*"[| l is_const; m is_const |] ==>  \
  13.198  					\(k + m * n) + l * n = k + (l + m)*n"*)
  13.199 -	 Rule.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),	
  13.200 +	 Rule.Thm ("real_one_collect",ThmC.numerals_to_Free @{thm real_one_collect}),	
  13.201  	     (*"m is_const ==> n + m * n = (1 + m) * n"*)
  13.202 -	 Rule.Thm ("real_one_collect_assoc_r",TermC.num_str @{thm real_one_collect_assoc_r}), 
  13.203 +	 Rule.Thm ("real_one_collect_assoc_r",ThmC.numerals_to_Free @{thm real_one_collect_assoc_r}), 
  13.204  	     (*"m is_const ==> (k + n) + m * n = k + (m + 1) * n"*)
  13.205  
  13.206           Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"),
  13.207  
  13.208  	 (*MG: Reihenfolge der folgenden 2 Rule.Thm muss so bleiben, wegen
  13.209  		     (a+a)+a --> a + 2*a --> 3*a and not (a+a)+a --> 2*a + a *)
  13.210 -         Rule.Thm ("real_mult_2_assoc_r",TermC.num_str @{thm real_mult_2_assoc_r}),
  13.211 +         Rule.Thm ("real_mult_2_assoc_r",ThmC.numerals_to_Free @{thm real_mult_2_assoc_r}),
  13.212  	     (*"(k + z1) + z1 = k + 2 * z1"*)
  13.213 -	 Rule.Thm ("sym_real_mult_2",TermC.num_str (@{thm real_mult_2} RS @{thm sym}))
  13.214 +	 Rule.Thm ("sym_real_mult_2",ThmC.numerals_to_Free (@{thm real_mult_2} RS @{thm sym}))
  13.215  	     (*"z1 + z1 = 2 * z1"*)
  13.216  	], scr = Rule.EmptyScr};
  13.217  
  13.218 @@ -855,30 +855,30 @@
  13.219    Rule_Def.Repeat{id = "reduce_012_", preconds = [], 
  13.220        rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  13.221        erls = Rule_Set.empty,srls = Rule_Set.Empty, calc = [], errpatts = [],
  13.222 -      rules = [Rule.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),                 
  13.223 +      rules = [Rule.Thm ("mult_1_left",ThmC.numerals_to_Free @{thm mult_1_left}),                 
  13.224  	       (*"1 * z = z"*)
  13.225 -	       Rule.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),        
  13.226 +	       Rule.Thm ("mult_zero_left",ThmC.numerals_to_Free @{thm mult_zero_left}),        
  13.227  	       (*"0 * z = 0"*)
  13.228 -	       Rule.Thm ("mult_zero_right",TermC.num_str @{thm mult_zero_right}),
  13.229 +	       Rule.Thm ("mult_zero_right",ThmC.numerals_to_Free @{thm mult_zero_right}),
  13.230  	       (*"z * 0 = 0"*)
  13.231 -	       Rule.Thm ("add_0_left",TermC.num_str @{thm add_0_left}),
  13.232 +	       Rule.Thm ("add_0_left",ThmC.numerals_to_Free @{thm add_0_left}),
  13.233  	       (*"0 + z = z"*)
  13.234 -	       Rule.Thm ("add_0_right",TermC.num_str @{thm add_0_right}),
  13.235 +	       Rule.Thm ("add_0_right",ThmC.numerals_to_Free @{thm add_0_right}),
  13.236  	       (*"z + 0 = z"*) (*wegen a+b-b --> a+(1-1)*b --> a+0 --> a*)
  13.237  
  13.238 -	       (*Rule.Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI})*)
  13.239 +	       (*Rule.Thm ("realpow_oneI",ThmC.numerals_to_Free @{thm realpow_oneI})*)
  13.240  	       (*"?r ^^^ 1 = ?r"*)
  13.241 -	       Rule.Thm ("division_ring_divide_zero",TermC.num_str @{thm division_ring_divide_zero})
  13.242 +	       Rule.Thm ("division_ring_divide_zero",ThmC.numerals_to_Free @{thm division_ring_divide_zero})
  13.243  	       (*"0 / ?x = 0"*)
  13.244  	       ], scr = Rule.EmptyScr};
  13.245  
  13.246  val discard_parentheses1 = 
  13.247      Rule_Set.append_rules "discard_parentheses1" Rule_Set.empty 
  13.248  	       [Rule.Thm ("sym_mult_assoc",
  13.249 -                      TermC.num_str (@{thm mult.assoc} RS @{thm sym}))
  13.250 +                      ThmC.numerals_to_Free (@{thm mult.assoc} RS @{thm sym}))
  13.251  		(*"?z1.1 * (?z2.1 * ?z3.1) = ?z1.1 * ?z2.1 * ?z3.1"*)
  13.252  		(*Rule.Thm ("sym_add_assoc",
  13.253 -                        TermC.num_str (@{thm add_assoc} RS @{thm sym}))*)
  13.254 +                        ThmC.numerals_to_Free (@{thm add_assoc} RS @{thm sym}))*)
  13.255  		(*"?z1.1 + (?z2.1 + ?z3.1) = ?z1.1 + ?z2.1 + ?z3.1"*)
  13.256  		 ];
  13.257  
  13.258 @@ -888,36 +888,36 @@
  13.259        erls = Rule_Set.empty,srls = Rule_Set.Empty,
  13.260        calc = [], errpatts = [],
  13.261        (*asm_thm = [],*)
  13.262 -      rules = [Rule.Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),
  13.263 +      rules = [Rule.Thm ("distrib_right" ,ThmC.numerals_to_Free @{thm distrib_right}),
  13.264  	       (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  13.265 -	       Rule.Thm ("distrib_left",TermC.num_str @{thm distrib_left}),
  13.266 +	       Rule.Thm ("distrib_left",ThmC.numerals_to_Free @{thm distrib_left}),
  13.267  	       (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  13.268 -	       (*Rule.Thm ("distrib_right1",TermC.num_str @{thm distrib_right}1),
  13.269 +	       (*Rule.Thm ("distrib_right1",ThmC.numerals_to_Free @{thm distrib_right}1),
  13.270  		....... 18.3.03 undefined???*)
  13.271  
  13.272 -	       Rule.Thm ("real_plus_binom_pow2",TermC.num_str @{thm real_plus_binom_pow2}),
  13.273 +	       Rule.Thm ("real_plus_binom_pow2",ThmC.numerals_to_Free @{thm real_plus_binom_pow2}),
  13.274  	       (*"(a + b)^^^2 = a^^^2 + 2*a*b + b^^^2"*)
  13.275 -	       Rule.Thm ("real_minus_binom_pow2_p",TermC.num_str @{thm real_minus_binom_pow2_p}),
  13.276 +	       Rule.Thm ("real_minus_binom_pow2_p",ThmC.numerals_to_Free @{thm real_minus_binom_pow2_p}),
  13.277  	       (*"(a - b)^^^2 = a^^^2 + -2*a*b + b^^^2"*)
  13.278  	       Rule.Thm ("real_plus_minus_binom1_p",
  13.279 -		    TermC.num_str @{thm real_plus_minus_binom1_p}),
  13.280 +		    ThmC.numerals_to_Free @{thm real_plus_minus_binom1_p}),
  13.281  	       (*"(a + b)*(a - b) = a^^^2 + -1*b^^^2"*)
  13.282  	       Rule.Thm ("real_plus_minus_binom2_p",
  13.283 -		    TermC.num_str @{thm real_plus_minus_binom2_p}),
  13.284 +		    ThmC.numerals_to_Free @{thm real_plus_minus_binom2_p}),
  13.285  	       (*"(a - b)*(a + b) = a^^^2 + -1*b^^^2"*)
  13.286  
  13.287 -	       Rule.Thm ("minus_minus",TermC.num_str @{thm minus_minus}),
  13.288 +	       Rule.Thm ("minus_minus",ThmC.numerals_to_Free @{thm minus_minus}),
  13.289  	       (*"- (- ?z) = ?z"*)
  13.290 -	       Rule.Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}),
  13.291 +	       Rule.Thm ("real_diff_minus",ThmC.numerals_to_Free @{thm real_diff_minus}),
  13.292  	       (*"a - b = a + -1 * b"*)
  13.293  	       Rule.Thm ("sym_real_mult_minus1",
  13.294 -                     TermC.num_str (@{thm real_mult_minus1} RS @{thm sym}))
  13.295 +                     ThmC.numerals_to_Free (@{thm real_mult_minus1} RS @{thm sym}))
  13.296  	       (*- ?z = "-1 * ?z"*)
  13.297  
  13.298  	       (*Rule.Thm ("real_minus_add_distrib",
  13.299 -		      TermC.num_str @{thm real_minus_add_distrib}),*)
  13.300 +		      ThmC.numerals_to_Free @{thm real_minus_add_distrib}),*)
  13.301  	       (*"- (?x + ?y) = - ?x + - ?y"*)
  13.302 -	       (*Rule.Thm ("real_diff_plus",TermC.num_str @{thm real_diff_plus})*)
  13.303 +	       (*Rule.Thm ("real_diff_plus",ThmC.numerals_to_Free @{thm real_diff_plus})*)
  13.304  	       (*"a - b = a + -b"*)
  13.305  	       ], scr = Rule.EmptyScr};
  13.306  
  13.307 @@ -926,22 +926,22 @@
  13.308        rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  13.309        erls = Rule_Set.empty, srls = Rule_Set.Empty,
  13.310        calc = [], errpatts = [],
  13.311 -      rules = [Rule.Thm ("realpow_multI", TermC.num_str @{thm realpow_multI}),
  13.312 +      rules = [Rule.Thm ("realpow_multI", ThmC.numerals_to_Free @{thm realpow_multI}),
  13.313  	       (*"(r * s) ^^^ n = r ^^^ n * s ^^^ n"*)
  13.314  	       
  13.315  	       Rule.Thm ("sym_realpow_twoI",
  13.316 -                     TermC.num_str( @{thm realpow_twoI} RS @{thm sym})),	
  13.317 +                     ThmC.numerals_to_Free( @{thm realpow_twoI} RS @{thm sym})),	
  13.318  	       (*"r1 * r1 = r1 ^^^ 2"*)
  13.319 -	       Rule.Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),		
  13.320 +	       Rule.Thm ("realpow_plus_1",ThmC.numerals_to_Free @{thm realpow_plus_1}),		
  13.321  	       (*"r * r ^^^ n = r ^^^ (n + 1)"*)
  13.322 -	       Rule.Thm ("realpow_pow",TermC.num_str @{thm realpow_pow}),
  13.323 +	       Rule.Thm ("realpow_pow",ThmC.numerals_to_Free @{thm realpow_pow}),
  13.324  	       (*"(a ^^^ b) ^^^ c = a ^^^ (b * c)"*)
  13.325  	       Rule.Thm ("sym_realpow_addI",
  13.326 -                     TermC.num_str (@{thm realpow_addI} RS @{thm sym})),
  13.327 +                     ThmC.numerals_to_Free (@{thm realpow_addI} RS @{thm sym})),
  13.328  	       (*"r ^^^ n * r ^^^ m = r ^^^ (n + m)"*)
  13.329 -	       Rule.Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}),
  13.330 +	       Rule.Thm ("realpow_oneI",ThmC.numerals_to_Free @{thm realpow_oneI}),
  13.331  	       (*"r ^^^ 1 = r"*)
  13.332 -	       Rule.Thm ("realpow_eq_oneI",TermC.num_str @{thm realpow_eq_oneI})
  13.333 +	       Rule.Thm ("realpow_eq_oneI",ThmC.numerals_to_Free @{thm realpow_eq_oneI})
  13.334  	       (*"1 ^^^ n = 1"*)
  13.335  	       ], scr = Rule.EmptyScr};
  13.336  
  13.337 @@ -953,14 +953,14 @@
  13.338  	      ("TIMES" , ("Groups.times_class.times", (**)eval_binop "#mult_")),
  13.339  	      ("POWER", ("Prog_Expr.pow", (**)eval_binop "#power_"))
  13.340  	      ], errpatts = [],
  13.341 -      rules = [Rule.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  13.342 +      rules = [Rule.Thm ("real_num_collect",ThmC.numerals_to_Free @{thm real_num_collect}), 
  13.343  	       (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
  13.344 -	       Rule.Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),
  13.345 +	       Rule.Thm ("real_num_collect_assoc",ThmC.numerals_to_Free @{thm real_num_collect_assoc}),
  13.346  	       (*"[| l is_const; m is_const |] ==>  
  13.347  				l * n + (m * n + k) =  (l + m) * n + k"*)
  13.348 -	       Rule.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),	
  13.349 +	       Rule.Thm ("real_one_collect",ThmC.numerals_to_Free @{thm real_one_collect}),	
  13.350  	       (*"m is_const ==> n + m * n = (1 + m) * n"*)
  13.351 -	       Rule.Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), 
  13.352 +	       Rule.Thm ("real_one_collect_assoc",ThmC.numerals_to_Free @{thm real_one_collect_assoc}), 
  13.353  	       (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  13.354  	       Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"), 
  13.355  	       Rule.Num_Calc ("Groups.times_class.times", (**)eval_binop "#mult_"),
  13.356 @@ -971,35 +971,35 @@
  13.357        rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  13.358        erls = Rule_Set.empty,srls = Rule_Set.Empty,
  13.359        calc = [], errpatts = [],
  13.360 -      rules = [Rule.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),                 
  13.361 +      rules = [Rule.Thm ("mult_1_left",ThmC.numerals_to_Free @{thm mult_1_left}),                 
  13.362  	       (*"1 * z = z"*)
  13.363 -	       (*Rule.Thm ("real_mult_minus1",TermC.num_str @{thm real_mult_minus1}),14.3.03*)
  13.364 +	       (*Rule.Thm ("real_mult_minus1",ThmC.numerals_to_Free @{thm real_mult_minus1}),14.3.03*)
  13.365  	       (*"-1 * z = - z"*)
  13.366  	       Rule.Thm ("minus_mult_left", 
  13.367 -		    TermC.num_str (@{thm minus_mult_left} RS @{thm sym})),
  13.368 +		    ThmC.numerals_to_Free (@{thm minus_mult_left} RS @{thm sym})),
  13.369  	       (*- (?x * ?y) = "- ?x * ?y"*)
  13.370  	       (*Rule.Thm ("real_minus_mult_cancel",
  13.371 -                       TermC.num_str @{thm real_minus_mult_cancel}),
  13.372 +                       ThmC.numerals_to_Free @{thm real_minus_mult_cancel}),
  13.373  	       (*"- ?x * - ?y = ?x * ?y"*)---*)
  13.374 -	       Rule.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),        
  13.375 +	       Rule.Thm ("mult_zero_left",ThmC.numerals_to_Free @{thm mult_zero_left}),        
  13.376  	       (*"0 * z = 0"*)
  13.377 -	       Rule.Thm ("add_0_left",TermC.num_str @{thm add_0_left}),
  13.378 +	       Rule.Thm ("add_0_left",ThmC.numerals_to_Free @{thm add_0_left}),
  13.379  	       (*"0 + z = z"*)
  13.380 -	       Rule.Thm ("right_minus",TermC.num_str @{thm right_minus}),
  13.381 +	       Rule.Thm ("right_minus",ThmC.numerals_to_Free @{thm right_minus}),
  13.382  	       (*"?z + - ?z = 0"*)
  13.383  	       Rule.Thm ("sym_real_mult_2",
  13.384 -                     TermC.num_str (@{thm real_mult_2} RS @{thm sym})),	
  13.385 +                     ThmC.numerals_to_Free (@{thm real_mult_2} RS @{thm sym})),	
  13.386  	       (*"z1 + z1 = 2 * z1"*)
  13.387 -	       Rule.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc})
  13.388 +	       Rule.Thm ("real_mult_2_assoc",ThmC.numerals_to_Free @{thm real_mult_2_assoc})
  13.389  	       (*"z1 + (z1 + k) = 2 * z1 + k"*)
  13.390  	       ], scr = Rule.EmptyScr};
  13.391  
  13.392  val discard_parentheses = 
  13.393      Rule_Set.append_rules "discard_parentheses" Rule_Set.empty 
  13.394  	       [Rule.Thm ("sym_mult_assoc",
  13.395 -                      TermC.num_str (@{thm mult.assoc} RS @{thm sym})),
  13.396 +                      ThmC.numerals_to_Free (@{thm mult.assoc} RS @{thm sym})),
  13.397  		Rule.Thm ("sym_add_assoc",
  13.398 -                      TermC.num_str (@{thm add.assoc} RS @{thm sym}))];
  13.399 +                      ThmC.numerals_to_Free (@{thm add.assoc} RS @{thm sym}))];
  13.400  \<close>
  13.401  
  13.402  subsubsection \<open>hard-coded AC rewriting\<close>
  13.403 @@ -1011,17 +1011,17 @@
  13.404        rew_ord = ("ord_make_polynomial",ord_make_polynomial false thy),
  13.405        erls = Rule_Set.empty,srls = Rule_Set.Empty,
  13.406        calc = [], errpatts = [],
  13.407 -      rules = [Rule.Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
  13.408 +      rules = [Rule.Thm ("mult_commute",ThmC.numerals_to_Free @{thm mult.commute}),
  13.409  	       (* z * w = w * z *)
  13.410 -	       Rule.Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
  13.411 +	       Rule.Thm ("real_mult_left_commute",ThmC.numerals_to_Free @{thm real_mult_left_commute}),
  13.412  	       (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*)
  13.413 -	       Rule.Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),		
  13.414 +	       Rule.Thm ("mult_assoc",ThmC.numerals_to_Free @{thm mult.assoc}),		
  13.415  	       (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*)
  13.416 -	       Rule.Thm ("add_commute",TermC.num_str @{thm add.commute}),	
  13.417 +	       Rule.Thm ("add_commute",ThmC.numerals_to_Free @{thm add.commute}),	
  13.418  	       (*z + w = w + z*)
  13.419 -	       Rule.Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}),
  13.420 +	       Rule.Thm ("add_left_commute",ThmC.numerals_to_Free @{thm add.left_commute}),
  13.421  	       (*x + (y + z) = y + (x + z)*)
  13.422 -	       Rule.Thm ("add_assoc",TermC.num_str @{thm add.assoc})	               
  13.423 +	       Rule.Thm ("add_assoc",ThmC.numerals_to_Free @{thm add.assoc})	               
  13.424  	       (*z1.0 + z2.0 + z3.0 = z1.0 + (z2.0 + z3.0)*)
  13.425  	       ], scr = Rule.EmptyScr};
  13.426  (*MG.0401: termorders for multivariate polys dropped due to principal problems:
  13.427 @@ -1031,11 +1031,11 @@
  13.428        rew_ord = ("ord_make_polynomial",ord_make_polynomial false thy),
  13.429        erls = Rule_Set.empty,srls = Rule_Set.Empty,
  13.430        calc = [], errpatts = [],
  13.431 -      rules = [Rule.Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
  13.432 +      rules = [Rule.Thm ("mult_commute",ThmC.numerals_to_Free @{thm mult.commute}),
  13.433  	       (* z * w = w * z *)
  13.434 -	       Rule.Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
  13.435 +	       Rule.Thm ("real_mult_left_commute",ThmC.numerals_to_Free @{thm real_mult_left_commute}),
  13.436  	       (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*)
  13.437 -	       Rule.Thm ("mult_assoc",TermC.num_str @{thm mult.assoc})	
  13.438 +	       Rule.Thm ("mult_assoc",ThmC.numerals_to_Free @{thm mult.assoc})	
  13.439  	       (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*)
  13.440  	       ], scr = Rule.EmptyScr};
  13.441  \<close>
  13.442 @@ -1201,21 +1201,21 @@
  13.443  	    ("TIMES" , ("Groups.times_class.times", (**)eval_binop "#mult_")),
  13.444  	    ("POWER", ("Prog_Expr.pow", (**)eval_binop "#power_"))*)
  13.445  	    ], errpatts = [],
  13.446 -    rules = [Rule.Thm ("real_plus_binom_times" ,TermC.num_str @{thm real_plus_binom_times}),
  13.447 +    rules = [Rule.Thm ("real_plus_binom_times" ,ThmC.numerals_to_Free @{thm real_plus_binom_times}),
  13.448  	     (*"(a + b)*(a + b) = a ^ 2 + 2 * a * b + b ^ 2*)
  13.449 -	     Rule.Thm ("real_plus_binom_times1" ,TermC.num_str @{thm real_plus_binom_times1}),
  13.450 +	     Rule.Thm ("real_plus_binom_times1" ,ThmC.numerals_to_Free @{thm real_plus_binom_times1}),
  13.451  	     (*"(a +  1*b)*(a + -1*b) = a^^^2 + -1*b^^^2"*)
  13.452 -	     Rule.Thm ("real_plus_binom_times2" ,TermC.num_str @{thm real_plus_binom_times2}),
  13.453 +	     Rule.Thm ("real_plus_binom_times2" ,ThmC.numerals_to_Free @{thm real_plus_binom_times2}),
  13.454  	     (*"(a + -1*b)*(a +  1*b) = a^^^2 + -1*b^^^2"*)
  13.455  
  13.456 -	     Rule.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),(*"1 * z = z"*)
  13.457 +	     Rule.Thm ("mult_1_left",ThmC.numerals_to_Free @{thm mult_1_left}),(*"1 * z = z"*)
  13.458  
  13.459 -             Rule.Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),
  13.460 +             Rule.Thm ("distrib_right" ,ThmC.numerals_to_Free @{thm distrib_right}),
  13.461  	     (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  13.462 -	     Rule.Thm ("distrib_left",TermC.num_str @{thm distrib_left}),
  13.463 +	     Rule.Thm ("distrib_left",ThmC.numerals_to_Free @{thm distrib_left}),
  13.464  	     (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  13.465  	       
  13.466 -	     Rule.Thm ("mult_assoc", TermC.num_str @{thm mult.assoc}),
  13.467 +	     Rule.Thm ("mult_assoc", ThmC.numerals_to_Free @{thm mult.assoc}),
  13.468  	     (*"?z1.1 * ?z2.1 * ?z3. =1 ?z1.1 * (?z2.1 * ?z3.1)"*)
  13.469  	     Rule.Rls_ order_mult_rls_,
  13.470  	     (*Rule.Rls_ order_add_rls_,*)
  13.471 @@ -1225,34 +1225,34 @@
  13.472  	     Rule.Num_Calc ("Prog_Expr.pow", (**)eval_binop "#power_"),
  13.473  	     
  13.474  	     Rule.Thm ("sym_realpow_twoI",
  13.475 -                   TermC.num_str (@{thm realpow_twoI} RS @{thm sym})),
  13.476 +                   ThmC.numerals_to_Free (@{thm realpow_twoI} RS @{thm sym})),
  13.477  	     (*"r1 * r1 = r1 ^^^ 2"*)
  13.478  	     Rule.Thm ("sym_real_mult_2",
  13.479 -                   TermC.num_str (@{thm real_mult_2} RS @{thm sym})),
  13.480 +                   ThmC.numerals_to_Free (@{thm real_mult_2} RS @{thm sym})),
  13.481  	     (*"z1 + z1 = 2 * z1"*)
  13.482 -	     Rule.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),
  13.483 +	     Rule.Thm ("real_mult_2_assoc",ThmC.numerals_to_Free @{thm real_mult_2_assoc}),
  13.484  	     (*"z1 + (z1 + k) = 2 * z1 + k"*)
  13.485  
  13.486 -	     Rule.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  13.487 +	     Rule.Thm ("real_num_collect",ThmC.numerals_to_Free @{thm real_num_collect}), 
  13.488  	     (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
  13.489 -	     Rule.Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),
  13.490 +	     Rule.Thm ("real_num_collect_assoc",ThmC.numerals_to_Free @{thm real_num_collect_assoc}),
  13.491  	     (*"[| l is_const; m is_const |] ==>  
  13.492                                       l * n + (m * n + k) =  (l + m) * n + k"*)
  13.493 -	     Rule.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),
  13.494 +	     Rule.Thm ("real_one_collect",ThmC.numerals_to_Free @{thm real_one_collect}),
  13.495  	     (*"m is_const ==> n + m * n = (1 + m) * n"*)
  13.496 -	     Rule.Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), 
  13.497 +	     Rule.Thm ("real_one_collect_assoc",ThmC.numerals_to_Free @{thm real_one_collect_assoc}), 
  13.498  	     (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  13.499  
  13.500 -	     Rule.Thm ("realpow_multI", TermC.num_str @{thm realpow_multI}),
  13.501 +	     Rule.Thm ("realpow_multI", ThmC.numerals_to_Free @{thm realpow_multI}),
  13.502  	     (*"(r * s) ^^^ n = r ^^^ n * s ^^^ n"*)
  13.503  
  13.504  	     Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"), 
  13.505  	     Rule.Num_Calc ("Groups.times_class.times", (**)eval_binop "#mult_"),
  13.506  	     Rule.Num_Calc ("Prog_Expr.pow", (**)eval_binop "#power_"),
  13.507  
  13.508 -	     Rule.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),(*"1 * z = z"*)
  13.509 -	     Rule.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),(*"0 * z = 0"*)
  13.510 -	     Rule.Thm ("add_0_left",TermC.num_str @{thm add_0_left})(*0 + z = z*)
  13.511 +	     Rule.Thm ("mult_1_left",ThmC.numerals_to_Free @{thm mult_1_left}),(*"1 * z = z"*)
  13.512 +	     Rule.Thm ("mult_zero_left",ThmC.numerals_to_Free @{thm mult_zero_left}),(*"0 * z = 0"*)
  13.513 +	     Rule.Thm ("add_0_left",ThmC.numerals_to_Free @{thm add_0_left})(*0 + z = z*)
  13.514  
  13.515  	     (*Rule.Rls_ order_add_rls_*)
  13.516  	     ],
  13.517 @@ -1304,89 +1304,89 @@
  13.518  	      ("POWER", ("Prog_Expr.pow", (**)eval_binop "#power_"))
  13.519  	      ], errpatts = [],
  13.520        rules = [Rule.Thm ("real_plus_binom_pow2",
  13.521 -                     TermC.num_str @{thm real_plus_binom_pow2}),     
  13.522 +                     ThmC.numerals_to_Free @{thm real_plus_binom_pow2}),     
  13.523  	       (*"(a + b) ^^^ 2 = a ^^^ 2 + 2 * a * b + b ^^^ 2"*)
  13.524  	       Rule.Thm ("real_plus_binom_times",
  13.525 -                     TermC.num_str @{thm real_plus_binom_times}),    
  13.526 +                     ThmC.numerals_to_Free @{thm real_plus_binom_times}),    
  13.527  	      (*"(a + b)*(a + b) = ...*)
  13.528  	       Rule.Thm ("real_minus_binom_pow2",
  13.529 -                     TermC.num_str @{thm real_minus_binom_pow2}),   
  13.530 +                     ThmC.numerals_to_Free @{thm real_minus_binom_pow2}),   
  13.531  	       (*"(a - b) ^^^ 2 = a ^^^ 2 - 2 * a * b + b ^^^ 2"*)
  13.532  	       Rule.Thm ("real_minus_binom_times",
  13.533 -                     TermC.num_str @{thm real_minus_binom_times}),   
  13.534 +                     ThmC.numerals_to_Free @{thm real_minus_binom_times}),   
  13.535  	       (*"(a - b)*(a - b) = ...*)
  13.536  	       Rule.Thm ("real_plus_minus_binom1",
  13.537 -                     TermC.num_str @{thm real_plus_minus_binom1}),   
  13.538 +                     ThmC.numerals_to_Free @{thm real_plus_minus_binom1}),   
  13.539  		(*"(a + b) * (a - b) = a ^^^ 2 - b ^^^ 2"*)
  13.540  	       Rule.Thm ("real_plus_minus_binom2",
  13.541 -                     TermC.num_str @{thm real_plus_minus_binom2}),   
  13.542 +                     ThmC.numerals_to_Free @{thm real_plus_minus_binom2}),   
  13.543  		(*"(a - b) * (a + b) = a ^^^ 2 - b ^^^ 2"*)
  13.544  	       (*RL 020915*)
  13.545 -	       Rule.Thm ("real_pp_binom_times",TermC.num_str @{thm real_pp_binom_times}), 
  13.546 +	       Rule.Thm ("real_pp_binom_times",ThmC.numerals_to_Free @{thm real_pp_binom_times}), 
  13.547  		(*(a + b)*(c + d) = a*c + a*d + b*c + b*d*)
  13.548 -               Rule.Thm ("real_pm_binom_times",TermC.num_str @{thm real_pm_binom_times}), 
  13.549 +               Rule.Thm ("real_pm_binom_times",ThmC.numerals_to_Free @{thm real_pm_binom_times}), 
  13.550  		(*(a + b)*(c - d) = a*c - a*d + b*c - b*d*)
  13.551 -               Rule.Thm ("real_mp_binom_times",TermC.num_str @{thm real_mp_binom_times}), 
  13.552 +               Rule.Thm ("real_mp_binom_times",ThmC.numerals_to_Free @{thm real_mp_binom_times}), 
  13.553  		(*(a - b)*(c + d) = a*c + a*d - b*c - b*d*)
  13.554 -               Rule.Thm ("real_mm_binom_times",TermC.num_str @{thm real_mm_binom_times}), 
  13.555 +               Rule.Thm ("real_mm_binom_times",ThmC.numerals_to_Free @{thm real_mm_binom_times}), 
  13.556  		(*(a - b)*(c - d) = a*c - a*d - b*c + b*d*)
  13.557 -	       Rule.Thm ("realpow_multI",TermC.num_str @{thm realpow_multI}),
  13.558 +	       Rule.Thm ("realpow_multI",ThmC.numerals_to_Free @{thm realpow_multI}),
  13.559  		(*(a*b)^^^n = a^^^n * b^^^n*)
  13.560 -	       Rule.Thm ("real_plus_binom_pow3",TermC.num_str @{thm real_plus_binom_pow3}),
  13.561 +	       Rule.Thm ("real_plus_binom_pow3",ThmC.numerals_to_Free @{thm real_plus_binom_pow3}),
  13.562  	        (* (a + b)^^^3 = a^^^3 + 3*a^^^2*b + 3*a*b^^^2 + b^^^3 *)
  13.563  	       Rule.Thm ("real_minus_binom_pow3",
  13.564 -                     TermC.num_str @{thm real_minus_binom_pow3}),
  13.565 +                     ThmC.numerals_to_Free @{thm real_minus_binom_pow3}),
  13.566  	        (* (a - b)^^^3 = a^^^3 - 3*a^^^2*b + 3*a*b^^^2 - b^^^3 *)
  13.567  
  13.568  
  13.569 -              (*Rule.Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),	
  13.570 +              (*Rule.Thm ("distrib_right" ,ThmC.numerals_to_Free @{thm distrib_right}),	
  13.571  		(*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  13.572 -	       Rule.Thm ("distrib_left",TermC.num_str @{thm distrib_left}),	
  13.573 +	       Rule.Thm ("distrib_left",ThmC.numerals_to_Free @{thm distrib_left}),	
  13.574  	       (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  13.575 -	       Rule.Thm ("left_diff_distrib" ,TermC.num_str @{thm left_diff_distrib}),	
  13.576 +	       Rule.Thm ("left_diff_distrib" ,ThmC.numerals_to_Free @{thm left_diff_distrib}),	
  13.577  	       (*"(z1.0 - z2.0) * w = z1.0 * w - z2.0 * w"*)
  13.578 -	       Rule.Thm ("right_diff_distrib",TermC.num_str @{thm right_diff_distrib}),	
  13.579 +	       Rule.Thm ("right_diff_distrib",ThmC.numerals_to_Free @{thm right_diff_distrib}),	
  13.580  	       (*"w * (z1.0 - z2.0) = w * z1.0 - w * z2.0"*)
  13.581  	      *)
  13.582 -	       Rule.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),
  13.583 +	       Rule.Thm ("mult_1_left",ThmC.numerals_to_Free @{thm mult_1_left}),
  13.584                 (*"1 * z = z"*)
  13.585 -	       Rule.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),
  13.586 +	       Rule.Thm ("mult_zero_left",ThmC.numerals_to_Free @{thm mult_zero_left}),
  13.587                 (*"0 * z = 0"*)
  13.588 -	       Rule.Thm ("add_0_left",TermC.num_str @{thm add_0_left}),(*"0 + z = z"*)
  13.589 +	       Rule.Thm ("add_0_left",ThmC.numerals_to_Free @{thm add_0_left}),(*"0 + z = z"*)
  13.590  
  13.591  	       Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"), 
  13.592  	       Rule.Num_Calc ("Groups.times_class.times", (**)eval_binop "#mult_"),
  13.593  	       Rule.Num_Calc ("Prog_Expr.pow", (**)eval_binop "#power_"),
  13.594 -              (*Rule.Thm ("mult_commute",TermC.num_str @{thm mult_commute}),
  13.595 +              (*Rule.Thm ("mult_commute",ThmC.numerals_to_Free @{thm mult_commute}),
  13.596  		(*AC-rewriting*)
  13.597  	       Rule.Thm ("real_mult_left_commute",
  13.598 -                     TermC.num_str @{thm real_mult_left_commute}),
  13.599 -	       Rule.Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),
  13.600 -	       Rule.Thm ("add_commute",TermC.num_str @{thm add.commute}),
  13.601 -	       Rule.Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}),
  13.602 -	       Rule.Thm ("add_assoc",TermC.num_str @{thm add.assoc}),
  13.603 +                     ThmC.numerals_to_Free @{thm real_mult_left_commute}),
  13.604 +	       Rule.Thm ("mult_assoc",ThmC.numerals_to_Free @{thm mult.assoc}),
  13.605 +	       Rule.Thm ("add_commute",ThmC.numerals_to_Free @{thm add.commute}),
  13.606 +	       Rule.Thm ("add_left_commute",ThmC.numerals_to_Free @{thm add.left_commute}),
  13.607 +	       Rule.Thm ("add_assoc",ThmC.numerals_to_Free @{thm add.assoc}),
  13.608  	      *)
  13.609  	       Rule.Thm ("sym_realpow_twoI",
  13.610 -                     TermC.num_str (@{thm realpow_twoI} RS @{thm sym})),
  13.611 +                     ThmC.numerals_to_Free (@{thm realpow_twoI} RS @{thm sym})),
  13.612  	       (*"r1 * r1 = r1 ^^^ 2"*)
  13.613 -	       Rule.Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),			
  13.614 +	       Rule.Thm ("realpow_plus_1",ThmC.numerals_to_Free @{thm realpow_plus_1}),			
  13.615  	       (*"r * r ^^^ n = r ^^^ (n + 1)"*)
  13.616  	       (*Rule.Thm ("sym_real_mult_2",
  13.617 -                       TermC.num_str (@{thm real_mult_2} RS @{thm sym})),		
  13.618 +                       ThmC.numerals_to_Free (@{thm real_mult_2} RS @{thm sym})),		
  13.619  	       (*"z1 + z1 = 2 * z1"*)*)
  13.620 -	       Rule.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),		
  13.621 +	       Rule.Thm ("real_mult_2_assoc",ThmC.numerals_to_Free @{thm real_mult_2_assoc}),		
  13.622  	       (*"z1 + (z1 + k) = 2 * z1 + k"*)
  13.623  
  13.624 -	       Rule.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  13.625 +	       Rule.Thm ("real_num_collect",ThmC.numerals_to_Free @{thm real_num_collect}), 
  13.626  	       (*"[| l is_const; m is_const |] ==>l * n + m * n = (l + m) * n"*)
  13.627  	       Rule.Thm ("real_num_collect_assoc",
  13.628 -                     TermC.num_str @{thm real_num_collect_assoc}),	
  13.629 +                     ThmC.numerals_to_Free @{thm real_num_collect_assoc}),	
  13.630  	       (*"[| l is_const; m is_const |] ==>  
  13.631                                         l * n + (m * n + k) =  (l + m) * n + k"*)
  13.632 -	       Rule.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),
  13.633 +	       Rule.Thm ("real_one_collect",ThmC.numerals_to_Free @{thm real_one_collect}),
  13.634  	       (*"m is_const ==> n + m * n = (1 + m) * n"*)
  13.635  	       Rule.Thm ("real_one_collect_assoc",
  13.636 -                     TermC.num_str @{thm real_one_collect_assoc}), 
  13.637 +                     ThmC.numerals_to_Free @{thm real_one_collect_assoc}), 
  13.638  	       (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  13.639  
  13.640  	       Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"), 
    14.1 --- a/src/Tools/isac/Knowledge/PolyEq.thy	Mon Apr 13 13:27:55 2020 +0200
    14.2 +++ b/src/Tools/isac/Knowledge/PolyEq.thy	Mon Apr 13 15:31:23 2020 +0200
    14.3 @@ -337,34 +337,34 @@
    14.4  	      Rule.Num_Calc ("HOL.eq", Prog_Expr.eval_equal "#equal_"),
    14.5                Rule.Num_Calc ("RootEq.is'_rootTerm'_in", eval_is_rootTerm_in ""),
    14.6  	      Rule.Num_Calc ("RatEq.is'_ratequation'_in", eval_is_ratequation_in ""),
    14.7 -	      Rule.Thm ("not_true",TermC.num_str @{thm not_true}),
    14.8 -	      Rule.Thm ("not_false",TermC.num_str @{thm not_false}),
    14.9 -	      Rule.Thm ("and_true",TermC.num_str @{thm and_true}),
   14.10 -	      Rule.Thm ("and_false",TermC.num_str @{thm and_false}),
   14.11 -	      Rule.Thm ("or_true",TermC.num_str @{thm or_true}),
   14.12 -	      Rule.Thm ("or_false",TermC.num_str @{thm or_false})
   14.13 +	      Rule.Thm ("not_true",ThmC.numerals_to_Free @{thm not_true}),
   14.14 +	      Rule.Thm ("not_false",ThmC.numerals_to_Free @{thm not_false}),
   14.15 +	      Rule.Thm ("and_true",ThmC.numerals_to_Free @{thm and_true}),
   14.16 +	      Rule.Thm ("and_false",ThmC.numerals_to_Free @{thm and_false}),
   14.17 +	      Rule.Thm ("or_true",ThmC.numerals_to_Free @{thm or_true}),
   14.18 +	      Rule.Thm ("or_false",ThmC.numerals_to_Free @{thm or_false})
   14.19  	       ];
   14.20  
   14.21  val PolyEq_erls = 
   14.22      Rule_Set.merge "PolyEq_erls" LinEq_erls
   14.23      (Rule_Set.append_rules "ops_preds" calculate_Rational
   14.24  		[Rule.Num_Calc ("HOL.eq", Prog_Expr.eval_equal "#equal_"),
   14.25 -		 Rule.Thm ("plus_leq", TermC.num_str @{thm plus_leq}),
   14.26 -		 Rule.Thm ("minus_leq", TermC.num_str @{thm minus_leq}),
   14.27 -		 Rule.Thm ("rat_leq1", TermC.num_str @{thm rat_leq1}),
   14.28 -		 Rule.Thm ("rat_leq2", TermC.num_str @{thm rat_leq2}),
   14.29 -		 Rule.Thm ("rat_leq3", TermC.num_str @{thm rat_leq3})
   14.30 +		 Rule.Thm ("plus_leq", ThmC.numerals_to_Free @{thm plus_leq}),
   14.31 +		 Rule.Thm ("minus_leq", ThmC.numerals_to_Free @{thm minus_leq}),
   14.32 +		 Rule.Thm ("rat_leq1", ThmC.numerals_to_Free @{thm rat_leq1}),
   14.33 +		 Rule.Thm ("rat_leq2", ThmC.numerals_to_Free @{thm rat_leq2}),
   14.34 +		 Rule.Thm ("rat_leq3", ThmC.numerals_to_Free @{thm rat_leq3})
   14.35  		 ]);
   14.36  
   14.37  val PolyEq_crls = 
   14.38      Rule_Set.merge "PolyEq_crls" LinEq_crls
   14.39      (Rule_Set.append_rules "ops_preds" calculate_Rational
   14.40  		[Rule.Num_Calc ("HOL.eq", Prog_Expr.eval_equal "#equal_"),
   14.41 -		 Rule.Thm ("plus_leq", TermC.num_str @{thm plus_leq}),
   14.42 -		 Rule.Thm ("minus_leq", TermC.num_str @{thm minus_leq}),
   14.43 -		 Rule.Thm ("rat_leq1", TermC.num_str @{thm rat_leq1}),
   14.44 -		 Rule.Thm ("rat_leq2", TermC.num_str @{thm rat_leq2}),
   14.45 -		 Rule.Thm ("rat_leq3", TermC.num_str @{thm rat_leq3})
   14.46 +		 Rule.Thm ("plus_leq", ThmC.numerals_to_Free @{thm plus_leq}),
   14.47 +		 Rule.Thm ("minus_leq", ThmC.numerals_to_Free @{thm minus_leq}),
   14.48 +		 Rule.Thm ("rat_leq1", ThmC.numerals_to_Free @{thm rat_leq1}),
   14.49 +		 Rule.Thm ("rat_leq2", ThmC.numerals_to_Free @{thm rat_leq2}),
   14.50 +		 Rule.Thm ("rat_leq3", ThmC.numerals_to_Free @{thm rat_leq3})
   14.51  		 ]);
   14.52  
   14.53  val cancel_leading_coeff = prep_rls'(
   14.54 @@ -372,19 +372,19 @@
   14.55         rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord),
   14.56        erls = PolyEq_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
   14.57        rules = 
   14.58 -      [Rule.Thm ("cancel_leading_coeff1",TermC.num_str @{thm cancel_leading_coeff1}),
   14.59 -       Rule.Thm ("cancel_leading_coeff2",TermC.num_str @{thm cancel_leading_coeff2}),
   14.60 -       Rule.Thm ("cancel_leading_coeff3",TermC.num_str @{thm cancel_leading_coeff3}),
   14.61 -       Rule.Thm ("cancel_leading_coeff4",TermC.num_str @{thm cancel_leading_coeff4}),
   14.62 -       Rule.Thm ("cancel_leading_coeff5",TermC.num_str @{thm cancel_leading_coeff5}),
   14.63 -       Rule.Thm ("cancel_leading_coeff6",TermC.num_str @{thm cancel_leading_coeff6}),
   14.64 -       Rule.Thm ("cancel_leading_coeff7",TermC.num_str @{thm cancel_leading_coeff7}),
   14.65 -       Rule.Thm ("cancel_leading_coeff8",TermC.num_str @{thm cancel_leading_coeff8}),
   14.66 -       Rule.Thm ("cancel_leading_coeff9",TermC.num_str @{thm cancel_leading_coeff9}),
   14.67 -       Rule.Thm ("cancel_leading_coeff10",TermC.num_str @{thm cancel_leading_coeff10}),
   14.68 -       Rule.Thm ("cancel_leading_coeff11",TermC.num_str @{thm cancel_leading_coeff11}),
   14.69 -       Rule.Thm ("cancel_leading_coeff12",TermC.num_str @{thm cancel_leading_coeff12}),
   14.70 -       Rule.Thm ("cancel_leading_coeff13",TermC.num_str @{thm cancel_leading_coeff13})
   14.71 +      [Rule.Thm ("cancel_leading_coeff1",ThmC.numerals_to_Free @{thm cancel_leading_coeff1}),
   14.72 +       Rule.Thm ("cancel_leading_coeff2",ThmC.numerals_to_Free @{thm cancel_leading_coeff2}),
   14.73 +       Rule.Thm ("cancel_leading_coeff3",ThmC.numerals_to_Free @{thm cancel_leading_coeff3}),
   14.74 +       Rule.Thm ("cancel_leading_coeff4",ThmC.numerals_to_Free @{thm cancel_leading_coeff4}),
   14.75 +       Rule.Thm ("cancel_leading_coeff5",ThmC.numerals_to_Free @{thm cancel_leading_coeff5}),
   14.76 +       Rule.Thm ("cancel_leading_coeff6",ThmC.numerals_to_Free @{thm cancel_leading_coeff6}),
   14.77 +       Rule.Thm ("cancel_leading_coeff7",ThmC.numerals_to_Free @{thm cancel_leading_coeff7}),
   14.78 +       Rule.Thm ("cancel_leading_coeff8",ThmC.numerals_to_Free @{thm cancel_leading_coeff8}),
   14.79 +       Rule.Thm ("cancel_leading_coeff9",ThmC.numerals_to_Free @{thm cancel_leading_coeff9}),
   14.80 +       Rule.Thm ("cancel_leading_coeff10",ThmC.numerals_to_Free @{thm cancel_leading_coeff10}),
   14.81 +       Rule.Thm ("cancel_leading_coeff11",ThmC.numerals_to_Free @{thm cancel_leading_coeff11}),
   14.82 +       Rule.Thm ("cancel_leading_coeff12",ThmC.numerals_to_Free @{thm cancel_leading_coeff12}),
   14.83 +       Rule.Thm ("cancel_leading_coeff13",ThmC.numerals_to_Free @{thm cancel_leading_coeff13})
   14.84         ],scr = Rule.EmptyScr});
   14.85  
   14.86  val prep_rls' = Auto_Prog.prep_rls @{theory};
   14.87 @@ -394,11 +394,11 @@
   14.88    Rule_Def.Repeat {id = "complete_square", preconds = [], 
   14.89         rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord),
   14.90        erls = PolyEq_erls, srls = Rule_Set.Empty, calc = [],  errpatts = [],
   14.91 -      rules = [Rule.Thm ("complete_square1",TermC.num_str @{thm complete_square1}),
   14.92 -	       Rule.Thm ("complete_square2",TermC.num_str @{thm complete_square2}),
   14.93 -	       Rule.Thm ("complete_square3",TermC.num_str @{thm complete_square3}),
   14.94 -	       Rule.Thm ("complete_square4",TermC.num_str @{thm complete_square4}),
   14.95 -	       Rule.Thm ("complete_square5",TermC.num_str @{thm complete_square5})
   14.96 +      rules = [Rule.Thm ("complete_square1",ThmC.numerals_to_Free @{thm complete_square1}),
   14.97 +	       Rule.Thm ("complete_square2",ThmC.numerals_to_Free @{thm complete_square2}),
   14.98 +	       Rule.Thm ("complete_square3",ThmC.numerals_to_Free @{thm complete_square3}),
   14.99 +	       Rule.Thm ("complete_square4",ThmC.numerals_to_Free @{thm complete_square4}),
  14.100 +	       Rule.Thm ("complete_square5",ThmC.numerals_to_Free @{thm complete_square5})
  14.101  	       ],
  14.102        scr = Rule.EmptyScr
  14.103        });
  14.104 @@ -409,11 +409,11 @@
  14.105         erls = PolyEq_erls, 
  14.106         srls = Rule_Set.Empty, 
  14.107         calc = [], errpatts = [],
  14.108 -       rules = [Rule.Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1}),
  14.109 -		Rule.Thm  ("real_assoc_2",TermC.num_str @{thm real_assoc_2}),
  14.110 -		Rule.Thm  ("real_diff_minus",TermC.num_str @{thm real_diff_minus}),
  14.111 -		Rule.Thm  ("real_unari_minus",TermC.num_str @{thm real_unari_minus}),
  14.112 -		Rule.Thm  ("realpow_multI",TermC.num_str @{thm realpow_multI}),
  14.113 +       rules = [Rule.Thm  ("real_assoc_1",ThmC.numerals_to_Free @{thm real_assoc_1}),
  14.114 +		Rule.Thm  ("real_assoc_2",ThmC.numerals_to_Free @{thm real_assoc_2}),
  14.115 +		Rule.Thm  ("real_diff_minus",ThmC.numerals_to_Free @{thm real_diff_minus}),
  14.116 +		Rule.Thm  ("real_unari_minus",ThmC.numerals_to_Free @{thm real_unari_minus}),
  14.117 +		Rule.Thm  ("realpow_multI",ThmC.numerals_to_Free @{thm realpow_multI}),
  14.118  		Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"),
  14.119  		Rule.Num_Calc ("Groups.minus_class.minus", (**)eval_binop "#sub_"),
  14.120  		Rule.Num_Calc ("Groups.times_class.times", (**)eval_binop "#mult_"),
  14.121 @@ -441,8 +441,8 @@
  14.122         erls = PolyEq_erls,
  14.123         srls = Rule_Set.Empty, 
  14.124         calc = [], errpatts = [],
  14.125 -       rules = [Rule.Thm("d0_true",TermC.num_str @{thm d0_true}),
  14.126 -		Rule.Thm("d0_false",TermC.num_str @{thm  d0_false})
  14.127 +       rules = [Rule.Thm("d0_true",ThmC.numerals_to_Free @{thm d0_true}),
  14.128 +		Rule.Thm("d0_false",ThmC.numerals_to_Free @{thm  d0_false})
  14.129  		],
  14.130         scr = Rule.EmptyScr
  14.131         });
  14.132 @@ -456,11 +456,11 @@
  14.133         srls = Rule_Set.Empty, 
  14.134         calc = [], errpatts = [],
  14.135         rules = [
  14.136 -		Rule.Thm("d1_isolate_add1",TermC.num_str @{thm d1_isolate_add1}), 
  14.137 +		Rule.Thm("d1_isolate_add1",ThmC.numerals_to_Free @{thm d1_isolate_add1}), 
  14.138  		(* a+bx=0 -> bx=-a *)
  14.139 -		Rule.Thm("d1_isolate_add2",TermC.num_str @{thm d1_isolate_add2}), 
  14.140 +		Rule.Thm("d1_isolate_add2",ThmC.numerals_to_Free @{thm d1_isolate_add2}), 
  14.141  		(* a+ x=0 ->  x=-a *)
  14.142 -		Rule.Thm("d1_isolate_div",TermC.num_str @{thm d1_isolate_div})    
  14.143 +		Rule.Thm("d1_isolate_div",ThmC.numerals_to_Free @{thm d1_isolate_div})    
  14.144  		(*   bx=c -> x=c/b *)  
  14.145  		],
  14.146         scr = Rule.EmptyScr
  14.147 @@ -475,16 +475,16 @@
  14.148    Rule_Def.Repeat {id = "d2_polyeq_bdv_only_simplify", preconds = [], rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord),
  14.149      erls = PolyEq_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  14.150      rules =
  14.151 -      [Rule.Thm ("d2_prescind1", TermC.num_str @{thm d2_prescind1}), (*   ax+bx^2=0 -> x(a+bx)=0 *)
  14.152 -       Rule.Thm ("d2_prescind2", TermC.num_str @{thm d2_prescind2}), (*   ax+ x^2=0 -> x(a+ x)=0 *)
  14.153 -       Rule.Thm ("d2_prescind3", TermC.num_str @{thm d2_prescind3}), (*    x+bx^2=0 -> x(1+bx)=0 *)
  14.154 -       Rule.Thm ("d2_prescind4", TermC.num_str @{thm d2_prescind4}), (*    x+ x^2=0 -> x(1+ x)=0 *)
  14.155 -       Rule.Thm ("d2_sqrt_equation1", TermC.num_str @{thm d2_sqrt_equation1}),    (* x^2=c   -> x=+-sqrt(c) *)
  14.156 -       Rule.Thm ("d2_sqrt_equation1_neg", TermC.num_str @{thm d2_sqrt_equation1_neg}), (* [0<c] x^2=c  -> []*)
  14.157 -       Rule.Thm ("d2_sqrt_equation2", TermC.num_str @{thm d2_sqrt_equation2}),    (*  x^2=0 ->    x=0       *)
  14.158 -       Rule.Thm ("d2_reduce_equation1", TermC.num_str @{thm d2_reduce_equation1}),(* x(a+bx)=0 -> x=0 |a+bx=0*)
  14.159 -       Rule.Thm ("d2_reduce_equation2", TermC.num_str @{thm d2_reduce_equation2}),(* x(a+ x)=0 -> x=0 |a+ x=0*)
  14.160 -       Rule.Thm ("d2_isolate_div", TermC.num_str @{thm d2_isolate_div})           (* bx^2=c -> x^2=c/b      *)
  14.161 +      [Rule.Thm ("d2_prescind1", ThmC.numerals_to_Free @{thm d2_prescind1}), (*   ax+bx^2=0 -> x(a+bx)=0 *)
  14.162 +       Rule.Thm ("d2_prescind2", ThmC.numerals_to_Free @{thm d2_prescind2}), (*   ax+ x^2=0 -> x(a+ x)=0 *)
  14.163 +       Rule.Thm ("d2_prescind3", ThmC.numerals_to_Free @{thm d2_prescind3}), (*    x+bx^2=0 -> x(1+bx)=0 *)
  14.164 +       Rule.Thm ("d2_prescind4", ThmC.numerals_to_Free @{thm d2_prescind4}), (*    x+ x^2=0 -> x(1+ x)=0 *)
  14.165 +       Rule.Thm ("d2_sqrt_equation1", ThmC.numerals_to_Free @{thm d2_sqrt_equation1}),    (* x^2=c   -> x=+-sqrt(c) *)
  14.166 +       Rule.Thm ("d2_sqrt_equation1_neg", ThmC.numerals_to_Free @{thm d2_sqrt_equation1_neg}), (* [0<c] x^2=c  -> []*)
  14.167 +       Rule.Thm ("d2_sqrt_equation2", ThmC.numerals_to_Free @{thm d2_sqrt_equation2}),    (*  x^2=0 ->    x=0       *)
  14.168 +       Rule.Thm ("d2_reduce_equation1", ThmC.numerals_to_Free @{thm d2_reduce_equation1}),(* x(a+bx)=0 -> x=0 |a+bx=0*)
  14.169 +       Rule.Thm ("d2_reduce_equation2", ThmC.numerals_to_Free @{thm d2_reduce_equation2}),(* x(a+ x)=0 -> x=0 |a+ x=0*)
  14.170 +       Rule.Thm ("d2_isolate_div", ThmC.numerals_to_Free @{thm d2_isolate_div})           (* bx^2=c -> x^2=c/b      *)
  14.171         ],
  14.172         scr = Rule.EmptyScr
  14.173         });
  14.174 @@ -500,17 +500,17 @@
  14.175         calc = [], errpatts = [],
  14.176         (*asm_thm = [("d2_sqrt_equation1",""),("d2_sqrt_equation1_neg",""),
  14.177                    ("d2_isolate_div","")],*)
  14.178 -       rules = [Rule.Thm("d2_isolate_add1",TermC.num_str @{thm d2_isolate_add1}),
  14.179 +       rules = [Rule.Thm("d2_isolate_add1",ThmC.numerals_to_Free @{thm d2_isolate_add1}),
  14.180                  (* a+   bx^2=0 -> bx^2=(-1)a*)
  14.181 -		Rule.Thm("d2_isolate_add2",TermC.num_str @{thm d2_isolate_add2}),
  14.182 +		Rule.Thm("d2_isolate_add2",ThmC.numerals_to_Free @{thm d2_isolate_add2}),
  14.183                  (* a+    x^2=0 ->  x^2=(-1)a*)
  14.184 -		Rule.Thm("d2_sqrt_equation2",TermC.num_str @{thm d2_sqrt_equation2}),
  14.185 +		Rule.Thm("d2_sqrt_equation2",ThmC.numerals_to_Free @{thm d2_sqrt_equation2}),
  14.186                  (*  x^2=0 ->    x=0    *)
  14.187 -		Rule.Thm("d2_sqrt_equation1",TermC.num_str @{thm d2_sqrt_equation1}),
  14.188 +		Rule.Thm("d2_sqrt_equation1",ThmC.numerals_to_Free @{thm d2_sqrt_equation1}),
  14.189                  (* x^2=c   -> x=+-sqrt(c)*)
  14.190 -		Rule.Thm("d2_sqrt_equation1_neg",TermC.num_str @{thm d2_sqrt_equation1_neg}),
  14.191 +		Rule.Thm("d2_sqrt_equation1_neg",ThmC.numerals_to_Free @{thm d2_sqrt_equation1_neg}),
  14.192                  (* [c<0] x^2=c  -> x=[] *)
  14.193 -		Rule.Thm("d2_isolate_div",TermC.num_str @{thm d2_isolate_div})
  14.194 +		Rule.Thm("d2_isolate_div",ThmC.numerals_to_Free @{thm d2_isolate_div})
  14.195                   (* bx^2=c -> x^2=c/b*)
  14.196  		],
  14.197         scr = Rule.EmptyScr
  14.198 @@ -523,41 +523,41 @@
  14.199    Rule_Def.Repeat {id = "d2_polyeq_pqFormula_simplify", preconds = [],
  14.200         rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord), erls = PolyEq_erls,
  14.201         srls = Rule_Set.Empty, calc = [], errpatts = [],
  14.202 -       rules = [Rule.Thm("d2_pqformula1",TermC.num_str @{thm d2_pqformula1}),
  14.203 +       rules = [Rule.Thm("d2_pqformula1",ThmC.numerals_to_Free @{thm d2_pqformula1}),
  14.204                  (* q+px+ x^2=0 *)
  14.205 -		Rule.Thm("d2_pqformula1_neg",TermC.num_str @{thm d2_pqformula1_neg}),
  14.206 +		Rule.Thm("d2_pqformula1_neg",ThmC.numerals_to_Free @{thm d2_pqformula1_neg}),
  14.207                  (* q+px+ x^2=0 *)
  14.208 -		Rule.Thm("d2_pqformula2",TermC.num_str @{thm d2_pqformula2}), 
  14.209 +		Rule.Thm("d2_pqformula2",ThmC.numerals_to_Free @{thm d2_pqformula2}), 
  14.210                  (* q+px+1x^2=0 *)
  14.211 -		Rule.Thm("d2_pqformula2_neg",TermC.num_str @{thm d2_pqformula2_neg}),
  14.212 +		Rule.Thm("d2_pqformula2_neg",ThmC.numerals_to_Free @{thm d2_pqformula2_neg}),
  14.213                  (* q+px+1x^2=0 *)
  14.214 -		Rule.Thm("d2_pqformula3",TermC.num_str @{thm d2_pqformula3}),
  14.215 +		Rule.Thm("d2_pqformula3",ThmC.numerals_to_Free @{thm d2_pqformula3}),
  14.216                  (* q+ x+ x^2=0 *)
  14.217 -		Rule.Thm("d2_pqformula3_neg",TermC.num_str @{thm d2_pqformula3_neg}), 
  14.218 +		Rule.Thm("d2_pqformula3_neg",ThmC.numerals_to_Free @{thm d2_pqformula3_neg}), 
  14.219                  (* q+ x+ x^2=0 *)
  14.220 -		Rule.Thm("d2_pqformula4",TermC.num_str @{thm d2_pqformula4}),
  14.221 +		Rule.Thm("d2_pqformula4",ThmC.numerals_to_Free @{thm d2_pqformula4}),
  14.222                  (* q+ x+1x^2=0 *)
  14.223 -		Rule.Thm("d2_pqformula4_neg",TermC.num_str @{thm d2_pqformula4_neg}),
  14.224 +		Rule.Thm("d2_pqformula4_neg",ThmC.numerals_to_Free @{thm d2_pqformula4_neg}),
  14.225                  (* q+ x+1x^2=0 *)
  14.226 -		Rule.Thm("d2_pqformula5",TermC.num_str @{thm d2_pqformula5}),
  14.227 +		Rule.Thm("d2_pqformula5",ThmC.numerals_to_Free @{thm d2_pqformula5}),
  14.228                  (*   qx+ x^2=0 *)
  14.229 -		Rule.Thm("d2_pqformula6",TermC.num_str @{thm d2_pqformula6}),
  14.230 +		Rule.Thm("d2_pqformula6",ThmC.numerals_to_Free @{thm d2_pqformula6}),
  14.231                  (*   qx+1x^2=0 *)
  14.232 -		Rule.Thm("d2_pqformula7",TermC.num_str @{thm d2_pqformula7}),
  14.233 +		Rule.Thm("d2_pqformula7",ThmC.numerals_to_Free @{thm d2_pqformula7}),
  14.234                  (*    x+ x^2=0 *)
  14.235 -		Rule.Thm("d2_pqformula8",TermC.num_str @{thm d2_pqformula8}),
  14.236 +		Rule.Thm("d2_pqformula8",ThmC.numerals_to_Free @{thm d2_pqformula8}),
  14.237                  (*    x+1x^2=0 *)
  14.238 -		Rule.Thm("d2_pqformula9",TermC.num_str @{thm d2_pqformula9}),
  14.239 +		Rule.Thm("d2_pqformula9",ThmC.numerals_to_Free @{thm d2_pqformula9}),
  14.240                  (* q   +1x^2=0 *)
  14.241 -		Rule.Thm("d2_pqformula9_neg",TermC.num_str @{thm d2_pqformula9_neg}),
  14.242 +		Rule.Thm("d2_pqformula9_neg",ThmC.numerals_to_Free @{thm d2_pqformula9_neg}),
  14.243                  (* q   +1x^2=0 *)
  14.244 -		Rule.Thm("d2_pqformula10",TermC.num_str @{thm d2_pqformula10}),
  14.245 +		Rule.Thm("d2_pqformula10",ThmC.numerals_to_Free @{thm d2_pqformula10}),
  14.246                  (* q   + x^2=0 *)
  14.247 -		Rule.Thm("d2_pqformula10_neg",TermC.num_str @{thm d2_pqformula10_neg}),
  14.248 +		Rule.Thm("d2_pqformula10_neg",ThmC.numerals_to_Free @{thm d2_pqformula10_neg}),
  14.249                  (* q   + x^2=0 *)
  14.250 -		Rule.Thm("d2_sqrt_equation2",TermC.num_str @{thm d2_sqrt_equation2}),
  14.251 +		Rule.Thm("d2_sqrt_equation2",ThmC.numerals_to_Free @{thm d2_sqrt_equation2}),
  14.252                  (*       x^2=0 *)
  14.253 -		Rule.Thm("d2_sqrt_equation3",TermC.num_str @{thm d2_sqrt_equation3})
  14.254 +		Rule.Thm("d2_sqrt_equation3",ThmC.numerals_to_Free @{thm d2_sqrt_equation3})
  14.255                 (*      1x^2=0 *)
  14.256  	       ],scr = Rule.EmptyScr
  14.257         });
  14.258 @@ -569,41 +569,41 @@
  14.259    Rule_Def.Repeat {id = "d2_polyeq_abcFormula_simplify", preconds = [],
  14.260         rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord), erls = PolyEq_erls,
  14.261         srls = Rule_Set.Empty, calc = [], errpatts = [],
  14.262 -       rules = [Rule.Thm("d2_abcformula1",TermC.num_str @{thm d2_abcformula1}),
  14.263 +       rules = [Rule.Thm("d2_abcformula1",ThmC.numerals_to_Free @{thm d2_abcformula1}),
  14.264                  (*c+bx+cx^2=0 *)
  14.265 -		Rule.Thm("d2_abcformula1_neg",TermC.num_str @{thm d2_abcformula1_neg}),
  14.266 +		Rule.Thm("d2_abcformula1_neg",ThmC.numerals_to_Free @{thm d2_abcformula1_neg}),
  14.267                  (*c+bx+cx^2=0 *)
  14.268 -		Rule.Thm("d2_abcformula2",TermC.num_str @{thm d2_abcformula2}),
  14.269 +		Rule.Thm("d2_abcformula2",ThmC.numerals_to_Free @{thm d2_abcformula2}),
  14.270                  (*c+ x+cx^2=0 *)
  14.271 -		Rule.Thm("d2_abcformula2_neg",TermC.num_str @{thm d2_abcformula2_neg}),
  14.272 +		Rule.Thm("d2_abcformula2_neg",ThmC.numerals_to_Free @{thm d2_abcformula2_neg}),
  14.273                  (*c+ x+cx^2=0 *)
  14.274 -		Rule.Thm("d2_abcformula3",TermC.num_str @{thm d2_abcformula3}), 
  14.275 +		Rule.Thm("d2_abcformula3",ThmC.numerals_to_Free @{thm d2_abcformula3}), 
  14.276                  (*c+bx+ x^2=0 *)
  14.277 -		Rule.Thm("d2_abcformula3_neg",TermC.num_str @{thm d2_abcformula3_neg}),
  14.278 +		Rule.Thm("d2_abcformula3_neg",ThmC.numerals_to_Free @{thm d2_abcformula3_neg}),
  14.279                  (*c+bx+ x^2=0 *)
  14.280 -		Rule.Thm("d2_abcformula4",TermC.num_str @{thm d2_abcformula4}),
  14.281 +		Rule.Thm("d2_abcformula4",ThmC.numerals_to_Free @{thm d2_abcformula4}),
  14.282                  (*c+ x+ x^2=0 *)
  14.283 -		Rule.Thm("d2_abcformula4_neg",TermC.num_str @{thm d2_abcformula4_neg}),
  14.284 +		Rule.Thm("d2_abcformula4_neg",ThmC.numerals_to_Free @{thm d2_abcformula4_neg}),
  14.285                  (*c+ x+ x^2=0 *)
  14.286 -		Rule.Thm("d2_abcformula5",TermC.num_str @{thm d2_abcformula5}),
  14.287 +		Rule.Thm("d2_abcformula5",ThmC.numerals_to_Free @{thm d2_abcformula5}),
  14.288                  (*c+   cx^2=0 *)
  14.289 -		Rule.Thm("d2_abcformula5_neg",TermC.num_str @{thm d2_abcformula5_neg}),
  14.290 +		Rule.Thm("d2_abcformula5_neg",ThmC.numerals_to_Free @{thm d2_abcformula5_neg}),
  14.291                  (*c+   cx^2=0 *)
  14.292 -		Rule.Thm("d2_abcformula6",TermC.num_str @{thm d2_abcformula6}),
  14.293 +		Rule.Thm("d2_abcformula6",ThmC.numerals_to_Free @{thm d2_abcformula6}),
  14.294                  (*c+    x^2=0 *)
  14.295 -		Rule.Thm("d2_abcformula6_neg",TermC.num_str @{thm d2_abcformula6_neg}),
  14.296 +		Rule.Thm("d2_abcformula6_neg",ThmC.numerals_to_Free @{thm d2_abcformula6_neg}),
  14.297                  (*c+    x^2=0 *)
  14.298 -		Rule.Thm("d2_abcformula7",TermC.num_str @{thm d2_abcformula7}),
  14.299 +		Rule.Thm("d2_abcformula7",ThmC.numerals_to_Free @{thm d2_abcformula7}),
  14.300                  (*  bx+ax^2=0 *)
  14.301 -		Rule.Thm("d2_abcformula8",TermC.num_str @{thm d2_abcformula8}),
  14.302 +		Rule.Thm("d2_abcformula8",ThmC.numerals_to_Free @{thm d2_abcformula8}),
  14.303                  (*  bx+ x^2=0 *)
  14.304 -		Rule.Thm("d2_abcformula9",TermC.num_str @{thm d2_abcformula9}),
  14.305 +		Rule.Thm("d2_abcformula9",ThmC.numerals_to_Free @{thm d2_abcformula9}),
  14.306                  (*   x+ax^2=0 *)
  14.307 -		Rule.Thm("d2_abcformula10",TermC.num_str @{thm d2_abcformula10}),
  14.308 +		Rule.Thm("d2_abcformula10",ThmC.numerals_to_Free @{thm d2_abcformula10}),
  14.309                  (*   x+ x^2=0 *)
  14.310 -		Rule.Thm("d2_sqrt_equation2",TermC.num_str @{thm d2_sqrt_equation2}),
  14.311 +		Rule.Thm("d2_sqrt_equation2",ThmC.numerals_to_Free @{thm d2_sqrt_equation2}),
  14.312                  (*      x^2=0 *)  
  14.313 -		Rule.Thm("d2_sqrt_equation3",TermC.num_str @{thm d2_sqrt_equation3})
  14.314 +		Rule.Thm("d2_sqrt_equation3",ThmC.numerals_to_Free @{thm d2_sqrt_equation3})
  14.315                 (*     bx^2=0 *)  
  14.316  	       ],
  14.317         scr = Rule.EmptyScr
  14.318 @@ -617,53 +617,53 @@
  14.319    Rule_Def.Repeat {id = "d2_polyeq_simplify", preconds = [],
  14.320         rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord), erls = PolyEq_erls,
  14.321         srls = Rule_Set.Empty, calc = [], errpatts = [],
  14.322 -       rules = [Rule.Thm("d2_pqformula1",TermC.num_str @{thm d2_pqformula1}),
  14.323 +       rules = [Rule.Thm("d2_pqformula1",ThmC.numerals_to_Free @{thm d2_pqformula1}),
  14.324                  (* p+qx+ x^2=0 *)
  14.325 -		Rule.Thm("d2_pqformula1_neg",TermC.num_str @{thm d2_pqformula1_neg}),
  14.326 +		Rule.Thm("d2_pqformula1_neg",ThmC.numerals_to_Free @{thm d2_pqformula1_neg}),
  14.327                  (* p+qx+ x^2=0 *)
  14.328 -		Rule.Thm("d2_pqformula2",TermC.num_str @{thm d2_pqformula2}),
  14.329 +		Rule.Thm("d2_pqformula2",ThmC.numerals_to_Free @{thm d2_pqformula2}),
  14.330                  (* p+qx+1x^2=0 *)
  14.331 -		Rule.Thm("d2_pqformula2_neg",TermC.num_str @{thm d2_pqformula2_neg}),
  14.332 +		Rule.Thm("d2_pqformula2_neg",ThmC.numerals_to_Free @{thm d2_pqformula2_neg}),
  14.333                  (* p+qx+1x^2=0 *)
  14.334 -		Rule.Thm("d2_pqformula3",TermC.num_str @{thm d2_pqformula3}),
  14.335 +		Rule.Thm("d2_pqformula3",ThmC.numerals_to_Free @{thm d2_pqformula3}),
  14.336                  (* p+ x+ x^2=0 *)
  14.337 -		Rule.Thm("d2_pqformula3_neg",TermC.num_str @{thm d2_pqformula3_neg}),
  14.338 +		Rule.Thm("d2_pqformula3_neg",ThmC.numerals_to_Free @{thm d2_pqformula3_neg}),
  14.339                  (* p+ x+ x^2=0 *)
  14.340 -		Rule.Thm("d2_pqformula4",TermC.num_str @{thm d2_pqformula4}), 
  14.341 +		Rule.Thm("d2_pqformula4",ThmC.numerals_to_Free @{thm d2_pqformula4}), 
  14.342                  (* p+ x+1x^2=0 *)
  14.343 -		Rule.Thm("d2_pqformula4_neg",TermC.num_str @{thm d2_pqformula4_neg}),
  14.344 +		Rule.Thm("d2_pqformula4_neg",ThmC.numerals_to_Free @{thm d2_pqformula4_neg}),
  14.345                  (* p+ x+1x^2=0 *)
  14.346 -		Rule.Thm("d2_abcformula1",TermC.num_str @{thm d2_abcformula1}),
  14.347 +		Rule.Thm("d2_abcformula1",ThmC.numerals_to_Free @{thm d2_abcformula1}),
  14.348                  (* c+bx+cx^2=0 *)
  14.349 -		Rule.Thm("d2_abcformula1_neg",TermC.num_str @{thm d2_abcformula1_neg}),
  14.350 +		Rule.Thm("d2_abcformula1_neg",ThmC.numerals_to_Free @{thm d2_abcformula1_neg}),
  14.351                  (* c+bx+cx^2=0 *)
  14.352 -		Rule.Thm("d2_abcformula2",TermC.num_str @{thm d2_abcformula2}),
  14.353 +		Rule.Thm("d2_abcformula2",ThmC.numerals_to_Free @{thm d2_abcformula2}),
  14.354                  (* c+ x+cx^2=0 *)
  14.355 -		Rule.Thm("d2_abcformula2_neg",TermC.num_str @{thm d2_abcformula2_neg}),
  14.356 +		Rule.Thm("d2_abcformula2_neg",ThmC.numerals_to_Free @{thm d2_abcformula2_neg}),
  14.357                  (* c+ x+cx^2=0 *)
  14.358 -		Rule.Thm("d2_prescind1",TermC.num_str @{thm d2_prescind1}),
  14.359 +		Rule.Thm("d2_prescind1",ThmC.numerals_to_Free @{thm d2_prescind1}),
  14.360                  (*   ax+bx^2=0 -> x(a+bx)=0 *)
  14.361 -		Rule.Thm("d2_prescind2",TermC.num_str @{thm d2_prescind2}),
  14.362 +		Rule.Thm("d2_prescind2",ThmC.numerals_to_Free @{thm d2_prescind2}),
  14.363                  (*   ax+ x^2=0 -> x(a+ x)=0 *)
  14.364 -		Rule.Thm("d2_prescind3",TermC.num_str @{thm d2_prescind3}),
  14.365 +		Rule.Thm("d2_prescind3",ThmC.numerals_to_Free @{thm d2_prescind3}),
  14.366                  (*    x+bx^2=0 -> x(1+bx)=0 *)
  14.367 -		Rule.Thm("d2_prescind4",TermC.num_str @{thm d2_prescind4}),
  14.368 +		Rule.Thm("d2_prescind4",ThmC.numerals_to_Free @{thm d2_prescind4}),
  14.369                  (*    x+ x^2=0 -> x(1+ x)=0 *)
  14.370 -		Rule.Thm("d2_isolate_add1",TermC.num_str @{thm d2_isolate_add1}),
  14.371 +		Rule.Thm("d2_isolate_add1",ThmC.numerals_to_Free @{thm d2_isolate_add1}),
  14.372                  (* a+   bx^2=0 -> bx^2=(-1)a*)
  14.373 -		Rule.Thm("d2_isolate_add2",TermC.num_str @{thm d2_isolate_add2}),
  14.374 +		Rule.Thm("d2_isolate_add2",ThmC.numerals_to_Free @{thm d2_isolate_add2}),
  14.375                  (* a+    x^2=0 ->  x^2=(-1)a*)
  14.376 -		Rule.Thm("d2_sqrt_equation1",TermC.num_str @{thm d2_sqrt_equation1}),
  14.377 +		Rule.Thm("d2_sqrt_equation1",ThmC.numerals_to_Free @{thm d2_sqrt_equation1}),
  14.378                  (* x^2=c   -> x=+-sqrt(c)*)
  14.379 -		Rule.Thm("d2_sqrt_equation1_neg",TermC.num_str @{thm d2_sqrt_equation1_neg}),
  14.380 +		Rule.Thm("d2_sqrt_equation1_neg",ThmC.numerals_to_Free @{thm d2_sqrt_equation1_neg}),
  14.381                  (* [c<0] x^2=c   -> x=[]*)
  14.382 -		Rule.Thm("d2_sqrt_equation2",TermC.num_str @{thm d2_sqrt_equation2}),
  14.383 +		Rule.Thm("d2_sqrt_equation2",ThmC.numerals_to_Free @{thm d2_sqrt_equation2}),
  14.384                  (*  x^2=0 ->    x=0    *)
  14.385 -		Rule.Thm("d2_reduce_equation1",TermC.num_str @{thm d2_reduce_equation1}),
  14.386 +		Rule.Thm("d2_reduce_equation1",ThmC.numerals_to_Free @{thm d2_reduce_equation1}),
  14.387                  (* x(a+bx)=0 -> x=0 | a+bx=0*)
  14.388 -		Rule.Thm("d2_reduce_equation2",TermC.num_str @{thm d2_reduce_equation2}),
  14.389 +		Rule.Thm("d2_reduce_equation2",ThmC.numerals_to_Free @{thm d2_reduce_equation2}),
  14.390                  (* x(a+ x)=0 -> x=0 | a+ x=0*)
  14.391 -		Rule.Thm("d2_isolate_div",TermC.num_str @{thm d2_isolate_div})
  14.392 +		Rule.Thm("d2_isolate_div",ThmC.numerals_to_Free @{thm d2_isolate_div})
  14.393                 (* bx^2=c -> x^2=c/b*)
  14.394  	       ],
  14.395         scr = Rule.EmptyScr
  14.396 @@ -678,65 +678,65 @@
  14.397         rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord), erls = PolyEq_erls,
  14.398         srls = Rule_Set.Empty, calc = [], errpatts = [],
  14.399         rules = 
  14.400 -       [Rule.Thm("d3_reduce_equation1",TermC.num_str @{thm d3_reduce_equation1}),
  14.401 +       [Rule.Thm("d3_reduce_equation1",ThmC.numerals_to_Free @{thm d3_reduce_equation1}),
  14.402  	(*a*bdv + b*bdv^^^2 + c*bdv^^^3=0) = 
  14.403          (bdv=0 | (a + b*bdv + c*bdv^^^2=0)*)
  14.404 -	Rule.Thm("d3_reduce_equation2",TermC.num_str @{thm d3_reduce_equation2}),
  14.405 +	Rule.Thm("d3_reduce_equation2",ThmC.numerals_to_Free @{thm d3_reduce_equation2}),
  14.406  	(*  bdv + b*bdv^^^2 + c*bdv^^^3=0) = 
  14.407          (bdv=0 | (1 + b*bdv + c*bdv^^^2=0)*)
  14.408 -	Rule.Thm("d3_reduce_equation3",TermC.num_str @{thm d3_reduce_equation3}),
  14.409 +	Rule.Thm("d3_reduce_equation3",ThmC.numerals_to_Free @{thm d3_reduce_equation3}),
  14.410  	(*a*bdv +   bdv^^^2 + c*bdv^^^3=0) = 
  14.411          (bdv=0 | (a +   bdv + c*bdv^^^2=0)*)
  14.412 -	Rule.Thm("d3_reduce_equation4",TermC.num_str @{thm d3_reduce_equation4}),
  14.413 +	Rule.Thm("d3_reduce_equation4",ThmC.numerals_to_Free @{thm d3_reduce_equation4}),
  14.414  	(*  bdv +   bdv^^^2 + c*bdv^^^3=0) = 
  14.415          (bdv=0 | (1 +   bdv + c*bdv^^^2=0)*)
  14.416 -	Rule.Thm("d3_reduce_equation5",TermC.num_str @{thm d3_reduce_equation5}),
  14.417 +	Rule.Thm("d3_reduce_equation5",ThmC.numerals_to_Free @{thm d3_reduce_equation5}),
  14.418  	(*a*bdv + b*bdv^^^2 +   bdv^^^3=0) = 
  14.419          (bdv=0 | (a + b*bdv +   bdv^^^2=0)*)
  14.420 -	Rule.Thm("d3_reduce_equation6",TermC.num_str @{thm d3_reduce_equation6}),
  14.421 +	Rule.Thm("d3_reduce_equation6",ThmC.numerals_to_Free @{thm d3_reduce_equation6}),
  14.422  	(*  bdv + b*bdv^^^2 +   bdv^^^3=0) = 
  14.423          (bdv=0 | (1 + b*bdv +   bdv^^^2=0)*)
  14.424 -	Rule.Thm("d3_reduce_equation7",TermC.num_str @{thm d3_reduce_equation7}),
  14.425 +	Rule.Thm("d3_reduce_equation7",ThmC.numerals_to_Free @{thm d3_reduce_equation7}),
  14.426  	     (*a*bdv +   bdv^^^2 +   bdv^^^3=0) = 
  14.427               (bdv=0 | (1 +   bdv +   bdv^^^2=0)*)
  14.428 -	Rule.Thm("d3_reduce_equation8",TermC.num_str @{thm d3_reduce_equation8}),
  14.429 +	Rule.Thm("d3_reduce_equation8",ThmC.numerals_to_Free @{thm d3_reduce_equation8}),
  14.430  	     (*  bdv +   bdv^^^2 +   bdv^^^3=0) = 
  14.431               (bdv=0 | (1 +   bdv +   bdv^^^2=0)*)
  14.432 -	Rule.Thm("d3_reduce_equation9",TermC.num_str @{thm d3_reduce_equation9}),
  14.433 +	Rule.Thm("d3_reduce_equation9",ThmC.numerals_to_Free @{thm d3_reduce_equation9}),
  14.434  	     (*a*bdv             + c*bdv^^^3=0) = 
  14.435               (bdv=0 | (a         + c*bdv^^^2=0)*)
  14.436 -	Rule.Thm("d3_reduce_equation10",TermC.num_str @{thm d3_reduce_equation10}),
  14.437 +	Rule.Thm("d3_reduce_equation10",ThmC.numerals_to_Free @{thm d3_reduce_equation10}),
  14.438  	     (*  bdv             + c*bdv^^^3=0) = 
  14.439               (bdv=0 | (1         + c*bdv^^^2=0)*)
  14.440 -	Rule.Thm("d3_reduce_equation11",TermC.num_str @{thm d3_reduce_equation11}),
  14.441 +	Rule.Thm("d3_reduce_equation11",ThmC.numerals_to_Free @{thm d3_reduce_equation11}),
  14.442  	     (*a*bdv             +   bdv^^^3=0) = 
  14.443               (bdv=0 | (a         +   bdv^^^2=0)*)
  14.444 -	Rule.Thm("d3_reduce_equation12",TermC.num_str @{thm d3_reduce_equation12}),
  14.445 +	Rule.Thm("d3_reduce_equation12",ThmC.numerals_to_Free @{thm d3_reduce_equation12}),
  14.446  	     (*  bdv             +   bdv^^^3=0) = 
  14.447               (bdv=0 | (1         +   bdv^^^2=0)*)
  14.448 -	Rule.Thm("d3_reduce_equation13",TermC.num_str @{thm d3_reduce_equation13}),
  14.449 +	Rule.Thm("d3_reduce_equation13",ThmC.numerals_to_Free @{thm d3_reduce_equation13}),
  14.450  	     (*        b*bdv^^^2 + c*bdv^^^3=0) = 
  14.451               (bdv=0 | (    b*bdv + c*bdv^^^2=0)*)
  14.452 -	Rule.Thm("d3_reduce_equation14",TermC.num_str @{thm d3_reduce_equation14}),
  14.453 +	Rule.Thm("d3_reduce_equation14",ThmC.numerals_to_Free @{thm d3_reduce_equation14}),
  14.454  	     (*          bdv^^^2 + c*bdv^^^3=0) = 
  14.455               (bdv=0 | (      bdv + c*bdv^^^2=0)*)
  14.456 -	Rule.Thm("d3_reduce_equation15",TermC.num_str @{thm d3_reduce_equation15}),
  14.457 +	Rule.Thm("d3_reduce_equation15",ThmC.numerals_to_Free @{thm d3_reduce_equation15}),
  14.458  	     (*        b*bdv^^^2 +   bdv^^^3=0) = 
  14.459               (bdv=0 | (    b*bdv +   bdv^^^2=0)*)
  14.460 -	Rule.Thm("d3_reduce_equation16",TermC.num_str @{thm d3_reduce_equation16}),
  14.461 +	Rule.Thm("d3_reduce_equation16",ThmC.numerals_to_Free @{thm d3_reduce_equation16}),
  14.462  	     (*          bdv^^^2 +   bdv^^^3=0) = 
  14.463               (bdv=0 | (      bdv +   bdv^^^2=0)*)
  14.464 -	Rule.Thm("d3_isolate_add1",TermC.num_str @{thm d3_isolate_add1}),
  14.465 +	Rule.Thm("d3_isolate_add1",ThmC.numerals_to_Free @{thm d3_isolate_add1}),
  14.466  	     (*[|Not(bdv occurs_in a)|] ==> (a + b*bdv^^^3=0) = 
  14.467                (bdv=0 | (b*bdv^^^3=a)*)
  14.468 -	Rule.Thm("d3_isolate_add2",TermC.num_str @{thm d3_isolate_add2}),
  14.469 +	Rule.Thm("d3_isolate_add2",ThmC.numerals_to_Free @{thm d3_isolate_add2}),
  14.470               (*[|Not(bdv occurs_in a)|] ==> (a +   bdv^^^3=0) = 
  14.471                (bdv=0 | (  bdv^^^3=a)*)
  14.472 -	Rule.Thm("d3_isolate_div",TermC.num_str @{thm d3_isolate_div}),
  14.473 +	Rule.Thm("d3_isolate_div",ThmC.numerals_to_Free @{thm d3_isolate_div}),
  14.474          (*[|Not(b=0)|] ==> (b*bdv^^^3=c) = (bdv^^^3=c/b*)
  14.475 -        Rule.Thm("d3_root_equation2",TermC.num_str @{thm d3_root_equation2}),
  14.476 +        Rule.Thm("d3_root_equation2",ThmC.numerals_to_Free @{thm d3_root_equation2}),
  14.477          (*(bdv^^^3=0) = (bdv=0) *)
  14.478 -	Rule.Thm("d3_root_equation1",TermC.num_str @{thm d3_root_equation1})
  14.479 +	Rule.Thm("d3_root_equation1",ThmC.numerals_to_Free @{thm d3_root_equation1})
  14.480         (*bdv^^^3=c) = (bdv = nroot 3 c*)
  14.481         ],
  14.482         scr = Rule.EmptyScr
  14.483 @@ -751,7 +751,7 @@
  14.484         rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord), erls = PolyEq_erls,
  14.485         srls = Rule_Set.Empty, calc = [], errpatts = [],
  14.486         rules = 
  14.487 -       [Rule.Thm("d4_sub_u1",TermC.num_str @{thm d4_sub_u1})  
  14.488 +       [Rule.Thm("d4_sub_u1",ThmC.numerals_to_Free @{thm d4_sub_u1})  
  14.489         (* ax^4+bx^2+c=0 -> x=+-sqrt(ax^2+bx^+c) *)
  14.490         ],
  14.491         scr = Rule.EmptyScr
  14.492 @@ -1237,17 +1237,17 @@
  14.493  		 ord_make_polynomial_in false @{theory "Poly"}),
  14.494        erls = Rule_Set.empty,srls = Rule_Set.Empty,
  14.495        calc = [], errpatts = [],
  14.496 -      rules = [Rule.Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
  14.497 +      rules = [Rule.Thm ("mult_commute",ThmC.numerals_to_Free @{thm mult.commute}),
  14.498  	       (* z * w = w * z *)
  14.499 -	       Rule.Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
  14.500 +	       Rule.Thm ("real_mult_left_commute",ThmC.numerals_to_Free @{thm real_mult_left_commute}),
  14.501  	       (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*)
  14.502 -	       Rule.Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),		
  14.503 +	       Rule.Thm ("mult_assoc",ThmC.numerals_to_Free @{thm mult.assoc}),		
  14.504  	       (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*)
  14.505 -	       Rule.Thm ("add_commute",TermC.num_str @{thm add.commute}),	
  14.506 +	       Rule.Thm ("add_commute",ThmC.numerals_to_Free @{thm add.commute}),	
  14.507  	       (*z + w = w + z*)
  14.508 -	       Rule.Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}),
  14.509 +	       Rule.Thm ("add_left_commute",ThmC.numerals_to_Free @{thm add.left_commute}),
  14.510  	       (*x + (y + z) = y + (x + z)*)
  14.511 -	       Rule.Thm ("add_assoc",TermC.num_str @{thm add.assoc})	               
  14.512 +	       Rule.Thm ("add_assoc",ThmC.numerals_to_Free @{thm add.assoc})	               
  14.513  	       (*z1.0 + z2.0 + z3.0 = z1.0 + (z2.0 + z3.0)*)
  14.514  	       ], scr = Rule.EmptyScr});
  14.515  
  14.516 @@ -1258,30 +1258,30 @@
  14.517        rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  14.518        erls = Rule_Set.empty,srls = Rule_Set.Empty,
  14.519        calc = [], errpatts = [],
  14.520 -      rules = [Rule.Thm ("bdv_collect_1",TermC.num_str @{thm bdv_collect_1}),
  14.521 -	       Rule.Thm ("bdv_collect_2",TermC.num_str @{thm bdv_collect_2}),
  14.522 -	       Rule.Thm ("bdv_collect_3",TermC.num_str @{thm bdv_collect_3}),
  14.523 +      rules = [Rule.Thm ("bdv_collect_1",ThmC.numerals_to_Free @{thm bdv_collect_1}),
  14.524 +	       Rule.Thm ("bdv_collect_2",ThmC.numerals_to_Free @{thm bdv_collect_2}),
  14.525 +	       Rule.Thm ("bdv_collect_3",ThmC.numerals_to_Free @{thm bdv_collect_3}),
  14.526  
  14.527 -	       Rule.Thm ("bdv_collect_assoc1_1",TermC.num_str @{thm bdv_collect_assoc1_1}),
  14.528 -	       Rule.Thm ("bdv_collect_assoc1_2",TermC.num_str @{thm bdv_collect_assoc1_2}),
  14.529 -	       Rule.Thm ("bdv_collect_assoc1_3",TermC.num_str @{thm bdv_collect_assoc1_3}),
  14.530 +	       Rule.Thm ("bdv_collect_assoc1_1",ThmC.numerals_to_Free @{thm bdv_collect_assoc1_1}),
  14.531 +	       Rule.Thm ("bdv_collect_assoc1_2",ThmC.numerals_to_Free @{thm bdv_collect_assoc1_2}),
  14.532 +	       Rule.Thm ("bdv_collect_assoc1_3",ThmC.numerals_to_Free @{thm bdv_collect_assoc1_3}),
  14.533  
  14.534 -	       Rule.Thm ("bdv_collect_assoc2_1",TermC.num_str @{thm bdv_collect_assoc2_1}),
  14.535 -	       Rule.Thm ("bdv_collect_assoc2_2",TermC.num_str @{thm bdv_collect_assoc2_2}),
  14.536 -	       Rule.Thm ("bdv_collect_assoc2_3",TermC.num_str @{thm bdv_collect_assoc2_3}),
  14.537 +	       Rule.Thm ("bdv_collect_assoc2_1",ThmC.numerals_to_Free @{thm bdv_collect_assoc2_1}),
  14.538 +	       Rule.Thm ("bdv_collect_assoc2_2",ThmC.numerals_to_Free @{thm bdv_collect_assoc2_2}),
  14.539 +	       Rule.Thm ("bdv_collect_assoc2_3",ThmC.numerals_to_Free @{thm bdv_collect_assoc2_3}),
  14.540  
  14.541  
  14.542 -	       Rule.Thm ("bdv_n_collect_1",TermC.num_str @{thm bdv_n_collect_1}),
  14.543 -	       Rule.Thm ("bdv_n_collect_2",TermC.num_str @{thm bdv_n_collect_2}),
  14.544 -	       Rule.Thm ("bdv_n_collect_3",TermC.num_str @{thm bdv_n_collect_3}),
  14.545 +	       Rule.Thm ("bdv_n_collect_1",ThmC.numerals_to_Free @{thm bdv_n_collect_1}),
  14.546 +	       Rule.Thm ("bdv_n_collect_2",ThmC.numerals_to_Free @{thm bdv_n_collect_2}),
  14.547 +	       Rule.Thm ("bdv_n_collect_3",ThmC.numerals_to_Free @{thm bdv_n_collect_3}),
  14.548  
  14.549 -	       Rule.Thm ("bdv_n_collect_assoc1_1",TermC.num_str @{thm bdv_n_collect_assoc1_1}),
  14.550 -	       Rule.Thm ("bdv_n_collect_assoc1_2",TermC.num_str @{thm bdv_n_collect_assoc1_2}),
  14.551 -	       Rule.Thm ("bdv_n_collect_assoc1_3",TermC.num_str @{thm bdv_n_collect_assoc1_3}),
  14.552 +	       Rule.Thm ("bdv_n_collect_assoc1_1",ThmC.numerals_to_Free @{thm bdv_n_collect_assoc1_1}),
  14.553 +	       Rule.Thm ("bdv_n_collect_assoc1_2",ThmC.numerals_to_Free @{thm bdv_n_collect_assoc1_2}),
  14.554 +	       Rule.Thm ("bdv_n_collect_assoc1_3",ThmC.numerals_to_Free @{thm bdv_n_collect_assoc1_3}),
  14.555  
  14.556 -	       Rule.Thm ("bdv_n_collect_assoc2_1",TermC.num_str @{thm bdv_n_collect_assoc2_1}),
  14.557 -	       Rule.Thm ("bdv_n_collect_assoc2_2",TermC.num_str @{thm bdv_n_collect_assoc2_2}),
  14.558 -	       Rule.Thm ("bdv_n_collect_assoc2_3",TermC.num_str @{thm bdv_n_collect_assoc2_3})
  14.559 +	       Rule.Thm ("bdv_n_collect_assoc2_1",ThmC.numerals_to_Free @{thm bdv_n_collect_assoc2_1}),
  14.560 +	       Rule.Thm ("bdv_n_collect_assoc2_2",ThmC.numerals_to_Free @{thm bdv_n_collect_assoc2_2}),
  14.561 +	       Rule.Thm ("bdv_n_collect_assoc2_3",ThmC.numerals_to_Free @{thm bdv_n_collect_assoc2_3})
  14.562  	       ], scr = Rule.EmptyScr});
  14.563  
  14.564  \<close>
  14.565 @@ -1298,7 +1298,7 @@
  14.566  	       Rule.Rls_ simplify_power,
  14.567  	       Rule.Rls_ collect_numerals,
  14.568  	       Rule.Rls_ reduce_012,
  14.569 -	       Rule.Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}),
  14.570 +	       Rule.Thm ("realpow_oneI",ThmC.numerals_to_Free @{thm realpow_oneI}),
  14.571  	       Rule.Rls_ discard_parentheses,
  14.572  	       Rule.Rls_ collect_bdv
  14.573  	       ],
  14.574 @@ -1310,15 +1310,15 @@
  14.575  val separate_bdvs = 
  14.576      Rule_Set.append_rules "separate_bdvs"
  14.577  	       collect_bdv
  14.578 -	       [Rule.Thm ("separate_bdv", TermC.num_str @{thm separate_bdv}),
  14.579 +	       [Rule.Thm ("separate_bdv", ThmC.numerals_to_Free @{thm separate_bdv}),
  14.580  		(*"?a * ?bdv / ?b = ?a / ?b * ?bdv"*)
  14.581 -		Rule.Thm ("separate_bdv_n", TermC.num_str @{thm separate_bdv_n}),
  14.582 -		Rule.Thm ("separate_1_bdv", TermC.num_str @{thm separate_1_bdv}),
  14.583 +		Rule.Thm ("separate_bdv_n", ThmC.numerals_to_Free @{thm separate_bdv_n}),
  14.584 +		Rule.Thm ("separate_1_bdv", ThmC.numerals_to_Free @{thm separate_1_bdv}),
  14.585  		(*"?bdv / ?b = (1 / ?b) * ?bdv"*)
  14.586 -		Rule.Thm ("separate_1_bdv_n", TermC.num_str @{thm separate_1_bdv_n}),
  14.587 +		Rule.Thm ("separate_1_bdv_n", ThmC.numerals_to_Free @{thm separate_1_bdv_n}),
  14.588  		(*"?bdv ^^^ ?n / ?b = 1 / ?b * ?bdv ^^^ ?n"*)
  14.589  		Rule.Thm ("add_divide_distrib", 
  14.590 -		     TermC.num_str @{thm add_divide_distrib})
  14.591 +		     ThmC.numerals_to_Free @{thm add_divide_distrib})
  14.592  		(*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"
  14.593  		      WN051031 DOES NOT BELONG TO HERE*)
  14.594  		];
    15.1 --- a/src/Tools/isac/Knowledge/PolyMinus.thy	Mon Apr 13 13:27:55 2020 +0200
    15.2 +++ b/src/Tools/isac/Knowledge/PolyMinus.thy	Mon Apr 13 15:31:23 2020 +0200
    15.3 @@ -194,21 +194,21 @@
    15.4    Rule_Def.Repeat{id = "ordne_alphabetisch", preconds = [], 
    15.5        rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), srls = Rule_Set.Empty, calc = [], errpatts = [],
    15.6        erls = erls_ordne_alphabetisch, 
    15.7 -      rules = [Rule.Thm ("tausche_plus",TermC.num_str @{thm tausche_plus}),
    15.8 +      rules = [Rule.Thm ("tausche_plus",ThmC.numerals_to_Free @{thm tausche_plus}),
    15.9  	       (*"b kleiner a ==> (b + a) = (a + b)"*)
   15.10 -	       Rule.Thm ("tausche_minus",TermC.num_str @{thm tausche_minus}),
   15.11 +	       Rule.Thm ("tausche_minus",ThmC.numerals_to_Free @{thm tausche_minus}),
   15.12  	       (*"b kleiner a ==> (b - a) = (-a + b)"*)
   15.13 -	       Rule.Thm ("tausche_vor_plus",TermC.num_str @{thm tausche_vor_plus}),
   15.14 +	       Rule.Thm ("tausche_vor_plus",ThmC.numerals_to_Free @{thm tausche_vor_plus}),
   15.15  	       (*"[| b ist_monom; a kleiner b  |] ==> (- b + a) = (a - b)"*)
   15.16 -	       Rule.Thm ("tausche_vor_minus",TermC.num_str @{thm tausche_vor_minus}),
   15.17 +	       Rule.Thm ("tausche_vor_minus",ThmC.numerals_to_Free @{thm tausche_vor_minus}),
   15.18  	       (*"[| b ist_monom; a kleiner b  |] ==> (- b - a) = (-a - b)"*)
   15.19 -	       Rule.Thm ("tausche_plus_plus",TermC.num_str @{thm tausche_plus_plus}),
   15.20 +	       Rule.Thm ("tausche_plus_plus",ThmC.numerals_to_Free @{thm tausche_plus_plus}),
   15.21  	       (*"c kleiner b ==> (a + c + b) = (a + b + c)"*)
   15.22 -	       Rule.Thm ("tausche_plus_minus",TermC.num_str @{thm tausche_plus_minus}),
   15.23 +	       Rule.Thm ("tausche_plus_minus",ThmC.numerals_to_Free @{thm tausche_plus_minus}),
   15.24  	       (*"c kleiner b ==> (a + c - b) = (a - b + c)"*)
   15.25 -	       Rule.Thm ("tausche_minus_plus",TermC.num_str @{thm tausche_minus_plus}),
   15.26 +	       Rule.Thm ("tausche_minus_plus",ThmC.numerals_to_Free @{thm tausche_minus_plus}),
   15.27  	       (*"c kleiner b ==> (a - c + b) = (a + b - c)"*)
   15.28 -	       Rule.Thm ("tausche_minus_minus",TermC.num_str @{thm tausche_minus_minus})
   15.29 +	       Rule.Thm ("tausche_minus_minus",ThmC.numerals_to_Free @{thm tausche_minus_minus})
   15.30  	       (*"c kleiner b ==> (a - c - b) = (a - b - c)"*)
   15.31  	       ], scr = Rule.EmptyScr};
   15.32  
   15.33 @@ -219,42 +219,42 @@
   15.34  			  [Rule.Num_Calc ("Prog_Expr.is'_const", Prog_Expr.eval_const "#is_const_")], 
   15.35  	srls = Rule_Set.Empty, calc = [], errpatts = [],
   15.36  	rules = 
   15.37 -	[Rule.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
   15.38 +	[Rule.Thm ("real_num_collect",ThmC.numerals_to_Free @{thm real_num_collect}), 
   15.39  	 (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
   15.40 -	 Rule.Thm ("real_num_collect_assoc_r",TermC.num_str @{thm real_num_collect_assoc_r}),
   15.41 +	 Rule.Thm ("real_num_collect_assoc_r",ThmC.numerals_to_Free @{thm real_num_collect_assoc_r}),
   15.42  	 (*"[| l is_const; m..|] ==>  (k + m * n) + l * n = k + (l + m)*n"*)
   15.43 -	 Rule.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),	
   15.44 +	 Rule.Thm ("real_one_collect",ThmC.numerals_to_Free @{thm real_one_collect}),	
   15.45  	 (*"m is_const ==> n + m * n = (1 + m) * n"*)
   15.46 -	 Rule.Thm ("real_one_collect_assoc_r",TermC.num_str @{thm real_one_collect_assoc_r}), 
   15.47 +	 Rule.Thm ("real_one_collect_assoc_r",ThmC.numerals_to_Free @{thm real_one_collect_assoc_r}), 
   15.48  	 (*"m is_const ==> (k + n) + m * n = k + (m + 1) * n"*)
   15.49  
   15.50  
   15.51 -	 Rule.Thm ("subtrahiere",TermC.num_str @{thm subtrahiere}),
   15.52 +	 Rule.Thm ("subtrahiere",ThmC.numerals_to_Free @{thm subtrahiere}),
   15.53  	 (*"[| l is_const; m is_const |] ==> m * v - l * v = (m - l) * v"*)
   15.54 -	 Rule.Thm ("subtrahiere_von_1",TermC.num_str @{thm subtrahiere_von_1}),
   15.55 +	 Rule.Thm ("subtrahiere_von_1",ThmC.numerals_to_Free @{thm subtrahiere_von_1}),
   15.56  	 (*"[| l is_const |] ==> v - l * v = (1 - l) * v"*)
   15.57 -	 Rule.Thm ("subtrahiere_1",TermC.num_str @{thm subtrahiere_1}),
   15.58 +	 Rule.Thm ("subtrahiere_1",ThmC.numerals_to_Free @{thm subtrahiere_1}),
   15.59  	 (*"[| l is_const; m is_const |] ==> m * v - v = (m - 1) * v"*)
   15.60  
   15.61 -	 Rule.Thm ("subtrahiere_x_plus_minus",TermC.num_str @{thm subtrahiere_x_plus_minus}), 
   15.62 +	 Rule.Thm ("subtrahiere_x_plus_minus",ThmC.numerals_to_Free @{thm subtrahiere_x_plus_minus}), 
   15.63  	 (*"[| l is_const; m..|] ==> (k + m * n) - l * n = k + ( m - l) * n"*)
   15.64 -	 Rule.Thm ("subtrahiere_x_plus1_minus",TermC.num_str @{thm subtrahiere_x_plus1_minus}),
   15.65 +	 Rule.Thm ("subtrahiere_x_plus1_minus",ThmC.numerals_to_Free @{thm subtrahiere_x_plus1_minus}),
   15.66  	 (*"[| l is_const |] ==> (x + v) - l * v = x + (1 - l) * v"*)
   15.67 -	 Rule.Thm ("subtrahiere_x_plus_minus1",TermC.num_str @{thm subtrahiere_x_plus_minus1}),
   15.68 +	 Rule.Thm ("subtrahiere_x_plus_minus1",ThmC.numerals_to_Free @{thm subtrahiere_x_plus_minus1}),
   15.69  	 (*"[| m is_const |] ==> (x + m * v) - v = x + (m - 1) * v"*)
   15.70  
   15.71 -	 Rule.Thm ("subtrahiere_x_minus_plus",TermC.num_str @{thm subtrahiere_x_minus_plus}), 
   15.72 +	 Rule.Thm ("subtrahiere_x_minus_plus",ThmC.numerals_to_Free @{thm subtrahiere_x_minus_plus}), 
   15.73  	 (*"[| l is_const; m..|] ==> (k - m * n) + l * n = k + (-m + l) * n"*)
   15.74 -	 Rule.Thm ("subtrahiere_x_minus1_plus",TermC.num_str @{thm subtrahiere_x_minus1_plus}),
   15.75 +	 Rule.Thm ("subtrahiere_x_minus1_plus",ThmC.numerals_to_Free @{thm subtrahiere_x_minus1_plus}),
   15.76  	 (*"[| l is_const |] ==> (x - v) + l * v = x + (-1 + l) * v"*)
   15.77 -	 Rule.Thm ("subtrahiere_x_minus_plus1",TermC.num_str @{thm subtrahiere_x_minus_plus1}),
   15.78 +	 Rule.Thm ("subtrahiere_x_minus_plus1",ThmC.numerals_to_Free @{thm subtrahiere_x_minus_plus1}),
   15.79  	 (*"[| m is_const |] ==> (x - m * v) + v = x + (-m + 1) * v"*)
   15.80  
   15.81 -	 Rule.Thm ("subtrahiere_x_minus_minus",TermC.num_str @{thm subtrahiere_x_minus_minus}), 
   15.82 +	 Rule.Thm ("subtrahiere_x_minus_minus",ThmC.numerals_to_Free @{thm subtrahiere_x_minus_minus}), 
   15.83  	 (*"[| l is_const; m..|] ==> (k - m * n) - l * n = k + (-m - l) * n"*)
   15.84 -	 Rule.Thm ("subtrahiere_x_minus1_minus",TermC.num_str @{thm subtrahiere_x_minus1_minus}),
   15.85 +	 Rule.Thm ("subtrahiere_x_minus1_minus",ThmC.numerals_to_Free @{thm subtrahiere_x_minus1_minus}),
   15.86  	 (*"[| l is_const |] ==> (x - v) - l * v = x + (-1 - l) * v"*)
   15.87 -	 Rule.Thm ("subtrahiere_x_minus_minus1",TermC.num_str @{thm subtrahiere_x_minus_minus1}),
   15.88 +	 Rule.Thm ("subtrahiere_x_minus_minus1",ThmC.numerals_to_Free @{thm subtrahiere_x_minus_minus1}),
   15.89  	 (*"[| m is_const |] ==> (x - m * v) - v = x + (-m - 1) * v"*)
   15.90  	 
   15.91  	 Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"),
   15.92 @@ -262,18 +262,18 @@
   15.93  	 
   15.94  	 (*MG: Reihenfolge der folgenden 2 Rule.Thm muss so bleiben, wegen
   15.95             (a+a)+a --> a + 2*a --> 3*a and not (a+a)+a --> 2*a + a *)
   15.96 -	 Rule.Thm ("real_mult_2_assoc_r",TermC.num_str @{thm real_mult_2_assoc_r}),
   15.97 +	 Rule.Thm ("real_mult_2_assoc_r",ThmC.numerals_to_Free @{thm real_mult_2_assoc_r}),
   15.98  	 (*"(k + z1) + z1 = k + 2 * z1"*)
   15.99 -	 Rule.Thm ("sym_real_mult_2",TermC.num_str (@{thm real_mult_2} RS @{thm sym})),
  15.100 +	 Rule.Thm ("sym_real_mult_2",ThmC.numerals_to_Free (@{thm real_mult_2} RS @{thm sym})),
  15.101  	 (*"z1 + z1 = 2 * z1"*)
  15.102  
  15.103 -	 Rule.Thm ("addiere_vor_minus",TermC.num_str @{thm addiere_vor_minus}),
  15.104 +	 Rule.Thm ("addiere_vor_minus",ThmC.numerals_to_Free @{thm addiere_vor_minus}),
  15.105  	 (*"[| l is_const; m is_const |] ==> -(l * v) +  m * v = (-l + m) *v"*)
  15.106 -	 Rule.Thm ("addiere_eins_vor_minus",TermC.num_str @{thm addiere_eins_vor_minus}),
  15.107 +	 Rule.Thm ("addiere_eins_vor_minus",ThmC.numerals_to_Free @{thm addiere_eins_vor_minus}),
  15.108  	 (*"[| m is_const |] ==> -  v +  m * v = (-1 + m) * v"*)
  15.109 -	 Rule.Thm ("subtrahiere_vor_minus",TermC.num_str @{thm subtrahiere_vor_minus}),
  15.110 +	 Rule.Thm ("subtrahiere_vor_minus",ThmC.numerals_to_Free @{thm subtrahiere_vor_minus}),
  15.111  	 (*"[| l is_const; m is_const |] ==> -(l * v) -  m * v = (-l - m) *v"*)
  15.112 -	 Rule.Thm ("subtrahiere_eins_vor_minus",TermC.num_str @{thm subtrahiere_eins_vor_minus})
  15.113 +	 Rule.Thm ("subtrahiere_eins_vor_minus",ThmC.numerals_to_Free @{thm subtrahiere_eins_vor_minus})
  15.114  	 (*"[| m is_const |] ==> -  v -  m * v = (-1 - m) * v"*)
  15.115  	 
  15.116  	 ], scr = Rule.EmptyScr};
  15.117 @@ -283,29 +283,29 @@
  15.118        rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), srls = Rule_Set.Empty, calc = [], errpatts = [],
  15.119        erls = Rule_Set.append_rules "erls_verschoenere" Rule_Set.empty 
  15.120  			[Rule.Num_Calc ("PolyMinus.kleiner", eval_kleiner "")], 
  15.121 -      rules = [Rule.Thm ("vorzeichen_minus_weg1",TermC.num_str @{thm vorzeichen_minus_weg1}),
  15.122 +      rules = [Rule.Thm ("vorzeichen_minus_weg1",ThmC.numerals_to_Free @{thm vorzeichen_minus_weg1}),
  15.123  	       (*"l kleiner 0 ==> a + l * b = a - -l * b"*)
  15.124 -	       Rule.Thm ("vorzeichen_minus_weg2",TermC.num_str @{thm vorzeichen_minus_weg2}),
  15.125 +	       Rule.Thm ("vorzeichen_minus_weg2",ThmC.numerals_to_Free @{thm vorzeichen_minus_weg2}),
  15.126  	       (*"l kleiner 0 ==> a - l * b = a + -l * b"*)
  15.127 -	       Rule.Thm ("vorzeichen_minus_weg3",TermC.num_str @{thm vorzeichen_minus_weg3}),
  15.128 +	       Rule.Thm ("vorzeichen_minus_weg3",ThmC.numerals_to_Free @{thm vorzeichen_minus_weg3}),
  15.129  	       (*"l kleiner 0 ==> k + a - l * b = k + a + -l * b"*)
  15.130 -	       Rule.Thm ("vorzeichen_minus_weg4",TermC.num_str @{thm vorzeichen_minus_weg4}),
  15.131 +	       Rule.Thm ("vorzeichen_minus_weg4",ThmC.numerals_to_Free @{thm vorzeichen_minus_weg4}),
  15.132  	       (*"l kleiner 0 ==> k - a - l * b = k - a + -l * b"*)
  15.133  
  15.134  	       Rule.Num_Calc ("Groups.times_class.times", (**)eval_binop "#mult_"),
  15.135  
  15.136 -	       Rule.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),    
  15.137 +	       Rule.Thm ("mult_zero_left",ThmC.numerals_to_Free @{thm mult_zero_left}),    
  15.138  	       (*"0 * z = 0"*)
  15.139 -	       Rule.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),     
  15.140 +	       Rule.Thm ("mult_1_left",ThmC.numerals_to_Free @{thm mult_1_left}),     
  15.141  	       (*"1 * z = z"*)
  15.142 -	       Rule.Thm ("add_0_left",TermC.num_str @{thm add_0_left}),
  15.143 +	       Rule.Thm ("add_0_left",ThmC.numerals_to_Free @{thm add_0_left}),
  15.144  	       (*"0 + z = z"*)
  15.145 -	       Rule.Thm ("null_minus",TermC.num_str @{thm null_minus}),
  15.146 +	       Rule.Thm ("null_minus",ThmC.numerals_to_Free @{thm null_minus}),
  15.147  	       (*"0 - a = -a"*)
  15.148 -	       Rule.Thm ("vor_minus_mal",TermC.num_str @{thm vor_minus_mal})
  15.149 +	       Rule.Thm ("vor_minus_mal",ThmC.numerals_to_Free @{thm vor_minus_mal})
  15.150  	       (*"- a * b = (-a) * b"*)
  15.151  
  15.152 -	       (*Rule.Thm ("",TermC.num_str @{}),*)
  15.153 +	       (*Rule.Thm ("",ThmC.numerals_to_Free @{}),*)
  15.154  	       (**)
  15.155  	       ], scr = Rule.EmptyScr} (*end verschoenere*);
  15.156  
  15.157 @@ -313,30 +313,30 @@
  15.158    Rule_Def.Repeat{id = "klammern_aufloesen", preconds = [], 
  15.159        rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), srls = Rule_Set.Empty, calc = [], errpatts = [], erls = Rule_Set.Empty, 
  15.160        rules = [Rule.Thm ("sym_add_assoc",
  15.161 -                     TermC.num_str (@{thm add.assoc} RS @{thm sym})),
  15.162 +                     ThmC.numerals_to_Free (@{thm add.assoc} RS @{thm sym})),
  15.163  	       (*"a + (b + c) = (a + b) + c"*)
  15.164 -	       Rule.Thm ("klammer_plus_minus",TermC.num_str @{thm klammer_plus_minus}),
  15.165 +	       Rule.Thm ("klammer_plus_minus",ThmC.numerals_to_Free @{thm klammer_plus_minus}),
  15.166  	       (*"a + (b - c) = (a + b) - c"*)
  15.167 -	       Rule.Thm ("klammer_minus_plus",TermC.num_str @{thm klammer_minus_plus}),
  15.168 +	       Rule.Thm ("klammer_minus_plus",ThmC.numerals_to_Free @{thm klammer_minus_plus}),
  15.169  	       (*"a - (b + c) = (a - b) - c"*)
  15.170 -	       Rule.Thm ("klammer_minus_minus",TermC.num_str @{thm klammer_minus_minus})
  15.171 +	       Rule.Thm ("klammer_minus_minus",ThmC.numerals_to_Free @{thm klammer_minus_minus})
  15.172  	       (*"a - (b - c) = (a - b) + c"*)
  15.173  	       ], scr = Rule.EmptyScr};
  15.174  
  15.175  val klammern_ausmultiplizieren = 
  15.176    Rule_Def.Repeat{id = "klammern_ausmultiplizieren", preconds = [], 
  15.177        rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), srls = Rule_Set.Empty, calc = [], errpatts = [], erls = Rule_Set.Empty, 
  15.178 -      rules = [Rule.Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),
  15.179 +      rules = [Rule.Thm ("distrib_right" ,ThmC.numerals_to_Free @{thm distrib_right}),
  15.180  	       (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  15.181 -	       Rule.Thm ("distrib_left",TermC.num_str @{thm distrib_left}),
  15.182 +	       Rule.Thm ("distrib_left",ThmC.numerals_to_Free @{thm distrib_left}),
  15.183  	       (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  15.184  	       
  15.185 -	       Rule.Thm ("klammer_mult_minus",TermC.num_str @{thm klammer_mult_minus}),
  15.186 +	       Rule.Thm ("klammer_mult_minus",ThmC.numerals_to_Free @{thm klammer_mult_minus}),
  15.187  	       (*"a * (b - c) = a * b - a * c"*)
  15.188 -	       Rule.Thm ("klammer_minus_mult",TermC.num_str @{thm klammer_minus_mult})
  15.189 +	       Rule.Thm ("klammer_minus_mult",ThmC.numerals_to_Free @{thm klammer_minus_mult})
  15.190  	       (*"(b - c) * a = b * a - c * a"*)
  15.191  
  15.192 -	       (*Rule.Thm ("",TermC.num_str @{}),
  15.193 +	       (*Rule.Thm ("",ThmC.numerals_to_Free @{}),
  15.194  	       (*""*)*)
  15.195  	       ], scr = Rule.EmptyScr};
  15.196  
  15.197 @@ -347,16 +347,16 @@
  15.198  	       [Rule.Num_Calc ("PolyMinus.kleiner", eval_kleiner ""),
  15.199  		Rule.Num_Calc ("Prog_Expr.is'_atom", Prog_Expr.eval_is_atom "")
  15.200  		], 
  15.201 -      rules = [Rule.Thm ("tausche_mal",TermC.num_str @{thm tausche_mal}),
  15.202 +      rules = [Rule.Thm ("tausche_mal",ThmC.numerals_to_Free @{thm tausche_mal}),
  15.203  	       (*"[| b is_atom; a kleiner b  |] ==> (b * a) = (a * b)"*)
  15.204 -	       Rule.Thm ("tausche_vor_mal",TermC.num_str @{thm tausche_vor_mal}),
  15.205 +	       Rule.Thm ("tausche_vor_mal",ThmC.numerals_to_Free @{thm tausche_vor_mal}),
  15.206  	       (*"[| b is_atom; a kleiner b  |] ==> (-b * a) = (-a * b)"*)
  15.207 -	       Rule.Thm ("tausche_mal_mal",TermC.num_str @{thm tausche_mal_mal}),
  15.208 +	       Rule.Thm ("tausche_mal_mal",ThmC.numerals_to_Free @{thm tausche_mal_mal}),
  15.209  	       (*"[| c is_atom; b kleiner c  |] ==> (a * c * b) = (a * b *c)"*)
  15.210 -	       Rule.Thm ("x_quadrat",TermC.num_str @{thm x_quadrat})
  15.211 +	       Rule.Thm ("x_quadrat",ThmC.numerals_to_Free @{thm x_quadrat})
  15.212  	       (*"(x * a) * a = x * a ^^^ 2"*)
  15.213  
  15.214 -	       (*Rule.Thm ("",TermC.num_str @{}),
  15.215 +	       (*Rule.Thm ("",ThmC.numerals_to_Free @{}),
  15.216  	       (*""*)*)
  15.217  	       ], scr = Rule.EmptyScr};
  15.218  
  15.219 @@ -410,13 +410,13 @@
  15.220          Rule_Set.append_rules "prls_pbl_vereinf_poly" Rule_Set.empty 
  15.221  	        [Rule.Num_Calc ("Poly.is'_polyexp", eval_is_polyexp ""),
  15.222  	          Rule.Num_Calc ("Prog_Expr.matchsub", Prog_Expr.eval_matchsub ""),
  15.223 -	          Rule.Thm ("or_true", TermC.num_str @{thm or_true}),
  15.224 +	          Rule.Thm ("or_true", ThmC.numerals_to_Free @{thm or_true}),
  15.225              (*"(?a | True) = True"*)
  15.226 -            Rule.Thm ("or_false", TermC.num_str @{thm or_false}),
  15.227 +            Rule.Thm ("or_false", ThmC.numerals_to_Free @{thm or_false}),
  15.228              (*"(?a | False) = ?a"*)
  15.229 -            Rule.Thm ("not_true",TermC.num_str @{thm not_true}),
  15.230 +            Rule.Thm ("not_true",ThmC.numerals_to_Free @{thm not_true}),
  15.231              (*"(~ True) = False"*)
  15.232 -            Rule.Thm ("not_false",TermC.num_str @{thm not_false})
  15.233 +            Rule.Thm ("not_false",ThmC.numerals_to_Free @{thm not_false})
  15.234              (*"(~ False) = True"*)], 
  15.235         SOME "Vereinfache t_t", [["simplification","for_polynomials","with_minus"]])),
  15.236      (Specify.prep_pbt thy "pbl_vereinf_poly_klammer" [] Celem.e_pblID
  15.237 @@ -431,13 +431,13 @@
  15.238          Rule_Set.append_rules "prls_pbl_vereinf_poly_klammer" Rule_Set.empty
  15.239            [Rule.Num_Calc ("Poly.is'_polyexp", eval_is_polyexp ""),
  15.240  	           Rule.Num_Calc ("Prog_Expr.matchsub", Prog_Expr.eval_matchsub ""),
  15.241 -             Rule.Thm ("or_true", TermC.num_str @{thm or_true}),
  15.242 +             Rule.Thm ("or_true", ThmC.numerals_to_Free @{thm or_true}),
  15.243               (*"(?a | True) = True"*)
  15.244 -             Rule.Thm ("or_false", TermC.num_str @{thm or_false}),
  15.245 +             Rule.Thm ("or_false", ThmC.numerals_to_Free @{thm or_false}),
  15.246               (*"(?a | False) = ?a"*)
  15.247 -             Rule.Thm ("not_true",TermC.num_str @{thm not_true}),
  15.248 +             Rule.Thm ("not_true",ThmC.numerals_to_Free @{thm not_true}),
  15.249               (*"(~ True) = False"*)
  15.250 -             Rule.Thm ("not_false",TermC.num_str @{thm not_false})
  15.251 +             Rule.Thm ("not_false",ThmC.numerals_to_Free @{thm not_false})
  15.252               (*"(~ False) = True"*)], 
  15.253          SOME "Vereinfache t_t", 
  15.254          [["simplification","for_polynomials","with_parentheses"]])),
  15.255 @@ -493,13 +493,13 @@
  15.256  	        prls = Rule_Set.append_rules "prls_met_simp_poly_minus" Rule_Set.empty 
  15.257  				      [Rule.Num_Calc ("Poly.is'_polyexp", eval_is_polyexp ""),
  15.258  				        Rule.Num_Calc ("Prog_Expr.matchsub", Prog_Expr.eval_matchsub ""),
  15.259 -				        Rule.Thm ("and_true",TermC.num_str @{thm and_true}),
  15.260 +				        Rule.Thm ("and_true",ThmC.numerals_to_Free @{thm and_true}),
  15.261                  (*"(?a & True) = ?a"*)
  15.262 -                Rule.Thm ("and_false",TermC.num_str @{thm and_false}),
  15.263 +                Rule.Thm ("and_false",ThmC.numerals_to_Free @{thm and_false}),
  15.264                  (*"(?a & False) = False"*)
  15.265 -                Rule.Thm ("not_true",TermC.num_str @{thm not_true}),
  15.266 +                Rule.Thm ("not_true",ThmC.numerals_to_Free @{thm not_true}),
  15.267                  (*"(~ True) = False"*)
  15.268 -                Rule.Thm ("not_false",TermC.num_str @{thm not_false})
  15.269 +                Rule.Thm ("not_false",ThmC.numerals_to_Free @{thm not_false})
  15.270                  (*"(~ False) = True"*)],
  15.271            crls = Rule_Set.empty, errpats = [], nrls = rls_p_33},
  15.272            @{thm simplify.simps})]
    16.1 --- a/src/Tools/isac/Knowledge/RatEq.thy	Mon Apr 13 13:27:55 2020 +0200
    16.2 +++ b/src/Tools/isac/Knowledge/RatEq.thy	Mon Apr 13 15:31:23 2020 +0200
    16.3 @@ -88,12 +88,12 @@
    16.4  	      Rule.Num_Calc ("Prog_Expr.rhs", Prog_Expr.eval_rhs ""),
    16.5  	      Rule.Num_Calc ("RatEq.is'_ratequation'_in", eval_is_ratequation_in ""),
    16.6  	      Rule.Num_Calc ("HOL.eq", Prog_Expr.eval_equal "#equal_"),
    16.7 -	      Rule.Thm ("not_true",TermC.num_str @{thm not_true}),
    16.8 -	      Rule.Thm ("not_false",TermC.num_str @{thm not_false}),
    16.9 -	      Rule.Thm ("and_true",TermC.num_str @{thm and_true}),
   16.10 -	      Rule.Thm ("and_false",TermC.num_str @{thm and_false}),
   16.11 -	      Rule.Thm ("or_true",TermC.num_str @{thm or_true}),
   16.12 -	      Rule.Thm ("or_false",TermC.num_str @{thm or_false})
   16.13 +	      Rule.Thm ("not_true",ThmC.numerals_to_Free @{thm not_true}),
   16.14 +	      Rule.Thm ("not_false",ThmC.numerals_to_Free @{thm not_false}),
   16.15 +	      Rule.Thm ("and_true",ThmC.numerals_to_Free @{thm and_true}),
   16.16 +	      Rule.Thm ("and_false",ThmC.numerals_to_Free @{thm and_false}),
   16.17 +	      Rule.Thm ("or_true",ThmC.numerals_to_Free @{thm or_true}),
   16.18 +	      Rule.Thm ("or_false",ThmC.numerals_to_Free @{thm or_false})
   16.19  	      ];
   16.20  
   16.21  \<close> ML \<open>
   16.22 @@ -104,8 +104,8 @@
   16.23  		  (Rule_Set.append_rules "is_ratequation_in"
   16.24  			  Poly_erls [(*Rule.Num_Calc ("Rings.divide_class.divide", Prog_Expr.eval_cancel "#divide_e"),*)
   16.25  			    Rule.Num_Calc ("RatEq.is'_ratequation'_in", eval_is_ratequation_in "")]))
   16.26 - [Rule.Thm ("and_commute",TermC.num_str @{thm and_commute}), (*WN: ein Hack*)
   16.27 -	Rule.Thm ("or_commute",TermC.num_str @{thm or_commute})];  (*WN: ein Hack*)
   16.28 + [Rule.Thm ("and_commute",ThmC.numerals_to_Free @{thm and_commute}), (*WN: ein Hack*)
   16.29 +	Rule.Thm ("or_commute",ThmC.numerals_to_Free @{thm or_commute})];  (*WN: ein Hack*)
   16.30  
   16.31  \<close> ML \<open>
   16.32  val RatEq_crls = 
   16.33 @@ -114,19 +114,19 @@
   16.34  		  (Rule_Set.append_rules "is_ratequation_in"
   16.35  			  Poly_erls [(*Rule.Num_Calc ("Rings.divide_class.divide", Prog_Expr.eval_cancel "#divide_e"),*)
   16.36  			    Rule.Num_Calc ("RatEq.is'_ratequation'_in", eval_is_ratequation_in "")]))
   16.37 - [Rule.Thm ("and_commute",TermC.num_str @{thm and_commute}), (*WN: ein Hack*)
   16.38 -	Rule.Thm ("or_commute",TermC.num_str @{thm or_commute})];  (*WN: ein Hack*)
   16.39 + [Rule.Thm ("and_commute",ThmC.numerals_to_Free @{thm and_commute}), (*WN: ein Hack*)
   16.40 +	Rule.Thm ("or_commute",ThmC.numerals_to_Free @{thm or_commute})];  (*WN: ein Hack*)
   16.41  
   16.42  val RatEq_eliminate = prep_rls'(
   16.43    Rule_Def.Repeat
   16.44      {id = "RatEq_eliminate", preconds = [], rew_ord = ("termlessI", termlessI), erls = rateq_erls,
   16.45       srls = Rule_Set.Empty, calc = [], errpatts = [],
   16.46       rules = [
   16.47 -	     Rule.Thm("rat_mult_denominator_both",TermC.num_str @{thm rat_mult_denominator_both}), 
   16.48 +	     Rule.Thm("rat_mult_denominator_both",ThmC.numerals_to_Free @{thm rat_mult_denominator_both}), 
   16.49  	     (* a/b=c/d -> ad=cb *)
   16.50 -	     Rule.Thm("rat_mult_denominator_left",TermC.num_str @{thm rat_mult_denominator_left}), 
   16.51 +	     Rule.Thm("rat_mult_denominator_left",ThmC.numerals_to_Free @{thm rat_mult_denominator_left}), 
   16.52  	     (* a  =c/d -> ad=c  *)
   16.53 -	     Rule.Thm("rat_mult_denominator_right",TermC.num_str @{thm rat_mult_denominator_right})
   16.54 +	     Rule.Thm("rat_mult_denominator_right",ThmC.numerals_to_Free @{thm rat_mult_denominator_right})
   16.55  	     (* a/b=c   ->  a=cb *)
   16.56  	     ],
   16.57      scr = Rule.EmptyScr});
   16.58 @@ -137,21 +137,21 @@
   16.59      {id = "RatEq_simplify", preconds = [], rew_ord = ("termlessI", termlessI), erls = rateq_erls,
   16.60       srls = Rule_Set.Empty, calc = [], errpatts = [],
   16.61       rules = [
   16.62 -	     Rule.Thm("real_rat_mult_1",TermC.num_str @{thm real_rat_mult_1}),
   16.63 +	     Rule.Thm("real_rat_mult_1",ThmC.numerals_to_Free @{thm real_rat_mult_1}),
   16.64  	     (*a*(b/c) = (a*b)/c*)
   16.65 -	     Rule.Thm("real_rat_mult_2",TermC.num_str @{thm real_rat_mult_2}),
   16.66 +	     Rule.Thm("real_rat_mult_2",ThmC.numerals_to_Free @{thm real_rat_mult_2}),
   16.67  	     (*(a/b)*(c/d) = (a*c)/(b*d)*)
   16.68 -       Rule.Thm("real_rat_mult_3",TermC.num_str @{thm real_rat_mult_3}),
   16.69 +       Rule.Thm("real_rat_mult_3",ThmC.numerals_to_Free @{thm real_rat_mult_3}),
   16.70         (* (a/b)*c = (a*c)/b*)
   16.71 -	     Rule.Thm("real_rat_pow",TermC.num_str @{thm real_rat_pow}),
   16.72 +	     Rule.Thm("real_rat_pow",ThmC.numerals_to_Free @{thm real_rat_pow}),
   16.73  	     (*(a/b)^^^2 = a^^^2/b^^^2*)
   16.74 -	     Rule.Thm("real_diff_minus",TermC.num_str @{thm real_diff_minus}),
   16.75 +	     Rule.Thm("real_diff_minus",ThmC.numerals_to_Free @{thm real_diff_minus}),
   16.76  	     (* a - b = a + (-1) * b *)
   16.77 -       Rule.Thm("rat_double_rat_1",TermC.num_str @{thm rat_double_rat_1}),
   16.78 +       Rule.Thm("rat_double_rat_1",ThmC.numerals_to_Free @{thm rat_double_rat_1}),
   16.79         (* (a / (c/d) = (a*d) / c) *)
   16.80 -       Rule.Thm("rat_double_rat_2",TermC.num_str @{thm rat_double_rat_2}), 
   16.81 +       Rule.Thm("rat_double_rat_2",ThmC.numerals_to_Free @{thm rat_double_rat_2}), 
   16.82         (* ((a/b) / (c/d) = (a*d) / (b*c)) *)
   16.83 -       Rule.Thm("rat_double_rat_3",TermC.num_str @{thm rat_double_rat_3}) 
   16.84 +       Rule.Thm("rat_double_rat_3",ThmC.numerals_to_Free @{thm rat_double_rat_3}) 
   16.85         (* ((a/b) / c = a / (b*c) ) *)],
   16.86       scr = Rule.EmptyScr});
   16.87  \<close>
    17.1 --- a/src/Tools/isac/Knowledge/Rational.thy	Mon Apr 13 13:27:55 2020 +0200
    17.2 +++ b/src/Tools/isac/Knowledge/Rational.thy	Mon Apr 13 15:31:23 2020 +0200
    17.3 @@ -395,8 +395,8 @@
    17.4        rules = 
    17.5          [Rule.Num_Calc ("HOL.eq", Prog_Expr.eval_equal "#equal_"),
    17.6          Rule.Num_Calc ("Prog_Expr.is'_const", Prog_Expr.eval_const "#is_const_"),
    17.7 -        Rule.Thm ("not_true", TermC.num_str @{thm not_true}),
    17.8 -        Rule.Thm ("not_false", TermC.num_str @{thm not_false})], 
    17.9 +        Rule.Thm ("not_true", ThmC.numerals_to_Free @{thm not_true}),
   17.10 +        Rule.Thm ("not_false", ThmC.numerals_to_Free @{thm not_false})], 
   17.11        scr = Rule.EmptyScr});
   17.12  
   17.13  (* simplifies expressions with numerals;
   17.14 @@ -410,39 +410,39 @@
   17.15        rules = 
   17.16          [Rule.Num_Calc ("Rings.divide_class.divide", Prog_Expr.eval_cancel "#divide_e"),
   17.17  
   17.18 -        Rule.Thm ("minus_divide_left", TermC.num_str (@{thm minus_divide_left} RS @{thm sym})),
   17.19 +        Rule.Thm ("minus_divide_left", ThmC.numerals_to_Free (@{thm minus_divide_left} RS @{thm sym})),
   17.20            (*SYM - ?x / ?y = - (?x / ?y)  may come from subst*)
   17.21 -        Rule.Thm ("rat_add", TermC.num_str @{thm rat_add}),
   17.22 +        Rule.Thm ("rat_add", ThmC.numerals_to_Free @{thm rat_add}),
   17.23            (*"[| a is_const; b is_const; c is_const; d is_const |] ==> \
   17.24            \a / c + b / d = (a * d) / (c * d) + (b * c ) / (d * c)"*)
   17.25 -        Rule.Thm ("rat_add1", TermC.num_str @{thm rat_add1}),
   17.26 +        Rule.Thm ("rat_add1", ThmC.numerals_to_Free @{thm rat_add1}),
   17.27            (*"[| a is_const; b is_const; c is_const |] ==> a / c + b / c = (a + b) / c"*)
   17.28 -        Rule.Thm ("rat_add2", TermC.num_str @{thm rat_add2}),
   17.29 +        Rule.Thm ("rat_add2", ThmC.numerals_to_Free @{thm rat_add2}),
   17.30            (*"[| ?a is_const; ?b is_const; ?c is_const |] ==> ?a / ?c + ?b = (?a + ?b * ?c) / ?c"*)
   17.31 -        Rule.Thm ("rat_add3", TermC.num_str @{thm rat_add3}),
   17.32 +        Rule.Thm ("rat_add3", ThmC.numerals_to_Free @{thm rat_add3}),
   17.33            (*"[| a is_const; b is_const; c is_const |] ==> a + b / c = (a * c) / c + b / c"\
   17.34            .... is_const to be omitted here FIXME*)
   17.35          
   17.36 -        Rule.Thm ("rat_mult", TermC.num_str @{thm rat_mult}), 
   17.37 +        Rule.Thm ("rat_mult", ThmC.numerals_to_Free @{thm rat_mult}), 
   17.38            (*a / b * (c / d) = a * c / (b * d)*)
   17.39 -        Rule.Thm ("times_divide_eq_right", TermC.num_str @{thm times_divide_eq_right}),
   17.40 +        Rule.Thm ("times_divide_eq_right", ThmC.numerals_to_Free @{thm times_divide_eq_right}),
   17.41            (*?x * (?y / ?z) = ?x * ?y / ?z*)
   17.42 -        Rule.Thm ("times_divide_eq_left", TermC.num_str @{thm times_divide_eq_left}),
   17.43 +        Rule.Thm ("times_divide_eq_left", ThmC.numerals_to_Free @{thm times_divide_eq_left}),
   17.44            (*?y / ?z * ?x = ?y * ?x / ?z*)
   17.45          
   17.46 -        Rule.Thm ("real_divide_divide1", TermC.num_str @{thm real_divide_divide1}),
   17.47 +        Rule.Thm ("real_divide_divide1", ThmC.numerals_to_Free @{thm real_divide_divide1}),
   17.48            (*"?y ~= 0 ==> ?u / ?v / (?y / ?z) = ?u / ?v * (?z / ?y)"*)
   17.49 -        Rule.Thm ("divide_divide_eq_left", TermC.num_str @{thm divide_divide_eq_left}),
   17.50 +        Rule.Thm ("divide_divide_eq_left", ThmC.numerals_to_Free @{thm divide_divide_eq_left}),
   17.51            (*"?x / ?y / ?z = ?x / (?y * ?z)"*)
   17.52          
   17.53 -        Rule.Thm ("rat_power", TermC.num_str @{thm rat_power}),
   17.54 +        Rule.Thm ("rat_power", ThmC.numerals_to_Free @{thm rat_power}),
   17.55            (*"(?a / ?b) ^^^ ?n = ?a ^^^ ?n / ?b ^^^ ?n"*)
   17.56          
   17.57 -        Rule.Thm ("mult_cross", TermC.num_str @{thm mult_cross}),
   17.58 +        Rule.Thm ("mult_cross", ThmC.numerals_to_Free @{thm mult_cross}),
   17.59            (*"[| b ~= 0; d ~= 0 |] ==> (a / b = c / d) = (a * d = b * c)*)
   17.60 -        Rule.Thm ("mult_cross1", TermC.num_str @{thm mult_cross1}),
   17.61 +        Rule.Thm ("mult_cross1", ThmC.numerals_to_Free @{thm mult_cross1}),
   17.62            (*"   b ~= 0            ==> (a / b = c    ) = (a     = b * c)*)
   17.63 -        Rule.Thm ("mult_cross2", TermC.num_str @{thm mult_cross2})
   17.64 +        Rule.Thm ("mult_cross2", ThmC.numerals_to_Free @{thm mult_cross2})
   17.65            (*"           d ~= 0    ==> (a     = c / d) = (a * d =     c)*)], 
   17.66        scr = Rule.EmptyScr})
   17.67      calculate_Poly);
   17.68 @@ -478,7 +478,7 @@
   17.69      val SOME (t'', asm) = cancel_p_ thy t;
   17.70      val der = Rtools.reverse_deriv thy eval_rls rules ro NONE t';
   17.71      val der = der @ 
   17.72 -      [(Rule.Thm ("real_mult_div_cancel2", TermC.num_str @{thm real_mult_div_cancel2}), (t'', asm))]
   17.73 +      [(Rule.Thm ("real_mult_div_cancel2", ThmC.numerals_to_Free @{thm real_mult_div_cancel2}), (t'', asm))]
   17.74      val rs = (Rtools.distinct_Thm o (map #1)) der
   17.75    	val rs = filter_out (Rtools.eq_Thms 
   17.76    	  ["sym_real_add_zero_left", "sym_real_mult_0", "sym_real_mult_1"]) rs
   17.77 @@ -539,7 +539,7 @@
   17.78      val SOME (t'', asm) = add_fraction_p_ thy t;
   17.79      val der = Rtools.reverse_deriv thy eval_rls rules ro NONE t';
   17.80      val der = der @ 
   17.81 -      [(Rule.Thm ("real_mult_div_cancel2", TermC.num_str @{thm real_mult_div_cancel2}), (t'',asm))]
   17.82 +      [(Rule.Thm ("real_mult_div_cancel2", ThmC.numerals_to_Free @{thm real_mult_div_cancel2}), (t'',asm))]
   17.83      val rs = (Rtools.distinct_Thm o (map #1)) der;
   17.84      val rs = filter_out (Rtools.eq_Thms 
   17.85        ["sym_real_add_zero_left", "sym_real_mult_0", "sym_real_mult_1"]) rs;
   17.86 @@ -606,8 +606,8 @@
   17.87        rules = [Rule.Num_Calc ("Prog_Expr.is'_atom", Prog_Expr.eval_is_atom "#is_atom_"),
   17.88  	       Rule.Num_Calc ("Prog_Expr.is'_even", Prog_Expr.eval_is_even "#is_even_"),
   17.89  	       Rule.Num_Calc ("Orderings.ord_class.less", Prog_Expr.eval_equ "#less_"),
   17.90 -	       Rule.Thm ("not_false", TermC.num_str @{thm not_false}),
   17.91 -	       Rule.Thm ("not_true", TermC.num_str @{thm not_true}),
   17.92 +	       Rule.Thm ("not_false", ThmC.numerals_to_Free @{thm not_false}),
   17.93 +	       Rule.Thm ("not_true", ThmC.numerals_to_Free @{thm not_true}),
   17.94  	       Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_")
   17.95  	       ],
   17.96        scr = Rule.EmptyScr
   17.97 @@ -617,29 +617,29 @@
   17.98  val powers = prep_rls'(
   17.99    Rule_Def.Repeat {id = "powers", preconds = [], rew_ord = ("dummy_ord",Rewrite_Ord.dummy_ord), 
  17.100        erls = powers_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  17.101 -      rules = [Rule.Thm ("realpow_multI", TermC.num_str @{thm realpow_multI}),
  17.102 +      rules = [Rule.Thm ("realpow_multI", ThmC.numerals_to_Free @{thm realpow_multI}),
  17.103  	       (*"(r * s) ^^^ n = r ^^^ n * s ^^^ n"*)
  17.104 -	       Rule.Thm ("realpow_pow",TermC.num_str @{thm realpow_pow}),
  17.105 +	       Rule.Thm ("realpow_pow",ThmC.numerals_to_Free @{thm realpow_pow}),
  17.106  	       (*"(a ^^^ b) ^^^ c = a ^^^ (b * c)"*)
  17.107 -	       Rule.Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}),
  17.108 +	       Rule.Thm ("realpow_oneI",ThmC.numerals_to_Free @{thm realpow_oneI}),
  17.109  	       (*"r ^^^ 1 = r"*)
  17.110 -	       Rule.Thm ("realpow_minus_even",TermC.num_str @{thm realpow_minus_even}),
  17.111 +	       Rule.Thm ("realpow_minus_even",ThmC.numerals_to_Free @{thm realpow_minus_even}),
  17.112  	       (*"n is_even ==> (- r) ^^^ n = r ^^^ n" ?-->discard_minus?*)
  17.113 -	       Rule.Thm ("realpow_minus_odd",TermC.num_str @{thm realpow_minus_odd}),
  17.114 +	       Rule.Thm ("realpow_minus_odd",ThmC.numerals_to_Free @{thm realpow_minus_odd}),
  17.115  	       (*"Not (n is_even) ==> (- r) ^^^ n = -1 * r ^^^ n"*)
  17.116  	       
  17.117  	       (*----- collect atoms over * -----*)
  17.118 -	       Rule.Thm ("realpow_two_atom",TermC.num_str @{thm realpow_two_atom}),	
  17.119 +	       Rule.Thm ("realpow_two_atom",ThmC.numerals_to_Free @{thm realpow_two_atom}),	
  17.120  	       (*"r is_atom ==> r * r = r ^^^ 2"*)
  17.121 -	       Rule.Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),		
  17.122 +	       Rule.Thm ("realpow_plus_1",ThmC.numerals_to_Free @{thm realpow_plus_1}),		
  17.123  	       (*"r is_atom ==> r * r ^^^ n = r ^^^ (n + 1)"*)
  17.124 -	       Rule.Thm ("realpow_addI_atom",TermC.num_str @{thm realpow_addI_atom}),
  17.125 +	       Rule.Thm ("realpow_addI_atom",ThmC.numerals_to_Free @{thm realpow_addI_atom}),
  17.126  	       (*"r is_atom ==> r ^^^ n * r ^^^ m = r ^^^ (n + m)"*)
  17.127  
  17.128  	       (*----- distribute none-atoms -----*)
  17.129 -	       Rule.Thm ("realpow_def_atom",TermC.num_str @{thm realpow_def_atom}),
  17.130 +	       Rule.Thm ("realpow_def_atom",ThmC.numerals_to_Free @{thm realpow_def_atom}),
  17.131  	       (*"[| 1 < n; not(r is_atom) |]==>r ^^^ n = r * r ^^^ (n + -1)"*)
  17.132 -	       Rule.Thm ("realpow_eq_oneI",TermC.num_str @{thm realpow_eq_oneI}),
  17.133 +	       Rule.Thm ("realpow_eq_oneI",ThmC.numerals_to_Free @{thm realpow_eq_oneI}),
  17.134  	       (*"1 ^^^ n = 1"*)
  17.135  	       Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_")
  17.136  	       ],
  17.137 @@ -650,20 +650,20 @@
  17.138    Rule_Def.Repeat {id = "rat_mult_divide", preconds = [], 
  17.139        rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), 
  17.140        erls = Rule_Set.empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
  17.141 -      rules = [Rule.Thm ("rat_mult",TermC.num_str @{thm rat_mult}),
  17.142 +      rules = [Rule.Thm ("rat_mult",ThmC.numerals_to_Free @{thm rat_mult}),
  17.143  	       (*(1)"?a / ?b * (?c / ?d) = ?a * ?c / (?b * ?d)"*)
  17.144 -	       Rule.Thm ("times_divide_eq_right",TermC.num_str @{thm times_divide_eq_right}),
  17.145 +	       Rule.Thm ("times_divide_eq_right",ThmC.numerals_to_Free @{thm times_divide_eq_right}),
  17.146  	       (*(2)"?a * (?c / ?d) = ?a * ?c / ?d" must be [2],
  17.147  	       otherwise inv.to a / b / c = ...*)
  17.148 -	       Rule.Thm ("times_divide_eq_left",TermC.num_str @{thm times_divide_eq_left}),
  17.149 +	       Rule.Thm ("times_divide_eq_left",ThmC.numerals_to_Free @{thm times_divide_eq_left}),
  17.150  	       (*"?a / ?b * ?c = ?a * ?c / ?b" order weights x^^^n too much
  17.151  		     and does not commute a / b * c ^^^ 2 !*)
  17.152  	       
  17.153  	       Rule.Thm ("divide_divide_eq_right", 
  17.154 -                     TermC.num_str @{thm divide_divide_eq_right}),
  17.155 +                     ThmC.numerals_to_Free @{thm divide_divide_eq_right}),
  17.156  	       (*"?x / (?y / ?z) = ?x * ?z / ?y"*)
  17.157  	       Rule.Thm ("divide_divide_eq_left",
  17.158 -                     TermC.num_str @{thm divide_divide_eq_left}),
  17.159 +                     ThmC.numerals_to_Free @{thm divide_divide_eq_left}),
  17.160  	       (*"?x / ?y / ?z = ?x / (?y * ?z)"*)
  17.161  	       Rule.Num_Calc ("Rings.divide_class.divide", Prog_Expr.eval_cancel "#divide_e")
  17.162  	       ],
  17.163 @@ -674,29 +674,29 @@
  17.164  val reduce_0_1_2 = prep_rls'(
  17.165    Rule_Def.Repeat{id = "reduce_0_1_2", preconds = [], rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  17.166        erls = Rule_Set.empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
  17.167 -      rules = [(*Rule.Thm ("divide_1",TermC.num_str @{thm divide_1}),
  17.168 +      rules = [(*Rule.Thm ("divide_1",ThmC.numerals_to_Free @{thm divide_1}),
  17.169  		 "?x / 1 = ?x" unnecess.for normalform*)
  17.170 -	       Rule.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),                 
  17.171 +	       Rule.Thm ("mult_1_left",ThmC.numerals_to_Free @{thm mult_1_left}),                 
  17.172  	       (*"1 * z = z"*)
  17.173 -	       (*Rule.Thm ("real_mult_minus1",TermC.num_str @{thm real_mult_minus1}),
  17.174 +	       (*Rule.Thm ("real_mult_minus1",ThmC.numerals_to_Free @{thm real_mult_minus1}),
  17.175  	       "-1 * z = - z"*)
  17.176 -	       (*Rule.Thm ("real_minus_mult_cancel",TermC.num_str @{thm real_minus_mult_cancel}),
  17.177 +	       (*Rule.Thm ("real_minus_mult_cancel",ThmC.numerals_to_Free @{thm real_minus_mult_cancel}),
  17.178  	       "- ?x * - ?y = ?x * ?y"*)
  17.179  
  17.180 -	       Rule.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),        
  17.181 +	       Rule.Thm ("mult_zero_left",ThmC.numerals_to_Free @{thm mult_zero_left}),        
  17.182  	       (*"0 * z = 0"*)
  17.183 -	       Rule.Thm ("add_0_left",TermC.num_str @{thm add_0_left}),
  17.184 +	       Rule.Thm ("add_0_left",ThmC.numerals_to_Free @{thm add_0_left}),
  17.185  	       (*"0 + z = z"*)
  17.186 -	       (*Rule.Thm ("right_minus",TermC.num_str @{thm right_minus}),
  17.187 +	       (*Rule.Thm ("right_minus",ThmC.numerals_to_Free @{thm right_minus}),
  17.188  	       "?z + - ?z = 0"*)
  17.189  
  17.190  	       Rule.Thm ("sym_real_mult_2",
  17.191 -                     TermC.num_str (@{thm real_mult_2} RS @{thm sym})),	
  17.192 +                     ThmC.numerals_to_Free (@{thm real_mult_2} RS @{thm sym})),	
  17.193  	       (*"z1 + z1 = 2 * z1"*)
  17.194 -	       Rule.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),
  17.195 +	       Rule.Thm ("real_mult_2_assoc",ThmC.numerals_to_Free @{thm real_mult_2_assoc}),
  17.196  	       (*"z1 + (z1 + k) = 2 * z1 + k"*)
  17.197  
  17.198 -	       Rule.Thm ("division_ring_divide_zero",TermC.num_str @{thm division_ring_divide_zero})
  17.199 +	       Rule.Thm ("division_ring_divide_zero",ThmC.numerals_to_Free @{thm division_ring_divide_zero})
  17.200  	       (*"0 / ?x = 0"*)
  17.201  	       ], scr = Rule.EmptyScr});
  17.202  
  17.203 @@ -741,20 +741,20 @@
  17.204  val simplify_rational = 
  17.205      Rule_Set.merge "simplify_rational" expand_binoms
  17.206      (Rule_Set.append_rules "divide" calculate_Rational
  17.207 -		[Rule.Thm ("div_by_1",TermC.num_str @{thm div_by_1}),
  17.208 +		[Rule.Thm ("div_by_1",ThmC.numerals_to_Free @{thm div_by_1}),
  17.209  		 (*"?x / 1 = ?x"*)
  17.210 -		 Rule.Thm ("rat_mult",TermC.num_str @{thm rat_mult}),
  17.211 +		 Rule.Thm ("rat_mult",ThmC.numerals_to_Free @{thm rat_mult}),
  17.212  		 (*(1)"?a / ?b * (?c / ?d) = ?a * ?c / (?b * ?d)"*)
  17.213 -		 Rule.Thm ("times_divide_eq_right",TermC.num_str @{thm times_divide_eq_right}),
  17.214 +		 Rule.Thm ("times_divide_eq_right",ThmC.numerals_to_Free @{thm times_divide_eq_right}),
  17.215  		 (*(2)"?a * (?c / ?d) = ?a * ?c / ?d" must be [2],
  17.216  		 otherwise inv.to a / b / c = ...*)
  17.217 -		 Rule.Thm ("times_divide_eq_left",TermC.num_str @{thm times_divide_eq_left}),
  17.218 +		 Rule.Thm ("times_divide_eq_left",ThmC.numerals_to_Free @{thm times_divide_eq_left}),
  17.219  		 (*"?a / ?b * ?c = ?a * ?c / ?b"*)
  17.220 -		 Rule.Thm ("add_minus",TermC.num_str @{thm add_minus}),
  17.221 +		 Rule.Thm ("add_minus",ThmC.numerals_to_Free @{thm add_minus}),
  17.222  		 (*"?a + ?b - ?b = ?a"*)
  17.223 -		 Rule.Thm ("add_minus1",TermC.num_str @{thm add_minus1}),
  17.224 +		 Rule.Thm ("add_minus1",ThmC.numerals_to_Free @{thm add_minus1}),
  17.225  		 (*"?a - ?b + ?b = ?a"*)
  17.226 -		 Rule.Thm ("divide_minus1",TermC.num_str @{thm divide_minus1})
  17.227 +		 Rule.Thm ("divide_minus1",ThmC.numerals_to_Free @{thm divide_minus1})
  17.228  		 (*"?x / -1 = - ?x"*)
  17.229  		 ]);
  17.230  \<close>
  17.231 @@ -780,9 +780,9 @@
  17.232  	  erls = Rule_Set.append_rules "Rule_Set.empty-is_polyexp" Rule_Set.empty [Rule.Num_Calc ("Poly.is'_polyexp", eval_is_polyexp "")], 
  17.233  	  srls = Rule_Set.Empty, calc = [], errpatts = [],
  17.234  	  rules = 
  17.235 -	    [Rule.Thm ("rat_mult_poly_l",TermC.num_str @{thm rat_mult_poly_l}),
  17.236 +	    [Rule.Thm ("rat_mult_poly_l",ThmC.numerals_to_Free @{thm rat_mult_poly_l}),
  17.237  	    (*"?c is_polyexp ==> ?c * (?a / ?b) = ?c * ?a / ?b"*)
  17.238 -	    Rule.Thm ("rat_mult_poly_r",TermC.num_str @{thm rat_mult_poly_r})
  17.239 +	    Rule.Thm ("rat_mult_poly_r",ThmC.numerals_to_Free @{thm rat_mult_poly_r})
  17.240  	    (*"?c is_polyexp ==> ?a / ?b * ?c = ?a * ?c / ?b"*) ], 
  17.241  	  scr = Rule.EmptyScr});
  17.242  
  17.243 @@ -794,22 +794,22 @@
  17.244  val rat_mult_div_pow = prep_rls'(
  17.245    Rule_Def.Repeat {id = "rat_mult_div_pow", preconds = [], rew_ord = ("dummy_ord",Rewrite_Ord.dummy_ord), 
  17.246      erls = Rule_Set.empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
  17.247 -    rules = [Rule.Thm ("rat_mult", TermC.num_str @{thm rat_mult}),
  17.248 +    rules = [Rule.Thm ("rat_mult", ThmC.numerals_to_Free @{thm rat_mult}),
  17.249        (*"?a / ?b * (?c / ?d) = ?a * ?c / (?b * ?d)"*)
  17.250 -      Rule.Thm ("rat_mult_poly_l", TermC.num_str @{thm rat_mult_poly_l}),
  17.251 +      Rule.Thm ("rat_mult_poly_l", ThmC.numerals_to_Free @{thm rat_mult_poly_l}),
  17.252        (*"?c is_polyexp ==> ?c * (?a / ?b) = ?c * ?a / ?b"*)
  17.253 -      Rule.Thm ("rat_mult_poly_r", TermC.num_str @{thm rat_mult_poly_r}),
  17.254 +      Rule.Thm ("rat_mult_poly_r", ThmC.numerals_to_Free @{thm rat_mult_poly_r}),
  17.255        (*"?c is_polyexp ==> ?a / ?b * ?c = ?a * ?c / ?b"*)
  17.256        
  17.257 -      Rule.Thm ("real_divide_divide1_mg", TermC.num_str @{thm real_divide_divide1_mg}),
  17.258 +      Rule.Thm ("real_divide_divide1_mg", ThmC.numerals_to_Free @{thm real_divide_divide1_mg}),
  17.259        (*"y ~= 0 ==> (u / v) / (y / z) = (u * z) / (y * v)"*)
  17.260 -      Rule.Thm ("divide_divide_eq_right", TermC.num_str @{thm divide_divide_eq_right}),
  17.261 +      Rule.Thm ("divide_divide_eq_right", ThmC.numerals_to_Free @{thm divide_divide_eq_right}),
  17.262        (*"?x / (?y / ?z) = ?x * ?z / ?y"*)
  17.263 -      Rule.Thm ("divide_divide_eq_left", TermC.num_str @{thm divide_divide_eq_left}),
  17.264 +      Rule.Thm ("divide_divide_eq_left", ThmC.numerals_to_Free @{thm divide_divide_eq_left}),
  17.265        (*"?x / ?y / ?z = ?x / (?y * ?z)"*)
  17.266        Rule.Num_Calc ("Rings.divide_class.divide", Prog_Expr.eval_cancel "#divide_e"),
  17.267        
  17.268 -      Rule.Thm ("rat_power", TermC.num_str @{thm rat_power})
  17.269 +      Rule.Thm ("rat_power", ThmC.numerals_to_Free @{thm rat_power})
  17.270        (*"(?a / ?b) ^^^ ?n = ?a ^^^ ?n / ?b ^^^ ?n"*)
  17.271        ],
  17.272      scr = Rule.EmptyScr});
  17.273 @@ -818,9 +818,9 @@
  17.274    Rule_Def.Repeat {id = "rat_reduce_1", preconds = [], rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), 
  17.275      erls = Rule_Set.empty, srls = Rule_Set.Empty, calc = [], errpatts = [], 
  17.276      rules = 
  17.277 -      [Rule.Thm ("div_by_1", TermC.num_str @{thm div_by_1}),
  17.278 +      [Rule.Thm ("div_by_1", ThmC.numerals_to_Free @{thm div_by_1}),
  17.279        (*"?x / 1 = ?x"*)
  17.280 -      Rule.Thm ("mult_1_left", TermC.num_str @{thm mult_1_left})           
  17.281 +      Rule.Thm ("mult_1_left", ThmC.numerals_to_Free @{thm mult_1_left})           
  17.282        (*"1 * z = z"*)
  17.283        ],
  17.284      scr = Rule.EmptyScr});
    18.1 --- a/src/Tools/isac/Knowledge/Root.thy	Mon Apr 13 13:27:55 2020 +0200
    18.2 +++ b/src/Tools/isac/Knowledge/Root.thy	Mon Apr 13 15:31:23 2020 +0200
    18.3 @@ -163,7 +163,7 @@
    18.4  (*-------------------------rulse-------------------------*)
    18.5  val Root_crls = 
    18.6        Rule_Set.append_rules "Root_crls" Atools_erls 
    18.7 -       [Rule.Thm  ("real_unari_minus",TermC.num_str @{thm real_unari_minus}),
    18.8 +       [Rule.Thm  ("real_unari_minus",ThmC.numerals_to_Free @{thm real_unari_minus}),
    18.9          Rule.Num_Calc ("NthRoot.sqrt" , eval_sqrt "#sqrt_"),
   18.10          Rule.Num_Calc ("Rings.divide_class.divide", Prog_Expr.eval_cancel "#divide_e"),
   18.11          Rule.Num_Calc ("Prog_Expr.pow" , (**)eval_binop "#power_"),
   18.12 @@ -175,7 +175,7 @@
   18.13  
   18.14  val Root_erls = 
   18.15        Rule_Set.append_rules "Root_erls" Atools_erls 
   18.16 -       [Rule.Thm  ("real_unari_minus",TermC.num_str @{thm real_unari_minus}),
   18.17 +       [Rule.Thm  ("real_unari_minus",ThmC.numerals_to_Free @{thm real_unari_minus}),
   18.18          Rule.Num_Calc ("NthRoot.sqrt" , eval_sqrt "#sqrt_"),
   18.19          Rule.Num_Calc ("Rings.divide_class.divide", Prog_Expr.eval_cancel "#divide_e"),
   18.20          Rule.Num_Calc ("Prog_Expr.pow" , (**)eval_binop "#power_"),
   18.21 @@ -193,57 +193,57 @@
   18.22        rew_ord = ("sqrt_right", sqrt_right false thy),
   18.23        erls = Atools_erls, srls = Rule_Set.Empty,
   18.24        calc = [], errpatts = [],
   18.25 -      rules = [Rule.Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}),			
   18.26 +      rules = [Rule.Thm ("real_diff_minus",ThmC.numerals_to_Free @{thm real_diff_minus}),			
   18.27  	       (*"a - b = a + (-1) * b"*)
   18.28  
   18.29 -	       Rule.Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),	
   18.30 +	       Rule.Thm ("distrib_right" ,ThmC.numerals_to_Free @{thm distrib_right}),	
   18.31  	       (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
   18.32 -	       Rule.Thm ("distrib_left",TermC.num_str @{thm distrib_left}),	
   18.33 +	       Rule.Thm ("distrib_left",ThmC.numerals_to_Free @{thm distrib_left}),	
   18.34  	       (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
   18.35 -	       Rule.Thm ("left_diff_distrib" ,TermC.num_str @{thm left_diff_distrib}),	
   18.36 +	       Rule.Thm ("left_diff_distrib" ,ThmC.numerals_to_Free @{thm left_diff_distrib}),	
   18.37  	       (*"(z1.0 - z2.0) * w = z1.0 * w - z2.0 * w"*)
   18.38 -	       Rule.Thm ("right_diff_distrib",TermC.num_str @{thm right_diff_distrib}),	
   18.39 +	       Rule.Thm ("right_diff_distrib",ThmC.numerals_to_Free @{thm right_diff_distrib}),	
   18.40  	       (*"w * (z1.0 - z2.0) = w * z1.0 - w * z2.0"*)
   18.41  
   18.42 -	       Rule.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),                         
   18.43 +	       Rule.Thm ("mult_1_left",ThmC.numerals_to_Free @{thm mult_1_left}),                         
   18.44  	       (*"1 * z = z"*)
   18.45 -	       Rule.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),                         
   18.46 +	       Rule.Thm ("mult_zero_left",ThmC.numerals_to_Free @{thm mult_zero_left}),                         
   18.47  	       (*"0 * z = 0"*)
   18.48 -	       Rule.Thm ("add_0_left",TermC.num_str @{thm add_0_left}),		
   18.49 +	       Rule.Thm ("add_0_left",ThmC.numerals_to_Free @{thm add_0_left}),		
   18.50  	       (*"0 + z = z"*)
   18.51   
   18.52 -	       Rule.Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
   18.53 +	       Rule.Thm ("mult_commute",ThmC.numerals_to_Free @{thm mult.commute}),
   18.54  		(*AC-rewriting*)
   18.55 -	       Rule.Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
   18.56 +	       Rule.Thm ("real_mult_left_commute",ThmC.numerals_to_Free @{thm real_mult_left_commute}),
   18.57           	(**)
   18.58 -	       Rule.Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),
   18.59 +	       Rule.Thm ("mult_assoc",ThmC.numerals_to_Free @{thm mult.assoc}),
   18.60  	        (**)
   18.61 -	       Rule.Thm ("add_commute",TermC.num_str @{thm add.commute}),
   18.62 +	       Rule.Thm ("add_commute",ThmC.numerals_to_Free @{thm add.commute}),
   18.63  		(**)
   18.64 -	       Rule.Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}),
   18.65 +	       Rule.Thm ("add_left_commute",ThmC.numerals_to_Free @{thm add.left_commute}),
   18.66  	        (**)
   18.67 -	       Rule.Thm ("add_assoc",TermC.num_str @{thm add.assoc}),
   18.68 +	       Rule.Thm ("add_assoc",ThmC.numerals_to_Free @{thm add.assoc}),
   18.69  	        (**)
   18.70  
   18.71  	       Rule.Thm ("sym_realpow_twoI",
   18.72 -                     TermC.num_str (@{thm realpow_twoI} RS @{thm sym})),
   18.73 +                     ThmC.numerals_to_Free (@{thm realpow_twoI} RS @{thm sym})),
   18.74  	       (*"r1 * r1 = r1 ^^^ 2"*)
   18.75 -	       Rule.Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),			
   18.76 +	       Rule.Thm ("realpow_plus_1",ThmC.numerals_to_Free @{thm realpow_plus_1}),			
   18.77  	       (*"r * r ^^^ n = r ^^^ (n + 1)"*)
   18.78  	       Rule.Thm ("sym_real_mult_2",
   18.79 -                     TermC.num_str (@{thm real_mult_2} RS @{thm sym})),
   18.80 +                     ThmC.numerals_to_Free (@{thm real_mult_2} RS @{thm sym})),
   18.81  	       (*"z1 + z1 = 2 * z1"*)
   18.82 -	       Rule.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),		
   18.83 +	       Rule.Thm ("real_mult_2_assoc",ThmC.numerals_to_Free @{thm real_mult_2_assoc}),		
   18.84  	       (*"z1 + (z1 + k) = 2 * z1 + k"*)
   18.85  
   18.86 -	       Rule.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
   18.87 +	       Rule.Thm ("real_num_collect",ThmC.numerals_to_Free @{thm real_num_collect}), 
   18.88  	       (*"[| l is_const; m is_const |]==> l * n + m * n = (l + m) * n"*)
   18.89 -	       Rule.Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),	
   18.90 +	       Rule.Thm ("real_num_collect_assoc",ThmC.numerals_to_Free @{thm real_num_collect_assoc}),	
   18.91  	       (*"[| l is_const; m is_const |] ==>  
   18.92                                     l * n + (m * n + k) =  (l + m) * n + k"*)
   18.93 -	       Rule.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),		
   18.94 +	       Rule.Thm ("real_one_collect",ThmC.numerals_to_Free @{thm real_one_collect}),		
   18.95  	       (*"m is_const ==> n + m * n = (1 + m) * n"*)
   18.96 -	       Rule.Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), 
   18.97 +	       Rule.Thm ("real_one_collect_assoc",ThmC.numerals_to_Free @{thm real_one_collect_assoc}), 
   18.98  	       (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
   18.99  
  18.100  	       Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"), 
  18.101 @@ -263,33 +263,33 @@
  18.102        rew_ord = ("termlessI",termlessI),
  18.103        erls = Atools_erls, srls = Rule_Set.Empty,
  18.104        calc = [], errpatts = [],
  18.105 -      rules = [Rule.Thm ("real_plus_binom_pow2"  ,TermC.num_str @{thm real_plus_binom_pow2}),     
  18.106 +      rules = [Rule.Thm ("real_plus_binom_pow2"  ,ThmC.numerals_to_Free @{thm real_plus_binom_pow2}),     
  18.107  	       (*"(a + b) ^^^ 2 = a ^^^ 2 + 2 * a * b + b ^^^ 2"*)
  18.108 -	       Rule.Thm ("real_plus_binom_times" ,TermC.num_str @{thm real_plus_binom_times}),    
  18.109 +	       Rule.Thm ("real_plus_binom_times" ,ThmC.numerals_to_Free @{thm real_plus_binom_times}),    
  18.110  	       (*"(a + b)*(a + b) = ...*)
  18.111 -	       Rule.Thm ("real_minus_binom_pow2" ,TermC.num_str @{thm real_minus_binom_pow2}),    
  18.112 +	       Rule.Thm ("real_minus_binom_pow2" ,ThmC.numerals_to_Free @{thm real_minus_binom_pow2}),    
  18.113  		(*"(a - b) ^^^ 2 = a ^^^ 2 - 2 * a * b + b ^^^ 2"*)
  18.114 -	       Rule.Thm ("real_minus_binom_times",TermC.num_str @{thm real_minus_binom_times}),   
  18.115 +	       Rule.Thm ("real_minus_binom_times",ThmC.numerals_to_Free @{thm real_minus_binom_times}),   
  18.116  	       (*"(a - b)*(a - b) = ...*)
  18.117 -	       Rule.Thm ("real_plus_minus_binom1",TermC.num_str @{thm real_plus_minus_binom1}),   
  18.118 +	       Rule.Thm ("real_plus_minus_binom1",ThmC.numerals_to_Free @{thm real_plus_minus_binom1}),   
  18.119  		(*"(a + b) * (a - b) = a ^^^ 2 - b ^^^ 2"*)
  18.120 -	       Rule.Thm ("real_plus_minus_binom2",TermC.num_str @{thm real_plus_minus_binom2}),   
  18.121 +	       Rule.Thm ("real_plus_minus_binom2",ThmC.numerals_to_Free @{thm real_plus_minus_binom2}),   
  18.122  		(*"(a - b) * (a + b) = a ^^^ 2 - b ^^^ 2"*)
  18.123  	       (*RL 020915*)
  18.124 -	       Rule.Thm ("real_pp_binom_times",TermC.num_str @{thm real_pp_binom_times}), 
  18.125 +	       Rule.Thm ("real_pp_binom_times",ThmC.numerals_to_Free @{thm real_pp_binom_times}), 
  18.126  		(*(a + b)*(c + d) = a*c + a*d + b*c + b*d*)
  18.127 -               Rule.Thm ("real_pm_binom_times",TermC.num_str @{thm real_pm_binom_times}), 
  18.128 +               Rule.Thm ("real_pm_binom_times",ThmC.numerals_to_Free @{thm real_pm_binom_times}), 
  18.129  		(*(a + b)*(c - d) = a*c - a*d + b*c - b*d*)
  18.130 -               Rule.Thm ("real_mp_binom_times",TermC.num_str @{thm real_mp_binom_times}), 
  18.131 +               Rule.Thm ("real_mp_binom_times",ThmC.numerals_to_Free @{thm real_mp_binom_times}), 
  18.132  		(*(a - b)*(c p d) = a*c + a*d - b*c - b*d*)
  18.133 -               Rule.Thm ("real_mm_binom_times",TermC.num_str @{thm real_mm_binom_times}), 
  18.134 +               Rule.Thm ("real_mm_binom_times",ThmC.numerals_to_Free @{thm real_mm_binom_times}), 
  18.135  		(*(a - b)*(c p d) = a*c - a*d - b*c + b*d*)
  18.136 -	       Rule.Thm ("realpow_mul",TermC.num_str @{thm realpow_mul}),                 
  18.137 +	       Rule.Thm ("realpow_mul",ThmC.numerals_to_Free @{thm realpow_mul}),                 
  18.138  		(*(a*b)^^^n = a^^^n * b^^^n*)
  18.139  
  18.140 -	       Rule.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),         (*"1 * z = z"*)
  18.141 -	       Rule.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),         (*"0 * z = 0"*)
  18.142 -	       Rule.Thm ("add_0_left",TermC.num_str @{thm add_0_left}), 
  18.143 +	       Rule.Thm ("mult_1_left",ThmC.numerals_to_Free @{thm mult_1_left}),         (*"1 * z = z"*)
  18.144 +	       Rule.Thm ("mult_zero_left",ThmC.numerals_to_Free @{thm mult_zero_left}),         (*"0 * z = 0"*)
  18.145 +	       Rule.Thm ("add_0_left",ThmC.numerals_to_Free @{thm add_0_left}), 
  18.146                   (*"0 + z = z"*)
  18.147  
  18.148  	       Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"), 
  18.149 @@ -300,21 +300,21 @@
  18.150  	       Rule.Num_Calc ("Prog_Expr.pow", (**)eval_binop "#power_"),
  18.151  
  18.152  	       Rule.Thm ("sym_realpow_twoI",
  18.153 -                     TermC.num_str (@{thm realpow_twoI} RS @{thm sym})),
  18.154 +                     ThmC.numerals_to_Free (@{thm realpow_twoI} RS @{thm sym})),
  18.155  	       (*"r1 * r1 = r1 ^^^ 2"*)
  18.156 -	       Rule.Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),			
  18.157 +	       Rule.Thm ("realpow_plus_1",ThmC.numerals_to_Free @{thm realpow_plus_1}),			
  18.158  	       (*"r * r ^^^ n = r ^^^ (n + 1)"*)
  18.159 -	       Rule.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),		
  18.160 +	       Rule.Thm ("real_mult_2_assoc",ThmC.numerals_to_Free @{thm real_mult_2_assoc}),		
  18.161  	       (*"z1 + (z1 + k) = 2 * z1 + k"*)
  18.162  
  18.163 -	       Rule.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  18.164 +	       Rule.Thm ("real_num_collect",ThmC.numerals_to_Free @{thm real_num_collect}), 
  18.165  	       (*"[| l is_const; m is_const |] ==>l * n + m * n = (l + m) * n"*)
  18.166 -	       Rule.Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),	
  18.167 +	       Rule.Thm ("real_num_collect_assoc",ThmC.numerals_to_Free @{thm real_num_collect_assoc}),	
  18.168  	       (*"[| l is_const; m is_const |] ==>
  18.169                    l * n + (m * n + k) =  (l + m) * n + k"*)
  18.170 -	       Rule.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),		
  18.171 +	       Rule.Thm ("real_one_collect",ThmC.numerals_to_Free @{thm real_one_collect}),		
  18.172  	       (*"m is_const ==> n + m * n = (1 + m) * n"*)
  18.173 -	       Rule.Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), 
  18.174 +	       Rule.Thm ("real_one_collect_assoc",ThmC.numerals_to_Free @{thm real_one_collect_assoc}), 
  18.175  	       (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  18.176  
  18.177  	       Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"), 
    19.1 --- a/src/Tools/isac/Knowledge/RootEq.thy	Mon Apr 13 13:27:55 2020 +0200
    19.2 +++ b/src/Tools/isac/Knowledge/RootEq.thy	Mon Apr 13 15:31:23 2020 +0200
    19.3 @@ -188,21 +188,21 @@
    19.4  	      Rule.Num_Calc ("RootEq.is'_rootTerm'_in", eval_is_rootTerm_in ""),
    19.5  	      Rule.Num_Calc ("RootEq.is'_normSqrtTerm'_in", eval_is_normSqrtTerm_in ""),
    19.6  	      Rule.Num_Calc ("HOL.eq", Prog_Expr.eval_equal "#equal_"),
    19.7 -	      Rule.Thm ("not_true", TermC.num_str @{thm not_true}),
    19.8 -	      Rule.Thm ("not_false", TermC.num_str @{thm not_false}),
    19.9 -	      Rule.Thm ("and_true", TermC.num_str @{thm and_true}),
   19.10 -	      Rule.Thm ("and_false", TermC.num_str @{thm and_false}),
   19.11 -	      Rule.Thm ("or_true", TermC.num_str @{thm or_true}),
   19.12 -	      Rule.Thm ("or_false", TermC.num_str @{thm or_false})
   19.13 +	      Rule.Thm ("not_true", ThmC.numerals_to_Free @{thm not_true}),
   19.14 +	      Rule.Thm ("not_false", ThmC.numerals_to_Free @{thm not_false}),
   19.15 +	      Rule.Thm ("and_true", ThmC.numerals_to_Free @{thm and_true}),
   19.16 +	      Rule.Thm ("and_false", ThmC.numerals_to_Free @{thm and_false}),
   19.17 +	      Rule.Thm ("or_true", ThmC.numerals_to_Free @{thm or_true}),
   19.18 +	      Rule.Thm ("or_false", ThmC.numerals_to_Free @{thm or_false})
   19.19  	      ];
   19.20  
   19.21  val RootEq_erls =
   19.22    Rule_Set.append_rules "RootEq_erls" Root_erls
   19.23 -    [Rule.Thm ("divide_divide_eq_left", TermC.num_str @{thm divide_divide_eq_left})];
   19.24 +    [Rule.Thm ("divide_divide_eq_left", ThmC.numerals_to_Free @{thm divide_divide_eq_left})];
   19.25  
   19.26  val RootEq_crls = 
   19.27    Rule_Set.append_rules "RootEq_crls" Root_crls
   19.28 -    [Rule.Thm ("divide_divide_eq_left", TermC.num_str @{thm divide_divide_eq_left})];
   19.29 +    [Rule.Thm ("divide_divide_eq_left", ThmC.numerals_to_Free @{thm divide_divide_eq_left})];
   19.30  
   19.31  val rooteq_srls = 
   19.32    Rule_Set.append_rules "rooteq_srls" Rule_Set.empty
   19.33 @@ -217,95 +217,95 @@
   19.34    Rule_Def.Repeat {id = "sqrt_isolate", preconds = [], rew_ord = ("termlessI",termlessI), 
   19.35         erls = RootEq_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
   19.36         rules = [
   19.37 -       Rule.Thm("sqrt_square_1",TermC.num_str @{thm sqrt_square_1}),
   19.38 +       Rule.Thm("sqrt_square_1",ThmC.numerals_to_Free @{thm sqrt_square_1}),
   19.39                       (* (sqrt a)^^^2 -> a *)
   19.40 -       Rule.Thm("sqrt_square_2",TermC.num_str @{thm sqrt_square_2}),
   19.41 +       Rule.Thm("sqrt_square_2",ThmC.numerals_to_Free @{thm sqrt_square_2}),
   19.42                       (* sqrt (a^^^2) -> a *)
   19.43 -       Rule.Thm("sqrt_times_root_1",TermC.num_str @{thm sqrt_times_root_1}),
   19.44 +       Rule.Thm("sqrt_times_root_1",ThmC.numerals_to_Free @{thm sqrt_times_root_1}),
   19.45              (* sqrt a sqrt b -> sqrt(ab) *)
   19.46 -       Rule.Thm("sqrt_times_root_2",TermC.num_str @{thm sqrt_times_root_2}),
   19.47 +       Rule.Thm("sqrt_times_root_2",ThmC.numerals_to_Free @{thm sqrt_times_root_2}),
   19.48              (* a sqrt b sqrt c -> a sqrt(bc) *)
   19.49         Rule.Thm("sqrt_square_equation_both_1",
   19.50 -           TermC.num_str @{thm sqrt_square_equation_both_1}),
   19.51 +           ThmC.numerals_to_Free @{thm sqrt_square_equation_both_1}),
   19.52         (* (sqrt a + sqrt b  = sqrt c + sqrt d) -> 
   19.53              (a+2*sqrt(a)*sqrt(b)+b) = c+2*sqrt(c)*sqrt(d)+d) *)
   19.54         Rule.Thm("sqrt_square_equation_both_2",
   19.55 -            TermC.num_str @{thm sqrt_square_equation_both_2}),
   19.56 +            ThmC.numerals_to_Free @{thm sqrt_square_equation_both_2}),
   19.57         (* (sqrt a - sqrt b  = sqrt c + sqrt d) -> 
   19.58              (a-2*sqrt(a)*sqrt(b)+b) = c+2*sqrt(c)*sqrt(d)+d) *)
   19.59         Rule.Thm("sqrt_square_equation_both_3",
   19.60 -            TermC.num_str @{thm sqrt_square_equation_both_3}),
   19.61 +            ThmC.numerals_to_Free @{thm sqrt_square_equation_both_3}),
   19.62         (* (sqrt a + sqrt b  = sqrt c - sqrt d) -> 
   19.63              (a+2*sqrt(a)*sqrt(b)+b) = c-2*sqrt(c)*sqrt(d)+d) *)
   19.64         Rule.Thm("sqrt_square_equation_both_4",
   19.65 -            TermC.num_str @{thm sqrt_square_equation_both_4}),
   19.66 +            ThmC.numerals_to_Free @{thm sqrt_square_equation_both_4}),
   19.67         (* (sqrt a - sqrt b  = sqrt c - sqrt d) -> 
   19.68              (a-2*sqrt(a)*sqrt(b)+b) = c-2*sqrt(c)*sqrt(d)+d) *)
   19.69         Rule.Thm("sqrt_isolate_l_add1",
   19.70 -            TermC.num_str @{thm sqrt_isolate_l_add1}), 
   19.71 +            ThmC.numerals_to_Free @{thm sqrt_isolate_l_add1}), 
   19.72         (* a+b*sqrt(x)=d -> b*sqrt(x) = d-a *)
   19.73         Rule.Thm("sqrt_isolate_l_add2",
   19.74 -            TermC.num_str @{thm sqrt_isolate_l_add2}), 
   19.75 +            ThmC.numerals_to_Free @{thm sqrt_isolate_l_add2}), 
   19.76         (* a+  sqrt(x)=d ->   sqrt(x) = d-a *)
   19.77         Rule.Thm("sqrt_isolate_l_add3",
   19.78 -            TermC.num_str @{thm sqrt_isolate_l_add3}), 
   19.79 +            ThmC.numerals_to_Free @{thm sqrt_isolate_l_add3}), 
   19.80         (* a+b*c/sqrt(x)=d->b*c/sqrt(x)=d-a *)
   19.81         Rule.Thm("sqrt_isolate_l_add4",
   19.82 -            TermC.num_str @{thm sqrt_isolate_l_add4}), 
   19.83 +            ThmC.numerals_to_Free @{thm sqrt_isolate_l_add4}), 
   19.84         (* a+c/sqrt(x)=d -> c/sqrt(x) = d-a *)
   19.85         Rule.Thm("sqrt_isolate_l_add5",
   19.86 -            TermC.num_str @{thm sqrt_isolate_l_add5}), 
   19.87 +            ThmC.numerals_to_Free @{thm sqrt_isolate_l_add5}), 
   19.88         (* a+b*c/f*sqrt(x)=d->b*c/f*sqrt(x)=d-a *)
   19.89         Rule.Thm("sqrt_isolate_l_add6",
   19.90 -            TermC.num_str @{thm sqrt_isolate_l_add6}), 
   19.91 +            ThmC.numerals_to_Free @{thm sqrt_isolate_l_add6}), 
   19.92         (* a+c/f*sqrt(x)=d -> c/f*sqrt(x) = d-a *)
   19.93 -       (*Rule.Thm("sqrt_isolate_l_div",TermC.num_str @{thm sqrt_isolate_l_div}),*)
   19.94 +       (*Rule.Thm("sqrt_isolate_l_div",ThmC.numerals_to_Free @{thm sqrt_isolate_l_div}),*)
   19.95           (* b*sqrt(x) = d sqrt(x) d/b *)
   19.96         Rule.Thm("sqrt_isolate_r_add1",
   19.97 -            TermC.num_str @{thm sqrt_isolate_r_add1}),
   19.98 +            ThmC.numerals_to_Free @{thm sqrt_isolate_r_add1}),
   19.99         (* a= d+e*sqrt(x) -> a-d=e*sqrt(x) *)
  19.100         Rule.Thm("sqrt_isolate_r_add2",
  19.101 -            TermC.num_str @{thm sqrt_isolate_r_add2}),
  19.102 +            ThmC.numerals_to_Free @{thm sqrt_isolate_r_add2}),
  19.103         (* a= d+  sqrt(x) -> a-d=  sqrt(x) *)
  19.104         Rule.Thm("sqrt_isolate_r_add3",
  19.105 -            TermC.num_str @{thm sqrt_isolate_r_add3}),
  19.106 +            ThmC.numerals_to_Free @{thm sqrt_isolate_r_add3}),
  19.107         (* a=d+e*g/sqrt(x)->a-d=e*g/sqrt(x)*)
  19.108         Rule.Thm("sqrt_isolate_r_add4",
  19.109 -            TermC.num_str @{thm sqrt_isolate_r_add4}),
  19.110 +            ThmC.numerals_to_Free @{thm sqrt_isolate_r_add4}),
  19.111         (* a= d+g/sqrt(x) -> a-d=g/sqrt(x) *)
  19.112         Rule.Thm("sqrt_isolate_r_add5",
  19.113 -            TermC.num_str @{thm sqrt_isolate_r_add5}),
  19.114 +            ThmC.numerals_to_Free @{thm sqrt_isolate_r_add5}),
  19.115         (* a=d+e*g/h*sqrt(x)->a-d=e*g/h*sqrt(x)*)
  19.116         Rule.Thm("sqrt_isolate_r_add6",
  19.117 -            TermC.num_str @{thm sqrt_isolate_r_add6}),
  19.118 +            ThmC.numerals_to_Free @{thm sqrt_isolate_r_add6}),
  19.119         (* a= d+g/h*sqrt(x) -> a-d=g/h*sqrt(x) *)
  19.120 -       (*Rule.Thm("sqrt_isolate_r_div",TermC.num_str @{thm sqrt_isolate_r_div}),*)
  19.121 +       (*Rule.Thm("sqrt_isolate_r_div",ThmC.numerals_to_Free @{thm sqrt_isolate_r_div}),*)
  19.122           (* a=e*sqrt(x) -> a/e = sqrt(x) *)
  19.123         Rule.Thm("sqrt_square_equation_left_1",
  19.124 -            TermC.num_str @{thm sqrt_square_equation_left_1}),   
  19.125 +            ThmC.numerals_to_Free @{thm sqrt_square_equation_left_1}),   
  19.126         (* sqrt(x)=b -> x=b^2 *)
  19.127         Rule.Thm("sqrt_square_equation_left_2",
  19.128 -            TermC.num_str @{thm sqrt_square_equation_left_2}),   
  19.129 +            ThmC.numerals_to_Free @{thm sqrt_square_equation_left_2}),   
  19.130         (* c*sqrt(x)=b -> c^2*x=b^2 *)
  19.131 -       Rule.Thm("sqrt_square_equation_left_3",TermC.num_str @{thm sqrt_square_equation_left_3}),  
  19.132 +       Rule.Thm("sqrt_square_equation_left_3",ThmC.numerals_to_Free @{thm sqrt_square_equation_left_3}),  
  19.133  	      (* c/sqrt(x)=b -> c^2/x=b^2 *)
  19.134 -       Rule.Thm("sqrt_square_equation_left_4",TermC.num_str @{thm sqrt_square_equation_left_4}),
  19.135 +       Rule.Thm("sqrt_square_equation_left_4",ThmC.numerals_to_Free @{thm sqrt_square_equation_left_4}),
  19.136  	      (* c*d/sqrt(x)=b -> c^2*d^2/x=b^2 *)
  19.137 -       Rule.Thm("sqrt_square_equation_left_5",TermC.num_str @{thm sqrt_square_equation_left_5}),
  19.138 +       Rule.Thm("sqrt_square_equation_left_5",ThmC.numerals_to_Free @{thm sqrt_square_equation_left_5}),
  19.139  	      (* c/d*sqrt(x)=b -> c^2/d^2x=b^2 *)
  19.140 -       Rule.Thm("sqrt_square_equation_left_6",TermC.num_str @{thm sqrt_square_equation_left_6}),
  19.141 +       Rule.Thm("sqrt_square_equation_left_6",ThmC.numerals_to_Free @{thm sqrt_square_equation_left_6}),
  19.142  	      (* c*d/g*sqrt(x)=b -> c^2*d^2/g^2x=b^2 *)
  19.143 -       Rule.Thm("sqrt_square_equation_right_1",TermC.num_str @{thm sqrt_square_equation_right_1}),
  19.144 +       Rule.Thm("sqrt_square_equation_right_1",ThmC.numerals_to_Free @{thm sqrt_square_equation_right_1}),
  19.145  	      (* a=sqrt(x) ->a^2=x *)
  19.146 -       Rule.Thm("sqrt_square_equation_right_2",TermC.num_str @{thm sqrt_square_equation_right_2}),
  19.147 +       Rule.Thm("sqrt_square_equation_right_2",ThmC.numerals_to_Free @{thm sqrt_square_equation_right_2}),
  19.148  	      (* a=c*sqrt(x) ->a^2=c^2*x *)
  19.149 -       Rule.Thm("sqrt_square_equation_right_3",TermC.num_str @{thm sqrt_square_equation_right_3}),
  19.150 +       Rule.Thm("sqrt_square_equation_right_3",ThmC.numerals_to_Free @{thm sqrt_square_equation_right_3}),
  19.151  	      (* a=c/sqrt(x) ->a^2=c^2/x *)
  19.152 -       Rule.Thm("sqrt_square_equation_right_4",TermC.num_str @{thm sqrt_square_equation_right_4}),
  19.153 +       Rule.Thm("sqrt_square_equation_right_4",ThmC.numerals_to_Free @{thm sqrt_square_equation_right_4}),
  19.154  	      (* a=c*d/sqrt(x) ->a^2=c^2*d^2/x *)
  19.155 -       Rule.Thm("sqrt_square_equation_right_5",TermC.num_str @{thm sqrt_square_equation_right_5}),
  19.156 +       Rule.Thm("sqrt_square_equation_right_5",ThmC.numerals_to_Free @{thm sqrt_square_equation_right_5}),
  19.157  	      (* a=c/e*sqrt(x) ->a^2=c^2/e^2x *)
  19.158 -       Rule.Thm("sqrt_square_equation_right_6",TermC.num_str @{thm sqrt_square_equation_right_6})
  19.159 +       Rule.Thm("sqrt_square_equation_right_6",ThmC.numerals_to_Free @{thm sqrt_square_equation_right_6})
  19.160  	      (* a=c*d/g*sqrt(x) ->a^2=c^2*d^2/g^2*x *)
  19.161         ],scr = Rule.EmptyScr
  19.162        });
  19.163 @@ -317,39 +317,39 @@
  19.164  	  rew_ord = ("termlessI",termlessI), 
  19.165            erls = RootEq_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  19.166       rules = [
  19.167 -     Rule.Thm("sqrt_square_1",TermC.num_str @{thm sqrt_square_1}),
  19.168 +     Rule.Thm("sqrt_square_1",ThmC.numerals_to_Free @{thm sqrt_square_1}),
  19.169                              (* (sqrt a)^^^2 -> a *)
  19.170 -     Rule.Thm("sqrt_square_2",TermC.num_str @{thm sqrt_square_2}),
  19.171 +     Rule.Thm("sqrt_square_2",ThmC.numerals_to_Free @{thm sqrt_square_2}),
  19.172                              (* sqrt (a^^^2) -> a *)
  19.173 -     Rule.Thm("sqrt_times_root_1",TermC.num_str @{thm sqrt_times_root_1}),
  19.174 +     Rule.Thm("sqrt_times_root_1",ThmC.numerals_to_Free @{thm sqrt_times_root_1}),
  19.175              (* sqrt a sqrt b -> sqrt(ab) *)
  19.176 -     Rule.Thm("sqrt_times_root_2",TermC.num_str @{thm sqrt_times_root_2}),
  19.177 +     Rule.Thm("sqrt_times_root_2",ThmC.numerals_to_Free @{thm sqrt_times_root_2}),
  19.178          (* a sqrt b sqrt c -> a sqrt(bc) *)
  19.179 -     Rule.Thm("sqrt_isolate_l_add1",TermC.num_str @{thm sqrt_isolate_l_add1}),
  19.180 +     Rule.Thm("sqrt_isolate_l_add1",ThmC.numerals_to_Free @{thm sqrt_isolate_l_add1}),
  19.181          (* a+b*sqrt(x)=d -> b*sqrt(x) = d-a *)
  19.182 -     Rule.Thm("sqrt_isolate_l_add2",TermC.num_str @{thm sqrt_isolate_l_add2}),
  19.183 +     Rule.Thm("sqrt_isolate_l_add2",ThmC.numerals_to_Free @{thm sqrt_isolate_l_add2}),
  19.184          (* a+  sqrt(x)=d ->   sqrt(x) = d-a *)
  19.185 -     Rule.Thm("sqrt_isolate_l_add3",TermC.num_str @{thm sqrt_isolate_l_add3}),
  19.186 +     Rule.Thm("sqrt_isolate_l_add3",ThmC.numerals_to_Free @{thm sqrt_isolate_l_add3}),
  19.187          (* a+b*c/sqrt(x)=d->b*c/sqrt(x)=d-a *)
  19.188 -     Rule.Thm("sqrt_isolate_l_add4",TermC.num_str @{thm sqrt_isolate_l_add4}),
  19.189 +     Rule.Thm("sqrt_isolate_l_add4",ThmC.numerals_to_Free @{thm sqrt_isolate_l_add4}),
  19.190          (* a+c/sqrt(x)=d -> c/sqrt(x) = d-a *)
  19.191 -     Rule.Thm("sqrt_isolate_l_add5",TermC.num_str @{thm sqrt_isolate_l_add5}),
  19.192 +     Rule.Thm("sqrt_isolate_l_add5",ThmC.numerals_to_Free @{thm sqrt_isolate_l_add5}),
  19.193          (* a+b*c/f*sqrt(x)=d->b*c/f*sqrt(x)=d-a *)
  19.194 -     Rule.Thm("sqrt_isolate_l_add6",TermC.num_str @{thm sqrt_isolate_l_add6}),
  19.195 +     Rule.Thm("sqrt_isolate_l_add6",ThmC.numerals_to_Free @{thm sqrt_isolate_l_add6}),
  19.196          (* a+c/f*sqrt(x)=d -> c/f*sqrt(x) = d-a *)
  19.197 -   (*Rule.Thm("sqrt_isolate_l_div",TermC.num_str @{thm sqrt_isolate_l_div}),*)
  19.198 +   (*Rule.Thm("sqrt_isolate_l_div",ThmC.numerals_to_Free @{thm sqrt_isolate_l_div}),*)
  19.199          (* b*sqrt(x) = d sqrt(x) d/b *)
  19.200 -     Rule.Thm("sqrt_square_equation_left_1",TermC.num_str @{thm sqrt_square_equation_left_1}),
  19.201 +     Rule.Thm("sqrt_square_equation_left_1",ThmC.numerals_to_Free @{thm sqrt_square_equation_left_1}),
  19.202  	      (* sqrt(x)=b -> x=b^2 *)
  19.203 -     Rule.Thm("sqrt_square_equation_left_2",TermC.num_str @{thm sqrt_square_equation_left_2}),
  19.204 +     Rule.Thm("sqrt_square_equation_left_2",ThmC.numerals_to_Free @{thm sqrt_square_equation_left_2}),
  19.205  	      (* a*sqrt(x)=b -> a^2*x=b^2*)
  19.206 -     Rule.Thm("sqrt_square_equation_left_3",TermC.num_str @{thm sqrt_square_equation_left_3}),   
  19.207 +     Rule.Thm("sqrt_square_equation_left_3",ThmC.numerals_to_Free @{thm sqrt_square_equation_left_3}),   
  19.208  	      (* c/sqrt(x)=b -> c^2/x=b^2 *)
  19.209 -     Rule.Thm("sqrt_square_equation_left_4",TermC.num_str @{thm sqrt_square_equation_left_4}),   
  19.210 +     Rule.Thm("sqrt_square_equation_left_4",ThmC.numerals_to_Free @{thm sqrt_square_equation_left_4}),   
  19.211  	      (* c*d/sqrt(x)=b -> c^2*d^2/x=b^2 *)
  19.212 -     Rule.Thm("sqrt_square_equation_left_5",TermC.num_str @{thm sqrt_square_equation_left_5}),   
  19.213 +     Rule.Thm("sqrt_square_equation_left_5",ThmC.numerals_to_Free @{thm sqrt_square_equation_left_5}),   
  19.214  	      (* c/d*sqrt(x)=b -> c^2/d^2x=b^2 *)
  19.215 -     Rule.Thm("sqrt_square_equation_left_6",TermC.num_str @{thm sqrt_square_equation_left_6})  
  19.216 +     Rule.Thm("sqrt_square_equation_left_6",ThmC.numerals_to_Free @{thm sqrt_square_equation_left_6})  
  19.217  	      (* c*d/g*sqrt(x)=b -> c^2*d^2/g^2x=b^2 *)
  19.218      ],
  19.219      scr = Rule.EmptyScr
  19.220 @@ -363,39 +363,39 @@
  19.221  	  rew_ord = ("termlessI",termlessI), 
  19.222            erls = RootEq_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  19.223       rules = [
  19.224 -     Rule.Thm("sqrt_square_1",TermC.num_str @{thm sqrt_square_1}),
  19.225 +     Rule.Thm("sqrt_square_1",ThmC.numerals_to_Free @{thm sqrt_square_1}),
  19.226                             (* (sqrt a)^^^2 -> a *)
  19.227 -     Rule.Thm("sqrt_square_2",TermC.num_str @{thm sqrt_square_2}), 
  19.228 +     Rule.Thm("sqrt_square_2",ThmC.numerals_to_Free @{thm sqrt_square_2}), 
  19.229                             (* sqrt (a^^^2) -> a *)
  19.230 -     Rule.Thm("sqrt_times_root_1",TermC.num_str @{thm sqrt_times_root_1}),
  19.231 +     Rule.Thm("sqrt_times_root_1",ThmC.numerals_to_Free @{thm sqrt_times_root_1}),
  19.232             (* sqrt a sqrt b -> sqrt(ab) *)
  19.233 -     Rule.Thm("sqrt_times_root_2",TermC.num_str @{thm sqrt_times_root_2}),
  19.234 +     Rule.Thm("sqrt_times_root_2",ThmC.numerals_to_Free @{thm sqrt_times_root_2}),
  19.235         (* a sqrt b sqrt c -> a sqrt(bc) *)
  19.236 -     Rule.Thm("sqrt_isolate_r_add1",TermC.num_str @{thm sqrt_isolate_r_add1}),
  19.237 +     Rule.Thm("sqrt_isolate_r_add1",ThmC.numerals_to_Free @{thm sqrt_isolate_r_add1}),
  19.238         (* a= d+e*sqrt(x) -> a-d=e*sqrt(x) *)
  19.239 -     Rule.Thm("sqrt_isolate_r_add2",TermC.num_str @{thm sqrt_isolate_r_add2}),
  19.240 +     Rule.Thm("sqrt_isolate_r_add2",ThmC.numerals_to_Free @{thm sqrt_isolate_r_add2}),
  19.241         (* a= d+  sqrt(x) -> a-d=  sqrt(x) *)
  19.242 -     Rule.Thm("sqrt_isolate_r_add3",TermC.num_str @{thm sqrt_isolate_r_add3}),
  19.243 +     Rule.Thm("sqrt_isolate_r_add3",ThmC.numerals_to_Free @{thm sqrt_isolate_r_add3}),
  19.244         (* a=d+e*g/sqrt(x)->a-d=e*g/sqrt(x)*)
  19.245 -     Rule.Thm("sqrt_isolate_r_add4",TermC.num_str @{thm sqrt_isolate_r_add4}),
  19.246 +     Rule.Thm("sqrt_isolate_r_add4",ThmC.numerals_to_Free @{thm sqrt_isolate_r_add4}),
  19.247         (* a= d+g/sqrt(x) -> a-d=g/sqrt(x) *)
  19.248 -     Rule.Thm("sqrt_isolate_r_add5",TermC.num_str @{thm sqrt_isolate_r_add5}),
  19.249 +     Rule.Thm("sqrt_isolate_r_add5",ThmC.numerals_to_Free @{thm sqrt_isolate_r_add5}),
  19.250         (* a=d+e*g/h*sqrt(x)->a-d=e*g/h*sqrt(x)*)
  19.251 -     Rule.Thm("sqrt_isolate_r_add6",TermC.num_str @{thm sqrt_isolate_r_add6}),
  19.252 +     Rule.Thm("sqrt_isolate_r_add6",ThmC.numerals_to_Free @{thm sqrt_isolate_r_add6}),
  19.253         (* a= d+g/h*sqrt(x) -> a-d=g/h*sqrt(x) *)
  19.254 -   (*Rule.Thm("sqrt_isolate_r_div",TermC.num_str @{thm sqrt_isolate_r_div}),*)
  19.255 +   (*Rule.Thm("sqrt_isolate_r_div",ThmC.numerals_to_Free @{thm sqrt_isolate_r_div}),*)
  19.256         (* a=e*sqrt(x) -> a/e = sqrt(x) *)
  19.257 -     Rule.Thm("sqrt_square_equation_right_1",TermC.num_str @{thm sqrt_square_equation_right_1}),
  19.258 +     Rule.Thm("sqrt_square_equation_right_1",ThmC.numerals_to_Free @{thm sqrt_square_equation_right_1}),
  19.259  	      (* a=sqrt(x) ->a^2=x *)
  19.260 -     Rule.Thm("sqrt_square_equation_right_2",TermC.num_str @{thm sqrt_square_equation_right_2}),
  19.261 +     Rule.Thm("sqrt_square_equation_right_2",ThmC.numerals_to_Free @{thm sqrt_square_equation_right_2}),
  19.262  	      (* a=c*sqrt(x) ->a^2=c^2*x *)
  19.263 -     Rule.Thm("sqrt_square_equation_right_3",TermC.num_str @{thm sqrt_square_equation_right_3}),
  19.264 +     Rule.Thm("sqrt_square_equation_right_3",ThmC.numerals_to_Free @{thm sqrt_square_equation_right_3}),
  19.265  	      (* a=c/sqrt(x) ->a^2=c^2/x *)
  19.266 -     Rule.Thm("sqrt_square_equation_right_4",TermC.num_str @{thm sqrt_square_equation_right_4}), 
  19.267 +     Rule.Thm("sqrt_square_equation_right_4",ThmC.numerals_to_Free @{thm sqrt_square_equation_right_4}), 
  19.268  	      (* a=c*d/sqrt(x) ->a^2=c^2*d^2/x *)
  19.269 -     Rule.Thm("sqrt_square_equation_right_5",TermC.num_str @{thm sqrt_square_equation_right_5}),
  19.270 +     Rule.Thm("sqrt_square_equation_right_5",ThmC.numerals_to_Free @{thm sqrt_square_equation_right_5}),
  19.271  	      (* a=c/e*sqrt(x) ->a^2=c^2/e^2x *)
  19.272 -     Rule.Thm("sqrt_square_equation_right_6",TermC.num_str @{thm sqrt_square_equation_right_6})
  19.273 +     Rule.Thm("sqrt_square_equation_right_6",ThmC.numerals_to_Free @{thm sqrt_square_equation_right_6})
  19.274  	      (* a=c*d/g*sqrt(x) ->a^2=c^2*d^2/g^2*x *)
  19.275      ],
  19.276      scr = Rule.EmptyScr
  19.277 @@ -407,9 +407,9 @@
  19.278         preconds = [], rew_ord = ("termlessI",termlessI), 
  19.279         erls = RootEq_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  19.280         (*asm_thm = [("sqrt_square_1","")],*)
  19.281 -       rules = [Rule.Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1}),
  19.282 +       rules = [Rule.Thm  ("real_assoc_1",ThmC.numerals_to_Free @{thm real_assoc_1}),
  19.283                               (* a+(b+c) = a+b+c *)
  19.284 -                Rule.Thm  ("real_assoc_2",TermC.num_str @{thm real_assoc_2}),
  19.285 +                Rule.Thm  ("real_assoc_2",ThmC.numerals_to_Free @{thm real_assoc_2}),
  19.286                               (* a*(b*c) = a*b*c *)
  19.287                  Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"),
  19.288                  Rule.Num_Calc ("Groups.minus_class.minus", (**)eval_binop "#sub_"),
  19.289 @@ -417,17 +417,17 @@
  19.290                  Rule.Num_Calc ("Rings.divide_class.divide", Prog_Expr.eval_cancel "#divide_e"),
  19.291                  Rule.Num_Calc ("NthRoot.sqrt", eval_sqrt "#sqrt_"),
  19.292                  Rule.Num_Calc ("Prog_Expr.pow" , (**)eval_binop "#power_"),
  19.293 -                Rule.Thm("real_plus_binom_pow2",TermC.num_str @{thm real_plus_binom_pow2}),
  19.294 -                Rule.Thm("real_minus_binom_pow2",TermC.num_str @{thm real_minus_binom_pow2}),
  19.295 -                Rule.Thm("realpow_mul",TermC.num_str @{thm realpow_mul}),    
  19.296 +                Rule.Thm("real_plus_binom_pow2",ThmC.numerals_to_Free @{thm real_plus_binom_pow2}),
  19.297 +                Rule.Thm("real_minus_binom_pow2",ThmC.numerals_to_Free @{thm real_minus_binom_pow2}),
  19.298 +                Rule.Thm("realpow_mul",ThmC.numerals_to_Free @{thm realpow_mul}),    
  19.299                       (* (a * b)^n = a^n * b^n*)
  19.300 -                Rule.Thm("sqrt_times_root_1",TermC.num_str @{thm sqrt_times_root_1}), 
  19.301 +                Rule.Thm("sqrt_times_root_1",ThmC.numerals_to_Free @{thm sqrt_times_root_1}), 
  19.302                       (* sqrt b * sqrt c = sqrt(b*c) *)
  19.303 -                Rule.Thm("sqrt_times_root_2",TermC.num_str @{thm sqrt_times_root_2}),
  19.304 +                Rule.Thm("sqrt_times_root_2",ThmC.numerals_to_Free @{thm sqrt_times_root_2}),
  19.305                       (* a * sqrt a * sqrt b = a * sqrt(a*b) *)
  19.306 -                Rule.Thm("sqrt_square_2",TermC.num_str @{thm sqrt_square_2}),
  19.307 +                Rule.Thm("sqrt_square_2",ThmC.numerals_to_Free @{thm sqrt_square_2}),
  19.308                              (* sqrt (a^^^2) = a *)
  19.309 -                Rule.Thm("sqrt_square_1",TermC.num_str @{thm sqrt_square_1}) 
  19.310 +                Rule.Thm("sqrt_square_1",ThmC.numerals_to_Free @{thm sqrt_square_1}) 
  19.311                              (* sqrt a ^^^ 2 = a *)
  19.312                  ],
  19.313         scr = Rule.EmptyScr
    20.1 --- a/src/Tools/isac/Knowledge/RootRat.thy	Mon Apr 13 13:27:55 2020 +0200
    20.2 +++ b/src/Tools/isac/Knowledge/RootRat.thy	Mon Apr 13 15:31:23 2020 +0200
    20.3 @@ -16,11 +16,11 @@
    20.4  (*.calculate numeral groundterms.*)
    20.5  val calculate_RootRat = 
    20.6    Rule_Set.append_rules "calculate_RootRat" calculate_Rational
    20.7 -	    [Rule.Thm ("distrib_left",TermC.num_str @{thm distrib_left}),
    20.8 +	    [Rule.Thm ("distrib_left",ThmC.numerals_to_Free @{thm distrib_left}),
    20.9  		      (* w*(z1.0 + z2.0) = w * z1.0 + w * z2.0 *)
   20.10 -		     Rule.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),
   20.11 +		     Rule.Thm ("mult_1_left",ThmC.numerals_to_Free @{thm mult_1_left}),
   20.12  		      (* 1 * z = z *)
   20.13 -		     Rule.Thm ("sym_real_mult_minus1",TermC.num_str (@{thm real_mult_minus1} RS @{thm sym})),
   20.14 +		     Rule.Thm ("sym_real_mult_minus1",ThmC.numerals_to_Free (@{thm real_mult_minus1} RS @{thm sym})),
   20.15  		       (* "- z1 = -1 * z1"  *)
   20.16  		     Rule.Num_Calc ("NthRoot.sqrt", eval_sqrt "#sqrt_")
   20.17  		     ];
    21.1 --- a/src/Tools/isac/Knowledge/RootRatEq.thy	Mon Apr 13 13:27:55 2020 +0200
    21.2 +++ b/src/Tools/isac/Knowledge/RootRatEq.thy	Mon Apr 13 15:31:23 2020 +0200
    21.3 @@ -78,12 +78,12 @@
    21.4       Rule.Num_Calc ("RootEq.is'_rootTerm'_in", eval_is_rootTerm_in ""),
    21.5       Rule.Num_Calc ("RootRatEq.is'_rootRatAddTerm'_in", eval_is_rootRatAddTerm_in ""),
    21.6       Rule.Num_Calc ("HOL.eq", Prog_Expr.eval_equal "#equal_"),
    21.7 -     Rule.Thm ("not_true",TermC.num_str @{thm not_true}),
    21.8 -     Rule.Thm ("not_false",TermC.num_str @{thm not_false}),
    21.9 -     Rule.Thm ("and_true",TermC.num_str @{thm and_true}),
   21.10 -     Rule.Thm ("and_false",TermC.num_str @{thm and_false}),
   21.11 -     Rule.Thm ("or_true",TermC.num_str @{thm or_true}),
   21.12 -     Rule.Thm ("or_false",TermC.num_str @{thm or_false})];
   21.13 +     Rule.Thm ("not_true",ThmC.numerals_to_Free @{thm not_true}),
   21.14 +     Rule.Thm ("not_false",ThmC.numerals_to_Free @{thm not_false}),
   21.15 +     Rule.Thm ("and_true",ThmC.numerals_to_Free @{thm and_true}),
   21.16 +     Rule.Thm ("and_false",ThmC.numerals_to_Free @{thm and_false}),
   21.17 +     Rule.Thm ("or_true",ThmC.numerals_to_Free @{thm or_true}),
   21.18 +     Rule.Thm ("or_false",ThmC.numerals_to_Free @{thm or_false})];
   21.19  
   21.20  val RooRatEq_erls = 
   21.21    Rule_Set.merge "RooRatEq_erls" rootrat_erls
   21.22 @@ -105,15 +105,15 @@
   21.23    rew_ord = ("termlessI",termlessI), 
   21.24      erls = Rule_Set.empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
   21.25      rules = 
   21.26 -    [Rule.Thm("rootrat_equation_left_1", TermC.num_str @{thm rootrat_equation_left_1}),   
   21.27 +    [Rule.Thm("rootrat_equation_left_1", ThmC.numerals_to_Free @{thm rootrat_equation_left_1}),   
   21.28          (* [|c is_rootTerm_in bdv|] ==> 
   21.29                                     ( (a + b/c = d) = ( b = (d - a) * c )) *)
   21.30 -     Rule.Thm("rootrat_equation_left_2",TermC.num_str @{thm rootrat_equation_left_2}),
   21.31 +     Rule.Thm("rootrat_equation_left_2",ThmC.numerals_to_Free @{thm rootrat_equation_left_2}),
   21.32          (* [|c is_rootTerm_in bdv|] ==> ( (b/c = d) = ( b = d * c )) *)
   21.33 -     Rule.Thm("rootrat_equation_right_1",TermC.num_str @{thm rootrat_equation_right_1}),
   21.34 +     Rule.Thm("rootrat_equation_right_1",ThmC.numerals_to_Free @{thm rootrat_equation_right_1}),
   21.35  	(* [|f is_rootTerm_in bdv|] ==> 
   21.36                                     ( (a = d + e/f) = ( (a - d) * f = e )) *)
   21.37 -     Rule.Thm("rootrat_equation_right_2",TermC.num_str @{thm rootrat_equation_right_2})
   21.38 +     Rule.Thm("rootrat_equation_right_2",ThmC.numerals_to_Free @{thm rootrat_equation_right_2})
   21.39  	(* [|f is_rootTerm_in bdv|] ==> ( (a =  e/f) = ( a  * f = e ))*)
   21.40       ], scr = Rule.EmptyScr});
   21.41  \<close>
    22.1 --- a/src/Tools/isac/Knowledge/Test.thy	Mon Apr 13 13:27:55 2020 +0200
    22.2 +++ b/src/Tools/isac/Knowledge/Test.thy	Mon Apr 13 15:31:23 2020 +0200
    22.3 @@ -362,17 +362,17 @@
    22.4    Rule_Def.Repeat {id = "testerls", preconds = [], rew_ord = ("termlessI",termlessI), 
    22.5        erls = Rule_Set.empty, srls = Rule_Set.Empty, 
    22.6        calc = [], errpatts = [], 
    22.7 -      rules = [Rule.Thm ("refl",TermC.num_str @{thm refl}),
    22.8 -	       Rule.Thm ("order_refl",TermC.num_str @{thm order_refl}),
    22.9 -	       Rule.Thm ("radd_left_cancel_le",TermC.num_str @{thm radd_left_cancel_le}),
   22.10 -	       Rule.Thm ("not_true",TermC.num_str @{thm not_true}),
   22.11 -	       Rule.Thm ("not_false",TermC.num_str @{thm not_false}),
   22.12 -	       Rule.Thm ("and_true",TermC.num_str @{thm and_true}),
   22.13 -	       Rule.Thm ("and_false",TermC.num_str @{thm and_false}),
   22.14 -	       Rule.Thm ("or_true",TermC.num_str @{thm or_true}),
   22.15 -	       Rule.Thm ("or_false",TermC.num_str @{thm or_false}),
   22.16 -	       Rule.Thm ("and_commute",TermC.num_str @{thm and_commute}),
   22.17 -	       Rule.Thm ("or_commute",TermC.num_str @{thm or_commute}),
   22.18 +      rules = [Rule.Thm ("refl",ThmC.numerals_to_Free @{thm refl}),
   22.19 +	       Rule.Thm ("order_refl",ThmC.numerals_to_Free @{thm order_refl}),
   22.20 +	       Rule.Thm ("radd_left_cancel_le",ThmC.numerals_to_Free @{thm radd_left_cancel_le}),
   22.21 +	       Rule.Thm ("not_true",ThmC.numerals_to_Free @{thm not_true}),
   22.22 +	       Rule.Thm ("not_false",ThmC.numerals_to_Free @{thm not_false}),
   22.23 +	       Rule.Thm ("and_true",ThmC.numerals_to_Free @{thm and_true}),
   22.24 +	       Rule.Thm ("and_false",ThmC.numerals_to_Free @{thm and_false}),
   22.25 +	       Rule.Thm ("or_true",ThmC.numerals_to_Free @{thm or_true}),
   22.26 +	       Rule.Thm ("or_false",ThmC.numerals_to_Free @{thm or_false}),
   22.27 +	       Rule.Thm ("and_commute",ThmC.numerals_to_Free @{thm and_commute}),
   22.28 +	       Rule.Thm ("or_commute",ThmC.numerals_to_Free @{thm or_commute}),
   22.29  
   22.30  	       Rule.Num_Calc ("Prog_Expr.is'_const", Prog_Expr.eval_const "#is_const_"),
   22.31  	       Rule.Num_Calc ("Prog_Expr.matches", Prog_Expr.eval_matches ""),
   22.32 @@ -396,24 +396,24 @@
   22.33        rew_ord = ("sqrt_right",sqrt_right false @{theory "Pure"}), 
   22.34        erls=testerls,srls = Rule_Set.empty, 
   22.35        calc=[], errpatts = [],
   22.36 -      rules = [Rule.Thm ("refl",TermC.num_str @{thm refl}),
   22.37 -	       Rule.Thm ("order_refl",TermC.num_str @{thm order_refl}),
   22.38 -	       Rule.Thm ("radd_left_cancel_le",TermC.num_str @{thm radd_left_cancel_le}),
   22.39 -	       Rule.Thm ("not_true",TermC.num_str @{thm not_true}),
   22.40 -	       Rule.Thm ("not_false",TermC.num_str @{thm not_false}),
   22.41 -	       Rule.Thm ("and_true",TermC.num_str @{thm and_true}),
   22.42 -	       Rule.Thm ("and_false",TermC.num_str @{thm and_false}),
   22.43 -	       Rule.Thm ("or_true",TermC.num_str @{thm or_true}),
   22.44 -	       Rule.Thm ("or_false",TermC.num_str @{thm or_false}),
   22.45 -	       Rule.Thm ("and_commute",TermC.num_str @{thm and_commute}),
   22.46 -	       Rule.Thm ("or_commute",TermC.num_str @{thm or_commute}),
   22.47 +      rules = [Rule.Thm ("refl",ThmC.numerals_to_Free @{thm refl}),
   22.48 +	       Rule.Thm ("order_refl",ThmC.numerals_to_Free @{thm order_refl}),
   22.49 +	       Rule.Thm ("radd_left_cancel_le",ThmC.numerals_to_Free @{thm radd_left_cancel_le}),
   22.50 +	       Rule.Thm ("not_true",ThmC.numerals_to_Free @{thm not_true}),
   22.51 +	       Rule.Thm ("not_false",ThmC.numerals_to_Free @{thm not_false}),
   22.52 +	       Rule.Thm ("and_true",ThmC.numerals_to_Free @{thm and_true}),
   22.53 +	       Rule.Thm ("and_false",ThmC.numerals_to_Free @{thm and_false}),
   22.54 +	       Rule.Thm ("or_true",ThmC.numerals_to_Free @{thm or_true}),
   22.55 +	       Rule.Thm ("or_false",ThmC.numerals_to_Free @{thm or_false}),
   22.56 +	       Rule.Thm ("and_commute",ThmC.numerals_to_Free @{thm and_commute}),
   22.57 +	       Rule.Thm ("or_commute",ThmC.numerals_to_Free @{thm or_commute}),
   22.58  
   22.59 -	       Rule.Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}),
   22.60 +	       Rule.Thm ("real_diff_minus",ThmC.numerals_to_Free @{thm real_diff_minus}),
   22.61  
   22.62 -	       Rule.Thm ("root_ge0",TermC.num_str @{thm root_ge0}),
   22.63 -	       Rule.Thm ("root_add_ge0",TermC.num_str @{thm root_add_ge0}),
   22.64 -	       Rule.Thm ("root_ge0_1",TermC.num_str @{thm root_ge0_1}),
   22.65 -	       Rule.Thm ("root_ge0_2",TermC.num_str @{thm root_ge0_2}),
   22.66 +	       Rule.Thm ("root_ge0",ThmC.numerals_to_Free @{thm root_ge0}),
   22.67 +	       Rule.Thm ("root_add_ge0",ThmC.numerals_to_Free @{thm root_add_ge0}),
   22.68 +	       Rule.Thm ("root_ge0_1",ThmC.numerals_to_Free @{thm root_ge0_1}),
   22.69 +	       Rule.Thm ("root_ge0_2",ThmC.numerals_to_Free @{thm root_ge0_2}),
   22.70  
   22.71  	       Rule.Num_Calc ("Prog_Expr.is'_const", Prog_Expr.eval_const "#is_const_"),
   22.72  	       Rule.Num_Calc ("Test.contains'_root", eval_contains_root "#eval_contains_root"),
   22.73 @@ -442,8 +442,8 @@
   22.74        rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord), 
   22.75        erls = Rule_Set.empty, srls = Rule_Set.empty, calc = [], errpatts = [],
   22.76        rules = 
   22.77 -      [Rule.Thm ("sym_add_assoc",TermC.num_str (@{thm add.assoc} RS @{thm sym})),
   22.78 -       Rule.Thm ("sym_rmult_assoc",TermC.num_str (@{thm rmult_assoc} RS @{thm sym}))],
   22.79 +      [Rule.Thm ("sym_add_assoc",ThmC.numerals_to_Free (@{thm add.assoc} RS @{thm sym})),
   22.80 +       Rule.Thm ("sym_rmult_assoc",ThmC.numerals_to_Free (@{thm rmult_assoc} RS @{thm sym}))],
   22.81        scr = Rule.EmptyScr
   22.82        };      
   22.83  
   22.84 @@ -451,20 +451,20 @@
   22.85    Rule_Def.Repeat{id = "ac_plus_times", preconds = [], rew_ord = ("term_order",term_order),
   22.86        erls = Rule_Set.empty, srls = Rule_Set.empty, calc = [], errpatts = [],
   22.87        rules = 
   22.88 -      [Rule.Thm ("radd_commute",TermC.num_str @{thm radd_commute}),
   22.89 -       Rule.Thm ("radd_left_commute",TermC.num_str @{thm radd_left_commute}),
   22.90 -       Rule.Thm ("add_assoc",TermC.num_str @{thm add.assoc}),
   22.91 -       Rule.Thm ("rmult_commute",TermC.num_str @{thm rmult_commute}),
   22.92 -       Rule.Thm ("rmult_left_commute",TermC.num_str @{thm rmult_left_commute}),
   22.93 -       Rule.Thm ("rmult_assoc",TermC.num_str @{thm rmult_assoc})],
   22.94 +      [Rule.Thm ("radd_commute",ThmC.numerals_to_Free @{thm radd_commute}),
   22.95 +       Rule.Thm ("radd_left_commute",ThmC.numerals_to_Free @{thm radd_left_commute}),
   22.96 +       Rule.Thm ("add_assoc",ThmC.numerals_to_Free @{thm add.assoc}),
   22.97 +       Rule.Thm ("rmult_commute",ThmC.numerals_to_Free @{thm rmult_commute}),
   22.98 +       Rule.Thm ("rmult_left_commute",ThmC.numerals_to_Free @{thm rmult_left_commute}),
   22.99 +       Rule.Thm ("rmult_assoc",ThmC.numerals_to_Free @{thm rmult_assoc})],
  22.100        scr = Rule.EmptyScr
  22.101        };      
  22.102  
  22.103 -(*todo: replace by Rewrite("rnorm_equation_add",TermC.num_str @{thm rnorm_equation_add)*)
  22.104 +(*todo: replace by Rewrite("rnorm_equation_add",ThmC.numerals_to_Free @{thm rnorm_equation_add)*)
  22.105  val norm_equation =
  22.106    Rule_Def.Repeat{id = "norm_equation", preconds = [], rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord),
  22.107        erls = tval_rls, srls = Rule_Set.empty, calc = [], errpatts = [],
  22.108 -      rules = [Rule.Thm ("rnorm_equation_add",TermC.num_str @{thm rnorm_equation_add})
  22.109 +      rules = [Rule.Thm ("rnorm_equation_add",ThmC.numerals_to_Free @{thm rnorm_equation_add})
  22.110  	       ],
  22.111        scr = Rule.EmptyScr
  22.112        };      
  22.113 @@ -477,22 +477,22 @@
  22.114        erls = tval_rls, srls = Rule_Set.empty, 
  22.115        calc=[(*since 040209 filled by prep_rls'*)], errpatts = [],
  22.116        rules = [
  22.117 -	       Rule.Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}),
  22.118 -	       Rule.Thm ("radd_mult_distrib2",TermC.num_str @{thm radd_mult_distrib2}),
  22.119 -	       Rule.Thm ("rdistr_right_assoc",TermC.num_str @{thm rdistr_right_assoc}),
  22.120 -	       Rule.Thm ("rdistr_right_assoc_p",TermC.num_str @{thm rdistr_right_assoc_p}),
  22.121 -	       Rule.Thm ("rdistr_div_right",TermC.num_str @{thm rdistr_div_right}),
  22.122 -	       Rule.Thm ("rbinom_power_2",TermC.num_str @{thm rbinom_power_2}),	       
  22.123 +	       Rule.Thm ("real_diff_minus",ThmC.numerals_to_Free @{thm real_diff_minus}),
  22.124 +	       Rule.Thm ("radd_mult_distrib2",ThmC.numerals_to_Free @{thm radd_mult_distrib2}),
  22.125 +	       Rule.Thm ("rdistr_right_assoc",ThmC.numerals_to_Free @{thm rdistr_right_assoc}),
  22.126 +	       Rule.Thm ("rdistr_right_assoc_p",ThmC.numerals_to_Free @{thm rdistr_right_assoc_p}),
  22.127 +	       Rule.Thm ("rdistr_div_right",ThmC.numerals_to_Free @{thm rdistr_div_right}),
  22.128 +	       Rule.Thm ("rbinom_power_2",ThmC.numerals_to_Free @{thm rbinom_power_2}),	       
  22.129  
  22.130 -               Rule.Thm ("radd_commute",TermC.num_str @{thm radd_commute}), 
  22.131 -	       Rule.Thm ("radd_left_commute",TermC.num_str @{thm radd_left_commute}),
  22.132 -	       Rule.Thm ("add_assoc",TermC.num_str @{thm add.assoc}),
  22.133 -	       Rule.Thm ("rmult_commute",TermC.num_str @{thm rmult_commute}),
  22.134 -	       Rule.Thm ("rmult_left_commute",TermC.num_str @{thm rmult_left_commute}),
  22.135 -	       Rule.Thm ("rmult_assoc",TermC.num_str @{thm rmult_assoc}),
  22.136 +               Rule.Thm ("radd_commute",ThmC.numerals_to_Free @{thm radd_commute}), 
  22.137 +	       Rule.Thm ("radd_left_commute",ThmC.numerals_to_Free @{thm radd_left_commute}),
  22.138 +	       Rule.Thm ("add_assoc",ThmC.numerals_to_Free @{thm add.assoc}),
  22.139 +	       Rule.Thm ("rmult_commute",ThmC.numerals_to_Free @{thm rmult_commute}),
  22.140 +	       Rule.Thm ("rmult_left_commute",ThmC.numerals_to_Free @{thm rmult_left_commute}),
  22.141 +	       Rule.Thm ("rmult_assoc",ThmC.numerals_to_Free @{thm rmult_assoc}),
  22.142  
  22.143 -	       Rule.Thm ("radd_real_const_eq",TermC.num_str @{thm radd_real_const_eq}),
  22.144 -	       Rule.Thm ("radd_real_const",TermC.num_str @{thm radd_real_const}),
  22.145 +	       Rule.Thm ("radd_real_const_eq",ThmC.numerals_to_Free @{thm radd_real_const_eq}),
  22.146 +	       Rule.Thm ("radd_real_const",ThmC.numerals_to_Free @{thm radd_real_const}),
  22.147  	       (* these 2 rules are invers to distr_div_right wrt. termination.
  22.148  		  thus they MUST be done IMMEDIATELY before calc *)
  22.149  	       Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"), 
  22.150 @@ -500,27 +500,27 @@
  22.151  	       Rule.Num_Calc ("Rings.divide_class.divide", Prog_Expr.eval_cancel "#divide_e"),
  22.152  	       Rule.Num_Calc ("Prog_Expr.pow", (**)eval_binop "#power_"),
  22.153  
  22.154 -	       Rule.Thm ("rcollect_right",TermC.num_str @{thm rcollect_right}),
  22.155 -	       Rule.Thm ("rcollect_one_left",TermC.num_str @{thm rcollect_one_left}),
  22.156 -	       Rule.Thm ("rcollect_one_left_assoc",TermC.num_str @{thm rcollect_one_left_assoc}),
  22.157 -	       Rule.Thm ("rcollect_one_left_assoc_p",TermC.num_str @{thm rcollect_one_left_assoc_p}),
  22.158 +	       Rule.Thm ("rcollect_right",ThmC.numerals_to_Free @{thm rcollect_right}),
  22.159 +	       Rule.Thm ("rcollect_one_left",ThmC.numerals_to_Free @{thm rcollect_one_left}),
  22.160 +	       Rule.Thm ("rcollect_one_left_assoc",ThmC.numerals_to_Free @{thm rcollect_one_left_assoc}),
  22.161 +	       Rule.Thm ("rcollect_one_left_assoc_p",ThmC.numerals_to_Free @{thm rcollect_one_left_assoc_p}),
  22.162  
  22.163 -	       Rule.Thm ("rshift_nominator",TermC.num_str @{thm rshift_nominator}),
  22.164 -	       Rule.Thm ("rcancel_den",TermC.num_str @{thm rcancel_den}),
  22.165 -	       Rule.Thm ("rroot_square_inv",TermC.num_str @{thm rroot_square_inv}),
  22.166 -	       Rule.Thm ("rroot_times_root",TermC.num_str @{thm rroot_times_root}),
  22.167 -	       Rule.Thm ("rroot_times_root_assoc_p",TermC.num_str @{thm rroot_times_root_assoc_p}),
  22.168 -	       Rule.Thm ("rsqare",TermC.num_str @{thm rsqare}),
  22.169 -	       Rule.Thm ("power_1",TermC.num_str @{thm power_1}),
  22.170 -	       Rule.Thm ("rtwo_of_the_same",TermC.num_str @{thm rtwo_of_the_same}),
  22.171 -	       Rule.Thm ("rtwo_of_the_same_assoc_p",TermC.num_str @{thm rtwo_of_the_same_assoc_p}),
  22.172 +	       Rule.Thm ("rshift_nominator",ThmC.numerals_to_Free @{thm rshift_nominator}),
  22.173 +	       Rule.Thm ("rcancel_den",ThmC.numerals_to_Free @{thm rcancel_den}),
  22.174 +	       Rule.Thm ("rroot_square_inv",ThmC.numerals_to_Free @{thm rroot_square_inv}),
  22.175 +	       Rule.Thm ("rroot_times_root",ThmC.numerals_to_Free @{thm rroot_times_root}),
  22.176 +	       Rule.Thm ("rroot_times_root_assoc_p",ThmC.numerals_to_Free @{thm rroot_times_root_assoc_p}),
  22.177 +	       Rule.Thm ("rsqare",ThmC.numerals_to_Free @{thm rsqare}),
  22.178 +	       Rule.Thm ("power_1",ThmC.numerals_to_Free @{thm power_1}),
  22.179 +	       Rule.Thm ("rtwo_of_the_same",ThmC.numerals_to_Free @{thm rtwo_of_the_same}),
  22.180 +	       Rule.Thm ("rtwo_of_the_same_assoc_p",ThmC.numerals_to_Free @{thm rtwo_of_the_same_assoc_p}),
  22.181  
  22.182 -	       Rule.Thm ("rmult_1",TermC.num_str @{thm rmult_1}),
  22.183 -	       Rule.Thm ("rmult_1_right",TermC.num_str @{thm rmult_1_right}),
  22.184 -	       Rule.Thm ("rmult_0",TermC.num_str @{thm rmult_0}),
  22.185 -	       Rule.Thm ("rmult_0_right",TermC.num_str @{thm rmult_0_right}),
  22.186 -	       Rule.Thm ("radd_0",TermC.num_str @{thm radd_0}),
  22.187 -	       Rule.Thm ("radd_0_right",TermC.num_str @{thm radd_0_right})
  22.188 +	       Rule.Thm ("rmult_1",ThmC.numerals_to_Free @{thm rmult_1}),
  22.189 +	       Rule.Thm ("rmult_1_right",ThmC.numerals_to_Free @{thm rmult_1_right}),
  22.190 +	       Rule.Thm ("rmult_0",ThmC.numerals_to_Free @{thm rmult_0}),
  22.191 +	       Rule.Thm ("rmult_0_right",ThmC.numerals_to_Free @{thm rmult_0_right}),
  22.192 +	       Rule.Thm ("radd_0",ThmC.numerals_to_Free @{thm radd_0}),
  22.193 +	       Rule.Thm ("radd_0_right",ThmC.numerals_to_Free @{thm radd_0_right})
  22.194  	       ],
  22.195        scr = Rule.EmptyScr
  22.196  		    (*since 040209 filled by prep_rls': STest_simplify*)
  22.197 @@ -531,12 +531,12 @@
  22.198  val isolate_root =
  22.199    Rule_Def.Repeat{id = "isolate_root", preconds = [], rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord), 
  22.200        erls=tval_rls,srls = Rule_Set.empty, calc=[], errpatts = [],
  22.201 -      rules = [Rule.Thm ("rroot_to_lhs",TermC.num_str @{thm rroot_to_lhs}),
  22.202 -	       Rule.Thm ("rroot_to_lhs_mult",TermC.num_str @{thm rroot_to_lhs_mult}),
  22.203 -	       Rule.Thm ("rroot_to_lhs_add_mult",TermC.num_str @{thm rroot_to_lhs_add_mult}),
  22.204 -	       Rule.Thm ("risolate_root_add",TermC.num_str @{thm risolate_root_add}),
  22.205 -	       Rule.Thm ("risolate_root_mult",TermC.num_str @{thm risolate_root_mult}),
  22.206 -	       Rule.Thm ("risolate_root_div",TermC.num_str @{thm risolate_root_div})       ],
  22.207 +      rules = [Rule.Thm ("rroot_to_lhs",ThmC.numerals_to_Free @{thm rroot_to_lhs}),
  22.208 +	       Rule.Thm ("rroot_to_lhs_mult",ThmC.numerals_to_Free @{thm rroot_to_lhs_mult}),
  22.209 +	       Rule.Thm ("rroot_to_lhs_add_mult",ThmC.numerals_to_Free @{thm rroot_to_lhs_add_mult}),
  22.210 +	       Rule.Thm ("risolate_root_add",ThmC.numerals_to_Free @{thm risolate_root_add}),
  22.211 +	       Rule.Thm ("risolate_root_mult",ThmC.numerals_to_Free @{thm risolate_root_mult}),
  22.212 +	       Rule.Thm ("risolate_root_div",ThmC.numerals_to_Free @{thm risolate_root_div})       ],
  22.213        scr = Rule.Prog ((Thm.term_of o the o (TermC.parse thy)) 
  22.214        "empty_script")
  22.215        };
  22.216 @@ -546,12 +546,12 @@
  22.217      Rule_Def.Repeat{id = "isolate_bdv", preconds = [], rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord),
  22.218  	erls=tval_rls,srls = Rule_Set.empty, calc= [], errpatts = [],
  22.219  	rules = 
  22.220 -	[Rule.Thm ("risolate_bdv_add",TermC.num_str @{thm risolate_bdv_add}),
  22.221 -	 Rule.Thm ("risolate_bdv_mult_add",TermC.num_str @{thm risolate_bdv_mult_add}),
  22.222 -	 Rule.Thm ("risolate_bdv_mult",TermC.num_str @{thm risolate_bdv_mult}),
  22.223 -	 Rule.Thm ("mult_square",TermC.num_str @{thm mult_square}),
  22.224 -	 Rule.Thm ("constant_square",TermC.num_str @{thm constant_square}),
  22.225 -	 Rule.Thm ("constant_mult_square",TermC.num_str @{thm constant_mult_square})
  22.226 +	[Rule.Thm ("risolate_bdv_add",ThmC.numerals_to_Free @{thm risolate_bdv_add}),
  22.227 +	 Rule.Thm ("risolate_bdv_mult_add",ThmC.numerals_to_Free @{thm risolate_bdv_mult_add}),
  22.228 +	 Rule.Thm ("risolate_bdv_mult",ThmC.numerals_to_Free @{thm risolate_bdv_mult}),
  22.229 +	 Rule.Thm ("mult_square",ThmC.numerals_to_Free @{thm mult_square}),
  22.230 +	 Rule.Thm ("constant_square",ThmC.numerals_to_Free @{thm constant_square}),
  22.231 +	 Rule.Thm ("constant_mult_square",ThmC.numerals_to_Free @{thm constant_mult_square})
  22.232  	 ],
  22.233  	scr = Rule.Prog ((Thm.term_of o the o (TermC.parse thy)) 
  22.234  			  "empty_script")
  22.235 @@ -606,56 +606,56 @@
  22.236  	      ("TIMES" , ("Groups.times_class.times", (**)eval_binop "#mult_")),
  22.237  	      ("POWER", ("Prog_Expr.pow", (**)eval_binop "#power_"))
  22.238  	      ], errpatts = [],
  22.239 -      rules = [Rule.Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}),
  22.240 +      rules = [Rule.Thm ("real_diff_minus",ThmC.numerals_to_Free @{thm real_diff_minus}),
  22.241  	       (*"a - b = a + (-1) * b"*)
  22.242 -	       Rule.Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),
  22.243 +	       Rule.Thm ("distrib_right" ,ThmC.numerals_to_Free @{thm distrib_right}),
  22.244  	       (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  22.245 -	       Rule.Thm ("distrib_left",TermC.num_str @{thm distrib_left}),
  22.246 +	       Rule.Thm ("distrib_left",ThmC.numerals_to_Free @{thm distrib_left}),
  22.247  	       (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  22.248 -	       Rule.Thm ("left_diff_distrib" ,TermC.num_str @{thm left_diff_distrib}),
  22.249 +	       Rule.Thm ("left_diff_distrib" ,ThmC.numerals_to_Free @{thm left_diff_distrib}),
  22.250  	       (*"(z1.0 - z2.0) * w = z1.0 * w - z2.0 * w"*)
  22.251 -	       Rule.Thm ("right_diff_distrib",TermC.num_str @{thm right_diff_distrib}),
  22.252 +	       Rule.Thm ("right_diff_distrib",ThmC.numerals_to_Free @{thm right_diff_distrib}),
  22.253  	       (*"w * (z1.0 - z2.0) = w * z1.0 - w * z2.0"*)
  22.254 -	       Rule.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),                 
  22.255 +	       Rule.Thm ("mult_1_left",ThmC.numerals_to_Free @{thm mult_1_left}),                 
  22.256  	       (*"1 * z = z"*)
  22.257 -	       Rule.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),        
  22.258 +	       Rule.Thm ("mult_zero_left",ThmC.numerals_to_Free @{thm mult_zero_left}),        
  22.259  	       (*"0 * z = 0"*)
  22.260 -	       Rule.Thm ("add_0_left",TermC.num_str @{thm add_0_left}),
  22.261 +	       Rule.Thm ("add_0_left",ThmC.numerals_to_Free @{thm add_0_left}),
  22.262  	       (*"0 + z = z"*)
  22.263  
  22.264  	       (*AC-rewriting*)
  22.265 -	       Rule.Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
  22.266 +	       Rule.Thm ("mult_commute",ThmC.numerals_to_Free @{thm mult.commute}),
  22.267  	       (* z * w = w * z *)
  22.268 -	       Rule.Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
  22.269 +	       Rule.Thm ("real_mult_left_commute",ThmC.numerals_to_Free @{thm real_mult_left_commute}),
  22.270  	       (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*)
  22.271 -	       Rule.Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),		
  22.272 +	       Rule.Thm ("mult_assoc",ThmC.numerals_to_Free @{thm mult.assoc}),		
  22.273  	       (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*)
  22.274 -	       Rule.Thm ("add_commute",TermC.num_str @{thm add.commute}),	
  22.275 +	       Rule.Thm ("add_commute",ThmC.numerals_to_Free @{thm add.commute}),	
  22.276  	       (*z + w = w + z*)
  22.277 -	       Rule.Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}),
  22.278 +	       Rule.Thm ("add_left_commute",ThmC.numerals_to_Free @{thm add.left_commute}),
  22.279  	       (*x + (y + z) = y + (x + z)*)
  22.280 -	       Rule.Thm ("add_assoc",TermC.num_str @{thm add.assoc}),	               
  22.281 +	       Rule.Thm ("add_assoc",ThmC.numerals_to_Free @{thm add.assoc}),	               
  22.282  	       (*z1.0 + z2.0 + z3.0 = z1.0 + (z2.0 + z3.0)*)
  22.283  
  22.284  	       Rule.Thm ("sym_realpow_twoI",
  22.285 -                     TermC.num_str (@{thm realpow_twoI} RS @{thm sym})),	
  22.286 +                     ThmC.numerals_to_Free (@{thm realpow_twoI} RS @{thm sym})),	
  22.287  	       (*"r1 * r1 = r1 ^^^ 2"*)
  22.288 -	       Rule.Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),		
  22.289 +	       Rule.Thm ("realpow_plus_1",ThmC.numerals_to_Free @{thm realpow_plus_1}),		
  22.290  	       (*"r * r ^^^ n = r ^^^ (n + 1)"*)
  22.291  	       Rule.Thm ("sym_real_mult_2",
  22.292 -                     TermC.num_str (@{thm real_mult_2} RS @{thm sym})),	
  22.293 +                     ThmC.numerals_to_Free (@{thm real_mult_2} RS @{thm sym})),	
  22.294  	       (*"z1 + z1 = 2 * z1"*)
  22.295 -	       Rule.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),	
  22.296 +	       Rule.Thm ("real_mult_2_assoc",ThmC.numerals_to_Free @{thm real_mult_2_assoc}),	
  22.297  	       (*"z1 + (z1 + k) = 2 * z1 + k"*)
  22.298  
  22.299 -	       Rule.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  22.300 +	       Rule.Thm ("real_num_collect",ThmC.numerals_to_Free @{thm real_num_collect}), 
  22.301  	       (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
  22.302 -	       Rule.Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),
  22.303 +	       Rule.Thm ("real_num_collect_assoc",ThmC.numerals_to_Free @{thm real_num_collect_assoc}),
  22.304  	       (*"[| l is_const; m is_const |] ==>  
  22.305  				l * n + (m * n + k) =  (l + m) * n + k"*)
  22.306 -	       Rule.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),	
  22.307 +	       Rule.Thm ("real_one_collect",ThmC.numerals_to_Free @{thm real_one_collect}),	
  22.308  	       (*"m is_const ==> n + m * n = (1 + m) * n"*)
  22.309 -	       Rule.Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), 
  22.310 +	       Rule.Thm ("real_one_collect_assoc",ThmC.numerals_to_Free @{thm real_one_collect_assoc}), 
  22.311  	       (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  22.312  
  22.313  	       Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"), 
  22.314 @@ -675,83 +675,83 @@
  22.315  	      ("POWER", ("Prog_Expr.pow", (**)eval_binop "#power_"))
  22.316  	      ], errpatts = [],
  22.317        rules = 
  22.318 -      [Rule.Thm ("real_plus_binom_pow2"  ,TermC.num_str @{thm real_plus_binom_pow2}),     
  22.319 +      [Rule.Thm ("real_plus_binom_pow2"  ,ThmC.numerals_to_Free @{thm real_plus_binom_pow2}),     
  22.320  	       (*"(a + b) ^^^ 2 = a ^^^ 2 + 2 * a * b + b ^^^ 2"*)
  22.321 -       Rule.Thm ("real_plus_binom_times" ,TermC.num_str @{thm real_plus_binom_times}),    
  22.322 +       Rule.Thm ("real_plus_binom_times" ,ThmC.numerals_to_Free @{thm real_plus_binom_times}),    
  22.323  	      (*"(a + b)*(a + b) = ...*)
  22.324 -       Rule.Thm ("real_minus_binom_pow2" ,TermC.num_str @{thm real_minus_binom_pow2}),   
  22.325 +       Rule.Thm ("real_minus_binom_pow2" ,ThmC.numerals_to_Free @{thm real_minus_binom_pow2}),   
  22.326         (*"(a - b) ^^^ 2 = a ^^^ 2 - 2 * a * b + b ^^^ 2"*)
  22.327 -       Rule.Thm ("real_minus_binom_times",TermC.num_str @{thm real_minus_binom_times}),   
  22.328 +       Rule.Thm ("real_minus_binom_times",ThmC.numerals_to_Free @{thm real_minus_binom_times}),   
  22.329         (*"(a - b)*(a - b) = ...*)
  22.330 -       Rule.Thm ("real_plus_minus_binom1",TermC.num_str @{thm real_plus_minus_binom1}),   
  22.331 +       Rule.Thm ("real_plus_minus_binom1",ThmC.numerals_to_Free @{thm real_plus_minus_binom1}),   
  22.332          (*"(a + b) * (a - b) = a ^^^ 2 - b ^^^ 2"*)
  22.333 -       Rule.Thm ("real_plus_minus_binom2",TermC.num_str @{thm real_plus_minus_binom2}),   
  22.334 +       Rule.Thm ("real_plus_minus_binom2",ThmC.numerals_to_Free @{thm real_plus_minus_binom2}),   
  22.335          (*"(a - b) * (a + b) = a ^^^ 2 - b ^^^ 2"*)
  22.336         (*RL 020915*)
  22.337 -       Rule.Thm ("real_pp_binom_times",TermC.num_str @{thm real_pp_binom_times}), 
  22.338 +       Rule.Thm ("real_pp_binom_times",ThmC.numerals_to_Free @{thm real_pp_binom_times}), 
  22.339          (*(a + b)*(c + d) = a*c + a*d + b*c + b*d*)
  22.340 -       Rule.Thm ("real_pm_binom_times",TermC.num_str @{thm real_pm_binom_times}), 
  22.341 +       Rule.Thm ("real_pm_binom_times",ThmC.numerals_to_Free @{thm real_pm_binom_times}), 
  22.342          (*(a + b)*(c - d) = a*c - a*d + b*c - b*d*)
  22.343 -       Rule.Thm ("real_mp_binom_times",TermC.num_str @{thm real_mp_binom_times}), 
  22.344 +       Rule.Thm ("real_mp_binom_times",ThmC.numerals_to_Free @{thm real_mp_binom_times}), 
  22.345          (*(a - b)*(c p d) = a*c + a*d - b*c - b*d*)
  22.346 -       Rule.Thm ("real_mm_binom_times",TermC.num_str @{thm real_mm_binom_times}), 
  22.347 +       Rule.Thm ("real_mm_binom_times",ThmC.numerals_to_Free @{thm real_mm_binom_times}), 
  22.348          (*(a - b)*(c p d) = a*c - a*d - b*c + b*d*)
  22.349 -       Rule.Thm ("realpow_multI",TermC.num_str @{thm realpow_multI}),                
  22.350 +       Rule.Thm ("realpow_multI",ThmC.numerals_to_Free @{thm realpow_multI}),                
  22.351          (*(a*b)^^^n = a^^^n * b^^^n*)
  22.352 -       Rule.Thm ("real_plus_binom_pow3",TermC.num_str @{thm real_plus_binom_pow3}),
  22.353 +       Rule.Thm ("real_plus_binom_pow3",ThmC.numerals_to_Free @{thm real_plus_binom_pow3}),
  22.354          (* (a + b)^^^3 = a^^^3 + 3*a^^^2*b + 3*a*b^^^2 + b^^^3 *)
  22.355 -       Rule.Thm ("real_minus_binom_pow3",TermC.num_str @{thm real_minus_binom_pow3}),
  22.356 +       Rule.Thm ("real_minus_binom_pow3",ThmC.numerals_to_Free @{thm real_minus_binom_pow3}),
  22.357          (* (a - b)^^^3 = a^^^3 - 3*a^^^2*b + 3*a*b^^^2 - b^^^3 *)
  22.358  
  22.359  
  22.360 -     (*  Rule.Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),	
  22.361 +     (*  Rule.Thm ("distrib_right" ,ThmC.numerals_to_Free @{thm distrib_right}),	
  22.362  	 (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  22.363 -	Rule.Thm ("distrib_left",TermC.num_str @{thm distrib_left}),	
  22.364 +	Rule.Thm ("distrib_left",ThmC.numerals_to_Free @{thm distrib_left}),	
  22.365  	(*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  22.366 -	Rule.Thm ("left_diff_distrib" ,TermC.num_str @{thm left_diff_distrib}),	
  22.367 +	Rule.Thm ("left_diff_distrib" ,ThmC.numerals_to_Free @{thm left_diff_distrib}),	
  22.368  	(*"(z1.0 - z2.0) * w = z1.0 * w - z2.0 * w"*)
  22.369 -	Rule.Thm ("right_diff_distrib",TermC.num_str @{thm right_diff_distrib}),	
  22.370 +	Rule.Thm ("right_diff_distrib",ThmC.numerals_to_Free @{thm right_diff_distrib}),	
  22.371  	(*"w * (z1.0 - z2.0) = w * z1.0 - w * z2.0"*)
  22.372  	*)
  22.373  	
  22.374 -	Rule.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),              
  22.375 +	Rule.Thm ("mult_1_left",ThmC.numerals_to_Free @{thm mult_1_left}),              
  22.376           (*"1 * z = z"*)
  22.377 -	Rule.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),              
  22.378 +	Rule.Thm ("mult_zero_left",ThmC.numerals_to_Free @{thm mult_zero_left}),              
  22.379           (*"0 * z = 0"*)
  22.380 -	Rule.Thm ("add_0_left",TermC.num_str @{thm add_0_left}),
  22.381 +	Rule.Thm ("add_0_left",ThmC.numerals_to_Free @{thm add_0_left}),
  22.382           (*"0 + z = z"*)
  22.383  
  22.384  	Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"), 
  22.385  	Rule.Num_Calc ("Groups.times_class.times", (**)eval_binop "#mult_"),
  22.386  	Rule.Num_Calc ("Prog_Expr.pow", (**)eval_binop "#power_"),
  22.387          (*	       
  22.388 -	 Rule.Thm ("mult_commute",TermC.num_str @{thm mult_commute}),		
  22.389 +	 Rule.Thm ("mult_commute",ThmC.numerals_to_Free @{thm mult_commute}),		
  22.390          (*AC-rewriting*)
  22.391 -	Rule.Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
  22.392 -	Rule.Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),
  22.393 -	Rule.Thm ("add_commute",TermC.num_str @{thm add_commute}),	
  22.394 -	Rule.Thm ("add_left_commute",TermC.num_str @{thm add_left_commute}),
  22.395 -	Rule.Thm ("add_assoc",TermC.num_str @{thm add_assoc}),
  22.396 +	Rule.Thm ("real_mult_left_commute",ThmC.numerals_to_Free @{thm real_mult_left_commute}),
  22.397 +	Rule.Thm ("mult_assoc",ThmC.numerals_to_Free @{thm mult.assoc}),
  22.398 +	Rule.Thm ("add_commute",ThmC.numerals_to_Free @{thm add_commute}),	
  22.399 +	Rule.Thm ("add_left_commute",ThmC.numerals_to_Free @{thm add_left_commute}),
  22.400 +	Rule.Thm ("add_assoc",ThmC.numerals_to_Free @{thm add_assoc}),
  22.401  	*)
  22.402  	
  22.403  	Rule.Thm ("sym_realpow_twoI",
  22.404 -              TermC.num_str (@{thm realpow_twoI} RS @{thm sym})),
  22.405 +              ThmC.numerals_to_Free (@{thm realpow_twoI} RS @{thm sym})),
  22.406  	(*"r1 * r1 = r1 ^^^ 2"*)
  22.407 -	Rule.Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),			
  22.408 +	Rule.Thm ("realpow_plus_1",ThmC.numerals_to_Free @{thm realpow_plus_1}),			
  22.409  	(*"r * r ^^^ n = r ^^^ (n + 1)"*)
  22.410  	(*Rule.Thm ("sym_real_mult_2",
  22.411 -                TermC.num_str (@{thm real_mult_2} RS @{thm sym})),
  22.412 +                ThmC.numerals_to_Free (@{thm real_mult_2} RS @{thm sym})),
  22.413  	(*"z1 + z1 = 2 * z1"*)*)
  22.414 -	Rule.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),		
  22.415 +	Rule.Thm ("real_mult_2_assoc",ThmC.numerals_to_Free @{thm real_mult_2_assoc}),		
  22.416  	(*"z1 + (z1 + k) = 2 * z1 + k"*)
  22.417  
  22.418 -	Rule.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
  22.419 +	Rule.Thm ("real_num_collect",ThmC.numerals_to_Free @{thm real_num_collect}), 
  22.420  	(*"[| l is_const; m is_const |] ==> l * n + m * n = (l + m) * n"*)
  22.421 -	Rule.Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),	
  22.422 +	Rule.Thm ("real_num_collect_assoc",ThmC.numerals_to_Free @{thm real_num_collect_assoc}),	
  22.423  	(*"[| l is_const; m is_const |] ==>  l * n + (m * n + k) =  (l + m) * n + k"*)
  22.424 -	Rule.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),		
  22.425 +	Rule.Thm ("real_one_collect",ThmC.numerals_to_Free @{thm real_one_collect}),		
  22.426  	(*"m is_const ==> n + m * n = (1 + m) * n"*)
  22.427 -	Rule.Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), 
  22.428 +	Rule.Thm ("real_one_collect_assoc",ThmC.numerals_to_Free @{thm real_one_collect_assoc}), 
  22.429  	(*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  22.430  
  22.431  	Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"), 
    23.1 --- a/src/Tools/isac/MathEngBasic/rewrite.sml	Mon Apr 13 13:27:55 2020 +0200
    23.2 +++ b/src/Tools/isac/MathEngBasic/rewrite.sml	Mon Apr 13 15:31:23 2020 +0200
    23.3 @@ -310,19 +310,19 @@
    23.4  fun assoc_thm'' thy thmid =
    23.5    case Symbol.explode thmid of
    23.6      "s"::"y"::"m"::"_"::"#"::_ => error ("assoc_thm'' not impl.for " ^ thmid)
    23.7 -  | "s"::"y"::"m"::"_"::id => ((TermC.num_str o (Global_Theory.get_thm thy)) (implode id)) RS sym
    23.8 +  | "s"::"y"::"m"::"_"::id => ((ThmC.numerals_to_Free o (Global_Theory.get_thm thy)) (implode id)) RS sym
    23.9    | "#"::_ => error ("assoc_thm'' not impl.for " ^ thmid)
   23.10 -  | _ => thmid |> convert_metaview_to_thmid thy |> TermC.num_str
   23.11 +  | _ => thmid |> convert_metaview_to_thmid thy |> ThmC.numerals_to_Free
   23.12  fun assoc_thm' thy (thmid, ct') =
   23.13    (case Symbol.explode thmid of
   23.14      "s"::"y"::"m"::"_"::id => 
   23.15        if hd id = "#" 
   23.16        then mk_thm thy ct'
   23.17 -      else ((TermC.num_str o (Global_Theory.get_thm thy)) (implode id)) RS sym
   23.18 +      else ((ThmC.numerals_to_Free o (Global_Theory.get_thm thy)) (implode id)) RS sym
   23.19    | id =>
   23.20      if hd id = "#" 
   23.21      then mk_thm thy ct'
   23.22 -    else thmid |> convert_metaview_to_thmid thy |> TermC.num_str
   23.23 +    else thmid |> convert_metaview_to_thmid thy |> ThmC.numerals_to_Free
   23.24    ) handle _ (*TODO: find exn behind ERROR: Undefined fact: "add_commute"*) => 
   23.25      raise ERROR
   23.26        ("assoc_thm': \"" ^ thmid ^ "\" not in \"" ^ ThyC.theory2domID thy ^ "\" (and parents)")
    24.1 --- a/src/Tools/isac/MathEngBasic/thmC.sml	Mon Apr 13 13:27:55 2020 +0200
    24.2 +++ b/src/Tools/isac/MathEngBasic/thmC.sml	Mon Apr 13 15:31:23 2020 +0200
    24.3 @@ -6,6 +6,7 @@
    24.4  *)
    24.5  signature THEOREM_ISAC =
    24.6  sig
    24.7 +  val numerals_to_Free: thm -> thm
    24.8  
    24.9  end
   24.10  
   24.11 @@ -14,5 +15,9 @@
   24.12  struct
   24.13  (**)
   24.14  
   24.15 +type thmID = ThmC_Def.thmID;
   24.16 +type thm' = thmID * TermC.as_string;
   24.17 +
   24.18 +val numerals_to_Free = ThmC_Def.numerals_to_Free
   24.19  
   24.20  end
    25.1 --- a/src/Tools/isac/ProgLang/ListC.thy	Mon Apr 13 13:27:55 2020 +0200
    25.2 +++ b/src/Tools/isac/ProgLang/ListC.thy	Mon Apr 13 15:31:23 2020 +0200
    25.3 @@ -133,49 +133,49 @@
    25.4  val prog_expr =
    25.5    Rule_Def.Repeat {id = "prog_expr", preconds = [], rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), 
    25.6      erls = Rule_Def.Empty, srls = Rule_Def.Empty, calc = [], errpatts = [],
    25.7 -    rules = [Rule_Def.Thm ("refl", TermC.num_str @{thm refl}),  (*'a<>b -> FALSE' by fun eval_equal*)
    25.8 -       Rule_Def.Thm ("o_apply", TermC.num_str @{thm o_apply}),
    25.9 +    rules = [Rule_Def.Thm ("refl", ThmC_Def.numerals_to_Free @{thm refl}),  (*'a<>b -> FALSE' by fun eval_equal*)
   25.10 +       Rule_Def.Thm ("o_apply", ThmC_Def.numerals_to_Free @{thm o_apply}),
   25.11  
   25.12 -       Rule_Def.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),(*erls for cond. in Atools.ML*)
   25.13 -       Rule_Def.Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}),
   25.14 -       Rule_Def.Thm ("append_Cons",TermC.num_str @{thm append_Cons}),
   25.15 -       Rule_Def.Thm ("append_Nil",TermC.num_str @{thm append_Nil}),
   25.16 +       Rule_Def.Thm ("NTH_CONS",ThmC_Def.numerals_to_Free @{thm NTH_CONS}),(*erls for cond. in Atools.ML*)
   25.17 +       Rule_Def.Thm ("NTH_NIL",ThmC_Def.numerals_to_Free @{thm NTH_NIL}),
   25.18 +       Rule_Def.Thm ("append_Cons",ThmC_Def.numerals_to_Free @{thm append_Cons}),
   25.19 +       Rule_Def.Thm ("append_Nil",ThmC_Def.numerals_to_Free @{thm append_Nil}),
   25.20  (*       Thm ("butlast_Cons",num_str @{thm butlast_Cons}),
   25.21         Thm ("butlast_Nil",num_str @{thm butlast_Nil}),*)
   25.22 -       Rule_Def.Thm ("concat_Cons",TermC.num_str @{thm concat_Cons}),
   25.23 -       Rule_Def.Thm ("concat_Nil",TermC.num_str @{thm concat_Nil}),
   25.24 +       Rule_Def.Thm ("concat_Cons",ThmC_Def.numerals_to_Free @{thm concat_Cons}),
   25.25 +       Rule_Def.Thm ("concat_Nil",ThmC_Def.numerals_to_Free @{thm concat_Nil}),
   25.26  (*       Rule_Def.Thm ("del_base",num_str @{thm del_base}),
   25.27         Rule_Def.Thm ("del_rec",num_str @{thm del_rec}), *)
   25.28  
   25.29 -       Rule_Def.Thm ("distinct_Cons",TermC.num_str @{thm distinct_Cons}),
   25.30 -       Rule_Def.Thm ("distinct_Nil",TermC.num_str @{thm distinct_Nil}),
   25.31 -       Rule_Def.Thm ("dropWhile_Cons",TermC.num_str @{thm dropWhile_Cons}),
   25.32 -       Rule_Def.Thm ("dropWhile_Nil",TermC.num_str @{thm dropWhile_Nil}),
   25.33 -       Rule_Def.Thm ("filter_Cons",TermC.num_str @{thm filter_Cons}),
   25.34 -       Rule_Def.Thm ("filter_Nil",TermC.num_str @{thm filter_Nil}),
   25.35 -       Rule_Def.Thm ("foldr_Cons",TermC.num_str @{thm foldr_Cons}),
   25.36 -       Rule_Def.Thm ("foldr_Nil",TermC.num_str @{thm foldr_Nil}),
   25.37 -       Rule_Def.Thm ("hd_thm",TermC.num_str @{thm hd_thm}),
   25.38 -       Rule_Def.Thm ("LAST",TermC.num_str @{thm LAST}),
   25.39 -       Rule_Def.Thm ("LENGTH_CONS",TermC.num_str @{thm LENGTH_CONS}),
   25.40 -       Rule_Def.Thm ("LENGTH_NIL",TermC.num_str @{thm LENGTH_NIL}),
   25.41 +       Rule_Def.Thm ("distinct_Cons",ThmC_Def.numerals_to_Free @{thm distinct_Cons}),
   25.42 +       Rule_Def.Thm ("distinct_Nil",ThmC_Def.numerals_to_Free @{thm distinct_Nil}),
   25.43 +       Rule_Def.Thm ("dropWhile_Cons",ThmC_Def.numerals_to_Free @{thm dropWhile_Cons}),
   25.44 +       Rule_Def.Thm ("dropWhile_Nil",ThmC_Def.numerals_to_Free @{thm dropWhile_Nil}),
   25.45 +       Rule_Def.Thm ("filter_Cons",ThmC_Def.numerals_to_Free @{thm filter_Cons}),
   25.46 +       Rule_Def.Thm ("filter_Nil",ThmC_Def.numerals_to_Free @{thm filter_Nil}),
   25.47 +       Rule_Def.Thm ("foldr_Cons",ThmC_Def.numerals_to_Free @{thm foldr_Cons}),
   25.48 +       Rule_Def.Thm ("foldr_Nil",ThmC_Def.numerals_to_Free @{thm foldr_Nil}),
   25.49 +       Rule_Def.Thm ("hd_thm",ThmC_Def.numerals_to_Free @{thm hd_thm}),
   25.50 +       Rule_Def.Thm ("LAST",ThmC_Def.numerals_to_Free @{thm LAST}),
   25.51 +       Rule_Def.Thm ("LENGTH_CONS",ThmC_Def.numerals_to_Free @{thm LENGTH_CONS}),
   25.52 +       Rule_Def.Thm ("LENGTH_NIL",ThmC_Def.numerals_to_Free @{thm LENGTH_NIL}),
   25.53  (*       Rule_Def.Thm ("list_diff_def",num_str @{thm list_diff_def}),*)
   25.54 -       Rule_Def.Thm ("map_Cons",TermC.num_str @{thm map_Cons}),
   25.55 -       Rule_Def.Thm ("map_Nil",TermC.num_str @{thm map_Cons}),
   25.56 -(*       Rule_Def.Thm ("mem_Cons",TermC.num_str @{thm mem_Cons}),
   25.57 -       Rule_Def.Thm ("mem_Nil",TermC.num_str @{thm mem_Nil}), *)
   25.58 -(*       Rule_Def.Thm ("null_Cons",TermC.num_str @{thm null_Cons}),
   25.59 -       Rule_Def.Thm ("null_Nil",TermC.num_str @{thm null_Nil}),*)
   25.60 -       Rule_Def.Thm ("remdups_Cons",TermC.num_str @{thm remdups_Cons}),
   25.61 -       Rule_Def.Thm ("remdups_Nil",TermC.num_str @{thm remdups_Nil}),
   25.62 -       Rule_Def.Thm ("rev_Cons",TermC.num_str @{thm rev_Cons}),
   25.63 -       Rule_Def.Thm ("rev_Nil",TermC.num_str @{thm rev_Nil}),
   25.64 -       Rule_Def.Thm ("take_Nil",TermC.num_str @{thm take_Nil}),
   25.65 -       Rule_Def.Thm ("take_Cons",TermC.num_str @{thm take_Cons}),
   25.66 -       Rule_Def.Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}),
   25.67 -       Rule_Def.Thm ("tl_Nil",TermC.num_str @{thm tl_Nil}),
   25.68 -       Rule_Def.Thm ("zip_Cons",TermC.num_str @{thm zip_Cons}),
   25.69 -       Rule_Def.Thm ("zip_Nil",TermC.num_str @{thm zip_Nil})],
   25.70 +       Rule_Def.Thm ("map_Cons",ThmC_Def.numerals_to_Free @{thm map_Cons}),
   25.71 +       Rule_Def.Thm ("map_Nil",ThmC_Def.numerals_to_Free @{thm map_Cons}),
   25.72 +(*       Rule_Def.Thm ("mem_Cons",ThmC_Def.numerals_to_Free @{thm mem_Cons}),
   25.73 +       Rule_Def.Thm ("mem_Nil",ThmC_Def.numerals_to_Free @{thm mem_Nil}), *)
   25.74 +(*       Rule_Def.Thm ("null_Cons",ThmC_Def.numerals_to_Free @{thm null_Cons}),
   25.75 +       Rule_Def.Thm ("null_Nil",ThmC_Def.numerals_to_Free @{thm null_Nil}),*)
   25.76 +       Rule_Def.Thm ("remdups_Cons",ThmC_Def.numerals_to_Free @{thm remdups_Cons}),
   25.77 +       Rule_Def.Thm ("remdups_Nil",ThmC_Def.numerals_to_Free @{thm remdups_Nil}),
   25.78 +       Rule_Def.Thm ("rev_Cons",ThmC_Def.numerals_to_Free @{thm rev_Cons}),
   25.79 +       Rule_Def.Thm ("rev_Nil",ThmC_Def.numerals_to_Free @{thm rev_Nil}),
   25.80 +       Rule_Def.Thm ("take_Nil",ThmC_Def.numerals_to_Free @{thm take_Nil}),
   25.81 +       Rule_Def.Thm ("take_Cons",ThmC_Def.numerals_to_Free @{thm take_Cons}),
   25.82 +       Rule_Def.Thm ("tl_Cons",ThmC_Def.numerals_to_Free @{thm tl_Cons}),
   25.83 +       Rule_Def.Thm ("tl_Nil",ThmC_Def.numerals_to_Free @{thm tl_Nil}),
   25.84 +       Rule_Def.Thm ("zip_Cons",ThmC_Def.numerals_to_Free @{thm zip_Cons}),
   25.85 +       Rule_Def.Thm ("zip_Nil",ThmC_Def.numerals_to_Free @{thm zip_Nil})],
   25.86      scr = Rule_Def.EmptyScr}: Rule_Set.T;
   25.87  \<close>
   25.88  setup \<open>KEStore_Elems.add_rlss [("prog_expr", (Context.theory_name @{theory}, prog_expr))]\<close>
    26.1 --- a/src/Tools/isac/ProgLang/Prog_Expr.thy	Mon Apr 13 13:27:55 2020 +0200
    26.2 +++ b/src/Tools/isac/ProgLang/Prog_Expr.thy	Mon Apr 13 15:31:23 2020 +0200
    26.3 @@ -300,7 +300,7 @@
    26.4  		 (t as (Const _ $ arg)) _ = 
    26.5      (case arg of 
    26.6  	Free (n,_) =>
    26.7 -	 (case TermC.int_of_str_opt n of
    26.8 +	 (case ThmC_Def.int_of_str_opt n of
    26.9  	      SOME i =>
   26.10  	      if even i then SOME (TermC.mk_thmid thmid n "", 
   26.11  				   HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True})))
   26.12 @@ -344,7 +344,7 @@
   26.13    ("leq"     ,("Orderings.ord_class.less_eq"       , Prog_Expr.eval_equ "#less_equal_"))*)
   26.14  fun eval_equ (thmid:string) (_(*op_*)) (t as 
   26.15  	       (Const (op0, _) $ Free (n1, _) $ Free(n2, _))) _ = 
   26.16 -    (case (TermC.int_of_str_opt n1, TermC.int_of_str_opt n2) of
   26.17 +    (case (ThmC_Def.int_of_str_opt n1, ThmC_Def.int_of_str_opt n2) of
   26.18  	 (SOME n1', SOME n2') =>
   26.19    if Num_Calc.calc_equ (strip_thy op0) (n1', n2')
   26.20      then SOME (TermC.mk_thmid thmid n1 n2, 
   26.21 @@ -437,7 +437,7 @@
   26.22  (*("DIVIDE" ,("Rings.divide_class.divide"  , eval_cancel "#divide_e"))*)
   26.23  fun eval_cancel (thmid: string) "Rings.divide_class.divide" (t as 
   26.24  	       (Const (op0,t0) $ Free (n1, _) $ Free(n2, _))) _ = 
   26.25 -    (case (TermC.int_of_str_opt n1, TermC.int_of_str_opt n2) of
   26.26 +    (case (ThmC_Def.int_of_str_opt n1, ThmC_Def.int_of_str_opt n2) of
   26.27      	(SOME n1', SOME n2') =>
   26.28          let 
   26.29            val sg = Num_Calc.sign_mult n1' n2';
    27.1 --- a/src/Tools/isac/ProgLang/Program.thy	Mon Apr 13 13:27:55 2020 +0200
    27.2 +++ b/src/Tools/isac/ProgLang/Program.thy	Mon Apr 13 15:31:23 2020 +0200
    27.3 @@ -73,7 +73,7 @@
    27.4    |> HOLogic.dest_Trueprop
    27.5    |> Logic.unvarify_global
    27.6    |> TermC.inst_abs
    27.7 -  |> TermC.numbers_to_string (*for numbers in the program*))
    27.8 +  |> ThmC_Def.numbers_to_string (*for numbers in the program*))
    27.9    handle TERM _ => raise TERM ("prep_program", [Thm.prop_of thm])
   27.10  
   27.11  (* get identifier of partial_function *)
    28.1 --- a/src/Tools/isac/ProgLang/calculate.sml	Mon Apr 13 13:27:55 2020 +0200
    28.2 +++ b/src/Tools/isac/ProgLang/calculate.sml	Mon Apr 13 15:31:23 2020 +0200
    28.3 @@ -192,14 +192,14 @@
    28.4  
    28.5  (* convert int and float to internal floatingpoint prepresentation.*)
    28.6  fun numeral (Free (str, _)) = 
    28.7 -    (case TermC.int_of_str_opt str of
    28.8 +    (case ThmC_Def.int_of_str_opt str of
    28.9  	 SOME i => SOME ((i, 0), (0, 0))
   28.10         | NONE => NONE)
   28.11    | numeral (Const ("Float.Float", _) $
   28.12  		   (Const ("Product_Type.Pair", _) $
   28.13  			  (Const ("Product_Type.Pair", _) $ Free (v1, _) $ Free (v2,_)) $
   28.14  			  (Const ("Product_Type.Pair", _) $ Free (p1, _) $ Free (p2,_))))=
   28.15 -    (case (TermC.int_of_str_opt v1, TermC.int_of_str_opt v2, TermC.int_of_str_opt p1, TermC.int_of_str_opt p2) of
   28.16 +    (case (ThmC_Def.int_of_str_opt v1, ThmC_Def.int_of_str_opt v2, ThmC_Def.int_of_str_opt p1, ThmC_Def.int_of_str_opt p2) of
   28.17  	(SOME v1', SOME v2', SOME p1', SOME p2') =>
   28.18  	SOME ((v1', v2'), (p1', p2'))
   28.19        | _ => NONE)
    29.1 --- a/test/Tools/isac/ADDTESTS/course/CADGME/example_2.thy	Mon Apr 13 13:27:55 2020 +0200
    29.2 +++ b/test/Tools/isac/ADDTESTS/course/CADGME/example_2.thy	Mon Apr 13 15:31:23 2020 +0200
    29.3 @@ -34,9 +34,9 @@
    29.4  
    29.5  ML \<open>
    29.6    val transform = Rule_Set.append_rules "transform" Rule_Set.empty
    29.7 -    [ Thm  ("rule3",num_str @{thm rule3}),
    29.8 -      Thm  ("rule4",num_str @{thm rule4}),
    29.9 -      Thm  ("rule1",num_str @{thm rule1})   
   29.10 +    [ Thm  ("rule3",ThmC.numerals_to_Free @{thm rule3}),
   29.11 +      Thm  ("rule4",ThmC.numerals_to_Free @{thm rule4}),
   29.12 +      Thm  ("rule1",ThmC.numerals_to_Free @{thm rule1})   
   29.13      ];
   29.14  \<close>
   29.15  
    30.1 --- a/test/Tools/isac/ADDTESTS/course/SignalProcess/Build_Inverse_Z_Transform.thy	Mon Apr 13 13:27:55 2020 +0200
    30.2 +++ b/test/Tools/isac/ADDTESTS/course/SignalProcess/Build_Inverse_Z_Transform.thy	Mon Apr 13 15:31:23 2020 +0200
    30.3 @@ -74,9 +74,9 @@
    30.4  
    30.5  ML \<open>
    30.6    val inverse_Z = Rule_Set.append_rules "inverse_Z" Rule_Set.empty
    30.7 -    [ Thm  ("rule3",TermC.num_str @{thm rule3}),
    30.8 -      Thm  ("rule4",TermC.num_str @{thm rule4}),
    30.9 -      Thm  ("rule1",TermC.num_str @{thm rule1})   
   30.10 +    [ Thm  ("rule3",ThmC.numerals_to_Free @{thm rule3}),
   30.11 +      Thm  ("rule4",ThmC.numerals_to_Free @{thm rule4}),
   30.12 +      Thm  ("rule1",ThmC.numerals_to_Free @{thm rule1})   
   30.13      ];
   30.14  
   30.15    val t = TermC.str2term "z / (z - 1) + z / (z - \<alpha>) + 1";
   30.16 @@ -91,19 +91,19 @@
   30.17  ML \<open>val (thy, ro, er) = (@{theory}, tless_true, eval_rls);\<close>
   30.18  ML \<open>
   30.19    val SOME (t, asm1) = 
   30.20 -    Rewrite.rewrite_ thy ro er true (TermC.num_str @{thm rule3}) t;
   30.21 +    Rewrite.rewrite_ thy ro er true (ThmC.numerals_to_Free @{thm rule3}) t;
   30.22    UnparseC.term t = "- ?u [- ?n - 1] + z / (z - \<alpha>) + 1";
   30.23    (*- real *)
   30.24    UnparseC.term t;
   30.25  
   30.26    val SOME (t, asm2) = 
   30.27 -    Rewrite.rewrite_ thy ro er true (TermC.num_str @{thm rule4}) t;
   30.28 +    Rewrite.rewrite_ thy ro er true (ThmC.numerals_to_Free @{thm rule4}) t;
   30.29    UnparseC.term t = "- ?u [- ?n - 1] + \<alpha> ^^^ ?n * ?u [?n] + 1";
   30.30    (*- real *)
   30.31    UnparseC.term t;
   30.32  
   30.33    val SOME (t, asm3) = 
   30.34 -    Rewrite.rewrite_ thy ro er true (TermC.num_str @{thm rule1}) t;
   30.35 +    Rewrite.rewrite_ thy ro er true (ThmC.numerals_to_Free @{thm rule1}) t;
   30.36    UnparseC.term t = "- ?u [- ?n - 1] + \<alpha> ^^^ ?n * ?u [?n] + ?\<delta> [?n]";
   30.37    (*- real *)
   30.38    UnparseC.term t;
   30.39 @@ -701,8 +701,8 @@
   30.40      Rule_Set.Repeat {id = "ansatz_rls", preconds = [], rew_ord = ("dummy_ord",dummy_ord),
   30.41        erls = Rule_Set.empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
   30.42        rules = [
   30.43 -        Thm ("ansatz_2nd_order",num_str @{thm ansatz_2nd_order}),
   30.44 -        Thm ("equival_trans_2nd_order",num_str @{thm equival_trans_2nd_order})
   30.45 +        Thm ("ansatz_2nd_order",ThmC.numerals_to_Free @{thm ansatz_2nd_order}),
   30.46 +        Thm ("equival_trans_2nd_order",ThmC.numerals_to_Free @{thm equival_trans_2nd_order})
   30.47                ], 
   30.48        scr = EmptyScr});
   30.49  \<close>
   30.50 @@ -1096,9 +1096,9 @@
   30.51             ], 
   30.52           srls = Rule_Set.Empty, calc = [], errpatts = [],
   30.53           rules = [
   30.54 -                  Thm ("NTH_CONS",num_str @{thm NTH_CONS}),
   30.55 +                  Thm ("NTH_CONS",ThmC.numerals_to_Free @{thm NTH_CONS}),
   30.56                    Num_Calc("Groups.plus_class.plus", eval_binop "#add_"),
   30.57 -                  Thm ("NTH_NIL",num_str @{thm NTH_NIL}),
   30.58 +                  Thm ("NTH_NIL",ThmC.numerals_to_Free @{thm NTH_NIL}),
   30.59                    Num_Calc("Prog_Expr.lhs", eval_lhs"eval_lhs_"),
   30.60                    Num_Calc("Prog_Expr.rhs", eval_rhs"eval_rhs_"),
   30.61                    Num_Calc("Prog_Expr.argument'_in", eval_argument_in "Prog_Expr.argument'_in"),
    31.1 --- a/test/Tools/isac/ADDTESTS/course/phst11/T2_Rewriting.thy	Mon Apr 13 13:27:55 2020 +0200
    31.2 +++ b/test/Tools/isac/ADDTESTS/course/phst11/T2_Rewriting.thy	Mon Apr 13 15:31:23 2020 +0200
    31.3 @@ -22,10 +22,10 @@
    31.4    found in ~~/src/Tools/isac/Knowledge/Diff.thy:
    31.5  \<close>
    31.6  ML \<open>
    31.7 -val diff_sum = TermC.num_str @{thm diff_sum};
    31.8 -val diff_pow = TermC.num_str @{thm diff_pow};
    31.9 -val diff_var = TermC.num_str @{thm diff_var};
   31.10 -val diff_const = TermC.num_str @{thm diff_const};
   31.11 +val diff_sum = ThmC.numerals_to_Free @{thm diff_sum};
   31.12 +val diff_pow = ThmC.numerals_to_Free @{thm diff_pow};
   31.13 +val diff_var = ThmC.numerals_to_Free @{thm diff_var};
   31.14 +val diff_const = ThmC.numerals_to_Free @{thm diff_const};
   31.15  \<close>
   31.16  text \<open>Looking at the rules (abbreviated by 'thm' above), we see the 
   31.17    differential operator abbreviated by 'd_d ?bdv', where '?bdv' is the bound 
    32.1 --- a/test/Tools/isac/BaseDefinitions/termC.sml	Mon Apr 13 13:27:55 2020 +0200
    32.2 +++ b/test/Tools/isac/BaseDefinitions/termC.sml	Mon Apr 13 15:31:23 2020 +0200
    32.3 @@ -183,17 +183,17 @@
    32.4  "----------- inst_bdv -----------------------------------";
    32.5  "----------- inst_bdv -----------------------------------";
    32.6  "----------- inst_bdv -----------------------------------";
    32.7 - if (UnparseC.term o Thm.prop_of o num_str) @{thm d1_isolate_add2} = 
    32.8 + if (UnparseC.term o Thm.prop_of o ThmC.numerals_to_Free) @{thm d1_isolate_add2} = 
    32.9       "\<not> ?bdv occurs_in ?a \<Longrightarrow>\n(?a + ?bdv = 0) = (?bdv = -1 * ?a)"
   32.10     then ()
   32.11     else error "termC.sml d1_isolate_add2";
   32.12   val subst = [(str2term "bdv", str2term "x")];
   32.13 - val t = (norm o #prop o Thm.rep_thm) (num_str @{thm d1_isolate_add2});
   32.14 + val t = (norm o #prop o Thm.rep_thm) (ThmC.numerals_to_Free @{thm d1_isolate_add2});
   32.15   val t' = inst_bdv subst t;
   32.16   if UnparseC.term t' = "\<not> x occurs_in ?a \<Longrightarrow> (?a + x = 0) = (x = -1 * ?a)"
   32.17     then ()
   32.18     else error "termC.sml inst_bdv 1";
   32.19 -if (UnparseC.term o Thm.prop_of o num_str) @{thm separate_bdvs_add} = 
   32.20 +if (UnparseC.term o Thm.prop_of o ThmC.numerals_to_Free) @{thm separate_bdvs_add} = 
   32.21    "[] from [?bdv_1.0, ?bdv_2.0, ?bdv_3.0,\n         "
   32.22    ^ "?bdv_4.0] occur_exactly_in ?a \<Longrightarrow>\n(?a + ?b = ?c) = (?b = ?c + -1 * ?a)"
   32.23  then () else error "termC.sml separate_bdvs_add";
   32.24 @@ -204,7 +204,7 @@
   32.25   	   (str2term "bdv_2", str2term "c_2"),
   32.26   	   (str2term "bdv_3", str2term "c_3"),
   32.27   	   (str2term "bdv_4", str2term "c_4")];
   32.28 -val t = (norm o #prop o Thm.rep_thm) (num_str @{thm separate_bdvs_add});
   32.29 +val t = (norm o #prop o Thm.rep_thm) (ThmC.numerals_to_Free @{thm separate_bdvs_add});
   32.30  val t' = inst_bdv subst t;
   32.31  
   32.32  if UnparseC.term t' = "[] from [c, c_2, c_3, c_4] occur_exactly_in ?a \<Longrightarrow>\n"
   32.33 @@ -660,7 +660,7 @@
   32.34  val SOME t' = strip_imp_prems' t;
   32.35  if  UnparseC.term t' = "(\<Longrightarrow>) (?k \<noteq> 0)" then () else error "strip_imp_prems' changed";
   32.36  
   32.37 -val thm = TermC.num_str @{thm frac_sym_conv};
   32.38 +val thm = ThmC.numerals_to_Free @{thm frac_sym_conv};
   32.39  val prop = (#prop o Thm.rep_thm) thm;
   32.40  val concl = Logic.strip_imp_concl prop;
   32.41  val SOME prems = strip_imp_prems' prop;
    33.1 --- a/test/Tools/isac/BridgeLibisabelle/thy-hierarchy.sml	Mon Apr 13 13:27:55 2020 +0200
    33.2 +++ b/test/Tools/isac/BridgeLibisabelle/thy-hierarchy.sml	Mon Apr 13 15:31:23 2020 +0200
    33.3 @@ -173,13 +173,13 @@
    33.4  "----------- fun revert_sym --------------------------------------";
    33.5  val thy = @{theory Isac_Knowledge}
    33.6  val (Thm (thmID, thm)) =
    33.7 -  revert_sym thy (Thm ("sym_real_mult_minus1", num_str (@{thm real_mult_minus1} RS @{thm sym})))
    33.8 +  revert_sym thy (Thm ("sym_real_mult_minus1", ThmC.numerals_to_Free (@{thm real_mult_minus1} RS @{thm sym})))
    33.9  ;
   33.10  if thmID = "Poly.real_mult_minus1" andalso string_of_thmI thm = "-1 * ?z = - ?z"
   33.11  then () else error "fun revert_sym changed 1";
   33.12  
   33.13  val (Thm (thmID, thm)) =
   33.14 -  revert_sym thy (Thm ("real_diff_minus", num_str @{thm real_diff_minus}))
   33.15 +  revert_sym thy (Thm ("real_diff_minus", ThmC.numerals_to_Free @{thm real_diff_minus}))
   33.16  ;
   33.17  if thmID = "Root.real_diff_minus" andalso string_of_thmI thm = "?a - ?b = ?a + -1 * ?b"
   33.18  then () else error "fun revert_sym changed 2"
    34.1 --- a/test/Tools/isac/BridgeLibisabelle/use-cases.sml	Mon Apr 13 13:27:55 2020 +0200
    34.2 +++ b/test/Tools/isac/BridgeLibisabelle/use-cases.sml	Mon Apr 13 15:31:23 2020 +0200
    34.3 @@ -715,7 +715,7 @@
    34.4   autoCalculate 1 (Steps 1); fetchProposedTactic 1;
    34.5   setNextTactic 1 (Apply_Method ["PolyEq","normalise_poly"]);
    34.6   autoCalculate 1 (Steps 1); fetchProposedTactic 1;
    34.7 - setNextTactic 1 (Rewrite ("all_left", num_str @{thm all_left}));
    34.8 + setNextTactic 1 (Rewrite ("all_left", ThmC.numerals_to_Free @{thm all_left}));
    34.9   autoCalculate 1 (Steps 1); fetchProposedTactic 1;
   34.10   setNextTactic 1 (Rewrite_Set_Inst (["(''bdv'',x)"], "make_ratpoly_in"));
   34.11   autoCalculate 1 (Steps 1); fetchProposedTactic 1;
    35.1 --- a/test/Tools/isac/Interpret/rewtools.sml	Mon Apr 13 13:27:55 2020 +0200
    35.2 +++ b/test/Tools/isac/Interpret/rewtools.sml	Mon Apr 13 15:31:23 2020 +0200
    35.3 @@ -349,7 +349,7 @@
    35.4  "----------- fun is_contained_in ------------------------";
    35.5  "----------- fun is_contained_in ------------------------";
    35.6  "----------- fun is_contained_in ------------------------";
    35.7 -val r1 = Thm ("real_diff_minus",num_str @{thm real_diff_minus});
    35.8 +val r1 = Thm ("real_diff_minus",ThmC.numerals_to_Free @{thm real_diff_minus});
    35.9  if Rtools.contains_rule r1 Test_simplify then ()
   35.10  else error "rewtools.sml Rtools.contains_rule Thm";
   35.11  
    36.1 --- a/test/Tools/isac/Knowledge/biegelinie-1.sml	Mon Apr 13 13:27:55 2020 +0200
    36.2 +++ b/test/Tools/isac/Knowledge/biegelinie-1.sml	Mon Apr 13 15:31:23 2020 +0200
    36.3 @@ -61,9 +61,9 @@
    36.4  				   Num_Calc("Groups.plus_class.plus", eval_binop "#add_")
    36.5  				   ], 
    36.6  		srls = Rule_Set.Empty, calc = [], errpatts = [],
    36.7 -		rules = [Thm ("NTH_CONS",num_str @{thm NTH_CONS}),
    36.8 +		rules = [Thm ("NTH_CONS",ThmC.numerals_to_Free @{thm NTH_CONS}),
    36.9  			 Num_Calc("Groups.plus_class.plus", eval_binop "#add_"),
   36.10 -			 Thm ("NTH_NIL",num_str @{thm NTH_NIL}),
   36.11 +			 Thm ("NTH_NIL",ThmC.numerals_to_Free @{thm NTH_NIL}),
   36.12  			 Num_Calc("Prog_Expr.lhs", eval_lhs "eval_lhs_"),
   36.13  			 Num_Calc("Prog_Expr.rhs", eval_rhs "eval_rhs_"),
   36.14  			 Num_Calc("Prog_Expr.argument'_in", eval_argument_in "Prog_Expr.argument'_in")
    37.1 --- a/test/Tools/isac/Knowledge/diophanteq.sml	Mon Apr 13 13:27:55 2020 +0200
    37.2 +++ b/test/Tools/isac/Knowledge/diophanteq.sml	Mon Apr 13 15:31:23 2020 +0200
    37.3 @@ -34,7 +34,7 @@
    37.4      | NONE => error "diophanteq.sml: syntax error in rewriting for usecase1";
    37.5  
    37.6  val SOME (t,_) = rewrite_inst_ thy e_rew_ord Rule_Set.empty true subst 
    37.7 -  (num_str @{thm "int_isolate_add"}) t; UnparseC.term t;
    37.8 +  (ThmC.numerals_to_Free @{thm "int_isolate_add"}) t; UnparseC.term t;
    37.9  
   37.10  val SOME (thmID,thm) = adhoc_thm thy (the(LibraryC.assoc(KEStore_Elems.get_calcs @{theory},"TIMES"))) t; 
   37.11  val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t; UnparseC.term t;
    38.1 --- a/test/Tools/isac/Knowledge/eqsystem.sml	Mon Apr 13 13:27:55 2020 +0200
    38.2 +++ b/test/Tools/isac/Knowledge/eqsystem.sml	Mon Apr 13 15:31:23 2020 +0200
    38.3 @@ -83,8 +83,8 @@
    38.4  val t = str2term "LENGTH [x+y=1,y=2] = 2";
    38.5  atomty t;
    38.6  val testrls = Rule_Set.append_rules "testrls" Rule_Set.empty 
    38.7 -			 [(Thm ("LENGTH_NIL",num_str @{thm LENGTH_NIL})),
    38.8 -			  (Thm ("LENGTH_CONS",num_str @{thm LENGTH_CONS})),
    38.9 +			 [(Thm ("LENGTH_NIL",ThmC.numerals_to_Free @{thm LENGTH_NIL})),
   38.10 +			  (Thm ("LENGTH_CONS",ThmC.numerals_to_Free @{thm LENGTH_CONS})),
   38.11  			  Num_Calc ("Groups.plus_class.plus", eval_binop "#add_"),
   38.12  			  Num_Calc ("HOL.eq",eval_equal "#equal_")
   38.13  			  ];
   38.14 @@ -105,10 +105,10 @@
   38.15  val SOME (t,_) = 
   38.16      rewrite_set_ thy true 
   38.17  		 (Rule_Set.append_rules "prls_" Rule_Set.empty 
   38.18 -			     [Thm ("NTH_CONS",num_str @{thm NTH_CONS}),
   38.19 -			      Thm ("NTH_NIL",num_str @{thm NTH_NIL}),
   38.20 -			      Thm ("TL_CONS",num_str @{thm tl_Cons}),
   38.21 -			      Thm ("TL_NIL",num_str @{thm tl_Nil}),
   38.22 +			     [Thm ("NTH_CONS",ThmC.numerals_to_Free @{thm NTH_CONS}),
   38.23 +			      Thm ("NTH_NIL",ThmC.numerals_to_Free @{thm NTH_NIL}),
   38.24 +			      Thm ("TL_CONS",ThmC.numerals_to_Free @{thm tl_Cons}),
   38.25 +			      Thm ("TL_NIL",ThmC.numerals_to_Free @{thm tl_Nil}),
   38.26  			      Num_Calc ("EqSystem.occur'_exactly'_in", eval_occur_exactly_in "#eval_occur_exactly_in_")
   38.27  			      ]) t;
   38.28  if t = @{term True} then () 
   38.29 @@ -742,9 +742,9 @@
   38.30    "0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2, " ^
   38.31    "0 = c_4, " ^
   38.32    "0 = c_3]");
   38.33 -val SOME (t,_) = rewrite_ thy e_rew_ord Rule_Set.empty false (num_str @{thm commute_0_equality}) t;
   38.34 -val SOME (t,_) = rewrite_ thy e_rew_ord Rule_Set.empty false (num_str @{thm commute_0_equality}) t;
   38.35 -val SOME (t,_) = rewrite_ thy e_rew_ord Rule_Set.empty false (num_str @{thm commute_0_equality}) t;
   38.36 +val SOME (t,_) = rewrite_ thy e_rew_ord Rule_Set.empty false (ThmC.numerals_to_Free @{thm commute_0_equality}) t;
   38.37 +val SOME (t,_) = rewrite_ thy e_rew_ord Rule_Set.empty false (ThmC.numerals_to_Free @{thm commute_0_equality}) t;
   38.38 +val SOME (t,_) = rewrite_ thy e_rew_ord Rule_Set.empty false (ThmC.numerals_to_Free @{thm commute_0_equality}) t;
   38.39  if UnparseC.term t = 
   38.40    "[L * q_0 = c, (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2 = 0, c_4 = 0,\n c_3 = 0]"
   38.41  then () else error "7.70 go through the rewrites in met_eqsys_norm_4x4, 1";
    39.1 --- a/test/Tools/isac/Knowledge/integrate.sml	Mon Apr 13 13:27:55 2020 +0200
    39.2 +++ b/test/Tools/isac/Knowledge/integrate.sml	Mon Apr 13 15:31:23 2020 +0200
    39.3 @@ -38,8 +38,8 @@
    39.4      rules = [(*for rewriting conditions in Thm's*)
    39.5  	    Num_Calc ("Prog_Expr.occurs'_in", 
    39.6  		  eval_occurs_in "#occurs_in_"),
    39.7 -	    Thm ("not_true",num_str @{thm not_true}),
    39.8 -	    Thm ("not_false",num_str @{thm not_false})],
    39.9 +	    Thm ("not_true",ThmC.numerals_to_Free @{thm not_true}),
   39.10 +	    Thm ("not_false",ThmC.numerals_to_Free @{thm not_false})],
   39.11      scr = EmptyScr};
   39.12  val subs = [(str2t "bdv::real", str2t "x::real")];
   39.13  fun rewrit thm str = 
   39.14 @@ -149,8 +149,8 @@
   39.15       rules = [Num_Calc ("Prog_Expr.matches",eval_matches ""),
   39.16        	Num_Calc ("Integrate.is'_f'_x", 
   39.17        	      eval_is_f_x "is_f_x_"),
   39.18 -      	Thm ("not_true",num_str @{thm not_true}),
   39.19 -      	Thm ("not_false",num_str @{thm not_false})
   39.20 +      	Thm ("not_true",ThmC.numerals_to_Free @{thm not_true}),
   39.21 +      	Thm ("not_false",ThmC.numerals_to_Free @{thm not_false})
   39.22        	],
   39.23       scr = EmptyScr};
   39.24  fun rewrit thm t = 
   39.25 @@ -197,20 +197,20 @@
   39.26  val subs = [(str2t "bdv::real", str2t "x::real")];
   39.27  val rls = 
   39.28    (Rule_Set.append_rules "separate_bdv" collect_bdv
   39.29 - 	  [Thm ("separate_bdv", num_str @{thm separate_bdv}),
   39.30 + 	  [Thm ("separate_bdv", ThmC.numerals_to_Free @{thm separate_bdv}),
   39.31   		  (*"?a * ?bdv / ?b = ?a / ?b * ?bdv"*)
   39.32 - 		 Thm ("separate_bdv_n", num_str @{thm separate_bdv_n}),
   39.33 + 		 Thm ("separate_bdv_n", ThmC.numerals_to_Free @{thm separate_bdv_n}),
   39.34        (*"?a * ?bdv ^^^ ?n / ?b = ?a / ?b * ?bdv ^^^ ?n"*)
   39.35 - 		Thm ("separate_1_bdv", num_str @{thm separate_1_bdv}),
   39.36 + 		Thm ("separate_1_bdv", ThmC.numerals_to_Free @{thm separate_1_bdv}),
   39.37   		  (*"?bdv / ?b = (1 / ?b) * ?bdv"*)
   39.38 - 		Thm ("separate_1_bdv_n", num_str @{thm separate_1_bdv_n})
   39.39 + 		Thm ("separate_1_bdv_n", ThmC.numerals_to_Free @{thm separate_1_bdv_n})
   39.40         (*"?bdv ^^^ ?n / ?b = 1 / ?b * ?bdv ^^^ ?n"*)
   39.41      ]);
   39.42  (*show_types := true;  --- do we need type-constraint in thms? *)
   39.43  @{thm separate_bdv};     (*::?'a does NOT rewrite here WITHOUT type constraint*)
   39.44  @{thm separate_bdv_n};   (*::real ..because of ^^^, rewrites*)
   39.45  @{thm separate_1_bdv};   (*::?'a*)
   39.46 -val xxx = num_str @{thm separate_1_bdv}; (*::?'a*)
   39.47 +val xxx = ThmC.numerals_to_Free @{thm separate_1_bdv}; (*::?'a*)
   39.48  @{thm separate_1_bdv_n}; (*::real ..because of ^^^*)
   39.49  (*show_types := false; --- do we need type-constraint in thms? YES ?!?!?!*)
   39.50  
    40.1 --- a/test/Tools/isac/Knowledge/partial_fractions.sml	Mon Apr 13 13:27:55 2020 +0200
    40.2 +++ b/test/Tools/isac/Knowledge/partial_fractions.sml	Mon Apr 13 15:31:23 2020 +0200
    40.3 @@ -293,7 +293,7 @@
    40.4  	  erls = xxx,
    40.5  	  srls = Rule_Set.Empty, calc = [], errpatts = [],
    40.6  	  rules = 
    40.7 -	   [Thm ("multiply_2nd_order",num_str @{thm multiply_2nd_order})
    40.8 +	   [Thm ("multiply_2nd_order",ThmC.numerals_to_Free @{thm multiply_2nd_order})
    40.9  	   ], 
   40.10  	 scr = EmptyScr}:rls);
   40.11  
    41.1 --- a/test/Tools/isac/Knowledge/polyeq-1.sml	Mon Apr 13 13:27:55 2020 +0200
    41.2 +++ b/test/Tools/isac/Knowledge/polyeq-1.sml	Mon Apr 13 15:31:23 2020 +0200
    41.3 @@ -299,7 +299,7 @@
    41.4  val fmz = ["equality (1 = (0::real))", "solveFor x", "solutions L"];
    41.5  val (dI',pI',mI') = ("PolyEq",["degree_0","polynomial","univariate","equation"],
    41.6                       ["PolyEq","solve_d0_polyeq_equation"]);
    41.7 -(*=== inhibit exn WN110914: declare_constraints doesnt work with num_str ========
    41.8 +(*=== inhibit exn WN110914: declare_constraints doesnt work with ThmC.numerals_to_Free ========
    41.9  TODO: change to "equality (x + -1*x = (0::real))"
   41.10        and search for an appropriate problem and method.
   41.11  
   41.12 @@ -964,27 +964,27 @@
   41.13  val SOME (t,asm) = rewrite_set_inst_ thy true inst rls t;
   41.14  UnparseC.term t = "-8 + (2 / 2 - x) ^^^ 2 = (2 / 2) ^^^ 2";
   41.15  
   41.16 -val thm = num_str @{thm square_explicit1};
   41.17 +val thm = ThmC.numerals_to_Free @{thm square_explicit1};
   41.18  val SOME (t,asm) = rewrite_ thy dummy_ord Rule_Set.Empty true thm t;
   41.19  UnparseC.term t = "(2 / 2 - x) ^^^ 2 = (2 / 2) ^^^ 2 - -8";
   41.20  
   41.21 -val thm = num_str @{thm root_plus_minus};
   41.22 +val thm = ThmC.numerals_to_Free @{thm root_plus_minus};
   41.23  val SOME (t,asm) = rewrite_ thy dummy_ord PolyEq_erls true thm t;
   41.24  UnparseC.term t = "2 / 2 - x = sqrt ((2 / 2) ^^^ 2 - -8) |"^
   41.25             "\n2 / 2 - x = -1 * sqrt ((2 / 2) ^^^ 2 - -8)";
   41.26  
   41.27  (*the thm bdv_explicit2* here required to be constrained to ::real*)
   41.28 -val thm = num_str @{thm bdv_explicit2};
   41.29 +val thm = ThmC.numerals_to_Free @{thm bdv_explicit2};
   41.30  val SOME (t,asm) = rewrite_inst_ thy dummy_ord Rule_Set.Empty true inst thm t;
   41.31  UnparseC.term t = "2 / 2 - x = sqrt ((2 / 2) ^^^ 2 - -8) |"^
   41.32                "\n-1 * x = - (2 / 2) + -1 * sqrt ((2 / 2) ^^^ 2 - -8)";
   41.33  
   41.34 -val thm = num_str @{thm bdv_explicit3};
   41.35 +val thm = ThmC.numerals_to_Free @{thm bdv_explicit3};
   41.36  val SOME (t,asm) = rewrite_inst_ thy dummy_ord Rule_Set.Empty true inst thm t;
   41.37  UnparseC.term t = "2 / 2 - x = sqrt ((2 / 2) ^^^ 2 - -8) |"^
   41.38                     "\nx = -1 * (- (2 / 2) + -1 * sqrt ((2 / 2) ^^^ 2 - -8))";
   41.39  
   41.40 -val thm = num_str @{thm bdv_explicit2};
   41.41 +val thm = ThmC.numerals_to_Free @{thm bdv_explicit2};
   41.42  val SOME (t,asm) = rewrite_inst_ thy dummy_ord Rule_Set.Empty true inst thm t;
   41.43  UnparseC.term t = "-1 * x = - (2 / 2) + sqrt ((2 / 2) ^^^ 2 - -8) |"^
   41.44                  "\nx = -1 * (- (2 / 2) + -1 * sqrt ((2 / 2) ^^^ 2 - -8))";
    42.1 --- a/test/Tools/isac/Knowledge/polyeq-2.sml	Mon Apr 13 13:27:55 2020 +0200
    42.2 +++ b/test/Tools/isac/Knowledge/polyeq-2.sml	Mon Apr 13 15:31:23 2020 +0200
    42.3 @@ -287,14 +287,14 @@
    42.4  
    42.5  (*-6 * x + 5 * x ^ 2 = 0 : Rewrite_Inst (["(''bdv'',x)"],("d2_prescind1","")) --> x * (-6 + 5 * x) = 0*)
    42.6  t |> UnparseC.term; t |> atomty;
    42.7 -val thm = num_str @{thm d2_prescind1};
    42.8 +val thm = ThmC.numerals_to_Free @{thm d2_prescind1};
    42.9  thm |> Thm.prop_of |> UnparseC.term; thm |> Thm.prop_of |> atomty;
   42.10  val SOME (t', _) = rewrite_inst_ thy e_rew_ord Rule_Set.empty true subst thm t; UnparseC.term t';
   42.11  
   42.12  (*x * (-6 + 5 * x) = 0   : Rewrite_Inst (["(''bdv'',x)"],("d2_reduce_equation1","")) 
   42.13                                                                          --> x = 0 | -6 + 5 * x = 0*)
   42.14  t' |> UnparseC.term; t' |> atomty;
   42.15 -val thm = num_str @{thm d2_reduce_equation1};
   42.16 +val thm = ThmC.numerals_to_Free @{thm d2_reduce_equation1};
   42.17  thm |> Thm.prop_of |> UnparseC.term; thm |> Thm.prop_of |> atomty;
   42.18  val SOME (t'', _) = rewrite_inst_ thy e_rew_ord Rule_Set.empty true subst thm t'; UnparseC.term t'';
   42.19  (* NONE with d2_reduce_equation1:   "(bdv*(a +b*bdv)=0) = ((bdv=0)|(a+b*bdv=0))"
    43.1 --- a/test/Tools/isac/Knowledge/polyminus.sml	Mon Apr 13 13:27:55 2020 +0200
    43.2 +++ b/test/Tools/isac/Knowledge/polyminus.sml	Mon Apr 13 15:31:23 2020 +0200
    43.3 @@ -573,9 +573,9 @@
    43.4  	      (*"(?a | True) = True"*)
    43.5  	      Thm ("or_false",@{thm or_false}),
    43.6  	      (*"(?a | False) = ?a"*)
    43.7 -	      Thm ("not_true",num_str @{thm not_true}),
    43.8 +	      Thm ("not_true",ThmC.numerals_to_Free @{thm not_true}),
    43.9  	      (*"(~ True) = False"*)
   43.10 -	      Thm ("not_false",num_str @{thm not_false})
   43.11 +	      Thm ("not_false",ThmC.numerals_to_Free @{thm not_false})
   43.12  	      (*"(~ False) = True"*)];
   43.13  (*trace_rewrite := true; ..stopped Test_Isac.thy*)
   43.14  val SOME (t', _) = rewrite_set_ thy false prls t;
    44.1 --- a/test/Tools/isac/Knowledge/rational.sml	Mon Apr 13 13:27:55 2020 +0200
    44.2 +++ b/test/Tools/isac/Knowledge/rational.sml	Mon Apr 13 15:31:23 2020 +0200
    44.3 @@ -959,7 +959,7 @@
    44.4  
    44.5  val t = str2term "(6*x)^^^2";
    44.6  val SOME (t',_) = rewrite_ thy dummy_ord powers_erls false 
    44.7 -			   (num_str @{thm realpow_def_atom}) t;
    44.8 +			   (ThmC.numerals_to_Free @{thm realpow_def_atom}) t;
    44.9  if UnparseC.term t' = "6 * x * (6 * x) ^^^ (2 + -1)" then ()
   44.10  else error "rational.sml powers_erls (6*x)^^^2";
   44.11  
    45.1 --- a/test/Tools/isac/Knowledge/rootrat.sml	Mon Apr 13 13:27:55 2020 +0200
    45.2 +++ b/test/Tools/isac/Knowledge/rootrat.sml	Mon Apr 13 15:31:23 2020 +0200
    45.3 @@ -59,5 +59,5 @@
    45.4  val SOME (t,asm) = rewrite_set_ thy true rls ttt;
    45.5  
    45.6  (*~~~~~ val rls = calculate_RootRat: rewrite stepwise*)
    45.7 -val thm = num_str @{thm complete_square2};
    45.8 +val thm = ThmC.numerals_to_Free @{thm complete_square2};
    45.9  
    46.1 --- a/test/Tools/isac/MathEngBasic/rewrite.sml	Mon Apr 13 13:27:55 2020 +0200
    46.2 +++ b/test/Tools/isac/MathEngBasic/rewrite.sml	Mon Apr 13 15:31:23 2020 +0200
    46.3 @@ -244,7 +244,7 @@
    46.4  				      eval_occur_exactly_in 
    46.5  					  "#eval_occur_exactly_in_"))
    46.6  			       ]) 
    46.7 -		  false bdvs (num_str @{separate_bdvs_add) t;
    46.8 +		  false bdvs (ThmC.numerals_to_Free @{separate_bdvs_add) t;
    46.9  (writeln o UnparseC.term) t;
   46.10  if UnparseC.term t = "L * c_3 + c_4 = 0 + -1 * (-1 * (q_0 * L ^^^ 2) / 2)"
   46.11  then () else error "rewrite.sml rewrite_inst_ bdvs";
   46.12 @@ -502,7 +502,7 @@
   46.13  "----------- 2011 thms with axclasses -------------------";
   46.14  "----------- 2011 thms with axclasses -------------------";
   46.15  "----------- 2011 thms with axclasses -------------------";
   46.16 -val thm = num_str @{thm div_by_1};
   46.17 +val thm = ThmC.numerals_to_Free @{thm div_by_1};
   46.18  val prop = Thm.prop_of thm;
   46.19  atomty prop;                                     (*Type 'a*)
   46.20  val t = str2term "(2*x)/1";                      (*Type real*)
   46.21 @@ -741,7 +741,7 @@
   46.22    NONE => ()
   46.23  | _ => writeln "parse does NOT take patterns with '?'";
   46.24  
   46.25 -val t1 = (#prop o Thm.rep_thm) (num_str thm);
   46.26 +val t1 = (#prop o Thm.rep_thm) (ThmC.numerals_to_Free thm);
   46.27  if UnparseC.term t1 = patt_str then () else error "realpow_twoI (\<rightarrow> string) NOT equal to given string";
   46.28  
   46.29  val t2 = HOLogic.Trueprop $ (((parse_patt thy)) patt_str) : term;
   46.30 @@ -754,7 +754,7 @@
   46.31  val thm_made = Thm.make_thm (Thm.global_cterm_of thy t2) (* = "?r ^^^ 2 = ?r * ?r"  [.]: thm
   46.32    ..gives another strange thm; but it is used and works with rewriting: *);
   46.33  
   46.34 -val t1' = (#prop o Thm.rep_thm) (num_str thm_made);
   46.35 +val t1' = (#prop o Thm.rep_thm) (ThmC.numerals_to_Free thm_made);
   46.36  if t1 = t1' then () else error "prop of realpow_twoI NOT equal to thm_made from string";
   46.37  
   46.38  (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*)
   46.39 @@ -773,7 +773,7 @@
   46.40    NONE => ()
   46.41  | _ => writeln "parse does NOT take patterns with '?'";
   46.42  
   46.43 -val t1 = (#prop o Thm.rep_thm) (num_str thm);
   46.44 +val t1 = (#prop o Thm.rep_thm) (ThmC.numerals_to_Free thm);
   46.45  if UnparseC.term t1 = patt_str then () else error "realpow_twoI (\<rightarrow> string) NOT equal to given string";
   46.46  
   46.47  val t2 = (*Trueprop $*) (((parse_patt thy)) patt_str) : term;
   46.48 @@ -786,7 +786,7 @@
   46.49  val thm_made = Thm.make_thm (Thm.global_cterm_of thy t2) (* = "?r ^^^ 2 = ?r * ?r"  [.]: thm
   46.50    gives another strange thm; but it is used and words with rewriting: *);
   46.51  
   46.52 -val t1' = (#prop o Thm.rep_thm) (num_str thm_made);
   46.53 +val t1' = (#prop o Thm.rep_thm) (ThmC.numerals_to_Free thm_made);
   46.54  if t1 = t1' then () else error "prop of realpow_twoI NOT equal to thm_made from string";
   46.55  
   46.56  "----------- fun rewrite_set_ .. norm_equation -------------------------------------------------";
    47.1 --- a/test/Tools/isac/OLDTESTS/root-equ.sml	Mon Apr 13 13:27:55 2020 +0200
    47.2 +++ b/test/Tools/isac/OLDTESTS/root-equ.sml	Mon Apr 13 15:31:23 2020 +0200
    47.3 @@ -140,7 +140,7 @@
    47.4  " _________________ rewrite_ x+4_________________ ";
    47.5  " _________________ rewrite_ x+4_________________ ";
    47.6  val t = (Thm.term_of o the o (parse thy)) "sqrt(9+4*x)=sqrt x + sqrt(5+x)";
    47.7 -val thm = num_str @{thm square_equation_left};
    47.8 +val thm = ThmC.numerals_to_Free @{thm square_equation_left};
    47.9  val (t,asm) = the (rewrite_ thy tless_true tval_rls true thm t);
   47.10  val rls = Test_simplify;
   47.11  val (t,_) = the (rewrite_set_ thy false rls t);
   47.12 @@ -184,7 +184,7 @@
   47.13  
   47.14  28.8.02: ruleset besser zusammenstellen !!!
   47.15  *)
   47.16 -val thm = num_str @{thm square_equation_left};
   47.17 +val thm = ThmC.numerals_to_Free @{thm square_equation_left};
   47.18  val (t,asm') = the (rewrite_ thy tless_true tval_rls true thm t);
   47.19  val asm = asm union asm';
   47.20  val rls = Test_simplify;
   47.21 @@ -206,7 +206,7 @@
   47.22  " _________________ rewrite x=4_________________ ";
   47.23  " _________________ rewrite x=4_________________ ";
   47.24  (*
   47.25 -rewrite thy' "tless_true" "tval_rls" true (num_str @{thm rbinom_power_2}) ct;
   47.26 +rewrite thy' "tless_true" "tval_rls" true (ThmC.numerals_to_Free @{thm rbinom_power_2}) ct;
   47.27  atomty ((#prop o Thm.rep_thm) (!tthm));
   47.28  atomty (Thm.term_of (!tct));
   47.29  *)
    48.1 --- a/test/Tools/isac/ProgLang/auto_prog.sml	Mon Apr 13 13:27:55 2020 +0200
    48.2 +++ b/test/Tools/isac/ProgLang/auto_prog.sml	Mon Apr 13 15:31:23 2020 +0200
    48.3 @@ -242,7 +242,7 @@
    48.4  "-------- fun rule2stac, fun rule2stac_inst ----------------------------------------------------";
    48.5  "-------- fun rule2stac, fun rule2stac_inst ----------------------------------------------------";
    48.6  "-------- fun rule2stac, fun rule2stac_inst ----------------------------------------------------";
    48.7 -val t = rule2stac @{theory} (Thm ("real_diff_minus", num_str @{thm real_diff_minus}));
    48.8 +val t = rule2stac @{theory} (Thm ("real_diff_minus", ThmC.numerals_to_Free @{thm real_diff_minus}));
    48.9  if UnparseC.term t = "Try (Repeat (Rewrite ''real_diff_minus''))" then ()
   48.10  else error "rule2stac Thm.. changed";
   48.11  
   48.12 @@ -254,7 +254,7 @@
   48.13  if UnparseC.term t = "Try (Rewrite_Set ''rearrange_assoc'')" then ()
   48.14  else error "rule2stac Rls_.. changed";
   48.15  
   48.16 -val t = rule2stac_inst @{theory} (Thm ("risolate_bdv_add", num_str @{thm risolate_bdv_add}));
   48.17 +val t = rule2stac_inst @{theory} (Thm ("risolate_bdv_add", ThmC.numerals_to_Free @{thm risolate_bdv_add}));
   48.18  if UnparseC.term t = "Try (Repeat (Rewrite_Inst [(''bdv'', v)] ''risolate_bdv_add''))" then ()
   48.19  else error "rule2stac_inst Thm.. changed";
   48.20  case t of
    49.1 --- a/test/Tools/isac/ProgLang/listC.sml	Mon Apr 13 13:27:55 2020 +0200
    49.2 +++ b/test/Tools/isac/ProgLang/listC.sml	Mon Apr 13 15:31:23 2020 +0200
    49.3 @@ -43,9 +43,9 @@
    49.4  
    49.5  val t = str2term "NTH 1 [a,b,c,d,e]";
    49.6  atomty t;
    49.7 -val thm = (#prop o Thm.rep_thm o num_str) @{thm NTH_NIL};
    49.8 +val thm = (#prop o Thm.rep_thm o ThmC.numerals_to_Free) @{thm NTH_NIL};
    49.9  atomty thm;
   49.10 -val SOME (t', _) = rewrite_ thy dummy_ord prog_expr false (num_str @{thm NTH_NIL}) t;
   49.11 +val SOME (t', _) = rewrite_ thy dummy_ord prog_expr false (ThmC.numerals_to_Free @{thm NTH_NIL}) t;
   49.12  if UnparseC.term t' = "a" then () 
   49.13  else error "NTH 1 [a,b,c,d,e] = a ..changed";
   49.14  
   49.15 @@ -54,9 +54,9 @@
   49.16    (Const ("List.list.Cons", _) $ Free ("b", _) $ 
   49.17      (Const _ $ Free _ $ (Const _ $ Free _ $ (Const _ $ Free _ $ Const _))))) = t;
   49.18  atomty t;
   49.19 -val thm = (#prop o Thm.rep_thm o num_str) @{thm NTH_CONS};
   49.20 +val thm = (#prop o Thm.rep_thm o ThmC.numerals_to_Free) @{thm NTH_CONS};
   49.21  atomty thm;
   49.22 -val SOME (t', _) = rewrite_ thy dummy_ord prog_expr false (num_str @{thm NTH_CONS}) t;
   49.23 +val SOME (t', _) = rewrite_ thy dummy_ord prog_expr false (ThmC.numerals_to_Free @{thm NTH_CONS}) t;
   49.24  if UnparseC.term t' = "NTH (3 + -1) [b, c, d, e]" then () 
   49.25  else error "NTH 3 [a,b,c,d,e] = NTH (3 + - 1) [b, c, d, e] ..changed";
   49.26