separate Rule_Set from Rule
authorWalther Neuper <walther.neuper@jku.at>
Sat, 04 Apr 2020 12:11:32 +0200
changeset 59850f3cac3053e7b
parent 59849 d82a32869f27
child 59851 4dd533681fef
separate Rule_Set from Rule
src/Tools/isac/BridgeLibisabelle/datatypes.sml
src/Tools/isac/BridgeLibisabelle/pbl-met-hierarchy.sml
src/Tools/isac/BridgeLibisabelle/thy-hierarchy.sml
src/Tools/isac/Build_Isac.thy
src/Tools/isac/CalcElements/KEStore.thy
src/Tools/isac/CalcElements/calcelems.sml
src/Tools/isac/CalcElements/rule-def.sml
src/Tools/isac/CalcElements/rule-set.sml
src/Tools/isac/CalcElements/rule.sml
src/Tools/isac/Interpret/error-pattern.sml
src/Tools/isac/Interpret/istate.sml
src/Tools/isac/Interpret/li-tool.sml
src/Tools/isac/Interpret/lucas-interpreter.sml
src/Tools/isac/Interpret/rewtools.sml
src/Tools/isac/Knowledge/AlgEin.thy
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/DiophantEq.thy
src/Tools/isac/Knowledge/EqSystem.thy
src/Tools/isac/Knowledge/Equation.thy
src/Tools/isac/Knowledge/InsSort.thy
src/Tools/isac/Knowledge/Integrate.thy
src/Tools/isac/Knowledge/Inverse_Z_Transform.thy
src/Tools/isac/Knowledge/LinEq.thy
src/Tools/isac/Knowledge/LogExp.thy
src/Tools/isac/Knowledge/Partial_Fractions.thy
src/Tools/isac/Knowledge/Poly.thy
src/Tools/isac/Knowledge/PolyEq.thy
src/Tools/isac/Knowledge/PolyMinus.thy
src/Tools/isac/Knowledge/RatEq.thy
src/Tools/isac/Knowledge/Rational-WN.sml
src/Tools/isac/Knowledge/Rational.thy
src/Tools/isac/Knowledge/Root.thy
src/Tools/isac/Knowledge/RootEq.thy
src/Tools/isac/Knowledge/RootRat.thy
src/Tools/isac/Knowledge/RootRatEq.thy
src/Tools/isac/Knowledge/Simplify.thy
src/Tools/isac/Knowledge/Test.thy
src/Tools/isac/Knowledge/Test_Build_Thydata.thy
src/Tools/isac/MathEngBasic/ctree-basic.sml
src/Tools/isac/MathEngBasic/istate-def.sml
src/Tools/isac/MathEngBasic/mstools.sml
src/Tools/isac/MathEngBasic/tactic.sml
src/Tools/isac/MathEngine/detail-step.sml
src/Tools/isac/ProgLang/Auto_Prog.thy
src/Tools/isac/ProgLang/ListC.thy
src/Tools/isac/ProgLang/Prog_Expr.thy
src/Tools/isac/ProgLang/calculate.sml
src/Tools/isac/ProgLang/rewrite.sml
src/Tools/isac/Specify/appl.sml
src/Tools/isac/Specify/generate.sml
src/Tools/isac/Specify/ptyps.sml
src/Tools/isac/TODO.thy
test/Tools/isac/ADDTESTS/accumulate-val/Thy_1.thy
test/Tools/isac/ADDTESTS/accumulate-val/Thy_2.thy
test/Tools/isac/ADDTESTS/accumulate-val/Thy_2b.thy
test/Tools/isac/ADDTESTS/accumulate-val/Thy_3.thy
test/Tools/isac/ADDTESTS/accumulate-val/Thy_4.thy
test/Tools/isac/ADDTESTS/accumulate-val/Thy_5.thy
test/Tools/isac/ADDTESTS/accumulate-val/Thy_All.thy
test/Tools/isac/ADDTESTS/accumulate-val/lucas_interpreter.sml
test/Tools/isac/Interpret/ptyps.thy
test/Tools/isac/Knowledge/biegelinie-4.sml
test/Tools/isac/Knowledge/integrate.thy
test/Tools/isac/MathEngBasic/tactic.sml
test/Tools/isac/Minisubpbl/200-start-method.sml
test/Tools/isac/Minisubpbl/250-Rewrite_Set-from-method.sml
test/Tools/isac/Minisubpbl/800-append-on-Frm.sml
test/Tools/isac/ProgLang/auto_prog.sml
test/Tools/isac/ProgLang/calculate.thy
test/Tools/isac/ProgLang/rewrite.sml
test/Tools/isac/Test_Isac_Short.thy
     1.1 --- a/src/Tools/isac/BridgeLibisabelle/datatypes.sml	Wed Apr 01 19:20:05 2020 +0200
     1.2 +++ b/src/Tools/isac/BridgeLibisabelle/datatypes.sml	Sat Apr 04 12:11:32 2020 +0200
     1.3 @@ -6,8 +6,8 @@
     1.4  signature DATATYPES = (*TODO: redo with xml_of/to *)
     1.5    sig
     1.6      val authors2xml : int -> string -> string list -> Celem.xml
     1.7 -    val calc2xml : int -> Rule.thyID * Rule.calc -> Celem.xml
     1.8 -    val calcrefs2xml : int -> Rule.thyID * Rule.calc list -> Celem.xml
     1.9 +    val calc2xml : int -> Rule.thyID * Rule_Set.calc -> Celem.xml
    1.10 +    val calcrefs2xml : int -> Rule.thyID * Rule_Set.calc list -> Celem.xml
    1.11      val contthy2xml : int -> Rtools.contthy -> Celem.xml
    1.12      val extref2xml : int -> string -> string -> Celem.xml
    1.13      val filterpbl :
    1.14 @@ -37,7 +37,7 @@
    1.15      val posterms2xml : int -> (Pos.pos' * term) list -> Celem.xml
    1.16      val precond2xml : int -> bool * Term.term -> Celem.xml
    1.17      val preconds2xml : int -> (bool * Term.term) list -> Celem.xml
    1.18 -    val rls2xml : int -> Rule.thyID * Rule.rls -> Celem.xml
    1.19 +    val rls2xml : int -> Rule.thyID * Rule_Set.rls -> Celem.xml
    1.20      val rule2xml : int -> Celem.guh -> Rule.rule -> Celem.xml
    1.21      val rules2xml : int -> Celem.guh -> Rule.rule list -> Celem.xml
    1.22      val scr2xml : int -> Program.T -> Celem.xml
    1.23 @@ -112,7 +112,7 @@
    1.24  *)
    1.25    | rule2xml _ _ (Rule.Cal1 (_(*termop*), _)) = ""
    1.26    | rule2xml j thyID (Rule.Rls_ rls) =
    1.27 -      let val rls' = (#id o Rule.rep_rls) rls
    1.28 +      let val rls' = (#id o Rule_Set.rep_rls) rls
    1.29        in
    1.30          indt j ^ "<RULE>\n" ^
    1.31          indt (j+i) ^ "<TAG> Ruleset </TAG>\n" ^
    1.32 @@ -244,23 +244,23 @@
    1.33      indt (j+i) ^"</ORDER>\n" ^
    1.34      indt (j+i) ^"<ERLS>\n" ^
    1.35      indt (j+2*i) ^ "<TAG> Ruleset </TAG>\n" ^
    1.36 -    indt (j+2*i) ^ "<STRING> " ^ Rule.id_rls erls ^ " </STRING>\n" ^
    1.37 +    indt (j+2*i) ^ "<STRING> " ^ Rule_Set.id_rls erls ^ " </STRING>\n" ^
    1.38      indt (j+2*i) ^ "<GUH> " ^ Celem.rls2guh ("IsacKnowledge", thyID) 
    1.39 -				     (Rule.id_rls erls) ^ " </GUH>\n" ^
    1.40 +				     (Rule_Set.id_rls erls) ^ " </GUH>\n" ^
    1.41      indt (j+i) ^"</ERLS>\n" ^
    1.42      indt (j+i) ^"<SRLS>\n" ^
    1.43      indt (j+2*i) ^ "<TAG> Ruleset </TAG>\n" ^
    1.44 -    indt (j+2*i) ^ "<STRING> " ^ Rule.id_rls erls ^ " </STRING>\n" ^
    1.45 +    indt (j+2*i) ^ "<STRING> " ^ Rule_Set.id_rls erls ^ " </STRING>\n" ^
    1.46      indt (j+2*i) ^ "<GUH> " ^ Celem.rls2guh ("IsacKnowledge", thyID) 
    1.47 -				     (Rule.id_rls srls) ^ " </GUH>\n" ^
    1.48 +				     (Rule_Set.id_rls srls) ^ " </GUH>\n" ^
    1.49      indt (j+i) ^"</SRLS>\n" ^
    1.50      calcrefs2xml (j+i) (thyID, calc) ^
    1.51      scr2xml (j+i) scr ^
    1.52      indt j ^"</RULESET>\n";
    1.53 -fun rls2xml j (thyID, Rule.Erls) = rls2xml j (thyID, Rule.e_rls)
    1.54 -  | rls2xml j (thyID, Rule.Rls data) = rls2xm j (thyID, "Rls", data)
    1.55 -  | rls2xml j (thyID, Rule.Seq data) = rls2xm j (thyID, "Seq", data)
    1.56 -  | rls2xml j (thyID, Rule.Rrls {id, prepat, rew_ord=(ord,_), erls, calc, errpatts, scr}) = 
    1.57 +fun rls2xml j (thyID, Rule_Set.Erls) = rls2xml j (thyID, Rule_Set.e_rls)
    1.58 +  | rls2xml j (thyID, Rule_Set.Rls data) = rls2xm j (thyID, "Rls", data)
    1.59 +  | rls2xml j (thyID, Rule_Set.Seq data) = rls2xm j (thyID, "Seq", data)
    1.60 +  | rls2xml j (thyID, Rule_Set.Rrls {id, prepat, rew_ord=(ord,_), erls, calc, errpatts, scr}) = 
    1.61      indt j ^"<RULESET>\n"^
    1.62      indt (j+i) ^"<ID> "^ id ^" </ID>\n"^
    1.63      indt (j+i) ^"<TYPE> Rrls </TYPE>\n"^
    1.64 @@ -275,8 +275,8 @@
    1.65      indt (j+i) ^"</ORDER>\n" ^
    1.66      indt (j+i) ^"<ERLS> " ^
    1.67      indt (j+2*i) ^ "<TAG> Ruleset </TAG>\n" ^
    1.68 -    indt (j+2*i) ^ "<STRING> " ^ Rule.id_rls erls ^ " </STRING>\n" ^
    1.69 -    indt (j+2*i) ^ "<GUH> " ^ Celem.rls2guh ("IsacKnowledge", thyID) (Rule.id_rls erls) ^ " </GUH>\n" ^
    1.70 +    indt (j+2*i) ^ "<STRING> " ^ Rule_Set.id_rls erls ^ " </STRING>\n" ^
    1.71 +    indt (j+2*i) ^ "<GUH> " ^ Celem.rls2guh ("IsacKnowledge", thyID) (Rule_Set.id_rls erls) ^ " </GUH>\n" ^
    1.72      indt (j+i) ^"</ERLS>\n" ^
    1.73      calcrefs2xml (j+i) (thyID, calc) ^
    1.74      indt (j+i) ^"<SCRIPT>\n"^ 
     2.1 --- a/src/Tools/isac/BridgeLibisabelle/pbl-met-hierarchy.sml	Wed Apr 01 19:20:05 2020 +0200
     2.2 +++ b/src/Tools/isac/BridgeLibisabelle/pbl-met-hierarchy.sml	Sat Apr 04 12:11:32 2020 +0200
     2.3 @@ -118,7 +118,7 @@
     2.4  fun pbl2xml (id:(*pblRD*)Celem.pblID) ({guh,mathauthors,init,cas,met,ppc,prls,
     2.5  			 thy,where_}:Celem.pbt) =
     2.6      let val thy' = Rule.theory2theory' thy
     2.7 -	val prls' = (#id o Rule.rep_rls) prls
     2.8 +	val prls' = (#id o Rule_Set.rep_rls) prls
     2.9      in "<NODECONTENT>\n" ^
    2.10         indt i ^ "<GUH> " ^ guh ^ " </GUH>\n" ^
    2.11         (((id2xml i)(* o rev*)) id) ^ 
    2.12 @@ -173,7 +173,7 @@
    2.13  	       | _ => (indt i) ^ "<METHODS>\n" ^
    2.14  		      foldl op^ ("", map (keref2xml (i+i) Celem.Met_) met) ^
    2.15  		      (indt i) ^ "</METHODS>\n") ^
    2.16 -    indt i ^ "<EVALPRECOND> " ^ (#id o Rule.rep_rls) 
    2.17 +    indt i ^ "<EVALPRECOND> " ^ (#id o Rule_Set.rep_rls) 
    2.18  				    prls ^ " </EVALPRECOND>\n" ^ 
    2.19      authors2xml i "MATHAUTHORS" mathauthors ^
    2.20      authors2xml i "COURSEDESIGNS" ["isac team 2006"] ^
    2.21 @@ -194,11 +194,11 @@
    2.22  fun met2xml (id: Celem.metID) ({guh,mathauthors,init,ppc,pre,scr,calc,
    2.23  			 crls,erls,errpats,nrls,prls,srls,rew_ord'}: Celem.met) =
    2.24      let val thy' = "Isac_Knowledge" (*FIXME.WN0607 get thy from met ?!?*)
    2.25 -	val crls' = (#id o Rule.rep_rls) crls
    2.26 -	val erls' = (#id o Rule.rep_rls) erls
    2.27 -	val nrls' = (#id o Rule.rep_rls) nrls
    2.28 -	val prls' = (#id o Rule.rep_rls) prls
    2.29 -	val srls' = (#id o Rule.rep_rls) srls
    2.30 +	val crls' = (#id o Rule_Set.rep_rls) crls
    2.31 +	val erls' = (#id o Rule_Set.rep_rls) erls
    2.32 +	val nrls' = (#id o Rule_Set.rep_rls) nrls
    2.33 +	val prls' = (#id o Rule_Set.rep_rls) prls
    2.34 +	val srls' = (#id o Rule_Set.rep_rls) srls
    2.35      in "<NODECONTENT>\n" ^
    2.36         indt i ^ "<GUH> " ^ guh ^ " </GUH>\n" ^
    2.37         id2xml i id ^ 
    2.38 @@ -238,12 +238,12 @@
    2.39      scr2xml i scr ^
    2.40      pattern2xml i ppc pre ^
    2.41      indt i ^ "<EXPLANATIONS> </EXPLANATIONS>\n" ^
    2.42 -    indt i ^ "<EVALPRECOND> " ^  (#id o Rule.rep_rls) prls ^ " </EVALPRECOND>\n" ^
    2.43 -    indt i ^ "<EVALCOND> " ^ (#id o Rule.rep_rls) erls ^ " </EVALCOND>\n" ^
    2.44 -    indt i ^ "<EVALLISTEXPR> "^ (#id o Rule.rep_rls) srls ^ " </EVALLISTEXPR>\n" ^
    2.45 -    indt i ^ "<CHECKELEMENTWISE> " ^ (#id o Rule.rep_rls) 
    2.46 +    indt i ^ "<EVALPRECOND> " ^  (#id o Rule_Set.rep_rls) prls ^ " </EVALPRECOND>\n" ^
    2.47 +    indt i ^ "<EVALCOND> " ^ (#id o Rule_Set.rep_rls) erls ^ " </EVALCOND>\n" ^
    2.48 +    indt i ^ "<EVALLISTEXPR> "^ (#id o Rule_Set.rep_rls) srls ^ " </EVALLISTEXPR>\n" ^
    2.49 +    indt i ^ "<CHECKELEMENTWISE> " ^ (#id o Rule_Set.rep_rls) 
    2.50  					 crls ^ " </CHECKELEMENTWISE>\n" ^
    2.51 -    indt i ^ "<NORMALFORM> "  ^ (#id o Rule.rep_rls) nrls ^ " </NORMALFORM>\n" ^
    2.52 +    indt i ^ "<NORMALFORM> "  ^ (#id o Rule_Set.rep_rls) nrls ^ " </NORMALFORM>\n" ^
    2.53      indt i ^ "<REWORDER> " ^ rew_ord' ^ " </REWORDER>\n" ^
    2.54      calcs2xmlOLD i calc ^
    2.55      authors2xml i "MATHAUTHORS" mathauthors ^
     3.1 --- a/src/Tools/isac/BridgeLibisabelle/thy-hierarchy.sml	Wed Apr 01 19:20:05 2020 +0200
     3.2 +++ b/src/Tools/isac/BridgeLibisabelle/thy-hierarchy.sml	Sat Apr 04 12:11:32 2020 +0200
     3.3 @@ -25,7 +25,7 @@
     3.4      in (theID, Celem.Hthm {guh = Celem.theID2guh theID, coursedesign = [], 
     3.5  		     mathauthors = ["isac-team"], fillpats = [], thm = thm})
     3.6      end;
     3.7 -fun makeHrls (part : string) (rls' : Rule.rls', thy_rls as (thyID, rls): Rule.thyID * Rule.rls) =
     3.8 +fun makeHrls (part : string) (rls' : Rule_Set.rls', thy_rls as (thyID, rls): Rule.thyID * Rule_Set.rls) =
     3.9      let val theID = [part, thyID,"Rulesets"] @ [rls'] : Celem.theID
    3.10      in (theID, Celem.Hrls {guh = Celem.theID2guh theID, coursedesign = [], 
    3.11  		     mathauthors = ["isac-team"], thy_rls = thy_rls})
    3.12 @@ -52,7 +52,7 @@
    3.13    else Rule.Thm (Thm.get_name_hint thm, thm)
    3.14  
    3.15  (* get all theorems from the list of rule-sets (defined in Knowledge) *)
    3.16 -fun thms_of_rlss thy rlss = (rlss : (Rule.rls' * (Rule.theory' * Rule.rls)) list)
    3.17 +fun thms_of_rlss thy rlss = (rlss : (Rule_Set.rls' * (Rule.theory' * Rule_Set.rls)) list)
    3.18    |> map (Rtools.thms_of_rls o #2 o #2)
    3.19    |> flat
    3.20    |> map (revert_sym thy)
    3.21 @@ -64,7 +64,7 @@
    3.22  
    3.23  fun collect_thms part thy =
    3.24    map (makeHthm (part, Context.theory_name thy)) (rev (thms_of thy))
    3.25 -fun collect_rlss part rlss thys = (rlss : (Rule.rls' * (Rule.thyID * Rule.rls)) list)
    3.26 +fun collect_rlss part rlss thys = (rlss : (Rule_Set.rls' * (Rule.thyID * Rule_Set.rls)) list)
    3.27    |> filter (fn (_, (thyID, _)) => member (op=) (map Context.theory_name thys) thyID)
    3.28    |> map (makeHrls part)
    3.29  fun collect_cals (part, thy') =
    3.30 @@ -221,7 +221,7 @@
    3.31  
    3.32  fun make_rls thy rls (mathauthors : Celem.authors) =
    3.33    let 
    3.34 -    val guh = Celem.rls2guh ("IsacKnowledge", Rule.theory2thyID thy) ((#id o Rule.rep_rls) rls)
    3.35 +    val guh = Celem.rls2guh ("IsacKnowledge", Rule.theory2thyID thy) ((#id o Rule_Set.rep_rls) rls)
    3.36      val theID = Rtools.guh2theID guh
    3.37      val the = Celem.Hrls {guh = guh, coursedesign = [], mathauthors = mathauthors,
    3.38  			thy_rls = (Rule.theory2thyID thy, rls)}
     4.1 --- a/src/Tools/isac/Build_Isac.thy	Wed Apr 01 19:20:05 2020 +0200
     4.2 +++ b/src/Tools/isac/Build_Isac.thy	Sat Apr 04 12:11:32 2020 +0200
     4.3 @@ -15,6 +15,7 @@
     4.4  imports
     4.5  (*  theory KEStore imports Complex_Main
     4.6        ML_file libraryC.sml
     4.7 +      ML_file "rule-def.sml"
     4.8        ML_file rule.sml
     4.9        ML_file calcelems.sml
    4.10    theory CalcElements imports KEStore
     5.1 --- a/src/Tools/isac/CalcElements/KEStore.thy	Wed Apr 01 19:20:05 2020 +0200
     5.2 +++ b/src/Tools/isac/CalcElements/KEStore.thy	Sat Apr 04 12:11:32 2020 +0200
     5.3 @@ -8,8 +8,8 @@
     5.4  ML_file libraryC.sml
     5.5  ML_file "rule-def.sml"
     5.6  ML_file rule.sml
     5.7 +ML_file "rule-set.sml"
     5.8  ML_file calcelems.sml
     5.9 -
    5.10  ML \<open>
    5.11  \<close> ML \<open>
    5.12  \<close> ML \<open>
    5.13 @@ -31,10 +31,10 @@
    5.14  *)
    5.15  signature KESTORE_ELEMS =
    5.16  sig
    5.17 -  val get_rlss: theory -> (Rule.rls' * (Rule.theory' * Rule.rls)) list
    5.18 -  val add_rlss: (Rule.rls' * (Rule.theory' * Rule.rls)) list -> theory -> theory
    5.19 -  val get_calcs: theory -> (Rule.prog_calcID * (Rule.calID * Rule.eval_fn)) list
    5.20 -  val add_calcs: (Rule.prog_calcID * (Rule.calID * Rule.eval_fn)) list -> theory -> theory
    5.21 +  val get_rlss: theory -> (Rule_Set.rls' * (Rule.theory' * Rule_Set.rls)) list
    5.22 +  val add_rlss: (Rule_Set.rls' * (Rule.theory' * Rule_Set.rls)) list -> theory -> theory
    5.23 +  val get_calcs: theory -> (Rule_Set.prog_calcID * (Rule.calID * Rule.eval_fn)) list
    5.24 +  val add_calcs: (Rule_Set.prog_calcID * (Rule.calID * Rule.eval_fn)) list -> theory -> theory
    5.25    val get_cas: theory -> Celem.cas_elem list
    5.26    val add_cas: Celem.cas_elem list -> theory -> theory
    5.27    val get_ptyps: theory -> Celem.ptyps
    5.28 @@ -53,22 +53,22 @@
    5.29    fun union_overwrite eq l1 l2 = fold (insert eq) l2 (*..swapped..*) l1;
    5.30  
    5.31    structure Data = Theory_Data (
    5.32 -    type T = (Rule.rls' * (Rule.theory' * Rule.rls)) list;
    5.33 +    type T = (Rule_Set.rls' * (Rule.theory' * Rule_Set.rls)) list;
    5.34      val empty = [];
    5.35      val extend = I;
    5.36 -    val merge = Celem.merge_rlss;
    5.37 +    val merge = Rule_Set.merge_rlss;
    5.38      );  
    5.39    fun get_rlss thy = Data.get thy
    5.40 -  fun add_rlss rlss = Data.map (union_overwrite Celem.rls_eq rlss)
    5.41 +  fun add_rlss rlss = Data.map (union_overwrite Rule_Set.rls_eq rlss)
    5.42  
    5.43    structure Data = Theory_Data (
    5.44 -    type T = (Rule.prog_calcID * (Rule.calID * Rule.eval_fn)) list;
    5.45 +    type T = (Rule_Set.prog_calcID * (Rule.calID * Rule.eval_fn)) list;
    5.46      val empty = [];
    5.47      val extend = I;
    5.48 -    val merge = merge Rule.calc_eq;
    5.49 +    val merge = merge Rule_Set.calc_eq;
    5.50      );                                                              
    5.51    fun get_calcs thy = Data.get thy
    5.52 -  fun add_calcs calcs = Data.map (union_overwrite Rule.calc_eq calcs)
    5.53 +  fun add_calcs calcs = Data.map (union_overwrite Rule_Set.calc_eq calcs)
    5.54  
    5.55    structure Data = Theory_Data (
    5.56      type T = (term * (Celem.spec * (term list -> (term * term list) list))) list;
    5.57 @@ -141,13 +141,13 @@
    5.58  ML \<open>
    5.59  val get_ref_thy = KEStore_Elems.get_ref_thy;
    5.60  
    5.61 -fun assoc_rls (rls' : Rule.rls') =
    5.62 +fun assoc_rls (rls' : Rule_Set.rls') =
    5.63    case AList.lookup (op =) (KEStore_Elems.get_rlss (Rule.Thy_Info_get_theory "Isac_Knowledge")) rls' of
    5.64      SOME (_, rls) => rls
    5.65    | NONE => raise ERROR ("rls \""^ rls' ^ "\" missing in KEStore.\n" ^
    5.66      "TODO exception hierarchy needs to be established.")
    5.67  
    5.68 -fun assoc_rls' thy (rls' : Rule.rls') =
    5.69 +fun assoc_rls' thy (rls' : Rule_Set.rls') =
    5.70    case AList.lookup (op =) (KEStore_Elems.get_rlss thy) rls' of
    5.71      SOME (_, rls) => rls
    5.72    | NONE => raise ERROR ("rls \""^ rls' ^ "\" missing in KEStore.\n" ^
    5.73 @@ -174,8 +174,8 @@
    5.74  fun get_thes () = get_ref_thy () |> KEStore_Elems.get_thes;
    5.75  \<close>
    5.76  setup \<open>KEStore_Elems.add_rlss 
    5.77 -  [("e_rls", (Context.theory_name @{theory}, Rule.e_rls)), 
    5.78 -  ("e_rrls", (Context.theory_name @{theory}, Rule.e_rrls))]\<close>
    5.79 +  [("e_rls", (Context.theory_name @{theory}, Rule_Set.e_rls)), 
    5.80 +  ("e_rrls", (Context.theory_name @{theory}, Rule_Set.e_rrls))]\<close>
    5.81  
    5.82  section \<open>determine sequence of main parts in thehier\<close>
    5.83  setup \<open>
    5.84 @@ -190,18 +190,18 @@
    5.85  
    5.86  section \<open>Functions for checking KEStore_Elems\<close>
    5.87  ML \<open>
    5.88 -fun short_string_of_rls Rule.Erls = "Erls"
    5.89 -  | short_string_of_rls (Rule.Rls {calc, rules, ...}) =
    5.90 +fun short_string_of_rls Rule_Set.Erls = "Erls"
    5.91 +  | short_string_of_rls (Rule_Set.Rls {calc, rules, ...}) =
    5.92      "Rls {#calc = " ^ string_of_int (length calc) ^
    5.93      ", #rules = " ^ string_of_int (length rules) ^ ", ..."
    5.94 -  | short_string_of_rls (Rule.Seq {calc, rules, ...}) =
    5.95 +  | short_string_of_rls (Rule_Set.Seq {calc, rules, ...}) =
    5.96      "Seq {#calc = " ^ string_of_int (length calc) ^
    5.97      ", #rules = " ^ string_of_int (length rules) ^ ", ..."
    5.98 -  | short_string_of_rls (Rule.Rrls _) = "Rrls {...}";
    5.99 +  | short_string_of_rls (Rule_Set.Rrls _) = "Rrls {...}";
   5.100  fun check_kestore_rls (rls', (thyID, rls)) =
   5.101    "(" ^ rls' ^ ", (" ^ thyID ^ ", " ^ short_string_of_rls rls ^ "))";
   5.102  
   5.103 -fun check_kestore_calc ((id, (c, _)) : Rule.calc)  = "(" ^ id ^ ", (" ^ c ^ ", fn))";
   5.104 +fun check_kestore_calc ((id, (c, _)) : Rule_Set.calc)  = "(" ^ id ^ ", (" ^ c ^ ", fn))";
   5.105  
   5.106  (* we avoid term_to_string''' defined later *)
   5.107  fun check_kestore_cas ((t, (s, _)) : Celem.cas_elem) =
     6.1 --- a/src/Tools/isac/CalcElements/calcelems.sml	Wed Apr 01 19:20:05 2020 +0200
     6.2 +++ b/src/Tools/isac/CalcElements/calcelems.sml	Sat Apr 04 12:11:32 2020 +0200
     6.3 @@ -24,15 +24,12 @@
     6.4  
     6.5      type fillpat
     6.6      datatype thydata
     6.7 -      = Hcal of {calc: Rule.calc, coursedesign: authors, guh: guh, mathauthors: authors}
     6.8 +      = Hcal of {calc: Rule_Set.calc, coursedesign: authors, guh: guh, mathauthors: authors}
     6.9        | Hord of {coursedesign: authors, guh: guh, mathauthors: authors, ord: Rule.subst -> term * term -> bool}
    6.10 -      | Hrls of {coursedesign: authors, guh: guh, mathauthors: authors, thy_rls: Rule.thyID * Rule.rls}
    6.11 +      | Hrls of {coursedesign: authors, guh: guh, mathauthors: authors, thy_rls: Rule.thyID * Rule_Set.rls}
    6.12        | Hthm of {coursedesign: authors, fillpats: fillpat list, guh: guh, mathauthors: authors, thm: thm}
    6.13        | Html of {coursedesign: authors, guh: guh, html: string, mathauthors: authors}
    6.14      type theID
    6.15 -    type rlss_elem
    6.16 -    val merge_rlss: rlss_elem list * rlss_elem list -> rlss_elem list
    6.17 -    val rls_eq: (''a * ('b * 'c)) * (''a * ('d * 'e)) -> bool
    6.18      type spec
    6.19      val cas_eq: cas_elem * cas_elem -> bool
    6.20      val e_Ptyp: pbt ptyp
    6.21 @@ -82,7 +79,7 @@
    6.22      val partID': Rule.theory' -> string
    6.23      val thm2guh: string * Rule.thyID -> thmID -> guh
    6.24      val thmID_of_derivation_name: string -> string
    6.25 -    val rls2guh: string * Rule.thyID -> Rule.rls' -> guh
    6.26 +    val rls2guh: string * Rule.thyID -> Rule_Set.rls' -> guh
    6.27      val theID2guh: theID -> guh
    6.28      eqtype fillpatID
    6.29      type pbt_ = string * (term * term)
    6.30 @@ -112,8 +109,8 @@
    6.31  ( *\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*)
    6.32  
    6.33  (*----- unused code, kept as hints to design ideas ---------------------------------------------*)
    6.34 -val overwritelthy: theory -> (Rule.rls' * (string * Rule.rls)) list * (Rule.rls' * Rule.rls) list ->
    6.35 -  (Rule.rls' * (string * Rule.rls)) list  end
    6.36 +val overwritelthy: theory -> (Rule_Set.rls' * (string * Rule_Set.rls)) list * (Rule_Set.rls' * Rule_Set.rls) list ->
    6.37 +  (Rule_Set.rls' * (string * Rule_Set.rls)) list  end
    6.38  
    6.39  (**)
    6.40  structure Celem(**): CALC_ELEMENT(**) =
    6.41 @@ -288,8 +285,8 @@
    6.42    Html of {guh: guh, coursedesign: authors, mathauthors: authors, html: string}
    6.43  | Hthm of {guh: guh, coursedesign: authors, mathauthors: authors, fillpats: fillpat list,
    6.44     thm: thm} (* here no sym_thm, thus no thmID required *)
    6.45 -| Hrls of {guh: guh, coursedesign: authors, mathauthors: authors, thy_rls: (Rule.thyID * Rule.rls)}
    6.46 -| Hcal of {guh: guh, coursedesign: authors, mathauthors: authors, calc: Rule.calc}
    6.47 +| Hrls of {guh: guh, coursedesign: authors, mathauthors: authors, thy_rls: (Rule.thyID * Rule_Set.rls)}
    6.48 +| Hcal of {guh: guh, coursedesign: authors, mathauthors: authors, calc: Rule_Set.calc}
    6.49  | Hord of {guh: guh, coursedesign: authors, mathauthors: authors,
    6.50      ord: (Rule.subst -> (term * term) -> bool)};
    6.51  fun the2str (Html {guh, ...}) = guh
    6.52 @@ -399,25 +396,6 @@
    6.53  type filepath = string;
    6.54  type filename = string;
    6.55  
    6.56 -
    6.57 -
    6.58 -(* datastructure for KEStore_Elems, intermediate for thehier *)
    6.59 -type rlss_elem = 
    6.60 -  (Rule.rls' *     (* identifier unique within Isac *)
    6.61 -  (Rule.theory' *  (* just for assignment in thehier, not appropriate for parsing etc *)
    6.62 -    Rule.rls))     (* ((#id o rep_rls) rls) = rls'   by coding discipline *)
    6.63 -fun rls_eq ((id1, (_, _)), (id2, (_, _))) = id1 = id2
    6.64 -
    6.65 -fun insert_merge_rls (re as (id, (thyID, r1)) : rlss_elem) ys = 
    6.66 -    case get_index (fn y => if curry rls_eq re y then SOME y else NONE) ys of
    6.67 -      NONE => re :: ys
    6.68 -    | SOME (i, (_, (_, r2))) => 
    6.69 -      let
    6.70 -        val r12 = Rule.merge_rls id r1 r2
    6.71 -      in list_update ys i (id, (thyID, r12)) end
    6.72 -fun merge_rlss (s1, s2) = fold insert_merge_rls s1 s2;
    6.73 -
    6.74 -
    6.75  fun assoc_thy thy =
    6.76      if thy = "e_domID"
    6.77      then (Rule.Thy_Info_get_theory "Base_Tools") (*lower bound of Knowledge*)
    6.78 @@ -433,7 +411,7 @@
    6.79     in scripts...
    6.80     actually a hack to get alltogether run again with minimal effort *)
    6.81  fun insthy thy' (rls', rls) = (rls', (thy', rls));
    6.82 -fun overwritelthy thy (al, bl: (Rule.rls' * Rule.rls) list) =
    6.83 +fun overwritelthy thy (al, bl: (Rule_Set.rls' * Rule_Set.rls) list) =
    6.84      let val bl' = map (insthy ((get_thy o Rule.theory2theory') thy)) bl
    6.85      in overwritel (al, bl') end;
    6.86  
    6.87 @@ -482,7 +460,7 @@
    6.88    cas : term option,  (* 'CAS-command'                                                   *)
    6.89    met : metID list,   (* methods solving the pbt                                         *)
    6.90  (*TODO: abstract to ?pre_model?...*)
    6.91 -  prls : Rule.rls,    (* for preds in where_                                             *)
    6.92 +  prls : Rule_Set.rls,    (* for preds in where_                                             *)
    6.93    where_ : term list, (* where - predicates                                              *)
    6.94    ppc : pat list      (* this is the model-pattern; 
    6.95                           it contains "#Given","#Where","#Find","#Relate"-patterns
    6.96 @@ -490,13 +468,13 @@
    6.97  }   
    6.98  
    6.99  val e_pbt = {guh = "pbl_empty", mathauthors = [], init = e_pblID, thy = Thy_Info.get_theory "Pure",
   6.100 -  cas = NONE, prls = Rule.Erls, where_ = [], ppc = [], met = []} : pbt
   6.101 +  cas = NONE, prls = Rule_Set.Erls, where_ = [], ppc = [], met = []} : pbt
   6.102  fun pbt2str ({cas = cas', guh = guh', init = init', mathauthors = ma', met = met', ppc = ppc',
   6.103        prls = prls', thy = thy', where_ = w'} : pbt)
   6.104      = "{cas = " ^ (Rule.termopt2str cas') ^  ", guh = \"" ^ guh'  ^ "\", init = "
   6.105        ^ (strs2str init') ^ ", mathauthors = " ^ (strs2str ma' |> quote) ^ ", met = "
   6.106        ^ (strslist2strs met') ^ ", ppc = " ^ pats2str ppc' ^ ", prls = "
   6.107 -      ^ (Rule.rls2str prls' |> quote) ^ ", thy = {" ^ (Rule.theory2str thy') ^ "}, where_ = "
   6.108 +      ^ (Rule_Set.rls2str prls' |> quote) ^ ", thy = {" ^ (Rule.theory2str thy') ^ "}, where_ = "
   6.109        ^ (Rule.terms2str w') ^ "}" |> linefeed;
   6.110  fun pbts2str pbts = map pbt2str pbts |> list2str;
   6.111  
   6.112 @@ -564,19 +542,19 @@
   6.113       {guh        : guh,             (* unique within this isac-knowledge             *)
   6.114        mathauthors: string list,     (* copyright                                     *)
   6.115        init       : pblID,           (* WN060721 introduced mistakenly--TODO.REMOVE!  *)
   6.116 -      rew_ord'   : Rule.rew_ord',   (* for rules in Detail                           
   6.117 +      rew_ord'   : Rule_Def.rew_ord',  (* for rules in Detail                           
   6.118  			                                 TODO.WN0509 store fun itself, see 'type pbt'  *)
   6.119 -      erls       : Rule.rls,        (* the eval_rls for cond. in rules FIXME "rls'   
   6.120 +      erls       : Rule_Set.rls,        (* the eval_rls for cond. in rules FIXME "rls'   
   6.121  				                               instead erls in "fun prep_met"                *)
   6.122 -      srls       : Rule.rls,        (* for evaluating list expressions in scr        *)
   6.123 -      crls       : Rule.rls,        (* for check_elementwise, ie. formulae in calc.  *)
   6.124 -      nrls       : Rule.rls,        (* canonical simplifier specific for this met    *)
   6.125 +      srls       : Rule_Set.rls,        (* for evaluating list expressions in scr        *)
   6.126 +      crls       : Rule_Set.rls,        (* for check_elementwise, ie. formulae in calc.  *)
   6.127 +      nrls       : Rule_Set.rls,        (* canonical simplifier specific for this met    *)
   6.128        errpats    : Rule.errpat list,(* error patterns expected in this method        *)
   6.129 -      calc       : Rule.calc list,  (* Theory_Data in fun prep_met                   *)
   6.130 +      calc       : Rule_Set.calc list, (* Theory_Data in fun prep_met                   *)
   6.131        (*branch   : TransitiveB set in append_problem at generation ob pblobj         *)
   6.132        scr        : Rule.program,    (* progam, empty as @{thm refl} or Rfuns         *)
   6.133  (*TODO: abstract to ?pre_model?...*)
   6.134 -      prls       : Rule.rls,        (* for evaluating predicates in modelpattern     *)
   6.135 +      prls       : Rule_Set.rls,        (* for evaluating predicates in modelpattern     *)
   6.136        ppc        : pat list,        (* items in given, find, relate;
   6.137  	      items (in "#Find") which need not occur in the arg-list of a SubProblem
   6.138          are 'copy-named' with an identifier "*'.'".
   6.139 @@ -585,8 +563,8 @@
   6.140        pre        : term list        (* preconditions in where                        *)
   6.141  	   };
   6.142  val e_met = {guh = "met_empty", mathauthors = [], init = e_metID, rew_ord' = "e_rew_ord'",
   6.143 -	erls = Rule.e_rls, srls = Rule.e_rls, prls = Rule.e_rls, calc = [], crls = Rule.e_rls,
   6.144 -	errpats = [], nrls = Rule.e_rls, ppc = [], pre = [], scr = Rule.EmptyScr};
   6.145 +	erls = Rule_Set.e_rls, srls = Rule_Set.e_rls, prls = Rule_Set.e_rls, calc = [], crls = Rule_Set.e_rls,
   6.146 +	errpats = [], nrls = Rule_Set.e_rls, ppc = [], pre = [], scr = Rule.EmptyScr};
   6.147  val e_Mets = Ptyp ("e_metID", [e_met],[]);
   6.148  
   6.149  type mets = (met ptyp) list;
   6.150 @@ -636,14 +614,14 @@
   6.151      let
   6.152        val rls' = 
   6.153          case rls of
   6.154 -          Rule.Rls {id, preconds, rew_ord, erls, srls, calc, rules, scr, ...}
   6.155 -          => Rule.Rls {id = id, preconds = preconds, rew_ord = rew_ord, erls = erls, srls = srls,
   6.156 +          Rule_Set.Rls {id, preconds, rew_ord, erls, srls, calc, rules, scr, ...}
   6.157 +          => Rule_Set.Rls {id = id, preconds = preconds, rew_ord = rew_ord, erls = erls, srls = srls,
   6.158                 calc = calc, rules = rules, scr = scr, errpatts = errpatIDs}
   6.159 -        | Rule.Seq {id, preconds, rew_ord, erls, srls, calc, rules, scr, ...}
   6.160 -          => Rule.Seq {id = id, preconds = preconds, rew_ord = rew_ord, erls = erls, srls = srls,
   6.161 +        | Rule_Set.Seq {id, preconds, rew_ord, erls, srls, calc, rules, scr, ...}
   6.162 +          => Rule_Set.Seq {id = id, preconds = preconds, rew_ord = rew_ord, erls = erls, srls = srls,
   6.163                 calc = calc, rules = rules, scr = scr, errpatts = errpatIDs}
   6.164 -        | Rule.Rrls {id, prepat, rew_ord, erls, calc, scr, ...}
   6.165 -          => Rule.Rrls {id = id, prepat = prepat, rew_ord = rew_ord, erls = erls, calc = calc,
   6.166 +        | Rule_Set.Rrls {id, prepat, rew_ord, erls, calc, scr, ...}
   6.167 +          => Rule_Set.Rrls {id = id, prepat = prepat, rew_ord = rew_ord, erls = erls, calc = calc,
   6.168                 scr = scr, errpatts = errpatIDs}
   6.169          | Erls => Erls
   6.170      in
     7.1 --- a/src/Tools/isac/CalcElements/rule-def.sml	Wed Apr 01 19:20:05 2020 +0200
     7.2 +++ b/src/Tools/isac/CalcElements/rule-def.sml	Sat Apr 04 12:11:32 2020 +0200
     7.3 @@ -2,51 +2,51 @@
     7.4     Author: Walther Neuper
     7.5     (c) due to copyright terms
     7.6  
     7.7 -Separate the mutual recursive definition from individual items specified later.
     7.8 +A minimum of code for a mutual recursive datatype definition
     7.9 +awaiting individual specification later.
    7.10  *)
    7.11  signature RULE_DEFINITION =
    7.12 -  sig
    7.13 +sig
    7.14 +  type calc
    7.15 +  eqtype calID
    7.16 +  eqtype errpatID
    7.17 +  type rew_ord
    7.18 +  type rew_ord'
    7.19 +  type rew_ord_
    7.20 +  type eval_fn
    7.21  
    7.22 -    type calc                                       (*struct:   sig: OK in rule*)
    7.23 -    eqtype calID                                    (*struct:   sig: NOT ok in rule*)
    7.24 -    eqtype errpatID                                 (*struct:   sig: *)
    7.25 -    type rew_ord                                    (*struct:   sig: *)
    7.26 -    type eval_fn                                    (*struct:   sig: OK in rule*)
    7.27 -    val e_evalfn: eval_fn                           (*struct:   sig: (*NOT ok in rule*)*)
    7.28 -    datatype rls                                                                 (*OK*)
    7.29 -      =  Erls
    7.30 -       | Rls of {calc: calc list, erls: rls, errpatts: errpatID list, id: string,
    7.31 -         preconds: term list, rew_ord: rew_ord, rules: rule list, scr: program, srls: rls}
    7.32 -       | Seq of {calc: calc list, erls: rls, errpatts: errpatID list, id: string,
    7.33 -         preconds: term list, rew_ord: rew_ord, rules: rule list, scr: program, srls: rls}
    7.34 -       | Rrls of {calc: calc list, erls: rls, errpatts: errpatID list, id: string,
    7.35 -         prepat: (term list * term) list, rew_ord: rew_ord, scr: program}
    7.36 -    and rule = Cal1 of string * eval_fn | Num_Calc of string * eval_fn | Erule  (*OK*)
    7.37 -       | Rls_ of rls | Thm of string * thm
    7.38 -    and program                                                                 (*OK*)
    7.39 -      =  EmptyScr
    7.40 -       | Prog of term
    7.41 -       | Rfuns of
    7.42 -           {attach_form: rule list list -> term -> term -> (rule * (term * term list)) list,
    7.43 -            init_state: term -> term * term * rule list list * (rule * (term * term list)) list,
    7.44 -            locate_rule: rule list list -> term -> rule -> (rule * (term * term list)) list,
    7.45 -            next_rule: rule list list -> term -> rule option, normal_form: term ->
    7.46 -            (term * term list) option}
    7.47 -
    7.48 +  datatype rls =
    7.49 +       Erls
    7.50 +     | Rls of {calc: calc list, erls: rls, errpatts: errpatID list, id: string,
    7.51 +       preconds: term list, rew_ord: rew_ord, rules: rule list, scr: program, srls: rls}
    7.52 +     | Seq of {calc: calc list, erls: rls, errpatts: errpatID list, id: string,
    7.53 +       preconds: term list, rew_ord: rew_ord, rules: rule list, scr: program, srls: rls}
    7.54 +     | Rrls of {calc: calc list, erls: rls, errpatts: errpatID list, id: string,
    7.55 +       prepat: (term list * term) list, rew_ord: rew_ord, scr: program}
    7.56 +  and rule = Cal1 of string * eval_fn | Num_Calc of string * eval_fn | Erule
    7.57 +     | Rls_ of rls | Thm of string * thm
    7.58 +  and program =
    7.59 +       EmptyScr
    7.60 +     | Prog of term
    7.61 +     | Rfuns of
    7.62 +         {attach_form: rule list list -> term -> term -> (rule * (term * term list)) list,
    7.63 +          init_state: term -> term * term * rule list list * (rule * (term * term list)) list,
    7.64 +          locate_rule: rule list list -> term -> rule -> (rule * (term * term list)) list,
    7.65 +          next_rule: rule list list -> term -> rule option, normal_form: term ->
    7.66 +          (term * term list) option}
    7.67  (* ---- for tests only: shifted from below to remove the Warning "unused" at fun.def. --------- *)
    7.68    (*NONE*)
    7.69  (*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\* )
    7.70    (*NONE*)
    7.71  ( *\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*)
    7.72 -(*----- unused code, kept as hints to design ideas ---------------------------------------------*)
    7.73 -  end
    7.74 +end
    7.75  
    7.76  (**)
    7.77  structure Rule_Def(**): RULE_DEFINITION(**) =
    7.78  struct
    7.79  (**)
    7.80  
    7.81 -type calID = string;
    7.82 +
    7.83  (* eval function calling sml code during rewriting.
    7.84  Unifying "type cal" and "type calc" would make Lucas-Interpretation more efficient,
    7.85    see "fun rule2stac": instead of 
    7.86 @@ -54,20 +54,12 @@
    7.87    would be better
    7.88      Num_Calc: prog_calcID * (calID * eval_fn)) -> rule*)
    7.89  type eval_fn = (string -> term -> theory -> (string * term) option);
    7.90 -fun e_evalfn (_ : 'a) (_ : term) (_ : theory) = NONE : (string * term) option;
    7.91 -
    7.92 -type subst = (term * term) list;
    7.93  
    7.94  type rew_ord' = string;
    7.95 -type rew_ord_ = subst -> Term.term * Term.term -> bool;
    7.96 +type rew_ord_ = (term * term) list -> term * term -> bool;
    7.97  type rew_ord = rew_ord' * rew_ord_;
    7.98 -val e_rew_ord' = "e_rew_ord" : rew_ord';
    7.99 -fun dummy_ord (_: subst) (_: term, _: term) = true;
   7.100 -val e_rew_ord_ = dummy_ord;
   7.101 -val e_rew_ord = dummy_ord; (* TODO.WN071231 clarify identifiers..e_rew_ordX*)
   7.102 -val e_rew_ordX = (e_rew_ord', e_rew_ord_);
   7.103  
   7.104 -(* op in isa-term "Const(op,_)" *)
   7.105 +type calID = string;
   7.106  type cal = calID * eval_fn;
   7.107  type prog_calcID = string;
   7.108  type calc = (prog_calcID * cal);
   7.109 @@ -180,5 +172,6 @@
   7.110       errpatts : errpatID list,(*dialog-authoring in Build_Thydata.thy*)              
   7.111       scr      : program};      (* Rfuns {...}  (how to restrict type ???)                *)
   7.112  
   7.113 +
   7.114  (**)end(**)
   7.115  
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/src/Tools/isac/CalcElements/rule-set.sml	Sat Apr 04 12:11:32 2020 +0200
     8.3 @@ -0,0 +1,225 @@
     8.4 +(* Title:  KEStore/rule-set.sml
     8.5 +   Author: Walther Neuper
     8.6 +   (c) due to copyright terms
     8.7 +
     8.8 +In ISAC a Rule_Set serves rewriting. KEStore holds all rule-sets for ubiquitous access.
     8.9 +*)
    8.10 +signature RULE_SET =
    8.11 +sig
    8.12 +  datatype rls = datatype Rule_Def.rls
    8.13 +  eqtype rls'
    8.14 +
    8.15 +  type calc = Rule_Def.calc                                                    (*..from Rule_Def*)
    8.16 +  val e_rls: rls
    8.17 +
    8.18 +  type rrlsstate = term * term * Rule_Def.rule list list * (Rule_Def.rule * (term * term list)) list
    8.19 +  val e_rrlsstate: rrlsstate
    8.20 +  val e_rrls: rls
    8.21 +  type rlss_elem
    8.22 +
    8.23 +  val append_rls: string -> rls -> Rule_Def.rule list -> rls
    8.24 +  val rep_rls: rls -> {calc: calc list, erls: rls, errpats: Rule_Def.errpatID list, id: string,
    8.25 +    preconds: term list, rew_ord: Rule_Def.rew_ord, rules: Rule_Def.rule list, scr: Rule_Def.program, srls: rls}
    8.26 +
    8.27 +  val rls2str: Rule_Def.rls -> string
    8.28 +  val id_rls: Rule_Def.rls -> string
    8.29 +  val id_rule: Rule_Def.rule -> string
    8.30 +  val eq_rule: Rule_Def.rule * Rule_Def.rule -> bool
    8.31 +
    8.32 +  val merge_rls: string -> rls -> rls -> rls
    8.33 +  val merge_rlss: rlss_elem list * rlss_elem list -> rlss_elem list
    8.34 +  val remove_rls: string -> rls ->  Rule_Def.rule list -> rls
    8.35 +
    8.36 +  val rule2str: Rule_Def.rule -> string
    8.37 +  val rule2str': Rule_Def.rule -> string
    8.38 +
    8.39 +  eqtype prog_calcID
    8.40 +  type cal
    8.41 +  type calc_elem
    8.42 +  val calc_eq: calc_elem * calc_elem -> bool
    8.43 +  val e_evalfn: Rule_Def.eval_fn
    8.44 +
    8.45 +  val get_rules: rls -> Rule_Def.rule list
    8.46 +  val rls_eq: (''a * ('b * 'c)) * (''a * ('d * 'e)) -> bool
    8.47 +
    8.48 +(* ---- for tests only: shifted from below to remove the Warning "unused" at fun.def. --------- *)
    8.49 +  (*NONE*)
    8.50 +(*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\* )
    8.51 +  (*NONE*)
    8.52 +( *\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*)
    8.53 +end
    8.54 +(**)
    8.55 +structure Rule_Set(**): RULE_SET(**) =
    8.56 +struct
    8.57 +(**)
    8.58 +datatype rls = datatype Rule_Def.rls
    8.59 +type rls' = string
    8.60 +
    8.61 +type calc = Rule_Def.calc
    8.62 +type subst = (term * term) list;
    8.63 +fun dummy_ord (_: subst) (_: term, _: term) = true;
    8.64 +
    8.65 +val e_rls =
    8.66 +  Rls {id = "e_rls", preconds = [], rew_ord = ("dummy_ord", dummy_ord), erls = Erls,
    8.67 +    srls = Erls, calc = [], rules = [], errpatts = [], scr = Rule_Def.EmptyScr}: rls;
    8.68 +
    8.69 +(*/--------------------------------------\*)
    8.70 +type rrlsstate =  (* state for reverse rewriting, comments see type rule and scr | Rfuns *)
    8.71 +  (term * term * Rule_Def.rule list list * (Rule_Def.rule * (term * term list)) list);
    8.72 +val e_rrlsstate = (Rule.e_term, Rule.e_term, [[Rule_Def.Erule]], [(Rule_Def.Erule, (Rule.e_term, []))]) : rrlsstate;
    8.73 +(*\--------------------------------------/*)
    8.74 +local
    8.75 +    fun ii (_: term) = e_rrlsstate;
    8.76 +    fun no (_: term) = SOME (Rule.e_term, [Rule.e_term]);
    8.77 +    fun lo (_: Rule_Def.rule list list) (_: term) (_: Rule_Def.rule) = [(Rule_Def.Erule, (Rule.e_term, [Rule.e_term]))];
    8.78 +    fun ne (_: Rule_Def.rule list list) (_: term) = SOME Rule_Def.Erule;
    8.79 +    fun fo (_: Rule_Def.rule list list) (_: term) (_: term) = [(Rule_Def.Erule, (Rule.e_term, [Rule.e_term]))];
    8.80 +in
    8.81 +val e_rfuns = Rule_Def.Rfuns {init_state = ii, normal_form = no, locate_rule = lo,
    8.82 +		  next_rule = ne, attach_form = fo};
    8.83 +end;
    8.84 +val e_rrls =
    8.85 +  Rrls {id = "e_rrls", prepat = [], rew_ord = ("dummy_ord", dummy_ord), erls = Erls,
    8.86 +    calc = [], errpatts = [], scr = e_rfuns}:rls;
    8.87 +
    8.88 +fun rep_rls Erls = rep_rls e_rls
    8.89 +  | rep_rls (Rls {id, preconds, rew_ord, erls, srls, calc, errpatts, rules, scr}) =
    8.90 +    {id = id, preconds = preconds, rew_ord = rew_ord, erls = erls, srls = srls, errpats = errpatts,
    8.91 +      calc = calc, rules = rules, scr = scr}
    8.92 +  | rep_rls (Seq {id, preconds, rew_ord, erls, srls, calc, errpatts, rules, scr}) =
    8.93 +    {id = id, preconds = preconds, rew_ord = rew_ord, erls = erls, srls = srls, errpats = errpatts,
    8.94 +      calc = calc, rules = rules, scr = scr}
    8.95 +  | rep_rls (Rrls _)  = rep_rls e_rls
    8.96 +
    8.97 +fun append_rls id Erls _ = raise ERROR ("append_rls: with \"" ^ id ^ "\" not for Erls")
    8.98 +  | append_rls id (Rls {id = _, preconds = pc, rew_ord = ro, erls = er, srls = sr, calc = ca,
    8.99 +			rules = rs, errpatts = errpatts, scr = sc}) r =
   8.100 +    Rls {id = id, preconds = pc, rew_ord = ro, erls = er, srls = sr, calc = ca,
   8.101 +      rules = rs @ r, errpatts = errpatts, scr = sc}
   8.102 +  | append_rls id (Seq {id = _, preconds = pc, rew_ord = ro, erls = er, srls = sr, calc = ca,
   8.103 +			rules = rs, errpatts = errpatts, scr = sc}) r =
   8.104 +    Seq {id = id, preconds = pc, rew_ord = ro, erls = er, srls = sr, calc = ca,
   8.105 +      rules = rs @ r, errpatts = errpatts, scr = sc}
   8.106 +  | append_rls id (Rrls _) _ = raise ERROR ("append_rls: not for reverse-rewrite-rule-set " ^ id);
   8.107 +
   8.108 +fun id_rls Erls = "e_rls" (*WN060714 quick and dirty: recursive defs! TODO "Erls"*)
   8.109 +  | id_rls (Rule_Def.Rls {id, ...}) = id
   8.110 +  | id_rls (Rule_Def.Seq {id, ...}) = id
   8.111 +  | id_rls (Rule_Def.Rrls {id, ...}) = id;
   8.112 +val rls2str = id_rls;
   8.113 +
   8.114 +fun id_rule (Rule_Def.Thm (id, _)) = id
   8.115 +  | id_rule (Rule_Def.Num_Calc (id, _)) = id
   8.116 +  | id_rule (Rule_Def.Cal1 (id, _)) = id
   8.117 +  | id_rule (Rule_Def.Rls_ rls) = id_rls rls
   8.118 +  | id_rule Rule_Def.Erule = "Erule";
   8.119 +fun eq_rule (Rule_Def.Thm (thm1, _), Rule_Def.Thm (thm2, _)) = thm1 = thm2
   8.120 +  | eq_rule (Rule_Def.Num_Calc (id1, _), Rule_Def.Num_Calc (id2, _)) = id1 = id2
   8.121 +  | eq_rule (Rule_Def.Rls_ rls1, Rule_Def.Rls_ rls2) = id_rls rls1 = id_rls rls2
   8.122 +  | eq_rule _ = false;
   8.123 +
   8.124 +fun rule2str Rule_Def.Erule = "Erule"
   8.125 +  | rule2str (Rule_Def.Thm (str, thm)) = "Thm (\""^str^"\"," ^ Rule.string_of_thmI thm ^")"
   8.126 +  | rule2str (Rule_Def.Num_Calc (str, _)) = "Num_Calc (\""^str^"\",fn)"
   8.127 +  | rule2str (Rule_Def.Cal1 (str, _)) = "Cal1 (\""^str^"\",fn)"
   8.128 +  | rule2str (Rule_Def.Rls_ rls) = "Rls_ (\""^id_rls rls^"\")";
   8.129 +fun rule2str' Rule_Def.Erule = "Erule"
   8.130 +  | rule2str' (Rule_Def.Thm (str, _)) = "Thm (\""^str^"\",\"\")"
   8.131 +  | rule2str' (Rule_Def.Num_Calc (str, _)) = "Num_Calc (\""^str^"\",fn)"
   8.132 +  | rule2str' (Rule_Def.Cal1 (str, _)) = "Cal1 (\""^str^"\",fn)"
   8.133 +  | rule2str' (Rule_Def.Rls_ rls) = "Rls_ (\""^id_rls rls^"\")";
   8.134 +
   8.135 +fun merge_ids rls1 rls2 =
   8.136 +  let 
   8.137 +    val id1 = (#id o rep_rls) rls1
   8.138 +    val id2 = (#id o rep_rls) rls2
   8.139 +  in
   8.140 +    if id1 = id2 then id1 else "merged_" ^ id1 ^ "_" ^ id2
   8.141 +  end
   8.142 +(* op in isa-term "Const(op,_)" *)
   8.143 +type cal = Rule_Def.calID * Rule_Def.eval_fn;
   8.144 +
   8.145 +type prog_calcID = string;
   8.146 +
   8.147 +type calc_elem =  (* fun calculate_ fetches the evaluation-function via this list *)
   8.148 +  prog_calcID *   (* a simple identifier used in programs                    *)
   8.149 +  (Rule_Def.calID *        (* a long identifier used in Const                         *)
   8.150 +    Rule_Def.eval_fn)      (* an ML function                                          *)
   8.151 +fun calc_eq ((pi1, (ci1, _)), (pi2, (ci2, _))) =
   8.152 +  if pi1 = pi2
   8.153 +  then if ci1 = ci2 then true else error ("calc_eq: " ^ ci1 ^ " <> " ^ ci2)
   8.154 +  else false
   8.155 +fun e_evalfn (_ : 'a) (_ : term) (_ : theory) = NONE : (string * term) option;
   8.156 +
   8.157 +fun merge_rls _ Erls rls = rls
   8.158 +  | merge_rls _ rls Erls = rls
   8.159 +  | merge_rls _ (Rrls x) _ = Rrls x (* required for merging Theory_Data *)
   8.160 +  | merge_rls _ _ (Rrls x) = Rrls x
   8.161 +  | merge_rls id
   8.162 +	  (Rls {preconds = pc1, rew_ord = ro1, erls = er1, srls = sr1, calc = ca1,
   8.163 +	    rules = rs1, errpatts = eps1, scr = sc1, ...})
   8.164 +	  (Rls {preconds = pc2, erls = er2, srls = sr2, calc = ca2,
   8.165 +	    rules = rs2, errpatts = eps2, ...})
   8.166 +    =
   8.167 +	  Rls {id = id, rew_ord = ro1, scr = sc1,
   8.168 +	    preconds = union (op =) pc1 pc2,	    
   8.169 +	    erls = merge_rls (merge_ids er1 er2) er1 er2,
   8.170 +	    srls = merge_rls (merge_ids sr1 sr2) sr1 sr2,
   8.171 +	    calc = union calc_eq ca1 ca2,
   8.172 +		  rules = union eq_rule rs1 rs2,
   8.173 +      errpatts = union (op =) eps1 eps2}
   8.174 +  | merge_rls id
   8.175 +	  (Seq {preconds = pc1, rew_ord = ro1, erls = er1, srls = sr1, calc = ca1,
   8.176 +	    rules = rs1, errpatts = eps1, scr = sc1, ...})
   8.177 +	  (Seq {preconds = pc2, erls = er2, srls = sr2, calc = ca2,
   8.178 +	    rules = rs2, errpatts = eps2, ...})
   8.179 +    =
   8.180 +	  Seq {id = id, rew_ord = ro1, scr = sc1,
   8.181 +	    preconds = union (op =) pc1 pc2,	    
   8.182 +	    erls = merge_rls (merge_ids er1 er2) er1 er2,
   8.183 +	    srls = merge_rls (merge_ids sr1 sr2) sr1 sr2,
   8.184 +	    calc = union calc_eq ca1 ca2,
   8.185 +		  rules = union eq_rule rs1 rs2,
   8.186 +      errpatts = union (op =) eps1 eps2}
   8.187 +  | merge_rls id _ _ = error ("merge_rls: \"" ^ id ^ 
   8.188 +    "\"; not for reverse-rewrite-rule-sets and not for mixed Rls -- Seq");
   8.189 +
   8.190 +(* datastructure for KEStore_Elems, intermediate for thehier *)
   8.191 +type rlss_elem = 
   8.192 +  (rls' *     (* identifier unique within Isac *)
   8.193 +  (Rule.theory' *  (* just for assignment in thehier, not appropriate for parsing etc *)
   8.194 +    Rule_Def.rls))     (* ((#id o rep_rls) rls) = rls'   by coding discipline *)
   8.195 +fun rls_eq ((id1, (_, _)), (id2, (_, _))) = id1 = id2
   8.196 +
   8.197 +fun insert_merge_rls (re as (id, (thyID, r1)) : rlss_elem) ys = 
   8.198 +    case get_index (fn y => if curry rls_eq re y then SOME y else NONE) ys of
   8.199 +      NONE => re :: ys
   8.200 +    | SOME (i, (_, (_, r2))) => 
   8.201 +      let
   8.202 +        val r12 = merge_rls id r1 r2
   8.203 +      in list_update ys i (id, (thyID, r12)) end
   8.204 +fun merge_rlss (s1, s2) = fold insert_merge_rls s1 s2;
   8.205 +
   8.206 +(* used only for one hack TODO remove *)
   8.207 +fun remove_rls id (Rls {id = _, preconds = pc, rew_ord = ro, erls = er, srls = sr, calc = ca,
   8.208 +		  rules = rs, errpatts = eps, scr = sc}) r =
   8.209 +    Rls {id = id, preconds = pc, rew_ord = ro, erls = er, srls = sr, calc = ca,
   8.210 +	    rules = gen_rems eq_rule (rs, r),
   8.211 +	    errpatts = eps,
   8.212 +	    scr = sc}
   8.213 +  | remove_rls id (Seq {id = _, preconds = pc, rew_ord = ro, erls = er, srls = sr, calc = ca,
   8.214 +		  rules = rs, errpatts = eps, scr = sc}) r =
   8.215 +    Seq {id = id, preconds = pc, rew_ord = ro, erls = er, srls = sr, calc = ca,
   8.216 +	    rules = gen_rems eq_rule (rs, r),
   8.217 +	    errpatts = eps,
   8.218 +	    scr = sc}
   8.219 +  | remove_rls id (Rrls _) _ = raise ERROR ("remove_rls: not for reverse-rewrite-rule-set "^id)
   8.220 +  | remove_rls _ rls _ = raise ERROR ("remove_rls called with " ^ rls2str rls);
   8.221 +
   8.222 +fun get_rules Erls = []
   8.223 +  | get_rules (Rls {rules, ...}) = rules
   8.224 +  | get_rules (Seq {rules, ...}) = rules
   8.225 +  | get_rules (Rrls _) = [];
   8.226 +
   8.227 +
   8.228 +(**)end(**)
     9.1 --- a/src/Tools/isac/CalcElements/rule.sml	Wed Apr 01 19:20:05 2020 +0200
     9.2 +++ b/src/Tools/isac/CalcElements/rule.sml	Sat Apr 04 12:11:32 2020 +0200
     9.3 @@ -1,115 +1,92 @@
     9.4 -(* rules guiding stepwise execution of methods in the LUCAS_INTERPRETER.
     9.5 -   Author: Walther Neuper 2018 (code gathered from other Isac source)
     9.6 +(* Title:  CalcElements/rule.sml
     9.7 +   Author: Walther Neuper 2018
     9.8     (c) copyright due to lincense terms
     9.9 +
    9.10 +TODO: this theory should vanish; vaious stuff awaits separation.
    9.11 +* rew_ord: this also needs to 
    9.12 +* ThmC
    9.13 +* TheoryC
    9.14 +* ...
    9.15 +Some stuff waits for later rounds of restructuring, e.g. Rule.e_term
    9.16  *)
    9.17  
    9.18  signature RULE =
    9.19 -  sig
    9.20 -    type calc = Rule_Def.calc                                                    (*..from Rule_Def*)
    9.21 -    eqtype calID (*= Rule_Def.calID*)                                            (*..from Rule_Def*)
    9.22 -    type eval_fn = Rule_Def.eval_fn                                              (*..from Rule_Def*)
    9.23 -(**)val e_evalfn: eval_fn (** )Rule_Def.e_evalfn( **)                            (*..from Rule_Def*)
    9.24 -    type cal = calID * eval_fn
    9.25 +sig
    9.26 +  datatype rule = datatype Rule_Def.rule
    9.27 +  datatype program = datatype Rule_Def.program
    9.28  
    9.29 -    eqtype prog_calcID
    9.30 -    type calc_elem
    9.31 -    val calc_eq: calc_elem * calc_elem -> bool
    9.32 +  eqtype calID
    9.33 +  type eval_fn = Rule_Def.eval_fn
    9.34  
    9.35 -    eqtype cterm'
    9.36 -    type subst = (term * term) list
    9.37 +  eqtype cterm'
    9.38 +  type subst = (term * term) list
    9.39  
    9.40 -    eqtype rew_ord'
    9.41 -    val e_rew_ord': rew_ord'
    9.42 -    type rew_ord_
    9.43 -    val dummy_ord: rew_ord_
    9.44 -    val e_rew_ord_: rew_ord_
    9.45 -    type rew_ord = rew_ord' * rew_ord_                                           (*..from Rule_Def*)
    9.46 -    val e_rew_ord: rew_ord_
    9.47 -    val e_rew_ordX: rew_ord
    9.48 -    val rew_ord': (rew_ord' * (subst -> term * term -> bool)) list Unsynchronized.ref
    9.49 -    val assoc_rew_ord: string -> subst -> term * term -> bool
    9.50 +  val dummy_ord: Rule_Def.rew_ord_
    9.51 +  val e_rew_ord_: Rule_Def.rew_ord_
    9.52 +  val e_rew_ord: Rule_Def.rew_ord_
    9.53 +  val e_rew_ordX: Rule_Def.rew_ord
    9.54 +  val rew_ord': (Rule_Def.rew_ord' * (subst -> term * term -> bool)) list Unsynchronized.ref
    9.55 +  val assoc_rew_ord: string -> subst -> term * term -> bool
    9.56  
    9.57 -    eqtype errpatID                                                              (*..from Rule_Def*)
    9.58 -    type errpat = errpatID * term list * thm list
    9.59 -    eqtype rls'
    9.60 -    datatype rls = datatype Rule_Def.rls
    9.61 -    datatype rule = datatype Rule_Def.rule
    9.62 -    datatype program = datatype Rule_Def.program
    9.63 -    val rule2str: rule -> string
    9.64 -    val rule2str': rule -> string
    9.65 -    val e_rule: rule
    9.66 -    val get_rules: rls -> rule list
    9.67 -    val id_rule: rule -> string
    9.68 -    val eq_rule: rule * rule -> bool
    9.69 +  eqtype errpatID                                                              (*..from Rule_Def*)
    9.70 +  type errpat = errpatID * term list * thm list
    9.71  
    9.72 -    val scr2str: program -> string
    9.73 -    val e_rrls: rls
    9.74 +  val scr2str: program -> string
    9.75  
    9.76 -    val e_rls: rls
    9.77 -    val rls2str: rls -> string
    9.78 -    val id_rls: rls -> string
    9.79 -    val rep_rls: rls -> {calc: calc list, erls: rls, errpats: errpatID list, id: string,
    9.80 -      preconds: term list, rew_ord: rew_ord, rules: rule list, scr: program, srls: rls}
    9.81 -    val append_rls: string -> rls -> rule list -> rls
    9.82 -    val merge_rls: string -> rls -> rls -> rls
    9.83 -    val remove_rls: string -> rls -> rule list -> rls
    9.84 +  val thy2ctxt: theory -> Proof.context                      (* shift up in sequence of defs *)
    9.85 +  val thy2ctxt': string -> Proof.context                     (* shift up in sequence of defs *)
    9.86 +  val Thy_Info_get_theory: string -> theory                  (* shift up in sequence of defs *)
    9.87  
    9.88 -    type rrlsstate = term * term * rule list list * (rule * (term * term list)) list
    9.89 -    val e_rrlsstate: rrlsstate
    9.90 +  eqtype thyID                                               (* shift up in sequence of defs *)
    9.91 +  eqtype domID                                               (* shift up in sequence of defs *)
    9.92 +  val e_domID: domID                                         (* shift up in sequence of defs *)
    9.93 +  eqtype theory'                                             (* shift up in sequence of defs *)
    9.94 +  val theory'2thyID: theory' -> theory'                      (* shift up in sequence of defs *)
    9.95 +  val theory2theory': theory -> theory'                      (* shift up in sequence of defs *)
    9.96 +  val theory2thyID: theory -> thyID                          (* shift up in sequence of defs *)
    9.97 +  val thyID2theory': thyID -> thyID                          (* shift up in sequence of defs *)
    9.98 +  val string_of_thy: theory -> theory'                       (* shift up in sequence of defs *)
    9.99 +  val theory2domID: theory -> theory'                        (* shift up in sequence of defs *)
   9.100  
   9.101 -    val thy2ctxt: theory -> Proof.context                      (* shift up in sequence of defs *)
   9.102 -    val thy2ctxt': string -> Proof.context                     (* shift up in sequence of defs *)
   9.103 -    val Thy_Info_get_theory: string -> theory                  (* shift up in sequence of defs *)
   9.104 +  val Isac: 'a -> theory                                     (* shift up in sequence of defs *)
   9.105  
   9.106 -    eqtype thyID                                               (* shift up in sequence of defs *)
   9.107 -    eqtype domID                                               (* shift up in sequence of defs *)
   9.108 -    val e_domID: domID                                         (* shift up in sequence of defs *)
   9.109 -    eqtype theory'                                             (* shift up in sequence of defs *)
   9.110 -    val theory'2thyID: theory' -> theory'                      (* shift up in sequence of defs *)
   9.111 -    val theory2theory': theory -> theory'                      (* shift up in sequence of defs *)
   9.112 -    val theory2thyID: theory -> thyID                          (* shift up in sequence of defs *)
   9.113 -    val thyID2theory': thyID -> thyID                          (* shift up in sequence of defs *)
   9.114 -    val string_of_thy: theory -> theory'                       (* shift up in sequence of defs *)
   9.115 -    val theory2domID: theory -> theory'                        (* shift up in sequence of defs *)
   9.116 -
   9.117 -    val Isac: 'a -> theory                                     (* shift up in sequence of defs *)
   9.118 -
   9.119 -    val string_of_thmI: thm -> string                          (* shift up to Unparse *)
   9.120 -    val e_term: term                                           (* shift up to Unparse *)
   9.121 -    val e_type: typ                                            (* shift up to Unparse *)
   9.122 -    val type2str: typ -> string
   9.123 -    val term_to_string': Proof.context -> term -> string       (* shift up to Unparse *)
   9.124 -    val term2str: term -> string                               (* shift up to Unparse *)
   9.125 -    val termopt2str: term option -> string                     (* shift up to Unparse *)
   9.126 -    val theory2str: theory -> theory'                          (* shift up to Unparse *)
   9.127 -    val terms2str: term list -> string                         (* shift up to Unparse *)
   9.128 -    val terms2strs: term list -> string list
   9.129 -    val term_to_string'': thyID -> term -> string              (* shift up to Unparse *)
   9.130 -    val term_to_string''': theory -> term -> string            (* shift up to Unparse *)
   9.131 -    val t2str: theory -> term -> string
   9.132 -    val ts2str: theory -> term list -> string                  (* shift up to Unparse *)
   9.133 -    val string_of_typ: typ -> string                           (* shift up to Unparse *)
   9.134 -    val string_of_typ_thy: thyID -> typ -> string              (* shift up to Unparse *)
   9.135 +  val string_of_thmI: thm -> string                          (* shift up to Unparse *)
   9.136 +  val e_term: term                                           (* shift up to Unparse *)
   9.137 +  val e_type: typ                                            (* shift up to Unparse *)
   9.138 +  val type2str: typ -> string
   9.139 +  val term_to_string': Proof.context -> term -> string       (* shift up to Unparse *)
   9.140 +  val term2str: term -> string                               (* shift up to Unparse *)
   9.141 +  val termopt2str: term option -> string                     (* shift up to Unparse *)
   9.142 +  val theory2str: theory -> theory'                          (* shift up to Unparse *)
   9.143 +  val terms2str: term list -> string                         (* shift up to Unparse *)
   9.144 +  val terms2strs: term list -> string list
   9.145 +  val term_to_string'': thyID -> term -> string              (* shift up to Unparse *)
   9.146 +  val term_to_string''': theory -> term -> string            (* shift up to Unparse *)
   9.147 +  val t2str: theory -> term -> string
   9.148 +  val ts2str: theory -> term list -> string                  (* shift up to Unparse *)
   9.149 +  val string_of_typ: typ -> string                           (* shift up to Unparse *)
   9.150 +  val string_of_typ_thy: thyID -> typ -> string              (* shift up to Unparse *)
   9.151  
   9.152  (* ---- for tests only: shifted from below to remove the Warning "unused" at fun.def. --------- *)
   9.153 -    val terms2str': term list -> string                        (* shift up to Unparse *)
   9.154 -    val thm2str: thm -> string
   9.155 -    val thms2str : thm list -> string
   9.156 +  val terms2str': term list -> string                        (* shift up to Unparse *)
   9.157 +  val thm2str: thm -> string
   9.158 +  val thms2str : thm list -> string
   9.159 +  val string_of_thm': theory -> thm -> string                (* shift up to Unparse *)
   9.160 +  val errpats2str : errpat list -> string
   9.161  (*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\* )
   9.162 -    val string_of_thm': theory -> thm -> string                (* shift up to Unparse *)
   9.163      val string_of_thm: thm -> string                           (* shift up to Unparse *)
   9.164 -    val errpats2str : errpat list -> string
   9.165  ( *\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*)
   9.166 -
   9.167 -(*----- unused code, kept as hints to design ideas ---------------------------------------------*)
   9.168 -
   9.169 -  end
   9.170 +end
   9.171  
   9.172  (**)
   9.173  structure Rule(**): RULE(**) =
   9.174  struct
   9.175  (**)
   9.176  
   9.177 +datatype rule = datatype Rule_Def.rule
   9.178 +datatype program = datatype Rule_Def.program
   9.179 +
   9.180 +type calc = Rule_Def.calc                                                        (*..from Rule_Def*)
   9.181  type calID = Rule_Def.calID;                                                     (*..from Rule_Def*)
   9.182  (* eval function calling sml code during rewriting.
   9.183  Unifying "type cal" and "type calc" would make Lucas-Interpretation more efficient,
   9.184 @@ -118,31 +95,12 @@
   9.185    would be better
   9.186      Num_Calc: prog_calcID * (calID * eval_fn)) -> rule*)
   9.187  type eval_fn = Rule_Def.eval_fn                                                  (*..from Rule_Def*)
   9.188 -(*fun e_evalfn (_ : 'a) (_ : term) (_ : theory) = NONE : (string * term) option;*)
   9.189 -val e_evalfn = Rule_Def.e_evalfn                                                 (*..from Rule_Def*)
   9.190 -
   9.191 -(* op in isa-term "Const(op,_)" *)
   9.192 -type cal = calID * eval_fn;
   9.193 -type prog_calcID = string;
   9.194 -type calc = Rule_Def.calc                                                        (*..from Rule_Def*)
   9.195 -
   9.196 -type calc_elem =  (* fun calculate_ fetches the evaluation-function via this list *)
   9.197 -  prog_calcID *   (* a simple identifier used in programs                    *)
   9.198 -  (calID *        (* a long identifier used in Const                         *)
   9.199 -    eval_fn)      (* an ML function                                          *)
   9.200 -fun calc_eq ((pi1, (ci1, _)), (pi2, (ci2, _))) =
   9.201 -  if pi1 = pi2
   9.202 -  then if ci1 = ci2 then true else error ("calc_eq: " ^ ci1 ^ " <> " ^ ci2)
   9.203 -  else false
   9.204  
   9.205  type cterm' = string;
   9.206  type subst = (term * term) list;
   9.207  
   9.208 -(*TODO.WN060610 make use of "type rew_ord" total*)
   9.209 -type rew_ord' = string;
   9.210 -val e_rew_ord' = "e_rew_ord" : rew_ord';
   9.211 -
   9.212 -type rew_ord_ = subst -> Term.term * Term.term -> bool;
   9.213 +val e_rew_ord' = "e_rew_ord" : Rule_Def.rew_ord';
   9.214 +type rew_ord_ = Rule_Def.rew_ord_;
   9.215  fun dummy_ord (_: subst) (_: term, _: term) = true;
   9.216  val e_rew_ord_ = dummy_ord;
   9.217  type rew_ord = (*rew_ord' * rew_ord_;*) Rule_Def.rew_ord                         (*..from Rule_Def*)
   9.218 @@ -153,7 +111,7 @@
   9.219    The association list is required for 'rewrite.."rew_ord"..' *)
   9.220  val rew_ord' = Unsynchronized.ref
   9.221    ([("e_rew_ord", e_rew_ord), ("dummy_ord", dummy_ord)]
   9.222 -	: (rew_ord' *    (* the key for the association list         *)
   9.223 +	: (Rule_Def.rew_ord' *    (* the key for the association list         *)
   9.224  	    (subst 	    (* the bound variables - they get high order*)
   9.225  	     -> (term * term) (* (t1, t2) to be compared                  *)
   9.226  	     -> bool))        (* if t1 <= t2 then true else false         *)
   9.227 @@ -162,7 +120,7 @@
   9.228    | assoc' ((keyi, xi) :: pairs, key) =
   9.229      if key = keyi then SOME xi else assoc' (pairs, key);
   9.230  fun assoc_rew_ord ro = ((the o assoc') (! rew_ord',ro))
   9.231 -  handle _ => error ("ME_Isa: rew_ord '" ^ ro ^ "' not in system");
   9.232 +  handle _ => raise ERROR ("ME_Isa: rew_ord '" ^ ro ^ "' not in system");
   9.233  
   9.234  (* Since Isabelle2017 sessions in theory identifiers are enforced.
   9.235    However, we leave theory identifiers short, in particular in use as keys into KEStore. *)
   9.236 @@ -214,25 +172,6 @@
   9.237    "(\"" ^ id ^ "\",\n" ^ terms2str tms ^ ",\n" ^ thms2str thms
   9.238  fun errpats2str errpats = (strs2str' o (map errpat2str)) errpats
   9.239  
   9.240 -    datatype rls = datatype Rule_Def.rls
   9.241 -    datatype rule = datatype Rule_Def.rule
   9.242 -    datatype program = datatype Rule_Def.program
   9.243 -
   9.244 -fun id_rls Erls = "e_rls" (*WN060714 quick and dirty: recursive defs! TODO "Erls"*)
   9.245 -  | id_rls (Rls {id, ...}) = id
   9.246 -  | id_rls (Seq {id, ...}) = id
   9.247 -  | id_rls (Rrls {id, ...}) = id;
   9.248 -val rls2str = id_rls;
   9.249 -fun id_rule (Thm (id, _)) = id
   9.250 -  | id_rule (Num_Calc (id, _)) = id
   9.251 -  | id_rule (Cal1 (id, _)) = id
   9.252 -  | id_rule (Rls_ rls) = id_rls rls
   9.253 -  | id_rule Erule = "Erule";
   9.254 -fun eq_rule (Thm (thm1, _), Thm (thm2, _)) = thm1 = thm2
   9.255 -  | eq_rule (Num_Calc (id1, _), Num_Calc (id2, _)) = id1 = id2
   9.256 -  | eq_rule (Rls_ rls1, Rls_ rls2) = id_rls rls1 = id_rls rls2
   9.257 -  | eq_rule _ = false;
   9.258 -
   9.259  (*ad thm':
   9.260     there are two kinds of theorems ...
   9.261     (1) known by isabelle
   9.262 @@ -275,125 +214,11 @@
   9.263      | _ => str
   9.264    end
   9.265  
   9.266 -fun get_rules Erls = []
   9.267 -  | get_rules (Rls {rules, ...}) = rules
   9.268 -  | get_rules (Seq {rules, ...}) = rules
   9.269 -  | get_rules (Rrls _) = [];
   9.270 -fun rule2str Erule = "Erule"
   9.271 -  | rule2str (Thm (str, thm)) = "Thm (\""^str^"\","^(string_of_thmI thm)^")"
   9.272 -  | rule2str (Num_Calc (str, _)) = "Num_Calc (\""^str^"\",fn)"
   9.273 -  | rule2str (Cal1 (str, _)) = "Cal1 (\""^str^"\",fn)"
   9.274 -  | rule2str (Rls_ rls) = "Rls_ (\""^id_rls rls^"\")";
   9.275 -fun rule2str' Erule = "Erule"
   9.276 -  | rule2str' (Thm (str, _)) = "Thm (\""^str^"\",\"\")"
   9.277 -  | rule2str' (Num_Calc (str, _)) = "Num_Calc (\""^str^"\",fn)"
   9.278 -  | rule2str' (Cal1 (str, _)) = "Cal1 (\""^str^"\",fn)"
   9.279 -  | rule2str' (Rls_ rls) = "Rls_ (\""^id_rls rls^"\")";
   9.280  fun scr2str EmptyScr = "EmptyScr"
   9.281    | scr2str (Prog s) = "Prog " ^ term2str s
   9.282    | scr2str (Rfuns _)  = "Rfuns";
   9.283  
   9.284  val e_type = Type ("empty",[]);
   9.285 -val e_term = Const ("empty", e_type);
   9.286 -val e_rule = Thm ("refl", @{thm refl});
   9.287  val e_term = Const ("empty", Type("'a", []));
   9.288 -type rrlsstate =  (* state for reverse rewriting, comments see type rule and scr | Rfuns *)
   9.289 -  (term * term * rule list list * (rule * (term * term list)) list);
   9.290 -val e_rrlsstate = (e_term,e_term, [[e_rule]], [(e_rule, (e_term, []))]) : rrlsstate;
   9.291 -
   9.292 -type rls' = string;
   9.293 -local
   9.294 -    fun ii (_: term) = e_rrlsstate;
   9.295 -    fun no (_: term) = SOME (e_term, [e_term]);
   9.296 -    fun lo (_: rule list list) (_: term) (_: rule) = [(e_rule, (e_term, [e_term]))];
   9.297 -    fun ne (_: rule list list) (_: term) = SOME e_rule;
   9.298 -    fun fo (_: rule list list) (_: term) (_: term) = [(e_rule, (e_term, [e_term]))];
   9.299 -in
   9.300 -val e_rfuns = Rfuns {init_state = ii, normal_form = no, locate_rule = lo,
   9.301 -		  next_rule = ne, attach_form = fo};
   9.302 -end;
   9.303 -val e_rls =
   9.304 -  Rls {id = "e_rls", preconds = [], rew_ord = ("dummy_ord", dummy_ord), erls = Erls,
   9.305 -    srls = Erls, calc = [], rules = [], errpatts = [], scr = EmptyScr}: rls;
   9.306 -val e_rrls =
   9.307 -  Rrls {id = "e_rrls", prepat = [], rew_ord = ("dummy_ord", dummy_ord), erls = Erls,
   9.308 -    calc = [], errpatts = [], scr = e_rfuns}:rls;
   9.309 -
   9.310 -fun rep_rls Erls = rep_rls e_rls
   9.311 -  | rep_rls (Rls {id, preconds, rew_ord, erls, srls, calc, errpatts, rules, scr}) =
   9.312 -    {id = id, preconds = preconds, rew_ord = rew_ord, erls = erls, srls = srls, errpats = errpatts,
   9.313 -      calc = calc, rules = rules, scr = scr}
   9.314 -  | rep_rls (Seq {id, preconds, rew_ord, erls, srls, calc, errpatts, rules, scr}) =
   9.315 -    {id = id, preconds = preconds, rew_ord = rew_ord, erls = erls, srls = srls, errpats = errpatts,
   9.316 -      calc = calc, rules = rules, scr = scr}
   9.317 -  | rep_rls (Rrls _)  = rep_rls e_rls
   9.318 -
   9.319 -fun append_rls id Erls _ = raise ERROR ("append_rls: with \"" ^ id ^ "\" not for Erls")
   9.320 -  | append_rls id (Rls {id = _, preconds = pc, rew_ord = ro, erls = er, srls = sr, calc = ca,
   9.321 -			rules = rs, errpatts = errpatts, scr = sc}) r =
   9.322 -    Rls {id = id, preconds = pc, rew_ord = ro, erls = er, srls = sr, calc = ca,
   9.323 -      rules = rs @ r, errpatts = errpatts, scr = sc}
   9.324 -  | append_rls id (Seq {id = _, preconds = pc, rew_ord = ro, erls = er, srls = sr, calc = ca,
   9.325 -			rules = rs, errpatts = errpatts, scr = sc}) r =
   9.326 -    Seq {id = id, preconds = pc, rew_ord = ro, erls = er, srls = sr, calc = ca,
   9.327 -      rules = rs @ r, errpatts = errpatts, scr = sc}
   9.328 -  | append_rls id (Rrls _) _ = raise ERROR ("append_rls: not for reverse-rewrite-rule-set " ^ id);
   9.329 -
   9.330 -fun merge_ids rls1 rls2 =
   9.331 -  let 
   9.332 -    val id1 = (#id o rep_rls) rls1
   9.333 -    val id2 = (#id o rep_rls) rls2
   9.334 -  in
   9.335 -    if id1 = id2 then id1 else "merged_" ^ id1 ^ "_" ^ id2
   9.336 -  end
   9.337 -fun merge_rls _ Erls rls = rls
   9.338 -  | merge_rls _ rls Erls = rls
   9.339 -  | merge_rls _ (Rrls x) _ = Rrls x (* required for merging Theory_Data *)
   9.340 -  | merge_rls _ _ (Rrls x) = Rrls x
   9.341 -  | merge_rls id
   9.342 -	  (Rls {preconds = pc1, rew_ord = ro1, erls = er1, srls = sr1, calc = ca1,
   9.343 -	    rules = rs1, errpatts = eps1, scr = sc1, ...})
   9.344 -	  (Rls {preconds = pc2, erls = er2, srls = sr2, calc = ca2,
   9.345 -	    rules = rs2, errpatts = eps2, ...})
   9.346 -    =
   9.347 -	  Rls {id = id, rew_ord = ro1, scr = sc1,
   9.348 -	    preconds = union (op =) pc1 pc2,	    
   9.349 -	    erls = merge_rls (merge_ids er1 er2) er1 er2,
   9.350 -	    srls = merge_rls (merge_ids sr1 sr2) sr1 sr2,
   9.351 -	    calc = union calc_eq ca1 ca2,
   9.352 -		  rules = union eq_rule rs1 rs2,
   9.353 -      errpatts = union (op =) eps1 eps2}
   9.354 -  | merge_rls id
   9.355 -	  (Seq {preconds = pc1, rew_ord = ro1, erls = er1, srls = sr1, calc = ca1,
   9.356 -	    rules = rs1, errpatts = eps1, scr = sc1, ...})
   9.357 -	  (Seq {preconds = pc2, erls = er2, srls = sr2, calc = ca2,
   9.358 -	    rules = rs2, errpatts = eps2, ...})
   9.359 -    =
   9.360 -	  Seq {id = id, rew_ord = ro1, scr = sc1,
   9.361 -	    preconds = union (op =) pc1 pc2,	    
   9.362 -	    erls = merge_rls (merge_ids er1 er2) er1 er2,
   9.363 -	    srls = merge_rls (merge_ids sr1 sr2) sr1 sr2,
   9.364 -	    calc = union calc_eq ca1 ca2,
   9.365 -		  rules = union eq_rule rs1 rs2,
   9.366 -      errpatts = union (op =) eps1 eps2}
   9.367 -  | merge_rls id _ _ = error ("merge_rls: \"" ^ id ^ 
   9.368 -    "\"; not for reverse-rewrite-rule-sets and not for mixed Rls -- Seq");
   9.369 -
   9.370 -(* used only for one hack TODO remove *)
   9.371 -fun remove_rls id (Rls {id = _, preconds = pc, rew_ord = ro, erls = er, srls = sr, calc = ca,
   9.372 -		  rules = rs, errpatts = eps, scr = sc}) r =
   9.373 -    Rls {id = id, preconds = pc, rew_ord = ro, erls = er, srls = sr, calc = ca,
   9.374 -	    rules = gen_rems eq_rule (rs, r),
   9.375 -	    errpatts = eps,
   9.376 -	    scr = sc}
   9.377 -  | remove_rls id (Seq {id = _, preconds = pc, rew_ord = ro, erls = er, srls = sr, calc = ca,
   9.378 -		  rules = rs, errpatts = eps, scr = sc}) r =
   9.379 -    Seq {id = id, preconds = pc, rew_ord = ro, erls = er, srls = sr, calc = ca,
   9.380 -	    rules = gen_rems eq_rule (rs, r),
   9.381 -	    errpatts = eps,
   9.382 -	    scr = sc}
   9.383 -  | remove_rls id (Rrls _) _ = raise ERROR ("remove_rls: not for reverse-rewrite-rule-set "^id)
   9.384 -  | remove_rls _ rls _ = raise ERROR ("remove_rls called with " ^ rls2str rls);
   9.385 -
   9.386  
   9.387  end (*struct*)
    10.1 --- a/src/Tools/isac/Interpret/error-pattern.sml	Wed Apr 01 19:20:05 2020 +0200
    10.2 +++ b/src/Tools/isac/Interpret/error-pattern.sml	Sat Apr 04 12:11:32 2020 +0200
    10.3 @@ -9,12 +9,12 @@
    10.4    val find_fillpatterns : Calc.T -> Rule.errpatID -> (Celem.fillpatID * term * thm * Selem.subs option) list
    10.5    val is_exactly_equal : Calc.T -> string -> string * Tactic.input
    10.6    val concat_deriv : 'a * ((term * term) list -> term * term -> bool) ->
    10.7 -    Rule.rls -> Rule.rule list -> term -> term -> bool * (term * Rule.rule * (term * term list)) list
    10.8 -  val mk_tacis: Rule.rew_ord' * 'a -> Rule.rls -> term * Rule.rule * (term * term list) -> Tactic.input * Tactic.T * (Pos.pos' * (Istate.T * Proof.context))
    10.9 +    Rule_Set.rls -> Rule.rule list -> term -> term -> bool * (term * Rule.rule * (term * term list)) list
   10.10 +  val mk_tacis: Rule_Def.rew_ord' * 'a -> Rule_Set.rls -> term * Rule.rule * (term * term list) -> Tactic.input * Tactic.T * (Pos.pos' * (Istate.T * Proof.context))
   10.11    val fetchErrorpatterns : Tactic.input -> Rule.errpatID list
   10.12    val check_for :
   10.13      term * term ->
   10.14 -    term * (term * term) list -> (Rule.errpatID * term list * 'a list) list * Rule.rls -> Rule.errpatID option
   10.15 +    term * (term * term) list -> (Rule.errpatID * term list * 'a list) list * Rule_Set.rls -> Rule.errpatID option
   10.16    val rule2thm'' : Rule.rule -> Celem.thm''
   10.17    val rule2rls' : Rule.rule -> string
   10.18  (* ---- for tests only: shifted from below to remove the Warning "unused" at fun.def. --------- *)
   10.19 @@ -22,7 +22,7 @@
   10.20  (*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\* )
   10.21    val dropwhile' : ('a -> 'b -> bool) -> 'a list -> 'b list -> 'a list * 'b list
   10.22    val rev_deriv' : 'a * Rule.rule * ('b * 'c) -> 'b * Rule.rule * ('a * 'c)
   10.23 -  val check_err_patt : term * term -> Rule.subst -> Rule.errpatID * term -> Rule.rls -> Rule.errpatID option
   10.24 +  val check_err_patt : term * term -> Rule.subst -> Rule.errpatID * term -> Rule_Set.rls -> Rule.errpatID option
   10.25    val get_fillform :
   10.26       'a * (term * term) list -> 'b * term -> Rule.errpatID -> Celem.fillpat -> (Celem.fillpatID * term * 'b * 'a) option
   10.27    val get_fillpats :
   10.28 @@ -36,9 +36,9 @@
   10.29  (**)
   10.30  
   10.31  fun rule2thm'' (Rule.Thm (id, thm)) = (id, thm)
   10.32 -  | rule2thm'' r = error ("rule2thm': not defined for " ^ Rule.rule2str r);
   10.33 -fun rule2rls' (Rule.Rls_ rls) = Rule.id_rls rls
   10.34 -  | rule2rls' r = error ("rule2rls': not defined for " ^ Rule.rule2str r);
   10.35 +  | rule2thm'' r = error ("rule2thm': not defined for " ^ Rule_Set.rule2str r);
   10.36 +fun rule2rls' (Rule.Rls_ rls) = Rule_Set.id_rls rls
   10.37 +  | rule2rls' r = error ("rule2rls': not defined for " ^ Rule_Set.rule2str r);
   10.38  
   10.39  (*the lists contain eq-al elem-pairs at the beginning;
   10.40    return first list reverted (again) - ie. in order as required subsequently*)
   10.41 @@ -68,7 +68,7 @@
   10.42        (Tactic.Rewrite_Set (rule2rls' r), 
   10.43          Tactic.Rewrite_Set' ("Isac_Knowledge", false, rls, t, (t', a)),
   10.44         (Pos.e_pos'(*to be updated before generate tacis!!!*), (Istate.Uistate, ContextC.empty)))
   10.45 -  | mk_tacis _ _ (t, r, _) = error ("mk_tacis: not impl. for " ^ Rule.rule2str r ^ " at " ^ Rule.term2str t)
   10.46 +  | mk_tacis _ _ (t, r, _) = error ("mk_tacis: not impl. for " ^ Rule_Set.rule2str r ^ " at " ^ Rule.term2str t)
   10.47  
   10.48  (* fo = ifo excluded already in inform *)
   10.49  fun concat_deriv rew_ord erls rules fo ifo =
   10.50 @@ -97,7 +97,7 @@
   10.51  fun check_err_patt (res, inf) subst (errpatID, pat) rls =
   10.52    let 
   10.53      val (res', _, _, rewritten) =
   10.54 -      Rewrite.rew_sub (Rule.Isac()) 1 subst Rule.e_rew_ord Rule.e_rls false [] (HOLogic.Trueprop $ pat) res;
   10.55 +      Rewrite.rew_sub (Rule.Isac()) 1 subst Rule.e_rew_ord Rule_Set.e_rls false [] (HOLogic.Trueprop $ pat) res;
   10.56    in
   10.57      if rewritten then 
   10.58        let
   10.59 @@ -134,7 +134,7 @@
   10.60  fun get_fillform (subs_opt, subst) (thm, form) errpatID (fillpatID, pat, erpaID) =
   10.61    let
   10.62      val (form', _, _, rewritten) =
   10.63 -      Rewrite.rew_sub (Rule.Isac()) 1 subst Rule.e_rew_ord Rule.e_rls false [] (HOLogic.Trueprop $ pat) form;
   10.64 +      Rewrite.rew_sub (Rule.Isac()) 1 subst Rule.e_rew_ord Rule_Set.e_rls false [] (HOLogic.Trueprop $ pat) form;
   10.65    in (*the fillpat of the thm must be dedicated to errpatID*)
   10.66      if errpatID = erpaID andalso rewritten then
   10.67        SOME (fillpatID, HOLogic.mk_eq (form, form'), thm, subs_opt) 
   10.68 @@ -205,10 +205,10 @@
   10.69        Celem.Hrls {thy_rls = (_, rls), ...} => rls
   10.70      | _ => error "fetchErrorpatterns: uncovered case of get_the"
   10.71    in case rls of
   10.72 -    Rule.Rls {errpatts, ...} => errpatts
   10.73 -  | Rule.Seq {errpatts, ...} => errpatts
   10.74 -  | Rule.Rrls {errpatts, ...} => errpatts
   10.75 -  | Rule.Erls => []
   10.76 +    Rule_Set.Rls {errpatts, ...} => errpatts
   10.77 +  | Rule_Set.Seq {errpatts, ...} => errpatts
   10.78 +  | Rule_Set.Rrls {errpatts, ...} => errpatts
   10.79 +  | Rule_Set.Erls => []
   10.80    end
   10.81  
   10.82  (**)
    11.1 --- a/src/Tools/isac/Interpret/istate.sml	Wed Apr 01 19:20:05 2020 +0200
    11.2 +++ b/src/Tools/isac/Interpret/istate.sml	Sat Apr 04 12:11:32 2020 +0200
    11.3 @@ -34,7 +34,7 @@
    11.4  
    11.5    val set_form: term -> pstate -> pstate
    11.6    val set_path: TermC.path -> pstate -> pstate
    11.7 -  val set_eval: Rule.rls -> pstate -> pstate
    11.8 +  val set_eval: Rule_Set.rls -> pstate -> pstate
    11.9    val set_act: term -> pstate -> pstate
   11.10    val set_or: asap -> pstate -> pstate
   11.11    val set_found: pstate -> pstate
    12.1 --- a/src/Tools/isac/Interpret/li-tool.sml	Wed Apr 01 19:20:05 2020 +0200
    12.2 +++ b/src/Tools/isac/Interpret/li-tool.sml	Sat Apr 04 12:11:32 2020 +0200
    12.3 @@ -14,15 +14,15 @@
    12.4    val associate: Ctree.ctree -> Proof.context -> (Tactic.T * term (*..Prog_Tac*)) -> ass
    12.5    
    12.6    val implicit_take : Program.T -> (term * term) list -> term option
    12.7 -  val init_pstate : Rule.rls -> Proof.context -> Model.itm list -> Celem.metID ->
    12.8 +  val init_pstate : Rule_Set.rls -> Proof.context -> Model.itm list -> Celem.metID ->
    12.9      Istate.T * Proof.context * Program.T
   12.10  
   12.11 -  val get_simplifier : Calc.T -> Rule.rls
   12.12 +  val get_simplifier : Calc.T -> Rule_Set.rls
   12.13    val resume_prog : Rule.theory' (*..for lookup in KEStore*) -> Pos.pos' -> Ctree.ctree -> 
   12.14      (Istate.T * Proof.context) * Program.T
   12.15  
   12.16    val tac_from_prog : Ctree.ctree -> theory (*..for lookup in KEStore*) -> term -> Tactic.input
   12.17 -  val check_leaf : string -> Proof.context -> Rule.rls -> (Env.T * (term option * term)) -> term -> 
   12.18 +  val check_leaf : string -> Proof.context -> Rule_Set.rls -> (Env.T * (term option * term)) -> term -> 
   12.19        Program.leaf * term option
   12.20  (* ---- for tests only: shifted from below to remove the Warning "unused" at fun.def. --------- *)
   12.21    (*NONE*)
   12.22 @@ -144,28 +144,28 @@
   12.23        | _ => Not_Associated)
   12.24    | associate _ ctxt (m as Tactic.Rewrite_Set_Inst' (_, _, _, rls, f, (f', asms')),
   12.25          (Const ("Prog_Tac.Rewrite'_Set'_Inst", _) $ _ $ rls_ $ f_)) = 
   12.26 -      if Rule.id_rls rls = HOLogic.dest_string rls_ then
   12.27 +      if Rule_Set.id_rls rls = HOLogic.dest_string rls_ then
   12.28          if f = f_ then
   12.29            Associated (m, f', ContextC.insert_assumptions asms' ctxt)
   12.30          else Ass_Weak (m ,f', ContextC.insert_assumptions asms' ctxt)
   12.31        else Not_Associated
   12.32    | associate _ ctxt (m as Tactic.Detail_Set_Inst' (_, _, _, rls, f, (f', asms')),
   12.33          (Const ("Prog_Tac.Rewrite'_Set'_Inst", _) $ _ $ rls_ $ f_)) = 
   12.34 -      if Rule.id_rls rls = HOLogic.dest_string rls_ then
   12.35 +      if Rule_Set.id_rls rls = HOLogic.dest_string rls_ then
   12.36          if f = f_ then
   12.37            Associated (m, f', ContextC.insert_assumptions asms' ctxt)
   12.38          else Ass_Weak (m ,f', ContextC.insert_assumptions asms' ctxt)
   12.39        else Not_Associated
   12.40    | associate _ ctxt (m as Tactic.Rewrite_Set' (_, _, rls, f, (f', asms')),
   12.41          (Const ("Prog_Tac.Rewrite'_Set", _) $ rls_ $ f_)) = 
   12.42 -      if Rule.id_rls rls = HOLogic.dest_string rls_ then
   12.43 +      if Rule_Set.id_rls rls = HOLogic.dest_string rls_ then
   12.44          if f = f_ then
   12.45            Associated (m, f', ContextC.insert_assumptions asms' ctxt)
   12.46          else Ass_Weak (m ,f', ContextC.insert_assumptions asms' ctxt)
   12.47        else Not_Associated
   12.48    | associate _ ctxt (m as Tactic.Detail_Set' (_, _, rls, f, (f', asms')),
   12.49          (Const ("Prog_Tac.Rewrite'_Set", _) $ rls_ $ f_)) = 
   12.50 -      if Rule.id_rls rls = HOLogic.dest_string rls_ then
   12.51 +      if Rule_Set.id_rls rls = HOLogic.dest_string rls_ then
   12.52          if f = f_ then
   12.53            Associated (m, f', ContextC.insert_assumptions asms' ctxt)
   12.54          else Ass_Weak (m ,f', ContextC.insert_assumptions asms' ctxt)
    13.1 --- a/src/Tools/isac/Interpret/lucas-interpreter.sml	Wed Apr 01 19:20:05 2020 +0200
    13.2 +++ b/src/Tools/isac/Interpret/lucas-interpreter.sml	Sat Apr 04 12:11:32 2020 +0200
    13.3 @@ -621,7 +621,7 @@
    13.4    let
    13.5      val fo = Calc.get_current_formula ptp
    13.6  	  val {nrls, ...} = Specify.get_met (Ctree.get_obj Ctree.g_metID pt (Ctree.par_pblobj pt p))
    13.7 -	  val {rew_ord, erls, rules, ...} = Rule.rep_rls nrls
    13.8 +	  val {rew_ord, erls, rules, ...} = Rule_Set.rep_rls nrls
    13.9  	  val (found, der) = Error_Pattern.concat_deriv rew_ord erls rules fo ifo; (*<---------------*)
   13.10    in
   13.11      if found
    14.1 --- a/src/Tools/isac/Interpret/rewtools.sml	Wed Apr 01 19:20:05 2020 +0200
    14.2 +++ b/src/Tools/isac/Interpret/rewtools.sml	Sat Apr 04 12:11:32 2020 +0200
    14.3 @@ -8,28 +8,28 @@
    14.4  signature REWRITE_TOOLS =
    14.5  sig
    14.6    type deriv
    14.7 -  val contains_rule : Rule.rule -> Rule.rls -> bool
    14.8 -  val atomic_appl_tacs : theory -> string -> Rule.rls -> term -> Tactic.input -> Tactic.input list
    14.9 -  val thy_containing_rls : Rule.theory' -> Rule.rls' -> string * Rule.theory'
   14.10 -  val thy_containing_cal : Rule.theory' -> Rule.prog_calcID -> string * string
   14.11 +  val contains_rule : Rule.rule -> Rule_Set.rls -> bool
   14.12 +  val atomic_appl_tacs : theory -> string -> Rule_Set.rls -> term -> Tactic.input -> Tactic.input list
   14.13 +  val thy_containing_rls : Rule.theory' -> Rule_Set.rls' -> string * Rule.theory'
   14.14 +  val thy_containing_cal : Rule.theory' -> Rule_Set.prog_calcID -> string * string
   14.15    datatype contthy
   14.16    = ContNOrew of {applto: term, thm_rls: Celem.guh, thyID: Rule.thyID}
   14.17       | ContNOrewInst of {applto: term, bdvs: Rule.subst, thm_rls: Celem.guh, thminst: term, thyID: Rule.thyID}
   14.18       | ContRls of {applto: term, asms: term list, result: term, rls: Celem.guh, thyID: Rule.thyID}
   14.19       | ContRlsInst of {applto: term, asms: term list, bdvs: Rule.subst, result: term, rls: Celem.guh, thyID: Rule.thyID}
   14.20 -     | ContThm of {applat: term, applto: term, asmrls: Rule.rls', asms: (term * term) list,
   14.21 -       lhs: term * term, resasms: term list, result: term, reword: Rule.rew_ord', rhs: term * term,
   14.22 +     | ContThm of {applat: term, applto: term, asmrls: Rule_Set.rls', asms: (term * term) list,
   14.23 +       lhs: term * term, resasms: term list, result: term, reword: Rule_Def.rew_ord', rhs: term * term,
   14.24         thm: Celem.guh, thyID: Rule.thyID}
   14.25 -     | ContThmInst of {applat: term, applto: term, asmrls: Rule.rls', asms: (term * term) list,
   14.26 -       bdvs: Rule.subst, lhs: term * term, resasms: term list, result: term, reword: Rule.rew_ord',
   14.27 +     | ContThmInst of {applat: term, applto: term, asmrls: Rule_Set.rls', asms: (term * term) list,
   14.28 +       bdvs: Rule.subst, lhs: term * term, resasms: term list, result: term, reword: Rule_Def.rew_ord',
   14.29         rhs: term * term, thm: Celem.guh, thminst: term, thyID: Rule.thyID}
   14.30       | EContThy
   14.31    val guh2filename : Celem.guh -> Celem.filename
   14.32    val is_sym : Celem.thmID -> bool
   14.33    val sym_drop : Celem.thmID -> Celem.thmID
   14.34 -  val sym_rls : Rule.rls -> Rule.rls
   14.35 +  val sym_rls : Rule_Set.rls -> Rule_Set.rls
   14.36    val sym_rule : Rule.rule -> Rule.rule
   14.37 -  val thms_of_rls : Rule.rls -> Rule.rule list
   14.38 +  val thms_of_rls : Rule_Set.rls -> Rule.rule list
   14.39    val theID2filename : Celem.theID -> Celem.filename
   14.40    val no_thycontext : Celem.guh -> bool
   14.41    val subs_from : Istate.T -> 'a -> Celem.guh -> Selem.subs
   14.42 @@ -38,9 +38,9 @@
   14.43    val context_thy : Calc.T -> Tactic.input -> contthy
   14.44    val distinct_Thm : Rule.rule list -> Rule.rule list
   14.45    val eq_Thms : string list -> Rule.rule -> bool
   14.46 -  val make_deriv : theory -> Rule.rls -> Rule.rule list -> ((term * term) list -> term * term -> bool) ->
   14.47 +  val make_deriv : theory -> Rule_Set.rls -> Rule.rule list -> ((term * term) list -> term * term -> bool) ->
   14.48      term option -> term -> deriv
   14.49 -  val reverse_deriv : theory -> Rule.rls -> Rule.rule list -> ((term * term) list -> term * term -> bool) ->
   14.50 +  val reverse_deriv : theory -> Rule_Set.rls -> Rule.rule list -> ((term * term) list -> term * term -> bool) ->
   14.51      term option -> term -> (Rule.rule * (term * term list)) list
   14.52    val get_bdv_subst : term -> (term * term) list -> Selem.subs option * Rule.subst
   14.53    val thy_containing_thm : string -> string * string
   14.54 @@ -90,11 +90,11 @@
   14.55    list
   14.56  
   14.57  fun trta2str (t, r, (t', a)) =
   14.58 -  "\n(" ^ Rule.term2str t ^ ", " ^ Rule.rule2str' r ^ ", (" ^ Rule.term2str t' ^ ", " ^ Rule.terms2str a ^ "))"
   14.59 +  "\n(" ^ Rule.term2str t ^ ", " ^ Rule_Set.rule2str' r ^ ", (" ^ Rule.term2str t' ^ ", " ^ Rule.terms2str a ^ "))"
   14.60  fun trtas2str trtas = (strs2str o (map trta2str)) trtas
   14.61  val deriv2str = trtas2str
   14.62  fun rta2str (r, (t, a)) =
   14.63 -  "\n(" ^ Rule.rule2str' r ^ ", (" ^ Rule.term2str t ^ ", " ^ Rule.terms2str a ^ "))"
   14.64 +  "\n(" ^ Rule_Set.rule2str' r ^ ", (" ^ Rule.term2str t ^ ", " ^ Rule.terms2str a ^ "))"
   14.65  fun rtas2str rtas = (strs2str o (map rta2str)) rtas
   14.66  val deri2str = rtas2str
   14.67  
   14.68 @@ -186,7 +186,7 @@
   14.69            (case Rewrite.rewrite_set_ thy true rls t of
   14.70              NONE => rew_once lim rts t apno rs'
   14.71            | SOME (t', a') => rew_once (lim - 1) (rts @ [(t, r, (t', a'))]) t' Appl rrs')
   14.72 -        | rule => error ("rew_once: uncovered case " ^ Rule.rule2str rule))
   14.73 +        | rule => error ("rew_once: uncovered case " ^ Rule_Set.rule2str rule))
   14.74      | rew_or_calc _ _ _ _ [] = error "rew_or_calc: called with []"
   14.75    in rew_once (! Celem.lim_deriv) [] tt Noap rs end
   14.76  
   14.77 @@ -201,15 +201,15 @@
   14.78  
   14.79  (*FIXXXXME.040219: detail has to handle Rls id="sym_..." 
   14.80    by applying make_deriv, rev_deriv'; see concat_deriv*)
   14.81 -fun sym_rls Rule.Erls = Rule.Erls
   14.82 -  | sym_rls (Rule.Rls {id, scr, calc, errpatts, erls, srls, rules, rew_ord, preconds}) =
   14.83 -    Rule.Rls {id = "sym_" ^ id, scr = scr, calc = calc, errpatts = errpatts, erls = erls, srls = srls, 
   14.84 +fun sym_rls Rule_Set.Erls = Rule_Set.Erls
   14.85 +  | sym_rls (Rule_Set.Rls {id, scr, calc, errpatts, erls, srls, rules, rew_ord, preconds}) =
   14.86 +    Rule_Set.Rls {id = "sym_" ^ id, scr = scr, calc = calc, errpatts = errpatts, erls = erls, srls = srls, 
   14.87        rules = rules, rew_ord = rew_ord, preconds = preconds}
   14.88 -  | sym_rls (Rule.Seq {id, scr, calc, errpatts, erls, srls, rules, rew_ord, preconds}) =
   14.89 -    Rule.Seq {id = "sym_" ^ id, scr = scr, calc = calc, errpatts = errpatts, erls = erls, srls = srls, 
   14.90 +  | sym_rls (Rule_Set.Seq {id, scr, calc, errpatts, erls, srls, rules, rew_ord, preconds}) =
   14.91 +    Rule_Set.Seq {id = "sym_" ^ id, scr = scr, calc = calc, errpatts = errpatts, erls = erls, srls = srls, 
   14.92        rules = rules, rew_ord = rew_ord, preconds = preconds}
   14.93 -  | sym_rls (Rule.Rrls {id, scr, calc, errpatts, erls, prepat, rew_ord}) = 
   14.94 -    Rule.Rrls {id = "sym_" ^ id, scr = scr, calc = calc,  errpatts = errpatts, erls = erls,
   14.95 +  | sym_rls (Rule_Set.Rrls {id, scr, calc, errpatts, erls, prepat, rew_ord}) = 
   14.96 +    Rule_Set.Rrls {id = "sym_" ^ id, scr = scr, calc = calc,  errpatts = errpatts, erls = erls,
   14.97        prepat = prepat, rew_ord = rew_ord}
   14.98  
   14.99  (* toggles sym_* and keeps "#:" for ad-hoc calculations *)
  14.100 @@ -222,7 +222,7 @@
  14.101      | _ => "sym_" ^ thmID
  14.102    in Rule.Thm (thmID', thm') end
  14.103  | sym_rule (Rule.Rls_ rls) = Rule.Rls_ (sym_rls rls) (* TODO? handle with interSteps ? *)
  14.104 -| sym_rule r = error ("sym_rule: not for " ^  Rule.rule2str r)
  14.105 +| sym_rule r = error ("sym_rule: not for " ^  Rule_Set.rule2str r)
  14.106  
  14.107  (*version for reverse rewrite used before 040214*)
  14.108  fun rev_deriv (t, r, (_, a)) = (sym_rule r, (t, a));
  14.109 @@ -231,9 +231,9 @@
  14.110  
  14.111  fun eq_Thm (Rule.Thm (id1, _), Rule.Thm (id2,_)) = id1 = id2
  14.112    | eq_Thm (Rule.Thm (_, _), _) = false
  14.113 -  | eq_Thm (Rule.Rls_ r1, Rule.Rls_ r2) = Rule.id_rls r1 = Rule.id_rls r2
  14.114 +  | eq_Thm (Rule.Rls_ r1, Rule.Rls_ r2) = Rule_Set.id_rls r1 = Rule_Set.id_rls r2
  14.115    | eq_Thm (Rule.Rls_ _, _) = false
  14.116 -  | eq_Thm (r1, r2) = error ("eq_Thm: called with '" ^ Rule.rule2str r1 ^ "' '" ^ Rule.rule2str r2 ^ "'")
  14.117 +  | eq_Thm (r1, r2) = error ("eq_Thm: called with '" ^ Rule_Set.rule2str r1 ^ "' '" ^ Rule_Set.rule2str r2 ^ "'")
  14.118  fun distinct_Thm r = gen_distinct eq_Thm r
  14.119  
  14.120  fun eq_Thms thmIDs thm = (member op = thmIDs (Celem.id_of_thm thm))
  14.121 @@ -269,14 +269,14 @@
  14.122    end
  14.123  
  14.124  (* packing return-values to matchTheory, contextToThy for xml-generation *)
  14.125 -datatype contthy =  (*also an item from KEStore on Browser .....#*)
  14.126 +datatype contthy =  (*also an item from KEStore on Browser ...........#*)
  14.127  	EContThy   (* not from KEStore ..............................*)
  14.128    | ContThm of (* a theorem in contex ===========================*)
  14.129 -    {thyID   : Rule.thyID,     (* for *2guh in sub-elems here        .*)
  14.130 +    {thyID   : Rule.thyID,      (* for *2guh in sub-elems here        .*)
  14.131       thm     : Celem.guh,       (* theorem in the context             .*)
  14.132       applto  : term,	          (* applied to formula ...             .*)
  14.133       applat  : term,	          (* ...  with lhs inserted             .*)
  14.134 -     reword  : Rule.rew_ord',  (* order used for rewrite             .*)
  14.135 +     reword  : Rule_Def.rew_ord',   (* order used for rewrite             .*)
  14.136       asms    : (term            (* asumption instantiated             .*)
  14.137     	   * term) list,            (* asumption evaluated                .*)
  14.138       lhs     : term             (* lhs of the theorem ...             #*)
  14.139 @@ -285,16 +285,16 @@
  14.140     	   * term,                  (* ... instantiated                   .*)
  14.141       result  : term,	          (* resulting from the rewrite         .*)
  14.142       resasms : term list,       (* ... with asms stored               .*)
  14.143 -     asmrls  : Rule.rls'       (* ruleset for evaluating asms        .*)
  14.144 +     asmrls  : Rule_Set.rls'        (* ruleset for evaluating asms        .*)
  14.145     	}						 
  14.146    | ContThmInst of (* a theorem with bdvs in contex ============ *)
  14.147 -    {thyID   : Rule.thyID,     (*for *2guh in sub-elems here         .*)
  14.148 +    {thyID   : Rule.thyID,      (*for *2guh in sub-elems here         .*)
  14.149       thm     : Celem.guh,       (*theorem in the context              .*)
  14.150 -     bdvs    : Rule.subst,     (*bound variables to modify...        .*)
  14.151 +     bdvs    : Rule.subst,      (*bound variables to modify...        .*)
  14.152       thminst : term,            (*... theorem instantiated            .*)
  14.153       applto  : term,	          (*applied to formula ...              .*)
  14.154       applat  : term,	          (*...  with lhs inserted              .*)
  14.155 -     reword  : Rule.rew_ord',  (*order used for rewrite              .*)
  14.156 +     reword  : Rule_Def.rew_ord',   (*order used for rewrite              .*)
  14.157       asms    : (term            (*asumption instantiated              .*)
  14.158     	   * term) list,            (*asumption evaluated                 .*)
  14.159       lhs     : term             (*lhs of the theorem ...              #*)
  14.160 @@ -303,34 +303,34 @@
  14.161     	   * term,                  (*... instantiated                    .*)
  14.162       result  : term,	          (*resulting from the rewrite          .*)
  14.163       resasms : term list,       (*... with asms stored                .*)
  14.164 -     asmrls  : Rule.rls'       (*ruleset for evaluating asms         .*)
  14.165 +     asmrls  : Rule_Set.rls'        (*ruleset for evaluating asms         .*)
  14.166      }						 
  14.167    | ContRls of (* a rule set in contex ========================= *)
  14.168 -    {thyID   : Rule.thyID,     (*for *2guh in sub-elems here         .*)
  14.169 +    {thyID   : Rule.thyID,      (*for *2guh in sub-elems here         .*)
  14.170       rls     : Celem.guh,       (*rule set in the context             .*)
  14.171       applto  : term,	          (*rewrite this formula                .*)
  14.172       result  : term,	          (*resulting from the rewrite          .*)
  14.173       asms    : term list        (*... with asms stored                .*)
  14.174     	}						 
  14.175    | ContRlsInst of (* a rule set with bdvs in contex =========== *)
  14.176 -	{thyID   : Rule.thyID,       (*for *2guh in sub-elems here         .*)
  14.177 +	{thyID   : Rule.thyID,        (*for *2guh in sub-elems here         .*)
  14.178  	 rls     : Celem.guh,         (*rule set in the context             .*)
  14.179 -	 bdvs    : Rule.subst,       (*for bound variables in thms         .*)
  14.180 +	 bdvs    : Rule.subst,        (*for bound variables in thms         .*)
  14.181  	 applto  : term,	            (*rewrite this formula                .*)
  14.182  	 result  : term,	            (*resulting from the rewrite          .*)
  14.183  	 asms    : term list          (*... with asms stored                .*)
  14.184     	}						 
  14.185    | ContNOrew of (* no rewrite for thm or rls ================== *)
  14.186 -    {thyID   : Rule.thyID,     (*for *2guh in sub-elems here         .*)
  14.187 +    {thyID   : Rule.thyID,      (*for *2guh in sub-elems here         .*)
  14.188       thm_rls : Celem.guh,       (*thm or rls in the context           .*)
  14.189       applto  : term	            (*rewrite this formula                .*)
  14.190     	}						 
  14.191    | ContNOrewInst of (* no rewrite for some instantiation ====== *)
  14.192 -    {thyID   : Rule.thyID,     (*for *2guh in sub-elems here         .*)
  14.193 +    {thyID   : Rule.thyID,      (*for *2guh in sub-elems here         .*)
  14.194       thm_rls : Celem.guh,       (*thm or rls in the context           .*)
  14.195 -     bdvs    : Rule.subst,     (*for bound variables in thms         .*)
  14.196 +     bdvs    : Rule.subst,      (*for bound variables in thms         .*)
  14.197       thminst : term,            (*... theorem instantiated            .*)
  14.198 -     applto  : term	            (*rewrite this formula               .*)
  14.199 +     applto  : term	            (*rewrite this formula                .*)
  14.200     	}						 
  14.201  
  14.202  (*.check a rewrite-tac for bdv (RL always used *_Inst !) TODO.WN060718
  14.203 @@ -352,7 +352,7 @@
  14.204            thm = Celem.thm2guh (thy_containing_thm thm_deriv) (Celem.thmID_of_derivation_name thm_deriv),
  14.205            applto = f, applat  = Rule.e_term, reword  = ord',
  14.206            asms = [](*asms ~~ asms'*), lhs = (Rule.e_term, Rule.e_term)(*(lhs, lhs')*), rhs = (Rule.e_term, Rule.e_term)(*(rhs, rhs')*),
  14.207 -          result = res, resasms = asm, asmrls  = Rule.id_rls erls}
  14.208 +          result = res, resasms = asm, asmrls  = Rule_Set.id_rls erls}
  14.209       | Applicable.Notappl _ =>
  14.210           let
  14.211             val pp = Ctree.par_pblobj pt p
  14.212 @@ -385,7 +385,7 @@
  14.213  	             Celem.thm2guh (thy_containing_thm thm_deriv) (Celem.thmID_of_derivation_name thm_deriv),
  14.214  	           bdvs = subst, thminst = thminst, applto  = f, applat  = Rule.e_term, reword  = ord',
  14.215  	           asms = [](*asms ~~ asms'*), lhs = (Rule.e_term, Rule.e_term)(*(lhs, lhs')*), rhs = (Rule.e_term, Rule.e_term)(*(rhs, rhs')*),
  14.216 -	           result = res, resasms = asm, asmrls  = Rule.id_rls erls}
  14.217 +	           result = res, resasms = asm, asmrls  = Rule_Set.id_rls erls}
  14.218  	       end
  14.219       | Applicable.Notappl _ =>
  14.220           let
  14.221 @@ -432,10 +432,10 @@
  14.222    | thm_of_rule (Rule.Num_Calc _) = []
  14.223    | thm_of_rule (Rule.Cal1 _) = []
  14.224    | thm_of_rule (Rule.Rls_ rls) = thms_of_rls rls
  14.225 -and thms_of_rls Rule.Erls = []
  14.226 -  | thms_of_rls (Rule.Rls {rules,...}) = (flat o (map  thm_of_rule)) rules
  14.227 -  | thms_of_rls (Rule.Seq {rules,...}) = (flat o (map  thm_of_rule)) rules
  14.228 -  | thms_of_rls (Rule.Rrls _) = []
  14.229 +and thms_of_rls Rule_Set.Erls = []
  14.230 +  | thms_of_rls (Rule_Set.Rls {rules,...}) = (flat o (map  thm_of_rule)) rules
  14.231 +  | thms_of_rls (Rule_Set.Seq {rules,...}) = (flat o (map  thm_of_rule)) rules
  14.232 +  | thms_of_rls (Rule_Set.Rrls _) = []
  14.233  
  14.234  (* check if a rule is contained in a rule-set (recursivley down in Rls_);
  14.235     this rule can even be a rule-set itself                             *)
  14.236 @@ -444,14 +444,14 @@
  14.237      fun (*find (_, Rls_ rls) = finds (get_rules rls)
  14.238        | find r12 = eq_rule r12
  14.239      and*) finds [] = false
  14.240 -    | finds (r1 :: rs) = if Rule.eq_rule (r, r1) then true else finds rs
  14.241 +    | finds (r1 :: rs) = if Rule_Set.eq_rule (r, r1) then true else finds rs
  14.242    in 
  14.243 -    finds (Rule.get_rules rls) 
  14.244 +    finds (Rule_Set.get_rules rls) 
  14.245    end
  14.246  
  14.247  (* try if a rewrite-rule is applicable to a given formula; 
  14.248     in case of rule-sets (recursivley) collect all _atomic_ rewrites *) 
  14.249 -fun try_rew thy ((_, ro) : Rule.rew_ord) erls (subst : Rule.subst) f (thm' as Rule.Thm (_, thm)) =
  14.250 +fun try_rew thy ((_, ro) : Rule_Def.rew_ord) erls (subst : Rule.subst) f (thm' as Rule.Thm (_, thm)) =
  14.251      if Auto_Prog.contains_bdv thm
  14.252      then case Rewrite.rewrite_inst_ thy ro erls false subst thm f of
  14.253  	    SOME _ => [Tactic.rule2tac thy subst thm']
  14.254 @@ -469,17 +469,17 @@
  14.255        | NONE => [])
  14.256    | try_rew thy _ _ subst f (Rule.Rls_ rls) = filter_appl_rews thy subst f rls
  14.257    | try_rew _ _ _ _ _ _ = error "try_rew: uncovered case"
  14.258 -and filter_appl_rews thy subst f (Rule.Rls {rew_ord = ro, erls, rules, ...}) = 
  14.259 +and filter_appl_rews thy subst f (Rule_Set.Rls {rew_ord = ro, erls, rules, ...}) = 
  14.260      gen_distinct Tactic.eq_tac (flat (map (try_rew thy ro erls subst f) rules))
  14.261 -  | filter_appl_rews thy subst f (Rule.Seq {rew_ord = ro, erls, rules,...}) = 
  14.262 +  | filter_appl_rews thy subst f (Rule_Set.Seq {rew_ord = ro, erls, rules,...}) = 
  14.263      gen_distinct Tactic.eq_tac (flat (map (try_rew thy ro erls subst f) rules))
  14.264 -  | filter_appl_rews _ _ _ (Rule.Rrls _) = []
  14.265 +  | filter_appl_rews _ _ _ (Rule_Set.Rrls _) = []
  14.266    | filter_appl_rews _ _ _ _ = error "filter_appl_rews: uncovered case"
  14.267  
  14.268  (* decide if a tactic is applicable to a given formula; 
  14.269     in case of Rewrite_Set* go down to _atomic_ rewrite-tactics *)
  14.270  fun atomic_appl_tacs thy _ _ f (Tactic.Calculate scrID) =
  14.271 -    try_rew thy Rule.e_rew_ordX Rule.e_rls [] f (Rule.Num_Calc (assoc_calc' thy scrID |> snd))
  14.272 +    try_rew thy Rule.e_rew_ordX Rule_Set.e_rls [] f (Rule.Num_Calc (assoc_calc' thy scrID |> snd))
  14.273    | atomic_appl_tacs thy ro erls f (Tactic.Rewrite thm'') =
  14.274      try_rew thy (ro, Rule.assoc_rew_ord ro) erls [] f (Rule.Thm thm'')
  14.275    | atomic_appl_tacs thy ro erls f (Tactic.Rewrite_Inst (subs, thm'')) =
  14.276 @@ -591,7 +591,7 @@
  14.277  	        end
  14.278    	  | "Rulesets" => 
  14.279          let
  14.280 -          val rules = (Rule.get_rules o assoc_rls) xstr
  14.281 +          val rules = (Rule_Set.get_rules o assoc_rls) xstr
  14.282          in
  14.283            if Auto_Prog.contain_bdv rules
  14.284            then
    15.1 --- a/src/Tools/isac/Knowledge/AlgEin.thy	Wed Apr 01 19:20:05 2020 +0200
    15.2 +++ b/src/Tools/isac/Knowledge/AlgEin.thy	Sat Apr 04 12:11:32 2020 +0200
    15.3 @@ -24,25 +24,25 @@
    15.4  \<close>
    15.5  (** problems **)
    15.6  setup \<open>KEStore_Elems.add_pbts
    15.7 -  [(Specify.prep_pbt thy "pbl_algein" [] Celem.e_pblID (["Berechnung"], [], Rule.e_rls, NONE, [])),
    15.8 +  [(Specify.prep_pbt thy "pbl_algein" [] Celem.e_pblID (["Berechnung"], [], Rule_Set.e_rls, NONE, [])),
    15.9      (Specify.prep_pbt thy "pbl_algein_numsym" [] Celem.e_pblID
   15.10        (["numerischSymbolische", "Berechnung"],
   15.11          [("#Given",
   15.12              ["KantenLaenge k_k","Querschnitt q__q"(*q_ in Biegelinie.thy*), "KantenUnten u_u",
   15.13                "KantenSenkrecht s_s", "KantenOben o_o"]),
   15.14            ("#Find", ["GesamtLaenge l_l"])],
   15.15 -        Rule.e_rls, NONE, [["Berechnung", "erstNumerisch"], ["Berechnung", "erstSymbolisch"]]))]\<close>
   15.16 +        Rule_Set.e_rls, NONE, [["Berechnung", "erstNumerisch"], ["Berechnung", "erstSymbolisch"]]))]\<close>
   15.17  
   15.18  setup \<open>KEStore_Elems.add_mets
   15.19      [Specify.prep_met thy "met_algein" [] Celem.e_metID
   15.20  	    (["Berechnung"], [],
   15.21 -	      {rew_ord'="tless_true", rls'= Rule.Erls, calc = [], srls = Rule.Erls, prls = Rule.Erls, crls =Rule.Erls,
   15.22 -          errpats = [], nrls = Rule.Erls},
   15.23 +	      {rew_ord'="tless_true", rls'= Rule_Set.Erls, calc = [], srls = Rule_Set.Erls, prls = Rule_Set.Erls, crls =Rule_Set.Erls,
   15.24 +          errpats = [], nrls = Rule_Set.Erls},
   15.25            @{thm refl}),
   15.26      Specify.prep_met thy "met_algein_numsym" [] Celem.e_metID
   15.27  	    (["Berechnung","erstNumerisch"], [],
   15.28 -	      {rew_ord'="tless_true", rls'= Rule.Erls, calc = [], srls = Rule.Erls, prls = Rule.Erls, crls =Rule.Erls,
   15.29 -	        errpats = [], nrls = Rule.Erls},
   15.30 +	      {rew_ord'="tless_true", rls'= Rule_Set.Erls, calc = [], srls = Rule_Set.Erls, prls = Rule_Set.Erls, crls =Rule_Set.Erls,
   15.31 +	        errpats = [], nrls = Rule_Set.Erls},
   15.32  	      @{thm refl})]
   15.33  \<close>
   15.34  
   15.35 @@ -74,10 +74,10 @@
   15.36  	       [("#Given" ,["KantenLaenge k_k","Querschnitt q__q", "KantenUnten u_u",
   15.37  	           "KantenSenkrecht s_s", "KantenOben o_o"]),
   15.38  	         ("#Find"  ,["GesamtLaenge l_l"])],
   15.39 -	       {rew_ord'="tless_true", rls'= Rule.e_rls, calc = [],
   15.40 -           srls = Rule.append_rls "srls_..Berechnung-erstSymbolisch" Rule.e_rls 
   15.41 +	       {rew_ord'="tless_true", rls'= Rule_Set.e_rls, calc = [],
   15.42 +           srls = Rule_Set.append_rls "srls_..Berechnung-erstSymbolisch" Rule_Set.e_rls 
   15.43  				       [Rule.Num_Calc ("Prog_Expr.boollist2sum", Prog_Expr.eval_boollist2sum "")], 
   15.44 -		       prls = Rule.e_rls, crls =Rule.e_rls , errpats = [], nrls = norm_Rational},
   15.45 +		       prls = Rule_Set.e_rls, crls =Rule_Set.e_rls , errpats = [], nrls = norm_Rational},
   15.46           @{thm symbolisch_rechnen.simps})]
   15.47  \<close>
   15.48  
   15.49 @@ -107,10 +107,10 @@
   15.50  	        [("#Given" ,["KantenLaenge k_k","Querschnitt q__q", "KantenUnten u_u",
   15.51                  "KantenSenkrecht s_s", "KantenOben o_o"]),
   15.52  		        ("#Find"  ,["GesamtLaenge l_l"])],
   15.53 -	        {rew_ord'="tless_true", rls'= Rule.e_rls, calc = [], 
   15.54 -	          srls = Rule.append_rls "srls_..Berechnung-erstSymbolisch" Rule.e_rls 
   15.55 +	        {rew_ord'="tless_true", rls'= Rule_Set.e_rls, calc = [], 
   15.56 +	          srls = Rule_Set.append_rls "srls_..Berechnung-erstSymbolisch" Rule_Set.e_rls 
   15.57  				        [Rule.Num_Calc ("Prog_Expr.boollist2sum", Prog_Expr.eval_boollist2sum "")], 
   15.58 -				    prls = Rule.e_rls, crls =Rule.e_rls , errpats = [], nrls = norm_Rational},
   15.59 +				    prls = Rule_Set.e_rls, crls =Rule_Set.e_rls , errpats = [], nrls = norm_Rational},
   15.60              @{thm symbolisch_rechnen.simps})]
   15.61  \<close>
   15.62  
    16.1 --- a/src/Tools/isac/Knowledge/Base_Tools.thy	Wed Apr 01 19:20:05 2020 +0200
    16.2 +++ b/src/Tools/isac/Knowledge/Base_Tools.thy	Sat Apr 04 12:11:32 2020 +0200
    16.3 @@ -57,7 +57,7 @@
    16.4  subsection \<open>rule-sets\<close>
    16.5  ML \<open>
    16.6  \<close> ML \<open>
    16.7 -val Atools_erls = Rule.append_rls "Atools_erls" Rule.e_rls
    16.8 +val Atools_erls = Rule_Set.append_rls "Atools_erls" Rule_Set.e_rls
    16.9    [ Rule.Num_Calc ("HOL.eq", Prog_Expr.eval_equal "#equal_"),
   16.10      Rule.Thm ("not_true", TermC.num_str @{thm not_true}),
   16.11  		(*"(~ True) = False"*)
   16.12 @@ -89,7 +89,7 @@
   16.13  \<close>
   16.14  
   16.15  ML \<open>
   16.16 -val Atools_crls = Rule.append_rls "Atools_crls" Rule.e_rls
   16.17 +val Atools_crls = Rule_Set.append_rls "Atools_crls" Rule_Set.e_rls
   16.18    [ Rule.Num_Calc ("HOL.eq", Prog_Expr.eval_equal "#equal_"),
   16.19      Rule.Thm ("not_true", TermC.num_str @{thm not_true}),
   16.20  		Rule.Thm ("not_false", TermC.num_str @{thm not_false}),
   16.21 @@ -117,7 +117,7 @@
   16.22  subsection \<open>ONCE AGAIN extend rule-set for evaluating pre-conditions and program-expressions\<close>
   16.23  text \<open>requires "eval_binop" from above\<close>
   16.24  ML \<open>
   16.25 -val prog_expr = Rule.append_rls "prog_expr" prog_expr
   16.26 +val prog_expr = Rule_Set.append_rls "prog_expr" prog_expr
   16.27  	[ Rule.Num_Calc ("Groups.times_class.times", (**)eval_binop "#mult_"),
   16.28  		Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"), 
   16.29  		Rule.Num_Calc ("Orderings.ord_class.less", Prog_Expr.eval_equ "#less_"),
   16.30 @@ -130,15 +130,15 @@
   16.31  		Rule.Thm ("if_True",TermC.num_str @{thm if_True}),
   16.32  		Rule.Thm ("if_False",TermC.num_str @{thm if_False})];
   16.33  
   16.34 -val prog_expr = Auto_Prog.prep_rls @{theory} (Rule.merge_rls "list_erls"
   16.35 -	(Rule.Rls {id = "replaced", preconds = [], rew_ord = ("termlessI", termlessI),
   16.36 -    erls = Rule.Rls {id = "list_elrs", preconds = [], rew_ord = ("termlessI", termlessI), 
   16.37 -    erls = Rule.e_rls, srls = Rule.Erls, calc = [], errpatts = [],
   16.38 +val prog_expr = Auto_Prog.prep_rls @{theory} (Rule_Set.merge_rls "list_erls"
   16.39 +	(Rule_Set.Rls {id = "replaced", preconds = [], rew_ord = ("termlessI", termlessI),
   16.40 +    erls = Rule_Set.Rls {id = "list_elrs", preconds = [], rew_ord = ("termlessI", termlessI), 
   16.41 +    erls = Rule_Set.e_rls, srls = Rule_Set.Erls, calc = [], errpatts = [],
   16.42      rules = [Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"),
   16.43        Rule.Num_Calc ("Orderings.ord_class.less", Prog_Expr.eval_equ "#less_")
   16.44        (*    ~~~~~~ for nth_Cons_*)],
   16.45      scr = Rule.EmptyScr},
   16.46 -    srls = Rule.Erls, calc = [], errpatts = [],
   16.47 +    srls = Rule_Set.Erls, calc = [], errpatts = [],
   16.48      rules = [], scr = Rule.EmptyScr})
   16.49    prog_expr);
   16.50  \<close>
    17.1 --- a/src/Tools/isac/Knowledge/Biegelinie.thy	Wed Apr 01 19:20:05 2020 +0200
    17.2 +++ b/src/Tools/isac/Knowledge/Biegelinie.thy	Sat Apr 04 12:11:32 2020 +0200
    17.3 @@ -78,7 +78,7 @@
    17.4            (*("#Where",["0 < l_l"]), ...wait for &lt; and handling Arbfix*)
    17.5            ("#Find"  ,["Biegelinie b_b"]),
    17.6            ("#Relate",["Randbedingungen r_b"])],
    17.7 -        Rule.append_rls "e_rls" Rule.e_rls [], NONE, [["IntegrierenUndKonstanteBestimmen2"]])),
    17.8 +        Rule_Set.append_rls "e_rls" Rule_Set.e_rls [], NONE, [["IntegrierenUndKonstanteBestimmen2"]])),
    17.9      (Specify.prep_pbt @{theory} "pbl_bieg_mom" [] Celem.e_pblID
   17.10        (["MomentBestimmte","Biegelinien"],
   17.11          [("#Given" ,["Traegerlaenge l_l", "Streckenlast q_q"]),
   17.12 @@ -86,44 +86,44 @@
   17.13            ("#Find"  ,["Biegelinie b_b"]),
   17.14            ("#Relate",["RandbedingungenBiegung r_b","RandbedingungenMoment r_m"])
   17.15          ],
   17.16 -        Rule.append_rls "e_rls" Rule.e_rls [], NONE, [["IntegrierenUndKonstanteBestimmen"]])),
   17.17 +        Rule_Set.append_rls "e_rls" Rule_Set.e_rls [], NONE, [["IntegrierenUndKonstanteBestimmen"]])),
   17.18      (Specify.prep_pbt @{theory} "pbl_bieg_momg" [] Celem.e_pblID
   17.19 -      (["MomentGegebene","Biegelinien"], [], Rule.append_rls "e_rls" Rule.e_rls [], NONE,
   17.20 +      (["MomentGegebene","Biegelinien"], [], Rule_Set.append_rls "e_rls" Rule_Set.e_rls [], NONE,
   17.21          [["IntegrierenUndKonstanteBestimmen","2xIntegrieren"]])),
   17.22      (Specify.prep_pbt @{theory} "pbl_bieg_einf" [] Celem.e_pblID
   17.23 -      (["einfache","Biegelinien"], [], Rule.append_rls "e_rls" Rule.e_rls [], NONE,
   17.24 +      (["einfache","Biegelinien"], [], Rule_Set.append_rls "e_rls" Rule_Set.e_rls [], NONE,
   17.25          [["IntegrierenUndKonstanteBestimmen","4x4System"]])),
   17.26      (Specify.prep_pbt @{theory} "pbl_bieg_momquer" [] Celem.e_pblID
   17.27 -      (["QuerkraftUndMomentBestimmte","Biegelinien"], [], Rule.append_rls "e_rls" Rule.e_rls [], NONE,
   17.28 +      (["QuerkraftUndMomentBestimmte","Biegelinien"], [], Rule_Set.append_rls "e_rls" Rule_Set.e_rls [], NONE,
   17.29          [["IntegrierenUndKonstanteBestimmen","1xIntegrieren"]])),
   17.30      (Specify.prep_pbt @{theory} "pbl_bieg_vonq" [] Celem.e_pblID
   17.31        (["vonBelastungZu","Biegelinien"],
   17.32            [("#Given" ,["Streckenlast q_q","FunktionsVariable v_v"]),
   17.33              ("#Find"  ,["Funktionen funs'''"])],
   17.34 -        Rule.append_rls "e_rls" Rule.e_rls [], NONE, [["Biegelinien","ausBelastung"]])),
   17.35 +        Rule_Set.append_rls "e_rls" Rule_Set.e_rls [], NONE, [["Biegelinien","ausBelastung"]])),
   17.36      (Specify.prep_pbt @{theory} "pbl_bieg_randbed" [] Celem.e_pblID
   17.37        (["setzeRandbedingungen","Biegelinien"],
   17.38            [("#Given" ,["Funktionen fun_s","Randbedingungen r_b"]),
   17.39              ("#Find"  ,["Gleichungen equs'''"])],
   17.40 -        Rule.append_rls "e_rls" Rule.e_rls [], NONE, [["Biegelinien","setzeRandbedingungenEin"]])),
   17.41 +        Rule_Set.append_rls "e_rls" Rule_Set.e_rls [], NONE, [["Biegelinien","setzeRandbedingungenEin"]])),
   17.42      (Specify.prep_pbt @{theory} "pbl_equ_fromfun" [] Celem.e_pblID
   17.43        (["makeFunctionTo","equation"],
   17.44            [("#Given" ,["functionEq fu_n","substitution su_b"]),
   17.45              ("#Find"  ,["equality equ'''"])],
   17.46 -        Rule.append_rls "e_rls" Rule.e_rls [], NONE, [["Equation","fromFunction"]]))]\<close>
   17.47 +        Rule_Set.append_rls "e_rls" Rule_Set.e_rls [], NONE, [["Equation","fromFunction"]]))]\<close>
   17.48  ML \<open>
   17.49  (** methods **)
   17.50  
   17.51 -val srls = Rule.Rls {id="srls_IntegrierenUnd..", 
   17.52 +val srls = Rule_Set.Rls {id="srls_IntegrierenUnd..", 
   17.53  		preconds = [], 
   17.54  		rew_ord = ("termlessI",termlessI), 
   17.55 -		erls = Rule.append_rls "erls_in_srls_IntegrierenUnd.." Rule.e_rls
   17.56 +		erls = Rule_Set.append_rls "erls_in_srls_IntegrierenUnd.." Rule_Set.e_rls
   17.57  				  [(*for asm in NTH_CONS ...*)
   17.58  				   Rule.Num_Calc ("Orderings.ord_class.less", Prog_Expr.eval_equ "#less_"),
   17.59  				   (*2nd NTH_CONS pushes n+-1 into asms*)
   17.60  				   Rule.Num_Calc("Groups.plus_class.plus", (**)eval_binop "#add_")
   17.61  				   ], 
   17.62 -		srls = Rule.Erls, calc = [], errpatts = [],
   17.63 +		srls = Rule_Set.Erls, calc = [], errpatts = [],
   17.64  		rules = [Rule.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
   17.65  			 Rule.Num_Calc("Groups.plus_class.plus", (**)eval_binop "#add_"),
   17.66  			 Rule.Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}),
   17.67 @@ -134,16 +134,16 @@
   17.68  		scr = Rule.EmptyScr};
   17.69      
   17.70  val srls2 = 
   17.71 -    Rule.Rls {id="srls_IntegrierenUnd..", 
   17.72 +    Rule_Set.Rls {id="srls_IntegrierenUnd..", 
   17.73  	 preconds = [], 
   17.74  	 rew_ord = ("termlessI",termlessI), 
   17.75 -	 erls = Rule.append_rls "erls_in_srls_IntegrierenUnd.." Rule.e_rls
   17.76 +	 erls = Rule_Set.append_rls "erls_in_srls_IntegrierenUnd.." Rule_Set.e_rls
   17.77  			   [(*for asm in NTH_CONS ...*)
   17.78  			    Rule.Num_Calc ("Orderings.ord_class.less", Prog_Expr.eval_equ "#less_"),
   17.79  			    (*2nd NTH_CONS pushes n+-1 into asms*)
   17.80  			    Rule.Num_Calc("Groups.plus_class.plus", (**)eval_binop "#add_")
   17.81  			    ], 
   17.82 -	 srls = Rule.Erls, calc = [], errpatts = [],
   17.83 +	 srls = Rule_Set.Erls, calc = [], errpatts = [],
   17.84  	 rules = [Rule.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
   17.85  		  Rule.Num_Calc("Groups.plus_class.plus", (**)eval_binop "#add_"),
   17.86  		  Rule.Thm ("NTH_NIL", TermC.num_str @{thm NTH_NIL}),
   17.87 @@ -165,8 +165,8 @@
   17.88  setup \<open>KEStore_Elems.add_mets
   17.89      [Specify.prep_met @{theory} "met_biege" [] Celem.e_metID 
   17.90  	    (["IntegrierenUndKonstanteBestimmen"], [],
   17.91 -	    {rew_ord'="tless_true", rls'= Rule.Erls, calc = [], srls = Rule.Erls, prls = Rule.Erls, crls =Rule.Erls,
   17.92 -          errpats = [], nrls = Rule.Erls},
   17.93 +	    {rew_ord'="tless_true", rls'= Rule_Set.Erls, calc = [], srls = Rule_Set.Erls, prls = Rule_Set.Erls, crls =Rule_Set.Erls,
   17.94 +          errpats = [], nrls = Rule_Set.Erls},
   17.95        @{thm refl})]
   17.96  \<close>
   17.97  subsection \<open>Sub-problem "integrate and determine constants", nicely modularised\<close>
   17.98 @@ -194,40 +194,40 @@
   17.99  		      ("#Find"  ,["Biegelinie b"]),
  17.100  		      ("#Relate",["Randbedingungen s"])],
  17.101  	      {rew_ord'="tless_true", 
  17.102 -	        rls' = Rule.append_rls "erls_IntegrierenUndK.." Rule.e_rls 
  17.103 +	        rls' = Rule_Set.append_rls "erls_IntegrierenUndK.." Rule_Set.e_rls 
  17.104  				      [Rule.Num_Calc ("Prog_Expr.ident", Prog_Expr.eval_ident "#ident_"),
  17.105  				        Rule.Thm ("not_true",TermC.num_str @{thm not_true}),
  17.106  				        Rule.Thm ("not_false",TermC.num_str @{thm not_false})], 
  17.107  				  calc = [], 
  17.108 -				  srls = Rule.append_rls "erls_IntegrierenUndK.." Rule.e_rls 
  17.109 +				  srls = Rule_Set.append_rls "erls_IntegrierenUndK.." Rule_Set.e_rls 
  17.110  				      [Rule.Num_Calc("Prog_Expr.rhs", Prog_Expr.eval_rhs"eval_rhs_"),
  17.111  				        Rule.Num_Calc ("Prog_Expr.ident", Prog_Expr.eval_ident "#ident_"),
  17.112  				        Rule.Thm ("last_thmI",TermC.num_str @{thm last_thmI}),
  17.113  				        Rule.Thm ("if_True",TermC.num_str @{thm if_True}),
  17.114  				        Rule.Thm ("if_False",TermC.num_str @{thm if_False})],
  17.115 -				  prls = Rule.Erls, crls = Atools_erls, errpats = [], nrls = Rule.Erls},
  17.116 +				  prls = Rule_Set.Erls, crls = Atools_erls, errpats = [], nrls = Rule_Set.Erls},
  17.117          @{thm biegelinie.simps})]
  17.118  \<close>
  17.119  setup \<open>KEStore_Elems.add_mets
  17.120      [Specify.prep_met @{theory} "met_biege_intconst_2" [] Celem.e_metID
  17.121  	    (["IntegrierenUndKonstanteBestimmen","2xIntegrieren"], [],
  17.122 -	      {rew_ord'="tless_true", rls'=Rule.Erls, calc = [], srls = Rule.e_rls, prls=Rule.e_rls, crls = Atools_erls,
  17.123 -          errpats = [], nrls = Rule.e_rls},
  17.124 +	      {rew_ord'="tless_true", rls'=Rule_Set.Erls, calc = [], srls = Rule_Set.e_rls, prls=Rule_Set.e_rls, crls = Atools_erls,
  17.125 +          errpats = [], nrls = Rule_Set.e_rls},
  17.126          @{thm refl}),
  17.127      Specify.prep_met @{theory} "met_biege_intconst_4" [] Celem.e_metID
  17.128  	    (["IntegrierenUndKonstanteBestimmen","4x4System"], [],
  17.129 -	      {rew_ord'="tless_true", rls'=Rule.Erls, calc = [], srls = Rule.e_rls, prls=Rule.e_rls, crls = Atools_erls,
  17.130 -          errpats = [], nrls = Rule.e_rls},
  17.131 +	      {rew_ord'="tless_true", rls'=Rule_Set.Erls, calc = [], srls = Rule_Set.e_rls, prls=Rule_Set.e_rls, crls = Atools_erls,
  17.132 +          errpats = [], nrls = Rule_Set.e_rls},
  17.133          @{thm refl}),
  17.134      Specify.prep_met @{theory} "met_biege_intconst_1" [] Celem.e_metID
  17.135  	    (["IntegrierenUndKonstanteBestimmen","1xIntegrieren"], [],
  17.136 -        {rew_ord'="tless_true", rls'=Rule.Erls, calc = [], srls = Rule.e_rls, prls=Rule.e_rls, crls = Atools_erls,
  17.137 -          errpats = [], nrls = Rule.e_rls},
  17.138 +        {rew_ord'="tless_true", rls'=Rule_Set.Erls, calc = [], srls = Rule_Set.e_rls, prls=Rule_Set.e_rls, crls = Atools_erls,
  17.139 +          errpats = [], nrls = Rule_Set.e_rls},
  17.140          @{thm refl}),
  17.141      Specify.prep_met @{theory} "met_biege2" [] Celem.e_metID
  17.142  	    (["Biegelinien"], [],
  17.143 -	      {rew_ord'="tless_true", rls'=Rule.Erls, calc = [], srls = Rule.e_rls, prls=Rule.e_rls, crls = Atools_erls,
  17.144 -          errpats = [], nrls = Rule.e_rls},
  17.145 +	      {rew_ord'="tless_true", rls'=Rule_Set.Erls, calc = [], srls = Rule_Set.e_rls, prls=Rule_Set.e_rls, crls = Atools_erls,
  17.146 +          errpats = [], nrls = Rule_Set.e_rls},
  17.147          @{thm refl})]
  17.148  \<close>
  17.149  subsection \<open>Compute the general bending line\<close>
  17.150 @@ -260,14 +260,14 @@
  17.151              "Biegelinie id_fun", "AbleitungBiegelinie id_abl"]),
  17.152  	       ("#Find"  ,["Funktionen fun_s"])],
  17.153  	      {rew_ord'="tless_true", 
  17.154 -	        rls' = Rule.append_rls "erls_ausBelastung" Rule.e_rls 
  17.155 +	        rls' = Rule_Set.append_rls "erls_ausBelastung" Rule_Set.e_rls 
  17.156  				      [Rule.Num_Calc ("Prog_Expr.ident", Prog_Expr.eval_ident "#ident_"),
  17.157  				        Rule.Thm ("not_true", TermC.num_str @{thm not_true}),
  17.158  				        Rule.Thm ("not_false", TermC.num_str @{thm not_false})], 
  17.159  				  calc = [], 
  17.160 -				  srls = Rule.append_rls "srls_ausBelastung" Rule.e_rls 
  17.161 +				  srls = Rule_Set.append_rls "srls_ausBelastung" Rule_Set.e_rls 
  17.162  				      [Rule.Num_Calc ("Prog_Expr.rhs", Prog_Expr.eval_rhs "eval_rhs_")], 
  17.163 -				  prls = Rule.e_rls, crls = Atools_erls, errpats = [], nrls = Rule.e_rls},
  17.164 +				  prls = Rule_Set.e_rls, crls = Atools_erls, errpats = [], nrls = Rule_Set.e_rls},
  17.165          @{thm belastung_zu_biegelinie.simps})]
  17.166  \<close>
  17.167  subsection \<open>Substitute the constraints into the equations\<close>
  17.168 @@ -299,8 +299,8 @@
  17.169  	    (["Biegelinien", "setzeRandbedingungenEin"],
  17.170  	      [("#Given" , ["Funktionen fun_s", "Randbedingungen r_b"]),
  17.171  	        ("#Find"  , ["Gleichungen equs'''"])],
  17.172 -	      {rew_ord'="tless_true", rls'=Rule.Erls, calc = [], srls = srls2, prls=Rule.e_rls, crls = Atools_erls,
  17.173 -          errpats = [], nrls = Rule.e_rls},
  17.174 +	      {rew_ord'="tless_true", rls'=Rule_Set.Erls, calc = [], srls = srls2, prls=Rule_Set.e_rls, crls = Atools_erls,
  17.175 +          errpats = [], nrls = Rule_Set.e_rls},
  17.176          @{thm setzte_randbedingungen.simps})]
  17.177  \<close>
  17.178  subsection \<open>Transform an equality into a function\<close>
  17.179 @@ -323,11 +323,11 @@
  17.180  	    (["Equation","fromFunction"],
  17.181  	      [("#Given" ,["functionEq fu_n","substitution su_b"]),
  17.182  	        ("#Find"  ,["equality equ'''"])],
  17.183 -	      {rew_ord'="tless_true", rls'=Rule.Erls, calc = [],
  17.184 -          srls = Rule.append_rls "srls_in_EquationfromFunc" Rule.e_rls
  17.185 +	      {rew_ord'="tless_true", rls'=Rule_Set.Erls, calc = [],
  17.186 +          srls = Rule_Set.append_rls "srls_in_EquationfromFunc" Rule_Set.e_rls
  17.187  				      [Rule.Num_Calc("Prog_Expr.lhs", Prog_Expr.eval_lhs "eval_lhs_"),
  17.188  				        Rule.Num_Calc("Prog_Expr.argument'_in", Prog_Expr.eval_argument_in "Prog_Expr.argument'_in")], 
  17.189 -				  prls=Rule.e_rls, crls = Atools_erls, errpats = [], nrls = Rule.e_rls},
  17.190 +				  prls=Rule_Set.e_rls, crls = Atools_erls, errpats = [], nrls = Rule_Set.e_rls},
  17.191          (*(M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2) (M_b L = 0) -->
  17.192                 0 = c_2 + c * L + -1 * q_0 / 2 * L ^^^ 2*)
  17.193          @{thm function_to_equality.simps})]
    18.1 --- a/src/Tools/isac/Knowledge/Diff.thy	Wed Apr 01 19:20:05 2020 +0200
    18.2 +++ b/src/Tools/isac/Knowledge/Diff.thy	Sat Apr 04 12:11:32 2020 +0200
    18.3 @@ -106,10 +106,10 @@
    18.4  
    18.5  (*.converts a term such that differentiation works optimally.*)
    18.6  val diff_conv =   
    18.7 -    Rule.Rls {id="diff_conv", 
    18.8 +    Rule_Set.Rls {id="diff_conv", 
    18.9  	 preconds = [], 
   18.10  	 rew_ord = ("termlessI",termlessI), 
   18.11 -	 erls = Rule.append_rls "erls_diff_conv" Rule.e_rls 
   18.12 +	 erls = Rule_Set.append_rls "erls_diff_conv" Rule_Set.e_rls 
   18.13  			   [Rule.Num_Calc ("Prog_Expr.occurs'_in", Prog_Expr.eval_occurs_in ""),
   18.14  			    Rule.Thm ("not_true",TermC.num_str @{thm not_true}),
   18.15  			    Rule.Thm ("not_false",TermC.num_str @{thm not_false}),
   18.16 @@ -117,7 +117,7 @@
   18.17  			    Rule.Thm ("and_true",TermC.num_str @{thm and_true}),
   18.18  			    Rule.Thm ("and_false",TermC.num_str @{thm and_false})
   18.19  			    ], 
   18.20 -	 srls = Rule.Erls, calc = [], errpatts = [],
   18.21 +	 srls = Rule_Set.Erls, calc = [], errpatts = [],
   18.22  	 rules =
   18.23    [Rule.Thm ("frac_conv", TermC.num_str @{thm frac_conv}),
   18.24       (*"?bdv occurs_in ?b \<Longrightarrow> 0 < ?n \<Longrightarrow> ?a / ?b ^^^ ?n = ?a * ?b ^^^ - ?n"*)
   18.25 @@ -144,13 +144,13 @@
   18.26  ML \<open>
   18.27  (*.beautifies a term after differentiation.*)
   18.28  val diff_sym_conv =   
   18.29 -    Rule.Rls {id="diff_sym_conv", 
   18.30 +    Rule_Set.Rls {id="diff_sym_conv", 
   18.31  	 preconds = [], 
   18.32  	 rew_ord = ("termlessI",termlessI), 
   18.33 -	 erls = Rule.append_rls "erls_diff_sym_conv" Rule.e_rls 
   18.34 +	 erls = Rule_Set.append_rls "erls_diff_sym_conv" Rule_Set.e_rls 
   18.35  			   [Rule.Num_Calc ("Orderings.ord_class.less", Prog_Expr.eval_equ "#less_")
   18.36  			    ], 
   18.37 -	 srls = Rule.Erls, calc = [], errpatts = [],
   18.38 +	 srls = Rule_Set.Erls, calc = [], errpatts = [],
   18.39  	 rules = [Rule.Thm ("frac_sym_conv", TermC.num_str @{thm frac_sym_conv}),
   18.40  		  Rule.Thm ("sqrt_sym_conv", TermC.num_str @{thm sqrt_sym_conv}),
   18.41  		  Rule.Thm ("root_sym_conv", TermC.num_str @{thm root_sym_conv}),
   18.42 @@ -169,11 +169,11 @@
   18.43  
   18.44  (*..*)
   18.45  val srls_diff = 
   18.46 -    Rule.Rls {id="srls_differentiate..", 
   18.47 +    Rule_Set.Rls {id="srls_differentiate..", 
   18.48  	 preconds = [], 
   18.49  	 rew_ord = ("termlessI",termlessI), 
   18.50 -	 erls = Rule.e_rls, 
   18.51 -	 srls = Rule.Erls, calc = [], errpatts = [],
   18.52 +	 erls = Rule_Set.e_rls, 
   18.53 +	 srls = Rule_Set.Erls, calc = [], errpatts = [],
   18.54  	 rules = [Rule.Num_Calc("Prog_Expr.lhs", Prog_Expr.eval_lhs "eval_lhs_"),
   18.55  		  Rule.Num_Calc("Prog_Expr.rhs", Prog_Expr.eval_rhs "eval_rhs_"),
   18.56  		  Rule.Num_Calc("Diff.primed", eval_primed "Diff.primed")
   18.57 @@ -183,7 +183,7 @@
   18.58  ML \<open>
   18.59  (*..*)
   18.60  val erls_diff = 
   18.61 -    Rule.append_rls "erls_differentiate.." Rule.e_rls
   18.62 +    Rule_Set.append_rls "erls_differentiate.." Rule_Set.e_rls
   18.63                 [Rule.Thm ("not_true",TermC.num_str @{thm not_true}),
   18.64  		Rule.Thm ("not_false",TermC.num_str @{thm not_false}),
   18.65  		
   18.66 @@ -195,8 +195,8 @@
   18.67  
   18.68  (*.rules for differentiation, _no_ simplification.*)
   18.69  val diff_rules =
   18.70 -    Rule.Rls {id="diff_rules", preconds = [], rew_ord = ("termlessI",termlessI), 
   18.71 -	 erls = erls_diff, srls = Rule.Erls, calc = [], errpatts = [],
   18.72 +    Rule_Set.Rls {id="diff_rules", preconds = [], rew_ord = ("termlessI",termlessI), 
   18.73 +	 erls = erls_diff, srls = Rule_Set.Erls, calc = [], errpatts = [],
   18.74  	 rules = [Rule.Thm ("diff_sum",TermC.num_str @{thm diff_sum}),
   18.75  		  Rule.Thm ("diff_dif",TermC.num_str @{thm diff_dif}),
   18.76  		  Rule.Thm ("diff_prod_const",TermC.num_str @{thm diff_prod_const}),
   18.77 @@ -224,9 +224,9 @@
   18.78  ML \<open>
   18.79  (*.normalisation for checking user-input.*)
   18.80  val norm_diff = 
   18.81 -  Rule.Rls
   18.82 +  Rule_Set.Rls
   18.83      {id="norm_diff", preconds = [], rew_ord = ("termlessI",termlessI), 
   18.84 -     erls = Rule.Erls, srls = Rule.Erls, calc = [], errpatts = [],
   18.85 +     erls = Rule_Set.Erls, srls = Rule_Set.Erls, calc = [], errpatts = [],
   18.86       rules = [Rule.Rls_ diff_rules, Rule.Rls_ norm_Poly ],
   18.87       scr = Rule.EmptyScr};
   18.88  \<close>
   18.89 @@ -239,12 +239,12 @@
   18.90  
   18.91  (** problem types **)
   18.92  setup \<open>KEStore_Elems.add_pbts
   18.93 -  [(Specify.prep_pbt thy "pbl_fun" [] Celem.e_pblID (["function"], [], Rule.e_rls, NONE, [])),
   18.94 +  [(Specify.prep_pbt thy "pbl_fun" [] Celem.e_pblID (["function"], [], Rule_Set.e_rls, NONE, [])),
   18.95      (Specify.prep_pbt thy "pbl_fun_deriv" [] Celem.e_pblID
   18.96        (["derivative_of","function"],
   18.97          [("#Given" ,["functionTerm f_f","differentiateFor v_v"]),
   18.98            ("#Find"  ,["derivative f_f'"])],
   18.99 -        Rule.append_rls "e_rls" Rule.e_rls [],
  18.100 +        Rule_Set.append_rls "e_rls" Rule_Set.e_rls [],
  18.101          SOME "Diff (f_f, v_v)", [["diff","differentiate_on_R"],
  18.102  			  ["diff","after_simplification"]])),
  18.103      (*here "named" is used differently from Integration"*)
  18.104 @@ -252,7 +252,7 @@
  18.105        (["named","derivative_of","function"],
  18.106          [("#Given" ,["functionEq f_f","differentiateFor v_v"]),
  18.107            ("#Find"  ,["derivativeEq f_f'"])],
  18.108 -        Rule.append_rls "e_rls" Rule.e_rls [],
  18.109 +        Rule_Set.append_rls "e_rls" Rule_Set.e_rls [],
  18.110          SOME "Differentiate (f_f, v_v)",
  18.111          [["diff","differentiate_equality"]]))]\<close>
  18.112  
  18.113 @@ -274,7 +274,7 @@
  18.114  setup \<open>KEStore_Elems.add_mets
  18.115      [Specify.prep_met thy "met_diff" [] Celem.e_metID
  18.116        (["diff"], [],
  18.117 -        {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = Rule.e_rls, prls=Rule.e_rls,
  18.118 +        {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = Rule_Set.e_rls, prls=Rule_Set.e_rls,
  18.119            crls = Atools_erls, errpats = [], nrls = norm_diff},
  18.120          @{thm refl})]
  18.121  \<close>
  18.122 @@ -311,7 +311,7 @@
  18.123        (["diff","differentiate_on_R"],
  18.124          [("#Given" ,["functionTerm f_f","differentiateFor v_v"]),
  18.125            ("#Find"  ,["derivative f_f'"])],
  18.126 -        {rew_ord'="tless_true", rls' = erls_diff, calc = [], srls = Rule.e_rls, prls=Rule.e_rls,
  18.127 +        {rew_ord'="tless_true", rls' = erls_diff, calc = [], srls = Rule_Set.e_rls, prls=Rule_Set.e_rls,
  18.128            crls = Atools_erls, errpats = [], nrls = norm_diff},
  18.129          @{thm differentiate_on_R.simps})]
  18.130  \<close>
  18.131 @@ -346,7 +346,7 @@
  18.132        (["diff","diff_simpl"],
  18.133          [("#Given", ["functionTerm f_f","differentiateFor v_v"]),
  18.134           ("#Find" , ["derivative f_f'"])],
  18.135 -        {rew_ord'="tless_true", rls' = erls_diff, calc = [], srls = Rule.e_rls, prls=Rule.e_rls,
  18.136 +        {rew_ord'="tless_true", rls' = erls_diff, calc = [], srls = Rule_Set.e_rls, prls=Rule_Set.e_rls,
  18.137            crls = Atools_erls, errpats = [], nrls = norm_diff},
  18.138          @{thm differentiateX.simps})]
  18.139  \<close>
  18.140 @@ -384,7 +384,7 @@
  18.141        (["diff","differentiate_equality"],
  18.142          [("#Given" ,["functionEq f_f","differentiateFor v_v"]),
  18.143            ("#Find"  ,["derivativeEq f_f'"])],
  18.144 -        {rew_ord'="tless_true", rls' = erls_diff, calc = [], srls = srls_diff, prls=Rule.e_rls,
  18.145 +        {rew_ord'="tless_true", rls' = erls_diff, calc = [], srls = srls_diff, prls=Rule_Set.e_rls,
  18.146            crls=Atools_erls, errpats = [], nrls = norm_diff},
  18.147          @{thm differentiate_equality.simps})]
  18.148  \<close>
  18.149 @@ -407,7 +407,7 @@
  18.150        (["diff","after_simplification"],
  18.151          [("#Given" ,["functionTerm term","differentiateFor bound_variable"]),
  18.152            ("#Find"  ,["derivative term'"])],
  18.153 -        {rew_ord'="tless_true", rls' = Rule.e_rls, calc = [], srls = Rule.e_rls, prls=Rule.e_rls,
  18.154 +        {rew_ord'="tless_true", rls' = Rule_Set.e_rls, calc = [], srls = Rule_Set.e_rls, prls=Rule_Set.e_rls,
  18.155            crls=Atools_erls, errpats = [], nrls = norm_Rational},
  18.156          @{thm simplify_derivative.simps})]
  18.157  \<close>
    19.1 --- a/src/Tools/isac/Knowledge/DiffApp.thy	Wed Apr 01 19:20:05 2020 +0200
    19.2 +++ b/src/Tools/isac/Knowledge/DiffApp.thy	Sat Apr 04 12:11:32 2020 +0200
    19.3 @@ -35,8 +35,8 @@
    19.4  val thy = @{theory};
    19.5  
    19.6  val eval_rls = prep_rls' (
    19.7 -  Rule.Rls {id = "eval_rls", preconds = [], rew_ord = ("termlessI", termlessI), 
    19.8 -    erls = Rule.e_rls, srls = Rule.Erls, calc = [], errpatts = [],
    19.9 +  Rule_Set.Rls {id = "eval_rls", preconds = [], rew_ord = ("termlessI", termlessI), 
   19.10 +    erls = Rule_Set.e_rls, srls = Rule_Set.Erls, calc = [], errpatts = [],
   19.11      rules = [Rule.Thm ("refl", TermC.num_str @{thm refl}),
   19.12        Rule.Thm ("order_refl", TermC.num_str @{thm order_refl}),
   19.13        Rule.Thm ("radd_left_cancel_le", TermC.num_str @{thm radd_left_cancel_le}),
   19.14 @@ -68,44 +68,44 @@
   19.15          [("#Given" ,["fixedValues f_ix"]),
   19.16            ("#Find"  ,["maximum m_m","valuesFor v_s"]),
   19.17            ("#Relate",["relations r_s"])],
   19.18 -        Rule.e_rls, NONE, [])),
   19.19 +        Rule_Set.e_rls, NONE, [])),
   19.20      (Specify.prep_pbt thy "pbl_fun_make" [] Celem.e_pblID
   19.21        (["make","function"],
   19.22          [("#Given" ,["functionOf f_f","boundVariable v_v","equalities eqs"]),
   19.23            ("#Find"  ,["functionEq f_1"])],
   19.24 -        Rule.e_rls, NONE, [])),
   19.25 +        Rule_Set.e_rls, NONE, [])),
   19.26      (Specify.prep_pbt thy "pbl_fun_max_expl" [] Celem.e_pblID
   19.27        (["by_explicit","make","function"],
   19.28          [("#Given" ,["functionOf f_f","boundVariable v_v","equalities eqs"]),
   19.29            ("#Find"  ,["functionEq f_1"])],
   19.30 -      Rule.e_rls, NONE, [["DiffApp","make_fun_by_explicit"]])),
   19.31 +      Rule_Set.e_rls, NONE, [["DiffApp","make_fun_by_explicit"]])),
   19.32      (Specify.prep_pbt thy "pbl_fun_max_newvar" [] Celem.e_pblID
   19.33        (["by_new_variable","make","function"],
   19.34          [("#Given" ,["functionOf f_f","boundVariable v_v","equalities eqs"]),
   19.35            (*WN.12.5.03: precond for distinction still missing*)
   19.36            ("#Find"  ,["functionEq f_1"])],
   19.37 -      Rule.e_rls, NONE, [["DiffApp","make_fun_by_new_variable"]])),
   19.38 +      Rule_Set.e_rls, NONE, [["DiffApp","make_fun_by_new_variable"]])),
   19.39      (Specify.prep_pbt thy "pbl_fun_max_interv" [] Celem.e_pblID
   19.40        (["on_interval","maximum_of","function"],
   19.41          [("#Given" ,["functionEq t_t","boundVariable v_v","interval i_tv"]),
   19.42            (*WN.12.5.03: precond for distinction still missing*)
   19.43            ("#Find"  ,["maxArgument v_0"])],
   19.44 -      Rule.e_rls, NONE, [])),
   19.45 +      Rule_Set.e_rls, NONE, [])),
   19.46      (Specify.prep_pbt thy "pbl_tool" [] Celem.e_pblID
   19.47 -      (["tool"], [], Rule.e_rls, NONE, [])),
   19.48 +      (["tool"], [], Rule_Set.e_rls, NONE, [])),
   19.49      (Specify.prep_pbt thy "pbl_tool_findvals" [] Celem.e_pblID
   19.50        (["find_values","tool"],
   19.51          [("#Given" ,["maxArgument m_ax","functionEq f_f","boundVariable v_v"]),
   19.52            ("#Find"  ,["valuesFor v_ls"]),
   19.53            ("#Relate",["additionalRels r_s"])],
   19.54 -      Rule.e_rls, NONE, []))]\<close>
   19.55 +      Rule_Set.e_rls, NONE, []))]\<close>
   19.56  
   19.57  
   19.58  (** methods, scripts not yet implemented **)
   19.59  setup \<open>KEStore_Elems.add_mets
   19.60      [Specify.prep_met thy "met_diffapp" [] Celem.e_metID
   19.61        (["DiffApp"], [],
   19.62 -        {rew_ord'="tless_true", rls'=Atools_erls,calc = [], srls = Rule.e_rls, prls = Rule.e_rls,
   19.63 +        {rew_ord'="tless_true", rls'=Atools_erls,calc = [], srls = Rule_Set.e_rls, prls = Rule_Set.e_rls,
   19.64            crls = Atools_erls, errpats = [], nrls = norm_Rational (*, asm_rls=[],asm_thm=[]*)},
   19.65          @{thm refl})]
   19.66  \<close>
   19.67 @@ -131,7 +131,7 @@
   19.68                "interval i_tv","errorBound e_rr"]),
   19.69            ("#Find"  ,["valuesFor v_s"]),
   19.70            ("#Relate",[])],
   19.71 -      {rew_ord'="tless_true",rls'=eval_rls,calc=[],srls=prog_expr,prls=Rule.e_rls, crls = eval_rls,
   19.72 +      {rew_ord'="tless_true",rls'=eval_rls,calc=[],srls=prog_expr,prls=Rule_Set.e_rls, crls = eval_rls,
   19.73          errpats = [], nrls = norm_Rational (*,  asm_rls=[],asm_thm=[]*)},
   19.74        @{thm maximum_value.simps})]
   19.75  \<close>
   19.76 @@ -156,7 +156,7 @@
   19.77        (["DiffApp","make_fun_by_new_variable"],
   19.78          [("#Given" ,["functionOf f_f","boundVariable v_v","equalities eqs"]),
   19.79            ("#Find"  ,["functionEq f_1"])],
   19.80 -        {rew_ord'="tless_true",rls'=eval_rls,srls=prog_expr,prls=Rule.e_rls, calc=[], crls = eval_rls,
   19.81 +        {rew_ord'="tless_true",rls'=eval_rls,srls=prog_expr,prls=Rule_Set.e_rls, calc=[], crls = eval_rls,
   19.82            errpats = [], nrls = norm_Rational(*,asm_rls=[],asm_thm=[]*)},
   19.83          @{thm make_fun_by_new_variable.simps})]
   19.84  \<close>
   19.85 @@ -176,7 +176,7 @@
   19.86        (["DiffApp","make_fun_by_explicit"],
   19.87          [("#Given" ,["functionOf f_f","boundVariable v_v","equalities eqs"]),
   19.88            ("#Find"  ,["functionEq f_1"])],
   19.89 -        {rew_ord'="tless_true",rls'=eval_rls,calc=[],srls=prog_expr,prls=Rule.e_rls, crls = eval_rls,
   19.90 +        {rew_ord'="tless_true",rls'=eval_rls,calc=[],srls=prog_expr,prls=Rule_Set.e_rls, crls = eval_rls,
   19.91            errpats = [], nrls = norm_Rational (*, asm_rls=[],asm_thm=[]*)},
   19.92          @{thm make_fun_by_explicit.simps})]
   19.93  \<close>
   19.94 @@ -185,17 +185,17 @@
   19.95        (["DiffApp","max_on_interval_by_calculus"],
   19.96          [("#Given" ,["functionEq t_t","boundVariable v_v","interval i_tv"(*, "errorBound e_rr"*)]),
   19.97            ("#Find"  ,["maxArgument v_0"])],
   19.98 -      {rew_ord'="tless_true",rls'=eval_rls,calc=[],srls = Rule.e_rls,prls=Rule.e_rls, crls = eval_rls,
   19.99 +      {rew_ord'="tless_true",rls'=eval_rls,calc=[],srls = Rule_Set.e_rls,prls=Rule_Set.e_rls, crls = eval_rls,
  19.100          errpats = [], nrls = norm_Rational (*, asm_rls=[],asm_thm=[]*)},
  19.101        @{thm refl}),
  19.102      Specify.prep_met thy "met_diffapp_findvals" [] Celem.e_metID
  19.103        (["DiffApp","find_values"], [],
  19.104 -        {rew_ord'="tless_true",rls'=eval_rls,calc=[],srls = Rule.e_rls,prls=Rule.e_rls, crls = eval_rls,
  19.105 +        {rew_ord'="tless_true",rls'=eval_rls,calc=[],srls = Rule_Set.e_rls,prls=Rule_Set.e_rls, crls = eval_rls,
  19.106            errpats = [], nrls = norm_Rational(*, asm_rls = [], asm_thm = []*)},
  19.107          @{thm refl})]
  19.108  \<close>
  19.109  ML \<open>
  19.110 -val prog_expr = Rule.append_rls "prog_expr" prog_expr
  19.111 +val prog_expr = Rule_Set.append_rls "prog_expr" prog_expr
  19.112    [Rule.Thm ("filterVar_Const", TermC.num_str @{thm filterVar_Const}),
  19.113     Rule.Thm ("filterVar_Nil", TermC.num_str @{thm filterVar_Nil})];
  19.114  \<close>
    20.1 --- a/src/Tools/isac/Knowledge/DiophantEq.thy	Wed Apr 01 19:20:05 2020 +0200
    20.2 +++ b/src/Tools/isac/Knowledge/DiophantEq.thy	Sat Apr 04 12:11:32 2020 +0200
    20.3 @@ -21,7 +21,7 @@
    20.4            (*                                      TODO: drop ^^^^^*)
    20.5            ("#Where" ,[]),
    20.6            ("#Find"  ,["boolTestFind s_s"])],
    20.7 -        Rule.e_rls, SOME "solve (e_e::bool, v_v::int)", [["LinEq","solve_lineq_equation"]]))]\<close>
    20.8 +        Rule_Set.e_rls, SOME "solve (e_e::bool, v_v::int)", [["LinEq","solve_lineq_equation"]]))]\<close>
    20.9  
   20.10  text \<open>method solving the usecase\<close>
   20.11  
   20.12 @@ -39,7 +39,7 @@
   20.13            (*                                      TODO: drop ^^^^^*)
   20.14            ("#Where" ,[]),
   20.15            ("#Find"  ,["boolTestFind s_s"])],
   20.16 -        {rew_ord' = "e_rew_ord", rls' = tval_rls, srls = Rule.e_rls, prls = Rule.e_rls, calc = [],
   20.17 +        {rew_ord' = "e_rew_ord", rls' = tval_rls, srls = Rule_Set.e_rls, prls = Rule_Set.e_rls, calc = [],
   20.18            crls = tval_rls, errpats = [], nrls = Test_simplify},
   20.19          @{thm diophant_equation.simps})]
   20.20  \<close>
    21.1 --- a/src/Tools/isac/Knowledge/EqSystem.thy	Wed Apr 01 19:20:05 2020 +0200
    21.2 +++ b/src/Tools/isac/Knowledge/EqSystem.thy	Sat Apr 04 12:11:32 2020 +0200
    21.3 @@ -170,10 +170,10 @@
    21.4  
    21.5  (*.adapted from 'order_add_mult_in' by just replacing the rew_ord.*)
    21.6  val order_add_mult_System = 
    21.7 -  Rule.Rls{id = "order_add_mult_System", preconds = [], 
    21.8 +  Rule_Set.Rls{id = "order_add_mult_System", preconds = [], 
    21.9        rew_ord = ("ord_simplify_System",
   21.10  		 ord_simplify_System false @{theory "Integrate"}),
   21.11 -      erls = Rule.e_rls,srls = Rule.Erls, calc = [], errpatts = [],
   21.12 +      erls = Rule_Set.e_rls,srls = Rule_Set.Erls, calc = [], errpatts = [],
   21.13        rules = [Rule.Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
   21.14  	       (* z * w = w * z *)
   21.15  	       Rule.Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
   21.16 @@ -194,9 +194,9 @@
   21.17    #1 using 'ord_simplify_System' in 'order_add_mult_System'
   21.18    #2 NOT using common_nominator_p                          .*)
   21.19  val norm_System_noadd_fractions = 
   21.20 -  Rule.Rls {id = "norm_System_noadd_fractions", preconds = [], 
   21.21 +  Rule_Set.Rls {id = "norm_System_noadd_fractions", preconds = [], 
   21.22         rew_ord = ("dummy_ord",Rule.dummy_ord), 
   21.23 -       erls = norm_rat_erls, srls = Rule.Erls, calc = [], errpatts = [],
   21.24 +       erls = norm_rat_erls, srls = Rule_Set.Erls, calc = [], errpatts = [],
   21.25         rules = [(*sequence given by operator precedence*)
   21.26  		Rule.Rls_ discard_minus,
   21.27  		Rule.Rls_ powers,
   21.28 @@ -215,9 +215,9 @@
   21.29  (*.adapted from 'norm_Rational' by
   21.30    *1* using 'ord_simplify_System' in 'order_add_mult_System'.*)
   21.31  val norm_System = 
   21.32 -  Rule.Rls {id = "norm_System", preconds = [], 
   21.33 +  Rule_Set.Rls {id = "norm_System", preconds = [], 
   21.34         rew_ord = ("dummy_ord",Rule.dummy_ord), 
   21.35 -       erls = norm_rat_erls, srls = Rule.Erls, calc = [], errpatts = [],
   21.36 +       erls = norm_rat_erls, srls = Rule_Set.Erls, calc = [], errpatts = [],
   21.37         rules = [(*sequence given by operator precedence*)
   21.38  		Rule.Rls_ discard_minus,
   21.39  		Rule.Rls_ powers,
   21.40 @@ -243,9 +243,9 @@
   21.41     *3* discard_parentheses only for (.*(.*.))
   21.42     analoguous to simplify_Integral                                       .*)
   21.43  val simplify_System_parenthesized = 
   21.44 -  Rule.Seq {id = "simplify_System_parenthesized", preconds = []:term list, 
   21.45 +  Rule_Set.Seq {id = "simplify_System_parenthesized", preconds = []:term list, 
   21.46         rew_ord = ("dummy_ord", Rule.dummy_ord),
   21.47 -      erls = Atools_erls, srls = Rule.Erls, calc = [], errpatts = [],
   21.48 +      erls = Atools_erls, srls = Rule_Set.Erls, calc = [], errpatts = [],
   21.49        rules = [Rule.Thm ("distrib_right",TermC.num_str @{thm distrib_right}),
   21.50   	       (*"(?z1.0 + ?z2.0) * ?w = ?z1.0 * ?w + ?z2.0 * ?w"*)
   21.51  	       Rule.Thm ("add_divide_distrib",TermC.num_str @{thm add_divide_distrib}),
   21.52 @@ -268,9 +268,9 @@
   21.53     *1* ord_simplify_System instead of termlessI           .*)
   21.54  (*TODO.WN051031 ^^^^^^^^^^ should be in EACH rls contained *)
   21.55  val simplify_System = 
   21.56 -  Rule.Seq {id = "simplify_System", preconds = []:term list, 
   21.57 +  Rule_Set.Seq {id = "simplify_System", preconds = []:term list, 
   21.58         rew_ord = ("dummy_ord", Rule.dummy_ord),
   21.59 -      erls = Atools_erls, srls = Rule.Erls, calc = [], errpatts = [],
   21.60 +      erls = Atools_erls, srls = Rule_Set.Erls, calc = [], errpatts = [],
   21.61        rules = [Rule.Rls_ norm_Rational,
   21.62  	       Rule.Rls_ (*order_add_mult_in*) norm_System (**1**),
   21.63  	       Rule.Rls_ discard_parentheses,
   21.64 @@ -281,21 +281,21 @@
   21.65        scr = Rule.EmptyScr};      
   21.66  (*
   21.67  val simplify_System = 
   21.68 -    Rule.append_rls "simplify_System" simplify_System_parenthesized
   21.69 +    Rule_Set.append_rls "simplify_System" simplify_System_parenthesized
   21.70  	       [Rule.Thm ("sym_add_assoc",
   21.71                        TermC.num_str (@{thm add.assoc} RS @{thm sym}))];
   21.72  *)
   21.73  \<close>
   21.74  ML \<open>
   21.75  val isolate_bdvs = 
   21.76 -    Rule.Rls {id="isolate_bdvs", preconds = [], 
   21.77 +    Rule_Set.Rls {id="isolate_bdvs", preconds = [], 
   21.78  	 rew_ord = ("e_rew_ord", Rule.e_rew_ord), 
   21.79 -	 erls = Rule.append_rls "erls_isolate_bdvs" Rule.e_rls 
   21.80 +	 erls = Rule_Set.append_rls "erls_isolate_bdvs" Rule_Set.e_rls 
   21.81  			   [(Rule.Num_Calc ("EqSystem.occur'_exactly'_in", 
   21.82  				   eval_occur_exactly_in 
   21.83  				       "#eval_occur_exactly_in_"))
   21.84  			    ], 
   21.85 -			   srls = Rule.Erls, calc = [], errpatts = [],
   21.86 +			   srls = Rule_Set.Erls, calc = [], errpatts = [],
   21.87  	      rules = 
   21.88               [Rule.Thm ("commute_0_equality", TermC.num_str @{thm commute_0_equality}),
   21.89  	      Rule.Thm ("separate_bdvs_add", TermC.num_str @{thm separate_bdvs_add}),
   21.90 @@ -304,10 +304,10 @@
   21.91  \<close>
   21.92  ML \<open>
   21.93  val isolate_bdvs_4x4 = 
   21.94 -    Rule.Rls {id="isolate_bdvs_4x4", preconds = [], 
   21.95 +    Rule_Set.Rls {id="isolate_bdvs_4x4", preconds = [], 
   21.96  	 rew_ord = ("e_rew_ord", Rule.e_rew_ord), 
   21.97 -	 erls = Rule.append_rls 
   21.98 -		    "erls_isolate_bdvs_4x4" Rule.e_rls 
   21.99 +	 erls = Rule_Set.append_rls 
  21.100 +		    "erls_isolate_bdvs_4x4" Rule_Set.e_rls 
  21.101  		    [Rule.Num_Calc ("EqSystem.occur'_exactly'_in", 
  21.102  			   eval_occur_exactly_in "#eval_occur_exactly_in_"),
  21.103  		     Rule.Num_Calc ("Prog_Expr.ident", Prog_Expr.eval_ident "#ident_"),
  21.104 @@ -315,7 +315,7 @@
  21.105           Rule.Thm ("not_true",TermC.num_str @{thm not_true}),
  21.106  		     Rule.Thm ("not_false",TermC.num_str @{thm not_false})
  21.107  			    ], 
  21.108 -	 srls = Rule.Erls, calc = [], errpatts = [],
  21.109 +	 srls = Rule_Set.Erls, calc = [], errpatts = [],
  21.110  	 rules = [Rule.Thm ("commute_0_equality", TermC.num_str @{thm commute_0_equality}),
  21.111  		  Rule.Thm ("separate_bdvs0", TermC.num_str @{thm separate_bdvs0}),
  21.112  		  Rule.Thm ("separate_bdvs_add1", TermC.num_str @{thm separate_bdvs_add1}),
  21.113 @@ -329,20 +329,20 @@
  21.114  (*.order the equations in a system such, that a triangular system (if any)
  21.115     appears as [..c_4 = .., ..., ..., ..c_1 + ..c_2 + ..c_3 ..c_4 = ..].*)
  21.116  val order_system = 
  21.117 -    Rule.Rls {id="order_system", preconds = [], 
  21.118 +    Rule_Set.Rls {id="order_system", preconds = [], 
  21.119  	 rew_ord = ("ord_simplify_System", 
  21.120  		    ord_simplify_System false thy), 
  21.121 -	 erls = Rule.Erls, srls = Rule.Erls, calc = [], errpatts = [],
  21.122 +	 erls = Rule_Set.Erls, srls = Rule_Set.Erls, calc = [], errpatts = [],
  21.123  	 rules = [Rule.Thm ("order_system_NxN", TermC.num_str @{thm order_system_NxN})
  21.124  		  ],
  21.125  	 scr = Rule.EmptyScr};
  21.126  
  21.127  val prls_triangular = 
  21.128 -    Rule.Rls {id="prls_triangular", preconds = [], 
  21.129 +    Rule_Set.Rls {id="prls_triangular", preconds = [], 
  21.130  	 rew_ord = ("e_rew_ord", Rule.e_rew_ord), 
  21.131 -	 erls = Rule.Rls {id="erls_prls_triangular", preconds = [], 
  21.132 +	 erls = Rule_Set.Rls {id="erls_prls_triangular", preconds = [], 
  21.133  		     rew_ord = ("e_rew_ord", Rule.e_rew_ord), 
  21.134 -		     erls = Rule.Erls, srls = Rule.Erls, calc = [], errpatts = [],
  21.135 +		     erls = Rule_Set.Erls, srls = Rule_Set.Erls, calc = [], errpatts = [],
  21.136  		     rules = [(*for precond NTH_CONS ...*)
  21.137  			      Rule.Num_Calc ("Orderings.ord_class.less", Prog_Expr.eval_equ "#less_"),
  21.138  			      Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_")
  21.139 @@ -350,7 +350,7 @@
  21.140  					    '+' into precondition !*)
  21.141  			      ],
  21.142  		     scr = Rule.EmptyScr}, 
  21.143 -	 srls = Rule.Erls, calc = [], errpatts = [],
  21.144 +	 srls = Rule_Set.Erls, calc = [], errpatts = [],
  21.145  	 rules = [Rule.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
  21.146  		  Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"),
  21.147  		  Rule.Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}),
  21.148 @@ -367,11 +367,11 @@
  21.149  (*WN060914 quickly created for 4x4; 
  21.150   more similarity to prls_triangular desirable*)
  21.151  val prls_triangular4 = 
  21.152 -    Rule.Rls {id="prls_triangular4", preconds = [], 
  21.153 +    Rule_Set.Rls {id="prls_triangular4", preconds = [], 
  21.154  	 rew_ord = ("e_rew_ord", Rule.e_rew_ord), 
  21.155 -	 erls = Rule.Rls {id="erls_prls_triangular4", preconds = [], 
  21.156 +	 erls = Rule_Set.Rls {id="erls_prls_triangular4", preconds = [], 
  21.157  		     rew_ord = ("e_rew_ord", Rule.e_rew_ord), 
  21.158 -		     erls = Rule.Erls, srls = Rule.Erls, calc = [], errpatts = [],
  21.159 +		     erls = Rule_Set.Erls, srls = Rule_Set.Erls, calc = [], errpatts = [],
  21.160  		     rules = [(*for precond NTH_CONS ...*)
  21.161  			      Rule.Num_Calc ("Orderings.ord_class.less", Prog_Expr.eval_equ "#less_"),
  21.162  			      Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_")
  21.163 @@ -379,7 +379,7 @@
  21.164  					    '+' into precondition !*)
  21.165  			      ],
  21.166  		     scr = Rule.EmptyScr}, 
  21.167 -	 srls = Rule.Erls, calc = [], errpatts = [],
  21.168 +	 srls = Rule_Set.Erls, calc = [], errpatts = [],
  21.169  	 rules = [Rule.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
  21.170  		  Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"),
  21.171  		  Rule.Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}),
  21.172 @@ -410,20 +410,20 @@
  21.173        (["system"],
  21.174          [("#Given" ,["equalities e_s", "solveForVars v_s"]),
  21.175            ("#Find"  ,["solution ss'''"](*''' is copy-named*))],
  21.176 -        Rule.append_rls "e_rls" Rule.e_rls [(*for preds in where_*)], SOME "solveSystem e_s v_s", [])),
  21.177 +        Rule_Set.append_rls "e_rls" Rule_Set.e_rls [(*for preds in where_*)], SOME "solveSystem e_s v_s", [])),
  21.178      (Specify.prep_pbt thy "pbl_equsys_lin" [] Celem.e_pblID
  21.179        (["LINEAR", "system"],
  21.180          [("#Given" ,["equalities e_s", "solveForVars v_s"]),
  21.181            (*TODO.WN050929 check linearity*)
  21.182            ("#Find"  ,["solution ss'''"])],
  21.183 -        Rule.append_rls "e_rls" Rule.e_rls [(*for preds in where_*)], SOME "solveSystem e_s v_s", [])),
  21.184 +        Rule_Set.append_rls "e_rls" Rule_Set.e_rls [(*for preds in where_*)], SOME "solveSystem e_s v_s", [])),
  21.185      (Specify.prep_pbt thy "pbl_equsys_lin_2x2" [] Celem.e_pblID
  21.186        (["2x2", "LINEAR", "system"],
  21.187        (*~~~~~~~~~~~~~~~~~~~~~~~~~*)
  21.188          [("#Given" ,["equalities e_s", "solveForVars v_s"]),
  21.189            ("#Where"  ,["LENGTH (e_s:: bool list) = 2", "LENGTH v_s = 2"]),
  21.190            ("#Find"  ,["solution ss'''"])],
  21.191 -        Rule.append_rls "prls_2x2_linear_system" Rule.e_rls 
  21.192 +        Rule_Set.append_rls "prls_2x2_linear_system" Rule_Set.e_rls 
  21.193  			    [Rule.Thm ("LENGTH_CONS",TermC.num_str @{thm LENGTH_CONS}),
  21.194  			      Rule.Thm ("LENGTH_NIL",TermC.num_str @{thm LENGTH_NIL}),
  21.195  			      Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"),
  21.196 @@ -441,7 +441,7 @@
  21.197        (["normalise", "2x2", "LINEAR", "system"],
  21.198          [("#Given" ,["equalities e_s", "solveForVars v_s"]),
  21.199            ("#Find"  ,["solution ss'''"])],
  21.200 -      Rule.append_rls "e_rls" Rule.e_rls [(*for preds in where_*)], 
  21.201 +      Rule_Set.append_rls "e_rls" Rule_Set.e_rls [(*for preds in where_*)], 
  21.202        SOME "solveSystem e_s v_s", 
  21.203        [["EqSystem","normalise","2x2"]])),
  21.204      (Specify.prep_pbt thy "pbl_equsys_lin_3x3" [] Celem.e_pblID
  21.205 @@ -450,7 +450,7 @@
  21.206          [("#Given" ,["equalities e_s", "solveForVars v_s"]),
  21.207            ("#Where"  ,["LENGTH (e_s:: bool list) = 3", "LENGTH v_s = 3"]),
  21.208            ("#Find"  ,["solution ss'''"])],
  21.209 -        Rule.append_rls "prls_3x3_linear_system" Rule.e_rls 
  21.210 +        Rule_Set.append_rls "prls_3x3_linear_system" Rule_Set.e_rls 
  21.211  			    [Rule.Thm ("LENGTH_CONS",TermC.num_str @{thm LENGTH_CONS}),
  21.212  			      Rule.Thm ("LENGTH_NIL",TermC.num_str @{thm LENGTH_NIL}),
  21.213  			      Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"),
  21.214 @@ -462,7 +462,7 @@
  21.215          [("#Given" ,["equalities e_s", "solveForVars v_s"]),
  21.216            ("#Where"  ,["LENGTH (e_s:: bool list) = 4", "LENGTH v_s = 4"]),
  21.217            ("#Find"  ,["solution ss'''"])],
  21.218 -        Rule.append_rls "prls_4x4_linear_system" Rule.e_rls 
  21.219 +        Rule_Set.append_rls "prls_4x4_linear_system" Rule_Set.e_rls 
  21.220  			    [Rule.Thm ("LENGTH_CONS",TermC.num_str @{thm LENGTH_CONS}),
  21.221  			      Rule.Thm ("LENGTH_NIL",TermC.num_str @{thm LENGTH_NIL}),
  21.222  			      Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"),
  21.223 @@ -477,7 +477,7 @@
  21.224                "(NTH 3 (v_s::real list)) occurs_in (NTH 3 (e_s::bool list))",
  21.225                "(NTH 4 (v_s::real list)) occurs_in (NTH 4 (e_s::bool list))"]),
  21.226            ("#Find"  ,["solution ss'''"])],
  21.227 -      Rule.append_rls "prls_tri_4x4_lin_sys" prls_triangular
  21.228 +      Rule_Set.append_rls "prls_tri_4x4_lin_sys" prls_triangular
  21.229  	      [Rule.Num_Calc ("Prog_Expr.occurs'_in", Prog_Expr.eval_occurs_in "")], 
  21.230        SOME "solveSystem e_s v_s", 
  21.231        [["EqSystem","top_down_substitution","4x4"]])),
  21.232 @@ -486,22 +486,22 @@
  21.233          [("#Given" ,["equalities e_s", "solveForVars v_s"]),
  21.234            (*LENGTH is checked 1 level above*)
  21.235            ("#Find"  ,["solution ss'''"])],
  21.236 -        Rule.append_rls "e_rls" Rule.e_rls [(*for preds in where_*)], 
  21.237 +        Rule_Set.append_rls "e_rls" Rule_Set.e_rls [(*for preds in where_*)], 
  21.238          SOME "solveSystem e_s v_s", 
  21.239          [["EqSystem","normalise","4x4"]]))]\<close>
  21.240  
  21.241  ML \<open>
  21.242  (*this is for NTH only*)
  21.243 -val srls = Rule.Rls {id="srls_normalise_4x4", 
  21.244 +val srls = Rule_Set.Rls {id="srls_normalise_4x4", 
  21.245  		preconds = [], 
  21.246  		rew_ord = ("termlessI",termlessI), 
  21.247 -		erls = Rule.append_rls "erls_in_srls_IntegrierenUnd.." Rule.e_rls
  21.248 +		erls = Rule_Set.append_rls "erls_in_srls_IntegrierenUnd.." Rule_Set.e_rls
  21.249  				  [(*for asm in NTH_CONS ...*)
  21.250  				   Rule.Num_Calc ("Orderings.ord_class.less", Prog_Expr.eval_equ "#less_"),
  21.251  				   (*2nd NTH_CONS pushes n+-1 into asms*)
  21.252  				   Rule.Num_Calc("Groups.plus_class.plus", (**)eval_binop "#add_")
  21.253  				   ], 
  21.254 -		srls = Rule.Erls, calc = [], errpatts = [],
  21.255 +		srls = Rule_Set.Erls, calc = [], errpatts = [],
  21.256  		rules = [Rule.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
  21.257  			 Rule.Num_Calc("Groups.plus_class.plus", (**)eval_binop "#add_"),
  21.258  			 Rule.Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL})],
  21.259 @@ -512,13 +512,13 @@
  21.260  setup \<open>KEStore_Elems.add_mets
  21.261      [Specify.prep_met thy "met_eqsys" [] Celem.e_metID
  21.262  	    (["EqSystem"], [],
  21.263 -	      {rew_ord'="tless_true", rls' = Rule.Erls, calc = [], srls = Rule.Erls, prls = Rule.Erls, crls = Rule.Erls,
  21.264 -          errpats = [], nrls = Rule.Erls},
  21.265 +	      {rew_ord'="tless_true", rls' = Rule_Set.Erls, calc = [], srls = Rule_Set.Erls, prls = Rule_Set.Erls, crls = Rule_Set.Erls,
  21.266 +          errpats = [], nrls = Rule_Set.Erls},
  21.267  	      @{thm refl}),
  21.268      Specify.prep_met thy "met_eqsys_topdown" [] Celem.e_metID
  21.269        (["EqSystem","top_down_substitution"], [],
  21.270 -        {rew_ord'="tless_true", rls' = Rule.Erls, calc = [], srls = Rule.Erls, prls = Rule.Erls, crls = Rule.Erls,
  21.271 -          errpats = [], nrls = Rule.Erls},
  21.272 +        {rew_ord'="tless_true", rls' = Rule_Set.Erls, calc = [], srls = Rule_Set.Erls, prls = Rule_Set.Erls, crls = Rule_Set.Erls,
  21.273 +          errpats = [], nrls = Rule_Set.Erls},
  21.274         @{thm refl})]
  21.275  \<close>
  21.276  
  21.277 @@ -549,19 +549,19 @@
  21.278              ["(tl v_s) from v_s occur_exactly_in (NTH 1 (e_s::bool list))",
  21.279                "    v_s  from v_s occur_exactly_in (NTH 2 (e_s::bool list))"]),
  21.280            ("#Find"  ,["solution ss'''"])],
  21.281 -	      {rew_ord'="ord_simplify_System", rls' = Rule.Erls, calc = [], 
  21.282 -	        srls = Rule.append_rls "srls_top_down_2x2" Rule.e_rls
  21.283 +	      {rew_ord'="ord_simplify_System", rls' = Rule_Set.Erls, calc = [], 
  21.284 +	        srls = Rule_Set.append_rls "srls_top_down_2x2" Rule_Set.e_rls
  21.285  				      [Rule.Thm ("hd_thm",TermC.num_str @{thm hd_thm}),
  21.286  				        Rule.Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}),
  21.287  				        Rule.Thm ("tl_Nil",TermC.num_str @{thm tl_Nil})], 
  21.288 -	        prls = prls_triangular, crls = Rule.Erls, errpats = [], nrls = Rule.Erls},
  21.289 +	        prls = prls_triangular, crls = Rule_Set.Erls, errpats = [], nrls = Rule_Set.Erls},
  21.290  	      @{thm solve_system.simps})]
  21.291  \<close>
  21.292  setup \<open>KEStore_Elems.add_mets
  21.293      [Specify.prep_met thy "met_eqsys_norm" [] Celem.e_metID
  21.294  	    (["EqSystem", "normalise"], [],
  21.295 -	      {rew_ord'="tless_true", rls' = Rule.Erls, calc = [], srls = Rule.Erls, prls = Rule.Erls, crls = Rule.Erls,
  21.296 -          errpats = [], nrls = Rule.Erls},
  21.297 +	      {rew_ord'="tless_true", rls' = Rule_Set.Erls, calc = [], srls = Rule_Set.Erls, prls = Rule_Set.Erls, crls = Rule_Set.Erls,
  21.298 +          errpats = [], nrls = Rule_Set.Erls},
  21.299  	      @{thm refl})]
  21.300  \<close>
  21.301  
  21.302 @@ -584,12 +584,12 @@
  21.303  	    (["EqSystem","normalise","2x2"],
  21.304  	      [("#Given" ,["equalities e_s", "solveForVars v_s"]),
  21.305  		      ("#Find"  ,["solution ss'''"])],
  21.306 -	      {rew_ord'="tless_true", rls' = Rule.Erls, calc = [], 
  21.307 -	        srls = Rule.append_rls "srls_normalise_2x2" Rule.e_rls
  21.308 +	      {rew_ord'="tless_true", rls' = Rule_Set.Erls, calc = [], 
  21.309 +	        srls = Rule_Set.append_rls "srls_normalise_2x2" Rule_Set.e_rls
  21.310  				      [Rule.Thm ("hd_thm",TermC.num_str @{thm hd_thm}),
  21.311  				        Rule.Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}),
  21.312  				        Rule.Thm ("tl_Nil",TermC.num_str @{thm tl_Nil})], 
  21.313 -		      prls = Rule.Erls, crls = Rule.Erls, errpats = [], nrls = Rule.Erls},
  21.314 +		      prls = Rule_Set.Erls, crls = Rule_Set.Erls, errpats = [], nrls = Rule_Set.Erls},
  21.315  		    @{thm solve_system2.simps})]
  21.316  \<close>
  21.317  
  21.318 @@ -616,12 +616,12 @@
  21.319  	      (["EqSystem","normalise","4x4"],
  21.320  	       [("#Given" ,["equalities e_s", "solveForVars v_s"]),
  21.321  	         ("#Find"  ,["solution ss'''"])],
  21.322 -	       {rew_ord'="tless_true", rls' = Rule.Erls, calc = [], 
  21.323 -	         srls = Rule.append_rls "srls_normalise_4x4" srls
  21.324 +	       {rew_ord'="tless_true", rls' = Rule_Set.Erls, calc = [], 
  21.325 +	         srls = Rule_Set.append_rls "srls_normalise_4x4" srls
  21.326  	             [Rule.Thm ("hd_thm",TermC.num_str @{thm hd_thm}),
  21.327  	               Rule.Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}),
  21.328  	               Rule.Thm ("tl_Nil",TermC.num_str @{thm tl_Nil})], 
  21.329 -		       prls = Rule.Erls, crls = Rule.Erls, errpats = [], nrls = Rule.Erls},
  21.330 +		       prls = Rule_Set.Erls, crls = Rule_Set.Erls, errpats = [], nrls = Rule_Set.Erls},
  21.331  		     (*STOPPED.WN06? met ["EqSystem","normalise","4x4"] #>#>#>#>#>#>#>#>#>#>#>#>#>@*)
  21.332  		     @{thm solve_system3.simps})]
  21.333  \<close>
  21.334 @@ -653,11 +653,11 @@
  21.335                "(NTH 3 (v_s::real list)) occurs_in (NTH 3 (e_s::bool list))",
  21.336                "(NTH 4 (v_s::real list)) occurs_in (NTH 4 (e_s::bool list))"]),
  21.337  	        ("#Find", ["solution ss'''"])],
  21.338 -	    {rew_ord'="ord_simplify_System", rls' = Rule.Erls, calc = [], 
  21.339 -	      srls = Rule.append_rls "srls_top_down_4x4" srls [], 
  21.340 -	      prls = Rule.append_rls "prls_tri_4x4_lin_sys" prls_triangular
  21.341 +	    {rew_ord'="ord_simplify_System", rls' = Rule_Set.Erls, calc = [], 
  21.342 +	      srls = Rule_Set.append_rls "srls_top_down_4x4" srls [], 
  21.343 +	      prls = Rule_Set.append_rls "prls_tri_4x4_lin_sys" prls_triangular
  21.344  			      [Rule.Num_Calc ("Prog_Expr.occurs'_in", Prog_Expr.eval_occurs_in "")], 
  21.345 -	      crls = Rule.Erls, errpats = [], nrls = Rule.Erls},
  21.346 +	      crls = Rule_Set.Erls, errpats = [], nrls = Rule_Set.Erls},
  21.347  	    (*FIXXXXME.WN060916: this script works ONLY for exp 7.79 #>#>#>#>#>#>#>#>#>#>*)
  21.348  	    @{thm solve_system4.simps})]
  21.349  \<close>
    22.1 --- a/src/Tools/isac/Knowledge/Equation.thy	Wed Apr 01 19:20:05 2020 +0200
    22.2 +++ b/src/Tools/isac/Knowledge/Equation.thy	Sat Apr 04 12:11:32 2020 +0200
    22.3 @@ -37,7 +37,7 @@
    22.4  val ctxt = Rule.thy2ctxt thy;
    22.5  
    22.6  val univariate_equation_prls = 
    22.7 -    Rule.append_rls "univariate_equation_prls" Rule.e_rls 
    22.8 +    Rule_Set.append_rls "univariate_equation_prls" Rule_Set.e_rls 
    22.9  	       [Rule.Num_Calc ("Prog_Expr.matches", Prog_Expr.eval_matches "")];
   22.10  \<close>
   22.11  setup \<open>KEStore_Elems.add_rlss [("univariate_equation_prls",
   22.12 @@ -48,7 +48,7 @@
   22.13          [("#Given" ,["equality e_e","solveFor v_v"]),
   22.14            ("#Where" ,["matches (?a = ?b) e_e"]),
   22.15            ("#Find"  ,["solutions v_v'i'"])],
   22.16 -        Rule.append_rls "equation_prls" Rule.e_rls  [Rule.Num_Calc ("Prog_Expr.matches", Prog_Expr.eval_matches "")],
   22.17 +        Rule_Set.append_rls "equation_prls" Rule_Set.e_rls  [Rule.Num_Calc ("Prog_Expr.matches", Prog_Expr.eval_matches "")],
   22.18          SOME "solve (e_e::bool, v_v)", [])),
   22.19      (Specify.prep_pbt thy "pbl_equ_univ" [] Celem.e_pblID
   22.20        (["univariate","equation"],
   22.21 @@ -83,8 +83,8 @@
   22.22  setup \<open>KEStore_Elems.add_mets
   22.23      [Specify.prep_met thy "met_equ" [] Celem.e_metID
   22.24  	    (["Equation"], [],
   22.25 -	      {rew_ord'="tless_true", rls'=Rule.Erls, calc = [], srls = Rule.e_rls, prls=Rule.e_rls, crls = Atools_erls,
   22.26 -          errpats = [], nrls = Rule.e_rls},
   22.27 +	      {rew_ord'="tless_true", rls'=Rule_Set.Erls, calc = [], srls = Rule_Set.e_rls, prls=Rule_Set.e_rls, crls = Atools_erls,
   22.28 +          errpats = [], nrls = Rule_Set.e_rls},
   22.29          @{thm refl})]
   22.30  \<close>
   22.31  
    23.1 --- a/src/Tools/isac/Knowledge/InsSort.thy	Wed Apr 01 19:20:05 2020 +0200
    23.2 +++ b/src/Tools/isac/Knowledge/InsSort.thy	Sat Apr 04 12:11:32 2020 +0200
    23.3 @@ -47,9 +47,9 @@
    23.4  section \<open>rulesets\<close>
    23.5  ML \<open>
    23.6  val ins_sort = 
    23.7 -  Rule.Rls {
    23.8 -    id = "ins_sort", preconds = [], rew_ord = ("tless_true", tless_true), erls = Rule.e_rls,
    23.9 -    srls = Rule.e_rls, calc = [], rules = [
   23.10 +  Rule_Set.Rls {
   23.11 +    id = "ins_sort", preconds = [], rew_ord = ("tless_true", tless_true), erls = Rule_Set.e_rls,
   23.12 +    srls = Rule_Set.e_rls, calc = [], rules = [
   23.13        Rule.Thm ("xfoldr_Nil",(*num_str*) @{thm xfoldr_Nil} (* foldr ?f [] = id *)),
   23.14  	    Rule.Thm ("xfoldr_Cons", @{thm xfoldr_Cons} (* foldr ?f (?x # ?xs) = ?f ?x \<circ> foldr ?f ?xs *)),
   23.15  
   23.16 @@ -73,13 +73,13 @@
   23.17  section \<open>problems\<close>
   23.18  setup \<open>KEStore_Elems.add_pbts
   23.19    [(Specify.prep_pbt @{theory} "pbl_Programming" [] Celem.e_pblID 
   23.20 -     (["Programming"], [], Rule.e_rls, NONE, [])),
   23.21 +     (["Programming"], [], Rule_Set.e_rls, NONE, [])),
   23.22     (Specify.prep_pbt @{theory} "pbl_Prog_sort" [] Celem.e_pblID 
   23.23 -     (["SORT","Programming"], [], Rule.e_rls, NONE, [])),
   23.24 +     (["SORT","Programming"], [], Rule_Set.e_rls, NONE, [])),
   23.25     (Specify.prep_pbt @{theory} "pbl_Prog_sort_ins" [] Celem.e_pblID
   23.26       (["insertion","SORT","Programming"], 
   23.27       [("#Given", ["unsorted u_u"]), ("#Find", ["sorted s_s"])], 
   23.28 -     Rule.e_rls, 
   23.29 +     Rule_Set.e_rls, 
   23.30       SOME "Sort u_u", [["Programming","SORT","insertion_steps"]]))]\<close>
   23.31  
   23.32  section \<open>methods\<close>
   23.33 @@ -87,12 +87,12 @@
   23.34  setup \<open>KEStore_Elems.add_mets
   23.35    [ Specify.prep_met @{theory} "met_Programming" [] Celem.e_metID
   23.36        (["Programming"], [],
   23.37 -        {rew_ord'="tless_true",rls' = Rule.e_rls, calc = [], srls = Rule.e_rls, prls = Rule.e_rls,
   23.38 -          crls = Rule.e_rls, errpats = [], nrls = Rule.e_rls}, @{thm refl}),
   23.39 +        {rew_ord'="tless_true",rls' = Rule_Set.e_rls, calc = [], srls = Rule_Set.e_rls, prls = Rule_Set.e_rls,
   23.40 +          crls = Rule_Set.e_rls, errpats = [], nrls = Rule_Set.e_rls}, @{thm refl}),
   23.41      Specify.prep_met @{theory} "met_Prog_sort" [] Celem.e_metID
   23.42        (["Programming","SORT"], [],
   23.43 -        {rew_ord'="tless_true",rls' = Rule.e_rls, calc = [], srls = Rule.e_rls, prls = Rule.e_rls,
   23.44 -          crls = Rule.e_rls, errpats = [], nrls = Rule.e_rls},
   23.45 +        {rew_ord'="tless_true",rls' = Rule_Set.e_rls, calc = [], srls = Rule_Set.e_rls, prls = Rule_Set.e_rls,
   23.46 +          crls = Rule_Set.e_rls, errpats = [], nrls = Rule_Set.e_rls},
   23.47          @{thm refl})]
   23.48  \<close>
   23.49  
   23.50 @@ -107,7 +107,7 @@
   23.51     [Specify.prep_met @{theory} "met_Prog_sort_ins" [] Celem.e_metID
   23.52        (["Programming","SORT","insertion"], 
   23.53        [("#Given", ["unsorted u_u"]), ("#Find", ["sorted s_s"])],
   23.54 -        {rew_ord'="tless_true",rls' = Atools_erls, calc = [], srls = Rule.e_rls, prls = Rule.e_rls,
   23.55 +        {rew_ord'="tless_true",rls' = Atools_erls, calc = [], srls = Rule_Set.e_rls, prls = Rule_Set.e_rls,
   23.56            crls = Atools_crls, errpats = [], nrls = norm_Rational},
   23.57          @{thm sort_program.simps})]
   23.58  \<close>
   23.59 @@ -137,7 +137,7 @@
   23.60     [Specify.prep_met @{theory} "met_Prog_sort_ins_steps" [] Celem.e_metID
   23.61        (["Programming","SORT","insertion_steps"], 
   23.62        [("#Given", ["unsorted u_u"]), ("#Find", ["sorted s_s"])],
   23.63 -        {rew_ord'="tless_true",rls' = Atools_erls, calc = [], srls = Rule.e_rls, prls = Rule.e_rls,
   23.64 +        {rew_ord'="tless_true",rls' = Atools_erls, calc = [], srls = Rule_Set.e_rls, prls = Rule_Set.e_rls,
   23.65            crls = Atools_crls, errpats = [], nrls = norm_Rational},
   23.66          @{thm sort_program2.simps})]
   23.67  \<close>
    24.1 --- a/src/Tools/isac/Knowledge/Integrate.thy	Wed Apr 01 19:20:05 2020 +0200
    24.2 +++ b/src/Tools/isac/Knowledge/Integrate.thy	Sat Apr 04 12:11:32 2020 +0200
    24.3 @@ -110,20 +110,20 @@
    24.4  
    24.5  (*.rulesets for integration.*)
    24.6  val integration_rules = 
    24.7 -    Rule.Rls {id="integration_rules", preconds = [], 
    24.8 +    Rule_Set.Rls {id="integration_rules", preconds = [], 
    24.9  	 rew_ord = ("termlessI",termlessI), 
   24.10 -	 erls = Rule.Rls {id="conditions_in_integration_rules", 
   24.11 +	 erls = Rule_Set.Rls {id="conditions_in_integration_rules", 
   24.12  		     preconds = [], 
   24.13  		     rew_ord = ("termlessI",termlessI), 
   24.14 -		     erls = Rule.Erls, 
   24.15 -		     srls = Rule.Erls, calc = [], errpatts = [],
   24.16 +		     erls = Rule_Set.Erls, 
   24.17 +		     srls = Rule_Set.Erls, calc = [], errpatts = [],
   24.18  		     rules = [(*for rewriting conditions in Thm's*)
   24.19  			      Rule.Num_Calc ("Prog_Expr.occurs'_in", Prog_Expr.eval_occurs_in "#occurs_in_"),
   24.20  			      Rule.Thm ("not_true", TermC.num_str @{thm not_true}),
   24.21  			      Rule.Thm ("not_false",@{thm not_false})
   24.22  			      ],
   24.23  		     scr = Rule.EmptyScr}, 
   24.24 -	 srls = Rule.Erls, calc = [], errpatts = [],
   24.25 +	 srls = Rule_Set.Erls, calc = [], errpatts = [],
   24.26  	 rules = [
   24.27  		  Rule.Thm ("integral_const", TermC.num_str @{thm integral_const}),
   24.28  		  Rule.Thm ("integral_var", TermC.num_str @{thm integral_var}),
   24.29 @@ -136,13 +136,13 @@
   24.30  \<close>
   24.31  ML \<open>
   24.32  val add_new_c = 
   24.33 -    Rule.Seq {id="add_new_c", preconds = [], 
   24.34 +    Rule_Set.Seq {id="add_new_c", preconds = [], 
   24.35  	 rew_ord = ("termlessI",termlessI), 
   24.36 -	 erls = Rule.Rls {id="conditions_in_add_new_c", 
   24.37 +	 erls = Rule_Set.Rls {id="conditions_in_add_new_c", 
   24.38  		     preconds = [], 
   24.39  		     rew_ord = ("termlessI",termlessI), 
   24.40 -		     erls = Rule.Erls, 
   24.41 -		     srls = Rule.Erls, calc = [], errpatts = [],
   24.42 +		     erls = Rule_Set.Erls, 
   24.43 +		     srls = Rule_Set.Erls, calc = [], errpatts = [],
   24.44  		     rules = [Rule.Num_Calc ("Prog_Expr.matches", Prog_Expr.eval_matches""),
   24.45  			      Rule.Num_Calc ("Integrate.is'_f'_x", 
   24.46  				    eval_is_f_x "is_f_x_"),
   24.47 @@ -150,7 +150,7 @@
   24.48  			      Rule.Thm ("not_false", TermC.num_str @{thm not_false})
   24.49  			      ],
   24.50  		     scr = Rule.EmptyScr}, 
   24.51 -	 srls = Rule.Erls, calc = [], errpatts = [],
   24.52 +	 srls = Rule_Set.Erls, calc = [], errpatts = [],
   24.53  	 rules = [ (*Rule.Thm ("call_for_new_c", TermC.num_str @{thm call_for_new_c}),*)
   24.54  		   Rule.Cal1 ("Integrate.add'_new'_c", eval_add_new_c "new_c_")
   24.55  		   ],
   24.56 @@ -162,18 +162,18 @@
   24.57  
   24.58  (*.for simplify_Integral adapted from 'norm_Rational_rls'.*)
   24.59  val norm_Rational_rls_noadd_fractions = 
   24.60 -Rule.Rls {id = "norm_Rational_rls_noadd_fractions", preconds = [], 
   24.61 +Rule_Set.Rls {id = "norm_Rational_rls_noadd_fractions", preconds = [], 
   24.62       rew_ord = ("dummy_ord",Rule.dummy_ord), 
   24.63 -     erls = norm_rat_erls, srls = Rule.Erls, calc = [], errpatts = [],
   24.64 +     erls = norm_rat_erls, srls = Rule_Set.Erls, calc = [], errpatts = [],
   24.65       rules = [(*Rule.Rls_ add_fractions_p_rls,!!!*)
   24.66  	      Rule.Rls_ (*rat_mult_div_pow original corrected WN051028*)
   24.67 -		  (Rule.Rls {id = "rat_mult_div_pow", preconds = [], 
   24.68 +		  (Rule_Set.Rls {id = "rat_mult_div_pow", preconds = [], 
   24.69  		       rew_ord = ("dummy_ord",Rule.dummy_ord), 
   24.70 -		       erls = (*FIXME.WN051028 Rule.e_rls,*)
   24.71 -		       Rule.append_rls "Rule.e_rls-is_polyexp" Rule.e_rls
   24.72 +		       erls = (*FIXME.WN051028 Rule_Set.e_rls,*)
   24.73 +		       Rule_Set.append_rls "Rule_Set.e_rls-is_polyexp" Rule_Set.e_rls
   24.74  				  [Rule.Num_Calc ("Poly.is'_polyexp", 
   24.75  					 eval_is_polyexp "")],
   24.76 -				  srls = Rule.Erls, calc = [], errpatts = [],
   24.77 +				  srls = Rule_Set.Erls, calc = [], errpatts = [],
   24.78  				  rules = [Rule.Thm ("rat_mult", TermC.num_str @{thm rat_mult}),
   24.79  	       (*"?a / ?b * (?c / ?d) = ?a * ?c / (?b * ?d)"*)
   24.80  	       Rule.Thm ("rat_mult_poly_l", TermC.num_str @{thm rat_mult_poly_l}),
   24.81 @@ -206,9 +206,9 @@
   24.82  
   24.83  (*.for simplify_Integral adapted from 'norm_Rational'.*)
   24.84  val norm_Rational_noadd_fractions = 
   24.85 -   Rule.Seq {id = "norm_Rational_noadd_fractions", preconds = [], 
   24.86 +   Rule_Set.Seq {id = "norm_Rational_noadd_fractions", preconds = [], 
   24.87         rew_ord = ("dummy_ord",Rule.dummy_ord), 
   24.88 -       erls = norm_rat_erls, srls = Rule.Erls, calc = [], errpatts = [],
   24.89 +       erls = norm_rat_erls, srls = Rule_Set.Erls, calc = [], errpatts = [],
   24.90         rules = [Rule.Rls_ discard_minus,
   24.91  		Rule.Rls_ rat_mult_poly,(* removes double fractions like a/b/c    *)
   24.92  		Rule.Rls_ make_rat_poly_with_parentheses, (*WN0510 also in(#)below*)
   24.93 @@ -226,7 +226,7 @@
   24.94     *1* expand the term, ie. distribute * and / over +
   24.95  .*)
   24.96  val separate_bdv2 =
   24.97 -    Rule.append_rls "separate_bdv2"
   24.98 +    Rule_Set.append_rls "separate_bdv2"
   24.99  	       collect_bdv
  24.100  	       [Rule.Thm ("separate_bdv", TermC.num_str @{thm separate_bdv}),
  24.101  		(*"?a * ?bdv / ?b = ?a / ?b * ?bdv"*)
  24.102 @@ -240,9 +240,9 @@
  24.103  			  (*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"*)----------*)
  24.104  		];
  24.105  val simplify_Integral = 
  24.106 -  Rule.Seq {id = "simplify_Integral", preconds = []:term list, 
  24.107 +  Rule_Set.Seq {id = "simplify_Integral", preconds = []:term list, 
  24.108         rew_ord = ("dummy_ord", Rule.dummy_ord),
  24.109 -      erls = Atools_erls, srls = Rule.Erls,
  24.110 +      erls = Atools_erls, srls = Rule_Set.Erls,
  24.111        calc = [],  errpatts = [],
  24.112        rules = [Rule.Thm ("distrib_right", TermC.num_str @{thm distrib_right}),
  24.113   	       (*"(?z1.0 + ?z2.0) * ?w = ?z1.0 * ?w + ?z2.0 * ?w"*)
  24.114 @@ -266,9 +266,9 @@
  24.115     'make_ratpoly_in' 
  24.116  THIS IS KEPT FOR COMPARISON ............................................   
  24.117  * val simplify_Integral = prep_rls'(
  24.118 -*   Rule.Seq {id = "", preconds = []:term list, 
  24.119 +*   Rule_Set.Seq {id = "", preconds = []:term list, 
  24.120  *        rew_ord = ("dummy_ord", Rule.dummy_ord),
  24.121 -*       erls = Atools_erls, srls = Rule.Erls,
  24.122 +*       erls = Atools_erls, srls = Rule_Set.Erls,
  24.123  *       calc = [], (*asm_thm = [],*)
  24.124  *       rules = [Rule.Rls_ expand_poly,
  24.125  * 	       Rule.Rls_ order_add_mult_in,
  24.126 @@ -279,7 +279,7 @@
  24.127  * 	       Rule.Rls_ discard_parentheses,
  24.128  * 	       Rule.Rls_ collect_bdv,
  24.129  * 	       (*below inserted from 'make_ratpoly_in'*)
  24.130 -* 	       Rule.Rls_ (Rule.append_rls "separate_bdv"
  24.131 +* 	       Rule.Rls_ (Rule_Set.append_rls "separate_bdv"
  24.132  * 			 collect_bdv
  24.133  * 			 [Rule.Thm ("separate_bdv", TermC.num_str @{thm separate_bdv}),
  24.134  * 			  (*"?a * ?bdv / ?b = ?a / ?b * ?bdv"*)
  24.135 @@ -299,16 +299,16 @@
  24.136  .......................................................................*)
  24.137  
  24.138  val integration = 
  24.139 -    Rule.Seq {id="integration", preconds = [], 
  24.140 +    Rule_Set.Seq {id="integration", preconds = [], 
  24.141  	 rew_ord = ("termlessI",termlessI), 
  24.142 -	 erls = Rule.Rls {id="conditions_in_integration", 
  24.143 +	 erls = Rule_Set.Rls {id="conditions_in_integration", 
  24.144  		     preconds = [], 
  24.145  		     rew_ord = ("termlessI",termlessI), 
  24.146 -		     erls = Rule.Erls, 
  24.147 -		     srls = Rule.Erls, calc = [], errpatts = [],
  24.148 +		     erls = Rule_Set.Erls, 
  24.149 +		     srls = Rule_Set.Erls, calc = [], errpatts = [],
  24.150  		     rules = [],
  24.151  		     scr = Rule.EmptyScr}, 
  24.152 -	 srls = Rule.Erls, calc = [], errpatts = [],
  24.153 +	 srls = Rule_Set.Erls, calc = [], errpatts = [],
  24.154  	 rules = [ Rule.Rls_ integration_rules,
  24.155  		   Rule.Rls_ add_new_c,
  24.156  		   Rule.Rls_ simplify_Integral
  24.157 @@ -335,7 +335,7 @@
  24.158        (["integrate","function"],
  24.159          [("#Given" ,["functionTerm f_f", "integrateBy v_v"]),
  24.160            ("#Find"  ,["antiDerivative F_F"])],
  24.161 -        Rule.append_rls "e_rls" Rule.e_rls [(*for preds in where_*)], 
  24.162 +        Rule_Set.append_rls "e_rls" Rule_Set.e_rls [(*for preds in where_*)], 
  24.163          SOME "Integrate (f_f, v_v)", 
  24.164          [["diff","integration"]])),
  24.165      (*here "named" is used differently from Differentiation"*)
  24.166 @@ -343,7 +343,7 @@
  24.167        (["named","integrate","function"],
  24.168          [("#Given" ,["functionTerm f_f", "integrateBy v_v"]),
  24.169            ("#Find"  ,["antiDerivativeName F_F"])],
  24.170 -        Rule.append_rls "e_rls" Rule.e_rls [(*for preds in where_*)], 
  24.171 +        Rule_Set.append_rls "e_rls" Rule_Set.e_rls [(*for preds in where_*)], 
  24.172          SOME "Integrate (f_f, v_v)", 
  24.173          [["diff","integration","named"]]))]\<close>
  24.174  
  24.175 @@ -360,8 +360,8 @@
  24.176      [Specify.prep_met thy "met_diffint" [] Celem.e_metID
  24.177  	    (["diff","integration"],
  24.178  	      [("#Given" ,["functionTerm f_f", "integrateBy v_v"]), ("#Find"  ,["antiDerivative F_F"])],
  24.179 -	      {rew_ord'="tless_true", rls'=Atools_erls, calc = [], srls = Rule.e_rls, prls=Rule.e_rls,
  24.180 -	        crls = Atools_erls, errpats = [], nrls = Rule.e_rls},
  24.181 +	      {rew_ord'="tless_true", rls'=Atools_erls, calc = [], srls = Rule_Set.e_rls, prls=Rule_Set.e_rls,
  24.182 +	        crls = Atools_erls, errpats = [], nrls = Rule_Set.e_rls},
  24.183  	      @{thm integrate.simps})]
  24.184  \<close>
  24.185  
  24.186 @@ -379,8 +379,8 @@
  24.187  	    (["diff","integration","named"],
  24.188  	      [("#Given" ,["functionTerm f_f", "integrateBy v_v"]),
  24.189  	        ("#Find"  ,["antiDerivativeName F_F"])],
  24.190 -	      {rew_ord'="tless_true", rls'=Atools_erls, calc = [], srls = Rule.e_rls, prls=Rule.e_rls,
  24.191 -          crls = Atools_erls, errpats = [], nrls = Rule.e_rls},
  24.192 +	      {rew_ord'="tless_true", rls'=Atools_erls, calc = [], srls = Rule_Set.e_rls, prls=Rule_Set.e_rls,
  24.193 +          crls = Atools_erls, errpats = [], nrls = Rule_Set.e_rls},
  24.194          @{thm intergrate_named.simps})]
  24.195  \<close>
  24.196  
    25.1 --- a/src/Tools/isac/Knowledge/Inverse_Z_Transform.thy	Wed Apr 01 19:20:05 2020 +0200
    25.2 +++ b/src/Tools/isac/Knowledge/Inverse_Z_Transform.thy	Sat Apr 04 12:11:32 2020 +0200
    25.3 @@ -27,8 +27,8 @@
    25.4  
    25.5  ML \<open>
    25.6  val inverse_z = prep_rls'(
    25.7 -  Rule.Rls {id = "inverse_z", preconds = [], rew_ord = ("dummy_ord",Rule.dummy_ord), 
    25.8 -	  erls = Rule.Erls, srls = Rule.Erls, calc = [], errpatts = [],
    25.9 +  Rule_Set.Rls {id = "inverse_z", preconds = [], rew_ord = ("dummy_ord",Rule.dummy_ord), 
   25.10 +	  erls = Rule_Set.Erls, srls = Rule_Set.Erls, calc = [], errpatts = [],
   25.11  	  rules = 
   25.12  	   [
   25.13      Rule.Thm ("rule4", @{thm rule4})
   25.14 @@ -46,14 +46,14 @@
   25.15  val thy = @{theory};
   25.16  \<close>
   25.17  setup \<open>KEStore_Elems.add_pbts
   25.18 -  [(Specify.prep_pbt thy "pbl_SP" [] Celem.e_pblID (["SignalProcessing"], [], Rule.e_rls, NONE, [])),
   25.19 +  [(Specify.prep_pbt thy "pbl_SP" [] Celem.e_pblID (["SignalProcessing"], [], Rule_Set.e_rls, NONE, [])),
   25.20      (Specify.prep_pbt thy "pbl_SP_Ztrans" [] Celem.e_pblID
   25.21 -      (["Z_Transform","SignalProcessing"], [], Rule.e_rls, NONE, [])),
   25.22 +      (["Z_Transform","SignalProcessing"], [], Rule_Set.e_rls, NONE, [])),
   25.23      (Specify.prep_pbt thy "pbl_SP_Ztrans_inv" [] Celem.e_pblID
   25.24        (["Inverse", "Z_Transform", "SignalProcessing"],
   25.25          [("#Given" , ["filterExpression X_eq"]),
   25.26            ("#Find"  ,["stepResponse n_eq"])], \<comment> \<open>TODO: unused, "u [n]" is introduced by rule1..6\<close>
   25.27 -        Rule.append_rls "e_rls" Rule.e_rls [(*for preds in where_*)], NONE, 
   25.28 +        Rule_Set.append_rls "e_rls" Rule_Set.e_rls [(*for preds in where_*)], NONE, 
   25.29          [["SignalProcessing","Z_Transform","Inverse"]]))]\<close>
   25.30  
   25.31  subsection \<open>Setup Parent Nodes in Hierarchy of Method\<close>
   25.32 @@ -61,12 +61,12 @@
   25.33  setup \<open>KEStore_Elems.add_mets
   25.34      [Specify.prep_met thy "met_SP" [] Celem.e_metID
   25.35        (["SignalProcessing"], [],
   25.36 -        {rew_ord'="tless_true", rls'= Rule.e_rls, calc = [], srls = Rule.e_rls, prls = Rule.e_rls, crls = Rule.e_rls,
   25.37 -          errpats = [], nrls = Rule.e_rls}, @{thm refl}),
   25.38 +        {rew_ord'="tless_true", rls'= Rule_Set.e_rls, calc = [], srls = Rule_Set.e_rls, prls = Rule_Set.e_rls, crls = Rule_Set.e_rls,
   25.39 +          errpats = [], nrls = Rule_Set.e_rls}, @{thm refl}),
   25.40      Specify.prep_met thy "met_SP_Ztrans" [] Celem.e_metID
   25.41        (["SignalProcessing", "Z_Transform"], [],
   25.42 -        {rew_ord'="tless_true", rls'= Rule.e_rls, calc = [], srls = Rule.e_rls, prls = Rule.e_rls, crls = Rule.e_rls,
   25.43 -          errpats = [], nrls = Rule.e_rls}, @{thm refl})]
   25.44 +        {rew_ord'="tless_true", rls'= Rule_Set.e_rls, calc = [], srls = Rule_Set.e_rls, prls = Rule_Set.e_rls, crls = Rule_Set.e_rls,
   25.45 +          errpats = [], nrls = Rule_Set.e_rls}, @{thm refl})]
   25.46  \<close>
   25.47  
   25.48  partial_function (tailrec) inverse_ztransform :: "bool \<Rightarrow> real \<Rightarrow> bool"
   25.49 @@ -91,8 +91,8 @@
   25.50        (["SignalProcessing", "Z_Transform", "Inverse"],
   25.51          [("#Given" ,["filterExpression X_eq", "functionName X_z"]),
   25.52            ("#Find"  ,["stepResponse n_eq"])], \<comment> \<open>TODO: unused, "u [n]" is introduced by rule1..6\<close>
   25.53 -        {rew_ord'="tless_true", rls'= Rule.e_rls, calc = [], srls = Rule.e_rls, prls = Rule.e_rls, crls = Rule.e_rls,
   25.54 -          errpats = [], nrls = Rule.e_rls},
   25.55 +        {rew_ord'="tless_true", rls'= Rule_Set.e_rls, calc = [], srls = Rule_Set.e_rls, prls = Rule_Set.e_rls, crls = Rule_Set.e_rls,
   25.56 +          errpats = [], nrls = Rule_Set.e_rls},
   25.57          @{thm inverse_ztransform.simps})]
   25.58  \<close>
   25.59  
   25.60 @@ -119,15 +119,15 @@
   25.61        (["SignalProcessing", "Z_Transform", "Inverse_sub"],
   25.62          [("#Given" ,["filterExpression X_eq", "functionName X_z"]),
   25.63            ("#Find"  ,["stepResponse n_eq"])], \<comment> \<open>TODO: unused, "u [n]" is introduced by rule1..6\<close>
   25.64 -        {rew_ord'="tless_true", rls'= Rule.e_rls, calc = [],
   25.65 -          srls = Rule.Rls {id="srls_partial_fraction", 
   25.66 +        {rew_ord'="tless_true", rls'= Rule_Set.e_rls, calc = [],
   25.67 +          srls = Rule_Set.Rls {id="srls_partial_fraction", 
   25.68                preconds = [], rew_ord = ("termlessI",termlessI),
   25.69 -              erls = Rule.append_rls "erls_in_srls_partial_fraction" Rule.e_rls
   25.70 +              erls = Rule_Set.append_rls "erls_in_srls_partial_fraction" Rule_Set.e_rls
   25.71                    [(*for asm in NTH_CONS ...*)
   25.72                      Rule.Num_Calc ("Orderings.ord_class.less", Prog_Expr.eval_equ "#less_"),
   25.73                      (*2nd NTH_CONS pushes n+-1 into asms*)
   25.74                      Rule.Num_Calc("Groups.plus_class.plus", (**)eval_binop "#add_")], 
   25.75 -              srls = Rule.Erls, calc = [], errpatts = [],
   25.76 +              srls = Rule_Set.Erls, calc = [], errpatts = [],
   25.77                rules = [Rule.Thm ("NTH_CONS", @{thm NTH_CONS}),
   25.78                    Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"),
   25.79                    Rule.Thm ("NTH_NIL", @{thm NTH_NIL}),
   25.80 @@ -139,7 +139,7 @@
   25.81                    Rule.Num_Calc ("Partial_Fractions.factors_from_solution",
   25.82                      eval_factors_from_solution "#factors_from_solution")
   25.83                    ], scr = Rule.EmptyScr},
   25.84 -          prls = Rule.e_rls, crls = Rule.e_rls, errpats = [], nrls = norm_Rational},
   25.85 +          prls = Rule_Set.e_rls, crls = Rule_Set.e_rls, errpats = [], nrls = norm_Rational},
   25.86          @{thm inverse_ztransform2.simps})]
   25.87  \<close>
   25.88  ML \<open>
    26.1 --- a/src/Tools/isac/Knowledge/LinEq.thy	Wed Apr 01 19:20:05 2020 +0200
    26.2 +++ b/src/Tools/isac/Knowledge/LinEq.thy	Sat Apr 04 12:11:32 2020 +0200
    26.3 @@ -26,7 +26,7 @@
    26.4  val thy = @{theory};
    26.5  
    26.6  val LinEq_prls = (*3.10.02:just the following order due to subterm evaluation*)
    26.7 -  Rule.append_rls "LinEq_prls" Rule.e_rls 
    26.8 +  Rule_Set.append_rls "LinEq_prls" Rule_Set.e_rls 
    26.9  	     [Rule.Num_Calc ("HOL.eq", Prog_Expr.eval_equal "#equal_"),
   26.10  	      Rule.Num_Calc ("Prog_Expr.matches", Prog_Expr.eval_matches ""),
   26.11  	      Rule.Num_Calc ("Prog_Expr.lhs"    , Prog_Expr.eval_lhs ""),
   26.12 @@ -44,7 +44,7 @@
   26.13                ];
   26.14  (* ----- erls ----- *)
   26.15  val LinEq_crls = 
   26.16 -   Rule.append_rls "LinEq_crls" poly_crls
   26.17 +   Rule_Set.append_rls "LinEq_crls" poly_crls
   26.18     [Rule.Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1})
   26.19      (*		
   26.20       Don't use
   26.21 @@ -55,7 +55,7 @@
   26.22  
   26.23  (* ----- crls ----- *)
   26.24  val LinEq_erls = 
   26.25 -   Rule.append_rls "LinEq_erls" Poly_erls
   26.26 +   Rule_Set.append_rls "LinEq_erls" Poly_erls
   26.27     [Rule.Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1})
   26.28      (*		
   26.29       Don't use
   26.30 @@ -69,10 +69,10 @@
   26.31  ML \<open>
   26.32      
   26.33  val LinPoly_simplify = prep_rls'(
   26.34 -  Rule.Rls {id = "LinPoly_simplify", preconds = [], 
   26.35 +  Rule_Set.Rls {id = "LinPoly_simplify", preconds = [], 
   26.36         rew_ord = ("termlessI",termlessI), 
   26.37         erls = LinEq_erls, 
   26.38 -       srls = Rule.Erls, 
   26.39 +       srls = Rule_Set.Erls, 
   26.40         calc = [], errpatts = [],
   26.41         rules = [
   26.42  		Rule.Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1}),
   26.43 @@ -93,10 +93,10 @@
   26.44  
   26.45  (*isolate the bound variable in an linear equation; 'bdv' is a meta-constant*)
   26.46  val LinEq_simplify = prep_rls'(
   26.47 -Rule.Rls {id = "LinEq_simplify", preconds = [],
   26.48 +Rule_Set.Rls {id = "LinEq_simplify", preconds = [],
   26.49       rew_ord = ("e_rew_ord", Rule.e_rew_ord),
   26.50       erls = LinEq_erls,
   26.51 -     srls = Rule.Erls,
   26.52 +     srls = Rule_Set.Erls,
   26.53       calc = [], errpatts = [],
   26.54       rules = [
   26.55  	      Rule.Thm("lin_isolate_add1",TermC.num_str @{thm lin_isolate_add1}), 
   26.56 @@ -129,7 +129,7 @@
   26.57  setup \<open>KEStore_Elems.add_mets
   26.58      [Specify.prep_met thy "met_eqlin" [] Celem.e_metID
   26.59        (["LinEq"], [],
   26.60 -        {rew_ord' = "tless_true",rls' = Atools_erls,calc = [], srls = Rule.e_rls, prls = Rule.e_rls,
   26.61 +        {rew_ord' = "tless_true",rls' = Atools_erls,calc = [], srls = Rule_Set.e_rls, prls = Rule_Set.e_rls,
   26.62            crls = LinEq_crls, errpats = [], nrls = norm_Poly},
   26.63          @{thm refl})]
   26.64  \<close>
   26.65 @@ -156,7 +156,7 @@
   26.66          [("#Given", ["equality e_e", "solveFor v_v"]),
   26.67            ("#Where", ["Not ((lhs e_e) is_polyrat_in v_v)", "((lhs e_e)  has_degree_in v_v) = 1"]),
   26.68            ("#Find",  ["solutions v_v'i'"])],
   26.69 -        {rew_ord' = "termlessI", rls' = LinEq_erls, srls = Rule.e_rls, prls = LinEq_prls, calc = [],
   26.70 +        {rew_ord' = "termlessI", rls' = LinEq_erls, srls = Rule_Set.e_rls, prls = LinEq_prls, calc = [],
   26.71            crls = LinEq_crls, errpats = [], nrls = norm_Poly},
   26.72          @{thm solve_linear_equation.simps})]
   26.73  \<close>
    27.1 --- a/src/Tools/isac/Knowledge/LogExp.thy	Wed Apr 01 19:20:05 2020 +0200
    27.2 +++ b/src/Tools/isac/Knowledge/LogExp.thy	Sat Apr 04 12:11:32 2020 +0200
    27.3 @@ -49,7 +49,7 @@
    27.4          [("#Given" ,["equality e_e","solveFor v_v"]),
    27.5            ("#Where" ,["matches ((?a log ?v_v) = ?b) e_e"]),
    27.6            ("#Find"  ,["solutions v_v'i'"])],
    27.7 -        {rew_ord' = "termlessI", rls' = PolyEq_erls, srls = Rule.e_rls, prls = PolyEq_prls, calc = [],
    27.8 +        {rew_ord' = "termlessI", rls' = PolyEq_erls, srls = Rule_Set.e_rls, prls = PolyEq_prls, calc = [],
    27.9            crls = PolyEq_crls, errpats = [], nrls = norm_Rational},
   27.10          @{thm solve_log.simps})]
   27.11  \<close>
    28.1 --- a/src/Tools/isac/Knowledge/Partial_Fractions.thy	Wed Apr 01 19:20:05 2020 +0200
    28.2 +++ b/src/Tools/isac/Knowledge/Partial_Fractions.thy	Sat Apr 04 12:11:32 2020 +0200
    28.3 @@ -106,8 +106,8 @@
    28.4  
    28.5  ML \<open>
    28.6  val ansatz_rls = prep_rls'(
    28.7 -  Rule.Rls {id = "ansatz_rls", preconds = [], rew_ord = ("dummy_ord",Rule.dummy_ord), 
    28.8 -	  erls = Rule.Erls, srls = Rule.Erls, calc = [], errpatts = [],
    28.9 +  Rule_Set.Rls {id = "ansatz_rls", preconds = [], rew_ord = ("dummy_ord",Rule.dummy_ord), 
   28.10 +	  erls = Rule_Set.Erls, srls = Rule_Set.Erls, calc = [], errpatts = [],
   28.11  	  rules = 
   28.12  	   [Rule.Thm ("ansatz_2nd_order",TermC.num_str @{thm ansatz_2nd_order}),
   28.13  	    Rule.Thm ("ansatz_3rd_order",TermC.num_str @{thm ansatz_3rd_order})
   28.14 @@ -115,8 +115,8 @@
   28.15  	 scr = Rule.EmptyScr});
   28.16  
   28.17  val equival_trans = prep_rls'(
   28.18 -  Rule.Rls {id = "equival_trans", preconds = [], rew_ord = ("dummy_ord",Rule.dummy_ord), 
   28.19 -	  erls = Rule.Erls, srls = Rule.Erls, calc = [], errpatts = [],
   28.20 +  Rule_Set.Rls {id = "equival_trans", preconds = [], rew_ord = ("dummy_ord",Rule.dummy_ord), 
   28.21 +	  erls = Rule_Set.Erls, srls = Rule_Set.Erls, calc = [], errpatts = [],
   28.22  	  rules = 
   28.23  	   [Rule.Thm ("equival_trans_2nd_order",TermC.num_str @{thm equival_trans_2nd_order}),
   28.24  	    Rule.Thm ("equival_trans_3rd_order",TermC.num_str @{thm equival_trans_3rd_order})
   28.25 @@ -124,9 +124,9 @@
   28.26  	 scr = Rule.EmptyScr});
   28.27  
   28.28  val multiply_ansatz = prep_rls'(
   28.29 -  Rule.Rls {id = "multiply_ansatz", preconds = [], rew_ord = ("dummy_ord",Rule.dummy_ord), 
   28.30 -	  erls = Rule.Erls,
   28.31 -	  srls = Rule.Erls, calc = [], errpatts = [],
   28.32 +  Rule_Set.Rls {id = "multiply_ansatz", preconds = [], rew_ord = ("dummy_ord",Rule.dummy_ord), 
   28.33 +	  erls = Rule_Set.Erls,
   28.34 +	  srls = Rule_Set.Erls, calc = [], errpatts = [],
   28.35  	  rules = 
   28.36  	   [Rule.Thm ("multiply_2nd_order",TermC.num_str @{thm multiply_2nd_order})
   28.37  	   ], 
   28.38 @@ -156,22 +156,22 @@
   28.39              ("#Where" ,["((get_numerator t_t) has_degree_in v_v) < 
   28.40                 ((get_denominator t_t) has_degree_in v_v)"]), TODO*)
   28.41            ("#Find"  ,["decomposedFunction p_p'''"])],
   28.42 -        Rule.append_rls "e_rls" Rule.e_rls [(*for preds in where_ TODO*)], 
   28.43 +        Rule_Set.append_rls "e_rls" Rule_Set.e_rls [(*for preds in where_ TODO*)], 
   28.44          NONE, 
   28.45          [["simplification","of_rationals","to_partial_fraction"]]))]\<close>
   28.46  
   28.47  subsection \<open>Method\<close>
   28.48  text \<open>rule set for functions called in the Program\<close>
   28.49  ML \<open>
   28.50 -  val srls_partial_fraction = Rule.Rls {id="srls_partial_fraction", 
   28.51 +  val srls_partial_fraction = Rule_Set.Rls {id="srls_partial_fraction", 
   28.52      preconds = [],
   28.53      rew_ord = ("termlessI",termlessI),
   28.54 -    erls = Rule.append_rls "erls_in_srls_partial_fraction" Rule.e_rls
   28.55 +    erls = Rule_Set.append_rls "erls_in_srls_partial_fraction" Rule_Set.e_rls
   28.56        [(*for asm in NTH_CONS ...*)
   28.57         Rule.Num_Calc ("Orderings.ord_class.less", Prog_Expr.eval_equ "#less_"),
   28.58         (*2nd NTH_CONS pushes n+-1 into asms*)
   28.59         Rule.Num_Calc("Groups.plus_class.plus", (**)eval_binop "#add_")], 
   28.60 -    srls = Rule.Erls, calc = [], errpatts = [],
   28.61 +    srls = Rule_Set.Erls, calc = [], errpatts = [],
   28.62      rules = [
   28.63         Rule.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
   28.64         Rule.Num_Calc("Groups.plus_class.plus", (**)eval_binop "#add_"),
   28.65 @@ -235,8 +235,8 @@
   28.66              ((get_denominator t_t) has_degree_in v_v)"]), TODO*)
   28.67            ("#Find"  ,["decomposedFunction p_p'''"])],
   28.68          (*f_f = 3 / (z * (z - 1 / 4 + -1 / 8 * (1 / z)), zzz: z*)
   28.69 -        {rew_ord'="tless_true", rls'= Rule.e_rls, calc = [], srls = srls_partial_fraction, prls = Rule.e_rls,
   28.70 -          crls = Rule.e_rls, errpats = [], nrls = Rule.e_rls},
   28.71 +        {rew_ord'="tless_true", rls'= Rule_Set.e_rls, calc = [], srls = srls_partial_fraction, prls = Rule_Set.e_rls,
   28.72 +          crls = Rule_Set.e_rls, errpats = [], nrls = Rule_Set.e_rls},
   28.73          (*([], Frm), Problem (Partial_Fractions, [partial_fraction, rational, simplification])*)
   28.74          @{thm partial_fraction.simps})]
   28.75  \<close>
    29.1 --- a/src/Tools/isac/Knowledge/Poly.thy	Wed Apr 01 19:20:05 2020 +0200
    29.2 +++ b/src/Tools/isac/Knowledge/Poly.thy	Sat Apr 04 12:11:32 2020 +0200
    29.3 @@ -648,10 +648,10 @@
    29.4  subsubsection \<open>without specific order\<close>
    29.5  ML \<open>
    29.6  (* used only for merge *)
    29.7 -val calculate_Poly = Rule.append_rls "calculate_PolyFIXXXME.not.impl." Rule.e_rls [];
    29.8 +val calculate_Poly = Rule_Set.append_rls "calculate_PolyFIXXXME.not.impl." Rule_Set.e_rls [];
    29.9  
   29.10  (*.for evaluation of conditions in rewrite rules.*)
   29.11 -val Poly_erls = Rule.append_rls "Poly_erls" Atools_erls
   29.12 +val Poly_erls = Rule_Set.append_rls "Poly_erls" Atools_erls
   29.13    [Rule.Num_Calc ("HOL.eq", Prog_Expr.eval_equal "#equal_"),
   29.14    Rule.Thm  ("real_unari_minus", TermC.num_str @{thm real_unari_minus}),
   29.15    Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"),
   29.16 @@ -659,7 +659,7 @@
   29.17    Rule.Num_Calc ("Groups.times_class.times", (**)eval_binop "#mult_"),
   29.18    Rule.Num_Calc ("Prog_Expr.pow", (**)eval_binop "#power_")];
   29.19  
   29.20 -val poly_crls = Rule.append_rls "poly_crls" Atools_crls
   29.21 +val poly_crls = Rule_Set.append_rls "poly_crls" Atools_crls
   29.22    [Rule.Num_Calc ("HOL.eq", Prog_Expr.eval_equal "#equal_"),
   29.23    Rule.Thm ("real_unari_minus", TermC.num_str @{thm real_unari_minus}),
   29.24    Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"),
   29.25 @@ -669,8 +669,8 @@
   29.26  \<close>
   29.27  ML \<open>
   29.28  val expand =
   29.29 -  Rule.Rls {id = "expand", preconds = [], rew_ord = ("dummy_ord", Rule.dummy_ord),
   29.30 -      erls = Rule.e_rls,srls = Rule.Erls, calc = [], errpatts = [],
   29.31 +  Rule_Set.Rls {id = "expand", preconds = [], rew_ord = ("dummy_ord", Rule.dummy_ord),
   29.32 +      erls = Rule_Set.e_rls,srls = Rule_Set.Erls, calc = [], errpatts = [],
   29.33        rules = [Rule.Thm ("distrib_right" , TermC.num_str @{thm distrib_right}),
   29.34  	       (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
   29.35  	       Rule.Thm ("distrib_left", TermC.num_str @{thm distrib_left})
   29.36 @@ -678,8 +678,8 @@
   29.37  	       ], scr = Rule.EmptyScr};
   29.38  
   29.39  val discard_minus =
   29.40 -  Rule.Rls {id = "discard_minus", preconds = [], rew_ord = ("dummy_ord", Rule.dummy_ord),
   29.41 -      erls = Rule.e_rls, srls = Rule.Erls, calc = [], errpatts = [],
   29.42 +  Rule_Set.Rls {id = "discard_minus", preconds = [], rew_ord = ("dummy_ord", Rule.dummy_ord),
   29.43 +      erls = Rule_Set.e_rls, srls = Rule_Set.Erls, calc = [], errpatts = [],
   29.44        rules =
   29.45         [Rule.Thm ("real_diff_minus", TermC.num_str @{thm real_diff_minus}),
   29.46            (*"a - b = a + -1 * b"*)
   29.47 @@ -688,9 +688,9 @@
   29.48  	      scr = Rule.EmptyScr};
   29.49  
   29.50  val expand_poly_ = 
   29.51 -  Rule.Rls{id = "expand_poly_", preconds = [], 
   29.52 +  Rule_Set.Rls{id = "expand_poly_", preconds = [], 
   29.53        rew_ord = ("dummy_ord", Rule.dummy_ord),
   29.54 -      erls = Rule.e_rls,srls = Rule.Erls,
   29.55 +      erls = Rule_Set.e_rls,srls = Rule_Set.Erls,
   29.56        calc = [], errpatts = [],
   29.57        rules =
   29.58          [Rule.Thm ("real_plus_binom_pow4", TermC.num_str @{thm real_plus_binom_pow4}),
   29.59 @@ -722,12 +722,12 @@
   29.60  	       ], scr = Rule.EmptyScr};
   29.61  
   29.62  val expand_poly_rat_ = 
   29.63 -  Rule.Rls{id = "expand_poly_rat_", preconds = [], 
   29.64 +  Rule_Set.Rls{id = "expand_poly_rat_", preconds = [], 
   29.65        rew_ord = ("dummy_ord", Rule.dummy_ord),
   29.66 -      erls =  Rule.append_rls "Rule.e_rls-is_polyexp" Rule.e_rls
   29.67 +      erls =  Rule_Set.append_rls "Rule_Set.e_rls-is_polyexp" Rule_Set.e_rls
   29.68  	        [Rule.Num_Calc ("Poly.is'_polyexp", eval_is_polyexp "")
   29.69  		 ],
   29.70 -      srls = Rule.Erls,
   29.71 +      srls = Rule_Set.Erls,
   29.72        calc = [], errpatts = [],
   29.73        rules = 
   29.74          [Rule.Thm ("real_plus_binom_pow4_poly", TermC.num_str @{thm real_plus_binom_pow4_poly}),
   29.75 @@ -760,9 +760,9 @@
   29.76  	 ], scr = Rule.EmptyScr};
   29.77  
   29.78  val simplify_power_ = 
   29.79 -  Rule.Rls{id = "simplify_power_", preconds = [], 
   29.80 +  Rule_Set.Rls{id = "simplify_power_", preconds = [], 
   29.81        rew_ord = ("dummy_ord", Rule.dummy_ord),
   29.82 -      erls = Rule.e_rls, srls = Rule.Erls,
   29.83 +      erls = Rule_Set.e_rls, srls = Rule_Set.Erls,
   29.84        calc = [], errpatts = [],
   29.85        rules = [(*MG: Reihenfolge der folgenden 2 Rule.Thm muss so bleiben, wegen
   29.86  		a*(a*a) --> a*a^^^2 und nicht a*(a*a) --> a^^^2*a *)
   29.87 @@ -795,9 +795,9 @@
   29.88  	       ], scr = Rule.EmptyScr};
   29.89  
   29.90  val calc_add_mult_pow_ = 
   29.91 -  Rule.Rls{id = "calc_add_mult_pow_", preconds = [], 
   29.92 +  Rule_Set.Rls{id = "calc_add_mult_pow_", preconds = [], 
   29.93        rew_ord = ("dummy_ord", Rule.dummy_ord),
   29.94 -      erls = Atools_erls(*erls3.4.03*),srls = Rule.Erls,
   29.95 +      erls = Atools_erls(*erls3.4.03*),srls = Rule_Set.Erls,
   29.96        calc = [("PLUS"  , ("Groups.plus_class.plus", (**)eval_binop "#add_")), 
   29.97  	      ("TIMES" , ("Groups.times_class.times", (**)eval_binop "#mult_")),
   29.98  	      ("POWER", ("Prog_Expr.pow", (**)eval_binop "#power_"))
   29.99 @@ -809,9 +809,9 @@
  29.100  	       ], scr = Rule.EmptyScr};
  29.101  
  29.102  val reduce_012_mult_ = 
  29.103 -  Rule.Rls{id = "reduce_012_mult_", preconds = [], 
  29.104 +  Rule_Set.Rls{id = "reduce_012_mult_", preconds = [], 
  29.105        rew_ord = ("dummy_ord", Rule.dummy_ord),
  29.106 -      erls = Rule.e_rls,srls = Rule.Erls,
  29.107 +      erls = Rule_Set.e_rls,srls = Rule_Set.Erls,
  29.108        calc = [], errpatts = [],
  29.109        rules = [(* MG: folgende Rule.Thm müssen hier stehen bleiben: *)
  29.110                 Rule.Thm ("mult_1_right",TermC.num_str @{thm mult_1_right}),
  29.111 @@ -825,9 +825,9 @@
  29.112  	       ], scr = Rule.EmptyScr};
  29.113  
  29.114  val collect_numerals_ = 
  29.115 -  Rule.Rls{id = "collect_numerals_", preconds = [], 
  29.116 +  Rule_Set.Rls{id = "collect_numerals_", preconds = [], 
  29.117        rew_ord = ("dummy_ord", Rule.dummy_ord),
  29.118 -      erls = Atools_erls, srls = Rule.Erls,
  29.119 +      erls = Atools_erls, srls = Rule_Set.Erls,
  29.120        calc = [("PLUS"  , ("Groups.plus_class.plus", (**)eval_binop "#add_"))
  29.121  	      ], errpatts = [],
  29.122        rules = 
  29.123 @@ -852,9 +852,9 @@
  29.124  	], scr = Rule.EmptyScr};
  29.125  
  29.126  val reduce_012_ = 
  29.127 -  Rule.Rls{id = "reduce_012_", preconds = [], 
  29.128 +  Rule_Set.Rls{id = "reduce_012_", preconds = [], 
  29.129        rew_ord = ("dummy_ord", Rule.dummy_ord),
  29.130 -      erls = Rule.e_rls,srls = Rule.Erls, calc = [], errpatts = [],
  29.131 +      erls = Rule_Set.e_rls,srls = Rule_Set.Erls, calc = [], errpatts = [],
  29.132        rules = [Rule.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),                 
  29.133  	       (*"1 * z = z"*)
  29.134  	       Rule.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),        
  29.135 @@ -873,7 +873,7 @@
  29.136  	       ], scr = Rule.EmptyScr};
  29.137  
  29.138  val discard_parentheses1 = 
  29.139 -    Rule.append_rls "discard_parentheses1" Rule.e_rls 
  29.140 +    Rule_Set.append_rls "discard_parentheses1" Rule_Set.e_rls 
  29.141  	       [Rule.Thm ("sym_mult_assoc",
  29.142                        TermC.num_str (@{thm mult.assoc} RS @{thm sym}))
  29.143  		(*"?z1.1 * (?z2.1 * ?z3.1) = ?z1.1 * ?z2.1 * ?z3.1"*)
  29.144 @@ -883,9 +883,9 @@
  29.145  		 ];
  29.146  
  29.147  val expand_poly =
  29.148 -  Rule.Rls{id = "expand_poly", preconds = [], 
  29.149 +  Rule_Set.Rls{id = "expand_poly", preconds = [], 
  29.150        rew_ord = ("dummy_ord", Rule.dummy_ord),
  29.151 -      erls = Rule.e_rls,srls = Rule.Erls,
  29.152 +      erls = Rule_Set.e_rls,srls = Rule_Set.Erls,
  29.153        calc = [], errpatts = [],
  29.154        (*asm_thm = [],*)
  29.155        rules = [Rule.Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),
  29.156 @@ -922,9 +922,9 @@
  29.157  	       ], scr = Rule.EmptyScr};
  29.158  
  29.159  val simplify_power = 
  29.160 -  Rule.Rls{id = "simplify_power", preconds = [], 
  29.161 +  Rule_Set.Rls{id = "simplify_power", preconds = [], 
  29.162        rew_ord = ("dummy_ord", Rule.dummy_ord),
  29.163 -      erls = Rule.e_rls, srls = Rule.Erls,
  29.164 +      erls = Rule_Set.e_rls, srls = Rule_Set.Erls,
  29.165        calc = [], errpatts = [],
  29.166        rules = [Rule.Thm ("realpow_multI", TermC.num_str @{thm realpow_multI}),
  29.167  	       (*"(r * s) ^^^ n = r ^^^ n * s ^^^ n"*)
  29.168 @@ -946,9 +946,9 @@
  29.169  	       ], scr = Rule.EmptyScr};
  29.170  
  29.171  val collect_numerals = 
  29.172 -  Rule.Rls{id = "collect_numerals", preconds = [], 
  29.173 +  Rule_Set.Rls{id = "collect_numerals", preconds = [], 
  29.174        rew_ord = ("dummy_ord", Rule.dummy_ord),
  29.175 -      erls = Atools_erls(*erls3.4.03*),srls = Rule.Erls,
  29.176 +      erls = Atools_erls(*erls3.4.03*),srls = Rule_Set.Erls,
  29.177        calc = [("PLUS"  , ("Groups.plus_class.plus", (**)eval_binop "#add_")), 
  29.178  	      ("TIMES" , ("Groups.times_class.times", (**)eval_binop "#mult_")),
  29.179  	      ("POWER", ("Prog_Expr.pow", (**)eval_binop "#power_"))
  29.180 @@ -967,9 +967,9 @@
  29.181  	       Rule.Num_Calc ("Prog_Expr.pow", (**)eval_binop "#power_")
  29.182  	       ], scr = Rule.EmptyScr};
  29.183  val reduce_012 = 
  29.184 -  Rule.Rls{id = "reduce_012", preconds = [], 
  29.185 +  Rule_Set.Rls{id = "reduce_012", preconds = [], 
  29.186        rew_ord = ("dummy_ord", Rule.dummy_ord),
  29.187 -      erls = Rule.e_rls,srls = Rule.Erls,
  29.188 +      erls = Rule_Set.e_rls,srls = Rule_Set.Erls,
  29.189        calc = [], errpatts = [],
  29.190        rules = [Rule.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),                 
  29.191  	       (*"1 * z = z"*)
  29.192 @@ -995,7 +995,7 @@
  29.193  	       ], scr = Rule.EmptyScr};
  29.194  
  29.195  val discard_parentheses = 
  29.196 -    Rule.append_rls "discard_parentheses" Rule.e_rls 
  29.197 +    Rule_Set.append_rls "discard_parentheses" Rule_Set.e_rls 
  29.198  	       [Rule.Thm ("sym_mult_assoc",
  29.199                        TermC.num_str (@{thm mult.assoc} RS @{thm sym})),
  29.200  		Rule.Thm ("sym_add_assoc",
  29.201 @@ -1007,9 +1007,9 @@
  29.202  (*MG.0401: termorders for multivariate polys dropped due to principal problems:
  29.203    (total-degree-)ordering of monoms NOT possible with size_of_term GIVEN*)
  29.204  val order_add_mult = 
  29.205 -  Rule.Rls{id = "order_add_mult", preconds = [], 
  29.206 +  Rule_Set.Rls{id = "order_add_mult", preconds = [], 
  29.207        rew_ord = ("ord_make_polynomial",ord_make_polynomial false thy),
  29.208 -      erls = Rule.e_rls,srls = Rule.Erls,
  29.209 +      erls = Rule_Set.e_rls,srls = Rule_Set.Erls,
  29.210        calc = [], errpatts = [],
  29.211        rules = [Rule.Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
  29.212  	       (* z * w = w * z *)
  29.213 @@ -1027,9 +1027,9 @@
  29.214  (*MG.0401: termorders for multivariate polys dropped due to principal problems:
  29.215    (total-degree-)ordering of monoms NOT possible with size_of_term GIVEN*)
  29.216  val order_mult = 
  29.217 -  Rule.Rls{id = "order_mult", preconds = [], 
  29.218 +  Rule_Set.Rls{id = "order_mult", preconds = [], 
  29.219        rew_ord = ("ord_make_polynomial",ord_make_polynomial false thy),
  29.220 -      erls = Rule.e_rls,srls = Rule.Erls,
  29.221 +      erls = Rule_Set.e_rls,srls = Rule_Set.Erls,
  29.222        calc = [], errpatts = [],
  29.223        rules = [Rule.Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
  29.224  	       (* z * w = w * z *)
  29.225 @@ -1042,21 +1042,21 @@
  29.226  ML \<open>
  29.227  fun attach_form (_: Rule.rule list list) (_: term) (_: term) = (*still missing*)
  29.228      []:(Rule.rule * (term * term list)) list;
  29.229 -fun init_state (_: term) = Rule.e_rrlsstate;
  29.230 +fun init_state (_: term) = Rule_Set.e_rrlsstate;
  29.231  fun locate_rule (_: Rule.rule list list) (_: term) (_: Rule.rule) =
  29.232      ([]:(Rule.rule * (term * term list)) list);
  29.233  fun next_rule (_: Rule.rule list list) (_: term) = (NONE: Rule.rule option);
  29.234  fun normal_form t = SOME (sort_variables t, []: term list);
  29.235  
  29.236  val order_mult_ =
  29.237 -    Rule.Rrls {id = "order_mult_", 
  29.238 +    Rule_Set.Rrls {id = "order_mult_", 
  29.239  	  prepat = 
  29.240            (* ?p matched with the current term gives an environment,
  29.241               which evaluates (the instantiated) "?p is_multUnordered" to true *)
  29.242  	  [([TermC.parse_patt thy "?p is_multUnordered"], 
  29.243               TermC.parse_patt thy "?p :: real")],
  29.244  	  rew_ord = ("dummy_ord", Rule.dummy_ord),
  29.245 -	  erls = Rule.append_rls "Rule.e_rls-is_multUnordered" Rule.e_rls
  29.246 +	  erls = Rule_Set.append_rls "Rule_Set.e_rls-is_multUnordered" Rule_Set.e_rls
  29.247  			    [Rule.Num_Calc ("Poly.is'_multUnordered", 
  29.248                                      eval_is_multUnordered "")],
  29.249  	  calc = [("PLUS"  , ("Groups.plus_class.plus", (**)eval_binop "#add_")),
  29.250 @@ -1070,9 +1070,9 @@
  29.251  		     next_rule   = next_rule,
  29.252  		     attach_form = attach_form}};
  29.253  val order_mult_rls_ = 
  29.254 -  Rule.Rls {id = "order_mult_rls_", preconds = [], 
  29.255 +  Rule_Set.Rls {id = "order_mult_rls_", preconds = [], 
  29.256        rew_ord = ("dummy_ord", Rule.dummy_ord),
  29.257 -      erls = Rule.e_rls,srls = Rule.Erls,
  29.258 +      erls = Rule_Set.e_rls,srls = Rule_Set.Erls,
  29.259        calc = [], errpatts = [],
  29.260        rules = [Rule.Rls_ order_mult_
  29.261  	       ], scr = Rule.EmptyScr};
  29.262 @@ -1081,22 +1081,22 @@
  29.263  
  29.264  fun attach_form (_: Rule.rule list list) (_: term) (_: term) = (*still missing*)
  29.265      []: (Rule.rule * (term * term list)) list;
  29.266 -fun init_state (_: term) = Rule.e_rrlsstate;
  29.267 +fun init_state (_: term) = Rule_Set.e_rrlsstate;
  29.268  fun locate_rule (_: Rule.rule list list) (_: term) (_: Rule.rule) =
  29.269      ([]: (Rule.rule * (term * term list)) list);
  29.270  fun next_rule (_: Rule.rule list list) (_: term) = (NONE: Rule.rule option);
  29.271  fun normal_form t = SOME (sort_monoms t,[]: term list);
  29.272  \<close> ML \<open>
  29.273  val order_add_ =
  29.274 -    Rule.Rrls {id = "order_add_", 
  29.275 +    Rule_Set.Rrls {id = "order_add_", 
  29.276  	  prepat = (*WN.18.6.03 Preconditions und Pattern,
  29.277 -		    die beide passen muessen, damit das Rule.Rrls angewandt wird*)
  29.278 +		    die beide passen muessen, damit das Rule_Set.Rrls angewandt wird*)
  29.279  	  [([TermC.parse_patt @{theory} "?p is_addUnordered"], 
  29.280  	     TermC.parse_patt @{theory} "?p :: real" 
  29.281  	    (*WN.18.6.03 also KEIN pattern, dieses erzeugt nur das Environment 
  29.282  	      fuer die Evaluation der Precondition "p is_addUnordered"*))],
  29.283  	  rew_ord = ("dummy_ord", Rule.dummy_ord),
  29.284 -	  erls = Rule.append_rls "Rule.e_rls-is_addUnordered" Rule.e_rls(*MG: poly_erls*)
  29.285 +	  erls = Rule_Set.append_rls "Rule_Set.e_rls-is_addUnordered" Rule_Set.e_rls(*MG: poly_erls*)
  29.286  			    [Rule.Num_Calc ("Poly.is'_addUnordered", eval_is_addUnordered "")],
  29.287  	  calc = [("PLUS"  ,("Groups.plus_class.plus", (**)eval_binop "#add_")),
  29.288  		  ("TIMES" ,("Groups.times_class.times", (**)eval_binop "#mult_")),
  29.289 @@ -1110,9 +1110,9 @@
  29.290  		     attach_form = attach_form}};
  29.291  
  29.292  val order_add_rls_ =
  29.293 -  Rule.Rls {id = "order_add_rls_", preconds = [], 
  29.294 +  Rule_Set.Rls {id = "order_add_rls_", preconds = [], 
  29.295        rew_ord = ("dummy_ord", Rule.dummy_ord),
  29.296 -      erls = Rule.e_rls,srls = Rule.Erls,
  29.297 +      erls = Rule_Set.e_rls,srls = Rule_Set.Erls,
  29.298        calc = [], errpatts = [],
  29.299        rules = [Rule.Rls_ order_add_
  29.300  	       ], scr = Rule.EmptyScr};
  29.301 @@ -1130,9 +1130,9 @@
  29.302  (*. see MG-DA.p.52ff .*)
  29.303  val make_polynomial(*MG.03, overwrites version from above, 
  29.304      previously 'make_polynomial_'*) =
  29.305 -  Rule.Seq {id = "make_polynomial", preconds = []:term list, 
  29.306 +  Rule_Set.Seq {id = "make_polynomial", preconds = []:term list, 
  29.307        rew_ord = ("dummy_ord", Rule.dummy_ord),
  29.308 -      erls = Atools_erls, srls = Rule.Erls,calc = [], errpatts = [],
  29.309 +      erls = Atools_erls, srls = Rule_Set.Erls,calc = [], errpatts = [],
  29.310        rules = [Rule.Rls_ discard_minus,
  29.311  	       Rule.Rls_ expand_poly_,
  29.312  	       Rule.Num_Calc ("Groups.times_class.times", (**)eval_binop "#mult_"),
  29.313 @@ -1150,9 +1150,9 @@
  29.314  \<close>
  29.315  ML \<open>
  29.316  val norm_Poly(*=make_polynomial*) = 
  29.317 -  Rule.Seq {id = "norm_Poly", preconds = []:term list, 
  29.318 +  Rule_Set.Seq {id = "norm_Poly", preconds = []:term list, 
  29.319        rew_ord = ("dummy_ord", Rule.dummy_ord),
  29.320 -      erls = Atools_erls, srls = Rule.Erls, calc = [], errpatts = [],
  29.321 +      erls = Atools_erls, srls = Rule_Set.Erls, calc = [], errpatts = [],
  29.322        rules = [Rule.Rls_ discard_minus,
  29.323  	       Rule.Rls_ expand_poly_,
  29.324  	       Rule.Num_Calc ("Groups.times_class.times", (**)eval_binop "#mult_"),
  29.325 @@ -1173,9 +1173,9 @@
  29.326     and expand_poly_rat_ instead of expand_poly_, see MG-DA.p.56ff*)
  29.327  (* MG necessary  for termination of norm_Rational(*_mg*) in Rational.ML*)
  29.328  val make_rat_poly_with_parentheses =
  29.329 -  Rule.Seq{id = "make_rat_poly_with_parentheses", preconds = []:term list, 
  29.330 +  Rule_Set.Seq{id = "make_rat_poly_with_parentheses", preconds = []:term list, 
  29.331        rew_ord = ("dummy_ord", Rule.dummy_ord),
  29.332 -      erls = Atools_erls, srls = Rule.Erls, calc = [], errpatts = [],
  29.333 +      erls = Atools_erls, srls = Rule_Set.Erls, calc = [], errpatts = [],
  29.334        rules = [Rule.Rls_ discard_minus,
  29.335  	       Rule.Rls_ expand_poly_rat_,(*ignors rationals*)
  29.336  	       Rule.Num_Calc ("Groups.times_class.times", (**)eval_binop "#mult_"),
  29.337 @@ -1195,8 +1195,8 @@
  29.338  (*.a minimal ruleset for reverse rewriting of factions [2];
  29.339     compare expand_binoms.*)
  29.340  val rev_rew_p = 
  29.341 -Rule.Seq{id = "rev_rew_p", preconds = [], rew_ord = ("termlessI",termlessI),
  29.342 -    erls = Atools_erls, srls = Rule.Erls,
  29.343 +Rule_Set.Seq{id = "rev_rew_p", preconds = [], rew_ord = ("termlessI",termlessI),
  29.344 +    erls = Atools_erls, srls = Rule_Set.Erls,
  29.345      calc = [(*("PLUS"  , ("Groups.plus_class.plus", (**)eval_binop "#add_")), 
  29.346  	    ("TIMES" , ("Groups.times_class.times", (**)eval_binop "#mult_")),
  29.347  	    ("POWER", ("Prog_Expr.pow", (**)eval_binop "#power_"))*)
  29.348 @@ -1297,8 +1297,8 @@
  29.349    term)"
  29.350  ML \<open>
  29.351  val expand_binoms = 
  29.352 -  Rule.Rls{id = "expand_binoms", preconds = [], rew_ord = ("termlessI",termlessI),
  29.353 -      erls = Atools_erls, srls = Rule.Erls,
  29.354 +  Rule_Set.Rls{id = "expand_binoms", preconds = [], rew_ord = ("termlessI",termlessI),
  29.355 +      erls = Atools_erls, srls = Rule_Set.Erls,
  29.356        calc = [("PLUS"  , ("Groups.plus_class.plus", (**)eval_binop "#add_")), 
  29.357  	      ("TIMES" , ("Groups.times_class.times", (**)eval_binop "#mult_")),
  29.358  	      ("POWER", ("Prog_Expr.pow", (**)eval_binop "#power_"))
  29.359 @@ -1439,7 +1439,7 @@
  29.360          [("#Given" ,["Term t_t"]),
  29.361            ("#Where" ,["t_t is_polyexp"]),
  29.362            ("#Find"  ,["normalform n_n"])],
  29.363 -        Rule.append_rls "e_rls" Rule.e_rls [(*for preds in where_*)
  29.364 +        Rule_Set.append_rls "e_rls" Rule_Set.e_rls [(*for preds in where_*)
  29.365  			  Rule.Num_Calc ("Poly.is'_polyexp", eval_is_polyexp "")], 
  29.366          SOME "Simplify t_t", 
  29.367          [["simplification","for_polynomials"]]))]\<close>
  29.368 @@ -1455,11 +1455,11 @@
  29.369  	      [("#Given" ,["Term t_t"]),
  29.370  	        ("#Where" ,["t_t is_polyexp"]),
  29.371  	        ("#Find"  ,["normalform n_n"])],
  29.372 -	      {rew_ord'="tless_true", rls' = Rule.e_rls, calc = [], srls = Rule.e_rls, 
  29.373 -	        prls = Rule.append_rls "simplification_for_polynomials_prls" Rule.e_rls 
  29.374 +	      {rew_ord'="tless_true", rls' = Rule_Set.e_rls, calc = [], srls = Rule_Set.e_rls, 
  29.375 +	        prls = Rule_Set.append_rls "simplification_for_polynomials_prls" Rule_Set.e_rls 
  29.376  				    [(*for preds in where_*)
  29.377  				      Rule.Num_Calc ("Poly.is'_polyexp", eval_is_polyexp"")],
  29.378 -				  crls = Rule.e_rls, errpats = [], nrls = norm_Poly},
  29.379 +				  crls = Rule_Set.e_rls, errpats = [], nrls = norm_Poly},
  29.380          @{thm simplify.simps})]
  29.381  \<close>
  29.382  ML \<open>
    30.1 --- a/src/Tools/isac/Knowledge/PolyEq.thy	Wed Apr 01 19:20:05 2020 +0200
    30.2 +++ b/src/Tools/isac/Knowledge/PolyEq.thy	Sat Apr 04 12:11:32 2020 +0200
    30.3 @@ -323,7 +323,7 @@
    30.4  
    30.5  (*-------------------------rulse-------------------------*)
    30.6  val PolyEq_prls = (*3.10.02:just the following order due to subterm evaluation*)
    30.7 -  Rule.append_rls "PolyEq_prls" Rule.e_rls 
    30.8 +  Rule_Set.append_rls "PolyEq_prls" Rule_Set.e_rls 
    30.9  	     [Rule.Num_Calc ("Prog_Expr.ident", Prog_Expr.eval_ident "#ident_"),
   30.10  	      Rule.Num_Calc ("Prog_Expr.matches", Prog_Expr.eval_matches ""),
   30.11  	      Rule.Num_Calc ("Prog_Expr.lhs", Prog_Expr.eval_lhs ""),
   30.12 @@ -346,8 +346,8 @@
   30.13  	       ];
   30.14  
   30.15  val PolyEq_erls = 
   30.16 -    Rule.merge_rls "PolyEq_erls" LinEq_erls
   30.17 -    (Rule.append_rls "ops_preds" calculate_Rational
   30.18 +    Rule_Set.merge_rls "PolyEq_erls" LinEq_erls
   30.19 +    (Rule_Set.append_rls "ops_preds" calculate_Rational
   30.20  		[Rule.Num_Calc ("HOL.eq", Prog_Expr.eval_equal "#equal_"),
   30.21  		 Rule.Thm ("plus_leq", TermC.num_str @{thm plus_leq}),
   30.22  		 Rule.Thm ("minus_leq", TermC.num_str @{thm minus_leq}),
   30.23 @@ -357,8 +357,8 @@
   30.24  		 ]);
   30.25  
   30.26  val PolyEq_crls = 
   30.27 -    Rule.merge_rls "PolyEq_crls" LinEq_crls
   30.28 -    (Rule.append_rls "ops_preds" calculate_Rational
   30.29 +    Rule_Set.merge_rls "PolyEq_crls" LinEq_crls
   30.30 +    (Rule_Set.append_rls "ops_preds" calculate_Rational
   30.31  		[Rule.Num_Calc ("HOL.eq", Prog_Expr.eval_equal "#equal_"),
   30.32  		 Rule.Thm ("plus_leq", TermC.num_str @{thm plus_leq}),
   30.33  		 Rule.Thm ("minus_leq", TermC.num_str @{thm minus_leq}),
   30.34 @@ -368,9 +368,9 @@
   30.35  		 ]);
   30.36  
   30.37  val cancel_leading_coeff = prep_rls'(
   30.38 -  Rule.Rls {id = "cancel_leading_coeff", preconds = [], 
   30.39 +  Rule_Set.Rls {id = "cancel_leading_coeff", preconds = [], 
   30.40         rew_ord = ("e_rew_ord",Rule.e_rew_ord),
   30.41 -      erls = PolyEq_erls, srls = Rule.Erls, calc = [], errpatts = [],
   30.42 +      erls = PolyEq_erls, srls = Rule_Set.Erls, calc = [], errpatts = [],
   30.43        rules = 
   30.44        [Rule.Thm ("cancel_leading_coeff1",TermC.num_str @{thm cancel_leading_coeff1}),
   30.45         Rule.Thm ("cancel_leading_coeff2",TermC.num_str @{thm cancel_leading_coeff2}),
   30.46 @@ -391,9 +391,9 @@
   30.47  \<close>
   30.48  ML\<open>
   30.49  val complete_square = prep_rls'(
   30.50 -  Rule.Rls {id = "complete_square", preconds = [], 
   30.51 +  Rule_Set.Rls {id = "complete_square", preconds = [], 
   30.52         rew_ord = ("e_rew_ord",Rule.e_rew_ord),
   30.53 -      erls = PolyEq_erls, srls = Rule.Erls, calc = [],  errpatts = [],
   30.54 +      erls = PolyEq_erls, srls = Rule_Set.Erls, calc = [],  errpatts = [],
   30.55        rules = [Rule.Thm ("complete_square1",TermC.num_str @{thm complete_square1}),
   30.56  	       Rule.Thm ("complete_square2",TermC.num_str @{thm complete_square2}),
   30.57  	       Rule.Thm ("complete_square3",TermC.num_str @{thm complete_square3}),
   30.58 @@ -404,10 +404,10 @@
   30.59        });
   30.60  
   30.61  val polyeq_simplify = prep_rls'(
   30.62 -  Rule.Rls {id = "polyeq_simplify", preconds = [], 
   30.63 +  Rule_Set.Rls {id = "polyeq_simplify", preconds = [], 
   30.64         rew_ord = ("termlessI",termlessI), 
   30.65         erls = PolyEq_erls, 
   30.66 -       srls = Rule.Erls, 
   30.67 +       srls = Rule_Set.Erls, 
   30.68         calc = [], errpatts = [],
   30.69         rules = [Rule.Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1}),
   30.70  		Rule.Thm  ("real_assoc_2",TermC.num_str @{thm real_assoc_2}),
   30.71 @@ -436,10 +436,10 @@
   30.72  (* -- d0 -- *)
   30.73  (*isolate the bound variable in an d0 equation; 'bdv' is a meta-constant*)
   30.74  val d0_polyeq_simplify = prep_rls'(
   30.75 -  Rule.Rls {id = "d0_polyeq_simplify", preconds = [],
   30.76 +  Rule_Set.Rls {id = "d0_polyeq_simplify", preconds = [],
   30.77         rew_ord = ("e_rew_ord",Rule.e_rew_ord),
   30.78         erls = PolyEq_erls,
   30.79 -       srls = Rule.Erls, 
   30.80 +       srls = Rule_Set.Erls, 
   30.81         calc = [], errpatts = [],
   30.82         rules = [Rule.Thm("d0_true",TermC.num_str @{thm d0_true}),
   30.83  		Rule.Thm("d0_false",TermC.num_str @{thm  d0_false})
   30.84 @@ -450,10 +450,10 @@
   30.85  (* -- d1 -- *)
   30.86  (*isolate the bound variable in an d1 equation; 'bdv' is a meta-constant*)
   30.87  val d1_polyeq_simplify = prep_rls'(
   30.88 -  Rule.Rls {id = "d1_polyeq_simplify", preconds = [],
   30.89 +  Rule_Set.Rls {id = "d1_polyeq_simplify", preconds = [],
   30.90         rew_ord = ("e_rew_ord",Rule.e_rew_ord),
   30.91         erls = PolyEq_erls,
   30.92 -       srls = Rule.Erls, 
   30.93 +       srls = Rule_Set.Erls, 
   30.94         calc = [], errpatts = [],
   30.95         rules = [
   30.96  		Rule.Thm("d1_isolate_add1",TermC.num_str @{thm d1_isolate_add1}), 
   30.97 @@ -472,8 +472,8 @@
   30.98  (* isolate the bound variable in an d2 equation with bdv only;
   30.99    "bdv" is a meta-constant substituted for the "x" below by isac's rewriter. *)
  30.100  val d2_polyeq_bdv_only_simplify = prep_rls'(
  30.101 -  Rule.Rls {id = "d2_polyeq_bdv_only_simplify", preconds = [], rew_ord = ("e_rew_ord",Rule.e_rew_ord),
  30.102 -    erls = PolyEq_erls, srls = Rule.Erls, calc = [], errpatts = [],
  30.103 +  Rule_Set.Rls {id = "d2_polyeq_bdv_only_simplify", preconds = [], rew_ord = ("e_rew_ord",Rule.e_rew_ord),
  30.104 +    erls = PolyEq_erls, srls = Rule_Set.Erls, calc = [], errpatts = [],
  30.105      rules =
  30.106        [Rule.Thm ("d2_prescind1", TermC.num_str @{thm d2_prescind1}), (*   ax+bx^2=0 -> x(a+bx)=0 *)
  30.107         Rule.Thm ("d2_prescind2", TermC.num_str @{thm d2_prescind2}), (*   ax+ x^2=0 -> x(a+ x)=0 *)
  30.108 @@ -493,10 +493,10 @@
  30.109  (* isolate the bound variable in an d2 equation with sqrt only; 
  30.110     'bdv' is a meta-constant*)
  30.111  val d2_polyeq_sq_only_simplify = prep_rls'(
  30.112 -  Rule.Rls {id = "d2_polyeq_sq_only_simplify", preconds = [],
  30.113 +  Rule_Set.Rls {id = "d2_polyeq_sq_only_simplify", preconds = [],
  30.114         rew_ord = ("e_rew_ord",Rule.e_rew_ord),
  30.115         erls = PolyEq_erls,
  30.116 -       srls = Rule.Erls, 
  30.117 +       srls = Rule_Set.Erls, 
  30.118         calc = [], errpatts = [],
  30.119         (*asm_thm = [("d2_sqrt_equation1",""),("d2_sqrt_equation1_neg",""),
  30.120                    ("d2_isolate_div","")],*)
  30.121 @@ -520,9 +520,9 @@
  30.122  (* isolate the bound variable in an d2 equation with pqFormula;
  30.123     'bdv' is a meta-constant*)
  30.124  val d2_polyeq_pqFormula_simplify = prep_rls'(
  30.125 -  Rule.Rls {id = "d2_polyeq_pqFormula_simplify", preconds = [],
  30.126 +  Rule_Set.Rls {id = "d2_polyeq_pqFormula_simplify", preconds = [],
  30.127         rew_ord = ("e_rew_ord",Rule.e_rew_ord), erls = PolyEq_erls,
  30.128 -       srls = Rule.Erls, calc = [], errpatts = [],
  30.129 +       srls = Rule_Set.Erls, calc = [], errpatts = [],
  30.130         rules = [Rule.Thm("d2_pqformula1",TermC.num_str @{thm d2_pqformula1}),
  30.131                  (* q+px+ x^2=0 *)
  30.132  		Rule.Thm("d2_pqformula1_neg",TermC.num_str @{thm d2_pqformula1_neg}),
  30.133 @@ -566,9 +566,9 @@
  30.134  (* isolate the bound variable in an d2 equation with abcFormula; 
  30.135     'bdv' is a meta-constant*)
  30.136  val d2_polyeq_abcFormula_simplify = prep_rls'(
  30.137 -  Rule.Rls {id = "d2_polyeq_abcFormula_simplify", preconds = [],
  30.138 +  Rule_Set.Rls {id = "d2_polyeq_abcFormula_simplify", preconds = [],
  30.139         rew_ord = ("e_rew_ord",Rule.e_rew_ord), erls = PolyEq_erls,
  30.140 -       srls = Rule.Erls, calc = [], errpatts = [],
  30.141 +       srls = Rule_Set.Erls, calc = [], errpatts = [],
  30.142         rules = [Rule.Thm("d2_abcformula1",TermC.num_str @{thm d2_abcformula1}),
  30.143                  (*c+bx+cx^2=0 *)
  30.144  		Rule.Thm("d2_abcformula1_neg",TermC.num_str @{thm d2_abcformula1_neg}),
  30.145 @@ -614,9 +614,9 @@
  30.146  (* isolate the bound variable in an d2 equation; 
  30.147     'bdv' is a meta-constant*)
  30.148  val d2_polyeq_simplify = prep_rls'(
  30.149 -  Rule.Rls {id = "d2_polyeq_simplify", preconds = [],
  30.150 +  Rule_Set.Rls {id = "d2_polyeq_simplify", preconds = [],
  30.151         rew_ord = ("e_rew_ord",Rule.e_rew_ord), erls = PolyEq_erls,
  30.152 -       srls = Rule.Erls, calc = [], errpatts = [],
  30.153 +       srls = Rule_Set.Erls, calc = [], errpatts = [],
  30.154         rules = [Rule.Thm("d2_pqformula1",TermC.num_str @{thm d2_pqformula1}),
  30.155                  (* p+qx+ x^2=0 *)
  30.156  		Rule.Thm("d2_pqformula1_neg",TermC.num_str @{thm d2_pqformula1_neg}),
  30.157 @@ -674,9 +674,9 @@
  30.158  (* -- d3 -- *)
  30.159  (* isolate the bound variable in an d3 equation; 'bdv' is a meta-constant *)
  30.160  val d3_polyeq_simplify = prep_rls'(
  30.161 -  Rule.Rls {id = "d3_polyeq_simplify", preconds = [],
  30.162 +  Rule_Set.Rls {id = "d3_polyeq_simplify", preconds = [],
  30.163         rew_ord = ("e_rew_ord",Rule.e_rew_ord), erls = PolyEq_erls,
  30.164 -       srls = Rule.Erls, calc = [], errpatts = [],
  30.165 +       srls = Rule_Set.Erls, calc = [], errpatts = [],
  30.166         rules = 
  30.167         [Rule.Thm("d3_reduce_equation1",TermC.num_str @{thm d3_reduce_equation1}),
  30.168  	(*a*bdv + b*bdv^^^2 + c*bdv^^^3=0) = 
  30.169 @@ -747,9 +747,9 @@
  30.170  (* -- d4 -- *)
  30.171  (*isolate the bound variable in an d4 equation; 'bdv' is a meta-constant*)
  30.172  val d4_polyeq_simplify = prep_rls'(
  30.173 -  Rule.Rls {id = "d4_polyeq_simplify", preconds = [],
  30.174 +  Rule_Set.Rls {id = "d4_polyeq_simplify", preconds = [],
  30.175         rew_ord = ("e_rew_ord",Rule.e_rew_ord), erls = PolyEq_erls,
  30.176 -       srls = Rule.Erls, calc = [], errpatts = [],
  30.177 +       srls = Rule_Set.Erls, calc = [], errpatts = [],
  30.178         rules = 
  30.179         [Rule.Thm("d4_sub_u1",TermC.num_str @{thm d4_sub_u1})  
  30.180         (* ax^4+bx^2+c=0 -> x=+-sqrt(ax^2+bx^+c) *)
  30.181 @@ -903,7 +903,7 @@
  30.182  setup \<open>KEStore_Elems.add_mets
  30.183      [Specify.prep_met thy "met_polyeq" [] Celem.e_metID
  30.184        (["PolyEq"], [],
  30.185 -        {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = Rule.e_rls, prls=Rule.e_rls,
  30.186 +        {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = Rule_Set.e_rls, prls=Rule_Set.e_rls,
  30.187            crls=PolyEq_crls, errpats = [], nrls = norm_Rational},
  30.188          @{thm refl})]
  30.189  \<close>
  30.190 @@ -927,7 +927,7 @@
  30.191          [("#Given" ,["equality e_e","solveFor v_v"]),
  30.192            ("#Where" ,["(Not((matches (?a = 0 ) e_e ))) | (Not(((lhs e_e) is_poly_in v_v)))"]),
  30.193            ("#Find"  ,["solutions v_v'i'"])],
  30.194 -        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Rule.e_rls, prls=PolyEq_prls, calc=[],
  30.195 +        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Rule_Set.e_rls, prls=PolyEq_prls, calc=[],
  30.196            crls=PolyEq_crls, errpats = [], nrls = norm_Rational},
  30.197          @{thm normalize_poly_eq.simps})]
  30.198  \<close>
  30.199 @@ -945,7 +945,7 @@
  30.200          [("#Given" ,["equality e_e","solveFor v_v"]),
  30.201            ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 0"]),
  30.202            ("#Find"  ,["solutions v_v'i'"])],
  30.203 -        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Rule.e_rls, prls=PolyEq_prls,
  30.204 +        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Rule_Set.e_rls, prls=PolyEq_prls,
  30.205            calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [],
  30.206            nrls = norm_Rational},
  30.207          @{thm solve_poly_equ.simps})]
  30.208 @@ -968,7 +968,7 @@
  30.209          [("#Given" ,["equality e_e","solveFor v_v"]),
  30.210            ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 1"]),
  30.211            ("#Find"  ,["solutions v_v'i'"])],
  30.212 -        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Rule.e_rls, prls=PolyEq_prls,
  30.213 +        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Rule_Set.e_rls, prls=PolyEq_prls,
  30.214            calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [],
  30.215            nrls = norm_Rational},
  30.216          @{thm solve_poly_eq1.simps})]
  30.217 @@ -993,7 +993,7 @@
  30.218          [("#Given" ,["equality e_e","solveFor v_v"]),
  30.219            ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 2"]),
  30.220            ("#Find"  ,["solutions v_v'i'"])],
  30.221 -        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Rule.e_rls, prls=PolyEq_prls,
  30.222 +        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Rule_Set.e_rls, prls=PolyEq_prls,
  30.223            calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [],
  30.224            nrls = norm_Rational},
  30.225          @{thm solve_poly_equ2.simps})]
  30.226 @@ -1018,7 +1018,7 @@
  30.227          [("#Given" ,["equality e_e","solveFor v_v"]),
  30.228            ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 2"]),
  30.229            ("#Find"  ,["solutions v_v'i'"])],
  30.230 -        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Rule.e_rls, prls=PolyEq_prls,
  30.231 +        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Rule_Set.e_rls, prls=PolyEq_prls,
  30.232            calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [],
  30.233            nrls = norm_Rational},
  30.234          @{thm solve_poly_equ0.simps})]
  30.235 @@ -1041,7 +1041,7 @@
  30.236          [("#Given" ,["equality e_e","solveFor v_v"]),
  30.237            ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 2"]),
  30.238            ("#Find"  ,["solutions v_v'i'"])],
  30.239 -        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Rule.e_rls, prls=PolyEq_prls,
  30.240 +        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Rule_Set.e_rls, prls=PolyEq_prls,
  30.241            calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [],
  30.242            nrls = norm_Rational},
  30.243          @{thm solve_poly_equ_sqrt.simps})]
  30.244 @@ -1064,7 +1064,7 @@
  30.245          [("#Given" ,["equality e_e","solveFor v_v"]),
  30.246            ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 2"]),
  30.247            ("#Find"  ,["solutions v_v'i'"])],
  30.248 -        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Rule.e_rls, prls=PolyEq_prls,
  30.249 +        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Rule_Set.e_rls, prls=PolyEq_prls,
  30.250            calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [],
  30.251            nrls = norm_Rational},
  30.252          @{thm solve_poly_equ_pq.simps})]
  30.253 @@ -1086,7 +1086,7 @@
  30.254          [("#Given" ,["equality e_e","solveFor v_v"]),
  30.255            ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 2"]),
  30.256            ("#Find"  ,["solutions v_v'i'"])],
  30.257 -        {rew_ord'="termlessI", rls'=PolyEq_erls,srls=Rule.e_rls, prls=PolyEq_prls,
  30.258 +        {rew_ord'="termlessI", rls'=PolyEq_erls,srls=Rule_Set.e_rls, prls=PolyEq_prls,
  30.259            calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [],
  30.260            nrls = norm_Rational},
  30.261          @{thm solve_poly_equ_abc.simps})]
  30.262 @@ -1113,7 +1113,7 @@
  30.263          [("#Given" ,["equality e_e","solveFor v_v"]),
  30.264            ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 3"]),
  30.265            ("#Find"  ,["solutions v_v'i'"])],
  30.266 -        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Rule.e_rls, prls=PolyEq_prls,
  30.267 +        {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Rule_Set.e_rls, prls=PolyEq_prls,
  30.268            calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [],
  30.269            nrls = norm_Rational},
  30.270          @{thm solve_poly_equ3.simps})]
  30.271 @@ -1143,7 +1143,7 @@
  30.272          [("#Given" ,["equality e_e","solveFor v_v"]),
  30.273            ("#Where" ,["matches (?a = 0) e_e", "((lhs e_e) has_degree_in v_v) = 2"]),
  30.274            ("#Find"  ,["solutions v_v'i'"])],
  30.275 -        {rew_ord'="termlessI",rls'=PolyEq_erls,srls=Rule.e_rls,prls=PolyEq_prls,
  30.276 +        {rew_ord'="termlessI",rls'=PolyEq_erls,srls=Rule_Set.e_rls,prls=PolyEq_prls,
  30.277            calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [],
  30.278            nrls = norm_Rational},
  30.279          @{thm solve_by_completing_square.simps})]
  30.280 @@ -1232,10 +1232,10 @@
  30.281  \<close>
  30.282  ML\<open>
  30.283  val order_add_mult_in = prep_rls'(
  30.284 -  Rule.Rls{id = "order_add_mult_in", preconds = [], 
  30.285 +  Rule_Set.Rls{id = "order_add_mult_in", preconds = [], 
  30.286        rew_ord = ("ord_make_polynomial_in",
  30.287  		 ord_make_polynomial_in false @{theory "Poly"}),
  30.288 -      erls = Rule.e_rls,srls = Rule.Erls,
  30.289 +      erls = Rule_Set.e_rls,srls = Rule_Set.Erls,
  30.290        calc = [], errpatts = [],
  30.291        rules = [Rule.Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
  30.292  	       (* z * w = w * z *)
  30.293 @@ -1254,9 +1254,9 @@
  30.294  \<close>
  30.295  ML\<open>
  30.296  val collect_bdv = prep_rls'(
  30.297 -  Rule.Rls{id = "collect_bdv", preconds = [], 
  30.298 +  Rule_Set.Rls{id = "collect_bdv", preconds = [], 
  30.299        rew_ord = ("dummy_ord", Rule.dummy_ord),
  30.300 -      erls = Rule.e_rls,srls = Rule.Erls,
  30.301 +      erls = Rule_Set.e_rls,srls = Rule_Set.Erls,
  30.302        calc = [], errpatts = [],
  30.303        rules = [Rule.Thm ("bdv_collect_1",TermC.num_str @{thm bdv_collect_1}),
  30.304  	       Rule.Thm ("bdv_collect_2",TermC.num_str @{thm bdv_collect_2}),
  30.305 @@ -1289,9 +1289,9 @@
  30.306  (*.transforms an arbitrary term without roots to a polynomial [4] 
  30.307     according to knowledge/Poly.sml.*) 
  30.308  val make_polynomial_in = prep_rls'(
  30.309 -  Rule.Seq {id = "make_polynomial_in", preconds = []:term list, 
  30.310 +  Rule_Set.Seq {id = "make_polynomial_in", preconds = []:term list, 
  30.311         rew_ord = ("dummy_ord", Rule.dummy_ord),
  30.312 -      erls = Atools_erls, srls = Rule.Erls,
  30.313 +      erls = Atools_erls, srls = Rule_Set.Erls,
  30.314        calc = [], errpatts = [],
  30.315        rules = [Rule.Rls_ expand_poly,
  30.316  	       Rule.Rls_ order_add_mult_in,
  30.317 @@ -1308,7 +1308,7 @@
  30.318  \<close>
  30.319  ML\<open>
  30.320  val separate_bdvs = 
  30.321 -    Rule.append_rls "separate_bdvs"
  30.322 +    Rule_Set.append_rls "separate_bdvs"
  30.323  	       collect_bdv
  30.324  	       [Rule.Thm ("separate_bdv", TermC.num_str @{thm separate_bdv}),
  30.325  		(*"?a * ?bdv / ?b = ?a / ?b * ?bdv"*)
  30.326 @@ -1325,9 +1325,9 @@
  30.327  \<close>
  30.328  ML\<open>
  30.329  val make_ratpoly_in = prep_rls'(
  30.330 -  Rule.Seq {id = "make_ratpoly_in", preconds = []:term list, 
  30.331 +  Rule_Set.Seq {id = "make_ratpoly_in", preconds = []:term list, 
  30.332         rew_ord = ("dummy_ord", Rule.dummy_ord),
  30.333 -      erls = Atools_erls, srls = Rule.Erls,
  30.334 +      erls = Atools_erls, srls = Rule_Set.Erls,
  30.335        calc = [], errpatts = [],
  30.336        rules = [Rule.Rls_ norm_Rational,
  30.337  	       Rule.Rls_ order_add_mult_in,
    31.1 --- a/src/Tools/isac/Knowledge/PolyMinus.thy	Wed Apr 01 19:20:05 2020 +0200
    31.2 +++ b/src/Tools/isac/Knowledge/PolyMinus.thy	Sat Apr 04 12:11:32 2020 +0200
    31.3 @@ -185,14 +185,14 @@
    31.4  (** rulesets **)
    31.5  
    31.6  val erls_ordne_alphabetisch =
    31.7 -    Rule.append_rls "erls_ordne_alphabetisch" Rule.e_rls
    31.8 +    Rule_Set.append_rls "erls_ordne_alphabetisch" Rule_Set.e_rls
    31.9  	       [Rule.Num_Calc ("PolyMinus.kleiner", eval_kleiner ""),
   31.10  		Rule.Num_Calc ("PolyMinus.ist'_monom", eval_ist_monom "")
   31.11  		];
   31.12  
   31.13  val ordne_alphabetisch = 
   31.14 -  Rule.Rls{id = "ordne_alphabetisch", preconds = [], 
   31.15 -      rew_ord = ("dummy_ord", Rule.dummy_ord), srls = Rule.Erls, calc = [], errpatts = [],
   31.16 +  Rule_Set.Rls{id = "ordne_alphabetisch", preconds = [], 
   31.17 +      rew_ord = ("dummy_ord", Rule.dummy_ord), srls = Rule_Set.Erls, calc = [], errpatts = [],
   31.18        erls = erls_ordne_alphabetisch, 
   31.19        rules = [Rule.Thm ("tausche_plus",TermC.num_str @{thm tausche_plus}),
   31.20  	       (*"b kleiner a ==> (b + a) = (a + b)"*)
   31.21 @@ -213,11 +213,11 @@
   31.22  	       ], scr = Rule.EmptyScr};
   31.23  
   31.24  val fasse_zusammen = 
   31.25 -    Rule.Rls{id = "fasse_zusammen", preconds = [], 
   31.26 +    Rule_Set.Rls{id = "fasse_zusammen", preconds = [], 
   31.27  	rew_ord = ("dummy_ord", Rule.dummy_ord),
   31.28 -	erls = Rule.append_rls "erls_fasse_zusammen" Rule.e_rls 
   31.29 +	erls = Rule_Set.append_rls "erls_fasse_zusammen" Rule_Set.e_rls 
   31.30  			  [Rule.Num_Calc ("Prog_Expr.is'_const", Prog_Expr.eval_const "#is_const_")], 
   31.31 -	srls = Rule.Erls, calc = [], errpatts = [],
   31.32 +	srls = Rule_Set.Erls, calc = [], errpatts = [],
   31.33  	rules = 
   31.34  	[Rule.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), 
   31.35  	 (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*)
   31.36 @@ -279,9 +279,9 @@
   31.37  	 ], scr = Rule.EmptyScr};
   31.38      
   31.39  val verschoenere = 
   31.40 -  Rule.Rls{id = "verschoenere", preconds = [], 
   31.41 -      rew_ord = ("dummy_ord", Rule.dummy_ord), srls = Rule.Erls, calc = [], errpatts = [],
   31.42 -      erls = Rule.append_rls "erls_verschoenere" Rule.e_rls 
   31.43 +  Rule_Set.Rls{id = "verschoenere", preconds = [], 
   31.44 +      rew_ord = ("dummy_ord", Rule.dummy_ord), srls = Rule_Set.Erls, calc = [], errpatts = [],
   31.45 +      erls = Rule_Set.append_rls "erls_verschoenere" Rule_Set.e_rls 
   31.46  			[Rule.Num_Calc ("PolyMinus.kleiner", eval_kleiner "")], 
   31.47        rules = [Rule.Thm ("vorzeichen_minus_weg1",TermC.num_str @{thm vorzeichen_minus_weg1}),
   31.48  	       (*"l kleiner 0 ==> a + l * b = a - -l * b"*)
   31.49 @@ -310,8 +310,8 @@
   31.50  	       ], scr = Rule.EmptyScr} (*end verschoenere*);
   31.51  
   31.52  val klammern_aufloesen = 
   31.53 -  Rule.Rls{id = "klammern_aufloesen", preconds = [], 
   31.54 -      rew_ord = ("dummy_ord", Rule.dummy_ord), srls = Rule.Erls, calc = [], errpatts = [], erls = Rule.Erls, 
   31.55 +  Rule_Set.Rls{id = "klammern_aufloesen", preconds = [], 
   31.56 +      rew_ord = ("dummy_ord", Rule.dummy_ord), srls = Rule_Set.Erls, calc = [], errpatts = [], erls = Rule_Set.Erls, 
   31.57        rules = [Rule.Thm ("sym_add_assoc",
   31.58                       TermC.num_str (@{thm add.assoc} RS @{thm sym})),
   31.59  	       (*"a + (b + c) = (a + b) + c"*)
   31.60 @@ -324,8 +324,8 @@
   31.61  	       ], scr = Rule.EmptyScr};
   31.62  
   31.63  val klammern_ausmultiplizieren = 
   31.64 -  Rule.Rls{id = "klammern_ausmultiplizieren", preconds = [], 
   31.65 -      rew_ord = ("dummy_ord", Rule.dummy_ord), srls = Rule.Erls, calc = [], errpatts = [], erls = Rule.Erls, 
   31.66 +  Rule_Set.Rls{id = "klammern_ausmultiplizieren", preconds = [], 
   31.67 +      rew_ord = ("dummy_ord", Rule.dummy_ord), srls = Rule_Set.Erls, calc = [], errpatts = [], erls = Rule_Set.Erls, 
   31.68        rules = [Rule.Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),
   31.69  	       (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
   31.70  	       Rule.Thm ("distrib_left",TermC.num_str @{thm distrib_left}),
   31.71 @@ -341,9 +341,9 @@
   31.72  	       ], scr = Rule.EmptyScr};
   31.73  
   31.74  val ordne_monome = 
   31.75 -  Rule.Rls{id = "ordne_monome", preconds = [], 
   31.76 -      rew_ord = ("dummy_ord", Rule.dummy_ord), srls = Rule.Erls, calc = [], errpatts = [], 
   31.77 -      erls = Rule.append_rls "erls_ordne_monome" Rule.e_rls
   31.78 +  Rule_Set.Rls{id = "ordne_monome", preconds = [], 
   31.79 +      rew_ord = ("dummy_ord", Rule.dummy_ord), srls = Rule_Set.Erls, calc = [], errpatts = [], 
   31.80 +      erls = Rule_Set.append_rls "erls_ordne_monome" Rule_Set.e_rls
   31.81  	       [Rule.Num_Calc ("PolyMinus.kleiner", eval_kleiner ""),
   31.82  		Rule.Num_Calc ("Prog_Expr.is'_atom", Prog_Expr.eval_is_atom "")
   31.83  		], 
   31.84 @@ -362,20 +362,20 @@
   31.85  
   31.86  
   31.87  val rls_p_33 = 
   31.88 -    Rule.append_rls "rls_p_33" Rule.e_rls
   31.89 +    Rule_Set.append_rls "rls_p_33" Rule_Set.e_rls
   31.90  	       [Rule.Rls_ ordne_alphabetisch,
   31.91  		Rule.Rls_ fasse_zusammen,
   31.92  		Rule.Rls_ verschoenere
   31.93  		];
   31.94  val rls_p_34 = 
   31.95 -    Rule.append_rls "rls_p_34" Rule.e_rls
   31.96 +    Rule_Set.append_rls "rls_p_34" Rule_Set.e_rls
   31.97  	       [Rule.Rls_ klammern_aufloesen,
   31.98  		Rule.Rls_ ordne_alphabetisch,
   31.99  		Rule.Rls_ fasse_zusammen,
  31.100  		Rule.Rls_ verschoenere
  31.101  		];
  31.102  val rechnen = 
  31.103 -    Rule.append_rls "rechnen" Rule.e_rls
  31.104 +    Rule_Set.append_rls "rechnen" Rule_Set.e_rls
  31.105  	       [Rule.Num_Calc ("Groups.times_class.times", (**)eval_binop "#mult_"),
  31.106  		Rule.Num_Calc ("Groups.plus_class.plus", (**)eval_binop "#add_"),
  31.107  		Rule.Num_Calc ("Groups.minus_class.minus", (**)eval_binop "#subtr_")
  31.108 @@ -393,7 +393,7 @@
  31.109  (** problems **)
  31.110  setup \<open>KEStore_Elems.add_pbts
  31.111    [(Specify.prep_pbt thy "pbl_vereinf_poly" [] Celem.e_pblID
  31.112 -      (["polynom","vereinfachen"], [], Rule.Erls, NONE, [])),
  31.113 +      (["polynom","vereinfachen"], [], Rule_Set.Erls, NONE, [])),
  31.114      (Specify.prep_pbt thy "pbl_vereinf_poly_minus" [] Celem.e_pblID
  31.115        (["plus_minus","polynom","vereinfachen"],
  31.116          [("#Given", ["Term t_t"]),
  31.117 @@ -407,7 +407,7 @@
  31.118              "     matchsub ((?b + ?c) * ?a) t_t | " ^
  31.119              "     matchsub ((?b - ?c) * ?a) t_t )"]),
  31.120            ("#Find", ["normalform n_n"])],
  31.121 -        Rule.append_rls "prls_pbl_vereinf_poly" Rule.e_rls 
  31.122 +        Rule_Set.append_rls "prls_pbl_vereinf_poly" Rule_Set.e_rls 
  31.123  	        [Rule.Num_Calc ("Poly.is'_polyexp", eval_is_polyexp ""),
  31.124  	          Rule.Num_Calc ("Prog_Expr.matchsub", Prog_Expr.eval_matchsub ""),
  31.125  	          Rule.Thm ("or_true", TermC.num_str @{thm or_true}),
  31.126 @@ -428,7 +428,7 @@
  31.127              "     matchsub ((?b + ?c) * ?a) t_t | " ^
  31.128              "     matchsub ((?b - ?c) * ?a) t_t )"]),
  31.129            ("#Find"  ,["normalform n_n"])],
  31.130 -        Rule.append_rls "prls_pbl_vereinf_poly_klammer" Rule.e_rls
  31.131 +        Rule_Set.append_rls "prls_pbl_vereinf_poly_klammer" Rule_Set.e_rls
  31.132            [Rule.Num_Calc ("Poly.is'_polyexp", eval_is_polyexp ""),
  31.133  	           Rule.Num_Calc ("Prog_Expr.matchsub", Prog_Expr.eval_matchsub ""),
  31.134               Rule.Thm ("or_true", TermC.num_str @{thm or_true}),
  31.135 @@ -446,17 +446,17 @@
  31.136          [("#Given", ["Term t_t"]),
  31.137            ("#Where", ["t_t is_polyexp"]),
  31.138            ("#Find", ["normalform n_n"])],
  31.139 -        Rule.append_rls "e_rls" Rule.e_rls [(*for preds in where_*)
  31.140 +        Rule_Set.append_rls "e_rls" Rule_Set.e_rls [(*for preds in where_*)
  31.141  			      Rule.Num_Calc ("Poly.is'_polyexp", eval_is_polyexp "")], 
  31.142          SOME "Vereinfache t_t", 
  31.143          [["simplification","for_polynomials","with_parentheses_mult"]])),
  31.144 -    (Specify.prep_pbt thy "pbl_probe" [] Celem.e_pblID (["probe"], [], Rule.Erls, NONE, [])),
  31.145 +    (Specify.prep_pbt thy "pbl_probe" [] Celem.e_pblID (["probe"], [], Rule_Set.Erls, NONE, [])),
  31.146      (Specify.prep_pbt thy "pbl_probe_poly" [] Celem.e_pblID
  31.147        (["polynom","probe"],
  31.148          [("#Given", ["Pruefe e_e", "mitWert w_w"]),
  31.149            ("#Where", ["e_e is_polyexp"]),
  31.150            ("#Find", ["Geprueft p_p"])],
  31.151 -        Rule.append_rls "prls_pbl_probe_poly" Rule.e_rls [(*for preds in where_*)
  31.152 +        Rule_Set.append_rls "prls_pbl_probe_poly" Rule_Set.e_rls [(*for preds in where_*)
  31.153  		      Rule.Num_Calc ("Poly.is'_polyexp", eval_is_polyexp "")], 
  31.154          SOME "Probe e_e w_w", 
  31.155          [["probe","fuer_polynom"]])),
  31.156 @@ -465,7 +465,7 @@
  31.157          [("#Given" ,["Pruefe e_e", "mitWert w_w"]),
  31.158            ("#Where" ,["e_e is_ratpolyexp"]),
  31.159            ("#Find"  ,["Geprueft p_p"])],
  31.160 -        Rule.append_rls "prls_pbl_probe_bruch" Rule.e_rls [(*for preds in where_*)
  31.161 +        Rule_Set.append_rls "prls_pbl_probe_bruch" Rule_Set.e_rls [(*for preds in where_*)
  31.162  		      Rule.Num_Calc ("Rational.is'_ratpolyexp", eval_is_ratpolyexp "")], 
  31.163          SOME "Probe e_e w_w", [["probe","fuer_bruch"]]))]\<close>
  31.164  
  31.165 @@ -489,8 +489,8 @@
  31.166  	            "     matchsub (?a - (?b + ?c)) t_t | " ^
  31.167  	            "     matchsub (?a + (?b - ?c)) t_t )"]),
  31.168  	        ("#Find"  ,["normalform n_n"])],
  31.169 -	      {rew_ord'="tless_true", rls' = Rule.e_rls, calc = [], srls = Rule.e_rls,
  31.170 -	        prls = Rule.append_rls "prls_met_simp_poly_minus" Rule.e_rls 
  31.171 +	      {rew_ord'="tless_true", rls' = Rule_Set.e_rls, calc = [], srls = Rule_Set.e_rls,
  31.172 +	        prls = Rule_Set.append_rls "prls_met_simp_poly_minus" Rule_Set.e_rls 
  31.173  				      [Rule.Num_Calc ("Poly.is'_polyexp", eval_is_polyexp ""),
  31.174  				        Rule.Num_Calc ("Prog_Expr.matchsub", Prog_Expr.eval_matchsub ""),
  31.175  				        Rule.Thm ("and_true",TermC.num_str @{thm and_true}),
  31.176 @@ -501,7 +501,7 @@
  31.177                  (*"(~ True) = False"*)
  31.178                  Rule.Thm ("not_false",TermC.num_str @{thm not_false})
  31.179                  (*"(~ False) = True"*)],
  31.180 -          crls = Rule.e_rls, errpats = [], nrls = rls_p_33},
  31.181 +          crls = Rule_Set.e_rls, errpats = [], nrls = rls_p_33},
  31.182            @{thm simplify.simps})]
  31.183  \<close>
  31.184  
  31.185 @@ -520,10 +520,10 @@
  31.186  	      [("#Given" ,["Term t_t"]),
  31.187  	        ("#Where" ,["t_t is_polyexp"]),
  31.188  	        ("#Find"  ,["normalform n_n"])],
  31.189 -	      {rew_ord'="tless_true", rls' = Rule.e_rls, calc = [], srls = Rule.e_rls, 
  31.190 -	        prls = Rule.append_rls "simplification_for_polynomials_prls" Rule.e_rls 
  31.191 +	      {rew_ord'="tless_true", rls' = Rule_Set.e_rls, calc = [], srls = Rule_Set.e_rls, 
  31.192 +	        prls = Rule_Set.append_rls "simplification_for_polynomials_prls" Rule_Set.e_rls 
  31.193  				    [(*for preds in where_*) Rule.Num_Calc("Poly.is'_polyexp", eval_is_polyexp"")],
  31.194 -				  crls = Rule.e_rls, errpats = [], nrls = rls_p_34},
  31.195 +				  crls = Rule_Set.e_rls, errpats = [], nrls = rls_p_34},
  31.196  				@{thm simplify2.simps})]
  31.197  \<close>
  31.198  
  31.199 @@ -543,17 +543,17 @@
  31.200      [Specify.prep_met thy "met_simp_poly_parenth_mult" [] Celem.e_metID
  31.201  	    (["simplification","for_polynomials","with_parentheses_mult"],
  31.202  	      [("#Given" ,["Term t_t"]), ("#Where" ,["t_t is_polyexp"]), ("#Find"  ,["normalform n_n"])],
  31.203 -	        {rew_ord'="tless_true", rls' = Rule.e_rls, calc = [], srls = Rule.e_rls, 
  31.204 -	          prls = Rule.append_rls "simplification_for_polynomials_prls" Rule.e_rls 
  31.205 +	        {rew_ord'="tless_true", rls' = Rule_Set.e_rls, calc = [], srls = Rule_Set.e_rls, 
  31.206 +	          prls = Rule_Set.append_rls "simplification_for_polynomials_prls" Rule_Set.e_rls 
  31.207  				      [(*for preds in where_*) Rule.Num_Calc("Poly.is'_polyexp", eval_is_polyexp"")],
  31.208 -				    crls = Rule.e_rls, errpats = [], nrls = rls_p_34},
  31.209 +				    crls = Rule_Set.e_rls, errpats = [], nrls = rls_p_34},
  31.210  				  @{thm simplify3.simps})]
  31.211  \<close>
  31.212  setup \<open>KEStore_Elems.add_mets
  31.213      [Specify.prep_met thy "met_probe" [] Celem.e_metID
  31.214  	    (["probe"], [],
  31.215 -	      {rew_ord'="tless_true", rls' = Rule.e_rls, calc = [], srls = Rule.e_rls, prls = Rule.Erls, crls = Rule.e_rls,
  31.216 -	        errpats = [], nrls = Rule.Erls}, 
  31.217 +	      {rew_ord'="tless_true", rls' = Rule_Set.e_rls, calc = [], srls = Rule_Set.e_rls, prls = Rule_Set.Erls, crls = Rule_Set.e_rls,
  31.218 +	        errpats = [], nrls = Rule_Set.Erls}, 
  31.219  	      @{thm refl})]
  31.220  \<close>
  31.221  
  31.222 @@ -575,10 +575,10 @@
  31.223  	      [("#Given" ,["Pruefe e_e", "mitWert w_w"]),
  31.224  	        ("#Where" ,["e_e is_polyexp"]),
  31.225  	        ("#Find"  ,["Geprueft p_p"])],
  31.226 -	      {rew_ord'="tless_true", rls' = Rule.e_rls, calc = [], srls = Rule.e_rls, 
  31.227 -	        prls = Rule.append_rls "prls_met_probe_bruch" Rule.e_rls
  31.228 +	      {rew_ord'="tless_true", rls' = Rule_Set.e_rls, calc = [], srls = Rule_Set.e_rls, 
  31.229 +	        prls = Rule_Set.append_rls "prls_met_probe_bruch" Rule_Set.e_rls
  31.230  	            [(*for preds in where_*) Rule.Num_Calc ("Rational.is'_ratpolyexp", eval_is_ratpolyexp "")], 
  31.231 -	        crls = Rule.e_rls, errpats = [], nrls = rechnen}, 
  31.232 +	        crls = Rule_Set.e_rls, errpats = [], nrls = rechnen}, 
  31.233  	      @{thm mache_probe.simps})]
  31.234  \<close>
  31.235  setup \<open>KEStore_Elems.add_mets
  31.236 @@ -587,10 +587,10 @@
  31.237  	      [("#Given" ,["Pruefe e_e", "mitWert w_w"]),
  31.238  	        ("#Where" ,["e_e is_ratpolyexp"]),
  31.239  	        ("#Find"  ,["Geprueft p_p"])],
  31.240 -	      {rew_ord'="tless_true", rls' = Rule.e_rls, calc = [], srls = Rule.e_rls, 
  31.241 -	        prls = Rule.append_rls "prls_met_probe_bruch" Rule.e_rls
  31.242 +	      {rew_ord'="tless_true", rls' = Rule_Set.e_rls, calc = [], srls = Rule_Set.e_rls, 
  31.243 +	        prls = Rule_Set.append_rls "prls_met_probe_bruch" Rule_Set.e_rls
  31.244  	            [(*for preds in where_*) Rule.Num_Calc ("Rational.is'_ratpolyexp", eval_is_ratpolyexp "")], 
  31.245 -	        crls = Rule.e_rls, errpats = [], nrls = Rule.Erls}, 
  31.246 +	        crls = Rule_Set.e_rls, errpats = [], nrls = Rule_Set.Erls}, 
  31.247  	      @{thm refl})]
  31.248  \<close>
  31.249  
    32.1 --- a/src/Tools/isac/Knowledge/RatEq.thy	Wed Apr 01 19:20:05 2020 +0200
    32.2 +++ b/src/Tools/isac/Knowledge/RatEq.thy	Sat Apr 04 12:11:32 2020 +0200
    32.3 @@ -81,7 +81,7 @@
    32.4  subsection \<open>rule-sets\<close>
    32.5  ML \<open>
    32.6  val RatEq_prls = (*15.10.02:just the following order due to subterm evaluation*)
    32.7 -  Rule.append_rls "RatEq_prls" Rule.e_rls 
    32.8 +  Rule_Set.append_rls "RatEq_prls" Rule_Set.e_rls 
    32.9  	     [Rule.Num_Calc ("Prog_Expr.ident", Prog_Expr.eval_ident "#ident_"),
   32.10  	      Rule.Num_Calc ("Prog_Expr.matches", Prog_Expr.eval_matches ""),
   32.11  	      Rule.Num_Calc ("Prog_Expr.lhs", Prog_Expr.eval_lhs ""),
   32.12 @@ -97,11 +97,11 @@
   32.13  	      ];
   32.14  
   32.15  \<close> ML \<open>
   32.16 -(*rls = Rule.merge_rls erls Poly_erls *)
   32.17 +(*rls = Rule_Set.merge_rls erls Poly_erls *)
   32.18  val rateq_erls = 
   32.19 -  Rule.remove_rls "rateq_erls"                             (*WN: ein Hack*)
   32.20 -	  (Rule.merge_rls "is_ratequation_in" calculate_Rational
   32.21 -		  (Rule.append_rls "is_ratequation_in"
   32.22 +  Rule_Set.remove_rls "rateq_erls"                             (*WN: ein Hack*)
   32.23 +	  (Rule_Set.merge_rls "is_ratequation_in" calculate_Rational
   32.24 +		  (Rule_Set.append_rls "is_ratequation_in"
   32.25  			  Poly_erls [(*Rule.Num_Calc ("Rings.divide_class.divide", Prog_Expr.eval_cancel "#divide_e"),*)
   32.26  			    Rule.Num_Calc ("RatEq.is'_ratequation'_in", eval_is_ratequation_in "")]))
   32.27   [Rule.Thm ("and_commute",TermC.num_str @{thm and_commute}), (*WN: ein Hack*)
   32.28 @@ -109,18 +109,18 @@
   32.29  
   32.30  \<close> ML \<open>
   32.31  val RatEq_crls = 
   32.32 -  Rule.remove_rls "RatEq_crls"                              (*WN: ein Hack*)
   32.33 -	  (Rule.merge_rls "is_ratequation_in" calculate_Rational
   32.34 -		  (Rule.append_rls "is_ratequation_in"
   32.35 +  Rule_Set.remove_rls "RatEq_crls"                              (*WN: ein Hack*)
   32.36 +	  (Rule_Set.merge_rls "is_ratequation_in" calculate_Rational
   32.37 +		  (Rule_Set.append_rls "is_ratequation_in"
   32.38  			  Poly_erls [(*Rule.Num_Calc ("Rings.divide_class.divide", Prog_Expr.eval_cancel "#divide_e"),*)
   32.39  			    Rule.Num_Calc ("RatEq.is'_ratequation'_in", eval_is_ratequation_in "")]))
   32.40   [Rule.Thm ("and_commute",TermC.num_str @{thm and_commute}), (*WN: ein Hack*)
   32.41  	Rule.Thm ("or_commute",TermC.num_str @{thm or_commute})];  (*WN: ein Hack*)
   32.42  
   32.43  val RatEq_eliminate = prep_rls'(
   32.44 -  Rule.Rls
   32.45 +  Rule_Set.Rls
   32.46      {id = "RatEq_eliminate", preconds = [], rew_ord = ("termlessI", termlessI), erls = rateq_erls,
   32.47 -     srls = Rule.Erls, calc = [], errpatts = [],
   32.48 +     srls = Rule_Set.Erls, calc = [], errpatts = [],
   32.49       rules = [
   32.50  	     Rule.Thm("rat_mult_denominator_both",TermC.num_str @{thm rat_mult_denominator_both}), 
   32.51  	     (* a/b=c/d -> ad=cb *)
   32.52 @@ -133,9 +133,9 @@
   32.53  
   32.54  \<close> ML \<open>
   32.55  val RatEq_simplify = prep_rls'(
   32.56 -  Rule.Rls
   32.57 +  Rule_Set.Rls
   32.58      {id = "RatEq_simplify", preconds = [], rew_ord = ("termlessI", termlessI), erls = rateq_erls,
   32.59 -     srls = Rule.Erls, calc = [], errpatts = [],
   32.60 +     srls = Rule_Set.Erls, calc = [], errpatts = [],
   32.61       rules = [
   32.62  	     Rule.Thm("real_rat_mult_1",TermC.num_str @{thm real_rat_mult_1}),
   32.63  	     (*a*(b/c) = (a*b)/c*)
   32.64 @@ -172,7 +172,7 @@
   32.65  setup \<open>KEStore_Elems.add_mets
   32.66      [Specify.prep_met thy "met_rateq" [] Celem.e_metID
   32.67        (["RatEq"], [],
   32.68 -        {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = Rule.e_rls, prls=Rule.e_rls,
   32.69 +        {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = Rule_Set.e_rls, prls=Rule_Set.e_rls,
   32.70            crls=RatEq_crls, errpats = [], nrls = norm_Rational}, @{thm refl})]\<close>
   32.71  
   32.72  partial_function (tailrec) solve_rational_equ :: "bool \<Rightarrow> real \<Rightarrow> bool list"
   32.73 @@ -193,7 +193,7 @@
   32.74          [("#Given" ,["equality e_e","solveFor v_v"]),
   32.75            ("#Where" ,["(e_e::bool) is_ratequation_in (v_v::real)"]),
   32.76            ("#Find"  ,["solutions v_v'i'"])],
   32.77 -        {rew_ord'="termlessI", rls'=rateq_erls, srls=Rule.e_rls, prls=RatEq_prls, calc=[],
   32.78 +        {rew_ord'="termlessI", rls'=rateq_erls, srls=Rule_Set.e_rls, prls=RatEq_prls, calc=[],
   32.79            crls=RatEq_crls, errpats = [], nrls = norm_Rational},
   32.80          @{thm solve_rational_equ.simps})]
   32.81  \<close>
    33.1 --- a/src/Tools/isac/Knowledge/Rational-WN.sml	Wed Apr 01 19:20:05 2020 +0200
    33.2 +++ b/src/Tools/isac/Knowledge/Rational-WN.sml	Sat Apr 04 12:11:32 2020 +0200
    33.3 @@ -185,8 +185,8 @@
    33.4  "***************************************************************************";
    33.5  fun rewrite_set_' thy rls put_asm ruless ct =
    33.6      case ruless of
    33.7 -	Rule.Rrls _ => error "rewrite_set_' not for Rule.Rrls"
    33.8 -      | Rule.Rls _ =>
    33.9 +	Rule_Set.Rrls _ => error "rewrite_set_' not for Rule_Set.Rrls"
   33.10 +      | Rule_Set.Rls _ =>
   33.11    let
   33.12      datatype switch = Appl | Noap;
   33.13      fun rew_once ruls asm ct Noap [] = (ct,asm)
   33.14 @@ -194,7 +194,7 @@
   33.15        | rew_once ruls asm ct apno (rul::thms) =
   33.16        case rul of
   33.17  	Rule.Thm (thmid, thm) =>
   33.18 -	  (case rewrite_ thy ((snd o #rew_ord o Rule.rep_rls) ruless) 
   33.19 +	  (case rewrite_ thy ((snd o #rew_ord o Rule_Set.rep_rls) ruless) 
   33.20  	     rls put_asm (Celem.thm_of_thm rul) ct of
   33.21  	     NONE => rew_once ruls asm ct apno thms
   33.22  	   | SOME (ct',asm') => 
   33.23 @@ -205,14 +205,14 @@
   33.24  	   | SOME (thmid, thm') => 
   33.25  	       let 
   33.26  		 val pairopt = 
   33.27 -		   rewrite_ thy ((snd o #rew_ord o Rule.rep_rls) ruless) 
   33.28 +		   rewrite_ thy ((snd o #rew_ord o Rule_Set.rep_rls) ruless) 
   33.29  		   rls put_asm thm' ct;
   33.30  		 val _ = if pairopt <> NONE then () 
   33.31  			 else error("rewrite_set_, rewrite_ \""^
   33.32  			 (string_of_thmI thm')^"\" \""^
   33.33  			 (Syntax.string_of_term (Rule.thy2ctxt thy) ct)^"\" = NONE")
   33.34  	       in rew_once ruls asm ((fst o the) pairopt) Appl(rul::thms) end);
   33.35 -    val ruls = (#rules o Rule.rep_rls) ruless;
   33.36 +    val ruls = (#rules o Rule_Set.rep_rls) ruless;
   33.37      val (ct',asm') = rew_once ruls [] ct Noap ruls;
   33.38    in if ct = ct' then NONE else SOME (ct',asm') end;
   33.39  
   33.40 @@ -221,8 +221,8 @@
   33.41  *)
   33.42  fun rewrite_set_' thy rls put_asm ruless ct =
   33.43      case ruless of
   33.44 -	Rule.Rrls _ => error "rewrite_set_' not for Rule.Rrls"
   33.45 -      | Rule.Rls _ =>
   33.46 +	Rule_Set.Rrls _ => error "rewrite_set_' not for Rule_Set.Rrls"
   33.47 +      | Rule_Set.Rls _ =>
   33.48    let
   33.49      datatype switch = Appl | Noap;
   33.50      fun rew_once ruls asm ct Noap [] = (ct,asm)
   33.51 @@ -230,7 +230,7 @@
   33.52        | rew_once ruls asm ct apno (rul::thms) =
   33.53        case rul of
   33.54  	Rule.Thm (thmid, thm) =>
   33.55 -	  (case rewrite_ thy ((snd o #rew_ord o Rule.rep_rls) ruless) 
   33.56 +	  (case rewrite_ thy ((snd o #rew_ord o Rule_Set.rep_rls) ruless) 
   33.57  	     rls put_asm (Celem.thm_of_thm rul) ct of
   33.58  	     NONE => rew_once ruls asm ct apno thms
   33.59  	   | SOME (ct',asm') => 
   33.60 @@ -241,14 +241,14 @@
   33.61  	   | SOME (thmid, thm') => 
   33.62  	       let 
   33.63  		 val pairopt = 
   33.64 -		   rewrite_ thy ((snd o #rew_ord o Rule.rep_rls) ruless) 
   33.65 +		   rewrite_ thy ((snd o #rew_ord o Rule_Set.rep_rls) ruless) 
   33.66  		   rls put_asm thm' ct;
   33.67  		 val _ = if pairopt <> NONE then () 
   33.68  			 else error("rewrite_set_, rewrite_ \""^
   33.69  			 (string_of_thmI thm')^"\" \""^
   33.70  			 (Syntax.string_of_term (Rule.thy2ctxt thy) ct)^"\" = NONE")
   33.71  	       in rew_once ruls asm ((fst o the) pairopt) Appl(rul::thms) end);
   33.72 -    val ruls = (#rules o Rule.rep_rls) ruless;
   33.73 +    val ruls = (#rules o Rule_Set.rep_rls) ruless;
   33.74      val (ct',asm') = rew_once ruls [] ct Noap ruls;
   33.75    in if ct = ct' then NONE else SOME (ct',asm') end;
   33.76  
    34.1 --- a/src/Tools/isac/Knowledge/Rational.thy	Wed Apr 01 19:20:05 2020 +0200
    34.2 +++ b/src/Tools/isac/Knowledge/Rational.thy	Sat Apr 04 12:11:32 2020 +0200
    34.3 @@ -391,8 +391,8 @@
    34.4  (* evaluates conditions in calculate_Rational *)
    34.5  val calc_rat_erls =
    34.6    prep_rls'
    34.7 -    (Rule.Rls {id = "calc_rat_erls", preconds = [], rew_ord = ("dummy_ord", Rule.dummy_ord), 
    34.8 -      erls = Rule.e_rls, srls = Rule.Erls, calc = [], errpatts = [],
    34.9 +    (Rule_Set.Rls {id = "calc_rat_erls", preconds = [], rew_ord = ("dummy_ord", Rule.dummy_ord), 
   34.10 +      erls = Rule_Set.e_rls, srls = Rule_Set.Erls, calc = [], errpatts = [],
   34.11        rules = 
   34.12          [Rule.Num_Calc ("HOL.eq", Prog_Expr.eval_equal "#equal_"),
   34.13          Rule.Num_Calc ("Prog_Expr.is'_const", Prog_Expr.eval_const "#is_const_"),
   34.14 @@ -404,9 +404,9 @@
   34.15     does NOT rearrange the term by AC-rewriting; thus terms with variables 
   34.16     need to have constants to be commuted together respectively           *)
   34.17  val calculate_Rational =
   34.18 -  prep_rls' (Rule.merge_rls "calculate_Rational"
   34.19 -    (Rule.Rls {id = "divide", preconds = [], rew_ord = ("dummy_ord", Rule.dummy_ord), 
   34.20 -      erls = calc_rat_erls, srls = Rule.Erls,
   34.21 +  prep_rls' (Rule_Set.merge_rls "calculate_Rational"
   34.22 +    (Rule_Set.Rls {id = "divide", preconds = [], rew_ord = ("dummy_ord", Rule.dummy_ord), 
   34.23 +      erls = calc_rat_erls, srls = Rule_Set.Erls,
   34.24        calc = [], errpatts = [],
   34.25        rules = 
   34.26          [Rule.Num_Calc ("Rings.divide_class.divide", Prog_Expr.eval_cancel "#divide_e"),
   34.27 @@ -462,8 +462,8 @@
   34.28    [("is_expanded", ("Rational.is'_expanded", eval_is_expanded ""))]\<close>
   34.29  ML \<open>
   34.30  val rational_erls = 
   34.31 -  Rule.merge_rls "rational_erls" calculate_Rational 
   34.32 -    (Rule.append_rls "is_expanded" Atools_erls 
   34.33 +  Rule_Set.merge_rls "rational_erls" calculate_Rational 
   34.34 +    (Rule_Set.append_rls "is_expanded" Atools_erls 
   34.35        [Rule.Num_Calc ("Rational.is'_expanded", eval_is_expanded "")]);
   34.36  \<close>
   34.37  
   34.38 @@ -471,7 +471,7 @@
   34.39  ML \<open>
   34.40  (**)local (* cancel_p *)
   34.41  
   34.42 -val {rules = rules, rew_ord = (_, ro), ...} = Rule.rep_rls (assoc_rls' @{theory} "rev_rew_p");
   34.43 +val {rules = rules, rew_ord = (_, ro), ...} = Rule_Set.rep_rls (assoc_rls' @{theory} "rev_rew_p");
   34.44  
   34.45  fun init_state thy eval_rls ro t =
   34.46    let
   34.47 @@ -509,7 +509,7 @@
   34.48  in
   34.49  
   34.50  val cancel_p = 
   34.51 -  Rule.Rrls {id = "cancel_p", prepat = [],
   34.52 +  Rule_Set.Rrls {id = "cancel_p", prepat = [],
   34.53  	rew_ord=("ord_make_polynomial", ord_make_polynomial false thy),
   34.54  	erls = rational_erls, 
   34.55  	calc = 
   34.56 @@ -531,8 +531,8 @@
   34.57  ML \<open>
   34.58  (** )local ( * add_fractions_p *)
   34.59  
   34.60 -(*val {rules = rules, rew_ord = (_, ro), ...} = Rule.rep_rls (assoc_rls "make_polynomial");*)
   34.61 -val {rules, rew_ord=(_,ro),...} = Rule.rep_rls (assoc_rls' @{theory} "rev_rew_p");
   34.62 +(*val {rules = rules, rew_ord = (_, ro), ...} = Rule_Set.rep_rls (assoc_rls "make_polynomial");*)
   34.63 +val {rules, rew_ord=(_,ro),...} = Rule_Set.rep_rls (assoc_rls' @{theory} "rev_rew_p");
   34.64  
   34.65  fun init_state thy eval_rls ro t =
   34.66    let 
   34.67 @@ -578,7 +578,7 @@
   34.68  (** )in( **)
   34.69  
   34.70  val add_fractions_p =
   34.71 -  Rule.Rrls {id = "add_fractions_p", prepat=prepat,
   34.72 +  Rule_Set.Rrls {id = "add_fractions_p", prepat=prepat,
   34.73      rew_ord = ("ord_make_polynomial", ord_make_polynomial false thy),
   34.74      erls = rational_erls,
   34.75      calc = [("PLUS", ("Groups.plus_class.plus", (**)eval_binop "#add_")),
   34.76 @@ -603,8 +603,8 @@
   34.77  ML \<open>
   34.78  (*erls for calculate_Rational; make local with FIXX@ME result:term *term list*)
   34.79  val powers_erls = prep_rls'(
   34.80 -  Rule.Rls {id = "powers_erls", preconds = [], rew_ord = ("dummy_ord",Rule.dummy_ord), 
   34.81 -      erls = Rule.e_rls, srls = Rule.Erls, calc = [], errpatts = [],
   34.82 +  Rule_Set.Rls {id = "powers_erls", preconds = [], rew_ord = ("dummy_ord",Rule.dummy_ord), 
   34.83 +      erls = Rule_Set.e_rls, srls = Rule_Set.Erls, calc = [], errpatts = [],
   34.84        rules = [Rule.Num_Calc ("Prog_Expr.is'_atom", Prog_Expr.eval_is_atom "#is_atom_"),
   34.85  	       Rule.Num_Calc ("Prog_Expr.is'_even", Prog_Expr.eval_is_even "#is_even_"),
   34.86  	       Rule.Num_Calc ("Orderings.ord_class.less", Prog_Expr.eval_equ "#less_"),
   34.87 @@ -617,8 +617,8 @@
   34.88  (*.all powers over + distributed; atoms over * collected, other distributed
   34.89     contains absolute minimum of thms for context in norm_Rational .*)
   34.90  val powers = prep_rls'(
   34.91 -  Rule.Rls {id = "powers", preconds = [], rew_ord = ("dummy_ord",Rule.dummy_ord), 
   34.92 -      erls = powers_erls, srls = Rule.Erls, calc = [], errpatts = [],
   34.93 +  Rule_Set.Rls {id = "powers", preconds = [], rew_ord = ("dummy_ord",Rule.dummy_ord), 
   34.94 +      erls = powers_erls, srls = Rule_Set.Erls, calc = [], errpatts = [],
   34.95        rules = [Rule.Thm ("realpow_multI", TermC.num_str @{thm realpow_multI}),
   34.96  	       (*"(r * s) ^^^ n = r ^^^ n * s ^^^ n"*)
   34.97  	       Rule.Thm ("realpow_pow",TermC.num_str @{thm realpow_pow}),
   34.98 @@ -649,9 +649,9 @@
   34.99        });
  34.100  (*.contains absolute minimum of thms for context in norm_Rational.*)
  34.101  val rat_mult_divide = prep_rls'(
  34.102 -  Rule.Rls {id = "rat_mult_divide", preconds = [], 
  34.103 +  Rule_Set.Rls {id = "rat_mult_divide", preconds = [], 
  34.104        rew_ord = ("dummy_ord", Rule.dummy_ord), 
  34.105 -      erls = Rule.e_rls, srls = Rule.Erls, calc = [], errpatts = [],
  34.106 +      erls = Rule_Set.e_rls, srls = Rule_Set.Erls, calc = [], errpatts = [],
  34.107        rules = [Rule.Thm ("rat_mult",TermC.num_str @{thm rat_mult}),
  34.108  	       (*(1)"?a / ?b * (?c / ?d) = ?a * ?c / (?b * ?d)"*)
  34.109  	       Rule.Thm ("times_divide_eq_right",TermC.num_str @{thm times_divide_eq_right}),
  34.110 @@ -674,8 +674,8 @@
  34.111  
  34.112  (*.contains absolute minimum of thms for context in norm_Rational.*)
  34.113  val reduce_0_1_2 = prep_rls'(
  34.114 -  Rule.Rls{id = "reduce_0_1_2", preconds = [], rew_ord = ("dummy_ord", Rule.dummy_ord),
  34.115 -      erls = Rule.e_rls, srls = Rule.Erls, calc = [], errpatts = [],
  34.116 +  Rule_Set.Rls{id = "reduce_0_1_2", preconds = [], rew_ord = ("dummy_ord", Rule.dummy_ord),
  34.117 +      erls = Rule_Set.e_rls, srls = Rule_Set.Erls, calc = [], errpatts = [],
  34.118        rules = [(*Rule.Thm ("divide_1",TermC.num_str @{thm divide_1}),
  34.119  		 "?x / 1 = ?x" unnecess.for normalform*)
  34.120  	       Rule.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),                 
  34.121 @@ -705,8 +705,8 @@
  34.122  (*erls for calculate_Rational; 
  34.123    make local with FIXX@ME result:term *term list WN0609???SKMG*)
  34.124  val norm_rat_erls = prep_rls'(
  34.125 -  Rule.Rls {id = "norm_rat_erls", preconds = [], rew_ord = ("dummy_ord",Rule.dummy_ord), 
  34.126 -      erls = Rule.e_rls, srls = Rule.Erls, calc = [], errpatts = [],
  34.127 +  Rule_Set.Rls {id = "norm_rat_erls", preconds = [], rew_ord = ("dummy_ord",Rule.dummy_ord), 
  34.128 +      erls = Rule_Set.e_rls, srls = Rule_Set.Erls, calc = [], errpatts = [],
  34.129        rules = [Rule.Num_Calc ("Prog_Expr.is'_const", Prog_Expr.eval_const "#is_const_")
  34.130  	       ], scr = Rule.EmptyScr});
  34.131  
  34.132 @@ -714,8 +714,8 @@
  34.133  (*040209: this version has been used by RL for his equations,
  34.134  which is now replaced by MGs version "norm_Rational" below *)
  34.135  val norm_Rational_min = prep_rls'(
  34.136 -  Rule.Rls {id = "norm_Rational_min", preconds = [], rew_ord = ("dummy_ord",Rule.dummy_ord), 
  34.137 -      erls = norm_rat_erls, srls = Rule.Erls, calc = [], errpatts = [],
  34.138 +  Rule_Set.Rls {id = "norm_Rational_min", preconds = [], rew_ord = ("dummy_ord",Rule.dummy_ord), 
  34.139 +      erls = norm_rat_erls, srls = Rule_Set.Erls, calc = [], errpatts = [],
  34.140        rules = [(*sequence given by operator precedence*)
  34.141  	       Rule.Rls_ discard_minus,
  34.142  	       Rule.Rls_ powers,
  34.143 @@ -730,9 +730,9 @@
  34.144        scr = Rule.EmptyScr});
  34.145  
  34.146  val norm_Rational_parenthesized = prep_rls'(
  34.147 -  Rule.Seq {id = "norm_Rational_parenthesized", preconds = []:term list, 
  34.148 +  Rule_Set.Seq {id = "norm_Rational_parenthesized", preconds = []:term list, 
  34.149         rew_ord = ("dummy_ord", Rule.dummy_ord),
  34.150 -      erls = Atools_erls, srls = Rule.Erls,
  34.151 +      erls = Atools_erls, srls = Rule_Set.Erls,
  34.152        calc = [], errpatts = [],
  34.153        rules = [Rule.Rls_  norm_Rational_min,
  34.154  	       Rule.Rls_ discard_parentheses
  34.155 @@ -741,8 +741,8 @@
  34.156  
  34.157  (*WN030318???SK: simplifies all but cancel and common_nominator*)
  34.158  val simplify_rational = 
  34.159 -    Rule.merge_rls "simplify_rational" expand_binoms
  34.160 -    (Rule.append_rls "divide" calculate_Rational
  34.161 +    Rule_Set.merge_rls "simplify_rational" expand_binoms
  34.162 +    (Rule_Set.append_rls "divide" calculate_Rational
  34.163  		[Rule.Thm ("div_by_1",TermC.num_str @{thm div_by_1}),
  34.164  		 (*"?x / 1 = ?x"*)
  34.165  		 Rule.Thm ("rat_mult",TermC.num_str @{thm rat_mult}),
  34.166 @@ -762,25 +762,25 @@
  34.167  \<close>
  34.168  ML \<open>
  34.169  val add_fractions_p_rls = prep_rls'(
  34.170 -  Rule.Rls {id = "add_fractions_p_rls", preconds = [], rew_ord = ("dummy_ord", Rule.dummy_ord), 
  34.171 -	  erls = Rule.e_rls, srls = Rule.Erls, calc = [], errpatts = [],
  34.172 +  Rule_Set.Rls {id = "add_fractions_p_rls", preconds = [], rew_ord = ("dummy_ord", Rule.dummy_ord), 
  34.173 +	  erls = Rule_Set.e_rls, srls = Rule_Set.Erls, calc = [], errpatts = [],
  34.174  	  rules = [Rule.Rls_ add_fractions_p], 
  34.175  	  scr = Rule.EmptyScr});
  34.176  
  34.177 -(* "Rule.Rls" causes repeated application of cancel_p to one and the same term *)
  34.178 +(* "Rule_Set.Rls" causes repeated application of cancel_p to one and the same term *)
  34.179  val cancel_p_rls = prep_rls'(
  34.180 -  Rule.Rls 
  34.181 +  Rule_Set.Rls 
  34.182      {id = "cancel_p_rls", preconds = [], rew_ord = ("dummy_ord", Rule.dummy_ord), 
  34.183 -    erls = Rule.e_rls, srls = Rule.Erls, calc = [], errpatts = [],
  34.184 +    erls = Rule_Set.e_rls, srls = Rule_Set.Erls, calc = [], errpatts = [],
  34.185      rules = [Rule.Rls_ cancel_p], 
  34.186  	  scr = Rule.EmptyScr});
  34.187  
  34.188  (*. makes 'normal' fractions; 'is_polyexp' inhibits double fractions;
  34.189      used in initial part norm_Rational_mg, see example DA-M02-main.p.60.*)
  34.190  val rat_mult_poly = prep_rls'(
  34.191 -  Rule.Rls {id = "rat_mult_poly", preconds = [], rew_ord = ("dummy_ord", Rule.dummy_ord), 
  34.192 -	  erls = Rule.append_rls "Rule.e_rls-is_polyexp" Rule.e_rls [Rule.Num_Calc ("Poly.is'_polyexp", eval_is_polyexp "")], 
  34.193 -	  srls = Rule.Erls, calc = [], errpatts = [],
  34.194 +  Rule_Set.Rls {id = "rat_mult_poly", preconds = [], rew_ord = ("dummy_ord", Rule.dummy_ord), 
  34.195 +	  erls = Rule_Set.append_rls "Rule_Set.e_rls-is_polyexp" Rule_Set.e_rls [Rule.Num_Calc ("Poly.is'_polyexp", eval_is_polyexp "")], 
  34.196 +	  srls = Rule_Set.Erls, calc = [], errpatts = [],
  34.197  	  rules = 
  34.198  	    [Rule.Thm ("rat_mult_poly_l",TermC.num_str @{thm rat_mult_poly_l}),
  34.199  	    (*"?c is_polyexp ==> ?c * (?a / ?b) = ?c * ?a / ?b"*)
  34.200 @@ -790,12 +790,12 @@
  34.201  
  34.202  (*. makes 'normal' fractions; 'is_polyexp' inhibits double fractions;
  34.203      used in looping part norm_Rational_rls, see example DA-M02-main.p.60 
  34.204 -    .. WHERE THE LATTER DOES ALWAYS WORK, BECAUSE erls = Rule.e_rls, 
  34.205 +    .. WHERE THE LATTER DOES ALWAYS WORK, BECAUSE erls = Rule_Set.e_rls, 
  34.206      I.E. THE RESPECTIVE ASSUMPTION IS STORED AND Rule.Thm APPLIED; WN051028 
  34.207      ... WN0609???MG.*)
  34.208  val rat_mult_div_pow = prep_rls'(
  34.209 -  Rule.Rls {id = "rat_mult_div_pow", preconds = [], rew_ord = ("dummy_ord",Rule.dummy_ord), 
  34.210 -    erls = Rule.e_rls, srls = Rule.Erls, calc = [], errpatts = [],
  34.211 +  Rule_Set.Rls {id = "rat_mult_div_pow", preconds = [], rew_ord = ("dummy_ord",Rule.dummy_ord), 
  34.212 +    erls = Rule_Set.e_rls, srls = Rule_Set.Erls, calc = [], errpatts = [],
  34.213      rules = [Rule.Thm ("rat_mult", TermC.num_str @{thm rat_mult}),
  34.214        (*"?a / ?b * (?c / ?d) = ?a * ?c / (?b * ?d)"*)
  34.215        Rule.Thm ("rat_mult_poly_l", TermC.num_str @{thm rat_mult_poly_l}),
  34.216 @@ -817,8 +817,8 @@
  34.217      scr = Rule.EmptyScr});
  34.218  
  34.219  val rat_reduce_1 = prep_rls'(
  34.220 -  Rule.Rls {id = "rat_reduce_1", preconds = [], rew_ord = ("dummy_ord", Rule.dummy_ord), 
  34.221 -    erls = Rule.e_rls, srls = Rule.Erls, calc = [], errpatts = [], 
  34.222 +  Rule_Set.Rls {id = "rat_reduce_1", preconds = [], rew_ord = ("dummy_ord", Rule.dummy_ord), 
  34.223 +    erls = Rule_Set.e_rls, srls = Rule_Set.Erls, calc = [], errpatts = [], 
  34.224      rules = 
  34.225        [Rule.Thm ("div_by_1", TermC.num_str @{thm div_by_1}),
  34.226        (*"?x / 1 = ?x"*)
  34.227 @@ -829,8 +829,8 @@
  34.228  
  34.229  (* looping part of norm_Rational *)
  34.230  val norm_Rational_rls = prep_rls' (
  34.231 -  Rule.Rls {id = "norm_Rational_rls", preconds = [], rew_ord = ("dummy_ord",Rule.dummy_ord), 
  34.232 -    erls = norm_rat_erls, srls = Rule.Erls, calc = [], errpatts = [],
  34.233 +  Rule_Set.Rls {id = "norm_Rational_rls", preconds = [], rew_ord = ("dummy_ord",Rule.dummy_ord), 
  34.234 +    erls = norm_rat_erls, srls = Rule_Set.Erls, calc = [], errpatts = [],
  34.235      rules = [Rule.Rls_ add_fractions_p_rls,
  34.236        Rule.Rls_ rat_mult_div_pow,
  34.237        Rule.Rls_ make_rat_poly_with_parentheses,
  34.238 @@ -840,9 +840,9 @@
  34.239      scr = Rule.EmptyScr});
  34.240  
  34.241  val norm_Rational = prep_rls' (
  34.242 -  Rule.Seq 
  34.243 +  Rule_Set.Seq 
  34.244      {id = "norm_Rational", preconds = [], rew_ord = ("dummy_ord", Rule.dummy_ord), 
  34.245 -    erls = norm_rat_erls, srls = Rule.Erls, calc = [], errpatts = [],
  34.246 +    erls = norm_rat_erls, srls = Rule_Set.Erls, calc = [], errpatts = [],
  34.247      rules = [Rule.Rls_ discard_minus,
  34.248        Rule.Rls_ rat_mult_poly,             (* removes double fractions like a/b/c *)
  34.249        Rule.Rls_ make_rat_poly_with_parentheses,
  34.250 @@ -884,7 +884,7 @@
  34.251          [("#Given" ,["Term t_t"]),
  34.252            ("#Where" ,["t_t is_ratpolyexp"]),
  34.253            ("#Find"  ,["normalform n_n"])],
  34.254 -        Rule.append_rls "e_rls" Rule.e_rls [(*for preds in where_*)], 
  34.255 +        Rule_Set.append_rls "e_rls" Rule_Set.e_rls [(*for preds in where_*)], 
  34.256          SOME "Simplify t_t", [["simplification","of_rationals"]]))]\<close>
  34.257  
  34.258  section \<open>A methods for simplification of rationals\<close>
  34.259 @@ -912,10 +912,10 @@
  34.260          [("#Given" ,["Term t_t"]),
  34.261            ("#Where" ,["t_t is_ratpolyexp"]),
  34.262            ("#Find"  ,["normalform n_n"])],
  34.263 -	      {rew_ord'="tless_true", rls' = Rule.e_rls, calc = [], srls = Rule.e_rls, 
  34.264 -	        prls = Rule.append_rls "simplification_of_rationals_prls" Rule.e_rls 
  34.265 +	      {rew_ord'="tless_true", rls' = Rule_Set.e_rls, calc = [], srls = Rule_Set.e_rls, 
  34.266 +	        prls = Rule_Set.append_rls "simplification_of_rationals_prls" Rule_Set.e_rls 
  34.267  				    [(*for preds in where_*) Rule.Num_Calc ("Rational.is'_ratpolyexp", eval_is_ratpolyexp "")],
  34.268 -				  crls = Rule.e_rls, errpats = [], nrls = norm_Rational_rls},
  34.269 +				  crls = Rule_Set.e_rls, errpats = [], nrls = norm_Rational_rls},
  34.270  				  @{thm simplify.simps})]
  34.271  \<close>
  34.272  
    35.1 --- a/src/Tools/isac/Knowledge/Root.thy	Wed Apr 01 19:20:05 2020 +0200
    35.2 +++ b/src/Tools/isac/Knowledge/Root.thy	Sat Apr 04 12:11:32 2020 +0200
    35.3 @@ -162,7 +162,7 @@
    35.4  
    35.5  (*-------------------------rulse-------------------------*)
    35.6  val Root_crls = 
    35.7 -      Rule.append_rls "Root_crls" Atools_erls 
    35.8 +      Rule_Set.append_rls "Root_crls" Atools_erls 
    35.9         [Rule.Thm  ("real_unari_minus",TermC.num_str @{thm real_unari_minus}),
   35.10          Rule.Num_Calc ("NthRoot.sqrt" , eval_sqrt "#sqrt_"),
   35.11          Rule.Num_Calc ("Rings.divide_class.divide", Prog_Expr.eval_cancel "#divide_e"),
   35.12 @@ -174,7 +174,7 @@
   35.13          ];
   35.14  
   35.15  val Root_erls = 
   35.16 -      Rule.append_rls "Root_erls" Atools_erls 
   35.17 +      Rule_Set.append_rls "Root_erls" Atools_erls 
   35.18         [Rule.Thm  ("real_unari_minus",TermC.num_str @{thm real_unari_minus}),
   35.19          Rule.Num_Calc ("NthRoot.sqrt" , eval_sqrt "#sqrt_"),
   35.20          Rule.Num_Calc ("Rings.divide_class.divide", Prog_Expr.eval_cancel "#divide_e"),
   35.21 @@ -189,9 +189,9 @@
   35.22  ML \<open>
   35.23  
   35.24  val make_rooteq = prep_rls'(
   35.25 -  Rule.Rls{id = "make_rooteq", preconds = []:term list, 
   35.26 +  Rule_Set.Rls{id = "make_rooteq", preconds = []:term list, 
   35.27        rew_ord = ("sqrt_right", sqrt_right false thy),
   35.28 -      erls = Atools_erls, srls = Rule.Erls,
   35.29 +      erls = Atools_erls, srls = Rule_Set.Erls,
   35.30        calc = [], errpatts = [],
   35.31        rules = [Rule.Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}),			
   35.32  	       (*"a - b = a + (-1) * b"*)
   35.33 @@ -259,9 +259,9 @@
   35.34  val prep_rls' = Auto_Prog.prep_rls @{theory};
   35.35  
   35.36  val expand_rootbinoms = prep_rls'(
   35.37 -  Rule.Rls{id = "expand_rootbinoms", preconds = [], 
   35.38 +  Rule_Set.Rls{id = "expand_rootbinoms", preconds = [], 
   35.39        rew_ord = ("termlessI",termlessI),
   35.40 -      erls = Atools_erls, srls = Rule.Erls,
   35.41 +      erls = Atools_erls, srls = Rule_Set.Erls,
   35.42        calc = [], errpatts = [],
   35.43        rules = [Rule.Thm ("real_plus_binom_pow2"  ,TermC.num_str @{thm real_plus_binom_pow2}),     
   35.44  	       (*"(a + b) ^^^ 2 = a ^^^ 2 + 2 * a * b + b ^^^ 2"*)
    36.1 --- a/src/Tools/isac/Knowledge/RootEq.thy	Wed Apr 01 19:20:05 2020 +0200
    36.2 +++ b/src/Tools/isac/Knowledge/RootEq.thy	Sat Apr 04 12:11:32 2020 +0200
    36.3 @@ -179,7 +179,7 @@
    36.4  subsection \<open>rule-sets\<close>
    36.5  ML \<open>
    36.6  val RootEq_prls =(*15.10.02:just the following order due to subterm evaluation*)
    36.7 -  Rule.append_rls "RootEq_prls" Rule.e_rls 
    36.8 +  Rule_Set.append_rls "RootEq_prls" Rule_Set.e_rls 
    36.9  	     [Rule.Num_Calc ("Prog_Expr.ident", Prog_Expr.eval_ident "#ident_"),
   36.10  	      Rule.Num_Calc ("Prog_Expr.matches", Prog_Expr.eval_matches ""),
   36.11  	      Rule.Num_Calc ("Prog_Expr.lhs"    , Prog_Expr.eval_lhs ""),
   36.12 @@ -197,15 +197,15 @@
   36.13  	      ];
   36.14  
   36.15  val RootEq_erls =
   36.16 -  Rule.append_rls "RootEq_erls" Root_erls
   36.17 +  Rule_Set.append_rls "RootEq_erls" Root_erls
   36.18      [Rule.Thm ("divide_divide_eq_left", TermC.num_str @{thm divide_divide_eq_left})];
   36.19  
   36.20  val RootEq_crls = 
   36.21 -  Rule.append_rls "RootEq_crls" Root_crls
   36.22 +  Rule_Set.append_rls "RootEq_crls" Root_crls
   36.23      [Rule.Thm ("divide_divide_eq_left", TermC.num_str @{thm divide_divide_eq_left})];
   36.24  
   36.25  val rooteq_srls = 
   36.26 -  Rule.append_rls "rooteq_srls" Rule.e_rls
   36.27 +  Rule_Set.append_rls "rooteq_srls" Rule_Set.e_rls
   36.28      [Rule.Num_Calc ("RootEq.is'_sqrtTerm'_in", eval_is_sqrtTerm_in ""),
   36.29       Rule.Num_Calc ("RootEq.is'_normSqrtTerm'_in", eval_is_normSqrtTerm_in""),
   36.30       Rule.Num_Calc ("RootEq.is'_rootTerm'_in", eval_is_rootTerm_in "")];
   36.31 @@ -214,8 +214,8 @@
   36.32  
   36.33  (*isolate the bound variable in an sqrt equation; 'bdv' is a meta-constant*)
   36.34   val sqrt_isolate = prep_rls'(
   36.35 -  Rule.Rls {id = "sqrt_isolate", preconds = [], rew_ord = ("termlessI",termlessI), 
   36.36 -       erls = RootEq_erls, srls = Rule.Erls, calc = [], errpatts = [],
   36.37 +  Rule_Set.Rls {id = "sqrt_isolate", preconds = [], rew_ord = ("termlessI",termlessI), 
   36.38 +       erls = RootEq_erls, srls = Rule_Set.Erls, calc = [], errpatts = [],
   36.39         rules = [
   36.40         Rule.Thm("sqrt_square_1",TermC.num_str @{thm sqrt_square_1}),
   36.41                       (* (sqrt a)^^^2 -> a *)
   36.42 @@ -313,9 +313,9 @@
   36.43  \<close> ML \<open>
   36.44  (*isolate the bound variable in an sqrt left equation; 'bdv' is a meta-constant*)
   36.45   val l_sqrt_isolate = prep_rls'(
   36.46 -     Rule.Rls {id = "l_sqrt_isolate", preconds = [], 
   36.47 +     Rule_Set.Rls {id = "l_sqrt_isolate", preconds = [], 
   36.48  	  rew_ord = ("termlessI",termlessI), 
   36.49 -          erls = RootEq_erls, srls = Rule.Erls, calc = [], errpatts = [],
   36.50 +          erls = RootEq_erls, srls = Rule_Set.Erls, calc = [], errpatts = [],
   36.51       rules = [
   36.52       Rule.Thm("sqrt_square_1",TermC.num_str @{thm sqrt_square_1}),
   36.53                              (* (sqrt a)^^^2 -> a *)
   36.54 @@ -359,9 +359,9 @@
   36.55  (* -- right 28.8.02--*)
   36.56  (*isolate the bound variable in an sqrt right equation; 'bdv' is a meta-constant*)
   36.57   val r_sqrt_isolate = prep_rls'(
   36.58 -     Rule.Rls {id = "r_sqrt_isolate", preconds = [], 
   36.59 +     Rule_Set.Rls {id = "r_sqrt_isolate", preconds = [], 
   36.60  	  rew_ord = ("termlessI",termlessI), 
   36.61 -          erls = RootEq_erls, srls = Rule.Erls, calc = [], errpatts = [],
   36.62 +          erls = RootEq_erls, srls = Rule_Set.Erls, calc = [], errpatts = [],
   36.63       rules = [
   36.64       Rule.Thm("sqrt_square_1",TermC.num_str @{thm sqrt_square_1}),
   36.65                             (* (sqrt a)^^^2 -> a *)
   36.66 @@ -403,9 +403,9 @@
   36.67  
   36.68  \<close> ML \<open>
   36.69  val rooteq_simplify = prep_rls'(
   36.70 -  Rule.Rls {id = "rooteq_simplify", 
   36.71 +  Rule_Set.Rls {id = "rooteq_simplify", 
   36.72         preconds = [], rew_ord = ("termlessI",termlessI), 
   36.73 -       erls = RootEq_erls, srls = Rule.Erls, calc = [], errpatts = [],
   36.74 +       erls = RootEq_erls, srls = Rule_Set.Erls, calc = [], errpatts = [],
   36.75         (*asm_thm = [("sqrt_square_1","")],*)
   36.76         rules = [Rule.Thm  ("real_assoc_1",TermC.num_str @{thm real_assoc_1}),
   36.77                               (* a+(b+c) = a+b+c *)
   36.78 @@ -476,7 +476,7 @@
   36.79  setup \<open>KEStore_Elems.add_mets
   36.80      [Specify.prep_met thy "met_rooteq" [] Celem.e_metID
   36.81        (["RootEq"], [],
   36.82 -        {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = Rule.e_rls, prls=Rule.e_rls,
   36.83 +        {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = Rule_Set.e_rls, prls=Rule_Set.e_rls,
   36.84            crls=RootEq_crls, errpats = [], nrls = norm_Poly}, @{thm refl})]
   36.85  \<close>
   36.86      (*-- normalise 20.10.02 --*)
   36.87 @@ -503,7 +503,7 @@
   36.88                "( ((rhs e_e) is_sqrtTerm_in (v_v::real)) &" ^
   36.89                "  Not((rhs e_e) is_normSqrtTerm_in (v_v::real)))"]),
   36.90            ("#Find"  ,["solutions v_v'i'"])],
   36.91 -        {rew_ord'="termlessI", rls'=RootEq_erls, srls=Rule.e_rls, prls=RootEq_prls, calc=[],
   36.92 +        {rew_ord'="termlessI", rls'=RootEq_erls, srls=Rule_Set.e_rls, prls=RootEq_prls, calc=[],
   36.93            crls=RootEq_crls, errpats = [], nrls = norm_Poly},
   36.94          @{thm norm_sqrt_equ.simps})]
   36.95  \<close>
   36.96 @@ -565,7 +565,7 @@
   36.97          [("#Given" ,["equality e_e","solveFor v_v"]),
   36.98            ("#Where" ,["(rhs e_e) is_sqrtTerm_in v_v"]),
   36.99            ("#Find"  ,["solutions v_v'i'"])],
  36.100 -        {rew_ord' = "termlessI", rls' = RootEq_erls, srls = Rule.e_rls, prls = RootEq_prls, calc = [],
  36.101 +        {rew_ord' = "termlessI", rls' = RootEq_erls, srls = Rule_Set.e_rls, prls = RootEq_prls, calc = [],
  36.102            crls = RootEq_crls, errpats = [], nrls = norm_Poly},
  36.103          @{thm solve_sqrt_equ_right.simps})]
  36.104  \<close>
  36.105 @@ -594,7 +594,7 @@
  36.106          [("#Given" ,["equality e_e","solveFor v_v"]),
  36.107            ("#Where" ,["(lhs e_e) is_sqrtTerm_in v_v"]),
  36.108            ("#Find"  ,["solutions v_v'i'"])],
  36.109 -        {rew_ord'="termlessI", rls'=RootEq_erls, srls=Rule.e_rls, prls=RootEq_prls, calc=[],
  36.110 +        {rew_ord'="termlessI", rls'=RootEq_erls, srls=Rule_Set.e_rls, prls=RootEq_prls, calc=[],
  36.111            crls=RootEq_crls, errpats = [], nrls = norm_Poly},
  36.112          @{thm solve_sqrt_equ_left.simps})]
  36.113  \<close>
    37.1 --- a/src/Tools/isac/Knowledge/RootRat.thy	Wed Apr 01 19:20:05 2020 +0200
    37.2 +++ b/src/Tools/isac/Knowledge/RootRat.thy	Sat Apr 04 12:11:32 2020 +0200
    37.3 @@ -9,13 +9,13 @@
    37.4  val thy = @{theory};
    37.5  
    37.6  val rootrat_erls = 
    37.7 -  Rule.merge_rls "rootrat_erls" Root_erls
    37.8 -    (Rule.merge_rls "" rational_erls
    37.9 -      (Rule.append_rls "" Rule.e_rls []));
   37.10 +  Rule_Set.merge_rls "rootrat_erls" Root_erls
   37.11 +    (Rule_Set.merge_rls "" rational_erls
   37.12 +      (Rule_Set.append_rls "" Rule_Set.e_rls []));
   37.13  
   37.14  (*.calculate numeral groundterms.*)
   37.15  val calculate_RootRat = 
   37.16 -  Rule.append_rls "calculate_RootRat" calculate_Rational
   37.17 +  Rule_Set.append_rls "calculate_RootRat" calculate_Rational
   37.18  	    [Rule.Thm ("distrib_left",TermC.num_str @{thm distrib_left}),
   37.19  		      (* w*(z1.0 + z2.0) = w * z1.0 + w * z2.0 *)
   37.20  		     Rule.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),
    38.1 --- a/src/Tools/isac/Knowledge/RootRatEq.thy	Wed Apr 01 19:20:05 2020 +0200
    38.2 +++ b/src/Tools/isac/Knowledge/RootRatEq.thy	Sat Apr 04 12:11:32 2020 +0200
    38.3 @@ -70,7 +70,7 @@
    38.4  subsection \<open>rule-sets\<close>
    38.5  ML \<open>
    38.6  val RootRatEq_prls = 
    38.7 -  Rule.append_rls "RootRatEq_prls" Rule.e_rls
    38.8 +  Rule_Set.append_rls "RootRatEq_prls" Rule_Set.e_rls
    38.9  		[Rule.Num_Calc ("Prog_Expr.ident", Prog_Expr.eval_ident "#ident_"),
   38.10       Rule.Num_Calc ("Prog_Expr.matches", Prog_Expr.eval_matches ""),
   38.11       Rule.Num_Calc ("Prog_Expr.lhs", Prog_Expr.eval_lhs ""),
   38.12 @@ -86,24 +86,24 @@
   38.13       Rule.Thm ("or_false",TermC.num_str @{thm or_false})];
   38.14  
   38.15  val RooRatEq_erls = 
   38.16 -  Rule.merge_rls "RooRatEq_erls" rootrat_erls
   38.17 -    (Rule.merge_rls "" RootEq_erls
   38.18 -     (Rule.merge_rls "" rateq_erls
   38.19 -      (Rule.append_rls "" Rule.e_rls
   38.20 +  Rule_Set.merge_rls "RooRatEq_erls" rootrat_erls
   38.21 +    (Rule_Set.merge_rls "" RootEq_erls
   38.22 +     (Rule_Set.merge_rls "" rateq_erls
   38.23 +      (Rule_Set.append_rls "" Rule_Set.e_rls
   38.24  		[])));
   38.25  
   38.26  val RootRatEq_crls = 
   38.27 -  Rule.merge_rls "RootRatEq_crls" rootrat_erls
   38.28 -    (Rule.merge_rls "" RootEq_erls
   38.29 -     (Rule.merge_rls "" rateq_erls
   38.30 -      (Rule.append_rls "" Rule.e_rls
   38.31 +  Rule_Set.merge_rls "RootRatEq_crls" rootrat_erls
   38.32 +    (Rule_Set.merge_rls "" RootEq_erls
   38.33 +     (Rule_Set.merge_rls "" rateq_erls
   38.34 +      (Rule_Set.append_rls "" Rule_Set.e_rls
   38.35  		[])));
   38.36  \<close> ML \<open>
   38.37  (* Solves a rootrat Equation *)
   38.38  val rootrat_solve = prep_rls'(
   38.39 -  Rule.Rls {id = "rootrat_solve", preconds = [], 
   38.40 +  Rule_Set.Rls {id = "rootrat_solve", preconds = [], 
   38.41    rew_ord = ("termlessI",termlessI), 
   38.42 -    erls = Rule.e_rls, srls = Rule.Erls, calc = [], errpatts = [],
   38.43 +    erls = Rule_Set.e_rls, srls = Rule_Set.Erls, calc = [], errpatts = [],
   38.44      rules = 
   38.45      [Rule.Thm("rootrat_equation_left_1", TermC.num_str @{thm rootrat_equation_left_1}),   
   38.46          (* [|c is_rootTerm_in bdv|] ==> 
   38.47 @@ -141,7 +141,7 @@
   38.48  setup \<open>KEStore_Elems.add_mets
   38.49      [Specify.prep_met @{theory LinEq} "met_rootrateq" [] Celem.e_metID
   38.50        (["RootRatEq"], [],
   38.51 -        {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = Rule.e_rls, prls=Rule.e_rls,
   38.52 +        {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = Rule_Set.e_rls, prls=Rule_Set.e_rls,
   38.53            crls=Atools_erls, errpats = [], nrls = norm_Rational}, @{thm refl})]
   38.54  \<close>
   38.55      (*-- left 20.10.02 --*)
   38.56 @@ -163,7 +163,7 @@
   38.57            ("#Where" ,["( (lhs e_e) is_rootRatAddTerm_in (v_v::real) ) | " ^
   38.58                "( (rhs e_e) is_rootRatAddTerm_in (v_v::real) )"]),
   38.59            ("#Find"  ,["solutions v_v'i'"])],
   38.60 -        {rew_ord'="termlessI", rls'=RooRatEq_erls, srls=Rule.e_rls, prls=RootRatEq_prls, calc=[],
   38.61 +        {rew_ord'="termlessI", rls'=RooRatEq_erls, srls=Rule_Set.e_rls, prls=RootRatEq_prls, calc=[],
   38.62            crls=RootRatEq_crls, errpats = [], nrls = norm_Rational},
   38.63          @{thm solve_rootrat_equ.simps})]
   38.64  \<close>
    39.1 --- a/src/Tools/isac/Knowledge/Simplify.thy	Wed Apr 01 19:20:05 2020 +0200
    39.2 +++ b/src/Tools/isac/Knowledge/Simplify.thy	Sat Apr 04 12:11:32 2020 +0200
    39.3 @@ -29,12 +29,12 @@
    39.4        (["simplification"],
    39.5          [("#Given" ,["Term t_t"]),
    39.6            ("#Find"  ,["normalform n_n"])],
    39.7 -        Rule.append_rls "e_rls" Rule.e_rls [(*for preds in where_*)], SOME "Simplify t_t", [])),
    39.8 +        Rule_Set.append_rls "e_rls" Rule_Set.e_rls [(*for preds in where_*)], SOME "Simplify t_t", [])),
    39.9      (Specify.prep_pbt thy "pbl_vereinfache" [] Celem.e_pblID
   39.10        (["vereinfachen"],
   39.11          [("#Given", ["Term t_t"]),
   39.12            ("#Find", ["normalform n_n"])],
   39.13 -        Rule.append_rls "e_rls" Rule.e_rls [(*for preds in where_*)], SOME "Vereinfache t_t", []))]\<close>
   39.14 +        Rule_Set.append_rls "e_rls" Rule_Set.e_rls [(*for preds in where_*)], SOME "Vereinfache t_t", []))]\<close>
   39.15  
   39.16  (** methods **)
   39.17  setup \<open>KEStore_Elems.add_mets
   39.18 @@ -42,8 +42,8 @@
   39.19  	    (["simplification"],
   39.20  	      [("#Given" ,["Term t_t"]),
   39.21  		      ("#Find"  ,["normalform n_n"])],
   39.22 -		    {rew_ord'="tless_true", rls'= Rule.e_rls, calc = [], srls = Rule.e_rls, prls=Rule.e_rls, crls = Rule.e_rls,
   39.23 -		      errpats = [], nrls = Rule.e_rls},
   39.24 +		    {rew_ord'="tless_true", rls'= Rule_Set.e_rls, calc = [], srls = Rule_Set.e_rls, prls=Rule_Set.e_rls, crls = Rule_Set.e_rls,
   39.25 +		      errpats = [], nrls = Rule_Set.e_rls},
   39.26  	      @{thm refl})]
   39.27  \<close>
   39.28  
    40.1 --- a/src/Tools/isac/Knowledge/Test.thy	Wed Apr 01 19:20:05 2020 +0200
    40.2 +++ b/src/Tools/isac/Knowledge/Test.thy	Sat Apr 04 12:11:32 2020 +0200
    40.3 @@ -359,8 +359,8 @@
    40.4  section \<open>rulesets\<close>
    40.5  ML \<open>
    40.6  val testerls = 
    40.7 -  Rule.Rls {id = "testerls", preconds = [], rew_ord = ("termlessI",termlessI), 
    40.8 -      erls = Rule.e_rls, srls = Rule.Erls, 
    40.9 +  Rule_Set.Rls {id = "testerls", preconds = [], rew_ord = ("termlessI",termlessI), 
   40.10 +      erls = Rule_Set.e_rls, srls = Rule_Set.Erls, 
   40.11        calc = [], errpatts = [], 
   40.12        rules = [Rule.Thm ("refl",TermC.num_str @{thm refl}),
   40.13  	       Rule.Thm ("order_refl",TermC.num_str @{thm order_refl}),
   40.14 @@ -392,9 +392,9 @@
   40.15  (*.for evaluation of conditions in rewrite rules.*)
   40.16  (*FIXXXXXXME 10.8.02: handle like _simplify*)
   40.17  val tval_rls =  
   40.18 -  Rule.Rls{id = "tval_rls", preconds = [], 
   40.19 +  Rule_Set.Rls{id = "tval_rls", preconds = [], 
   40.20        rew_ord = ("sqrt_right",sqrt_right false @{theory "Pure"}), 
   40.21 -      erls=testerls,srls = Rule.e_rls, 
   40.22 +      erls=testerls,srls = Rule_Set.e_rls, 
   40.23        calc=[], errpatts = [],
   40.24        rules = [Rule.Thm ("refl",TermC.num_str @{thm refl}),
   40.25  	       Rule.Thm ("order_refl",TermC.num_str @{thm order_refl}),
   40.26 @@ -438,9 +438,9 @@
   40.27  ML \<open>
   40.28  (*make () dissappear*)   
   40.29  val rearrange_assoc =
   40.30 -  Rule.Rls{id = "rearrange_assoc", preconds = [], 
   40.31 +  Rule_Set.Rls{id = "rearrange_assoc", preconds = [], 
   40.32        rew_ord = ("e_rew_ord",Rule.e_rew_ord), 
   40.33 -      erls = Rule.e_rls, srls = Rule.e_rls, calc = [], errpatts = [],
   40.34 +      erls = Rule_Set.e_rls, srls = Rule_Set.e_rls, calc = [], errpatts = [],
   40.35        rules = 
   40.36        [Rule.Thm ("sym_add_assoc",TermC.num_str (@{thm add.assoc} RS @{thm sym})),
   40.37         Rule.Thm ("sym_rmult_assoc",TermC.num_str (@{thm rmult_assoc} RS @{thm sym}))],
   40.38 @@ -448,8 +448,8 @@
   40.39        };      
   40.40  
   40.41  val ac_plus_times =
   40.42 -  Rule.Rls{id = "ac_plus_times", preconds = [], rew_ord = ("term_order",term_order),
   40.43 -      erls = Rule.e_rls, srls = Rule.e_rls, calc = [], errpatts = [],
   40.44 +  Rule_Set.Rls{id = "ac_plus_times", preconds = [], rew_ord = ("term_order",term_order),
   40.45 +      erls = Rule_Set.e_rls, srls = Rule_Set.e_rls, calc = [], errpatts = [],
   40.46        rules = 
   40.47        [Rule.Thm ("radd_commute",TermC.num_str @{thm radd_commute}),
   40.48         Rule.Thm ("radd_left_commute",TermC.num_str @{thm radd_left_commute}),
   40.49 @@ -462,8 +462,8 @@
   40.50  
   40.51  (*todo: replace by Rewrite("rnorm_equation_add",TermC.num_str @{thm rnorm_equation_add)*)
   40.52  val norm_equation =
   40.53 -  Rule.Rls{id = "norm_equation", preconds = [], rew_ord = ("e_rew_ord",Rule.e_rew_ord),
   40.54 -      erls = tval_rls, srls = Rule.e_rls, calc = [], errpatts = [],
   40.55 +  Rule_Set.Rls{id = "norm_equation", preconds = [], rew_ord = ("e_rew_ord",Rule.e_rew_ord),
   40.56 +      erls = tval_rls, srls = Rule_Set.e_rls, calc = [], errpatts = [],
   40.57        rules = [Rule.Thm ("rnorm_equation_add",TermC.num_str @{thm rnorm_equation_add})
   40.58  	       ],
   40.59        scr = Rule.EmptyScr
   40.60 @@ -472,9 +472,9 @@
   40.61  ML \<open>
   40.62  (* expects * distributed over + *)
   40.63  val Test_simplify =
   40.64 -  Rule.Rls{id = "Test_simplify", preconds = [], 
   40.65 +  Rule_Set.Rls{id = "Test_simplify", preconds = [], 
   40.66        rew_ord = ("sqrt_right",sqrt_right false @{theory "Pure"}),
   40.67 -      erls = tval_rls, srls = Rule.e_rls, 
   40.68 +      erls = tval_rls, srls = Rule_Set.e_rls, 
   40.69        calc=[(*since 040209 filled by prep_rls'*)], errpatts = [],
   40.70        rules = [
   40.71  	       Rule.Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}),
   40.72 @@ -529,8 +529,8 @@
   40.73  ML \<open>
   40.74  (*isolate the root in a root-equation*)
   40.75  val isolate_root =
   40.76 -  Rule.Rls{id = "isolate_root", preconds = [], rew_ord = ("e_rew_ord",Rule.e_rew_ord), 
   40.77 -      erls=tval_rls,srls = Rule.e_rls, calc=[], errpatts = [],
   40.78 +  Rule_Set.Rls{id = "isolate_root", preconds = [], rew_ord = ("e_rew_ord",Rule.e_rew_ord), 
   40.79 +      erls=tval_rls,srls = Rule_Set.e_rls, calc=[], errpatts = [],
   40.80        rules = [Rule.Thm ("rroot_to_lhs",TermC.num_str @{thm rroot_to_lhs}),
   40.81  	       Rule.Thm ("rroot_to_lhs_mult",TermC.num_str @{thm rroot_to_lhs_mult}),
   40.82  	       Rule.Thm ("rroot_to_lhs_add_mult",TermC.num_str @{thm rroot_to_lhs_add_mult}),
   40.83 @@ -543,8 +543,8 @@
   40.84  
   40.85  (*isolate the bound variable in an equation; 'bdv' is a meta-constant*)
   40.86  val isolate_bdv =
   40.87 -    Rule.Rls{id = "isolate_bdv", preconds = [], rew_ord = ("e_rew_ord",Rule.e_rew_ord),
   40.88 -	erls=tval_rls,srls = Rule.e_rls, calc= [], errpatts = [],
   40.89 +    Rule_Set.Rls{id = "isolate_bdv", preconds = [], rew_ord = ("e_rew_ord",Rule.e_rew_ord),
   40.90 +	erls=tval_rls,srls = Rule_Set.e_rls, calc= [], errpatts = [],
   40.91  	rules = 
   40.92  	[Rule.Thm ("risolate_bdv_add",TermC.num_str @{thm risolate_bdv_add}),
   40.93  	 Rule.Thm ("risolate_bdv_mult_add",TermC.num_str @{thm risolate_bdv_mult_add}),
   40.94 @@ -564,13 +564,13 @@
   40.95    ("isolate_root", (Context.theory_name @{theory}, prep_rls' isolate_root)), 
   40.96    ("isolate_bdv", (Context.theory_name @{theory}, prep_rls' isolate_bdv)), 
   40.97    ("matches", (Context.theory_name @{theory}, prep_rls'
   40.98 -    (Rule.append_rls "matches" testerls [Rule.Num_Calc ("Prog_Expr.matches", Prog_Expr.eval_matches "#matches_")])))]
   40.99 +    (Rule_Set.append_rls "matches" testerls [Rule.Num_Calc ("Prog_Expr.matches", Prog_Expr.eval_matches "#matches_")])))]
  40.100  \<close>
  40.101  
  40.102  subsection \<open>problems\<close>
  40.103  (** problem types **)
  40.104  setup \<open>KEStore_Elems.add_pbts
  40.105 -  [(Specify.prep_pbt thy "pbl_test" [] Celem.e_pblID (["test"], [], Rule.e_rls, NONE, [])),
  40.106 +  [(Specify.prep_pbt thy "pbl_test" [] Celem.e_pblID (["test"], [], Rule_Set.e_rls, NONE, [])),
  40.107      (Specify.prep_pbt thy "pbl_test_equ" [] Celem.e_pblID
  40.108        (["equation","test"],
  40.109          [("#Given" ,["equality e_e","solveFor v_v"]),
  40.110 @@ -599,9 +599,9 @@
  40.111   ]);
  40.112  
  40.113  val make_polytest =
  40.114 -  Rule.Rls{id = "make_polytest", preconds = []:term list, 
  40.115 +  Rule_Set.Rls{id = "make_polytest", preconds = []:term list, 
  40.116        rew_ord = ("ord_make_polytest", ord_make_polytest false @{theory "Poly"}),
  40.117 -      erls = testerls, srls = Rule.Erls,
  40.118 +      erls = testerls, srls = Rule_Set.Erls,
  40.119        calc = [("PLUS"  , ("Groups.plus_class.plus", (**)eval_binop "#add_")), 
  40.120  	      ("TIMES" , ("Groups.times_class.times", (**)eval_binop "#mult_")),
  40.121  	      ("POWER", ("Prog_Expr.pow", (**)eval_binop "#power_"))
  40.122 @@ -667,9 +667,9 @@
  40.123        }; 
  40.124  
  40.125  val expand_binomtest =
  40.126 -  Rule.Rls{id = "expand_binomtest", preconds = [], 
  40.127 +  Rule_Set.Rls{id = "expand_binomtest", preconds = [], 
  40.128        rew_ord = ("termlessI",termlessI),
  40.129 -      erls = testerls, srls = Rule.Erls,
  40.130 +      erls = testerls, srls = Rule_Set.Erls,
  40.131        calc = [("PLUS"  , ("Groups.plus_class.plus", (**)eval_binop "#add_")), 
  40.132  	      ("TIMES" , ("Groups.times_class.times", (**)eval_binop "#mult_")),
  40.133  	      ("POWER", ("Prog_Expr.pow", (**)eval_binop "#power_"))
  40.134 @@ -787,28 +787,28 @@
  40.135          [("#Given" ,["equality (v_v ^^^2 + p_p * v_v + q__q = 0)","solveFor v_v"]),
  40.136            ("#Where" ,["HOL.False"]),
  40.137            ("#Find"  ,["solutions v_v'i'"])],
  40.138 -        Rule.e_rls, SOME "solve (e_e::bool, v_v)", [])),
  40.139 +        Rule_Set.e_rls, SOME "solve (e_e::bool, v_v)", [])),
  40.140      (Specify.prep_pbt thy "pbl_test_uni_poly_deg2" [] Celem.e_pblID
  40.141        (["degree_two","polynomial","univariate","equation","test"],
  40.142          [("#Given" ,["equality (v_v ^^^2 + p_p * v_v + q__q = 0)","solveFor v_v"]),
  40.143            ("#Find"  ,["solutions v_v'i'"])],
  40.144 -        Rule.e_rls, SOME "solve (v_v ^^^2 + p_p * v_v + q__q = 0, v_v)", [])),
  40.145 +        Rule_Set.e_rls, SOME "solve (v_v ^^^2 + p_p * v_v + q__q = 0, v_v)", [])),
  40.146      (Specify.prep_pbt thy "pbl_test_uni_poly_deg2_pq" [] Celem.e_pblID
  40.147        (["pq_formula","degree_two","polynomial","univariate","equation","test"],
  40.148          [("#Given" ,["equality (v_v ^^^2 + p_p * v_v + q__q = 0)","solveFor v_v"]),
  40.149            ("#Find"  ,["solutions v_v'i'"])],
  40.150 -        Rule.e_rls, SOME "solve (v_v ^^^2 + p_p * v_v + q__q = 0, v_v)", [])),
  40.151 +        Rule_Set.e_rls, SOME "solve (v_v ^^^2 + p_p * v_v + q__q = 0, v_v)", [])),
  40.152      (Specify.prep_pbt thy "pbl_test_uni_poly_deg2_abc" [] Celem.e_pblID
  40.153        (["abc_formula","degree_two","polynomial","univariate","equation","test"],
  40.154          [("#Given" ,["equality (a_a * x ^^^2 + b_b * x + c_c = 0)","solveFor v_v"]),
  40.155            ("#Find"  ,["solutions v_v'i'"])],
  40.156 -        Rule.e_rls, SOME "solve (a_a * x ^^^2 + b_b * x + c_c = 0, v_v)", [])),
  40.157 +        Rule_Set.e_rls, SOME "solve (a_a * x ^^^2 + b_b * x + c_c = 0, v_v)", [])),
  40.158      (Specify.prep_pbt thy "pbl_test_uni_root" [] Celem.e_pblID
  40.159        (["squareroot","univariate","equation","test"],
  40.160          [("#Given" ,["equality e_e","solveFor v_v"]),
  40.161            ("#Where" ,["precond_rootpbl v_v"]),
  40.162            ("#Find"  ,["solutions v_v'i'"])],
  40.163 -        Rule.append_rls "contains_root" Rule.e_rls [Rule.Num_Calc ("Test.contains'_root",
  40.164 +        Rule_Set.append_rls "contains_root" Rule_Set.e_rls [Rule.Num_Calc ("Test.contains'_root",
  40.165              eval_contains_root "#contains_root_")], 
  40.166          SOME "solve (e_e::bool, v_v)", [["Test","square_equation"]])),
  40.167      (Specify.prep_pbt thy "pbl_test_uni_norm" [] Celem.e_pblID
  40.168 @@ -816,27 +816,27 @@
  40.169          [("#Given" ,["equality e_e","solveFor v_v"]),
  40.170            ("#Where" ,[]),
  40.171            ("#Find"  ,["solutions v_v'i'"])],
  40.172 -        Rule.e_rls, SOME "solve (e_e::bool, v_v)", [["Test","norm_univar_equation"]])),
  40.173 +        Rule_Set.e_rls, SOME "solve (e_e::bool, v_v)", [["Test","norm_univar_equation"]])),
  40.174      (Specify.prep_pbt thy "pbl_test_uni_roottest" [] Celem.e_pblID
  40.175        (["sqroot-test","univariate","equation","test"],
  40.176          [("#Given" ,["equality e_e","solveFor v_v"]),
  40.177            ("#Where" ,["precond_rootpbl v_v"]),
  40.178            ("#Find"  ,["solutions v_v'i'"])],
  40.179 -        Rule.e_rls, SOME "solve (e_e::bool, v_v)", [])),
  40.180 +        Rule_Set.e_rls, SOME "solve (e_e::bool, v_v)", [])),
  40.181      (Specify.prep_pbt thy "pbl_test_intsimp" [] Celem.e_pblID
  40.182        (["inttype","test"],
  40.183          [("#Given" ,["intTestGiven t_t"]),
  40.184            ("#Where" ,[]),
  40.185            ("#Find"  ,["intTestFind s_s"])],
  40.186 -      Rule.e_rls, NONE, [["Test","intsimp"]]))]\<close>
  40.187 +      Rule_Set.e_rls, NONE, [["Test","intsimp"]]))]\<close>
  40.188  
  40.189  section \<open>methods\<close>
  40.190  subsection \<open>differentiate\<close>
  40.191  setup \<open>KEStore_Elems.add_mets
  40.192      [Specify.prep_met @{theory "Diff"} "met_test" [] Celem.e_metID
  40.193        (["Test"], [],
  40.194 -        {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = Rule.e_rls, prls=Rule.e_rls,
  40.195 -          crls=Atools_erls, errpats = [], nrls = Rule.e_rls}, @{thm refl})]
  40.196 +        {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = Rule_Set.e_rls, prls=Rule_Set.e_rls,
  40.197 +          crls=Atools_erls, errpats = [], nrls = Rule_Set.e_rls}, @{thm refl})]
  40.198  \<close>
  40.199  
  40.200  partial_function (tailrec) solve_linear :: "bool \<Rightarrow> real \<Rightarrow> bool list"
  40.201 @@ -854,7 +854,7 @@
  40.202          [("#Given" ,["equality e_e","solveFor v_v"]),
  40.203            ("#Where" ,["matches (?a = ?b) e_e"]),
  40.204            ("#Find"  ,["solutions v_v'i'"])],
  40.205 -        {rew_ord' = "e_rew_ord", rls' = tval_rls, srls = Rule.e_rls,
  40.206 +        {rew_ord' = "e_rew_ord", rls' = tval_rls, srls = Rule_Set.e_rls,
  40.207            prls = assoc_rls' @{theory} "matches", calc = [], crls = tval_rls, errpats = [],
  40.208            nrls = Test_simplify},
  40.209          @{thm solve_linear.simps})]
  40.210 @@ -887,11 +887,11 @@
  40.211            ("#Where" ,["contains_root (e_e::bool)"]),
  40.212            ("#Find"  ,["solutions v_v'i'"])],
  40.213          {rew_ord'="e_rew_ord",rls'=tval_rls,
  40.214 -          srls = Rule.append_rls "srls_contains_root" Rule.e_rls
  40.215 +          srls = Rule_Set.append_rls "srls_contains_root" Rule_Set.e_rls
  40.216                [Rule.Num_Calc ("Test.contains'_root", eval_contains_root "")],
  40.217 -          prls = Rule.append_rls "prls_contains_root" Rule.e_rls 
  40.218 +          prls = Rule_Set.append_rls "prls_contains_root" Rule_Set.e_rls 
  40.219                [Rule.Num_Calc ("Test.contains'_root", eval_contains_root "")],
  40.220 -          calc=[], crls=tval_rls, errpats = [], nrls = Rule.e_rls (*,asm_rls=[],
  40.221 +          calc=[], crls=tval_rls, errpats = [], nrls = Rule_Set.e_rls (*,asm_rls=[],
  40.222            asm_thm=[("square_equation_left",""), ("square_equation_right","")]*)},
  40.223          @{thm solve_root_equ.simps})]
  40.224  \<close>
  40.225 @@ -914,8 +914,8 @@
  40.226          [("#Given" ,["equality e_e","solveFor v_v"]),
  40.227            ("#Where" ,["precond_rootmet v_v"]),
  40.228            ("#Find"  ,["solutions v_v'i'"])],
  40.229 -        {rew_ord' = "e_rew_ord", rls' = tval_rls, srls = Rule.e_rls,
  40.230 -          prls = Rule.append_rls "prls_met_test_squ_sub" Rule.e_rls
  40.231 +        {rew_ord' = "e_rew_ord", rls' = tval_rls, srls = Rule_Set.e_rls,
  40.232 +          prls = Rule_Set.append_rls "prls_met_test_squ_sub" Rule_Set.e_rls
  40.233                [Rule.Num_Calc ("Test.precond'_rootmet", eval_precond_rootmet "")],
  40.234            calc=[], crls=tval_rls, errpats = [], nrls = Test_simplify},
  40.235          @{thm minisubpbl.simps})]
  40.236 @@ -946,9 +946,9 @@
  40.237          [("#Given" ,["equality e_e","solveFor v_v"]),
  40.238            ("#Find"  ,["solutions v_v'i'"])],
  40.239          {rew_ord'="e_rew_ord",rls'=tval_rls,
  40.240 -          srls = Rule.append_rls "srls_contains_root" Rule.e_rls 
  40.241 -            [Rule.Num_Calc ("Test.contains'_root", eval_contains_root"")], prls=Rule.e_rls, calc=[], crls=tval_rls,
  40.242 -              errpats = [], nrls = Rule.e_rls(*,asm_rls=[], asm_thm=[("square_equation_left",""),
  40.243 +          srls = Rule_Set.append_rls "srls_contains_root" Rule_Set.e_rls 
  40.244 +            [Rule.Num_Calc ("Test.contains'_root", eval_contains_root"")], prls=Rule_Set.e_rls, calc=[], crls=tval_rls,
  40.245 +              errpats = [], nrls = Rule_Set.e_rls(*,asm_rls=[], asm_thm=[("square_equation_left",""),
  40.246                ("square_equation_right","")]*)},
  40.247          @{thm solve_root_equ2.simps})]
  40.248  \<close>
  40.249 @@ -979,9 +979,9 @@
  40.250            [("#Given" ,["equality e_e","solveFor v_v"]),
  40.251            ("#Find"  ,["solutions v_v'i'"])],
  40.252          {rew_ord'="e_rew_ord",rls'=tval_rls,
  40.253 -          srls = Rule.append_rls "srls_contains_root" Rule.e_rls 
  40.254 +          srls = Rule_Set.append_rls "srls_contains_root" Rule_Set.e_rls 
  40.255                [Rule.Num_Calc ("Test.contains'_root", eval_contains_root"")],
  40.256 -          prls=Rule.e_rls,calc=[], crls=tval_rls, errpats = [], nrls = Rule.e_rls(*,asm_rls=[],
  40.257 +          prls=Rule_Set.e_rls,calc=[], crls=tval_rls, errpats = [], nrls = Rule_Set.e_rls(*,asm_rls=[],
  40.258            asm_thm=[("square_equation_left",""), ("square_equation_right","")]*)},
  40.259          @{thm solve_root_equ3.simps})]
  40.260  \<close>
  40.261 @@ -1012,9 +1012,9 @@
  40.262          [("#Given" ,["equality e_e","solveFor v_v"]),
  40.263            ("#Find"  ,["solutions v_v'i'"])],
  40.264          {rew_ord'="e_rew_ord",rls'=tval_rls,
  40.265 -          srls = Rule.append_rls "srls_contains_root" Rule.e_rls 
  40.266 +          srls = Rule_Set.append_rls "srls_contains_root" Rule_Set.e_rls 
  40.267                [Rule.Num_Calc ("Test.contains'_root", eval_contains_root"")],
  40.268 -          prls=Rule.e_rls,calc=[], crls=tval_rls, errpats = [], nrls = Rule.e_rls (*,asm_rls=[],
  40.269 +          prls=Rule_Set.e_rls,calc=[], crls=tval_rls, errpats = [], nrls = Rule_Set.e_rls (*,asm_rls=[],
  40.270            asm_thm=[("square_equation_left",""), ("square_equation_right","")]*)},
  40.271          @{thm solve_root_equ4.simps})]
  40.272  \<close>
  40.273 @@ -1041,8 +1041,8 @@
  40.274                "(matches (?a +    v_v ^^^2 = 0) e_e) |" ^
  40.275                "(matches (        v_v ^^^2 = 0) e_e)"]), 
  40.276            ("#Find"  ,["solutions v_v'i'"])],
  40.277 -        {rew_ord'="e_rew_ord",rls'=tval_rls,calc=[],srls=Rule.e_rls,
  40.278 -          prls = assoc_rls' @{theory} "matches", crls=tval_rls, errpats = [], nrls = Rule.e_rls(*,
  40.279 +        {rew_ord'="e_rew_ord",rls'=tval_rls,calc=[],srls=Rule_Set.e_rls,
  40.280 +          prls = assoc_rls' @{theory} "matches", crls=tval_rls, errpats = [], nrls = Rule_Set.e_rls(*,
  40.281            asm_rls=[],asm_thm=[]*)},
  40.282          @{thm solve_plain_square.simps})]
  40.283  \<close>
  40.284 @@ -1064,8 +1064,8 @@
  40.285          [("#Given",["equality e_e","solveFor v_v"]),
  40.286            ("#Where" ,[]), 
  40.287            ("#Find"  ,["solutions v_v'i'"])],
  40.288 -        {rew_ord'="e_rew_ord",rls'=tval_rls,srls = Rule.e_rls,prls=Rule.e_rls, calc=[], crls=tval_rls,
  40.289 -          errpats = [], nrls = Rule.e_rls},
  40.290 +        {rew_ord'="e_rew_ord",rls'=tval_rls,srls = Rule_Set.e_rls,prls=Rule_Set.e_rls, calc=[], crls=tval_rls,
  40.291 +          errpats = [], nrls = Rule_Set.e_rls},
  40.292          @{thm norm_univariate_equ.simps})]
  40.293  \<close>
  40.294  subsection \<open>diophantine equation\<close>
  40.295 @@ -1082,7 +1082,7 @@
  40.296          [("#Given" ,["intTestGiven t_t"]),
  40.297            ("#Where" ,[]),
  40.298            ("#Find"  ,["intTestFind s_s"])],
  40.299 -        {rew_ord' = "e_rew_ord", rls' = tval_rls, srls = Rule.e_rls,  prls = Rule.e_rls, calc = [],
  40.300 +        {rew_ord' = "e_rew_ord", rls' = tval_rls, srls = Rule_Set.e_rls,  prls = Rule_Set.e_rls, calc = [],
  40.301            crls = tval_rls, errpats = [], nrls = Test_simplify},
  40.302          @{thm test_simplify.simps})]
  40.303  \<close>
    41.1 --- a/src/Tools/isac/Knowledge/Test_Build_Thydata.thy	Wed Apr 01 19:20:05 2020 +0200
    41.2 +++ b/src/Tools/isac/Knowledge/Test_Build_Thydata.thy	Sat Apr 04 12:11:32 2020 +0200
    41.3 @@ -13,15 +13,15 @@
    41.4    thm222: "thm222 = thm222 + (222::int)"
    41.5  
    41.6  ML \<open>
    41.7 -val rls111 = Rule.Rls {id = "rls111", 
    41.8 -	preconds = [], rew_ord = ("termlessI", termlessI), erls = Rule.e_rls, 
    41.9 -	srls = Rule.Erls, calc = [], errpatts = [],
   41.10 +val rls111 = Rule_Set.Rls {id = "rls111", 
   41.11 +	preconds = [], rew_ord = ("termlessI", termlessI), erls = Rule_Set.e_rls, 
   41.12 +	srls = Rule_Set.Erls, calc = [], errpatts = [],
   41.13  	rules = [Rule.Thm ("thm111", @{thm thm111}), Rule.Thm ("refl", @{thm refl})],
   41.14  	scr = Rule.EmptyScr};
   41.15  
   41.16 -val rls222 = Rule.Rls {id = "rls222", 
   41.17 -	preconds = [], rew_ord = ("termlessI", termlessI), erls = Rule.e_rls, 
   41.18 -	srls = Rule.Erls, calc = [], errpatts = [],
   41.19 +val rls222 = Rule_Set.Rls {id = "rls222", 
   41.20 +	preconds = [], rew_ord = ("termlessI", termlessI), erls = Rule_Set.e_rls, 
   41.21 +	srls = Rule_Set.Erls, calc = [], errpatts = [],
   41.22  	rules = [Rule.Thm ("sym_thm111", @{thm thm111} RS @{thm sym}), Rule.Thm ("o_def", @{thm o_def})],
   41.23  	scr = Rule.EmptyScr};
   41.24  
   41.25 @@ -45,21 +45,21 @@
   41.26  case ddd of
   41.27    ("rls111",
   41.28      ("Test_Build_Thydata",
   41.29 -     Rls {calc = [], erls =
   41.30 -          Rls {calc = [], erls = Erls, errpatts = [], id = "e_rls", preconds = [], rew_ord =
   41.31 -               ("dummy_ord", _), rules = [], scr = EmptyScr, srls = Erls},
   41.32 +     Rule_Set.Rls {calc = [], erls =
   41.33 +          Rule_Set.Rls {calc = [], erls = Erls, errpatts = [], id = "e_rls", preconds = [], rew_ord =
   41.34 +               ("dummy_ord", _), rules = [], scr = EmptyScr, srls = Rule_Set.Erls},
   41.35            errpatts = [], id = "rls111", preconds = [], rew_ord = ("termlessI", _), rules =
   41.36 -          [Thm ("thm111", _), Thm ("refl", _)], scr = EmptyScr, srls = Erls})) => ()
   41.37 +          [Thm ("thm111", _), Thm ("refl", _)], scr = EmptyScr, srls = Rule_Set.Erls})) => ()
   41.38  | _ => error "test/../thy-hierarchy CHANGED 4";
   41.39  \<close> ML \<open>
   41.40  case eee of
   41.41    ("rls222",
   41.42      ("Test_Build_Thydata",
   41.43 -     Rls {calc = [], erls =
   41.44 -          Rls {calc = [], erls = Erls, errpatts = [], id = "e_rls", preconds = [], rew_ord =
   41.45 -               ("dummy_ord", _), rules = [], scr = EmptyScr, srls = Erls},
   41.46 +     Rule_Set.Rls {calc = [], erls =
   41.47 +          Rule_Set.Rls {calc = [], erls = Erls, errpatts = [], id = "e_rls", preconds = [], rew_ord =
   41.48 +               ("dummy_ord", _), rules = [], scr = EmptyScr, srls = Rule_Set.Erls},
   41.49            errpatts = [], id = "rls222", preconds = [], rew_ord = ("termlessI", _), rules =
   41.50 -          [Thm ("sym_thm111", _), Thm ("o_def", _)], scr = EmptyScr, srls = Erls})) => ()
   41.51 +          [Thm ("sym_thm111", _), Thm ("o_def", _)], scr = EmptyScr, srls = Rule_Set.Erls})) => ()
   41.52  | _ => error "test/../thy-hierarchy CHANGED 5";
   41.53  \<close>
   41.54  
    42.1 --- a/src/Tools/isac/MathEngBasic/ctree-basic.sml	Wed Apr 01 19:20:05 2020 +0200
    42.2 +++ b/src/Tools/isac/MathEngBasic/ctree-basic.sml	Sat Apr 04 12:11:32 2020 +0200
    42.3 @@ -82,7 +82,7 @@
    42.4    val get_somespec' : Celem.spec -> Celem.spec -> Celem.spec
    42.5    exception PTREE of string;
    42.6    
    42.7 -  val parent_node : ctree -> Pos.pos -> bool * Pos.pos * Rule.rls                      (* for appl.sml *)
    42.8 +  val parent_node : ctree -> Pos.pos -> bool * Pos.pos * Rule_Set.rls                      (* for appl.sml *)
    42.9    val rootthy : ctree -> theory                                               (* for script.sml *)
   42.10  (* ---- made visible ONLY for structure CTaccess : CALC_TREE_ACCESS --------------------------- *)
   42.11    val appl_obj : (ppobj -> ppobj) -> ctree -> Pos.pos -> ctree
   42.12 @@ -185,7 +185,7 @@
   42.13  
   42.14  type envp =(*9.5.03: unused, delete with field in ctree.PblObj FIXXXME*)
   42.15    (int * term list) list * (* assoc-list: args of met*)
   42.16 -  (int * Rule.rls) list * (* assoc-list: tacs already done ///15.9.00*)
   42.17 +  (int * Rule_Set.rls) list * (* assoc-list: tacs already done ///15.9.00*)
   42.18    (int * ets) list *       (* assoc-list: tacs etc. already done*)
   42.19    (string * pos) list;     (* asms * from where*)
   42.20  
   42.21 @@ -386,13 +386,13 @@
   42.22  (*\--------------- duplicates in ctree-navi.sml: required also here below ---------------/*)
   42.23  
   42.24  (* find the next parent, which is either a PblObj or a PrfObj *)
   42.25 -fun parent_node _ [] = (true, [], Rule.Erls)
   42.26 +fun parent_node _ [] = (true, [], Rule_Set.Erls)
   42.27    | parent_node pt p =
   42.28      let
   42.29 -      fun par _ [] = (true, [], Rule.Erls)
   42.30 +      fun par _ [] = (true, [], Rule_Set.Erls)
   42.31          | par pt p =
   42.32            if is_pblobj (get_obj I pt p)
   42.33 -          then (true, p, Rule.Erls)
   42.34 +          then (true, p, Rule_Set.Erls)
   42.35  		      else case get_obj g_tac pt p of
   42.36  				    Tactic.Rewrite_Set rls' => (false, p, assoc_rls rls')
   42.37  			    | Tactic.Rewrite_Set_Inst (_, rls') => (false, p, assoc_rls rls')
    43.1 --- a/src/Tools/isac/MathEngBasic/istate-def.sml	Wed Apr 01 19:20:05 2020 +0200
    43.2 +++ b/src/Tools/isac/MathEngBasic/istate-def.sml	Sat Apr 04 12:11:32 2020 +0200
    43.3 @@ -14,13 +14,13 @@
    43.4    val pstate2str: pstate -> string
    43.5    val pstate2str': pstate -> string
    43.6  
    43.7 -  datatype T = RrlsState of Rule.rrlsstate | Pstate of pstate | Uistate
    43.8 +  datatype T = RrlsState of Rule_Set.rrlsstate | Pstate of pstate | Uistate
    43.9    val empty: T
   43.10    val string_of: T -> string
   43.11    val string_of': T -> string
   43.12    val istates2str: T option * T option -> string
   43.13  
   43.14 -  val set_eval: Rule.rls -> pstate -> pstate
   43.15 +  val set_eval: Rule_Set.rls -> pstate -> pstate
   43.16    val set_act: term -> pstate -> pstate
   43.17    val set_env_true: Env.T -> pstate -> pstate
   43.18  
   43.19 @@ -47,23 +47,23 @@
   43.20  type pstate =
   43.21    {env: Env.T,          (* environment for variables in a program *)
   43.22    path: TermC.path,     (* to the current location in a program   *)
   43.23 -  eval: Rule.rls,       (* rule-set for evaluating a Prog_Expr    *)
   43.24 +  eval: Rule_Set.rls,       (* rule-set for evaluating a Prog_Expr    *)
   43.25    form_arg: term option,(* argument of a curried function         *)
   43.26    act_arg: term,        (* value for the curried argument         *)
   43.27    or: asap,             (* flag for scanning tactical "Or"      !shall be dropped *)
   43.28    found_accept: bool,   (* flag set after execution of a tactic !shall be dropped *)
   43.29    assoc: bool}          (* is the tactic associated to input ?cont.search Unsafe_Step \<rightarrow> Safe_Step*)
   43.30  val e_pstate =
   43.31 -  {env = [], path = [], eval = Rule.e_rls, form_arg = NONE, act_arg = Rule.e_term,
   43.32 +  {env = [], path = [], eval = Rule_Set.e_rls, form_arg = NONE, act_arg = Rule.e_term,
   43.33      or = ORundef, found_accept = false, assoc = false}
   43.34  fun topt2str NONE = "NONE"
   43.35    | topt2str (SOME t) = "SOME " ^ Rule.term2str t;
   43.36  fun pstate2str {env, path, eval, form_arg, act_arg, or, found_accept, assoc} = (* for tests only *)
   43.37 -  "(" ^  Env.env2str env ^ ", " ^ TermC.string_of_path path ^ ", " ^ Rule.id_rls eval ^ ", " ^
   43.38 +  "(" ^  Env.env2str env ^ ", " ^ TermC.string_of_path path ^ ", " ^ Rule_Set.id_rls eval ^ ", " ^
   43.39    topt2str form_arg ^ ", \n" ^ Rule.term2str act_arg ^ ", " ^ asap2str or ^ ", " ^
   43.40    bool2str found_accept ^ ", " ^ bool2str assoc ^ ")";
   43.41  fun pstate2str' {env, path, eval, form_arg, act_arg, or, found_accept, assoc} = (* for tests only *)
   43.42 -  "(" ^  Env.env2str' env ^ ", " ^ TermC.string_of_path path ^ ", " ^ Rule.id_rls eval ^ ", " ^
   43.43 +  "(" ^  Env.env2str' env ^ ", " ^ TermC.string_of_path path ^ ", " ^ Rule_Set.id_rls eval ^ ", " ^
   43.44    topt2str form_arg ^ ", " ^ Rule.term2str act_arg ^ ", " ^ asap2str or ^ ", " ^
   43.45    bool2str found_accept ^ ", " ^ bool2str assoc ^ ")";
   43.46  
   43.47 @@ -71,16 +71,16 @@
   43.48  datatype T =                 (*interpreter state*)
   43.49  	  Uistate                       (*undefined in modspec, in '_deriv'ation*)
   43.50    | Pstate of pstate          (*for script interpreter*)
   43.51 -  | RrlsState of Rule.rrlsstate; (*for reverse rewriting*)
   43.52 +  | RrlsState of Rule_Set.rrlsstate; (*for reverse rewriting*)
   43.53  val empty = Pstate e_pstate;
   43.54  
   43.55 -fun rta2str (r, (t, a)) = "\n(" ^ Rule.rule2str r ^ ", (" ^ Rule.term2str t ^ ", " ^ Rule.terms2str a ^ "))";
   43.56 +fun rta2str (r, (t, a)) = "\n(" ^ Rule_Set.rule2str r ^ ", (" ^ Rule.term2str t ^ ", " ^ Rule.terms2str a ^ "))";
   43.57  fun string_of Uistate = "Uistate"
   43.58    | string_of (Pstate pst) = 
   43.59      "Pstate " ^ pstate2str pst
   43.60    | string_of (RrlsState (t, t1, rss, rtas)) =
   43.61      "RrlsState (" ^ Rule.term2str t ^ ", " ^ Rule.term2str t1 ^ ", " ^
   43.62 -    (strs2str o (map (strs2str o (map Rule.rule2str)))) rss ^ ", " ^
   43.63 +    (strs2str o (map (strs2str o (map Rule_Set.rule2str)))) rss ^ ", " ^
   43.64      (strs2str o (map rta2str)) rtas ^ ")";
   43.65  fun string_of' Uistate = "Uistate"
   43.66    | string_of' (Pstate pst) = 
    44.1 --- a/src/Tools/isac/MathEngBasic/mstools.sml	Wed Apr 01 19:20:05 2020 +0200
    44.2 +++ b/src/Tools/isac/MathEngBasic/mstools.sml	Sat Apr 04 12:11:32 2020 +0200
    44.3 @@ -9,8 +9,8 @@
    44.4  
    44.5  signature SPECIFY_TOOL =
    44.6  sig
    44.7 -  val check_preconds : 'a -> Rule.rls -> term list -> Model.itm list -> (bool * term) list
    44.8 -  val check_preconds' : Rule.rls -> term list -> Model.itm list -> 'a -> (bool * term) list
    44.9 +  val check_preconds : 'a -> Rule_Set.rls -> term list -> Model.itm list -> (bool * term) list
   44.10 +  val check_preconds' : Rule_Set.rls -> term list -> Model.itm list -> 'a -> (bool * term) list
   44.11  
   44.12    datatype match_ = Match_ of Celem.pblID * (Model.itm list * (bool * term) list) | NoMatch_
   44.13    val refined_ : match_ list -> match_ option
    45.1 --- a/src/Tools/isac/MathEngBasic/tactic.sml	Wed Apr 01 19:20:05 2020 +0200
    45.2 +++ b/src/Tools/isac/MathEngBasic/tactic.sml	Sat Apr 04 12:11:32 2020 +0200
    45.3 @@ -26,9 +26,9 @@
    45.4    | Check_elementwise' of term * Rule.cterm' * Selem.result
    45.5    | Del_Find' of Rule.cterm' | Del_Given' of Rule.cterm' | Del_Relation' of Rule.cterm'
    45.6  
    45.7 -  | Derive' of Rule.rls      
    45.8 -  | Detail_Set' of Rule.theory' * bool * Rule.rls * term * Selem.result
    45.9 -  | Detail_Set_Inst' of Rule.theory' * bool * Rule.subst * Rule.rls * term * Selem.result
   45.10 +  | Derive' of Rule_Set.rls      
   45.11 +  | Detail_Set' of Rule.theory' * bool * Rule_Set.rls * term * Selem.result
   45.12 +  | Detail_Set_Inst' of Rule.theory' * bool * Rule.subst * Rule_Set.rls * term * Selem.result
   45.13    | End_Detail' of Selem.result
   45.14  
   45.15    | Empty_Tac_
   45.16 @@ -40,10 +40,10 @@
   45.17    | Refine_Problem' of Celem.pblID * (Model.itm list * (bool * term) list)
   45.18    | Refine_Tacitly' of Celem.pblID * Celem.pblID * Rule.domID * Celem.metID * Model.itm list
   45.19  
   45.20 -  | Rewrite' of Rule.theory' * Rule.rew_ord' * Rule.rls * bool * Celem.thm'' * term * Selem.result
   45.21 -  | Rewrite_Inst' of Rule.theory' * Rule.rew_ord' * Rule.rls * bool * Rule.subst * Celem.thm'' * term * Selem.result
   45.22 -  | Rewrite_Set' of Rule.theory' * bool * Rule.rls * term * Selem.result
   45.23 -  | Rewrite_Set_Inst' of Rule.theory' * bool * Rule.subst * Rule.rls * term * Selem.result
   45.24 +  | Rewrite' of Rule.theory' * Rule_Def.rew_ord' * Rule_Set.rls * bool * Celem.thm'' * term * Selem.result
   45.25 +  | Rewrite_Inst' of Rule.theory' * Rule_Def.rew_ord' * Rule_Set.rls * bool * Rule.subst * Celem.thm'' * term * Selem.result
   45.26 +  | Rewrite_Set' of Rule.theory' * bool * Rule_Set.rls * term * Selem.result
   45.27 +  | Rewrite_Set_Inst' of Rule.theory' * bool * Rule.subst * Rule_Set.rls * term * Selem.result
   45.28  
   45.29    | Specify_Method' of Celem.metID * Model.ori list * Model.itm list
   45.30    | Specify_Problem' of Celem.pblID * (bool * (Model.itm list * (bool * term) list))
   45.31 @@ -55,7 +55,7 @@
   45.32        (*Istate.T *       ?       *)
   45.33        Proof.context * (* derived from prog. in ???  *)
   45.34        term            (* ?UNUSED, e.g."Subproblem\n (''Test'',\n  ??.\<^const>String.char.Char ''LINEAR'' ''univariate'' ''equation''\n   ''test'')" *)
   45.35 -  | Substitute' of Rule.rew_ord_ * Rule.rls * Selem.subte * term * term
   45.36 +  | Substitute' of Rule_Def.rew_ord_ * Rule_Set.rls * Selem.subte * term * term
   45.37    | Tac_ of theory * string * string * string
   45.38    | Take' of term
   45.39    val string_of: T -> string
   45.40 @@ -77,9 +77,9 @@
   45.41    | Check_elementwise of Rule.cterm'
   45.42    | Del_Find of Rule.cterm' | Del_Given of Rule.cterm' | Del_Relation of Rule.cterm'
   45.43  
   45.44 -  | Derive of Rule.rls'
   45.45 -  | Detail_Set of Rule.rls'
   45.46 -  | Detail_Set_Inst of Selem.subs * Rule.rls'
   45.47 +  | Derive of Rule_Set.rls'
   45.48 +  | Detail_Set of Rule_Set.rls'
   45.49 +  | Detail_Set_Inst of Selem.subs * Rule_Set.rls'
   45.50    | End_Detail
   45.51  
   45.52    | Empty_Tac
   45.53 @@ -93,8 +93,8 @@
   45.54  
   45.55    | Rewrite of Celem.thm''
   45.56    | Rewrite_Inst of Selem.subs * Celem.thm''
   45.57 -  | Rewrite_Set of Rule.rls'
   45.58 -  | Rewrite_Set_Inst of Selem.subs * Rule.rls'
   45.59 +  | Rewrite_Set of Rule_Set.rls'
   45.60 +  | Rewrite_Set_Inst of Selem.subs * Rule_Set.rls'
   45.61  
   45.62    | Specify_Method of Celem.metID
   45.63    | Specify_Problem of Celem.pblID
   45.64 @@ -111,7 +111,7 @@
   45.65    val eq_tac : input * input -> bool
   45.66    val is_rewtac : input -> bool
   45.67    val is_rewset : input -> bool
   45.68 -  val rls_of : input -> Rule.rls'
   45.69 +  val rls_of : input -> Rule_Set.rls'
   45.70    val rule2tac : theory -> (term * term) list ->  Rule.rule -> input
   45.71    val input_from_T : T -> input
   45.72    val result : T -> term
   45.73 @@ -165,9 +165,9 @@
   45.74    | Check_elementwise of Rule.cterm'
   45.75    | Del_Find of Rule.cterm' | Del_Given of Rule.cterm' | Del_Relation of Rule.cterm'
   45.76  
   45.77 -  | Derive of Rule.rls'                 (* WN0509 drop *)
   45.78 -  | Detail_Set of Rule.rls'             (* WN0509 drop *)
   45.79 -  | Detail_Set_Inst of Selem.subs * Rule.rls' (* WN0509 drop *)
   45.80 +  | Derive of Rule_Set.rls'                 (* WN0509 drop *)
   45.81 +  | Detail_Set of Rule_Set.rls'             (* WN0509 drop *)
   45.82 +  | Detail_Set_Inst of Selem.subs * Rule_Set.rls' (* WN0509 drop *)
   45.83    | End_Detail                     (* WN0509 drop *)
   45.84  
   45.85    | Empty_Tac
   45.86 @@ -185,8 +185,8 @@
   45.87       and thm is created from ThmID by assoc_thm'' when entering isabisac *)
   45.88    | Rewrite of Celem.thm''
   45.89    | Rewrite_Inst of Selem.subs * Celem.thm''
   45.90 -  | Rewrite_Set of Rule.rls'
   45.91 -  | Rewrite_Set_Inst of Selem.subs * Rule.rls'
   45.92 +  | Rewrite_Set of Rule_Set.rls'
   45.93 +  | Rewrite_Set_Inst of Selem.subs * Rule_Set.rls'
   45.94  
   45.95    | Specify_Method of Celem.metID
   45.96    | Specify_Problem of Celem.pblID
   45.97 @@ -315,11 +315,11 @@
   45.98    | rule2tac _ [] (Rule.Thm thm'') = Rewrite thm''
   45.99    | rule2tac _ subst (Rule.Thm thm'') = 
  45.100      Rewrite_Inst (Selem.subst2subs subst, thm'')
  45.101 -  | rule2tac _ [] (Rule.Rls_ rls) = Rewrite_Set (Rule.id_rls rls)
  45.102 +  | rule2tac _ [] (Rule.Rls_ rls) = Rewrite_Set (Rule_Set.id_rls rls)
  45.103    | rule2tac _ subst (Rule.Rls_ rls) = 
  45.104 -    Rewrite_Set_Inst (Selem.subst2subs subst, (Rule.id_rls rls))
  45.105 +    Rewrite_Set_Inst (Selem.subst2subs subst, (Rule_Set.id_rls rls))
  45.106    | rule2tac _ _ rule = 
  45.107 -    error ("rule2tac: called with \"" ^ Rule.rule2str rule ^ "\"");
  45.108 +    error ("rule2tac: called with \"" ^ Rule_Set.rule2str rule ^ "\"");
  45.109  
  45.110  (* tactics for for internal use, compare "input" for user at the front-end.
  45.111    tac_ contains results from check in 'fun applicable_in'.
  45.112 @@ -360,9 +360,9 @@
  45.113      Selem.result (* (3) composed from (1) and (2): {x. pred}                  *)
  45.114    | Del_Find' of Rule.cterm' | Del_Given' of Rule.cterm' | Del_Relation' of Rule.cterm'
  45.115  
  45.116 -  | Derive' of Rule.rls
  45.117 -  | Detail_Set' of Rule.theory' * bool * Rule.rls * term * Selem.result
  45.118 -  | Detail_Set_Inst' of Rule.theory' * bool * Rule.subst * Rule.rls * term * Selem.result
  45.119 +  | Derive' of Rule_Set.rls
  45.120 +  | Detail_Set' of Rule.theory' * bool * Rule_Set.rls * term * Selem.result
  45.121 +  | Detail_Set_Inst' of Rule.theory' * bool * Rule.subst * Rule_Set.rls * term * Selem.result
  45.122    | End_Detail' of Selem.result
  45.123  
  45.124    | Empty_Tac_
  45.125 @@ -381,10 +381,10 @@
  45.126      Rule.domID *      (* from new pbt?! filled in specify                                     *)
  45.127      Celem.metID *     (* from new pbt?! filled in specify                                     *)
  45.128      Model.itm list    (* drop ! 9.03: remains [] for Model_Problem recognizing its activation *)
  45.129 -  | Rewrite' of Rule.theory' * Rule.rew_ord' * Rule.rls * bool * Celem.thm'' * term * Selem.result
  45.130 -  | Rewrite_Inst' of Rule.theory' * Rule.rew_ord' * Rule.rls * bool * Rule.subst * Celem.thm'' * term * Selem.result
  45.131 -  | Rewrite_Set' of Rule.theory' * bool * Rule.rls * term * Selem.result
  45.132 -  | Rewrite_Set_Inst' of Rule.theory' * bool * Rule.subst * Rule.rls * term * Selem.result
  45.133 +  | Rewrite' of Rule.theory' * Rule_Def.rew_ord' * Rule_Set.rls * bool * Celem.thm'' * term * Selem.result
  45.134 +  | Rewrite_Inst' of Rule.theory' * Rule_Def.rew_ord' * Rule_Set.rls * bool * Rule.subst * Celem.thm'' * term * Selem.result
  45.135 +  | Rewrite_Set' of Rule.theory' * bool * Rule_Set.rls * term * Selem.result
  45.136 +  | Rewrite_Set_Inst' of Rule.theory' * bool * Rule.subst * Rule_Set.rls * term * Selem.result
  45.137  
  45.138    | Specify_Method' of Celem.metID * Model.ori list * Model.itm list
  45.139    | Specify_Problem' of Celem.pblID * 
  45.140 @@ -400,8 +400,8 @@
  45.141      Proof.context *          (* for specify-phase                         *)
  45.142  		term                     (* Subproblem (thyID, pbl) OR cascmd         *)  
  45.143    | Substitute' of           
  45.144 -    Rule.rew_ord_ *          (* for re-calculation                        *)
  45.145 -    Rule.rls *               (* for re-calculation                        *)
  45.146 +    Rule_Def.rew_ord_ *          (* for re-calculation                        *)
  45.147 +    Rule_Set.rls *               (* for re-calculation                        *)
  45.148      Selem.subte *            (* the 'substitution': terms of type bool    *)
  45.149      term *                   (* to be substituted into                    *)
  45.150      term                     (* resulting from the substitution           *)
  45.151 @@ -437,12 +437,12 @@
  45.152    | Rewrite' _(*thm'*) => "Rewrite' "(*^(spair2str thm')*)
  45.153    | Rewrite_Set_Inst' _(*subs,thm'*) => "Rewrite_Set_Inst' "(*^(pair2str (subs2str subs, quote rls))*)
  45.154    | Rewrite_Set' (thy', pasm, rls', f, (f', asm)) => "Rewrite_Set' (" ^ thy' ^ "," ^ bool2str pasm ^
  45.155 -    "," ^ Rule.id_rls rls' ^ "," ^ Rule.term2str f ^ ",(" ^ Rule.term2str f' ^ "," ^ Rule.terms2str asm ^ "))"
  45.156 +    "," ^ Rule_Set.id_rls rls' ^ "," ^ Rule.term2str f ^ ",(" ^ Rule.term2str f' ^ "," ^ Rule.terms2str asm ^ "))"
  45.157    | End_Detail' _ => "End_Detail' xxx"
  45.158    | Detail_Set' _ => "Detail_Set' xxx"
  45.159    | Detail_Set_Inst' _ => "Detail_Set_Inst' xxx"
  45.160  
  45.161 -  | Derive' rls => "Derive' " ^ Rule.id_rls rls
  45.162 +  | Derive' rls => "Derive' " ^ Rule_Set.id_rls rls
  45.163    | Calculate'  _ => "Calculate' "
  45.164    | Substitute' _ => "Substitute' "(*^(subs2str subs)*)    
  45.165  
  45.166 @@ -468,13 +468,13 @@
  45.167    | input_from_T (Rewrite' (_, _, _, _, thm, _, _)) = Rewrite thm
  45.168    | input_from_T (Rewrite_Inst' (_, _, _, _, sub, thm, _, _)) = Rewrite_Inst (Selem.subst2subs sub, thm)
  45.169  
  45.170 -  | input_from_T (Rewrite_Set' (_, _, rls, _, _)) = Rewrite_Set (Rule.id_rls rls)
  45.171 -  | input_from_T (Detail_Set' (_, _, rls, _, _)) = Detail_Set (Rule.id_rls rls)
  45.172 +  | input_from_T (Rewrite_Set' (_, _, rls, _, _)) = Rewrite_Set (Rule_Set.id_rls rls)
  45.173 +  | input_from_T (Detail_Set' (_, _, rls, _, _)) = Detail_Set (Rule_Set.id_rls rls)
  45.174  
  45.175    | input_from_T (Rewrite_Set_Inst' (_, _, sub, rls, _, _)) = 
  45.176 -    Rewrite_Set_Inst (Selem.subst2subs sub, Rule.id_rls rls)
  45.177 +    Rewrite_Set_Inst (Selem.subst2subs sub, Rule_Set.id_rls rls)
  45.178    | input_from_T (Detail_Set_Inst' (_, _, sub, rls, _, _)) = 
  45.179 -    Detail_Set_Inst (Selem.subst2subs sub, Rule.id_rls rls)
  45.180 +    Detail_Set_Inst (Selem.subst2subs sub, Rule_Set.id_rls rls)
  45.181  
  45.182    | input_from_T (Calculate' (_, op_, _, _)) = Calculate (op_)
  45.183    | input_from_T (Check_elementwise' (_, pred, _)) = Check_elementwise pred
    46.1 --- a/src/Tools/isac/MathEngine/detail-step.sml	Wed Apr 01 19:20:05 2020 +0200
    46.2 +++ b/src/Tools/isac/MathEngine/detail-step.sml	Sat Apr 04 12:11:32 2020 +0200
    46.3 @@ -34,7 +34,7 @@
    46.4      val ctxt = get_ctxt pt pos
    46.5    in
    46.6      case rls of
    46.7 -	    Rule.Rrls {scr = Rule.Rfuns {init_state, ...}, ...} => 
    46.8 +	    Rule_Set.Rrls {scr = Rule.Rfuns {init_state, ...}, ...} => 
    46.9  	    let
   46.10          val (_, _, _, rul_terms) = init_state t
   46.11  	      val newnds = rul_terms_2nds (Proof_Context.theory_of ctxt) [] t rul_terms
    47.1 --- a/src/Tools/isac/ProgLang/Auto_Prog.thy	Wed Apr 01 19:20:05 2020 +0200
    47.2 +++ b/src/Tools/isac/ProgLang/Auto_Prog.thy	Sat Apr 04 12:11:32 2020 +0200
    47.3 @@ -32,9 +32,9 @@
    47.4      val subpbl: string -> string list -> term
    47.5      val stacpbls: term -> term list
    47.6      val op_of_calc: term -> string
    47.7 -    val get_calcs: theory -> term -> (Rule.prog_calcID * (Rule.calID * Rule.eval_fn)) list
    47.8 -    val prep_rls: theory -> Rule.rls -> Rule.rls (*ren insert*)
    47.9 -    val gen: theory -> term -> Rule.rls -> term
   47.10 +    val get_calcs: theory -> term -> (Rule_Set.prog_calcID * (Rule.calID * Rule.eval_fn)) list
   47.11 +    val prep_rls: theory -> Rule_Set.rls -> Rule_Set.rls (*ren insert*)
   47.12 +    val gen: theory -> term -> Rule_Set.rls -> term
   47.13  (* ---- for tests only: shifted from below to remove the Warning "unused" at fun.def. --------- *)
   47.14    (* NONE *)
   47.15  (*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\* )
   47.16 @@ -133,8 +133,8 @@
   47.17  fun rule2stac _ (Rule.Thm (thmID, _)) = Try $ (Repeat $ (Rew $ HOLogic.mk_string thmID))
   47.18    | rule2stac thy (Rule.Num_Calc (c, _)) = Try $ (Repeat $ (Cal $ HOLogic.mk_string (assoc_calc thy c)))
   47.19    | rule2stac thy (Rule.Cal1 (c, _)) = Try $ (Repeat $ (Ca1 $ HOLogic.mk_string (assoc_calc thy c)))
   47.20 -  | rule2stac _ (Rule.Rls_ rls) = Try $ (Rew_Set $ HOLogic.mk_string (Rule.id_rls rls))
   47.21 -  | rule2stac _ r = raise ERROR ("rule2stac: not applicable to \"" ^ Rule.rule2str r ^ "\"");
   47.22 +  | rule2stac _ (Rule.Rls_ rls) = Try $ (Rew_Set $ HOLogic.mk_string (Rule_Set.id_rls rls))
   47.23 +  | rule2stac _ r = raise ERROR ("rule2stac: not applicable to \"" ^ Rule_Set.rule2str r ^ "\"");
   47.24  fun rule2stac_inst _ (Rule.Thm (thmID, _)) = 
   47.25      Try $ (Repeat $ (Rew_Inst $ Subs $ HOLogic.mk_string thmID))
   47.26    | rule2stac_inst thy (Rule.Num_Calc (c, _)) = 
   47.27 @@ -142,8 +142,8 @@
   47.28    | rule2stac_inst thy (Rule.Cal1 (c, _)) = 
   47.29      Try $ (Repeat $ (Cal $ HOLogic.mk_string (assoc_calc thy c)))
   47.30    | rule2stac_inst _ (Rule.Rls_ rls) = 
   47.31 -    Try $ (Rew_Set_Inst $ Subs $ HOLogic.mk_string (Rule.id_rls rls))
   47.32 -  | rule2stac_inst _ r = raise ERROR ("rule2stac_inst: not applicable to \"" ^ Rule.rule2str r ^ "\"");
   47.33 +    Try $ (Rew_Set_Inst $ Subs $ HOLogic.mk_string (Rule_Set.id_rls rls))
   47.34 +  | rule2stac_inst _ r = raise ERROR ("rule2stac_inst: not applicable to \"" ^ Rule_Set.rule2str r ^ "\"");
   47.35  
   47.36  (*for appropriate nesting take stacs in _reverse_ order*)
   47.37  fun op #>@ sts [s] = SEq $ s $ sts
   47.38 @@ -167,9 +167,9 @@
   47.39    | contain_bdv (Rule.Num_Calc _ :: rs) = contain_bdv rs
   47.40    | contain_bdv (Rule.Cal1 _ :: rs) = contain_bdv rs
   47.41    | contain_bdv (Rule.Rls_ rls :: rs) = 
   47.42 -    contain_bdv (Rule.get_rules rls) orelse contain_bdv rs
   47.43 +    contain_bdv (Rule_Set.get_rules rls) orelse contain_bdv rs
   47.44    | contain_bdv (r :: _) = 
   47.45 -    error ("contain_bdv called with [" ^ Rule.id_rule r ^ ",...]");
   47.46 +    error ("contain_bdv called with [" ^ Rule_Set.id_rule r ^ ",...]");
   47.47  
   47.48  (* filter Frees for free_str and pair their respective types with typ *)
   47.49  fun subst_typ free_str typ frees =
   47.50 @@ -208,24 +208,24 @@
   47.51     # filter the operators for Num_Calc out of the script ?WN111014?
   47.52     use this function while storing (TODO integrate..) into KEStore_Elems.add_rlss
   47.53  *)
   47.54 -fun prep_rls _ Rule.Erls = error "prep_rls: not required for Erls"
   47.55 -  | prep_rls thy (Rule.Rls {id, preconds, rew_ord, erls, srls, rules, errpatts, ...}) = 
   47.56 +fun prep_rls _ Rule_Set.Erls = error "prep_rls: not required for Erls"
   47.57 +  | prep_rls thy (Rule_Set.Rls {id, preconds, rew_ord, erls, srls, rules, errpatts, ...}) = 
   47.58        let
   47.59          val sc = (rules2scr_Rls thy rules)
   47.60        in
   47.61 -        Rule.Rls {id = id, preconds = preconds, rew_ord = rew_ord, erls = erls, srls = srls,
   47.62 +        Rule_Set.Rls {id = id, preconds = preconds, rew_ord = rew_ord, erls = erls, srls = srls,
   47.63    	      calc = get_calcs thy sc,
   47.64    	      rules = rules, errpatts = errpatts,
   47.65    	      scr = Rule.EmptyScr (*Rule.Prog sc  AD-HOC REPLACED BY Auto_Prog.gen*)} end
   47.66 -  | prep_rls thy (Rule.Seq {id, preconds, rew_ord, erls, srls, rules, errpatts, ...}) = 
   47.67 +  | prep_rls thy (Rule_Set.Seq {id, preconds, rew_ord, erls, srls, rules, errpatts, ...}) = 
   47.68        let
   47.69          val sc = (rules2scr_Seq thy rules)
   47.70        in
   47.71 -        Rule.Seq {id = id, preconds = preconds, rew_ord = rew_ord, erls = erls, srls = srls,
   47.72 +        Rule_Set.Seq {id = id, preconds = preconds, rew_ord = rew_ord, erls = erls, srls = srls,
   47.73  	        calc = get_calcs thy sc,
   47.74  	        rules = rules, errpatts = errpatts,
   47.75    	      scr = Rule.EmptyScr (*Rule.Prog sc  AD-HOC REPLACED BY Auto_Prog.gen*)} end
   47.76 -  | prep_rls _ (Rule.Rrls {id, ...}) = 
   47.77 +  | prep_rls _ (Rule_Set.Rrls {id, ...}) = 
   47.78        error ("prep_rls: not required for Rrls \"" ^ id ^ "\"");
   47.79  
   47.80  (* on the fly generate a Prog from an rls for Detail_Step.go.
   47.81 @@ -235,9 +235,9 @@
   47.82  fun gen thy t rls =
   47.83    let
   47.84      val prog = case rls of
   47.85 -	      Rule.Rls {rules, ...} => rules2scr_Rls thy rules
   47.86 -	    | Rule.Seq {rules, ...} => rules2scr_Seq thy rules
   47.87 -	    | _ => raise ERROR ("Auto_Prog.gen: not for rule-set \"" ^ Rule.id_rls rls ^ "\"")
   47.88 +	      Rule_Set.Rls {rules, ...} => rules2scr_Rls thy rules
   47.89 +	    | Rule_Set.Seq {rules, ...} => rules2scr_Seq thy rules
   47.90 +	    | _ => raise ERROR ("Auto_Prog.gen: not for rule-set \"" ^ Rule_Set.id_rls rls ^ "\"")
   47.91    in
   47.92      subst_typs prog (type_of t) (TermC.guess_bdv_typ t)
   47.93    end
    48.1 --- a/src/Tools/isac/ProgLang/ListC.thy	Wed Apr 01 19:20:05 2020 +0200
    48.2 +++ b/src/Tools/isac/ProgLang/ListC.thy	Sat Apr 04 12:11:32 2020 +0200
    48.3 @@ -130,53 +130,53 @@
    48.4  subsection \<open>rule set for evaluating Porg_Expr, will be extended in several thys\<close>
    48.5  ML \<open>
    48.6  \<close> ML \<open>
    48.7 -val prog_expr = 
    48.8 -  Rule.Rls {id = "prog_expr", preconds = [], rew_ord = ("dummy_ord", Rule.dummy_ord), 
    48.9 -    erls = Rule.Erls, srls = Rule.Erls, calc = [], errpatts = [],
   48.10 -    rules = [Rule.Thm ("refl", TermC.num_str @{thm refl}),  (*'a<>b -> FALSE' by fun eval_equal*)
   48.11 -       Rule.Thm ("o_apply", TermC.num_str @{thm o_apply}),
   48.12 +val prog_expr =
   48.13 +  Rule_Def.Rls {id = "prog_expr", preconds = [], rew_ord = ("dummy_ord", Rule.dummy_ord), 
   48.14 +    erls = Rule_Def.Erls, srls = Rule_Def.Erls, calc = [], errpatts = [],
   48.15 +    rules = [Rule_Def.Thm ("refl", TermC.num_str @{thm refl}),  (*'a<>b -> FALSE' by fun eval_equal*)
   48.16 +       Rule_Def.Thm ("o_apply", TermC.num_str @{thm o_apply}),
   48.17  
   48.18 -       Rule.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),(*erls for cond. in Atools.ML*)
   48.19 -       Rule.Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}),
   48.20 -       Rule.Thm ("append_Cons",TermC.num_str @{thm append_Cons}),
   48.21 -       Rule.Thm ("append_Nil",TermC.num_str @{thm append_Nil}),
   48.22 +       Rule_Def.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),(*erls for cond. in Atools.ML*)
   48.23 +       Rule_Def.Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}),
   48.24 +       Rule_Def.Thm ("append_Cons",TermC.num_str @{thm append_Cons}),
   48.25 +       Rule_Def.Thm ("append_Nil",TermC.num_str @{thm append_Nil}),
   48.26  (*       Thm ("butlast_Cons",num_str @{thm butlast_Cons}),
   48.27         Thm ("butlast_Nil",num_str @{thm butlast_Nil}),*)
   48.28 -       Rule.Thm ("concat_Cons",TermC.num_str @{thm concat_Cons}),
   48.29 -       Rule.Thm ("concat_Nil",TermC.num_str @{thm concat_Nil}),
   48.30 -(*       Rule.Thm ("del_base",num_str @{thm del_base}),
   48.31 -       Rule.Thm ("del_rec",num_str @{thm del_rec}), *)
   48.32 +       Rule_Def.Thm ("concat_Cons",TermC.num_str @{thm concat_Cons}),
   48.33 +       Rule_Def.Thm ("concat_Nil",TermC.num_str @{thm concat_Nil}),
   48.34 +(*       Rule_Def.Thm ("del_base",num_str @{thm del_base}),
   48.35 +       Rule_Def.Thm ("del_rec",num_str @{thm del_rec}), *)
   48.36  
   48.37 -       Rule.Thm ("distinct_Cons",TermC.num_str @{thm distinct_Cons}),
   48.38 -       Rule.Thm ("distinct_Nil",TermC.num_str @{thm distinct_Nil}),
   48.39 -       Rule.Thm ("dropWhile_Cons",TermC.num_str @{thm dropWhile_Cons}),
   48.40 -       Rule.Thm ("dropWhile_Nil",TermC.num_str @{thm dropWhile_Nil}),
   48.41 -       Rule.Thm ("filter_Cons",TermC.num_str @{thm filter_Cons}),
   48.42 -       Rule.Thm ("filter_Nil",TermC.num_str @{thm filter_Nil}),
   48.43 -       Rule.Thm ("foldr_Cons",TermC.num_str @{thm foldr_Cons}),
   48.44 -       Rule.Thm ("foldr_Nil",TermC.num_str @{thm foldr_Nil}),
   48.45 -       Rule.Thm ("hd_thm",TermC.num_str @{thm hd_thm}),
   48.46 -       Rule.Thm ("LAST",TermC.num_str @{thm LAST}),
   48.47 -       Rule.Thm ("LENGTH_CONS",TermC.num_str @{thm LENGTH_CONS}),
   48.48 -       Rule.Thm ("LENGTH_NIL",TermC.num_str @{thm LENGTH_NIL}),
   48.49 -(*       Rule.Thm ("list_diff_def",num_str @{thm list_diff_def}),*)
   48.50 -       Rule.Thm ("map_Cons",TermC.num_str @{thm map_Cons}),
   48.51 -       Rule.Thm ("map_Nil",TermC.num_str @{thm map_Cons}),
   48.52 -(*       Rule.Thm ("mem_Cons",TermC.num_str @{thm mem_Cons}),
   48.53 -       Rule.Thm ("mem_Nil",TermC.num_str @{thm mem_Nil}), *)
   48.54 -(*       Rule.Thm ("null_Cons",TermC.num_str @{thm null_Cons}),
   48.55 -       Rule.Thm ("null_Nil",TermC.num_str @{thm null_Nil}),*)
   48.56 -       Rule.Thm ("remdups_Cons",TermC.num_str @{thm remdups_Cons}),
   48.57 -       Rule.Thm ("remdups_Nil",TermC.num_str @{thm remdups_Nil}),
   48.58 -       Rule.Thm ("rev_Cons",TermC.num_str @{thm rev_Cons}),
   48.59 -       Rule.Thm ("rev_Nil",TermC.num_str @{thm rev_Nil}),
   48.60 -       Rule.Thm ("take_Nil",TermC.num_str @{thm take_Nil}),
   48.61 -       Rule.Thm ("take_Cons",TermC.num_str @{thm take_Cons}),
   48.62 -       Rule.Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}),
   48.63 -       Rule.Thm ("tl_Nil",TermC.num_str @{thm tl_Nil}),
   48.64 -       Rule.Thm ("zip_Cons",TermC.num_str @{thm zip_Cons}),
   48.65 -       Rule.Thm ("zip_Nil",TermC.num_str @{thm zip_Nil})],
   48.66 -    scr = Rule.EmptyScr}: Rule.rls;
   48.67 +       Rule_Def.Thm ("distinct_Cons",TermC.num_str @{thm distinct_Cons}),
   48.68 +       Rule_Def.Thm ("distinct_Nil",TermC.num_str @{thm distinct_Nil}),
   48.69 +       Rule_Def.Thm ("dropWhile_Cons",TermC.num_str @{thm dropWhile_Cons}),
   48.70 +       Rule_Def.Thm ("dropWhile_Nil",TermC.num_str @{thm dropWhile_Nil}),
   48.71 +       Rule_Def.Thm ("filter_Cons",TermC.num_str @{thm filter_Cons}),
   48.72 +       Rule_Def.Thm ("filter_Nil",TermC.num_str @{thm filter_Nil}),
   48.73 +       Rule_Def.Thm ("foldr_Cons",TermC.num_str @{thm foldr_Cons}),
   48.74 +       Rule_Def.Thm ("foldr_Nil",TermC.num_str @{thm foldr_Nil}),
   48.75 +       Rule_Def.Thm ("hd_thm",TermC.num_str @{thm hd_thm}),
   48.76 +       Rule_Def.Thm ("LAST",TermC.num_str @{thm LAST}),
   48.77 +       Rule_Def.Thm ("LENGTH_CONS",TermC.num_str @{thm LENGTH_CONS}),
   48.78 +       Rule_Def.Thm ("LENGTH_NIL",TermC.num_str @{thm LENGTH_NIL}),
   48.79 +(*       Rule_Def.Thm ("list_diff_def",num_str @{thm list_diff_def}),*)
   48.80 +       Rule_Def.Thm ("map_Cons",TermC.num_str @{thm map_Cons}),
   48.81 +       Rule_Def.Thm ("map_Nil",TermC.num_str @{thm map_Cons}),
   48.82 +(*       Rule_Def.Thm ("mem_Cons",TermC.num_str @{thm mem_Cons}),
   48.83 +       Rule_Def.Thm ("mem_Nil",TermC.num_str @{thm mem_Nil}), *)
   48.84 +(*       Rule_Def.Thm ("null_Cons",TermC.num_str @{thm null_Cons}),
   48.85 +       Rule_Def.Thm ("null_Nil",TermC.num_str @{thm null_Nil}),*)
   48.86 +       Rule_Def.Thm ("remdups_Cons",TermC.num_str @{thm remdups_Cons}),
   48.87 +       Rule_Def.Thm ("remdups_Nil",TermC.num_str @{thm remdups_Nil}),
   48.88 +       Rule_Def.Thm ("rev_Cons",TermC.num_str @{thm rev_Cons}),
   48.89 +       Rule_Def.Thm ("rev_Nil",TermC.num_str @{thm rev_Nil}),
   48.90 +       Rule_Def.Thm ("take_Nil",TermC.num_str @{thm take_Nil}),
   48.91 +       Rule_Def.Thm ("take_Cons",TermC.num_str @{thm take_Cons}),
   48.92 +       Rule_Def.Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}),
   48.93 +       Rule_Def.Thm ("tl_Nil",TermC.num_str @{thm tl_Nil}),
   48.94 +       Rule_Def.Thm ("zip_Cons",TermC.num_str @{thm zip_Cons}),
   48.95 +       Rule_Def.Thm ("zip_Nil",TermC.num_str @{thm zip_Nil})],
   48.96 +    scr = Rule_Def.EmptyScr}: Rule_Set.rls;
   48.97  \<close>
   48.98  setup \<open>KEStore_Elems.add_rlss [("prog_expr", (Context.theory_name @{theory}, prog_expr))]\<close>
   48.99  
    49.1 --- a/src/Tools/isac/ProgLang/Prog_Expr.thy	Wed Apr 01 19:20:05 2020 +0200
    49.2 +++ b/src/Tools/isac/ProgLang/Prog_Expr.thy	Sat Apr 04 12:11:32 2020 +0200
    49.3 @@ -360,13 +360,13 @@
    49.4  > reflI;
    49.5  val it = "(?t = ?t) = True"
    49.6  > val t = str2term "x = 0";
    49.7 -> val NONE = rewrite_ thy Rule.dummy_ord Rule.e_rls false reflI t;
    49.8 +> val NONE = rewrite_ thy Rule.dummy_ord Rule_Set.e_rls false reflI t;
    49.9  
   49.10  > val t = str2term "1 = 0";
   49.11 -> val NONE = rewrite_ thy Rule.dummy_ord Rule.e_rls false reflI t;
   49.12 +> val NONE = rewrite_ thy Rule.dummy_ord Rule_Set.e_rls false reflI t;
   49.13  ----------- thus needs Rule.Num_Calc !
   49.14  > val t = str2term "0 = 0";
   49.15 -> val SOME (t',_) = rewrite_ thy Rule.dummy_ord Rule.e_rls false reflI t;
   49.16 +> val SOME (t',_) = rewrite_ thy Rule.dummy_ord Rule_Set.e_rls false reflI t;
   49.17  > Rule.term2str t';
   49.18  val it = "HOL.True"
   49.19  
   49.20 @@ -533,7 +533,7 @@
   49.21  
   49.22  subsection \<open>extend rule-set for evaluating pre-conditions and program-expressions\<close>
   49.23  ML \<open>
   49.24 -val prog_expr = Rule.append_rls "prog_expr" prog_expr [Rule.Num_Calc ("Prog_Expr.rhs", Prog_Expr.eval_rhs "")];
   49.25 +val prog_expr = Rule_Set.append_rls "prog_expr" prog_expr [Rule.Num_Calc ("Prog_Expr.rhs", Prog_Expr.eval_rhs "")];
   49.26  \<close> ML \<open>
   49.27  \<close> ML \<open>
   49.28  \<close>
    50.1 --- a/src/Tools/isac/ProgLang/calculate.sml	Wed Apr 01 19:20:05 2020 +0200
    50.2 +++ b/src/Tools/isac/ProgLang/calculate.sml	Sat Apr 04 12:11:32 2020 +0200
    50.3 @@ -12,7 +12,7 @@
    50.4      val gcd: int -> int -> int
    50.5      val sqrt: int -> int
    50.6      val adhoc_thm: theory -> string * Rule.eval_fn -> term -> (string * thm) option
    50.7 -    val adhoc_thm1_: theory -> Rule.cal -> term -> (string * thm) option
    50.8 +    val adhoc_thm1_: theory -> Rule_Set.cal -> term -> (string * thm) option
    50.9      val norm: term -> term
   50.10      val popt2str: ('a * term) option -> string
   50.11      val numeral: term -> ((int * int) * (int * int)) option
    51.1 --- a/src/Tools/isac/ProgLang/rewrite.sml	Wed Apr 01 19:20:05 2020 +0200
    51.2 +++ b/src/Tools/isac/ProgLang/rewrite.sml	Sat Apr 04 12:11:32 2020 +0200
    51.3 @@ -7,28 +7,28 @@
    51.4      val assoc_thm': theory -> Celem.thm' -> thm
    51.5      val assoc_thm'': theory -> Celem.thmID -> thm
    51.6      val calculate_: theory -> string * Rule.eval_fn -> term -> (term * (string * thm)) option
    51.7 -    val eval__true: theory -> int -> term list -> (term * term) list -> Rule.rls -> term list * bool
    51.8 -    val eval_prog_expr: theory -> Rule.rls -> term -> term
    51.9 -    val eval_true_: theory -> Rule.rls -> term -> bool
   51.10 -    val eval_true: theory -> term list -> Rule.rls -> bool
   51.11 +    val eval__true: theory -> int -> term list -> (term * term) list -> Rule_Set.rls -> term list * bool
   51.12 +    val eval_prog_expr: theory -> Rule_Set.rls -> term -> term
   51.13 +    val eval_true_: theory -> Rule_Set.rls -> term -> bool
   51.14 +    val eval_true: theory -> term list -> Rule_Set.rls -> bool
   51.15      val rew_sub: theory -> int -> (term * term) list -> ((term * term) list -> term * term -> bool)
   51.16 -      -> Rule.rls -> bool -> TermC.path -> term -> term -> term * term list * TermC.path * bool
   51.17 -    val rewrite_: theory -> ((term * term) list -> term * term -> bool) -> Rule.rls -> bool -> thm ->
   51.18 +      -> Rule_Set.rls -> bool -> TermC.path -> term -> term -> term * term list * TermC.path * bool
   51.19 +    val rewrite_: theory -> ((term * term) list -> term * term -> bool) -> Rule_Set.rls -> bool -> thm ->
   51.20        term -> (term * term list) option
   51.21 -    val rewrite_inst_: theory -> ((term * term) list -> term * term -> bool) -> Rule.rls -> bool
   51.22 +    val rewrite_inst_: theory -> ((term * term) list -> term * term -> bool) -> Rule_Set.rls -> bool
   51.23        -> (term * term) list -> thm -> term -> (term * term list) option
   51.24 -    val rewrite_set_: theory -> bool -> Rule.rls -> term -> (term * term list) option
   51.25 -    val rewrite_set_inst_: theory -> bool -> (term * term) list -> Rule.rls -> term -> (term * term list) option
   51.26 -    val rewrite_terms_: theory -> ((term * term) list -> term * term -> bool) -> Rule.rls -> term list
   51.27 +    val rewrite_set_: theory -> bool -> Rule_Set.rls -> term -> (term * term list) option
   51.28 +    val rewrite_set_inst_: theory -> bool -> (term * term) list -> Rule_Set.rls -> term -> (term * term list) option
   51.29 +    val rewrite_terms_: theory -> ((term * term) list -> term * term -> bool) -> Rule_Set.rls -> term list
   51.30        -> term -> (term * term list) option
   51.31  (* ---- for tests only: shifted from below to remove the Warning "unused" at fun.def. --------- *)
   51.32    (* NONE *)
   51.33  (*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\* )
   51.34      val rewrite__: theory -> int -> (term * term) list -> ((term * term) list -> term * term -> bool) ->
   51.35 -      Rule.rls -> bool -> thm -> term -> (term * term list) option
   51.36 -    val rewrite__set_: theory -> int -> bool -> (term * term) list -> Rule.rls -> term -> (term * term list) option
   51.37 -    val app_rev: theory -> int -> Rule.rls -> term -> term * term list * bool
   51.38 -    val app_sub: theory -> int -> Rule.rls -> term -> term * term list * bool
   51.39 +      Rule_Set.rls -> bool -> thm -> term -> (term * term list) option
   51.40 +    val rewrite__set_: theory -> int -> bool -> (term * term) list -> Rule_Set.rls -> term -> (term * term list) option
   51.41 +    val app_rev: theory -> int -> Rule_Set.rls -> term -> term * term list * bool
   51.42 +    val app_sub: theory -> int -> Rule_Set.rls -> term -> term * term list * bool
   51.43      val mk_thm: theory -> string -> thm
   51.44      val trace1: int -> string -> unit
   51.45  ( *\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*)
   51.46 @@ -121,11 +121,11 @@
   51.47              (*asm false .. thm not applied ^^^; continue until False vvv*)
   51.48              else chk (indets @ [t] @ a') asms);
   51.49        in chk [] asms end
   51.50 -and rewrite__set_ thy _ __ Rule.Erls t =                             (* rewrite with a rule set *)
   51.51 +and rewrite__set_ thy _ __ Rule_Set.Erls t =                             (* rewrite with a rule set *)
   51.52      error ("rewrite__set_ called with 'Erls' for '" ^ Rule.t2str thy t ^ "'")
   51.53 -  | rewrite__set_ thy i _ _ (rrls as Rule.Rrls _) t =      (* rewrite with a 'reverse rule set' *)
   51.54 +  | rewrite__set_ thy i _ _ (rrls as Rule_Set.Rrls _) t =      (* rewrite with a 'reverse rule set' *)
   51.55      let
   51.56 -      val _= trace i (" rls: " ^ Rule.id_rls rrls ^ " on: " ^ Rule.t2str thy t)
   51.57 +      val _= trace i (" rls: " ^ Rule_Set.id_rls rrls ^ " on: " ^ Rule.t2str thy t)
   51.58  	    val (t', asm, rew) = app_rev thy (i + 1) rrls t                   
   51.59      in if rew then SOME (t', distinct asm) else NONE end
   51.60    | rewrite__set_ thy i put_asm bdv rls ct =          (* Rls, Seq containing Thms or Num_Calc, Cal1 *)
   51.61 @@ -134,15 +134,15 @@
   51.62        datatype switch = Appl | Noap;
   51.63        fun rew_once _ asm ct Noap [] = (ct, asm)         (* ?TODO unify with Prog_Expr.rew_once? *)
   51.64          | rew_once ruls asm ct Appl [] = 
   51.65 -          (case rls of Rule.Rls _ => rew_once ruls asm ct Noap ruls
   51.66 -          | Rule.Seq _ => (ct, asm)
   51.67 -          | rls => raise ERROR ("rew_once not appl. to \"" ^ Rule.rls2str rls ^ "\""))
   51.68 +          (case rls of Rule_Set.Rls _ => rew_once ruls asm ct Noap ruls
   51.69 +          | Rule_Set.Seq _ => (ct, asm)
   51.70 +          | rls => raise ERROR ("rew_once not appl. to \"" ^ Rule_Set.rls2str rls ^ "\""))
   51.71          | rew_once ruls asm ct apno (rul :: thms) =
   51.72            case rul of
   51.73              Rule.Thm (thmid, thm) =>
   51.74                (trace1 i (" try thm: \"" ^ thmid ^ "\"");
   51.75 -              case rewrite__ thy (i + 1) bdv ((snd o #rew_ord o Rule.rep_rls) rls)
   51.76 -                  ((#erls o Rule.rep_rls) rls) put_asm thm ct of
   51.77 +              case rewrite__ thy (i + 1) bdv ((snd o #rew_ord o Rule_Set.rep_rls) rls)
   51.78 +                  ((#erls o Rule_Set.rep_rls) rls) put_asm thm ct of
   51.79                  NONE => rew_once ruls asm ct apno thms
   51.80                | SOME (ct', asm') => 
   51.81                  (trace1 i (" rewrites to: \"" ^ Rule.t2str thy ct' ^ "\"");
   51.82 @@ -155,8 +155,8 @@
   51.83                  NONE => rew_once ruls asm ct apno thms
   51.84                | SOME (_, thm') => 
   51.85                  let 
   51.86 -                  val pairopt = rewrite__ thy (i + 1) bdv ((snd o #rew_ord o Rule.rep_rls) rls)
   51.87 -                    ((#erls o Rule.rep_rls) rls) put_asm thm' ct;
   51.88 +                  val pairopt = rewrite__ thy (i + 1) bdv ((snd o #rew_ord o Rule_Set.rep_rls) rls)
   51.89 +                    ((#erls o Rule_Set.rep_rls) rls) put_asm thm' ct;
   51.90                    val _ = if pairopt <> NONE then () else error ("rewrite_set_, rewrite_ \"" ^ 
   51.91                      Rule.string_of_thmI thm' ^ "\" " ^ Rule.t2str thy ct ^ " = NONE")
   51.92                    val _ = trace1 i (" calc. to: " ^ Rule.t2str thy ((fst o the) pairopt))
   51.93 @@ -169,8 +169,8 @@
   51.94                  NONE => (ct, asm)
   51.95                | SOME (_, thm') =>
   51.96                  let 
   51.97 -                  val pairopt = rewrite__ thy (i + 1) bdv ((snd o #rew_ord o Rule.rep_rls) rls)
   51.98 -                    ((#erls o Rule.rep_rls) rls) put_asm thm' ct;
   51.99 +                  val pairopt = rewrite__ thy (i + 1) bdv ((snd o #rew_ord o Rule_Set.rep_rls) rls)
  51.100 +                    ((#erls o Rule_Set.rep_rls) rls) put_asm thm' ct;
  51.101                    val _ = if pairopt <> NONE then () else error ("rewrite_set_, rewrite_ \"" ^
  51.102                       Rule.string_of_thmI thm' ^ "\" " ^ Rule.t2str thy ct ^ " = NONE")
  51.103                    val _ = trace1 i (" cal1. to: " ^ Rule.t2str thy ((fst o the) pairopt))
  51.104 @@ -180,9 +180,9 @@
  51.105              (case rewrite__set_ thy (i + 1) put_asm bdv rls' ct of
  51.106                SOME (t', asm') => rew_once ruls (union (op =) asm asm') t' Appl thms
  51.107              | NONE => rew_once ruls asm ct apno thms)
  51.108 -          | r => raise ERROR ("rew_once not appl. to \"" ^ Rule.rule2str r ^ "\"");
  51.109 -      val ruls = (#rules o Rule.rep_rls) rls;
  51.110 -      val _ = trace i (" rls: " ^ Rule.id_rls rls ^ " on: " ^ Rule.t2str thy ct)
  51.111 +          | r => raise ERROR ("rew_once not appl. to \"" ^ Rule_Set.rule2str r ^ "\"");
  51.112 +      val ruls = (#rules o Rule_Set.rep_rls) rls;
  51.113 +      val _ = trace i (" rls: " ^ Rule_Set.id_rls rls ^ " on: " ^ Rule.t2str thy ct)
  51.114        val (ct', asm') = rew_once ruls [] ct Noap ruls;
  51.115  	  in if ct = ct' then NONE else SOME (ct', distinct asm') end
  51.116  (*------------------------
  51.117 @@ -204,9 +204,9 @@
  51.118                 if f pp then true else scan_ f pps;
  51.119          in scan_ chk prepat end;
  51.120      (* apply the normal_form of a rev-set *)
  51.121 -    fun app_rev' thy (Rule.Rrls {erls, prepat, scr = Rule.Rfuns {normal_form, ...}, ...}) t =
  51.122 +    fun app_rev' thy (Rule_Set.Rrls {erls, prepat, scr = Rule.Rfuns {normal_form, ...}, ...}) t =
  51.123        if chk_prepat thy erls prepat t then normal_form t else NONE
  51.124 -      | app_rev' _ r _ = raise ERROR ("app_rev' not appl. to \"" ^ Rule.rls2str r ^ "\"");
  51.125 +      | app_rev' _ r _ = raise ERROR ("app_rev' not appl. to \"" ^ Rule_Set.rls2str r ^ "\"");
  51.126      val opt = app_rev' thy rrls t
  51.127    in
  51.128      case opt of
  51.129 @@ -269,7 +269,7 @@
  51.130      in case Num_Calc.adhoc_thm thy isa_fn ct of
  51.131  	   NONE => NONE
  51.132  	 | SOME (thmID, thm) =>
  51.133 -	   (let val rew = case rewrite_ thy Rule.dummy_ord Rule.e_rls false thm ct of
  51.134 +	   (let val rew = case rewrite_ thy Rule.dummy_ord Rule_Set.e_rls false thm ct of
  51.135           SOME (rew, _) => rew
  51.136         | NONE => raise ERROR ""
  51.137       in SOME (rew, (thmID, thm)) end)
    52.1 --- a/src/Tools/isac/Specify/appl.sml	Wed Apr 01 19:20:05 2020 +0200
    52.2 +++ b/src/Tools/isac/Specify/appl.sml	Sat Apr 04 12:11:32 2020 +0200
    52.3 @@ -23,13 +23,13 @@
    52.4  open Ctree
    52.5  open Pos
    52.6  
    52.7 -fun rew_info (Rule.Rls {erls, rew_ord = (rew_ord', _), calc = ca, ...}) =
    52.8 +fun rew_info (Rule_Set.Rls {erls, rew_ord = (rew_ord', _), calc = ca, ...}) =
    52.9      (rew_ord', erls, ca)
   52.10 -  | rew_info (Rule.Seq {erls, rew_ord = (rew_ord', _), calc = ca, ...}) =
   52.11 +  | rew_info (Rule_Set.Seq {erls, rew_ord = (rew_ord', _), calc = ca, ...}) =
   52.12      (rew_ord', erls, ca)
   52.13 -  | rew_info (Rule.Rrls {erls, rew_ord = (rew_ord', _), calc = ca, ...}) =
   52.14 +  | rew_info (Rule_Set.Rrls {erls, rew_ord = (rew_ord', _), calc = ca, ...}) =
   52.15      (rew_ord', erls, ca)
   52.16 -  | rew_info rls = error ("rew_info called with '" ^ Rule.rls2str rls ^ "'");
   52.17 +  | rew_info rls = error ("rew_info called with '" ^ Rule_Set.rls2str rls ^ "'");
   52.18  
   52.19  (*FIXME.3.4.03:re-organize from_pblobj_or_detail_thm after rls' --> rls*)
   52.20  fun from_pblobj_or_detail_thm _ p pt = 
   52.21 @@ -62,7 +62,7 @@
   52.22  	    in
   52.23  	      case opt of
   52.24  	        SOME isa_fn => ("OK", thy', isa_fn)
   52.25 -	      | NONE => ("applicable_in Calculate: unknown '" ^ scrop ^ "'", "", ("", Rule.e_evalfn))
   52.26 +	      | NONE => ("applicable_in Calculate: unknown '" ^ scrop ^ "'", "", ("", Rule_Set.e_evalfn))
   52.27  	    end
   52.28      else 
   52.29  		  let
   52.30 @@ -71,7 +71,7 @@
   52.31  		  in
   52.32  		    case assoc (scr_isa_fns, scrop) of
   52.33  		      SOME isa_fn => ("OK",thy',isa_fn)
   52.34 -		    | NONE => ("applicable_in Calculate: unknown '" ^ scrop ^ "'", "", ("", Rule.e_evalfn))
   52.35 +		    | NONE => ("applicable_in Calculate: unknown '" ^ scrop ^ "'", "", ("", Rule_Set.e_evalfn))
   52.36  		  end
   52.37    end;
   52.38  
    53.1 --- a/src/Tools/isac/Specify/generate.sml	Wed Apr 01 19:20:05 2020 +0200
    53.2 +++ b/src/Tools/isac/Specify/generate.sml	Sat Apr 04 12:11:32 2020 +0200
    53.3 @@ -264,7 +264,7 @@
    53.4    | generate1 (Tactic.Rewrite_Set_Inst' (_, _, subs', rls', f, (f', asm))) (is, ctxt) (pt, (p, _)) =
    53.5      let
    53.6        val (pt, c) = cappend_atomic pt p (is, ctxt) f 
    53.7 -        (Tactic.Rewrite_Set_Inst (Selem.subst2subs subs', Rule.id_rls rls')) (f', asm) Complete
    53.8 +        (Tactic.Rewrite_Set_Inst (Selem.subst2subs subs', Rule_Set.id_rls rls')) (f', asm) Complete
    53.9        val pt = update_branch pt p TransitiveB
   53.10      in
   53.11        ((p, Res), c, FormKF (Rule.term2str f'), pt)
   53.12 @@ -273,7 +273,7 @@
   53.13      let
   53.14        val (pt, _) = cappend_form pt p (is, ctxt) f 
   53.15        val pt = update_branch pt p TransitiveB
   53.16 -      val is = init_istate (Tactic.Rewrite_Set_Inst (Selem.subst2subs subs, Rule.id_rls rls)) f 
   53.17 +      val is = init_istate (Tactic.Rewrite_Set_Inst (Selem.subst2subs subs, Rule_Set.id_rls rls)) f 
   53.18        val tac_ = Tactic.Apply_Method' (Celem.e_metID, SOME Rule.e_term (*t ..has not been declared*), is, ctxt)
   53.19        val pos' = ((lev_on o lev_dn) p, Frm)
   53.20      in
   53.21 @@ -282,7 +282,7 @@
   53.22    | generate1 (Tactic.Rewrite_Set' (_, _, rls', f, (f', asm))) (is, ctxt) (pt, (p, _)) =
   53.23      let
   53.24        val (pt, c) = cappend_atomic pt p (is, ctxt) f 
   53.25 -        (Tactic.Rewrite_Set (Rule.id_rls rls')) (f', asm) Complete
   53.26 +        (Tactic.Rewrite_Set (Rule_Set.id_rls rls')) (f', asm) Complete
   53.27        val pt = update_branch pt p TransitiveB
   53.28      in
   53.29        ((p, Res), c, FormKF (Rule.term2str f'), pt)
   53.30 @@ -291,7 +291,7 @@
   53.31      let
   53.32        val (pt, _) = cappend_form pt p (is, ctxt) f 
   53.33        val pt = update_branch pt p TransitiveB
   53.34 -      val is = init_istate (Tactic.Rewrite_Set (Rule.id_rls rls)) f
   53.35 +      val is = init_istate (Tactic.Rewrite_Set (Rule_Set.id_rls rls)) f
   53.36        val tac_ = Tactic.Apply_Method' (Celem.e_metID, SOME Rule.e_term (*t ..has not been declared*), is, ctxt)
   53.37        val pos' = ((lev_on o lev_dn) p, Frm)
   53.38      in
   53.39 @@ -401,7 +401,7 @@
   53.40      			(pos_plus (length tacis) (lev_dn p, Res), (new_val res ist, ctxt)))]
   53.41      	val {nrls, ...} = Specify.get_met (get_obj g_metID pt (par_pblobj pt p))
   53.42      	val (pt, c, pos as (p, _)) = generate (rev tacis) (pt, [], (p, Res))
   53.43 -    	val pt = update_tac pt p (Tactic.Derive (Rule.id_rls nrls))
   53.44 +    	val pt = update_tac pt p (Tactic.Derive (Rule_Set.id_rls nrls))
   53.45      	val pt = update_branch pt p TransitiveB
   53.46      in (c, (pt, pos: pos')) end
   53.47    | embed_deriv tacis (pt, (p, Res)) =
   53.48 @@ -418,7 +418,7 @@
   53.49      			(pos_plus (length tacis) (lev_dn p, Res), (new_val res ist, ctxt)))];
   53.50      	val {nrls, ...} = Specify.get_met (get_obj g_metID pt (par_pblobj pt p))
   53.51      	val (pt, c, pos as (p, _)) = generate (rev tacis) (pt, [], (p, Res))
   53.52 -    	val pt = update_tac pt p (Tactic.Derive (Rule.id_rls nrls))
   53.53 +    	val pt = update_tac pt p (Tactic.Derive (Rule_Set.id_rls nrls))
   53.54      	val pt = update_branch pt p TransitiveB
   53.55      in (c, (pt, pos)) end
   53.56    | embed_deriv _ _ = error "embed_deriv: uncovered definition"
    54.1 --- a/src/Tools/isac/Specify/ptyps.sml	Wed Apr 01 19:20:05 2020 +0200
    54.2 +++ b/src/Tools/isac/Specify/ptyps.sml	Sat Apr 04 12:11:32 2020 +0200
    54.3 @@ -14,7 +14,7 @@
    54.4    val prep_ori : Selem.fmz_ -> theory -> field list -> Model.ori list * Proof.context
    54.5    val add_id : 'a list -> (int * 'a) list
    54.6    val add_field' : theory -> field list -> Model.ori list -> Model.ori list
    54.7 -  val match_itms_oris : theory -> Model.itm list -> field list * term list * Rule.rls ->
    54.8 +  val match_itms_oris : theory -> Model.itm list -> field list * term list * Rule_Set.rls ->
    54.9      Model.ori list -> bool * (Model.itm list * (bool * term) list)
   54.10    val refine_ori : Model.ori list -> Celem.pblID -> Celem.pblID option
   54.11    val refine_ori' : Model.ori list -> Celem.pblID -> Celem.pblID
   54.12 @@ -42,12 +42,12 @@
   54.13    val guh2kestoreID : Celem.guh -> string list                             (* for interface.sml *)
   54.14    (* for Knowledge/, if below at left margin *)
   54.15    val prep_pbt : theory -> Celem.guh -> string list -> Celem.pblID ->
   54.16 -    string list * (string * string list) list * Rule.rls * string option * Celem.metID list ->
   54.17 +    string list * (string * string list) list * Rule_Set.rls * string option * Celem.metID list ->
   54.18        Celem.pbt * Celem.pblID
   54.19    val prep_met : theory -> string -> string list -> Celem.pblID ->
   54.20       string list * (string * string list) list *
   54.21 -       {calc: 'a, crls: Rule.rls, errpats: Rule.errpat list, nrls: Rule.rls, prls: Rule.rls,
   54.22 -         rew_ord': Rule.rew_ord', rls': Rule.rls, srls: Rule.rls} * thm ->
   54.23 +       {calc: 'a, crls: Rule_Set.rls, errpats: Rule.errpat list, nrls: Rule_Set.rls, prls: Rule_Set.rls,
   54.24 +         rew_ord': Rule_Def.rew_ord', rls': Rule_Set.rls, srls: Rule_Set.rls} * thm ->
   54.25       Celem.met * Celem.metID
   54.26  (* ---- for tests only: shifted from below to remove the Warning "unused" at fun.def. --------- *)
   54.27    val show_ptyps : unit -> unit
    55.1 --- a/src/Tools/isac/TODO.thy	Wed Apr 01 19:20:05 2020 +0200
    55.2 +++ b/src/Tools/isac/TODO.thy	Sat Apr 04 12:11:32 2020 +0200
    55.3 @@ -188,7 +188,7 @@
    55.4    \item Diff.thy: differentiateX --> differentiate after removal of script-constant
    55.5    \item Test.thy: met_test_sqrt2: deleted?!
    55.6    \item xxx          
    55.7 -  \item Rule.rew_ord' := overwritel (! Rule.rew_ord', (*<<<---- use KEStore.xxx, too*)
    55.8 +  \item Rule_Def.rew_ord' := overwritel (! Rule_Def.rew_ord', (*<<<---- use KEStore.xxx, too*)
    55.9    \item xxx
   55.10      \item automatically extrac rls from program-code 
   55.11        ? take ["SignalProcessing", "Z_Transform", "Inverse_sub"] as an example ?
   55.12 @@ -386,17 +386,19 @@
   55.13    \item xxx
   55.14    \item in locate_input_tactic .. ?scan_dn1?; Program.is_eval_expr   .use  Term.exists_Const
   55.15    \item push srls into pstate
   55.16 -  \item lucas-intrpreter.locate_input_tactic: scan_to_tactic1 srls tac cstate (progr, Rule.e_rls)
   55.17 +  \item lucas-intrpreter.locate_input_tactic: scan_to_tactic1 srls tac cstate (progr, Rule_Set.e_rls)
   55.18                                                                                        ^^^^^^^^^^
   55.19    \item xxx
   55.20    \end{itemize}
   55.21  \<close>
   55.22  subsection \<open>Rfuns, Begin_/End_Detail', Rrls, Istate\<close>
   55.23  text \<open>
   55.24 -remove Rfuns -> Rule.Prog, Rule.EmptyScr
   55.25 -consider separating spec.funs. to ?Inter_Steps?
   55.26 +remove refactor Rfuns, Rule.Prog, Rule.EmptyScr, RrlsState: this is a concept never brought to work.
   55.27 +  Clarify relation to reverse rewriting!
   55.28    \begin{itemize}
   55.29 -  \item ^^^+ see from_pblobj_or_detail_thm, from_pblobj_or_detail_calc, ...
   55.30 +  \item separate mut.recursion program with rule and rls by deleting fild scr in rls
   55.31 +    (possible since CS 43160c1e775a
   55.32 +  ` "replace Prog. in prep_rls by Auto_Prog.gen, which generates Prog. on the fly" )
   55.33    \item xxx
   55.34    \item probably only "normal_form" seems to be needed
   55.35    \item deleted Rfuns in NEW "locate_input_tactic": no active test for "locate_rule"
   55.36 @@ -413,6 +415,8 @@
   55.37    \item and do_next (* WN1907: ?only for Begin_/End_Detail' DEL!!!*)
   55.38    \item xxx
   55.39    \item shouldn't go Rfuns from Rewrite --> Rewrite_Set; they behave similar to "fun interSteps" ?
   55.40 +  \item xxx
   55.41 +  \item ?finally Prog could go from Calcelems to ProgLang?
   55.42    \end{itemize}
   55.43  \<close>
   55.44  subsection \<open>Inverse_Z_Transform.thy\<close>
   55.45 @@ -517,7 +521,7 @@
   55.46    \item [*\_prls] 
   55.47    \item [*\_srls] 
   55.48    \end{description}
   55.49 -{\tt Rule.append_rls, Rule.merge_rls, remove_rls} TODO
   55.50 +{\tt Rule_Set.append_rls, Rule_Set.merge_rls, remove_rls} TODO
   55.51  \<close>
   55.52  
   55.53  subsection \<open>get proof-state\<close>
    56.1 --- a/test/Tools/isac/ADDTESTS/accumulate-val/Thy_1.thy	Wed Apr 01 19:20:05 2020 +0200
    56.2 +++ b/test/Tools/isac/ADDTESTS/accumulate-val/Thy_1.thy	Sat Apr 04 12:11:32 2020 +0200
    56.3 @@ -6,7 +6,7 @@
    56.4    length (Test_KEStore_Elems.get_rlss @{theory}) = 0;
    56.5  (*length (! test_ruleset')                  = 1 (* if you have clicked somewhere below *)*)
    56.6  \<close>
    56.7 -setup \<open>Test_KEStore_Elems.add_rlss [("test_list_rls", (Context.theory_name @{theory}, Rule.Erls))]\<close>
    56.8 +setup \<open>Test_KEStore_Elems.add_rlss [("test_list_rls", (Context.theory_name @{theory}, Rule_Set.Erls))]\<close>
    56.9  ML \<open>
   56.10  (*test_ruleset' := overwritelthy @{theory} (! test_ruleset', [("test_list_rls", Erls)])
   56.11    ;
   56.12 @@ -14,6 +14,6 @@
   56.13      else error "removal of Unsynchonized.ref: ruleset' <> Test_KEStore_Elems.get_rlss in Thy_1"*)
   56.14  \<close>
   56.15  
   56.16 -setup \<open>Test_KEStore_Elems.add_calcs [("calc", ("Thy_1", Rule.e_evalfn))]\<close>
   56.17 +setup \<open>Test_KEStore_Elems.add_calcs [("calc", ("Thy_1", Rule_Set.e_evalfn))]\<close>
   56.18  
   56.19  end
    57.1 --- a/test/Tools/isac/ADDTESTS/accumulate-val/Thy_2.thy	Wed Apr 01 19:20:05 2020 +0200
    57.2 +++ b/test/Tools/isac/ADDTESTS/accumulate-val/Thy_2.thy	Sat Apr 04 12:11:32 2020 +0200
    57.3 @@ -1,7 +1,7 @@
    57.4  theory Thy_2 imports Thy_1 begin
    57.5  
    57.6  ML \<open>val test_list_rls =
    57.7 -  Rule.append_rls "test_list_rls" Rule.e_rls
    57.8 +  Rule_Set.append_rls "test_list_rls" Rule_Set.e_rls
    57.9      [Rule.Thm ("refl", @{thm refl}), Rule.Thm ("subst", @{thm subst})]\<close>
   57.10  
   57.11  setup \<open>Test_KEStore_Elems.add_rlss 
    58.1 --- a/test/Tools/isac/ADDTESTS/accumulate-val/Thy_2b.thy	Wed Apr 01 19:20:05 2020 +0200
    58.2 +++ b/test/Tools/isac/ADDTESTS/accumulate-val/Thy_2b.thy	Sat Apr 04 12:11:32 2020 +0200
    58.3 @@ -1,7 +1,7 @@
    58.4  theory Thy_2b imports Thy_1 begin
    58.5  
    58.6  ML \<open>val test_list_rls =
    58.7 -  Rule.append_rls "test_list_rls" Rule.e_rls [Rule.Thm ("False_def", @{thm False_def})]\<close>
    58.8 +  Rule_Set.append_rls "test_list_rls" Rule_Set.e_rls [Rule.Thm ("False_def", @{thm False_def})]\<close>
    58.9  
   58.10  setup \<open>Test_KEStore_Elems.add_rlss [("test_list_rls", (Context.theory_name @{theory},
   58.11    test_list_rls))]\<close>
    59.1 --- a/test/Tools/isac/ADDTESTS/accumulate-val/Thy_3.thy	Wed Apr 01 19:20:05 2020 +0200
    59.2 +++ b/test/Tools/isac/ADDTESTS/accumulate-val/Thy_3.thy	Sat Apr 04 12:11:32 2020 +0200
    59.3 @@ -1,7 +1,7 @@
    59.4  theory Thy_3 imports Thy_2 Thy_2b begin
    59.5  
    59.6  ML \<open>val test_list_rls =
    59.7 -  Rule.append_rls "test_list_rls" Rule.e_rls [Rule.Thm ("not_def", @{thm not_def})]\<close>
    59.8 +  Rule_Set.append_rls "test_list_rls" Rule_Set.e_rls [Rule.Thm ("not_def", @{thm not_def})]\<close>
    59.9  
   59.10  setup \<open>Test_KEStore_Elems.add_rlss (*already added in Thy_1.thy and Thy_2.thy*)
   59.11    [("test_list_rls", (Context.theory_name @{theory}, test_list_rls))]\<close>
   59.12 @@ -16,7 +16,7 @@
   59.13  (*if length (Test_KEStore_Elems.get_rlss @{theory}) = length (! test_ruleset')
   59.14    then () else error "Test_KEStore_Elems.get_rlss = test_ruleset': changed"*)
   59.15    ;
   59.16 -  val SOME (_, Rule.Rls {rules, ...}) =
   59.17 +  val SOME (_, Rule_Set.Rls {rules, ...}) =
   59.18      AList.lookup op= (Test_KEStore_Elems.get_rlss @{theory}) "test_list_rls"
   59.19    ;
   59.20    case rules of
    60.1 --- a/test/Tools/isac/ADDTESTS/accumulate-val/Thy_4.thy	Wed Apr 01 19:20:05 2020 +0200
    60.2 +++ b/test/Tools/isac/ADDTESTS/accumulate-val/Thy_4.thy	Sat Apr 04 12:11:32 2020 +0200
    60.3 @@ -1,6 +1,6 @@
    60.4  theory Thy_4 imports Lucas_Interpreter (*!!!!!*) begin
    60.5  
    60.6  setup \<open>Test_KEStore_Elems.add_rlss
    60.7 -  [("rls1", ("Thy_4", Rule.Erls)), ("rls2", ("Thy_4", Rule.Erls))]\<close>
    60.8 +  [("rls1", ("Thy_4", Rule_Set.Erls)), ("rls2", ("Thy_4", Rule_Set.Erls))]\<close>
    60.9  
   60.10  end
    61.1 --- a/test/Tools/isac/ADDTESTS/accumulate-val/Thy_5.thy	Wed Apr 01 19:20:05 2020 +0200
    61.2 +++ b/test/Tools/isac/ADDTESTS/accumulate-val/Thy_5.thy	Sat Apr 04 12:11:32 2020 +0200
    61.3 @@ -1,5 +1,5 @@
    61.4  theory Thy_5 imports Thy_4 begin
    61.5  
    61.6 -setup \<open>Test_KEStore_Elems.add_rlss [("rls", ("Thy_5", Rule.Erls))]\<close>
    61.7 +setup \<open>Test_KEStore_Elems.add_rlss [("rls", ("Thy_5", Rule_Set.Erls))]\<close>
    61.8  
    61.9  end                             
    62.1 --- a/test/Tools/isac/ADDTESTS/accumulate-val/Thy_All.thy	Wed Apr 01 19:20:05 2020 +0200
    62.2 +++ b/test/Tools/isac/ADDTESTS/accumulate-val/Thy_All.thy	Sat Apr 04 12:11:32 2020 +0200
    62.3 @@ -13,7 +13,7 @@
    62.4  *)
    62.5  ;
    62.6  case Test_KEStore_Elems.get_rlss @{theory} of
    62.7 -  ("rls2", ("Thy_4", Erls)) :: ("rls1", ("Thy_4", Rule.Erls)) :: _ => ()
    62.8 +  ("rls2", ("Thy_4", Erls)) :: ("rls1", ("Thy_4", Rule_Set.Erls)) :: _ => ()
    62.9  | _ => raise error "Test_KEStore_Elems.get_rlss changed"
   62.10  ;
   62.11  case Test_KEStore_Elems.get_calcs @{theory} of
    63.1 --- a/test/Tools/isac/ADDTESTS/accumulate-val/lucas_interpreter.sml	Wed Apr 01 19:20:05 2020 +0200
    63.2 +++ b/test/Tools/isac/ADDTESTS/accumulate-val/lucas_interpreter.sml	Sat Apr 04 12:11:32 2020 +0200
    63.3 @@ -7,10 +7,10 @@
    63.4  *)
    63.5  signature KESTORE_ELEMS =
    63.6  sig
    63.7 -  val get_rlss: theory -> (Rule.rls' * (Rule.theory' * Rule.rls)) list
    63.8 -  val add_rlss: (Rule.rls' * (Rule.theory' * Rule.rls)) list -> theory -> theory
    63.9 -  val get_calcs: theory -> (Rule.prog_calcID * (Rule.calID * Rule.eval_fn)) list
   63.10 -  val add_calcs: (Rule.prog_calcID * (Rule.calID * Rule.eval_fn)) list -> theory -> theory
   63.11 +  val get_rlss: theory -> (Rule_Set.rls' * (Rule.theory' * Rule_Set.rls)) list
   63.12 +  val add_rlss: (Rule_Set.rls' * (Rule.theory' * Rule_Set.rls)) list -> theory -> theory
   63.13 +  val get_calcs: theory -> (Rule_Set.prog_calcID * (Rule.calID * Rule.eval_fn)) list
   63.14 +  val add_calcs: (Rule_Set.prog_calcID * (Rule.calID * Rule.eval_fn)) list -> theory -> theory
   63.15    (*etc*)
   63.16  end;                               
   63.17  
   63.18 @@ -20,7 +20,7 @@
   63.19  
   63.20    fun rls_eq ((id1, (thyID1, _)), (id2, (thyID2, _))) = id1 = id2 (*andalso thyID1 = thyID2*)
   63.21    structure Data = Theory_Data (
   63.22 -    type T = (Rule.rls' * (Rule.theory' * Rule.rls)) list;
   63.23 +    type T = (Rule_Set.rls' * (Rule.theory' * Rule_Set.rls)) list;
   63.24      val empty = [];
   63.25      val extend = I;
   63.26      val merge = merge rls_eq;
   63.27 @@ -30,7 +30,7 @@
   63.28  
   63.29    val calc_eq = rls_eq
   63.30    structure Data = Theory_Data (
   63.31 -    type T = (Rule.prog_calcID * (Rule.calID * Rule.eval_fn)) list;
   63.32 +    type T = (Rule_Set.prog_calcID * (Rule.calID * Rule.eval_fn)) list;
   63.33      val empty = [];
   63.34      val extend = I;
   63.35      val merge = merge calc_eq;
    64.1 --- a/test/Tools/isac/Interpret/ptyps.thy	Wed Apr 01 19:20:05 2020 +0200
    64.2 +++ b/test/Tools/isac/Interpret/ptyps.thy	Sat Apr 04 12:11:32 2020 +0200
    64.3 @@ -14,32 +14,32 @@
    64.4  section \<open>data for test "-ptyps.thy: store test-pbtyps by 'setup' ---"\<close>
    64.5  setup \<open>KEStore_Elems.add_pbts
    64.6  [(Specify.prep_pbt thy "pbl_test_refine" [] Celem.e_pblID
    64.7 -  (["refine", "test"], [], Rule.e_rls, NONE, [])),
    64.8 +  (["refine", "test"], [], Rule_Set.e_rls, NONE, [])),
    64.9  (Specify.prep_pbt @{theory DiffApp} "pbl_pbla" [] Celem.e_pblID
   64.10    (["pbla", "refine", "test"],         
   64.11 -  [("#Given", ["fixedValues a_a"])], Rule.e_rls, NONE, [])),
   64.12 +  [("#Given", ["fixedValues a_a"])], Rule_Set.e_rls, NONE, [])),
   64.13  (Specify.prep_pbt @{theory DiffApp} "pbl_pbla1" [] Celem.e_pblID
   64.14    (["pbla1","pbla", "refine", "test"], 
   64.15 -  [("#Given", ["fixedValues a_a","maximum a_1"])], Rule.e_rls, NONE, [])),
   64.16 +  [("#Given", ["fixedValues a_a","maximum a_1"])], Rule_Set.e_rls, NONE, [])),
   64.17  (Specify.prep_pbt @{theory DiffApp} "pbl_pbla2" [] Celem.e_pblID
   64.18    (["pbla2","pbla", "refine", "test"], 
   64.19 -  [("#Given", ["fixedValues a_a","valuesFor a_2"])], Rule.e_rls, NONE, [])),
   64.20 +  [("#Given", ["fixedValues a_a","valuesFor a_2"])], Rule_Set.e_rls, NONE, [])),
   64.21  (Specify.prep_pbt @{theory DiffApp} "pbl_pbla2x" [] Celem.e_pblID
   64.22    (["pbla2x","pbla2","pbla", "refine", "test"],
   64.23    [("#Given", ["fixedValues a_a","valuesFor a_2","functionOf a2_x"])], 
   64.24 -  Rule.e_rls, NONE, [])),
   64.25 +  Rule_Set.e_rls, NONE, [])),
   64.26  (Specify.prep_pbt @{theory DiffApp} "pbl_pbla2y" [] Celem.e_pblID
   64.27    (["pbla2y","pbla2","pbla", "refine", "test"],
   64.28    [("#Given" ,["fixedValues a_a","valuesFor a_2","boundVariable a2_y"])], 
   64.29 -  Rule.e_rls, NONE, [])),
   64.30 +  Rule_Set.e_rls, NONE, [])),
   64.31  (Specify.prep_pbt @{theory DiffApp} "pbl_pbla2z" [] Celem.e_pblID
   64.32    (["pbla2z","pbla2","pbla", "refine", "test"],
   64.33    [("#Given" ,["fixedValues a_a","valuesFor a_2","interval a2_z"])], 
   64.34 -  Rule.e_rls, NONE, [])),
   64.35 +  Rule_Set.e_rls, NONE, [])),
   64.36  (Specify.prep_pbt @{theory DiffApp} "pbl_pbla3" [] Celem.e_pblID
   64.37   (["pbla3","pbla", "refine", "test"],
   64.38    [("#Given" ,["fixedValues a_a","relations a_3"])], 
   64.39 -  Rule.e_rls, NONE, []))]
   64.40 +  Rule_Set.e_rls, NONE, []))]
   64.41  \<close>
   64.42  
   64.43  (*ML_file "ptyps.sml"    ... is called in Test_Isac.thy *)
    65.1 --- a/test/Tools/isac/Knowledge/biegelinie-4.sml	Wed Apr 01 19:20:05 2020 +0200
    65.2 +++ b/test/Tools/isac/Knowledge/biegelinie-4.sml	Sat Apr 04 12:11:32 2020 +0200
    65.3 @@ -166,7 +166,7 @@
    65.4        val p = lev_dn p;
    65.5  val NONE = (*case*) ini (*of*);
    65.6              val (m', (is', ctxt'), _) = LI.find_next_step sc (pt, (p, Res)) is ctxt;
    65.7 -	          val d = Rule.e_rls (*FIXME: get simplifier from domID*);
    65.8 +	          val d = Rule_Set.e_rls (*FIXME: get simplifier from domID*);
    65.9       val Safe_Step ((pt', p'), _, _, _) = (*case*) locate_input_tactic sc (pt,(p, Res)) is' ctxt' m' (*of*);
   65.10  Safe_Step : state * Istate.T * Proof.context * Tactic.T -> input_tactic_result;
   65.11  
    66.1 --- a/test/Tools/isac/Knowledge/integrate.thy	Wed Apr 01 19:20:05 2020 +0200
    66.2 +++ b/test/Tools/isac/Knowledge/integrate.thy	Sat Apr 04 12:11:32 2020 +0200
    66.3 @@ -18,8 +18,8 @@
    66.4    [Specify.prep_met @{theory "Isac_Knowledge"} "met_testint" [] Celem.e_metID
    66.5  	    (["diff","integration","test"],
    66.6  	      [("#Given" ,["functionTerm f_f", "integrateBy v_v"]), ("#Find", ["antiDerivative F_F"])],
    66.7 -	      {rew_ord'="tless_true", rls'=Atools_erls, calc = [], srls = Rule.e_rls, prls = Rule.e_rls,
    66.8 -	        crls = Atools_erls, errpats = [], nrls = Rule.e_rls},
    66.9 +	      {rew_ord'="tless_true", rls'=Atools_erls, calc = [], srls = Rule_Set.e_rls, prls = Rule_Set.e_rls,
   66.10 +	        crls = Atools_erls, errpats = [], nrls = Rule_Set.e_rls},
   66.11  	      @{thm integration_test.simps})]\<close>
   66.12  
   66.13  end
    67.1 --- a/test/Tools/isac/MathEngBasic/tactic.sml	Wed Apr 01 19:20:05 2020 +0200
    67.2 +++ b/test/Tools/isac/MathEngBasic/tactic.sml	Sat Apr 04 12:11:32 2020 +0200
    67.3 @@ -18,7 +18,7 @@
    67.4  val thm'' = ("real_mult_div_cancel2", @{thm real_mult_div_cancel2});
    67.5  val (f, res) = (@{term "a * x / (b * x) :: real"}, (@{term "a / b :: real"}, [@{term "k \<noteq> (0 :: real)"}]: term list))
    67.6  ;
    67.7 -Rewrite': theory' * rew_ord' * rls * bool * thm'' * term * result -> T;
    67.8 +Rewrite': theory' * Rule_Def.rew_ord' * rls * bool * thm'' * term * result -> T;
    67.9  val tac = Rewrite' ("Diff", "dummy_ord", e_rls, true, thm'', f, res)
   67.10  ;
   67.11  if (Tactic.result tac |> term2str) = "a / b" then () else error "creates_assms CHANGED";
    68.1 --- a/test/Tools/isac/Minisubpbl/200-start-method.sml	Wed Apr 01 19:20:05 2020 +0200
    68.2 +++ b/test/Tools/isac/Minisubpbl/200-start-method.sml	Sat Apr 04 12:11:32 2020 +0200
    68.3 @@ -162,8 +162,8 @@
    68.4  "~~~~~ fun rep_tac_, args:"; val (Tactic.Rewrite_Set' (thy', put, rls, f, (f', _))) = (m);
    68.5        val fT = type_of f;
    68.6        val lhs = Const ("Prog_Tac.Rewrite'_Set", [HOLogic.stringT, fT] ---> fT) 
    68.7 -        $ HOLogic.mk_string (Rule.id_rls rls) $ f;
    68.8 -(*        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ here was Free (Rule.id_rls rls, idT) *)
    68.9 +        $ HOLogic.mk_string (Rule_Set.id_rls rls) $ f;
   68.10 +(*        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ here was Free (Rule_Set.id_rls rls, idT) *)
   68.11  
   68.12  val (p,_,f,nxt,_,pt) = me nxt p'''' [] pt''''; (*nxt = ("Rewrite_Set"*)
   68.13  case nxt of (Rewrite_Set _) => ()
    69.1 --- a/test/Tools/isac/Minisubpbl/250-Rewrite_Set-from-method.sml	Wed Apr 01 19:20:05 2020 +0200
    69.2 +++ b/test/Tools/isac/Minisubpbl/250-Rewrite_Set-from-method.sml	Sat Apr 04 12:11:32 2020 +0200
    69.3 @@ -83,7 +83,7 @@
    69.4  "~~~~~ fun associate, args:"; val (_, ctxt, (m as Tactic.Rewrite_Set' (_, _, rls, f, (f', _))), 
    69.5        (Const ("Prog_Tac.Rewrite'_Set", _) $ rls_ $ f_)) = (pt, d, m, stac);
    69.6  
    69.7 -(*+*)if Rule.id_rls rls = HOLogic.dest_string rls_ then () else error "Prog_Tac.associate changed";
    69.8 +(*+*)if Rule_Set.id_rls rls = HOLogic.dest_string rls_ then () else error "Prog_Tac.associate changed";
    69.9  
   69.10  "~~~~~ continue me[1] after Step.by_tactic";
   69.11      val (pt, p) = ptp''''';
    70.1 --- a/test/Tools/isac/Minisubpbl/800-append-on-Frm.sml	Wed Apr 01 19:20:05 2020 +0200
    70.2 +++ b/test/Tools/isac/Minisubpbl/800-append-on-Frm.sml	Sat Apr 04 12:11:32 2020 +0200
    70.3 @@ -68,10 +68,10 @@
    70.4  
    70.5        (** )val (pt, c) =( **)
    70.6             cappend_atomic pt p (is, ContextC.insert_assumptions asm ctxt) f 
    70.7 -                     (Tactic.Rewrite_Set (Rule.id_rls rls')) (f',asm) Complete;
    70.8 +                     (Tactic.Rewrite_Set (Rule_Set.id_rls rls')) (f',asm) Complete;
    70.9  "~~~~~ fun cappend_atomic , args:"; val (pt, p: pos, ic_res, f, r, f', s)
   70.10    = (pt, p, (is, ContextC.insert_assumptions asm ctxt), f,
   70.11 -      (Tactic.Rewrite_Set (Rule.id_rls rls')), (f',asm), Complete);
   70.12 +      (Tactic.Rewrite_Set (Rule_Set.id_rls rls')), (f',asm), Complete);
   70.13    (*if*) existpt p pt andalso Tactic.is_empty (get_obj g_tac pt p) (*then*);
   70.14        val (ic_form, f) = (get_loc pt (p, Frm), get_obj g_form pt p)
   70.15  	    val (pt, cs) = cut_tree(*!*)pt (p, Frm);
    71.1 --- a/test/Tools/isac/ProgLang/auto_prog.sml	Wed Apr 01 19:20:05 2020 +0200
    71.2 +++ b/test/Tools/isac/ProgLang/auto_prog.sml	Sat Apr 04 12:11:32 2020 +0200
    71.3 @@ -32,8 +32,8 @@
    71.4   Auto_Prog.gen thy' t rls;
    71.5  "~~~~~ fun generate , args:"; val (thy, t, rls) = (thy', t, rls);
    71.6      val prog = case rls of
    71.7 -	      Rule.Rls {rules, ...} => rules2scr_Rls thy rules
    71.8 -	    | Rule.Seq {rules, ...} => rules2scr_Seq thy rules
    71.9 +	      Rule_Set.Rls {rules, ...} => rules2scr_Rls thy rules
   71.10 +	    | Rule_Set.Seq {rules, ...} => rules2scr_Seq thy rules
   71.11      val auto_script = subst_typs prog (type_of t) (TermC.guess_bdv_typ t) (*return from generate*);
   71.12  
   71.13  if term2str auto_script =
    72.1 --- a/test/Tools/isac/ProgLang/calculate.thy	Wed Apr 01 19:20:05 2020 +0200
    72.2 +++ b/test/Tools/isac/ProgLang/calculate.thy	Sat Apr 04 12:11:32 2020 +0200
    72.3 @@ -18,12 +18,12 @@
    72.4  \<close>
    72.5  
    72.6  setup \<open>KEStore_Elems.add_pbts
    72.7 -  [Specify.prep_pbt @{theory "Test"} "pbl_ttest" [] Celem.e_pblID (["test"], [], Rule.e_rls, NONE, []),
    72.8 +  [Specify.prep_pbt @{theory "Test"} "pbl_ttest" [] Celem.e_pblID (["test"], [], Rule_Set.e_rls, NONE, []),
    72.9      Specify.prep_pbt @{theory "Test"} "pbl_ttest_calc" [] Celem.e_pblID
   72.10        (["calculate", "test"],
   72.11          [("#Given", ["realTestGiven t_t"]),
   72.12           ("#Find", ["realTestFind s_s"])],
   72.13 -        Rule.e_rls, NONE, [["Test", "test_calculate"]])]\<close>
   72.14 +        Rule_Set.e_rls, NONE, [["Test", "test_calculate"]])]\<close>
   72.15  
   72.16  partial_function (tailrec) calc_test :: "real \<Rightarrow> real"
   72.17    where
   72.18 @@ -37,12 +37,12 @@
   72.19    [Specify.prep_met (@{theory "Test"}) "met_testcal" [] Celem.e_metID
   72.20        (["Test","test_calculate"],
   72.21          [("#Given" , ["realTestGiven t_t"]), ("#Find", ["realTestFind s_s"])],
   72.22 -        {rew_ord'="sqrt_right",rls'=tval_rls,srls = Rule.e_rls, prls = Rule.e_rls,
   72.23 +        {rew_ord'="sqrt_right",rls'=tval_rls,srls = Rule_Set.e_rls, prls = Rule_Set.e_rls,
   72.24            calc=[("PLUS", ("op +", eval_binop "#add_")),
   72.25                ("TIMES", ("Groups.times_class.times", eval_binop "#mult_")),
   72.26                ("DIVIDE", ("HOL.divide", Prog_Expr.eval_cancel "#divide_")),
   72.27                ("POWER", ("Prog_Expr.pow", eval_binop "#power_"))],
   72.28 -          crls=tval_rls, errpats = [], nrls= Rule.e_rls (*, asm_rls=[],asm_thm=[]*)},
   72.29 +          crls=tval_rls, errpats = [], nrls= Rule_Set.e_rls (*, asm_rls=[],asm_thm=[]*)},
   72.30          @{thm calc_test.simps})]
   72.31  \<close>
   72.32  
    73.1 --- a/test/Tools/isac/ProgLang/rewrite.sml	Wed Apr 01 19:20:05 2020 +0200
    73.2 +++ b/test/Tools/isac/ProgLang/rewrite.sml	Sat Apr 04 12:11:32 2020 +0200
    73.3 @@ -530,8 +530,8 @@
    73.4        datatype switch = Appl | Noap;
    73.5        fun rew_once _ asm ct Noap [] = (ct, asm) (* ?TODO unify with Prog_Expr.rew_once? *)
    73.6          | rew_once ruls asm ct Appl [] = 
    73.7 -          (case rls of Rule.Rls _ => rew_once ruls asm ct Noap ruls
    73.8 -          | Rule.Seq _ => (ct, asm)
    73.9 +          (case rls of Rule_Set.Rls _ => rew_once ruls asm ct Noap ruls
   73.10 +          | Rule_Set.Seq _ => (ct, asm)
   73.11            | rls => raise ERROR ("rew_once not appl. to \"" ^ Rule.rls2str rls ^ "\""))
   73.12          | rew_once ruls asm ct apno (rul :: thms) =
   73.13            case rul of
   73.14 @@ -578,7 +578,7 @@
   73.15              | NONE => rew_once ruls asm ct apno thms)
   73.16            | r => raise ERROR ("rew_once not appl. to \"" ^ Rule.rule2str r ^ "\"");
   73.17        val ruls = (#rules o Rule.rep_rls) rls;
   73.18 -(*    val _ = trace i (" rls: " ^ Rule.id_rls rls ^ " on: " ^ Rule.t2str thy ct)*)
   73.19 +(*    val _ = trace i (" rls: " ^ Rule_Set.id_rls rls ^ " on: " ^ Rule.t2str thy ct)*)
   73.20        val (ct', asm') = rew_once ruls [] ct Noap ruls;
   73.21  "~~~~~ fun rew_once , args:"; val (ruls, asm, ct, apno, (rul :: thms))
   73.22    = (ruls, []:term list, ct, Noap, ruls);
    74.1 --- a/test/Tools/isac/Test_Isac_Short.thy	Wed Apr 01 19:20:05 2020 +0200
    74.2 +++ b/test/Tools/isac/Test_Isac_Short.thy	Sat Apr 04 12:11:32 2020 +0200
    74.3 @@ -127,6 +127,7 @@
    74.4    open TermC;                  atomt;
    74.5    open Celem;                  e_pbt;
    74.6    open Rule;                   string_of_thm;
    74.7 +  open Rule_Set
    74.8  (*\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*)
    74.9  \<close>
   74.10