1.1 --- a/README.md Mon Apr 19 13:57:47 2021 +0200
1.2 +++ b/README.md Mon Apr 19 15:02:11 2021 +0200
1.3 @@ -19,8 +19,8 @@
1.4 hg clone https://isabelle.in.tum.de/repos/isabelle isabisac
1.5 hg clone https://hg.risc.uni-linz.ac.at/wneuper/isa
1.6
1.7 - isabisac/Admin/init -I isabisac -V isa
1.8 - isabisac/bin/isabelle components -u isa
1.9 + isabisac/Admin/init -I isabisac -V "../../isa"
1.10 + isabisac/bin/isabelle components -u "../isa"
1.11
1.12 * later updates:
1.13
2.1 --- a/test/Tools/isac/BaseDefinitions/calcelems.sml Mon Apr 19 13:57:47 2021 +0200
2.2 +++ b/test/Tools/isac/BaseDefinitions/calcelems.sml Mon Apr 19 15:02:11 2021 +0200
2.3 @@ -78,10 +78,10 @@
2.4 (fn _ => fn _ => ml_pretty o Pretty.to_ML o Proof_Display.pp_typ Pure.thy);
2.5 (*default_print_depth 3;*)
2.6 *)
2.7 -"===== extend parse to string with markup===";
2.8 +"===== extend TermC.parse to string with markup===";
2.9 (*
2.10 -fun parse thy str =
2.11 - (let val t = (typ_a2real o ThmC_Def.num_to_Free)
2.12 +fun TermC.parse thy str =
2.13 + (let val t = (TermC.typ_a2real o ThmC_Def.num_to_Free)
2.14 (Syntax.read_term_global thy str)
2.15 in SOME (Thm.global_cterm_of thy t) end) (*FIXXXXME 10.8.02: return term !!!*)
2.16 handle _ => NONE;
2.17 @@ -162,7 +162,7 @@
2.18 "----------- fun subst2str' --------------------------------------------------------------------";
2.19 "----------- fun subst2str' --------------------------------------------------------------------";
2.20 "----------- fun subst2str' --------------------------------------------------------------------";
2.21 -(*> subst2str' [(str2term "bdv", str2term "x"),
2.22 - (str2term "bdv_2", str2term "y")];
2.23 +(*> subst2str' [(TermC.str2term "bdv", TermC.str2term "x"),
2.24 + (TermC.str2term "bdv_2", TermC.str2term "y")];
2.25 val it = "[(bdv, x)]" : string
2.26 *)
3.1 --- a/test/Tools/isac/BaseDefinitions/contextC.sml Mon Apr 19 13:57:47 2021 +0200
3.2 +++ b/test/Tools/isac/BaseDefinitions/contextC.sml Mon Apr 19 15:02:11 2021 +0200
3.3 @@ -62,9 +62,9 @@
3.4 "----------- fun transfer_asms_from_to ---------------------------------------------------------";
3.5 val ctxt = Proof_Context.init_global @{theory "Isac_Knowledge"}
3.6 val from_ctxt = ContextC.insert_assumptions
3.7 - [str2term "a < (fro::int)", str2term "b < (fro::int)"] ctxt
3.8 + [TermC.str2term "a < (fro::int)", TermC.str2term "b < (fro::int)"] ctxt
3.9 val to_ctxt = ContextC.insert_assumptions
3.10 - [str2term "b < (to::int)", str2term "c < (to::int)"] ctxt
3.11 + [TermC.str2term "b < (to::int)", TermC.str2term "c < (to::int)"] ctxt
3.12 val new_ctxt = transfer_asms_from_to from_ctxt to_ctxt;
3.13 if UnparseC.terms_to_strings (get_assumptions new_ctxt) = ["b < fro", "b < to", "c < to"]
3.14 then () else error "fun transfer_asms_from_to changed"
3.15 @@ -74,34 +74,34 @@
3.16 "----------- fun avoid_contradict --------------------------------------------------------------";
3.17 "----------- fun avoid_contradict --------------------------------------------------------------";
3.18 val preds = [
3.19 -(*0.pre*)str2term "x / (x ^^^ 2 - 6 * x + 9) - 1 / (x ^^^ 2 - 3 * x) =\n1 / x is_ratequation_in x",
3.20 -(*1.pre*)str2term ("\<not> matches (?a = 0)\n ((3 + -1 * x + x ^^^ 2) * x =\n 1 * (9 * x + -6 * x ^^^ 2 + x ^^^ 3)) \<or>\n"
3.21 +(*0.pre*)TermC.str2term "x / (x ^^^ 2 - 6 * x + 9) - 1 / (x ^^^ 2 - 3 * x) =\n1 / x is_ratequation_in x",
3.22 +(*1.pre*)TermC.str2term ("\<not> TermC.matches (?a = 0)\n ((3 + -1 * x + x ^^^ 2) * x =\n 1 * (9 * x + -6 * x ^^^ 2 + x ^^^ 3)) \<or>\n"
3.23 (*1.pre*) ^ "\<not> lhs ((3 + -1 * x + x ^^^ 2) * x =\n 1 * (9 * x + -6 * x ^^^ 2 + x ^^^ 3)) is_poly_in x"),
3.24 -(*0.asm*)str2term "x \<noteq> 0", (* <-------------- "x \<noteq> 0" would contradict "x = 0" ---\*)
3.25 -(*0.asm*)str2term "9 * x + -6 * x ^^^ 2 + x ^^^ 3 \<noteq> 0"
3.26 +(*0.asm*)TermC.str2term "x \<noteq> 0", (* <-------------- "x \<noteq> 0" would contradict "x = 0" ---\*)
3.27 +(*0.asm*)TermC.str2term "9 * x + -6 * x ^^^ 2 + x ^^^ 3 \<noteq> 0"
3.28 ];
3.29
3.30 -val t = str2term "[x = 0, x = 6 / 5]";
3.31 +val t = TermC.str2term "[x = 0, x = 6 / 5]";
3.32 val (t', for_asm) = avoid_contradict t preds;
3.33 if UnparseC.term t' = "[x = 6 / 5]" andalso map UnparseC.term for_asm = ["x = 6 / 5"]
3.34 then () else error "avoid_contradict [x = 0, x = 6 / 5] CHANGED";
3.35
3.36 -val t = str2term "x = 0";
3.37 +val t = TermC.str2term "x = 0";
3.38 val (t', for_asm) = avoid_contradict t preds;
3.39 if UnparseC.term t' = "bool_undef" andalso map UnparseC.term for_asm = []
3.40 then () else error "avoid_contradict x = 0 CHANGED"; (* "x \<noteq> 0" in preds *)
3.41
3.42 -val t = str2term "x = 1";
3.43 +val t = TermC.str2term "x = 1";
3.44 val (t', for_asm) = avoid_contradict t preds;
3.45 if UnparseC.term t' = "x = 1" andalso map UnparseC.term for_asm = ["x = 1"]
3.46 then () else error "avoid_contradict x = 1 CHANGED"; (* "x \<noteq> 1" NOT in preds *)
3.47
3.48 -val t = str2term "a + b";
3.49 +val t = TermC.str2term "a + b";
3.50 val (t', for_asm) = avoid_contradict t preds;
3.51 if UnparseC.term t' = "a + b" andalso map UnparseC.term for_asm = []
3.52 then () else error "avoid_contradict a + b CHANGED"; (* NOT a predicate *)
3.53
3.54 -val t = str2term "[a + b]";
3.55 +val t = TermC.str2term "[a + b]";
3.56 val (t', for_asm) = avoid_contradict t preds;
3.57 if UnparseC.term t' = "[a + b]" andalso map UnparseC.term for_asm = []
3.58 then () else error "avoid_contradict [a + b] CHANGED"; (* NOT a predicate *)
3.59 @@ -113,12 +113,12 @@
3.60 val ctxt = Proof_Context.init_global @{theory "Isac_Knowledge"}
3.61
3.62 val sub_ctxt = ContextC.insert_assumptions
3.63 - [str2term "a < (fro::int)", str2term "b < (fro::int)"] ctxt
3.64 -val prog_res = str2term "[x_1 = 1, x_2 = (2::int), x_3 = 3]";
3.65 + [TermC.str2term "a < (fro::int)", TermC.str2term "b < (fro::int)"] ctxt
3.66 +val prog_res = TermC.str2term "[x_1 = 1, x_2 = (2::int), x_3 = 3]";
3.67
3.68 (* NO contradiction ..*)
3.69 val caller_ctxt = ContextC.insert_assumptions
3.70 - [str2term "b < (to::int)", str2term "c < (to::int)"] ctxt
3.71 + [TermC.str2term "b < (to::int)", TermC.str2term "c < (to::int)"] ctxt
3.72 val (t, new_ctxt) = subpbl_to_caller sub_ctxt prog_res caller_ctxt;
3.73
3.74 if UnparseC.term t = "[x_1 = 1, x_2 = 2, x_3 = 3]" andalso map UnparseC.term (get_assumptions new_ctxt) =
3.75 @@ -127,7 +127,7 @@
3.76
3.77 (* a contradiction ..*)
3.78 val caller_ctxt = ContextC.insert_assumptions
3.79 - [str2term "b < (to::int)", str2term "x_2 \<noteq> (2::int)"] ctxt
3.80 + [TermC.str2term "b < (to::int)", TermC.str2term "x_2 \<noteq> (2::int)"] ctxt
3.81 val (t, new_ctxt) = subpbl_to_caller sub_ctxt prog_res caller_ctxt;
3.82
3.83 if UnparseC.term t = "[x_1 = 1, x_3 = 3]" andalso map UnparseC.term (get_assumptions new_ctxt) =
3.84 @@ -203,7 +203,7 @@
3.85
3.86 (* *)if eq_set op = ((Ctree.get_assumptions pt p |> map UnparseC.term), [
3.87 (*0.pre*) "x / (x ^^^ 2 - 6 * x + 9) - 1 / (x ^^^ 2 - 3 * x) =\n1 / x is_ratequation_in x",
3.88 -(*1.pre*) "\<not> matches (?a = 0)\n ((3 + -1 * x + x ^^^ 2) * x =\n 1 * (9 * x + -6 * x ^^^ 2 + x ^^^ 3)) \<or>\n"
3.89 +(*1.pre*) "\<not> TermC.matches (?a = 0)\n ((3 + -1 * x + x ^^^ 2) * x =\n 1 * (9 * x + -6 * x ^^^ 2 + x ^^^ 3)) \<or>\n"
3.90 (*1.pre*) ^ "\<not> lhs ((3 + -1 * x + x ^^^ 2) * x =\n 1 * (9 * x + -6 * x ^^^ 2 + x ^^^ 3)) is_poly_in x",
3.91 (*2.pre*) "lhs (-6 * x + 5 * x ^^^ 2 = 0) is_poly_in x",
3.92 (*2.pre*) "lhs (-6 * x + 5 * x ^^^ 2 = 0) has_degree_in x = 2",
3.93 @@ -249,7 +249,7 @@
3.94
3.95 (* *)if eq_set op = (map UnparseC.term (get_assumptions ctxt_parent), [
3.96 (*0.pre*) "x / (x ^^^ 2 - 6 * x + 9) - 1 / (x ^^^ 2 - 3 * x) =\n1 / x is_ratequation_in x",
3.97 -(*1.pre*) "\<not> matches (?a = 0)\n ((3 + -1 * x + x ^^^ 2) * x =\n 1 * (9 * x + -6 * x ^^^ 2 + x ^^^ 3)) \<or>\n"
3.98 +(*1.pre*) "\<not> TermC.matches (?a = 0)\n ((3 + -1 * x + x ^^^ 2) * x =\n 1 * (9 * x + -6 * x ^^^ 2 + x ^^^ 3)) \<or>\n"
3.99 (*1.pre*) ^ "\<not> lhs ((3 + -1 * x + x ^^^ 2) * x =\n 1 * (9 * x + -6 * x ^^^ 2 + x ^^^ 3)) is_poly_in x",
3.100 (*0.asm*) "x \<noteq> 0",
3.101 (*0.asm*) "9 * x + -6 * x ^^^ 2 + x ^^^ 3 \<noteq> 0"
3.102 @@ -260,7 +260,7 @@
3.103 ContextC.subpbl_to_caller sub_ctxt prog_res ctxt_parent;
3.104 (* *)if eq_set op = (map UnparseC.term (get_assumptions ctxt'), [
3.105 (*0.pre*) "x / (x ^^^ 2 - 6 * x + 9) - 1 / (x ^^^ 2 - 3 * x) =\n1 / x is_ratequation_in x",
3.106 -(*1.pre*) "\<not> matches (?a = 0)\n ((3 + -1 * x + x ^^^ 2) * x =\n 1 * (9 * x + -6 * x ^^^ 2 + x ^^^ 3)) \<or>\n"
3.107 +(*1.pre*) "\<not> TermC.matches (?a = 0)\n ((3 + -1 * x + x ^^^ 2) * x =\n 1 * (9 * x + -6 * x ^^^ 2 + x ^^^ 3)) \<or>\n"
3.108 (*1.pre*) ^ "\<not> lhs ((3 + -1 * x + x ^^^ 2) * x =\n 1 * (9 * x + -6 * x ^^^ 2 + x ^^^ 3)) is_poly_in x",
3.109 (*0.asm*) "9 * x + -6 * x ^^^ 2 + x ^^^ 3 \<noteq> 0",
3.110 (*0.asm*) "x \<noteq> 0", (* <----------------------- "x \<noteq> 0" contradiction resoved ---\*)
3.111 @@ -308,7 +308,7 @@
3.112 if f2str f = "[x = 6 / 5]" andalso map UnparseC.term (Ctree.get_assumptions pt p) =
3.113 ["x = 6 / 5", "lhs (-6 * x + 5 * x ^^^ 2 = 0) is_poly_in x",
3.114 "lhs (-6 * x + 5 * x ^^^ 2 = 0) has_degree_in x = 2",
3.115 - "\<not> matches (?a = 0)\n ((3 + -1 * x + x ^^^ 2) * x =\n 1 * (9 * x + -6 * x ^^^ 2 + x ^^^ 3)) \<or>\n\<not> lhs ((3 + -1 * x + x ^^^ 2) * x =\n 1 * (9 * x + -6 * x ^^^ 2 + x ^^^ 3)) is_poly_in x",
3.116 + "\<not> TermC.matches (?a = 0)\n ((3 + -1 * x + x ^^^ 2) * x =\n 1 * (9 * x + -6 * x ^^^ 2 + x ^^^ 3)) \<or>\n\<not> lhs ((3 + -1 * x + x ^^^ 2) * x =\n 1 * (9 * x + -6 * x ^^^ 2 + x ^^^ 3)) is_poly_in x",
3.117 "x \<noteq> 0", "9 * x + -6 * x ^^^ 2 + x ^^^ 3 \<noteq> 0",
3.118 "x / (x ^^^ 2 - 6 * x + 9) - 1 / (x ^^^ 2 - 3 * x) =\n1 / x is_ratequation_in x"]
3.119 then () else error "test CHANGED";
4.1 --- a/test/Tools/isac/BaseDefinitions/libraryC.sml Mon Apr 19 13:57:47 2021 +0200
4.2 +++ b/test/Tools/isac/BaseDefinitions/libraryC.sml Mon Apr 19 15:02:11 2021 +0200
4.3 @@ -78,7 +78,7 @@
4.4 "----------- fun ids_of ------------------------------------------------------------------------";
4.5 "----------- fun ids_of ------------------------------------------------------------------------";
4.6 (*
4.7 -> val t = (Thm.term_of o the o (parse thy))
4.8 +> val t = (Thm.term_of o the o (TermC.parse thy))
4.9 "solve_univar (R, [univar, equation], no_met) (a = b + #1) a";
4.10 > ids_of t;
4.11 ["solve'_univar", "Product_Type.Pair", "R", "Cons", "univar", "equation", "Nil",...]*)
5.1 --- a/test/Tools/isac/BaseDefinitions/substitution.sml Mon Apr 19 13:57:47 2021 +0200
5.2 +++ b/test/Tools/isac/BaseDefinitions/substitution.sml Mon Apr 19 15:02:11 2021 +0200
5.3 @@ -97,7 +97,7 @@
5.4 Subst.program_to_input: Subst.program -> string list;
5.5
5.6 val {scr = Prog prog, ...} = MethodC.from_store ["diff", "differentiate_on_R"];
5.7 -val env = [(str2term "v_v", str2term "x")] : Subst.T;
5.8 +val env = [(TermC.str2term "v_v", TermC.str2term "x")] : Subst.T;
5.9
5.10 "~~~~~ fun for_bdv, args:"; val (prog, env) = (prog, env);
5.11 fun scan (Const _) = NONE
6.1 --- a/test/Tools/isac/BaseDefinitions/termC.sml Mon Apr 19 13:57:47 2021 +0200
6.2 +++ b/test/Tools/isac/BaseDefinitions/termC.sml Mon Apr 19 15:02:11 2021 +0200
6.3 @@ -10,24 +10,24 @@
6.4 "----------- inst_bdv -----------------------------------";
6.5 "----------- subst_atomic_all ---------------------------";
6.6 "----------- Pattern.match ------------------------------";
6.7 -"----------- fun matches --------------------------------";
6.8 -"----------- fun parse, fun parse_patt, fun T_a2real -------------------------------------------";
6.9 -"----------- fun vars_of -----------------------------------------------------------------------";
6.10 +"----------- fun TermC.matches --------------------------------";
6.11 +"----------- fun TermC.parse, fun TermC.parse_patt, fun T_a2real -------------------------------------------";
6.12 +"----------- fun TermC.vars_of -----------------------------------------------------------------------";
6.13 "----------- uminus_to_string ---------------------------";
6.14 "----------- *** Problem.prep_input: syntax error in '#Where' of [v";
6.15 "----------- check writeln, tracing for string markup ---";
6.16 -"----------- build fun is_bdv_subst ------------------------------------------------------------";
6.17 +"----------- build fun TermC.is_bdv_subst ------------------------------------------------------------";
6.18 "----------- fun str_of_int --------------------------------------------------------------------";
6.19 -"----------- fun scala_of_term -----------------------------------------------------------------";
6.20 -"----------- fun contains_Var ------------------------------------------------------------------";
6.21 -"----------- fun ThmC_Def.int_opt_of_string, fun is_num ----------------------------------------------------";
6.22 -"----------- fun is_f_x ------------------------------------------------------------------------";
6.23 +"----------- fun TermC.scala_of_term -----------------------------------------------------------------";
6.24 +"----------- fun TermC.contains_Var ------------------------------------------------------------------";
6.25 +"----------- fun ThmC_Def.int_opt_of_string, fun TermC.is_num ----------------------------------------------------";
6.26 +"----------- fun TermC.is_f_x ------------------------------------------------------------------------";
6.27 "----------- fun list2isalist, fun isalist2list ------------------------------------------------";
6.28 -"----------- fun strip_imp_prems' --------------------------------------------------------------";
6.29 -"----------- fun ins_concl ---------------------------------------------------------------------";
6.30 +"----------- fun TermC.strip_imp_prems' --------------------------------------------------------------";
6.31 +"----------- fun TermC.ins_concl ---------------------------------------------------------------------";
6.32 "----------- fun mk_factroot, fun mk_num_op_num, -----------------------------------------------";
6.33 -"----------- fun dest_binop_typ ----------------------------------------------------------------";
6.34 -"----------- fun is_list -----------------------------------------------------------------------";
6.35 +"----------- fun TermC.dest_binop_typ ----------------------------------------------------------------";
6.36 +"----------- fun TermC.is_list -----------------------------------------------------------------------";
6.37 "----------- fun inst_abs ----------------------------------------------------------------------";
6.38 "----------- fun ThmC_Def.num_to_Free -------------------------------------------------------------";
6.39 "--------------------------------------------------------";
6.40 @@ -188,8 +188,8 @@
6.41 then ()
6.42 else error "termC.sml d1_isolate_add2";
6.43 val subst = [(TermC.str2term "bdv", TermC.str2term "x")];
6.44 - val t = (norm o Thm.prop_of) (ThmC.numerals_to_Free @{thm d1_isolate_add2});
6.45 - val t' = inst_bdv subst t;
6.46 + val t = (Eval.norm o Thm.prop_of) (ThmC.numerals_to_Free @{thm d1_isolate_add2});
6.47 + val t' = TermC.inst_bdv subst t;
6.48 if UnparseC.term t' = "\<not> x occurs_in ?a \<Longrightarrow> (?a + x = 0) = (x = -1 * ?a)"
6.49 then ()
6.50 else error "termC.sml inst_bdv 1";
6.51 @@ -200,12 +200,12 @@
6.52 (*default_print_depth 5;*)
6.53
6.54 val subst =
6.55 - [(str2term "bdv_1", str2term "c"),
6.56 - (str2term "bdv_2", str2term "c_2"),
6.57 - (str2term "bdv_3", str2term "c_3"),
6.58 - (str2term "bdv_4", str2term "c_4")];
6.59 -val t = (norm o Thm.prop_of) (ThmC.numerals_to_Free @{thm separate_bdvs_add});
6.60 -val t' = inst_bdv subst t;
6.61 + [(TermC.str2term "bdv_1", TermC.str2term "c"),
6.62 + (TermC.str2term "bdv_2", TermC.str2term "c_2"),
6.63 + (TermC.str2term "bdv_3", TermC.str2term "c_3"),
6.64 + (TermC.str2term "bdv_4", TermC.str2term "c_4")];
6.65 +val t = (Eval.norm o Thm.prop_of) (ThmC.numerals_to_Free @{thm separate_bdvs_add});
6.66 +val t' = TermC.inst_bdv subst t;
6.67
6.68 if UnparseC.term t' = "[] from [c, c_2, c_3, c_4] occur_exactly_in ?a \<Longrightarrow>\n"
6.69 ^ "(?a + ?b = ?c) = (?b = ?c + -1 * ?a)"
6.70 @@ -214,26 +214,26 @@
6.71 "----------- subst_atomic_all ---------------------------";
6.72 "----------- subst_atomic_all ---------------------------";
6.73 "----------- subst_atomic_all ---------------------------";
6.74 - val t = str2term "(tl vs_vs) from vs_vs occur_exactly_in (NTH 1 (es_es::bool list))";
6.75 - val env = [(str2term "vs_vs::real list", str2term "[c, c_2]"),
6.76 - (str2term "es_es::bool list", str2term "[c_2 = 0, c + c_2 = 1]")];
6.77 - val (all_Free_subst, t') = subst_atomic_all env t;
6.78 + val t = TermC.str2term "(tl vs_vs) from vs_vs occur_exactly_in (NTH 1 (es_es::bool list))";
6.79 + val env = [(TermC.str2term "vs_vs::real list", TermC.str2term "[c, c_2]"),
6.80 + (TermC.str2term "es_es::bool list", TermC.str2term "[c_2 = 0, c + c_2 = 1]")];
6.81 + val (all_Free_subst, t') = TermC.subst_atomic_all env t;
6.82
6.83 if all_Free_subst andalso
6.84 UnparseC.term t' = "tl [c, c_2] from [c, c_2] occur_exactly_in NTH 1 [c_2 = 0, c + c_2 = 1]"
6.85 then ()
6.86 else error "termC.sml subst_atomic_all should be 'true'";
6.87
6.88 - val (all_Free_subst, t') = subst_atomic_all (tl env) t;
6.89 + val (all_Free_subst, t') = TermC.subst_atomic_all (tl env) t;
6.90 if not all_Free_subst andalso
6.91 UnparseC.term t' = "tl vs_vs from vs_vs occur_exactly_in NTH 1 [c_2 = 0, c + c_2 = 1]" then ()
6.92 - else error "termC.sml subst_atomic_all should be 'false'";
6.93 + else error "TermC.subst_atomic_all should be 'false'";
6.94
6.95 "----------- Pattern.match ------------------------------";
6.96 "----------- Pattern.match ------------------------------";
6.97 "----------- Pattern.match ------------------------------";
6.98 - val t = (Thm.term_of o the o (parse thy)) "3 * x^^^2 = (1::real)";
6.99 - val pat = (free2var o Thm.term_of o the o (parse thy)) "a * b^^^2 = (c::real)";
6.100 + val t = (Thm.term_of o the o (TermC.parse thy)) "3 * x^^^2 = (1::real)";
6.101 + val pat = (TermC.free2var o Thm.term_of o the o (TermC.parse thy)) "a * b^^^2 = (c::real)";
6.102 (* !^^^^^^^^!... necessary for Pattern.match, see Logic.varify_global below*)
6.103 val insts = Pattern.match @{theory "Isac_Knowledge"} (pat, t) (Vartab.empty, Vartab.empty);
6.104 (*default_print_depth 3; 999*) insts;
6.105 @@ -244,7 +244,7 @@
6.106 (("c", 0), ("Real.real", Free ("1", "Real.real")))})*)
6.107
6.108 "----- throws exn MATCH...";
6.109 -(* val t = str2term "x";
6.110 +(* val t = TermC.str2term "x";
6.111 (Pattern.match @{theory "Isac_Knowledge"} (pat, t) (Vartab.empty, Vartab.empty))
6.112 handle MATCH => ???; *)
6.113
6.114 @@ -256,19 +256,19 @@
6.115
6.116 Vartab.dest tenv;
6.117
6.118 -"----------- fun matches --------------------------------";
6.119 -"----------- fun matches --------------------------------";
6.120 -"----------- fun matches --------------------------------";
6.121 +"----------- fun TermC.matches --------------------------------";
6.122 +"----------- fun TermC.matches --------------------------------";
6.123 +"----------- fun TermC.matches --------------------------------";
6.124 (*examples see
6.125 test/../Knowledge/polyeq.sml:
6.126 - Where=[Correct "matches (?a = 0) (-8 - 2 * x + x ^^^ 2 = 0)"*)
6.127 + Where=[Correct "TermC.matches (?a = 0) (-8 - 2 * x + x ^^^ 2 = 0)"*)
6.128 (*test/../Specify/refine.sml:
6.129 |\nmatches (?a + ?b * x = #0) ((x + #1) * (x + #2) = x ^^^ #2 + #8)"],*)
6.130 val thy = @{theory "Complex_Main"};
6.131
6.132 "----- test 1: OK";
6.133 val pa = Logic.varify_global @{term "a = (0::real)"}; (*<<<<<<<---------------*)
6.134 - tracing "paIsa=..."; atomty pa; tracing "...=paIsa";
6.135 + tracing "paIsa=..."; TermC.atomty pa; tracing "...=paIsa";
6.136 (***
6.137 *** Const (op =, real => real => bool)
6.138 *** . Var ((a, 0), real)
6.139 @@ -276,121 +276,121 @@
6.140 ***)
6.141 "----- test 1a true";
6.142 val tm = @{term "-8 - 2 * x + x ^ 2 = (0::real)"}; (*<<<<<<<---------------*)
6.143 - if matches thy tm pa then ()
6.144 - else error "termC.sml diff.behav. in matches true 1";
6.145 + if TermC.matches thy tm pa then ()
6.146 + else error "termC.sml diff.behav. in TermC.matches true 1";
6.147 "----- test 1b false";
6.148 val tm = @{term "-8 - 2 * x + x ^ 2 = (3::real)"}; (*<<<<<<<---------------*)
6.149 - if matches thy tm pa then error "termC.sml diff.behav. in matches false 1"
6.150 + if TermC.matches thy tm pa then error "termC.sml diff.behav. in TermC.matches false 1"
6.151 else ();
6.152
6.153 "----- test 2: Nok";
6.154 - val pa = Logic.varify_global (str2term "a = (0::real)");(*<<<<<<<-------------*)
6.155 - tracing "paLo2=..."; atomty pa; tracing "...=paLo2";
6.156 + val pa = Logic.varify_global (TermC.str2term "a = (0::real)");(*<<<<<<<-------------*)
6.157 + tracing "paLo2=..."; TermC.atomty pa; tracing "...=paLo2";
6.158 (***
6.159 *** Const (op =, real => real => bool)
6.160 *** . Var ((a, 0), real)
6.161 *** . Var ((0, 0), real)
6.162 ***)
6.163 "----- test 2a true";
6.164 - val tm = str2term "-8 - 2 * x + x ^ 2 = (0::real)"; (*<<<<<<<-------------*)
6.165 - if matches thy tm pa then ()
6.166 - else error "termC.sml diff.behav. in matches true 2";
6.167 + val tm = TermC.str2term "-8 - 2 * x + x ^ 2 = (0::real)"; (*<<<<<<<-------------*)
6.168 + if TermC.matches thy tm pa then ()
6.169 + else error "termC.sml diff.behav. in TermC.matches true 2";
6.170 "----- test 2b false";
6.171 - val tm = str2term "-8 - 2 * x + x ^ 2 = (3::real)"; (*<<<<<<<-------------*)
6.172 - if matches thy tm pa then ()
6.173 - else error "termC.sml diff.behav. in matches false 2";
6.174 + val tm = TermC.str2term "-8 - 2 * x + x ^ 2 = (3::real)"; (*<<<<<<<-------------*)
6.175 + if TermC.matches thy tm pa then ()
6.176 + else error "termC.sml diff.behav. in TermC.matches false 2";
6.177 (* i.e. !!!!!!!!!!!!!!!!! THIS KIND OF PATTERN IS NOT RELIABLE !!!!!!!!!!!!!!!!!
6.178 -if matches thy tm pa then error "termC.sml diff.behav. in matches false 2"
6.179 +if TermC.matches thy tm pa then error "termC.sml diff.behav. in TermC.matches false 2"
6.180 else ();*)
6.181
6.182 "----- test 3: OK";
6.183 - val pa = free2var (str2term "a = (0::real)");(*<<<<<<<-------------*)
6.184 - tracing "paF2=..."; atomty pa; tracing "...=paF2";
6.185 + val pa = TermC.free2var (TermC.str2term "a = (0::real)");(*<<<<<<<-------------*)
6.186 + tracing "paF2=..."; TermC.atomty pa; tracing "...=paF2";
6.187 (***
6.188 *** Const (op =, real => real => bool)
6.189 *** . Var ((a, 0), real)
6.190 *** . Free (0, real)
6.191 ***)
6.192 "----- test 3a true";
6.193 - val tm = str2term "-8 - 2 * x + x ^ 2 = (0::real)"; (*<<<<<<<-------------*)
6.194 - if matches thy tm pa then ()
6.195 - else error "termC.sml diff.behav. in matches true 3";
6.196 + val tm = TermC.str2term "-8 - 2 * x + x ^ 2 = (0::real)"; (*<<<<<<<-------------*)
6.197 + if TermC.matches thy tm pa then ()
6.198 + else error "termC.sml diff.behav. in TermC.matches true 3";
6.199 "----- test 3b false";
6.200 - val tm = str2term "-8 - 2 * x + x ^ 2 = (3::real)"; (*<<<<<<<-------------*)
6.201 - if matches thy tm pa then error "termC.sml diff.behav. in matches false 3"
6.202 + val tm = TermC.str2term "-8 - 2 * x + x ^ 2 = (3::real)"; (*<<<<<<<-------------*)
6.203 + if TermC.matches thy tm pa then error "termC.sml diff.behav. in TermC.matches false 3"
6.204 else ();
6.205
6.206 "----- test 4=3 with specific data";
6.207 - val pa = free2var (str2term "M_b 0");
6.208 + val pa = TermC.free2var (TermC.str2term "M_b 0");
6.209 "----- test 4a true";
6.210 - val tm = str2term "M_b 0";
6.211 - if matches thy tm pa then ()
6.212 - else error "termC.sml diff.behav. in matches true 4";
6.213 + val tm = TermC.str2term "M_b 0";
6.214 + if TermC.matches thy tm pa then ()
6.215 + else error "termC.sml diff.behav. in TermC.matches true 4";
6.216 "----- test 4b false";
6.217 - val tm = str2term "M_b x";
6.218 - if matches thy tm pa then error "termC.sml diff.behav. in matches false 4"
6.219 + val tm = TermC.str2term "M_b x";
6.220 + if TermC.matches thy tm pa then error "termC.sml diff.behav. in TermC.matches false 4"
6.221 else ();
6.222
6.223 -"----------- fun matches, repair 'Handler catches all exceptions' ------------------------------";
6.224 -"----------- fun matches, repair 'Handler catches all exceptions' ------------------------------";
6.225 -"----------- fun matches, repair 'Handler catches all exceptions' ------------------------------";
6.226 +"----------- fun TermC.matches, repair 'Handler catches all exceptions' ------------------------------";
6.227 +"----------- fun TermC.matches, repair 'Handler catches all exceptions' ------------------------------";
6.228 +"----------- fun TermC.matches, repair 'Handler catches all exceptions' ------------------------------";
6.229
6.230
6.231
6.232
6.233 -"----------- fun parse, fun parse_patt, fun T_a2real -------------------------------------------";
6.234 -"----------- fun parse, fun parse_patt, fun T_a2real -------------------------------------------";
6.235 -"----------- fun parse, fun parse_patt, fun T_a2real -------------------------------------------";
6.236 +"----------- fun TermC.parse, fun TermC.parse_patt, fun T_a2real -------------------------------------------";
6.237 +"----------- fun TermC.parse, fun TermC.parse_patt, fun T_a2real -------------------------------------------";
6.238 +"----------- fun TermC.parse, fun TermC.parse_patt, fun T_a2real -------------------------------------------";
6.239 (* added after Isabelle2015->17
6.240 -> val (SOME ct) = parse thy "(-#5)^^^#3";
6.241 -> atomty (Thm.term_of ct);
6.242 +> val (SOME ct) = TermC.parse thy "(-#5)^^^#3";
6.243 +> TermC.atomty (Thm.term_of ct);
6.244 *** -------------
6.245 *** Const ( Nat.op ^, ['a, nat] => 'a)
6.246 *** Const ( uminus, 'a => 'a)
6.247 *** Free ( #5, 'a)
6.248 *** Free ( #3, nat)
6.249 -> val (SOME ct) = parse thy "R=R";
6.250 -> atomty (Thm.term_of ct);
6.251 +> val (SOME ct) = TermC.parse thy "R=R";
6.252 +> TermC.atomty (Thm.term_of ct);
6.253 *** -------------
6.254 *** Const ( op =, [real, real] => bool)
6.255 *** Free ( R, real)
6.256 *** Free ( R, real)
6.257
6.258 -THIS IS THE OUTPUT FOR VERSION (3) above at typ_a2real !!!!!
6.259 +THIS IS THE OUTPUT FOR VERSION (3) above at TermC.typ_a2real !!!!!
6.260 *** -------------
6.261 *** Const ( op =, [RealDef.real, RealDef.real] => bool)
6.262 *** Free ( R, RealDef.real)
6.263 *** Free ( R, RealDef.real) *)
6.264 val thy = @{theory "Complex_Main"};
6.265 val str = "x + z";
6.266 - parse thy str;
6.267 + TermC.parse thy str;
6.268 "---------------";
6.269 val str = "x + 2*z";
6.270 val t = (Syntax.read_term_global thy str);
6.271 val t = ThmC_Def.num_to_Free (Syntax.read_term_global thy str);
6.272 - val t = (typ_a2real o ThmC_Def.num_to_Free) (Syntax.read_term_global thy str);
6.273 + val t = (TermC.typ_a2real o ThmC_Def.num_to_Free) (Syntax.read_term_global thy str);
6.274 Thm.global_cterm_of thy t;
6.275 - val t = (the (parse thy str)) handle _ => error "termC.sml parsing 'x + 2*z' failed";
6.276 + val t = (the (TermC.parse thy str)) handle _ => error "termC.sml parsing 'x + 2*z' failed";
6.277
6.278 -"===== fun parse_patt caused error in fun T_a2real ===";
6.279 +"===== fun TermC.parse_patt caused error in fun T_a2real ===";
6.280 val thy = @{theory "Poly"};
6.281 - parse_patt thy "?p is_addUnordered";
6.282 - parse_patt thy "?p :: real";
6.283 + TermC.parse_patt thy "?p is_addUnordered";
6.284 + TermC.parse_patt thy "?p :: real";
6.285
6.286 val str = "x + z";
6.287 - parse thy str;
6.288 + TermC.parse thy str;
6.289 "---------------";
6.290 val str = "x + 2*z";
6.291 val t = (Syntax.read_term_global thy str);
6.292 val t = ThmC_Def.num_to_Free (Syntax.read_term_global thy str);
6.293 - val t = (typ_a2real o ThmC_Def.num_to_Free) (Syntax.read_term_global thy str);
6.294 + val t = (TermC.typ_a2real o ThmC_Def.num_to_Free) (Syntax.read_term_global thy str);
6.295 Thm.global_cterm_of thy t;
6.296 - val t = (the (parse thy str)) handle _ => error "termC.sml parsing 'x + 2*z' failed";
6.297 + val t = (the (TermC.parse thy str)) handle _ => error "termC.sml parsing 'x + 2*z' failed";
6.298
6.299 -"===== fun parse_patt caused error in fun T_a2real ===";
6.300 +"===== fun TermC.parse_patt caused error in fun T_a2real ===";
6.301 val thy = @{theory "Poly"};
6.302 - parse_patt thy "?p is_addUnordered";
6.303 - parse_patt thy "?p :: real";
6.304 + TermC.parse_patt thy "?p is_addUnordered";
6.305 + TermC.parse_patt thy "?p :: real";
6.306
6.307 (* Christian Urban, 101001
6.308 theory Test
6.309 @@ -415,20 +415,20 @@
6.310 |> writeln
6.311 end *)
6.312
6.313 -"----------- fun vars_of -----------------------------------------------------------------------";
6.314 -"----------- fun vars_of -----------------------------------------------------------------------";
6.315 -"----------- fun vars_of -----------------------------------------------------------------------";
6.316 +"----------- fun TermC.vars_of -----------------------------------------------------------------------";
6.317 +"----------- fun TermC.vars_of -----------------------------------------------------------------------";
6.318 +"----------- fun TermC.vars_of -----------------------------------------------------------------------";
6.319 val thy = @{theory Partial_Fractions};
6.320 val ctxt = Proof_Context.init_global @{theory}
6.321
6.322 val SOME t = TermC.parseNEW ctxt "x ^^^ 2 + -1 * x * y";
6.323 -case vars_of t of [Free ("x", _), Free ("y", _)] => ()
6.324 -| _ => error "vars_of (x ^^^ 2 + -1 * x * y) ..changed";
6.325 +case TermC.vars_of t of [Free ("x", _), Free ("y", _)] => ()
6.326 +| _ => error "TermC.vars_of (x ^^^ 2 + -1 * x * y) ..changed";
6.327
6.328 val SOME t = TermC.parseNEW ctxt "3 = 3 * AA / 4";
6.329
6.330 -case vars_of t of [Const ("Partial_Fractions.AA", _), Const ("HOL.eq", _)] => ()
6.331 -| _ => error "vars_of (3 = 3 * AA / 4) ..changed (! use only for polynomials, not equations!)";
6.332 +case TermC.vars_of t of [Const ("Partial_Fractions.AA", _), Const ("HOL.eq", _)] => ()
6.333 +| _ => error "TermC.vars_of (3 = 3 * AA / 4) ..changed (! use only for polynomials, not equations!)";
6.334
6.335
6.336 "----------- uminus_to_string ---------------------------";
6.337 @@ -436,7 +436,7 @@
6.338 "----------- uminus_to_string ---------------------------";
6.339 val t1 = ThmC_Def.num_to_Free @{term "-2::real"};
6.340 val t2 = ThmC_Def.num_to_Free @{term "- 2::real"};
6.341 - if uminus_to_string t2 = t1
6.342 + if TermC.uminus_to_string t2 = t1
6.343 then ()
6.344 else error "termC.sml diff.behav. in uminus_to_string";
6.345
6.346 @@ -476,7 +476,7 @@
6.347 val t = (thy, str) |>> ThyC.to_ctxt
6.348 |-> Proof_Context.read_term_pattern
6.349 |> ThmC_Def.num_to_Free;
6.350 -val t_real = typ_a2real t;
6.351 +val t_real = TermC.typ_a2real t;
6.352 if UnparseC.term_in_ctxt ctxt t_real =
6.353 "\<not> (matchsub ((?a::real) + ((?b::real) + (?c::real))) (t_t::real) \<or>\n "
6.354 ^ "matchsub (?a + (?b - ?c)) t_t \<or>\n "
6.355 @@ -561,44 +561,44 @@
6.356 tracing "----------------DIFFERENT output----";
6.357 *)
6.358
6.359 -"----------- fun is_bdv_subst ------------------------------------------------------------------";
6.360 -"----------- fun is_bdv_subst ------------------------------------------------------------------";
6.361 -"----------- fun is_bdv_subst ------------------------------------------------------------------";
6.362 -if is_bdv_subst (str2term "[(''bdv'', v_v)]") then ()
6.363 -else error "is_bdv_subst canged 1";
6.364 +"----------- fun TermC.is_bdv_subst ------------------------------------------------------------------";
6.365 +"----------- fun TermC.is_bdv_subst ------------------------------------------------------------------";
6.366 +"----------- fun TermC.is_bdv_subst ------------------------------------------------------------------";
6.367 +if TermC.is_bdv_subst (TermC.str2term "[(''bdv'', v_v)]") then ()
6.368 +else error "TermC.is_bdv_subst canged 1";
6.369
6.370 -if is_bdv_subst (str2term "[(''bdv_1'', v_s1),(''bdv_2'', v_s2)]") then ()
6.371 -else error "is_bdv_subst canged 2";
6.372 +if TermC.is_bdv_subst (TermC.str2term "[(''bdv_1'', v_s1),(''bdv_2'', v_s2)]") then ()
6.373 +else error "TermC.is_bdv_subst canged 2";
6.374
6.375 "----------- fun str_of_int --------------------------------------------------------------------";
6.376 "----------- fun str_of_int --------------------------------------------------------------------";
6.377 "----------- fun str_of_int --------------------------------------------------------------------";
6.378 -if str_of_int 1 = "1" then () else error "str_of_int 1";
6.379 -if str_of_int ~1 = "-1" then () else error "str_of_int -1";
6.380 +if TermC.str_of_int 1 = "1" then () else error "str_of_int 1";
6.381 +if TermC.str_of_int ~1 = "-1" then () else error "str_of_int -1";
6.382
6.383 -"----------- fun scala_of_term -----------------------------------------------------------------";
6.384 -"----------- fun scala_of_term -----------------------------------------------------------------";
6.385 -"----------- fun scala_of_term -----------------------------------------------------------------";
6.386 +"----------- fun TermC.scala_of_term -----------------------------------------------------------------";
6.387 +"----------- fun TermC.scala_of_term -----------------------------------------------------------------";
6.388 +"----------- fun TermC.scala_of_term -----------------------------------------------------------------";
6.389 val t = @{term "aaa::real"};
6.390 -if scala_of_term t = "Free(\"aaa\", Type(\"Real.real\", List()))"
6.391 -then () else error "scala_of_term aaa::real";
6.392 +if TermC.scala_of_term t = "Free(\"aaa\", Type(\"Real.real\", List()))"
6.393 +then () else error "TermC.scala_of_term aaa::real";
6.394
6.395 val t = @{term "aaa + bbb"};
6.396 -if scala_of_term t = "App(App(Const(\"Groups.plus_class.plus\", Type(\"fun\", List(TFree(\"'a\", List(\"Groups.plus\")), Type(\"fun\", List(TFree(\"'a\", List(\"Groups.plus\")), TFree(\"'a\", List(\"Groups.plus\"))))))), Free(\"aaa\", TFree(\"'a\", List(\"Groups.plus\")))), Free(\"bbb\", TFree(\"'a\", List(\"Groups.plus\"))))"
6.397 -then () else error "scala_of_term aaa + bbb";
6.398 +if TermC.scala_of_term t = "App(App(Const(\"Groups.plus_class.plus\", Type(\"fun\", List(TFree(\"'a\", List(\"Groups.plus\")), Type(\"fun\", List(TFree(\"'a\", List(\"Groups.plus\")), TFree(\"'a\", List(\"Groups.plus\"))))))), Free(\"aaa\", TFree(\"'a\", List(\"Groups.plus\")))), Free(\"bbb\", TFree(\"'a\", List(\"Groups.plus\"))))"
6.399 +then () else error "TermC.scala_of_term aaa + bbb";
6.400
6.401 -"----------- fun contains_Var ------------------------------------------------------------------";
6.402 -"----------- fun contains_Var ------------------------------------------------------------------";
6.403 -"----------- fun contains_Var ------------------------------------------------------------------";
6.404 -val t = parse_patt @{theory} "?z = 3";
6.405 -if contains_Var t = true then () else error "contains_Var ?z = 3";
6.406 +"----------- fun TermC.contains_Var ------------------------------------------------------------------";
6.407 +"----------- fun TermC.contains_Var ------------------------------------------------------------------";
6.408 +"----------- fun TermC.contains_Var ------------------------------------------------------------------";
6.409 +val t = TermC.parse_patt @{theory} "?z = 3";
6.410 +if TermC.contains_Var t = true then () else error "TermC.contains_Var ?z = 3";
6.411
6.412 -val t = parse_patt @{theory} "z = 3";
6.413 -if contains_Var t = false then () else error "contains_Var ?z = 3";
6.414 +val t = TermC.parse_patt @{theory} "z = 3";
6.415 +if TermC.contains_Var t = false then () else error "TermC.contains_Var ?z = 3";
6.416
6.417 -"----------- fun ThmC_Def.int_opt_of_string, fun is_num ----------------------------------------------------";
6.418 -"----------- fun ThmC_Def.int_opt_of_string, fun is_num ----------------------------------------------------";
6.419 -"----------- fun ThmC_Def.int_opt_of_string, fun is_num ----------------------------------------------------";
6.420 +"----------- fun ThmC_Def.int_opt_of_string, fun TermC.is_num ----------------------------------------------------";
6.421 +"----------- fun ThmC_Def.int_opt_of_string, fun TermC.is_num ----------------------------------------------------";
6.422 +"----------- fun ThmC_Def.int_opt_of_string, fun TermC.is_num ----------------------------------------------------";
6.423 case ThmC_Def.int_opt_of_string "123" of
6.424 SOME 123 => () | _ => raise error "ThmC_Def.int_opt_of_string 123 changed";
6.425 case ThmC_Def.int_opt_of_string "(-123)" of
6.426 @@ -608,46 +608,46 @@
6.427 case ThmC_Def.int_opt_of_string "-123" of
6.428 SOME ~123 => () | _ => raise error "ThmC_Def.int_opt_of_string -123 changed";
6.429
6.430 -val t = str2term "1";
6.431 -if is_num t = true then () else error "is_num 1";
6.432 +val t = TermC.str2term "1";
6.433 +if TermC.is_num t = true then () else error "TermC.is_num 1";
6.434
6.435 -val t = str2term "-1";
6.436 -if is_num t = true then () else error "is_num -1";
6.437 +val t = TermC.str2term "-1";
6.438 +if TermC.is_num t = true then () else error "TermC.is_num -1";
6.439
6.440 -val t = str2term "a123";
6.441 -if is_num t = false then () else error "is_num a123";
6.442 +val t = TermC.str2term "a123";
6.443 +if TermC.is_num t = false then () else error "TermC.is_num a123";
6.444
6.445 -"----------- fun is_f_x ------------------------------------------------------------------------";
6.446 -"----------- fun is_f_x ------------------------------------------------------------------------";
6.447 -"----------- fun is_f_x ------------------------------------------------------------------------";
6.448 -val t = str2term "q_0/2 * L * x";
6.449 -if is_f_x t = false then () else error "is_f_x q_0/2 * L * x";
6.450 +"----------- fun TermC.is_f_x ------------------------------------------------------------------------";
6.451 +"----------- fun TermC.is_f_x ------------------------------------------------------------------------";
6.452 +"----------- fun TermC.is_f_x ------------------------------------------------------------------------";
6.453 +val t = TermC.str2term "q_0/2 * L * x";
6.454 +if TermC.is_f_x t = false then () else error "TermC.is_f_x q_0/2 * L * x";
6.455
6.456 -val t = str2term "M_b x";
6.457 -if is_f_x t = true then () else error "M_b x";
6.458 +val t = TermC.str2term "M_b x";
6.459 +if TermC.is_f_x t = true then () else error "M_b x";
6.460
6.461 "----------- fun list2isalist, fun isalist2list ------------------------------------------------";
6.462 "----------- fun list2isalist, fun isalist2list ------------------------------------------------";
6.463 "----------- fun list2isalist, fun isalist2list ------------------------------------------------";
6.464 -val t = str2term "R=(R::real)";
6.465 +val t = TermC.str2term "R=(R::real)";
6.466 val T = type_of t;
6.467 -val ss = list2isalist T [t,t,t];
6.468 +val ss = TermC.list2isalist T [t,t,t];
6.469 if UnparseC.term ss = "[R = R, R = R, R = R]" then () else error "list2isalist 1";
6.470
6.471 -val t = str2term "[a=b,c=d,e=f]";
6.472 -val il = isalist2list t;
6.473 +val t = TermC.str2term "[a=b,c=d,e=f]";
6.474 +val il = TermC.isalist2list t;
6.475 if UnparseC.terms il = "[\"a = b\", \"c = d\", \"e = f\"]" then () else error "isalist2list 2";
6.476
6.477 -val t = str2term "[a=b,c=d,e=f]";
6.478 -val il = isalist2list t;
6.479 +val t = TermC.str2term "[a=b,c=d,e=f]";
6.480 +val il = TermC.isalist2list t;
6.481 if UnparseC.terms il = "[\"a = b\", \"c = d\", \"e = f\"]" then () else error "isalist2list 3";
6.482
6.483 -val t = str2term "ss___s::bool list";
6.484 -(isalist2list t; error "isalist2list 1") handle TERM ("isalist2list applied to NON-list: ", _) =>();
6.485 +val t = TermC.str2term "ss___s::bool list";
6.486 +(TermC.isalist2list t; error "isalist2list 1") handle TERM ("isalist2list applied to NON-list: ", _) =>();
6.487
6.488 -"----------- fun strip_imp_prems', fun ins_concl -----------------------------------------------";
6.489 -"----------- fun strip_imp_prems', fun ins_concl -----------------------------------------------";
6.490 -"----------- fun strip_imp_prems', fun ins_concl -----------------------------------------------";
6.491 +"----------- fun TermC.strip_imp_prems', fun TermC.ins_concl -----------------------------------------------";
6.492 +"----------- fun TermC.strip_imp_prems', fun TermC.ins_concl -----------------------------------------------";
6.493 +"----------- fun TermC.strip_imp_prems', fun TermC.ins_concl -----------------------------------------------";
6.494 val prop = Thm.prop_of @{thm real_mult_div_cancel2};
6.495 UnparseC.term prop = "?k \<noteq> 0 \<Longrightarrow> ?m * ?k / (?n * ?k) = ?m / ?n";
6.496 val t as Const ("Pure.imp", _) $
6.497 @@ -657,47 +657,47 @@
6.498 (Const ("Rings.divide_class.divide", _) $ (Const ("Groups.times_class.times", _) $ Var (("m", 0), _) $ Var (("k", 0), _)) $
6.499 (Const ("Groups.times_class.times", _) $ Var (("n", 0), _) $ Var (("k", 0), _))) $
6.500 (Const ("Rings.divide_class.divide", _) $ Var (("m", 0), _) $ Var (("n", 0), _)))) = prop;
6.501 -val SOME t' = strip_imp_prems' t;
6.502 -if UnparseC.term t' = "(\<Longrightarrow>) (?k \<noteq> 0)" then () else error "strip_imp_prems' changed";
6.503 +val SOME t' = TermC.strip_imp_prems' t;
6.504 +if UnparseC.term t' = "(\<Longrightarrow>) (?k \<noteq> 0)" then () else error "TermC.strip_imp_prems' changed";
6.505
6.506 val thm = ThmC.numerals_to_Free @{thm frac_sym_conv};
6.507 val prop = Thm.prop_of thm;
6.508 val concl = Logic.strip_imp_concl prop;
6.509 -val SOME prems = strip_imp_prems' prop;
6.510 -val prop' = ins_concl prems concl;
6.511 -if prop = prop' then () else error "ins_concl o strip_imp_concl";
6.512 +val SOME prems = TermC.strip_imp_prems' prop;
6.513 +val prop' = TermC.ins_concl prems concl;
6.514 +if prop = prop' then () else error "TermC.ins_concl o strip_imp_concl";
6.515
6.516 "----------- fun mk_factroot, fun mk_num_op_num, -----------------------------------------------";
6.517 "----------- fun mk_factroot, fun mk_num_op_num, -----------------------------------------------";
6.518 "----------- fun mk_factroot, fun mk_num_op_num, -----------------------------------------------";
6.519 -val T = (type_of o Thm.term_of o the) (parse thy "12::real");
6.520 -val t = mk_factroot "SqRoot.sqrt" T 2 3;
6.521 +val T = (type_of o Thm.term_of o the) (TermC.parse thy "12::real");
6.522 +val t = TermC.mk_factroot "SqRoot.sqrt" T 2 3;
6.523 if UnparseC.term t = "2 * ??.SqRoot.sqrt 3" then () else error "mk_factroot";
6.524
6.525 -val t = str2term "aaa + bbb";
6.526 +val t = TermC.str2term "aaa + bbb";
6.527 val op_ as Const ("Groups.plus_class.plus", Top) $ Free ("aaa", T1) $ Free ("bbb", T2) = t;
6.528 -val t' = mk_num_op_num T1 T2 ("Groups.plus_class.plus", Top) 2 3;
6.529 +val t' = TermC.mk_num_op_num T1 T2 ("Groups.plus_class.plus", Top) 2 3;
6.530 if UnparseC.term t' = "2 + 3" then () else error "mk_num_op_num";
6.531
6.532 -"----------- fun dest_binop_typ ----------------------------------------------------------------";
6.533 -"----------- fun dest_binop_typ ----------------------------------------------------------------";
6.534 -"----------- fun dest_binop_typ ----------------------------------------------------------------";
6.535 -val t = (Thm.term_of o the o (parse thy)) "3 ^ 4";
6.536 +"----------- fun TermC.dest_binop_typ ----------------------------------------------------------------";
6.537 +"----------- fun TermC.dest_binop_typ ----------------------------------------------------------------";
6.538 +"----------- fun TermC.dest_binop_typ ----------------------------------------------------------------";
6.539 +val t = (Thm.term_of o the o (TermC.parse thy)) "3 ^ 4";
6.540 val hT = type_of (head_of t);
6.541 -if (HOLogic.realT, HOLogic.natT, HOLogic.realT) = dest_binop_typ hT
6.542 -then () else error "dest_binop_typ";
6.543 +if (HOLogic.realT, HOLogic.natT, HOLogic.realT) = TermC.dest_binop_typ hT
6.544 +then () else error "TermC.dest_binop_typ";
6.545
6.546 -"----------- fun is_list -----------------------------------------------------------------------";
6.547 -"----------- fun is_list -----------------------------------------------------------------------";
6.548 -"----------- fun is_list -----------------------------------------------------------------------";
6.549 -val (SOME ct) = parse thy "lll::real list";
6.550 -val t = str2term "lll::real list";
6.551 +"----------- fun TermC.is_list -----------------------------------------------------------------------";
6.552 +"----------- fun TermC.is_list -----------------------------------------------------------------------";
6.553 +"----------- fun TermC.is_list -----------------------------------------------------------------------";
6.554 +val (SOME ct) = TermC.parse thy "lll::real list";
6.555 +val t = TermC.str2term "lll::real list";
6.556 val ty = (Term.type_of o Thm.term_of) ct;
6.557 -if is_list t = false then () else error "is_list lll::real list";
6.558 +if TermC.is_list t = false then () else error "TermC.is_list lll::real list";
6.559
6.560 -val t = str2term "[a, b, c]";
6.561 +val t = TermC.str2term "[a, b, c]";
6.562 val ty = (Term.type_of o Thm.term_of) ct;
6.563 -if is_list t = true then () else error "is_list [a, b, c]";
6.564 +if TermC.is_list t = true then () else error "TermC.is_list [a, b, c]";
6.565
6.566 "----------- fun ThmC_Def.num_to_Free -------------------------------------------------------------";
6.567 "----------- fun ThmC_Def.num_to_Free -------------------------------------------------------------";
7.1 --- a/test/Tools/isac/BridgeJEdit/parseC.sml Mon Apr 19 13:57:47 2021 +0200
7.2 +++ b/test/Tools/isac/BridgeJEdit/parseC.sml Mon Apr 19 15:02:11 2021 +0200
7.3 @@ -78,7 +78,7 @@
7.4 val toks = ParseC.tokenize problem_headline_str;
7.5 case ParseC.problem_headline toks of
7.6 ((((("(", "Biegelinie"), ","), ["Biegelinien"]), ")"), [])
7.7 - => () | _ => error "parse problem_headline CHANGED"
7.8 + => () | _ => error "TermC.parse problem_headline CHANGED"
7.9
7.10
7.11 "----------- Model-items -----------------------------------------------------------------------";
7.12 @@ -99,18 +99,18 @@
7.13 val given_comma = Parse.command_name "Given" -- Parse.$$$ ":" -- Parse.list1 Parse.term;
7.14 val given = Parse.command_name "Given" -- Parse.$$$ ":" -- Parse.list1 Parse.term;
7.15
7.16 -case ParseC.parse given_comma (ParseC.tokenize given_comma_str) of
7.17 +case ParseC.TermC.parse given_comma (ParseC.tokenize given_comma_str) of
7.18 ((("Given", ":"), [_(*"<markup>"*), _(*"<markup>"*)]),
7.19 []) => ()
7.20 (*^^^^--------------------------------- is empty: parsing OK*)
7.21 -| _ => error "parse given_comma CHANGED";
7.22 +| _ => error "TermC.parse given_comma CHANGED";
7.23
7.24 "----------- Parse.list1 DOES expect <,> between elements";
7.25 -case ParseC.parse given (ParseC.tokenize given_str) of
7.26 +case ParseC.TermC.parse given (ParseC.tokenize given_str) of
7.27 ((("Given", ":"), [_(*"<markup>"*)]),
7.28 [_(*Token (("Streckenlast q_0", ({}, {})), (String, "Streckenlast q_0"), Slot)*)]) => ()
7.29 (*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ is NOT empty: parsing NOT ok*)
7.30 -| _ => error "parse given CHANGED";
7.31 +| _ => error "TermC.parse given CHANGED";
7.32
7.33
7.34 "----------- Model -----------------------------------------------------------------------------";
7.35 @@ -142,36 +142,36 @@
7.36 );
7.37
7.38 val toks = ParseC.tokenize model_str;
7.39 -case ParseC.parse ParseC.model toks of
7.40 +case ParseC.TermC.parse ParseC.model toks of
7.41 (((((((((((((((
7.42 "Model", (("", ""), "")), ":"),
7.43 "Given"), ":"), [_(*"<markup>"*), _(*"<markup>"*)]),
7.44 "Where"), ":"), [_(*"<markup>"*), _(*"<markup>"*)]),
7.45 "Find"), ":"), _(*"<markup>"*)),
7.46 "Relate"), ":"), [_(*"<markup>"*)]), [])
7.47 -=> () | _ => error "parse model CHANGED";
7.48 +=> () | _ => error "TermC.parse model CHANGED";
7.49
7.50 "----------- Model before student's input";
7.51 val toks = ParseC.tokenize model_empty_str;
7.52 -case ParseC.parse ParseC.model toks of
7.53 +case ParseC.TermC.parse ParseC.model toks of
7.54 (((((((((((((((
7.55 "Model", (("", ""), "")), ":"),
7.56 "Given"), ":"), [_(*"<markup>"*), _(*"<markup>"*)]),
7.57 "Where"), ":"), [_(*"<markup>"*) (*//, _(*"<markup>"*) //*)]),
7.58 "Find"), ":"), _(*"<markup>"*)),
7.59 "Relate"), ":"), [_(*"<markup>"*)]), [])
7.60 -=> () | _ => error "parse model_empty_str CHANGED";
7.61 +=> () | _ => error "TermC.parse model_empty_str CHANGED";
7.62
7.63 "----------- Model explicitly referring to RProblem (default), not RMethod";
7.64 val toks = ParseC.tokenize model_str_opt;
7.65 -case ParseC.parse ParseC.model toks of
7.66 +case ParseC.TermC.parse ParseC.model toks of
7.67 (((((((((((((((
7.68 "Model", (("(", "RProblem"), ")")), ":"),
7.69 "Given"), ":"), [_(*"<markup>"*), _(*"<markup>"*)]),
7.70 "Where"), ":"), [_(*"<markup>"*), _(*"<markup>"*)]),
7.71 "Find"), ":"), _(*"<markup>"*)),
7.72 "Relate"), ":"), [_(*"<markup>"*)]), [])
7.73 -=> () | _ => error "parse model_str_opt CHANGED";
7.74 +=> () | _ => error "TermC.parse model_str_opt CHANGED";
7.75
7.76
7.77 "----------- References ------------------------------------------------------------------------";
7.78 @@ -193,26 +193,26 @@
7.79 "RMethod: [\"\"]"
7.80 );
7.81
7.82 -case ParseC.parse ParseC.references (ParseC.tokenize references_collapsed_str) of
7.83 +case ParseC.TermC.parse ParseC.references (ParseC.tokenize references_collapsed_str) of
7.84 ((("References", ":"), (((((((("", ""), ""), ""), ""), []), ""), ""), [])), [])
7.85 - => () | _ => error "parse references_collapsed CHANGED";
7.86 + => () | _ => error "TermC.parse references_collapsed CHANGED";
7.87
7.88 -case ParseC.parse ParseC.references (ParseC.tokenize references_str) of (((
7.89 +case ParseC.TermC.parse ParseC.references (ParseC.tokenize references_str) of (((
7.90 "References", ":"),
7.91 ((((((((
7.92 "RTheory", ":"), "Biegelinie"),
7.93 "RProblem"), ":"), ["Biegelinien"]),
7.94 "RMethod"), ":"), ["Integrieren", "KonstanteBestimmen2"])),
7.95 [])
7.96 - => () | _ => error "parse references CHANGED";
7.97 + => () | _ => error "TermC.parse references CHANGED";
7.98
7.99 -case ParseC.parse ParseC.references (ParseC.tokenize references_empty_str) of (((
7.100 +case ParseC.TermC.parse ParseC.references (ParseC.tokenize references_empty_str) of (((
7.101 "References", ":"), ((((((((
7.102 "RTheory", ":"), ""),
7.103 "RProblem"), ":"), [""]),
7.104 "RMethod"), ":"), [""])),
7.105 [])
7.106 - => () | _ => error "parse references_empty_str CHANGED"
7.107 + => () | _ => error "TermC.parse references_empty_str CHANGED"
7.108
7.109
7.110 "----------- Specification: References + Model -------------------------------------------------";
7.111 @@ -250,15 +250,15 @@
7.112 "RProblem"), ":"), ["Biegelinien"]),
7.113 "RMethod"), ":"), ["Integrieren", "KonstanteBestimmen2"])))),
7.114 [])
7.115 - => () | _ => error "parse specification (expanded) changed";
7.116 + => () | _ => error "TermC.parse specification (expanded) changed";
7.117
7.118 "----------- Specification collapsed";
7.119 -case ParseC.parse ParseC.specification (ParseC.tokenize specification_collapsed_str) of (((
7.120 +case ParseC.TermC.parse ParseC.specification (ParseC.tokenize specification_collapsed_str) of (((
7.121 "Specification", ":"),
7.122 (*model*)((((((((((((((("", (("", ""), "")), ""), ""), ""), []), ""), ""), []), ""), ""), ""), ""), ""), []), (("", ""),
7.123 (*refs?*)(((((((("", ""), ""), ""), ""), []), ""), ""), [])))),
7.124 [])
7.125 - => () | _ => error "parse specification (collapsed) changed";
7.126 + => () | _ => error "TermC.parse specification (collapsed) changed";
7.127
7.128
7.129 "----------- Tactics ---------------------------------------------------------------------------";
7.130 @@ -274,29 +274,29 @@
7.131
7.132 val toks1 = ParseC.tokenize "Substitute \"c_4 + c_3 * x + 1 / (-1 * EI)\" \"[c, c_1, c_2, c_4]\"";
7.133 case ParseC.substitute toks1 of ((("Substitute", _(*<markup>*)), _(*<markup>*)), [])
7.134 -=> () | _ => error "parse Substitute CHANGED";
7.135 +=> () | _ => error "TermC.parse Substitute CHANGED";
7.136
7.137 val toks2 = ParseC.tokenize "Rewrite_Set_Inst \"[(bdv, x)]\" \"make_ratpoly_in\"";
7.138 case ParseC.rewrite_set_inst toks2 of
7.139 ((("Rewrite_Set_Inst", _(*<markup>*)), "make_ratpoly_in"), [])
7.140 -=> () | _ => error "parse Rewrite_Set_Inst CHANGED";
7.141 +=> () | _ => error "TermC.parse Rewrite_Set_Inst CHANGED";
7.142
7.143 val toks3 = ParseC.tokenize "Check_Postcond [\"Biegelinien\", \"xxx\"]";
7.144 case ParseC.check_postcond toks3 of (("Check_Postcond", ["Biegelinien", "xxx"]), [])
7.145 -=> () | _ => error "parse Check_Postcond CHANGED";
7.146 +=> () | _ => error "TermC.parse Check_Postcond CHANGED";
7.147
7.148 "----------- Tactics collected";
7.149 val toks1' = ParseC.tokenize tactic_Substitute_str;
7.150 val toks2' = ParseC.tokenize tactic_Rewrite_Set_Inst_str;
7.151 val toks3' = ParseC.tokenize tactic_Check_Postcond_str;
7.152
7.153 -ParseC.parse ParseC.tactic toks1'; (* = (("Tactic", "EXEC IMMEDIATELY: Substitute <markup> <markup>"), [])*)
7.154 -ParseC.parse ParseC.tactic toks2'; (* = (("Tactic", "EXEC IMMEDIATELY: Rewrite_Set_Inst <markup> make_ratpoly_in"), [])*)
7.155 -ParseC.parse ParseC.tactic toks3'; (* = (("Tactic", "EXEC IMMEDIATELY: Check_Postcond xxxBiegelinien"), [])*)
7.156 +ParseC.TermC.parse ParseC.tactic toks1'; (* = (("Tactic", "EXEC IMMEDIATELY: Substitute <markup> <markup>"), [])*)
7.157 +ParseC.TermC.parse ParseC.tactic toks2'; (* = (("Tactic", "EXEC IMMEDIATELY: Rewrite_Set_Inst <markup> make_ratpoly_in"), [])*)
7.158 +ParseC.TermC.parse ParseC.tactic toks3'; (* = (("Tactic", "EXEC IMMEDIATELY: Check_Postcond xxxBiegelinien"), [])*)
7.159
7.160 -case ParseC.parse ParseC.tactic (ParseC.tokenize tactic_Substitute_str) of
7.161 +case ParseC.TermC.parse ParseC.tactic (ParseC.tokenize tactic_Substitute_str) of
7.162 (("Tactic", _(*"EXEC IMMEDIATELY: Substitute <markup> <markup>"*)), [])
7.163 -=> () | _ => error "parse Tactic Substitute CHANGED";
7.164 +=> () | _ => error "TermC.parse Tactic Substitute CHANGED";
7.165
7.166
7.167 "----------- steps -----------------------------------------------------------------------------";
7.168 @@ -323,29 +323,29 @@
7.169 val toks3 = ParseC.tokenize steps_nonrec_str;
7.170
7.171 "----------- simple version";
7.172 -ParseC.parse ParseC.steps []; (* = ([], []): (string * (string * string)) list * Token.T list *)
7.173 -ParseC.parse ParseC.steps toks1; (* = ([("<markup>", ("", ""))], [])*)
7.174 -ParseC.parse ParseC.steps toks2; (* = ([("<markup>", ("Tactic", "EXEC IMMEDIATELY: Check_Postcond Biegelinien"))], [])*)
7.175 -ParseC.parse ParseC.steps toks3;
7.176 +ParseC.TermC.parse ParseC.steps []; (* = ([], []): (string * (string * string)) list * Token.T list *)
7.177 +ParseC.TermC.parse ParseC.steps toks1; (* = ([("<markup>", ("", ""))], [])*)
7.178 +ParseC.TermC.parse ParseC.steps toks2; (* = ([("<markup>", ("Tactic", "EXEC IMMEDIATELY: Check_Postcond Biegelinien"))], [])*)
7.179 +ParseC.TermC.parse ParseC.steps toks3;
7.180
7.181 -case ParseC.parse ParseC.steps toks3 of
7.182 +case ParseC.TermC.parse ParseC.steps toks3 of
7.183 ([(_(*"<markup>"*), ("", "")),
7.184 (_(*"<markup>"*), ("Tactic", _(*"EXEC IMMEDIATELY: Substitute <markup> <markup>"*))),
7.185 (_(*"<markup>"*), ("Tactic", _(*"EXEC IMMEDIATELY: Rewrite_Set_Inst <markup> make_ratpoly_in"*))),
7.186 (_(*"<markup>"*), ("Tactic", _(*"EXEC IMMEDIATELY: Check_Postcond Biegelinien"*))),
7.187 (_(*"<markup>"*), ("", ""))],
7.188 [])
7.189 -=> () | _ => error "parse steps, simple version, CHANGED";
7.190 +=> () | _ => error "TermC.parse steps, simple version, CHANGED";
7.191
7.192 "----------- version preparing subproblems";
7.193 -case ParseC.parse ParseC.steps_subpbl toks3 of
7.194 +case ParseC.TermC.parse ParseC.steps_subpbl toks3 of
7.195 ([_(*"EXEC IMMEDIATELY step_term: <markup> (, )"*),
7.196 _(*"EXEC IMMEDIATELY step_term: <markup> (Tactic, EXEC IMMEDIATELY: Substitute <markup> <markup>)"*),
7.197 _(*"EXEC IMMEDIATELY step_term: <markup> (Tactic, EXEC IMMEDIATELY: Rewrite_Set_Inst <markup> make_ratpoly_in)"*),
7.198 _(*"EXEC IMMEDIATELY step_term: <markup> (Tactic, EXEC IMMEDIATELY: Check_Postcond xxxBiegelinien)"*),
7.199 _(*"EXEC IMMEDIATELY step_term: <markup> (, )"*)],
7.200 [])
7.201 -=> () | _ => error "parse steps, with exec_step_term, CHANGED";
7.202 +=> () | _ => error "TermC.parse steps, with exec_step_term, CHANGED";
7.203
7.204
7.205 "----------- body ------------------------------------------------------------------------------";
7.206 @@ -357,7 +357,7 @@
7.207 );
7.208 val body_str = specification_str ^ solution_str;
7.209
7.210 -case ParseC.parse ParseC.body (ParseC.tokenize body_str) of ((((((
7.211 +case ParseC.TermC.parse ParseC.body (ParseC.tokenize body_str) of ((((((
7.212 "Specification", ":"), (((((((((((((((
7.213 "Model", (("", ""), "")), ":"),
7.214 "Given"), ":"), [_(*"<markup>"*), _(*"<markup>"*)]),
7.215 @@ -375,7 +375,7 @@
7.216 _(*"EXEC IMMEDIATELY step_term: <markup> (Tactic, EXEC IMMEDIATELY: Check_Postcond xxxBiegelinien)"*),
7.217 _(*"EXEC IMMEDIATELY step_term: <markup> (, )"*)]),
7.218 [])
7.219 -=> () | _ => error "parse body CHANGED";
7.220 +=> () | _ => error "TermC.parse body CHANGED";
7.221
7.222
7.223 "----------- Problem ---------------------------------------------------------------------------";
7.224 @@ -384,7 +384,7 @@
7.225 "----------- whole Problem";
7.226 val toks = ParseC.tokenize (problem_headline_str ^ specification_str ^ solution_str);
7.227
7.228 -case ParseC.parse ParseC.problem toks of (((((((
7.229 +case ParseC.TermC.parse ParseC.problem toks of (((((((
7.230 "(", "Biegelinie"), ","), ["Biegelinien"]), ")"), (((((
7.231 "Specification", ":"), (((((((((((((((
7.232 "Model", (("", ""), "")), ":"),
7.233 @@ -404,7 +404,7 @@
7.234 _(*"EXEC IMMEDIATELY step_term: <markup> (, )"*)])),
7.235 ""),
7.236 [])
7.237 - => () | _ => error "parse problem (whole) CHANGED"
7.238 + => () | _ => error "TermC.parse problem (whole) CHANGED"
7.239
7.240 "----------- enter Specification";
7.241 val toks = ParseC.tokenize (
7.242 @@ -414,7 +414,7 @@
7.243 "References:" ^ (* <<<----- collapsed *)
7.244 "Solution:"
7.245 );
7.246 -case ParseC.parse ParseC.problem toks of (((((((
7.247 +case ParseC.TermC.parse ParseC.problem toks of (((((((
7.248 "(", "Biegelinie"), ","), ["Biegelinien"]), ")"), (((((
7.249 "Specification", ":"), (((((((((((((((
7.250 "Model", (("", ""), "")), ":"),
7.251 @@ -426,12 +426,12 @@
7.252 "Solution"), ":"), [])),
7.253 ""),
7.254 [])
7.255 -=> () | _ => error "parse enter Specification CHANGED"
7.256 +=> () | _ => error "TermC.parse enter Specification CHANGED"
7.257
7.258 "----------- Problem-headline only";
7.259 val toks = ParseC.tokenize problem_headline_str;
7.260
7.261 -case ParseC.parse ParseC.problem toks of (((((((
7.262 +case ParseC.TermC.parse ParseC.problem toks of (((((((
7.263 "(", "Biegelinie"), ","), ["Biegelinien"]), ")"), (((((
7.264 "", ""), (((((((((((((((
7.265 "", (("", ""), "")), ""),
7.266 @@ -443,7 +443,7 @@
7.267 ""), ""), [])),
7.268 ""),
7.269 [])
7.270 -=> () | _ => error "parse BEFORE enter Specification CHANGED"
7.271 +=> () | _ => error "TermC.parse BEFORE enter Specification CHANGED"
7.272
7.273 "----------- finish Specification";
7.274 val toks = ParseC.tokenize (
7.275 @@ -453,7 +453,7 @@
7.276 references_str ^
7.277 "Solution:"
7.278 );
7.279 -case ParseC.parse ParseC.problem toks of ( ((((((
7.280 +case ParseC.TermC.parse ParseC.problem toks of ( ((((((
7.281 "(", "Biegelinie"), ","), ["Biegelinien"]), ")"), (((((
7.282 "Specification", ":"), (((((((((((((((
7.283 "Model", (("", ""), "")), ":"),
7.284 @@ -469,10 +469,10 @@
7.285 [])),
7.286 ""),
7.287 [])
7.288 -=> () | _ => error "parse finish specification CHANGED"
7.289 +=> () | _ => error "TermC.parse finish specification CHANGED"
7.290
7.291 "----------- Specification collapsed";
7.292 -case ParseC.parse ParseC.problem (ParseC.tokenize problem_headline_str) of (((((((
7.293 +case ParseC.TermC.parse ParseC.problem (ParseC.tokenize problem_headline_str) of (((((((
7.294 "(", "Biegelinie"), ","), ["Biegelinien"]), ")"), (((((
7.295 (*Specification*)"", ""), (((((((((((((((
7.296 (*Model*)"", (("", ""), "")), ""), ""), ""), []), ""), ""), []), ""), ""), ""), ""), ""), []), (("", ""), ((((((((
7.297 @@ -481,11 +481,11 @@
7.298 [])),
7.299 ""),
7.300 [])
7.301 -=> () | _ => error "parse Specification collapsed CHANGED"
7.302 +=> () | _ => error "TermC.parse Specification collapsed CHANGED"
7.303
7.304 "----------- Problem with final_result, all collapsed";
7.305 val toks = ParseC.tokenize (problem_headline_str ^ final_result_str);
7.306 -case ParseC.parse ParseC.problem toks of (((((((
7.307 +case ParseC.TermC.parse ParseC.problem toks of (((((((
7.308 "(", "Biegelinie"), ","), ["Biegelinien"]), ")"), (((((
7.309 (*Specification*)"", ""), (((((((((((((((
7.310 (*Model*)"", (("", ""), "")), ""), ""), ""), []), ""), ""), []), ""), ""), ""), ""), ""), []), (("", ""), ((((((((
7.311 @@ -494,7 +494,7 @@
7.312 [])),
7.313 _(*"<markup>"*)),
7.314 [])
7.315 -=> () | _ => error "parse Problem with final_result, all collapsed CHANGED"
7.316 +=> () | _ => error "TermC.parse Problem with final_result, all collapsed CHANGED"
7.317
7.318
7.319 "----------- fun read_out_problem --------------------------------------------------------------";
7.320 @@ -507,7 +507,7 @@
7.321 references_str ^
7.322 "Solution:"
7.323 );
7.324 -case ParseC.parse ParseC.problem toks |> fst |> ParseC.read_out_problem of
7.325 +case ParseC.TermC.parse ParseC.problem toks |> fst |> ParseC.read_out_problem of
7.326 {thy_id = "Biegelinie", pbl_id = ["Biegelinien"],
7.327 givens = [_(*"<markup>"*), _(*"<markup>"*)], wheres = [_(*"<markup>"*), _(*"<markup>"*)],
7.328 find = _(*"<markup>"*), relates = [_(*"<markup>"*)],
7.329 @@ -552,7 +552,7 @@
7.330 ")");
7.331
7.332 val toks = ParseC.tokenize form_single_str;
7.333 -case ParseC.parse form_single toks of (((((((((((
7.334 +case ParseC.TermC.parse form_single toks of (((((((((((
7.335 "(",
7.336 ["Traegerlaenge L", "Streckenlast q_0", "Biegelinie y",
7.337 "Randbedingungen [y 0 = (0::real), y L = 0, M_b 0 = 0, M_b L = 0]", "FunktionsVariable x",
7.338 @@ -561,7 +561,7 @@
7.339 "("), "Biegelinie"), ","), ["Biegelinien"]), ","), ["IntegrierenUndKonstanteBestimmen2"]), ")"),
7.340 ")"),
7.341 [])
7.342 -=> () | _ => error "parse form_single toks CHANGED";
7.343 +=> () | _ => error "TermC.parse form_single toks CHANGED";
7.344
7.345 (* Isac always takes a singleton here *)
7.346 val formalise = (Parse.$$$ "[" |-- Parse.list1 form_single --| Parse.$$$ "]");
7.347 @@ -571,7 +571,7 @@
7.348 formalise: formalise parser;
7.349
7.350 val toks = ParseC.tokenize ("[" ^ form_single_str ^ "]");
7.351 -case ParseC.parse formalise (ParseC.tokenize ("[" ^ form_single_str ^ "]")) of ([((((((((((
7.352 +case ParseC.TermC.parse formalise (ParseC.tokenize ("[" ^ form_single_str ^ "]")) of ([((((((((((
7.353 "(",
7.354 ["Traegerlaenge L", "Streckenlast q_0", "Biegelinie y",
7.355 "Randbedingungen [y 0 = (0::real), y L = 0, M_b 0 = 0, M_b L = 0]", "FunktionsVariable x",
7.356 @@ -580,5 +580,5 @@
7.357 "("), "Biegelinie"), ","), ["Biegelinien"]), ","), ["IntegrierenUndKonstanteBestimmen2"]), ")"),
7.358 ")")],
7.359 [])
7.360 -=> () | _ => error "parse formalise CHANGED";
7.361 +=> () | _ => error "TermC.parse formalise CHANGED";
7.362
8.1 --- a/test/Tools/isac/BridgeLibisabelle/mathml.sml Mon Apr 19 13:57:47 2021 +0200
8.2 +++ b/test/Tools/isac/BridgeLibisabelle/mathml.sml Mon Apr 19 15:02:11 2021 +0200
8.3 @@ -42,24 +42,24 @@
8.4
8.5 (*========== inhibit exn AK110725 ================================================
8.6 "----- check 'manually' the xml-output of calling functions ------";
8.7 -formula2xml 1 (str2term str);
8.8 +formula2xml 1 (TermC.str2term str);
8.9
8.10 (* AK110725
8.11 -(*str2term str; (* ERROR: Inner syntax error at "; 0 < ?n |] ==> ?a / ?b ^ ?n = ?a * ?b ^ - ?n"
8.12 - Failed to parse term*)*)
8.13 -"~~~~~ fun str2term, args:"; val (str) = (str);
8.14 +(*TermC.str2term str; (* ERROR: Inner syntax error at "; 0 < ?n |] ==> ?a / ?b ^ ?n = ?a * ?b ^ - ?n"
8.15 + Failed to TermC.parse term*)*)
8.16 +"~~~~~ fun TermC.str2term, args:"; val (str) = (str);
8.17 ThyC.get_theory "Isac_Knowledge";
8.18
8.19 -parse_patt;
8.20 -parse_patt (ThyC.get_theory "Isac_Knowledge");
8.21 -(*parse_patt (ThyC.get_theory "Isac_Knowledge") str; (* ERROR: Inner syntax error at "; 0 < ?n |] ==> ?a / ?b ^ ?n = ?a * ?b ^ - ?n"
8.22 -Failed to parse term*)*)
8.23 +TermC.parse_patt;
8.24 +TermC.parse_patt (ThyC.get_theory "Isac_Knowledge");
8.25 +(*TermC.parse_patt (ThyC.get_theory "Isac_Knowledge") str; (* ERROR: Inner syntax error at "; 0 < ?n |] ==> ?a / ?b ^ ?n = ?a * ?b ^ - ?n"
8.26 +Failed to TermC.parse term*)*)
8.27
8.28 -"~~~~~ fun parse_patt, args:"; val (thy, str) = ((ThyC.get_theory "Isac_Knowledge"), str);
8.29 +"~~~~~ fun TermC.parse_patt, args:"; val (thy, str) = ((ThyC.get_theory "Isac_Knowledge"), str);
8.30 (thy, str)
8.31 |>> ThyC.to_ctxt
8.32 (*|-> Proof_Context.read_term_pattern (*ERROR: Inner syntax error at "; 0 < ?n |] ==> ?a / ?b ^ ?n = ?a * ?b ^ - ?n"
8.33 -Failed to parse term*)*)
8.34 +Failed to TermC.parse term*)*)
8.35
8.36 Proof_Context.read_term_pattern;
8.37 (@{theory "Isac_Knowledge"}, str) |>> ThyC.to_ctxt;
9.1 --- a/test/Tools/isac/BridgeLibisabelle/pbl-met-hierarchy.sml Mon Apr 19 13:57:47 2021 +0200
9.2 +++ b/test/Tools/isac/BridgeLibisabelle/pbl-met-hierarchy.sml Mon Apr 19 15:02:11 2021 +0200
9.3 @@ -106,9 +106,9 @@
9.4 val str = ("Problem (" ^
9.5 (get_thy o theory2domID) thy ^ ", " ^
9.6 (strs2str' o rev) pblRD ^ ")");
9.7 - str2term str;
9.8 - str2term "Biegelinie";
9.9 - str2term "Biegelinien";
9.10 + TermC.str2term str;
9.11 + TermC.str2term "Biegelinie";
9.12 + TermC.str2term "Biegelinien";
9.13 *)
9.14 (*Const
9.15 ("Biegelinie.Biegelinie",
9.16 @@ -156,11 +156,11 @@
9.17
9.18 val errpatstest =
9.19 [("chain-rule-diff-both",
9.20 - [parse_patt @{theory} "d_d ?bdv (sin ?u) = cos (d_d ?bdv ?u)",
9.21 - parse_patt @{theory} "d_d ?bdv (cos ?u) = - sin (d_d ?bdv ?u)",
9.22 - parse_patt @{theory} "d_d ?bdv (?u ^^^ ?n) = ?n * ?u ^^^ (?n - 1)",
9.23 - parse_patt @{theory} "d_d ?bdv (LogExp.ln ?u) = 1 / ?u",
9.24 - parse_patt @{theory} "d_d ?bdv (LogExp.ln ?u) = 1 / d_d ?bdv ?u"],
9.25 + [TermC.parse_patt @{theory} "d_d ?bdv (sin ?u) = cos (d_d ?bdv ?u)",
9.26 + TermC.parse_patt @{theory} "d_d ?bdv (cos ?u) = - sin (d_d ?bdv ?u)",
9.27 + TermC.parse_patt @{theory} "d_d ?bdv (?u ^^^ ?n) = ?n * ?u ^^^ (?n - 1)",
9.28 + TermC.parse_patt @{theory} "d_d ?bdv (LogExp.ln ?u) = 1 / ?u",
9.29 + TermC.parse_patt @{theory} "d_d ?bdv (LogExp.ln ?u) = 1 / d_d ?bdv ?u"],
9.30 [@{thm diff_sin_chain}, @{thm diff_cos_chain}, @{thm diff_pow_chain},
9.31 @{thm diff_ln_chain}, @{thm diff_exp_chain}])];
9.32
10.1 --- a/test/Tools/isac/BridgeLibisabelle/use-cases.sml Mon Apr 19 13:57:47 2021 +0200
10.2 +++ b/test/Tools/isac/BridgeLibisabelle/use-cases.sml Mon Apr 19 15:02:11 2021 +0200
10.3 @@ -795,7 +795,7 @@
10.4 initContext 1 Ptool.Pbl_ ([],Pbl);
10.5 (* this would break if a calculation would be inserted before: CALCID...
10.6 and pattern matching is not available in *.java.
10.7 -if cut_xml xml = "(CONTEXTPBL)\n. (CALCID)\n. . 1\n. (/CALCID)\n. (CONTEXTDATA)\n. . (GUH)\n. . . pbl_equ_univ\n. . (/GUH)\n. . (STATUS)\n. . . correct\n. . (/STATUS)\n. . (HEAD)\n. . . (MATHML)\n. . . . (ISA)\n. . . . . solve (x ^ 2 + 4 * x + 5 = 2, x)\n. . . . (/ISA)\n. . . (/MATHML)\n. . (/HEAD)\n. . (MODEL)\n. . . (GIVEN)\n. . . . (ITEM status=correct)\n. . . . . (MATHML)\n. . . . . . (ISA)\n. . . . . . . equality (x ^ 2 + 4 * x + 5 = 2)\n. . . . . . (/ISA)\n. . . . . (/MATHML)\n. . . . (/ITEM)\n. . . . (ITEM status=correct)\n. . . . . (MATHML)\n. . . . . . (ISA)\n. . . . . . . solveFor x\n. . . . . . (/ISA)\n. . . . . (/MATHML)\n. . . . (/ITEM)\n. . . (/GIVEN)\n. . . (WHERE)\n. . . . (ITEM status=correct)\n. . . . . (MATHML)\n. . . . . . (ISA)\n. . . . . . . matches (?a = ?b) (x ^ 2 + 4 * x + 5 = 2)\n. . . . . . (/ISA)\n. . . . . (/MATHML)\n. . . . (/ITEM)\n. . . (/WHERE)\n. . . (FIND)\n. . . . (ITEM status=correct)\n. . . . . (MATHML)\n. . . . . . (ISA)\n. . . . . . . solutions L\n. . . . . . (/ISA)\n. . . . . (/MATHML)\n. . . . (/ITEM)\n. . . (/FI"
10.8 +if cut_xml xml = "(CONTEXTPBL)\n. (CALCID)\n. . 1\n. (/CALCID)\n. (CONTEXTDATA)\n. . (GUH)\n. . . pbl_equ_univ\n. . (/GUH)\n. . (STATUS)\n. . . correct\n. . (/STATUS)\n. . (HEAD)\n. . . (MATHML)\n. . . . (ISA)\n. . . . . solve (x ^ 2 + 4 * x + 5 = 2, x)\n. . . . (/ISA)\n. . . (/MATHML)\n. . (/HEAD)\n. . (MODEL)\n. . . (GIVEN)\n. . . . (ITEM status=correct)\n. . . . . (MATHML)\n. . . . . . (ISA)\n. . . . . . . equality (x ^ 2 + 4 * x + 5 = 2)\n. . . . . . (/ISA)\n. . . . . (/MATHML)\n. . . . (/ITEM)\n. . . . (ITEM status=correct)\n. . . . . (MATHML)\n. . . . . . (ISA)\n. . . . . . . solveFor x\n. . . . . . (/ISA)\n. . . . . (/MATHML)\n. . . . (/ITEM)\n. . . (/GIVEN)\n. . . (WHERE)\n. . . . (ITEM status=correct)\n. . . . . (MATHML)\n. . . . . . (ISA)\n. . . . . . . TermC.matches (?a = ?b) (x ^ 2 + 4 * x + 5 = 2)\n. . . . . . (/ISA)\n. . . . . (/MATHML)\n. . . . (/ITEM)\n. . . (/WHERE)\n. . . (FIND)\n. . . . (ITEM status=correct)\n. . . . . (MATHML)\n. . . . . . (ISA)\n. . . . . . . solutions L\n. . . . . . (/ISA)\n. . . . . (/MATHML)\n. . . . (/ITEM)\n. . . (/FI"
10.9 then () else error "--- tryMatchProblem, tryRefineProblem: initContext 1 Ptool.Pbl_ ([],Pbl); CHANGED";
10.10 *)
10.11 initContext 1 Ptool.Met_ ([],Pbl);
11.1 --- a/test/Tools/isac/Interpret/error-pattern.sml Mon Apr 19 13:57:47 2021 +0200
11.2 +++ b/test/Tools/isac/Interpret/error-pattern.sml Mon Apr 19 15:02:11 2021 +0200
11.3 @@ -119,13 +119,13 @@
11.4 val fod = Derive.do_one (@{theory "Isac_Knowledge"}) Atools_erls
11.5 ((#rules o Rule_Set.rep) Test_simplify)
11.6 (sqrt_right false (@{theory "Pure"})) NONE
11.7 - (str2term "x + 1 + -1 * 2 = 0");
11.8 + (TermC.str2term "x + 1 + -1 * 2 = 0");
11.9 (writeln o Derive.trtas2str) fod;
11.10
11.11 val ifod = Derive.do_one (@{theory "Isac_Knowledge"}) Atools_erls
11.12 ((#rules o Rule_Set.rep) Test_simplify)
11.13 (sqrt_right false (@{theory "Pure"})) NONE
11.14 - (str2term "-2 * 1 + (1 + x) = 0");
11.15 + (TermC.str2term "-2 * 1 + (1 + x) = 0");
11.16 (writeln o Derive.trtas2str) ifod;
11.17 fun equal (_,_,(t1, _)) (_,_,(t2, _)) = t1 = t2;
11.18 val (fod', rifod') = dropwhile' equal (rev fod) (rev ifod);
11.19 @@ -637,11 +637,11 @@
11.20 "--------- Take as 1st tac, start with <NEW> (CAS input) ---------";
11.21 "--------- Take as 1st tac, start with <NEW> (CAS input) ---------";
11.22 "--------- Take as 1st tac, start with <NEW> (CAS input) ---------";
11.23 -val t = str2term "Diff (x^^^2 + x + 1, x)";
11.24 +val t = TermC.str2term "Diff (x^^^2 + x + 1, x)";
11.25 case t of Const ("Diff.Diff", _) $ _ => ()
11.26 | _ => raise
11.27 error "diff.sml behav.changed for CAS Diff (..., x)";
11.28 -atomty t;
11.29 +TermC.atomty t;
11.30 "-----------------------------------------------------------------";
11.31 (*1>*)reset_states ();
11.32 (*2>*)CalcTree [([], ("empty_thy_id", ["empty_probl_id"], ["empty_meth_id"]))];
11.33 @@ -901,13 +901,13 @@
11.34 "--------- build fun check_for' ------------------------------";
11.35 "--------- build fun check_for' ------------------------------";
11.36 "--------- build fun check_for' ------------------------------";
11.37 -val subst = [(str2term "bdv", str2term "x")]: subst;
11.38 +val subst = [(TermC.str2term "bdv", TermC.str2term "x")]: subst;
11.39 val rls = norm_Rational
11.40 -val pat = parse_patt @{theory} "(?a + ?b)/(?b + ?c) = ?a / ?c";
11.41 -val (res, inf) = (str2term "(2 + 3)/(3 + 4)", str2term "2 / 4");
11.42 -val (res, inf) = (str2term "(2 + 3)/(3 + 4)", str2term "1 / 2");
11.43 +val pat = TermC.parse_patt @{theory} "(?a + ?b)/(?b + ?c) = ?a / ?c";
11.44 +val (res, inf) = (TermC.str2term "(2 + 3)/(3 + 4)", TermC.str2term "2 / 4");
11.45 +val (res, inf) = (TermC.str2term "(2 + 3)/(3 + 4)", TermC.str2term "1 / 2");
11.46
11.47 -val (res', _, _, rewritten) = (*rewritten: the lhs of the pattern matches in res*)
11.48 +val (res', _, _, rewritten) = (*rewritten: the lhs of the pattern TermC.matches in res*)
11.49 rew_sub thy 1 [] e_rew_ord Rule_Set.empty false [] (HOLogic.Trueprop $ pat) res;
11.50 if rewritten then NONE else SOME "e_errpatID";
11.51
11.52 @@ -922,39 +922,39 @@
11.53 res' = inf;
11.54 norm_res = norm_inf;
11.55
11.56 -val pat = parse_patt @{theory} "(?a + ?b)/?a = ?b";
11.57 -val (res, inf) = (str2term "(2 + 3)/2", str2term "3");
11.58 +val pat = TermC.parse_patt @{theory} "(?a + ?b)/?a = ?b";
11.59 +val (res, inf) = (TermC.str2term "(2 + 3)/2", TermC.str2term "3");
11.60 if check_for' (res, inf) subst ("errpatID", pat) rls = SOME "errpatID"
11.61 then () else error "error patt example1 changed";
11.62
11.63 -val pat = parse_patt @{theory} "(?a + ?b)/(?a + ?c) = ?b / ?c";
11.64 -val (res, inf) = (str2term "(2 + 3)/(2 + 4)", str2term "3 / 4");
11.65 +val pat = TermC.parse_patt @{theory} "(?a + ?b)/(?a + ?c) = ?b / ?c";
11.66 +val (res, inf) = (TermC.str2term "(2 + 3)/(2 + 4)", TermC.str2term "3 / 4");
11.67 if check_for' (res, inf) subst ("errpatID", pat) rls = SOME "errpatID"
11.68 then () else error "error patt example2 changed";
11.69
11.70 -val pat = parse_patt @{theory} "(?a + ?b)/(?b + ?c) = ?a / ?c";
11.71 -val (res, inf) = (str2term "(2 + 3)/(3 + 4)", str2term "2 / 4");
11.72 +val pat = TermC.parse_patt @{theory} "(?a + ?b)/(?b + ?c) = ?a / ?c";
11.73 +val (res, inf) = (TermC.str2term "(2 + 3)/(3 + 4)", TermC.str2term "2 / 4");
11.74 if check_for' (res, inf) subst ("errpatID", pat) rls = SOME "errpatID"
11.75 then () else error "error patt example3 changed";
11.76
11.77 -val inf = str2term "1 / 2";
11.78 +val inf = TermC.str2term "1 / 2";
11.79 if check_for' (res, inf) subst ("errpatID", pat) rls = SOME "errpatID"
11.80 then () else error "error patt example3 changed";
11.81
11.82 "--------- build fun check_for' ?bdv -------------------------";
11.83 "--------- build fun check_for' ?bdv -------------------------";
11.84 "--------- build fun check_for' ?bdv -------------------------";
11.85 -val subst = [(str2term "bdv", str2term "x")]: subst;
11.86 -val t = str2term "d_d x (x ^^^ 2 + sin (x ^^^ 4))";
11.87 +val subst = [(TermC.str2term "bdv", TermC.str2term "x")]: subst;
11.88 +val t = TermC.str2term "d_d x (x ^^^ 2 + sin (x ^^^ 4))";
11.89 val SOME (t, _) = rewrite_set_inst_ thy false subst norm_diff t;
11.90 if UnparseC.term t = "2 * x + cos (x ^^^ 4) * 4 * x ^^^ 3" then ()
11.91 else error "build fun check_for' ?bdv changed 1";
11.92
11.93 val rls = norm_diff
11.94 -val pat = parse_patt @{theory} "d_d ?bdv (sin ?u) = cos (d_d ?bdv ?u)";
11.95 -val (res, inf) = (str2term "2 * x + d_d x (sin (x ^^^ 4))", str2term "2 * x + cos (4 * x ^^^ 3)");
11.96 +val pat = TermC.parse_patt @{theory} "d_d ?bdv (sin ?u) = cos (d_d ?bdv ?u)";
11.97 +val (res, inf) = (TermC.str2term "2 * x + d_d x (sin (x ^^^ 4))", TermC.str2term "2 * x + cos (4 * x ^^^ 3)");
11.98
11.99 -val (res', _, _, rewritten) = (*rewritten: the lhs of the pattern matches in res*)
11.100 +val (res', _, _, rewritten) = (*rewritten: the lhs of the pattern TermC.matches in res*)
11.101 rew_sub thy 1 subst e_rew_ord Rule_Set.empty false [] (HOLogic.Trueprop $ pat) res;
11.102 if UnparseC.term res' = "2 * x + cos (d_d x (x ^^^ 4))" andalso rewritten then ()
11.103 else error "build fun check_for' ?bdv changed 2";
11.104 @@ -982,19 +982,19 @@
11.105 "--------- build fun check_for ------------------------";
11.106 "--------- build fun check_for ------------------------";
11.107 val (res, inf) =
11.108 - (str2term "d_d x (x ^^^ 2) + d_d x (sin (x ^^^ 4))",
11.109 - str2term "d_d x (x ^^^ 2) + cos (4 * x ^^^ 3)");
11.110 + (TermC.str2term "d_d x (x ^^^ 2) + d_d x (sin (x ^^^ 4))",
11.111 + TermC.str2term "d_d x (x ^^^ 2) + cos (4 * x ^^^ 3)");
11.112 val {errpats, nrls = rls, scr = Prog prog, ...} = MethodC.from_store ["diff", "differentiate_on_R"]
11.113
11.114 -val env = [(str2term "v_v", str2term "x")];
11.115 +val env = [(TermC.str2term "v_v", TermC.str2term "x")];
11.116 val errpats =
11.117 [Error_Pattern.empty, (*generalised for testing*)
11.118 ("chain-rule-diff-both",
11.119 - [parse_patt @{theory} "d_d ?bdv (sin ?u) = cos (d_d ?bdv ?u)",
11.120 - parse_patt @{theory} "d_d ?bdv (cos ?u) = - sin (d_d ?bdv ?u)",
11.121 - parse_patt @{theory} "d_d ?bdv (?u ^^^ ?n) = ?n * ?u ^^^ (?n - 1)",
11.122 - parse_patt @{theory} "d_d ?bdv (LogExp.ln ?u) = 1 / ?u",
11.123 - parse_patt @{theory} "d_d ?bdv (LogExp.ln ?u) = 1 / d_d ?bdv ?u"],
11.124 + [TermC.parse_patt @{theory} "d_d ?bdv (sin ?u) = cos (d_d ?bdv ?u)",
11.125 + TermC.parse_patt @{theory} "d_d ?bdv (cos ?u) = - sin (d_d ?bdv ?u)",
11.126 + TermC.parse_patt @{theory} "d_d ?bdv (?u ^^^ ?n) = ?n * ?u ^^^ (?n - 1)",
11.127 + TermC.parse_patt @{theory} "d_d ?bdv (LogExp.ln ?u) = 1 / ?u",
11.128 + TermC.parse_patt @{theory} "d_d ?bdv (LogExp.ln ?u) = 1 / d_d ?bdv ?u"],
11.129 [@{thm diff_sin_chain}, @{thm diff_cos_chain}, @{thm diff_pow_chain},
11.130 @{thm diff_ln_chain}, @{thm diff_exp_chain}])];
11.131 case Error_Pattern.check_for (res, inf) (prog, env) (errpats, rls) of SOME _ => ()
11.132 @@ -1276,7 +1276,7 @@
11.133 "--------- fun concat_deriv --------------------------------------";
11.134 (*
11.135 val ({rew_ord, erls, rules,...}, fo, ifo) =
11.136 - (Rule_Set.rep Test_simplify, str2term "x+1+ -1*2=0", str2term "-2*1+(x+1)=0");
11.137 + (Rule_Set.rep Test_simplify, TermC.str2term "x+1+ -1*2=0", TermC.str2term "-2*1+(x+1)=0");
11.138 (tracing o Derive.trtas2str) fod';
11.139 > ["
11.140 (x + 1 + -1 * 2 = 0, Thm ("radd_commute", "?m + ?n = ?n + ?m"), (-1 * 2 + (x + 1) = 0, []))", "
12.1 --- a/test/Tools/isac/Interpret/li-tool.sml Mon Apr 19 13:57:47 2021 +0200
12.2 +++ b/test/Tools/isac/Interpret/li-tool.sml Mon Apr 19 15:02:11 2021 +0200
12.3 @@ -168,14 +168,14 @@
12.4 "----------- fun go ----------------------------------------------";
12.5 "----------- fun go ----------------------------------------------";
12.6 (*
12.7 -> val t = (Thm.term_of o the o (parse thy)) "a+b";
12.8 +> val t = (Thm.term_of o the o (TermC.parse thy)) "a+b";
12.9 val it = Const (#,#) $ Free (#,#) $ Free ("b", "RealDef.real") : term
12.10 > val plus_a = TermC.sub_at [L] t;
12.11 > val b = TermC.sub_at [R] t;
12.12 > val plus = TermC.sub_at [L,L] t;
12.13 > val a = TermC.sub_at [L,R] t;
12.14
12.15 -> val t = (Thm.term_of o the o (parse thy)) "a+b+c";
12.16 +> val t = (Thm.term_of o the o (TermC.parse thy)) "a+b+c";
12.17 val t = Const (#,#) $ (# $ # $ Free #) $ Free ("c", "RealDef.real") : term
12.18 > val pl_pl_a_b = TermC.sub_at [L] t;
12.19 > val c = TermC.sub_at [R] t;
12.20 @@ -194,13 +194,13 @@
12.21 "----------- fun dsc_valT ----------------------------------------";
12.22 "----------- fun dsc_valT ----------------------------------------";
12.23 "----------- fun dsc_valT ----------------------------------------";
12.24 -(*> val t = (Thm.term_of o the o (parse thy)) "equality";
12.25 +(*> val t = (Thm.term_of o the o (TermC.parse thy)) "equality";
12.26 > val T = type_of t;
12.27 val T = "bool => Tools.una" : typ
12.28 > val dsc = dsc_valT t;
12.29 val dsc = "una" : string
12.30
12.31 -> val t = (Thm.term_of o the o (parse thy)) "fixedValues";
12.32 +> val t = (Thm.term_of o the o (TermC.parse thy)) "fixedValues";
12.33 > val T = type_of t;
12.34 val T = "bool List.list => Tools.nam" : typ
12.35 > val dsc = dsc_valT t;
13.1 --- a/test/Tools/isac/Knowledge/algein.sml Mon Apr 19 13:57:47 2021 +0200
13.2 +++ b/test/Tools/isac/Knowledge/algein.sml Mon Apr 19 15:02:11 2021 +0200
13.3 @@ -29,8 +29,8 @@
13.4 \ (let t_t = (l_l = 1)\
13.5 \ in t_t)"
13.6 ;
13.7 -val sc = (inst_abs o Thm.term_of o the o (parse thy)) str;
13.8 -atomty sc;
13.9 +val sc = (inst_abs o Thm.term_of o the o (TermC.parse thy)) str;
13.10 +TermC.atomty sc;
13.11 atomt sc;
13.12
13.13 "----------- me 'Berechnung' 'erstNumerisch' ---------------------";
13.14 @@ -104,7 +104,7 @@
13.15 val rew_ord = dummy_ord;
13.16 val erls = Rule_Set.Empty;
13.17 val thm = ThmC.thm_from_thy thy "sym_mult_zero_right";
13.18 -val t = str2term "0 = (0::real)";
13.19 +val t = TermC.str2term "0 = (0::real)";
13.20 val SOME (t',_) = rewrite_ thy rew_ord erls false thm t;
13.21 UnparseC.term t' = "0 = ?a1 * 0"; (* = true*)
13.22
13.23 @@ -112,7 +112,7 @@
13.24 val subte = Subst.input_to_terms sube;
13.25 UnparseC.terms_short subte = "[?a1 = 3]"; (* = true*)
13.26 val subst = Subst.T_from_string_eqs thy sube;
13.27 -foldl and_ (true, map contains_Var subte);
13.28 +foldl and_ (true, map TermC.contains_Var subte);
13.29
13.30 val t'' = subst_atomic subst t';
13.31 UnparseC.term t'' = "0 = 3 * 0"; (* = true*)
14.1 --- a/test/Tools/isac/Knowledge/biegelinie-1.sml Mon Apr 19 13:57:47 2021 +0200
14.2 +++ b/test/Tools/isac/Knowledge/biegelinie-1.sml Mon Apr 19 15:02:11 2021 +0200
14.3 @@ -28,23 +28,23 @@
14.4
14.5 val thy = @{theory "Biegelinie"};
14.6 val ctxt = ThyC.id_to_ctxt "Biegelinie";
14.7 -fun str2term str = (Thm.term_of o the o (parse thy)) str;
14.8 +fun TermC.str2term str = (Thm.term_of o the o (TermC.parse thy)) str;
14.9 fun term2s t = UnparseC.term_by_thyID "Biegelinie" t;
14.10 fun rewrit thm str = fst (the (rewrite_ thy tless_true Rule_Set.empty true thm str));
14.11
14.12 "----------- the rules -------------------------------------------";
14.13 "----------- the rules -------------------------------------------";
14.14 "----------- the rules -------------------------------------------";
14.15 -val t = rewrit @{thm Belastung_Querkraft} (str2term "- qq x = - q_0"); term2s t;
14.16 +val t = rewrit @{thm Belastung_Querkraft} (TermC.str2term "- qq x = - q_0"); term2s t;
14.17 if term2s t = "Q' x = - q_0" then ()
14.18 else error "/biegelinie.sml: Belastung_Querkraft";
14.19
14.20 -val t = rewrit @{thm Querkraft_Moment} (str2term "Q x = - q_0 * x + c"); term2s t;
14.21 +val t = rewrit @{thm Querkraft_Moment} (TermC.str2term "Q x = - q_0 * x + c"); term2s t;
14.22 if term2s t = "?M_b' x = - q_0 * x + c" then ()
14.23 (*if term2s t = "M_b' x = - q_0 * x + c" then () cf.fbe1652b0df8 new handling of quotes in mixfix*)
14.24 else error "/biegelinie.sml: Querkraft_Moment";
14.25
14.26 -val t = rewrit @{thm Moment_Neigung} (str2term "M_b x = -q_0 * x^^^2/2 + q_0/2 *L*x");
14.27 +val t = rewrit @{thm Moment_Neigung} (TermC.str2term "M_b x = -q_0 * x^^^2/2 + q_0/2 *L*x");
14.28 term2s t;
14.29 if term2s t = "- EI * y'' x = - q_0 * x ^^^ 2 / 2 + q_0 / 2 * L * x" then ()
14.30 else error "biegelinie.sml: Moment_Neigung";
14.31 @@ -70,15 +70,15 @@
14.32 Eval("Prog_Expr.argument'_in", eval_argument_in "Prog_Expr.argument'_in")
14.33 ],
14.34 scr = Empty_Prog};
14.35 -val rm_ = str2term"[M_b 0 = 0, M_b L = 0]";
14.36 -val M__ = str2term"M_b x = -1 * x ^^^ 2 / 2 + x * c + c_2";
14.37 +val rm_ = TermC.str2term"[M_b 0 = 0, M_b L = 0]";
14.38 +val M__ = TermC.str2term"M_b x = -1 * x ^^^ 2 / 2 + x * c + c_2";
14.39 val SOME (e1__,_) = rewrite_set_ thy false srls
14.40 - (str2term "(NTH::[real,bool list]=>bool) 1 " $ rm_);
14.41 + (TermC.str2term "(NTH::[real,bool list]=>bool) 1 " $ rm_);
14.42 if UnparseC.term e1__ = "M_b 0 = 0" then () else error "biegelinie.sml simplify NTH 1 rm_";
14.43
14.44 val SOME (x1__,_) =
14.45 rewrite_set_ thy false srls
14.46 - (str2term"argument_in (lhs (M_b 0 = 0))");
14.47 + (TermC.str2term"argument_in (lhs (M_b 0 = 0))");
14.48 if UnparseC.term x1__ = "0" then ()
14.49 else error "biegelinie.sml simplify argument_in (lhs (M_b 0 = 0)";
14.50
14.51 @@ -118,8 +118,8 @@
14.52 "----------- investigate normalforms in biegelinien --------------";
14.53 "----------- investigate normalforms in biegelinien --------------";
14.54 "----- coming from integration, kept for later improvements:";
14.55 -val Q = str2term "Q x = c + -1 * q_0 * x";
14.56 -val M_b = str2term "M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2";
14.57 -val y' = str2term "y' x = c_3 + 1 / (-1 * EI) * (c_2 * x + c / 2 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3)";
14.58 -val y = str2term "y x = c_4 + c_3 * x +\n1 / (-1 * EI) * (c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)";
14.59 +val Q = TermC.str2term "Q x = c + -1 * q_0 * x";
14.60 +val M_b = TermC.str2term "M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2";
14.61 +val y' = TermC.str2term "y' x = c_3 + 1 / (-1 * EI) * (c_2 * x + c / 2 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3)";
14.62 +val y = TermC.str2term "y x = c_4 + c_3 * x +\n1 / (-1 * EI) * (c_2 / 2 * x ^^^ 2 + c / 6 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)";
14.63 (*^^^ 1 / (-1 * EI) NOT distributed - ok! ^^^^^^^^^^^^^^^^^^^^^^^*)
15.1 --- a/test/Tools/isac/Knowledge/diff.sml Mon Apr 19 13:57:47 2021 +0200
15.2 +++ b/test/Tools/isac/Knowledge/diff.sml Mon Apr 19 15:02:11 2021 +0200
15.3 @@ -36,11 +36,11 @@
15.4 Find =["derivative f_f'"],
15.5 With =[],
15.6 Relate=[]}:string ppc;
15.7 -val chkpbt = ((map (the o (parse thy))) o P_Model.to_list) pbt;
15.8 +val chkpbt = ((map (the o (TermC.parse thy))) o P_Model.to_list) pbt;
15.9
15.10 val org = ["functionTerm (d_d x (x ^^^ 2 + 3 * x + 4))",
15.11 "differentiateFor x", "derivative f_f'"];
15.12 -val chkorg = map (the o (parse thy)) org;
15.13 +val chkorg = map (the o (TermC.parse thy)) org;
15.14
15.15 Problem.from_store ["derivative_of", "function"];
15.16 MethodC.from_store ["diff", "differentiate_on_R"];
15.17 @@ -49,18 +49,18 @@
15.18 "----------- for correction of diff_const ---------------";
15.19 "----------- for correction of diff_const ---------------";
15.20 (*re-evaluate this file, otherwise > *** ME_Isa: 'erls' not known*)
15.21 -val t = (Thm.term_of o the o (parse thy)) "Not (x =!= a)";
15.22 +val t = (Thm.term_of o the o (TermC.parse thy)) "Not (x =!= a)";
15.23 case rewrite_set_ thy false erls_diff t of
15.24 SOME (Const ("HOL.True", _), []) => ()
15.25 | _ => error "rewrite_set_ Not (x =!= a) changed";
15.26
15.27 -val t =(Thm.term_of o the o (parse thy)) "2 is_const";
15.28 +val t =(Thm.term_of o the o (TermC.parse thy)) "2 is_const";
15.29 case rewrite_set_ thy false erls_diff t of
15.30 SOME (Const ("HOL.True", _), []) => ()
15.31 | _ => error "rewrite_set_ 2 is_const changed";
15.32
15.33 val thm = @{thm diff_const};
15.34 -val ct = (Thm.term_of o the o (parse thy)) "d_d x x";
15.35 +val ct = (Thm.term_of o the o (TermC.parse thy)) "d_d x x";
15.36 val subst = [(@{term "bdv::real"}, @{term "x::real"})];
15.37 val NONE = (rewrite_inst_ thy tless_true erls_diff false subst thm ct);
15.38
15.39 @@ -68,10 +68,10 @@
15.40 "----------- for correction of diff_quot ----------------";
15.41 "----------- for correction of diff_quot ----------------";
15.42 val thy = @{theory "Diff"};
15.43 -val ct = (Thm.term_of o the o (parse thy)) "Not (x = 0)";
15.44 +val ct = (Thm.term_of o the o (TermC.parse thy)) "Not (x = 0)";
15.45 rewrite_set_ thy false erls_diff ct;
15.46
15.47 -val ct = (Thm.term_of o the o (parse thy)) "d_d x ((x+1) / (x - 1))";
15.48 +val ct = (Thm.term_of o the o (TermC.parse thy)) "d_d x ((x+1) / (x - 1))";
15.49 val thm = @{thm diff_quot};
15.50 val SOME (ctt,_) =
15.51 (rewrite_inst_ thy tless_true erls_diff true subst thm ct);
15.52 @@ -80,7 +80,7 @@
15.53 "----------- differentiate by rewrite -------------------";
15.54 "----------- differentiate by rewrite -------------------";
15.55 val thy = @{theory "Diff"};
15.56 -val ct = (Thm.term_of o the o (parse thy)) "d_d x (x ^^^ 2 + 3 * x + 4)";
15.57 +val ct = (Thm.term_of o the o (TermC.parse thy)) "d_d x (x ^^^ 2 + 3 * x + 4)";
15.58 "--- 1 ---";
15.59 val thm = @{thm "diff_sum"};
15.60 val (ct, _) = the (rewrite_inst_ thy tless_true erls_diff true subst thm ct);
15.61 @@ -103,7 +103,7 @@
15.62 "--- 7 ---";
15.63 "--- 7 ---";
15.64 val rls = Test_simplify;
15.65 -val ct = (Thm.term_of o the o (parse thy)) "2 * x ^^^ (2 - 1) + 3 * 1 + 0";
15.66 +val ct = (Thm.term_of o the o (TermC.parse thy)) "2 * x ^^^ (2 - 1) + 3 * 1 + 0";
15.67 val (ct, _) = the (rewrite_set_ thy true rls ct);
15.68 if UnparseC.term ct = "3 + 2 * x" then () else error "rewrite_set_ Test_simplify 2 changed";
15.69
15.70 @@ -215,21 +215,21 @@
15.71 "----------- primed id ----------------------------------";
15.72 "----------- primed id ----------------------------------";
15.73 "----------- primed id ----------------------------------";
15.74 -val f_ = str2term "f_f::bool";
15.75 -val f = str2term "A = s * (a - s)";
15.76 -val v_ = str2term "v_v";
15.77 -val v = str2term "s";
15.78 -val screxp0 = str2term "Take ((primed (lhs f_f)) = d_d v_v (rhs f_f))";
15.79 -atomty screxp0;
15.80 +val f_ = TermC.str2term "f_f::bool";
15.81 +val f = TermC.str2term "A = s * (a - s)";
15.82 +val v_ = TermC.str2term "v_v";
15.83 +val v = TermC.str2term "s";
15.84 +val screxp0 = TermC.str2term "Take ((primed (lhs f_f)) = d_d v_v (rhs f_f))";
15.85 +TermC.atomty screxp0;
15.86
15.87 val screxp1 = subst_atomic [(f_, f), (v_, v)] screxp0;
15.88 UnparseC.term screxp1;
15.89 -atomty screxp1;
15.90 +TermC.atomty screxp1;
15.91
15.92 val SOME (f'_,_) = rewrite_set_ (@{theory "Isac_Knowledge"}) false srls_diff screxp1;
15.93 if UnparseC.term f'_= "Take (A' = d_d s (s * (a - s)))" then ()
15.94 else error "diff.sml: diff.behav. in 'primed'";
15.95 -atomty f'_;
15.96 +TermC.atomty f'_;
15.97
15.98 val str = "Program DiffEqScr (f_f::bool) (v_v::real) = \
15.99 \ (let f_f' = Take ((primed (lhs f_f)) = d_d v_v (rhs f_f)) \
15.100 @@ -259,38 +259,38 @@
15.101 \ (Try (Repeat (Rewrite sym_frac_conv))) #> \
15.102 \ (Try (Repeat (Rewrite sym_root_conv))))) f_f')"
15.103 ;
15.104 -val sc = (inst_abs o Thm.term_of o the o (parse thy)) str;
15.105 +val sc = (inst_abs o Thm.term_of o the o (TermC.parse thy)) str;
15.106
15.107
15.108 "----------- diff_conv, sym_diff_conv -------------------";
15.109 "----------- diff_conv, sym_diff_conv -------------------";
15.110 "----------- diff_conv, sym_diff_conv -------------------";
15.111 -val subs = [(str2term "bdv", str2term "x")];
15.112 +val subs = [(TermC.str2term "bdv", TermC.str2term "x")];
15.113 val rls = diff_conv;
15.114
15.115 -val t = str2term "2/x^^^2";
15.116 +val t = TermC.str2term "2/x^^^2";
15.117 val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; UnparseC.term t;
15.118 if UnparseC.term t = "2 * x ^^^ -2" then () else error "diff.sml 1/x";
15.119
15.120 -val t = str2term "sqrt (x^^^3)";
15.121 +val t = TermC.str2term "sqrt (x^^^3)";
15.122 val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; UnparseC.term t;
15.123 if UnparseC.term t = "x ^^^ (3 / 2)" then () else error "diff.sml x^1/2";
15.124
15.125 -val t = str2term "2 / sqrt x^^^3";
15.126 +val t = TermC.str2term "2 / sqrt x^^^3";
15.127 val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; UnparseC.term t;
15.128 if UnparseC.term t = "2 * x ^^^ (-3 / 2)" then () else error"diff.sml x^-1/2";
15.129 val rls = diff_sym_conv;
15.130
15.131 -val t = str2term "2 * x ^^^ -2";
15.132 +val t = TermC.str2term "2 * x ^^^ -2";
15.133 val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; UnparseC.term t;
15.134 if UnparseC.term t = "2 / x ^^^ 2" then () else error "diff.sml sym 1/x";
15.135
15.136
15.137 -val t = str2term "x ^^^ (3 / 2)";
15.138 +val t = TermC.str2term "x ^^^ (3 / 2)";
15.139 val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; UnparseC.term t;
15.140 if UnparseC.term t = "sqrt (x ^^^ 3)" then () else error"diff.sml sym x^1/x";
15.141
15.142 -val t = str2term "2 * x ^^^ (-3 / 2)";
15.143 +val t = TermC.str2term "2 * x ^^^ (-3 / 2)";
15.144 val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; UnparseC.term t;
15.145 if UnparseC.term t ="2 / sqrt (x ^^^ 3)"then()else error"diff.sml sym x^-1/x";
15.146
15.147 @@ -384,15 +384,15 @@
15.148 "----------- tests for examples -------------------------";
15.149 "----------- tests for examples -------------------------";
15.150 "----------- tests for examples -------------------------";
15.151 -"----- parse errors";
15.152 -(*str2term "F = sqrt( y^^^2 - O) * (z + O^^^2)";
15.153 -str2term "O";
15.154 -str2term "OO"; ---errors*)
15.155 -str2term "OOO";
15.156 +"----- TermC.parse errors";
15.157 +(*TermC.str2term "F = sqrt( y^^^2 - O) * (z + O^^^2)";
15.158 +TermC.str2term "O";
15.159 +TermC.str2term "OO"; ---errors*)
15.160 +TermC.str2term "OOO";
15.161
15.162 "----- thm 'diff_prod_const'";
15.163 -val subs = [(str2term "bdv", str2term "l")];
15.164 -val f = str2term "G' = d_d l (l * sqrt (7 * s ^^^ 2 - l ^^^ 2))";
15.165 +val subs = [(TermC.str2term "bdv", TermC.str2term "l")];
15.166 +val f = TermC.str2term "G' = d_d l (l * sqrt (7 * s ^^^ 2 - l ^^^ 2))";
15.167
15.168 "------------inform for x^2+x+1 -------------------------";
15.169 "------------inform for x^2+x+1 -------------------------";
16.1 --- a/test/Tools/isac/Knowledge/diffapp.sml Mon Apr 19 13:57:47 2021 +0200
16.2 +++ b/test/Tools/isac/Knowledge/diffapp.sml Mon Apr 19 15:02:11 2021 +0200
16.3 @@ -450,7 +450,7 @@
16.4 "--------------------- 30.4.03: maximum .. rewrite_set_ prog_expr ---------";
16.5 "--------------------- 30.4.03: maximum .. rewrite_set_ prog_expr ---------";
16.6 "--------------------- 30.4.03: maximum .. rewrite_set_ prog_expr ---------";
16.7 -str2term
16.8 +TermC.str2term
16.9 "Program Maximum_value(f_ix::bool list)(m_m::real) (r_s::bool list)\
16.10 \ (v_v::real) (itv_v::real set) (err_r::bool) = \
16.11 \ (let e_e = (hd o (filterVar m_m)) r_s; \
16.12 @@ -465,22 +465,22 @@
16.13 \ [REAL mx_x, REAL (Rhs t_t), REAL v_v, REAL m_m, \
16.14 \ BOOL_LIST (dropWhile (ident e_e) r_s)])::bool list))";
16.15
16.16 -val f_ix = (str2term "f_ix::bool list",
16.17 - str2term "[r=Arbfix]");
16.18 -val m_m = (str2term "m_m::real",
16.19 - str2term "A");
16.20 -val r_s = (str2term "rs_s::bool list",
16.21 - str2term "[A = a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]");
16.22 -val v_v = (str2term "v_v::real",
16.23 - str2term "b");
16.24 -val itv_v = (str2term "itv_v::real set",
16.25 - str2term "{x::real. 0 <= x & x <= 2*r}");
16.26 -val err_r = (str2term "err_r::bool",
16.27 - str2term "eps=0");
16.28 +val f_ix = (TermC.str2term "f_ix::bool list",
16.29 + TermC.str2term "[r=Arbfix]");
16.30 +val m_m = (TermC.str2term "m_m::real",
16.31 + TermC.str2term "A");
16.32 +val r_s = (TermC.str2term "rs_s::bool list",
16.33 + TermC.str2term "[A = a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]");
16.34 +val v_v = (TermC.str2term "v_v::real",
16.35 + TermC.str2term "b");
16.36 +val itv_v = (TermC.str2term "itv_v::real set",
16.37 + TermC.str2term "{x::real. 0 <= x & x <= 2*r}");
16.38 +val err_r = (TermC.str2term "err_r::bool",
16.39 + TermC.str2term "eps=0");
16.40 val env = [f_ix, m_m, r_s ,v_v, itv_v, err_r];
16.41
16.42 (*--- 1.line in script ---*)
16.43 -val t = str2term "(hd o (filterVar m_m)) (r_s::bool list)";
16.44 +val t = TermC.str2term "(hd o (filterVar m_m)) (r_s::bool list)";
16.45 val s = subst_atomic env t;
16.46 UnparseC.term s;
16.47 "(hd o filterVar A) [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]";
16.48 @@ -489,10 +489,10 @@
16.49 val s'' = UnparseC.term s';
16.50 if s''="A = a * b" then () else error "new behaviour with prog_expr 1.1.";
16.51 === inhibit exn 110726=============================================================*)
16.52 -val env = env @ [(str2term "e_e::bool",str2term "A = a * b")];
16.53 +val env = env @ [(TermC.str2term "e_e::bool",TermC.str2term "A = a * b")];
16.54
16.55 (*--- 2.line: condition alone ---*)
16.56 -val t = str2term "1 < length_h (r_s::bool list)";
16.57 +val t = TermC.str2term "1 < length_h (r_s::bool list)";
16.58 val s = subst_atomic env t;
16.59 UnparseC.term s;
16.60 "1 < length_h [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]";
16.61 @@ -503,7 +503,7 @@
16.62 === inhibit exn 110726=============================================================*)
16.63
16.64 (*--- 2.line in script ---*)
16.65 -val t = str2term
16.66 +val t = TermC.str2term
16.67 "(if 1 < length_h r_s \
16.68 \ then (SubProblem (Reals_s,[make,function],[no_met])\
16.69 \ [REAL m_m, REAL v_v, BOOL_LIST r_s])\
16.70 @@ -524,15 +524,15 @@
16.71 \ BOOL_LIST [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]]" then ()
16.72 else error "new behaviour with prog_expr 1.3.";
16.73 === inhibit exn 110726=============================================================*)
16.74 -val env = env @ [(str2term "t_t::bool",
16.75 - str2term "A = (2*sqrt(r^^^2-(b/2)^^^2)) * b")];
16.76 +val env = env @ [(TermC.str2term "t_t::bool",
16.77 + TermC.str2term "A = (2*sqrt(r^^^2-(b/2)^^^2)) * b")];
16.78
16.79
16.80
16.81 "---------------------- 1.5.03: Make_fun_by_explicit ---------------------";
16.82 "---------------------- 1.5.03: Make_fun_by_explicit ---------------------";
16.83 "---------------------- 1.5.03: Make_fun_by_explicit ---------------------";
16.84 -str2term
16.85 +TermC.str2term
16.86 "Program Make_fun_by_explicit (f_f::real) (v_v::real) \
16.87 \ (eqs::bool list) = \
16.88 \ (let h_h = (hd o (filterVar f_f)) eqs; \
16.89 @@ -542,32 +542,32 @@
16.90 \ (s_1::bool list)=(SubProblem(Reals_s,[univar,equation],[no_met])\
16.91 \ [BOOL e_1, REAL v_1])\
16.92 \ in Substitute [(v_1 = (rhs o hd) s_1)] h_h)";
16.93 -val f_f = (str2term "f_f::real",
16.94 - str2term "A");
16.95 -val v_v = (str2term "v_v::real",
16.96 - str2term "b");
16.97 -val eqs=(str2term "eqs::bool list",
16.98 - str2term "[A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]");
16.99 +val f_f = (TermC.str2term "f_f::real",
16.100 + TermC.str2term "A");
16.101 +val v_v = (TermC.str2term "v_v::real",
16.102 + TermC.str2term "b");
16.103 +val eqs=(TermC.str2term "eqs::bool list",
16.104 + TermC.str2term "[A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]");
16.105 val env = [f_f, v_v, eqs];
16.106
16.107 (*--- 1.line in script ---*)
16.108 -val t = str2term "(hd o (filterVar v_v)) (eqs::bool list)";
16.109 +val t = TermC.str2term "(hd o (filterVar v_v)) (eqs::bool list)";
16.110 val s = subst_atomic env t;
16.111 UnparseC.term s;
16.112 -val t = str2term
16.113 +val t = TermC.str2term
16.114 "(hd o filterVar b) [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]";
16.115 val SOME (t',_) = rewrite_set_ thy false prog_expr t;
16.116 val s' = UnparseC.term t';
16.117 (*=== inhibit exn 110726=============================================================
16.118 if s' = "A = a * b" then () else error "new behaviour with prog_expr 2.1";
16.119 === inhibit exn 110726=============================================================*)
16.120 -val env = env @ [(str2term "h_h::bool", str2term s')];
16.121 +val env = env @ [(TermC.str2term "h_h::bool", TermC.str2term s')];
16.122
16.123 (*--- 2.line in script ---*)
16.124 -val t = str2term "hd (dropWhile (ident h_h) (eqs::bool list))";
16.125 +val t = TermC.str2term "hd (dropWhile (ident h_h) (eqs::bool list))";
16.126 val s = subst_atomic env t;
16.127 UnparseC.term s;
16.128 -val t = str2term
16.129 +val t = TermC.str2term
16.130 "hd (dropWhile (ident (A = a * b))\
16.131 \ [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2])";
16.132 (*=== inhibit exn 110726=============================================================
16.133 @@ -578,47 +578,47 @@
16.134 if s' = "(a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2" then ()
16.135 else error "new behaviour with prog_expr 2.2";
16.136 === inhibit exn 110726=============================================================*)
16.137 -val env = env @ [(str2term "e_1::bool", str2term s')];
16.138 +val env = env @ [(TermC.str2term "e_1::bool", TermC.str2term s')];
16.139
16.140 (*--- 3.line in script ---*)
16.141 -val t = str2term "dropWhile (ident f_f) (Vars (h_h::bool))";
16.142 +val t = TermC.str2term "dropWhile (ident f_f) (Vars (h_h::bool))";
16.143 val s = subst_atomic env t;
16.144 UnparseC.term s;
16.145 -val t = str2term "dropWhile (ident A) (Vars (A = a * b))";
16.146 +val t = TermC.str2term "dropWhile (ident A) (Vars (A = a * b))";
16.147 (*=== inhibit exn 110726=============================================================
16.148 val SOME (t',_) = rewrite_set_ thy false prog_expr t;
16.149 val s' = UnparseC.term t';
16.150 if s' = "[a, b]" then () else error "new behaviour with prog_expr 2.3";
16.151 === inhibit exn 110726=============================================================*)
16.152 -val env = env @ [(str2term "vs_s::real list", str2term s')];
16.153 +val env = env @ [(TermC.str2term "vs_s::real list", TermC.str2term s')];
16.154
16.155 (*--- 4.line in script ---*)
16.156 -val t = str2term "hd (dropWhile (ident v_v) v_s)";
16.157 +val t = TermC.str2term "hd (dropWhile (ident v_v) v_s)";
16.158 val s = subst_atomic env t;
16.159 UnparseC.term s;
16.160 -val t = str2term "hd (dropWhile (ident b) [a, b])";
16.161 +val t = TermC.str2term "hd (dropWhile (ident b) [a, b])";
16.162 (*=== inhibit exn 110726=============================================================
16.163 val SOME (t',_) = rewrite_set_ thy false prog_expr t;
16.164 val s' = UnparseC.term t';
16.165 if s' = "a" then () else error "new behaviour with prog_expr 2.4.";
16.166 === inhibit exn 110726=============================================================*)
16.167 -val env = env @ [(str2term "v_1::real", str2term s')];
16.168 +val env = env @ [(TermC.str2term "v_1::real", TermC.str2term s')];
16.169
16.170 (*--- 5.line in script ---*)
16.171 -val t = str2term "(SubProblem(Reals_s,[univar,equation],[no_met])\
16.172 +val t = TermC.str2term "(SubProblem(Reals_s,[univar,equation],[no_met])\
16.173 \ [BOOL e_1, REAL v_1])";
16.174 val s = subst_atomic env t;
16.175 UnparseC.term s;
16.176 "SubProblem (Reals_s, [univar, equation], [no_met])\n\
16.177 \ [BOOL ((a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2), REAL a]";
16.178 -val env = env @ [(str2term "s_1::bool list",
16.179 - str2term "[a = 2 * sqrt (r^^^2 - (b/2)^^^2)]")];
16.180 +val env = env @ [(TermC.str2term "s_1::bool list",
16.181 + TermC.str2term "[a = 2 * sqrt (r^^^2 - (b/2)^^^2)]")];
16.182
16.183 (*--- 6.line in script ---*)
16.184 -val t = str2term "Substitute [(v_1 = (rhs o hd) (s_1::bool list))] (h_h::bool)";
16.185 +val t = TermC.str2term "Substitute [(v_1 = (rhs o hd) (s_1::bool list))] (h_h::bool)";
16.186 val s = subst_atomic env t;
16.187 UnparseC.term s;
16.188 -val t = str2term
16.189 +val t = TermC.str2term
16.190 "Substitute [(a = (rhs o hd) [a = 2 * sqrt (r ^^^ 2 - (b / 2) ^^^ 2)])]\n\
16.191 \ (A = a * b)";
16.192 (*=== inhibit exn 110726=============================================================
16.193 @@ -633,7 +633,7 @@
16.194 "---------------------- 2.5.03: Make_fun_by_new_variable -----------------";
16.195 "---------------------- 2.5.03: Make_fun_by_new_variable -----------------";
16.196 "---------------------- 2.5.03: Make_fun_by_new_variable -----------------";
16.197 -str2term
16.198 +TermC.str2term
16.199 "Program Make_fun_by_new_variable (f_f::real) (v_v::real) \
16.200 \ (eqs::bool list) = \
16.201 \(let h_h = (hd o (filterVar f_f)) eqs; \
16.202 @@ -648,19 +648,19 @@
16.203 \ (s_2::bool list) = (SubProblem (Reals_s,[univar,equation],[no_met])\
16.204 \ [BOOL e_2, REAL v_2])\
16.205 \in Substitute [(v_1 = (rhs o hd) s_1),(v_2 = (rhs o hd) s_2)] h_h)";
16.206 -val f_ = (str2term "f_f::real",
16.207 - str2term "A");
16.208 -val v_v = (str2term "v_v::real",
16.209 - str2term "alpha");
16.210 -val eqs=(str2term "eqs::bool list",
16.211 - str2term "[A=a*b, a/2=r*sin alpha, b/2=r*cos (alpha::real)]");
16.212 +val f_ = (TermC.str2term "f_f::real",
16.213 + TermC.str2term "A");
16.214 +val v_v = (TermC.str2term "v_v::real",
16.215 + TermC.str2term "alpha");
16.216 +val eqs=(TermC.str2term "eqs::bool list",
16.217 + TermC.str2term "[A=a*b, a/2=r*sin alpha, b/2=r*cos (alpha::real)]");
16.218 val env = [f_f, v_v, eqs];
16.219
16.220 (*--- 1.line in script ---*)
16.221 -val t = str2term "(hd o (filterVar (f_f::real))) (eqs::bool list)";
16.222 +val t = TermC.str2term "(hd o (filterVar (f_f::real))) (eqs::bool list)";
16.223 val s = subst_atomic env t;
16.224 UnparseC.term s;
16.225 -val t = str2term
16.226 +val t = TermC.str2term
16.227 "(hd o filterVar A) [A = a * b, a / 2 = r * sin alpha, b / 2 = r * cos alpha]";
16.228 Rewrite.trace_on := false;
16.229 val SOME (t',_) = rewrite_set_ thy false prog_expr t;
16.230 @@ -668,14 +668,14 @@
16.231 val s' = UnparseC.term t';
16.232 (*=== inhibit exn 110726=============================================================
16.233 if s' = "A = a * b" then() else error "new behaviour with prog_expr 3.1.";
16.234 -val env = env @ [(str2term "h_h::bool", str2term s')];
16.235 +val env = env @ [(TermC.str2term "h_h::bool", TermC.str2term s')];
16.236 === inhibit exn 110726=============================================================*)
16.237
16.238 (*--- 2.line in script ---*)
16.239 -val t = str2term "dropWhile (ident (h_h::bool)) (eqs::bool list)";
16.240 +val t = TermC.str2term "dropWhile (ident (h_h::bool)) (eqs::bool list)";
16.241 val s = subst_atomic env t;
16.242 UnparseC.term s;
16.243 -val t = str2term
16.244 +val t = TermC.str2term
16.245 "dropWhile (ident (A = a * b))\
16.246 \ [A = a * b, a / 2 = r * sin alpha, b / 2 = r * cos alpha]";
16.247 (*=== inhibit exn 110726=============================================================
16.248 @@ -684,49 +684,49 @@
16.249 if s' = "[a / 2 = r * sin alpha, b / 2 = r * cos alpha]"
16.250 then () else error "new behaviour with prog_expr 3.2.";
16.251 === inhibit exn 110726=============================================================*)
16.252 -val env = env @ [(str2term "es_s::bool list", str2term s')];
16.253 +val env = env @ [(TermC.str2term "es_s::bool list", TermC.str2term s')];
16.254
16.255 (*--- 3.line in script ---*)
16.256 -val t = str2term "dropWhile (ident (f_f::real)) (Vars (h_h::bool))";
16.257 +val t = TermC.str2term "dropWhile (ident (f_f::real)) (Vars (h_h::bool))";
16.258 val s = subst_atomic env t;
16.259 UnparseC.term s;
16.260 -val t = str2term "dropWhile (ident A) (Vars (A = a * b))";
16.261 +val t = TermC.str2term "dropWhile (ident A) (Vars (A = a * b))";
16.262 (*=== inhibit exn 110726=============================================================
16.263 val SOME (t',_) = rewrite_set_ thy false prog_expr t;
16.264 val s' = UnparseC.term t';
16.265 if s' = "[a, b]" then () else error "new behaviour with prog_expr 3.3.";
16.266 === inhibit exn 110726=============================================================*)
16.267 -val env = env @ [(str2term "vs_s::real list", str2term s')];
16.268 +val env = env @ [(TermC.str2term "vs_s::real list", TermC.str2term s')];
16.269
16.270 (*--- 4.line in script ---*)
16.271 -val t = str2term "nth_h 1 v_s";
16.272 +val t = TermC.str2term "nth_h 1 v_s";
16.273 val s = subst_atomic env t;
16.274 UnparseC.term s;
16.275 -val t = str2term "nth_h 1 [a, b]";
16.276 +val t = TermC.str2term "nth_h 1 [a, b]";
16.277 (*=== inhibit exn 110726=============================================================
16.278 val SOME (t',_) = rewrite_set_ thy false prog_expr t;
16.279 val s' = UnparseC.term t';
16.280 if s' = "a" then () else error "new behaviour with prog_expr 3.4.";
16.281 === inhibit exn 110726=============================================================*)
16.282 -val env = env @ [(str2term "v_1", str2term s')];
16.283 +val env = env @ [(TermC.str2term "v_1", TermC.str2term s')];
16.284
16.285 (*--- 5.line in script ---*)
16.286 -val t = str2term "nth_h 2 v_s";
16.287 +val t = TermC.str2term "nth_h 2 v_s";
16.288 val s = subst_atomic env t;
16.289 UnparseC.term s;
16.290 -val t = str2term "nth_h 2 [a, b]";
16.291 +val t = TermC.str2term "nth_h 2 [a, b]";
16.292 (*=== inhibit exn 110726=============================================================
16.293 val SOME (t',_) = rewrite_set_ thy false prog_expr t;
16.294 val s' = UnparseC.term t';
16.295 if s' = "b" then () else error "new behaviour with prog_expr 3.5.";
16.296 === inhibit exn 110726=============================================================*)
16.297 -val env = env @ [(str2term "v_2", str2term s')];
16.298 +val env = env @ [(TermC.str2term "v_2", TermC.str2term s')];
16.299
16.300 (*--- 6.line in script ---*)
16.301 -val t = str2term "(hd o (filterVar v_1)) (es_s::bool list)";
16.302 +val t = TermC.str2term "(hd o (filterVar v_1)) (es_s::bool list)";
16.303 val s = subst_atomic env t;
16.304 UnparseC.term s;
16.305 -val t = str2term
16.306 +val t = TermC.str2term
16.307 "(hd o filterVar a) [a / 2 = r * sin alpha, b / 2 = r * cos alpha]";
16.308 val SOME (t',_) = rewrite_set_ thy false prog_expr t;
16.309 val s' = UnparseC.term t';
16.310 @@ -734,14 +734,14 @@
16.311 if s' = "a / 2 = r * sin alpha" then ()
16.312 else error "new behaviour with prog_expr 3.6.";
16.313 === inhibit exn 110726=============================================================*)
16.314 -val e_1 = str2term "e_1::bool";
16.315 -val env = env @ [(e_1, str2term s')];
16.316 +val e_1 = TermC.str2term "e_1::bool";
16.317 +val env = env @ [(e_1, TermC.str2term s')];
16.318
16.319 (*--- 7.line in script ---*)
16.320 -val t = str2term "(hd o (filterVar v_2)) (es_s::bool list)";
16.321 +val t = TermC.str2term "(hd o (filterVar v_2)) (es_s::bool list)";
16.322 val s = subst_atomic env t;
16.323 UnparseC.term s;
16.324 -val t = str2term
16.325 +val t = TermC.str2term
16.326 "(hd o filterVar b) [a / 2 = r * sin alpha, b / 2 = r * cos alpha]";
16.327 val SOME (t',_) = rewrite_set_ thy false prog_expr t;
16.328 val s' = UnparseC.term t';
16.329 @@ -749,30 +749,30 @@
16.330 if s' = "b / 2 = r * cos alpha" then ()
16.331 else error "new behaviour with prog_expr 3.7.";
16.332 === inhibit exn 110726=============================================================*)
16.333 -val env = env @ [(str2term "e_2::bool", str2term s')];
16.334 +val env = env @ [(TermC.str2term "e_2::bool", TermC.str2term s')];
16.335
16.336 (*--- 8.line in script ---*)
16.337 -val t = str2term "(SubProblem (Reals_s,[univar,equation],[no_met])\
16.338 +val t = TermC.str2term "(SubProblem (Reals_s,[univar,equation],[no_met])\
16.339 \ [BOOL e_1, REAL v_1])";
16.340 val s = subst_atomic env t;
16.341 UnparseC.term s;
16.342 "SubProblem (Reals_s, [univar, equation], [no_met])\
16.343 \ [BOOL (a / 2 = r * sin alpha), REAL a]";
16.344 -val s_1 = str2term "[a = 2*r*sin alpha]";
16.345 -val env = env @ [(str2term "s_1::bool list", s_1)];
16.346 +val s_1 = TermC.str2term "[a = 2*r*sin alpha]";
16.347 +val env = env @ [(TermC.str2term "s_1::bool list", s_1)];
16.348
16.349 (*--- 9.line in script ---*)
16.350 -val t = str2term "(SubProblem (Reals_s,[univar,equation],[no_met])\
16.351 +val t = TermC.str2term "(SubProblem (Reals_s,[univar,equation],[no_met])\
16.352 \ [BOOL e_2, REAL v_2])";
16.353 val s = subst_atomic env t;
16.354 UnparseC.term s;
16.355 "SubProblem (Reals_s, [univar, equation], [no_met])\
16.356 \ [BOOL (b / 2 = r * cos alpha), REAL b]";
16.357 -val s_2 = str2term "[b = 2*r*cos alpha]";
16.358 -val env = env @ [(str2term "s_2::bool list", s_2)];
16.359 +val s_2 = TermC.str2term "[b = 2*r*cos alpha]";
16.360 +val env = env @ [(TermC.str2term "s_2::bool list", s_2)];
16.361
16.362 (*--- 10.line in script ---*)
16.363 -val t = str2term
16.364 +val t = TermC.str2term
16.365 "Substitute [(v_1 = (rhs o hd) s_1),(v_2 = (rhs o hd) s_2)] (h_h::bool)";
16.366 val s = subst_atomic env t;
16.367 UnparseC.term s;
17.1 --- a/test/Tools/isac/Knowledge/eqsystem.sml Mon Apr 19 13:57:47 2021 +0200
17.2 +++ b/test/Tools/isac/Knowledge/eqsystem.sml Mon Apr 19 15:02:11 2021 +0200
17.3 @@ -31,46 +31,46 @@
17.4 "----------- occur_exactly_in ------------------------------------";
17.5 "----------- occur_exactly_in ------------------------------------";
17.6 "----------- occur_exactly_in ------------------------------------";
17.7 -val all = [str2term"c", str2term"c_2", str2term"c_3"];
17.8 -val t = str2term"0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2";
17.9 +val all = [TermC.str2term"c", TermC.str2term"c_2", TermC.str2term"c_3"];
17.10 +val t = TermC.str2term"0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2";
17.11
17.12 -if occur_exactly_in [str2term"c", str2term"c_2"] all t
17.13 +if occur_exactly_in [TermC.str2term"c", TermC.str2term"c_2"] all t
17.14 then () else error "eqsystem.sml occur_exactly_in 1";
17.15
17.16 -if not (occur_exactly_in [str2term"c", str2term"c_2", str2term"c_3"] all t)
17.17 +if not (occur_exactly_in [TermC.str2term"c", TermC.str2term"c_2", TermC.str2term"c_3"] all t)
17.18 then () else error "eqsystem.sml occur_exactly_in 2";
17.19
17.20 -if not (occur_exactly_in [str2term"c_2"] all t)
17.21 +if not (occur_exactly_in [TermC.str2term"c_2"] all t)
17.22 then () else error "eqsystem.sml occur_exactly_in 3";
17.23
17.24 -val t = str2term"[c,c_2] from [c,c_2,c_3] occur_exactly_in -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2";
17.25 +val t = TermC.str2term"[c,c_2] from [c,c_2,c_3] occur_exactly_in -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2";
17.26 eval_occur_exactly_in 0 "EqSystem.occur'_exactly'_in" t 0;
17.27 val SOME (str, t') = eval_occur_exactly_in 0 "EqSystem.occur'_exactly'_in" t 0;
17.28 if str = "[c, c_2] from [c, c_2,\n" ^
17.29 " c_3] occur_exactly_in -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2 = True"
17.30 then () else error "eval_occur_exactly_in [c, c_2]";
17.31
17.32 -val t = str2term ("[c,c_2,c_3] from [c,c_2,c_3] occur_exactly_in " ^
17.33 +val t = TermC.str2term ("[c,c_2,c_3] from [c,c_2,c_3] occur_exactly_in " ^
17.34 "-1 * q_0 * L ^^^ 2 / 2 + L * c + c_2");
17.35 val SOME (str, t') = eval_occur_exactly_in 0 "EqSystem.occur'_exactly'_in" t 0;
17.36 if str = "[c, c_2,\n c_3] from [c, c_2,\n" ^
17.37 " c_3] occur_exactly_in -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2 = False"
17.38 then () else error "eval_occur_exactly_in [c, c_2, c_3]";
17.39
17.40 -val t = str2term"[c_2] from [c,c_2,c_3] occur_exactly_in \
17.41 +val t = TermC.str2term"[c_2] from [c,c_2,c_3] occur_exactly_in \
17.42 \-1 * q_0 * L ^^^ 2 / 2 + L * c + c_2";
17.43 val SOME (str, t') = eval_occur_exactly_in 0 "EqSystem.occur'_exactly'_in" t 0;
17.44 if str = "[c_2] from [c, c_2,\n" ^
17.45 " c_3] occur_exactly_in -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2 = False"
17.46 then () else error "eval_occur_exactly_in [c, c_2, c_3]";
17.47
17.48 -val t = str2term"[] from [c,c_2,c_3] occur_exactly_in 0";
17.49 +val t = TermC.str2term"[] from [c,c_2,c_3] occur_exactly_in 0";
17.50 val SOME (str, t') = eval_occur_exactly_in 0 "EqSystem.occur'_exactly'_in" t 0;
17.51 if str = "[] from [c, c_2, c_3] occur_exactly_in 0 = True" then ()
17.52 else error "eval_occur_exactly_in [c, c_2, c_3]";
17.53
17.54 val t =
17.55 - str2term
17.56 + TermC.str2term
17.57 "[] from [c, c_2, c_3, c_4] occur_exactly_in -1 * (q_0 * L ^^^ 2) /2";
17.58 val SOME (str, t') = eval_occur_exactly_in 0 "EqSystem.occur'_exactly'_in" t 0;
17.59 if str = "[] from [c, c_2, c_3, c_4] occur_exactly_in \
17.60 @@ -80,8 +80,8 @@
17.61 "----------- problems --------------------------------------------";
17.62 "----------- problems --------------------------------------------";
17.63 "----------- problems --------------------------------------------";
17.64 -val t = str2term "Length [x+y=1,y=2] = 2";
17.65 -atomty t;
17.66 +val t = TermC.str2term "Length [x+y=1,y=2] = 2";
17.67 +TermC.atomty t;
17.68 val testrls = Rule_Set.append_rules "testrls" Rule_Set.empty
17.69 [(Thm ("LENGTH_NIL",ThmC.numerals_to_Free @{thm LENGTH_NIL})),
17.70 (Thm ("LENGTH_CONS",ThmC.numerals_to_Free @{thm LENGTH_CONS})),
17.71 @@ -92,15 +92,15 @@
17.72 if UnparseC.term t' = "True" then ()
17.73 else error "eqsystem.sml: length_ [x+y=1,y=2] = 2";
17.74
17.75 -val SOME t = parse thy "solution LL";
17.76 -atomty (Thm.term_of t);
17.77 -val SOME t = parse thy "solution LL";
17.78 -atomty (Thm.term_of t);
17.79 +val SOME t = TermC.parse thy "solution LL";
17.80 +TermC.atomty (Thm.term_of t);
17.81 +val SOME t = TermC.parse thy "solution LL";
17.82 +TermC.atomty (Thm.term_of t);
17.83
17.84 -val t = str2term
17.85 +val t = TermC.str2term
17.86 "(tl (tl (tl v_s))) from v_s occur_exactly_in (NTH 1 (e_s::bool list))";
17.87 -atomty t;
17.88 -val t = str2term ("(tl (tl (tl [c, c_2, c_3, c_4]))) from [c, c_2, c_3, c_4] occur_exactly_in " ^
17.89 +TermC.atomty t;
17.90 +val t = TermC.str2term ("(tl (tl (tl [c, c_2, c_3, c_4]))) from [c, c_2, c_3, c_4] occur_exactly_in " ^
17.91 "(NTH 1 [c_4 = 1, 2 = 2, 3 = 3, 4 = 4])");
17.92 val SOME (t,_) =
17.93 rewrite_set_ thy true
17.94 @@ -119,39 +119,39 @@
17.95 "----------- rewrite-order ord_simplify_System -------------------";
17.96 "M_b x = c * x + -1 * q_0 * (x ^^^ 2 / 2) + c_2";
17.97 "--- add.commute ---"; (* ... add.commute cf. b42e334c97ee *)
17.98 -if ord_simplify_System false thy [] (str2term"-1 * q_0 * (x ^^^ 2 / 2)",
17.99 - str2term"c * x") then ()
17.100 +if ord_simplify_System false thy [] (TermC.str2term"-1 * q_0 * (x ^^^ 2 / 2)",
17.101 + TermC.str2term"c * x") then ()
17.102 else error "integrate.sml, (-1 * q_0 * (x ^^^ 2 / 2)) < (c * x) not#1";
17.103
17.104 -if ord_simplify_System false thy [] (str2term"-1 * q_0 * (x ^^^ 2 / 2)",
17.105 - str2term"c_2") then ()
17.106 +if ord_simplify_System false thy [] (TermC.str2term"-1 * q_0 * (x ^^^ 2 / 2)",
17.107 + TermC.str2term"c_2") then ()
17.108 else error "integrate.sml, (-1 * q_0 * (x ^^^ 2 / 2)) < (c_2) not#2";
17.109
17.110 -if ord_simplify_System false thy [] (str2term"c * x",
17.111 - str2term"c_2") then ()
17.112 +if ord_simplify_System false thy [] (TermC.str2term"c * x",
17.113 + TermC.str2term"c_2") then ()
17.114 else error "integrate.sml, (c * x) < (c_2) not#3";
17.115
17.116 "--- mult.commute ---";
17.117 -if ord_simplify_System false thy [] (str2term"x * c",
17.118 - str2term"c * x") then ()
17.119 +if ord_simplify_System false thy [] (TermC.str2term"x * c",
17.120 + TermC.str2term"c * x") then ()
17.121 else error "integrate.sml, (x * c) < (c * x) not#4";
17.122
17.123 -if ord_simplify_System false thy [] (str2term"-1 * q_0 * (x ^^^ 2 / 2) * c",
17.124 - str2term"-1 * q_0 * c * (x ^^^ 2 / 2)")
17.125 +if ord_simplify_System false thy [] (TermC.str2term"-1 * q_0 * (x ^^^ 2 / 2) * c",
17.126 + TermC.str2term"-1 * q_0 * c * (x ^^^ 2 / 2)")
17.127 then () else error "integrate.sml, (. * .) < (. * .) not#5";
17.128
17.129 -if ord_simplify_System false thy [] (str2term"-1 * q_0 * (x ^^^ 2 / 2) * c",
17.130 - str2term"c * -1 * q_0 * (x ^^^ 2 / 2)")
17.131 +if ord_simplify_System false thy [] (TermC.str2term"-1 * q_0 * (x ^^^ 2 / 2) * c",
17.132 + TermC.str2term"c * -1 * q_0 * (x ^^^ 2 / 2)")
17.133 then () else error "integrate.sml, (. * .) < (. * .) not#6";
17.134
17.135
17.136 "----------- rewrite in [EqSystem,normalise,2x2] -----------------";
17.137 "----------- rewrite in [EqSystem,normalise,2x2] -----------------";
17.138 "----------- rewrite in [EqSystem,normalise,2x2] -----------------";
17.139 -val t = str2term"[0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2,\
17.140 +val t = TermC.str2term"[0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2,\
17.141 \0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2]";
17.142 -val bdvs = [(str2term"bdv_1",str2term"c"),
17.143 - (str2term"bdv_2",str2term"c_2")];
17.144 +val bdvs = [(TermC.str2term"bdv_1",TermC.str2term"c"),
17.145 + (TermC.str2term"bdv_2",TermC.str2term"c_2")];
17.146 val SOME(t,_)= rewrite_set_inst_ thy true bdvs simplify_System_parenthesized t;
17.147 if UnparseC.term t = "[0 = -1 * q_0 * L ^^^ 2 / 2 + (L * c + c_2), 0 = c_2]"
17.148 then () else error "eqsystem.sml rewrite in 2x2 simplify_System_par.1";
17.149 @@ -174,7 +174,7 @@
17.150 "----------- rewrite example from 2nd [EqSystem,normalise,2x2] ---";
17.151 val thy = @{theory "Isac_Knowledge"} (*because of Undeclared constant "Biegelinie.EI*);
17.152 val t =
17.153 - str2term"[0 = c_2 + c * 0 + 1 / EI * (L * q_0 / 12 * 0 ^^^ 3 + \
17.154 + TermC.str2term"[0 = c_2 + c * 0 + 1 / EI * (L * q_0 / 12 * 0 ^^^ 3 + \
17.155 \ -1 * q_0 / 24 * 0 ^^^ 4),\
17.156 \ 0 = c_2 + c * L + 1 / EI * (L * q_0 / 12 * L ^^^ 3 + \
17.157 \ -1 * q_0 / 24 * L ^^^ 4)]";
17.158 @@ -206,10 +206,10 @@
17.159 "----------- rewrite in [EqSystem,top_down_substitution,2x2] -----";
17.160 "----------- rewrite in [EqSystem,top_down_substitution,2x2] -----";
17.161 "----------- rewrite in [EqSystem,top_down_substitution,2x2] -----";
17.162 -val e1__ = str2term "c_2 = 77";
17.163 -val e2__ = str2term "L * c + c_2 = q_0 * L ^^^ 2 / 2";
17.164 -val bdvs = [(str2term"bdv_1",str2term"c"),
17.165 - (str2term"bdv_2",str2term"c_2")];
17.166 +val e1__ = TermC.str2term "c_2 = 77";
17.167 +val e2__ = TermC.str2term "L * c + c_2 = q_0 * L ^^^ 2 / 2";
17.168 +val bdvs = [(TermC.str2term"bdv_1",TermC.str2term"c"),
17.169 + (TermC.str2term"bdv_2",TermC.str2term"c_2")];
17.170 val SOME (e2__,_) = rewrite_terms_ thy dummy_ord Rule_Set.Empty [e1__] e2__;
17.171 if UnparseC.term e2__ = "L * c + 77 = q_0 * L ^^^ 2 / 2" then ()
17.172 else error "eqsystem.sml top_down_substitution,2x2] subst";
17.173 @@ -223,15 +223,15 @@
17.174 if UnparseC.term e2__ = "c = (q_0 * L ^^^ 2 / 2 + -1 * 77) / L" then ()
17.175 else error "eqsystem.sml top_down_substitution,2x2] isolate";
17.176
17.177 -val t = str2term "[c_2 = 77, c = (q_0 * L ^^^ 2 / 2 + -1 * 77) / L]";
17.178 +val t = TermC.str2term "[c_2 = 77, c = (q_0 * L ^^^ 2 / 2 + -1 * 77) / L]";
17.179 val SOME (t,_) = rewrite_set_ thy true order_system t;
17.180 if UnparseC.term t = "[c = (q_0 * L ^^^ 2 / 2 + -1 * 77) / L, c_2 = 77]" then ()
17.181 else error "eqsystem.sml top_down_substitution,2x2] order_system";
17.182
17.183 if not (ord_simplify_System
17.184 false thy []
17.185 - (str2term"[c_2 = 77, c = (q_0 * L ^^^ 2 / 2 + -1 * 77) / L]",
17.186 - str2term"[c = (q_0 * L ^^^ 2 / 2 + -1 * 77) / L, c_2 = 77]"))
17.187 + (TermC.str2term"[c_2 = 77, c = (q_0 * L ^^^ 2 / 2 + -1 * 77) / L]",
17.188 + TermC.str2term"[c = (q_0 * L ^^^ 2 / 2 + -1 * 77) / L, c_2 = 77]"))
17.189 then () else error "eqsystem.sml, order_result rew_ord";
17.190
17.191
17.192 @@ -239,14 +239,14 @@
17.193 "----------- rewrite in [EqSystem,normalise,4x4] -----------------";
17.194 "----------- rewrite in [EqSystem,normalise,4x4] -----------------";
17.195 (*STOPPED.WN06?: revise rewrite in [EqSystem,normalise,4x4] from before 0609*)
17.196 -val t = str2term"[0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c_3 + c_4,\
17.197 +val t = TermC.str2term"[0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c_3 + c_4,\
17.198 \0 = -1 * q_0 * L ^^^ 2 / 2 + L * c_3 + c_4,\
17.199 \c + c_2 + c_3 + c_4 = 0,\
17.200 \c_2 + c_3 + c_4 = 0]";
17.201 -val bdvs = [(str2term"bdv_1",str2term"c"),
17.202 - (str2term"bdv_2",str2term"c_2"),
17.203 - (str2term"bdv_3",str2term"c_3"),
17.204 - (str2term"bdv_4",str2term"c_4")];
17.205 +val bdvs = [(TermC.str2term"bdv_1",TermC.str2term"c"),
17.206 + (TermC.str2term"bdv_2",TermC.str2term"c_2"),
17.207 + (TermC.str2term"bdv_3",TermC.str2term"c_3"),
17.208 + (TermC.str2term"bdv_4",TermC.str2term"c_4")];
17.209 val SOME (t,_) =
17.210 rewrite_set_inst_ thy true bdvs simplify_System_parenthesized t;
17.211 if UnparseC.term t = "[0 = c_4, 0 = -1 * q_0 * L ^^^ 2 / 2 + (L * c_3 + c_4),\n\
17.212 @@ -314,8 +314,8 @@
17.213 Operand: L :: real ========== L was already present in equalities ========== *)
17.214
17.215 "===== case 1 =====";
17.216 -val matches = Refine.refine fmz ["LINEAR", "system"];
17.217 -case matches of
17.218 +val TermC.matches = Refine.refine fmz ["LINEAR", "system"];
17.219 +case TermC.matches of
17.220 [M_Match.Matches (["LINEAR", "system"], _),
17.221 M_Match.Matches (["2x2", "LINEAR", "system"], _),
17.222 M_Match.NoMatch (["triangular", "2x2", "LINEAR", "system"], _),
17.223 @@ -333,8 +333,8 @@
17.224 "===== case 2 =====";
17.225 val fmz = ["equalities [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]",
17.226 "solveForVars [c, c_2]", "solution LL"];
17.227 -val matches = Refine.refine fmz ["LINEAR", "system"];
17.228 -case matches of [_,_,
17.229 +val TermC.matches = Refine.refine fmz ["LINEAR", "system"];
17.230 +case TermC.matches of [_,_,
17.231 M_Match.Matches
17.232 (["triangular", "2x2", "LINEAR", "system"],
17.233 {Find = [Correct "solution LL"],
17.234 @@ -350,15 +350,15 @@
17.235 | _ => error "eqsystem.sml Refine.refine ['triangular','2x2'...]";
17.236
17.237 (*WN051014----------------------------------------------------------------
17.238 - the above 'val matches = Refine.refine fmz ["LINEAR", "system"]'
17.239 + the above 'val TermC.matches = Refine.refine fmz ["LINEAR", "system"]'
17.240 didn't work anymore; we investigated in these steps:*)
17.241 val fmz = ["equalities [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]",
17.242 "solveForVars [c, c_2]", "solution LL"];
17.243 -val matches = Refine.refine fmz ["triangular", "2x2", "LINEAR", "system"];
17.244 +val TermC.matches = Refine.refine fmz ["triangular", "2x2", "LINEAR", "system"];
17.245 (*... resulted in
17.246 False "[c, c_2] from_ [c, c_2] occur_exactly_in nth_ 2\n
17.247 [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]"]*)
17.248 -val t = str2term ("[c, c_2] from [c, c_2] occur_exactly_in NTH 2" ^
17.249 +val t = TermC.str2term ("[c, c_2] from [c, c_2] occur_exactly_in NTH 2" ^
17.250 "[c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]");
17.251 Rewrite.trace_on := false;
17.252 val SOME (t',_) = rewrite_set_ thy false prls_triangular t;
17.253 @@ -389,8 +389,8 @@
17.254 Operator: op # c_3 :: 'a list \<Rightarrow> 'a list
17.255 Operand: [c_4] :: 'b list
17.256 \-------------------------------------------------------/
17.257 -val matches = Refine.refine fmz ["LINEAR", "system"];
17.258 -case matches of
17.259 +val TermC.matches = Refine.refine fmz ["LINEAR", "system"];
17.260 +case TermC.matches of
17.261 [M_Match.Matches (["LINEAR", "system"], _),
17.262 M_Match.NoMatch (["2x2", "LINEAR", "system"], _),
17.263 M_Match.NoMatch (["3x3", "LINEAR", "system"], _),
17.264 @@ -406,11 +406,11 @@
17.265 \ 0 = c_3, \
17.266 \ 0 = c_4]",
17.267 "solveForVars [c, c_2, c_3, c_4]", "solution LL"];
17.268 -val matches = Refine.refine fmz ["triangular", "4x4", "LINEAR", "system"];
17.269 -case matches of
17.270 +val TermC.matches = Refine.refine fmz ["triangular", "4x4", "LINEAR", "system"];
17.271 +case TermC.matches of
17.272 [M_Match.Matches (["triangular", "4x4", "LINEAR", "system"], _)] => ()
17.273 | _ => error "eqsystem.sml: Refine.refine relaxed triangular sys M_Match.NoMatch";
17.274 -val matches = Refine.refine fmz ["LINEAR", "system"];
17.275 +val TermC.matches = Refine.refine fmz ["LINEAR", "system"];
17.276 ============ inhibit exn WN120314 ==============================================*)
17.277
17.278 "----------- Refine.refine [2x2,linear,system] search error--------------";
17.279 @@ -422,9 +422,9 @@
17.280 \0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2]",
17.281 "solveForVars [c, c_2]", "solution LL"];
17.282 Rewrite.trace_on := false;
17.283 -val matches = Refine.refine fmz ["2x2", "LINEAR", "system"];
17.284 +val TermC.matches = Refine.refine fmz ["2x2", "LINEAR", "system"];
17.285 Rewrite.trace_on:=false;
17.286 -(*default_print_depth 11;*) matches; (*default_print_depth 3;*)
17.287 +(*default_print_depth 11;*) TermC.matches; (*default_print_depth 3;*)
17.288 (*brought: 'False "length_ es_ = 2"'*)
17.289
17.290 (*-----fun refin' (pblRD:Problem.id_reverse) fmz pbls ((Store.Node (pI,[py],[])):pbt Store.store) =
17.291 @@ -449,7 +449,7 @@
17.292 *)
17.293 > val [("#Given", [equalities_es_, "solveForVars v_s"])] = gi;
17.294 val equalities_es_ = "equalities es_" : string
17.295 -> val (dd, ii) = (split_did o Thm.term_of o the o (parse thy)) equalities_es_;
17.296 +> val (dd, ii) = (split_did o Thm.term_of o the o (TermC.parse thy)) equalities_es_;
17.297 > show_types:=true; UnparseC.term ii; show_types:=false;
17.298 val it = "es_::bool list" : string
17.299 ~~~~~~~~~~~~~~~^^^^^^^^^ OK~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17.300 @@ -491,7 +491,7 @@
17.301 val es_ = Free ("es_", "bool List.list") : Term.term
17.302
17.303 > val pre1 = hd pres;
17.304 -atomty pre1;
17.305 +TermC.atomty pre1;
17.306 ***
17.307 *** Const (op =, [real, real] => bool)
17.308 *** . Const (ListG.length_, real list => real)
17.309 @@ -642,8 +642,8 @@
17.310 "----------- all systems from Biegelinie -------------------------";
17.311 val thy = @{theory Isac_Knowledge}
17.312 val subst =
17.313 - [(str2term "bdv_1", str2term "c"), (str2term "bdv_2", str2term "c_2"),
17.314 - (str2term "bdv_3", str2term "c_3"), (str2term "bdv_4", str2term "c_4")];
17.315 + [(TermC.str2term "bdv_1", TermC.str2term "c"), (TermC.str2term "bdv_2", TermC.str2term "c_2"),
17.316 + (TermC.str2term "bdv_3", TermC.str2term "c_3"), (TermC.str2term "bdv_4", TermC.str2term "c_4")];
17.317
17.318 "------- Bsp 7.27";
17.319 reset_states ();
17.320 @@ -659,7 +659,7 @@
17.321 c c_2 c_3 c_4 c c_2 1->2: c
17.322 c_2 c_4
17.323 c c_2 c c_2 c_3 c_4 [2':c, 1:c_2, 3:c_4] -> 4:c_3*)
17.324 -val t = str2term
17.325 +val t = TermC.str2term
17.326 ("[0 = c_4, " ^
17.327 "0 = c_4 + L * c_3 +(12 * L ^^^ 2 * c_2 + 4 * L ^^^ 3 * c + -1 * L ^^^ 4 * q_0) / (-24 * EI), " ^
17.328 "0 = c_2, " ^
17.329 @@ -670,7 +670,7 @@
17.330 then () else error "Bsp 7.27";
17.331
17.332 "----- Bsp 7.27 go through the rewrites in met_eqsys_norm_4x4";
17.333 -val t = str2term "0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2";
17.334 +val t = TermC.str2term "0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2";
17.335 val NONE = rewrite_set_ thy false norm_Rational t;
17.336 val SOME (t,_) =
17.337 rewrite_set_inst_ thy false subst simplify_System_parenthesized t;
17.338 @@ -715,7 +715,7 @@
17.339 c c_2 c_3 c_4 c c_2 c_3 1:c_3 -> 2:c c_2 2: c c_2
17.340 c_3 c_4
17.341 c c_2 c_3 c c_2 c_3 c_4 3:c_4 -> 4:c c_2 c_3 1:c_3 -> 4:c c_2*)
17.342 -val t = str2term
17.343 +val t = TermC.str2term
17.344 ("[0 = c_4 + 0 / (-1 * EI), " ^
17.345 "0 = c_4 + L * c_3 + (12 * L ^^^ 2 * c_2 + 4 * L ^^^ 3 * c + -1 * L ^^^ 4 * q_0) / (-24 * EI), " ^
17.346 "0 = c_3 + 0 / (-1 * EI), " ^
17.347 @@ -737,7 +737,7 @@
17.348 c_4 | STOPPED.WN06? test methods @@@@@@@@@@@@@@@@@@@@@@@*)
17.349
17.350 "----- 7.70 go through the rewrites in met_eqsys_norm_4x4";
17.351 -val t = str2term
17.352 +val t = TermC.str2term
17.353 ("[L * q_0 = c, " ^
17.354 "0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2, " ^
17.355 "0 = c_4, " ^
17.356 @@ -852,7 +852,7 @@
17.357 c_4 | c_3 |2:c_3 -> 4' :c c_2 c_4 | |
17.358 c c_2 c_3 c_4 | c_4 |3' | |
17.359 c_3 |c c_2 c_3 c_4 |3:c_4 -> 4'':c c_2 |4'':c c_2 | *)
17.360 -val t = str2term"[0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2, \
17.361 +val t = TermC.str2term"[0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2, \
17.362 \ 0 = c_4 + 0 / (-1 * EI), \
17.363 \ 0 = c_4 + L * c_3 +(12 * L ^^^ 2 * c_2 + 4 * L ^^^ 3 * c + -1 * L ^^^ 4 * q_0) /(-24 * EI),\
17.364 \ 0 = c_3 + 0 / (-1 * EI)]";
17.365 @@ -887,7 +887,7 @@
17.366 c c_2 | |1:c_2 -> 2':c |c_2 c
17.367 c_4 | | |
17.368 c c_2 c_3 c_4 | |3:c_4 -> 4':c c_2 c_3 |c_2 c c_3*)
17.369 -val t = str2term"[0 = c_2, \
17.370 +val t = TermC.str2term"[0 = c_2, \
17.371 \ 0 = (6 * c_2 + 6 * L * c + -1 * L ^^^ 2 * q_0) / 6, \
17.372 \ 0 = c_4 + 0 / (-1 * EI), \
17.373 \ 0 = c_4 + L * c_3 + (60 * L ^^^ 2 * c_2 + 20 * L ^^^ 3 * c + -1 * L ^^^ 4 * q_0) / (-120 * EI)]";
18.1 --- a/test/Tools/isac/Knowledge/integrate.sml Mon Apr 19 13:57:47 2021 +0200
18.2 +++ b/test/Tools/isac/Knowledge/integrate.sml Mon Apr 19 15:02:11 2021 +0200
18.3 @@ -7,7 +7,7 @@
18.4 "--------------------------------------------------------";
18.5 "----------- parsing ------------------------------------";
18.6 "----------- integrate by rewriting ---------------------";
18.7 -"----------- test add_new_c, is_f_x ---------------------";
18.8 +"----------- test add_new_c, TermC.is_f_x ---------------------";
18.9 "----------- simplify by ruleset reducing make_ratpoly_in";
18.10 "----------- integrate by ruleset -----------------------";
18.11 "----------- rewrite 3rd integration in 7.27 ------------";
18.12 @@ -58,9 +58,9 @@
18.13 (Const ("Prog_Expr.pow", _) $ Free _ $ Free _) $ Free ("x", _) => ()
18.14 | _ => error "integrate.sml: parsing: Integral x^^^2 D x";
18.15
18.16 -val t = str2t "ff x is_f_x";
18.17 +val t = str2t "ff x TermC.is_f_x";
18.18 case t of Const ("Integrate.is'_f'_x", _) $ _ => ()
18.19 - | _ => error "integrate.sml: parsing: ff x is_f_x";
18.20 + | _ => error "integrate.sml: parsing: ff x TermC.is_f_x";
18.21
18.22
18.23 "----------- integrate by rewriting ---------------------";
18.24 @@ -90,9 +90,9 @@
18.25 else error "integrate.sml Integral x^^^3 D x";
18.26
18.27
18.28 -"----------- test add_new_c, is_f_x ---------------------";
18.29 -"----------- test add_new_c, is_f_x ---------------------";
18.30 -"----------- test add_new_c, is_f_x ---------------------";
18.31 +"----------- test add_new_c, TermC.is_f_x ---------------------";
18.32 +"----------- test add_new_c, TermC.is_f_x ---------------------";
18.33 +"----------- test add_new_c, TermC.is_f_x ---------------------";
18.34 val term = str2t "x^^^2 * c + c_2";
18.35 val cc = new_c term;
18.36 if UnparseC.term cc = "c_3" then () else error "integrate.sml: new_c ???";
18.37 @@ -120,24 +120,24 @@
18.38 if term2s t' = "new_c c * x ^^^ 2 + c_2 = c_3" then ()
18.39 else error "integrate.sml: eval_new_c ???";
18.40
18.41 -val t = str2t "matches (?u + new_c ?v) (x ^^^ 2 / 2)";
18.42 -val SOME (_,t') = eval_matches "" "Prog_Expr.matches" t thy; term2s t';
18.43 -if term2s t' = "matches (?u + new_c ?v) (x ^^^ 2 / 2) = False" then ()
18.44 -else error "integrate.sml: matches new_c = False";
18.45 +val t = str2t "TermC.matches (?u + new_c ?v) (x ^^^ 2 / 2)";
18.46 +val SOME (_,t') = eval_matches "" "Prog_Expr.TermC.matches" t thy; term2s t';
18.47 +if term2s t' = "TermC.matches (?u + new_c ?v) (x ^^^ 2 / 2) = False" then ()
18.48 +else error "integrate.sml: TermC.matches new_c = False";
18.49
18.50 -val t = str2t "matches (?u + new_c ?v) (x ^^^ 2 / 2 + new_c x ^^^ 2 / 2)";
18.51 -val SOME (_,t') = eval_matches "" "Prog_Expr.matches" t thy; term2s t';
18.52 -if term2s t'="matches (?u + new_c ?v) (x ^^^ 2 / 2 + new_c x ^^^ 2 / 2) = True"
18.53 -then () else error "integrate.sml: matches new_c = True";
18.54 +val t = str2t "TermC.matches (?u + new_c ?v) (x ^^^ 2 / 2 + new_c x ^^^ 2 / 2)";
18.55 +val SOME (_,t') = eval_matches "" "Prog_Expr.TermC.matches" t thy; term2s t';
18.56 +if term2s t'="TermC.matches (?u + new_c ?v) (x ^^^ 2 / 2 + new_c x ^^^ 2 / 2) = True"
18.57 +then () else error "integrate.sml: TermC.matches new_c = True";
18.58
18.59 -val t = str2t "ff x is_f_x";
18.60 +val t = str2t "ff x TermC.is_f_x";
18.61 val SOME (_,t') = eval_is_f_x "" "" t thy; term2s t';
18.62 -if term2s t' = "(ff x is_f_x) = True" then ()
18.63 +if term2s t' = "(ff x TermC.is_f_x) = True" then ()
18.64 else error "integrate.sml: eval_is_f_x --> true";
18.65
18.66 -val t = str2t "q_0/2 * L * x is_f_x";
18.67 +val t = str2t "q_0/2 * L * x TermC.is_f_x";
18.68 val SOME (_,t') = eval_is_f_x "" "" t thy; term2s t';
18.69 -if term2s t' = "(q_0 / 2 * L * x is_f_x) = False" then ()
18.70 +if term2s t' = "(q_0 / 2 * L * x TermC.is_f_x) = False" then ()
18.71 else error "integrate.sml: eval_is_f_x --> false";
18.72
18.73 val conditions_in_integration =
18.74 @@ -146,7 +146,7 @@
18.75 rew_ord = ("termlessI",termlessI),
18.76 erls = Rule_Set.Empty,
18.77 srls = Rule_Set.Empty, calc = [], errpatts = [],
18.78 - rules = [Eval ("Prog_Expr.matches",eval_matches ""),
18.79 + rules = [Eval ("Prog_Expr.TermC.matches",eval_matches ""),
18.80 Eval ("Integrate.is'_f'_x",
18.81 eval_is_f_x "is_f_x_"),
18.82 Thm ("not_true",ThmC.numerals_to_Free @{thm not_true}),
18.83 @@ -173,7 +173,7 @@
18.84 "----------- simplify by ruleset reducing make_ratpoly_in";
18.85 val thy = @{theory "Isac_Knowledge"};
18.86 "===== test 1";
18.87 -val t = str2term "1/EI * (L * q_0 * x / 2 + -1 * q_0 * x^^^2 / 2)";
18.88 +val t = TermC.str2term "1/EI * (L * q_0 * x / 2 + -1 * q_0 * x^^^2 / 2)";
18.89
18.90 "----- stepwise from the rulesets in simplify_Integral and below-----";
18.91 val rls = norm_Rational_noadd_fractions;
18.92 @@ -253,52 +253,52 @@
18.93 val subs = [(@{term "bdv::real"}, @{term "x::real"})];
18.94 (*~~~~~~~~~~~~~~~~~~~~~~~~~~~*)
18.95
18.96 -val t = (Thm.term_of o the o (parse thy)) "Integral x D x";
18.97 +val t = (Thm.term_of o the o (TermC.parse thy)) "Integral x D x";
18.98 val SOME (res, _) = rewrite_set_inst_ thy true subs rls t;
18.99 if UnparseC.term res = "x ^^^ 2 / 2" then () else error "Integral x D x changed";
18.100
18.101 -val t = (Thm.term_of o the o (parse thy)) "Integral c * x ^^^ 2 + c_2 D x";
18.102 +val t = (Thm.term_of o the o (TermC.parse thy)) "Integral c * x ^^^ 2 + c_2 D x";
18.103 val SOME (res, _) = rewrite_set_inst_ thy true subs rls t;
18.104 if UnparseC.term res = "c * (x ^^^ 3 / 3) + c_2 * x" then () else error "Integral c * x ^^^ 2 + c_2 D x";
18.105
18.106 val rls = add_new_c;
18.107 -val t = (Thm.term_of o the o (parse thy)) "c * (x ^^^ 3 / 3) + c_2 * x";
18.108 +val t = (Thm.term_of o the o (TermC.parse thy)) "c * (x ^^^ 3 / 3) + c_2 * x";
18.109 val SOME (res, _) = rewrite_set_inst_ thy true subs rls t;
18.110 if UnparseC.term res = "c * (x ^^^ 3 / 3) + c_2 * x + c_3" then ()
18.111 else error "integrate.sml: diff.behav. in add_new_c simpl.";
18.112
18.113 -val t = (Thm.term_of o the o (parse thy)) "F x = x ^^^ 3 / 3 + x";
18.114 +val t = (Thm.term_of o the o (TermC.parse thy)) "F x = x ^^^ 3 / 3 + x";
18.115 val SOME (res, _) = rewrite_set_inst_ thy true subs rls t;
18.116 if UnparseC.term res = "F x = x ^^^ 3 / 3 + x + c"(*not "F x + c =..."*) then ()
18.117 else error "integrate.sml: diff.behav. in add_new_c equation";
18.118
18.119 val rls = simplify_Integral;
18.120 (*~~~~~~~~~~~~~~~~~~~~~~~~~~~*)
18.121 -val t = (Thm.term_of o the o (parse thy)) "ff x = c * x + -1 * q_0 * (x ^^^ 2 / 2) + c_2";
18.122 +val t = (Thm.term_of o the o (TermC.parse thy)) "ff x = c * x + -1 * q_0 * (x ^^^ 2 / 2) + c_2";
18.123 val SOME (res, _) = rewrite_set_inst_ thy true subs rls t;
18.124 if UnparseC.term res = "ff x = c_2 + c * x + -1 * q_0 / 2 * x ^^^ 2"
18.125 then () else error "integrate.sml: diff.behav. in simplify_I #1";
18.126
18.127 val rls = integration;
18.128 (*~~~~~~~~~~~~~~~~~~~~~~~~~~~*)
18.129 -val t = (Thm.term_of o the o (parse thy)) "Integral c * x ^^^ 2 + c_2 D x";
18.130 +val t = (Thm.term_of o the o (TermC.parse thy)) "Integral c * x ^^^ 2 + c_2 D x";
18.131 val SOME (res, _) = rewrite_set_inst_ thy true subs rls t;
18.132 if UnparseC.term res = "c_3 + c_2 * x + c / 3 * x ^^^ 3"
18.133 then () else error "integrate.sml: diff.behav. in integration #1";
18.134
18.135 -val t = (Thm.term_of o the o (parse thy)) "Integral 3*x^^^2 + 2*x + 1 D x";
18.136 +val t = (Thm.term_of o the o (TermC.parse thy)) "Integral 3*x^^^2 + 2*x + 1 D x";
18.137 val SOME (res, _) = rewrite_set_inst_ thy true subs rls t;
18.138 if UnparseC.term res = "c + x + x ^^^ 2 + x ^^^ 3" then ()
18.139 else error "integrate.sml: diff.behav. in integration #2";
18.140
18.141 -val t = (Thm.term_of o the o (parse thy))
18.142 +val t = (Thm.term_of o the o (TermC.parse thy))
18.143 "Integral 1 / EI * (L * q_0 / 2 * x + -1 * q_0 / 2 * x ^^^ 2) D x";
18.144 val SOME (res, _) = rewrite_set_inst_ thy true subs rls t;
18.145 "Integral 1 / EI * (L * q_0 / 2 * x + -1 * q_0 / 2 * x ^^^ 2) D x";
18.146 if UnparseC.term res = "c + 1 / EI * (L * q_0 / 4 * x ^^^ 2 + -1 * q_0 / 6 * x ^^^ 3)"
18.147 then () else error "integrate.sml: diff.behav. in integration #3";
18.148
18.149 -val t = (Thm.term_of o the o (parse thy)) ("Integral " ^ UnparseC.term res ^ " D x");
18.150 +val t = (Thm.term_of o the o (TermC.parse thy)) ("Integral " ^ UnparseC.term res ^ " D x");
18.151 val SOME (res, _) = rewrite_set_inst_ thy true subs rls t;
18.152 if UnparseC.term res = "c_2 + c * x + 1 / EI * (L * q_0 / 12 * x ^^^ 3 + -1 * q_0 / 24 * x ^^^ 4)"
18.153 then () else error "integrate.sml: diff.behav. in integration #4";
18.154 @@ -328,7 +328,7 @@
18.155 Find =["antiDerivative F_F"],
18.156 With =[],
18.157 Relate=[]}:string ppc;
18.158 -val chkmodel = ((map (the o (parse thy))) o P_Model.to_list) model;
18.159 +val chkmodel = ((map (the o (TermC.parse thy))) o P_Model.to_list) model;
18.160 val t1 = (Thm.term_of o hd) chkmodel;
18.161 val t2 = (Thm.term_of o hd o tl) chkmodel;
18.162 val t3 = (Thm.term_of o hd o tl o tl) chkmodel;
18.163 @@ -340,7 +340,7 @@
18.164 Find =["antiDerivativeName F_F"],
18.165 With =[],
18.166 Relate=[]}:string ppc;
18.167 -val chkmodel = ((map (the o (parse thy))) o P_Model.to_list) model;
18.168 +val chkmodel = ((map (the o (TermC.parse thy))) o P_Model.to_list) model;
18.169 val t1 = (Thm.term_of o hd) chkmodel;
18.170 val t2 = (Thm.term_of o hd o tl) chkmodel;
18.171 val t3 = (Thm.term_of o hd o tl o tl) chkmodel;
19.1 --- a/test/Tools/isac/Knowledge/logexp.sml Mon Apr 19 13:57:47 2021 +0200
19.2 +++ b/test/Tools/isac/Knowledge/logexp.sml Mon Apr 19 15:02:11 2021 +0200
19.3 @@ -29,10 +29,10 @@
19.4 ["equation", "test"]; *)
19.5 *)
19.6
19.7 -val t = str2term "(2 log x)";
19.8 -val t = str2term "(2 log x) = 3";
19.9 -val t = str2term "matches ((?a log x) = ?b) ((2 log x) = 3)";
19.10 -atomty t;
19.11 +val t = TermC.str2term "(2 log x)";
19.12 +val t = TermC.str2term "(2 log x) = 3";
19.13 +val t = TermC.str2term "TermC.matches ((?a log x) = ?b) ((2 log x) = 3)";
19.14 +TermC.atomty t;
19.15
19.16
19.17 val fmz = ["equality ((2 log x) = 3)", "solveFor x", "solutions L"];
20.1 --- a/test/Tools/isac/Knowledge/partial_fractions.sml Mon Apr 19 13:57:47 2021 +0200
20.2 +++ b/test/Tools/isac/Knowledge/partial_fractions.sml Mon Apr 19 15:02:11 2021 +0200
20.3 @@ -272,7 +272,7 @@
20.4 "----------- progr.vers.2: check erls for multiply_ansatz";
20.5 "----------- progr.vers.2: check erls for multiply_ansatz";
20.6 (*test for outcommented 3 lines in script: is norm_Rational strong enough?*)
20.7 -val t = str2term "(3 / ((-1 + -2 * z + 8 * z ^^^ 2) *3/24)) = (3 / ((z - 1 / 2) * (z - -1 / 4)))";
20.8 +val t = TermC.str2term "(3 / ((-1 + -2 * z + 8 * z ^^^ 2) *3/24)) = (3 / ((z - 1 / 2) * (z - -1 / 4)))";
20.9 val SOME (t', _) = rewrite_set_ @{theory Isac_Knowledge} true ansatz_rls t;
20.10 UnparseC.term t' = "3 / ((-1 + -2 * z + 8 * z ^^^ 2) * 3 / 24) =\n?A / (z - 1 / 2) + ?B / (z - -1 / 4)";
20.11
21.1 --- a/test/Tools/isac/Knowledge/poly.sml Mon Apr 19 13:57:47 2021 +0200
21.2 +++ b/test/Tools/isac/Knowledge/poly.sml Mon Apr 19 15:02:11 2021 +0200
21.3 @@ -50,171 +50,171 @@
21.4 "----------- fun has_degree_in -----------------------------------------------------------------";
21.5 "----------- fun has_degree_in -----------------------------------------------------------------";
21.6 "----------- fun has_degree_in -----------------------------------------------------------------";
21.7 -val v = (Thm.term_of o the o (parse thy)) "x";
21.8 -val t = (Thm.term_of o the o (parse thy)) "1";
21.9 +val v = (Thm.term_of o the o (TermC.parse thy)) "x";
21.10 +val t = (Thm.term_of o the o (TermC.parse thy)) "1";
21.11 if has_degree_in t v = 0 then () else error "has_degree_in (1) x";
21.12
21.13 -val v = (Thm.term_of o the o (parse thy)) "AA";
21.14 -val t = (Thm.term_of o the o (parse thy)) "1";
21.15 +val v = (Thm.term_of o the o (TermC.parse thy)) "AA";
21.16 +val t = (Thm.term_of o the o (TermC.parse thy)) "1";
21.17 if has_degree_in t v = 0 then () else error "has_degree_in (1) AA";
21.18
21.19 (*----------*)
21.20 -val v = (Thm.term_of o the o (parse thy)) "x";
21.21 -val t = (Thm.term_of o the o (parse thy)) "a*b+c";
21.22 +val v = (Thm.term_of o the o (TermC.parse thy)) "x";
21.23 +val t = (Thm.term_of o the o (TermC.parse thy)) "a*b+c";
21.24 if has_degree_in t v = 0 then () else error "has_degree_in (a*b+c) x";
21.25
21.26 -val v = (Thm.term_of o the o (parse thy)) "AA";
21.27 -val t = (Thm.term_of o the o (parse thy)) "a*b+c";
21.28 +val v = (Thm.term_of o the o (TermC.parse thy)) "AA";
21.29 +val t = (Thm.term_of o the o (TermC.parse thy)) "a*b+c";
21.30 if has_degree_in t v = 0 then () else error "has_degree_in (a*b+c) AA";
21.31
21.32 (*----------*)
21.33 -val v = (Thm.term_of o the o (parse thy)) "x";
21.34 -val t = (Thm.term_of o the o (parse thy)) "a*x+c";
21.35 +val v = (Thm.term_of o the o (TermC.parse thy)) "x";
21.36 +val t = (Thm.term_of o the o (TermC.parse thy)) "a*x+c";
21.37 if has_degree_in t v = ~1 then () else error "has_degree_in (a*x+c) x";
21.38
21.39 -val v = (Thm.term_of o the o (parse thy)) "AA";
21.40 -val t = (Thm.term_of o the o (parse thy)) "a*AA+c";
21.41 +val v = (Thm.term_of o the o (TermC.parse thy)) "AA";
21.42 +val t = (Thm.term_of o the o (TermC.parse thy)) "a*AA+c";
21.43 if has_degree_in t v = ~1 then () else error "has_degree_in (a*AA+c) AA";
21.44
21.45 (*----------*)
21.46 -val v = (Thm.term_of o the o (parse thy)) "x";
21.47 -val t = (Thm.term_of o the o (parse thy)) "(a*b+c)*x^^^7";
21.48 +val v = (Thm.term_of o the o (TermC.parse thy)) "x";
21.49 +val t = (Thm.term_of o the o (TermC.parse thy)) "(a*b+c)*x^^^7";
21.50 if has_degree_in t v = 7 then () else error "has_degree_in ((a*b+c)*x^^^7) x";
21.51
21.52 -val v = (Thm.term_of o the o (parse thy)) "AA";
21.53 -val t = (Thm.term_of o the o (parse thy)) "(a*b+c)*AA^^^7";
21.54 +val v = (Thm.term_of o the o (TermC.parse thy)) "AA";
21.55 +val t = (Thm.term_of o the o (TermC.parse thy)) "(a*b+c)*AA^^^7";
21.56 if has_degree_in t v = 7 then () else error "has_degree_in ((a*b+c)*AA^^^7) AA";
21.57
21.58 (*----------*)
21.59 -val v = (Thm.term_of o the o (parse thy)) "x";
21.60 -val t = (Thm.term_of o the o (parse thy)) "x^^^7";
21.61 +val v = (Thm.term_of o the o (TermC.parse thy)) "x";
21.62 +val t = (Thm.term_of o the o (TermC.parse thy)) "x^^^7";
21.63 if has_degree_in t v = 7 then () else error "has_degree_in (x^^^7) x";
21.64
21.65 -val v = (Thm.term_of o the o (parse thy)) "AA";
21.66 -val t = (Thm.term_of o the o (parse thy)) "AA^^^7";
21.67 +val v = (Thm.term_of o the o (TermC.parse thy)) "AA";
21.68 +val t = (Thm.term_of o the o (TermC.parse thy)) "AA^^^7";
21.69 if has_degree_in t v = 7 then () else error "has_degree_in (AA^^^7) AA";
21.70
21.71 (*----------*)
21.72 -val v = (Thm.term_of o the o (parse thy)) "x";
21.73 -val t = (Thm.term_of o the o (parse thy)) "(a*b+c)*x";
21.74 +val v = (Thm.term_of o the o (TermC.parse thy)) "x";
21.75 +val t = (Thm.term_of o the o (TermC.parse thy)) "(a*b+c)*x";
21.76 if has_degree_in t v = 1 then () else error "has_degree_in ((a*b+c)*x) x";
21.77
21.78 -val v = (Thm.term_of o the o (parse thy)) "AA";
21.79 -val t = (Thm.term_of o the o (parse thy)) "(a*b+c)*AA";
21.80 +val v = (Thm.term_of o the o (TermC.parse thy)) "AA";
21.81 +val t = (Thm.term_of o the o (TermC.parse thy)) "(a*b+c)*AA";
21.82 if has_degree_in t v = 1 then () else error "has_degree_in ((a*b+c)*AA) AA";
21.83
21.84 (*----------*)
21.85 -val v = (Thm.term_of o the o (parse thy)) "x";
21.86 -val t = (Thm.term_of o the o (parse thy)) "(a*b+x)*x";
21.87 +val v = (Thm.term_of o the o (TermC.parse thy)) "x";
21.88 +val t = (Thm.term_of o the o (TermC.parse thy)) "(a*b+x)*x";
21.89 if has_degree_in t v = ~1 then () else error "has_degree_in (a*b+x)*x() x";
21.90
21.91 -val v = (Thm.term_of o the o (parse thy)) "AA";
21.92 -val t = (Thm.term_of o the o (parse thy)) "(a*b+AA)*AA";
21.93 +val v = (Thm.term_of o the o (TermC.parse thy)) "AA";
21.94 +val t = (Thm.term_of o the o (TermC.parse thy)) "(a*b+AA)*AA";
21.95 if has_degree_in t v = ~1 then () else error "has_degree_in ((a*b+AA)*AA) AA";
21.96
21.97 (*----------*)
21.98 -val v = (Thm.term_of o the o (parse thy)) "x";
21.99 -val t = (Thm.term_of o the o (parse thy)) "x";
21.100 +val v = (Thm.term_of o the o (TermC.parse thy)) "x";
21.101 +val t = (Thm.term_of o the o (TermC.parse thy)) "x";
21.102 if has_degree_in t v = 1 then () else error "has_degree_in (x) x";
21.103
21.104 -val v = (Thm.term_of o the o (parse thy)) "AA";
21.105 -val t = (Thm.term_of o the o (parse thy)) "AA";
21.106 +val v = (Thm.term_of o the o (TermC.parse thy)) "AA";
21.107 +val t = (Thm.term_of o the o (TermC.parse thy)) "AA";
21.108 if has_degree_in t v = 1 then () else error "has_degree_in (AA) AA";
21.109
21.110 (*----------*)
21.111 -val v = (Thm.term_of o the o (parse thy)) "x";
21.112 -val t = (Thm.term_of o the o (parse thy)) "ab - (a*b)*x";
21.113 +val v = (Thm.term_of o the o (TermC.parse thy)) "x";
21.114 +val t = (Thm.term_of o the o (TermC.parse thy)) "ab - (a*b)*x";
21.115 if has_degree_in t v = 1 then () else error "has_degree_in (ab - (a*b)*x) x";
21.116
21.117 -val v = (Thm.term_of o the o (parse thy)) "AA";
21.118 -val t = (Thm.term_of o the o (parse thy)) "ab - (a*b)*AA";
21.119 +val v = (Thm.term_of o the o (TermC.parse thy)) "AA";
21.120 +val t = (Thm.term_of o the o (TermC.parse thy)) "ab - (a*b)*AA";
21.121 if has_degree_in t v = 1 then () else error "has_degree_in (ab - (a*b)*AA) AA";
21.122
21.123 "----------- fun mono_deg_in -------------------------------------------------------------------";
21.124 "----------- fun mono_deg_in -------------------------------------------------------------------";
21.125 "----------- fun mono_deg_in -------------------------------------------------------------------";
21.126 -val v = (Thm.term_of o the o (parse thy)) "x";
21.127 +val v = (Thm.term_of o the o (TermC.parse thy)) "x";
21.128
21.129 -val t = (Thm.term_of o the o (parse thy)) "(a*b+c)*x^^^7";
21.130 +val t = (Thm.term_of o the o (TermC.parse thy)) "(a*b+c)*x^^^7";
21.131 if mono_deg_in t v = SOME 7 then () else error "mono_deg_in ((a*b+c)*x^^^7) x changed";
21.132
21.133 -val t = (Thm.term_of o the o (parse thy)) "x^^^7";
21.134 +val t = (Thm.term_of o the o (TermC.parse thy)) "x^^^7";
21.135 if mono_deg_in t v = SOME 7 then () else error "mono_deg_in (x^^^7) x changed";
21.136
21.137 -val t = (Thm.term_of o the o (parse thy)) "(a*b+c)*x";
21.138 +val t = (Thm.term_of o the o (TermC.parse thy)) "(a*b+c)*x";
21.139 if mono_deg_in t v = SOME 1 then () else error "mono_deg_in ((a*b+c)*x) x changed";
21.140
21.141 -val t = (Thm.term_of o the o (parse thy)) "(a*b+x)*x";
21.142 +val t = (Thm.term_of o the o (TermC.parse thy)) "(a*b+x)*x";
21.143 if mono_deg_in t v = NONE then () else error "mono_deg_in ((a*b+x)*x) x changed";
21.144
21.145 -val t = (Thm.term_of o the o (parse thy)) "x";
21.146 +val t = (Thm.term_of o the o (TermC.parse thy)) "x";
21.147 if mono_deg_in t v = SOME 1 then () else error "mono_deg_in (x) x changed";
21.148
21.149 -val t = (Thm.term_of o the o (parse thy)) "(a*b+c)";
21.150 +val t = (Thm.term_of o the o (TermC.parse thy)) "(a*b+c)";
21.151 if mono_deg_in t v = SOME 0 then () else error "mono_deg_in ((a*b+c)) x changed";
21.152
21.153 -val t = (Thm.term_of o the o (parse thy)) "ab - (a*b)*x";
21.154 +val t = (Thm.term_of o the o (TermC.parse thy)) "ab - (a*b)*x";
21.155 if mono_deg_in t v = NONE then () else error "mono_deg_in (ab - (a*b)*x) x changed";
21.156
21.157 (*. . . . . . . . . . . . the same with Const ("Partial_Functions.AA", _) . . . . . . . . . . . *)
21.158 val thy = @{theory Partial_Fractions}
21.159 -val v = (Thm.term_of o the o (parse thy)) "AA";
21.160 +val v = (Thm.term_of o the o (TermC.parse thy)) "AA";
21.161
21.162 -val t = (Thm.term_of o the o (parse thy)) "(a*b+c)*AA^^^7";
21.163 +val t = (Thm.term_of o the o (TermC.parse thy)) "(a*b+c)*AA^^^7";
21.164 if mono_deg_in t v = SOME 7 then () else error "mono_deg_in ((a*b+c)*AA^^^7) AA changed";
21.165
21.166 -val t = (Thm.term_of o the o (parse thy)) "AA^^^7";
21.167 +val t = (Thm.term_of o the o (TermC.parse thy)) "AA^^^7";
21.168 if mono_deg_in t v = SOME 7 then () else error "mono_deg_in (AA^^^7) AA changed";
21.169
21.170 -val t = (Thm.term_of o the o (parse thy)) "(a*b+c)*AA";
21.171 +val t = (Thm.term_of o the o (TermC.parse thy)) "(a*b+c)*AA";
21.172 if mono_deg_in t v = SOME 1 then () else error "mono_deg_in ((a*b+c)*AA) AA changed";
21.173
21.174 -val t = (Thm.term_of o the o (parse thy)) "(a*b+AA)*AA";
21.175 +val t = (Thm.term_of o the o (TermC.parse thy)) "(a*b+AA)*AA";
21.176 if mono_deg_in t v = NONE then () else error "mono_deg_in ((a*b+AA)*AA) AA changed";
21.177
21.178 -val t = (Thm.term_of o the o (parse thy)) "AA";
21.179 +val t = (Thm.term_of o the o (TermC.parse thy)) "AA";
21.180 if mono_deg_in t v = SOME 1 then () else error "mono_deg_in (AA) AA changed";
21.181
21.182 -val t = (Thm.term_of o the o (parse thy)) "(a*b+c)";
21.183 +val t = (Thm.term_of o the o (TermC.parse thy)) "(a*b+c)";
21.184 if mono_deg_in t v = SOME 0 then () else error "mono_deg_in ((a*b+c)) AA changed";
21.185
21.186 -val t = (Thm.term_of o the o (parse thy)) "ab - (a*b)*AA";
21.187 +val t = (Thm.term_of o the o (TermC.parse thy)) "ab - (a*b)*AA";
21.188 if mono_deg_in t v = NONE then () else error "mono_deg_in (ab - (a*b)*AA) AA changed";
21.189
21.190 "----------- rewrite_set_ has_degree_in Const ('Partial_Fractions', _) -------------------------";
21.191 "----------- rewrite_set_ has_degree_in Const ('Partial_Fractions', _) -------------------------";
21.192 "----------- rewrite_set_ has_degree_in Const ('Partial_Fractions', _) -------------------------";
21.193 val thy = @{theory Partial_Fractions}
21.194 -val expr = (Thm.term_of o the o (parse thy)) "((-8 - 2*x + x^^^2) has_degree_in x) = 2";
21.195 +val expr = (Thm.term_of o the o (TermC.parse thy)) "((-8 - 2*x + x^^^2) has_degree_in x) = 2";
21.196 val SOME (Const ("HOL.True", _), []) = rewrite_set_ thy false PolyEq_prls expr;
21.197
21.198 -val expr = (Thm.term_of o the o (parse thy)) "((-8 - 2*AA + AA^^^2) has_degree_in AA) = 2";
21.199 +val expr = (Thm.term_of o the o (TermC.parse thy)) "((-8 - 2*AA + AA^^^2) has_degree_in AA) = 2";
21.200 val SOME (Const ("HOL.True", _), []) = rewrite_set_ thy false PolyEq_prls expr;
21.201
21.202 "----------- eval_ for is_expanded_in, is_poly_in, has_degree_in -------------------------------";
21.203 "----------- eval_ for is_expanded_in, is_poly_in, has_degree_in -------------------------------";
21.204 "----------- eval_ for is_expanded_in, is_poly_in, has_degree_in -------------------------------";
21.205 -val t = (Thm.term_of o the o (parse thy)) "(-8 - 2*x + x^^^2) is_expanded_in x";
21.206 +val t = (Thm.term_of o the o (TermC.parse thy)) "(-8 - 2*x + x^^^2) is_expanded_in x";
21.207 val SOME (id, t') = eval_is_expanded_in 0 0 t 0;
21.208 if UnparseC.term t' = "-8 - 2 * x + x ^^^ 2 is_expanded_in x = True"
21.209 andalso id = "-8 - 2 * x + x ^^^ 2 is_expanded_in x = True"
21.210 then () else error "eval_is_expanded_in x ..changed";
21.211
21.212 val thy = @{theory Partial_Fractions}
21.213 -val t = (Thm.term_of o the o (parse thy)) "(-8 - 2*AA + AA^^^2) is_expanded_in AA";
21.214 +val t = (Thm.term_of o the o (TermC.parse thy)) "(-8 - 2*AA + AA^^^2) is_expanded_in AA";
21.215 val SOME (id, t') = eval_is_expanded_in 0 0 t 0;
21.216 if UnparseC.term t' = "-8 - 2 * AA + AA ^^^ 2 is_expanded_in AA = True"
21.217 andalso id = "-8 - 2 * AA + AA ^^^ 2 is_expanded_in AA = True"
21.218 then () else error "eval_is_expanded_in AA ..changed";
21.219
21.220
21.221 -val t = (Thm.term_of o the o (parse thy)) "(8 + 2*x + x^^^2) is_poly_in x";
21.222 +val t = (Thm.term_of o the o (TermC.parse thy)) "(8 + 2*x + x^^^2) is_poly_in x";
21.223 val SOME (id, t') = eval_is_poly_in 0 0 t 0;
21.224 if UnparseC.term t' = "8 + 2 * x + x ^^^ 2 is_poly_in x = True"
21.225 andalso id = "8 + 2 * x + x ^^^ 2 is_poly_in x = True"
21.226 then () else error "is_poly_in x ..changed";
21.227
21.228 -val t = (Thm.term_of o the o (parse thy)) "(8 + 2*AA + AA^^^2) is_poly_in AA";
21.229 +val t = (Thm.term_of o the o (TermC.parse thy)) "(8 + 2*AA + AA^^^2) is_poly_in AA";
21.230 val SOME (id, t') = eval_is_poly_in 0 0 t 0;
21.231 if UnparseC.term t' = "8 + 2 * AA + AA ^^^ 2 is_poly_in AA = True"
21.232 andalso id = "8 + 2 * AA + AA ^^^ 2 is_poly_in AA = True"
21.233 @@ -222,10 +222,10 @@
21.234
21.235
21.236 val thy = @{theory Partial_Fractions}
21.237 -val expr = (Thm.term_of o the o (parse thy)) "((-8 - 2*x + x^^^2) has_degree_in x) = 2";
21.238 +val expr = (Thm.term_of o the o (TermC.parse thy)) "((-8 - 2*x + x^^^2) has_degree_in x) = 2";
21.239 val SOME (Const ("HOL.True", _), []) = rewrite_set_ thy false PolyEq_prls expr;
21.240
21.241 -val expr = (Thm.term_of o the o (parse thy)) "((-8 - 2*AA + AA^^^2) has_degree_in AA) = 2";
21.242 +val expr = (Thm.term_of o the o (TermC.parse thy)) "((-8 - 2*AA + AA^^^2) has_degree_in AA) = 2";
21.243 val SOME (Const ("HOL.True", _), []) = rewrite_set_ thy false PolyEq_prls expr;
21.244
21.245 "-------- investigate (new 2002) uniary minus -----------";
21.246 @@ -233,7 +233,7 @@
21.247 "-------- investigate (new 2002) uniary minus -----------";
21.248 (*---------------------------------------------- vvvvvvvvvvvvvv -----------------------*)
21.249 val t = Thm.prop_of @{thm real_diff_0}; (*"0 - ?x = - ?x"*)
21.250 -atomty t;
21.251 +TermC.atomty t;
21.252 (*
21.253 *** Const (HOL.Trueprop, bool => prop)
21.254 *** . Const (HOL.eq, real => real => bool)
21.255 @@ -252,16 +252,16 @@
21.256 | _ => error "internal representation of \"0 - ?x = - ?x\" changed";
21.257
21.258 (*----------------------------------- vvvv --------------------------------------------*)
21.259 -val t = (Thm.term_of o the o (parse thy)) "-1";
21.260 -atomty t;
21.261 +val t = (Thm.term_of o the o (TermC.parse thy)) "-1";
21.262 +TermC.atomty t;
21.263 (*** -------------
21.264 *** Free ( -1, real) *)
21.265 case t of
21.266 Free ("-1", _) => ()
21.267 | _ => error "internal representation of \"-1\" changed";
21.268 (*----------------------------------- vvvvv -------------------------------------------*)
21.269 -val t = (Thm.term_of o the o (parse thy)) "- 1";
21.270 -atomty t;
21.271 +val t = (Thm.term_of o the o (TermC.parse thy)) "- 1";
21.272 +TermC.atomty t;
21.273 (*
21.274 ***
21.275 *** Free (-1, real)
21.276 @@ -274,24 +274,24 @@
21.277 "======= these external values all have the same internal representation";
21.278 (* "1-x" causes syntyx error --- binary minus detected by blank inbetween !!!*)
21.279 (*----------------------------------- vvvvv -------------------------------------------*)
21.280 -val t = (Thm.term_of o the o (parse thy)) "-x";
21.281 -atomty t;
21.282 +val t = (Thm.term_of o the o (TermC.parse thy)) "-x";
21.283 +TermC.atomty t;
21.284 (**** -------------
21.285 *** Free ( -x, real)*)
21.286 case t of
21.287 Const ("Groups.uminus_class.uminus", _) $ Free ("x", _) => ()
21.288 | _ => error "internal representation of \"-x\" changed";
21.289 (*----------------------------------- vvvvv -------------------------------------------*)
21.290 -val t = (Thm.term_of o the o (parse thy)) "- x";
21.291 -atomty t;
21.292 +val t = (Thm.term_of o the o (TermC.parse thy)) "- x";
21.293 +TermC.atomty t;
21.294 (**** -------------
21.295 *** Free ( -x, real) !!!!!!!!!!!!!!!!!!!!!!!! is the same !!!*)
21.296 case t of
21.297 Const ("Groups.uminus_class.uminus", _) $ Free ("x", _) => ()
21.298 | _ => error "internal representation of \"- x\" changed";
21.299 (*----------------------------------- vvvvvv ------------------------------------------*)
21.300 -val t = (Thm.term_of o the o (parse thy)) "-(x)";
21.301 -atomty t;
21.302 +val t = (Thm.term_of o the o (TermC.parse thy)) "-(x)";
21.303 +TermC.atomty t;
21.304 (**** -------------
21.305 *** Free ( -x, real)*)
21.306 case t of
21.307 @@ -302,32 +302,32 @@
21.308 "-------- check make_polynomial with simple terms -------";
21.309 "-------- check make_polynomial with simple terms -------";
21.310 "----- check 1 ---";
21.311 -val t = str2term "2*3*a";
21.312 +val t = TermC.str2term "2*3*a";
21.313 val SOME (t, _) = rewrite_set_ thy false make_polynomial t;
21.314 if UnparseC.term t = "6 * a" then () else error "check make_polynomial 1";
21.315
21.316 "----- check 2 ---";
21.317 -val t = str2term "2*a + 3*a";
21.318 +val t = TermC.str2term "2*a + 3*a";
21.319 val SOME (t, _) = rewrite_set_ thy false make_polynomial t;
21.320 if UnparseC.term t = "5 * a" then () else error "check make_polynomial 2";
21.321
21.322 "----- check 3 ---";
21.323 -val t = str2term "2*a + 3*a + 3*a";
21.324 +val t = TermC.str2term "2*a + 3*a + 3*a";
21.325 val SOME (t, _) = rewrite_set_ thy false make_polynomial t;
21.326 if UnparseC.term t = "8 * a" then () else error "check make_polynomial 3";
21.327
21.328 "----- check 4 ---";
21.329 -val t = str2term "3*a - 2*a";
21.330 +val t = TermC.str2term "3*a - 2*a";
21.331 val SOME (t, _) = rewrite_set_ thy false make_polynomial t;
21.332 if UnparseC.term t = "a" then () else error "check make_polynomial 4";
21.333
21.334 "----- check 5 ---";
21.335 -val t = str2term "4*(3*a - 2*a)";
21.336 +val t = TermC.str2term "4*(3*a - 2*a)";
21.337 val SOME (t, _) = rewrite_set_ thy false make_polynomial t;
21.338 if UnparseC.term t = "4 * a" then () else error "check make_polynomial 5";
21.339
21.340 "----- check 6 ---";
21.341 -val t = str2term "4*(3*a^^^2 - 2*a^^^2)";
21.342 +val t = TermC.str2term "4*(3*a^^^2 - 2*a^^^2)";
21.343 val SOME (t, _) = rewrite_set_ thy false make_polynomial t;
21.344 if UnparseC.term t = "4 * a ^^^ 2" then () else error "check make_polynomial 6";
21.345
21.346 @@ -336,7 +336,7 @@
21.347 "-------- fun is_multUnordered --------------------------";
21.348 val thy = @{theory "Isac_Knowledge"};
21.349 "===== works for a simple example, see rewrite.sml -- fun app_rev ===";
21.350 -val t = str2term "x^^^2 * x";
21.351 +val t = TermC.str2term "x^^^2 * x";
21.352 val SOME (t', _) = rewrite_set_ thy true order_mult_ t;
21.353 if UnparseC.term t' = "x * x ^^^ 2" then ()
21.354 else error "poly.sml Poly.is'_multUnordered doesn't work";
21.355 @@ -348,7 +348,7 @@
21.356 ####### try calc: Poly.is'_multUnordered'
21.357 ======= calc. to: False !!!!!!!!!!!!! INSTEAD OF TRUE in 2002 !!!!!!!!!!!!!
21.358 *)
21.359 -val t = str2term "5 * x ^^^ 2 * (2 * x ^^^ 7) + 5 * x ^^^ 2 * 3 + (6 * x ^^^ 7 + 9) + (-1 * (3 * x ^^^ 5 * (6 * x ^^^ 4)) + -1 * (3 * x ^^^ 5 * -1) + (-48 * x ^^^ 4 + 8))";
21.360 +val t = TermC.str2term "5 * x ^^^ 2 * (2 * x ^^^ 7) + 5 * x ^^^ 2 * 3 + (6 * x ^^^ 7 + 9) + (-1 * (3 * x ^^^ 5 * (6 * x ^^^ 4)) + -1 * (3 * x ^^^ 5 * -1) + (-48 * x ^^^ 4 + 8))";
21.361
21.362 "----- is_multUnordered ---";
21.363 val tsort = sort_variables t;
21.364 @@ -359,7 +359,7 @@
21.365 if is_multUnordered t then () else error "poly.sml diff. is_multUnordered 1";
21.366
21.367 "----- eval_is_multUnordered ---";
21.368 -val tm = str2term "(5 * x ^^^ 2 * (2 * x ^^^ 7) + 5 * x ^^^ 2 * 3 + (6 * x ^^^ 7 + 9) + (-1 * (3 * x ^^^ 5 * (6 * x ^^^ 4)) + -1 * (3 * x ^^^ 5 * -1) + (-48 * x ^^^ 4 + 8))) is_multUnordered";
21.369 +val tm = TermC.str2term "(5 * x ^^^ 2 * (2 * x ^^^ 7) + 5 * x ^^^ 2 * 3 + (6 * x ^^^ 7 + 9) + (-1 * (3 * x ^^^ 5 * (6 * x ^^^ 4)) + -1 * (3 * x ^^^ 5 * -1) + (-48 * x ^^^ 4 + 8))) is_multUnordered";
21.370 case eval_is_multUnordered "testid" "" tm thy of
21.371 SOME (_, Const ("HOL.Trueprop", _) $
21.372 (Const ("HOL.eq", _) $
21.373 @@ -375,20 +375,20 @@
21.374 "-------- examples from textbook Schalk I ---------------";
21.375 "-------- examples from textbook Schalk I ---------------";
21.376 "-----SPB Schalk I p.63 No.267b ---";
21.377 -val t = str2term "(5*x^^^2 + 3) * (2*x^^^7 + 3) - (3*x^^^5 + 8) * (6*x^^^4 - 1)";
21.378 +val t = TermC.str2term "(5*x^^^2 + 3) * (2*x^^^7 + 3) - (3*x^^^5 + 8) * (6*x^^^4 - 1)";
21.379 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
21.380 if (UnparseC.term t) = "17 + 15 * x ^^^ 2 + -48 * x ^^^ 4 + 3 * x ^^^ 5 + 6 * x ^^^ 7 + -8 * x ^^^ 9"
21.381 then () else error "poly.sml: diff.behav. in make_polynomial 1";
21.382
21.383 "-----SPB Schalk I p.63 No.275b ---";
21.384 -val t = str2term "(3*x^^^2 - 2*x*y + y^^^2) * (x^^^2 - 2*y^^^2)";
21.385 +val t = TermC.str2term "(3*x^^^2 - 2*x*y + y^^^2) * (x^^^2 - 2*y^^^2)";
21.386 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
21.387 if (UnparseC.term t) = ("3 * x ^^^ 4 + -2 * x ^^^ 3 * y + -5 * x ^^^ 2 * y ^^^ 2 + " ^
21.388 "4 * x * y ^^^ 3 +\n-2 * y ^^^ 4")
21.389 then () else error "poly.sml: diff.behav. in make_polynomial 2";
21.390
21.391 "-----SPB Schalk I p.63 No.279b ---";
21.392 -val t = str2term "(x-a)*(x-b)*(x-c)*(x-d)";
21.393 +val t = TermC.str2term "(x-a)*(x-b)*(x-c)*(x-d)";
21.394 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
21.395 if (UnparseC.term t) =
21.396 ("a * b * c * d + -1 * a * b * c * x + -1 * a * b * d * x + a * b * x ^^^ 2 +\n" ^
21.397 @@ -398,32 +398,32 @@
21.398 then () else error "poly.sml: diff.behav. in make_polynomial 3";
21.399
21.400 "-----SPB Schalk I p.63 No.291 ---";
21.401 -val t = str2term "(5+96*x^^^3+8*x*(-4+(7- 3*x)*4*x))*(5*(2- 3*x)- (-15*x*(-8*x- 5)))";
21.402 +val t = TermC.str2term "(5+96*x^^^3+8*x*(-4+(7- 3*x)*4*x))*(5*(2- 3*x)- (-15*x*(-8*x- 5)))";
21.403 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
21.404 if (UnparseC.term t) = "50 + -770 * x + 4520 * x ^^^ 2 + -16320 * x ^^^ 3 + -26880 * x ^^^ 4"
21.405 then () else error "poly.sml: diff.behav. in make_polynomial 4";
21.406
21.407 "-----SPB Schalk I p.64 No.295c ---";
21.408 -val t = str2term "(13*a^^^4*b^^^9*c - 12*a^^^3*b^^^6*c^^^9)^^^2";
21.409 +val t = TermC.str2term "(13*a^^^4*b^^^9*c - 12*a^^^3*b^^^6*c^^^9)^^^2";
21.410 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
21.411 if (UnparseC.term t) = ("169 * a ^^^ 8 * b ^^^ 18 * c ^^^ 2 + -312 * a ^^^ 7 * b ^^^ 15 * c ^^^ 10" ^
21.412 " +\n144 * a ^^^ 6 * b ^^^ 12 * c ^^^ 18")
21.413 then ()else error "poly.sml: diff.behav. in make_polynomial 5";
21.414
21.415 "-----SPB Schalk I p.64 No.299a ---";
21.416 -val t = str2term "(x - y)*(x + y)";
21.417 +val t = TermC.str2term "(x - y)*(x + y)";
21.418 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
21.419 if (UnparseC.term t) = "x ^^^ 2 + -1 * y ^^^ 2"
21.420 then () else error "poly.sml: diff.behav. in make_polynomial 6";
21.421
21.422 "-----SPB Schalk I p.64 No.300c ---";
21.423 -val t = str2term "(3*x^^^2*y - 1)*(3*x^^^2*y + 1)";
21.424 +val t = TermC.str2term "(3*x^^^2*y - 1)*(3*x^^^2*y + 1)";
21.425 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
21.426 if (UnparseC.term t) = "-1 + 9 * x ^^^ 4 * y ^^^ 2"
21.427 then () else error "poly.sml: diff.behav. in make_polynomial 7";
21.428
21.429 "-----SPB Schalk I p.64 No.302 ---";
21.430 -val t = str2term
21.431 +val t = TermC.str2term
21.432 "(13*x^^^2 + 5)*(13*x^^^2 - 5) - (5*x^^^2 + 3)*(5*x^^^2 - 3) - (12*x^^^2 + 4)*(12*x^^^2 - 4)";
21.433 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
21.434 if UnparseC.term t = "0"
21.435 @@ -431,44 +431,44 @@
21.436 (* RL?MG?: Bei Berechnung sollte 3 mal real_plus_minus_binom1_p aus expand_poly verwendet werden *)
21.437
21.438 "-----SPB Schalk I p.64 No.306a ---";
21.439 -val t = str2term "((x^^^2 + 1)*(x^^^2 - 1))^^^2";
21.440 +val t = TermC.str2term "((x^^^2 + 1)*(x^^^2 - 1))^^^2";
21.441 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
21.442 if (UnparseC.term t) = "1 + 2 * x ^^^ 4 + 2 * -2 * x ^^^ 4 + x ^^^ 8" then ()
21.443 else error "poly.sml: diff.behav. in 2 * x ^^^ 4 + 2 * -2 * x ^^^ 4 = -2 * x ^^^ 4";
21.444
21.445 (*WN071729 when reducing "rls reduce_012_" for Schaerding,
21.446 the above resulted in the term below ... but reduces from then correctly*)
21.447 -val t = str2term "1 + 2 * x ^^^ 4 + 2 * -2 * x ^^^ 4 + x ^^^ 8";
21.448 +val t = TermC.str2term "1 + 2 * x ^^^ 4 + 2 * -2 * x ^^^ 4 + x ^^^ 8";
21.449 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
21.450 if (UnparseC.term t) = "1 + -2 * x ^^^ 4 + x ^^^ 8"
21.451 then () else error "poly.sml: diff.behav. in make_polynomial 9b";
21.452
21.453 "-----SPB Schalk I p.64 No.296a ---";
21.454 -val t = str2term "(x - a)^^^3";
21.455 +val t = TermC.str2term "(x - a)^^^3";
21.456 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
21.457 if (UnparseC.term t) = "-1 * a ^^^ 3 + 3 * a ^^^ 2 * x + -3 * a * x ^^^ 2 + x ^^^ 3"
21.458 then () else error "poly.sml: diff.behav. in make_polynomial 10";
21.459
21.460 "-----SPB Schalk I p.64 No.296c ---";
21.461 -val t = str2term "(-3*x - 4*y)^^^3";
21.462 +val t = TermC.str2term "(-3*x - 4*y)^^^3";
21.463 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
21.464 if (UnparseC.term t) = "-27 * x ^^^ 3 + -108 * x ^^^ 2 * y + -144 * x * y ^^^ 2 + -64 * y ^^^ 3"
21.465 then () else error "poly.sml: diff.behav. in make_polynomial 11";
21.466
21.467 "-----SPB Schalk I p.62 No.242c ---";
21.468 -val t = str2term "x^^^(-4)*(x^^^(-4)*y^^^(-2))^^^(-1)*y^^^(-2)";
21.469 +val t = TermC.str2term "x^^^(-4)*(x^^^(-4)*y^^^(-2))^^^(-1)*y^^^(-2)";
21.470 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
21.471 if (UnparseC.term t) = "1"
21.472 then () else error "poly.sml: diff.behav. in make_polynomial 12";
21.473
21.474 "-----SPB Schalk I p.60 No.209a ---";
21.475 -val t = str2term "a^^^(7-x) * a^^^x";
21.476 +val t = TermC.str2term "a^^^(7-x) * a^^^x";
21.477 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
21.478 if UnparseC.term t = "a ^^^ 7"
21.479 then () else error "poly.sml: diff.behav. in make_polynomial 13";
21.480
21.481 "-----SPB Schalk I p.60 No.209d ---";
21.482 -val t = str2term "d^^^x * d^^^(x+1) * d^^^(2 - 2*x)";
21.483 +val t = TermC.str2term "d^^^x * d^^^(x+1) * d^^^(2 - 2*x)";
21.484 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
21.485 if UnparseC.term t = "d ^^^ 3"
21.486 then () else error "poly.sml: diff.behav. in make_polynomial 14";
21.487 @@ -477,7 +477,7 @@
21.488 (*---------------- ?RL?Bsple bei denen es Probleme gibt----------------*)
21.489 (*---------------------------------------------------------------------*)
21.490 "-----Schalk I p.64 No.303 ---";
21.491 -val t = str2term "(a + 2*b)*(a^^^2 + 4*b^^^2)*(a - 2*b) - (a - 6*b)*(a^^^2 + 36*b^^^2)*(a + 6*b)";
21.492 +val t = TermC.str2term "(a + 2*b)*(a^^^2 + 4*b^^^2)*(a - 2*b) - (a - 6*b)*(a^^^2 + 36*b^^^2)*(a + 6*b)";
21.493 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
21.494 if UnparseC.term t = "1280 * b ^^^ 4"
21.495 then () else error "poly.sml: diff.behav. in make_polynomial 14b";
21.496 @@ -487,74 +487,74 @@
21.497 (*----------------------- Eigene Beispiele ---------------------------*)
21.498 (*--------------------------------------------------------------------*)
21.499 "-----SPO ---";
21.500 -val t = str2term "a^^^2*a^^^(-2)";
21.501 +val t = TermC.str2term "a^^^2*a^^^(-2)";
21.502 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
21.503 if UnparseC.term t = "1" then ()
21.504 else error "poly.sml: diff.behav. in make_polynomial 15";
21.505 "-----SPO ---";
21.506 -val t = str2term "a + a + a";
21.507 +val t = TermC.str2term "a + a + a";
21.508 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
21.509 if UnparseC.term t = "3 * a" then ()
21.510 else error "poly.sml: diff.behav. in make_polynomial 16";
21.511 "-----SPO ---";
21.512 -val t = str2term "a + b + b + b";
21.513 +val t = TermC.str2term "a + b + b + b";
21.514 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
21.515 if UnparseC.term t = "a + 3 * b" then ()
21.516 else error "poly.sml: diff.behav. in make_polynomial 17";
21.517 "-----SPO ---";
21.518 -val t = str2term "a^^^2*b*b^^^(-1)";
21.519 +val t = TermC.str2term "a^^^2*b*b^^^(-1)";
21.520 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
21.521 if UnparseC.term t = "a ^^^ 2" then ()
21.522 else error "poly.sml: diff.behav. in make_polynomial 18";
21.523 "-----SPO ---";
21.524 -val t = str2term "a^^^2*a^^^(-2)";
21.525 +val t = TermC.str2term "a^^^2*a^^^(-2)";
21.526 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
21.527 if (UnparseC.term t) = "1" then ()
21.528 else error "poly.sml: diff.behav. in make_polynomial 19";
21.529 "-----SPO ---";
21.530 -val t = str2term "b + a - b";
21.531 +val t = TermC.str2term "b + a - b";
21.532 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
21.533 if (UnparseC.term t) = "a" then ()
21.534 else error "poly.sml: diff.behav. in make_polynomial 20";
21.535 "-----SPO ---";
21.536 -val t = str2term "b * a * a";
21.537 +val t = TermC.str2term "b * a * a";
21.538 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
21.539 if UnparseC.term t = "a ^^^ 2 * b" then ()
21.540 else error "poly.sml: diff.behav. in make_polynomial 21";
21.541 "-----SPO ---";
21.542 -val t = str2term "(a^^^2)^^^3";
21.543 +val t = TermC.str2term "(a^^^2)^^^3";
21.544 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
21.545 if UnparseC.term t = "a ^^^ 6" then ()
21.546 else error "poly.sml: diff.behav. in make_polynomial 22";
21.547 "-----SPO ---";
21.548 -val t = str2term "x^^^2 * y^^^2 + x * x^^^2 * y";
21.549 +val t = TermC.str2term "x^^^2 * y^^^2 + x * x^^^2 * y";
21.550 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
21.551 if UnparseC.term t = "x ^^^ 3 * y + x ^^^ 2 * y ^^^ 2" then ()
21.552 else error "poly.sml: diff.behav. in make_polynomial 23";
21.553 "-----SPO ---";
21.554 -val t = (Thm.term_of o the o (parse thy)) "a^^^2 * (-a)^^^2";
21.555 +val t = (Thm.term_of o the o (TermC.parse thy)) "a^^^2 * (-a)^^^2";
21.556 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
21.557 if (UnparseC.term t) = "a ^^^ 4" then ()
21.558 else error "poly.sml: diff.behav. in make_polynomial 24";
21.559 "-----SPO ---";
21.560 -val t = str2term "a * b * b^^^(-1) + a";
21.561 +val t = TermC.str2term "a * b * b^^^(-1) + a";
21.562 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
21.563 if (UnparseC.term t) = "2 * a" then ()
21.564 else error "poly.sml: diff.behav. in make_polynomial 25";
21.565 "-----SPO ---";
21.566 -val t = str2term "a*c*b^^^(2*n) + 3*a + 5*b^^^(2*n)*c*b";
21.567 +val t = TermC.str2term "a*c*b^^^(2*n) + 3*a + 5*b^^^(2*n)*c*b";
21.568 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
21.569 if (UnparseC.term t) = "3 * a + 5 * b ^^^ (1 + 2 * n) * c + a * b ^^^ (2 * n) * c"
21.570 then () else error "poly.sml: diff.behav. in make_polynomial 26";
21.571
21.572 (*MG030627 -------------vvv-: Verschachtelte Terme -----------*)
21.573 "-----SPO ---";
21.574 -val t = str2term "(1 + (x*y*a) + x)^^^(1 + (x*y*a) + x)";
21.575 +val t = TermC.str2term "(1 + (x*y*a) + x)^^^(1 + (x*y*a) + x)";
21.576 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
21.577 if UnparseC.term t = "(1 + x + a * x * y) ^^^ (1 + x + a * x * y)"
21.578 then () else error "poly.sml: diff.behav. in make_polynomial 27";(*SPO*)
21.579
21.580 -val t = str2term "(1 + x*(y*z)*zz)^^^(1 + x*(y*z)*zz)";
21.581 +val t = TermC.str2term "(1 + x*(y*z)*zz)^^^(1 + x*(y*z)*zz)";
21.582 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
21.583 if UnparseC.term t = "(1 + x * y * z * zz) ^^^ (1 + x * y * z * zz)"
21.584 then () else error "poly.sml: diff.behav. in make_polynomial 28";
21.585 @@ -587,7 +587,7 @@
21.586 (*default_print_depth 7;*)
21.587 val prls = (#prls o Problem.from_store) ["polynomial", "simplification"];
21.588 (*default_print_depth 3;*)
21.589 -val t = str2term "((5*x^^^2 + 3) * (2*x^^^7 + 3) - (3*x^^^5 + 8) * (6*x^^^4 - 1)) is_polyexp";
21.590 +val t = TermC.str2term "((5*x^^^2 + 3) * (2*x^^^7 + 3) - (3*x^^^5 + 8) * (6*x^^^4 - 1)) is_polyexp";
21.591 val SOME (t',_) = rewrite_set_ thy false prls t;
21.592 if t' = @{term True} then ()
21.593 else error "poly.sml: diff.behav. in check pbl 'polynomial..";
21.594 @@ -671,7 +671,7 @@
21.595 val thy = @{theory Simplify};
21.596
21.597 val SOME (f',_) = rewrite_set_ thy false norm_Poly
21.598 -(str2term "L = k - 2 * q + (k - 2 * q) + (k - 2 * q) + (k - 2 * q) + senkrecht + oben");
21.599 +(TermC.str2term "L = k - 2 * q + (k - 2 * q) + (k - 2 * q) + (k - 2 * q) + senkrecht + oben");
21.600 if UnparseC.term f' = "L = 2 * 2 * (k + -2 * q) + senkrecht + oben"
21.601 then ((*norm_Poly NOT COMPLETE -- TODO MG*))
21.602 else error "norm_Poly changed behavior";
21.603 @@ -679,17 +679,17 @@
21.604 "-------- ord_make_polynomial ---------------------------";
21.605 "-------- ord_make_polynomial ---------------------------";
21.606 "-------- ord_make_polynomial ---------------------------";
21.607 -val t1 = str2term "2 * b + (3 * a + 3 * b)";
21.608 -val t2 = str2term "3 * a + 3 * b + 2 * b";
21.609 +val t1 = TermC.str2term "2 * b + (3 * a + 3 * b)";
21.610 +val t2 = TermC.str2term "3 * a + 3 * b + 2 * b";
21.611
21.612 if ord_make_polynomial true thy [] (t1, t2) then ()
21.613 else error "poly.sml: diff.behav. in ord_make_polynomial";
21.614
21.615 (*WN071202: ^^^ why then is there no rewriting ...*)
21.616 -val term = str2term "2*b + (3*a + 3*b)";
21.617 +val term = TermC.str2term "2*b + (3*a + 3*b)";
21.618 val NONE = rewrite_set_ (@{theory "Isac_Knowledge"}) false order_add_mult term;
21.619
21.620 (*or why is there no rewriting this way...*)
21.621 -val t1 = str2term "2 * b + (3 * a + 3 * b)";
21.622 -val t2 = str2term "3 * a + (2 * b + 3 * b)";
21.623 +val t1 = TermC.str2term "2 * b + (3 * a + 3 * b)";
21.624 +val t2 = TermC.str2term "3 * a + (2 * b + 3 * b)";
21.625
22.1 --- a/test/Tools/isac/Knowledge/polyeq-1.sml Mon Apr 19 13:57:47 2021 +0200
22.2 +++ b/test/Tools/isac/Knowledge/polyeq-1.sml Mon Apr 19 15:02:11 2021 +0200
22.3 @@ -52,54 +52,54 @@
22.4 (* Rewrite.trace_on:=true;
22.5 Rewrite.trace_on:=false;
22.6 *)
22.7 - val t1 = (Thm.term_of o the o (parse thy)) "lhs (-8 - 2*x + x^^^2 = 0)";
22.8 + val t1 = (Thm.term_of o the o (TermC.parse thy)) "lhs (-8 - 2*x + x^^^2 = 0)";
22.9 val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t1;
22.10 if ((UnparseC.term t) = "-8 - 2 * x + x ^^^ 2") then ()
22.11 else error "polyeq.sml: diff.behav. in lhs";
22.12
22.13 - val t2 = (Thm.term_of o the o (parse thy)) "(-8 - 2*x + x^^^2) is_expanded_in x";
22.14 + val t2 = (Thm.term_of o the o (TermC.parse thy)) "(-8 - 2*x + x^^^2) is_expanded_in x";
22.15 val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t2;
22.16 if (UnparseC.term t) = "True" then ()
22.17 else error "polyeq.sml: diff.behav. 1 in is_expended_in";
22.18
22.19 - val t0 = (Thm.term_of o the o (parse thy)) "(sqrt(x)) is_poly_in x";
22.20 + val t0 = (Thm.term_of o the o (TermC.parse thy)) "(sqrt(x)) is_poly_in x";
22.21 val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t0;
22.22 if (UnparseC.term t) = "False" then ()
22.23 else error "polyeq.sml: diff.behav. 2 in is_poly_in";
22.24
22.25 - val t3 = (Thm.term_of o the o (parse thy)) "(-8 + (-1)*2*x + x^^^2) is_poly_in x";
22.26 + val t3 = (Thm.term_of o the o (TermC.parse thy)) "(-8 + (-1)*2*x + x^^^2) is_poly_in x";
22.27 val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t3;
22.28 if (UnparseC.term t) = "True" then ()
22.29 else error "polyeq.sml: diff.behav. 3 in is_poly_in";
22.30
22.31 - val t4 = (Thm.term_of o the o (parse thy)) "(lhs (-8 + (-1)*2*x + x^^^2 = 0)) is_expanded_in x";
22.32 + val t4 = (Thm.term_of o the o (TermC.parse thy)) "(lhs (-8 + (-1)*2*x + x^^^2 = 0)) is_expanded_in x";
22.33 val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t4;
22.34 if (UnparseC.term t) = "True" then ()
22.35 else error "polyeq.sml: diff.behav. 4 in is_expended_in";
22.36
22.37
22.38 - val t6 = (Thm.term_of o the o (parse thy)) "(lhs (-8 - 2*x + x^^^2 = 0)) is_expanded_in x";
22.39 + val t6 = (Thm.term_of o the o (TermC.parse thy)) "(lhs (-8 - 2*x + x^^^2 = 0)) is_expanded_in x";
22.40 val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t6;
22.41 if (UnparseC.term t) = "True" then ()
22.42 else error "polyeq.sml: diff.behav. 5 in is_expended_in";
22.43
22.44 - val t3 = (Thm.term_of o the o (parse thy))"((-8 - 2*x + x^^^2) has_degree_in x) = 2";
22.45 + val t3 = (Thm.term_of o the o (TermC.parse thy))"((-8 - 2*x + x^^^2) has_degree_in x) = 2";
22.46 val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t3;
22.47 if (UnparseC.term t) = "True" then ()
22.48 else error "polyeq.sml: diff.behav. in has_degree_in_in";
22.49
22.50 - val t3 = (Thm.term_of o the o (parse thy)) "((sqrt(x)) has_degree_in x) = 2";
22.51 + val t3 = (Thm.term_of o the o (TermC.parse thy)) "((sqrt(x)) has_degree_in x) = 2";
22.52 val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t3;
22.53 if (UnparseC.term t) = "False" then ()
22.54 else error "polyeq.sml: diff.behav. 6 in has_degree_in_in";
22.55
22.56 - val t4 = (Thm.term_of o the o (parse thy))
22.57 + val t4 = (Thm.term_of o the o (TermC.parse thy))
22.58 "((-8 - 2*x + x^^^2) has_degree_in x) = 1";
22.59 val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t4;
22.60 if (UnparseC.term t) = "False" then ()
22.61 else error "polyeq.sml: diff.behav. 7 in has_degree_in_in";
22.62
22.63 - val t5 = (Thm.term_of o the o (parse thy))
22.64 + val t5 = (Thm.term_of o the o (TermC.parse thy))
22.65 "((-8 - 2*x + x^^^2) has_degree_in x) = 2";
22.66 val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t5;
22.67 if (UnparseC.term t) = "True" then ()
22.68 @@ -113,7 +113,7 @@
22.69 M_Match.Matches' {Find = [Correct "solutions L"],
22.70 With = [],
22.71 Given = [Correct "equality (-8 - 2 * x + x ^^^ 2 = 0)", Correct "solveFor x"],
22.72 - Where = [Correct "matches (?a = 0) (-8 - 2 * x + x ^^^ 2 = 0)",
22.73 + Where = [Correct "TermC.matches (?a = 0) (-8 - 2 * x + x ^^^ 2 = 0)",
22.74 Correct "lhs (-8 - 2 * x + x ^^^ 2 = 0) is_expanded_in x"],
22.75 Relate = []}
22.76 then () else error "M_Match.match_pbl [expanded,univariate,equation]";
22.77 @@ -134,7 +134,7 @@
22.78 -----------28.2.03: war nicht upgedatet und ausgeklammert in ROOT.ML-->Test_Isac.thy
22.79
22.80 (*Aufgabe zum Einstieg in die Arbeit...*)
22.81 - val t = (Thm.term_of o the o (parse thy)) "a*b - (a+b)*x + x^^^2 = 0";
22.82 + val t = (Thm.term_of o the o (TermC.parse thy)) "a*b - (a+b)*x + x^^^2 = 0";
22.83 (*ein 'ruleset' aus Poly.ML wird angewandt...*)
22.84 val SOME (t,_) = rewrite_set_ thy Poly_erls false make_polynomial t;
22.85 UnparseC.term t;
22.86 @@ -164,9 +164,9 @@
22.87 *)
22.88
22.89 "------15.11.02 --------------------------";
22.90 - val t = (Thm.term_of o the o (parse thy)) "1 + a * x + b * x";
22.91 - val bdv = (Thm.term_of o the o (parse thy)) "bdv";
22.92 - val a = (Thm.term_of o the o (parse thy)) "a";
22.93 + val t = (Thm.term_of o the o (TermC.parse thy)) "1 + a * x + b * x";
22.94 + val bdv = (Thm.term_of o the o (TermC.parse thy)) "bdv";
22.95 + val a = (Thm.term_of o the o (TermC.parse thy)) "a";
22.96
22.97 Rewrite.trace_on := false;
22.98 (* Anwenden einer Regelmenge aus Termorder.ML: *)
22.99 @@ -178,7 +178,7 @@
22.100 UnparseC.term t;
22.101 "1 + b * x + x * a";
22.102
22.103 - val t = (Thm.term_of o the o (parse thy)) "1 + a * (x + b * x) + a^^^2";
22.104 + val t = (Thm.term_of o the o (TermC.parse thy)) "1 + a * (x + b * x) + a^^^2";
22.105 val SOME (t,_) =
22.106 rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
22.107 UnparseC.term t;
22.108 @@ -187,7 +187,7 @@
22.109 UnparseC.term t;
22.110 "1 + (x + b * x) * a + a ^^^ 2";
22.111
22.112 - val t = (Thm.term_of o the o (parse thy)) "1 + a ^^^2 * x + b * a + 7*a^^^2";
22.113 + val t = (Thm.term_of o the o (TermC.parse thy)) "1 + a ^^^2 * x + b * a + 7*a^^^2";
22.114 val SOME (t,_) =
22.115 rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
22.116 UnparseC.term t;
22.117 @@ -207,7 +207,7 @@
22.118 get_thm Termorder.thy "bdv_n_collect";
22.119 get_thm (theory "Isac_Knowledge") "bdv_n_collect";
22.120 *)
22.121 - val t = (Thm.term_of o the o (parse thy)) "a ^^^2 * x + 7 * a^^^2";
22.122 + val t = (Thm.term_of o the o (TermC.parse thy)) "a ^^^2 * x + 7 * a^^^2";
22.123 val SOME (t,_) =
22.124 rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
22.125 UnparseC.term t;
22.126 @@ -216,7 +216,7 @@
22.127 UnparseC.term t;
22.128 "(7 + x) * a ^^^ 2";
22.129
22.130 - val t = (Thm.term_of o the o (parse Termorder.thy)) "Pi";
22.131 + val t = (Thm.term_of o the o (TermC.parse Termorder.thy)) "Pi";
22.132
22.133 val t = (Thm.term_of o the o (parseold thy)) "7";
22.134 ##################################################################################*)
22.135 @@ -225,14 +225,14 @@
22.136 "----------- Matthias Goldgruber 2003 trials on rewrite orders -------------------------------";
22.137 "----------- Matthias Goldgruber 2003 trials on rewrite orders -------------------------------";
22.138 "----------- Matthias Goldgruber 2003 trials on rewrite orders -------------------------------";
22.139 - val substa = [(TermC.empty, (Thm.term_of o the o (parse thy)) "a")];
22.140 - val substb = [(TermC.empty, (Thm.term_of o the o (parse thy)) "b")];
22.141 - val substx = [(TermC.empty, (Thm.term_of o the o (parse thy)) "x")];
22.142 + val substa = [(TermC.empty, (Thm.term_of o the o (TermC.parse thy)) "a")];
22.143 + val substb = [(TermC.empty, (Thm.term_of o the o (TermC.parse thy)) "b")];
22.144 + val substx = [(TermC.empty, (Thm.term_of o the o (TermC.parse thy)) "x")];
22.145
22.146 - val x1 = (Thm.term_of o the o (parse thy)) "a + b + x";
22.147 - val x2 = (Thm.term_of o the o (parse thy)) "a + x + b";
22.148 - val x3 = (Thm.term_of o the o (parse thy)) "a + x + b";
22.149 - val x4 = (Thm.term_of o the o (parse thy)) "x + a + b";
22.150 + val x1 = (Thm.term_of o the o (TermC.parse thy)) "a + b + x";
22.151 + val x2 = (Thm.term_of o the o (TermC.parse thy)) "a + x + b";
22.152 + val x3 = (Thm.term_of o the o (TermC.parse thy)) "a + x + b";
22.153 + val x4 = (Thm.term_of o the o (TermC.parse thy)) "x + a + b";
22.154
22.155 if ord_make_polynomial_in true thy substx (x1,x2) = true(*LESS *) then ()
22.156 else error "termorder.sml diff.behav ord_make_polynomial_in #1";
22.157 @@ -243,22 +243,22 @@
22.158 if ord_make_polynomial_in true thy substb (x1,x2) = false(*GREATER*) then ()
22.159 else error "termorder.sml diff.behav ord_make_polynomial_in #3";
22.160
22.161 - val aa = (Thm.term_of o the o (parse thy)) "-1 * a * x";
22.162 - val bb = (Thm.term_of o the o (parse thy)) "x^^^3";
22.163 + val aa = (Thm.term_of o the o (TermC.parse thy)) "-1 * a * x";
22.164 + val bb = (Thm.term_of o the o (TermC.parse thy)) "x^^^3";
22.165 ord_make_polynomial_in true thy substx (aa, bb);
22.166 true; (* => LESS *)
22.167
22.168 - val aa = (Thm.term_of o the o (parse thy)) "-1 * a * x";
22.169 - val bb = (Thm.term_of o the o (parse thy)) "x^^^3";
22.170 + val aa = (Thm.term_of o the o (TermC.parse thy)) "-1 * a * x";
22.171 + val bb = (Thm.term_of o the o (TermC.parse thy)) "x^^^3";
22.172 ord_make_polynomial_in true thy substa (aa, bb);
22.173 false; (* => GREATER *)
22.174
22.175 (* und nach dem Re-engineering der Termorders in den 'rulesets'
22.176 kannst Du die 'gr"osste' Variable frei w"ahlen: *)
22.177 - val bdv= (Thm.term_of o the o (parse thy)) "''bdv''";
22.178 - val x = (Thm.term_of o the o (parse thy)) "x";
22.179 - val a = (Thm.term_of o the o (parse thy)) "a";
22.180 - val b = (Thm.term_of o the o (parse thy)) "b";
22.181 + val bdv= (Thm.term_of o the o (TermC.parse thy)) "''bdv''";
22.182 + val x = (Thm.term_of o the o (TermC.parse thy)) "x";
22.183 + val a = (Thm.term_of o the o (TermC.parse thy)) "a";
22.184 + val b = (Thm.term_of o the o (TermC.parse thy)) "b";
22.185 val SOME (t',_) = rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in x2;
22.186 if UnparseC.term t' = "b + x + a" then ()
22.187 else error "termorder.sml diff.behav ord_make_polynomial_in #11";
22.188 @@ -270,7 +270,7 @@
22.189 else error "termorder.sml diff.behav ord_make_polynomial_in #13";
22.190
22.191 val ppp' = "-6 + -5*x + x^^^3 + -1*x^^^2 + -1*x^^^3 + -14*x^^^2";
22.192 - val ppp = (Thm.term_of o the o (parse thy)) ppp';
22.193 + val ppp = (Thm.term_of o the o (TermC.parse thy)) ppp';
22.194 val SOME (t',_) = rewrite_set_inst_ thy false [(bdv,x)] make_polynomial_in ppp;
22.195 if UnparseC.term t' = "-6 + -5 * x + -15 * x ^^^ 2 + 0" then ()
22.196 else error "termorder.sml diff.behav ord_make_polynomial_in #14";
22.197 @@ -280,7 +280,7 @@
22.198 else error "termorder.sml diff.behav ord_make_polynomial_in #15";
22.199
22.200 val ttt' = "(3*x + 5)/18";
22.201 - val ttt = (Thm.term_of o the o (parse thy)) ttt';
22.202 + val ttt = (Thm.term_of o the o (TermC.parse thy)) ttt';
22.203 val SOME (uuu,_) = rewrite_set_inst_ thy false [(bdv,x)] make_polynomial_in ttt;
22.204 if UnparseC.term uuu = "(5 + 3 * x) / 18" then ()
22.205 else error "termorder.sml diff.behav ord_make_polynomial_in #16a";
22.206 @@ -941,7 +941,7 @@
22.207 "-------------------- (3 - 10*x + 3*x^^^2 = 0), ----------------------";
22.208 "-------------------- (3 - 10*x + 3*x^^^2 = 0), ----------------------";
22.209 "---- test the erls ----";
22.210 - val t1 = (Thm.term_of o the o (parse thy)) "0 <= (10/3/2)^^^2 - 1";
22.211 + val t1 = (Thm.term_of o the o (TermC.parse thy)) "0 <= (10/3/2)^^^2 - 1";
22.212 val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_erls t1;
22.213 val t' = UnparseC.term t;
22.214 (*if t'= "HOL.True" then ()
23.1 --- a/test/Tools/isac/Knowledge/polyeq-2.sml Mon Apr 19 13:57:47 2021 +0200
23.2 +++ b/test/Tools/isac/Knowledge/polyeq-2.sml Mon Apr 19 15:02:11 2021 +0200
23.3 @@ -214,22 +214,22 @@
23.4 "----------- rls make_polynomial_in ------------------------------";
23.5 (*Punkte aus dem TestBericht, die ich in rlang.sml nicht zuordnen konnte:*)
23.6 (*WN.19.3.03 ---v-*)
23.7 -(*3(b)*)val (bdv,v) = (str2term "''bdv''", str2term "R1");
23.8 -val t = str2term "-1 * (R * R2) + R2 * R1 + -1 * (R * R1) = 0";
23.9 +(*3(b)*)val (bdv,v) = (TermC.str2term "''bdv''", TermC.str2term "R1");
23.10 +val t = TermC.str2term "-1 * (R * R2) + R2 * R1 + -1 * (R * R1) = 0";
23.11 val SOME (t',_) = rewrite_set_inst_ thy false [(bdv,v)] make_polynomial_in t;
23.12 if UnparseC.term t' = "-1 * R * R2 + R2 * R1 + -1 * R * R1 = 0" then ()
23.13 else error "make_polynomial_in (-1 * (R * R2) + R2 * R1 + -1 * (R * R1) = 0)";
23.14 "-1 * R * R2 + (R2 + -1 * R) * R1 = 0";
23.15 (*WN.19.3.03 ---^-*)
23.16
23.17 -(*3(c)*)val (bdv,v) = (str2term "bdv", str2term "p");
23.18 -val t = str2term "y ^^^ 2 + -2 * (x * p) = 0";
23.19 +(*3(c)*)val (bdv,v) = (TermC.str2term "bdv", TermC.str2term "p");
23.20 +val t = TermC.str2term "y ^^^ 2 + -2 * (x * p) = 0";
23.21 val SOME (t',_) = rewrite_set_inst_ thy false [(bdv,v)] make_polynomial_in t;
23.22 if UnparseC.term t' = "y ^^^ 2 + -2 * x * p = 0" then ()
23.23 else error "make_polynomial_in (y ^^^ 2 + -2 * (x * p) = 0)";
23.24
23.25 -(*3(d)*)val (bdv,v) = (str2term "''bdv''", str2term "x2");
23.26 -val t = str2term
23.27 +(*3(d)*)val (bdv,v) = (TermC.str2term "''bdv''", TermC.str2term "x2");
23.28 +val t = TermC.str2term
23.29 "A + x1 * (y3 * (1 / 2)) + x3 * (y2 * (1 / 2)) + -1 * (x1 * (y2 * (1 / 2))) + -1 * (x3 * (y1 * (1 / 2 ))) + y1 * (1 / 2 * x2) + -1 * (y3 * (1 / 2 * x2)) = 0";
23.30 val SOME (t',_) = rewrite_set_inst_ thy false [(bdv,v)] make_polynomial_in t;
23.31 if UnparseC.term t' =
23.32 @@ -245,13 +245,13 @@
23.33 else error "make_ratpoly_in (A + x1 * (y3 * (1 / 2)) + x3 * (y2 * (1 / 2)) + -1...";
23.34 "A + x1 * y3 * (1 / 2) + x3 * y2 * (1 / 2) + -1 * x1 * y2 * (1 / 2) + -1 * x3 * y1 * (1 / 2) + (y1 * (1 / 2) + -1 * y3 * (1 / 2)) * x2 = 0";
23.35
23.36 -(*3(e)*)val (bdv,v) = (str2term "bdv", str2term "a");
23.37 -val t = str2term
23.38 +(*3(e)*)val (bdv,v) = (TermC.str2term "bdv", TermC.str2term "a");
23.39 +val t = TermC.str2term
23.40 "A ^^^ 2 + c ^^^ 2 * (c / d) ^^^ 2 + (-4 * (c / d) ^^^ 2) * a ^^^ 2 = 0";
23.41 val NONE = rewrite_set_inst_ thy false [(bdv,v)] make_polynomial_in t;
23.42 (* the invisible parentheses are as expected *)
23.43
23.44 -val t = str2term "(x + 1) * (x + 2) - (3 * x - 2) ^^^ 2 - ((2 * x - 1) ^^^ 2 + (3 * x - 1) * (x + 1)) = 0";
23.45 +val t = TermC.str2term "(x + 1) * (x + 2) - (3 * x - 2) ^^^ 2 - ((2 * x - 1) ^^^ 2 + (3 * x - 1) * (x + 1)) = 0";
23.46 Rewrite.trace_on:=(*true*)false;
23.47 rewrite_set_ thy false expand_binoms t;
23.48 Rewrite.trace_on:=false;
23.49 @@ -276,22 +276,22 @@
23.50 "----------- rls d2_polyeq_bdv_only_simplify ---------------------";
23.51 "----------- rls d2_polyeq_bdv_only_simplify ---------------------";
23.52 "----------- rls d2_polyeq_bdv_only_simplify ---------------------";
23.53 -val t = str2term "-6 * x + 5 * x ^^^ 2 = (0::real)";
23.54 -val subst = [(str2term "(bdv::real)", str2term "(x::real)")];
23.55 +val t = TermC.str2term "-6 * x + 5 * x ^^^ 2 = (0::real)";
23.56 +val subst = [(TermC.str2term "(bdv::real)", TermC.str2term "(x::real)")];
23.57 val SOME (t''''', _) = rewrite_set_inst_ thy true subst d2_polyeq_bdv_only_simplify t;
23.58 (* steps in rls d2_polyeq_bdv_only_simplify:*)
23.59
23.60 (*-6 * x + 5 * x ^ 2 = 0 : Rewrite_Inst (["(''bdv'',x)"],("d2_prescind1", "")) --> x * (-6 + 5 * x) = 0*)
23.61 -t |> UnparseC.term; t |> atomty;
23.62 +t |> UnparseC.term; t |> TermC.atomty;
23.63 val thm = ThmC.numerals_to_Free @{thm d2_prescind1};
23.64 -thm |> Thm.prop_of |> UnparseC.term; thm |> Thm.prop_of |> atomty;
23.65 +thm |> Thm.prop_of |> UnparseC.term; thm |> Thm.prop_of |> TermC.atomty;
23.66 val SOME (t', _) = rewrite_inst_ thy e_rew_ord Rule_Set.empty true subst thm t; UnparseC.term t';
23.67
23.68 (*x * (-6 + 5 * x) = 0 : Rewrite_Inst (["(''bdv'',x)"],("d2_reduce_equation1", ""))
23.69 --> x = 0 | -6 + 5 * x = 0*)
23.70 -t' |> UnparseC.term; t' |> atomty;
23.71 +t' |> UnparseC.term; t' |> TermC.atomty;
23.72 val thm = ThmC.numerals_to_Free @{thm d2_reduce_equation1};
23.73 -thm |> Thm.prop_of |> UnparseC.term; thm |> Thm.prop_of |> atomty;
23.74 +thm |> Thm.prop_of |> UnparseC.term; thm |> Thm.prop_of |> TermC.atomty;
23.75 val SOME (t'', _) = rewrite_inst_ thy e_rew_ord Rule_Set.empty true subst thm t'; UnparseC.term t'';
23.76 (* NONE with d2_reduce_equation1: "(bdv*(a +b*bdv)=0) = ((bdv=0)|(a+b*bdv=0))"
23.77 instead d2_reduce_equation1: "(bdv*(a +b*bdv)=0) = ((bdv=0)|(a+b*bdv=(0::real)))"
24.1 --- a/test/Tools/isac/Knowledge/polyminus.sml Mon Apr 19 13:57:47 2021 +0200
24.2 +++ b/test/Tools/isac/Knowledge/polyminus.sml Mon Apr 19 15:02:11 2021 +0200
24.3 @@ -32,32 +32,32 @@
24.4 "----------- fun eval_ist_monom ----------------------------------";
24.5 "----------- fun eval_ist_monom ----------------------------------";
24.6 "----------- fun eval_ist_monom ----------------------------------";
24.7 -ist_monom (str2term "12");
24.8 -case eval_ist_monom 0 0 (str2term "12 ist_monom") 0 of
24.9 +ist_monom (TermC.str2term "12");
24.10 +case eval_ist_monom 0 0 (TermC.str2term "12 ist_monom") 0 of
24.11 SOME ("12 ist_monom = True", _) => ()
24.12 | _ => error "polyminus.sml: 12 ist_monom = True";
24.13
24.14 -case eval_ist_monom 0 0 (str2term "a ist_monom") 0 of
24.15 +case eval_ist_monom 0 0 (TermC.str2term "a ist_monom") 0 of
24.16 SOME ("a ist_monom = True", _) => ()
24.17 | _ => error "polyminus.sml: a ist_monom = True";
24.18
24.19 -case eval_ist_monom 0 0 (str2term "(3*a) ist_monom") 0 of
24.20 +case eval_ist_monom 0 0 (TermC.str2term "(3*a) ist_monom") 0 of
24.21 SOME ("3 * a ist_monom = True", _) => ()
24.22 | _ => error "polyminus.sml: 3 * a ist_monom = True";
24.23
24.24 -case eval_ist_monom 0 0 (str2term "(a^^^2) ist_monom") 0 of
24.25 +case eval_ist_monom 0 0 (TermC.str2term "(a^^^2) ist_monom") 0 of
24.26 SOME ("a ^^^ 2 ist_monom = True", _) => ()
24.27 | _ => error "polyminus.sml: a^^^2 ist_monom = True";
24.28
24.29 -case eval_ist_monom 0 0 (str2term "(3*a^^^2) ist_monom") 0 of
24.30 +case eval_ist_monom 0 0 (TermC.str2term "(3*a^^^2) ist_monom") 0 of
24.31 SOME ("3 * a ^^^ 2 ist_monom = True", _) => ()
24.32 | _ => error "polyminus.sml: 3*a^^^2 ist_monom = True";
24.33
24.34 -case eval_ist_monom 0 0 (str2term "(a*b) ist_monom") 0 of
24.35 +case eval_ist_monom 0 0 (TermC.str2term "(a*b) ist_monom") 0 of
24.36 SOME ("a * b ist_monom = True", _) => ()
24.37 | _ => error "polyminus.sml: a*b ist_monom = True";
24.38
24.39 -case eval_ist_monom 0 0 (str2term "(3*a*b) ist_monom") 0 of
24.40 +case eval_ist_monom 0 0 (TermC.str2term "(3*a*b) ist_monom") 0 of
24.41 SOME ("3 * a * b ist_monom = True", _) => ()
24.42 | _ => error "polyminus.sml: 3*a*b ist_monom = True";
24.43
24.44 @@ -68,7 +68,7 @@
24.45 "----- with these simple variables it works...";
24.46 (*Rewrite.trace_on := true; ..stopped Test_Isac.thy*)
24.47 Rewrite.trace_on:=false;
24.48 -val t = str2term "((a + d) + c) + b";
24.49 +val t = TermC.str2term "((a + d) + c) + b";
24.50 val SOME (t,_) = rewrite_set_ thy false order_add_mult t; UnparseC.term t;
24.51 if UnparseC.term t = "a + (b + (c + d))" then ()
24.52 else error "polyminus.sml 1 watch order_add_mult";
24.53 @@ -76,7 +76,7 @@
24.54
24.55 "----- the same stepwise...";
24.56 val od = ord_make_polynomial true (@{theory "Poly"});
24.57 -val t = str2term "((a + d) + c) + b";
24.58 +val t = TermC.str2term "((a + d) + c) + b";
24.59 "((a + d) + c) + b";
24.60 val SOME (t,_) = rewrite_ thy od Rule_Set.empty true @{thm add.commute} t; UnparseC.term t;
24.61 "b + ((a + d) + c)";
24.62 @@ -90,7 +90,7 @@
24.63 else error "polyminus.sml 2 watch order_add_mult";
24.64
24.65 "----- if parentheses are right, left_commute is (almost) sufficient...";
24.66 -val t = str2term "a + (d + (c + b))";
24.67 +val t = TermC.str2term "a + (d + (c + b))";
24.68 "a + (d + (c + b))";
24.69 val SOME (t,_) = rewrite_ thy od Rule_Set.empty true @{thm add.left_commute} t;UnparseC.term t;
24.70 "a + (c + (d + b))";
24.71 @@ -101,14 +101,14 @@
24.72
24.73 "----- but we do not want the parentheses at right; thus: cond.rew.";
24.74 "WN0712707 complicated monomials do not yet work ...";
24.75 -val t = str2term "((5*a + 4*d) + 3*c) + 2*b";
24.76 +val t = TermC.str2term "((5*a + 4*d) + 3*c) + 2*b";
24.77 val SOME (t,_) = rewrite_set_ thy false order_add_mult t; UnparseC.term t;
24.78 if UnparseC.term t = "2 * b + (3 * c + (4 * d + 5 * a))" then ()
24.79 else error "polyminus.sml: order_add_mult changed";
24.80
24.81 "----- here we see rew_sub going into subterm with ord.rew....";
24.82 val od = ord_make_polynomial false (@{theory "Poly"});
24.83 -val t = str2term "b + a + c + d";
24.84 +val t = TermC.str2term "b + a + c + d";
24.85 val SOME (t,_) = rewrite_ thy od Rule_Set.empty false @{thm add.commute} t; UnparseC.term t;
24.86 val SOME (t,_) = rewrite_ thy od Rule_Set.empty false @{thm add.commute} t; UnparseC.term t;
24.87 (*@@@ rew_sub gosub: t = d + (b + a + c)
24.88 @@ -124,34 +124,34 @@
24.89 "12" < "3"; (*true !!!*)
24.90
24.91 " a kleiner b ==> (b + a) = (a + b)";
24.92 -str2term "aaa";
24.93 -str2term "222 * aaa";
24.94 +TermC.str2term "aaa";
24.95 +TermC.str2term "222 * aaa";
24.96
24.97 -case eval_kleiner 0 0 (str2term "123 kleiner 32") 0 of
24.98 +case eval_kleiner 0 0 (TermC.str2term "123 kleiner 32") 0 of
24.99 SOME ("123 kleiner 32 = False", _) => ()
24.100 | _ => error "polyminus.sml: 12 kleiner 9 = False";
24.101
24.102 -case eval_kleiner 0 0 (str2term "a kleiner b") 0 of
24.103 +case eval_kleiner 0 0 (TermC.str2term "a kleiner b") 0 of
24.104 SOME ("a kleiner b = True", _) => ()
24.105 | _ => error "polyminus.sml: a kleiner b = True";
24.106
24.107 -case eval_kleiner 0 0 (str2term "(10*g) kleiner f") 0 of
24.108 +case eval_kleiner 0 0 (TermC.str2term "(10*g) kleiner f") 0 of
24.109 SOME ("10 * g kleiner f = False", _) => ()
24.110 | _ => error "polyminus.sml: 10 * g kleiner f = False";
24.111
24.112 -case eval_kleiner 0 0 (str2term "(a^^^2) kleiner b") 0 of
24.113 +case eval_kleiner 0 0 (TermC.str2term "(a^^^2) kleiner b") 0 of
24.114 SOME ("a ^^^ 2 kleiner b = True", _) => ()
24.115 | _ => error "polyminus.sml: a ^^^ 2 kleiner b = True";
24.116
24.117 -case eval_kleiner 0 0 (str2term "(3*a^^^2) kleiner b") 0 of
24.118 +case eval_kleiner 0 0 (TermC.str2term "(3*a^^^2) kleiner b") 0 of
24.119 SOME ("3 * a ^^^ 2 kleiner b = True", _) => ()
24.120 | _ => error "polyminus.sml: 3 * a ^^^ 2 kleiner b = True";
24.121
24.122 -case eval_kleiner 0 0 (str2term "(a*b) kleiner c") 0 of
24.123 +case eval_kleiner 0 0 (TermC.str2term "(a*b) kleiner c") 0 of
24.124 SOME ("a * b kleiner c = True", _) => ()
24.125 | _ => error "polyminus.sml: a * b kleiner b = True";
24.126
24.127 -case eval_kleiner 0 0 (str2term "(3*a*b) kleiner c") 0 of
24.128 +case eval_kleiner 0 0 (TermC.str2term "(3*a*b) kleiner c") 0 of
24.129 SOME ("3 * a * b kleiner c = True", _) => ()
24.130 | _ => error "polyminus.sml: 3 * a * b kleiner b = True";
24.131
24.132 @@ -159,52 +159,52 @@
24.133 val od = dummy_ord;
24.134
24.135 val erls = erls_ordne_alphabetisch;
24.136 -val t = str2term "b + a";
24.137 +val t = TermC.str2term "b + a";
24.138 val SOME (t,_) = rewrite_ thy od erls false @{thm tausche_plus} t; UnparseC.term t;
24.139 if UnparseC.term t = "a + b" then ()
24.140 else error "polyminus.sml: ordne_alphabetisch1 b + a";
24.141
24.142 val erls = Atools_erls;
24.143 -val t = str2term "2*a + 3*a";
24.144 +val t = TermC.str2term "2*a + 3*a";
24.145 val SOME (t,_) = rewrite_ thy od erls false @{thm real_num_collect} t; UnparseC.term t;
24.146
24.147 "======= test rewrite_, rewrite_set_";
24.148 (*Rewrite.trace_on := true; ..stopped Test_Isac.thy*)
24.149 val erls = erls_ordne_alphabetisch;
24.150 -val t = str2term "b + a";
24.151 +val t = TermC.str2term "b + a";
24.152 val SOME (t,_) = rewrite_set_ thy false ordne_alphabetisch t; UnparseC.term t;
24.153 if UnparseC.term t = "a + b" then ()
24.154 else error "polyminus.sml: ordne_alphabetisch a + b";
24.155
24.156 -val t = str2term "2*b + a";
24.157 +val t = TermC.str2term "2*b + a";
24.158 val SOME (t,_) = rewrite_set_ thy false ordne_alphabetisch t; UnparseC.term t;
24.159 if UnparseC.term t = "a + 2 * b" then ()
24.160 else error "polyminus.sml: ordne_alphabetisch a + 2 * b";
24.161
24.162 -val t = str2term "a + c + b";
24.163 +val t = TermC.str2term "a + c + b";
24.164 val SOME (t,_) = rewrite_set_ thy false ordne_alphabetisch t; UnparseC.term t;
24.165 if UnparseC.term t = "a + b + c" then ()
24.166 else error "polyminus.sml: ordne_alphabetisch a + b + c";
24.167
24.168 "======= rewrite goes into subterms";
24.169 -val t = str2term "a + c + b + d";
24.170 +val t = TermC.str2term "a + c + b + d";
24.171 val SOME (t,_) = rewrite_ thy od erls false @{thm tausche_plus_plus} t; UnparseC.term t;
24.172 if UnparseC.term t = "a + b + c + d" then ()
24.173 else error "polyminus.sml: ordne_alphabetisch1 a + b + c + d";
24.174
24.175 -val t = str2term "a + c + d + b";
24.176 +val t = TermC.str2term "a + c + d + b";
24.177 val SOME (t,_) = rewrite_set_ thy false ordne_alphabetisch t; UnparseC.term t;
24.178 if UnparseC.term t = "a + b + c + d" then ()
24.179 else error "polyminus.sml: ordne_alphabetisch2 a + b + c + d";
24.180
24.181 "======= here we see rew_sub going into subterm with cond.rew....";
24.182 -val t = str2term "b + a + c + d";
24.183 +val t = TermC.str2term "b + a + c + d";
24.184 val SOME (t,_) = rewrite_ thy od erls false @{thm tausche_plus} t; UnparseC.term t;
24.185 if UnparseC.term t = "a + b + c + d" then ()
24.186 else error "polyminus.sml: ordne_alphabetisch3 a + b + c + d";
24.187
24.188 "======= compile rls for the most complicated terms";
24.189 -val t = str2term "5*e + 6*f - 8*g - 9 - 7*e - 4*f + 10*g + 12";
24.190 +val t = TermC.str2term "5*e + 6*f - 8*g - 9 - 7*e - 4*f + 10*g + 12";
24.191 "5 * e + 6 * f - 8 * g - 9 - 7 * e - 4 * f + 10 * g + 12";
24.192 val SOME (t,_) = rewrite_set_ thy false ordne_alphabetisch t;
24.193 if UnparseC.term t = "- 9 + 12 + 5 * e - 7 * e + 6 * f - 4 * f - 8 * g + 10 * g"
24.194 @@ -214,7 +214,7 @@
24.195 "----------- build fasse_zusammen --------------------------------";
24.196 "----------- build fasse_zusammen --------------------------------";
24.197 "----------- build fasse_zusammen --------------------------------";
24.198 -val t = str2term "- 9 + 12 + 5 * e - 7 * e + 6 * f - 4 * f - 8 * g + 10 * g";
24.199 +val t = TermC.str2term "- 9 + 12 + 5 * e - 7 * e + 6 * f - 4 * f - 8 * g + 10 * g";
24.200 val SOME (t,_) = rewrite_set_ thy false fasse_zusammen t;
24.201 if UnparseC.term t = "3 + -2 * e + 2 * f + 2 * g" then ()
24.202 else error "polyminus.sml: fasse_zusammen finished";
24.203 @@ -222,7 +222,7 @@
24.204 "----------- build verschoenere ----------------------------------";
24.205 "----------- build verschoenere ----------------------------------";
24.206 "----------- build verschoenere ----------------------------------";
24.207 -val t = str2term "3 + -2 * e + 2 * f + 2 * g";
24.208 +val t = TermC.str2term "3 + -2 * e + 2 * f + 2 * g";
24.209 val SOME (t,_) = rewrite_set_ thy false verschoenere t;
24.210 if UnparseC.term t = "3 - 2 * e + 2 * f + 2 * g" then ()
24.211 else error "polyminus.sml: verschoenere 3 + -2 * e ...";
24.212 @@ -238,8 +238,8 @@
24.213 \ (((Try (Rewrite_Set ordne_alphabetisch False)) #> \
24.214 \ (Try (Rewrite_Set fasse_zusammen False)) #> \
24.215 \ (Try (Rewrite_Set verschoenere False))) t_t)"
24.216 -val sc = (inst_abs o Thm.term_of o the o (parse thy)) str;
24.217 -atomty sc;
24.218 +val sc = (inst_abs o Thm.term_of o the o (TermC.parse thy)) str;
24.219 +TermC.atomty sc;
24.220
24.221 "----------- me simplification.for_polynomials.with_minus";
24.222 "----------- me simplification.for_polynomials.with_minus";
24.223 @@ -345,8 +345,8 @@
24.224 \ in (Repeat((Try (Repeat (Calculate ''TIMES''))) #> \
24.225 \ (Try (Repeat (Calculate ''PLUS''))) #> \
24.226 \ (Try (Repeat (Calculate ''MINUS''))))) e_e)"
24.227 -val sc = (inst_abs o Thm.term_of o the o (parse thy)) str;
24.228 -atomty sc;
24.229 +val sc = (inst_abs o Thm.term_of o the o (TermC.parse thy)) str;
24.230 +TermC.atomty sc;
24.231
24.232 "----------- pbl polynom probe -----------------------------------";
24.233 "----------- pbl polynom probe -----------------------------------";
24.234 @@ -422,16 +422,16 @@
24.235 "----- 2 ^^^";
24.236 (*Rewrite.trace_on := true; ..stopped Test_Isac.thy*)
24.237 val erls = erls_ordne_alphabetisch;
24.238 -val t = str2term "- 9 + 12 + 5 * e - 7 * e + (6 - 4) * f - 8 * g + 10 * g";
24.239 +val t = TermC.str2term "- 9 + 12 + 5 * e - 7 * e + (6 - 4) * f - 8 * g + 10 * g";
24.240 val SOME (t',_) =
24.241 rewrite_ (@{theory "Isac_Knowledge"}) e_rew_ord erls false @{thm tausche_minus} t;
24.242 UnparseC.term t'; "- 9 + 12 + 5 * e - 7 * e + (- 4 + 6) * f - 8 * g + 10 * g";
24.243
24.244 -val t = str2term "- 9 + 12 + 5 * e - 7 * e + (6 - 4) * f - 8 * g + 10 * g";
24.245 +val t = TermC.str2term "- 9 + 12 + 5 * e - 7 * e + (6 - 4) * f - 8 * g + 10 * g";
24.246 val NONE =
24.247 rewrite_ (@{theory "Isac_Knowledge"}) e_rew_ord erls false @{thm tausche_minus_plus} t;
24.248
24.249 -val t = str2term "- 9 + 12 + 5 * e - 7 * e + (6 - 4) * f - 8 * g + 10 * g";
24.250 +val t = TermC.str2term "- 9 + 12 + 5 * e - 7 * e + (6 - 4) * f - 8 * g + 10 * g";
24.251 val SOME (t',_) =
24.252 rewrite_set_ (@{theory "Isac_Knowledge"}) false ordne_alphabetisch t;
24.253 UnparseC.term t'; "- 9 + 12 + 5 * e - 7 * e - 8 * g + 10 * g + (- 4 + 6) * f";
24.254 @@ -493,7 +493,7 @@
24.255 "----------- pbl binom polynom vereinfachen p.39 -----------------";
24.256 "----------- pbl binom polynom vereinfachen p.39 -----------------";
24.257 val rls = klammern_ausmultiplizieren;
24.258 -val t = str2term "(3 * a + 2) * (4 * a - 1)";
24.259 +val t = TermC.str2term "(3 * a + 2) * (4 * a - 1)";
24.260 val SOME (t,_) = rewrite_set_ thy false rls t; UnparseC.term t;
24.261 "3 * a * (4 * a) - 3 * a * 1 + (2 * (4 * a) - 2 * 1)";
24.262 val rls = discard_parentheses;
24.263 @@ -503,7 +503,7 @@
24.264 val SOME (t,_) = rewrite_set_ thy false rls t; UnparseC.term t;
24.265 "3 * 4 * a * a - 1 * 3 * a + (2 * 4 * a - 1 * 2)";
24.266 (*
24.267 -val t = str2term "3 * a * 4 * a";
24.268 +val t = TermC.str2term "3 * a * 4 * a";
24.269 val rls = ordne_monome;
24.270 val SOME (t,_) = rewrite_set_ thy false rls t; UnparseC.term t;
24.271 *)
24.272 @@ -552,12 +552,12 @@
24.273 "----------- Refine.refine Vereinfache ----------------------------------";
24.274 val fmz = ["Term (8*(a - q) + a - 2*q + 3*(a - 2*(q::real)))", "normalform (N::real)"];
24.275 (*default_print_depth 11;*)
24.276 -val matches = Refine.refine fmz ["vereinfachen"];
24.277 +val TermC.matches = Refine.refine fmz ["vereinfachen"];
24.278 (*default_print_depth 3;*)
24.279
24.280 "----- go into details, if it seems not to work -----";
24.281 "--- does the predicate evaluate correctly ?";
24.282 -val t = str2term
24.283 +val t = TermC.str2term
24.284 "matchsub (?a * (?b - ?c)) (8 * (a - q) + a - 2 * q + 3 * (a - 2 * (q::real)))";
24.285 val ma = eval_matchsub "" "Prog_Expr.matchsub" t thy;
24.286 case ma of
24.287 @@ -582,7 +582,7 @@
24.288 Rewrite.trace_on := false;
24.289
24.290 "--- does the respective prls rewrite the whole predicate ?";
24.291 -val t = str2term
24.292 +val t = TermC.str2term
24.293 "Not (matchsub (?a * (?b + ?c)) (8 * (a - q) + a - 2 * q) | \
24.294 \ matchsub (?a * (?b - ?c)) (8 * (a - q) + a - 2 * q) | \
24.295 \ matchsub ((?b + ?c) * ?a) (8 * (a - q) + a - 2 * q) | \
24.296 @@ -597,8 +597,8 @@
24.297 "----------- *** Problem.prep_input: syntax error in '#Where' of [v";
24.298 "----------- *** Problem.prep_input: syntax error in '#Where' of [v";
24.299 (*see test/../termC.sml for details*)
24.300 -val t = parse_patt thy "t_t is_polyexp";
24.301 -val t = parse_patt thy ("Not (matchsub (?a + (?b + ?c)) t_t | " ^
24.302 +val t = TermC.parse_patt thy "t_t is_polyexp";
24.303 +val t = TermC.parse_patt thy ("Not (matchsub (?a + (?b + ?c)) t_t | " ^
24.304 " matchsub (?a + (?b - ?c)) t_t | " ^
24.305 " matchsub (?a - (?b + ?c)) t_t | " ^
24.306 " matchsub (?a + (?b - ?c)) t_t )");
25.1 --- a/test/Tools/isac/Knowledge/rateq.sml Mon Apr 19 13:57:47 2021 +0200
25.2 +++ b/test/Tools/isac/Knowledge/rateq.sml Mon Apr 19 15:02:11 2021 +0200
25.3 @@ -20,22 +20,22 @@
25.4 "------------ pbl: rational, univariate, equation ----------------";
25.5 "------------ pbl: rational, univariate, equation ----------------";
25.6 "------------ pbl: rational, univariate, equation ----------------";
25.7 -val t = (Thm.term_of o the o (parse thy)) "(1/b+1/x=1) is_ratequation_in x";
25.8 +val t = (Thm.term_of o the o (TermC.parse thy)) "(1/b+1/x=1) is_ratequation_in x";
25.9 val SOME (t_, _) = rewrite_set_ thy false RatEq_prls t;
25.10 val result = UnparseC.term t_;
25.11 if result <> "True" then error "rateq.sml: new behaviour 1:" else ();
25.12
25.13 -val t = (Thm.term_of o the o (parse thy)) "(sqrt(x)=1) is_ratequation_in x";
25.14 +val t = (Thm.term_of o the o (TermC.parse thy)) "(sqrt(x)=1) is_ratequation_in x";
25.15 val SOME (t_, _) = rewrite_set_ thy false RatEq_prls t;
25.16 val result = UnparseC.term t_;
25.17 if result <> "False" then error "rateq.sml: new behaviour 2:" else ();
25.18
25.19 -val t = (Thm.term_of o the o (parse thy)) "(x=-1) is_ratequation_in x";
25.20 +val t = (Thm.term_of o the o (TermC.parse thy)) "(x=-1) is_ratequation_in x";
25.21 val SOME (t_,_) = rewrite_set_ thy false RatEq_prls t;
25.22 val result = UnparseC.term t_;
25.23 if result <> "False" then error "rateq.sml: new behaviour 3:" else ();
25.24
25.25 -val t = (Thm.term_of o the o (parse thy)) "(3 + x^^^2 + 1/(x^^^2+3)=1) is_ratequation_in x";
25.26 +val t = (Thm.term_of o the o (TermC.parse thy)) "(3 + x^^^2 + 1/(x^^^2+3)=1) is_ratequation_in x";
25.27 val SOME (t_,_) = rewrite_set_ thy false RatEq_prls t;
25.28 val result = UnparseC.term t_;
25.29 if result <> "True" then error "rateq.sml: new behaviour 4:" else ();
25.30 @@ -148,7 +148,7 @@
25.31
25.32 UnparseC.term bdv = "x";
25.33 UnparseC.terms asms = (* asms from rewriting are missing : vvv *)
25.34 - ("[\"<not> matches (?a = 0) (1 = 5 * x) | ~ lhs (1 = 5 * x) is_poly_in x\",\"x = 1 / 5\", " ^
25.35 + ("[\"<not> TermC.matches (?a = 0) (1 = 5 * x) | ~ lhs (1 = 5 * x) is_poly_in x\",\"x = 1 / 5\", " ^
25.36 "\"lhs (1 + -5 * x = 0) is_poly_in x\",\"lhs (1 + -5 * x = 0) has_degree_in x = 1\", " ^
25.37 "\"1 / x = 5 is_ratequation_in x\"]");
25.38 (*
25.39 @@ -158,7 +158,7 @@
25.40 val Applicable.Yes (Check_elementwise' (curr_form, pred, (res, asms))) = check p''''' pt''''' m''''';
25.41 UnparseC.term curr_form = "[x = 1 / 5]";
25.42 pred = "Assumptions";
25.43 -res = str2term "[]::bool list";
25.44 +res = TermC.str2term "[]::bool list";
25.45 asms = [];
25.46
25.47 val (p,_,f,nxt,_,pt) = me nxt''' p''' [] pt'''; (*<<<----- this caused the error*)
25.48 @@ -286,7 +286,7 @@
25.49
25.50 (* *)if eq_set op = ((Ctree.get_assumptions pt p |> map UnparseC.term), [
25.51 (*0.pre*) "x / (x ^^^ 2 - 6 * x + 9) - 1 / (x ^^^ 2 - 3 * x) =\n1 / x is_ratequation_in x",
25.52 -(*1.pre*) "\<not> matches (?a = 0)\n ((3 + -1 * x + x ^^^ 2) * x =\n 1 * (9 * x + -6 * x ^^^ 2 + x ^^^ 3)) \<or>\n"
25.53 +(*1.pre*) "\<not> TermC.matches (?a = 0)\n ((3 + -1 * x + x ^^^ 2) * x =\n 1 * (9 * x + -6 * x ^^^ 2 + x ^^^ 3)) \<or>\n"
25.54 (*1.pre*) ^ "\<not> lhs ((3 + -1 * x + x ^^^ 2) * x =\n 1 * (9 * x + -6 * x ^^^ 2 + x ^^^ 3)) is_poly_in x",
25.55 (*2.pre*) "lhs (-6 * x + 5 * x ^^^ 2 = 0) is_poly_in x",
25.56 (*2.pre*) "lhs (-6 * x + 5 * x ^^^ 2 = 0) has_degree_in x = 2",
25.57 @@ -308,7 +308,7 @@
25.58 if f2str f = "[x = 6 / 5]" andalso eq_set op = (map UnparseC.term (Ctree.get_assumptions pt p),
25.59 ["x = 6 / 5", "lhs (-6 * x + 5 * x ^^^ 2 = 0) is_poly_in x",
25.60 "lhs (-6 * x + 5 * x ^^^ 2 = 0) has_degree_in x = 2",
25.61 - "\<not> matches (?a = 0)\n ((3 + -1 * x + x ^^^ 2) * x =\n 1 * (9 * x + -6 * x ^^^ 2 + x ^^^ 3)) \<or>\n\<not> lhs ((3 + -1 * x + x ^^^ 2) * x =\n 1 * (9 * x + -6 * x ^^^ 2 + x ^^^ 3)) is_poly_in x",
25.62 + "\<not> TermC.matches (?a = 0)\n ((3 + -1 * x + x ^^^ 2) * x =\n 1 * (9 * x + -6 * x ^^^ 2 + x ^^^ 3)) \<or>\n\<not> lhs ((3 + -1 * x + x ^^^ 2) * x =\n 1 * (9 * x + -6 * x ^^^ 2 + x ^^^ 3)) is_poly_in x",
25.63 "x \<noteq> 0", "9 * x + -6 * x ^^^ 2 + x ^^^ 3 \<noteq> 0",
25.64 "x / (x ^^^ 2 - 6 * x + 9) - 1 / (x ^^^ 2 - 3 * x) =\n1 / x is_ratequation_in x"])
25.65 then () else error "test CHANGED";
26.1 --- a/test/Tools/isac/Knowledge/rational-old.sml Mon Apr 19 13:57:47 2021 +0200
26.2 +++ b/test/Tools/isac/Knowledge/rational-old.sml Mon Apr 19 15:02:11 2021 +0200
26.3 @@ -175,18 +175,18 @@
26.4
26.5 (*
26.6 print("***** TERM2POLY-TESTS *****\n");
26.7 -val t0 = (Thm.term_of o the o (parse thy)) "3 * 4";
26.8 -val t1 = (Thm.term_of o the o (parse thy)) "27";
26.9 -val t11= (Thm.term_of o the o (parse thy)) "27 * c";
26.10 -val t2 = (Thm.term_of o the o (parse thy)) "b";
26.11 -val t23= (Thm.term_of o the o (parse thy)) "c^^^7";
26.12 -val t24= (Thm.term_of o the o (parse thy)) "5 * c^^^7";
26.13 -val t26= (Thm.term_of o the o (parse thy)) "a * b";
26.14 -val t3 = (Thm.term_of o the o (parse thy)) "2 + a";
26.15 -val t4 = (Thm.term_of o the o (parse thy)) "b + a";
26.16 -val t5 = (Thm.term_of o the o (parse thy)) "2 + a^^^3";*)
26.17 -val t6 = (Thm.term_of o the o (parse thy)) "5*a^^^2*b^^^3*c+4*a^^^4*b+2*a*c";
26.18 -val t7 = (Thm.term_of o the o (parse thy)) "a-b";
26.19 +val t0 = (Thm.term_of o the o (TermC.parse thy)) "3 * 4";
26.20 +val t1 = (Thm.term_of o the o (TermC.parse thy)) "27";
26.21 +val t11= (Thm.term_of o the o (TermC.parse thy)) "27 * c";
26.22 +val t2 = (Thm.term_of o the o (TermC.parse thy)) "b";
26.23 +val t23= (Thm.term_of o the o (TermC.parse thy)) "c^^^7";
26.24 +val t24= (Thm.term_of o the o (TermC.parse thy)) "5 * c^^^7";
26.25 +val t26= (Thm.term_of o the o (TermC.parse thy)) "a * b";
26.26 +val t3 = (Thm.term_of o the o (TermC.parse thy)) "2 + a";
26.27 +val t4 = (Thm.term_of o the o (TermC.parse thy)) "b + a";
26.28 +val t5 = (Thm.term_of o the o (TermC.parse thy)) "2 + a^^^3";*)
26.29 +val t6 = (Thm.term_of o the o (TermC.parse thy)) "5*a^^^2*b^^^3*c+4*a^^^4*b+2*a*c";
26.30 +val t7 = (Thm.term_of o the o (TermC.parse thy)) "a-b";
26.31 (*
26.32 (the o term2poly) t0;
26.33 (the o term2poly) t1;
26.34 @@ -204,28 +204,28 @@
26.35
26.36 print("\n\n***** STEP_CANCEL_TESTS: *****\n");
26.37 (*
26.38 -val term2 = (Thm.term_of o the o (parse thy)) " (9 * a^^^2 * b) /// (6 * a * c)";
26.39 +val term2 = (Thm.term_of o the o (TermC.parse thy)) " (9 * a^^^2 * b) /// (6 * a * c)";
26.40 val div2 = step_cancel term2;
26.41 atomt div2;
26.42 *)
26.43
26.44 -val term1 = (Thm.term_of o the o (parse thy)) "(10 * a^^^2 * b * c + 14 * a * b + 3 * a * c + 20 * a * b^^^2 * c) /// a";
26.45 +val term1 = (Thm.term_of o the o (TermC.parse thy)) "(10 * a^^^2 * b * c + 14 * a * b + 3 * a * c + 20 * a * b^^^2 * c) /// a";
26.46 val div1 = step_cancel term1;
26.47 -(*if div1 = (Thm.term_of o the o (parse thy)) "((10 * a * b * c + 14 * b + 3 * c + 20 * b^^^2 * c) * a) /// (1 * a)" then () else raise error ("Test failed");*)
26.48 +(*if div1 = (Thm.term_of o the o (TermC.parse thy)) "((10 * a * b * c + 14 * b + 3 * c + 20 * b^^^2 * c) * a) /// (1 * a)" then () else raise error ("Test failed");*)
26.49
26.50 -val term2 = (Thm.term_of o the o (parse thy)) "(10 * a^^^2 * b * c + 14 * a * b + 3 * a * c + 20 * a * b^^^2 * c) /// (5 * a * b * c + 7 * a^^^2 * b * c) ";
26.51 +val term2 = (Thm.term_of o the o (TermC.parse thy)) "(10 * a^^^2 * b * c + 14 * a * b + 3 * a * c + 20 * a * b^^^2 * c) /// (5 * a * b * c + 7 * a^^^2 * b * c) ";
26.52 val div2 = step_cancel term2;
26.53 (*if div2 = ([(10,[1,1,1]),(20,[0,2,1]),(14,[0,1,0]),(3,[0,0,1])],[(1,[1,0,0])],[(7,[1,1,1]),(5,[0,1,1])]) then () else raise error ("Test failed");*)
26.54
26.55
26.56 -val term3 = (Thm.term_of o the o (parse thy)) "(10 * a^^^2 * b * c) /// (1 * x * y * z) ";
26.57 +val term3 = (Thm.term_of o the o (TermC.parse thy)) "(10 * a^^^2 * b * c) /// (1 * x * y * z) ";
26.58 val div3 = step_cancel term3;
26.59
26.60
26.61
26.62 -(*val mul1=(Thm.term_of o the o (parse thy)) "(5*a*b*c+4*a*b+2*a*c)";
26.63 -val mul2=(the (term2poly((Thm.term_of o the o (parse thy)) "13*a^^^2*b*c+7*a*b-19*a*b*c^^^2")));
26.64 -val mul3=(the (term2poly((Thm.term_of o the o (parse thy)) "6*a*b^^^2-13*a^^^2*b^^^2*c^^^2+21*a^^^2*b*c")));
26.65 +(*val mul1=(Thm.term_of o the o (TermC.parse thy)) "(5*a*b*c+4*a*b+2*a*c)";
26.66 +val mul2=(the (term2poly((Thm.term_of o the o (TermC.parse thy)) "13*a^^^2*b*c+7*a*b-19*a*b*c^^^2")));
26.67 +val mul3=(the (term2poly((Thm.term_of o the o (TermC.parse thy)) "6*a*b^^^2-13*a^^^2*b^^^2*c^^^2+21*a^^^2*b*c")));
26.68 val t1=mv_mul(mul1,mul2,LEX_);
26.69 val t2=mv_mul(mul3,mul2,LEX_);
26.70 val div3=step_cancel t1 t2;
26.71 @@ -237,7 +237,7 @@
26.72
26.73 val thy = Rational.thy;
26.74 val rls = Prls {func=cancel};
26.75 -val t = (Thm.term_of o the o (parse thy))
26.76 +val t = (Thm.term_of o the o (TermC.parse thy))
26.77 "(1 + 1 * a ^^^ 1)///(-2 + 2 * a ^^^ 2)";
26.78 val (t,asm) = the (rewrite_set_ thy eval_rls false rls t);
26.79
26.80 @@ -261,9 +261,9 @@
26.81 val (t',asm') = the (rewrite_set thy' "eval_rls" false rls' t');
26.82
26.83 (*
26.84 -val term2 = (Thm.term_of o the o (parse thy)) "(a^^^2 * b + 2 * a * b + b ) /// ( a^^^2 - 1 )";
26.85 +val term2 = (Thm.term_of o the o (TermC.parse thy)) "(a^^^2 * b + 2 * a * b + b ) /// ( a^^^2 - 1 )";
26.86 val div2 = direct_cancel term2;
26.87 -val t = (Thm.term_of o the o (parse thy)) "(1 + 1 * a ^^^ 1)///(-2 + 2 * a ^^^ 2) = 0";*)
26.88 +val t = (Thm.term_of o the o (TermC.parse thy)) "(1 + 1 * a ^^^ 1)///(-2 + 2 * a ^^^ 2) = 0";*)
26.89
26.90
26.91
26.92 @@ -291,7 +291,7 @@
26.93 val e186c'="(144 * a^^^2 * b * c) / (12 * a * b * c )";
26.94 val e186c = (the (rewrite_set thy' "rational_erls" false rls' e186c'))
26.95 handle e => OldGoals.print_exn e;
26.96 -val t = (Thm.term_of o the o (parse thy)) e186c';
26.97 +val t = (Thm.term_of o the o (TermC.parse thy)) e186c';
26.98 atomt t;
26.99
26.100 print("\n\nexample 187:\n");
26.101 @@ -600,7 +600,7 @@
26.102
26.103
26.104 (*
26.105 - val t = (Thm.term_of o the o (parse thy))
26.106 + val t = (Thm.term_of o the o (TermC.parse thy))
26.107 "(9 - x ^^^ 2) / (9 - 6 * x + x ^^^ 2)";
26.108 val SOME (t',_) = factor_expanded_ thy t;
26.109 UnparseC.term t';
26.110 @@ -616,7 +616,7 @@
26.111 the 'reverse-ruleset' cancel*)
26.112
26.113 (*the term for which reverse rewriting is demonstrated*)
26.114 - val t = (Thm.term_of o the o (parse thy))
26.115 + val t = (Thm.term_of o the o (TermC.parse thy))
26.116 "(9 - x ^^^ 2) / (9 + 6 * x + x ^^^ 2)";
26.117 val Rrls {scr=Rfuns {init_state=ini,locate_rule=loc,
26.118 next_rule=nex,normal_form=nor,...},...} = cancel;
26.119 @@ -677,7 +677,7 @@
26.120 (*WN.11.9.02: the 'reverse-ruleset' cancel*)
26.121
26.122 (*the term for which reverse rewriting is demonstrated*)
26.123 - val t = (Thm.term_of o the o (parse thy))
26.124 + val t = (Thm.term_of o the o (TermC.parse thy))
26.125 "(9 + (-1)*x^^^2) / (9 + ((-6)*x + x^^^2))";
26.126 val Rrls {scr=Rfuns {init_state=ini,locate_rule=loc,
26.127 next_rule=nex,normal_form=nor,...},...} = cancel;
26.128 @@ -731,8 +731,8 @@
26.129 OK Thm ("real_mult_div_cancel2", "?k ~= 0 ==> ?m * ?k / (?n * ?k) = ?m / ?n")]
26.130 -------- revset ----------------------------------------------------
26.131
26.132 - val t = (Thm.term_of o the o (parse thy)) "(-6) * x";
26.133 - val t = (Thm.term_of o the o (parse thy))
26.134 + val t = (Thm.term_of o the o (TermC.parse thy)) "(-6) * x";
26.135 + val t = (Thm.term_of o the o (TermC.parse thy))
26.136 "(9 + (-1)*x^^^2) / (9 + ((-6)*x + x^^^2))";
26.137 val thm = (mk_thm thy "(-6) * x = 2 * ((-3) * x)")
26.138 handle e => OldGoals.print_exn e;
26.139 @@ -744,38 +744,38 @@
26.140
26.141 (* SK: Testbeispiele --- WN kopiert Rational.ML -> rational.sml-----
26.142
26.143 -val t1 = (Thm.term_of o the o (parse thy)) "((3 * x^^^2 + 6 *x + 3) / (2*x + 2))";
26.144 +val t1 = (Thm.term_of o the o (TermC.parse thy)) "((3 * x^^^2 + 6 *x + 3) / (2*x + 2))";
26.145 val SOME (t1',rest)= cancel_ thy t1;
26.146 val SOME (t1'',_)= factor_out_gcd_ thy t1;
26.147 print(UnparseC.term t1'^" + Einschr\"ankung: "^UnparseC.term (hd(rest)));
26.148 UnparseC.term t1'';
26.149
26.150 -val t1 = (Thm.term_of o the o (parse thy)) "((-3 * x^^^2 + 6 *x - 3) / (2*x - 2))";
26.151 +val t1 = (Thm.term_of o the o (TermC.parse thy)) "((-3 * x^^^2 + 6 *x - 3) / (2*x - 2))";
26.152 val SOME (t1',_)= cancel_ thy t1;
26.153 val SOME (t1'',_)= factor_expanded_ thy t1;
26.154 UnparseC.term t1';
26.155 UnparseC.term t1'';
26.156
26.157 -val t2 = (Thm.term_of o the o (parse thy)) "((x+ (-1)) / (x + 1)) + ((x + 1) / (x + (-1)))";
26.158 +val t2 = (Thm.term_of o the o (TermC.parse thy)) "((x+ (-1)) / (x + 1)) + ((x + 1) / (x + (-1)))";
26.159 val SOME (t2',_) = add_fractions_ thy t2;
26.160 val SOME (t2'',_) = common_nominators_ thy t2;
26.161 UnparseC.term t2';
26.162 UnparseC.term t2'';
26.163
26.164 -val t2 = (Thm.term_of o the o (parse thy)) "((x - 1) / (x + 1)) + ((x + 1) / (x - 1))";
26.165 +val t2 = (Thm.term_of o the o (TermC.parse thy)) "((x - 1) / (x + 1)) + ((x + 1) / (x - 1))";
26.166 val SOME (t2',_) = add_expanded_frac_ thy t2;
26.167 val SOME (t2'',_) = common_expanded_nom_ thy t2;
26.168 UnparseC.term t2';
26.169 UnparseC.term t2'';
26.170
26.171
26.172 -val t3 = (Thm.term_of o the o (parse thy)) "((1) / (2*x + 2)) + ((1) / (2*x + (-2))) + ((1) / ( x^^^2 + (-1)))+((1) / (x^^^2 + (-2)*x + 1))";
26.173 +val t3 = (Thm.term_of o the o (TermC.parse thy)) "((1) / (2*x + 2)) + ((1) / (2*x + (-2))) + ((1) / ( x^^^2 + (-1)))+((1) / (x^^^2 + (-2)*x + 1))";
26.174 val SOME (t3',_) = common_nominators_ thy t3;
26.175 val SOME (t3'',_) = add_fractions_ thy t3;
26.176 (UnparseC.term t3');
26.177 (UnparseC.term t3'');
26.178
26.179 -val t3 = (Thm.term_of o the o (parse thy)) "((1) / (2*x + 2)) + ((1) / (2*x - 2)) + ((1) / ( x^^^2 - 1))+((1) / (x^^^2 - 2 * x + 1))";
26.180 +val t3 = (Thm.term_of o the o (TermC.parse thy)) "((1) / (2*x + 2)) + ((1) / (2*x - 2)) + ((1) / ( x^^^2 - 1))+((1) / (x^^^2 - 2 * x + 1))";
26.181 val SOME (t3',_) = common_expanded_nom_ thy t3;
26.182 val SOME (t3'',_) = add_expanded_frac_ thy t3;
26.183 (UnparseC.term t3');
26.184 @@ -787,10 +787,10 @@
26.185 UnparseC.term t4;
26.186 UnparseC.term (hd(t5));*)
26.187
26.188 -(*val test1 = (Thm.term_of o the o (parse thy)) "1 - x^^^2 - 5 * x^^^5";
26.189 -val test2 = (Thm.term_of o the o (parse thy)) "1 + (-1) * x ^^^ 2 + (-5) * x ^^^ 5";
26.190 -val test2 = (Thm.term_of o the o (parse thy)) "1 - x";
26.191 -val test2 = (Thm.term_of o the o (parse thy)) "1 + (-1) * x";
26.192 +(*val test1 = (Thm.term_of o the o (TermC.parse thy)) "1 - x^^^2 - 5 * x^^^5";
26.193 +val test2 = (Thm.term_of o the o (TermC.parse thy)) "1 + (-1) * x ^^^ 2 + (-5) * x ^^^ 5";
26.194 +val test2 = (Thm.term_of o the o (TermC.parse thy)) "1 - x";
26.195 +val test2 = (Thm.term_of o the o (TermC.parse thy)) "1 + (-1) * x";
26.196 UnparseC.term(expanded2term(test1));
26.197 UnparseC.term(term2expanded(test2)); *)
26.198
26.199 @@ -798,7 +798,7 @@
26.200
26.201 (* WN kopiert 16.10.02 Rational.ML -> rational.sml-----vvv---*)
26.202
26.203 - val t=(Thm.term_of o the o (parse thy)) "(9 - x^^^2)/(9 - 6*x + x^^^2)";
26.204 + val t=(Thm.term_of o the o (TermC.parse thy)) "(9 - x^^^2)/(9 - 6*x + x^^^2)";
26.205 val SOME (t',_) = factout_ thy t;
26.206 val SOME (t'',_) = cancel_ thy t;
26.207 UnparseC.term t';
26.208 @@ -806,7 +806,7 @@
26.209 "(3 + x) * (3 - x) / ((3 - x) * (3 - x))";
26.210 "(3 + x) / (3 - x)";
26.211
26.212 - val t=(Thm.term_of o the o(parse thy))
26.213 + val t=(Thm.term_of o the o(TermC.parse thy))
26.214 "(9 - x^^^2) / (9 - 6*x + x^^^2) + 1 / (3 - x)";
26.215 val SOME (t',_) = common_nominator_ thy t;
26.216 val SOME (t'',_) = add_fraction_ thy t;
26.217 @@ -816,7 +816,7 @@
26.218 "(4 + x) / (3 - x)";
26.219
26.220 (*WN.16.10.02 hinzugef"ugt -----vv---*)
26.221 - val t=(Thm.term_of o the o(parse thy))
26.222 + val t=(Thm.term_of o the o(TermC.parse thy))
26.223 "(9 - x^^^2) / (9 - 6*x + x^^^2) + 1";
26.224 val SOME (t',_) = common_nominator_ thy t;
26.225 val SOME (t'',_) = add_fraction_ thy t;
26.226 @@ -826,7 +826,7 @@
26.227 \1 * (9 - 6 * x + x ^^^ 2) / (9 - 6 * x + x ^^^ 2)";
26.228 "6 / (3 - x)";
26.229
26.230 - val t=(Thm.term_of o the o(parse thy))
26.231 + val t=(Thm.term_of o the o(TermC.parse thy))
26.232 "1 + (9 - x^^^2) / (9 - 6*x + x^^^2)";
26.233 val SOME (t',_) = common_nominator_ thy t;
26.234 val SOME (t'',_) = add_fraction_ thy t;
26.235 @@ -837,7 +837,7 @@
26.236 "6 / (3 - x)";
26.237 (*WN.16.10.02 hinzugef"ugt -----^^---*)
26.238
26.239 - val t=(Thm.term_of o the o (parse thy))
26.240 + val t=(Thm.term_of o the o (TermC.parse thy))
26.241 "(y^^^2 - x^^^2)/(y^^^2 - 2*y*x + x^^^2)";
26.242 val SOME (t',_) = factout_ thy t;
26.243 val SOME (t'',_) = cancel_ thy t;
26.244 @@ -846,7 +846,7 @@
26.245 "(y + x) * (y - x) / ((y - x) * (y - x))";
26.246 "(y + x) / (y - x)";
26.247
26.248 - val t=(Thm.term_of o the o (parse thy))
26.249 + val t=(Thm.term_of o the o (TermC.parse thy))
26.250 "(y^^^2 - x^^^2)/(y^^^2 - 2*y*x + x^^^2) + 1 / (y - x)";
26.251 val SOME (t',_) = common_nominator_ thy t;
26.252 val SOME (t'',_) = add_fraction_ thy t;
26.253 @@ -857,7 +857,7 @@
26.254 "((-1) - x - y) / (x - y)";
26.255 (*WN.16.10.02 ^^^^^^^ Reihenfolge aus Angabe umgekehrt ?!*)
26.256
26.257 - val t=(Thm.term_of o the o (parse thy))
26.258 + val t=(Thm.term_of o the o (TermC.parse thy))
26.259 "(x^^^2 - y^^^2)/(x^^^2 - 2*x*y + y^^^2) + 1 / (x - y)";
26.260 val SOME (t',_) = common_nominator_ thy t;
26.261 val SOME (t'',_) = add_fraction_ thy t;
26.262 @@ -868,7 +868,7 @@
26.263 "((-1) - y - x) / (y - x)";
26.264 (*WN.16.10.02 ^^^^^^^ lexicographische Ordnung ?!*)
26.265
26.266 - val t=(Thm.term_of o the o (parse thy))
26.267 + val t=(Thm.term_of o the o (TermC.parse thy))
26.268 "(y^^^2 - x^^^2)/(y^^^2 - 2*y*x + x^^^2)";
26.269 val SOME (t',_) = norm_expanded_rat_ thy t;
26.270 UnparseC.term t';
26.271 @@ -878,7 +878,7 @@
26.272 *** RATIONALS_TERM2POLY_EXCEPTION: Invalid Polynomial
26.273 WN.16.10.02 ?!*)
26.274
26.275 - val t=(Thm.term_of o the o (parse thy))
26.276 + val t=(Thm.term_of o the o (TermC.parse thy))
26.277 "(9 - x^^^2)/(9 - 6*x + x^^^2) + (1)/(3 + x)";
26.278 val SOME (t',_) = norm_expanded_rat_ thy t;
26.279 UnparseC.term t';
26.280 @@ -888,7 +888,7 @@
26.281 *** RATIONALS_TERM2POLY_EXCEPTION: Invalid Polynomial
26.282 WN.16.10.02 ?!*)
26.283
26.284 - val t=(Thm.term_of o the o (parse thy))
26.285 + val t=(Thm.term_of o the o (TermC.parse thy))
26.286 "(9 + (-1)* x^^^2)/(9 + (-1)* 6*x + x^^^2) + (1)/(3 + x)";
26.287 val SOME (t',_) = norm_expanded_rat_ thy t;
26.288 val SOME (t'',_) = norm_rational_ thy t;
27.1 --- a/test/Tools/isac/Knowledge/rational.sml Mon Apr 19 13:57:47 2021 +0200
27.2 +++ b/test/Tools/isac/Knowledge/rational.sml Mon Apr 19 15:02:11 2021 +0200
27.3 @@ -52,46 +52,46 @@
27.4 val ctxt = Proof_Context.init_global @{theory}
27.5 val vs = TermC.vars_of (the (parseNEW ctxt "12 * x^^^3 * y^^^4 * z^^^6"));
27.6
27.7 -if poly_of_term vs (str2term "12::real") = SOME [(12, [0, 0, 0])]
27.8 +if poly_of_term vs (TermC.str2term "12::real") = SOME [(12, [0, 0, 0])]
27.9 then () else error "poly_of_term 1 changed";
27.10 -if poly_of_term vs (str2term "x::real") = SOME [(1, [1, 0, 0])]
27.11 +if poly_of_term vs (TermC.str2term "x::real") = SOME [(1, [1, 0, 0])]
27.12 then () else error "poly_of_term 2 changed";
27.13 -if poly_of_term vs (str2term "12 * x^^^3") = SOME [(12, [3, 0, 0])]
27.14 +if poly_of_term vs (TermC.str2term "12 * x^^^3") = SOME [(12, [3, 0, 0])]
27.15 then () else error "poly_of_term 3 changed";
27.16 -if poly_of_term vs (str2term "12 * x^^^3 * y^^^4 * z^^^6") = SOME [(12, [3, 4, 6])]
27.17 +if poly_of_term vs (TermC.str2term "12 * x^^^3 * y^^^4 * z^^^6") = SOME [(12, [3, 4, 6])]
27.18 then () else error "poly_of_term 4 changed";
27.19 -if poly_of_term vs (str2term "1 + 2 * x^^^3 * y^^^4 * z^^^6 + y") =
27.20 +if poly_of_term vs (TermC.str2term "1 + 2 * x^^^3 * y^^^4 * z^^^6 + y") =
27.21 SOME [(1, [0, 0, 0]), (1, [0, 1, 0]), (2, [3, 4, 6])]
27.22 then () else error "poly_of_term 5 changed";
27.23
27.24 (*poly_of_term is quite liberal:*)
27.25 (*the coefficient may be somewhere, the order of variables and the parentheses
27.26 within a monomial are arbitrary*)
27.27 -if poly_of_term vs (str2term "y^^^4 * (x^^^3 * 12 * z^^^6)") = SOME [(12, [3, 4, 6])]
27.28 +if poly_of_term vs (TermC.str2term "y^^^4 * (x^^^3 * 12 * z^^^6)") = SOME [(12, [3, 4, 6])]
27.29 then () else error "poly_of_term 6 changed";
27.30
27.31 (*there may even be more than 1 coefficient:*)
27.32 -if poly_of_term vs (str2term "2 * y^^^4 * (x^^^3 * 6 * z^^^6)") = SOME [(12, [3, 4, 6])]
27.33 +if poly_of_term vs (TermC.str2term "2 * y^^^4 * (x^^^3 * 6 * z^^^6)") = SOME [(12, [3, 4, 6])]
27.34 then () else error "poly_of_term 7 changed";
27.35
27.36 (*the order and the parentheses within monomials are arbitrary:*)
27.37 -if poly_of_term vs (str2term "2 * x^^^3 * y^^^4 * z^^^6 + (7 * y^^^8 + 1)")
27.38 +if poly_of_term vs (TermC.str2term "2 * x^^^3 * y^^^4 * z^^^6 + (7 * y^^^8 + 1)")
27.39 = SOME [(1, [0, 0, 0]), (7, [0, 8, 0]), (2, [3, 4, 6])]
27.40 then () else error "poly_of_term 8 changed";
27.41
27.42 "-------- fun is_poly --------------------------------------------------------";
27.43 "-------- fun is_poly --------------------------------------------------------";
27.44 "-------- fun is_poly --------------------------------------------------------";
27.45 -if is_poly (str2term "2 * x^^^3 * y^^^4 * z^^^6 + 7 * y^^^8 + 1")
27.46 +if is_poly (TermC.str2term "2 * x^^^3 * y^^^4 * z^^^6 + 7 * y^^^8 + 1")
27.47 then () else error "is_poly 1 changed";
27.48 -if not (is_poly (str2term "2 * (x^^^3 * y^^^4 * z^^^6 + 7) * y^^^8 + 1"))
27.49 +if not (is_poly (TermC.str2term "2 * (x^^^3 * y^^^4 * z^^^6 + 7) * y^^^8 + 1"))
27.50 then () else error "is_poly 2 changed";
27.51
27.52 "-------- fun term_of_poly ---------------------------------------------------";
27.53 "-------- fun term_of_poly ---------------------------------------------------";
27.54 "-------- fun term_of_poly ---------------------------------------------------";
27.55 val expT = HOLogic.realT
27.56 -val Free (_, baseT) = (hd o vars o str2term) "12 * x^^^3 * y^^^4 * z^^^6";
27.57 +val Free (_, baseT) = (hd o vars o TermC.str2term) "12 * x^^^3 * y^^^4 * z^^^6";
27.58 val p = [(1, [0, 0, 0]), (7, [0, 8, 0]), (2, [3, 4, 5])]
27.59 val vs = TermC.vars_of (the (parseNEW ctxt "12 * x^^^3 * y^^^4 * z^^^6"))
27.60 (*precondition for [(c, es),...]: legth es = length vs*)
27.61 @@ -102,7 +102,7 @@
27.62 "-------- integration lev.1 fun factout_p_ -----------------------------------";
27.63 "-------- integration lev.1 fun factout_p_ -----------------------------------";
27.64 "-------- integration lev.1 fun factout_p_ -----------------------------------";
27.65 -val t = str2term "(x^^^2 + -1*y^^^2) / (x^^^2 + -1*x*y)"
27.66 +val t = TermC.str2term "(x^^^2 + -1*y^^^2) / (x^^^2 + -1*x*y)"
27.67 val SOME (t', asm) = factout_p_ thy t;
27.68 if UnparseC.term t' = "(x + y) * (x + -1 * y) / (x * (x + -1 * y))"
27.69 then () else error ("factout_p_ term 1 changed: " ^ UnparseC.term t')
27.70 @@ -110,10 +110,10 @@
27.71 if UnparseC.terms asm = "[\"x \<noteq> 0\",\"x + -1 * y \<noteq> 0\"]"
27.72 then () else error "factout_p_ asm 1 changed"
27.73 ;
27.74 -val t = str2term "nothing + to_cancel ::real";
27.75 +val t = TermC.str2term "nothing + to_cancel ::real";
27.76 if NONE = factout_p_ thy t then () else error "factout_p_ doesn't report non-applicable";
27.77 ;
27.78 -val t = str2term "((3 * x^^^2 + 6 *x + 3) / (2*x + 2))";
27.79 +val t = TermC.str2term "((3 * x^^^2 + 6 *x + 3) / (2*x + 2))";
27.80 val SOME (t', asm) = factout_p_ thy t;
27.81 if UnparseC.term t' = "(3 + 3 * x) * (1 + x) / (2 * (1 + x))" andalso
27.82 UnparseC.terms asm = "[\"1 + x \<noteq> 0\"]"
27.83 @@ -122,15 +122,15 @@
27.84 "-------- integration lev.1 fun cancel_p_ ------------------------------------";
27.85 "-------- integration lev.1 fun cancel_p_ ------------------------------------";
27.86 "-------- integration lev.1 fun cancel_p_ ------------------------------------";
27.87 -val t = str2term "(x^^^2 + -1*y^^^2) / (x^^^2 + -1*x*y)"
27.88 +val t = TermC.str2term "(x^^^2 + -1*y^^^2) / (x^^^2 + -1*x*y)"
27.89 val SOME (t', asm) = cancel_p_ thy t;
27.90 if (UnparseC.term t', UnparseC.terms asm) = ("(x + y) / x", "[\"x \<noteq> 0\"]")
27.91 then () else error ("cancel_p_ (t', asm) 1 changed: " ^ UnparseC.term t')
27.92 ;
27.93 -val t = str2term "nothing + to_cancel ::real";
27.94 +val t = TermC.str2term "nothing + to_cancel ::real";
27.95 if NONE = cancel_p_ thy t then () else error "cancel_p_ doesn't report non-applicable";
27.96 ;
27.97 -val t = str2term "((3 * x^^^2 + 6 *x + 3) / (2*x + 2))";
27.98 +val t = TermC.str2term "((3 * x^^^2 + 6 *x + 3) / (2*x + 2))";
27.99 val SOME (t', asm) = cancel_p_ thy t;
27.100 if UnparseC.term t' = "(3 + 3 * x) / 2" andalso UnparseC.terms asm = "[]"
27.101 then () else error "cancel_p_ 1 changed";
27.102 @@ -138,7 +138,7 @@
27.103 "-------- integration lev.1 fun common_nominator_p_ --------------------------";
27.104 "-------- integration lev.1 fun common_nominator_p_ --------------------------";
27.105 "-------- integration lev.1 fun common_nominator_p_ --------------------------";
27.106 -val t = str2term ("y / (a*x + b*x + c*x) " ^
27.107 +val t = TermC.str2term ("y / (a*x + b*x + c*x) " ^
27.108 (* n1 d1 *)
27.109 "+ a / (x*y)");
27.110 (* n2 d2 *)
27.111 @@ -153,7 +153,7 @@
27.112 then () else error "common_nominator_p_ asm 1 changed"
27.113
27.114 "-------- example in mail Nipkow";
27.115 -val t = str2term "x/(x^^^2 + -1*y^^^2) + y/(x^^^2 + -1*x*y)";
27.116 +val t = TermC.str2term "x/(x^^^2 + -1*y^^^2) + y/(x^^^2 + -1*x*y)";
27.117 val SOME (t', asm) = common_nominator_p_ thy t;
27.118 if UnparseC.term t' = "x * x / " ^
27.119 "((x + -1 * y) * ((x + y) * x))" ^
27.120 @@ -166,10 +166,10 @@
27.121 then () else error "common_nominator_p_ asm 2 changed"
27.122
27.123 "-------- example: applicable tested by SML code";
27.124 -val t = str2term "nothing / to_add";
27.125 +val t = TermC.str2term "nothing / to_add";
27.126 if NONE = common_nominator_p_ thy t then () else error "common_nominator_p_ term 3 changed";
27.127 ;
27.128 -val t = str2term "((x + (-1)) / (x + 1)) + ((x + 1) / (x + (-1)))";
27.129 +val t = TermC.str2term "((x + (-1)) / (x + 1)) + ((x + 1) / (x + (-1)))";
27.130 val SOME (t', asm) = common_nominator_p_ thy t;
27.131 if UnparseC.term t' =
27.132 "(x + -1) * (-1 + x) / ((1 + x) * (-1 + x)) +\n(x + 1) * (1 + x) / ((1 + x) * (-1 + x))"
27.133 @@ -179,7 +179,7 @@
27.134 "-------- integration lev.1 fun add_fraction_p_ ------------------------------";
27.135 "-------- integration lev.1 fun add_fraction_p_ ------------------------------";
27.136 "-------- integration lev.1 fun add_fraction_p_ ------------------------------";
27.137 -val t = str2term "((x + (-1)) / (x + 1)) + ((x + 1) / (x + (-1)))";
27.138 +val t = TermC.str2term "((x + (-1)) / (x + 1)) + ((x + 1) / (x + (-1)))";
27.139 val SOME (t', asm) = add_fraction_p_ thy t;
27.140 if UnparseC.term t' = "(2 + 2 * x ^^^ 2) / (-1 + x ^^^ 2)"
27.141 then () else error "add_fraction_p_ 3 changed";
27.142 @@ -187,10 +187,10 @@
27.143 if UnparseC.terms asm = "[\"-1 + x ^^^ 2 \<noteq> 0\"]"
27.144 then () else error "add_fraction_p_ 3 changed";
27.145 ;
27.146 -val t = str2term "nothing / to_add";
27.147 +val t = TermC.str2term "nothing / to_add";
27.148 if NONE = add_fraction_p_ thy t then () else error "add_fraction_p_ term 3 changed";
27.149 ;
27.150 -val t = str2term "((x + (-1)) / (x + 1)) + ((x + 1) / (x + (-1)))";
27.151 +val t = TermC.str2term "((x + (-1)) / (x + 1)) + ((x + 1) / (x + (-1)))";
27.152 val SOME (t', asm) = add_fraction_p_ thy t;
27.153 if UnparseC.term t' = "(2 + 2 * x ^^^ 2) / (-1 + x ^^^ 2)" andalso
27.154 UnparseC.terms asm = "[\"-1 + x ^^^ 2 \<noteq> 0\"]"
27.155 @@ -203,7 +203,7 @@
27.156 (which does not to work, because substitution is not done -- compare rew_sub!);
27.157 keep this sequence for the case, factout_p, cancel_p, common_nominator_p, add_fraction_p
27.158 (again) get prepat = [] changed to <>[]. *)
27.159 -val t = str2term "(x^^^2 + -1*y^^^2) / (x^^^2 + -1*x*y)";
27.160 +val t = TermC.str2term "(x^^^2 + -1*y^^^2) / (x^^^2 + -1*x*y)";
27.161
27.162 (*rewrite_set_ @{theory Isac_Knowledge} true cancel t = NONE; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*)
27.163 "~~~~~ fun rewrite_set_, args:"; val (thy, bool, rls, term) = (thy, false, cancel_p, t);
27.164 @@ -280,13 +280,13 @@
27.165 "-------- fun rewrite_set_ cancel_p downto fun gcd_poly ----------------------";
27.166 "-------- fun rewrite_set_ cancel_p downto fun gcd_poly ----------------------";
27.167 "-------- fun rewrite_set_ cancel_p downto fun gcd_poly ----------------------";
27.168 -val t = str2term "(12 * x * y) / (8 * y^^^2 )";
27.169 +val t = TermC.str2term "(12 * x * y) / (8 * y^^^2 )";
27.170 (* "-------- example 187a": exception Div raised...
27.171 val SOME (t', asm) = rewrite_set_ thy false cancel_p t;*)
27.172 -val t = str2term "(8 * x^^^2 * y * z ) / (18 * x * y^^^2 * z )";
27.173 +val t = TermC.str2term "(8 * x^^^2 * y * z ) / (18 * x * y^^^2 * z )";
27.174 (* "-------- example 187b": doesn't terminate...
27.175 val SOME (t', asm) = rewrite_set_ thy false cancel_p t;*)
27.176 -val t = str2term "(9 * x^^^5 * y^^^2 * z^^^4) / (15 * x^^^6 * y^^^3 * z )";
27.177 +val t = TermC.str2term "(9 * x^^^5 * y^^^2 * z^^^4) / (15 * x^^^6 * y^^^3 * z )";
27.178 (* "-------- example 187c": doesn't terminate...
27.179 val SOME (t', asm) = rewrite_set_ thy false cancel_p t;*)
27.180 "~~~~~ fun rewrite_set_, args:"; val (thy, bool, rls, term) = (@{theory Isac_Knowledge}, false, cancel_p, t);
27.181 @@ -312,7 +312,7 @@
27.182 "~~~~~ fun cancel_p_, args:"; val (t) = (t);
27.183 val opt = check_fraction t;
27.184 val SOME (numerator, denominator) = opt
27.185 - val vs = vars_of t
27.186 + val vs = TermC.vars_of t
27.187 val baseT = type_of numerator
27.188 val expT = HOLogic.realT
27.189 val (SOME a, SOME b) = (poly_of_term vs numerator, poly_of_term vs denominator);
27.190 @@ -335,7 +335,7 @@
27.191 "-------- rls norm_Rational downto fun gcd_poly ------------------------------";
27.192 "-------- rls norm_Rational downto fun gcd_poly ------------------------------";
27.193 "-------- rls norm_Rational downto fun gcd_poly ------------------------------";
27.194 -val t = str2term "(x^^^2 - 4)*(3 - y) / ((y^^^2 - 9)*(2+x))";
27.195 +val t = TermC.str2term "(x^^^2 - 4)*(3 - y) / ((y^^^2 - 9)*(2+x))";
27.196 Rewrite.trace_on := false (*true false*);
27.197 (* trace stops with ...: (and then jEdit hangs)..
27.198 rewrite_set_ thy false norm_Rational t;
27.199 @@ -343,7 +343,7 @@
27.200 ### rls: cancel_p on: (-12 + 4 * y + 3 * x ^^^ 2 + -1 * (x ^^^ 2 * y)) /
27.201 (-18 + -9 * x + 2 * y ^^^ 2 + x * y ^^^ 2)
27.202 *)
27.203 -val t = str2term (*copy from above: "::real" is not required due to "^^^"*)
27.204 +val t = TermC.str2term (*copy from above: "::real" is not required due to "^^^"*)
27.205 ("(-12 + 4 * y + 3 * x ^^^ 2 + -1 * (x ^^^ 2 * y)) /" ^
27.206 "(-18 + -9 * x + 2 * y ^^^ 2 + x * y ^^^ 2)");
27.207 (*cancel_p_ thy t;
27.208 @@ -352,7 +352,7 @@
27.209 "~~~~~ fun cancel_p_, args:"; val (t) = (t);
27.210 val opt = check_fraction t;
27.211 val SOME (numerator, denominator) = opt
27.212 - val vs = vars_of t
27.213 + val vs = TermC.vars_of t
27.214 val baseT = type_of numerator
27.215 val expT = HOLogic.realT;
27.216 (*default_print_depth 3; 999*)
27.217 @@ -369,7 +369,7 @@
27.218 "-------- rls norm_Rational downto fun add_fraction_p_ -----------------------";
27.219 val thy = @{theory Isac_Knowledge};
27.220 "----- SK060904-2a non-termination of add_fraction_p_";
27.221 -val t = str2term (" (a + b * x) / (a + -1 * (b * x)) + " ^
27.222 +val t = TermC.str2term (" (a + b * x) / (a + -1 * (b * x)) + " ^
27.223 " (-1 * a + b * x) / (a + b * x) ");
27.224 (* rewrite_set_ thy false norm_Rational t
27.225 exception Div raised*)
27.226 @@ -416,7 +416,7 @@
27.227 "~~~~~ fun add_fraction_p_, args:"; val ((_: theory), t) = (thy, t);
27.228 val SOME ((n1, d1), (n2, d2)) = check_frac_sum t;
27.229 UnparseC.term n1; UnparseC.term d1; UnparseC.term n2; UnparseC.term d2;
27.230 - val vs = vars_of t;
27.231 + val vs = TermC.vars_of t;
27.232 (*default_print_depth 3; 999*)
27.233 val (SOME _, SOME a, SOME _, SOME b) =
27.234 (poly_of_term vs n1, poly_of_term vs d1, poly_of_term vs n2, poly_of_term vs d2);
27.235 @@ -461,7 +461,7 @@
27.236 (*+*) (UnparseC.term n2, UnparseC.term d2) = ("B / 2 + -1 * B / 2", "1")
27.237 (*+*)then () else error "check_frac_sum (A / 4 + (B / 2 + -1 * B / (2::real))) changed";
27.238
27.239 - val vs = vars_of t;
27.240 + val vs = TermC.vars_of t;
27.241 val (SOME [(1, [1, 0])], SOME [(4, [0, 0])], NONE, SOME [(1, [0, 0])]) =
27.242 (*case*) (poly_of_term vs n1, poly_of_term vs d1, poly_of_term vs n2, poly_of_term vs d2) (*of*);
27.243
27.244 @@ -503,7 +503,7 @@
27.245 (*+*) (UnparseC.term n2, UnparseC.term d2) = ("BB / 2 + -1 * BB / 2", "1")
27.246 (*+*)then () else error "check_frac_sum (AA / 4 + (BB / 2 + -1 * BB / 2)) changed";
27.247
27.248 - val vs = vars_of t;
27.249 + val vs = TermC.vars_of t;
27.250 val (SOME [(1, [1, 0])], SOME [(4, [0, 0])], NONE, SOME [(1, [0, 0])]) =
27.251 (*case*) (poly_of_term vs n1, poly_of_term vs d1, poly_of_term vs n2, poly_of_term vs d2) (*of*);
27.252
27.253 @@ -547,26 +547,26 @@
27.254 "-------- rewrite_set_ cancel_p from: Mathematik 1 Schalk Reniets Verlag -----";
27.255 val thy = @{theory "Rational"};
27.256 "-------- WN";
27.257 -val t = str2term "(2 + -3 * x) / 9";
27.258 +val t = TermC.str2term "(2 + -3 * x) / 9";
27.259 if NONE = rewrite_set_ thy false cancel_p t then ()
27.260 else error "rewrite_set_ cancel_p must return NONE, if the term cannot be cancelled";
27.261
27.262 "-------- example 186a";
27.263 -val t = str2term "(14 * x * y) / (x * y)";
27.264 - is_expanded (str2term "14 * x * y");
27.265 - is_expanded (str2term "x * y");
27.266 +val t = TermC.str2term "(14 * x * y) / (x * y)";
27.267 + is_expanded (TermC.str2term "14 * x * y");
27.268 + is_expanded (TermC.str2term "x * y");
27.269 val SOME (t', asm) = rewrite_set_ thy false cancel_p t;
27.270 if (UnparseC.term t', UnparseC.terms asm) = ("14 / 1", "[]")
27.271 then () else error "rational.sml cancel Schalk 186a";
27.272
27.273 "-------- example 186b";
27.274 -val t = str2term "(60 * a * b) / ( 15 * a * b )";
27.275 +val t = TermC.str2term "(60 * a * b) / ( 15 * a * b )";
27.276 val SOME (t', asm) = rewrite_set_ thy false cancel_p t;
27.277 if (UnparseC.term t', UnparseC.terms asm) = ("4 / 1", "[]")
27.278 then () else error "rational.sml cancel Schalk 186b";
27.279
27.280 "-------- example 186c";
27.281 -val t = str2term "(144 * a^^^2 * b * c) / (12 * a * b * c)";
27.282 +val t = TermC.str2term "(144 * a^^^2 * b * c) / (12 * a * b * c)";
27.283 val SOME (t', asm) = rewrite_set_ thy false cancel_p t;
27.284 if (UnparseC.term t', UnparseC.terms asm) = ("12 * a / 1", "[]")
27.285 then () else error "rational.sml cancel Schalk 186c";
27.286 @@ -574,7 +574,7 @@
27.287 (* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! exception Div raised !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
27.288 see --- fun rewrite_set_ downto fun gcd_poly ---
27.289 "-------- example 187a";
27.290 -val t = str2term "(12 * x * y) / (8 * y^^^2 )";
27.291 +val t = TermC.str2term "(12 * x * y) / (8 * y^^^2 )";
27.292 val SOME (t', asm) = rewrite_set_ thy false cancel_p t;
27.293 if (UnparseC.term t', UnparseC.terms asm) = ("3 * x / (2 * y)", "[\"4 * y ~= 0\"]")
27.294 then () else error "rational.sml cancel Schalk 187a";
27.295 @@ -583,7 +583,7 @@
27.296 (* doesn't terminate !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
27.297 see --- fun rewrite_set_ downto fun gcd_poly ---
27.298 "-------- example 187b";
27.299 -val t = str2term "(8 * x^^^2 * y * z ) / (18 * x * y^^^2 * z )";
27.300 +val t = TermC.str2term "(8 * x^^^2 * y * z ) / (18 * x * y^^^2 * z )";
27.301 val SOME (t', asm) = rewrite_set_ thy false cancel_p t;
27.302 if (UnparseC.term t', UnparseC.terms asm) = ("4 * x / (9 * y)", "[\"2 * (z * (y * x)) ~= 0\"]")
27.303 then () else error "rational.sml cancel Schalk 187b";
27.304 @@ -592,7 +592,7 @@
27.305 (* doesn't terminate !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
27.306 see --- fun rewrite_set_ downto fun gcd_poly ---
27.307 "-------- example 187c";
27.308 -val t = str2term "(9 * x^^^5 * y^^^2 * z^^^4) / (15 * x^^^6 * y^^^3 * z )";
27.309 +val t = TermC.str2term "(9 * x^^^5 * y^^^2 * z^^^4) / (15 * x^^^6 * y^^^3 * z )";
27.310 val SOME (t', asm) = rewrite_set_ thy false cancel_p t;
27.311 if (UnparseC.term t', UnparseC.terms asm) =
27.312 ("3 * z ^^^ 3 / (5 * (y * x))", "[\"3 * (z * (y ^^^ 2 * x ^^^ 5)) ~= 0\"]")
27.313 @@ -600,119 +600,119 @@
27.314 *)
27.315
27.316 "-------- example 188a";
27.317 -val t = str2term "(-8 + 8 * x) / (-9 + 9 * x)";
27.318 - is_expanded (str2term "8 * x + -8");
27.319 +val t = TermC.str2term "(-8 + 8 * x) / (-9 + 9 * x)";
27.320 + is_expanded (TermC.str2term "8 * x + -8");
27.321 val SOME (t', asm) = rewrite_set_ thy false cancel_p t;
27.322 if (UnparseC.term t', UnparseC.terms asm) = ("8 / 9", "[]")
27.323 then () else error "rational.sml cancel Schalk 188a";
27.324
27.325 -val t = str2term "(8*((-1) + x))/(9*((-1) + x))";
27.326 +val t = TermC.str2term "(8*((-1) + x))/(9*((-1) + x))";
27.327 val SOME (t, _) = rewrite_set_ thy false make_polynomial t;
27.328 if (UnparseC.term t', UnparseC.terms asm) = ("8 / 9", "[]")
27.329 then () else error "rational.sml cancel Schalk make_polynomial 1";
27.330
27.331 "-------- example 188b";
27.332 -val t = str2term "(-15 + 5 * x) / (-18 + 6 * x)";
27.333 +val t = TermC.str2term "(-15 + 5 * x) / (-18 + 6 * x)";
27.334 val SOME (t', asm) = rewrite_set_ thy false cancel_p t;
27.335 if (UnparseC.term t', UnparseC.terms asm) = ("5 / 6", "[]")
27.336 then () else error "rational.sml cancel Schalk 188b";
27.337
27.338 "-------- example 188c";
27.339 -val t = str2term "(a + -1 * b) / (b + -1 * a)";
27.340 +val t = TermC.str2term "(a + -1 * b) / (b + -1 * a)";
27.341 val SOME (t', asm) = rewrite_set_ thy false cancel_p t;
27.342 if (UnparseC.term t', UnparseC.terms asm) = ("-1 / 1", "[]")
27.343 then () else error "rational.sml cancel Schalk 188c";
27.344
27.345 -is_expanded (str2term "a + -1 * b") = true;
27.346 -val t = str2term "((-1)*(b + (-1) * a))/(1*(b + (-1) * a))";
27.347 +is_expanded (TermC.str2term "a + -1 * b") = true;
27.348 +val t = TermC.str2term "((-1)*(b + (-1) * a))/(1*(b + (-1) * a))";
27.349 val SOME (t', asm) = rewrite_set_ thy false make_polynomial t;
27.350 if (UnparseC.term t', UnparseC.terms asm) = ("(a + -1 * b) / (-1 * a + b)", "[]")
27.351 then () else error "rational.sml cancel Schalk make_polynomial 2";
27.352
27.353 "-------- example 190a";
27.354 -val t = str2term "( 27 * a^^^3 + 9 * a^^^2 + 3 * a + 1 ) / ( 27 * a^^^3 + 18 * a^^^2 + 3 * a )";
27.355 +val t = TermC.str2term "( 27 * a^^^3 + 9 * a^^^2 + 3 * a + 1 ) / ( 27 * a^^^3 + 18 * a^^^2 + 3 * a )";
27.356 val SOME (t', asm) = rewrite_set_ thy false cancel_p t;
27.357 if (UnparseC.term t', UnparseC.terms asm) =
27.358 ("(1 + 9 * a ^^^ 2) / (3 * a + 9 * a ^^^ 2)", "[\"3 * a + 9 * a ^^^ 2 \<noteq> 0\"]")
27.359 then () else error "rational.sml cancel Schalk 190a";
27.360
27.361 "-------- example 190c";
27.362 -val t = str2term "((1 + 9 * a ^^^ 2)*(1 + 3 * a))/((3 * a + 9 * a ^^^ 2)*(1 + 3 * a))";
27.363 +val t = TermC.str2term "((1 + 9 * a ^^^ 2)*(1 + 3 * a))/((3 * a + 9 * a ^^^ 2)*(1 + 3 * a))";
27.364 val SOME (t', asm) = rewrite_set_ thy false make_polynomial t;
27.365 if (UnparseC.term t', UnparseC.terms asm) =
27.366 ("(1 + 3 * a + 9 * a ^^^ 2 + 27 * a ^^^ 3) /\n(3 * a + 18 * a ^^^ 2 + 27 * a ^^^ 3)", "[]")
27.367 then () else error "rational.sml make_polynomial Schalk 190c";
27.368
27.369 "-------- example 191a";
27.370 -val t = str2term "( x^^^2 + -1 * y^^^2 ) / ( x + y )";
27.371 - is_expanded (str2term "x^^^2 + -1 * y^^^2") = false; (*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*)
27.372 - is_expanded (str2term "x + y") = true;
27.373 +val t = TermC.str2term "( x^^^2 + -1 * y^^^2 ) / ( x + y )";
27.374 + is_expanded (TermC.str2term "x^^^2 + -1 * y^^^2") = false; (*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*)
27.375 + is_expanded (TermC.str2term "x + y") = true;
27.376 val SOME (t', asm) = rewrite_set_ thy false cancel_p t;
27.377 if (UnparseC.term t', UnparseC.terms asm) = ("(x + -1 * y) / 1", "[]")
27.378 then () else error "rational.sml make_polynomial Schalk 191a";
27.379
27.380 "-------- example 191b";
27.381 -val t = str2term "((x + (-1) * y)*(x + y))/((1)*(x + y))";
27.382 +val t = TermC.str2term "((x + (-1) * y)*(x + y))/((1)*(x + y))";
27.383 val SOME (t', asm) = rewrite_set_ thy false make_polynomial t;
27.384 if (UnparseC.term t', UnparseC.terms asm) = ("(x ^^^ 2 + -1 * y ^^^ 2) / (x + y)", "[]")
27.385 then () else error "rational.sml make_polynomial Schalk 191b";
27.386
27.387 "-------- example 191c";
27.388 -val t = str2term "( 9 * x^^^2 + -30 * x + 25 ) / ( 9 * x^^^2 + -25 )";
27.389 - is_expanded (str2term "9 * x^^^2 + -30 * x + 25") = true;
27.390 - is_expanded (str2term "25 + -30*x + 9*x^^^2") = true;
27.391 - is_expanded (str2term "-25 + 9*x^^^2") = true;
27.392 +val t = TermC.str2term "( 9 * x^^^2 + -30 * x + 25 ) / ( 9 * x^^^2 + -25 )";
27.393 + is_expanded (TermC.str2term "9 * x^^^2 + -30 * x + 25") = true;
27.394 + is_expanded (TermC.str2term "25 + -30*x + 9*x^^^2") = true;
27.395 + is_expanded (TermC.str2term "-25 + 9*x^^^2") = true;
27.396
27.397 -val t = str2term "(((-5) + 3 * x)*((-5) + 3 * x))/((5 + 3 * x)*((-5) + 3 * x))";
27.398 +val t = TermC.str2term "(((-5) + 3 * x)*((-5) + 3 * x))/((5 + 3 * x)*((-5) + 3 * x))";
27.399 val SOME (t', asm) = rewrite_set_ thy false make_polynomial t;
27.400 if (UnparseC.term t', UnparseC.terms asm) = ("(25 + -30 * x + 9 * x ^^^ 2) / (-25 + 9 * x ^^^ 2)", "[]")
27.401 then () else error "rational.sml make_polynomial Schalk 191c";
27.402
27.403 "-------- example 192b";
27.404 -val t = str2term "( 7 * x^^^3 + -1 * x^^^2 * y ) / ( 7 * x * y^^^2 + -1 * y^^^3 )";
27.405 +val t = TermC.str2term "( 7 * x^^^3 + -1 * x^^^2 * y ) / ( 7 * x * y^^^2 + -1 * y^^^3 )";
27.406 val SOME (t', asm) = rewrite_set_ thy false cancel_p t;
27.407 if (UnparseC.term t', UnparseC.terms asm) = ("x ^^^ 2 / y ^^^ 2", "[\"y ^^^ 2 \<noteq> 0\"]")
27.408 then () else error "rational.sml cancel_p Schalk 192b";
27.409
27.410 -val t = str2term "((x ^^^ 2)*(7 * x + (-1) * y))/((y ^^^ 2)*(7 * x + (-1) * y))";
27.411 +val t = TermC.str2term "((x ^^^ 2)*(7 * x + (-1) * y))/((y ^^^ 2)*(7 * x + (-1) * y))";
27.412 val SOME (t', asm) = rewrite_set_ thy false make_polynomial t;
27.413 if (UnparseC.term t', UnparseC.terms asm) =
27.414 ("(7 * x ^^^ 3 + -1 * x ^^^ 2 * y) / (7 * x * y ^^^ 2 + -1 * y ^^^ 3)", "[]")
27.415 then () else error "rational.sml make_polynomial Schalk 192b";
27.416
27.417 -val t = str2term "((x ^^^ 2)*(7 * x + (-1) * y))/((y ^^^ 2)*(7 * x + (-1) * y))";
27.418 +val t = TermC.str2term "((x ^^^ 2)*(7 * x + (-1) * y))/((y ^^^ 2)*(7 * x + (-1) * y))";
27.419 val SOME (t', asm) = rewrite_set_ thy false make_polynomial t;
27.420 if (UnparseC.term t', UnparseC.terms asm) =
27.421 ("(7 * x ^^^ 3 + -1 * x ^^^ 2 * y) / (7 * x * y ^^^ 2 + -1 * y ^^^ 3)", "[]")
27.422 then () else error "rational.sml make_polynomial Schalk WN050929 not working";
27.423
27.424 "-------- example 193a";
27.425 -val t = str2term "( x^^^2 + -6 * x + 9 ) / ( x^^^2 + -9 )";
27.426 +val t = TermC.str2term "( x^^^2 + -6 * x + 9 ) / ( x^^^2 + -9 )";
27.427 val SOME (t', asm) = rewrite_set_ thy false cancel_p t;
27.428 if (UnparseC.term t', UnparseC.terms asm) = ("(-3 + x) / (3 + x)", "[\"3 + x \<noteq> 0\"]")
27.429 then () else error "rational.sml cancel_p Schalk 193a";
27.430
27.431 "-------- example 193b";
27.432 -val t = str2term "( x^^^2 + -8 * x + 16 ) / ( 2 * x^^^2 + -32 )";
27.433 +val t = TermC.str2term "( x^^^2 + -8 * x + 16 ) / ( 2 * x^^^2 + -32 )";
27.434 val SOME (t', asm) = rewrite_set_ thy false cancel_p t;
27.435 if (UnparseC.term t', UnparseC.terms asm) = ("(-4 + x) / (8 + 2 * x)", "[\"8 + 2 * x \<noteq> 0\"]")
27.436 then () else error "rational.sml cancel_p Schalk 193b";
27.437
27.438 "-------- example 193c";
27.439 -val t = str2term "( 2 * x + -50 * x^^^3 ) / ( 25 * x^^^2 + -10 * x + 1 )";
27.440 +val t = TermC.str2term "( 2 * x + -50 * x^^^3 ) / ( 25 * x^^^2 + -10 * x + 1 )";
27.441 val SOME (t', asm) = rewrite_set_ thy false cancel_p t;
27.442 if (UnparseC.term t', UnparseC.terms asm) =
27.443 ("(2 * x + 10 * x ^^^ 2) / (1 + -5 * x)", "[\"1 + -5 * x \<noteq> 0\"]")
27.444 then () else error "rational.sml cancel_p Schalk 193c";
27.445
27.446 (*WN:*)
27.447 -val t = str2term "(-25 + 9*x^^^2)/(5 + 3*x)";
27.448 +val t = TermC.str2term "(-25 + 9*x^^^2)/(5 + 3*x)";
27.449 val SOME (t, asm) = rewrite_set_ thy false cancel_p t;
27.450 if (UnparseC.term t', UnparseC.terms asm) = ("(2 * x + 10 * x ^^^ 2) / (1 + -5 * x)", "[]")
27.451 then () else error "rational.sml cancel WN 1";
27.452
27.453 "-------- example heuberger";
27.454 -val t = str2term ("(x^^^4 + x * y + x^^^3 * y + y^^^2) / " ^
27.455 +val t = TermC.str2term ("(x^^^4 + x * y + x^^^3 * y + y^^^2) / " ^
27.456 "(x + 5 * x^^^2 + y + 5 * x * y + x^^^2 * y^^^3 + x * y^^^4)");
27.457 val SOME (t', asm) = rewrite_set_ thy false cancel_p t;
27.458 if (UnparseC.term t', UnparseC.terms asm) =
27.459 @@ -727,7 +727,7 @@
27.460 "-------- integration lev.1 -- lev.5: cancel_p_ & add_fractions_p_ -----------";
27.461 "-------- integration lev.1 -- lev.5: cancel_p_ & add_fractions_p_ -----------";
27.462 "-------- integration lev.1 -- lev.5: cancel_p_ & add_fractions_p_ -----------";
27.463 -val t = str2term ("123 = (a*x)/(b*x) + (c*x)/(d*x) + (e*x)/(f*x::real)");
27.464 +val t = TermC.str2term ("123 = (a*x)/(b*x) + (c*x)/(d*x) + (e*x)/(f*x::real)");
27.465 "-------- gcd_poly integration level 1: works on exact term";
27.466 if NONE = cancel_p_ thy t then () else error "cancel_p_ works on exact fraction";
27.467 if NONE = add_fraction_p_ thy t then () else error "add_fraction_p_ works on exact fraction";
27.468 @@ -792,7 +792,7 @@
27.469 "-------- reverse rewrite ----------------------------------------------------";
27.470 "-------- reverse rewrite ----------------------------------------------------";
27.471 (** the term for which reverse rewriting is demonstrated **)
27.472 -val t = str2term "(9 + -1 * x ^^^ 2) / (9 + 6 * x + x ^^^ 2)";
27.473 +val t = TermC.str2term "(9 + -1 * x ^^^ 2) / (9 + 6 * x + x ^^^ 2)";
27.474 val Rrls {scr = Rfuns {init_state = ini, locate_rule = loc,
27.475 next_rule = nex, normal_form = nor, ...},...} = cancel_p;
27.476
27.477 @@ -841,7 +841,7 @@
27.478 if str = "sym_#power_Float ((3,0), (0,0)) __ ((2,0), (0,0))"
27.479 andalso ThmC.string_of_thm thm =
27.480 (string_of_thm (Thm.make_thm @{theory "Isac_Knowledge"}
27.481 - (Trueprop $ (Thm.term_of o the o (parse thy)) "9 = 3 ^^^ 2"))) then ()
27.482 + (Trueprop $ (Thm.term_of o the o (TermC.parse thy)) "9 = 3 ^^^ 2"))) then ()
27.483 else error "rational.sml next_rule (9 - x ^^^ 2) / (9 - 6 * x + x ^^^ 2)";
27.484 \---------------------------------------------------------------------------------------/*)
27.485
27.486 @@ -860,7 +860,7 @@
27.487 val SOME (r as (Thm (str, thm))) = nex revsets t;
27.488 if str = "sym_#power_Float ((3,0), (0,0)) __ ((2,0), (0,0))" andalso
27.489 ThmC.string_of_thm thm = (string_of_thm (ThmC_Def.make_thm @{theory "Isac_Knowledge"}
27.490 - (Trueprop $ (Thm.term_of o the o (parse thy)) "9 = 3 ^^^ 2"))) then ()
27.491 + (Trueprop $ (Thm.term_of o the o (TermC.parse thy)) "9 = 3 ^^^ 2"))) then ()
27.492 else error "rational.sml next_rule (9 - x ^^^ 2) / (9 - 6 * x + x ^^^ 2)";
27.493
27.494 (*check the next rule*)
27.495 @@ -898,7 +898,7 @@
27.496 special cases.*)
27.497
27.498 (*the term for which reverse rewriting is demonstrated*)
27.499 -val t = str2term "(9 + (-1)*x^^^2) / (9 + ((-6)*x + x^^^2))";
27.500 +val t = TermC.str2term "(9 + (-1)*x^^^2) / (9 + ((-6)*x + x^^^2))";
27.501 val Rrls {scr=Rfuns {init_state=ini,locate_rule=loc,
27.502 next_rule=nex,normal_form=nor,...},...} = cancel_p;
27.503
27.504 @@ -935,62 +935,62 @@
27.505 "-------- examples: rls norm_Rational ----------------------------------------";
27.506 "-------- examples: rls norm_Rational ----------------------------------------";
27.507 "-------- examples: rls norm_Rational ----------------------------------------";
27.508 -val t = str2term "(3*x+5)/18 - x/2 - -(3*x - 2)/9 = 0";
27.509 +val t = TermC.str2term "(3*x+5)/18 - x/2 - -(3*x - 2)/9 = 0";
27.510 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; UnparseC.term t';
27.511 if UnparseC.term t' = "1 / 18 = 0" then () else error "rational.sml 1";
27.512
27.513 -val t = str2term "(17*x - 51)/9 - (-(13*x - 3)/6) + 11 - (9*x - 7)/4 = 0";
27.514 +val t = TermC.str2term "(17*x - 51)/9 - (-(13*x - 3)/6) + 11 - (9*x - 7)/4 = 0";
27.515 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; UnparseC.term t';
27.516 if UnparseC.term t' = "(237 + 65 * x) / 36 = 0" then ()
27.517 else error "rational.sml 2";
27.518
27.519 -val t = str2term "(1/2 + (5*x)/2)^^^2 - ((13*x)/2 - 5/2)^^^2 - (6*x)^^^2 + 29";
27.520 +val t = TermC.str2term "(1/2 + (5*x)/2)^^^2 - ((13*x)/2 - 5/2)^^^2 - (6*x)^^^2 + 29";
27.521 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; UnparseC.term t';
27.522 if UnparseC.term t' = "23 + 35 * x + -72 * x ^^^ 2" then ()
27.523 else error "rational.sml 3";
27.524
27.525 (*Rewrite.trace_on:=true;*)
27.526 -val t = str2term "Not (6*x is_atom)";
27.527 +val t = TermC.str2term "Not (6*x is_atom)";
27.528 val SOME (t',_) = rewrite_set_ thy false powers_erls t; UnparseC.term t';
27.529 "HOL.True";
27.530 -val t = str2term "1 < 2";
27.531 +val t = TermC.str2term "1 < 2";
27.532 val SOME (t',_) = rewrite_set_ thy false powers_erls t; UnparseC.term t';
27.533 "HOL.True";
27.534
27.535 -val t = str2term "(6*x)^^^2";
27.536 +val t = TermC.str2term "(6*x)^^^2";
27.537 val SOME (t',_) = rewrite_ thy dummy_ord powers_erls false
27.538 (ThmC.numerals_to_Free @{thm realpow_def_atom}) t;
27.539 if UnparseC.term t' = "6 * x * (6 * x) ^^^ (2 + -1)" then ()
27.540 else error "rational.sml powers_erls (6*x)^^^2";
27.541
27.542 -val t = str2term "-1 * (-2 * (5 / 2 * (13 * x / 2)))";
27.543 +val t = TermC.str2term "-1 * (-2 * (5 / 2 * (13 * x / 2)))";
27.544 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; UnparseC.term t';
27.545 if UnparseC.term t' = "65 * x / 2" then () else error "rational.sml 4";
27.546
27.547 -val t = str2term "1 - ((13*x)/2 - 5/2)^^^2";
27.548 +val t = TermC.str2term "1 - ((13*x)/2 - 5/2)^^^2";
27.549 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; UnparseC.term t';
27.550 if UnparseC.term t' = "(-21 + 130 * x + -169 * x ^^^ 2) / 4" then ()
27.551 else error "rational.sml 5";
27.552
27.553 (*SRAM Schalk I, p.92 Nr. 609a*)
27.554 -val t = str2term "2*(3 - x/5)/3 - 4*(1 - x/3) - x/3 - 2*(x/2 - 1/4)/27 +5/54";
27.555 +val t = TermC.str2term "2*(3 - x/5)/3 - 4*(1 - x/3) - x/3 - 2*(x/2 - 1/4)/27 +5/54";
27.556 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; UnparseC.term t';
27.557 if UnparseC.term t' = "(-255 + 112 * x) / 135" then ()
27.558 else error "rational.sml 6";
27.559
27.560 (*SRAM Schalk I, p.92 Nr. 610c*)
27.561 -val t = str2term "((x- 1)/(x+1) + 1) / ((x- 1)/(x+1) - (x+1)/(x- 1)) - 2";
27.562 +val t = TermC.str2term "((x- 1)/(x+1) + 1) / ((x- 1)/(x+1) - (x+1)/(x- 1)) - 2";
27.563 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; UnparseC.term t';
27.564 if UnparseC.term t' = "(3 + x) / -2" then () else error "rational.sml 7";
27.565
27.566 (*SRAM Schalk I, p.92 Nr. 476a*)
27.567 -val t = str2term "(x^^^2/(1 - x^^^2) + 1)/(x/(1 - x) + 1) * (1 + x)";
27.568 +val t = TermC.str2term "(x^^^2/(1 - x^^^2) + 1)/(x/(1 - x) + 1) * (1 + x)";
27.569 (*. a/b : c/d translated to a/b * d/c .*)
27.570 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; UnparseC.term t';
27.571 if UnparseC.term t' = "1" then () else error "rational.sml 8";
27.572
27.573 (*Schalk I, p.92 Nr. 472a*)
27.574 -val t = str2term "((8*x^^^2 - 32*y^^^2)/(2*x + 4*y))/((4*x - 8*y)/(x + y))";
27.575 +val t = TermC.str2term "((8*x^^^2 - 32*y^^^2)/(2*x + 4*y))/((4*x - 8*y)/(x + y))";
27.576 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; UnparseC.term t';
27.577 if UnparseC.term t' = "x + y" then () else error "rational.sml p.92 Nr. 472a";
27.578
27.579 @@ -998,11 +998,11 @@
27.580
27.581 (*WN130910 add_fractions_p exception Div raised + history:
27.582 ### WN.2.6.03 from rlang.sml 56a
27.583 -val t = str2term "(a + b * x) / (a + -1 * (b * x)) + (-1 * a + b * x) / (a + b * x) = 4 * (a * b) / (a ^^^ 2 + -1 * b ^^^ 2)";
27.584 +val t = TermC.str2term "(a + b * x) / (a + -1 * (b * x)) + (-1 * a + b * x) / (a + b * x) = 4 * (a * b) / (a ^^^ 2 + -1 * b ^^^ 2)";
27.585 val NONE = rewrite_set_ thy false add_fractions_p t;
27.586
27.587 THE ERROR ALREADY OCCURS IN THIS PART:
27.588 -val t = str2term "(a + b * x) / (a + -1 * (b * x)) + (-1 * a + b * x) / (a + b * x)";
27.589 +val t = TermC.str2term "(a + b * x) / (a + -1 * (b * x)) + (-1 * a + b * x) / (a + b * x)";
27.590 val NONE = add_fraction_p_ thy t;
27.591
27.592 SEE Test_Some.thy: section {* add_fractions_p downto exception Div raised ===
27.593 @@ -1012,14 +1012,14 @@
27.594 "-------- rational numerals --------------------------------------------------";
27.595 "-------- rational numerals --------------------------------------------------";
27.596 (*SRA Schalk I, p.40 Nr. 164b *)
27.597 -val t = str2term "(47/6 - 76/9 + 13/4)/(35/12)";
27.598 +val t = TermC.str2term "(47/6 - 76/9 + 13/4)/(35/12)";
27.599 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.600 UnparseC.term t;
27.601 if UnparseC.term t = "19 / 21" then ()
27.602 else error "rational.sml: diff.behav. in norm_Rational_mg 1";
27.603
27.604 (*SRA Schalk I, p.40 Nr. 166a *)
27.605 -val t = str2term "((5/4)/(4+22/7) + 37/20)*(110/3 - 110/9 * 23/11)";
27.606 +val t = TermC.str2term "((5/4)/(4+22/7) + 37/20)*(110/3 - 110/9 * 23/11)";
27.607 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.608 UnparseC.term t;
27.609 if UnparseC.term t = "45 / 2" then ()
27.610 @@ -1029,75 +1029,75 @@
27.611 "-------- examples cancellation from: Mathematik 1 Schalk --------------------";
27.612 "-------- examples cancellation from: Mathematik 1 Schalk --------------------";
27.613 (* e190c Stefan K.*)
27.614 -val t = str2term "((1 + 9*a^^^2) * (1 + 3*a)) / ((3*a + 9*a^^^2) * (1 + 3*a))";
27.615 +val t = TermC.str2term "((1 + 9*a^^^2) * (1 + 3*a)) / ((3*a + 9*a^^^2) * (1 + 3*a))";
27.616 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.617 if UnparseC.term t = "(1 + 9 * a ^^^ 2) / (3 * a + 9 * a ^^^ 2)"
27.618 then () else error "rational.sml: diff.behav. in norm_Rational_mg 3";
27.619
27.620 (* e192b Stefan K.*)
27.621 -val t = str2term "(x^^^2 * (7*x + (-1)*y)) / (y^^^2 * (7*x + (-1)*y))";
27.622 +val t = TermC.str2term "(x^^^2 * (7*x + (-1)*y)) / (y^^^2 * (7*x + (-1)*y))";
27.623 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.624 if UnparseC.term t = "x ^^^ 2 / y ^^^ 2"
27.625 then () else error "rational.sml: diff.behav. in norm_Rational_mg 4";
27.626
27.627 (*SRC Schalk I, p.66 Nr. 379c *)
27.628 -val t = str2term "(a - b)/(b - a)";
27.629 +val t = TermC.str2term "(a - b)/(b - a)";
27.630 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.631 UnparseC.term t;
27.632 if UnparseC.term t = "-1"
27.633 then () else error "rational.sml: diff.behav. in norm_Rational_mg 5";
27.634
27.635 (*SRC Schalk I, p.66 Nr. 380b *)
27.636 -val t = str2term "15*(3*x + 3) * (4*x + 9) / (12*(2*x + 7) * (5*x + 5))";
27.637 +val t = TermC.str2term "15*(3*x + 3) * (4*x + 9) / (12*(2*x + 7) * (5*x + 5))";
27.638 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.639 if UnparseC.term t = "(27 + 12 * x) / (28 + 8 * x)"
27.640 then () else error "rational.sml: diff.behav. in norm_Rational_mg 6";
27.641
27.642 (*Schalk I, p.60 Nr. 215c: was not cancelled with Isabelle2002 *)
27.643 -val t = str2term "(a + b)^^^4 * (x - y) / ((x - y)^^^3 * (a + b)^^^2)";
27.644 +val t = TermC.str2term "(a + b)^^^4 * (x - y) / ((x - y)^^^3 * (a + b)^^^2)";
27.645 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.646 if UnparseC.term t = "(a ^^^ 2 + 2 * a * b + b ^^^ 2) / (x ^^^ 2 + -2 * x * y + y ^^^ 2)"
27.647 then () else error "rational.sml: diff.behav. in norm_Rational_mg 7";
27.648
27.649 (*SRC Schalk I, p.66 Nr. 381b *)
27.650 -val t = str2term
27.651 +val t = TermC.str2term
27.652 "(4*x^^^2 - 20*x + 25)/(2*x - 5)^^^3";
27.653 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.654 if UnparseC.term t = "1 / (-5 + 2 * x)"
27.655 then () else error "rational.sml: diff.behav. in norm_Rational_mg 9";
27.656
27.657 (* e190c Stefan K.*)
27.658 -val t = str2term "((1 + 9*a^^^2) * (1 + 3*a)) / ((3*a + 9*a^^^2) * (1 + 3 * a))";
27.659 +val t = TermC.str2term "((1 + 9*a^^^2) * (1 + 3*a)) / ((3*a + 9*a^^^2) * (1 + 3 * a))";
27.660 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.661 if UnparseC.term t = "(1 + 9 * a ^^^ 2) / (3 * a + 9 * a ^^^ 2)"
27.662 then () else error "rational.sml: diff.behav. in norm_Rational_mg 3";
27.663
27.664 (* e192b Stefan K.*)
27.665 -val t = str2term "(x^^^2 * (7*x + (-1)*y)) / (y^^^2 * (7*x + (-1)*y))";
27.666 +val t = TermC.str2term "(x^^^2 * (7*x + (-1)*y)) / (y^^^2 * (7*x + (-1)*y))";
27.667 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.668 if UnparseC.term t = "x ^^^ 2 / y ^^^ 2"
27.669 then () else error "rational.sml: diff.behav. in norm_Rational_mg 4";
27.670
27.671 (*SRC Schalk I, p.66 Nr. 379c *)
27.672 -val t = str2term "(a - b) / (b - a)";
27.673 +val t = TermC.str2term "(a - b) / (b - a)";
27.674 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.675 if UnparseC.term t = "-1"
27.676 then () else error "rational.sml: diff.behav. in norm_Rational_mg 5";
27.677
27.678 (*SRC Schalk I, p.66 Nr. 380b *)
27.679 -val t = str2term "15*(3*x + 3) * (4*x + 9) / (12*(2*x + 7) * (5*x + 5))";
27.680 +val t = TermC.str2term "15*(3*x + 3) * (4*x + 9) / (12*(2*x + 7) * (5*x + 5))";
27.681 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.682 if UnparseC.term t = "(27 + 12 * x) / (28 + 8 * x)"
27.683 then () else error "rational.sml: diff.behav. in norm_Rational_mg 6";
27.684
27.685 (*Schalk I, p.60 Nr. 215c *)
27.686 -val t = str2term "(a + b)^^^4 * (x - y) / ((x - y)^^^3 * (a + b)^^^2)";
27.687 +val t = TermC.str2term "(a + b)^^^4 * (x - y) / ((x - y)^^^3 * (a + b)^^^2)";
27.688 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.689 if UnparseC.term t = "(a ^^^ 2 + 2 * a * b + b ^^^ 2) / (x ^^^ 2 + -2 * x * y + y ^^^ 2)"
27.690 then () else error "Schalk I, p.60 Nr. 215c: with Isabelle2002 cancellation incomplete, changed";
27.691
27.692 (* extreme example from somewhere *)
27.693 -val t = str2term
27.694 +val t = TermC.str2term
27.695 ("(a^^^4 * x + -1*a^^^4 * y + 4*a^^^3 * b * x + -4*a^^^3 * b * y + " ^
27.696 "6*a^^^2 * b^^^2 * x + -6*a^^^2 * b^^^2 * y + 4*a * b^^^3 * x + -4*a * b^^^3 * y + " ^
27.697 "b^^^4 * x + -1*b^^^4 * y) " ^
27.698 @@ -1110,33 +1110,33 @@
27.699
27.700 (*Schalk I, p.66 Nr. 381a *)
27.701 (* ATTENTION: here the rls is very slow. In Isabelle2002 this required 2 min *)
27.702 -val t = str2term "18*(a + b)^^^3 * (a - b)^^^2 / (72*(a - b)^^^3 * (a + b)^^^2)";
27.703 +val t = TermC.str2term "18*(a + b)^^^3 * (a - b)^^^2 / (72*(a - b)^^^3 * (a + b)^^^2)";
27.704 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.705 if UnparseC.term t = "(a + b) / (4 * a + -4 * b)"
27.706 then () else error "rational.sml: diff.behav. in norm_Rational_mg 8";
27.707
27.708 (*SRC Schalk I, p.66 Nr. 381b *)
27.709 -val t = str2term "(4*x^^^2 - 20*x + 25) / (2*x - 5)^^^3";
27.710 +val t = TermC.str2term "(4*x^^^2 - 20*x + 25) / (2*x - 5)^^^3";
27.711 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.712 if UnparseC.term t = "1 / (-5 + 2 * x)"
27.713 then () else error "rational.sml: diff.behav. in norm_Rational_mg 9";
27.714
27.715 (*SRC Schalk I, p.66 Nr. 381c *)
27.716 -val t = str2term "(27*a^^^3 + 9*a^^^2+3*a+1) / (27*a^^^3 + 18*a^^^2+3*a)";
27.717 +val t = TermC.str2term "(27*a^^^3 + 9*a^^^2+3*a+1) / (27*a^^^3 + 18*a^^^2+3*a)";
27.718 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.719 if UnparseC.term t = "(1 + 9 * a ^^^ 2) / (3 * a + 9 * a ^^^ 2)"
27.720 then () else error "rational.sml: diff.behav. in norm_Rational_mg 10";
27.721
27.722 (*SRC Schalk I, p.66 Nr. 383a *)
27.723 -val t = str2term "(5*a^^^2 - 5*a*b) / (a - b)^^^2";
27.724 +val t = TermC.str2term "(5*a^^^2 - 5*a*b) / (a - b)^^^2";
27.725 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.726 if UnparseC.term t = "-5 * a / (-1 * a + b)"
27.727 then () else error "rational.sml: diff.behav. in norm_Rational_mg 11";
27.728
27.729 "----- NOT TERMINATING ?: worked before 0707xx";
27.730 -val t = str2term "(a^^^2 - 1)*(b + 1) / ((b^^^2 - 1)*(a+1))";
27.731 +val t = TermC.str2term "(a^^^2 - 1)*(b + 1) / ((b^^^2 - 1)*(a+1))";
27.732 (* WN130911 "exception Div raised" by
27.733 - cancel_p_ thy (str2term ("(-1 + -1 * b + a ^^^ 2 + a ^^^ 2 * b) /" ^
27.734 + cancel_p_ thy (TermC.str2term ("(-1 + -1 * b + a ^^^ 2 + a ^^^ 2 * b) /" ^
27.735 "(-1 + -1 * a + b ^^^ 2 + a * b ^^^ 2)"))
27.736
27.737 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.738 @@ -1148,20 +1148,20 @@
27.739 "-------- examples common denominator from: Mathematik 1 Schalk --------------";
27.740 "-------- examples common denominator from: Mathematik 1 Schalk --------------";
27.741 (*SRA Schalk I, p.67 Nr. 403a *)
27.742 -val t = str2term "4/x - 3/y - 1";
27.743 +val t = TermC.str2term "4/x - 3/y - 1";
27.744 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.745 if UnparseC.term t = "(-3 * x + 4 * y + -1 * x * y) / (x * y)"
27.746 then () else error "rational.sml: diff.behav. in norm_Rational_mg 12";
27.747
27.748 -val t = str2term "(2*a+3*b)/(b*c) + (3*c+a)/(a*c) - (2*a^^^2+3*b*c)/(a*b*c)";
27.749 +val t = TermC.str2term "(2*a+3*b)/(b*c) + (3*c+a)/(a*c) - (2*a^^^2+3*b*c)/(a*b*c)";
27.750 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.751 if UnparseC.term t = "4 / c"
27.752 then () else error "rational.sml: diff.behav. in norm_Rational_mg 13";
27.753
27.754 (*SRA Schalk I, p.67 Nr. 410b *)
27.755 -val t = str2term "1/(x+1) + 1/(x+2) - 2/(x+3)";
27.756 +val t = TermC.str2term "1/(x+1) + 1/(x+2) - 2/(x+3)";
27.757 (* WN130911 non-termination due to non-termination of
27.758 - cancel_p_ thy (str2term "(5 + 3 * x) / (6 + 11 * x + 6 * x ^^^ 2 + x ^^^ 3)")
27.759 + cancel_p_ thy (TermC.str2term "(5 + 3 * x) / (6 + 11 * x + 6 * x ^^^ 2 + x ^^^ 3)")
27.760
27.761 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.762 if UnparseC.term t = "(5 + 3 * x) / (6 + 11 * x + 6 * x ^^^ 2 + x ^^^ 3)"
27.763 @@ -1169,22 +1169,22 @@
27.764 *)
27.765
27.766 (*SRA Schalk I, p.67 Nr. 413b *)
27.767 -val t = str2term "(1 + x)/(1 - x) - (1 - x)/(1 + x) + 2*x/(1 - x^^^2)";
27.768 +val t = TermC.str2term "(1 + x)/(1 - x) - (1 - x)/(1 + x) + 2*x/(1 - x^^^2)";
27.769 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.770 if UnparseC.term t = "6 * x / (1 + -1 * x ^^^ 2)"
27.771 then () else error "rational.sml: diff.behav. in norm_Rational_mg 15";
27.772
27.773 (*SRA Schalk I, p.68 Nr. 414a *)
27.774 -val t = str2term "(x + 2)/(x - 1) + (x - 3)/(x - 2) - (x + 1)/((x - 1)*(x - 2))";
27.775 +val t = TermC.str2term "(x + 2)/(x - 1) + (x - 3)/(x - 2) - (x + 1)/((x - 1)*(x - 2))";
27.776 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.777 if UnparseC.term t ="(-2 + -5 * x + 2 * x ^^^ 2) / (2 + -3 * x + x ^^^ 2)"
27.778 then () else error "rational.sml: diff.behav. in norm_Rational_mg 16";
27.779
27.780 (*SRA Schalk I, p.68 Nr. 428b *)
27.781 -val t = str2term
27.782 +val t = TermC.str2term
27.783 "1/(a - b)^^^2 + 1/(a + b)^^^2 - 2/(a^^^2 - b^^^2) - 4*(b^^^2 - 1)/(a^^^2 - b^^^2)^^^2";
27.784 (* WN130911 non-termination due to non-termination of
27.785 - cancel_p_ thy (str2term "(4 + -4 * b ^^^ 2) / (a ^^^ 4 + -2 * (a ^^^ 2 * b ^^^ 2) + b ^^^ 4)")
27.786 + cancel_p_ thy (TermC.str2term "(4 + -4 * b ^^^ 2) / (a ^^^ 4 + -2 * (a ^^^ 2 * b ^^^ 2) + b ^^^ 4)")
27.787
27.788 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.789 if UnparseC.term t = "4 / (a ^^^ 4 + -2 * a ^^^ 2 * b ^^^ 2 + b ^^^ 4)"
27.790 @@ -1192,14 +1192,14 @@
27.791 *)
27.792
27.793 (*SRA Schalk I, p.68 Nr. 430b *)
27.794 -val t = str2term
27.795 +val t = TermC.str2term
27.796 "a^^^2/(a - 3*b) - 108*a*b^^^3/((a+3*b)*(a^^^2 - 9*b^^^2)) - 9*b^^^2*(a - 3*b)/(a+3*b)^^^2";
27.797 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.798 if UnparseC.term t = "a + 3 * b"
27.799 then () else error "rational.sml: diff.behav. in norm_Rational_mg 19";
27.800
27.801 (*SRA Schalk I, p.68 Nr. 432 *)
27.802 -val t = str2term
27.803 +val t = TermC.str2term
27.804 ("(a^^^2 + a*b) / (a^^^2 - b^^^2) - (b^^^2 - a*b) / (b^^^2 - a^^^2) + " ^
27.805 "a^^^2*(a - b) / (a^^^3 - a^^^2*b) - 2*a*(a^^^2 - b^^^2) / (a^^^3 - a*b^^^2) - " ^
27.806 "2*b^^^2 / (a^^^2 - b^^^2)");
27.807 @@ -1208,7 +1208,7 @@
27.808 then () else error "rational.sml: diff.behav. in norm_Rational_mg 20";
27.809
27.810 (* some example *)
27.811 -val t = str2term "3*a / (a*b) + x/y";
27.812 +val t = TermC.str2term "3*a / (a*b) + x/y";
27.813 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.814 if UnparseC.term t = "(3 * y + b * x) / (b * y)"
27.815 then () else error "rational.sml: diff.behav. in norm_Rational_mg 21";
27.816 @@ -1217,19 +1217,19 @@
27.817 "-------- examples multiply and cancel from: Mathematik 1 Schalk -------------";
27.818 "-------- examples multiply and cancel from: Mathematik 1 Schalk -------------";
27.819 (*------- SRM Schalk I, p.68 Nr. 436a *)
27.820 -val t = str2term "3*(x+y) / (15*(x - y)) * 25*(x - y)^^^2 / (18*(x + y)^^^2)";
27.821 +val t = TermC.str2term "3*(x+y) / (15*(x - y)) * 25*(x - y)^^^2 / (18*(x + y)^^^2)";
27.822 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.823 if UnparseC.term t = "(-5 * x + 5 * y) / (-18 * x + -18 * y)"
27.824 then () else error "rational.sml: diff.behav. in norm_Rational_mg 22";
27.825
27.826 (*------- SRM.test Schalk I, p.68 Nr. 436b *)
27.827 -val t = str2term "5*a*(a - b)^^^2*(a + b)^^^3/(7*b*(a - b)^^^3) * 7*b/(a + b)^^^3";
27.828 +val t = TermC.str2term "5*a*(a - b)^^^2*(a + b)^^^3/(7*b*(a - b)^^^3) * 7*b/(a + b)^^^3";
27.829 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.830 if UnparseC.term t = "5 * a / (a + -1 * b)"
27.831 then () else error "rational.sml: diff.behav. in norm_Rational_mg 23";
27.832
27.833 (*------- Schalk I, p.68 Nr. 437a *)
27.834 -val t = str2term "(3*a - 4*b) / (4*c+3*e) * (3*a+4*b)/(9*a^^^2 - 16*b^^^2)";
27.835 +val t = TermC.str2term "(3*a - 4*b) / (4*c+3*e) * (3*a+4*b)/(9*a^^^2 - 16*b^^^2)";
27.836 (* raises an exception for unclear reasons:
27.837 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.838 :
27.839 @@ -1238,7 +1238,7 @@
27.840 exception Div raised
27.841
27.842 BUT
27.843 -val t = str2term
27.844 +val t = TermC.str2term
27.845 ("(9 * a ^^^ 2 + -16 * b ^^^ 2) / (4 * c + 3 * e) /" ^
27.846 "(9 * a ^^^ 2 + -16 * b ^^^ 2)");
27.847 NONE = cancel_p_ thy t;
27.848 @@ -1248,7 +1248,7 @@
27.849 *)
27.850
27.851 "----- S.K. corrected non-termination 060904";
27.852 -val t = str2term "(3*a - 4*b) * (3*a+4*b)/((4*c+3*e)*(9*a^^^2 - 16*b^^^2))";
27.853 +val t = TermC.str2term "(3*a - 4*b) * (3*a+4*b)/((4*c+3*e)*(9*a^^^2 - 16*b^^^2))";
27.854 val SOME (t, _) = rewrite_set_ thy false make_polynomial t;
27.855 if UnparseC.term t =
27.856 "(9 * a ^^^ 2 + -16 * b ^^^ 2) /\n(36 * a ^^^ 2 * c + 27 * a ^^^ 2 * e + -64 * b ^^^ 2 * c +\n -48 * b ^^^ 2 * e)"
27.857 @@ -1256,7 +1256,7 @@
27.858 then () else error "rational.sml: S.K.8..corrected 060904-6";
27.859
27.860 "----- S.K. corrected non-termination of cancel_p_";
27.861 -val t'' = str2term ("(9 * a ^^^ 2 + -16 * b ^^^ 2) /" ^
27.862 +val t'' = TermC.str2term ("(9 * a ^^^ 2 + -16 * b ^^^ 2) /" ^
27.863 "(36 * a^^^2 * c + (27 * a^^^2 * e + (-64 * b^^^2 * c + -48 * b^^^2 * e)))");
27.864 (* /--- DOES NOT TERMINATE AT TRANSITION isabisac15 --> Isabelle2017 --------------------------\
27.865 val SOME (t',_) = rewrite_set_ thy false cancel_p t'';
27.866 @@ -1265,7 +1265,7 @@
27.867 \--- DOES NOT TERMINATE AT TRANSITION isabisac15 --> Isabelle2017 --------------------------/*)
27.868
27.869 (*------- Schalk I, p.68 Nr. 437b*)
27.870 -val t = str2term "(a + b)/(x^^^2 - y^^^2) * ((x - y)^^^2/(a^^^2 - b^^^2))";
27.871 +val t = TermC.str2term "(a + b)/(x^^^2 - y^^^2) * ((x - y)^^^2/(a^^^2 - b^^^2))";
27.872 (*val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.873 :
27.874 #### rls: cancel_p on: (a * x ^^^ 2 + -2 * (a * (x * y)) + a * y ^^^ 2 + b * x ^^^ 2 +
27.875 @@ -1277,25 +1277,25 @@
27.876 *)
27.877
27.878 (*------- SRM Schalk I, p.68 Nr. 438a *)
27.879 -val t = str2term "x*y / (x*y - y^^^2) * (x^^^2 - x*y)";
27.880 +val t = TermC.str2term "x*y / (x*y - y^^^2) * (x^^^2 - x*y)";
27.881 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.882 if UnparseC.term t = "x ^^^ 2"
27.883 then () else error "rational.sml: diff.behav. in norm_Rational_mg 24";
27.884
27.885 (*------- SRM Schalk I, p.68 Nr. 439b *)
27.886 -val t = str2term "(4*x^^^2 + 4*x + 1) * ((x^^^2 - 2*x^^^3) / (4*x^^^2 + 2*x))";
27.887 +val t = TermC.str2term "(4*x^^^2 + 4*x + 1) * ((x^^^2 - 2*x^^^3) / (4*x^^^2 + 2*x))";
27.888 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.889 if UnparseC.term t = "(x + -4 * x ^^^ 3) / 2"
27.890 then () else error "rational.sml: diff.behav. in norm_Rational_mg 25";
27.891
27.892 (*------- SRM Schalk I, p.68 Nr. 440a *)
27.893 -val t = str2term "(x^^^2 - 2*x) / (x^^^2 - 3*x) * (x - 3)^^^2 / (x^^^2 - 4)";
27.894 +val t = TermC.str2term "(x^^^2 - 2*x) / (x^^^2 - 3*x) * (x - 3)^^^2 / (x^^^2 - 4)";
27.895 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.896 if UnparseC.term t = "(-3 + x) / (2 + x)"
27.897 then () else error "rational.sml: diff.behav. in norm_Rational_mg 26";
27.898
27.899 "----- Schalk I, p.68 Nr. 440b SK11 works since 0707xx";
27.900 -val t = str2term "(a^^^3 - 9*a) / (a^^^3*b - a*b^^^3) * (a^^^2*b + a*b^^^2) / (a+3)";
27.901 +val t = TermC.str2term "(a^^^3 - 9*a) / (a^^^3*b - a*b^^^3) * (a^^^2*b + a*b^^^2) / (a+3)";
27.902 (* WN130911 non-termination for unclear reasons:
27.903 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.904
27.905 @@ -1306,7 +1306,7 @@
27.906 (a ^^^ 3 * b + -1 * (a * b ^^^ 3)) /
27.907 (3 + a)
27.908 BUT THIS IS CORRECTLY RECOGNISED
27.909 -val t = str2term
27.910 +val t = TermC.str2term
27.911 ("(-9 * (a^^^3 * b) + -9 * (a^^^2 * b^^^2) + a^^^5 * b + a^^^4 * b^^^2) /" ^
27.912 "(a^^^3 * b + -1 * (a * b^^^3)) / (3 + (a::real))");
27.913 AS
27.914 @@ -1317,9 +1317,9 @@
27.915 *)
27.916
27.917 "----- SK12 works since 0707xx";
27.918 -val t = str2term "(a^^^3 - 9*a) * (a^^^2*b+a*b^^^2) / ((a^^^3*b - a*b^^^3) * (a+3))";
27.919 +val t = TermC.str2term "(a^^^3 - 9*a) * (a^^^2*b+a*b^^^2) / ((a^^^3*b - a*b^^^3) * (a+3))";
27.920 (* WN130911 non-termination due to non-termination of
27.921 - cancel_p_ thy (str2term "(4 + -4 * b ^^^ 2) / (a ^^^ 4 + -2 * (a ^^^ 2 * b ^^^ 2) + b ^^^ 4)")
27.922 + cancel_p_ thy (TermC.str2term "(4 + -4 * b ^^^ 2) / (a ^^^ 4 + -2 * (a ^^^ 2 * b ^^^ 2) + b ^^^ 4)")
27.923
27.924 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.925 if UnparseC.term t' = "(-3 * a + a ^^^ 2) / (a + -1 * b)" then ()
27.926 @@ -1330,53 +1330,53 @@
27.927 "-------- examples common denominator and multiplication from: Schalk --------";
27.928 "-------- examples common denominator and multiplication from: Schalk --------";
27.929 (*------- SRAM Schalk I, p.69 Nr. 441b *)
27.930 -val t = str2term "(4*a/3 + 3*b^^^2/a^^^3 + b/(4*a))*(4*b/(3*a))";
27.931 +val t = TermC.str2term "(4*a/3 + 3*b^^^2/a^^^3 + b/(4*a))*(4*b/(3*a))";
27.932 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.933 if UnparseC.term t = "(36 * b ^^^ 3 + 3 * a ^^^ 2 * b ^^^ 2 + 16 * a ^^^ 4 * b) / (9 * a ^^^ 4)"
27.934 then () else error "rational.sml: diff.behav. in norm_Rational_mg 28";
27.935
27.936 (*------- SRAM Schalk I, p.69 Nr. 442b *)
27.937 -val t = str2term ("(15*a^^^2/x^^^3 - 5*b^^^4/x^^^2 + 25*c^^^2/x) * " ^
27.938 +val t = TermC.str2term ("(15*a^^^2/x^^^3 - 5*b^^^4/x^^^2 + 25*c^^^2/x) * " ^
27.939 "(x^^^3/(5*a*b^^^3*c^^^3)) + 1/c^^^3 * (b*x/a - 3*a/b^^^3)");
27.940 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.941 if UnparseC.term t = "5 * x ^^^ 2 / (a * b ^^^ 3 * c)"
27.942 then () else error "rational.sml: diff.behav. in norm_Rational_mg 29";
27.943
27.944 (*------- SRAM Schalk I, p.69 Nr. 443b *)
27.945 -val t = str2term "(a/2 + b/3) * (b/3 - a/2)";
27.946 +val t = TermC.str2term "(a/2 + b/3) * (b/3 - a/2)";
27.947 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.948 if UnparseC.term t = "(-9 * a ^^^ 2 + 4 * b ^^^ 2) / 36"
27.949 then () else error "rational.sml: diff.behav. in norm_Rational_mg 30";
27.950
27.951 (*------- SRAM Schalk I, p.69 Nr. 445b *)
27.952 -val t = str2term "(a^^^2/9 + 2*a/(3*b) + 4/b^^^2)*(a/3 - 2/b) + 8/b^^^3";
27.953 +val t = TermC.str2term "(a^^^2/9 + 2*a/(3*b) + 4/b^^^2)*(a/3 - 2/b) + 8/b^^^3";
27.954 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.955 if UnparseC.term t = "a ^^^ 3 / 27"
27.956 then () else error "rational.sml: diff.behav. in norm_Rational_mg 31";
27.957
27.958 (*------- SRAM Schalk I, p.69 Nr. 446b *)
27.959 -val t = str2term "(x/(5*x + 4*y) - y/(5*x - 4*y) + 1)*(25*x^^^2 - 16*y^^^2)";
27.960 +val t = TermC.str2term "(x/(5*x + 4*y) - y/(5*x - 4*y) + 1)*(25*x^^^2 - 16*y^^^2)";
27.961 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.962 if UnparseC.term t = (*"30 * x ^^^ 2 + -9 * x * y + -20 * y ^^^ 2" ..isabisac15 | Isabelle2017..*)
27.963 "(-30 * x ^^^ 2 + 9 * x * y + 20 * y ^^^ 2) / -1"
27.964 then () else error "rational.sml: diff.behav. in norm_Rational_mg 32";
27.965
27.966 (*------- SRAM Schalk I, p.69 Nr. 449a *)(*Achtung: rechnet ca 8 Sekunden*)
27.967 -val t = str2term
27.968 +val t = TermC.str2term
27.969 "(2*x^^^2/(3*y)+x/y^^^2)*(4*x^^^4/(9*y^^^2)+x^^^2/y^^^4)*(2*x^^^2/(3*y) - x/y^^^2)";
27.970 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.971 if UnparseC.term t = "(-81 * x ^^^ 4 + 16 * x ^^^ 8 * y ^^^ 4) / (81 * y ^^^ 8)"
27.972 then () else error "rational.sml: diff.behav. in norm_Rational_mg 33";
27.973
27.974 (*------- SRAM Schalk I, p.69 Nr. 450a *)
27.975 -val t = str2term
27.976 +val t = TermC.str2term
27.977 "(4*x/(3*y)+2*y/(3*x))^^^2 - (2*y/(3*x) - 2*x/y)*(2*y/(3*x)+2*x/y)";
27.978 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.979 if UnparseC.term t = "(52 * x ^^^ 2 + 16 * y ^^^ 2) / (9 * y ^^^ 2)"
27.980 then () else error "rational.sml: diff.behav. in norm_Rational_mg 34";
27.981
27.982 (*------- SRAM Schalk I, p.69 Nr. 442b --- abgewandelt*)
27.983 -val t = str2term
27.984 +val t = TermC.str2term
27.985 ("(15*a^^^4/(a*x^^^3) - 5*a*((b^^^4 - 5*c^^^2*x) / x^^^2)) * " ^
27.986 "(x^^^3/(5*a*b^^^3*c^^^3)) + a/c^^^3 * (x*(b/a) - 3*b*(a/b^^^4))");
27.987 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.988 @@ -1388,21 +1388,21 @@
27.989 "-------- examples double fractions from: Mathematik 1 Schalk ----------------";
27.990 "-------- examples double fractions from: Mathematik 1 Schalk ----------------";
27.991 "----- SRD Schalk I, p.69 Nr. 454b";
27.992 -val t = str2term "((2 - x)/(2*a)) / (2*a/(x - 2))";
27.993 +val t = TermC.str2term "((2 - x)/(2*a)) / (2*a/(x - 2))";
27.994 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.995 if UnparseC.term t = "(-4 + 4 * x + -1 * x ^^^ 2) / (4 * a ^^^ 2)"
27.996 then () else error "rational.sml: diff.behav. in norm_Rational_mg 35";
27.997
27.998 "----- SRD Schalk I, p.69 Nr. 455a";
27.999 -val t = str2term "(a^^^2 + 1)/(a^^^2 - 1) / ((a+1)/(a - 1))";
27.1000 +val t = TermC.str2term "(a^^^2 + 1)/(a^^^2 - 1) / ((a+1)/(a - 1))";
27.1001 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.1002 if UnparseC.term t = "(1 + a ^^^ 2) / (1 + 2 * a + a ^^^ 2)" then ()
27.1003 else error "rational.sml: diff.behav. in norm_Rational_mg 36";
27.1004
27.1005 "----- Schalk I, p.69 Nr. 455b";
27.1006 -val t = str2term "(x^^^2 - 4)/(y^^^2 - 9)/((2+x)/(3 - y))";
27.1007 +val t = TermC.str2term "(x^^^2 - 4)/(y^^^2 - 9)/((2+x)/(3 - y))";
27.1008 (* WN130911 non-termination due to non-termination of
27.1009 - cancel_p_ thy (str2term ("(-12 + 4 * y + 3 * x ^^^ 2 + -1 * (x ^^^ 2 * y)) /" ^
27.1010 + cancel_p_ thy (TermC.str2term ("(-12 + 4 * y + 3 * x ^^^ 2 + -1 * (x ^^^ 2 * y)) /" ^
27.1011 "(-18 + -9 * x + 2 * y ^^^ 2 + x * y ^^^ 2)"))
27.1012
27.1013 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.1014 @@ -1411,9 +1411,9 @@
27.1015 *)
27.1016
27.1017 "----- SK060904-1a non-termination of cancel_p_ ?: worked before 0707xx";
27.1018 -val t = str2term "(x^^^2 - 4)*(3 - y) / ((y^^^2 - 9)*(2+x))";
27.1019 +val t = TermC.str2term "(x^^^2 - 4)*(3 - y) / ((y^^^2 - 9)*(2+x))";
27.1020 (* WN130911 non-termination due to non-termination of
27.1021 - cancel_p_ thy (str2term ("(-12 + 4 * y + 3 * x ^^^ 2 + -1 * (x ^^^ 2 * y)) /" ^
27.1022 + cancel_p_ thy (TermC.str2term ("(-12 + 4 * y + 3 * x ^^^ 2 + -1 * (x ^^^ 2 * y)) /" ^
27.1023 "(-18 + -9 * x + 2 * y ^^^ 2 + x * y ^^^ 2)"))
27.1024
27.1025 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.1026 @@ -1422,25 +1422,25 @@
27.1027 *)
27.1028
27.1029 "----- ?: worked before 0707xx";
27.1030 -val t = str2term "(3 + -1 * y) / (-9 + y ^^^ 2)";
27.1031 +val t = TermC.str2term "(3 + -1 * y) / (-9 + y ^^^ 2)";
27.1032 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.1033 if UnparseC.term t = "-1 / (3 + y)"
27.1034 then () else error "rational.sml: -1 / (3 + y) norm_Rational";
27.1035
27.1036 "----- SRD Schalk I, p.69 Nr. 456b";
27.1037 -val t = str2term "(b^^^3 - b^^^2) / (b^^^2+b) / (b^^^2 - 1)";
27.1038 +val t = TermC.str2term "(b^^^3 - b^^^2) / (b^^^2+b) / (b^^^2 - 1)";
27.1039 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.1040 if UnparseC.term t = "b / (1 + 2 * b + b ^^^ 2)"
27.1041 then () else error "rational.sml: diff.behav. in norm_Rational_mg 38";
27.1042
27.1043 "----- SRD Schalk I, p.69 Nr. 457b";
27.1044 -val t = str2term "(16*a^^^2 - 9*b^^^2)/(2*a+3*a*b) / ((4*a+3*b)/(4*a^^^2 - 9*a^^^2*b^^^2))";
27.1045 +val t = TermC.str2term "(16*a^^^2 - 9*b^^^2)/(2*a+3*a*b) / ((4*a+3*b)/(4*a^^^2 - 9*a^^^2*b^^^2))";
27.1046 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.1047 if UnparseC.term t = "8 * a ^^^ 2 + -6 * a * b + -12 * a ^^^ 2 * b + 9 * a * b ^^^ 2"
27.1048 then () else error "rational.sml: diff.behav. in norm_Rational_mg 39";
27.1049
27.1050 "----- Schalk I, p.69 Nr. 458b works since 0707";
27.1051 -val t = str2term "(2*a^^^2*x - a^^^2) / (a*x - b*x) / (b^^^2*(2*x - 1) / (x*(a - b)))";
27.1052 +val t = TermC.str2term "(2*a^^^2*x - a^^^2) / (a*x - b*x) / (b^^^2*(2*x - 1) / (x*(a - b)))";
27.1053 (*val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.1054 :
27.1055 ### rls: cancel_p on: (-1 * a ^^^ 2 + 2 * (a ^^^ 2 * x)) / (a * x + -1 * (b * x)) /
27.1056 @@ -1448,7 +1448,7 @@
27.1057 exception Div raised
27.1058
27.1059 BUT
27.1060 -val t = str2term
27.1061 +val t = TermC.str2term
27.1062 ("(-1 * a ^^^ 2 + 2 * (a ^^^ 2 * x)) / (a * x + -1 * (b * x)) /" ^
27.1063 "((-1 * b ^^^ 2 + 2 * (b ^^^ 2 * x)) / (a * x + -1 * (b * x)))");
27.1064 NONE = cancel_p_ thy t;
27.1065 @@ -1458,18 +1458,18 @@
27.1066 *)
27.1067
27.1068 "----- SRD Schalk I, p.69 Nr. 459b";
27.1069 -val t = str2term "(a^^^2 - b^^^2)/(a*b) / (4*(a+b)^^^2/a)";
27.1070 +val t = TermC.str2term "(a^^^2 - b^^^2)/(a*b) / (4*(a+b)^^^2/a)";
27.1071 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.1072 if UnparseC.term t = "(a + -1 * b) / (4 * a * b + 4 * b ^^^ 2)" then ()
27.1073 else error "rational.sml: diff.behav. in norm_Rational_mg 41";
27.1074
27.1075 "----- Schalk I, p.69 Nr. 460b nonterm.SK";
27.1076 -val t = str2term "(9*(x^^^2 - 8*x + 16) / (4*(y^^^2 - 2*y + 1))) / ((3*x - 12) / (16*y - 16))";
27.1077 +val t = TermC.str2term "(9*(x^^^2 - 8*x + 16) / (4*(y^^^2 - 2*y + 1))) / ((3*x - 12) / (16*y - 16))";
27.1078 (*val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.1079 exception Div raised
27.1080
27.1081 BUT
27.1082 -val t = str2term
27.1083 +val t = TermC.str2term
27.1084 ("(144 + -72 * x + 9 * x ^^^ 2) / (4 + -8 * y + 4 * y ^^^ 2) /" ^
27.1085 "((-12 + 3 * x) / (-16 + 16 * y))");
27.1086 NONE = cancel_p_ thy t;
27.1087 @@ -1479,40 +1479,40 @@
27.1088 *)
27.1089
27.1090 "----- some variant of the above; was non-terminating before";
27.1091 -val t = str2term "9*(x^^^2 - 8*x+16)*(16*y - 16)/(4*(y^^^2 - 2*y+1)*(3*x - 12))";
27.1092 +val t = TermC.str2term "9*(x^^^2 - 8*x+16)*(16*y - 16)/(4*(y^^^2 - 2*y+1)*(3*x - 12))";
27.1093 val SOME (t , _) = rewrite_set_ thy false norm_Rational t;
27.1094 if UnparseC.term t = "(48 + -12 * x) / (1 + -1 * y)"
27.1095 then () else error "some variant of the above; was non-terminating before";
27.1096
27.1097 "----- SRD Schalk I, p.70 Nr. 472a";
27.1098 -val t = str2term ("((8*x^^^2 - 32*y^^^2) / (2*x + 4*y)) / ((4*x - 8*y) / (x + y))");
27.1099 +val t = TermC.str2term ("((8*x^^^2 - 32*y^^^2) / (2*x + 4*y)) / ((4*x - 8*y) / (x + y))");
27.1100 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.1101 if UnparseC.term t = "x + y"
27.1102 then () else error "rational.sml: diff.behav. in norm_Rational_mg 43";
27.1103
27.1104 "----- Schalk I, p.70 Nr. 478b ----- Rechenzeit: 5 sec";
27.1105 -val t = str2term ("(a - (a*b + b^^^2)/(a+b))/(b+(a - b)/(1+(a+b)/(a - b))) / " ^
27.1106 +val t = TermC.str2term ("(a - (a*b + b^^^2)/(a+b))/(b+(a - b)/(1+(a+b)/(a - b))) / " ^
27.1107 "((a - a^^^2/(a+b))/(a+(a*b)/(a - b)))");
27.1108 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.1109 if UnparseC.term t = "(2 * a ^^^ 3 + 2 * a ^^^ 2 * b) / (a ^^^ 2 * b + b ^^^ 3)"
27.1110 then () else error "rational.sml: diff.behav. in norm_Rational_mg 51";
27.1111
27.1112 (*SRD Schalk I, p.69 Nr. 461a *)
27.1113 -val t = str2term "(2/(x+3) + 2/(x - 3)) / (8*x/(x^^^2 - 9))";
27.1114 +val t = TermC.str2term "(2/(x+3) + 2/(x - 3)) / (8*x/(x^^^2 - 9))";
27.1115 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.1116 if UnparseC.term t = "1 / 2"
27.1117 then () else error "rational.sml: diff.behav. in norm_Rational_mg 44";
27.1118
27.1119 (*SRD Schalk I, p.69 Nr. 464b *)
27.1120 -val t = str2term "(a - a/(a - 2)) / (a + a/(a - 2))";
27.1121 +val t = TermC.str2term "(a - a/(a - 2)) / (a + a/(a - 2))";
27.1122 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.1123 if UnparseC.term t = "(-3 + a) / (-1 + a)"
27.1124 then () else error "rational.sml: diff.behav. in norm_Rational_mg 45";
27.1125
27.1126 (*SRD Schalk I, p.69 Nr. 465b *)
27.1127 -val t = str2term "((x+3*y)/9 + (4*y^^^2 - 9*z^^^2)/(16*x)) / (x/9 + y/6 + z/4)";
27.1128 +val t = TermC.str2term "((x+3*y)/9 + (4*y^^^2 - 9*z^^^2)/(16*x)) / (x/9 + y/6 + z/4)";
27.1129 (* WN130911 non-termination due to non-termination of
27.1130 - cancel_p_ thy (str2term
27.1131 + cancel_p_ thy (TermC.str2term
27.1132 ("("(576 * x ^^^ 2 + 1728 * (x * y) + 1296 * y ^^^ 2 + -2916 * z ^^^ 2) /" ^
27.1133 "(576 * x ^^^ 2 + 864 * (x * y) + 1296 * (x * z))"))
27.1134
27.1135 @@ -1522,13 +1522,13 @@
27.1136 *)
27.1137
27.1138 (*SRD Schalk I, p.69 Nr. 466b *)
27.1139 -val t = str2term "((1 - 7*(x - 2)/(x^^^2 - 4)) / (6/(x+2))) / (3/(x+5)+30/(x^^^2 - 25))";
27.1140 +val t = TermC.str2term "((1 - 7*(x - 2)/(x^^^2 - 4)) / (6/(x+2))) / (3/(x+5)+30/(x^^^2 - 25))";
27.1141 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.1142 if UnparseC.term t = "(25 + -10 * x + x ^^^ 2) / 18"
27.1143 then () else error "rational.sml: diff.behav. in norm_Rational_mg 47";
27.1144
27.1145 (*SRD Schalk I, p.70 Nr. 469 *)
27.1146 -val t = str2term ("3*b^^^2 / (4*a^^^2 - 8*a*b + 4*b^^^2) / " ^
27.1147 +val t = TermC.str2term ("3*b^^^2 / (4*a^^^2 - 8*a*b + 4*b^^^2) / " ^
27.1148 "(a / (a^^^2*b - b^^^3) + (a - b) / (4*a*b^^^2 + 4*b^^^3) - 1 / (4*b^^^2))");
27.1149 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.1150 if UnparseC.term t = "-3 * b ^^^ 3 / (-2 * a + 2 * b)"
27.1151 @@ -1682,13 +1682,13 @@
27.1152 "-------- investigate rulesets for cancel_p ----------------------------------";
27.1153 "-------- investigate rulesets for cancel_p ----------------------------------";
27.1154 val thy = @{theory "Rational"};
27.1155 -val t = str2term "(a^^^2 + -1*b^^^2) / (a^^^2 + -2*a*b + b^^^2)";
27.1156 -val tt = str2term "(1 * a + 1 * b) * (1 * a + -1 * b)"(*numerator only*);
27.1157 +val t = TermC.str2term "(a^^^2 + -1*b^^^2) / (a^^^2 + -2*a*b + b^^^2)";
27.1158 +val tt = TermC.str2term "(1 * a + 1 * b) * (1 * a + -1 * b)"(*numerator only*);
27.1159
27.1160 "----- with rewrite_set_";
27.1161 val SOME (tt',asm) = rewrite_set_ thy false make_polynomial tt;
27.1162 if UnparseC.term tt'= "a ^^^ 2 + -1 * b ^^^ 2" then () else error "rls chancel_p 1";
27.1163 -val tt = str2term "((1 * a + -1 * b) * (1 * a + -1 * b))"(*denominator only*);
27.1164 +val tt = TermC.str2term "((1 * a + -1 * b) * (1 * a + -1 * b))"(*denominator only*);
27.1165 val SOME (tt',asm) = rewrite_set_ thy false make_polynomial tt;
27.1166 if UnparseC.term tt' = "a ^^^ 2 + -2 * a * b + b ^^^ 2" then () else error "rls chancel_p 2";
27.1167
27.1168 @@ -1710,12 +1710,12 @@
27.1169 (*default_print_depth 99;*) map (UnparseC.term o #1 o #3) der; (*default_print_depth 3;*)
27.1170
27.1171 val der = .make_deriv thy Atools_erls rules ro NONE
27.1172 - (str2term "(1 * a + 1 * b) * (1 * a + -1 * b)");
27.1173 + (TermC.str2term "(1 * a + 1 * b) * (1 * a + -1 * b)");
27.1174 (*default_print_depth 99;*) writeln (deriv2str der); (*default_print_depth 3;*)
27.1175
27.1176 val {rules, rew_ord=(_,ro),...} = Rule_Set.rep (assoc_rls "rev_rew_p");
27.1177 val der = .make_deriv thy Atools_erls rules ro NONE
27.1178 - (str2term "(1 * a + -1 * b) * (1 * a + -1 * b)");
27.1179 + (TermC.str2term "(1 * a + -1 * b) * (1 * a + -1 * b)");
27.1180 (*default_print_depth 99;*) writeln (deriv2str der); (*default_print_depth 3;*)
27.1181 (*default_print_depth 99;*) map (UnparseC.term o #1) der; (*default_print_depth 3;*)
27.1182 (*WN060829 ...postponed*)
27.1183 @@ -1725,7 +1725,7 @@
27.1184 "-------- fun eval_get_denominator -------------------------------------------";
27.1185 "-------- fun eval_get_denominator -------------------------------------------";
27.1186 val thy = @{theory Isac_Knowledge};
27.1187 -val t = Thm.term_of (the (parse thy "get_denominator ((a +x)/b)"));
27.1188 +val t = Thm.term_of (the (TermC.parse thy "get_denominator ((a +x)/b)"));
27.1189 val SOME (_, t') = eval_get_denominator "" 0 t thy;
27.1190 if UnparseC.term t' = "get_denominator ((a + x) / b) = b"
27.1191 then () else error "get_denominator ((a + x) / b) = b"
27.1192 @@ -1762,21 +1762,21 @@
27.1193 "-------- WN1309xx non-terminating rls norm_Rational -------------------------";
27.1194 "-------- WN1309xx non-terminating rls norm_Rational -------------------------";
27.1195 (*------- Schalk I, p.70 Nr. 480b; a/b : c/d translated to a/b * d/c*)
27.1196 -val t = str2term
27.1197 +val t = TermC.str2term
27.1198 ("((12*x*y / (9*x^^^2 - y^^^2)) / (1 / (3*x - y)^^^2 - 1 / (3*x + y)^^^2)) * " ^
27.1199 "((1/(x - 5*y)^^^2 - 1/(x + 5*y)^^^2) / (20*x*y / (x^^^2 - 25*y^^^2)))");
27.1200
27.1201 (*1st factor separately simplified *)
27.1202 -val t = str2term "((12*x*y / (9*x^^^2 - y^^^2)) / (1 / (3*x - y)^^^2 - 1 / (3*x + y)^^^2))";
27.1203 +val t = TermC.str2term "((12*x*y / (9*x^^^2 - y^^^2)) / (1 / (3*x - y)^^^2 - 1 / (3*x + y)^^^2))";
27.1204 val SOME (t', _) = rewrite_set_ thy false norm_Rational t;
27.1205 if UnparseC.term t' = "(-9 * x ^^^ 2 + y ^^^ 2) / -1" then () else error "Nr. 480b lhs changed";
27.1206 (*2nd factor separately simplified *)
27.1207 -val t = str2term "((1/(x - 5*y)^^^2 - 1/(x + 5*y)^^^2) / (20*x*y / (x^^^2 - 25*y^^^2)))";
27.1208 +val t = TermC.str2term "((1/(x - 5*y)^^^2 - 1/(x + 5*y)^^^2) / (20*x*y / (x^^^2 - 25*y^^^2)))";
27.1209 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; UnparseC.term t';
27.1210 if UnparseC.term t' = "-1 / (-1 * x ^^^ 2 + 25 * y ^^^ 2)" then () else error "Nr. 480b rhs changed";
27.1211
27.1212 "-------- Schalk I, p.70 Nr. 477a: terms are exploding ?!?";
27.1213 -val t = str2term ("b*y/(b - 2*y)/((b^^^2 - y^^^2)/(b+2*y)) /" ^
27.1214 +val t = TermC.str2term ("b*y/(b - 2*y)/((b^^^2 - y^^^2)/(b+2*y)) /" ^
27.1215 "(b^^^2*y + b*y^^^2) * (a+x)^^^2 / ((b^^^2 - 4*y^^^2) * (a+2*x)^^^2)");
27.1216 (*val SOME (t',_) = rewrite_set_ thy false norm_Rational t;
27.1217 :
27.1218 @@ -1791,7 +1791,7 @@
27.1219 exception Div raised
27.1220
27.1221 BUT
27.1222 -val t = str2term
27.1223 +val t = TermC.str2term
27.1224 ("(a ^^^ 2 * (b * y) + 2 * (a * (b * (x * y))) + b * (x ^^^ 2 * y)) /" ^
27.1225 "(b + -2 * y) /" ^
27.1226 "((b ^^^ 2 + -1 * y ^^^ 2) / (b + 2 * y)) /" ^
27.1227 @@ -1804,7 +1804,7 @@
27.1228 *)
27.1229
27.1230 (*------- Schalk I, p.70 Nr. 476b in 2003 this worked using 10 sec. *)
27.1231 -val t = str2term
27.1232 +val t = TermC.str2term
27.1233 ("((a^^^2 - b^^^2)/(2*a*b) + 2*a*b/(a^^^2 - b^^^2)) / ((a^^^2 + b^^^2)/(2*a*b) + 1) / " ^
27.1234 "((a^^^2 + b^^^2)^^^2 / (a + b)^^^2)");
27.1235 (* Rewrite.trace_on := true;
27.1236 @@ -1828,7 +1828,7 @@
27.1237 *)
27.1238
27.1239 "-------- Schalk I, p.70 Nr. 480a: terms are exploding ?!?";
27.1240 -val t = str2term ("(1/x + 1/y + 1/z) / (1/x - 1/y - 1/z) / " ^
27.1241 +val t = TermC.str2term ("(1/x + 1/y + 1/z) / (1/x - 1/y - 1/z) / " ^
27.1242 "(2*x^^^2 / (x^^^2 - z^^^2) / (x / (x + z) + x / (x - z)))");
27.1243 (* Rewrite.trace_on := true;
27.1244 rewrite_set_ thy false norm_Rational t;
27.1245 @@ -1846,14 +1846,14 @@
27.1246 *)
27.1247
27.1248 "-------- Schalk I, p.60 Nr. 215d: terms are exploding, internal loop does not terminate";
27.1249 -val t = str2term "(a-b)^^^3 * (x+y)^^^4 / ((x+y)^^^2 * (a-b)^^^5)";
27.1250 +val t = TermC.str2term "(a-b)^^^3 * (x+y)^^^4 / ((x+y)^^^2 * (a-b)^^^5)";
27.1251 (* Kein Wunder, denn Z???ler und Nenner extra als Polynom dargestellt ergibt:
27.1252
27.1253 -val t = str2term "(a-b)^^^3 * (x+y)^^^4";
27.1254 +val t = TermC.str2term "(a-b)^^^3 * (x+y)^^^4";
27.1255 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.1256 UnparseC.term t;
27.1257 "a^^^3 * x^^^4 + 4 * a^^^3 * x^^^3 * y +6 * a^^^3 * x^^^2 * y^^^2 +4 * a^^^3 * x * y^^^3 +a^^^3 * y^^^4 +-3 * a^^^2 * b * x^^^4 +-12 * a^^^2 * b * x^^^3 * y +-18 * a^^^2 * b * x^^^2 * y^^^2 +-12 * a^^^2 * b * x * y^^^3 +-3 * a^^^2 * b * y^^^4 +3 * a * b^^^2 * x^^^4 +12 * a * b^^^2 * x^^^3 * y +18 * a * b^^^2 * x^^^2 * y^^^2 +12 * a * b^^^2 * x * y^^^3 +3 * a * b^^^2 * y^^^4 +-1 * b^^^3 * x^^^4 +-4 * b^^^3 * x^^^3 * y +-6 * b^^^3 * x^^^2 * y^^^2 +-4 * b^^^3 * x * y^^^3 +-1 * b^^^3 * y^^^4";
27.1258 -val t = str2term "((x+y)^^^2 * (a-b)^^^5)";
27.1259 +val t = TermC.str2term "((x+y)^^^2 * (a-b)^^^5)";
27.1260 val SOME (t, _) = rewrite_set_ thy false norm_Rational t;
27.1261 UnparseC.term t;
27.1262 "a^^^5 * x^^^2 + 2 * a^^^5 * x * y + a^^^5 * y^^^2 +-5 * a^^^4 * b * x^^^2 +-10 * a^^^4 * b * x * y +-5 * a^^^4 * b * y^^^2 +10 * a^^^3 * b^^^2 * x^^^2 +20 * a^^^3 * b^^^2 * x * y +10 * a^^^3 * b^^^2 * y^^^2 +-10 * a^^^2 * b^^^3 * x^^^2 +-20 * a^^^2 * b^^^3 * x * y +-10 * a^^^2 * b^^^3 * y^^^2 +5 * a * b^^^4 * x^^^2 +10 * a * b^^^4 * x * y +5 * a * b^^^4 * y^^^2 +-1 * b^^^5 * x^^^2 +-2 * b^^^5 * x * y +-1 * b^^^5 * y^^^2";
27.1263 @@ -1861,7 +1861,7 @@
27.1264 anscheinend macht dem Rechner das Krzen diese Bruches keinen Spass mehr ...*)
27.1265
27.1266 "-------- Schalk I, p.70 Nr. 480b: terms are exploding, Rewrite.trace_on stops at";
27.1267 -val t = str2term ("((12*x*y/(9*x^^^2 - y^^^2))/" ^
27.1268 +val t = TermC.str2term ("((12*x*y/(9*x^^^2 - y^^^2))/" ^
27.1269 "(1/(3*x - y)^^^2 - 1/(3*x + y)^^^2)) *" ^
27.1270 "(1/(x - 5*y)^^^2 - 1/(x + 5*y)^^^2)/" ^
27.1271 "(20*x*y/(x^^^2 - 25*y^^^2))");
28.1 --- a/test/Tools/isac/Knowledge/rlang.sml Mon Apr 19 13:57:47 2021 +0200
28.2 +++ b/test/Tools/isac/Knowledge/rlang.sml Mon Apr 19 15:02:11 2021 +0200
28.3 @@ -186,15 +186,15 @@
28.4 | _ => error "rlang.sml: diff.behav. in Schalk I s.86 Bsp 28b []";
28.5
28.6 (*WN---v *)
28.7 -val bdv= (Thm.term_of o the o (parse thy)) "bdv";
28.8 -val v = (Thm.term_of o the o (parse thy)) "x";
28.9 -val t = (Thm.term_of o the o (parse thy)) "3 * x / 5";
28.10 +val bdv= (Thm.term_of o the o (TermC.parse thy)) "bdv";
28.11 +val v = (Thm.term_of o the o (TermC.parse thy)) "x";
28.12 +val t = (Thm.term_of o the o (TermC.parse thy)) "3 * x / 5";
28.13 val SOME (t',_) = rewrite_set_inst_ PolyEq.thy true
28.14 [ (bdv, v) ] make_ratpoly_in t;
28.15 if UnparseC.term t' = "3 / 5 * x" then () else error "rlang.sml: 1";
28.16
28.17 -val t = str2term "(3*x+5)/18 - x/2 - -(3*x - 2)/9 = 0";
28.18 -val subst = [(str2term "bdv", str2term "x")];
28.19 +val t = TermC.str2term "(3*x+5)/18 - x/2 - -(3*x - 2)/9 = 0";
28.20 +val subst = [(TermC.str2term "bdv", TermC.str2term "x")];
28.21 val SOME (t',_) = rewrite_set_inst_ thy false subst make_ratpoly_in t;
28.22 if UnparseC.term t' = "1 / 18 = 0" then () else error "rlang.sml: 2";
28.23 (*WN---^ *)
28.24 @@ -226,8 +226,8 @@
28.25
28.26
28.27 (*WN---v *)
28.28 -val t = str2term "(17*x - 51)/9 - (-(13*x - 3)/6) + 11 - (9*x - 7)/4 = 0";
28.29 -val subst = [(str2term "bdv", str2term "x")];
28.30 +val t = TermC.str2term "(17*x - 51)/9 - (-(13*x - 3)/6) + 11 - (9*x - 7)/4 = 0";
28.31 +val subst = [(TermC.str2term "bdv", TermC.str2term "x")];
28.32 val SOME (t',_) = rewrite_set_inst_ thy false subst make_ratpoly_in t;
28.33 UnparseC.term t';
28.34 if UnparseC.term t' = "79 / 12 + 65 / 36 * x = 0" then ()
28.35 @@ -338,14 +338,14 @@
28.36 | _ => error "rlang.sml: diff.behav. in Schalk I s.87 Bsp 44a [x = 1]";
28.37
28.38 (*WN---v *)
28.39 -val t = str2term "(1/2 + (5*x)/2)^^^2 - ((13*x)/2 - 5/2)^^^2 - (6*x)^^^2 + 29";
28.40 -val subst = [(str2term "bdv", str2term "x")];
28.41 +val t = TermC.str2term "(1/2 + (5*x)/2)^^^2 - ((13*x)/2 - 5/2)^^^2 - (6*x)^^^2 + 29";
28.42 +val subst = [(TermC.str2term "bdv", TermC.str2term "x")];
28.43 val SOME (t',_) = rewrite_set_inst_ thy false subst make_ratpoly_in t;
28.44 if UnparseC.term t' = "23 + 35 * x + -72 * x ^^^ 2" then ()
28.45 else error "rlang.sml: 4";
28.46
28.47 -val t = str2term "(1/2 + (5*x)/2)^^^2 - ((13*x)/2 - 5/2)^^^2 + (6*x)^^^2 - 29";
28.48 -val subst = [(str2term "bdv", str2term "x")];
28.49 +val t = TermC.str2term "(1/2 + (5*x)/2)^^^2 - ((13*x)/2 - 5/2)^^^2 + (6*x)^^^2 - 29";
28.50 +val subst = [(TermC.str2term "bdv", TermC.str2term "x")];
28.51 val SOME (t',_) = rewrite_set_inst_ thy false subst make_ratpoly_in t;
28.52 if UnparseC.term t' = "-35 + 35 * x" then ()
28.53 else error "rlang.sml: 4.1";
28.54 @@ -486,7 +486,7 @@
28.55 "[v = (u * v0 + v0 * w + -1 * f * w) / f]")) => ()
28.56 | _ => error "rlang.sml: diff.behav. in Schalk I s.89 Bsp 90a (1) [v=...]";
28.57 if Ctree.get_assumptions pt p =
28.58 - [str2term"(u * v0 + v0 * w + -1 * f * w) / f + w ~= 0"] then ()
28.59 + [TermC.str2term"(u * v0 + v0 * w + -1 * f * w) / f + w ~= 0"] then ()
28.60 else error "rlang.sml: diff.behav. in I s.89 Bsp 90a (1) [v=...] asm";
28.61
28.62
28.63 @@ -530,8 +530,8 @@
28.64 case f of Form' (Test_Out.FormKF (~1,EdUndef,0,Nundef,"[w = (u * v0 + -1 * f * v) / (f + -1 * v0)]")) => ()
28.65 | _ => error "rlang.sml: diff.behav. in Schalk I Bsp 90a(2)";
28.66 if Ctree.get_assumptions pt p =
28.67 -[str2term"v + (u * v0 + -1 * f * v) / (f + -1 * v0) ~= 0",
28.68 - str2term"f + -1 * v0 ~= 0"]
28.69 +[TermC.str2term"v + (u * v0 + -1 * f * v) / (f + -1 * v0) ~= 0",
28.70 + TermC.str2term"f + -1 * v0 ~= 0"]
28.71 then writeln "asm should be simplified ???"
28.72 else error "rlang.sml: diff.behav. in Schalk I Bsp 90a(2) asm";
28.73
28.74 @@ -571,9 +571,9 @@
28.75 val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
28.76 case f of Form' (Test_Out.FormKF (~1,EdUndef,0,Nundef,"[R1 = R * R2 / (R2 + -1 * R)]")) => ()
28.77 | _ => error "rlang.sml: diff.behav. in 98a(1) [R1 = ...]";
28.78 -if Ctree.get_assumptions pt p = [str2term"R * R2 * R2 ~= (R2 + -1 * R) * 0",
28.79 - str2term"R2 + -1 * R ~= 0",
28.80 - str2term"R2 + -1 * R ~= 0"]
28.81 +if Ctree.get_assumptions pt p = [TermC.str2term"R * R2 * R2 ~= (R2 + -1 * R) * 0",
28.82 + TermC.str2term"R2 + -1 * R ~= 0",
28.83 + TermC.str2term"R2 + -1 * R ~= 0"]
28.84 then writeln "asm should be simplified"
28.85 else error "rlang.sml: diff.behav. in 98a(1) asm";
28.86
28.87 @@ -602,7 +602,7 @@
28.88 val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
28.89 case f of Form' (Test_Out.FormKF (_,_,0,_,"[p = y ^^^ 2 / (2 * x)]")) => ()
28.90 | _ => error "rlang.sml: diff.behav. in Schalk I s.89 Bsp 104a (1) [p = y^2/(2*x)]";
28.91 -if Ctree.get_assumptions pt p = [str2term"-2 * x ~= 0"]
28.92 +if Ctree.get_assumptions pt p = [TermC.str2term"-2 * x ~= 0"]
28.93 then writeln"should be x ~= 0\nshould be x ~= 0\nshould be x ~= 0\n"
28.94 else error "rlang.sml: diff.behav. in I s.89 Bsp 104a(1) asm";
28.95
28.96 @@ -632,8 +632,8 @@
28.97 val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
28.98 case f of Form' (Test_Out.FormKF (_,_,0,_,"[y = sqrt (2 * p * x), y = -1 * sqrt (2 * p * x)]")) => ()
28.99 | _ => error "rlang.sml: diff.behav. Schalk I s.89 Bsp 104a(2) [x = ]";
28.100 -if Ctree.get_assumptions pt p = [str2term"0 <= -1 * (-2 * p * x)",
28.101 - str2term"0 <= -1 * (-2 * p * x)"]
28.102 +if Ctree.get_assumptions pt p = [TermC.str2term"0 <= -1 * (-2 * p * x)",
28.103 + TermC.str2term"0 <= -1 * (-2 * p * x)"]
28.104 then writeln "asm should be simplified\nshould be simplified"
28.105 else error "rlang.sml: diff.behav. in I s.89 Bsp 104a(2) asm";
28.106
28.107 @@ -678,10 +678,10 @@
28.108 | _ => error "rlang.sml: diff.behav. in Schalk I s.89 Bsp 118a(2) [x = ]";
28.109 val asms = Ctree.get_assumptions pt p;
28.110 if asms =
28.111 - [str2term"0 * b ^^^ 2 <= -1 * (a ^^^ 2 * y ^^^ 2 + -1 * a ^^^ 2 * b ^^^ 2)",
28.112 - str2term"b ^^^ 2 ~= 0",
28.113 - str2term"0 * b ^^^ 2 <= -1 * (a ^^^ 2 * y ^^^ 2 + -1 * a ^^^ 2 * b ^^^ 2)",
28.114 - str2term"b ^^^ 2 ~= 0"] then writeln"should be simplified MG"
28.115 + [TermC.str2term"0 * b ^^^ 2 <= -1 * (a ^^^ 2 * y ^^^ 2 + -1 * a ^^^ 2 * b ^^^ 2)",
28.116 + TermC.str2term"b ^^^ 2 ~= 0",
28.117 + TermC.str2term"0 * b ^^^ 2 <= -1 * (a ^^^ 2 * y ^^^ 2 + -1 * a ^^^ 2 * b ^^^ 2)",
28.118 + TermC.str2term"b ^^^ 2 ~= 0"] then writeln"should be simplified MG"
28.119 else error "rlang.sml: diff.behav. in Schalk I s.89 Bsp 118a(2) asms";
28.120
28.121 (*----------------- Schalk I s.102 Bsp 268(1) ------------------------*)
28.122 @@ -709,7 +709,7 @@
28.123 val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
28.124 case f of Form' (Test_Out.FormKF (~1,EdUndef,0,Nundef,"[x2 =\n (-2 * A + x1 * y2 + x3 * y1 + -1 * x1 * y3 + -1 * x3 * y2) /\n (y1 + -1 * y3)]")) => ()
28.125 | _ => error "rlang.sml: diff.behav. Schalk I s.102 Bsp 268(1) [x2=...]";
28.126 -if Ctree.get_assumptions pt p = [str2term"y1 / 2 + -1 * y3 / 2 ~= 0"] then ()
28.127 +if Ctree.get_assumptions pt p = [TermC.str2term"y1 / 2 + -1 * y3 / 2 ~= 0"] then ()
28.128 else error "rlang.sml: diff.behav. in I s.102 Bsp 268(1) asm";
28.129
28.130 (*-------------------- Schalk II ----------------------------*)
28.131 @@ -824,11 +824,11 @@
28.132 \0 <= 1 / 9]"
28.133 (*WN050916 before correction 'rewrite__set_ called with 'Rule_Set.Empty' for ..'
28.134 thus: maybe the rls for the asms is Rule_Set.Empty ??:
28.135 - [(str2term"0 <= (25 * (1 / 9) + -1 * (16 + 49 * (1 / 9))) * -56", []),
28.136 - (str2term"9 ~= 0", []),
28.137 - (str2term"0 <= (-5 + 7 * sqrt (1 / 9) + 1) * 5", []),
28.138 - (str2term"9 ~= 0", []),
28.139 - (str2term"0 <= (25 * (1 / 9) + -1 * (16 + 49 * (1 / 9))) * -56", [])]*)
28.140 + [(TermC.str2term"0 <= (25 * (1 / 9) + -1 * (16 + 49 * (1 / 9))) * -56", []),
28.141 + (TermC.str2term"9 ~= 0", []),
28.142 + (TermC.str2term"0 <= (-5 + 7 * sqrt (1 / 9) + 1) * 5", []),
28.143 + (TermC.str2term"9 ~= 0", []),
28.144 + (TermC.str2term"0 <= (25 * (1 / 9) + -1 * (16 + 49 * (1 / 9))) * -56", [])]*)
28.145 then "should get True * False!!!"
28.146 else error "rlang.sml: diff.behav. in II 68a asms";
28.147
28.148 @@ -1329,7 +1329,7 @@
28.149 a * b / (a ^^^ 2 + -1 * b ^^^ 2)"
28.150
28.151
28.152 -val t = str2term"(a + b * x) / (a + -1 * (b * x)) + -1 * (a + -1 * (b * x)) / (a + b * x) =\n4 * a * b / (a ^^^ 2 + -1 * b ^^^ 2)";
28.153 +val t = TermC.str2term"(a + b * x) / (a + -1 * (b * x)) + -1 * (a + -1 * (b * x)) / (a + b * x) =\n4 * a * b / (a ^^^ 2 + -1 * b ^^^ 2)";
28.154 Rewrite.trace_on := false;
28.155 val SOME (t',asm) = rewrite_set_ thy false norm_Rational t;
28.156 UnparseC.term t';
28.157 @@ -1496,14 +1496,14 @@
28.158 "[x = (-2 * a + 4 * b + sqrt (16 * a * b + 16 * b ^^^ 2 + 4 * a ^^^ 2)) / 4,\n x =\n (-2 * a + 4 * b + -1 * sqrt (16 * a * b + 16 * b ^^^ 2 + 4 * a ^^^ 2)) / 4]")) then writeln "simplify MG"
28.159 else error "rlang.sml: diff.behav. in II 62b [x=...]";
28.160 val asms = Ctree.get_assumptions pt p;
28.161 -if asms = [str2term"0 <= ((-2 * a + 4 * b + sqrt (16 * a * b + 16 * b ^^^ 2 + 4 * a ^^^ 2)) / 4 + a) ^^^ 2 + ((-2 * a + 4 * b + sqrt (16 * a * b + 16 * b ^^^ 2 + 4 * a ^^^ 2)) / 4 - 2 * b) ^^^ 2",
28.162 - str2term"0 <= a + 2 * b",
28.163 - str2term"8 * (-4 * a * b) <= (-4 * b + 2 * a) ^^^ 2",
28.164 - str2term"8 * (-4 * a * b) <= (-4 * b + 2 * a) ^^^ 2",
28.165 - str2term"0 <= ((-2 * a + 4 * b + -1 * sqrt (16 * a * b + 16 * b ^^^ 2 + 4 * a ^^^ 2)) / 4 + a) ^^^ 2 + ((-2 * a + 4 * b + -1 * sqrt (16 * a * b + 16 * b ^^^ 2 + 4 * a ^^^ 2)) / 4 - 2 * b) ^^^ 2",
28.166 - str2term"0 <= a + 2 * b",
28.167 - str2term"8 * (-4 * a * b) <= (-4 * b + 2 * a) ^^^ 2",
28.168 - str2term"8 * (-4 * a * b) <= (-4 * b + 2 * a) ^^^ 2"]
28.169 +if asms = [TermC.str2term"0 <= ((-2 * a + 4 * b + sqrt (16 * a * b + 16 * b ^^^ 2 + 4 * a ^^^ 2)) / 4 + a) ^^^ 2 + ((-2 * a + 4 * b + sqrt (16 * a * b + 16 * b ^^^ 2 + 4 * a ^^^ 2)) / 4 - 2 * b) ^^^ 2",
28.170 + TermC.str2term"0 <= a + 2 * b",
28.171 + TermC.str2term"8 * (-4 * a * b) <= (-4 * b + 2 * a) ^^^ 2",
28.172 + TermC.str2term"8 * (-4 * a * b) <= (-4 * b + 2 * a) ^^^ 2",
28.173 + TermC.str2term"0 <= ((-2 * a + 4 * b + -1 * sqrt (16 * a * b + 16 * b ^^^ 2 + 4 * a ^^^ 2)) / 4 + a) ^^^ 2 + ((-2 * a + 4 * b + -1 * sqrt (16 * a * b + 16 * b ^^^ 2 + 4 * a ^^^ 2)) / 4 - 2 * b) ^^^ 2",
28.174 + TermC.str2term"0 <= a + 2 * b",
28.175 + TermC.str2term"8 * (-4 * a * b) <= (-4 * b + 2 * a) ^^^ 2",
28.176 + TermC.str2term"8 * (-4 * a * b) <= (-4 * b + 2 * a) ^^^ 2"]
28.177 then writeln "should be simplified MG"
28.178 else error "rlang.sml: diff.behav. in II 62b asms";
28.179
28.180 @@ -1523,8 +1523,8 @@
28.181 (*
28.182 val f = Form' (Test_Out.FormKF (~1,EdUndef,1,Nundef,"(2 * x + 1) * x ^^^ 2 = 0"))
28.183 normiert nicht ... korr.WN:
28.184 -val t = str2term "(2*x+1)*x^^^2 = 0";
28.185 -val subst = [(str2term "bdv", str2term "x")];
28.186 +val t = TermC.str2term "(2*x+1)*x^^^2 = 0";
28.187 +val subst = [(TermC.str2term "bdv", TermC.str2term "x")];
28.188 val SOME (t',_) = rewrite_set_inst_ thy false subst make_ratpoly_in t;
28.189 if UnparseC.term t' = "x ^^^ 2 + 2 * x ^^^ 3 = 0" then ()
28.190 else error "rlang.sml: 7";
28.191 @@ -1547,7 +1547,7 @@
28.192
28.193 (*------------------------------vvv-Rewrite_Set "rat_eliminate"---------
28.194 > Rewrite.trace_on:=true;
28.195 -> val t = str2term
28.196 +> val t = TermC.str2term
28.197 "(3 + -1 * x + 1 * x ^^^ 2) / (9 * x + -6 * x ^^^ 2 + 1 * x ^^^ 3) = 1 / x";
28.198 > val SOME (t',asm) =
28.199 rewrite_ thy dummy_ord rateq_erls true rat_mult_denominator_both t;
28.200 @@ -1595,8 +1595,8 @@
28.201 then writeln"simplify result\nsimplify result\nsimplify result"
28.202 else error "rlang.sml: diff.behav. in Pythagoras";
28.203 val asms = Ctree.get_assumptions pt p;
28.204 -(*if asms = [str2term"0 <= -4 * (b ^^^ 2 / 4 + -4 * r ^^^ 2 / 4)",
28.205 - str2term"0 <= -4 * (b ^^^ 2 / 4 + -4 * r ^^^ 2 / 4)"]*)
28.206 +(*if asms = [TermC.str2term"0 <= -4 * (b ^^^ 2 / 4 + -4 * r ^^^ 2 / 4)",
28.207 + TermC.str2term"0 <= -4 * (b ^^^ 2 / 4 + -4 * r ^^^ 2 / 4)"]*)
28.208 if UnparseC.terms (*WN1104changed*) asms =
28.209 "[0 <= -4 * (b ^^^ 2 / 4 + -1 * r ^^^ 2 / 1),\
28.210 \0 <= -4 * (b ^^^ 2 / 4 + -1 * r ^^^ 2 / 1)]"
29.1 --- a/test/Tools/isac/Knowledge/root.sml Mon Apr 19 13:57:47 2021 +0200
29.2 +++ b/test/Tools/isac/Knowledge/root.sml Mon Apr 19 15:02:11 2021 +0200
29.3 @@ -15,14 +15,14 @@
29.4 "----------- rls Root_erls ------------------------------";
29.5 "----------- rls Root_erls ------------------------------";
29.6 "----------- rls Root_erls ------------------------------";
29.7 -val t = str2term "sqrt 1";
29.8 +val t = TermC.str2term "sqrt 1";
29.9 val SOME (t',_) = rewrite_set_ thy false Root_erls t;
29.10 if UnparseC.term t' = "1" then () else error "root.sml: diff.behav. sqrt 1";
29.11
29.12 -val t = str2term "sqrt (-1)";
29.13 +val t = TermC.str2term "sqrt (-1)";
29.14 val NONE = rewrite_set_ thy false Root_erls t;
29.15
29.16 -val t = str2term "sqrt 0";
29.17 +val t = TermC.str2term "sqrt 0";
29.18 val SOME (t',_) = rewrite_set_ thy false Root_erls t;
29.19 if UnparseC.term t' = "0" then () else error "root.sml: diff.behav. sqrt 1";
29.20
30.1 --- a/test/Tools/isac/Knowledge/rooteq.sml Mon Apr 19 13:57:47 2021 +0200
30.2 +++ b/test/Tools/isac/Knowledge/rooteq.sml Mon Apr 19 15:02:11 2021 +0200
30.3 @@ -22,62 +22,62 @@
30.4
30.5 (*=== inhibit exn ?=============================================================
30.6
30.7 -val t = (Thm.term_of o the o (parse RootEq.thy)) "(sqrt(2+x+3)) is_rootTerm_in x";
30.8 +val t = (Thm.term_of o the o (TermC.parse RootEq.thy)) "(sqrt(2+x+3)) is_rootTerm_in x";
30.9 val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
30.10 val result = UnparseC.term t_;
30.11 if result <> "HOL.True" then error "rooteq.sml: new behaviour:" else ();
30.12
30.13 -val t = (Thm.term_of o the o (parse RootEq.thy)) "(sqrt(2+x+3)) is_rootTerm_in x";
30.14 +val t = (Thm.term_of o the o (TermC.parse RootEq.thy)) "(sqrt(2+x+3)) is_rootTerm_in x";
30.15 val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
30.16 val result = UnparseC.term t_;
30.17 if result <> "HOL.True" then error "rooteq.sml: new behaviour:" else ();
30.18
30.19 -val t = (Thm.term_of o the o (parse RootEq.thy)) "(nroot 5 (x+4)) is_rootTerm_in x";
30.20 +val t = (Thm.term_of o the o (TermC.parse RootEq.thy)) "(nroot 5 (x+4)) is_rootTerm_in x";
30.21 val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
30.22 val result = UnparseC.term t_;
30.23 if result <> "HOL.True" then error "rooteq.sml: new behaviour:" else ();
30.24
30.25 -val t = (Thm.term_of o the o (parse RootEq.thy)) "(sqrt(2+x+3)) is_sqrtTerm_in x";
30.26 +val t = (Thm.term_of o the o (TermC.parse RootEq.thy)) "(sqrt(2+x+3)) is_sqrtTerm_in x";
30.27 val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
30.28 val result = UnparseC.term t_;
30.29 if result <> "HOL.True" then error "rooteq.sml: new behaviour:" else ();
30.30
30.31 -val t = (Thm.term_of o the o (parse RootEq.thy)) "(sqrt(25)) is_sqrtTerm_in x";
30.32 +val t = (Thm.term_of o the o (TermC.parse RootEq.thy)) "(sqrt(25)) is_sqrtTerm_in x";
30.33 val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
30.34 val result = UnparseC.term t_;
30.35 if result <> "HOL.False" then error "rooteq.sml: new behaviour:" else ();
30.36
30.37 -val t = (Thm.term_of o the o (parse RootEq.thy)) "sqrt(1 + x) is_normSqrtTerm_in x";
30.38 +val t = (Thm.term_of o the o (TermC.parse RootEq.thy)) "sqrt(1 + x) is_normSqrtTerm_in x";
30.39 val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
30.40 val result = UnparseC.term t_;
30.41 if result <> "HOL.True" then error "rooteq.sml: new behaviour:" else ();
30.42
30.43 -val t = (Thm.term_of o the o (parse RootEq.thy)) "(3+3*sqrt(x)) is_normSqrtTerm_in x";
30.44 +val t = (Thm.term_of o the o (TermC.parse RootEq.thy)) "(3+3*sqrt(x)) is_normSqrtTerm_in x";
30.45 val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
30.46 val result = UnparseC.term t_;
30.47 if result <> "HOL.True" then error "rooteq.sml: new behaviour:" else ();
30.48
30.49 -val t = (Thm.term_of o the o (parse RootEq.thy)) "(sqrt(x+1)+1) is_normSqrtTerm_in x";
30.50 +val t = (Thm.term_of o the o (TermC.parse RootEq.thy)) "(sqrt(x+1)+1) is_normSqrtTerm_in x";
30.51 val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
30.52 val result = UnparseC.term t_;
30.53 if result <> "HOL.False" then error "rooteq.sml: new behaviour:" else ();
30.54
30.55 -val t = (Thm.term_of o the o (parse RootEq.thy)) "(1 - u/(sqrt(r - u))) is_normSqrtTerm_in u";
30.56 +val t = (Thm.term_of o the o (TermC.parse RootEq.thy)) "(1 - u/(sqrt(r - u))) is_normSqrtTerm_in u";
30.57 val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
30.58 val result = UnparseC.term t_;
30.59 if result <> "HOL.False" then error "rooteq.sml: new behaviour:" else ();
30.60
30.61 -val t = (Thm.term_of o the o (parse RootEq.thy)) "(x*(1+x)/(sqrt(x+1))) is_normSqrtTerm_in x";
30.62 +val t = (Thm.term_of o the o (TermC.parse RootEq.thy)) "(x*(1+x)/(sqrt(x+1))) is_normSqrtTerm_in x";
30.63 val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
30.64 val result = UnparseC.term t_;
30.65 if result <> "HOL.True" then error "rooteq.sml: new behaviour:" else ();
30.66
30.67 -val t = (Thm.term_of o the o (parse RootEq.thy)) "(1 - (sqrt(2+x+3)^^^3)) is_normSqrtTerm_in x";
30.68 +val t = (Thm.term_of o the o (TermC.parse RootEq.thy)) "(1 - (sqrt(2+x+3)^^^3)) is_normSqrtTerm_in x";
30.69 val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
30.70 val result = UnparseC.term t_;
30.71 if result <> "HOL.False" then error "rooteq.sml: new behaviour:" else ();
30.72
30.73 -val t = (Thm.term_of o the o (parse RootEq.thy)) "(1 + (sqrt(2+x+3)^^^3)) is_normSqrtTerm_in x";
30.74 +val t = (Thm.term_of o the o (TermC.parse RootEq.thy)) "(1 + (sqrt(2+x+3)^^^3)) is_normSqrtTerm_in x";
30.75 val SOME(t_, _) = rewrite_set_ RootEq.thy false RootEq_prls t;
30.76 val result = UnparseC.term t_;
30.77 if result <> "HOL.True" then error "rooteq.sml: new behaviour:" else ();
30.78 @@ -136,7 +136,7 @@
30.79 | _ => error "rooteq.sml: diff.behav. [x = 1 / 25]";
30.80 if UnparseC.terms (*WN1104changed*) (Ctree.get_assumptions pt p) = "[0 <= 1 / 25]"
30.81 (*WN050916 before correction 'rewrite__set_ called with 'Rule_Set.Empty' for ..:
30.82 - [(str2term"25 ~= 0",[])] *)
30.83 + [(TermC.str2term"25 ~= 0",[])] *)
30.84 then writeln "should be True\n\
30.85 \should be True\n\
30.86 \should be True\n"
30.87 @@ -204,7 +204,7 @@
30.88 val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
30.89 case f of Form' (Test_Out.FormKF (~1,EdUndef,0,Nundef,"[x = 4]")) => ()
30.90 | _ => error "rooteq.sml: diff.behav. [x = 4]";
30.91 -if Ctree.get_assumptions pt p = [str2term"0 <= 12 * sqrt 2 * 4"]
30.92 +if Ctree.get_assumptions pt p = [TermC.str2term"0 <= 12 * sqrt 2 * 4"]
30.93 then writeln "should be True\nshould be True\nshould be True\n\
30.94 \should be True\nshould be True\nshould be True\n"
30.95 else error "rooteq.sml: diff.behav. with 0 <= 12 * sqrt 2 * 4";
31.1 --- a/test/Tools/isac/Knowledge/rootrat.sml Mon Apr 19 13:57:47 2021 +0200
31.2 +++ b/test/Tools/isac/Knowledge/rootrat.sml Mon Apr 19 15:02:11 2021 +0200
31.3 @@ -27,7 +27,7 @@
31.4 val ctxt = Proof_Context.init_global thy;
31.5 val ttt = (the o (parseNEW ctxt)) ("-1 * x = - (2 / 2) + sqrt ((2 / 2) ^^^ 2 - -8) |"^
31.6 "\nx = -1 * (- (2 / 2) + -1 * sqrt ((2 / 2) ^^^ 2 - -8))");
31.7 -atomty t; (*!real ?by sqrt and ^^^?*)
31.8 +TermC.atomty t; (*!real ?by sqrt and ^^^?*)
31.9
31.10 "--- val rls = calculate_Poly ---";
31.11 (*val rls = assoc_rls "calculate_Poly"; WAS ME_Isa: 'calculate_Poly' not in system
32.1 --- a/test/Tools/isac/Knowledge/rootrateq.sml Mon Apr 19 13:57:47 2021 +0200
32.2 +++ b/test/Tools/isac/Knowledge/rootrateq.sml Mon Apr 19 15:02:11 2021 +0200
32.3 @@ -27,37 +27,37 @@
32.4 "------------ tests on predicates -------------------------------";
32.5 "------------ tests on predicates -------------------------------";
32.6 "------------ tests on predicates -------------------------------";
32.7 -val t1 = (Thm.term_of o the o (parse thy)) "(-8 - sqrt(x) + x^^^2) is_rootRatAddTerm_in x";
32.8 +val t1 = (Thm.term_of o the o (TermC.parse thy)) "(-8 - sqrt(x) + x^^^2) is_rootRatAddTerm_in x";
32.9 val SOME (t,_) = rewrite_set_ @{theory "RootRatEq"} false RootRatEq_prls t1;
32.10 if (UnparseC.term t) = "False" then ()
32.11 else error "rootrateq.sml: diff.behav. 1 in is_rootRatAddTerm_in";
32.12
32.13 -val t1 = (Thm.term_of o the o (parse thy)) "(1/x) is_rootRatAddTerm_in x";
32.14 +val t1 = (Thm.term_of o the o (TermC.parse thy)) "(1/x) is_rootRatAddTerm_in x";
32.15 val SOME (t,_) = rewrite_set_ @{theory "RootRatEq"} false RootRatEq_prls t1;
32.16 if (UnparseC.term t) = "False" then ()
32.17 else error "rootrateq.sml: diff.behav. 2 in is_rootRatAddTerm_in";
32.18
32.19 -val t1 = (Thm.term_of o the o (parse thy)) "(1/sqrt(x)) is_rootRatAddTerm_in x";
32.20 +val t1 = (Thm.term_of o the o (TermC.parse thy)) "(1/sqrt(x)) is_rootRatAddTerm_in x";
32.21 val SOME (t,_) = rewrite_set_ @{theory "RootRatEq"} false RootRatEq_prls t1;
32.22 if (UnparseC.term t) = "False" then ()
32.23 else error "rootrateq.sml: diff.behav. 3 in is_rootRatAddTerm_in";
32.24
32.25 -val t1 = (Thm.term_of o the o (parse thy)) "(1/(sqrt(x)+1)) is_rootRatAddTerm_in x";
32.26 +val t1 = (Thm.term_of o the o (TermC.parse thy)) "(1/(sqrt(x)+1)) is_rootRatAddTerm_in x";
32.27 val SOME (t,_) = rewrite_set_ @{theory "RootRatEq"} false RootRatEq_prls t1;
32.28 if (UnparseC.term t) = "True" then ()
32.29 else error "rootrateq.sml: diff.behav. 4 in is_rootRatAddTerm_in";
32.30
32.31 -val t1 = (Thm.term_of o the o (parse thy)) "(3 + 1/(1+sqrt(x))) is_rootRatAddTerm_in x";
32.32 +val t1 = (Thm.term_of o the o (TermC.parse thy)) "(3 + 1/(1+sqrt(x))) is_rootRatAddTerm_in x";
32.33 val SOME (t,_) = rewrite_set_ @{theory "RootRatEq"} false RootRatEq_prls t1;
32.34 if (UnparseC.term t) = "True" then ()
32.35 else error "rootrateq.sml: diff.behav. 5 in is_rootRatAddTerm_in";
32.36
32.37 -val t1 = (Thm.term_of o the o (parse thy)) "(1/(1+sqrt(y)) + 3 + 1/(1+sqrt(x))) is_rootRatAddTerm_in x";
32.38 +val t1 = (Thm.term_of o the o (TermC.parse thy)) "(1/(1+sqrt(y)) + 3 + 1/(1+sqrt(x))) is_rootRatAddTerm_in x";
32.39 val SOME (t,_) = rewrite_set_ @{theory "RootRatEq"} false RootRatEq_prls t1;
32.40 if (UnparseC.term t) = "True" then ()
32.41 else error "rootrateq.sml: diff.behav. 6 in is_rootRatAddTerm_in";
32.42
32.43 -val t1 = (Thm.term_of o the o (parse thy)) "(1/(1+sqrt(x)) + 3 + 1/(1+sqrt(y))) is_rootRatAddTerm_in x";
32.44 +val t1 = (Thm.term_of o the o (TermC.parse thy)) "(1/(1+sqrt(x)) + 3 + 1/(1+sqrt(y))) is_rootRatAddTerm_in x";
32.45 val SOME (t,_) = rewrite_set_ @{theory "RootRatEq"} false RootRatEq_prls t1;
32.46 if (UnparseC.term t) = "True" then ()
32.47 else error "rootrateq.sml: diff.behav. 7 in is_rootRatAddTerm_in";
32.48 @@ -113,8 +113,8 @@
32.49 "check_elementwise: no set 1 = 2 + -2 * sqrt x"*)
32.50
32.51 (*---- 2nd try: we investigate the script ["RootEq", "solve_sq_root_equation"] found via pbl*)
32.52 -val t = str2term "((lhs e_e) is_sqrtTerm_in v_v) | ((rhs e_e) is_sqrtTerm_in v_v)";
32.53 -val t = str2term ("((lhs (1 = 2 * (1 + -1 * sqrt x))) is_sqrtTerm_in x) |" ^
32.54 +val t = TermC.str2term "((lhs e_e) is_sqrtTerm_in v_v) | ((rhs e_e) is_sqrtTerm_in v_v)";
32.55 +val t = TermC.str2term ("((lhs (1 = 2 * (1 + -1 * sqrt x))) is_sqrtTerm_in x) |" ^
32.56 " ((rhs (1 = 2 * (1 + -1 * sqrt x))) is_sqrtTerm_in x)");
32.57 val SOME (t, _) = rewrite_set_ thy true rooteq_srls t;
32.58 UnparseC.term t = "True | True"; (*...was same in 2002 (NOT "True"); so program seems to take
33.1 --- a/test/Tools/isac/Knowledge/system.sml Mon Apr 19 13:57:47 2021 +0200
33.2 +++ b/test/Tools/isac/Knowledge/system.sml Mon Apr 19 15:02:11 2021 +0200
33.3 @@ -19,14 +19,14 @@
33.4 "----------- normalise system ------------------------------------";
33.5 "----------- normalise system ------------------------------------";
33.6 "----------- normalise system ------------------------------------";
33.7 -val t = str2term "[0 = c*0 + -1*q_0*(0^^^2 / 2) + c_2,\
33.8 +val t = TermC.str2term "[0 = c*0 + -1*q_0*(0^^^2 / 2) + c_2,\
33.9 \ 0 = c*L + -1*q_0*(L^^^2 / 2) + c_2]";
33.10 val SOME (t,_) = rewrite_set_ thy false norm_Poly t;
33.11 if UnparseC.term t =
33.12 "[0 = -1 * q_0 * (0 / 2) + c_2, 0 = L * c + -1 * q_0 * (L ^^^ 2 / 2) + c_2]"
33.13 then () else error "system.sml, diff.behav. in norm_Poly";
33.14
33.15 -val t = str2term "[0 = c*0 + -1*q_0*(0^^^2 / 2) + c_2,\
33.16 +val t = TermC.str2term "[0 = c*0 + -1*q_0*(0^^^2 / 2) + c_2,\
33.17 \ 0 = c*L + -1*q_0*(L^^^2 / 2) + c_2]";
33.18 val SOME (t,_) = rewrite_set_ thy false norm_Rational t;
33.19 if UnparseC.term t =
33.20 @@ -34,7 +34,7 @@
33.21 then () else error "system.sml, diff.behav. in norm_Rational";
33.22
33.23
33.24 -val t = str2term "nth_ 1 [0 = c*0 + -1*q_0*(0^^^2 / 2) + c_2,\
33.25 +val t = TermC.str2term "nth_ 1 [0 = c*0 + -1*q_0*(0^^^2 / 2) + c_2,\
33.26 \ 0 = c*L + -1*q_0*(L^^^2 / 2) + c_2]";
33.27 val SOME (t,_) = rewrite_set_ thy false prog_expr t;
33.28 if UnparseC.term t = "0 = c * 0 + -1 * q_0 * (0 ^^^ 2 / 2) + c_2"
34.1 --- a/test/Tools/isac/Knowledge/wn.sml Mon Apr 19 13:57:47 2021 +0200
34.2 +++ b/test/Tools/isac/Knowledge/wn.sml Mon Apr 19 15:02:11 2021 +0200
34.3 @@ -4,8 +4,8 @@
34.4 various test dependent on IsacKnowledge/ outside Test.thy, Test.ML*)
34.5
34.6
34.7 - val t = str2term "solve (a*x + b = c, x)";
34.8 - atomty t;
34.9 + val t = TermC.str2term "solve (a*x + b = c, x)";
34.10 + TermC.atomty t;
34.11 (*
34.12 "\n*** -------------"
34.13 "\n*** Const ( Equation.solve, bool * real => bool list)"
35.1 --- a/test/Tools/isac/MathEngBasic/ctree.sml Mon Apr 19 13:57:47 2021 +0200
35.2 +++ b/test/Tools/isac/MathEngBasic/ctree.sml Mon Apr 19 15:02:11 2021 +0200
35.3 @@ -101,7 +101,7 @@
35.4 "ctree.sml-------------- cut_tree new (from ctree above)----------";
35.5 val (pt', cuts) = cut_tree pt ([1],Frm);
35.6 "ctree.sml-------------- cappend on complete ctree from above ----";
35.7 -val (pt', cuts) = cappend_form pt [1] (Istate.empty, ContextC.empty) (str2term "Inform[1]");
35.8 +val (pt', cuts) = cappend_form pt [1] (Istate.empty, ContextC.empty) (TermC.str2term "Inform[1]");
35.9 "----------------------------------------------------------------/";
35.10
35.11 val (p,_,f,nxt,_,pt) = me nxt p [1] pt(*cappend_form: pos =[1]*);
35.12 @@ -417,7 +417,7 @@
35.13 "-------------- cappend (from ctree above)------------------------";
35.14 "-------------- cappend (from ctree above)------------------------";
35.15 "-------------- cappend (from ctree above)------------------------";
35.16 -val (pt',cuts) = cappend_form pt [3,2,1] Istate.empty (str2term "newnew");
35.17 +val (pt',cuts) = cappend_form pt [3,2,1] Istate.empty (TermC.str2term "newnew");
35.18 if cuts = [([3, 2, 1], Res),
35.19 ([3, 2, 2], Res),
35.20 ([3, 2], Res),
35.21 @@ -430,8 +430,8 @@
35.22 UnparseC.term (fst (get_obj g_result pt' [3,2,1])) = "??.empty"
35.23 then () else error "ctree.sml: diff:behav. in cappend 1";
35.24
35.25 -val (pt',cuts) = cappend_atomic pt [3,2,1] Istate.empty (str2term "newform")
35.26 - (Tac "test") (str2term "newresult",[]) Complete;
35.27 +val (pt',cuts) = cappend_atomic pt [3,2,1] Istate.empty (TermC.str2term "newform")
35.28 + (Tac "test") (TermC.str2term "newresult",[]) Complete;
35.29 if cuts = [([3, 2, 1], Res), (*?????????????*)
35.30 ([3, 2, 2], Res),
35.31 ([3, 2], Res),
35.32 @@ -469,7 +469,7 @@
35.33
35.34 (*val (p,_,f,nxt,_,pt) = me nxt p [1] pt(**)cappend_form: pos =[1]*);
35.35 val p = ([1], Frm);
35.36 -val (pt,cuts) = cappend_form pt (fst p) Istate.empty (str2term "x + 1 = 2");
35.37 +val (pt,cuts) = cappend_form pt (fst p) Istate.empty (TermC.str2term "x + 1 = 2");
35.38 val form = get_obj g_form pt (fst p);
35.39 val (res,_) = get_obj g_result pt (fst p);
35.40 if UnparseC.term form = "x + 1 = 2" andalso res = TermC.empty then () else
35.41 @@ -480,8 +480,8 @@
35.42 (*val (p,_,f,nxt,_,pt) = me nxt p [1] pt(**)cappend_atomic: pos =[1]*);
35.43 val p = ([1], Res);
35.44 val (pt,cuts) =
35.45 - cappend_atomic pt (fst p) Istate.empty (str2term "x + 1 = 2")
35.46 - Empty_Tac (str2term "x + 1 + -1 * 2 = 0",[]) Incomplete;
35.47 + cappend_atomic pt (fst p) Istate.empty (TermC.str2term "x + 1 = 2")
35.48 + Empty_Tac (TermC.str2term "x + 1 + -1 * 2 = 0",[]) Incomplete;
35.49 val form = get_obj g_form pt (fst p);
35.50 val (res,_) = get_obj g_result pt (fst p);
35.51 if UnparseC.term form = "x + 1 = 2" andalso UnparseC.term res = "x + 1 + -1 * 2 = 0"
35.52 @@ -492,8 +492,8 @@
35.53 (*val (p,_,f,nxt,_,pt) = me nxt p [1] pt(**)cappend_atomic: pos =[2]*);
35.54 val p = ([2], Res);
35.55 val (pt,cuts) =
35.56 - cappend_atomic pt (fst p) Istate.empty (str2term "x + 1 + -1 * 2 = 0")
35.57 - Empty_Tac (str2term "-1 + x = 0",[]) Incomplete;
35.58 + cappend_atomic pt (fst p) Istate.empty (TermC.str2term "x + 1 + -1 * 2 = 0")
35.59 + Empty_Tac (TermC.str2term "-1 + x = 0",[]) Incomplete;
35.60 val form = get_obj g_form pt (fst p);
35.61 val (res,_) = get_obj g_result pt (fst p);
35.62 if UnparseC.term form = "x + 1 + -1 * 2 = 0" andalso UnparseC.term res = "-1 + x = 0"
35.63 @@ -514,7 +514,7 @@
35.64
35.65 (*val (p,_,f,nxt,_,pt) = me nxt p [1] pt(**)cappend_form: pos =[3,1]*);
35.66 val p = ([3, 1], Frm);
35.67 -val (pt,cuts) = cappend_form pt (fst p) Istate.empty (str2term "-1 + x = 0");
35.68 +val (pt,cuts) = cappend_form pt (fst p) Istate.empty (TermC.str2term "-1 + x = 0");
35.69 val form = get_obj g_form pt (fst p);
35.70 val (res,_) = get_obj g_result pt (fst p);
35.71 if UnparseC.term form = "-1 + x = 0" andalso res = TermC.empty then () else
35.72 @@ -525,8 +525,8 @@
35.73 (*val (p,_,f,nxt,_,pt) = me nxt p [1] pt;(**)cappend_atomic: pos =[3,1]*)
35.74 val p = ([3, 1], Res);
35.75 val (pt,cuts) =
35.76 - cappend_atomic pt (fst p) Istate.empty (str2term "-1 + x = 0")
35.77 - Empty_Tac (str2term "x = 0 + -1 * -1",[]) Incomplete;
35.78 + cappend_atomic pt (fst p) Istate.empty (TermC.str2term "-1 + x = 0")
35.79 + Empty_Tac (TermC.str2term "x = 0 + -1 * -1",[]) Incomplete;
35.80 val form = get_obj g_form pt (fst p);
35.81 val (res,_) = get_obj g_result pt (fst p);
35.82 if UnparseC.term form = "-1 + x = 0" andalso UnparseC.term res = "x = 0 + -1 * -1" then()
35.83 @@ -1158,8 +1158,8 @@
35.84 "---(2) on S(606)..S(608)--------";
35.85 (*========== inhibit exn AK110726 ==============================================
35.86 (* ERROR: Can't unify istate to istate * Proof.context *)
35.87 -val (pt', cuts) = cappend_atomic pt [1] Istate.empty (str2term "Inform[1]")
35.88 - (Tac "test") (str2term "Inres[1]",[]) Complete;
35.89 +val (pt', cuts) = cappend_atomic pt [1] Istate.empty (TermC.str2term "Inform[1]")
35.90 + (Tac "test") (TermC.str2term "Inres[1]",[]) Complete;
35.91
35.92 (*default_print_depth 99;*)
35.93 cuts;
35.94 @@ -1180,8 +1180,8 @@
35.95 Test_Tool.show_pt pt';
35.96 "---(3) on S(606)..S(608)--------";
35.97 Test_Tool.show_pt pt;
35.98 -val (pt', cuts) = cappend_atomic pt [2] Istate.empty (str2term "Inform[2]")
35.99 - (Tac "test") (str2term "Inres[2]",[]) Complete;
35.100 +val (pt', cuts) = cappend_atomic pt [2] Istate.empty (TermC.str2term "Inform[2]")
35.101 + (Tac "test") (TermC.str2term "Inres[2]",[]) Complete;
35.102 (*default_print_depth 99;*)
35.103 cuts;
35.104 (*default_print_depth 3;*)
35.105 @@ -1218,7 +1218,7 @@
35.106
35.107 "---(4) on S(606)..S(608)--------";
35.108 val (pt', cuts) = cappend_problem pt [3] Istate.empty ([],References.empty)
35.109 - ([],References.empty, str2term "Inhead[3]", ContextC.empty);
35.110 + ([],References.empty, TermC.str2term "Inhead[3]", ContextC.empty);
35.111 (*default_print_depth 99;*)
35.112 cuts;
35.113 (*default_print_depth 3;*)
35.114 @@ -1243,8 +1243,8 @@
35.115 *)
35.116
35.117 "---(6-1) on S(606)..S(608)--------";
35.118 -val (pt', cuts) = cappend_atomic pt [3,1] Istate.empty (str2term "Inform[3,1]")
35.119 - (Tac "test") (str2term "Inres[3,1]",[]) Complete;
35.120 +val (pt', cuts) = cappend_atomic pt [3,1] Istate.empty (TermC.str2term "Inform[3,1]")
35.121 + (Tac "test") (TermC.str2term "Inres[3,1]",[]) Complete;
35.122 (*default_print_depth 99;*)
35.123 cuts;
35.124 (*default_print_depth 3;*)
35.125 @@ -1269,8 +1269,8 @@
35.126 error "ctree.sml: diff:behav. in complete pt: append_atomic[3,1] Inform";
35.127
35.128 "---(6) on S(606)..S(608)--------";
35.129 -val (pt', cuts) = cappend_atomic pt [3,2] Istate.empty (str2term "Inform[3,2]")
35.130 - (Tac "test") (str2term "Inres[3,2]",[]) Complete;
35.131 +val (pt', cuts) = cappend_atomic pt [3,2] Istate.empty (TermC.str2term "Inform[3,2]")
35.132 + (Tac "test") (TermC.str2term "Inres[3,2]",[]) Complete;
35.133 (*default_print_depth 99;*)
35.134 cuts;
35.135 (*default_print_depth 3;*)
35.136 @@ -1294,8 +1294,8 @@
35.137
35.138 "---(6++) on S(606)..S(608)--------";
35.139 (**)
35.140 -val (pt', cuts) = cappend_atomic pt [3,2,1] Istate.empty (str2term "Inform[3,2,1]")
35.141 - (Tac "test") (str2term "Inres[3,2,1]",[]) Complete;
35.142 +val (pt', cuts) = cappend_atomic pt [3,2,1] Istate.empty (TermC.str2term "Inform[3,2,1]")
35.143 + (Tac "test") (TermC.str2term "Inres[3,2,1]",[]) Complete;
35.144 (*default_print_depth 99;*)
35.145 cuts;
35.146 (*default_print_depth 1;*)
36.1 --- a/test/Tools/isac/MathEngBasic/mstools.sml Mon Apr 19 13:57:47 2021 +0200
36.2 +++ b/test/Tools/isac/MathEngBasic/mstools.sml Mon Apr 19 15:02:11 2021 +0200
36.3 @@ -20,56 +20,56 @@
36.4 "----------- fun Input_Descript.join -- fun Input_Descript.split -------------------------------";
36.5 "----------- fun Input_Descript.join -- fun Input_Descript.split -------------------------------";
36.6 "----------- fun Input_Descript.join -- fun Input_Descript.split -------------------------------";
36.7 -(*val t = str2term "maximum A";
36.8 +(*val t = TermC.str2term "maximum A";
36.9 > val (d,ts) = Input_Descript.split thy t; Input_Descript.join thy (d,ts);
36.10 val it = "maximum A" : cterm
36.11 -> val t = str2term "fixedValues [r=Arbfix]";
36.12 +> val t = TermC.str2term "fixedValues [r=Arbfix]";
36.13 > val (d,ts) = Input_Descript.split thy t; Input_Descript.join thy (d,ts);
36.14 "fixedValues [r = Arbfix]"
36.15 -> val t = str2term "valuesFor [a]";
36.16 +> val t = TermC.str2term "valuesFor [a]";
36.17 > val (d,ts) = Input_Descript.split thy t; Input_Descript.join thy (d,ts);
36.18 "valuesFor [a]"
36.19 -> val t = str2term "valuesFor [a,b]";
36.20 +> val t = TermC.str2term "valuesFor [a,b]";
36.21 > val (d,ts) = Input_Descript.split thy t; Input_Descript.join thy (d,ts);
36.22 "valuesFor [a, b]"
36.23 -> val t = str2term "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]";
36.24 +> val t = TermC.str2term "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]";
36.25 > val (d,ts) = Input_Descript.split thy t; Input_Descript.join thy (d,ts);
36.26 relations [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]"
36.27 -> val t = str2term "boundVariable a";
36.28 +> val t = TermC.str2term "boundVariable a";
36.29 > val (d,ts) = Input_Descript.split thy t; Input_Descript.join thy (d,ts);
36.30 "boundVariable a"
36.31 -> val t = str2term "interval {x::real. 0 <= x & x <= 2*r}";
36.32 +> val t = TermC.str2term "interval {x::real. 0 <= x & x <= 2*r}";
36.33 > val (d,ts) = Input_Descript.split thy t; Input_Descript.join thy (d,ts);
36.34 "interval {x. 0 <= x & x <= 2 * r}"
36.35
36.36 -> val t = str2term "equality (sqrt(9+4*x)=sqrt x + sqrt(5+x))";
36.37 +> val t = TermC.str2term "equality (sqrt(9+4*x)=sqrt x + sqrt(5+x))";
36.38 > val (d,ts) = Input_Descript.split thy t; Input_Descript.join thy (d,ts);
36.39 "equality (sqrt (9 + 4 * x) = sqrt x + sqrt (5 + x))"
36.40 -> val t = str2term "solveFor x";
36.41 +> val t = TermC.str2term "solveFor x";
36.42 > val (d,ts) = Input_Descript.split thy t; Input_Descript.join thy (d,ts);
36.43 "solveFor x"
36.44 -> val t = str2term "errorBound (eps=0)";
36.45 +> val t = TermC.str2term "errorBound (eps=0)";
36.46 > val (d,ts) = Input_Descript.split thy t; Input_Descript.join thy (d,ts);
36.47 "errorBound (eps = 0)"
36.48 -> val t = str2term "solutions L";
36.49 +> val t = TermC.str2term "solutions L";
36.50 > val (d,ts) = Input_Descript.split thy t; Input_Descript.join thy (d,ts);
36.51 "solutions L"
36.52
36.53 before 6.5.03:
36.54 -> val t = (Thm.term_of o the o (parse thy)) "testdscforlist [#1]";
36.55 +> val t = (Thm.term_of o the o (TermC.parse thy)) "testdscforlist [#1]";
36.56 > val (d,ts) = Input_Descript.split t;
36.57 > Input_Descript.join thy (d,ts);
36.58 val it = "testdscforlist [#1]" : cterm
36.59
36.60 -> val t = (Thm.term_of o the o (parse thy)) "(A::real)";
36.61 +> val t = (Thm.term_of o the o (TermC.parse thy)) "(A::real)";
36.62 > val (d,ts) = Input_Descript.split t;
36.63 val d = Const ("empty", "empty") : term
36.64 val ts = [Free ("A", "RealDef.real")] : term list
36.65 -> val t = (Thm.term_of o the o (parse thy)) "[R=(R::real)]";
36.66 +> val t = (Thm.term_of o the o (TermC.parse thy)) "[R=(R::real)]";
36.67 > val (d,ts) = Input_Descript.split t;
36.68 val d = Const ("empty", "empty") : term
36.69 val ts = [Const # $ Free # $ Free (#,#)] : term list
36.70 -> val t = (Thm.term_of o the o (parse thy)) "[#1,#2]";
36.71 +> val t = (Thm.term_of o the o (TermC.parse thy)) "[#1,#2]";
36.72 > val (d,ts) = Input_Descript.split t;
36.73 val ts = [Free ("#1", "'a"),Free ("#2", "'a")] : NOT WANTED
36.74 *)
36.75 @@ -77,13 +77,13 @@
36.76 "----------- type penv -------------------------------------------------------------------------";
36.77 "----------- type penv -------------------------------------------------------------------------";
36.78 (*
36.79 - val e_ = (Thm.term_of o the o (parse thy)) "e_::bool";
36.80 - val ev = (Thm.term_of o the o (parse thy)) "#4 + #3 * x^^^#2 = #0";
36.81 - val v_ = (Thm.term_of o the o (parse thy)) "v_";
36.82 - val vv = (Thm.term_of o the o (parse thy)) "x";
36.83 - val r_ = (Thm.term_of o the o (parse thy)) "err_::bool";
36.84 - val rv1 = (Thm.term_of o the o (parse thy)) "#0";
36.85 - val rv2 = (Thm.term_of o the o (parse thy)) "eps";
36.86 + val e_ = (Thm.term_of o the o (TermC.parse thy)) "e_::bool";
36.87 + val ev = (Thm.term_of o the o (TermC.parse thy)) "#4 + #3 * x^^^#2 = #0";
36.88 + val v_ = (Thm.term_of o the o (TermC.parse thy)) "v_";
36.89 + val vv = (Thm.term_of o the o (TermC.parse thy)) "x";
36.90 + val r_ = (Thm.term_of o the o (TermC.parse thy)) "err_::bool";
36.91 + val rv1 = (Thm.term_of o the o (TermC.parse thy)) "#0";
36.92 + val rv2 = (Thm.term_of o the o (TermC.parse thy)) "eps";
36.93
36.94 val penv = [(e_,[ev]),(v_,[vv]),(r_,[rv2,rv2])]:penv;
36.95 map getval penv;
36.96 @@ -105,30 +105,30 @@
36.97 "----------- fun pbl_ids -----------------------------------------------------------------------";
36.98 "----------- fun pbl_ids -----------------------------------------------------------------------";
36.99 (*
36.100 -val t as t1 $ t2 = str2term "antiDerivativeName M_b";
36.101 +val t as t1 $ t2 = TermC.str2term "antiDerivativeName M_b";
36.102 pbl_ids ctxt t1 t2;
36.103
36.104 - val t = (Thm.term_of o the o (parse thy)) "fixedValues [r=Arbfix]";
36.105 + val t = (Thm.term_of o the o (TermC.parse thy)) "fixedValues [r=Arbfix]";
36.106 val (d,argl) = strip_comb t;
36.107 Input_Descript.is_a d; (*see Input_Descript.split*)
36.108 dest_list (d,argl);
36.109 val (_ $ v) = t;
36.110 - is_list v;
36.111 + TermC.is_list v;
36.112 pbl_ids ctxt d v;
36.113 [Const ("List.list.Cons", "[bool, bool List.list] => bool List.list") $
36.114 (Const # $ Free # $ Const (#,#)) $ Const ("List.list.Nil", "bool List..
36.115
36.116 - val (dsc,vl) = (Input_Descript.split o Thm.term_of o the o (parse thy)) "solveFor x";
36.117 + val (dsc,vl) = (Input_Descript.split o Thm.term_of o the o (TermC.parse thy)) "solveFor x";
36.118 val dsc = Const ("Input_Descript.solveFor", "RealDef.real => Tools.una") : term
36.119 val vl = Free ("x", "RealDef.real") : term
36.120
36.121 - val (dsc,id) = (split_did o Thm.term_of o the o (parse thy)) "solveFor v_";
36.122 + val (dsc,id) = (split_did o Thm.term_of o the o (TermC.parse thy)) "solveFor v_";
36.123 pbl_ids ctxt dsc vl;
36.124 val it = [Free ("x", "RealDef.real")] : term list
36.125
36.126 - val (dsc,vl) = (Input_Descript.split o Thm.term_of o the o(parse thy))
36.127 + val (dsc,vl) = (Input_Descript.split o Thm.term_of o the o(TermC.parse thy))
36.128 "errorBound (eps=#0)";
36.129 - val (dsc,id) = (split_did o Thm.term_of o the o(parse thy)) "errorBound err_";
36.130 + val (dsc,id) = (split_did o Thm.term_of o the o(TermC.parse thy)) "errorBound err_";
36.131 pbl_ids ctxt dsc vl;
36.132 val it = [Free ("#0", "RealDef.real"),Free ("eps", "RealDef.real")] : term list *)
36.133 "----------- fun upd_penv ----------------------------------------------------------------------";
36.134 @@ -136,15 +136,15 @@
36.135 "----------- fun upd_penv ----------------------------------------------------------------------";
36.136 (*
36.137 val penv = [];
36.138 - val (dsc,vl) = (split_did o Thm.term_of o the o (parse thy)) "solveFor x";
36.139 - val (dsc,id) = (split_did o Thm.term_of o the o (parse thy)) "solveFor v_";
36.140 + val (dsc,vl) = (split_did o Thm.term_of o the o (TermC.parse thy)) "solveFor x";
36.141 + val (dsc,id) = (split_did o Thm.term_of o the o (TermC.parse thy)) "solveFor v_";
36.142 val penv = upd_penv thy penv dsc (id, vl);
36.143 [(Free ("v_", "RealDef.real"),
36.144 [Const (#,#) $ Free (#,#) $ Free ("#0", "RealDef.real")])]
36.145 : (term * term list) list
36.146
36.147 - val (dsc,vl) = (split_did o Thm.term_of o the o(parse thy))"errorBound (eps=#0)";
36.148 - val (dsc,id) = (split_did o Thm.term_of o the o(parse thy))"errorBound err_";
36.149 + val (dsc,vl) = (split_did o Thm.term_of o the o(TermC.parse thy))"errorBound (eps=#0)";
36.150 + val (dsc,id) = (split_did o Thm.term_of o the o(TermC.parse thy))"errorBound err_";
36.151 upd_penv thy penv dsc (id, vl);
36.152 [(Free ("v_", "RealDef.real"),
36.153 [Const (#,#) $ Free (#,#) $ Free ("#0", "RealDef.real")]),
36.154 @@ -158,8 +158,8 @@
36.155 (*
36.156 val i = 2;
36.157 val envv = [(1,[]:penv),(2,[]:penv),(3,[]:penv)]:envv;
36.158 - val (dsc,vl) = (split_did o Thm.term_of o the o(parse thy))"boundVariable b";
36.159 - val (dsc,id) = (split_did o Thm.term_of o the o(parse thy))"boundVariable v_";
36.160 + val (dsc,vl) = (split_did o Thm.term_of o the o(TermC.parse thy))"boundVariable b";
36.161 + val (dsc,id) = (split_did o Thm.term_of o the o(TermC.parse thy))"boundVariable v_";
36.162 upd thy envv dsc (id, vl) i;
36.163 val it = (2,[(Free ("v_", "RealDef.real"),[Free ("b", "RealDef.real")])])
36.164 : int * (term * term list) list*)
37.1 --- a/test/Tools/isac/MathEngBasic/rewrite.sml Mon Apr 19 13:57:47 2021 +0200
37.2 +++ b/test/Tools/isac/MathEngBasic/rewrite.sml Mon Apr 19 15:02:11 2021 +0200
37.3 @@ -34,10 +34,10 @@
37.4 val thy = @{theory Complex_Main};
37.5 val ctxt = @{context};
37.6 val thm = @{thm add.commute};
37.7 -val t = (Thm.term_of o the) (parse thy "((r + u) + t) + s");
37.8 +val t = (Thm.term_of o the) (TermC.parse thy "((r + u) + t) + s");
37.9 "----- from old: fun rewrite__";
37.10 val bdv = [];
37.11 -val r = inst_bdv bdv (norm (Thm.prop_of thm));
37.12 +val r = TermC.inst_bdv bdv (Eval.norm (Thm.prop_of thm));
37.13 "----- from old: and rew_sub";
37.14 val (LHS,RHS) = (dest_equals o strip_trueprop
37.15 o Logic.strip_imp_concl) r;
37.16 @@ -196,8 +196,8 @@
37.17 "----------- step through 'fun rewrite_terms_' ---------";
37.18 "----- step 0: args for rewrite_terms_, local fun";
37.19 val (thy, ord, erls, equs, t) =
37.20 - (@{theory "Biegelinie"}, dummy_ord, Rule_Set.Empty, [str2term "x = 0"],
37.21 - str2term "M_b x = -1 * q_0 * x ^^^ 2 / 2 + x * c + c_2");
37.22 + (@{theory "Biegelinie"}, dummy_ord, Rule_Set.Empty, [TermC.str2term "x = 0"],
37.23 + TermC.str2term "M_b x = -1 * q_0 * x ^^^ 2 / 2 + x * c + c_2");
37.24 "----- step 1: args for rew_";
37.25 val ((t', asm'), (rules as r::rs), t) = ((TermC.empty, []), equs, t);
37.26 "----- step 2: rew_sub";
37.27 @@ -210,15 +210,15 @@
37.28 if UnparseC.term t' = "M_b 0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2" then ()
37.29 else error "rewrite.sml rewrite_terms_ [x = 0]";
37.30
37.31 -val equs = [str2term "M_b 0 = 0"];
37.32 -val t = str2term "M_b 0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2";
37.33 +val equs = [TermC.str2term "M_b 0 = 0"];
37.34 +val t = TermC.str2term "M_b 0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2";
37.35 val SOME (t', _) = rewrite_terms_ thy dummy_ord Rule_Set.Empty equs t;
37.36 writeln "----------- rewrite_terms_ 2---------------------------";
37.37 if UnparseC.term t' = "0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2" then ()
37.38 else error "rewrite.sml rewrite_terms_ [M_b 0 = 0]";
37.39
37.40 -val equs = [str2term "x = 0", str2term"M_b 0 = 0"];
37.41 -val t = str2term "M_b x = -1 * q_0 * x ^^^ 2 / 2 + x * c + c_2";
37.42 +val equs = [TermC.str2term "x = 0", TermC.str2term"M_b 0 = 0"];
37.43 +val t = TermC.str2term "M_b x = -1 * q_0 * x ^^^ 2 / 2 + x * c + c_2";
37.44 val SOME (t', _) = rewrite_terms_ thy dummy_ord Rule_Set.Empty equs t;
37.45 writeln "----------- rewrite_terms_ 3---------------------------";
37.46 if UnparseC.term t' = "0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2" then ()
37.47 @@ -229,11 +229,11 @@
37.48 "----------- rewrite_inst_ bdvs -------------------------";
37.49 "----------- rewrite_inst_ bdvs -------------------------";
37.50 (*see smltest/Scripts/term_G.sml: inst_bdv 2*)
37.51 -val t = str2term"-1 * (q_0 * L ^^^ 2) / 2 + (L * c_3 + c_4) = 0";
37.52 -val bdvs = [(str2term"bdv_1",str2term"c"),
37.53 - (str2term"bdv_2",str2term"c_2"),
37.54 - (str2term"bdv_3",str2term"c_3"),
37.55 - (str2term"bdv_4",str2term"c_4")];
37.56 +val t = TermC.str2term"-1 * (q_0 * L ^^^ 2) / 2 + (L * c_3 + c_4) = 0";
37.57 +val bdvs = [(TermC.str2term"bdv_1",TermC.str2term"c"),
37.58 + (TermC.str2term"bdv_2",TermC.str2term"c_2"),
37.59 + (TermC.str2term"bdv_3",TermC.str2term"c_3"),
37.60 + (TermC.str2term"bdv_4",TermC.str2term"c_4")];
37.61 (*------------ outcommented WN071210, after inclusion into ROOT.ML
37.62 val SOME (t,_) =
37.63 rewrite_inst_ thy e_rew_ord
37.64 @@ -346,9 +346,9 @@
37.65 "----------- compare all prepat's existing 2010 ---------";
37.66 val thy = @{theory "Isac_Knowledge"};
37.67 val t = @{term "a + b * x = (0 ::real)"};
37.68 -val pat = parse_patt thy "?l = (?r ::real)";
37.69 -val precond = parse_patt thy "is_polynomial (?l::real)";(*no infix def*)
37.70 -val precond = parse_patt thy "(?l::real) is_expanded";
37.71 +val pat = TermC.parse_patt thy "?l = (?r ::real)";
37.72 +val precond = TermC.parse_patt thy "is_polynomial (?l::real)";(*no infix def*)
37.73 +val precond = TermC.parse_patt thy "(?l::real) is_expanded";
37.74
37.75 val inst = Pattern.match thy (pat, t) (Vartab.empty, Vartab.empty);
37.76 val preinst = Envir.subst_term inst precond;
37.77 @@ -359,9 +359,9 @@
37.78 (or not: hen the Rrls not applied);
37.79 if pre1 and pre2 evaluate to @{term True} in this environment,
37.80 then the Rrls is applied. *)
37.81 -val t = str2term "(a + b) / c ::real";
37.82 -val pat = parse_patt thy "?r / ?s ::real";
37.83 -val pres = [parse_patt thy "?r is_expanded", parse_patt thy "?s is_expanded"];
37.84 +val t = TermC.str2term "(a + b) / c ::real";
37.85 +val pat = TermC.parse_patt thy "?r / ?s ::real";
37.86 +val pres = [TermC.parse_patt thy "?r is_expanded", TermC.parse_patt thy "?s is_expanded"];
37.87 val prepat = [(pres, pat)];
37.88 val erls = rational_erls;
37.89 (* erls got from Rrls {erls, prepat, scr = Rfuns {normal_form, ...}, ...} *)
37.90 @@ -374,10 +374,10 @@
37.91 then () else error "rewrite.sml: prepat cancel eval__true";
37.92
37.93 "===== Rational.thy: add_fractions_p ===";
37.94 -(* if each pat* matches with the current term, the Rrls is applied
37.95 +(* if each pat* TermC.matches with the current term, the Rrls is applied
37.96 (there are no preconditions to be checked, they are @{term True}) *)
37.97 -val t = str2term "a / b + 1 / 2";
37.98 -val pat = parse_patt thy "?r / ?s + ?u / ?v";
37.99 +val t = TermC.str2term "a / b + 1 / 2";
37.100 +val pat = TermC.parse_patt thy "?r / ?s + ?u / ?v";
37.101 val pres = [@{term True}];
37.102 val prepat = [(pres, pat)];
37.103 val erls = rational_erls;
37.104 @@ -390,9 +390,9 @@
37.105 "===== Poly.thy: order_mult_ ===";
37.106 (* ?p matched with the current term gives an environment,
37.107 which evaluates (the instantiated) "p is_multUnordered" to true*)
37.108 -val t = str2term "x^^^2 * x";
37.109 -val pat = parse_patt thy "?p :: real"
37.110 -val pres = [parse_patt thy "?p is_multUnordered"];
37.111 +val t = TermC.str2term "x^^^2 * x";
37.112 +val pat = TermC.parse_patt thy "?p :: real"
37.113 +val pres = [TermC.parse_patt thy "?p is_multUnordered"];
37.114 val prepat = [(pres, pat)];
37.115 val erls = Rule_Set.append_rules "Rule_Set.empty-is_multUnordered" Rule_Set.empty
37.116 [Eval ("Poly.is'_multUnordered",
37.117 @@ -409,10 +409,10 @@
37.118 "----------- fun app_rev, Rrls, -------------------------";
37.119 "----------- fun app_rev, Rrls, -------------------------";
37.120 "----------- fun app_rev, Rrls, -------------------------";
37.121 -val t = str2term "x^^^2 * x";
37.122 +val t = TermC.str2term "x^^^2 * x";
37.123
37.124 if is_multUnordered t then () else error "rewrite.sml diff. is_multUnordered 2";
37.125 -val tm = str2term "(x^^^2 * x) is_multUnordered";
37.126 +val tm = TermC.str2term "(x^^^2 * x) is_multUnordered";
37.127 eval_is_multUnordered "testid" "" tm thy;
37.128
37.129 case eval_is_multUnordered "testid" "" tm thy of
37.130 @@ -479,7 +479,7 @@
37.131 tracing "=== poly.sml: scan_ chk prepat end";
37.132
37.133 "----- chk ---";
37.134 -(*reestablish...*) val t = str2term "x ^^^ 2 * x";
37.135 +(*reestablish...*) val t = TermC.str2term "x ^^^ 2 * x";
37.136 val [(pres, pat)] = prepat;
37.137 val subst: Type.tyenv * Envir.tenv =
37.138 Pattern.match thy (pat, t)
37.139 @@ -491,7 +491,7 @@
37.140 if UnparseC.terms asms = "[\"x ^^^ 2 * x is_multUnordered\"]" then ()
37.141 else error "rewrite.sml: diff. is_multUnordered, asms";
37.142 val (thy, i, asms, bdv, rls) =
37.143 - (thy, (i+1), [str2term "(x^^^2 * x) is_multUnordered"],
37.144 + (thy, (i+1), [TermC.str2term "(x^^^2 * x) is_multUnordered"],
37.145 [] : (term * term) list, erls);
37.146 case eval__true thy i asms bdv rls of
37.147 ([], true) => ()
37.148 @@ -502,12 +502,12 @@
37.149 "----------- 2011 thms with axclasses -------------------";
37.150 val thm = ThmC.numerals_to_Free @{thm div_by_1};
37.151 val prop = Thm.prop_of thm;
37.152 -atomty prop; (*Type 'a*)
37.153 -val t = str2term "(2*x)/1"; (*Type real*)
37.154 +TermC.atomty prop; (*Type 'a*)
37.155 +val t = TermC.str2term "(2*x)/1"; (*Type real*)
37.156
37.157 val (thy, ro, er, inst) =
37.158 (@{theory "Isac_Knowledge"}, tless_true, eval_rls, [(@{term "bdv::real"}, @{term "x::real"})]);
37.159 -val SOME (t, _) = rewrite_ thy ro er true thm t; (*real matches 'a ?via ring? etc*)
37.160 +val SOME (t, _) = rewrite_ thy ro er true thm t; (*real TermC.matches 'a ?via ring? etc*)
37.161
37.162 "----------- fun rewrite_set_ .. RatEq_eliminate step into to fun chk --------------------------";
37.163 "----------- fun rewrite_set_ .. RatEq_eliminate step into to fun chk --------------------------";
37.164 @@ -688,7 +688,7 @@
37.165 "~~~~~ fun rewrite__ , args:"; val (thy, i, bdv, tless, rls, put_asm, thm, ct) =
37.166 (thy, 1, [], rew_ord, erls, bool, thm, term);
37.167 "~~~~~ and rew_sub , args:"; val (thy, i, bdv, tless, rls, put_asm, lrd, r, t) =
37.168 - (thy, i, bdv, tless, rls, put_asm, [], inst_bdv bdv (norm (Thm.prop_of thm)), ct)
37.169 + (thy, i, bdv, tless, rls, put_asm, [], TermC.inst_bdv bdv (Eval.norm (Thm.prop_of thm)), ct)
37.170 val (lhss, rhss) = (HOLogic.dest_eq o HOLogic.dest_Trueprop o Logic.strip_imp_concl) r
37.171 val r' = Envir.subst_term (Pattern.match thy (lhss, t) (Vartab.empty, Vartab.empty)) r
37.172 val p' = map HOLogic.dest_Trueprop ((fst o Logic.strip_prems) (Logic.count_prems r', [], r'))
37.173 @@ -706,7 +706,7 @@
37.174 (* norm_equation is defined in Test.thy, other rls see Knowledg/**)
37.175 val thy = @{theory};
37.176 val rls = norm_equation;
37.177 -val term = str2term "x + 1 = 2";
37.178 +val term = TermC.str2term "x + 1 = 2";
37.179
37.180 val SOME (t, asm) = rewrite_set_ thy false rls term;
37.181 if UnparseC.term t = "x + 1 + -1 * 2 = 0" then () else error "rewrite_set_ norm_equation CHANGED";
38.1 --- a/test/Tools/isac/MathEngine/mathengine-stateless.sml Mon Apr 19 13:57:47 2021 +0200
38.2 +++ b/test/Tools/isac/MathEngine/mathengine-stateless.sml Mon Apr 19 15:02:11 2021 +0200
38.3 @@ -10,7 +10,7 @@
38.4 "--------------------------------------------------------";
38.5 "table of contents --------------------------------------";
38.6 "--------------------------------------------------------";
38.7 -"----------- change to parse ctxt -----------------------";
38.8 +"----------- change to TermC.parse ctxt -----------------------";
38.9 "----------- debugging setContext..pbl_ -----------------";
38.10 "----------- tryrefine ----------------------------------";
38.11 "----------- search for Or_to_List ----------------------";
38.12 @@ -21,9 +21,9 @@
38.13 "--------------------------------------------------------";
38.14 "--------------------------------------------------------";
38.15
38.16 -"----------- change to parse ctxt -----------------------";
38.17 -"----------- change to parse ctxt -----------------------";
38.18 -"----------- change to parse ctxt -----------------------";
38.19 +"----------- change to TermC.parse ctxt -----------------------";
38.20 +"----------- change to TermC.parse ctxt -----------------------";
38.21 +"----------- change to TermC.parse ctxt -----------------------";
38.22 "===== start calculation: from problem description (fmz) to origin";
38.23 val fmz = ["realTestGiven (((1+2)*4/3)^^^2)", "realTestFind s"];
38.24 val (thyID, pblID, metID) =
38.25 @@ -332,7 +332,7 @@
38.26 (*val ("ok", (_, c, ptp as (_,p))) = *)Step_Solve.by_term ptp' (encode ifo);
38.27 "~~~~~ fun Step_Solve.by_term , args:"; val (cs as (_, _, ptp as (pt, pos as (p, p_))), istr) =
38.28 (cs', (encode ifo));
38.29 -val SOME f_in = parse (ThyC.get_theory "Isac_Knowledge") istr
38.30 +val SOME f_in = TermC.parse (ThyC.get_theory "Isac_Knowledge") istr
38.31 val f_in = Thm.term_of f_in
38.32 val f_succ = get_curr_formula (pt, pos);
38.33 f_succ = f_in = false;
39.1 --- a/test/Tools/isac/MathEngine/step.sml Mon Apr 19 13:57:47 2021 +0200
39.2 +++ b/test/Tools/isac/MathEngine/step.sml Mon Apr 19 15:02:11 2021 +0200
39.3 @@ -106,26 +106,26 @@
39.4 --------- ([3], Pbl)--------- Step.do_next \<rightarrow> Add_Given equality (-1 + x = 0)----------------------------------
39.5 ========= ([3], Met)========= Step.by_tactic: Apply_Method ["Test", "solve_linear"] ==================================
39.6 Frm ..... (SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x)], [], Rule_Set.empty, NONE, ??.empty, ORundef, false, true),
39.7 -... ctxt: ["matches (?a = ?b) (-1 + x = 0)"]) ,
39.8 +... ctxt: ["TermC.matches (?a = ?b) (-1 + x = 0)"]) ,
39.9 Res ..... NONE)
39.10 --------- ([3,1], Frm)--------- Step.do_next \<rightarrow> Rewrite_Set_Inst ([(''bdv'', x)], "isolate_bdv")----------------------------------
39.11 Frm ..... (SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x)], [], Rule_Set.empty, NONE, ??.empty, ORundef, false, true),
39.12 -... ctxt: ["matches (?a = ?b) (-1 + x = 0)"]) ,
39.13 +... ctxt: ["TermC.matches (?a = ?b) (-1 + x = 0)"]) ,
39.14 Res ..... SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x)], [R,L,R,L,R,L,R], Rule_Set.empty, SOME e_e, x = 0 + -1 * -1, ORundef, true, false),
39.15 -... ctxt: ["matches (?a = ?b) (-1 + x = 0)"]) )
39.16 +... ctxt: ["TermC.matches (?a = ?b) (-1 + x = 0)"]) )
39.17 ========= ([3,1], Frm)========= Step.by_tactic: Rewrite_Set_Inst ([(''bdv'', x)], "isolate_bdv") ==================================
39.18 Frm ..... (SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x)], [], Rule_Set.empty, NONE, ??.empty, ORundef, false, true),
39.19 -... ctxt: ["matches (?a = ?b) (-1 + x = 0)"]) ,
39.20 +... ctxt: ["TermC.matches (?a = ?b) (-1 + x = 0)"]) ,
39.21 Res ..... SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x)], [R,L,R,L,R,L,R], Rule_Set.empty, SOME e_e, x = 0 + -1 * -1, ORundef, true, true),
39.22 -... ctxt: ["matches (?a = ?b) (-1 + x = 0)"]) )
39.23 +... ctxt: ["TermC.matches (?a = ?b) (-1 + x = 0)"]) )
39.24 --------- ([3,1], Res)--------- Step.do_next \<rightarrow> Rewrite_Set "Test_simplify"----------------------------------
39.25 Frm ..... (NONE,
39.26 Res ..... SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x)], [R,L,R,L,R,R], Rule_Set.empty, SOME e_e, x = 1, ORundef, true, false),
39.27 -... ctxt: ["matches (?a = ?b) (-1 + x = 0)"]) )
39.28 +... ctxt: ["TermC.matches (?a = ?b) (-1 + x = 0)"]) )
39.29 ========= ([3,1], Res)========= Step.by_tactic: Rewrite_Set "Test_simplify" ==================================
39.30 Frm ..... (NONE,
39.31 Res ..... SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x)], [R,L,R,L,R,R], Rule_Set.empty, SOME e_e, x = 1, ORundef, true, false),
39.32 -... ctxt: ["matches (?a = ?b) (-1 + x = 0)"]) )
39.33 +... ctxt: ["TermC.matches (?a = ?b) (-1 + x = 0)"]) )
39.34 --------- ([3,2], Res)--------- Step.do_next \<rightarrow> Check_Postcond ["LINEAR", "univariate", "equation", "test"]----------------------------------
39.35 Frm ..... (SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x)], [R,R,D,L,R], Rule_Set.empty, NONE, Subproblem
39.36 (''Test'',
39.37 @@ -133,7 +133,7 @@
39.38 ''test''), ORundef, true, true),
39.39 ... ctxt: []) ,
39.40 Res ..... SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x)], [R,R,D,L,R], Rule_Set.empty, NONE, [x = 1], ORundef, true, true),
39.41 -... ctxt: ["matches (?a = ?b) (-1 + x = 0)", "x = 1"]) )
39.42 +... ctxt: ["TermC.matches (?a = ?b) (-1 + x = 0)", "x = 1"]) )
39.43 ========= ([3,2], Res)========= Step.by_tactic: Check_Postcond ["LINEAR", "univariate", "equation", "test"] ==================================
39.44 Frm ..... (SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x)], [R,R,D,L,R], Rule_Set.empty, NONE, Subproblem
39.45 (''Test'',
39.46 @@ -141,31 +141,31 @@
39.47 ''test''), ORundef, true, true),
39.48 ... ctxt: []) ,
39.49 Res ..... SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x)], [R,R,D,L,R], Rule_Set.empty, NONE, [x = 1], ORundef, true, true),
39.50 -... ctxt: ["matches (?a = ?b) (-1 + x = 0)", "x = 1"]) )
39.51 +... ctxt: ["TermC.matches (?a = ?b) (-1 + x = 0)", "x = 1"]) )
39.52 --------- ([3], Res)--------- Step.do_next \<rightarrow> Check_elementwise "Assumptions"----------------------------------
39.53 Frm ..... (NONE,
39.54 Res ..... SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x),(L_L, [x = 1])], [R,R,D,R,D], Rule_Set.empty, NONE, [x = 1], ORundef, true, false),
39.55 -... ctxt: ["matches (?a = ?b) (-1 + x = 0)", "x = 1"]) )
39.56 +... ctxt: ["TermC.matches (?a = ?b) (-1 + x = 0)", "x = 1"]) )
39.57 ========= ([3], Res)========= Step.by_tactic: Check_elementwise "Assumptions" ==================================
39.58 Frm ..... (NONE,
39.59 Res ..... SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x),(L_L, [x = 1])], [R,R,D,R,D], Rule_Set.empty, NONE, [x = 1], ORundef, true, true),
39.60 -... ctxt: ["matches (?a = ?b) (-1 + x = 0)", "x = 1"]) )
39.61 +... ctxt: ["TermC.matches (?a = ?b) (-1 + x = 0)", "x = 1"]) )
39.62 --------- ([4], Res)--------- Step.do_next \<rightarrow> Check_Postcond ["sqroot-test", "univariate", "equation", "test"]----------------------------------
39.63 Frm ..... (SOME (Pstate ([], [], Rule_Set.empty, NONE, ??.empty, ORundef, false, false),
39.64 ... ctxt: []) ,
39.65 Res ..... SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x),(L_L, [x = 1])], [R,R,D,R,D], Rule_Set.empty, NONE, [x = 1], ORundef, true, true),
39.66 -... ctxt: ["matches (?a = ?b) (-1 + x = 0)", "x = 1"]) )
39.67 +... ctxt: ["TermC.matches (?a = ?b) (-1 + x = 0)", "x = 1"]) )
39.68 ========= ([4], Res)========= Step.by_tactic: Check_Postcond ["sqroot-test", "univariate", "equation", "test"] ==================================
39.69 Frm ..... (SOME (Pstate ([], [], Rule_Set.empty, NONE, ??.empty, ORundef, false, false),
39.70 ... ctxt: []) ,
39.71 Res ..... SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x),(L_L, [x = 1])], [R,R,D,R,D], Rule_Set.empty, NONE, [x = 1], ORundef, true, true),
39.72 -... ctxt: ["matches (?a = ?b) (-1 + x = 0)", "x = 1"]) )
39.73 +... ctxt: ["TermC.matches (?a = ?b) (-1 + x = 0)", "x = 1"]) )
39.74 --------- ([], Res)--------- Step.do_next \<rightarrow> input End_Proof'----------------------------------
39.75 ========= ([], Res)========= Step.by_tactic: input End_Proof' ==================================
39.76 Frm ..... (SOME (Pstate ([], [], Rule_Set.empty, NONE, ??.empty, ORundef, false, false),
39.77 ... ctxt: []) ,
39.78 Res ..... SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x),(L_L, [x = 1])], [R,R,D,R,D], Rule_Set.empty, NONE, [x = 1], ORundef, true, true),
39.79 -... ctxt: ["matches (?a = ?b) (-1 + x = 0)", "x = 1"]) )
39.80 +... ctxt: ["TermC.matches (?a = ?b) (-1 + x = 0)", "x = 1"]) )
39.81 --------- ([], Res)--------- Step.do_next \<rightarrow> input End_Proof'----------------------------------
39.82 *)
39.83
40.1 --- a/test/Tools/isac/Minisubpbl/790-complete-NEXT_STEP.sml Mon Apr 19 13:57:47 2021 +0200
40.2 +++ b/test/Tools/isac/Minisubpbl/790-complete-NEXT_STEP.sml Mon Apr 19 15:02:11 2021 +0200
40.3 @@ -30,7 +30,7 @@
40.4 (*[3], Res*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*\<rightarrow>Check_Postcond ["LINEAR", "univariate", "equation", "test"]*)
40.5
40.6 ((get_obj g_result pt (fst p)) |> snd |> UnparseC.terms) = "[]";(*isa*)
40.7 -((get_obj g_result pt (fst p)) |> snd |> UnparseC.terms) = "[\"matches (?a = ?b) (-1 + x = 0)\"]";(*REP*)
40.8 +((get_obj g_result pt (fst p)) |> snd |> UnparseC.terms) = "[\"TermC.matches (?a = ?b) (-1 + x = 0)\"]";(*REP*)
40.9 (* there are questionable assumptions either ---------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*)
40.10
40.11 (*[4], Res*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*Check_elementwise "Assumptions"*)
41.1 --- a/test/Tools/isac/OLDTESTS/interface-xml.sml Mon Apr 19 13:57:47 2021 +0200
41.2 +++ b/test/Tools/isac/OLDTESTS/interface-xml.sml Mon Apr 19 15:02:11 2021 +0200
41.3 @@ -2,11 +2,11 @@
41.4 use"interface-xml.sml";
41.5 *)
41.6
41.7 -(*see javatest.isac.util.parse.TestXMLParserDigest#testParseRefFormula*)
41.8 -refformulaOK2xml 1 ([1],Frm) (Form (str2term "x+1=2"));
41.9 -(*see javatest.isac.util.parse.TestXMLParserDigest#testParseRefCalcHead*)
41.10 +(*see javatest.isac.util.TermC.parse.TestXMLParserDigest#testParseRefFormula*)
41.11 +refformulaOK2xml 1 ([1],Frm) (Form (TermC.str2term "x+1=2"));
41.12 +(*see javatest.isac.util.TermC.parse.TestXMLParserDigest#testParseRefCalcHead*)
41.13 refformulaOK2xml 1 ([1],Pbl) (ModSpec Specification_Def.empty);
41.14
41.15 -getintervalOK 1 [(([2],Res), str2term "x = 4"),
41.16 - (([3],Pbl), str2term "e_headline"),
41.17 - (([3,1],Frm), str2term "-1+x=0")];
41.18 +getintervalOK 1 [(([2],Res), TermC.str2term "x = 4"),
41.19 + (([3],Pbl), TermC.str2term "e_headline"),
41.20 + (([3,1],Frm), TermC.str2term "-1+x=0")];
42.1 --- a/test/Tools/isac/OLDTESTS/root-equ.sml Mon Apr 19 13:57:47 2021 +0200
42.2 +++ b/test/Tools/isac/OLDTESTS/root-equ.sml Mon Apr 19 15:02:11 2021 +0200
42.3 @@ -27,7 +27,7 @@
42.4
42.5
42.6 (*
42.7 -> val t = (Thm.term_of o the o (parse thy)) "#2^^^#3";
42.8 +> val t = (Thm.term_of o the o (TermC.parse thy)) "#2^^^#3";
42.9 > val eval_fn = the (LibraryC.assoc (!eval_list, "pow"));
42.10 > val (SOME (id,t')) = get_pair thy "pow" eval_fn t;
42.11 > Syntax.string_of_term (ThyC.to_ctxt thy) t';
42.12 @@ -101,7 +101,7 @@
42.13 "solutions L::real set" ,
42.14 "L = {bdv. || ((%x. l) bdv) - ((%x. r) bdv) || < eps}"*)];
42.15 val thy = (theory "Isac_Knowledge");
42.16 -val formals = map (the o (parse thy)) origin;
42.17 +val formals = map (the o (TermC.parse thy)) origin;
42.18
42.19 val given = ["equation (l=(r::real))",
42.20 "bound_variable bdv", (* TODO type *)
42.21 @@ -112,13 +112,13 @@
42.22 val find = ["solutions (L::bool list)"];
42.23 val with_ = [(* parseold ...
42.24 "L = {bdv. || ((%x. l) bdv) - ((%x. r) bdv) || < eps}"*)];
42.25 -val chkpbl = map (the o (parse thy)) (given @ where_ @ find @ with_);
42.26 -val givens = map (the o (parse thy)) given;
42.27 +val chkpbl = map (the o (TermC.parse thy)) (given @ where_ @ find @ with_);
42.28 +val givens = map (the o (TermC.parse thy)) given;
42.29 parseold thy "L = {bdv. || ((%x. l) bdv) - ((%x. r) bdv) || < apx}";
42.30
42.31 " --- subproblem 2: linear-equation --- ";
42.32 val origin = ["x + 4 = (0::real)", "x::real"];
42.33 -val formals = map (the o (parse thy)) origin;
42.34 +val formals = map (the o (TermC.parse thy)) origin;
42.35
42.36 val given = ["equation (l=(0::real))",
42.37 "bound_variable bdv"];
42.38 @@ -126,13 +126,13 @@
42.39 val find = ["l::real"];
42.40 val with_ = ["l = (%x. l) bdv"];
42.41 val chkpbl = map (the o (parseold thy)) (given @ where_ @ find @ with_);
42.42 -val givens = map (the o (parse thy)) given;
42.43 +val givens = map (the o (TermC.parse thy)) given;
42.44
42.45
42.46 " _________________ rewrite_ x+4_________________ ";
42.47 " _________________ rewrite_ x+4_________________ ";
42.48 " _________________ rewrite_ x+4_________________ ";
42.49 -val t = (Thm.term_of o the o (parse thy)) "sqrt(9+4*x)=sqrt x + sqrt(5+x)";
42.50 +val t = (Thm.term_of o the o (TermC.parse thy)) "sqrt(9+4*x)=sqrt x + sqrt(5+x)";
42.51 val thm = ThmC.numerals_to_Free @{thm square_equation_left};
42.52 val (t,asm) = the (rewrite_ thy tless_true tval_rls true thm t);
42.53 val rls = Test_simplify;
42.54 @@ -187,7 +187,7 @@
42.55 val rls = Test_simplify;
42.56 val (t,_) = the (rewrite_set_ thy false rls t);
42.57 val rls = isolate_bdv;
42.58 -val subst = [(str2term "bdv", str2term "x")];
42.59 +val subst = [(TermC.str2term "bdv", TermC.str2term "x")];
42.60 val (t,_) = the (rewrite_set_inst_ thy false subst rls t);
42.61 val rls = Test_simplify;
42.62 val (t,_) = the (rewrite_set_ thy false rls t);
42.63 @@ -200,8 +200,8 @@
42.64 " _________________ rewrite x=4_________________ ";
42.65 (*
42.66 rewrite thy' "tless_true" "tval_rls" true (ThmC.numerals_to_Free @{thm rbinom_power_2}) ct;
42.67 -atomty (Thm.prop_of (!tthm));
42.68 -atomty (Thm.term_of (!tct));
42.69 +TermC.atomty (Thm.prop_of (!tthm));
42.70 +TermC.atomty (Thm.term_of (!tct));
42.71 *)
42.72 val thy' = "Test";
42.73 val ct = "sqrt(9+4*x)=sqrt x + sqrt(5+x)";
42.74 @@ -248,7 +248,7 @@
42.75 " _________________ rewrite + cappend _________________ ";
42.76 " _________________ rewrite + cappend _________________ ";
42.77 val thy' = "Test";
42.78 -val ct = str2term"sqrt(9+4*x)=sqrt x + sqrt(5+x)";
42.79 +val ct = TermC.str2term"sqrt(9+4*x)=sqrt x + sqrt(5+x)";
42.80 val ctl = ["sqrt(9+4*x)=sqrt x + sqrt(5+x)", "x::real", "0"];
42.81 val oris = O_Model.init ctl thy
42.82 ((#ppc o Problem.from_store)
42.83 @@ -291,70 +291,70 @@
42.84 val pos = (lev_on o lev_dn) pos;
42.85 val thm = ("square_equation_left", ""); val ctold = ct;
42.86 val (ct,asm) = the (rewrite thy' "tless_true" ("tval_rls") true thm (UnparseC.term ct));
42.87 -val (pt,_) = cappend_atomic pt pos loc ctold (Tac (fst thm)) (str2term ct,[])Complete;
42.88 +val (pt,_) = cappend_atomic pt pos loc ctold (Tac (fst thm)) (TermC.str2term ct,[])Complete;
42.89 (*val pt = union_asm pt [] (map (rpair []) asm);*)
42.90
42.91 val pos = lev_on pos;
42.92 -val rls = ("Test_simplify"); val ctold = str2term ct;
42.93 +val rls = ("Test_simplify"); val ctold = TermC.str2term ct;
42.94 val (ct,_) = the (rewrite_set thy' false rls ct);
42.95 -val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (str2term ct,[]) Complete;
42.96 +val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.str2term ct,[]) Complete;
42.97
42.98 val pos = lev_on pos;
42.99 -val rls = ("rearrange_assoc"); val ctold = str2term ct;
42.100 +val rls = ("rearrange_assoc"); val ctold = TermC.str2term ct;
42.101 val (ct,_) = the (rewrite_set thy' false rls ct);
42.102 -val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (str2term ct,[]) Complete;
42.103 +val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.str2term ct,[]) Complete;
42.104
42.105 val pos = lev_on pos;
42.106 -val rls = ("isolate_root"); val ctold = str2term ct;
42.107 +val rls = ("isolate_root"); val ctold = TermC.str2term ct;
42.108 val (ct,_) = the (rewrite_set thy' false rls ct);
42.109 -val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (str2term ct,[]) Complete;
42.110 +val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.str2term ct,[]) Complete;
42.111
42.112 val pos = lev_on pos;
42.113 -val rls = ("Test_simplify"); val ctold = str2term ct;
42.114 +val rls = ("Test_simplify"); val ctold = TermC.str2term ct;
42.115 val (ct,_) = the (rewrite_set thy' false rls ct);
42.116 -val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (str2term ct,[]) Complete;
42.117 +val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.str2term ct,[]) Complete;
42.118
42.119 val pos = lev_on pos;
42.120 -val thm = ("square_equation_left", ""); val ctold = str2term ct;
42.121 +val thm = ("square_equation_left", ""); val ctold = TermC.str2term ct;
42.122 val (ct,asm) = the (rewrite thy' "tless_true" "tval_rls" true thm ct);
42.123 -val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (str2term ct,[]) Complete;
42.124 +val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.str2term ct,[]) Complete;
42.125 (*val pt = union_asm pt [] (map (rpair []) asm);*)
42.126
42.127 val pos = lev_up pos;
42.128 -val (pt,_) = append_result pt pos Istate.empty (str2term ct,[]) Complete;
42.129 +val (pt,_) = append_result pt pos Istate.empty (TermC.str2term ct,[]) Complete;
42.130
42.131 val pos = lev_on pos;
42.132 -val rls = ("Test_simplify"); val ctold = str2term ct;
42.133 +val rls = ("Test_simplify"); val ctold = TermC.str2term ct;
42.134 val (ct,_) = the (rewrite_set thy' false rls ct);
42.135 -val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (str2term ct,[]) Complete;
42.136 +val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.str2term ct,[]) Complete;
42.137
42.138 val pos = lev_on pos;
42.139 -val rls = ("norm_equation"); val ctold = str2term ct;
42.140 +val rls = ("norm_equation"); val ctold = TermC.str2term ct;
42.141 val (ct,_) = the (rewrite_set thy' false rls ct);
42.142 -val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (str2term ct,[]) Complete;
42.143 +val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.str2term ct,[]) Complete;
42.144
42.145 val pos = lev_on pos;
42.146 -val rls = ("Test_simplify"); val ctold = str2term ct;
42.147 +val rls = ("Test_simplify"); val ctold = TermC.str2term ct;
42.148 val (ct,_) = the (rewrite_set thy' false rls ct);
42.149 -val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (str2term ct,[]) Complete;
42.150 +val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.str2term ct,[]) Complete;
42.151
42.152 (* --- see comments in interface_ME_ISA/instantiate''
42.153 val rlsdat' = instantiate_rls' thy' [("bdv", "x")] ("isolate_bdv");
42.154 val (ct,_) = the (rewrite_set thy' false
42.155 ("#isolate_bdv",rlsdat') ct); *)
42.156 val pos = lev_on pos;
42.157 -val rls = ("isolate_bdv"); val ctold = str2term ct;
42.158 +val rls = ("isolate_bdv"); val ctold = TermC.str2term ct;
42.159 val (ct,_) = the (rewrite_set_inst thy' false
42.160 [("bdv", "x")] rls ct);
42.161 -val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (str2term ct,[]) Complete;
42.162 +val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.str2term ct,[]) Complete;
42.163
42.164 val pos = lev_on pos;
42.165 -val rls = ("Test_simplify"); val ctold = str2term ct;
42.166 +val rls = ("Test_simplify"); val ctold = TermC.str2term ct;
42.167 val (ct,_) = the (rewrite_set thy' false rls ct);
42.168 -val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (str2term ct,[]) Complete;
42.169 +val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.str2term ct,[]) Complete;
42.170
42.171 val pos = lev_up pos;
42.172 -val (pt,pos) = append_result pt pos Istate.empty (str2term ct,[]) Complete;
42.173 +val (pt,pos) = append_result pt pos Istate.empty (TermC.str2term ct,[]) Complete;
42.174 Ctree.get_assumptions pt ([],Res);
42.175
42.176 writeln (pr_ctree pr_short pt);
42.177 @@ -375,8 +375,8 @@
42.178 *)
42.179
42.180 (*
42.181 -val t = (Thm.term_of o the o (parse thy)) "solutions (L::real set)";
42.182 -atomty t;
42.183 +val t = (Thm.term_of o the o (TermC.parse thy)) "solutions (L::real set)";
42.184 +TermC.atomty t;
42.185 *)
42.186
42.187
42.188 @@ -530,7 +530,7 @@
42.189 val (p,_,f,nxt,_,pt) = me nxt p c pt;
42.190
42.191 (*.9.6.03
42.192 - val t = str2term "sqrt (9 + 4 * x) = sqrt x + sqrt (5 + x)";
42.193 + val t = TermC.str2term "sqrt (9 + 4 * x) = sqrt x + sqrt (5 + x)";
42.194 val SOME (t',asm) = rewrite_set_ thy false rls t;
42.195 UnparseC.term t';
42.196 > Rewrite.trace_on:=true;
42.197 @@ -557,7 +557,7 @@
42.198
42.199
42.200
42.201 -val ttt = (Thm.term_of o the o (parse Test.thy))
42.202 +val ttt = (Thm.term_of o the o (TermC.parse Test.thy))
42.203 "Let (((While contains_root e_e Do\
42.204 \Rewrite square_equation_left #>\
42.205 \Try (Rewrite_Set Test_simplify) #>\
43.1 --- a/test/Tools/isac/OLDTESTS/script.sml Mon Apr 19 13:57:47 2021 +0200
43.2 +++ b/test/Tools/isac/OLDTESTS/script.sml Mon Apr 19 15:02:11 2021 +0200
43.3 @@ -38,7 +38,7 @@
43.4 " scripts: Variante 'funktional' 6.5.03";
43.5 " ################################################# 6.5.03 ";
43.6
43.7 -val c = (the o (parse DiffApp.thy))
43.8 +val c = (the o (TermC.parse DiffApp.thy))
43.9 "Program Maximum_value(fix_::bool list)(m_::real) (rs_::bool list)\
43.10 \ (v_::real) (itv_::real set) (err_::bool) = \
43.11 \ (let e_e = (hd o (filterVar m_)) rs_; \
43.12 @@ -58,7 +58,7 @@
43.13 "############## Make_fun_by_new_variable ########### 6.5.03";
43.14 "################################################### 6.5.03";
43.15
43.16 -val sc = (the o (parse DiffApp.thy)) (*start interpretieren*)
43.17 +val sc = (the o (TermC.parse DiffApp.thy)) (*start interpretieren*)
43.18 "Program Make_fun_by_new_variable (f_::real) (v_::real) \
43.19 \ (eqs_::bool list) = \
43.20 \(let h_ = (hd o (filterVar f_)) eqs_; \
43.21 @@ -74,7 +74,7 @@
43.22 \ [BOOL e_2, REAL v_2])\
43.23 \in Substitute [(v_1 = (rhs o hd) s_1),(v_2 = (rhs o hd) s_2)] h_)";
43.24
43.25 -val ags = map (Thm.term_of o the o (parse DiffApp.thy))
43.26 +val ags = map (Thm.term_of o the o (TermC.parse DiffApp.thy))
43.27 ["A::real", "alpha::real",
43.28 "[A=a*b, a/2=r*sin alpha, b/2=r*cos (alpha::real)]"];
43.29 val ll = [](*:loc_*);
43.30 @@ -141,7 +141,7 @@
43.31 "############## Make_fun_by_explicit ############## 6.5.03";
43.32 "############## Make_fun_by_explicit ############## 6.5.03";
43.33 "############## Make_fun_by_explicit ############## 6.5.03";
43.34 -val c = (the o (parse DiffApp.thy))
43.35 +val c = (the o (TermC.parse DiffApp.thy))
43.36 "Program Make_fun_by_explicit (f_::real) (v_::real) \
43.37 \ (eqs_::bool list) = \
43.38 \ (let h_ = (hd o (filterVar f_)) eqs_; \
43.39 @@ -156,7 +156,7 @@
43.40 (*#####################################################--------11.5.02
43.41 "################ Solve_root_equation #################";
43.42 (*#####################################################*)
43.43 -val sc = (Thm.term_of o the o (parse Test.thy))
43.44 +val sc = (Thm.term_of o the o (TermC.parse Test.thy))
43.45 "Program Solve_root_equation (eq_::bool) (v_::real) (err_::bool) =\
43.46 \ (let e_e = Rewrite square_equation_left True eq_; \
43.47 \ e_e = Rewrite_Set Test_simplify False e_; \
43.48 @@ -172,7 +172,7 @@
43.49 \ e_e = Rewrite_Set_Inst [(''bdv'',v_)] isolate_bdv False e_;\
43.50 \ e_e = Rewrite_Set Test_simplify False e_e \
43.51 \ in [e_::bool])";
43.52 -val ags = map (Thm.term_of o the o (parse Test.thy))
43.53 +val ags = map (Thm.term_of o the o (TermC.parse Test.thy))
43.54 ["sqrt(#9+#4*x)=sqrt x + sqrt(#5+x)", "x::real", "#0"];
43.55 val fmz =
43.56 ["equality (sqrt(#9+#4*x)=sqrt x + sqrt(#5+x))",
43.57 @@ -245,14 +245,14 @@
43.58 " --- test100: nxt_tac order------------------------------------ ";
43.59
43.60 val scr as (Prog sc) = Prog (((inst_abs Test.thy)
43.61 - o Thm.term_of o the o (parse thy))
43.62 + o Thm.term_of o the o (TermC.parse thy))
43.63 "Program Testeq (e_e::bool) = \
43.64 \(While (contains_root e_e) Do \
43.65 \((Try (Repeat (Rewrite rroot_square_inv))) #> \
43.66 \ (Try (Repeat (Rewrite square_equation_left))) #> \
43.67 \ (Try (Repeat (Rewrite radd_0)))))\
43.68 \ e_e ");
43.69 -atomty sc;
43.70 +TermC.atomty sc;
43.71 val (dI',pI',mI') = ("Test",["sqroot-test", "univariate", "equation", "test"],
43.72 ["Test", "sqrt-equ-test"]);
43.73 val c = [];
43.74 @@ -262,30 +262,30 @@
43.75 val nxt = ("Specify_Method",Specify_Method ["Test", "sqrt-equ-test"]); (*for asm in square_equation_left*)
43.76 val (p,_,_,_,_,pt) = me nxt p c pt;
43.77 val p = ([1],Res):pos';
43.78 -val eq_ = (Thm.term_of o the o (parse thy))"e_::bool";
43.79 +val eq_ = (Thm.term_of o the o (TermC.parse thy))"e_::bool";
43.80
43.81 val ct = "0+(sqrt(sqrt(sqrt a))^^^2)^^^2=0";
43.82 -val ve0_= (Thm.term_of o the o (parse thy)) ct;
43.83 +val ve0_= (Thm.term_of o the o (TermC.parse thy)) ct;
43.84 val ets0=[([],(Tac_(Program.thy,"BS", "", ""),[(eq_,ve0_)],[(eq_,ve0_)],
43.85 TermC.empty,TermC.empty,Safe)),
43.86 ([],(User', [], [], TermC.empty, TermC.empty,Sundef))]:ets;
43.87 val l0 = [];
43.88 " --------------- 1. ---------------------------------------------";
43.89 -val (pt,_) = cappend_atomic pt[1]Istate.empty TermC.empty(Rewrite("test", ""))(str2term ct,[])Complete;
43.90 +val (pt,_) = cappend_atomic pt[1]Istate.empty TermC.empty(Rewrite("test", ""))(TermC.str2term ct,[])Complete;
43.91 (*12.10.03:*** Unknown theorem(s) "rroot_square_inv"
43.92 val Applicable.Yes m' = Step.check (Rewrite("rroot_square_inv", "")) (pt, p);
43.93 *)
43.94
43.95
43.96 val scr as (Prog sc) =
43.97 - Prog (((inst_abs Test.thy) o Thm.term_of o the o (parse thy))
43.98 + Prog (((inst_abs Test.thy) o Thm.term_of o the o (TermC.parse thy))
43.99 "Program Testterm (g_::real) = (Calculate cancel g_)");
43.100 (*
43.101 val scr as (Prog sc) =
43.102 - Prog (((inst_abs Test.thy) o Thm.term_of o the o (parse thy))
43.103 + Prog (((inst_abs Test.thy) o Thm.term_of o the o (TermC.parse thy))
43.104 "Program Testterm (g_::real) = (Calculate power g_)");
43.105 val scr as (Prog sc) =
43.106 - Prog (((inst_abs Test.thy) o Thm.term_of o the o (parse thy))
43.107 + Prog (((inst_abs Test.thy) o Thm.term_of o the o (TermC.parse thy))
43.108 "Program Testterm (g_::real) = (Calculate pow g_)");
43.109 ..............................................................*)
43.110 writeln
44.1 --- a/test/Tools/isac/OLDTESTS/script_if.sml Mon Apr 19 13:57:47 2021 +0200
44.2 +++ b/test/Tools/isac/OLDTESTS/script_if.sml Mon Apr 19 15:02:11 2021 +0200
44.3 @@ -9,37 +9,37 @@
44.4 (*---------------- 25.7.02 ---------------------*)
44.5
44.6 val thy = (theory "Isac_Knowledge");
44.7 -val t = (Thm.term_of o the o (parse thy)) "contains_root (sqrt(x)=1)";
44.8 +val t = (Thm.term_of o the o (TermC.parse thy)) "contains_root (sqrt(x)=1)";
44.9 val SOME(ss,tt) = eval_contains_root "xxx" 1 t thy;
44.10
44.11 -val t = (Thm.term_of o the o (parse thy)) "is_rootequation_in (sqrt(x)=1) x";
44.12 +val t = (Thm.term_of o the o (TermC.parse thy)) "is_rootequation_in (sqrt(x)=1) x";
44.13 val SOME(ss,tt) = eval_is_rootequation_in "is_rootequation_i" 1 t thy;
44.14
44.15 (*---
44.16 -val v = (Thm.term_of o the o (parse thy)) "x";
44.17 -val t = (Thm.term_of o the o (parse thy)) "sqrt(#3+#4*x)";
44.18 +val v = (Thm.term_of o the o (TermC.parse thy)) "x";
44.19 +val t = (Thm.term_of o the o (TermC.parse thy)) "sqrt(#3+#4*x)";
44.20 scan t v;
44.21 -val t = (Thm.term_of o the o (parse thy)) "sqrt(#3+#4*a)";
44.22 +val t = (Thm.term_of o the o (TermC.parse thy)) "sqrt(#3+#4*a)";
44.23 scan t v;
44.24 -val t = (Thm.term_of o the o (parse thy)) "#1 + #2*sqrt(#3+#4*x)";
44.25 +val t = (Thm.term_of o the o (TermC.parse thy)) "#1 + #2*sqrt(#3+#4*x)";
44.26 scan t v;
44.27 -val t = (Thm.term_of o the o (parse thy)) "x + #2*sqrt(#3+#4*a)";
44.28 +val t = (Thm.term_of o the o (TermC.parse thy)) "x + #2*sqrt(#3+#4*a)";
44.29 scan t v;
44.30 ---*)
44.31 -val t = (Thm.term_of o the o (parse thy))
44.32 +val t = (Thm.term_of o the o (TermC.parse thy))
44.33 "is_rootequation_in (1 + 2*sqrt(3+4*x)=0) x";
44.34 val SOME(ss,tt) = eval_is_rootequation_in "is_rootequation_i" 1 t thy;
44.35
44.36 -val t = (Thm.term_of o the o (parse thy))
44.37 +val t = (Thm.term_of o the o (TermC.parse thy))
44.38 "is_rootequation_in (x + 2*sqrt(3+4*a)=0) x";
44.39 val SOME(ss,tt) = eval_is_rootequation_in "is_rootequation_i" 1 t thy;
44.40
44.41 -val t = (Thm.term_of o the o (parse Test.thy))
44.42 +val t = (Thm.term_of o the o (TermC.parse Test.thy))
44.43 "is_rootequation_in (sqrt(x)=1) x";
44.44 -atomty t;
44.45 -val t = (Thm.term_of o the o (parse (theory "Isac_Knowledge")))
44.46 +TermC.atomty t;
44.47 +val t = (Thm.term_of o the o (TermC.parse (theory "Isac_Knowledge")))
44.48 "is_rootequation_in (sqrt(x)=1) x";
44.49 -atomty t;
44.50 +TermC.atomty t;
44.51
44.52 (*
44.53 val SOME(tt,_) = rewrite_set_ Test.thytrue tval_rls t;
44.54 @@ -71,9 +71,9 @@
44.55 [Problem.prep_input (theory "Isac_Knowledge")
44.56 (["approximate", "univariate", "equation", "test"],
44.57 [("#Given", ["equality e_e", "solveFor v_v", "errorBound err_"]),
44.58 - ("#Where", ["matches (?a = ?b) e_e"]),
44.59 + ("#Where", ["TermC.matches (?a = ?b) e_e"]),
44.60 ("#Find", ["solutions v_i_"])],
44.61 - Rule_Set.append_rules Rule_Set.empty [Eval ("Prog_Expr.matches",eval_matches "#matches_")], [])]
44.62 + Rule_Set.append_rules Rule_Set.empty [Eval ("Prog_Expr.TermC.matches",eval_matches "#matches_")], [])]
44.63 thy;
44.64
44.65 methods:= overwritel (!methods,
45.1 --- a/test/Tools/isac/OLDTESTS/scriptnew.sml Mon Apr 19 13:57:47 2021 +0200
45.2 +++ b/test/Tools/isac/OLDTESTS/scriptnew.sml Mon Apr 19 15:02:11 2021 +0200
45.3 @@ -388,9 +388,9 @@
45.4 val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.5 Rewrite.trace_on := false;
45.6 val asms = Ctree.get_assumptions pt p;
45.7 -if asms = [(str2term "0 <= 9 + 4 * x",[1]),
45.8 - (str2term "0 <= x",[1]),
45.9 - (str2term "0 <= -3 + x",[1])] then ()
45.10 +if asms = [(TermC.str2term "0 <= 9 + 4 * x",[1]),
45.11 + (TermC.str2term "0 <= x",[1]),
45.12 + (TermC.str2term "0 <= -3 + x",[1])] then ()
45.13 else error "scriptnew.sml diff.behav. in sqrt assumptions 1";
45.14
45.15 val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.16 @@ -400,11 +400,11 @@
45.17 [("0 <= 9 + 4 * x",[1]),("0 <= x",[1]),("0 <= -3 + x",[1])];
45.18 val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.19 val asms = Ctree.get_assumptions pt p;
45.20 -if asms = [(str2term "0 <= 9 + 4 * x",[1]),
45.21 - (str2term "0 <= x",[1]),
45.22 - (str2term "0 <= -3 + x",[1]),
45.23 - (str2term "0 <= x ^^^ 2 + -3 * x",[6]),
45.24 - (str2term "0 <= 6 + x",[6])] then ()
45.25 +if asms = [(TermC.str2term "0 <= 9 + 4 * x",[1]),
45.26 + (TermC.str2term "0 <= x",[1]),
45.27 + (TermC.str2term "0 <= -3 + x",[1]),
45.28 + (TermC.str2term "0 <= x ^^^ 2 + -3 * x",[6]),
45.29 + (TermC.str2term "0 <= 6 + x",[6])] then ()
45.30 else error "scriptnew.sml diff.behav. in sqrt assumptions 2";
45.31
45.32 val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
45.33 @@ -427,11 +427,11 @@
45.34 (*val nxt = ("Check_elementwise",Check_elementwise "Assumptions")*)
45.35
45.36 val asms = Ctree.get_assumptions pt p;
45.37 -if asms = [(str2term "0 <= 9 + 4 * x",[1]),
45.38 - (str2term "0 <= x",[1]),
45.39 - (str2term "0 <= -3 + x",[1]),
45.40 - (str2term "0 <= x ^^^ 2 + -3 * x",[6]),
45.41 - (str2term "0 <= 6 + x",[6])] then ()
45.42 +if asms = [(TermC.str2term "0 <= 9 + 4 * x",[1]),
45.43 + (TermC.str2term "0 <= x",[1]),
45.44 + (TermC.str2term "0 <= -3 + x",[1]),
45.45 + (TermC.str2term "0 <= x ^^^ 2 + -3 * x",[6]),
45.46 + (TermC.str2term "0 <= 6 + x",[6])] then ()
45.47 else raise
45.48 error "scriptnew.sml: diff.behav. at Check_elementwise [x = -12 / 5]";
45.49
45.50 @@ -451,11 +451,11 @@
45.51 else error "diff.behav. in scriptnew.sml; root-eq: L = []";
45.52
45.53 val asms = Ctree.get_assumptions pt p;
45.54 -if asms = [(str2term "0 <= 9 + 4 * (-12 / 5)",[]),
45.55 - (str2term "0 <= -12 / 5", []),
45.56 - (str2term "0 <= -3 + -12 / 5", []),
45.57 - (str2term "0 <= (-12 / 5) ^^^ 2 + -3 * (-12 / 5)", []),
45.58 - (str2term "0 <= 6 + -12 / 5", [])] then ()
45.59 +if asms = [(TermC.str2term "0 <= 9 + 4 * (-12 / 5)",[]),
45.60 + (TermC.str2term "0 <= -12 / 5", []),
45.61 + (TermC.str2term "0 <= -3 + -12 / 5", []),
45.62 + (TermC.str2term "0 <= (-12 / 5) ^^^ 2 + -3 * (-12 / 5)", []),
45.63 + (TermC.str2term "0 <= 6 + -12 / 5", [])] then ()
45.64 else error "scriptnew.sml diff.behav. in sqrt assumptions 4";
45.65
45.66
45.67 @@ -465,7 +465,7 @@
45.68
45.69
45.70 (*GoOn.5.03. script with Map, Subst (biquadr.equ.)
45.71 -val scr = Prog ((inst_abs o Thm.term_of o the o (parse thy))
45.72 +val scr = Prog ((inst_abs o Thm.term_of o the o (TermC.parse thy))
45.73 "Program Biquadrat_poly (e_e::bool) (v_::real) = \
45.74 \(let e_e = Substitute [(v_^^^4, v_0_^^^2),(v_^^^2, v_0_)] e_; \
45.75 \ L_0_ = (SubProblem (PolyEqX,[univariate,equation], [no_met]) \
46.1 --- a/test/Tools/isac/ProgLang/auto_prog.sml Mon Apr 19 13:57:47 2021 +0200
46.2 +++ b/test/Tools/isac/ProgLang/auto_prog.sml Mon Apr 19 15:02:11 2021 +0200
46.3 @@ -50,9 +50,9 @@
46.4 if UnparseC.terms (formal_args auto_script) = "[\"t_t\", \"v\"]"
46.5 then () else error "formal_args of auto-gen.script changed";
46.6
46.7 - Istate.init_detail (Rewrite_Set_Inst (["(''bdv'', x)"], "integration_rules")) (str2term "someTermWithBdv");
46.8 + Istate.init_detail (Rewrite_Set_Inst (["(''bdv'', x)"], "integration_rules")) (TermC.str2term "someTermWithBdv");
46.9 "~~~~~ fun init_detail , args:"; val ((Tactic.Rewrite_Set_Inst (subs, rls)), t)
46.10 - = ((Rewrite_Set_Inst (["(''bdv'', x)"], "integration_rules")), str2term "someTermWithBdv");
46.11 + = ((Rewrite_Set_Inst (["(''bdv'', x)"], "integration_rules")), TermC.str2term "someTermWithBdv");
46.12 val v = case Subst.T_from_input (ThyC.get_theory "Isac_Knowledge") subs of
46.13 (_, v) :: _ => v;
46.14 (*case*) assoc_rls rls (*of*);
46.15 @@ -148,7 +148,7 @@
46.16 val auto_script =
46.17 Auto_Prog.gen @{theory "Poly"} @{term "ttt :: real"} (assoc_rls "norm_Rational");
46.18 writeln(UnparseC.term auto_script);
46.19 -atomty auto_script;
46.20 +TermC.atomty auto_script;
46.21 (***
46.22 *** Const (Program.Stepwise, 'z => 'z => 'z)
46.23 *** . Free (t_t, 'z)
47.1 --- a/test/Tools/isac/ProgLang/evaluate.sml Mon Apr 19 13:57:47 2021 +0200
47.2 +++ b/test/Tools/isac/ProgLang/evaluate.sml Mon Apr 19 15:02:11 2021 +0200
47.3 @@ -43,7 +43,7 @@
47.4 "----------- fun calculate_ --------------------------------------------------------------------";
47.5 "----------- fun calculate_ --------------------------------------------------------------------";
47.6 (* fun rewrite__set_ \<longrightarrow> fun rew_once works the same way *)
47.7 -val t = str2term "((1+2)*4/3)^^^2";
47.8 +val t = TermC.str2term "((1+2)*4/3)^^^2";
47.9 val thy = @{theory};
47.10 val times = ("Groups.times_class.times", eval_binop "#mult_") : string * Eval_Def.eval_fn;
47.11 val plus = ("Groups.plus_class.plus",eval_binop "#add_") : string * Eval_Def.eval_fn;
47.12 @@ -128,18 +128,18 @@
47.13
47.14 (*--------------(2): does divide work in Test_simplify ?: ------*)
47.15 val thy = @{theory Test};
47.16 - val t = (Thm.term_of o the o (parse thy)) "6 / 2";
47.17 + val t = (Thm.term_of o the o (TermC.parse thy)) "6 / 2";
47.18 val rls = Test_simplify;
47.19 val (t,_) = the (rewrite_set_ thy false rls t);
47.20 (*val t = Free ("3", "Real.real") : term*)
47.21
47.22 (*--------------(3): is_const works ?: -------------------------------------*)
47.23 - val t = (Thm.term_of o the o (parse @{theory Test})) "2 is_const";
47.24 - atomty t;
47.25 + val t = (Thm.term_of o the o (TermC.parse @{theory Test})) "2 is_const";
47.26 + TermC.atomty t;
47.27 rewrite_set_ @{theory Test} false tval_rls t;
47.28 (*val it = SOME (Const ("HOL.True", "bool"),[]) ... works*)
47.29
47.30 - val t = str2term "2 * x is_const";
47.31 + val t = TermC.str2term "2 * x is_const";
47.32 val SOME (str,t') = eval_const "" "" t (@{theory "Isac_Knowledge"});
47.33 UnparseC.term t';
47.34
47.35 @@ -151,17 +151,17 @@
47.36 Rewrite.trace_on := false;
47.37 val thy = @{theory Test};
47.38 val rls = Test_simplify;
47.39 - val t = (Thm.term_of o the o (parse thy)) "(-4) / 2";
47.40 + val t = (Thm.term_of o the o (TermC.parse thy)) "(-4) / 2";
47.41
47.42 val SOME (_, t) = eval_cancel "xxx" "Rings.divide_class.divide" t thy;
47.43
47.44 (*--------------(5): reproduce (1) with simpler term: ------------*)
47.45 - val t = (Thm.term_of o the o (parse thy)) "(3+5)/2";
47.46 + val t = (Thm.term_of o the o (TermC.parse thy)) "(3+5)/2";
47.47 case rewrite_set_ thy false rls t of
47.48 SOME (Free ("4", _), []) => ()
47.49 | _ => error "rewrite_set_ (3+5)/2 changed";
47.50
47.51 - val t = (Thm.term_of o the o (parse thy)) "(3+1+2*x)/2";
47.52 + val t = (Thm.term_of o the o (TermC.parse thy)) "(3+1+2*x)/2";
47.53 case rewrite_set_ thy false rls t of
47.54 SOME (Const ("Groups.plus_class.plus", _) $ Free ("2", _) $ Free ("x", _), []) => ()
47.55 | _ => error "rewrite_set_ (3+1+2*x)/2 changed";
47.56 @@ -198,7 +198,7 @@
47.57
47.58 (*===================*)
47.59 Rewrite.trace_on:=false; (*WN130722: =true stopped Test_Isac.thy*)
47.60 - val t = (Thm.term_of o the o (parse thy)) "x + (-1 + -3) / 2";
47.61 + val t = (Thm.term_of o the o (TermC.parse thy)) "x + (-1 + -3) / 2";
47.62 val SOME (res, []) = rewrite_set_ thy false rls t;
47.63 if UnparseC.term res = "-2 + x" then () else error "rewrite_set_ x + (-1 + -3) / 2 changed";
47.64 "x + (-4) / 2";
47.65 @@ -221,14 +221,14 @@
47.66 "----------- Prog_Expr.pow Power.power_class.power ---------";
47.67 "----------- Prog_Expr.pow Power.power_class.power ---------";
47.68 val t = (Thm.term_of o the o (parseold thy)) "1 ^ aaa";
47.69 -atomty t;
47.70 +TermC.atomty t;
47.71 (*** -------------
47.72 *** Const ( Nat.power, ['a, nat] => 'a)
47.73 *** . Free ( 1, 'a)
47.74 *** . Free ( aaa, nat) *)
47.75
47.76 -val t = str2term "1 ^^^ aaa";
47.77 -atomty t;
47.78 +val t = TermC.str2term "1 ^^^ aaa";
47.79 +TermC.atomty t;
47.80 (****
47.81 *** Const (Prog_Expr.pow, real => real => real)
47.82 *** . Free (1, real)
47.83 @@ -240,17 +240,17 @@
47.84 " ================= evaluate.sml: calculate_ 2002 =================== ";
47.85
47.86 val thy = @{theory Test};
47.87 -val t = (Thm.term_of o the o (parse thy)) "12 / 3";
47.88 +val t = (Thm.term_of o the o (TermC.parse thy)) "12 / 3";
47.89 val SOME (thmID,thm) = adhoc_thm thy(the(LibraryC.assoc(KEStore_Elems.get_calcs @{theory},"DIVIDE")))t;
47.90 val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
47.91 "12 / 3 = 4";
47.92 val thy = @{theory Test};
47.93 -val t = (Thm.term_of o the o (parse thy)) "4 ^^^ 2";
47.94 +val t = (Thm.term_of o the o (TermC.parse thy)) "4 ^^^ 2";
47.95 val SOME (thmID,thm) = adhoc_thm thy(the(LibraryC.assoc(KEStore_Elems.get_calcs @{theory},"POWER"))) t;
47.96 val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
47.97 "4 ^ 2 = 16";
47.98
47.99 - val t = (Thm.term_of o the o (parse thy)) "((1 + 2) * 4 / 3) ^^^ 2";
47.100 + val t = (Thm.term_of o the o (TermC.parse thy)) "((1 + 2) * 4 / 3) ^^^ 2";
47.101 val SOME (thmID,thm) = adhoc_thm thy (the(LibraryC.assoc(KEStore_Elems.get_calcs @{theory},"PLUS"))) t;
47.102 "1 + 2 = 3";
47.103 val SOME (t,_) = rewrite_ thy tless_true tval_rls true thm t;
47.104 @@ -275,7 +275,7 @@
47.105 else ();
47.106
47.107 (*13.9.02 *** calc: operator = pow not defined*)
47.108 - val t = (Thm.term_of o the o (parse thy)) "3^^^2";
47.109 + val t = (Thm.term_of o the o (TermC.parse thy)) "3^^^2";
47.110 val SOME (thmID,thm) =
47.111 adhoc_thm thy (the(LibraryC.assoc(KEStore_Elems.get_calcs @{theory},"POWER"))) t;
47.112 (*** calc: operator = pow not defined*)
47.113 @@ -302,7 +302,7 @@
47.114 val (thy, op_, ef, arg) =
47.115 (thy, "EqSystem.occur'_exactly'_in",
47.116 assoc_calc' (@{theory "EqSystem"}) "occur_exactly_in" |> snd |> snd,
47.117 - str2term
47.118 + TermC.str2term
47.119 "[] from [c, c_2, c_3, c_4] occur_exactly_in -1 * (q_0 * L ^^^ 2) / 2"
47.120 );
47.121 val SOME (str, simpl) = get_pair thy op_ ef arg;
47.122 @@ -314,7 +314,7 @@
47.123 "----------- calculate (2 * x is_const) -----------------";
47.124 "----------- calculate (2 * x is_const) -----------------";
47.125 "----------- calculate (2 * x is_const) -----------------";
47.126 -val t = str2term "2 * x is_const";
47.127 +val t = TermC.str2term "2 * x is_const";
47.128 val SOME (str, t') = eval_const "" "" t @{theory Test};
47.129 UnparseC.term t';
47.130 "(2 * x is_const) = False";
47.131 @@ -329,36 +329,36 @@
47.132 val thy = @{theory};
47.133 val SOME (isa_str, eval_fn) = LibraryC.assoc (KEStore_Elems.get_calcs @{theory}, "PLUS");
47.134
47.135 -val t = (Thm.term_of o the o (parse thy)) "3 + 4";
47.136 +val t = (Thm.term_of o the o (TermC.parse thy)) "3 + 4";
47.137 val SOME (str, term) = get_pair thy isa_str eval_fn t;
47.138 if str = "#: 3 + 4 = 7" andalso UnparseC.term term = "3 + 4 = 7"
47.139 then () else error "get_pair 3 + 4 changed";
47.140
47.141 -val t = (Thm.term_of o the o (parse thy)) "(a + 3) + 4";
47.142 +val t = (Thm.term_of o the o (TermC.parse thy)) "(a + 3) + 4";
47.143 val SOME (str, term) = get_pair thy isa_str eval_fn t;
47.144 if str = "#: a + 3 + 4 = a + 7" andalso UnparseC.term term = "a + 3 + 4 = a + 7"
47.145 then () else error "get_pair (a + 3) + 4 changed";
47.146
47.147 -val t = (Thm.term_of o the o (parse thy)) "(a + 3) + 4";
47.148 +val t = (Thm.term_of o the o (TermC.parse thy)) "(a + 3) + 4";
47.149 val SOME (str, term) = get_pair thy isa_str eval_fn t;
47.150 if str = "#: a + 3 + 4 = a + 7" andalso UnparseC.term term = "a + 3 + 4 = a + 7"
47.151 then () else error "get_pair (a + 3) + 4 changed";
47.152
47.153 -val t = (Thm.term_of o the o (parse thy)) "x = 5 * (3 + (4 + a))";
47.154 +val t = (Thm.term_of o the o (TermC.parse thy)) "x = 5 * (3 + (4 + a))";
47.155 val SOME (str, term) = get_pair thy isa_str eval_fn t;
47.156 if str = "#: 3 + (4 + a) = 7 + a" andalso UnparseC.term term = "3 + (4 + a) = 7 + a"
47.157 then ((* !!! gets subterm !!!*)) else error "get_pair x = 5 * (3 + (4 + a)) (subterm) changed";
47.158
47.159 val SOME (isa_str, eval_fn) = LibraryC.assoc (KEStore_Elems.get_calcs @{theory}, "DIVIDE");
47.160
47.161 -val t = (Thm.term_of o the o (parse thy)) "-4 / -2";
47.162 +val t = (Thm.term_of o the o (TermC.parse thy)) "-4 / -2";
47.163 val SOME (str, term) = get_pair thy isa_str eval_fn t;
47.164 if str = "#divide_e-4_-2" andalso UnparseC.term term = "-4 / -2 = 2"
47.165 then () else error "get_pair -4 / -2 changed";
47.166
47.167 val SOME (isa_str, eval_fn) = LibraryC.assoc (KEStore_Elems.get_calcs @{theory}, "POWER");
47.168
47.169 -val t = (Thm.term_of o the o (parse thy)) "2 ^^^ 3";
47.170 +val t = (Thm.term_of o the o (TermC.parse thy)) "2 ^^^ 3";
47.171 val SOME (str, term) = get_pair thy isa_str eval_fn t;
47.172 if str = "#: 2 ^^^ 3 = 8" andalso UnparseC.term term = "2 ^^^ 3 = 8"
47.173 then () else error "get_pair 2 ^^^ 3 changed";
48.1 --- a/test/Tools/isac/ProgLang/listC.sml Mon Apr 19 13:57:47 2021 +0200
48.2 +++ b/test/Tools/isac/ProgLang/listC.sml Mon Apr 19 15:02:11 2021 +0200
48.3 @@ -41,28 +41,28 @@
48.4 "--------------------- NTH ---------------------------------------------------";
48.5 val prog_expr = assoc_rls "prog_expr"
48.6
48.7 -val t = str2term "NTH 1 [a,b,c,d,e]";
48.8 -atomty t;
48.9 +val t = TermC.str2term "NTH 1 [a,b,c,d,e]";
48.10 +TermC.atomty t;
48.11 val thm = (Thm.prop_of o ThmC.numerals_to_Free) @{thm NTH_NIL};
48.12 -atomty thm;
48.13 +TermC.atomty thm;
48.14 val SOME (t', _) = rewrite_ thy dummy_ord prog_expr false (ThmC.numerals_to_Free @{thm NTH_NIL}) t;
48.15 if UnparseC.term t' = "a" then ()
48.16 else error "NTH 1 [a,b,c,d,e] = a ..changed";
48.17
48.18 -val t = str2term "NTH 3 [a,b,c,d,e]";
48.19 +val t = TermC.str2term "NTH 3 [a,b,c,d,e]";
48.20 val Const ("ListC.NTH", _) $ Free ("3", _) $ (Const ("List.list.Cons", _) $ Free ("a", _) $
48.21 (Const ("List.list.Cons", _) $ Free ("b", _) $
48.22 (Const _ $ Free _ $ (Const _ $ Free _ $ (Const _ $ Free _ $ Const _))))) = t;
48.23 -atomty t;
48.24 +TermC.atomty t;
48.25 val thm = (Thm.prop_of o ThmC.numerals_to_Free) @{thm NTH_CONS};
48.26 -atomty thm;
48.27 +TermC.atomty thm;
48.28 val SOME (t', _) = rewrite_ thy dummy_ord prog_expr false (ThmC.numerals_to_Free @{thm NTH_CONS}) t;
48.29 if UnparseC.term t' = "NTH (3 + -1) [b, c, d, e]" then ()
48.30 else error "NTH 3 [a,b,c,d,e] = NTH (3 + - 1) [b, c, d, e] ..changed";
48.31
48.32 (* now the argument "(3 + - 1)" etc needs to be evaluated in the assumption of NTH_CONS *)
48.33 -val t = str2term "NTH 3 [a,b,c,d,e]";
48.34 -atomty t;
48.35 +val t = TermC.str2term "NTH 3 [a,b,c,d,e]";
48.36 +TermC.atomty t;
48.37 Rewrite.trace_on := false;
48.38 val SOME (t', _) = rewrite_set_ thy false prog_expr t;
48.39 Rewrite.trace_on := false;
48.40 @@ -75,7 +75,7 @@
48.41 val prog_expr = assoc_rls "prog_expr"
48.42
48.43 val thy = @{theory ListC};
48.44 -val t = str2term "Length [1, 1, 1]";
48.45 +val t = TermC.str2term "Length [1, 1, 1]";
48.46 val SOME (t, asm) = rewrite_ thy tless_true tval_rls false @{thm LENGTH_CONS} t;
48.47 UnparseC.term t = "1 + Length [1, 1]";
48.48 val SOME (t, asm) = rewrite_ thy tless_true tval_rls false @{thm LENGTH_CONS} t;
48.49 @@ -88,12 +88,12 @@
48.50 if UnparseC.term t = "1 + (1 + (1 + 0))" then ()
48.51 else error "Length [1, 1, 1] = 1 + (1 + (1 + 0)) ..changed";
48.52
48.53 -val t = str2term "Length [1, 1, 1]";
48.54 +val t = TermC.str2term "Length [1, 1, 1]";
48.55 val SOME (t, asm) = rewrite_set_ thy false prog_expr t;
48.56 if UnparseC.term t = "3" then ()
48.57 else error "Length [1, 1, 1] = 3 ..prog_expr changed";
48.58
48.59 -val t = str2term "Length [1, 1, 1]";
48.60 +val t = TermC.str2term "Length [1, 1, 1]";
48.61 val t = eval_prog_expr thy prog_expr t;
48.62 case t of Free ("3", _) => ()
48.63 | _ => error "Length [1, 1, 1] = 3 ..eval_prog_expr changed";
49.1 --- a/test/Tools/isac/ProgLang/prog_expr.sml Mon Apr 19 13:57:47 2021 +0200
49.2 +++ b/test/Tools/isac/ProgLang/prog_expr.sml Mon Apr 19 15:02:11 2021 +0200
49.3 @@ -27,20 +27,20 @@
49.4 "-------- fun eval_equal for x \<noteq> 0: \<rightarrow> indetermined, NOT \<rightarrow> 'True' -----------------------------";
49.5 val thy = @{theory}
49.6
49.7 -val t = str2term "x = 0";
49.8 +val t = TermC.str2term "x = 0";
49.9 val NONE(*= indetermined*) = eval_equal "equal_" "HOL.eq" t thy;
49.10
49.11 -val t = str2term "(x + 1) = (x + 1)";
49.12 +val t = TermC.str2term "(x + 1) = (x + 1)";
49.13 val (Const _(*op0,t0*) $ t1 $ t2 ) = t
49.14 val SOME ("equal_(x + 1)_(x + 1)", t') = eval_equal "equal_" "HOL.eq" t thy;
49.15 if UnparseC.term t' = "(x + 1 = x + 1) = True" then () else error "(x + 1) = (x + 1) CHANGED";
49.16
49.17 -val t as Const _ $ v $ c = str2term "1 = 0";
49.18 +val t as Const _ $ v $ c = TermC.str2term "1 = 0";
49.19 val false = variable_constant_pair (v, c);
49.20 val SOME ("equal_(1)_(0)", t') = eval_equal "equal_" "HOL.eq" t thy;
49.21 if UnparseC.term t' = "(1 = 0) = False" then () else error "1 = 0 CHANGED";
49.22
49.23 -val t = str2term "0 = 0";
49.24 +val t = TermC.str2term "0 = 0";
49.25 val SOME ("equal_(0)_(0)", t') = eval_equal "equal_" "HOL.eq" t thy;
49.26 if UnparseC.term t' = "(0 = 0) = True" then () else error "0 = 0 CHANGED";
49.27
49.28 @@ -49,14 +49,14 @@
49.29 "-------- occurs_in ----------------------------------------------------------------------------";
49.30 "-------- occurs_in ----------------------------------------------------------------------------";
49.31 (*=========================================================================*)
49.32 -fun str2t str = (Thm.term_of o the o (parse thy)) str;
49.33 +fun str2t str = (Thm.term_of o the o (TermC.parse thy)) str;
49.34 fun term2s t = UnparseC.term_in_thy thy t;
49.35 (*=========================================================================*)
49.36
49.37 val t = str2t "x";
49.38 if occurs_in t t then "OK" else error "occurs_in x x -> f ..changed";
49.39
49.40 -val t = str2term "x occurs_in x";
49.41 +val t = TermC.str2term "x occurs_in x";
49.42 val SOME (str, t') = eval_occurs_in 0 "Prog_Expr.occurs'_in" t 0;
49.43 if UnparseC.term t' = "x occurs_in x = True" then ()
49.44 else error "x occurs_in x = True ..changed";
49.45 @@ -81,91 +81,91 @@
49.46 "-------- fun eval_occurs_in -------------------------------------------------------------------";
49.47 "-------- fun eval_occurs_in -------------------------------------------------------------------";
49.48 "-------- fun eval_occurs_in -------------------------------------------------------------------";
49.49 -val v = (Thm.term_of o the o (parse thy)) "x";
49.50 -val t = (Thm.term_of o the o (parse thy)) "1";
49.51 +val v = (Thm.term_of o the o (TermC.parse thy)) "x";
49.52 +val t = (Thm.term_of o the o (TermC.parse thy)) "1";
49.53 if occurs_in v t then error "factor_right_deg (1) x ..changed" else ();
49.54
49.55 -val v = (Thm.term_of o the o (parse thy)) "AA";
49.56 -val t = (Thm.term_of o the o (parse thy)) "1";
49.57 +val v = (Thm.term_of o the o (TermC.parse thy)) "AA";
49.58 +val t = (Thm.term_of o the o (TermC.parse thy)) "1";
49.59 if occurs_in v t then error "factor_right_deg (1) AA ..changed" else ();
49.60
49.61 (*----------*)
49.62 -val v = (Thm.term_of o the o (parse thy)) "x";
49.63 -val t = (Thm.term_of o the o (parse thy)) "a*b+c";
49.64 +val v = (Thm.term_of o the o (TermC.parse thy)) "x";
49.65 +val t = (Thm.term_of o the o (TermC.parse thy)) "a*b+c";
49.66 if occurs_in v t then error "factor_right_deg (a*b+c) x ..changed" else ();
49.67
49.68 -val v = (Thm.term_of o the o (parse thy)) "AA";
49.69 -val t = (Thm.term_of o the o (parse thy)) "a*b+c";
49.70 +val v = (Thm.term_of o the o (TermC.parse thy)) "AA";
49.71 +val t = (Thm.term_of o the o (TermC.parse thy)) "a*b+c";
49.72 if occurs_in v t then error "factor_right_deg (a*b+c) AA ..changed" else ();
49.73
49.74 (*----------*)
49.75 -val v = (Thm.term_of o the o (parse thy)) "x";
49.76 -val t = (Thm.term_of o the o (parse thy)) "a*x+c";
49.77 +val v = (Thm.term_of o the o (TermC.parse thy)) "x";
49.78 +val t = (Thm.term_of o the o (TermC.parse thy)) "a*x+c";
49.79 if occurs_in v t then () else error "factor_right_deg (a*x+c) x ..changed";
49.80
49.81 -val v = (Thm.term_of o the o (parse thy)) "AA";
49.82 -val t = (Thm.term_of o the o (parse thy)) "a*AA+c";
49.83 +val v = (Thm.term_of o the o (TermC.parse thy)) "AA";
49.84 +val t = (Thm.term_of o the o (TermC.parse thy)) "a*AA+c";
49.85 if occurs_in v t then () else error "factor_right_deg (a*AA+c) AA ..changed";
49.86
49.87 (*----------*)
49.88 -val v = (Thm.term_of o the o (parse thy)) "x";
49.89 -val t = (Thm.term_of o the o (parse thy)) "(a*b+c)*x^^^7";
49.90 +val v = (Thm.term_of o the o (TermC.parse thy)) "x";
49.91 +val t = (Thm.term_of o the o (TermC.parse thy)) "(a*b+c)*x^^^7";
49.92 if occurs_in v t then () else error "factor_right_deg (a*b+c)*x^^^7) x ..changed";
49.93
49.94 -val v = (Thm.term_of o the o (parse thy)) "AA";
49.95 -val t = (Thm.term_of o the o (parse thy)) "(a*b+c)*AA^^^7";
49.96 +val v = (Thm.term_of o the o (TermC.parse thy)) "AA";
49.97 +val t = (Thm.term_of o the o (TermC.parse thy)) "(a*b+c)*AA^^^7";
49.98 if occurs_in v t then () else error "factor_right_deg (a*b+c)*AA^^^7) AA ..changed";
49.99
49.100 (*----------*)
49.101 -val v = (Thm.term_of o the o (parse thy)) "x";
49.102 -val t = (Thm.term_of o the o (parse thy)) "x^^^7";
49.103 +val v = (Thm.term_of o the o (TermC.parse thy)) "x";
49.104 +val t = (Thm.term_of o the o (TermC.parse thy)) "x^^^7";
49.105 if occurs_in v t then () else error "factor_right_deg (x^^^7) x ..changed";
49.106
49.107 -val v = (Thm.term_of o the o (parse thy)) "AA";
49.108 -val t = (Thm.term_of o the o (parse thy)) "AA^^^7";
49.109 +val v = (Thm.term_of o the o (TermC.parse thy)) "AA";
49.110 +val t = (Thm.term_of o the o (TermC.parse thy)) "AA^^^7";
49.111 if occurs_in v t then () else error "factor_right_deg (AA^^^7) AA ..changed";
49.112
49.113 (*----------*)
49.114 -val v = (Thm.term_of o the o (parse thy)) "x";
49.115 -val t = (Thm.term_of o the o (parse thy)) "(a*b+c)*x";
49.116 +val v = (Thm.term_of o the o (TermC.parse thy)) "x";
49.117 +val t = (Thm.term_of o the o (TermC.parse thy)) "(a*b+c)*x";
49.118 if occurs_in v t then () else error "factor_right_deg ((a*b+c)*x) x ..changed";
49.119
49.120 -val v = (Thm.term_of o the o (parse thy)) "AA";
49.121 -val t = (Thm.term_of o the o (parse thy)) "(a*b+c)*AA";
49.122 +val v = (Thm.term_of o the o (TermC.parse thy)) "AA";
49.123 +val t = (Thm.term_of o the o (TermC.parse thy)) "(a*b+c)*AA";
49.124 if occurs_in v t then () else error "factor_right_deg ((a*b+c)*AA) AA ..changed";
49.125
49.126 (*----------*)
49.127 -val v = (Thm.term_of o the o (parse thy)) "x";
49.128 -val t = (Thm.term_of o the o (parse thy)) "(a*b+x)*x";
49.129 +val v = (Thm.term_of o the o (TermC.parse thy)) "x";
49.130 +val t = (Thm.term_of o the o (TermC.parse thy)) "(a*b+x)*x";
49.131 if occurs_in v t then () else error "factor_right_deg ((a*b+x)*x) x ..changed";
49.132
49.133 -val v = (Thm.term_of o the o (parse thy)) "AA";
49.134 -val t = (Thm.term_of o the o (parse thy)) "(a*b+AA)*AA";
49.135 +val v = (Thm.term_of o the o (TermC.parse thy)) "AA";
49.136 +val t = (Thm.term_of o the o (TermC.parse thy)) "(a*b+AA)*AA";
49.137 if occurs_in v t then () else error "factor_right_deg ((a*b+AA)*AA) AA ..changed";
49.138
49.139 (*----------*)
49.140 -val v = (Thm.term_of o the o (parse thy)) "x";
49.141 -val t = (Thm.term_of o the o (parse thy)) "x";
49.142 +val v = (Thm.term_of o the o (TermC.parse thy)) "x";
49.143 +val t = (Thm.term_of o the o (TermC.parse thy)) "x";
49.144 if occurs_in v t then () else error "factor_right_deg (x) x ..changed";
49.145
49.146 -val v = (Thm.term_of o the o (parse thy)) "AA";
49.147 -val t = (Thm.term_of o the o (parse thy)) "AA";
49.148 +val v = (Thm.term_of o the o (TermC.parse thy)) "AA";
49.149 +val t = (Thm.term_of o the o (TermC.parse thy)) "AA";
49.150 if occurs_in v t then () else error "factor_right_deg (AA) AA ..changed";
49.151
49.152 (*----------*)
49.153 -val v = (Thm.term_of o the o (parse thy)) "x";
49.154 -val t = (Thm.term_of o the o (parse thy)) "ab - (a*b)*x";
49.155 +val v = (Thm.term_of o the o (TermC.parse thy)) "x";
49.156 +val t = (Thm.term_of o the o (TermC.parse thy)) "ab - (a*b)*x";
49.157 if occurs_in v t then () else error "factor_right_deg (ab - (a*b)*x) x ..changed";
49.158
49.159 -val v = (Thm.term_of o the o (parse thy)) "AA";
49.160 -val t = (Thm.term_of o the o (parse thy)) "ab - (a*b)*AA";
49.161 +val v = (Thm.term_of o the o (TermC.parse thy)) "AA";
49.162 +val t = (Thm.term_of o the o (TermC.parse thy)) "ab - (a*b)*AA";
49.163 if occurs_in v t then () else error "factor_right_deg (ab - (a*b)*AA) AA ..changed";
49.164
49.165
49.166 "---------fun eval_argument_of -----------------------------------------------------------------";
49.167 "---------fun eval_argument_of -----------------------------------------------------------------";
49.168 "---------fun eval_argument_of -----------------------------------------------------------------";
49.169 -val t = str2term "argument_in (M_b x)";
49.170 +val t = TermC.str2term "argument_in (M_b x)";
49.171 val SOME (str, t') = eval_argument_in "0" "Prog_Expr.argument'_in" t 0;
49.172 if UnparseC.term t' = "(argument_in M_b x) = x" then ()
49.173 else error "atools.sml:(argument_in M_b x) = x ???";
49.174 @@ -174,7 +174,7 @@
49.175 "---------fun eval_sameFunId -------------------------------------------------------------------";
49.176 "---------fun eval_sameFunId -------------------------------------------------------------------";
49.177 "---------fun eval_sameFunId -------------------------------------------------------------------";
49.178 -val t = str2t "M_b L"; atomty t;
49.179 +val t = str2t "M_b L"; TermC.atomty t;
49.180 val t as f1 $ _ = str2t "M_b L";
49.181 val t as Const ("HOL.eq", _) $ (f2 $ _) $ _ = str2t "M_b x = c + L*x";
49.182 f1 = f2 (*true*);
49.183 @@ -244,7 +244,7 @@
49.184 "---------fun eval_binop -----------------------------------------------------------------------";
49.185 "---------fun eval_binop -----------------------------------------------------------------------";
49.186 val (op_, ef) = the (LibraryC.assoc (KEStore_Elems.get_calcs @{theory}, "TIMES"));
49.187 -val t = (Thm.term_of o the o (parse thy)) "2 * 3";
49.188 +val t = (Thm.term_of o the o (TermC.parse thy)) "2 * 3";
49.189 (*val SOME (thmid,t') = *)get_pair thy op_ ef t;
49.190 ;
49.191 "~~~~~ fun get_pair, args:"; val (thy, op_, ef, (t as (Const (op0,_) $ t1 $ t2))) =
49.192 @@ -255,7 +255,7 @@
49.193 "~~~~~ fun eval_binop, args:"; val ((thmid : string), (op_: string),
49.194 (t as (Const (op0, t0) $ t1 $ t2)), _) = ("#mult_", op_, t, thy); (* binary . n1.(n2.v) *)
49.195 val (SOME n1, SOME n2) = (numeral t1, numeral t2)
49.196 - val (_, _, Trange) = dest_binop_typ t0;
49.197 + val (_, _, Trange) = TermC.dest_binop_typ t0;
49.198 val res = calcul op0 n1 n2;
49.199 val rhs = term_of_float Trange res;
49.200 val prop = HOLogic.Trueprop $ (mk_equality (t, rhs));
49.201 @@ -272,10 +272,10 @@
49.202 "-------- fun matchsub -------------------------------------------------------------------------";
49.203 "-------- fun matchsub -------------------------------------------------------------------------";
49.204 "-------- fun matchsub -------------------------------------------------------------------------";
49.205 -if matchsub thy (str2term "(a + (b + c))") (str2term "?x + (?y + ?z)")
49.206 +if matchsub thy (TermC.str2term "(a + (b + c))") (TermC.str2term "?x + (?y + ?z)")
49.207 then () else error "tools.sml matchsub a + (b + c)";
49.208
49.209 -if matchsub thy (str2term "(a + (b + c)) + d") (str2term "?x + (?y + ?z)")
49.210 +if matchsub thy (TermC.str2term "(a + (b + c)) + d") (TermC.str2term "?x + (?y + ?z)")
49.211 then () else error "tools.sml matchsub (a + (b + c)) + d";
49.212
49.213
49.214 @@ -287,9 +287,9 @@
49.215 | _ => error "TermC.UniversalList changed 1";
49.216 case or2list @{term False} of Const ("List.list.Nil", _) => ()
49.217 | _ => error "TermC.UniversalList changed 2";
49.218 -val t = (str2term "x=3");
49.219 +val t = (TermC.str2term "x=3");
49.220 if UnparseC.term (or2list t) = "[x = 3]" then ()
49.221 else error "or2list changed";
49.222 -val t = (str2term "x=3 | x=-3 | x=0");
49.223 +val t = (TermC.str2term "x=3 | x=-3 | x=0");
49.224 if UnparseC.term (or2list t) = "[x = 3, x = -3, x = 0]" then ()
49.225 else error "HOL.eq ? HOL.disj ? changed";
50.1 --- a/test/Tools/isac/Specify/m-match.sml Mon Apr 19 13:57:47 2021 +0200
50.2 +++ b/test/Tools/isac/Specify/m-match.sml Mon Apr 19 15:02:11 2021 +0200
50.3 @@ -31,7 +31,7 @@
50.4 Correct "solveFor x",
50.5 Superfl "errorBound (eps = 0)"],
50.6 Relate = [],
50.7 - Where = [Correct "matches (?a = ?b) (sqrt (9 + 4 * x) = sqrt x + sqrt (5 + x))"],
50.8 + Where = [Correct "TermC.matches (?a = ?b) (sqrt (9 + 4 * x) = sqrt x + sqrt (5 + x))"],
50.9 With = []} => ()
50.10 | _ => error "M_Match.match_pbl CHANGED";
50.11
50.12 @@ -60,7 +60,7 @@
50.13 Free (dI',_) $
50.14 (Const ("Product_Type.Pair",_) $ pI' $ mI')) $ ags' =
50.15 (*...copied from LItool.tac_from_prog*)
50.16 - str2term (
50.17 + TermC.str2term (
50.18 "SubProblem (EqSystemX, [LINEAR, system], [no_met]) " ^
50.19 " [BOOL_LIST [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]," ^
50.20 " REAL_LIST [c, c_2]]");
50.21 @@ -85,7 +85,7 @@
50.22 Free (dI',_) $
50.23 (Const ("Product_Type.Pair",_) $ pI' $ mI')) $ ags' =
50.24 (*...copied from LItool.tac_from_prog*)
50.25 - str2term (
50.26 + TermC.str2term (
50.27 "SubProblem (EqSystemX, [LINEAR, system], [no_met]) " ^
50.28 " [BOOL_LIST [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]," ^
50.29 " REAL_LIST [c, c_2], BOOL_LIST ss''']");
50.30 @@ -111,7 +111,7 @@
50.31 Free (dI',_) $
50.32 (Const ("Product_Type.Pair",_) $ pI' $ mI')) $ ags' =
50.33 (*...copied from LItool.tac_from_prog*)
50.34 - str2term (
50.35 + TermC.str2term (
50.36 "SubProblem (EqSystemX, [LINEAR, system], [no_met]) " ^
50.37 " [REAL_LIST [c, c_2]]");
50.38 val ags = isalist2list ags';
50.39 @@ -151,7 +151,7 @@
50.40 Free (dI',_) $
50.41 (Const ("Product_Type.Pair",_) $ pI' $ mI')) $ ags' =
50.42 (*...copied from LItool.tac_from_prog*)
50.43 - str2term (
50.44 + TermC.str2term (
50.45 "SubProblem (EqSystemX, [LINEAR, system], [no_met]) " ^
50.46 " [BOOL_LIST [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]," ^
50.47 " REAL_LIST [c, c_2]]");
50.48 @@ -176,7 +176,7 @@
50.49 Free (dI',_) $
50.50 (Const ("Product_Type.Pair",_) $ pI' $ mI')) $ ags' =
50.51 (*...copied from LItool.tac_from_prog*)
50.52 - str2term (
50.53 + TermC.str2term (
50.54 "SubProblem (EqSystemX, [LINEAR, system], [no_met]) " ^
50.55 " [BOOL_LIST [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]," ^
50.56 " REAL_LIST [c, c_2], BOOL_LIST ss''']");
50.57 @@ -202,7 +202,7 @@
50.58 Free (dI',_) $
50.59 (Const ("Product_Type.Pair",_) $ pI' $ mI')) $ ags' =
50.60 (*...copied from LItool.tac_from_prog*)
50.61 - str2term (
50.62 + TermC.str2term (
50.63 "SubProblem (EqSystemX, [LINEAR, system], [no_met]) " ^
50.64 " [REAL_LIST [c, c_2]]");
50.65 val ags = isalist2list ags';
50.66 @@ -247,7 +247,7 @@
50.67 Free (dI',_) $
50.68 (Const ("Product_Type.Pair",_) $ pI' $ mI')) $ ags' =
50.69 (*...copied from LItool.tac_from_prog*)
50.70 - str2term (
50.71 + TermC.str2term (
50.72 "SubProblem (TestX,[univariate,equation,test]," ^
50.73 " [no_met]) [BOOL (x+1=2), REAL x]");
50.74 val AGS = isalist2list ags';
50.75 @@ -265,7 +265,7 @@
50.76 Free (dI',_) $
50.77 (Const ("Product_Type.Pair",_) $ pI' $ mI')) $ ags' =
50.78 (*...copied from LItool.tac_from_prog*)
50.79 - str2term (
50.80 + TermC.str2term (
50.81 "SubProblem (TestX,[univariate,equation,test]," ^
50.82 " [no_met]) [BOOL (x+1=2), REAL x]");
50.83 val AGS = isalist2list ags';
51.1 --- a/test/Tools/isac/Specify/o-model.sml Mon Apr 19 13:57:47 2021 +0200
51.2 +++ b/test/Tools/isac/Specify/o-model.sml Mon Apr 19 15:02:11 2021 +0200
51.3 @@ -236,7 +236,7 @@
51.4 val pbt = [("#Given", (@{term "equality"}, @{term "e_e :: bool"})),
51.5 ("#Given", (@{term "solveFor"}, @{term "v_v :: real"} ))];
51.6 (*the model specific for an example*)
51.7 -val oris = [([1], "#Given", @{term "equality"} , [str2term "x+1= 2"]),
51.8 +val oris = [([1], "#Given", @{term "equality"} , [TermC.str2term "x+1= 2"]),
51.9 ([1], "#Given", @{term "solveFor"} , [@{term "x :: real"} ])];
51.10 val cy = [("#Find", (@{term "solutions"}, @{term "v_v'i' :: bool list"}))];
51.11 (*...all must be true*)
51.12 @@ -253,7 +253,7 @@
51.13 val pbt = [("#Given", (@{term "equalities"}, @{term "e_s :: bool list"})),
51.14 ("#Given", (@{term "solveForVars v_s"}, @{term "v_s :: bool list"} ))];
51.15 (*the model specific for an example*)
51.16 -val oris = [([1], "#Given", @{term "equalities"} ,[str2term "[x_1+1=2,x_2=0]"]),
51.17 +val oris = [([1], "#Given", @{term "equalities"} ,[TermC.str2term "[x_1+1=2,x_2=0]"]),
51.18 ([1], "#Given", @{term "solveForVars"} , [@{term "[x_1,x_2]::real list"}])];
51.19 val cy = [("#Find", (@{term "solution"}, @{term "ss''' :: bool list"}))
51.20 (*could be more than 1*)];
52.1 --- a/test/Tools/isac/Specify/refine.sml Mon Apr 19 13:57:47 2021 +0200
52.2 +++ b/test/Tools/isac/Specify/refine.sml Mon Apr 19 15:02:11 2021 +0200
52.3 @@ -346,7 +346,7 @@
52.4 Where = [False www(*! ! ! ! ! !*)],
52.5 Relate = [],...}) => www(*! ! !*)
52.6 | _ => error "--- Refine_Problem broken 1";
52.7 -if www = "matches (x = 0) ((x + 1) * (x + 2) = x ^^^ 2 + 8) \<or>\nmatches (?b * x = 0) ((x + 1) * (x + 2) = x ^^^ 2 + 8) \<or>\nmatches (?a + x = 0) ((x + 1) * (x + 2) = x ^^^ 2 + 8) \<or>\nmatches (?a + ?b * x = 0) ((x + 1) * (x + 2) = x ^^^ 2 + 8)"
52.8 +if www = "TermC.matches (x = 0) ((x + 1) * (x + 2) = x ^^^ 2 + 8) \<or>\nmatches (?b * x = 0) ((x + 1) * (x + 2) = x ^^^ 2 + 8) \<or>\nmatches (?a + x = 0) ((x + 1) * (x + 2) = x ^^^ 2 + 8) \<or>\nmatches (?a + ?b * x = 0) ((x + 1) * (x + 2) = x ^^^ 2 + 8)"
52.9 then () else error "--- Refine_Problem broken 2";
52.10 (*ML> f;
52.11 val it = Form' (Test_Out.PpcKF (0,EdUndef,0,Nundef,
52.12 @@ -354,7 +354,7 @@
52.13 {Find=[Incompl "solutions []"],
52.14 Given=[Correct "equality ((x + #1) * (x + #2) = x ^^^ #2 + #8)",
52.15 Correct "solveFor x"],Relate=[],
52.16 - Where=[False "matches (x = #0) ((x + #1) * (x + #2) = x ^^^ #2 + #8)
52.17 + Where=[False "TermC.matches (x = #0) ((x + #1) * (x + #2) = x ^^^ #2 + #8)
52.18 |\nmatches (?b * x = #0) ((x + #1) * (x + #2) = x ^^^ #2 + #8)
52.19 |\nmatches (?a + x = #0) ((x + #1) * (x + #2) = x ^^^ #2 + #8)
52.20 |\nmatches (?a + ?b * x = #0) ((x + #1) * (x + #2) = x ^^^ #2 + #8)"],
52.21 @@ -420,11 +420,11 @@
52.22 (*if*) not preok (*then*);
52.23
52.24 (*+*)Pre_Conds.to_string xxxxx = "[\n" ^
52.25 - "(false, matches (x = 0) ((x + 1) * (x + 2) = x ^^^ 2 + 8) \<or>\n" ^
52.26 - "matches (?b * x = 0) ((x + 1) * (x + 2) = x ^^^ 2 + 8) \<or>\n" ^
52.27 - "matches (?a + x = 0) ((x + 1) * (x + 2) = x ^^^ 2 + 8) \<or>\n" ^
52.28 - "matches (?a + ?b * x = 0) ((x + 1) * (x + 2) = x ^^^ 2 + 8))]";
52.29 - (*matches ^^^^^^^^^^^^^^^^ NONE, ok: why then NONE = Refine.problem below?*)
52.30 + "(false, TermC.matches (x = 0) ((x + 1) * (x + 2) = x ^^^ 2 + 8) \<or>\n" ^
52.31 + "TermC.matches (?b * x = 0) ((x + 1) * (x + 2) = x ^^^ 2 + 8) \<or>\n" ^
52.32 + "TermC.matches (?a + x = 0) ((x + 1) * (x + 2) = x ^^^ 2 + 8) \<or>\n" ^
52.33 + "TermC.matches (?a + ?b * x = 0) ((x + 1) * (x + 2) = x ^^^ 2 + 8))]";
52.34 + (*TermC.matches ^^^^^^^^^^^^^^^^ NONE, ok: why then NONE = Refine.problem below?*)
52.35 (*-------------------- stop step into find_next_step ----------------------------------------*)
52.36 (*+ continue after find_next_step*)val (p_', tac) = (p_'_'''''_', tac'''''_')
52.37 (*\------------------- step into find_next_step --------------------------------------------/*)
53.1 --- a/test/Tools/isac/Test_Code/test-code.sml Mon Apr 19 13:57:47 2021 +0200
53.2 +++ b/test/Tools/isac/Test_Code/test-code.sml Mon Apr 19 15:02:11 2021 +0200
53.3 @@ -47,6 +47,6 @@
53.4
53.5 if p = ([], Res) andalso f2str t = "[x = 1]" andalso
53.6 eq_set op = (get_ctxt pt p |> get_assumptions |> map UnparseC.term,
53.7 - ["precond_rootmet x", "matches (?a = ?b) (-1 + x = 0)", "x = 1"])
53.8 + ["precond_rootmet x", "TermC.matches (?a = ?b) (-1 + x = 0)", "x = 1"])
53.9 then case nxt of End_Proof' => () | _ => error "fun me_trace all Minisubpbl CHANGED 1"
53.10 else error "fun me_trace all Minisubpbl CHANGED 2";
54.1 --- a/test/Tools/isac/Test_Isac_Short.thy Mon Apr 19 13:57:47 2021 +0200
54.2 +++ b/test/Tools/isac/Test_Isac_Short.thy Mon Apr 19 15:02:11 2021 +0200
54.3 @@ -197,6 +197,18 @@
54.4 (*called by Know_Store..*)
54.5 ML_file "BaseDefinitions/calcelems.sml"
54.6 ML_file "BaseDefinitions/termC.sml"
54.7 +ML \<open>
54.8 +\<close> ML \<open>
54.9 +\<close> ML \<open>
54.10 +\<close> ML \<open>
54.11 +\<close> ML \<open>
54.12 +\<close> ML \<open>
54.13 +\<close> ML \<open>
54.14 +\<close> ML \<open>
54.15 +\<close> ML \<open>
54.16 +\<close> ML \<open>
54.17 +\<close> ML \<open>
54.18 +\<close>
54.19 ML_file "BaseDefinitions/substitution.sml"
54.20 ML_file "BaseDefinitions/contextC.sml"
54.21 ML_file "BaseDefinitions/environment.sml"