# HG changeset patch # User Walther Neuper # Date 1521114124 -3600 # Node ID 509d70b507e51c8ef5159bbd7b20176d2a6dfcdf # Parent 49d7d410b83cc17c9a2ecb4a768844522918dd80 separate structure Celem: CALC_ELEMENT, finished on src/ diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Build_Isac.thy --- a/src/Tools/isac/Build_Isac.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Build_Isac.thy Thu Mar 15 12:42:04 2018 +0100 @@ -115,7 +115,7 @@ ML {* @{thm last_thmI} (*from Atools.thy*) *} ML {*@{thm Querkraft_Belastung}*} -ML {* check_guhs_unique := false; *} +ML {* Celem.check_guhs_unique := false; *} ML {* writeln "**** isac kernel = math-engine + Knowledge complete ******" *} ML {* @{theory "Isac"} *} ML {* (*get_the ["IsacKnowledge", "Diff", "Theorems", "diff_sin_chain"] diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Isac_Protocol.thy --- a/src/Tools/isac/Isac_Protocol.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Isac_Protocol.thy Thu Mar 15 12:42:04 2018 +0100 @@ -9,7 +9,7 @@ val (calcid, cterm') = case intree of XML.Elem (("APPENDFORMULA", []), [ XML.Elem (("CALCID", []), [XML.Text ci]), - form]) => (ci |> TermC.int_of_str, form |> xml_to_term_NEW |> term2str) + form]) => (ci |> TermC.int_of_str, form |> xml_to_term_NEW |> Celem.term2str) | x => raise ERROR ("append_form: WRONG intree = " ^ xmlstr 0 x) val result = Kernel.appendFormula calcid cterm' in result end) @@ -550,7 +550,7 @@ val (calcid, cterm') = case intree of XML.Elem (("REPLACEFORMULA", []), [ XML.Elem (("CALCID", []), [XML.Text ci]), form]) - => (ci |> TermC.int_of_str, form |> xml_to_term_NEW |> term2str) + => (ci |> TermC.int_of_str, form |> xml_to_term_NEW |> Celem.term2str) | tree => raise ERROR ("replace_form: WRONG intree = " ^ xmlstr 0 tree) val result = Kernel.replaceFormula calcid cterm' in result end) diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/AlgEin.thy --- a/src/Tools/isac/Knowledge/AlgEin.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/AlgEin.thy Thu Mar 15 12:42:04 2018 +0100 @@ -26,35 +26,35 @@ *} (** problems **) setup {* KEStore_Elems.add_pbts - [(Specify.prep_pbt thy "pbl_algein" [] e_pblID (["Berechnung"], [], e_rls, NONE, [])), - (Specify.prep_pbt thy "pbl_algein_numsym" [] e_pblID + [(Specify.prep_pbt thy "pbl_algein" [] Celem.e_pblID (["Berechnung"], [], Celem.e_rls, NONE, [])), + (Specify.prep_pbt thy "pbl_algein_numsym" [] Celem.e_pblID (["numerischSymbolische", "Berechnung"], [("#Given", ["KantenLaenge k_k","Querschnitt q__q"(*q_ in Biegelinie.thy*), "KantenUnten u_u", "KantenSenkrecht s_s", "KantenOben o_o"]), ("#Find", ["GesamtLaenge l_l"])], - e_rls, NONE, [["Berechnung","erstNumerisch"], ["Berechnung","erstSymbolisch"]]))]; *} + Celem.e_rls, NONE, [["Berechnung","erstNumerisch"], ["Berechnung","erstSymbolisch"]]))]; *} setup {* KEStore_Elems.add_mets - [Specify.prep_met thy "met_algein" [] e_metID + [Specify.prep_met thy "met_algein" [] Celem.e_metID (["Berechnung"], [], - {rew_ord'="tless_true", rls'= Erls, calc = [], srls = Erls, prls = Erls, crls =Erls, - errpats = [], nrls = Erls}, + {rew_ord'="tless_true", rls'= Celem.Erls, calc = [], srls = Celem.Erls, prls = Celem.Erls, crls =Celem.Erls, + errpats = [], nrls = Celem.Erls}, "empty_script"), - Specify.prep_met thy "met_algein_numsym" [] e_metID + Specify.prep_met thy "met_algein_numsym" [] Celem.e_metID (["Berechnung","erstNumerisch"], [], - {rew_ord'="tless_true", rls'= Erls, calc = [], srls = Erls, prls = Erls, crls =Erls, - errpats = [], nrls = Erls}, + {rew_ord'="tless_true", rls'= Celem.Erls, calc = [], srls = Celem.Erls, prls = Celem.Erls, crls =Celem.Erls, + errpats = [], nrls = Celem.Erls}, "empty_script"), - Specify.prep_met thy "met_algein_numsym" [] e_metID + Specify.prep_met thy "met_algein_numsym" [] Celem.e_metID (["Berechnung","erstNumerisch"], [("#Given" ,["KantenLaenge k_k","Querschnitt q__q", "KantenUnten u_u", "KantenSenkrecht s_s", "KantenOben o_o"]), ("#Find" ,["GesamtLaenge l_l"])], - {rew_ord'="tless_true", rls'= e_rls, calc = [], - srls = append_rls "srls_..Berechnung-erstSymbolisch" e_rls - [Calc ("Atools.boollist2sum", eval_boollist2sum "")], - prls = e_rls, crls =e_rls , errpats = [], nrls = norm_Rational}, + {rew_ord'="tless_true", rls'= Celem.e_rls, calc = [], + srls = Celem.append_rls "srls_..Berechnung-erstSymbolisch" Celem.e_rls + [Celem.Calc ("Atools.boollist2sum", eval_boollist2sum "")], + prls = Celem.e_rls, crls =Celem.e_rls , errpats = [], nrls = norm_Rational}, "Script RechnenSymbolScript (k_k::bool) (q__q::bool) " ^ "(u_u::bool list) (s_s::bool list) (o_o::bool list) (l_l::real) =" ^ " (let t_t = Take (l_l = oben + senkrecht + unten); " ^ @@ -74,15 +74,15 @@ " t_t = Substitute [k_k, q__q] t_t; " ^ " t_t = (Repeat (Try (Rewrite_Set norm_Poly False))) t_t " ^ " in (Try (Rewrite_Set norm_Poly False)) t_t) "), - Specify.prep_met thy "met_algein_symnum" [] e_metID + Specify.prep_met thy "met_algein_symnum" [] Celem.e_metID (["Berechnung","erstSymbolisch"], [("#Given" ,["KantenLaenge k_k","Querschnitt q__q", "KantenUnten u_u", "KantenSenkrecht s_s", "KantenOben o_o"]), ("#Find" ,["GesamtLaenge l_l"])], - {rew_ord'="tless_true", rls'= e_rls, calc = [], - srls = append_rls "srls_..Berechnung-erstSymbolisch" e_rls - [Calc ("Atools.boollist2sum", eval_boollist2sum "")], - prls = e_rls, crls =e_rls , errpats = [], nrls = norm_Rational}, + {rew_ord'="tless_true", rls'= Celem.e_rls, calc = [], + srls = Celem.append_rls "srls_..Berechnung-erstSymbolisch" Celem.e_rls + [Celem.Calc ("Atools.boollist2sum", eval_boollist2sum "")], + prls = Celem.e_rls, crls =Celem.e_rls , errpats = [], nrls = norm_Rational}, "Script RechnenSymbolScript (k_k::bool) (q__q::bool) " ^ "(u_u::bool list) (s_s::bool list) (o_o::bool list) (l_l::real) =" ^ " (let t_t = Take (l_l = oben + senkrecht + unten); " ^ diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/Atools.thy --- a/src/Tools/isac/Knowledge/Atools.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/Atools.thy Thu Mar 15 12:42:04 2018 +0100 @@ -118,7 +118,7 @@ \item [*\_srls] \end{description} -{\tt append_rls, merge_rls, remove_rls} TODO +{\tt Celem.append_rls, Celem.merge_rls, remove_rls} TODO *} ML {* @@ -136,12 +136,12 @@ (*("occurs_in", ("Atools.occurs'_in", eval_occurs_in ""))*) fun eval_occurs_in _ "Atools.occurs'_in" (p as (Const ("Atools.occurs'_in",_) $ v $ t)) _ = - ((*tracing("@@@ eval_occurs_in: v= "^(term2str v)); - tracing("@@@ eval_occurs_in: t= "^(term2str t));*) + ((*tracing("@@@ eval_occurs_in: v= "^(Celem.term2str v)); + tracing("@@@ eval_occurs_in: t= "^(Celem.term2str t));*) if occurs_in v t - then SOME ((term2str p) ^ " = True", + then SOME ((Celem.term2str p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True}))) - else SOME ((term2str p) ^ " = False", + else SOME ((Celem.term2str p) ^ " = False", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False})))) | eval_occurs_in _ _ _ _ = NONE; @@ -156,9 +156,9 @@ (p as (Const ("Atools.some'_occur'_in",_) $ vs $ t)) _ = if some_occur_in (TermC.isalist2list vs) t - then SOME ((term2str p) ^ " = True", + then SOME ((Celem.term2str p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True}))) - else SOME ((term2str p) ^ " = False", + else SOME ((Celem.term2str p) ^ " = False", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False}))) | eval_some_occur_in _ _ _ _ = NONE; @@ -209,10 +209,10 @@ else SOME (TermC.mk_thmid thmid n1 "", HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False}))) | Const ("Float.Float",_) => - SOME (TermC.mk_thmid thmid (term2str arg) "", + SOME (TermC.mk_thmid thmid (Celem.term2str arg) "", HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True}))) | _ => (*NONE*) - SOME (TermC.mk_thmid thmid (term2str arg) "", + SOME (TermC.mk_thmid thmid (Celem.term2str arg) "", HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False})))) | eval_const _ _ _ _ = NONE; @@ -259,7 +259,7 @@ (*WN071229 "Rings.divide_class.divide" never tried*) val rhs = var_op_float v op_ t0 T1 res val prop = HOLogic.Trueprop $ (TermC.mk_equality (t, rhs)) - in SOME ("#: " ^ term2str prop, prop) end + in SOME ("#: " ^ Celem.term2str prop, prop) end | _ => NONE else NONE | eval_binop (thmid : string) (op_ : string) @@ -273,7 +273,7 @@ val res = calcul op0 n1 n2 val rhs = float_op_var v op_ t0 T1 res val prop = HOLogic.Trueprop $ (TermC.mk_equality (t, rhs)) - in SOME ("#: " ^ term2str prop, prop) end + in SOME ("#: " ^ Celem.term2str prop, prop) end | _ => NONE else NONE | eval_binop (thmid : string) _ (t as (Const (op0, t0) $ t1 $ t2)) _ = (* binary . n1.n2 *) @@ -284,16 +284,16 @@ val res = calcul op0 n1 n2; val rhs = term_of_float Trange res; val prop = HOLogic.Trueprop $ (TermC.mk_equality (t, rhs)); - in SOME ("#: " ^ term2str prop, prop) end + in SOME ("#: " ^ Celem.term2str prop, prop) end | _ => NONE) | eval_binop _ _ _ _ = NONE; (* > val SOME (thmid, t) = eval_binop "#add_" "Groups.plus_class.plus" (str2term "-1 + 2") thy; -> term2str t; +> Celem.term2str t; val it = "-1 + 2 = 1" > val t = str2term "-1 * (-1 * a)"; > val SOME (thmid, t) = eval_binop "#mult_" "Groups.times_class.times" t thy; -> term2str t; +> Celem.term2str t; val it = "-1 * (-1 * a) = 1 * a"*) @@ -319,18 +319,18 @@ > reflI; val it = "(?t = ?t) = True" > val t = str2term "x = 0"; -> val NONE = rewrite_ thy dummy_ord e_rls false reflI t; +> val NONE = rewrite_ thy Celem.dummy_ord Celem.e_rls false reflI t; > val t = str2term "1 = 0"; -> val NONE = rewrite_ thy dummy_ord e_rls false reflI t; ------------ thus needs Calc ! +> val NONE = rewrite_ thy Celem.dummy_ord Celem.e_rls false reflI t; +----------- thus needs Celem.Calc ! > val t = str2term "0 = 0"; -> val SOME (t',_) = rewrite_ thy dummy_ord e_rls false reflI t; -> term2str t'; +> val SOME (t',_) = rewrite_ thy Celem.dummy_ord Celem.e_rls false reflI t; +> Celem.term2str t'; val it = "HOL.True" val t = str2term "Not (x = 0)"; -atomt t; term2str t; +atomt t; Celem.term2str t; *** ------------- *** Const ( Not) *** . Const ( op =) @@ -345,28 +345,28 @@ (Const (op0,t0) $ t1 $ t2 )) thy = if t1 = t2 then SOME (TermC.mk_thmid thmid - ("(" ^ (term_to_string''' thy t1) ^ ")") - ("(" ^ (term_to_string''' thy t2) ^ ")"), + ("(" ^ (Celem.term_to_string''' thy t1) ^ ")") + ("(" ^ (Celem.term_to_string''' thy t2) ^ ")"), HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True}))) else SOME (TermC.mk_thmid thmid - ("(" ^ (term_to_string''' thy t1) ^ ")") - ("(" ^ (term_to_string''' thy t2) ^ ")"), + ("(" ^ (Celem.term_to_string''' thy t1) ^ ")") + ("(" ^ (Celem.term_to_string''' thy t2) ^ ")"), HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False}))) | eval_ident _ _ _ _ = NONE; (* TODO > val t = str2term "x =!= 0"; > val SOME (str, t') = eval_ident "ident_" "b" t thy; -> term2str t'; +> Celem.term2str t'; val str = "ident_(x)_(0)" : string val it = "(x =!= 0) = False" : string > val t = str2term "1 =!= 0"; > val SOME (str, t') = eval_ident "ident_" "b" t thy; -> term2str t'; +> Celem.term2str t'; val str = "ident_(1)_(0)" : string val it = "(1 =!= 0) = False" : string > val t = str2term "0 =!= 0"; > val SOME (str, t') = eval_ident "ident_" "b" t thy; -> term2str t'; +> Celem.term2str t'; val str = "ident_(0)_(0)" : string val it = "(0 =!= 0) = True" : string *) @@ -377,14 +377,14 @@ fun eval_equal (thmid : string) "HOL.eq" (t as (Const (op0,t0) $ t1 $ t2 )) thy = if t1 = t2 then SOME (TermC.mk_thmid thmid - ("(" ^ term_to_string''' thy t1 ^ ")") - ("(" ^ term_to_string''' thy t2 ^ ")"), + ("(" ^ Celem.term_to_string''' thy t1 ^ ")") + ("(" ^ Celem.term_to_string''' thy t2 ^ ")"), HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True}))) else (case (TermC.is_atom t1, TermC.is_atom t2) of (true, true) => SOME (TermC.mk_thmid thmid - ("(" ^ term_to_string''' thy t1 ^ ")") - ("(" ^ term_to_string''' thy t2 ^ ")"), + ("(" ^ Celem.term_to_string''' thy t1 ^ ")") + ("(" ^ Celem.term_to_string''' thy t2 ^ ")"), HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False}))) | _ => NONE) (* NOT is_atom t1,t2 --> rew_sub *) | eval_equal _ _ _ _ = NONE; (* error-exit *) @@ -395,7 +395,7 @@ > val t = str2term "(x + 1) = (x + 1)"; > val SOME (str, t') = eval_equal "equal_" "b" t thy; -> term2str t'; +> Celem.term2str t'; val str = "equal_(x + 1)_(x + 1)" : string val it = "(x + 1 = x + 1) = True" : string > val t = str2term "x = 0"; @@ -403,12 +403,12 @@ > val t = str2term "1 = 0"; > val SOME (str, t') = eval_equal "equal_" "b" t thy; -> term2str t'; +> Celem.term2str t'; val str = "equal_(1)_(0)" : string val it = "(1 = 0) = False" : string > val t = str2term "0 = 0"; > val SOME (str, t') = eval_equal "equal_" "b" t thy; -> term2str t'; +> Celem.term2str t'; val str = "equal_(0)_(0)" : string val it = "(0 = 0) = True" : string *) @@ -449,7 +449,7 @@ fun eval_argument_in _ "Atools.argument'_in" (t as (Const ("Atools.argument'_in", _) $ (f $ arg))) _ = if is_Free arg (*could be something to be simplified before*) - then SOME (term2str t ^ " = " ^ term2str arg, + then SOME (Celem.term2str t ^ " = " ^ Celem.term2str arg, HOLogic.Trueprop $ (TermC.mk_equality (t, arg))) else NONE | eval_argument_in _ _ _ _ = NONE; @@ -463,9 +463,9 @@ (f1 $ _) $ (Const ("HOL.eq", _) $ (f2 $ _) $ _)) _ = if f1 = f2 - then SOME ((term2str p) ^ " = True", + then SOME ((Celem.term2str p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True}))) - else SOME ((term2str p) ^ " = False", + else SOME ((Celem.term2str p) ^ " = False", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False}))) | eval_sameFunId _ _ _ _ = NONE; @@ -476,7 +476,7 @@ this is, because Isabelles filter takes more than 1 sec.*) fun same_funid f1 (Const ("HOL.eq", _) $ (f2 $ _) $ _) = f1 = f2 | same_funid f1 t = error ("same_funid called with t = (" - ^term2str f1^") ("^term2str t^")"); + ^Celem.term2str f1^") ("^Celem.term2str t^")"); (*("filter_sameFunId" ,("Atools.filter'_sameFunId", eval_filter_sameFunId "Atools.filter'_sameFunId"))*) fun eval_filter_sameFunId _ "Atools.filter'_sameFunId" @@ -484,7 +484,7 @@ (fid $ _) $ fs) _ = let val fs' = ((TermC.list2isalist HOLogic.boolT) o (filter (same_funid fid))) (TermC.isalist2list fs) - in SOME (term2str (TermC.mk_equality (p, fs')), + in SOME (Celem.term2str (TermC.mk_equality (p, fs')), HOLogic.Trueprop $ (TermC.mk_equality (p, fs'))) end | eval_filter_sameFunId _ _ _ _ = NONE; @@ -509,7 +509,7 @@ let val isal = TermC.isalist2list l val lhss = map lhs isal val sum = list2sum lhss - in SOME ((term2str p) ^ " = " ^ (term2str sum), + in SOME ((Celem.term2str p) ^ " = " ^ (Celem.term2str sum), HOLogic.Trueprop $ (TermC.mk_equality (p, sum))) end | eval_boollist2sum _ _ _ _ = NONE; @@ -521,47 +521,47 @@ open Term; in -fun termlessI (_:subst) uv = Term_Ord.termless uv; -fun term_ordI (_:subst) uv = Term_Ord.term_ord uv; +fun termlessI (_: Celem.subst) uv = Term_Ord.termless uv; +fun term_ordI (_: Celem.subst) uv = Term_Ord.term_ord uv; end; (** rule set, for evaluating list-expressions in scripts 8.01.02 **) -val list_rls = append_rls "list_rls" list_rls - [Calc ("Groups.times_class.times",eval_binop "#mult_"), - Calc ("Groups.plus_class.plus", eval_binop "#add_"), - Calc ("Orderings.ord_class.less",eval_equ "#less_"), - Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"), - Calc ("Atools.ident",eval_ident "#ident_"), - Calc ("HOL.eq",eval_equal "#equal_"),(*atom <> atom -> False*) +val list_rls = Celem.append_rls "list_rls" list_rls + [Celem.Calc ("Groups.times_class.times",eval_binop "#mult_"), + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"), + Celem.Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"), + Celem.Calc ("Atools.ident",eval_ident "#ident_"), + Celem.Calc ("HOL.eq",eval_equal "#equal_"),(*atom <> atom -> False*) - Calc ("Tools.Vars",eval_var "#Vars_"), + Celem.Calc ("Tools.Vars",eval_var "#Vars_"), - Thm ("if_True",TermC.num_str @{thm if_True}), - Thm ("if_False",TermC.num_str @{thm if_False}) + Celem.Thm ("if_True",TermC.num_str @{thm if_True}), + Celem.Thm ("if_False",TermC.num_str @{thm if_False}) ]; *} ML {* -(*TODO.WN0509 reduce ids: tless_true = e_rew_ord' = e_rew_ord = dummy_ord*) -val tless_true = dummy_ord; -rew_ord' := overwritel (!rew_ord', +(*TODO.WN0509 reduce ids: tless_true = e_rew_ord' = Celem.e_rew_ord = Celem.dummy_ord*) +val tless_true = Celem.dummy_ord; +Celem.rew_ord' := overwritel (! Celem.rew_ord', [("tless_true", tless_true), ("e_rew_ord'", tless_true), - ("dummy_ord", dummy_ord)]); + ("dummy_ord", Celem.dummy_ord)]); val calculate_Atools = - append_rls "calculate_Atools" e_rls - [Calc ("Orderings.ord_class.less",eval_equ "#less_"), - Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"), - Calc ("HOL.eq",eval_equal "#equal_"), + Celem.append_rls "calculate_Atools" Celem.e_rls + [Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"), + Celem.Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"), + Celem.Calc ("HOL.eq",eval_equal "#equal_"), - Thm ("real_unari_minus",TermC.num_str @{thm real_unari_minus}), - Calc ("Groups.plus_class.plus",eval_binop "#add_"), - Calc ("Groups.minus_class.minus",eval_binop "#sub_"), - Calc ("Groups.times_class.times",eval_binop "#mult_") + Celem.Thm ("real_unari_minus",TermC.num_str @{thm real_unari_minus}), + Celem.Calc ("Groups.plus_class.plus",eval_binop "#add_"), + Celem.Calc ("Groups.minus_class.minus",eval_binop "#sub_"), + Celem.Calc ("Groups.times_class.times",eval_binop "#mult_") ]; *} @@ -570,101 +570,101 @@ ML {* val Atools_erls = - append_rls "Atools_erls" e_rls - [Calc ("HOL.eq",eval_equal "#equal_"), - Thm ("not_true",TermC.num_str @{thm not_true}), + Celem.append_rls "Atools_erls" Celem.e_rls + [Celem.Calc ("HOL.eq",eval_equal "#equal_"), + Celem.Thm ("not_true",TermC.num_str @{thm not_true}), (*"(~ True) = False"*) - Thm ("not_false",TermC.num_str @{thm not_false}), + Celem.Thm ("not_false",TermC.num_str @{thm not_false}), (*"(~ False) = True"*) - Thm ("and_true",TermC.num_str @{thm and_true}), + Celem.Thm ("and_true",TermC.num_str @{thm and_true}), (*"(?a & True) = ?a"*) - Thm ("and_false",TermC.num_str @{thm and_false}), + Celem.Thm ("and_false",TermC.num_str @{thm and_false}), (*"(?a & False) = False"*) - Thm ("or_true",TermC.num_str @{thm or_true}), + Celem.Thm ("or_true",TermC.num_str @{thm or_true}), (*"(?a | True) = True"*) - Thm ("or_false",TermC.num_str @{thm or_false}), + Celem.Thm ("or_false",TermC.num_str @{thm or_false}), (*"(?a | False) = ?a"*) - Thm ("rat_leq1",TermC.num_str @{thm rat_leq1}), - Thm ("rat_leq2",TermC.num_str @{thm rat_leq2}), - Thm ("rat_leq3",TermC.num_str @{thm rat_leq3}), - Thm ("refl",TermC.num_str @{thm refl}), - Thm ("order_refl",TermC.num_str @{thm order_refl}), - Thm ("radd_left_cancel_le",TermC.num_str @{thm radd_left_cancel_le}), + Celem.Thm ("rat_leq1",TermC.num_str @{thm rat_leq1}), + Celem.Thm ("rat_leq2",TermC.num_str @{thm rat_leq2}), + Celem.Thm ("rat_leq3",TermC.num_str @{thm rat_leq3}), + Celem.Thm ("refl",TermC.num_str @{thm refl}), + Celem.Thm ("order_refl",TermC.num_str @{thm order_refl}), + Celem.Thm ("radd_left_cancel_le",TermC.num_str @{thm radd_left_cancel_le}), - Calc ("Orderings.ord_class.less",eval_equ "#less_"), - Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"), + Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"), + Celem.Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"), - Calc ("Atools.ident",eval_ident "#ident_"), - Calc ("Atools.is'_const",eval_const "#is_const_"), - Calc ("Atools.occurs'_in",eval_occurs_in ""), - Calc ("Tools.matches",eval_matches "") + Celem.Calc ("Atools.ident",eval_ident "#ident_"), + Celem.Calc ("Atools.is'_const",eval_const "#is_const_"), + Celem.Calc ("Atools.occurs'_in",eval_occurs_in ""), + Celem.Calc ("Tools.matches",eval_matches "") ]; *} ML {* val Atools_crls = - append_rls "Atools_crls" e_rls - [Calc ("HOL.eq",eval_equal "#equal_"), - Thm ("not_true",TermC.num_str @{thm not_true}), - Thm ("not_false",TermC.num_str @{thm not_false}), - Thm ("and_true",TermC.num_str @{thm and_true}), - Thm ("and_false",TermC.num_str @{thm and_false}), - Thm ("or_true",TermC.num_str @{thm or_true}), - Thm ("or_false",TermC.num_str @{thm or_false}), + Celem.append_rls "Atools_crls" Celem.e_rls + [Celem.Calc ("HOL.eq",eval_equal "#equal_"), + Celem.Thm ("not_true",TermC.num_str @{thm not_true}), + Celem.Thm ("not_false",TermC.num_str @{thm not_false}), + Celem.Thm ("and_true",TermC.num_str @{thm and_true}), + Celem.Thm ("and_false",TermC.num_str @{thm and_false}), + Celem.Thm ("or_true",TermC.num_str @{thm or_true}), + Celem.Thm ("or_false",TermC.num_str @{thm or_false}), - Thm ("rat_leq1",TermC.num_str @{thm rat_leq1}), - Thm ("rat_leq2",TermC.num_str @{thm rat_leq2}), - Thm ("rat_leq3",TermC.num_str @{thm rat_leq3}), - Thm ("refl",TermC.num_str @{thm refl}), - Thm ("order_refl",TermC.num_str @{thm order_refl}), - Thm ("radd_left_cancel_le",TermC.num_str @{thm radd_left_cancel_le}), + Celem.Thm ("rat_leq1",TermC.num_str @{thm rat_leq1}), + Celem.Thm ("rat_leq2",TermC.num_str @{thm rat_leq2}), + Celem.Thm ("rat_leq3",TermC.num_str @{thm rat_leq3}), + Celem.Thm ("refl",TermC.num_str @{thm refl}), + Celem.Thm ("order_refl",TermC.num_str @{thm order_refl}), + Celem.Thm ("radd_left_cancel_le",TermC.num_str @{thm radd_left_cancel_le}), - Calc ("Orderings.ord_class.less",eval_equ "#less_"), - Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"), + Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"), + Celem.Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"), - Calc ("Atools.ident",eval_ident "#ident_"), - Calc ("Atools.is'_const",eval_const "#is_const_"), - Calc ("Atools.occurs'_in",eval_occurs_in ""), - Calc ("Tools.matches",eval_matches "") + Celem.Calc ("Atools.ident",eval_ident "#ident_"), + Celem.Calc ("Atools.is'_const",eval_const "#is_const_"), + Celem.Calc ("Atools.occurs'_in",eval_occurs_in ""), + Celem.Calc ("Tools.matches",eval_matches "") ]; (*val atools_erls = ... waere zu testen ... - merge_rls calculate_Atools - (append_rls Atools_erls (*i.A. zu viele rules*) - [Calc ("Atools.ident",eval_ident "#ident_"), - Calc ("Atools.is'_const",eval_const "#is_const_"), - Calc ("Atools.occurs'_in", + Celem.merge_rls calculate_Atools + (Celem.append_rls Atools_erls (*i.A. zu viele rules*) + [Celem.Calc ("Atools.ident",eval_ident "#ident_"), + Celem.Calc ("Atools.is'_const",eval_const "#is_const_"), + Celem.Calc ("Atools.occurs'_in", eval_occurs_in "#occurs_in"), - Calc ("Tools.matches",eval_matches "#matches") + Celem.Calc ("Tools.matches",eval_matches "#matches") ] (*i.A. zu viele rules*) );*) (* val atools_erls = prep_rls'( (*outcommented*) - Rls {id="atools_erls",preconds = [], rew_ord = ("termlessI",termlessI), - erls = e_rls, srls = Erls, calc = [], errpatts = [], - rules = [Thm ("refl",num_str @{thm refl}), - Thm ("order_refl",num_str @{thm order_refl}), - Thm ("radd_left_cancel_le",num_str @{thm radd_left_cancel_le}), - Thm ("not_true",num_str @{thm not_true}), - Thm ("not_false",num_str @{thm not_false}), - Thm ("and_true",num_str @{thm and_true}), - Thm ("and_false",num_str @{thm and_false}), - Thm ("or_true",num_str @{thm or_true}), - Thm ("or_false",num_str @{thm or_false}), - Thm ("and_commute",num_str @{thm and_commute}), - Thm ("or_commute",num_str @{thm or_commute}), + Celem.Rls {id="atools_erls",preconds = [], rew_ord = ("termlessI",termlessI), + erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Thm ("refl",num_str @{thm refl}), + Celem.Thm ("order_refl",num_str @{thm order_refl}), + Celem.Thm ("radd_left_cancel_le",num_str @{thm radd_left_cancel_le}), + Celem.Thm ("not_true",num_str @{thm not_true}), + Celem.Thm ("not_false",num_str @{thm not_false}), + Celem.Thm ("and_true",num_str @{thm and_true}), + Celem.Thm ("and_false",num_str @{thm and_false}), + Celem.Thm ("or_true",num_str @{thm or_true}), + Celem.Thm ("or_false",num_str @{thm or_false}), + Celem.Thm ("and_commute",num_str @{thm and_commute}), + Celem.Thm ("or_commute",num_str @{thm or_commute}), - Calc ("Orderings.ord_class.less",eval_equ "#less_"), - Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"), + Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"), + Celem.Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"), - Calc ("Atools.ident",eval_ident "#ident_"), - Calc ("Atools.is'_const",eval_const "#is_const_"), - Calc ("Atools.occurs'_in",eval_occurs_in ""), - Calc ("Tools.matches",eval_matches "") + Celem.Calc ("Atools.ident",eval_ident "#ident_"), + Celem.Calc ("Atools.is'_const",eval_const "#is_const_"), + Celem.Calc ("Atools.occurs'_in",eval_occurs_in ""), + Celem.Calc ("Tools.matches",eval_matches "") ], - scr = Prog ((Thm.term_of o the o (parse @{theory})) "empty_script") - }:rls); + scr = Celem.Prog ((Thm.term_of o the o (parse @{theory})) "empty_script") + }); *) "******* Atools.ML end *******"; *} @@ -686,16 +686,16 @@ ("POWER" ,("Atools.pow", eval_binop "#power_")), ("boollist2sum",("Atools.boollist2sum", eval_boollist2sum ""))] *} ML {* -val list_rls = LTool.prep_rls @{theory} (merge_rls "list_erls" - (Rls {id = "replaced", preconds = [], rew_ord = ("termlessI", termlessI), - erls = Rls {id = "list_elrs", preconds = [], rew_ord = ("termlessI", termlessI), - erls = e_rls, srls = Erls, calc = [], errpatts = [], - rules = [Calc ("Groups.plus_class.plus", eval_binop "#add_"), - Calc ("Orderings.ord_class.less", eval_equ "#less_") +val list_rls = LTool.prep_rls @{theory} (Celem.merge_rls "list_erls" + (Celem.Rls {id = "replaced", preconds = [], rew_ord = ("termlessI", termlessI), + erls = Celem.Rls {id = "list_elrs", preconds = [], rew_ord = ("termlessI", termlessI), + erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Calc ("Orderings.ord_class.less", eval_equ "#less_") (* ~~~~~~ for nth_Cons_*)], - scr = EmptyScr}, - srls = Erls, calc = [], errpatts = [], - rules = [], scr = EmptyScr}) + scr = Celem.EmptyScr}, + srls = Celem.Erls, calc = [], errpatts = [], + rules = [], scr = Celem.EmptyScr}) list_rls); *} setup {* KEStore_Elems.add_rlss diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/Biegelinie.thy --- a/src/Tools/isac/Knowledge/Biegelinie.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/Biegelinie.thy Thu Mar 15 12:42:04 2018 +0100 @@ -94,109 +94,109 @@ (** problems **) setup {* KEStore_Elems.add_pbts - [(Specify.prep_pbt @{theory} "pbl_bieg" [] e_pblID + [(Specify.prep_pbt @{theory} "pbl_bieg" [] Celem.e_pblID (["Biegelinien"], [("#Given" ,["Traegerlaenge l_l", "Streckenlast q_q"]), (*("#Where",["0 < l_l"]), ...wait for < and handling Arbfix*) ("#Find" ,["Biegelinie b_b"]), ("#Relate",["Randbedingungen r_b"])], - append_rls "e_rls" e_rls [], NONE, [["IntegrierenUndKonstanteBestimmen2"]])), - (Specify.prep_pbt @{theory} "pbl_bieg_mom" [] e_pblID + Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [], NONE, [["IntegrierenUndKonstanteBestimmen2"]])), + (Specify.prep_pbt @{theory} "pbl_bieg_mom" [] Celem.e_pblID (["MomentBestimmte","Biegelinien"], [("#Given" ,["Traegerlaenge l_l", "Streckenlast q_q"]), (*("#Where",["0 < l_l"]), ...wait for < and handling Arbfix*) ("#Find" ,["Biegelinie b_b"]), ("#Relate",["RandbedingungenBiegung r_b","RandbedingungenMoment r_m"]) ], - append_rls "e_rls" e_rls [], NONE, [["IntegrierenUndKonstanteBestimmen"]])), - (Specify.prep_pbt @{theory} "pbl_bieg_momg" [] e_pblID - (["MomentGegebene","Biegelinien"], [], append_rls "e_rls" e_rls [], NONE, + Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [], NONE, [["IntegrierenUndKonstanteBestimmen"]])), + (Specify.prep_pbt @{theory} "pbl_bieg_momg" [] Celem.e_pblID + (["MomentGegebene","Biegelinien"], [], Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [], NONE, [["IntegrierenUndKonstanteBestimmen","2xIntegrieren"]])), - (Specify.prep_pbt @{theory} "pbl_bieg_einf" [] e_pblID - (["einfache","Biegelinien"], [], append_rls "e_rls" e_rls [], NONE, + (Specify.prep_pbt @{theory} "pbl_bieg_einf" [] Celem.e_pblID + (["einfache","Biegelinien"], [], Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [], NONE, [["IntegrierenUndKonstanteBestimmen","4x4System"]])), - (Specify.prep_pbt @{theory} "pbl_bieg_momquer" [] e_pblID - (["QuerkraftUndMomentBestimmte","Biegelinien"], [], append_rls "e_rls" e_rls [], NONE, + (Specify.prep_pbt @{theory} "pbl_bieg_momquer" [] Celem.e_pblID + (["QuerkraftUndMomentBestimmte","Biegelinien"], [], Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [], NONE, [["IntegrierenUndKonstanteBestimmen","1xIntegrieren"]])), - (Specify.prep_pbt @{theory} "pbl_bieg_vonq" [] e_pblID + (Specify.prep_pbt @{theory} "pbl_bieg_vonq" [] Celem.e_pblID (["vonBelastungZu","Biegelinien"], [("#Given" ,["Streckenlast q_q","FunktionsVariable v_v"]), ("#Find" ,["Funktionen funs'''"])], - append_rls "e_rls" e_rls [], NONE, [["Biegelinien","ausBelastung"]])), - (Specify.prep_pbt @{theory} "pbl_bieg_randbed" [] e_pblID + Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [], NONE, [["Biegelinien","ausBelastung"]])), + (Specify.prep_pbt @{theory} "pbl_bieg_randbed" [] Celem.e_pblID (["setzeRandbedingungen","Biegelinien"], [("#Given" ,["Funktionen fun_s","Randbedingungen r_b"]), ("#Find" ,["Gleichungen equs'''"])], - append_rls "e_rls" e_rls [], NONE, [["Biegelinien","setzeRandbedingungenEin"]])), - (Specify.prep_pbt @{theory} "pbl_equ_fromfun" [] e_pblID + Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [], NONE, [["Biegelinien","setzeRandbedingungenEin"]])), + (Specify.prep_pbt @{theory} "pbl_equ_fromfun" [] Celem.e_pblID (["makeFunctionTo","equation"], [("#Given" ,["functionEq fu_n","substitution su_b"]), ("#Find" ,["equality equ'''"])], - append_rls "e_rls" e_rls [], NONE, [["Equation","fromFunction"]]))] *} + Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [], NONE, [["Equation","fromFunction"]]))] *} ML {* (** methods **) -val srls = Rls {id="srls_IntegrierenUnd..", +val srls = Celem.Rls {id="srls_IntegrierenUnd..", preconds = [], rew_ord = ("termlessI",termlessI), - erls = append_rls "erls_in_srls_IntegrierenUnd.." e_rls + erls = Celem.append_rls "erls_in_srls_IntegrierenUnd.." Celem.e_rls [(*for asm in NTH_CONS ...*) - Calc ("Orderings.ord_class.less",eval_equ "#less_"), + Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"), (*2nd NTH_CONS pushes n+-1 into asms*) - Calc("Groups.plus_class.plus", eval_binop "#add_") + Celem.Calc("Groups.plus_class.plus", eval_binop "#add_") ], - srls = Erls, calc = [], errpatts = [], - rules = [Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}), - Calc("Groups.plus_class.plus", eval_binop "#add_"), - Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}), - Calc("Tools.lhs", eval_lhs"eval_lhs_"), - Calc("Tools.rhs", eval_rhs"eval_rhs_"), - Calc("Atools.argument'_in", + srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}), + Celem.Calc("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}), + Celem.Calc("Tools.lhs", eval_lhs"eval_lhs_"), + Celem.Calc("Tools.rhs", eval_rhs"eval_rhs_"), + Celem.Calc("Atools.argument'_in", eval_argument_in "Atools.argument'_in") ], - scr = EmptyScr}; + scr = Celem.EmptyScr}; val srls2 = - Rls {id="srls_IntegrierenUnd..", + Celem.Rls {id="srls_IntegrierenUnd..", preconds = [], rew_ord = ("termlessI",termlessI), - erls = append_rls "erls_in_srls_IntegrierenUnd.." e_rls + erls = Celem.append_rls "erls_in_srls_IntegrierenUnd.." Celem.e_rls [(*for asm in NTH_CONS ...*) - Calc ("Orderings.ord_class.less",eval_equ "#less_"), + Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"), (*2nd NTH_CONS pushes n+-1 into asms*) - Calc("Groups.plus_class.plus", eval_binop "#add_") + Celem.Calc("Groups.plus_class.plus", eval_binop "#add_") ], - srls = Erls, calc = [], errpatts = [], - rules = [Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}), - Calc("Groups.plus_class.plus", eval_binop "#add_"), - Thm ("NTH_NIL", TermC.num_str @{thm NTH_NIL}), - Calc("Tools.lhs", eval_lhs "eval_lhs_"), - Calc("Atools.filter'_sameFunId", + srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}), + Celem.Calc("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Thm ("NTH_NIL", TermC.num_str @{thm NTH_NIL}), + Celem.Calc("Tools.lhs", eval_lhs "eval_lhs_"), + Celem.Calc("Atools.filter'_sameFunId", eval_filter_sameFunId "Atools.filter'_sameFunId"), (*WN070514 just for smltest/../biegelinie.sml ...*) - Calc("Atools.sameFunId", eval_sameFunId "Atools.sameFunId"), - Thm ("filter_Cons", TermC.num_str @{thm filter_Cons}), - Thm ("filter_Nil", TermC.num_str @{thm filter_Nil}), - Thm ("if_True", TermC.num_str @{thm if_True}), - Thm ("if_False", TermC.num_str @{thm if_False}), - Thm ("hd_thm", TermC.num_str @{thm hd_thm}) + Celem.Calc("Atools.sameFunId", eval_sameFunId "Atools.sameFunId"), + Celem.Thm ("filter_Cons", TermC.num_str @{thm filter_Cons}), + Celem.Thm ("filter_Nil", TermC.num_str @{thm filter_Nil}), + Celem.Thm ("if_True", TermC.num_str @{thm if_True}), + Celem.Thm ("if_False", TermC.num_str @{thm if_False}), + Celem.Thm ("hd_thm", TermC.num_str @{thm hd_thm}) ], - scr = EmptyScr}; + scr = Celem.EmptyScr}; *} setup {* KEStore_Elems.add_mets - [Specify.prep_met @{theory} "met_biege" [] e_metID + [Specify.prep_met @{theory} "met_biege" [] Celem.e_metID (["IntegrierenUndKonstanteBestimmen"], [("#Given" ,["Traegerlaenge l_l", "Streckenlast q__q", "FunktionsVariable v_v"]), (*("#Where",["0 < l_l"]), ...wait for < and handling Arbfix*) ("#Find" ,["Biegelinie b_b"]), ("#Relate",["RandbedingungenBiegung r_b", "RandbedingungenMoment r_m"])], {rew_ord'="tless_true", - rls' = append_rls "erls_IntegrierenUndK.." e_rls - [Calc ("Atools.ident",eval_ident "#ident_"), - Thm ("not_true",TermC.num_str @{thm not_true}), - Thm ("not_false",TermC.num_str @{thm not_false})], - calc = [], srls = srls, prls = Erls, crls = Atools_erls, errpats = [], nrls = Erls}, + rls' = Celem.append_rls "erls_IntegrierenUndK.." Celem.e_rls + [Celem.Calc ("Atools.ident",eval_ident "#ident_"), + Celem.Thm ("not_true",TermC.num_str @{thm not_true}), + Celem.Thm ("not_false",TermC.num_str @{thm not_false})], + calc = [], srls = srls, prls = Celem.Erls, crls = Atools_erls, errpats = [], nrls = Celem.Erls}, "Script BiegelinieScript " ^ "(l_l::real) (q__q::real) (v_v::real) (b_b::real=>real) " ^ "(r_b::bool list) (r_m::bool list) = " ^ @@ -261,25 +261,25 @@ " B__B = ((Substitute c_1_2) @@ " ^ " (Rewrite_Set_Inst [(bdv, x)] make_ratpoly_in False)) B__B " ^ " in B__B)"), - Specify.prep_met @{theory} "met_biege_2" [] e_metID + Specify.prep_met @{theory} "met_biege_2" [] Celem.e_metID (["IntegrierenUndKonstanteBestimmen2"], [("#Given" ,["Traegerlaenge l_l", "Streckenlast q__q", "FunktionsVariable v_v"]), (*("#Where",["0 < l_l"]), ...wait for < and handling Arbfix*) ("#Find" ,["Biegelinie b_b"]), ("#Relate",["Randbedingungen r_b"])], {rew_ord'="tless_true", - rls' = append_rls "erls_IntegrierenUndK.." e_rls - [Calc ("Atools.ident",eval_ident "#ident_"), - Thm ("not_true",TermC.num_str @{thm not_true}), - Thm ("not_false",TermC.num_str @{thm not_false})], + rls' = Celem.append_rls "erls_IntegrierenUndK.." Celem.e_rls + [Celem.Calc ("Atools.ident",eval_ident "#ident_"), + Celem.Thm ("not_true",TermC.num_str @{thm not_true}), + Celem.Thm ("not_false",TermC.num_str @{thm not_false})], calc = [], - srls = append_rls "erls_IntegrierenUndK.." e_rls - [Calc("Tools.rhs", eval_rhs"eval_rhs_"), - Calc ("Atools.ident",eval_ident "#ident_"), - Thm ("last_thmI",TermC.num_str @{thm last_thmI}), - Thm ("if_True",TermC.num_str @{thm if_True}), - Thm ("if_False",TermC.num_str @{thm if_False})], - prls = Erls, crls = Atools_erls, errpats = [], nrls = Erls}, + srls = Celem.append_rls "erls_IntegrierenUndK.." Celem.e_rls + [Celem.Calc("Tools.rhs", eval_rhs"eval_rhs_"), + Celem.Calc ("Atools.ident",eval_ident "#ident_"), + Celem.Thm ("last_thmI",TermC.num_str @{thm last_thmI}), + Celem.Thm ("if_True",TermC.num_str @{thm if_True}), + Celem.Thm ("if_False",TermC.num_str @{thm if_False})], + prls = Celem.Erls, crls = Atools_erls, errpats = [], nrls = Celem.Erls}, "Script Biegelinie2Script " ^ "(l_l::real) (q__q::real) (v_v::real) (b_b::real=>real) (r_b::bool list) = " ^ " (let " ^ @@ -298,39 +298,39 @@ " B_B = ((Substitute con_s) @@ " ^ " (Rewrite_Set_Inst [(bdv, v_v)] make_ratpoly_in False)) B_B " ^ " in B_B)"), - Specify.prep_met @{theory} "met_biege_intconst_2" [] e_metID + Specify.prep_met @{theory} "met_biege_intconst_2" [] Celem.e_metID (["IntegrierenUndKonstanteBestimmen","2xIntegrieren"], [], - {rew_ord'="tless_true", rls'=Erls, calc = [], srls = e_rls, prls=e_rls, crls = Atools_erls, - errpats = [], nrls = e_rls}, + {rew_ord'="tless_true", rls'=Celem.Erls, calc = [], srls = Celem.e_rls, prls=Celem.e_rls, crls = Atools_erls, + errpats = [], nrls = Celem.e_rls}, "empty_script"), - Specify.prep_met @{theory} "met_biege_intconst_4" [] e_metID + Specify.prep_met @{theory} "met_biege_intconst_4" [] Celem.e_metID (["IntegrierenUndKonstanteBestimmen","4x4System"], [], - {rew_ord'="tless_true", rls'=Erls, calc = [], srls = e_rls, prls=e_rls, crls = Atools_erls, - errpats = [], nrls = e_rls}, + {rew_ord'="tless_true", rls'=Celem.Erls, calc = [], srls = Celem.e_rls, prls=Celem.e_rls, crls = Atools_erls, + errpats = [], nrls = Celem.e_rls}, "empty_script"), - Specify.prep_met @{theory} "met_biege_intconst_1" [] e_metID + Specify.prep_met @{theory} "met_biege_intconst_1" [] Celem.e_metID (["IntegrierenUndKonstanteBestimmen","1xIntegrieren"], [], - {rew_ord'="tless_true", rls'=Erls, calc = [], srls = e_rls, prls=e_rls, crls = Atools_erls, - errpats = [], nrls = e_rls}, + {rew_ord'="tless_true", rls'=Celem.Erls, calc = [], srls = Celem.e_rls, prls=Celem.e_rls, crls = Atools_erls, + errpats = [], nrls = Celem.e_rls}, "empty_script"), - Specify.prep_met @{theory} "met_biege2" [] e_metID + Specify.prep_met @{theory} "met_biege2" [] Celem.e_metID (["Biegelinien"], [], - {rew_ord'="tless_true", rls'=Erls, calc = [], srls = e_rls, prls=e_rls, crls = Atools_erls, - errpats = [], nrls = e_rls}, + {rew_ord'="tless_true", rls'=Celem.Erls, calc = [], srls = Celem.e_rls, prls=Celem.e_rls, crls = Atools_erls, + errpats = [], nrls = Celem.e_rls}, "empty_script"), - Specify.prep_met @{theory} "met_biege_ausbelast" [] e_metID + Specify.prep_met @{theory} "met_biege_ausbelast" [] Celem.e_metID (["Biegelinien", "ausBelastung"], [("#Given" ,["Streckenlast q__q", "FunktionsVariable v_v"]), ("#Find" ,["Funktionen fun_s"])], {rew_ord'="tless_true", - rls' = append_rls "erls_ausBelastung" e_rls - [Calc ("Atools.ident", eval_ident "#ident_"), - Thm ("not_true", TermC.num_str @{thm not_true}), - Thm ("not_false", TermC.num_str @{thm not_false})], + rls' = Celem.append_rls "erls_ausBelastung" Celem.e_rls + [Celem.Calc ("Atools.ident", eval_ident "#ident_"), + Celem.Thm ("not_true", TermC.num_str @{thm not_true}), + Celem.Thm ("not_false", TermC.num_str @{thm not_false})], calc = [], - srls = append_rls "srls_ausBelastung" e_rls - [Calc ("Tools.rhs", eval_rhs "eval_rhs_")], - prls = e_rls, crls = Atools_erls, errpats = [], nrls = e_rls}, + srls = Celem.append_rls "srls_ausBelastung" Celem.e_rls + [Celem.Calc ("Tools.rhs", eval_rhs "eval_rhs_")], + prls = Celem.e_rls, crls = Atools_erls, errpats = [], nrls = Celem.e_rls}, "Script Belastung2BiegelScript (q__q::real) (v_v::real) = " ^ " (let q___q = Take (qq v_v = q__q); " ^ " q___q = ((Rewrite sym_neg_equal_iff_equal True) @@ " ^ @@ -355,12 +355,12 @@ " [diff,integration,named]) " ^ " [REAL (rhs N__N), REAL v_v, REAL_REAL y]) " ^ " in [Q__Q, M__M, N__N, B__B])"), - Specify.prep_met @{theory} "met_biege_setzrand" [] e_metID + Specify.prep_met @{theory} "met_biege_setzrand" [] Celem.e_metID (["Biegelinien", "setzeRandbedingungenEin"], [("#Given" , ["Funktionen fun_s", "Randbedingungen r_b"]), ("#Find" , ["Gleichungen equs'''"])], - {rew_ord'="tless_true", rls'=Erls, calc = [], srls = srls2, prls=e_rls, crls = Atools_erls, - errpats = [], nrls = e_rls}, + {rew_ord'="tless_true", rls'=Celem.Erls, calc = [], srls = srls2, prls=Celem.e_rls, crls = Atools_erls, + errpats = [], nrls = Celem.e_rls}, "Script SetzeRandbedScript (fun_s::bool list) (r_b::bool list) = " ^ " (let b_1 = NTH 1 r_b; " ^ " f_s = filter_sameFunId (lhs b_1) fun_s; " ^ @@ -414,15 +414,15 @@ " [Equation,fromFunction]) " ^ " [BOOL (hd f_s), BOOL b_4]) " ^ " in [e_1,e_2,e_3,e_4])"*)), - Specify.prep_met @{theory} "met_equ_fromfun" [] e_metID + Specify.prep_met @{theory} "met_equ_fromfun" [] Celem.e_metID (["Equation","fromFunction"], [("#Given" ,["functionEq fu_n","substitution su_b"]), ("#Find" ,["equality equ'''"])], - {rew_ord'="tless_true", rls'=Erls, calc = [], - srls = append_rls "srls_in_EquationfromFunc" e_rls - [Calc("Tools.lhs", eval_lhs"eval_lhs_"), - Calc("Atools.argument'_in", eval_argument_in "Atools.argument'_in")], - prls=e_rls, crls = Atools_erls, errpats = [], nrls = e_rls}, + {rew_ord'="tless_true", rls'=Celem.Erls, calc = [], + srls = Celem.append_rls "srls_in_EquationfromFunc" Celem.e_rls + [Celem.Calc("Tools.lhs", eval_lhs"eval_lhs_"), + Celem.Calc("Atools.argument'_in", eval_argument_in "Atools.argument'_in")], + prls=Celem.e_rls, crls = Atools_erls, errpats = [], nrls = Celem.e_rls}, (*(M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2) (M_b L = 0) --> 0 = c_2 + c * L + -1 * q_0 / 2 * L ^^^ 2*) "Script Function2Equality (fu_n::bool) (su_b::bool) =" ^ diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/Build_Thydata.thy --- a/src/Tools/isac/Knowledge/Build_Thydata.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/Build_Thydata.thy Thu Mar 15 12:42:04 2018 +0100 @@ -43,12 +43,12 @@ subsubsection {* From rule-sets collect theorems, which have been taken from Isabelle *} ML {* val isacrlsthms = (*length = 460*) - thms_of_rlss @{theory} (KEStore_Elems.get_rlss knowledge_parent) : (thmID * thm) list + thms_of_rlss @{theory} (KEStore_Elems.get_rlss knowledge_parent) : (Celem.thmID * thm) list val rlsthmsNOTisac = isacrlsthms (*length = 36*) |> filter (fn (deriv, _) => - member op= (map Context.theory_name isabthys') (thyID_of_derivation_name deriv)) - : (thmID * thm) list + member op= (map Context.theory_name isabthys') (Celem.thyID_of_derivation_name deriv)) + : (Celem.thmID * thm) list *} subsubsection {* Collect data in a (key, data) list and insert data into the tree *} @@ -62,7 +62,7 @@ collect_part "IsacKnowledge" knowledge_parent knowthys' @ (map (collect_isab "Isabelle") rlsthmsNOTisac) @ collect_part "IsacScripts" proglang_parent progthys' -: (theID * thydata) list +: (Celem.theID * Celem.thydata) list *} setup {* KEStore_Elems.add_thes (map (fn (a, b) => (b, a)) thydata_list) *} @@ -94,7 +94,7 @@ ("fill-inner-deriv", TermC.parse_patt @{theory Diff} "d_d ?bdv (sin ?u) = cos ?u * _", "chain-rule-diff-both"), ("fill-all", - TermC.parse_patt @{theory Diff} "d_d ?bdv (sin ?u) = _", "chain-rule-diff-both")]: fillpat list)) + TermC.parse_patt @{theory Diff} "d_d ?bdv (sin ?u) = _", "chain-rule-diff-both")]: Celem.fillpat list)) ] *} diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/Diff.thy --- a/src/Tools/isac/Knowledge/Diff.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/Diff.thy Thu Mar 15 12:42:04 2018 +0100 @@ -100,11 +100,11 @@ fun primed (Const (id, T)) = Const (id ^ "'", T) | primed (Free (id, T)) = Free (id ^ "'", T) - | primed t = error ("primed called with arg = '"^ term2str t ^"'"); + | primed t = error ("primed called with arg = '"^ Celem.term2str t ^"'"); (*("primed", ("Diff.primed", eval_primed "#primed"))*) fun eval_primed _ _ (p as (Const ("Diff.primed",_) $ t)) _ = - SOME ((term2str p) ^ " = " ^ term2str (primed t), + SOME ((Celem.term2str p) ^ " = " ^ Celem.term2str (primed t), HOLogic.Trueprop $ (TermC.mk_equality (p, primed t))) | eval_primed _ _ _ _ = NONE; *} @@ -115,129 +115,129 @@ (*.converts a term such that differentiation works optimally.*) val diff_conv = - Rls {id="diff_conv", + Celem.Rls {id="diff_conv", preconds = [], rew_ord = ("termlessI",termlessI), - erls = append_rls "erls_diff_conv" e_rls - [Calc ("Atools.occurs'_in", eval_occurs_in ""), - Thm ("not_true",TermC.num_str @{thm not_true}), - Thm ("not_false",TermC.num_str @{thm not_false}), - Calc ("Orderings.ord_class.less",eval_equ "#less_"), - Thm ("and_true",TermC.num_str @{thm and_true}), - Thm ("and_false",TermC.num_str @{thm and_false}) + erls = Celem.append_rls "erls_diff_conv" Celem.e_rls + [Celem.Calc ("Atools.occurs'_in", eval_occurs_in ""), + Celem.Thm ("not_true",TermC.num_str @{thm not_true}), + Celem.Thm ("not_false",TermC.num_str @{thm not_false}), + Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"), + Celem.Thm ("and_true",TermC.num_str @{thm and_true}), + Celem.Thm ("and_false",TermC.num_str @{thm and_false}) ], - srls = Erls, calc = [], errpatts = [], + srls = Celem.Erls, calc = [], errpatts = [], rules = - [Thm ("frac_conv", TermC.num_str @{thm frac_conv}), + [Celem.Thm ("frac_conv", TermC.num_str @{thm frac_conv}), (*"?bdv occurs_in ?b \ 0 < ?n \ ?a / ?b ^^^ ?n = ?a * ?b ^^^ - ?n"*) - Thm ("sqrt_conv_bdv", TermC.num_str @{thm sqrt_conv_bdv}), + Celem.Thm ("sqrt_conv_bdv", TermC.num_str @{thm sqrt_conv_bdv}), (*"sqrt ?bdv = ?bdv ^^^ (1 / 2)"*) - Thm ("sqrt_conv_bdv_n", TermC.num_str @{thm sqrt_conv_bdv_n}), + Celem.Thm ("sqrt_conv_bdv_n", TermC.num_str @{thm sqrt_conv_bdv_n}), (*"sqrt (?bdv ^^^ ?n) = ?bdv ^^^ (?n / 2)"*) - Thm ("sqrt_conv", TermC.num_str @{thm sqrt_conv}), + Celem.Thm ("sqrt_conv", TermC.num_str @{thm sqrt_conv}), (*"?bdv occurs_in ?u \ sqrt ?u = ?u ^^^ (1 / 2)"*) - Thm ("root_conv", TermC.num_str @{thm root_conv}), + Celem.Thm ("root_conv", TermC.num_str @{thm root_conv}), (*"?bdv occurs_in ?u \ nroot ?n ?u = ?u ^^^ (1 / ?n)"*) - Thm ("realpow_pow_bdv", TermC.num_str @{thm realpow_pow_bdv}), + Celem.Thm ("realpow_pow_bdv", TermC.num_str @{thm realpow_pow_bdv}), (* "(?bdv ^^^ ?b) ^^^ ?c = ?bdv ^^^ (?b * ?c)"*) - Calc ("Groups.times_class.times", eval_binop "#mult_"), - Thm ("rat_mult",TermC.num_str @{thm rat_mult}), + Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"), + Celem.Thm ("rat_mult",TermC.num_str @{thm rat_mult}), (*a / b * (c / d) = a * c / (b * d)*) - Thm ("times_divide_eq_right",TermC.num_str @{thm times_divide_eq_right}), + Celem.Thm ("times_divide_eq_right",TermC.num_str @{thm times_divide_eq_right}), (*?x * (?y / ?z) = ?x * ?y / ?z*) - Thm ("times_divide_eq_left",TermC.num_str @{thm times_divide_eq_left}) + Celem.Thm ("times_divide_eq_left",TermC.num_str @{thm times_divide_eq_left}) (*?y / ?z * ?x = ?y * ?x / ?z*) ], - scr = EmptyScr}; + scr = Celem.EmptyScr}; *} ML {* (*.beautifies a term after differentiation.*) val diff_sym_conv = - Rls {id="diff_sym_conv", + Celem.Rls {id="diff_sym_conv", preconds = [], rew_ord = ("termlessI",termlessI), - erls = append_rls "erls_diff_sym_conv" e_rls - [Calc ("Orderings.ord_class.less",eval_equ "#less_") + erls = Celem.append_rls "erls_diff_sym_conv" Celem.e_rls + [Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_") ], - srls = Erls, calc = [], errpatts = [], - rules = [Thm ("frac_sym_conv", TermC.num_str @{thm frac_sym_conv}), - Thm ("sqrt_sym_conv", TermC.num_str @{thm sqrt_sym_conv}), - Thm ("root_sym_conv", TermC.num_str @{thm root_sym_conv}), - Thm ("sym_real_mult_minus1", + srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Thm ("frac_sym_conv", TermC.num_str @{thm frac_sym_conv}), + Celem.Thm ("sqrt_sym_conv", TermC.num_str @{thm sqrt_sym_conv}), + Celem.Thm ("root_sym_conv", TermC.num_str @{thm root_sym_conv}), + Celem.Thm ("sym_real_mult_minus1", TermC.num_str (@{thm real_mult_minus1} RS @{thm sym})), (*- ?z = "-1 * ?z"*) - Thm ("rat_mult",TermC.num_str @{thm rat_mult}), + Celem.Thm ("rat_mult",TermC.num_str @{thm rat_mult}), (*a / b * (c / d) = a * c / (b * d)*) - Thm ("times_divide_eq_right",TermC.num_str @{thm times_divide_eq_right}), + Celem.Thm ("times_divide_eq_right",TermC.num_str @{thm times_divide_eq_right}), (*?x * (?y / ?z) = ?x * ?y / ?z*) - Thm ("times_divide_eq_left",TermC.num_str @{thm times_divide_eq_left}), + Celem.Thm ("times_divide_eq_left",TermC.num_str @{thm times_divide_eq_left}), (*?y / ?z * ?x = ?y * ?x / ?z*) - Calc ("Groups.times_class.times", eval_binop "#mult_") + Celem.Calc ("Groups.times_class.times", eval_binop "#mult_") ], - scr = EmptyScr}; + scr = Celem.EmptyScr}; (*..*) val srls_diff = - Rls {id="srls_differentiate..", + Celem.Rls {id="srls_differentiate..", preconds = [], rew_ord = ("termlessI",termlessI), - erls = e_rls, - srls = Erls, calc = [], errpatts = [], - rules = [Calc("Tools.lhs", eval_lhs "eval_lhs_"), - Calc("Tools.rhs", eval_rhs "eval_rhs_"), - Calc("Diff.primed", eval_primed "Diff.primed") + erls = Celem.e_rls, + srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Calc("Tools.lhs", eval_lhs "eval_lhs_"), + Celem.Calc("Tools.rhs", eval_rhs "eval_rhs_"), + Celem.Calc("Diff.primed", eval_primed "Diff.primed") ], - scr = EmptyScr}; + scr = Celem.EmptyScr}; *} ML {* (*..*) val erls_diff = - append_rls "erls_differentiate.." e_rls - [Thm ("not_true",TermC.num_str @{thm not_true}), - Thm ("not_false",TermC.num_str @{thm not_false}), + Celem.append_rls "erls_differentiate.." Celem.e_rls + [Celem.Thm ("not_true",TermC.num_str @{thm not_true}), + Celem.Thm ("not_false",TermC.num_str @{thm not_false}), - Calc ("Atools.ident",eval_ident "#ident_"), - Calc ("Atools.is'_atom",eval_is_atom "#is_atom_"), - Calc ("Atools.occurs'_in",eval_occurs_in ""), - Calc ("Atools.is'_const",eval_const "#is_const_") + Celem.Calc ("Atools.ident",eval_ident "#ident_"), + Celem.Calc ("Atools.is'_atom",eval_is_atom "#is_atom_"), + Celem.Calc ("Atools.occurs'_in",eval_occurs_in ""), + Celem.Calc ("Atools.is'_const",eval_const "#is_const_") ]; (*.rules for differentiation, _no_ simplification.*) val diff_rules = - Rls {id="diff_rules", preconds = [], rew_ord = ("termlessI",termlessI), - erls = erls_diff, srls = Erls, calc = [], errpatts = [], - rules = [Thm ("diff_sum",TermC.num_str @{thm diff_sum}), - Thm ("diff_dif",TermC.num_str @{thm diff_dif}), - Thm ("diff_prod_const",TermC.num_str @{thm diff_prod_const}), - Thm ("diff_prod",TermC.num_str @{thm diff_prod}), - Thm ("diff_quot",TermC.num_str @{thm diff_quot}), - Thm ("diff_sin",TermC.num_str @{thm diff_sin}), - Thm ("diff_sin_chain",TermC.num_str @{thm diff_sin_chain}), - Thm ("diff_cos",TermC.num_str @{thm diff_cos}), - Thm ("diff_cos_chain",TermC.num_str @{thm diff_cos_chain}), - Thm ("diff_pow",TermC.num_str @{thm diff_pow}), - Thm ("diff_pow_chain",TermC.num_str @{thm diff_pow_chain}), - Thm ("diff_ln",TermC.num_str @{thm diff_ln}), - Thm ("diff_ln_chain",TermC.num_str @{thm diff_ln_chain}), - Thm ("diff_exp",TermC.num_str @{thm diff_exp}), - Thm ("diff_exp_chain",TermC.num_str @{thm diff_exp_chain}), + Celem.Rls {id="diff_rules", preconds = [], rew_ord = ("termlessI",termlessI), + erls = erls_diff, srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Thm ("diff_sum",TermC.num_str @{thm diff_sum}), + Celem.Thm ("diff_dif",TermC.num_str @{thm diff_dif}), + Celem.Thm ("diff_prod_const",TermC.num_str @{thm diff_prod_const}), + Celem.Thm ("diff_prod",TermC.num_str @{thm diff_prod}), + Celem.Thm ("diff_quot",TermC.num_str @{thm diff_quot}), + Celem.Thm ("diff_sin",TermC.num_str @{thm diff_sin}), + Celem.Thm ("diff_sin_chain",TermC.num_str @{thm diff_sin_chain}), + Celem.Thm ("diff_cos",TermC.num_str @{thm diff_cos}), + Celem.Thm ("diff_cos_chain",TermC.num_str @{thm diff_cos_chain}), + Celem.Thm ("diff_pow",TermC.num_str @{thm diff_pow}), + Celem.Thm ("diff_pow_chain",TermC.num_str @{thm diff_pow_chain}), + Celem.Thm ("diff_ln",TermC.num_str @{thm diff_ln}), + Celem.Thm ("diff_ln_chain",TermC.num_str @{thm diff_ln_chain}), + Celem.Thm ("diff_exp",TermC.num_str @{thm diff_exp}), + Celem.Thm ("diff_exp_chain",TermC.num_str @{thm diff_exp_chain}), (* - Thm ("diff_sqrt",TermC.num_str @{thm diff_sqrt}), - Thm ("diff_sqrt_chain",TermC.num_str @{thm diff_sqrt_chain}), + Celem.Thm ("diff_sqrt",TermC.num_str @{thm diff_sqrt}), + Celem.Thm ("diff_sqrt_chain",TermC.num_str @{thm diff_sqrt_chain}), *) - Thm ("diff_const",TermC.num_str @{thm diff_const}), - Thm ("diff_var",TermC.num_str @{thm diff_var}) + Celem.Thm ("diff_const",TermC.num_str @{thm diff_const}), + Celem.Thm ("diff_var",TermC.num_str @{thm diff_var}) ], - scr = EmptyScr}; + scr = Celem.EmptyScr}; *} ML {* (*.normalisation for checking user-input.*) val norm_diff = - Rls + Celem.Rls {id="norm_diff", preconds = [], rew_ord = ("termlessI",termlessI), - erls = Erls, srls = Erls, calc = [], errpatts = [], - rules = [Rls_ diff_rules, Rls_ norm_Poly ], - scr = EmptyScr}; + erls = Celem.Erls, srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Rls_ diff_rules, Celem.Rls_ norm_Poly ], + scr = Celem.EmptyScr}; *} setup {* KEStore_Elems.add_rlss [("erls_diff", (Context.theory_name @{theory}, prep_rls' erls_diff)), @@ -248,20 +248,20 @@ (** problem types **) setup {* KEStore_Elems.add_pbts - [(Specify.prep_pbt thy "pbl_fun" [] e_pblID (["function"], [], e_rls, NONE, [])), - (Specify.prep_pbt thy "pbl_fun_deriv" [] e_pblID + [(Specify.prep_pbt thy "pbl_fun" [] Celem.e_pblID (["function"], [], Celem.e_rls, NONE, [])), + (Specify.prep_pbt thy "pbl_fun_deriv" [] Celem.e_pblID (["derivative_of","function"], [("#Given" ,["functionTerm f_f","differentiateFor v_v"]), ("#Find" ,["derivative f_f'"])], - append_rls "e_rls" e_rls [], + Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [], SOME "Diff (f_f, v_v)", [["diff","differentiate_on_R"], ["diff","after_simplification"]])), (*here "named" is used differently from Integration"*) - (Specify.prep_pbt thy "pbl_fun_deriv_nam" [] e_pblID + (Specify.prep_pbt thy "pbl_fun_deriv_nam" [] Celem.e_pblID (["named","derivative_of","function"], [("#Given" ,["functionEq f_f","differentiateFor v_v"]), ("#Find" ,["derivativeEq f_f'"])], - append_rls "e_rls" e_rls [], + Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [], SOME "Differentiate (f_f, v_v)", [["diff","differentiate_equality"]]))] *} @@ -281,16 +281,16 @@ | argl2dtss _ = error "Diff.ML: wrong argument for argl2dtss"; *} setup {* KEStore_Elems.add_mets - [Specify.prep_met thy "met_diff" [] e_metID + [Specify.prep_met thy "met_diff" [] Celem.e_metID (["diff"], [], - {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = e_rls, prls=e_rls, + {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = Celem.e_rls, prls=Celem.e_rls, crls = Atools_erls, errpats = [], nrls = norm_diff}, "empty_script"), - Specify.prep_met thy "met_diff_onR" [] e_metID + Specify.prep_met thy "met_diff_onR" [] Celem.e_metID (["diff","differentiate_on_R"], [("#Given" ,["functionTerm f_f","differentiateFor v_v"]), ("#Find" ,["derivative f_f'"])], - {rew_ord'="tless_true", rls' = erls_diff, calc = [], srls = e_rls, prls=e_rls, + {rew_ord'="tless_true", rls' = erls_diff, calc = [], srls = Celem.e_rls, prls=Celem.e_rls, crls = Atools_erls, errpats = [], nrls = norm_diff}, "Script DiffScr (f_f::real) (v_v::real) = " ^ " (let f_f' = Take (d_d v_v f_f) " ^ @@ -314,11 +314,11 @@ " (Repeat (Rewrite_Inst [(bdv,v_v)] diff_var False)) Or " ^ " (Repeat (Rewrite_Set make_polynomial False)))) @@ " ^ " (Try (Rewrite_Set_Inst [(bdv,v_v)] diff_sym_conv False)))) f_f')"), - Specify.prep_met thy "met_diff_simpl" [] e_metID + Specify.prep_met thy "met_diff_simpl" [] Celem.e_metID (["diff","diff_simpl"], [("#Given", ["functionTerm f_f","differentiateFor v_v"]), ("#Find" , ["derivative f_f'"])], - {rew_ord'="tless_true", rls' = erls_diff, calc = [], srls = e_rls, prls=e_rls, + {rew_ord'="tless_true", rls' = erls_diff, calc = [], srls = Celem.e_rls, prls=Celem.e_rls, crls = Atools_erls, errpats = [], nrls = norm_diff}, "Script DiffScr (f_f::real) (v_v::real) = " ^ " (let f_f' = Take (d_d v_v f_f) " ^ @@ -342,11 +342,11 @@ " (Repeat (Rewrite_Inst [(bdv,v_v)] diff_var False)) Or " ^ " (Repeat (Rewrite_Set make_polynomial False)))) " ^ " )) f_f')"), - Specify.prep_met thy "met_diff_equ" [] e_metID + Specify.prep_met thy "met_diff_equ" [] Celem.e_metID (["diff","differentiate_equality"], [("#Given" ,["functionEq f_f","differentiateFor v_v"]), ("#Find" ,["derivativeEq f_f'"])], - {rew_ord'="tless_true", rls' = erls_diff, calc = [], srls = srls_diff, prls=e_rls, + {rew_ord'="tless_true", rls' = erls_diff, calc = [], srls = srls_diff, prls=Celem.e_rls, crls=Atools_erls, errpats = [], nrls = norm_diff}, "Script DiffEqScr (f_f::bool) (v_v::real) = " ^ " (let f_f' = Take ((primed (lhs f_f)) = d_d v_v (rhs f_f)) " ^ @@ -371,11 +371,11 @@ " (Repeat (Rewrite_Inst [(bdv,v_v)] diff_var False)) Or " ^ " (Repeat (Rewrite_Set make_polynomial False)))) @@ " ^ " (Try (Rewrite_Set_Inst [(bdv,v_v)] diff_sym_conv False)))) f_f')"), - Specify.prep_met thy "met_diff_after_simp" [] e_metID + Specify.prep_met thy "met_diff_after_simp" [] Celem.e_metID (["diff","after_simplification"], [("#Given" ,["functionTerm f_f","differentiateFor v_v"]), ("#Find" ,["derivative f_f'"])], - {rew_ord'="tless_true", rls' = e_rls, calc = [], srls = e_rls, prls=e_rls, + {rew_ord'="tless_true", rls' = Celem.e_rls, calc = [], srls = Celem.e_rls, prls=Celem.e_rls, crls=Atools_erls, errpats = [], nrls = norm_Rational}, "Script DiffScr (f_f::real) (v_v::real) = " ^ " (let f_f' = Take (d_d v_v f_f) " ^ diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/DiffApp-scrpbl.sml --- a/src/Tools/isac/Knowledge/DiffApp-scrpbl.sml Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/DiffApp-scrpbl.sml Thu Mar 15 12:42:04 2018 +0100 @@ -315,7 +315,7 @@ "additionalRels [A=#2*a*b - a^^^#2,(a//#2)^^^#2 + (b//#2)^^^#2 =R^^^#2]", "additionalRels [A=#2*a*b - a^^^#2,a=#2*R*sin alpha, b=#2*R*cos alpha]"]; val (dI',pI',mI')= - ("DiffAppl",["Script","maximum_of","function"],e_metID); + ("DiffAppl",["Script","maximum_of","function"],Celem.e_metID); val c = []:cid; (* @@ -416,14 +416,14 @@ "additionalRels [(a//#2)^^^#2 + (b//#2)^^^#2 =R^^^#2]", "additionalRels [a=#2*R*sin alpha, b=#2*R*cos alpha]"]; val (dI',pI',mI')= - ("DiffAppl",["DiffAppl","test_maximum"],e_metID); + ("DiffAppl",["DiffAppl","test_maximum"],Celem.e_metID); val p = e_pos'; val c = []; val (mI,m) = ("Init_Proof",Init_Proof (cts, (dI',pI',mI'))); -val (pst as (sc,pt,cl):pstate) = (EmptyScr, e_ctree, []); +val (pst as (sc,pt,cl):pstate) = (Celem.EmptyScr, e_ctree, []); val (p,_,f,nxt,_,(_,pt,_)) = do_ (mI,m) p c pst; (*val nxt = ("Add_Given",Add_Given "fixedValues [R = R]")*) val (p,_,Form' (PpcKF (_,_,ppc)),nxt,_,(_,pt,_)) = - do_ nxt p c (EmptyScr,pt,[]); + do_ nxt p c (Celem.EmptyScr,pt,[]); (*val nxt = ("Add_Given",Add_Given "boundVariable a") *) diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/DiffApp.sml --- a/src/Tools/isac/Knowledge/DiffApp.sml Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/DiffApp.sml Thu Mar 15 12:42:04 2018 +0100 @@ -24,7 +24,7 @@ ]), prep_pbt DiffAppl.thy - (["DiffAppl","make","function"]:pblID, + (["DiffAppl","make","function"], [("#Given" ,"functionOf f_f"), ("#Given" ,"boundVariable v_v"), ("#Given" ,"equalities eqs"), @@ -32,7 +32,7 @@ ]), prep_pbt DiffAppl.thy - (["DiffAppl","on_interval","maximum_of","function"]:pblID, + (["DiffAppl","on_interval","maximum_of","function"], [("#Given" ,"functionTerm t_"), ("#Given" ,"boundVariable v_v"), ("#Given" ,"interval itv_"), @@ -40,7 +40,7 @@ ]), prep_pbt DiffAppl.thy - (["DiffAppl","find_values","tool"]:pblID, + (["DiffAppl","find_values","tool"], [("#Given" ,"maxArgument ma_"), ("#Given" ,"functionTerm f_f"), ("#Given" ,"boundVariable v_v"), @@ -52,7 +52,7 @@ methods:= overwritel (!methods, [ - (("DiffAppl","max_by_calculus"):metID, + (("DiffAppl","max_by_calculus"), {ppc = prep_met DiffAppl.thy [("#Given" ,"fixedValues f_ix"), ("#Given" ,"boundVariable v_v"), @@ -63,9 +63,9 @@ ("#Relate","relations r_s") ], rew_ord'="tless_true",rls'="eval_rls",asm_rls=[],asm_thm=[], - scr=EmptyScr} : met), + scr=Celem.EmptyScr} : met), - (("DiffAppl","make_fun_by_new_variable"):metID, + (("DiffAppl","make_fun_by_new_variable"), {ppc = prep_met DiffAppl.thy [("#Given" ,"functionOf f_f"), ("#Given" ,"boundVariable v_v"), @@ -73,9 +73,9 @@ ("#Find" ,"functionTerm f_0_") ], rew_ord'="tless_true",rls'="eval_rls",asm_rls=[],asm_thm=[], - scr=EmptyScr} : met), + scr=Celem.EmptyScr} : met), - (("DiffAppl","make_fun_by_explicit"):metID, + (("DiffAppl","make_fun_by_explicit"), {ppc = prep_met DiffAppl.thy [("#Given" ,"functionOf f_f"), ("#Given" ,"boundVariable v_v"), @@ -83,9 +83,9 @@ ("#Find" ,"functionTerm f_0_") ], rew_ord'="tless_true",rls'="eval_rls",asm_rls=[],asm_thm=[], - scr=EmptyScr} : met), + scr=Celem.EmptyScr} : met), - (("DiffAppl","max_on_interval_by_calculus"):metID, + (("DiffAppl","max_on_interval_by_calculus"), {ppc = prep_met DiffAppl.thy [("#Given" ,"functionTerm t_"), ("#Given" ,"boundVariable v_v"), @@ -94,11 +94,11 @@ ("#Find" ,"maxArgument v_0") ], rew_ord'="tless_true",rls'="eval_rls",asm_rls=[],asm_thm=[], - scr=EmptyScr} : met), + scr=Celem.EmptyScr} : met), - (("DiffAppl","find_values"):metID, + (("DiffAppl","find_values"), {ppc = prep_met DiffAppl.thy [], rew_ord'="tless_true",rls'="eval_rls",asm_rls=[],asm_thm=[], - scr=EmptyScr} : met) + scr=Celem.EmptyScr} : met) ]); diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/DiffApp.thy --- a/src/Tools/isac/Knowledge/DiffApp.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/DiffApp.thy Thu Mar 15 12:42:04 2018 +0100 @@ -49,86 +49,86 @@ val thy = @{theory}; val eval_rls = prep_rls' ( - Rls {id = "eval_rls", preconds = [], rew_ord = ("termlessI", termlessI), - erls = e_rls, srls = Erls, calc = [], errpatts = [], - rules = [Thm ("refl", TermC.num_str @{thm refl}), - Thm ("order_refl", TermC.num_str @{thm order_refl}), - Thm ("radd_left_cancel_le", TermC.num_str @{thm radd_left_cancel_le}), - Thm ("not_true", TermC.num_str @{thm not_true}), - Thm ("not_false", TermC.num_str @{thm not_false}), - Thm ("and_true", TermC.num_str @{thm and_true}), - Thm ("and_false", TermC.num_str @{thm and_false}), - Thm ("or_true", TermC.num_str @{thm or_true}), - Thm ("or_false", TermC.num_str @{thm or_false}), - Thm ("and_commute", TermC.num_str @{thm and_commute}), - Thm ("or_commute", TermC.num_str @{thm or_commute}), + Celem.Rls {id = "eval_rls", preconds = [], rew_ord = ("termlessI", termlessI), + erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Thm ("refl", TermC.num_str @{thm refl}), + Celem.Thm ("order_refl", TermC.num_str @{thm order_refl}), + Celem.Thm ("radd_left_cancel_le", TermC.num_str @{thm radd_left_cancel_le}), + Celem.Thm ("not_true", TermC.num_str @{thm not_true}), + Celem.Thm ("not_false", TermC.num_str @{thm not_false}), + Celem.Thm ("and_true", TermC.num_str @{thm and_true}), + Celem.Thm ("and_false", TermC.num_str @{thm and_false}), + Celem.Thm ("or_true", TermC.num_str @{thm or_true}), + Celem.Thm ("or_false", TermC.num_str @{thm or_false}), + Celem.Thm ("and_commute", TermC.num_str @{thm and_commute}), + Celem.Thm ("or_commute", TermC.num_str @{thm or_commute}), - Calc ("Orderings.ord_class.less", eval_equ "#less_"), - Calc ("Orderings.ord_class.less_eq", eval_equ "#less_equal_"), + Celem.Calc ("Orderings.ord_class.less", eval_equ "#less_"), + Celem.Calc ("Orderings.ord_class.less_eq", eval_equ "#less_equal_"), - Calc ("Atools.ident", eval_ident "#ident_"), - Calc ("Atools.is'_const", eval_const "#is_const_"), - Calc ("Atools.occurs'_in", eval_occurs_in ""), - Calc ("Tools.matches", eval_matches "")], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls); + Celem.Calc ("Atools.ident", eval_ident "#ident_"), + Celem.Calc ("Atools.is'_const", eval_const "#is_const_"), + Celem.Calc ("Atools.occurs'_in", eval_occurs_in ""), + Celem.Calc ("Tools.matches", eval_matches "")], + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }); *} setup {* KEStore_Elems.add_rlss [("eval_rls", (Context.theory_name @{theory}, eval_rls))] *} (** problem types **) setup {* KEStore_Elems.add_pbts - [(Specify.prep_pbt thy "pbl_fun_max" [] e_pblID + [(Specify.prep_pbt thy "pbl_fun_max" [] Celem.e_pblID (["maximum_of","function"], [("#Given" ,["fixedValues f_ix"]), ("#Find" ,["maximum m_m","valuesFor v_s"]), ("#Relate",["relations r_s"])], - e_rls, NONE, [])), - (Specify.prep_pbt thy "pbl_fun_make" [] e_pblID - (["make","function"]:pblID, + Celem.e_rls, NONE, [])), + (Specify.prep_pbt thy "pbl_fun_make" [] Celem.e_pblID + (["make","function"], [("#Given" ,["functionOf f_f","boundVariable v_v","equalities eqs"]), ("#Find" ,["functionEq f_1"])], - e_rls, NONE, [])), - (Specify.prep_pbt thy "pbl_fun_max_expl" [] e_pblID - (["by_explicit","make","function"]:pblID, + Celem.e_rls, NONE, [])), + (Specify.prep_pbt thy "pbl_fun_max_expl" [] Celem.e_pblID + (["by_explicit","make","function"], [("#Given" ,["functionOf f_f","boundVariable v_v","equalities eqs"]), ("#Find" ,["functionEq f_1"])], - e_rls, NONE, [["DiffApp","make_fun_by_explicit"]])), - (Specify.prep_pbt thy "pbl_fun_max_newvar" [] e_pblID - (["by_new_variable","make","function"]:pblID, + Celem.e_rls, NONE, [["DiffApp","make_fun_by_explicit"]])), + (Specify.prep_pbt thy "pbl_fun_max_newvar" [] Celem.e_pblID + (["by_new_variable","make","function"], [("#Given" ,["functionOf f_f","boundVariable v_v","equalities eqs"]), (*WN.12.5.03: precond for distinction still missing*) ("#Find" ,["functionEq f_1"])], - e_rls, NONE, [["DiffApp","make_fun_by_new_variable"]])), - (Specify.prep_pbt thy "pbl_fun_max_interv" [] e_pblID - (["on_interval","maximum_of","function"]:pblID, + Celem.e_rls, NONE, [["DiffApp","make_fun_by_new_variable"]])), + (Specify.prep_pbt thy "pbl_fun_max_interv" [] Celem.e_pblID + (["on_interval","maximum_of","function"], [("#Given" ,["functionEq t_t","boundVariable v_v","interval i_tv"]), (*WN.12.5.03: precond for distinction still missing*) ("#Find" ,["maxArgument v_0"])], - e_rls, NONE, [])), - (Specify.prep_pbt thy "pbl_tool" [] e_pblID - (["tool"]:pblID, [], e_rls, NONE, [])), - (Specify.prep_pbt thy "pbl_tool_findvals" [] e_pblID - (["find_values","tool"]:pblID, + Celem.e_rls, NONE, [])), + (Specify.prep_pbt thy "pbl_tool" [] Celem.e_pblID + (["tool"], [], Celem.e_rls, NONE, [])), + (Specify.prep_pbt thy "pbl_tool_findvals" [] Celem.e_pblID + (["find_values","tool"], [("#Given" ,["maxArgument m_ax","functionEq f_f","boundVariable v_v"]), ("#Find" ,["valuesFor v_ls"]), ("#Relate",["additionalRels r_s"])], - e_rls, NONE, []))] *} + Celem.e_rls, NONE, []))] *} (** methods, scripts not yet implemented **) setup {* KEStore_Elems.add_mets - [Specify.prep_met thy "met_diffapp" [] e_metID + [Specify.prep_met thy "met_diffapp" [] Celem.e_metID (["DiffApp"], [], - {rew_ord'="tless_true", rls'=Atools_erls,calc = [], srls = e_rls, prls = e_rls, + {rew_ord'="tless_true", rls'=Atools_erls,calc = [], srls = Celem.e_rls, prls = Celem.e_rls, crls = Atools_erls, errpats = [], nrls = norm_Rational (*, asm_rls=[],asm_thm=[]*)}, "empty_script"), - Specify.prep_met thy "met_diffapp_max" [] e_metID - (["DiffApp","max_by_calculus"]:metID, + Specify.prep_met thy "met_diffapp_max" [] Celem.e_metID + (["DiffApp","max_by_calculus"], [("#Given" ,["fixedValues f_ix","maximum m_m","relations r_s", "boundVariable v_v", "interval i_tv","errorBound e_rr"]), ("#Find" ,["valuesFor v_s"]), ("#Relate",[])], - {rew_ord'="tless_true",rls'=eval_rls,calc=[],srls=list_rls,prls=e_rls, crls = eval_rls, + {rew_ord'="tless_true",rls'=eval_rls,calc=[],srls=list_rls,prls=Celem.e_rls, crls = eval_rls, errpats = [], nrls = norm_Rational (*, asm_rls=[],asm_thm=[]*)}, "Script Maximum_value(f_ix::bool list)(m_m::real) (r_s::bool list) " ^ " (v_v::real) (itv_v::real set) (e_rr::bool) = " ^ @@ -144,11 +144,11 @@ " in ((SubProblem (DiffApp',[find_values,tool],[Isac,find_values]) " ^ " [REAL m_x, REAL (Rhs t_t), REAL v_v, REAL m_m, " ^ " BOOL_LIST (dropWhile (ident e_e) r_s)])::bool list)) "), - Specify.prep_met thy "met_diffapp_funnew" [] e_metID - (["DiffApp","make_fun_by_new_variable"]:metID, + Specify.prep_met thy "met_diffapp_funnew" [] Celem.e_metID + (["DiffApp","make_fun_by_new_variable"], [("#Given" ,["functionOf f_f","boundVariable v_v","equalities eqs"]), ("#Find" ,["functionEq f_1"])], - {rew_ord'="tless_true",rls'=eval_rls,srls=list_rls,prls=e_rls, calc=[], crls = eval_rls, + {rew_ord'="tless_true",rls'=eval_rls,srls=list_rls,prls=Celem.e_rls, calc=[], crls = eval_rls, errpats = [], nrls = norm_Rational(*,asm_rls=[],asm_thm=[]*)}, "Script Make_fun_by_new_variable (f_f::real) (v_v::real) " ^ " (eqs::bool list) = " ^ @@ -166,11 +166,11 @@ " (SubProblem (DiffApp',[univariate,equation],[no_met])" ^ " [BOOL e_2, REAL v_2])" ^ "in Substitute [(v_1 = (rhs o hd) s_1),(v_2 = (rhs o hd) s_2)] h_h)"), - Specify.prep_met thy "met_diffapp_funexp" [] e_metID - (["DiffApp","make_fun_by_explicit"]:metID, + Specify.prep_met thy "met_diffapp_funexp" [] Celem.e_metID + (["DiffApp","make_fun_by_explicit"], [("#Given" ,["functionOf f_f","boundVariable v_v","equalities eqs"]), ("#Find" ,["functionEq f_1"])], - {rew_ord'="tless_true",rls'=eval_rls,calc=[],srls=list_rls,prls=e_rls, crls = eval_rls, + {rew_ord'="tless_true",rls'=eval_rls,calc=[],srls=list_rls,prls=Celem.e_rls, crls = eval_rls, errpats = [], nrls = norm_Rational (*, asm_rls=[],asm_thm=[]*)}, "Script Make_fun_by_explicit (f_f::real) (v_v::real) " ^ " (eqs::bool list) = " ^ @@ -182,23 +182,23 @@ " (SubProblem(DiffApp',[univariate,equation],[no_met])" ^ " [BOOL e_1, REAL v_1]) " ^ " in Substitute [(v_1 = (rhs o hd) s_1)] h_h) "), - Specify.prep_met thy "met_diffapp_max_oninterval" [] e_metID - (["DiffApp","max_on_interval_by_calculus"]:metID, + Specify.prep_met thy "met_diffapp_max_oninterval" [] Celem.e_metID + (["DiffApp","max_on_interval_by_calculus"], [("#Given" ,["functionEq t_t","boundVariable v_v","interval i_tv"(*, "errorBound e_rr"*)]), ("#Find" ,["maxArgument v_0"])], - {rew_ord'="tless_true",rls'=eval_rls,calc=[],srls = e_rls,prls=e_rls, crls = eval_rls, + {rew_ord'="tless_true",rls'=eval_rls,calc=[],srls = Celem.e_rls,prls=Celem.e_rls, crls = eval_rls, errpats = [], nrls = norm_Rational (*, asm_rls=[],asm_thm=[]*)}, "empty_script"), - Specify.prep_met thy "met_diffapp_findvals" [] e_metID - (["DiffApp","find_values"]:metID, [], - {rew_ord'="tless_true",rls'=eval_rls,calc=[],srls = e_rls,prls=e_rls, crls = eval_rls, + Specify.prep_met thy "met_diffapp_findvals" [] Celem.e_metID + (["DiffApp","find_values"], [], + {rew_ord'="tless_true",rls'=eval_rls,calc=[],srls = Celem.e_rls,prls=Celem.e_rls, crls = eval_rls, errpats = [], nrls = norm_Rational(*, asm_rls = [], asm_thm = []*)}, "empty_script")] *} ML {* -val list_rls = append_rls "list_rls" list_rls - [Thm ("filterVar_Const", TermC.num_str @{thm filterVar_Const}), - Thm ("filterVar_Nil", TermC.num_str @{thm filterVar_Nil})]; +val list_rls = Celem.append_rls "list_rls" list_rls + [Celem.Thm ("filterVar_Const", TermC.num_str @{thm filterVar_Const}), + Celem.Thm ("filterVar_Nil", TermC.num_str @{thm filterVar_Nil})]; *} setup {* KEStore_Elems.add_rlss [("list_rls", (Context.theory_name @{theory}, list_rls))] *} diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/DiophantEq.thy --- a/src/Tools/isac/Knowledge/DiophantEq.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/DiophantEq.thy Thu Mar 15 12:42:04 2018 +0100 @@ -20,23 +20,23 @@ text {*problemclass for the usecase*} setup {* KEStore_Elems.add_pbts - [(Specify.prep_pbt thy "pbl_equ_dio" [] e_pblID + [(Specify.prep_pbt thy "pbl_equ_dio" [] Celem.e_pblID (["diophantine","equation"], [("#Given" ,["boolTestGiven e_e","intTestGiven (v_v::int)"]), (* TODO: drop ^^^^^*) ("#Where" ,[]), ("#Find" ,["boolTestFind s_s"])], - e_rls, SOME "solve (e_e::bool, v_v::int)", [["LinEq","solve_lineq_equation"]]))] *} + Celem.e_rls, SOME "solve (e_e::bool, v_v::int)", [["LinEq","solve_lineq_equation"]]))] *} text {*method solving the usecase*} setup {* KEStore_Elems.add_mets - [Specify.prep_met thy "met_test_diophant" [] e_metID - (["Test","solve_diophant"]:metID, + [Specify.prep_met thy "met_test_diophant" [] Celem.e_metID + (["Test","solve_diophant"], [("#Given" ,["boolTestGiven e_e","intTestGiven (v_v::int)"]), (* TODO: drop ^^^^^*) ("#Where" ,[]), ("#Find" ,["boolTestFind s_s"])], - {rew_ord' = "e_rew_ord", rls' = tval_rls, srls = e_rls, prls = e_rls, calc = [], + {rew_ord' = "xxxe_rew_ordxxx", rls' = tval_rls, srls = Celem.e_rls, prls = Celem.e_rls, calc = [], crls = tval_rls, errpats = [], nrls = Test_simplify}, "Script Diophant_equation (e_e::bool) (v_v::int)= " ^ "(Repeat " ^ diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/EqSystem.thy --- a/src/Tools/isac/Knowledge/EqSystem.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/EqSystem.thy Thu Mar 15 12:42:04 2018 +0100 @@ -77,9 +77,9 @@ (p as (Const ("EqSystem.occur'_exactly'_in",_) $ vs $ all $ t)) _ = if occur_exactly_in (TermC.isalist2list vs) (TermC.isalist2list all) t - then SOME ((term2str p) ^ " = True", + then SOME ((Celem.term2str p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True}))) - else SOME ((term2str p) ^ " = False", + else SOME ((Celem.term2str p) ^ " = False", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False}))) | eval_occur_exactly_in _ _ _ _ = NONE; *} @@ -131,10 +131,10 @@ then let val (f, ts) = strip_comb t and (g, us) = strip_comb u; - val _ = tracing ("t= f@ts= \"" ^ term_to_string''' thy f ^ "\" @ \"[" ^ - commas (map (term_to_string''' thy) ts) ^ "]\""); - val _ = tracing ("u= g@us= \"" ^ term_to_string''' thy g ^ "\" @ \"[" ^ - commas (map (term_to_string''' thy) us) ^ "]\""); + val _ = tracing ("t= f@ts= \"" ^ Celem.term_to_string''' thy f ^ "\" @ \"[" ^ + commas (map (Celem.term_to_string''' thy) ts) ^ "]\""); + val _ = tracing ("u= g@us= \"" ^ Celem.term_to_string''' thy g ^ "\" @ \"[" ^ + commas (map (Celem.term_to_string''' thy) us) ^ "]\""); val _ = tracing ("size_of_term(t,u)= (" ^ string_of_int (size_of_term' t) ^ ", " ^ string_of_int (size_of_term' u) ^ ")"); val _ = tracing ("hd_ord(f,g) = " ^ ((pr_ord o hd_ord) (f,g))); @@ -152,7 +152,7 @@ | ord => ord) and hd_ord (f, g) = (* ~ term.ML *) prod_ord (prod_ord Term_Ord.indexname_ord Term_Ord.typ_ord) int_ord (dest_hd' f, dest_hd' g) -and terms_ord str pr (ts, us) = list_ord (term_ord' pr (assoc_thy "Isac"))(ts, us); +and terms_ord str pr (ts, us) = list_ord (term_ord' pr (Celem.assoc_thy "Isac"))(ts, us); (**) in (**) @@ -166,7 +166,7 @@ (**) end; (**) -rew_ord' := overwritel (!rew_ord', +Celem.rew_ord' := overwritel (! Celem.rew_ord', [("ord_simplify_System", ord_simplify_System false thy) ]); *} @@ -175,67 +175,67 @@ (*.adapted from 'order_add_mult_in' by just replacing the rew_ord.*) val order_add_mult_System = - Rls{id = "order_add_mult_System", preconds = [], + Celem.Rls{id = "order_add_mult_System", preconds = [], rew_ord = ("ord_simplify_System", ord_simplify_System false @{theory "Integrate"}), - erls = e_rls,srls = Erls, calc = [], errpatts = [], - rules = [Thm ("mult_commute",TermC.num_str @{thm mult.commute}), + erls = Celem.e_rls,srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Thm ("mult_commute",TermC.num_str @{thm mult.commute}), (* z * w = w * z *) - Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}), + Celem.Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}), (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*) - Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}), + Celem.Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}), (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*) - Thm ("add_commute",TermC.num_str @{thm add.commute}), + Celem.Thm ("add_commute",TermC.num_str @{thm add.commute}), (*z + w = w + z*) - Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}), + Celem.Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}), (*x + (y + z) = y + (x + z)*) - Thm ("add_assoc",TermC.num_str @{thm add.assoc}) + Celem.Thm ("add_assoc",TermC.num_str @{thm add.assoc}) (*z1.0 + z2.0 + z3.0 = z1.0 + (z2.0 + z3.0)*) ], - scr = EmptyScr}:rls; + scr = Celem.EmptyScr}; *} ML {* (*.adapted from 'norm_Rational' by #1 using 'ord_simplify_System' in 'order_add_mult_System' #2 NOT using common_nominator_p .*) val norm_System_noadd_fractions = - Rls {id = "norm_System_noadd_fractions", preconds = [], - rew_ord = ("dummy_ord",dummy_ord), - erls = norm_rat_erls, srls = Erls, calc = [], errpatts = [], + Celem.Rls {id = "norm_System_noadd_fractions", preconds = [], + rew_ord = ("dummy_ord",Celem.dummy_ord), + erls = norm_rat_erls, srls = Celem.Erls, calc = [], errpatts = [], rules = [(*sequence given by operator precedence*) - Rls_ discard_minus, - Rls_ powers, - Rls_ rat_mult_divide, - Rls_ expand, - Rls_ reduce_0_1_2, - Rls_ (*order_add_mult #1*) order_add_mult_System, - Rls_ collect_numerals, - (*Rls_ add_fractions_p, #2*) - Rls_ cancel_p + Celem.Rls_ discard_minus, + Celem.Rls_ powers, + Celem.Rls_ rat_mult_divide, + Celem.Rls_ expand, + Celem.Rls_ reduce_0_1_2, + Celem.Rls_ (*order_add_mult #1*) order_add_mult_System, + Celem.Rls_ collect_numerals, + (*Celem.Rls_ add_fractions_p, #2*) + Celem.Rls_ cancel_p ], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls; + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }; *} ML {* (*.adapted from 'norm_Rational' by *1* using 'ord_simplify_System' in 'order_add_mult_System'.*) val norm_System = - Rls {id = "norm_System", preconds = [], - rew_ord = ("dummy_ord",dummy_ord), - erls = norm_rat_erls, srls = Erls, calc = [], errpatts = [], + Celem.Rls {id = "norm_System", preconds = [], + rew_ord = ("dummy_ord",Celem.dummy_ord), + erls = norm_rat_erls, srls = Celem.Erls, calc = [], errpatts = [], rules = [(*sequence given by operator precedence*) - Rls_ discard_minus, - Rls_ powers, - Rls_ rat_mult_divide, - Rls_ expand, - Rls_ reduce_0_1_2, - Rls_ (*order_add_mult *1*) order_add_mult_System, - Rls_ collect_numerals, - Rls_ add_fractions_p, - Rls_ cancel_p + Celem.Rls_ discard_minus, + Celem.Rls_ powers, + Celem.Rls_ rat_mult_divide, + Celem.Rls_ expand, + Celem.Rls_ reduce_0_1_2, + Celem.Rls_ (*order_add_mult *1*) order_add_mult_System, + Celem.Rls_ collect_numerals, + Celem.Rls_ add_fractions_p, + Celem.Rls_ cancel_p ], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls; + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }; *} ML {* (*.simplify an equational system BEFORE solving it such that parentheses are @@ -248,24 +248,24 @@ *3* discard_parentheses only for (.*(.*.)) analoguous to simplify_Integral .*) val simplify_System_parenthesized = - Seq {id = "simplify_System_parenthesized", preconds = []:term list, - rew_ord = ("dummy_ord", dummy_ord), - erls = Atools_erls, srls = Erls, calc = [], errpatts = [], - rules = [Thm ("distrib_right",TermC.num_str @{thm distrib_right}), + Celem.Seq {id = "simplify_System_parenthesized", preconds = []:term list, + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Atools_erls, srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Thm ("distrib_right",TermC.num_str @{thm distrib_right}), (*"(?z1.0 + ?z2.0) * ?w = ?z1.0 * ?w + ?z2.0 * ?w"*) - Thm ("add_divide_distrib",TermC.num_str @{thm add_divide_distrib}), + Celem.Thm ("add_divide_distrib",TermC.num_str @{thm add_divide_distrib}), (*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"*) (*^^^^^ *0* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*) - Rls_ norm_Rational_noadd_fractions(**2**), - Rls_ (*order_add_mult_in*) norm_System_noadd_fractions (**1**), - Thm ("sym_mult_assoc", + Celem.Rls_ norm_Rational_noadd_fractions(**2**), + Celem.Rls_ (*order_add_mult_in*) norm_System_noadd_fractions (**1**), + Celem.Thm ("sym_mult_assoc", TermC.num_str (@{thm mult.assoc} RS @{thm sym})) - (*Rls_ discard_parentheses *3**), - Rls_ collect_bdv, (*from make_polynomial_in WN051031 welldone?*) - Rls_ separate_bdv2, - Calc ("Rings.divide_class.divide" ,eval_cancel "#divide_e") + (*Celem.Rls_ discard_parentheses *3**), + Celem.Rls_ collect_bdv, (*from make_polynomial_in WN051031 welldone?*) + Celem.Rls_ separate_bdv2, + Celem.Calc ("Rings.divide_class.divide" ,eval_cancel "#divide_e") ], - scr = EmptyScr}:rls; + scr = Celem.EmptyScr}; *} ML {* (*.simplify an equational system AFTER solving it; @@ -273,61 +273,61 @@ *1* ord_simplify_System instead of termlessI .*) (*TODO.WN051031 ^^^^^^^^^^ should be in EACH rls contained *) val simplify_System = - Seq {id = "simplify_System", preconds = []:term list, - rew_ord = ("dummy_ord", dummy_ord), - erls = Atools_erls, srls = Erls, calc = [], errpatts = [], - rules = [Rls_ norm_Rational, - Rls_ (*order_add_mult_in*) norm_System (**1**), - Rls_ discard_parentheses, - Rls_ collect_bdv, (*from make_polynomial_in WN051031 welldone?*) - Rls_ separate_bdv2, - Calc ("Rings.divide_class.divide" ,eval_cancel "#divide_e") + Celem.Seq {id = "simplify_System", preconds = []:term list, + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Atools_erls, srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Rls_ norm_Rational, + Celem.Rls_ (*order_add_mult_in*) norm_System (**1**), + Celem.Rls_ discard_parentheses, + Celem.Rls_ collect_bdv, (*from make_polynomial_in WN051031 welldone?*) + Celem.Rls_ separate_bdv2, + Celem.Calc ("Rings.divide_class.divide" ,eval_cancel "#divide_e") ], - scr = EmptyScr}:rls; + scr = Celem.EmptyScr}; (* val simplify_System = - append_rls "simplify_System" simplify_System_parenthesized - [Thm ("sym_add_assoc", + Celem.append_rls "simplify_System" simplify_System_parenthesized + [Celem.Thm ("sym_add_assoc", TermC.num_str (@{thm add.assoc} RS @{thm sym}))]; *) *} ML {* val isolate_bdvs = - Rls {id="isolate_bdvs", preconds = [], - rew_ord = ("e_rew_ord", e_rew_ord), - erls = append_rls "erls_isolate_bdvs" e_rls - [(Calc ("EqSystem.occur'_exactly'_in", + Celem.Rls {id="isolate_bdvs", preconds = [], + rew_ord = ("xxxe_rew_ordxxx", Celem.e_rew_ord), + erls = Celem.append_rls "erls_isolate_bdvs" Celem.e_rls + [(Celem.Calc ("EqSystem.occur'_exactly'_in", eval_occur_exactly_in "#eval_occur_exactly_in_")) ], - srls = Erls, calc = [], errpatts = [], + srls = Celem.Erls, calc = [], errpatts = [], rules = - [Thm ("commute_0_equality", TermC.num_str @{thm commute_0_equality}), - Thm ("separate_bdvs_add", TermC.num_str @{thm separate_bdvs_add}), - Thm ("separate_bdvs_mult", TermC.num_str @{thm separate_bdvs_mult})], - scr = EmptyScr}; + [Celem.Thm ("commute_0_equality", TermC.num_str @{thm commute_0_equality}), + Celem.Thm ("separate_bdvs_add", TermC.num_str @{thm separate_bdvs_add}), + Celem.Thm ("separate_bdvs_mult", TermC.num_str @{thm separate_bdvs_mult})], + scr = Celem.EmptyScr}; *} ML {* val isolate_bdvs_4x4 = - Rls {id="isolate_bdvs_4x4", preconds = [], - rew_ord = ("e_rew_ord", e_rew_ord), - erls = append_rls - "erls_isolate_bdvs_4x4" e_rls - [Calc ("EqSystem.occur'_exactly'_in", + Celem.Rls {id="isolate_bdvs_4x4", preconds = [], + rew_ord = ("xxxe_rew_ordxxx", Celem.e_rew_ord), + erls = Celem.append_rls + "erls_isolate_bdvs_4x4" Celem.e_rls + [Celem.Calc ("EqSystem.occur'_exactly'_in", eval_occur_exactly_in "#eval_occur_exactly_in_"), - Calc ("Atools.ident",eval_ident "#ident_"), - Calc ("Atools.some'_occur'_in", + Celem.Calc ("Atools.ident",eval_ident "#ident_"), + Celem.Calc ("Atools.some'_occur'_in", eval_some_occur_in "#some_occur_in_"), - Thm ("not_true",TermC.num_str @{thm not_true}), - Thm ("not_false",TermC.num_str @{thm not_false}) + Celem.Thm ("not_true",TermC.num_str @{thm not_true}), + Celem.Thm ("not_false",TermC.num_str @{thm not_false}) ], - srls = Erls, calc = [], errpatts = [], - rules = [Thm ("commute_0_equality", TermC.num_str @{thm commute_0_equality}), - Thm ("separate_bdvs0", TermC.num_str @{thm separate_bdvs0}), - Thm ("separate_bdvs_add1", TermC.num_str @{thm separate_bdvs_add1}), - Thm ("separate_bdvs_add1", TermC.num_str @{thm separate_bdvs_add2}), - Thm ("separate_bdvs_mult", TermC.num_str @{thm separate_bdvs_mult}) - ], scr = EmptyScr}; + srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Thm ("commute_0_equality", TermC.num_str @{thm commute_0_equality}), + Celem.Thm ("separate_bdvs0", TermC.num_str @{thm separate_bdvs0}), + Celem.Thm ("separate_bdvs_add1", TermC.num_str @{thm separate_bdvs_add1}), + Celem.Thm ("separate_bdvs_add1", TermC.num_str @{thm separate_bdvs_add2}), + Celem.Thm ("separate_bdvs_mult", TermC.num_str @{thm separate_bdvs_mult}) + ], scr = Celem.EmptyScr}; *} ML {* @@ -335,67 +335,67 @@ (*.order the equations in a system such, that a triangular system (if any) appears as [..c_4 = .., ..., ..., ..c_1 + ..c_2 + ..c_3 ..c_4 = ..].*) val order_system = - Rls {id="order_system", preconds = [], + Celem.Rls {id="order_system", preconds = [], rew_ord = ("ord_simplify_System", ord_simplify_System false thy), - erls = Erls, srls = Erls, calc = [], errpatts = [], - rules = [Thm ("order_system_NxN", TermC.num_str @{thm order_system_NxN}) + erls = Celem.Erls, srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Thm ("order_system_NxN", TermC.num_str @{thm order_system_NxN}) ], - scr = EmptyScr}; + scr = Celem.EmptyScr}; val prls_triangular = - Rls {id="prls_triangular", preconds = [], - rew_ord = ("e_rew_ord", e_rew_ord), - erls = Rls {id="erls_prls_triangular", preconds = [], - rew_ord = ("e_rew_ord", e_rew_ord), - erls = Erls, srls = Erls, calc = [], errpatts = [], + Celem.Rls {id="prls_triangular", preconds = [], + rew_ord = ("xxxe_rew_ordxxx", Celem.e_rew_ord), + erls = Celem.Rls {id="erls_prls_triangular", preconds = [], + rew_ord = ("xxxe_rew_ordxxx", Celem.e_rew_ord), + erls = Celem.Erls, srls = Celem.Erls, calc = [], errpatts = [], rules = [(*for precond NTH_CONS ...*) - Calc ("Orderings.ord_class.less",eval_equ "#less_"), - Calc ("Groups.plus_class.plus", eval_binop "#add_") + Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"), + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_") (*immediately repeated rewrite pushes '+' into precondition !*) ], - scr = EmptyScr}, - srls = Erls, calc = [], errpatts = [], - rules = [Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}), - Calc ("Groups.plus_class.plus", eval_binop "#add_"), - Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}), - Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}), - Thm ("tl_Nil",TermC.num_str @{thm tl_Nil}), - Calc ("EqSystem.occur'_exactly'_in", + scr = Celem.EmptyScr}, + srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}), + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}), + Celem.Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}), + Celem.Thm ("tl_Nil",TermC.num_str @{thm tl_Nil}), + Celem.Calc ("EqSystem.occur'_exactly'_in", eval_occur_exactly_in "#eval_occur_exactly_in_") ], - scr = EmptyScr}; + scr = Celem.EmptyScr}; *} ML {* (*WN060914 quickly created for 4x4; more similarity to prls_triangular desirable*) val prls_triangular4 = - Rls {id="prls_triangular4", preconds = [], - rew_ord = ("e_rew_ord", e_rew_ord), - erls = Rls {id="erls_prls_triangular4", preconds = [], - rew_ord = ("e_rew_ord", e_rew_ord), - erls = Erls, srls = Erls, calc = [], errpatts = [], + Celem.Rls {id="prls_triangular4", preconds = [], + rew_ord = ("xxxe_rew_ordxxx", Celem.e_rew_ord), + erls = Celem.Rls {id="erls_prls_triangular4", preconds = [], + rew_ord = ("xxxe_rew_ordxxx", Celem.e_rew_ord), + erls = Celem.Erls, srls = Celem.Erls, calc = [], errpatts = [], rules = [(*for precond NTH_CONS ...*) - Calc ("Orderings.ord_class.less",eval_equ "#less_"), - Calc ("Groups.plus_class.plus", eval_binop "#add_") + Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"), + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_") (*immediately repeated rewrite pushes '+' into precondition !*) ], - scr = EmptyScr}, - srls = Erls, calc = [], errpatts = [], - rules = [Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}), - Calc ("Groups.plus_class.plus", eval_binop "#add_"), - Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}), - Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}), - Thm ("tl_Nil",TermC.num_str @{thm tl_Nil}), - Calc ("EqSystem.occur'_exactly'_in", + scr = Celem.EmptyScr}, + srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}), + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}), + Celem.Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}), + Celem.Thm ("tl_Nil",TermC.num_str @{thm tl_Nil}), + Celem.Calc ("EqSystem.occur'_exactly'_in", eval_occur_exactly_in "#eval_occur_exactly_in_") ], - scr = EmptyScr}; + scr = Celem.EmptyScr}; *} setup {* KEStore_Elems.add_rlss @@ -412,30 +412,30 @@ (** problems **) setup {* KEStore_Elems.add_pbts - [(Specify.prep_pbt thy "pbl_equsys" [] e_pblID + [(Specify.prep_pbt thy "pbl_equsys" [] Celem.e_pblID (["system"], [("#Given" ,["equalities e_s", "solveForVars v_s"]), ("#Find" ,["solution ss'''"](*''' is copy-named*))], - append_rls "e_rls" e_rls [(*for preds in where_*)], SOME "solveSystem e_s v_s", [])), - (Specify.prep_pbt thy "pbl_equsys_lin" [] e_pblID + Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*)], SOME "solveSystem e_s v_s", [])), + (Specify.prep_pbt thy "pbl_equsys_lin" [] Celem.e_pblID (["LINEAR", "system"], [("#Given" ,["equalities e_s", "solveForVars v_s"]), (*TODO.WN050929 check linearity*) ("#Find" ,["solution ss'''"])], - append_rls "e_rls" e_rls [(*for preds in where_*)], SOME "solveSystem e_s v_s", [])), - (Specify.prep_pbt thy "pbl_equsys_lin_2x2" [] e_pblID + Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*)], SOME "solveSystem e_s v_s", [])), + (Specify.prep_pbt thy "pbl_equsys_lin_2x2" [] Celem.e_pblID (["2x2", "LINEAR", "system"], (*~~~~~~~~~~~~~~~~~~~~~~~~~*) [("#Given" ,["equalities e_s", "solveForVars v_s"]), ("#Where" ,["LENGTH (e_s:: bool list) = 2", "LENGTH v_s = 2"]), ("#Find" ,["solution ss'''"])], - append_rls "prls_2x2_linear_system" e_rls - [Thm ("LENGTH_CONS",TermC.num_str @{thm LENGTH_CONS}), - Thm ("LENGTH_NIL",TermC.num_str @{thm LENGTH_NIL}), - Calc ("Groups.plus_class.plus", eval_binop "#add_"), - Calc ("HOL.eq",eval_equal "#equal_")], + Celem.append_rls "prls_2x2_linear_system" Celem.e_rls + [Celem.Thm ("LENGTH_CONS",TermC.num_str @{thm LENGTH_CONS}), + Celem.Thm ("LENGTH_NIL",TermC.num_str @{thm LENGTH_NIL}), + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Calc ("HOL.eq",eval_equal "#equal_")], SOME "solveSystem e_s v_s", [])), - (Specify.prep_pbt thy "pbl_equsys_lin_2x2_tri" [] e_pblID + (Specify.prep_pbt thy "pbl_equsys_lin_2x2_tri" [] Celem.e_pblID (["triangular", "2x2", "LINEAR", "system"], [("#Given" ,["equalities e_s", "solveForVars v_s"]), ("#Where", @@ -443,38 +443,38 @@ " v_s from v_s occur_exactly_in (NTH 2 (e_s::bool list))"]), ("#Find" ,["solution ss'''"])], prls_triangular, SOME "solveSystem e_s v_s", [["EqSystem","top_down_substitution","2x2"]])), - (Specify.prep_pbt thy "pbl_equsys_lin_2x2_norm" [] e_pblID + (Specify.prep_pbt thy "pbl_equsys_lin_2x2_norm" [] Celem.e_pblID (["normalise", "2x2", "LINEAR", "system"], [("#Given" ,["equalities e_s", "solveForVars v_s"]), ("#Find" ,["solution ss'''"])], - append_rls "e_rls" e_rls [(*for preds in where_*)], + Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*)], SOME "solveSystem e_s v_s", [["EqSystem","normalise","2x2"]])), - (Specify.prep_pbt thy "pbl_equsys_lin_3x3" [] e_pblID + (Specify.prep_pbt thy "pbl_equsys_lin_3x3" [] Celem.e_pblID (["3x3", "LINEAR", "system"], (*~~~~~~~~~~~~~~~~~~~~~~~~~*) [("#Given" ,["equalities e_s", "solveForVars v_s"]), ("#Where" ,["LENGTH (e_s:: bool list) = 3", "LENGTH v_s = 3"]), ("#Find" ,["solution ss'''"])], - append_rls "prls_3x3_linear_system" e_rls - [Thm ("LENGTH_CONS",TermC.num_str @{thm LENGTH_CONS}), - Thm ("LENGTH_NIL",TermC.num_str @{thm LENGTH_NIL}), - Calc ("Groups.plus_class.plus", eval_binop "#add_"), - Calc ("HOL.eq",eval_equal "#equal_")], + Celem.append_rls "prls_3x3_linear_system" Celem.e_rls + [Celem.Thm ("LENGTH_CONS",TermC.num_str @{thm LENGTH_CONS}), + Celem.Thm ("LENGTH_NIL",TermC.num_str @{thm LENGTH_NIL}), + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Calc ("HOL.eq",eval_equal "#equal_")], SOME "solveSystem e_s v_s", [])), - (Specify.prep_pbt thy "pbl_equsys_lin_4x4" [] e_pblID + (Specify.prep_pbt thy "pbl_equsys_lin_4x4" [] Celem.e_pblID (["4x4", "LINEAR", "system"], (*~~~~~~~~~~~~~~~~~~~~~~~~~*) [("#Given" ,["equalities e_s", "solveForVars v_s"]), ("#Where" ,["LENGTH (e_s:: bool list) = 4", "LENGTH v_s = 4"]), ("#Find" ,["solution ss'''"])], - append_rls "prls_4x4_linear_system" e_rls - [Thm ("LENGTH_CONS",TermC.num_str @{thm LENGTH_CONS}), - Thm ("LENGTH_NIL",TermC.num_str @{thm LENGTH_NIL}), - Calc ("Groups.plus_class.plus", eval_binop "#add_"), - Calc ("HOL.eq",eval_equal "#equal_")], + Celem.append_rls "prls_4x4_linear_system" Celem.e_rls + [Celem.Thm ("LENGTH_CONS",TermC.num_str @{thm LENGTH_CONS}), + Celem.Thm ("LENGTH_NIL",TermC.num_str @{thm LENGTH_NIL}), + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Calc ("HOL.eq",eval_equal "#equal_")], SOME "solveSystem e_s v_s", [])), - (Specify.prep_pbt thy "pbl_equsys_lin_4x4_tri" [] e_pblID + (Specify.prep_pbt thy "pbl_equsys_lin_4x4_tri" [] Celem.e_pblID (["triangular", "4x4", "LINEAR", "system"], [("#Given" ,["equalities e_s", "solveForVars v_s"]), ("#Where" , (*accepts missing variables up to diagional form*) @@ -483,62 +483,62 @@ "(NTH 3 (v_s::real list)) occurs_in (NTH 3 (e_s::bool list))", "(NTH 4 (v_s::real list)) occurs_in (NTH 4 (e_s::bool list))"]), ("#Find" ,["solution ss'''"])], - append_rls "prls_tri_4x4_lin_sys" prls_triangular - [Calc ("Atools.occurs'_in",eval_occurs_in "")], + Celem.append_rls "prls_tri_4x4_lin_sys" prls_triangular + [Celem.Calc ("Atools.occurs'_in",eval_occurs_in "")], SOME "solveSystem e_s v_s", [["EqSystem","top_down_substitution","4x4"]])), - (Specify.prep_pbt thy "pbl_equsys_lin_4x4_norm" [] e_pblID + (Specify.prep_pbt thy "pbl_equsys_lin_4x4_norm" [] Celem.e_pblID (["normalise", "4x4", "LINEAR", "system"], [("#Given" ,["equalities e_s", "solveForVars v_s"]), (*LENGTH is checked 1 level above*) ("#Find" ,["solution ss'''"])], - append_rls "e_rls" e_rls [(*for preds in where_*)], + Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*)], SOME "solveSystem e_s v_s", [["EqSystem","normalise","4x4"]]))] *} ML {* (*this is for NTH only*) -val srls = Rls {id="srls_normalise_4x4", +val srls = Celem.Rls {id="srls_normalise_4x4", preconds = [], rew_ord = ("termlessI",termlessI), - erls = append_rls "erls_in_srls_IntegrierenUnd.." e_rls + erls = Celem.append_rls "erls_in_srls_IntegrierenUnd.." Celem.e_rls [(*for asm in NTH_CONS ...*) - Calc ("Orderings.ord_class.less",eval_equ "#less_"), + Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"), (*2nd NTH_CONS pushes n+-1 into asms*) - Calc("Groups.plus_class.plus", eval_binop "#add_") + Celem.Calc("Groups.plus_class.plus", eval_binop "#add_") ], - srls = Erls, calc = [], errpatts = [], - rules = [Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}), - Calc("Groups.plus_class.plus", eval_binop "#add_"), - Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL})], - scr = EmptyScr}; + srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}), + Celem.Calc("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL})], + scr = Celem.EmptyScr}; *} (**methods**) setup {* KEStore_Elems.add_mets - [Specify.prep_met thy "met_eqsys" [] e_metID + [Specify.prep_met thy "met_eqsys" [] Celem.e_metID (["EqSystem"], [], - {rew_ord'="tless_true", rls' = Erls, calc = [], srls = Erls, prls = Erls, crls = Erls, - errpats = [], nrls = Erls}, + {rew_ord'="tless_true", rls' = Celem.Erls, calc = [], srls = Celem.Erls, prls = Celem.Erls, crls = Celem.Erls, + errpats = [], nrls = Celem.Erls}, "empty_script"), - Specify.prep_met thy "met_eqsys_topdown" [] e_metID + Specify.prep_met thy "met_eqsys_topdown" [] Celem.e_metID (["EqSystem","top_down_substitution"], [], - {rew_ord'="tless_true", rls' = Erls, calc = [], srls = Erls, prls = Erls, crls = Erls, - errpats = [], nrls = Erls}, + {rew_ord'="tless_true", rls' = Celem.Erls, calc = [], srls = Celem.Erls, prls = Celem.Erls, crls = Celem.Erls, + errpats = [], nrls = Celem.Erls}, "empty_script"), - Specify.prep_met thy "met_eqsys_topdown_2x2" [] e_metID + Specify.prep_met thy "met_eqsys_topdown_2x2" [] Celem.e_metID (["EqSystem", "top_down_substitution", "2x2"], [("#Given", ["equalities e_s", "solveForVars v_s"]), ("#Where", ["(tl v_s) from v_s occur_exactly_in (NTH 1 (e_s::bool list))", " v_s from v_s occur_exactly_in (NTH 2 (e_s::bool list))"]), ("#Find" ,["solution ss'''"])], - {rew_ord'="ord_simplify_System", rls' = Erls, calc = [], - srls = append_rls "srls_top_down_2x2" e_rls - [Thm ("hd_thm",TermC.num_str @{thm hd_thm}), - Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}), - Thm ("tl_Nil",TermC.num_str @{thm tl_Nil})], - prls = prls_triangular, crls = Erls, errpats = [], nrls = Erls}, + {rew_ord'="ord_simplify_System", rls' = Celem.Erls, calc = [], + srls = Celem.append_rls "srls_top_down_2x2" Celem.e_rls + [Celem.Thm ("hd_thm",TermC.num_str @{thm hd_thm}), + Celem.Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}), + Celem.Thm ("tl_Nil",TermC.num_str @{thm tl_Nil})], + prls = prls_triangular, crls = Celem.Erls, errpats = [], nrls = Celem.Erls}, "Script SolveSystemScript (e_s::bool list) (v_s::real list) = " ^ " (let e_1 = Take (hd e_s); " ^ " e_1 = ((Try (Rewrite_Set_Inst [(bdv_1, hd v_s),(bdv_2, hd (tl v_s))]" ^ @@ -572,21 +572,21 @@ " (Try (Rewrite_Set_Inst [(bdv_1, hd v_s),(bdv_2, hd (tl v_s))]" ^ " simplify_System False))) e__s)" ---------------------------------------------------------------------------*)), - Specify.prep_met thy "met_eqsys_norm" [] e_metID + Specify.prep_met thy "met_eqsys_norm" [] Celem.e_metID (["EqSystem", "normalise"], [], - {rew_ord'="tless_true", rls' = Erls, calc = [], srls = Erls, prls = Erls, crls = Erls, - errpats = [], nrls = Erls}, + {rew_ord'="tless_true", rls' = Celem.Erls, calc = [], srls = Celem.Erls, prls = Celem.Erls, crls = Celem.Erls, + errpats = [], nrls = Celem.Erls}, "empty_script"), - Specify.prep_met thy "met_eqsys_norm_2x2" [] e_metID + Specify.prep_met thy "met_eqsys_norm_2x2" [] Celem.e_metID (["EqSystem","normalise","2x2"], [("#Given" ,["equalities e_s", "solveForVars v_s"]), ("#Find" ,["solution ss'''"])], - {rew_ord'="tless_true", rls' = Erls, calc = [], - srls = append_rls "srls_normalise_2x2" e_rls - [Thm ("hd_thm",TermC.num_str @{thm hd_thm}), - Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}), - Thm ("tl_Nil",TermC.num_str @{thm tl_Nil})], - prls = Erls, crls = Erls, errpats = [], nrls = Erls}, + {rew_ord'="tless_true", rls' = Celem.Erls, calc = [], + srls = Celem.append_rls "srls_normalise_2x2" Celem.e_rls + [Celem.Thm ("hd_thm",TermC.num_str @{thm hd_thm}), + Celem.Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}), + Celem.Thm ("tl_Nil",TermC.num_str @{thm tl_Nil})], + prls = Celem.Erls, crls = Celem.Erls, errpats = [], nrls = Celem.Erls}, "Script SolveSystemScript (e_s::bool list) (v_s::real list) = " ^ " (let e__s = ((Try (Rewrite_Set norm_Rational False)) @@ " ^ " (Try (Rewrite_Set_Inst [(bdv_1, hd v_s),(bdv_2, hd (tl v_s))]" ^ @@ -598,16 +598,16 @@ " (Try (Rewrite_Set order_system False))) e_s " ^ " in (SubProblem (EqSystem',[LINEAR,system],[no_met]) " ^ " [BOOL_LIST e__s, REAL_LIST v_s]))"), - Specify.prep_met thy "met_eqsys_norm_4x4" [] e_metID + Specify.prep_met thy "met_eqsys_norm_4x4" [] Celem.e_metID (["EqSystem","normalise","4x4"], [("#Given" ,["equalities e_s", "solveForVars v_s"]), ("#Find" ,["solution ss'''"])], - {rew_ord'="tless_true", rls' = Erls, calc = [], - srls = append_rls "srls_normalise_4x4" srls - [Thm ("hd_thm",TermC.num_str @{thm hd_thm}), - Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}), - Thm ("tl_Nil",TermC.num_str @{thm tl_Nil})], - prls = Erls, crls = Erls, errpats = [], nrls = Erls}, + {rew_ord'="tless_true", rls' = Celem.Erls, calc = [], + srls = Celem.append_rls "srls_normalise_4x4" srls + [Celem.Thm ("hd_thm",TermC.num_str @{thm hd_thm}), + Celem.Thm ("tl_Cons",TermC.num_str @{thm tl_Cons}), + Celem.Thm ("tl_Nil",TermC.num_str @{thm tl_Nil})], + prls = Celem.Erls, crls = Celem.Erls, errpats = [], nrls = Celem.Erls}, (*STOPPED.WN06? met ["EqSystem","normalise","4x4"] @@@@@@@@@@@@@@@@@@@@@@@@@@@*) "Script SolveSystemScript (e_s::bool list) (v_s::real list) = " ^ " (let e__s = " ^ @@ -625,7 +625,7 @@ " (Try (Rewrite_Set order_system False))) e_s " ^ " in (SubProblem (EqSystem',[LINEAR,system],[no_met]) " ^ " [BOOL_LIST e__s, REAL_LIST v_s]))"), - Specify.prep_met thy "met_eqsys_topdown_4x4" [] e_metID + Specify.prep_met thy "met_eqsys_topdown_4x4" [] Celem.e_metID (["EqSystem","top_down_substitution","4x4"], [("#Given" ,["equalities e_s", "solveForVars v_s"]), ("#Where" , (*accepts missing variables up to diagonal form*) @@ -634,11 +634,11 @@ "(NTH 3 (v_s::real list)) occurs_in (NTH 3 (e_s::bool list))", "(NTH 4 (v_s::real list)) occurs_in (NTH 4 (e_s::bool list))"]), ("#Find", ["solution ss'''"])], - {rew_ord'="ord_simplify_System", rls' = Erls, calc = [], - srls = append_rls "srls_top_down_4x4" srls [], - prls = append_rls "prls_tri_4x4_lin_sys" prls_triangular - [Calc ("Atools.occurs'_in",eval_occurs_in "")], - crls = Erls, errpats = [], nrls = Erls}, + {rew_ord'="ord_simplify_System", rls' = Celem.Erls, calc = [], + srls = Celem.append_rls "srls_top_down_4x4" srls [], + prls = Celem.append_rls "prls_tri_4x4_lin_sys" prls_triangular + [Celem.Calc ("Atools.occurs'_in",eval_occurs_in "")], + crls = Celem.Erls, errpats = [], nrls = Celem.Erls}, (*FIXXXXME.WN060916: this script works ONLY for exp 7.79 @@@@@@@@@@@@@@@@@@@@*) "Script SolveSystemScript (e_s::bool list) (v_s::real list) = " ^ " (let e_1 = NTH 1 e_s; " ^ diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/Equation.thy --- a/src/Tools/isac/Knowledge/Equation.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/Equation.thy Thu Mar 15 12:42:04 2018 +0100 @@ -39,23 +39,23 @@ ML {* val thy = @{theory}; -val ctxt = thy2ctxt thy; +val ctxt = Celem.thy2ctxt thy; val univariate_equation_prls = - append_rls "univariate_equation_prls" e_rls - [Calc ("Tools.matches",eval_matches "")]; + Celem.append_rls "univariate_equation_prls" Celem.e_rls + [Celem.Calc ("Tools.matches",eval_matches "")]; *} setup {* KEStore_Elems.add_rlss [("univariate_equation_prls", (Context.theory_name @{theory}, LTool.prep_rls @{theory} univariate_equation_prls))] *} setup {* KEStore_Elems.add_pbts - [(Specify.prep_pbt thy "pbl_equ" [] e_pblID + [(Specify.prep_pbt thy "pbl_equ" [] Celem.e_pblID (["equation"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["matches (?a = ?b) e_e"]), ("#Find" ,["solutions v_v'i'"])], - append_rls "equation_prls" e_rls [Calc ("Tools.matches",eval_matches "")], + Celem.append_rls "equation_prls" Celem.e_rls [Celem.Calc ("Tools.matches",eval_matches "")], SOME "solve (e_e::bool, v_v)", [])), - (Specify.prep_pbt thy "pbl_equ_univ" [] e_pblID + (Specify.prep_pbt thy "pbl_equ_univ" [] Celem.e_pblID (["univariate","equation"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["matches (?a = ?b) e_e"]), @@ -86,10 +86,10 @@ setup {* KEStore_Elems.add_mets - [Specify.prep_met thy "met_equ" [] e_metID + [Specify.prep_met thy "met_equ" [] Celem.e_metID (["Equation"], [], - {rew_ord'="tless_true", rls'=Erls, calc = [], srls = e_rls, prls=e_rls, crls = Atools_erls, - errpats = [], nrls = e_rls}, + {rew_ord'="tless_true", rls'=Celem.Erls, calc = [], srls = Celem.e_rls, prls=Celem.e_rls, crls = Atools_erls, + errpats = [], nrls = Celem.e_rls}, "empty_script")] *} diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/InsSort.thy --- a/src/Tools/isac/Knowledge/InsSort.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/InsSort.thy Thu Mar 15 12:42:04 2018 +0100 @@ -44,67 +44,67 @@ subsection {* rulesets *} ML {* val ins_sort = - Rls { - id = "ins_sort", preconds = [], rew_ord = ("tless_true", tless_true), erls = e_rls, - srls = e_rls, calc = [], rules = [ - Thm ("xfoldr_Nil",(*num_str*) @{thm xfoldr_Nil} (* foldr ?f [] = id *)), - Thm ("xfoldr_Cons", @{thm xfoldr_Cons} (* foldr ?f (?x # ?xs) = ?f ?x \ foldr ?f ?xs *)), + Celem.Rls { + id = "ins_sort", preconds = [], rew_ord = ("tless_true", tless_true), erls = Celem.e_rls, + srls = Celem.e_rls, calc = [], rules = [ + Celem.Thm ("xfoldr_Nil",(*num_str*) @{thm xfoldr_Nil} (* foldr ?f [] = id *)), + Celem.Thm ("xfoldr_Cons", @{thm xfoldr_Cons} (* foldr ?f (?x # ?xs) = ?f ?x \ foldr ?f ?xs *)), - Thm ("ins_Nil", @{thm ins_Nil} (* ins ?i [] = [?i] *)), - Thm ("ins_Cons", @{thm ins_Cons} (* ins ?i (?x # ?xs) = (if ?i < ?x then ?i # ?x # ?xs else ?x # ins ?i ?xs) *)), - Thm ("sort_deff", @{thm sort_deff} (* InsSort.sort ?xs = foldr ins ?xs [] *)), + Celem.Thm ("ins_Nil", @{thm ins_Nil} (* ins ?i [] = [?i] *)), + Celem.Thm ("ins_Cons", @{thm ins_Cons} (* ins ?i (?x # ?xs) = (if ?i < ?x then ?i # ?x # ?xs else ?x # ins ?i ?xs) *)), + Celem.Thm ("sort_deff", @{thm sort_deff} (* InsSort.sort ?xs = foldr ins ?xs [] *)), - Thm ("o_id", @{thm o_id} (* ?f \ id = ?f *)), - Thm ("o_assoc", @{thm o_assoc} (* ?f \ (?g \ ?h) = ?f \ ?g \ ?h *)), - Thm ("o_apply", @{thm o_apply} (* (?f \ ?g) ?x = ?f (?g ?x) *)), - Thm ("id_apply", @{thm id_apply} (* id ?x = ?x *)), + Celem.Thm ("o_id", @{thm o_id} (* ?f \ id = ?f *)), + Celem.Thm ("o_assoc", @{thm o_assoc} (* ?f \ (?g \ ?h) = ?f \ ?g \ ?h *)), + Celem.Thm ("o_apply", @{thm o_apply} (* (?f \ ?g) ?x = ?f (?g ?x) *)), + Celem.Thm ("id_apply", @{thm id_apply} (* id ?x = ?x *)), - Calc ("Orderings.ord_class.less", eval_equ "#less_"), - Thm ("If_def", @{thm If_def} (* if ?P then ?x else ?y \ THE z. (?P = True \ z = ?x) \ (?P = False \ z = ?y) *)), - Thm ("if_True", @{thm if_True} (* "(if True then x else y) = x" *)), - Thm ("if_False", @{thm if_False} (* "(if False then x else y) = y" *))], - errpatts = [], scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")}; + Celem.Calc ("Orderings.ord_class.less", eval_equ "#less_"), + Celem.Thm ("If_def", @{thm If_def} (* if ?P then ?x else ?y \ THE z. (?P = True \ z = ?x) \ (?P = False \ z = ?y) *)), + Celem.Thm ("if_True", @{thm if_True} (* "(if True then x else y) = x" *)), + Celem.Thm ("if_False", @{thm if_False} (* "(if False then x else y) = y" *))], + errpatts = [], scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")}; *} setup {* KEStore_Elems.add_rlss [("ins_sort", (Context.theory_name @{theory}, ins_sort))] *} subsection {* problems *} setup {* KEStore_Elems.add_pbts - [(Specify.prep_pbt @{theory} "pbl_Programming" [] e_pblID - (["Programming"], [], e_rls, NONE, [])), - (Specify.prep_pbt @{theory} "pbl_Prog_sort" [] e_pblID - (["SORT","Programming"], [], e_rls, NONE, [])), - (Specify.prep_pbt @{theory} "pbl_Prog_sort_ins" [] e_pblID + [(Specify.prep_pbt @{theory} "pbl_Programming" [] Celem.e_pblID + (["Programming"], [], Celem.e_rls, NONE, [])), + (Specify.prep_pbt @{theory} "pbl_Prog_sort" [] Celem.e_pblID + (["SORT","Programming"], [], Celem.e_rls, NONE, [])), + (Specify.prep_pbt @{theory} "pbl_Prog_sort_ins" [] Celem.e_pblID (["insertion","SORT","Programming"], [("#Given", ["unsorted u_u"]), ("#Find", ["sorted s_s"])], - e_rls, + Celem.e_rls, SOME "Sort u_u", [["Programming","SORT","insertion_steps"]]))] *} subsection {* methods *} (* TODO: implementation needs extra object-level lists ?!?*) setup {* KEStore_Elems.add_mets - [ Specify.prep_met @{theory} "met_Programming" [] e_metID + [ Specify.prep_met @{theory} "met_Programming" [] Celem.e_metID (["Programming"], [], - {rew_ord'="tless_true",rls' = e_rls, calc = [], srls = e_rls, prls = e_rls, - crls = e_rls, errpats = [], nrls = e_rls}, "empty_script"), - Specify.prep_met @{theory} "met_Prog_sort" [] e_metID + {rew_ord'="tless_true",rls' = Celem.e_rls, calc = [], srls = Celem.e_rls, prls = Celem.e_rls, + crls = Celem.e_rls, errpats = [], nrls = Celem.e_rls}, "empty_script"), + Specify.prep_met @{theory} "met_Prog_sort" [] Celem.e_metID (["Programming","SORT"], [], - {rew_ord'="tless_true",rls' = e_rls, calc = [], srls = e_rls, prls = e_rls, - crls = e_rls, errpats = [], nrls = e_rls}, + {rew_ord'="tless_true",rls' = Celem.e_rls, calc = [], srls = Celem.e_rls, prls = Celem.e_rls, + crls = Celem.e_rls, errpats = [], nrls = Celem.e_rls}, "empty_script"), - Specify.prep_met @{theory} "met_Prog_sort_ins" [] e_metID + Specify.prep_met @{theory} "met_Prog_sort_ins" [] Celem.e_metID (["Programming","SORT","insertion"], [("#Given", ["unsorted u_u"]), ("#Find", ["sorted s_s"])], - {rew_ord'="tless_true",rls' = Atools_erls, calc = [], srls = e_rls, prls = e_rls, + {rew_ord'="tless_true",rls' = Atools_erls, calc = [], srls = Celem.e_rls, prls = Celem.e_rls, crls = Atools_crls, errpats = [], nrls = norm_Rational}, "Script Sortprog (unso :: int xlist) = " ^ " (let uns = Take (sort unso) " ^ " in " ^ " (Rewrite_Set ins_sort False) uns" ^ " )"), - Specify.prep_met @{theory} "met_Prog_sort_ins_steps" [] e_metID + Specify.prep_met @{theory} "met_Prog_sort_ins_steps" [] Celem.e_metID (["Programming","SORT","insertion_steps"], [("#Given", ["unsorted u_u"]), ("#Find", ["sorted s_s"])], - {rew_ord'="tless_true",rls' = Atools_erls, calc = [], srls = e_rls, prls = e_rls, + {rew_ord'="tless_true",rls' = Atools_erls, calc = [], srls = Celem.e_rls, prls = Celem.e_rls, crls = Atools_crls, errpats = [], nrls = norm_Rational}, "Script Sortprog (unso :: int xlist) = " ^ " (let uns = Take (sort unso) " ^ diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/Integrate.thy --- a/src/Tools/isac/Knowledge/Integrate.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/Integrate.thy Thu Mar 15 12:42:04 2018 +0100 @@ -50,7 +50,7 @@ (** eval functions **) val c = Free ("c", HOLogic.realT); -(*.create a new unique variable 'c..' in a term; for use by Calc in a rls; +(*.create a new unique variable 'c..' in a term; for use by Celem.Calc in a rls; an alternative to do this would be '(Try (Calculate new_c_) (new_c es__))' in the script; this will be possible if currying doesnt take the value from a variable, but the value '(new_c es__)' itself.*) @@ -78,7 +78,7 @@ (*WN080222 (*("new_c", ("Integrate.new'_c", eval_new_c "#new_c_"))*) fun eval_new_c _ _ (p as (Const ("Integrate.new'_c",_) $ t)) _ = - SOME ((term2str p) ^ " = " ^ term2str (new_c p), + SOME ((Celem.term2str p) ^ " = " ^ Celem.term2str (new_c p), Trueprop $ (mk_equality (p, new_c p))) | eval_new_c _ _ _ _ = NONE; *) @@ -92,7 +92,7 @@ Const ("HOL.eq", T) $ lh $ rh => Const ("HOL.eq", T) $ lh $ TermC.mk_add rh (new_c rh) | p => TermC.mk_add p (new_c p) - in SOME ((term2str p) ^ " = " ^ term2str p', + in SOME ((Celem.term2str p) ^ " = " ^ Celem.term2str p', HOLogic.Trueprop $ (TermC.mk_equality (p, p'))) end | eval_add_new_c _ _ _ _ = NONE; @@ -102,9 +102,9 @@ fun eval_is_f_x _ _(p as (Const ("Integrate.is'_f'_x", _) $ arg)) _ = if TermC.is_f_x arg - then SOME ((term2str p) ^ " = True", + then SOME ((Celem.term2str p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True}))) - else SOME ((term2str p) ^ " = False", + else SOME ((Celem.term2str p) ^ " = False", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False}))) | eval_is_f_x _ _ _ _ = NONE; *} @@ -116,52 +116,52 @@ (*.rulesets for integration.*) val integration_rules = - Rls {id="integration_rules", preconds = [], + Celem.Rls {id="integration_rules", preconds = [], rew_ord = ("termlessI",termlessI), - erls = Rls {id="conditions_in_integration_rules", + erls = Celem.Rls {id="conditions_in_integration_rules", preconds = [], rew_ord = ("termlessI",termlessI), - erls = Erls, - srls = Erls, calc = [], errpatts = [], + erls = Celem.Erls, + srls = Celem.Erls, calc = [], errpatts = [], rules = [(*for rewriting conditions in Thm's*) - Calc ("Atools.occurs'_in", + Celem.Calc ("Atools.occurs'_in", eval_occurs_in "#occurs_in_"), - Thm ("not_true", TermC.num_str @{thm not_true}), - Thm ("not_false",@{thm not_false}) + Celem.Thm ("not_true", TermC.num_str @{thm not_true}), + Celem.Thm ("not_false",@{thm not_false}) ], - scr = EmptyScr}, - srls = Erls, calc = [], errpatts = [], + scr = Celem.EmptyScr}, + srls = Celem.Erls, calc = [], errpatts = [], rules = [ - Thm ("integral_const", TermC.num_str @{thm integral_const}), - Thm ("integral_var", TermC.num_str @{thm integral_var}), - Thm ("integral_add", TermC.num_str @{thm integral_add}), - Thm ("integral_mult", TermC.num_str @{thm integral_mult}), - Thm ("integral_pow", TermC.num_str @{thm integral_pow}), - Calc ("Groups.plus_class.plus", eval_binop "#add_")(*for n+1*) + Celem.Thm ("integral_const", TermC.num_str @{thm integral_const}), + Celem.Thm ("integral_var", TermC.num_str @{thm integral_var}), + Celem.Thm ("integral_add", TermC.num_str @{thm integral_add}), + Celem.Thm ("integral_mult", TermC.num_str @{thm integral_mult}), + Celem.Thm ("integral_pow", TermC.num_str @{thm integral_pow}), + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_")(*for n+1*) ], - scr = EmptyScr}; + scr = Celem.EmptyScr}; *} ML {* val add_new_c = - Seq {id="add_new_c", preconds = [], + Celem.Seq {id="add_new_c", preconds = [], rew_ord = ("termlessI",termlessI), - erls = Rls {id="conditions_in_add_new_c", + erls = Celem.Rls {id="conditions_in_add_new_c", preconds = [], rew_ord = ("termlessI",termlessI), - erls = Erls, - srls = Erls, calc = [], errpatts = [], - rules = [Calc ("Tools.matches", eval_matches""), - Calc ("Integrate.is'_f'_x", + erls = Celem.Erls, + srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Calc ("Tools.matches", eval_matches""), + Celem.Calc ("Integrate.is'_f'_x", eval_is_f_x "is_f_x_"), - Thm ("not_true", TermC.num_str @{thm not_true}), - Thm ("not_false", TermC.num_str @{thm not_false}) + Celem.Thm ("not_true", TermC.num_str @{thm not_true}), + Celem.Thm ("not_false", TermC.num_str @{thm not_false}) ], - scr = EmptyScr}, - srls = Erls, calc = [], errpatts = [], - rules = [ (*Thm ("call_for_new_c", TermC.num_str @{thm call_for_new_c}),*) - Cal1 ("Integrate.add'_new'_c", eval_add_new_c "new_c_") + scr = Celem.EmptyScr}, + srls = Celem.Erls, calc = [], errpatts = [], + rules = [ (*Celem.Thm ("call_for_new_c", TermC.num_str @{thm call_for_new_c}),*) + Celem.Cal1 ("Integrate.add'_new'_c", eval_add_new_c "new_c_") ], - scr = EmptyScr}; + scr = Celem.EmptyScr}; *} ML {* @@ -169,62 +169,62 @@ (*.for simplify_Integral adapted from 'norm_Rational_rls'.*) val norm_Rational_rls_noadd_fractions = -Rls {id = "norm_Rational_rls_noadd_fractions", preconds = [], - rew_ord = ("dummy_ord",dummy_ord), - erls = norm_rat_erls, srls = Erls, calc = [], errpatts = [], - rules = [(*Rls_ add_fractions_p_rls,!!!*) - Rls_ (*rat_mult_div_pow original corrected WN051028*) - (Rls {id = "rat_mult_div_pow", preconds = [], - rew_ord = ("dummy_ord",dummy_ord), - erls = (*FIXME.WN051028 e_rls,*) - append_rls "e_rls-is_polyexp" e_rls - [Calc ("Poly.is'_polyexp", +Celem.Rls {id = "norm_Rational_rls_noadd_fractions", preconds = [], + rew_ord = ("dummy_ord",Celem.dummy_ord), + erls = norm_rat_erls, srls = Celem.Erls, calc = [], errpatts = [], + rules = [(*Celem.Rls_ add_fractions_p_rls,!!!*) + Celem.Rls_ (*rat_mult_div_pow original corrected WN051028*) + (Celem.Rls {id = "rat_mult_div_pow", preconds = [], + rew_ord = ("dummy_ord",Celem.dummy_ord), + erls = (*FIXME.WN051028 Celem.e_rls,*) + Celem.append_rls "Celem.e_rls-is_polyexp" Celem.e_rls + [Celem.Calc ("Poly.is'_polyexp", eval_is_polyexp "")], - srls = Erls, calc = [], errpatts = [], - rules = [Thm ("rat_mult", TermC.num_str @{thm rat_mult}), + srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Thm ("rat_mult", TermC.num_str @{thm rat_mult}), (*"?a / ?b * (?c / ?d) = ?a * ?c / (?b * ?d)"*) - Thm ("rat_mult_poly_l", TermC.num_str @{thm rat_mult_poly_l}), + Celem.Thm ("rat_mult_poly_l", TermC.num_str @{thm rat_mult_poly_l}), (*"?c is_polyexp ==> ?c * (?a / ?b) = ?c * ?a / ?b"*) - Thm ("rat_mult_poly_r", TermC.num_str @{thm rat_mult_poly_r}), + Celem.Thm ("rat_mult_poly_r", TermC.num_str @{thm rat_mult_poly_r}), (*"?c is_polyexp ==> ?a / ?b * ?c = ?a * ?c / ?b"*) - Thm ("real_divide_divide1_mg", + Celem.Thm ("real_divide_divide1_mg", TermC.num_str @{thm real_divide_divide1_mg}), (*"y ~= 0 ==> (u / v) / (y / z) = (u * z) / (y * v)"*) - Thm ("divide_divide_eq_right", + Celem.Thm ("divide_divide_eq_right", TermC.num_str @{thm divide_divide_eq_right}), (*"?x / (?y / ?z) = ?x * ?z / ?y"*) - Thm ("divide_divide_eq_left", + Celem.Thm ("divide_divide_eq_left", TermC.num_str @{thm divide_divide_eq_left}), (*"?x / ?y / ?z = ?x / (?y * ?z)"*) - Calc ("Rings.divide_class.divide" ,eval_cancel "#divide_e"), + Celem.Calc ("Rings.divide_class.divide" ,eval_cancel "#divide_e"), - Thm ("rat_power", TermC.num_str @{thm rat_power}) + Celem.Thm ("rat_power", TermC.num_str @{thm rat_power}) (*"(?a / ?b) ^^^ ?n = ?a ^^^ ?n / ?b ^^^ ?n"*) ], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") }), - Rls_ make_rat_poly_with_parentheses, - Rls_ cancel_p_rls,(*FIXME:cancel_p does NOT order sometimes*) - Rls_ rat_reduce_1 + Celem.Rls_ make_rat_poly_with_parentheses, + Celem.Rls_ cancel_p_rls,(*FIXME:cancel_p does NOT order sometimes*) + Celem.Rls_ rat_reduce_1 ], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls; + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }; (*.for simplify_Integral adapted from 'norm_Rational'.*) val norm_Rational_noadd_fractions = - Seq {id = "norm_Rational_noadd_fractions", preconds = [], - rew_ord = ("dummy_ord",dummy_ord), - erls = norm_rat_erls, srls = Erls, calc = [], errpatts = [], - rules = [Rls_ discard_minus, - Rls_ rat_mult_poly,(* removes double fractions like a/b/c *) - Rls_ make_rat_poly_with_parentheses, (*WN0510 also in(#)below*) - Rls_ cancel_p_rls, (*FIXME.MG:cancel_p does NOT order sometim*) - Rls_ norm_Rational_rls_noadd_fractions,(* the main rls (#) *) - Rls_ discard_parentheses1 (* mult only *) + Celem.Seq {id = "norm_Rational_noadd_fractions", preconds = [], + rew_ord = ("dummy_ord",Celem.dummy_ord), + erls = norm_rat_erls, srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Rls_ discard_minus, + Celem.Rls_ rat_mult_poly,(* removes double fractions like a/b/c *) + Celem.Rls_ make_rat_poly_with_parentheses, (*WN0510 also in(#)below*) + Celem.Rls_ cancel_p_rls, (*FIXME.MG:cancel_p does NOT order sometim*) + Celem.Rls_ norm_Rational_rls_noadd_fractions,(* the main rls (#) *) + Celem.Rls_ discard_parentheses1 (* mult only *) ], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls; + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }; (*.simplify terms before and after Integration such that ..a.x^2/2 + b.x^3/3.. is made to ..a/2.x^2 + b/3.x^3.. (and NO @@ -233,37 +233,37 @@ *1* expand the term, ie. distribute * and / over + .*) val separate_bdv2 = - append_rls "separate_bdv2" + Celem.append_rls "separate_bdv2" collect_bdv - [Thm ("separate_bdv", TermC.num_str @{thm separate_bdv}), + [Celem.Thm ("separate_bdv", TermC.num_str @{thm separate_bdv}), (*"?a * ?bdv / ?b = ?a / ?b * ?bdv"*) - Thm ("separate_bdv_n", TermC.num_str @{thm separate_bdv_n}), - Thm ("separate_1_bdv", TermC.num_str @{thm separate_1_bdv}), + Celem.Thm ("separate_bdv_n", TermC.num_str @{thm separate_bdv_n}), + Celem.Thm ("separate_1_bdv", TermC.num_str @{thm separate_1_bdv}), (*"?bdv / ?b = (1 / ?b) * ?bdv"*) - Thm ("separate_1_bdv_n", TermC.num_str @{thm separate_1_bdv_n})(*, + Celem.Thm ("separate_1_bdv_n", TermC.num_str @{thm separate_1_bdv_n})(*, (*"?bdv ^^^ ?n / ?b = 1 / ?b * ?bdv ^^^ ?n"*) - *****Thm ("add_divide_distrib", + *****Celem.Thm ("add_divide_distrib", ***** TermC.num_str @{thm add_divide_distrib}) (*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"*)----------*) ]; val simplify_Integral = - Seq {id = "simplify_Integral", preconds = []:term list, - rew_ord = ("dummy_ord", dummy_ord), - erls = Atools_erls, srls = Erls, + Celem.Seq {id = "simplify_Integral", preconds = []:term list, + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Atools_erls, srls = Celem.Erls, calc = [], errpatts = [], - rules = [Thm ("distrib_right", TermC.num_str @{thm distrib_right}), + rules = [Celem.Thm ("distrib_right", TermC.num_str @{thm distrib_right}), (*"(?z1.0 + ?z2.0) * ?w = ?z1.0 * ?w + ?z2.0 * ?w"*) - Thm ("add_divide_distrib", TermC.num_str @{thm add_divide_distrib}), + Celem.Thm ("add_divide_distrib", TermC.num_str @{thm add_divide_distrib}), (*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"*) (*^^^^^ *1* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*) - Rls_ norm_Rational_noadd_fractions, - Rls_ order_add_mult_in, - Rls_ discard_parentheses, - (*Rls_ collect_bdv, from make_polynomial_in*) - Rls_ separate_bdv2, - Calc ("Rings.divide_class.divide" ,eval_cancel "#divide_e") + Celem.Rls_ norm_Rational_noadd_fractions, + Celem.Rls_ order_add_mult_in, + Celem.Rls_ discard_parentheses, + (*Celem.Rls_ collect_bdv, from make_polynomial_in*) + Celem.Rls_ separate_bdv2, + Celem.Calc ("Rings.divide_class.divide" ,eval_cancel "#divide_e") ], - scr = EmptyScr}:rls; + scr = Celem.EmptyScr}; (*simplify terms before and after Integration such that @@ -273,54 +273,54 @@ 'make_ratpoly_in' THIS IS KEPT FOR COMPARISON ............................................ * val simplify_Integral = prep_rls'( -* Seq {id = "", preconds = []:term list, -* rew_ord = ("dummy_ord", dummy_ord), -* erls = Atools_erls, srls = Erls, +* Celem.Seq {id = "", preconds = []:term list, +* rew_ord = ("dummy_ord", Celem.dummy_ord), +* erls = Atools_erls, srls = Celem.Erls, * calc = [], (*asm_thm = [],*) -* rules = [Rls_ expand_poly, -* Rls_ order_add_mult_in, -* Rls_ simplify_power, -* Rls_ collect_numerals, -* Rls_ reduce_012, -* Thm ("realpow_oneI", TermC.num_str @{thm realpow_oneI}), -* Rls_ discard_parentheses, -* Rls_ collect_bdv, +* rules = [Celem.Rls_ expand_poly, +* Celem.Rls_ order_add_mult_in, +* Celem.Rls_ simplify_power, +* Celem.Rls_ collect_numerals, +* Celem.Rls_ reduce_012, +* Celem.Thm ("realpow_oneI", TermC.num_str @{thm realpow_oneI}), +* Celem.Rls_ discard_parentheses, +* Celem.Rls_ collect_bdv, * (*below inserted from 'make_ratpoly_in'*) -* Rls_ (append_rls "separate_bdv" +* Celem.Rls_ (Celem.append_rls "separate_bdv" * collect_bdv -* [Thm ("separate_bdv", TermC.num_str @{thm separate_bdv}), +* [Celem.Thm ("separate_bdv", TermC.num_str @{thm separate_bdv}), * (*"?a * ?bdv / ?b = ?a / ?b * ?bdv"*) -* Thm ("separate_bdv_n", TermC.num_str @{thm separate_bdv_n}), -* Thm ("separate_1_bdv", TermC.num_str @{thm separate_1_bdv}), +* Celem.Thm ("separate_bdv_n", TermC.num_str @{thm separate_bdv_n}), +* Celem.Thm ("separate_1_bdv", TermC.num_str @{thm separate_1_bdv}), * (*"?bdv / ?b = (1 / ?b) * ?bdv"*) -* Thm ("separate_1_bdv_n", TermC.num_str @{thm separate_1_bdv_n})(*, +* Celem.Thm ("separate_1_bdv_n", TermC.num_str @{thm separate_1_bdv_n})(*, * (*"?bdv ^^^ ?n / ?b = 1 / ?b * ?bdv ^^^ ?n"*) -* Thm ("add_divide_distrib", +* Celem.Thm ("add_divide_distrib", * TermC.num_str @{thm add_divide_distrib}) * (*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"*)*) * ]), -* Calc ("Rings.divide_class.divide" ,eval_cancel "#divide_e") +* Celem.Calc ("Rings.divide_class.divide" ,eval_cancel "#divide_e") * ], -* scr = EmptyScr -* }:rls); +* scr = Celem.EmptyScr +* }); .......................................................................*) val integration = - Seq {id="integration", preconds = [], + Celem.Seq {id="integration", preconds = [], rew_ord = ("termlessI",termlessI), - erls = Rls {id="conditions_in_integration", + erls = Celem.Rls {id="conditions_in_integration", preconds = [], rew_ord = ("termlessI",termlessI), - erls = Erls, - srls = Erls, calc = [], errpatts = [], + erls = Celem.Erls, + srls = Celem.Erls, calc = [], errpatts = [], rules = [], - scr = EmptyScr}, - srls = Erls, calc = [], errpatts = [], - rules = [ Rls_ integration_rules, - Rls_ add_new_c, - Rls_ simplify_Integral + scr = Celem.EmptyScr}, + srls = Celem.Erls, calc = [], errpatts = [], + rules = [ Celem.Rls_ integration_rules, + Celem.Rls_ add_new_c, + Celem.Rls_ simplify_Integral ], - scr = EmptyScr}; + scr = Celem.EmptyScr}; val prep_rls' = LTool.prep_rls @{theory}; *} @@ -338,38 +338,38 @@ (** problems **) setup {* KEStore_Elems.add_pbts - [(Specify.prep_pbt thy "pbl_fun_integ" [] e_pblID + [(Specify.prep_pbt thy "pbl_fun_integ" [] Celem.e_pblID (["integrate","function"], [("#Given" ,["functionTerm f_f", "integrateBy v_v"]), ("#Find" ,["antiDerivative F_F"])], - append_rls "e_rls" e_rls [(*for preds in where_*)], + Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*)], SOME "Integrate (f_f, v_v)", [["diff","integration"]])), (*here "named" is used differently from Differentiation"*) - (Specify.prep_pbt thy "pbl_fun_integ_nam" [] e_pblID + (Specify.prep_pbt thy "pbl_fun_integ_nam" [] Celem.e_pblID (["named","integrate","function"], [("#Given" ,["functionTerm f_f", "integrateBy v_v"]), ("#Find" ,["antiDerivativeName F_F"])], - append_rls "e_rls" e_rls [(*for preds in where_*)], + Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*)], SOME "Integrate (f_f, v_v)", [["diff","integration","named"]]))] *} (** methods **) setup {* KEStore_Elems.add_mets - [Specify.prep_met thy "met_diffint" [] e_metID + [Specify.prep_met thy "met_diffint" [] Celem.e_metID (["diff","integration"], [("#Given" ,["functionTerm f_f", "integrateBy v_v"]), ("#Find" ,["antiDerivative F_F"])], - {rew_ord'="tless_true", rls'=Atools_erls, calc = [], srls = e_rls, prls=e_rls, - crls = Atools_erls, errpats = [], nrls = e_rls}, + {rew_ord'="tless_true", rls'=Atools_erls, calc = [], srls = Celem.e_rls, prls=Celem.e_rls, + crls = Atools_erls, errpats = [], nrls = Celem.e_rls}, "Script IntegrationScript (f_f::real) (v_v::real) = " ^ " (let t_t = Take (Integral f_f D v_v) " ^ " in (Rewrite_Set_Inst [(bdv,v_v)] integration False) (t_t::real))"), - Specify.prep_met thy "met_diffint_named" [] e_metID + Specify.prep_met thy "met_diffint_named" [] Celem.e_metID (["diff","integration","named"], [("#Given" ,["functionTerm f_f", "integrateBy v_v"]), ("#Find" ,["antiDerivativeName F_F"])], - {rew_ord'="tless_true", rls'=Atools_erls, calc = [], srls = e_rls, prls=e_rls, - crls = Atools_erls, errpats = [], nrls = e_rls}, + {rew_ord'="tless_true", rls'=Atools_erls, calc = [], srls = Celem.e_rls, prls=Celem.e_rls, + crls = Atools_erls, errpats = [], nrls = Celem.e_rls}, "Script NamedIntegrationScript (f_f::real) (v_v::real) (F_F::real=>real) = " ^ " (let t_t = Take (F_F v_v = Integral f_f D v_v) " ^ " in ((Try (Rewrite_Set_Inst [(bdv,v_v)] simplify_Integral False)) @@ " ^ diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/Inverse_Z_Transform.thy --- a/src/Tools/isac/Knowledge/Inverse_Z_Transform.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/Inverse_Z_Transform.thy Thu Mar 15 12:42:04 2018 +0100 @@ -28,13 +28,13 @@ ML {* val inverse_z = prep_rls'( - Rls {id = "inverse_z", preconds = [], rew_ord = ("dummy_ord",dummy_ord), - erls = Erls, srls = Erls, calc = [], errpatts = [], + Celem.Rls {id = "inverse_z", preconds = [], rew_ord = ("dummy_ord",Celem.dummy_ord), + erls = Celem.Erls, srls = Celem.Erls, calc = [], errpatts = [], rules = [ - Thm ("rule4", @{thm rule4}) + Celem.Thm ("rule4", @{thm rule4}) ], - scr = EmptyScr}:rls); + scr = Celem.EmptyScr}); *} @@ -47,22 +47,22 @@ val thy = @{theory}; *} setup {* KEStore_Elems.add_pbts - [(Specify.prep_pbt thy "pbl_SP" [] e_pblID (["SignalProcessing"], [], e_rls, NONE, [])), - (Specify.prep_pbt thy "pbl_SP_Ztrans" [] e_pblID - (["Z_Transform","SignalProcessing"], [], e_rls, NONE, [])), - (Specify.prep_pbt thy "pbl_SP_Ztrans_inv" [] e_pblID + [(Specify.prep_pbt thy "pbl_SP" [] Celem.e_pblID (["SignalProcessing"], [], Celem.e_rls, NONE, [])), + (Specify.prep_pbt thy "pbl_SP_Ztrans" [] Celem.e_pblID + (["Z_Transform","SignalProcessing"], [], Celem.e_rls, NONE, [])), + (Specify.prep_pbt thy "pbl_SP_Ztrans_inv" [] Celem.e_pblID (["Inverse", "Z_Transform", "SignalProcessing"], (*^ capital letter breaks coding standard because "inverse" = Const ("Rings.inverse_class.inverse", ..*) [("#Given" ,["filterExpression (X_eq::bool)"]), ("#Find" ,["stepResponse (n_eq::bool)"])], - append_rls "e_rls" e_rls [(*for preds in where_*)], NONE, + Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*)], NONE, [["SignalProcessing","Z_Transform","Inverse"]])), - (Specify.prep_pbt thy "pbl_SP_Ztrans_inv" [] e_pblID + (Specify.prep_pbt thy "pbl_SP_Ztrans_inv" [] Celem.e_pblID (["Inverse", "Z_Transform", "SignalProcessing"], [("#Given" ,["filterExpression X_eq"]), ("#Find" ,["stepResponse n_eq"])], - append_rls "e_rls" e_rls [(*for preds in where_*)], NONE, + Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*)], NONE, [["SignalProcessing","Z_Transform","Inverse"]]))] *} subsection {*Define Name and Signature for the Method*} @@ -73,20 +73,20 @@ subsection {*Setup Parent Nodes in Hierarchy of Method*} ML {* val thy = @{theory}; (*latest version of thy required*) *} setup {* KEStore_Elems.add_mets - [Specify.prep_met thy "met_SP" [] e_metID + [Specify.prep_met thy "met_SP" [] Celem.e_metID (["SignalProcessing"], [], - {rew_ord'="tless_true", rls'= e_rls, calc = [], srls = e_rls, prls = e_rls, crls = e_rls, - errpats = [], nrls = e_rls}, "empty_script"), - Specify.prep_met thy "met_SP_Ztrans" [] e_metID + {rew_ord'="tless_true", rls'= Celem.e_rls, calc = [], srls = Celem.e_rls, prls = Celem.e_rls, crls = Celem.e_rls, + errpats = [], nrls = Celem.e_rls}, "empty_script"), + Specify.prep_met thy "met_SP_Ztrans" [] Celem.e_metID (["SignalProcessing", "Z_Transform"], [], - {rew_ord'="tless_true", rls'= e_rls, calc = [], srls = e_rls, prls = e_rls, crls = e_rls, - errpats = [], nrls = e_rls}, "empty_script"), - Specify.prep_met thy "met_SP_Ztrans_inv" [] e_metID + {rew_ord'="tless_true", rls'= Celem.e_rls, calc = [], srls = Celem.e_rls, prls = Celem.e_rls, crls = Celem.e_rls, + errpats = [], nrls = Celem.e_rls}, "empty_script"), + Specify.prep_met thy "met_SP_Ztrans_inv" [] Celem.e_metID (["SignalProcessing", "Z_Transform", "Inverse"], [("#Given" ,["filterExpression (X_eq::bool)"]), ("#Find" ,["stepResponse (n_eq::bool)"])], - {rew_ord'="tless_true", rls'= e_rls, calc = [], srls = e_rls, prls = e_rls, crls = e_rls, - errpats = [], nrls = e_rls}, + {rew_ord'="tless_true", rls'= Celem.e_rls, calc = [], srls = Celem.e_rls, prls = Celem.e_rls, crls = Celem.e_rls, + errpats = [], nrls = Celem.e_rls}, "Script InverseZTransform (X_eq::bool) =" ^ (*(1/z) instead of z ^^^ -1*) " (let X = Take X_eq;" ^ " X' = Rewrite ruleZY False X;" ^ (*z * denominator*) @@ -102,12 +102,12 @@ " [Test,solve_linear]) " ^ " [BOOL equ, REAL z]) " ^ " in X)"), - Specify.prep_met thy "met_SP_Ztrans_inv" [] e_metID + Specify.prep_met thy "met_SP_Ztrans_inv" [] Celem.e_metID (["SignalProcessing", "Z_Transform", "Inverse"], [("#Given" ,["filterExpression X_eq"]), ("#Find" ,["stepResponse n_eq"])], - {rew_ord'="tless_true", rls'= e_rls, calc = [], srls = srls_partial_fraction, prls = e_rls, - crls = e_rls, errpats = [], nrls = e_rls}, + {rew_ord'="tless_true", rls'= Celem.e_rls, calc = [], srls = srls_partial_fraction, prls = Celem.e_rls, + crls = Celem.e_rls, errpats = [], nrls = Celem.e_rls}, "Script InverseZTransform (X_eq::bool) = "^ (*(1/z) instead of z ^^^ -1*) "(let X = Take X_eq; "^ @@ -175,32 +175,32 @@ " (n_eq::bool) = (Rewrite_Set inverse_z False) X_z; "^ " n_eq = drop_questionmarks n_eq "^ "in n_eq)"), - Specify.prep_met thy "met_SP_Ztrans_inv_sub" [] e_metID + Specify.prep_met thy "met_SP_Ztrans_inv_sub" [] Celem.e_metID (["SignalProcessing", "Z_Transform", "Inverse_sub"], [("#Given" ,["filterExpression X_eq"]), ("#Find" ,["stepResponse n_eq"])], - {rew_ord'="tless_true", rls'= e_rls, calc = [], - srls = Rls {id="srls_partial_fraction", + {rew_ord'="tless_true", rls'= Celem.e_rls, calc = [], + srls = Celem.Rls {id="srls_partial_fraction", preconds = [], rew_ord = ("termlessI",termlessI), - erls = append_rls "erls_in_srls_partial_fraction" e_rls + erls = Celem.append_rls "erls_in_srls_partial_fraction" Celem.e_rls [(*for asm in NTH_CONS ...*) - Calc ("Orderings.ord_class.less",eval_equ "#less_"), + Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"), (*2nd NTH_CONS pushes n+-1 into asms*) - Calc("Groups.plus_class.plus", eval_binop "#add_")], - srls = Erls, calc = [], errpatts = [], - rules = [Thm ("NTH_CONS", @{thm NTH_CONS}), - Calc ("Groups.plus_class.plus", eval_binop "#add_"), - Thm ("NTH_NIL", @{thm NTH_NIL}), - Calc ("Tools.lhs", eval_lhs "eval_lhs_"), - Calc ("Tools.rhs", eval_rhs"eval_rhs_"), - Calc ("Atools.argument'_in", eval_argument_in "Atools.argument'_in"), - Calc ("Rational.get_denominator", eval_get_denominator "#get_denominator"), - Calc ("Rational.get_numerator", eval_get_numerator "#get_numerator"), - Calc ("Partial_Fractions.factors_from_solution", + Celem.Calc("Groups.plus_class.plus", eval_binop "#add_")], + srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Thm ("NTH_CONS", @{thm NTH_CONS}), + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Thm ("NTH_NIL", @{thm NTH_NIL}), + Celem.Calc ("Tools.lhs", eval_lhs "eval_lhs_"), + Celem.Calc ("Tools.rhs", eval_rhs"eval_rhs_"), + Celem.Calc ("Atools.argument'_in", eval_argument_in "Atools.argument'_in"), + Celem.Calc ("Rational.get_denominator", eval_get_denominator "#get_denominator"), + Celem.Calc ("Rational.get_numerator", eval_get_numerator "#get_numerator"), + Celem.Calc ("Partial_Fractions.factors_from_solution", eval_factors_from_solution "#factors_from_solution"), - Calc("Partial_Fractions.drop_questionmarks", eval_drop_questionmarks "#drop_?")], - scr = EmptyScr}, - prls = e_rls, crls = e_rls, errpats = [], nrls = norm_Rational}, + Celem.Calc("Partial_Fractions.drop_questionmarks", eval_drop_questionmarks "#drop_?")], + scr = Celem.EmptyScr}, + prls = Celem.e_rls, crls = Celem.e_rls, errpats = [], nrls = norm_Rational}, (*([], Frm), Problem (Isac, [Inverse, Z_Transform, SignalProcessing])*) "Script InverseZTransform (X_eq::bool) = "^ (*([1], Frm), X z = 3 / (z - 1 / 4 + -1 / 8 * (1 / z))*) diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/LinEq.thy --- a/src/Tools/isac/Knowledge/LinEq.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/LinEq.thy Thu Mar 15 12:42:04 2018 +0100 @@ -32,41 +32,41 @@ val thy = @{theory}; val LinEq_prls = (*3.10.02:just the following order due to subterm evaluation*) - append_rls "LinEq_prls" e_rls - [Calc ("HOL.eq",eval_equal "#equal_"), - Calc ("Tools.matches",eval_matches ""), - Calc ("Tools.lhs" ,eval_lhs ""), - Calc ("Tools.rhs" ,eval_rhs ""), - Calc ("Poly.has'_degree'_in",eval_has_degree_in ""), - Calc ("Poly.is'_polyrat'_in",eval_is_polyrat_in ""), - Calc ("Atools.occurs'_in",eval_occurs_in ""), - Calc ("Atools.ident",eval_ident "#ident_"), - Thm ("not_true",TermC.num_str @{thm not_true}), - Thm ("not_false",TermC.num_str @{thm not_false}), - Thm ("and_true",TermC.num_str @{thm and_true}), - Thm ("and_false",TermC.num_str @{thm and_false}), - Thm ("or_true",TermC.num_str @{thm or_true}), - Thm ("or_false",TermC.num_str @{thm or_false}) + Celem.append_rls "LinEq_prls" Celem.e_rls + [Celem.Calc ("HOL.eq",eval_equal "#equal_"), + Celem.Calc ("Tools.matches",eval_matches ""), + Celem.Calc ("Tools.lhs" ,eval_lhs ""), + Celem.Calc ("Tools.rhs" ,eval_rhs ""), + Celem.Calc ("Poly.has'_degree'_in",eval_has_degree_in ""), + Celem.Calc ("Poly.is'_polyrat'_in",eval_is_polyrat_in ""), + Celem.Calc ("Atools.occurs'_in",eval_occurs_in ""), + Celem.Calc ("Atools.ident",eval_ident "#ident_"), + Celem.Thm ("not_true",TermC.num_str @{thm not_true}), + Celem.Thm ("not_false",TermC.num_str @{thm not_false}), + Celem.Thm ("and_true",TermC.num_str @{thm and_true}), + Celem.Thm ("and_false",TermC.num_str @{thm and_false}), + Celem.Thm ("or_true",TermC.num_str @{thm or_true}), + Celem.Thm ("or_false",TermC.num_str @{thm or_false}) ]; (* ----- erls ----- *) val LinEq_crls = - append_rls "LinEq_crls" poly_crls - [Thm ("real_assoc_1",TermC.num_str @{thm real_assoc_1}) + Celem.append_rls "LinEq_crls" poly_crls + [Celem.Thm ("real_assoc_1",TermC.num_str @{thm real_assoc_1}) (* Don't use - Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"), - Calc ("Atools.pow" ,eval_binop "#power_"), + Celem.Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"), + Celem.Calc ("Atools.pow" ,eval_binop "#power_"), *) ]; (* ----- crls ----- *) val LinEq_erls = - append_rls "LinEq_erls" Poly_erls - [Thm ("real_assoc_1",TermC.num_str @{thm real_assoc_1}) + Celem.append_rls "LinEq_erls" Poly_erls + [Celem.Thm ("real_assoc_1",TermC.num_str @{thm real_assoc_1}) (* Don't use - Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"), - Calc ("Atools.pow" ,eval_binop "#power_"), + Celem.Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"), + Celem.Calc ("Atools.pow" ,eval_binop "#power_"), *) ]; *} @@ -75,23 +75,23 @@ ML {* val LinPoly_simplify = prep_rls'( - Rls {id = "LinPoly_simplify", preconds = [], + Celem.Rls {id = "LinPoly_simplify", preconds = [], rew_ord = ("termlessI",termlessI), erls = LinEq_erls, - srls = Erls, + srls = Celem.Erls, calc = [], errpatts = [], rules = [ - Thm ("real_assoc_1",TermC.num_str @{thm real_assoc_1}), - Calc ("Groups.plus_class.plus",eval_binop "#add_"), - Calc ("Groups.minus_class.minus",eval_binop "#sub_"), - Calc ("Groups.times_class.times",eval_binop "#mult_"), + Celem.Thm ("real_assoc_1",TermC.num_str @{thm real_assoc_1}), + Celem.Calc ("Groups.plus_class.plus",eval_binop "#add_"), + Celem.Calc ("Groups.minus_class.minus",eval_binop "#sub_"), + Celem.Calc ("Groups.times_class.times",eval_binop "#mult_"), (* Dont use - Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"), - Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"), + Celem.Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"), + Celem.Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"), *) - Calc ("Atools.pow" ,eval_binop "#power_") + Celem.Calc ("Atools.pow" ,eval_binop "#power_") ], - scr = EmptyScr}:rls); + scr = Celem.EmptyScr}); *} setup {* KEStore_Elems.add_rlss [("LinPoly_simplify", (Context.theory_name @{theory}, LinPoly_simplify))] *} @@ -99,20 +99,20 @@ (*isolate the bound variable in an linear equation; 'bdv' is a meta-constant*) val LinEq_simplify = prep_rls'( -Rls {id = "LinEq_simplify", preconds = [], - rew_ord = ("e_rew_ord",e_rew_ord), +Celem.Rls {id = "LinEq_simplify", preconds = [], + rew_ord = ("xxxe_rew_ordxxx", Celem.e_rew_ord), erls = LinEq_erls, - srls = Erls, + srls = Celem.Erls, calc = [], errpatts = [], rules = [ - Thm("lin_isolate_add1",TermC.num_str @{thm lin_isolate_add1}), + Celem.Thm("lin_isolate_add1",TermC.num_str @{thm lin_isolate_add1}), (* a+bx=0 -> bx=-a *) - Thm("lin_isolate_add2",TermC.num_str @{thm lin_isolate_add2}), + Celem.Thm("lin_isolate_add2",TermC.num_str @{thm lin_isolate_add2}), (* a+ x=0 -> x=-a *) - Thm("lin_isolate_div",TermC.num_str @{thm lin_isolate_div}) + Celem.Thm("lin_isolate_div",TermC.num_str @{thm lin_isolate_div}) (* bx=c -> x=c/b *) ], - scr = EmptyScr}:rls); + scr = Celem.EmptyScr}); *} setup {* KEStore_Elems.add_rlss [("LinEq_simplify", (Context.theory_name @{theory}, LinEq_simplify))] *} @@ -120,7 +120,7 @@ (*----------------------------- problem types --------------------------------*) (* ---------linear----------- *) setup {* KEStore_Elems.add_pbts - [(Specify.prep_pbt thy "pbl_equ_univ_lin" [] e_pblID + [(Specify.prep_pbt thy "pbl_equ_univ_lin" [] Celem.e_pblID (["LINEAR", "univariate", "equation"], [("#Given" ,["equality e_e", "solveFor v_v"]), ("#Where" ,["HOL.False", (*WN0509 just detected: this pbl can never be used?!?*) @@ -133,18 +133,18 @@ (*-------------- methods------------------------------------------------------*) setup {* KEStore_Elems.add_mets - [Specify.prep_met thy "met_eqlin" [] e_metID + [Specify.prep_met thy "met_eqlin" [] Celem.e_metID (["LinEq"], [], - {rew_ord' = "tless_true",rls' = Atools_erls,calc = [], srls = e_rls, prls = e_rls, + {rew_ord' = "tless_true",rls' = Atools_erls,calc = [], srls = Celem.e_rls, prls = Celem.e_rls, crls = LinEq_crls, errpats = [], nrls = norm_Poly}, "empty_script"), (* ansprechen mit ["LinEq","solve_univar_equation"] *) - Specify.prep_met thy "met_eq_lin" [] e_metID + Specify.prep_met thy "met_eq_lin" [] Celem.e_metID (["LinEq","solve_lineq_equation"], [("#Given", ["equality e_e", "solveFor v_v"]), ("#Where", ["Not ((lhs e_e) is_polyrat_in v_v)", "((lhs e_e) has_degree_in v_v) = 1"]), ("#Find", ["solutions v_v'i'"])], - {rew_ord' = "termlessI", rls' = LinEq_erls, srls = e_rls, prls = LinEq_prls, calc = [], + {rew_ord' = "termlessI", rls' = LinEq_erls, srls = Celem.e_rls, prls = LinEq_prls, calc = [], crls = LinEq_crls, errpats = [], nrls = norm_Poly}, "Script Solve_lineq_equation (e_e::bool) (v_v::real) = " ^ "(let e_e =((Try (Rewrite all_left False)) @@ " ^ diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/LogExp.thy --- a/src/Tools/isac/Knowledge/LogExp.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/LogExp.thy Thu Mar 15 12:42:04 2018 +0100 @@ -29,7 +29,7 @@ *} (** problems **) setup {* KEStore_Elems.add_pbts - [(Specify.prep_pbt thy "pbl_test_equ_univ_log" [] e_pblID + [(Specify.prep_pbt thy "pbl_test_equ_univ_log" [] Celem.e_pblID (["logarithmic","univariate","equation"], [("#Given",["equality e_e","solveFor v_v"]), ("#Where",["matches ((?a log ?v_v) = ?b) e_e"]), @@ -40,12 +40,12 @@ (** methods **) setup {* KEStore_Elems.add_mets - [Specify.prep_met thy "met_equ_log" [] e_metID + [Specify.prep_met thy "met_equ_log" [] Celem.e_metID (["Equation","solve_log"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["matches ((?a log ?v_v) = ?b) e_e"]), ("#Find" ,["solutions v_v'i'"])], - {rew_ord' = "termlessI", rls' = PolyEq_erls, srls = e_rls, prls = PolyEq_prls, calc = [], + {rew_ord' = "termlessI", rls' = PolyEq_erls, srls = Celem.e_rls, prls = PolyEq_prls, calc = [], crls = PolyEq_crls, errpats = [], nrls = norm_Rational}, "Script Solve_log (e_e::bool) (v_v::real) = " ^ "(let e_e = ((Rewrite equality_power False) @@ " ^ diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/Partial_Fractions.thy --- a/src/Tools/isac/Knowledge/Partial_Fractions.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/Partial_Fractions.thy Thu Mar 15 12:42:04 2018 +0100 @@ -38,11 +38,11 @@ in HOLogic.mk_binop "Groups.minus_class.minus" (lhs, rhs) end; fun mk_prod prod [] = - if prod = e_term then error "mk_prod called with []" else prod + if prod = Celem.e_term then error "mk_prod called with []" else prod | mk_prod prod (t :: []) = - if prod = e_term then t else HOLogic.mk_binop "Groups.times_class.times" (prod, t) + if prod = Celem.e_term then t else HOLogic.mk_binop "Groups.times_class.times" (prod, t) | mk_prod prod (t1 :: t2 :: ts) = - if prod = e_term + if prod = Celem.e_term then let val p = HOLogic.mk_binop "Groups.times_class.times" (t1, t2) in mk_prod p ts end @@ -52,14 +52,14 @@ fun factors_from_solution sol = let val ts = HOLogic.dest_list sol - in mk_prod e_term (map fac_from_sol ts) end; + in mk_prod Celem.e_term (map fac_from_sol ts) end; (*("factors_from_solution", ("Partial_Fractions.factors_from_solution", eval_factors_from_solution ""))*) fun eval_factors_from_solution (thmid:string) _ (t as Const ("Partial_Fractions.factors_from_solution", _) $ sol) thy = ((let val prod = factors_from_solution sol - in SOME (TermC.mk_thmid thmid (term_to_string''' thy prod) "", + in SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy prod) "", HOLogic.Trueprop $ (TermC.mk_equality (t, prod))) end) handle _ => NONE) @@ -75,7 +75,7 @@ then let val tm' = TermC.var2free tm - in SOME (TermC.mk_thmid thmid (term_to_string''' thy tm') "", + in SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy tm') "", HOLogic.Trueprop $ (TermC.mk_equality (t, tm'))) end else NONE @@ -125,31 +125,31 @@ ML {* val ansatz_rls = prep_rls'( - Rls {id = "ansatz_rls", preconds = [], rew_ord = ("dummy_ord",dummy_ord), - erls = Erls, srls = Erls, calc = [], errpatts = [], + Celem.Rls {id = "ansatz_rls", preconds = [], rew_ord = ("dummy_ord",Celem.dummy_ord), + erls = Celem.Erls, srls = Celem.Erls, calc = [], errpatts = [], rules = - [Thm ("ansatz_2nd_order",TermC.num_str @{thm ansatz_2nd_order}), - Thm ("ansatz_3rd_order",TermC.num_str @{thm ansatz_3rd_order}) + [Celem.Thm ("ansatz_2nd_order",TermC.num_str @{thm ansatz_2nd_order}), + Celem.Thm ("ansatz_3rd_order",TermC.num_str @{thm ansatz_3rd_order}) ], - scr = EmptyScr}:rls); + scr = Celem.EmptyScr}); val equival_trans = prep_rls'( - Rls {id = "equival_trans", preconds = [], rew_ord = ("dummy_ord",dummy_ord), - erls = Erls, srls = Erls, calc = [], errpatts = [], + Celem.Rls {id = "equival_trans", preconds = [], rew_ord = ("dummy_ord",Celem.dummy_ord), + erls = Celem.Erls, srls = Celem.Erls, calc = [], errpatts = [], rules = - [Thm ("equival_trans_2nd_order",TermC.num_str @{thm equival_trans_2nd_order}), - Thm ("equival_trans_3rd_order",TermC.num_str @{thm equival_trans_3rd_order}) + [Celem.Thm ("equival_trans_2nd_order",TermC.num_str @{thm equival_trans_2nd_order}), + Celem.Thm ("equival_trans_3rd_order",TermC.num_str @{thm equival_trans_3rd_order}) ], - scr = EmptyScr}:rls); + scr = Celem.EmptyScr}); val multiply_ansatz = prep_rls'( - Rls {id = "multiply_ansatz", preconds = [], rew_ord = ("dummy_ord",dummy_ord), - erls = Erls, - srls = Erls, calc = [], errpatts = [], + Celem.Rls {id = "multiply_ansatz", preconds = [], rew_ord = ("dummy_ord",Celem.dummy_ord), + erls = Celem.Erls, + srls = Celem.Erls, calc = [], errpatts = [], rules = - [Thm ("multiply_2nd_order",TermC.num_str @{thm multiply_2nd_order}) + [Celem.Thm ("multiply_2nd_order",TermC.num_str @{thm multiply_2nd_order}) ], - scr = EmptyScr}:rls); + scr = Celem.EmptyScr}); *} text {*store the rule set for math engine*} @@ -164,10 +164,10 @@ decomposedFunction :: "real => una" ML {* -check_guhs_unique := false; (*WN120307 REMOVE after editing*) +Celem.check_guhs_unique := false; (*WN120307 REMOVE after editing*) *} setup {* KEStore_Elems.add_pbts - [(Specify.prep_pbt @{theory} "pbl_simp_rat_partfrac" [] e_pblID + [(Specify.prep_pbt @{theory} "pbl_simp_rat_partfrac" [] Celem.e_pblID (["partial_fraction", "rational", "simplification"], [("#Given" ,["functionTerm t_t", "solveFor v_v"]), (* TODO: call this sub-problem with appropriate functionTerm: @@ -175,7 +175,7 @@ ("#Where" ,["((get_numerator t_t) has_degree_in v_v) < ((get_denominator t_t) has_degree_in v_v)"]), TODO*) ("#Find" ,["decomposedFunction p_p'''"])], - append_rls "e_rls" e_rls [(*for preds in where_ TODO*)], + Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_ TODO*)], NONE, [["simplification","of_rationals","to_partial_fraction"]]))] *} @@ -186,28 +186,28 @@ text {* rule set for functions called in the Script *} ML {* - val srls_partial_fraction = Rls {id="srls_partial_fraction", + val srls_partial_fraction = Celem.Rls {id="srls_partial_fraction", preconds = [], rew_ord = ("termlessI",termlessI), - erls = append_rls "erls_in_srls_partial_fraction" e_rls + erls = Celem.append_rls "erls_in_srls_partial_fraction" Celem.e_rls [(*for asm in NTH_CONS ...*) - Calc ("Orderings.ord_class.less",eval_equ "#less_"), + Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"), (*2nd NTH_CONS pushes n+-1 into asms*) - Calc("Groups.plus_class.plus", eval_binop "#add_")], - srls = Erls, calc = [], errpatts = [], + Celem.Calc("Groups.plus_class.plus", eval_binop "#add_")], + srls = Celem.Erls, calc = [], errpatts = [], rules = [ - Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}), - Calc("Groups.plus_class.plus", eval_binop "#add_"), - Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}), - Calc("Tools.lhs", eval_lhs "eval_lhs_"), - Calc("Tools.rhs", eval_rhs"eval_rhs_"), - Calc("Atools.argument'_in", eval_argument_in "Atools.argument'_in"), - Calc("Rational.get_denominator", eval_get_denominator "#get_denominator"), - Calc("Rational.get_numerator", eval_get_numerator "#get_numerator"), - Calc("Partial_Fractions.factors_from_solution", + Celem.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}), + Celem.Calc("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}), + Celem.Calc("Tools.lhs", eval_lhs "eval_lhs_"), + Celem.Calc("Tools.rhs", eval_rhs"eval_rhs_"), + Celem.Calc("Atools.argument'_in", eval_argument_in "Atools.argument'_in"), + Celem.Calc("Rational.get_denominator", eval_get_denominator "#get_denominator"), + Celem.Calc("Rational.get_numerator", eval_get_numerator "#get_numerator"), + Celem.Calc("Partial_Fractions.factors_from_solution", eval_factors_from_solution "#factors_from_solution"), - Calc("Partial_Fractions.drop_questionmarks", eval_drop_questionmarks "#drop_?")], - scr = EmptyScr}; + Celem.Calc("Partial_Fractions.drop_questionmarks", eval_drop_questionmarks "#drop_?")], + scr = Celem.EmptyScr}; *} ML {* eval_drop_questionmarks; @@ -223,15 +223,15 @@ (* current version, error outcommented *) setup {* KEStore_Elems.add_mets - [Specify.prep_met @{theory} "met_partial_fraction" [] e_metID + [Specify.prep_met @{theory} "met_partial_fraction" [] Celem.e_metID (["simplification","of_rationals","to_partial_fraction"], [("#Given" ,["functionTerm t_t", "solveFor v_v"]), (*("#Where" ,["((get_numerator t_t) has_degree_in v_v) < ((get_denominator t_t) has_degree_in v_v)"]), TODO*) ("#Find" ,["decomposedFunction p_p'''"])], (*f_f = 3 / (z * (z - 1 / 4 + -1 / 8 * (1 / z)), zzz: z*) - {rew_ord'="tless_true", rls'= e_rls, calc = [], srls = srls_partial_fraction, prls = e_rls, - crls = e_rls, errpats = [], nrls = e_rls}, + {rew_ord'="tless_true", rls'= Celem.e_rls, calc = [], srls = srls_partial_fraction, prls = Celem.e_rls, + crls = Celem.e_rls, errpats = [], nrls = Celem.e_rls}, (*([], Frm), Problem (Partial_Fractions, [partial_fraction, rational, simplification])*) "Script PartFracScript (f_f::real) (zzz::real) = " ^ (*([1], Frm), 3 / (z * (z - 1 / 4 + -1 / 8 * (1 / z)))*) diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/Poly.thy --- a/src/Tools/isac/Knowledge/Poly.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/Poly.thy Thu Mar 15 12:42:04 2018 +0100 @@ -186,9 +186,9 @@ fun eval_is_polyrat_in _ _(p as (Const ("Poly.is'_polyrat'_in",_) $ t $ v)) _ = if is_polyrat_in t v - then SOME ((term2str p) ^ " = True", + then SOME ((Celem.term2str p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True}))) - else SOME ((term2str p) ^ " = True", + else SOME ((Celem.term2str p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False}))) | eval_is_polyrat_in _ _ _ _ = ((*tracing"### no matches";*) NONE); @@ -341,16 +341,16 @@ fun eval_is_expanded_in _ _ (p as (Const ("Poly.is'_expanded'_in",_) $ t $ v)) _ = if is_expanded_in t v - then SOME ((term2str p) ^ " = True", + then SOME ((Celem.term2str p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True}))) - else SOME ((term2str p) ^ " = True", + else SOME ((Celem.term2str p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False}))) | eval_is_expanded_in _ _ _ _ = NONE; (* val t = (Thm.term_of o the o (parse thy)) "(-8 - 2*x + x^^^2) is_expanded_in x"; val SOME (id, t') = eval_is_expanded_in 0 0 t 0; (*val id = "Poly.is'_expanded'_in (-8 - 2 * x + x ^^^ 2) x = True"*) - term2str t'; + Celem.term2str t'; (*val it = "Poly.is'_expanded'_in (-8 - 2 * x + x ^^^ 2) x = True"*) *) @@ -358,16 +358,16 @@ fun eval_is_poly_in _ _ (p as (Const ("Poly.is'_poly'_in",_) $ t $ v)) _ = if is_poly_in t v - then SOME ((term2str p) ^ " = True", + then SOME ((Celem.term2str p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True}))) - else SOME ((term2str p) ^ " = True", + else SOME ((Celem.term2str p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False}))) | eval_is_poly_in _ _ _ _ = NONE; (* val t = (Thm.term_of o the o (parse thy)) "(8 + 2*x + x^^^2) is_poly_in x"; val SOME (id, t') = eval_is_poly_in 0 0 t 0; (*val id = "Poly.is'_poly'_in (8 + 2 * x + x ^^^ 2) x = True"*) - term2str t'; + Celem.term2str t'; (*val it = "Poly.is'_poly'_in (8 + 2 * x + x ^^^ 2) x = True"*) *) @@ -376,7 +376,7 @@ (p as (Const ("Poly.has'_degree'_in",_) $ t $ v)) _ = let val d = has_degree_in t v val d' = TermC.term_of_num HOLogic.realT d - in SOME ((term2str p) ^ " = " ^ (string_of_int d), + in SOME ((Celem.term2str p) ^ " = " ^ (string_of_int d), HOLogic.Trueprop $ (TermC.mk_equality (p, d'))) end | eval_has_degree_in _ _ _ _ = NONE; @@ -384,31 +384,31 @@ > val t = (Thm.term_of o the o (parse thy)) "(-8 - 2*x + x^^^2) has_degree_in x"; > val SOME (id, t') = eval_has_degree_in 0 0 t 0; val id = "Poly.has'_degree'_in (-8 - 2 * x + x ^^^ 2) x = 2" : string -> term2str t'; +> Celem.term2str t'; val it = "Poly.has'_degree'_in (-8 - 2 * x + x ^^^ 2) x = 2" : string *) (*..*) val calculate_Poly = - append_rls "calculate_PolyFIXXXME.not.impl." e_rls + Celem.append_rls "calculate_PolyFIXXXME.not.impl." Celem.e_rls []; (*.for evaluation of conditions in rewrite rules.*) -val Poly_erls = append_rls "Poly_erls" Atools_erls - [Calc ("HOL.eq", eval_equal "#equal_"), - Thm ("real_unari_minus", TermC.num_str @{thm real_unari_minus}), - Calc ("Groups.plus_class.plus", eval_binop "#add_"), - Calc ("Groups.minus_class.minus", eval_binop "#sub_"), - Calc ("Groups.times_class.times", eval_binop "#mult_"), - Calc ("Atools.pow", eval_binop "#power_")]; +val Poly_erls = Celem.append_rls "Poly_erls" Atools_erls + [Celem.Calc ("HOL.eq", eval_equal "#equal_"), + Celem.Thm ("real_unari_minus", TermC.num_str @{thm real_unari_minus}), + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Calc ("Groups.minus_class.minus", eval_binop "#sub_"), + Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"), + Celem.Calc ("Atools.pow", eval_binop "#power_")]; -val poly_crls = append_rls "poly_crls" Atools_crls - [Calc ("HOL.eq", eval_equal "#equal_"), - Thm ("real_unari_minus", TermC.num_str @{thm real_unari_minus}), - Calc ("Groups.plus_class.plus", eval_binop "#add_"), - Calc ("Groups.minus_class.minus", eval_binop "#sub_"), - Calc ("Groups.times_class.times", eval_binop "#mult_"), - Calc ("Atools.pow" ,eval_binop "#power_")]; +val poly_crls = Celem.append_rls "poly_crls" Atools_crls + [Celem.Calc ("HOL.eq", eval_equal "#equal_"), + Celem.Thm ("real_unari_minus", TermC.num_str @{thm real_unari_minus}), + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Calc ("Groups.minus_class.minus", eval_binop "#sub_"), + Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"), + Celem.Calc ("Atools.pow" ,eval_binop "#power_")]; local (*. for make_polynomial .*) @@ -445,10 +445,10 @@ (if pr then let val (f, ts) = strip_comb t and (g, us) = strip_comb u; - val _ = tracing ("t= f@ts= \"" ^ term_to_string''' thy f ^ "\" @ \"[" ^ - commas (map (term_to_string''' thy) ts) ^ "]\""); - val _ = tracing("u= g@us= \"" ^ term_to_string''' thy g ^ "\" @ \"[" ^ - commas (map (term_to_string''' thy) us) ^ "]\""); + val _ = tracing ("t= f@ts= \"" ^ Celem.term_to_string''' thy f ^ "\" @ \"[" ^ + commas (map (Celem.term_to_string''' thy) ts) ^ "]\""); + val _ = tracing("u= g@us= \"" ^ Celem.term_to_string''' thy g ^ "\" @ \"[" ^ + commas (map (Celem.term_to_string''' thy) us) ^ "]\""); val _ = tracing ("size_of_term(t,u)= (" ^ string_of_int (size_of_term' t) ^ ", " ^ string_of_int (size_of_term' u) ^ ")"); val _ = tracing ("hd_ord(f,g) = " ^ (pr_ord o hd_ord) (f,g)); @@ -466,78 +466,78 @@ and hd_ord (f, g) = (* ~ term.ML *) prod_ord (prod_ord Term_Ord.indexname_ord Term_Ord.typ_ord) int_ord (dest_hd' f, dest_hd' g) and terms_ord str pr (ts, us) = - list_ord (term_ord' pr (assoc_thy "Isac"))(ts, us); + list_ord (term_ord' pr (Celem.assoc_thy "Isac"))(ts, us); in -fun ord_make_polynomial (pr:bool) thy (_:subst) tu = +fun ord_make_polynomial (pr:bool) thy (_: Celem.subst) tu = (term_ord' pr thy(***) tu = LESS ); end;(*local*) -rew_ord' := overwritel (!rew_ord', +Celem.rew_ord' := overwritel (! Celem.rew_ord', [("termlessI", termlessI), ("ord_make_polynomial", ord_make_polynomial false thy) ]); val expand = - Rls{id = "expand", preconds = [], rew_ord = ("dummy_ord", dummy_ord), - erls = e_rls,srls = Erls, calc = [], errpatts = [], - rules = [Thm ("distrib_right" , TermC.num_str @{thm distrib_right}), + Celem.Rls {id = "expand", preconds = [], rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Celem.e_rls,srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Thm ("distrib_right" , TermC.num_str @{thm distrib_right}), (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*) - Thm ("distrib_left", TermC.num_str @{thm distrib_left}) + Celem.Thm ("distrib_left", TermC.num_str @{thm distrib_left}) (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*) - ], scr = EmptyScr}:rls; + ], scr = Celem.EmptyScr}; (*----------------- Begin: rulesets for make_polynomial_ ----------------- 'rlsIDs' redefined by MG as 'rlsIDs_' ^^^*) val discard_minus = - Rls {id = "discard_minus", preconds = [], rew_ord = ("dummy_ord", dummy_ord), - erls = e_rls, srls = Erls, calc = [], errpatts = [], + Celem.Rls {id = "discard_minus", preconds = [], rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [], rules = - [Thm ("real_diff_minus", TermC.num_str @{thm real_diff_minus}), + [Celem.Thm ("real_diff_minus", TermC.num_str @{thm real_diff_minus}), (*"a - b = a + -1 * b"*) - Thm ("sym_real_mult_minus1", TermC.num_str (@{thm real_mult_minus1} RS @{thm sym})) + Celem.Thm ("sym_real_mult_minus1", TermC.num_str (@{thm real_mult_minus1} RS @{thm sym})) (*- ?z = "-1 * ?z"*)], - scr = EmptyScr}:rls; + scr = Celem.EmptyScr}; val expand_poly_ = - Rls{id = "expand_poly_", preconds = [], - rew_ord = ("dummy_ord", dummy_ord), - erls = e_rls,srls = Erls, + Celem.Rls{id = "expand_poly_", preconds = [], + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Celem.e_rls,srls = Celem.Erls, calc = [], errpatts = [], rules = - [Thm ("real_plus_binom_pow4", TermC.num_str @{thm real_plus_binom_pow4}), + [Celem.Thm ("real_plus_binom_pow4", TermC.num_str @{thm real_plus_binom_pow4}), (*"(a + b)^^^4 = ... "*) - Thm ("real_plus_binom_pow5",TermC.num_str @{thm real_plus_binom_pow5}), + Celem.Thm ("real_plus_binom_pow5",TermC.num_str @{thm real_plus_binom_pow5}), (*"(a + b)^^^5 = ... "*) - Thm ("real_plus_binom_pow3",TermC.num_str @{thm real_plus_binom_pow3}), + Celem.Thm ("real_plus_binom_pow3",TermC.num_str @{thm real_plus_binom_pow3}), (*"(a + b)^^^3 = a^^^3 + 3*a^^^2*b + 3*a*b^^^2 + b^^^3" *) (*WN071229 changed/removed for Schaerding -----vvv*) - (*Thm ("real_plus_binom_pow2",TermC.num_str @{thm real_plus_binom_pow2}),*) + (*Celem.Thm ("real_plus_binom_pow2",TermC.num_str @{thm real_plus_binom_pow2}),*) (*"(a + b)^^^2 = a^^^2 + 2*a*b + b^^^2"*) - Thm ("real_plus_binom_pow2",TermC.num_str @{thm real_plus_binom_pow2}), + Celem.Thm ("real_plus_binom_pow2",TermC.num_str @{thm real_plus_binom_pow2}), (*"(a + b)^^^2 = (a + b) * (a + b)"*) - (*Thm ("real_plus_minus_binom1_p_p", TermC.num_str @{thm real_plus_minus_binom1_p_p}),*) + (*Celem.Thm ("real_plus_minus_binom1_p_p", TermC.num_str @{thm real_plus_minus_binom1_p_p}),*) (*"(a + b)*(a + -1 * b) = a^^^2 + -1*b^^^2"*) - (*Thm ("real_plus_minus_binom2_p_p", TermC.num_str @{thm real_plus_minus_binom2_p_p}),*) + (*Celem.Thm ("real_plus_minus_binom2_p_p", TermC.num_str @{thm real_plus_minus_binom2_p_p}),*) (*"(a + -1 * b)*(a + b) = a^^^2 + -1*b^^^2"*) (*WN071229 changed/removed for Schaerding -----^^^*) - Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}), + Celem.Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}), (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*) - Thm ("distrib_left",TermC.num_str @{thm distrib_left}), + Celem.Thm ("distrib_left",TermC.num_str @{thm distrib_left}), (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*) - Thm ("realpow_multI", TermC.num_str @{thm realpow_multI}), + Celem.Thm ("realpow_multI", TermC.num_str @{thm realpow_multI}), (*"(r * s) ^^^ n = r ^^^ n * s ^^^ n"*) - Thm ("realpow_pow",TermC.num_str @{thm realpow_pow}) + Celem.Thm ("realpow_pow",TermC.num_str @{thm realpow_pow}) (*"(a ^^^ b) ^^^ c = a ^^^ (b * c)"*) - ], scr = EmptyScr}:rls; + ], scr = Celem.EmptyScr}; (*.the expression contains + - * ^ only ? this is weaker than 'is_polynomial' !.*) @@ -560,169 +560,169 @@ fun eval_is_polyexp (thmid:string) _ (t as (Const("Poly.is'_polyexp", _) $ arg)) thy = if is_polyexp arg - then SOME (TermC.mk_thmid thmid (term_to_string''' thy arg) "", + then SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg) "", HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True}))) - else SOME (TermC.mk_thmid thmid (term_to_string''' thy arg) "", + else SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg) "", HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False}))) | eval_is_polyexp _ _ _ _ = NONE; val expand_poly_rat_ = - Rls{id = "expand_poly_rat_", preconds = [], - rew_ord = ("dummy_ord", dummy_ord), - erls = append_rls "e_rls-is_polyexp" e_rls - [Calc ("Poly.is'_polyexp", eval_is_polyexp "") + Celem.Rls{id = "expand_poly_rat_", preconds = [], + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Celem.append_rls "Celem.e_rls-is_polyexp" Celem.e_rls + [Celem.Calc ("Poly.is'_polyexp", eval_is_polyexp "") ], - srls = Erls, + srls = Celem.Erls, calc = [], errpatts = [], rules = - [Thm ("real_plus_binom_pow4_poly", TermC.num_str @{thm real_plus_binom_pow4_poly}), + [Celem.Thm ("real_plus_binom_pow4_poly", TermC.num_str @{thm real_plus_binom_pow4_poly}), (*"[| a is_polyexp; b is_polyexp |] ==> (a + b)^^^4 = ... "*) - Thm ("real_plus_binom_pow5_poly", TermC.num_str @{thm real_plus_binom_pow5_poly}), + Celem.Thm ("real_plus_binom_pow5_poly", TermC.num_str @{thm real_plus_binom_pow5_poly}), (*"[| a is_polyexp; b is_polyexp |] ==> (a + b)^^^5 = ... "*) - Thm ("real_plus_binom_pow2_poly",TermC.num_str @{thm real_plus_binom_pow2_poly}), + Celem.Thm ("real_plus_binom_pow2_poly",TermC.num_str @{thm real_plus_binom_pow2_poly}), (*"[| a is_polyexp; b is_polyexp |] ==> (a + b)^^^2 = a^^^2 + 2*a*b + b^^^2"*) - Thm ("real_plus_binom_pow3_poly",TermC.num_str @{thm real_plus_binom_pow3_poly}), + Celem.Thm ("real_plus_binom_pow3_poly",TermC.num_str @{thm real_plus_binom_pow3_poly}), (*"[| a is_polyexp; b is_polyexp |] ==> (a + b)^^^3 = a^^^3 + 3*a^^^2*b + 3*a*b^^^2 + b^^^3" *) - Thm ("real_plus_minus_binom1_p_p",TermC.num_str @{thm real_plus_minus_binom1_p_p}), + Celem.Thm ("real_plus_minus_binom1_p_p",TermC.num_str @{thm real_plus_minus_binom1_p_p}), (*"(a + b)*(a + -1 * b) = a^^^2 + -1*b^^^2"*) - Thm ("real_plus_minus_binom2_p_p",TermC.num_str @{thm real_plus_minus_binom2_p_p}), + Celem.Thm ("real_plus_minus_binom2_p_p",TermC.num_str @{thm real_plus_minus_binom2_p_p}), (*"(a + -1 * b)*(a + b) = a^^^2 + -1*b^^^2"*) - Thm ("real_add_mult_distrib_poly", + Celem.Thm ("real_add_mult_distrib_poly", TermC.num_str @{thm real_add_mult_distrib_poly}), (*"w is_polyexp ==> (z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*) - Thm("real_add_mult_distrib2_poly", + Celem.Thm("real_add_mult_distrib2_poly", TermC.num_str @{thm real_add_mult_distrib2_poly}), (*"w is_polyexp ==> w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*) - Thm ("realpow_multI_poly", TermC.num_str @{thm realpow_multI_poly}), + Celem.Thm ("realpow_multI_poly", TermC.num_str @{thm realpow_multI_poly}), (*"[| r is_polyexp; s is_polyexp |] ==> (r * s) ^^^ n = r ^^^ n * s ^^^ n"*) - Thm ("realpow_pow",TermC.num_str @{thm realpow_pow}) + Celem.Thm ("realpow_pow",TermC.num_str @{thm realpow_pow}) (*"(a ^^^ b) ^^^ c = a ^^^ (b * c)"*) - ], scr = EmptyScr}:rls; + ], scr = Celem.EmptyScr}; val simplify_power_ = - Rls{id = "simplify_power_", preconds = [], - rew_ord = ("dummy_ord", dummy_ord), - erls = e_rls, srls = Erls, + Celem.Rls{id = "simplify_power_", preconds = [], + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [], - rules = [(*MG: Reihenfolge der folgenden 2 Thm muss so bleiben, wegen + rules = [(*MG: Reihenfolge der folgenden 2 Celem.Thm muss so bleiben, wegen a*(a*a) --> a*a^^^2 und nicht a*(a*a) --> a^^^2*a *) - Thm ("sym_realpow_twoI", + Celem.Thm ("sym_realpow_twoI", TermC.num_str (@{thm realpow_twoI} RS @{thm sym})), (*"r * r = r ^^^ 2"*) - Thm ("realpow_twoI_assoc_l",TermC.num_str @{thm realpow_twoI_assoc_l}), + Celem.Thm ("realpow_twoI_assoc_l",TermC.num_str @{thm realpow_twoI_assoc_l}), (*"r * (r * s) = r ^^^ 2 * s"*) - Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}), + Celem.Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}), (*"r * r ^^^ n = r ^^^ (n + 1)"*) - Thm ("realpow_plus_1_assoc_l", + Celem.Thm ("realpow_plus_1_assoc_l", TermC.num_str @{thm realpow_plus_1_assoc_l}), (*"r * (r ^^^ m * s) = r ^^^ (1 + m) * s"*) - (*MG 9.7.03: neues Thm wegen a*(a*(a*b)) --> a^^^2*(a*b) *) - Thm ("realpow_plus_1_assoc_l2", + (*MG 9.7.03: neues Celem.Thm wegen a*(a*(a*b)) --> a^^^2*(a*b) *) + Celem.Thm ("realpow_plus_1_assoc_l2", TermC.num_str @{thm realpow_plus_1_assoc_l2}), (*"r ^^^ m * (r * s) = r ^^^ (1 + m) * s"*) - Thm ("sym_realpow_addI", + Celem.Thm ("sym_realpow_addI", TermC.num_str (@{thm realpow_addI} RS @{thm sym})), (*"r ^^^ n * r ^^^ m = r ^^^ (n + m)"*) - Thm ("realpow_addI_assoc_l",TermC.num_str @{thm realpow_addI_assoc_l}), + Celem.Thm ("realpow_addI_assoc_l",TermC.num_str @{thm realpow_addI_assoc_l}), (*"r ^^^ n * (r ^^^ m * s) = r ^^^ (n + m) * s"*) (* ist in expand_poly - wird hier aber auch gebraucht, wegen: "r * r = r ^^^ 2" wenn r=a^^^b*) - Thm ("realpow_pow",TermC.num_str @{thm realpow_pow}) + Celem.Thm ("realpow_pow",TermC.num_str @{thm realpow_pow}) (*"(a ^^^ b) ^^^ c = a ^^^ (b * c)"*) - ], scr = EmptyScr}:rls; + ], scr = Celem.EmptyScr}; val calc_add_mult_pow_ = - Rls{id = "calc_add_mult_pow_", preconds = [], - rew_ord = ("dummy_ord", dummy_ord), - erls = Atools_erls(*erls3.4.03*),srls = Erls, + Celem.Rls{id = "calc_add_mult_pow_", preconds = [], + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Atools_erls(*erls3.4.03*),srls = Celem.Erls, calc = [("PLUS" , ("Groups.plus_class.plus", eval_binop "#add_")), ("TIMES" , ("Groups.times_class.times", eval_binop "#mult_")), ("POWER", ("Atools.pow", eval_binop "#power_")) ], errpatts = [], - rules = [Calc ("Groups.plus_class.plus", eval_binop "#add_"), - Calc ("Groups.times_class.times", eval_binop "#mult_"), - Calc ("Atools.pow", eval_binop "#power_") - ], scr = EmptyScr}:rls; + rules = [Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"), + Celem.Calc ("Atools.pow", eval_binop "#power_") + ], scr = Celem.EmptyScr}; val reduce_012_mult_ = - Rls{id = "reduce_012_mult_", preconds = [], - rew_ord = ("dummy_ord", dummy_ord), - erls = e_rls,srls = Erls, + Celem.Rls{id = "reduce_012_mult_", preconds = [], + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Celem.e_rls,srls = Celem.Erls, calc = [], errpatts = [], - rules = [(* MG: folgende Thm müssen hier stehen bleiben: *) - Thm ("mult_1_right",TermC.num_str @{thm mult_1_right}), + rules = [(* MG: folgende Celem.Thm müssen hier stehen bleiben: *) + Celem.Thm ("mult_1_right",TermC.num_str @{thm mult_1_right}), (*"z * 1 = z"*) (*wegen "a * b * b^^^(-1) + a"*) - Thm ("realpow_zeroI",TermC.num_str @{thm realpow_zeroI}), + Celem.Thm ("realpow_zeroI",TermC.num_str @{thm realpow_zeroI}), (*"r ^^^ 0 = 1"*) (*wegen "a*a^^^(-1)*c + b + c"*) - Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}), + Celem.Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}), (*"r ^^^ 1 = r"*) - Thm ("realpow_eq_oneI",TermC.num_str @{thm realpow_eq_oneI}) + Celem.Thm ("realpow_eq_oneI",TermC.num_str @{thm realpow_eq_oneI}) (*"1 ^^^ n = 1"*) - ], scr = EmptyScr}:rls; + ], scr = Celem.EmptyScr}; val collect_numerals_ = - Rls{id = "collect_numerals_", preconds = [], - rew_ord = ("dummy_ord", dummy_ord), - erls = Atools_erls, srls = Erls, + Celem.Rls{id = "collect_numerals_", preconds = [], + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Atools_erls, srls = Celem.Erls, calc = [("PLUS" , ("Groups.plus_class.plus", eval_binop "#add_")) ], errpatts = [], rules = - [Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), + [Celem.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*) - Thm ("real_num_collect_assoc_r",TermC.num_str @{thm real_num_collect_assoc_r}), + Celem.Thm ("real_num_collect_assoc_r",TermC.num_str @{thm real_num_collect_assoc_r}), (*"[| l is_const; m is_const |] ==> \ \(k + m * n) + l * n = k + (l + m)*n"*) - Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}), + Celem.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}), (*"m is_const ==> n + m * n = (1 + m) * n"*) - Thm ("real_one_collect_assoc_r",TermC.num_str @{thm real_one_collect_assoc_r}), + Celem.Thm ("real_one_collect_assoc_r",TermC.num_str @{thm real_one_collect_assoc_r}), (*"m is_const ==> (k + n) + m * n = k + (m + 1) * n"*) - Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), - (*MG: Reihenfolge der folgenden 2 Thm muss so bleiben, wegen + (*MG: Reihenfolge der folgenden 2 Celem.Thm muss so bleiben, wegen (a+a)+a --> a + 2*a --> 3*a and not (a+a)+a --> 2*a + a *) - Thm ("real_mult_2_assoc_r",TermC.num_str @{thm real_mult_2_assoc_r}), + Celem.Thm ("real_mult_2_assoc_r",TermC.num_str @{thm real_mult_2_assoc_r}), (*"(k + z1) + z1 = k + 2 * z1"*) - Thm ("sym_real_mult_2",TermC.num_str (@{thm real_mult_2} RS @{thm sym})) + Celem.Thm ("sym_real_mult_2",TermC.num_str (@{thm real_mult_2} RS @{thm sym})) (*"z1 + z1 = 2 * z1"*) - ], scr = EmptyScr}:rls; + ], scr = Celem.EmptyScr}; val reduce_012_ = - Rls{id = "reduce_012_", preconds = [], - rew_ord = ("dummy_ord", dummy_ord), - erls = e_rls,srls = Erls, calc = [], errpatts = [], - rules = [Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}), + Celem.Rls{id = "reduce_012_", preconds = [], + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Celem.e_rls,srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}), (*"1 * z = z"*) - Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}), + Celem.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}), (*"0 * z = 0"*) - Thm ("mult_zero_right",TermC.num_str @{thm mult_zero_right}), + Celem.Thm ("mult_zero_right",TermC.num_str @{thm mult_zero_right}), (*"z * 0 = 0"*) - Thm ("add_0_left",TermC.num_str @{thm add_0_left}), + Celem.Thm ("add_0_left",TermC.num_str @{thm add_0_left}), (*"0 + z = z"*) - Thm ("add_0_right",TermC.num_str @{thm add_0_right}), + Celem.Thm ("add_0_right",TermC.num_str @{thm add_0_right}), (*"z + 0 = z"*) (*wegen a+b-b --> a+(1-1)*b --> a+0 --> a*) - (*Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI})*) + (*Celem.Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI})*) (*"?r ^^^ 1 = ?r"*) - Thm ("division_ring_divide_zero",TermC.num_str @{thm division_ring_divide_zero}) + Celem.Thm ("division_ring_divide_zero",TermC.num_str @{thm division_ring_divide_zero}) (*"0 / ?x = 0"*) - ], scr = EmptyScr}:rls; + ], scr = Celem.EmptyScr}; val discard_parentheses1 = - append_rls "discard_parentheses1" e_rls - [Thm ("sym_mult_assoc", + Celem.append_rls "discard_parentheses1" Celem.e_rls + [Celem.Thm ("sym_mult_assoc", TermC.num_str (@{thm mult.assoc} RS @{thm sym})) (*"?z1.1 * (?z2.1 * ?z3.1) = ?z1.1 * ?z2.1 * ?z3.1"*) - (*Thm ("sym_add_assoc", + (*Celem.Thm ("sym_add_assoc", TermC.num_str (@{thm add_assoc} RS @{thm sym}))*) (*"?z1.1 + (?z2.1 + ?z3.1) = ?z1.1 + ?z2.1 + ?z3.1"*) ]; @@ -731,187 +731,187 @@ (*MG.0401 ev. for use in rls with ordered rewriting ? val collect_numerals_left = - Rls{id = "collect_numerals", preconds = [], - rew_ord = ("dummy_ord", dummy_ord), - erls = Atools_erls(*erls3.4.03*),srls = Erls, + Celem.Rls{id = "collect_numerals", preconds = [], + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Atools_erls(*erls3.4.03*),srls = Celem.Erls, calc = [("PLUS" , ("Groups.plus_class.plus", eval_binop "#add_")), ("TIMES" , ("Groups.times_class.times", eval_binop "#mult_")), ("POWER", ("Atools.pow", eval_binop "#power_")) ], errpatts = [], - rules = [Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), + rules = [Celem.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*) - Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}), + Celem.Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}), (*"[| l is_const; m is_const |] ==> l * n + (m * n + k) = (l + m) * n + k"*) - Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}), + Celem.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}), (*"m is_const ==> n + m * n = (1 + m) * n"*) - Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), + Celem.Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), (*"m is_const ==> n + (m * n + k) = (1 + m) * n + k"*) - Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), (*MG am 2.5.03: 2 Theoreme aus reduce_012 hierher verschoben*) - Thm ("sym_real_mult_2", + Celem.Thm ("sym_real_mult_2", TermC.num_str (@{thm real_mult_2} RS @{thm sym})), (*"z1 + z1 = 2 * z1"*) - Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}) + Celem.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}) (*"z1 + (z1 + k) = 2 * z1 + k"*) - ], scr = EmptyScr}:rls;*) + ], scr = Celem.EmptyScr};*) val expand_poly = - Rls{id = "expand_poly", preconds = [], - rew_ord = ("dummy_ord", dummy_ord), - erls = e_rls,srls = Erls, + Celem.Rls{id = "expand_poly", preconds = [], + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Celem.e_rls,srls = Celem.Erls, calc = [], errpatts = [], (*asm_thm = [],*) - rules = [Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}), + rules = [Celem.Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}), (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*) - Thm ("distrib_left",TermC.num_str @{thm distrib_left}), + Celem.Thm ("distrib_left",TermC.num_str @{thm distrib_left}), (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*) - (*Thm ("distrib_right1",TermC.num_str @{thm distrib_right}1), + (*Celem.Thm ("distrib_right1",TermC.num_str @{thm distrib_right}1), ....... 18.3.03 undefined???*) - Thm ("real_plus_binom_pow2",TermC.num_str @{thm real_plus_binom_pow2}), + Celem.Thm ("real_plus_binom_pow2",TermC.num_str @{thm real_plus_binom_pow2}), (*"(a + b)^^^2 = a^^^2 + 2*a*b + b^^^2"*) - Thm ("real_minus_binom_pow2_p",TermC.num_str @{thm real_minus_binom_pow2_p}), + Celem.Thm ("real_minus_binom_pow2_p",TermC.num_str @{thm real_minus_binom_pow2_p}), (*"(a - b)^^^2 = a^^^2 + -2*a*b + b^^^2"*) - Thm ("real_plus_minus_binom1_p", + Celem.Thm ("real_plus_minus_binom1_p", TermC.num_str @{thm real_plus_minus_binom1_p}), (*"(a + b)*(a - b) = a^^^2 + -1*b^^^2"*) - Thm ("real_plus_minus_binom2_p", + Celem.Thm ("real_plus_minus_binom2_p", TermC.num_str @{thm real_plus_minus_binom2_p}), (*"(a - b)*(a + b) = a^^^2 + -1*b^^^2"*) - Thm ("minus_minus",TermC.num_str @{thm minus_minus}), + Celem.Thm ("minus_minus",TermC.num_str @{thm minus_minus}), (*"- (- ?z) = ?z"*) - Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}), + Celem.Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}), (*"a - b = a + -1 * b"*) - Thm ("sym_real_mult_minus1", + Celem.Thm ("sym_real_mult_minus1", TermC.num_str (@{thm real_mult_minus1} RS @{thm sym})) (*- ?z = "-1 * ?z"*) - (*Thm ("real_minus_add_distrib", + (*Celem.Thm ("real_minus_add_distrib", TermC.num_str @{thm real_minus_add_distrib}),*) (*"- (?x + ?y) = - ?x + - ?y"*) - (*Thm ("real_diff_plus",TermC.num_str @{thm real_diff_plus})*) + (*Celem.Thm ("real_diff_plus",TermC.num_str @{thm real_diff_plus})*) (*"a - b = a + -b"*) - ], scr = EmptyScr}:rls; + ], scr = Celem.EmptyScr}; val simplify_power = - Rls{id = "simplify_power", preconds = [], - rew_ord = ("dummy_ord", dummy_ord), - erls = e_rls, srls = Erls, + Celem.Rls{id = "simplify_power", preconds = [], + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [], - rules = [Thm ("realpow_multI", TermC.num_str @{thm realpow_multI}), + rules = [Celem.Thm ("realpow_multI", TermC.num_str @{thm realpow_multI}), (*"(r * s) ^^^ n = r ^^^ n * s ^^^ n"*) - Thm ("sym_realpow_twoI", + Celem.Thm ("sym_realpow_twoI", TermC.num_str( @{thm realpow_twoI} RS @{thm sym})), (*"r1 * r1 = r1 ^^^ 2"*) - Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}), + Celem.Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}), (*"r * r ^^^ n = r ^^^ (n + 1)"*) - Thm ("realpow_pow",TermC.num_str @{thm realpow_pow}), + Celem.Thm ("realpow_pow",TermC.num_str @{thm realpow_pow}), (*"(a ^^^ b) ^^^ c = a ^^^ (b * c)"*) - Thm ("sym_realpow_addI", + Celem.Thm ("sym_realpow_addI", TermC.num_str (@{thm realpow_addI} RS @{thm sym})), (*"r ^^^ n * r ^^^ m = r ^^^ (n + m)"*) - Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}), + Celem.Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}), (*"r ^^^ 1 = r"*) - Thm ("realpow_eq_oneI",TermC.num_str @{thm realpow_eq_oneI}) + Celem.Thm ("realpow_eq_oneI",TermC.num_str @{thm realpow_eq_oneI}) (*"1 ^^^ n = 1"*) - ], scr = EmptyScr}:rls; + ], scr = Celem.EmptyScr}; (*MG.0401: termorders for multivariate polys dropped due to principal problems: (total-degree-)ordering of monoms NOT possible with size_of_term GIVEN*) val order_add_mult = - Rls{id = "order_add_mult", preconds = [], + Celem.Rls{id = "order_add_mult", preconds = [], rew_ord = ("ord_make_polynomial",ord_make_polynomial false thy), - erls = e_rls,srls = Erls, + erls = Celem.e_rls,srls = Celem.Erls, calc = [], errpatts = [], - rules = [Thm ("mult_commute",TermC.num_str @{thm mult.commute}), + rules = [Celem.Thm ("mult_commute",TermC.num_str @{thm mult.commute}), (* z * w = w * z *) - Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}), + Celem.Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}), (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*) - Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}), + Celem.Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}), (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*) - Thm ("add_commute",TermC.num_str @{thm add.commute}), + Celem.Thm ("add_commute",TermC.num_str @{thm add.commute}), (*z + w = w + z*) - Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}), + Celem.Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}), (*x + (y + z) = y + (x + z)*) - Thm ("add_assoc",TermC.num_str @{thm add.assoc}) + Celem.Thm ("add_assoc",TermC.num_str @{thm add.assoc}) (*z1.0 + z2.0 + z3.0 = z1.0 + (z2.0 + z3.0)*) - ], scr = EmptyScr}:rls; + ], scr = Celem.EmptyScr}; (*MG.0401: termorders for multivariate polys dropped due to principal problems: (total-degree-)ordering of monoms NOT possible with size_of_term GIVEN*) val order_mult = - Rls{id = "order_mult", preconds = [], + Celem.Rls{id = "order_mult", preconds = [], rew_ord = ("ord_make_polynomial",ord_make_polynomial false thy), - erls = e_rls,srls = Erls, + erls = Celem.e_rls,srls = Celem.Erls, calc = [], errpatts = [], - rules = [Thm ("mult_commute",TermC.num_str @{thm mult.commute}), + rules = [Celem.Thm ("mult_commute",TermC.num_str @{thm mult.commute}), (* z * w = w * z *) - Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}), + Celem.Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}), (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*) - Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}) + Celem.Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}) (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*) - ], scr = EmptyScr}:rls; + ], scr = Celem.EmptyScr}; *} ML {* val collect_numerals = - Rls{id = "collect_numerals", preconds = [], - rew_ord = ("dummy_ord", dummy_ord), - erls = Atools_erls(*erls3.4.03*),srls = Erls, + Celem.Rls{id = "collect_numerals", preconds = [], + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Atools_erls(*erls3.4.03*),srls = Celem.Erls, calc = [("PLUS" , ("Groups.plus_class.plus", eval_binop "#add_")), ("TIMES" , ("Groups.times_class.times", eval_binop "#mult_")), ("POWER", ("Atools.pow", eval_binop "#power_")) ], errpatts = [], - rules = [Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), + rules = [Celem.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*) - Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}), + Celem.Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}), (*"[| l is_const; m is_const |] ==> l * n + (m * n + k) = (l + m) * n + k"*) - Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}), + Celem.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}), (*"m is_const ==> n + m * n = (1 + m) * n"*) - Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), + Celem.Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*) - Calc ("Groups.plus_class.plus", eval_binop "#add_"), - Calc ("Groups.times_class.times", eval_binop "#mult_"), - Calc ("Atools.pow", eval_binop "#power_") - ], scr = EmptyScr}:rls; + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"), + Celem.Calc ("Atools.pow", eval_binop "#power_") + ], scr = Celem.EmptyScr}; val reduce_012 = - Rls{id = "reduce_012", preconds = [], - rew_ord = ("dummy_ord", dummy_ord), - erls = e_rls,srls = Erls, + Celem.Rls{id = "reduce_012", preconds = [], + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Celem.e_rls,srls = Celem.Erls, calc = [], errpatts = [], - rules = [Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}), + rules = [Celem.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}), (*"1 * z = z"*) - (*Thm ("real_mult_minus1",TermC.num_str @{thm real_mult_minus1}),14.3.03*) + (*Celem.Thm ("real_mult_minus1",TermC.num_str @{thm real_mult_minus1}),14.3.03*) (*"-1 * z = - z"*) - Thm ("minus_mult_left", + Celem.Thm ("minus_mult_left", TermC.num_str (@{thm minus_mult_left} RS @{thm sym})), (*- (?x * ?y) = "- ?x * ?y"*) - (*Thm ("real_minus_mult_cancel", + (*Celem.Thm ("real_minus_mult_cancel", TermC.num_str @{thm real_minus_mult_cancel}), (*"- ?x * - ?y = ?x * ?y"*)---*) - Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}), + Celem.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}), (*"0 * z = 0"*) - Thm ("add_0_left",TermC.num_str @{thm add_0_left}), + Celem.Thm ("add_0_left",TermC.num_str @{thm add_0_left}), (*"0 + z = z"*) - Thm ("right_minus",TermC.num_str @{thm right_minus}), + Celem.Thm ("right_minus",TermC.num_str @{thm right_minus}), (*"?z + - ?z = 0"*) - Thm ("sym_real_mult_2", + Celem.Thm ("sym_real_mult_2", TermC.num_str (@{thm real_mult_2} RS @{thm sym})), (*"z1 + z1 = 2 * z1"*) - Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}) + Celem.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}) (*"z1 + (z1 + k) = 2 * z1 + k"*) - ], scr = EmptyScr}:rls; + ], scr = Celem.EmptyScr}; val discard_parentheses = - append_rls "discard_parentheses" e_rls - [Thm ("sym_mult_assoc", + Celem.append_rls "discard_parentheses" Celem.e_rls + [Celem.Thm ("sym_mult_assoc", TermC.num_str (@{thm mult.assoc} RS @{thm sym})), - Thm ("sym_add_assoc", + Celem.Thm ("sym_add_assoc", TermC.num_str (@{thm add.assoc} RS @{thm sym}))]; val scr_make_polynomial = @@ -953,20 +953,20 @@ (*version used by MG.02/03, overwritten by version AG in 04 below val make_polynomial = prep_rls'( - Seq{id = "make_polynomial", preconds = []:term list, - rew_ord = ("dummy_ord", dummy_ord), - erls = Atools_erls, srls = Erls, + Celem.Seq{id = "make_polynomial", preconds = []:term list, + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Atools_erls, srls = Celem.Erls, calc = [], errpatts = [], - rules = [Rls_ expand_poly, - Rls_ order_add_mult, - Rls_ simplify_power, (*realpow_eq_oneI, eg. x^1 --> x *) - Rls_ collect_numerals, (*eg. x^(2+ -1) --> x^1 *) - Rls_ reduce_012, - Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}),(*in --^*) - Rls_ discard_parentheses + rules = [Celem.Rls_ expand_poly, + Celem.Rls_ order_add_mult, + Celem.Rls_ simplify_power, (*realpow_eq_oneI, eg. x^1 --> x *) + Celem.Rls_ collect_numerals, (*eg. x^(2+ -1) --> x^1 *) + Celem.Rls_ reduce_012, + Celem.Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}),(*in --^*) + Celem.Rls_ discard_parentheses ], - scr = EmptyScr - }:rls); *) + scr = Celem.EmptyScr + }); *) val scr_expand_binoms = "Script Expand_binoms t_t =" ^ @@ -1003,104 +1003,104 @@ " t_t)"; val expand_binoms = - Rls{id = "expand_binoms", preconds = [], rew_ord = ("termlessI",termlessI), - erls = Atools_erls, srls = Erls, + Celem.Rls{id = "expand_binoms", preconds = [], rew_ord = ("termlessI",termlessI), + erls = Atools_erls, srls = Celem.Erls, calc = [("PLUS" , ("Groups.plus_class.plus", eval_binop "#add_")), ("TIMES" , ("Groups.times_class.times", eval_binop "#mult_")), ("POWER", ("Atools.pow", eval_binop "#power_")) ], errpatts = [], - rules = [Thm ("real_plus_binom_pow2", + rules = [Celem.Thm ("real_plus_binom_pow2", TermC.num_str @{thm real_plus_binom_pow2}), (*"(a + b) ^^^ 2 = a ^^^ 2 + 2 * a * b + b ^^^ 2"*) - Thm ("real_plus_binom_times", + Celem.Thm ("real_plus_binom_times", TermC.num_str @{thm real_plus_binom_times}), (*"(a + b)*(a + b) = ...*) - Thm ("real_minus_binom_pow2", + Celem.Thm ("real_minus_binom_pow2", TermC.num_str @{thm real_minus_binom_pow2}), (*"(a - b) ^^^ 2 = a ^^^ 2 - 2 * a * b + b ^^^ 2"*) - Thm ("real_minus_binom_times", + Celem.Thm ("real_minus_binom_times", TermC.num_str @{thm real_minus_binom_times}), (*"(a - b)*(a - b) = ...*) - Thm ("real_plus_minus_binom1", + Celem.Thm ("real_plus_minus_binom1", TermC.num_str @{thm real_plus_minus_binom1}), (*"(a + b) * (a - b) = a ^^^ 2 - b ^^^ 2"*) - Thm ("real_plus_minus_binom2", + Celem.Thm ("real_plus_minus_binom2", TermC.num_str @{thm real_plus_minus_binom2}), (*"(a - b) * (a + b) = a ^^^ 2 - b ^^^ 2"*) (*RL 020915*) - Thm ("real_pp_binom_times",TermC.num_str @{thm real_pp_binom_times}), + Celem.Thm ("real_pp_binom_times",TermC.num_str @{thm real_pp_binom_times}), (*(a + b)*(c + d) = a*c + a*d + b*c + b*d*) - Thm ("real_pm_binom_times",TermC.num_str @{thm real_pm_binom_times}), + Celem.Thm ("real_pm_binom_times",TermC.num_str @{thm real_pm_binom_times}), (*(a + b)*(c - d) = a*c - a*d + b*c - b*d*) - Thm ("real_mp_binom_times",TermC.num_str @{thm real_mp_binom_times}), + Celem.Thm ("real_mp_binom_times",TermC.num_str @{thm real_mp_binom_times}), (*(a - b)*(c + d) = a*c + a*d - b*c - b*d*) - Thm ("real_mm_binom_times",TermC.num_str @{thm real_mm_binom_times}), + Celem.Thm ("real_mm_binom_times",TermC.num_str @{thm real_mm_binom_times}), (*(a - b)*(c - d) = a*c - a*d - b*c + b*d*) - Thm ("realpow_multI",TermC.num_str @{thm realpow_multI}), + Celem.Thm ("realpow_multI",TermC.num_str @{thm realpow_multI}), (*(a*b)^^^n = a^^^n * b^^^n*) - Thm ("real_plus_binom_pow3",TermC.num_str @{thm real_plus_binom_pow3}), + Celem.Thm ("real_plus_binom_pow3",TermC.num_str @{thm real_plus_binom_pow3}), (* (a + b)^^^3 = a^^^3 + 3*a^^^2*b + 3*a*b^^^2 + b^^^3 *) - Thm ("real_minus_binom_pow3", + Celem.Thm ("real_minus_binom_pow3", TermC.num_str @{thm real_minus_binom_pow3}), (* (a - b)^^^3 = a^^^3 - 3*a^^^2*b + 3*a*b^^^2 - b^^^3 *) - (*Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}), + (*Celem.Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}), (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*) - Thm ("distrib_left",TermC.num_str @{thm distrib_left}), + Celem.Thm ("distrib_left",TermC.num_str @{thm distrib_left}), (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*) - Thm ("left_diff_distrib" ,TermC.num_str @{thm left_diff_distrib}), + Celem.Thm ("left_diff_distrib" ,TermC.num_str @{thm left_diff_distrib}), (*"(z1.0 - z2.0) * w = z1.0 * w - z2.0 * w"*) - Thm ("right_diff_distrib",TermC.num_str @{thm right_diff_distrib}), + Celem.Thm ("right_diff_distrib",TermC.num_str @{thm right_diff_distrib}), (*"w * (z1.0 - z2.0) = w * z1.0 - w * z2.0"*) *) - Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}), + Celem.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}), (*"1 * z = z"*) - Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}), + Celem.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}), (*"0 * z = 0"*) - Thm ("add_0_left",TermC.num_str @{thm add_0_left}),(*"0 + z = z"*) + Celem.Thm ("add_0_left",TermC.num_str @{thm add_0_left}),(*"0 + z = z"*) - Calc ("Groups.plus_class.plus", eval_binop "#add_"), - Calc ("Groups.times_class.times", eval_binop "#mult_"), - Calc ("Atools.pow", eval_binop "#power_"), - (*Thm ("mult_commute",TermC.num_str @{thm mult_commute}), + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"), + Celem.Calc ("Atools.pow", eval_binop "#power_"), + (*Celem.Thm ("mult_commute",TermC.num_str @{thm mult_commute}), (*AC-rewriting*) - Thm ("real_mult_left_commute", + Celem.Thm ("real_mult_left_commute", TermC.num_str @{thm real_mult_left_commute}), - Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}), - Thm ("add_commute",TermC.num_str @{thm add.commute}), - Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}), - Thm ("add_assoc",TermC.num_str @{thm add.assoc}), + Celem.Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}), + Celem.Thm ("add_commute",TermC.num_str @{thm add.commute}), + Celem.Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}), + Celem.Thm ("add_assoc",TermC.num_str @{thm add.assoc}), *) - Thm ("sym_realpow_twoI", + Celem.Thm ("sym_realpow_twoI", TermC.num_str (@{thm realpow_twoI} RS @{thm sym})), (*"r1 * r1 = r1 ^^^ 2"*) - Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}), + Celem.Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}), (*"r * r ^^^ n = r ^^^ (n + 1)"*) - (*Thm ("sym_real_mult_2", + (*Celem.Thm ("sym_real_mult_2", TermC.num_str (@{thm real_mult_2} RS @{thm sym})), (*"z1 + z1 = 2 * z1"*)*) - Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}), + Celem.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}), (*"z1 + (z1 + k) = 2 * z1 + k"*) - Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), + Celem.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), (*"[| l is_const; m is_const |] ==>l * n + m * n = (l + m) * n"*) - Thm ("real_num_collect_assoc", + Celem.Thm ("real_num_collect_assoc", TermC.num_str @{thm real_num_collect_assoc}), (*"[| l is_const; m is_const |] ==> l * n + (m * n + k) = (l + m) * n + k"*) - Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}), + Celem.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}), (*"m is_const ==> n + m * n = (1 + m) * n"*) - Thm ("real_one_collect_assoc", + Celem.Thm ("real_one_collect_assoc", TermC.num_str @{thm real_one_collect_assoc}), (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*) - Calc ("Groups.plus_class.plus", eval_binop "#add_"), - Calc ("Groups.times_class.times", eval_binop "#mult_"), - Calc ("Atools.pow", eval_binop "#power_") + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"), + Celem.Calc ("Atools.pow", eval_binop "#power_") ], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) scr_expand_binoms) - }:rls; + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) scr_expand_binoms) + }; (**. MG.03: make_polynomial_ ... uses SML-fun for ordering .**) @@ -1122,7 +1122,7 @@ | get_basStr (Free (str, _)) = str | get_basStr t = "|||"; (* gross gewichtet; für Brüch ect. *) (*| get_basStr t = - error("get_basStr: called with t= "^(term2str t));*) + error("get_basStr: called with t= "^(Celem.term2str t));*) (* liefert Hochzahl (String) einer Variablen bzw Gewichtstring (zum Sortieren) *) fun get_potStr (Const ("Atools.pow",_) $ Free _ $ Free (str, _)) = str @@ -1130,7 +1130,7 @@ | get_potStr (Free (str, _)) = "---" (* keine Hochzahl --> kleinst gewichtet *) | get_potStr t = "||||||"; (* gross gewichtet; für Brüch ect. *) (*| get_potStr t = - error("get_potStr: called with t= "^(term2str t));*) + error("get_potStr: called with t= "^(Celem.term2str t));*) (* Umgekehrte string_ord *) val string_ord_rev = rev_order o string_ord; @@ -1189,7 +1189,7 @@ | (Const ("Atools.pow", _) $ Free (str_b, _) $ _ ) => counter (n + 1000, xs) (*FIXME.MG?!*) | (Free (str, _)) => counter (n + 1, xs) - (*| _ => error("monom_degree: called with factor: "^(term2str x)))*) + (*| _ => error("monom_degree: called with factor: "^(Celem.term2str x)))*) | _ => counter (n + 10000, xs)) (*FIXME.MG?! ... Brüche ect.*) in fun monom_degree l = counter (0, l) @@ -1309,49 +1309,49 @@ fun eval_is_multUnordered (thmid:string) _ (t as (Const("Poly.is'_multUnordered", _) $ arg)) thy = if is_multUnordered arg - then SOME (TermC.mk_thmid thmid (term_to_string''' thy arg) "", + then SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg) "", HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True}))) - else SOME (TermC.mk_thmid thmid (term_to_string''' thy arg) "", + else SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg) "", HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False}))) | eval_is_multUnordered _ _ _ _ = NONE; -fun attach_form (_:rule list list) (_:term) (_:term) = (*still missing*) - []:(rule * (term * term list)) list; -fun init_state (_:term) = e_rrlsstate; -fun locate_rule (_:rule list list) (_:term) (_:rule) = - ([]:(rule * (term * term list)) list); -fun next_rule (_:rule list list) (_:term) = (NONE:rule option); -fun normal_form t = SOME (sort_variables t,[]:term list); +fun attach_form (_: Celem.rule list list) (_: term) (_: term) = (*still missing*) + []:(Celem.rule * (term * term list)) list; +fun init_state (_: term) = Celem.e_rrlsstate; +fun locate_rule (_: Celem.rule list list) (_: term) (_: Celem.rule) = + ([]:(Celem.rule * (term * term list)) list); +fun next_rule (_: Celem.rule list list) (_: term) = (NONE: Celem.rule option); +fun normal_form t = SOME (sort_variables t, []: term list); val order_mult_ = - Rrls {id = "order_mult_", + Celem.Rrls {id = "order_mult_", prepat = (* ?p matched with the current term gives an environment, which evaluates (the instantiated) "?p is_multUnordered" to true *) [([TermC.parse_patt thy "?p is_multUnordered"], TermC.parse_patt thy "?p :: real")], - rew_ord = ("dummy_ord", dummy_ord), - erls = append_rls "e_rls-is_multUnordered" e_rls - [Calc ("Poly.is'_multUnordered", + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Celem.append_rls "Celem.e_rls-is_multUnordered" Celem.e_rls + [Celem.Calc ("Poly.is'_multUnordered", eval_is_multUnordered "")], calc = [("PLUS" , ("Groups.plus_class.plus", eval_binop "#add_")), ("TIMES" , ("Groups.times_class.times", eval_binop "#mult_")), ("DIVIDE", ("Rings.divide_class.divide", eval_cancel "#divide_e")), ("POWER" , ("Atools.pow", eval_binop "#power_"))], - errpatts = [], - scr=Rfuns {init_state = init_state, + errpatts = [], + scr = Celem.Rfuns {init_state = init_state, normal_form = normal_form, locate_rule = locate_rule, next_rule = next_rule, attach_form = attach_form}}; val order_mult_rls_ = - Rls{id = "order_mult_rls_", preconds = [], - rew_ord = ("dummy_ord", dummy_ord), - erls = e_rls,srls = Erls, + Celem.Rls {id = "order_mult_rls_", preconds = [], + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Celem.e_rls,srls = Celem.Erls, calc = [], errpatts = [], - rules = [Rls_ order_mult_ - ], scr = EmptyScr}:rls; + rules = [Celem.Rls_ order_mult_ + ], scr = Celem.EmptyScr}; *} ML {* @@ -1362,31 +1362,32 @@ fun eval_is_addUnordered (thmid:string) _ (t as (Const("Poly.is'_addUnordered", _) $ arg)) thy = if is_addUnordered arg - then SOME (TermC.mk_thmid thmid (term_to_string''' thy arg) "", + then SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg) "", HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True}))) - else SOME (TermC.mk_thmid thmid (term_to_string''' thy arg) "", + else SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg) "", HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False}))) | eval_is_addUnordered _ _ _ _ = NONE; -fun attach_form (_:rule list list) (_:term) (_:term) = (*still missing*) - []:(rule * (term * term list)) list; -fun init_state (_:term) = e_rrlsstate; -fun locate_rule (_:rule list list) (_:term) (_:rule) = - ([]:(rule * (term * term list)) list); -fun next_rule (_:rule list list) (_:term) = (NONE:rule option); -fun normal_form t = SOME (sort_monoms t,[]:term list); +fun attach_form (_: Celem.rule list list) (_: term) (_: term) = (*still missing*) + []: (Celem.rule * (term * term list)) list; +fun init_state (_: term) = Celem.e_rrlsstate; +fun locate_rule (_: Celem.rule list list) (_: term) (_: Celem.rule) = + ([]: (Celem.rule * (term * term list)) list); +fun next_rule (_: Celem.rule list list) (_: term) = (NONE: Celem.rule option); +fun normal_form t = SOME (sort_monoms t,[]: term list); +*} ML {* val order_add_ = - Rrls {id = "order_add_", + Celem.Rrls {id = "order_add_", prepat = (*WN.18.6.03 Preconditions und Pattern, - die beide passen muessen, damit das Rrls angewandt wird*) + die beide passen muessen, damit das Celem.Rrls angewandt wird*) [([TermC.parse_patt @{theory} "?p is_addUnordered"], TermC.parse_patt @{theory} "?p :: real" (*WN.18.6.03 also KEIN pattern, dieses erzeugt nur das Environment fuer die Evaluation der Precondition "p is_addUnordered"*))], - rew_ord = ("dummy_ord", dummy_ord), - erls = append_rls "e_rls-is_addUnordered" e_rls(*MG: poly_erls*) - [Calc ("Poly.is'_addUnordered", + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Celem.append_rls "Celem.e_rls-is_addUnordered" Celem.e_rls(*MG: poly_erls*) + [Celem.Calc ("Poly.is'_addUnordered", eval_is_addUnordered "")], calc = [("PLUS" ,("Groups.plus_class.plus", eval_binop "#add_")), ("TIMES" ,("Groups.times_class.times", eval_binop "#mult_")), @@ -1394,19 +1395,19 @@ eval_cancel "#divide_e")), ("POWER" ,("Atools.pow" ,eval_binop "#power_"))], errpatts = [], - scr=Rfuns {init_state = init_state, + scr = Celem.Rfuns {init_state = init_state, normal_form = normal_form, locate_rule = locate_rule, next_rule = next_rule, attach_form = attach_form}}; -val order_add_rls_ = - Rls{id = "order_add_rls_", preconds = [], - rew_ord = ("dummy_ord", dummy_ord), - erls = e_rls,srls = Erls, +val order_add_rls_ = + Celem.Rls {id = "order_add_rls_", preconds = [], + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Celem.e_rls,srls = Celem.Erls, calc = [], errpatts = [], - rules = [Rls_ order_add_ - ], scr = EmptyScr}:rls; + rules = [Celem.Rls_ order_add_ + ], scr = Celem.EmptyScr}; *} text {* rule-set make_polynomial also named norm_Poly: @@ -1421,134 +1422,134 @@ (*. see MG-DA.p.52ff .*) val make_polynomial(*MG.03, overwrites version from above, previously 'make_polynomial_'*) = - Seq {id = "make_polynomial", preconds = []:term list, - rew_ord = ("dummy_ord", dummy_ord), - erls = Atools_erls, srls = Erls,calc = [], errpatts = [], - rules = [Rls_ discard_minus, - Rls_ expand_poly_, - Calc ("Groups.times_class.times", eval_binop "#mult_"), - Rls_ order_mult_rls_, - Rls_ simplify_power_, - Rls_ calc_add_mult_pow_, - Rls_ reduce_012_mult_, - Rls_ order_add_rls_, - Rls_ collect_numerals_, - Rls_ reduce_012_, - Rls_ discard_parentheses1 + Celem.Seq {id = "make_polynomial", preconds = []:term list, + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Atools_erls, srls = Celem.Erls,calc = [], errpatts = [], + rules = [Celem.Rls_ discard_minus, + Celem.Rls_ expand_poly_, + Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"), + Celem.Rls_ order_mult_rls_, + Celem.Rls_ simplify_power_, + Celem.Rls_ calc_add_mult_pow_, + Celem.Rls_ reduce_012_mult_, + Celem.Rls_ order_add_rls_, + Celem.Rls_ collect_numerals_, + Celem.Rls_ reduce_012_, + Celem.Rls_ discard_parentheses1 ], - scr = EmptyScr - }:rls; + scr = Celem.EmptyScr + }; *} ML {* val norm_Poly(*=make_polynomial*) = - Seq {id = "norm_Poly", preconds = []:term list, - rew_ord = ("dummy_ord", dummy_ord), - erls = Atools_erls, srls = Erls, calc = [], errpatts = [], - rules = [Rls_ discard_minus, - Rls_ expand_poly_, - Calc ("Groups.times_class.times", eval_binop "#mult_"), - Rls_ order_mult_rls_, - Rls_ simplify_power_, - Rls_ calc_add_mult_pow_, - Rls_ reduce_012_mult_, - Rls_ order_add_rls_, - Rls_ collect_numerals_, - Rls_ reduce_012_, - Rls_ discard_parentheses1 + Celem.Seq {id = "norm_Poly", preconds = []:term list, + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Atools_erls, srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Rls_ discard_minus, + Celem.Rls_ expand_poly_, + Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"), + Celem.Rls_ order_mult_rls_, + Celem.Rls_ simplify_power_, + Celem.Rls_ calc_add_mult_pow_, + Celem.Rls_ reduce_012_mult_, + Celem.Rls_ order_add_rls_, + Celem.Rls_ collect_numerals_, + Celem.Rls_ reduce_012_, + Celem.Rls_ discard_parentheses1 ], - scr = EmptyScr - }:rls; + scr = Celem.EmptyScr + }; *} ML {* -(* MG:03 Like make_polynomial_ but without Rls_ discard_parentheses1 +(* MG:03 Like make_polynomial_ but without Celem.Rls_ discard_parentheses1 and expand_poly_rat_ instead of expand_poly_, see MG-DA.p.56ff*) (* MG necessary for termination of norm_Rational(*_mg*) in Rational.ML*) val make_rat_poly_with_parentheses = - Seq{id = "make_rat_poly_with_parentheses", preconds = []:term list, - rew_ord = ("dummy_ord", dummy_ord), - erls = Atools_erls, srls = Erls, calc = [], errpatts = [], - rules = [Rls_ discard_minus, - Rls_ expand_poly_rat_,(*ignors rationals*) - Calc ("Groups.times_class.times", eval_binop "#mult_"), - Rls_ order_mult_rls_, - Rls_ simplify_power_, - Rls_ calc_add_mult_pow_, - Rls_ reduce_012_mult_, - Rls_ order_add_rls_, - Rls_ collect_numerals_, - Rls_ reduce_012_ - (*Rls_ discard_parentheses1 *) + Celem.Seq{id = "make_rat_poly_with_parentheses", preconds = []:term list, + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Atools_erls, srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Rls_ discard_minus, + Celem.Rls_ expand_poly_rat_,(*ignors rationals*) + Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"), + Celem.Rls_ order_mult_rls_, + Celem.Rls_ simplify_power_, + Celem.Rls_ calc_add_mult_pow_, + Celem.Rls_ reduce_012_mult_, + Celem.Rls_ order_add_rls_, + Celem.Rls_ collect_numerals_, + Celem.Rls_ reduce_012_ + (*Celem.Rls_ discard_parentheses1 *) ], - scr = EmptyScr - }:rls; + scr = Celem.EmptyScr + }; *} ML {* (*.a minimal ruleset for reverse rewriting of factions [2]; compare expand_binoms.*) val rev_rew_p = -Seq{id = "rev_rew_p", preconds = [], rew_ord = ("termlessI",termlessI), - erls = Atools_erls, srls = Erls, +Celem.Seq{id = "rev_rew_p", preconds = [], rew_ord = ("termlessI",termlessI), + erls = Atools_erls, srls = Celem.Erls, calc = [(*("PLUS" , ("Groups.plus_class.plus", eval_binop "#add_")), ("TIMES" , ("Groups.times_class.times", eval_binop "#mult_")), ("POWER", ("Atools.pow", eval_binop "#power_"))*) ], errpatts = [], - rules = [Thm ("real_plus_binom_times" ,TermC.num_str @{thm real_plus_binom_times}), + rules = [Celem.Thm ("real_plus_binom_times" ,TermC.num_str @{thm real_plus_binom_times}), (*"(a + b)*(a + b) = a ^ 2 + 2 * a * b + b ^ 2*) - Thm ("real_plus_binom_times1" ,TermC.num_str @{thm real_plus_binom_times1}), + Celem.Thm ("real_plus_binom_times1" ,TermC.num_str @{thm real_plus_binom_times1}), (*"(a + 1*b)*(a + -1*b) = a^^^2 + -1*b^^^2"*) - Thm ("real_plus_binom_times2" ,TermC.num_str @{thm real_plus_binom_times2}), + Celem.Thm ("real_plus_binom_times2" ,TermC.num_str @{thm real_plus_binom_times2}), (*"(a + -1*b)*(a + 1*b) = a^^^2 + -1*b^^^2"*) - Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),(*"1 * z = z"*) + Celem.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),(*"1 * z = z"*) - Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}), + Celem.Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}), (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*) - Thm ("distrib_left",TermC.num_str @{thm distrib_left}), + Celem.Thm ("distrib_left",TermC.num_str @{thm distrib_left}), (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*) - Thm ("mult_assoc", TermC.num_str @{thm mult.assoc}), + Celem.Thm ("mult_assoc", TermC.num_str @{thm mult.assoc}), (*"?z1.1 * ?z2.1 * ?z3. =1 ?z1.1 * (?z2.1 * ?z3.1)"*) - Rls_ order_mult_rls_, - (*Rls_ order_add_rls_,*) + Celem.Rls_ order_mult_rls_, + (*Celem.Rls_ order_add_rls_,*) - Calc ("Groups.plus_class.plus", eval_binop "#add_"), - Calc ("Groups.times_class.times", eval_binop "#mult_"), - Calc ("Atools.pow", eval_binop "#power_"), + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"), + Celem.Calc ("Atools.pow", eval_binop "#power_"), - Thm ("sym_realpow_twoI", + Celem.Thm ("sym_realpow_twoI", TermC.num_str (@{thm realpow_twoI} RS @{thm sym})), (*"r1 * r1 = r1 ^^^ 2"*) - Thm ("sym_real_mult_2", + Celem.Thm ("sym_real_mult_2", TermC.num_str (@{thm real_mult_2} RS @{thm sym})), (*"z1 + z1 = 2 * z1"*) - Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}), + Celem.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}), (*"z1 + (z1 + k) = 2 * z1 + k"*) - Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), + Celem.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*) - Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}), + Celem.Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}), (*"[| l is_const; m is_const |] ==> l * n + (m * n + k) = (l + m) * n + k"*) - Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}), + Celem.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}), (*"m is_const ==> n + m * n = (1 + m) * n"*) - Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), + Celem.Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*) - Thm ("realpow_multI", TermC.num_str @{thm realpow_multI}), + Celem.Thm ("realpow_multI", TermC.num_str @{thm realpow_multI}), (*"(r * s) ^^^ n = r ^^^ n * s ^^^ n"*) - Calc ("Groups.plus_class.plus", eval_binop "#add_"), - Calc ("Groups.times_class.times", eval_binop "#mult_"), - Calc ("Atools.pow", eval_binop "#power_"), + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"), + Celem.Calc ("Atools.pow", eval_binop "#power_"), - Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),(*"1 * z = z"*) - Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),(*"0 * z = 0"*) - Thm ("add_0_left",TermC.num_str @{thm add_0_left})(*0 + z = z*) + Celem.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),(*"1 * z = z"*) + Celem.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),(*"0 * z = 0"*) + Celem.Thm ("add_0_left",TermC.num_str @{thm add_0_left})(*0 + z = z*) - (*Rls_ order_add_rls_*) + (*Celem.Rls_ order_add_rls_*) ], - scr = EmptyScr}:rls; + scr = Celem.EmptyScr}; *} ML {* val prep_rls' = LTool.prep_rls @{theory} *} @@ -1595,27 +1596,27 @@ (** problems **) setup {* KEStore_Elems.add_pbts - [(Specify.prep_pbt thy "pbl_simp_poly" [] e_pblID + [(Specify.prep_pbt thy "pbl_simp_poly" [] Celem.e_pblID (["polynomial","simplification"], [("#Given" ,["Term t_t"]), ("#Where" ,["t_t is_polyexp"]), ("#Find" ,["normalform n_n"])], - append_rls "e_rls" e_rls [(*for preds in where_*) - Calc ("Poly.is'_polyexp", eval_is_polyexp "")], + Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*) + Celem.Calc ("Poly.is'_polyexp", eval_is_polyexp "")], SOME "Simplify t_t", [["simplification","for_polynomials"]]))] *} (** methods **) setup {* KEStore_Elems.add_mets - [Specify.prep_met thy "met_simp_poly" [] e_metID + [Specify.prep_met thy "met_simp_poly" [] Celem.e_metID (["simplification","for_polynomials"], [("#Given" ,["Term t_t"]), ("#Where" ,["t_t is_polyexp"]), ("#Find" ,["normalform n_n"])], - {rew_ord'="tless_true", rls' = e_rls, calc = [], srls = e_rls, - prls = append_rls "simplification_for_polynomials_prls" e_rls + {rew_ord'="tless_true", rls' = Celem.e_rls, calc = [], srls = Celem.e_rls, + prls = Celem.append_rls "simplification_for_polynomials_prls" Celem.e_rls [(*for preds in where_*) - Calc ("Poly.is'_polyexp",eval_is_polyexp"")], - crls = e_rls, errpats = [], nrls = norm_Poly}, + Celem.Calc ("Poly.is'_polyexp",eval_is_polyexp"")], + crls = Celem.e_rls, errpats = [], nrls = norm_Poly}, "Script SimplifyScript (t_t::real) = " ^ " ((Rewrite_Set norm_Poly False) t_t)")] *} diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/PolyEq.thy --- a/src/Tools/isac/Knowledge/PolyEq.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/PolyEq.thy Thu Mar 15 12:42:04 2018 +0100 @@ -376,107 +376,107 @@ (*-------------------------rulse-------------------------*) val PolyEq_prls = (*3.10.02:just the following order due to subterm evaluation*) - append_rls "PolyEq_prls" e_rls - [Calc ("Atools.ident",eval_ident "#ident_"), - Calc ("Tools.matches",eval_matches ""), - Calc ("Tools.lhs" ,eval_lhs ""), - Calc ("Tools.rhs" ,eval_rhs ""), - Calc ("Poly.is'_expanded'_in",eval_is_expanded_in ""), - Calc ("Poly.is'_poly'_in",eval_is_poly_in ""), - Calc ("Poly.has'_degree'_in",eval_has_degree_in ""), - Calc ("Poly.is'_polyrat'_in",eval_is_polyrat_in ""), - (*Calc ("Atools.occurs'_in",eval_occurs_in ""), *) - (*Calc ("Atools.is'_const",eval_const "#is_const_"),*) - Calc ("HOL.eq",eval_equal "#equal_"), - Calc ("RootEq.is'_rootTerm'_in",eval_is_rootTerm_in ""), - Calc ("RatEq.is'_ratequation'_in",eval_is_ratequation_in ""), - Thm ("not_true",TermC.num_str @{thm not_true}), - Thm ("not_false",TermC.num_str @{thm not_false}), - Thm ("and_true",TermC.num_str @{thm and_true}), - Thm ("and_false",TermC.num_str @{thm and_false}), - Thm ("or_true",TermC.num_str @{thm or_true}), - Thm ("or_false",TermC.num_str @{thm or_false}) + Celem.append_rls "PolyEq_prls" Celem.e_rls + [Celem.Calc ("Atools.ident",eval_ident "#ident_"), + Celem.Calc ("Tools.matches",eval_matches ""), + Celem.Calc ("Tools.lhs" ,eval_lhs ""), + Celem.Calc ("Tools.rhs" ,eval_rhs ""), + Celem.Calc ("Poly.is'_expanded'_in",eval_is_expanded_in ""), + Celem.Calc ("Poly.is'_poly'_in",eval_is_poly_in ""), + Celem.Calc ("Poly.has'_degree'_in",eval_has_degree_in ""), + Celem.Calc ("Poly.is'_polyrat'_in",eval_is_polyrat_in ""), + (*Celem.Calc ("Atools.occurs'_in",eval_occurs_in ""), *) + (*Celem.Calc ("Atools.is'_const",eval_const "#is_const_"),*) + Celem.Calc ("HOL.eq",eval_equal "#equal_"), + Celem.Calc ("RootEq.is'_rootTerm'_in",eval_is_rootTerm_in ""), + Celem.Calc ("RatEq.is'_ratequation'_in",eval_is_ratequation_in ""), + Celem.Thm ("not_true",TermC.num_str @{thm not_true}), + Celem.Thm ("not_false",TermC.num_str @{thm not_false}), + Celem.Thm ("and_true",TermC.num_str @{thm and_true}), + Celem.Thm ("and_false",TermC.num_str @{thm and_false}), + Celem.Thm ("or_true",TermC.num_str @{thm or_true}), + Celem.Thm ("or_false",TermC.num_str @{thm or_false}) ]; val PolyEq_erls = - merge_rls "PolyEq_erls" LinEq_erls - (append_rls "ops_preds" calculate_Rational - [Calc ("HOL.eq",eval_equal "#equal_"), - Thm ("plus_leq", TermC.num_str @{thm plus_leq}), - Thm ("minus_leq", TermC.num_str @{thm minus_leq}), - Thm ("rat_leq1", TermC.num_str @{thm rat_leq1}), - Thm ("rat_leq2", TermC.num_str @{thm rat_leq2}), - Thm ("rat_leq3", TermC.num_str @{thm rat_leq3}) + Celem.merge_rls "PolyEq_erls" LinEq_erls + (Celem.append_rls "ops_preds" calculate_Rational + [Celem.Calc ("HOL.eq",eval_equal "#equal_"), + Celem.Thm ("plus_leq", TermC.num_str @{thm plus_leq}), + Celem.Thm ("minus_leq", TermC.num_str @{thm minus_leq}), + Celem.Thm ("rat_leq1", TermC.num_str @{thm rat_leq1}), + Celem.Thm ("rat_leq2", TermC.num_str @{thm rat_leq2}), + Celem.Thm ("rat_leq3", TermC.num_str @{thm rat_leq3}) ]); val PolyEq_crls = - merge_rls "PolyEq_crls" LinEq_crls - (append_rls "ops_preds" calculate_Rational - [Calc ("HOL.eq",eval_equal "#equal_"), - Thm ("plus_leq", TermC.num_str @{thm plus_leq}), - Thm ("minus_leq", TermC.num_str @{thm minus_leq}), - Thm ("rat_leq1", TermC.num_str @{thm rat_leq1}), - Thm ("rat_leq2", TermC.num_str @{thm rat_leq2}), - Thm ("rat_leq3", TermC.num_str @{thm rat_leq3}) + Celem.merge_rls "PolyEq_crls" LinEq_crls + (Celem.append_rls "ops_preds" calculate_Rational + [Celem.Calc ("HOL.eq",eval_equal "#equal_"), + Celem.Thm ("plus_leq", TermC.num_str @{thm plus_leq}), + Celem.Thm ("minus_leq", TermC.num_str @{thm minus_leq}), + Celem.Thm ("rat_leq1", TermC.num_str @{thm rat_leq1}), + Celem.Thm ("rat_leq2", TermC.num_str @{thm rat_leq2}), + Celem.Thm ("rat_leq3", TermC.num_str @{thm rat_leq3}) ]); val cancel_leading_coeff = prep_rls'( - Rls {id = "cancel_leading_coeff", preconds = [], - rew_ord = ("e_rew_ord",e_rew_ord), - erls = PolyEq_erls, srls = Erls, calc = [], errpatts = [], + Celem.Rls {id = "cancel_leading_coeff", preconds = [], + rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord), + erls = PolyEq_erls, srls = Celem.Erls, calc = [], errpatts = [], rules = - [Thm ("cancel_leading_coeff1",TermC.num_str @{thm cancel_leading_coeff1}), - Thm ("cancel_leading_coeff2",TermC.num_str @{thm cancel_leading_coeff2}), - Thm ("cancel_leading_coeff3",TermC.num_str @{thm cancel_leading_coeff3}), - Thm ("cancel_leading_coeff4",TermC.num_str @{thm cancel_leading_coeff4}), - Thm ("cancel_leading_coeff5",TermC.num_str @{thm cancel_leading_coeff5}), - Thm ("cancel_leading_coeff6",TermC.num_str @{thm cancel_leading_coeff6}), - Thm ("cancel_leading_coeff7",TermC.num_str @{thm cancel_leading_coeff7}), - Thm ("cancel_leading_coeff8",TermC.num_str @{thm cancel_leading_coeff8}), - Thm ("cancel_leading_coeff9",TermC.num_str @{thm cancel_leading_coeff9}), - Thm ("cancel_leading_coeff10",TermC.num_str @{thm cancel_leading_coeff10}), - Thm ("cancel_leading_coeff11",TermC.num_str @{thm cancel_leading_coeff11}), - Thm ("cancel_leading_coeff12",TermC.num_str @{thm cancel_leading_coeff12}), - Thm ("cancel_leading_coeff13",TermC.num_str @{thm cancel_leading_coeff13}) - ],scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")}:rls); + [Celem.Thm ("cancel_leading_coeff1",TermC.num_str @{thm cancel_leading_coeff1}), + Celem.Thm ("cancel_leading_coeff2",TermC.num_str @{thm cancel_leading_coeff2}), + Celem.Thm ("cancel_leading_coeff3",TermC.num_str @{thm cancel_leading_coeff3}), + Celem.Thm ("cancel_leading_coeff4",TermC.num_str @{thm cancel_leading_coeff4}), + Celem.Thm ("cancel_leading_coeff5",TermC.num_str @{thm cancel_leading_coeff5}), + Celem.Thm ("cancel_leading_coeff6",TermC.num_str @{thm cancel_leading_coeff6}), + Celem.Thm ("cancel_leading_coeff7",TermC.num_str @{thm cancel_leading_coeff7}), + Celem.Thm ("cancel_leading_coeff8",TermC.num_str @{thm cancel_leading_coeff8}), + Celem.Thm ("cancel_leading_coeff9",TermC.num_str @{thm cancel_leading_coeff9}), + Celem.Thm ("cancel_leading_coeff10",TermC.num_str @{thm cancel_leading_coeff10}), + Celem.Thm ("cancel_leading_coeff11",TermC.num_str @{thm cancel_leading_coeff11}), + Celem.Thm ("cancel_leading_coeff12",TermC.num_str @{thm cancel_leading_coeff12}), + Celem.Thm ("cancel_leading_coeff13",TermC.num_str @{thm cancel_leading_coeff13}) + ],scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")}); val prep_rls' = LTool.prep_rls @{theory}; *} ML{* val complete_square = prep_rls'( - Rls {id = "complete_square", preconds = [], - rew_ord = ("e_rew_ord",e_rew_ord), - erls = PolyEq_erls, srls = Erls, calc = [], errpatts = [], - rules = [Thm ("complete_square1",TermC.num_str @{thm complete_square1}), - Thm ("complete_square2",TermC.num_str @{thm complete_square2}), - Thm ("complete_square3",TermC.num_str @{thm complete_square3}), - Thm ("complete_square4",TermC.num_str @{thm complete_square4}), - Thm ("complete_square5",TermC.num_str @{thm complete_square5}) + Celem.Rls {id = "complete_square", preconds = [], + rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord), + erls = PolyEq_erls, srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Thm ("complete_square1",TermC.num_str @{thm complete_square1}), + Celem.Thm ("complete_square2",TermC.num_str @{thm complete_square2}), + Celem.Thm ("complete_square3",TermC.num_str @{thm complete_square3}), + Celem.Thm ("complete_square4",TermC.num_str @{thm complete_square4}), + Celem.Thm ("complete_square5",TermC.num_str @{thm complete_square5}) ], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls); + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }); val polyeq_simplify = prep_rls'( - Rls {id = "polyeq_simplify", preconds = [], + Celem.Rls {id = "polyeq_simplify", preconds = [], rew_ord = ("termlessI",termlessI), erls = PolyEq_erls, - srls = Erls, + srls = Celem.Erls, calc = [], errpatts = [], - rules = [Thm ("real_assoc_1",TermC.num_str @{thm real_assoc_1}), - Thm ("real_assoc_2",TermC.num_str @{thm real_assoc_2}), - Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}), - Thm ("real_unari_minus",TermC.num_str @{thm real_unari_minus}), - Thm ("realpow_multI",TermC.num_str @{thm realpow_multI}), - Calc ("Groups.plus_class.plus",eval_binop "#add_"), - Calc ("Groups.minus_class.minus",eval_binop "#sub_"), - Calc ("Groups.times_class.times",eval_binop "#mult_"), - Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"), - Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"), - Calc ("Atools.pow" ,eval_binop "#power_"), - Rls_ reduce_012 + rules = [Celem.Thm ("real_assoc_1",TermC.num_str @{thm real_assoc_1}), + Celem.Thm ("real_assoc_2",TermC.num_str @{thm real_assoc_2}), + Celem.Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}), + Celem.Thm ("real_unari_minus",TermC.num_str @{thm real_unari_minus}), + Celem.Thm ("realpow_multI",TermC.num_str @{thm realpow_multI}), + Celem.Calc ("Groups.plus_class.plus",eval_binop "#add_"), + Celem.Calc ("Groups.minus_class.minus",eval_binop "#sub_"), + Celem.Calc ("Groups.times_class.times",eval_binop "#mult_"), + Celem.Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"), + Celem.Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"), + Celem.Calc ("Atools.pow" ,eval_binop "#power_"), + Celem.Rls_ reduce_012 ], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls); + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }); *} setup {* KEStore_Elems.add_rlss [("cancel_leading_coeff", (Context.theory_name @{theory}, cancel_leading_coeff)), @@ -489,35 +489,35 @@ (* -- d0 -- *) (*isolate the bound variable in an d0 equation; 'bdv' is a meta-constant*) val d0_polyeq_simplify = prep_rls'( - Rls {id = "d0_polyeq_simplify", preconds = [], - rew_ord = ("e_rew_ord",e_rew_ord), + Celem.Rls {id = "d0_polyeq_simplify", preconds = [], + rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord), erls = PolyEq_erls, - srls = Erls, + srls = Celem.Erls, calc = [], errpatts = [], - rules = [Thm("d0_true",TermC.num_str @{thm d0_true}), - Thm("d0_false",TermC.num_str @{thm d0_false}) + rules = [Celem.Thm("d0_true",TermC.num_str @{thm d0_true}), + Celem.Thm("d0_false",TermC.num_str @{thm d0_false}) ], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls); + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }); (* -- d1 -- *) (*isolate the bound variable in an d1 equation; 'bdv' is a meta-constant*) val d1_polyeq_simplify = prep_rls'( - Rls {id = "d1_polyeq_simplify", preconds = [], - rew_ord = ("e_rew_ord",e_rew_ord), + Celem.Rls {id = "d1_polyeq_simplify", preconds = [], + rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord), erls = PolyEq_erls, - srls = Erls, + srls = Celem.Erls, calc = [], errpatts = [], rules = [ - Thm("d1_isolate_add1",TermC.num_str @{thm d1_isolate_add1}), + Celem.Thm("d1_isolate_add1",TermC.num_str @{thm d1_isolate_add1}), (* a+bx=0 -> bx=-a *) - Thm("d1_isolate_add2",TermC.num_str @{thm d1_isolate_add2}), + Celem.Thm("d1_isolate_add2",TermC.num_str @{thm d1_isolate_add2}), (* a+ x=0 -> x=-a *) - Thm("d1_isolate_div",TermC.num_str @{thm d1_isolate_div}) + Celem.Thm("d1_isolate_div",TermC.num_str @{thm d1_isolate_div}) (* bx=c -> x=c/b *) ], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls); + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }); *} subsection {* degree 2 *} @@ -525,290 +525,290 @@ (* isolate the bound variable in an d2 equation with bdv only; "bdv" is a meta-constant substituted for the "x" below by isac's rewriter. *) val d2_polyeq_bdv_only_simplify = prep_rls'( - Rls {id = "d2_polyeq_bdv_only_simplify", preconds = [], rew_ord = ("e_rew_ord",e_rew_ord), - erls = PolyEq_erls, srls = Erls, calc = [], errpatts = [], + Celem.Rls {id = "d2_polyeq_bdv_only_simplify", preconds = [], rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord), + erls = PolyEq_erls, srls = Celem.Erls, calc = [], errpatts = [], rules = - [Thm ("d2_prescind1", TermC.num_str @{thm d2_prescind1}), (* ax+bx^2=0 -> x(a+bx)=0 *) - Thm ("d2_prescind2", TermC.num_str @{thm d2_prescind2}), (* ax+ x^2=0 -> x(a+ x)=0 *) - Thm ("d2_prescind3", TermC.num_str @{thm d2_prescind3}), (* x+bx^2=0 -> x(1+bx)=0 *) - Thm ("d2_prescind4", TermC.num_str @{thm d2_prescind4}), (* x+ x^2=0 -> x(1+ x)=0 *) - Thm ("d2_sqrt_equation1", TermC.num_str @{thm d2_sqrt_equation1}), (* x^2=c -> x=+-sqrt(c) *) - Thm ("d2_sqrt_equation1_neg", TermC.num_str @{thm d2_sqrt_equation1_neg}), (* [0 []*) - Thm ("d2_sqrt_equation2", TermC.num_str @{thm d2_sqrt_equation2}), (* x^2=0 -> x=0 *) - Thm ("d2_reduce_equation1", TermC.num_str @{thm d2_reduce_equation1}),(* x(a+bx)=0 -> x=0 |a+bx=0*) - Thm ("d2_reduce_equation2", TermC.num_str @{thm d2_reduce_equation2}),(* x(a+ x)=0 -> x=0 |a+ x=0*) - Thm ("d2_isolate_div", TermC.num_str @{thm d2_isolate_div}) (* bx^2=c -> x^2=c/b *) + [Celem.Thm ("d2_prescind1", TermC.num_str @{thm d2_prescind1}), (* ax+bx^2=0 -> x(a+bx)=0 *) + Celem.Thm ("d2_prescind2", TermC.num_str @{thm d2_prescind2}), (* ax+ x^2=0 -> x(a+ x)=0 *) + Celem.Thm ("d2_prescind3", TermC.num_str @{thm d2_prescind3}), (* x+bx^2=0 -> x(1+bx)=0 *) + Celem.Thm ("d2_prescind4", TermC.num_str @{thm d2_prescind4}), (* x+ x^2=0 -> x(1+ x)=0 *) + Celem.Thm ("d2_sqrt_equation1", TermC.num_str @{thm d2_sqrt_equation1}), (* x^2=c -> x=+-sqrt(c) *) + Celem.Thm ("d2_sqrt_equation1_neg", TermC.num_str @{thm d2_sqrt_equation1_neg}), (* [0 []*) + Celem.Thm ("d2_sqrt_equation2", TermC.num_str @{thm d2_sqrt_equation2}), (* x^2=0 -> x=0 *) + Celem.Thm ("d2_reduce_equation1", TermC.num_str @{thm d2_reduce_equation1}),(* x(a+bx)=0 -> x=0 |a+bx=0*) + Celem.Thm ("d2_reduce_equation2", TermC.num_str @{thm d2_reduce_equation2}),(* x(a+ x)=0 -> x=0 |a+ x=0*) + Celem.Thm ("d2_isolate_div", TermC.num_str @{thm d2_isolate_div}) (* bx^2=c -> x^2=c/b *) ], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls); + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }); *} ML{* (* isolate the bound variable in an d2 equation with sqrt only; 'bdv' is a meta-constant*) val d2_polyeq_sq_only_simplify = prep_rls'( - Rls {id = "d2_polyeq_sq_only_simplify", preconds = [], - rew_ord = ("e_rew_ord",e_rew_ord), + Celem.Rls {id = "d2_polyeq_sq_only_simplify", preconds = [], + rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord), erls = PolyEq_erls, - srls = Erls, + srls = Celem.Erls, calc = [], errpatts = [], (*asm_thm = [("d2_sqrt_equation1",""),("d2_sqrt_equation1_neg",""), ("d2_isolate_div","")],*) - rules = [Thm("d2_isolate_add1",TermC.num_str @{thm d2_isolate_add1}), + rules = [Celem.Thm("d2_isolate_add1",TermC.num_str @{thm d2_isolate_add1}), (* a+ bx^2=0 -> bx^2=(-1)a*) - Thm("d2_isolate_add2",TermC.num_str @{thm d2_isolate_add2}), + Celem.Thm("d2_isolate_add2",TermC.num_str @{thm d2_isolate_add2}), (* a+ x^2=0 -> x^2=(-1)a*) - Thm("d2_sqrt_equation2",TermC.num_str @{thm d2_sqrt_equation2}), + Celem.Thm("d2_sqrt_equation2",TermC.num_str @{thm d2_sqrt_equation2}), (* x^2=0 -> x=0 *) - Thm("d2_sqrt_equation1",TermC.num_str @{thm d2_sqrt_equation1}), + Celem.Thm("d2_sqrt_equation1",TermC.num_str @{thm d2_sqrt_equation1}), (* x^2=c -> x=+-sqrt(c)*) - Thm("d2_sqrt_equation1_neg",TermC.num_str @{thm d2_sqrt_equation1_neg}), + Celem.Thm("d2_sqrt_equation1_neg",TermC.num_str @{thm d2_sqrt_equation1_neg}), (* [c<0] x^2=c -> x=[] *) - Thm("d2_isolate_div",TermC.num_str @{thm d2_isolate_div}) + Celem.Thm("d2_isolate_div",TermC.num_str @{thm d2_isolate_div}) (* bx^2=c -> x^2=c/b*) ], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls); + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }); *} ML{* (* isolate the bound variable in an d2 equation with pqFormula; 'bdv' is a meta-constant*) val d2_polyeq_pqFormula_simplify = prep_rls'( - Rls {id = "d2_polyeq_pqFormula_simplify", preconds = [], - rew_ord = ("e_rew_ord",e_rew_ord), erls = PolyEq_erls, - srls = Erls, calc = [], errpatts = [], - rules = [Thm("d2_pqformula1",TermC.num_str @{thm d2_pqformula1}), + Celem.Rls {id = "d2_polyeq_pqFormula_simplify", preconds = [], + rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord), erls = PolyEq_erls, + srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Thm("d2_pqformula1",TermC.num_str @{thm d2_pqformula1}), (* q+px+ x^2=0 *) - Thm("d2_pqformula1_neg",TermC.num_str @{thm d2_pqformula1_neg}), + Celem.Thm("d2_pqformula1_neg",TermC.num_str @{thm d2_pqformula1_neg}), (* q+px+ x^2=0 *) - Thm("d2_pqformula2",TermC.num_str @{thm d2_pqformula2}), + Celem.Thm("d2_pqformula2",TermC.num_str @{thm d2_pqformula2}), (* q+px+1x^2=0 *) - Thm("d2_pqformula2_neg",TermC.num_str @{thm d2_pqformula2_neg}), + Celem.Thm("d2_pqformula2_neg",TermC.num_str @{thm d2_pqformula2_neg}), (* q+px+1x^2=0 *) - Thm("d2_pqformula3",TermC.num_str @{thm d2_pqformula3}), + Celem.Thm("d2_pqformula3",TermC.num_str @{thm d2_pqformula3}), (* q+ x+ x^2=0 *) - Thm("d2_pqformula3_neg",TermC.num_str @{thm d2_pqformula3_neg}), + Celem.Thm("d2_pqformula3_neg",TermC.num_str @{thm d2_pqformula3_neg}), (* q+ x+ x^2=0 *) - Thm("d2_pqformula4",TermC.num_str @{thm d2_pqformula4}), + Celem.Thm("d2_pqformula4",TermC.num_str @{thm d2_pqformula4}), (* q+ x+1x^2=0 *) - Thm("d2_pqformula4_neg",TermC.num_str @{thm d2_pqformula4_neg}), + Celem.Thm("d2_pqformula4_neg",TermC.num_str @{thm d2_pqformula4_neg}), (* q+ x+1x^2=0 *) - Thm("d2_pqformula5",TermC.num_str @{thm d2_pqformula5}), + Celem.Thm("d2_pqformula5",TermC.num_str @{thm d2_pqformula5}), (* qx+ x^2=0 *) - Thm("d2_pqformula6",TermC.num_str @{thm d2_pqformula6}), + Celem.Thm("d2_pqformula6",TermC.num_str @{thm d2_pqformula6}), (* qx+1x^2=0 *) - Thm("d2_pqformula7",TermC.num_str @{thm d2_pqformula7}), + Celem.Thm("d2_pqformula7",TermC.num_str @{thm d2_pqformula7}), (* x+ x^2=0 *) - Thm("d2_pqformula8",TermC.num_str @{thm d2_pqformula8}), + Celem.Thm("d2_pqformula8",TermC.num_str @{thm d2_pqformula8}), (* x+1x^2=0 *) - Thm("d2_pqformula9",TermC.num_str @{thm d2_pqformula9}), + Celem.Thm("d2_pqformula9",TermC.num_str @{thm d2_pqformula9}), (* q +1x^2=0 *) - Thm("d2_pqformula9_neg",TermC.num_str @{thm d2_pqformula9_neg}), + Celem.Thm("d2_pqformula9_neg",TermC.num_str @{thm d2_pqformula9_neg}), (* q +1x^2=0 *) - Thm("d2_pqformula10",TermC.num_str @{thm d2_pqformula10}), + Celem.Thm("d2_pqformula10",TermC.num_str @{thm d2_pqformula10}), (* q + x^2=0 *) - Thm("d2_pqformula10_neg",TermC.num_str @{thm d2_pqformula10_neg}), + Celem.Thm("d2_pqformula10_neg",TermC.num_str @{thm d2_pqformula10_neg}), (* q + x^2=0 *) - Thm("d2_sqrt_equation2",TermC.num_str @{thm d2_sqrt_equation2}), + Celem.Thm("d2_sqrt_equation2",TermC.num_str @{thm d2_sqrt_equation2}), (* x^2=0 *) - Thm("d2_sqrt_equation3",TermC.num_str @{thm d2_sqrt_equation3}) + Celem.Thm("d2_sqrt_equation3",TermC.num_str @{thm d2_sqrt_equation3}) (* 1x^2=0 *) - ],scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls); + ],scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }); *} ML{* (* isolate the bound variable in an d2 equation with abcFormula; 'bdv' is a meta-constant*) val d2_polyeq_abcFormula_simplify = prep_rls'( - Rls {id = "d2_polyeq_abcFormula_simplify", preconds = [], - rew_ord = ("e_rew_ord",e_rew_ord), erls = PolyEq_erls, - srls = Erls, calc = [], errpatts = [], - rules = [Thm("d2_abcformula1",TermC.num_str @{thm d2_abcformula1}), + Celem.Rls {id = "d2_polyeq_abcFormula_simplify", preconds = [], + rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord), erls = PolyEq_erls, + srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Thm("d2_abcformula1",TermC.num_str @{thm d2_abcformula1}), (*c+bx+cx^2=0 *) - Thm("d2_abcformula1_neg",TermC.num_str @{thm d2_abcformula1_neg}), + Celem.Thm("d2_abcformula1_neg",TermC.num_str @{thm d2_abcformula1_neg}), (*c+bx+cx^2=0 *) - Thm("d2_abcformula2",TermC.num_str @{thm d2_abcformula2}), + Celem.Thm("d2_abcformula2",TermC.num_str @{thm d2_abcformula2}), (*c+ x+cx^2=0 *) - Thm("d2_abcformula2_neg",TermC.num_str @{thm d2_abcformula2_neg}), + Celem.Thm("d2_abcformula2_neg",TermC.num_str @{thm d2_abcformula2_neg}), (*c+ x+cx^2=0 *) - Thm("d2_abcformula3",TermC.num_str @{thm d2_abcformula3}), + Celem.Thm("d2_abcformula3",TermC.num_str @{thm d2_abcformula3}), (*c+bx+ x^2=0 *) - Thm("d2_abcformula3_neg",TermC.num_str @{thm d2_abcformula3_neg}), + Celem.Thm("d2_abcformula3_neg",TermC.num_str @{thm d2_abcformula3_neg}), (*c+bx+ x^2=0 *) - Thm("d2_abcformula4",TermC.num_str @{thm d2_abcformula4}), + Celem.Thm("d2_abcformula4",TermC.num_str @{thm d2_abcformula4}), (*c+ x+ x^2=0 *) - Thm("d2_abcformula4_neg",TermC.num_str @{thm d2_abcformula4_neg}), + Celem.Thm("d2_abcformula4_neg",TermC.num_str @{thm d2_abcformula4_neg}), (*c+ x+ x^2=0 *) - Thm("d2_abcformula5",TermC.num_str @{thm d2_abcformula5}), + Celem.Thm("d2_abcformula5",TermC.num_str @{thm d2_abcformula5}), (*c+ cx^2=0 *) - Thm("d2_abcformula5_neg",TermC.num_str @{thm d2_abcformula5_neg}), + Celem.Thm("d2_abcformula5_neg",TermC.num_str @{thm d2_abcformula5_neg}), (*c+ cx^2=0 *) - Thm("d2_abcformula6",TermC.num_str @{thm d2_abcformula6}), + Celem.Thm("d2_abcformula6",TermC.num_str @{thm d2_abcformula6}), (*c+ x^2=0 *) - Thm("d2_abcformula6_neg",TermC.num_str @{thm d2_abcformula6_neg}), + Celem.Thm("d2_abcformula6_neg",TermC.num_str @{thm d2_abcformula6_neg}), (*c+ x^2=0 *) - Thm("d2_abcformula7",TermC.num_str @{thm d2_abcformula7}), + Celem.Thm("d2_abcformula7",TermC.num_str @{thm d2_abcformula7}), (* bx+ax^2=0 *) - Thm("d2_abcformula8",TermC.num_str @{thm d2_abcformula8}), + Celem.Thm("d2_abcformula8",TermC.num_str @{thm d2_abcformula8}), (* bx+ x^2=0 *) - Thm("d2_abcformula9",TermC.num_str @{thm d2_abcformula9}), + Celem.Thm("d2_abcformula9",TermC.num_str @{thm d2_abcformula9}), (* x+ax^2=0 *) - Thm("d2_abcformula10",TermC.num_str @{thm d2_abcformula10}), + Celem.Thm("d2_abcformula10",TermC.num_str @{thm d2_abcformula10}), (* x+ x^2=0 *) - Thm("d2_sqrt_equation2",TermC.num_str @{thm d2_sqrt_equation2}), + Celem.Thm("d2_sqrt_equation2",TermC.num_str @{thm d2_sqrt_equation2}), (* x^2=0 *) - Thm("d2_sqrt_equation3",TermC.num_str @{thm d2_sqrt_equation3}) + Celem.Thm("d2_sqrt_equation3",TermC.num_str @{thm d2_sqrt_equation3}) (* bx^2=0 *) ], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls); + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }); *} ML{* (* isolate the bound variable in an d2 equation; 'bdv' is a meta-constant*) val d2_polyeq_simplify = prep_rls'( - Rls {id = "d2_polyeq_simplify", preconds = [], - rew_ord = ("e_rew_ord",e_rew_ord), erls = PolyEq_erls, - srls = Erls, calc = [], errpatts = [], - rules = [Thm("d2_pqformula1",TermC.num_str @{thm d2_pqformula1}), + Celem.Rls {id = "d2_polyeq_simplify", preconds = [], + rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord), erls = PolyEq_erls, + srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Thm("d2_pqformula1",TermC.num_str @{thm d2_pqformula1}), (* p+qx+ x^2=0 *) - Thm("d2_pqformula1_neg",TermC.num_str @{thm d2_pqformula1_neg}), + Celem.Thm("d2_pqformula1_neg",TermC.num_str @{thm d2_pqformula1_neg}), (* p+qx+ x^2=0 *) - Thm("d2_pqformula2",TermC.num_str @{thm d2_pqformula2}), + Celem.Thm("d2_pqformula2",TermC.num_str @{thm d2_pqformula2}), (* p+qx+1x^2=0 *) - Thm("d2_pqformula2_neg",TermC.num_str @{thm d2_pqformula2_neg}), + Celem.Thm("d2_pqformula2_neg",TermC.num_str @{thm d2_pqformula2_neg}), (* p+qx+1x^2=0 *) - Thm("d2_pqformula3",TermC.num_str @{thm d2_pqformula3}), + Celem.Thm("d2_pqformula3",TermC.num_str @{thm d2_pqformula3}), (* p+ x+ x^2=0 *) - Thm("d2_pqformula3_neg",TermC.num_str @{thm d2_pqformula3_neg}), + Celem.Thm("d2_pqformula3_neg",TermC.num_str @{thm d2_pqformula3_neg}), (* p+ x+ x^2=0 *) - Thm("d2_pqformula4",TermC.num_str @{thm d2_pqformula4}), + Celem.Thm("d2_pqformula4",TermC.num_str @{thm d2_pqformula4}), (* p+ x+1x^2=0 *) - Thm("d2_pqformula4_neg",TermC.num_str @{thm d2_pqformula4_neg}), + Celem.Thm("d2_pqformula4_neg",TermC.num_str @{thm d2_pqformula4_neg}), (* p+ x+1x^2=0 *) - Thm("d2_abcformula1",TermC.num_str @{thm d2_abcformula1}), + Celem.Thm("d2_abcformula1",TermC.num_str @{thm d2_abcformula1}), (* c+bx+cx^2=0 *) - Thm("d2_abcformula1_neg",TermC.num_str @{thm d2_abcformula1_neg}), + Celem.Thm("d2_abcformula1_neg",TermC.num_str @{thm d2_abcformula1_neg}), (* c+bx+cx^2=0 *) - Thm("d2_abcformula2",TermC.num_str @{thm d2_abcformula2}), + Celem.Thm("d2_abcformula2",TermC.num_str @{thm d2_abcformula2}), (* c+ x+cx^2=0 *) - Thm("d2_abcformula2_neg",TermC.num_str @{thm d2_abcformula2_neg}), + Celem.Thm("d2_abcformula2_neg",TermC.num_str @{thm d2_abcformula2_neg}), (* c+ x+cx^2=0 *) - Thm("d2_prescind1",TermC.num_str @{thm d2_prescind1}), + Celem.Thm("d2_prescind1",TermC.num_str @{thm d2_prescind1}), (* ax+bx^2=0 -> x(a+bx)=0 *) - Thm("d2_prescind2",TermC.num_str @{thm d2_prescind2}), + Celem.Thm("d2_prescind2",TermC.num_str @{thm d2_prescind2}), (* ax+ x^2=0 -> x(a+ x)=0 *) - Thm("d2_prescind3",TermC.num_str @{thm d2_prescind3}), + Celem.Thm("d2_prescind3",TermC.num_str @{thm d2_prescind3}), (* x+bx^2=0 -> x(1+bx)=0 *) - Thm("d2_prescind4",TermC.num_str @{thm d2_prescind4}), + Celem.Thm("d2_prescind4",TermC.num_str @{thm d2_prescind4}), (* x+ x^2=0 -> x(1+ x)=0 *) - Thm("d2_isolate_add1",TermC.num_str @{thm d2_isolate_add1}), + Celem.Thm("d2_isolate_add1",TermC.num_str @{thm d2_isolate_add1}), (* a+ bx^2=0 -> bx^2=(-1)a*) - Thm("d2_isolate_add2",TermC.num_str @{thm d2_isolate_add2}), + Celem.Thm("d2_isolate_add2",TermC.num_str @{thm d2_isolate_add2}), (* a+ x^2=0 -> x^2=(-1)a*) - Thm("d2_sqrt_equation1",TermC.num_str @{thm d2_sqrt_equation1}), + Celem.Thm("d2_sqrt_equation1",TermC.num_str @{thm d2_sqrt_equation1}), (* x^2=c -> x=+-sqrt(c)*) - Thm("d2_sqrt_equation1_neg",TermC.num_str @{thm d2_sqrt_equation1_neg}), + Celem.Thm("d2_sqrt_equation1_neg",TermC.num_str @{thm d2_sqrt_equation1_neg}), (* [c<0] x^2=c -> x=[]*) - Thm("d2_sqrt_equation2",TermC.num_str @{thm d2_sqrt_equation2}), + Celem.Thm("d2_sqrt_equation2",TermC.num_str @{thm d2_sqrt_equation2}), (* x^2=0 -> x=0 *) - Thm("d2_reduce_equation1",TermC.num_str @{thm d2_reduce_equation1}), + Celem.Thm("d2_reduce_equation1",TermC.num_str @{thm d2_reduce_equation1}), (* x(a+bx)=0 -> x=0 | a+bx=0*) - Thm("d2_reduce_equation2",TermC.num_str @{thm d2_reduce_equation2}), + Celem.Thm("d2_reduce_equation2",TermC.num_str @{thm d2_reduce_equation2}), (* x(a+ x)=0 -> x=0 | a+ x=0*) - Thm("d2_isolate_div",TermC.num_str @{thm d2_isolate_div}) + Celem.Thm("d2_isolate_div",TermC.num_str @{thm d2_isolate_div}) (* bx^2=c -> x^2=c/b*) ], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls); + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }); *} ML{* (* -- d3 -- *) (* isolate the bound variable in an d3 equation; 'bdv' is a meta-constant *) val d3_polyeq_simplify = prep_rls'( - Rls {id = "d3_polyeq_simplify", preconds = [], - rew_ord = ("e_rew_ord",e_rew_ord), erls = PolyEq_erls, - srls = Erls, calc = [], errpatts = [], + Celem.Rls {id = "d3_polyeq_simplify", preconds = [], + rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord), erls = PolyEq_erls, + srls = Celem.Erls, calc = [], errpatts = [], rules = - [Thm("d3_reduce_equation1",TermC.num_str @{thm d3_reduce_equation1}), + [Celem.Thm("d3_reduce_equation1",TermC.num_str @{thm d3_reduce_equation1}), (*a*bdv + b*bdv^^^2 + c*bdv^^^3=0) = (bdv=0 | (a + b*bdv + c*bdv^^^2=0)*) - Thm("d3_reduce_equation2",TermC.num_str @{thm d3_reduce_equation2}), + Celem.Thm("d3_reduce_equation2",TermC.num_str @{thm d3_reduce_equation2}), (* bdv + b*bdv^^^2 + c*bdv^^^3=0) = (bdv=0 | (1 + b*bdv + c*bdv^^^2=0)*) - Thm("d3_reduce_equation3",TermC.num_str @{thm d3_reduce_equation3}), + Celem.Thm("d3_reduce_equation3",TermC.num_str @{thm d3_reduce_equation3}), (*a*bdv + bdv^^^2 + c*bdv^^^3=0) = (bdv=0 | (a + bdv + c*bdv^^^2=0)*) - Thm("d3_reduce_equation4",TermC.num_str @{thm d3_reduce_equation4}), + Celem.Thm("d3_reduce_equation4",TermC.num_str @{thm d3_reduce_equation4}), (* bdv + bdv^^^2 + c*bdv^^^3=0) = (bdv=0 | (1 + bdv + c*bdv^^^2=0)*) - Thm("d3_reduce_equation5",TermC.num_str @{thm d3_reduce_equation5}), + Celem.Thm("d3_reduce_equation5",TermC.num_str @{thm d3_reduce_equation5}), (*a*bdv + b*bdv^^^2 + bdv^^^3=0) = (bdv=0 | (a + b*bdv + bdv^^^2=0)*) - Thm("d3_reduce_equation6",TermC.num_str @{thm d3_reduce_equation6}), + Celem.Thm("d3_reduce_equation6",TermC.num_str @{thm d3_reduce_equation6}), (* bdv + b*bdv^^^2 + bdv^^^3=0) = (bdv=0 | (1 + b*bdv + bdv^^^2=0)*) - Thm("d3_reduce_equation7",TermC.num_str @{thm d3_reduce_equation7}), + Celem.Thm("d3_reduce_equation7",TermC.num_str @{thm d3_reduce_equation7}), (*a*bdv + bdv^^^2 + bdv^^^3=0) = (bdv=0 | (1 + bdv + bdv^^^2=0)*) - Thm("d3_reduce_equation8",TermC.num_str @{thm d3_reduce_equation8}), + Celem.Thm("d3_reduce_equation8",TermC.num_str @{thm d3_reduce_equation8}), (* bdv + bdv^^^2 + bdv^^^3=0) = (bdv=0 | (1 + bdv + bdv^^^2=0)*) - Thm("d3_reduce_equation9",TermC.num_str @{thm d3_reduce_equation9}), + Celem.Thm("d3_reduce_equation9",TermC.num_str @{thm d3_reduce_equation9}), (*a*bdv + c*bdv^^^3=0) = (bdv=0 | (a + c*bdv^^^2=0)*) - Thm("d3_reduce_equation10",TermC.num_str @{thm d3_reduce_equation10}), + Celem.Thm("d3_reduce_equation10",TermC.num_str @{thm d3_reduce_equation10}), (* bdv + c*bdv^^^3=0) = (bdv=0 | (1 + c*bdv^^^2=0)*) - Thm("d3_reduce_equation11",TermC.num_str @{thm d3_reduce_equation11}), + Celem.Thm("d3_reduce_equation11",TermC.num_str @{thm d3_reduce_equation11}), (*a*bdv + bdv^^^3=0) = (bdv=0 | (a + bdv^^^2=0)*) - Thm("d3_reduce_equation12",TermC.num_str @{thm d3_reduce_equation12}), + Celem.Thm("d3_reduce_equation12",TermC.num_str @{thm d3_reduce_equation12}), (* bdv + bdv^^^3=0) = (bdv=0 | (1 + bdv^^^2=0)*) - Thm("d3_reduce_equation13",TermC.num_str @{thm d3_reduce_equation13}), + Celem.Thm("d3_reduce_equation13",TermC.num_str @{thm d3_reduce_equation13}), (* b*bdv^^^2 + c*bdv^^^3=0) = (bdv=0 | ( b*bdv + c*bdv^^^2=0)*) - Thm("d3_reduce_equation14",TermC.num_str @{thm d3_reduce_equation14}), + Celem.Thm("d3_reduce_equation14",TermC.num_str @{thm d3_reduce_equation14}), (* bdv^^^2 + c*bdv^^^3=0) = (bdv=0 | ( bdv + c*bdv^^^2=0)*) - Thm("d3_reduce_equation15",TermC.num_str @{thm d3_reduce_equation15}), + Celem.Thm("d3_reduce_equation15",TermC.num_str @{thm d3_reduce_equation15}), (* b*bdv^^^2 + bdv^^^3=0) = (bdv=0 | ( b*bdv + bdv^^^2=0)*) - Thm("d3_reduce_equation16",TermC.num_str @{thm d3_reduce_equation16}), + Celem.Thm("d3_reduce_equation16",TermC.num_str @{thm d3_reduce_equation16}), (* bdv^^^2 + bdv^^^3=0) = (bdv=0 | ( bdv + bdv^^^2=0)*) - Thm("d3_isolate_add1",TermC.num_str @{thm d3_isolate_add1}), + Celem.Thm("d3_isolate_add1",TermC.num_str @{thm d3_isolate_add1}), (*[|Not(bdv occurs_in a)|] ==> (a + b*bdv^^^3=0) = (bdv=0 | (b*bdv^^^3=a)*) - Thm("d3_isolate_add2",TermC.num_str @{thm d3_isolate_add2}), + Celem.Thm("d3_isolate_add2",TermC.num_str @{thm d3_isolate_add2}), (*[|Not(bdv occurs_in a)|] ==> (a + bdv^^^3=0) = (bdv=0 | ( bdv^^^3=a)*) - Thm("d3_isolate_div",TermC.num_str @{thm d3_isolate_div}), + Celem.Thm("d3_isolate_div",TermC.num_str @{thm d3_isolate_div}), (*[|Not(b=0)|] ==> (b*bdv^^^3=c) = (bdv^^^3=c/b*) - Thm("d3_root_equation2",TermC.num_str @{thm d3_root_equation2}), + Celem.Thm("d3_root_equation2",TermC.num_str @{thm d3_root_equation2}), (*(bdv^^^3=0) = (bdv=0) *) - Thm("d3_root_equation1",TermC.num_str @{thm d3_root_equation1}) + Celem.Thm("d3_root_equation1",TermC.num_str @{thm d3_root_equation1}) (*bdv^^^3=c) = (bdv = nroot 3 c*) ], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls); + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }); *} ML{* (* -- d4 -- *) (*isolate the bound variable in an d4 equation; 'bdv' is a meta-constant*) val d4_polyeq_simplify = prep_rls'( - Rls {id = "d4_polyeq_simplify", preconds = [], - rew_ord = ("e_rew_ord",e_rew_ord), erls = PolyEq_erls, - srls = Erls, calc = [], errpatts = [], + Celem.Rls {id = "d4_polyeq_simplify", preconds = [], + rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord), erls = PolyEq_erls, + srls = Celem.Erls, calc = [], errpatts = [], rules = - [Thm("d4_sub_u1",TermC.num_str @{thm d4_sub_u1}) + [Celem.Thm("d4_sub_u1",TermC.num_str @{thm d4_sub_u1}) (* ax^4+bx^2+c=0 -> x=+-sqrt(ax^2+bx^+c) *) ], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls); + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }); *} setup {* KEStore_Elems.add_rlss [("d0_polyeq_simplify", (Context.theory_name @{theory}, d0_polyeq_simplify)), @@ -831,7 +831,7 @@ *) *} setup {* KEStore_Elems.add_pbts - [(Specify.prep_pbt thy "pbl_equ_univ_poly" [] e_pblID + [(Specify.prep_pbt thy "pbl_equ_univ_poly" [] Celem.e_pblID (["polynomial","univariate","equation"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["~((e_e::bool) is_ratequation_in (v_v::real))", @@ -840,7 +840,7 @@ ("#Find" ,["solutions v_v'i'"])], PolyEq_prls, SOME "solve (e_e::bool, v_v)", [])), (*--- d0 ---*) - (Specify.prep_pbt thy "pbl_equ_univ_poly_deg0" [] e_pblID + (Specify.prep_pbt thy "pbl_equ_univ_poly_deg0" [] Celem.e_pblID (["degree_0","polynomial","univariate","equation"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["matches (?a = 0) e_e", @@ -849,7 +849,7 @@ ("#Find" ,["solutions v_v'i'"])], PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","solve_d0_polyeq_equation"]])), (*--- d1 ---*) - (Specify.prep_pbt thy "pbl_equ_univ_poly_deg1" [] e_pblID + (Specify.prep_pbt thy "pbl_equ_univ_poly_deg1" [] Celem.e_pblID (["degree_1","polynomial","univariate","equation"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["matches (?a = 0) e_e", @@ -858,7 +858,7 @@ ("#Find" ,["solutions v_v'i'"])], PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","solve_d1_polyeq_equation"]])), (*--- d2 ---*) - (Specify.prep_pbt thy "pbl_equ_univ_poly_deg2" [] e_pblID + (Specify.prep_pbt thy "pbl_equ_univ_poly_deg2" [] Celem.e_pblID (["degree_2","polynomial","univariate","equation"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["matches (?a = 0) e_e", @@ -866,7 +866,7 @@ "((lhs e_e) has_degree_in v_v ) = 2"]), ("#Find" ,["solutions v_v'i'"])], PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","solve_d2_polyeq_equation"]])), - (Specify.prep_pbt thy "pbl_equ_univ_poly_deg2_sqonly" [] e_pblID + (Specify.prep_pbt thy "pbl_equ_univ_poly_deg2_sqonly" [] Celem.e_pblID (["sq_only","degree_2","polynomial","univariate","equation"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["matches ( ?a + ?v_^^^2 = 0) e_e | " ^ @@ -884,7 +884,7 @@ ("#Find" ,["solutions v_v'i'"])], PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","solve_d2_polyeq_sqonly_equation"]])), - (Specify.prep_pbt thy "pbl_equ_univ_poly_deg2_bdvonly" [] e_pblID + (Specify.prep_pbt thy "pbl_equ_univ_poly_deg2_bdvonly" [] Celem.e_pblID (["bdv_only","degree_2","polynomial","univariate","equation"], [("#Given", ["equality e_e","solveFor v_v"]), ("#Where", ["matches (?a*?v_ + ?v_^^^2 = 0) e_e | " ^ @@ -896,14 +896,14 @@ ("#Find", ["solutions v_v'i'"])], PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","solve_d2_polyeq_bdvonly_equation"]])), - (Specify.prep_pbt thy "pbl_equ_univ_poly_deg2_pq" [] e_pblID + (Specify.prep_pbt thy "pbl_equ_univ_poly_deg2_pq" [] Celem.e_pblID (["pqFormula","degree_2","polynomial","univariate","equation"], [("#Given", ["equality e_e","solveFor v_v"]), ("#Where", ["matches (?a + 1*?v_^^^2 = 0) e_e | " ^ "matches (?a + ?v_^^^2 = 0) e_e"]), ("#Find", ["solutions v_v'i'"])], PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","solve_d2_polyeq_pq_equation"]])), - (Specify.prep_pbt thy "pbl_equ_univ_poly_deg2_abc" [] e_pblID + (Specify.prep_pbt thy "pbl_equ_univ_poly_deg2_abc" [] Celem.e_pblID (["abcFormula","degree_2","polynomial","univariate","equation"], [("#Given", ["equality e_e","solveFor v_v"]), ("#Where", ["matches (?a + ?v_^^^2 = 0) e_e | " ^ @@ -911,7 +911,7 @@ ("#Find", ["solutions v_v'i'"])], PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","solve_d2_polyeq_abc_equation"]])), (*--- d3 ---*) - (Specify.prep_pbt thy "pbl_equ_univ_poly_deg3" [] e_pblID + (Specify.prep_pbt thy "pbl_equ_univ_poly_deg3" [] Celem.e_pblID (["degree_3","polynomial","univariate","equation"], [("#Given", ["equality e_e","solveFor v_v"]), ("#Where", ["matches (?a = 0) e_e", @@ -920,7 +920,7 @@ ("#Find", ["solutions v_v'i'"])], PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","solve_d3_polyeq_equation"]])), (*--- d4 ---*) - (Specify.prep_pbt thy "pbl_equ_univ_poly_deg4" [] e_pblID + (Specify.prep_pbt thy "pbl_equ_univ_poly_deg4" [] Celem.e_pblID (["degree_4","polynomial","univariate","equation"], [("#Given", ["equality e_e","solveFor v_v"]), ("#Where", ["matches (?a = 0) e_e", @@ -929,7 +929,7 @@ ("#Find", ["solutions v_v'i'"])], PolyEq_prls, SOME "solve (e_e::bool, v_v)", [(*["PolyEq","solve_d4_polyeq_equation"]*)])), (*--- normalise ---*) - (Specify.prep_pbt thy "pbl_equ_univ_poly_norm" [] e_pblID + (Specify.prep_pbt thy "pbl_equ_univ_poly_norm" [] Celem.e_pblID (["normalise","polynomial","univariate","equation"], [("#Given", ["equality e_e","solveFor v_v"]), ("#Where", ["(Not((matches (?a = 0 ) e_e ))) |" ^ @@ -937,7 +937,7 @@ ("#Find", ["solutions v_v'i'"])], PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","normalise_poly"]])), (*-------------------------expanded-----------------------*) - (Specify.prep_pbt thy "pbl_equ_univ_expand" [] e_pblID + (Specify.prep_pbt thy "pbl_equ_univ_expand" [] Celem.e_pblID (["expanded","univariate","equation"], [("#Given", ["equality e_e","solveFor v_v"]), ("#Where", ["matches (?a = 0) e_e", @@ -945,7 +945,7 @@ ("#Find", ["solutions v_v'i'"])], PolyEq_prls, SOME "solve (e_e::bool, v_v)", [])), (*--- d2 ---*) - (Specify.prep_pbt thy "pbl_equ_univ_expand_deg2" [] e_pblID + (Specify.prep_pbt thy "pbl_equ_univ_expand_deg2" [] Celem.e_pblID (["degree_2","expanded","univariate","equation"], [("#Given", ["equality e_e","solveFor v_v"]), ("#Where", ["((lhs e_e) has_degree_in v_v) = 2"]), @@ -968,17 +968,17 @@ text {* "-------------------------methods-----------------------" *} setup {* KEStore_Elems.add_mets - [Specify.prep_met thy "met_polyeq" [] e_metID + [Specify.prep_met thy "met_polyeq" [] Celem.e_metID (["PolyEq"], [], - {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = e_rls, prls=e_rls, + {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = Celem.e_rls, prls=Celem.e_rls, crls=PolyEq_crls, errpats = [], nrls = norm_Rational}, "empty_script"), - Specify.prep_met thy "met_polyeq_norm" [] e_metID + Specify.prep_met thy "met_polyeq_norm" [] Celem.e_metID (["PolyEq","normalise_poly"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["(Not((matches (?a = 0 ) e_e ))) |(Not(((lhs e_e) is_poly_in v_v)))"]), ("#Find" ,["solutions v_v'i'"])], - {rew_ord'="termlessI", rls'=PolyEq_erls, srls=e_rls, prls=PolyEq_prls, calc=[], + {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Celem.e_rls, prls=PolyEq_prls, calc=[], crls=PolyEq_crls, errpats = [], nrls = norm_Rational}, "Script Normalize_poly (e_e::bool) (v_v::real) = " ^ "(let e_e =((Try (Rewrite all_left False)) @@ " ^ @@ -989,24 +989,24 @@ " (Try (Repeat (Rewrite_Set polyeq_simplify False)))) e_e " ^ " in (SubProblem (PolyEq',[polynomial,univariate,equation], [no_met]) " ^ " [BOOL e_e, REAL v_v]))"), - Specify.prep_met thy "met_polyeq_d0" [] e_metID + Specify.prep_met thy "met_polyeq_d0" [] Celem.e_metID (["PolyEq","solve_d0_polyeq_equation"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 0"]), ("#Find" ,["solutions v_v'i'"])], - {rew_ord'="termlessI", rls'=PolyEq_erls, srls=e_rls, prls=PolyEq_prls, + {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Celem.e_rls, prls=PolyEq_prls, calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [], nrls = norm_Rational}, "Script Solve_d0_polyeq_equation (e_e::bool) (v_v::real) = " ^ "(let e_e = ((Try (Rewrite_Set_Inst [(bdv,v_v::real)] " ^ " d0_polyeq_simplify False))) e_e " ^ " in ((Or_to_List e_e)::bool list))"), - Specify.prep_met thy "met_polyeq_d1" [] e_metID + Specify.prep_met thy "met_polyeq_d1" [] Celem.e_metID (["PolyEq","solve_d1_polyeq_equation"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 1"]), ("#Find" ,["solutions v_v'i'"])], - {rew_ord'="termlessI", rls'=PolyEq_erls, srls=e_rls, prls=PolyEq_prls, + {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Celem.e_rls, prls=PolyEq_prls, calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [], nrls = norm_Rational}, "Script Solve_d1_polyeq_equation (e_e::bool) (v_v::real) = " ^ @@ -1016,12 +1016,12 @@ " (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e;" ^ " (L_L::bool list) = ((Or_to_List e_e)::bool list) " ^ " in Check_elementwise L_L {(v_v::real). Assumptions} )"), - Specify.prep_met thy "met_polyeq_d22" [] e_metID + Specify.prep_met thy "met_polyeq_d22" [] Celem.e_metID (["PolyEq","solve_d2_polyeq_equation"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 2"]), ("#Find" ,["solutions v_v'i'"])], - {rew_ord'="termlessI", rls'=PolyEq_erls, srls=e_rls, prls=PolyEq_prls, + {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Celem.e_rls, prls=PolyEq_prls, calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [], nrls = norm_Rational}, "Script Solve_d2_polyeq_equation (e_e::bool) (v_v::real) = " ^ @@ -1034,12 +1034,12 @@ " (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e;" ^ " (L_L::bool list) = ((Or_to_List e_e)::bool list) " ^ " in Check_elementwise L_L {(v_v::real). Assumptions} )"), - Specify.prep_met thy "met_polyeq_d2_bdvonly" [] e_metID + Specify.prep_met thy "met_polyeq_d2_bdvonly" [] Celem.e_metID (["PolyEq","solve_d2_polyeq_bdvonly_equation"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 2"]), ("#Find" ,["solutions v_v'i'"])], - {rew_ord'="termlessI", rls'=PolyEq_erls, srls=e_rls, prls=PolyEq_prls, + {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Celem.e_rls, prls=PolyEq_prls, calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [], nrls = norm_Rational}, "Script Solve_d2_polyeq_bdvonly_equation (e_e::bool) (v_v::real) =" ^ @@ -1052,12 +1052,12 @@ " (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e;" ^ " (L_L::bool list) = ((Or_to_List e_e)::bool list) " ^ " in Check_elementwise L_L {(v_v::real). Assumptions} )"), - Specify.prep_met thy "met_polyeq_d2_sqonly" [] e_metID + Specify.prep_met thy "met_polyeq_d2_sqonly" [] Celem.e_metID (["PolyEq","solve_d2_polyeq_sqonly_equation"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 2"]), ("#Find" ,["solutions v_v'i'"])], - {rew_ord'="termlessI", rls'=PolyEq_erls, srls=e_rls, prls=PolyEq_prls, + {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Celem.e_rls, prls=PolyEq_prls, calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [], nrls = norm_Rational}, "Script Solve_d2_polyeq_sqonly_equation (e_e::bool) (v_v::real) =" ^ @@ -1067,12 +1067,12 @@ " (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e; " ^ " (L_L::bool list) = ((Or_to_List e_e)::bool list) " ^ " in Check_elementwise L_L {(v_v::real). Assumptions} )"), - Specify.prep_met thy "met_polyeq_d2_pq" [] e_metID + Specify.prep_met thy "met_polyeq_d2_pq" [] Celem.e_metID (["PolyEq","solve_d2_polyeq_pq_equation"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 2"]), ("#Find" ,["solutions v_v'i'"])], - {rew_ord'="termlessI", rls'=PolyEq_erls, srls=e_rls, prls=PolyEq_prls, + {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Celem.e_rls, prls=PolyEq_prls, calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [], nrls = norm_Rational}, "Script Solve_d2_polyeq_pq_equation (e_e::bool) (v_v::real) = " ^ @@ -1082,12 +1082,12 @@ " (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e;" ^ " (L_L::bool list) = ((Or_to_List e_e)::bool list) " ^ " in Check_elementwise L_L {(v_v::real). Assumptions} )"), - Specify.prep_met thy "met_polyeq_d2_abc" [] e_metID + Specify.prep_met thy "met_polyeq_d2_abc" [] Celem.e_metID (["PolyEq","solve_d2_polyeq_abc_equation"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 2"]), ("#Find" ,["solutions v_v'i'"])], - {rew_ord'="termlessI", rls'=PolyEq_erls,srls=e_rls, prls=PolyEq_prls, + {rew_ord'="termlessI", rls'=PolyEq_erls,srls=Celem.e_rls, prls=PolyEq_prls, calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [], nrls = norm_Rational}, "Script Solve_d2_polyeq_abc_equation (e_e::bool) (v_v::real) = " ^ @@ -1097,12 +1097,12 @@ " (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e;" ^ " (L_L::bool list) = ((Or_to_List e_e)::bool list) " ^ " in Check_elementwise L_L {(v_v::real). Assumptions} )"), - Specify.prep_met thy "met_polyeq_d3" [] e_metID + Specify.prep_met thy "met_polyeq_d3" [] Celem.e_metID (["PolyEq","solve_d3_polyeq_equation"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 3"]), ("#Find" ,["solutions v_v'i'"])], - {rew_ord'="termlessI", rls'=PolyEq_erls, srls=e_rls, prls=PolyEq_prls, + {rew_ord'="termlessI", rls'=PolyEq_erls, srls=Celem.e_rls, prls=PolyEq_prls, calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [], nrls = norm_Rational}, "Script Solve_d3_polyeq_equation (e_e::bool) (v_v::real) = " ^ @@ -1121,12 +1121,12 @@ (*.solves all expanded (ie. normalised) terms of degree 2.*) (*Oct.02 restriction: 'eval_true 0 =< discriminant' ony for integer values by 'PolyEq_erls'; restricted until Float.thy is implemented*) - Specify.prep_met thy "met_polyeq_complsq" [] e_metID + Specify.prep_met thy "met_polyeq_complsq" [] Celem.e_metID (["PolyEq","complete_square"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["matches (?a = 0) e_e", "((lhs e_e) has_degree_in v_v) = 2"]), ("#Find" ,["solutions v_v'i'"])], - {rew_ord'="termlessI",rls'=PolyEq_erls,srls=e_rls,prls=PolyEq_prls, + {rew_ord'="termlessI",rls'=PolyEq_erls,srls=Celem.e_rls,prls=PolyEq_prls, calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [], nrls = norm_Rational}, "Script Complete_square (e_e::bool) (v_v::real) = " ^ @@ -1169,12 +1169,12 @@ (Free (xstr,_)) => (if xstr = var then 1000*(the (TermC.int_of_str_opt pot)) else 3) | _ => error ("size_of_term' called with subst = "^ - (term2str x))) + (Celem.term2str x))) | size_of_term' x (Free (subst,_)) = (case x of (Free (xstr,_)) => (if xstr = subst then 1000 else 1) | _ => error ("size_of_term' called with subst = "^ - (term2str x))) + (Celem.term2str x))) | size_of_term' x (Abs (_,_,body)) = 1 + size_of_term' x body | size_of_term' x (f$t) = size_of_term' x f + size_of_term' x t | size_of_term' x _ = 1; @@ -1186,10 +1186,10 @@ then let val (f, ts) = strip_comb t and (g, us) = strip_comb u; - val _ = tracing ("t= f@ts= \"" ^ term_to_string''' thy f ^ "\" @ \"[" ^ - commas (map (term_to_string''' thy) ts) ^ "]\""); - val _ = tracing ("u= g@us= \"" ^ term_to_string''' thy g ^ "\" @ \"[" ^ - commas(map (term_to_string''' thy) us) ^ "]\""); + val _ = tracing ("t= f@ts= \"" ^ Celem.term_to_string''' thy f ^ "\" @ \"[" ^ + commas (map (Celem.term_to_string''' thy) ts) ^ "]\""); + val _ = tracing ("u= g@us= \"" ^ Celem.term_to_string''' thy g ^ "\" @ \"[" ^ + commas(map (Celem.term_to_string''' thy) us) ^ "]\""); val _ = tracing ("size_of_term(t,u)= (" ^ string_of_int (size_of_term' x t) ^ ", " ^ string_of_int (size_of_term' x u) ^ ")"); val _ = tracing ("hd_ord(f,g) = " ^ (pr_ord o (hd_ord x)) (f,g)); @@ -1210,110 +1210,110 @@ prod_ord (prod_ord Term_Ord.indexname_ord Term_Ord.typ_ord) int_ord (dest_hd' x f, dest_hd' x g) and terms_ord x str pr (ts, us) = - list_ord (term_ord' x pr (assoc_thy "Isac"))(ts, us); + list_ord (term_ord' x pr (Celem.assoc_thy "Isac"))(ts, us); in fun ord_make_polynomial_in (pr:bool) thy subst tu = let - (* val _=tracing("*** subs variable is: "^(subst2str subst)); *) + (* val _=tracing("*** subs variable is: "^(Celem.subst2str subst)); *) in case subst of (_,x)::_ => (term_ord' x pr thy tu = LESS) | _ => error ("ord_make_polynomial_in called with subst = "^ - (subst2str subst)) + (Celem.subst2str subst)) end; end;(*local*) *} ML{* val order_add_mult_in = prep_rls'( - Rls{id = "order_add_mult_in", preconds = [], + Celem.Rls{id = "order_add_mult_in", preconds = [], rew_ord = ("ord_make_polynomial_in", ord_make_polynomial_in false @{theory "Poly"}), - erls = e_rls,srls = Erls, + erls = Celem.e_rls,srls = Celem.Erls, calc = [], errpatts = [], - rules = [Thm ("mult_commute",TermC.num_str @{thm mult.commute}), + rules = [Celem.Thm ("mult_commute",TermC.num_str @{thm mult.commute}), (* z * w = w * z *) - Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}), + Celem.Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}), (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*) - Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}), + Celem.Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}), (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*) - Thm ("add_commute",TermC.num_str @{thm add.commute}), + Celem.Thm ("add_commute",TermC.num_str @{thm add.commute}), (*z + w = w + z*) - Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}), + Celem.Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}), (*x + (y + z) = y + (x + z)*) - Thm ("add_assoc",TermC.num_str @{thm add.assoc}) + Celem.Thm ("add_assoc",TermC.num_str @{thm add.assoc}) (*z1.0 + z2.0 + z3.0 = z1.0 + (z2.0 + z3.0)*) - ], scr = EmptyScr}:rls); + ], scr = Celem.EmptyScr}); *} ML{* val collect_bdv = prep_rls'( - Rls{id = "collect_bdv", preconds = [], - rew_ord = ("dummy_ord", dummy_ord), - erls = e_rls,srls = Erls, + Celem.Rls{id = "collect_bdv", preconds = [], + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Celem.e_rls,srls = Celem.Erls, calc = [], errpatts = [], - rules = [Thm ("bdv_collect_1",TermC.num_str @{thm bdv_collect_1}), - Thm ("bdv_collect_2",TermC.num_str @{thm bdv_collect_2}), - Thm ("bdv_collect_3",TermC.num_str @{thm bdv_collect_3}), + rules = [Celem.Thm ("bdv_collect_1",TermC.num_str @{thm bdv_collect_1}), + Celem.Thm ("bdv_collect_2",TermC.num_str @{thm bdv_collect_2}), + Celem.Thm ("bdv_collect_3",TermC.num_str @{thm bdv_collect_3}), - Thm ("bdv_collect_assoc1_1",TermC.num_str @{thm bdv_collect_assoc1_1}), - Thm ("bdv_collect_assoc1_2",TermC.num_str @{thm bdv_collect_assoc1_2}), - Thm ("bdv_collect_assoc1_3",TermC.num_str @{thm bdv_collect_assoc1_3}), + Celem.Thm ("bdv_collect_assoc1_1",TermC.num_str @{thm bdv_collect_assoc1_1}), + Celem.Thm ("bdv_collect_assoc1_2",TermC.num_str @{thm bdv_collect_assoc1_2}), + Celem.Thm ("bdv_collect_assoc1_3",TermC.num_str @{thm bdv_collect_assoc1_3}), - Thm ("bdv_collect_assoc2_1",TermC.num_str @{thm bdv_collect_assoc2_1}), - Thm ("bdv_collect_assoc2_2",TermC.num_str @{thm bdv_collect_assoc2_2}), - Thm ("bdv_collect_assoc2_3",TermC.num_str @{thm bdv_collect_assoc2_3}), + Celem.Thm ("bdv_collect_assoc2_1",TermC.num_str @{thm bdv_collect_assoc2_1}), + Celem.Thm ("bdv_collect_assoc2_2",TermC.num_str @{thm bdv_collect_assoc2_2}), + Celem.Thm ("bdv_collect_assoc2_3",TermC.num_str @{thm bdv_collect_assoc2_3}), - Thm ("bdv_n_collect_1",TermC.num_str @{thm bdv_n_collect_1}), - Thm ("bdv_n_collect_2",TermC.num_str @{thm bdv_n_collect_2}), - Thm ("bdv_n_collect_3",TermC.num_str @{thm bdv_n_collect_3}), + Celem.Thm ("bdv_n_collect_1",TermC.num_str @{thm bdv_n_collect_1}), + Celem.Thm ("bdv_n_collect_2",TermC.num_str @{thm bdv_n_collect_2}), + Celem.Thm ("bdv_n_collect_3",TermC.num_str @{thm bdv_n_collect_3}), - Thm ("bdv_n_collect_assoc1_1",TermC.num_str @{thm bdv_n_collect_assoc1_1}), - Thm ("bdv_n_collect_assoc1_2",TermC.num_str @{thm bdv_n_collect_assoc1_2}), - Thm ("bdv_n_collect_assoc1_3",TermC.num_str @{thm bdv_n_collect_assoc1_3}), + Celem.Thm ("bdv_n_collect_assoc1_1",TermC.num_str @{thm bdv_n_collect_assoc1_1}), + Celem.Thm ("bdv_n_collect_assoc1_2",TermC.num_str @{thm bdv_n_collect_assoc1_2}), + Celem.Thm ("bdv_n_collect_assoc1_3",TermC.num_str @{thm bdv_n_collect_assoc1_3}), - Thm ("bdv_n_collect_assoc2_1",TermC.num_str @{thm bdv_n_collect_assoc2_1}), - Thm ("bdv_n_collect_assoc2_2",TermC.num_str @{thm bdv_n_collect_assoc2_2}), - Thm ("bdv_n_collect_assoc2_3",TermC.num_str @{thm bdv_n_collect_assoc2_3}) - ], scr = EmptyScr}:rls); + Celem.Thm ("bdv_n_collect_assoc2_1",TermC.num_str @{thm bdv_n_collect_assoc2_1}), + Celem.Thm ("bdv_n_collect_assoc2_2",TermC.num_str @{thm bdv_n_collect_assoc2_2}), + Celem.Thm ("bdv_n_collect_assoc2_3",TermC.num_str @{thm bdv_n_collect_assoc2_3}) + ], scr = Celem.EmptyScr}); *} ML{* (*.transforms an arbitrary term without roots to a polynomial [4] according to knowledge/Poly.sml.*) val make_polynomial_in = prep_rls'( - Seq {id = "make_polynomial_in", preconds = []:term list, - rew_ord = ("dummy_ord", dummy_ord), - erls = Atools_erls, srls = Erls, + Celem.Seq {id = "make_polynomial_in", preconds = []:term list, + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Atools_erls, srls = Celem.Erls, calc = [], errpatts = [], - rules = [Rls_ expand_poly, - Rls_ order_add_mult_in, - Rls_ simplify_power, - Rls_ collect_numerals, - Rls_ reduce_012, - Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}), - Rls_ discard_parentheses, - Rls_ collect_bdv + rules = [Celem.Rls_ expand_poly, + Celem.Rls_ order_add_mult_in, + Celem.Rls_ simplify_power, + Celem.Rls_ collect_numerals, + Celem.Rls_ reduce_012, + Celem.Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}), + Celem.Rls_ discard_parentheses, + Celem.Rls_ collect_bdv ], - scr = EmptyScr - }:rls); + scr = Celem.EmptyScr + }); *} ML{* val separate_bdvs = - append_rls "separate_bdvs" + Celem.append_rls "separate_bdvs" collect_bdv - [Thm ("separate_bdv", TermC.num_str @{thm separate_bdv}), + [Celem.Thm ("separate_bdv", TermC.num_str @{thm separate_bdv}), (*"?a * ?bdv / ?b = ?a / ?b * ?bdv"*) - Thm ("separate_bdv_n", TermC.num_str @{thm separate_bdv_n}), - Thm ("separate_1_bdv", TermC.num_str @{thm separate_1_bdv}), + Celem.Thm ("separate_bdv_n", TermC.num_str @{thm separate_bdv_n}), + Celem.Thm ("separate_1_bdv", TermC.num_str @{thm separate_1_bdv}), (*"?bdv / ?b = (1 / ?b) * ?bdv"*) - Thm ("separate_1_bdv_n", TermC.num_str @{thm separate_1_bdv_n}), + Celem.Thm ("separate_1_bdv_n", TermC.num_str @{thm separate_1_bdv_n}), (*"?bdv ^^^ ?n / ?b = 1 / ?b * ?bdv ^^^ ?n"*) - Thm ("add_divide_distrib", + Celem.Thm ("add_divide_distrib", TermC.num_str @{thm add_divide_distrib}) (*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z" WN051031 DOES NOT BELONG TO HERE*) @@ -1321,19 +1321,19 @@ *} ML{* val make_ratpoly_in = prep_rls'( - Seq {id = "make_ratpoly_in", preconds = []:term list, - rew_ord = ("dummy_ord", dummy_ord), - erls = Atools_erls, srls = Erls, + Celem.Seq {id = "make_ratpoly_in", preconds = []:term list, + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Atools_erls, srls = Celem.Erls, calc = [], errpatts = [], - rules = [Rls_ norm_Rational, - Rls_ order_add_mult_in, - Rls_ discard_parentheses, - Rls_ separate_bdvs, - (* Rls_ rearrange_assoc, WN060916 why does cancel_p not work?*) - Rls_ cancel_p - (*Calc ("Rings.divide_class.divide" ,eval_cancel "#divide_e") too weak!*) + rules = [Celem.Rls_ norm_Rational, + Celem.Rls_ order_add_mult_in, + Celem.Rls_ discard_parentheses, + Celem.Rls_ separate_bdvs, + (* Celem.Rls_ rearrange_assoc, WN060916 why does cancel_p not work?*) + Celem.Rls_ cancel_p + (*Celem.Calc ("Rings.divide_class.divide" ,eval_cancel "#divide_e") too weak!*) ], - scr = EmptyScr}:rls); + scr = Celem.EmptyScr}); *} setup {* KEStore_Elems.add_rlss [("order_add_mult_in", (Context.theory_name @{theory}, order_add_mult_in)), diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/PolyMinus.thy --- a/src/Tools/isac/Knowledge/PolyMinus.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/PolyMinus.thy Thu Mar 15 12:42:04 2018 +0100 @@ -139,18 +139,18 @@ if TermC.is_num b then if TermC.is_num a then (*123 kleiner 32 = True !!!*) if TermC.num_of_term a < TermC.num_of_term b then - SOME ((term2str p) ^ " = True", + SOME ((Celem.term2str p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True}))) - else SOME ((term2str p) ^ " = False", + else SOME ((Celem.term2str p) ^ " = False", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False}))) else (* -1 * -2 kleiner 0 *) - SOME ((term2str p) ^ " = False", + SOME ((Celem.term2str p) ^ " = False", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False}))) else if identifier a < identifier b then - SOME ((term2str p) ^ " = True", + SOME ((Celem.term2str p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True}))) - else SOME ((term2str p) ^ " = False", + else SOME ((Celem.term2str p) ^ " = False", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False}))) | eval_kleiner _ _ _ _ = NONE; @@ -178,9 +178,9 @@ (*("ist_monom", ("PolyMinus.ist'_monom", eval_ist_monom ""))*) fun eval_ist_monom _ _ (p as (Const ("PolyMinus.ist'_monom",_) $ a)) _ = if ist_monom a then - SOME ((term2str p) ^ " = True", + SOME ((Celem.term2str p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True}))) - else SOME ((term2str p) ^ " = False", + else SOME ((Celem.term2str p) ^ " = False", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False}))) | eval_ist_monom _ _ _ _ = NONE; @@ -190,200 +190,200 @@ (** rulesets **) val erls_ordne_alphabetisch = - append_rls "erls_ordne_alphabetisch" e_rls - [Calc ("PolyMinus.kleiner", eval_kleiner ""), - Calc ("PolyMinus.ist'_monom", eval_ist_monom "") + Celem.append_rls "erls_ordne_alphabetisch" Celem.e_rls + [Celem.Calc ("PolyMinus.kleiner", eval_kleiner ""), + Celem.Calc ("PolyMinus.ist'_monom", eval_ist_monom "") ]; val ordne_alphabetisch = - Rls{id = "ordne_alphabetisch", preconds = [], - rew_ord = ("dummy_ord", dummy_ord), srls = Erls, calc = [], errpatts = [], + Celem.Rls{id = "ordne_alphabetisch", preconds = [], + rew_ord = ("dummy_ord", Celem.dummy_ord), srls = Celem.Erls, calc = [], errpatts = [], erls = erls_ordne_alphabetisch, - rules = [Thm ("tausche_plus",TermC.num_str @{thm tausche_plus}), + rules = [Celem.Thm ("tausche_plus",TermC.num_str @{thm tausche_plus}), (*"b kleiner a ==> (b + a) = (a + b)"*) - Thm ("tausche_minus",TermC.num_str @{thm tausche_minus}), + Celem.Thm ("tausche_minus",TermC.num_str @{thm tausche_minus}), (*"b kleiner a ==> (b - a) = (-a + b)"*) - Thm ("tausche_vor_plus",TermC.num_str @{thm tausche_vor_plus}), + Celem.Thm ("tausche_vor_plus",TermC.num_str @{thm tausche_vor_plus}), (*"[| b ist_monom; a kleiner b |] ==> (- b + a) = (a - b)"*) - Thm ("tausche_vor_minus",TermC.num_str @{thm tausche_vor_minus}), + Celem.Thm ("tausche_vor_minus",TermC.num_str @{thm tausche_vor_minus}), (*"[| b ist_monom; a kleiner b |] ==> (- b - a) = (-a - b)"*) - Thm ("tausche_plus_plus",TermC.num_str @{thm tausche_plus_plus}), + Celem.Thm ("tausche_plus_plus",TermC.num_str @{thm tausche_plus_plus}), (*"c kleiner b ==> (a + c + b) = (a + b + c)"*) - Thm ("tausche_plus_minus",TermC.num_str @{thm tausche_plus_minus}), + Celem.Thm ("tausche_plus_minus",TermC.num_str @{thm tausche_plus_minus}), (*"c kleiner b ==> (a + c - b) = (a - b + c)"*) - Thm ("tausche_minus_plus",TermC.num_str @{thm tausche_minus_plus}), + Celem.Thm ("tausche_minus_plus",TermC.num_str @{thm tausche_minus_plus}), (*"c kleiner b ==> (a - c + b) = (a + b - c)"*) - Thm ("tausche_minus_minus",TermC.num_str @{thm tausche_minus_minus}) + Celem.Thm ("tausche_minus_minus",TermC.num_str @{thm tausche_minus_minus}) (*"c kleiner b ==> (a - c - b) = (a - b - c)"*) - ], scr = EmptyScr}:rls; + ], scr = Celem.EmptyScr}; val fasse_zusammen = - Rls{id = "fasse_zusammen", preconds = [], - rew_ord = ("dummy_ord", dummy_ord), - erls = append_rls "erls_fasse_zusammen" e_rls - [Calc ("Atools.is'_const",eval_const "#is_const_")], - srls = Erls, calc = [], errpatts = [], + Celem.Rls{id = "fasse_zusammen", preconds = [], + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Celem.append_rls "erls_fasse_zusammen" Celem.e_rls + [Celem.Calc ("Atools.is'_const",eval_const "#is_const_")], + srls = Celem.Erls, calc = [], errpatts = [], rules = - [Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), + [Celem.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*) - Thm ("real_num_collect_assoc_r",TermC.num_str @{thm real_num_collect_assoc_r}), + Celem.Thm ("real_num_collect_assoc_r",TermC.num_str @{thm real_num_collect_assoc_r}), (*"[| l is_const; m..|] ==> (k + m * n) + l * n = k + (l + m)*n"*) - Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}), + Celem.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}), (*"m is_const ==> n + m * n = (1 + m) * n"*) - Thm ("real_one_collect_assoc_r",TermC.num_str @{thm real_one_collect_assoc_r}), + Celem.Thm ("real_one_collect_assoc_r",TermC.num_str @{thm real_one_collect_assoc_r}), (*"m is_const ==> (k + n) + m * n = k + (m + 1) * n"*) - Thm ("subtrahiere",TermC.num_str @{thm subtrahiere}), + Celem.Thm ("subtrahiere",TermC.num_str @{thm subtrahiere}), (*"[| l is_const; m is_const |] ==> m * v - l * v = (m - l) * v"*) - Thm ("subtrahiere_von_1",TermC.num_str @{thm subtrahiere_von_1}), + Celem.Thm ("subtrahiere_von_1",TermC.num_str @{thm subtrahiere_von_1}), (*"[| l is_const |] ==> v - l * v = (1 - l) * v"*) - Thm ("subtrahiere_1",TermC.num_str @{thm subtrahiere_1}), + Celem.Thm ("subtrahiere_1",TermC.num_str @{thm subtrahiere_1}), (*"[| l is_const; m is_const |] ==> m * v - v = (m - 1) * v"*) - Thm ("subtrahiere_x_plus_minus",TermC.num_str @{thm subtrahiere_x_plus_minus}), + Celem.Thm ("subtrahiere_x_plus_minus",TermC.num_str @{thm subtrahiere_x_plus_minus}), (*"[| l is_const; m..|] ==> (k + m * n) - l * n = k + ( m - l) * n"*) - Thm ("subtrahiere_x_plus1_minus",TermC.num_str @{thm subtrahiere_x_plus1_minus}), + Celem.Thm ("subtrahiere_x_plus1_minus",TermC.num_str @{thm subtrahiere_x_plus1_minus}), (*"[| l is_const |] ==> (x + v) - l * v = x + (1 - l) * v"*) - Thm ("subtrahiere_x_plus_minus1",TermC.num_str @{thm subtrahiere_x_plus_minus1}), + Celem.Thm ("subtrahiere_x_plus_minus1",TermC.num_str @{thm subtrahiere_x_plus_minus1}), (*"[| m is_const |] ==> (x + m * v) - v = x + (m - 1) * v"*) - Thm ("subtrahiere_x_minus_plus",TermC.num_str @{thm subtrahiere_x_minus_plus}), + Celem.Thm ("subtrahiere_x_minus_plus",TermC.num_str @{thm subtrahiere_x_minus_plus}), (*"[| l is_const; m..|] ==> (k - m * n) + l * n = k + (-m + l) * n"*) - Thm ("subtrahiere_x_minus1_plus",TermC.num_str @{thm subtrahiere_x_minus1_plus}), + Celem.Thm ("subtrahiere_x_minus1_plus",TermC.num_str @{thm subtrahiere_x_minus1_plus}), (*"[| l is_const |] ==> (x - v) + l * v = x + (-1 + l) * v"*) - Thm ("subtrahiere_x_minus_plus1",TermC.num_str @{thm subtrahiere_x_minus_plus1}), + Celem.Thm ("subtrahiere_x_minus_plus1",TermC.num_str @{thm subtrahiere_x_minus_plus1}), (*"[| m is_const |] ==> (x - m * v) + v = x + (-m + 1) * v"*) - Thm ("subtrahiere_x_minus_minus",TermC.num_str @{thm subtrahiere_x_minus_minus}), + Celem.Thm ("subtrahiere_x_minus_minus",TermC.num_str @{thm subtrahiere_x_minus_minus}), (*"[| l is_const; m..|] ==> (k - m * n) - l * n = k + (-m - l) * n"*) - Thm ("subtrahiere_x_minus1_minus",TermC.num_str @{thm subtrahiere_x_minus1_minus}), + Celem.Thm ("subtrahiere_x_minus1_minus",TermC.num_str @{thm subtrahiere_x_minus1_minus}), (*"[| l is_const |] ==> (x - v) - l * v = x + (-1 - l) * v"*) - Thm ("subtrahiere_x_minus_minus1",TermC.num_str @{thm subtrahiere_x_minus_minus1}), + Celem.Thm ("subtrahiere_x_minus_minus1",TermC.num_str @{thm subtrahiere_x_minus_minus1}), (*"[| m is_const |] ==> (x - m * v) - v = x + (-m - 1) * v"*) - Calc ("Groups.plus_class.plus", eval_binop "#add_"), - Calc ("Groups.minus_class.minus", eval_binop "#subtr_"), + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Calc ("Groups.minus_class.minus", eval_binop "#subtr_"), - (*MG: Reihenfolge der folgenden 2 Thm muss so bleiben, wegen + (*MG: Reihenfolge der folgenden 2 Celem.Thm muss so bleiben, wegen (a+a)+a --> a + 2*a --> 3*a and not (a+a)+a --> 2*a + a *) - Thm ("real_mult_2_assoc_r",TermC.num_str @{thm real_mult_2_assoc_r}), + Celem.Thm ("real_mult_2_assoc_r",TermC.num_str @{thm real_mult_2_assoc_r}), (*"(k + z1) + z1 = k + 2 * z1"*) - Thm ("sym_real_mult_2",TermC.num_str (@{thm real_mult_2} RS @{thm sym})), + Celem.Thm ("sym_real_mult_2",TermC.num_str (@{thm real_mult_2} RS @{thm sym})), (*"z1 + z1 = 2 * z1"*) - Thm ("addiere_vor_minus",TermC.num_str @{thm addiere_vor_minus}), + Celem.Thm ("addiere_vor_minus",TermC.num_str @{thm addiere_vor_minus}), (*"[| l is_const; m is_const |] ==> -(l * v) + m * v = (-l + m) *v"*) - Thm ("addiere_eins_vor_minus",TermC.num_str @{thm addiere_eins_vor_minus}), + Celem.Thm ("addiere_eins_vor_minus",TermC.num_str @{thm addiere_eins_vor_minus}), (*"[| m is_const |] ==> - v + m * v = (-1 + m) * v"*) - Thm ("subtrahiere_vor_minus",TermC.num_str @{thm subtrahiere_vor_minus}), + Celem.Thm ("subtrahiere_vor_minus",TermC.num_str @{thm subtrahiere_vor_minus}), (*"[| l is_const; m is_const |] ==> -(l * v) - m * v = (-l - m) *v"*) - Thm ("subtrahiere_eins_vor_minus",TermC.num_str @{thm subtrahiere_eins_vor_minus}) + Celem.Thm ("subtrahiere_eins_vor_minus",TermC.num_str @{thm subtrahiere_eins_vor_minus}) (*"[| m is_const |] ==> - v - m * v = (-1 - m) * v"*) - ], scr = EmptyScr}:rls; + ], scr = Celem.EmptyScr}; val verschoenere = - Rls{id = "verschoenere", preconds = [], - rew_ord = ("dummy_ord", dummy_ord), srls = Erls, calc = [], errpatts = [], - erls = append_rls "erls_verschoenere" e_rls - [Calc ("PolyMinus.kleiner", eval_kleiner "")], - rules = [Thm ("vorzeichen_minus_weg1",TermC.num_str @{thm vorzeichen_minus_weg1}), + Celem.Rls{id = "verschoenere", preconds = [], + rew_ord = ("dummy_ord", Celem.dummy_ord), srls = Celem.Erls, calc = [], errpatts = [], + erls = Celem.append_rls "erls_verschoenere" Celem.e_rls + [Celem.Calc ("PolyMinus.kleiner", eval_kleiner "")], + rules = [Celem.Thm ("vorzeichen_minus_weg1",TermC.num_str @{thm vorzeichen_minus_weg1}), (*"l kleiner 0 ==> a + l * b = a - -l * b"*) - Thm ("vorzeichen_minus_weg2",TermC.num_str @{thm vorzeichen_minus_weg2}), + Celem.Thm ("vorzeichen_minus_weg2",TermC.num_str @{thm vorzeichen_minus_weg2}), (*"l kleiner 0 ==> a - l * b = a + -l * b"*) - Thm ("vorzeichen_minus_weg3",TermC.num_str @{thm vorzeichen_minus_weg3}), + Celem.Thm ("vorzeichen_minus_weg3",TermC.num_str @{thm vorzeichen_minus_weg3}), (*"l kleiner 0 ==> k + a - l * b = k + a + -l * b"*) - Thm ("vorzeichen_minus_weg4",TermC.num_str @{thm vorzeichen_minus_weg4}), + Celem.Thm ("vorzeichen_minus_weg4",TermC.num_str @{thm vorzeichen_minus_weg4}), (*"l kleiner 0 ==> k - a - l * b = k - a + -l * b"*) - Calc ("Groups.times_class.times", eval_binop "#mult_"), + Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"), - Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}), + Celem.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}), (*"0 * z = 0"*) - Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}), + Celem.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}), (*"1 * z = z"*) - Thm ("add_0_left",TermC.num_str @{thm add_0_left}), + Celem.Thm ("add_0_left",TermC.num_str @{thm add_0_left}), (*"0 + z = z"*) - Thm ("null_minus",TermC.num_str @{thm null_minus}), + Celem.Thm ("null_minus",TermC.num_str @{thm null_minus}), (*"0 - a = -a"*) - Thm ("vor_minus_mal",TermC.num_str @{thm vor_minus_mal}) + Celem.Thm ("vor_minus_mal",TermC.num_str @{thm vor_minus_mal}) (*"- a * b = (-a) * b"*) - (*Thm ("",TermC.num_str @{}),*) + (*Celem.Thm ("",TermC.num_str @{}),*) (**) - ], scr = EmptyScr}:rls (*end verschoenere*); + ], scr = Celem.EmptyScr} (*end verschoenere*); val klammern_aufloesen = - Rls{id = "klammern_aufloesen", preconds = [], - rew_ord = ("dummy_ord", dummy_ord), srls = Erls, calc = [], errpatts = [], erls = Erls, - rules = [Thm ("sym_add_assoc", + Celem.Rls{id = "klammern_aufloesen", preconds = [], + rew_ord = ("dummy_ord", Celem.dummy_ord), srls = Celem.Erls, calc = [], errpatts = [], erls = Celem.Erls, + rules = [Celem.Thm ("sym_add_assoc", TermC.num_str (@{thm add.assoc} RS @{thm sym})), (*"a + (b + c) = (a + b) + c"*) - Thm ("klammer_plus_minus",TermC.num_str @{thm klammer_plus_minus}), + Celem.Thm ("klammer_plus_minus",TermC.num_str @{thm klammer_plus_minus}), (*"a + (b - c) = (a + b) - c"*) - Thm ("klammer_minus_plus",TermC.num_str @{thm klammer_minus_plus}), + Celem.Thm ("klammer_minus_plus",TermC.num_str @{thm klammer_minus_plus}), (*"a - (b + c) = (a - b) - c"*) - Thm ("klammer_minus_minus",TermC.num_str @{thm klammer_minus_minus}) + Celem.Thm ("klammer_minus_minus",TermC.num_str @{thm klammer_minus_minus}) (*"a - (b - c) = (a - b) + c"*) - ], scr = EmptyScr}:rls; + ], scr = Celem.EmptyScr}; val klammern_ausmultiplizieren = - Rls{id = "klammern_ausmultiplizieren", preconds = [], - rew_ord = ("dummy_ord", dummy_ord), srls = Erls, calc = [], errpatts = [], erls = Erls, - rules = [Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}), + Celem.Rls{id = "klammern_ausmultiplizieren", preconds = [], + rew_ord = ("dummy_ord", Celem.dummy_ord), srls = Celem.Erls, calc = [], errpatts = [], erls = Celem.Erls, + rules = [Celem.Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}), (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*) - Thm ("distrib_left",TermC.num_str @{thm distrib_left}), + Celem.Thm ("distrib_left",TermC.num_str @{thm distrib_left}), (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*) - Thm ("klammer_mult_minus",TermC.num_str @{thm klammer_mult_minus}), + Celem.Thm ("klammer_mult_minus",TermC.num_str @{thm klammer_mult_minus}), (*"a * (b - c) = a * b - a * c"*) - Thm ("klammer_minus_mult",TermC.num_str @{thm klammer_minus_mult}) + Celem.Thm ("klammer_minus_mult",TermC.num_str @{thm klammer_minus_mult}) (*"(b - c) * a = b * a - c * a"*) - (*Thm ("",TermC.num_str @{}), + (*Celem.Thm ("",TermC.num_str @{}), (*""*)*) - ], scr = EmptyScr}:rls; + ], scr = Celem.EmptyScr}; val ordne_monome = - Rls{id = "ordne_monome", preconds = [], - rew_ord = ("dummy_ord", dummy_ord), srls = Erls, calc = [], errpatts = [], - erls = append_rls "erls_ordne_monome" e_rls - [Calc ("PolyMinus.kleiner", eval_kleiner ""), - Calc ("Atools.is'_atom", eval_is_atom "") + Celem.Rls{id = "ordne_monome", preconds = [], + rew_ord = ("dummy_ord", Celem.dummy_ord), srls = Celem.Erls, calc = [], errpatts = [], + erls = Celem.append_rls "erls_ordne_monome" Celem.e_rls + [Celem.Calc ("PolyMinus.kleiner", eval_kleiner ""), + Celem.Calc ("Atools.is'_atom", eval_is_atom "") ], - rules = [Thm ("tausche_mal",TermC.num_str @{thm tausche_mal}), + rules = [Celem.Thm ("tausche_mal",TermC.num_str @{thm tausche_mal}), (*"[| b is_atom; a kleiner b |] ==> (b * a) = (a * b)"*) - Thm ("tausche_vor_mal",TermC.num_str @{thm tausche_vor_mal}), + Celem.Thm ("tausche_vor_mal",TermC.num_str @{thm tausche_vor_mal}), (*"[| b is_atom; a kleiner b |] ==> (-b * a) = (-a * b)"*) - Thm ("tausche_mal_mal",TermC.num_str @{thm tausche_mal_mal}), + Celem.Thm ("tausche_mal_mal",TermC.num_str @{thm tausche_mal_mal}), (*"[| c is_atom; b kleiner c |] ==> (a * c * b) = (a * b *c)"*) - Thm ("x_quadrat",TermC.num_str @{thm x_quadrat}) + Celem.Thm ("x_quadrat",TermC.num_str @{thm x_quadrat}) (*"(x * a) * a = x * a ^^^ 2"*) - (*Thm ("",TermC.num_str @{}), + (*Celem.Thm ("",TermC.num_str @{}), (*""*)*) - ], scr = EmptyScr}:rls; + ], scr = Celem.EmptyScr}; val rls_p_33 = - append_rls "rls_p_33" e_rls - [Rls_ ordne_alphabetisch, - Rls_ fasse_zusammen, - Rls_ verschoenere + Celem.append_rls "rls_p_33" Celem.e_rls + [Celem.Rls_ ordne_alphabetisch, + Celem.Rls_ fasse_zusammen, + Celem.Rls_ verschoenere ]; val rls_p_34 = - append_rls "rls_p_34" e_rls - [Rls_ klammern_aufloesen, - Rls_ ordne_alphabetisch, - Rls_ fasse_zusammen, - Rls_ verschoenere + Celem.append_rls "rls_p_34" Celem.e_rls + [Celem.Rls_ klammern_aufloesen, + Celem.Rls_ ordne_alphabetisch, + Celem.Rls_ fasse_zusammen, + Celem.Rls_ verschoenere ]; val rechnen = - append_rls "rechnen" e_rls - [Calc ("Groups.times_class.times", eval_binop "#mult_"), - Calc ("Groups.plus_class.plus", eval_binop "#add_"), - Calc ("Groups.minus_class.minus", eval_binop "#subtr_") + Celem.append_rls "rechnen" Celem.e_rls + [Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"), + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Calc ("Groups.minus_class.minus", eval_binop "#subtr_") ]; *} setup {* KEStore_Elems.add_rlss @@ -397,9 +397,9 @@ (** problems **) setup {* KEStore_Elems.add_pbts - [(Specify.prep_pbt thy "pbl_vereinf_poly" [] e_pblID - (["polynom","vereinfachen"], [], Erls, NONE, [])), - (Specify.prep_pbt thy "pbl_vereinf_poly_minus" [] e_pblID + [(Specify.prep_pbt thy "pbl_vereinf_poly" [] Celem.e_pblID + (["polynom","vereinfachen"], [], Celem.Erls, NONE, [])), + (Specify.prep_pbt thy "pbl_vereinf_poly_minus" [] Celem.e_pblID (["plus_minus","polynom","vereinfachen"], [("#Given", ["Term t_t"]), ("#Where", ["t_t is_polyexp", @@ -412,19 +412,19 @@ " matchsub ((?b + ?c) * ?a) t_t | " ^ " matchsub ((?b - ?c) * ?a) t_t )"]), ("#Find", ["normalform n_n"])], - append_rls "prls_pbl_vereinf_poly" e_rls - [Calc ("Poly.is'_polyexp", eval_is_polyexp ""), - Calc ("Tools.matchsub", eval_matchsub ""), - Thm ("or_true", TermC.num_str @{thm or_true}), + Celem.append_rls "prls_pbl_vereinf_poly" Celem.e_rls + [Celem.Calc ("Poly.is'_polyexp", eval_is_polyexp ""), + Celem.Calc ("Tools.matchsub", eval_matchsub ""), + Celem.Thm ("or_true", TermC.num_str @{thm or_true}), (*"(?a | True) = True"*) - Thm ("or_false", TermC.num_str @{thm or_false}), + Celem.Thm ("or_false", TermC.num_str @{thm or_false}), (*"(?a | False) = ?a"*) - Thm ("not_true",TermC.num_str @{thm not_true}), + Celem.Thm ("not_true",TermC.num_str @{thm not_true}), (*"(~ True) = False"*) - Thm ("not_false",TermC.num_str @{thm not_false}) + Celem.Thm ("not_false",TermC.num_str @{thm not_false}) (*"(~ False) = True"*)], SOME "Vereinfache t_t", [["simplification","for_polynomials","with_minus"]])), - (Specify.prep_pbt thy "pbl_vereinf_poly_klammer" [] e_pblID + (Specify.prep_pbt thy "pbl_vereinf_poly_klammer" [] Celem.e_pblID (["klammer","polynom","vereinfachen"], [("#Given" ,["Term t_t"]), ("#Where" ,["t_t is_polyexp", @@ -433,50 +433,50 @@ " matchsub ((?b + ?c) * ?a) t_t | " ^ " matchsub ((?b - ?c) * ?a) t_t )"]), ("#Find" ,["normalform n_n"])], - append_rls "prls_pbl_vereinf_poly_klammer" e_rls - [Calc ("Poly.is'_polyexp", eval_is_polyexp ""), - Calc ("Tools.matchsub", eval_matchsub ""), - Thm ("or_true", TermC.num_str @{thm or_true}), + Celem.append_rls "prls_pbl_vereinf_poly_klammer" Celem.e_rls + [Celem.Calc ("Poly.is'_polyexp", eval_is_polyexp ""), + Celem.Calc ("Tools.matchsub", eval_matchsub ""), + Celem.Thm ("or_true", TermC.num_str @{thm or_true}), (*"(?a | True) = True"*) - Thm ("or_false", TermC.num_str @{thm or_false}), + Celem.Thm ("or_false", TermC.num_str @{thm or_false}), (*"(?a | False) = ?a"*) - Thm ("not_true",TermC.num_str @{thm not_true}), + Celem.Thm ("not_true",TermC.num_str @{thm not_true}), (*"(~ True) = False"*) - Thm ("not_false",TermC.num_str @{thm not_false}) + Celem.Thm ("not_false",TermC.num_str @{thm not_false}) (*"(~ False) = True"*)], SOME "Vereinfache t_t", [["simplification","for_polynomials","with_parentheses"]])), - (Specify.prep_pbt thy "pbl_vereinf_poly_klammer_mal" [] e_pblID + (Specify.prep_pbt thy "pbl_vereinf_poly_klammer_mal" [] Celem.e_pblID (["binom_klammer","polynom","vereinfachen"], [("#Given", ["Term t_t"]), ("#Where", ["t_t is_polyexp"]), ("#Find", ["normalform n_n"])], - append_rls "e_rls" e_rls [(*for preds in where_*) - Calc ("Poly.is'_polyexp", eval_is_polyexp "")], + Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*) + Celem.Calc ("Poly.is'_polyexp", eval_is_polyexp "")], SOME "Vereinfache t_t", [["simplification","for_polynomials","with_parentheses_mult"]])), - (Specify.prep_pbt thy "pbl_probe" [] e_pblID (["probe"], [], Erls, NONE, [])), - (Specify.prep_pbt thy "pbl_probe_poly" [] e_pblID + (Specify.prep_pbt thy "pbl_probe" [] Celem.e_pblID (["probe"], [], Celem.Erls, NONE, [])), + (Specify.prep_pbt thy "pbl_probe_poly" [] Celem.e_pblID (["polynom","probe"], [("#Given", ["Pruefe e_e", "mitWert w_w"]), ("#Where", ["e_e is_polyexp"]), ("#Find", ["Geprueft p_p"])], - append_rls "prls_pbl_probe_poly" e_rls [(*for preds in where_*) - Calc ("Poly.is'_polyexp", eval_is_polyexp "")], + Celem.append_rls "prls_pbl_probe_poly" Celem.e_rls [(*for preds in where_*) + Celem.Calc ("Poly.is'_polyexp", eval_is_polyexp "")], SOME "Probe e_e w_w", [["probe","fuer_polynom"]])), - (Specify.prep_pbt thy "pbl_probe_bruch" [] e_pblID + (Specify.prep_pbt thy "pbl_probe_bruch" [] Celem.e_pblID (["bruch","probe"], [("#Given" ,["Pruefe e_e", "mitWert w_w"]), ("#Where" ,["e_e is_ratpolyexp"]), ("#Find" ,["Geprueft p_p"])], - append_rls "prls_pbl_probe_bruch" e_rls [(*for preds in where_*) - Calc ("Rational.is'_ratpolyexp", eval_is_ratpolyexp "")], + Celem.append_rls "prls_pbl_probe_bruch" Celem.e_rls [(*for preds in where_*) + Celem.Calc ("Rational.is'_ratpolyexp", eval_is_ratpolyexp "")], SOME "Probe e_e w_w", [["probe","fuer_bruch"]]))] *} (** methods **) setup {* KEStore_Elems.add_mets - [Specify.prep_met thy "met_simp_poly_minus" [] e_metID + [Specify.prep_met thy "met_simp_poly_minus" [] Celem.e_metID (["simplification","for_polynomials","with_minus"], [("#Given" ,["Term t_t"]), ("#Where" ,["t_t is_polyexp", @@ -485,44 +485,44 @@ " matchsub (?a - (?b + ?c)) t_t | " ^ " matchsub (?a + (?b - ?c)) t_t )"]), ("#Find" ,["normalform n_n"])], - {rew_ord'="tless_true", rls' = e_rls, calc = [], srls = e_rls, - prls = append_rls "prls_met_simp_poly_minus" e_rls - [Calc ("Poly.is'_polyexp", eval_is_polyexp ""), - Calc ("Tools.matchsub", eval_matchsub ""), - Thm ("and_true",TermC.num_str @{thm and_true}), + {rew_ord'="tless_true", rls' = Celem.e_rls, calc = [], srls = Celem.e_rls, + prls = Celem.append_rls "prls_met_simp_poly_minus" Celem.e_rls + [Celem.Calc ("Poly.is'_polyexp", eval_is_polyexp ""), + Celem.Calc ("Tools.matchsub", eval_matchsub ""), + Celem.Thm ("and_true",TermC.num_str @{thm and_true}), (*"(?a & True) = ?a"*) - Thm ("and_false",TermC.num_str @{thm and_false}), + Celem.Thm ("and_false",TermC.num_str @{thm and_false}), (*"(?a & False) = False"*) - Thm ("not_true",TermC.num_str @{thm not_true}), + Celem.Thm ("not_true",TermC.num_str @{thm not_true}), (*"(~ True) = False"*) - Thm ("not_false",TermC.num_str @{thm not_false}) + Celem.Thm ("not_false",TermC.num_str @{thm not_false}) (*"(~ False) = True"*)], - crls = e_rls, errpats = [], nrls = rls_p_33}, + crls = Celem.e_rls, errpats = [], nrls = rls_p_33}, "Script SimplifyScript (t_t::real) = " ^ " ((Repeat((Try (Rewrite_Set ordne_alphabetisch False)) @@ " ^ " (Try (Rewrite_Set fasse_zusammen False)) @@ " ^ " (Try (Rewrite_Set verschoenere False)))) t_t)"), - Specify.prep_met thy "met_simp_poly_parenth" [] e_metID + Specify.prep_met thy "met_simp_poly_parenth" [] Celem.e_metID (["simplification","for_polynomials","with_parentheses"], [("#Given" ,["Term t_t"]), ("#Where" ,["t_t is_polyexp"]), ("#Find" ,["normalform n_n"])], - {rew_ord'="tless_true", rls' = e_rls, calc = [], srls = e_rls, - prls = append_rls "simplification_for_polynomials_prls" e_rls - [(*for preds in where_*) Calc("Poly.is'_polyexp",eval_is_polyexp"")], - crls = e_rls, errpats = [], nrls = rls_p_34}, + {rew_ord'="tless_true", rls' = Celem.e_rls, calc = [], srls = Celem.e_rls, + prls = Celem.append_rls "simplification_for_polynomials_prls" Celem.e_rls + [(*for preds in where_*) Celem.Calc("Poly.is'_polyexp",eval_is_polyexp"")], + crls = Celem.e_rls, errpats = [], nrls = rls_p_34}, "Script SimplifyScript (t_t::real) = " ^ " ((Repeat((Try (Rewrite_Set klammern_aufloesen False)) @@ " ^ " (Try (Rewrite_Set ordne_alphabetisch False)) @@ " ^ " (Try (Rewrite_Set fasse_zusammen False)) @@ " ^ " (Try (Rewrite_Set verschoenere False)))) t_t)"), - Specify.prep_met thy "met_simp_poly_parenth_mult" [] e_metID + Specify.prep_met thy "met_simp_poly_parenth_mult" [] Celem.e_metID (["simplification","for_polynomials","with_parentheses_mult"], [("#Given" ,["Term t_t"]), ("#Where" ,["t_t is_polyexp"]), ("#Find" ,["normalform n_n"])], - {rew_ord'="tless_true", rls' = e_rls, calc = [], srls = e_rls, - prls = append_rls "simplification_for_polynomials_prls" e_rls - [(*for preds in where_*) Calc("Poly.is'_polyexp",eval_is_polyexp"")], - crls = e_rls, errpats = [], nrls = rls_p_34}, + {rew_ord'="tless_true", rls' = Celem.e_rls, calc = [], srls = Celem.e_rls, + prls = Celem.append_rls "simplification_for_polynomials_prls" Celem.e_rls + [(*for preds in where_*) Celem.Calc("Poly.is'_polyexp",eval_is_polyexp"")], + crls = Celem.e_rls, errpats = [], nrls = rls_p_34}, "Script SimplifyScript (t_t::real) = " ^ " ((Repeat((Try (Rewrite_Set klammern_ausmultiplizieren False)) @@ " ^ " (Try (Rewrite_Set discard_parentheses False)) @@ " ^ @@ -531,35 +531,35 @@ " (Try (Rewrite_Set ordne_alphabetisch False)) @@ " ^ " (Try (Rewrite_Set fasse_zusammen False)) @@ " ^ " (Try (Rewrite_Set verschoenere False)))) t_t)"), - Specify.prep_met thy "met_probe" [] e_metID + Specify.prep_met thy "met_probe" [] Celem.e_metID (["probe"], [], - {rew_ord'="tless_true", rls' = e_rls, calc = [], srls = e_rls, prls = Erls, crls = e_rls, - errpats = [], nrls = Erls}, + {rew_ord'="tless_true", rls' = Celem.e_rls, calc = [], srls = Celem.e_rls, prls = Celem.Erls, crls = Celem.e_rls, + errpats = [], nrls = Celem.Erls}, "empty_script"), - Specify.prep_met thy "met_probe_poly" [] e_metID + Specify.prep_met thy "met_probe_poly" [] Celem.e_metID (["probe","fuer_polynom"], [("#Given" ,["Pruefe e_e", "mitWert w_w"]), ("#Where" ,["e_e is_polyexp"]), ("#Find" ,["Geprueft p_p"])], - {rew_ord'="tless_true", rls' = e_rls, calc = [], srls = e_rls, - prls = append_rls "prls_met_probe_bruch" e_rls - [(*for preds in where_*) Calc ("Rational.is'_ratpolyexp", eval_is_ratpolyexp "")], - crls = e_rls, errpats = [], nrls = rechnen}, + {rew_ord'="tless_true", rls' = Celem.e_rls, calc = [], srls = Celem.e_rls, + prls = Celem.append_rls "prls_met_probe_bruch" Celem.e_rls + [(*for preds in where_*) Celem.Calc ("Rational.is'_ratpolyexp", eval_is_ratpolyexp "")], + crls = Celem.e_rls, errpats = [], nrls = rechnen}, "Script ProbeScript (e_e::bool) (w_w::bool list) = " ^ " (let e_e = Take e_e; " ^ " e_e = Substitute w_w e_e " ^ " in (Repeat((Try (Repeat (Calculate TIMES))) @@ " ^ " (Try (Repeat (Calculate PLUS ))) @@ " ^ " (Try (Repeat (Calculate MINUS))))) e_e)"), - Specify.prep_met thy "met_probe_bruch" [] e_metID + Specify.prep_met thy "met_probe_bruch" [] Celem.e_metID (["probe","fuer_bruch"], [("#Given" ,["Pruefe e_e", "mitWert w_w"]), ("#Where" ,["e_e is_ratpolyexp"]), ("#Find" ,["Geprueft p_p"])], - {rew_ord'="tless_true", rls' = e_rls, calc = [], srls = e_rls, - prls = append_rls "prls_met_probe_bruch" e_rls - [(*for preds in where_*) Calc ("Rational.is'_ratpolyexp", eval_is_ratpolyexp "")], - crls = e_rls, errpats = [], nrls = Erls}, + {rew_ord'="tless_true", rls' = Celem.e_rls, calc = [], srls = Celem.e_rls, + prls = Celem.append_rls "prls_met_probe_bruch" Celem.e_rls + [(*for preds in where_*) Celem.Calc ("Rational.is'_ratpolyexp", eval_is_ratpolyexp "")], + crls = Celem.e_rls, errpats = [], nrls = Celem.Erls}, "empty_script")] *} diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/RatEq.thy --- a/src/Tools/isac/Knowledge/RatEq.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/RatEq.thy Thu Mar 15 12:42:04 2018 +0100 @@ -75,103 +75,103 @@ fun eval_is_ratequation_in _ _ (p as (Const ("RatEq.is'_ratequation'_in",_) $ t $ v)) _ = if is_rateqation_in t v then - SOME ((term2str p) ^ " = True", + SOME ((Celem.term2str p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True}))) - else SOME ((term2str p) ^ " = True", + else SOME ((Celem.term2str p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False}))) | eval_is_ratequation_in _ _ _ _ = ((*tracing"### nichts matcht";*) NONE); (*-------------------------rulse-----------------------*) val RatEq_prls = (*15.10.02:just the following order due to subterm evaluation*) - append_rls "RatEq_prls" e_rls - [Calc ("Atools.ident",eval_ident "#ident_"), - Calc ("Tools.matches",eval_matches ""), - Calc ("Tools.lhs" ,eval_lhs ""), - Calc ("Tools.rhs" ,eval_rhs ""), - Calc ("RatEq.is'_ratequation'_in",eval_is_ratequation_in ""), - Calc ("HOL.eq",eval_equal "#equal_"), - Thm ("not_true",TermC.num_str @{thm not_true}), - Thm ("not_false",TermC.num_str @{thm not_false}), - Thm ("and_true",TermC.num_str @{thm and_true}), - Thm ("and_false",TermC.num_str @{thm and_false}), - Thm ("or_true",TermC.num_str @{thm or_true}), - Thm ("or_false",TermC.num_str @{thm or_false}) + Celem.append_rls "RatEq_prls" Celem.e_rls + [Celem.Calc ("Atools.ident",eval_ident "#ident_"), + Celem.Calc ("Tools.matches",eval_matches ""), + Celem.Calc ("Tools.lhs" ,eval_lhs ""), + Celem.Calc ("Tools.rhs" ,eval_rhs ""), + Celem.Calc ("RatEq.is'_ratequation'_in",eval_is_ratequation_in ""), + Celem.Calc ("HOL.eq",eval_equal "#equal_"), + Celem.Thm ("not_true",TermC.num_str @{thm not_true}), + Celem.Thm ("not_false",TermC.num_str @{thm not_false}), + Celem.Thm ("and_true",TermC.num_str @{thm and_true}), + Celem.Thm ("and_false",TermC.num_str @{thm and_false}), + Celem.Thm ("or_true",TermC.num_str @{thm or_true}), + Celem.Thm ("or_false",TermC.num_str @{thm or_false}) ]; -(*rls = merge_rls erls Poly_erls *) +(*rls = Celem.merge_rls erls Poly_erls *) val rateq_erls = - remove_rls "rateq_erls" (*WN: ein Hack*) - (merge_rls "is_ratequation_in" calculate_Rational - (append_rls "is_ratequation_in" + Celem.remove_rls "rateq_erls" (*WN: ein Hack*) + (Celem.merge_rls "is_ratequation_in" calculate_Rational + (Celem.append_rls "is_ratequation_in" Poly_erls - [(*Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),*) - Calc ("RatEq.is'_ratequation'_in", + [(*Celem.Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),*) + Celem.Calc ("RatEq.is'_ratequation'_in", eval_is_ratequation_in "") ])) - [Thm ("and_commute",TermC.num_str @{thm and_commute}), (*WN: ein Hack*) - Thm ("or_commute",TermC.num_str @{thm or_commute}) (*WN: ein Hack*) + [Celem.Thm ("and_commute",TermC.num_str @{thm and_commute}), (*WN: ein Hack*) + Celem.Thm ("or_commute",TermC.num_str @{thm or_commute}) (*WN: ein Hack*) ]; *} setup {* KEStore_Elems.add_rlss [("rateq_erls", (Context.theory_name @{theory}, rateq_erls))] *} ML {* val RatEq_crls = - remove_rls "RatEq_crls" (*WN: ein Hack*) - (merge_rls "is_ratequation_in" calculate_Rational - (append_rls "is_ratequation_in" + Celem.remove_rls "RatEq_crls" (*WN: ein Hack*) + (Celem.merge_rls "is_ratequation_in" calculate_Rational + (Celem.append_rls "is_ratequation_in" Poly_erls - [(*Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),*) - Calc ("RatEq.is'_ratequation'_in", + [(*Celem.Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"),*) + Celem.Calc ("RatEq.is'_ratequation'_in", eval_is_ratequation_in "") ])) - [Thm ("and_commute",TermC.num_str @{thm and_commute}), (*WN: ein Hack*) - Thm ("or_commute",TermC.num_str @{thm or_commute}) (*WN: ein Hack*) + [Celem.Thm ("and_commute",TermC.num_str @{thm and_commute}), (*WN: ein Hack*) + Celem.Thm ("or_commute",TermC.num_str @{thm or_commute}) (*WN: ein Hack*) ]; val RatEq_eliminate = prep_rls'( - Rls {id = "RatEq_eliminate", preconds = [], - rew_ord = ("termlessI", termlessI), erls = rateq_erls, srls = Erls, + Celem.Rls {id = "RatEq_eliminate", preconds = [], + rew_ord = ("termlessI", termlessI), erls = rateq_erls, srls = Celem.Erls, calc = [], errpatts = [], rules = [ - Thm("rat_mult_denominator_both",TermC.num_str @{thm rat_mult_denominator_both}), + Celem.Thm("rat_mult_denominator_both",TermC.num_str @{thm rat_mult_denominator_both}), (* a/b=c/d -> ad=cb *) - Thm("rat_mult_denominator_left",TermC.num_str @{thm rat_mult_denominator_left}), + Celem.Thm("rat_mult_denominator_left",TermC.num_str @{thm rat_mult_denominator_left}), (* a =c/d -> ad=c *) - Thm("rat_mult_denominator_right",TermC.num_str @{thm rat_mult_denominator_right}) + Celem.Thm("rat_mult_denominator_right",TermC.num_str @{thm rat_mult_denominator_right}) (* a/b=c -> a=cb *) ], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls); + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }); *} setup {* KEStore_Elems.add_rlss [("RatEq_eliminate", (Context.theory_name @{theory}, RatEq_eliminate))] *} ML {* val RatEq_simplify = prep_rls'( - Rls {id = "RatEq_simplify", preconds = [], rew_ord = ("termlessI", termlessI), - erls = rateq_erls, srls = Erls, calc = [], errpatts = [], + Celem.Rls {id = "RatEq_simplify", preconds = [], rew_ord = ("termlessI", termlessI), + erls = rateq_erls, srls = Celem.Erls, calc = [], errpatts = [], rules = [ - Thm("real_rat_mult_1",TermC.num_str @{thm real_rat_mult_1}), + Celem.Thm("real_rat_mult_1",TermC.num_str @{thm real_rat_mult_1}), (*a*(b/c) = (a*b)/c*) - Thm("real_rat_mult_2",TermC.num_str @{thm real_rat_mult_2}), + Celem.Thm("real_rat_mult_2",TermC.num_str @{thm real_rat_mult_2}), (*(a/b)*(c/d) = (a*c)/(b*d)*) - Thm("real_rat_mult_3",TermC.num_str @{thm real_rat_mult_3}), + Celem.Thm("real_rat_mult_3",TermC.num_str @{thm real_rat_mult_3}), (* (a/b)*c = (a*c)/b*) - Thm("real_rat_pow",TermC.num_str @{thm real_rat_pow}), + Celem.Thm("real_rat_pow",TermC.num_str @{thm real_rat_pow}), (*(a/b)^^^2 = a^^^2/b^^^2*) - Thm("real_diff_minus",TermC.num_str @{thm real_diff_minus}), + Celem.Thm("real_diff_minus",TermC.num_str @{thm real_diff_minus}), (* a - b = a + (-1) * b *) - Thm("rat_double_rat_1",TermC.num_str @{thm rat_double_rat_1}), + Celem.Thm("rat_double_rat_1",TermC.num_str @{thm rat_double_rat_1}), (* (a / (c/d) = (a*d) / c) *) - Thm("rat_double_rat_2",TermC.num_str @{thm rat_double_rat_2}), + Celem.Thm("rat_double_rat_2",TermC.num_str @{thm rat_double_rat_2}), (* ((a/b) / (c/d) = (a*d) / (b*c)) *) - Thm("rat_double_rat_3",TermC.num_str @{thm rat_double_rat_3}) + Celem.Thm("rat_double_rat_3",TermC.num_str @{thm rat_double_rat_3}) (* ((a/b) / c = a / (b*c) ) *) ], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls); + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }); *} setup {* KEStore_Elems.add_rlss [("RatEq_simplify", (Context.theory_name @{theory}, RatEq_simplify))] *} @@ -183,7 +183,7 @@ *) *} setup {* KEStore_Elems.add_pbts - [(Specify.prep_pbt thy "pbl_equ_univ_rat" [] e_pblID + [(Specify.prep_pbt thy "pbl_equ_univ_rat" [] Celem.e_pblID (["rational","univariate","equation"], [("#Given", ["equality e_e","solveFor v_v"]), ("#Where", ["(e_e::bool) is_ratequation_in (v_v::real)"]), @@ -192,16 +192,16 @@ (*-------------------------methods-----------------------*) setup {* KEStore_Elems.add_mets - [Specify.prep_met thy "met_rateq" [] e_metID + [Specify.prep_met thy "met_rateq" [] Celem.e_metID (["RatEq"], [], - {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = e_rls, prls=e_rls, + {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = Celem.e_rls, prls=Celem.e_rls, crls=RatEq_crls, errpats = [], nrls = norm_Rational}, "empty_script"), - Specify.prep_met thy "met_rat_eq" [] e_metID + Specify.prep_met thy "met_rat_eq" [] Celem.e_metID (["RatEq", "solve_rat_equation"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["(e_e::bool) is_ratequation_in (v_v::real)"]), ("#Find" ,["solutions v_v'i'"])], - {rew_ord'="termlessI", rls'=rateq_erls, srls=e_rls, prls=RatEq_prls, calc=[], + {rew_ord'="termlessI", rls'=rateq_erls, srls=Celem.e_rls, prls=RatEq_prls, calc=[], crls=RatEq_crls, errpats = [], nrls = norm_Rational}, "Script Solve_rat_equation (e_e::bool) (v_v::real) = " ^ "(let e_e = ((Repeat(Try (Rewrite_Set RatEq_simplify True))) @@ " ^ diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/Rational-WN.sml --- a/src/Tools/isac/Knowledge/Rational-WN.sml Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/Rational-WN.sml Thu Mar 15 12:42:04 2018 +0100 @@ -21,7 +21,7 @@ (*diese vvv funktionen kommen nach src/Isa99/termC.sml -------------*) -fun term2str t = +fun Celem.term2str t = let fun ato (Const(a,T)) n = "\n"^indent n^"Const ( "^a^")" | ato (Free (a,T)) n = @@ -35,8 +35,8 @@ | ato (f$t') n = ato f n^ato t' (n+1) in "\n-------------"^ato t 0^"\n" end; fun free2int (t as Free (s, _)) = (((the o int_of_str) s) - handle _ => error ("free2int: "^term2str t)) - | free2int t = error ("free2int: "^term2str t); + handle _ => error ("free2int: "^Celem.term2str t)) + | free2int t = error ("free2int: "^Celem.term2str t); (*diese ^^^ funktionen kommen nach src/Isa99/termC.sml -------------*) @@ -56,12 +56,12 @@ fun mono (Const ("RatArith.pow",_) $ t1 $ t2) v g = if t1 = v then ((replicate ((free2int t2) - g) 0) @ [1]) : poly - else error ("term2poly.1 "^term2str t1) + else error ("term2poly.1 "^Celem.term2str t1) | mono (t as Const ("Groups.times_class.times",_) $ t1 $ (Const ("RatArith.pow",_) $ t2 $ t3)) v g = if t2 = v then (replicate ((free2int t3) - g) 0) @ [free2int t1] - else error ("term2poly.2 "^term2str t) - | mono t _ _ = error ("term2poly.3 "^term2str t); + else error ("term2poly.2 "^Celem.term2str t) + | mono t _ _ = error ("term2poly.3 "^Celem.term2str t); fun poly (Const ("Groups.plus_class.plus",_) $ t1 $ t2) v g = let val l = mono t1 v g @@ -185,34 +185,34 @@ "***************************************************************************"; fun rewrite_set_' thy rls put_asm ruless ct = case ruless of - Rrls _ => error "rewrite_set_' not for Rrls" - | Rls _ => + Celem.Rrls _ => error "rewrite_set_' not for Celem.Rrls" + | Celem.Rls _ => let datatype switch = Appl | Noap; fun rew_once ruls asm ct Noap [] = (ct,asm) | rew_once ruls asm ct Appl [] = rew_once ruls asm ct Noap ruls | rew_once ruls asm ct apno (rul::thms) = case rul of - Thm (thmid, thm) => - (case rewrite_ thy ((snd o #rew_ord o rep_rls) ruless) - rls put_asm (thm_of_thm rul) ct of + Celem.Thm (thmid, thm) => + (case rewrite_ thy ((snd o #rew_ord o Celem.rep_rls) ruless) + rls put_asm (Celem.thm_of_thm rul) ct of NONE => rew_once ruls asm ct apno thms | SOME (ct',asm') => rew_once ruls (asm union asm') ct' Appl (rul::thms)) - | Calc (cc as (op_,_)) => + | Celem.Calc (cc as (op_,_)) => (case adhoc_thm thy cc ct of NONE => rew_once ruls asm ct apno thms | SOME (thmid, thm') => let val pairopt = - rewrite_ thy ((snd o #rew_ord o rep_rls) ruless) + rewrite_ thy ((snd o #rew_ord o Celem.rep_rls) ruless) rls put_asm thm' ct; val _ = if pairopt <> NONE then () else error("rewrite_set_, rewrite_ \""^ (string_of_thmI thm')^"\" \""^ - (Syntax.string_of_term (thy2ctxt thy) ct)^"\" = NONE") + (Syntax.string_of_term (Celem.thy2ctxt thy) ct)^"\" = NONE") in rew_once ruls asm ((fst o the) pairopt) Appl(rul::thms) end); - val ruls = (#rules o rep_rls) ruless; + val ruls = (#rules o Celem.rep_rls) ruless; val (ct',asm') = rew_once ruls [] ct Noap ruls; in if ct = ct' then NONE else SOME (ct',asm') end; @@ -221,34 +221,34 @@ *) fun rewrite_set_' thy rls put_asm ruless ct = case ruless of - Rrls _ => error "rewrite_set_' not for Rrls" - | Rls _ => + Celem.Rrls _ => error "rewrite_set_' not for Celem.Rrls" + | Celem.Rls _ => let datatype switch = Appl | Noap; fun rew_once ruls asm ct Noap [] = (ct,asm) | rew_once ruls asm ct Appl [] = rew_once ruls asm ct Noap ruls | rew_once ruls asm ct apno (rul::thms) = case rul of - Thm (thmid, thm) => - (case rewrite_ thy ((snd o #rew_ord o rep_rls) ruless) - rls put_asm (thm_of_thm rul) ct of + Celem.Thm (thmid, thm) => + (case rewrite_ thy ((snd o #rew_ord o Celem.rep_rls) ruless) + rls put_asm (Celem.thm_of_thm rul) ct of NONE => rew_once ruls asm ct apno thms | SOME (ct',asm') => rew_once ruls (asm union asm') ct' Appl (rul::thms)) - | Calc (cc as (op_,_)) => + | Celem.Calc (cc as (op_,_)) => (case adhoc_thm thy cc ct of NONE => rew_once ruls asm ct apno thms | SOME (thmid, thm') => let val pairopt = - rewrite_ thy ((snd o #rew_ord o rep_rls) ruless) + rewrite_ thy ((snd o #rew_ord o Celem.rep_rls) ruless) rls put_asm thm' ct; val _ = if pairopt <> NONE then () else error("rewrite_set_, rewrite_ \""^ (string_of_thmI thm')^"\" \""^ - (Syntax.string_of_term (thy2ctxt thy) ct)^"\" = NONE") + (Syntax.string_of_term (Celem.thy2ctxt thy) ct)^"\" = NONE") in rew_once ruls asm ((fst o the) pairopt) Appl(rul::thms) end); - val ruls = (#rules o rep_rls) ruless; + val ruls = (#rules o Celem.rep_rls) ruless; val (ct',asm') = rew_once ruls [] ct Noap ruls; in if ct = ct' then NONE else SOME (ct',asm') end; diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/Rational.thy --- a/src/Tools/isac/Knowledge/Rational.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/Rational.thy Thu Mar 15 12:42:04 2018 +0100 @@ -11,7 +11,7 @@ imports Poly "~~/src/Tools/isac/Knowledge/GCD_Poly_ML" begin -section {* Constants for evaluation by "Calc" *} +section {* Constants for evaluation by "Celem.Calc" *} consts is'_expanded :: "real => bool" ("_ is'_expanded") (*RL->Poly.thy*) @@ -43,9 +43,9 @@ fun eval_is_ratpolyexp (thmid:string) _ (t as (Const("Rational.is'_ratpolyexp", _) $ arg)) thy = if is_ratpolyexp arg - then SOME (TermC.mk_thmid thmid (term_to_string''' thy arg) "", + then SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg) "", HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True}))) - else SOME (TermC.mk_thmid thmid (term_to_string''' thy arg) "", + else SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg) "", HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False}))) | eval_is_ratpolyexp _ _ _ _ = NONE; @@ -54,7 +54,7 @@ (t as Const ("Rational.get_denominator", _) $ (Const ("Rings.divide_class.divide", _) $ num $ denom)) thy = - SOME (TermC.mk_thmid thmid (term_to_string''' thy denom) "", + SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy denom) "", HOLogic.Trueprop $ (TermC.mk_equality (t, denom))) | eval_get_denominator _ _ _ _ = NONE; @@ -63,7 +63,7 @@ (t as Const ("Rational.get_numerator", _) $ (Const ("Rings.divide_class.divide", _) $num $denom )) thy = - SOME (TermC.mk_thmid thmid (term_to_string''' thy num) "", + SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy num) "", HOLogic.Trueprop $ (TermC.mk_equality (t, num))) | eval_get_numerator _ _ _ _ = NONE; *} @@ -130,7 +130,7 @@ | monom_of_term vs (c, es) (Const ("Groups.times_class.times", _) $ m1 $ m2) = let val (c', es') = monom_of_term vs (c, es) m1 in monom_of_term vs (c', es') m2 end - | monom_of_term _ _ t = raise ERROR ("poly malformed with " ^ term2str t) + | monom_of_term _ _ t = raise ERROR ("poly malformed with " ^ Celem.term2str t) fun monoms_of_term vs (t as Free _) = [monom_of_term vs (1, replicate (length vs) 0) t] @@ -140,7 +140,7 @@ [monom_of_term vs (1, replicate (length vs) 0) t] | monoms_of_term vs (Const ("Groups.plus_class.plus", _) $ ms1 $ ms2) = (monoms_of_term vs ms1) @ (monoms_of_term vs ms2) - | monoms_of_term _ t = raise ERROR ("poly malformed with " ^ term2str t) + | monoms_of_term _ t = raise ERROR ("poly malformed with " ^ Celem.term2str t) (* convert a term to the internal representation of a multivariate polynomial; the conversion is quite liberal, see test --- fun poly_of_term ---: @@ -394,70 +394,70 @@ (* evaluates conditions in calculate_Rational *) val calc_rat_erls = prep_rls' - (Rls {id = "calc_rat_erls", preconds = [], rew_ord = ("dummy_ord", dummy_ord), - erls = e_rls, srls = Erls, calc = [], errpatts = [], + (Celem.Rls {id = "calc_rat_erls", preconds = [], rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [], rules = - [Calc ("HOL.eq", eval_equal "#equal_"), - Calc ("Atools.is'_const", eval_const "#is_const_"), - Thm ("not_true", TermC.num_str @{thm not_true}), - Thm ("not_false", TermC.num_str @{thm not_false})], - scr = EmptyScr}); + [Celem.Calc ("HOL.eq", eval_equal "#equal_"), + Celem.Calc ("Atools.is'_const", eval_const "#is_const_"), + Celem.Thm ("not_true", TermC.num_str @{thm not_true}), + Celem.Thm ("not_false", TermC.num_str @{thm not_false})], + scr = Celem.EmptyScr}); (* simplifies expressions with numerals; does NOT rearrange the term by AC-rewriting; thus terms with variables need to have constants to be commuted together respectively *) val calculate_Rational = - prep_rls' (merge_rls "calculate_Rational" - (Rls {id = "divide", preconds = [], rew_ord = ("dummy_ord", dummy_ord), - erls = calc_rat_erls, srls = Erls, + prep_rls' (Celem.merge_rls "calculate_Rational" + (Celem.Rls {id = "divide", preconds = [], rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = calc_rat_erls, srls = Celem.Erls, calc = [], errpatts = [], rules = - [Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"), + [Celem.Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"), - Thm ("minus_divide_left", TermC.num_str (@{thm minus_divide_left} RS @{thm sym})), + Celem.Thm ("minus_divide_left", TermC.num_str (@{thm minus_divide_left} RS @{thm sym})), (*SYM - ?x / ?y = - (?x / ?y) may come from subst*) - Thm ("rat_add", TermC.num_str @{thm rat_add}), + Celem.Thm ("rat_add", TermC.num_str @{thm rat_add}), (*"[| a is_const; b is_const; c is_const; d is_const |] ==> \ \a / c + b / d = (a * d) / (c * d) + (b * c ) / (d * c)"*) - Thm ("rat_add1", TermC.num_str @{thm rat_add1}), + Celem.Thm ("rat_add1", TermC.num_str @{thm rat_add1}), (*"[| a is_const; b is_const; c is_const |] ==> a / c + b / c = (a + b) / c"*) - Thm ("rat_add2", TermC.num_str @{thm rat_add2}), + Celem.Thm ("rat_add2", TermC.num_str @{thm rat_add2}), (*"[| ?a is_const; ?b is_const; ?c is_const |] ==> ?a / ?c + ?b = (?a + ?b * ?c) / ?c"*) - Thm ("rat_add3", TermC.num_str @{thm rat_add3}), + Celem.Thm ("rat_add3", TermC.num_str @{thm rat_add3}), (*"[| a is_const; b is_const; c is_const |] ==> a + b / c = (a * c) / c + b / c"\ .... is_const to be omitted here FIXME*) - Thm ("rat_mult", TermC.num_str @{thm rat_mult}), + Celem.Thm ("rat_mult", TermC.num_str @{thm rat_mult}), (*a / b * (c / d) = a * c / (b * d)*) - Thm ("times_divide_eq_right", TermC.num_str @{thm times_divide_eq_right}), + Celem.Thm ("times_divide_eq_right", TermC.num_str @{thm times_divide_eq_right}), (*?x * (?y / ?z) = ?x * ?y / ?z*) - Thm ("times_divide_eq_left", TermC.num_str @{thm times_divide_eq_left}), + Celem.Thm ("times_divide_eq_left", TermC.num_str @{thm times_divide_eq_left}), (*?y / ?z * ?x = ?y * ?x / ?z*) - Thm ("real_divide_divide1", TermC.num_str @{thm real_divide_divide1}), + Celem.Thm ("real_divide_divide1", TermC.num_str @{thm real_divide_divide1}), (*"?y ~= 0 ==> ?u / ?v / (?y / ?z) = ?u / ?v * (?z / ?y)"*) - Thm ("divide_divide_eq_left", TermC.num_str @{thm divide_divide_eq_left}), + Celem.Thm ("divide_divide_eq_left", TermC.num_str @{thm divide_divide_eq_left}), (*"?x / ?y / ?z = ?x / (?y * ?z)"*) - Thm ("rat_power", TermC.num_str @{thm rat_power}), + Celem.Thm ("rat_power", TermC.num_str @{thm rat_power}), (*"(?a / ?b) ^^^ ?n = ?a ^^^ ?n / ?b ^^^ ?n"*) - Thm ("mult_cross", TermC.num_str @{thm mult_cross}), + Celem.Thm ("mult_cross", TermC.num_str @{thm mult_cross}), (*"[| b ~= 0; d ~= 0 |] ==> (a / b = c / d) = (a * d = b * c)*) - Thm ("mult_cross1", TermC.num_str @{thm mult_cross1}), + Celem.Thm ("mult_cross1", TermC.num_str @{thm mult_cross1}), (*" b ~= 0 ==> (a / b = c ) = (a = b * c)*) - Thm ("mult_cross2", TermC.num_str @{thm mult_cross2}) + Celem.Thm ("mult_cross2", TermC.num_str @{thm mult_cross2}) (*" d ~= 0 ==> (a = c / d) = (a * d = c)*)], - scr = EmptyScr}) + scr = Celem.EmptyScr}) calculate_Poly); (*("is_expanded", ("Rational.is'_expanded", eval_is_expanded ""))*) fun eval_is_expanded (thmid:string) _ (t as (Const("Rational.is'_expanded", _) $ arg)) thy = if is_expanded arg - then SOME (TermC.mk_thmid thmid (term_to_string''' thy arg) "", + then SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg) "", HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True}))) - else SOME (TermC.mk_thmid thmid (term_to_string''' thy arg) "", + else SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg) "", HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False}))) | eval_is_expanded _ _ _ _ = NONE; *} @@ -465,16 +465,16 @@ [("is_expanded", ("Rational.is'_expanded", eval_is_expanded ""))] *} ML {* val rational_erls = - merge_rls "rational_erls" calculate_Rational - (append_rls "is_expanded" Atools_erls - [Calc ("Rational.is'_expanded", eval_is_expanded "")]); + Celem.merge_rls "rational_erls" calculate_Rational + (Celem.append_rls "is_expanded" Atools_erls + [Celem.Calc ("Rational.is'_expanded", eval_is_expanded "")]); *} subsection {* Embed cancellation into rewriting *} ML {* local (* cancel_p *) -val {rules = rules, rew_ord = (_, ro), ...} = rep_rls (assoc_rls' @{theory} "rev_rew_p"); +val {rules = rules, rew_ord = (_, ro), ...} = Celem.rep_rls (assoc_rls' @{theory} "rev_rew_p"); fun init_state thy eval_rls ro t = let @@ -482,22 +482,22 @@ val SOME (t'', asm) = cancel_p_ thy t; val der = Rtools.reverse_deriv thy eval_rls rules ro NONE t'; val der = der @ - [(Thm ("real_mult_div_cancel2", TermC.num_str @{thm real_mult_div_cancel2}), (t'', asm))] + [(Celem.Thm ("real_mult_div_cancel2", TermC.num_str @{thm real_mult_div_cancel2}), (t'', asm))] val rs = (Rtools.distinct_Thm o (map #1)) der val rs = filter_out (Rtools.eq_Thms ["sym_real_add_zero_left", "sym_real_mult_0", "sym_real_mult_1"]) rs in (t, t'', [rs(*one in order to ease locate_rule*)], der) end; fun locate_rule thy eval_rls ro [rs] t r = - if member op = ((map (id_of_thm)) rs) (id_of_thm r) + if member op = ((map (Celem.id_of_thm)) rs) (Celem.id_of_thm r) then - let val ropt = Rewrite.rewrite_ thy ro eval_rls true (thm_of_thm r) t; + let val ropt = Rewrite.rewrite_ thy ro eval_rls true (Celem.thm_of_thm r) t; in case ropt of SOME ta => [(r, ta)] | NONE => (tracing - ("### locate_rule: rewrite " ^ id_of_thm r ^ " " ^ term2str t ^ " = NONE"); []) + ("### locate_rule: rewrite " ^ Celem.id_of_thm r ^ " " ^ Celem.term2str t ^ " = NONE"); []) end - else (tracing ("### locate_rule: " ^ id_of_thm r ^ " not mem rrls"); []) + else (tracing ("### locate_rule: " ^ Celem.id_of_thm r ^ " not mem rrls"); []) | locate_rule _ _ _ _ _ _ = error "locate_rule: doesnt match rev-sets in istate"; fun next_rule thy eval_rls ro [rs] t = @@ -506,13 +506,13 @@ in case der of (_, r, _) :: _ => SOME r | _ => NONE end | next_rule _ _ _ _ _ = error ("next_rule: doesnt match rev-sets in istate"); -fun attach_form (_:rule list list) (_:term) (_:term) = - [(*TODO*)]: (rule * (term * term list)) list; +fun attach_form (_: Celem.rule list list) (_: term) (_: term) = + [(*TODO*)]: ( Celem.rule * (term * term list)) list; in val cancel_p = - Rrls {id = "cancel_p", prepat = [], + Celem.Rrls {id = "cancel_p", prepat = [], rew_ord=("ord_make_polynomial", ord_make_polynomial false thy), erls = rational_erls, calc = @@ -522,7 +522,7 @@ ("POWER", ("Atools.pow", eval_binop "#power_"))], errpatts = [], scr = - Rfuns {init_state = init_state thy Atools_erls ro, + Celem.Rfuns {init_state = init_state thy Atools_erls ro, normal_form = cancel_p_ thy, locate_rule = locate_rule thy Atools_erls ro, next_rule = next_rule thy Atools_erls ro, @@ -534,8 +534,8 @@ ML {* local (* add_fractions_p *) -(*val {rules = rules, rew_ord = (_, ro), ...} = rep_rls (assoc_rls "make_polynomial");*) -val {rules, rew_ord=(_,ro),...} = rep_rls (assoc_rls' @{theory} "rev_rew_p"); +(*val {rules = rules, rew_ord = (_, ro), ...} = Celem.rep_rls (assoc_rls "make_polynomial");*) +val {rules, rew_ord=(_,ro),...} = Celem.rep_rls (assoc_rls' @{theory} "rev_rew_p"); fun init_state thy eval_rls ro t = let @@ -543,23 +543,23 @@ val SOME (t'', asm) = add_fraction_p_ thy t; val der = Rtools.reverse_deriv thy eval_rls rules ro NONE t'; val der = der @ - [(Thm ("real_mult_div_cancel2", TermC.num_str @{thm real_mult_div_cancel2}), (t'',asm))] + [(Celem.Thm ("real_mult_div_cancel2", TermC.num_str @{thm real_mult_div_cancel2}), (t'',asm))] val rs = (Rtools.distinct_Thm o (map #1)) der; val rs = filter_out (Rtools.eq_Thms ["sym_real_add_zero_left", "sym_real_mult_0", "sym_real_mult_1"]) rs; in (t, t'', [rs(*here only _ONE_*)], der) end; fun locate_rule thy eval_rls ro [rs] t r = - if member op = ((map (id_of_thm)) rs) (id_of_thm r) + if member op = ((map (Celem.id_of_thm)) rs) (Celem.id_of_thm r) then - let val ropt = Rewrite.rewrite_ thy ro eval_rls true (thm_of_thm r) t; + let val ropt = Rewrite.rewrite_ thy ro eval_rls true (Celem.thm_of_thm r) t; in case ropt of SOME ta => [(r, ta)] | NONE => - (tracing ("### locate_rule: rewrite " ^ id_of_thm r ^ " " ^ term2str t ^ " = NONE"); + (tracing ("### locate_rule: rewrite " ^ Celem.id_of_thm r ^ " " ^ Celem.term2str t ^ " = NONE"); []) end - else (tracing ("### locate_rule: " ^ id_of_thm r ^ " not mem rrls"); []) + else (tracing ("### locate_rule: " ^ Celem.id_of_thm r ^ " not mem rrls"); []) | locate_rule _ _ _ _ _ _ = error "locate_rule: doesnt match rev-sets in istate"; fun next_rule thy eval_rls ro [rs] t = @@ -580,7 +580,7 @@ in val add_fractions_p = - Rrls {id = "add_fractions_p", prepat=prepat, + Celem.Rrls {id = "add_fractions_p", prepat=prepat, rew_ord = ("ord_make_polynomial", ord_make_polynomial false thy), erls = rational_erls, calc = [("PLUS", ("Groups.plus_class.plus", eval_binop "#add_")), @@ -588,7 +588,7 @@ ("DIVIDE", ("Rings.divide_class.divide", eval_cancel "#divide_e")), ("POWER", ("Atools.pow", eval_binop "#power_"))], errpatts = [], - scr = Rfuns {init_state = init_state thy Atools_erls ro, + scr = Celem.Rfuns {init_state = init_state thy Atools_erls ro, normal_form = add_fraction_p_ thy, locate_rule = locate_rule thy Atools_erls ro, next_rule = next_rule thy Atools_erls ro, @@ -610,254 +610,254 @@ (*erls for calculate_Rational; make local with FIXX@ME result:term *term list*) val powers_erls = prep_rls'( - Rls {id = "powers_erls", preconds = [], rew_ord = ("dummy_ord",dummy_ord), - erls = e_rls, srls = Erls, calc = [], errpatts = [], - rules = [Calc ("Atools.is'_atom",eval_is_atom "#is_atom_"), - Calc ("Atools.is'_even",eval_is_even "#is_even_"), - Calc ("Orderings.ord_class.less",eval_equ "#less_"), - Thm ("not_false", TermC.num_str @{thm not_false}), - Thm ("not_true", TermC.num_str @{thm not_true}), - Calc ("Groups.plus_class.plus",eval_binop "#add_") + Celem.Rls {id = "powers_erls", preconds = [], rew_ord = ("dummy_ord",Celem.dummy_ord), + erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Calc ("Atools.is'_atom",eval_is_atom "#is_atom_"), + Celem.Calc ("Atools.is'_even",eval_is_even "#is_even_"), + Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"), + Celem.Thm ("not_false", TermC.num_str @{thm not_false}), + Celem.Thm ("not_true", TermC.num_str @{thm not_true}), + Celem.Calc ("Groups.plus_class.plus",eval_binop "#add_") ], - scr = EmptyScr - }:rls); + scr = Celem.EmptyScr + }); (*.all powers over + distributed; atoms over * collected, other distributed contains absolute minimum of thms for context in norm_Rational .*) val powers = prep_rls'( - Rls {id = "powers", preconds = [], rew_ord = ("dummy_ord",dummy_ord), - erls = powers_erls, srls = Erls, calc = [], errpatts = [], - rules = [Thm ("realpow_multI", TermC.num_str @{thm realpow_multI}), + Celem.Rls {id = "powers", preconds = [], rew_ord = ("dummy_ord",Celem.dummy_ord), + erls = powers_erls, srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Thm ("realpow_multI", TermC.num_str @{thm realpow_multI}), (*"(r * s) ^^^ n = r ^^^ n * s ^^^ n"*) - Thm ("realpow_pow",TermC.num_str @{thm realpow_pow}), + Celem.Thm ("realpow_pow",TermC.num_str @{thm realpow_pow}), (*"(a ^^^ b) ^^^ c = a ^^^ (b * c)"*) - Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}), + Celem.Thm ("realpow_oneI",TermC.num_str @{thm realpow_oneI}), (*"r ^^^ 1 = r"*) - Thm ("realpow_minus_even",TermC.num_str @{thm realpow_minus_even}), + Celem.Thm ("realpow_minus_even",TermC.num_str @{thm realpow_minus_even}), (*"n is_even ==> (- r) ^^^ n = r ^^^ n" ?-->discard_minus?*) - Thm ("realpow_minus_odd",TermC.num_str @{thm realpow_minus_odd}), + Celem.Thm ("realpow_minus_odd",TermC.num_str @{thm realpow_minus_odd}), (*"Not (n is_even) ==> (- r) ^^^ n = -1 * r ^^^ n"*) (*----- collect atoms over * -----*) - Thm ("realpow_two_atom",TermC.num_str @{thm realpow_two_atom}), + Celem.Thm ("realpow_two_atom",TermC.num_str @{thm realpow_two_atom}), (*"r is_atom ==> r * r = r ^^^ 2"*) - Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}), + Celem.Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}), (*"r is_atom ==> r * r ^^^ n = r ^^^ (n + 1)"*) - Thm ("realpow_addI_atom",TermC.num_str @{thm realpow_addI_atom}), + Celem.Thm ("realpow_addI_atom",TermC.num_str @{thm realpow_addI_atom}), (*"r is_atom ==> r ^^^ n * r ^^^ m = r ^^^ (n + m)"*) (*----- distribute none-atoms -----*) - Thm ("realpow_def_atom",TermC.num_str @{thm realpow_def_atom}), + Celem.Thm ("realpow_def_atom",TermC.num_str @{thm realpow_def_atom}), (*"[| 1 < n; not(r is_atom) |]==>r ^^^ n = r * r ^^^ (n + -1)"*) - Thm ("realpow_eq_oneI",TermC.num_str @{thm realpow_eq_oneI}), + Celem.Thm ("realpow_eq_oneI",TermC.num_str @{thm realpow_eq_oneI}), (*"1 ^^^ n = 1"*) - Calc ("Groups.plus_class.plus",eval_binop "#add_") + Celem.Calc ("Groups.plus_class.plus",eval_binop "#add_") ], - scr = EmptyScr - }:rls); + scr = Celem.EmptyScr + }); (*.contains absolute minimum of thms for context in norm_Rational.*) val rat_mult_divide = prep_rls'( - Rls {id = "rat_mult_divide", preconds = [], - rew_ord = ("dummy_ord", dummy_ord), - erls = e_rls, srls = Erls, calc = [], errpatts = [], - rules = [Thm ("rat_mult",TermC.num_str @{thm rat_mult}), + Celem.Rls {id = "rat_mult_divide", preconds = [], + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Thm ("rat_mult",TermC.num_str @{thm rat_mult}), (*(1)"?a / ?b * (?c / ?d) = ?a * ?c / (?b * ?d)"*) - Thm ("times_divide_eq_right",TermC.num_str @{thm times_divide_eq_right}), + Celem.Thm ("times_divide_eq_right",TermC.num_str @{thm times_divide_eq_right}), (*(2)"?a * (?c / ?d) = ?a * ?c / ?d" must be [2], otherwise inv.to a / b / c = ...*) - Thm ("times_divide_eq_left",TermC.num_str @{thm times_divide_eq_left}), + Celem.Thm ("times_divide_eq_left",TermC.num_str @{thm times_divide_eq_left}), (*"?a / ?b * ?c = ?a * ?c / ?b" order weights x^^^n too much and does not commute a / b * c ^^^ 2 !*) - Thm ("divide_divide_eq_right", + Celem.Thm ("divide_divide_eq_right", TermC.num_str @{thm divide_divide_eq_right}), (*"?x / (?y / ?z) = ?x * ?z / ?y"*) - Thm ("divide_divide_eq_left", + Celem.Thm ("divide_divide_eq_left", TermC.num_str @{thm divide_divide_eq_left}), (*"?x / ?y / ?z = ?x / (?y * ?z)"*) - Calc ("Rings.divide_class.divide" ,eval_cancel "#divide_e") + Celem.Calc ("Rings.divide_class.divide" ,eval_cancel "#divide_e") ], - scr = EmptyScr - }:rls); + scr = Celem.EmptyScr + }); (*.contains absolute minimum of thms for context in norm_Rational.*) val reduce_0_1_2 = prep_rls'( - Rls{id = "reduce_0_1_2", preconds = [], rew_ord = ("dummy_ord", dummy_ord), - erls = e_rls, srls = Erls, calc = [], errpatts = [], - rules = [(*Thm ("divide_1",TermC.num_str @{thm divide_1}), + Celem.Rls{id = "reduce_0_1_2", preconds = [], rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [], + rules = [(*Celem.Thm ("divide_1",TermC.num_str @{thm divide_1}), "?x / 1 = ?x" unnecess.for normalform*) - Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}), + Celem.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}), (*"1 * z = z"*) - (*Thm ("real_mult_minus1",TermC.num_str @{thm real_mult_minus1}), + (*Celem.Thm ("real_mult_minus1",TermC.num_str @{thm real_mult_minus1}), "-1 * z = - z"*) - (*Thm ("real_minus_mult_cancel",TermC.num_str @{thm real_minus_mult_cancel}), + (*Celem.Thm ("real_minus_mult_cancel",TermC.num_str @{thm real_minus_mult_cancel}), "- ?x * - ?y = ?x * ?y"*) - Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}), + Celem.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}), (*"0 * z = 0"*) - Thm ("add_0_left",TermC.num_str @{thm add_0_left}), + Celem.Thm ("add_0_left",TermC.num_str @{thm add_0_left}), (*"0 + z = z"*) - (*Thm ("right_minus",TermC.num_str @{thm right_minus}), + (*Celem.Thm ("right_minus",TermC.num_str @{thm right_minus}), "?z + - ?z = 0"*) - Thm ("sym_real_mult_2", + Celem.Thm ("sym_real_mult_2", TermC.num_str (@{thm real_mult_2} RS @{thm sym})), (*"z1 + z1 = 2 * z1"*) - Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}), + Celem.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}), (*"z1 + (z1 + k) = 2 * z1 + k"*) - Thm ("division_ring_divide_zero",TermC.num_str @{thm division_ring_divide_zero}) + Celem.Thm ("division_ring_divide_zero",TermC.num_str @{thm division_ring_divide_zero}) (*"0 / ?x = 0"*) - ], scr = EmptyScr}:rls); + ], scr = Celem.EmptyScr}); (*erls for calculate_Rational; make local with FIXX@ME result:term *term list WN0609???SKMG*) val norm_rat_erls = prep_rls'( - Rls {id = "norm_rat_erls", preconds = [], rew_ord = ("dummy_ord",dummy_ord), - erls = e_rls, srls = Erls, calc = [], errpatts = [], - rules = [Calc ("Atools.is'_const",eval_const "#is_const_") - ], scr = EmptyScr}:rls); + Celem.Rls {id = "norm_rat_erls", preconds = [], rew_ord = ("dummy_ord",Celem.dummy_ord), + erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Calc ("Atools.is'_const",eval_const "#is_const_") + ], scr = Celem.EmptyScr}); (* consists of rls containing the absolute minimum of thms *) (*040209: this version has been used by RL for his equations, which is now replaced by MGs version "norm_Rational" below *) val norm_Rational_min = prep_rls'( - Rls {id = "norm_Rational_min", preconds = [], rew_ord = ("dummy_ord",dummy_ord), - erls = norm_rat_erls, srls = Erls, calc = [], errpatts = [], + Celem.Rls {id = "norm_Rational_min", preconds = [], rew_ord = ("dummy_ord",Celem.dummy_ord), + erls = norm_rat_erls, srls = Celem.Erls, calc = [], errpatts = [], rules = [(*sequence given by operator precedence*) - Rls_ discard_minus, - Rls_ powers, - Rls_ rat_mult_divide, - Rls_ expand, - Rls_ reduce_0_1_2, - Rls_ order_add_mult, - Rls_ collect_numerals, - Rls_ add_fractions_p, - Rls_ cancel_p + Celem.Rls_ discard_minus, + Celem.Rls_ powers, + Celem.Rls_ rat_mult_divide, + Celem.Rls_ expand, + Celem.Rls_ reduce_0_1_2, + Celem.Rls_ order_add_mult, + Celem.Rls_ collect_numerals, + Celem.Rls_ add_fractions_p, + Celem.Rls_ cancel_p ], - scr = EmptyScr}:rls); + scr = Celem.EmptyScr}); val norm_Rational_parenthesized = prep_rls'( - Seq {id = "norm_Rational_parenthesized", preconds = []:term list, - rew_ord = ("dummy_ord", dummy_ord), - erls = Atools_erls, srls = Erls, + Celem.Seq {id = "norm_Rational_parenthesized", preconds = []:term list, + rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Atools_erls, srls = Celem.Erls, calc = [], errpatts = [], - rules = [Rls_ norm_Rational_min, - Rls_ discard_parentheses + rules = [Celem.Rls_ norm_Rational_min, + Celem.Rls_ discard_parentheses ], - scr = EmptyScr}:rls); + scr = Celem.EmptyScr}); (*WN030318???SK: simplifies all but cancel and common_nominator*) val simplify_rational = - merge_rls "simplify_rational" expand_binoms - (append_rls "divide" calculate_Rational - [Thm ("div_by_1",TermC.num_str @{thm div_by_1}), + Celem.merge_rls "simplify_rational" expand_binoms + (Celem.append_rls "divide" calculate_Rational + [Celem.Thm ("div_by_1",TermC.num_str @{thm div_by_1}), (*"?x / 1 = ?x"*) - Thm ("rat_mult",TermC.num_str @{thm rat_mult}), + Celem.Thm ("rat_mult",TermC.num_str @{thm rat_mult}), (*(1)"?a / ?b * (?c / ?d) = ?a * ?c / (?b * ?d)"*) - Thm ("times_divide_eq_right",TermC.num_str @{thm times_divide_eq_right}), + Celem.Thm ("times_divide_eq_right",TermC.num_str @{thm times_divide_eq_right}), (*(2)"?a * (?c / ?d) = ?a * ?c / ?d" must be [2], otherwise inv.to a / b / c = ...*) - Thm ("times_divide_eq_left",TermC.num_str @{thm times_divide_eq_left}), + Celem.Thm ("times_divide_eq_left",TermC.num_str @{thm times_divide_eq_left}), (*"?a / ?b * ?c = ?a * ?c / ?b"*) - Thm ("add_minus",TermC.num_str @{thm add_minus}), + Celem.Thm ("add_minus",TermC.num_str @{thm add_minus}), (*"?a + ?b - ?b = ?a"*) - Thm ("add_minus1",TermC.num_str @{thm add_minus1}), + Celem.Thm ("add_minus1",TermC.num_str @{thm add_minus1}), (*"?a - ?b + ?b = ?a"*) - Thm ("divide_minus1",TermC.num_str @{thm divide_minus1}) + Celem.Thm ("divide_minus1",TermC.num_str @{thm divide_minus1}) (*"?x / -1 = - ?x"*) ]); *} ML {* val add_fractions_p_rls = prep_rls'( - Rls {id = "add_fractions_p_rls", preconds = [], rew_ord = ("dummy_ord", dummy_ord), - erls = e_rls, srls = Erls, calc = [], errpatts = [], - rules = [Rls_ add_fractions_p], - scr = EmptyScr}); + Celem.Rls {id = "add_fractions_p_rls", preconds = [], rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Rls_ add_fractions_p], + scr = Celem.EmptyScr}); -(* "Rls" causes repeated application of cancel_p to one and the same term *) +(* "Celem.Rls" causes repeated application of cancel_p to one and the same term *) val cancel_p_rls = prep_rls'( - Rls - {id = "cancel_p_rls", preconds = [], rew_ord = ("dummy_ord", dummy_ord), - erls = e_rls, srls = Erls, calc = [], errpatts = [], - rules = [Rls_ cancel_p], - scr = EmptyScr}); + Celem.Rls + {id = "cancel_p_rls", preconds = [], rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Rls_ cancel_p], + scr = Celem.EmptyScr}); (*. makes 'normal' fractions; 'is_polyexp' inhibits double fractions; used in initial part norm_Rational_mg, see example DA-M02-main.p.60.*) val rat_mult_poly = prep_rls'( - Rls {id = "rat_mult_poly", preconds = [], rew_ord = ("dummy_ord", dummy_ord), - erls = append_rls "e_rls-is_polyexp" e_rls [Calc ("Poly.is'_polyexp", eval_is_polyexp "")], - srls = Erls, calc = [], errpatts = [], + Celem.Rls {id = "rat_mult_poly", preconds = [], rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Celem.append_rls "Celem.e_rls-is_polyexp" Celem.e_rls [Celem.Calc ("Poly.is'_polyexp", eval_is_polyexp "")], + srls = Celem.Erls, calc = [], errpatts = [], rules = - [Thm ("rat_mult_poly_l",TermC.num_str @{thm rat_mult_poly_l}), + [Celem.Thm ("rat_mult_poly_l",TermC.num_str @{thm rat_mult_poly_l}), (*"?c is_polyexp ==> ?c * (?a / ?b) = ?c * ?a / ?b"*) - Thm ("rat_mult_poly_r",TermC.num_str @{thm rat_mult_poly_r}) + Celem.Thm ("rat_mult_poly_r",TermC.num_str @{thm rat_mult_poly_r}) (*"?c is_polyexp ==> ?a / ?b * ?c = ?a * ?c / ?b"*) ], - scr = EmptyScr}); + scr = Celem.EmptyScr}); (*. makes 'normal' fractions; 'is_polyexp' inhibits double fractions; used in looping part norm_Rational_rls, see example DA-M02-main.p.60 - .. WHERE THE LATTER DOES ALWAYS WORK, BECAUSE erls = e_rls, - I.E. THE RESPECTIVE ASSUMPTION IS STORED AND Thm APPLIED; WN051028 + .. WHERE THE LATTER DOES ALWAYS WORK, BECAUSE erls = Celem.e_rls, + I.E. THE RESPECTIVE ASSUMPTION IS STORED AND Celem.Thm APPLIED; WN051028 ... WN0609???MG.*) val rat_mult_div_pow = prep_rls'( - Rls {id = "rat_mult_div_pow", preconds = [], rew_ord = ("dummy_ord",dummy_ord), - erls = e_rls, srls = Erls, calc = [], errpatts = [], - rules = [Thm ("rat_mult", TermC.num_str @{thm rat_mult}), + Celem.Rls {id = "rat_mult_div_pow", preconds = [], rew_ord = ("dummy_ord",Celem.dummy_ord), + erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Thm ("rat_mult", TermC.num_str @{thm rat_mult}), (*"?a / ?b * (?c / ?d) = ?a * ?c / (?b * ?d)"*) - Thm ("rat_mult_poly_l", TermC.num_str @{thm rat_mult_poly_l}), + Celem.Thm ("rat_mult_poly_l", TermC.num_str @{thm rat_mult_poly_l}), (*"?c is_polyexp ==> ?c * (?a / ?b) = ?c * ?a / ?b"*) - Thm ("rat_mult_poly_r", TermC.num_str @{thm rat_mult_poly_r}), + Celem.Thm ("rat_mult_poly_r", TermC.num_str @{thm rat_mult_poly_r}), (*"?c is_polyexp ==> ?a / ?b * ?c = ?a * ?c / ?b"*) - Thm ("real_divide_divide1_mg", TermC.num_str @{thm real_divide_divide1_mg}), + Celem.Thm ("real_divide_divide1_mg", TermC.num_str @{thm real_divide_divide1_mg}), (*"y ~= 0 ==> (u / v) / (y / z) = (u * z) / (y * v)"*) - Thm ("divide_divide_eq_right", TermC.num_str @{thm divide_divide_eq_right}), + Celem.Thm ("divide_divide_eq_right", TermC.num_str @{thm divide_divide_eq_right}), (*"?x / (?y / ?z) = ?x * ?z / ?y"*) - Thm ("divide_divide_eq_left", TermC.num_str @{thm divide_divide_eq_left}), + Celem.Thm ("divide_divide_eq_left", TermC.num_str @{thm divide_divide_eq_left}), (*"?x / ?y / ?z = ?x / (?y * ?z)"*) - Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"), + Celem.Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"), - Thm ("rat_power", TermC.num_str @{thm rat_power}) + Celem.Thm ("rat_power", TermC.num_str @{thm rat_power}) (*"(?a / ?b) ^^^ ?n = ?a ^^^ ?n / ?b ^^^ ?n"*) ], - scr = EmptyScr}:rls); + scr = Celem.EmptyScr}); val rat_reduce_1 = prep_rls'( - Rls {id = "rat_reduce_1", preconds = [], rew_ord = ("dummy_ord", dummy_ord), - erls = e_rls, srls = Erls, calc = [], errpatts = [], + Celem.Rls {id = "rat_reduce_1", preconds = [], rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [], rules = - [Thm ("div_by_1", TermC.num_str @{thm div_by_1}), + [Celem.Thm ("div_by_1", TermC.num_str @{thm div_by_1}), (*"?x / 1 = ?x"*) - Thm ("mult_1_left", TermC.num_str @{thm mult_1_left}) + Celem.Thm ("mult_1_left", TermC.num_str @{thm mult_1_left}) (*"1 * z = z"*) ], - scr = EmptyScr}:rls); + scr = Celem.EmptyScr}); (* looping part of norm_Rational *) val norm_Rational_rls = prep_rls' ( - Rls {id = "norm_Rational_rls", preconds = [], rew_ord = ("dummy_ord",dummy_ord), - erls = norm_rat_erls, srls = Erls, calc = [], errpatts = [], - rules = [Rls_ add_fractions_p_rls, - Rls_ rat_mult_div_pow, - Rls_ make_rat_poly_with_parentheses, - Rls_ cancel_p_rls, - Rls_ rat_reduce_1 + Celem.Rls {id = "norm_Rational_rls", preconds = [], rew_ord = ("dummy_ord",Celem.dummy_ord), + erls = norm_rat_erls, srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Rls_ add_fractions_p_rls, + Celem.Rls_ rat_mult_div_pow, + Celem.Rls_ make_rat_poly_with_parentheses, + Celem.Rls_ cancel_p_rls, + Celem.Rls_ rat_reduce_1 ], - scr = EmptyScr}:rls); + scr = Celem.EmptyScr}); val norm_Rational = prep_rls' ( - Seq - {id = "norm_Rational", preconds = [], rew_ord = ("dummy_ord", dummy_ord), - erls = norm_rat_erls, srls = Erls, calc = [], errpatts = [], - rules = [Rls_ discard_minus, - Rls_ rat_mult_poly, (* removes double fractions like a/b/c *) - Rls_ make_rat_poly_with_parentheses, - Rls_ cancel_p_rls, - Rls_ norm_Rational_rls, (* the main rls, looping (#) *) - Rls_ discard_parentheses1 (* mult only *) + Celem.Seq + {id = "norm_Rational", preconds = [], rew_ord = ("dummy_ord", Celem.dummy_ord), + erls = norm_rat_erls, srls = Celem.Erls, calc = [], errpatts = [], + rules = [Celem.Rls_ discard_minus, + Celem.Rls_ rat_mult_poly, (* removes double fractions like a/b/c *) + Celem.Rls_ make_rat_poly_with_parentheses, + Celem.Rls_ cancel_p_rls, + Celem.Rls_ norm_Rational_rls, (* the main rls, looping (#) *) + Celem.Rls_ discard_parentheses1 (* mult only *) ], - scr = EmptyScr}:rls); + scr = Celem.EmptyScr}); *} setup {* KEStore_Elems.add_rlss @@ -886,27 +886,27 @@ section {* A problem for simplification of rationals *} setup {* KEStore_Elems.add_pbts - [(Specify.prep_pbt thy "pbl_simp_rat" [] e_pblID + [(Specify.prep_pbt thy "pbl_simp_rat" [] Celem.e_pblID (["rational","simplification"], [("#Given" ,["Term t_t"]), ("#Where" ,["t_t is_ratpolyexp"]), ("#Find" ,["normalform n_n"])], - append_rls "e_rls" e_rls [(*for preds in where_*)], + Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*)], SOME "Simplify t_t", [["simplification","of_rationals"]]))] *} section {* A methods for simplification of rationals *} (*WN061025 this methods script is copied from (auto-generated) script of norm_Rational in order to ease repair on inform*) setup {* KEStore_Elems.add_mets - [Specify.prep_met thy "met_simp_rat" [] e_metID + [Specify.prep_met thy "met_simp_rat" [] Celem.e_metID (["simplification","of_rationals"], [("#Given" ,["Term t_t"]), ("#Where" ,["t_t is_ratpolyexp"]), ("#Find" ,["normalform n_n"])], - {rew_ord'="tless_true", rls' = e_rls, calc = [], srls = e_rls, - prls = append_rls "simplification_of_rationals_prls" e_rls - [(*for preds in where_*) Calc ("Rational.is'_ratpolyexp", eval_is_ratpolyexp "")], - crls = e_rls, errpats = [], nrls = norm_Rational_rls}, + {rew_ord'="tless_true", rls' = Celem.e_rls, calc = [], srls = Celem.e_rls, + prls = Celem.append_rls "simplification_of_rationals_prls" Celem.e_rls + [(*for preds in where_*) Celem.Calc ("Rational.is'_ratpolyexp", eval_is_ratpolyexp "")], + crls = Celem.e_rls, errpats = [], nrls = norm_Rational_rls}, "Script SimplifyScript (t_t::real) = " ^ " ((Try (Rewrite_Set discard_minus False) @@ " ^ " Try (Rewrite_Set rat_mult_poly False) @@ " ^ diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/Root.thy --- a/src/Tools/isac/Knowledge/Root.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/Root.thy Thu Mar 15 12:42:04 2018 +0100 @@ -113,10 +113,10 @@ (if pr then let val (f, ts) = strip_comb t and (g, us) = strip_comb u; - val _ = tracing ("t= f@ts= \"" ^ term2str f ^"\" @ \"[" ^ - commas (map term2str ts) ^ "]\""); - val _ = tracing ("u= g@us= \"" ^ term2str g ^"\" @ \"[" ^ - commas (map term2str us) ^ "]\""); + val _ = tracing ("t= f@ts= \"" ^ Celem.term2str f ^"\" @ \"[" ^ + commas (map Celem.term2str ts) ^ "]\""); + val _ = tracing ("u= g@us= \"" ^ Celem.term2str g ^"\" @ \"[" ^ + commas (map Celem.term2str us) ^ "]\""); val _ = tracing ("size_of_term(t,u)= (" ^ string_of_int(size_of_term' t) ^", " ^ string_of_int(size_of_term' u) ^")"); @@ -137,7 +137,7 @@ prod_ord (prod_ord Term_Ord.indexname_ord Term_Ord.typ_ord) int_ord (dest_hd' f, dest_hd' g) and terms_ord str pr (ts, us) = - list_ord (term_ord' pr (assoc_thy "Isac"))(ts, us); + list_ord (term_ord' pr (Celem.assoc_thy "Isac"))(ts, us); in (* associates a+(b+c) => (a+b)+c = a+b+c ... avoiding parentheses @@ -151,107 +151,107 @@ thy: subst: no bound variables, only Root.sqrt tu: the terms to compare (t1, t2) ... *) -fun sqrt_right (pr:bool) thy (_:subst) tu = +fun sqrt_right (pr:bool) thy (_: Celem.subst) tu = (term_ord' pr thy(***) tu = LESS ); end; -rew_ord' := overwritel (!rew_ord', +Celem.rew_ord' := overwritel (! Celem.rew_ord', [("termlessI", termlessI), ("sqrt_right", sqrt_right false @{theory "Pure"}) ]); (*-------------------------rulse-------------------------*) val Root_crls = - append_rls "Root_crls" Atools_erls - [Thm ("real_unari_minus",TermC.num_str @{thm real_unari_minus}), - Calc ("NthRoot.sqrt" ,eval_sqrt "#sqrt_"), - Calc ("Rings.divide_class.divide",eval_cancel "#divide_e"), - Calc ("Atools.pow" ,eval_binop "#power_"), - Calc ("Groups.plus_class.plus", eval_binop "#add_"), - Calc ("Groups.minus_class.minus", eval_binop "#sub_"), - Calc ("Groups.times_class.times", eval_binop "#mult_"), - Calc ("HOL.eq",eval_equal "#equal_") + Celem.append_rls "Root_crls" Atools_erls + [Celem.Thm ("real_unari_minus",TermC.num_str @{thm real_unari_minus}), + Celem.Calc ("NthRoot.sqrt" ,eval_sqrt "#sqrt_"), + Celem.Calc ("Rings.divide_class.divide",eval_cancel "#divide_e"), + Celem.Calc ("Atools.pow" ,eval_binop "#power_"), + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Calc ("Groups.minus_class.minus", eval_binop "#sub_"), + Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"), + Celem.Calc ("HOL.eq",eval_equal "#equal_") ]; val Root_erls = - append_rls "Root_erls" Atools_erls - [Thm ("real_unari_minus",TermC.num_str @{thm real_unari_minus}), - Calc ("NthRoot.sqrt" ,eval_sqrt "#sqrt_"), - Calc ("Rings.divide_class.divide",eval_cancel "#divide_e"), - Calc ("Atools.pow" ,eval_binop "#power_"), - Calc ("Groups.plus_class.plus", eval_binop "#add_"), - Calc ("Groups.minus_class.minus", eval_binop "#sub_"), - Calc ("Groups.times_class.times", eval_binop "#mult_"), - Calc ("HOL.eq",eval_equal "#equal_") + Celem.append_rls "Root_erls" Atools_erls + [Celem.Thm ("real_unari_minus",TermC.num_str @{thm real_unari_minus}), + Celem.Calc ("NthRoot.sqrt" ,eval_sqrt "#sqrt_"), + Celem.Calc ("Rings.divide_class.divide",eval_cancel "#divide_e"), + Celem.Calc ("Atools.pow" ,eval_binop "#power_"), + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Calc ("Groups.minus_class.minus", eval_binop "#sub_"), + Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"), + Celem.Calc ("HOL.eq",eval_equal "#equal_") ]; *} setup {* KEStore_Elems.add_rlss [("Root_erls", (Context.theory_name @{theory}, Root_erls))] *} ML {* val make_rooteq = prep_rls'( - Rls{id = "make_rooteq", preconds = []:term list, + Celem.Rls{id = "make_rooteq", preconds = []:term list, rew_ord = ("sqrt_right", sqrt_right false thy), - erls = Atools_erls, srls = Erls, + erls = Atools_erls, srls = Celem.Erls, calc = [], errpatts = [], - rules = [Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}), + rules = [Celem.Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}), (*"a - b = a + (-1) * b"*) - Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}), + Celem.Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}), (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*) - Thm ("distrib_left",TermC.num_str @{thm distrib_left}), + Celem.Thm ("distrib_left",TermC.num_str @{thm distrib_left}), (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*) - Thm ("left_diff_distrib" ,TermC.num_str @{thm left_diff_distrib}), + Celem.Thm ("left_diff_distrib" ,TermC.num_str @{thm left_diff_distrib}), (*"(z1.0 - z2.0) * w = z1.0 * w - z2.0 * w"*) - Thm ("right_diff_distrib",TermC.num_str @{thm right_diff_distrib}), + Celem.Thm ("right_diff_distrib",TermC.num_str @{thm right_diff_distrib}), (*"w * (z1.0 - z2.0) = w * z1.0 - w * z2.0"*) - Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}), + Celem.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}), (*"1 * z = z"*) - Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}), + Celem.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}), (*"0 * z = 0"*) - Thm ("add_0_left",TermC.num_str @{thm add_0_left}), + Celem.Thm ("add_0_left",TermC.num_str @{thm add_0_left}), (*"0 + z = z"*) - Thm ("mult_commute",TermC.num_str @{thm mult.commute}), + Celem.Thm ("mult_commute",TermC.num_str @{thm mult.commute}), (*AC-rewriting*) - Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}), + Celem.Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}), (**) - Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}), + Celem.Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}), (**) - Thm ("add_commute",TermC.num_str @{thm add.commute}), + Celem.Thm ("add_commute",TermC.num_str @{thm add.commute}), (**) - Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}), + Celem.Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}), (**) - Thm ("add_assoc",TermC.num_str @{thm add.assoc}), + Celem.Thm ("add_assoc",TermC.num_str @{thm add.assoc}), (**) - Thm ("sym_realpow_twoI", + Celem.Thm ("sym_realpow_twoI", TermC.num_str (@{thm realpow_twoI} RS @{thm sym})), (*"r1 * r1 = r1 ^^^ 2"*) - Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}), + Celem.Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}), (*"r * r ^^^ n = r ^^^ (n + 1)"*) - Thm ("sym_real_mult_2", + Celem.Thm ("sym_real_mult_2", TermC.num_str (@{thm real_mult_2} RS @{thm sym})), (*"z1 + z1 = 2 * z1"*) - Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}), + Celem.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}), (*"z1 + (z1 + k) = 2 * z1 + k"*) - Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), + Celem.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), (*"[| l is_const; m is_const |]==> l * n + m * n = (l + m) * n"*) - Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}), + Celem.Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}), (*"[| l is_const; m is_const |] ==> l * n + (m * n + k) = (l + m) * n + k"*) - Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}), + Celem.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}), (*"m is_const ==> n + m * n = (1 + m) * n"*) - Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), + Celem.Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*) - Calc ("Groups.plus_class.plus", eval_binop "#add_"), - Calc ("Groups.times_class.times", eval_binop "#mult_"), - Calc ("Atools.pow", eval_binop "#power_") + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"), + Celem.Calc ("Atools.pow", eval_binop "#power_") ], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls); + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }); *} setup {* KEStore_Elems.add_rlss [("make_rooteq", (Context.theory_name @{theory}, make_rooteq))] *} ML {* @@ -259,73 +259,73 @@ val prep_rls' = LTool.prep_rls @{theory}; val expand_rootbinoms = prep_rls'( - Rls{id = "expand_rootbinoms", preconds = [], + Celem.Rls{id = "expand_rootbinoms", preconds = [], rew_ord = ("termlessI",termlessI), - erls = Atools_erls, srls = Erls, + erls = Atools_erls, srls = Celem.Erls, calc = [], errpatts = [], - rules = [Thm ("real_plus_binom_pow2" ,TermC.num_str @{thm real_plus_binom_pow2}), + rules = [Celem.Thm ("real_plus_binom_pow2" ,TermC.num_str @{thm real_plus_binom_pow2}), (*"(a + b) ^^^ 2 = a ^^^ 2 + 2 * a * b + b ^^^ 2"*) - Thm ("real_plus_binom_times" ,TermC.num_str @{thm real_plus_binom_times}), + Celem.Thm ("real_plus_binom_times" ,TermC.num_str @{thm real_plus_binom_times}), (*"(a + b)*(a + b) = ...*) - Thm ("real_minus_binom_pow2" ,TermC.num_str @{thm real_minus_binom_pow2}), + Celem.Thm ("real_minus_binom_pow2" ,TermC.num_str @{thm real_minus_binom_pow2}), (*"(a - b) ^^^ 2 = a ^^^ 2 - 2 * a * b + b ^^^ 2"*) - Thm ("real_minus_binom_times",TermC.num_str @{thm real_minus_binom_times}), + Celem.Thm ("real_minus_binom_times",TermC.num_str @{thm real_minus_binom_times}), (*"(a - b)*(a - b) = ...*) - Thm ("real_plus_minus_binom1",TermC.num_str @{thm real_plus_minus_binom1}), + Celem.Thm ("real_plus_minus_binom1",TermC.num_str @{thm real_plus_minus_binom1}), (*"(a + b) * (a - b) = a ^^^ 2 - b ^^^ 2"*) - Thm ("real_plus_minus_binom2",TermC.num_str @{thm real_plus_minus_binom2}), + Celem.Thm ("real_plus_minus_binom2",TermC.num_str @{thm real_plus_minus_binom2}), (*"(a - b) * (a + b) = a ^^^ 2 - b ^^^ 2"*) (*RL 020915*) - Thm ("real_pp_binom_times",TermC.num_str @{thm real_pp_binom_times}), + Celem.Thm ("real_pp_binom_times",TermC.num_str @{thm real_pp_binom_times}), (*(a + b)*(c + d) = a*c + a*d + b*c + b*d*) - Thm ("real_pm_binom_times",TermC.num_str @{thm real_pm_binom_times}), + Celem.Thm ("real_pm_binom_times",TermC.num_str @{thm real_pm_binom_times}), (*(a + b)*(c - d) = a*c - a*d + b*c - b*d*) - Thm ("real_mp_binom_times",TermC.num_str @{thm real_mp_binom_times}), + Celem.Thm ("real_mp_binom_times",TermC.num_str @{thm real_mp_binom_times}), (*(a - b)*(c p d) = a*c + a*d - b*c - b*d*) - Thm ("real_mm_binom_times",TermC.num_str @{thm real_mm_binom_times}), + Celem.Thm ("real_mm_binom_times",TermC.num_str @{thm real_mm_binom_times}), (*(a - b)*(c p d) = a*c - a*d - b*c + b*d*) - Thm ("realpow_mul",TermC.num_str @{thm realpow_mul}), + Celem.Thm ("realpow_mul",TermC.num_str @{thm realpow_mul}), (*(a*b)^^^n = a^^^n * b^^^n*) - Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}), (*"1 * z = z"*) - Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}), (*"0 * z = 0"*) - Thm ("add_0_left",TermC.num_str @{thm add_0_left}), + Celem.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}), (*"1 * z = z"*) + Celem.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}), (*"0 * z = 0"*) + Celem.Thm ("add_0_left",TermC.num_str @{thm add_0_left}), (*"0 + z = z"*) - Calc ("Groups.plus_class.plus", eval_binop "#add_"), - Calc ("Groups.minus_class.minus", eval_binop "#sub_"), - Calc ("Groups.times_class.times", eval_binop "#mult_"), - Calc ("Rings.divide_class.divide" ,eval_cancel "#divide_e"), - Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"), - Calc ("Atools.pow", eval_binop "#power_"), + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Calc ("Groups.minus_class.minus", eval_binop "#sub_"), + Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"), + Celem.Calc ("Rings.divide_class.divide" ,eval_cancel "#divide_e"), + Celem.Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"), + Celem.Calc ("Atools.pow", eval_binop "#power_"), - Thm ("sym_realpow_twoI", + Celem.Thm ("sym_realpow_twoI", TermC.num_str (@{thm realpow_twoI} RS @{thm sym})), (*"r1 * r1 = r1 ^^^ 2"*) - Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}), + Celem.Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}), (*"r * r ^^^ n = r ^^^ (n + 1)"*) - Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}), + Celem.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}), (*"z1 + (z1 + k) = 2 * z1 + k"*) - Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), + Celem.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), (*"[| l is_const; m is_const |] ==>l * n + m * n = (l + m) * n"*) - Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}), + Celem.Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}), (*"[| l is_const; m is_const |] ==> l * n + (m * n + k) = (l + m) * n + k"*) - Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}), + Celem.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}), (*"m is_const ==> n + m * n = (1 + m) * n"*) - Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), + Celem.Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*) - Calc ("Groups.plus_class.plus", eval_binop "#add_"), - Calc ("Groups.minus_class.minus", eval_binop "#sub_"), - Calc ("Groups.times_class.times", eval_binop "#mult_"), - Calc ("Rings.divide_class.divide" ,eval_cancel "#divide_e"), - Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"), - Calc ("Atools.pow", eval_binop "#power_") + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Calc ("Groups.minus_class.minus", eval_binop "#sub_"), + Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"), + Celem.Calc ("Rings.divide_class.divide" ,eval_cancel "#divide_e"), + Celem.Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"), + Celem.Calc ("Atools.pow", eval_binop "#power_") ], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls); + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }); *} setup {* KEStore_Elems.add_rlss [("expand_rootbinoms", (Context.theory_name @{theory}, expand_rootbinoms))] *} diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/RootEq.thy --- a/src/Tools/isac/Knowledge/RootEq.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/RootEq.thy Thu Mar 15 12:42:04 2018 +0100 @@ -177,64 +177,64 @@ fun eval_is_rootTerm_in _ _ (p as (Const ("RootEq.is'_rootTerm'_in",_) $ t $ v)) _ = if is_rootTerm_in t v then - SOME ((term2str p) ^ " = True", + SOME ((Celem.term2str p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True}))) - else SOME ((term2str p) ^ " = True", + else SOME ((Celem.term2str p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False}))) | eval_is_rootTerm_in _ _ _ _ = ((*tracing"### nichts matcht";*) NONE); fun eval_is_sqrtTerm_in _ _ (p as (Const ("RootEq.is'_sqrtTerm'_in",_) $ t $ v)) _ = if is_sqrtTerm_in t v then - SOME ((term2str p) ^ " = True", + SOME ((Celem.term2str p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True}))) - else SOME ((term2str p) ^ " = True", + else SOME ((Celem.term2str p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False}))) | eval_is_sqrtTerm_in _ _ _ _ = ((*tracing"### nichts matcht";*) NONE); fun eval_is_normSqrtTerm_in _ _ (p as (Const ("RootEq.is'_normSqrtTerm'_in",_) $ t $ v)) _ = if is_normSqrtTerm_in t v then - SOME ((term2str p) ^ " = True", + SOME ((Celem.term2str p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True}))) - else SOME ((term2str p) ^ " = True", + else SOME ((Celem.term2str p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False}))) | eval_is_normSqrtTerm_in _ _ _ _ = ((*tracing"### nichts matcht";*) NONE); (*-------------------------rulse-------------------------*) val RootEq_prls =(*15.10.02:just the following order due to subterm evaluation*) - append_rls "RootEq_prls" e_rls - [Calc ("Atools.ident",eval_ident "#ident_"), - Calc ("Tools.matches",eval_matches ""), - Calc ("Tools.lhs" ,eval_lhs ""), - Calc ("Tools.rhs" ,eval_rhs ""), - Calc ("RootEq.is'_sqrtTerm'_in",eval_is_sqrtTerm_in ""), - Calc ("RootEq.is'_rootTerm'_in",eval_is_rootTerm_in ""), - Calc ("RootEq.is'_normSqrtTerm'_in",eval_is_normSqrtTerm_in ""), - Calc ("HOL.eq",eval_equal "#equal_"), - Thm ("not_true",TermC.num_str @{thm not_true}), - Thm ("not_false",TermC.num_str @{thm not_false}), - Thm ("and_true",TermC.num_str @{thm and_true}), - Thm ("and_false",TermC.num_str @{thm and_false}), - Thm ("or_true",TermC.num_str @{thm or_true}), - Thm ("or_false",TermC.num_str @{thm or_false}) + Celem.append_rls "RootEq_prls" Celem.e_rls + [Celem.Calc ("Atools.ident",eval_ident "#ident_"), + Celem.Calc ("Tools.matches",eval_matches ""), + Celem.Calc ("Tools.lhs" ,eval_lhs ""), + Celem.Calc ("Tools.rhs" ,eval_rhs ""), + Celem.Calc ("RootEq.is'_sqrtTerm'_in",eval_is_sqrtTerm_in ""), + Celem.Calc ("RootEq.is'_rootTerm'_in",eval_is_rootTerm_in ""), + Celem.Calc ("RootEq.is'_normSqrtTerm'_in",eval_is_normSqrtTerm_in ""), + Celem.Calc ("HOL.eq",eval_equal "#equal_"), + Celem.Thm ("not_true",TermC.num_str @{thm not_true}), + Celem.Thm ("not_false",TermC.num_str @{thm not_false}), + Celem.Thm ("and_true",TermC.num_str @{thm and_true}), + Celem.Thm ("and_false",TermC.num_str @{thm and_false}), + Celem.Thm ("or_true",TermC.num_str @{thm or_true}), + Celem.Thm ("or_false",TermC.num_str @{thm or_false}) ]; val RootEq_erls = - append_rls "RootEq_erls" Root_erls - [Thm ("divide_divide_eq_left",TermC.num_str @{thm divide_divide_eq_left}) + Celem.append_rls "RootEq_erls" Root_erls + [Celem.Thm ("divide_divide_eq_left",TermC.num_str @{thm divide_divide_eq_left}) ]; val RootEq_crls = - append_rls "RootEq_crls" Root_crls - [Thm ("divide_divide_eq_left",TermC.num_str @{thm divide_divide_eq_left}) + Celem.append_rls "RootEq_crls" Root_crls + [Celem.Thm ("divide_divide_eq_left",TermC.num_str @{thm divide_divide_eq_left}) ]; val rooteq_srls = - append_rls "rooteq_srls" e_rls - [Calc ("RootEq.is'_sqrtTerm'_in",eval_is_sqrtTerm_in ""), - Calc ("RootEq.is'_normSqrtTerm'_in",eval_is_normSqrtTerm_in""), - Calc ("RootEq.is'_rootTerm'_in",eval_is_rootTerm_in "") + Celem.append_rls "rooteq_srls" Celem.e_rls + [Celem.Calc ("RootEq.is'_sqrtTerm'_in",eval_is_sqrtTerm_in ""), + Celem.Calc ("RootEq.is'_normSqrtTerm'_in",eval_is_normSqrtTerm_in""), + Celem.Calc ("RootEq.is'_rootTerm'_in",eval_is_rootTerm_in "") ]; *} setup {* KEStore_Elems.add_rlss @@ -244,101 +244,101 @@ (*isolate the bound variable in an sqrt equation; 'bdv' is a meta-constant*) val sqrt_isolate = prep_rls'( - Rls {id = "sqrt_isolate", preconds = [], rew_ord = ("termlessI",termlessI), - erls = RootEq_erls, srls = Erls, calc = [], errpatts = [], + Celem.Rls {id = "sqrt_isolate", preconds = [], rew_ord = ("termlessI",termlessI), + erls = RootEq_erls, srls = Celem.Erls, calc = [], errpatts = [], rules = [ - Thm("sqrt_square_1",TermC.num_str @{thm sqrt_square_1}), + Celem.Thm("sqrt_square_1",TermC.num_str @{thm sqrt_square_1}), (* (sqrt a)^^^2 -> a *) - Thm("sqrt_square_2",TermC.num_str @{thm sqrt_square_2}), + Celem.Thm("sqrt_square_2",TermC.num_str @{thm sqrt_square_2}), (* sqrt (a^^^2) -> a *) - Thm("sqrt_times_root_1",TermC.num_str @{thm sqrt_times_root_1}), + Celem.Thm("sqrt_times_root_1",TermC.num_str @{thm sqrt_times_root_1}), (* sqrt a sqrt b -> sqrt(ab) *) - Thm("sqrt_times_root_2",TermC.num_str @{thm sqrt_times_root_2}), + Celem.Thm("sqrt_times_root_2",TermC.num_str @{thm sqrt_times_root_2}), (* a sqrt b sqrt c -> a sqrt(bc) *) - Thm("sqrt_square_equation_both_1", + Celem.Thm("sqrt_square_equation_both_1", TermC.num_str @{thm sqrt_square_equation_both_1}), (* (sqrt a + sqrt b = sqrt c + sqrt d) -> (a+2*sqrt(a)*sqrt(b)+b) = c+2*sqrt(c)*sqrt(d)+d) *) - Thm("sqrt_square_equation_both_2", + Celem.Thm("sqrt_square_equation_both_2", TermC.num_str @{thm sqrt_square_equation_both_2}), (* (sqrt a - sqrt b = sqrt c + sqrt d) -> (a-2*sqrt(a)*sqrt(b)+b) = c+2*sqrt(c)*sqrt(d)+d) *) - Thm("sqrt_square_equation_both_3", + Celem.Thm("sqrt_square_equation_both_3", TermC.num_str @{thm sqrt_square_equation_both_3}), (* (sqrt a + sqrt b = sqrt c - sqrt d) -> (a+2*sqrt(a)*sqrt(b)+b) = c-2*sqrt(c)*sqrt(d)+d) *) - Thm("sqrt_square_equation_both_4", + Celem.Thm("sqrt_square_equation_both_4", TermC.num_str @{thm sqrt_square_equation_both_4}), (* (sqrt a - sqrt b = sqrt c - sqrt d) -> (a-2*sqrt(a)*sqrt(b)+b) = c-2*sqrt(c)*sqrt(d)+d) *) - Thm("sqrt_isolate_l_add1", + Celem.Thm("sqrt_isolate_l_add1", TermC.num_str @{thm sqrt_isolate_l_add1}), (* a+b*sqrt(x)=d -> b*sqrt(x) = d-a *) - Thm("sqrt_isolate_l_add2", + Celem.Thm("sqrt_isolate_l_add2", TermC.num_str @{thm sqrt_isolate_l_add2}), (* a+ sqrt(x)=d -> sqrt(x) = d-a *) - Thm("sqrt_isolate_l_add3", + Celem.Thm("sqrt_isolate_l_add3", TermC.num_str @{thm sqrt_isolate_l_add3}), (* a+b*c/sqrt(x)=d->b*c/sqrt(x)=d-a *) - Thm("sqrt_isolate_l_add4", + Celem.Thm("sqrt_isolate_l_add4", TermC.num_str @{thm sqrt_isolate_l_add4}), (* a+c/sqrt(x)=d -> c/sqrt(x) = d-a *) - Thm("sqrt_isolate_l_add5", + Celem.Thm("sqrt_isolate_l_add5", TermC.num_str @{thm sqrt_isolate_l_add5}), (* a+b*c/f*sqrt(x)=d->b*c/f*sqrt(x)=d-a *) - Thm("sqrt_isolate_l_add6", + Celem.Thm("sqrt_isolate_l_add6", TermC.num_str @{thm sqrt_isolate_l_add6}), (* a+c/f*sqrt(x)=d -> c/f*sqrt(x) = d-a *) - (*Thm("sqrt_isolate_l_div",TermC.num_str @{thm sqrt_isolate_l_div}),*) + (*Celem.Thm("sqrt_isolate_l_div",TermC.num_str @{thm sqrt_isolate_l_div}),*) (* b*sqrt(x) = d sqrt(x) d/b *) - Thm("sqrt_isolate_r_add1", + Celem.Thm("sqrt_isolate_r_add1", TermC.num_str @{thm sqrt_isolate_r_add1}), (* a= d+e*sqrt(x) -> a-d=e*sqrt(x) *) - Thm("sqrt_isolate_r_add2", + Celem.Thm("sqrt_isolate_r_add2", TermC.num_str @{thm sqrt_isolate_r_add2}), (* a= d+ sqrt(x) -> a-d= sqrt(x) *) - Thm("sqrt_isolate_r_add3", + Celem.Thm("sqrt_isolate_r_add3", TermC.num_str @{thm sqrt_isolate_r_add3}), (* a=d+e*g/sqrt(x)->a-d=e*g/sqrt(x)*) - Thm("sqrt_isolate_r_add4", + Celem.Thm("sqrt_isolate_r_add4", TermC.num_str @{thm sqrt_isolate_r_add4}), (* a= d+g/sqrt(x) -> a-d=g/sqrt(x) *) - Thm("sqrt_isolate_r_add5", + Celem.Thm("sqrt_isolate_r_add5", TermC.num_str @{thm sqrt_isolate_r_add5}), (* a=d+e*g/h*sqrt(x)->a-d=e*g/h*sqrt(x)*) - Thm("sqrt_isolate_r_add6", + Celem.Thm("sqrt_isolate_r_add6", TermC.num_str @{thm sqrt_isolate_r_add6}), (* a= d+g/h*sqrt(x) -> a-d=g/h*sqrt(x) *) - (*Thm("sqrt_isolate_r_div",TermC.num_str @{thm sqrt_isolate_r_div}),*) + (*Celem.Thm("sqrt_isolate_r_div",TermC.num_str @{thm sqrt_isolate_r_div}),*) (* a=e*sqrt(x) -> a/e = sqrt(x) *) - Thm("sqrt_square_equation_left_1", + Celem.Thm("sqrt_square_equation_left_1", TermC.num_str @{thm sqrt_square_equation_left_1}), (* sqrt(x)=b -> x=b^2 *) - Thm("sqrt_square_equation_left_2", + Celem.Thm("sqrt_square_equation_left_2", TermC.num_str @{thm sqrt_square_equation_left_2}), (* c*sqrt(x)=b -> c^2*x=b^2 *) - Thm("sqrt_square_equation_left_3",TermC.num_str @{thm sqrt_square_equation_left_3}), + Celem.Thm("sqrt_square_equation_left_3",TermC.num_str @{thm sqrt_square_equation_left_3}), (* c/sqrt(x)=b -> c^2/x=b^2 *) - Thm("sqrt_square_equation_left_4",TermC.num_str @{thm sqrt_square_equation_left_4}), + Celem.Thm("sqrt_square_equation_left_4",TermC.num_str @{thm sqrt_square_equation_left_4}), (* c*d/sqrt(x)=b -> c^2*d^2/x=b^2 *) - Thm("sqrt_square_equation_left_5",TermC.num_str @{thm sqrt_square_equation_left_5}), + Celem.Thm("sqrt_square_equation_left_5",TermC.num_str @{thm sqrt_square_equation_left_5}), (* c/d*sqrt(x)=b -> c^2/d^2x=b^2 *) - Thm("sqrt_square_equation_left_6",TermC.num_str @{thm sqrt_square_equation_left_6}), + Celem.Thm("sqrt_square_equation_left_6",TermC.num_str @{thm sqrt_square_equation_left_6}), (* c*d/g*sqrt(x)=b -> c^2*d^2/g^2x=b^2 *) - Thm("sqrt_square_equation_right_1",TermC.num_str @{thm sqrt_square_equation_right_1}), + Celem.Thm("sqrt_square_equation_right_1",TermC.num_str @{thm sqrt_square_equation_right_1}), (* a=sqrt(x) ->a^2=x *) - Thm("sqrt_square_equation_right_2",TermC.num_str @{thm sqrt_square_equation_right_2}), + Celem.Thm("sqrt_square_equation_right_2",TermC.num_str @{thm sqrt_square_equation_right_2}), (* a=c*sqrt(x) ->a^2=c^2*x *) - Thm("sqrt_square_equation_right_3",TermC.num_str @{thm sqrt_square_equation_right_3}), + Celem.Thm("sqrt_square_equation_right_3",TermC.num_str @{thm sqrt_square_equation_right_3}), (* a=c/sqrt(x) ->a^2=c^2/x *) - Thm("sqrt_square_equation_right_4",TermC.num_str @{thm sqrt_square_equation_right_4}), + Celem.Thm("sqrt_square_equation_right_4",TermC.num_str @{thm sqrt_square_equation_right_4}), (* a=c*d/sqrt(x) ->a^2=c^2*d^2/x *) - Thm("sqrt_square_equation_right_5",TermC.num_str @{thm sqrt_square_equation_right_5}), + Celem.Thm("sqrt_square_equation_right_5",TermC.num_str @{thm sqrt_square_equation_right_5}), (* a=c/e*sqrt(x) ->a^2=c^2/e^2x *) - Thm("sqrt_square_equation_right_6",TermC.num_str @{thm sqrt_square_equation_right_6}) + Celem.Thm("sqrt_square_equation_right_6",TermC.num_str @{thm sqrt_square_equation_right_6}) (* a=c*d/g*sqrt(x) ->a^2=c^2*d^2/g^2*x *) - ],scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls); + ],scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }); *} setup {* KEStore_Elems.add_rlss [("sqrt_isolate", (Context.theory_name @{theory}, sqrt_isolate))] *} @@ -346,47 +346,47 @@ (*isolate the bound variable in an sqrt left equation; 'bdv' is a meta-constant*) val l_sqrt_isolate = prep_rls'( - Rls {id = "l_sqrt_isolate", preconds = [], + Celem.Rls {id = "l_sqrt_isolate", preconds = [], rew_ord = ("termlessI",termlessI), - erls = RootEq_erls, srls = Erls, calc = [], errpatts = [], + erls = RootEq_erls, srls = Celem.Erls, calc = [], errpatts = [], rules = [ - Thm("sqrt_square_1",TermC.num_str @{thm sqrt_square_1}), + Celem.Thm("sqrt_square_1",TermC.num_str @{thm sqrt_square_1}), (* (sqrt a)^^^2 -> a *) - Thm("sqrt_square_2",TermC.num_str @{thm sqrt_square_2}), + Celem.Thm("sqrt_square_2",TermC.num_str @{thm sqrt_square_2}), (* sqrt (a^^^2) -> a *) - Thm("sqrt_times_root_1",TermC.num_str @{thm sqrt_times_root_1}), + Celem.Thm("sqrt_times_root_1",TermC.num_str @{thm sqrt_times_root_1}), (* sqrt a sqrt b -> sqrt(ab) *) - Thm("sqrt_times_root_2",TermC.num_str @{thm sqrt_times_root_2}), + Celem.Thm("sqrt_times_root_2",TermC.num_str @{thm sqrt_times_root_2}), (* a sqrt b sqrt c -> a sqrt(bc) *) - Thm("sqrt_isolate_l_add1",TermC.num_str @{thm sqrt_isolate_l_add1}), + Celem.Thm("sqrt_isolate_l_add1",TermC.num_str @{thm sqrt_isolate_l_add1}), (* a+b*sqrt(x)=d -> b*sqrt(x) = d-a *) - Thm("sqrt_isolate_l_add2",TermC.num_str @{thm sqrt_isolate_l_add2}), + Celem.Thm("sqrt_isolate_l_add2",TermC.num_str @{thm sqrt_isolate_l_add2}), (* a+ sqrt(x)=d -> sqrt(x) = d-a *) - Thm("sqrt_isolate_l_add3",TermC.num_str @{thm sqrt_isolate_l_add3}), + Celem.Thm("sqrt_isolate_l_add3",TermC.num_str @{thm sqrt_isolate_l_add3}), (* a+b*c/sqrt(x)=d->b*c/sqrt(x)=d-a *) - Thm("sqrt_isolate_l_add4",TermC.num_str @{thm sqrt_isolate_l_add4}), + Celem.Thm("sqrt_isolate_l_add4",TermC.num_str @{thm sqrt_isolate_l_add4}), (* a+c/sqrt(x)=d -> c/sqrt(x) = d-a *) - Thm("sqrt_isolate_l_add5",TermC.num_str @{thm sqrt_isolate_l_add5}), + Celem.Thm("sqrt_isolate_l_add5",TermC.num_str @{thm sqrt_isolate_l_add5}), (* a+b*c/f*sqrt(x)=d->b*c/f*sqrt(x)=d-a *) - Thm("sqrt_isolate_l_add6",TermC.num_str @{thm sqrt_isolate_l_add6}), + Celem.Thm("sqrt_isolate_l_add6",TermC.num_str @{thm sqrt_isolate_l_add6}), (* a+c/f*sqrt(x)=d -> c/f*sqrt(x) = d-a *) - (*Thm("sqrt_isolate_l_div",TermC.num_str @{thm sqrt_isolate_l_div}),*) + (*Celem.Thm("sqrt_isolate_l_div",TermC.num_str @{thm sqrt_isolate_l_div}),*) (* b*sqrt(x) = d sqrt(x) d/b *) - Thm("sqrt_square_equation_left_1",TermC.num_str @{thm sqrt_square_equation_left_1}), + Celem.Thm("sqrt_square_equation_left_1",TermC.num_str @{thm sqrt_square_equation_left_1}), (* sqrt(x)=b -> x=b^2 *) - Thm("sqrt_square_equation_left_2",TermC.num_str @{thm sqrt_square_equation_left_2}), + Celem.Thm("sqrt_square_equation_left_2",TermC.num_str @{thm sqrt_square_equation_left_2}), (* a*sqrt(x)=b -> a^2*x=b^2*) - Thm("sqrt_square_equation_left_3",TermC.num_str @{thm sqrt_square_equation_left_3}), + Celem.Thm("sqrt_square_equation_left_3",TermC.num_str @{thm sqrt_square_equation_left_3}), (* c/sqrt(x)=b -> c^2/x=b^2 *) - Thm("sqrt_square_equation_left_4",TermC.num_str @{thm sqrt_square_equation_left_4}), + Celem.Thm("sqrt_square_equation_left_4",TermC.num_str @{thm sqrt_square_equation_left_4}), (* c*d/sqrt(x)=b -> c^2*d^2/x=b^2 *) - Thm("sqrt_square_equation_left_5",TermC.num_str @{thm sqrt_square_equation_left_5}), + Celem.Thm("sqrt_square_equation_left_5",TermC.num_str @{thm sqrt_square_equation_left_5}), (* c/d*sqrt(x)=b -> c^2/d^2x=b^2 *) - Thm("sqrt_square_equation_left_6",TermC.num_str @{thm sqrt_square_equation_left_6}) + Celem.Thm("sqrt_square_equation_left_6",TermC.num_str @{thm sqrt_square_equation_left_6}) (* c*d/g*sqrt(x)=b -> c^2*d^2/g^2x=b^2 *) ], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls); + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }); *} setup {* KEStore_Elems.add_rlss [("l_sqrt_isolate", (Context.theory_name @{theory}, l_sqrt_isolate))] *} @@ -395,82 +395,82 @@ (* -- right 28.8.02--*) (*isolate the bound variable in an sqrt right equation; 'bdv' is a meta-constant*) val r_sqrt_isolate = prep_rls'( - Rls {id = "r_sqrt_isolate", preconds = [], + Celem.Rls {id = "r_sqrt_isolate", preconds = [], rew_ord = ("termlessI",termlessI), - erls = RootEq_erls, srls = Erls, calc = [], errpatts = [], + erls = RootEq_erls, srls = Celem.Erls, calc = [], errpatts = [], rules = [ - Thm("sqrt_square_1",TermC.num_str @{thm sqrt_square_1}), + Celem.Thm("sqrt_square_1",TermC.num_str @{thm sqrt_square_1}), (* (sqrt a)^^^2 -> a *) - Thm("sqrt_square_2",TermC.num_str @{thm sqrt_square_2}), + Celem.Thm("sqrt_square_2",TermC.num_str @{thm sqrt_square_2}), (* sqrt (a^^^2) -> a *) - Thm("sqrt_times_root_1",TermC.num_str @{thm sqrt_times_root_1}), + Celem.Thm("sqrt_times_root_1",TermC.num_str @{thm sqrt_times_root_1}), (* sqrt a sqrt b -> sqrt(ab) *) - Thm("sqrt_times_root_2",TermC.num_str @{thm sqrt_times_root_2}), + Celem.Thm("sqrt_times_root_2",TermC.num_str @{thm sqrt_times_root_2}), (* a sqrt b sqrt c -> a sqrt(bc) *) - Thm("sqrt_isolate_r_add1",TermC.num_str @{thm sqrt_isolate_r_add1}), + Celem.Thm("sqrt_isolate_r_add1",TermC.num_str @{thm sqrt_isolate_r_add1}), (* a= d+e*sqrt(x) -> a-d=e*sqrt(x) *) - Thm("sqrt_isolate_r_add2",TermC.num_str @{thm sqrt_isolate_r_add2}), + Celem.Thm("sqrt_isolate_r_add2",TermC.num_str @{thm sqrt_isolate_r_add2}), (* a= d+ sqrt(x) -> a-d= sqrt(x) *) - Thm("sqrt_isolate_r_add3",TermC.num_str @{thm sqrt_isolate_r_add3}), + Celem.Thm("sqrt_isolate_r_add3",TermC.num_str @{thm sqrt_isolate_r_add3}), (* a=d+e*g/sqrt(x)->a-d=e*g/sqrt(x)*) - Thm("sqrt_isolate_r_add4",TermC.num_str @{thm sqrt_isolate_r_add4}), + Celem.Thm("sqrt_isolate_r_add4",TermC.num_str @{thm sqrt_isolate_r_add4}), (* a= d+g/sqrt(x) -> a-d=g/sqrt(x) *) - Thm("sqrt_isolate_r_add5",TermC.num_str @{thm sqrt_isolate_r_add5}), + Celem.Thm("sqrt_isolate_r_add5",TermC.num_str @{thm sqrt_isolate_r_add5}), (* a=d+e*g/h*sqrt(x)->a-d=e*g/h*sqrt(x)*) - Thm("sqrt_isolate_r_add6",TermC.num_str @{thm sqrt_isolate_r_add6}), + Celem.Thm("sqrt_isolate_r_add6",TermC.num_str @{thm sqrt_isolate_r_add6}), (* a= d+g/h*sqrt(x) -> a-d=g/h*sqrt(x) *) - (*Thm("sqrt_isolate_r_div",TermC.num_str @{thm sqrt_isolate_r_div}),*) + (*Celem.Thm("sqrt_isolate_r_div",TermC.num_str @{thm sqrt_isolate_r_div}),*) (* a=e*sqrt(x) -> a/e = sqrt(x) *) - Thm("sqrt_square_equation_right_1",TermC.num_str @{thm sqrt_square_equation_right_1}), + Celem.Thm("sqrt_square_equation_right_1",TermC.num_str @{thm sqrt_square_equation_right_1}), (* a=sqrt(x) ->a^2=x *) - Thm("sqrt_square_equation_right_2",TermC.num_str @{thm sqrt_square_equation_right_2}), + Celem.Thm("sqrt_square_equation_right_2",TermC.num_str @{thm sqrt_square_equation_right_2}), (* a=c*sqrt(x) ->a^2=c^2*x *) - Thm("sqrt_square_equation_right_3",TermC.num_str @{thm sqrt_square_equation_right_3}), + Celem.Thm("sqrt_square_equation_right_3",TermC.num_str @{thm sqrt_square_equation_right_3}), (* a=c/sqrt(x) ->a^2=c^2/x *) - Thm("sqrt_square_equation_right_4",TermC.num_str @{thm sqrt_square_equation_right_4}), + Celem.Thm("sqrt_square_equation_right_4",TermC.num_str @{thm sqrt_square_equation_right_4}), (* a=c*d/sqrt(x) ->a^2=c^2*d^2/x *) - Thm("sqrt_square_equation_right_5",TermC.num_str @{thm sqrt_square_equation_right_5}), + Celem.Thm("sqrt_square_equation_right_5",TermC.num_str @{thm sqrt_square_equation_right_5}), (* a=c/e*sqrt(x) ->a^2=c^2/e^2x *) - Thm("sqrt_square_equation_right_6",TermC.num_str @{thm sqrt_square_equation_right_6}) + Celem.Thm("sqrt_square_equation_right_6",TermC.num_str @{thm sqrt_square_equation_right_6}) (* a=c*d/g*sqrt(x) ->a^2=c^2*d^2/g^2*x *) ], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls); + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }); *} setup {* KEStore_Elems.add_rlss [("r_sqrt_isolate", (Context.theory_name @{theory}, r_sqrt_isolate))] *} ML {* val rooteq_simplify = prep_rls'( - Rls {id = "rooteq_simplify", + Celem.Rls {id = "rooteq_simplify", preconds = [], rew_ord = ("termlessI",termlessI), - erls = RootEq_erls, srls = Erls, calc = [], errpatts = [], + erls = RootEq_erls, srls = Celem.Erls, calc = [], errpatts = [], (*asm_thm = [("sqrt_square_1","")],*) - rules = [Thm ("real_assoc_1",TermC.num_str @{thm real_assoc_1}), + rules = [Celem.Thm ("real_assoc_1",TermC.num_str @{thm real_assoc_1}), (* a+(b+c) = a+b+c *) - Thm ("real_assoc_2",TermC.num_str @{thm real_assoc_2}), + Celem.Thm ("real_assoc_2",TermC.num_str @{thm real_assoc_2}), (* a*(b*c) = a*b*c *) - Calc ("Groups.plus_class.plus",eval_binop "#add_"), - Calc ("Groups.minus_class.minus",eval_binop "#sub_"), - Calc ("Groups.times_class.times",eval_binop "#mult_"), - Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"), - Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"), - Calc ("Atools.pow" ,eval_binop "#power_"), - Thm("real_plus_binom_pow2",TermC.num_str @{thm real_plus_binom_pow2}), - Thm("real_minus_binom_pow2",TermC.num_str @{thm real_minus_binom_pow2}), - Thm("realpow_mul",TermC.num_str @{thm realpow_mul}), + Celem.Calc ("Groups.plus_class.plus",eval_binop "#add_"), + Celem.Calc ("Groups.minus_class.minus",eval_binop "#sub_"), + Celem.Calc ("Groups.times_class.times",eval_binop "#mult_"), + Celem.Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"), + Celem.Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"), + Celem.Calc ("Atools.pow" ,eval_binop "#power_"), + Celem.Thm("real_plus_binom_pow2",TermC.num_str @{thm real_plus_binom_pow2}), + Celem.Thm("real_minus_binom_pow2",TermC.num_str @{thm real_minus_binom_pow2}), + Celem.Thm("realpow_mul",TermC.num_str @{thm realpow_mul}), (* (a * b)^n = a^n * b^n*) - Thm("sqrt_times_root_1",TermC.num_str @{thm sqrt_times_root_1}), + Celem.Thm("sqrt_times_root_1",TermC.num_str @{thm sqrt_times_root_1}), (* sqrt b * sqrt c = sqrt(b*c) *) - Thm("sqrt_times_root_2",TermC.num_str @{thm sqrt_times_root_2}), + Celem.Thm("sqrt_times_root_2",TermC.num_str @{thm sqrt_times_root_2}), (* a * sqrt a * sqrt b = a * sqrt(a*b) *) - Thm("sqrt_square_2",TermC.num_str @{thm sqrt_square_2}), + Celem.Thm("sqrt_square_2",TermC.num_str @{thm sqrt_square_2}), (* sqrt (a^^^2) = a *) - Thm("sqrt_square_1",TermC.num_str @{thm sqrt_square_1}) + Celem.Thm("sqrt_square_1",TermC.num_str @{thm sqrt_square_1}) (* sqrt a ^^^ 2 = a *) ], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls); + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }); *} setup {* KEStore_Elems.add_rlss [("rooteq_simplify", (Context.theory_name @{theory}, rooteq_simplify))] *} @@ -484,7 +484,7 @@ *} setup {* KEStore_Elems.add_pbts (* ---------root----------- *) - [(Specify.prep_pbt thy "pbl_equ_univ_root" [] e_pblID + [(Specify.prep_pbt thy "pbl_equ_univ_root" [] Celem.e_pblID (["root'","univariate","equation"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["(lhs e_e) is_rootTerm_in (v_v::real) | " ^ @@ -492,7 +492,7 @@ ("#Find" ,["solutions v_v'i'"])], RootEq_prls, SOME "solve (e_e::bool, v_v)", [])), (* ---------sqrt----------- *) - (Specify.prep_pbt thy "pbl_equ_univ_root_sq" [] e_pblID + (Specify.prep_pbt thy "pbl_equ_univ_root_sq" [] Celem.e_pblID (["sq","root'","univariate","equation"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["( ((lhs e_e) is_sqrtTerm_in (v_v::real)) &" ^ @@ -502,7 +502,7 @@ ("#Find" ,["solutions v_v'i'"])], RootEq_prls, SOME "solve (e_e::bool, v_v)", [["RootEq","solve_sq_root_equation"]])), (* ---------normalise----------- *) - (Specify.prep_pbt thy "pbl_equ_univ_root_norm" [] e_pblID + (Specify.prep_pbt thy "pbl_equ_univ_root_norm" [] Celem.e_pblID (["normalise","root'","univariate","equation"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["( ((lhs e_e) is_sqrtTerm_in (v_v::real)) &" ^ @@ -516,12 +516,12 @@ (*-------------------------methods-----------------------*) setup {* KEStore_Elems.add_mets [(* ---- root 20.8.02 ---*) - Specify.prep_met thy "met_rooteq" [] e_metID + Specify.prep_met thy "met_rooteq" [] Celem.e_metID (["RootEq"], [], - {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = e_rls, prls=e_rls, + {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = Celem.e_rls, prls=Celem.e_rls, crls=RootEq_crls, errpats = [], nrls = norm_Poly}, "empty_script"), (*-- normalise 20.10.02 --*) - Specify.prep_met thy "met_rooteq_norm" [] e_metID + Specify.prep_met thy "met_rooteq_norm" [] Celem.e_metID (["RootEq","norm_sq_root_equation"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["( ((lhs e_e) is_sqrtTerm_in (v_v::real)) &" ^ @@ -529,7 +529,7 @@ "( ((rhs e_e) is_sqrtTerm_in (v_v::real)) &" ^ " Not((rhs e_e) is_normSqrtTerm_in (v_v::real)))"]), ("#Find" ,["solutions v_v'i'"])], - {rew_ord'="termlessI", rls'=RootEq_erls, srls=e_rls, prls=RootEq_prls, calc=[], + {rew_ord'="termlessI", rls'=RootEq_erls, srls=Celem.e_rls, prls=RootEq_prls, calc=[], crls=RootEq_crls, errpats = [], nrls = norm_Poly}, "Script Norm_sq_root_equation (e_e::bool) (v_v::real) = " ^ "(let e_e = ((Repeat(Try (Rewrite makex1_x False))) @@ " ^ @@ -539,7 +539,7 @@ " (Try (Rewrite_Set rooteq_simplify True))) e_e " ^ " in ((SubProblem (RootEq',[univariate,equation], " ^ " [no_met]) [BOOL e_e, REAL v_v])))"), - Specify.prep_met thy "met_rooteq_sq" [] e_metID + Specify.prep_met thy "met_rooteq_sq" [] Celem.e_metID (["RootEq","solve_sq_root_equation"], [("#Given" ,["equality e_e", "solveFor v_v"]), ("#Where" ,["(((lhs e_e) is_sqrtTerm_in (v_v::real)) & " ^ @@ -564,12 +564,12 @@ " [BOOL e_e, REAL v_v])) " ^ "in Check_elementwise L_L {(v_v::real). Assumptions})"), (*-- right 28.08.02 --*) - Specify.prep_met thy "met_rooteq_sq_right" [] e_metID + Specify.prep_met thy "met_rooteq_sq_right" [] Celem.e_metID (["RootEq","solve_right_sq_root_equation"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["(rhs e_e) is_sqrtTerm_in v_v"]), ("#Find" ,["solutions v_v'i'"])], - {rew_ord' = "termlessI", rls' = RootEq_erls, srls = e_rls, prls = RootEq_prls, calc = [], + {rew_ord' = "termlessI", rls' = RootEq_erls, srls = Celem.e_rls, prls = RootEq_prls, calc = [], crls = RootEq_crls, errpats = [], nrls = norm_Poly}, "Script Solve_right_sq_root_equation (e_e::bool) (v_v::real) = " ^ "(let e_e = " ^ @@ -584,12 +584,12 @@ " else ((SubProblem (RootEq',[univariate,equation], " ^ " [no_met]) [BOOL e_e, REAL v_v])))"), (*-- left 28.08.02 --*) - Specify.prep_met thy "met_rooteq_sq_left" [] e_metID + Specify.prep_met thy "met_rooteq_sq_left" [] Celem.e_metID (["RootEq","solve_left_sq_root_equation"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["(lhs e_e) is_sqrtTerm_in v_v"]), ("#Find" ,["solutions v_v'i'"])], - {rew_ord'="termlessI", rls'=RootEq_erls, srls=e_rls, prls=RootEq_prls, calc=[], + {rew_ord'="termlessI", rls'=RootEq_erls, srls=Celem.e_rls, prls=RootEq_prls, calc=[], crls=RootEq_crls, errpats = [], nrls = norm_Poly}, "Script Solve_left_sq_root_equation (e_e::bool) (v_v::real) = " ^ "(let e_e = " ^ diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/RootRat.thy --- a/src/Tools/isac/Knowledge/RootRat.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/RootRat.thy Thu Mar 15 12:42:04 2018 +0100 @@ -9,20 +9,20 @@ val thy = @{theory}; val rootrat_erls = - merge_rls "rootrat_erls" Root_erls - (merge_rls "" rational_erls - (append_rls "" e_rls [])); + Celem.merge_rls "rootrat_erls" Root_erls + (Celem.merge_rls "" rational_erls + (Celem.append_rls "" Celem.e_rls [])); (*.calculate numeral groundterms.*) val calculate_RootRat = - append_rls "calculate_RootRat" calculate_Rational - [Thm ("distrib_left",TermC.num_str @{thm distrib_left}), + Celem.append_rls "calculate_RootRat" calculate_Rational + [Celem.Thm ("distrib_left",TermC.num_str @{thm distrib_left}), (* w*(z1.0 + z2.0) = w * z1.0 + w * z2.0 *) - Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}), + Celem.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}), (* 1 * z = z *) - Thm ("sym_real_mult_minus1",TermC.num_str (@{thm real_mult_minus1} RS @{thm sym})), + Celem.Thm ("sym_real_mult_minus1",TermC.num_str (@{thm real_mult_minus1} RS @{thm sym})), (* "- z1 = -1 * z1" *) - Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_") + Celem.Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_") ]; val prep_rls' = LTool.prep_rls @{theory}; diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/RootRatEq.thy --- a/src/Tools/isac/Knowledge/RootRatEq.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/RootRatEq.thy Thu Mar 15 12:42:04 2018 +0100 @@ -68,44 +68,44 @@ fun eval_is_rootRatAddTerm_in _ _ (p as (Const ("RootRatEq.is'_rootRatAddTerm'_in",_) $ t $ v)) _ = if is_rootRatAddTerm_in t v then - SOME ((term2str p) ^ " = True", + SOME ((Celem.term2str p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term True}))) - else SOME ((term2str p) ^ " = True", + else SOME ((Celem.term2str p) ^ " = True", HOLogic.Trueprop $ (TermC.mk_equality (p, @{term False}))) | eval_is_rootRatAddTerm_in _ _ _ _ = ((*tracing"### nichts matcht";*) NONE); *} ML {* (*-------------------------rulse-------------------------*) val RootRatEq_prls = - append_rls "RootRatEq_prls" e_rls - [Calc ("Atools.ident",eval_ident "#ident_"), - Calc ("Tools.matches",eval_matches ""), - Calc ("Tools.lhs" ,eval_lhs ""), - Calc ("Tools.rhs" ,eval_rhs ""), - Calc ("RootEq.is'_rootTerm'_in",eval_is_rootTerm_in ""), - Calc ("RootRatEq.is'_rootRatAddTerm'_in", + Celem.append_rls "RootRatEq_prls" Celem.e_rls + [Celem.Calc ("Atools.ident",eval_ident "#ident_"), + Celem.Calc ("Tools.matches",eval_matches ""), + Celem.Calc ("Tools.lhs" ,eval_lhs ""), + Celem.Calc ("Tools.rhs" ,eval_rhs ""), + Celem.Calc ("RootEq.is'_rootTerm'_in",eval_is_rootTerm_in ""), + Celem.Calc ("RootRatEq.is'_rootRatAddTerm'_in", eval_is_rootRatAddTerm_in ""), - Calc ("HOL.eq",eval_equal "#equal_"), - Thm ("not_true",TermC.num_str @{thm not_true}), - Thm ("not_false",TermC.num_str @{thm not_false}), - Thm ("and_true",TermC.num_str @{thm and_true}), - Thm ("and_false",TermC.num_str @{thm and_false}), - Thm ("or_true",TermC.num_str @{thm or_true}), - Thm ("or_false",TermC.num_str @{thm or_false}) + Celem.Calc ("HOL.eq",eval_equal "#equal_"), + Celem.Thm ("not_true",TermC.num_str @{thm not_true}), + Celem.Thm ("not_false",TermC.num_str @{thm not_false}), + Celem.Thm ("and_true",TermC.num_str @{thm and_true}), + Celem.Thm ("and_false",TermC.num_str @{thm and_false}), + Celem.Thm ("or_true",TermC.num_str @{thm or_true}), + Celem.Thm ("or_false",TermC.num_str @{thm or_false}) ]; val RooRatEq_erls = - merge_rls "RooRatEq_erls" rootrat_erls - (merge_rls "" RootEq_erls - (merge_rls "" rateq_erls - (append_rls "" e_rls + Celem.merge_rls "RooRatEq_erls" rootrat_erls + (Celem.merge_rls "" RootEq_erls + (Celem.merge_rls "" rateq_erls + (Celem.append_rls "" Celem.e_rls []))); val RootRatEq_crls = - merge_rls "RootRatEq_crls" rootrat_erls - (merge_rls "" RootEq_erls - (merge_rls "" rateq_erls - (append_rls "" e_rls + Celem.merge_rls "RootRatEq_crls" rootrat_erls + (Celem.merge_rls "" RootEq_erls + (Celem.merge_rls "" rateq_erls + (Celem.append_rls "" Celem.e_rls []))); *} setup {* KEStore_Elems.add_rlss @@ -113,21 +113,21 @@ ML {* (* Solves a rootrat Equation *) val rootrat_solve = prep_rls'( - Rls {id = "rootrat_solve", preconds = [], + Celem.Rls {id = "rootrat_solve", preconds = [], rew_ord = ("termlessI",termlessI), - erls = e_rls, srls = Erls, calc = [], errpatts = [], + erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [], rules = - [Thm("rootrat_equation_left_1", TermC.num_str @{thm rootrat_equation_left_1}), + [Celem.Thm("rootrat_equation_left_1", TermC.num_str @{thm rootrat_equation_left_1}), (* [|c is_rootTerm_in bdv|] ==> ( (a + b/c = d) = ( b = (d - a) * c )) *) - Thm("rootrat_equation_left_2",TermC.num_str @{thm rootrat_equation_left_2}), + Celem.Thm("rootrat_equation_left_2",TermC.num_str @{thm rootrat_equation_left_2}), (* [|c is_rootTerm_in bdv|] ==> ( (b/c = d) = ( b = d * c )) *) - Thm("rootrat_equation_right_1",TermC.num_str @{thm rootrat_equation_right_1}), + Celem.Thm("rootrat_equation_right_1",TermC.num_str @{thm rootrat_equation_right_1}), (* [|f is_rootTerm_in bdv|] ==> ( (a = d + e/f) = ( (a - d) * f = e )) *) - Thm("rootrat_equation_right_2",TermC.num_str @{thm rootrat_equation_right_2}) + Celem.Thm("rootrat_equation_right_2",TermC.num_str @{thm rootrat_equation_right_2}) (* [|f is_rootTerm_in bdv|] ==> ( (a = e/f) = ( a * f = e ))*) - ], scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")}:rls); + ], scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")}); *} setup {* KEStore_Elems.add_rlss [("rootrat_solve", (Context.theory_name @{theory}, rootrat_solve))] *} @@ -139,7 +139,7 @@ *) *} setup {* KEStore_Elems.add_pbts - [(Specify.prep_pbt thy "pbl_equ_univ_root_sq_rat" [] e_pblID + [(Specify.prep_pbt thy "pbl_equ_univ_root_sq_rat" [] Celem.e_pblID (["rat","sq","root'","univariate","equation"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["( (lhs e_e) is_rootRatAddTerm_in (v_v::real) )| " ^ @@ -149,18 +149,18 @@ (*-------------------------Methode-----------------------*) setup {* KEStore_Elems.add_mets - [Specify.prep_met @{theory LinEq} "met_rootrateq" [] e_metID + [Specify.prep_met @{theory LinEq} "met_rootrateq" [] Celem.e_metID (["RootRatEq"], [], - {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = e_rls, prls=e_rls, + {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = Celem.e_rls, prls=Celem.e_rls, crls=Atools_erls, errpats = [], nrls = norm_Rational}, "empty_script"), (*-- left 20.10.02 --*) - Specify.prep_met thy "met_rootrateq_elim" [] e_metID + Specify.prep_met thy "met_rootrateq_elim" [] Celem.e_metID (["RootRatEq","elim_rootrat_equation"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["( (lhs e_e) is_rootRatAddTerm_in (v_v::real) ) | " ^ "( (rhs e_e) is_rootRatAddTerm_in (v_v::real) )"]), ("#Find" ,["solutions v_v'i'"])], - {rew_ord'="termlessI", rls'=RooRatEq_erls, srls=e_rls, prls=RootRatEq_prls, calc=[], + {rew_ord'="termlessI", rls'=RooRatEq_erls, srls=Celem.e_rls, prls=RootRatEq_prls, calc=[], crls=RootRatEq_crls, errpats = [], nrls = norm_Rational}, "Script Elim_rootrat_equation (e_e::bool) (v_v::real) = " ^ "(let e_e = ((Try (Rewrite_Set expand_rootbinoms False)) @@ " ^ diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/Simplify.thy --- a/src/Tools/isac/Knowledge/Simplify.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/Simplify.thy Thu Mar 15 12:42:04 2018 +0100 @@ -29,25 +29,25 @@ *} (** problems **) setup {* KEStore_Elems.add_pbts - [(Specify.prep_pbt thy "pbl_simp" [] e_pblID + [(Specify.prep_pbt thy "pbl_simp" [] Celem.e_pblID (["simplification"], [("#Given" ,["Term t_t"]), ("#Find" ,["normalform n_n"])], - append_rls "e_rls" e_rls [(*for preds in where_*)], SOME "Simplify t_t", [])), - (Specify.prep_pbt thy "pbl_vereinfache" [] e_pblID + Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*)], SOME "Simplify t_t", [])), + (Specify.prep_pbt thy "pbl_vereinfache" [] Celem.e_pblID (["vereinfachen"], [("#Given", ["Term t_t"]), ("#Find", ["normalform n_n"])], - append_rls "e_rls" e_rls [(*for preds in where_*)], SOME "Vereinfache t_t", []))] *} + Celem.append_rls "xxxe_rlsxxx" Celem.e_rls [(*for preds in where_*)], SOME "Vereinfache t_t", []))] *} (** methods **) setup {* KEStore_Elems.add_mets - [Specify.prep_met thy "met_tsimp" [] e_metID + [Specify.prep_met thy "met_tsimp" [] Celem.e_metID (["simplification"], [("#Given" ,["Term t_t"]), ("#Find" ,["normalform n_n"])], - {rew_ord'="tless_true", rls'= e_rls, calc = [], srls = e_rls, prls=e_rls, crls = e_rls, - errpats = [], nrls = e_rls}, + {rew_ord'="tless_true", rls'= Celem.e_rls, calc = [], srls = Celem.e_rls, prls=Celem.e_rls, crls = Celem.e_rls, + errpats = [], nrls = Celem.e_rls}, "empty_script")] *} diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/Knowledge/Test.thy --- a/src/Tools/isac/Knowledge/Test.thy Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/Knowledge/Test.thy Thu Mar 15 12:42:04 2018 +0100 @@ -172,21 +172,21 @@ fun eval_contains_root (thmid:string) _ (t as (Const("Test.contains'_root",t0) $ arg)) thy = if member op = (ids_of arg) "sqrt" - then SOME (TermC.mk_thmid thmid (term_to_string''' thy arg)"", + then SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg)"", HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True}))) - else SOME (TermC.mk_thmid thmid (term_to_string''' thy arg)"", + else SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg)"", HOLogic.Trueprop $ (TermC.mk_equality (t, @{term False}))) | eval_contains_root _ _ _ _ = NONE; (*dummy precondition for root-met of x+1=2*) fun eval_precond_rootmet (thmid:string) _ (t as (Const ("Test.precond'_rootmet", _) $ arg)) thy = - SOME (TermC.mk_thmid thmid (term_to_string''' thy arg)"", + SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg)"", HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True}))) | eval_precond_rootmet _ _ _ _ = NONE; (*dummy precondition for root-pbl of x+1=2*) fun eval_precond_rootpbl (thmid:string) _ (t as (Const ("Test.precond'_rootpbl", _) $ arg)) thy = - SOME (TermC.mk_thmid thmid (term_to_string''' thy arg) "", + SOME (TermC.mk_thmid thmid (Celem.term_to_string''' thy arg) "", HOLogic.Trueprop $ (TermC.mk_equality (t, @{term True}))) | eval_precond_rootpbl _ _ _ _ = NONE; *} @@ -197,120 +197,120 @@ eval_precond_rootpbl"#Test.precond_rootpbl_"))] *} ML {* (** term order **) -fun term_order (_:subst) tu = (term_ordI [] tu = LESS); +fun term_order (_: Celem.subst) tu = (term_ordI [] tu = LESS); (** rule sets **) val testerls = - Rls {id = "testerls", preconds = [], rew_ord = ("termlessI",termlessI), - erls = e_rls, srls = Erls, + Celem.Rls {id = "testerls", preconds = [], rew_ord = ("termlessI",termlessI), + erls = Celem.e_rls, srls = Celem.Erls, calc = [], errpatts = [], - rules = [Thm ("refl",TermC.num_str @{thm refl}), - Thm ("order_refl",TermC.num_str @{thm order_refl}), - Thm ("radd_left_cancel_le",TermC.num_str @{thm radd_left_cancel_le}), - Thm ("not_true",TermC.num_str @{thm not_true}), - Thm ("not_false",TermC.num_str @{thm not_false}), - Thm ("and_true",TermC.num_str @{thm and_true}), - Thm ("and_false",TermC.num_str @{thm and_false}), - Thm ("or_true",TermC.num_str @{thm or_true}), - Thm ("or_false",TermC.num_str @{thm or_false}), - Thm ("and_commute",TermC.num_str @{thm and_commute}), - Thm ("or_commute",TermC.num_str @{thm or_commute}), + rules = [Celem.Thm ("refl",TermC.num_str @{thm refl}), + Celem.Thm ("order_refl",TermC.num_str @{thm order_refl}), + Celem.Thm ("radd_left_cancel_le",TermC.num_str @{thm radd_left_cancel_le}), + Celem.Thm ("not_true",TermC.num_str @{thm not_true}), + Celem.Thm ("not_false",TermC.num_str @{thm not_false}), + Celem.Thm ("and_true",TermC.num_str @{thm and_true}), + Celem.Thm ("and_false",TermC.num_str @{thm and_false}), + Celem.Thm ("or_true",TermC.num_str @{thm or_true}), + Celem.Thm ("or_false",TermC.num_str @{thm or_false}), + Celem.Thm ("and_commute",TermC.num_str @{thm and_commute}), + Celem.Thm ("or_commute",TermC.num_str @{thm or_commute}), - Calc ("Atools.is'_const",eval_const "#is_const_"), - Calc ("Tools.matches",eval_matches ""), + Celem.Calc ("Atools.is'_const",eval_const "#is_const_"), + Celem.Calc ("Tools.matches",eval_matches ""), - Calc ("Groups.plus_class.plus",eval_binop "#add_"), - Calc ("Groups.times_class.times",eval_binop "#mult_"), - Calc ("Atools.pow" ,eval_binop "#power_"), + Celem.Calc ("Groups.plus_class.plus",eval_binop "#add_"), + Celem.Calc ("Groups.times_class.times",eval_binop "#mult_"), + Celem.Calc ("Atools.pow" ,eval_binop "#power_"), - Calc ("Orderings.ord_class.less",eval_equ "#less_"), - Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"), + Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"), + Celem.Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"), - Calc ("Atools.ident",eval_ident "#ident_")], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls; + Celem.Calc ("Atools.ident",eval_ident "#ident_")], + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }; *} ML {* (*.for evaluation of conditions in rewrite rules.*) (*FIXXXXXXME 10.8.02: handle like _simplify*) val tval_rls = - Rls{id = "tval_rls", preconds = [], + Celem.Rls{id = "tval_rls", preconds = [], rew_ord = ("sqrt_right",sqrt_right false @{theory "Pure"}), - erls=testerls,srls = e_rls, + erls=testerls,srls = Celem.e_rls, calc=[], errpatts = [], - rules = [Thm ("refl",TermC.num_str @{thm refl}), - Thm ("order_refl",TermC.num_str @{thm order_refl}), - Thm ("radd_left_cancel_le",TermC.num_str @{thm radd_left_cancel_le}), - Thm ("not_true",TermC.num_str @{thm not_true}), - Thm ("not_false",TermC.num_str @{thm not_false}), - Thm ("and_true",TermC.num_str @{thm and_true}), - Thm ("and_false",TermC.num_str @{thm and_false}), - Thm ("or_true",TermC.num_str @{thm or_true}), - Thm ("or_false",TermC.num_str @{thm or_false}), - Thm ("and_commute",TermC.num_str @{thm and_commute}), - Thm ("or_commute",TermC.num_str @{thm or_commute}), + rules = [Celem.Thm ("refl",TermC.num_str @{thm refl}), + Celem.Thm ("order_refl",TermC.num_str @{thm order_refl}), + Celem.Thm ("radd_left_cancel_le",TermC.num_str @{thm radd_left_cancel_le}), + Celem.Thm ("not_true",TermC.num_str @{thm not_true}), + Celem.Thm ("not_false",TermC.num_str @{thm not_false}), + Celem.Thm ("and_true",TermC.num_str @{thm and_true}), + Celem.Thm ("and_false",TermC.num_str @{thm and_false}), + Celem.Thm ("or_true",TermC.num_str @{thm or_true}), + Celem.Thm ("or_false",TermC.num_str @{thm or_false}), + Celem.Thm ("and_commute",TermC.num_str @{thm and_commute}), + Celem.Thm ("or_commute",TermC.num_str @{thm or_commute}), - Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}), + Celem.Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}), - Thm ("root_ge0",TermC.num_str @{thm root_ge0}), - Thm ("root_add_ge0",TermC.num_str @{thm root_add_ge0}), - Thm ("root_ge0_1",TermC.num_str @{thm root_ge0_1}), - Thm ("root_ge0_2",TermC.num_str @{thm root_ge0_2}), + Celem.Thm ("root_ge0",TermC.num_str @{thm root_ge0}), + Celem.Thm ("root_add_ge0",TermC.num_str @{thm root_add_ge0}), + Celem.Thm ("root_ge0_1",TermC.num_str @{thm root_ge0_1}), + Celem.Thm ("root_ge0_2",TermC.num_str @{thm root_ge0_2}), - Calc ("Atools.is'_const",eval_const "#is_const_"), - Calc ("Test.contains'_root",eval_contains_root "#eval_contains_root"), - Calc ("Tools.matches",eval_matches ""), - Calc ("Test.contains'_root", + Celem.Calc ("Atools.is'_const",eval_const "#is_const_"), + Celem.Calc ("Test.contains'_root",eval_contains_root "#eval_contains_root"), + Celem.Calc ("Tools.matches",eval_matches ""), + Celem.Calc ("Test.contains'_root", eval_contains_root"#contains_root_"), - Calc ("Groups.plus_class.plus",eval_binop "#add_"), - Calc ("Groups.times_class.times",eval_binop "#mult_"), - Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"), - Calc ("Atools.pow" ,eval_binop "#power_"), + Celem.Calc ("Groups.plus_class.plus",eval_binop "#add_"), + Celem.Calc ("Groups.times_class.times",eval_binop "#mult_"), + Celem.Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"), + Celem.Calc ("Atools.pow" ,eval_binop "#power_"), - Calc ("Orderings.ord_class.less",eval_equ "#less_"), - Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"), + Celem.Calc ("Orderings.ord_class.less",eval_equ "#less_"), + Celem.Calc ("Orderings.ord_class.less_eq",eval_equ "#less_equal_"), - Calc ("Atools.ident",eval_ident "#ident_")], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls; + Celem.Calc ("Atools.ident",eval_ident "#ident_")], + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }; *} setup {* KEStore_Elems.add_rlss [("testerls", (Context.theory_name @{theory}, prep_rls' testerls))] *} ML {* (*make () dissappear*) val rearrange_assoc = - Rls{id = "rearrange_assoc", preconds = [], - rew_ord = ("e_rew_ord",e_rew_ord), - erls = e_rls, srls = e_rls, calc = [], errpatts = [], + Celem.Rls{id = "rearrange_assoc", preconds = [], + rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord), + erls = Celem.e_rls, srls = Celem.e_rls, calc = [], errpatts = [], rules = - [Thm ("sym_add_assoc",TermC.num_str (@{thm add.assoc} RS @{thm sym})), - Thm ("sym_rmult_assoc",TermC.num_str (@{thm rmult_assoc} RS @{thm sym}))], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls; + [Celem.Thm ("sym_add_assoc",TermC.num_str (@{thm add.assoc} RS @{thm sym})), + Celem.Thm ("sym_rmult_assoc",TermC.num_str (@{thm rmult_assoc} RS @{thm sym}))], + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }; val ac_plus_times = - Rls{id = "ac_plus_times", preconds = [], rew_ord = ("term_order",term_order), - erls = e_rls, srls = e_rls, calc = [], errpatts = [], + Celem.Rls{id = "ac_plus_times", preconds = [], rew_ord = ("term_order",term_order), + erls = Celem.e_rls, srls = Celem.e_rls, calc = [], errpatts = [], rules = - [Thm ("radd_commute",TermC.num_str @{thm radd_commute}), - Thm ("radd_left_commute",TermC.num_str @{thm radd_left_commute}), - Thm ("add_assoc",TermC.num_str @{thm add.assoc}), - Thm ("rmult_commute",TermC.num_str @{thm rmult_commute}), - Thm ("rmult_left_commute",TermC.num_str @{thm rmult_left_commute}), - Thm ("rmult_assoc",TermC.num_str @{thm rmult_assoc})], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls; + [Celem.Thm ("radd_commute",TermC.num_str @{thm radd_commute}), + Celem.Thm ("radd_left_commute",TermC.num_str @{thm radd_left_commute}), + Celem.Thm ("add_assoc",TermC.num_str @{thm add.assoc}), + Celem.Thm ("rmult_commute",TermC.num_str @{thm rmult_commute}), + Celem.Thm ("rmult_left_commute",TermC.num_str @{thm rmult_left_commute}), + Celem.Thm ("rmult_assoc",TermC.num_str @{thm rmult_assoc})], + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }; (*todo: replace by Rewrite("rnorm_equation_add",TermC.num_str @{thm rnorm_equation_add)*) val norm_equation = - Rls{id = "norm_equation", preconds = [], rew_ord = ("e_rew_ord",e_rew_ord), - erls = tval_rls, srls = e_rls, calc = [], errpatts = [], - rules = [Thm ("rnorm_equation_add",TermC.num_str @{thm rnorm_equation_add}) + Celem.Rls{id = "norm_equation", preconds = [], rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord), + erls = tval_rls, srls = Celem.e_rls, calc = [], errpatts = [], + rules = [Celem.Thm ("rnorm_equation_add",TermC.num_str @{thm rnorm_equation_add}) ], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls; + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + }; *} ML {* (** rule sets **) @@ -366,59 +366,59 @@ ML {* (* expects * distributed over + *) val Test_simplify = - Rls{id = "Test_simplify", preconds = [], + Celem.Rls{id = "Test_simplify", preconds = [], rew_ord = ("sqrt_right",sqrt_right false @{theory "Pure"}), - erls = tval_rls, srls = e_rls, + erls = tval_rls, srls = Celem.e_rls, calc=[(*since 040209 filled by prep_rls'*)], errpatts = [], rules = [ - Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}), - Thm ("radd_mult_distrib2",TermC.num_str @{thm radd_mult_distrib2}), - Thm ("rdistr_right_assoc",TermC.num_str @{thm rdistr_right_assoc}), - Thm ("rdistr_right_assoc_p",TermC.num_str @{thm rdistr_right_assoc_p}), - Thm ("rdistr_div_right",TermC.num_str @{thm rdistr_div_right}), - Thm ("rbinom_power_2",TermC.num_str @{thm rbinom_power_2}), + Celem.Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}), + Celem.Thm ("radd_mult_distrib2",TermC.num_str @{thm radd_mult_distrib2}), + Celem.Thm ("rdistr_right_assoc",TermC.num_str @{thm rdistr_right_assoc}), + Celem.Thm ("rdistr_right_assoc_p",TermC.num_str @{thm rdistr_right_assoc_p}), + Celem.Thm ("rdistr_div_right",TermC.num_str @{thm rdistr_div_right}), + Celem.Thm ("rbinom_power_2",TermC.num_str @{thm rbinom_power_2}), - Thm ("radd_commute",TermC.num_str @{thm radd_commute}), - Thm ("radd_left_commute",TermC.num_str @{thm radd_left_commute}), - Thm ("add_assoc",TermC.num_str @{thm add.assoc}), - Thm ("rmult_commute",TermC.num_str @{thm rmult_commute}), - Thm ("rmult_left_commute",TermC.num_str @{thm rmult_left_commute}), - Thm ("rmult_assoc",TermC.num_str @{thm rmult_assoc}), + Celem.Thm ("radd_commute",TermC.num_str @{thm radd_commute}), + Celem.Thm ("radd_left_commute",TermC.num_str @{thm radd_left_commute}), + Celem.Thm ("add_assoc",TermC.num_str @{thm add.assoc}), + Celem.Thm ("rmult_commute",TermC.num_str @{thm rmult_commute}), + Celem.Thm ("rmult_left_commute",TermC.num_str @{thm rmult_left_commute}), + Celem.Thm ("rmult_assoc",TermC.num_str @{thm rmult_assoc}), - Thm ("radd_real_const_eq",TermC.num_str @{thm radd_real_const_eq}), - Thm ("radd_real_const",TermC.num_str @{thm radd_real_const}), + Celem.Thm ("radd_real_const_eq",TermC.num_str @{thm radd_real_const_eq}), + Celem.Thm ("radd_real_const",TermC.num_str @{thm radd_real_const}), (* these 2 rules are invers to distr_div_right wrt. termination. thus they MUST be done IMMEDIATELY before calc *) - Calc ("Groups.plus_class.plus", eval_binop "#add_"), - Calc ("Groups.times_class.times", eval_binop "#mult_"), - Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"), - Calc ("Atools.pow", eval_binop "#power_"), + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"), + Celem.Calc ("Rings.divide_class.divide", eval_cancel "#divide_e"), + Celem.Calc ("Atools.pow", eval_binop "#power_"), - Thm ("rcollect_right",TermC.num_str @{thm rcollect_right}), - Thm ("rcollect_one_left",TermC.num_str @{thm rcollect_one_left}), - Thm ("rcollect_one_left_assoc",TermC.num_str @{thm rcollect_one_left_assoc}), - Thm ("rcollect_one_left_assoc_p",TermC.num_str @{thm rcollect_one_left_assoc_p}), + Celem.Thm ("rcollect_right",TermC.num_str @{thm rcollect_right}), + Celem.Thm ("rcollect_one_left",TermC.num_str @{thm rcollect_one_left}), + Celem.Thm ("rcollect_one_left_assoc",TermC.num_str @{thm rcollect_one_left_assoc}), + Celem.Thm ("rcollect_one_left_assoc_p",TermC.num_str @{thm rcollect_one_left_assoc_p}), - Thm ("rshift_nominator",TermC.num_str @{thm rshift_nominator}), - Thm ("rcancel_den",TermC.num_str @{thm rcancel_den}), - Thm ("rroot_square_inv",TermC.num_str @{thm rroot_square_inv}), - Thm ("rroot_times_root",TermC.num_str @{thm rroot_times_root}), - Thm ("rroot_times_root_assoc_p",TermC.num_str @{thm rroot_times_root_assoc_p}), - Thm ("rsqare",TermC.num_str @{thm rsqare}), - Thm ("power_1",TermC.num_str @{thm power_1}), - Thm ("rtwo_of_the_same",TermC.num_str @{thm rtwo_of_the_same}), - Thm ("rtwo_of_the_same_assoc_p",TermC.num_str @{thm rtwo_of_the_same_assoc_p}), + Celem.Thm ("rshift_nominator",TermC.num_str @{thm rshift_nominator}), + Celem.Thm ("rcancel_den",TermC.num_str @{thm rcancel_den}), + Celem.Thm ("rroot_square_inv",TermC.num_str @{thm rroot_square_inv}), + Celem.Thm ("rroot_times_root",TermC.num_str @{thm rroot_times_root}), + Celem.Thm ("rroot_times_root_assoc_p",TermC.num_str @{thm rroot_times_root_assoc_p}), + Celem.Thm ("rsqare",TermC.num_str @{thm rsqare}), + Celem.Thm ("power_1",TermC.num_str @{thm power_1}), + Celem.Thm ("rtwo_of_the_same",TermC.num_str @{thm rtwo_of_the_same}), + Celem.Thm ("rtwo_of_the_same_assoc_p",TermC.num_str @{thm rtwo_of_the_same_assoc_p}), - Thm ("rmult_1",TermC.num_str @{thm rmult_1}), - Thm ("rmult_1_right",TermC.num_str @{thm rmult_1_right}), - Thm ("rmult_0",TermC.num_str @{thm rmult_0}), - Thm ("rmult_0_right",TermC.num_str @{thm rmult_0_right}), - Thm ("radd_0",TermC.num_str @{thm radd_0}), - Thm ("radd_0_right",TermC.num_str @{thm radd_0_right}) + Celem.Thm ("rmult_1",TermC.num_str @{thm rmult_1}), + Celem.Thm ("rmult_1_right",TermC.num_str @{thm rmult_1_right}), + Celem.Thm ("rmult_0",TermC.num_str @{thm rmult_0}), + Celem.Thm ("rmult_0_right",TermC.num_str @{thm rmult_0_right}), + Celem.Thm ("radd_0",TermC.num_str @{thm radd_0}), + Celem.Thm ("radd_0_right",TermC.num_str @{thm radd_0_right}) ], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") (*since 040209 filled by prep_rls': STest_simplify*) - }:rls; + }; *} ML {* @@ -428,33 +428,33 @@ (*isolate the root in a root-equation*) val isolate_root = - Rls{id = "isolate_root", preconds = [], rew_ord = ("e_rew_ord",e_rew_ord), - erls=tval_rls,srls = e_rls, calc=[], errpatts = [], - rules = [Thm ("rroot_to_lhs",TermC.num_str @{thm rroot_to_lhs}), - Thm ("rroot_to_lhs_mult",TermC.num_str @{thm rroot_to_lhs_mult}), - Thm ("rroot_to_lhs_add_mult",TermC.num_str @{thm rroot_to_lhs_add_mult}), - Thm ("risolate_root_add",TermC.num_str @{thm risolate_root_add}), - Thm ("risolate_root_mult",TermC.num_str @{thm risolate_root_mult}), - Thm ("risolate_root_div",TermC.num_str @{thm risolate_root_div}) ], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) + Celem.Rls{id = "isolate_root", preconds = [], rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord), + erls=tval_rls,srls = Celem.e_rls, calc=[], errpatts = [], + rules = [Celem.Thm ("rroot_to_lhs",TermC.num_str @{thm rroot_to_lhs}), + Celem.Thm ("rroot_to_lhs_mult",TermC.num_str @{thm rroot_to_lhs_mult}), + Celem.Thm ("rroot_to_lhs_add_mult",TermC.num_str @{thm rroot_to_lhs_add_mult}), + Celem.Thm ("risolate_root_add",TermC.num_str @{thm risolate_root_add}), + Celem.Thm ("risolate_root_mult",TermC.num_str @{thm risolate_root_mult}), + Celem.Thm ("risolate_root_div",TermC.num_str @{thm risolate_root_div}) ], + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls; + }; (*isolate the bound variable in an equation; 'bdv' is a meta-constant*) val isolate_bdv = - Rls{id = "isolate_bdv", preconds = [], rew_ord = ("e_rew_ord",e_rew_ord), - erls=tval_rls,srls = e_rls, calc= [], errpatts = [], + Celem.Rls{id = "isolate_bdv", preconds = [], rew_ord = ("xxxe_rew_ordxxx",Celem.e_rew_ord), + erls=tval_rls,srls = Celem.e_rls, calc= [], errpatts = [], rules = - [Thm ("risolate_bdv_add",TermC.num_str @{thm risolate_bdv_add}), - Thm ("risolate_bdv_mult_add",TermC.num_str @{thm risolate_bdv_mult_add}), - Thm ("risolate_bdv_mult",TermC.num_str @{thm risolate_bdv_mult}), - Thm ("mult_square",TermC.num_str @{thm mult_square}), - Thm ("constant_square",TermC.num_str @{thm constant_square}), - Thm ("constant_mult_square",TermC.num_str @{thm constant_mult_square}) + [Celem.Thm ("risolate_bdv_add",TermC.num_str @{thm risolate_bdv_add}), + Celem.Thm ("risolate_bdv_mult_add",TermC.num_str @{thm risolate_bdv_mult_add}), + Celem.Thm ("risolate_bdv_mult",TermC.num_str @{thm risolate_bdv_mult}), + Celem.Thm ("mult_square",TermC.num_str @{thm mult_square}), + Celem.Thm ("constant_square",TermC.num_str @{thm constant_square}), + Celem.Thm ("constant_mult_square",TermC.num_str @{thm constant_mult_square}) ], - scr = Prog ((Thm.term_of o the o (TermC.parse thy)) + scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script") - }:rls; + }; *} ML {* @@ -489,24 +489,24 @@ ("isolate_root", (Context.theory_name @{theory}, prep_rls' isolate_root)), ("isolate_bdv", (Context.theory_name @{theory}, prep_rls' isolate_bdv)), ("matches", (Context.theory_name @{theory}, prep_rls' - (append_rls "matches" testerls [Calc ("Tools.matches",eval_matches "#matches_")])))] *} + (Celem.append_rls "matches" testerls [Celem.Calc ("Tools.matches",eval_matches "#matches_")])))] *} (** problem types **) setup {* KEStore_Elems.add_pbts - [(Specify.prep_pbt thy "pbl_test" [] e_pblID (["test"], [], e_rls, NONE, [])), - (Specify.prep_pbt thy "pbl_test_equ" [] e_pblID + [(Specify.prep_pbt thy "pbl_test" [] Celem.e_pblID (["test"], [], Celem.e_rls, NONE, [])), + (Specify.prep_pbt thy "pbl_test_equ" [] Celem.e_pblID (["equation","test"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["matches (?a = ?b) e_e"]), ("#Find" ,["solutions v_v'i'"])], assoc_rls' @{theory} "matches", SOME "solve (e_e::bool, v_v)", [])), - (Specify.prep_pbt thy "pbl_test_uni" [] e_pblID + (Specify.prep_pbt thy "pbl_test_uni" [] Celem.e_pblID (["univariate","equation","test"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["matches (?a = ?b) e_e"]), ("#Find" ,["solutions v_v'i'"])], assoc_rls' @{theory} "matches", SOME "solve (e_e::bool, v_v)", [])), - (Specify.prep_pbt thy "pbl_test_uni_lin" [] e_pblID + (Specify.prep_pbt thy "pbl_test_uni_lin" [] Celem.e_pblID (["LINEAR","univariate","equation","test"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["(matches ( v_v = 0) e_e) | (matches ( ?b*v_v = 0) e_e) |" ^ @@ -530,16 +530,16 @@ (** methods **) setup {* KEStore_Elems.add_mets - [Specify.prep_met @{theory "Diff"} "met_test" [] e_metID + [Specify.prep_met @{theory "Diff"} "met_test" [] Celem.e_metID (["Test"], [], - {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = e_rls, prls=e_rls, - crls=Atools_erls, errpats = [], nrls = e_rls}, "empty_script"), - Specify.prep_met thy "met_test_solvelin" [] e_metID - (["Test","solve_linear"]:metID, + {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = Celem.e_rls, prls=Celem.e_rls, + crls=Atools_erls, errpats = [], nrls = Celem.e_rls}, "empty_script"), + Specify.prep_met thy "met_test_solvelin" [] Celem.e_metID + (["Test","solve_linear"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["matches (?a = ?b) e_e"]), ("#Find" ,["solutions v_v'i'"])], - {rew_ord' = "e_rew_ord", rls' = tval_rls, srls = e_rls, + {rew_ord' = "xxxe_rew_ordxxx", rls' = tval_rls, srls = Celem.e_rls, prls = assoc_rls' @{theory} "matches", calc = [], crls = tval_rls, errpats = [], nrls = Test_simplify}, "Script Solve_linear (e_e::bool) (v_v::real)= " ^ @@ -549,10 +549,10 @@ " (Rewrite_Set Test_simplify False))) e_e" ^ " in [e_e::bool])")(*, Specify.prep_met thy (*test for equations*) - (["Test","testeq"]:metID, + (["Test","testeq"], [("#Given" ,["boolTestGiven g_g"]), ("#Find" ,["boolTestFind f_f"])], - {rew_ord'="e_rew_ord",rls'="tval_rls",asm_rls=[], asm_thm=[("square_equation_left","")]}, + {rew_ord'="xxxe_rew_ordxxx",rls'="tval_rls",asm_rls=[], asm_thm=[("square_equation_left","")]}, "Script Testeq (e_q::bool) = " ^ "Repeat " ^ " (let e_e = Try (Repeat (Rewrite rroot_square_inv False e_q)); " ^ @@ -707,7 +707,7 @@ *} (** problem types **) setup {* KEStore_Elems.add_pbts - [(Specify.prep_pbt thy "pbl_test_uni_plain2" [] e_pblID + [(Specify.prep_pbt thy "pbl_test_uni_plain2" [] Celem.e_pblID (["plain_square","univariate","equation","test"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["(matches (?a + ?b*v_v ^^^2 = 0) e_e) |" ^ @@ -740,71 +740,71 @@ *) setup {* KEStore_Elems.add_pbts - [(Specify.prep_pbt thy "pbl_test_uni_poly" [] e_pblID + [(Specify.prep_pbt thy "pbl_test_uni_poly" [] Celem.e_pblID (["polynomial","univariate","equation","test"], [("#Given" ,["equality (v_v ^^^2 + p_p * v_v + q__q = 0)","solveFor v_v"]), ("#Where" ,["HOL.False"]), ("#Find" ,["solutions v_v'i'"])], - e_rls, SOME "solve (e_e::bool, v_v)", [])), - (Specify.prep_pbt thy "pbl_test_uni_poly_deg2" [] e_pblID + Celem.e_rls, SOME "solve (e_e::bool, v_v)", [])), + (Specify.prep_pbt thy "pbl_test_uni_poly_deg2" [] Celem.e_pblID (["degree_two","polynomial","univariate","equation","test"], [("#Given" ,["equality (v_v ^^^2 + p_p * v_v + q__q = 0)","solveFor v_v"]), ("#Find" ,["solutions v_v'i'"])], - e_rls, SOME "solve (v_v ^^^2 + p_p * v_v + q__q = 0, v_v)", [])), - (Specify.prep_pbt thy "pbl_test_uni_poly_deg2_pq" [] e_pblID + Celem.e_rls, SOME "solve (v_v ^^^2 + p_p * v_v + q__q = 0, v_v)", [])), + (Specify.prep_pbt thy "pbl_test_uni_poly_deg2_pq" [] Celem.e_pblID (["pq_formula","degree_two","polynomial","univariate","equation","test"], [("#Given" ,["equality (v_v ^^^2 + p_p * v_v + q__q = 0)","solveFor v_v"]), ("#Find" ,["solutions v_v'i'"])], - e_rls, SOME "solve (v_v ^^^2 + p_p * v_v + q__q = 0, v_v)", [])), - (Specify.prep_pbt thy "pbl_test_uni_poly_deg2_abc" [] e_pblID + Celem.e_rls, SOME "solve (v_v ^^^2 + p_p * v_v + q__q = 0, v_v)", [])), + (Specify.prep_pbt thy "pbl_test_uni_poly_deg2_abc" [] Celem.e_pblID (["abc_formula","degree_two","polynomial","univariate","equation","test"], [("#Given" ,["equality (a_a * x ^^^2 + b_b * x + c_c = 0)","solveFor v_v"]), ("#Find" ,["solutions v_v'i'"])], - e_rls, SOME "solve (a_a * x ^^^2 + b_b * x + c_c = 0, v_v)", [])), - (Specify.prep_pbt thy "pbl_test_uni_root" [] e_pblID + Celem.e_rls, SOME "solve (a_a * x ^^^2 + b_b * x + c_c = 0, v_v)", [])), + (Specify.prep_pbt thy "pbl_test_uni_root" [] Celem.e_pblID (["squareroot","univariate","equation","test"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["precond_rootpbl v_v"]), ("#Find" ,["solutions v_v'i'"])], - append_rls "contains_root" e_rls [Calc ("Test.contains'_root", + Celem.append_rls "contains_root" Celem.e_rls [Celem.Calc ("Test.contains'_root", eval_contains_root "#contains_root_")], SOME "solve (e_e::bool, v_v)", [["Test","square_equation"]])), - (Specify.prep_pbt thy "pbl_test_uni_norm" [] e_pblID + (Specify.prep_pbt thy "pbl_test_uni_norm" [] Celem.e_pblID (["normalise","univariate","equation","test"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,[]), ("#Find" ,["solutions v_v'i'"])], - e_rls, SOME "solve (e_e::bool, v_v)", [["Test","norm_univar_equation"]])), - (Specify.prep_pbt thy "pbl_test_uni_roottest" [] e_pblID + Celem.e_rls, SOME "solve (e_e::bool, v_v)", [["Test","norm_univar_equation"]])), + (Specify.prep_pbt thy "pbl_test_uni_roottest" [] Celem.e_pblID (["sqroot-test","univariate","equation","test"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["precond_rootpbl v_v"]), ("#Find" ,["solutions v_v'i'"])], - e_rls, SOME "solve (e_e::bool, v_v)", [])), - (Specify.prep_pbt thy "pbl_test_intsimp" [] e_pblID + Celem.e_rls, SOME "solve (e_e::bool, v_v)", [])), + (Specify.prep_pbt thy "pbl_test_intsimp" [] Celem.e_pblID (["inttype","test"], [("#Given" ,["intTestGiven t_t"]), ("#Where" ,[]), ("#Find" ,["intTestFind s_s"])], - e_rls, NONE, [["Test","intsimp"]]))] *} + Celem.e_rls, NONE, [["Test","intsimp"]]))] *} (* show_ptyps(); get_pbt ["inttype","test"]; *) setup {* KEStore_Elems.add_mets - [Specify.prep_met thy "met_test_sqrt" [] e_metID + [Specify.prep_met thy "met_test_sqrt" [] Celem.e_metID (*root-equation, version for tests before 8.01.01*) - (["Test","sqrt-equ-test"]:metID, + (["Test","sqrt-equ-test"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["contains_root (e_e::bool)"]), ("#Find" ,["solutions v_v'i'"])], - {rew_ord'="e_rew_ord",rls'=tval_rls, - srls = append_rls "srls_contains_root" e_rls - [Calc ("Test.contains'_root",eval_contains_root "")], - prls = append_rls "prls_contains_root" e_rls - [Calc ("Test.contains'_root",eval_contains_root "")], - calc=[], crls=tval_rls, errpats = [], nrls = e_rls (*,asm_rls=[], + {rew_ord'="xxxe_rew_ordxxx",rls'=tval_rls, + srls = Celem.append_rls "srls_contains_root" Celem.e_rls + [Celem.Calc ("Test.contains'_root",eval_contains_root "")], + prls = Celem.append_rls "prls_contains_root" Celem.e_rls + [Celem.Calc ("Test.contains'_root",eval_contains_root "")], + calc=[], crls=tval_rls, errpats = [], nrls = Celem.e_rls (*,asm_rls=[], asm_thm=[("square_equation_left",""), ("square_equation_right","")]*)}, "Script Solve_root_equation (e_e::bool) (v_v::real) = " ^ "(let e_e = " ^ @@ -820,15 +820,15 @@ " (Try (Rewrite_Set Test_simplify False)))" ^ " e_e" ^ " in [e_e::bool])"), - Specify.prep_met thy "met_test_sqrt2" [] e_metID + Specify.prep_met thy "met_test_sqrt2" [] Celem.e_metID (*root-equation ... for test-*.sml until 8.01*) - (["Test","squ-equ-test2"]:metID, + (["Test","squ-equ-test2"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Find" ,["solutions v_v'i'"])], - {rew_ord'="e_rew_ord",rls'=tval_rls, - srls = append_rls "srls_contains_root" e_rls - [Calc ("Test.contains'_root",eval_contains_root"")], - prls=e_rls,calc=[], crls=tval_rls, errpats = [], nrls = e_rls(*,asm_rls=[], + {rew_ord'="xxxe_rew_ordxxx",rls'=tval_rls, + srls = Celem.append_rls "srls_contains_root" Celem.e_rls + [Celem.Calc ("Test.contains'_root",eval_contains_root"")], + prls=Celem.e_rls,calc=[], crls=tval_rls, errpats = [], nrls = Celem.e_rls(*,asm_rls=[], asm_thm=[("square_equation_left",""), ("square_equation_right","")]*)}, "Script Solve_root_equation (e_e::bool) (v_v::real) = " ^ "(let e_e = " ^ @@ -846,15 +846,15 @@ " (L_L::bool list) = Tac subproblem_equation_dummy; " ^ " L_L = Tac solve_equation_dummy " ^ " in Check_elementwise L_L {(v_v::real). Assumptions})"), - Specify.prep_met thy "met_test_squ_sub" [] e_metID + Specify.prep_met thy "met_test_squ_sub" [] Celem.e_metID (*tests subproblem fixed linear*) - (["Test","squ-equ-test-subpbl1"]:metID, + (["Test","squ-equ-test-subpbl1"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Where" ,["precond_rootmet v_v"]), ("#Find" ,["solutions v_v'i'"])], - {rew_ord' = "e_rew_ord", rls' = tval_rls, srls = e_rls, - prls = append_rls "prls_met_test_squ_sub" e_rls - [Calc ("Test.precond'_rootmet", eval_precond_rootmet "")], + {rew_ord' = "xxxe_rew_ordxxx", rls' = tval_rls, srls = Celem.e_rls, + prls = Celem.append_rls "prls_met_test_squ_sub" Celem.e_rls + [Celem.Calc ("Test.precond'_rootmet", eval_precond_rootmet "")], calc=[], crls=tval_rls, errpats = [], nrls = Test_simplify}, "Script Solve_root_equation (e_e::bool) (v_v::real) = " ^ " (let e_e = ((Try (Rewrite_Set norm_equation False)) @@ " ^ @@ -865,28 +865,28 @@ " [Test,solve_linear]) " ^ " [BOOL e_e, REAL v_v]) " ^ " in Check_elementwise L_L {(v_v::real). Assumptions}) "), - Specify.prep_met thy "met_test_squ_sub2" [] e_metID + Specify.prep_met thy "met_test_squ_sub2" [] Celem.e_metID (*tests subproblem fixed degree 2*) - (["Test","squ-equ-test-subpbl2"]:metID, + (["Test","squ-equ-test-subpbl2"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Find" ,["solutions v_v'i'"])], - {rew_ord'="e_rew_ord",rls'=tval_rls,srls=e_rls,prls=e_rls,calc=[], crls=tval_rls, - errpats = [], nrls = e_rls (*, asm_rls=[],asm_thm=[("square_equation_left",""), + {rew_ord'="xxxe_rew_ordxxx",rls'=tval_rls,srls=Celem.e_rls,prls=Celem.e_rls,calc=[], crls=tval_rls, + errpats = [], nrls = Celem.e_rls (*, asm_rls=[],asm_thm=[("square_equation_left",""), ("square_equation_right","")]*)}, "Script Solve_root_equation (e_e::bool) (v_v::real) = " ^ " (let e_e = Try (Rewrite_Set norm_equation False) e_e; " ^ "(L_L::bool list) = (SubProblem (Test',[LINEAR,univariate,equation,test]," ^ " [Test,solve_by_pq_formula]) [BOOL e_e, REAL v_v])" ^ "in Check_elementwise L_L {(v_v::real). Assumptions})"), - Specify.prep_met thy "met_test_squ_nonterm" [] e_metID + Specify.prep_met thy "met_test_squ_nonterm" [] Celem.e_metID (*root-equation: see foils..., but notTerminating*) - (["Test","square_equation...notTerminating"]:metID, + (["Test","square_equation...notTerminating"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Find" ,["solutions v_v'i'"])], - {rew_ord'="e_rew_ord",rls'=tval_rls, - srls = append_rls "srls_contains_root" e_rls - [Calc ("Test.contains'_root",eval_contains_root"")], - prls=e_rls,calc=[], crls=tval_rls, errpats = [], nrls = e_rls(*,asm_rls=[], + {rew_ord'="xxxe_rew_ordxxx",rls'=tval_rls, + srls = Celem.append_rls "srls_contains_root" Celem.e_rls + [Celem.Calc ("Test.contains'_root",eval_contains_root"")], + prls=Celem.e_rls,calc=[], crls=tval_rls, errpats = [], nrls = Celem.e_rls(*,asm_rls=[], asm_thm=[("square_equation_left",""), ("square_equation_right","")]*)}, "Script Solve_root_equation (e_e::bool) (v_v::real) = " ^ "(let e_e = " ^ @@ -903,15 +903,15 @@ " (SubProblem (Test',[LINEAR,univariate,equation,test]," ^ " [Test,solve_linear]) [BOOL e_e, REAL v_v])" ^ "in Check_elementwise L_L {(v_v::real). Assumptions})"), - Specify.prep_met thy "met_test_eq1" [] e_metID + Specify.prep_met thy "met_test_eq1" [] Celem.e_metID (*root-equation1:*) - (["Test","square_equation1"]:metID, + (["Test","square_equation1"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Find" ,["solutions v_v'i'"])], - {rew_ord'="e_rew_ord",rls'=tval_rls, - srls = append_rls "srls_contains_root" e_rls - [Calc ("Test.contains'_root",eval_contains_root"")], prls=e_rls, calc=[], crls=tval_rls, - errpats = [], nrls = e_rls(*,asm_rls=[], asm_thm=[("square_equation_left",""), + {rew_ord'="xxxe_rew_ordxxx",rls'=tval_rls, + srls = Celem.append_rls "srls_contains_root" Celem.e_rls + [Celem.Calc ("Test.contains'_root",eval_contains_root"")], prls=Celem.e_rls, calc=[], crls=tval_rls, + errpats = [], nrls = Celem.e_rls(*,asm_rls=[], asm_thm=[("square_equation_left",""), ("square_equation_right","")]*)}, "Script Solve_root_equation (e_e::bool) (v_v::real) = " ^ "(let e_e = " ^ @@ -927,15 +927,15 @@ " (L_L::bool list) = (SubProblem (Test',[LINEAR,univariate,equation,test]," ^ " [Test,solve_linear]) [BOOL e_e, REAL v_v])" ^ " in Check_elementwise L_L {(v_v::real). Assumptions})"), - Specify.prep_met thy "met_test_squ2" [] e_metID + Specify.prep_met thy "met_test_squ2" [] Celem.e_metID (*root-equation2*) - (["Test","square_equation2"]:metID, + (["Test","square_equation2"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Find" ,["solutions v_v'i'"])], - {rew_ord'="e_rew_ord",rls'=tval_rls, - srls = append_rls "srls_contains_root" e_rls - [Calc ("Test.contains'_root",eval_contains_root"")], - prls=e_rls,calc=[], crls=tval_rls, errpats = [], nrls = e_rls(*,asm_rls=[], + {rew_ord'="xxxe_rew_ordxxx",rls'=tval_rls, + srls = Celem.append_rls "srls_contains_root" Celem.e_rls + [Celem.Calc ("Test.contains'_root",eval_contains_root"")], + prls=Celem.e_rls,calc=[], crls=tval_rls, errpats = [], nrls = Celem.e_rls(*,asm_rls=[], asm_thm=[("square_equation_left",""), ("square_equation_right","")]*)}, "Script Solve_root_equation (e_e::bool) (v_v::real) = " ^ "(let e_e = " ^ @@ -952,15 +952,15 @@ " (L_L::bool list) = (SubProblem (Test',[plain_square,univariate,equation,test]," ^ " [Test,solve_plain_square]) [BOOL e_e, REAL v_v])" ^ " in Check_elementwise L_L {(v_v::real). Assumptions})"), - Specify.prep_met thy "met_test_squeq" [] e_metID + Specify.prep_met thy "met_test_squeq" [] Celem.e_metID (*root-equation*) - (["Test","square_equation"]:metID, + (["Test","square_equation"], [("#Given" ,["equality e_e","solveFor v_v"]), ("#Find" ,["solutions v_v'i'"])], - {rew_ord'="e_rew_ord",rls'=tval_rls, - srls = append_rls "srls_contains_root" e_rls - [Calc ("Test.contains'_root",eval_contains_root"")], - prls=e_rls,calc=[], crls=tval_rls, errpats = [], nrls = e_rls (*,asm_rls=[], + {rew_ord'="xxxe_rew_ordxxx",rls'=tval_rls, + srls = Celem.append_rls "srls_contains_root" Celem.e_rls + [Celem.Calc ("Test.contains'_root",eval_contains_root"")], + prls=Celem.e_rls,calc=[], crls=tval_rls, errpats = [], nrls = Celem.e_rls (*,asm_rls=[], asm_thm=[("square_equation_left",""), ("square_equation_right","")]*)}, "Script Solve_root_equation (e_e::bool) (v_v::real) = " ^ "(let e_e = " ^ @@ -977,17 +977,17 @@ " (L_L::bool list) = (SubProblem (Test',[univariate,equation,test]," ^ " [no_met]) [BOOL e_e, REAL v_v])" ^ " in Check_elementwise L_L {(v_v::real). Assumptions})"), - Specify.prep_met thy "met_test_eq_plain" [] e_metID + Specify.prep_met thy "met_test_eq_plain" [] Celem.e_metID (*solve_plain_square*) - (["Test","solve_plain_square"]:metID, + (["Test","solve_plain_square"], [("#Given",["equality e_e","solveFor v_v"]), ("#Where" ,["(matches (?a + ?b*v_v ^^^2 = 0) e_e) |" ^ "(matches ( ?b*v_v ^^^2 = 0) e_e) |" ^ "(matches (?a + v_v ^^^2 = 0) e_e) |" ^ "(matches ( v_v ^^^2 = 0) e_e)"]), ("#Find" ,["solutions v_v'i'"])], - {rew_ord'="e_rew_ord",rls'=tval_rls,calc=[],srls=e_rls, - prls = assoc_rls' @{theory} "matches", crls=tval_rls, errpats = [], nrls = e_rls(*, + {rew_ord'="xxxe_rew_ordxxx",rls'=tval_rls,calc=[],srls=Celem.e_rls, + prls = assoc_rls' @{theory} "matches", crls=tval_rls, errpats = [], nrls = Celem.e_rls(*, asm_rls=[],asm_thm=[]*)}, "Script Solve_plain_square (e_e::bool) (v_v::real) = " ^ " (let e_e = ((Try (Rewrite_Set isolate_bdv False)) @@ " ^ @@ -996,25 +996,25 @@ " (Rewrite square_equality True)) @@ " ^ " (Try (Rewrite_Set tval_rls False))) e_e " ^ " in ((Or_to_List e_e)::bool list))"), - Specify.prep_met thy "met_test_norm_univ" [] e_metID - (["Test","norm_univar_equation"]:metID, + Specify.prep_met thy "met_test_norm_univ" [] Celem.e_metID + (["Test","norm_univar_equation"], [("#Given",["equality e_e","solveFor v_v"]), ("#Where" ,[]), ("#Find" ,["solutions v_v'i'"])], - {rew_ord'="e_rew_ord",rls'=tval_rls,srls = e_rls,prls=e_rls, calc=[], crls=tval_rls, - errpats = [], nrls = e_rls}, + {rew_ord'="xxxe_rew_ordxxx",rls'=tval_rls,srls = Celem.e_rls,prls=Celem.e_rls, calc=[], crls=tval_rls, + errpats = [], nrls = Celem.e_rls}, "Script Norm_univar_equation (e_e::bool) (v_v::real) = " ^ " (let e_e = ((Try (Rewrite rnorm_equation_add False)) @@ " ^ " (Try (Rewrite_Set Test_simplify False))) e_e " ^ " in (SubProblem (Test',[univariate,equation,test], " ^ " [no_met]) [BOOL e_e, REAL v_v]))"), (*17.9.02 aus SqRoot.ML------------------------------^^^---*) - Specify.prep_met thy "met_test_intsimp" [] e_metID - (["Test","intsimp"]:metID, + Specify.prep_met thy "met_test_intsimp" [] Celem.e_metID + (["Test","intsimp"], [("#Given" ,["intTestGiven t_t"]), ("#Where" ,[]), ("#Find" ,["intTestFind s_s"])], - {rew_ord' = "e_rew_ord", rls' = tval_rls, srls = e_rls, prls = e_rls, calc = [], + {rew_ord' = "xxxe_rew_ordxxx", rls' = tval_rls, srls = Celem.e_rls, prls = Celem.e_rls, calc = [], crls = tval_rls, errpats = [], nrls = Test_simplify}, "Script STest_simplify (t_t::int) = " ^ "(Repeat " ^ @@ -1061,10 +1061,10 @@ | term_ord' pr thy (t, u) = (if pr then let val (f, ts) = strip_comb t and (g, us) = strip_comb u; - val _ = tracing ("t= f@ts= \"" ^ term2str f ^ "\" @ \"[" ^ - commas(map term2str ts) ^ "]\"") - val _ = tracing ("u= g@us= \"" ^ term2str g ^"\" @ \"[" ^ - commas(map term2str us) ^"]\"") + val _ = tracing ("t= f@ts= \"" ^ Celem.term2str f ^ "\" @ \"[" ^ + commas(map Celem.term2str ts) ^ "]\"") + val _ = tracing ("u= g@us= \"" ^ Celem.term2str g ^"\" @ \"[" ^ + commas(map Celem.term2str us) ^"]\"") val _ = tracing ("size_of_term(t,u)= (" ^ string_of_int (size_of_term' t) ^ ", " ^ string_of_int (size_of_term' u) ^ ")") @@ -1084,17 +1084,17 @@ and hd_ord (f, g) = (* ~ term.ML *) prod_ord (prod_ord Term_Ord.indexname_ord Term_Ord.typ_ord) int_ord (dest_hd' f, dest_hd' g) and terms_ord str pr (ts, us) = - list_ord (term_ord' pr (assoc_thy "Isac"))(ts, us); + list_ord (term_ord' pr (Celem.assoc_thy "Isac"))(ts, us); in -fun ord_make_polytest (pr:bool) thy (_:subst) tu = +fun ord_make_polytest (pr:bool) thy (_: Celem.subst) tu = (term_ord' pr thy(***) tu = LESS ); end;(*local*) *} ML {* -rew_ord' := overwritel (!rew_ord', +Celem.rew_ord' := overwritel (! Celem.rew_ord', [("termlessI", termlessI), ("ord_make_polytest", ord_make_polytest false thy) ]); @@ -1139,72 +1139,72 @@ -----------------------------------------------------*) val make_polytest = - Rls{id = "make_polytest", preconds = []:term list, + Celem.Rls{id = "make_polytest", preconds = []:term list, rew_ord = ("ord_make_polytest", ord_make_polytest false @{theory "Poly"}), - erls = testerls, srls = Erls, + erls = testerls, srls = Celem.Erls, calc = [("PLUS" , ("Groups.plus_class.plus", eval_binop "#add_")), ("TIMES" , ("Groups.times_class.times", eval_binop "#mult_")), ("POWER", ("Atools.pow", eval_binop "#power_")) ], errpatts = [], - rules = [Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}), + rules = [Celem.Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}), (*"a - b = a + (-1) * b"*) - Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}), + Celem.Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}), (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*) - Thm ("distrib_left",TermC.num_str @{thm distrib_left}), + Celem.Thm ("distrib_left",TermC.num_str @{thm distrib_left}), (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*) - Thm ("left_diff_distrib" ,TermC.num_str @{thm left_diff_distrib}), + Celem.Thm ("left_diff_distrib" ,TermC.num_str @{thm left_diff_distrib}), (*"(z1.0 - z2.0) * w = z1.0 * w - z2.0 * w"*) - Thm ("right_diff_distrib",TermC.num_str @{thm right_diff_distrib}), + Celem.Thm ("right_diff_distrib",TermC.num_str @{thm right_diff_distrib}), (*"w * (z1.0 - z2.0) = w * z1.0 - w * z2.0"*) - Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}), + Celem.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}), (*"1 * z = z"*) - Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}), + Celem.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}), (*"0 * z = 0"*) - Thm ("add_0_left",TermC.num_str @{thm add_0_left}), + Celem.Thm ("add_0_left",TermC.num_str @{thm add_0_left}), (*"0 + z = z"*) (*AC-rewriting*) - Thm ("mult_commute",TermC.num_str @{thm mult.commute}), + Celem.Thm ("mult_commute",TermC.num_str @{thm mult.commute}), (* z * w = w * z *) - Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}), + Celem.Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}), (*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*) - Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}), + Celem.Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}), (*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*) - Thm ("add_commute",TermC.num_str @{thm add.commute}), + Celem.Thm ("add_commute",TermC.num_str @{thm add.commute}), (*z + w = w + z*) - Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}), + Celem.Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}), (*x + (y + z) = y + (x + z)*) - Thm ("add_assoc",TermC.num_str @{thm add.assoc}), + Celem.Thm ("add_assoc",TermC.num_str @{thm add.assoc}), (*z1.0 + z2.0 + z3.0 = z1.0 + (z2.0 + z3.0)*) - Thm ("sym_realpow_twoI", + Celem.Thm ("sym_realpow_twoI", TermC.num_str (@{thm realpow_twoI} RS @{thm sym})), (*"r1 * r1 = r1 ^^^ 2"*) - Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}), + Celem.Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}), (*"r * r ^^^ n = r ^^^ (n + 1)"*) - Thm ("sym_real_mult_2", + Celem.Thm ("sym_real_mult_2", TermC.num_str (@{thm real_mult_2} RS @{thm sym})), (*"z1 + z1 = 2 * z1"*) - Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}), + Celem.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}), (*"z1 + (z1 + k) = 2 * z1 + k"*) - Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), + Celem.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), (*"[| l is_const; m is_const |]==>l * n + m * n = (l + m) * n"*) - Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}), + Celem.Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}), (*"[| l is_const; m is_const |] ==> l * n + (m * n + k) = (l + m) * n + k"*) - Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}), + Celem.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}), (*"m is_const ==> n + m * n = (1 + m) * n"*) - Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), + Celem.Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*) - Calc ("Groups.plus_class.plus", eval_binop "#add_"), - Calc ("Groups.times_class.times", eval_binop "#mult_"), - Calc ("Atools.pow", eval_binop "#power_") + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"), + Celem.Calc ("Atools.pow", eval_binop "#power_") ], - scr = EmptyScr(*Prog ((Thm.term_of o the o (parse thy)) + scr = Celem.EmptyScr(*Celem.Prog ((Thm.term_of o the o (parse thy)) scr_make_polytest)*) - }:rls; + }; *} ML {* (*WN060510 this was done before 'fun prep_rls ...------------------------ @@ -1244,100 +1244,100 @@ --------------------------------------------------------------------------*) val expand_binomtest = - Rls{id = "expand_binomtest", preconds = [], + Celem.Rls{id = "expand_binomtest", preconds = [], rew_ord = ("termlessI",termlessI), - erls = testerls, srls = Erls, + erls = testerls, srls = Celem.Erls, calc = [("PLUS" , ("Groups.plus_class.plus", eval_binop "#add_")), ("TIMES" , ("Groups.times_class.times", eval_binop "#mult_")), ("POWER", ("Atools.pow", eval_binop "#power_")) ], errpatts = [], rules = - [Thm ("real_plus_binom_pow2" ,TermC.num_str @{thm real_plus_binom_pow2}), + [Celem.Thm ("real_plus_binom_pow2" ,TermC.num_str @{thm real_plus_binom_pow2}), (*"(a + b) ^^^ 2 = a ^^^ 2 + 2 * a * b + b ^^^ 2"*) - Thm ("real_plus_binom_times" ,TermC.num_str @{thm real_plus_binom_times}), + Celem.Thm ("real_plus_binom_times" ,TermC.num_str @{thm real_plus_binom_times}), (*"(a + b)*(a + b) = ...*) - Thm ("real_minus_binom_pow2" ,TermC.num_str @{thm real_minus_binom_pow2}), + Celem.Thm ("real_minus_binom_pow2" ,TermC.num_str @{thm real_minus_binom_pow2}), (*"(a - b) ^^^ 2 = a ^^^ 2 - 2 * a * b + b ^^^ 2"*) - Thm ("real_minus_binom_times",TermC.num_str @{thm real_minus_binom_times}), + Celem.Thm ("real_minus_binom_times",TermC.num_str @{thm real_minus_binom_times}), (*"(a - b)*(a - b) = ...*) - Thm ("real_plus_minus_binom1",TermC.num_str @{thm real_plus_minus_binom1}), + Celem.Thm ("real_plus_minus_binom1",TermC.num_str @{thm real_plus_minus_binom1}), (*"(a + b) * (a - b) = a ^^^ 2 - b ^^^ 2"*) - Thm ("real_plus_minus_binom2",TermC.num_str @{thm real_plus_minus_binom2}), + Celem.Thm ("real_plus_minus_binom2",TermC.num_str @{thm real_plus_minus_binom2}), (*"(a - b) * (a + b) = a ^^^ 2 - b ^^^ 2"*) (*RL 020915*) - Thm ("real_pp_binom_times",TermC.num_str @{thm real_pp_binom_times}), + Celem.Thm ("real_pp_binom_times",TermC.num_str @{thm real_pp_binom_times}), (*(a + b)*(c + d) = a*c + a*d + b*c + b*d*) - Thm ("real_pm_binom_times",TermC.num_str @{thm real_pm_binom_times}), + Celem.Thm ("real_pm_binom_times",TermC.num_str @{thm real_pm_binom_times}), (*(a + b)*(c - d) = a*c - a*d + b*c - b*d*) - Thm ("real_mp_binom_times",TermC.num_str @{thm real_mp_binom_times}), + Celem.Thm ("real_mp_binom_times",TermC.num_str @{thm real_mp_binom_times}), (*(a - b)*(c p d) = a*c + a*d - b*c - b*d*) - Thm ("real_mm_binom_times",TermC.num_str @{thm real_mm_binom_times}), + Celem.Thm ("real_mm_binom_times",TermC.num_str @{thm real_mm_binom_times}), (*(a - b)*(c p d) = a*c - a*d - b*c + b*d*) - Thm ("realpow_multI",TermC.num_str @{thm realpow_multI}), + Celem.Thm ("realpow_multI",TermC.num_str @{thm realpow_multI}), (*(a*b)^^^n = a^^^n * b^^^n*) - Thm ("real_plus_binom_pow3",TermC.num_str @{thm real_plus_binom_pow3}), + Celem.Thm ("real_plus_binom_pow3",TermC.num_str @{thm real_plus_binom_pow3}), (* (a + b)^^^3 = a^^^3 + 3*a^^^2*b + 3*a*b^^^2 + b^^^3 *) - Thm ("real_minus_binom_pow3",TermC.num_str @{thm real_minus_binom_pow3}), + Celem.Thm ("real_minus_binom_pow3",TermC.num_str @{thm real_minus_binom_pow3}), (* (a - b)^^^3 = a^^^3 - 3*a^^^2*b + 3*a*b^^^2 - b^^^3 *) - (* Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}), + (* Celem.Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}), (*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*) - Thm ("distrib_left",TermC.num_str @{thm distrib_left}), + Celem.Thm ("distrib_left",TermC.num_str @{thm distrib_left}), (*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*) - Thm ("left_diff_distrib" ,TermC.num_str @{thm left_diff_distrib}), + Celem.Thm ("left_diff_distrib" ,TermC.num_str @{thm left_diff_distrib}), (*"(z1.0 - z2.0) * w = z1.0 * w - z2.0 * w"*) - Thm ("right_diff_distrib",TermC.num_str @{thm right_diff_distrib}), + Celem.Thm ("right_diff_distrib",TermC.num_str @{thm right_diff_distrib}), (*"w * (z1.0 - z2.0) = w * z1.0 - w * z2.0"*) *) - Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}), + Celem.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}), (*"1 * z = z"*) - Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}), + Celem.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}), (*"0 * z = 0"*) - Thm ("add_0_left",TermC.num_str @{thm add_0_left}), + Celem.Thm ("add_0_left",TermC.num_str @{thm add_0_left}), (*"0 + z = z"*) - Calc ("Groups.plus_class.plus", eval_binop "#add_"), - Calc ("Groups.times_class.times", eval_binop "#mult_"), - Calc ("Atools.pow", eval_binop "#power_"), + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"), + Celem.Calc ("Atools.pow", eval_binop "#power_"), (* - Thm ("mult_commute",TermC.num_str @{thm mult_commute}), + Celem.Thm ("mult_commute",TermC.num_str @{thm mult_commute}), (*AC-rewriting*) - Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}), - Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}), - Thm ("add_commute",TermC.num_str @{thm add_commute}), - Thm ("add_left_commute",TermC.num_str @{thm add_left_commute}), - Thm ("add_assoc",TermC.num_str @{thm add_assoc}), + Celem.Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}), + Celem.Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}), + Celem.Thm ("add_commute",TermC.num_str @{thm add_commute}), + Celem.Thm ("add_left_commute",TermC.num_str @{thm add_left_commute}), + Celem.Thm ("add_assoc",TermC.num_str @{thm add_assoc}), *) - Thm ("sym_realpow_twoI", + Celem.Thm ("sym_realpow_twoI", TermC.num_str (@{thm realpow_twoI} RS @{thm sym})), (*"r1 * r1 = r1 ^^^ 2"*) - Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}), + Celem.Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}), (*"r * r ^^^ n = r ^^^ (n + 1)"*) - (*Thm ("sym_real_mult_2", + (*Celem.Thm ("sym_real_mult_2", TermC.num_str (@{thm real_mult_2} RS @{thm sym})), (*"z1 + z1 = 2 * z1"*)*) - Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}), + Celem.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}), (*"z1 + (z1 + k) = 2 * z1 + k"*) - Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), + Celem.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}), (*"[| l is_const; m is_const |] ==> l * n + m * n = (l + m) * n"*) - Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}), + Celem.Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}), (*"[| l is_const; m is_const |] ==> l * n + (m * n + k) = (l + m) * n + k"*) - Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}), + Celem.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}), (*"m is_const ==> n + m * n = (1 + m) * n"*) - Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), + Celem.Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}), (*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*) - Calc ("Groups.plus_class.plus", eval_binop "#add_"), - Calc ("Groups.times_class.times", eval_binop "#mult_"), - Calc ("Atools.pow", eval_binop "#power_") + Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"), + Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"), + Celem.Calc ("Atools.pow", eval_binop "#power_") ], - scr = EmptyScr + scr = Celem.EmptyScr (*Script ((Thm.term_of o the o (parse thy)) scr_expand_binomtest)*) - }:rls; + }; *} setup {* KEStore_Elems.add_rlss [("make_polytest", (Context.theory_name @{theory}, prep_rls' make_polytest)), diff -r 49d7d410b83c -r 509d70b507e5 src/Tools/isac/calcelems.sml --- a/src/Tools/isac/calcelems.sml Thu Mar 15 10:17:44 2018 +0100 +++ b/src/Tools/isac/calcelems.sml Thu Mar 15 12:42:04 2018 +0100 @@ -190,6 +190,10 @@ eqtype calcID val thm''_of_thm: thm -> thm'' val rew_ord': (rew_ord' * (subst -> term * term -> bool)) list Unsynchronized.ref + val merge_rls: string -> rls -> rls -> rls + val e_rrlsstate: rrlsstate + val thm_of_thm: rule -> thm + val remove_rls: string -> rls -> rule list -> rls (*---------------------- ^^^ make public on a minimalist way down to Build?Isac ----------------- val Html_default: theID -> thydata @@ -205,7 +209,6 @@ val e_rew_ord': rew_ord' val e_rew_ord_: subst -> term * term -> bool val e_rfuns: scr - val e_rrlsstate: rrlsstate val e_scr: scr val e_subst: (term * term) list val e_theID: string list @@ -225,14 +228,12 @@ val memrls: rule -> rls -> bool val merge_ids: rls -> rls -> string val merge_ptyps': 'a ptyp list -> 'a ptyp list -> 'a ptyp list - val merge_rls: string -> rls -> rls -> rls val overwritelthy: theory -> (rls' * (string * rls)) list * (rls' * rls) list -> (rls' * (string * rls)) list val partID: theory -> string val pat2str: pat -> string val pblID2str: string list -> string val pbt2str: pbt -> string val progthys: unit -> theory list - val remove_rls: string -> rls -> rule list -> rls val rep_rrls: rls -> {attach_form: rule list list -> term -> term -> (rule * (term * term list)) list, calc: calc list, @@ -255,7 +256,6 @@ val theory2str': theory -> string val thm2str: thm -> string eqtype thmDeriv - val thm_of_thm: rule -> thm val thy2ctxt: theory -> Proof.context val type_to_string': Proof.context -> typ -> string val type_to_string'': thyID -> typ -> string