src/Tools/isac/Knowledge/LinEq.thy
changeset 59416 229e5c9cf78b
parent 59411 3e241a6938ce
child 59472 3e904f8ec16c
     1.1 --- a/src/Tools/isac/Knowledge/LinEq.thy	Sun Mar 25 13:59:57 2018 +0200
     1.2 +++ b/src/Tools/isac/Knowledge/LinEq.thy	Mon Mar 26 07:28:39 2018 +0200
     1.3 @@ -32,41 +32,41 @@
     1.4  val thy = @{theory};
     1.5  
     1.6  val LinEq_prls = (*3.10.02:just the following order due to subterm evaluation*)
     1.7 -  Celem.append_rls "LinEq_prls" Celem.e_rls 
     1.8 -	     [Celem.Calc ("HOL.eq",eval_equal "#equal_"),
     1.9 -	      Celem.Calc ("Tools.matches",eval_matches ""),
    1.10 -	      Celem.Calc ("Tools.lhs"    ,eval_lhs ""),
    1.11 -	      Celem.Calc ("Tools.rhs"    ,eval_rhs ""),
    1.12 -	      Celem.Calc ("Poly.has'_degree'_in",eval_has_degree_in ""),
    1.13 - 	      Celem.Calc ("Poly.is'_polyrat'_in",eval_is_polyrat_in ""),
    1.14 -	      Celem.Calc ("Atools.occurs'_in",eval_occurs_in ""),    
    1.15 -	      Celem.Calc ("Atools.ident",eval_ident "#ident_"),
    1.16 -	      Celem.Thm ("not_true",TermC.num_str @{thm not_true}),
    1.17 -	      Celem.Thm ("not_false",TermC.num_str @{thm not_false}),
    1.18 -	      Celem.Thm ("and_true",TermC.num_str @{thm and_true}),
    1.19 -	      Celem.Thm ("and_false",TermC.num_str @{thm and_false}),
    1.20 -	      Celem.Thm ("or_true",TermC.num_str @{thm or_true}),
    1.21 -	      Celem.Thm ("or_false",TermC.num_str @{thm or_false})
    1.22 +  Rule.append_rls "LinEq_prls" Rule.e_rls 
    1.23 +	     [Rule.Calc ("HOL.eq",eval_equal "#equal_"),
    1.24 +	      Rule.Calc ("Tools.matches",eval_matches ""),
    1.25 +	      Rule.Calc ("Tools.lhs"    ,eval_lhs ""),
    1.26 +	      Rule.Calc ("Tools.rhs"    ,eval_rhs ""),
    1.27 +	      Rule.Calc ("Poly.has'_degree'_in",eval_has_degree_in ""),
    1.28 + 	      Rule.Calc ("Poly.is'_polyrat'_in",eval_is_polyrat_in ""),
    1.29 +	      Rule.Calc ("Atools.occurs'_in",eval_occurs_in ""),    
    1.30 +	      Rule.Calc ("Atools.ident",eval_ident "#ident_"),
    1.31 +	      Rule.Thm ("not_true",TermC.num_str @{thm not_true}),
    1.32 +	      Rule.Thm ("not_false",TermC.num_str @{thm not_false}),
    1.33 +	      Rule.Thm ("and_true",TermC.num_str @{thm and_true}),
    1.34 +	      Rule.Thm ("and_false",TermC.num_str @{thm and_false}),
    1.35 +	      Rule.Thm ("or_true",TermC.num_str @{thm or_true}),
    1.36 +	      Rule.Thm ("or_false",TermC.num_str @{thm or_false})
    1.37                ];
    1.38  (* ----- erls ----- *)
    1.39  val LinEq_crls = 
    1.40 -   Celem.append_rls "LinEq_crls" poly_crls
    1.41 -   [Celem.Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1})
    1.42 +   Rule.append_rls "LinEq_crls" poly_crls
    1.43 +   [Rule.Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1})
    1.44      (*		
    1.45       Don't use
    1.46 -     Celem.Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),
    1.47 -     Celem.Calc ("Atools.pow" ,eval_binop "#power_"),
    1.48 +     Rule.Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),
    1.49 +     Rule.Calc ("Atools.pow" ,eval_binop "#power_"),
    1.50       *)
    1.51      ];
    1.52  
    1.53  (* ----- crls ----- *)
    1.54  val LinEq_erls = 
    1.55 -   Celem.append_rls "LinEq_erls" Poly_erls
    1.56 -   [Celem.Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1})
    1.57 +   Rule.append_rls "LinEq_erls" Poly_erls
    1.58 +   [Rule.Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1})
    1.59      (*		
    1.60       Don't use
    1.61 -     Celem.Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),
    1.62 -     Celem.Calc ("Atools.pow" ,eval_binop "#power_"),
    1.63 +     Rule.Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),
    1.64 +     Rule.Calc ("Atools.pow" ,eval_binop "#power_"),
    1.65       *)
    1.66      ];
    1.67  *}
    1.68 @@ -75,23 +75,23 @@
    1.69  ML {*
    1.70      
    1.71  val LinPoly_simplify = prep_rls'(
    1.72 -  Celem.Rls {id = "LinPoly_simplify", preconds = [], 
    1.73 +  Rule.Rls {id = "LinPoly_simplify", preconds = [], 
    1.74         rew_ord = ("termlessI",termlessI), 
    1.75         erls = LinEq_erls, 
    1.76 -       srls = Celem.Erls, 
    1.77 +       srls = Rule.Erls, 
    1.78         calc = [], errpatts = [],
    1.79         rules = [
    1.80 -		Celem.Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1}),
    1.81 -		Celem.Calc ("Groups.plus_class.plus",eval_binop "#add_"),
    1.82 -		Celem.Calc ("Groups.minus_class.minus",eval_binop "#sub_"),
    1.83 -		Celem.Calc ("Groups.times_class.times",eval_binop "#mult_"),
    1.84 +		Rule.Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1}),
    1.85 +		Rule.Calc ("Groups.plus_class.plus",eval_binop "#add_"),
    1.86 +		Rule.Calc ("Groups.minus_class.minus",eval_binop "#sub_"),
    1.87 +		Rule.Calc ("Groups.times_class.times",eval_binop "#mult_"),
    1.88  		(*  Dont use  
    1.89 -		 Celem.Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),		
    1.90 -		 Celem.Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"),
    1.91 +		 Rule.Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),		
    1.92 +		 Rule.Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"),
    1.93  		 *)
    1.94 -		Celem.Calc ("Atools.pow" ,eval_binop "#power_")
    1.95 +		Rule.Calc ("Atools.pow" ,eval_binop "#power_")
    1.96  		],
    1.97 -       scr = Celem.EmptyScr});
    1.98 +       scr = Rule.EmptyScr});
    1.99  *}
   1.100  setup {* KEStore_Elems.add_rlss 
   1.101    [("LinPoly_simplify", (Context.theory_name @{theory}, LinPoly_simplify))] *}
   1.102 @@ -99,20 +99,20 @@
   1.103  
   1.104  (*isolate the bound variable in an linear equation; 'bdv' is a meta-constant*)
   1.105  val LinEq_simplify = prep_rls'(
   1.106 -Celem.Rls {id = "LinEq_simplify", preconds = [],
   1.107 -     rew_ord = ("e_rew_ord", Celem.e_rew_ord),
   1.108 +Rule.Rls {id = "LinEq_simplify", preconds = [],
   1.109 +     rew_ord = ("e_rew_ord", Rule.e_rew_ord),
   1.110       erls = LinEq_erls,
   1.111 -     srls = Celem.Erls,
   1.112 +     srls = Rule.Erls,
   1.113       calc = [], errpatts = [],
   1.114       rules = [
   1.115 -	      Celem.Thm("lin_isolate_add1",TermC.num_str @{thm lin_isolate_add1}), 
   1.116 +	      Rule.Thm("lin_isolate_add1",TermC.num_str @{thm lin_isolate_add1}), 
   1.117  	      (* a+bx=0 -> bx=-a *)
   1.118 -	      Celem.Thm("lin_isolate_add2",TermC.num_str @{thm lin_isolate_add2}), 
   1.119 +	      Rule.Thm("lin_isolate_add2",TermC.num_str @{thm lin_isolate_add2}), 
   1.120  	      (* a+ x=0 ->  x=-a *)
   1.121 -	      Celem.Thm("lin_isolate_div",TermC.num_str @{thm lin_isolate_div})    
   1.122 +	      Rule.Thm("lin_isolate_div",TermC.num_str @{thm lin_isolate_div})    
   1.123  	      (*   bx=c -> x=c/b *)  
   1.124  	      ],
   1.125 -     scr = Celem.EmptyScr});
   1.126 +     scr = Rule.EmptyScr});
   1.127  *}
   1.128  setup {* KEStore_Elems.add_rlss 
   1.129    [("LinEq_simplify", (Context.theory_name @{theory}, LinEq_simplify))] *}
   1.130 @@ -135,7 +135,7 @@
   1.131  setup {* KEStore_Elems.add_mets
   1.132    [Specify.prep_met thy "met_eqlin" [] Celem.e_metID
   1.133        (["LinEq"], [],
   1.134 -        {rew_ord' = "tless_true",rls' = Atools_erls,calc = [], srls = Celem.e_rls, prls = Celem.e_rls,
   1.135 +        {rew_ord' = "tless_true",rls' = Atools_erls,calc = [], srls = Rule.e_rls, prls = Rule.e_rls,
   1.136            crls = LinEq_crls, errpats = [], nrls = norm_Poly},
   1.137          "empty_script"),
   1.138      (* ansprechen mit ["LinEq","solve_univar_equation"] *)
   1.139 @@ -144,7 +144,7 @@
   1.140          [("#Given", ["equality e_e", "solveFor v_v"]),
   1.141            ("#Where", ["Not ((lhs e_e) is_polyrat_in v_v)", "((lhs e_e)  has_degree_in v_v) = 1"]),
   1.142            ("#Find",  ["solutions v_v'i'"])],
   1.143 -        {rew_ord' = "termlessI", rls' = LinEq_erls, srls = Celem.e_rls, prls = LinEq_prls, calc = [],
   1.144 +        {rew_ord' = "termlessI", rls' = LinEq_erls, srls = Rule.e_rls, prls = LinEq_prls, calc = [],
   1.145            crls = LinEq_crls, errpats = [], nrls = norm_Poly},
   1.146          "Script Solve_lineq_equation (e_e::bool) (v_v::real) =                 " ^
   1.147            "(let e_e =((Try         (Rewrite      all_left           False)) @@   " ^