complete replacement of Rule.Thm/Eval by \<^rule_thm> and \<^rule_eval> in src/*
authorwneuper <walther.neuper@jku.at>
Tue, 10 Aug 2021 09:43:07 +0200
changeset 603588377b6c37640
parent 60357 600952fb4724
child 60359 03dea0a179d0
complete replacement of Rule.Thm/Eval by \<^rule_thm> and \<^rule_eval> in src/*
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/Equation.thy
src/Tools/isac/Knowledge/Integrate.thy
src/Tools/isac/Knowledge/Inverse_Z_Transform.thy
src/Tools/isac/Knowledge/Isac_Knowledge.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/RootRatEq.thy
src/Tools/isac/Knowledge/Test.thy
     1.1 --- a/src/Tools/isac/Knowledge/Base_Tools.thy	Mon Aug 09 14:20:20 2021 +0200
     1.2 +++ b/src/Tools/isac/Knowledge/Base_Tools.thy	Tue Aug 10 09:43:07 2021 +0200
     1.3 @@ -62,86 +62,80 @@
     1.4  subsection \<open>rule-sets\<close>
     1.5  ML \<open>
     1.6  \<close> ML \<open>
     1.7 -val Atools_erls = Rule_Set.append_rules "Atools_erls" Rule_Set.empty
     1.8 -  [ \<^rule_eval>\<open>HOL.eq\<close> (Prog_Expr.eval_equal "#equal_"),
     1.9 -    \<^rule_thm>\<open>not_true\<close>,
    1.10 -		(*"(~ True) = False"*)
    1.11 -		\<^rule_thm>\<open>not_false\<close>,
    1.12 -		(*"(~ False) = True"*)
    1.13 -		\<^rule_thm>\<open>and_true\<close>,
    1.14 -		(*"(?a & True) = ?a"*)
    1.15 -		\<^rule_thm>\<open>and_false\<close>,
    1.16 -		(*"(?a & False) = False"*)
    1.17 -		\<^rule_thm>\<open>or_true\<close>,
    1.18 -		(*"(?a | True) = True"*)
    1.19 -		\<^rule_thm>\<open>or_false\<close>,
    1.20 -		(*"(?a | False) = ?a"*)
    1.21 -               
    1.22 -		\<^rule_thm>\<open>rat_leq1\<close>,
    1.23 -		\<^rule_thm>\<open>rat_leq2\<close>,
    1.24 -		\<^rule_thm>\<open>rat_leq3\<close>,
    1.25 -    \<^rule_thm>\<open>refl\<close>,
    1.26 -		\<^rule_thm>\<open>order_refl\<close>,
    1.27 -		\<^rule_thm>\<open>radd_left_cancel_le\<close>,
    1.28 -		
    1.29 -		\<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"),
    1.30 -		\<^rule_eval>\<open>less_eq\<close> (Prog_Expr.eval_equ "#less_equal_"),
    1.31 -		
    1.32 -		\<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
    1.33 -		\<^rule_eval>\<open>Prog_Expr.is_const\<close> (Prog_Expr.eval_const "#is_const_"),
    1.34 -		\<^rule_eval>\<open>Prog_Expr.occurs_in\<close> (Prog_Expr.eval_occurs_in ""),
    1.35 -		\<^rule_eval>\<open>Prog_Expr.matches\<close> (Prog_Expr.eval_matches "")];
    1.36 +val Atools_erls = Rule_Set.append_rules "Atools_erls" Rule_Set.empty [
    1.37 +  \<^rule_eval>\<open>HOL.eq\<close> (Prog_Expr.eval_equal "#equal_"),
    1.38 +  \<^rule_thm>\<open>not_true\<close>, (*"(~ True) = False"*)
    1.39 +	\<^rule_thm>\<open>not_false\<close>, (*"(~ False) = True"*)
    1.40 +	\<^rule_thm>\<open>and_true\<close>, (*"(?a & True) = ?a"*)
    1.41 +	\<^rule_thm>\<open>and_false\<close>, (*"(?a & False) = False"*)
    1.42 +	\<^rule_thm>\<open>or_true\<close>, (*"(?a | True) = True"*)
    1.43 +	\<^rule_thm>\<open>or_false\<close>, (*"(?a | False) = ?a"*)
    1.44 +             
    1.45 +	\<^rule_thm>\<open>rat_leq1\<close>,
    1.46 +	\<^rule_thm>\<open>rat_leq2\<close>,
    1.47 +	\<^rule_thm>\<open>rat_leq3\<close>,
    1.48 +  \<^rule_thm>\<open>refl\<close>,
    1.49 +	\<^rule_thm>\<open>order_refl\<close>,
    1.50 +	\<^rule_thm>\<open>radd_left_cancel_le\<close>,
    1.51 +	
    1.52 +	\<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"),
    1.53 +	\<^rule_eval>\<open>less_eq\<close> (Prog_Expr.eval_equ "#less_equal_"),
    1.54 +	
    1.55 +	\<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
    1.56 +	\<^rule_eval>\<open>Prog_Expr.is_const\<close> (Prog_Expr.eval_const "#is_const_"),
    1.57 +	\<^rule_eval>\<open>Prog_Expr.occurs_in\<close> (Prog_Expr.eval_occurs_in ""),
    1.58 +	\<^rule_eval>\<open>Prog_Expr.matches\<close> (Prog_Expr.eval_matches "")];
    1.59  \<close>
    1.60  
    1.61  ML \<open>
    1.62 -val Atools_crls = Rule_Set.append_rules "Atools_crls" Rule_Set.empty
    1.63 -  [ \<^rule_eval>\<open>HOL.eq\<close> (Prog_Expr.eval_equal "#equal_"),
    1.64 -    \<^rule_thm>\<open>not_true\<close>,
    1.65 -		\<^rule_thm>\<open>not_false\<close>,
    1.66 -		\<^rule_thm>\<open>and_true\<close>,
    1.67 -		\<^rule_thm>\<open>and_false\<close>,
    1.68 -		\<^rule_thm>\<open>or_true\<close>,
    1.69 -		\<^rule_thm>\<open>or_false\<close>,
    1.70 -
    1.71 -		\<^rule_thm>\<open>rat_leq1\<close>,
    1.72 -		\<^rule_thm>\<open>rat_leq2\<close>,
    1.73 -		\<^rule_thm>\<open>rat_leq3\<close>,
    1.74 -		\<^rule_thm>\<open>refl\<close>,
    1.75 -		\<^rule_thm>\<open>order_refl\<close>,
    1.76 -		\<^rule_thm>\<open>radd_left_cancel_le\<close>,
    1.77 -		
    1.78 -		\<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"),
    1.79 -		\<^rule_eval>\<open>less_eq\<close> (Prog_Expr.eval_equ "#less_equal_"),
    1.80 -		
    1.81 -		\<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
    1.82 -		\<^rule_eval>\<open>Prog_Expr.is_const\<close> (Prog_Expr.eval_const "#is_const_"),
    1.83 -		\<^rule_eval>\<open>Prog_Expr.occurs_in\<close> (Prog_Expr.eval_occurs_in ""),
    1.84 -		\<^rule_eval>\<open>Prog_Expr.matches\<close> (Prog_Expr.eval_matches "")];
    1.85 +val Atools_crls = Rule_Set.append_rules "Atools_crls" Rule_Set.empty [
    1.86 +  \<^rule_eval>\<open>HOL.eq\<close> (Prog_Expr.eval_equal "#equal_"),
    1.87 +  \<^rule_thm>\<open>not_true\<close>,
    1.88 + 	\<^rule_thm>\<open>not_false\<close>,
    1.89 + 	\<^rule_thm>\<open>and_true\<close>,
    1.90 + 	\<^rule_thm>\<open>and_false\<close>,
    1.91 + 	\<^rule_thm>\<open>or_true\<close>,
    1.92 + 	\<^rule_thm>\<open>or_false\<close>,
    1.93 + 
    1.94 + 	\<^rule_thm>\<open>rat_leq1\<close>,
    1.95 + 	\<^rule_thm>\<open>rat_leq2\<close>,
    1.96 + 	\<^rule_thm>\<open>rat_leq3\<close>,
    1.97 + 	\<^rule_thm>\<open>refl\<close>,
    1.98 + 	\<^rule_thm>\<open>order_refl\<close>,
    1.99 + 	\<^rule_thm>\<open>radd_left_cancel_le\<close>,
   1.100 + 	
   1.101 + 	\<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"),
   1.102 + 	\<^rule_eval>\<open>less_eq\<close> (Prog_Expr.eval_equ "#less_equal_"),
   1.103 + 	
   1.104 + 	\<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
   1.105 + 	\<^rule_eval>\<open>Prog_Expr.is_const\<close> (Prog_Expr.eval_const "#is_const_"),
   1.106 + 	\<^rule_eval>\<open>Prog_Expr.occurs_in\<close> (Prog_Expr.eval_occurs_in ""),
   1.107 + 	\<^rule_eval>\<open>Prog_Expr.matches\<close> (Prog_Expr.eval_matches "")];
   1.108  \<close>
   1.109  
   1.110  subsection \<open>ONCE AGAIN extend rule-set for evaluating pre-conditions and program-expressions\<close>
   1.111  text \<open>requires "eval_binop" from above\<close>
   1.112  ML \<open>
   1.113 -val prog_expr = Rule_Set.append_rules "prog_expr" prog_expr
   1.114 -	[ \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
   1.115 -		\<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"), 
   1.116 -		\<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"),
   1.117 -		\<^rule_eval>\<open>less_eq\<close> (Prog_Expr.eval_equ "#less_equal_"),
   1.118 -		\<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
   1.119 -		\<^rule_eval>\<open>HOL.eq\<close> (Prog_Expr.eval_equal "#equal_"),(*atom <> atom -> False*)
   1.120 -       
   1.121 -		\<^rule_eval>\<open>Prog_Expr.Vars\<close> (Prog_Expr.eval_var "#Vars_"),
   1.122 -		
   1.123 -		\<^rule_thm>\<open>if_True\<close>,
   1.124 -		\<^rule_thm>\<open>if_False\<close>];
   1.125 +val prog_expr = Rule_Set.append_rules "prog_expr" prog_expr [
   1.126 +  \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
   1.127 +	\<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"), 
   1.128 +	\<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"),
   1.129 +	\<^rule_eval>\<open>less_eq\<close> (Prog_Expr.eval_equ "#less_equal_"),
   1.130 +	\<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
   1.131 +	\<^rule_eval>\<open>HOL.eq\<close> (Prog_Expr.eval_equal "#equal_"),(*atom <> atom -> False*)
   1.132 +     
   1.133 +	\<^rule_eval>\<open>Prog_Expr.Vars\<close> (Prog_Expr.eval_var "#Vars_"),
   1.134 +	
   1.135 +	\<^rule_thm>\<open>if_True\<close>,
   1.136 +	\<^rule_thm>\<open>if_False\<close>];
   1.137  
   1.138  val prog_expr = Auto_Prog.prep_rls @{theory} (Rule_Set.merge "list_erls"
   1.139  	(Rule_Def.Repeat {id = "replaced", preconds = [], rew_ord = ("termlessI", termlessI),
   1.140      erls = Rule_Def.Repeat {id = "list_elrs", preconds = [], rew_ord = ("termlessI", termlessI), 
   1.141      erls = Rule_Set.empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
   1.142 -    rules = [\<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
   1.143 -      \<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_")
   1.144 -      (*    ~~~~~~ for nth_Cons_*)],
   1.145 +    rules = [
   1.146 +      \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
   1.147 +      \<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_") (*..for nth_Cons_*)],
   1.148      scr = Rule.Empty_Prog},
   1.149      srls = Rule_Set.Empty, calc = [], errpatts = [],
   1.150      rules = [], scr = Rule.Empty_Prog})
     2.1 --- a/src/Tools/isac/Knowledge/Biegelinie.thy	Mon Aug 09 14:20:20 2021 +0200
     2.2 +++ b/src/Tools/isac/Knowledge/Biegelinie.thy	Tue Aug 10 09:43:07 2021 +0200
     2.3 @@ -151,50 +151,45 @@
     2.4  ML \<open>
     2.5  (** methods **)
     2.6  
     2.7 -val srls = Rule_Def.Repeat {id="srls_IntegrierenUnd..", 
     2.8 -		preconds = [], 
     2.9 -		rew_ord = ("termlessI",termlessI), 
    2.10 -		erls = Rule_Set.append_rules "erls_in_srls_IntegrierenUnd.." Rule_Set.empty
    2.11 -				  [(*for asm in NTH_CONS ...*)
    2.12 -				   \<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"),
    2.13 -				   (*2nd NTH_CONS pushes n+-1 into asms*)
    2.14 -				   \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_")
    2.15 -				   ], 
    2.16 -		srls = Rule_Set.Empty, calc = [], errpatts = [],
    2.17 -		rules = [\<^rule_thm>\<open>NTH_CONS\<close>,
    2.18 -			 \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
    2.19 -			 \<^rule_thm>\<open>NTH_NIL\<close>,
    2.20 -			 \<^rule_eval>\<open>Prog_Expr.lhs\<close> (Prog_Expr.eval_lhs"eval_lhs_"),
    2.21 -			 \<^rule_eval>\<open>Prog_Expr.rhs\<close> (Prog_Expr.eval_rhs"eval_rhs_"),
    2.22 -			 \<^rule_eval>\<open>Prog_Expr.argument_in\<close> (Prog_Expr.eval_argument_in "Prog_Expr.argument_in")
    2.23 -			 ],
    2.24 -		scr = Rule.Empty_Prog};
    2.25 +val srls = Rule_Def.Repeat {
    2.26 +  id="srls_IntegrierenUnd..", preconds = [], rew_ord = ("termlessI",termlessI), 
    2.27 +	erls = Rule_Set.append_rules "erls_in_srls_IntegrierenUnd.." Rule_Set.empty [
    2.28 +    (*for asm in NTH_CONS ...*)
    2.29 +	  \<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"),
    2.30 +	  (*2nd NTH_CONS pushes n+-1 into asms*)
    2.31 +	  \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_")], 
    2.32 +	srls = Rule_Set.Empty, calc = [], errpatts = [],
    2.33 +	rules = [
    2.34 +     \<^rule_thm>\<open>NTH_CONS\<close>,
    2.35 +		 \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
    2.36 +		 \<^rule_thm>\<open>NTH_NIL\<close>,
    2.37 +		 \<^rule_eval>\<open>Prog_Expr.lhs\<close> (Prog_Expr.eval_lhs"eval_lhs_"),
    2.38 +		 \<^rule_eval>\<open>Prog_Expr.rhs\<close> (Prog_Expr.eval_rhs"eval_rhs_"),
    2.39 +		 \<^rule_eval>\<open>Prog_Expr.argument_in\<close> (Prog_Expr.eval_argument_in "Prog_Expr.argument_in")],
    2.40 +	scr = Rule.Empty_Prog};
    2.41      
    2.42 -val srls2 = 
    2.43 -    Rule_Def.Repeat {id="srls_IntegrierenUnd..", 
    2.44 -	 preconds = [], 
    2.45 -	 rew_ord = ("termlessI",termlessI), 
    2.46 -	 erls = Rule_Set.append_rules "erls_in_srls_IntegrierenUnd.." Rule_Set.empty
    2.47 -			   [(*for asm in NTH_CONS ...*)
    2.48 -			    \<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"),
    2.49 -			    (*2nd NTH_CONS pushes n+-1 into asms*)
    2.50 -			    \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_")
    2.51 -			    ], 
    2.52 -	 srls = Rule_Set.Empty, calc = [], errpatts = [],
    2.53 -	 rules = [\<^rule_thm>\<open>NTH_CONS\<close>,
    2.54 -		  \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
    2.55 -		  \<^rule_thm>\<open>NTH_NIL\<close>,
    2.56 -		  \<^rule_eval>\<open>Prog_Expr.lhs\<close> (Prog_Expr.eval_lhs "eval_lhs_"),
    2.57 -		  \<^rule_eval>\<open>Prog_Expr.filter_sameFunId\<close> (Prog_Expr.eval_filter_sameFunId "Prog_Expr.filter_sameFunId"),
    2.58 -		  (*WN070514 just for smltest/../biegelinie.sml ...*)
    2.59 -		  \<^rule_eval>\<open>Prog_Expr.sameFunId\<close> (Prog_Expr.eval_sameFunId "Prog_Expr.sameFunId"),
    2.60 -		  \<^rule_thm>\<open>filter_Cons\<close>,
    2.61 -		  \<^rule_thm>\<open>filter_Nil\<close>,
    2.62 -		  \<^rule_thm>\<open>if_True\<close>,
    2.63 -		  \<^rule_thm>\<open>if_False\<close>,
    2.64 -		  \<^rule_thm>\<open>hd_thm\<close>
    2.65 -		  ],
    2.66 -	 scr = Rule.Empty_Prog};
    2.67 +val srls2 = Rule_Def.Repeat {
    2.68 +  id="srls_IntegrierenUnd..", preconds = [], rew_ord = ("termlessI",termlessI), 
    2.69 +	erls = Rule_Set.append_rules "erls_in_srls_IntegrierenUnd.." Rule_Set.empty [
    2.70 +    (*for asm in NTH_CONS ...*)
    2.71 +		\<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"),
    2.72 +		(*2nd NTH_CONS pushes n+-1 into asms*)
    2.73 +		\<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_")], 
    2.74 +	srls = Rule_Set.Empty, calc = [], errpatts = [],
    2.75 +	rules = [
    2.76 +    \<^rule_thm>\<open>NTH_CONS\<close>,
    2.77 +	  \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
    2.78 +	  \<^rule_thm>\<open>NTH_NIL\<close>,
    2.79 +	  \<^rule_eval>\<open>Prog_Expr.lhs\<close> (Prog_Expr.eval_lhs "eval_lhs_"),
    2.80 +	  \<^rule_eval>\<open>Prog_Expr.filter_sameFunId\<close> (Prog_Expr.eval_filter_sameFunId "Prog_Expr.filter_sameFunId"),
    2.81 +	  (*WN070514 just for smltest/../biegelinie.sml ...*)
    2.82 +	  \<^rule_eval>\<open>Prog_Expr.sameFunId\<close> (Prog_Expr.eval_sameFunId "Prog_Expr.sameFunId"),
    2.83 +	  \<^rule_thm>\<open>filter_Cons\<close>,
    2.84 +	  \<^rule_thm>\<open>filter_Nil\<close>,
    2.85 +	  \<^rule_thm>\<open>if_True\<close>,
    2.86 +	  \<^rule_thm>\<open>if_False\<close>,
    2.87 +	  \<^rule_thm>\<open>hd_thm\<close>],
    2.88 +	scr = Rule.Empty_Prog};
    2.89  \<close>
    2.90  
    2.91  section \<open>Methods\<close>
    2.92 @@ -254,17 +249,17 @@
    2.93  
    2.94  method met_biege_2 : "IntegrierenUndKonstanteBestimmen2" =
    2.95    \<open>{rew_ord'="tless_true",
    2.96 -    rls' = Rule_Set.append_rules "erls_IntegrierenUndK.." Rule_Set.empty 
    2.97 -        [\<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
    2.98 -          \<^rule_thm>\<open>not_true\<close>,
    2.99 -          \<^rule_thm>\<open>not_false\<close>], 
   2.100 +    rls' = Rule_Set.append_rules "erls_IntegrierenUndK.." Rule_Set.empty [
   2.101 +      \<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
   2.102 +      \<^rule_thm>\<open>not_true\<close>,
   2.103 +      \<^rule_thm>\<open>not_false\<close>], 
   2.104      calc = [], 
   2.105 -    srls = Rule_Set.append_rules "erls_IntegrierenUndK.." Rule_Set.empty 
   2.106 -        [\<^rule_eval>\<open>Prog_Expr.rhs\<close> (Prog_Expr.eval_rhs"eval_rhs_"),
   2.107 -          \<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
   2.108 -          \<^rule_thm>\<open>last_thmI\<close>,
   2.109 -          \<^rule_thm>\<open>if_True\<close>,
   2.110 -          \<^rule_thm>\<open>if_False\<close>],
   2.111 +    srls = Rule_Set.append_rules "erls_IntegrierenUndK.." Rule_Set.empty [
   2.112 +      \<^rule_eval>\<open>Prog_Expr.rhs\<close> (Prog_Expr.eval_rhs"eval_rhs_"),
   2.113 +      \<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
   2.114 +      \<^rule_thm>\<open>last_thmI\<close>,
   2.115 +      \<^rule_thm>\<open>if_True\<close>,
   2.116 +      \<^rule_thm>\<open>if_False\<close>],
   2.117      prls = Rule_Set.Empty, crls = Atools_erls, errpats = [], nrls = Rule_Set.Empty}\<close>
   2.118    Program: biegelinie.simps
   2.119    Given: "Traegerlaenge beam" "Streckenlast load"
   2.120 @@ -319,13 +314,13 @@
   2.121  
   2.122  method met_biege_ausbelast : "Biegelinien/ausBelastung" =
   2.123    \<open>{rew_ord'="tless_true", 
   2.124 -    rls' = Rule_Set.append_rules "erls_ausBelastung" Rule_Set.empty
   2.125 -        [\<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
   2.126 -          \<^rule_thm>\<open>not_true\<close>,
   2.127 -          \<^rule_thm>\<open>not_false\<close>],
   2.128 +    rls' = Rule_Set.append_rules "erls_ausBelastung" Rule_Set.empty [
   2.129 +      \<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
   2.130 +      \<^rule_thm>\<open>not_true\<close>,
   2.131 +      \<^rule_thm>\<open>not_false\<close>],
   2.132      calc = [], 
   2.133 -    srls = Rule_Set.append_rules "srls_ausBelastung" Rule_Set.empty
   2.134 -        [\<^rule_eval>\<open>Prog_Expr.rhs\<close> (Prog_Expr.eval_rhs "eval_rhs_")],
   2.135 +    srls = Rule_Set.append_rules "srls_ausBelastung" Rule_Set.empty [
   2.136 +      \<^rule_eval>\<open>Prog_Expr.rhs\<close> (Prog_Expr.eval_rhs "eval_rhs_")],
   2.137      prls = Rule_Set.empty, crls = Atools_erls, errpats = [], nrls = Rule_Set.empty}\<close>
   2.138    Program: belastung_zu_biegelinie.simps
   2.139    Given: "Streckenlast q__q" "FunktionsVariable v_v" "Biegelinie id_fun" "AbleitungBiegelinie id_der"
   2.140 @@ -382,9 +377,9 @@
   2.141  
   2.142  method met_equ_fromfun : "Equation/fromFunction" =
   2.143    \<open>{rew_ord'="tless_true", rls'=Rule_Set.Empty, calc = [],
   2.144 -    srls = Rule_Set.append_rules "srls_in_EquationfromFunc" Rule_Set.empty
   2.145 -        [\<^rule_eval>\<open>Prog_Expr.lhs\<close> (Prog_Expr.eval_lhs "eval_lhs_"),
   2.146 -          \<^rule_eval>\<open>Prog_Expr.argument_in\<close> (Prog_Expr.eval_argument_in "Prog_Expr.argument_in")],
   2.147 +    srls = Rule_Set.append_rules "srls_in_EquationfromFunc" Rule_Set.empty [
   2.148 +      \<^rule_eval>\<open>Prog_Expr.lhs\<close> (Prog_Expr.eval_lhs "eval_lhs_"),
   2.149 +      \<^rule_eval>\<open>Prog_Expr.argument_in\<close> (Prog_Expr.eval_argument_in "Prog_Expr.argument_in")],
   2.150      prls=Rule_Set.empty, crls = Atools_erls, errpats = [], nrls = Rule_Set.empty}\<close>
   2.151    Program: function_to_equality.simps
   2.152    (*(M_b x = c_2 + c * x + -1 * q_0 / 2 * x \<up> 2) (M_b L = 0) -->
     3.1 --- a/src/Tools/isac/Knowledge/Diff.thy	Mon Aug 09 14:20:20 2021 +0200
     3.2 +++ b/src/Tools/isac/Knowledge/Diff.thy	Tue Aug 10 09:43:07 2021 +0200
     3.3 @@ -109,98 +109,79 @@
     3.4  
     3.5  (*.converts a term such that differentiation works optimally.*)
     3.6  val diff_conv =   
     3.7 -    Rule_Def.Repeat {id="diff_conv", 
     3.8 -	 preconds = [], 
     3.9 -	 rew_ord = ("termlessI",termlessI), 
    3.10 -	 erls = Rule_Set.append_rules "erls_diff_conv" Rule_Set.empty 
    3.11 -			   [\<^rule_eval>\<open>Prog_Expr.occurs_in\<close> (Prog_Expr.eval_occurs_in ""),
    3.12 -			    \<^rule_thm>\<open>not_true\<close>,
    3.13 -			    \<^rule_thm>\<open>not_false\<close>,
    3.14 -			    \<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"),
    3.15 -			    \<^rule_thm>\<open>and_true\<close>,
    3.16 -			    \<^rule_thm>\<open>and_false\<close>
    3.17 -			    ], 
    3.18 -	 srls = Rule_Set.Empty, calc = [], errpatts = [],
    3.19 -	 rules =
    3.20 -  [\<^rule_thm>\<open>frac_conv\<close>,
    3.21 -     (*"?bdv occurs_in ?b \<Longrightarrow> 0 < ?n \<Longrightarrow> ?a / ?b \<up> ?n = ?a * ?b \<up> - ?n"*)
    3.22 -		   \<^rule_thm>\<open>sqrt_conv_bdv\<close>,
    3.23 -		     (*"sqrt ?bdv = ?bdv \<up> (1 / 2)"*)
    3.24 -		   \<^rule_thm>\<open>sqrt_conv_bdv_n\<close>,
    3.25 -		     (*"sqrt (?bdv \<up> ?n) = ?bdv \<up> (?n / 2)"*)
    3.26 -		   \<^rule_thm>\<open>sqrt_conv\<close>,
    3.27 -		     (*"?bdv occurs_in ?u \<Longrightarrow> sqrt ?u = ?u \<up> (1 / 2)"*)
    3.28 -		   \<^rule_thm>\<open>root_conv\<close>,
    3.29 -		     (*"?bdv occurs_in ?u \<Longrightarrow> nroot ?n ?u = ?u \<up> (1 / ?n)"*)
    3.30 -		   \<^rule_thm>\<open>realpow_pow_bdv\<close>,
    3.31 -		     (* "(?bdv \<up> ?b) \<up> ?c = ?bdv \<up> (?b * ?c)"*)
    3.32 -		   \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
    3.33 -		   \<^rule_thm>\<open>rat_mult\<close>,
    3.34 -		     (*a / b * (c / d) = a * c / (b * d)*)
    3.35 -		   \<^rule_thm>\<open>times_divide_eq_right\<close>,
    3.36 -		     (*?x * (?y / ?z) = ?x * ?y / ?z*)
    3.37 -		   \<^rule_thm>\<open>times_divide_eq_left\<close>
    3.38 -		     (*?y / ?z * ?x = ?y * ?x / ?z*)
    3.39 -		 ],
    3.40 -	 scr = Rule.Empty_Prog};
    3.41 +  Rule_Def.Repeat {id="diff_conv", preconds = [], rew_ord = ("termlessI",termlessI), 
    3.42 +  erls = Rule_Set.append_rules "erls_diff_conv" Rule_Set.empty [
    3.43 +    \<^rule_eval>\<open>Prog_Expr.occurs_in\<close> (Prog_Expr.eval_occurs_in ""),
    3.44 +    \<^rule_thm>\<open>not_true\<close>,
    3.45 +    \<^rule_thm>\<open>not_false\<close>,
    3.46 +    \<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"),
    3.47 +    \<^rule_thm>\<open>and_true\<close>,
    3.48 +    \<^rule_thm>\<open>and_false\<close>], 
    3.49 +  srls = Rule_Set.Empty, calc = [], errpatts = [],
    3.50 +  rules = [
    3.51 +     \<^rule_thm>\<open>frac_conv\<close>, (*"?bdv occurs_in ?b \<Longrightarrow> 0 < ?n \<Longrightarrow> ?a / ?b \<up> ?n = ?a * ?b \<up> - ?n"*)
    3.52 + 	   \<^rule_thm>\<open>sqrt_conv_bdv\<close>, (*"sqrt ?bdv = ?bdv \<up> (1 / 2)"*)
    3.53 + 	   \<^rule_thm>\<open>sqrt_conv_bdv_n\<close>, (*"sqrt (?bdv \<up> ?n) = ?bdv \<up> (?n / 2)"*)
    3.54 + 	   \<^rule_thm>\<open>sqrt_conv\<close>, (*"?bdv occurs_in ?u \<Longrightarrow> sqrt ?u = ?u \<up> (1 / 2)"*)
    3.55 + 	   \<^rule_thm>\<open>root_conv\<close>, (*"?bdv occurs_in ?u \<Longrightarrow> nroot ?n ?u = ?u \<up> (1 / ?n)"*)
    3.56 + 	   \<^rule_thm>\<open>realpow_pow_bdv\<close>, (* "(?bdv \<up> ?b) \<up> ?c = ?bdv \<up> (?b * ?c)"*)
    3.57 + 	   \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
    3.58 + 	   \<^rule_thm>\<open>rat_mult\<close>, (*a / b * (c / d) = a * c / (b * d)*)
    3.59 + 	   \<^rule_thm>\<open>times_divide_eq_right\<close>, (*?x * (?y / ?z) = ?x * ?y / ?z*)
    3.60 + 	   \<^rule_thm>\<open>times_divide_eq_left\<close>], (*?y / ?z * ?x = ?y * ?x / ?z*)
    3.61 +  scr = Rule.Empty_Prog};
    3.62  \<close>
    3.63  ML \<open>
    3.64  (*.beautifies a term after differentiation.*)
    3.65  val diff_sym_conv =   
    3.66 -    Rule_Def.Repeat {id="diff_sym_conv", 
    3.67 -	 preconds = [], 
    3.68 -	 rew_ord = ("termlessI",termlessI), 
    3.69 -	 erls =
    3.70 -     Rule_Set.append_rules "erls_diff_sym_conv" Rule_Set.empty 
    3.71 -	 	  [\<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"), 
    3.72 -       \<^rule_eval>\<open>matches\<close> (Prog_Expr.eval_matches "#matches_"),
    3.73 -	     \<^rule_eval>\<open>is_atom\<close> (Prog_Expr.eval_is_atom "#is_atom_"),
    3.74 -	     \<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"),
    3.75 -	     \<^rule_thm>\<open>not_false\<close>,
    3.76 -	     \<^rule_thm>\<open>not_true\<close>], 
    3.77 -	 srls = Rule_Set.Empty, calc = [], errpatts = [],
    3.78 -	 rules = [
    3.79 -     \<^rule_thm>\<open>frac_sym_conv\<close>,
    3.80 -	   \<^rule_thm>\<open>sqrt_sym_conv\<close>,
    3.81 -	   \<^rule_thm>\<open>root_sym_conv\<close>,
    3.82 -     \<^rule_thm>\<open>real_mult_minus1_sym\<close> (*"\<not>(z is_const) ==> - (z::real) = -1 * z"*),
    3.83 -	   \<^rule_thm>\<open>rat_mult\<close> (*a / b * (c / d) = a * c / (b * d)*),
    3.84 -	   \<^rule_thm>\<open>times_divide_eq_right\<close> (*?x * (?y / ?z) = ?x * ?y / ?z*),
    3.85 -	   \<^rule_thm>\<open>times_divide_eq_left\<close> (*?y / ?z * ?x = ?y * ?x / ?z*),
    3.86 -	   \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_")],
    3.87 -	 scr = Rule.Empty_Prog};
    3.88 +  Rule_Def.Repeat {id="diff_sym_conv", preconds = [], rew_ord = ("termlessI",termlessI), 
    3.89 +  erls = Rule_Set.append_rules "erls_diff_sym_conv" Rule_Set.empty [
    3.90 +    \<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"), 
    3.91 +    \<^rule_eval>\<open>matches\<close> (Prog_Expr.eval_matches "#matches_"),
    3.92 +    \<^rule_eval>\<open>is_atom\<close> (Prog_Expr.eval_is_atom "#is_atom_"),
    3.93 +    \<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"),
    3.94 +    \<^rule_thm>\<open>not_false\<close>,
    3.95 +    \<^rule_thm>\<open>not_true\<close>], 
    3.96 +  srls = Rule_Set.Empty, calc = [], errpatts = [],
    3.97 +  rules = [
    3.98 +    \<^rule_thm>\<open>frac_sym_conv\<close>,
    3.99 +    \<^rule_thm>\<open>sqrt_sym_conv\<close>,
   3.100 +    \<^rule_thm>\<open>root_sym_conv\<close>,
   3.101 +    \<^rule_thm>\<open>real_mult_minus1_sym\<close> (*"\<not>(z is_const) ==> - (z::real) = -1 * z"*),
   3.102 +    \<^rule_thm>\<open>rat_mult\<close> (*a / b * (c / d) = a * c / (b * d)*),
   3.103 +    \<^rule_thm>\<open>times_divide_eq_right\<close> (*?x * (?y / ?z) = ?x * ?y / ?z*),
   3.104 +    \<^rule_thm>\<open>times_divide_eq_left\<close> (*?y / ?z * ?x = ?y * ?x / ?z*),
   3.105 +    \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_")],
   3.106 +  scr = Rule.Empty_Prog};
   3.107  
   3.108  (*..*)
   3.109  val srls_diff = 
   3.110 -    Rule_Def.Repeat {id="srls_differentiate..", 
   3.111 -	 preconds = [], 
   3.112 -	 rew_ord = ("termlessI",termlessI), 
   3.113 -	 erls = Rule_Set.empty, 
   3.114 -	 srls = Rule_Set.Empty, calc = [], errpatts = [],
   3.115 -	 rules = [\<^rule_eval>\<open>Prog_Expr.lhs\<close> (Prog_Expr.eval_lhs "eval_lhs_"),
   3.116 -		  \<^rule_eval>\<open>Prog_Expr.rhs\<close> (Prog_Expr.eval_rhs "eval_rhs_"),
   3.117 -		  \<^rule_eval>\<open>Diff.primed\<close> (eval_primed "Diff.primed")
   3.118 -		  ],
   3.119 -	 scr = Rule.Empty_Prog};
   3.120 +  Rule_Def.Repeat {id="srls_differentiate..", preconds = [], rew_ord = ("termlessI",termlessI), 
   3.121 +  erls = Rule_Set.empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
   3.122 +  rules = [
   3.123 +    \<^rule_eval>\<open>Prog_Expr.lhs\<close> (Prog_Expr.eval_lhs "eval_lhs_"),
   3.124 +    \<^rule_eval>\<open>Prog_Expr.rhs\<close> (Prog_Expr.eval_rhs "eval_rhs_"),
   3.125 +    \<^rule_eval>\<open>Diff.primed\<close> (eval_primed "Diff.primed")],
   3.126 +  scr = Rule.Empty_Prog};
   3.127  \<close>
   3.128  ML \<open>
   3.129  (*..*)
   3.130  val erls_diff = 
   3.131 -    Rule_Set.append_rules "erls_differentiate.." Rule_Set.empty
   3.132 -               [\<^rule_thm>\<open>not_true\<close>,
   3.133 +  Rule_Set.append_rules "erls_differentiate.." Rule_Set.empty [
   3.134 +    \<^rule_thm>\<open>not_true\<close>,
   3.135  		\<^rule_thm>\<open>not_false\<close>,
   3.136  		
   3.137  		\<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
   3.138  		\<^rule_eval>\<open>Prog_Expr.is_atom\<close> (Prog_Expr.eval_is_atom "#is_atom_"),
   3.139  		\<^rule_eval>\<open>Prog_Expr.occurs_in\<close> (Prog_Expr.eval_occurs_in ""),
   3.140 -		\<^rule_eval>\<open>Prog_Expr.is_const\<close> (Prog_Expr.eval_const "#is_const_")
   3.141 -		];
   3.142 +		\<^rule_eval>\<open>Prog_Expr.is_const\<close> (Prog_Expr.eval_const "#is_const_")];
   3.143  
   3.144  (*.rules for differentiation, _no_ simplification.*)
   3.145  val diff_rules =
   3.146 -    Rule_Def.Repeat {id="diff_rules", preconds = [], rew_ord = ("termlessI",termlessI), 
   3.147 +   Rule_Def.Repeat {id="diff_rules", preconds = [], rew_ord = ("termlessI",termlessI), 
   3.148  	 erls = erls_diff, srls = Rule_Set.Empty, calc = [], errpatts = [],
   3.149 -	 rules = [\<^rule_thm>\<open>diff_sum\<close>,
   3.150 +	 rules = [
   3.151 +      \<^rule_thm>\<open>diff_sum\<close>,
   3.152  		  \<^rule_thm>\<open>diff_dif\<close>,
   3.153  		  \<^rule_thm>\<open>diff_prod_const\<close>,
   3.154  		  \<^rule_thm>\<open>diff_prod\<close>,
   3.155 @@ -215,13 +196,12 @@
   3.156  		  \<^rule_thm>\<open>diff_ln_chain\<close>,
   3.157  		  \<^rule_thm>\<open>diff_exp\<close>,
   3.158  		  \<^rule_thm>\<open>diff_exp_chain\<close>,
   3.159 -(*
   3.160 +      (*
   3.161  		  \<^rule_thm>\<open>diff_sqrt\<close>,
   3.162  		  \<^rule_thm>\<open>diff_sqrt_chain\<close>,
   3.163 -*)
   3.164 +      *)
   3.165  		  \<^rule_thm>\<open>diff_const\<close>,
   3.166 -		  \<^rule_thm>\<open>diff_var\<close>
   3.167 -		  ],
   3.168 +		  \<^rule_thm>\<open>diff_var\<close>],
   3.169  	 scr = Rule.Empty_Prog};
   3.170  \<close>
   3.171  ML \<open>
     4.1 --- a/src/Tools/isac/Knowledge/DiffApp.thy	Mon Aug 09 14:20:20 2021 +0200
     4.2 +++ b/src/Tools/isac/Knowledge/DiffApp.thy	Tue Aug 10 09:43:07 2021 +0200
     4.3 @@ -35,7 +35,8 @@
     4.4  val eval_rls = prep_rls' (
     4.5    Rule_Def.Repeat {id = "eval_rls", preconds = [], rew_ord = ("termlessI", termlessI), 
     4.6      erls = Rule_Set.empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
     4.7 -    rules = [\<^rule_thm>\<open>refl\<close>,
     4.8 +    rules = [
     4.9 +      \<^rule_thm>\<open>refl\<close>,
    4.10        \<^rule_thm>\<open>order_refl\<close>,
    4.11        \<^rule_thm>\<open>radd_left_cancel_le\<close>,
    4.12        \<^rule_thm>\<open>not_true\<close>,
    4.13 @@ -183,8 +184,8 @@
    4.14      errpats = [], nrls = norm_Rational(*, asm_rls = [], asm_thm = []*)}\<close>
    4.15  
    4.16  ML \<open>
    4.17 -val prog_expr = Rule_Set.append_rules "prog_expr" prog_expr
    4.18 -  [\<^rule_thm>\<open>filterVar_Const\<close>,
    4.19 +val prog_expr = Rule_Set.append_rules "prog_expr" prog_expr [
    4.20 +   \<^rule_thm>\<open>filterVar_Const\<close>,
    4.21     \<^rule_thm>\<open>filterVar_Nil\<close>];
    4.22  \<close>
    4.23  rule_set_knowledge prog_expr = \<open>prog_expr\<close>
     5.1 --- a/src/Tools/isac/Knowledge/EqSystem.thy	Mon Aug 09 14:20:20 2021 +0200
     5.2 +++ b/src/Tools/isac/Knowledge/EqSystem.thy	Tue Aug 10 09:43:07 2021 +0200
     5.3 @@ -169,24 +169,18 @@
     5.4  
     5.5  (*.adapted from 'order_add_mult_in' by just replacing the rew_ord.*)
     5.6  val order_add_mult_System = 
     5.7 -  Rule_Def.Repeat{id = "order_add_mult_System", preconds = [], 
     5.8 -      rew_ord = ("ord_simplify_System",
     5.9 -		 ord_simplify_System false @{theory "Integrate"}),
    5.10 -      erls = Rule_Set.empty,srls = Rule_Set.Empty, calc = [], errpatts = [],
    5.11 -      rules = [\<^rule_thm>\<open>mult.commute\<close>,
    5.12 -	       (* z * w = w * z *)
    5.13 -	       \<^rule_thm>\<open>real_mult_left_commute\<close>,
    5.14 -	       (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*)
    5.15 -	       \<^rule_thm>\<open>mult.assoc\<close>,		
    5.16 -	       (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*)
    5.17 -	       \<^rule_thm>\<open>add.commute\<close>,	
    5.18 -	       (*z + w = w + z*)
    5.19 -	       \<^rule_thm>\<open>add.left_commute\<close>,
    5.20 -	       (*x + (y + z) = y + (x + z)*)
    5.21 -	       \<^rule_thm>\<open>add.assoc\<close>	               
    5.22 -	       (*z1.0 + z2.0 + z3.0 = z1.0 + (z2.0 + z3.0)*)
    5.23 -	       ], 
    5.24 -      scr = Rule.Empty_Prog};
    5.25 +  Rule_Def.Repeat{
    5.26 +    id = "order_add_mult_System", preconds = [], 
    5.27 +    rew_ord = ("ord_simplify_System", ord_simplify_System false @{theory "Integrate"}),
    5.28 +    erls = Rule_Set.empty,srls = Rule_Set.Empty, calc = [], errpatts = [],
    5.29 +    rules = [
    5.30 +      \<^rule_thm>\<open>mult.commute\<close>, (* z * w = w * z *)
    5.31 +      \<^rule_thm>\<open>real_mult_left_commute\<close>, (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*)
    5.32 +      \<^rule_thm>\<open>mult.assoc\<close>,	 (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*)
    5.33 +      \<^rule_thm>\<open>add.commute\<close>, (*z + w = w + z*)
    5.34 +      \<^rule_thm>\<open>add.left_commute\<close>, (*x + (y + z) = y + (x + z)*)
    5.35 +      \<^rule_thm>\<open>add.assoc\<close>	],  (*z1.0 + z2.0 + z3.0 = z1.0 + (z2.0 + z3.0)*)
    5.36 +    scr = Rule.Empty_Prog};
    5.37  \<close>
    5.38  ML \<open>
    5.39  (*.adapted from 'norm_Rational' by
    5.40 @@ -194,42 +188,38 @@
    5.41    #2 NOT using common_nominator_p                          .*)
    5.42  val norm_System_noadd_fractions = 
    5.43    Rule_Def.Repeat {id = "norm_System_noadd_fractions", preconds = [], 
    5.44 -       rew_ord = ("dummy_ord",Rewrite_Ord.dummy_ord), 
    5.45 -       erls = norm_rat_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
    5.46 -       rules = [(*sequence given by operator precedence*)
    5.47 -		Rule.Rls_ discard_minus,
    5.48 -		Rule.Rls_ powers,
    5.49 -		Rule.Rls_ rat_mult_divide,
    5.50 -		Rule.Rls_ expand,
    5.51 -		Rule.Rls_ reduce_0_1_2,
    5.52 -		Rule.Rls_ (*order_add_mult #1*) order_add_mult_System,
    5.53 -		Rule.Rls_ collect_numerals,
    5.54 -		(*Rule.Rls_ add_fractions_p, #2*)
    5.55 -		Rule.Rls_ cancel_p
    5.56 -		],
    5.57 -       scr = Rule.Empty_Prog
    5.58 -       };
    5.59 +    rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), 
    5.60 +    erls = norm_rat_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
    5.61 +    rules = [(*sequence given by operator precedence*)
    5.62 +  		Rule.Rls_ discard_minus,
    5.63 +  		Rule.Rls_ powers,
    5.64 +  		Rule.Rls_ rat_mult_divide,
    5.65 +  		Rule.Rls_ expand,
    5.66 +  		Rule.Rls_ reduce_0_1_2,
    5.67 +  		Rule.Rls_ (*order_add_mult #1*) order_add_mult_System,
    5.68 +  		Rule.Rls_ collect_numerals,
    5.69 +  		(*Rule.Rls_ add_fractions_p, #2*)
    5.70 +  		Rule.Rls_ cancel_p],
    5.71 +    scr = Rule.Empty_Prog};
    5.72  \<close>
    5.73  ML \<open>
    5.74  (*.adapted from 'norm_Rational' by
    5.75    *1* using 'ord_simplify_System' in 'order_add_mult_System'.*)
    5.76  val norm_System = 
    5.77    Rule_Def.Repeat {id = "norm_System", preconds = [], 
    5.78 -       rew_ord = ("dummy_ord",Rewrite_Ord.dummy_ord), 
    5.79 -       erls = norm_rat_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
    5.80 -       rules = [(*sequence given by operator precedence*)
    5.81 -		Rule.Rls_ discard_minus,
    5.82 -		Rule.Rls_ powers,
    5.83 -		Rule.Rls_ rat_mult_divide,
    5.84 -		Rule.Rls_ expand,
    5.85 -		Rule.Rls_ reduce_0_1_2,
    5.86 -		Rule.Rls_ (*order_add_mult *1*) order_add_mult_System,
    5.87 -		Rule.Rls_ collect_numerals,
    5.88 -		Rule.Rls_ add_fractions_p,
    5.89 -		Rule.Rls_ cancel_p
    5.90 -		],
    5.91 -       scr = Rule.Empty_Prog
    5.92 -       };
    5.93 +    rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), 
    5.94 +    erls = norm_rat_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
    5.95 +    rules = [(*sequence given by operator precedence*)
    5.96 +  		Rule.Rls_ discard_minus,
    5.97 +  		Rule.Rls_ powers,
    5.98 +  		Rule.Rls_ rat_mult_divide,
    5.99 +  		Rule.Rls_ expand,
   5.100 +  		Rule.Rls_ reduce_0_1_2,
   5.101 +  		Rule.Rls_ (*order_add_mult *1*) order_add_mult_System,
   5.102 +  		Rule.Rls_ collect_numerals,
   5.103 +  		Rule.Rls_ add_fractions_p,
   5.104 +  		Rule.Rls_ cancel_p],
   5.105 +    scr = Rule.Empty_Prog};
   5.106  \<close>
   5.107  ML \<open>
   5.108  (*.simplify an equational system BEFORE solving it such that parentheses are
   5.109 @@ -243,22 +233,18 @@
   5.110     analoguous to simplify_Integral                                       .*)
   5.111  val simplify_System_parenthesized = 
   5.112    Rule_Set.Sequence {id = "simplify_System_parenthesized", preconds = []:term list, 
   5.113 -       rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
   5.114 -      erls = Atools_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
   5.115 -      rules = [\<^rule_thm>\<open>distrib_right\<close>,
   5.116 - 	       (*"(?z1.0 + ?z2.0) * ?w = ?z1.0 * ?w + ?z2.0 * ?w"*)
   5.117 -	       \<^rule_thm>\<open>add_divide_distrib\<close>,
   5.118 - 	       (*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"*)
   5.119 -	       (*^^^^^ *0* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*)
   5.120 -	       Rule.Rls_ norm_Rational_noadd_fractions(**2**),
   5.121 -	       Rule.Rls_ (*order_add_mult_in*) norm_System_noadd_fractions (**1**),
   5.122 -	       \<^rule_thm_sym>\<open>mult.assoc\<close>
   5.123 -	       (*Rule.Rls_ discard_parentheses *3**),
   5.124 -	       Rule.Rls_ collect_bdv, (*from make_polynomial_in WN051031 welldone?*)
   5.125 -	       Rule.Rls_ separate_bdv2,
   5.126 -	       \<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e")
   5.127 -	       ],
   5.128 -      scr = Rule.Empty_Prog};      
   5.129 +    rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
   5.130 +    erls = Atools_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
   5.131 +    rules = [
   5.132 +       \<^rule_thm>\<open>distrib_right\<close>, (*"(?z1.0 + ?z2.0) * ?w = ?z1.0 * ?w + ?z2.0 * ?w"*)
   5.133 +	     \<^rule_thm>\<open>add_divide_distrib\<close>, (*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"*)
   5.134 +	     Rule.Rls_ norm_Rational_noadd_fractions,
   5.135 +	     Rule.Rls_ (*order_add_mult_in*) norm_System_noadd_fractions,
   5.136 +	     \<^rule_thm_sym>\<open>mult.assoc\<close>,
   5.137 +	     Rule.Rls_ collect_bdv, (*from make_polynomial_in WN051031 welldone?*)
   5.138 +	     Rule.Rls_ separate_bdv2,
   5.139 +	     \<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e")],
   5.140 +    scr = Rule.Empty_Prog};      
   5.141  \<close>
   5.142  ML \<open>
   5.143  (*.simplify an equational system AFTER solving it;
   5.144 @@ -267,16 +253,16 @@
   5.145  (*TODO.WN051031 ^^^^^^^^^^ should be in EACH rls contained *)
   5.146  val simplify_System = 
   5.147    Rule_Set.Sequence {id = "simplify_System", preconds = []:term list, 
   5.148 -       rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
   5.149 -      erls = Atools_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
   5.150 -      rules = [Rule.Rls_ norm_Rational,
   5.151 -	       Rule.Rls_ (*order_add_mult_in*) norm_System (**1**),
   5.152 -	       Rule.Rls_ discard_parentheses,
   5.153 -	       Rule.Rls_ collect_bdv, (*from make_polynomial_in WN051031 welldone?*)
   5.154 -	       Rule.Rls_ separate_bdv2,
   5.155 -	       \<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e")
   5.156 -	       ],
   5.157 -      scr = Rule.Empty_Prog};      
   5.158 +    rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
   5.159 +    erls = Atools_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
   5.160 +    rules = [
   5.161 +      Rule.Rls_ norm_Rational,
   5.162 +	    Rule.Rls_ (*order_add_mult_in*) norm_System (**1**),
   5.163 +	    Rule.Rls_ discard_parentheses,
   5.164 +	    Rule.Rls_ collect_bdv, (*from make_polynomial_in WN051031 welldone?*)
   5.165 +	    Rule.Rls_ separate_bdv2,
   5.166 +	    \<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e")],
   5.167 +    scr = Rule.Empty_Prog};      
   5.168  (*
   5.169  val simplify_System = 
   5.170      Rule_Set.append_rules "simplify_System" simplify_System_parenthesized
   5.171 @@ -285,36 +271,35 @@
   5.172  \<close>
   5.173  ML \<open>
   5.174  val isolate_bdvs = 
   5.175 -    Rule_Def.Repeat {id="isolate_bdvs", preconds = [], 
   5.176 -	 rew_ord = ("e_rew_ord", Rewrite_Ord.e_rew_ord), 
   5.177 -	 erls = Rule_Set.append_rules "erls_isolate_bdvs" Rule_Set.empty 
   5.178 -			   [(\<^rule_eval>\<open>occur_exactly_in\<close> (eval_occur_exactly_in "#eval_occur_exactly_in_"))], 
   5.179 -			   srls = Rule_Set.Empty, calc = [], errpatts = [],
   5.180 -	      rules = 
   5.181 -             [\<^rule_thm>\<open>commute_0_equality\<close>,
   5.182 -	      \<^rule_thm>\<open>separate_bdvs_add\<close>,
   5.183 -	      \<^rule_thm>\<open>separate_bdvs_mult\<close>],
   5.184 -	      scr = Rule.Empty_Prog};
   5.185 +  Rule_Def.Repeat {
   5.186 +    id="isolate_bdvs", preconds = [], rew_ord = ("e_rew_ord", Rewrite_Ord.e_rew_ord), 
   5.187 +    erls = Rule_Set.append_rules "erls_isolate_bdvs" Rule_Set.empty [
   5.188 +      (\<^rule_eval>\<open>occur_exactly_in\<close> (eval_occur_exactly_in "#eval_occur_exactly_in_"))], 
   5.189 +    srls = Rule_Set.Empty, calc = [], errpatts = [],
   5.190 +    rules = [
   5.191 +      \<^rule_thm>\<open>commute_0_equality\<close>,
   5.192 +      \<^rule_thm>\<open>separate_bdvs_add\<close>,
   5.193 +      \<^rule_thm>\<open>separate_bdvs_mult\<close>],
   5.194 +    scr = Rule.Empty_Prog};
   5.195  \<close>
   5.196  ML \<open>
   5.197  val isolate_bdvs_4x4 = 
   5.198 -    Rule_Def.Repeat {id="isolate_bdvs_4x4", preconds = [], 
   5.199 -	 rew_ord = ("e_rew_ord", Rewrite_Ord.e_rew_ord), 
   5.200 -	 erls = Rule_Set.append_rules 
   5.201 -		    "erls_isolate_bdvs_4x4" Rule_Set.empty 
   5.202 -		    [\<^rule_eval>\<open>occur_exactly_in\<close> (eval_occur_exactly_in "#eval_occur_exactly_in_"),
   5.203 -		     \<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
   5.204 -		     \<^rule_eval>\<open>Prog_Expr.some_occur_in\<close> (Prog_Expr.eval_some_occur_in "#some_occur_in_"),
   5.205 -         \<^rule_thm>\<open>not_true\<close>,
   5.206 -		     \<^rule_thm>\<open>not_false\<close>
   5.207 -			    ], 
   5.208 -	 srls = Rule_Set.Empty, calc = [], errpatts = [],
   5.209 -	 rules = [\<^rule_thm>\<open>commute_0_equality\<close>,
   5.210 -		  \<^rule_thm>\<open>separate_bdvs0\<close>,
   5.211 -		  \<^rule_thm>\<open>separate_bdvs_add1\<close>,
   5.212 -		  \<^rule_thm>\<open>separate_bdvs_add2\<close>,
   5.213 -		  \<^rule_thm>\<open>separate_bdvs_mult\<close>
   5.214 -                 ], scr = Rule.Empty_Prog};
   5.215 +  Rule_Def.Repeat {id="isolate_bdvs_4x4", preconds = [], 
   5.216 +    rew_ord = ("e_rew_ord", Rewrite_Ord.e_rew_ord), 
   5.217 +    erls = Rule_Set.append_rules "erls_isolate_bdvs_4x4" Rule_Set.empty [
   5.218 +      \<^rule_eval>\<open>occur_exactly_in\<close> (eval_occur_exactly_in "#eval_occur_exactly_in_"),
   5.219 +      \<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
   5.220 +      \<^rule_eval>\<open>Prog_Expr.some_occur_in\<close> (Prog_Expr.eval_some_occur_in "#some_occur_in_"),
   5.221 +      \<^rule_thm>\<open>not_true\<close>,
   5.222 +      \<^rule_thm>\<open>not_false\<close>], 
   5.223 +    srls = Rule_Set.Empty, calc = [], errpatts = [],
   5.224 +    rules = [
   5.225 +      \<^rule_thm>\<open>commute_0_equality\<close>,
   5.226 +      \<^rule_thm>\<open>separate_bdvs0\<close>,
   5.227 +      \<^rule_thm>\<open>separate_bdvs_add1\<close>,
   5.228 +      \<^rule_thm>\<open>separate_bdvs_add2\<close>,
   5.229 +      \<^rule_thm>\<open>separate_bdvs_mult\<close>],
   5.230 +    scr = Rule.Empty_Prog};
   5.231  
   5.232  \<close>
   5.233  ML \<open>
   5.234 @@ -322,65 +307,59 @@
   5.235  (*.order the equations in a system such, that a triangular system (if any)
   5.236     appears as [..c_4 = .., ..., ..., ..c_1 + ..c_2 + ..c_3 ..c_4 = ..].*)
   5.237  val order_system = 
   5.238 -    Rule_Def.Repeat {id="order_system", preconds = [], 
   5.239 -	 rew_ord = ("ord_simplify_System", 
   5.240 -		    ord_simplify_System false \<^theory>), 
   5.241 -	 erls = Rule_Set.Empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
   5.242 -	 rules = [\<^rule_thm>\<open>order_system_NxN\<close>
   5.243 -		  ],
   5.244 -	 scr = Rule.Empty_Prog};
   5.245 +  Rule_Def.Repeat {id="order_system", preconds = [], 
   5.246 +	  rew_ord = ("ord_simplify_System", ord_simplify_System false \<^theory>), 
   5.247 +	  erls = Rule_Set.Empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
   5.248 +	  rules = [
   5.249 +      \<^rule_thm>\<open>order_system_NxN\<close>],
   5.250 +	  scr = Rule.Empty_Prog};
   5.251  
   5.252  val prls_triangular = 
   5.253 -    Rule_Def.Repeat {id="prls_triangular", preconds = [], 
   5.254 -	 rew_ord = ("e_rew_ord", Rewrite_Ord.e_rew_ord), 
   5.255 -	 erls = Rule_Def.Repeat {id="erls_prls_triangular", preconds = [], 
   5.256 -		     rew_ord = ("e_rew_ord", Rewrite_Ord.e_rew_ord), 
   5.257 -		     erls = Rule_Set.Empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
   5.258 -		     rules = [(*for precond NTH_CONS ...*)
   5.259 -			      \<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"),
   5.260 -			      \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
   5.261 -            Rule.Eval ("EqSystem.occur_exactly_in", 
   5.262 -              eval_occur_exactly_in "#eval_occur_exactly_in_")
   5.263 -			      (*immediately repeated rewrite pushes
   5.264 -					    '+' into precondition !*)
   5.265 -			      ],
   5.266 -		     scr = Rule.Empty_Prog}, 
   5.267 -	 srls = Rule_Set.Empty, calc = [], errpatts = [],
   5.268 -	 rules = [\<^rule_thm>\<open>NTH_CONS\<close>,
   5.269 -		  \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
   5.270 -		  \<^rule_thm>\<open>NTH_NIL\<close>,
   5.271 -		  \<^rule_thm>\<open>tl_Cons\<close>,
   5.272 -		  \<^rule_thm>\<open>tl_Nil\<close>,
   5.273 -		  \<^rule_eval>\<open>occur_exactly_in\<close> (eval_occur_exactly_in "#eval_occur_exactly_in_")
   5.274 -		  ],
   5.275 -	 scr = Rule.Empty_Prog};
   5.276 +  Rule_Def.Repeat {
   5.277 +    id="prls_triangular", preconds = [], rew_ord = ("e_rew_ord", Rewrite_Ord.e_rew_ord), 
   5.278 +    erls = Rule_Def.Repeat {
   5.279 +      id="erls_prls_triangular", preconds = [], rew_ord = ("e_rew_ord", Rewrite_Ord.e_rew_ord), 
   5.280 +      erls = Rule_Set.Empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
   5.281 +      rules = [(*for precond NTH_CONS ...*)
   5.282 +         \<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"),
   5.283 +         \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
   5.284 +         \<^rule_eval>\<open>occur_exactly_in\<close> (eval_occur_exactly_in "#eval_occur_exactly_in_")],
   5.285 +         (*immediately repeated rewrite pushes '+' into precondition !*)
   5.286 +      scr = Rule.Empty_Prog}, 
   5.287 +    srls = Rule_Set.Empty, calc = [], errpatts = [],
   5.288 +    rules = [
   5.289 +      \<^rule_thm>\<open>NTH_CONS\<close>,
   5.290 +      \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
   5.291 +      \<^rule_thm>\<open>NTH_NIL\<close>,
   5.292 +      \<^rule_thm>\<open>tl_Cons\<close>,
   5.293 +      \<^rule_thm>\<open>tl_Nil\<close>,
   5.294 +      \<^rule_eval>\<open>occur_exactly_in\<close> (eval_occur_exactly_in "#eval_occur_exactly_in_")],
   5.295 +    scr = Rule.Empty_Prog};
   5.296  \<close>
   5.297  ML \<open>
   5.298  
   5.299  (*WN060914 quickly created for 4x4; 
   5.300   more similarity to prls_triangular desirable*)
   5.301  val prls_triangular4 = 
   5.302 -    Rule_Def.Repeat {id="prls_triangular4", preconds = [], 
   5.303 -	 rew_ord = ("e_rew_ord", Rewrite_Ord.e_rew_ord), 
   5.304 -	 erls = Rule_Def.Repeat {id="erls_prls_triangular4", preconds = [], 
   5.305 -		     rew_ord = ("e_rew_ord", Rewrite_Ord.e_rew_ord), 
   5.306 -		     erls = Rule_Set.Empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
   5.307 -		     rules = [(*for precond NTH_CONS ...*)
   5.308 -			      \<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"),
   5.309 -			      \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_")
   5.310 -			      (*immediately repeated rewrite pushes
   5.311 -					    '+' into precondition !*)
   5.312 -			      ],
   5.313 -		     scr = Rule.Empty_Prog}, 
   5.314 -	 srls = Rule_Set.Empty, calc = [], errpatts = [],
   5.315 -	 rules = [\<^rule_thm>\<open>NTH_CONS\<close>,
   5.316 -		  \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
   5.317 -		  \<^rule_thm>\<open>NTH_NIL\<close>,
   5.318 -		  \<^rule_thm>\<open>tl_Cons\<close>,
   5.319 -		  \<^rule_thm>\<open>tl_Nil\<close>,
   5.320 -		  \<^rule_eval>\<open>occur_exactly_in\<close> (eval_occur_exactly_in "#eval_occur_exactly_in_")
   5.321 -		  ],
   5.322 -	 scr = Rule.Empty_Prog};
   5.323 +  Rule_Def.Repeat {
   5.324 +  id="prls_triangular4", preconds = [], rew_ord = ("e_rew_ord", Rewrite_Ord.e_rew_ord), 
   5.325 +  erls = Rule_Def.Repeat {
   5.326 +    id="erls_prls_triangular4", preconds = [], rew_ord = ("e_rew_ord", Rewrite_Ord.e_rew_ord), 
   5.327 +    erls = Rule_Set.Empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
   5.328 +    rules = [(*for precond NTH_CONS ...*)
   5.329 +  	   \<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"),
   5.330 +  	   \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_")],
   5.331 +  	   (*immediately repeated rewrite pushes '+' into precondition !*)
   5.332 +    scr = Rule.Empty_Prog}, 
   5.333 +  srls = Rule_Set.Empty, calc = [], errpatts = [],
   5.334 +  rules = [
   5.335 +    \<^rule_thm>\<open>NTH_CONS\<close>,
   5.336 +    \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
   5.337 +    \<^rule_thm>\<open>NTH_NIL\<close>,
   5.338 +    \<^rule_thm>\<open>tl_Cons\<close>,
   5.339 +    \<^rule_thm>\<open>tl_Nil\<close>,
   5.340 +    \<^rule_eval>\<open>occur_exactly_in\<close> (eval_occur_exactly_in "#eval_occur_exactly_in_")],
   5.341 +  scr = Rule.Empty_Prog};
   5.342  \<close>
   5.343  
   5.344  rule_set_knowledge
   5.345 @@ -624,7 +603,7 @@
   5.346    \<open>{rew_ord'="ord_simplify_System", rls' = Rule_Set.Empty, calc = [], 
   5.347      srls = Rule_Set.append_rules "srls_top_down_4x4" srls [], 
   5.348      prls = Rule_Set.append_rules "prls_tri_4x4_lin_sys" prls_triangular
   5.349 -        [\<^rule_eval>\<open>Prog_Expr.occurs_in\<close> (Prog_Expr.eval_occurs_in "")], 
   5.350 +      [\<^rule_eval>\<open>Prog_Expr.occurs_in\<close> (Prog_Expr.eval_occurs_in "")], 
   5.351      crls = Rule_Set.Empty, errpats = [], nrls = Rule_Set.Empty}\<close>
   5.352    (*FIXXXXME.WN060916: this script works ONLY for exp 7.79 #>#>#>#>#>#>#>#>#>#>*)
   5.353    Program: solve_system4.simps
     6.1 --- a/src/Tools/isac/Knowledge/Equation.thy	Mon Aug 09 14:20:20 2021 +0200
     6.2 +++ b/src/Tools/isac/Knowledge/Equation.thy	Tue Aug 10 09:43:07 2021 +0200
     6.3 @@ -34,8 +34,8 @@
     6.4  
     6.5  ML \<open>
     6.6  val univariate_equation_prls = 
     6.7 -    Rule_Set.append_rules "univariate_equation_prls" Rule_Set.empty 
     6.8 -	       [\<^rule_eval>\<open>Prog_Expr.matches\<close> (Prog_Expr.eval_matches "")];
     6.9 +  Rule_Set.append_rules "univariate_equation_prls" Rule_Set.empty 
    6.10 +	  [\<^rule_eval>\<open>Prog_Expr.matches\<close> (Prog_Expr.eval_matches "")];
    6.11  \<close>
    6.12  rule_set_knowledge univariate_equation_prls = \<open>Auto_Prog.prep_rls @{theory} univariate_equation_prls\<close>
    6.13  
     7.1 --- a/src/Tools/isac/Knowledge/Integrate.thy	Mon Aug 09 14:20:20 2021 +0200
     7.2 +++ b/src/Tools/isac/Knowledge/Integrate.thy	Tue Aug 10 09:43:07 2021 +0200
     7.3 @@ -44,7 +44,7 @@
     7.4  (** eval functions **)
     7.5  
     7.6  val c = Free ("c", HOLogic.realT);
     7.7 -(*.create a new unique variable 'c..' in a term; for use by Rule.Eval in a rls;
     7.8 +(*.create a new unique variable 'c..' in a term; for use by \<^rule_eval> in a rls;
     7.9     an alternative to do this would be '(Try (Calculate new_c_) (new_c es__))'
    7.10     in the script; this will be possible if currying doesnt take the value
    7.11     from a variable, but the value '(new_c es__)' itself.*)
    7.12 @@ -111,50 +111,45 @@
    7.13  
    7.14  (*.rulesets for integration.*)
    7.15  val integration_rules = 
    7.16 -    Rule_Def.Repeat {id="integration_rules", preconds = [], 
    7.17 -	 rew_ord = ("termlessI",termlessI), 
    7.18 -	 erls = Rule_Def.Repeat {id="conditions_in_integration_rules", 
    7.19 -		     preconds = [], 
    7.20 -		     rew_ord = ("termlessI",termlessI), 
    7.21 -		     erls = Rule_Set.Empty, 
    7.22 -		     srls = Rule_Set.Empty, calc = [], errpatts = [],
    7.23 -		     rules = [(*for rewriting conditions in Thm's*)
    7.24 -			      \<^rule_eval>\<open>Prog_Expr.occurs_in\<close> (Prog_Expr.eval_occurs_in "#occurs_in_"),
    7.25 -			      \<^rule_thm>\<open>not_true\<close>,
    7.26 -			      \<^rule_thm>\<open>not_false\<close>
    7.27 -			      ],
    7.28 -		     scr = Rule.Empty_Prog}, 
    7.29 -	 srls = Rule_Set.Empty, calc = [], errpatts = [],
    7.30 -	 rules = [
    7.31 -		  \<^rule_thm>\<open>integral_const\<close>,
    7.32 -		  \<^rule_thm>\<open>integral_var\<close>,
    7.33 -		  \<^rule_thm>\<open>integral_add\<close>,
    7.34 -		  \<^rule_thm>\<open>integral_mult\<close>,
    7.35 -		  \<^rule_thm>\<open>integral_pow\<close>,
    7.36 -		  \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_")(*for n+1*)
    7.37 -		  ],
    7.38 -	 scr = Rule.Empty_Prog};
    7.39 +  Rule_Def.Repeat {id="integration_rules", preconds = [], 
    7.40 +    rew_ord = ("termlessI",termlessI), 
    7.41 +    erls = Rule_Def.Repeat {id="conditions_in_integration_rules", 
    7.42 +   	  preconds = [], 
    7.43 +   	  rew_ord = ("termlessI",termlessI), 
    7.44 +   	  erls = Rule_Set.Empty, 
    7.45 +   	  srls = Rule_Set.Empty, calc = [], errpatts = [],
    7.46 +   	  rules = [(*for rewriting conditions in Thm's*)
    7.47 +   		   \<^rule_eval>\<open>Prog_Expr.occurs_in\<close> (Prog_Expr.eval_occurs_in "#occurs_in_"),
    7.48 +   		   \<^rule_thm>\<open>not_true\<close>,
    7.49 +   		   \<^rule_thm>\<open>not_false\<close>],
    7.50 +   	  scr = Rule.Empty_Prog}, 
    7.51 +    srls = Rule_Set.Empty, calc = [], errpatts = [],
    7.52 +    rules = [
    7.53 +   	  \<^rule_thm>\<open>integral_const\<close>,
    7.54 +   	  \<^rule_thm>\<open>integral_var\<close>,
    7.55 +   	  \<^rule_thm>\<open>integral_add\<close>,
    7.56 +   	  \<^rule_thm>\<open>integral_mult\<close>,
    7.57 +   	  \<^rule_thm>\<open>integral_pow\<close>,
    7.58 +   	  \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_")(*for n+1*)],
    7.59 +    scr = Rule.Empty_Prog};
    7.60  \<close>
    7.61  ML \<open>
    7.62  val add_new_c = 
    7.63 -    Rule_Set.Sequence {id="add_new_c", preconds = [], 
    7.64 -	 rew_ord = ("termlessI",termlessI), 
    7.65 -	 erls = Rule_Def.Repeat {id="conditions_in_add_new_c", 
    7.66 -		     preconds = [], 
    7.67 -		     rew_ord = ("termlessI",termlessI), 
    7.68 -		     erls = Rule_Set.Empty, 
    7.69 -		     srls = Rule_Set.Empty, calc = [], errpatts = [],
    7.70 -		     rules = [\<^rule_eval>\<open>Prog_Expr.matches\<close> (Prog_Expr.eval_matches""),
    7.71 -			      \<^rule_eval>\<open>Integrate.is_f_x\<close> (eval_is_f_x "is_f_x_"),
    7.72 -			      \<^rule_thm>\<open>not_true\<close>,
    7.73 -			      \<^rule_thm>\<open>not_false\<close>
    7.74 -			      ],
    7.75 -		     scr = Rule.Empty_Prog}, 
    7.76 -	 srls = Rule_Set.Empty, calc = [], errpatts = [],
    7.77 -	 rules = [ (*\<^rule_thm>\<open>call_for_new_c\<close>,*)
    7.78 -		   Rule.Cal1 ("Integrate.add_new_c", eval_add_new_c "new_c_")
    7.79 -		   ],
    7.80 -	 scr = Rule.Empty_Prog};
    7.81 +  Rule_Set.Sequence {id="add_new_c", preconds = [], 
    7.82 +    rew_ord = ("termlessI",termlessI), 
    7.83 +    erls = Rule_Def.Repeat {id="conditions_in_add_new_c", 
    7.84 +      preconds = [], rew_ord = ("termlessI",termlessI), erls = Rule_Set.Empty, 
    7.85 +      srls = Rule_Set.Empty, calc = [], errpatts = [],
    7.86 +      rules = [
    7.87 +        \<^rule_eval>\<open>Prog_Expr.matches\<close> (Prog_Expr.eval_matches""),
    7.88 +   	    \<^rule_eval>\<open>Integrate.is_f_x\<close> (eval_is_f_x "is_f_x_"),
    7.89 +   	    \<^rule_thm>\<open>not_true\<close>,
    7.90 +   	    \<^rule_thm>\<open>not_false\<close>],
    7.91 +      scr = Rule.Empty_Prog}, 
    7.92 +    srls = Rule_Set.Empty, calc = [], errpatts = [],
    7.93 +    rules = [ (*\<^rule_thm>\<open>call_for_new_c\<close>,*)
    7.94 +      Rule.Cal1 ("Integrate.add_new_c", eval_add_new_c "new_c_")],
    7.95 +    scr = Rule.Empty_Prog};
    7.96  \<close>
    7.97  ML \<open>
    7.98  
    7.99 @@ -162,58 +157,45 @@
   7.100  
   7.101  (*.for simplify_Integral adapted from 'norm_Rational_rls'.*)
   7.102  val norm_Rational_rls_noadd_fractions = 
   7.103 -Rule_Def.Repeat {id = "norm_Rational_rls_noadd_fractions", preconds = [], 
   7.104 -     rew_ord = ("dummy_ord",Rewrite_Ord.dummy_ord), 
   7.105 -     erls = norm_rat_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
   7.106 -     rules = [(*Rule.Rls_ add_fractions_p_rls,!!!*)
   7.107 -	      Rule.Rls_ (*rat_mult_div_pow original corrected WN051028*)
   7.108 -		  (Rule_Def.Repeat {id = "rat_mult_div_pow", preconds = [], 
   7.109 -		       rew_ord = ("dummy_ord",Rewrite_Ord.dummy_ord), 
   7.110 -		       erls = (*FIXME.WN051028 Rule_Set.empty,*)
   7.111 -		       Rule_Set.append_rules "Rule_Set.empty-is_polyexp" Rule_Set.empty
   7.112 -				  [\<^rule_eval>\<open>is_polyexp\<close> (eval_is_polyexp "")],
   7.113 -				  srls = Rule_Set.Empty, calc = [], errpatts = [],
   7.114 -				  rules = [\<^rule_thm>\<open>rat_mult\<close>,
   7.115 -	       (*"?a / ?b * (?c / ?d) = ?a * ?c / (?b * ?d)"*)
   7.116 -	       \<^rule_thm>\<open>rat_mult_poly_l\<close>,
   7.117 -	       (*"?c is_polyexp ==> ?c * (?a / ?b) = ?c * ?a / ?b"*)
   7.118 -	       \<^rule_thm>\<open>rat_mult_poly_r\<close>,
   7.119 -	       (*"?c is_polyexp ==> ?a / ?b * ?c = ?a * ?c / ?b"*)
   7.120 -
   7.121 -	       \<^rule_thm>\<open>real_divide_divide1_mg\<close>,
   7.122 -	       (*"y ~= 0 ==> (u / v) / (y / z) = (u * z) / (y * v)"*)
   7.123 -	       \<^rule_thm>\<open>divide_divide_eq_right\<close>,
   7.124 -	       (*"?x / (?y / ?z) = ?x * ?z / ?y"*)
   7.125 -	       \<^rule_thm>\<open>divide_divide_eq_left\<close>,
   7.126 -	       (*"?x / ?y / ?z = ?x / (?y * ?z)"*)
   7.127 -	       \<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e"),
   7.128 -	      
   7.129 -	       \<^rule_thm>\<open>rat_power\<close>
   7.130 -		(*"(?a / ?b)  \<up>  ?n = ?a  \<up>  ?n / ?b  \<up>  ?n"*)
   7.131 -	       ],
   7.132 -      scr = Rule.Empty_Prog
   7.133 -      }),
   7.134 -		Rule.Rls_ make_rat_poly_with_parentheses,
   7.135 -		Rule.Rls_ cancel_p_rls,(*FIXME:cancel_p does NOT order sometimes*)
   7.136 -		Rule.Rls_ rat_reduce_1
   7.137 -		],
   7.138 -       scr = Rule.Empty_Prog
   7.139 -       };
   7.140 +  Rule_Def.Repeat {id = "norm_Rational_rls_noadd_fractions", preconds = [], 
   7.141 +    rew_ord = ("dummy_ord",Rewrite_Ord.dummy_ord), 
   7.142 +    erls = norm_rat_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
   7.143 +    rules = [(*Rule.Rls_ add_fractions_p_rls,!!!*)
   7.144 +  	  Rule.Rls_ (*rat_mult_div_pow original corrected WN051028*)
   7.145 +  		(Rule_Def.Repeat {id = "rat_mult_div_pow", preconds = [], 
   7.146 +  		   rew_ord = ("dummy_ord",Rewrite_Ord.dummy_ord), 
   7.147 +  		   erls = Rule_Set.append_rules "Rule_Set.empty-is_polyexp" Rule_Set.empty
   7.148 +  				 [\<^rule_eval>\<open>is_polyexp\<close> (eval_is_polyexp "")],
   7.149 +  			 srls = Rule_Set.Empty, calc = [], errpatts = [],
   7.150 +  		   rules = [
   7.151 +           \<^rule_thm>\<open>rat_mult\<close>, (*"?a / ?b * (?c / ?d) = ?a * ?c / (?b * ?d)"*)
   7.152 +  	       \<^rule_thm>\<open>rat_mult_poly_l\<close>, (*"?c is_polyexp ==> ?c * (?a / ?b) = ?c * ?a / ?b"*)
   7.153 +  	       \<^rule_thm>\<open>rat_mult_poly_r\<close>, (*"?c is_polyexp ==> ?a / ?b * ?c = ?a * ?c / ?b"*)
   7.154 +  
   7.155 +  	       \<^rule_thm>\<open>real_divide_divide1_mg\<close>, (*"y ~= 0 ==> (u / v) / (y / z) = (u * z) / (y * v)"*)
   7.156 +  	       \<^rule_thm>\<open>divide_divide_eq_right\<close>, (*"?x / (?y / ?z) = ?x * ?z / ?y"*)
   7.157 +  	       \<^rule_thm>\<open>divide_divide_eq_left\<close>, (*"?x / ?y / ?z = ?x / (?y * ?z)"*)
   7.158 +  	       \<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e"),
   7.159 +  	      
   7.160 +  	       \<^rule_thm>\<open>rat_power\<close>], (*"(?a / ?b)  \<up>  ?n = ?a  \<up>  ?n / ?b  \<up>  ?n"*)
   7.161 +        scr = Rule.Empty_Prog}),
   7.162 +  		Rule.Rls_ make_rat_poly_with_parentheses,
   7.163 +  		Rule.Rls_ cancel_p_rls,(*FIXME:cancel_p does NOT order sometimes*)
   7.164 +  		Rule.Rls_ rat_reduce_1],
   7.165 +    scr = Rule.Empty_Prog};
   7.166  
   7.167  (*.for simplify_Integral adapted from 'norm_Rational'.*)
   7.168  val norm_Rational_noadd_fractions = 
   7.169 -   Rule_Set.Sequence {id = "norm_Rational_noadd_fractions", preconds = [], 
   7.170 -       rew_ord = ("dummy_ord",Rewrite_Ord.dummy_ord), 
   7.171 -       erls = norm_rat_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
   7.172 -       rules = [Rule.Rls_ discard_minus,
   7.173 -		Rule.Rls_ rat_mult_poly,(* removes double fractions like a/b/c    *)
   7.174 -		Rule.Rls_ make_rat_poly_with_parentheses, (*WN0510 also in(#)below*)
   7.175 -		Rule.Rls_ cancel_p_rls, (*FIXME.MG:cancel_p does NOT order sometim*)
   7.176 -		Rule.Rls_ norm_Rational_rls_noadd_fractions,(* the main rls (#)   *)
   7.177 -		Rule.Rls_ discard_parentheses1 (* mult only                       *)
   7.178 -		],
   7.179 -       scr = Rule.Empty_Prog
   7.180 -       };
   7.181 +  Rule_Set.Sequence {id = "norm_Rational_noadd_fractions", preconds = [], 
   7.182 +    rew_ord = ("dummy_ord",Rewrite_Ord.dummy_ord), 
   7.183 +    erls = norm_rat_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
   7.184 +    rules = [Rule.Rls_ discard_minus,
   7.185 +  		Rule.Rls_ rat_mult_poly,(* removes double fractions like a/b/c    *)
   7.186 +  		Rule.Rls_ make_rat_poly_with_parentheses, (*WN0510 also in(#)below*)
   7.187 +  		Rule.Rls_ cancel_p_rls, (*FIXME.MG:cancel_p does NOT order sometim*)
   7.188 +  		Rule.Rls_ norm_Rational_rls_noadd_fractions,(* the main rls (#)   *)
   7.189 +  		Rule.Rls_ discard_parentheses1], (* mult only                       *)
   7.190 +    scr = Rule.Empty_Prog};
   7.191  
   7.192  (*.simplify terms before and after Integration such that  
   7.193     ..a.x^2/2 + b.x^3/3.. is made to ..a/2.x^2 + b/3.x^3.. (and NO
   7.194 @@ -222,92 +204,44 @@
   7.195     *1* expand the term, ie. distribute * and / over +
   7.196  .*)
   7.197  val separate_bdv2 =
   7.198 -    Rule_Set.append_rules "separate_bdv2"
   7.199 -	       collect_bdv
   7.200 -	       [\<^rule_thm>\<open>separate_bdv\<close>,
   7.201 -		(*"?a * ?bdv / ?b = ?a / ?b * ?bdv"*)
   7.202 +   Rule_Set.append_rules "separate_bdv2" collect_bdv [
   7.203 +    \<^rule_thm>\<open>separate_bdv\<close>, (*"?a * ?bdv / ?b = ?a / ?b * ?bdv"*)
   7.204  		\<^rule_thm>\<open>separate_bdv_n\<close>,
   7.205 -		\<^rule_thm>\<open>separate_1_bdv\<close>,
   7.206 -		(*"?bdv / ?b = (1 / ?b) * ?bdv"*)
   7.207 -		\<^rule_thm>\<open>separate_1_bdv_n\<close>(*,
   7.208 -			  (*"?bdv  \<up>  ?n / ?b = 1 / ?b * ?bdv  \<up>  ?n"*)
   7.209 -			  *****\<^rule_thm>\<open>add_divide_distrib\<close>
   7.210 -			  (*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"*)----------*)
   7.211 +		\<^rule_thm>\<open>separate_1_bdv\<close>, (*"?bdv / ?b = (1 / ?b) * ?bdv"*)
   7.212 +		\<^rule_thm>\<open>separate_1_bdv_n\<close> (*"?bdv  \<up>  ?n / ?b = 1 / ?b * ?bdv  \<up>  ?n"*)
   7.213 +    (*
   7.214 +		rule_thm>\<open>add_divide_distrib\<close> (*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"*)*)
   7.215  		];
   7.216  val simplify_Integral = 
   7.217    Rule_Set.Sequence {id = "simplify_Integral", preconds = []:term list, 
   7.218 -       rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
   7.219 -      erls = Atools_erls, srls = Rule_Set.Empty,
   7.220 -      calc = [],  errpatts = [],
   7.221 -      rules = [\<^rule_thm>\<open>distrib_right\<close>,
   7.222 - 	       (*"(?z1.0 + ?z2.0) * ?w = ?z1.0 * ?w + ?z2.0 * ?w"*)
   7.223 -	       \<^rule_thm>\<open>add_divide_distrib\<close>,
   7.224 - 	       (*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"*)
   7.225 -	       (*^^^^^ *1* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*)
   7.226 -	       Rule.Rls_ norm_Rational_noadd_fractions,
   7.227 -	       Rule.Rls_ order_add_mult_in,
   7.228 -	       Rule.Rls_ discard_parentheses,
   7.229 -	       (*Rule.Rls_ collect_bdv, from make_polynomial_in*)
   7.230 -	       Rule.Rls_ separate_bdv2,
   7.231 -	       \<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e")
   7.232 -	       ],
   7.233 -      scr = Rule.Empty_Prog};      
   7.234 +    rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
   7.235 +    erls = Atools_erls, srls = Rule_Set.Empty,
   7.236 +    calc = [],  errpatts = [],
   7.237 +    rules = [
   7.238 +      \<^rule_thm>\<open>distrib_right\<close>, (*"(?z1.0 + ?z2.0) * ?w = ?z1.0 * ?w + ?z2.0 * ?w"*)
   7.239 +	    \<^rule_thm>\<open>add_divide_distrib\<close>, (*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"*)
   7.240 +	     (*^^^^^ *1* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*)
   7.241 +	    Rule.Rls_ norm_Rational_noadd_fractions,
   7.242 +	    Rule.Rls_ order_add_mult_in,
   7.243 +	    Rule.Rls_ discard_parentheses,
   7.244 +	    (*Rule.Rls_ collect_bdv, from make_polynomial_in*)
   7.245 +	    Rule.Rls_ separate_bdv2,
   7.246 +	    \<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e")],
   7.247 +    scr = Rule.Empty_Prog};      
   7.248  
   7.249 -
   7.250 -(*simplify terms before and after Integration such that  
   7.251 -   ..a.x^2/2 + b.x^3/3.. is made to ..a/2.x^2 + b/3.x^3.. (and NO
   7.252 -   common denominator as done by norm_Rational or make_ratpoly_in.
   7.253 -   This is a copy from 'make_polynomial_in' with insertions from 
   7.254 -   'make_ratpoly_in' 
   7.255 -THIS IS KEPT FOR COMPARISON ............................................   
   7.256 -* val simplify_Integral = prep_rls'(
   7.257 -*   Rule_Set.Sequence {id = "", preconds = []:term list, 
   7.258 -*        rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
   7.259 -*       erls = Atools_erls, srls = Rule_Set.Empty,
   7.260 -*       calc = [], (*asm_thm = [],*)
   7.261 -*       rules = [Rule.Rls_ expand_poly,
   7.262 -* 	       Rule.Rls_ order_add_mult_in,
   7.263 -* 	       Rule.Rls_ simplify_power,
   7.264 -* 	       Rule.Rls_ collect_numerals,
   7.265 -* 	       Rule.Rls_ reduce_012,
   7.266 -* 	       \<^rule_thm>\<open>realpow_oneI\<close>,
   7.267 -* 	       Rule.Rls_ discard_parentheses,
   7.268 -* 	       Rule.Rls_ collect_bdv,
   7.269 -* 	       (*below inserted from 'make_ratpoly_in'*)
   7.270 -* 	       Rule.Rls_ (Rule_Set.append_rules "separate_bdv"
   7.271 -* 			 collect_bdv
   7.272 -* 			 [\<^rule_thm>\<open>separate_bdv\<close>,
   7.273 -* 			  (*"?a * ?bdv / ?b = ?a / ?b * ?bdv"*)
   7.274 -* 			  \<^rule_thm>\<open>separate_bdv_n\<close>,
   7.275 -* 			  \<^rule_thm>\<open>separate_1_bdv\<close>,
   7.276 -* 			  (*"?bdv / ?b = (1 / ?b) * ?bdv"*)
   7.277 -* 			  \<^rule_thm>\<open>separate_1_bdv_n\<close>(*,
   7.278 -* 			  (*"?bdv  \<up>  ?n / ?b = 1 / ?b * ?bdv  \<up>  ?n"*)
   7.279 -* 			  \<^rule_thm>\<open>add_divide_distrib\<close>
   7.280 -* 			   (*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"*)*)
   7.281 -* 			  ]),
   7.282 -* 	       \<^rule_eval>\<open>divide\<close> (eval_cancel "#divide_e")
   7.283 -* 	       ],
   7.284 -*       scr = Rule.Empty_Prog
   7.285 -*       }); 
   7.286 -.......................................................................*)
   7.287 -
   7.288 -val integration = 
   7.289 -    Rule_Set.Sequence {id="integration", preconds = [], 
   7.290 -	 rew_ord = ("termlessI",termlessI), 
   7.291 -	 erls = Rule_Def.Repeat {id="conditions_in_integration", 
   7.292 -		     preconds = [], 
   7.293 -		     rew_ord = ("termlessI",termlessI), 
   7.294 -		     erls = Rule_Set.Empty, 
   7.295 -		     srls = Rule_Set.Empty, calc = [], errpatts = [],
   7.296 -		     rules = [],
   7.297 -		     scr = Rule.Empty_Prog}, 
   7.298 -	 srls = Rule_Set.Empty, calc = [], errpatts = [],
   7.299 -	 rules = [ Rule.Rls_ integration_rules,
   7.300 -		   Rule.Rls_ add_new_c,
   7.301 -		   Rule.Rls_ simplify_Integral
   7.302 -		   ],
   7.303 -	 scr = Rule.Empty_Prog};
   7.304 +val integration =
   7.305 +  Rule_Set.Sequence {
   7.306 +     id="integration", preconds = [], rew_ord = ("termlessI",termlessI), 
   7.307 +  	 erls = Rule_Def.Repeat {
   7.308 +       id="conditions_in_integration",  preconds = [], rew_ord = ("termlessI",termlessI), 
   7.309 +  		 erls = Rule_Set.Empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
   7.310 +  		 rules = [], scr = Rule.Empty_Prog}, 
   7.311 +  	 srls = Rule_Set.Empty, calc = [], errpatts = [],
   7.312 +  	 rules = [
   7.313 +      Rule.Rls_ integration_rules,
   7.314 +  		 Rule.Rls_ add_new_c,
   7.315 +  		 Rule.Rls_ simplify_Integral],
   7.316 +  	 scr = Rule.Empty_Prog};
   7.317  
   7.318  val prep_rls' = Auto_Prog.prep_rls @{theory};
   7.319  \<close>
     8.1 --- a/src/Tools/isac/Knowledge/Inverse_Z_Transform.thy	Mon Aug 09 14:20:20 2021 +0200
     8.2 +++ b/src/Tools/isac/Knowledge/Inverse_Z_Transform.thy	Tue Aug 10 09:43:07 2021 +0200
     8.3 @@ -110,24 +110,23 @@
     8.4  
     8.5  method met_SP_Ztrans_inv_sub : "SignalProcessing/Z_Transform/Inverse_sub" =
     8.6    \<open>{rew_ord'="tless_true", rls'= Rule_Set.empty, calc = [],
     8.7 -    srls = Rule_Def.Repeat {id="srls_partial_fraction", 
     8.8 -        preconds = [], rew_ord = ("termlessI",termlessI),
     8.9 -        erls = Rule_Set.append_rules "erls_in_srls_partial_fraction" Rule_Set.empty
    8.10 -            [(*for asm in NTH_CONS ...*)
    8.11 -              \<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"),
    8.12 -              (*2nd NTH_CONS pushes n+-1 into asms*)
    8.13 -              \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_")], 
    8.14 -        srls = Rule_Set.Empty, calc = [], errpatts = [],
    8.15 -        rules = [\<^rule_thm>\<open>NTH_CONS\<close>,
    8.16 -            \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
    8.17 -            \<^rule_thm>\<open>NTH_NIL\<close>,
    8.18 -            \<^rule_eval>\<open>Prog_Expr.lhs\<close> (Prog_Expr.eval_lhs "eval_lhs_"),
    8.19 -            \<^rule_eval>\<open>Prog_Expr.rhs\<close> (Prog_Expr.eval_rhs"eval_rhs_"),
    8.20 -            \<^rule_eval>\<open>Prog_Expr.argument_in\<close> (Prog_Expr.eval_argument_in "Prog_Expr.argument_in"),
    8.21 -            \<^rule_eval>\<open>get_denominator\<close> (eval_get_denominator "#get_denominator"),
    8.22 -            \<^rule_eval>\<open>get_numerator\<close> (eval_get_numerator "#get_numerator"),
    8.23 -            \<^rule_eval>\<open>factors_from_solution\<close> (eval_factors_from_solution "#factors_from_solution")
    8.24 -            ], scr = Rule.Empty_Prog},
    8.25 +    srls = Rule_Def.Repeat {
    8.26 +      id = "srls_partial_fraction",  preconds = [], rew_ord = ("termlessI",termlessI),
    8.27 +      erls = Rule_Set.append_rules "erls_in_srls_partial_fraction" Rule_Set.empty [
    8.28 +        \<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"), (* ...for asm in NTH_CONS*)
    8.29 +        (*2nd NTH_CONS pushes n+-1 into asms*)
    8.30 +        \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_")], 
    8.31 +      srls = Rule_Set.Empty, calc = [], errpatts = [],
    8.32 +      rules = [\<^rule_thm>\<open>NTH_CONS\<close>,
    8.33 +        \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
    8.34 +        \<^rule_thm>\<open>NTH_NIL\<close>,
    8.35 +        \<^rule_eval>\<open>Prog_Expr.lhs\<close> (Prog_Expr.eval_lhs "eval_lhs_"),
    8.36 +        \<^rule_eval>\<open>Prog_Expr.rhs\<close> (Prog_Expr.eval_rhs"eval_rhs_"),
    8.37 +        \<^rule_eval>\<open>Prog_Expr.argument_in\<close> (Prog_Expr.eval_argument_in "Prog_Expr.argument_in"),
    8.38 +        \<^rule_eval>\<open>get_denominator\<close> (eval_get_denominator "#get_denominator"),
    8.39 +        \<^rule_eval>\<open>get_numerator\<close> (eval_get_numerator "#get_numerator"),
    8.40 +        \<^rule_eval>\<open>factors_from_solution\<close> (eval_factors_from_solution "#factors_from_solution")],
    8.41 +      scr = Rule.Empty_Prog},
    8.42      prls = Rule_Set.empty, crls = Rule_Set.empty, errpats = [], nrls = norm_Rational}\<close>
    8.43    Program: inverse_ztransform2.simps
    8.44    Given: "filterExpression X_eq" "functionName X_z"
     9.1 --- a/src/Tools/isac/Knowledge/Isac_Knowledge.thy	Mon Aug 09 14:20:20 2021 +0200
     9.2 +++ b/src/Tools/isac/Knowledge/Isac_Knowledge.thy	Tue Aug 10 09:43:07 2021 +0200
     9.3 @@ -26,7 +26,6 @@
     9.4  ML \<open>
     9.5    val version_isac = "isac version 120504 15:33";
     9.6  \<close> ML \<open>
     9.7 -TermC.numerals_to_Free
     9.8  \<close> ML \<open>
     9.9  \<close>
    9.10  end
    10.1 --- a/src/Tools/isac/Knowledge/LinEq.thy	Mon Aug 09 14:20:20 2021 +0200
    10.2 +++ b/src/Tools/isac/Knowledge/LinEq.thy	Tue Aug 10 09:43:07 2021 +0200
    10.3 @@ -24,22 +24,21 @@
    10.4  
    10.5  ML \<open>
    10.6  val LinEq_prls = (*3.10.02:just the following order due to subterm evaluation*)
    10.7 -  Rule_Set.append_rules "LinEq_prls" Rule_Set.empty 
    10.8 -	     [\<^rule_eval>\<open>HOL.eq\<close> (Prog_Expr.eval_equal "#equal_"),
    10.9 -	      \<^rule_eval>\<open>Prog_Expr.matches\<close> (Prog_Expr.eval_matches ""),
   10.10 -	      \<^rule_eval>\<open>Prog_Expr.lhs\<close> (Prog_Expr.eval_lhs ""),
   10.11 -	      \<^rule_eval>\<open>Prog_Expr.rhs\<close> (Prog_Expr.eval_rhs ""),
   10.12 -	      \<^rule_eval>\<open>has_degree_in\<close> (eval_has_degree_in ""),
   10.13 - 	      \<^rule_eval>\<open>is_polyrat_in\<close> (eval_is_polyrat_in ""),
   10.14 -	      \<^rule_eval>\<open>Prog_Expr.occurs_in\<close> (Prog_Expr.eval_occurs_in ""),    
   10.15 -	      \<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
   10.16 -	      \<^rule_thm>\<open>not_true\<close>,
   10.17 -	      \<^rule_thm>\<open>not_false\<close>,
   10.18 -	      \<^rule_thm>\<open>and_true\<close>,
   10.19 -	      \<^rule_thm>\<open>and_false\<close>,
   10.20 -	      \<^rule_thm>\<open>or_true\<close>,
   10.21 -	      \<^rule_thm>\<open>or_false\<close>
   10.22 -              ];
   10.23 +  Rule_Set.append_rules "LinEq_prls" Rule_Set.empty [
   10.24 +    \<^rule_eval>\<open>HOL.eq\<close> (Prog_Expr.eval_equal "#equal_"),
   10.25 +    \<^rule_eval>\<open>Prog_Expr.matches\<close> (Prog_Expr.eval_matches ""),
   10.26 +    \<^rule_eval>\<open>Prog_Expr.lhs\<close> (Prog_Expr.eval_lhs ""),
   10.27 +    \<^rule_eval>\<open>Prog_Expr.rhs\<close> (Prog_Expr.eval_rhs ""),
   10.28 +    \<^rule_eval>\<open>has_degree_in\<close> (eval_has_degree_in ""),
   10.29 +    \<^rule_eval>\<open>is_polyrat_in\<close> (eval_is_polyrat_in ""),
   10.30 +    \<^rule_eval>\<open>Prog_Expr.occurs_in\<close> (Prog_Expr.eval_occurs_in ""),    
   10.31 +    \<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
   10.32 +    \<^rule_thm>\<open>not_true\<close>,
   10.33 +    \<^rule_thm>\<open>not_false\<close>,
   10.34 +    \<^rule_thm>\<open>and_true\<close>,
   10.35 +    \<^rule_thm>\<open>and_false\<close>,
   10.36 +    \<^rule_thm>\<open>or_true\<close>,
   10.37 +    \<^rule_thm>\<open>or_false\<close>];
   10.38  (* ----- erls ----- *)
   10.39  val LinEq_crls = 
   10.40     Rule_Set.append_rules "LinEq_crls" poly_crls
   10.41 @@ -53,8 +52,8 @@
   10.42  
   10.43  (* ----- crls ----- *)
   10.44  val LinEq_erls = 
   10.45 -   Rule_Set.append_rules "LinEq_erls" Poly_erls
   10.46 -   [\<^rule_thm>\<open>real_assoc_1\<close>
   10.47 +  Rule_Set.append_rules "LinEq_erls" Poly_erls [
   10.48 +    \<^rule_thm>\<open>real_assoc_1\<close>
   10.49      (*		
   10.50       Don't use
   10.51       \<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e"),
   10.52 @@ -67,42 +66,37 @@
   10.53      
   10.54  val LinPoly_simplify = prep_rls'(
   10.55    Rule_Def.Repeat {id = "LinPoly_simplify", preconds = [], 
   10.56 -       rew_ord = ("termlessI",termlessI), 
   10.57 -       erls = LinEq_erls, 
   10.58 -       srls = Rule_Set.Empty, 
   10.59 -       calc = [], errpatts = [],
   10.60 -       rules = [
   10.61 -		\<^rule_thm>\<open>real_assoc_1\<close>,
   10.62 -		\<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
   10.63 -		\<^rule_eval>\<open>minus\<close> (**)(eval_binop "#sub_"),
   10.64 -		\<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
   10.65 -		(*  Don't use  
   10.66 -		 \<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e"),
   10.67 -		 \<^rule_eval>\<open>sqrt\<close> (eval_sqrt "#sqrt_"),
   10.68 -		 *)
   10.69 -		\<^rule_eval>\<open>powr\<close> (**)(eval_binop "#power_")
   10.70 -		],
   10.71 -       scr = Rule.Empty_Prog});
   10.72 +    rew_ord = ("termlessI",termlessI), 
   10.73 +    erls = LinEq_erls, 
   10.74 +    srls = Rule_Set.Empty, 
   10.75 +    calc = [], errpatts = [],
   10.76 +    rules = [
   10.77 +      \<^rule_thm>\<open>real_assoc_1\<close>,
   10.78 +      \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
   10.79 +      \<^rule_eval>\<open>minus\<close> (**)(eval_binop "#sub_"),
   10.80 +      \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
   10.81 +      (*  Don't use  
   10.82 +       \<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e"),
   10.83 +       \<^rule_eval>\<open>sqrt\<close> (eval_sqrt "#sqrt_"),
   10.84 +       *)
   10.85 +      \<^rule_eval>\<open>powr\<close> (**)(eval_binop "#power_")],
   10.86 +    scr = Rule.Empty_Prog});
   10.87  \<close>
   10.88  rule_set_knowledge LinPoly_simplify = LinPoly_simplify
   10.89  ML \<open>
   10.90  
   10.91  (*isolate the bound variable in an linear equation; 'bdv' is a meta-constant*)
   10.92  val LinEq_simplify = prep_rls'(
   10.93 -Rule_Def.Repeat {id = "LinEq_simplify", preconds = [],
   10.94 -     rew_ord = ("e_rew_ord", Rewrite_Ord.e_rew_ord),
   10.95 -     erls = LinEq_erls,
   10.96 -     srls = Rule_Set.Empty,
   10.97 -     calc = [], errpatts = [],
   10.98 -     rules = [
   10.99 -	      \<^rule_thm>\<open>lin_isolate_add1\<close>, 
  10.100 -	      (* a+bx=0 -> bx=-a *)
  10.101 -	      \<^rule_thm>\<open>lin_isolate_add2\<close>, 
  10.102 -	      (* a+ x=0 ->  x=-a *)
  10.103 -	      \<^rule_thm>\<open>lin_isolate_div\<close>    
  10.104 -	      (*   bx=c -> x=c/b *)  
  10.105 -	      ],
  10.106 -     scr = Rule.Empty_Prog});
  10.107 +  Rule_Def.Repeat {id = "LinEq_simplify", preconds = [],
  10.108 +    rew_ord = ("e_rew_ord", Rewrite_Ord.e_rew_ord),
  10.109 +    erls = LinEq_erls,
  10.110 +    srls = Rule_Set.Empty,
  10.111 +    calc = [], errpatts = [],
  10.112 +    rules = [
  10.113 +	     \<^rule_thm>\<open>lin_isolate_add1\<close>, (* a+bx=0 -> bx=-a *)
  10.114 +	     \<^rule_thm>\<open>lin_isolate_add2\<close>, (* a+ x=0 ->  x=-a *)
  10.115 +	     \<^rule_thm>\<open>lin_isolate_div\<close> (*   bx=c -> x=c/b *)],
  10.116 +    scr = Rule.Empty_Prog});
  10.117  \<close>
  10.118  rule_set_knowledge LinEq_simplify = LinEq_simplify
  10.119  
    11.1 --- a/src/Tools/isac/Knowledge/Partial_Fractions.thy	Mon Aug 09 14:20:20 2021 +0200
    11.2 +++ b/src/Tools/isac/Knowledge/Partial_Fractions.thy	Tue Aug 10 09:43:07 2021 +0200
    11.3 @@ -108,29 +108,26 @@
    11.4  val ansatz_rls = prep_rls'(
    11.5    Rule_Def.Repeat {id = "ansatz_rls", preconds = [], rew_ord = ("dummy_ord",Rewrite_Ord.dummy_ord), 
    11.6  	  erls = Rule_Set.Empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
    11.7 -	  rules = 
    11.8 -	   [\<^rule_thm>\<open>ansatz_2nd_order\<close>,
    11.9 -	    \<^rule_thm>\<open>ansatz_3rd_order\<close>
   11.10 -	   ], 
   11.11 -	 scr = Rule.Empty_Prog});
   11.12 +	  rules = [
   11.13 +      \<^rule_thm>\<open>ansatz_2nd_order\<close>,
   11.14 +	    \<^rule_thm>\<open>ansatz_3rd_order\<close>], 
   11.15 +	  scr = Rule.Empty_Prog});
   11.16  
   11.17  val equival_trans = prep_rls'(
   11.18    Rule_Def.Repeat {id = "equival_trans", preconds = [], rew_ord = ("dummy_ord",Rewrite_Ord.dummy_ord), 
   11.19  	  erls = Rule_Set.Empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
   11.20 -	  rules = 
   11.21 -	   [\<^rule_thm>\<open>equival_trans_2nd_order\<close>,
   11.22 -	    \<^rule_thm>\<open>equival_trans_3rd_order\<close>
   11.23 -	   ], 
   11.24 -	 scr = Rule.Empty_Prog});
   11.25 +	  rules = [
   11.26 +      \<^rule_thm>\<open>equival_trans_2nd_order\<close>,
   11.27 +	    \<^rule_thm>\<open>equival_trans_3rd_order\<close>], 
   11.28 +	  scr = Rule.Empty_Prog});
   11.29  
   11.30  val multiply_ansatz = prep_rls'(
   11.31    Rule_Def.Repeat {id = "multiply_ansatz", preconds = [], rew_ord = ("dummy_ord",Rewrite_Ord.dummy_ord), 
   11.32  	  erls = Rule_Set.Empty,
   11.33  	  srls = Rule_Set.Empty, calc = [], errpatts = [],
   11.34 -	  rules = 
   11.35 -	   [\<^rule_thm>\<open>multiply_2nd_order\<close>
   11.36 -	   ], 
   11.37 -	 scr = Rule.Empty_Prog});
   11.38 +	  rules = [
   11.39 +      \<^rule_thm>\<open>multiply_2nd_order\<close>], 
   11.40 +	  scr = Rule.Empty_Prog});
   11.41  \<close>
   11.42  
   11.43  text \<open>store the rule set for math engine\<close>
   11.44 @@ -160,28 +157,26 @@
   11.45  subsection \<open>MethodC\<close>
   11.46  text \<open>rule set for functions called in the Program\<close>
   11.47  ML \<open>
   11.48 -  val srls_partial_fraction = Rule_Def.Repeat {id="srls_partial_fraction", 
   11.49 -    preconds = [],
   11.50 -    rew_ord = ("termlessI",termlessI),
   11.51 -    erls = Rule_Set.append_rules "erls_in_srls_partial_fraction" Rule_Set.empty
   11.52 -      [(*for asm in NTH_CONS ...*)
   11.53 -       \<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"),
   11.54 -       (*2nd NTH_CONS pushes n+-1 into asms*)
   11.55 -       \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_")], 
   11.56 -    srls = Rule_Set.Empty, calc = [], errpatts = [],
   11.57 -    rules = [
   11.58 -       \<^rule_thm>\<open>NTH_CONS\<close>,
   11.59 -       \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
   11.60 -       \<^rule_thm>\<open>NTH_NIL\<close>,
   11.61 -       \<^rule_eval>\<open>Prog_Expr.lhs\<close> (Prog_Expr.eval_lhs "eval_lhs_"),
   11.62 -       \<^rule_eval>\<open>Prog_Expr.rhs\<close> (Prog_Expr.eval_rhs"eval_rhs_"),
   11.63 -       \<^rule_eval>\<open>Prog_Expr.argument_in\<close> (Prog_Expr.eval_argument_in "Prog_Expr.argument_in"),
   11.64 -       \<^rule_eval>\<open>get_denominator\<close> (eval_get_denominator "#get_denominator"),
   11.65 -       \<^rule_eval>\<open>get_numerator\<close> (eval_get_numerator "#get_numerator"),
   11.66 -       \<^rule_eval>\<open>factors_from_solution\<close>
   11.67 -         (eval_factors_from_solution "#factors_from_solution")
   11.68 -       ],
   11.69 -    scr = Rule.Empty_Prog};
   11.70 +val srls_partial_fraction = Rule_Def.Repeat {id="srls_partial_fraction", 
   11.71 +  preconds = [],
   11.72 +  rew_ord = ("termlessI",termlessI),
   11.73 +  erls = Rule_Set.append_rules "erls_in_srls_partial_fraction" Rule_Set.empty
   11.74 +    [(*for asm in NTH_CONS ...*)
   11.75 +     \<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"),
   11.76 +     (*2nd NTH_CONS pushes n+-1 into asms*)
   11.77 +     \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_")], 
   11.78 +  srls = Rule_Set.Empty, calc = [], errpatts = [],
   11.79 +  rules = [
   11.80 +     \<^rule_thm>\<open>NTH_CONS\<close>,
   11.81 +     \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
   11.82 +     \<^rule_thm>\<open>NTH_NIL\<close>,
   11.83 +     \<^rule_eval>\<open>Prog_Expr.lhs\<close> (Prog_Expr.eval_lhs "eval_lhs_"),
   11.84 +     \<^rule_eval>\<open>Prog_Expr.rhs\<close> (Prog_Expr.eval_rhs"eval_rhs_"),
   11.85 +     \<^rule_eval>\<open>Prog_Expr.argument_in\<close> (Prog_Expr.eval_argument_in "Prog_Expr.argument_in"),
   11.86 +     \<^rule_eval>\<open>get_denominator\<close> (eval_get_denominator "#get_denominator"),
   11.87 +     \<^rule_eval>\<open>get_numerator\<close> (eval_get_numerator "#get_numerator"),
   11.88 +     \<^rule_eval>\<open>factors_from_solution\<close> (eval_factors_from_solution "#factors_from_solution")],
   11.89 +  scr = Rule.Empty_Prog};
   11.90  \<close>
   11.91  
   11.92  (* current version, error outcommented *)
    12.1 --- a/src/Tools/isac/Knowledge/Poly.thy	Mon Aug 09 14:20:20 2021 +0200
    12.2 +++ b/src/Tools/isac/Knowledge/Poly.thy	Tue Aug 10 09:43:07 2021 +0200
    12.3 @@ -659,7 +659,7 @@
    12.4  
    12.5  (*("is_polyexp", ("Poly.is_polyexp", eval_is_polyexp ""))*)
    12.6  fun eval_is_polyexp (thmid:string) _ 
    12.7 -		       (t as (Const (\<^const_name>\<open>Poly.is_polyexp\<close>, _) $ arg)) thy = 
    12.8 +		       (t as (Const (\<^const_name>\<open>is_polyexp\<close>, _) $ arg)) thy = 
    12.9      if is_polyexp arg
   12.10      then SOME (TermC.mk_thmid thmid (UnparseC.term_in_thy thy arg) "", 
   12.11  	         HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True})))
   12.12 @@ -673,7 +673,7 @@
   12.13  (*WN.18.6.03 *)
   12.14  (*("is_addUnordered", ("Poly.is_addUnordered", eval_is_addUnordered ""))*)
   12.15  fun eval_is_addUnordered (thmid:string) _ 
   12.16 -		       (t as (Const (\<^const_name>\<open>Poly.is_addUnordered\<close>, _) $ arg)) thy = 
   12.17 +		       (t as (Const (\<^const_name>\<open>is_addUnordered\<close>, _) $ arg)) thy = 
   12.18      if is_addUnordered arg
   12.19      then SOME (TermC.mk_thmid thmid (UnparseC.term_in_thy thy arg) "", 
   12.20  	         HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True})))
   12.21 @@ -682,7 +682,7 @@
   12.22    | eval_is_addUnordered _ _ _ _ = NONE; 
   12.23  
   12.24  fun eval_is_multUnordered (thmid:string) _ 
   12.25 -		       (t as (Const (\<^const_name>\<open>Poly.is_multUnordered\<close>, _) $ arg)) thy = 
   12.26 +		       (t as (Const (\<^const_name>\<open>is_multUnordered\<close>, _) $ arg)) thy = 
   12.27      if is_multUnordered arg
   12.28      then SOME (TermC.mk_thmid thmid (UnparseC.term_in_thy thy arg) "", 
   12.29  	         HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True})))
   12.30 @@ -705,16 +705,16 @@
   12.31  val calculate_Poly = Rule_Set.append_rules "calculate_PolyFIXXXME.not.impl." Rule_Set.empty [];
   12.32  
   12.33  (*.for evaluation of conditions in rewrite rules.*)
   12.34 -val Poly_erls = Rule_Set.append_rules "Poly_erls" Atools_erls
   12.35 -  [\<^rule_eval>\<open>HOL.eq\<close> (Prog_Expr.eval_equal "#equal_"),
   12.36 +val Poly_erls = Rule_Set.append_rules "Poly_erls" Atools_erls [
   12.37 +  \<^rule_eval>\<open>HOL.eq\<close> (Prog_Expr.eval_equal "#equal_"),
   12.38    \<^rule_thm>\<open>real_unari_minus\<close>,
   12.39    \<^rule_eval>\<open>plus\<close> (eval_binop "#add_"),
   12.40    \<^rule_eval>\<open>minus\<close> (eval_binop "#sub_"),
   12.41    \<^rule_eval>\<open>times\<close> (eval_binop "#mult_"),
   12.42    \<^rule_eval>\<open>powr\<close> (eval_binop "#power_")];
   12.43  
   12.44 -val poly_crls = Rule_Set.append_rules "poly_crls" Atools_crls
   12.45 -  [\<^rule_eval>\<open>HOL.eq\<close> (Prog_Expr.eval_equal "#equal_"),
   12.46 +val poly_crls = Rule_Set.append_rules "poly_crls" Atools_crls [
   12.47 +  \<^rule_eval>\<open>HOL.eq\<close> (Prog_Expr.eval_equal "#equal_"),
   12.48    \<^rule_thm>\<open>real_unari_minus\<close>,
   12.49    \<^rule_eval>\<open>plus\<close> (eval_binop "#add_"),
   12.50    \<^rule_eval>\<open>minus\<close> (eval_binop "#sub_"),
   12.51 @@ -725,28 +725,25 @@
   12.52  val expand =
   12.53    Rule_Def.Repeat {id = "expand", preconds = [], rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
   12.54        erls = Rule_Set.empty,srls = Rule_Set.Empty, calc = [], errpatts = [],
   12.55 -      rules = [\<^rule_thm>\<open>distrib_right\<close>,
   12.56 -	       (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
   12.57 -	       \<^rule_thm>\<open>distrib_left\<close>
   12.58 -	       (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
   12.59 -	       ], scr = Rule.Empty_Prog};
   12.60 +      rules = [
   12.61 +        \<^rule_thm>\<open>distrib_right\<close>, (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
   12.62 +	      \<^rule_thm>\<open>distrib_left\<close> (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)],
   12.63 +      scr = Rule.Empty_Prog};
   12.64  
   12.65  (* erls for calculate_Rational + etc *)
   12.66  val powers_erls =
   12.67    Rule_Def.Repeat {id = "powers_erls", preconds = [], rew_ord = ("dummy_ord",Rewrite_Ord.dummy_ord), 
   12.68        erls = Rule_Set.empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
   12.69 -      rules = 
   12.70 -        [Rule.Eval ("Prog_Expr.matches", Prog_Expr.eval_matches "#matches_"),
   12.71 -	       Rule.Eval ("Prog_Expr.is_atom", Prog_Expr.eval_is_atom "#is_atom_"),
   12.72 -	       Rule.Eval ("Prog_Expr.is_num", Prog_Expr.eval_is_num "#is_num_"),
   12.73 -	       Rule.Eval ("Prog_Expr.is_even", Prog_Expr.eval_is_even "#is_even_"),
   12.74 -	       Rule.Eval ("Orderings.ord_class.less", Prog_Expr.eval_equ "#less_"),
   12.75 -	       Rule.Thm ("not_false",  @{thm not_false}),
   12.76 -	       Rule.Thm ("not_true",  @{thm not_true}),
   12.77 -	       Rule.Eval ("Groups.plus_class.plus", (**)eval_binop "#add_")
   12.78 -	       ],
   12.79 -      scr = Rule.Empty_Prog
   12.80 -      };
   12.81 +      rules = [
   12.82 +        \<^rule_eval>\<open>matches\<close> (Prog_Expr.eval_matches "#matches_"),
   12.83 +        \<^rule_eval>\<open>is_atom\<close> (Prog_Expr.eval_is_atom "#is_atom_"),
   12.84 +        \<^rule_eval>\<open>is_num\<close> (Prog_Expr.eval_is_num "#is_num_"),
   12.85 +        \<^rule_eval>\<open>is_even\<close> (Prog_Expr.eval_is_even "#is_even_"),
   12.86 +        \<^rule_eval>\<open>ord_class.less\<close> (Prog_Expr.eval_equ "#less_"),
   12.87 +        \<^rule_thm>\<open>not_false\<close>,
   12.88 +        \<^rule_thm>\<open>not_true\<close>,
   12.89 +        \<^rule_eval>\<open>plus_class.plus\<close> (eval_binop "#add_")],
   12.90 +      scr = Rule.Empty_Prog};
   12.91  
   12.92  \<close> ML \<open>
   12.93  val discard_minus =
   12.94 @@ -762,112 +759,77 @@
   12.95        rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
   12.96        erls = powers_erls, srls = Rule_Set.Empty,
   12.97        calc = [], errpatts = [],
   12.98 -      rules =
   12.99 -        [\<^rule_thm>\<open>real_plus_binom_pow4\<close>,
  12.100 -	           (*"(a + b) \<up> 4 = ... "*)
  12.101 -	         \<^rule_thm>\<open>real_plus_binom_pow5\<close>,
  12.102 -	           (*"(a + b) \<up> 5 = ... "*)
  12.103 -	         \<^rule_thm>\<open>real_plus_binom_pow3\<close>,
  12.104 -	           (*"(a + b) \<up> 3 = a \<up> 3 + 3*a \<up> 2*b + 3*a*b \<up> 2 + b \<up> 3" *)
  12.105 -	         (*WN071229 changed/removed for Schaerding -----vvv*)
  12.106 -	         (*\<^rule_thm>\<open>real_plus_binom_pow2\<close>,*)
  12.107 -	           (*"(a + b) \<up> 2 = a \<up> 2 + 2*a*b + b \<up> 2"*)
  12.108 -	         \<^rule_thm>\<open>real_plus_binom_pow2\<close>,
  12.109 -	           (*"(a + b) \<up> 2 = (a + b) * (a + b)"*)
  12.110 -	         (*\<^rule_thm>\<open>real_plus_minus_binom1_p_p\<close>,*)
  12.111 -	           (*"(a + b)*(a + -1 * b) = a \<up> 2 + -1*b \<up> 2"*)
  12.112 -	         (*\<^rule_thm>\<open>real_plus_minus_binom2_p_p\<close>,*)
  12.113 -	           (*"(a + -1 * b)*(a + b) = a \<up> 2 + -1*b \<up> 2"*)
  12.114 -	         (*WN071229 changed/removed for Schaerding -----\<up>*)
  12.115 -	      
  12.116 -	         \<^rule_thm>\<open>distrib_right\<close>,
  12.117 -	           (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  12.118 -	         \<^rule_thm>\<open>distrib_left\<close>,
  12.119 -	           (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  12.120 -	       
  12.121 -	         \<^rule_thm>\<open>realpow_multI\<close>,
  12.122 -	           (*"(r * s) \<up> n = r \<up> n * s \<up> n"*)
  12.123 -	         \<^rule_thm>\<open>realpow_pow\<close>,
  12.124 -	           (*"(a \<up> b) \<up> c = a \<up> (b * c)"*)
  12.125 -(**)
  12.126 -	         \<^rule_thm>\<open>realpow_minus_even\<close>, (*"n is_even ==> (- r) \<up> n = r \<up> n"*)
  12.127 -	         \<^rule_thm>\<open>realpow_minus_odd\<close> (*"Not (n is_even) ==> (- r) \<up> n = -1 * r \<up> n"*)
  12.128 -(**)
  12.129 -	       ], scr = Rule.Empty_Prog};
  12.130 +      rules = [
  12.131 +        \<^rule_thm>\<open>real_plus_binom_pow4\<close>, (*"(a + b) \<up> 4 = ... "*)
  12.132 +        \<^rule_thm>\<open>real_plus_binom_pow5\<close>, (*"(a + b) \<up> 5 = ... "*)
  12.133 +        \<^rule_thm>\<open>real_plus_binom_pow3\<close>, (*"(a + b) \<up> 3 = a \<up> 3 + 3*a \<up> 2*b + 3*a*b \<up> 2 + b \<up> 3" *)
  12.134 +      (*WN071229 changed/removed for Schaerding -----vvv*)
  12.135 +        (*\<^rule_thm>\<open>real_plus_binom_pow2\<close>,*) (*"(a + b) \<up> 2 = a \<up> 2 + 2*a*b + b \<up> 2"*)
  12.136 +        \<^rule_thm>\<open>real_plus_binom_pow2\<close>, (*"(a + b) \<up> 2 = (a + b) * (a + b)"*)
  12.137 +        (*\<^rule_thm>\<open>real_plus_minus_binom1_p_p\<close>,*) (*"(a + b)*(a + -1 * b) = a \<up> 2 + -1*b \<up> 2"*)
  12.138 +        (*\<^rule_thm>\<open>real_plus_minus_binom2_p_p\<close>,*) (*"(a + -1 * b)*(a + b) = a \<up> 2 + -1*b \<up> 2"*)
  12.139 +      (*WN071229 changed/removed for Schaerding -----^^^*)
  12.140 +
  12.141 +        \<^rule_thm>\<open>distrib_right\<close>, (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  12.142 +        \<^rule_thm>\<open>distrib_left\<close>, (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  12.143 +
  12.144 +        \<^rule_thm>\<open>realpow_multI\<close>, (*"(r * s) \<up> n = r \<up> n * s \<up> n"*)
  12.145 +        \<^rule_thm>\<open>realpow_pow\<close>, (*"(a \<up> b) \<up> c = a \<up> (b * c)"*)
  12.146 +
  12.147 +        \<^rule_thm>\<open>realpow_minus_even\<close>, (*"n is_even ==> (- r) \<up> n = r \<up> n"*)
  12.148 +        \<^rule_thm>\<open>realpow_minus_odd\<close> (*"Not (n is_even) ==> (- r) \<up> n = -1 * r \<up> n"*)],
  12.149 +      scr = Rule.Empty_Prog};
  12.150  
  12.151  val expand_poly_rat_ = 
  12.152    Rule_Def.Repeat{id = "expand_poly_rat_", preconds = [], 
  12.153        rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  12.154 -      erls =  Rule_Set.append_rules "Rule_Set.empty-expand_poly_rat_" Rule_Set.empty
  12.155 -	        [Rule.Eval ("Poly.is_polyexp", eval_is_polyexp ""),
  12.156 -	         Rule.Eval ("Prog_Expr.is_even", Prog_Expr.eval_is_even "#is_even_"),
  12.157 -	         Rule.Thm ("not_false",  @{thm not_false}),
  12.158 -	         Rule.Thm ("not_true",  @{thm not_true})
  12.159 -		      ],
  12.160 +      erls =  Rule_Set.append_rules "Rule_Set.empty-expand_poly_rat_" Rule_Set.empty [
  12.161 +        \<^rule_eval>\<open>is_polyexp\<close> (eval_is_polyexp ""),
  12.162 +        \<^rule_eval>\<open>is_even\<close> (Prog_Expr.eval_is_even "#is_even_"),
  12.163 +        \<^rule_thm>\<open>not_false\<close>,
  12.164 +        \<^rule_thm>\<open>not_true\<close> ],
  12.165        srls = Rule_Set.Empty,
  12.166        calc = [], errpatts = [],
  12.167 -      rules = 
  12.168 -        [\<^rule_thm>\<open>real_plus_binom_pow4_poly\<close>,
  12.169 -	     (*"[| a is_polyexp; b is_polyexp |] ==> (a + b) \<up> 4 = ... "*)
  12.170 -	 \<^rule_thm>\<open>real_plus_binom_pow5_poly\<close>,
  12.171 -	     (*"[| a is_polyexp; b is_polyexp |] ==> (a + b) \<up> 5 = ... "*)
  12.172 -	 \<^rule_thm>\<open>real_plus_binom_pow2_poly\<close>,
  12.173 -	     (*"[| a is_polyexp; b is_polyexp |] ==>
  12.174 -		            (a + b) \<up> 2 = a \<up> 2 + 2*a*b + b \<up> 2"*)
  12.175 -	 \<^rule_thm>\<open>real_plus_binom_pow3_poly\<close>,
  12.176 -	     (*"[| a is_polyexp; b is_polyexp |] ==> 
  12.177 -			(a + b) \<up> 3 = a \<up> 3 + 3*a \<up> 2*b + 3*a*b \<up> 2 + b \<up> 3" *)
  12.178 -	 \<^rule_thm>\<open>real_plus_minus_binom1_p_p\<close>,
  12.179 -	     (*"(a + b)*(a + -1 * b) = a \<up> 2 + -1*b \<up> 2"*)
  12.180 -	 \<^rule_thm>\<open>real_plus_minus_binom2_p_p\<close>,
  12.181 -	     (*"(a + -1 * b)*(a + b) = a \<up> 2 + -1*b \<up> 2"*)
  12.182 -	      
  12.183 -	 \<^rule_thm>\<open>real_add_mult_distrib_poly\<close>,
  12.184 -	       (*"w is_polyexp ==> (z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  12.185 -	 \<^rule_thm>\<open>real_add_mult_distrib2_poly\<close>,
  12.186 -	     (*"w is_polyexp ==> w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  12.187 -	       
  12.188 -	 \<^rule_thm>\<open>realpow_multI_poly\<close>,
  12.189 -	     (*"[| r is_polyexp; s is_polyexp |] ==> 
  12.190 -		            (r * s) \<up> n = r \<up> n * s \<up> n"*)
  12.191 -	 Rule.Thm ("realpow_pow", @{thm realpow_pow}),
  12.192 -	   (*"(a \<up> b) \<up> c = a \<up> (b * c)"*)
  12.193 -	 Rule.Thm ("realpow_minus_even", @{thm realpow_minus_even}),
  12.194 -	   (*"n is_even ==> (- r) \<up> n = r \<up> n"*)
  12.195 -	 Rule.Thm ("realpow_minus_odd", @{thm realpow_minus_odd})
  12.196 -	   (*"\<not> (n is_even) ==> (- r) \<up> n = -1 * r \<up> n"*)
  12.197 -	 ], scr = Rule.Empty_Prog};
  12.198 +      rules = [
  12.199 +        \<^rule_thm>\<open>real_plus_binom_pow4_poly\<close>, (*"[| a is_polyexp; b is_polyexp |] ==> (a + b) \<up> 4 = ... "*)
  12.200 +        \<^rule_thm>\<open>real_plus_binom_pow5_poly\<close>, (*"[| a is_polyexp; b is_polyexp |] ==> (a + b) \<up> 5 = ... "*)
  12.201 +        \<^rule_thm>\<open>real_plus_binom_pow2_poly\<close>, (*"[| a is_polyexp; b is_polyexp |] ==> (a + b) \<up> 2 = a \<up> 2 + 2*a*b + b \<up> 2"*)
  12.202 +      	 \<^rule_thm>\<open>real_plus_binom_pow3_poly\<close>,
  12.203 +      	   (*"[| a is_polyexp; b is_polyexp |] ==> (a + b) \<up> 3 = a \<up> 3 + 3*a \<up> 2*b + 3*a*b \<up> 2 + b \<up> 3" *)
  12.204 +      	 \<^rule_thm>\<open>real_plus_minus_binom1_p_p\<close>, (*"(a + b)*(a + -1 * b) = a \<up> 2 + -1*b \<up> 2"*)
  12.205 +      	 \<^rule_thm>\<open>real_plus_minus_binom2_p_p\<close>, (*"(a + -1 * b)*(a + b) = a \<up> 2 + -1*b \<up> 2"*)
  12.206 +      	      
  12.207 +      	 \<^rule_thm>\<open>real_add_mult_distrib_poly\<close>, (*"w is_polyexp ==> (z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  12.208 +      	 \<^rule_thm>\<open>real_add_mult_distrib2_poly\<close>, (*"w is_polyexp ==> w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  12.209 +      	       
  12.210 +      	 \<^rule_thm>\<open>realpow_multI_poly\<close>, (*"[| r is_polyexp; s is_polyexp |] ==> (r * s) \<up> n = r \<up> n * s \<up> n"*)
  12.211 +      	 \<^rule_thm>\<open>realpow_pow\<close>, (*"(a \<up> b) \<up> c = a \<up> (b * c)"*)
  12.212 +      	 \<^rule_thm>\<open>realpow_minus_even\<close>, (*"n is_even ==> (- r) \<up> n = r \<up> n"*)
  12.213 +     	   \<^rule_thm>\<open>realpow_minus_odd\<close> (*"\<not> (n is_even) ==> (- r) \<up> n = -1 * r \<up> n"*) ],
  12.214 +      scr = Rule.Empty_Prog};
  12.215  
  12.216  val simplify_power_ = 
  12.217    Rule_Def.Repeat{id = "simplify_power_", preconds = [], 
  12.218        rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  12.219        erls = Rule_Set.empty, srls = Rule_Set.Empty,
  12.220        calc = [], errpatts = [],
  12.221 -      rules = [(*MG: Reihenfolge der folgenden 2 Rule.Thm muss so bleiben, wegen
  12.222 -		a*(a*a) --> a*a \<up> 2 und nicht a*(a*a) --> a \<up> 2*a *)
  12.223 -	       \<^rule_thm_sym>\<open>realpow_twoI\<close>,	
  12.224 -	       (*"r * r = r \<up> 2"*)
  12.225 -	       \<^rule_thm>\<open>realpow_twoI_assoc_l\<close>,
  12.226 -	       (*"r * (r * s) = r \<up> 2 * s"*)
  12.227 -
  12.228 -	       \<^rule_thm>\<open>realpow_plus_1\<close>,		
  12.229 -	       (*"r * r \<up> n = r \<up> (n + 1)"*)
  12.230 -	       \<^rule_thm>\<open>realpow_plus_1_assoc_l\<close>,
  12.231 -	       (*"r * (r \<up> m * s) = r \<up> (1 + m) * s"*)
  12.232 -	       (*MG 9.7.03: neues Rule.Thm wegen a*(a*(a*b)) --> a \<up> 2*(a*b) *)
  12.233 -	       \<^rule_thm>\<open>realpow_plus_1_assoc_l2\<close>,
  12.234 -	       (*"r \<up> m * (r * s) = r \<up> (1 + m) * s"*)
  12.235 -
  12.236 -	       \<^rule_thm_sym>\<open>realpow_addI\<close>,
  12.237 -	       (*"r \<up> n * r \<up> m = r \<up> (n + m)"*)
  12.238 -	       \<^rule_thm>\<open>realpow_addI_assoc_l\<close>,
  12.239 -	       (*"r \<up> n * (r \<up> m * s) = r \<up> (n + m) * s"*)
  12.240 -	       
  12.241 -	       (* ist in expand_poly - wird hier aber auch gebraucht, wegen: 
  12.242 -		  "r * r = r \<up> 2" wenn r=a \<up> b*)
  12.243 -	       \<^rule_thm>\<open>realpow_pow\<close>
  12.244 -	       (*"(a \<up> b) \<up> c = a \<up> (b * c)"*)
  12.245 -	       ], scr = Rule.Empty_Prog};
  12.246 +      rules = [
  12.247 +         (*MG: Reihenfolge der folgenden 2 Rule.Thm muss so bleiben, wegen
  12.248 +	        	a*(a*a) --> a*a \<up> 2 und nicht a*(a*a) --> a \<up> 2*a *)
  12.249 +        \<^rule_thm_sym>\<open>realpow_twoI\<close>, (*"r * r = r \<up> 2"*)
  12.250 +        \<^rule_thm>\<open>realpow_twoI_assoc_l\<close>, (*"r * (r * s) = r \<up> 2 * s"*)
  12.251 +        
  12.252 +        \<^rule_thm>\<open>realpow_plus_1\<close>, (*"r * r \<up> n = r \<up> (n + 1)"*)
  12.253 +        \<^rule_thm>\<open>realpow_plus_1_assoc_l\<close>, (*"r * (r \<up> m * s) = r \<up> (1 + m) * s"*)
  12.254 +        (*MG 9.7.03: neues Rule.Thm wegen a*(a*(a*b)) --> a \<up> 2*(a*b) *)
  12.255 +        \<^rule_thm>\<open>realpow_plus_1_assoc_l2\<close>, (*"r \<up> m * (r * s) = r \<up> (1 + m) * s"*)
  12.256 +        
  12.257 +        \<^rule_thm_sym>\<open>realpow_addI\<close>, (*"r \<up> n * r \<up> m = r \<up> (n + m)"*)
  12.258 +        \<^rule_thm>\<open>realpow_addI_assoc_l\<close>, (*"r \<up> n * (r \<up> m * s) = r \<up> (n + m) * s"*)
  12.259 +        
  12.260 +        (* ist in expand_poly - wird hier aber auch gebraucht, wegen: "r * r = r \<up> 2" wenn r=a \<up> b*)
  12.261 +        \<^rule_thm>\<open>realpow_pow\<close> (*"(a \<up> b) \<up> c = a \<up> (b * c)"*)], 
  12.262 +      scr = Rule.Empty_Prog};
  12.263  
  12.264  val calc_add_mult_pow_ = 
  12.265    Rule_Def.Repeat{id = "calc_add_mult_pow_", preconds = [], 
  12.266 @@ -878,10 +840,11 @@
  12.267  	      ("POWER", (\<^const_name>\<open>powr\<close>, eval_binop "#power_"))
  12.268  	      ],
  12.269        errpatts = [],
  12.270 -      rules = [\<^rule_eval>\<open>plus\<close> (eval_binop "#add_"),
  12.271 -	       \<^rule_eval>\<open>times\<close> (eval_binop "#mult_"),
  12.272 -	       \<^rule_eval>\<open>powr\<close> (eval_binop "#power_")
  12.273 -	       ], scr = Rule.Empty_Prog};
  12.274 +      rules = [
  12.275 +        \<^rule_eval>\<open>plus\<close> (eval_binop "#add_"),
  12.276 +	      \<^rule_eval>\<open>times\<close> (eval_binop "#mult_"),
  12.277 +	      \<^rule_eval>\<open>powr\<close> (eval_binop "#power_")],
  12.278 +      scr = Rule.Empty_Prog};
  12.279  
  12.280  val reduce_012_mult_ = 
  12.281    Rule_Def.Repeat{id = "reduce_012_mult_", preconds = [], 
  12.282 @@ -889,15 +852,11 @@
  12.283        erls = Rule_Set.empty,srls = Rule_Set.Empty,
  12.284        calc = [], errpatts = [],
  12.285        rules = [(* MG: folgende Rule.Thm müssen hier stehen bleiben: *)
  12.286 -               \<^rule_thm>\<open>mult_1_right\<close>,
  12.287 -	       (*"z * 1 = z"*) (*wegen "a * b * b \<up> (-1) + a"*) 
  12.288 -	       \<^rule_thm>\<open>realpow_zeroI\<close>,
  12.289 -	       (*"r \<up> 0 = 1"*) (*wegen "a*a \<up> (-1)*c + b + c"*)
  12.290 -	       \<^rule_thm>\<open>realpow_oneI\<close>,
  12.291 -	       (*"r \<up> 1 = r"*)
  12.292 -	       \<^rule_thm>\<open>realpow_eq_oneI\<close>
  12.293 -	       (*"1 \<up> n = 1"*)
  12.294 -	       ], scr = Rule.Empty_Prog};
  12.295 +         \<^rule_thm>\<open>mult_1_right\<close>, (*"z * 1 = z"*) (*wegen "a * b * b \<up> (-1) + a"*) 
  12.296 +	       \<^rule_thm>\<open>realpow_zeroI\<close>, (*"r \<up> 0 = 1"*) (*wegen "a*a \<up> (-1)*c + b + c"*)
  12.297 +	       \<^rule_thm>\<open>realpow_oneI\<close>, (*"r \<up> 1 = r"*)
  12.298 +	       \<^rule_thm>\<open>realpow_eq_oneI\<close> (*"1 \<up> n = 1"*)],
  12.299 +      scr = Rule.Empty_Prog};
  12.300  
  12.301  val collect_numerals_ = 
  12.302    Rule_Def.Repeat{id = "collect_numerals_", preconds = [], 
  12.303 @@ -905,108 +864,77 @@
  12.304        erls = Atools_erls, srls = Rule_Set.Empty,
  12.305        calc = [("PLUS"  , (\<^const_name>\<open>plus\<close>, eval_binop "#add_"))
  12.306  	      ], errpatts = [],
  12.307 -      rules = 
  12.308 -        [\<^rule_thm>\<open>real_num_collect\<close>, 
  12.309 -	     (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
  12.310 -	 \<^rule_thm>\<open>real_num_collect_assoc_r\<close>,
  12.311 -	     (*"[| l is_const; m is_const |] ==>  \
  12.312 -					\(k + m * n) + l * n = k + (l + m)*n"*)
  12.313 -	 \<^rule_thm>\<open>real_one_collect\<close>,	
  12.314 -	     (*"m is_const ==> n + m * n = (1 + m) * n"*)
  12.315 -	 \<^rule_thm>\<open>real_one_collect_assoc_r\<close>, 
  12.316 -	     (*"m is_const ==> (k + n) + m * n = k + (m + 1) * n"*)
  12.317 +      rules = [
  12.318 +        \<^rule_thm>\<open>real_num_collect\<close>, (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
  12.319 +	      \<^rule_thm>\<open>real_num_collect_assoc_r\<close>,
  12.320 +	        (*"[| l is_const; m is_const |] ==> (k + m * n) + l * n = k + (l + m)*n"*)
  12.321 +        \<^rule_thm>\<open>real_one_collect\<close>, (*"m is_const ==> n + m * n = (1 + m) * n"*)
  12.322 +        \<^rule_thm>\<open>real_one_collect_assoc_r\<close>, (*"m is_const ==> (k + n) + m * n = k + (m + 1) * n"*)
  12.323  
  12.324 -         \<^rule_eval>\<open>plus\<close> (eval_binop "#add_"),
  12.325 +        \<^rule_eval>\<open>plus\<close> (eval_binop "#add_"),
  12.326  
  12.327 -	 (*MG: Reihenfolge der folgenden 2 Rule.Thm muss so bleiben, wegen
  12.328 -		     (a+a)+a --> a + 2*a --> 3*a and not (a+a)+a --> 2*a + a *)
  12.329 -         \<^rule_thm>\<open>real_mult_2_assoc_r\<close>,
  12.330 -	     (*"(k + z1) + z1 = k + 2 * z1"*)
  12.331 -	 \<^rule_thm_sym>\<open>real_mult_2\<close>
  12.332 -	     (*"z1 + z1 = 2 * z1"*)
  12.333 -	], scr = Rule.Empty_Prog};
  12.334 +      	 (*MG: Reihenfolge der folgenden 2 Rule.Thm muss so bleiben, wegen
  12.335 +		       (a+a)+a --> a + 2*a --> 3*a and not (a+a)+a --> 2*a + a *)
  12.336 +        \<^rule_thm>\<open>real_mult_2_assoc_r\<close>, (*"(k + z1) + z1 = k + 2 * z1"*)
  12.337 +      	 \<^rule_thm_sym>\<open>real_mult_2\<close> (*"z1 + z1 = 2 * z1"*)],
  12.338 +      scr = Rule.Empty_Prog};
  12.339  
  12.340  val reduce_012_ = 
  12.341    Rule_Def.Repeat{id = "reduce_012_", preconds = [], 
  12.342        rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  12.343        erls = Rule_Set.empty,srls = Rule_Set.Empty, calc = [], errpatts = [],
  12.344 -      rules = [\<^rule_thm>\<open>mult_1_left\<close>,                 
  12.345 -	       (*"1 * z = z"*)
  12.346 -	       \<^rule_thm>\<open>mult_zero_left\<close>,        
  12.347 -	       (*"0 * z = 0"*)
  12.348 -	       \<^rule_thm>\<open>mult_zero_right\<close>,
  12.349 -	       (*"z * 0 = 0"*)
  12.350 -	       \<^rule_thm>\<open>add_0_left\<close>,
  12.351 -	       (*"0 + z = z"*)
  12.352 -	       \<^rule_thm>\<open>add_0_right\<close>,
  12.353 -	       (*"z + 0 = z"*) (*wegen a+b-b --> a+(1-1)*b --> a+0 --> a*)
  12.354 -
  12.355 -	       (*\<^rule_thm>\<open>realpow_oneI\<close>*)
  12.356 -	       (*"?r \<up> 1 = ?r"*)
  12.357 -	       \<^rule_thm>\<open>division_ring_divide_zero\<close>
  12.358 -	       (*"0 / ?x = 0"*)
  12.359 -	       ], scr = Rule.Empty_Prog};
  12.360 +      rules = [
  12.361 +        \<^rule_thm>\<open>mult_1_left\<close>, (*"1 * z = z"*)
  12.362 +	      \<^rule_thm>\<open>mult_zero_left\<close>, (*"0 * z = 0"*)
  12.363 +	      \<^rule_thm>\<open>mult_zero_right\<close>, (*"z * 0 = 0"*)
  12.364 +	      \<^rule_thm>\<open>add_0_left\<close>, (*"0 + z = z"*)
  12.365 +	      \<^rule_thm>\<open>add_0_right\<close>, (*"z + 0 = z"*) (*wegen a+b-b --> a+(1-1)*b --> a+0 --> a*)
  12.366 +   
  12.367 +	      (*\<^rule_thm>\<open>realpow_oneI\<close>*) (*"?r \<up> 1 = ?r"*)
  12.368 +	      \<^rule_thm>\<open>division_ring_divide_zero\<close> (*"0 / ?x = 0"*)],
  12.369 +      scr = Rule.Empty_Prog};
  12.370  
  12.371  val discard_parentheses1 = 
  12.372 -    Rule_Set.append_rules "discard_parentheses1" Rule_Set.empty 
  12.373 -	       [\<^rule_thm_sym>\<open>mult.assoc\<close>
  12.374 -		(*"?z1.1 * (?z2.1 * ?z3.1) = ?z1.1 * ?z2.1 * ?z3.1"*)
  12.375 -		(*\<^rule_thm_sym>\<open>add.assoc\<close>*)
  12.376 -		(*"?z1.1 + (?z2.1 + ?z3.1) = ?z1.1 + ?z2.1 + ?z3.1"*)
  12.377 -		 ];
  12.378 +    Rule_Set.append_rules "discard_parentheses1" Rule_Set.empty [
  12.379 +      \<^rule_thm_sym>\<open>mult.assoc\<close> (*"?z1.1 * (?z2.1 * ?z3.1) = ?z1.1 * ?z2.1 * ?z3.1"*)
  12.380 +		   (*\<^rule_thm_sym>\<open>add.assoc\<close>*) (*"?z1.1 + (?z2.1 + ?z3.1) = ?z1.1 + ?z2.1 + ?z3.1"*)];
  12.381  
  12.382  val expand_poly =
  12.383    Rule_Def.Repeat{id = "expand_poly", preconds = [], 
  12.384        rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  12.385        erls = powers_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  12.386 -      rules = 
  12.387 -        [Rule.Thm ("distrib_right" , @{thm distrib_right}),
  12.388 -	       (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  12.389 -	       \<^rule_thm>\<open>distrib_left\<close>,
  12.390 -	       (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  12.391 -	       (*Rule.Thm ("distrib_right1", @{thm distrib_right}1),
  12.392 -		....... 18.3.03 undefined???*)
  12.393 +      rules = [
  12.394 +        \<^rule_thm>\<open>distrib_right\<close>, (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  12.395 +        \<^rule_thm>\<open>distrib_left\<close>, (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  12.396  
  12.397 -	       \<^rule_thm>\<open>real_plus_binom_pow2\<close>,
  12.398 -	       (*"(a + b) \<up> 2 = a \<up> 2 + 2*a*b + b \<up> 2"*)
  12.399 -	       \<^rule_thm>\<open>real_minus_binom_pow2_p\<close>,
  12.400 -	       (*"(a - b) \<up> 2 = a \<up> 2 + -2*a*b + b \<up> 2"*)
  12.401 -	       \<^rule_thm>\<open>real_plus_minus_binom1_p\<close>,
  12.402 -	       (*"(a + b)*(a - b) = a \<up> 2 + -1*b \<up> 2"*)
  12.403 -	       \<^rule_thm>\<open>real_plus_minus_binom2_p\<close>,
  12.404 -	       (*"(a - b)*(a + b) = a \<up> 2 + -1*b \<up> 2"*)
  12.405 +        \<^rule_thm>\<open>real_plus_binom_pow2\<close>, (*"(a + b) \<up> 2 = a \<up> 2 + 2*a*b + b \<up> 2"*)
  12.406 +        \<^rule_thm>\<open>real_minus_binom_pow2_p\<close>, (*"(a - b) \<up> 2 = a \<up> 2 + -2*a*b + b \<up> 2"*)
  12.407 +        \<^rule_thm>\<open>real_plus_minus_binom1_p\<close>, (*"(a + b)*(a - b) = a \<up> 2 + -1*b \<up> 2"*)
  12.408 +        \<^rule_thm>\<open>real_plus_minus_binom2_p\<close>, (*"(a - b)*(a + b) = a \<up> 2 + -1*b \<up> 2"*)
  12.409  
  12.410 -	       \<^rule_thm>\<open>minus_minus\<close> (*"- (- ?z) = ?z"*),
  12.411 -	       \<^rule_thm>\<open>real_diff_minus\<close> (*"a - b = a + -1 * b"*),
  12.412 -         \<^rule_thm>\<open>real_mult_minus1_sym\<close> (*"\<not>(z is_const) ==> - (z::real) = -1 * z"*)
  12.413 +        \<^rule_thm>\<open>minus_minus\<close> (*"- (- ?z) = ?z"*),
  12.414 +        \<^rule_thm>\<open>real_diff_minus\<close> (*"a - b = a + -1 * b"*),
  12.415 +        \<^rule_thm>\<open>real_mult_minus1_sym\<close> (*"\<not>(z is_const) ==> - (z::real) = -1 * z"*)
  12.416  
  12.417 -	       (*\<^rule_thm>\<open>real_minus_add_distrib\<close>,*)
  12.418 -	       (*"- (?x + ?y) = - ?x + - ?y"*)
  12.419 -	       (*\<^rule_thm>\<open>real_diff_plus\<close>*)
  12.420 -	       (*"a - b = a + -b"*)
  12.421 -	       ], scr = Rule.Empty_Prog};
  12.422 +	       (*\<^rule_thm>\<open>real_minus_add_distrib\<close>,*) (*"- (?x + ?y) = - ?x + - ?y"*)
  12.423 +	       (*\<^rule_thm>\<open>real_diff_plus\<close>*) (*"a - b = a + -b"*)],
  12.424 +      scr = Rule.Empty_Prog};
  12.425  
  12.426  val simplify_power = 
  12.427    Rule_Def.Repeat{id = "simplify_power", preconds = [], 
  12.428        rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  12.429        erls = Rule_Set.empty, srls = Rule_Set.Empty,
  12.430        calc = [], errpatts = [],
  12.431 -      rules = [\<^rule_thm>\<open>realpow_multI\<close>,
  12.432 -	       (*"(r * s) \<up> n = r \<up> n * s \<up> n"*)
  12.433 -	       
  12.434 -	       \<^rule_thm_sym>\<open>realpow_twoI\<close>,	
  12.435 -	       (*"r1 * r1 = r1 \<up> 2"*)
  12.436 -	       \<^rule_thm>\<open>realpow_plus_1\<close>,		
  12.437 -	       (*"r * r \<up> n = r \<up> (n + 1)"*)
  12.438 -	       \<^rule_thm>\<open>realpow_pow\<close>,
  12.439 -	       (*"(a \<up> b) \<up> c = a \<up> (b * c)"*)
  12.440 -	       \<^rule_thm_sym>\<open>realpow_addI\<close>,
  12.441 -	       (*"r \<up> n * r \<up> m = r \<up> (n + m)"*)
  12.442 -	       \<^rule_thm>\<open>realpow_oneI\<close>,
  12.443 -	       (*"r \<up> 1 = r"*)
  12.444 -	       \<^rule_thm>\<open>realpow_eq_oneI\<close>
  12.445 -	       (*"1 \<up> n = 1"*)
  12.446 -	       ], scr = Rule.Empty_Prog};
  12.447 +      rules = [
  12.448 +        \<^rule_thm>\<open>realpow_multI\<close>, (*"(r * s) \<up> n = r \<up> n * s \<up> n"*)
  12.449 +
  12.450 +        \<^rule_thm_sym>\<open>realpow_twoI\<close>, (*"r1 * r1 = r1 \<up> 2"*)
  12.451 +        \<^rule_thm>\<open>realpow_plus_1\<close>, (*"r * r \<up> n = r \<up> (n + 1)"*)
  12.452 +        \<^rule_thm>\<open>realpow_pow\<close>, (*"(a \<up> b) \<up> c = a \<up> (b * c)"*)
  12.453 +        \<^rule_thm_sym>\<open>realpow_addI\<close>, (*"r \<up> n * r \<up> m = r \<up> (n + m)"*)
  12.454 +        \<^rule_thm>\<open>realpow_oneI\<close>, (*"r \<up> 1 = r"*)
  12.455 +        \<^rule_thm>\<open>realpow_eq_oneI\<close> (*"1 \<up> n = 1"*)],
  12.456 +      scr = Rule.Empty_Prog};
  12.457  
  12.458  val collect_numerals = 
  12.459    Rule_Def.Repeat{id = "collect_numerals", preconds = [], 
  12.460 @@ -1016,19 +944,16 @@
  12.461  	      ("TIMES" , (\<^const_name>\<open>times\<close>, eval_binop "#mult_")),
  12.462  	      ("POWER", (\<^const_name>\<open>powr\<close>, eval_binop "#power_"))
  12.463  	      ], errpatts = [],
  12.464 -      rules = [\<^rule_thm>\<open>real_num_collect\<close>, 
  12.465 -	       (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
  12.466 -	       \<^rule_thm>\<open>real_num_collect_assoc\<close>,
  12.467 -	       (*"[| l is_const; m is_const |] ==>  
  12.468 -				l * n + (m * n + k) =  (l + m) * n + k"*)
  12.469 -	       \<^rule_thm>\<open>real_one_collect\<close>,	
  12.470 -	       (*"m is_const ==> n + m * n = (1 + m) * n"*)
  12.471 -	       \<^rule_thm>\<open>real_one_collect_assoc\<close>, 
  12.472 -	       (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  12.473 -	       \<^rule_eval>\<open>plus\<close> (eval_binop "#add_"), 
  12.474 -	       \<^rule_eval>\<open>times\<close> (eval_binop "#mult_"),
  12.475 -	       \<^rule_eval>\<open>powr\<close> (eval_binop "#power_")
  12.476 -	       ], scr = Rule.Empty_Prog};
  12.477 +      rules =[
  12.478 +        \<^rule_thm>\<open>real_num_collect\<close>, (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
  12.479 +	      \<^rule_thm>\<open>real_num_collect_assoc\<close>,
  12.480 +          (*"[| l is_const; m is_const |] ==> l * n + (m * n + k) =  (l + m) * n + k"*)
  12.481 +	      \<^rule_thm>\<open>real_one_collect\<close>,	 (*"m is_const ==> n + m * n = (1 + m) * n"*)
  12.482 +	      \<^rule_thm>\<open>real_one_collect_assoc\<close>, (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  12.483 +	      \<^rule_eval>\<open>plus\<close> (eval_binop "#add_"), 
  12.484 +	      \<^rule_eval>\<open>times\<close> (eval_binop "#mult_"),
  12.485 +	      \<^rule_eval>\<open>powr\<close> (eval_binop "#power_")],
  12.486 +      scr = Rule.Empty_Prog};
  12.487  val reduce_012 = 
  12.488    Rule_Def.Repeat{id = "reduce_012", preconds = [], 
  12.489        rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  12.490 @@ -1037,24 +962,18 @@
  12.491          \<^rule_thm>\<open>not_false\<close>,
  12.492          \<^rule_thm>\<open>not_true\<close>],
  12.493        srls = Rule_Set.Empty, calc = [], errpatts = [],
  12.494 -      rules = [\<^rule_thm>\<open>mult_1_left\<close>,                 
  12.495 -	       (*"1 * z = z"*)
  12.496 -	       (*\<^rule_thm>\<open>real_mult_minus1\<close>,14.3.03*)
  12.497 -	       (*"-1 * z = - z"*)
  12.498 +      rules = [
  12.499 +        \<^rule_thm>\<open>mult_1_left\<close>, (*"1 * z = z"*)
  12.500 +	       (*\<^rule_thm>\<open>real_mult_minus1\<close>,14.3.03*) (*"-1 * z = - z"*)
  12.501  	       \<^rule_thm>\<open>real_minus_mult_left\<close>, (*"\<not> ((a::real) is_num) ==> (- a) * b = - (a * b)"*)
  12.502 -	       (*\<^rule_thm>\<open>real_minus_mult_cancel\<close>,
  12.503 -	       (*"- ?x * - ?y = ?x * ?y"*)---*)
  12.504 -	       \<^rule_thm>\<open>mult_zero_left\<close>,        
  12.505 -	       (*"0 * z = 0"*)
  12.506 +	       (*\<^rule_thm>\<open>real_minus_mult_cancel\<close>, (*"- ?x * - ?y = ?x * ?y"*)---*)
  12.507 +	       \<^rule_thm>\<open>mult_zero_left\<close>, (*"0 * z = 0"*)
  12.508  	       \<^rule_thm>\<open>add_0_left\<close>, (*"0 + z = z"*)
  12.509  	       \<^rule_thm>\<open>add_0_right\<close>, (*"a + - a = 0"*)
  12.510 -	       \<^rule_thm>\<open>right_minus\<close>,
  12.511 -	       (*"?z + - ?z = 0"*)
  12.512 -	       \<^rule_thm_sym>\<open>real_mult_2\<close>,	
  12.513 -	       (*"z1 + z1 = 2 * z1"*)
  12.514 -	       \<^rule_thm>\<open>real_mult_2_assoc\<close>
  12.515 -	       (*"z1 + (z1 + k) = 2 * z1 + k"*)
  12.516 -	       ], scr = Rule.Empty_Prog};
  12.517 +	       \<^rule_thm>\<open>right_minus\<close>, (*"?z + - ?z = 0"*)
  12.518 +	       \<^rule_thm_sym>\<open>real_mult_2\<close>,	 (*"z1 + z1 = 2 * z1"*)
  12.519 +	       \<^rule_thm>\<open>real_mult_2_assoc\<close> (*"z1 + (z1 + k) = 2 * z1 + k"*)],
  12.520 +      scr = Rule.Empty_Prog};
  12.521  
  12.522  val discard_parentheses = 
  12.523      Rule_Set.append_rules "discard_parentheses" Rule_Set.empty 
  12.524 @@ -1070,19 +989,14 @@
  12.525        rew_ord = ("ord_make_polynomial",ord_make_polynomial false \<^theory>),
  12.526        erls = Rule_Set.empty,srls = Rule_Set.Empty,
  12.527        calc = [], errpatts = [],
  12.528 -      rules = [\<^rule_thm>\<open>mult.commute\<close>,
  12.529 -	       (* z * w = w * z *)
  12.530 -	       \<^rule_thm>\<open>real_mult_left_commute\<close>,
  12.531 -	       (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*)
  12.532 -	       \<^rule_thm>\<open>mult.assoc\<close>,		
  12.533 -	       (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*)
  12.534 -	       \<^rule_thm>\<open>add.commute\<close>,	
  12.535 -	       (*z + w = w + z*)
  12.536 -	       \<^rule_thm>\<open>add.left_commute\<close>,
  12.537 -	       (*x + (y + z) = y + (x + z)*)
  12.538 -	       \<^rule_thm>\<open>add.assoc\<close>	               
  12.539 -	       (*z1.0 + z2.0 + z3.0 = z1.0 + (z2.0 + z3.0)*)
  12.540 -	       ], scr = Rule.Empty_Prog};
  12.541 +      rules = [
  12.542 +        \<^rule_thm>\<open>mult.commute\<close>, (* z * w = w * z *)
  12.543 +	       \<^rule_thm>\<open>real_mult_left_commute\<close>, (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*)
  12.544 +	       \<^rule_thm>\<open>mult.assoc\<close>, (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*)
  12.545 +	       \<^rule_thm>\<open>add.commute\<close>,	 (*z + w = w + z*)
  12.546 +	       \<^rule_thm>\<open>add.left_commute\<close>, (*x + (y + z) = y + (x + z)*)
  12.547 +	       \<^rule_thm>\<open>add.assoc\<close> (*z1.0 + z2.0 + z3.0 = z1.0 + (z2.0 + z3.0)*)],
  12.548 +      scr = Rule.Empty_Prog};
  12.549  (*MG.0401: termorders for multivariate polys dropped due to principal problems:
  12.550    (total-degree-)ordering of monoms NOT possible with size_of_term GIVEN*)
  12.551  val order_mult = 
  12.552 @@ -1090,13 +1004,11 @@
  12.553        rew_ord = ("ord_make_polynomial",ord_make_polynomial false \<^theory>),
  12.554        erls = Rule_Set.empty,srls = Rule_Set.Empty,
  12.555        calc = [], errpatts = [],
  12.556 -      rules = [\<^rule_thm>\<open>mult.commute\<close>,
  12.557 -	       (* z * w = w * z *)
  12.558 -	       \<^rule_thm>\<open>real_mult_left_commute\<close>,
  12.559 -	       (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*)
  12.560 -	       \<^rule_thm>\<open>mult.assoc\<close>	
  12.561 -	       (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*)
  12.562 -	       ], scr = Rule.Empty_Prog};
  12.563 +      rules = [
  12.564 +        \<^rule_thm>\<open>mult.commute\<close>, (* z * w = w * z *)
  12.565 +	       \<^rule_thm>\<open>real_mult_left_commute\<close>, (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*)
  12.566 +	       \<^rule_thm>\<open>mult.assoc\<close>	 (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*)],
  12.567 +      scr = Rule.Empty_Prog};
  12.568  \<close>
  12.569  ML \<open>
  12.570  fun attach_form (_: Rule.rule list list) (_: term) (_: term) = (*still missing*)
  12.571 @@ -1129,11 +1041,12 @@
  12.572  		     attach_form = attach_form}};
  12.573  val order_mult_rls_ = 
  12.574    Rule_Def.Repeat {id = "order_mult_rls_", preconds = [], 
  12.575 -      rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  12.576 -      erls = Rule_Set.empty,srls = Rule_Set.Empty,
  12.577 -      calc = [], errpatts = [],
  12.578 -      rules = [Rule.Rls_ order_mult_
  12.579 -	       ], scr = Rule.Empty_Prog};
  12.580 +    rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  12.581 +    erls = Rule_Set.empty,srls = Rule_Set.Empty,
  12.582 +    calc = [], errpatts = [],
  12.583 +    rules = [
  12.584 +      Rule.Rls_ order_mult_],
  12.585 +    scr = Rule.Empty_Prog};
  12.586  
  12.587  \<close> ML \<open>
  12.588  
  12.589 @@ -1146,34 +1059,37 @@
  12.590  fun normal_form t = SOME (sort_monoms t,[]: term list);
  12.591  \<close> ML \<open>
  12.592  val order_add_ =
  12.593 -    Rule_Set.Rrls {id = "order_add_", 
  12.594 -	  prepat = (*WN.18.6.03 Preconditions und Pattern,
  12.595 +  Rule_Set.Rrls {id = "order_add_", 
  12.596 +	  prepat = [(*WN.18.6.03 Preconditions und Pattern,
  12.597  		    die beide passen muessen, damit das Rule_Set.Rrls angewandt wird*)
  12.598 -	  [([TermC.parse_patt @{theory} "?p is_addUnordered"], 
  12.599 -	     TermC.parse_patt @{theory} "?p :: real" 
  12.600 +	    ([TermC.parse_patt @{theory} "?p is_addUnordered"], 
  12.601 +	      TermC.parse_patt @{theory} "?p :: real" 
  12.602  	    (*WN.18.6.03 also KEIN pattern, dieses erzeugt nur das Environment 
  12.603  	      fuer die Evaluation der Precondition "p is_addUnordered"*))],
  12.604  	  rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  12.605  	  erls = Rule_Set.append_rules "Rule_Set.empty-is_addUnordered" Rule_Set.empty(*MG: poly_erls*)
  12.606 -			    [\<^rule_eval>\<open>is_addUnordered\<close> (eval_is_addUnordered "")],
  12.607 -	  calc = [("PLUS"  ,(\<^const_name>\<open>plus\<close>, eval_binop "#add_")),
  12.608 +			[\<^rule_eval>\<open>is_addUnordered\<close> (eval_is_addUnordered "")],
  12.609 +	  calc = [
  12.610 +      ("PLUS"  ,(\<^const_name>\<open>plus\<close>, eval_binop "#add_")),
  12.611  		  ("TIMES" ,(\<^const_name>\<open>times\<close>, eval_binop "#mult_")),
  12.612  		  ("DIVIDE",(\<^const_name>\<open>divide\<close>, Prog_Expr.eval_cancel "#divide_e")),
  12.613  		  ("POWER" ,(\<^const_name>\<open>powr\<close>  , eval_binop "#power_"))],
  12.614  	  errpatts = [],
  12.615 -	  scr = Rule.Rfuns {init_state  = init_state,
  12.616 -		     normal_form = normal_form,
  12.617 -		     locate_rule = locate_rule,
  12.618 -		     next_rule   = next_rule,
  12.619 -		     attach_form = attach_form}};
  12.620 +	  scr = Rule.Rfuns {
  12.621 +      init_state  = init_state,
  12.622 +		  normal_form = normal_form,
  12.623 +		  locate_rule = locate_rule,
  12.624 +		  next_rule   = next_rule,
  12.625 +		  attach_form = attach_form}};
  12.626  
  12.627  val order_add_rls_ =
  12.628    Rule_Def.Repeat {id = "order_add_rls_", preconds = [], 
  12.629 -      rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  12.630 -      erls = Rule_Set.empty,srls = Rule_Set.Empty,
  12.631 -      calc = [], errpatts = [],
  12.632 -      rules = [Rule.Rls_ order_add_
  12.633 -	       ], scr = Rule.Empty_Prog};
  12.634 +    rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  12.635 +    erls = Rule_Set.empty, srls = Rule_Set.Empty,
  12.636 +    calc = [], errpatts = [],
  12.637 +    rules = [
  12.638 +      Rule.Rls_ order_add_],
  12.639 +    scr = Rule.Empty_Prog};
  12.640  \<close>
  12.641  
  12.642  text \<open>rule-set make_polynomial also named norm_Poly:
  12.643 @@ -1189,42 +1105,40 @@
  12.644  val make_polynomial(*MG.03, overwrites version from above, 
  12.645      previously 'make_polynomial_'*) =
  12.646    Rule_Set.Sequence {id = "make_polynomial", preconds = []:term list, 
  12.647 -      rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  12.648 -      erls = Atools_erls, srls = Rule_Set.Empty,calc = [], errpatts = [],
  12.649 -      rules = [Rule.Rls_ discard_minus,
  12.650 -	       Rule.Rls_ expand_poly_,
  12.651 -	       \<^rule_eval>\<open>times\<close> (eval_binop "#mult_"),
  12.652 -	       Rule.Rls_ order_mult_rls_,
  12.653 -	       Rule.Rls_ simplify_power_, 
  12.654 -	       Rule.Rls_ calc_add_mult_pow_, 
  12.655 -	       Rule.Rls_ reduce_012_mult_,
  12.656 -	       Rule.Rls_ order_add_rls_,
  12.657 -	       Rule.Rls_ collect_numerals_, 
  12.658 -	       Rule.Rls_ reduce_012_,
  12.659 -	       Rule.Rls_ discard_parentheses1
  12.660 -	       ],
  12.661 -      scr = Rule.Empty_Prog
  12.662 -      };
  12.663 +    rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  12.664 +    erls = Atools_erls, srls = Rule_Set.Empty,calc = [], errpatts = [],
  12.665 +    rules = [
  12.666 +       Rule.Rls_ discard_minus,
  12.667 +	     Rule.Rls_ expand_poly_,
  12.668 +	     \<^rule_eval>\<open>times\<close> (eval_binop "#mult_"),
  12.669 +	     Rule.Rls_ order_mult_rls_,
  12.670 +	     Rule.Rls_ simplify_power_, 
  12.671 +	     Rule.Rls_ calc_add_mult_pow_, 
  12.672 +	     Rule.Rls_ reduce_012_mult_,
  12.673 +	     Rule.Rls_ order_add_rls_,
  12.674 +	     Rule.Rls_ collect_numerals_, 
  12.675 +	     Rule.Rls_ reduce_012_,
  12.676 +	     Rule.Rls_ discard_parentheses1],
  12.677 +    scr = Rule.Empty_Prog};
  12.678  \<close>
  12.679  ML \<open>
  12.680  val norm_Poly(*=make_polynomial*) = 
  12.681    Rule_Set.Sequence {id = "norm_Poly", preconds = []:term list, 
  12.682 -      rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  12.683 -      erls = Atools_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  12.684 -      rules = [Rule.Rls_ discard_minus,
  12.685 -	       Rule.Rls_ expand_poly_,
  12.686 -	       \<^rule_eval>\<open>times\<close> (eval_binop "#mult_"),
  12.687 -	       Rule.Rls_ order_mult_rls_,
  12.688 -	       Rule.Rls_ simplify_power_, 
  12.689 -	       Rule.Rls_ calc_add_mult_pow_, 
  12.690 -	       Rule.Rls_ reduce_012_mult_,
  12.691 -	       Rule.Rls_ order_add_rls_,
  12.692 -	       Rule.Rls_ collect_numerals_, 
  12.693 -	       Rule.Rls_ reduce_012_,
  12.694 -	       Rule.Rls_ discard_parentheses1
  12.695 -	       ],
  12.696 -      scr = Rule.Empty_Prog
  12.697 -      };
  12.698 +    rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  12.699 +    erls = Atools_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  12.700 +    rules = [
  12.701 +       Rule.Rls_ discard_minus,
  12.702 +	     Rule.Rls_ expand_poly_,
  12.703 +	     \<^rule_eval>\<open>times\<close> (eval_binop "#mult_"),
  12.704 +	     Rule.Rls_ order_mult_rls_,
  12.705 +	     Rule.Rls_ simplify_power_, 
  12.706 +	     Rule.Rls_ calc_add_mult_pow_, 
  12.707 +	     Rule.Rls_ reduce_012_mult_,
  12.708 +	     Rule.Rls_ order_add_rls_,
  12.709 +	     Rule.Rls_ collect_numerals_, 
  12.710 +	     Rule.Rls_ reduce_012_,
  12.711 +	     Rule.Rls_ discard_parentheses1],
  12.712 +    scr = Rule.Empty_Prog};
  12.713  \<close>
  12.714  ML \<open>
  12.715  (* MG:03 Like make_polynomial_ but without Rule.Rls_ discard_parentheses1 
  12.716 @@ -1232,49 +1146,43 @@
  12.717  (* MG necessary  for termination of norm_Rational(*_mg*) in Rational.ML*)
  12.718  val make_rat_poly_with_parentheses =
  12.719    Rule_Set.Sequence{id = "make_rat_poly_with_parentheses", preconds = []:term list, 
  12.720 -      rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  12.721 -      erls = Atools_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  12.722 -      rules = [Rule.Rls_ discard_minus,
  12.723 -	       Rule.Rls_ expand_poly_rat_,(*ignors rationals*)
  12.724 -	       \<^rule_eval>\<open>times\<close> (eval_binop "#mult_"),
  12.725 -	       Rule.Rls_ order_mult_rls_,
  12.726 -	       Rule.Rls_ simplify_power_, 
  12.727 -	       Rule.Rls_ calc_add_mult_pow_, 
  12.728 -	       Rule.Rls_ reduce_012_mult_,
  12.729 -	       Rule.Rls_ order_add_rls_,
  12.730 -	       Rule.Rls_ collect_numerals_, 
  12.731 -	       Rule.Rls_ reduce_012_
  12.732 -	       (*Rule.Rls_ discard_parentheses1 *)
  12.733 -	       ],
  12.734 -      scr = Rule.Empty_Prog
  12.735 -      };
  12.736 +    rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  12.737 +    erls = Atools_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  12.738 +    rules = [
  12.739 +      Rule.Rls_ discard_minus,
  12.740 +	    Rule.Rls_ expand_poly_rat_,(*ignors rationals*)
  12.741 +	    \<^rule_eval>\<open>times\<close> (eval_binop "#mult_"),
  12.742 +	    Rule.Rls_ order_mult_rls_,
  12.743 +	    Rule.Rls_ simplify_power_, 
  12.744 +	    Rule.Rls_ calc_add_mult_pow_, 
  12.745 +	    Rule.Rls_ reduce_012_mult_,
  12.746 +	    Rule.Rls_ order_add_rls_,
  12.747 +	    Rule.Rls_ collect_numerals_, 
  12.748 +	    Rule.Rls_ reduce_012_
  12.749 +	    (*Rule.Rls_ discard_parentheses1 *)],
  12.750 +    scr = Rule.Empty_Prog};
  12.751  \<close>
  12.752  ML \<open>
  12.753  (*.a minimal ruleset for reverse rewriting of factions [2];
  12.754     compare expand_binoms.*)
  12.755  val rev_rew_p = 
  12.756 -Rule_Set.Sequence{id = "rev_rew_p", preconds = [], rew_ord = ("termlessI",termlessI),
  12.757 +  Rule_Set.Sequence{id = "rev_rew_p", preconds = [], rew_ord = ("termlessI",termlessI),
  12.758      erls = Atools_erls, srls = Rule_Set.Empty,
  12.759      calc = [(*("PLUS"  , (\<^const_name>\<open>plus\<close>, eval_binop "#add_")), 
  12.760  	    ("TIMES" , (\<^const_name>\<open>times\<close>, eval_binop "#mult_")),
  12.761  	    ("POWER", (\<^const_name>\<open>powr\<close>, eval_binop "#power_"))*)
  12.762  	    ], errpatts = [],
  12.763 -    rules = [\<^rule_thm>\<open>real_plus_binom_times\<close>,
  12.764 -	     (*"(a + b)*(a + b) = a ^ 2 + 2 * a * b + b ^ 2*)
  12.765 -	     \<^rule_thm>\<open>real_plus_binom_times1\<close>,
  12.766 -	     (*"(a +  1*b)*(a + -1*b) = a \<up> 2 + -1*b \<up> 2"*)
  12.767 -	     \<^rule_thm>\<open>real_plus_binom_times2\<close>,
  12.768 -	     (*"(a + -1*b)*(a +  1*b) = a \<up> 2 + -1*b \<up> 2"*)
  12.769 +    rules = [
  12.770 +       \<^rule_thm>\<open>real_plus_binom_times\<close>, (*"(a + b)*(a + b) = a ^ 2 + 2 * a * b + b ^ 2*)
  12.771 +	     \<^rule_thm>\<open>real_plus_binom_times1\<close>, (*"(a +  1*b)*(a + -1*b) = a \<up> 2 + -1*b \<up> 2"*)
  12.772 +	     \<^rule_thm>\<open>real_plus_binom_times2\<close>, (*"(a + -1*b)*(a +  1*b) = a \<up> 2 + -1*b \<up> 2"*)
  12.773  
  12.774  	     \<^rule_thm>\<open>mult_1_left\<close>,(*"1 * z = z"*)
  12.775  
  12.776 -             \<^rule_thm>\<open>distrib_right\<close>,
  12.777 -	     (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  12.778 -	     \<^rule_thm>\<open>distrib_left\<close>,
  12.779 -	     (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  12.780 +       \<^rule_thm>\<open>distrib_right\<close>, (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  12.781 +	     \<^rule_thm>\<open>distrib_left\<close>, (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  12.782  	       
  12.783 -	     \<^rule_thm>\<open>mult.assoc\<close>,
  12.784 -	     (*"?z1.1 * ?z2.1 * ?z3. =1 ?z1.1 * (?z2.1 * ?z3.1)"*)
  12.785 +	     \<^rule_thm>\<open>mult.assoc\<close>, (*"?z1.1 * ?z2.1 * ?z3. =1 ?z1.1 * (?z2.1 * ?z3.1)"*)
  12.786  	     Rule.Rls_ order_mult_rls_,
  12.787  	     (*Rule.Rls_ order_add_rls_,*)
  12.788  
  12.789 @@ -1282,37 +1190,27 @@
  12.790  	     \<^rule_eval>\<open>times\<close> (eval_binop "#mult_"),
  12.791  	     \<^rule_eval>\<open>powr\<close> (eval_binop "#power_"),
  12.792  	     
  12.793 -	     \<^rule_thm_sym>\<open>realpow_twoI\<close>,
  12.794 -	     (*"r1 * r1 = r1 \<up> 2"*)
  12.795 -	     \<^rule_thm_sym>\<open>real_mult_2\<close>,
  12.796 -	     (*"z1 + z1 = 2 * z1"*)
  12.797 -	     \<^rule_thm>\<open>real_mult_2_assoc\<close>,
  12.798 -	     (*"z1 + (z1 + k) = 2 * z1 + k"*)
  12.799 +	     \<^rule_thm_sym>\<open>realpow_twoI\<close>, (*"r1 * r1 = r1 \<up> 2"*)
  12.800 +	     \<^rule_thm_sym>\<open>real_mult_2\<close>, (*"z1 + z1 = 2 * z1"*)
  12.801 +	     \<^rule_thm>\<open>real_mult_2_assoc\<close>, (*"z1 + (z1 + k) = 2 * z1 + k"*)
  12.802  
  12.803 -	     \<^rule_thm>\<open>real_num_collect\<close>, 
  12.804 -	     (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
  12.805 -	     \<^rule_thm>\<open>real_num_collect_assoc\<close>,
  12.806 -	     (*"[| l is_const; m is_const |] ==>  
  12.807 -                                     l * n + (m * n + k) =  (l + m) * n + k"*)
  12.808 -	     \<^rule_thm>\<open>real_one_collect\<close>,
  12.809 -	     (*"m is_const ==> n + m * n = (1 + m) * n"*)
  12.810 -	     \<^rule_thm>\<open>real_one_collect_assoc\<close>, 
  12.811 -	     (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  12.812 +	     \<^rule_thm>\<open>real_num_collect\<close>,  (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
  12.813 +	     \<^rule_thm>\<open>real_num_collect_assoc\<close>, (*"[| l is_const; m is_const |] ==> l * n + (m * n + k) =  (l + m) * n + k"*)
  12.814 +	     \<^rule_thm>\<open>real_one_collect\<close>, (*"m is_const ==> n + m * n = (1 + m) * n"*)
  12.815 +	     \<^rule_thm>\<open>real_one_collect_assoc\<close>, (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  12.816  
  12.817 -	     \<^rule_thm>\<open>realpow_multI\<close>,
  12.818 -	     (*"(r * s) \<up> n = r \<up> n * s \<up> n"*)
  12.819 +	     \<^rule_thm>\<open>realpow_multI\<close>, (*"(r * s) \<up> n = r \<up> n * s \<up> n"*)
  12.820  
  12.821  	     \<^rule_eval>\<open>plus\<close> (eval_binop "#add_"),
  12.822  	     \<^rule_eval>\<open>times\<close> (eval_binop "#mult_"),
  12.823  	     \<^rule_eval>\<open>powr\<close> (eval_binop "#power_"),
  12.824  
  12.825 -	     \<^rule_thm>\<open>mult_1_left\<close>,(*"1 * z = z"*)
  12.826 -	     \<^rule_thm>\<open>mult_zero_left\<close>,(*"0 * z = 0"*)
  12.827 -	     \<^rule_thm>\<open>add_0_left\<close>(*0 + z = z*)
  12.828 +	     \<^rule_thm>\<open>mult_1_left\<close>, (*"1 * z = z"*)
  12.829 +	     \<^rule_thm>\<open>mult_zero_left\<close>, (*"0 * z = 0"*)
  12.830 +	     \<^rule_thm>\<open>add_0_left\<close> (*0 + z = z*)
  12.831  
  12.832  	     (*Rule.Rls_ order_add_rls_*)
  12.833  	     ],
  12.834 -
  12.835      scr = Rule.Empty_Prog};      
  12.836  \<close>
  12.837  
  12.838 @@ -1354,91 +1252,62 @@
  12.839  ML \<open>
  12.840  val expand_binoms = 
  12.841    Rule_Def.Repeat{id = "expand_binoms", preconds = [], rew_ord = ("termlessI",termlessI),
  12.842 -      erls = Atools_erls, srls = Rule_Set.Empty,
  12.843 -      calc = [("PLUS"  , (\<^const_name>\<open>plus\<close>, eval_binop "#add_")), 
  12.844 -	      ("TIMES" , (\<^const_name>\<open>times\<close>, eval_binop "#mult_")),
  12.845 -	      ("POWER", (\<^const_name>\<open>powr\<close>, eval_binop "#power_"))
  12.846 -	      ], errpatts = [],
  12.847 -      rules = [\<^rule_thm>\<open>real_plus_binom_pow2\<close>,     
  12.848 -	       (*"(a + b) \<up> 2 = a \<up> 2 + 2 * a * b + b \<up> 2"*)
  12.849 -	       \<^rule_thm>\<open>real_plus_binom_times\<close>,    
  12.850 -	      (*"(a + b)*(a + b) = ...*)
  12.851 -	       \<^rule_thm>\<open>real_minus_binom_pow2\<close>,   
  12.852 -	       (*"(a - b) \<up> 2 = a \<up> 2 - 2 * a * b + b \<up> 2"*)
  12.853 -	       \<^rule_thm>\<open>real_minus_binom_times\<close>,   
  12.854 -	       (*"(a - b)*(a - b) = ...*)
  12.855 -	       \<^rule_thm>\<open>real_plus_minus_binom1\<close>,   
  12.856 -		(*"(a + b) * (a - b) = a \<up> 2 - b \<up> 2"*)
  12.857 -	       \<^rule_thm>\<open>real_plus_minus_binom2\<close>,   
  12.858 -		(*"(a - b) * (a + b) = a \<up> 2 - b \<up> 2"*)
  12.859 -	       (*RL 020915*)
  12.860 -	       \<^rule_thm>\<open>real_pp_binom_times\<close>, 
  12.861 -		(*(a + b)*(c + d) = a*c + a*d + b*c + b*d*)
  12.862 -               \<^rule_thm>\<open>real_pm_binom_times\<close>, 
  12.863 -		(*(a + b)*(c - d) = a*c - a*d + b*c - b*d*)
  12.864 -               \<^rule_thm>\<open>real_mp_binom_times\<close>, 
  12.865 -		(*(a - b)*(c + d) = a*c + a*d - b*c - b*d*)
  12.866 -               \<^rule_thm>\<open>real_mm_binom_times\<close>, 
  12.867 -		(*(a - b)*(c - d) = a*c - a*d - b*c + b*d*)
  12.868 -	       \<^rule_thm>\<open>realpow_multI\<close>,
  12.869 -		(*(a*b) \<up> n = a \<up> n * b \<up> n*)
  12.870 -	       \<^rule_thm>\<open>real_plus_binom_pow3\<close>,
  12.871 -	        (* (a + b) \<up> 3 = a \<up> 3 + 3*a \<up> 2*b + 3*a*b \<up> 2 + b \<up> 3 *)
  12.872 -	       \<^rule_thm>\<open>real_minus_binom_pow3\<close>,
  12.873 -	        (* (a - b) \<up> 3 = a \<up> 3 - 3*a \<up> 2*b + 3*a*b \<up> 2 - b \<up> 3 *)
  12.874 -
  12.875 -
  12.876 -              (*\<^rule_thm>\<open>distrib_right\<close>,	
  12.877 -		(*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  12.878 -	       \<^rule_thm>\<open>distrib_left\<close>,	
  12.879 -	       (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  12.880 -	       \<^rule_thm>\<open>left_diff_distrib\<close>,	
  12.881 -	       (*"(z1.0 - z2.0) * w = z1.0 * w - z2.0 * w"*)
  12.882 -	       \<^rule_thm>\<open>right_diff_distrib\<close>,	
  12.883 -	       (*"w * (z1.0 - z2.0) = w * z1.0 - w * z2.0"*)
  12.884 +    erls = Atools_erls, srls = Rule_Set.Empty,
  12.885 +    calc = [("PLUS"  , (\<^const_name>\<open>plus\<close>, eval_binop "#add_")), 
  12.886 +	    ("TIMES" , (\<^const_name>\<open>times\<close>, eval_binop "#mult_")),
  12.887 +	    ("POWER", (\<^const_name>\<open>powr\<close>, eval_binop "#power_"))
  12.888 +	    ], errpatts = [],
  12.889 +    rules = [
  12.890 +       \<^rule_thm>\<open>real_plus_binom_pow2\<close>, (*"(a + b) \<up> 2 = a \<up> 2 + 2 * a * b + b \<up> 2"*)
  12.891 +	     \<^rule_thm>\<open>real_plus_binom_times\<close>, (*"(a + b)*(a + b) = ...*)
  12.892 +	     \<^rule_thm>\<open>real_minus_binom_pow2\<close>,  (*"(a - b) \<up> 2 = a \<up> 2 - 2 * a * b + b \<up> 2"*)
  12.893 +	     \<^rule_thm>\<open>real_minus_binom_times\<close>, (*"(a - b)*(a - b) = ...*)
  12.894 +	     \<^rule_thm>\<open>real_plus_minus_binom1\<close>, (*"(a + b) * (a - b) = a \<up> 2 - b \<up> 2"*)
  12.895 +	     \<^rule_thm>\<open>real_plus_minus_binom2\<close>, (*"(a - b) * (a + b) = a \<up> 2 - b \<up> 2"*)
  12.896 +	     (*RL 020915*)
  12.897 +	     \<^rule_thm>\<open>real_pp_binom_times\<close>, (*(a + b)*(c + d) = a*c + a*d + b*c + b*d*)
  12.898 +             \<^rule_thm>\<open>real_pm_binom_times\<close>, (*(a + b)*(c - d) = a*c - a*d + b*c - b*d*)
  12.899 +             \<^rule_thm>\<open>real_mp_binom_times\<close>, (*(a - b)*(c + d) = a*c + a*d - b*c - b*d*)
  12.900 +             \<^rule_thm>\<open>real_mm_binom_times\<close>, (*(a - b)*(c - d) = a*c - a*d - b*c + b*d*)
  12.901 +	     \<^rule_thm>\<open>realpow_multI\<close>, (*(a*b) \<up> n = a \<up> n * b \<up> n*)
  12.902 +	     \<^rule_thm>\<open>real_plus_binom_pow3\<close>, (* (a + b) \<up> 3 = a \<up> 3 + 3*a \<up> 2*b + 3*a*b \<up> 2 + b \<up> 3 *)
  12.903 +	     \<^rule_thm>\<open>real_minus_binom_pow3\<close>, (* (a - b) \<up> 3 = a \<up> 3 - 3*a \<up> 2*b + 3*a*b \<up> 2 - b \<up> 3 *)
  12.904 +       (*
  12.905 +       \<^rule_thm>\<open>distrib_right\<close>,	 (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  12.906 +	     \<^rule_thm>\<open>distrib_left\<close>, (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  12.907 +	     \<^rule_thm>\<open>left_diff_distrib\<close>,	 (*"(z1.0 - z2.0) * w = z1.0 * w - z2.0 * w"*)
  12.908 +	     \<^rule_thm>\<open>right_diff_distrib\<close>, (*"w * (z1.0 - z2.0) = w * z1.0 - w * z2.0"*)
  12.909  	      *)
  12.910 -	       \<^rule_thm>\<open>mult_1_left\<close>,
  12.911 -               (*"1 * z = z"*)
  12.912 -	       \<^rule_thm>\<open>mult_zero_left\<close>,
  12.913 -               (*"0 * z = 0"*)
  12.914 -	       \<^rule_thm>\<open>add_0_left\<close>,(*"0 + z = z"*)
  12.915 -
  12.916 -	       \<^rule_eval>\<open>plus\<close> (eval_binop "#add_"), 
  12.917 -	       \<^rule_eval>\<open>times\<close> (eval_binop "#mult_"),
  12.918 -	       \<^rule_eval>\<open>powr\<close> (eval_binop "#power_"),
  12.919 -              (*\<^rule_thm>\<open>mult.commute\<close>,
  12.920 -		(*AC-rewriting*)
  12.921 -	       \<^rule_thm>\<open>real_mult_left_commute\<close>,
  12.922 -	       \<^rule_thm>\<open>mult.assoc\<close>,
  12.923 -	       \<^rule_thm>\<open>add.commute\<close>,
  12.924 -	       \<^rule_thm>\<open>add.left_commute\<close>,
  12.925 -	       \<^rule_thm>\<open>add.assoc\<close>,
  12.926 +	     \<^rule_thm>\<open>mult_1_left\<close>, (*"1 * z = z"*)
  12.927 +	     \<^rule_thm>\<open>mult_zero_left\<close>, (*"0 * z = 0"*)
  12.928 +	     \<^rule_thm>\<open>add_0_left\<close>, (*"0 + z = z"*)
  12.929 +    
  12.930 +	     \<^rule_eval>\<open>plus\<close> (eval_binop "#add_"), 
  12.931 +	     \<^rule_eval>\<open>times\<close> (eval_binop "#mult_"),
  12.932 +	     \<^rule_eval>\<open>powr\<close> (eval_binop "#power_"),
  12.933 +            (*\<^rule_thm>\<open>mult.commute\<close>,
  12.934 +		    (*AC-rewriting*)
  12.935 +	     \<^rule_thm>\<open>real_mult_left_commute\<close>,
  12.936 +	     \<^rule_thm>\<open>mult.assoc\<close>,
  12.937 +	     \<^rule_thm>\<open>add.commute\<close>,
  12.938 +	     \<^rule_thm>\<open>add.left_commute\<close>,
  12.939 +	     \<^rule_thm>\<open>add.assoc\<close>,
  12.940  	      *)
  12.941 -	       \<^rule_thm_sym>\<open>realpow_twoI\<close>,
  12.942 -	       (*"r1 * r1 = r1 \<up> 2"*)
  12.943 -	       \<^rule_thm>\<open>realpow_plus_1\<close>,			
  12.944 -	       (*"r * r \<up> n = r \<up> (n + 1)"*)
  12.945 -	       (*\<^rule_thm_sym>\<open>real_mult_2\<close>,		
  12.946 -	       (*"z1 + z1 = 2 * z1"*)*)
  12.947 -	       \<^rule_thm>\<open>real_mult_2_assoc\<close>,		
  12.948 -	       (*"z1 + (z1 + k) = 2 * z1 + k"*)
  12.949 -
  12.950 -	       \<^rule_thm>\<open>real_num_collect\<close>, 
  12.951 -	       (*"[| l is_const; m is_const |] ==>l * n + m * n = (l + m) * n"*)
  12.952 -	       \<^rule_thm>\<open>real_num_collect_assoc\<close>,	
  12.953 -	       (*"[| l is_const; m is_const |] ==>  
  12.954 -                                       l * n + (m * n + k) =  (l + m) * n + k"*)
  12.955 -	       \<^rule_thm>\<open>real_one_collect\<close>,
  12.956 -	       (*"m is_const ==> n + m * n = (1 + m) * n"*)
  12.957 -	       \<^rule_thm>\<open>real_one_collect_assoc\<close>, 
  12.958 -	       (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  12.959 -
  12.960 -	       \<^rule_eval>\<open>plus\<close> (eval_binop "#add_"), 
  12.961 -	       \<^rule_eval>\<open>times\<close> (eval_binop "#mult_"),
  12.962 -	       \<^rule_eval>\<open>powr\<close> (eval_binop "#power_")
  12.963 -	       ],
  12.964 -      scr = Rule.Prog (Program.prep_program @{thm expand_binoms_2.simps})
  12.965 -      };      
  12.966 +	     \<^rule_thm_sym>\<open>realpow_twoI\<close>, (*"r1 * r1 = r1 \<up> 2"*)
  12.967 +	     \<^rule_thm>\<open>realpow_plus_1\<close>, (*"r * r \<up> n = r \<up> (n + 1)"*)
  12.968 +	     (*
  12.969 +       \<^rule_thm_sym>\<open>real_mult_2\<close>, (*"z1 + z1 = 2 * z1"*)*)
  12.970 +	     \<^rule_thm>\<open>real_mult_2_assoc\<close>,	 (*"z1 + (z1 + k) = 2 * z1 + k"*)
  12.971 +    
  12.972 +	     \<^rule_thm>\<open>real_num_collect\<close>, (*"[| l is_const; m is_const |] ==>l * n + m * n = (l + m) * n"*)
  12.973 +	     \<^rule_thm>\<open>real_num_collect_assoc\<close>, (*"[| l is_const; m is_const |] ==> l * n + (m * n + k) =  (l + m) * n + k"*)
  12.974 +	     \<^rule_thm>\<open>real_one_collect\<close>, (*"m is_const ==> n + m * n = (1 + m) * n"*)
  12.975 +	     \<^rule_thm>\<open>real_one_collect_assoc\<close>, (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  12.976 +    
  12.977 +	     \<^rule_eval>\<open>plus\<close> (eval_binop "#add_"), 
  12.978 +	     \<^rule_eval>\<open>times\<close> (eval_binop "#mult_"),
  12.979 +	     \<^rule_eval>\<open>powr\<close> (eval_binop "#power_")],
  12.980 +    scr = Rule.Prog (Program.prep_program @{thm expand_binoms_2.simps})};      
  12.981  \<close>
  12.982  
  12.983  subsection \<open>add to Know_Store\<close>
    13.1 --- a/src/Tools/isac/Knowledge/PolyEq.thy	Mon Aug 09 14:20:20 2021 +0200
    13.2 +++ b/src/Tools/isac/Knowledge/PolyEq.thy	Tue Aug 10 09:43:07 2021 +0200
    13.3 @@ -301,8 +301,7 @@
    13.4    bdv_n_collect_2:     " bdv \<up> n + m * bdv \<up> n = (1 + m) * bdv \<up> n" and
    13.5    bdv_n_collect_3:     "l * bdv \<up> n + bdv \<up> n = (l + 1) * bdv \<up> n" (*order!*) and
    13.6  
    13.7 -  bdv_n_collect_assoc1_1:
    13.8 -                      "l * bdv \<up> n + (m * bdv \<up> n + k) = (l + m) * bdv \<up> n + k" and
    13.9 +  bdv_n_collect_assoc1_1: "l * bdv \<up> n + (m * bdv \<up> n + k) = (l + m) * bdv \<up> n + k" and
   13.10    bdv_n_collect_assoc1_2: "bdv \<up> n + (m * bdv \<up> n + k) = (1 + m) * bdv \<up> n + k" and
   13.11    bdv_n_collect_assoc1_3: "l * bdv \<up> n + (bdv \<up> n + k) = (l + 1) * bdv \<up> n + k" and
   13.12  
   13.13 @@ -321,45 +320,40 @@
   13.14  ML \<open>
   13.15  val thy = @{theory};
   13.16  
   13.17 -(*-------------------------rulse-------------------------*)
   13.18  val PolyEq_prls = (*3.10.02:just the following order due to subterm evaluation*)
   13.19 -  Rule_Set.append_rules "PolyEq_prls" Rule_Set.empty 
   13.20 -	     [Rule.Eval ("Prog_Expr.ident", Prog_Expr.eval_ident "#ident_"),
   13.21 -	      Rule.Eval ("Prog_Expr.matches", Prog_Expr.eval_matches "#matches_"),
   13.22 -	      Rule.Eval ("Prog_Expr.lhs", Prog_Expr.eval_lhs ""),
   13.23 -	      Rule.Eval ("Prog_Expr.rhs", Prog_Expr.eval_rhs ""),
   13.24 -	      Rule.Eval ("Poly.is_expanded_in", eval_is_expanded_in ""),
   13.25 -	      Rule.Eval ("Poly.is_poly_in", eval_is_poly_in ""),
   13.26 -	      Rule.Eval ("Poly.has_degree_in", eval_has_degree_in ""),    
   13.27 -              Rule.Eval ("Poly.is_polyrat_in", eval_is_polyrat_in ""),
   13.28 -	      (*Rule.Eval ("Prog_Expr.occurs_in", Prog_Expr.eval_occurs_in ""),   *) 
   13.29 -	      (*Rule.Eval ("Prog_Expr.is_const", Prog_Expr.eval_const "#is_const_"),*)
   13.30 -	      Rule.Eval ("HOL.eq", Prog_Expr.eval_equal "#equal_"),
   13.31 -              Rule.Eval ("RootEq.is_rootTerm_in", eval_is_rootTerm_in ""),
   13.32 -	      Rule.Eval ("RatEq.is_ratequation_in", eval_is_ratequation_in ""),
   13.33 -	      Rule.Thm ("not_true", @{thm not_true}),
   13.34 -	      Rule.Thm ("not_false", @{thm not_false}),
   13.35 -	      Rule.Thm ("and_true", @{thm and_true}),
   13.36 -	      Rule.Thm ("and_false", @{thm and_false}),
   13.37 -	      Rule.Thm ("or_true", @{thm or_true}),
   13.38 -	      Rule.Thm ("or_false", @{thm or_false})
   13.39 -	       ];
   13.40 +  Rule_Set.append_rules "PolyEq_prls" Rule_Set.empty [
   13.41 +     \<^rule_eval>\<open>ident\<close> (Prog_Expr.eval_ident "#ident_"),
   13.42 +     \<^rule_eval>\<open>matches\<close> (Prog_Expr.eval_matches "#matches_"),
   13.43 +     \<^rule_eval>\<open>lhs\<close> (Prog_Expr.eval_lhs ""),
   13.44 +     \<^rule_eval>\<open>rhs\<close> (Prog_Expr.eval_rhs ""),
   13.45 +     \<^rule_eval>\<open>is_expanded_in\<close> (eval_is_expanded_in ""),
   13.46 +     \<^rule_eval>\<open>is_poly_in\<close> (eval_is_poly_in ""),
   13.47 +     \<^rule_eval>\<open>has_degree_in\<close> (eval_has_degree_in ""),    
   13.48 +     \<^rule_eval>\<open>is_polyrat_in\<close> (eval_is_polyrat_in ""),
   13.49 +     \<^rule_eval>\<open>HOL.eq\<close> (Prog_Expr.eval_equal "#equal_"),
   13.50 +     \<^rule_eval>\<open>is_rootTerm_in\<close> (eval_is_rootTerm_in ""),
   13.51 +     \<^rule_eval>\<open>is_ratequation_in\<close> (eval_is_ratequation_in ""),
   13.52 +     \<^rule_thm>\<open>not_true\<close>,
   13.53 +     \<^rule_thm>\<open>not_false\<close>,
   13.54 +     \<^rule_thm>\<open>and_true\<close>,
   13.55 +     \<^rule_thm>\<open>and_false\<close>,
   13.56 +     \<^rule_thm>\<open>or_true\<close>,
   13.57 +     \<^rule_thm>\<open>or_false\<close>];
   13.58  
   13.59  val PolyEq_erls = 
   13.60 -    Rule_Set.merge "PolyEq_erls" LinEq_erls
   13.61 -    (Rule_Set.append_rules "ops_preds" calculate_Rational
   13.62 -		[\<^rule_eval>\<open>HOL.eq\<close> (Prog_Expr.eval_equal "#equal_"),
   13.63 +  Rule_Set.merge "PolyEq_erls" LinEq_erls
   13.64 +    (Rule_Set.append_rules "ops_preds" calculate_Rational [
   13.65 +     \<^rule_eval>\<open>HOL.eq\<close> (Prog_Expr.eval_equal "#equal_"),
   13.66  		 \<^rule_thm>\<open>plus_leq\<close>,
   13.67  		 \<^rule_thm>\<open>minus_leq\<close>,
   13.68  		 \<^rule_thm>\<open>rat_leq1\<close>,
   13.69  		 \<^rule_thm>\<open>rat_leq2\<close>,
   13.70 -		 \<^rule_thm>\<open>rat_leq3\<close>
   13.71 -		 ]);
   13.72 +		 \<^rule_thm>\<open>rat_leq3\<close>]);
   13.73  
   13.74  val PolyEq_crls = 
   13.75      Rule_Set.merge "PolyEq_crls" LinEq_crls
   13.76 -    (Rule_Set.append_rules "ops_preds" calculate_Rational
   13.77 -		[\<^rule_eval>\<open>HOL.eq\<close> (Prog_Expr.eval_equal "#equal_"),
   13.78 +    (Rule_Set.append_rules "ops_preds" calculate_Rational [
   13.79 +     \<^rule_eval>\<open>HOL.eq\<close> (Prog_Expr.eval_equal "#equal_"),
   13.80  		 \<^rule_thm>\<open>plus_leq\<close>,
   13.81  		 \<^rule_thm>\<open>minus_leq\<close>,
   13.82  		 \<^rule_thm>\<open>rat_leq1\<close>,
   13.83 @@ -369,61 +363,59 @@
   13.84  
   13.85  val cancel_leading_coeff = prep_rls'(
   13.86    Rule_Def.Repeat {id = "cancel_leading_coeff", preconds = [], 
   13.87 -       rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord),
   13.88 -      erls = PolyEq_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
   13.89 -      rules = 
   13.90 -      [\<^rule_thm>\<open>cancel_leading_coeff1\<close>,
   13.91 -       \<^rule_thm>\<open>cancel_leading_coeff2\<close>,
   13.92 -       \<^rule_thm>\<open>cancel_leading_coeff3\<close>,
   13.93 -       \<^rule_thm>\<open>cancel_leading_coeff4\<close>,
   13.94 -       \<^rule_thm>\<open>cancel_leading_coeff5\<close>,
   13.95 -       \<^rule_thm>\<open>cancel_leading_coeff6\<close>,
   13.96 -       \<^rule_thm>\<open>cancel_leading_coeff7\<close>,
   13.97 -       \<^rule_thm>\<open>cancel_leading_coeff8\<close>,
   13.98 -       \<^rule_thm>\<open>cancel_leading_coeff9\<close>,
   13.99 -       \<^rule_thm>\<open>cancel_leading_coeff10\<close>,
  13.100 -       \<^rule_thm>\<open>cancel_leading_coeff11\<close>,
  13.101 -       \<^rule_thm>\<open>cancel_leading_coeff12\<close>,
  13.102 -       \<^rule_thm>\<open>cancel_leading_coeff13\<close>
  13.103 -       ],scr = Rule.Empty_Prog});
  13.104 +    rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord),
  13.105 +    erls = PolyEq_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  13.106 +    rules = [
  13.107 +      \<^rule_thm>\<open>cancel_leading_coeff1\<close>,
  13.108 +      \<^rule_thm>\<open>cancel_leading_coeff2\<close>,
  13.109 +      \<^rule_thm>\<open>cancel_leading_coeff3\<close>,
  13.110 +      \<^rule_thm>\<open>cancel_leading_coeff4\<close>,
  13.111 +      \<^rule_thm>\<open>cancel_leading_coeff5\<close>,
  13.112 +      \<^rule_thm>\<open>cancel_leading_coeff6\<close>,
  13.113 +      \<^rule_thm>\<open>cancel_leading_coeff7\<close>,
  13.114 +      \<^rule_thm>\<open>cancel_leading_coeff8\<close>,
  13.115 +      \<^rule_thm>\<open>cancel_leading_coeff9\<close>,
  13.116 +      \<^rule_thm>\<open>cancel_leading_coeff10\<close>,
  13.117 +      \<^rule_thm>\<open>cancel_leading_coeff11\<close>,
  13.118 +      \<^rule_thm>\<open>cancel_leading_coeff12\<close>,
  13.119 +      \<^rule_thm>\<open>cancel_leading_coeff13\<close> ],
  13.120 +    scr = Rule.Empty_Prog});
  13.121  
  13.122  val prep_rls' = Auto_Prog.prep_rls @{theory};
  13.123  \<close>
  13.124  ML\<open>
  13.125  val complete_square = prep_rls'(
  13.126    Rule_Def.Repeat {id = "complete_square", preconds = [], 
  13.127 -       rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord),
  13.128 -      erls = PolyEq_erls, srls = Rule_Set.Empty, calc = [],  errpatts = [],
  13.129 -      rules = [\<^rule_thm>\<open>complete_square1\<close>,
  13.130 -	       \<^rule_thm>\<open>complete_square2\<close>,
  13.131 -	       \<^rule_thm>\<open>complete_square3\<close>,
  13.132 -	       \<^rule_thm>\<open>complete_square4\<close>,
  13.133 -	       \<^rule_thm>\<open>complete_square5\<close>
  13.134 -	       ],
  13.135 -      scr = Rule.Empty_Prog
  13.136 -      });
  13.137 +    rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord),
  13.138 +    erls = PolyEq_erls, srls = Rule_Set.Empty, calc = [],  errpatts = [],
  13.139 +    rules = [
  13.140 +      \<^rule_thm>\<open>complete_square1\<close>,
  13.141 +      \<^rule_thm>\<open>complete_square2\<close>,
  13.142 +      \<^rule_thm>\<open>complete_square3\<close>,
  13.143 +      \<^rule_thm>\<open>complete_square4\<close>,
  13.144 +      \<^rule_thm>\<open>complete_square5\<close>],
  13.145 +    scr = Rule.Empty_Prog});
  13.146  
  13.147  val polyeq_simplify = prep_rls'(
  13.148    Rule_Def.Repeat {id = "polyeq_simplify", preconds = [], 
  13.149 -       rew_ord = ("termlessI",termlessI), 
  13.150 -       erls = PolyEq_erls, 
  13.151 -       srls = Rule_Set.Empty, 
  13.152 -       calc = [], errpatts = [],
  13.153 -       rules = [\<^rule_thm>\<open>real_assoc_1\<close>,
  13.154 -		\<^rule_thm>\<open>real_assoc_2\<close>,
  13.155 -		\<^rule_thm>\<open>real_diff_minus\<close>,
  13.156 -		\<^rule_thm>\<open>real_unari_minus\<close>,
  13.157 -		\<^rule_thm>\<open>realpow_multI\<close>,
  13.158 -		\<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
  13.159 -		\<^rule_eval>\<open>minus\<close> (**)(eval_binop "#sub_"),
  13.160 -		\<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
  13.161 -		\<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e"),
  13.162 -		\<^rule_eval>\<open>sqrt\<close> (eval_sqrt "#sqrt_"),
  13.163 -		\<^rule_eval>\<open>powr\<close> (**)(eval_binop "#power_"),
  13.164 -                Rule.Rls_ reduce_012
  13.165 -                ],
  13.166 -       scr = Rule.Empty_Prog
  13.167 -       });
  13.168 +    rew_ord = ("termlessI",termlessI), 
  13.169 +    erls = PolyEq_erls, 
  13.170 +    srls = Rule_Set.Empty, 
  13.171 +    calc = [], errpatts = [],
  13.172 +    rules = [
  13.173 +      \<^rule_thm>\<open>real_assoc_1\<close>,
  13.174 +  		\<^rule_thm>\<open>real_assoc_2\<close>,
  13.175 +  		\<^rule_thm>\<open>real_diff_minus\<close>,
  13.176 +  		\<^rule_thm>\<open>real_unari_minus\<close>,
  13.177 +  		\<^rule_thm>\<open>realpow_multI\<close>,
  13.178 +  		\<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
  13.179 +  		\<^rule_eval>\<open>minus\<close> (**)(eval_binop "#sub_"),
  13.180 +  		\<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
  13.181 +  		\<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e"),
  13.182 +  		\<^rule_eval>\<open>sqrt\<close> (eval_sqrt "#sqrt_"),
  13.183 +  		\<^rule_eval>\<open>powr\<close> (**)(eval_binop "#power_"),
  13.184 +       Rule.Rls_ reduce_012],
  13.185 +    scr = Rule.Empty_Prog});
  13.186  \<close>
  13.187  rule_set_knowledge
  13.188    cancel_leading_coeff = cancel_leading_coeff and
  13.189 @@ -432,39 +424,35 @@
  13.190    polyeq_simplify = polyeq_simplify
  13.191  ML\<open>
  13.192  
  13.193 -(* ------------- polySolve ------------------ *)
  13.194 +(* the subsequent rule-sets are caused by the lack of rewriting at the time of implementation *)
  13.195  (* -- d0 -- *)
  13.196  (*isolate the bound variable in an d0 equation; 'bdv' is a meta-constant*)
  13.197  val d0_polyeq_simplify = prep_rls'(
  13.198    Rule_Def.Repeat {id = "d0_polyeq_simplify", preconds = [],
  13.199 -       rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord),
  13.200 -       erls = PolyEq_erls,
  13.201 -       srls = Rule_Set.Empty, 
  13.202 -       calc = [], errpatts = [],
  13.203 -       rules = [\<^rule_thm>\<open>d0_true\<close>, \<^rule_thm>\<open>d0_false\<close>],
  13.204 -       scr = Rule.Empty_Prog
  13.205 -       });
  13.206 +    rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord),
  13.207 +    erls = PolyEq_erls,
  13.208 +    srls = Rule_Set.Empty, 
  13.209 +    calc = [], errpatts = [],
  13.210 +    rules = [
  13.211 +      \<^rule_thm>\<open>d0_true\<close>,
  13.212 +      \<^rule_thm>\<open>d0_false\<close>],
  13.213 +    scr = Rule.Empty_Prog});
  13.214  
  13.215  (* -- d1 -- *)
  13.216  (*isolate the bound variable in an d1 equation; 'bdv' is a meta-constant*)
  13.217  val d1_polyeq_simplify = prep_rls'(
  13.218    Rule_Def.Repeat {id = "d1_polyeq_simplify", preconds = [],
  13.219 -       rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord),
  13.220 -       erls = PolyEq_erls,
  13.221 -       srls = Rule_Set.Empty, 
  13.222 -       calc = [], errpatts = [],
  13.223 -       rules = [
  13.224 -		\<^rule_thm>\<open>d1_isolate_add1\<close>, 
  13.225 -		(* a+bx=0 -> bx=-a *)
  13.226 -		\<^rule_thm>\<open>d1_isolate_add2\<close>, 
  13.227 -		(* a+ x=0 ->  x=-a *)
  13.228 -		\<^rule_thm>\<open>d1_isolate_div\<close>    
  13.229 -		(*   bx=c -> x=c/b *)  
  13.230 -		],
  13.231 -       scr = Rule.Empty_Prog
  13.232 -       });
  13.233 +    rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord),
  13.234 +    erls = PolyEq_erls,
  13.235 +    srls = Rule_Set.Empty, 
  13.236 +    calc = [], errpatts = [],
  13.237 +    rules = [
  13.238 +  		\<^rule_thm>\<open>d1_isolate_add1\<close>, (* a+bx=0 -> bx=-a *)
  13.239 +  		\<^rule_thm>\<open>d1_isolate_add2\<close>, (* a+ x=0 ->  x=-a *)
  13.240 +  		\<^rule_thm>\<open>d1_isolate_div\<close>   (*   bx=c -> x=c/b *)],
  13.241 +    scr = Rule.Empty_Prog});
  13.242 +\<close>
  13.243  
  13.244 -\<close>
  13.245  subsection \<open>degree 2\<close>
  13.246  ML\<open>
  13.247  (* isolate the bound variable in an d2 equation with bdv only;
  13.248 @@ -472,8 +460,8 @@
  13.249  val d2_polyeq_bdv_only_simplify = prep_rls'(
  13.250    Rule_Def.Repeat {id = "d2_polyeq_bdv_only_simplify", preconds = [], rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord),
  13.251      erls = PolyEq_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  13.252 -    rules =
  13.253 -      [\<^rule_thm>\<open>d2_prescind1\<close>, (*   ax+bx^2=0 -> x(a+bx)=0 *)
  13.254 +    rules = [
  13.255 +       \<^rule_thm>\<open>d2_prescind1\<close>, (*   ax+bx^2=0 -> x(a+bx)=0 *)
  13.256         \<^rule_thm>\<open>d2_prescind2\<close>, (*   ax+ x^2=0 -> x(a+ x)=0 *)
  13.257         \<^rule_thm>\<open>d2_prescind3\<close>, (*    x+bx^2=0 -> x(1+bx)=0 *)
  13.258         \<^rule_thm>\<open>d2_prescind4\<close>, (*    x+ x^2=0 -> x(1+ x)=0 *)
  13.259 @@ -482,278 +470,151 @@
  13.260         \<^rule_thm>\<open>d2_sqrt_equation2\<close>,    (*  x^2=0 ->    x=0       *)
  13.261         \<^rule_thm>\<open>d2_reduce_equation1\<close>,(* x(a+bx)=0 -> x=0 |a+bx=0*)
  13.262         \<^rule_thm>\<open>d2_reduce_equation2\<close>,(* x(a+ x)=0 -> x=0 |a+ x=0*)
  13.263 -       \<^rule_thm>\<open>d2_isolate_div\<close>           (* bx^2=c -> x^2=c/b      *)
  13.264 -       ],
  13.265 -       scr = Rule.Empty_Prog
  13.266 -       });
  13.267 -\<close>
  13.268 -ML\<open>
  13.269 -(* isolate the bound variable in an d2 equation with sqrt only; 
  13.270 +       \<^rule_thm>\<open>d2_isolate_div\<close>],           (* bx^2=c -> x^2=c/b      *)
  13.271 +    scr = Rule.Empty_Prog});
  13.272 +
  13.273 +(* isolate the bound variable in an d2 equation with sqrt only;
  13.274     'bdv' is a meta-constant*)
  13.275  val d2_polyeq_sq_only_simplify = prep_rls'(
  13.276    Rule_Def.Repeat {id = "d2_polyeq_sq_only_simplify", preconds = [],
  13.277 -       rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord),
  13.278 -       erls = PolyEq_erls,
  13.279 -       srls = Rule_Set.Empty, 
  13.280 -       calc = [], errpatts = [],
  13.281 -       (*asm_thm = [("d2_sqrt_equation1", ""),("d2_sqrt_equation1_neg", ""),
  13.282 -                  ("d2_isolate_div", "")],*)
  13.283 -       rules = [\<^rule_thm>\<open>d2_isolate_add1\<close>,
  13.284 -                (* a+   bx^2=0 -> bx^2=(-1)a*)
  13.285 -		\<^rule_thm>\<open>d2_isolate_add2\<close>,
  13.286 -                (* a+    x^2=0 ->  x^2=(-1)a*)
  13.287 -		\<^rule_thm>\<open>d2_sqrt_equation2\<close>,
  13.288 -                (*  x^2=0 ->    x=0    *)
  13.289 -		\<^rule_thm>\<open>d2_sqrt_equation1\<close>,
  13.290 -                (* x^2=c   -> x=+-sqrt(c)*)
  13.291 -		\<^rule_thm>\<open>d2_sqrt_equation1_neg\<close>,
  13.292 -                (* [c<0] x^2=c  -> x=[] *)
  13.293 -		\<^rule_thm>\<open>d2_isolate_div\<close>
  13.294 -                 (* bx^2=c -> x^2=c/b*)
  13.295 -		],
  13.296 -       scr = Rule.Empty_Prog
  13.297 -       });
  13.298 +    rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord),
  13.299 +    erls = PolyEq_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  13.300 +    rules = [
  13.301 +      \<^rule_thm>\<open>d2_isolate_add1\<close>,(* a+   bx^2=0 -> bx^2=(-1)a*)
  13.302 +  		\<^rule_thm>\<open>d2_isolate_add2\<close>,  (* a+    x^2=0 ->  x^2=(-1)a*)
  13.303 +  		\<^rule_thm>\<open>d2_sqrt_equation2\<close>,     (*  x^2=0 ->    x=0    *)
  13.304 +  		\<^rule_thm>\<open>d2_sqrt_equation1\<close>,      (* x^2=c   -> x=+-sqrt(c)*)
  13.305 +  		\<^rule_thm>\<open>d2_sqrt_equation1_neg\<close>,(* [c<0] x^2=c  -> x=[] *)
  13.306 +  		\<^rule_thm>\<open>d2_isolate_div\<close>],        (* bx^2=c -> x^2=c/b*)
  13.307 +    scr = Rule.Empty_Prog});
  13.308  \<close>
  13.309  ML\<open>
  13.310  (* isolate the bound variable in an d2 equation with pqFormula;
  13.311     'bdv' is a meta-constant*)
  13.312  val d2_polyeq_pqFormula_simplify = prep_rls'(
  13.313    Rule_Def.Repeat {id = "d2_polyeq_pqFormula_simplify", preconds = [],
  13.314 -       rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord), erls = PolyEq_erls,
  13.315 -       srls = Rule_Set.Empty, calc = [], errpatts = [],
  13.316 -       rules = [\<^rule_thm>\<open>d2_pqformula1\<close>,
  13.317 -                (* q+px+ x^2=0 *)
  13.318 -		\<^rule_thm>\<open>d2_pqformula1_neg\<close>,
  13.319 -                (* q+px+ x^2=0 *)
  13.320 -		\<^rule_thm>\<open>d2_pqformula2\<close>, 
  13.321 -                (* q+px+1x^2=0 *)
  13.322 -		\<^rule_thm>\<open>d2_pqformula2_neg\<close>,
  13.323 -                (* q+px+1x^2=0 *)
  13.324 -		\<^rule_thm>\<open>d2_pqformula3\<close>,
  13.325 -                (* q+ x+ x^2=0 *)
  13.326 -		\<^rule_thm>\<open>d2_pqformula3_neg\<close>, 
  13.327 -                (* q+ x+ x^2=0 *)
  13.328 -		\<^rule_thm>\<open>d2_pqformula4\<close>,
  13.329 -                (* q+ x+1x^2=0 *)
  13.330 -		\<^rule_thm>\<open>d2_pqformula4_neg\<close>,
  13.331 -                (* q+ x+1x^2=0 *)
  13.332 -		\<^rule_thm>\<open>d2_pqformula5\<close>,
  13.333 -                (*   qx+ x^2=0 *)
  13.334 -		\<^rule_thm>\<open>d2_pqformula6\<close>,
  13.335 -                (*   qx+1x^2=0 *)
  13.336 -		\<^rule_thm>\<open>d2_pqformula7\<close>,
  13.337 -                (*    x+ x^2=0 *)
  13.338 -		\<^rule_thm>\<open>d2_pqformula8\<close>,
  13.339 -                (*    x+1x^2=0 *)
  13.340 -		\<^rule_thm>\<open>d2_pqformula9\<close>,
  13.341 -                (* q   +1x^2=0 *)
  13.342 -		\<^rule_thm>\<open>d2_pqformula9_neg\<close>,
  13.343 -                (* q   +1x^2=0 *)
  13.344 -		\<^rule_thm>\<open>d2_pqformula10\<close>,
  13.345 -                (* q   + x^2=0 *)
  13.346 -		\<^rule_thm>\<open>d2_pqformula10_neg\<close>,
  13.347 -                (* q   + x^2=0 *)
  13.348 -		\<^rule_thm>\<open>d2_sqrt_equation2\<close>,
  13.349 -                (*       x^2=0 *)
  13.350 -		\<^rule_thm>\<open>d2_sqrt_equation3\<close>
  13.351 -               (*      1x^2=0 *)
  13.352 -	       ],scr = Rule.Empty_Prog
  13.353 -       });
  13.354 -\<close>
  13.355 -ML\<open>
  13.356 -(* isolate the bound variable in an d2 equation with abcFormula; 
  13.357 +    rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord), erls = PolyEq_erls,
  13.358 +    srls = Rule_Set.Empty, calc = [], errpatts = [],
  13.359 +    rules = [
  13.360 +      \<^rule_thm>\<open>d2_pqformula1\<close>, (* q+px+ x^2=0 *)
  13.361 +  		\<^rule_thm>\<open>d2_pqformula1_neg\<close>, (* q+px+ x^2=0 *)
  13.362 +  		\<^rule_thm>\<open>d2_pqformula2\<close>, (* q+px+1x^2=0 *)
  13.363 +  		\<^rule_thm>\<open>d2_pqformula2_neg\<close>, (* q+px+1x^2=0 *)
  13.364 +  		\<^rule_thm>\<open>d2_pqformula3\<close>, (* q+ x+ x^2=0 *)
  13.365 +  		\<^rule_thm>\<open>d2_pqformula3_neg\<close>, (* q+ x+ x^2=0 *)
  13.366 +  		\<^rule_thm>\<open>d2_pqformula4\<close>, (* q+ x+1x^2=0 *)
  13.367 +  		\<^rule_thm>\<open>d2_pqformula4_neg\<close>, (* q+ x+1x^2=0 *)
  13.368 +  		\<^rule_thm>\<open>d2_pqformula5\<close>, (*   qx+ x^2=0 *)
  13.369 +  		\<^rule_thm>\<open>d2_pqformula6\<close>, (*   qx+1x^2=0 *)
  13.370 +  		\<^rule_thm>\<open>d2_pqformula7\<close>, (*    x+ x^2=0 *)
  13.371 +  		\<^rule_thm>\<open>d2_pqformula8\<close>, (*    x+1x^2=0 *)
  13.372 +  		\<^rule_thm>\<open>d2_pqformula9\<close>, (* q   +1x^2=0 *)
  13.373 +  		\<^rule_thm>\<open>d2_pqformula9_neg\<close>, (* q   +1x^2=0 *)
  13.374 +  		\<^rule_thm>\<open>d2_pqformula10\<close>, (* q   + x^2=0 *)
  13.375 +  		\<^rule_thm>\<open>d2_pqformula10_neg\<close>, (* q   + x^2=0 *)
  13.376 +  		\<^rule_thm>\<open>d2_sqrt_equation2\<close>, (*       x^2=0 *)
  13.377 +  		\<^rule_thm>\<open>d2_sqrt_equation3\<close>], (*      1x^2=0 *)
  13.378 +    scr = Rule.Empty_Prog});
  13.379 +
  13.380 +(* isolate the bound variable in an d2 equation with abcFormula;
  13.381     'bdv' is a meta-constant*)
  13.382  val d2_polyeq_abcFormula_simplify = prep_rls'(
  13.383    Rule_Def.Repeat {id = "d2_polyeq_abcFormula_simplify", preconds = [],
  13.384 -       rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord), erls = PolyEq_erls,
  13.385 -       srls = Rule_Set.Empty, calc = [], errpatts = [],
  13.386 -       rules = [\<^rule_thm>\<open>d2_abcformula1\<close>,
  13.387 -                (*c+bx+cx^2=0 *)
  13.388 -		\<^rule_thm>\<open>d2_abcformula1_neg\<close>,
  13.389 -                (*c+bx+cx^2=0 *)
  13.390 -		\<^rule_thm>\<open>d2_abcformula2\<close>,
  13.391 -                (*c+ x+cx^2=0 *)
  13.392 -		\<^rule_thm>\<open>d2_abcformula2_neg\<close>,
  13.393 -                (*c+ x+cx^2=0 *)
  13.394 -		\<^rule_thm>\<open>d2_abcformula3\<close>, 
  13.395 -                (*c+bx+ x^2=0 *)
  13.396 -		\<^rule_thm>\<open>d2_abcformula3_neg\<close>,
  13.397 -                (*c+bx+ x^2=0 *)
  13.398 -		\<^rule_thm>\<open>d2_abcformula4\<close>,
  13.399 -                (*c+ x+ x^2=0 *)
  13.400 -		\<^rule_thm>\<open>d2_abcformula4_neg\<close>,
  13.401 -                (*c+ x+ x^2=0 *)
  13.402 -		\<^rule_thm>\<open>d2_abcformula5\<close>,
  13.403 -                (*c+   cx^2=0 *)
  13.404 -		\<^rule_thm>\<open>d2_abcformula5_neg\<close>,
  13.405 -                (*c+   cx^2=0 *)
  13.406 -		\<^rule_thm>\<open>d2_abcformula6\<close>,
  13.407 -                (*c+    x^2=0 *)
  13.408 -		\<^rule_thm>\<open>d2_abcformula6_neg\<close>,
  13.409 -                (*c+    x^2=0 *)
  13.410 -		\<^rule_thm>\<open>d2_abcformula7\<close>,
  13.411 -                (*  bx+ax^2=0 *)
  13.412 -		\<^rule_thm>\<open>d2_abcformula8\<close>,
  13.413 -                (*  bx+ x^2=0 *)
  13.414 -		\<^rule_thm>\<open>d2_abcformula9\<close>,
  13.415 -                (*   x+ax^2=0 *)
  13.416 -		\<^rule_thm>\<open>d2_abcformula10\<close>,
  13.417 -                (*   x+ x^2=0 *)
  13.418 -		\<^rule_thm>\<open>d2_sqrt_equation2\<close>,
  13.419 -                (*      x^2=0 *)  
  13.420 -		\<^rule_thm>\<open>d2_sqrt_equation3\<close>
  13.421 -               (*     bx^2=0 *)  
  13.422 -	       ],
  13.423 -       scr = Rule.Empty_Prog
  13.424 -       });
  13.425 -\<close>
  13.426 -ML\<open>
  13.427 +    rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord), erls = PolyEq_erls,
  13.428 +    srls = Rule_Set.Empty, calc = [], errpatts = [],
  13.429 +    rules = [
  13.430 +      \<^rule_thm>\<open>d2_abcformula1\<close>, (*c+bx+cx^2=0 *)
  13.431 +  		\<^rule_thm>\<open>d2_abcformula1_neg\<close>, (*c+bx+cx^2=0 *)
  13.432 +  		\<^rule_thm>\<open>d2_abcformula2\<close>, (*c+ x+cx^2=0 *)
  13.433 +  		\<^rule_thm>\<open>d2_abcformula2_neg\<close>, (*c+ x+cx^2=0 *)
  13.434 +  		\<^rule_thm>\<open>d2_abcformula3\<close>, (*c+bx+ x^2=0 *)
  13.435 +  		\<^rule_thm>\<open>d2_abcformula3_neg\<close>, (*c+bx+ x^2=0 *)
  13.436 +  		\<^rule_thm>\<open>d2_abcformula4\<close>, (*c+ x+ x^2=0 *)
  13.437 +  		\<^rule_thm>\<open>d2_abcformula4_neg\<close>, (*c+ x+ x^2=0 *)
  13.438 +  		\<^rule_thm>\<open>d2_abcformula5\<close>, (*c+   cx^2=0 *)
  13.439 +  		\<^rule_thm>\<open>d2_abcformula5_neg\<close>, (*c+   cx^2=0 *)
  13.440 +  		\<^rule_thm>\<open>d2_abcformula6\<close>, (*c+    x^2=0 *)
  13.441 +  		\<^rule_thm>\<open>d2_abcformula6_neg\<close>, (*c+    x^2=0 *)
  13.442 +  		\<^rule_thm>\<open>d2_abcformula7\<close>, (*  bx+ax^2=0 *)
  13.443 +  		\<^rule_thm>\<open>d2_abcformula8\<close>, (*  bx+ x^2=0 *)
  13.444 +  		\<^rule_thm>\<open>d2_abcformula9\<close>, (*   x+ax^2=0 *)
  13.445 +  		\<^rule_thm>\<open>d2_abcformula10\<close>, (*   x+ x^2=0 *)
  13.446 +  		\<^rule_thm>\<open>d2_sqrt_equation2\<close>, (*      x^2=0 *)  
  13.447 +  		\<^rule_thm>\<open>d2_sqrt_equation3\<close>], (*     bx^2=0 *)  
  13.448 +    scr = Rule.Empty_Prog});
  13.449  
  13.450  (* isolate the bound variable in an d2 equation; 
  13.451     'bdv' is a meta-constant*)
  13.452  val d2_polyeq_simplify = prep_rls'(
  13.453    Rule_Def.Repeat {id = "d2_polyeq_simplify", preconds = [],
  13.454 -       rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord), erls = PolyEq_erls,
  13.455 -       srls = Rule_Set.Empty, calc = [], errpatts = [],
  13.456 -       rules = [\<^rule_thm>\<open>d2_pqformula1\<close>,
  13.457 -                (* p+qx+ x^2=0 *)
  13.458 -		\<^rule_thm>\<open>d2_pqformula1_neg\<close>,
  13.459 -                (* p+qx+ x^2=0 *)
  13.460 -		\<^rule_thm>\<open>d2_pqformula2\<close>,
  13.461 -                (* p+qx+1x^2=0 *)
  13.462 -		\<^rule_thm>\<open>d2_pqformula2_neg\<close>,
  13.463 -                (* p+qx+1x^2=0 *)
  13.464 -		\<^rule_thm>\<open>d2_pqformula3\<close>,
  13.465 -                (* p+ x+ x^2=0 *)
  13.466 -		\<^rule_thm>\<open>d2_pqformula3_neg\<close>,
  13.467 -                (* p+ x+ x^2=0 *)
  13.468 -		\<^rule_thm>\<open>d2_pqformula4\<close>, 
  13.469 -                (* p+ x+1x^2=0 *)
  13.470 -		\<^rule_thm>\<open>d2_pqformula4_neg\<close>,
  13.471 -                (* p+ x+1x^2=0 *)
  13.472 -		\<^rule_thm>\<open>d2_abcformula1\<close>,
  13.473 -                (* c+bx+cx^2=0 *)
  13.474 -		\<^rule_thm>\<open>d2_abcformula1_neg\<close>,
  13.475 -                (* c+bx+cx^2=0 *)
  13.476 -		\<^rule_thm>\<open>d2_abcformula2\<close>,
  13.477 -                (* c+ x+cx^2=0 *)
  13.478 -		\<^rule_thm>\<open>d2_abcformula2_neg\<close>,
  13.479 -                (* c+ x+cx^2=0 *)
  13.480 -		\<^rule_thm>\<open>d2_prescind1\<close>,
  13.481 -                (*   ax+bx^2=0 -> x(a+bx)=0 *)
  13.482 -		\<^rule_thm>\<open>d2_prescind2\<close>,
  13.483 -                (*   ax+ x^2=0 -> x(a+ x)=0 *)
  13.484 -		\<^rule_thm>\<open>d2_prescind3\<close>,
  13.485 -                (*    x+bx^2=0 -> x(1+bx)=0 *)
  13.486 -		\<^rule_thm>\<open>d2_prescind4\<close>,
  13.487 -                (*    x+ x^2=0 -> x(1+ x)=0 *)
  13.488 -		\<^rule_thm>\<open>d2_isolate_add1\<close>,
  13.489 -                (* a+   bx^2=0 -> bx^2=(-1)a*)
  13.490 -		\<^rule_thm>\<open>d2_isolate_add2\<close>,
  13.491 -                (* a+    x^2=0 ->  x^2=(-1)a*)
  13.492 -		\<^rule_thm>\<open>d2_sqrt_equation1\<close>,
  13.493 -                (* x^2=c   -> x=+-sqrt(c)*)
  13.494 -		\<^rule_thm>\<open>d2_sqrt_equation1_neg\<close>,
  13.495 -                (* [c<0] x^2=c   -> x=[]*)
  13.496 -		\<^rule_thm>\<open>d2_sqrt_equation2\<close>,
  13.497 -                (*  x^2=0 ->    x=0    *)
  13.498 -		\<^rule_thm>\<open>d2_reduce_equation1\<close>,
  13.499 -                (* x(a+bx)=0 -> x=0 | a+bx=0*)
  13.500 -		\<^rule_thm>\<open>d2_reduce_equation2\<close>,
  13.501 -                (* x(a+ x)=0 -> x=0 | a+ x=0*)
  13.502 -		\<^rule_thm>\<open>d2_isolate_div\<close>
  13.503 -               (* bx^2=c -> x^2=c/b*)
  13.504 -	       ],
  13.505 -       scr = Rule.Empty_Prog
  13.506 -      });
  13.507 -\<close>
  13.508 -ML\<open>
  13.509 +    rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord), erls = PolyEq_erls,
  13.510 +    srls = Rule_Set.Empty, calc = [], errpatts = [],
  13.511 +    rules = [
  13.512 +      \<^rule_thm>\<open>d2_pqformula1\<close>, (* p+qx+ x^2=0 *)
  13.513 +  		\<^rule_thm>\<open>d2_pqformula1_neg\<close>, (* p+qx+ x^2=0 *)
  13.514 +  		\<^rule_thm>\<open>d2_pqformula2\<close>, (* p+qx+1x^2=0 *)
  13.515 +  		\<^rule_thm>\<open>d2_pqformula2_neg\<close>, (* p+qx+1x^2=0 *)
  13.516 +  		\<^rule_thm>\<open>d2_pqformula3\<close>, (* p+ x+ x^2=0 *)
  13.517 +  		\<^rule_thm>\<open>d2_pqformula3_neg\<close>, (* p+ x+ x^2=0 *)
  13.518 +  		\<^rule_thm>\<open>d2_pqformula4\<close>, (* p+ x+1x^2=0 *)
  13.519 +  		\<^rule_thm>\<open>d2_pqformula4_neg\<close>, (* p+ x+1x^2=0 *)
  13.520 +  		\<^rule_thm>\<open>d2_abcformula1\<close>, (* c+bx+cx^2=0 *)
  13.521 +  		\<^rule_thm>\<open>d2_abcformula1_neg\<close>, (* c+bx+cx^2=0 *)
  13.522 +  		\<^rule_thm>\<open>d2_abcformula2\<close>, (* c+ x+cx^2=0 *)
  13.523 +  		\<^rule_thm>\<open>d2_abcformula2_neg\<close>, (* c+ x+cx^2=0 *)
  13.524 +  		\<^rule_thm>\<open>d2_prescind1\<close>, (*   ax+bx^2=0 -> x(a+bx)=0 *)
  13.525 +  		\<^rule_thm>\<open>d2_prescind2\<close>, (*   ax+ x^2=0 -> x(a+ x)=0 *)
  13.526 +  		\<^rule_thm>\<open>d2_prescind3\<close>, (*    x+bx^2=0 -> x(1+bx)=0 *)
  13.527 +  		\<^rule_thm>\<open>d2_prescind4\<close>, (*    x+ x^2=0 -> x(1+ x)=0 *)
  13.528 +  		\<^rule_thm>\<open>d2_isolate_add1\<close>, (* a+   bx^2=0 -> bx^2=(-1)a*)
  13.529 +  		\<^rule_thm>\<open>d2_isolate_add2\<close>, (* a+    x^2=0 ->  x^2=(-1)a*)
  13.530 +  		\<^rule_thm>\<open>d2_sqrt_equation1\<close>, (* x^2=c   -> x=+-sqrt(c)*)
  13.531 +  		\<^rule_thm>\<open>d2_sqrt_equation1_neg\<close>, (* [c<0] x^2=c   -> x=[]*)
  13.532 +  		\<^rule_thm>\<open>d2_sqrt_equation2\<close>, (*  x^2=0 ->    x=0    *)
  13.533 +  		\<^rule_thm>\<open>d2_reduce_equation1\<close>, (* x(a+bx)=0 -> x=0 | a+bx=0*)
  13.534 +  		\<^rule_thm>\<open>d2_reduce_equation2\<close>, (* x(a+ x)=0 -> x=0 | a+ x=0*)
  13.535 +  		\<^rule_thm>\<open>d2_isolate_div\<close>], (* bx^2=c -> x^2=c/b*)
  13.536 +    scr = Rule.Empty_Prog});
  13.537  
  13.538  (* -- d3 -- *)
  13.539  (* isolate the bound variable in an d3 equation; 'bdv' is a meta-constant *)
  13.540  val d3_polyeq_simplify = prep_rls'(
  13.541    Rule_Def.Repeat {id = "d3_polyeq_simplify", preconds = [],
  13.542 -       rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord), erls = PolyEq_erls,
  13.543 -       srls = Rule_Set.Empty, calc = [], errpatts = [],
  13.544 -       rules = 
  13.545 -       [\<^rule_thm>\<open>d3_reduce_equation1\<close>,
  13.546 -	(*a*bdv + b*bdv \<up> 2 + c*bdv \<up> 3=0) = 
  13.547 -        (bdv=0 | (a + b*bdv + c*bdv \<up> 2=0)*)
  13.548 -	\<^rule_thm>\<open>d3_reduce_equation2\<close>,
  13.549 -	(*  bdv + b*bdv \<up> 2 + c*bdv \<up> 3=0) = 
  13.550 -        (bdv=0 | (1 + b*bdv + c*bdv \<up> 2=0)*)
  13.551 -	\<^rule_thm>\<open>d3_reduce_equation3\<close>,
  13.552 -	(*a*bdv +   bdv \<up> 2 + c*bdv \<up> 3=0) = 
  13.553 -        (bdv=0 | (a +   bdv + c*bdv \<up> 2=0)*)
  13.554 -	\<^rule_thm>\<open>d3_reduce_equation4\<close>,
  13.555 -	(*  bdv +   bdv \<up> 2 + c*bdv \<up> 3=0) = 
  13.556 -        (bdv=0 | (1 +   bdv + c*bdv \<up> 2=0)*)
  13.557 -	\<^rule_thm>\<open>d3_reduce_equation5\<close>,
  13.558 -	(*a*bdv + b*bdv \<up> 2 +   bdv \<up> 3=0) = 
  13.559 -        (bdv=0 | (a + b*bdv +   bdv \<up> 2=0)*)
  13.560 -	\<^rule_thm>\<open>d3_reduce_equation6\<close>,
  13.561 -	(*  bdv + b*bdv \<up> 2 +   bdv \<up> 3=0) = 
  13.562 -        (bdv=0 | (1 + b*bdv +   bdv \<up> 2=0)*)
  13.563 -	\<^rule_thm>\<open>d3_reduce_equation7\<close>,
  13.564 -	     (*a*bdv +   bdv \<up> 2 +   bdv \<up> 3=0) = 
  13.565 -             (bdv=0 | (1 +   bdv +   bdv \<up> 2=0)*)
  13.566 -	\<^rule_thm>\<open>d3_reduce_equation8\<close>,
  13.567 -	     (*  bdv +   bdv \<up> 2 +   bdv \<up> 3=0) = 
  13.568 -             (bdv=0 | (1 +   bdv +   bdv \<up> 2=0)*)
  13.569 -	\<^rule_thm>\<open>d3_reduce_equation9\<close>,
  13.570 -	     (*a*bdv             + c*bdv \<up> 3=0) = 
  13.571 -             (bdv=0 | (a         + c*bdv \<up> 2=0)*)
  13.572 -	\<^rule_thm>\<open>d3_reduce_equation10\<close>,
  13.573 -	     (*  bdv             + c*bdv \<up> 3=0) = 
  13.574 -             (bdv=0 | (1         + c*bdv \<up> 2=0)*)
  13.575 -	\<^rule_thm>\<open>d3_reduce_equation11\<close>,
  13.576 -	     (*a*bdv             +   bdv \<up> 3=0) = 
  13.577 -             (bdv=0 | (a         +   bdv \<up> 2=0)*)
  13.578 -	\<^rule_thm>\<open>d3_reduce_equation12\<close>,
  13.579 -	     (*  bdv             +   bdv \<up> 3=0) = 
  13.580 -             (bdv=0 | (1         +   bdv \<up> 2=0)*)
  13.581 -	\<^rule_thm>\<open>d3_reduce_equation13\<close>,
  13.582 -	     (*        b*bdv \<up> 2 + c*bdv \<up> 3=0) = 
  13.583 -             (bdv=0 | (    b*bdv + c*bdv \<up> 2=0)*)
  13.584 -	\<^rule_thm>\<open>d3_reduce_equation14\<close>,
  13.585 -	     (*          bdv \<up> 2 + c*bdv \<up> 3=0) = 
  13.586 -             (bdv=0 | (      bdv + c*bdv \<up> 2=0)*)
  13.587 -	\<^rule_thm>\<open>d3_reduce_equation15\<close>,
  13.588 -	     (*        b*bdv \<up> 2 +   bdv \<up> 3=0) = 
  13.589 -             (bdv=0 | (    b*bdv +   bdv \<up> 2=0)*)
  13.590 -	\<^rule_thm>\<open>d3_reduce_equation16\<close>,
  13.591 -	     (*          bdv \<up> 2 +   bdv \<up> 3=0) = 
  13.592 -             (bdv=0 | (      bdv +   bdv \<up> 2=0)*)
  13.593 -	\<^rule_thm>\<open>d3_isolate_add1\<close>,
  13.594 -	     (*[|Not(bdv occurs_in a)|] ==> (a + b*bdv \<up> 3=0) = 
  13.595 -              (bdv=0 | (b*bdv \<up> 3=a)*)
  13.596 -	\<^rule_thm>\<open>d3_isolate_add2\<close>,
  13.597 -             (*[|Not(bdv occurs_in a)|] ==> (a +   bdv \<up> 3=0) = 
  13.598 -              (bdv=0 | (  bdv \<up> 3=a)*)
  13.599 -	\<^rule_thm>\<open>d3_isolate_div\<close>,
  13.600 -        (*[|Not(b=0)|] ==> (b*bdv \<up> 3=c) = (bdv \<up> 3=c/b*)
  13.601 -        \<^rule_thm>\<open>d3_root_equation2\<close>,
  13.602 -        (*(bdv \<up> 3=0) = (bdv=0) *)
  13.603 -	\<^rule_thm>\<open>d3_root_equation1\<close>
  13.604 -       (*bdv \<up> 3=c) = (bdv = nroot 3 c*)
  13.605 -       ],
  13.606 -       scr = Rule.Empty_Prog
  13.607 -      });
  13.608 -\<close>
  13.609 -ML\<open>
  13.610 +    rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord), erls = PolyEq_erls,
  13.611 +    srls = Rule_Set.Empty, calc = [], errpatts = [],
  13.612 +    rules = [
  13.613 +      \<^rule_thm>\<open>d3_reduce_equation1\<close>, (*a*bdv + b*bdv \<up> 2 + c*bdv \<up> 3=0) = (bdv=0 | (a + b*bdv + c*bdv \<up> 2=0)*)
  13.614 +    	\<^rule_thm>\<open>d3_reduce_equation2\<close>, (*  bdv + b*bdv \<up> 2 + c*bdv \<up> 3=0) = (bdv=0 | (1 + b*bdv + c*bdv \<up> 2=0)*)
  13.615 +    	\<^rule_thm>\<open>d3_reduce_equation3\<close>, (*a*bdv +   bdv \<up> 2 + c*bdv \<up> 3=0) = (bdv=0 | (a +   bdv + c*bdv \<up> 2=0)*)
  13.616 +    	\<^rule_thm>\<open>d3_reduce_equation4\<close>, (*  bdv +   bdv \<up> 2 + c*bdv \<up> 3=0) = (bdv=0 | (1 +   bdv + c*bdv \<up> 2=0)*)
  13.617 +    	\<^rule_thm>\<open>d3_reduce_equation5\<close>, (*a*bdv + b*bdv \<up> 2 +   bdv \<up> 3=0) = (bdv=0 | (a + b*bdv +   bdv \<up> 2=0)*)
  13.618 +    	\<^rule_thm>\<open>d3_reduce_equation6\<close>, (*  bdv + b*bdv \<up> 2 +   bdv \<up> 3=0) = (bdv=0 | (1 + b*bdv +   bdv \<up> 2=0)*)
  13.619 +    	\<^rule_thm>\<open>d3_reduce_equation7\<close>, (*a*bdv +   bdv \<up> 2 +   bdv \<up> 3=0) = (bdv=0 | (1 +   bdv +   bdv \<up> 2=0)*)
  13.620 +    	\<^rule_thm>\<open>d3_reduce_equation8\<close>, (*  bdv +   bdv \<up> 2 +   bdv \<up> 3=0) = (bdv=0 | (1 +   bdv +   bdv \<up> 2=0)*)
  13.621 +    	\<^rule_thm>\<open>d3_reduce_equation9\<close>, (*a*bdv             + c*bdv \<up> 3=0) = (bdv=0 | (a         + c*bdv \<up> 2=0)*)
  13.622 +    	\<^rule_thm>\<open>d3_reduce_equation10\<close>, (*  bdv             + c*bdv \<up> 3=0) = (bdv=0 | (1         + c*bdv \<up> 2=0)*)
  13.623 +    	\<^rule_thm>\<open>d3_reduce_equation11\<close>, (*a*bdv             +   bdv \<up> 3=0) = (bdv=0 | (a         +   bdv \<up> 2=0)*)
  13.624 +    	\<^rule_thm>\<open>d3_reduce_equation12\<close>, (*  bdv             +   bdv \<up> 3=0) = (bdv=0 | (1         +   bdv \<up> 2=0)*)
  13.625 +    	\<^rule_thm>\<open>d3_reduce_equation13\<close>, (*        b*bdv \<up> 2 + c*bdv \<up> 3=0) = (bdv=0 | (    b*bdv + c*bdv \<up> 2=0)*)
  13.626 +    	\<^rule_thm>\<open>d3_reduce_equation14\<close>, (*          bdv \<up> 2 + c*bdv \<up> 3=0) = (bdv=0 | (      bdv + c*bdv \<up> 2=0)*)
  13.627 +    	\<^rule_thm>\<open>d3_reduce_equation15\<close>, (*        b*bdv \<up> 2 +   bdv \<up> 3=0) = (bdv=0 | (    b*bdv +   bdv \<up> 2=0)*)
  13.628 +    	\<^rule_thm>\<open>d3_reduce_equation16\<close>, (*          bdv \<up> 2 +   bdv \<up> 3=0) = (bdv=0 | (      bdv +   bdv \<up> 2=0)*)
  13.629 +    	\<^rule_thm>\<open>d3_isolate_add1\<close>, (*[|Not(bdv occurs_in a)|] ==> (a + b*bdv \<up> 3=0) = (bdv=0 | (b*bdv \<up> 3=a)*)
  13.630 +    	\<^rule_thm>\<open>d3_isolate_add2\<close>, (*[|Not(bdv occurs_in a)|] ==> (a +   bdv \<up> 3=0) = (bdv=0 | (  bdv \<up> 3=a)*)
  13.631 +    	\<^rule_thm>\<open>d3_isolate_div\<close>, (*[|Not(b=0)|] ==> (b*bdv \<up> 3=c) = (bdv \<up> 3=c/b*)
  13.632 +      \<^rule_thm>\<open>d3_root_equation2\<close>, (*(bdv \<up> 3=0) = (bdv=0) *)
  13.633 +    	\<^rule_thm>\<open>d3_root_equation1\<close>], (*bdv \<up> 3=c) = (bdv = nroot 3 c*)
  13.634 +    scr = Rule.Empty_Prog});
  13.635  
  13.636  (* -- d4 -- *)
  13.637  (*isolate the bound variable in an d4 equation; 'bdv' is a meta-constant*)
  13.638  val d4_polyeq_simplify = prep_rls'(
  13.639    Rule_Def.Repeat {id = "d4_polyeq_simplify", preconds = [],
  13.640 -       rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord), erls = PolyEq_erls,
  13.641 -       srls = Rule_Set.Empty, calc = [], errpatts = [],
  13.642 -       rules = 
  13.643 -       [\<^rule_thm>\<open>d4_sub_u1\<close>  
  13.644 -       (* ax^4+bx^2+c=0 -> x=+-sqrt(ax^2+bx^+c) *)
  13.645 -       ],
  13.646 -       scr = Rule.Empty_Prog
  13.647 -      });
  13.648 +    rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord), erls = PolyEq_erls,
  13.649 +    srls = Rule_Set.Empty, calc = [], errpatts = [],
  13.650 +    rules = [
  13.651 +      \<^rule_thm>\<open>d4_sub_u1\<close> (* ax^4+bx^2+c=0 -> x=+-sqrt(ax^2+bx^+c) *)],
  13.652 +    scr = Rule.Empty_Prog});
  13.653  \<close>
  13.654  rule_set_knowledge
  13.655    d0_polyeq_simplify = d0_polyeq_simplify and
  13.656 @@ -1253,109 +1114,94 @@
  13.657  ML\<open>
  13.658  val order_add_mult_in = prep_rls'(
  13.659    Rule_Def.Repeat{id = "order_add_mult_in", preconds = [], 
  13.660 -      rew_ord = ("ord_make_polynomial_in", ord_make_polynomial_in false @{theory "Poly"}),
  13.661 -      erls = Rule_Set.empty,srls = Rule_Set.Empty,
  13.662 -      calc = [], errpatts = [],
  13.663 -      rules = [\<^rule_thm>\<open>mult.commute\<close>,
  13.664 -	       (* z * w = w * z *)
  13.665 -	       \<^rule_thm>\<open>real_mult_left_commute\<close>,
  13.666 -	       (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*)
  13.667 -	       \<^rule_thm>\<open>mult.assoc\<close>,		
  13.668 -	       (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*)
  13.669 -	       \<^rule_thm>\<open>add.commute\<close>,	
  13.670 -	       (*z + w = w + z*)
  13.671 -	       \<^rule_thm>\<open>add.left_commute\<close>,
  13.672 -	       (*x + (y + z) = y + (x + z)*)
  13.673 -	       \<^rule_thm>\<open>add.assoc\<close>	               
  13.674 -	       (*z1.0 + z2.0 + z3.0 = z1.0 + (z2.0 + z3.0)*)
  13.675 -	       ], scr = Rule.Empty_Prog});
  13.676 +    rew_ord = ("ord_make_polynomial_in", ord_make_polynomial_in false @{theory "Poly"}),
  13.677 +    erls = Rule_Set.empty,srls = Rule_Set.Empty,
  13.678 +    calc = [], errpatts = [],
  13.679 +    rules = [
  13.680 +       \<^rule_thm>\<open>mult.commute\<close>, (* z * w = w * z *)
  13.681 +	     \<^rule_thm>\<open>real_mult_left_commute\<close>, (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*)
  13.682 +	     \<^rule_thm>\<open>mult.assoc\<close>, (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*)
  13.683 +	     \<^rule_thm>\<open>add.commute\<close>,	 (*z + w = w + z*)
  13.684 +	     \<^rule_thm>\<open>add.left_commute\<close>, (*x + (y + z) = y + (x + z)*)
  13.685 +	     \<^rule_thm>\<open>add.assoc\<close>], (*z1.0 + z2.0 + z3.0 = z1.0 + (z2.0 + z3.0)*)
  13.686 +    scr = Rule.Empty_Prog});
  13.687  
  13.688  \<close>
  13.689  ML\<open>
  13.690  val collect_bdv = prep_rls'(
  13.691    Rule_Def.Repeat{id = "collect_bdv", preconds = [], 
  13.692 -      rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  13.693 -      erls = Rule_Set.empty,srls = Rule_Set.Empty,
  13.694 -      calc = [], errpatts = [],
  13.695 -      rules = [\<^rule_thm>\<open>bdv_collect_1\<close>,
  13.696 -	       \<^rule_thm>\<open>bdv_collect_2\<close>,
  13.697 -	       \<^rule_thm>\<open>bdv_collect_3\<close>,
  13.698 -
  13.699 -	       \<^rule_thm>\<open>bdv_collect_assoc1_1\<close>,
  13.700 -	       \<^rule_thm>\<open>bdv_collect_assoc1_2\<close>,
  13.701 -	       \<^rule_thm>\<open>bdv_collect_assoc1_3\<close>,
  13.702 -
  13.703 -	       \<^rule_thm>\<open>bdv_collect_assoc2_1\<close>,
  13.704 -	       \<^rule_thm>\<open>bdv_collect_assoc2_2\<close>,
  13.705 -	       \<^rule_thm>\<open>bdv_collect_assoc2_3\<close>,
  13.706 -
  13.707 -
  13.708 -	       \<^rule_thm>\<open>bdv_n_collect_1\<close>,
  13.709 -	       \<^rule_thm>\<open>bdv_n_collect_2\<close>,
  13.710 -	       \<^rule_thm>\<open>bdv_n_collect_3\<close>,
  13.711 -
  13.712 -	       \<^rule_thm>\<open>bdv_n_collect_assoc1_1\<close>,
  13.713 -	       \<^rule_thm>\<open>bdv_n_collect_assoc1_2\<close>,
  13.714 -	       \<^rule_thm>\<open>bdv_n_collect_assoc1_3\<close>,
  13.715 -
  13.716 -	       \<^rule_thm>\<open>bdv_n_collect_assoc2_1\<close>,
  13.717 -	       \<^rule_thm>\<open>bdv_n_collect_assoc2_2\<close>,
  13.718 -	       \<^rule_thm>\<open>bdv_n_collect_assoc2_3\<close>
  13.719 -	       ], scr = Rule.Empty_Prog});
  13.720 +    rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  13.721 +    erls = Rule_Set.empty,srls = Rule_Set.Empty,
  13.722 +    calc = [], errpatts = [],
  13.723 +    rules = [\<^rule_thm>\<open>bdv_collect_1\<close>,
  13.724 +	     \<^rule_thm>\<open>bdv_collect_2\<close>,
  13.725 +	     \<^rule_thm>\<open>bdv_collect_3\<close>,
  13.726 +    
  13.727 +	     \<^rule_thm>\<open>bdv_collect_assoc1_1\<close>,
  13.728 +	     \<^rule_thm>\<open>bdv_collect_assoc1_2\<close>,
  13.729 +	     \<^rule_thm>\<open>bdv_collect_assoc1_3\<close>,
  13.730 +    
  13.731 +	     \<^rule_thm>\<open>bdv_collect_assoc2_1\<close>,
  13.732 +	     \<^rule_thm>\<open>bdv_collect_assoc2_2\<close>,
  13.733 +	     \<^rule_thm>\<open>bdv_collect_assoc2_3\<close>,
  13.734 +    
  13.735 +    
  13.736 +	     \<^rule_thm>\<open>bdv_n_collect_1\<close>,
  13.737 +	     \<^rule_thm>\<open>bdv_n_collect_2\<close>,
  13.738 +	     \<^rule_thm>\<open>bdv_n_collect_3\<close>,
  13.739 +    
  13.740 +	     \<^rule_thm>\<open>bdv_n_collect_assoc1_1\<close>,
  13.741 +	     \<^rule_thm>\<open>bdv_n_collect_assoc1_2\<close>,
  13.742 +	     \<^rule_thm>\<open>bdv_n_collect_assoc1_3\<close>,
  13.743 +    
  13.744 +	     \<^rule_thm>\<open>bdv_n_collect_assoc2_1\<close>,
  13.745 +	     \<^rule_thm>\<open>bdv_n_collect_assoc2_2\<close>,
  13.746 +	     \<^rule_thm>\<open>bdv_n_collect_assoc2_3\<close>],
  13.747 +    scr = Rule.Empty_Prog});
  13.748  
  13.749  \<close>
  13.750  ML\<open>
  13.751  (*.transforms an arbitrary term without roots to a polynomial [4] 
  13.752     according to knowledge/Poly.sml.*) 
  13.753  val make_polynomial_in = prep_rls'(
  13.754 -  Rule_Set.Sequence {id = "make_polynomial_in", preconds = []:term list, 
  13.755 -       rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  13.756 -      erls = Atools_erls, srls = Rule_Set.Empty,
  13.757 -      calc = [], errpatts = [],
  13.758 -      rules = [Rule.Rls_ expand_poly,
  13.759 -	       Rule.Rls_ order_add_mult_in,
  13.760 -	       Rule.Rls_ simplify_power,
  13.761 -	       Rule.Rls_ collect_numerals,
  13.762 -	       Rule.Rls_ reduce_012,
  13.763 -	       \<^rule_thm>\<open>realpow_oneI\<close>,
  13.764 -	       Rule.Rls_ discard_parentheses,
  13.765 -	       Rule.Rls_ collect_bdv
  13.766 -	       ],
  13.767 -      scr = Rule.Empty_Prog
  13.768 -      });     
  13.769 +  Rule_Set.Sequence {
  13.770 +    id = "make_polynomial_in", preconds = [], rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  13.771 +    erls = Atools_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  13.772 +    rules = [
  13.773 +      Rule.Rls_ expand_poly,
  13.774 +	    Rule.Rls_ order_add_mult_in,
  13.775 +	    Rule.Rls_ simplify_power,
  13.776 +	    Rule.Rls_ collect_numerals,
  13.777 +	    Rule.Rls_ reduce_012,
  13.778 +	    \<^rule_thm>\<open>realpow_oneI\<close>,
  13.779 +	    Rule.Rls_ discard_parentheses,
  13.780 +	    Rule.Rls_ collect_bdv],
  13.781 +    scr = Rule.Empty_Prog});     
  13.782  
  13.783  \<close>
  13.784  ML\<open>
  13.785 -val separate_bdvs = 
  13.786 -    Rule_Set.append_rules "separate_bdvs"
  13.787 -	       collect_bdv
  13.788 -	       [\<^rule_thm>\<open>separate_bdv\<close>,
  13.789 -		(*"?a * ?bdv / ?b = ?a / ?b * ?bdv"*)
  13.790 -		\<^rule_thm>\<open>separate_bdv_n\<close>,
  13.791 -		\<^rule_thm>\<open>separate_1_bdv\<close>,
  13.792 -		(*"?bdv / ?b = (1 / ?b) * ?bdv"*)
  13.793 -		\<^rule_thm>\<open>separate_1_bdv_n\<close>,
  13.794 -		(*"?bdv \<up> ?n / ?b = 1 / ?b * ?bdv \<up> ?n"*)
  13.795 -		\<^rule_thm>\<open>add_divide_distrib\<close>
  13.796 -		(*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"
  13.797 -		      WN051031 DOES NOT BELONG TO HERE*)
  13.798 -		];
  13.799 +val separate_bdvs = Rule_Set.append_rules "separate_bdvs" collect_bdv [
  13.800 +  \<^rule_thm>\<open>separate_bdv\<close>, (*"?a * ?bdv / ?b = ?a / ?b * ?bdv"*)
  13.801 +	\<^rule_thm>\<open>separate_bdv_n\<close>,
  13.802 +	\<^rule_thm>\<open>separate_1_bdv\<close>, (*"?bdv / ?b = (1 / ?b) * ?bdv"*)
  13.803 +	\<^rule_thm>\<open>separate_1_bdv_n\<close>, (*"?bdv \<up> ?n / ?b = 1 / ?b * ?bdv \<up> ?n"*)
  13.804 +	\<^rule_thm>\<open>add_divide_distrib\<close> (*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"
  13.805 +	WN051031 DOES NOT BELONG TO HERE*)];
  13.806  \<close>
  13.807  ML\<open>
  13.808  val make_ratpoly_in = prep_rls'(
  13.809 -  Rule_Set.Sequence {id = "make_ratpoly_in", preconds = []:term list, 
  13.810 -       rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  13.811 -      erls = Atools_erls, srls = Rule_Set.Empty,
  13.812 -      calc = [], errpatts = [],
  13.813 -      rules = [Rule.Rls_ norm_Rational,
  13.814 -	       Rule.Rls_ order_add_mult_in,
  13.815 -	       Rule.Rls_ discard_parentheses,
  13.816 -	       Rule.Rls_ separate_bdvs,
  13.817 -	       (* Rule.Rls_ rearrange_assoc, WN060916 why does cancel_p not work?*)
  13.818 -	       Rule.Rls_ cancel_p
  13.819 -	       (*\<^rule_eval>\<open>divide\<close> (eval_cancel "#divide_e") too weak!*)
  13.820 -	       ],
  13.821 -      scr = Rule.Empty_Prog});      
  13.822 +  Rule_Set.Sequence {
  13.823 +    id = "make_ratpoly_in", preconds = []:term list, rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  13.824 +    erls = Atools_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  13.825 +    rules = [
  13.826 +      Rule.Rls_ norm_Rational,
  13.827 +	    Rule.Rls_ order_add_mult_in,
  13.828 +	    Rule.Rls_ discard_parentheses,
  13.829 +	    Rule.Rls_ separate_bdvs,
  13.830 +	    (* Rule.Rls_ rearrange_assoc, WN060916 why does cancel_p not work?*)
  13.831 +	    Rule.Rls_ cancel_p
  13.832 +	    (*\<^rule_eval>\<open>divide\<close> (eval_cancel "#divide_e") too weak!*)],
  13.833 +    scr = Rule.Empty_Prog});      
  13.834  \<close>
  13.835  rule_set_knowledge
  13.836    order_add_mult_in = order_add_mult_in and
    14.1 --- a/src/Tools/isac/Knowledge/PolyMinus.thy	Mon Aug 09 14:20:20 2021 +0200
    14.2 +++ b/src/Tools/isac/Knowledge/PolyMinus.thy	Tue Aug 10 09:43:07 2021 +0200
    14.3 @@ -187,191 +187,140 @@
    14.4  (** rulesets **)
    14.5  
    14.6  val erls_ordne_alphabetisch =
    14.7 -  Rule_Set.append_rules "erls_ordne_alphabetisch" Rule_Set.empty
    14.8 -	 [Rule.Eval ("PolyMinus.kleiner", eval_kleiner ""),
    14.9 -		Rule.Eval ("PolyMinus.ist_monom", eval_ist_monom "")
   14.10 -		];
   14.11 +  Rule_Set.append_rules "erls_ordne_alphabetisch" Rule_Set.empty [
   14.12 +    \<^rule_eval>\<open>kleiner\<close> (eval_kleiner ""),
   14.13 +    \<^rule_eval>\<open>ist_monom\<close> (eval_ist_monom "")];
   14.14  
   14.15  val ordne_alphabetisch = 
   14.16    Rule_Def.Repeat{id = "ordne_alphabetisch", preconds = [], 
   14.17 -      rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), srls = Rule_Set.Empty, calc = [], errpatts = [],
   14.18 -      erls = erls_ordne_alphabetisch, 
   14.19 -      rules = [\<^rule_thm>\<open>tausche_plus\<close>,
   14.20 -	       (*"b kleiner a ==> (b + a) = (a + b)"*)
   14.21 -	       \<^rule_thm>\<open>tausche_minus\<close>,
   14.22 -	       (*"b kleiner a ==> (b - a) = (-a + b)"*)
   14.23 -	       \<^rule_thm>\<open>tausche_vor_plus\<close>,
   14.24 -	       (*"[| b ist_monom; a kleiner b  |] ==> (- b + a) = (a - b)"*)
   14.25 -	       \<^rule_thm>\<open>tausche_vor_minus\<close>,
   14.26 -	       (*"[| b ist_monom; a kleiner b  |] ==> (- b - a) = (-a - b)"*)
   14.27 -	       \<^rule_thm>\<open>tausche_plus_plus\<close>,
   14.28 -	       (*"c kleiner b ==> (a + c + b) = (a + b + c)"*)
   14.29 -	       \<^rule_thm>\<open>tausche_plus_minus\<close>,
   14.30 -	       (*"c kleiner b ==> (a + c - b) = (a - b + c)"*)
   14.31 -	       \<^rule_thm>\<open>tausche_minus_plus\<close>,
   14.32 -	       (*"c kleiner b ==> (a - c + b) = (a + b - c)"*)
   14.33 -	       \<^rule_thm>\<open>tausche_minus_minus\<close>
   14.34 -	       (*"c kleiner b ==> (a - c - b) = (a - b - c)"*)
   14.35 -	       ], scr = Rule.Empty_Prog};
   14.36 +    rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), srls = Rule_Set.Empty, calc = [], errpatts = [],
   14.37 +    erls = erls_ordne_alphabetisch, 
   14.38 +    rules = [
   14.39 +      \<^rule_thm>\<open>tausche_plus\<close>, (*"b kleiner a ==> (b + a) = (a + b)"*)
   14.40 +      \<^rule_thm>\<open>tausche_minus\<close>, (*"b kleiner a ==> (b - a) = (-a + b)"*)
   14.41 +      \<^rule_thm>\<open>tausche_vor_plus\<close>, (*"[| b ist_monom; a kleiner b  |] ==> (- b + a) = (a - b)"*)
   14.42 +      \<^rule_thm>\<open>tausche_vor_minus\<close>, (*"[| b ist_monom; a kleiner b  |] ==> (- b - a) = (-a - b)"*)
   14.43 +      \<^rule_thm>\<open>tausche_plus_plus\<close>, (*"c kleiner b ==> (a + c + b) = (a + b + c)"*)
   14.44 +      \<^rule_thm>\<open>tausche_plus_minus\<close>, (*"c kleiner b ==> (a + c - b) = (a - b + c)"*)
   14.45 +      \<^rule_thm>\<open>tausche_minus_plus\<close>, (*"c kleiner b ==> (a - c + b) = (a + b - c)"*)
   14.46 +      \<^rule_thm>\<open>tausche_minus_minus\<close>], (*"c kleiner b ==> (a - c - b) = (a - b - c)"*)
   14.47 +    scr = Rule.Empty_Prog};
   14.48  
   14.49  val fasse_zusammen = 
   14.50 -    Rule_Def.Repeat{id = "fasse_zusammen", preconds = [], 
   14.51 -	rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
   14.52 -	erls = Rule_Set.append_rules "erls_fasse_zusammen" Rule_Set.empty 
   14.53 -			  [\<^rule_eval>\<open>Prog_Expr.is_const\<close> (Prog_Expr.eval_const "#is_const_")],
   14.54 -	srls = Rule_Set.Empty, calc = [], errpatts = [],
   14.55 -	rules = 
   14.56 -	[\<^rule_thm>\<open>real_num_collect\<close>, 
   14.57 -	 (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
   14.58 -	 \<^rule_thm>\<open>real_num_collect_assoc_r\<close>,
   14.59 -	 (*"[| l is_const; m..|] ==>  (k + m * n) + l * n = k + (l + m)*n"*)
   14.60 -	 \<^rule_thm>\<open>real_one_collect\<close>,	
   14.61 -	 (*"m is_const ==> n + m * n = (1 + m) * n"*)
   14.62 -	 \<^rule_thm>\<open>real_one_collect_assoc_r\<close>, 
   14.63 -	 (*"m is_const ==> (k + n) + m * n = k + (m + 1) * n"*)
   14.64 +  Rule_Def.Repeat{id = "fasse_zusammen", preconds = [], 
   14.65 +	  rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
   14.66 +	  erls = Rule_Set.append_rules "erls_fasse_zusammen" Rule_Set.empty 
   14.67 +	  	[\<^rule_eval>\<open>Prog_Expr.is_const\<close> (Prog_Expr.eval_const "#is_const_")],
   14.68 +	  srls = Rule_Set.Empty, calc = [], errpatts = [],
   14.69 +	  rules = [
   14.70 +     \<^rule_thm>\<open>real_num_collect\<close>, (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
   14.71 +  	 \<^rule_thm>\<open>real_num_collect_assoc_r\<close>, (*"[| l is_const; m..|] ==>  (k + m * n) + l * n = k + (l + m)*n"*)
   14.72 +  	 \<^rule_thm>\<open>real_one_collect\<close>, (*"m is_const ==> n + m * n = (1 + m) * n"*)
   14.73 +  	 \<^rule_thm>\<open>real_one_collect_assoc_r\<close>, (*"m is_const ==> (k + n) + m * n = k + (m + 1) * n"*)
   14.74  
   14.75 +  	 \<^rule_thm>\<open>subtrahiere\<close>, (*"[| l is_const; m is_const |] ==> m * v - l * v = (m - l) * v"*)
   14.76 +  	 \<^rule_thm>\<open>subtrahiere_von_1\<close>, (*"[| l is_const |] ==> v - l * v = (1 - l) * v"*)
   14.77 +  	 \<^rule_thm>\<open>subtrahiere_1\<close>, (*"[| l is_const; m is_const |] ==> m * v - v = (m - 1) * v"*)
   14.78  
   14.79 -	 \<^rule_thm>\<open>subtrahiere\<close>,
   14.80 -	 (*"[| l is_const; m is_const |] ==> m * v - l * v = (m - l) * v"*)
   14.81 -	 \<^rule_thm>\<open>subtrahiere_von_1\<close>,
   14.82 -	 (*"[| l is_const |] ==> v - l * v = (1 - l) * v"*)
   14.83 -	 \<^rule_thm>\<open>subtrahiere_1\<close>,
   14.84 -	 (*"[| l is_const; m is_const |] ==> m * v - v = (m - 1) * v"*)
   14.85 +  	 \<^rule_thm>\<open>subtrahiere_x_plus_minus\<close>, (*"[| l is_const; m..|] ==> (k + m * n) - l * n = k + ( m - l) * n"*)
   14.86 +  	 \<^rule_thm>\<open>subtrahiere_x_plus1_minus\<close>, (*"[| l is_const |] ==> (x + v) - l * v = x + (1 - l) * v"*)
   14.87 +  	 \<^rule_thm>\<open>subtrahiere_x_plus_minus1\<close>, (*"[| m is_const |] ==> (x + m * v) - v = x + (m - 1) * v"*)
   14.88  
   14.89 -	 \<^rule_thm>\<open>subtrahiere_x_plus_minus\<close>, 
   14.90 -	 (*"[| l is_const; m..|] ==> (k + m * n) - l * n = k + ( m - l) * n"*)
   14.91 -	 \<^rule_thm>\<open>subtrahiere_x_plus1_minus\<close>,
   14.92 -	 (*"[| l is_const |] ==> (x + v) - l * v = x + (1 - l) * v"*)
   14.93 -	 \<^rule_thm>\<open>subtrahiere_x_plus_minus1\<close>,
   14.94 -	 (*"[| m is_const |] ==> (x + m * v) - v = x + (m - 1) * v"*)
   14.95 +  	 \<^rule_thm>\<open>subtrahiere_x_minus_plus\<close>, (*"[| l is_const; m..|] ==> (k - m * n) + l * n = k + (-m + l) * n"*)
   14.96 +  	 \<^rule_thm>\<open>subtrahiere_x_minus1_plus\<close>, (*"[| l is_const |] ==> (x - v) + l * v = x + (-1 + l) * v"*)
   14.97 +  	 \<^rule_thm>\<open>subtrahiere_x_minus_plus1\<close>, (*"[| m is_const |] ==> (x - m * v) + v = x + (-m + 1) * v"*)
   14.98  
   14.99 -	 \<^rule_thm>\<open>subtrahiere_x_minus_plus\<close>, 
  14.100 -	 (*"[| l is_const; m..|] ==> (k - m * n) + l * n = k + (-m + l) * n"*)
  14.101 -	 \<^rule_thm>\<open>subtrahiere_x_minus1_plus\<close>,
  14.102 -	 (*"[| l is_const |] ==> (x - v) + l * v = x + (-1 + l) * v"*)
  14.103 -	 \<^rule_thm>\<open>subtrahiere_x_minus_plus1\<close>,
  14.104 -	 (*"[| m is_const |] ==> (x - m * v) + v = x + (-m + 1) * v"*)
  14.105 +  	 \<^rule_thm>\<open>subtrahiere_x_minus_minus\<close>, (*"[| l is_const; m..|] ==> (k - m * n) - l * n = k + (-m - l) * n"*)
  14.106 +  	 \<^rule_thm>\<open>subtrahiere_x_minus1_minus\<close>, (*"[| l is_const |] ==> (x - v) - l * v = x + (-1 - l) * v"*)
  14.107 +  	 \<^rule_thm>\<open>subtrahiere_x_minus_minus1\<close>, (*"[| m is_const |] ==> (x - m * v) - v = x + (-m - 1) * v"*)
  14.108  
  14.109 -	 \<^rule_thm>\<open>subtrahiere_x_minus_minus\<close>, 
  14.110 -	 (*"[| l is_const; m..|] ==> (k - m * n) - l * n = k + (-m - l) * n"*)
  14.111 -	 \<^rule_thm>\<open>subtrahiere_x_minus1_minus\<close>,
  14.112 -	 (*"[| l is_const |] ==> (x - v) - l * v = x + (-1 - l) * v"*)
  14.113 -	 \<^rule_thm>\<open>subtrahiere_x_minus_minus1\<close>,
  14.114 -	 (*"[| m is_const |] ==> (x - m * v) - v = x + (-m - 1) * v"*)
  14.115 -	 
  14.116 -	 \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
  14.117 -	 \<^rule_eval>\<open>minus\<close> (**)(eval_binop "#subtr_"),
  14.118 -	 
  14.119 -	 (*MG: Reihenfolge der folgenden 2 Rule.Thm muss so bleiben, wegen
  14.120 -           (a+a)+a --> a + 2*a --> 3*a and not (a+a)+a --> 2*a + a *)
  14.121 -	 \<^rule_thm>\<open>real_mult_2_assoc_r\<close>,
  14.122 -	 (*"(k + z1) + z1 = k + 2 * z1"*)
  14.123 -	 \<^rule_thm_sym>\<open>real_mult_2\<close>,
  14.124 -	 (*"z1 + z1 = 2 * z1"*)
  14.125 +  	 \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
  14.126 +  	 \<^rule_eval>\<open>minus\<close> (**)(eval_binop "#subtr_"),
  14.127  
  14.128 -	 \<^rule_thm>\<open>addiere_vor_minus\<close>,
  14.129 -	 (*"[| l is_const; m is_const |] ==> -(l * v) +  m * v = (-l + m) *v"*)
  14.130 -	 \<^rule_thm>\<open>addiere_eins_vor_minus\<close>,
  14.131 -	 (*"[| m is_const |] ==> -  v +  m * v = (-1 + m) * v"*)
  14.132 -	 \<^rule_thm>\<open>subtrahiere_vor_minus\<close>,
  14.133 -	 (*"[| l is_const; m is_const |] ==> -(l * v) -  m * v = (-l - m) *v"*)
  14.134 -	 \<^rule_thm>\<open>subtrahiere_eins_vor_minus\<close>
  14.135 -	 (*"[| m is_const |] ==> -  v -  m * v = (-1 - m) * v"*)
  14.136 -	 
  14.137 -	 ], scr = Rule.Empty_Prog};
  14.138 +  	 (*MG: Reihenfolge der folgenden 2 Rule.Thm muss so bleiben, wegen
  14.139 +        (a+a)+a --> a + 2*a --> 3*a and not (a+a)+a --> 2*a + a *)
  14.140 +  	 \<^rule_thm>\<open>real_mult_2_assoc_r\<close>, (*"(k + z1) + z1 = k + 2 * z1"*)
  14.141 +  	 \<^rule_thm_sym>\<open>real_mult_2\<close>, (*"z1 + z1 = 2 * z1"*)
  14.142 +
  14.143 +  	 \<^rule_thm>\<open>addiere_vor_minus\<close>, (*"[| l is_const; m is_const |] ==> -(l * v) +  m * v = (-l + m) *v"*)
  14.144 +  	 \<^rule_thm>\<open>addiere_eins_vor_minus\<close>, (*"[| m is_const |] ==> -  v +  m * v = (-1 + m) * v"*)
  14.145 +  	 \<^rule_thm>\<open>subtrahiere_vor_minus\<close>, (*"[| l is_const; m is_const |] ==> -(l * v) -  m * v = (-l - m) *v"*)
  14.146 +  	 \<^rule_thm>\<open>subtrahiere_eins_vor_minus\<close>], (*"[| m is_const |] ==> -  v -  m * v = (-1 - m) * v"*)	 
  14.147 +	  scr = Rule.Empty_Prog};
  14.148      
  14.149  val verschoenere = 
  14.150    Rule_Def.Repeat{id = "verschoenere", preconds = [], 
  14.151 -      rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), srls = Rule_Set.Empty, calc = [], errpatts = [],
  14.152 -      erls = Rule_Set.append_rules "erls_verschoenere" Rule_Set.empty 
  14.153 -			[\<^rule_eval>\<open>PolyMinus.kleiner\<close> (eval_kleiner "")],
  14.154 -      rules = [\<^rule_thm>\<open>vorzeichen_minus_weg1\<close>,
  14.155 -	       (*"l kleiner 0 ==> a + l * b = a - -l * b"*)
  14.156 -	       \<^rule_thm>\<open>vorzeichen_minus_weg2\<close>,
  14.157 -	       (*"l kleiner 0 ==> a - l * b = a + -l * b"*)
  14.158 -	       \<^rule_thm>\<open>vorzeichen_minus_weg3\<close>,
  14.159 -	       (*"l kleiner 0 ==> k + a - l * b = k + a + -l * b"*)
  14.160 -	       \<^rule_thm>\<open>vorzeichen_minus_weg4\<close>,
  14.161 -	       (*"l kleiner 0 ==> k - a - l * b = k - a + -l * b"*)
  14.162 +    rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), srls = Rule_Set.Empty, calc = [], errpatts = [],
  14.163 +    erls = Rule_Set.append_rules "erls_verschoenere" Rule_Set.empty 
  14.164 +		  [\<^rule_eval>\<open>PolyMinus.kleiner\<close> (eval_kleiner "")],
  14.165 +    rules = [
  14.166 +      \<^rule_thm>\<open>vorzeichen_minus_weg1\<close>, (*"l kleiner 0 ==> a + l * b = a - -l * b"*)
  14.167 +      \<^rule_thm>\<open>vorzeichen_minus_weg2\<close>, (*"l kleiner 0 ==> a - l * b = a + -l * b"*)
  14.168 +      \<^rule_thm>\<open>vorzeichen_minus_weg3\<close>, (*"l kleiner 0 ==> k + a - l * b = k + a + -l * b"*)
  14.169 +      \<^rule_thm>\<open>vorzeichen_minus_weg4\<close>, (*"l kleiner 0 ==> k - a - l * b = k - a + -l * b"*)
  14.170  
  14.171 -	       \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
  14.172 +      \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
  14.173  
  14.174 -	       \<^rule_thm>\<open>mult_zero_left\<close>,    
  14.175 -	       (*"0 * z = 0"*)
  14.176 -	       \<^rule_thm>\<open>mult_1_left\<close>,     
  14.177 -	       (*"1 * z = z"*)
  14.178 -	       \<^rule_thm>\<open>add_0_left\<close>,
  14.179 -	       (*"0 + z = z"*)
  14.180 -	       \<^rule_thm>\<open>null_minus\<close>,
  14.181 -	       (*"0 - a = -a"*)
  14.182 -	       \<^rule_thm>\<open>vor_minus_mal\<close>
  14.183 -	       (*"- a * b = (-a) * b"*)
  14.184 -	       ], scr = Rule.Empty_Prog} (*end verschoenere*);
  14.185 +      \<^rule_thm>\<open>mult_zero_left\<close>, (*"0 * z = 0"*)
  14.186 +      \<^rule_thm>\<open>mult_1_left\<close>, (*"1 * z = z"*)
  14.187 +      \<^rule_thm>\<open>add_0_left\<close>, (*"0 + z = z"*)
  14.188 +      \<^rule_thm>\<open>null_minus\<close>, (*"0 - a = -a"*)
  14.189 +      \<^rule_thm>\<open>vor_minus_mal\<close>], (*"- a * b = (-a) * b"*)
  14.190 +	  scr = Rule.Empty_Prog};
  14.191  
  14.192  val klammern_aufloesen = 
  14.193    Rule_Def.Repeat{id = "klammern_aufloesen", preconds = [], 
  14.194 -      rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), srls = Rule_Set.Empty, calc = [], errpatts = [], erls = Rule_Set.Empty, 
  14.195 -      rules = [\<^rule_thm_sym>\<open>add.assoc\<close>,
  14.196 -	       (*"a + (b + c) = (a + b) + c"*)
  14.197 -	       \<^rule_thm>\<open>klammer_plus_minus\<close>,
  14.198 -	       (*"a + (b - c) = (a + b) - c"*)
  14.199 -	       \<^rule_thm>\<open>klammer_minus_plus\<close>,
  14.200 -	       (*"a - (b + c) = (a - b) - c"*)
  14.201 -	       \<^rule_thm>\<open>klammer_minus_minus\<close>
  14.202 -	       (*"a - (b - c) = (a - b) + c"*)
  14.203 -	       ], scr = Rule.Empty_Prog};
  14.204 +    rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), srls = Rule_Set.Empty, 
  14.205 +    calc = [], errpatts = [], erls = Rule_Set.Empty, 
  14.206 +    rules = [
  14.207 +      \<^rule_thm_sym>\<open>add.assoc\<close>, (*"a + (b + c) = (a + b) + c"*)
  14.208 +      \<^rule_thm>\<open>klammer_plus_minus\<close>, (*"a + (b - c) = (a + b) - c"*)
  14.209 +      \<^rule_thm>\<open>klammer_minus_plus\<close>, (*"a - (b + c) = (a - b) - c"*)
  14.210 +      \<^rule_thm>\<open>klammer_minus_minus\<close>], (*"a - (b - c) = (a - b) + c"*)
  14.211 +	  scr = Rule.Empty_Prog};
  14.212  
  14.213  val klammern_ausmultiplizieren = 
  14.214    Rule_Def.Repeat{id = "klammern_ausmultiplizieren", preconds = [], 
  14.215 -      rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), srls = Rule_Set.Empty, calc = [], errpatts = [], erls = Rule_Set.Empty, 
  14.216 -      rules = [\<^rule_thm>\<open>distrib_right\<close>,
  14.217 -	       (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  14.218 -	       \<^rule_thm>\<open>distrib_left\<close>,
  14.219 -	       (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  14.220 -	       
  14.221 -	       \<^rule_thm>\<open>klammer_mult_minus\<close>,
  14.222 -	       (*"a * (b - c) = a * b - a * c"*)
  14.223 -	       \<^rule_thm>\<open>klammer_minus_mult\<close>
  14.224 -	       (*"(b - c) * a = b * a - c * a"*)
  14.225 -	       ], scr = Rule.Empty_Prog};
  14.226 +    rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), srls = Rule_Set.Empty, 
  14.227 +    calc = [], errpatts = [], erls = Rule_Set.Empty, 
  14.228 +    rules = [
  14.229 +      \<^rule_thm>\<open>distrib_right\<close>, (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  14.230 +      \<^rule_thm>\<open>distrib_left\<close>, (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  14.231 +
  14.232 +      \<^rule_thm>\<open>klammer_mult_minus\<close>, (*"a * (b - c) = a * b - a * c"*)
  14.233 +      \<^rule_thm>\<open>klammer_minus_mult\<close>], (*"(b - c) * a = b * a - c * a"*)
  14.234 +	  scr = Rule.Empty_Prog};
  14.235  
  14.236  val ordne_monome = 
  14.237 -  Rule_Def.Repeat{id = "ordne_monome", preconds = [], 
  14.238 -      rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), srls = Rule_Set.Empty, calc = [], errpatts = [], 
  14.239 -      erls = Rule_Set.append_rules "erls_ordne_monome" Rule_Set.empty
  14.240 -	       [\<^rule_eval>\<open>PolyMinus.kleiner\<close> (eval_kleiner ""),
  14.241 -		      \<^rule_eval>\<open>Prog_Expr.is_atom\<close> (Prog_Expr.eval_is_atom "")
  14.242 -		], 
  14.243 -      rules = [\<^rule_thm>\<open>tausche_mal\<close>,
  14.244 -	       (*"[| b is_atom; a kleiner b  |] ==> (b * a) = (a * b)"*)
  14.245 -	       \<^rule_thm>\<open>tausche_vor_mal\<close>,
  14.246 -	       (*"[| b is_atom; a kleiner b  |] ==> (-b * a) = (-a * b)"*)
  14.247 -	       \<^rule_thm>\<open>tausche_mal_mal\<close>,
  14.248 -	       (*"[| c is_atom; b kleiner c  |] ==> (a * c * b) = (a * b *c)"*)
  14.249 -	       \<^rule_thm>\<open>x_quadrat\<close>
  14.250 -	       (*"(x * a) * a = x * a \<up> 2"*)
  14.251 -	       ], scr = Rule.Empty_Prog};
  14.252 -
  14.253 +  Rule_Def.Repeat {
  14.254 +    id = "ordne_monome", preconds = [], rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), 
  14.255 +    srls = Rule_Set.Empty, calc = [], errpatts = [], 
  14.256 +    erls = Rule_Set.append_rules "erls_ordne_monome" Rule_Set.empty [
  14.257 +      \<^rule_eval>\<open>PolyMinus.kleiner\<close> (eval_kleiner ""),
  14.258 +		  \<^rule_eval>\<open>Prog_Expr.is_atom\<close> (Prog_Expr.eval_is_atom "")], 
  14.259 +    rules = [
  14.260 +      \<^rule_thm>\<open>tausche_mal\<close>, (*"[| b is_atom; a kleiner b  |] ==> (b * a) = (a * b)"*)
  14.261 +      \<^rule_thm>\<open>tausche_vor_mal\<close>, (*"[| b is_atom; a kleiner b  |] ==> (-b * a) = (-a * b)"*)
  14.262 +      \<^rule_thm>\<open>tausche_mal_mal\<close>, (*"[| c is_atom; b kleiner c  |] ==> (a * c * b) = (a * b *c)"*)
  14.263 +      \<^rule_thm>\<open>x_quadrat\<close>], (*"(x * a) * a = x * a \<up> 2"*)
  14.264 +	  scr = Rule.Empty_Prog};
  14.265  
  14.266  val rls_p_33 = 
  14.267 -    Rule_Set.append_rules "rls_p_33" Rule_Set.empty
  14.268 -	       [Rule.Rls_ ordne_alphabetisch,
  14.269 +  Rule_Set.append_rules "rls_p_33" Rule_Set.empty [
  14.270 +    Rule.Rls_ ordne_alphabetisch,
  14.271  		Rule.Rls_ fasse_zusammen,
  14.272 -		Rule.Rls_ verschoenere
  14.273 -		];
  14.274 +		Rule.Rls_ verschoenere];
  14.275  val rls_p_34 = 
  14.276 -    Rule_Set.append_rules "rls_p_34" Rule_Set.empty
  14.277 -	       [Rule.Rls_ klammern_aufloesen,
  14.278 -		Rule.Rls_ ordne_alphabetisch,
  14.279 -		Rule.Rls_ fasse_zusammen,
  14.280 -		Rule.Rls_ verschoenere
  14.281 -		];
  14.282 +  Rule_Set.append_rules "rls_p_34" Rule_Set.empty [
  14.283 +    Rule.Rls_ klammern_aufloesen,
  14.284 +  	Rule.Rls_ ordne_alphabetisch,
  14.285 +  	Rule.Rls_ fasse_zusammen,
  14.286 +  	Rule.Rls_ verschoenere];
  14.287  val rechnen = 
  14.288 -    Rule_Set.append_rules "rechnen" Rule_Set.empty
  14.289 -	       [\<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
  14.290 -          \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
  14.291 -          \<^rule_eval>\<open>minus\<close> (**)(eval_binop "#subtr_")
  14.292 -		];
  14.293 +  Rule_Set.append_rules "rechnen" Rule_Set.empty [
  14.294 +    \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
  14.295 +    \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
  14.296 +    \<^rule_eval>\<open>minus\<close> (**)(eval_binop "#subtr_")];
  14.297  \<close>
  14.298  rule_set_knowledge
  14.299    ordne_alphabetisch = \<open>prep_rls' ordne_alphabetisch\<close> and
  14.300 @@ -386,17 +335,13 @@
  14.301  problem pbl_vereinf_poly : "polynom/vereinfachen" = \<open>Rule_Set.Empty\<close>
  14.302  
  14.303  problem pbl_vereinf_poly_minus : "plus_minus/polynom/vereinfachen" =
  14.304 -  \<open>Rule_Set.append_rules "prls_pbl_vereinf_poly" Rule_Set.empty 
  14.305 -    [\<^rule_eval>\<open>is_polyexp\<close> (eval_is_polyexp ""),
  14.306 +  \<open>Rule_Set.append_rules "prls_pbl_vereinf_poly" Rule_Set.empty [
  14.307 +     \<^rule_eval>\<open>is_polyexp\<close> (eval_is_polyexp ""),
  14.308       \<^rule_eval>\<open>Prog_Expr.matchsub\<close> (Prog_Expr.eval_matchsub ""),
  14.309 -      \<^rule_thm>\<open>or_true\<close>,
  14.310 -      (*"(?a | True) = True"*)
  14.311 -      \<^rule_thm>\<open>or_false\<close>,
  14.312 -      (*"(?a | False) = ?a"*)
  14.313 -      \<^rule_thm>\<open>not_true\<close>,
  14.314 -      (*"(~ True) = False"*)
  14.315 -      \<^rule_thm>\<open>not_false\<close>
  14.316 -      (*"(~ False) = True"*)]\<close>
  14.317 +     \<^rule_thm>\<open>or_true\<close>, (*"(?a | True) = True"*)
  14.318 +     \<^rule_thm>\<open>or_false\<close>, (*"(?a | False) = ?a"*)
  14.319 +     \<^rule_thm>\<open>not_true\<close>, (*"(~ True) = False"*)
  14.320 +     \<^rule_thm>\<open>not_false\<close> (*"(~ False) = True"*)]\<close>
  14.321    Method: "simplification/for_polynomials/with_minus"
  14.322    CAS: "Vereinfache t_t"
  14.323    Given: "Term t_t"
  14.324 @@ -413,17 +358,13 @@
  14.325    Find: "normalform n_n"
  14.326  
  14.327  problem pbl_vereinf_poly_klammer : "klammer/polynom/vereinfachen" =
  14.328 -  \<open>Rule_Set.append_rules "prls_pbl_vereinf_poly_klammer" Rule_Set.empty
  14.329 -    [\<^rule_eval>\<open>is_polyexp\<close> (eval_is_polyexp ""),
  14.330 +  \<open>Rule_Set.append_rules "prls_pbl_vereinf_poly_klammer" Rule_Set.empty [
  14.331 +     \<^rule_eval>\<open>is_polyexp\<close> (eval_is_polyexp ""),
  14.332       \<^rule_eval>\<open>Prog_Expr.matchsub\<close> (Prog_Expr.eval_matchsub ""),
  14.333 -     \<^rule_thm>\<open>or_true\<close>,
  14.334 -     (*"(?a | True) = True"*)
  14.335 -     \<^rule_thm>\<open>or_false\<close>,
  14.336 -     (*"(?a | False) = ?a"*)
  14.337 -     \<^rule_thm>\<open>not_true\<close>,
  14.338 -     (*"(~ True) = False"*)
  14.339 -     \<^rule_thm>\<open>not_false\<close>
  14.340 -     (*"(~ False) = True"*)]\<close>
  14.341 +     \<^rule_thm>\<open>or_true\<close>, (*"(?a | True) = True"*)
  14.342 +     \<^rule_thm>\<open>or_false\<close>, (*"(?a | False) = ?a"*)
  14.343 +     \<^rule_thm>\<open>not_true\<close>, (*"(~ True) = False"*)
  14.344 +     \<^rule_thm>\<open>not_false\<close> (*"(~ False) = True"*)]\<close>
  14.345    Method: "simplification/for_polynomials/with_parentheses"
  14.346    CAS: "Vereinfache t_t"
  14.347    Given: "Term t_t"
  14.348 @@ -477,18 +418,13 @@
  14.349  
  14.350  method met_simp_poly_minus : "simplification/for_polynomials/with_minus" =
  14.351    \<open>{rew_ord'="tless_true", rls' = Rule_Set.empty, calc = [], srls = Rule_Set.empty,
  14.352 -    prls =
  14.353 -      Rule_Set.append_rules "prls_met_simp_poly_minus" Rule_Set.empty 
  14.354 -        [\<^rule_eval>\<open>is_polyexp\<close> (eval_is_polyexp ""),
  14.355 -          \<^rule_eval>\<open>Prog_Expr.matchsub\<close> (Prog_Expr.eval_matchsub ""),
  14.356 -          \<^rule_thm>\<open>and_true\<close>,
  14.357 -          (*"(?a & True) = ?a"*)
  14.358 -          \<^rule_thm>\<open>and_false\<close>,
  14.359 -          (*"(?a & False) = False"*)
  14.360 -          \<^rule_thm>\<open>not_true\<close>,
  14.361 -          (*"(~ True) = False"*)
  14.362 -          \<^rule_thm>\<open>not_false\<close>
  14.363 -          (*"(~ False) = True"*)],
  14.364 +    prls = Rule_Set.append_rules "prls_met_simp_poly_minus" Rule_Set.empty [
  14.365 +      \<^rule_eval>\<open>is_polyexp\<close> (eval_is_polyexp ""),
  14.366 +      \<^rule_eval>\<open>Prog_Expr.matchsub\<close> (Prog_Expr.eval_matchsub ""),
  14.367 +      \<^rule_thm>\<open>and_true\<close>, (*"(?a & True) = ?a"*)
  14.368 +      \<^rule_thm>\<open>and_false\<close>, (*"(?a & False) = False"*)
  14.369 +      \<^rule_thm>\<open>not_true\<close>, (*"(~ True) = False"*)
  14.370 +      \<^rule_thm>\<open>not_false\<close> (*"(~ False) = True"*)],
  14.371      crls = Rule_Set.empty, errpats = [], nrls = rls_p_33}\<close>
  14.372    Program: simplify.simps
  14.373    Given: "Term t_t"
    15.1 --- a/src/Tools/isac/Knowledge/RatEq.thy	Mon Aug 09 14:20:20 2021 +0200
    15.2 +++ b/src/Tools/isac/Knowledge/RatEq.thy	Tue Aug 10 09:43:07 2021 +0200
    15.3 @@ -78,79 +78,66 @@
    15.4  subsection \<open>rule-sets\<close>
    15.5  ML \<open>
    15.6  val RatEq_prls = (*15.10.02:just the following order due to subterm evaluation*)
    15.7 -  Rule_Set.append_rules "RatEq_prls" Rule_Set.empty 
    15.8 -	     [\<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
    15.9 -	      \<^rule_eval>\<open>Prog_Expr.matches\<close> (Prog_Expr.eval_matches ""),
   15.10 -	      \<^rule_eval>\<open>Prog_Expr.lhs\<close> (Prog_Expr.eval_lhs ""),
   15.11 -	      \<^rule_eval>\<open>Prog_Expr.rhs\<close> (Prog_Expr.eval_rhs ""),
   15.12 -	      \<^rule_eval>\<open>is_ratequation_in\<close> (eval_is_ratequation_in ""),
   15.13 -	      \<^rule_eval>\<open>HOL.eq\<close> (Prog_Expr.eval_equal "#equal_"),
   15.14 -	      \<^rule_thm>\<open>not_true\<close>,
   15.15 -	      \<^rule_thm>\<open>not_false\<close>,
   15.16 -	      \<^rule_thm>\<open>and_true\<close>,
   15.17 -	      \<^rule_thm>\<open>and_false\<close>,
   15.18 -	      \<^rule_thm>\<open>or_true\<close>,
   15.19 -	      \<^rule_thm>\<open>or_false\<close>
   15.20 -	      ];
   15.21 +  Rule_Set.append_rules "RatEq_prls" Rule_Set.empty [
   15.22 +    \<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
   15.23 +    \<^rule_eval>\<open>Prog_Expr.matches\<close> (Prog_Expr.eval_matches ""),
   15.24 +    \<^rule_eval>\<open>Prog_Expr.lhs\<close> (Prog_Expr.eval_lhs ""),
   15.25 +    \<^rule_eval>\<open>Prog_Expr.rhs\<close> (Prog_Expr.eval_rhs ""),
   15.26 +    \<^rule_eval>\<open>is_ratequation_in\<close> (eval_is_ratequation_in ""),
   15.27 +    \<^rule_eval>\<open>HOL.eq\<close> (Prog_Expr.eval_equal "#equal_"),
   15.28 +    \<^rule_thm>\<open>not_true\<close>,
   15.29 +    \<^rule_thm>\<open>not_false\<close>,
   15.30 +    \<^rule_thm>\<open>and_true\<close>,
   15.31 +    \<^rule_thm>\<open>and_false\<close>,
   15.32 +    \<^rule_thm>\<open>or_true\<close>,
   15.33 +    \<^rule_thm>\<open>or_false\<close>];
   15.34  
   15.35  \<close> ML \<open>
   15.36  (*rls = Rule_Set.merge erls Poly_erls *)
   15.37  val rateq_erls = 
   15.38    Rule_Set.keep_unique_rules "rateq_erls"                             (*WN: ein Hack*)
   15.39  	  (Rule_Set.merge "is_ratequation_in" calculate_Rational
   15.40 -		  (Rule_Set.append_rules "is_ratequation_in"
   15.41 -			  Poly_erls [(*\<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e"),*)
   15.42 -			    \<^rule_eval>\<open>is_ratequation_in\<close> (eval_is_ratequation_in "")]))
   15.43 - [\<^rule_thm>\<open>and_commute\<close>, (*WN: ein Hack*)
   15.44 -	\<^rule_thm>\<open>or_commute\<close>];  (*WN: ein Hack*)
   15.45 +		  (Rule_Set.append_rules "is_ratequation_in" Poly_erls [
   15.46 +         (*\<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e"),*)
   15.47 +			    \<^rule_eval>\<open>is_ratequation_in\<close> (eval_is_ratequation_in "")])) [
   15.48 +      \<^rule_thm>\<open>and_commute\<close>, (*WN: ein Hack*)
   15.49 +    	\<^rule_thm>\<open>or_commute\<close>];  (*WN: ein Hack*)
   15.50  
   15.51  \<close> ML \<open>
   15.52  val RatEq_crls = 
   15.53    Rule_Set.keep_unique_rules "RatEq_crls"                              (*WN: ein Hack*)
   15.54  	  (Rule_Set.merge "is_ratequation_in" calculate_Rational
   15.55 -		  (Rule_Set.append_rules "is_ratequation_in"
   15.56 -			  Poly_erls [(*\<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e"),*)
   15.57 -			    \<^rule_eval>\<open>is_ratequation_in\<close> (eval_is_ratequation_in "")]))
   15.58 - [\<^rule_thm>\<open>and_commute\<close>, (*WN: ein Hack*)
   15.59 -	\<^rule_thm>\<open>or_commute\<close>];  (*WN: ein Hack*)
   15.60 +		  (Rule_Set.append_rules "is_ratequation_in" Poly_erls [
   15.61 +         (*\<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e"),*)
   15.62 +		    \<^rule_eval>\<open>is_ratequation_in\<close> (eval_is_ratequation_in "")])) [
   15.63 +      \<^rule_thm>\<open>and_commute\<close>, (*WN: ein Hack*)
   15.64 +    	\<^rule_thm>\<open>or_commute\<close>];  (*WN: ein Hack*)
   15.65  
   15.66  val RatEq_eliminate = prep_rls'(
   15.67 -  Rule_Def.Repeat
   15.68 -    {id = "RatEq_eliminate", preconds = [], rew_ord = ("termlessI", termlessI), erls = rateq_erls,
   15.69 -     srls = Rule_Set.Empty, calc = [], errpatts = [],
   15.70 -     rules = [
   15.71 -	     \<^rule_thm>\<open>rat_mult_denominator_both\<close>, 
   15.72 -	     (* a/b=c/d -> ad=cb *)
   15.73 -	     \<^rule_thm>\<open>rat_mult_denominator_left\<close>, 
   15.74 -	     (* a  =c/d -> ad=c  *)
   15.75 -	     \<^rule_thm>\<open>rat_mult_denominator_right\<close>
   15.76 -	     (* a/b=c   ->  a=cb *)
   15.77 -	     ],
   15.78 -    scr = Rule.Empty_Prog});
   15.79 +  Rule_Def.Repeat {
   15.80 +    id = "RatEq_eliminate", preconds = [], rew_ord = ("termlessI", termlessI), erls = rateq_erls,
   15.81 +    srls = Rule_Set.Empty, calc = [], errpatts = [],
   15.82 +    rules = [
   15.83 +     \<^rule_thm>\<open>rat_mult_denominator_both\<close>, (* a/b=c/d -> ad=cb *)
   15.84 +     \<^rule_thm>\<open>rat_mult_denominator_left\<close>, (* a  =c/d -> ad=c  *)
   15.85 +     \<^rule_thm>\<open>rat_mult_denominator_right\<close>],  (* a/b=c   ->  a=cb *)
   15.86 +   scr = Rule.Empty_Prog});
   15.87  
   15.88  \<close> ML \<open>
   15.89  val RatEq_simplify = prep_rls'(
   15.90 -  Rule_Def.Repeat
   15.91 -    {id = "RatEq_simplify", preconds = [], rew_ord = ("termlessI", termlessI), erls = rateq_erls,
   15.92 -     srls = Rule_Set.Empty, calc = [], errpatts = [],
   15.93 -     rules = [
   15.94 -	     \<^rule_thm>\<open>real_rat_mult_1\<close>,
   15.95 -	     (*a*(b/c) = (a*b)/c*)
   15.96 -	     \<^rule_thm>\<open>real_rat_mult_2\<close>,
   15.97 -	     (*(a/b)*(c/d) = (a*c)/(b*d)*)
   15.98 -       \<^rule_thm>\<open>real_rat_mult_3\<close>,
   15.99 -       (* (a/b)*c = (a*c)/b*)
  15.100 -	     \<^rule_thm>\<open>real_rat_pow\<close>,
  15.101 -	     (*(a/b) \<up> 2 = a \<up> 2/b \<up> 2*)
  15.102 -	     \<^rule_thm>\<open>real_diff_minus\<close>,
  15.103 -	     (* a - b = a + (-1) * b *)
  15.104 -       \<^rule_thm>\<open>rat_double_rat_1\<close>,
  15.105 -       (* (a / (c/d) = (a*d) / c) *)
  15.106 -       \<^rule_thm>\<open>rat_double_rat_2\<close>, 
  15.107 -       (* ((a/b) / (c/d) = (a*d) / (b*c)) *)
  15.108 -       \<^rule_thm>\<open>rat_double_rat_3\<close> 
  15.109 -       (* ((a/b) / c = a / (b*c) ) *)],
  15.110 -     scr = Rule.Empty_Prog});
  15.111 +  Rule_Def.Repeat {
  15.112 +    id = "RatEq_simplify", preconds = [], rew_ord = ("termlessI", termlessI), erls = rateq_erls,
  15.113 +    srls = Rule_Set.Empty, calc = [], errpatts = [],
  15.114 +    rules = [
  15.115 +      \<^rule_thm>\<open>real_rat_mult_1\<close>, (*a*(b/c) = (a*b)/c*)
  15.116 +      \<^rule_thm>\<open>real_rat_mult_2\<close>, (*(a/b)*(c/d) = (a*c)/(b*d)*)
  15.117 +      \<^rule_thm>\<open>real_rat_mult_3\<close>, (* (a/b)*c = (a*c)/b*)
  15.118 +      \<^rule_thm>\<open>real_rat_pow\<close>, (*(a/b) \<up> 2 = a \<up> 2/b \<up> 2*)
  15.119 +      \<^rule_thm>\<open>real_diff_minus\<close>, (* a - b = a + (-1) * b *)
  15.120 +      \<^rule_thm>\<open>rat_double_rat_1\<close>, (* (a / (c/d) = (a*d) / c) *)
  15.121 +      \<^rule_thm>\<open>rat_double_rat_2\<close>, (* ((a/b) / (c/d) = (a*d) / (b*c)) *)
  15.122 +      \<^rule_thm>\<open>rat_double_rat_3\<close> (* ((a/b) / c = a / (b*c) ) *)],
  15.123 +    scr = Rule.Empty_Prog});
  15.124  \<close>
  15.125  rule_set_knowledge rateq_erls = rateq_erls
  15.126  rule_set_knowledge RatEq_eliminate = RatEq_eliminate
    16.1 --- a/src/Tools/isac/Knowledge/Rational.thy	Mon Aug 09 14:20:20 2021 +0200
    16.2 +++ b/src/Tools/isac/Knowledge/Rational.thy	Tue Aug 10 09:43:07 2021 +0200
    16.3 @@ -11,7 +11,7 @@
    16.4  imports Poly GCD_Poly_ML
    16.5  begin
    16.6  
    16.7 -section \<open>Constants for evaluation by "Rule.Eval"\<close>
    16.8 +section \<open>Constants for evaluation by \ <^rule_eval>\<close>
    16.9  consts
   16.10  
   16.11    is_expanded    :: "real => bool" ("_ is'_expanded")     (*RL->Poly.thy*)
   16.12 @@ -411,12 +411,12 @@
   16.13    prep_rls'
   16.14      (Rule_Def.Repeat {id = "calc_rat_erls", preconds = [], rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), 
   16.15        erls = Rule_Set.empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
   16.16 -      rules = 
   16.17 -       [Rule.Eval ("Prog_Expr.matches", Prog_Expr.eval_matches "#matches_"),
   16.18 -        Rule.Eval ("HOL.eq", Prog_Expr.eval_equal "#equal_"),
   16.19 -        Rule.Eval ("Prog_Expr.is_const", Prog_Expr.eval_const "#is_const_"),
   16.20 -        Rule.Thm ("not_true",  @{thm not_true}),
   16.21 -        Rule.Thm ("not_false",  @{thm not_false})], 
   16.22 +      rules = [
   16.23 +        \<^rule_eval>\<open>matches\<close> (Prog_Expr.eval_matches "#matches_"),
   16.24 +        \<^rule_eval>\<open>HOL.eq\<close> (Prog_Expr.eval_equal "#equal_"),
   16.25 +        \<^rule_eval>\<open>is_const\<close> (Prog_Expr.eval_const "#is_const_"),
   16.26 +        \<^rule_thm>\<open>not_true\<close>,
   16.27 +        \<^rule_thm>\<open>not_false\<close>], 
   16.28        scr = Rule.Empty_Prog});
   16.29  
   16.30  (* simplifies expressions with numerals;
   16.31 @@ -427,43 +427,28 @@
   16.32      (Rule_Def.Repeat {id = "divide", preconds = [], rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), 
   16.33        erls = calc_rat_erls, srls = Rule_Set.Empty,
   16.34        calc = [], errpatts = [],
   16.35 -      rules = 
   16.36 -        [\<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e"),
   16.37 +      rules = [
   16.38 +        \<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e"),
   16.39  
   16.40 -        Rule.Thm ("minus_divide_left",  (@{thm minus_divide_left} RS @{thm sym})),
   16.41 -          (*SYM - ?x / ?y = - (?x / ?y)  may come from subst*)
   16.42 +        \<^rule_thm_sym>\<open>minus_divide_left\<close>, (*SYM - ?x / ?y = - (?x / ?y)  may come from subst*)
   16.43          \<^rule_thm>\<open>rat_add\<close>,
   16.44 -          (*"[| a is_const; b is_const; c is_const; d is_const |] ==> \
   16.45 -          \a / c + b / d = (a * d) / (c * d) + (b * c ) / (d * c)"*)
   16.46 -        \<^rule_thm>\<open>rat_add1\<close>,
   16.47 -          (*"[| a is_const; b is_const; c is_const |] ==> a / c + b / c = (a + b) / c"*)
   16.48 -        \<^rule_thm>\<open>rat_add2\<close>,
   16.49 -          (*"[| ?a is_const; ?b is_const; ?c is_const |] ==> ?a / ?c + ?b = (?a + ?b * ?c) / ?c"*)
   16.50 -        \<^rule_thm>\<open>rat_add3\<close>,
   16.51 -          (*"[| a is_const; b is_const; c is_const |] ==> a + b / c = (a * c) / c + b / c"\
   16.52 -          .... is_const to be omitted here FIXME*)
   16.53 +          (*"[| a is_const; b is_const; c is_const; d is_const |] ==> a / c + b / d = (a * d) / (c * d) + (b * c ) / (d * c)"*)
   16.54 +        \<^rule_thm>\<open>rat_add1\<close>, (*"[| a is_const; b is_const; c is_const |] ==> a / c + b / c = (a + b) / c"*)
   16.55 +        \<^rule_thm>\<open>rat_add2\<close>, (*"[| ?a is_const; ?b is_const; ?c is_const |] ==> ?a / ?c + ?b = (?a + ?b * ?c) / ?c"*)
   16.56 +        \<^rule_thm>\<open>rat_add3\<close>, (*"[| a is_const; b is_const; c is_const |] ==> a + b / c = (a * c) / c + b / c" *)
   16.57          
   16.58 -        \<^rule_thm>\<open>rat_mult\<close>, 
   16.59 -          (*a / b * (c / d) = a * c / (b * d)*)
   16.60 -        \<^rule_thm>\<open>times_divide_eq_right\<close>,
   16.61 -          (*?x * (?y / ?z) = ?x * ?y / ?z*)
   16.62 -        \<^rule_thm>\<open>times_divide_eq_left\<close>,
   16.63 -          (*?y / ?z * ?x = ?y * ?x / ?z*)
   16.64 +        \<^rule_thm>\<open>rat_mult\<close>, (*a / b * (c / d) = a * c / (b * d)*)
   16.65 +        \<^rule_thm>\<open>times_divide_eq_right\<close>, (*?x * (?y / ?z) = ?x * ?y / ?z*)
   16.66 +        \<^rule_thm>\<open>times_divide_eq_left\<close>, (*?y / ?z * ?x = ?y * ?x / ?z*)
   16.67          
   16.68 -        \<^rule_thm>\<open>real_divide_divide1\<close>,
   16.69 -          (*"?y ~= 0 ==> ?u / ?v / (?y / ?z) = ?u / ?v * (?z / ?y)"*)
   16.70 -        \<^rule_thm>\<open>divide_divide_eq_left\<close>,
   16.71 -          (*"?x / ?y / ?z = ?x / (?y * ?z)"*)
   16.72 +        \<^rule_thm>\<open>real_divide_divide1\<close>, (*"?y ~= 0 ==> ?u / ?v / (?y / ?z) = ?u / ?v * (?z / ?y)"*)
   16.73 +        \<^rule_thm>\<open>divide_divide_eq_left\<close>, (*"?x / ?y / ?z = ?x / (?y * ?z)"*)
   16.74          
   16.75 -        \<^rule_thm>\<open>rat_power\<close>,
   16.76 -          (*"(?a / ?b)  \<up>  ?n = ?a  \<up>  ?n / ?b  \<up>  ?n"*)
   16.77 +        \<^rule_thm>\<open>rat_power\<close>, (*"(?a / ?b)  \<up>  ?n = ?a  \<up>  ?n / ?b  \<up>  ?n"*)
   16.78          
   16.79 -        \<^rule_thm>\<open>mult_cross\<close>,
   16.80 -          (*"[| b ~= 0; d ~= 0 |] ==> (a / b = c / d) = (a * d = b * c)*)
   16.81 -        \<^rule_thm>\<open>mult_cross1\<close>,
   16.82 -          (*"   b ~= 0            ==> (a / b = c    ) = (a     = b * c)*)
   16.83 -        \<^rule_thm>\<open>mult_cross2\<close>
   16.84 -          (*"           d ~= 0    ==> (a     = c / d) = (a * d =     c)*)], 
   16.85 +        \<^rule_thm>\<open>mult_cross\<close>,  (*"[| b ~= 0; d ~= 0 |] ==> (a / b = c / d) = (a * d = b * c)*)
   16.86 +        \<^rule_thm>\<open>mult_cross1\<close>, (*"   b ~= 0            ==> (a / b = c    ) = (a     = b * c)*)
   16.87 +        \<^rule_thm>\<open>mult_cross2\<close>  (*"           d ~= 0    ==> (a     = c / d) = (a * d =     c)*)], 
   16.88        scr = Rule.Empty_Prog})
   16.89      calculate_Poly);
   16.90  
   16.91 @@ -481,8 +466,8 @@
   16.92  ML \<open>
   16.93  val rational_erls = 
   16.94    Rule_Set.merge "rational_erls" calculate_Rational 
   16.95 -    (Rule_Set.append_rules "is_expanded" Atools_erls 
   16.96 -      [\<^rule_eval>\<open>is_expanded\<close> (eval_is_expanded "")]);
   16.97 +    (Rule_Set.append_rules "is_expanded" Atools_erls [
   16.98 +      \<^rule_eval>\<open>is_expanded\<close> (eval_is_expanded "")]);
   16.99  \<close>
  16.100  
  16.101  subsection \<open>Embed cancellation into rewriting\<close>
  16.102 @@ -554,7 +539,7 @@
  16.103  
  16.104  fun init_state thy eval_rls ro t =
  16.105    let 
  16.106 -    val SOME (t',_) = common_nominator_p_ thy t;
  16.107 +    val SOME (t', _) = common_nominator_p_ thy t;
  16.108      val SOME (t'', asm) = add_fraction_p_ thy t;
  16.109      val der = Derive.steps_reverse thy eval_rls rules ro NONE t';
  16.110      val der = der @ 
  16.111 @@ -623,145 +608,114 @@
  16.112  val powers = prep_rls'(
  16.113    Rule_Def.Repeat {id = "powers", preconds = [], rew_ord = ("dummy_ord",Rewrite_Ord.dummy_ord), 
  16.114        erls = powers_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  16.115 -      rules = [\<^rule_thm>\<open>realpow_multI\<close>,
  16.116 -	       (*"(r * s)  \<up>  n = r  \<up>  n * s  \<up>  n"*)
  16.117 -	       \<^rule_thm>\<open>realpow_pow\<close>,
  16.118 -	       (*"(a  \<up>  b)  \<up>  c = a  \<up>  (b * c)"*)
  16.119 -	       \<^rule_thm>\<open>realpow_oneI\<close>,
  16.120 -	       (*"r  \<up>  1 = r"*)
  16.121 -	       \<^rule_thm>\<open>realpow_minus_even\<close>,
  16.122 -	       (*"n is_even ==> (- r)  \<up>  n = r  \<up>  n" ?-->discard_minus?*)
  16.123 -	       \<^rule_thm>\<open>realpow_minus_odd\<close>,
  16.124 -	       (*"Not (n is_even) ==> (- r)  \<up>  n = -1 * r  \<up>  n"*)
  16.125 -	       
  16.126 -	       (*----- collect atoms over * -----*)
  16.127 -	       \<^rule_thm>\<open>realpow_two_atom\<close>,	
  16.128 -	       (*"r is_atom ==> r * r = r  \<up>  2"*)
  16.129 -	       \<^rule_thm>\<open>realpow_plus_1\<close>,		
  16.130 -	       (*"r is_atom ==> r * r  \<up>  n = r  \<up>  (n + 1)"*)
  16.131 -	       \<^rule_thm>\<open>realpow_addI_atom\<close>,
  16.132 -	       (*"r is_atom ==> r  \<up>  n * r  \<up>  m = r  \<up>  (n + m)"*)
  16.133 +      rules = [
  16.134 +        \<^rule_thm>\<open>realpow_multI\<close>, (*"(r * s)  \<up>  n = r  \<up>  n * s  \<up>  n"*)
  16.135 +        \<^rule_thm>\<open>realpow_pow\<close>, (*"(a  \<up>  b)  \<up>  c = a  \<up>  (b * c)"*)
  16.136 +        \<^rule_thm>\<open>realpow_oneI\<close>, (*"r  \<up>  1 = r"*)
  16.137 +        \<^rule_thm>\<open>realpow_minus_even\<close>, (*"n is_even ==> (- r)  \<up>  n = r  \<up>  n" ?-->discard_minus?*)
  16.138 +        \<^rule_thm>\<open>realpow_minus_odd\<close>, (*"Not (n is_even) ==> (- r)  \<up>  n = -1 * r  \<up>  n"*)
  16.139  
  16.140 -	       (*----- distribute none-atoms -----*)
  16.141 -	       \<^rule_thm>\<open>realpow_def_atom\<close>,
  16.142 -	       (*"[| 1 < n; ~ (r is_atom) |]==>r  \<up>  n = r * r  \<up>  (n + -1)"*)
  16.143 -	       \<^rule_thm>\<open>realpow_eq_oneI\<close>,
  16.144 -	       (*"1  \<up>  n = 1"*)
  16.145 -	       \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_")
  16.146 -	       ],
  16.147 -      scr = Rule.Empty_Prog
  16.148 -      });
  16.149 +        (*----- collect atoms over * -----*)
  16.150 +        \<^rule_thm>\<open>realpow_two_atom\<close>, (*"r is_atom ==> r * r = r  \<up>  2"*)
  16.151 +        \<^rule_thm>\<open>realpow_plus_1\<close>, (*"r is_atom ==> r * r  \<up>  n = r  \<up>  (n + 1)"*)
  16.152 +        \<^rule_thm>\<open>realpow_addI_atom\<close>, (*"r is_atom ==> r  \<up>  n * r  \<up>  m = r  \<up>  (n + m)"*)
  16.153 +
  16.154 +        (*----- distribute none-atoms -----*)
  16.155 +        \<^rule_thm>\<open>realpow_def_atom\<close>, (*"[| 1 < n; ~ (r is_atom) |]==>r  \<up>  n = r * r  \<up>  (n + -1)"*)
  16.156 +        \<^rule_thm>\<open>realpow_eq_oneI\<close>, (*"1  \<up>  n = 1"*)
  16.157 +        \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_")],
  16.158 +      scr = Rule.Empty_Prog});
  16.159 +
  16.160  (*.contains absolute minimum of thms for context in norm_Rational.*)
  16.161  val rat_mult_divide = prep_rls'(
  16.162    Rule_Def.Repeat {id = "rat_mult_divide", preconds = [], 
  16.163        rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), 
  16.164        erls = Rule_Set.empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
  16.165 -      rules = [\<^rule_thm>\<open>rat_mult\<close>,
  16.166 -	       (*(1)"?a / ?b * (?c / ?d) = ?a * ?c / (?b * ?d)"*)
  16.167 -	       \<^rule_thm>\<open>times_divide_eq_right\<close>,
  16.168 -	       (*(2)"?a * (?c / ?d) = ?a * ?c / ?d" must be [2],
  16.169 -	       otherwise inv.to a / b / c = ...*)
  16.170 -	       \<^rule_thm>\<open>times_divide_eq_left\<close>,
  16.171 -	       (*"?a / ?b * ?c = ?a * ?c / ?b" order weights x \<up> n too much
  16.172 -		     and does not commute a / b * c  \<up>  2 !*)
  16.173 +      rules = [
  16.174 +       \<^rule_thm>\<open>rat_mult\<close>, (*(1)"?a / ?b * (?c / ?d) = ?a * ?c / (?b * ?d)"*)
  16.175 +	       \<^rule_thm>\<open>times_divide_eq_right\<close>, (*(2)"?a * (?c / ?d) = ?a * ?c / ?d" must be [2],
  16.176 +	         otherwise inv.to a / b / c = ...*)
  16.177 +	       \<^rule_thm>\<open>times_divide_eq_left\<close>, (*"?a / ?b * ?c = ?a * ?c / ?b" order weights x \<up> n too much
  16.178 +		       and does not commute a / b * c  \<up>  2 !*)
  16.179  	       
  16.180 -	       \<^rule_thm>\<open>divide_divide_eq_right\<close>,
  16.181 -	       (*"?x / (?y / ?z) = ?x * ?z / ?y"*)
  16.182 -	       \<^rule_thm>\<open>divide_divide_eq_left\<close>,
  16.183 -	       (*"?x / ?y / ?z = ?x / (?y * ?z)"*)
  16.184 -	       \<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e")
  16.185 -	       ],
  16.186 -      scr = Rule.Empty_Prog
  16.187 -      });
  16.188 +	       \<^rule_thm>\<open>divide_divide_eq_right\<close>, (*"?x / (?y / ?z) = ?x * ?z / ?y"*)
  16.189 +	       \<^rule_thm>\<open>divide_divide_eq_left\<close>, (*"?x / ?y / ?z = ?x / (?y * ?z)"*)
  16.190 +	       \<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e")],
  16.191 +      scr = Rule.Empty_Prog});
  16.192  
  16.193  (*.contains absolute minimum of thms for context in norm_Rational.*)
  16.194  val reduce_0_1_2 = prep_rls'(
  16.195    Rule_Def.Repeat{id = "reduce_0_1_2", preconds = [], rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  16.196 -      erls = Rule_Set.empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
  16.197 -      rules = [(*\<^rule_thm>\<open>divide_1\<close>,
  16.198 -		 "?x / 1 = ?x" unnecess.for normalform*)
  16.199 -	       \<^rule_thm>\<open>mult_1_left\<close>,                 
  16.200 -	       (*"1 * z = z"*)
  16.201 -	       (*\<^rule_thm>\<open>real_mult_minus1\<close>,
  16.202 -	       "-1 * z = - z"*)
  16.203 -	       (*\<^rule_thm>\<open>real_minus_mult_cancel\<close>,
  16.204 -	       "- ?x * - ?y = ?x * ?y"*)
  16.205 -
  16.206 -	       \<^rule_thm>\<open>mult_zero_left\<close>,        
  16.207 -	       (*"0 * z = 0"*)
  16.208 -	       \<^rule_thm>\<open>add_0_left\<close>,
  16.209 -	       (*"0 + z = z"*)
  16.210 -	       (*\<^rule_thm>\<open>right_minus\<close>,
  16.211 -	       "?z + - ?z = 0"*)
  16.212 -
  16.213 -	       \<^rule_thm_sym>\<open>real_mult_2\<close>,	
  16.214 -	       (*"z1 + z1 = 2 * z1"*)
  16.215 -	       \<^rule_thm>\<open>real_mult_2_assoc\<close>,
  16.216 -	       (*"z1 + (z1 + k) = 2 * z1 + k"*)
  16.217 -
  16.218 -	       \<^rule_thm>\<open>division_ring_divide_zero\<close>
  16.219 -	       (*"0 / ?x = 0"*)
  16.220 -	       ], scr = Rule.Empty_Prog});
  16.221 +    erls = Rule_Set.empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
  16.222 +    rules = [
  16.223 +      (*\<^rule_thm>\<open>divide_1\<close>, "?x / 1 = ?x" unnecessary.for normalform*)
  16.224 +	    \<^rule_thm>\<open>mult_1_left\<close>, (*"1 * z = z"*)
  16.225 +	    (*\<^rule_thm>\<open>real_mult_minus1\<close>, "-1 * z = - z"*)
  16.226 +	    (*\<^rule_thm>\<open>real_minus_mult_cancel\<close>, "- ?x * - ?y = ?x * ?y"*)
  16.227 +    
  16.228 +    
  16.229 +      \<^rule_thm>\<open>mult_zero_left\<close>, (*"0 * z = 0"*)
  16.230 +      \<^rule_thm>\<open>add_0_left\<close>, (*"0 + z = z"*)
  16.231 +      (*\<^rule_thm>\<open>right_minus\<close>, "?z + - ?z = 0"*)
  16.232 +    
  16.233 +      \<^rule_thm_sym>\<open>real_mult_2\<close>,	 (*"z1 + z1 = 2 * z1"*)
  16.234 +      \<^rule_thm>\<open>real_mult_2_assoc\<close>, (*"z1 + (z1 + k) = 2 * z1 + k"*)
  16.235 +    
  16.236 +      \<^rule_thm>\<open>division_ring_divide_zero\<close> (*"0 / ?x = 0"*)],
  16.237 +    scr = Rule.Empty_Prog});
  16.238  
  16.239  (*erls for calculate_Rational; 
  16.240    make local with FIXX@ME result:term *term list WN0609???SKMG*)
  16.241  val norm_rat_erls = prep_rls'(
  16.242    Rule_Def.Repeat {id = "norm_rat_erls", preconds = [], rew_ord = ("dummy_ord",Rewrite_Ord.dummy_ord), 
  16.243 -      erls = Rule_Set.empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
  16.244 -      rules = [\<^rule_eval>\<open>Prog_Expr.is_const\<close> (Prog_Expr.eval_const "#is_const_")
  16.245 -	       ], scr = Rule.Empty_Prog});
  16.246 +    erls = Rule_Set.empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
  16.247 +    rules = [
  16.248 +      \<^rule_eval>\<open>Prog_Expr.is_const\<close> (Prog_Expr.eval_const "#is_const_")],
  16.249 +    scr = Rule.Empty_Prog});
  16.250  
  16.251  (* consists of rls containing the absolute minimum of thms *)
  16.252 -(*040209: this version has been used by RL for his equations,
  16.253 -which is now replaced by MGs version "norm_Rational" below *)
  16.254 +(*
  16.255 +  which is now replaced by MGs version "norm_Rational" below
  16.256 +*)
  16.257  val norm_Rational_min = prep_rls'(
  16.258    Rule_Def.Repeat {id = "norm_Rational_min", preconds = [], rew_ord = ("dummy_ord",Rewrite_Ord.dummy_ord), 
  16.259 -      erls = norm_rat_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  16.260 -      rules = [(*sequence given by operator precedence*)
  16.261 -	       Rule.Rls_ discard_minus,
  16.262 -	       Rule.Rls_ powers,
  16.263 -	       Rule.Rls_ rat_mult_divide,
  16.264 -	       Rule.Rls_ expand,
  16.265 -	       Rule.Rls_ reduce_0_1_2,
  16.266 -	       Rule.Rls_ order_add_mult,
  16.267 -	       Rule.Rls_ collect_numerals,
  16.268 -	       Rule.Rls_ add_fractions_p,
  16.269 -	       Rule.Rls_ cancel_p
  16.270 -	       ],
  16.271 -      scr = Rule.Empty_Prog});
  16.272 +    erls = norm_rat_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  16.273 +    rules = [(*sequence given by operator precedence*)
  16.274 +	     Rule.Rls_ discard_minus,
  16.275 +	     Rule.Rls_ powers,
  16.276 +	     Rule.Rls_ rat_mult_divide,
  16.277 +	     Rule.Rls_ expand,
  16.278 +	     Rule.Rls_ reduce_0_1_2,
  16.279 +	     Rule.Rls_ order_add_mult,
  16.280 +	     Rule.Rls_ collect_numerals,
  16.281 +	     Rule.Rls_ add_fractions_p,
  16.282 +	     Rule.Rls_ cancel_p
  16.283 +	     ],
  16.284 +    scr = Rule.Empty_Prog});
  16.285  
  16.286  val norm_Rational_parenthesized = prep_rls'(
  16.287    Rule_Set.Sequence {id = "norm_Rational_parenthesized", preconds = []:term list, 
  16.288 -       rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  16.289 -      erls = Atools_erls, srls = Rule_Set.Empty,
  16.290 -      calc = [], errpatts = [],
  16.291 -      rules = [Rule.Rls_  norm_Rational_min,
  16.292 -	       Rule.Rls_ discard_parentheses
  16.293 -	       ],
  16.294 -      scr = Rule.Empty_Prog});      
  16.295 +    rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord),
  16.296 +    erls = Atools_erls, srls = Rule_Set.Empty,
  16.297 +    calc = [], errpatts = [],
  16.298 +    rules = [
  16.299 +      Rule.Rls_  norm_Rational_min,
  16.300 +	    Rule.Rls_ discard_parentheses],
  16.301 +    scr = Rule.Empty_Prog});      
  16.302  
  16.303  (*WN030318???SK: simplifies all but cancel and common_nominator*)
  16.304  val simplify_rational = 
  16.305 -    Rule_Set.merge "simplify_rational" expand_binoms
  16.306 -    (Rule_Set.append_rules "divide" calculate_Rational
  16.307 -		[\<^rule_thm>\<open>div_by_1\<close>,
  16.308 -		 (*"?x / 1 = ?x"*)
  16.309 -		 \<^rule_thm>\<open>rat_mult\<close>,
  16.310 -		 (*(1)"?a / ?b * (?c / ?d) = ?a * ?c / (?b * ?d)"*)
  16.311 -		 \<^rule_thm>\<open>times_divide_eq_right\<close>,
  16.312 -		 (*(2)"?a * (?c / ?d) = ?a * ?c / ?d" must be [2],
  16.313 -		 otherwise inv.to a / b / c = ...*)
  16.314 -		 \<^rule_thm>\<open>times_divide_eq_left\<close>,
  16.315 -		 (*"?a / ?b * ?c = ?a * ?c / ?b"*)
  16.316 -		 \<^rule_thm>\<open>add_minus\<close>,
  16.317 -		 (*"?a + ?b - ?b = ?a"*)
  16.318 -		 \<^rule_thm>\<open>add_minus1\<close>,
  16.319 -		 (*"?a - ?b + ?b = ?a"*)
  16.320 -		 \<^rule_thm>\<open>divide_minus1\<close>
  16.321 -		 (*"?x / -1 = - ?x"*)
  16.322 -		 ]);
  16.323 -\<close>
  16.324 -ML \<open>
  16.325 +  Rule_Set.merge "simplify_rational" expand_binoms
  16.326 +    (Rule_Set.append_rules "divide" calculate_Rational [
  16.327 +      \<^rule_thm>\<open>div_by_1\<close>, (*"?x / 1 = ?x"*)
  16.328 +      \<^rule_thm>\<open>rat_mult\<close>, (*(1)"?a / ?b * (?c / ?d) = ?a * ?c / (?b * ?d)"*)
  16.329 +      \<^rule_thm>\<open>times_divide_eq_right\<close>, (*(2)"?a * (?c / ?d) = ?a * ?c / ?d" must be [2],
  16.330 +  		   otherwise inv.to a / b / c = ...*)
  16.331 +      \<^rule_thm>\<open>times_divide_eq_left\<close>, (*"?a / ?b * ?c = ?a * ?c / ?b"*)
  16.332 +      \<^rule_thm>\<open>add_minus\<close>, (*"?a + ?b - ?b = ?a"*)
  16.333 +      \<^rule_thm>\<open>add_minus1\<close>, (*"?a - ?b + ?b = ?a"*)
  16.334 +      \<^rule_thm>\<open>divide_minus1\<close> (*"?x / -1 = - ?x"*)]);
  16.335 +
  16.336  val add_fractions_p_rls = prep_rls'(
  16.337    Rule_Def.Repeat {id = "add_fractions_p_rls", preconds = [], rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), 
  16.338  	  erls = Rule_Set.empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
  16.339 @@ -780,14 +734,12 @@
  16.340      used in initial part norm_Rational_mg, see example DA-M02-main.p.60.*)
  16.341  val rat_mult_poly = prep_rls'(
  16.342    Rule_Def.Repeat {id = "rat_mult_poly", preconds = [], rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), 
  16.343 -	  erls = Rule_Set.append_rules "Rule_Set.empty-is_polyexp" Rule_Set.empty
  16.344 -      [\<^rule_eval>\<open>is_polyexp\<close> (eval_is_polyexp "")],
  16.345 +	  erls = Rule_Set.append_rules "Rule_Set.empty-is_polyexp" Rule_Set.empty [
  16.346 +     \<^rule_eval>\<open>is_polyexp\<close> (eval_is_polyexp "")],
  16.347  	  srls = Rule_Set.Empty, calc = [], errpatts = [],
  16.348 -	  rules = 
  16.349 -	    [\<^rule_thm>\<open>rat_mult_poly_l\<close>,
  16.350 -	    (*"?c is_polyexp ==> ?c * (?a / ?b) = ?c * ?a / ?b"*)
  16.351 -	    \<^rule_thm>\<open>rat_mult_poly_r\<close>
  16.352 -	    (*"?c is_polyexp ==> ?a / ?b * ?c = ?a * ?c / ?b"*) ], 
  16.353 +	  rules = [
  16.354 +      \<^rule_thm>\<open>rat_mult_poly_l\<close>, (*"?c is_polyexp ==> ?c * (?a / ?b) = ?c * ?a / ?b"*)
  16.355 +	    \<^rule_thm>\<open>rat_mult_poly_r\<close> (*"?c is_polyexp ==> ?a / ?b * ?c = ?a * ?c / ?b"*)], 
  16.356  	  scr = Rule.Empty_Prog});
  16.357  
  16.358  (*. makes 'normal' fractions; 'is_polyexp' inhibits double fractions;
  16.359 @@ -798,60 +750,50 @@
  16.360  val rat_mult_div_pow = prep_rls'(
  16.361    Rule_Def.Repeat {id = "rat_mult_div_pow", preconds = [], rew_ord = ("dummy_ord",Rewrite_Ord.dummy_ord), 
  16.362      erls = Rule_Set.empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
  16.363 -    rules = [\<^rule_thm>\<open>rat_mult\<close>,
  16.364 -      (*"?a / ?b * (?c / ?d) = ?a * ?c / (?b * ?d)"*)
  16.365 -      \<^rule_thm>\<open>rat_mult_poly_l\<close>,
  16.366 -      (*"?c is_polyexp ==> ?c * (?a / ?b) = ?c * ?a / ?b"*)
  16.367 -      \<^rule_thm>\<open>rat_mult_poly_r\<close>,
  16.368 -      (*"?c is_polyexp ==> ?a / ?b * ?c = ?a * ?c / ?b"*)
  16.369 +    rules = [
  16.370 +      \<^rule_thm>\<open>rat_mult\<close>, (*"?a / ?b * (?c / ?d) = ?a * ?c / (?b * ?d)"*)
  16.371 +      \<^rule_thm>\<open>rat_mult_poly_l\<close>, (*"?c is_polyexp ==> ?c * (?a / ?b) = ?c * ?a / ?b"*)
  16.372 +      \<^rule_thm>\<open>rat_mult_poly_r\<close>, (*"?c is_polyexp ==> ?a / ?b * ?c = ?a * ?c / ?b"*)
  16.373        
  16.374 -      \<^rule_thm>\<open>real_divide_divide1_mg\<close>,
  16.375 -      (*"y ~= 0 ==> (u / v) / (y / z) = (u * z) / (y * v)"*)
  16.376 -      \<^rule_thm>\<open>divide_divide_eq_right\<close>,
  16.377 -      (*"?x / (?y / ?z) = ?x * ?z / ?y"*)
  16.378 -      \<^rule_thm>\<open>divide_divide_eq_left\<close>,
  16.379 -      (*"?x / ?y / ?z = ?x / (?y * ?z)"*)
  16.380 +      \<^rule_thm>\<open>real_divide_divide1_mg\<close>, (*"y ~= 0 ==> (u / v) / (y / z) = (u * z) / (y * v)"*)
  16.381 +      \<^rule_thm>\<open>divide_divide_eq_right\<close>, (*"?x / (?y / ?z) = ?x * ?z / ?y"*)
  16.382 +      \<^rule_thm>\<open>divide_divide_eq_left\<close>, (*"?x / ?y / ?z = ?x / (?y * ?z)"*)
  16.383        \<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e"),
  16.384        
  16.385 -      \<^rule_thm>\<open>rat_power\<close>
  16.386 -      (*"(?a / ?b)  \<up>  ?n = ?a  \<up>  ?n / ?b  \<up>  ?n"*)
  16.387 -      ],
  16.388 +      \<^rule_thm>\<open>rat_power\<close> (*"(?a / ?b)  \<up>  ?n = ?a  \<up>  ?n / ?b  \<up>  ?n"*)],
  16.389      scr = Rule.Empty_Prog});
  16.390  
  16.391  val rat_reduce_1 = prep_rls'(
  16.392    Rule_Def.Repeat {id = "rat_reduce_1", preconds = [], rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), 
  16.393      erls = Rule_Set.empty, srls = Rule_Set.Empty, calc = [], errpatts = [], 
  16.394 -    rules = 
  16.395 -      [\<^rule_thm>\<open>div_by_1\<close>,
  16.396 -      (*"?x / 1 = ?x"*)
  16.397 -      \<^rule_thm>\<open>mult_1_left\<close>           
  16.398 -      (*"1 * z = z"*)
  16.399 -      ],
  16.400 +    rules = [
  16.401 +      \<^rule_thm>\<open>div_by_1\<close>, (*"?x / 1 = ?x"*)
  16.402 +      \<^rule_thm>\<open>mult_1_left\<close> (*"1 * z = z"*)],
  16.403      scr = Rule.Empty_Prog});
  16.404  
  16.405  (* looping part of norm_Rational *)
  16.406  val norm_Rational_rls = prep_rls' (
  16.407    Rule_Def.Repeat {id = "norm_Rational_rls", preconds = [], rew_ord = ("dummy_ord",Rewrite_Ord.dummy_ord), 
  16.408      erls = norm_rat_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  16.409 -    rules = [Rule.Rls_ add_fractions_p_rls,
  16.410 +    rules = [
  16.411 +      Rule.Rls_ add_fractions_p_rls,
  16.412        Rule.Rls_ rat_mult_div_pow,
  16.413        Rule.Rls_ make_rat_poly_with_parentheses,
  16.414        Rule.Rls_ cancel_p_rls,
  16.415 -      Rule.Rls_ rat_reduce_1
  16.416 -      ],
  16.417 +      Rule.Rls_ rat_reduce_1],
  16.418      scr = Rule.Empty_Prog});
  16.419  
  16.420  val norm_Rational = prep_rls' (
  16.421    Rule_Set.Sequence 
  16.422      {id = "norm_Rational", preconds = [], rew_ord = ("dummy_ord", Rewrite_Ord.dummy_ord), 
  16.423      erls = norm_rat_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  16.424 -    rules = [Rule.Rls_ discard_minus,
  16.425 +    rules = [
  16.426 +      Rule.Rls_ discard_minus,
  16.427        Rule.Rls_ rat_mult_poly,             (* removes double fractions like a/b/c *)
  16.428        Rule.Rls_ make_rat_poly_with_parentheses,
  16.429        Rule.Rls_ cancel_p_rls,
  16.430        Rule.Rls_ norm_Rational_rls,         (* the main rls, looping (#) *)
  16.431 -      Rule.Rls_ discard_parentheses1       (* mult only *)
  16.432 -      ],
  16.433 +      Rule.Rls_ discard_parentheses1],     (* mult only *)
  16.434      scr = Rule.Empty_Prog});
  16.435  \<close>
  16.436  
    17.1 --- a/src/Tools/isac/Knowledge/Root.thy	Mon Aug 09 14:20:20 2021 +0200
    17.2 +++ b/src/Tools/isac/Knowledge/Root.thy	Tue Aug 10 09:43:07 2021 +0200
    17.3 @@ -156,94 +156,69 @@
    17.4  
    17.5  (*-------------------------rulse-------------------------*)
    17.6  val Root_crls = 
    17.7 -      Rule_Set.append_rules "Root_crls" Atools_erls 
    17.8 -       [\<^rule_thm>\<open>real_unari_minus\<close>,
    17.9 -        \<^rule_eval>\<open>sqrt\<close> (eval_sqrt "#sqrt_"),
   17.10 -        \<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e"),
   17.11 -        \<^rule_eval>\<open>powr\<close> (**)(eval_binop "#power_"),
   17.12 -        \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"), 
   17.13 -        \<^rule_eval>\<open>minus\<close> (**)(eval_binop "#sub_"),
   17.14 -        \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
   17.15 -        \<^rule_eval>\<open>HOL.eq\<close> (Prog_Expr.eval_equal "#equal_") 
   17.16 -        ];
   17.17 +  Rule_Set.append_rules "Root_crls" Atools_erls [
   17.18 +    \<^rule_thm>\<open>real_unari_minus\<close>,
   17.19 +    \<^rule_eval>\<open>sqrt\<close> (eval_sqrt "#sqrt_"),
   17.20 +    \<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e"),
   17.21 +    \<^rule_eval>\<open>powr\<close> (**)(eval_binop "#power_"),
   17.22 +    \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"), 
   17.23 +    \<^rule_eval>\<open>minus\<close> (**)(eval_binop "#sub_"),
   17.24 +    \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
   17.25 +    \<^rule_eval>\<open>HOL.eq\<close> (Prog_Expr.eval_equal "#equal_")];
   17.26  
   17.27  val Root_erls = 
   17.28 -      Rule_Set.append_rules "Root_erls" Atools_erls 
   17.29 -       [\<^rule_thm>\<open>real_unari_minus\<close>,
   17.30 -        \<^rule_eval>\<open>sqrt\<close> (eval_sqrt "#sqrt_"),
   17.31 -        \<^rule_eval>\<open>Rings.divide_class.divide\<close> (Prog_Expr.eval_cancel "#divide_e"),
   17.32 -        \<^rule_eval>\<open>Transcendental.powr\<close> (**)(eval_binop "#power_"),
   17.33 -        \<^rule_eval>\<open>Groups.plus_class.plus\<close> (**)(eval_binop "#add_"), 
   17.34 -        \<^rule_eval>\<open>Groups.minus_class.minus\<close> (**)(eval_binop "#sub_"),
   17.35 -        \<^rule_eval>\<open>Groups.times_class.times\<close> (**)(eval_binop "#mult_"),
   17.36 -        \<^rule_eval>\<open>HOL.eq\<close> (Prog_Expr.eval_equal "#equal_") 
   17.37 -        ];
   17.38 +  Rule_Set.append_rules "Root_erls" Atools_erls [
   17.39 +    \<^rule_thm>\<open>real_unari_minus\<close>,
   17.40 +    \<^rule_eval>\<open>sqrt\<close> (eval_sqrt "#sqrt_"),
   17.41 +    \<^rule_eval>\<open>Rings.divide_class.divide\<close> (Prog_Expr.eval_cancel "#divide_e"),
   17.42 +    \<^rule_eval>\<open>Transcendental.powr\<close> (**)(eval_binop "#power_"),
   17.43 +    \<^rule_eval>\<open>Groups.plus_class.plus\<close> (**)(eval_binop "#add_"), 
   17.44 +    \<^rule_eval>\<open>Groups.minus_class.minus\<close> (**)(eval_binop "#sub_"),
   17.45 +    \<^rule_eval>\<open>Groups.times_class.times\<close> (**)(eval_binop "#mult_"),
   17.46 +    \<^rule_eval>\<open>HOL.eq\<close> (Prog_Expr.eval_equal "#equal_")];
   17.47  \<close>
   17.48  rule_set_knowledge Root_erls = Root_erls
   17.49  ML \<open>
   17.50  
   17.51  val make_rooteq = prep_rls'(
   17.52    Rule_Def.Repeat{id = "make_rooteq", preconds = []:term list, 
   17.53 -      rew_ord = ("sqrt_right", sqrt_right false \<^theory>),
   17.54 -      erls = Atools_erls, srls = Rule_Set.Empty,
   17.55 -      calc = [], errpatts = [],
   17.56 -      rules = [\<^rule_thm>\<open>real_diff_minus\<close>,			
   17.57 -	       (*"a - b = a + (-1) * b"*)
   17.58 +    rew_ord = ("sqrt_right", sqrt_right false \<^theory>),
   17.59 +    erls = Atools_erls, srls = Rule_Set.Empty,
   17.60 +    calc = [], errpatts = [],
   17.61 +    rules = [
   17.62 +      \<^rule_thm>\<open>real_diff_minus\<close>,	 (*"a - b = a + (-1) * b"*)
   17.63  
   17.64 -	       \<^rule_thm>\<open>distrib_right\<close>,	
   17.65 -	       (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
   17.66 -	       \<^rule_thm>\<open>distrib_left\<close>,	
   17.67 -	       (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
   17.68 -	       \<^rule_thm>\<open>left_diff_distrib\<close>,	
   17.69 -	       (*"(z1.0 - z2.0) * w = z1.0 * w - z2.0 * w"*)
   17.70 -	       \<^rule_thm>\<open>right_diff_distrib\<close>,	
   17.71 -	       (*"w * (z1.0 - z2.0) = w * z1.0 - w * z2.0"*)
   17.72 +      \<^rule_thm>\<open>distrib_right\<close>,	 (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
   17.73 +      \<^rule_thm>\<open>distrib_left\<close>, (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
   17.74 +      \<^rule_thm>\<open>left_diff_distrib\<close>, (*"(z1.0 - z2.0) * w = z1.0 * w - z2.0 * w"*)
   17.75 +      \<^rule_thm>\<open>right_diff_distrib\<close>, (*"w * (z1.0 - z2.0) = w * z1.0 - w * z2.0"*)
   17.76  
   17.77 -	       \<^rule_thm>\<open>mult_1_left\<close>,                         
   17.78 -	       (*"1 * z = z"*)
   17.79 -	       \<^rule_thm>\<open>mult_zero_left\<close>,                         
   17.80 -	       (*"0 * z = 0"*)
   17.81 -	       \<^rule_thm>\<open>add_0_left\<close>,		
   17.82 -	       (*"0 + z = z"*)
   17.83 - 
   17.84 -	       \<^rule_thm>\<open>mult.commute\<close>,
   17.85 -		(*AC-rewriting*)
   17.86 -	       \<^rule_thm>\<open>real_mult_left_commute\<close>,
   17.87 -         	(**)
   17.88 -	       \<^rule_thm>\<open>mult.assoc\<close>,
   17.89 -	        (**)
   17.90 -	       \<^rule_thm>\<open>add.commute\<close>,
   17.91 -		(**)
   17.92 -	       \<^rule_thm>\<open>add.left_commute\<close>,
   17.93 -	        (**)
   17.94 -	       \<^rule_thm>\<open>add.assoc\<close>,
   17.95 -	        (**)
   17.96 +      \<^rule_thm>\<open>mult_1_left\<close>, (*"1 * z = z"*)
   17.97 +      \<^rule_thm>\<open>mult_zero_left\<close>, (*"0 * z = 0"*)
   17.98 +      \<^rule_thm>\<open>add_0_left\<close>, (*"0 + z = z"*)
   17.99  
  17.100 -	       \<^rule_thm_sym>\<open>realpow_twoI\<close>,
  17.101 -	       (*"r1 * r1 = r1  \<up>  2"*)
  17.102 -	       \<^rule_thm>\<open>realpow_plus_1\<close>,			
  17.103 -	       (*"r * r  \<up>  n = r  \<up>  (n + 1)"*)
  17.104 -	       \<^rule_thm_sym>\<open>real_mult_2\<close>,
  17.105 -	       (*"z1 + z1 = 2 * z1"*)
  17.106 -	       \<^rule_thm>\<open>real_mult_2_assoc\<close>,		
  17.107 -	       (*"z1 + (z1 + k) = 2 * z1 + k"*)
  17.108 +       (*AC-rewriting*)
  17.109 +      \<^rule_thm>\<open>mult.commute\<close>,
  17.110 +      \<^rule_thm>\<open>real_mult_left_commute\<close>,
  17.111 +      \<^rule_thm>\<open>mult.assoc\<close>,
  17.112 +      \<^rule_thm>\<open>add.commute\<close>,
  17.113 +      \<^rule_thm>\<open>add.left_commute\<close>,
  17.114 +      \<^rule_thm>\<open>add.assoc\<close>,
  17.115  
  17.116 -	       \<^rule_thm>\<open>real_num_collect\<close>, 
  17.117 -	       (*"[| l is_const; m is_const |]==> l * n + m * n = (l + m) * n"*)
  17.118 -	       \<^rule_thm>\<open>real_num_collect_assoc\<close>,	
  17.119 -	       (*"[| l is_const; m is_const |] ==>  
  17.120 -                                   l * n + (m * n + k) =  (l + m) * n + k"*)
  17.121 -	       \<^rule_thm>\<open>real_one_collect\<close>,		
  17.122 -	       (*"m is_const ==> n + m * n = (1 + m) * n"*)
  17.123 -	       \<^rule_thm>\<open>real_one_collect_assoc\<close>, 
  17.124 -	       (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  17.125 +      \<^rule_thm_sym>\<open>realpow_twoI\<close>, (*"r1 * r1 = r1  \<up>  2"*)
  17.126 +      \<^rule_thm>\<open>realpow_plus_1\<close>, (*"r * r  \<up>  n = r  \<up>  (n + 1)"*)
  17.127 +      \<^rule_thm_sym>\<open>real_mult_2\<close>, (*"z1 + z1 = 2 * z1"*)
  17.128 +      \<^rule_thm>\<open>real_mult_2_assoc\<close>,	(*"z1 + (z1 + k) = 2 * z1 + k"*)
  17.129  
  17.130 -	       \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"), 
  17.131 -	       \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
  17.132 -	       \<^rule_eval>\<open>powr\<close> (**)(eval_binop "#power_")
  17.133 -	       ],
  17.134 -      scr = Rule.Empty_Prog
  17.135 -      });      
  17.136 +      \<^rule_thm>\<open>real_num_collect\<close>, (*"[| l is_const; m is_const |]==> l * n + m * n = (l + m) * n"*)
  17.137 +      \<^rule_thm>\<open>real_num_collect_assoc\<close>, (*"[| l is_const; m is_const |] ==> l * n + (m * n + k) =  (l + m) * n + k"*)
  17.138 +      \<^rule_thm>\<open>real_one_collect\<close>, (*"m is_const ==> n + m * n = (1 + m) * n"*)
  17.139 +      \<^rule_thm>\<open>real_one_collect_assoc\<close>, (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  17.140 +
  17.141 +      \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
  17.142 +      \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
  17.143 +      \<^rule_eval>\<open>powr\<close> (**)(eval_binop "#power_")],
  17.144 +    scr = Rule.Empty_Prog});      
  17.145  \<close>
  17.146  rule_set_knowledge make_rooteq = make_rooteq
  17.147  ML \<open>
  17.148 @@ -251,72 +226,50 @@
  17.149  val prep_rls' = Auto_Prog.prep_rls @{theory};
  17.150  
  17.151  val expand_rootbinoms = prep_rls'(
  17.152 -  Rule_Def.Repeat{id = "expand_rootbinoms", preconds = [], 
  17.153 -      rew_ord = ("termlessI",termlessI),
  17.154 -      erls = Atools_erls, srls = Rule_Set.Empty,
  17.155 -      calc = [], errpatts = [],
  17.156 -      rules = [\<^rule_thm>\<open>real_plus_binom_pow2\<close>,     
  17.157 -	       (*"(a + b)  \<up>  2 = a  \<up>  2 + 2 * a * b + b  \<up>  2"*)
  17.158 -	       \<^rule_thm>\<open>real_plus_binom_times\<close>,    
  17.159 -	       (*"(a + b)*(a + b) = ...*)
  17.160 -	       \<^rule_thm>\<open>real_minus_binom_pow2\<close>,    
  17.161 -		(*"(a - b)  \<up>  2 = a  \<up>  2 - 2 * a * b + b  \<up>  2"*)
  17.162 -	       \<^rule_thm>\<open>real_minus_binom_times\<close>,   
  17.163 -	       (*"(a - b)*(a - b) = ...*)
  17.164 -	       \<^rule_thm>\<open>real_plus_minus_binom1\<close>,   
  17.165 -		(*"(a + b) * (a - b) = a  \<up>  2 - b  \<up>  2"*)
  17.166 -	       \<^rule_thm>\<open>real_plus_minus_binom2\<close>,   
  17.167 -		(*"(a - b) * (a + b) = a  \<up>  2 - b  \<up>  2"*)
  17.168 -	       (*RL 020915*)
  17.169 -	       \<^rule_thm>\<open>real_pp_binom_times\<close>, 
  17.170 -		(*(a + b)*(c + d) = a*c + a*d + b*c + b*d*)
  17.171 -               \<^rule_thm>\<open>real_pm_binom_times\<close>, 
  17.172 -		(*(a + b)*(c - d) = a*c - a*d + b*c - b*d*)
  17.173 -               \<^rule_thm>\<open>real_mp_binom_times\<close>, 
  17.174 -		(*(a - b)*(c p d) = a*c + a*d - b*c - b*d*)
  17.175 -               \<^rule_thm>\<open>real_mm_binom_times\<close>, 
  17.176 -		(*(a - b)*(c p d) = a*c - a*d - b*c + b*d*)
  17.177 -	       \<^rule_thm>\<open>realpow_mul\<close>,                 
  17.178 -		(*(a*b) \<up> n = a \<up> n * b \<up> n*)
  17.179 -
  17.180 -	       \<^rule_thm>\<open>mult_1_left\<close>,         (*"1 * z = z"*)
  17.181 -	       \<^rule_thm>\<open>mult_zero_left\<close>,         (*"0 * z = 0"*)
  17.182 -	       \<^rule_thm>\<open>add_0_left\<close>, 
  17.183 -                 (*"0 + z = z"*)
  17.184 -
  17.185 -	       \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"), 
  17.186 -	       \<^rule_eval>\<open>minus\<close> (**)(eval_binop "#sub_"), 
  17.187 -	       \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
  17.188 -	       \<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e"),
  17.189 -	       \<^rule_eval>\<open>sqrt\<close> (eval_sqrt "#sqrt_"),
  17.190 -	       \<^rule_eval>\<open>powr\<close> (**)(eval_binop "#power_"),
  17.191 -
  17.192 -	       \<^rule_thm_sym>\<open>realpow_twoI\<close>,
  17.193 -	       (*"r1 * r1 = r1  \<up>  2"*)
  17.194 -	       \<^rule_thm>\<open>realpow_plus_1\<close>,			
  17.195 -	       (*"r * r  \<up>  n = r  \<up>  (n + 1)"*)
  17.196 -	       \<^rule_thm>\<open>real_mult_2_assoc\<close>,		
  17.197 -	       (*"z1 + (z1 + k) = 2 * z1 + k"*)
  17.198 -
  17.199 -	       \<^rule_thm>\<open>real_num_collect\<close>, 
  17.200 -	       (*"[| l is_const; m is_const |] ==>l * n + m * n = (l + m) * n"*)
  17.201 -	       \<^rule_thm>\<open>real_num_collect_assoc\<close>,	
  17.202 -	       (*"[| l is_const; m is_const |] ==>
  17.203 -                  l * n + (m * n + k) =  (l + m) * n + k"*)
  17.204 -	       \<^rule_thm>\<open>real_one_collect\<close>,		
  17.205 -	       (*"m is_const ==> n + m * n = (1 + m) * n"*)
  17.206 -	       \<^rule_thm>\<open>real_one_collect_assoc\<close>, 
  17.207 -	       (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  17.208 -
  17.209 -	       \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"), 
  17.210 -	       \<^rule_eval>\<open>minus\<close> (**)(eval_binop "#sub_"), 
  17.211 -	       \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
  17.212 -	       \<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e"),
  17.213 -	       \<^rule_eval>\<open>sqrt\<close> (eval_sqrt "#sqrt_"),
  17.214 -	       \<^rule_eval>\<open>powr\<close> (**)(eval_binop "#power_")
  17.215 -	       ],
  17.216 -      scr = Rule.Empty_Prog
  17.217 -       });      
  17.218 +  Rule_Def.Repeat {
  17.219 +    id = "expand_rootbinoms", preconds = [], rew_ord = ("termlessI",termlessI),
  17.220 +    erls = Atools_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  17.221 +    rules = [
  17.222 +       \<^rule_thm>\<open>real_plus_binom_pow2\<close>, (*"(a + b)  \<up>  2 = a  \<up>  2 + 2 * a * b + b  \<up>  2"*)
  17.223 +       \<^rule_thm>\<open>real_plus_binom_times\<close>, (*"(a + b)*(a + b) = ...*)
  17.224 +       \<^rule_thm>\<open>real_minus_binom_pow2\<close>, (*"(a - b)  \<up>  2 = a  \<up>  2 - 2 * a * b + b  \<up>  2"*)
  17.225 +       \<^rule_thm>\<open>real_minus_binom_times\<close>, (*"(a - b)*(a - b) = ...*)
  17.226 +       \<^rule_thm>\<open>real_plus_minus_binom1\<close>, (*"(a + b) * (a - b) = a  \<up>  2 - b  \<up>  2"*)
  17.227 +       \<^rule_thm>\<open>real_plus_minus_binom2\<close>,  (*"(a - b) * (a + b) = a  \<up>  2 - b  \<up>  2"*)
  17.228 +       (*RL 020915*)
  17.229 +       \<^rule_thm>\<open>real_pp_binom_times\<close>, (*(a + b)*(c + d) = a*c + a*d + b*c + b*d*)
  17.230 +       \<^rule_thm>\<open>real_pm_binom_times\<close>, (*(a + b)*(c - d) = a*c - a*d + b*c - b*d*)
  17.231 +       \<^rule_thm>\<open>real_mp_binom_times\<close>, (*(a - b)*(c p d) = a*c + a*d - b*c - b*d*)
  17.232 +       \<^rule_thm>\<open>real_mm_binom_times\<close>, (*(a - b)*(c p d) = a*c - a*d - b*c + b*d*)
  17.233 +       \<^rule_thm>\<open>realpow_mul\<close>,  (*(a*b) \<up> n = a \<up> n * b \<up> n*)
  17.234 +  
  17.235 +       \<^rule_thm>\<open>mult_1_left\<close>, (*"1 * z = z"*)
  17.236 +       \<^rule_thm>\<open>mult_zero_left\<close>, (*"0 * z = 0"*)
  17.237 +       \<^rule_thm>\<open>add_0_left\<close>, (*"0 + z = z"*)
  17.238 +  
  17.239 +       \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"), 
  17.240 +       \<^rule_eval>\<open>minus\<close> (**)(eval_binop "#sub_"), 
  17.241 +       \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
  17.242 +       \<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e"),
  17.243 +       \<^rule_eval>\<open>sqrt\<close> (eval_sqrt "#sqrt_"),
  17.244 +       \<^rule_eval>\<open>powr\<close> (**)(eval_binop "#power_"),
  17.245 +  
  17.246 +       \<^rule_thm_sym>\<open>realpow_twoI\<close>, (*"r1 * r1 = r1  \<up>  2"*)
  17.247 +       \<^rule_thm>\<open>realpow_plus_1\<close>, (*"r * r  \<up>  n = r  \<up>  (n + 1)"*)
  17.248 +       \<^rule_thm>\<open>real_mult_2_assoc\<close>,	 (*"z1 + (z1 + k) = 2 * z1 + k"*)
  17.249 +  
  17.250 +       \<^rule_thm>\<open>real_num_collect\<close>, (*"[| l is_const; m is_const |] ==>l * n + m * n = (l + m) * n"*)
  17.251 +       \<^rule_thm>\<open>real_num_collect_assoc\<close>, (*"[| l is_const; m is_const |] ==> l * n + (m * n + k) =  (l + m) * n + k"*)
  17.252 +       \<^rule_thm>\<open>real_one_collect\<close>, (*"m is_const ==> n + m * n = (1 + m) * n"*)
  17.253 +       \<^rule_thm>\<open>real_one_collect_assoc\<close>, (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  17.254 +  
  17.255 +       \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"), 
  17.256 +       \<^rule_eval>\<open>minus\<close> (**)(eval_binop "#sub_"), 
  17.257 +       \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
  17.258 +       \<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e"),
  17.259 +       \<^rule_eval>\<open>sqrt\<close> (eval_sqrt "#sqrt_"),
  17.260 +       \<^rule_eval>\<open>powr\<close> (**)(eval_binop "#power_")],
  17.261 +    scr = Rule.Empty_Prog});      
  17.262  \<close>
  17.263  rule_set_knowledge expand_rootbinoms = expand_rootbinoms
  17.264  ML \<open>
    18.1 --- a/src/Tools/isac/Knowledge/RootEq.thy	Mon Aug 09 14:20:20 2021 +0200
    18.2 +++ b/src/Tools/isac/Knowledge/RootEq.thy	Tue Aug 10 09:43:07 2021 +0200
    18.3 @@ -176,22 +176,21 @@
    18.4  subsection \<open>rule-sets\<close>
    18.5  ML \<open>
    18.6  val RootEq_prls =(*15.10.02:just the following order due to subterm evaluation*)
    18.7 -  Rule_Set.append_rules "RootEq_prls" Rule_Set.empty 
    18.8 -	     [\<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
    18.9 -	      \<^rule_eval>\<open>Prog_Expr.matches\<close> (Prog_Expr.eval_matches ""),
   18.10 -	      \<^rule_eval>\<open>Prog_Expr.lhs\<close> (Prog_Expr.eval_lhs ""),
   18.11 -	      \<^rule_eval>\<open>Prog_Expr.rhs\<close> (Prog_Expr.eval_rhs ""),
   18.12 -	      \<^rule_eval>\<open>is_sqrtTerm_in\<close> (eval_is_sqrtTerm_in ""),
   18.13 -	      \<^rule_eval>\<open>is_rootTerm_in\<close> (eval_is_rootTerm_in ""),
   18.14 -	      \<^rule_eval>\<open>is_normSqrtTerm_in\<close> (eval_is_normSqrtTerm_in ""),
   18.15 -	      \<^rule_eval>\<open>HOL.eq\<close> (Prog_Expr.eval_equal "#equal_"),
   18.16 -	      \<^rule_thm>\<open>not_true\<close>,
   18.17 -	      \<^rule_thm>\<open>not_false\<close>,
   18.18 -	      \<^rule_thm>\<open>and_true\<close>,
   18.19 -	      \<^rule_thm>\<open>and_false\<close>,
   18.20 -	      \<^rule_thm>\<open>or_true\<close>,
   18.21 -	      \<^rule_thm>\<open>or_false\<close>
   18.22 -	      ];
   18.23 +  Rule_Set.append_rules "RootEq_prls" Rule_Set.empty [
   18.24 +    \<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
   18.25 +    \<^rule_eval>\<open>Prog_Expr.matches\<close> (Prog_Expr.eval_matches ""),
   18.26 +    \<^rule_eval>\<open>Prog_Expr.lhs\<close> (Prog_Expr.eval_lhs ""),
   18.27 +    \<^rule_eval>\<open>Prog_Expr.rhs\<close> (Prog_Expr.eval_rhs ""),
   18.28 +    \<^rule_eval>\<open>is_sqrtTerm_in\<close> (eval_is_sqrtTerm_in ""),
   18.29 +    \<^rule_eval>\<open>is_rootTerm_in\<close> (eval_is_rootTerm_in ""),
   18.30 +    \<^rule_eval>\<open>is_normSqrtTerm_in\<close> (eval_is_normSqrtTerm_in ""),
   18.31 +    \<^rule_eval>\<open>HOL.eq\<close> (Prog_Expr.eval_equal "#equal_"),
   18.32 +    \<^rule_thm>\<open>not_true\<close>,
   18.33 +    \<^rule_thm>\<open>not_false\<close>,
   18.34 +    \<^rule_thm>\<open>and_true\<close>,
   18.35 +    \<^rule_thm>\<open>and_false\<close>,
   18.36 +    \<^rule_thm>\<open>or_true\<close>,
   18.37 +    \<^rule_thm>\<open>or_false\<close>];
   18.38  
   18.39  val RootEq_erls =
   18.40    Rule_Set.append_rules "RootEq_erls" Root_erls
   18.41 @@ -202,8 +201,8 @@
   18.42      [\<^rule_thm>\<open>divide_divide_eq_left\<close>];
   18.43  
   18.44  val rooteq_srls = 
   18.45 -  Rule_Set.append_rules "rooteq_srls" Rule_Set.empty
   18.46 -    [\<^rule_eval>\<open>is_sqrtTerm_in\<close> (eval_is_sqrtTerm_in ""),
   18.47 +  Rule_Set.append_rules "rooteq_srls" Rule_Set.empty [
   18.48 +     \<^rule_eval>\<open>is_sqrtTerm_in\<close> (eval_is_sqrtTerm_in ""),
   18.49       \<^rule_eval>\<open>is_normSqrtTerm_in\<close> (eval_is_normSqrtTerm_in""),
   18.50       \<^rule_eval>\<open>is_rootTerm_in\<close> (eval_is_rootTerm_in "")];
   18.51  \<close>
   18.52 @@ -211,206 +210,128 @@
   18.53  
   18.54  (*isolate the bound variable in an sqrt equation; 'bdv' is a meta-constant*)
   18.55   val sqrt_isolate = prep_rls'(
   18.56 -  Rule_Def.Repeat {id = "sqrt_isolate", preconds = [], rew_ord = ("termlessI",termlessI), 
   18.57 -       erls = RootEq_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
   18.58 -       rules = [
   18.59 -       \<^rule_thm>\<open>sqrt_square_1\<close>,
   18.60 -                     (* (sqrt a) \<up> 2 -> a *)
   18.61 -       \<^rule_thm>\<open>sqrt_square_2\<close>,
   18.62 -                     (* sqrt (a \<up> 2) -> a *)
   18.63 -       \<^rule_thm>\<open>sqrt_times_root_1\<close>,
   18.64 -            (* sqrt a sqrt b -> sqrt(ab) *)
   18.65 -       \<^rule_thm>\<open>sqrt_times_root_2\<close>,
   18.66 -            (* a sqrt b sqrt c -> a sqrt(bc) *)
   18.67 -       \<^rule_thm>\<open>sqrt_square_equation_both_1\<close>,
   18.68 -       (* (sqrt a + sqrt b  = sqrt c + sqrt d) -> 
   18.69 -            (a+2*sqrt(a)*sqrt(b)+b) = c+2*sqrt(c)*sqrt(d)+d) *)
   18.70 -       \<^rule_thm>\<open>sqrt_square_equation_both_2\<close>,
   18.71 -       (* (sqrt a - sqrt b  = sqrt c + sqrt d) -> 
   18.72 -            (a-2*sqrt(a)*sqrt(b)+b) = c+2*sqrt(c)*sqrt(d)+d) *)
   18.73 -       \<^rule_thm>\<open>sqrt_square_equation_both_3\<close>,
   18.74 -       (* (sqrt a + sqrt b  = sqrt c - sqrt d) -> 
   18.75 -            (a+2*sqrt(a)*sqrt(b)+b) = c-2*sqrt(c)*sqrt(d)+d) *)
   18.76 -       \<^rule_thm>\<open>sqrt_square_equation_both_4\<close>,
   18.77 -       (* (sqrt a - sqrt b  = sqrt c - sqrt d) -> 
   18.78 -            (a-2*sqrt(a)*sqrt(b)+b) = c-2*sqrt(c)*sqrt(d)+d) *)
   18.79 -       \<^rule_thm>\<open>sqrt_isolate_l_add1\<close>, 
   18.80 -       (* a+b*sqrt(x)=d -> b*sqrt(x) = d-a *)
   18.81 -       \<^rule_thm>\<open>sqrt_isolate_l_add2\<close>, 
   18.82 -       (* a+  sqrt(x)=d ->   sqrt(x) = d-a *)
   18.83 -       \<^rule_thm>\<open>sqrt_isolate_l_add3\<close>, 
   18.84 -       (* a+b*c/sqrt(x)=d->b*c/sqrt(x)=d-a *)
   18.85 -       \<^rule_thm>\<open>sqrt_isolate_l_add4\<close>, 
   18.86 -       (* a+c/sqrt(x)=d -> c/sqrt(x) = d-a *)
   18.87 -       \<^rule_thm>\<open>sqrt_isolate_l_add5\<close>, 
   18.88 -       (* a+b*c/f*sqrt(x)=d->b*c/f*sqrt(x)=d-a *)
   18.89 -       \<^rule_thm>\<open>sqrt_isolate_l_add6\<close>, 
   18.90 -       (* a+c/f*sqrt(x)=d -> c/f*sqrt(x) = d-a *)
   18.91 -       (*\<^rule_thm>\<open>sqrt_isolate_l_div\<close>,*)
   18.92 -         (* b*sqrt(x) = d sqrt(x) d/b *)
   18.93 -       \<^rule_thm>\<open>sqrt_isolate_r_add1\<close>,
   18.94 -       (* a= d+e*sqrt(x) -> a-d=e*sqrt(x) *)
   18.95 -       \<^rule_thm>\<open>sqrt_isolate_r_add2\<close>,
   18.96 -       (* a= d+  sqrt(x) -> a-d=  sqrt(x) *)
   18.97 -       \<^rule_thm>\<open>sqrt_isolate_r_add3\<close>,
   18.98 -       (* a=d+e*g/sqrt(x)->a-d=e*g/sqrt(x)*)
   18.99 -       \<^rule_thm>\<open>sqrt_isolate_r_add4\<close>,
  18.100 -       (* a= d+g/sqrt(x) -> a-d=g/sqrt(x) *)
  18.101 -       \<^rule_thm>\<open>sqrt_isolate_r_add5\<close>,
  18.102 -       (* a=d+e*g/h*sqrt(x)->a-d=e*g/h*sqrt(x)*)
  18.103 -       \<^rule_thm>\<open>sqrt_isolate_r_add6\<close>,
  18.104 -       (* a= d+g/h*sqrt(x) -> a-d=g/h*sqrt(x) *)
  18.105 -       (*\<^rule_thm>\<open>sqrt_isolate_r_div\<close>,*)
  18.106 -         (* a=e*sqrt(x) -> a/e = sqrt(x) *)
  18.107 -       \<^rule_thm>\<open>sqrt_square_equation_left_1\<close>,   
  18.108 -       (* sqrt(x)=b -> x=b^2 *)
  18.109 -       \<^rule_thm>\<open>sqrt_square_equation_left_2\<close>,   
  18.110 -       (* c*sqrt(x)=b -> c^2*x=b^2 *)
  18.111 -       \<^rule_thm>\<open>sqrt_square_equation_left_3\<close>,  
  18.112 -	      (* c/sqrt(x)=b -> c^2/x=b^2 *)
  18.113 -       \<^rule_thm>\<open>sqrt_square_equation_left_4\<close>,
  18.114 -	      (* c*d/sqrt(x)=b -> c^2*d^2/x=b^2 *)
  18.115 -       \<^rule_thm>\<open>sqrt_square_equation_left_5\<close>,
  18.116 -	      (* c/d*sqrt(x)=b -> c^2/d^2x=b^2 *)
  18.117 -       \<^rule_thm>\<open>sqrt_square_equation_left_6\<close>,
  18.118 -	      (* c*d/g*sqrt(x)=b -> c^2*d^2/g^2x=b^2 *)
  18.119 -       \<^rule_thm>\<open>sqrt_square_equation_right_1\<close>,
  18.120 -	      (* a=sqrt(x) ->a^2=x *)
  18.121 -       \<^rule_thm>\<open>sqrt_square_equation_right_2\<close>,
  18.122 -	      (* a=c*sqrt(x) ->a^2=c^2*x *)
  18.123 -       \<^rule_thm>\<open>sqrt_square_equation_right_3\<close>,
  18.124 -	      (* a=c/sqrt(x) ->a^2=c^2/x *)
  18.125 -       \<^rule_thm>\<open>sqrt_square_equation_right_4\<close>,
  18.126 -	      (* a=c*d/sqrt(x) ->a^2=c^2*d^2/x *)
  18.127 -       \<^rule_thm>\<open>sqrt_square_equation_right_5\<close>,
  18.128 -	      (* a=c/e*sqrt(x) ->a^2=c^2/e^2x *)
  18.129 -       \<^rule_thm>\<open>sqrt_square_equation_right_6\<close>
  18.130 -	      (* a=c*d/g*sqrt(x) ->a^2=c^2*d^2/g^2*x *)
  18.131 -       ],scr = Rule.Empty_Prog
  18.132 -      });
  18.133 +  Rule_Def.Repeat {
  18.134 +    id = "sqrt_isolate", preconds = [], rew_ord = ("termlessI",termlessI), 
  18.135 +    erls = RootEq_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  18.136 +    rules = [
  18.137 +       \<^rule_thm>\<open>sqrt_square_1\<close>, (* (sqrt a) \<up> 2 -> a *)
  18.138 +       \<^rule_thm>\<open>sqrt_square_2\<close>, (* sqrt (a \<up> 2) -> a *)
  18.139 +       \<^rule_thm>\<open>sqrt_times_root_1\<close>, (* sqrt a sqrt b -> sqrt(ab) *)
  18.140 +       \<^rule_thm>\<open>sqrt_times_root_2\<close>, (* a sqrt b sqrt c -> a sqrt(bc) *)
  18.141 +       \<^rule_thm>\<open>sqrt_square_equation_both_1\<close>, (* (sqrt a + sqrt b  = sqrt c + sqrt d) -> 
  18.142 +          (a+2*sqrt(a)*sqrt(b)+b) = c+2*sqrt(c)*sqrt(d)+d) *)
  18.143 +       \<^rule_thm>\<open>sqrt_square_equation_both_2\<close>, (* (sqrt a - sqrt b  = sqrt c + sqrt d) -> 
  18.144 +          (a-2*sqrt(a)*sqrt(b)+b) = c+2*sqrt(c)*sqrt(d)+d) *)
  18.145 +       \<^rule_thm>\<open>sqrt_square_equation_both_3\<close>, (* (sqrt a + sqrt b  = sqrt c - sqrt d) -> 
  18.146 +          (a+2*sqrt(a)*sqrt(b)+b) = c-2*sqrt(c)*sqrt(d)+d) *)
  18.147 +       \<^rule_thm>\<open>sqrt_square_equation_both_4\<close>, (* (sqrt a - sqrt b  = sqrt c - sqrt d) -> 
  18.148 +          (a-2*sqrt(a)*sqrt(b)+b) = c-2*sqrt(c)*sqrt(d)+d) *)
  18.149 +       \<^rule_thm>\<open>sqrt_isolate_l_add1\<close>, (* a+b*sqrt(x)=d -> b*sqrt(x) = d-a *)
  18.150 +       \<^rule_thm>\<open>sqrt_isolate_l_add2\<close>, (* a+  sqrt(x)=d ->   sqrt(x) = d-a *)
  18.151 +       \<^rule_thm>\<open>sqrt_isolate_l_add3\<close>, (* a+b*c/sqrt(x)=d->b*c/sqrt(x)=d-a *)
  18.152 +       \<^rule_thm>\<open>sqrt_isolate_l_add4\<close>, (* a+c/sqrt(x)=d -> c/sqrt(x) = d-a *)
  18.153 +       \<^rule_thm>\<open>sqrt_isolate_l_add5\<close>, (* a+b*c/f*sqrt(x)=d->b*c/f*sqrt(x)=d-a *)
  18.154 +       \<^rule_thm>\<open>sqrt_isolate_l_add6\<close>, (* a+c/f*sqrt(x)=d -> c/f*sqrt(x) = d-a *)
  18.155 +       (*
  18.156 +       \<^rule_thm>\<open>sqrt_isolate_l_div\<close>, (* b*sqrt(x) = d sqrt(x) d/b *)*)
  18.157 +       \<^rule_thm>\<open>sqrt_isolate_r_add1\<close>, (* a= d+e*sqrt(x) -> a-d=e*sqrt(x) *)
  18.158 +       \<^rule_thm>\<open>sqrt_isolate_r_add2\<close>, (* a= d+  sqrt(x) -> a-d=  sqrt(x) *)
  18.159 +       \<^rule_thm>\<open>sqrt_isolate_r_add3\<close>, (* a=d+e*g/sqrt(x)->a-d=e*g/sqrt(x)*)
  18.160 +       \<^rule_thm>\<open>sqrt_isolate_r_add4\<close>, (* a= d+g/sqrt(x) -> a-d=g/sqrt(x) *)
  18.161 +       \<^rule_thm>\<open>sqrt_isolate_r_add5\<close>, (* a=d+e*g/h*sqrt(x)->a-d=e*g/h*sqrt(x)*)
  18.162 +       \<^rule_thm>\<open>sqrt_isolate_r_add6\<close>, (* a= d+g/h*sqrt(x) -> a-d=g/h*sqrt(x) *)
  18.163 +       (*
  18.164 +       \<^rule_thm>\<open>sqrt_isolate_r_div\<close>, (* a=e*sqrt(x) -> a/e = sqrt(x) *)*)
  18.165 +       \<^rule_thm>\<open>sqrt_square_equation_left_1\<close>, (* sqrt(x)=b -> x=b^2 *)
  18.166 +       \<^rule_thm>\<open>sqrt_square_equation_left_2\<close>, (* c*sqrt(x)=b -> c^2*x=b^2 *)
  18.167 +       \<^rule_thm>\<open>sqrt_square_equation_left_3\<close>, (* c/sqrt(x)=b -> c^2/x=b^2 *)
  18.168 +       \<^rule_thm>\<open>sqrt_square_equation_left_4\<close>, (* c*d/sqrt(x)=b -> c^2*d^2/x=b^2 *)
  18.169 +       \<^rule_thm>\<open>sqrt_square_equation_left_5\<close>, (* c/d*sqrt(x)=b -> c^2/d^2x=b^2 *)
  18.170 +       \<^rule_thm>\<open>sqrt_square_equation_left_6\<close>, (* c*d/g*sqrt(x)=b -> c^2*d^2/g^2x=b^2 *)
  18.171 +       \<^rule_thm>\<open>sqrt_square_equation_right_1\<close>, (* a=sqrt(x) ->a^2=x *)
  18.172 +       \<^rule_thm>\<open>sqrt_square_equation_right_2\<close>, (* a=c*sqrt(x) ->a^2=c^2*x *)
  18.173 +       \<^rule_thm>\<open>sqrt_square_equation_right_3\<close>, (* a=c/sqrt(x) ->a^2=c^2/x *)
  18.174 +       \<^rule_thm>\<open>sqrt_square_equation_right_4\<close>, (* a=c*d/sqrt(x) ->a^2=c^2*d^2/x *)
  18.175 +       \<^rule_thm>\<open>sqrt_square_equation_right_5\<close>, (* a=c/e*sqrt(x) ->a^2=c^2/e^2x *)
  18.176 +       \<^rule_thm>\<open>sqrt_square_equation_right_6\<close>], (* a=c*d/g*sqrt(x) ->a^2=c^2*d^2/g^2*x *)
  18.177 +    scr = Rule.Empty_Prog});
  18.178  
  18.179  \<close> ML \<open>
  18.180  (*isolate the bound variable in an sqrt left equation; 'bdv' is a meta-constant*)
  18.181 - val l_sqrt_isolate = prep_rls'(
  18.182 -     Rule_Def.Repeat {id = "l_sqrt_isolate", preconds = [], 
  18.183 -	  rew_ord = ("termlessI",termlessI), 
  18.184 -          erls = RootEq_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  18.185 -     rules = [
  18.186 -     \<^rule_thm>\<open>sqrt_square_1\<close>,
  18.187 -                            (* (sqrt a) \<up> 2 -> a *)
  18.188 -     \<^rule_thm>\<open>sqrt_square_2\<close>,
  18.189 -                            (* sqrt (a \<up> 2) -> a *)
  18.190 -     \<^rule_thm>\<open>sqrt_times_root_1\<close>,
  18.191 -            (* sqrt a sqrt b -> sqrt(ab) *)
  18.192 -     \<^rule_thm>\<open>sqrt_times_root_2\<close>,
  18.193 -        (* a sqrt b sqrt c -> a sqrt(bc) *)
  18.194 -     \<^rule_thm>\<open>sqrt_isolate_l_add1\<close>,
  18.195 -        (* a+b*sqrt(x)=d -> b*sqrt(x) = d-a *)
  18.196 -     \<^rule_thm>\<open>sqrt_isolate_l_add2\<close>,
  18.197 -        (* a+  sqrt(x)=d ->   sqrt(x) = d-a *)
  18.198 -     \<^rule_thm>\<open>sqrt_isolate_l_add3\<close>,
  18.199 -        (* a+b*c/sqrt(x)=d->b*c/sqrt(x)=d-a *)
  18.200 -     \<^rule_thm>\<open>sqrt_isolate_l_add4\<close>,
  18.201 -        (* a+c/sqrt(x)=d -> c/sqrt(x) = d-a *)
  18.202 -     \<^rule_thm>\<open>sqrt_isolate_l_add5\<close>,
  18.203 -        (* a+b*c/f*sqrt(x)=d->b*c/f*sqrt(x)=d-a *)
  18.204 -     \<^rule_thm>\<open>sqrt_isolate_l_add6\<close>,
  18.205 -        (* a+c/f*sqrt(x)=d -> c/f*sqrt(x) = d-a *)
  18.206 -   (*\<^rule_thm>\<open>sqrt_isolate_l_div\<close>,*)
  18.207 -        (* b*sqrt(x) = d sqrt(x) d/b *)
  18.208 -     \<^rule_thm>\<open>sqrt_square_equation_left_1\<close>,
  18.209 -	      (* sqrt(x)=b -> x=b^2 *)
  18.210 -     \<^rule_thm>\<open>sqrt_square_equation_left_2\<close>,
  18.211 -	      (* a*sqrt(x)=b -> a^2*x=b^2*)
  18.212 -     \<^rule_thm>\<open>sqrt_square_equation_left_3\<close>,   
  18.213 -	      (* c/sqrt(x)=b -> c^2/x=b^2 *)
  18.214 -     \<^rule_thm>\<open>sqrt_square_equation_left_4\<close>,   
  18.215 -	      (* c*d/sqrt(x)=b -> c^2*d^2/x=b^2 *)
  18.216 -     \<^rule_thm>\<open>sqrt_square_equation_left_5\<close>,   
  18.217 -	      (* c/d*sqrt(x)=b -> c^2/d^2x=b^2 *)
  18.218 -     \<^rule_thm>\<open>sqrt_square_equation_left_6\<close>  
  18.219 -	      (* c*d/g*sqrt(x)=b -> c^2*d^2/g^2x=b^2 *)
  18.220 -    ],
  18.221 -    scr = Rule.Empty_Prog
  18.222 -   });
  18.223 +val l_sqrt_isolate = prep_rls'(
  18.224 +  Rule_Def.Repeat {
  18.225 +  id = "l_sqrt_isolate", preconds = [], rew_ord = ("termlessI",termlessI), 
  18.226 +  erls = RootEq_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  18.227 +  rules = [
  18.228 +     \<^rule_thm>\<open>sqrt_square_1\<close>, (* (sqrt a) \<up> 2 -> a *)
  18.229 +     \<^rule_thm>\<open>sqrt_square_2\<close>, (* sqrt (a \<up> 2) -> a *)
  18.230 +     \<^rule_thm>\<open>sqrt_times_root_1\<close>, (* sqrt a sqrt b -> sqrt(ab) *)
  18.231 +     \<^rule_thm>\<open>sqrt_times_root_2\<close>, (* a sqrt b sqrt c -> a sqrt(bc) *)
  18.232 +     \<^rule_thm>\<open>sqrt_isolate_l_add1\<close>, (* a+b*sqrt(x)=d -> b*sqrt(x) = d-a *)
  18.233 +     \<^rule_thm>\<open>sqrt_isolate_l_add2\<close>, (* a+  sqrt(x)=d ->   sqrt(x) = d-a *)
  18.234 +     \<^rule_thm>\<open>sqrt_isolate_l_add3\<close>, (* a+b*c/sqrt(x)=d->b*c/sqrt(x)=d-a *)
  18.235 +     \<^rule_thm>\<open>sqrt_isolate_l_add4\<close>, (* a+c/sqrt(x)=d -> c/sqrt(x) = d-a *)
  18.236 +     \<^rule_thm>\<open>sqrt_isolate_l_add5\<close>, (* a+b*c/f*sqrt(x)=d->b*c/f*sqrt(x)=d-a *)
  18.237 +     \<^rule_thm>\<open>sqrt_isolate_l_add6\<close>, (* a+c/f*sqrt(x)=d -> c/f*sqrt(x) = d-a *)
  18.238 +     (*
  18.239 +     \<^rule_thm>\<open>sqrt_isolate_l_div\<close>, (* b*sqrt(x) = d sqrt(x) d/b *)*)
  18.240 +     \<^rule_thm>\<open>sqrt_square_equation_left_1\<close>, (* sqrt(x)=b -> x=b^2 *)
  18.241 +     \<^rule_thm>\<open>sqrt_square_equation_left_2\<close>, (* a*sqrt(x)=b -> a^2*x=b^2*)
  18.242 +     \<^rule_thm>\<open>sqrt_square_equation_left_3\<close>, (* c/sqrt(x)=b -> c^2/x=b^2 *)
  18.243 +     \<^rule_thm>\<open>sqrt_square_equation_left_4\<close>, (* c*d/sqrt(x)=b -> c^2*d^2/x=b^2 *)
  18.244 +     \<^rule_thm>\<open>sqrt_square_equation_left_5\<close>, (* c/d*sqrt(x)=b -> c^2/d^2x=b^2 *)
  18.245 +     \<^rule_thm>\<open>sqrt_square_equation_left_6\<close>], (* c*d/g*sqrt(x)=b -> c^2*d^2/g^2x=b^2 *)
  18.246 +  scr = Rule.Empty_Prog});
  18.247  
  18.248  \<close> ML \<open>
  18.249  (* -- right 28.8.02--*)
  18.250  (*isolate the bound variable in an sqrt right equation; 'bdv' is a meta-constant*)
  18.251 - val r_sqrt_isolate = prep_rls'(
  18.252 -     Rule_Def.Repeat {id = "r_sqrt_isolate", preconds = [], 
  18.253 -	  rew_ord = ("termlessI",termlessI), 
  18.254 -          erls = RootEq_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  18.255 -     rules = [
  18.256 -     \<^rule_thm>\<open>sqrt_square_1\<close>,
  18.257 -                           (* (sqrt a) \<up> 2 -> a *)
  18.258 -     \<^rule_thm>\<open>sqrt_square_2\<close>, 
  18.259 -                           (* sqrt (a \<up> 2) -> a *)
  18.260 -     \<^rule_thm>\<open>sqrt_times_root_1\<close>,
  18.261 -           (* sqrt a sqrt b -> sqrt(ab) *)
  18.262 -     \<^rule_thm>\<open>sqrt_times_root_2\<close>,
  18.263 -       (* a sqrt b sqrt c -> a sqrt(bc) *)
  18.264 -     \<^rule_thm>\<open>sqrt_isolate_r_add1\<close>,
  18.265 -       (* a= d+e*sqrt(x) -> a-d=e*sqrt(x) *)
  18.266 -     \<^rule_thm>\<open>sqrt_isolate_r_add2\<close>,
  18.267 -       (* a= d+  sqrt(x) -> a-d=  sqrt(x) *)
  18.268 -     \<^rule_thm>\<open>sqrt_isolate_r_add3\<close>,
  18.269 -       (* a=d+e*g/sqrt(x)->a-d=e*g/sqrt(x)*)
  18.270 -     \<^rule_thm>\<open>sqrt_isolate_r_add4\<close>,
  18.271 -       (* a= d+g/sqrt(x) -> a-d=g/sqrt(x) *)
  18.272 -     \<^rule_thm>\<open>sqrt_isolate_r_add5\<close>,
  18.273 -       (* a=d+e*g/h*sqrt(x)->a-d=e*g/h*sqrt(x)*)
  18.274 -     \<^rule_thm>\<open>sqrt_isolate_r_add6\<close>,
  18.275 -       (* a= d+g/h*sqrt(x) -> a-d=g/h*sqrt(x) *)
  18.276 -   (*\<^rule_thm>\<open>sqrt_isolate_r_div\<close>,*)
  18.277 -       (* a=e*sqrt(x) -> a/e = sqrt(x) *)
  18.278 -     \<^rule_thm>\<open>sqrt_square_equation_right_1\<close>,
  18.279 -	      (* a=sqrt(x) ->a^2=x *)
  18.280 -     \<^rule_thm>\<open>sqrt_square_equation_right_2\<close>,
  18.281 -	      (* a=c*sqrt(x) ->a^2=c^2*x *)
  18.282 -     \<^rule_thm>\<open>sqrt_square_equation_right_3\<close>,
  18.283 -	      (* a=c/sqrt(x) ->a^2=c^2/x *)
  18.284 -     \<^rule_thm>\<open>sqrt_square_equation_right_4\<close>, 
  18.285 -	      (* a=c*d/sqrt(x) ->a^2=c^2*d^2/x *)
  18.286 -     \<^rule_thm>\<open>sqrt_square_equation_right_5\<close>,
  18.287 -	      (* a=c/e*sqrt(x) ->a^2=c^2/e^2x *)
  18.288 -     \<^rule_thm>\<open>sqrt_square_equation_right_6\<close>
  18.289 -	      (* a=c*d/g*sqrt(x) ->a^2=c^2*d^2/g^2*x *)
  18.290 -    ],
  18.291 -    scr = Rule.Empty_Prog
  18.292 -   });
  18.293 +val r_sqrt_isolate = prep_rls'(
  18.294 +   Rule_Def.Repeat {id = "r_sqrt_isolate", preconds = [], rew_ord = ("termlessI",termlessI), 
  18.295 +   erls = RootEq_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  18.296 +   rules = [
  18.297 +     \<^rule_thm>\<open>sqrt_square_1\<close>, (* (sqrt a) \<up> 2 -> a *)
  18.298 +     \<^rule_thm>\<open>sqrt_square_2\<close>, (* sqrt (a \<up> 2) -> a *)
  18.299 +     \<^rule_thm>\<open>sqrt_times_root_1\<close>, (* sqrt a sqrt b -> sqrt(ab) *)
  18.300 +     \<^rule_thm>\<open>sqrt_times_root_2\<close>, (* a sqrt b sqrt c -> a sqrt(bc) *)
  18.301 +     \<^rule_thm>\<open>sqrt_isolate_r_add1\<close>, (* a= d+e*sqrt(x) -> a-d=e*sqrt(x) *)
  18.302 +     \<^rule_thm>\<open>sqrt_isolate_r_add2\<close>, (* a= d+  sqrt(x) -> a-d=  sqrt(x) *)
  18.303 +     \<^rule_thm>\<open>sqrt_isolate_r_add3\<close>, (* a=d+e*g/sqrt(x)->a-d=e*g/sqrt(x)*)
  18.304 +     \<^rule_thm>\<open>sqrt_isolate_r_add4\<close>, (* a= d+g/sqrt(x) -> a-d=g/sqrt(x) *)
  18.305 +     \<^rule_thm>\<open>sqrt_isolate_r_add5\<close>, (* a=d+e*g/h*sqrt(x)->a-d=e*g/h*sqrt(x)*)
  18.306 +     \<^rule_thm>\<open>sqrt_isolate_r_add6\<close>, (* a= d+g/h*sqrt(x) -> a-d=g/h*sqrt(x) *)
  18.307 +      (*
  18.308 +     \<^rule_thm>\<open>sqrt_isolate_r_div\<close>, (* a=e*sqrt(x) -> a/e = sqrt(x) *)*)
  18.309 +     \<^rule_thm>\<open>sqrt_square_equation_right_1\<close>, (* a=sqrt(x) ->a^2=x *)
  18.310 +     \<^rule_thm>\<open>sqrt_square_equation_right_2\<close>, (* a=c*sqrt(x) ->a^2=c^2*x *)
  18.311 +     \<^rule_thm>\<open>sqrt_square_equation_right_3\<close>, (* a=c/sqrt(x) ->a^2=c^2/x *)
  18.312 +     \<^rule_thm>\<open>sqrt_square_equation_right_4\<close>, (* a=c*d/sqrt(x) ->a^2=c^2*d^2/x *)
  18.313 +     \<^rule_thm>\<open>sqrt_square_equation_right_5\<close>, (* a=c/e*sqrt(x) ->a^2=c^2/e^2x *)
  18.314 +     \<^rule_thm>\<open>sqrt_square_equation_right_6\<close>], (* a=c*d/g*sqrt(x) ->a^2=c^2*d^2/g^2*x *)
  18.315 +   scr = Rule.Empty_Prog});
  18.316  
  18.317  \<close> ML \<open>
  18.318  val rooteq_simplify = prep_rls'(
  18.319 -  Rule_Def.Repeat {id = "rooteq_simplify", 
  18.320 -       preconds = [], rew_ord = ("termlessI",termlessI), 
  18.321 -       erls = RootEq_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  18.322 -       (*asm_thm = [("sqrt_square_1", "")],*)
  18.323 -       rules = [\<^rule_thm>\<open>real_assoc_1\<close>,
  18.324 -                             (* a+(b+c) = a+b+c *)
  18.325 -                \<^rule_thm>\<open>real_assoc_2\<close>,
  18.326 -                             (* a*(b*c) = a*b*c *)
  18.327 -                \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
  18.328 -                \<^rule_eval>\<open>minus\<close> (**)(eval_binop "#sub_"),
  18.329 -                \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
  18.330 -                \<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e"),
  18.331 -                \<^rule_eval>\<open>sqrt\<close> (eval_sqrt "#sqrt_"),
  18.332 -                \<^rule_eval>\<open>powr\<close> (**)(eval_binop "#power_"),
  18.333 -                \<^rule_thm>\<open>real_plus_binom_pow2\<close>,
  18.334 -                \<^rule_thm>\<open>real_minus_binom_pow2\<close>,
  18.335 -                \<^rule_thm>\<open>realpow_mul\<close>,    
  18.336 -                     (* (a * b)^n = a^n * b^n*)
  18.337 -                \<^rule_thm>\<open>sqrt_times_root_1\<close>, 
  18.338 -                     (* sqrt b * sqrt c = sqrt(b*c) *)
  18.339 -                \<^rule_thm>\<open>sqrt_times_root_2\<close>,
  18.340 -                     (* a * sqrt a * sqrt b = a * sqrt(a*b) *)
  18.341 -                \<^rule_thm>\<open>sqrt_square_2\<close>,
  18.342 -                            (* sqrt (a \<up> 2) = a *)
  18.343 -                \<^rule_thm>\<open>sqrt_square_1\<close> 
  18.344 -                            (* sqrt a  \<up>  2 = a *)
  18.345 -                ],
  18.346 -       scr = Rule.Empty_Prog
  18.347 -    });
  18.348 +  Rule_Def.Repeat {
  18.349 +    id = "rooteq_simplify", preconds = [], rew_ord = ("termlessI",termlessI), 
  18.350 +    erls = RootEq_erls, srls = Rule_Set.Empty, calc = [], errpatts = [],
  18.351 +    rules = [
  18.352 +      \<^rule_thm>\<open>real_assoc_1\<close>, (* a+(b+c) = a+b+c *)
  18.353 +      \<^rule_thm>\<open>real_assoc_2\<close>, (* a*(b*c) = a*b*c *)
  18.354 +      \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
  18.355 +      \<^rule_eval>\<open>minus\<close> (**)(eval_binop "#sub_"),
  18.356 +      \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
  18.357 +      \<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e"),
  18.358 +      \<^rule_eval>\<open>sqrt\<close> (eval_sqrt "#sqrt_"),
  18.359 +      \<^rule_eval>\<open>powr\<close> (**)(eval_binop "#power_"),
  18.360 +      \<^rule_thm>\<open>real_plus_binom_pow2\<close>,
  18.361 +      \<^rule_thm>\<open>real_minus_binom_pow2\<close>,
  18.362 +      \<^rule_thm>\<open>realpow_mul\<close>, (* (a * b)^n = a^n * b^n*)
  18.363 +      \<^rule_thm>\<open>sqrt_times_root_1\<close>, (* sqrt b * sqrt c = sqrt(b*c) *)
  18.364 +      \<^rule_thm>\<open>sqrt_times_root_2\<close>, (* a * sqrt a * sqrt b = a * sqrt(a*b) *)
  18.365 +      \<^rule_thm>\<open>sqrt_square_2\<close>, (* sqrt (a \<up> 2) = a *)
  18.366 +      \<^rule_thm>\<open>sqrt_square_1\<close>], (* sqrt a  \<up>  2 = a *)
  18.367 +    scr = Rule.Empty_Prog});
  18.368  \<close>
  18.369  rule_set_knowledge
  18.370    RootEq_erls = RootEq_erls and
    19.1 --- a/src/Tools/isac/Knowledge/RootRatEq.thy	Mon Aug 09 14:20:20 2021 +0200
    19.2 +++ b/src/Tools/isac/Knowledge/RootRatEq.thy	Tue Aug 10 09:43:07 2021 +0200
    19.3 @@ -66,8 +66,8 @@
    19.4  subsection \<open>rule-sets\<close>
    19.5  ML \<open>
    19.6  val RootRatEq_prls = 
    19.7 -  Rule_Set.append_rules "RootRatEq_prls" Rule_Set.empty
    19.8 -		[\<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
    19.9 +  Rule_Set.append_rules "RootRatEq_prls" Rule_Set.empty [
   19.10 +     \<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_"),
   19.11       \<^rule_eval>\<open>Prog_Expr.matches\<close> (Prog_Expr.eval_matches ""),
   19.12       \<^rule_eval>\<open>Prog_Expr.lhs\<close> (Prog_Expr.eval_lhs ""),
   19.13       \<^rule_eval>\<open>Prog_Expr.rhs\<close> (Prog_Expr.eval_rhs ""),
   19.14 @@ -97,21 +97,15 @@
   19.15  \<close> ML \<open>
   19.16  (* Solves a rootrat Equation *)
   19.17  val rootrat_solve = prep_rls'(
   19.18 -  Rule_Def.Repeat {id = "rootrat_solve", preconds = [], 
   19.19 -  rew_ord = ("termlessI",termlessI), 
   19.20 +  Rule_Def.Repeat {
   19.21 +    id = "rootrat_solve", preconds = [], rew_ord = ("termlessI",termlessI), 
   19.22      erls = Rule_Set.empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
   19.23 -    rules = 
   19.24 -    [\<^rule_thm>\<open>rootrat_equation_left_1\<close>,   
   19.25 -        (* [|c is_rootTerm_in bdv|] ==> 
   19.26 -                                   ( (a + b/c = d) = ( b = (d - a) * c )) *)
   19.27 -     \<^rule_thm>\<open>rootrat_equation_left_2\<close>,
   19.28 -        (* [|c is_rootTerm_in bdv|] ==> ( (b/c = d) = ( b = d * c )) *)
   19.29 -     \<^rule_thm>\<open>rootrat_equation_right_1\<close>,
   19.30 -	(* [|f is_rootTerm_in bdv|] ==> 
   19.31 -                                   ( (a = d + e/f) = ( (a - d) * f = e )) *)
   19.32 -     \<^rule_thm>\<open>rootrat_equation_right_2\<close>
   19.33 -	(* [|f is_rootTerm_in bdv|] ==> ( (a =  e/f) = ( a  * f = e ))*)
   19.34 -     ], scr = Rule.Empty_Prog});
   19.35 +    rules = [
   19.36 +      \<^rule_thm>\<open>rootrat_equation_left_1\<close>, (* [|c is_rootTerm_in bdv|] ==> ( (a + b/c = d) = ( b = (d - a) * c )) *)
   19.37 +      \<^rule_thm>\<open>rootrat_equation_left_2\<close>, (* [|c is_rootTerm_in bdv|] ==> ( (b/c = d) = ( b = d * c )) *)
   19.38 +      \<^rule_thm>\<open>rootrat_equation_right_1\<close>, (* [|f is_rootTerm_in bdv|] ==> ( (a = d + e/f) = ( (a - d) * f = e )) *)
   19.39 +      \<^rule_thm>\<open>rootrat_equation_right_2\<close>], (* [|f is_rootTerm_in bdv|] ==> ( (a =  e/f) = ( a  * f = e ))*)
   19.40 +    scr = Rule.Empty_Prog});
   19.41  \<close>
   19.42  rule_set_knowledge
   19.43    RooRatEq_erls = RooRatEq_erls and
    20.1 --- a/src/Tools/isac/Knowledge/Test.thy	Mon Aug 09 14:20:20 2021 +0200
    20.2 +++ b/src/Tools/isac/Knowledge/Test.thy	Tue Aug 10 09:43:07 2021 +0200
    20.3 @@ -360,199 +360,195 @@
    20.4  ML \<open>
    20.5  val testerls = 
    20.6    Rule_Def.Repeat {id = "testerls", preconds = [], rew_ord = ("termlessI",termlessI), 
    20.7 -      erls = Rule_Set.empty, srls = Rule_Set.Empty, 
    20.8 -      calc = [], errpatts = [], 
    20.9 -      rules = [\<^rule_thm>\<open>refl\<close>,
   20.10 -	       \<^rule_thm>\<open>order_refl\<close>,
   20.11 -	       \<^rule_thm>\<open>radd_left_cancel_le\<close>,
   20.12 -	       \<^rule_thm>\<open>not_true\<close>,
   20.13 -	       \<^rule_thm>\<open>not_false\<close>,
   20.14 -	       \<^rule_thm>\<open>and_true\<close>,
   20.15 -	       \<^rule_thm>\<open>and_false\<close>,
   20.16 -	       \<^rule_thm>\<open>or_true\<close>,
   20.17 -	       \<^rule_thm>\<open>or_false\<close>,
   20.18 -	       \<^rule_thm>\<open>and_commute\<close>,
   20.19 -	       \<^rule_thm>\<open>or_commute\<close>,
   20.20 -
   20.21 -	       \<^rule_eval>\<open>Prog_Expr.is_const\<close> (Prog_Expr.eval_const "#is_const_"),
   20.22 -	       \<^rule_eval>\<open>Prog_Expr.matches\<close> (Prog_Expr.eval_matches ""),
   20.23 -
   20.24 -	       \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
   20.25 -	       \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
   20.26 -	       \<^rule_eval>\<open>powr\<close> (**)(eval_binop "#power_"),
   20.27 -
   20.28 -	       \<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"),
   20.29 -	       \<^rule_eval>\<open>less_eq\<close> (Prog_Expr.eval_equ "#less_equal_"),
   20.30 -
   20.31 -	       \<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_")],
   20.32 -      scr = Rule.Empty_Prog
   20.33 -      };      
   20.34 +    erls = Rule_Set.empty, srls = Rule_Set.Empty, 
   20.35 +    calc = [], errpatts = [], 
   20.36 +    rules = [
   20.37 +       \<^rule_thm>\<open>refl\<close>,
   20.38 +	     \<^rule_thm>\<open>order_refl\<close>,
   20.39 +	     \<^rule_thm>\<open>radd_left_cancel_le\<close>,
   20.40 +	     \<^rule_thm>\<open>not_true\<close>,
   20.41 +	     \<^rule_thm>\<open>not_false\<close>,
   20.42 +	     \<^rule_thm>\<open>and_true\<close>,
   20.43 +	     \<^rule_thm>\<open>and_false\<close>,
   20.44 +	     \<^rule_thm>\<open>or_true\<close>,
   20.45 +	     \<^rule_thm>\<open>or_false\<close>,
   20.46 +	     \<^rule_thm>\<open>and_commute\<close>,
   20.47 +	     \<^rule_thm>\<open>or_commute\<close>,
   20.48 +    
   20.49 +	     \<^rule_eval>\<open>Prog_Expr.is_const\<close> (Prog_Expr.eval_const "#is_const_"),
   20.50 +	     \<^rule_eval>\<open>Prog_Expr.matches\<close> (Prog_Expr.eval_matches ""),
   20.51 +    
   20.52 +	     \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
   20.53 +	     \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
   20.54 +	     \<^rule_eval>\<open>powr\<close> (**)(eval_binop "#power_"),
   20.55 +    
   20.56 +	     \<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"),
   20.57 +	     \<^rule_eval>\<open>less_eq\<close> (Prog_Expr.eval_equ "#less_equal_"),
   20.58 +    
   20.59 +	     \<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_")],
   20.60 +    scr = Rule.Empty_Prog};      
   20.61  \<close>
   20.62  ML \<open>
   20.63  (*.for evaluation of conditions in rewrite rules.*)
   20.64  (*FIXXXXXXME 10.8.02: handle like _simplify*)
   20.65  val tval_rls =  
   20.66    Rule_Def.Repeat{id = "tval_rls", preconds = [], 
   20.67 -      rew_ord = ("sqrt_right",sqrt_right false @{theory "Pure"}), 
   20.68 -      erls=testerls,srls = Rule_Set.empty, 
   20.69 -      calc=[], errpatts = [],
   20.70 -      rules = [\<^rule_thm>\<open>refl\<close>,
   20.71 -	       \<^rule_thm>\<open>order_refl\<close>,
   20.72 -	       \<^rule_thm>\<open>radd_left_cancel_le\<close>,
   20.73 -	       \<^rule_thm>\<open>not_true\<close>,
   20.74 -	       \<^rule_thm>\<open>not_false\<close>,
   20.75 -	       \<^rule_thm>\<open>and_true\<close>,
   20.76 -	       \<^rule_thm>\<open>and_false\<close>,
   20.77 -	       \<^rule_thm>\<open>or_true\<close>,
   20.78 -	       \<^rule_thm>\<open>or_false\<close>,
   20.79 -	       \<^rule_thm>\<open>and_commute\<close>,
   20.80 -	       \<^rule_thm>\<open>or_commute\<close>,
   20.81 -
   20.82 -	       \<^rule_thm>\<open>real_diff_minus\<close>,
   20.83 -
   20.84 -	       \<^rule_thm>\<open>root_ge0\<close>,
   20.85 -	       \<^rule_thm>\<open>root_add_ge0\<close>,
   20.86 -	       \<^rule_thm>\<open>root_ge0_1\<close>,
   20.87 -	       \<^rule_thm>\<open>root_ge0_2\<close>,
   20.88 -
   20.89 -	       \<^rule_eval>\<open>Prog_Expr.is_const\<close> (Prog_Expr.eval_const "#is_const_"),
   20.90 -	       \<^rule_eval>\<open>contains_root\<close> (eval_contains_root "#eval_contains_root"),
   20.91 -	       \<^rule_eval>\<open>Prog_Expr.matches\<close> (Prog_Expr.eval_matches ""),
   20.92 -	       \<^rule_eval>\<open>contains_root\<close> (eval_contains_root"#contains_root_"),
   20.93 -
   20.94 -	       \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
   20.95 -	       \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
   20.96 -	       \<^rule_eval>\<open>sqrt\<close> (eval_sqrt "#sqrt_"),
   20.97 -	       \<^rule_eval>\<open>powr\<close> (**)(eval_binop "#power_"),
   20.98 -
   20.99 -	       \<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"),
  20.100 -	       \<^rule_eval>\<open>less_eq\<close> (Prog_Expr.eval_equ "#less_equal_"),
  20.101 -
  20.102 -	       \<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_")],
  20.103 -      scr = Rule.Empty_Prog
  20.104 -      };      
  20.105 +    rew_ord = ("sqrt_right",sqrt_right false @{theory "Pure"}), 
  20.106 +    erls=testerls,srls = Rule_Set.empty, 
  20.107 +    calc=[], errpatts = [],
  20.108 +    rules = [
  20.109 +       \<^rule_thm>\<open>refl\<close>,
  20.110 +	     \<^rule_thm>\<open>order_refl\<close>,
  20.111 +	     \<^rule_thm>\<open>radd_left_cancel_le\<close>,
  20.112 +	     \<^rule_thm>\<open>not_true\<close>,
  20.113 +	     \<^rule_thm>\<open>not_false\<close>,
  20.114 +	     \<^rule_thm>\<open>and_true\<close>,
  20.115 +	     \<^rule_thm>\<open>and_false\<close>,
  20.116 +	     \<^rule_thm>\<open>or_true\<close>,
  20.117 +	     \<^rule_thm>\<open>or_false\<close>,
  20.118 +	     \<^rule_thm>\<open>and_commute\<close>,
  20.119 +	     \<^rule_thm>\<open>or_commute\<close>,
  20.120 +    
  20.121 +	     \<^rule_thm>\<open>real_diff_minus\<close>,
  20.122 +    
  20.123 +	     \<^rule_thm>\<open>root_ge0\<close>,
  20.124 +	     \<^rule_thm>\<open>root_add_ge0\<close>,
  20.125 +	     \<^rule_thm>\<open>root_ge0_1\<close>,
  20.126 +	     \<^rule_thm>\<open>root_ge0_2\<close>,
  20.127 +    
  20.128 +	     \<^rule_eval>\<open>Prog_Expr.is_const\<close> (Prog_Expr.eval_const "#is_const_"),
  20.129 +	     \<^rule_eval>\<open>contains_root\<close> (eval_contains_root "#eval_contains_root"),
  20.130 +	     \<^rule_eval>\<open>Prog_Expr.matches\<close> (Prog_Expr.eval_matches ""),
  20.131 +	     \<^rule_eval>\<open>contains_root\<close> (eval_contains_root"#contains_root_"),
  20.132 +    
  20.133 +	     \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"),
  20.134 +	     \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
  20.135 +	     \<^rule_eval>\<open>sqrt\<close> (eval_sqrt "#sqrt_"),
  20.136 +	     \<^rule_eval>\<open>powr\<close> (**)(eval_binop "#power_"),
  20.137 +    
  20.138 +	     \<^rule_eval>\<open>less\<close> (Prog_Expr.eval_equ "#less_"),
  20.139 +	     \<^rule_eval>\<open>less_eq\<close> (Prog_Expr.eval_equ "#less_equal_"),
  20.140 +    
  20.141 +	     \<^rule_eval>\<open>Prog_Expr.ident\<close> (Prog_Expr.eval_ident "#ident_")],
  20.142 +    scr = Rule.Empty_Prog};      
  20.143  \<close>
  20.144  rule_set_knowledge testerls = \<open>prep_rls' testerls\<close>
  20.145  
  20.146  ML \<open>
  20.147  (*make () dissappear*)   
  20.148  val rearrange_assoc =
  20.149 -  Rule_Def.Repeat{id = "rearrange_assoc", preconds = [], 
  20.150 -      rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord), 
  20.151 -      erls = Rule_Set.empty, srls = Rule_Set.empty, calc = [], errpatts = [],
  20.152 -      rules = [\<^rule_thm_sym>\<open>add.assoc\<close>, \<^rule_thm_sym>\<open>rmult_assoc\<close>],
  20.153 -      scr = Rule.Empty_Prog
  20.154 -      };      
  20.155 +  Rule_Def.Repeat{
  20.156 +    id = "rearrange_assoc", preconds = [], 
  20.157 +    rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord), 
  20.158 +    erls = Rule_Set.empty, srls = Rule_Set.empty, calc = [], errpatts = [],
  20.159 +    rules = [
  20.160 +      \<^rule_thm_sym>\<open>add.assoc\<close>,
  20.161 +      \<^rule_thm_sym>\<open>rmult_assoc\<close>],
  20.162 +    scr = Rule.Empty_Prog};      
  20.163  
  20.164  val ac_plus_times =
  20.165 -  Rule_Def.Repeat{id = "ac_plus_times", preconds = [], rew_ord = ("term_order",term_order),
  20.166 -      erls = Rule_Set.empty, srls = Rule_Set.empty, calc = [], errpatts = [],
  20.167 -      rules = 
  20.168 -      [\<^rule_thm>\<open>radd_commute\<close>,
  20.169 -       \<^rule_thm>\<open>radd_left_commute\<close>,
  20.170 -       \<^rule_thm>\<open>add.assoc\<close>,
  20.171 -       \<^rule_thm>\<open>rmult_commute\<close>,
  20.172 -       \<^rule_thm>\<open>rmult_left_commute\<close>,
  20.173 -       \<^rule_thm>\<open>rmult_assoc\<close>],
  20.174 -      scr = Rule.Empty_Prog
  20.175 -      };      
  20.176 +  Rule_Def.Repeat{
  20.177 +    id = "ac_plus_times", preconds = [], rew_ord = ("term_order",term_order),
  20.178 +    erls = Rule_Set.empty, srls = Rule_Set.empty, calc = [], errpatts = [],
  20.179 +    rules = [
  20.180 +      \<^rule_thm>\<open>radd_commute\<close>,
  20.181 +      \<^rule_thm>\<open>radd_left_commute\<close>,
  20.182 +      \<^rule_thm>\<open>add.assoc\<close>,
  20.183 +      \<^rule_thm>\<open>rmult_commute\<close>,
  20.184 +      \<^rule_thm>\<open>rmult_left_commute\<close>,
  20.185 +      \<^rule_thm>\<open>rmult_assoc\<close>],
  20.186 +    scr = Rule.Empty_Prog};      
  20.187  
  20.188  (*todo: replace by Rewrite("rnorm_equation_add", @{thm rnorm_equation_add)*)
  20.189  val norm_equation =
  20.190    Rule_Def.Repeat{id = "norm_equation", preconds = [], rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord),
  20.191 -      erls = tval_rls, srls = Rule_Set.empty, calc = [], errpatts = [],
  20.192 -      rules = [\<^rule_thm>\<open>rnorm_equation_add\<close>
  20.193 -	       ],
  20.194 -      scr = Rule.Empty_Prog
  20.195 -      };      
  20.196 +    erls = tval_rls, srls = Rule_Set.empty, calc = [], errpatts = [],
  20.197 +    rules = [
  20.198 +      \<^rule_thm>\<open>rnorm_equation_add\<close>],
  20.199 +    scr = Rule.Empty_Prog};      
  20.200  \<close>
  20.201  ML \<open>
  20.202  (* expects * distributed over + *)
  20.203  val Test_simplify =
  20.204 -  Rule_Def.Repeat{id = "Test_simplify", preconds = [], 
  20.205 -      rew_ord = ("sqrt_right", sqrt_right false @{theory "Pure"}),
  20.206 -      erls = tval_rls, srls = Rule_Set.empty, 
  20.207 -      calc=[(*since 040209 filled by prep_rls'*)], errpatts = [],
  20.208 -      rules = [
  20.209 -	       \<^rule_thm>\<open>real_diff_minus\<close>,
  20.210 -	       \<^rule_thm>\<open>radd_mult_distrib2\<close>,
  20.211 -	       \<^rule_thm>\<open>rdistr_right_assoc\<close>,
  20.212 -	       \<^rule_thm>\<open>rdistr_right_assoc_p\<close>,
  20.213 -	       \<^rule_thm>\<open>rdistr_div_right\<close>,
  20.214 -	       \<^rule_thm>\<open>rbinom_power_2\<close>,	       
  20.215 +  Rule_Def.Repeat{
  20.216 +    id = "Test_simplify", preconds = [], 
  20.217 +    rew_ord = ("sqrt_right", sqrt_right false @{theory "Pure"}),
  20.218 +    erls = tval_rls, srls = Rule_Set.empty, 
  20.219 +    calc=[(*since 040209 filled by prep_rls'*)], errpatts = [],
  20.220 +    rules = [
  20.221 +	     \<^rule_thm>\<open>real_diff_minus\<close>,
  20.222 +	     \<^rule_thm>\<open>radd_mult_distrib2\<close>,
  20.223 +	     \<^rule_thm>\<open>rdistr_right_assoc\<close>,
  20.224 +	     \<^rule_thm>\<open>rdistr_right_assoc_p\<close>,
  20.225 +	     \<^rule_thm>\<open>rdistr_div_right\<close>,
  20.226 +	     \<^rule_thm>\<open>rbinom_power_2\<close>,	       
  20.227  
  20.228 -               \<^rule_thm>\<open>radd_commute\<close>, 
  20.229 -	       \<^rule_thm>\<open>radd_left_commute\<close>,
  20.230 -	       \<^rule_thm>\<open>add.assoc\<close>,
  20.231 -	       \<^rule_thm>\<open>rmult_commute\<close>,
  20.232 -	       \<^rule_thm>\<open>rmult_left_commute\<close>,
  20.233 -	       \<^rule_thm>\<open>rmult_assoc\<close>,
  20.234 +             \<^rule_thm>\<open>radd_commute\<close>,
  20.235 +	     \<^rule_thm>\<open>radd_left_commute\<close>,
  20.236 +	     \<^rule_thm>\<open>add.assoc\<close>,
  20.237 +	     \<^rule_thm>\<open>rmult_commute\<close>,
  20.238 +	     \<^rule_thm>\<open>rmult_left_commute\<close>,
  20.239 +	     \<^rule_thm>\<open>rmult_assoc\<close>,
  20.240  
  20.241 -	       \<^rule_thm>\<open>radd_real_const_eq\<close>,
  20.242 -	       \<^rule_thm>\<open>radd_real_const\<close>,
  20.243 -	       (* these 2 rules are invers to distr_div_right wrt. termination.
  20.244 -		  thus they MUST be done IMMEDIATELY before calc *)
  20.245 -	       \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"), 
  20.246 -	       \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
  20.247 -	       \<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e"),
  20.248 -	       \<^rule_eval>\<open>powr\<close> (**)(eval_binop "#power_"),
  20.249 +	     \<^rule_thm>\<open>radd_real_const_eq\<close>,
  20.250 +	     \<^rule_thm>\<open>radd_real_const\<close>,
  20.251 +	     (* these 2 rules are invers to distr_div_right wrt. termination.
  20.252 +		     thus they MUST be done IMMEDIATELY before calc *)
  20.253 +	     \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"), 
  20.254 +	     \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
  20.255 +	     \<^rule_eval>\<open>divide\<close> (Prog_Expr.eval_cancel "#divide_e"),
  20.256 +	     \<^rule_eval>\<open>powr\<close> (**)(eval_binop "#power_"),
  20.257  
  20.258 -	       \<^rule_thm>\<open>rcollect_right\<close>,
  20.259 -	       \<^rule_thm>\<open>rcollect_one_left\<close>,
  20.260 -	       \<^rule_thm>\<open>rcollect_one_left_assoc\<close>,
  20.261 -	       \<^rule_thm>\<open>rcollect_one_left_assoc_p\<close>,
  20.262 +	     \<^rule_thm>\<open>rcollect_right\<close>,
  20.263 +	     \<^rule_thm>\<open>rcollect_one_left\<close>,
  20.264 +	     \<^rule_thm>\<open>rcollect_one_left_assoc\<close>,
  20.265 +	     \<^rule_thm>\<open>rcollect_one_left_assoc_p\<close>,
  20.266  
  20.267 -	       \<^rule_thm>\<open>rshift_nominator\<close>,
  20.268 -	       \<^rule_thm>\<open>rcancel_den\<close>,
  20.269 -	       \<^rule_thm>\<open>rroot_square_inv\<close>,
  20.270 -	       \<^rule_thm>\<open>rroot_times_root\<close>,
  20.271 -	       \<^rule_thm>\<open>rroot_times_root_assoc_p\<close>,
  20.272 -	       \<^rule_thm>\<open>rsqare\<close>,
  20.273 -	       \<^rule_thm>\<open>power_1\<close>,
  20.274 -	       \<^rule_thm>\<open>rtwo_of_the_same\<close>,
  20.275 -	       \<^rule_thm>\<open>rtwo_of_the_same_assoc_p\<close>,
  20.276 +	     \<^rule_thm>\<open>rshift_nominator\<close>,
  20.277 +	     \<^rule_thm>\<open>rcancel_den\<close>,
  20.278 +	     \<^rule_thm>\<open>rroot_square_inv\<close>,
  20.279 +	     \<^rule_thm>\<open>rroot_times_root\<close>,
  20.280 +	     \<^rule_thm>\<open>rroot_times_root_assoc_p\<close>,
  20.281 +	     \<^rule_thm>\<open>rsqare\<close>,
  20.282 +	     \<^rule_thm>\<open>power_1\<close>,
  20.283 +	     \<^rule_thm>\<open>rtwo_of_the_same\<close>,
  20.284 +	     \<^rule_thm>\<open>rtwo_of_the_same_assoc_p\<close>,
  20.285  
  20.286 -	       \<^rule_thm>\<open>rmult_1\<close>,
  20.287 -	       \<^rule_thm>\<open>rmult_1_right\<close>,
  20.288 -	       \<^rule_thm>\<open>rmult_0\<close>,
  20.289 -	       \<^rule_thm>\<open>rmult_0_right\<close>,
  20.290 -	       \<^rule_thm>\<open>radd_0\<close>,
  20.291 -	       \<^rule_thm>\<open>radd_0_right\<close>
  20.292 -	       ],
  20.293 -      scr = Rule.Empty_Prog
  20.294 -		    (*since 040209 filled by prep_rls': STest_simplify*)
  20.295 -      };      
  20.296 +	     \<^rule_thm>\<open>rmult_1\<close>,
  20.297 +	     \<^rule_thm>\<open>rmult_1_right\<close>,
  20.298 +	     \<^rule_thm>\<open>rmult_0\<close>,
  20.299 +	     \<^rule_thm>\<open>rmult_0_right\<close>,
  20.300 +	     \<^rule_thm>\<open>radd_0\<close>,
  20.301 +	     \<^rule_thm>\<open>radd_0_right\<close>],
  20.302 +    scr = Rule.Empty_Prog};      
  20.303  \<close>
  20.304  ML \<open>
  20.305  (*isolate the root in a root-equation*)
  20.306  val isolate_root =
  20.307    Rule_Def.Repeat{id = "isolate_root", preconds = [], rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord), 
  20.308 -      erls=tval_rls,srls = Rule_Set.empty, calc=[], errpatts = [],
  20.309 -      rules = [\<^rule_thm>\<open>rroot_to_lhs\<close>,
  20.310 -	       \<^rule_thm>\<open>rroot_to_lhs_mult\<close>,
  20.311 -	       \<^rule_thm>\<open>rroot_to_lhs_add_mult\<close>,
  20.312 -	       \<^rule_thm>\<open>risolate_root_add\<close>,
  20.313 -	       \<^rule_thm>\<open>risolate_root_mult\<close>,
  20.314 -	       \<^rule_thm>\<open>risolate_root_div\<close>       ],
  20.315 -      scr = Rule.Prog ((Thm.term_of o the o (TermC.parse \<^theory>)) 
  20.316 -      "empty_script")
  20.317 -      };
  20.318 +    erls=tval_rls,srls = Rule_Set.empty, calc=[], errpatts = [],
  20.319 +    rules = [
  20.320 +       \<^rule_thm>\<open>rroot_to_lhs\<close>,
  20.321 +	     \<^rule_thm>\<open>rroot_to_lhs_mult\<close>,
  20.322 +	     \<^rule_thm>\<open>rroot_to_lhs_add_mult\<close>,
  20.323 +	     \<^rule_thm>\<open>risolate_root_add\<close>,
  20.324 +	     \<^rule_thm>\<open>risolate_root_mult\<close>,
  20.325 +	     \<^rule_thm>\<open>risolate_root_div\<close>],
  20.326 +    scr = Rule.Empty_Prog};      
  20.327  
  20.328  (*isolate the bound variable in an equation; 'bdv' is a meta-constant*)
  20.329  val isolate_bdv =
  20.330 -    Rule_Def.Repeat{id = "isolate_bdv", preconds = [], rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord),
  20.331 -	erls=tval_rls,srls = Rule_Set.empty, calc= [], errpatts = [],
  20.332 -	rules = 
  20.333 -	[\<^rule_thm>\<open>risolate_bdv_add\<close>,
  20.334 -	 \<^rule_thm>\<open>risolate_bdv_mult_add\<close>,
  20.335 -	 \<^rule_thm>\<open>risolate_bdv_mult\<close>,
  20.336 -	 \<^rule_thm>\<open>mult_square\<close>,
  20.337 -	 \<^rule_thm>\<open>constant_square\<close>,
  20.338 -	 \<^rule_thm>\<open>constant_mult_square\<close>
  20.339 -	 ],
  20.340 -	scr = Rule.Prog ((Thm.term_of o the o (TermC.parse \<^theory>)) 
  20.341 -			  "empty_script")
  20.342 -	};      
  20.343 +  Rule_Def.Repeat{
  20.344 +    id = "isolate_bdv", preconds = [], rew_ord = ("e_rew_ord",Rewrite_Ord.e_rew_ord),
  20.345 +  	erls=tval_rls,srls = Rule_Set.empty, calc= [], errpatts = [],
  20.346 +  	rules = [
  20.347 +      \<^rule_thm>\<open>risolate_bdv_add\<close>,
  20.348 +      \<^rule_thm>\<open>risolate_bdv_mult_add\<close>,
  20.349 +      \<^rule_thm>\<open>risolate_bdv_mult\<close>,
  20.350 +      \<^rule_thm>\<open>mult_square\<close>,
  20.351 +      \<^rule_thm>\<open>constant_square\<close>,
  20.352 +      \<^rule_thm>\<open>constant_mult_square\<close>],
  20.353 +    scr = Rule.Empty_Prog};      
  20.354  \<close>
  20.355  ML \<open>val prep_rls' = Auto_Prog.prep_rls @{theory};\<close>
  20.356  rule_set_knowledge
  20.357 @@ -601,163 +597,92 @@
  20.358  
  20.359  val make_polytest =
  20.360    Rule_Def.Repeat{id = "make_polytest", preconds = []:term list, 
  20.361 -      rew_ord = ("ord_make_polytest", ord_make_polytest false @{theory "Poly"}),
  20.362 -      erls = testerls, srls = Rule_Set.Empty,
  20.363 -      calc = [("PLUS"  , (\<^const_name>\<open>plus\<close>, (**)eval_binop "#add_")), 
  20.364 -	      ("TIMES" , (\<^const_name>\<open>times\<close>, (**)eval_binop "#mult_")),
  20.365 -	      ("POWER", (\<^const_name>\<open>powr\<close>, (**)eval_binop "#power_"))
  20.366 -	      ], errpatts = [],
  20.367 -      rules = [\<^rule_thm>\<open>real_diff_minus\<close>,
  20.368 -	       (*"a - b = a + (-1) * b"*)
  20.369 -	       \<^rule_thm>\<open>distrib_right\<close>,
  20.370 -	       (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  20.371 -	       \<^rule_thm>\<open>distrib_left\<close>,
  20.372 -	       (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  20.373 -	       \<^rule_thm>\<open>left_diff_distrib\<close>,
  20.374 -	       (*"(z1.0 - z2.0) * w = z1.0 * w - z2.0 * w"*)
  20.375 -	       \<^rule_thm>\<open>right_diff_distrib\<close>,
  20.376 -	       (*"w * (z1.0 - z2.0) = w * z1.0 - w * z2.0"*)
  20.377 -	       \<^rule_thm>\<open>mult_1_left\<close>,                 
  20.378 -	       (*"1 * z = z"*)
  20.379 -	       \<^rule_thm>\<open>mult_zero_left\<close>,        
  20.380 -	       (*"0 * z = 0"*)
  20.381 -	       \<^rule_thm>\<open>add_0_left\<close>,
  20.382 -	       (*"0 + z = z"*)
  20.383 -
  20.384 -	       (*AC-rewriting*)
  20.385 -	       \<^rule_thm>\<open>mult.commute\<close>,
  20.386 -	       (* z * w = w * z *)
  20.387 -	       \<^rule_thm>\<open>real_mult_left_commute\<close>,
  20.388 -	       (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*)
  20.389 -	       \<^rule_thm>\<open>mult.assoc\<close>,		
  20.390 -	       (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*)
  20.391 -	       \<^rule_thm>\<open>add.commute\<close>,	
  20.392 -	       (*z + w = w + z*)
  20.393 -	       \<^rule_thm>\<open>add.left_commute\<close>,
  20.394 -	       (*x + (y + z) = y + (x + z)*)
  20.395 -	       \<^rule_thm>\<open>add.assoc\<close>,	               
  20.396 -	       (*z1.0 + z2.0 + z3.0 = z1.0 + (z2.0 + z3.0)*)
  20.397 -
  20.398 -	       \<^rule_thm_sym>\<open>realpow_twoI\<close>,	
  20.399 -	       (*"r1 * r1 = r1 \<up> 2"*)
  20.400 -	       \<^rule_thm>\<open>realpow_plus_1\<close>,		
  20.401 -	       (*"r * r \<up> n = r \<up> (n + 1)"*)
  20.402 -	       \<^rule_thm_sym>\<open>real_mult_2\<close>,	
  20.403 -	       (*"z1 + z1 = 2 * z1"*)
  20.404 -	       \<^rule_thm>\<open>real_mult_2_assoc\<close>,	
  20.405 -	       (*"z1 + (z1 + k) = 2 * z1 + k"*)
  20.406 -
  20.407 -	       \<^rule_thm>\<open>real_num_collect\<close>, 
  20.408 -	       (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
  20.409 -	       \<^rule_thm>\<open>real_num_collect_assoc\<close>,
  20.410 -	       (*"[| l is_const; m is_const |] ==>  
  20.411 -				l * n + (m * n + k) =  (l + m) * n + k"*)
  20.412 -	       \<^rule_thm>\<open>real_one_collect\<close>,	
  20.413 -	       (*"m is_const ==> n + m * n = (1 + m) * n"*)
  20.414 -	       \<^rule_thm>\<open>real_one_collect_assoc\<close>, 
  20.415 -	       (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  20.416 -
  20.417 -	       \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"), 
  20.418 -	       \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
  20.419 -	       \<^rule_eval>\<open>powr\<close> (**)(eval_binop "#power_")
  20.420 -	       ],
  20.421 -      scr = Rule.Empty_Prog(*Rule.Prog ((Thm.term_of o the o (parse thy)) 
  20.422 -      scr_make_polytest)*)
  20.423 -      }; 
  20.424 +    rew_ord = ("ord_make_polytest", ord_make_polytest false @{theory "Poly"}),
  20.425 +    erls = testerls, srls = Rule_Set.Empty,
  20.426 +    calc = [
  20.427 +      ("PLUS"  , (\<^const_name>\<open>plus\<close>, (**)eval_binop "#add_")), 
  20.428 +	    ("TIMES" , (\<^const_name>\<open>times\<close>, (**)eval_binop "#mult_")),
  20.429 +	    ("POWER", (\<^const_name>\<open>powr\<close>, (**)eval_binop "#power_"))],
  20.430 +    errpatts = [],
  20.431 +    rules = [
  20.432 +       \<^rule_thm>\<open>real_diff_minus\<close>, (*"a - b = a + (-1) * b"*)
  20.433 +	     \<^rule_thm>\<open>distrib_right\<close>, (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  20.434 +	     \<^rule_thm>\<open>distrib_left\<close>, (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  20.435 +	     \<^rule_thm>\<open>left_diff_distrib\<close>, (*"(z1.0 - z2.0) * w = z1.0 * w - z2.0 * w"*)
  20.436 +	     \<^rule_thm>\<open>right_diff_distrib\<close>, (*"w * (z1.0 - z2.0) = w * z1.0 - w * z2.0"*)
  20.437 +	     \<^rule_thm>\<open>mult_1_left\<close>, (*"1 * z = z"*)
  20.438 +	     \<^rule_thm>\<open>mult_zero_left\<close>, (*"0 * z = 0"*)
  20.439 +	     \<^rule_thm>\<open>add_0_left\<close>, (*"0 + z = z"*)
  20.440 +	     (*AC-rewriting*)
  20.441 +	     \<^rule_thm>\<open>mult.commute\<close>, (* z * w = w * z *)
  20.442 +	     \<^rule_thm>\<open>real_mult_left_commute\<close>, (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*)
  20.443 +	     \<^rule_thm>\<open>mult.assoc\<close>, (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*)
  20.444 +	     \<^rule_thm>\<open>add.commute\<close>,	 (*z + w = w + z*)
  20.445 +	     \<^rule_thm>\<open>add.left_commute\<close>, (*x + (y + z) = y + (x + z)*)
  20.446 +	     \<^rule_thm>\<open>add.assoc\<close>, (*z1.0 + z2.0 + z3.0 = z1.0 + (z2.0 + z3.0)*)
  20.447 +    
  20.448 +	     \<^rule_thm_sym>\<open>realpow_twoI\<close>, (*"r1 * r1 = r1 \<up> 2"*)
  20.449 +	     \<^rule_thm>\<open>realpow_plus_1\<close>, (*"r * r \<up> n = r \<up> (n + 1)"*)
  20.450 +	     \<^rule_thm_sym>\<open>real_mult_2\<close>,	 (*"z1 + z1 = 2 * z1"*)
  20.451 +	     \<^rule_thm>\<open>real_mult_2_assoc\<close>,	 (*"z1 + (z1 + k) = 2 * z1 + k"*)
  20.452 +    
  20.453 +	     \<^rule_thm>\<open>real_num_collect\<close>, (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
  20.454 +	     \<^rule_thm>\<open>real_num_collect_assoc\<close>, (*"[| l is_const; m is_const |] ==> l * n + (m * n + k) =  (l + m) * n + k"*)
  20.455 +	     \<^rule_thm>\<open>real_one_collect\<close>, (*"m is_const ==> n + m * n = (1 + m) * n"*)
  20.456 +	     \<^rule_thm>\<open>real_one_collect_assoc\<close>, (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  20.457 +    
  20.458 +	     \<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"), 
  20.459 +	     \<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
  20.460 +	     \<^rule_eval>\<open>powr\<close> (**)(eval_binop "#power_")],
  20.461 +    scr = Rule.Empty_Prog}; 
  20.462  
  20.463  val expand_binomtest =
  20.464    Rule_Def.Repeat{id = "expand_binomtest", preconds = [], 
  20.465 -      rew_ord = ("termlessI",termlessI),
  20.466 -      erls = testerls, srls = Rule_Set.Empty,
  20.467 -      calc = [("PLUS"  , (\<^const_name>\<open>plus\<close>, (**)eval_binop "#add_")), 
  20.468 -	      ("TIMES" , (\<^const_name>\<open>times\<close>, (**)eval_binop "#mult_")),
  20.469 -	      ("POWER", (\<^const_name>\<open>powr\<close>, (**)eval_binop "#power_"))
  20.470 -	      ], errpatts = [],
  20.471 -      rules = 
  20.472 -      [\<^rule_thm>\<open>real_plus_binom_pow2\<close>,     
  20.473 -	       (*"(a + b) \<up> 2 = a \<up> 2 + 2 * a * b + b \<up> 2"*)
  20.474 -       \<^rule_thm>\<open>real_plus_binom_times\<close>,    
  20.475 -	      (*"(a + b)*(a + b) = ...*)
  20.476 -       \<^rule_thm>\<open>real_minus_binom_pow2\<close>,   
  20.477 -       (*"(a - b) \<up> 2 = a \<up> 2 - 2 * a * b + b \<up> 2"*)
  20.478 -       \<^rule_thm>\<open>real_minus_binom_times\<close>,   
  20.479 -       (*"(a - b)*(a - b) = ...*)
  20.480 -       \<^rule_thm>\<open>real_plus_minus_binom1\<close>,   
  20.481 -        (*"(a + b) * (a - b) = a \<up> 2 - b \<up> 2"*)
  20.482 -       \<^rule_thm>\<open>real_plus_minus_binom2\<close>,   
  20.483 -        (*"(a - b) * (a + b) = a \<up> 2 - b \<up> 2"*)
  20.484 -       (*RL 020915*)
  20.485 -       \<^rule_thm>\<open>real_pp_binom_times\<close>, 
  20.486 -        (*(a + b)*(c + d) = a*c + a*d + b*c + b*d*)
  20.487 -       \<^rule_thm>\<open>real_pm_binom_times\<close>, 
  20.488 -        (*(a + b)*(c - d) = a*c - a*d + b*c - b*d*)
  20.489 -       \<^rule_thm>\<open>real_mp_binom_times\<close>, 
  20.490 -        (*(a - b)*(c p d) = a*c + a*d - b*c - b*d*)
  20.491 -       \<^rule_thm>\<open>real_mm_binom_times\<close>, 
  20.492 -        (*(a - b)*(c p d) = a*c - a*d - b*c + b*d*)
  20.493 -       \<^rule_thm>\<open>realpow_multI\<close>,                
  20.494 -        (*(a*b) \<up> n = a \<up> n * b \<up> n*)
  20.495 -       \<^rule_thm>\<open>real_plus_binom_pow3\<close>,
  20.496 -        (* (a + b) \<up> 3 = a \<up> 3 + 3*a \<up> 2*b + 3*a*b \<up> 2 + b \<up> 3 *)
  20.497 -       \<^rule_thm>\<open>real_minus_binom_pow3\<close>,
  20.498 -        (* (a - b) \<up> 3 = a \<up> 3 - 3*a \<up> 2*b + 3*a*b \<up> 2 - b \<up> 3 *)
  20.499 +    rew_ord = ("termlessI",termlessI), erls = testerls, srls = Rule_Set.Empty,
  20.500 +    calc = [
  20.501 +      ("PLUS"  , (\<^const_name>\<open>plus\<close>, (**)eval_binop "#add_")), 
  20.502 +	    ("TIMES" , (\<^const_name>\<open>times\<close>, (**)eval_binop "#mult_")),
  20.503 +	    ("POWER", (\<^const_name>\<open>powr\<close>, (**)eval_binop "#power_"))
  20.504 +	    ],
  20.505 +    errpatts = [],
  20.506 +    rules = [
  20.507 +      \<^rule_thm>\<open>real_plus_binom_pow2\<close>, (*"(a + b) \<up> 2 = a \<up> 2 + 2 * a * b + b \<up> 2"*)
  20.508 +      \<^rule_thm>\<open>real_plus_binom_times\<close>, (*"(a + b)*(a + b) = ...*)
  20.509 +      \<^rule_thm>\<open>real_minus_binom_pow2\<close>, (*"(a - b) \<up> 2 = a \<up> 2 - 2 * a * b + b \<up> 2"*)
  20.510 +      \<^rule_thm>\<open>real_minus_binom_times\<close>, (*"(a - b)*(a - b) = ...*)
  20.511 +      \<^rule_thm>\<open>real_plus_minus_binom1\<close>, (*"(a + b) * (a - b) = a \<up> 2 - b \<up> 2"*)
  20.512 +      \<^rule_thm>\<open>real_plus_minus_binom2\<close>, (*"(a - b) * (a + b) = a \<up> 2 - b \<up> 2"*)
  20.513 +      (*RL 020915*)
  20.514 +      \<^rule_thm>\<open>real_pp_binom_times\<close>,  (*(a + b)*(c + d) = a*c + a*d + b*c + b*d*)
  20.515 +      \<^rule_thm>\<open>real_pm_binom_times\<close>, (*(a + b)*(c - d) = a*c - a*d + b*c - b*d*)
  20.516 +      \<^rule_thm>\<open>real_mp_binom_times\<close>, (*(a - b)*(c p d) = a*c + a*d - b*c - b*d*)
  20.517 +      \<^rule_thm>\<open>real_mm_binom_times\<close>, (*(a - b)*(c p d) = a*c - a*d - b*c + b*d*)
  20.518 +      \<^rule_thm>\<open>realpow_multI\<close>, (*(a*b) \<up> n = a \<up> n * b \<up> n*)
  20.519 +      \<^rule_thm>\<open>real_plus_binom_pow3\<close>, (* (a + b) \<up> 3 = a \<up> 3 + 3*a \<up> 2*b + 3*a*b \<up> 2 + b \<up> 3 *)
  20.520 +      \<^rule_thm>\<open>real_minus_binom_pow3\<close>, (* (a - b) \<up> 3 = a \<up> 3 - 3*a \<up> 2*b + 3*a*b \<up> 2 - b \<up> 3 *)
  20.521  
  20.522 -
  20.523 -     (*  \<^rule_thm>\<open>distrib_right\<close>,	
  20.524 -	 (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
  20.525 -	\<^rule_thm>\<open>distrib_left\<close>,	
  20.526 -	(*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
  20.527 -	\<^rule_thm>\<open>left_diff_distrib\<close>,	
  20.528 -	(*"(z1.0 - z2.0) * w = z1.0 * w - z2.0 * w"*)
  20.529 -	\<^rule_thm>\<open>right_diff_distrib\<close>,	
  20.530 -	(*"w * (z1.0 - z2.0) = w * z1.0 - w * z2.0"*)
  20.531 -	*)
  20.532 -	
  20.533 -	\<^rule_thm>\<open>mult_1_left\<close>,              
  20.534 -         (*"1 * z = z"*)
  20.535 -	\<^rule_thm>\<open>mult_zero_left\<close>,              
  20.536 -         (*"0 * z = 0"*)
  20.537 -	\<^rule_thm>\<open>add_0_left\<close>,
  20.538 -         (*"0 + z = z"*)
  20.539 -
  20.540 -	\<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"), 
  20.541 -	\<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
  20.542 -	\<^rule_eval>\<open>powr\<close> (**)(eval_binop "#power_"),
  20.543 -        (*	       
  20.544 -	 \<^rule_thm>\<open>mult.commute\<close>,		
  20.545 -        (*AC-rewriting*)
  20.546 -	\<^rule_thm>\<open>real_mult_left_commute\<close>,
  20.547 -	\<^rule_thm>\<open>mult.assoc\<close>,
  20.548 -	\<^rule_thm>\<open>add.commute\<close>,	
  20.549 -	\<^rule_thm>\<open>add.left_commute\<close>,
  20.550 -	\<^rule_thm>\<open>add.assoc\<close>,
  20.551 -	*)
  20.552 -	
  20.553 -	\<^rule_thm_sym>\<open>realpow_twoI\<close>,
  20.554 -	(*"r1 * r1 = r1 \<up> 2"*)
  20.555 -	\<^rule_thm>\<open>realpow_plus_1\<close>,			
  20.556 -	(*"r * r \<up> n = r \<up> (n + 1)"*)
  20.557 -	(*\<^rule_thm_sym>\<open>real_mult_2\<close>,
  20.558 -	(*"z1 + z1 = 2 * z1"*)*)
  20.559 -	\<^rule_thm>\<open>real_mult_2_assoc\<close>,		
  20.560 -	(*"z1 + (z1 + k) = 2 * z1 + k"*)
  20.561 -
  20.562 -	\<^rule_thm>\<open>real_num_collect\<close>, 
  20.563 -	(*"[| l is_const; m is_const |] ==> l * n + m * n = (l + m) * n"*)
  20.564 -	\<^rule_thm>\<open>real_num_collect_assoc\<close>,	
  20.565 -	(*"[| l is_const; m is_const |] ==>  l * n + (m * n + k) =  (l + m) * n + k"*)
  20.566 -	\<^rule_thm>\<open>real_one_collect\<close>,		
  20.567 -	(*"m is_const ==> n + m * n = (1 + m) * n"*)
  20.568 -	\<^rule_thm>\<open>real_one_collect_assoc\<close>, 
  20.569 -	(*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  20.570 -
  20.571 -	\<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"), 
  20.572 -	\<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
  20.573 -	\<^rule_eval>\<open>powr\<close> (**)(eval_binop "#power_")
  20.574 -	],
  20.575 -      scr = Rule.Empty_Prog
  20.576 -(*Program ((Thm.term_of o the o (parse thy)) scr_expand_binomtest)*)
  20.577 -      };      
  20.578 +    	\<^rule_thm>\<open>mult_1_left\<close>, (*"1 * z = z"*)
  20.579 +    	\<^rule_thm>\<open>mult_zero_left\<close>, (*"0 * z = 0"*)
  20.580 +    	\<^rule_thm>\<open>add_0_left\<close>, (*"0 + z = z"*)
  20.581 +    
  20.582 +    	\<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"), 
  20.583 +    	\<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
  20.584 +    	\<^rule_eval>\<open>powr\<close> (**)(eval_binop "#power_"),
  20.585 +    
  20.586 +    	\<^rule_thm_sym>\<open>realpow_twoI\<close>, (*"r1 * r1 = r1 \<up> 2"*)
  20.587 +    	\<^rule_thm>\<open>realpow_plus_1\<close>,	 (*"r * r \<up> n = r \<up> (n + 1)"*)
  20.588 +    	(*\<^rule_thm_sym>\<open>real_mult_2\<close>, (*"z1 + z1 = 2 * z1"*)*)
  20.589 +    	\<^rule_thm>\<open>real_mult_2_assoc\<close>, (*"z1 + (z1 + k) = 2 * z1 + k"*)
  20.590 +    
  20.591 +    	\<^rule_thm>\<open>real_num_collect\<close>, (*"[| l is_const; m is_const |] ==> l * n + m * n = (l + m) * n"*)
  20.592 +    	\<^rule_thm>\<open>real_num_collect_assoc\<close>,	 (*"[| l is_const; m is_const |] ==>  l * n + (m * n + k) =  (l + m) * n + k"*)
  20.593 +    	\<^rule_thm>\<open>real_one_collect\<close>,	 (*"m is_const ==> n + m * n = (1 + m) * n"*)
  20.594 +    	\<^rule_thm>\<open>real_one_collect_assoc\<close>, (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
  20.595 +    
  20.596 +    	\<^rule_eval>\<open>plus\<close> (**)(eval_binop "#add_"), 
  20.597 +    	\<^rule_eval>\<open>times\<close> (**)(eval_binop "#mult_"),
  20.598 +    	\<^rule_eval>\<open>powr\<close> (**)(eval_binop "#power_")],
  20.599 +    scr = Rule.Empty_Prog};      
  20.600  \<close>
  20.601  rule_set_knowledge
  20.602    make_polytest = \<open>prep_rls' make_polytest\<close> and
  20.603 @@ -914,9 +839,9 @@
  20.604  method met_test_squ_sub : "Test/squ-equ-test-subpbl1" =
  20.605    (*tests subproblem fixed linear*)
  20.606    \<open>{rew_ord' = "e_rew_ord", rls' = tval_rls, srls = Rule_Set.empty,
  20.607 -          prls = Rule_Set.append_rules "prls_met_test_squ_sub" Rule_Set.empty
  20.608 -              [\<^rule_eval>\<open>precond_rootmet\<close> (eval_precond_rootmet "")],
  20.609 -          calc=[], crls=tval_rls, errpats = [], nrls = Test_simplify}\<close>
  20.610 +     prls = Rule_Set.append_rules "prls_met_test_squ_sub" Rule_Set.empty
  20.611 +       [\<^rule_eval>\<open>precond_rootmet\<close> (eval_precond_rootmet "")],
  20.612 +     calc=[], crls=tval_rls, errpats = [], nrls = Test_simplify}\<close>
  20.613    Program: minisubpbl.simps
  20.614    Given: "equality e_e" "solveFor v_v"
  20.615    Where: "precond_rootmet v_v"
  20.616 @@ -945,9 +870,8 @@
  20.617    (*root-equation1:*)
  20.618    \<open>{rew_ord'="e_rew_ord",rls'=tval_rls,
  20.619      srls = Rule_Set.append_rules "srls_contains_root" Rule_Set.empty 
  20.620 -      [\<^rule_eval>\<open>contains_root\<close> (eval_contains_root"")], prls=Rule_Set.empty, calc=[], crls=tval_rls,
  20.621 -        errpats = [], nrls = Rule_Set.empty(*,asm_rls=[], asm_thm=[("square_equation_left", ""),
  20.622 -        ("square_equation_right", "")]*)}\<close>
  20.623 +      [\<^rule_eval>\<open>contains_root\<close> (eval_contains_root"")],
  20.624 +    prls=Rule_Set.empty, calc=[], crls=tval_rls, errpats = [], nrls = Rule_Set.empty}\<close>
  20.625    Program: solve_root_equ2.simps
  20.626    Given: "equality e_e" "solveFor v_v"
  20.627    Find: "solutions v_v'i'"
  20.628 @@ -976,9 +900,8 @@
  20.629    (*root-equation2*)
  20.630    \<open>{rew_ord'="e_rew_ord",rls'=tval_rls,
  20.631      srls = Rule_Set.append_rules "srls_contains_root" Rule_Set.empty 
  20.632 -        [\<^rule_eval>\<open>contains_root\<close> (eval_contains_root"")],
  20.633 -    prls=Rule_Set.empty,calc=[], crls=tval_rls, errpats = [], nrls = Rule_Set.empty(*,asm_rls=[],
  20.634 -    asm_thm=[("square_equation_left", ""), ("square_equation_right", "")]*)}\<close>
  20.635 +      [\<^rule_eval>\<open>contains_root\<close> (eval_contains_root"")],
  20.636 +    prls=Rule_Set.empty,calc=[], crls=tval_rls, errpats = [], nrls = Rule_Set.empty}\<close>
  20.637    Program: solve_root_equ3.simps
  20.638    Given: "equality e_e" "solveFor v_v"
  20.639    Find: "solutions v_v'i'"
  20.640 @@ -1007,9 +930,8 @@
  20.641    (*root-equation*)
  20.642    \<open>{rew_ord'="e_rew_ord",rls'=tval_rls,
  20.643      srls = Rule_Set.append_rules "srls_contains_root" Rule_Set.empty 
  20.644 -        [\<^rule_eval>\<open>contains_root\<close> (eval_contains_root"")],
  20.645 -    prls=Rule_Set.empty,calc=[], crls=tval_rls, errpats = [], nrls = Rule_Set.empty (*,asm_rls=[],
  20.646 -    asm_thm=[("square_equation_left", ""), ("square_equation_right", "")]*)}\<close>
  20.647 +      [\<^rule_eval>\<open>contains_root\<close> (eval_contains_root"")],
  20.648 +    prls=Rule_Set.empty,calc=[], crls=tval_rls, errpats = [], nrls = Rule_Set.empty}\<close>
  20.649    Program: solve_root_equ4.simps
  20.650    Given: "equality e_e" "solveFor v_v"
  20.651    Find: "solutions v_v'i'"