1.1 --- a/src/Tools/isac/BaseDefinitions/termC.sml Sun Oct 09 06:53:03 2022 +0200
1.2 +++ b/src/Tools/isac/BaseDefinitions/termC.sml Sun Oct 09 07:44:22 2022 +0200
1.3 @@ -589,7 +589,7 @@
1.4 fun parse_patt_test thy str = (thy, str)
1.5 |>> Proof_Context.init_global
1.6 |-> Proof_Context.read_term_pattern
1.7 -(**)|> typ_a2real; (** )TODO drop*)
1.8 + |> Model_Pattern.adapt_term_to_type (Proof_Context.init_global thy)
1.9 fun str2term str = parse_patt (ThyC.get_theory "Isac_Knowledge") str
1.10
1.11
2.1 --- a/test/Tools/isac/ADDTESTS/All_Ctxt.thy Sun Oct 09 06:53:03 2022 +0200
2.2 +++ b/test/Tools/isac/ADDTESTS/All_Ctxt.thy Sun Oct 09 07:44:22 2022 +0200
2.3 @@ -116,8 +116,8 @@
2.4 ML \<open>
2.5 "artifically inject assumptions";
2.6 val (SOME (iform, cform), SOME (ires, cres)) = Ctree.get_obj Ctree.g_loc pt (fst p);
2.7 - val ctxt = ContextC.insert_assumptions [TermC.str2term "x < sub_asm_out",
2.8 - TermC.str2term "a < sub_asm_local"] cres;
2.9 + val ctxt = ContextC.insert_assumptions [TermC.parse_test @{context} "x < sub_asm_out",
2.10 + TermC.parse_test @{context} "a < sub_asm_local"] cres;
2.11 val pt = Ctree.update_loc' pt (fst p) (SOME (iform, cform), SOME (ires, ctxt));
2.12 \<close>
2.13
3.1 --- a/test/Tools/isac/ADDTESTS/course/CADGME/example_2.thy Sun Oct 09 06:53:03 2022 +0200
3.2 +++ b/test/Tools/isac/ADDTESTS/course/CADGME/example_2.thy Sun Oct 09 07:44:22 2022 +0200
3.3 @@ -43,7 +43,7 @@
3.4 text\<open>Apply the Ruleset to a term\<close>
3.5
3.6 ML \<open>
3.7 - val t = str2term "z / (z - 1) + z / (z - \<alpha>) + 1::real";
3.8 + val t = parse_test @{context} "z / (z - 1) + z / (z - \<alpha>) + 1::real";
3.9 val SOME (t', asm) = rewrite_set_ thy true transform t;
3.10 \<close>
3.11
4.1 --- a/test/Tools/isac/ADDTESTS/course/SignalProcess/Build_Inverse_Z_Transform.thy Sun Oct 09 06:53:03 2022 +0200
4.2 +++ b/test/Tools/isac/ADDTESTS/course/SignalProcess/Build_Inverse_Z_Transform.thy Sun Oct 09 07:44:22 2022 +0200
4.3 @@ -80,7 +80,7 @@
4.4 ];
4.5
4.6 \<close> ML \<open>
4.7 - val t = TermC.str2term "z / (z - 1) + z / (z - \<alpha>) + 1::real";
4.8 + val t = TermC.parse_test @{context} "z / (z - 1) + z / (z - \<alpha>) + 1::real";
4.9 \<close> ML \<open>
4.10 val SOME (t', asm) = Rewrite.rewrite_set_ thy true inverse_Z t;
4.11 (*rewrite__set_ called with 'Erls' for '|| z || < 1'*)
4.12 @@ -408,17 +408,17 @@
4.13 probably keep these test in test/Tools/isac/...
4.14 (*mk_prod TermC.empty [];*)
4.15
4.16 -val prod = mk_prod TermC.empty [str2term "x + 123"];
4.17 +val prod = mk_prod TermC.empty [parse_test @{context} "x + 123"];
4.18 UnparseC.term prod = "x + 123";
4.19
4.20 -val sol = str2term "[z = 1 / 2, z = -1 / 4]";
4.21 +val sol = parse_test @{context} "[z = 1 / 2, z = -1 / 4]";
4.22 val sols = HOLogic.dest_list sol;
4.23 val facs = map fac_from_sol sols;
4.24 val prod = mk_prod TermC.empty facs;
4.25 UnparseC.term prod = "(z + -1 * (1 / 2)) * (z + -1 * (-1 / 4))";
4.26
4.27 val prod =
4.28 - mk_prod TermC.empty [str2term "x + 1", str2term "x + 2", str2term "x + 3"];
4.29 + mk_prod TermC.empty [parse_test @{context} "x + 1", parse_test @{context} "x + 2", parse_test @{context} "x + 3"];
4.30 UnparseC.term prod = "(x + 1) * (x + 2) * (x + 3)";
4.31 *} *)
4.32 ML \<open>
4.33 @@ -427,7 +427,7 @@
4.34 in mk_prod TermC.empty (map fac_from_sol ts) end;
4.35 \<close>
4.36 (* ML {*
4.37 -val sol = str2term "[z = 1 / 2, z = -1 / 4]";
4.38 +val sol = parse_test @{context} "[z = 1 / 2, z = -1 / 4]";
4.39 val fs = factors_from_solution sol;
4.40 UnparseC.term fs = "(z + -1 * (1 / 2)) * (z + -1 * (-1 / 4))"
4.41 *} *)
5.1 --- a/test/Tools/isac/ADDTESTS/course/ml_quickstart/ML4_Datastructure.thy Sun Oct 09 06:53:03 2022 +0200
5.2 +++ b/test/Tools/isac/ADDTESTS/course/ml_quickstart/ML4_Datastructure.thy Sun Oct 09 07:44:22 2022 +0200
5.3 @@ -41,8 +41,8 @@
5.4
5.5 section \<open>Preview to Isabelle's terms\<close>
5.6 ML \<open>
5.7 -str2term;
5.8 -str2term "234 * bbb + ccc";
5.9 +parse_test @{context};
5.10 +parse_test @{context} "234 * bbb + ccc";
5.11 \<close>
5.12
5.13 ML \<open>
6.1 --- a/test/Tools/isac/BaseDefinitions/calcelems.sml Sun Oct 09 06:53:03 2022 +0200
6.2 +++ b/test/Tools/isac/BaseDefinitions/calcelems.sml Sun Oct 09 07:44:22 2022 +0200
6.3 @@ -154,7 +154,7 @@
6.4 "----------- fun subst2str' --------------------------------------------------------------------";
6.5 "----------- fun subst2str' --------------------------------------------------------------------";
6.6 "----------- fun subst2str' --------------------------------------------------------------------";
6.7 -(*> subst2str' [(TermC.str2term "bdv", TermC.str2term "x"),
6.8 - (TermC.str2term "bdv_2", TermC.str2term "y")];
6.9 +(*> subst2str' [(TermC.parse_test @{context} "bdv", TermC.parse_test @{context} "x"),
6.10 + (TermC.parse_test @{context} "bdv_2", TermC.parse_test @{context} "y")];
6.11 val it = "[(bdv, x)]" : string
6.12 *)
7.1 --- a/test/Tools/isac/BaseDefinitions/contextC.sml Sun Oct 09 06:53:03 2022 +0200
7.2 +++ b/test/Tools/isac/BaseDefinitions/contextC.sml Sun Oct 09 07:44:22 2022 +0200
7.3 @@ -64,9 +64,9 @@
7.4 "----------- fun transfer_asms_from_to ---------------------------------------------------------";
7.5 val ctxt = Proof_Context.init_global @{theory "Isac_Knowledge"}
7.6 val from_ctxt = ContextC.insert_assumptions
7.7 - [TermC.str2term "a < (fro::int)", TermC.str2term "b < (fro::int)"] ctxt
7.8 + [TermC.parse_test @{context} "a < (fro::int)", TermC.parse_test @{context} "b < (fro::int)"] ctxt
7.9 val to_ctxt = ContextC.insert_assumptions
7.10 - [TermC.str2term "b < (to::int)", TermC.str2term "c < (to::int)"] ctxt
7.11 + [TermC.parse_test @{context} "b < (to::int)", TermC.parse_test @{context} "c < (to::int)"] ctxt
7.12 val new_ctxt = transfer_asms_from_to from_ctxt to_ctxt;
7.13 if UnparseC.terms_to_strings (get_assumptions new_ctxt) = ["b < fro", "b < to", "c < to"]
7.14 then () else error "fun transfer_asms_from_to changed"
7.15 @@ -76,34 +76,34 @@
7.16 "----------- fun avoid_contradict --------------------------------------------------------------";
7.17 "----------- fun avoid_contradict --------------------------------------------------------------";
7.18 val preds = [
7.19 -(*0.pre*)TermC.str2term "x / (x \<up> 2 - 6 * x + 9) - 1 / (x \<up> 2 - 3 * x) =\n1 / x is_ratequation_in x",
7.20 -(*1.pre*)TermC.str2term ("\<not> matches (?a = 0)\n ((3 + - 1 * x + x \<up> 2) * x =\n 1 * (9 * x + -6 * x \<up> 2 + x \<up> 3)) \<or>\n"
7.21 +(*0.pre*)TermC.parse_test @{context} "x / (x \<up> 2 - 6 * x + 9) - 1 / (x \<up> 2 - 3 * x) =\n1 / x is_ratequation_in x",
7.22 +(*1.pre*)TermC.parse_patt_test @{theory} ("\<not> matches (?a = 0)\n ((3 + - 1 * x + x \<up> 2) * x =\n 1 * (9 * x + -6 * x \<up> 2 + x \<up> 3)) \<or>\n"
7.23 (*1.pre*) ^ "\<not> lhs ((3 + - 1 * x + x \<up> 2) * x =\n 1 * (9 * x + -6 * x \<up> 2 + x \<up> 3)) is_poly_in x"),
7.24 -(*0.asm*)TermC.str2term "x \<noteq> 0", (* <-------------- "x \<noteq> 0" would contradict "x = 0" ---\*)
7.25 -(*0.asm*)TermC.str2term "9 * x + -6 * x \<up> 2 + x \<up> 3 \<noteq> 0"
7.26 +(*0.asm*)TermC.parse_test @{context} "x \<noteq> 0", (* <-------------- "x \<noteq> 0" would contradict "x = 0" ---\*)
7.27 +(*0.asm*)TermC.parse_test @{context} "9 * x + -6 * x \<up> 2 + x \<up> 3 \<noteq> 0"
7.28 ];
7.29
7.30 -val t = TermC.str2term "[x = 0, x = 6 / 5]";
7.31 +val t = TermC.parse_test @{context} "[x = 0, x = 6 / 5]";
7.32 val (t', for_asm) = avoid_contradict t preds;
7.33 if UnparseC.term t' = "[x = 6 / 5]" andalso map UnparseC.term for_asm = ["x = 6 / 5"]
7.34 then () else error "avoid_contradict [x = 0, x = 6 / 5] CHANGED";
7.35
7.36 -val t = TermC.str2term "x = 0";
7.37 +val t = TermC.parse_test @{context} "x = 0";
7.38 val (t', for_asm) = avoid_contradict t preds;
7.39 if UnparseC.term t' = "bool_undef" andalso map UnparseC.term for_asm = []
7.40 then () else error "avoid_contradict x = 0 CHANGED"; (* "x \<noteq> 0" in preds *)
7.41
7.42 -val t = TermC.str2term "x = 1";
7.43 +val t = TermC.parse_test @{context} "x = 1";
7.44 val (t', for_asm) = avoid_contradict t preds;
7.45 if UnparseC.term t' = "x = 1" andalso map UnparseC.term for_asm = ["x = 1"]
7.46 then () else error "avoid_contradict x = 1 CHANGED"; (* "x \<noteq> 1" NOT in preds *)
7.47
7.48 -val t = TermC.str2term "a + b";
7.49 +val t = TermC.parse_test @{context} "a + b";
7.50 val (t', for_asm) = avoid_contradict t preds;
7.51 if UnparseC.term t' = "a + b" andalso map UnparseC.term for_asm = []
7.52 then () else error "avoid_contradict a + b CHANGED"; (* NOT a predicate *)
7.53
7.54 -val t = TermC.str2term "[a + b]";
7.55 +val t = TermC.parse_test @{context} "[a + b]";
7.56 val (t', for_asm) = avoid_contradict t preds;
7.57 if UnparseC.term t' = "[a + b]" andalso map UnparseC.term for_asm = []
7.58 then () else error "avoid_contradict [a + b] CHANGED"; (* NOT a predicate *)
7.59 @@ -115,12 +115,12 @@
7.60 val ctxt = Proof_Context.init_global @{theory "Isac_Knowledge"}
7.61
7.62 val sub_ctxt = ContextC.insert_assumptions
7.63 - [TermC.str2term "a < (fro::int)", TermC.str2term "b < (fro::int)"] ctxt
7.64 -val prog_res = TermC.str2term "[x_1 = 1, x_2 = (2::int), x_3 = 3]";
7.65 + [TermC.parse_test @{context} "a < (fro::int)", TermC.parse_test @{context} "b < (fro::int)"] ctxt
7.66 +val prog_res = TermC.parse_test @{context} "[x_1 = 1, x_2 = (2::int), x_3 = 3]";
7.67
7.68 (* NO contradiction ..*)
7.69 val caller_ctxt = ContextC.insert_assumptions
7.70 - [TermC.str2term "b < (to::int)", TermC.str2term "c < (to::int)"] ctxt
7.71 + [TermC.parse_test @{context} "b < (to::int)", TermC.parse_test @{context} "c < (to::int)"] ctxt
7.72 val (t, new_ctxt) = subpbl_to_caller sub_ctxt prog_res caller_ctxt;
7.73
7.74 if UnparseC.term t = "[x_1 = 1, x_2 = 2, x_3 = 3]" andalso map UnparseC.term (get_assumptions new_ctxt) =
7.75 @@ -129,7 +129,7 @@
7.76
7.77 (* a contradiction ..*)
7.78 val caller_ctxt = ContextC.insert_assumptions
7.79 - [TermC.str2term "b < (to::int)", TermC.str2term "x_2 \<noteq> (2::int)"] ctxt
7.80 + [TermC.parse_test @{context} "b < (to::int)", TermC.parse_test @{context} "x_2 \<noteq> (2::int)"] ctxt
7.81 val (t, new_ctxt) = subpbl_to_caller sub_ctxt prog_res caller_ctxt;
7.82
7.83 if UnparseC.term t = "[x_1 = 1, x_3 = 3]" andalso map UnparseC.term (get_assumptions new_ctxt) =
8.1 --- a/test/Tools/isac/BaseDefinitions/rewrite-order.sml Sun Oct 09 06:53:03 2022 +0200
8.2 +++ b/test/Tools/isac/BaseDefinitions/rewrite-order.sml Sun Oct 09 07:44:22 2022 +0200
8.3 @@ -17,7 +17,7 @@
8.4 "-------- identify difference in term-order between isa=NEW, isa2+OLD --------------------------";
8.5 "-------- identify difference in term-order between isa=NEW, isa2+OLD --------------------------";
8.6 "-------- identify difference in term-order between isa=NEW, isa2+OLD --------------------------";
8.7 -val form = TermC.str2term "x + -2 ::real"
8.8 +val form = TermC.parse_test @{context} "x + -2 ::real"
8.9 val Repeat {rew_ord = ("sqrt_right", rew_ord_), erls, ...} = Test_simplify;
8.10 val ctxt = Proof_Context.init_global @{theory Test};
8.11 (*Rewrite.trace_on := false; (*true false*)*)
9.1 --- a/test/Tools/isac/BaseDefinitions/substitution.sml Sun Oct 09 06:53:03 2022 +0200
9.2 +++ b/test/Tools/isac/BaseDefinitions/substitution.sml Sun Oct 09 07:44:22 2022 +0200
9.3 @@ -101,7 +101,7 @@
9.4 Subst.program_to_input: Subst.program -> string list;
9.5
9.6 val {scr = Prog prog, ...} = MethodC.from_store ctxt ["diff", "differentiate_on_R"];
9.7 -val env = [(TermC.str2term "v_v", TermC.str2term "x")] : Subst.T;
9.8 +val env = [(TermC.parse_test @{context} "v_v", TermC.parse_test @{context} "x")] : Subst.T;
9.9
9.10 "~~~~~ fun for_bdv, args:"; val (prog, env) = (prog, env);
9.11 fun scan (Const _) = NONE
10.1 --- a/test/Tools/isac/BaseDefinitions/termC.sml Sun Oct 09 06:53:03 2022 +0200
10.2 +++ b/test/Tools/isac/BaseDefinitions/termC.sml Sun Oct 09 07:44:22 2022 +0200
10.3 @@ -186,7 +186,7 @@
10.4 "\<not> ?bdv occurs_in ?a \<Longrightarrow>\n(?a + ?bdv = 0) = (?bdv = - 1 * ?a)"
10.5 then ()
10.6 else error "termC.sml d1_isolate_add2";
10.7 - val subst = [(TermC.str2term "bdv", TermC.str2term "x")];
10.8 + val subst = [(TermC.parse_test @{context} "bdv", TermC.parse_test @{context} "x")];
10.9 val t = (Eval.norm o Thm.prop_of) @{thm d1_isolate_add2};
10.10 val t' = TermC.inst_bdv subst t;
10.11 if UnparseC.term t' = "\<not> x occurs_in ?a \<Longrightarrow> (?a + x = 0) = (x = - 1 * ?a)"
10.12 @@ -199,10 +199,10 @@
10.13 (*default_print_depth 5;*)
10.14
10.15 val subst =
10.16 - [(TermC.str2term "bdv_1", TermC.str2term "c"),
10.17 - (TermC.str2term "bdv_2", TermC.str2term "c_2"),
10.18 - (TermC.str2term "bdv_3", TermC.str2term "c_3"),
10.19 - (TermC.str2term "bdv_4", TermC.str2term "c_4")];
10.20 + [(TermC.parse_test @{context} "bdv_1", TermC.parse_test @{context} "c"),
10.21 + (TermC.parse_test @{context} "bdv_2", TermC.parse_test @{context} "c_2"),
10.22 + (TermC.parse_test @{context} "bdv_3", TermC.parse_test @{context} "c_3"),
10.23 + (TermC.parse_test @{context} "bdv_4", TermC.parse_test @{context} "c_4")];
10.24 val t = (Eval.norm o Thm.prop_of) @{thm separate_bdvs_add};
10.25 val t' = TermC.inst_bdv subst t;
10.26
10.27 @@ -213,9 +213,9 @@
10.28 "----------- subst_atomic_all ---------------------------";
10.29 "----------- subst_atomic_all ---------------------------";
10.30 "----------- subst_atomic_all ---------------------------";
10.31 - val t = TermC.str2term "(tl vs_vs) from vs_vs occur_exactly_in (NTH 1 (es_es::bool list))";
10.32 - val env = [(TermC.str2term "vs_vs::real list", TermC.str2term "[c, c_2]"),
10.33 - (TermC.str2term "es_es::bool list", TermC.str2term "[c_2 = 0, c + c_2 = 1]")];
10.34 + val t = TermC.parse_test @{context} "(tl vs_vs) from vs_vs occur_exactly_in (NTH 1 (es_es::bool list))";
10.35 + val env = [(TermC.parse_test @{context} "vs_vs::real list", TermC.parse_test @{context} "[c, c_2]"),
10.36 + (TermC.parse_test @{context} "es_es::bool list", TermC.parse_test @{context} "[c_2 = 0, c + c_2 = 1]")];
10.37 val (all_Free_subst, t') = TermC.subst_atomic_all env t;
10.38
10.39 if all_Free_subst andalso
10.40 @@ -231,8 +231,8 @@
10.41 "----------- Pattern.match ------------------------------";
10.42 "----------- Pattern.match ------------------------------";
10.43 "----------- Pattern.match ------------------------------";
10.44 - val t = TermC.str2term "3 * x\<up>2 = (1::real)";
10.45 - val pat = (TermC.free2var o TermC.str2term) "a * b\<up>2 = (c::real)";
10.46 + val t = TermC.parse_test @{context} "3 * x\<up>2 = (1::real)";
10.47 + val pat = (TermC.free2var o TermC.parse_test @{context}) "a * b\<up>2 = (c::real)";
10.48 (* ! \<up> \<up> ^^!... necessary for Pattern.match, see Logic.varify_global below*)
10.49 val insts = Pattern.match @{theory "Isac_Knowledge"} (pat, t) (Vartab.empty, Vartab.empty);
10.50 (*default_print_depth 3; 999*) insts;
10.51 @@ -243,7 +243,7 @@
10.52 (("c", 0), ("Real.real", Free ("1", "Real.real")))})*)
10.53
10.54 "----- throws exn MATCH...";
10.55 -(* val t = TermC.str2term "x";
10.56 +(* val t = TermC.parse_test @{context} "x";
10.57 (Pattern.match @{theory "Isac_Knowledge"} (pat, t) (Vartab.empty, Vartab.empty))
10.58 handle MATCH => ???; *)
10.59
10.60 @@ -283,7 +283,7 @@
10.61 else ();
10.62
10.63 "----- test 2: Nok";
10.64 - val pa = Logic.varify_global (TermC.str2term "a = (0::real)");(*<<<<<<<-------------*)
10.65 + val pa = Logic.varify_global (TermC.parse_test @{context} "a = (0::real)");(*<<<<<<<-------------*)
10.66 tracing "paLo2=..."; TermC.atomty pa; tracing "...=paLo2";
10.67 (***
10.68 *** Const (op =, real => real => bool)
10.69 @@ -291,11 +291,11 @@
10.70 *** . Var ((0, 0), real)
10.71 ***)
10.72 "----- test 2a true";
10.73 - val tm = TermC.str2term "-8 - 2 * x + x ^ 2 = (0::real)"; (*<<<<<<<-------------*)
10.74 + val tm = TermC.parse_test @{context} "-8 - 2 * x + x ^ 2 = (0::real)"; (*<<<<<<<-------------*)
10.75 if TermC.matches thy tm pa then ()
10.76 else error "termC.sml diff.behav. in TermC.matches true 2";
10.77 "----- test 2b false";
10.78 - val tm = TermC.str2term "-8 - 2 * x + x ^ 2 = (3::real)"; (*<<<<<<<-------------*)
10.79 + val tm = TermC.parse_test @{context} "-8 - 2 * x + x ^ 2 = (3::real)"; (*<<<<<<<-------------*)
10.80 if TermC.matches thy tm pa then error "termC.sml diff.behav. in TermC.matches false 2"
10.81 else ();
10.82 (* i.e. !!!!!!!!!!!!!!!!! THIS KIND OF PATTERN IS NOT RELIABLE !!!!!!!!!!!!!!!!!
10.83 @@ -303,7 +303,7 @@
10.84 else ();*)
10.85
10.86 "----- test 3: OK";
10.87 - val pa = TermC.free2var (TermC.str2term "a = (0::real)");(*<<<<<<<-------------*)
10.88 + val pa = TermC.free2var (TermC.parse_test @{context} "a = (0::real)");(*<<<<<<<-------------*)
10.89 tracing "paF2=..."; TermC.atomty pa; tracing "...=paF2";
10.90 (***
10.91 *** Const (op =, real => real => bool)
10.92 @@ -311,22 +311,22 @@
10.93 *** . Free (0, real)
10.94 ***)
10.95 "----- test 3a true";
10.96 - val tm = TermC.str2term "-8 - 2 * x + x ^ 2 = (0::real)"; (*<<<<<<<-------------*)
10.97 + val tm = TermC.parse_test @{context} "-8 - 2 * x + x ^ 2 = (0::real)"; (*<<<<<<<-------------*)
10.98 if TermC.matches thy tm pa then ()
10.99 else error "termC.sml diff.behav. in TermC.matches true 3";
10.100 "----- test 3b false";
10.101 - val tm = TermC.str2term "-8 - 2 * x + x ^ 2 = (3::real)"; (*<<<<<<<-------------*)
10.102 + val tm = TermC.parse_test @{context} "-8 - 2 * x + x ^ 2 = (3::real)"; (*<<<<<<<-------------*)
10.103 if TermC.matches thy tm pa then error "termC.sml diff.behav. in TermC.matches false 3"
10.104 else ();
10.105
10.106 "----- test 4=3 with specific data";
10.107 - val pa = TermC.free2var (TermC.str2term "M_b 0");
10.108 + val pa = TermC.free2var (TermC.parse_test @{context} "M_b 0");
10.109 "----- test 4a true";
10.110 - val tm = TermC.str2term "M_b 0";
10.111 + val tm = TermC.parse_test @{context} "M_b 0";
10.112 if TermC.matches thy tm pa then ()
10.113 else error "termC.sml diff.behav. in TermC.matches true 4";
10.114 "----- test 4b false";
10.115 - val tm = TermC.str2term "M_b x";
10.116 + val tm = TermC.parse_test @{context} "M_b x";
10.117 if TermC.matches thy tm pa then error "termC.sml diff.behav. in TermC.matches false 4"
10.118 else ();
10.119
10.120 @@ -537,10 +537,10 @@
10.121 "----------- fun TermC.is_bdv_subst ------------------------------------------------------------------";
10.122 "----------- fun TermC.is_bdv_subst ------------------------------------------------------------------";
10.123 "----------- fun TermC.is_bdv_subst ------------------------------------------------------------------";
10.124 -if TermC.is_bdv_subst (TermC.str2term "[(''bdv'', v_v)]") then ()
10.125 +if TermC.is_bdv_subst (TermC.parse_test @{context} "[(''bdv'', v_v)]") then ()
10.126 else error "TermC.is_bdv_subst canged 1";
10.127
10.128 -if TermC.is_bdv_subst (TermC.str2term "[(''bdv_1'', v_s1),(''bdv_2'', v_s2)]") then ()
10.129 +if TermC.is_bdv_subst (TermC.parse_test @{context} "[(''bdv_1'', v_s1),(''bdv_2'', v_s2)]") then ()
10.130 else error "TermC.is_bdv_subst canged 2";
10.131
10.132 "----------- fun str_of_int --------------------------------------------------------------------";
10.133 @@ -581,41 +581,41 @@
10.134 case ThmC_Def.int_opt_of_string "-123" of
10.135 SOME ~123 => () | _ => raise error "ThmC_Def.int_opt_of_string -123 changed";
10.136
10.137 -val t = TermC.str2term "1";
10.138 +val t = TermC.parse_test @{context} "1";
10.139 if TermC.is_num t = true then () else error "TermC.is_num 1";
10.140
10.141 -val t = TermC.str2term "-1";
10.142 +val t = TermC.parse_test @{context} "-1";
10.143 if TermC.is_num t = true then () else error "TermC.is_num -1";
10.144
10.145 -val t = TermC.str2term "a123";
10.146 +val t = TermC.parse_test @{context} "a123";
10.147 if TermC.is_num t = false then () else error "TermC.is_num a123";
10.148
10.149 "----------- fun TermC.is_f_x ------------------------------------------------------------------------";
10.150 "----------- fun TermC.is_f_x ------------------------------------------------------------------------";
10.151 "----------- fun TermC.is_f_x ------------------------------------------------------------------------";
10.152 -val t = TermC.str2term "q_0/2 * L * x";
10.153 +val t = TermC.parse_test @{context} "q_0/2 * L * x";
10.154 if TermC.is_f_x t = false then () else error "TermC.is_f_x q_0/2 * L * x";
10.155
10.156 -val t = TermC.str2term "M_b x";
10.157 +val t = TermC.parse_test @{context} "M_b x";
10.158 if TermC.is_f_x t = true then () else error "M_b x";
10.159
10.160 "----------- fun list2isalist, fun isalist2list ------------------------------------------------";
10.161 "----------- fun list2isalist, fun isalist2list ------------------------------------------------";
10.162 "----------- fun list2isalist, fun isalist2list ------------------------------------------------";
10.163 -val t = TermC.str2term "R=(R::real)";
10.164 +val t = TermC.parse_test @{context} "R=(R::real)";
10.165 val T = type_of t;
10.166 val ss = TermC.list2isalist T [t,t,t];
10.167 if UnparseC.term ss = "[R = R, R = R, R = R]" then () else error "list2isalist 1";
10.168
10.169 -val t = TermC.str2term "[a=b,c=d,e=f]";
10.170 +val t = TermC.parse_test @{context} "[a=b,c=d,e=f]";
10.171 val il = TermC.isalist2list t;
10.172 if UnparseC.terms il = "[\"a = b\", \"c = d\", \"e = f\"]" then () else error "isalist2list 2";
10.173
10.174 -val t = TermC.str2term "[a=b,c=d,e=f]";
10.175 +val t = TermC.parse_test @{context} "[a=b,c=d,e=f]";
10.176 val il = TermC.isalist2list t;
10.177 if UnparseC.terms il = "[\"a = b\", \"c = d\", \"e = f\"]" then () else error "isalist2list 3";
10.178
10.179 -val t = TermC.str2term "ss___s::bool list";
10.180 +val t = TermC.parse_test @{context} "ss___s::bool list";
10.181 (TermC.isalist2list t; error "isalist2list 1") handle TERM ("isalist2list applied to NON-list: ", _) =>();
10.182
10.183 "----------- fun TermC.strip_imp_prems', fun TermC.ins_concl -----------------------------------------------";
10.184 @@ -647,7 +647,7 @@
10.185 val t = TermC.mk_factroot "SqRoot.sqrt" T 2 3;
10.186 if UnparseC.term t = "2 * ??.SqRoot.sqrt 3" then () else error "mk_factroot";
10.187
10.188 -val t = TermC.str2term "aaa + bbb";
10.189 +val t = TermC.parse_test @{context} "aaa + bbb";
10.190 val op_ as Const (\<^const_name>\<open>plus\<close>, Top) $ Free ("aaa", T1) $ Free ("bbb", T2) = t;
10.191 val t' = TermC.mk_num_op_num T1 T2 (\<^const_name>\<open>plus\<close>, Top) 2 3;
10.192 if UnparseC.term t' = "2 + 3" then () else error "mk_num_op_num";
10.193 @@ -664,11 +664,11 @@
10.194 "----------- fun TermC.is_list -----------------------------------------------------------------------";
10.195 "----------- fun TermC.is_list -----------------------------------------------------------------------";
10.196 val (SOME ct) = TermC.parseNEW ctxt "lll::real list";
10.197 -val t = TermC.str2term "lll::real list";
10.198 +val t = TermC.parse_test @{context} "lll::real list";
10.199 val ty = Term.type_of ct;
10.200 if TermC.is_list t = false then () else error "TermC.is_list lll::real list";
10.201
10.202 -val t = TermC.str2term "[a, b, c]";
10.203 +val t = TermC.parse_test @{context} "[a, b, c]";
10.204 val ty = Term.type_of ct;
10.205 if TermC.is_list t = true then () else error "TermC.is_list [a, b, c]";
10.206
11.1 --- a/test/Tools/isac/Interpret/error-pattern.sml Sun Oct 09 06:53:03 2022 +0200
11.2 +++ b/test/Tools/isac/Interpret/error-pattern.sml Sun Oct 09 07:44:22 2022 +0200
11.3 @@ -119,13 +119,13 @@
11.4 val fod = Derive.do_one (Proof_Context.init_global @{theory "Isac_Knowledge"}) Atools_erls
11.5 ((#rules o Rule_Set.rep) Test_simplify)
11.6 (sqrt_right false (@{theory "Pure"})) NONE
11.7 - (TermC.str2term "x + 1 + - 1 * 2 = 0");
11.8 + (TermC.parse_test @{context} "x + 1 + - 1 * 2 = 0");
11.9 (writeln o Derive.trtas2str) fod;
11.10
11.11 val ifod = Derive.do_one (Proof_Context.init_global @{theory "Isac_Knowledge"}) Atools_erls
11.12 ((#rules o Rule_Set.rep) Test_simplify)
11.13 (sqrt_right false (@{theory "Pure"})) NONE
11.14 - (TermC.str2term "- 2 * 1 + (1 + x) = 0");
11.15 + (TermC.parse_test @{context} "- 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,7 +637,7 @@
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 = TermC.str2term "Diff (x \<up> 2 + x + 1, x)";
11.24 +val t = TermC.parse_test @{context} "Diff (x \<up> 2 + x + 1, x)";
11.25 case t of Const (\<^const_name>\<open>Diff\<close>, _) $ _ => ()
11.26 | _ => raise
11.27 error "diff.sml behav.changed for CAS Diff (..., x)";
11.28 @@ -902,11 +902,11 @@
11.29 "--------- build fun check_for' ------------------------------";
11.30 "--------- build fun check_for' ------------------------------";
11.31 "--------- build fun check_for' ------------------------------";
11.32 -val subst = [(TermC.str2term "bdv", TermC.str2term "x")]: subst;
11.33 +val subst = [(TermC.parse_test @{context} "bdv", TermC.parse_test @{context} "x")]: subst;
11.34 val rls = norm_Rational
11.35 val pat = TermC.parse_patt @{theory} "(?a + ?b)/(?b + ?c) = ?a / ?c";
11.36 -val (res, inf) = (TermC.str2term "(2 + 3)/(3 + 4)", TermC.str2term "2 / 4");
11.37 -val (res, inf) = (TermC.str2term "(2 + 3)/(3 + 4)", TermC.str2term "1 / 2");
11.38 +val (res, inf) = (TermC.parse_test @{context} "(2 + 3)/(3 + 4)", TermC.parse_test @{context} "2 / 4");
11.39 +val (res, inf) = (TermC.parse_test @{context} "(2 + 3)/(3 + 4)", TermC.parse_test @{context} "1 / 2");
11.40
11.41 val (res', _, _, rewritten) = (*rewritten: the lhs of the pattern TermC.matches in res*)
11.42 rew_sub ctxt 1 [] Rewrite_Ord.function_empty Rule_Set.empty false [] (HOLogic.Trueprop $ pat) res;
11.43 @@ -924,21 +924,21 @@
11.44 norm_res = norm_inf;
11.45
11.46 val pat = TermC.parse_patt @{theory} "(?a + ?b)/?a = ?b";
11.47 -val (res, inf) = (TermC.str2term "(2 + 3)/2", TermC.str2term "3");
11.48 +val (res, inf) = (TermC.parse_test @{context} "(2 + 3)/2", TermC.parse_test @{context} "3");
11.49 if check_for' ctxt (res, inf) subst ("errpatID", pat) rls = SOME "errpatID"
11.50 then () else error "error patt example1 changed";
11.51
11.52 val pat = TermC.parse_patt @{theory} "(?a + ?b)/(?a + ?c) = ?b / ?c";
11.53 -val (res, inf) = (TermC.str2term "(2 + 3)/(2 + 4)", TermC.str2term "3 / 4");
11.54 +val (res, inf) = (TermC.parse_test @{context} "(2 + 3)/(2 + 4)", TermC.parse_test @{context} "3 / 4");
11.55 if check_for' ctxt (res, inf) subst ("errpatID", pat) rls = SOME "errpatID"
11.56 then () else error "error patt example2 changed";
11.57
11.58 val pat = TermC.parse_patt @{theory} "(?a + ?b)/(?b + ?c) = ?a / ?c";
11.59 -val (res, inf) = (TermC.str2term "(2 + 3)/(3 + 4)", TermC.str2term "2 / 4");
11.60 +val (res, inf) = (TermC.parse_test @{context} "(2 + 3)/(3 + 4)", TermC.parse_test @{context} "2 / 4");
11.61 if check_for' ctxt (res, inf) subst ("errpatID", pat) rls = SOME "errpatID"
11.62 then () else error "error patt example3 changed";
11.63
11.64 -val inf = TermC.str2term "1 / 2";
11.65 +val inf = TermC.parse_test @{context} "1 / 2";
11.66 if check_for' ctxt (res, inf) subst ("errpatID", pat) rls = SOME "errpatID"
11.67 then () else error "error patt example3 changed";
11.68
11.69 @@ -946,15 +946,15 @@
11.70 "--------- build fun check_for' ?bdv -------------------------";
11.71 "--------- build fun check_for' ?bdv -------------------------";
11.72 val ctxt = Proof_Context.init_global @{theory}
11.73 -val subst = [(TermC.str2term "bdv", TermC.str2term "x")]: subst;
11.74 -val t = TermC.str2term "d_d x (x \<up> 2 + sin (x \<up> 4))";
11.75 +val subst = [(TermC.parse_test @{context} "bdv", TermC.parse_test @{context} "x")]: subst;
11.76 +val t = TermC.parse_test @{context} "d_d x (x \<up> 2 + sin (x \<up> 4))";
11.77 val SOME (t, _) = rewrite_set_inst_ ctxt false subst norm_diff t;
11.78 if UnparseC.term t = "2 * x + cos (x \<up> 4) * 4 * x \<up> 3" then ()
11.79 else error "build fun check_for' ?bdv changed 1";
11.80
11.81 val rls = norm_diff
11.82 val pat = TermC.parse_patt @{theory} "d_d ?bdv (sin ?u) = cos (d_d ?bdv ?u)";
11.83 -val (res, inf) = (TermC.str2term "2 * x + d_d x (sin (x \<up> 4))", TermC.str2term "2 * x + cos (4 * x \<up> 3)");
11.84 +val (res, inf) = (TermC.parse_test @{context} "2 * x + d_d x (sin (x \<up> 4))", TermC.parse_test @{context} "2 * x + cos (4 * x \<up> 3)");
11.85
11.86 val (res', _, _, rewritten) = (*rewritten: the lhs of the pattern TermC.matches in res*)
11.87 rew_sub ctxt 1 subst Rewrite_Ord.function_empty Rule_Set.empty false [] (HOLogic.Trueprop $ pat) res;
11.88 @@ -984,11 +984,11 @@
11.89 "--------- build fun check_for ------------------------";
11.90 "--------- build fun check_for ------------------------";
11.91 val (res, inf) =
11.92 - (TermC.str2term "d_d x (x \<up> 2) + d_d x (sin (x \<up> 4))",
11.93 - TermC.str2term "d_d x (x \<up> 2) + cos (4 * x \<up> 3)");
11.94 + (TermC.parse_test @{context} "d_d x (x \<up> 2) + d_d x (sin (x \<up> 4))",
11.95 + TermC.parse_test @{context} "d_d x (x \<up> 2) + cos (4 * x \<up> 3)");
11.96 val {errpats, nrls = rls, scr = Prog prog, ...} = MethodC.from_store ctxt ["diff", "differentiate_on_R"]
11.97
11.98 -val env = [(TermC.str2term "v_v", TermC.str2term "x")];
11.99 +val env = [(TermC.parse_test @{context} "v_v", TermC.parse_test @{context} "x")];
11.100 val errpats =
11.101 [Error_Pattern.empty, (*generalised for testing*)
11.102 ("chain-rule-diff-both",
11.103 @@ -1277,7 +1277,7 @@
11.104 "--------- fun concat_deriv --------------------------------------";
11.105 (*
11.106 val ({rew_ord, erls, rules,...}, fo, ifo) =
11.107 - (Rule_Set.rep Test_simplify, TermC.str2term "x+1+ - 1*2=0", TermC.str2term "-2*1+(x+1)=0");
11.108 + (Rule_Set.rep Test_simplify, TermC.parse_test @{context} "x+1+ - 1*2=0", TermC.parse_test @{context} "-2*1+(x+1)=0");
11.109 (tracing o Derive.trtas2str) fod';
11.110 > ["
11.111 (x + 1 + - 1 * 2 = 0, Thm ("radd_commute", "?m + ?n = ?n + ?m"), (- 1 * 2 + (x + 1) = 0, []))", "
12.1 --- a/test/Tools/isac/Knowledge/algein.sml Sun Oct 09 06:53:03 2022 +0200
12.2 +++ b/test/Tools/isac/Knowledge/algein.sml Sun Oct 09 07:44:22 2022 +0200
12.3 @@ -102,7 +102,7 @@
12.4 val rew_ord = Rewrite_Ord.function_empty;
12.5 val erls = Rule_Set.Empty;
12.6 val thm = ThmC.thm_from_thy thy "sym_mult_zero_right";
12.7 -val t = TermC.str2term "0 = (0::real)";
12.8 +val t = TermC.parse_test @{context} "0 = (0::real)";
12.9 val SOME (t',_) = rewrite_ ctxt rew_ord erls false thm t;
12.10 UnparseC.term t' = "0 = ?a1 * 0"; (* = true*)
12.11
13.1 --- a/test/Tools/isac/Knowledge/biegelinie-1.sml Sun Oct 09 06:53:03 2022 +0200
13.2 +++ b/test/Tools/isac/Knowledge/biegelinie-1.sml Sun Oct 09 07:44:22 2022 +0200
13.3 @@ -29,23 +29,22 @@
13.4
13.5 val thy = @{theory "Biegelinie"};
13.6 val ctxt = ThyC.id_to_ctxt "Biegelinie";
13.7 -fun str2term str = TermC.parseNEW' ctxt str;
13.8 fun term2s t = UnparseC.term_by_thyID "Biegelinie" t;
13.9 fun rewrit thm str = fst (the (rewrite_ ctxt tless_true Rule_Set.empty true thm str));
13.10
13.11 "----------- the rules -------------------------------------------";
13.12 "----------- the rules -------------------------------------------";
13.13 "----------- the rules -------------------------------------------";
13.14 -val t = rewrit @{thm Belastung_Querkraft} (TermC.str2term "- qq x = - q_0"); term2s t;
13.15 +val t = rewrit @{thm Belastung_Querkraft} (TermC.parse_test @{context} "- qq x = - q_0"); term2s t;
13.16 if term2s t = "Q' x = - q_0" then ()
13.17 else error "/biegelinie.sml: Belastung_Querkraft";
13.18
13.19 -val t = rewrit @{thm Querkraft_Moment} (TermC.str2term "Q x = - q_0 * x + c"); term2s t;
13.20 +val t = rewrit @{thm Querkraft_Moment} (TermC.parse_test @{context} "Q x = - q_0 * x + c"); term2s t;
13.21 if term2s t = "?M_b' x = - q_0 * x + c" then ()
13.22 (*if term2s t = "M_b' x = - q_0 * x + c" then () cf.fbe1652b0df8 new handling of quotes in mixfix*)
13.23 else error "/biegelinie.sml: Querkraft_Moment";
13.24
13.25 -val t = rewrit @{thm Moment_Neigung} (TermC.str2term "M_b x = -q_0 * x \<up> 2/2 + q_0/2 *L*x");
13.26 +val t = rewrit @{thm Moment_Neigung} (TermC.parse_test @{context} "M_b x = -q_0 * x \<up> 2/2 + q_0/2 *L*x");
13.27 term2s t;
13.28 if term2s t = "- EI * y'' x = - q_0 * x \<up> 2 / 2 + q_0 / 2 * L * x" then ()
13.29 else error "biegelinie.sml: Moment_Neigung";
13.30 @@ -71,13 +70,13 @@
13.31 Eval("Prog_Expr.argument_in", eval_argument_in "Prog_Expr.argument_in")
13.32 ],
13.33 scr = Empty_Prog};
13.34 -val rm_ = TermC.str2term"[M_b 0 = 0, M_b L = 0]";
13.35 -val M__ = TermC.str2term"M_b x = - 1 * x \<up> 2 / 2 + x * c + c_2";
13.36 +val rm_ = TermC.parse_test @{context}"[M_b 0 = 0, M_b L = 0]";
13.37 +val M__ = TermC.parse_test @{context}"M_b x = - 1 * x \<up> 2 / 2 + x * c + c_2";
13.38 val SOME (e1__,_) = rewrite_set_ ctxt false srls
13.39 - (TermC.str2term "(NTH::[real,bool list]=>bool) 1 " $ rm_);
13.40 + (TermC.parse_test @{context} "(NTH::[real,bool list]=>bool) 1 " $ rm_);
13.41 if UnparseC.term e1__ = "M_b 0 = 0" then () else error "biegelinie.sml simplify NTH 1 rm_";
13.42
13.43 -val SOME (x1__,_) = rewrite_set_ ctxt false srls (TermC.str2term "argument_in (lhs (M_b 0 = 0))");
13.44 +val SOME (x1__,_) = rewrite_set_ ctxt false srls (TermC.parse_test @{context} "argument_in (lhs (M_b 0 = 0))");
13.45 if UnparseC.term x1__ = "0" then ()
13.46 else error "biegelinie.sml simplify argument_in (lhs (M_b 0 = 0)";
13.47
13.48 @@ -115,8 +114,8 @@
13.49 "----------- investigate normalforms in biegelinien --------------";
13.50 "----------- investigate normalforms in biegelinien --------------";
13.51 "----- coming from integration, kept for later improvements:";
13.52 -val Q = TermC.str2term "Q x = c + - 1 * q_0 * x";
13.53 -val M_b = TermC.str2term "M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2";
13.54 -val y' = TermC.str2term "y' x = c_3 + 1 / (- 1 * EI) * (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3)";
13.55 -val y = TermC.str2term "y x = c_4 + c_3 * x +\n1 / (- 1 * EI) * (c_2 / 2 * x \<up> 2 + c / 6 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)";
13.56 +val Q = TermC.parse_test @{context} "Q x = c + - 1 * q_0 * x";
13.57 +val M_b = TermC.parse_test @{context} "M_b x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2";
13.58 +val y' = TermC.parse_test @{context} "y' x = c_3 + 1 / (- 1 * EI) * (c_2 * x + c / 2 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3)";
13.59 +val y = TermC.parse_test @{context} "y x = c_4 + c_3 * x +\n1 / (- 1 * EI) * (c_2 / 2 * x \<up> 2 + c / 6 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)";
13.60 (* \<up> 1 / (- 1 * EI) NOT distributed - ok! \<up> \<up> \<up> \<up> \<up> \<up> \<up> ^^*)
14.1 --- a/test/Tools/isac/Knowledge/diff-app.sml Sun Oct 09 06:53:03 2022 +0200
14.2 +++ b/test/Tools/isac/Knowledge/diff-app.sml Sun Oct 09 07:44:22 2022 +0200
14.3 @@ -455,7 +455,7 @@
14.4 "--------------------- 30.4.03: maximum .. rewrite_set_ prog_expr ---------";
14.5 "--------------------- 30.4.03: maximum .. rewrite_set_ prog_expr ---------";
14.6 "--------------------- 30.4.03: maximum .. rewrite_set_ prog_expr ---------";
14.7 -TermC.str2term
14.8 +TermC.parse_test @{context}
14.9 "Program Maximum_value(f_ix::bool list)(m_m::real) (r_s::bool list)\
14.10 \ (v_v::real) (itv_v::real set) (err_r::bool) = \
14.11 \ (let e_e = (hd o (filterVar m_m)) r_s; \
14.12 @@ -470,22 +470,22 @@
14.13 \ [REAL mx_x, REAL (Rhs t_t), REAL v_v, REAL m_m, \
14.14 \ BOOL_LIST (dropWhile (ident e_e) r_s)])::bool list))";
14.15
14.16 -val f_ix = (TermC.str2term "f_ix::bool list",
14.17 - TermC.str2term "[r=Arbfix]");
14.18 -val m_m = (TermC.str2term "m_m::real",
14.19 - TermC.str2term "A");
14.20 -val r_s = (TermC.str2term "rs_s::bool list",
14.21 - TermC.str2term "[A = a*b, (a/2) \<up> 2 + (b/2) \<up> 2 = r \<up> 2]");
14.22 -val v_v = (TermC.str2term "v_v::real",
14.23 - TermC.str2term "b");
14.24 -val itv_v = (TermC.str2term "itv_v::real set",
14.25 - TermC.str2term "{x::real. 0 <= x & x <= 2*r}");
14.26 -val err_r = (TermC.str2term "err_r::bool",
14.27 - TermC.str2term "eps=0");
14.28 +val f_ix = (TermC.parse_test @{context} "f_ix::bool list",
14.29 + TermC.parse_test @{context} "[r=Arbfix]");
14.30 +val m_m = (TermC.parse_test @{context} "m_m::real",
14.31 + TermC.parse_test @{context} "A");
14.32 +val r_s = (TermC.parse_test @{context} "rs_s::bool list",
14.33 + TermC.parse_test @{context} "[A = a*b, (a/2) \<up> 2 + (b/2) \<up> 2 = r \<up> 2]");
14.34 +val v_v = (TermC.parse_test @{context} "v_v::real",
14.35 + TermC.parse_test @{context} "b");
14.36 +val itv_v = (TermC.parse_test @{context} "itv_v::real set",
14.37 + TermC.parse_test @{context} "{x::real. 0 <= x & x <= 2*r}");
14.38 +val err_r = (TermC.parse_test @{context} "err_r::bool",
14.39 + TermC.parse_test @{context} "eps=0");
14.40 val env = [f_ix, m_m, r_s ,v_v, itv_v, err_r];
14.41
14.42 (*--- 1.line in script ---*)
14.43 -val t = TermC.str2term "(hd o (filterVar m_m)) (r_s::bool list)";
14.44 +val t = TermC.parse_test @{context} "(hd o (filterVar m_m)) (r_s::bool list)";
14.45 val s = subst_atomic env t;
14.46 UnparseC.term s;
14.47 "(hd o filterVar A) [A = a * b, (a / 2) \<up> 2 + (b / 2) \<up> 2 = r \<up> 2]";
14.48 @@ -494,10 +494,10 @@
14.49 val s'' = UnparseC.term s';
14.50 if s''="A = a * b" then () else error "new behaviour with prog_expr 1.1.";
14.51 === inhibit exn 110726=============================================================*)
14.52 -val env = env @ [(TermC.str2term "e_e::bool",TermC.str2term "A = a * b")];
14.53 +val env = env @ [(TermC.parse_test @{context} "e_e::bool",TermC.parse_test @{context} "A = a * b")];
14.54
14.55 (*--- 2.line: condition alone ---*)
14.56 -val t = TermC.str2term "1 < length_h (r_s::bool list)";
14.57 +val t = TermC.parse_test @{context} "1 < length_h (r_s::bool list)";
14.58 val s = subst_atomic env t;
14.59 UnparseC.term s;
14.60 "1 < length_h [A = a * b, (a / 2) \<up> 2 + (b / 2) \<up> 2 = r \<up> 2]";
14.61 @@ -508,7 +508,7 @@
14.62 === inhibit exn 110726=============================================================*)
14.63
14.64 (*--- 2.line in script ---*)
14.65 -val t = TermC.str2term
14.66 +val t = TermC.parse_test @{context}
14.67 "(if 1 < length_h r_s \
14.68 \ then (SubProblem (Reals_s,[make,function],[no_met])\
14.69 \ [REAL m_m, REAL v_v, BOOL_LIST r_s])\
14.70 @@ -529,15 +529,15 @@
14.71 \ BOOL_LIST [A = a * b, (a / 2) \<up> 2 + (b / 2) \<up> 2 = r \<up> 2]]" then ()
14.72 else error "new behaviour with prog_expr 1.3.";
14.73 === inhibit exn 110726=============================================================*)
14.74 -val env = env @ [(TermC.str2term "t_t::bool",
14.75 - TermC.str2term "A = (2*sqrt(r \<up> 2-(b/2) \<up> 2)) * b")];
14.76 +val env = env @ [(TermC.parse_test @{context} "t_t::bool",
14.77 + TermC.parse_test @{context} "A = (2*sqrt(r \<up> 2-(b/2) \<up> 2)) * b")];
14.78
14.79
14.80
14.81 "---------------------- 1.5.03: Make_fun_by_explicit ---------------------";
14.82 "---------------------- 1.5.03: Make_fun_by_explicit ---------------------";
14.83 "---------------------- 1.5.03: Make_fun_by_explicit ---------------------";
14.84 -TermC.str2term
14.85 +TermC.parse_test @{context}
14.86 "Program Make_fun_by_explicit (f_f::real) (v_v::real) \
14.87 \ (eqs::bool list) = \
14.88 \ (let h_h = (hd o (filterVar f_f)) eqs; \
14.89 @@ -547,32 +547,32 @@
14.90 \ (s_1::bool list)=(SubProblem(Reals_s,[univar,equation],[no_met])\
14.91 \ [BOOL e_1, REAL v_1])\
14.92 \ in Substitute [(v_1 = (rhs o hd) s_1)] h_h)";
14.93 -val f_f = (TermC.str2term "f_f::real",
14.94 - TermC.str2term "A");
14.95 -val v_v = (TermC.str2term "v_v::real",
14.96 - TermC.str2term "b");
14.97 -val eqs=(TermC.str2term "eqs::bool list",
14.98 - TermC.str2term "[A = a * b, (a / 2) \<up> 2 + (b / 2) \<up> 2 = r \<up> 2]");
14.99 +val f_f = (TermC.parse_test @{context} "f_f::real",
14.100 + TermC.parse_test @{context} "A");
14.101 +val v_v = (TermC.parse_test @{context} "v_v::real",
14.102 + TermC.parse_test @{context} "b");
14.103 +val eqs=(TermC.parse_test @{context} "eqs::bool list",
14.104 + TermC.parse_test @{context} "[A = a * b, (a / 2) \<up> 2 + (b / 2) \<up> 2 = r \<up> 2]");
14.105 val env = [f_f, v_v, eqs];
14.106
14.107 (*--- 1.line in script ---*)
14.108 -val t = TermC.str2term "(hd o (filterVar v_v)) (eqs::bool list)";
14.109 +val t = TermC.parse_test @{context} "(hd o (filterVar v_v)) (eqs::bool list)";
14.110 val s = subst_atomic env t;
14.111 UnparseC.term s;
14.112 -val t = TermC.str2term
14.113 +val t = TermC.parse_test @{context}
14.114 "(hd o filterVar b) [A = a * b, (a / 2) \<up> 2 + (b / 2) \<up> 2 = r \<up> 2]";
14.115 val SOME (t',_) = rewrite_set_ ctxt false prog_expr t;
14.116 val s' = UnparseC.term t';
14.117 (*=== inhibit exn 110726=============================================================
14.118 if s' = "A = a * b" then () else error "new behaviour with prog_expr 2.1";
14.119 === inhibit exn 110726=============================================================*)
14.120 -val env = env @ [(TermC.str2term "h_h::bool", TermC.str2term s')];
14.121 +val env = env @ [(TermC.parse_test @{context} "h_h::bool", TermC.parse_test @{context} s')];
14.122
14.123 (*--- 2.line in script ---*)
14.124 -val t = TermC.str2term "hd (dropWhile (ident h_h) (eqs::bool list))";
14.125 +val t = TermC.parse_test @{context} "hd (dropWhile (ident h_h) (eqs::bool list))";
14.126 val s = subst_atomic env t;
14.127 UnparseC.term s;
14.128 -val t = TermC.str2term
14.129 +val t = TermC.parse_test @{context}
14.130 "hd (dropWhile (ident (A = a * b))\
14.131 \ [A = a * b, (a / 2) \<up> 2 + (b / 2) \<up> 2 = r \<up> 2])";
14.132 (*=== inhibit exn 110726=============================================================
14.133 @@ -583,47 +583,47 @@
14.134 if s' = "(a / 2) \<up> 2 + (b / 2) \<up> 2 = r \<up> 2" then ()
14.135 else error "new behaviour with prog_expr 2.2";
14.136 === inhibit exn 110726=============================================================*)
14.137 -val env = env @ [(TermC.str2term "e_1::bool", TermC.str2term s')];
14.138 +val env = env @ [(TermC.parse_test @{context} "e_1::bool", TermC.parse_test @{context} s')];
14.139
14.140 (*--- 3.line in script ---*)
14.141 -val t = TermC.str2term "dropWhile (ident f_f) (Vars (h_h::bool))";
14.142 +val t = TermC.parse_test @{context} "dropWhile (ident f_f) (Vars (h_h::bool))";
14.143 val s = subst_atomic env t;
14.144 UnparseC.term s;
14.145 -val t = TermC.str2term "dropWhile (ident A) (Vars (A = a * b))";
14.146 +val t = TermC.parse_test @{context} "dropWhile (ident A) (Vars (A = a * b))";
14.147 (*=== inhibit exn 110726=============================================================
14.148 val SOME (t',_) = rewrite_set_ thy false prog_expr t;
14.149 val s' = UnparseC.term t';
14.150 if s' = "[a, b]" then () else error "new behaviour with prog_expr 2.3";
14.151 === inhibit exn 110726=============================================================*)
14.152 -val env = env @ [(TermC.str2term "vs_s::real list", TermC.str2term s')];
14.153 +val env = env @ [(TermC.parse_test @{context} "vs_s::real list", TermC.parse_test @{context} s')];
14.154
14.155 (*--- 4.line in script ---*)
14.156 -val t = TermC.str2term "hd (dropWhile (ident v_v) v_s)";
14.157 +val t = TermC.parse_test @{context} "hd (dropWhile (ident v_v) v_s)";
14.158 val s = subst_atomic env t;
14.159 UnparseC.term s;
14.160 -val t = TermC.str2term "hd (dropWhile (ident b) [a, b])";
14.161 +val t = TermC.parse_test @{context} "hd (dropWhile (ident b) [a, b])";
14.162 (*=== inhibit exn 110726=============================================================
14.163 val SOME (t',_) = rewrite_set_ thy false prog_expr t;
14.164 val s' = UnparseC.term t';
14.165 if s' = "a" then () else error "new behaviour with prog_expr 2.4.";
14.166 === inhibit exn 110726=============================================================*)
14.167 -val env = env @ [(TermC.str2term "v_1::real", TermC.str2term s')];
14.168 +val env = env @ [(TermC.parse_test @{context} "v_1::real", TermC.parse_test @{context} s')];
14.169
14.170 (*--- 5.line in script ---*)
14.171 -val t = TermC.str2term "(SubProblem(Reals_s,[univar,equation],[no_met])\
14.172 +val t = TermC.parse_test @{context} "(SubProblem(Reals_s,[univar,equation],[no_met])\
14.173 \ [BOOL e_1, REAL v_1])";
14.174 val s = subst_atomic env t;
14.175 UnparseC.term s;
14.176 "SubProblem (Reals_s, [univar, equation], [no_met])\n\
14.177 \ [BOOL ((a / 2) \<up> 2 + (b / 2) \<up> 2 = r \<up> 2), REAL a]";
14.178 -val env = env @ [(TermC.str2term "s_1::bool list",
14.179 - TermC.str2term "[a = 2 * sqrt (r \<up> 2 - (b/2) \<up> 2)]")];
14.180 +val env = env @ [(TermC.parse_test @{context} "s_1::bool list",
14.181 + TermC.parse_test @{context} "[a = 2 * sqrt (r \<up> 2 - (b/2) \<up> 2)]")];
14.182
14.183 (*--- 6.line in script ---*)
14.184 -val t = TermC.str2term "Substitute [(v_1 = (rhs o hd) (s_1::bool list))] (h_h::bool)";
14.185 +val t = TermC.parse_test @{context} "Substitute [(v_1 = (rhs o hd) (s_1::bool list))] (h_h::bool)";
14.186 val s = subst_atomic env t;
14.187 UnparseC.term s;
14.188 -val t = TermC.str2term
14.189 +val t = TermC.parse_test @{context}
14.190 "Substitute [(a = (rhs o hd) [a = 2 * sqrt (r \<up> 2 - (b / 2) \<up> 2)])]\n\
14.191 \ (A = a * b)";
14.192 (*=== inhibit exn 110726=============================================================
14.193 @@ -638,7 +638,7 @@
14.194 "---------------------- 2.5.03: Make_fun_by_new_variable -----------------";
14.195 "---------------------- 2.5.03: Make_fun_by_new_variable -----------------";
14.196 "---------------------- 2.5.03: Make_fun_by_new_variable -----------------";
14.197 -TermC.str2term
14.198 +TermC.parse_test @{context}
14.199 "Program Make_fun_by_new_variable (f_f::real) (v_v::real) \
14.200 \ (eqs::bool list) = \
14.201 \(let h_h = (hd o (filterVar f_f)) eqs; \
14.202 @@ -653,32 +653,32 @@
14.203 \ (s_2::bool list) = (SubProblem (Reals_s,[univar,equation],[no_met])\
14.204 \ [BOOL e_2, REAL v_2])\
14.205 \in Substitute [(v_1 = (rhs o hd) s_1),(v_2 = (rhs o hd) s_2)] h_h)";
14.206 -val f_ = (TermC.str2term "f_f::real",
14.207 - TermC.str2term "A");
14.208 -val v_v = (TermC.str2term "v_v::real",
14.209 - TermC.str2term "alpha");
14.210 -val eqs=(TermC.str2term "eqs::bool list",
14.211 - TermC.str2term "[A=a*b, a/2=r*sin alpha, b/2=r*cos (alpha::real)]");
14.212 +val f_ = (TermC.parse_test @{context} "f_f::real",
14.213 + TermC.parse_test @{context} "A");
14.214 +val v_v = (TermC.parse_test @{context} "v_v::real",
14.215 + TermC.parse_test @{context} "alpha");
14.216 +val eqs=(TermC.parse_test @{context} "eqs::bool list",
14.217 + TermC.parse_test @{context} "[A=a*b, a/2=r*sin alpha, b/2=r*cos (alpha::real)]");
14.218 val env = [f_f, v_v, eqs];
14.219
14.220 (*--- 1.line in script ---*)
14.221 -val t = TermC.str2term "(hd o (filterVar (f_f::real))) (eqs::bool list)";
14.222 +val t = TermC.parse_test @{context} "(hd o (filterVar (f_f::real))) (eqs::bool list)";
14.223 val s = subst_atomic env t;
14.224 UnparseC.term s;
14.225 -val t = TermC.str2term
14.226 +val t = TermC.parse_test @{context}
14.227 "(hd o filterVar A) [A = a * b, a / 2 = r * sin alpha, b / 2 = r * cos alpha]";
14.228 val SOME (t',_) = rewrite_set_ ctxt false prog_expr t;
14.229 val s' = UnparseC.term t';
14.230 (*=== inhibit exn 110726=============================================================
14.231 if s' = "A = a * b" then() else error "new behaviour with prog_expr 3.1.";
14.232 -val env = env @ [(TermC.str2term "h_h::bool", TermC.str2term s')];
14.233 +val env = env @ [(TermC.parse_test @{context} "h_h::bool", TermC.parse_test @{context} s')];
14.234 === inhibit exn 110726=============================================================*)
14.235
14.236 (*--- 2.line in script ---*)
14.237 -val t = TermC.str2term "dropWhile (ident (h_h::bool)) (eqs::bool list)";
14.238 +val t = TermC.parse_test @{context} "dropWhile (ident (h_h::bool)) (eqs::bool list)";
14.239 val s = subst_atomic env t;
14.240 UnparseC.term s;
14.241 -val t = TermC.str2term
14.242 +val t = TermC.parse_test @{context}
14.243 "dropWhile (ident (A = a * b))\
14.244 \ [A = a * b, a / 2 = r * sin alpha, b / 2 = r * cos alpha]";
14.245 (*=== inhibit exn 110726=============================================================
14.246 @@ -687,49 +687,49 @@
14.247 if s' = "[a / 2 = r * sin alpha, b / 2 = r * cos alpha]"
14.248 then () else error "new behaviour with prog_expr 3.2.";
14.249 === inhibit exn 110726=============================================================*)
14.250 -val env = env @ [(TermC.str2term "es_s::bool list", TermC.str2term s')];
14.251 +val env = env @ [(TermC.parse_test @{context} "es_s::bool list", TermC.parse_test @{context} s')];
14.252
14.253 (*--- 3.line in script ---*)
14.254 -val t = TermC.str2term "dropWhile (ident (f_f::real)) (Vars (h_h::bool))";
14.255 +val t = TermC.parse_test @{context} "dropWhile (ident (f_f::real)) (Vars (h_h::bool))";
14.256 val s = subst_atomic env t;
14.257 UnparseC.term s;
14.258 -val t = TermC.str2term "dropWhile (ident A) (Vars (A = a * b))";
14.259 +val t = TermC.parse_test @{context} "dropWhile (ident A) (Vars (A = a * b))";
14.260 (*=== inhibit exn 110726=============================================================
14.261 val SOME (t',_) = rewrite_set_ thy false prog_expr t;
14.262 val s' = UnparseC.term t';
14.263 if s' = "[a, b]" then () else error "new behaviour with prog_expr 3.3.";
14.264 === inhibit exn 110726=============================================================*)
14.265 -val env = env @ [(TermC.str2term "vs_s::real list", TermC.str2term s')];
14.266 +val env = env @ [(TermC.parse_test @{context} "vs_s::real list", TermC.parse_test @{context} s')];
14.267
14.268 (*--- 4.line in script ---*)
14.269 -val t = TermC.str2term "nth_h 1 v_s";
14.270 +val t = TermC.parse_test @{context} "nth_h 1 v_s";
14.271 val s = subst_atomic env t;
14.272 UnparseC.term s;
14.273 -val t = TermC.str2term "nth_h 1 [a, b]";
14.274 +val t = TermC.parse_test @{context} "nth_h 1 [a, b]";
14.275 (*=== inhibit exn 110726=============================================================
14.276 val SOME (t',_) = rewrite_set_ thy false prog_expr t;
14.277 val s' = UnparseC.term t';
14.278 if s' = "a" then () else error "new behaviour with prog_expr 3.4.";
14.279 === inhibit exn 110726=============================================================*)
14.280 -val env = env @ [(TermC.str2term "v_1", TermC.str2term s')];
14.281 +val env = env @ [(TermC.parse_test @{context} "v_1", TermC.parse_test @{context} s')];
14.282
14.283 (*--- 5.line in script ---*)
14.284 -val t = TermC.str2term "nth_h 2 v_s";
14.285 +val t = TermC.parse_test @{context} "nth_h 2 v_s";
14.286 val s = subst_atomic env t;
14.287 UnparseC.term s;
14.288 -val t = TermC.str2term "nth_h 2 [a, b]";
14.289 +val t = TermC.parse_test @{context} "nth_h 2 [a, b]";
14.290 (*=== inhibit exn 110726=============================================================
14.291 val SOME (t',_) = rewrite_set_ thy false prog_expr t;
14.292 val s' = UnparseC.term t';
14.293 if s' = "b" then () else error "new behaviour with prog_expr 3.5.";
14.294 === inhibit exn 110726=============================================================*)
14.295 -val env = env @ [(TermC.str2term "v_2", TermC.str2term s')];
14.296 +val env = env @ [(TermC.parse_test @{context} "v_2", TermC.parse_test @{context} s')];
14.297
14.298 (*--- 6.line in script ---*)
14.299 -val t = TermC.str2term "(hd o (filterVar v_1)) (es_s::bool list)";
14.300 +val t = TermC.parse_test @{context} "(hd o (filterVar v_1)) (es_s::bool list)";
14.301 val s = subst_atomic env t;
14.302 UnparseC.term s;
14.303 -val t = TermC.str2term
14.304 +val t = TermC.parse_test @{context}
14.305 "(hd o filterVar a) [a / 2 = r * sin alpha, b / 2 = r * cos alpha]";
14.306 val SOME (t',_) = rewrite_set_ ctxt false prog_expr t;
14.307 val s' = UnparseC.term t';
14.308 @@ -737,14 +737,14 @@
14.309 if s' = "a / 2 = r * sin alpha" then ()
14.310 else error "new behaviour with prog_expr 3.6.";
14.311 === inhibit exn 110726=============================================================*)
14.312 -val e_1 = TermC.str2term "e_1::bool";
14.313 -val env = env @ [(e_1, TermC.str2term s')];
14.314 +val e_1 = TermC.parse_test @{context} "e_1::bool";
14.315 +val env = env @ [(e_1, TermC.parse_test @{context} s')];
14.316
14.317 (*--- 7.line in script ---*)
14.318 -val t = TermC.str2term "(hd o (filterVar v_2)) (es_s::bool list)";
14.319 +val t = TermC.parse_test @{context} "(hd o (filterVar v_2)) (es_s::bool list)";
14.320 val s = subst_atomic env t;
14.321 UnparseC.term s;
14.322 -val t = TermC.str2term
14.323 +val t = TermC.parse_test @{context}
14.324 "(hd o filterVar b) [a / 2 = r * sin alpha, b / 2 = r * cos alpha]";
14.325 val SOME (t',_) = rewrite_set_ ctxt false prog_expr t;
14.326 val s' = UnparseC.term t';
14.327 @@ -752,30 +752,30 @@
14.328 if s' = "b / 2 = r * cos alpha" then ()
14.329 else error "new behaviour with prog_expr 3.7.";
14.330 === inhibit exn 110726=============================================================*)
14.331 -val env = env @ [(TermC.str2term "e_2::bool", TermC.str2term s')];
14.332 +val env = env @ [(TermC.parse_test @{context} "e_2::bool", TermC.parse_test @{context} s')];
14.333
14.334 (*--- 8.line in script ---*)
14.335 -val t = TermC.str2term "(SubProblem (Reals_s,[univar,equation],[no_met])\
14.336 +val t = TermC.parse_test @{context} "(SubProblem (Reals_s,[univar,equation],[no_met])\
14.337 \ [BOOL e_1, REAL v_1])";
14.338 val s = subst_atomic env t;
14.339 UnparseC.term s;
14.340 "SubProblem (Reals_s, [univar, equation], [no_met])\
14.341 \ [BOOL (a / 2 = r * sin alpha), REAL a]";
14.342 -val s_1 = TermC.str2term "[a = 2*r*sin alpha]";
14.343 -val env = env @ [(TermC.str2term "s_1::bool list", s_1)];
14.344 +val s_1 = TermC.parse_test @{context} "[a = 2*r*sin alpha]";
14.345 +val env = env @ [(TermC.parse_test @{context} "s_1::bool list", s_1)];
14.346
14.347 (*--- 9.line in script ---*)
14.348 -val t = TermC.str2term "(SubProblem (Reals_s,[univar,equation],[no_met])\
14.349 +val t = TermC.parse_test @{context} "(SubProblem (Reals_s,[univar,equation],[no_met])\
14.350 \ [BOOL e_2, REAL v_2])";
14.351 val s = subst_atomic env t;
14.352 UnparseC.term s;
14.353 "SubProblem (Reals_s, [univar, equation], [no_met])\
14.354 \ [BOOL (b / 2 = r * cos alpha), REAL b]";
14.355 -val s_2 = TermC.str2term "[b = 2*r*cos alpha]";
14.356 -val env = env @ [(TermC.str2term "s_2::bool list", s_2)];
14.357 +val s_2 = TermC.parse_test @{context} "[b = 2*r*cos alpha]";
14.358 +val env = env @ [(TermC.parse_test @{context} "s_2::bool list", s_2)];
14.359
14.360 (*--- 10.line in script ---*)
14.361 -val t = TermC.str2term
14.362 +val t = TermC.parse_test @{context}
14.363 "Substitute [(v_1 = (rhs o hd) s_1),(v_2 = (rhs o hd) s_2)] (h_h::bool)";
14.364 val s = subst_atomic env t;
14.365 UnparseC.term s;
15.1 --- a/test/Tools/isac/Knowledge/diff.sml Sun Oct 09 06:53:03 2022 +0200
15.2 +++ b/test/Tools/isac/Knowledge/diff.sml Sun Oct 09 07:44:22 2022 +0200
15.3 @@ -218,11 +218,11 @@
15.4 "----------- primed id ----------------------------------";
15.5 "----------- primed id ----------------------------------";
15.6 val ctxt = Proof_Context.init_global @{theory Isac_Knowledge};
15.7 -val f_ = TermC.str2term "f_f::bool";
15.8 -val f = TermC.str2term "A = s * (a - s)";
15.9 -val v_ = TermC.str2term "v_v";
15.10 -val v = TermC.str2term "s";
15.11 -val screxp0 = TermC.str2term "Take ((primed (lhs f_f)) = d_d v_v (rhs f_f))";
15.12 +val f_ = TermC.parse_test @{context} "f_f::bool";
15.13 +val f = TermC.parse_test @{context} "A = s * (a - s)";
15.14 +val v_ = TermC.parse_test @{context} "v_v";
15.15 +val v = TermC.parse_test @{context} "s";
15.16 +val screxp0 = TermC.parse_test @{context} "Take ((primed (lhs f_f)) = d_d v_v (rhs f_f))";
15.17 TermC.atomty screxp0;
15.18
15.19 val screxp1 = subst_atomic [(f_, f), (v_, v)] screxp0;
15.20 @@ -268,32 +268,32 @@
15.21 "----------- diff_conv, sym_diff_conv -------------------";
15.22 "----------- diff_conv, sym_diff_conv -------------------";
15.23 "----------- diff_conv, sym_diff_conv -------------------";
15.24 -val subs = [(TermC.str2term "bdv", TermC.str2term "x")];
15.25 +val subs = [(TermC.parse_test @{context} "bdv", TermC.parse_test @{context} "x")];
15.26 val rls = diff_conv;
15.27
15.28 -val t = TermC.str2term "2/x \<up> 2";
15.29 +val t = TermC.parse_test @{context} "2/x \<up> 2";
15.30 val SOME (t,_) = rewrite_set_inst_ ctxt false subs rls t; UnparseC.term t;
15.31 if UnparseC.term t = "2 * x \<up> - 2" then () else error "diff.sml 1/x";
15.32
15.33 -val t = TermC.str2term "sqrt (x \<up> 3)";
15.34 +val t = TermC.parse_test @{context} "sqrt (x \<up> 3)";
15.35 val SOME (t,_) = rewrite_set_inst_ ctxt false subs rls t; UnparseC.term t;
15.36 if UnparseC.term t = "x \<up> (3 / 2)" then () else error "diff.sml x \<up> 1/2";
15.37
15.38 -val t = TermC.str2term "2 / sqrt x \<up> 3";
15.39 +val t = TermC.parse_test @{context} "2 / sqrt x \<up> 3";
15.40 val SOME (t,_) = rewrite_set_inst_ ctxt false subs rls t; UnparseC.term t;
15.41 if UnparseC.term t = "2 * x \<up> (- 3 / 2)" then () else error "diff.sml x \<up> - 1/2";
15.42
15.43 val rls = diff_sym_conv;
15.44
15.45 -val t = TermC.str2term "2 * x \<up> - 2";
15.46 +val t = TermC.parse_test @{context} "2 * x \<up> - 2";
15.47 val SOME (t, _) = rewrite_set_inst_ ctxt false subs rls t; UnparseC.term t;
15.48 if UnparseC.term t = "2 / x \<up> 2" then () else error "diff.sml sym 1/x";
15.49
15.50 -val t = TermC.str2term "x \<up> (3 / 2)";
15.51 +val t = TermC.parse_test @{context} "x \<up> (3 / 2)";
15.52 val SOME (t,_) = rewrite_set_inst_ ctxt false subs rls t; UnparseC.term t;
15.53 if UnparseC.term t = "sqrt (x \<up> 3)" then ((*..wrong rewrite*)) else error"diff.sml sym x \<up> 1/x";
15.54
15.55 -val t = TermC.str2term "2 * x \<up> (-3 / 2)";
15.56 +val t = TermC.parse_test @{context} "2 * x \<up> (-3 / 2)";
15.57 val SOME (t,_) = rewrite_set_inst_ ctxt false subs rls t; UnparseC.term t;
15.58 if UnparseC.term t ="2 / sqrt (x \<up> 3)"then()else error"diff.sml sym x \<up> - 1/x";
15.59
15.60 @@ -388,14 +388,14 @@
15.61 "----------- tests for examples -------------------------";
15.62 "----------- tests for examples -------------------------";
15.63 "----- TermC.parse errors";
15.64 -(*TermC.str2term "F = sqrt( y \<up> 2 - O) * (z + O \<up> 2)";
15.65 -TermC.str2term "O";
15.66 -TermC.str2term "OO"; ---errors*)
15.67 -TermC.str2term "OOO";
15.68 +(*TermC.parse_test @{context} "F = sqrt( y \<up> 2 - O) * (z + O \<up> 2)";
15.69 +TermC.parse_test @{context} "O";
15.70 +TermC.parse_test @{context} "OO"; ---errors*)
15.71 +TermC.parse_test @{context} "OOO";
15.72
15.73 "----- thm 'diff_prod_const'";
15.74 -val subs = [(TermC.str2term "bdv", TermC.str2term "l")];
15.75 -val f = TermC.str2term "G' = d_d l (l * sqrt (7 * s \<up> 2 - l \<up> 2))";
15.76 +val subs = [(TermC.parse_test @{context} "bdv", TermC.parse_test @{context} "l")];
15.77 +val f = TermC.parse_test @{context} "G' = d_d l (l * sqrt (7 * s \<up> 2 - l \<up> 2))";
15.78
15.79 "------------inform for x \<up> 2+x+1 -------------------------";
15.80 "------------inform for x \<up> 2+x+1 -------------------------";
16.1 --- a/test/Tools/isac/Knowledge/eqsystem-1.sml Sun Oct 09 06:53:03 2022 +0200
16.2 +++ b/test/Tools/isac/Knowledge/eqsystem-1.sml Sun Oct 09 07:44:22 2022 +0200
16.3 @@ -33,46 +33,46 @@
16.4 "----------- occur_exactly_in ------------------------------------";
16.5 "----------- occur_exactly_in ------------------------------------";
16.6 "----------- occur_exactly_in ------------------------------------";
16.7 -val all = [TermC.str2term"c", TermC.str2term"c_2", TermC.str2term"c_3"];
16.8 -val t = TermC.str2term"0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2";
16.9 +val all = [TermC.parse_test @{context}"c", TermC.parse_test @{context}"c_2", TermC.parse_test @{context}"c_3"];
16.10 +val t = TermC.parse_test @{context}"0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2";
16.11
16.12 -if occur_exactly_in [TermC.str2term"c", TermC.str2term"c_2"] all t
16.13 +if occur_exactly_in [TermC.parse_test @{context}"c", TermC.parse_test @{context}"c_2"] all t
16.14 then () else error "eqsystem.sml occur_exactly_in 1";
16.15
16.16 -if not (occur_exactly_in [TermC.str2term"c", TermC.str2term"c_2", TermC.str2term"c_3"] all t)
16.17 +if not (occur_exactly_in [TermC.parse_test @{context}"c", TermC.parse_test @{context}"c_2", TermC.parse_test @{context}"c_3"] all t)
16.18 then () else error "eqsystem.sml occur_exactly_in 2";
16.19
16.20 -if not (occur_exactly_in [TermC.str2term"c_2"] all t)
16.21 +if not (occur_exactly_in [TermC.parse_test @{context}"c_2"] all t)
16.22 then () else error "eqsystem.sml occur_exactly_in 3";
16.23
16.24 -val t = TermC.str2term"[c,c_2] from [c,c_2,c_3] occur_exactly_in - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2";
16.25 +val t = TermC.parse_test @{context}"[c,c_2] from [c,c_2,c_3] occur_exactly_in - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2";
16.26 eval_occur_exactly_in 0 "EqSystem.occur_exactly_in" t 0;
16.27 val SOME (str, t') = eval_occur_exactly_in 0 "EqSystem.occur_exactly_in" t 0;
16.28 if str = "[c, c_2] from [c, c_2,\n" ^
16.29 " c_3] occur_exactly_in - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2 = True"
16.30 then () else error "eval_occur_exactly_in [c, c_2]";
16.31
16.32 -val t = TermC.str2term ("[c,c_2,c_3] from [c,c_2,c_3] occur_exactly_in " ^
16.33 +val t = TermC.parse_test @{context} ("[c,c_2,c_3] from [c,c_2,c_3] occur_exactly_in " ^
16.34 "- 1 * q_0 * L \<up> 2 / 2 + L * c + c_2");
16.35 val SOME (str, t') = eval_occur_exactly_in 0 "EqSystem.occur_exactly_in" t 0;
16.36 if str = "[c, c_2,\n c_3] from [c, c_2,\n" ^
16.37 " c_3] occur_exactly_in - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2 = False"
16.38 then () else error "eval_occur_exactly_in [c, c_2, c_3]";
16.39
16.40 -val t = TermC.str2term"[c_2] from [c,c_2,c_3] occur_exactly_in \
16.41 +val t = TermC.parse_test @{context}"[c_2] from [c,c_2,c_3] occur_exactly_in \
16.42 \- 1 * q_0 * L \<up> 2 / 2 + L * c + c_2";
16.43 val SOME (str, t') = eval_occur_exactly_in 0 "EqSystem.occur_exactly_in" t 0;
16.44 if str = "[c_2] from [c, c_2,\n" ^
16.45 " c_3] occur_exactly_in - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2 = False"
16.46 then () else error "eval_occur_exactly_in [c, c_2, c_3]";
16.47
16.48 -val t = TermC.str2term"[] from [c,c_2,c_3] occur_exactly_in 0";
16.49 +val t = TermC.parse_test @{context}"[] from [c,c_2,c_3] occur_exactly_in 0";
16.50 val SOME (str, t') = eval_occur_exactly_in 0 "EqSystem.occur_exactly_in" t 0;
16.51 if str = "[] from [c, c_2, c_3] occur_exactly_in 0 = True" then ()
16.52 else error "eval_occur_exactly_in [c, c_2, c_3]";
16.53
16.54 val t =
16.55 - TermC.str2term
16.56 + TermC.parse_test @{context}
16.57 "[] from [c, c_2, c_3, c_4] occur_exactly_in - 1 * (q_0 * L \<up> 2) /2";
16.58 val SOME (str, t') = eval_occur_exactly_in 0 "EqSystem.occur_exactly_in" t 0;
16.59 if str = "[] from [c, c_2, c_3, c_4] occur_exactly_in \
16.60 @@ -82,7 +82,7 @@
16.61 "----------- problems --------------------------------------------";
16.62 "----------- problems --------------------------------------------";
16.63 "----------- problems --------------------------------------------";
16.64 -val t = TermC.str2term "Length [x+y=1,y=2] = 2";
16.65 +val t = TermC.parse_test @{context} "Length [x+y=1,y=2] = 2";
16.66 TermC.atomty t;
16.67 val testrls = Rule_Set.append_rules "testrls" Rule_Set.empty
16.68 [(Thm ("LENGTH_NIL", @{thm LENGTH_NIL})),
16.69 @@ -99,10 +99,10 @@
16.70 val SOME t = TermC.parseNEW ctxt "solution LL";
16.71 TermC.atomty t;
16.72
16.73 -val t = TermC.str2term
16.74 +val t = TermC.parse_test @{context}
16.75 "(tl (tl (tl v_s))) from v_s occur_exactly_in (NTH 1 (e_s::bool list))";
16.76 TermC.atomty t;
16.77 -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 " ^
16.78 +val t = TermC.parse_test @{context} ("(tl (tl (tl [c, c_2, c_3, c_4]))) from [c, c_2, c_3, c_4] occur_exactly_in " ^
16.79 "(NTH 1 [c_4 = 1, 2 = 2, 3 = 3, 4 = 4])");
16.80 (*----- broken in child of.1790e1073acc : eliminate "handle _ => ..." from Rewrite.rewrite -----\\
16.81 assume flawed test setup hidden by "handle _ => ..."
16.82 @@ -126,39 +126,39 @@
16.83 "----------- rewrite-order ord_simplify_System -------------------";
16.84 "M_b x = c * x + - 1 * q_0 * (x \<up> 2 / 2) + c_2";
16.85 "--- add.commute ---"; (* ... add.commute cf. b42e334c97ee *)
16.86 -if ord_simplify_System false thy [] (TermC.str2term"- 1 * q_0 * (x \<up> 2 / 2)",
16.87 - TermC.str2term"c * x") then ()
16.88 +if ord_simplify_System false thy [] (TermC.parse_test @{context}"- 1 * q_0 * (x \<up> 2 / 2)",
16.89 + TermC.parse_test @{context}"c * x") then ()
16.90 else error "integrate.sml, (- 1 * q_0 * (x \<up> 2 / 2)) < (c * x) not#1";
16.91
16.92 -if ord_simplify_System false thy [] (TermC.str2term"- 1 * q_0 * (x \<up> 2 / 2)",
16.93 - TermC.str2term"c_2") then ()
16.94 +if ord_simplify_System false thy [] (TermC.parse_test @{context}"- 1 * q_0 * (x \<up> 2 / 2)",
16.95 + TermC.parse_test @{context}"c_2") then ()
16.96 else error "integrate.sml, (- 1 * q_0 * (x \<up> 2 / 2)) < (c_2) not#2";
16.97
16.98 -if ord_simplify_System false thy [] (TermC.str2term"c * x",
16.99 - TermC.str2term"c_2") then ()
16.100 +if ord_simplify_System false thy [] (TermC.parse_test @{context}"c * x",
16.101 + TermC.parse_test @{context}"c_2") then ()
16.102 else error "integrate.sml, (c * x) < (c_2) not#3";
16.103
16.104 "--- mult.commute ---";
16.105 -if ord_simplify_System false thy [] (TermC.str2term"x * c",
16.106 - TermC.str2term"c * x") then ()
16.107 +if ord_simplify_System false thy [] (TermC.parse_test @{context}"x * c",
16.108 + TermC.parse_test @{context}"c * x") then ()
16.109 else error "integrate.sml, (x * c) < (c * x) not#4";
16.110
16.111 -if ord_simplify_System false thy [] (TermC.str2term"- 1 * q_0 * (x \<up> 2 / 2) * c",
16.112 - TermC.str2term"- 1 * q_0 * c * (x \<up> 2 / 2)")
16.113 +if ord_simplify_System false thy [] (TermC.parse_test @{context}"- 1 * q_0 * (x \<up> 2 / 2) * c",
16.114 + TermC.parse_test @{context}"- 1 * q_0 * c * (x \<up> 2 / 2)")
16.115 then () else error "integrate.sml, (. * .) < (. * .) not#5";
16.116
16.117 -if ord_simplify_System false thy [] (TermC.str2term"- 1 * q_0 * (x \<up> 2 / 2) * c",
16.118 - TermC.str2term"c * - 1 * q_0 * (x \<up> 2 / 2)")
16.119 +if ord_simplify_System false thy [] (TermC.parse_test @{context}"- 1 * q_0 * (x \<up> 2 / 2) * c",
16.120 + TermC.parse_test @{context}"c * - 1 * q_0 * (x \<up> 2 / 2)")
16.121 then () else error "integrate.sml, (. * .) < (. * .) not#6";
16.122
16.123
16.124 "----------- rewrite in [EqSystem,normalise,2x2] -----------------";
16.125 "----------- rewrite in [EqSystem,normalise,2x2] -----------------";
16.126 "----------- rewrite in [EqSystem,normalise,2x2] -----------------";
16.127 -val t = TermC.str2term"[0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2,\
16.128 +val t = TermC.parse_test @{context}"[0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2,\
16.129 \0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2]";
16.130 -val bdvs = [(TermC.str2term"bdv_1",TermC.str2term"c"),
16.131 - (TermC.str2term"bdv_2",TermC.str2term"c_2")];
16.132 +val bdvs = [(TermC.parse_test @{context}"bdv_1",TermC.parse_test @{context}"c"),
16.133 + (TermC.parse_test @{context}"bdv_2",TermC.parse_test @{context}"c_2")];
16.134 val SOME (t,_) = rewrite_set_inst_ ctxt true bdvs simplify_System_parenthesized t;
16.135 if UnparseC.term t = "[0 = - 1 * q_0 * L \<up> 2 / 2 + (L * c + c_2), 0 = c_2]"
16.136 then () else error "eqsystem.sml rewrite in 2x2 simplify_System_par.1";
16.137 @@ -182,7 +182,7 @@
16.138 val thy = @{theory "Isac_Knowledge"} (*because of Undeclared constant "Biegelinie.EI*);
16.139 val ctxt = Proof_Context.init_global thy;
16.140 val t =
16.141 - TermC.str2term"[0 = c_2 + c * 0 + 1 / EI * (L * q_0 / 12 * 0 \<up> 3 + \
16.142 + TermC.parse_test @{context}"[0 = c_2 + c * 0 + 1 / EI * (L * q_0 / 12 * 0 \<up> 3 + \
16.143 \ - 1 * q_0 / 24 * 0 \<up> 4),\
16.144 \ 0 = c_2 + c * L + 1 / EI * (L * q_0 / 12 * L \<up> 3 + \
16.145 \ - 1 * q_0 / 24 * L \<up> 4)]";
16.146 @@ -218,10 +218,10 @@
16.147 "----------- rewrite in [EqSystem,top_down_substitution,2x2] -----";
16.148 "----------- rewrite in [EqSystem,top_down_substitution,2x2] -----";
16.149 "----------- rewrite in [EqSystem,top_down_substitution,2x2] -----";
16.150 -val e1__ = TermC.str2term "c_2 = 77";
16.151 -val e2__ = TermC.str2term "L * c + c_2 = q_0 * L \<up> 2 / 2";
16.152 -val bdvs = [(TermC.str2term"bdv_1",TermC.str2term"c"),
16.153 - (TermC.str2term"bdv_2",TermC.str2term"c_2")];
16.154 +val e1__ = TermC.parse_test @{context} "c_2 = 77";
16.155 +val e2__ = TermC.parse_test @{context} "L * c + c_2 = q_0 * L \<up> 2 / 2";
16.156 +val bdvs = [(TermC.parse_test @{context}"bdv_1",TermC.parse_test @{context}"c"),
16.157 + (TermC.parse_test @{context}"bdv_2",TermC.parse_test @{context}"c_2")];
16.158 val SOME (e2__,_) = rewrite_terms_ ctxt Rewrite_Ord.function_empty Rule_Set.Empty [e1__] e2__;
16.159 if UnparseC.term e2__ = "L * c + 77 = q_0 * L \<up> 2 / 2" then ()
16.160 else error "eqsystem.sml top_down_substitution,2x2] subst";
16.161 @@ -235,15 +235,15 @@
16.162 if UnparseC.term e2__ = "c = (q_0 * L \<up> 2 / 2 + - 1 * 77) / L" then ()
16.163 else error "eqsystem.sml top_down_substitution,2x2] isolate";
16.164
16.165 -val t = TermC.str2term "[c_2 = 77, c = (q_0 * L \<up> 2 / 2 + - 1 * 77) / L]";
16.166 +val t = TermC.parse_test @{context} "[c_2 = 77, c = (q_0 * L \<up> 2 / 2 + - 1 * 77) / L]";
16.167 val SOME (t,_) = rewrite_set_ ctxt true order_system t;
16.168 if UnparseC.term t = "[c = (q_0 * L \<up> 2 / 2 + - 1 * 77) / L, c_2 = 77]" then ()
16.169 else error "eqsystem.sml top_down_substitution,2x2] order_system";
16.170
16.171 if not (ord_simplify_System
16.172 false thy []
16.173 - (TermC.str2term"[c_2 = 77, c = (q_0 * L \<up> 2 / 2 + - 1 * 77) / L]",
16.174 - TermC.str2term"[c = (q_0 * L \<up> 2 / 2 + - 1 * 77) / L, c_2 = 77]"))
16.175 + (TermC.parse_test @{context}"[c_2 = 77, c = (q_0 * L \<up> 2 / 2 + - 1 * 77) / L]",
16.176 + TermC.parse_test @{context}"[c = (q_0 * L \<up> 2 / 2 + - 1 * 77) / L, c_2 = 77]"))
16.177 then () else error "eqsystem.sml, order_result rew_ord";
16.178
16.179
16.180 @@ -251,15 +251,15 @@
16.181 "----------- rewrite in [EqSystem,normalise,4x4] -----------------";
16.182 "----------- rewrite in [EqSystem,normalise,4x4] -----------------";
16.183 (*STOPPED.WN06?: revise rewrite in [EqSystem,normalise,4x4] from before 0609*)
16.184 -val t = TermC.str2term (
16.185 +val t = TermC.parse_test @{context} (
16.186 "[(0::real) = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c_3 + c_4, " ^
16.187 "(0::real) = - 1 * q_0 * L \<up> 2 / 2 + L * c_3 + c_4, " ^
16.188 "c + c_2 + c_3 + c_4 = 0, " ^
16.189 "c_2 + c_3 + c_4 = 0]");
16.190 -val bdvs = [(TermC.str2term"bdv_1::real",TermC.str2term"c::real"),
16.191 - (TermC.str2term"bdv_2::real",TermC.str2term"c_2::real"),
16.192 - (TermC.str2term"bdv_3::real",TermC.str2term"c_3::real"),
16.193 - (TermC.str2term"bdv_4::real",TermC.str2term"c_4::real")];
16.194 +val bdvs = [(TermC.parse_test @{context}"bdv_1::real",TermC.parse_test @{context}"c::real"),
16.195 + (TermC.parse_test @{context}"bdv_2::real",TermC.parse_test @{context}"c_2::real"),
16.196 + (TermC.parse_test @{context}"bdv_3::real",TermC.parse_test @{context}"c_3::real"),
16.197 + (TermC.parse_test @{context}"bdv_4::real",TermC.parse_test @{context}"c_4::real")];
16.198 val SOME (t, _) =
16.199 rewrite_set_inst_ ctxt true bdvs simplify_System_parenthesized t;
16.200 if UnparseC.term t = "[0 = c_4, 0 = - 1 * q_0 * L \<up> 2 / 2 + (L * c_3 + c_4),\n c + (c_2 + (c_3 + c_4)) = 0, c_2 + (c_3 + c_4) = 0]"
16.201 @@ -367,7 +367,7 @@
16.202 (*... resulted in
16.203 False "[c, c_2] from_ [c, c_2] occur_exactly_in nth_ 2\n
16.204 [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2]"]*)
16.205 -val t = TermC.str2term ("[c, c_2] from [c, c_2] occur_exactly_in NTH 2" ^
16.206 +val t = TermC.parse_test @{context} ("[c, c_2] from [c, c_2] occur_exactly_in NTH 2" ^
16.207 "[c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2]");
16.208
16.209 val SOME (t', _) = rewrite_set_ ctxt false prls_triangular t;
17.1 --- a/test/Tools/isac/Knowledge/eqsystem-2.sml Sun Oct 09 06:53:03 2022 +0200
17.2 +++ b/test/Tools/isac/Knowledge/eqsystem-2.sml Sun Oct 09 07:44:22 2022 +0200
17.3 @@ -108,8 +108,8 @@
17.4 "----------- all systems from Biegelinie -------------------------";
17.5 val thy = @{theory Isac_Knowledge}
17.6 val subst =
17.7 - [(TermC.str2term "bdv_1", TermC.str2term "c"), (TermC.str2term "bdv_2", TermC.str2term "c_2"),
17.8 - (TermC.str2term "bdv_3", TermC.str2term "c_3"), (TermC.str2term "bdv_4", TermC.str2term "c_4")];
17.9 + [(TermC.parse_test @{context} "bdv_1", TermC.parse_test @{context} "c"), (TermC.parse_test @{context} "bdv_2", TermC.parse_test @{context} "c_2"),
17.10 + (TermC.parse_test @{context} "bdv_3", TermC.parse_test @{context} "c_3"), (TermC.parse_test @{context} "bdv_4", TermC.parse_test @{context} "c_4")];
17.11
17.12 "------- Bsp 7.27";
17.13 States.reset ();
17.14 @@ -125,7 +125,7 @@
17.15 c c_2 c_3 c_4 c c_2 1->2: c
17.16 c_2 c_4
17.17 c c_2 c c_2 c_3 c_4 [2':c, 1:c_2, 3:c_4] -> 4:c_3*)
17.18 -val t = TermC.str2term
17.19 +val t = TermC.parse_test @{context}
17.20 ("[0 = c_4, " ^
17.21 "0 = c_4 + L * c_3 +(12 * L \<up> 2 * c_2 + 4 * L \<up> 3 * c + - 1 * L \<up> 4 * q_0) / (- 24 * EI), " ^
17.22 "0 = c_2, " ^
17.23 @@ -136,7 +136,7 @@
17.24 then () else error "Bsp 7.27";
17.25
17.26 "----- Bsp 7.27 go through the rewrites in met_eqsys_norm_4x4";
17.27 -val t = TermC.str2term "0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2";
17.28 +val t = TermC.parse_test @{context} "0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2";
17.29 val NONE = rewrite_set_ ctxt false norm_Rational t;
17.30 val SOME (t,_) =
17.31 rewrite_set_inst_ ctxt false subst simplify_System_parenthesized t;
17.32 @@ -181,7 +181,7 @@
17.33 c c_2 c_3 c_4 c c_2 c_3 1:c_3 -> 2:c c_2 2: c c_2
17.34 c_3 c_4
17.35 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.36 -val t = TermC.str2term
17.37 +val t = TermC.parse_test @{context}
17.38 ("[0 = c_4 + 0 / (- 1 * EI), " ^
17.39 "0 = c_4 + L * c_3 + (12 * L \<up> 2 * c_2 + 4 * L \<up> 3 * c + - 1 * L \<up> 4 * q_0) / (- 24 * EI), " ^
17.40 "0 = c_3 + 0 / (- 1 * EI), " ^
17.41 @@ -203,7 +203,7 @@
17.42 c_4 | STOPPED.WN06? test methods @@@@@@@@@@@@@@@@@@@@@@@*)
17.43
17.44 "----- 7.70 go through the rewrites in met_eqsys_norm_4x4";
17.45 -val t = TermC.str2term
17.46 +val t = TermC.parse_test @{context}
17.47 ("[L * q_0 = c, " ^
17.48 "0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2, " ^
17.49 "0 = c_4, " ^
17.50 @@ -321,7 +321,7 @@
17.51 c_4 | c_3 |2:c_3 -> 4' :c c_2 c_4 | |
17.52 c c_2 c_3 c_4 | c_4 |3' | |
17.53 c_3 |c c_2 c_3 c_4 |3:c_4 -> 4'':c c_2 |4'':c c_2 | *)
17.54 -val t = TermC.str2term"[0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2, \
17.55 +val t = TermC.parse_test @{context}"[0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2, \
17.56 \ 0 = c_4 + 0 / (- 1 * EI), \
17.57 \ 0 = c_4 + L * c_3 +(12 * L \<up> 2 * c_2 + 4 * L \<up> 3 * c + - 1 * L \<up> 4 * q_0) /(- 24 * EI),\
17.58 \ 0 = c_3 + 0 / (- 1 * EI)]";
17.59 @@ -356,7 +356,7 @@
17.60 c c_2 | |1:c_2 -> 2':c |c_2 c
17.61 c_4 | | |
17.62 c c_2 c_3 c_4 | |3:c_4 -> 4':c c_2 c_3 |c_2 c c_3*)
17.63 -val t = TermC.str2term"[0 = c_2, \
17.64 +val t = TermC.parse_test @{context}"[0 = c_2, \
17.65 \ 0 = (6 * c_2 + 6 * L * c + - 1 * L \<up> 2 * q_0) / 6, \
17.66 \ 0 = c_4 + 0 / (- 1 * EI), \
17.67 \ 0 = c_4 + L * c_3 + (60 * L \<up> 2 * c_2 + 20 * L \<up> 3 * c + - 1 * L \<up> 4 * q_0) / (- 120 * EI)]";
18.1 --- a/test/Tools/isac/Knowledge/integrate.sml Sun Oct 09 06:53:03 2022 +0200
18.2 +++ b/test/Tools/isac/Knowledge/integrate.sml Sun Oct 09 07:44:22 2022 +0200
18.3 @@ -51,14 +51,14 @@
18.4 "----------- parsing ------------------------------------";
18.5 "----------- parsing ------------------------------------";
18.6 "----------- parsing ------------------------------------";
18.7 -val t = TermC.str2term "Integral x D x";
18.8 -val t = TermC.str2term "Integral x \<up> 2 D x";
18.9 +val t = TermC.parse_test @{context} "Integral x D x";
18.10 +val t = TermC.parse_test @{context} "Integral x \<up> 2 D x";
18.11 case t of
18.12 Const (\<^const_name>\<open>Integral\<close>, _) $
18.13 (Const (\<^const_name>\<open>realpow\<close>, _) $ Free _ $ _) $ Free ("x", _) => ()
18.14 | _ => error "integrate.sml: parsing: Integral x \<up> 2 D x";
18.15
18.16 -val t = TermC.str2term "ff x is_f_x";
18.17 +val t = TermC.parse_test @{context} "ff x is_f_x";
18.18 case t of Const (\<^const_name>\<open>is_f_x\<close>, _) $ _ => ()
18.19 | _ => error "integrate.sml: parsing: ff x is_f_x";
18.20
18.21 @@ -66,26 +66,26 @@
18.22 "----------- integrate by rewriting ---------------------";
18.23 "----------- integrate by rewriting ---------------------";
18.24 "----------- integrate by rewriting ---------------------";
18.25 -val str = rewrit @{thm "integral_const"} (TermC.str2term "Integral 1 D x");
18.26 +val str = rewrit @{thm "integral_const"} (TermC.parse_test @{context} "Integral 1 D x");
18.27 if term2s str = "1 * x" then () else error "integrate.sml Integral 1 D x";
18.28
18.29 -val str = rewrit @{thm "integral_const"} (TermC.str2term "Integral M'/EJ D x");
18.30 +val str = rewrit @{thm "integral_const"} (TermC.parse_test @{context} "Integral M'/EJ D x");
18.31 if term2s str = "M' / EJ * x" then ()
18.32 else error "Integral M'/EJ D x BY integral_const";
18.33
18.34 -val str = rewrit @{thm "integral_var"} (TermC.str2term "Integral x D x");
18.35 +val str = rewrit @{thm "integral_var"} (TermC.parse_test @{context} "Integral x D x");
18.36 if term2s str = "x \<up> 2 / 2" then ()
18.37 else error "Integral x D x BY integral_var";
18.38
18.39 -val str = rewrit @{thm "integral_add"} (TermC.str2term "Integral x + 1 D x");
18.40 +val str = rewrit @{thm "integral_add"} (TermC.parse_test @{context} "Integral x + 1 D x");
18.41 if term2s str = "Integral x D x + Integral 1 D x" then ()
18.42 else error "Integral x + 1 D x BY integral_add";
18.43
18.44 -val str = rewrit @{thm "integral_mult"} (TermC.str2term "Integral M'/EJ * x \<up> 3 D x");
18.45 +val str = rewrit @{thm "integral_mult"} (TermC.parse_test @{context} "Integral M'/EJ * x \<up> 3 D x");
18.46 if term2s str = "M' / EJ * Integral x \<up> 3 D x" then ()
18.47 else error "Integral M'/EJ * x \<up> 3 D x BY integral_mult";
18.48
18.49 -val str = rewrit @{thm "integral_pow"} (TermC.str2term "Integral x \<up> 3 D x");
18.50 +val str = rewrit @{thm "integral_pow"} (TermC.parse_test @{context} "Integral x \<up> 3 D x");
18.51 if term2s str = "x \<up> (3 + 1) / (3 + 1)" then ()
18.52 else error "integrate.sml Integral x \<up> 3 D x";
18.53
18.54 @@ -93,7 +93,7 @@
18.55 "----------- test add_new_c, TermC.is_f_x ---------------------";
18.56 "----------- test add_new_c, TermC.is_f_x ---------------------";
18.57 "----------- test add_new_c, TermC.is_f_x ---------------------";
18.58 -val term = TermC.str2term "x \<up> 2 * c + c_2";
18.59 +val term = TermC.parse_test @{context} "x \<up> 2 * c + c_2";
18.60 val cc = new_c term;
18.61 if UnparseC.term cc = "c_3" then () else error "integrate.sml: new_c ???";
18.62
18.63 @@ -108,7 +108,7 @@
18.64 if UnparseC.term t' = "x \<up> 2 * c + c_2 + c_3" then ()
18.65 else error "intergrate.sml: diff. rewrite_set add_new_c 1";
18.66
18.67 -val term = TermC.str2term "ff x = x \<up> 2*c + c_2";
18.68 +val term = TermC.parse_test @{context} "ff x = x \<up> 2*c + c_2";
18.69 val SOME (t',_) = rewrite_set_ ctxt true add_new_c term;
18.70 if UnparseC.term t' = "ff x = x \<up> 2 * c + c_2 + c_3" then ()
18.71 else error "intergrate.sml: diff. rewrite_set add_new_c 2";
18.72 @@ -173,9 +173,9 @@
18.73 "----------- simplify by ruleset reducing make_ratpoly_in";
18.74 val thy = @{theory "Isac_Knowledge"};
18.75 val ctxt = Proof_Context.init_global thy;
18.76 -val subst = [(TermC.str2term "bdv ::real", TermC.str2term "x ::real")]; (*DOESN'T HELP*)
18.77 +val subst = [(TermC.parse_test @{context} "bdv ::real", TermC.parse_test @{context} "x ::real")]; (*DOESN'T HELP*)
18.78 "===== test 1";
18.79 -val t = TermC.str2term "1/EI * (L * q_0 * x / 2 + - 1 * q_0 * x \<up> 2 / 2)";
18.80 +val t = TermC.parse_test @{context} "1/EI * (L * q_0 * x / 2 + - 1 * q_0 * x \<up> 2 / 2)";
18.81
18.82 "----- stepwise from the rulesets in simplify_Integral and below-----";
18.83 val rls = norm_Rational_noadd_fractions;
18.84 @@ -196,7 +196,7 @@
18.85 else error "integrate.sml simplify by ruleset discard_parenth.. #3";
18.86
18.87 "===== test 4";
18.88 -val subs = [(TermC.str2term "bdv::real", TermC.str2term "x::real")];
18.89 +val subs = [(TermC.parse_test @{context} "bdv::real", TermC.parse_test @{context} "x::real")];
18.90 val rls =
18.91 (Rule_Set.append_rules "separate_bdv" collect_bdv
18.92 [Thm ("separate_bdv", @{thm separate_bdv}),
18.93 @@ -221,7 +221,7 @@
18.94 else error "integrate.sml simplify by ruleset separate_bdv.. #4";
18.95
18.96 "===== test 5";
18.97 -val t = TermC.str2term "1/EI * (L * q_0 * x / 2 + - 1 * q_0 * x \<up> 2 / 2)";
18.98 +val t = TermC.parse_test @{context} "1/EI * (L * q_0 * x / 2 + - 1 * q_0 * x \<up> 2 / 2)";
18.99 val rls = simplify_Integral;
18.100 val SOME (t,[]) = rewrite_set_inst_ ctxt true subs rls t;
18.101 (* given was: "1 / EI * (L * q_0 * x / 2 + - 1 * q_0 * x \<up> 2 / 2)" *)
18.102 @@ -231,10 +231,10 @@
18.103 "........... 2nd integral ........................................";
18.104 "........... 2nd integral ........................................";
18.105 "........... 2nd integral ........................................";
18.106 -val subs = [(TermC.str2term "bdv::real", TermC.str2term "x::real")];
18.107 +val subs = [(TermC.parse_test @{context} "bdv::real", TermC.parse_test @{context} "x::real")];
18.108
18.109 val thy = @{theory Biegelinie};
18.110 -val t = TermC.str2term
18.111 +val t = TermC.parse_test @{context}
18.112 "Integral 1 / EI * (L * q_0 / 2 * (x \<up> 2 / 2) + - 1 * q_0 / 2 * (x \<up> 3 / 3)) D x";
18.113
18.114 val rls = simplify_Integral;
18.115 @@ -309,7 +309,7 @@
18.116 "----------- rewrite 3rd integration in 7.27 ------------";
18.117 "----------- rewrite 3rd integration in 7.27 ------------";
18.118 "----------- rewrite 3rd integration in 7.27 ------------";
18.119 -val t = TermC.str2term "Integral 1 / EI * ((L * q_0 * x + - 1 * q_0 * x \<up> 2) / 2) D x";
18.120 +val t = TermC.parse_test @{context} "Integral 1 / EI * ((L * q_0 * x + - 1 * q_0 * x \<up> 2) / 2) D x";
18.121 val SOME(t, _)= rewrite_set_inst_ ctxt true subs simplify_Integral t;
18.122 if UnparseC.term t =
18.123 "Integral 1 / EI * (L * q_0 / 2 * x + - 1 * q_0 / 2 * x \<up> 2) D x"
18.124 @@ -358,7 +358,7 @@
18.125 if F1_ = F2_ then () else error "integrate.sml: unequal find's";
18.126
18.127 val ((dsc as Const (\<^const_name>\<open>antiDerivativeName\<close>, _))
18.128 - $ Free ("ff", F3_type)) = TermC.str2term "antiDerivativeName ff";
18.129 + $ Free ("ff", F3_type)) = TermC.parse_test @{context} "antiDerivativeName ff";
18.130 if Input_Descript.is_a dsc then () else error "integrate.sml: no description";
18.131 if F1_type = F3_type then ()
18.132 else error "integrate.sml: unequal types in find's";
19.1 --- a/test/Tools/isac/Knowledge/logexp.sml Sun Oct 09 06:53:03 2022 +0200
19.2 +++ b/test/Tools/isac/Knowledge/logexp.sml Sun Oct 09 07:44:22 2022 +0200
19.3 @@ -29,9 +29,9 @@
19.4 ["equation", "test"]; *)
19.5 *)
19.6
19.7 -val t = TermC.str2term "(2 log x)";
19.8 -val t = TermC.str2term "(2 log x) = 3";
19.9 -val t = TermC.str2term "matches ((?a log x) = ?b) ((2 log x) = 3)";
19.10 +val t = TermC.parse_test @{context} "(2 log x)";
19.11 +val t = TermC.parse_test @{context} "(2 log x) = 3";
19.12 +val t = TermC.parse_test @{context} "matches ((?a log x) = ?b) ((2 log x) = 3)";
19.13 TermC.atomty t;
19.14
19.15
20.1 --- a/test/Tools/isac/Knowledge/partial_fractions.sml Sun Oct 09 06:53:03 2022 +0200
20.2 +++ b/test/Tools/isac/Knowledge/partial_fractions.sml Sun Oct 09 07:44:22 2022 +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 = TermC.str2term "(3 / ((- 1 + - 2 * z + 8 * z \<up> 2) *3/24)) = (3 / ((z - 1 / 2) * (z - - 1 / 4)))";
20.8 +val t = TermC.parse_test @{context} "(3 / ((- 1 + - 2 * z + 8 * z \<up> 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 \<up> 2) * 3 / 24) =\n?A / (z - 1 / 2) + ?B / (z - - 1 / 4)";
20.11
21.1 --- a/test/Tools/isac/Knowledge/poly-1.sml Sun Oct 09 06:53:03 2022 +0200
21.2 +++ b/test/Tools/isac/Knowledge/poly-1.sml Sun Oct 09 07:44:22 2022 +0200
21.3 @@ -30,16 +30,16 @@
21.4 "-------- fun is_polyexp -----------------------------------------------------------------------";
21.5 "-------- fun is_polyexp -----------------------------------------------------------------------";
21.6 "-------- fun is_polyexp -----------------------------------------------------------------------";
21.7 -val t = TermC.str2term "x / x";
21.8 +val t = TermC.parse_test @{context} "x / x";
21.9 if is_polyexp t then error "NOT is_polyexp (x / x)" else ();
21.10
21.11 -val t = TermC.str2term "- 1 * A * 3";
21.12 +val t = TermC.parse_test @{context} "- 1 * A * 3";
21.13 if is_polyexp t then () else error "is_polyexp (- 1 * A * 3)";
21.14
21.15 -val t = TermC.str2term "- 1 * AA * 3";
21.16 +val t = TermC.parse_test @{context} "- 1 * AA * 3";
21.17 if is_polyexp t then () else error "is_polyexp (- 1 * AA * 3)";
21.18
21.19 -val t = TermC.str2term "x * x + x * y + (- 1 * y * x + - 1 * y * y)::real";
21.20 +val t = TermC.parse_test @{context} "x * x + x * y + (- 1 * y * x + - 1 * y * y)::real";
21.21 if is_polyexp t then () else error "is_polyexp (x * x + x * y + (- 1 * y * x + - 1 * y * y))";
21.22
21.23 "-------- fun has_degree_in --------------------------------------------------------------------";
21.24 @@ -264,7 +264,7 @@
21.25 "-------- fun is_addUnordered (x \<up> 2 * y \<up> 2 + x \<up> 3 * y) --------------------------------------";
21.26 "-------- fun is_addUnordered (x \<up> 2 * y \<up> 2 + x \<up> 3 * y) --------------------------------------";
21.27 val ctxt = Proof_Context.init_global @{theory}
21.28 -val t = TermC.str2term "x \<up> 2 * y \<up> 2 + x * x \<up> 2 * y";
21.29 +val t = TermC.parse_test @{context} "x \<up> 2 * y \<up> 2 + x * x \<up> 2 * y";
21.30 val SOME (t, _) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term t;
21.31 UnparseC.term t = "x \<up> 2 * y \<up> 2 + x \<up> 3 * y";
21.32 if UnparseC.term t = "x \<up> 3 * y + x \<up> 2 * y \<up> 2" then ()
21.33 @@ -280,9 +280,9 @@
21.34 ####### calc. to: False (*isa*)
21.35 True (*isa2*)
21.36 ( **)
21.37 - if is_addUnordered (TermC.str2term "x \<up> 2 * y \<up> 2 + x \<up> 3 * y ::real") then ()
21.38 + if is_addUnordered (TermC.parse_test @{context} "x \<up> 2 * y \<up> 2 + x \<up> 3 * y ::real") then ()
21.39 else error"is_addUnordered x \<up> 2 * y \<up> 2 + x \<up> 3 * y"; (*isa == isa2*)
21.40 -"~~~~~ fun is_addUnordered , args:"; val (t) = (TermC.str2term "x \<up> 2 * y \<up> 2 + x \<up> 3 * y ::real");
21.41 +"~~~~~ fun is_addUnordered , args:"; val (t) = (TermC.parse_test @{context} "x \<up> 2 * y \<up> 2 + x \<up> 3 * y ::real");
21.42 ((is_polyexp t) andalso not (t = sort_monoms t)) = false; (*isa == isa2*)
21.43
21.44 (*+*) if is_polyexp t = true then () else error "is_polyexp x \<up> 2 * y \<up> 2 + x \<up> 3 * y";
21.45 @@ -412,32 +412,32 @@
21.46 "-------- check make_polynomial with simple terms ----------------------------------------------";
21.47 "-------- check make_polynomial with simple terms ----------------------------------------------";
21.48 "----- check 1 ---";
21.49 -val t = TermC.str2term "2*3*a";
21.50 +val t = TermC.parse_test @{context} "2*3*a";
21.51 val SOME (t, _) = rewrite_set_ ctxt false make_polynomial t;
21.52 if UnparseC.term t = "6 * a" then () else error "check make_polynomial 1";
21.53
21.54 "----- check 2 ---";
21.55 -val t = TermC.str2term "2*a + 3*a";
21.56 +val t = TermC.parse_test @{context} "2*a + 3*a";
21.57 val SOME (t, _) = rewrite_set_ ctxt false make_polynomial t;
21.58 if UnparseC.term t = "5 * a" then () else error "check make_polynomial 2";
21.59
21.60 "----- check 3 ---";
21.61 -val t = TermC.str2term "2*a + 3*a + 3*a";
21.62 +val t = TermC.parse_test @{context} "2*a + 3*a + 3*a";
21.63 val SOME (t, _) = rewrite_set_ ctxt false make_polynomial t;
21.64 if UnparseC.term t = "8 * a" then () else error "check make_polynomial 3";
21.65
21.66 "----- check 4 ---";
21.67 -val t = TermC.str2term "3*a - 2*a";
21.68 +val t = TermC.parse_test @{context} "3*a - 2*a";
21.69 val SOME (t, _) = rewrite_set_ ctxt false make_polynomial t;
21.70 if UnparseC.term t = "a" then () else error "check make_polynomial 4";
21.71
21.72 "----- check 5 ---";
21.73 -val t = TermC.str2term "4*(3*a - 2*a)";
21.74 +val t = TermC.parse_test @{context} "4*(3*a - 2*a)";
21.75 val SOME (t, _) = rewrite_set_ ctxt false make_polynomial t;
21.76 if UnparseC.term t = "4 * a" then () else error "check make_polynomial 5";
21.77
21.78 "----- check 6 ---";
21.79 -val t = TermC.str2term "4*(3*a \<up> 2 - 2*a \<up> 2)";
21.80 +val t = TermC.parse_test @{context} "4*(3*a \<up> 2 - 2*a \<up> 2)";
21.81 val SOME (t, _) = rewrite_set_ ctxt false make_polynomial t;
21.82 if UnparseC.term t = "4 * a \<up> 2" then () else error "check make_polynomial 6";
21.83
21.84 @@ -446,7 +446,7 @@
21.85 "-------- fun is_multUnordered (x \<up> 2 * x) -----------------------------------------------------";
21.86 val thy = @{theory "Isac_Knowledge"};
21.87 "===== works for a simple example, see rewrite.sml -- fun app_rev ===";
21.88 -val t = TermC.str2term "x \<up> 2 * x";
21.89 +val t = TermC.parse_test @{context} "x \<up> 2 * x";
21.90 val SOME (t', _) = rewrite_set_ ctxt true order_mult_ t;
21.91 if UnparseC.term t' = "x * x \<up> 2" then ()
21.92 else error "poly.sml Poly.is_multUnordered doesn't work";
21.93 @@ -458,7 +458,7 @@
21.94 ####### try calc: Poly.is_multUnordered'
21.95 ======= calc. to: False !!!!!!!!!!!!! INSTEAD OF TRUE in 2002 !!!!!!!!!!!!!
21.96 *)
21.97 -val t = TermC.str2term "5 * x \<up> 2 * (2 * x \<up> 7) + 5 * x \<up> 2 * 3 + (6 * x \<up> 7 + 9) + (- 1 * (3 * x \<up> 5 * (6 * x \<up> 4)) + - 1 * (3 * x \<up> 5 * - 1) + (-48 * x \<up> 4 + 8))";
21.98 +val t = TermC.parse_test @{context} "5 * x \<up> 2 * (2 * x \<up> 7) + 5 * x \<up> 2 * 3 + (6 * x \<up> 7 + 9) + (- 1 * (3 * x \<up> 5 * (6 * x \<up> 4)) + - 1 * (3 * x \<up> 5 * - 1) + (-48 * x \<up> 4 + 8))";
21.99
21.100 "----- is_multUnordered ---";
21.101 val tsort = sort_variables t;
21.102 @@ -469,7 +469,7 @@
21.103 if is_multUnordered t then () else error "poly.sml diff. is_multUnordered 1";
21.104
21.105 "----- eval_is_multUnordered ---";
21.106 -val tm = TermC.str2term "(5 * x \<up> 2 * (2 * x \<up> 7) + 5 * x \<up> 2 * 3 + (6 * x \<up> 7 + 9) + (- 1 * (3 * x \<up> 5 * (6 * x \<up> 4)) + - 1 * (3 * x \<up> 5 * - 1) + (-48 * x \<up> 4 + 8))) is_multUnordered";
21.107 +val tm = TermC.parse_test @{context} "(5 * x \<up> 2 * (2 * x \<up> 7) + 5 * x \<up> 2 * 3 + (6 * x \<up> 7 + 9) + (- 1 * (3 * x \<up> 5 * (6 * x \<up> 4)) + - 1 * (3 * x \<up> 5 * - 1) + (-48 * x \<up> 4 + 8))) is_multUnordered";
21.108 case eval_is_multUnordered "testid" "" tm @{context} of
21.109 SOME (_, Const (\<^const_name>\<open>Trueprop\<close>, _) $
21.110 (Const (\<^const_name>\<open>HOL.eq\<close>, _) $
21.111 @@ -486,7 +486,7 @@
21.112 "-------- fun is_multUnordered (3 * a + - 2 * a) -----------------------------------------------";
21.113 "-------- fun is_multUnordered (3 * a + - 2 * a) -----------------------------------------------";
21.114 val thy = @{theory "Isac_Knowledge"};
21.115 -val t as (_ $ arg) = TermC.str2term "(3 * a + - 2 * a) is_multUnordered";
21.116 +val t as (_ $ arg) = TermC.parse_test @{context} "(3 * a + - 2 * a) is_multUnordered";
21.117
21.118 (*+*)if UnparseC.term (sort_variables arg) = "3 * a + - 2 * a" andalso is_polyexp arg = true
21.119 (*+*) andalso not (is_multUnordered arg)
21.120 @@ -501,7 +501,7 @@
21.121 | _ => error "eval_is_multUnordered 3 * a + - 2 * a CHANGED";
21.122
21.123 "----- is_multUnordered --- (- 2 * a) is_multUnordered = False";
21.124 -val t as (_ $ arg) = TermC.str2term "(- 2 * a) is_multUnordered";
21.125 +val t as (_ $ arg) = TermC.parse_test @{context} "(- 2 * a) is_multUnordered";
21.126
21.127 (*+*)if UnparseC.term (sort_variables arg) = "- 2 * a" andalso is_polyexp arg = true
21.128 (*+*) andalso not (is_multUnordered arg)
21.129 @@ -515,7 +515,7 @@
21.130 | _ => error "eval_is_multUnordered 3 * a + - 2 * a CHANGED";
21.131
21.132 "----- is_multUnordered --- (a) is_multUnordered = False";
21.133 -val t as (_ $ arg) = TermC.str2term "(a) is_multUnordered";
21.134 +val t as (_ $ arg) = TermC.parse_test @{context} "(a) is_multUnordered";
21.135
21.136 (*+*)if UnparseC.term (sort_variables arg) = "a" andalso is_polyexp arg = true
21.137 (*+*) andalso not (is_multUnordered arg)
21.138 @@ -529,7 +529,7 @@
21.139 | _ => error "eval_is_multUnordered 3 * a + - 2 * a CHANGED";
21.140
21.141 "----- is_multUnordered --- (- 2) is_multUnordered = False";
21.142 -val t as (_ $ arg) = TermC.str2term "(- 2) is_multUnordered";
21.143 +val t as (_ $ arg) = TermC.parse_test @{context} "(- 2) is_multUnordered";
21.144
21.145 (*+*)if UnparseC.term (sort_variables arg) = "- 2" andalso is_polyexp arg = true
21.146 (*+*) andalso not (is_multUnordered arg)
21.147 @@ -567,7 +567,7 @@
21.148 O:x \<up> 3 + - 1 * (3 * (a * x \<up> 2)) + - 1 \<up> 2 * (3 * (a \<up> 2 * x)) + - 1 \<up> 3 * a \<up> 3
21.149 -------------------------------------------------------------------------------------------------<>
21.150 *)
21.151 -val t = TermC.str2term "x \<up> 3 + 3 * x \<up> 2 * (- 1 * a) + 3 * x * ((- 1) \<up> 2 * a \<up> 2) + (- 1) \<up> 3 * a \<up> 3";
21.152 +val t = TermC.parse_test @{context} "x \<up> 3 + 3 * x \<up> 2 * (- 1 * a) + 3 * x * ((- 1) \<up> 2 * a \<up> 2) + (- 1) \<up> 3 * a \<up> 3";
21.153 (*
21.154 "~~~~~ fun is_multUnordered
21.155 "~~~~~~~ fun sort_variables
21.156 @@ -636,7 +636,7 @@
21.157 "-------- fun is_multUnordered b * a * a ------------------------------------------------------";
21.158 "-------- fun is_multUnordered b * a * a ------------------------------------------------------";
21.159 "-------- fun is_multUnordered b * a * a ------------------------------------------------------";
21.160 -val t = TermC.str2term "b * a * a";
21.161 +val t = TermC.parse_test @{context} "b * a * a";
21.162 val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term t;
21.163 if UnparseC.term t = "a \<up> 2 * b" then ()
21.164 else error "poly.sml: diff.behav. in make_polynomial 21";
21.165 @@ -659,7 +659,7 @@
21.166 "-------- fun is_multUnordered 2*3*a -----------------------------------------------------------";
21.167 "-------- fun is_multUnordered 2*3*a -----------------------------------------------------------";
21.168 "-------- fun is_multUnordered 2*3*a -----------------------------------------------------------";
21.169 -val t = TermC.str2term "2*3*a";
21.170 +val t = TermC.parse_test @{context} "2*3*a";
21.171 val SOME (t', _) = rewrite_set_ ctxt false make_polynomial t;
21.172 (*+*)if UnparseC.term t' = "6 * a" then () else error "rewrite_set_ 2*3*a CHANGED";
21.173 (*
21.174 @@ -673,7 +673,7 @@
21.175 ####### calc. to: True (*isa*)
21.176 False (*isa2*)
21.177 *)
21.178 -val t = TermC.str2term "(6 * a) is_multUnordered";
21.179 +val t = TermC.parse_test @{context} "(6 * a) is_multUnordered";
21.180 val SOME
21.181 (_, t') =
21.182 eval_is_multUnordered "xxx" () t @{context};
21.183 @@ -702,7 +702,7 @@
21.184 val ctxt = Proof_Context.init_global thy;
21.185
21.186 val SOME (f',_) = rewrite_set_ ctxt false norm_Poly
21.187 -(TermC.str2term "L = k - 2 * q + (k - 2 * q) + (k - 2 * q) + (k - 2 * q) + senkrecht + oben");
21.188 +(TermC.parse_test @{context} "L = k - 2 * q + (k - 2 * q) + (k - 2 * q) + (k - 2 * q) + senkrecht + oben");
21.189 if UnparseC.term f' = "L = 2 * 2 * k + 2 * - 4 * q + senkrecht + oben"
21.190 then ((*norm_Poly NOT COMPLETE -- TODO MG*))
21.191 else error "norm_Poly changed behavior";
21.192 @@ -720,7 +720,7 @@
21.193 ### rls: order_add_ on: L = k + k + k + k + - 2 * q + - 2 * q + - 2 * q + - 2 * q + senkrecht + oben
21.194 *)
21.195 "~~~~~ fun sort_monoms , args:"; val (t) =
21.196 - (TermC.str2term "L = k + k + k + k + - 2 * q + - 2 * q + - 2 * q + - 2 * q + senkrecht + oben");
21.197 + (TermC.parse_test @{context} "L = k + k + k + k + - 2 * q + - 2 * q + - 2 * q + - 2 * q + senkrecht + oben");
21.198 (*+*)val t' =
21.199 sort_monoms t;
21.200 (*+*)UnparseC.term t' = "L = k + k + k + k + - 2 * q + - 2 * q + - 2 * q + - 2 * q + senkrecht + oben"; (*isa*)
21.201 @@ -729,37 +729,37 @@
21.202 "-------- complex examples from textbook Schalk I ----------------------------------------------";
21.203 "-------- complex examples from textbook Schalk I ----------------------------------------------";
21.204 "-------- complex examples from textbook Schalk I ----------------------------------------------";
21.205 -val t = TermC.str2term "1 + 2 * x \<up> 4 + 2 * - 2 * x \<up> 4 + x \<up> 8";
21.206 +val t = TermC.parse_test @{context} "1 + 2 * x \<up> 4 + 2 * - 2 * x \<up> 4 + x \<up> 8";
21.207 val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term t;
21.208 if (UnparseC.term t) = "1 + - 2 * x \<up> 4 + x \<up> 8"
21.209 then () else error "poly.sml: diff.behav. in make_polynomial 9b";
21.210
21.211 "-----SPB Schalk I p.64 No.296a ---";
21.212 -val t = TermC.str2term "(x - a) \<up> 3";
21.213 +val t = TermC.parse_test @{context} "(x - a) \<up> 3";
21.214 val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term t;
21.215 if (UnparseC.term t) = "- 1 * a \<up> 3 + 3 * a \<up> 2 * x + - 3 * a * x \<up> 2 + x \<up> 3"
21.216 then () else error "poly.sml: diff.behav. in make_polynomial 10";
21.217
21.218 "-----SPB Schalk I p.64 No.296c ---";
21.219 -val t = TermC.str2term "(-3*x - 4*y) \<up> 3";
21.220 +val t = TermC.parse_test @{context} "(-3*x - 4*y) \<up> 3";
21.221 val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term t;
21.222 if (UnparseC.term t) = "- 27 * x \<up> 3 + - 108 * x \<up> 2 * y + - 144 * x * y \<up> 2 +\n- 64 * y \<up> 3"
21.223 then () else error "poly.sml: diff.behav. in make_polynomial 11";
21.224
21.225 "-----SPB Schalk I p.62 No.242c ---";
21.226 -val t = TermC.str2term "x \<up> (- 4)*(x \<up> (- 4)*y \<up> (- 2)) \<up> (- 1)*y \<up> (- 2)";
21.227 +val t = TermC.parse_test @{context} "x \<up> (- 4)*(x \<up> (- 4)*y \<up> (- 2)) \<up> (- 1)*y \<up> (- 2)";
21.228 val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term t;
21.229 if (UnparseC.term t) = "1"
21.230 then () else error "poly.sml: diff.behav. in make_polynomial 12";
21.231
21.232 "-----SPB Schalk I p.60 No.209a ---";
21.233 -val t = TermC.str2term "a \<up> (7-x) * a \<up> x";
21.234 +val t = TermC.parse_test @{context} "a \<up> (7-x) * a \<up> x";
21.235 val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term t;
21.236 if UnparseC.term t = "a \<up> 7"
21.237 then () else error "poly.sml: diff.behav. in make_polynomial 13";
21.238
21.239 "-----SPB Schalk I p.60 No.209d ---";
21.240 -val t = TermC.str2term "d \<up> x * d \<up> (x+1) * d \<up> (2 - 2*x)";
21.241 +val t = TermC.parse_test @{context} "d \<up> x * d \<up> (x+1) * d \<up> (2 - 2*x)";
21.242 val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term t;
21.243 if UnparseC.term t = "d \<up> 3"
21.244 then () else error "poly.sml: diff.behav. in make_polynomial 14";
21.245 @@ -769,23 +769,23 @@
21.246 "-------- complex Eigene Beispiele (Mathias Goldgruber) ----------------------------------------";
21.247 "-------- complex Eigene Beispiele (Mathias Goldgruber) ----------------------------------------";
21.248 "-----SPO ---";
21.249 -val t = TermC.str2term "a \<up> 2*a \<up> (- 2)";
21.250 +val t = TermC.parse_test @{context} "a \<up> 2*a \<up> (- 2)";
21.251 val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term t;
21.252 if UnparseC.term t = "1" then ()
21.253 else error "poly.sml: diff.behav. in make_polynomial 15";
21.254
21.255 "-----SPO ---";
21.256 -val t = TermC.str2term "a \<up> 2*b*b \<up> (- 1)";
21.257 +val t = TermC.parse_test @{context} "a \<up> 2*b*b \<up> (- 1)";
21.258 val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term t;
21.259 if UnparseC.term t = "a \<up> 2" then ()
21.260 else error "poly.sml: diff.behav. in make_polynomial 18";
21.261 "-----SPO ---";
21.262 -val t = TermC.str2term "a \<up> 2*a \<up> (- 2)";
21.263 +val t = TermC.parse_test @{context} "a \<up> 2*a \<up> (- 2)";
21.264 val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term t;
21.265 if (UnparseC.term t) = "1" then ()
21.266 else error "poly.sml: diff.behav. in make_polynomial 19";
21.267 "-----SPO ---";
21.268 -val t = TermC.str2term "b + a - b";
21.269 +val t = TermC.parse_test @{context} "b + a - b";
21.270 val SOME (t,_) = rewrite_set_ ctxt false make_polynomial t; UnparseC.term t;
21.271 if (UnparseC.term t) = "a" then ()
21.272 else error "poly.sml: diff.behav. in make_polynomial 20";
22.1 --- a/test/Tools/isac/Knowledge/poly-2.sml Sun Oct 09 06:53:03 2022 +0200
22.2 +++ b/test/Tools/isac/Knowledge/poly-2.sml Sun Oct 09 07:44:22 2022 +0200
22.3 @@ -255,7 +255,7 @@
22.4 "~~~~~~~~~~~~~ fun get_basStr used twice --^^
22.5 "~~~~~~~~~~~~~ fun get_potStr used twice --^^
22.6 *)
22.7 -val t = TermC.str2term "(1 + 2 * x \<up> 4 + - 4 * x \<up> 4 + x \<up> 8) is_addUnordered";
22.8 +val t = TermC.parse_test @{context} "(1 + 2 * x \<up> 4 + - 4 * x \<up> 4 + x \<up> 8) is_addUnordered";
22.9
22.10 eval_is_addUnordered "xxx" "yyy" t @{context};
22.11 "~~~~~ fun eval_is_addUnordered , args:"; val ((thmid:string), _,
22.12 @@ -420,20 +420,20 @@
22.13 "-------- examples from textbook Schalk I ------------------------------------------------------";
22.14 "-------- examples from textbook Schalk I ------------------------------------------------------";
22.15 "-----SPB Schalk I p.63 No.267b ---";
22.16 -val t = TermC.str2term "(5*x \<up> 2 + 3) * (2*x \<up> 7 + 3) - (3*x \<up> 5 + 8) * (6*x \<up> 4 - 1)";
22.17 +val t = TermC.parse_test @{context} "(5*x \<up> 2 + 3) * (2*x \<up> 7 + 3) - (3*x \<up> 5 + 8) * (6*x \<up> 4 - 1)";
22.18 val SOME (t, _) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
22.19 if UnparseC.term t = "17 + 15 * x \<up> 2 + - 48 * x \<up> 4 + 3 * x \<up> 5 + 6 * x \<up> 7 +\n- 8 * x \<up> 9"
22.20 then () else error "poly.sml: diff.behav. in make_polynomial 1";
22.21
22.22 "-----SPB Schalk I p.63 No.275b ---";
22.23 -val t = TermC.str2term "(3*x \<up> 2 - 2*x*y + y \<up> 2) * (x \<up> 2 - 2*y \<up> 2)";
22.24 +val t = TermC.parse_test @{context} "(3*x \<up> 2 - 2*x*y + y \<up> 2) * (x \<up> 2 - 2*y \<up> 2)";
22.25 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
22.26 if UnparseC.term t =
22.27 "3 * x \<up> 4 + - 2 * x \<up> 3 * y + - 5 * x \<up> 2 * y \<up> 2 +\n4 * x * y \<up> 3 +\n- 2 * y \<up> 4"
22.28 then () else error "poly.sml: diff.behav. in make_polynomial 2";
22.29
22.30 "-----SPB Schalk I p.63 No.279b ---";
22.31 -val t = TermC.str2term "(x-a)*(x-b)*(x-c)*(x-d)";
22.32 +val t = TermC.parse_test @{context} "(x-a)*(x-b)*(x-c)*(x-d)";
22.33 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
22.34 if UnparseC.term t =
22.35 ("a * b * c * d + - 1 * a * b * c * x + - 1 * a * b * d * x +\na * b * x \<up> 2 +\n" ^
22.36 @@ -444,32 +444,32 @@
22.37 (*associate poly*)
22.38
22.39 "-----SPB Schalk I p.63 No.291 ---";
22.40 -val t = TermC.str2term "(5+96*x \<up> 3+8*x*(-4+(7- 3*x)*4*x))*(5*(2- 3*x)- (- 15*x*(-8*x- 5)))";
22.41 +val t = TermC.parse_test @{context} "(5+96*x \<up> 3+8*x*(-4+(7- 3*x)*4*x))*(5*(2- 3*x)- (- 15*x*(-8*x- 5)))";
22.42 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
22.43 if UnparseC.term t = "50 + - 770 * x + 4520 * x \<up> 2 + - 16320 * x \<up> 3 +\n- 26880 * x \<up> 4"
22.44 then () else error "poly.sml: diff.behav. in make_polynomial 4";
22.45
22.46 "-----SPB Schalk I p.64 No.295c ---";
22.47 -val t = TermC.str2term "(13*a \<up> 4*b \<up> 9*c - 12*a \<up> 3*b \<up> 6*c \<up> 9) \<up> 2";
22.48 +val t = TermC.parse_test @{context} "(13*a \<up> 4*b \<up> 9*c - 12*a \<up> 3*b \<up> 6*c \<up> 9) \<up> 2";
22.49 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
22.50 if UnparseC.term t =
22.51 "169 * a \<up> 8 * b \<up> 18 * c \<up> 2 +\n- 312 * a \<up> 7 * b \<up> 15 * c \<up> 10 +\n144 * a \<up> 6 * b \<up> 12 * c \<up> 18"
22.52 then ()else error "poly.sml: diff.behav. in make_polynomial 5";
22.53
22.54 "-----SPB Schalk I p.64 No.299a ---";
22.55 -val t = TermC.str2term "(x - y)*(x + y)";
22.56 +val t = TermC.parse_test @{context} "(x - y)*(x + y)";
22.57 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
22.58 if UnparseC.term t = "x \<up> 2 + - 1 * y \<up> 2"
22.59 then () else error "poly.sml: diff.behav. in make_polynomial 6";
22.60
22.61 "-----SPB Schalk I p.64 No.300c ---";
22.62 -val t = TermC.str2term "(3*x \<up> 2*y - 1)*(3*x \<up> 2*y + 1)";
22.63 +val t = TermC.parse_test @{context} "(3*x \<up> 2*y - 1)*(3*x \<up> 2*y + 1)";
22.64 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
22.65 if UnparseC.term t = "- 1 + 9 * x \<up> 4 * y \<up> 2"
22.66 then () else error "poly.sml: diff.behav. in make_polynomial 7";
22.67
22.68 "-----SPB Schalk I p.64 No.302 ---";
22.69 -val t = TermC.str2term
22.70 +val t = TermC.parse_test @{context}
22.71 "(13*x \<up> 2 + 5)*(13*x \<up> 2 - 5) - (5*x \<up> 2 + 3)*(5*x \<up> 2 - 3) - (12*x \<up> 2 + 4)*(12*x \<up> 2 - 4)";
22.72 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
22.73 if UnparseC.term t = "0"
22.74 @@ -477,47 +477,47 @@
22.75 (* RL?MG?: Bei Berechnung sollte 3 mal real_plus_minus_binom1_p aus expand_poly verwendet werden *)
22.76
22.77 "-----SPB Schalk I p.64 No.306a ---";
22.78 -val t = TermC.str2term "((x \<up> 2 + 1)*(x \<up> 2 - 1)) \<up> 2";
22.79 +val t = TermC.parse_test @{context} "((x \<up> 2 + 1)*(x \<up> 2 - 1)) \<up> 2";
22.80 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
22.81 if UnparseC.term t = "1 + 2 * x \<up> 4 + 2 * - 2 * x \<up> 4 + x \<up> 8" then ()
22.82 else error "poly.sml: diff.behav. in 2 * x \<up> 4 + 2 * - 2 * x \<up> 4 = - 2 * x \<up> 4";
22.83
22.84 (*WN071729 when reducing "rls reduce_012_" for Schaerding,
22.85 the above resulted in the term below ... but reduces from then correctly*)
22.86 -val t = TermC.str2term "1 + 2 * x \<up> 4 + 2 * - 2 * x \<up> 4 + x \<up> 8";
22.87 +val t = TermC.parse_test @{context} "1 + 2 * x \<up> 4 + 2 * - 2 * x \<up> 4 + x \<up> 8";
22.88 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
22.89 if UnparseC.term t = "1 + - 2 * x \<up> 4 + x \<up> 8"
22.90 then () else error "poly.sml: diff.behav. in make_polynomial 9b";
22.91
22.92 "-----SPB Schalk I p.64 No.296a ---";
22.93 -val t = TermC.str2term "(x - a) \<up> 3";
22.94 +val t = TermC.parse_test @{context} "(x - a) \<up> 3";
22.95 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
22.96
22.97 -val NONE = eval_is_even "aaa" "bbb" (TermC.str2term "3::real") "ccc";
22.98 +val NONE = eval_is_even "aaa" "bbb" (TermC.parse_test @{context} "3::real") "ccc";
22.99
22.100 if UnparseC.term t = "- 1 * a \<up> 3 + 3 * a \<up> 2 * x + - 3 * a * x \<up> 2 + x \<up> 3"
22.101 then () else error "poly.sml: diff.behav. in make_polynomial 10";
22.102
22.103 "-----SPB Schalk I p.64 No.296c ---";
22.104 -val t = TermC.str2term "(-3*x - 4*y) \<up> 3";
22.105 +val t = TermC.parse_test @{context} "(-3*x - 4*y) \<up> 3";
22.106 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
22.107 if UnparseC.term t = "- 27 * x \<up> 3 + - 108 * x \<up> 2 * y + - 144 * x * y \<up> 2 +\n- 64 * y \<up> 3"
22.108 then () else error "poly.sml: diff.behav. in make_polynomial 11";
22.109
22.110 "-----SPB Schalk I p.62 No.242c ---";
22.111 -val t = TermC.str2term "x \<up> (-4)*(x \<up> (-4)*y \<up> (- 2)) \<up> (- 1)*y \<up> (- 2)";
22.112 +val t = TermC.parse_test @{context} "x \<up> (-4)*(x \<up> (-4)*y \<up> (- 2)) \<up> (- 1)*y \<up> (- 2)";
22.113 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
22.114 if UnparseC.term t = "1"
22.115 then () else error "poly.sml: diff.behav. in make_polynomial 12";
22.116
22.117 "-----SPB Schalk I p.60 No.209a ---";
22.118 -val t = TermC.str2term "a \<up> (7-x) * a \<up> x";
22.119 +val t = TermC.parse_test @{context} "a \<up> (7-x) * a \<up> x";
22.120 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
22.121 if UnparseC.term t = "a \<up> 7"
22.122 then () else error "poly.sml: diff.behav. in make_polynomial 13";
22.123
22.124 "-----SPB Schalk I p.60 No.209d ---";
22.125 -val t = TermC.str2term "d \<up> x * d \<up> (x+1) * d \<up> (2 - 2*x)";
22.126 +val t = TermC.parse_test @{context} "d \<up> x * d \<up> (x+1) * d \<up> (2 - 2*x)";
22.127 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
22.128 if UnparseC.term t = "d \<up> 3"
22.129 then () else error "poly.sml: diff.behav. in make_polynomial 14";
22.130 @@ -526,7 +526,7 @@
22.131 "-------- ?RL?Bsple bei denen es Probleme gibt--------------------------------------------------";
22.132 "-------- ?RL?Bsple bei denen es Probleme gibt--------------------------------------------------";
22.133 "-----Schalk I p.64 No.303 ---";
22.134 -val t = TermC.str2term "(a + 2*b)*(a \<up> 2 + 4*b \<up> 2)*(a - 2*b) - (a - 6*b)*(a \<up> 2 + 36*b \<up> 2)*(a + 6*b)";
22.135 +val t = TermC.parse_test @{context} "(a + 2*b)*(a \<up> 2 + 4*b \<up> 2)*(a - 2*b) - (a - 6*b)*(a \<up> 2 + 36*b \<up> 2)*(a + 6*b)";
22.136 (*SOMETIMES LOOPS---------------------------------------------------------------------------\\*)
22.137 val SOME (t, _) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
22.138 if UnparseC.term t = "1280 * b \<up> 4"
22.139 @@ -538,49 +538,49 @@
22.140 "-------- Eigene Beispiele (Mathias Goldgruber) ------------------------------------------------";
22.141 "-------- Eigene Beispiele (Mathias Goldgruber) ------------------------------------------------";
22.142 "-----SPO ---";
22.143 -val t = TermC.str2term "a + a + a";
22.144 +val t = TermC.parse_test @{context} "a + a + a";
22.145 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
22.146 if UnparseC.term t = "3 * a" then ()
22.147 else error "poly.sml: diff.behav. in make_polynomial 16";
22.148 "-----SPO ---";
22.149 -val t = TermC.str2term "a + b + b + b";
22.150 +val t = TermC.parse_test @{context} "a + b + b + b";
22.151 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
22.152 if UnparseC.term t = "a + 3 * b" then ()
22.153 else error "poly.sml: diff.behav. in make_polynomial 17";
22.154 "-----SPO ---";
22.155 -val t = TermC.str2term "b * a * a";
22.156 +val t = TermC.parse_test @{context} "b * a * a";
22.157 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
22.158 if UnparseC.term t = "a \<up> 2 * b" then ()
22.159 else error "poly.sml: diff.behav. in make_polynomial 21";
22.160 "-----SPO ---";
22.161 -val t = TermC.str2term "(a \<up> 2) \<up> 3";
22.162 +val t = TermC.parse_test @{context} "(a \<up> 2) \<up> 3";
22.163 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
22.164 if UnparseC.term t = "a \<up> 6" then ()
22.165 else error "poly.sml: diff.behav. in make_polynomial 22";
22.166 "-----SPO ---";
22.167 -val t = TermC.str2term "x \<up> 2 * y \<up> 2 + x * x \<up> 2 * y";
22.168 +val t = TermC.parse_test @{context} "x \<up> 2 * y \<up> 2 + x * x \<up> 2 * y";
22.169 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
22.170 if UnparseC.term t = "x \<up> 3 * y + x \<up> 2 * y \<up> 2" then ()
22.171 else error "poly.sml: diff.behav. in make_polynomial 23";
22.172 "-----SPO ---";
22.173 -val t = TermC.str2term "a * b * b \<up> (- 1) + a";
22.174 +val t = TermC.parse_test @{context} "a * b * b \<up> (- 1) + a";
22.175 val SOME (t,_) = rewrite_set_ @{context} false make_polynomial t; UnparseC.term t;
22.176 if UnparseC.term t = "2 * a" then ()
22.177 else error "poly.sml: diff.behav. in make_polynomial 25";
22.178 "-----SPO ---";
22.179 -val t = TermC.str2term "a*c*b \<up> (2*n) + 3*a + 5*b \<up> (2*n)*c*b";
22.180 +val t = TermC.parse_test @{context} "a*c*b \<up> (2*n) + 3*a + 5*b \<up> (2*n)*c*b";
22.181 val SOME (t,_) = rewrite_set_ @{context} false make_polynomial t; UnparseC.term t;
22.182 if UnparseC.term t = "3 * a + 5 * b \<up> (1 + 2 * n) * c + a * b \<up> (2 * n) * c"
22.183 then () else error "poly.sml: diff.behav. in make_polynomial 26";
22.184
22.185 (*MG030627 -------------vvv-: Verschachtelte Terme -----------*)
22.186 "-----SPO ---";
22.187 -val t = TermC.str2term "(1 + (x*y*a) + x) \<up> (1 + (x*y*a) + x)";
22.188 +val t = TermC.parse_test @{context} "(1 + (x*y*a) + x) \<up> (1 + (x*y*a) + x)";
22.189 val SOME (t,_) = rewrite_set_ @{context} false make_polynomial t;
22.190 if UnparseC.term t = "(1 + x + a * x * y) \<up> (1 + x + a * x * y)"
22.191 then () else error "poly.sml: diff.behav. in make_polynomial 27";(*SPO*)
22.192
22.193 -val t = TermC.str2term "(1 + x*(y*z)*zz) \<up> (1 + x*(y*z)*zz)";
22.194 +val t = TermC.parse_test @{context} "(1 + x*(y*z)*zz) \<up> (1 + x*(y*z)*zz)";
22.195 val SOME (t,_) = rewrite_set_ @{context} false make_polynomial t;
22.196 if UnparseC.term t = "(1 + x * y * z * zz) \<up> (1 + x * y * z * zz)"
22.197 then () else error "poly.sml: diff.behav. in make_polynomial 28";
22.198 @@ -611,7 +611,7 @@
22.199 (*default_print_depth 7;*)
22.200 val prls = (#prls o Problem.from_store @{context}) ["polynomial", "simplification"];
22.201 (*default_print_depth 3;*)
22.202 -val t = TermC.str2term "((5*x \<up> 2 + 3) * (2*x \<up> 7 + 3) - (3*x \<up> 5 + 8) * (6*x \<up> 4 - 1)) is_polyexp";
22.203 +val t = TermC.parse_test @{context} "((5*x \<up> 2 + 3) * (2*x \<up> 7 + 3) - (3*x \<up> 5 + 8) * (6*x \<up> 4 - 1)) is_polyexp";
22.204 val SOME (t',_) = rewrite_set_ thy false prls t;
22.205 if t' = @{term True} then ()
22.206 else error "poly.sml: diff.behav. in check pbl 'polynomial..";
22.207 @@ -690,14 +690,14 @@
22.208 "-------- ord_make_polynomial ------------------------------------------------------------------";
22.209 "-------- ord_make_polynomial ------------------------------------------------------------------";
22.210 "-------- ord_make_polynomial ------------------------------------------------------------------";
22.211 -val t1 = TermC.str2term "2 * b + (3 * a + 3 * b)";
22.212 -val t2 = TermC.str2term "(3 * a + 3 * b) + 2 * b";
22.213 +val t1 = TermC.parse_test @{context} "2 * b + (3 * a + 3 * b)";
22.214 +val t2 = TermC.parse_test @{context} "(3 * a + 3 * b) + 2 * b";
22.215
22.216 if ord_make_polynomial true @{theory} [] (t1, t2) then ()
22.217 else error "poly.sml: diff.behav. in ord_make_polynomial";
22.218 (*SO: WHY IS THERE NO REWRITING ...*)
22.219
22.220 -val term = TermC.str2term "2*b + (3*a + 3*b)";
22.221 +val term = TermC.parse_test @{context} "2*b + (3*a + 3*b)";
22.222 (*+++*)val NONE = rewrite_set_ (Proof_Context.init_global @{theory "Isac_Knowledge"}) false order_add_mult term;
22.223 (*
22.224 WHY IS THERE NO REWRITING ?!?
23.1 --- a/test/Tools/isac/Knowledge/polyeq-1.sml Sun Oct 09 06:53:03 2022 +0200
23.2 +++ b/test/Tools/isac/Knowledge/polyeq-1.sml Sun Oct 09 07:44:22 2022 +0200
23.3 @@ -323,16 +323,16 @@
23.4
23.5 (** )end;( *local*)
23.6
23.7 -val subs = [(TermC.str2term "bdv::real", TermC.str2term "x::real")];
23.8 +val subs = [(TermC.parse_test @{context} "bdv::real", TermC.parse_test @{context} "x::real")];
23.9 if ord_make_polynomial_in false(*true*) @{theory} subs (t1, t2) then () else error "still GREATER?";
23.10
23.11 -val x = TermC.str2term "x ::real";
23.12 +val x = TermC.parse_test @{context} "x ::real";
23.13
23.14 -val t1 = TermC.numerals_to_Free (TermC.str2term "L * q_0 * x \<up> 2 / 4 ::real");
23.15 +val t1 = TermC.numerals_to_Free (TermC.parse_test @{context} "L * q_0 * x \<up> 2 / 4 ::real");
23.16 if 2006 = size_of_term' 1 false(*true*) x t1
23.17 then () else error "size_of_term' (L * q_0 * x \<up> 2) CHANGED)";
23.18
23.19 -val t2 = TermC.numerals_to_Free (TermC.str2term "- 1 * (q_0 * x \<up> 3) :: real");
23.20 +val t2 = TermC.numerals_to_Free (TermC.parse_test @{context} "- 1 * (q_0 * x \<up> 3) :: real");
23.21 if 3004 = size_of_term' 1 false(*true*) x t2
23.22 then () else error "size_of_term' (- 1 * (q_0 * x \<up> 3)) CHANGED";
23.23
24.1 --- a/test/Tools/isac/Knowledge/polyeq-2.sml Sun Oct 09 06:53:03 2022 +0200
24.2 +++ b/test/Tools/isac/Knowledge/polyeq-2.sml Sun Oct 09 07:44:22 2022 +0200
24.3 @@ -218,22 +218,22 @@
24.4 val ctxt = @{context};
24.5 (*Punkte aus dem TestBericht, die ich in rlang.sml nicht zuordnen konnte:*)
24.6 (*WN.19.3.03 ---v-*)
24.7 -(*3(b)*)val (bdv,v) = (TermC.str2term "''bdv''", TermC.str2term "R1");
24.8 -val t = TermC.str2term "- 1 * (R * R2) + R2 * R1 + - 1 * (R * R1) = 0";
24.9 +(*3(b)*)val (bdv,v) = (TermC.parse_test @{context} "''bdv''", TermC.parse_test @{context} "R1");
24.10 +val t = TermC.parse_test @{context} "- 1 * (R * R2) + R2 * R1 + - 1 * (R * R1) = 0";
24.11 val SOME (t',_) = rewrite_set_inst_ ctxt false [(bdv,v)] make_polynomial_in t;
24.12 if UnparseC.term t' = "- 1 * R * R2 + R2 * R1 + - 1 * R * R1 = 0" then ()
24.13 else error "make_polynomial_in (- 1 * (R * R2) + R2 * R1 + - 1 * (R * R1) = 0)";
24.14 "- 1 * R * R2 + (R2 + - 1 * R) * R1 = 0";
24.15 (*WN.19.3.03 ---^-*)
24.16
24.17 -(*3(c)*)val (bdv,v) = (TermC.str2term "bdv", TermC.str2term "p");
24.18 -val t = TermC.str2term "y \<up> 2 + - 2 * (x * p) = 0";
24.19 +(*3(c)*)val (bdv,v) = (TermC.parse_test @{context} "bdv", TermC.parse_test @{context} "p");
24.20 +val t = TermC.parse_test @{context} "y \<up> 2 + - 2 * (x * p) = 0";
24.21 val SOME (t',_) = rewrite_set_inst_ ctxt false [(bdv,v)] make_polynomial_in t;
24.22 if UnparseC.term t' = "y \<up> 2 + - 2 * x * p = 0" then ()
24.23 else error "make_polynomial_in (y \<up> 2 + - 2 * (x * p) = 0)";
24.24
24.25 -(*3(d)*)val (bdv,v) = (TermC.str2term "''bdv''", TermC.str2term "x2");
24.26 -val t = TermC.str2term
24.27 +(*3(d)*)val (bdv,v) = (TermC.parse_test @{context} "''bdv''", TermC.parse_test @{context} "x2");
24.28 +val t = TermC.parse_test @{context}
24.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";
24.30 val SOME (t',_) = rewrite_set_inst_ ctxt false [(bdv,v)] make_polynomial_in t;
24.31 if UnparseC.term t' =
24.32 @@ -249,13 +249,13 @@
24.33 else error "make_ratpoly_in (A + x1 * (y3 * (1 / 2)) + x3 * (y2 * (1 / 2)) + - 1...";
24.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";
24.35
24.36 -(*3(e)*)val (bdv,v) = (TermC.str2term "bdv", TermC.str2term "a");
24.37 -val t = TermC.str2term
24.38 +(*3(e)*)val (bdv,v) = (TermC.parse_test @{context} "bdv", TermC.parse_test @{context} "a");
24.39 +val t = TermC.parse_test @{context}
24.40 "A \<up> 2 + c \<up> 2 * (c / d) \<up> 2 + (-4 * (c / d) \<up> 2) * a \<up> 2 = 0";
24.41 val NONE = rewrite_set_inst_ ctxt false [(bdv,v)] make_polynomial_in t;
24.42 (* the invisible parentheses are as expected *)
24.43
24.44 -val t = TermC.str2term "(x + 1) * (x + 2) - (3 * x - 2) \<up> 2 - ((2 * x - 1) \<up> 2 + (3 * x - 1) * (x + 1)) = 0";
24.45 +val t = TermC.parse_test @{context} "(x + 1) * (x + 2) - (3 * x - 2) \<up> 2 - ((2 * x - 1) \<up> 2 + (3 * x - 1) * (x + 1)) = 0";
24.46 rewrite_set_ ctxt false expand_binoms t;
24.47
24.48
24.49 @@ -278,8 +278,8 @@
24.50 "----------- rls d2_polyeq_bdv_only_simplify ---------------------";
24.51 "----------- rls d2_polyeq_bdv_only_simplify ---------------------";
24.52 "----------- rls d2_polyeq_bdv_only_simplify ---------------------";
24.53 -val t = TermC.str2term "-6 * x + 5 * x \<up> 2 = (0::real)";
24.54 -val subst = [(TermC.str2term "(bdv::real)", TermC.str2term "(x::real)")];
24.55 +val t = TermC.parse_test @{context} "-6 * x + 5 * x \<up> 2 = (0::real)";
24.56 +val subst = [(TermC.parse_test @{context} "(bdv::real)", TermC.parse_test @{context} "(x::real)")];
24.57 val SOME (t''''', _) = rewrite_set_inst_ ctxt true subst d2_polyeq_bdv_only_simplify t;
24.58 (* steps in rls d2_polyeq_bdv_only_simplify:*)
24.59
25.1 --- a/test/Tools/isac/Knowledge/polyminus.sml Sun Oct 09 06:53:03 2022 +0200
25.2 +++ b/test/Tools/isac/Knowledge/polyminus.sml Sun Oct 09 07:44:22 2022 +0200
25.3 @@ -36,21 +36,21 @@
25.4 "----------- fun identifier --------------------------------------------------------------------";
25.5 "----------- fun identifier --------------------------------------------------------------------";
25.6 "----------- fun identifier --------------------------------------------------------------------";
25.7 -if identifier (TermC.str2term "12 ::real") = "12" then () else error "identifier 1";
25.8 -if identifier (TermC.str2term
25.9 +if identifier (TermC.parse_test @{context} "12 ::real") = "12" then () else error "identifier 1";
25.10 +if identifier (TermC.parse_test @{context}
25.11 "5 * e + 6 * f - 8 * g - 9 - 7 * e - 4 * f + 10 * g ::real") = "|||||||||||||"
25.12 then () else error "identifier 1a";
25.13
25.14 -if identifier (TermC.str2term "a ::real") = "a" then () else error "identifier 2";
25.15 -if identifier (TermC.str2term "3 * a ::real") = "a" then () else error "identifier 3";
25.16 +if identifier (TermC.parse_test @{context} "a ::real") = "a" then () else error "identifier 2";
25.17 +if identifier (TermC.parse_test @{context} "3 * a ::real") = "a" then () else error "identifier 3";
25.18
25.19 -if identifier (TermC.str2term "a \<up> 2 ::real") = "a" then () else error "identifier 4";
25.20 -if identifier (TermC.str2term "3*a \<up> 2 ::real") = "a" then () else error "identifier 5";
25.21 -if identifier (TermC.str2term "a * b ::real") = "b" then () else error "identifier 5b";
25.22 +if identifier (TermC.parse_test @{context} "a \<up> 2 ::real") = "a" then () else error "identifier 4";
25.23 +if identifier (TermC.parse_test @{context} "3*a \<up> 2 ::real") = "a" then () else error "identifier 5";
25.24 +if identifier (TermC.parse_test @{context} "a * b ::real") = "b" then () else error "identifier 5b";
25.25
25.26 (*these are strange (see "specific monomials" in comment to fun.def.)..*)
25.27 -if identifier (TermC.str2term "a*b ::real") = "b" then () else error "identifier 6";
25.28 -if identifier (TermC.str2term "(3*a*b) ::real") = "b" then () else error "identifier 7";
25.29 +if identifier (TermC.parse_test @{context} "a*b ::real") = "b" then () else error "identifier 6";
25.30 +if identifier (TermC.parse_test @{context} "(3*a*b) ::real") = "b" then () else error "identifier 7";
25.31
25.32
25.33 "----------- fun eval_kleiner, fun kleiner -----------------------------------------------------";
25.34 @@ -62,33 +62,33 @@
25.35 "12" < "3"; (*true !!!*)
25.36
25.37 " a kleiner b ==> (b + a) = (a + b)";
25.38 -TermC.str2term "aaa";
25.39 -TermC.str2term "222 * aaa";
25.40 +TermC.parse_test @{context} "aaa";
25.41 +TermC.parse_test @{context} "222 * aaa";
25.42
25.43 -case eval_kleiner 0 0 (TermC.str2term "123 kleiner 32") 0 of
25.44 +case eval_kleiner 0 0 (TermC.parse_test @{context} "123 kleiner 32") 0 of
25.45 SOME ("123 kleiner 32 = False", _) => ()
25.46 | _ => error "polyminus.sml: 12 kleiner 9 = False";
25.47 -case eval_kleiner 0 0 (TermC.str2term "a kleiner b") 0 of
25.48 +case eval_kleiner 0 0 (TermC.parse_test @{context} "a kleiner b") 0 of
25.49 SOME ("a kleiner b = True", _) => ()
25.50 | _ => error "polyminus.sml: a kleiner b = True";
25.51 -case eval_kleiner 0 0 (TermC.str2term "(10*g) kleiner f") 0 of
25.52 +case eval_kleiner 0 0 (TermC.parse_test @{context} "(10*g) kleiner f") 0 of
25.53 SOME ("10 * g kleiner f = False", _) => ()
25.54 | _ => error "polyminus.sml: 10 * g kleiner f = False";
25.55 -case eval_kleiner 0 0 (TermC.str2term "(a \<up> 2) kleiner b") 0 of
25.56 +case eval_kleiner 0 0 (TermC.parse_test @{context} "(a \<up> 2) kleiner b") 0 of
25.57 SOME ("a \<up> 2 kleiner b = True", _) => ()
25.58 | _ => error "polyminus.sml: a \<up> 2 kleiner b = True";
25.59 -case eval_kleiner 0 0 (TermC.str2term "(3*a \<up> 2) kleiner b") 0 of
25.60 +case eval_kleiner 0 0 (TermC.parse_test @{context} "(3*a \<up> 2) kleiner b") 0 of
25.61 SOME ("3 * a \<up> 2 kleiner b = True", _) => ()
25.62 | _ => error "polyminus.sml: 3 * a \<up> 2 kleiner b = True";
25.63 -case eval_kleiner 0 0 (TermC.str2term "(a*b) kleiner c") 0 of
25.64 +case eval_kleiner 0 0 (TermC.parse_test @{context} "(a*b) kleiner c") 0 of
25.65 SOME ("a * b kleiner c = True", _) => ()
25.66 | _ => error "polyminus.sml: a * b kleiner b = True";
25.67 -case eval_kleiner 0 0 (TermC.str2term "(3*a*b) kleiner c") 0 of
25.68 +case eval_kleiner 0 0 (TermC.parse_test @{context} "(3*a*b) kleiner c") 0 of
25.69 SOME ("3 * a * b kleiner c = True", _) => ()
25.70 | _ => error "polyminus.sml: 3 * a * b kleiner b = True";
25.71
25.72
25.73 -val t = TermC.str2term "12 kleiner 5 * e + 6 * f - 8 * g - 9 - 7 * e - 4 * f + 10 * (g::real)";
25.74 +val t = TermC.parse_test @{context} "12 kleiner 5 * e + 6 * f - 8 * g - 9 - 7 * e - 4 * f + 10 * (g::real)";
25.75 val SOME ("12 kleiner 5 * e + 6 * f - 8 * g - 9 - 7 * e - 4 * f + 10 * g = True", _) =
25.76 eval_kleiner "aaa" "bbb" t "ccc";
25.77 "~~~~~ fun eval_kleiner , args:"; val (_, _, (p as (Const (\<^const_name>\<open>kleiner\<close>,_) $ a $ b)), _) =
25.78 @@ -106,61 +106,61 @@
25.79 "----------- fun ist_monom ---------------------------------------------------------------------";
25.80 "----------- fun ist_monom ---------------------------------------------------------------------";
25.81 "----------- fun ist_monom ---------------------------------------------------------------------";
25.82 -val t = TermC.str2term "0 ::real";
25.83 +val t = TermC.parse_test @{context} "0 ::real";
25.84 if ist_monom t then () else error "ist_monom 1";
25.85
25.86 -val t = TermC.str2term "a";
25.87 +val t = TermC.parse_test @{context} "a";
25.88 if ist_monom t then () else error "ist_monom 2";
25.89
25.90 -val t = TermC.str2term "2 * a";
25.91 +val t = TermC.parse_test @{context} "2 * a";
25.92 if ist_monom t then () else error "ist_monom 3";
25.93
25.94 -val t = TermC.str2term "2 * a * b";
25.95 +val t = TermC.parse_test @{context} "2 * a * b";
25.96 if ist_monom t then () else error "ist_monom 4";
25.97
25.98 -val t = TermC.str2term "a * b";
25.99 +val t = TermC.parse_test @{context} "a * b";
25.100 if ist_monom t then () else error "ist_monom 5";
25.101
25.102 (*not covered before NEW numerals*)
25.103 -val t = TermC.str2term "2 * a \<up> 2 * b";
25.104 +val t = TermC.parse_test @{context} "2 * a \<up> 2 * b";
25.105 if ist_monom t then () else error "ist_monom 6";
25.106
25.107 (*not covered before NEW numerals*)
25.108 -val t = TermC.str2term "a \<up> 2 * b \<up> 3";
25.109 +val t = TermC.parse_test @{context} "a \<up> 2 * b \<up> 3";
25.110 if ist_monom t then () else error "ist_monom 7";
25.111
25.112 -val t = TermC.str2term "a \<up> 2 * 4 * b \<up> 3 * 5";
25.113 +val t = TermC.parse_test @{context} "a \<up> 2 * 4 * b \<up> 3 * 5";
25.114 if ist_monom t then () else error "ist_monom 8";
25.115
25.116
25.117 "----------- fun eval_ist_monom ----------------------------------";
25.118 "----------- fun eval_ist_monom ----------------------------------";
25.119 "----------- fun eval_ist_monom ----------------------------------";
25.120 -case eval_ist_monom 0 0 (TermC.str2term "12 ist_monom") 0 of
25.121 +case eval_ist_monom 0 0 (TermC.parse_test @{context} "12 ist_monom") 0 of
25.122 SOME ("12 ist_monom = True", _) => ()
25.123 | _ => error "polyminus.sml: 12 ist_monom = True";
25.124
25.125 -case eval_ist_monom 0 0 (TermC.str2term "a ist_monom") 0 of
25.126 +case eval_ist_monom 0 0 (TermC.parse_test @{context} "a ist_monom") 0 of
25.127 SOME ("a ist_monom = True", _) => ()
25.128 | _ => error "polyminus.sml: a ist_monom = True";
25.129
25.130 -case eval_ist_monom 0 0 (TermC.str2term "(3*a) ist_monom") 0 of
25.131 +case eval_ist_monom 0 0 (TermC.parse_test @{context} "(3*a) ist_monom") 0 of
25.132 SOME ("3 * a ist_monom = True", _) => ()
25.133 | _ => error "polyminus.sml: 3 * a ist_monom = True";
25.134
25.135 -case eval_ist_monom 0 0 (TermC.str2term "(a \<up> 2) ist_monom") 0 of
25.136 +case eval_ist_monom 0 0 (TermC.parse_test @{context} "(a \<up> 2) ist_monom") 0 of
25.137 SOME ("a \<up> 2 ist_monom = True", _) => ()
25.138 | _ => error "polyminus.sml: a \<up> 2 ist_monom = True";
25.139
25.140 -case eval_ist_monom 0 0 (TermC.str2term "(3*a \<up> 2) ist_monom") 0 of
25.141 +case eval_ist_monom 0 0 (TermC.parse_test @{context} "(3*a \<up> 2) ist_monom") 0 of
25.142 SOME ("3 * a \<up> 2 ist_monom = True", _) => ()
25.143 | _ => error "polyminus.sml: 3*a \<up> 2 ist_monom = True";
25.144
25.145 -case eval_ist_monom 0 0 (TermC.str2term "(a*b) ist_monom") 0 of
25.146 +case eval_ist_monom 0 0 (TermC.parse_test @{context} "(a*b) ist_monom") 0 of
25.147 SOME ("a * b ist_monom = True", _) => ()
25.148 | _ => error "polyminus.sml: a*b ist_monom = True";
25.149
25.150 -case eval_ist_monom 0 0 (TermC.str2term "(3*a*b) ist_monom") 0 of
25.151 +case eval_ist_monom 0 0 (TermC.parse_test @{context} "(3*a*b) ist_monom") 0 of
25.152 SOME ("3 * a * b ist_monom = True", _) => ()
25.153 | _ => error "polyminus.sml: 3*a*b ist_monom = True";
25.154
25.155 @@ -170,14 +170,14 @@
25.156 "----------- watch order_add_mult -------------------------------";
25.157 "----- with these simple variables it works...";
25.158 val ctxt = @{context};
25.159 -val t = TermC.str2term "((a + d) + c) + b";
25.160 +val t = TermC.parse_test @{context} "((a + d) + c) + b";
25.161 val SOME (t,_) = rewrite_set_ ctxt false order_add_mult t; UnparseC.term t;
25.162 if UnparseC.term t = "a + (b + (c + d))" then ()
25.163 else error "polyminus.sml 1 watch order_add_mult";
25.164
25.165 "----- the same stepwise...";
25.166 val od = ord_make_polynomial true (@{theory "Poly"});
25.167 -val t = TermC.str2term "((a + d) + c) + b";
25.168 +val t = TermC.parse_test @{context} "((a + d) + c) + b";
25.169 "((a + d) + c) + b";
25.170 val SOME (t,_) = rewrite_ ctxt od Rule_Set.empty true @{thm add.commute} t; UnparseC.term t;
25.171 "b + ((a + d) + c)";
25.172 @@ -191,7 +191,7 @@
25.173 else error "polyminus.sml 2 watch order_add_mult";
25.174
25.175 "----- if parentheses are right, left_commute is (almost) sufficient...";
25.176 -val t = TermC.str2term "a + (d + (c + b))";
25.177 +val t = TermC.parse_test @{context} "a + (d + (c + b))";
25.178 "a + (d + (c + b))";
25.179 val SOME (t,_) = rewrite_ ctxt od Rule_Set.empty true @{thm add.left_commute} t;UnparseC.term t;
25.180 "a + (c + (d + b))";
25.181 @@ -202,14 +202,14 @@
25.182
25.183 "----- but we do not want the parentheses at right; thus: cond.rew.";
25.184 "WN0712707 complicated monomials do not yet work ...";
25.185 -val t = TermC.str2term "((5*a + 4*d) + 3*c) + 2*b";
25.186 +val t = TermC.parse_test @{context} "((5*a + 4*d) + 3*c) + 2*b";
25.187 val SOME (t,_) = rewrite_set_ ctxt false order_add_mult t; UnparseC.term t;
25.188 if UnparseC.term t = "2 * b + (3 * c + (4 * d + 5 * a))" then ()
25.189 else error "polyminus.sml: order_add_mult changed";
25.190
25.191 "----- here we see rew_sub going into subterm with ord.rew....";
25.192 val od = ord_make_polynomial false (@{theory "Poly"});
25.193 -val t = TermC.str2term "b + a + c + d";
25.194 +val t = TermC.parse_test @{context} "b + a + c + d";
25.195 val SOME (t,_) = rewrite_ ctxt od Rule_Set.empty false @{thm add.commute} t; UnparseC.term t;
25.196 val SOME (t,_) = rewrite_ ctxt od Rule_Set.empty false @{thm add.commute} t; UnparseC.term t;
25.197 (*@@@ rew_sub gosub: t = d + (b + a + c)
25.198 @@ -225,34 +225,34 @@
25.199 "12" < "3"; (*true !!!*)
25.200
25.201 " a kleiner b ==> (b + a) = (a + b)";
25.202 -TermC.str2term "aaa";
25.203 -TermC.str2term "222 * aaa";
25.204 +TermC.parse_test @{context} "aaa";
25.205 +TermC.parse_test @{context} "222 * aaa";
25.206
25.207 -case eval_kleiner 0 0 (TermC.str2term "123 kleiner 32") 0 of
25.208 +case eval_kleiner 0 0 (TermC.parse_test @{context} "123 kleiner 32") 0 of
25.209 SOME ("123 kleiner 32 = False", _) => ()
25.210 | _ => error "polyminus.sml: 12 kleiner 9 = False";
25.211
25.212 -case eval_kleiner 0 0 (TermC.str2term "a kleiner b") 0 of
25.213 +case eval_kleiner 0 0 (TermC.parse_test @{context} "a kleiner b") 0 of
25.214 SOME ("a kleiner b = True", _) => ()
25.215 | _ => error "polyminus.sml: a kleiner b = True";
25.216
25.217 -case eval_kleiner 0 0 (TermC.str2term "(10*g) kleiner f") 0 of
25.218 +case eval_kleiner 0 0 (TermC.parse_test @{context} "(10*g) kleiner f") 0 of
25.219 SOME ("10 * g kleiner f = False", _) => ()
25.220 | _ => error "polyminus.sml: 10 * g kleiner f = False";
25.221
25.222 -case eval_kleiner 0 0 (TermC.str2term "(a \<up> 2) kleiner b") 0 of
25.223 +case eval_kleiner 0 0 (TermC.parse_test @{context} "(a \<up> 2) kleiner b") 0 of
25.224 SOME ("a \<up> 2 kleiner b = True", _) => ()
25.225 | _ => error "polyminus.sml: a \<up> 2 kleiner b = True";
25.226
25.227 -case eval_kleiner 0 0 (TermC.str2term "(3*a \<up> 2) kleiner b") 0 of
25.228 +case eval_kleiner 0 0 (TermC.parse_test @{context} "(3*a \<up> 2) kleiner b") 0 of
25.229 SOME ("3 * a \<up> 2 kleiner b = True", _) => ()
25.230 | _ => error "polyminus.sml: 3 * a \<up> 2 kleiner b = True";
25.231
25.232 -case eval_kleiner 0 0 (TermC.str2term "(a*b) kleiner c") 0 of
25.233 +case eval_kleiner 0 0 (TermC.parse_test @{context} "(a*b) kleiner c") 0 of
25.234 SOME ("a * b kleiner c = True", _) => ()
25.235 | _ => error "polyminus.sml: a * b kleiner b = True";
25.236
25.237 -case eval_kleiner 0 0 (TermC.str2term "(3*a*b) kleiner c") 0 of
25.238 +case eval_kleiner 0 0 (TermC.parse_test @{context} "(3*a*b) kleiner c") 0 of
25.239 SOME ("3 * a * b kleiner c = True", _) => ()
25.240 | _ => error "polyminus.sml: 3 * a * b kleiner b = True";
25.241
25.242 @@ -260,52 +260,52 @@
25.243 val od = Rewrite_Ord.function_empty;
25.244
25.245 val erls = erls_ordne_alphabetisch;
25.246 -val t = TermC.str2term "b + a";
25.247 +val t = TermC.parse_test @{context} "b + a";
25.248 val SOME (t,_) = rewrite_ ctxt od erls false @{thm tausche_plus} t; UnparseC.term t;
25.249 if UnparseC.term t = "a + b" then ()
25.250 else error "polyminus.sml: ordne_alphabetisch1 b + a";
25.251
25.252 val erls = Atools_erls;
25.253 -val t = TermC.str2term "2*a + 3*a";
25.254 +val t = TermC.parse_test @{context} "2*a + 3*a";
25.255 val SOME (t,_) = rewrite_ ctxt od erls false @{thm real_num_collect} t; UnparseC.term t;
25.256
25.257 "======= test rewrite_, rewrite_set_";
25.258 (*Rewrite.trace_on := true; ..stopped Test_Isac.thy*)
25.259 val erls = erls_ordne_alphabetisch;
25.260 -val t = TermC.str2term "b + a";
25.261 +val t = TermC.parse_test @{context} "b + a";
25.262 val SOME (t,_) = rewrite_set_ ctxt false ordne_alphabetisch t; UnparseC.term t;
25.263 if UnparseC.term t = "a + b" then ()
25.264 else error "polyminus.sml: ordne_alphabetisch a + b";
25.265
25.266 -val t = TermC.str2term "2*b + a";
25.267 +val t = TermC.parse_test @{context} "2*b + a";
25.268 val SOME (t,_) = rewrite_set_ ctxt false ordne_alphabetisch t; UnparseC.term t;
25.269 if UnparseC.term t = "a + 2 * b" then ()
25.270 else error "polyminus.sml: ordne_alphabetisch a + 2 * b";
25.271
25.272 -val t = TermC.str2term "a + c + b";
25.273 +val t = TermC.parse_test @{context} "a + c + b";
25.274 val SOME (t,_) = rewrite_set_ ctxt false ordne_alphabetisch t; UnparseC.term t;
25.275 if UnparseC.term t = "a + b + c" then ()
25.276 else error "polyminus.sml: ordne_alphabetisch a + b + c";
25.277
25.278 "======= rewrite goes into subterms";
25.279 -val t = TermC.str2term "a + c + b + d ::real";
25.280 +val t = TermC.parse_test @{context} "a + c + b + d ::real";
25.281 val SOME (t,_) = rewrite_ ctxt od erls false @{thm tausche_plus_plus} t; UnparseC.term t;
25.282 if UnparseC.term t = "a + b + c + d" then ()
25.283 else error "polyminus.sml: ordne_alphabetisch1 a + b + c + d";
25.284
25.285 -val t = TermC.str2term "a + c + d + b";
25.286 +val t = TermC.parse_test @{context} "a + c + d + b";
25.287 val SOME (t,_) = rewrite_set_ ctxt false ordne_alphabetisch t; UnparseC.term t;
25.288 if UnparseC.term t = "a + b + c + d" then ()
25.289 else error "polyminus.sml: ordne_alphabetisch2 a + b + c + d";
25.290
25.291 "======= here we see rew_sub going into subterm with cond.rew....";
25.292 -val t = TermC.str2term "b + a + c + d";
25.293 +val t = TermC.parse_test @{context} "b + a + c + d";
25.294 val SOME (t,_) = rewrite_ ctxt od erls false @{thm tausche_plus} t; UnparseC.term t;
25.295 if UnparseC.term t = "a + b + c + d" then ()
25.296 else error "polyminus.sml: ordne_alphabetisch3 a + b + c + d";
25.297
25.298 "======= compile rls for the most complicated terms";
25.299 -val t = TermC.str2term "5*e + 6*f - 8*g - 9 - 7*e - 4*f + 10*g + 12";
25.300 +val t = TermC.parse_test @{context} "5*e + 6*f - 8*g - 9 - 7*e - 4*f + 10*g + 12";
25.301 "5 * e + 6 * f - 8 * g - 9 - 7 * e - 4 * f + 10 * g + 12";
25.302 val SOME (t,_) = rewrite_set_ ctxt false ordne_alphabetisch t;
25.303 if UnparseC.term t = "- 9 + 12 + 5 * e - 7 * e + 6 * f - 4 * f - 8 * g + 10 * g"
25.304 @@ -316,7 +316,7 @@
25.305 "----------- build fasse_zusammen --------------------------------";
25.306 "----------- build fasse_zusammen --------------------------------";
25.307 "----------- build fasse_zusammen --------------------------------";
25.308 -val t = TermC.str2term "- 9 + 12 + 5 * e - 7 * e + 6 * f - 4 * f - 8 * g + 10 * g";
25.309 +val t = TermC.parse_test @{context} "- 9 + 12 + 5 * e - 7 * e + 6 * f - 4 * f - 8 * g + 10 * g";
25.310 val SOME (t,_) = rewrite_set_ ctxt false fasse_zusammen t;
25.311 if UnparseC.term t = "3 + - 2 * e + 2 * f + 2 * g" then ()
25.312 else error "polyminus.sml: fasse_zusammen finished";
25.313 @@ -324,7 +324,7 @@
25.314 "----------- build verschoenere ----------------------------------";
25.315 "----------- build verschoenere ----------------------------------";
25.316 "----------- build verschoenere ----------------------------------";
25.317 -val t = TermC.str2term "3 + - 2 * e + 2 * f + 2 * g";
25.318 +val t = TermC.parse_test @{context} "3 + - 2 * e + 2 * f + 2 * g";
25.319 val SOME (t,_) = rewrite_set_ ctxt false verschoenere t;
25.320 if UnparseC.term t = "3 - 2 * e + 2 * f + 2 * g" then ()
25.321 else error "polyminus.sml: verschoenere 3 + - 2 * e ...";
25.322 @@ -524,16 +524,16 @@
25.323 "----- 2 \<up> ";
25.324 (*Rewrite.trace_on := true; ..stopped Test_Isac.thy*)
25.325 val erls = erls_ordne_alphabetisch;
25.326 -val t = TermC.str2term "- 9 + 12 + 5 * e - 7 * e + (6 - 4) * f - 8 * g + 10 * g";
25.327 +val t = TermC.parse_test @{context} "- 9 + 12 + 5 * e - 7 * e + (6 - 4) * f - 8 * g + 10 * g";
25.328 val SOME (t',_) =
25.329 rewrite_ ctxt Rewrite_Ord.function_empty erls false @{thm tausche_minus} t;
25.330 UnparseC.term t'; "- 9 + 12 + 5 * e - 7 * e + (- 4 + 6) * f - 8 * g + 10 * g";
25.331
25.332 -val t = TermC.str2term "- 9 + 12 + 5 * e - 7 * e + (6 - 4) * f - 8 * g + 10 * g";
25.333 +val t = TermC.parse_test @{context} "- 9 + 12 + 5 * e - 7 * e + (6 - 4) * f - 8 * g + 10 * g";
25.334 val NONE =
25.335 rewrite_ ctxt Rewrite_Ord.function_empty erls false @{thm tausche_minus_plus} t;
25.336
25.337 -val t = TermC.str2term "- 9 + 12 + 5 * e - 7 * e + (6 - 4) * f - 8 * g + 10 * g";
25.338 +val t = TermC.parse_test @{context} "- 9 + 12 + 5 * e - 7 * e + (6 - 4) * f - 8 * g + 10 * g";
25.339 val SOME (t',_) =
25.340 rewrite_set_ ctxt false ordne_alphabetisch t;
25.341 UnparseC.term t'; "- 9 + 12 + 5 * e - 7 * e - 8 * g + 10 * g + (- 4 + 6) * f";
25.342 @@ -598,7 +598,7 @@
25.343 "----------- pbl binom polynom vereinfachen p.39 -----------------";
25.344 val thy = @{theory};
25.345 val rls = klammern_ausmultiplizieren;
25.346 -val t = TermC.str2term "(3 * a + 2) * (4 * a - 1::real)";
25.347 +val t = TermC.parse_test @{context} "(3 * a + 2) * (4 * a - 1::real)";
25.348 val SOME (t,_) = rewrite_set_ ctxt false rls t; UnparseC.term t;
25.349 "3 * a * (4 * a) - 3 * a * 1 + (2 * (4 * a) - 2 * 1)";
25.350 val rls = discard_parentheses;
25.351 @@ -608,7 +608,7 @@
25.352 val SOME (t,_) = rewrite_set_ ctxt false rls t; UnparseC.term t;
25.353 "3 * 4 * a * a - 1 * 3 * a + (2 * 4 * a - 1 * 2)";
25.354 (*
25.355 -val t = TermC.str2term "3 * a * 4 * a";
25.356 +val t = TermC.parse_test @{context} "3 * a * 4 * a";
25.357 val rls = ordne_monome;
25.358 val SOME (t,_) = rewrite_set_ ctxt false rls t; UnparseC.term t;
25.359 *)
25.360 @@ -664,7 +664,7 @@
25.361
25.362 "----- go into details, if it seems not to work -----";
25.363 "--- does the predicate evaluate correctly ?";
25.364 -val t = TermC.str2term
25.365 +val t = TermC.parse_patt_test @{theory}
25.366 "matchsub (?a * (?b - ?c)) (8 * (a - q) + a - 2 * q + 3 * (a - 2 * (q::real)))";
25.367 val ma = eval_matchsub "" "Prog_Expr.matchsub" t ctxt;
25.368 case ma of
25.369 @@ -688,7 +688,7 @@
25.370 val SOME (t', _) = rewrite_set_ ctxt false prls t;
25.371
25.372 "--- does the respective prls rewrite the whole predicate ?";
25.373 -val t = TermC.str2term
25.374 +val t = TermC.parse_patt_test @{theory}
25.375 "Not (matchsub (?a * (?b + ?c)) (8 * (a - q) + a - 2 * q) | \
25.376 \ matchsub (?a * (?b - ?c)) (8 * (a - q) + a - 2 * q) | \
25.377 \ matchsub ((?b + ?c) * ?a) (8 * (a - q) + a - 2 * q) | \
26.1 --- a/test/Tools/isac/Knowledge/rateq.sml Sun Oct 09 06:53:03 2022 +0200
26.2 +++ b/test/Tools/isac/Knowledge/rateq.sml Sun Oct 09 07:44:22 2022 +0200
26.3 @@ -160,7 +160,7 @@
26.4 val Applicable.Yes (Check_elementwise' (curr_form, pred, (res, asms))) = check p''''' pt''''' m''''';
26.5 UnparseC.term curr_form = "[x = 1 / 5]";
26.6 pred = "Assumptions";
26.7 -res = TermC.str2term "[]::bool list";
26.8 +res = TermC.parse_test @{context} "[]::bool list";
26.9 asms = [];
26.10
26.11 val (p,_,f,nxt,_,pt) = me nxt''' p''' [] pt'''; (*<<<----- this caused the error*)
27.1 --- a/test/Tools/isac/Knowledge/rational-1.sml Sun Oct 09 06:53:03 2022 +0200
27.2 +++ b/test/Tools/isac/Knowledge/rational-1.sml Sun Oct 09 07:44:22 2022 +0200
27.3 @@ -24,26 +24,26 @@
27.4 "-------- fun poly_of_term ---------------------------------------------------------------------";
27.5 "-------- fun poly_of_term ---------------------------------------------------------------------";
27.6 val thy = @{theory Isac_Knowledge};
27.7 -val vs = TermC.vars_of (TermC.str2term "12 * x \<up> 3 * y \<up> 4 * z \<up> 6");
27.8 +val vs = TermC.vars_of (TermC.parse_test @{context} "12 * x \<up> 3 * y \<up> 4 * z \<up> 6");
27.9
27.10 -val t = TermC.str2term "0 ::real";
27.11 +val t = TermC.parse_test @{context} "0 ::real";
27.12 if poly_of_term vs t = SOME [(0, [0, 0, 0])]
27.13 then () else error "poly_of_term 0 changed";
27.14
27.15 -val t = TermC.str2term "-3 + - 2 * x ::real";
27.16 +val t = TermC.parse_test @{context} "-3 + - 2 * x ::real";
27.17 if poly_of_term vs t = SOME [(~3, [0, 0, 0]), (~2, [1, 0, 0])]
27.18 then () else error "poly_of_term uminus changed";
27.19
27.20 -if poly_of_term vs (TermC.str2term "12::real") = SOME [(12, [0, 0, 0])]
27.21 +if poly_of_term vs (TermC.parse_test @{context} "12::real") = SOME [(12, [0, 0, 0])]
27.22 then () else error "poly_of_term 1 changed";
27.23
27.24 -if poly_of_term vs (TermC.str2term "x::real") = SOME [(1, [1, 0, 0])]
27.25 +if poly_of_term vs (TermC.parse_test @{context} "x::real") = SOME [(1, [1, 0, 0])]
27.26 then () else error "poly_of_term 2 changed";
27.27
27.28 -if poly_of_term vs (TermC.str2term "12 * x \<up> 3") = SOME [(12, [3, 0, 0])]
27.29 +if poly_of_term vs (TermC.parse_test @{context} "12 * x \<up> 3") = SOME [(12, [3, 0, 0])]
27.30 then () else error "poly_of_term 3 changed";
27.31 "~~~~~ fun poly_of_term , args:"; val (vs, t) =
27.32 - (vs, (TermC.str2term "12 * x \<up> 3"));
27.33 + (vs, (TermC.parse_test @{context} "12 * x \<up> 3"));
27.34
27.35 monom_of_term vs (1, replicate (length vs) 0) t;(*poly malformed 1 with x \<up> 3*)
27.36 "~~~~~ fun monom_of_term , args:"; val (vs, (c, es), (Const (\<^const_name>\<open>times\<close>, _) $ m1 $ m2)) =
27.37 @@ -59,30 +59,30 @@
27.38 if (c, num |> HOLogic.dest_numeral |> list_update es (find_index (curry op = t) vs)) = (12, [3, 0, 0])
27.39 then () else error "monom_of_term (realpow): return value CHANGED";
27.40
27.41 -if poly_of_term vs (TermC.str2term "12 * x \<up> 3 * y \<up> 4 * z \<up> 6") = SOME [(12, [3, 4, 6])]
27.42 +if poly_of_term vs (TermC.parse_test @{context} "12 * x \<up> 3 * y \<up> 4 * z \<up> 6") = SOME [(12, [3, 4, 6])]
27.43 then () else error "poly_of_term 4 changed";
27.44
27.45 -if poly_of_term vs (TermC.str2term "1 + 2 * x \<up> 3 * y \<up> 4 * z \<up> 6 + y") =
27.46 +if poly_of_term vs (TermC.parse_test @{context} "1 + 2 * x \<up> 3 * y \<up> 4 * z \<up> 6 + y") =
27.47 SOME [(1, [0, 0, 0]), (1, [0, 1, 0]), (2, [3, 4, 6])]
27.48 then () else error "poly_of_term 5 changed";
27.49
27.50 (*poly_of_term is quite liberal:*)
27.51 (*the coefficient may be somewhere, the order of variables and the parentheses
27.52 within a monomial are arbitrary*)
27.53 -if poly_of_term vs (TermC.str2term "y \<up> 4 * (x \<up> 3 * 12 * z \<up> 6)") = SOME [(12, [3, 4, 6])]
27.54 +if poly_of_term vs (TermC.parse_test @{context} "y \<up> 4 * (x \<up> 3 * 12 * z \<up> 6)") = SOME [(12, [3, 4, 6])]
27.55 then () else error "poly_of_term 6 changed";
27.56
27.57 (*there may even be more than 1 coefficient:*)
27.58 -if poly_of_term vs (TermC.str2term "2 * y \<up> 4 * (x \<up> 3 * 6 * z \<up> 6)") = SOME [(12, [3, 4, 6])]
27.59 +if poly_of_term vs (TermC.parse_test @{context} "2 * y \<up> 4 * (x \<up> 3 * 6 * z \<up> 6)") = SOME [(12, [3, 4, 6])]
27.60 then () else error "poly_of_term 7 changed";
27.61
27.62 (*the order and the parentheses within monomials are arbitrary:*)
27.63 -if poly_of_term vs (TermC.str2term "2 * x \<up> 3 * y \<up> 4 * z \<up> 6 + (7 * y \<up> 8 + 1)")
27.64 +if poly_of_term vs (TermC.parse_test @{context} "2 * x \<up> 3 * y \<up> 4 * z \<up> 6 + (7 * y \<up> 8 + 1)")
27.65 = SOME [(1, [0, 0, 0]), (7, [0, 8, 0]), (2, [3, 4, 6])]
27.66 then () else error "poly_of_term 8 changed";
27.67
27.68 (*from --- rls norm_Rational downto fun gcd_poly ---*)
27.69 -val t = TermC.str2term (*copy from above: "::real" is not required due to " \<up> "*)
27.70 +val t = TermC.parse_test @{context} (*copy from above: "::real" is not required due to " \<up> "*)
27.71 ("(- 12 + 4 * y + 3 * x \<up> 2 + - 1 * (x \<up> 2 * y)) /" ^
27.72 "(- 18 + -9 * x + 2 * y \<up> 2 + x * y \<up> 2)");
27.73 "~~~~~ fun cancel_p_, args:"; val (t) = (t);
27.74 @@ -99,9 +99,9 @@
27.75 "-------- fun is_poly --------------------------------------------------------------------------";
27.76 "-------- fun is_poly --------------------------------------------------------------------------";
27.77 "-------- fun is_poly --------------------------------------------------------------------------";
27.78 -if is_poly (TermC.str2term "2 * x \<up> 3 * y \<up> 4 * z \<up> 6 + 7 * y \<up> 8 + 1")
27.79 +if is_poly (TermC.parse_test @{context} "2 * x \<up> 3 * y \<up> 4 * z \<up> 6 + 7 * y \<up> 8 + 1")
27.80 then () else error "is_poly 1 changed";
27.81 -if not (is_poly (TermC.str2term "2 * (x \<up> 3 * y \<up> 4 * z \<up> 6 + 7) * y \<up> 8 + 1"))
27.82 +if not (is_poly (TermC.parse_test @{context} "2 * (x \<up> 3 * y \<up> 4 * z \<up> 6 + 7) * y \<up> 8 + 1"))
27.83 then () else error "is_poly 2 changed";
27.84
27.85 "-------- fun is_ratpolyexp --------------------------------------------------------------------";
27.86 @@ -122,7 +122,7 @@
27.87 "-------- fun term_of_poly ---------------------------------------------------------------------";
27.88 "-------- fun term_of_poly ---------------------------------------------------------------------";
27.89 val expT = HOLogic.realT
27.90 -val Free (_, baseT) = (hd o vars o TermC.str2term) "12 * x \<up> 3 * y \<up> 4 * z \<up> 6";
27.91 +val Free (_, baseT) = (hd o vars o TermC.parse_test @{context}) "12 * x \<up> 3 * y \<up> 4 * z \<up> 6";
27.92 val p = [(1, [0, 0, 0]), (7, [0, 8, 0]), (2, [3, 4, 5])]
27.93 val vs = TermC.vars_of (the (parseNEW ctxt "12 * x \<up> 3 * y \<up> 4 * z \<up> 6"))
27.94 (*precondition for [(c, es),...]: legth es = length vs*)
27.95 @@ -137,7 +137,7 @@
27.96 val ctxt = Proof_Context.init_global thy
27.97
27.98 (*------- standard case: *)
27.99 -val t = TermC.str2term "2 / 3 + 1 / 6 ::real";
27.100 +val t = TermC.parse_test @{context} "2 / 3 + 1 / 6 ::real";
27.101 "~~~~~ fun add_fraction_p_ , args:"; val ((_: theory), t) = (thy, t);
27.102 val SOME ((n1, d1), (n2, d2)) =
27.103 (*case*) check_frac_sum t (*of*);
27.104 @@ -175,7 +175,7 @@
27.105
27.106 (*------- 0 / m + 0 / n
27.107 20 years old bug found here: *)
27.108 -val t = TermC.str2term "0 = c_2 + c * 0 + 1 / EI * (L * q_0 / 12 * 0 \<up> 3 + - 1 * q_0 / 24 * 0 \<up> 4)";
27.109 +val t = TermC.parse_test @{context} "0 = c_2 + c * 0 + 1 / EI * (L * q_0 / 12 * 0 \<up> 3 + - 1 * q_0 / 24 * 0 \<up> 4)";
27.110 val SOME (t', _) = rewrite_set_ ctxt true norm_Rational t;
27.111 (*
27.112 :
27.113 @@ -195,7 +195,7 @@
27.114 *)
27.115 if UnparseC.term t' = "0 = c_2" then () else error "norm_Rational CHANGED"; (*isa2*)
27.116
27.117 -val t = TermC.str2term "0 / 12 + 0 / 24 ::real";
27.118 +val t = TermC.parse_test @{context} "0 / 12 + 0 / 24 ::real";
27.119 add_fraction_p_ @{theory} t;
27.120 "~~~~~ fun add_fraction_p_ , args:"; val ((_: theory), t) = (thy, t);
27.121 val SOME ((n1, d1), (n2, d2)) =
27.122 @@ -268,16 +268,16 @@
27.123 "-------- complex examples: rls norm_Rational --------------------------------------------------";
27.124 "-------- complex examples: rls norm_Rational --------------------------------------------------";
27.125 "-------- complex examples: rls norm_Rational --------------------------------------------------";
27.126 -val t = TermC.str2term "(3*x+5)/18 - x/2 - -(3*x - 2)/9 = 0";
27.127 +val t = TermC.parse_test @{context} "(3*x+5)/18 - x/2 - -(3*x - 2)/9 = 0";
27.128 val SOME (t', _) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term t';
27.129 if UnparseC.term t' = "1 / 18 = 0" then () else error "rational.sml 1";
27.130
27.131 -val t = TermC.str2term "(17*x - 51)/9 - (-(13*x - 3)/6) + 11 - (9*x - 7)/4 = 0";
27.132 +val t = TermC.parse_test @{context} "(17*x - 51)/9 - (-(13*x - 3)/6) + 11 - (9*x - 7)/4 = 0";
27.133 val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term t';
27.134 if UnparseC.term t' = "(237 + 65 * x) / 36 = 0" then ()
27.135 else error "rational.sml 2";
27.136
27.137 -val t = TermC.str2term "(1/2 + (5*x)/2) \<up> 2 - ((13*x)/2 - 5/2) \<up> 2 - (6*x) \<up> 2 + 29";
27.138 +val t = TermC.parse_test @{context} "(1/2 + (5*x)/2) \<up> 2 - ((13*x)/2 - 5/2) \<up> 2 - (6*x) \<up> 2 + 29";
27.139 val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term t';
27.140 if UnparseC.term t' = "23 + 35 * x + - 72 * x \<up> 2" then ()
27.141 else error "rational.sml 3";
27.142 @@ -286,20 +286,20 @@
27.143 "-------- complex examples cancellation from: Mathematik 1 Schalk ------------------------------";
27.144 "-------- complex examples cancellation from: Mathematik 1 Schalk ------------------------------";
27.145 (*Schalk I, p.60 Nr. 215c *)
27.146 -val t = TermC.str2term "(a + b) \<up> 4 * (x - y) / ((x - y) \<up> 3 * (a + b) \<up> 2)";
27.147 +val t = TermC.parse_test @{context} "(a + b) \<up> 4 * (x - y) / ((x - y) \<up> 3 * (a + b) \<up> 2)";
27.148 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
27.149 if UnparseC.term t = "(a \<up> 2 + 2 * a * b + b \<up> 2) / (x \<up> 2 + - 2 * x * y + y \<up> 2)"
27.150 then () else error "rational.sml: diff.behav. in norm_Rational_mg 7";
27.151
27.152 (*SRC Schalk I, p.66 Nr. 381b *)
27.153 -val t = TermC.str2term
27.154 +val t = TermC.parse_test @{context}
27.155 "(4*x \<up> 2 - 20*x + 25)/(2*x - 5) \<up> 3";
27.156 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
27.157 if UnparseC.term t = "1 / (- 5 + 2 * x)"
27.158 then () else error "rational.sml: diff.behav. in norm_Rational_mg 9";
27.159
27.160 (*Schalk I, p.60 Nr. 215c *)
27.161 -val t = TermC.str2term "(a + b) \<up> 4 * (x - y) / ((x - y) \<up> 3 * (a + b) \<up> 2)";
27.162 +val t = TermC.parse_test @{context} "(a + b) \<up> 4 * (x - y) / ((x - y) \<up> 3 * (a + b) \<up> 2)";
27.163 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
27.164 if UnparseC.term t = "(a \<up> 2 + 2 * a * b + b \<up> 2) / (x \<up> 2 + - 2 * x * y + y \<up> 2)"
27.165 then () else error "Schalk I, p.60 Nr. 215c: with Isabelle2002 cancellation incomplete, changed";
28.1 --- a/test/Tools/isac/Knowledge/rational-2.sml Sun Oct 09 06:53:03 2022 +0200
28.2 +++ b/test/Tools/isac/Knowledge/rational-2.sml Sun Oct 09 07:44:22 2022 +0200
28.3 @@ -44,7 +44,7 @@
28.4 "-------- integration lev.1 fun factout_p_ -----------------------------------";
28.5 "-------- integration lev.1 fun factout_p_ -----------------------------------";
28.6 "-------- integration lev.1 fun factout_p_ -----------------------------------";
28.7 -val t = TermC.str2term "(x \<up> 2 + - 1*y \<up> 2) / (x \<up> 2 + - 1*x*y)"
28.8 +val t = TermC.parse_test @{context} "(x \<up> 2 + - 1*y \<up> 2) / (x \<up> 2 + - 1*x*y)"
28.9 val SOME (t', asm) = factout_p_ thy t;
28.10 if UnparseC.term t' = "(x + y) * (x + - 1 * y) / (x * (x + - 1 * y))"
28.11 then () else error ("factout_p_ term 1 changed: " ^ UnparseC.term t')
28.12 @@ -52,10 +52,10 @@
28.13 if UnparseC.terms asm = "[\"x \<noteq> 0\", \"x + - 1 * y \<noteq> 0\"]"
28.14 then () else error "factout_p_ asm 1 changed"
28.15 ;
28.16 -val t = TermC.str2term "nothing + to_cancel ::real";
28.17 +val t = TermC.parse_test @{context} "nothing + to_cancel ::real";
28.18 if NONE = factout_p_ thy t then () else error "factout_p_ doesn't report non-applicable";
28.19 ;
28.20 -val t = TermC.str2term "((3 * x \<up> 2 + 6 *x + 3) / (2*x + 2))";
28.21 +val t = TermC.parse_test @{context} "((3 * x \<up> 2 + 6 *x + 3) / (2*x + 2))";
28.22 val SOME (t', asm) = factout_p_ thy t;
28.23 if UnparseC.term t' = "(3 + 3 * x) * (1 + x) / (2 * (1 + x))" andalso
28.24 UnparseC.terms asm = "[\"1 + x \<noteq> 0\"]"
28.25 @@ -64,15 +64,15 @@
28.26 "-------- integration lev.1 fun cancel_p_ ------------------------------------";
28.27 "-------- integration lev.1 fun cancel_p_ ------------------------------------";
28.28 "-------- integration lev.1 fun cancel_p_ ------------------------------------";
28.29 -val t = TermC.str2term "(x \<up> 2 + - 1*y \<up> 2) / (x \<up> 2 + - 1*x*y)"
28.30 +val t = TermC.parse_test @{context} "(x \<up> 2 + - 1*y \<up> 2) / (x \<up> 2 + - 1*x*y)"
28.31 val SOME (t', asm) = cancel_p_ thy t;
28.32 if (UnparseC.term t', UnparseC.terms asm) = ("(x + y) / x", "[\"x \<noteq> 0\"]")
28.33 then () else error ("cancel_p_ (t', asm) 1 changed: " ^ UnparseC.term t')
28.34 ;
28.35 -val t = TermC.str2term "nothing + to_cancel ::real";
28.36 +val t = TermC.parse_test @{context} "nothing + to_cancel ::real";
28.37 if NONE = cancel_p_ thy t then () else error "cancel_p_ doesn't report non-applicable";
28.38 ;
28.39 -val t = TermC.str2term "((3 * x \<up> 2 + 6 *x + 3) / (2*x + 2))";
28.40 +val t = TermC.parse_test @{context} "((3 * x \<up> 2 + 6 *x + 3) / (2*x + 2))";
28.41 val SOME (t', asm) = cancel_p_ thy t;
28.42 if UnparseC.term t' = "(3 + 3 * x) / 2" andalso UnparseC.terms asm = "[]"
28.43 then () else error "cancel_p_ 1 changed";
28.44 @@ -80,7 +80,7 @@
28.45 "-------- integration lev.1 fun common_nominator_p_ --------------------------";
28.46 "-------- integration lev.1 fun common_nominator_p_ --------------------------";
28.47 "-------- integration lev.1 fun common_nominator_p_ --------------------------";
28.48 -val t = TermC.str2term ("y / (a*x + b*x + c*x) " ^
28.49 +val t = TermC.parse_test @{context} ("y / (a*x + b*x + c*x) " ^
28.50 (* n1 d1 *)
28.51 "+ a / (x*y)");
28.52 (* n2 d2 *)
28.53 @@ -95,7 +95,7 @@
28.54 then () else error "common_nominator_p_ asm 1 changed"
28.55
28.56 "-------- example in mail Nipkow";
28.57 -val t = TermC.str2term "x/(x \<up> 2 + - 1*y \<up> 2) + y/(x \<up> 2 + - 1*x*y)";
28.58 +val t = TermC.parse_test @{context} "x/(x \<up> 2 + - 1*y \<up> 2) + y/(x \<up> 2 + - 1*x*y)";
28.59 val SOME (t', asm) = common_nominator_p_ thy t;
28.60 if UnparseC.term t' =
28.61 "x * x / ((x + - 1 * y) * ((x + y) * x)) +\ny * (x + y) / ((x + - 1 * y) * ((x + y) * x))"
28.62 @@ -105,10 +105,10 @@
28.63 then () else error "common_nominator_p_ asm 2 changed"
28.64
28.65 "-------- example: applicable tested by SML code";
28.66 -val t = TermC.str2term "nothing / to_add";
28.67 +val t = TermC.parse_test @{context} "nothing / to_add";
28.68 if NONE = common_nominator_p_ thy t then () else error "common_nominator_p_ term 3 changed";
28.69 ;
28.70 -val t = TermC.str2term "((x + (- 1)) / (x + 1)) + ((x + 1) / (x + (- 1)))";
28.71 +val t = TermC.parse_test @{context} "((x + (- 1)) / (x + 1)) + ((x + 1) / (x + (- 1)))";
28.72 val SOME (t', asm) = common_nominator_p_ thy t;
28.73 if UnparseC.term t' =
28.74 "(x + - 1) * (- 1 + x) / ((1 + x) * (- 1 + x)) +\n(x + 1) * (1 + x) / ((1 + x) * (- 1 + x))"
28.75 @@ -118,7 +118,7 @@
28.76 "-------- integration lev.1 fun add_fraction_p_ ------------------------------";
28.77 "-------- integration lev.1 fun add_fraction_p_ ------------------------------";
28.78 "-------- integration lev.1 fun add_fraction_p_ ------------------------------";
28.79 -val t = TermC.str2term "((x + (- 1)) / (x + 1)) + ((x + 1) / (x + (- 1)))";
28.80 +val t = TermC.parse_test @{context} "((x + (- 1)) / (x + 1)) + ((x + 1) / (x + (- 1)))";
28.81 val SOME (t', asm) = add_fraction_p_ thy t;
28.82 if UnparseC.term t' = "(2 + 2 * x \<up> 2) / (- 1 + x \<up> 2)"
28.83 then () else error "add_fraction_p_ 3 changed";
28.84 @@ -126,10 +126,10 @@
28.85 if UnparseC.terms asm = "[\"- 1 + x \<up> 2 \<noteq> 0\"]"
28.86 then () else error "add_fraction_p_ 3 changed";
28.87 ;
28.88 -val t = TermC.str2term "nothing / to_add";
28.89 +val t = TermC.parse_test @{context} "nothing / to_add";
28.90 if NONE = add_fraction_p_ thy t then () else error "add_fraction_p_ term 3 changed";
28.91 ;
28.92 -val t = TermC.str2term "((x + (- 1)) / (x + 1)) + ((x + 1) / (x + (- 1)))";
28.93 +val t = TermC.parse_test @{context} "((x + (- 1)) / (x + 1)) + ((x + 1) / (x + (- 1)))";
28.94 val SOME (t', asm) = add_fraction_p_ thy t;
28.95 if UnparseC.term t' = "(2 + 2 * x \<up> 2) / (- 1 + x \<up> 2)" andalso
28.96 UnparseC.terms asm = "[\"- 1 + x \<up> 2 \<noteq> 0\"]"
28.97 @@ -142,7 +142,7 @@
28.98 (which does not to work, because substitution is not done -- compare rew_sub!);
28.99 keep this sequence for the case, factout_p, cancel_p, common_nominator_p, add_fraction_p
28.100 (again) get prepat = [] changed to <>[]. *)
28.101 -val t = TermC.str2term "(x \<up> 2 + - 1*y \<up> 2) / (x \<up> 2 + - 1*x*y)";
28.102 +val t = TermC.parse_test @{context} "(x \<up> 2 + - 1*y \<up> 2) / (x \<up> 2 + - 1*x*y)";
28.103
28.104 (*rewrite_set_ @{theory Isac_Knowledge} true cancel t = NONE; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*)
28.105 "~~~~~ fun rewrite_set_, args:"; val (thy, bool, rls, term) = (thy, false, cancel_p, t);
28.106 @@ -219,13 +219,13 @@
28.107 "-------- fun rewrite_set_ cancel_p downto fun gcd_poly ----------------------";
28.108 "-------- fun rewrite_set_ cancel_p downto fun gcd_poly ----------------------";
28.109 "-------- fun rewrite_set_ cancel_p downto fun gcd_poly ----------------------";
28.110 -val t = TermC.str2term "(12 * x * y) / (8 * y \<up> 2 )";
28.111 +val t = TermC.parse_test @{context} "(12 * x * y) / (8 * y \<up> 2 )";
28.112 (* "-------- example 187a": exception Div raised...
28.113 val SOME (t', asm) = rewrite_set_ thy false cancel_p t;*)
28.114 -val t = TermC.str2term "(8 * x \<up> 2 * y * z ) / (18 * x * y \<up> 2 * z )";
28.115 +val t = TermC.parse_test @{context} "(8 * x \<up> 2 * y * z ) / (18 * x * y \<up> 2 * z )";
28.116 (* "-------- example 187b": doesn't terminate...
28.117 val SOME (t', asm) = rewrite_set_ thy false cancel_p t;*)
28.118 -val t = TermC.str2term "(9 * x \<up> 5 * y \<up> 2 * z \<up> 4) / (15 * x \<up> 6 * y \<up> 3 * z )";
28.119 +val t = TermC.parse_test @{context} "(9 * x \<up> 5 * y \<up> 2 * z \<up> 4) / (15 * x \<up> 6 * y \<up> 3 * z )";
28.120 (* "-------- example 187c": doesn't terminate...
28.121 val SOME (t', asm) = rewrite_set_ thy false cancel_p t;*)
28.122 "~~~~~ fun rewrite_set_, args:"; val (thy, bool, rls, term) = (@{theory Isac_Knowledge}, false, cancel_p, t);
28.123 @@ -274,14 +274,14 @@
28.124 "-------- rls norm_Rational downto fun gcd_poly ------------------------------";
28.125 "-------- rls norm_Rational downto fun gcd_poly ------------------------------";
28.126 "-------- rls norm_Rational downto fun gcd_poly ------------------------------";
28.127 -val t = TermC.str2term "(x \<up> 2 - 4)*(3 - y) / ((y \<up> 2 - 9)*(2+x))";
28.128 +val t = TermC.parse_test @{context} "(x \<up> 2 - 4)*(3 - y) / ((y \<up> 2 - 9)*(2+x))";
28.129 (* trace_rewrite stops with ...: (and then jEdit hangs)..
28.130 rewrite_set_ thy false norm_Rational t;
28.131 :
28.132 ### rls: cancel_p on: (- 12 + 4 * y + 3 * x \<up> 2 + - 1 * (x \<up> 2 * y)) /
28.133 (- 18 + -9 * x + 2 * y \<up> 2 + x * y \<up> 2)
28.134 *)
28.135 -val t = TermC.str2term (*copy from above: "::real" is not required due to " \<up> "*)
28.136 +val t = TermC.parse_test @{context} (*copy from above: "::real" is not required due to " \<up> "*)
28.137 ("(- 12 + 4 * y + 3 * x \<up> 2 + - 1 * (x \<up> 2 * y)) /" ^
28.138 "(- 18 + -9 * x + 2 * y \<up> 2 + x * y \<up> 2)");
28.139 (*cancel_p_ thy t;
28.140 @@ -307,7 +307,7 @@
28.141 "-------- rls norm_Rational downto fun add_fraction_p_ -----------------------";
28.142 val thy = @{theory Isac_Knowledge};
28.143 "----- SK060904- 2a non-termination of add_fraction_p_";
28.144 -val t = TermC.str2term (" (a + b * x) / (a + - 1 * (b * x)) + " ^
28.145 +val t = TermC.parse_test @{context} (" (a + b * x) / (a + - 1 * (b * x)) + " ^
28.146 " (- 1 * a + b * x) / (a + b * x) ");
28.147 (* rewrite_set_ thy false norm_Rational t
28.148 exception Div raised*)
28.149 @@ -429,7 +429,7 @@
28.150 (* Rewrite.trace_on:
28.151 add_fractions_p on: 3 = A / 2 + A / 4 + (B / 2 + - 1 * B / 2) --> 3 = A / 2 + A / 4 + 0 / 2 *)
28.152 (* |||||||||||||||||||||||||||| *)
28.153 -val t = TermC.str2term (* ||||||||||||||||||||||||| *)
28.154 +val t = TermC.parse_test @{context} (* ||||||||||||||||||||||||| *)
28.155 "AA / 4 + (BB / 2 + - 1 * BB / 2)";
28.156 "~~~~~ fun add_fraction_p_ , ad-hoc args:"; val (t) = (t);
28.157 val SOME ((n1, d1), (n2, d2)) = (*case*) check_frac_sum t (*of*);
28.158 @@ -456,26 +456,26 @@
28.159 "-------- rewrite_set_ cancel_p from: Mathematik 1 Schalk Reniets Verlag -----";
28.160 val thy = @{theory "Rational"};
28.161 "-------- WN";
28.162 -val t = TermC.str2term "(2 + -3 * x) / 9";
28.163 +val t = TermC.parse_test @{context} "(2 + -3 * x) / 9";
28.164 if NONE = rewrite_set_ ctxt false cancel_p t then ()
28.165 else error "rewrite_set_ cancel_p must return NONE, if the term cannot be cancelled";
28.166
28.167 "-------- example 186a";
28.168 -val t = TermC.str2term "(14 * x * y) / (x * y)";
28.169 - is_expanded (TermC.str2term "14 * x * y");
28.170 - is_expanded (TermC.str2term "x * y");
28.171 +val t = TermC.parse_test @{context} "(14 * x * y) / (x * y)";
28.172 + is_expanded (TermC.parse_test @{context} "14 * x * y");
28.173 + is_expanded (TermC.parse_test @{context} "x * y");
28.174 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
28.175 if (UnparseC.term t', UnparseC.terms asm) = ("14 / 1", "[]")
28.176 then () else error "rational.sml cancel Schalk 186a";
28.177
28.178 "-------- example 186b";
28.179 -val t = TermC.str2term "(60 * a * b) / ( 15 * a * b )";
28.180 +val t = TermC.parse_test @{context} "(60 * a * b) / ( 15 * a * b )";
28.181 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
28.182 if (UnparseC.term t', UnparseC.terms asm) = ("4 / 1", "[]")
28.183 then () else error "rational.sml cancel Schalk 186b";
28.184
28.185 "-------- example 186c";
28.186 -val t = TermC.str2term "(144 * a \<up> 2 * b * c) / (12 * a * b * c)";
28.187 +val t = TermC.parse_test @{context} "(144 * a \<up> 2 * b * c) / (12 * a * b * c)";
28.188 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
28.189 if (UnparseC.term t', UnparseC.terms asm) = ("12 * a / 1", "[]")
28.190 then () else error "rational.sml cancel Schalk 186c";
28.191 @@ -483,7 +483,7 @@
28.192 (* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! exception Div raised !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
28.193 see --- fun rewrite_set_ downto fun gcd_poly ---
28.194 "-------- example 187a";
28.195 -val t = TermC.str2term "(12 * x * y) / (8 * y \<up> 2 )";
28.196 +val t = TermC.parse_test @{context} "(12 * x * y) / (8 * y \<up> 2 )";
28.197 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
28.198 if (UnparseC.term t', UnparseC.terms asm) = ("3 * x / (2 * y)", "[\"4 * y ~= 0\"]")
28.199 then () else error "rational.sml cancel Schalk 187a";
28.200 @@ -492,7 +492,7 @@
28.201 (* doesn't terminate !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
28.202 see --- fun rewrite_set_ downto fun gcd_poly ---
28.203 "-------- example 187b";
28.204 -val t = TermC.str2term "(8 * x \<up> 2 * y * z ) / (18 * x * y \<up> 2 * z )";
28.205 +val t = TermC.parse_test @{context} "(8 * x \<up> 2 * y * z ) / (18 * x * y \<up> 2 * z )";
28.206 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
28.207 if (UnparseC.term t', UnparseC.terms asm) = ("4 * x / (9 * y)", "[\"2 * (z * (y * x)) ~= 0\"]")
28.208 then () else error "rational.sml cancel Schalk 187b";
28.209 @@ -501,7 +501,7 @@
28.210 (* doesn't terminate !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
28.211 see --- fun rewrite_set_ downto fun gcd_poly ---
28.212 "-------- example 187c";
28.213 -val t = TermC.str2term "(9 * x \<up> 5 * y \<up> 2 * z \<up> 4) / (15 * x \<up> 6 * y \<up> 3 * z )";
28.214 +val t = TermC.parse_test @{context} "(9 * x \<up> 5 * y \<up> 2 * z \<up> 4) / (15 * x \<up> 6 * y \<up> 3 * z )";
28.215 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
28.216 if (UnparseC.term t', UnparseC.terms asm) =
28.217 ("3 * z \<up> 3 / (5 * (y * x))", "[\"3 * (z * (y \<up> 2 * x \<up> 5)) ~= 0\"]")
28.218 @@ -509,119 +509,119 @@
28.219 *)
28.220
28.221 "-------- example 188a";
28.222 -val t = TermC.str2term "(-8 + 8 * x) / (-9 + 9 * x)";
28.223 - is_expanded (TermC.str2term "8 * x + -8");
28.224 +val t = TermC.parse_test @{context} "(-8 + 8 * x) / (-9 + 9 * x)";
28.225 + is_expanded (TermC.parse_test @{context} "8 * x + -8");
28.226 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
28.227 if (UnparseC.term t', UnparseC.terms asm) = ("8 / 9", "[]")
28.228 then () else error "rational.sml cancel Schalk 188a";
28.229
28.230 -val t = TermC.str2term "(8*((- 1) + x))/(9*((- 1) + x))";
28.231 +val t = TermC.parse_test @{context} "(8*((- 1) + x))/(9*((- 1) + x))";
28.232 val SOME (t, _) = rewrite_set_ ctxt false make_polynomial t;
28.233 if (UnparseC.term t', UnparseC.terms asm) = ("8 / 9", "[]")
28.234 then () else error "rational.sml cancel Schalk make_polynomial 1";
28.235
28.236 "-------- example 188b";
28.237 -val t = TermC.str2term "(- 15 + 5 * x) / (- 18 + 6 * x)";
28.238 +val t = TermC.parse_test @{context} "(- 15 + 5 * x) / (- 18 + 6 * x)";
28.239 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
28.240 if (UnparseC.term t', UnparseC.terms asm) = ("5 / 6", "[]")
28.241 then () else error "rational.sml cancel Schalk 188b";
28.242
28.243 "-------- example 188c";
28.244 -val t = TermC.str2term "(a + - 1 * b) / (b + - 1 * a)";
28.245 +val t = TermC.parse_test @{context} "(a + - 1 * b) / (b + - 1 * a)";
28.246 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
28.247 if (UnparseC.term t', UnparseC.terms asm) = ("- 1 / 1", "[]")
28.248 then () else error "rational.sml cancel Schalk 188c";
28.249
28.250 -is_expanded (TermC.str2term "a + - 1 * b") = true;
28.251 -val t = TermC.str2term "((- 1)*(b + (- 1) * a))/(1*(b + (- 1) * a))";
28.252 +is_expanded (TermC.parse_test @{context} "a + - 1 * b") = true;
28.253 +val t = TermC.parse_test @{context} "((- 1)*(b + (- 1) * a))/(1*(b + (- 1) * a))";
28.254 val SOME (t', asm) = rewrite_set_ ctxt false make_polynomial t;
28.255 if (UnparseC.term t', UnparseC.terms asm) = ("(a + - 1 * b) / (- 1 * a + b)", "[]")
28.256 then () else error "rational.sml cancel Schalk make_polynomial 2";
28.257
28.258 "-------- example 190a";
28.259 -val t = TermC.str2term "( 27 * a \<up> 3 + 9 * a \<up> 2 + 3 * a + 1 ) / ( 27 * a \<up> 3 + 18 * a \<up> 2 + 3 * a )";
28.260 +val t = TermC.parse_test @{context} "( 27 * a \<up> 3 + 9 * a \<up> 2 + 3 * a + 1 ) / ( 27 * a \<up> 3 + 18 * a \<up> 2 + 3 * a )";
28.261 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
28.262 if (UnparseC.term t', UnparseC.terms asm) =
28.263 ("(1 + 9 * a \<up> 2) / (3 * a + 9 * a \<up> 2)", "[\"3 * a + 9 * a \<up> 2 \<noteq> 0\"]")
28.264 then () else error "rational.sml cancel Schalk 190a";
28.265
28.266 "-------- example 190c";
28.267 -val t = TermC.str2term "((1 + 9 * a \<up> 2)*(1 + 3 * a))/((3 * a + 9 * a \<up> 2)*(1 + 3 * a))";
28.268 +val t = TermC.parse_test @{context} "((1 + 9 * a \<up> 2)*(1 + 3 * a))/((3 * a + 9 * a \<up> 2)*(1 + 3 * a))";
28.269 val SOME (t', asm) = rewrite_set_ ctxt false make_polynomial t;
28.270 if (UnparseC.term t', UnparseC.terms asm) =
28.271 ("(1 + 3 * a + 9 * a \<up> 2 + 27 * a \<up> 3) /\n(3 * a + 18 * a \<up> 2 + 27 * a \<up> 3)", "[]")
28.272 then () else error "rational.sml make_polynomial Schalk 190c";
28.273
28.274 "-------- example 191a";
28.275 -val t = TermC.str2term "( x \<up> 2 + - 1 * y \<up> 2 ) / ( x + y )";
28.276 - is_expanded (TermC.str2term "x \<up> 2 + - 1 * y \<up> 2") = false; (*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*)
28.277 - is_expanded (TermC.str2term "x + y") = true;
28.278 +val t = TermC.parse_test @{context} "( x \<up> 2 + - 1 * y \<up> 2 ) / ( x + y )";
28.279 + is_expanded (TermC.parse_test @{context} "x \<up> 2 + - 1 * y \<up> 2") = false; (*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*)
28.280 + is_expanded (TermC.parse_test @{context} "x + y") = true;
28.281 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
28.282 if (UnparseC.term t', UnparseC.terms asm) = ("(x + - 1 * y) / 1", "[]")
28.283 then () else error "rational.sml make_polynomial Schalk 191a";
28.284
28.285 "-------- example 191b";
28.286 -val t = TermC.str2term "((x + (- 1) * y)*(x + y))/((1)*(x + y))";
28.287 +val t = TermC.parse_test @{context} "((x + (- 1) * y)*(x + y))/((1)*(x + y))";
28.288 val SOME (t', asm) = rewrite_set_ ctxt false make_polynomial t;
28.289 if (UnparseC.term t', UnparseC.terms asm) = ("(x \<up> 2 + - 1 * y \<up> 2) / (x + y)", "[]")
28.290 then () else error "rational.sml make_polynomial Schalk 191b";
28.291
28.292 "-------- example 191c";
28.293 -val t = TermC.str2term "( 9 * x \<up> 2 + -30 * x + 25 ) / ( 9 * x \<up> 2 + - 25 )";
28.294 - is_expanded (TermC.str2term "9 * x \<up> 2 + -30 * x + 25") = true;
28.295 - is_expanded (TermC.str2term "25 + -30*x + 9*x \<up> 2") = true;
28.296 - is_expanded (TermC.str2term "- 25 + 9*x \<up> 2") = true;
28.297 +val t = TermC.parse_test @{context} "( 9 * x \<up> 2 + -30 * x + 25 ) / ( 9 * x \<up> 2 + - 25 )";
28.298 + is_expanded (TermC.parse_test @{context} "9 * x \<up> 2 + -30 * x + 25") = true;
28.299 + is_expanded (TermC.parse_test @{context} "25 + -30*x + 9*x \<up> 2") = true;
28.300 + is_expanded (TermC.parse_test @{context} "- 25 + 9*x \<up> 2") = true;
28.301
28.302 -val t = TermC.str2term "(((-5) + 3 * x)*((-5) + 3 * x))/((5 + 3 * x)*((-5) + 3 * x))";
28.303 +val t = TermC.parse_test @{context} "(((-5) + 3 * x)*((-5) + 3 * x))/((5 + 3 * x)*((-5) + 3 * x))";
28.304 val SOME (t', asm) = rewrite_set_ ctxt false make_polynomial t;
28.305 if (UnparseC.term t', UnparseC.terms asm) = ("(25 + - 30 * x + 9 * x \<up> 2) / (- 25 + 9 * x \<up> 2)", "[]")
28.306 then () else error "rational.sml make_polynomial Schalk 191c";
28.307
28.308 "-------- example 192b";
28.309 -val t = TermC.str2term "( 7 * x \<up> 3 + - 1 * x \<up> 2 * y ) / ( 7 * x * y \<up> 2 + - 1 * y \<up> 3 )";
28.310 +val t = TermC.parse_test @{context} "( 7 * x \<up> 3 + - 1 * x \<up> 2 * y ) / ( 7 * x * y \<up> 2 + - 1 * y \<up> 3 )";
28.311 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
28.312 if (UnparseC.term t', UnparseC.terms asm) = ("x \<up> 2 / y \<up> 2", "[\"y \<up> 2 \<noteq> 0\"]")
28.313 then () else error "rational.sml cancel_p Schalk 192b";
28.314
28.315 -val t = TermC.str2term "((x \<up> 2)*(7 * x + (- 1) * y))/((y \<up> 2)*(7 * x + (- 1) * y))";
28.316 +val t = TermC.parse_test @{context} "((x \<up> 2)*(7 * x + (- 1) * y))/((y \<up> 2)*(7 * x + (- 1) * y))";
28.317 val SOME (t', asm) = rewrite_set_ ctxt false make_polynomial t;
28.318 if (UnparseC.term t', UnparseC.terms asm) =
28.319 ("(7 * x \<up> 3 + - 1 * x \<up> 2 * y) /\n(7 * x * y \<up> 2 + - 1 * y \<up> 3)", "[]")
28.320 then () else error "rational.sml make_polynomial Schalk 192b";
28.321
28.322 -val t = TermC.str2term "((x \<up> 2)*(7 * x + (- 1) * y))/((y \<up> 2)*(7 * x + (- 1) * y))";
28.323 +val t = TermC.parse_test @{context} "((x \<up> 2)*(7 * x + (- 1) * y))/((y \<up> 2)*(7 * x + (- 1) * y))";
28.324 val SOME (t', asm) = rewrite_set_ ctxt false make_polynomial t;
28.325 if (UnparseC.term t', UnparseC.terms asm) =
28.326 ("(7 * x \<up> 3 + - 1 * x \<up> 2 * y) /\n(7 * x * y \<up> 2 + - 1 * y \<up> 3)", "[]")
28.327 then () else error "rational.sml make_polynomial Schalk WN050929 not working";
28.328
28.329 "-------- example 193a";
28.330 -val t = TermC.str2term "( x \<up> 2 + -6 * x + 9 ) / ( x \<up> 2 + -9 )";
28.331 +val t = TermC.parse_test @{context} "( x \<up> 2 + -6 * x + 9 ) / ( x \<up> 2 + -9 )";
28.332 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
28.333 if (UnparseC.term t', UnparseC.terms asm) = ("(- 3 + x) / (3 + x)", "[\"3 + x \<noteq> 0\"]")
28.334 then () else error "rational.sml cancel_p Schalk 193a";
28.335
28.336 "-------- example 193b";
28.337 -val t = TermC.str2term "( x \<up> 2 + -8 * x + 16 ) / ( 2 * x \<up> 2 + -32 )";
28.338 +val t = TermC.parse_test @{context} "( x \<up> 2 + -8 * x + 16 ) / ( 2 * x \<up> 2 + -32 )";
28.339 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
28.340 if (UnparseC.term t', UnparseC.terms asm) = ("(- 4 + x) / (8 + 2 * x)", "[\"8 + 2 * x \<noteq> 0\"]")
28.341 then () else error "rational.sml cancel_p Schalk 193b";
28.342
28.343 "-------- example 193c";
28.344 -val t = TermC.str2term "( 2 * x + -50 * x \<up> 3 ) / ( 25 * x \<up> 2 + - 10 * x + 1 )";
28.345 +val t = TermC.parse_test @{context} "( 2 * x + -50 * x \<up> 3 ) / ( 25 * x \<up> 2 + - 10 * x + 1 )";
28.346 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
28.347 if (UnparseC.term t', UnparseC.terms asm) =
28.348 ("(2 * x + 10 * x \<up> 2) / (1 + - 5 * x)", "[\"1 + - 5 * x \<noteq> 0\"]")
28.349 then () else error "rational.sml cancel_p Schalk 193c";
28.350
28.351 (*WN: improved with new numerals*)
28.352 -val t = TermC.str2term "(- 25 + 9*x \<up> 2)/(5 + 3*x)";
28.353 +val t = TermC.parse_test @{context} "(- 25 + 9*x \<up> 2)/(5 + 3*x)";
28.354 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
28.355 if (UnparseC.term t', UnparseC.terms asm) = ("(- 5 + 3 * x) / 1", "[]")
28.356 then () else error "rational.sml cancel WN 1";
28.357
28.358 "-------- example heuberger";
28.359 -val t = TermC.str2term ("(x \<up> 4 + x * y + x \<up> 3 * y + y \<up> 2) / " ^
28.360 +val t = TermC.parse_test @{context} ("(x \<up> 4 + x * y + x \<up> 3 * y + y \<up> 2) / " ^
28.361 "(x + 5 * x \<up> 2 + y + 5 * x * y + x \<up> 2 * y \<up> 3 + x * y \<up> 4)");
28.362 val SOME (t', asm) = rewrite_set_ ctxt false cancel_p t;
28.363 if (UnparseC.term t', UnparseC.terms asm) =
28.364 @@ -636,7 +636,7 @@
28.365 "-------- integration lev.1 -- lev.5: cancel_p_ & add_fractions_p_ -----------";
28.366 "-------- integration lev.1 -- lev.5: cancel_p_ & add_fractions_p_ -----------";
28.367 "-------- integration lev.1 -- lev.5: cancel_p_ & add_fractions_p_ -----------";
28.368 -val t = TermC.str2term ("123 = (a*x)/(b*x) + (c*x)/(d*x) + (e*x)/(f*x::real)");
28.369 +val t = TermC.parse_test @{context} ("123 = (a*x)/(b*x) + (c*x)/(d*x) + (e*x)/(f*x::real)");
28.370 "-------- gcd_poly integration level 1: works on exact term";
28.371 if NONE = cancel_p_ thy t then () else error "cancel_p_ works on exact fraction";
28.372 if NONE = add_fraction_p_ thy t then () else error "add_fraction_p_ works on exact fraction";
28.373 @@ -701,7 +701,7 @@
28.374 "-------- reverse rewrite ----------------------------------------------------";
28.375 "-------- reverse rewrite ----------------------------------------------------";
28.376 (** the term for which reverse rewriting is demonstrated **)
28.377 -val t = TermC.str2term "(9 + - 1 * x \<up> 2) / (9 + 6 * x + x \<up> 2)";
28.378 +val t = TermC.parse_test @{context} "(9 + - 1 * x \<up> 2) / (9 + 6 * x + x \<up> 2)";
28.379 val Rrls {scr = Rfuns {init_state = ini, locate_rule = loc,
28.380 next_rule = nex, normal_form = nor, ...},...} = cancel_p;
28.381
28.382 @@ -807,7 +807,7 @@
28.383 special cases.*)
28.384
28.385 (*the term for which reverse rewriting is demonstrated*)
28.386 -val t = TermC.str2term "(9 + (- 1)*x \<up> 2) / (9 + ((-6)*x + x \<up> 2))";
28.387 +val t = TermC.parse_test @{context} "(9 + (- 1)*x \<up> 2) / (9 + ((-6)*x + x \<up> 2))";
28.388 val Rrls {scr=Rfuns {init_state=ini,locate_rule=loc,
28.389 next_rule=nex,normal_form=nor,...},...} = cancel_p;
28.390
28.391 @@ -846,46 +846,46 @@
28.392 "-------- examples: rls norm_Rational ----------------------------------------";
28.393 "-------- examples: rls norm_Rational ----------------------------------------";
28.394 "-------- examples: rls norm_Rational ----------------------------------------";
28.395 -val t = TermC.str2term "Not (6*x is_atom)";
28.396 +val t = TermC.parse_test @{context} "Not (6*x is_atom)";
28.397 val SOME (t',_) = rewrite_set_ ctxt false powers_erls t; UnparseC.term t';
28.398 "HOL.True";
28.399 -val t = TermC.str2term "1 < 2";
28.400 +val t = TermC.parse_test @{context} "1 < 2";
28.401 val SOME (t',_) = rewrite_set_ ctxt false powers_erls t; UnparseC.term t';
28.402 "HOL.True";
28.403
28.404 -val t = TermC.str2term "(6*x) \<up> 2";
28.405 +val t = TermC.parse_test @{context} "(6*x) \<up> 2";
28.406 val SOME (t',_) = rewrite_ ctxt Rewrite_Ord.function_empty powers_erls false @{thm realpow_def_atom} t;
28.407 if UnparseC.term t' = "6 * x * (6 * x) \<up> (2 + - 1)" then ()
28.408 else error "rational.sml powers_erls (6*x) \<up> 2";
28.409
28.410 -val t = TermC.str2term "- 1 * (- 2 * (5 / 2 * (13 * x / 2)))";
28.411 +val t = TermC.parse_test @{context} "- 1 * (- 2 * (5 / 2 * (13 * x / 2)))";
28.412 val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term t';
28.413 if UnparseC.term t' = "65 * x / 2" then () else error "rational.sml 4";
28.414
28.415 -val t = TermC.str2term "1 - ((13*x)/2 - 5/2) \<up> 2";
28.416 +val t = TermC.parse_test @{context} "1 - ((13*x)/2 - 5/2) \<up> 2";
28.417 val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term t';
28.418 if UnparseC.term t' = "(- 21 + 130 * x + - 169 * x \<up> 2) / 4" then ()
28.419 else error "rational.sml 5";
28.420
28.421 (*SRAM Schalk I, p.92 Nr. 609a*)
28.422 -val t = TermC.str2term "2*(3 - x/5)/3 - 4*(1 - x/3) - x/3 - 2*(x/2 - 1/4)/27 +5/54";
28.423 +val t = TermC.parse_test @{context} "2*(3 - x/5)/3 - 4*(1 - x/3) - x/3 - 2*(x/2 - 1/4)/27 +5/54";
28.424 val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term t';
28.425 if UnparseC.term t' = "(- 255 + 112 * x) / 135" then ()
28.426 else error "rational.sml 6";
28.427
28.428 (*SRAM Schalk I, p.92 Nr. 610c*)
28.429 -val t = TermC.str2term "((x- 1)/(x+1) + 1) / ((x- 1)/(x+1) - (x+1)/(x- 1)) - 2";
28.430 +val t = TermC.parse_test @{context} "((x- 1)/(x+1) + 1) / ((x- 1)/(x+1) - (x+1)/(x- 1)) - 2";
28.431 val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term t';
28.432 if UnparseC.term t' = "(3 + x) / - 2" then () else error "rational.sml 7";
28.433
28.434 (*SRAM Schalk I, p.92 Nr. 476a*)
28.435 -val t = TermC.str2term "(x \<up> 2/(1 - x \<up> 2) + 1)/(x/(1 - x) + 1) * (1 + x)";
28.436 +val t = TermC.parse_test @{context} "(x \<up> 2/(1 - x \<up> 2) + 1)/(x/(1 - x) + 1) * (1 + x)";
28.437 (*. a/b : c/d translated to a/b * d/c .*)
28.438 val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term t';
28.439 if UnparseC.term t' = "1" then () else error "rational.sml 8";
28.440
28.441 (*Schalk I, p.92 Nr. 472a*)
28.442 -val t = TermC.str2term "((8*x \<up> 2 - 32*y \<up> 2)/(2*x + 4*y))/((4*x - 8*y)/(x + y))";
28.443 +val t = TermC.parse_test @{context} "((8*x \<up> 2 - 32*y \<up> 2)/(2*x + 4*y))/((4*x - 8*y)/(x + y))";
28.444 val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term t';
28.445 if UnparseC.term t' = "x + y" then () else error "rational.sml p.92 Nr. 472a";
28.446
28.447 @@ -893,11 +893,11 @@
28.448
28.449 (*WN130910 add_fractions_p exception Div raised + history:
28.450 ### WN.2.6.03 from rlang.sml 56a
28.451 -val t = TermC.str2term "(a + b * x) / (a + - 1 * (b * x)) + (- 1 * a + b * x) / (a + b * x) = 4 * (a * b) / (a \<up> 2 + - 1 * b \<up> 2)";
28.452 +val t = TermC.parse_test @{context} "(a + b * x) / (a + - 1 * (b * x)) + (- 1 * a + b * x) / (a + b * x) = 4 * (a * b) / (a \<up> 2 + - 1 * b \<up> 2)";
28.453 val NONE = rewrite_set_ ctxt false add_fractions_p t;
28.454
28.455 THE ERROR ALREADY OCCURS IN THIS PART:
28.456 -val t = TermC.str2term "(a + b * x) / (a + - 1 * (b * x)) + (- 1 * a + b * x) / (a + b * x)";
28.457 +val t = TermC.parse_test @{context} "(a + b * x) / (a + - 1 * (b * x)) + (- 1 * a + b * x) / (a + b * x)";
28.458 val NONE = add_fraction_p_ ctxt t;
28.459
28.460 SEE Test_Some.thy: section {* add_fractions_p downto exception Div raised ===
28.461 @@ -907,13 +907,13 @@
28.462 "-------- rational numerals --------------------------------------------------";
28.463 "-------- rational numerals --------------------------------------------------";
28.464 (*SRA Schalk I, p.40 Nr. 164b *)
28.465 -val t = TermC.str2term "(47/6 - 76/9 + 13/4)/(35/12)";
28.466 +val t = TermC.parse_test @{context} "(47/6 - 76/9 + 13/4)/(35/12)";
28.467 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.468 if UnparseC.term t = "19 / 21" then ()
28.469 else error "rational.sml: diff.behav. in norm_Rational_mg 1";
28.470
28.471 (*SRA Schalk I, p.40 Nr. 166a *)
28.472 -val t = TermC.str2term "((5/4)/(4+22/7) + 37/20)*(110/3 - 110/9 * 23/11)";
28.473 +val t = TermC.parse_test @{context} "((5/4)/(4+22/7) + 37/20)*(110/3 - 110/9 * 23/11)";
28.474 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.475 if UnparseC.term t = "45 / 2" then ()
28.476 else error "rational.sml: diff.behav. in norm_Rational_mg 2";
28.477 @@ -922,55 +922,55 @@
28.478 "-------- examples cancellation from: Mathematik 1 Schalk --------------------";
28.479 "-------- examples cancellation from: Mathematik 1 Schalk --------------------";
28.480 (* e190c Stefan K.*)
28.481 -val t = TermC.str2term "((1 + 9*a \<up> 2) * (1 + 3*a)) / ((3*a + 9*a \<up> 2) * (1 + 3*a))";
28.482 +val t = TermC.parse_test @{context} "((1 + 9*a \<up> 2) * (1 + 3*a)) / ((3*a + 9*a \<up> 2) * (1 + 3*a))";
28.483 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.484 if UnparseC.term t = "(1 + 9 * a \<up> 2) / (3 * a + 9 * a \<up> 2)"
28.485 then () else error "rational.sml: diff.behav. in norm_Rational_mg 3";
28.486
28.487 (* e192b Stefan K.*)
28.488 -val t = TermC.str2term "(x \<up> 2 * (7*x + (- 1)*y)) / (y \<up> 2 * (7*x + (- 1)*y))";
28.489 +val t = TermC.parse_test @{context} "(x \<up> 2 * (7*x + (- 1)*y)) / (y \<up> 2 * (7*x + (- 1)*y))";
28.490 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.491 if UnparseC.term t = "x \<up> 2 / y \<up> 2"
28.492 then () else error "rational.sml: diff.behav. in norm_Rational_mg 4";
28.493
28.494 (*SRC Schalk I, p.66 Nr. 379c *)
28.495 -val t = TermC.str2term "(a - b)/(b - a)";
28.496 +val t = TermC.parse_test @{context} "(a - b)/(b - a)";
28.497 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.498 if UnparseC.term t = "- 1"
28.499 then () else error "rational.sml: diff.behav. in norm_Rational_mg 5";
28.500
28.501 (*SRC Schalk I, p.66 Nr. 380b *)
28.502 -val t = TermC.str2term "15*(3*x + 3) * (4*x + 9) / (12*(2*x + 7) * (5*x + 5))";
28.503 +val t = TermC.parse_test @{context} "15*(3*x + 3) * (4*x + 9) / (12*(2*x + 7) * (5*x + 5))";
28.504 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.505 if UnparseC.term t = "(27 + 12 * x) / (28 + 8 * x)"
28.506 then () else error "rational.sml: diff.behav. in norm_Rational_mg 6";
28.507
28.508 (* e190c Stefan K.*)
28.509 -val t = TermC.str2term "((1 + 9*a \<up> 2) * (1 + 3*a)) / ((3*a + 9*a \<up> 2) * (1 + 3 * a))";
28.510 +val t = TermC.parse_test @{context} "((1 + 9*a \<up> 2) * (1 + 3*a)) / ((3*a + 9*a \<up> 2) * (1 + 3 * a))";
28.511 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.512 if UnparseC.term t = "(1 + 9 * a \<up> 2) / (3 * a + 9 * a \<up> 2)"
28.513 then () else error "rational.sml: diff.behav. in norm_Rational_mg 3";
28.514
28.515 (* e192b Stefan K.*)
28.516 -val t = TermC.str2term "(x \<up> 2 * (7*x + (- 1)*y)) / (y \<up> 2 * (7*x + (- 1)*y))";
28.517 +val t = TermC.parse_test @{context} "(x \<up> 2 * (7*x + (- 1)*y)) / (y \<up> 2 * (7*x + (- 1)*y))";
28.518 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.519 if UnparseC.term t = "x \<up> 2 / y \<up> 2"
28.520 then () else error "rational.sml: diff.behav. in norm_Rational_mg 4";
28.521
28.522 (*SRC Schalk I, p.66 Nr. 379c *)
28.523 -val t = TermC.str2term "(a - b) / (b - a)";
28.524 +val t = TermC.parse_test @{context} "(a - b) / (b - a)";
28.525 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.526 if UnparseC.term t = "- 1"
28.527 then () else error "rational.sml: diff.behav. in norm_Rational_mg 5";
28.528
28.529 (*SRC Schalk I, p.66 Nr. 380b *)
28.530 -val t = TermC.str2term "15*(3*x + 3) * (4*x + 9) / (12*(2*x + 7) * (5*x + 5))";
28.531 +val t = TermC.parse_test @{context} "15*(3*x + 3) * (4*x + 9) / (12*(2*x + 7) * (5*x + 5))";
28.532 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.533 if UnparseC.term t = "(27 + 12 * x) / (28 + 8 * x)"
28.534 then () else error "rational.sml: diff.behav. in norm_Rational_mg 6";
28.535
28.536 (* extreme example from somewhere *)
28.537 -val t = TermC.str2term
28.538 +val t = TermC.parse_test @{context}
28.539 ("(a \<up> 4 * x + - 1*a \<up> 4 * y + 4*a \<up> 3 * b * x + -4*a \<up> 3 * b * y + " ^
28.540 "6*a \<up> 2 * b \<up> 2 * x + -6*a \<up> 2 * b \<up> 2 * y + 4*a * b \<up> 3 * x + -4*a * b \<up> 3 * y + " ^
28.541 "b \<up> 4 * x + - 1*b \<up> 4 * y) " ^
28.542 @@ -983,33 +983,33 @@
28.543
28.544 (*Schalk I, p.66 Nr. 381a *)
28.545 (* ATTENTION: here the rls is very slow. In Isabelle2002 this required 2 min *)
28.546 -val t = TermC.str2term "18*(a + b) \<up> 3 * (a - b) \<up> 2 / (72*(a - b) \<up> 3 * (a + b) \<up> 2)";
28.547 +val t = TermC.parse_test @{context} "18*(a + b) \<up> 3 * (a - b) \<up> 2 / (72*(a - b) \<up> 3 * (a + b) \<up> 2)";
28.548 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.549 if UnparseC.term t = "(a + b) / (4 * a + - 4 * b)"
28.550 then () else error "rational.sml: diff.behav. in norm_Rational_mg 8";
28.551
28.552 (*SRC Schalk I, p.66 Nr. 381b *)
28.553 -val t = TermC.str2term "(4*x \<up> 2 - 20*x + 25) / (2*x - 5) \<up> 3";
28.554 +val t = TermC.parse_test @{context} "(4*x \<up> 2 - 20*x + 25) / (2*x - 5) \<up> 3";
28.555 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.556 if UnparseC.term t = "1 / (- 5 + 2 * x)"
28.557 then () else error "rational.sml: diff.behav. in norm_Rational_mg 9";
28.558
28.559 (*SRC Schalk I, p.66 Nr. 381c *)
28.560 -val t = TermC.str2term "(27*a \<up> 3 + 9*a \<up> 2+3*a+1) / (27*a \<up> 3 + 18*a \<up> 2+3*a)";
28.561 +val t = TermC.parse_test @{context} "(27*a \<up> 3 + 9*a \<up> 2+3*a+1) / (27*a \<up> 3 + 18*a \<up> 2+3*a)";
28.562 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.563 if UnparseC.term t = "(1 + 9 * a \<up> 2) / (3 * a + 9 * a \<up> 2)"
28.564 then () else error "rational.sml: diff.behav. in norm_Rational_mg 10";
28.565
28.566 (*SRC Schalk I, p.66 Nr. 383a *)
28.567 -val t = TermC.str2term "(5*a \<up> 2 - 5*a*b) / (a - b) \<up> 2";
28.568 +val t = TermC.parse_test @{context} "(5*a \<up> 2 - 5*a*b) / (a - b) \<up> 2";
28.569 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.570 if UnparseC.term t = "- 5 * a / (- 1 * a + b)"
28.571 then () else error "rational.sml: diff.behav. in norm_Rational_mg 11";
28.572
28.573 "----- NOT TERMINATING ?: worked before 0707xx";
28.574 -val t = TermC.str2term "(a \<up> 2 - 1)*(b + 1) / ((b \<up> 2 - 1)*(a+1))";
28.575 +val t = TermC.parse_test @{context} "(a \<up> 2 - 1)*(b + 1) / ((b \<up> 2 - 1)*(a+1))";
28.576 (* WN130911 "exception Div raised" by
28.577 - cancel_p_ thy (TermC.str2term ("(- 1 + - 1 * b + a \<up> 2 + a \<up> 2 * b) /" ^
28.578 + cancel_p_ thy (TermC.parse_test @{context} ("(- 1 + - 1 * b + a \<up> 2 + a \<up> 2 * b) /" ^
28.579 "(- 1 + - 1 * a + b \<up> 2 + a * b \<up> 2)"))
28.580
28.581 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.582 @@ -1021,20 +1021,20 @@
28.583 "-------- examples common denominator from: Mathematik 1 Schalk --------------";
28.584 "-------- examples common denominator from: Mathematik 1 Schalk --------------";
28.585 (*SRA Schalk I, p.67 Nr. 403a *)
28.586 -val t = TermC.str2term "4/x - 3/y - 1";
28.587 +val t = TermC.parse_test @{context} "4/x - 3/y - 1";
28.588 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.589 if UnparseC.term t = "(- 3 * x + 4 * y + - 1 * x * y) / (x * y)"
28.590 then () else error "rational.sml: diff.behav. in norm_Rational_mg 12";
28.591
28.592 -val t = TermC.str2term "(2*a+3*b)/(b*c) + (3*c+a)/(a*c) - (2*a \<up> 2+3*b*c)/(a*b*c)";
28.593 +val t = TermC.parse_test @{context} "(2*a+3*b)/(b*c) + (3*c+a)/(a*c) - (2*a \<up> 2+3*b*c)/(a*b*c)";
28.594 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.595 if UnparseC.term t = "4 / c"
28.596 then () else error "rational.sml: diff.behav. in norm_Rational_mg 13";
28.597
28.598 (*SRA Schalk I, p.67 Nr. 410b *)
28.599 -val t = TermC.str2term "1/(x+1) + 1/(x+2) - 2/(x+3)";
28.600 +val t = TermC.parse_test @{context} "1/(x+1) + 1/(x+2) - 2/(x+3)";
28.601 (* WN130911 non-termination due to non-termination of
28.602 - cancel_p_ thy (TermC.str2term "(5 + 3 * x) / (6 + 11 * x + 6 * x \<up> 2 + x \<up> 3)")
28.603 + cancel_p_ thy (TermC.parse_test @{context} "(5 + 3 * x) / (6 + 11 * x + 6 * x \<up> 2 + x \<up> 3)")
28.604
28.605 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.606 if UnparseC.term t = "(5 + 3 * x) / (6 + 11 * x + 6 * x \<up> 2 + x \<up> 3)"
28.607 @@ -1042,22 +1042,22 @@
28.608 *)
28.609
28.610 (*SRA Schalk I, p.67 Nr. 413b *)
28.611 -val t = TermC.str2term "(1 + x)/(1 - x) - (1 - x)/(1 + x) + 2*x/(1 - x \<up> 2)";
28.612 +val t = TermC.parse_test @{context} "(1 + x)/(1 - x) - (1 - x)/(1 + x) + 2*x/(1 - x \<up> 2)";
28.613 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.614 if UnparseC.term t = "6 * x / (1 + - 1 * x \<up> 2)"
28.615 then () else error "rational.sml: diff.behav. in norm_Rational_mg 15";
28.616
28.617 (*SRA Schalk I, p.68 Nr. 414a *)
28.618 -val t = TermC.str2term "(x + 2)/(x - 1) + (x - 3)/(x - 2) - (x + 1)/((x - 1)*(x - 2))";
28.619 +val t = TermC.parse_test @{context} "(x + 2)/(x - 1) + (x - 3)/(x - 2) - (x + 1)/((x - 1)*(x - 2))";
28.620 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.621 if UnparseC.term t ="(- 2 + - 5 * x + 2 * x \<up> 2) / (2 + - 3 * x + x \<up> 2)"
28.622 then () else error "rational.sml: diff.behav. in norm_Rational_mg 16";
28.623
28.624 (*SRA Schalk I, p.68 Nr. 428b *)
28.625 -val t = TermC.str2term
28.626 +val t = TermC.parse_test @{context}
28.627 "1/(a - b) \<up> 2 + 1/(a + b) \<up> 2 - 2/(a \<up> 2 - b \<up> 2) - 4*(b \<up> 2 - 1)/(a \<up> 2 - b \<up> 2) \<up> 2";
28.628 (* WN130911 non-termination due to non-termination of
28.629 - cancel_p_ thy (TermC.str2term "(4 + -4 * b \<up> 2) / (a \<up> 4 + - 2 * (a \<up> 2 * b \<up> 2) + b \<up> 4)")
28.630 + cancel_p_ thy (TermC.parse_test @{context} "(4 + -4 * b \<up> 2) / (a \<up> 4 + - 2 * (a \<up> 2 * b \<up> 2) + b \<up> 4)")
28.631
28.632 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.633 if UnparseC.term t = "4 / (a \<up> 4 + - 2 * a \<up> 2 * b \<up> 2 + b \<up> 4)"
28.634 @@ -1065,14 +1065,14 @@
28.635 *)
28.636
28.637 (*SRA Schalk I, p.68 Nr. 430b *)
28.638 -val t = TermC.str2term
28.639 +val t = TermC.parse_test @{context}
28.640 "a \<up> 2/(a - 3*b) - 108*a*b \<up> 3/((a+3*b)*(a \<up> 2 - 9*b \<up> 2)) - 9*b \<up> 2*(a - 3*b)/(a+3*b) \<up> 2";
28.641 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.642 if UnparseC.term t = "a + 3 * b"
28.643 then () else error "rational.sml: diff.behav. in norm_Rational_mg 19";
28.644
28.645 (*SRA Schalk I, p.68 Nr. 432 *)
28.646 -val t = TermC.str2term
28.647 +val t = TermC.parse_test @{context}
28.648 ("(a \<up> 2 + a*b) / (a \<up> 2 - b \<up> 2) - (b \<up> 2 - a*b) / (b \<up> 2 - a \<up> 2) + " ^
28.649 "a \<up> 2*(a - b) / (a \<up> 3 - a \<up> 2*b) - 2*a*(a \<up> 2 - b \<up> 2) / (a \<up> 3 - a*b \<up> 2) - " ^
28.650 "2*b \<up> 2 / (a \<up> 2 - b \<up> 2)");
28.651 @@ -1081,7 +1081,7 @@
28.652 then () else error "rational.sml: diff.behav. in norm_Rational_mg 20";
28.653
28.654 (* some example *)
28.655 -val t = TermC.str2term "3*a / (a*b) + x/y";
28.656 +val t = TermC.parse_test @{context} "3*a / (a*b) + x/y";
28.657 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.658 if UnparseC.term t = "(3 * y + b * x) / (b * y)"
28.659 then () else error "rational.sml: diff.behav. in norm_Rational_mg 21";
28.660 @@ -1091,19 +1091,19 @@
28.661 "-------- examples multiply and cancel from: Mathematik 1 Schalk -------------";
28.662 "-------- examples multiply and cancel from: Mathematik 1 Schalk -------------";
28.663 (*------- SRM Schalk I, p.68 Nr. 436a *)
28.664 -val t = TermC.str2term "3*(x+y) / (15*(x - y)) * 25*(x - y) \<up> 2 / (18*(x + y) \<up> 2)";
28.665 +val t = TermC.parse_test @{context} "3*(x+y) / (15*(x - y)) * 25*(x - y) \<up> 2 / (18*(x + y) \<up> 2)";
28.666 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.667 if UnparseC.term t = "(- 5 * x + 5 * y) / (- 18 * x + - 18 * y)"
28.668 then () else error "rational.sml: diff.behav. in norm_Rational_mg 22";
28.669
28.670 (*------- SRM.test Schalk I, p.68 Nr. 436b *)
28.671 -val t = TermC.str2term "5*a*(a - b) \<up> 2*(a + b) \<up> 3/(7*b*(a - b) \<up> 3) * 7*b/(a + b) \<up> 3";
28.672 +val t = TermC.parse_test @{context} "5*a*(a - b) \<up> 2*(a + b) \<up> 3/(7*b*(a - b) \<up> 3) * 7*b/(a + b) \<up> 3";
28.673 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.674 if UnparseC.term t = "5 * a / (a + - 1 * b)"
28.675 then () else error "rational.sml: diff.behav. in norm_Rational_mg 23";
28.676
28.677 (*------- Schalk I, p.68 Nr. 437a *)
28.678 -val t = TermC.str2term "(3*a - 4*b) / (4*c+3*e) * (3*a+4*b)/(9*a \<up> 2 - 16*b \<up> 2)";
28.679 +val t = TermC.parse_test @{context} "(3*a - 4*b) / (4*c+3*e) * (3*a+4*b)/(9*a \<up> 2 - 16*b \<up> 2)";
28.680 (* raises an exception for unclear reasons:
28.681 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.682 :
28.683 @@ -1112,7 +1112,7 @@
28.684 exception Div raised
28.685
28.686 BUT
28.687 -val t = TermC.str2term
28.688 +val t = TermC.parse_test @{context}
28.689 ("(9 * a \<up> 2 + - 16 * b \<up> 2) / (4 * c + 3 * e) /" ^
28.690 "(9 * a \<up> 2 + - 16 * b \<up> 2)");
28.691 NONE = cancel_p_ thy t;
28.692 @@ -1122,14 +1122,14 @@
28.693 *)
28.694
28.695 "----- S.K. corrected non-termination 060904";
28.696 -val t = TermC.str2term "(3*a - 4*b) * (3*a+4*b)/((4*c+3*e)*(9*a \<up> 2 - 16*b \<up> 2))";
28.697 +val t = TermC.parse_test @{context} "(3*a - 4*b) * (3*a+4*b)/((4*c+3*e)*(9*a \<up> 2 - 16*b \<up> 2))";
28.698 val SOME (t, _) = rewrite_set_ ctxt false make_polynomial t;
28.699 if UnparseC.term t =
28.700 "(9 * a \<up> 2 + - 16 * b \<up> 2) /\n(36 * a \<up> 2 * c + 27 * a \<up> 2 * e + - 64 * b \<up> 2 * c +\n - 48 * b \<up> 2 * e)"
28.701 then () else error "rational.sml: S.K.8..corrected 060904-6";
28.702
28.703 "----- S.K. corrected non-termination of cancel_p_";
28.704 -val t'' = TermC.str2term ("(9 * a \<up> 2 + - 16 * b \<up> 2) /" ^
28.705 +val t'' = TermC.parse_test @{context} ("(9 * a \<up> 2 + - 16 * b \<up> 2) /" ^
28.706 "(36 * a \<up> 2 * c + (27 * a \<up> 2 * e + (-64 * b \<up> 2 * c + -48 * b \<up> 2 * e)))");
28.707 (* /--- DOES NOT TERMINATE AT TRANSITION isabisac15 --> Isabelle2017 --------------------------\
28.708 val SOME (t',_) = rewrite_set_ ctxt false cancel_p t'';
28.709 @@ -1138,7 +1138,7 @@
28.710 \--- DOES NOT TERMINATE AT TRANSITION isabisac15 --> Isabelle2017 --------------------------/*)
28.711
28.712 (*------- Schalk I, p.68 Nr. 437b*)
28.713 -val t = TermC.str2term "(a + b)/(x \<up> 2 - y \<up> 2) * ((x - y) \<up> 2/(a \<up> 2 - b \<up> 2))";
28.714 +val t = TermC.parse_test @{context} "(a + b)/(x \<up> 2 - y \<up> 2) * ((x - y) \<up> 2/(a \<up> 2 - b \<up> 2))";
28.715 (*val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.716 :
28.717 #### rls: cancel_p on: (a * x \<up> 2 + - 2 * (a * (x * y)) + a * y \<up> 2 + b * x \<up> 2 +
28.718 @@ -1150,25 +1150,25 @@
28.719 *)
28.720
28.721 (*------- SRM Schalk I, p.68 Nr. 438a *)
28.722 -val t = TermC.str2term "x*y / (x*y - y \<up> 2) * (x \<up> 2 - x*y)";
28.723 +val t = TermC.parse_test @{context} "x*y / (x*y - y \<up> 2) * (x \<up> 2 - x*y)";
28.724 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.725 if UnparseC.term t = "x \<up> 2"
28.726 then () else error "rational.sml: diff.behav. in norm_Rational_mg 24";
28.727
28.728 (*------- SRM Schalk I, p.68 Nr. 439b *)
28.729 -val t = TermC.str2term "(4*x \<up> 2 + 4*x + 1) * ((x \<up> 2 - 2*x \<up> 3) / (4*x \<up> 2 + 2*x))";
28.730 +val t = TermC.parse_test @{context} "(4*x \<up> 2 + 4*x + 1) * ((x \<up> 2 - 2*x \<up> 3) / (4*x \<up> 2 + 2*x))";
28.731 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.732 if UnparseC.term t = "(x + - 4 * x \<up> 3) / 2"
28.733 then () else error "rational.sml: diff.behav. in norm_Rational_mg 25";
28.734
28.735 (*------- SRM Schalk I, p.68 Nr. 440a *)
28.736 -val t = TermC.str2term "(x \<up> 2 - 2*x) / (x \<up> 2 - 3*x) * (x - 3) \<up> 2 / (x \<up> 2 - 4)";
28.737 +val t = TermC.parse_test @{context} "(x \<up> 2 - 2*x) / (x \<up> 2 - 3*x) * (x - 3) \<up> 2 / (x \<up> 2 - 4)";
28.738 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.739 if UnparseC.term t = "(- 3 + x) / (2 + x)"
28.740 then () else error "rational.sml: diff.behav. in norm_Rational_mg 26";
28.741
28.742 "----- Schalk I, p.68 Nr. 440b SK11 works since 0707xx";
28.743 -val t = TermC.str2term "(a \<up> 3 - 9*a) / (a \<up> 3*b - a*b \<up> 3) * (a \<up> 2*b + a*b \<up> 2) / (a+3)";
28.744 +val t = TermC.parse_test @{context} "(a \<up> 3 - 9*a) / (a \<up> 3*b - a*b \<up> 3) * (a \<up> 2*b + a*b \<up> 2) / (a+3)";
28.745 (* WN130911 non-termination for unclear reasons:
28.746 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.747
28.748 @@ -1179,7 +1179,7 @@
28.749 (a \<up> 3 * b + - 1 * (a * b \<up> 3)) /
28.750 (3 + a)
28.751 BUT THIS IS CORRECTLY RECOGNISED
28.752 -val t = TermC.str2term
28.753 +val t = TermC.parse_test @{context}
28.754 ("(-9 * (a \<up> 3 * b) + -9 * (a \<up> 2 * b \<up> 2) + a \<up> 5 * b + a \<up> 4 * b \<up> 2) /" ^
28.755 "(a \<up> 3 * b + - 1 * (a * b \<up> 3)) / (3 + (a::real))");
28.756 AS
28.757 @@ -1190,9 +1190,9 @@
28.758 *)
28.759
28.760 "----- SK12 works since 0707xx";
28.761 -val t = TermC.str2term "(a \<up> 3 - 9*a) * (a \<up> 2*b+a*b \<up> 2) / ((a \<up> 3*b - a*b \<up> 3) * (a+3))";
28.762 +val t = TermC.parse_test @{context} "(a \<up> 3 - 9*a) * (a \<up> 2*b+a*b \<up> 2) / ((a \<up> 3*b - a*b \<up> 3) * (a+3))";
28.763 (* WN130911 non-termination due to non-termination of
28.764 - cancel_p_ thy (TermC.str2term "(4 + -4 * b \<up> 2) / (a \<up> 4 + - 2 * (a \<up> 2 * b \<up> 2) + b \<up> 4)")
28.765 + cancel_p_ thy (TermC.parse_test @{context} "(4 + -4 * b \<up> 2) / (a \<up> 4 + - 2 * (a \<up> 2 * b \<up> 2) + b \<up> 4)")
28.766
28.767 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.768 if UnparseC.term t' = "(-3 * a + a \<up> 2) / (a + - 1 * b)" then ()
28.769 @@ -1203,53 +1203,53 @@
28.770 "-------- examples common denominator and multiplication from: Schalk --------";
28.771 "-------- examples common denominator and multiplication from: Schalk --------";
28.772 (*------- SRAM Schalk I, p.69 Nr. 441b *)
28.773 -val t = TermC.str2term "(4*a/3 + 3*b \<up> 2/a \<up> 3 + b/(4*a))*(4*b/(3*a))";
28.774 +val t = TermC.parse_test @{context} "(4*a/3 + 3*b \<up> 2/a \<up> 3 + b/(4*a))*(4*b/(3*a))";
28.775 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.776 if UnparseC.term t = "(36 * b \<up> 3 + 3 * a \<up> 2 * b \<up> 2 + 16 * a \<up> 4 * b) /\n(9 * a \<up> 4)"
28.777 then () else error "rational.sml: diff.behav. in norm_Rational_mg 28";
28.778
28.779 (*------- SRAM Schalk I, p.69 Nr. 442b *)
28.780 -val t = TermC.str2term ("(15*a \<up> 2/x \<up> 3 - 5*b \<up> 4/x \<up> 2 + 25*c \<up> 2/x) * " ^
28.781 +val t = TermC.parse_test @{context} ("(15*a \<up> 2/x \<up> 3 - 5*b \<up> 4/x \<up> 2 + 25*c \<up> 2/x) * " ^
28.782 "(x \<up> 3/(5*a*b \<up> 3*c \<up> 3)) + 1/c \<up> 3 * (b*x/a - 3*a/b \<up> 3)");
28.783 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.784 if UnparseC.term t = "5 * x \<up> 2 / (a * b \<up> 3 * c)"
28.785 then () else error "rational.sml: diff.behav. in norm_Rational_mg 29";
28.786
28.787 (*------- SRAM Schalk I, p.69 Nr. 443b *)
28.788 -val t = TermC.str2term "(a/2 + b/3) * (b/3 - a/2)";
28.789 +val t = TermC.parse_test @{context} "(a/2 + b/3) * (b/3 - a/2)";
28.790 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.791 if UnparseC.term t = "(- 9 * a \<up> 2 + 4 * b \<up> 2) / 36"
28.792 then () else error "rational.sml: diff.behav. in norm_Rational_mg 30";
28.793
28.794 (*------- SRAM Schalk I, p.69 Nr. 445b *)
28.795 -val t = TermC.str2term "(a \<up> 2/9 + 2*a/(3*b) + 4/b \<up> 2)*(a/3 - 2/b) + 8/b \<up> 3";
28.796 +val t = TermC.parse_test @{context} "(a \<up> 2/9 + 2*a/(3*b) + 4/b \<up> 2)*(a/3 - 2/b) + 8/b \<up> 3";
28.797 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.798 if UnparseC.term t = "a \<up> 3 / 27"
28.799 then () else error "rational.sml: diff.behav. in norm_Rational_mg 31";
28.800
28.801 (*------- SRAM Schalk I, p.69 Nr. 446b *)
28.802 -val t = TermC.str2term "(x/(5*x + 4*y) - y/(5*x - 4*y) + 1)*(25*x \<up> 2 - 16*y \<up> 2)";
28.803 +val t = TermC.parse_test @{context} "(x/(5*x + 4*y) - y/(5*x - 4*y) + 1)*(25*x \<up> 2 - 16*y \<up> 2)";
28.804 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.805 if UnparseC.term t = (*"30 * x \<up> 2 + -9 * x * y + - 20 * y \<up> 2" ..isabisac15 | Isabelle2017..*)
28.806 "(- 30 * x \<up> 2 + 9 * x * y + 20 * y \<up> 2) / - 1"
28.807 then () else error "rational.sml: diff.behav. in norm_Rational_mg 32";
28.808
28.809 (*------- SRAM Schalk I, p.69 Nr. 449a *)(*Achtung: rechnet ca 8 Sekunden*)
28.810 -val t = TermC.str2term
28.811 +val t = TermC.parse_test @{context}
28.812 "(2*x \<up> 2/(3*y)+x/y \<up> 2)*(4*x \<up> 4/(9*y \<up> 2)+x \<up> 2/y \<up> 4)*(2*x \<up> 2/(3*y) - x/y \<up> 2)";
28.813 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.814 if UnparseC.term t = "(- 81 * x \<up> 4 + 16 * x \<up> 8 * y \<up> 4) / (81 * y \<up> 8)"
28.815 then () else error "rational.sml: diff.behav. in norm_Rational_mg 33";
28.816
28.817 (*------- SRAM Schalk I, p.69 Nr. 450a *)
28.818 -val t = TermC.str2term
28.819 +val t = TermC.parse_test @{context}
28.820 "(4*x/(3*y)+2*y/(3*x)) \<up> 2 - (2*y/(3*x) - 2*x/y)*(2*y/(3*x)+2*x/y)";
28.821 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.822 if UnparseC.term t = "(52 * x \<up> 2 + 16 * y \<up> 2) / (9 * y \<up> 2)"
28.823 then () else error "rational.sml: diff.behav. in norm_Rational_mg 34";
28.824
28.825 (*------- SRAM Schalk I, p.69 Nr. 442b --- abgewandelt*)
28.826 -val t = TermC.str2term
28.827 +val t = TermC.parse_test @{context}
28.828 ("(15*a \<up> 4/(a*x \<up> 3) - 5*a*((b \<up> 4 - 5*c \<up> 2*x) / x \<up> 2)) * " ^
28.829 "(x \<up> 3/(5*a*b \<up> 3*c \<up> 3)) + a/c \<up> 3 * (x*(b/a) - 3*b*(a/b \<up> 4))");
28.830 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.831 @@ -1261,21 +1261,21 @@
28.832 "-------- examples double fractions from: Mathematik 1 Schalk ----------------";
28.833 "-------- examples double fractions from: Mathematik 1 Schalk ----------------";
28.834 "----- SRD Schalk I, p.69 Nr. 454b";
28.835 -val t = TermC.str2term "((2 - x)/(2*a)) / (2*a/(x - 2))";
28.836 +val t = TermC.parse_test @{context} "((2 - x)/(2*a)) / (2*a/(x - 2))";
28.837 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.838 if UnparseC.term t = "(- 4 + 4 * x + - 1 * x \<up> 2) / (4 * a \<up> 2)"
28.839 then () else error "rational.sml: diff.behav. in norm_Rational_mg 35";
28.840
28.841 "----- SRD Schalk I, p.69 Nr. 455a";
28.842 -val t = TermC.str2term "(a \<up> 2 + 1)/(a \<up> 2 - 1) / ((a+1)/(a - 1))";
28.843 +val t = TermC.parse_test @{context} "(a \<up> 2 + 1)/(a \<up> 2 - 1) / ((a+1)/(a - 1))";
28.844 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.845 if UnparseC.term t = "(1 + a \<up> 2) / (1 + 2 * a + a \<up> 2)" then ()
28.846 else error "rational.sml: diff.behav. in norm_Rational_mg 36";
28.847
28.848 "----- Schalk I, p.69 Nr. 455b";
28.849 -val t = TermC.str2term "(x \<up> 2 - 4)/(y \<up> 2 - 9)/((2+x)/(3 - y))";
28.850 +val t = TermC.parse_test @{context} "(x \<up> 2 - 4)/(y \<up> 2 - 9)/((2+x)/(3 - y))";
28.851 (* WN130911 non-termination due to non-termination of
28.852 - cancel_p_ thy (TermC.str2term ("(- 12 + 4 * y + 3 * x \<up> 2 + - 1 * (x \<up> 2 * y)) /" ^
28.853 + cancel_p_ thy (TermC.parse_test @{context} ("(- 12 + 4 * y + 3 * x \<up> 2 + - 1 * (x \<up> 2 * y)) /" ^
28.854 "(- 18 + -9 * x + 2 * y \<up> 2 + x * y \<up> 2)"))
28.855
28.856 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.857 @@ -1284,9 +1284,9 @@
28.858 *)
28.859
28.860 "----- SK060904- 1a non-termination of cancel_p_ ?: worked before 0707xx";
28.861 -val t = TermC.str2term "(x \<up> 2 - 4)*(3 - y) / ((y \<up> 2 - 9)*(2+x))";
28.862 +val t = TermC.parse_test @{context} "(x \<up> 2 - 4)*(3 - y) / ((y \<up> 2 - 9)*(2+x))";
28.863 (* WN130911 non-termination due to non-termination of
28.864 - cancel_p_ thy (TermC.str2term ("(- 12 + 4 * y + 3 * x \<up> 2 + - 1 * (x \<up> 2 * y)) /" ^
28.865 + cancel_p_ thy (TermC.parse_test @{context} ("(- 12 + 4 * y + 3 * x \<up> 2 + - 1 * (x \<up> 2 * y)) /" ^
28.866 "(- 18 + -9 * x + 2 * y \<up> 2 + x * y \<up> 2)"))
28.867
28.868 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.869 @@ -1295,25 +1295,25 @@
28.870 *)
28.871
28.872 "----- ?: worked before 0707xx";
28.873 -val t = TermC.str2term "(3 + - 1 * y) / (-9 + y \<up> 2)";
28.874 +val t = TermC.parse_test @{context} "(3 + - 1 * y) / (-9 + y \<up> 2)";
28.875 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.876 if UnparseC.term t = "- 1 / (3 + y)"
28.877 then () else error "rational.sml: - 1 / (3 + y) norm_Rational";
28.878
28.879 "----- SRD Schalk I, p.69 Nr. 456b";
28.880 -val t = TermC.str2term "(b \<up> 3 - b \<up> 2) / (b \<up> 2+b) / (b \<up> 2 - 1)";
28.881 +val t = TermC.parse_test @{context} "(b \<up> 3 - b \<up> 2) / (b \<up> 2+b) / (b \<up> 2 - 1)";
28.882 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.883 if UnparseC.term t = "b / (1 + 2 * b + b \<up> 2)"
28.884 then () else error "rational.sml: diff.behav. in norm_Rational_mg 38";
28.885
28.886 "----- SRD Schalk I, p.69 Nr. 457b";
28.887 -val t = TermC.str2term "(16*a \<up> 2 - 9*b \<up> 2)/(2*a+3*a*b) / ((4*a+3*b)/(4*a \<up> 2 - 9*a \<up> 2*b \<up> 2))";
28.888 +val t = TermC.parse_test @{context} "(16*a \<up> 2 - 9*b \<up> 2)/(2*a+3*a*b) / ((4*a+3*b)/(4*a \<up> 2 - 9*a \<up> 2*b \<up> 2))";
28.889 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.890 if UnparseC.term t = "8 * a \<up> 2 + - 6 * a * b + - 12 * a \<up> 2 * b + 9 * a * b \<up> 2"
28.891 then () else error "rational.sml: diff.behav. in norm_Rational_mg 39";
28.892
28.893 "----- Schalk I, p.69 Nr. 458b works since 0707";
28.894 -val t = TermC.str2term "(2*a \<up> 2*x - a \<up> 2) / (a*x - b*x) / (b \<up> 2*(2*x - 1) / (x*(a - b)))";
28.895 +val t = TermC.parse_test @{context} "(2*a \<up> 2*x - a \<up> 2) / (a*x - b*x) / (b \<up> 2*(2*x - 1) / (x*(a - b)))";
28.896 (*val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.897 :
28.898 ### rls: cancel_p on: (- 1 * a \<up> 2 + 2 * (a \<up> 2 * x)) / (a * x + - 1 * (b * x)) /
28.899 @@ -1321,7 +1321,7 @@
28.900 exception Div raised
28.901
28.902 BUT
28.903 -val t = TermC.str2term
28.904 +val t = TermC.parse_test @{context}
28.905 ("(- 1 * a \<up> 2 + 2 * (a \<up> 2 * x)) / (a * x + - 1 * (b * x)) /" ^
28.906 "((- 1 * b \<up> 2 + 2 * (b \<up> 2 * x)) / (a * x + - 1 * (b * x)))");
28.907 NONE = cancel_p_ thy t;
28.908 @@ -1331,18 +1331,18 @@
28.909 *)
28.910
28.911 "----- SRD Schalk I, p.69 Nr. 459b";
28.912 -val t = TermC.str2term "(a \<up> 2 - b \<up> 2)/(a*b) / (4*(a+b) \<up> 2/a)";
28.913 +val t = TermC.parse_test @{context} "(a \<up> 2 - b \<up> 2)/(a*b) / (4*(a+b) \<up> 2/a)";
28.914 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.915 if UnparseC.term t = "(a + - 1 * b) / (4 * a * b + 4 * b \<up> 2)" then ()
28.916 else error "rational.sml: diff.behav. in norm_Rational_mg 41";
28.917
28.918 "----- Schalk I, p.69 Nr. 460b nonterm.SK";
28.919 -val t = TermC.str2term "(9*(x \<up> 2 - 8*x + 16) / (4*(y \<up> 2 - 2*y + 1))) / ((3*x - 12) / (16*y - 16))";
28.920 +val t = TermC.parse_test @{context} "(9*(x \<up> 2 - 8*x + 16) / (4*(y \<up> 2 - 2*y + 1))) / ((3*x - 12) / (16*y - 16))";
28.921 (*val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.922 exception Div raised
28.923
28.924 BUT
28.925 -val t = TermC.str2term
28.926 +val t = TermC.parse_test @{context}
28.927 ("(144 + -72 * x + 9 * x \<up> 2) / (4 + -8 * y + 4 * y \<up> 2) /" ^
28.928 "((- 12 + 3 * x) / (- 16 + 16 * y))");
28.929 NONE = cancel_p_ thy t;
28.930 @@ -1352,40 +1352,40 @@
28.931 *)
28.932
28.933 "----- some variant of the above; was non-terminating before";
28.934 -val t = TermC.str2term "9*(x \<up> 2 - 8*x+16)*(16*y - 16)/(4*(y \<up> 2 - 2*y+1)*(3*x - 12))";
28.935 +val t = TermC.parse_test @{context} "9*(x \<up> 2 - 8*x+16)*(16*y - 16)/(4*(y \<up> 2 - 2*y+1)*(3*x - 12))";
28.936 val SOME (t , _) = rewrite_set_ ctxt false norm_Rational t;
28.937 if UnparseC.term t = "(48 + - 12 * x) / (1 + - 1 * y)"
28.938 then () else error "some variant of the above; was non-terminating before";
28.939
28.940 "----- SRD Schalk I, p.70 Nr. 472a";
28.941 -val t = TermC.str2term ("((8*x \<up> 2 - 32*y \<up> 2) / (2*x + 4*y)) / ((4*x - 8*y) / (x + y))");
28.942 +val t = TermC.parse_test @{context} ("((8*x \<up> 2 - 32*y \<up> 2) / (2*x + 4*y)) / ((4*x - 8*y) / (x + y))");
28.943 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.944 if UnparseC.term t = "x + y"
28.945 then () else error "rational.sml: diff.behav. in norm_Rational_mg 43";
28.946
28.947 "----- Schalk I, p.70 Nr. 478b ----- Rechenzeit: 5 sec";
28.948 -val t = TermC.str2term ("(a - (a*b + b \<up> 2)/(a+b))/(b+(a - b)/(1+(a+b)/(a - b))) / " ^
28.949 +val t = TermC.parse_test @{context} ("(a - (a*b + b \<up> 2)/(a+b))/(b+(a - b)/(1+(a+b)/(a - b))) / " ^
28.950 "((a - a \<up> 2/(a+b))/(a+(a*b)/(a - b)))");
28.951 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.952 if UnparseC.term t = "(2 * a \<up> 3 + 2 * a \<up> 2 * b) / (a \<up> 2 * b + b \<up> 3)"
28.953 then () else error "rational.sml: diff.behav. in norm_Rational_mg 51";
28.954
28.955 (*SRD Schalk I, p.69 Nr. 461a *)
28.956 -val t = TermC.str2term "(2/(x+3) + 2/(x - 3)) / (8*x/(x \<up> 2 - 9))";
28.957 +val t = TermC.parse_test @{context} "(2/(x+3) + 2/(x - 3)) / (8*x/(x \<up> 2 - 9))";
28.958 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.959 if UnparseC.term t = "1 / 2"
28.960 then () else error "rational.sml: diff.behav. in norm_Rational_mg 44";
28.961
28.962 (*SRD Schalk I, p.69 Nr. 464b *)
28.963 -val t = TermC.str2term "(a - a/(a - 2)) / (a + a/(a - 2))";
28.964 +val t = TermC.parse_test @{context} "(a - a/(a - 2)) / (a + a/(a - 2))";
28.965 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.966 if UnparseC.term t = "(- 3 + a) / (- 1 + a)"
28.967 then () else error "rational.sml: diff.behav. in norm_Rational_mg 45";
28.968
28.969 (*SRD Schalk I, p.69 Nr. 465b *)
28.970 -val t = TermC.str2term "((x+3*y)/9 + (4*y \<up> 2 - 9*z \<up> 2)/(16*x)) / (x/9 + y/6 + z/4)";
28.971 +val t = TermC.parse_test @{context} "((x+3*y)/9 + (4*y \<up> 2 - 9*z \<up> 2)/(16*x)) / (x/9 + y/6 + z/4)";
28.972 (* WN130911 non-termination due to non-termination of
28.973 - cancel_p_ thy (TermC.str2term
28.974 + cancel_p_ thy (TermC.parse_test @{context}
28.975 ("("(576 * x \<up> 2 + 1728 * (x * y) + 1296 * y \<up> 2 + - 2916 * z \<up> 2) /" ^
28.976 "(576 * x \<up> 2 + 864 * (x * y) + 1296 * (x * z))"))
28.977
28.978 @@ -1395,13 +1395,13 @@
28.979 *)
28.980
28.981 (*SRD Schalk I, p.69 Nr. 466b *)
28.982 -val t = TermC.str2term "((1 - 7*(x - 2)/(x \<up> 2 - 4)) / (6/(x+2))) / (3/(x+5)+30/(x \<up> 2 - 25))";
28.983 +val t = TermC.parse_test @{context} "((1 - 7*(x - 2)/(x \<up> 2 - 4)) / (6/(x+2))) / (3/(x+5)+30/(x \<up> 2 - 25))";
28.984 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.985 if UnparseC.term t = "(25 + - 10 * x + x \<up> 2) / 18"
28.986 then () else error "rational.sml: diff.behav. in norm_Rational_mg 47";
28.987
28.988 (*SRD Schalk I, p.70 Nr. 469 *)
28.989 -val t = TermC.str2term ("3*b \<up> 2 / (4*a \<up> 2 - 8*a*b + 4*b \<up> 2) / " ^
28.990 +val t = TermC.parse_test @{context} ("3*b \<up> 2 / (4*a \<up> 2 - 8*a*b + 4*b \<up> 2) / " ^
28.991 "(a / (a \<up> 2*b - b \<up> 3) + (a - b) / (4*a*b \<up> 2 + 4*b \<up> 3) - 1 / (4*b \<up> 2))");
28.992 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.993 if UnparseC.term t = "- 3 * b \<up> 3 / (- 2 * a + 2 * b)"
28.994 @@ -1558,13 +1558,13 @@
28.995 "-------- investigate rulesets for cancel_p ----------------------------------";
28.996 "-------- investigate rulesets for cancel_p ----------------------------------";
28.997 val thy = @{theory "Rational"};
28.998 -val t = TermC.str2term "(a \<up> 2 + - 1*b \<up> 2) / (a \<up> 2 + - 2*a*b + b \<up> 2)";
28.999 -val tt = TermC.str2term "(1 * a + 1 * b) * (1 * a + - 1 * b)"(*numerator only*);
28.1000 +val t = TermC.parse_test @{context} "(a \<up> 2 + - 1*b \<up> 2) / (a \<up> 2 + - 2*a*b + b \<up> 2)";
28.1001 +val tt = TermC.parse_test @{context} "(1 * a + 1 * b) * (1 * a + - 1 * b)"(*numerator only*);
28.1002
28.1003 "----- with rewrite_set_";
28.1004 val SOME (tt',asm) = rewrite_set_ ctxt false make_polynomial tt;
28.1005 if UnparseC.term tt'= "a \<up> 2 + - 1 * b \<up> 2" then () else error "rls chancel_p 1";
28.1006 -val tt = TermC.str2term "((1 * a + - 1 * b) * (1 * a + - 1 * b))"(*denominator only*);
28.1007 +val tt = TermC.parse_test @{context} "((1 * a + - 1 * b) * (1 * a + - 1 * b))"(*denominator only*);
28.1008 val SOME (tt',asm) = rewrite_set_ ctxt false make_polynomial tt;
28.1009 if UnparseC.term tt' = "a \<up> 2 + - 2 * a * b + b \<up> 2" then () else error "rls chancel_p 2";
28.1010
28.1011 @@ -1585,12 +1585,12 @@
28.1012 (*default_print_depth 99;*) map (UnparseC.term o #1 o #3) der; (*default_print_depth 3;*)
28.1013
28.1014 val der = Derive.do_one ctxt Atools_erls rules ro NONE
28.1015 - (TermC.str2term "(1 * a + 1 * b) * (1 * a + - 1 * b)");
28.1016 + (TermC.parse_test @{context} "(1 * a + 1 * b) * (1 * a + - 1 * b)");
28.1017 (*default_print_depth 99;*) writeln (Derive.deriv2str der); (*default_print_depth 3;*)
28.1018
28.1019 val {rules, rew_ord=(_,ro),...} = Rule_Set.rep (get_rls @{context} "rev_rew_p");
28.1020 val der = Derive.do_one ctxt Atools_erls rules ro NONE
28.1021 - (TermC.str2term "(1 * a + - 1 * b) * (1 * a + - 1 * b)");
28.1022 + (TermC.parse_test @{context} "(1 * a + - 1 * b) * (1 * a + - 1 * b)");
28.1023 (*default_print_depth 99;*) writeln (Derive.deriv2str der); (*default_print_depth 3;*)
28.1024 (*default_print_depth 99;*) map (UnparseC.term o #1) der; (*default_print_depth 3;*)
28.1025 (*WN060829 ...postponed*)
28.1026 @@ -1638,21 +1638,21 @@
28.1027 "-------- WN1309xx non-terminating rls norm_Rational -------------------------";
28.1028 "-------- WN1309xx non-terminating rls norm_Rational -------------------------";
28.1029 (*------- Schalk I, p.70 Nr. 480b; a/b : c/d translated to a/b * d/c*)
28.1030 -val t = TermC.str2term
28.1031 +val t = TermC.parse_test @{context}
28.1032 ("((12*x*y / (9*x \<up> 2 - y \<up> 2)) / (1 / (3*x - y) \<up> 2 - 1 / (3*x + y) \<up> 2)) * " ^
28.1033 "((1/(x - 5*y) \<up> 2 - 1/(x + 5*y) \<up> 2) / (20*x*y / (x \<up> 2 - 25*y \<up> 2)))");
28.1034
28.1035 (*1st factor separately simplified *)
28.1036 -val t = TermC.str2term "((12*x*y / (9*x \<up> 2 - y \<up> 2)) / (1 / (3*x - y) \<up> 2 - 1 / (3*x + y) \<up> 2))";
28.1037 +val t = TermC.parse_test @{context} "((12*x*y / (9*x \<up> 2 - y \<up> 2)) / (1 / (3*x - y) \<up> 2 - 1 / (3*x + y) \<up> 2))";
28.1038 val SOME (t', _) = rewrite_set_ ctxt false norm_Rational t;
28.1039 if UnparseC.term t' = "(- 9 * x \<up> 2 + y \<up> 2) / - 1" then () else error "Nr. 480b lhs changed";
28.1040 (*2nd factor separately simplified *)
28.1041 -val t = TermC.str2term "((1/(x - 5*y) \<up> 2 - 1/(x + 5*y) \<up> 2) / (20*x*y / (x \<up> 2 - 25*y \<up> 2)))";
28.1042 +val t = TermC.parse_test @{context} "((1/(x - 5*y) \<up> 2 - 1/(x + 5*y) \<up> 2) / (20*x*y / (x \<up> 2 - 25*y \<up> 2)))";
28.1043 val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t; UnparseC.term t';
28.1044 if UnparseC.term t' = "- 1 / (- 1 * x \<up> 2 + 25 * y \<up> 2)" then () else error "Nr. 480b rhs changed";
28.1045
28.1046 "-------- Schalk I, p.70 Nr. 477a: terms are exploding ?!?";
28.1047 -val t = TermC.str2term ("b*y/(b - 2*y)/((b \<up> 2 - y \<up> 2)/(b+2*y)) /" ^
28.1048 +val t = TermC.parse_test @{context} ("b*y/(b - 2*y)/((b \<up> 2 - y \<up> 2)/(b+2*y)) /" ^
28.1049 "(b \<up> 2*y + b*y \<up> 2) * (a+x) \<up> 2 / ((b \<up> 2 - 4*y \<up> 2) * (a+2*x) \<up> 2)");
28.1050 (*val SOME (t',_) = rewrite_set_ ctxt false norm_Rational t;
28.1051 :
28.1052 @@ -1667,7 +1667,7 @@
28.1053 exception Div raised
28.1054
28.1055 BUT
28.1056 -val t = TermC.str2term
28.1057 +val t = TermC.parse_test @{context}
28.1058 ("(a \<up> 2 * (b * y) + 2 * (a * (b * (x * y))) + b * (x \<up> 2 * y)) /" ^
28.1059 "(b + - 2 * y) /" ^
28.1060 "((b \<up> 2 + - 1 * y \<up> 2) / (b + 2 * y)) /" ^
28.1061 @@ -1680,7 +1680,7 @@
28.1062 *)
28.1063
28.1064 (*------- Schalk I, p.70 Nr. 476b in 2003 this worked using 10 sec. *)
28.1065 -val t = TermC.str2term
28.1066 +val t = TermC.parse_test @{context}
28.1067 ("((a \<up> 2 - b \<up> 2)/(2*a*b) + 2*a*b/(a \<up> 2 - b \<up> 2)) / ((a \<up> 2 + b \<up> 2)/(2*a*b) + 1) / " ^
28.1068 "((a \<up> 2 + b \<up> 2) \<up> 2 / (a + b) \<up> 2)");
28.1069 (* Rewrite.trace_on := true; (*true false*)
28.1070 @@ -1704,7 +1704,7 @@
28.1071 *)
28.1072
28.1073 "-------- Schalk I, p.70 Nr. 480a: terms are exploding ?!?";
28.1074 -val t = TermC.str2term ("(1/x + 1/y + 1/z) / (1/x - 1/y - 1/z) / " ^
28.1075 +val t = TermC.parse_test @{context} ("(1/x + 1/y + 1/z) / (1/x - 1/y - 1/z) / " ^
28.1076 "(2*x \<up> 2 / (x \<up> 2 - z \<up> 2) / (x / (x + z) + x / (x - z)))");
28.1077 (* Rewrite.trace_on := true; (*true false*)
28.1078 rewrite_set_ ctxt false norm_Rational t;
28.1079 @@ -1722,14 +1722,14 @@
28.1080 *)
28.1081
28.1082 "-------- Schalk I, p.60 Nr. 215d: terms are exploding, internal loop does not terminate";
28.1083 -val t = TermC.str2term "(a-b) \<up> 3 * (x+y) \<up> 4 / ((x+y) \<up> 2 * (a-b) \<up> 5)";
28.1084 +val t = TermC.parse_test @{context} "(a-b) \<up> 3 * (x+y) \<up> 4 / ((x+y) \<up> 2 * (a-b) \<up> 5)";
28.1085 (* Kein Wunder, denn Z???ler und Nenner extra als Polynom dargestellt ergibt:
28.1086
28.1087 -val t = TermC.str2term "(a-b) \<up> 3 * (x+y) \<up> 4";
28.1088 +val t = TermC.parse_test @{context} "(a-b) \<up> 3 * (x+y) \<up> 4";
28.1089 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.1090 UnparseC.term t;
28.1091 "a \<up> 3 * x \<up> 4 + 4 * a \<up> 3 * x \<up> 3 * y +6 * a \<up> 3 * x \<up> 2 * y \<up> 2 +4 * a \<up> 3 * x * y \<up> 3 +a \<up> 3 * y \<up> 4 +-3 * a \<up> 2 * b * x \<up> 4 +- 12 * a \<up> 2 * b * x \<up> 3 * y +- 18 * a \<up> 2 * b * x \<up> 2 * y \<up> 2 +- 12 * a \<up> 2 * b * x * y \<up> 3 +-3 * a \<up> 2 * b * y \<up> 4 +3 * a * b \<up> 2 * x \<up> 4 +12 * a * b \<up> 2 * x \<up> 3 * y +18 * a * b \<up> 2 * x \<up> 2 * y \<up> 2 +12 * a * b \<up> 2 * x * y \<up> 3 +3 * a * b \<up> 2 * y \<up> 4 +- 1 * b \<up> 3 * x \<up> 4 +-4 * b \<up> 3 * x \<up> 3 * y +-6 * b \<up> 3 * x \<up> 2 * y \<up> 2 +-4 * b \<up> 3 * x * y \<up> 3 +- 1 * b \<up> 3 * y \<up> 4";
28.1092 -val t = TermC.str2term "((x+y) \<up> 2 * (a-b) \<up> 5)";
28.1093 +val t = TermC.parse_test @{context} "((x+y) \<up> 2 * (a-b) \<up> 5)";
28.1094 val SOME (t, _) = rewrite_set_ ctxt false norm_Rational t;
28.1095 UnparseC.term t;
28.1096 "a \<up> 5 * x \<up> 2 + 2 * a \<up> 5 * x * y + a \<up> 5 * y \<up> 2 +-5 * a \<up> 4 * b * x \<up> 2 +- 10 * a \<up> 4 * b * x * y +-5 * a \<up> 4 * b * y \<up> 2 +10 * a \<up> 3 * b \<up> 2 * x \<up> 2 +20 * a \<up> 3 * b \<up> 2 * x * y +10 * a \<up> 3 * b \<up> 2 * y \<up> 2 +- 10 * a \<up> 2 * b \<up> 3 * x \<up> 2 +- 20 * a \<up> 2 * b \<up> 3 * x * y +- 10 * a \<up> 2 * b \<up> 3 * y \<up> 2 +5 * a * b \<up> 4 * x \<up> 2 +10 * a * b \<up> 4 * x * y +5 * a * b \<up> 4 * y \<up> 2 +- 1 * b \<up> 5 * x \<up> 2 +- 2 * b \<up> 5 * x * y +- 1 * b \<up> 5 * y \<up> 2";
28.1097 @@ -1737,7 +1737,7 @@
28.1098 anscheinend macht dem Rechner das Krzen diese Bruches keinen Spass mehr ...*)
28.1099
28.1100 "-------- Schalk I, p.70 Nr. 480b: terms are exploding, Rewrite.trace_on stops at";
28.1101 -val t = TermC.str2term ("((12*x*y/(9*x \<up> 2 - y \<up> 2))/" ^
28.1102 +val t = TermC.parse_test @{context} ("((12*x*y/(9*x \<up> 2 - y \<up> 2))/" ^
28.1103 "(1/(3*x - y) \<up> 2 - 1/(3*x + y) \<up> 2)) *" ^
28.1104 "(1/(x - 5*y) \<up> 2 - 1/(x + 5*y) \<up> 2)/" ^
28.1105 "(20*x*y/(x \<up> 2 - 25*y \<up> 2))");
29.1 --- a/test/Tools/isac/Knowledge/rlang.sml Sun Oct 09 06:53:03 2022 +0200
29.2 +++ b/test/Tools/isac/Knowledge/rlang.sml Sun Oct 09 07:44:22 2022 +0200
29.3 @@ -193,8 +193,8 @@
29.4 [ (bdv, v) ] make_ratpoly_in t;
29.5 if UnparseC.term t' = "3 / 5 * x" then () else error "rlang.sml: 1";
29.6
29.7 -val t = TermC.str2term "(3*x+5)/18 - x/2 - -(3*x - 2)/9 = 0";
29.8 -val subst = [(TermC.str2term "bdv", TermC.str2term "x")];
29.9 +val t = TermC.parse_test @{context} "(3*x+5)/18 - x/2 - -(3*x - 2)/9 = 0";
29.10 +val subst = [(TermC.parse_test @{context} "bdv", TermC.parse_test @{context} "x")];
29.11 val SOME (t',_) = rewrite_set_inst_ thy false subst make_ratpoly_in t;
29.12 if UnparseC.term t' = "1 / 18 = 0" then () else error "rlang.sml: 2";
29.13 (*WN---^ *)
29.14 @@ -226,8 +226,8 @@
29.15
29.16
29.17 (*WN---v *)
29.18 -val t = TermC.str2term "(17*x - 51)/9 - (-(13*x - 3)/6) + 11 - (9*x - 7)/4 = 0";
29.19 -val subst = [(TermC.str2term "bdv", TermC.str2term "x")];
29.20 +val t = TermC.parse_test @{context} "(17*x - 51)/9 - (-(13*x - 3)/6) + 11 - (9*x - 7)/4 = 0";
29.21 +val subst = [(TermC.parse_test @{context} "bdv", TermC.parse_test @{context} "x")];
29.22 val SOME (t',_) = rewrite_set_inst_ thy false subst make_ratpoly_in t;
29.23 UnparseC.term t';
29.24 if UnparseC.term t' = "79 / 12 + 65 / 36 * x = 0" then ()
29.25 @@ -338,14 +338,14 @@
29.26 | _ => error "rlang.sml: diff.behav. in Schalk I s.87 Bsp 44a [x = 1]";
29.27
29.28 (*WN---v *)
29.29 -val t = TermC.str2term "(1/2 + (5*x)/2) \<up> 2 - ((13*x)/2 - 5/2) \<up> 2 - (6*x) \<up> 2 + 29";
29.30 -val subst = [(TermC.str2term "bdv", TermC.str2term "x")];
29.31 +val t = TermC.parse_test @{context} "(1/2 + (5*x)/2) \<up> 2 - ((13*x)/2 - 5/2) \<up> 2 - (6*x) \<up> 2 + 29";
29.32 +val subst = [(TermC.parse_test @{context} "bdv", TermC.parse_test @{context} "x")];
29.33 val SOME (t',_) = rewrite_set_inst_ thy false subst make_ratpoly_in t;
29.34 if UnparseC.term t' = "23 + 35 * x + -72 * x \<up> 2" then ()
29.35 else error "rlang.sml: 4";
29.36
29.37 -val t = TermC.str2term "(1/2 + (5*x)/2) \<up> 2 - ((13*x)/2 - 5/2) \<up> 2 + (6*x) \<up> 2 - 29";
29.38 -val subst = [(TermC.str2term "bdv", TermC.str2term "x")];
29.39 +val t = TermC.parse_test @{context} "(1/2 + (5*x)/2) \<up> 2 - ((13*x)/2 - 5/2) \<up> 2 + (6*x) \<up> 2 - 29";
29.40 +val subst = [(TermC.parse_test @{context} "bdv", TermC.parse_test @{context} "x")];
29.41 val SOME (t',_) = rewrite_set_inst_ thy false subst make_ratpoly_in t;
29.42 if UnparseC.term t' = "-35 + 35 * x" then ()
29.43 else error "rlang.sml: 4.1";
29.44 @@ -486,7 +486,7 @@
29.45 "[v = (u * v0 + v0 * w + - 1 * f * w) / f]")) => ()
29.46 | _ => error "rlang.sml: diff.behav. in Schalk I s.89 Bsp 90a (1) [v=...]";
29.47 if Ctree.get_assumptions pt p =
29.48 - [TermC.str2term"(u * v0 + v0 * w + - 1 * f * w) / f + w ~= 0"] then ()
29.49 + [TermC.parse_test @{context}"(u * v0 + v0 * w + - 1 * f * w) / f + w ~= 0"] then ()
29.50 else error "rlang.sml: diff.behav. in I s.89 Bsp 90a (1) [v=...] asm";
29.51
29.52
29.53 @@ -530,8 +530,8 @@
29.54 case f of Form' (Test_Out.FormKF (~1,EdUndef,0,Nundef,"[w = (u * v0 + - 1 * f * v) / (f + - 1 * v0)]")) => ()
29.55 | _ => error "rlang.sml: diff.behav. in Schalk I Bsp 90a(2)";
29.56 if Ctree.get_assumptions pt p =
29.57 -[TermC.str2term"v + (u * v0 + - 1 * f * v) / (f + - 1 * v0) ~= 0",
29.58 - TermC.str2term"f + - 1 * v0 ~= 0"]
29.59 +[TermC.parse_test @{context}"v + (u * v0 + - 1 * f * v) / (f + - 1 * v0) ~= 0",
29.60 + TermC.parse_test @{context}"f + - 1 * v0 ~= 0"]
29.61 then writeln "asm should be simplified ???"
29.62 else error "rlang.sml: diff.behav. in Schalk I Bsp 90a(2) asm";
29.63
29.64 @@ -571,9 +571,9 @@
29.65 val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
29.66 case f of Form' (Test_Out.FormKF (~1,EdUndef,0,Nundef,"[R1 = R * R2 / (R2 + - 1 * R)]")) => ()
29.67 | _ => error "rlang.sml: diff.behav. in 98a(1) [R1 = ...]";
29.68 -if Ctree.get_assumptions pt p = [TermC.str2term"R * R2 * R2 ~= (R2 + - 1 * R) * 0",
29.69 - TermC.str2term"R2 + - 1 * R ~= 0",
29.70 - TermC.str2term"R2 + - 1 * R ~= 0"]
29.71 +if Ctree.get_assumptions pt p = [TermC.parse_test @{context}"R * R2 * R2 ~= (R2 + - 1 * R) * 0",
29.72 + TermC.parse_test @{context}"R2 + - 1 * R ~= 0",
29.73 + TermC.parse_test @{context}"R2 + - 1 * R ~= 0"]
29.74 then writeln "asm should be simplified"
29.75 else error "rlang.sml: diff.behav. in 98a(1) asm";
29.76
29.77 @@ -602,7 +602,7 @@
29.78 val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
29.79 case f of Form' (Test_Out.FormKF (_,_,0,_,"[p = y \<up> 2 / (2 * x)]")) => ()
29.80 | _ => error "rlang.sml: diff.behav. in Schalk I s.89 Bsp 104a (1) [p = y^2/(2*x)]";
29.81 -if Ctree.get_assumptions pt p = [TermC.str2term"- 2 * x ~= 0"]
29.82 +if Ctree.get_assumptions pt p = [TermC.parse_test @{context}"- 2 * x ~= 0"]
29.83 then writeln"should be x ~= 0\nshould be x ~= 0\nshould be x ~= 0\n"
29.84 else error "rlang.sml: diff.behav. in I s.89 Bsp 104a(1) asm";
29.85
29.86 @@ -632,8 +632,8 @@
29.87 val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
29.88 case f of Form' (Test_Out.FormKF (_,_,0,_,"[y = sqrt (2 * p * x), y = - 1 * sqrt (2 * p * x)]")) => ()
29.89 | _ => error "rlang.sml: diff.behav. Schalk I s.89 Bsp 104a(2) [x = ]";
29.90 -if Ctree.get_assumptions pt p = [TermC.str2term"0 <= - 1 * (- 2 * p * x)",
29.91 - TermC.str2term"0 <= - 1 * (- 2 * p * x)"]
29.92 +if Ctree.get_assumptions pt p = [TermC.parse_test @{context}"0 <= - 1 * (- 2 * p * x)",
29.93 + TermC.parse_test @{context}"0 <= - 1 * (- 2 * p * x)"]
29.94 then writeln "asm should be simplified\nshould be simplified"
29.95 else error "rlang.sml: diff.behav. in I s.89 Bsp 104a(2) asm";
29.96
29.97 @@ -678,10 +678,10 @@
29.98 | _ => error "rlang.sml: diff.behav. in Schalk I s.89 Bsp 118a(2) [x = ]";
29.99 val asms = Ctree.get_assumptions pt p;
29.100 if asms =
29.101 - [TermC.str2term"0 * b \<up> 2 <= - 1 * (a \<up> 2 * y \<up> 2 + - 1 * a \<up> 2 * b \<up> 2)",
29.102 - TermC.str2term"b \<up> 2 ~= 0",
29.103 - TermC.str2term"0 * b \<up> 2 <= - 1 * (a \<up> 2 * y \<up> 2 + - 1 * a \<up> 2 * b \<up> 2)",
29.104 - TermC.str2term"b \<up> 2 ~= 0"] then writeln"should be simplified MG"
29.105 + [TermC.parse_test @{context}"0 * b \<up> 2 <= - 1 * (a \<up> 2 * y \<up> 2 + - 1 * a \<up> 2 * b \<up> 2)",
29.106 + TermC.parse_test @{context}"b \<up> 2 ~= 0",
29.107 + TermC.parse_test @{context}"0 * b \<up> 2 <= - 1 * (a \<up> 2 * y \<up> 2 + - 1 * a \<up> 2 * b \<up> 2)",
29.108 + TermC.parse_test @{context}"b \<up> 2 ~= 0"] then writeln"should be simplified MG"
29.109 else error "rlang.sml: diff.behav. in Schalk I s.89 Bsp 118a(2) asms";
29.110
29.111 (*----------------- Schalk I s.102 Bsp 268(1) ------------------------*)
29.112 @@ -709,7 +709,7 @@
29.113 val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
29.114 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)]")) => ()
29.115 | _ => error "rlang.sml: diff.behav. Schalk I s.102 Bsp 268(1) [x2=...]";
29.116 -if Ctree.get_assumptions pt p = [TermC.str2term"y1 / 2 + - 1 * y3 / 2 ~= 0"] then ()
29.117 +if Ctree.get_assumptions pt p = [TermC.parse_test @{context}"y1 / 2 + - 1 * y3 / 2 ~= 0"] then ()
29.118 else error "rlang.sml: diff.behav. in I s.102 Bsp 268(1) asm";
29.119
29.120 (*-------------------- Schalk II ----------------------------*)
29.121 @@ -824,11 +824,11 @@
29.122 \0 <= 1 / 9]"
29.123 (*WN050916 before correction 'rewrite__set_ called with 'Rule_Set.Empty' for ..'
29.124 thus: maybe the rls for the asms is Rule_Set.Empty ??:
29.125 - [(TermC.str2term"0 <= (25 * (1 / 9) + - 1 * (16 + 49 * (1 / 9))) * -56", []),
29.126 - (TermC.str2term"9 ~= 0", []),
29.127 - (TermC.str2term"0 <= (-5 + 7 * sqrt (1 / 9) + 1) * 5", []),
29.128 - (TermC.str2term"9 ~= 0", []),
29.129 - (TermC.str2term"0 <= (25 * (1 / 9) + - 1 * (16 + 49 * (1 / 9))) * -56", [])]*)
29.130 + [(TermC.parse_test @{context}"0 <= (25 * (1 / 9) + - 1 * (16 + 49 * (1 / 9))) * -56", []),
29.131 + (TermC.parse_test @{context}"9 ~= 0", []),
29.132 + (TermC.parse_test @{context}"0 <= (-5 + 7 * sqrt (1 / 9) + 1) * 5", []),
29.133 + (TermC.parse_test @{context}"9 ~= 0", []),
29.134 + (TermC.parse_test @{context}"0 <= (25 * (1 / 9) + - 1 * (16 + 49 * (1 / 9))) * -56", [])]*)
29.135 then "should get True * False!!!"
29.136 else error "rlang.sml: diff.behav. in II 68a asms";
29.137
29.138 @@ -1329,7 +1329,7 @@
29.139 a * b / (a \<up> 2 + - 1 * b \<up> 2)"
29.140
29.141
29.142 -val t = TermC.str2term"(a + b * x) / (a + - 1 * (b * x)) + - 1 * (a + - 1 * (b * x)) / (a + b * x) =\n4 * a * b / (a \<up> 2 + - 1 * b \<up> 2)";
29.143 +val t = TermC.parse_test @{context}"(a + b * x) / (a + - 1 * (b * x)) + - 1 * (a + - 1 * (b * x)) / (a + b * x) =\n4 * a * b / (a \<up> 2 + - 1 * b \<up> 2)";
29.144 Rewrite.trace_on := false; (*true false*)
29.145 val SOME (t',asm) = rewrite_set_ thy false norm_Rational t;
29.146 UnparseC.term t';
29.147 @@ -1496,14 +1496,14 @@
29.148 "[x = (- 2 * a + 4 * b + sqrt (16 * a * b + 16 * b \<up> 2 + 4 * a \<up> 2)) / 4,\n x =\n (- 2 * a + 4 * b + - 1 * sqrt (16 * a * b + 16 * b \<up> 2 + 4 * a \<up> 2)) / 4]")) then writeln "simplify MG"
29.149 else error "rlang.sml: diff.behav. in II 62b [x=...]";
29.150 val asms = Ctree.get_assumptions pt p;
29.151 -if asms = [TermC.str2term"0 <= ((- 2 * a + 4 * b + sqrt (16 * a * b + 16 * b \<up> 2 + 4 * a \<up> 2)) / 4 + a) \<up> 2 + ((- 2 * a + 4 * b + sqrt (16 * a * b + 16 * b \<up> 2 + 4 * a \<up> 2)) / 4 - 2 * b) \<up> 2",
29.152 - TermC.str2term"0 <= a + 2 * b",
29.153 - TermC.str2term"8 * (-4 * a * b) <= (-4 * b + 2 * a) \<up> 2",
29.154 - TermC.str2term"8 * (-4 * a * b) <= (-4 * b + 2 * a) \<up> 2",
29.155 - TermC.str2term"0 <= ((- 2 * a + 4 * b + - 1 * sqrt (16 * a * b + 16 * b \<up> 2 + 4 * a \<up> 2)) / 4 + a) \<up> 2 + ((- 2 * a + 4 * b + - 1 * sqrt (16 * a * b + 16 * b \<up> 2 + 4 * a \<up> 2)) / 4 - 2 * b) \<up> 2",
29.156 - TermC.str2term"0 <= a + 2 * b",
29.157 - TermC.str2term"8 * (-4 * a * b) <= (-4 * b + 2 * a) \<up> 2",
29.158 - TermC.str2term"8 * (-4 * a * b) <= (-4 * b + 2 * a) \<up> 2"]
29.159 +if asms = [TermC.parse_test @{context}"0 <= ((- 2 * a + 4 * b + sqrt (16 * a * b + 16 * b \<up> 2 + 4 * a \<up> 2)) / 4 + a) \<up> 2 + ((- 2 * a + 4 * b + sqrt (16 * a * b + 16 * b \<up> 2 + 4 * a \<up> 2)) / 4 - 2 * b) \<up> 2",
29.160 + TermC.parse_test @{context}"0 <= a + 2 * b",
29.161 + TermC.parse_test @{context}"8 * (-4 * a * b) <= (-4 * b + 2 * a) \<up> 2",
29.162 + TermC.parse_test @{context}"8 * (-4 * a * b) <= (-4 * b + 2 * a) \<up> 2",
29.163 + TermC.parse_test @{context}"0 <= ((- 2 * a + 4 * b + - 1 * sqrt (16 * a * b + 16 * b \<up> 2 + 4 * a \<up> 2)) / 4 + a) \<up> 2 + ((- 2 * a + 4 * b + - 1 * sqrt (16 * a * b + 16 * b \<up> 2 + 4 * a \<up> 2)) / 4 - 2 * b) \<up> 2",
29.164 + TermC.parse_test @{context}"0 <= a + 2 * b",
29.165 + TermC.parse_test @{context}"8 * (-4 * a * b) <= (-4 * b + 2 * a) \<up> 2",
29.166 + TermC.parse_test @{context}"8 * (-4 * a * b) <= (-4 * b + 2 * a) \<up> 2"]
29.167 then writeln "should be simplified MG"
29.168 else error "rlang.sml: diff.behav. in II 62b asms";
29.169
29.170 @@ -1523,8 +1523,8 @@
29.171 (*
29.172 val f = Form' (Test_Out.FormKF (~1,EdUndef,1,Nundef,"(2 * x + 1) * x \<up> 2 = 0"))
29.173 normiert nicht ... korr.WN:
29.174 -val t = TermC.str2term "(2*x+1)*x \<up> 2 = 0";
29.175 -val subst = [(TermC.str2term "bdv", TermC.str2term "x")];
29.176 +val t = TermC.parse_test @{context} "(2*x+1)*x \<up> 2 = 0";
29.177 +val subst = [(TermC.parse_test @{context} "bdv", TermC.parse_test @{context} "x")];
29.178 val SOME (t',_) = rewrite_set_inst_ thy false subst make_ratpoly_in t;
29.179 if UnparseC.term t' = "x \<up> 2 + 2 * x \<up> 3 = 0" then ()
29.180 else error "rlang.sml: 7";
29.181 @@ -1547,7 +1547,7 @@
29.182
29.183 (*------------------------------vvv-Rewrite_Set "rat_eliminate"---------
29.184 > Rewrite.trace_on:=true; (*true false*)
29.185 -> val t = TermC.str2term
29.186 +> val t = TermC.parse_test @{context}
29.187 "(3 + - 1 * x + 1 * x \<up> 2) / (9 * x + -6 * x \<up> 2 + 1 * x \<up> 3) = 1 / x";
29.188 > val SOME (t',asm) =
29.189 rewrite_ thy dummy_ord rateq_erls true rat_mult_denominator_both t;
29.190 @@ -1595,8 +1595,8 @@
29.191 then writeln"simplify result\nsimplify result\nsimplify result"
29.192 else error "rlang.sml: diff.behav. in Pythagoras";
29.193 val asms = Ctree.get_assumptions pt p;
29.194 -(*if asms = [TermC.str2term"0 <= -4 * (b \<up> 2 / 4 + -4 * r \<up> 2 / 4)",
29.195 - TermC.str2term"0 <= -4 * (b \<up> 2 / 4 + -4 * r \<up> 2 / 4)"]*)
29.196 +(*if asms = [TermC.parse_test @{context}"0 <= -4 * (b \<up> 2 / 4 + -4 * r \<up> 2 / 4)",
29.197 + TermC.parse_test @{context}"0 <= -4 * (b \<up> 2 / 4 + -4 * r \<up> 2 / 4)"]*)
29.198 if UnparseC.terms (*WN1104changed*) asms =
29.199 "[0 <= -4 * (b \<up> 2 / 4 + - 1 * r \<up> 2 / 1),\
29.200 \0 <= -4 * (b \<up> 2 / 4 + - 1 * r \<up> 2 / 1)]"
30.1 --- a/test/Tools/isac/Knowledge/root.sml Sun Oct 09 06:53:03 2022 +0200
30.2 +++ b/test/Tools/isac/Knowledge/root.sml Sun Oct 09 07:44:22 2022 +0200
30.3 @@ -15,14 +15,14 @@
30.4 "----------- rls Root_erls ------------------------------";
30.5 "----------- rls Root_erls ------------------------------";
30.6 "----------- rls Root_erls ------------------------------";
30.7 -val t = TermC.str2term "sqrt 1";
30.8 +val t = TermC.parse_test @{context} "sqrt 1";
30.9 val SOME (t',_) = rewrite_set_ ctxt false Root_erls t;
30.10 if UnparseC.term t' = "1" then () else error "root.sml: diff.behav. sqrt 1";
30.11
30.12 -val t = TermC.str2term "sqrt (- 1)";
30.13 +val t = TermC.parse_test @{context} "sqrt (- 1)";
30.14 val NONE = rewrite_set_ ctxt false Root_erls t;
30.15
30.16 -val t = TermC.str2term "sqrt 0";
30.17 +val t = TermC.parse_test @{context} "sqrt 0";
30.18 val SOME (t',_) = rewrite_set_ ctxt false Root_erls t;
30.19 if UnparseC.term t' = "0" then () else error "root.sml: diff.behav. sqrt 1";
30.20
31.1 --- a/test/Tools/isac/Knowledge/rooteq.sml Sun Oct 09 06:53:03 2022 +0200
31.2 +++ b/test/Tools/isac/Knowledge/rooteq.sml Sun Oct 09 07:44:22 2022 +0200
31.3 @@ -136,7 +136,7 @@
31.4 | _ => error "rooteq.sml: diff.behav. [x = 1 / 25]";
31.5 if UnparseC.terms (*WN1104changed*) (Ctree.get_assumptions pt p) = "[0 <= 1 / 25]"
31.6 (*WN050916 before correction 'rewrite__set_ called with 'Rule_Set.Empty' for ..:
31.7 - [(TermC.str2term"25 ~= 0",[])] *)
31.8 + [(TermC.parse_test @{context}"25 ~= 0",[])] *)
31.9 then writeln "should be True\n\
31.10 \should be True\n\
31.11 \should be True\n"
31.12 @@ -204,7 +204,7 @@
31.13 val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
31.14 case f of Form' (Test_Out.FormKF (~1,EdUndef,0,Nundef,"[x = 4]")) => ()
31.15 | _ => error "rooteq.sml: diff.behav. [x = 4]";
31.16 -if Ctree.get_assumptions pt p = [TermC.str2term"0 <= 12 * sqrt 2 * 4"]
31.17 +if Ctree.get_assumptions pt p = [TermC.parse_test @{context}"0 <= 12 * sqrt 2 * 4"]
31.18 then writeln "should be True\nshould be True\nshould be True\n\
31.19 \should be True\nshould be True\nshould be True\n"
31.20 else error "rooteq.sml: diff.behav. with 0 <= 12 * sqrt 2 * 4";
32.1 --- a/test/Tools/isac/Knowledge/rootrateq.sml Sun Oct 09 06:53:03 2022 +0200
32.2 +++ b/test/Tools/isac/Knowledge/rootrateq.sml Sun Oct 09 07:44:22 2022 +0200
32.3 @@ -114,8 +114,8 @@
32.4 "check_elementwise: no set 1 = 2 + - 2 * sqrt x"*)
32.5
32.6 (*---- 2nd try: we investigate the script ["RootEq", "solve_sq_root_equation"] found via pbl*)
32.7 -val t = TermC.str2term "((lhs e_e) is_sqrtTerm_in v_v) | ((rhs e_e) is_sqrtTerm_in v_v)";
32.8 -val t = TermC.str2term ("((lhs (1 = 2 * (1 + - 1 * sqrt x))) is_sqrtTerm_in x) |" ^
32.9 +val t = TermC.parse_test @{context} "((lhs e_e) is_sqrtTerm_in v_v) | ((rhs e_e) is_sqrtTerm_in v_v)";
32.10 +val t = TermC.parse_test @{context} ("((lhs (1 = 2 * (1 + - 1 * sqrt x))) is_sqrtTerm_in x) |" ^
32.11 " ((rhs (1 = 2 * (1 + - 1 * sqrt x))) is_sqrtTerm_in x)");
32.12 val SOME (t, _) = rewrite_set_ thy true rooteq_srls t;
32.13 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 Sun Oct 09 06:53:03 2022 +0200
33.2 +++ b/test/Tools/isac/Knowledge/system.sml Sun Oct 09 07:44:22 2022 +0200
33.3 @@ -19,14 +19,14 @@
33.4 "----------- normalise system ------------------------------------";
33.5 "----------- normalise system ------------------------------------";
33.6 "----------- normalise system ------------------------------------";
33.7 -val t = TermC.str2term "[0 = c*0 + - 1*q_0*(0 \<up> 2 / 2) + c_2,\
33.8 +val t = TermC.parse_test @{context} "[0 = c*0 + - 1*q_0*(0 \<up> 2 / 2) + c_2,\
33.9 \ 0 = c*L + - 1*q_0*(L \<up> 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 \<up> 2 / 2) + c_2]"
33.13 then () else error "system.sml, diff.behav. in norm_Poly";
33.14
33.15 -val t = TermC.str2term "[0 = c*0 + - 1*q_0*(0 \<up> 2 / 2) + c_2,\
33.16 +val t = TermC.parse_test @{context} "[0 = c*0 + - 1*q_0*(0 \<up> 2 / 2) + c_2,\
33.17 \ 0 = c*L + - 1*q_0*(L \<up> 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 = TermC.str2term "nth_ 1 [0 = c*0 + - 1*q_0*(0 \<up> 2 / 2) + c_2,\
33.25 +val t = TermC.parse_test @{context} "nth_ 1 [0 = c*0 + - 1*q_0*(0 \<up> 2 / 2) + c_2,\
33.26 \ 0 = c*L + - 1*q_0*(L \<up> 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 \<up> 2 / 2) + c_2"
34.1 --- a/test/Tools/isac/Knowledge/wn.sml Sun Oct 09 06:53:03 2022 +0200
34.2 +++ b/test/Tools/isac/Knowledge/wn.sml Sun Oct 09 07:44:22 2022 +0200
34.3 @@ -4,7 +4,7 @@
34.4 various test dependent on IsacKnowledge/ outside Test.thy, Test.ML*)
34.5
34.6
34.7 - val t = TermC.str2term "solve (a*x + b = c, x)";
34.8 + val t = TermC.parse_test @{context} "solve (a*x + b = c, x)";
34.9 TermC.atomty t;
34.10 (*
34.11 "\n*** -------------"
35.1 --- a/test/Tools/isac/MathEngBasic/ctree.sml Sun Oct 09 06:53:03 2022 +0200
35.2 +++ b/test/Tools/isac/MathEngBasic/ctree.sml Sun Oct 09 07:44:22 2022 +0200
35.3 @@ -103,7 +103,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) (TermC.str2term "Inform[1]");
35.8 +val (pt', cuts) = cappend_form pt [1] (Istate.empty, ContextC.empty) (TermC.parse_test @{context} "Inform[1]");
35.9 "----------------------------------------------------------------/";
35.10
35.11 val (p,_,f,nxt,_,pt) = me nxt p [1] pt(*cappend_form: pos =[1]*);
35.12 @@ -419,7 +419,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 (TermC.str2term "newnew");
35.17 +val (pt',cuts) = cappend_form pt [3,2,1] Istate.empty (TermC.parse_test @{context} "newnew");
35.18 if cuts = [([3, 2, 1], Res),
35.19 ([3, 2, 2], Res),
35.20 ([3, 2], Res),
35.21 @@ -432,8 +432,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 (TermC.str2term "newform")
35.26 - (Tac "test") (TermC.str2term "newresult",[]) Complete;
35.27 +val (pt',cuts) = cappend_atomic pt [3,2,1] Istate.empty (TermC.parse_test @{context} "newform")
35.28 + (Tac "test") (TermC.parse_test @{context} "newresult",[]) Complete;
35.29 if cuts = [([3, 2, 1], Res), (*?????????????*)
35.30 ([3, 2, 2], Res),
35.31 ([3, 2], Res),
35.32 @@ -471,7 +471,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 (TermC.str2term "x + 1 = 2");
35.37 +val (pt,cuts) = cappend_form pt (fst p) Istate.empty (TermC.parse_test @{context} "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 @@ -482,8 +482,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 (TermC.str2term "x + 1 = 2")
35.46 - Empty_Tac (TermC.str2term "x + 1 + - 1 * 2 = 0",[]) Incomplete;
35.47 + cappend_atomic pt (fst p) Istate.empty (TermC.parse_test @{context} "x + 1 = 2")
35.48 + Empty_Tac (TermC.parse_test @{context} "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 @@ -494,8 +494,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 (TermC.str2term "x + 1 + - 1 * 2 = 0")
35.57 - Empty_Tac (TermC.str2term "- 1 + x = 0",[]) Incomplete;
35.58 + cappend_atomic pt (fst p) Istate.empty (TermC.parse_test @{context} "x + 1 + - 1 * 2 = 0")
35.59 + Empty_Tac (TermC.parse_test @{context} "- 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 @@ -516,7 +516,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 (TermC.str2term "- 1 + x = 0");
35.68 +val (pt,cuts) = cappend_form pt (fst p) Istate.empty (TermC.parse_test @{context} "- 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 @@ -527,8 +527,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 (TermC.str2term "- 1 + x = 0")
35.77 - Empty_Tac (TermC.str2term "x = 0 + - 1 * - 1",[]) Incomplete;
35.78 + cappend_atomic pt (fst p) Istate.empty (TermC.parse_test @{context} "- 1 + x = 0")
35.79 + Empty_Tac (TermC.parse_test @{context} "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 @@ -1160,8 +1160,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 (TermC.str2term "Inform[1]")
35.88 - (Tac "test") (TermC.str2term "Inres[1]",[]) Complete;
35.89 +val (pt', cuts) = cappend_atomic pt [1] Istate.empty (TermC.parse_test @{context} "Inform[1]")
35.90 + (Tac "test") (TermC.parse_test @{context} "Inres[1]",[]) Complete;
35.91
35.92 (*default_print_depth 99;*)
35.93 cuts;
35.94 @@ -1182,8 +1182,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 (TermC.str2term "Inform[2]")
35.99 - (Tac "test") (TermC.str2term "Inres[2]",[]) Complete;
35.100 +val (pt', cuts) = cappend_atomic pt [2] Istate.empty (TermC.parse_test @{context} "Inform[2]")
35.101 + (Tac "test") (TermC.parse_test @{context} "Inres[2]",[]) Complete;
35.102 (*default_print_depth 99;*)
35.103 cuts;
35.104 (*default_print_depth 3;*)
35.105 @@ -1220,7 +1220,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, TermC.str2term "Inhead[3]", ContextC.empty);
35.110 + ([],References.empty, TermC.parse_test @{context} "Inhead[3]", ContextC.empty);
35.111 (*default_print_depth 99;*)
35.112 cuts;
35.113 (*default_print_depth 3;*)
35.114 @@ -1245,8 +1245,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 (TermC.str2term "Inform[3,1]")
35.119 - (Tac "test") (TermC.str2term "Inres[3,1]",[]) Complete;
35.120 +val (pt', cuts) = cappend_atomic pt [3,1] Istate.empty (TermC.parse_test @{context} "Inform[3,1]")
35.121 + (Tac "test") (TermC.parse_test @{context} "Inres[3,1]",[]) Complete;
35.122 (*default_print_depth 99;*)
35.123 cuts;
35.124 (*default_print_depth 3;*)
35.125 @@ -1271,8 +1271,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 (TermC.str2term "Inform[3,2]")
35.130 - (Tac "test") (TermC.str2term "Inres[3,2]",[]) Complete;
35.131 +val (pt', cuts) = cappend_atomic pt [3,2] Istate.empty (TermC.parse_test @{context} "Inform[3,2]")
35.132 + (Tac "test") (TermC.parse_test @{context} "Inres[3,2]",[]) Complete;
35.133 (*default_print_depth 99;*)
35.134 cuts;
35.135 (*default_print_depth 3;*)
35.136 @@ -1296,8 +1296,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 (TermC.str2term "Inform[3,2,1]")
35.141 - (Tac "test") (TermC.str2term "Inres[3,2,1]",[]) Complete;
35.142 +val (pt', cuts) = cappend_atomic pt [3,2,1] Istate.empty (TermC.parse_test @{context} "Inform[3,2,1]")
35.143 + (Tac "test") (TermC.parse_test @{context} "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 Sun Oct 09 06:53:03 2022 +0200
36.2 +++ b/test/Tools/isac/MathEngBasic/mstools.sml Sun Oct 09 07:44:22 2022 +0200
36.3 @@ -20,38 +20,38 @@
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 = TermC.str2term "maximum A";
36.8 +(*val t = TermC.parse_test @{context} "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 = TermC.str2term "fixedValues [r=Arbfix]";
36.12 +> val t = TermC.parse_test @{context} "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 = TermC.str2term "valuesFor [a]";
36.16 +> val t = TermC.parse_test @{context} "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 = TermC.str2term "valuesFor [a,b]";
36.20 +> val t = TermC.parse_test @{context} "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 = TermC.str2term "relations [A=a*b, (a/2) \<up> 2 + (b/2) \<up> 2 = r \<up> 2]";
36.24 +> val t = TermC.parse_test @{context} "relations [A=a*b, (a/2) \<up> 2 + (b/2) \<up> 2 = r \<up> 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) \<up> 2 + (b / 2) \<up> 2 = r \<up> 2]"
36.27 -> val t = TermC.str2term "boundVariable a";
36.28 +> val t = TermC.parse_test @{context} "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 = TermC.str2term "interval {x::real. 0 <= x & x <= 2*r}";
36.32 +> val t = TermC.parse_test @{context} "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 = TermC.str2term "equality (sqrt(9+4*x)=sqrt x + sqrt(5+x))";
36.37 +> val t = TermC.parse_test @{context} "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 = TermC.str2term "solveFor x";
36.41 +> val t = TermC.parse_test @{context} "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 = TermC.str2term "errorBound (eps=0)";
36.45 +> val t = TermC.parse_test @{context} "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 = TermC.str2term "solutions L";
36.49 +> val t = TermC.parse_test @{context} "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 @@ -105,7 +105,7 @@
36.54 "----------- fun pbl_ids -----------------------------------------------------------------------";
36.55 "----------- fun pbl_ids -----------------------------------------------------------------------";
36.56 (*
36.57 -val t as t1 $ t2 = TermC.str2term "antiDerivativeName M_b";
36.58 +val t as t1 $ t2 = TermC.parse_test @{context} "antiDerivativeName M_b";
36.59 pbl_ids ctxt t1 t2;
36.60
36.61 val t = (Thm.term_of o the o (TermC.parse thy)) "fixedValues [r=Arbfix]";
37.1 --- a/test/Tools/isac/MathEngBasic/rewrite.sml Sun Oct 09 06:53:03 2022 +0200
37.2 +++ b/test/Tools/isac/MathEngBasic/rewrite.sml Sun Oct 09 07:44:22 2022 +0200
37.3 @@ -245,8 +245,8 @@
37.4 "----------- step through 'fun rewrite_terms_' ------------------------------------------------";
37.5 "----- step 0: args for rewrite_terms_, local fun";
37.6 val (thy, ord, erls, equs, t) =
37.7 - (@{theory "Biegelinie"}, Rewrite_Ord.function_empty, Rule_Set.Empty, [TermC.str2term "x = 0"],
37.8 - TermC.str2term "M_b x = -1 * q_0 * x \<up> 2 / 2 + x * c + c_2");
37.9 + (@{theory "Biegelinie"}, Rewrite_Ord.function_empty, Rule_Set.Empty, [TermC.parse_test @{context} "x = 0"],
37.10 + TermC.parse_test @{context} "M_b x = -1 * q_0 * x \<up> 2 / 2 + x * c + c_2");
37.11 "----- step 1: args for rew_";
37.12 val ((t', asm'), (rules as r::rs), t) = ((TermC.empty, []), equs, t);
37.13 "----- step 2: rew_sub";
37.14 @@ -259,15 +259,15 @@
37.15 if UnparseC.term t' = "M_b 0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2" then ()
37.16 else error "rewrite.sml rewrite_terms_ [x = 0]";
37.17
37.18 -val equs = [TermC.str2term "M_b 0 = 0"];
37.19 -val t = TermC.str2term "M_b 0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2";
37.20 +val equs = [TermC.parse_test @{context} "M_b 0 = 0"];
37.21 +val t = TermC.parse_test @{context} "M_b 0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2";
37.22 val SOME (t', _) = rewrite_terms_ ctxt Rewrite_Ord.function_empty Rule_Set.Empty equs t;
37.23 writeln "---------- rewrite_terms_ 2---------------------------";
37.24 if UnparseC.term t' = "0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2" then ()
37.25 else error "rewrite.sml rewrite_terms_ [M_b 0 = 0]";
37.26
37.27 -val equs = [TermC.str2term "x = 0", TermC.str2term"M_b 0 = 0"];
37.28 -val t = TermC.str2term "M_b x = - 1 * q_0 * x \<up> 2 / 2 + x * c + c_2";
37.29 +val equs = [TermC.parse_test @{context} "x = 0", TermC.parse_test @{context}"M_b 0 = 0"];
37.30 +val t = TermC.parse_test @{context} "M_b x = - 1 * q_0 * x \<up> 2 / 2 + x * c + c_2";
37.31 val SOME (t', _) = rewrite_terms_ ctxt Rewrite_Ord.function_empty Rule_Set.Empty equs t;
37.32 writeln "---------- rewrite_terms_ 3---------------------------";
37.33 if UnparseC.term t' = "0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2" then ()
37.34 @@ -278,11 +278,11 @@
37.35 "----------- rewrite_inst_ bdvs ----------------------------------------------------------------";
37.36 "----------- rewrite_inst_ bdvs ----------------------------------------------------------------";
37.37 (*see smltest/Scripts/term_G.sml: inst_bdv 2*)
37.38 -val t = TermC.str2term"-1 * (q_0 * L \<up> 2) / 2 + (L * c_3 + c_4) = 0";
37.39 -val bdvs = [(TermC.str2term"bdv_1",TermC.str2term"c"),
37.40 - (TermC.str2term"bdv_2",TermC.str2term"c_2"),
37.41 - (TermC.str2term"bdv_3",TermC.str2term"c_3"),
37.42 - (TermC.str2term"bdv_4",TermC.str2term"c_4")];
37.43 +val t = TermC.parse_test @{context}"-1 * (q_0 * L \<up> 2) / 2 + (L * c_3 + c_4) = 0";
37.44 +val bdvs = [(TermC.parse_test @{context}"bdv_1",TermC.parse_test @{context}"c"),
37.45 + (TermC.parse_test @{context}"bdv_2",TermC.parse_test @{context}"c_2"),
37.46 + (TermC.parse_test @{context}"bdv_3",TermC.parse_test @{context}"c_3"),
37.47 + (TermC.parse_test @{context}"bdv_4",TermC.parse_test @{context}"c_4")];
37.48 (*------------ outcommented WN071210, after inclusion into ROOT.ML
37.49 val SOME (t,_) =
37.50 rewrite_inst_ thy e_rew_ord
37.51 @@ -317,7 +317,7 @@
37.52 (or not: hen the Rrls not applied);
37.53 if pre1 and pre2 evaluate to @{term True} in this environment,
37.54 then the Rrls is applied. *)
37.55 -val t = TermC.str2term "(a + b) / c ::real";
37.56 +val t = TermC.parse_test @{context} "(a + b) / c ::real";
37.57 val pat = TermC.parse_patt thy "?r / ?s ::real";
37.58 val pres = [TermC.parse_patt thy "?r is_expanded", TermC.parse_patt thy "?s is_expanded"];
37.59 val prepat = [(pres, pat)];
37.60 @@ -335,7 +335,7 @@
37.61 "===== Rational.thy: add_fractions_p ===";
37.62 (* if each pat* TermC.matches with the current term, the Rrls is applied
37.63 (there are no preconditions to be checked, they are @{term True}) *)
37.64 -val t = TermC.str2term "a / b + 1 / 2";
37.65 +val t = TermC.parse_test @{context} "a / b + 1 / 2";
37.66 val pat = TermC.parse_patt thy "?r / ?s + ?u / ?v";
37.67 val pres = [@{term True}];
37.68 val prepat = [(pres, pat)];
37.69 @@ -349,7 +349,7 @@
37.70 "===== Poly.thy: order_mult_ ===";
37.71 (* ?p matched with the current term gives an environment,
37.72 which evaluates (the instantiated) "p is_multUnordered" to true*)
37.73 -val t = TermC.str2term "x \<up> 2 * x";
37.74 +val t = TermC.parse_test @{context} "x \<up> 2 * x";
37.75 val pat = TermC.parse_patt thy "?p :: real"
37.76 val pres = [TermC.parse_patt thy "?p is_multUnordered"];
37.77 val prepat = [(pres, pat)];
37.78 @@ -369,10 +369,10 @@
37.79 "----------- fun app_rev, Rrls, ----------------------------------------------------------------";
37.80 "----------- fun app_rev, Rrls, ----------------------------------------------------------------";
37.81 "----------- fun app_rev, Rrls, ----------------------------------------------------------------";
37.82 -val t = TermC.str2term "x \<up> 2 * x";
37.83 +val t = TermC.parse_test @{context} "x \<up> 2 * x";
37.84
37.85 if is_multUnordered t then () else error "rewrite.sml diff. is_multUnordered 2";
37.86 -val tm = TermC.str2term "(x \<up> 2 * x) is_multUnordered";
37.87 +val tm = TermC.parse_test @{context} "(x \<up> 2 * x) is_multUnordered";
37.88
37.89 (*+*)case eval_is_multUnordered "testid" "" tm ctxt of
37.90 (*+*) SOME
37.91 @@ -453,7 +453,7 @@
37.92 tracing "=== poly.sml: scan_ chk prepat end";
37.93
37.94 "----- chk ---";
37.95 -(*reestablish...*) val t = TermC.str2term "x \<up> 2 * x";
37.96 +(*reestablish...*) val t = TermC.parse_test @{context} "x \<up> 2 * x";
37.97 val [(pres, pat)] = prepat;
37.98 val subst: Type.tyenv * Envir.tenv =
37.99 Pattern.match thy (pat, t)
37.100 @@ -465,7 +465,7 @@
37.101 if UnparseC.terms asms = "[\"x \<up> 2 * x is_multUnordered\"]" then ()
37.102 else error "rewrite.sml: diff. is_multUnordered, asms";
37.103 val (thy, i, asms, bdv, rls) =
37.104 - (thy, (i+1), [TermC.str2term "(x \<up> 2 * x) is_multUnordered"],
37.105 + (thy, (i+1), [TermC.parse_test @{context} "(x \<up> 2 * x) is_multUnordered"],
37.106 [] : Subst.T, erls);
37.107 case eval__true ctxt i asms bdv rls of
37.108 ([], true) => ()
37.109 @@ -477,7 +477,7 @@
37.110 val thm = @{thm div_by_1};
37.111 val prop = Thm.prop_of thm;
37.112 TermC.atomty prop; (*Type 'a*)
37.113 -val t = TermC.str2term "(2*x)/1"; (*Type real*)
37.114 +val t = TermC.parse_test @{context} "(2*x)/1"; (*Type real*)
37.115
37.116 val (thy, ro, er, inst) =
37.117 (@{theory "Isac_Knowledge"}, tless_true, eval_rls, [(@{term "bdv::real"}, @{term "x::real"})]);
37.118 @@ -680,7 +680,7 @@
37.119 (* norm_equation is defined in Test.thy, other rls see Knowledg/**)
37.120 val thy = @{theory};
37.121 val rls = norm_equation;
37.122 -val term = TermC.str2term "x + 1 = 2";
37.123 +val term = TermC.parse_test @{context} "x + 1 = 2";
37.124
37.125 (**)val SOME (t, asm) = rewrite_set_ ctxt false rls term;
37.126 (** )##### try thm: "root_ge0"
38.1 --- a/test/Tools/isac/OLDTESTS/interface-xml.sml Sun Oct 09 06:53:03 2022 +0200
38.2 +++ b/test/Tools/isac/OLDTESTS/interface-xml.sml Sun Oct 09 07:44:22 2022 +0200
38.3 @@ -3,10 +3,10 @@
38.4 *)
38.5
38.6 (*see javatest.isac.util.TermC.parse.TestXMLParserDigest#testParseRefFormula*)
38.7 -refformulaOK2xml 1 ([1],Frm) (Form (TermC.str2term "x+1=2"));
38.8 +refformulaOK2xml 1 ([1],Frm) (Form (TermC.parse_test @{context} "x+1=2"));
38.9 (*see javatest.isac.util.TermC.parse.TestXMLParserDigest#testParseRefCalcHead*)
38.10 refformulaOK2xml 1 ([1],Pbl) (ModSpec Specification_Def.empty);
38.11
38.12 -getintervalOK 1 [(([2],Res), TermC.str2term "x = 4"),
38.13 - (([3],Pbl), TermC.str2term "e_headline"),
38.14 - (([3,1],Frm), TermC.str2term "-1+x=0")];
38.15 +getintervalOK 1 [(([2],Res), TermC.parse_test @{context} "x = 4"),
38.16 + (([3],Pbl), TermC.parse_test @{context} "e_headline"),
38.17 + (([3,1],Frm), TermC.parse_test @{context} "-1+x=0")];
39.1 --- a/test/Tools/isac/OLDTESTS/root-equ.sml Sun Oct 09 06:53:03 2022 +0200
39.2 +++ b/test/Tools/isac/OLDTESTS/root-equ.sml Sun Oct 09 07:44:22 2022 +0200
39.3 @@ -186,7 +186,7 @@
39.4 val rls = Test_simplify;
39.5 val (t,_) = the (rewrite_set_ thy false rls t);
39.6 val rls = isolate_bdv;
39.7 -val subst = [(TermC.str2term "bdv", TermC.str2term "x")];
39.8 +val subst = [(TermC.parse_test @{context} "bdv", TermC.parse_test @{context} "x")];
39.9 val (t,_) = the (rewrite_set_inst_ thy false subst rls t);
39.10 val rls = Test_simplify;
39.11 val (t,_) = the (rewrite_set_ thy false rls t);
39.12 @@ -247,7 +247,7 @@
39.13 " _________________ rewrite + cappend _________________ ";
39.14 " _________________ rewrite + cappend _________________ ";
39.15 val thy' = "Test";
39.16 -val ct = TermC.str2term"sqrt(9+4*x)=sqrt x + sqrt(5+x)";
39.17 +val ct = TermC.parse_test @{context}"sqrt(9+4*x)=sqrt x + sqrt(5+x)";
39.18 val ctl = ["sqrt(9+4*x)=sqrt x + sqrt(5+x)", "x::real", "0"];
39.19 val oris = O_Model.init thy ctl
39.20 ((#ppc o Problem.from_store)
39.21 @@ -290,70 +290,70 @@
39.22 val pos = (lev_on o lev_dn) pos;
39.23 val thm = ("square_equation_left", ""); val ctold = ct;
39.24 val (ct,asm) = the (rewrite thy' "tless_true" ("tval_rls") true thm (UnparseC.term ct));
39.25 -val (pt,_) = cappend_atomic pt pos loc ctold (Tac (fst thm)) (TermC.str2term ct,[])Complete;
39.26 +val (pt,_) = cappend_atomic pt pos loc ctold (Tac (fst thm)) (TermC.parse_test @{context} ct,[])Complete;
39.27 (*val pt = union_asm pt [] (map (rpair []) asm);*)
39.28
39.29 val pos = lev_on pos;
39.30 -val rls = ("Test_simplify"); val ctold = TermC.str2term ct;
39.31 +val rls = ("Test_simplify"); val ctold = TermC.parse_test @{context} ct;
39.32 val (ct,_) = the (rewrite_set thy' false rls ct);
39.33 -val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.str2term ct,[]) Complete;
39.34 +val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.parse_test @{context} ct,[]) Complete;
39.35
39.36 val pos = lev_on pos;
39.37 -val rls = ("rearrange_assoc"); val ctold = TermC.str2term ct;
39.38 +val rls = ("rearrange_assoc"); val ctold = TermC.parse_test @{context} ct;
39.39 val (ct,_) = the (rewrite_set thy' false rls ct);
39.40 -val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.str2term ct,[]) Complete;
39.41 +val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.parse_test @{context} ct,[]) Complete;
39.42
39.43 val pos = lev_on pos;
39.44 -val rls = ("isolate_root"); val ctold = TermC.str2term ct;
39.45 +val rls = ("isolate_root"); val ctold = TermC.parse_test @{context} ct;
39.46 val (ct,_) = the (rewrite_set thy' false rls ct);
39.47 -val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.str2term ct,[]) Complete;
39.48 +val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.parse_test @{context} ct,[]) Complete;
39.49
39.50 val pos = lev_on pos;
39.51 -val rls = ("Test_simplify"); val ctold = TermC.str2term ct;
39.52 +val rls = ("Test_simplify"); val ctold = TermC.parse_test @{context} ct;
39.53 val (ct,_) = the (rewrite_set thy' false rls ct);
39.54 -val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.str2term ct,[]) Complete;
39.55 +val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.parse_test @{context} ct,[]) Complete;
39.56
39.57 val pos = lev_on pos;
39.58 -val thm = ("square_equation_left", ""); val ctold = TermC.str2term ct;
39.59 +val thm = ("square_equation_left", ""); val ctold = TermC.parse_test @{context} ct;
39.60 val (ct,asm) = the (rewrite thy' "tless_true" "tval_rls" true thm ct);
39.61 -val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.str2term ct,[]) Complete;
39.62 +val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.parse_test @{context} ct,[]) Complete;
39.63 (*val pt = union_asm pt [] (map (rpair []) asm);*)
39.64
39.65 val pos = lev_up pos;
39.66 -val (pt,_) = append_result pt pos Istate.empty (TermC.str2term ct,[]) Complete;
39.67 +val (pt,_) = append_result pt pos Istate.empty (TermC.parse_test @{context} ct,[]) Complete;
39.68
39.69 val pos = lev_on pos;
39.70 -val rls = ("Test_simplify"); val ctold = TermC.str2term ct;
39.71 +val rls = ("Test_simplify"); val ctold = TermC.parse_test @{context} ct;
39.72 val (ct,_) = the (rewrite_set thy' false rls ct);
39.73 -val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.str2term ct,[]) Complete;
39.74 +val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.parse_test @{context} ct,[]) Complete;
39.75
39.76 val pos = lev_on pos;
39.77 -val rls = ("norm_equation"); val ctold = TermC.str2term ct;
39.78 +val rls = ("norm_equation"); val ctold = TermC.parse_test @{context} ct;
39.79 val (ct,_) = the (rewrite_set thy' false rls ct);
39.80 -val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.str2term ct,[]) Complete;
39.81 +val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.parse_test @{context} ct,[]) Complete;
39.82
39.83 val pos = lev_on pos;
39.84 -val rls = ("Test_simplify"); val ctold = TermC.str2term ct;
39.85 +val rls = ("Test_simplify"); val ctold = TermC.parse_test @{context} ct;
39.86 val (ct,_) = the (rewrite_set thy' false rls ct);
39.87 -val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.str2term ct,[]) Complete;
39.88 +val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.parse_test @{context} ct,[]) Complete;
39.89
39.90 (* --- see comments in interface_ME_ISA/instantiate''
39.91 val rlsdat' = instantiate_rls' thy' [("bdv", "x")] ("isolate_bdv");
39.92 val (ct,_) = the (rewrite_set thy' false
39.93 ("#isolate_bdv",rlsdat') ct); *)
39.94 val pos = lev_on pos;
39.95 -val rls = ("isolate_bdv"); val ctold = TermC.str2term ct;
39.96 +val rls = ("isolate_bdv"); val ctold = TermC.parse_test @{context} ct;
39.97 val (ct,_) = the (rewrite_set_inst thy' false
39.98 [("bdv", "x")] rls ct);
39.99 -val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.str2term ct,[]) Complete;
39.100 +val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.parse_test @{context} ct,[]) Complete;
39.101
39.102 val pos = lev_on pos;
39.103 -val rls = ("Test_simplify"); val ctold = TermC.str2term ct;
39.104 +val rls = ("Test_simplify"); val ctold = TermC.parse_test @{context} ct;
39.105 val (ct,_) = the (rewrite_set thy' false rls ct);
39.106 -val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.str2term ct,[]) Complete;
39.107 +val (pt,_) = cappend_atomic pt pos loc ctold (Tac rls) (TermC.parse_test @{context} ct,[]) Complete;
39.108
39.109 val pos = lev_up pos;
39.110 -val (pt,pos) = append_result pt pos Istate.empty (TermC.str2term ct,[]) Complete;
39.111 +val (pt,pos) = append_result pt pos Istate.empty (TermC.parse_test @{context} ct,[]) Complete;
39.112 Ctree.get_assumptions pt ([],Res);
39.113
39.114 writeln (pr_ctree pr_short pt);
39.115 @@ -529,7 +529,7 @@
39.116 val (p,_,f,nxt,_,pt) = me nxt p c pt;
39.117
39.118 (*.9.6.03
39.119 - val t = TermC.str2term "sqrt (9 + 4 * x) = sqrt x + sqrt (5 + x)";
39.120 + val t = TermC.parse_test @{context} "sqrt (9 + 4 * x) = sqrt x + sqrt (5 + x)";
39.121 val SOME (t',asm) = rewrite_set_ thy false rls t;
39.122 UnparseC.term t';
39.123 Rewrite.trace_on:=false; (*true false*)
40.1 --- a/test/Tools/isac/OLDTESTS/script.sml Sun Oct 09 06:53:03 2022 +0200
40.2 +++ b/test/Tools/isac/OLDTESTS/script.sml Sun Oct 09 07:44:22 2022 +0200
40.3 @@ -271,7 +271,7 @@
40.4 ([],(User', [], [], TermC.empty, TermC.empty,Sundef))]:ets;
40.5 val l0 = [];
40.6 " --------------- 1. ---------------------------------------------";
40.7 -val (pt,_) = cappend_atomic pt[1]Istate.empty TermC.empty(Rewrite("test", ""))(TermC.str2term ct,[])Complete;
40.8 +val (pt,_) = cappend_atomic pt[1]Istate.empty TermC.empty(Rewrite("test", ""))(TermC.parse_test @{context} ct,[])Complete;
40.9 (*12.10.03:*** Unknown theorem(s) "rroot_square_inv"
40.10 val Applicable.Yes m' = Step.check (Rewrite("rroot_square_inv", "")) (pt, p);
40.11 *)
41.1 --- a/test/Tools/isac/ProgLang/auto_prog.sml Sun Oct 09 06:53:03 2022 +0200
41.2 +++ b/test/Tools/isac/ProgLang/auto_prog.sml Sun Oct 09 07:44:22 2022 +0200
41.3 @@ -51,9 +51,9 @@
41.4 if UnparseC.terms (formal_args auto_script) = "[\"t_t\", \"v\"]"
41.5 then () else error "formal_args of auto-gen.script changed";
41.6
41.7 - Istate.init_detail (Rewrite_Set_Inst (["(''bdv'', x)"], "integration_rules")) (TermC.str2term "someTermWithBdv");
41.8 + Istate.init_detail (Rewrite_Set_Inst (["(''bdv'', x)"], "integration_rules")) (TermC.parse_test @{context} "someTermWithBdv");
41.9 "~~~~~ fun init_detail , args:"; val ((Tactic.Rewrite_Set_Inst (subs, rls)), t)
41.10 - = ((Rewrite_Set_Inst (["(''bdv'', x)"], "integration_rules")), TermC.str2term "someTermWithBdv");
41.11 + = ((Rewrite_Set_Inst (["(''bdv'', x)"], "integration_rules")), TermC.parse_test @{context} "someTermWithBdv");
41.12 val v = case Subst.T_from_input ctxt subs of
41.13 (_, v) :: _ => v;
41.14 (*case*) get_rls ctxt rls (*of*);
42.1 --- a/test/Tools/isac/ProgLang/evaluate.sml Sun Oct 09 06:53:03 2022 +0200
42.2 +++ b/test/Tools/isac/ProgLang/evaluate.sml Sun Oct 09 07:44:22 2022 +0200
42.3 @@ -47,7 +47,7 @@
42.4 "----------- fun calculate_ --------------------------------------------------------------------";
42.5 "----------- fun calculate_ --------------------------------------------------------------------";
42.6 (* fun rewrite__set_ \<longrightarrow> fun rew_once works the same way *)
42.7 -val t = TermC.str2term "((1+2)*4/3) \<up> 2";
42.8 +val t = TermC.parse_test @{context} "((1+2)*4/3) \<up> 2";
42.9 val thy = @{theory};
42.10 val ctxt = Proof_Context.init_global @{theory}
42.11 val times = ("Groups.times_class.times", Calc_Binop.numeric "#mult_") : string * Eval.ml_fun;
42.12 @@ -145,7 +145,7 @@
42.13 rewrite_set_ ctxt false tval_rls t;
42.14 (*val it = SOME (Const (\<^const_name>\<open>True\<close>, "bool"),[]) ... works*)
42.15
42.16 - val t = TermC.str2term "2 * x is_num";
42.17 + val t = TermC.parse_test @{context} "2 * x is_num";
42.18 val NONE = eval_is_num "" "" t (@{theory "Isac_Knowledge"});
42.19
42.20
42.21 @@ -320,7 +320,7 @@
42.22 val (thy, op_, ef, arg) =
42.23 (thy, "EqSystem.occur_exactly_in",
42.24 get_calc (@{theory "EqSystem"} |> Proof_Context.init_global) "occur_exactly_in" |> snd |> snd,
42.25 - TermC.str2term
42.26 + TermC.parse_test @{context}
42.27 "[] from [c, c_2, c_3, c_4] occur_exactly_in - 1 * (q_0 * L \<up> 2) / 2"
42.28 );
42.29 val SOME (str, simpl) = get_pair ctxt op_ ef arg;
42.30 @@ -332,7 +332,7 @@
42.31 "----------- calculate (2 * x is_num) -------------------";
42.32 "----------- calculate (2 * x is_num) -------------------";
42.33 "----------- calculate (2 * x is_num) -------------------";
42.34 -val t = TermC.str2term "(2::real) * x is_num";
42.35 +val t = TermC.parse_test @{context} "(2::real) * x is_num";
42.36
42.37 val SOME (str, t') = eval_is_num "" "Prog_Expr.is_num" t @{theory Test};
42.38 if UnparseC.term t' = "(2 * x is_num) = False" then ()
42.39 @@ -471,7 +471,7 @@
42.40 "----------- fun adhoc_thm \<longrightarrow> exception TYPE --------------------------------------------------";
42.41 "----------- fun adhoc_thm \<longrightarrow> exception TYPE --------------------------------------------------";
42.42 "----------- fun adhoc_thm \<longrightarrow> exception TYPE --------------------------------------------------";
42.43 -val t = TermC.str2term "sqrt 4";
42.44 +val t = TermC.parse_test @{context} "sqrt 4";
42.45 Eval.adhoc_thm @{context} ("NthRoot.sqrt", eval_sqrt "#sqrt_") t;
42.46
42.47 "~~~~~ fun adhoc_thm , args:"; val (thy, (op_, eval_fn), ct) =
43.1 --- a/test/Tools/isac/ProgLang/listC.sml Sun Oct 09 06:53:03 2022 +0200
43.2 +++ b/test/Tools/isac/ProgLang/listC.sml Sun Oct 09 07:44:22 2022 +0200
43.3 @@ -47,7 +47,7 @@
43.4 val ctxt = Proof_Context.init_global @{theory}
43.5 val prog_expr = get_rls @{context} "prog_expr"
43.6
43.7 -val t = TermC.str2term "NTH 1 [a,b,c,d,e]";
43.8 +val t = TermC.parse_test @{context} "NTH 1 [a,b,c,d,e]";
43.9 TermC.atomty t;
43.10 val thm = Thm.prop_of @{thm NTH_NIL};
43.11 TermC.atomty thm;
43.12 @@ -55,8 +55,8 @@
43.13 if UnparseC.term t' = "a" then ()
43.14 else error "NTH 1 [a,b,c,d,e] = a ..changed";
43.15
43.16 -val t = TermC.str2term "NTH 3 [a,b,c,d,e]";
43.17 -case TermC.str2term "NTH 3 [a,b,c,d,e]" of
43.18 +val t = TermC.parse_test @{context} "NTH 3 [a,b,c,d,e]";
43.19 +case TermC.parse_test @{context} "NTH 3 [a,b,c,d,e]" of
43.20 Const (\<^const_name>\<open>NTH\<close>, _) $ (Const (\<^const_name>\<open>numeral\<close>, _) $ (Const (\<^const_name>\<open>num.Bit1\<close>, _) $ Const (\<^const_name>\<open>num.One\<close>, _))) $
43.21 (Const (\<^const_name>\<open>Cons\<close>, _) $ Free ("a", _) $
43.22 (Const (\<^const_name>\<open>Cons\<close>, _) $ Free ("b", _) $
43.23 @@ -71,7 +71,7 @@
43.24 else error "NTH 3 [a,b,c,d,e] = NTH (3 + - 1) [b, c, d, e] ..changed";
43.25
43.26 (* now the argument "(3 + - 1)" etc needs to be evaluated in the assumption of NTH_CONS *)
43.27 -val t = TermC.str2term "NTH 3 [a,b,c,d,e]";
43.28 +val t = TermC.parse_test @{context} "NTH 3 [a,b,c,d,e]";
43.29 TermC.atomty t;
43.30
43.31 val SOME (t', _) = rewrite_set_ ctxt false prog_expr t;
43.32 @@ -84,7 +84,7 @@
43.33 val prog_expr = get_rls @{context} "prog_expr"
43.34
43.35 val thy = @{theory ListC};
43.36 -val t = TermC.str2term "Length [1, 1, 1]";
43.37 +val t = TermC.parse_test @{context} "Length [1, 1, 1]";
43.38 val SOME (t, asm) = rewrite_ ctxt tless_true tval_rls false @{thm LENGTH_CONS} t;
43.39 UnparseC.term t = "1 + Length [1, 1]";
43.40 val SOME (t, asm) = rewrite_ ctxt tless_true tval_rls false @{thm LENGTH_CONS} t;
43.41 @@ -97,12 +97,12 @@
43.42 if UnparseC.term t = "1 + (1 + (1 + 0))" then ()
43.43 else error "Length [1, 1, 1] = 1 + (1 + (1 + 0)) ..changed";
43.44
43.45 -val t = TermC.str2term "Length [1, 1, 1]";
43.46 +val t = TermC.parse_test @{context} "Length [1, 1, 1]";
43.47 val SOME (t, asm) = rewrite_set_ ctxt false prog_expr t;
43.48 if UnparseC.term t = "3" then ()
43.49 else error "Length [1, 1, 1] = 3 ..prog_expr changed";
43.50
43.51 -val t = TermC.str2term "Length [1, 1, 1]";
43.52 +val t = TermC.parse_test @{context} "Length [1, 1, 1]";
43.53 val t = eval_prog_expr ctxt prog_expr t;
43.54 case t of
43.55 Const (\<^const_name>\<open>numeral\<close>, _) $ (Const (\<^const_name>\<open>num.Bit1\<close>, _) $ Const (\<^const_name>\<open>num.One\<close>, _)) => ()
44.1 --- a/test/Tools/isac/ProgLang/prog_expr.sml Sun Oct 09 06:53:03 2022 +0200
44.2 +++ b/test/Tools/isac/ProgLang/prog_expr.sml Sun Oct 09 07:44:22 2022 +0200
44.3 @@ -58,7 +58,7 @@
44.4 "-------- fun eval_is_even ---------------------------------------------------------------------";
44.5 "-------- fun eval_is_even ---------------------------------------------------------------------";
44.6 "-------- fun eval_is_even ---------------------------------------------------------------------";
44.7 -val t = TermC.str2term "2 is_even";
44.8 +val t = TermC.parse_test @{context} "2 is_even";
44.9 eval_is_even "aaa" "Prog_Expr.is_even" t "ccc";
44.10 "~~~~~ fun eval_is_even , args:"; val ((thmid:string), "Prog_Expr.is_even", (t as (Const _ $ arg)), _) =
44.11 ("aaa", "Prog_Expr.is_even", t, "ccc");
44.12 @@ -71,14 +71,14 @@
44.13 if UnparseC.term t' = "(2 is_even) = True" then () else error "(2 is_even) = True CHANGED";
44.14
44.15
44.16 -val t = TermC.str2term "3 is_even";
44.17 +val t = TermC.parse_test @{context} "3 is_even";
44.18 case eval_is_even "aaa" "Prog_Expr.is_even" t "ccc" of
44.19 SOME (str, t') =>
44.20 if str = "aaa_" andalso UnparseC.term t' = "(3 is_even) = False" then ()
44.21 else error "eval_is_even (3 is_even) CHANGED 1"
44.22 | NONE => error "eval_is_even (3 is_even) CHANGED 2";
44.23
44.24 -val t = TermC.str2term "a ::real";
44.25 +val t = TermC.parse_test @{context} "a ::real";
44.26 val NONE =
44.27 eval_is_even "aaa" "Prog_Expr.is_even" t "ccc";
44.28 case eval_is_even "aaa" "Prog_Expr.is_even" t "ccc" of
44.29 @@ -95,27 +95,27 @@
44.30 SOME (Const (\<^const_name>\<open>True\<close>, _), []) => ()
44.31 | _ => error "2 is_num CHANGED";
44.32
44.33 -val t = TermC.str2term "2 * x is_num";
44.34 +val t = TermC.parse_test @{context} "2 * x is_num";
44.35 val SOME (str, t') = eval_is_num "" "Prog_Expr.is_num" t (@{theory "Isac_Knowledge"});
44.36 if UnparseC.term t' = "(2 * x is_num) = False" then ()
44.37 else error "(2 * x is_num) = False CHANGED";
44.38
44.39 -val t = TermC.str2term "- 2 is_num";
44.40 +val t = TermC.parse_test @{context} "- 2 is_num";
44.41 val SOME (str, t') = eval_is_num "" "Prog_Expr.is_num" t (@{theory "Isac_Knowledge"});
44.42 if UnparseC.term t' = "(- 2 is_num) = True" then ()
44.43 else error "(- 2 is_num) = False CHANGED";
44.44
44.45 -val t = TermC.str2term "- 1 is_num";
44.46 +val t = TermC.parse_test @{context} "- 1 is_num";
44.47 val SOME (str, t') = eval_is_num "" "Prog_Expr.is_num" t (@{theory "Isac_Knowledge"});
44.48 if UnparseC.term t' = "(- 1 is_num) = True" then ()
44.49 else error "(- 1 is_num) = False CHANGED";
44.50
44.51 -val t = TermC.str2term "0 is_num";
44.52 +val t = TermC.parse_test @{context} "0 is_num";
44.53 val SOME (str, t') = eval_is_num "" "Prog_Expr.is_num" t (@{theory "Isac_Knowledge"});
44.54 if UnparseC.term t' = "(0 is_num) = True" then ()
44.55 else error "(0 is_num) = False CHANGED";
44.56
44.57 -val t = TermC.str2term "AA is_num";
44.58 +val t = TermC.parse_test @{context} "AA is_num";
44.59 val SOME (str, t') = eval_is_num "" "Prog_Expr.is_num" t (@{theory "Isac_Knowledge"});
44.60 if UnparseC.term t' = "(AA is_num) = False" then ()
44.61 else error "(0 is_num) = False CHANGED";
44.62 @@ -204,20 +204,20 @@
44.63 val thy = @{theory}
44.64 val ctxt = (ThyC.id_to_ctxt "Isac_Knowledge")
44.65
44.66 -val t = TermC.str2term "x = 0";
44.67 +val t = TermC.parse_test @{context} "x = 0";
44.68 val NONE(*= indetermined*) = eval_equal "equal_" \<^const_name>\<open>HOL.eq\<close> t ctxt;
44.69
44.70 -val t = TermC.str2term "(x + 1) = (x + 1)";
44.71 +val t = TermC.parse_test @{context} "(x + 1) = (x + 1)";
44.72 val (Const _(*op0,t0*) $ t1 $ t2 ) = t
44.73 val SOME ("equal_(x + 1)_(x + 1)", t') = eval_equal "equal_" \<^const_name>\<open>HOL.eq\<close> t ctxt;
44.74 if UnparseC.term t' = "(x + 1 = x + 1) = True" then () else error "(x + 1) = (x + 1) CHANGED";
44.75
44.76 -val t as Const _ $ v $ c = TermC.str2term "1 = 0";
44.77 +val t as Const _ $ v $ c = TermC.parse_test @{context} "1 = 0";
44.78 val false = variable_constant_pair (v, c);
44.79 val SOME ("equal_(1)_(0)", t') = eval_equal "equal_" \<^const_name>\<open>HOL.eq\<close> t ctxt;
44.80 if UnparseC.term t' = "(1 = 0) = False" then () else error "1 = 0 CHANGED";
44.81
44.82 -val t = TermC.str2term "0 = 0";
44.83 +val t = TermC.parse_test @{context} "0 = 0";
44.84 val SOME ("equal_(0)_(0)", t') = eval_equal "equal_" \<^const_name>\<open>HOL.eq\<close> t ctxt;
44.85 if UnparseC.term t' = "(0 = 0) = True" then () else error "0 = 0 CHANGED";
44.86
44.87 @@ -228,7 +228,7 @@
44.88 val t = @{term "x::real"};
44.89 if occurs_in t t then "OK" else error "occurs_in x x -> f ..changed";
44.90
44.91 -val t = TermC.str2term "x occurs_in x";
44.92 +val t = TermC.parse_test @{context} "x occurs_in x";
44.93 val SOME (str, t') = eval_occurs_in 0 "Prog_Expr.occurs_in" t 0;
44.94 if UnparseC.term t' = "x occurs_in x = True" then ()
44.95 else error "x occurs_in x = True ..changed";
44.96 @@ -337,7 +337,7 @@
44.97 "---------fun eval_argument_of -----------------------------------------------------------------";
44.98 "---------fun eval_argument_of -----------------------------------------------------------------";
44.99 "---------fun eval_argument_of -----------------------------------------------------------------";
44.100 -val t = TermC.str2term "argument_in (M_b x)";
44.101 +val t = TermC.parse_test @{context} "argument_in (M_b x)";
44.102 val SOME (str, t') = eval_argument_in "0" "Prog_Expr.argument_in" t 0;
44.103 if UnparseC.term t' = "(argument_in M_b x) = x" then ()
44.104 else error "atools.sml:(argument_in M_b x) = x ???";
44.105 @@ -450,10 +450,10 @@
44.106 "-------- fun matchsub -------------------------------------------------------------------------";
44.107 "-------- fun matchsub -------------------------------------------------------------------------";
44.108 "-------- fun matchsub -------------------------------------------------------------------------";
44.109 -if matchsub thy (TermC.str2term "(a + (b + c))") (TermC.str2term "?x + (?y + ?z)")
44.110 +if matchsub thy (TermC.parse_test @{context} "(a + (b + c))") (TermC.parse_patt_test @{theory} "?x + (?y + ?z)")
44.111 then () else error "tools.sml matchsub a + (b + c)";
44.112
44.113 -if matchsub thy (TermC.str2term "(a + (b + c)) + d") (TermC.str2term "?x + (?y + ?z)")
44.114 +if matchsub thy (TermC.parse_test @{context} "(a + (b + c)) + d") (TermC.parse_patt_test @{theory} "?x + (?y + ?z)")
44.115 then () else error "tools.sml matchsub (a + (b + c)) + d";
44.116
44.117
44.118 @@ -465,9 +465,9 @@
44.119 | _ => error "TermC.UniversalList changed 1";
44.120 case or2list @{term False} of Const (\<^const_name>\<open>Nil\<close>, _) => ()
44.121 | _ => error "TermC.UniversalList changed 2";
44.122 -val t = (TermC.str2term "x=3");
44.123 +val t = (TermC.parse_test @{context} "x=3");
44.124 if UnparseC.term (or2list t) = "[x = 3]" then ()
44.125 else error "or2list changed";
44.126 -val t = (TermC.str2term "x=3 | x=-3 | x=0");
44.127 +val t = (TermC.parse_test @{context} "x=3 | x=-3 | x=0");
44.128 if UnparseC.term (or2list t) = "[x = 3, x = - 3, x = 0]" then ()
44.129 else error "HOL.eq ? HOL.disj ? changed";
45.1 --- a/test/Tools/isac/Specify/m-match.sml Sun Oct 09 06:53:03 2022 +0200
45.2 +++ b/test/Tools/isac/Specify/m-match.sml Sun Oct 09 07:44:22 2022 +0200
45.3 @@ -60,7 +60,7 @@
45.4 Free (dI',_) $
45.5 (Const (\<^const_name>\<open>Pair\<close>,_) $ pI' $ mI')) $ ags' =
45.6 (*...copied from LItool.tac_from_prog*)
45.7 - TermC.str2term (
45.8 + TermC.parse_test @{context} (
45.9 "SubProblem (EqSystemX, [LINEAR, system], [no_met]) " ^
45.10 " [BOOL_LIST [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2]," ^
45.11 " REAL_LIST [c, c_2]]");
45.12 @@ -85,7 +85,7 @@
45.13 Free (dI',_) $
45.14 (Const (\<^const_name>\<open>Pair\<close>,_) $ pI' $ mI')) $ ags' =
45.15 (*...copied from LItool.tac_from_prog*)
45.16 - TermC.str2term (
45.17 + TermC.parse_test @{context} (
45.18 "SubProblem (EqSystemX, [LINEAR, system], [no_met]) " ^
45.19 " [BOOL_LIST [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2]," ^
45.20 " REAL_LIST [c, c_2], BOOL_LIST ss''']");
45.21 @@ -111,7 +111,7 @@
45.22 Free (dI',_) $
45.23 (Const (\<^const_name>\<open>Pair\<close>,_) $ pI' $ mI')) $ ags' =
45.24 (*...copied from LItool.tac_from_prog*)
45.25 - TermC.str2term (
45.26 + TermC.parse_test @{context} (
45.27 "SubProblem (EqSystemX, [LINEAR, system], [no_met]) " ^
45.28 " [REAL_LIST [c, c_2]]");
45.29 val ags = isalist2list ags';
45.30 @@ -151,7 +151,7 @@
45.31 Free (dI',_) $
45.32 (Const (\<^const_name>\<open>Pair\<close>,_) $ pI' $ mI')) $ ags' =
45.33 (*...copied from LItool.tac_from_prog*)
45.34 - TermC.str2term (
45.35 + TermC.parse_test @{context} (
45.36 "SubProblem (EqSystemX, [LINEAR, system], [no_met]) " ^
45.37 " [BOOL_LIST [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2]," ^
45.38 " REAL_LIST [c, c_2]]");
45.39 @@ -176,7 +176,7 @@
45.40 Free (dI',_) $
45.41 (Const (\<^const_name>\<open>Pair\<close>,_) $ pI' $ mI')) $ ags' =
45.42 (*...copied from LItool.tac_from_prog*)
45.43 - TermC.str2term (
45.44 + TermC.parse_test @{context} (
45.45 "SubProblem (EqSystemX, [LINEAR, system], [no_met]) " ^
45.46 " [BOOL_LIST [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2]," ^
45.47 " REAL_LIST [c, c_2], BOOL_LIST ss''']");
45.48 @@ -202,7 +202,7 @@
45.49 Free (dI',_) $
45.50 (Const (\<^const_name>\<open>Pair\<close>,_) $ pI' $ mI')) $ ags' =
45.51 (*...copied from LItool.tac_from_prog*)
45.52 - TermC.str2term (
45.53 + TermC.parse_test @{context} (
45.54 "SubProblem (EqSystemX, [LINEAR, system], [no_met]) " ^
45.55 " [REAL_LIST [c, c_2]]");
45.56 val ags = isalist2list ags';
45.57 @@ -247,7 +247,7 @@
45.58 Free (dI',_) $
45.59 (Const (\<^const_name>\<open>Pair\<close>,_) $ pI' $ mI')) $ ags' =
45.60 (*...copied from LItool.tac_from_prog*)
45.61 - TermC.str2term (
45.62 + TermC.parse_test @{context} (
45.63 "SubProblem (TestX,[univariate,equation,test]," ^
45.64 " [no_met]) [BOOL (x+1=2), REAL x]");
45.65 val AGS = isalist2list ags';
45.66 @@ -265,7 +265,7 @@
45.67 Free (dI',_) $
45.68 (Const (\<^const_name>\<open>Pair\<close>,_) $ pI' $ mI')) $ ags' =
45.69 (*...copied from LItool.tac_from_prog*)
45.70 - TermC.str2term (
45.71 + TermC.parse_test @{context} (
45.72 "SubProblem (TestX,[univariate,equation,test]," ^
45.73 " [no_met]) [BOOL (x+1=2), REAL x]");
45.74 val AGS = isalist2list ags';
46.1 --- a/test/Tools/isac/Specify/o-model.sml Sun Oct 09 06:53:03 2022 +0200
46.2 +++ b/test/Tools/isac/Specify/o-model.sml Sun Oct 09 07:44:22 2022 +0200
46.3 @@ -257,7 +257,7 @@
46.4 val pbt = [("#Given", (@{term "equality"}, @{term "e_e :: bool"})),
46.5 ("#Given", (@{term "solveFor"}, @{term "v_v :: real"} ))];
46.6 (*the model specific for an example*)
46.7 -val oris = [([1], "#Given", @{term "equality"} , [TermC.str2term "x+1= 2"]),
46.8 +val oris = [([1], "#Given", @{term "equality"} , [TermC.parse_test @{context} "x+1= 2"]),
46.9 ([1], "#Given", @{term "solveFor"} , [@{term "x :: real"} ])];
46.10 val cy = [("#Find", (@{term "solutions"}, @{term "v_v'i' :: bool list"}))];
46.11 (*...all must be true*)
46.12 @@ -274,7 +274,7 @@
46.13 val pbt = [("#Given", (@{term "equalities"}, @{term "e_s :: bool list"})),
46.14 ("#Given", (@{term "solveForVars v_s"}, @{term "v_s :: bool list"} ))];
46.15 (*the model specific for an example*)
46.16 -val oris = [([1], "#Given", @{term "equalities"} ,[TermC.str2term "[x_1+1=2,x_2=0]"]),
46.17 +val oris = [([1], "#Given", @{term "equalities"} ,[TermC.parse_test @{context} "[x_1+1=2,x_2=0]"]),
46.18 ([1], "#Given", @{term "solveForVars"} , [@{term "[x_1,x_2]::real list"}])];
46.19 val cy = [("#Find", (@{term "solution"}, @{term "ss''' :: bool list"}))
46.20 (*could be more than 1*)];