1.1 --- a/TODO.md Sat Jul 17 14:05:28 2021 +0200
1.2 +++ b/TODO.md Sun Jul 18 16:20:32 2021 +0200
1.3 @@ -30,8 +30,10 @@
1.4 - a few "hard" cases will remain, to be reconsidered eventually (e.g. differentiation);
1.5
1.6 * WN: eliminate ThmC.numerals_to_Free, use existing Isabelle/HOL representation, DONE partially;
1.7 - - TODO: ? how to do algebraic operations on numerals ? Presburger ? simplifier ?
1.8 - - TODO: clarify role of type "real" vs. "float" (see theory "HOL-Library.Float");
1.9 + + TOODOO are exclusive for this changeset; most follow from TOODOO.1
1.10 + + TOODOO.1: exception TYPE raised by Skip_Proof.make_thm
1.11 + + ? how to do algebraic operations on numerals ? Presburger ? simplifier ?
1.12 + + clarify role of type "real" vs. "float" (see theory "HOL-Library.Float");
1.13
1.14 * WN: DONE cleanup remaining ^^^ in comments (but sometimes it is just ASCII art), partially;
1.15 Left ^^^ in doc-isac (old master-theses, etc: "x^^^#2 + #8" ... # are left, too)
2.1 --- a/src/Tools/isac/Knowledge/Diff.thy Sat Jul 17 14:05:28 2021 +0200
2.2 +++ b/src/Tools/isac/Knowledge/Diff.thy Sun Jul 18 16:20:32 2021 +0200
2.3 @@ -150,23 +150,26 @@
2.4 preconds = [],
2.5 rew_ord = ("termlessI",termlessI),
2.6 erls = Rule_Set.append_rules "erls_diff_sym_conv" Rule_Set.empty
2.7 - [Rule.Eval ("Orderings.ord_class.less", Prog_Expr.eval_equ "#less_")
2.8 - ],
2.9 + [Rule.Eval ("Orderings.ord_class.less", Prog_Expr.eval_equ "#less_"),
2.10 + Rule.Eval ("Prog_Expr.matches", Prog_Expr.eval_matches "#matches_"),
2.11 + Rule.Eval ("Prog_Expr.is_atom", Prog_Expr.eval_is_atom "#is_atom_"),
2.12 + Rule.Eval ("Orderings.ord_class.less", Prog_Expr.eval_equ "#less_"),
2.13 + Rule.Thm ("not_false", ThmC.numerals_to_Free @{thm not_false}),
2.14 + Rule.Thm ("not_true", ThmC.numerals_to_Free @{thm not_true})],
2.15 srls = Rule_Set.Empty, calc = [], errpatts = [],
2.16 - rules = [Rule.Thm ("frac_sym_conv", ThmC.numerals_to_Free @{thm frac_sym_conv}),
2.17 - Rule.Thm ("sqrt_sym_conv", ThmC.numerals_to_Free @{thm sqrt_sym_conv}),
2.18 - Rule.Thm ("root_sym_conv", ThmC.numerals_to_Free @{thm root_sym_conv}),
2.19 - Rule.Thm ("sym_real_mult_minus1",
2.20 - ThmC.numerals_to_Free (@{thm real_mult_minus1} RS @{thm sym})),
2.21 - (*- ?z = "-1 * ?z"*)
2.22 - Rule.Thm ("rat_mult",ThmC.numerals_to_Free @{thm rat_mult}),
2.23 - (*a / b * (c / d) = a * c / (b * d)*)
2.24 - Rule.Thm ("times_divide_eq_right",ThmC.numerals_to_Free @{thm times_divide_eq_right}),
2.25 - (*?x * (?y / ?z) = ?x * ?y / ?z*)
2.26 - Rule.Thm ("times_divide_eq_left",ThmC.numerals_to_Free @{thm times_divide_eq_left}),
2.27 - (*?y / ?z * ?x = ?y * ?x / ?z*)
2.28 - Rule.Eval ("Groups.times_class.times", (**)eval_binop "#mult_")
2.29 - ],
2.30 + rules =
2.31 + [Rule.Thm ("frac_sym_conv", ThmC.numerals_to_Free @{thm frac_sym_conv}),
2.32 + Rule.Thm ("sqrt_sym_conv", ThmC.numerals_to_Free @{thm sqrt_sym_conv}),
2.33 + Rule.Thm ("root_sym_conv", ThmC.numerals_to_Free @{thm root_sym_conv}),
2.34 + Rule.Thm ("real_mult_minus1_sym", ThmC.numerals_to_Free (@{thm real_mult_minus1_sym}))
2.35 + (*"\<not>(z is_const) ==> - (z::real) = -1 * z"*),
2.36 + Rule.Thm ("rat_mult",ThmC.numerals_to_Free @{thm rat_mult}),
2.37 + (*a / b * (c / d) = a * c / (b * d)*)
2.38 + Rule.Thm ("times_divide_eq_right",ThmC.numerals_to_Free @{thm times_divide_eq_right}),
2.39 + (*?x * (?y / ?z) = ?x * ?y / ?z*)
2.40 + Rule.Thm ("times_divide_eq_left",ThmC.numerals_to_Free @{thm times_divide_eq_left}),
2.41 + (*?y / ?z * ?x = ?y * ?x / ?z*)
2.42 + Rule.Eval ("Groups.times_class.times", (**)eval_binop "#mult_")],
2.43 scr = Rule.Empty_Prog};
2.44
2.45 (*..*)
3.1 --- a/src/Tools/isac/Knowledge/EqSystem.thy Sat Jul 17 14:05:28 2021 +0200
3.2 +++ b/src/Tools/isac/Knowledge/EqSystem.thy Sun Jul 18 16:20:32 2021 +0200
3.3 @@ -67,7 +67,7 @@
3.4 end;
3.5
3.6 (*("occur_exactly_in", ("EqSystem.occur_exactly_in",
3.7 - eval_occur_exactly_in "#eval_occur_exactly_in_"))*)
3.8 + eval_occur_exactly_in "#eval_occur_exactly_in_") )*)
3.9 fun eval_occur_exactly_in _ "EqSystem.occur_exactly_in"
3.10 (p as (Const ("EqSystem.occur_exactly_in",_)
3.11 $ vs $ all $ t)) _ =
3.12 @@ -346,7 +346,9 @@
3.13 erls = Rule_Set.Empty, srls = Rule_Set.Empty, calc = [], errpatts = [],
3.14 rules = [(*for precond NTH_CONS ...*)
3.15 Rule.Eval ("Orderings.ord_class.less", Prog_Expr.eval_equ "#less_"),
3.16 - Rule.Eval ("Groups.plus_class.plus", (**)eval_binop "#add_")
3.17 + Rule.Eval ("Groups.plus_class.plus", (**)eval_binop "#add_"),
3.18 + Rule.Eval ("EqSystem.occur_exactly_in",
3.19 + eval_occur_exactly_in "#eval_occur_exactly_in_")
3.20 (*immediately repeated rewrite pushes
3.21 '+' into precondition !*)
3.22 ],
4.1 --- a/src/Tools/isac/Knowledge/PolyEq.thy Sat Jul 17 14:05:28 2021 +0200
4.2 +++ b/src/Tools/isac/Knowledge/PolyEq.thy Sun Jul 18 16:20:32 2021 +0200
4.3 @@ -1210,10 +1210,10 @@
4.4 and terms_ord x _ pr (ts, us) =
4.5 list_ord (term_ord' x pr (ThyC.get_theory "Isac_Knowledge"))(ts, us);
4.6
4.7 -in
4.8 +in(*local*)
4.9
4.10 fun ord_make_polynomial_in (pr:bool) thy subst (ts, us) =
4.11 - ((**)tracing ("*** subs variable is: " ^ (Env.subst2str subst)); (**)
4.12 + ((** )tracing ("*** subs variable is: " ^ (Env.subst2str subst)); ( **)
4.13 case subst of
4.14 (_, x) :: _ => (term_ord' x pr thy (TermC.numerals_to_Free ts, TermC.numerals_to_Free us) = LESS)
4.15 | _ => raise ERROR ("ord_make_polynomial_in called with subst = " ^ Env.subst2str subst))
4.16 @@ -1224,8 +1224,7 @@
4.17 ML\<open>
4.18 val order_add_mult_in = prep_rls'(
4.19 Rule_Def.Repeat{id = "order_add_mult_in", preconds = [],
4.20 - rew_ord = ("ord_make_polynomial_in",
4.21 - ord_make_polynomial_in false @{theory "Poly"}),
4.22 + rew_ord = ("ord_make_polynomial_in", ord_make_polynomial_in false @{theory "Poly"}),
4.23 erls = Rule_Set.empty,srls = Rule_Set.Empty,
4.24 calc = [], errpatts = [],
4.25 rules = [Rule.Thm ("mult.commute",ThmC.numerals_to_Free @{thm mult.commute}),
5.1 --- a/test/Tools/isac/ADDTESTS/All_Ctxt.thy Sat Jul 17 14:05:28 2021 +0200
5.2 +++ b/test/Tools/isac/ADDTESTS/All_Ctxt.thy Sun Jul 18 16:20:32 2021 +0200
5.3 @@ -127,7 +127,6 @@
5.4 \<close>
5.5
5.6 ML \<open>
5.7 -\<close> ML \<open>
5.8 if eq_set op = (UnparseC.terms_to_strings (Ctree.get_assumptions pt p),
5.9 ["matches (?a = ?b) (- 1 + x = 0)", "x < sub_asm_out", "x = 1", "precond_rootmet x"])
5.10 then () else error "All_Ctx: asms after finishing SubProblem";
5.11 @@ -147,7 +146,6 @@
5.12 \<close>
5.13
5.14 ML \<open>
5.15 -\<close> ML \<open>
5.16 if eq_set op = (UnparseC.terms_to_strings (Ctree.get_assumptions pt p),
5.17 ["matches (?a = ?b) (- 1 + x = 0)", "x < sub_asm_out", "x = 1", "precond_rootmet x"])
5.18 then () else error "All_Ctx at final result";
6.1 --- a/test/Tools/isac/ADDTESTS/course/SignalProcess/Build_Inverse_Z_Transform.thy Sat Jul 17 14:05:28 2021 +0200
6.2 +++ b/test/Tools/isac/ADDTESTS/course/SignalProcess/Build_Inverse_Z_Transform.thy Sun Jul 18 16:20:32 2021 +0200
6.3 @@ -654,7 +654,7 @@
6.4 of simplification occurs right here, in the next step.\<close>
6.5
6.6 ML \<open>
6.7 - Rewrite.trace_on := false;
6.8 + Rewrite.trace_on := false; (*true false*)
6.9 val SOME fract1 =
6.10 parseNEW ctxt "(z - 1/2)*(z - -1/4) * (A/(z - 1/2) + B/(z - -1/4))";
6.11 (*
6.12 @@ -1244,7 +1244,7 @@
6.13 tree and check if every node implements that what we have wanted.\<close>
6.14
6.15 ML \<open>
6.16 - Rewrite.trace_on := false; (*true*)
6.17 + Rewrite.trace_on := false; (*true false*)
6.18 LItool.trace_on := false; (*true*)
6.19 print_depth 9;
6.20
7.1 --- a/test/Tools/isac/ADDTESTS/course/phst11/T2_Rewriting.thy Sat Jul 17 14:05:28 2021 +0200
7.2 +++ b/test/Tools/isac/ADDTESTS/course/phst11/T2_Rewriting.thy Sun Jul 18 16:20:32 2021 +0200
7.3 @@ -55,7 +55,7 @@
7.4 \<close>
7.5 ML \<open>
7.6 val SOME (t, _) = Rewrite.rewrite_set_ thy true make_polynomial t; UnparseC.term t;
7.7 -Rewrite.trace_on := false;
7.8 +Rewrite.trace_on := false; (*true false*)
7.9 \<close>
7.10
7.11 section \<open>Note on bound variables\<close>
7.12 @@ -157,11 +157,11 @@
7.13 text \<open>The simplifiers are quite busy when finding the above results. you can
7.14 watch them at work by setting the switch 'Rewrite.trace_on:\<close>
7.15 ML \<open>
7.16 -Rewrite.trace_on := false;
7.17 +Rewrite.trace_on := false; (*true false*)
7.18 tracing "+++begin++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
7.19 val SOME (t, _) = Rewrite.rewrite_set_ thy true norm_Rational t2; UnparseC.term t;
7.20 tracing "+++end++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
7.21 -Rewrite.trace_on := false;
7.22 +Rewrite.trace_on := false; (*true false*)
7.23 \<close>
7.24 text \<open>You see what happend when you click the checkbox <Tracing> on the bar
7.25 separating this window from the Output-window.
8.1 --- a/test/Tools/isac/BaseDefinitions/contextC.sml Sat Jul 17 14:05:28 2021 +0200
8.2 +++ b/test/Tools/isac/BaseDefinitions/contextC.sml Sun Jul 18 16:20:32 2021 +0200
8.3 @@ -23,7 +23,7 @@
8.4 "----------- fun initialise --------------------------------------------------------------------";
8.5 "----------- fun initialise --------------------------------------------------------------------";
8.6 "----------- fun initialise --------------------------------------------------------------------";
8.7 -val t = @{term "a * b + -123 * c :: real"};
8.8 +val t = @{term "a * b + - 123 * c :: real"};
8.9 val ctxt = initialise "Rational" (vars t)
8.10
8.11 (*----- now parsing infers the type *)
8.12 @@ -75,8 +75,8 @@
8.13 "----------- fun avoid_contradict --------------------------------------------------------------";
8.14 val preds = [
8.15 (*0.pre*)TermC.str2term "x / (x \<up> 2 - 6 * x + 9) - 1 / (x \<up> 2 - 3 * x) =\n1 / x is_ratequation_in x",
8.16 -(*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"
8.17 -(*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"),
8.18 +(*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"
8.19 +(*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"),
8.20 (*0.asm*)TermC.str2term "x \<noteq> 0", (* <-------------- "x \<noteq> 0" would contradict "x = 0" ---\*)
8.21 (*0.asm*)TermC.str2term "9 * x + -6 * x \<up> 2 + x \<up> 3 \<noteq> 0"
8.22 ];
8.23 @@ -153,14 +153,14 @@
8.24
8.25 val (p,_,f,nxt,_,pt) = me nxt p [] pt; (* 0. solve-phase*)
8.26 val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
8.27 -val (p,_,f,nxt,_,pt) = me nxt p [] pt; f2str f = "(3 + -1 * x + x \<up> 2) * x = 1 * (9 * x + -6 * x \<up> 2 + x \<up> 3)";
8.28 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; f2str f = "(3 + - 1 * x + x \<up> 2) * x = 1 * (9 * x + -6 * x \<up> 2 + x \<up> 3)";
8.29
8.30 (*+*)if (Ctree.get_assumptions pt p |> map UnparseC.term) =
8.31 (*+*) ["x \<noteq> 0",
8.32 -(*+*) "9 * x + -6 * x \<up> 2 + x \<up> 3 \<noteq> 0",
8.33 +(*+*) "9 * x + - 6 * x \<up> 2 + x \<up> 3 \<noteq> 0",
8.34 (*+*) "x / (x \<up> 2 - 6 * x + 9) - 1 / (x \<up> 2 - 3 * x) =\n1 / x is_ratequation_in x"]
8.35 (*+*)then () else error "assumptions before 1. Subproblem CHANGED";
8.36 -(*+*)if p = ([3], Res) andalso f2str f = "(3 + -1 * x + x \<up> 2) * x = 1 * (9 * x + -6 * x \<up> 2 + x \<up> 3)"
8.37 +(*+*)if p = ([3], Res) andalso f2str f = "(3 + - 1 * x + x \<up> 2) * x = 1 * (9 * x + - 6 * x \<up> 2 + x \<up> 3)"
8.38 (*+*)then
8.39 (*+*) ((case nxt of Subproblem ("PolyEq", ["normalise", "polynomial", "univariate", "equation"]) => ()
8.40 (*+*) | _ => error ("S.68, Bsp.: 40 nxt =" ^ Tactic.input_to_string nxt)))
8.41 @@ -177,6 +177,18 @@
8.42
8.43 val (p,_,f,nxt,_,pt) = me nxt p [] pt; (* 1. solve-phase *)
8.44 val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
8.45 +
8.46 +
8.47 +(* TOODOO make_ratpoly: "- 6 * x + 5 * x \<up> 2 = 0" \<longrightarrow> "- (6 * x) + 5 * x \<up> 2 = 0" ------------\\
8.48 +NO NO -----------------^^^^^^^^^^^^^^^^^, rather:
8.49 +## rls: reduce_012 on: - 6 * x + 5 * x \<up> 2 = 0
8.50 +### try thm: "mult_1_left"
8.51 +### try thm: "minus_mult_left"
8.52 +#### eval asms: "- 6 * x = - (6 * x)"
8.53 + ^^^^^^^^ HERE APPLIES minus_mult_left SINCE NEW numerals
8.54 +### rewrites to: "- (6 * x) + 5 * x \<up> 2 = 0"
8.55 +
8.56 +(* IN THE STEP BELOW ---vvv--- THE SYSTEM HANGS *)
8.57 val (p,_,f,nxt,_,pt) = me nxt p [] pt; f2str f = "-6 * x + 5 * x \<up> 2 = 0";
8.58
8.59 if p = ([4, 3], Res) andalso f2str f = "-6 * x + 5 * x \<up> 2 = 0"
8.60 @@ -203,8 +215,8 @@
8.61
8.62 (* *)if eq_set op = ((Ctree.get_assumptions pt p |> map UnparseC.term), [
8.63 (*0.pre*) "x / (x \<up> 2 - 6 * x + 9) - 1 / (x \<up> 2 - 3 * x) =\n1 / x is_ratequation_in x",
8.64 -(*1.pre*) "\<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"
8.65 -(*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",
8.66 +(*1.pre*) "\<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"
8.67 +(*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",
8.68 (*2.pre*) "lhs (-6 * x + 5 * x \<up> 2 = 0) is_poly_in x",
8.69 (*2.pre*) "lhs (-6 * x + 5 * x \<up> 2 = 0) has_degree_in x = 2",
8.70 (*0.asm*) "x \<noteq> 0",
8.71 @@ -249,8 +261,8 @@
8.72
8.73 (* *)if eq_set op = (map UnparseC.term (get_assumptions ctxt_parent), [
8.74 (*0.pre*) "x / (x \<up> 2 - 6 * x + 9) - 1 / (x \<up> 2 - 3 * x) =\n1 / x is_ratequation_in x",
8.75 -(*1.pre*) "\<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"
8.76 -(*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",
8.77 +(*1.pre*) "\<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"
8.78 +(*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",
8.79 (*0.asm*) "x \<noteq> 0",
8.80 (*0.asm*) "9 * x + -6 * x \<up> 2 + x \<up> 3 \<noteq> 0"
8.81 (* *)])
8.82 @@ -260,8 +272,8 @@
8.83 ContextC.subpbl_to_caller sub_ctxt prog_res ctxt_parent;
8.84 (* *)if eq_set op = (map UnparseC.term (get_assumptions ctxt'), [
8.85 (*0.pre*) "x / (x \<up> 2 - 6 * x + 9) - 1 / (x \<up> 2 - 3 * x) =\n1 / x is_ratequation_in x",
8.86 -(*1.pre*) "\<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"
8.87 -(*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",
8.88 +(*1.pre*) "\<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"
8.89 +(*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",
8.90 (*0.asm*) "9 * x + -6 * x \<up> 2 + x \<up> 3 \<noteq> 0",
8.91 (*0.asm*) "x \<noteq> 0", (* <----------------------- "x \<noteq> 0" contradiction resoved ---\*)
8.92 (*2.pre*) "lhs (-6 * x + 5 * x \<up> 2 = 0) is_poly_in x",
8.93 @@ -308,7 +320,9 @@
8.94 if f2str f = "[x = 6 / 5]" andalso map UnparseC.term (Ctree.get_assumptions pt p) =
8.95 ["x = 6 / 5", "lhs (-6 * x + 5 * x \<up> 2 = 0) is_poly_in x",
8.96 "lhs (-6 * x + 5 * x \<up> 2 = 0) has_degree_in x = 2",
8.97 - "\<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\<not> lhs ((3 + -1 * x + x \<up> 2) * x =\n 1 * (9 * x + -6 * x \<up> 2 + x \<up> 3)) is_poly_in x",
8.98 + "\<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\<not> lhs ((3 + - 1 * x + x \<up> 2) * x =\n 1 * (9 * x + -6 * x \<up> 2 + x \<up> 3)) is_poly_in x",
8.99 "x \<noteq> 0", "9 * x + -6 * x \<up> 2 + x \<up> 3 \<noteq> 0",
8.100 "x / (x \<up> 2 - 6 * x + 9) - 1 / (x \<up> 2 - 3 * x) =\n1 / x is_ratequation_in x"]
8.101 then () else error "test CHANGED";
8.102 +(**) TOODOO make_ratpoly: "- 6 * x + 5 * x \<up> 2 = 0" \<longrightarrow> "- (6 * x) + 5 * x \<up> 2 = 0" --------//*)
8.103 +
9.1 --- a/test/Tools/isac/BaseDefinitions/rewrite-order.sml Sat Jul 17 14:05:28 2021 +0200
9.2 +++ b/test/Tools/isac/BaseDefinitions/rewrite-order.sml Sun Jul 18 16:20:32 2021 +0200
9.3 @@ -19,18 +19,18 @@
9.4 "-------- identify difference in term-order between isa=NEW, isa2+OLD --------------------------";
9.5 val form = TermC.str2term "x + -2 ::real"
9.6 val Repeat {rew_ord = ("sqrt_right", rew_ord_), erls, ...} = Test_simplify;
9.7 -Rewrite.trace_on := true;
9.8 +Rewrite.trace_on := false; (*true false*)
9.9 (** )val NONE = ( *isa*)
9.10 (**)val SOME (form', _) = (*isa2*)
9.11 rewrite_ @{theory Test} rew_ord_ erls true @{thm radd_commute} form;
9.12 (*
9.13 -------------------- code in rew_sub -------------------------------------------------------
9.14 -((*TOODOO*)
9.15 +(
9.16 @{print}{a = "@@@rew_sub.ord.rew: ", perm = TermC.perm lhs rhs, tless = not (tless bdv (t', t))};
9.17 if TermC.perm lhs rhs andalso not (tless bdv (t', t)) (*ordered rewriting*)
9.18 then (trace_eq2 i "not >" thy t t'; raise NO_REWRITE)
9.19 else (t'', p'', [], true)
9.20 -)(*TOODOO*)
9.21 +)
9.22 -------------------- output with Rewrite.trace_on := true; ---------------------------------
9.23 ## eval asms: "x + -2 = -2 + x"
9.24 {a = "@@@rew_sub.ord.rew: ", b = true, c = false}
10.1 --- a/test/Tools/isac/BridgeLibisabelle/thy-hierarchy.sml Sat Jul 17 14:05:28 2021 +0200
10.2 +++ b/test/Tools/isac/BridgeLibisabelle/thy-hierarchy.sml Sun Jul 18 16:20:32 2021 +0200
10.3 @@ -33,7 +33,7 @@
10.4
10.5 val [_, (thmID, term)] = Thy_Hierarchy.thms_of_rlss thy rlss;
10.6
10.7 -if thmID = "Poly.real_mult_minus1" (* WAS "??.unknown" from Pure/more_thm.ML *)
10.8 +if thmID = "Poly.real_mult_minus1_sym"
10.9 then () else error "thms_of_rlss changed";
10.10
10.11 "~~~~~ fun thms_of_rlss, args:"; val (thy, rlss) = (@{theory Isac_Knowledge}, rlss);
11.1 --- a/test/Tools/isac/Interpret/lucas-interpreter.sml Sat Jul 17 14:05:28 2021 +0200
11.2 +++ b/test/Tools/isac/Interpret/lucas-interpreter.sml Sun Jul 18 16:20:32 2021 +0200
11.3 @@ -248,37 +248,31 @@
11.4 val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
11.5 val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
11.6 val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
11.7 -(*[1], Frm*)val (p''''',_,f,nxt''''',_,pt''''') = me nxt p [] pt; (*nxt = Rewrite_Set "ordne_alphabetisch"*)
11.8 - (*//---------------- adhoc inserted TOODOO ------------------------------------------------\\*)
11.9 -val Test_Out.FormKF "5 * e + 6 * f - 8 * g - 9 - 7 * e - 4 * f + 10 * g + 12" = f; (*isa == isa2*)
11.10 -(** )val Test_Out.FormKF "??.empty" = f; ( *isa*)
11.11 +(*[1], Frm*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Rewrite_Set "ordne_alphabetisch"*)
11.12
11.13 -(** )val Test_Out.FormKF "- 9 + 12 + 5 * e + 6 * f - 8 * g - 7 * e - 4 * f + 10 * g" = f; ( *isa*)
11.14 -(**)val Test_Out.FormKF "5 * e + 6 * f - 8 * g - 9 - 7 * e - 4 * f + 10 * g + 12" = f; (*isa*)
11.15 -(** )val Test_Out.FormKF "- 9 + 12 + 5 * e - 7 * e + 6 * f - 4 * f - 8 * g + 10 * g" = f;( *isa2*)
11.16 -(*\\---------------- adhoc inserted TOODOO ------------------------------------------------//*)
11.17 +(*+*)val Test_Out.FormKF "5 * e + 6 * f - 8 * g - 9 - 7 * e - 4 * f + 10 * g + 12" = f
11.18 +
11.19 +(*[1], Res*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Rewrite_Set "fasse_zusammen"*)
11.20 +
11.21 +(*+*)val Test_Out.FormKF "- 9 + 12 + 5 * e - 7 * e + 6 * f - 4 * f - 8 * g + 10 * g" = f;
11.22
11.23 (*+*)if map Tactic.input_to_string (specific_from_prog pt p) =
11.24 -(** )
11.25 - ["Rewrite (\"tausche_plus_plus\", \"?b kleiner ?c \<Longrightarrow> ?a + ?c + ?b = ?a + ?b + ?c\")",
11.26 - "Rewrite (\"tausche_minus_minus\", \"?b kleiner ?c \<Longrightarrow> ?a - ?c - ?b = ?a - ?b - ?c\")"]
11.27 -( **) (*^^^---isa vvv---isa2 TOODOO*)
11.28 ["Rewrite (\"subtrahiere_x_plus_minus\", \"\<lbrakk>?l is_const; ?m is_const\<rbrakk>\n\<Longrightarrow> ?x + ?m * ?v - ?l * ?v = ?x + (?m - ?l) * ?v\")",
11.29 - "Rewrite (\"subtrahiere_x_minus_plus\", \"\<lbrakk>?l is_const; ?m is_const\<rbrakk>\n\<Longrightarrow> ?x - ?m * ?v + ?l * ?v = ?x + (- ?m + ?l) * ?v\")"]
11.30 -(**)
11.31 + "Rewrite (\"subtrahiere_x_minus_plus\", \"\<lbrakk>?l is_const; ?m is_const\<rbrakk>\n\<Longrightarrow> ?x - ?m * ?v + ?l * ?v = ?x + (- ?m + ?l) * ?v\")",
11.32 +(*this is new since ThmC.numerals_to_Free..*)
11.33 + "Calculate PLUS"]
11.34 + then () else error "specific_from_prog ([1], Res) CHANGED"; (*GOON*)
11.35 +(*[2], Res*)val ("ok", (_, _, ptp as (pt, p))) = Step.by_tactic (hd (specific_from_prog pt p)) (pt, p);
11.36 +
11.37 +(*+*)if map Tactic.input_to_string (specific_from_prog pt p) =
11.38 + ["Rewrite (\"tausche_minus\", \"\<lbrakk>?b ist_monom; ?a kleiner ?b\<rbrakk>\n\<Longrightarrow> ?b - ?a = - ?a + ?b\")",
11.39 + "Rewrite (\"tausche_plus_minus\", \"?b kleiner ?c \<Longrightarrow> ?a + ?c - ?b = ?a - ?b + ?c\")",
11.40 + "Rewrite (\"subtrahiere_x_plus_minus\", \"\<lbrakk>?l is_const; ?m is_const\<rbrakk>\n\<Longrightarrow> ?x + ?m * ?v - ?l * ?v = ?x + (?m - ?l) * ?v\")",
11.41 + "Rewrite (\"subtrahiere_x_minus_plus\", \"\<lbrakk>?l is_const; ?m is_const\<rbrakk>\n\<Longrightarrow> ?x - ?m * ?v + ?l * ?v = ?x + (- ?m + ?l) * ?v\")",
11.42 + "Calculate PLUS", (*..this is new since ThmC.numerals_to_Free*)
11.43 + "Calculate MINUS"]
11.44 then () else error "specific_from_prog ([1], Res) CHANGED";
11.45 -(*[2], Res*)val ("ok", (_, _, ptp as (pt, p))) = Step.by_tactic (hd (specific_from_prog pt p)) (pt, p);
11.46 -(*\\---------------- adhoc inserted TOODOO ------------------------------------------------//*)
11.47 -(*+*)if map Tactic.input_to_string (specific_from_prog pt p) =
11.48 -(** )
11.49 - ["Rewrite (\"tausche_minus_plus\", \"?b kleiner ?c \<Longrightarrow> ?a - ?c + ?b = ?a + ?b - ?c\")",
11.50 - "Rewrite (\"tausche_minus_minus\", \"?b kleiner ?c \<Longrightarrow> ?a - ?c - ?b = ?a - ?b - ?c\")"]
11.51 -( **) (*^^^---isa vvv---isa2 TOODOO*)
11.52 - ["Rewrite (\"tausche_minus\", \"\<lbrakk>?b ist_monom; ?a kleiner ?b\<rbrakk>\n\<Longrightarrow> ?b - ?a = - ?a + ?b\")", "Rewrite (\"tausche_plus_minus\", \"?b kleiner ?c \<Longrightarrow> ?a + ?c - ?b = ?a - ?b + ?c\")",
11.53 - "Rewrite (\"subtrahiere_x_plus_minus\", \"\<lbrakk>?l is_const; ?m is_const\<rbrakk>\n\<Longrightarrow> ?x + ?m * ?v - ?l * ?v = ?x + (?m - ?l) * ?v\")",
11.54 - "Rewrite (\"subtrahiere_x_minus_plus\", \"\<lbrakk>?l is_const; ?m is_const\<rbrakk>\n\<Longrightarrow> ?x - ?m * ?v + ?l * ?v = ?x + (- ?m + ?l) * ?v\")", "Calculate MINUS"]
11.55 -(**)
11.56 - then () else error "specific_from_prog ([1], Res) CHANGED";
11.57 +
11.58 (* = ([3], Res)*)val ("ok", (_, _, ptp as (pt, p))) = Step.by_tactic (hd (specific_from_prog pt p)) (pt, p);
11.59
11.60 (*//----------------- exception PTREE "get_obj f EmptyPtree" raised --------------------------\\*)
11.61 @@ -348,7 +342,7 @@
11.62 LItool.associate pt ctxt (tac, prog_tac) (*of*);
11.63 val _(*ORundef*) = (*case*) or (*of*);
11.64
11.65 -(*+*)Solve_Step.check (LItool.tac_from_prog pt (ThyC.get_theory "Isac_Knowledge") prog_tac) (pt, p)
11.66 +(*+*)Solve_Step.check (LItool.tac_from_prog pt (ThyC.get_theory "Isac_Knowledge") prog_tac) (pt, p);
11.67
11.68 val Applicable.Yes m' =
11.69 (*case*) Solve_Step.check (LItool.tac_from_prog pt (ThyC.get_theory "Isac_Knowledge") prog_tac) (pt, p) (*of*);
12.1 --- a/test/Tools/isac/Knowledge/biegelinie-1.sml Sat Jul 17 14:05:28 2021 +0200
12.2 +++ b/test/Tools/isac/Knowledge/biegelinie-1.sml Sun Jul 18 16:20:32 2021 +0200
12.3 @@ -82,8 +82,7 @@
12.4 if UnparseC.term x1__ = "0" then ()
12.5 else error "biegelinie.sml simplify argument_in (lhs (M_b 0 = 0)";
12.6
12.7 -(** )Rewrite.trace_on := true;( **)
12.8 -(**)Rewrite.trace_on := false;(**)
12.9 +Rewrite.trace_on := false; (*true false*)
12.10
12.11 "----------- SubProblem (_,[setzeRandbedingungen,Biegelinien] ----";
12.12 "----------- SubProblem (_,[setzeRandbedingungen,Biegelinien] ----";
13.1 --- a/test/Tools/isac/Knowledge/diff.sml Sat Jul 17 14:05:28 2021 +0200
13.2 +++ b/test/Tools/isac/Knowledge/diff.sml Sun Jul 18 16:20:32 2021 +0200
13.3 @@ -1,13 +1,11 @@
13.4 -(*
13.5 -
13.6 -use"../smltest/IsacKnowledge/diff.sml";
13.7 -use"diff.sml";
13.8 +(* Title: test/Tools/isac/Knowledge/diff.sml
13.9 + Author: Walther Neuper
13.10 + Use is subject to license terms.
13.11 *)
13.12 -
13.13 -"--------------------------------------------------------";
13.14 -"--------------------------------------------------------";
13.15 -"table of contents --------------------------------------";
13.16 -"--------------------------------------------------------";
13.17 +"-----------------------------------------------------------------------------------------------";
13.18 +"-----------------------------------------------------------------------------------------------";
13.19 +"table of contents -----------------------------------------------------------------------------";
13.20 +"-----------------------------------------------------------------------------------------------";
13.21 "----------- problemtype --------------------------------";
13.22 "----------- for correction of diff_const ---------------";
13.23 "----------- for correction of diff_quot ----------------";
13.24 @@ -323,7 +321,7 @@
13.25 Iterator 1;
13.26 moveActiveRoot 1;
13.27 autoCalculate 1 CompleteCalc;
13.28 -(* Rewrite.trace_on := true;
13.29 +(* Rewrite.trace_on := false; (*true false*)
13.30 LItool.trace_on := false;
13.31 *)
13.32 val ((pt,p),_) = get_calc 1; Test_Tool.show_pt pt;
13.33 @@ -343,11 +341,11 @@
13.34 ["diff", "after_simplification"]))];
13.35 Iterator 1;
13.36 moveActiveRoot 1;
13.37 -(* Rewrite.trace_on := true;
13.38 +(* Rewrite.trace_on := false; (*true false*)
13.39 LItool.trace_on := true;
13.40 *)
13.41 autoCalculate 1 CompleteCalc;
13.42 -(* Rewrite.trace_on := false;
13.43 +(* Rewrite.trace_on := false; Rewrite.trace_on := false; (*true false*)
13.44 LItool.trace_on := false;
13.45 *)
13.46 val ((pt,p),_) = get_calc 1; Test_Tool.show_pt pt;
14.1 --- a/test/Tools/isac/Knowledge/diffapp.sml Sat Jul 17 14:05:28 2021 +0200
14.2 +++ b/test/Tools/isac/Knowledge/diffapp.sml Sun Jul 18 16:20:32 2021 +0200
14.3 @@ -6,7 +6,7 @@
14.4 use"diffapp.sml";
14.5 *)
14.6
14.7 -Rewrite.trace_on := false;
14.8 +Rewrite.trace_on := false; (*true false*)
14.9 "Contents----------------------------------------------";
14.10 " Specify_Problem (match_itms_oris) ";
14.11 " test specify, fmz <> [] ";
14.12 @@ -668,9 +668,9 @@
14.13 UnparseC.term s;
14.14 val t = TermC.str2term
14.15 "(hd o filterVar A) [A = a * b, a / 2 = r * sin alpha, b / 2 = r * cos alpha]";
14.16 -Rewrite.trace_on := false;
14.17 +Rewrite.trace_on := false; (*true false*)
14.18 val SOME (t',_) = rewrite_set_ thy false prog_expr t;
14.19 -Rewrite.trace_on:=false;
14.20 +Rewrite.trace_on:=false; (*true false*)
14.21 val s' = UnparseC.term t';
14.22 (*=== inhibit exn 110726=============================================================
14.23 if s' = "A = a * b" then() else error "new behaviour with prog_expr 3.1.";
15.1 --- a/test/Tools/isac/Knowledge/eqsystem.sml Sat Jul 17 14:05:28 2021 +0200
15.2 +++ b/test/Tools/isac/Knowledge/eqsystem.sml Sun Jul 18 16:20:32 2021 +0200
15.3 @@ -3,7 +3,7 @@
15.4 (c) due to copyright terms
15.5 *)
15.6
15.7 -Rewrite.trace_on := false;
15.8 +Rewrite.trace_on := false; (*true false*)
15.9 "-----------------------------------------------------------------";
15.10 "table of contents -----------------------------------------------";
15.11 "-----------------------------------------------------------------";
15.12 @@ -365,7 +365,7 @@
15.13 [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2]"]*)
15.14 val t = TermC.str2term ("[c, c_2] from [c, c_2] occur_exactly_in NTH 2" ^
15.15 "[c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2]");
15.16 -Rewrite.trace_on := false;
15.17 +Rewrite.trace_on := false; (*true false*)
15.18 val SOME (t',_) = rewrite_set_ thy false prls_triangular t;
15.19 (*found:...
15.20 ## try thm: NTH_CONS
15.21 @@ -377,7 +377,7 @@
15.22 ### asms accepted: ["1 < 2 + - 1"] stored: ["1 < 2 + - 1"]
15.23
15.24 ... i.e Eval ("Groups.plus_class.plus", eval_binop "#add_") was missing in erls_prls_triangular*)
15.25 -Rewrite.trace_on:=false;
15.26 +Rewrite.trace_on:=false; (*true false*)
15.27
15.28 "===== case 3: relaxed preconditions for triangular system =====";
15.29 val fmz = ["equalities [L * q_0 = c, \
15.30 @@ -426,9 +426,9 @@
15.31 val fmz = ["equalities [0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2,\
15.32 \0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2]",
15.33 "solveForVars [c, c_2]", "solution LL"];
15.34 -Rewrite.trace_on := false;
15.35 +Rewrite.trace_on := false; (*true false*)
15.36 val matches = Refine.refine fmz ["2x2", "LINEAR", "system"];
15.37 -Rewrite.trace_on:=false;
15.38 +Rewrite.trace_on:=false; (*true false*)
15.39 (*default_print_depth 11;*) TermC.matches; (*default_print_depth 3;*)
15.40 (*brought: 'False "length_ es_ = 2"'*)
15.41
15.42 @@ -815,11 +815,12 @@
15.43 if f2str f ="[c = L * q_0, L * c + c_2 = q_0 * L \<up> 2 / 2, c_3 = 0, c_4 = 0]"
15.44 then () else error "eqsystem.sml: exp 7.70 normalise 4x4 by met changed";
15.45 --------------------------------------------------------------------------*)
15.46 +============ inhibit exn WN120314 ==============================================*)
15.47
15.48 "----- 7.70 with met top_down_: me";
15.49 -val fmz = ["equalities \
15.50 - \[c = L * q_0, L * c + c_2 = q_0 * L \<up> 2 / 2, c_3 = 0, c_4 = 0]",
15.51 - "solveForVars [c, c_2, c_3, c_4]", "solution LL"];
15.52 +val fmz = [
15.53 + "equalities [(c::real) = L * q_0, L * c + (c_2::real) = q_0 * L \<up> 2 / 2, (c_3::real) = 0, (c_4::real) = 0]",
15.54 + "solveForVars [(c::real), (c_2::real), (c_3::real), (c_4::real)]", "solution LL"];
15.55 val (dI',pI',mI') =
15.56 ("Biegelinie",["LINEAR", "system"],["no_met"]);
15.57 val p = e_pos'; val c = [];
15.58 @@ -839,7 +840,6 @@
15.59 if nxt = ("End_Proof'", End_Proof') andalso
15.60 f2str f = "[c = L * q_0, c_2 = - 1 * L \<up> 2 * q_0 / 2, c_3 = 0, c_4 = 0]"
15.61 then () else error "eqsystem.sml: 7.70 with met top_down_: me";
15.62 -============ inhibit exn WN120314 ==============================================*)
15.63
15.64 "------- Bsp 7.71";
15.65 reset_states ();
16.1 --- a/test/Tools/isac/Knowledge/integrate.sml Sat Jul 17 14:05:28 2021 +0200
16.2 +++ b/test/Tools/isac/Knowledge/integrate.sml Sun Jul 18 16:20:32 2021 +0200
16.3 @@ -1,5 +1,5 @@
16.4 -(* tests on integration over the reals
16.5 - author: Walther Neuper 2005
16.6 +(* Title: test/Tools/isac/Knowledge/integrate.sml
16.7 + Author: Walther Neuper 050826
16.8 (c) due to copyright terms
16.9 *)
16.10 "--------------------------------------------------------";
17.1 --- a/test/Tools/isac/Knowledge/poly-1.sml Sat Jul 17 14:05:28 2021 +0200
17.2 +++ b/test/Tools/isac/Knowledge/poly-1.sml Sun Jul 18 16:20:32 2021 +0200
17.3 @@ -261,7 +261,7 @@
17.4 "-------- fun is_addUnordered (x \<up> 2 * y \<up> 2 + x \<up> 3 * y) --------------------------------------";
17.5 "-------- fun is_addUnordered (x \<up> 2 * y \<up> 2 + x \<up> 3 * y) --------------------------------------";
17.6 val t = TermC.str2term "x \<up> 2 * y \<up> 2 + x * x \<up> 2 * y";
17.7 -Rewrite.trace_on := false;
17.8 +Rewrite.trace_on := false; (*true false*)
17.9 val SOME (t, _) = rewrite_set_ thy false make_polynomial t; UnparseC.term t;
17.10 UnparseC.term t = "x \<up> 2 * y \<up> 2 + x \<up> 3 * y";
17.11 if UnparseC.term t = "x \<up> 3 * y + x \<up> 2 * y \<up> 2" then ()
18.1 --- a/test/Tools/isac/Knowledge/poly-2.sml Sat Jul 17 14:05:28 2021 +0200
18.2 +++ b/test/Tools/isac/Knowledge/poly-2.sml Sun Jul 18 16:20:32 2021 +0200
18.3 @@ -604,9 +604,9 @@
18.4 ... then Rewrite.trace_on:*)
18.5
18.6 "----- 2 ---";
18.7 -Rewrite.trace_on := false;
18.8 +Rewrite.trace_on := false; (*true false*)
18.9 M_Match.match_pbl fmz pbt;
18.10 -Rewrite.trace_on := false;
18.11 +Rewrite.trace_on := false; (*true false*)
18.12 (*... if there is no rewrite, then there is something wrong with prls*)
18.13
18.14 "-----3 ---";
19.1 --- a/test/Tools/isac/Knowledge/polyeq-1.sml Sat Jul 17 14:05:28 2021 +0200
19.2 +++ b/test/Tools/isac/Knowledge/polyeq-1.sml Sun Jul 18 16:20:32 2021 +0200
19.3 @@ -49,9 +49,8 @@
19.4 "----------- tests on predicates in problems ---------------------";
19.5 "----------- tests on predicates in problems ---------------------";
19.6 "----------- tests on predicates in problems ---------------------";
19.7 -(* Rewrite.trace_on:=true;
19.8 - Rewrite.trace_on:=false;
19.9 -*)
19.10 +Rewrite.trace_on:=true; (*true false*)
19.11 +
19.12 val t1 = (Thm.term_of o the o (TermC.parse thy)) "lhs (-8 - 2*x + x \<up> 2 = 0)";
19.13 val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t1;
19.14 if ((UnparseC.term t) = "-8 - 2 * x + x \<up> 2") then ()
19.15 @@ -160,7 +159,7 @@
19.16 "x \<up> 2 + (- 1 * (b * x)) + (b + - 1 * x) * a = 0"*)
19.17
19.18 (*das rewriting l"asst sich beobachten mit
19.19 -Rewrite.trace_on := false;
19.20 +Rewrite.trace_on := false; (*true false*)
19.21 *)
19.22
19.23 "------ 15.11.02 --------------------------";
19.24 @@ -168,7 +167,7 @@
19.25 val bdv = (Thm.term_of o the o (TermC.parse thy)) "bdv";
19.26 val a = (Thm.term_of o the o (TermC.parse thy)) "a";
19.27
19.28 -Rewrite.trace_on := false;
19.29 +Rewrite.trace_on := false; (*true false*)
19.30 (* Anwenden einer Regelmenge aus Termorder.ML: *)
19.31 val SOME (t,_) =
19.32 rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
20.1 --- a/test/Tools/isac/Knowledge/polyeq-2.sml Sat Jul 17 14:05:28 2021 +0200
20.2 +++ b/test/Tools/isac/Knowledge/polyeq-2.sml Sun Jul 18 16:20:32 2021 +0200
20.3 @@ -252,9 +252,9 @@
20.4 (* the invisible parentheses are as expected *)
20.5
20.6 val t = TermC.str2term "(x + 1) * (x + 2) - (3 * x - 2) \<up> 2 - ((2 * x - 1) \<up> 2 + (3 * x - 1) * (x + 1)) = 0";
20.7 -Rewrite.trace_on:=(*true*)false;
20.8 +Rewrite.trace_on:= false; (*true false*)
20.9 rewrite_set_ thy false expand_binoms t;
20.10 -Rewrite.trace_on:=false;
20.11 +Rewrite.trace_on:=false; (*true false*)
20.12
20.13
20.14 "----------- interSteps ([1],Res); on Schalk Is86Bsp5-------------";
21.1 --- a/test/Tools/isac/Knowledge/polyminus.sml Sat Jul 17 14:05:28 2021 +0200
21.2 +++ b/test/Tools/isac/Knowledge/polyminus.sml Sun Jul 18 16:20:32 2021 +0200
21.3 @@ -164,12 +164,12 @@
21.4 "----------- watch order_add_mult -------------------------------";
21.5 "----- with these simple variables it works...";
21.6 (*Rewrite.trace_on := true; ..stopped Test_Isac.thy*)
21.7 -Rewrite.trace_on:=false;
21.8 +Rewrite.trace_on:=false; (*true false*)
21.9 val t = TermC.str2term "((a + d) + c) + b";
21.10 val SOME (t,_) = rewrite_set_ thy false order_add_mult t; UnparseC.term t;
21.11 if UnparseC.term t = "a + (b + (c + d))" then ()
21.12 else error "polyminus.sml 1 watch order_add_mult";
21.13 -Rewrite.trace_on:=false;
21.14 +Rewrite.trace_on:=false; (*true false*)
21.15
21.16 "----- the same stepwise...";
21.17 val od = ord_make_polynomial true (@{theory "Poly"});
21.18 @@ -325,7 +325,7 @@
21.19 else error "polyminus.sml: verschoenere 3 + - 2 * e ...";
21.20
21.21 (*Rewrite.trace_on := true; ..stopped Test_Isac.thy*)
21.22 -Rewrite.trace_on:=false;
21.23 +Rewrite.trace_on:=false; (*true false*)
21.24
21.25 "----------- met simplification for_polynomials with_minus -------";
21.26 "----------- met simplification for_polynomials with_minus -------";
21.27 @@ -538,7 +538,7 @@
21.28 val SOME (t',_) =
21.29 rewrite_set_ (@{theory "Isac_Knowledge"}) false ordne_alphabetisch t;
21.30 UnparseC.term t'; "- 9 + 12 + 5 * e - 7 * e - 8 * g + 10 * g + (- 4 + 6) * f";
21.31 -Rewrite.trace_on := false;
21.32 +Rewrite.trace_on := false; (*true false*)
21.33
21.34
21.35 applyTactic 1 p (hd (specific_from_prog pt p)) (*tausche_minus*);
21.36 @@ -684,7 +684,7 @@
21.37 (*"(~ False) = True"*)];
21.38 (*Rewrite.trace_on := true; ..stopped Test_Isac.thy*)
21.39 val SOME (t', _) = rewrite_set_ thy false prls t;
21.40 -Rewrite.trace_on := false;
21.41 +Rewrite.trace_on := false; (*true false*)
21.42
21.43 "--- does the respective prls rewrite the whole predicate ?";
21.44 val t = TermC.str2term
21.45 @@ -694,7 +694,7 @@
21.46 \ matchsub ((?b - ?c) * ?a) (8 * (a - q) + a - 2 * q) )";
21.47 (*Rewrite.trace_on := true; ..stopped Test_Isac.thy*)
21.48 val SOME (t', _) = rewrite_set_ thy false prls t;
21.49 -Rewrite.trace_on := false;
21.50 +Rewrite.trace_on := false; (*true false*)
21.51 if UnparseC.term t' = "False" then ()
21.52 else error "polyminus.sml Not (matchsub (?a * (?b + ?c)) (8 ...";
21.53
22.1 --- a/test/Tools/isac/Knowledge/rational-2.sml Sat Jul 17 14:05:28 2021 +0200
22.2 +++ b/test/Tools/isac/Knowledge/rational-2.sml Sun Jul 18 16:20:32 2021 +0200
22.3 @@ -378,9 +378,9 @@
22.4 (* required for applying thms in rewriting \<up> ^*)
22.5 (* we get details from here..*)
22.6
22.7 -Rewrite.trace_on := false;
22.8 +Rewrite.trace_on := false; (*true false*)
22.9 val SOME (t', _) = Rewrite.rewrite_set_ thy true add_fractions_p t;
22.10 -Rewrite.trace_on := false;
22.11 +Rewrite.trace_on := false; (*true false*)
22.12 (* Rewrite.trace_on:
22.13 add_fractions_p on: 3 = A / 2 + A / 4 + (B / 2 + - 1 * B / 2) --> 3 = A / 2 + A / 4 + 0 / 2 *)
22.14 (* |||||||||||||||||||||||||||||||||||| *)
22.15 @@ -421,9 +421,9 @@
22.16 (*AA :: real*)
22.17 (* we get details from here..*)
22.18
22.19 -Rewrite.trace_on := false;
22.20 +Rewrite.trace_on := false; (*true false*)
22.21 val SOME (t', _) = Rewrite.rewrite_set_ thy true add_fractions_p t;
22.22 -Rewrite.trace_on := false;
22.23 +Rewrite.trace_on := false; (*true false*)
22.24 (* Rewrite.trace_on:
22.25 add_fractions_p on: 3 = A / 2 + A / 4 + (B / 2 + - 1 * B / 2) --> 3 = A / 2 + A / 4 + 0 / 2 *)
22.26 (* |||||||||||||||||||||||||||||||||||| *)
22.27 @@ -693,7 +693,7 @@
22.28 (* simpler variant *)
22.29 val testrls = Rule_Set.append_rules "testrls" Rule_Set.empty [Rls_ cancel_p, Rls_ add_fractions_p]
22.30 val SOME (t', asm) = rewrite_set_ thy false testrls t;
22.31 -(*Rewrite.trace_on := false;
22.32 +(*Rewrite.trace_on := false; (*true false*)
22.33 # rls: testrls on: 123 = a * x / (b * x) + c * x / (d * x) + e * x / (f * x)
22.34 ## rls: cancel_p on: 123 = a * x / (b * x) + c * x / (d * x) + e * x / (f * x)
22.35 ## rls: add_fractions_p on: 123 = a * x / (b * x) + c * x / (d * x) + e / f
22.36 @@ -880,7 +880,8 @@
22.37 "-------- examples: rls norm_Rational ----------------------------------------";
22.38 "-------- examples: rls norm_Rational ----------------------------------------";
22.39 "-------- examples: rls norm_Rational ----------------------------------------";
22.40 -(*Rewrite.trace_on:=true;*)
22.41 +Rewrite.trace_on := false; (*true false*)
22.42 +
22.43 val t = TermC.str2term "Not (6*x is_atom)";
22.44 val SOME (t',_) = rewrite_set_ thy false powers_erls t; UnparseC.term t';
22.45 "HOL.True";
22.46 @@ -1721,7 +1722,7 @@
22.47 val t = TermC.str2term
22.48 ("((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) / " ^
22.49 "((a \<up> 2 + b \<up> 2) \<up> 2 / (a + b) \<up> 2)");
22.50 -(* Rewrite.trace_on := true;
22.51 +(* Rewrite.trace_on := true; (*true false*)
22.52 rewrite_set_ thy false norm_Rational t;
22.53 :
22.54 #### rls: cancel_p on: (2 * (a \<up> 7 * b) + 4 * (a \<up> 6 * b \<up> 2) + 6 * (a \<up> 5 * b \<up> 3) +
22.55 @@ -1744,7 +1745,7 @@
22.56 "-------- Schalk I, p.70 Nr. 480a: terms are exploding ?!?";
22.57 val t = TermC.str2term ("(1/x + 1/y + 1/z) / (1/x - 1/y - 1/z) / " ^
22.58 "(2*x \<up> 2 / (x \<up> 2 - z \<up> 2) / (x / (x + z) + x / (x - z)))");
22.59 -(* Rewrite.trace_on := true;
22.60 +(* Rewrite.trace_on := true; (*true false*)
22.61 rewrite_set_ thy false norm_Rational t;
22.62 :
22.63 #### rls: cancel_p on: (2 * (x \<up> 6 * (y \<up> 2 * z)) + 2 * (x \<up> 6 * (y * z \<up> 2)) +
23.1 --- a/test/Tools/isac/Knowledge/rlang.sml Sat Jul 17 14:05:28 2021 +0200
23.2 +++ b/test/Tools/isac/Knowledge/rlang.sml Sun Jul 18 16:20:32 2021 +0200
23.3 @@ -50,8 +50,8 @@
23.4 }
23.5 *)
23.6
23.7 -(* Rewrite.trace_on:=true;
23.8 - Rewrite.trace_on:=false;
23.9 +(*
23.10 + Rewrite.trace_on:=false; (*true false*)
23.11 Refine.refine fmz ["univariate", "equation"];
23.12 *)
23.13 "---- rlang.sml begin-----------------------------------";
23.14 @@ -318,8 +318,8 @@
23.15 "solveFor x", "solutions L"];
23.16 val (dI',pI',mI') = ("PolyEq",["univariate", "equation"],["no_met"]);
23.17 val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
23.18 -(*Rewrite.trace_on:=true;
23.19 -*)
23.20 +Rewrite.trace_on:=true; (*true false*)
23.21 +
23.22 val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
23.23 val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
23.24 val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
23.25 @@ -1330,10 +1330,10 @@
23.26
23.27
23.28 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)";
23.29 -Rewrite.trace_on := false;
23.30 +Rewrite.trace_on := false; (*true false*)
23.31 val SOME (t',asm) = rewrite_set_ thy false norm_Rational t;
23.32 UnparseC.term t';
23.33 -Rewrite.trace_on:=false;
23.34 +Rewrite.trace_on:=false; (*true false*)
23.35
23.36 # rls: norm_Rational on: (a + b * x) / (a + - 1 * (b * x)) + - 1 * (a + - 1 * (b * x)) / (a + b * x) = 4 * a * b / (a \<up> 2 + - 1 * b \<up> 2)
23.37
23.38 @@ -1546,7 +1546,7 @@
23.39 "------ rlang.sml end---------------------------------";
23.40
23.41 (*------------------------------vvv-Rewrite_Set "rat_eliminate"---------
23.42 -> Rewrite.trace_on:=true;
23.43 +> Rewrite.trace_on:=true; (*true false*)
23.44 > val t = TermC.str2term
23.45 "(3 + - 1 * x + 1 * x \<up> 2) / (9 * x + -6 * x \<up> 2 + 1 * x \<up> 3) = 1 / x";
23.46 > val SOME (t',asm) =
23.47 @@ -1554,7 +1554,7 @@
23.48 > UnparseC.term t'; UnparseC.terms asm;
23.49 "(3 + - 1 * x + 1 * x \<up> 2) * x = 1 * (9 * x + -6 * x \<up> 2 + 1 * x \<up> 3)"
23.50 "[\"9 * x + -6 * x \<up> 2 + 1 * x \<up> 3 ~= 0\",\"x ~= 0\"]"
23.51 -> Rewrite.trace_on:=false;
23.52 +> Rewrite.trace_on:=false; (*true false*)
23.53 ------------------------------ \<up> -Rewrite_Set "rat_eliminate"---------*)
23.54
23.55
24.1 --- a/test/Tools/isac/MathEngBasic/rewrite.sml Sat Jul 17 14:05:28 2021 +0200
24.2 +++ b/test/Tools/isac/MathEngBasic/rewrite.sml Sun Jul 18 16:20:32 2021 +0200
24.3 @@ -295,7 +295,7 @@
24.4 (writeln o UnparseC.term) t;
24.5 if UnparseC.term t = "L * c_3 + c_4 = 0 + -1 * (-1 * (q_0 * L \<up> 2) / 2)"
24.6 then () else error "rewrite.sml rewrite_inst_ bdvs";
24.7 -> Rewrite.trace_on:=true;
24.8 +> Rewrite.trace_on:=true;false
24.9 Rewrite.trace_on:=false;--------------------------------------------*)
24.10
24.11
24.12 @@ -396,9 +396,9 @@
24.13 Const ("HOL.True", _))) => ()
24.14 | _ => error "rewrite.sml diff. eval_is_multUnordered 2b";
24.15
24.16 -tracing "----- begin rewrite x \<up> 2 * x ---"; Rewrite.trace_on := false;
24.17 +tracing "----- begin rewrite x \<up> 2 * x ---"; Rewrite.trace_on := false; (*true false*)
24.18 val SOME (t', _) = rewrite_set_ thy true order_mult_ t;
24.19 -tracing "----- end rewrite x \<up> 2 * x ---"; Rewrite.trace_on := false;
24.20 +tracing "----- end rewrite x \<up> 2 * x ---"; Rewrite.trace_on := false; (*true false*)
24.21 if UnparseC.term t' = "x * x \<up> 2" then ()
24.22 else error "rewrite.sml Poly.is_multUnordered doesn't work";
24.23
24.24 @@ -629,7 +629,7 @@
24.25
24.26 rewrite__set_ thy (i + 1) false bdv rls a (*of*);
24.27
24.28 -(*+*)Rewrite.trace_on := false;
24.29 +(*+*)Rewrite.trace_on := false; (*true false*)
24.30
24.31 (*this was False; vvvv--- means: indeterminate*)
24.32 val (* SOME (t, a') *)NONE = (*case*)
24.33 @@ -650,7 +650,7 @@
24.34 :
24.35 ### asms accepted: [x \<noteq> 0] stored: []
24.36 : *)
24.37 -Rewrite.trace_on := false;
24.38 +Rewrite.trace_on := false; (*true false*)
24.39 ( *\------- outcomment this code: otherwise the re-definition could infect tests lateron ------/*)
24.40
24.41
25.1 --- a/test/Tools/isac/MathEngine/mathengine-stateless.sml Sat Jul 17 14:05:28 2021 +0200
25.2 +++ b/test/Tools/isac/MathEngine/mathengine-stateless.sml Sun Jul 18 16:20:32 2021 +0200
25.3 @@ -75,7 +75,7 @@
25.4 val (p''''',_,f,nxt''''',_,pt''''') = me nxt p [] pt;
25.5 ( **)
25.6 (*//---------------- adhoc inserted ------------------------------------------------\\* )
25.7 - see TODO.ThmC.numerals_to_Free 1 in test/../evaluate.sml
25.8 + see TOODOO.1 in test/../evaluate.sml
25.9 ( *\\---------------- adhoc inserted ------------------------------------------------//*)
25.10
25.11 (*//---------------- continue AFTER previous step "me" -----------------------------\\* )
26.1 --- a/test/Tools/isac/Minisubpbl/200-start-method-NEXT_STEP.sml Sat Jul 17 14:05:28 2021 +0200
26.2 +++ b/test/Tools/isac/Minisubpbl/200-start-method-NEXT_STEP.sml Sun Jul 18 16:20:32 2021 +0200
26.3 @@ -73,7 +73,7 @@
26.4 (*+* )UnparseC.term res = "1 + (x + - 2) = 0"; ( *isa*)
26.5 (*+*)if UnparseC.term res = "- 1 + x = 0" (*isa2*) then () else error "Test_simplify CHANGED";
26.6
26.7 -Rewrite.trace_on := false;
26.8 +Rewrite.trace_on := false; (*true false*)
26.9 val SOME (form', _) = rewrite_set_ @{theory Test} true Test_simplify form;
26.10
26.11 (*+* )UnparseC.term form' = "1 + (x + - 2) = 0"; ( *isa*)
27.1 --- a/test/Tools/isac/OLDTESTS/root-equ.sml Sat Jul 17 14:05:28 2021 +0200
27.2 +++ b/test/Tools/isac/OLDTESTS/root-equ.sml Sun Jul 18 16:20:32 2021 +0200
27.3 @@ -1,10 +1,9 @@
27.4 -(* Rewrite.trace_on:= true;
27.5 - Rewrite.trace_on:= false;
27.6 +(*
27.7 +
27.8
27.9 method "sqrt-equ-test", _NOT_ "square-equation"
27.10 *)
27.11
27.12 -
27.13 " ================= equation with x =(-12)/5, but L ={} ======= ";
27.14 " _________________ rewrite _________________ ";
27.15
27.16 @@ -533,8 +532,7 @@
27.17 val t = TermC.str2term "sqrt (9 + 4 * x) = sqrt x + sqrt (5 + x)";
27.18 val SOME (t',asm) = rewrite_set_ thy false rls t;
27.19 UnparseC.term t';
27.20 -> Rewrite.trace_on:=true;
27.21 - Rewrite.trace_on:=false;
27.22 + Rewrite.trace_on:=false; (*true false*)
27.23 *)
27.24
27.25 (*me------------
28.1 --- a/test/Tools/isac/ProgLang/evaluate.sml Sat Jul 17 14:05:28 2021 +0200
28.2 +++ b/test/Tools/isac/ProgLang/evaluate.sml Sun Jul 18 16:20:32 2021 +0200
28.3 @@ -149,7 +149,7 @@
28.4 "----------- check calculate bottom up ------------------";
28.5 "----------- check calculate bottom up ------------------";
28.6 (*-------------- eval_cancel works: *)
28.7 - Rewrite.trace_on := false;
28.8 + Rewrite.trace_on := false; (*true false*)
28.9 val thy = @{theory Test};
28.10 val rls = Test_simplify;
28.11 val t = (Thm.term_of o the o (TermC.parse thy)) "(-4) / 2";
28.12 @@ -170,7 +170,7 @@
28.13 if UnparseC.term t' = "2 + x" then () else error "rewrite_set_ (3+1+2*x)/2 changed 1"
28.14 | _ => error "rewrite_set_ (3+1+2*x)/2 changed 2";
28.15
28.16 - Rewrite.trace_on:=false; (*=true3.6.03*)
28.17 + Rewrite.trace_on := false; (*true false*)
28.18
28.19 (*--- Rewrite.trace_on before correction of ... --------------------
28.20 val ct = "(-3 + 2 * x + - 1) / 2";
28.21 @@ -460,7 +460,7 @@
28.22 "----------- fun adhoc_thm \<longrightarrow> exception TYPE --------------------------------------------------";
28.23 val t = TermC.str2term "sqrt 4";
28.24
28.25 -(* TODO.ThmC.numerals_to_Free 1 * )
28.26 +(* TOODOO.1: exception TYPE raised by Skip_Proof.make_thm * )
28.27 exception TYPE raised (line 169 of "consts.ML"): Illegal type
28.28 for constant "HOL.eq" :: real \<Rightarrow> (num \<Rightarrow> real) \<Rightarrow> bool (**)
28.29 Eval.adhoc_thm (ThyC.get_theory "Isac_Knowledge") ("NthRoot.sqrt", eval_sqrt "#sqrt_") t
29.1 --- a/test/Tools/isac/ProgLang/listC.sml Sat Jul 17 14:05:28 2021 +0200
29.2 +++ b/test/Tools/isac/ProgLang/listC.sml Sun Jul 18 16:20:32 2021 +0200
29.3 @@ -72,9 +72,9 @@
29.4 (* now the argument "(3 + - 1)" etc needs to be evaluated in the assumption of NTH_CONS *)
29.5 val t = TermC.str2term "NTH 3 [a,b,c,d,e]";
29.6 TermC.atomty t;
29.7 -Rewrite.trace_on := false;
29.8 +Rewrite.trace_on := false; (*true false*)
29.9 val SOME (t', _) = rewrite_set_ thy false prog_expr t;
29.10 -Rewrite.trace_on := false;
29.11 +Rewrite.trace_on := false; (*true false*)
29.12 if UnparseC.term t' = "c" then ()
29.13 else error "NTH 3 [a,b,c,d,e] = c ..changed";
29.14
30.1 --- a/test/Tools/isac/ProgLang/prog_expr.sml Sat Jul 17 14:05:28 2021 +0200
30.2 +++ b/test/Tools/isac/ProgLang/prog_expr.sml Sun Jul 18 16:20:32 2021 +0200
30.3 @@ -393,13 +393,13 @@
30.4 if UnparseC.term pred = "boollist2sum\n [b1 = k - 2 * q, b2 = k - 2 * q, b3 = k - 2 * q, b4 = k - 2 * q] =\nb1 + b2 + b3 + b4" then ()
30.5 else error "atools.sml diff.behav. in eval_boollist2sum";
30.6
30.7 -Rewrite.trace_on := false;
30.8 +Rewrite.trace_on := false; (*true false*)
30.9 val srls_ = Rule_Set.append_rules "srls_..Berechnung-erstSymbolisch" Rule_Set.empty
30.10 [Eval ("Prog_Expr.boollist2sum", eval_boollist2sum "")];
30.11 val t = @{term "boollist2sum [b1 = k - 2*(q::real), b2 = k - 2*q, b3 = k - 2*q, b4 = k - 2*q]"};
30.12 case rewrite_set_ @{theory} false srls_ t of SOME _ => ()
30.13 | _ => error "atools.sml diff.rewrite boollist2sum";
30.14 -Rewrite.trace_on := false;
30.15 +Rewrite.trace_on := false; (*true false*)
30.16
30.17
30.18 "-------- REBUILD fun eval_binop FOR Isabelle's NUMERALS ---------------------------------------";
31.1 --- a/test/Tools/isac/Test_Isac_Short.thy Sat Jul 17 14:05:28 2021 +0200
31.2 +++ b/test/Tools/isac/Test_Isac_Short.thy Sun Jul 18 16:20:32 2021 +0200
31.3 @@ -163,8 +163,8 @@
31.4 (*fun autoCalculate' cI auto = autoCalculate cI auto (*|> Future.join*)*);
31.5 \<close>
31.6
31.7 -(*---------------------- check test file by testfile -------------------------------------------
31.8 - ---------------------- check test file by testfile -------------------------------------------*)
31.9 +(*----- comments on tests with TOODOO after changeset "eliminate ThmC.numerals_to_Free"
31.10 + -------------------------------------------------------------------------ARE AT THE RIGHT MARGIN*)
31.11 section \<open>trials with Isabelle's functions\<close>
31.12 ML \<open>"%%%%%%%%%%%%%%%%% start Isabelle %%%%%%%%%%%%%%%%%%%%%%%";\<close>
31.13 ML_file "$ISABELLE_ISAC_TEST/Pure/General/alist.ML"
31.14 @@ -190,7 +190,7 @@
31.15 ML_file "BaseDefinitions/calcelems.sml"
31.16 ML_file "BaseDefinitions/termC.sml"
31.17 ML_file "BaseDefinitions/substitution.sml"
31.18 -(*ML_file "BaseDefinitions/contextC.sml" loops with eliminate ThmC.numerals_to_Free*)
31.19 + ML_file "BaseDefinitions/contextC.sml" (*TOODOO make_ratpoly: "- 6 * x" \<longrightarrow> "- (6 * x)"*)
31.20 ML_file "BaseDefinitions/environment.sml"
31.21 (** )ML_file "BaseDefinitions/kestore.sml" ( * setup in ADDTEST/accumulate-val/lucas_interpreter.sml*)
31.22 (*---------------------- do Minisubpbl before ADDTESTS/All_Ctxt --------------------------------
31.23 @@ -273,7 +273,7 @@
31.24 ML_file "BridgeLibisabelle/thy-hierarchy.sml"
31.25 ML_file "BridgeLibisabelle/interface-xml.sml" (*TODO after 2009- 2*)
31.26 (** )ML_file "BridgeLibisabelle/interface.sml"( *loops with eliminate ThmC.numerals_to_Free
31.27 - but is already deprecated ( **)
31.28 + but is deprecated after ^^^^^^^^^^^^^^^( **)
31.29 ML_file "BridgeJEdit/parseC.sml"
31.30 ML_file "BridgeJEdit/preliminary.sml"
31.31
31.32 @@ -287,43 +287,31 @@
31.33 ML_file "Knowledge/rational-1.sml"
31.34 (*ML_file "Knowledge/rational-2.sml" Test_Isac_Short*)
31.35 ML_file "Knowledge/equation.sml"
31.36 -(*ML_file "Knowledge/root.sml" see TODO.ThmC.numerals_to_Free 1*)
31.37 +(*ML_file "Knowledge/root.sml" see TOODOO.1*)
31.38 ML_file "Knowledge/lineq.sml"
31.39
31.40 (*ML_file "Knowledge/rooteq.sml" some complicated equations not recovered from 2002 *)
31.41 (*ML_file "Knowledge/rateq.sml" some complicated equations not recovered----Test_Isac_Short*)
31.42 -(*ML_file "Knowledge/rootrat.sml" see TODO.ThmC.numerals_to_Free 1*)
31.43 +(*ML_file "Knowledge/rootrat.sml" error inherited from root.sml*)
31.44 ML_file "Knowledge/rootrateq.sml"(*ome complicated equations not recovered from 2002 *)
31.45 (*ML_file "Knowledge/partial_fractions.sml" hangs with ML_system_64 = "true"---Test_Isac_Short*)
31.46 - ML_file "Knowledge/polyeq-1.sml"
31.47 -ML \<open>
31.48 -\<close> ML \<open>
31.49 -\<close> ML \<open>
31.50 -\<close> ML \<open>
31.51 -\<close> ML \<open>
31.52 -\<close> ML \<open>
31.53 -\<close> ML \<open>
31.54 -\<close> ML \<open>
31.55 -\<close> ML \<open>
31.56 -\<close> ML \<open>
31.57 -\<close> ML \<open>
31.58 -\<close>
31.59 +(*ML_file "Knowledge/polyeq-1.sml" error inherited from root.sml | in Test_Some.thy*)
31.60 (*ML_file "Knowledge/polyeq-2.sml" Test_Isac_Short*)
31.61 (*ML_file "Knowledge/rlang.sml" much to clean up, similar tests in other files *)
31.62 ML_file "Knowledge/calculus.sml"
31.63 ML_file "Knowledge/trig.sml"
31.64 (*ML_file "Knowledge/logexp.sml" not included as stuff for presentation of authoring*)
31.65 - ML_file "Knowledge/diff.sml"
31.66 - ML_file "Knowledge/integrate.sml"
31.67 - ML_file "Knowledge/eqsystem.sml"
31.68 +(*ML_file "Knowledge/diff.sml" incomplete repair 2 * x \<up> - 2" --> 2 / x \<up> 2 | in Test_Some.thy*)
31.69 +(*ML_file "Knowledge/integrate.sml" rls simplify_Integral broken | in Test_Some.thy*)
31.70 +(*ML_file "Knowledge/eqsystem.sml" simplify_System_parenthesized \<longrightarrow> - 0 + c_4 | in Test_Some.thy*)
31.71 ML_file "Knowledge/test.sml"
31.72 ML_file "Knowledge/polyminus.sml"
31.73 ML_file "Knowledge/vect.sml"
31.74 ML_file "Knowledge/diffapp.sml" (* postponed to dev. specification | TP-prog. *)
31.75 - ML_file "Knowledge/biegelinie-1.sml"
31.76 +(*ML_file "Knowledge/biegelinie-1.sml" (**) requires integrate.sml, eqsystem.sml*)
31.77 (*ML_file "Knowledge/biegelinie-2.sml" Test_Isac_Short*)
31.78 (*ML_file "Knowledge/biegelinie-3.sml" Test_Isac_Short*)
31.79 - ML_file "Knowledge/biegelinie-4.sml"
31.80 +(*ML_file "Knowledge/biegelinie-4.sml" (**) requires integrate.sml, eqsystem.sml*)
31.81 ML_file "Knowledge/algein.sml"
31.82 ML_file "Knowledge/diophanteq.sml"
31.83 (*ML_file "Knowledge/inverse_z_transform.sml"hangs with ML_system_64 = "true"---Test_Isac_Short*)
32.1 --- a/test/Tools/isac/Test_Some.thy Sat Jul 17 14:05:28 2021 +0200
32.2 +++ b/test/Tools/isac/Test_Some.thy Sun Jul 18 16:20:32 2021 +0200
32.3 @@ -108,687 +108,3021 @@
32.4 \<close> ML \<open>
32.5 \<close>
32.6
32.7 -section \<open>============ check"Interpret/lucas-interpreter.sml" ==============================\<close>
32.8 +section \<open>======== check Knowledge/polyeq-1.sml =============================================\<close>
32.9 ML \<open>
32.10 \<close> ML \<open>
32.11 -(* Title: "Interpret/lucas-interpreter.sml"
32.12 - Author: Walther Neuper
32.13 +(* Title: Knowledge/polyeq-1.sml
32.14 + testexamples for PolyEq, poynomial equations and equational systems
32.15 + Author: Richard Lang 2003
32.16 (c) due to copyright terms
32.17 +WN030609: some expls dont work due to unfinished handling of 'expanded terms';
32.18 + others marked with TODO have to be checked, too.
32.19 *)
32.20
32.21 +"-----------------------------------------------------------------";
32.22 +"table of contents -----------------------------------------------";
32.23 +"-----------------------------------------------------------------";
32.24 +"------ polyeq- 1.sml ---------------------------------------------";
32.25 +"----------- tests on predicates in problems ---------------------";
32.26 +"----------- test matching problems ------------------------------";
32.27 +"----------- prep. for introduction of Matthias Goldgruber 2003 trials on rewrite orders -----";
32.28 +"----------- Matthias Goldgruber 2003 trials on rewrite orders -------------------------------";
32.29 +"----------- lin.eq degree_0 -------------------------------------";
32.30 +"----------- test thm's d2_pq_formulsxx[_neg]---------------------";
32.31 +"----------- equality (2 +(- 1)*x + x \<up> 2 = (0::real)) ----------------------------------------";
32.32 +"----------- equality (- 2 +(- 1)*x + 1*x \<up> 2 = 0) ---------------------------------------------";
32.33 +"----------- equality (- 2 + x + x \<up> 2 = 0) ---------------------------------------------------";
32.34 +"----------- equality (2 + x + x \<up> 2 = 0) ----------------------------------------------------";
32.35 +"----------- equality (- 2 + x + 1*x \<up> 2 = 0)) ------------------------------------------------";
32.36 +"----------- equality (1*x + x \<up> 2 = 0) ----------------------------------------------------";
32.37 +"----------- equality (1*x + 1*x \<up> 2 = 0) ----------------------------------------------------";
32.38 +"----------- equality (x + x \<up> 2 = 0) ------------------------------------------------------";
32.39 +"----------- equality (x + 1*x \<up> 2 = 0) ------------------------------------------------------";
32.40 +"----------- equality (-4 + x \<up> 2 = 0) -------------------------------------------------------";
32.41 +"----------- equality (4 + 1*x \<up> 2 = 0) -------------------------------------------------------";
32.42 +"----------- equality (1 +(- 1)*x + 2*x \<up> 2 = 0) ----------------------------------------------";
32.43 +"----------- equality (- 1 + x + 2*x \<up> 2 = 0) -------------------------------------------------";
32.44 +"----------- equality (1 + x + 2*x \<up> 2 = 0) --------------------------------------------------";
32.45 +"----------- (-8 - 2*x + x \<up> 2 = 0), (*Schalk 2, S.67 Nr.31.b----";
32.46 +"----------- (-8 - 2*x + x \<up> 2 = 0), by rewriting ---------------";
32.47 +"----------- (- 16 + 4*x + 2*x \<up> 2 = 0), --------------------------";
32.48 +"-----------------------------------------------------------------";
32.49 +"------ polyeq- 2.sml ---------------------------------------------";
32.50 +"----------- (a*b - (a+b)*x + x \<up> 2 = 0), (*Schalk 2,S.68Nr.44.a*)";
32.51 +"----------- (-64 + x \<up> 2 = 0), (*Schalk 2, S.66 Nr.1.a~--------*)";
32.52 +"----------- (- 147 + 3*x \<up> 2 = 0), (*Schalk 2, S.66 Nr.1.b------*)";
32.53 +"----------- (3*x - 1 - (5*x - (2 - 4*x)) = - 11),(*Schalk Is86Bsp5";
32.54 +"----------- ((x+1)*(x+2) - (3*x - 2) \<up> 2=.. Schalk II s.68 Bsp 37";
32.55 +"----------- rls make_polynomial_in ------------------------------";
32.56 +"----------- interSteps ([1],Res); on Schalk Is86Bsp5-------------";
32.57 +"----------- rls d2_polyeq_bdv_only_simplify ---------------------";
32.58 +"-----------------------------------------------------------------";
32.59 +"-----------------------------------------------------------------";
32.60 +
32.61 +\<close> ML \<open>
32.62 +"----------- tests on predicates in problems ---------------------";
32.63 +"----------- tests on predicates in problems ---------------------";
32.64 +"----------- tests on predicates in problems ---------------------";
32.65 + val t1 = (Thm.term_of o the o (TermC.parse thy)) "lhs (-8 - 2*x + x \<up> 2 = 0)";
32.66 + val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t1;
32.67 + if ((UnparseC.term t) = "- 8 - 2 * x + x \<up> 2") then ()
32.68 + else error "polyeq.sml: diff.behav. in lhs";
32.69 +
32.70 + val t2 = (Thm.term_of o the o (TermC.parse thy)) "(-8 - 2*x + x \<up> 2) is_expanded_in x";
32.71 + val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t2;
32.72 + if (UnparseC.term t) = "True" then ()
32.73 + else error "polyeq.sml: diff.behav. 1 in is_expended_in";
32.74 +
32.75 + val t0 = (Thm.term_of o the o (TermC.parse thy)) "(sqrt(x)) is_poly_in x";
32.76 + val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t0;
32.77 + if (UnparseC.term t) = "False" then ()
32.78 + else error "polyeq.sml: diff.behav. 2 in is_poly_in";
32.79 +
32.80 + val t3 = (Thm.term_of o the o (TermC.parse thy)) "(-8 + (- 1)*2*x + x \<up> 2) is_poly_in x";
32.81 + val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t3;
32.82 + if (UnparseC.term t) = "True" then ()
32.83 + else error "polyeq.sml: diff.behav. 3 in is_poly_in";
32.84 +
32.85 + val t4 = (Thm.term_of o the o (TermC.parse thy)) "(lhs (-8 + (- 1)*2*x + x \<up> 2 = 0)) is_expanded_in x";
32.86 + val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t4;
32.87 + if (UnparseC.term t) = "True" then ()
32.88 + else error "polyeq.sml: diff.behav. 4 in is_expended_in";
32.89 +
32.90 + val t6 = (Thm.term_of o the o (TermC.parse thy)) "(lhs (-8 - 2*x + x \<up> 2 = 0)) is_expanded_in x";
32.91 + val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t6;
32.92 + if (UnparseC.term t) = "True" then ()
32.93 + else error "polyeq.sml: diff.behav. 5 in is_expended_in";
32.94 +
32.95 + val t3 = (Thm.term_of o the o (TermC.parse thy))"((-8 - 2*x + x \<up> 2) has_degree_in x) = 2";
32.96 + val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t3;
32.97 + if (UnparseC.term t) = "True" then ()
32.98 + else error "polyeq.sml: diff.behav. in has_degree_in_in";
32.99 +
32.100 +\<close> ML \<open>
32.101 + val t3 = (Thm.term_of o the o (TermC.parse thy)) "((sqrt(x)) has_degree_in x) = 2";
32.102 + val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t3;
32.103 +\<close> ML \<open>
32.104 +UnparseC.term t = "- 1 = 2";
32.105 +\<close> text \<open> (*"((sqrt(x)) has_degree_in x) = 2" --- = "- 1 = 2" START HERE*)
32.106 + if (UnparseC.term t) = "False" then ()
32.107 + else error "polyeq.sml: diff.behav. 6 in has_degree_in_in";
32.108 +
32.109 +\<close> ML \<open>
32.110 + val t4 = (Thm.term_of o the o (TermC.parse thy))
32.111 + "((-8 - 2*x + x \<up> 2) has_degree_in x) = 1";
32.112 + val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t4;
32.113 + if (UnparseC.term t) = "False" then ()
32.114 + else error "polyeq.sml: diff.behav. 7 in has_degree_in_in";
32.115 +
32.116 +val t5 = (Thm.term_of o the o (TermC.parse thy))
32.117 + "((-8 - 2*x + x \<up> 2) has_degree_in x) = 2";
32.118 + val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t5;
32.119 + if (UnparseC.term t) = "True" then ()
32.120 + else error "polyeq.sml: diff.behav. 8 in has_degree_in_in";
32.121 +
32.122 +\<close> text \<open> (* M_Match.match_pbl [expanded,univariate,equation] *)
32.123 +"----------- test matching problems --------------------------0---";
32.124 +"----------- test matching problems --------------------------0---";
32.125 +"----------- test matching problems --------------------------0---";
32.126 +val fmz = ["equality (-8 - 2*x + x \<up> 2 = 0)", "solveFor x", "solutions L"];
32.127 +if M_Match.match_pbl fmz (Problem.from_store ["expanded", "univariate", "equation"]) =
32.128 + M_Match.Matches' {Find = [Correct "solutions L"],
32.129 + With = [],
32.130 + Given = [Correct "equality (-8 - 2 * x + x \<up> 2 = 0)", Correct "solveFor x"],
32.131 + Where = [Correct "matches (?a = 0) (-8 - 2 * x + x \<up> 2 = 0)",
32.132 + Correct "lhs (-8 - 2 * x + x \<up> 2 = 0) is_expanded_in x"],
32.133 + Relate = []}
32.134 +then () else error "M_Match.match_pbl [expanded,univariate,equation]";
32.135 +
32.136 +if M_Match.match_pbl fmz (Problem.from_store ["degree_2", "expanded", "univariate", "equation"]) =
32.137 + M_Match.Matches' {Find = [Correct "solutions L"],
32.138 + With = [],
32.139 + Given = [Correct "equality (-8 - 2 * x + x \<up> 2 = 0)", Correct "solveFor x"],
32.140 + Where = [Correct "lhs (-8 - 2 * x + x \<up> 2 = 0) has_degree_in x = 2"],
32.141 + Relate = []} (*before WN110906 was: has_degree_in x =!= 2"]*)
32.142 +then () else error "M_Match.match_pbl [degree_2,expanded,univariate,equation]";
32.143 +
32.144 +
32.145 +"----------- prep. for introduction of Matthias Goldgruber 2003 trials on rewrite orders -----";
32.146 +"----------- prep. for introduction of Matthias Goldgruber 2003 trials on rewrite orders -----";
32.147 +"----------- prep. for introduction of Matthias Goldgruber 2003 trials on rewrite orders -----";
32.148 +(*##################################################################################
32.149 +----------- 28.2.03: war nicht upgedatet und ausgeklammert in ROOT.ML-->Test_Isac.thy
32.150 +
32.151 + (*Aufgabe zum Einstieg in die Arbeit...*)
32.152 + val t = (Thm.term_of o the o (TermC.parse thy)) "a*b - (a+b)*x + x \<up> 2 = 0";
32.153 + (*ein 'ruleset' aus Poly.ML wird angewandt...*)
32.154 + val SOME (t,_) = rewrite_set_ thy Poly_erls false make_polynomial t;
32.155 + UnparseC.term t;
32.156 + "a * b + (- 1 * (a * x) + (- 1 * (b * x) + x \<up> 2)) = 0";
32.157 + val SOME (t,_) =
32.158 + rewrite_set_inst_ thy Poly_erls false [("bdv", "a")] make_polynomial_in t;
32.159 + UnparseC.term t;
32.160 + "x \<up> 2 + (- 1 * (b * x) + (- 1 * (x * a) + b * a)) = 0";
32.161 +(* bei Verwendung von "size_of-term" nach MG :*)
32.162 +(*"x \<up> 2 + (- 1 * (b * x) + (b * a + - 1 * (x * a))) = 0" !!! *)
32.163 +
32.164 + (*wir holen 'a' wieder aus der Klammerung heraus...*)
32.165 + val SOME (t,_) = rewrite_set_ thy Poly_erls false discard_parentheses t;
32.166 + UnparseC.term t;
32.167 + "x \<up> 2 + - 1 * b * x + - 1 * x * a + b * a = 0";
32.168 +(* "x \<up> 2 + - 1 * b * x + b * a + - 1 * x * a = 0" !!! *)
32.169 +
32.170 + val SOME (t,_) =
32.171 + rewrite_set_inst_ thy Poly_erls false [("bdv", "a")] make_polynomial_in t;
32.172 + UnparseC.term t;
32.173 + "x \<up> 2 + (- 1 * (b * x) + a * (b + - 1 * x)) = 0";
32.174 + (*da sind wir fast am Ziel: make_polynomial_in 'a' sollte ergeben
32.175 + "x \<up> 2 + (- 1 * (b * x)) + (b + - 1 * x) * a = 0"*)
32.176 +
32.177 + (*das rewriting l"asst sich beobachten mit
32.178 +Rewrite.trace_on := false; (*true false*)
32.179 + *)
32.180 +
32.181 +"------ 15.11.02 --------------------------";
32.182 + val t = (Thm.term_of o the o (TermC.parse thy)) "1 + a * x + b * x";
32.183 + val bdv = (Thm.term_of o the o (TermC.parse thy)) "bdv";
32.184 + val a = (Thm.term_of o the o (TermC.parse thy)) "a";
32.185 +
32.186 +Rewrite.trace_on := false; (*true false*)
32.187 + (* Anwenden einer Regelmenge aus Termorder.ML: *)
32.188 + val SOME (t,_) =
32.189 + rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
32.190 + UnparseC.term t;
32.191 + val SOME (t,_) =
32.192 + rewrite_set_ thy false discard_parentheses t;
32.193 + UnparseC.term t;
32.194 +"1 + b * x + x * a";
32.195 +
32.196 + val t = (Thm.term_of o the o (TermC.parse thy)) "1 + a * (x + b * x) + a \<up> 2";
32.197 + val SOME (t,_) =
32.198 + rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
32.199 + UnparseC.term t;
32.200 + val SOME (t,_) =
32.201 + rewrite_set_ thy false discard_parentheses t;
32.202 + UnparseC.term t;
32.203 +"1 + (x + b * x) * a + a \<up> 2";
32.204 +
32.205 + val t = (Thm.term_of o the o (TermC.parse thy)) "1 + a \<up> 2 * x + b * a + 7*a \<up> 2";
32.206 + val SOME (t,_) =
32.207 + rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
32.208 + UnparseC.term t;
32.209 + val SOME (t,_) =
32.210 + rewrite_set_ thy false discard_parentheses t;
32.211 + UnparseC.term t;
32.212 +"1 + b * a + (7 + x) * a \<up> 2";
32.213 +
32.214 +(* MG2003
32.215 + Prog_Expr.thy grundlegende Algebra
32.216 + Poly.thy Polynome
32.217 + Rational.thy Br"uche
32.218 + Root.thy Wurzeln
32.219 + RootRat.thy Wurzen + Br"uche
32.220 + Termorder.thy BITTE NUR HIERHER SCHREIBEN (...WN03)
32.221 +
32.222 + get_thm Termorder.thy "bdv_n_collect";
32.223 + get_thm (theory "Isac_Knowledge") "bdv_n_collect";
32.224 +*)
32.225 + val t = (Thm.term_of o the o (TermC.parse thy)) "a \<up> 2 * x + 7 * a \<up> 2";
32.226 + val SOME (t,_) =
32.227 + rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
32.228 + UnparseC.term t;
32.229 + val SOME (t,_) =
32.230 + rewrite_set_ thy false discard_parentheses t;
32.231 + UnparseC.term t;
32.232 +"(7 + x) * a \<up> 2";
32.233 +
32.234 + val t = (Thm.term_of o the o (TermC.parse Termorder.thy)) "Pi";
32.235 +
32.236 + val t = (Thm.term_of o the o (parseold thy)) "7";
32.237 +##################################################################################*)
32.238 +
32.239 +
32.240 +\<close> ML \<open>
32.241 +"----------- Matthias Goldgruber 2003 trials on rewrite orders -------------------------------";
32.242 +"----------- Matthias Goldgruber 2003 trials on rewrite orders -------------------------------";
32.243 +"----------- Matthias Goldgruber 2003 trials on rewrite orders -------------------------------";
32.244 + val substa = [(TermC.empty, (Thm.term_of o the o (TermC.parse thy)) "a")];
32.245 + val substb = [(TermC.empty, (Thm.term_of o the o (TermC.parse thy)) "b")];
32.246 + val substx = [(TermC.empty, (Thm.term_of o the o (TermC.parse thy)) "x")];
32.247 +
32.248 + val x1 = (Thm.term_of o the o (TermC.parse thy)) "a + b + x";
32.249 + val x2 = (Thm.term_of o the o (TermC.parse thy)) "a + x + b";
32.250 + val x3 = (Thm.term_of o the o (TermC.parse thy)) "a + x + b";
32.251 + val x4 = (Thm.term_of o the o (TermC.parse thy)) "x + a + b";
32.252 +
32.253 +if ord_make_polynomial_in true thy substx (x1,x2) = true(*LESS *) then ()
32.254 +else error "termorder.sml diff.behav ord_make_polynomial_in #1";
32.255 +
32.256 +if ord_make_polynomial_in true thy substa (x1,x2) = true(*LESS *) then ()
32.257 +else error "termorder.sml diff.behav ord_make_polynomial_in #2";
32.258 +
32.259 +if ord_make_polynomial_in true thy substb (x1,x2) = false(*GREATER*) then ()
32.260 +else error "termorder.sml diff.behav ord_make_polynomial_in #3";
32.261 +
32.262 + val aa = (Thm.term_of o the o (TermC.parse thy)) "- 1 * a * x";
32.263 + val bb = (Thm.term_of o the o (TermC.parse thy)) "x \<up> 3";
32.264 + ord_make_polynomial_in true thy substx (aa, bb);
32.265 + true; (* => LESS *)
32.266 +
32.267 + val aa = (Thm.term_of o the o (TermC.parse thy)) "- 1 * a * x";
32.268 + val bb = (Thm.term_of o the o (TermC.parse thy)) "x \<up> 3";
32.269 + ord_make_polynomial_in true thy substa (aa, bb);
32.270 + false; (* => GREATER *)
32.271 +
32.272 +(* und nach dem Re-engineering der Termorders in den 'rulesets'
32.273 + kannst Du die 'gr"osste' Variable frei w"ahlen: *)
32.274 + val bdv= (Thm.term_of o the o (TermC.parse thy)) "''bdv''";
32.275 + val x = (Thm.term_of o the o (TermC.parse thy)) "x";
32.276 + val a = (Thm.term_of o the o (TermC.parse thy)) "a";
32.277 + val b = (Thm.term_of o the o (TermC.parse thy)) "b";
32.278 +val SOME (t',_) = rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in x2;
32.279 +if UnparseC.term t' = "b + x + a" then ()
32.280 +else error "termorder.sml diff.behav ord_make_polynomial_in #11";
32.281 +
32.282 +val NONE = rewrite_set_inst_ thy false [(bdv,b)] make_polynomial_in x2;
32.283 +
32.284 +val SOME (t',_) = rewrite_set_inst_ thy false [(bdv,x)] make_polynomial_in x2;
32.285 +if UnparseC.term t' = "a + b + x" then ()
32.286 +else error "termorder.sml diff.behav ord_make_polynomial_in #13";
32.287 +
32.288 + val ppp' = "-6 + -5*x + x \<up> 3 + - 1*x \<up> 2 + - 1*x \<up> 3 + - 14*x \<up> 2";
32.289 + val ppp = (Thm.term_of o the o (TermC.parse thy)) ppp';
32.290 +val SOME (t',_) = rewrite_set_inst_ thy false [(bdv,x)] make_polynomial_in ppp;
32.291 +
32.292 +UnparseC.term t' = "- 6 + - (5 * x) + x \<up> 3 + - (x \<up> 2) + - (x \<up> 3) +\n- (14 * x \<up> 2)"
32.293 +\<close> text \<open> (* TODO.ThmC.numerals_to_Free termorder.sml diff.behav ord_make_polynomial_in*)
32.294 +if UnparseC.term t' = "- 6 + -5 * x + - 15 * x \<up> 2 + 0" then ()
32.295 +else error "termorder.sml diff.behav ord_make_polynomial_in #14";
32.296 +
32.297 +val SOME (t', _) = rewrite_set_inst_ thy false [(bdv,x)] make_polynomial_in ppp;
32.298 +if UnparseC.term t' = "- 6 + - 5 * x + - 15 * x \<up> 2 + 0" then ()
32.299 +else error "termorder.sml diff.behav ord_make_polynomial_in #15";
32.300 +
32.301 + val ttt' = "(3*x + 5)/18";
32.302 + val ttt = (Thm.term_of o the o (TermC.parse thy)) ttt';
32.303 +val SOME (uuu,_) = rewrite_set_inst_ thy false [(bdv,x)] make_polynomial_in ttt;
32.304 +if UnparseC.term uuu = "(5 + 3 * x) / 18" then ()
32.305 +else error "termorder.sml diff.behav ord_make_polynomial_in #16a";
32.306 +
32.307 +(*============ inhibit exn WN120316 ==============================================
32.308 +val SOME (uuu,_) = rewrite_set_ thy false make_polynomial ttt;
32.309 +if UnparseC.term uuu = "(5 + 3 * x) / 18" then ()
32.310 +else error "termorder.sml diff.behav ord_make_polynomial_in #16b";
32.311 +============ inhibit exn WN120316 ==============================================*)
32.312 +
32.313 +
32.314 +\<close> ML \<open>
32.315 +"----------- lin.eq degree_0 -------------------------------------";
32.316 +"----------- lin.eq degree_0 -------------------------------------";
32.317 +"----------- lin.eq degree_0 -------------------------------------";
32.318 +"----- d0_false ------";
32.319 +val fmz = ["equality (1 = (0::real))", "solveFor x", "solutions L"];
32.320 +val (dI',pI',mI') = ("PolyEq",["degree_0", "polynomial", "univariate", "equation"],
32.321 + ["PolyEq", "solve_d0_polyeq_equation"]);
32.322 +(*=== inhibit exn WN110914: declare_constraints doesnt work with ThmC.numerals_to_Free ========
32.323 +TODO: change to "equality (x + - 1*x = (0::real))"
32.324 + and search for an appropriate problem and method.
32.325 +
32.326 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.327 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.328 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.329 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.330 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.331 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.332 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.333 +case f of Form' (Test_Out.FormKF (~1,EdUndef,0,Nundef,"[]")) => ()
32.334 + | _ => error "polyeq.sml: diff.behav. in 1 = 0 -> []";
32.335 +
32.336 +"----- d0_true ------";
32.337 +val fmz = ["equality (0 = (0::real))", "solveFor x", "solutions L"];
32.338 +val (dI',pI',mI') = ("PolyEq",["degree_0", "polynomial", "univariate", "equation"],
32.339 + ["PolyEq", "solve_d0_polyeq_equation"]);
32.340 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.341 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.342 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.343 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.344 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.345 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.346 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.347 +case f of Form' (Test_Out.FormKF (~1,EdUndef,0,Nundef,"UniversalList")) => ()
32.348 + | _ => error "polyeq.sml: diff.behav. in 0 = 0 -> UniversalList";
32.349 +============ inhibit exn WN110914 ============================================*)
32.350 +
32.351 +\<close> text \<open> (*rewrite_set_, rewrite_ "- 1 / 4 = - 1 / 4" z =
32.352 +- 1 * (- 1 / 4 / 2) + sqrt ((- 1 / 4) \<up> 2 + - 4 * (- 1 / 8)) / 2 \<or>
32.353 +z =
32.354 +- 1 * (- 1 / 4 / 2) + - 1 * (sqrt ((- 1 / 4) \<up> 2 + - 4 * (- 1 / 8)) / 2) = NONE*)
32.355 +"----------- test thm's d2_pq_formulsxx[_neg]---------------------";
32.356 +"----------- test thm's d2_pq_formulsxx[_neg]---------------------";
32.357 +"----------- test thm's d2_pq_formulsxx[_neg]---------------------";
32.358 +"----- d2_pqformula1 ------!!!!";
32.359 +val fmz = ["equality (- 1/8 + (- 1/4)*z + z \<up> 2 = (0::real))", "solveFor z", "solutions L"];
32.360 +val (dI',pI',mI') =
32.361 + ("Isac_Knowledge", ["pqFormula", "degree_2", "polynomial", "univariate", "equation"], ["no_met"]);
32.362 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.363 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.364 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.365 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.366 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.367 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.368 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.369 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*Apply_Method ["PolyEq", "solve_d2_polyeq_pq_equation"]*)
32.370 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.371 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.372 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.373 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.374 +
32.375 +(*[z = 1 / 8 + sqrt (9 / 16) / 2, z = 1 / 8 + - 1 * sqrt (9 / 16) / 2] TODO sqrt*)
32.376 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt =..,Check_elementwise "Assumptions")*)
32.377 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.378 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.379 +
32.380 +if p = ([], Res) andalso
32.381 + f2str f = "[z = 1 / 8 + sqrt (9 / 16) / 2, z = 1 / 8 + - 1 * sqrt (9 / 16) / 2]" then
32.382 + case nxt of End_Proof' => () | _ => error "(- 1/8 + (- 1/4)*z + z \<up> 2 = (0::real)) CHANGED 1"
32.383 +else error "(- 1/8 + (- 1/4)*z + z \<up> 2 = (0::real)) CHANGED 2";
32.384 +
32.385 +\<close> ML \<open>
32.386 +"----------- equality (2 +(- 1)*x + x \<up> 2 = (0::real)) ----------------------------------------";
32.387 +"----------- equality (2 +(- 1)*x + x \<up> 2 = (0::real)) ----------------------------------------";
32.388 +"----------- equality (2 +(- 1)*x + x \<up> 2 = (0::real)) ----------------------------------------";
32.389 +"----- d2_pqformula1_neg ------";
32.390 +val fmz = ["equality (2 +(- 1)*x + x \<up> 2 = (0::real))", "solveFor x", "solutions L"];
32.391 +val (dI',pI',mI') = ("PolyEq",["pqFormula", "degree_2", "polynomial", "univariate", "equation"], ["PolyEq", "solve_d2_polyeq_pq_equation"]);
32.392 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.393 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.394 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.395 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.396 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.397 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.398 +(*### or2list False
32.399 + ([1],Res) False Or_to_List)*)
32.400 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.401 +(*### or2list False
32.402 + ([2],Res) [] Check_elementwise "Assumptions"*)
32.403 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.404 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.405 +val asm = Ctree.get_assumptions pt p;
32.406 +if f2str f = "[]" andalso
32.407 + UnparseC.terms asm = "[\"lhs (2 + - 1 * x + x \<up> 2 = 0) is_poly_in x\", " ^
32.408 + "\"lhs (2 + - 1 * x + x \<up> 2 = 0) has_degree_in x = 2\"]" then ()
32.409 +else error "polyeq.sml: diff.behav. in 2 +(- 1)*x + x \<up> 2 = 0";
32.410 +
32.411 +\<close> text \<open> (*TOODOO rewrite_set_, rewrite_ "- 1 / 2 = - 1 / 2" x = - 1 * (- 1 / 2) + sqrt ((- 1) \<up> 2 + 8) / 2 \<or>
32.412 +x = - 1 * (- 1 / 2) + - 1 * (sqrt ((- 1) \<up> 2 + 8) / 2) = NONE*)
32.413 +"----------- equality (- 2 +(- 1)*x + 1*x \<up> 2 = 0) ---------------------------------------------";
32.414 +"----------- equality (- 2 +(- 1)*x + 1*x \<up> 2 = 0) ---------------------------------------------";
32.415 +"----------- equality (- 2 +(- 1)*x + 1*x \<up> 2 = 0) ---------------------------------------------";
32.416 +"----- d2_pqformula2 ------";
32.417 +val fmz = ["equality (- 2 +(- 1)*x + 1*x \<up> 2 = 0)", "solveFor x", "solutions L"];
32.418 +val (dI',pI',mI') = ("PolyEq",["pqFormula", "degree_2", "polynomial", "univariate", "equation"],
32.419 + ["PolyEq", "solve_d2_polyeq_pq_equation"]);
32.420 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.421 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.422 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.423 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.424 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.425 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.426 +
32.427 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.428 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.429 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.430 +case f of Test_Out.FormKF "[x = 2, x = - 1]" => ()
32.431 + | _ => error "polyeq.sml: diff.behav. in - 2 + (- 1)*x + x^2 = 0 -> [x = 2, x = - 1]";
32.432 +
32.433 +
32.434 +\<close> text \<open> (*see TOODOO.1*)
32.435 +"----------- equality (- 2 + x + x \<up> 2 = 0) ---------------------------------------------------";
32.436 +"----------- equality (- 2 + x + x \<up> 2 = 0) ---------------------------------------------------";
32.437 +"----------- equality (- 2 + x + x \<up> 2 = 0) ---------------------------------------------------";
32.438 +"----- d2_pqformula3 ------";
32.439 +(*EP-9*)
32.440 +val fmz = ["equality (- 2 + x + x \<up> 2 = 0)", "solveFor x", "solutions L"];
32.441 +val (dI',pI',mI') = ("PolyEq",["pqFormula", "degree_2", "polynomial", "univariate", "equation"],
32.442 + ["PolyEq", "solve_d2_polyeq_pq_equation"]);
32.443 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.444 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.445 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.446 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.447 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.448 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.449 +
32.450 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.451 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.452 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.453 +case f of Test_Out.FormKF "[x = 1, x = - 2]" => ()
32.454 + | _ => error "polyeq.sml: diff.behav. in - 2 + x + x^2 = 0-> [x = 1, x = - 2]";
32.455 +
32.456 +
32.457 +\<close> ML \<open>
32.458 +"----------- equality (2 + x + x \<up> 2 = 0) ----------------------------------------------------";
32.459 +"----------- equality (2 + x + x \<up> 2 = 0) ----------------------------------------------------";
32.460 +"----------- equality (2 + x + x \<up> 2 = 0) ----------------------------------------------------";
32.461 +"----- d2_pqformula3_neg ------";
32.462 +val fmz = ["equality (2 + x + x \<up> 2 = 0)", "solveFor x", "solutions L"];
32.463 +val (dI',pI',mI') = ("PolyEq",["pqFormula", "degree_2", "polynomial", "univariate", "equation"],
32.464 + ["PolyEq", "solve_d2_polyeq_pq_equation"]);
32.465 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.466 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.467 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.468 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.469 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.470 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.471 +
32.472 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.473 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.474 +"TODO 2 + x + x \<up> 2 = 0";
32.475 +"TODO 2 + x + x \<up> 2 = 0";
32.476 +"TODO 2 + x + x \<up> 2 = 0";
32.477 +
32.478 +\<close> text \<open> (*see TOODOO.1*)
32.479 +"----------- equality (- 2 + x + 1*x \<up> 2 = 0)) ------------------------------------------------";
32.480 +"----------- equality (- 2 + x + 1*x \<up> 2 = 0)) ------------------------------------------------";
32.481 +"----------- equality (- 2 + x + 1*x \<up> 2 = 0)) ------------------------------------------------";
32.482 +"----- d2_pqformula4 ------";
32.483 +val fmz = ["equality (- 2 + x + 1*x \<up> 2 = 0)", "solveFor x", "solutions L"];
32.484 +val (dI',pI',mI') = ("PolyEq",["pqFormula", "degree_2", "polynomial", "univariate", "equation"],
32.485 + ["PolyEq", "solve_d2_polyeq_pq_equation"]);
32.486 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.487 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.488 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.489 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.490 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.491 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.492 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.493 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.494 +case f of Test_Out.FormKF "[x = 1, x = - 2]" => ()
32.495 + | _ => error "polyeq.sml: diff.behav. in - 2 + x + 1*x \<up> 2 = 0 -> [x = 1, x = - 2]";
32.496 +
32.497 +\<close> text \<open> (* loops*)
32.498 +"----------- equality (1*x + x \<up> 2 = 0) ----------------------------------------------------";
32.499 +"----------- equality (1*x + x \<up> 2 = 0) ----------------------------------------------------";
32.500 +"----------- equality (1*x + x \<up> 2 = 0) ----------------------------------------------------";
32.501 +"----- d2_pqformula5 ------";
32.502 +val fmz = ["equality (1*x + x \<up> 2 = 0)", "solveFor x", "solutions L"];
32.503 +val (dI',pI',mI') = ("PolyEq",["pqFormula", "degree_2", "polynomial", "univariate", "equation"],
32.504 + ["PolyEq", "solve_d2_polyeq_pq_equation"]);
32.505 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.506 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.507 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.508 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.509 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.510 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.511 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.512 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.513 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.514 +case f of Test_Out.FormKF "[x = 0, x = - 1]" => ()
32.515 + | _ => error "polyeq.sml: diff.behav. in 1*x + x^2 = 0 -> [x = 0, x = - 1]";
32.516 +
32.517 +\<close> text \<open> (* loops*)
32.518 +"----------- equality (1*x + 1*x \<up> 2 = 0) ----------------------------------------------------";
32.519 +"----------- equality (1*x + 1*x \<up> 2 = 0) ----------------------------------------------------";
32.520 +"----------- equality (1*x + 1*x \<up> 2 = 0) ----------------------------------------------------";
32.521 +"----- d2_pqformula6 ------";
32.522 +val fmz = ["equality (1*x + 1*x \<up> 2 = 0)", "solveFor x", "solutions L"];
32.523 +val (dI',pI',mI') = ("PolyEq",["pqFormula", "degree_2", "polynomial", "univariate", "equation"],
32.524 + ["PolyEq", "solve_d2_polyeq_pq_equation"]);
32.525 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.526 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.527 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.528 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.529 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.530 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.531 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.532 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.533 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.534 +case f of Test_Out.FormKF "[x = 0, x = - 1]" => ()
32.535 + | _ => error "polyeq.sml: diff.behav. in 1*x + 1*x^2 = 0 -> [x = 0, x = - 1]";
32.536 +
32.537 +\<close> text \<open> (* loops*)
32.538 +"----------- equality (x + x \<up> 2 = 0) ------------------------------------------------------";
32.539 +"----------- equality (x + x \<up> 2 = 0) ------------------------------------------------------";
32.540 +"----------- equality (x + x \<up> 2 = 0) ------------------------------------------------------";
32.541 +"----- d2_pqformula7 ------";
32.542 +(*EP- 10*)
32.543 +val fmz = ["equality ( x + x \<up> 2 = 0)", "solveFor x", "solutions L"];
32.544 +val (dI',pI',mI') = ("PolyEq",["pqFormula", "degree_2", "polynomial", "univariate", "equation"],
32.545 + ["PolyEq", "solve_d2_polyeq_pq_equation"]);
32.546 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.547 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.548 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.549 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.550 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.551 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.552 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.553 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.554 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.555 +case f of Test_Out.FormKF "[x = 0, x = - 1]" => ()
32.556 + | _ => error "polyeq.sml: diff.behav. in x + x^2 = 0 -> [x = 0, x = - 1]";
32.557 +
32.558 +\<close> text \<open> (* loops*)
32.559 +"----------- equality (x + 1*x \<up> 2 = 0) ------------------------------------------------------";
32.560 +"----------- equality (x + 1*x \<up> 2 = 0) ------------------------------------------------------";
32.561 +"----------- equality (x + 1*x \<up> 2 = 0) ------------------------------------------------------";
32.562 +"----- d2_pqformula8 ------";
32.563 +val fmz = ["equality (x + 1*x \<up> 2 = 0)", "solveFor x", "solutions L"];
32.564 +val (dI',pI',mI') = ("PolyEq",["pqFormula", "degree_2", "polynomial", "univariate", "equation"],
32.565 + ["PolyEq", "solve_d2_polyeq_pq_equation"]);
32.566 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.567 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.568 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.569 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.570 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.571 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.572 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.573 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.574 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.575 +case f of Test_Out.FormKF "[x = 0, x = - 1]" => ()
32.576 + | _ => error "polyeq.sml: diff.behav. in x + 1*x^2 = 0 -> [x = 0, x = - 1]";
32.577 +
32.578 +\<close> text \<open> (*see TOODOO.1*)
32.579 +"----------- equality (-4 + x \<up> 2 = 0) -------------------------------------------------------";
32.580 +"----------- equality (-4 + x \<up> 2 = 0) -------------------------------------------------------";
32.581 +"----------- equality (-4 + x \<up> 2 = 0) -------------------------------------------------------";
32.582 +"----- d2_pqformula9 ------";
32.583 +val fmz = ["equality (-4 + x \<up> 2 = 0)", "solveFor x", "solutions L"];
32.584 +val (dI',pI',mI') = ("PolyEq",["pqFormula", "degree_2", "polynomial", "univariate", "equation"],
32.585 + ["PolyEq", "solve_d2_polyeq_pq_equation"]);
32.586 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.587 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.588 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.589 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.590 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.591 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.592 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.593 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.594 +case f of Test_Out.FormKF "[x = 2, x = - 2]" => ()
32.595 + | _ => error "polyeq.sml: diff.behav. in -4 + x^2 = 0 -> [x = 2, x = - 2]";
32.596 +
32.597 +
32.598 +\<close> ML \<open>
32.599 +"----------- equality (4 + 1*x \<up> 2 = 0) -------------------------------------------------------";
32.600 +"----------- equality (4 + 1*x \<up> 2 = 0) -------------------------------------------------------";
32.601 +"----------- equality (4 + 1*x \<up> 2 = 0) -------------------------------------------------------";
32.602 +"----- d2_pqformula9_neg ------";
32.603 +val fmz = ["equality (4 + 1*x \<up> 2 = 0)", "solveFor x", "solutions L"];
32.604 +val (dI',pI',mI') = ("PolyEq",["pqFormula", "degree_2", "polynomial", "univariate", "equation"],
32.605 + ["PolyEq", "solve_d2_polyeq_pq_equation"]);
32.606 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.607 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.608 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.609 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.610 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.611 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.612 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.613 +"TODO 4 + 1*x \<up> 2 = 0";
32.614 +"TODO 4 + 1*x \<up> 2 = 0";
32.615 +"TODO 4 + 1*x \<up> 2 = 0";
32.616 +
32.617 +\<close> text \<open> (*see TOODOO.1*)
32.618 +"-------------------- test thm's d2_abc_formulsxx[_neg]-----";
32.619 +"-------------------- test thm's d2_abc_formulsxx[_neg]-----";
32.620 +"-------------------- test thm's d2_abc_formulsxx[_neg]-----";
32.621 +val fmz = ["equality (- 1 +(- 1)*x + 2*x \<up> 2 = 0)", "solveFor x", "solutions L"];
32.622 +val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
32.623 + ["PolyEq", "solve_d2_polyeq_abc_equation"]);
32.624 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.625 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.626 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.627 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.628 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.629 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.630 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.631 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.632 +case f of Test_Out.FormKF "[x = 1, x = - 1 / 2]" => ()
32.633 + | _ => error "polyeq.sml: diff.behav. in - 1 + (- 1)*x + 2*x^2 = 0 -> [x = 1, x = - 1/2]";
32.634 +
32.635 +\<close> ML \<open>
32.636 +"----------- equality (1 +(- 1)*x + 2*x \<up> 2 = 0) ----------------------------------------------";
32.637 +"----------- equality (1 +(- 1)*x + 2*x \<up> 2 = 0) ----------------------------------------------";
32.638 +"----------- equality (1 +(- 1)*x + 2*x \<up> 2 = 0) ----------------------------------------------";
32.639 +val fmz = ["equality (1 +(- 1)*x + 2*x \<up> 2 = 0)", "solveFor x", "solutions L"];
32.640 +val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
32.641 + ["PolyEq", "solve_d2_polyeq_abc_equation"]);
32.642 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.643 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.644 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.645 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.646 +
32.647 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.648 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.649 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.650 +"TODO 1 +(- 1)*x + 2*x \<up> 2 = 0";
32.651 +"TODO 1 +(- 1)*x + 2*x \<up> 2 = 0";
32.652 +"TODO 1 +(- 1)*x + 2*x \<up> 2 = 0";
32.653 +
32.654 +
32.655 +\<close> text \<open> (*see TOODOO.1*)
32.656 +"----------- equality (- 1 + x + 2*x \<up> 2 = 0) -------------------------------------------------";
32.657 +"----------- equality (- 1 + x + 2*x \<up> 2 = 0) -------------------------------------------------";
32.658 +"----------- equality (- 1 + x + 2*x \<up> 2 = 0) -------------------------------------------------";
32.659 +(*EP- 11*)
32.660 +val fmz = ["equality (- 1 + x + 2*x \<up> 2 = 0)", "solveFor x", "solutions L"];
32.661 +val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
32.662 + ["PolyEq", "solve_d2_polyeq_abc_equation"]);
32.663 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.664 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.665 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.666 +
32.667 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.668 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.669 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.670 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.671 +
32.672 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.673 +case f of Test_Out.FormKF "[x = 1 / 2, x = - 1]" => ()
32.674 + | _ => error "polyeq.sml: diff.behav. in - 1 + x + 2*x^2 = 0 -> [x = 1/2, x = - 1]";
32.675 +
32.676 +
32.677 +\<close> ML \<open>
32.678 +"----------- equality (1 + x + 2*x \<up> 2 = 0) --------------------------------------------------";
32.679 +"----------- equality (1 + x + 2*x \<up> 2 = 0) --------------------------------------------------";
32.680 +"----------- equality (1 + x + 2*x \<up> 2 = 0) --------------------------------------------------";
32.681 +val fmz = ["equality (1 + x + 2*x \<up> 2 = 0)", "solveFor x", "solutions L"];
32.682 +val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
32.683 + ["PolyEq", "solve_d2_polyeq_abc_equation"]);
32.684 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.685 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.686 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.687 +
32.688 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.689 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.690 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.691 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.692 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.693 +"TODO 1 + x + 2*x \<up> 2 = 0";
32.694 +"TODO 1 + x + 2*x \<up> 2 = 0";
32.695 +"TODO 1 + x + 2*x \<up> 2 = 0";
32.696 +
32.697 +
32.698 +\<close> text \<open> (*f = Test_Out.FormKF "[]" *)
32.699 +val fmz = ["equality (- 2 + 1*x + x \<up> 2 = 0)", "solveFor x", "solutions L"];
32.700 +val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
32.701 + ["PolyEq", "solve_d2_polyeq_abc_equation"]);
32.702 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.703 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.704 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.705 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.706 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.707 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.708 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.709 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.710 +case f of Test_Out.FormKF "[x = 1, x = - 2]" => ()
32.711 + | _ => error "polyeq.sml: diff.behav. in - 2 + 1*x + x^2 = 0 -> [x = 1, x = - 2]";
32.712 +
32.713 +\<close> ML \<open>
32.714 +val fmz = ["equality ( 2 + 1*x + x \<up> 2 = 0)", "solveFor x", "solutions L"];
32.715 +val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
32.716 + ["PolyEq", "solve_d2_polyeq_abc_equation"]);
32.717 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.718 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.719 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.720 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.721 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.722 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.723 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.724 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.725 +"TODO 2 + 1*x + x \<up> 2 = 0";
32.726 +"TODO 2 + 1*x + x \<up> 2 = 0";
32.727 +"TODO 2 + 1*x + x \<up> 2 = 0";
32.728 +
32.729 +\<close> text \<open> (*f = Test_Out.FormKF "[]" *)
32.730 +(*EP- 12*)
32.731 +val fmz = ["equality (- 2 + x + x \<up> 2 = 0)", "solveFor x", "solutions L"];
32.732 +val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
32.733 + ["PolyEq", "solve_d2_polyeq_abc_equation"]);
32.734 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.735 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.736 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.737 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.738 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.739 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.740 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.741 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.742 +case f of Test_Out.FormKF "[x = 1, x = - 2]" => ()
32.743 + | _ => error "polyeq.sml: diff.behav. in - 2 + x + x^2 = 0 -> [x = 1, x = - 2]";
32.744 +
32.745 +\<close> ML \<open>
32.746 +val fmz = ["equality ( 2 + x + x \<up> 2 = 0)", "solveFor x", "solutions L"];
32.747 +val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
32.748 + ["PolyEq", "solve_d2_polyeq_abc_equation"]);
32.749 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.750 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.751 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.752 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.753 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.754 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.755 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.756 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.757 +"TODO 2 + x + x \<up> 2 = 0";
32.758 +"TODO 2 + x + x \<up> 2 = 0";
32.759 +"TODO 2 + x + x \<up> 2 = 0";
32.760 +
32.761 +\<close> text \<open> (*f = Test_Out.FormKF "[]" *)
32.762 +(*EP- 13*)
32.763 +val fmz = ["equality (-8 + 2*x \<up> 2 = 0)", "solveFor x", "solutions L"];
32.764 +val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
32.765 + ["PolyEq", "solve_d2_polyeq_abc_equation"]);
32.766 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.767 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.768 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.769 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.770 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.771 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.772 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.773 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.774 +case f of Test_Out.FormKF "[x = 2, x = - 2]" => ()
32.775 + | _ => error "polyeq.sml: diff.behav. in -8 + 2*x^2 = 0 -> [x = 2, x = - 2]";
32.776 +
32.777 +\<close> ML \<open>
32.778 +val fmz = ["equality ( 8+ 2*x \<up> 2 = 0)", "solveFor x", "solutions L"];
32.779 +val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
32.780 + ["PolyEq", "solve_d2_polyeq_abc_equation"]);
32.781 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.782 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.783 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.784 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.785 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.786 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.787 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.788 +"TODO 8+ 2*x \<up> 2 = 0";
32.789 +"TODO 8+ 2*x \<up> 2 = 0";
32.790 +"TODO 8+ 2*x \<up> 2 = 0";
32.791 +
32.792 +\<close> text \<open> (*f = Test_Out.FormKF "[]" *)
32.793 +(*EP- 14*)
32.794 +val fmz = ["equality (-4 + x \<up> 2 = 0)", "solveFor x", "solutions L"];
32.795 +val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"], ["PolyEq", "solve_d2_polyeq_abc_equation"]);
32.796 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.797 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.798 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.799 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.800 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.801 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.802 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.803 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.804 +case f of Test_Out.FormKF "[x = 2, x = - 2]" => ()
32.805 + | _ => error "polyeq.sml: diff.behav. in -4 + x^2 = 0 -> [x = 2, x = - 2]";
32.806 +
32.807 +
32.808 +\<close> ML \<open>
32.809 +val fmz = ["equality ( 4+ x \<up> 2 = 0)", "solveFor x", "solutions L"];
32.810 +val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"], ["PolyEq", "solve_d2_polyeq_abc_equation"]);
32.811 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.812 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.813 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.814 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.815 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.816 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.817 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.818 +"TODO 4+ x \<up> 2 = 0";
32.819 +"TODO 4+ x \<up> 2 = 0";
32.820 +"TODO 4+ x \<up> 2 = 0";
32.821 +
32.822 +\<close> text \<open> (*f = Test_Out.FormKF "[]"*)
32.823 +(*EP- 15*)
32.824 +val fmz = ["equality (2*x + 2*x \<up> 2 = 0)", "solveFor x", "solutions L"];
32.825 +val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
32.826 + ["PolyEq", "solve_d2_polyeq_abc_equation"]);
32.827 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.828 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.829 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.830 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.831 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.832 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.833 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.834 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.835 +case f of Test_Out.FormKF "[x = 0, x = - 1]" => ()
32.836 + | _ => error "polyeq.sml: diff.behav. in x + x^2 = 0 -> [x = 0, x = - 1]";
32.837 +
32.838 +\<close> text \<open> (* loops*)
32.839 +val fmz = ["equality (1*x + x \<up> 2 = 0)", "solveFor x", "solutions L"];
32.840 +val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
32.841 + ["PolyEq", "solve_d2_polyeq_abc_equation"]);
32.842 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.843 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.844 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.845 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.846 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.847 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.848 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.849 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.850 +case f of Test_Out.FormKF "[x = 0, x = - 1]" => ()
32.851 + | _ => error "polyeq.sml: diff.behav. in x + x^2 = 0 -> [x = 0, x = - 1]";
32.852 +
32.853 +\<close> text \<open> (* loops*)
32.854 +(*EP- 16*)
32.855 +val fmz = ["equality (x + 2*x \<up> 2 = 0)", "solveFor x", "solutions L"];
32.856 +val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
32.857 + ["PolyEq", "solve_d2_polyeq_abc_equation"]);
32.858 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.859 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.860 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.861 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.862 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.863 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.864 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.865 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.866 +case f of Test_Out.FormKF "[x = 0, x = - 1 / 2]" => ()
32.867 + | _ => error "polyeq.sml: diff.behav. in x + x^2 = 0 -> [x = 0, x = - 1 / 2]";
32.868 +
32.869 +\<close> text \<open> (* loops*)
32.870 +(*EP-//*)
32.871 +val fmz = ["equality (x + x \<up> 2 = 0)", "solveFor x", "solutions L"];
32.872 +val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
32.873 + ["PolyEq", "solve_d2_polyeq_abc_equation"]);
32.874 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.875 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.876 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.877 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.878 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.879 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.880 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.881 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.882 +case f of Test_Out.FormKF "[x = 0, x = - 1]" => ()
32.883 + | _ => error "polyeq.sml: diff.behav. in x + x^2 = 0 -> [x = 0, x = - 1]";
32.884 +
32.885 +
32.886 +\<close> text \<open> (* loops*)
32.887 +"----------- (-8 - 2*x + x \<up> 2 = 0), (*Schalk 2, S.67 Nr.31.b----";
32.888 +"----------- (-8 - 2*x + x \<up> 2 = 0), (*Schalk 2, S.67 Nr.31.b----";
32.889 +"----------- (-8 - 2*x + x \<up> 2 = 0), (*Schalk 2, S.67 Nr.31.b----";
32.890 +(*stopped du to TODO.txt WN111014.TODO calculate_Poly < calculate_Rational < calculate_RootRat
32.891 +see --- val rls = calculate_RootRat > calculate_Rational ---
32.892 +calculate_RootRat was a TODO with 2002, requires re-design.
32.893 +see also --- (-8 - 2*x + x \<up> 2 = 0), by rewriting --- below
32.894 +*)
32.895 + val fmz = ["equality (-8 - 2*x + x \<up> 2 = 0)", (*Schalk 2, S.67 Nr.31.b*)
32.896 + "solveFor x", "solutions L"];
32.897 + val (dI',pI',mI') =
32.898 + ("PolyEq",["degree_2", "expanded", "univariate", "equation"],
32.899 + ["PolyEq", "complete_square"]);
32.900 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.901 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.902 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.903 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.904 +
32.905 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.906 +(*Apply_Method ("PolyEq", "complete_square")*)
32.907 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.908 +(*"-8 - 2 * x + x \<up> 2 = 0", nxt = Rewrite_Set_Inst ... "complete_square*)
32.909 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.910 +(*"-8 + (2 / 2 - x) \<up> 2 = (2 / 2) \<up> 2", nxt = Rewrite("square_explicit1"*)
32.911 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.912 +(*"(2 / 2 - x) \<up> 2 = (2 / 2) \<up> 2 - -8" nxt = Rewrite("root_plus_minus*)
32.913 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.914 +(*"2 / 2 - x = sqrt ((2 / 2) \<up> 2 - -8) |
32.915 + 2 / 2 - x = - sqrt ((2 / 2) \<up> 2 - -8)" nxt = Rewr_Inst("bdv_explicit2"*)
32.916 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.917 +(*"2 / 2 - x = sqrt ((2 / 2) \<up> 2 - -8) |
32.918 + - 1*x = - (2 / 2) + - sqrt ((2 / 2) \<up> 2 - -8)"nxt = R_Inst("bdv_explt2"*)
32.919 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.920 +(*"- 1 * x = - (2 / 2) + sqrt ((2 / 2) \<up> 2 - -8) |
32.921 + - 1 * x = (- (2 / 2) + - sqrt ((2 / 2) \<up> 2 - -8))"nxt = bdv_explicit3*)
32.922 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.923 +(*"- 1 * x = - (2 / 2) + sqrt ((2 / 2) \<up> 2 - -8) |
32.924 + x = - 1 * (- (2 / 2) + - sqrt ((2 / 2) \<up> 2 - -8))" nxt = bdv_explicit3*)
32.925 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.926 +(*"x = - 1 * (- (2 / 2) + sqrt ((2 / 2) \<up> 2 - -8)) |
32.927 + x = - 1 * (- (2 / 2) + - sqrt ((2 / 2) \<up> 2 - -8))"nxt = calculate_Rational
32.928 + NOT IMPLEMENTED SINCE 2002 ------------------------------ \<up> \<up> \<up> \<up> \<up> \<up> *)
32.929 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.930 +(*"x = - 2 | x = 4" nxt = Or_to_List*)
32.931 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.932 +(*"[x = - 2, x = 4]" nxt = Check_Postcond*)
32.933 +val (p,_,f,nxt,_,pt) = me nxt p [] pt; f2str f;
32.934 +(* FIXXXME
32.935 + case f of Form' (Test_Out.FormKF (~1,EdUndef,0,Nundef,"[x = - 2, x = 4]")) => () TODO
32.936 + | _ => error "polyeq.sml: diff.behav. in [x = - 2, x = 4]";
32.937 +*)
32.938 +if f2str f =
32.939 +"[x = - 1 * - 1 + - 1 * sqrt (2 \<up> 2 / 2 \<up> 2 - -8),\n x = - 1 * - 1 + - 1 * (- 1 * sqrt (2 \<up> 2 / 2 \<up> 2 - -8))]"
32.940 +(*"[x = - 1 * - 1 + - 1 * sqrt (1 \<up> 2 - -8),\n x = - 1 * - 1 + - 1 * (- 1 * sqrt (1 \<up> 2 - -8))]"*)
32.941 +then () else error "polyeq.sml corrected?behav. in [x = - 2, x = 4]";
32.942 +
32.943 +
32.944 +\<close> text \<open> (* loops*)
32.945 +"----------- (-8 - 2*x + x \<up> 2 = 0), by rewriting ---------------";
32.946 +"----------- (-8 - 2*x + x \<up> 2 = 0), by rewriting ---------------";
32.947 +"----------- (-8 - 2*x + x \<up> 2 = 0), by rewriting ---------------";
32.948 +(*stopped du to TODO.txt WN111014.TODO calculate_Poly < calculate_Rational < calculate_RootRat
32.949 +see --- val rls = calculate_RootRat > calculate_Rational ---*)
32.950 +val thy = @ {theory PolyEq};
32.951 +val ctxt = Proof_Context.init_global thy;
32.952 +val inst = [((the o (parseNEW ctxt)) "bdv::real", (the o (parseNEW ctxt)) "x::real")];
32.953 +val t = (the o (parseNEW ctxt)) "-8 - 2*x + x \<up> 2 = (0::real)";
32.954 +
32.955 +val rls = complete_square;
32.956 +val SOME (t,asm) = rewrite_set_inst_ thy true inst rls t;
32.957 +UnparseC.term t = "-8 + (2 / 2 - x) \<up> 2 = (2 / 2) \<up> 2";
32.958 +
32.959 +val thm = ThmC.numerals_to_Free @{thm square_explicit1};
32.960 +val SOME (t,asm) = rewrite_ thy dummy_ord Rule_Set.Empty true thm t;
32.961 +UnparseC.term t = "(2 / 2 - x) \<up> 2 = (2 / 2) \<up> 2 - -8";
32.962 +
32.963 +val thm = ThmC.numerals_to_Free @{thm root_plus_minus};
32.964 +val SOME (t,asm) = rewrite_ thy dummy_ord PolyEq_erls true thm t;
32.965 +UnparseC.term t = "2 / 2 - x = sqrt ((2 / 2) \<up> 2 - -8) |"^
32.966 + "\n2 / 2 - x = - 1 * sqrt ((2 / 2) \<up> 2 - -8)";
32.967 +
32.968 +(*the thm bdv_explicit2* here required to be constrained to ::real*)
32.969 +val thm = ThmC.numerals_to_Free @{thm bdv_explicit2};
32.970 +val SOME (t,asm) = rewrite_inst_ thy dummy_ord Rule_Set.Empty true inst thm t;
32.971 +UnparseC.term t = "2 / 2 - x = sqrt ((2 / 2) \<up> 2 - -8) |"^
32.972 + "\n- 1 * x = - (2 / 2) + - 1 * sqrt ((2 / 2) \<up> 2 - -8)";
32.973 +
32.974 +val thm = ThmC.numerals_to_Free @{thm bdv_explicit3};
32.975 +val SOME (t,asm) = rewrite_inst_ thy dummy_ord Rule_Set.Empty true inst thm t;
32.976 +UnparseC.term t = "2 / 2 - x = sqrt ((2 / 2) \<up> 2 - -8) |"^
32.977 + "\nx = - 1 * (- (2 / 2) + - 1 * sqrt ((2 / 2) \<up> 2 - -8))";
32.978 +
32.979 +val thm = ThmC.numerals_to_Free @{thm bdv_explicit2};
32.980 +val SOME (t,asm) = rewrite_inst_ thy dummy_ord Rule_Set.Empty true inst thm t;
32.981 +UnparseC.term t = "- 1 * x = - (2 / 2) + sqrt ((2 / 2) \<up> 2 - -8) |"^
32.982 + "\nx = - 1 * (- (2 / 2) + - 1 * sqrt ((2 / 2) \<up> 2 - -8))";
32.983 +
32.984 +val rls = calculate_RootRat;
32.985 +val SOME (t,asm) = rewrite_set_ thy true rls t;
32.986 +if UnparseC.term t =
32.987 + "- 1 * x = - 1 + sqrt (2 \<up> 2 / 2 \<up> 2 - -8) \<or>\nx = - 1 * - 1 + - 1 * (- 1 * sqrt (2 \<up> 2 / 2 \<up> 2 - -8))"
32.988 +(*"- 1 * x = - 1 + sqrt (2 \<up> 2 / 2 \<up> 2 - -8) |\nx = - 1 * - 1 + - 1 * (- 1 * sqrt (2 \<up> 2 / 2 \<up> 2 - -8))"..isabisac15*)
32.989 +then () else error "(-8 - 2*x + x \<up> 2 = 0), by rewriting -- ERROR INDICATES IMPROVEMENT";
32.990 +(*SHOULD BE: UnparseC.term = "x = - 2 | x = 4;*)
32.991 +
32.992 +
32.993 +\<close> ML \<open>
32.994 +"-------------------- (3 - 10*x + 3*x \<up> 2 = 0), ----------------------";
32.995 +"-------------------- (3 - 10*x + 3*x \<up> 2 = 0), ----------------------";
32.996 +"-------------------- (3 - 10*x + 3*x \<up> 2 = 0), ----------------------";
32.997 +"---- test the erls ----";
32.998 + val t1 = (Thm.term_of o the o (TermC.parse thy)) "0 <= (10/3/2) \<up> 2 - 1";
32.999 + val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_erls t1;
32.1000 + val t' = UnparseC.term t;
32.1001 + (*if t'= "HOL.True" then ()
32.1002 + else error "polyeq.sml: diff.behav. in 'rewrite_set_.. PolyEq_erls";*)
32.1003 +(* *)
32.1004 + val fmz = ["equality (3 - 10*x + 3*x \<up> 2 = 0)",
32.1005 + "solveFor x", "solutions L"];
32.1006 + val (dI',pI',mI') =
32.1007 + ("PolyEq",["degree_2", "expanded", "univariate", "equation"],
32.1008 + ["PolyEq", "complete_square"]);
32.1009 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.1010 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.1011 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.1012 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.1013 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.1014 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.1015 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.1016 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.1017 + (*Apply_Method ("PolyEq", "complete_square")*)
32.1018 + val (p,_,f,nxt,_,pt) = me nxt p [] pt; f2str f;
32.1019 +
32.1020 +\<close> text \<open> (* loops*)
32.1021 +\<close> text \<open> (*f = Test_Out.FormKF "[]" *)
32.1022 +\<close> text \<open> (*see TOODOO.1*)
32.1023 +\<close> ML \<open>
32.1024 +\<close> text \<open> (* loops*)
32.1025 +"----------- (- 16 + 4*x + 2*x \<up> 2 = 0), --------------------------";
32.1026 +"----------- (- 16 + 4*x + 2*x \<up> 2 = 0), --------------------------";
32.1027 +"----------- (- 16 + 4*x + 2*x \<up> 2 = 0), --------------------------";
32.1028 + val fmz = ["equality (- 16 + 4*x + 2*x \<up> 2 = 0)",
32.1029 + "solveFor x", "solutions L"];
32.1030 + val (dI',pI',mI') =
32.1031 + ("PolyEq",["degree_2", "expanded", "univariate", "equation"],
32.1032 + ["PolyEq", "complete_square"]);
32.1033 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.1034 +val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.1035 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.1036 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.1037 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.1038 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.1039 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.1040 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.1041 + (*Apply_Method ("PolyEq", "complete_square")*)
32.1042 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.1043 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.1044 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.1045 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.1046 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.1047 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.1048 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.1049 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.1050 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.1051 + val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.1052 +(* FIXXXXME n1.,
32.1053 + case f of Form' (Test_Out.FormKF (~1,EdUndef,0,Nundef,"[x = 2, x = -4]")) => () TODO
32.1054 + | _ => error "polyeq.sml: diff.behav. in [x = 2, x = -4]";
32.1055 +*)
32.1056 +
32.1057 +\<close> ML \<open>
32.1058 +\<close> text \<open> (*-------^^^^^ polyeq-1.sml------------vvv diff.sml-------TOODOO----------------*)
32.1059 +\<close>
32.1060 +
32.1061 +section \<open>======== check Knowledge/diff.sml =================================================\<close>
32.1062 +ML \<open>
32.1063 +\<close> ML \<open>
32.1064 +(* Title: test/Tools/isac/Knowledge/diff.sml
32.1065 + Author: Walther Neuper
32.1066 + Use is subject to license terms.
32.1067 +*)
32.1068 +"-----------------------------------------------------------------------------------------------";
32.1069 "-----------------------------------------------------------------------------------------------";
32.1070 "table of contents -----------------------------------------------------------------------------";
32.1071 "-----------------------------------------------------------------------------------------------";
32.1072 -"----------- Take as 1st stac in program -------------------------------------------------------";
32.1073 -"----------- re-build: fun locate_input_tactic -------------------------------------------------";
32.1074 -"----------- fun locate_input_tactic Helpless, NOT applicable ----------------------------------";
32.1075 -"----------- re-build: fun find_next_step, mini ------------------------------------------------";
32.1076 -"----------- re-build: fun locate_input_term ---------------------------------------------------";
32.1077 -"-----------------------------------------------------------------------------------------------";
32.1078 -"-----------------------------------------------------------------------------------------------";
32.1079 -"-----------------------------------------------------------------------------------------------";
32.1080 +"----------- problemtype --------------------------------";
32.1081 +"----------- for correction of diff_const ---------------";
32.1082 +"----------- for correction of diff_quot ----------------";
32.1083 +"----------- differentiate by rewrite -------------------";
32.1084 +"----------- differentiate: me (*+ tacs input*) ---------";
32.1085 +"----------- 1.5.02 me from script ----------------------";
32.1086 +"----------- primed id ----------------------------------";
32.1087 +"----------- diff_conv, sym_diff_conv -------------------";
32.1088 +"----------- autoCalculate differentiate_on_R 2/x \<up> 2 -----";
32.1089 +"----------- autoCalculate diff after_simplification ----";
32.1090 +"----------- autoCalculate differentiate_equality -------";
32.1091 +"----------- tests for examples -------------------------";
32.1092 +"------------inform for x \<up> 2+x+1 -------------------------";
32.1093 +"--------------------------------------------------------";
32.1094 +"--------------------------------------------------------";
32.1095 +"--------------------------------------------------------";
32.1096
32.1097 -"----------- Take as 1st stac in program -------------------------------------------------------";
32.1098 -"----------- Take as 1st stac in program -------------------------------------------------------";
32.1099 -"----------- Take as 1st stac in program -------------------------------------------------------";
32.1100 -"compare --- Apply_Method with initial Take by Step.do_next --- in test/../step-solve ----------";
32.1101 +
32.1102 +val thy = @{theory "Diff"};
32.1103 +
32.1104 +"----------- problemtype --------------------------------";
32.1105 +"----------- problemtype --------------------------------";
32.1106 +"----------- problemtype --------------------------------";
32.1107 +val pbt = {Given =["functionTerm f_f", "differentiateFor v_v"],
32.1108 + Where =[],
32.1109 + Find =["derivative f_f'"],
32.1110 + With =[],
32.1111 + Relate=[]}:string ppc;
32.1112 +val chkpbt = ((map (the o (TermC.parse thy))) o P_Model.to_list) pbt;
32.1113 +
32.1114 +val org = ["functionTerm (d_d x (x \<up> 2 + 3 * x + 4))",
32.1115 + "differentiateFor x", "derivative f_f'"];
32.1116 +val chkorg = map (the o (TermC.parse thy)) org;
32.1117 +
32.1118 +Problem.from_store ["derivative_of", "function"];
32.1119 +MethodC.from_store ["diff", "differentiate_on_R"];
32.1120 +
32.1121 +"----------- for correction of diff_const ---------------";
32.1122 +"----------- for correction of diff_const ---------------";
32.1123 +"----------- for correction of diff_const ---------------";
32.1124 +(*re-evaluate this file, otherwise > *** ME_Isa: 'erls' not known*)
32.1125 +val t = (Thm.term_of o the o (TermC.parse thy)) "Not (x =!= a)";
32.1126 +case rewrite_set_ thy false erls_diff t of
32.1127 + SOME (Const ("HOL.True", _), []) => ()
32.1128 +| _ => error "rewrite_set_ Not (x =!= a) changed";
32.1129 +
32.1130 +val t =(Thm.term_of o the o (TermC.parse thy)) "2 is_const";
32.1131 +case rewrite_set_ thy false erls_diff t of
32.1132 + SOME (Const ("HOL.True", _), []) => ()
32.1133 +| _ => error "rewrite_set_ 2 is_const changed";
32.1134 +
32.1135 +val thm = @{thm diff_const};
32.1136 +val ct = (Thm.term_of o the o (TermC.parse thy)) "d_d x x";
32.1137 +val subst = [(@{term "bdv::real"}, @{term "x::real"})];
32.1138 +val NONE = (rewrite_inst_ thy tless_true erls_diff false subst thm ct);
32.1139 +
32.1140 +"----------- for correction of diff_quot ----------------";
32.1141 +"----------- for correction of diff_quot ----------------";
32.1142 +"----------- for correction of diff_quot ----------------";
32.1143 +val thy = @{theory "Diff"};
32.1144 +val ct = (Thm.term_of o the o (TermC.parse thy)) "Not (x = 0)";
32.1145 +rewrite_set_ thy false erls_diff ct;
32.1146 +
32.1147 +val ct = (Thm.term_of o the o (TermC.parse thy)) "d_d x ((x+1) / (x - 1))";
32.1148 +val thm = @{thm diff_quot};
32.1149 +val SOME (ctt,_) =
32.1150 + (rewrite_inst_ thy tless_true erls_diff true subst thm ct);
32.1151 +
32.1152 +"----------- differentiate by rewrite -------------------";
32.1153 +"----------- differentiate by rewrite -------------------";
32.1154 +"----------- differentiate by rewrite -------------------";
32.1155 +val thy = @{theory "Diff"};
32.1156 +val ct = (Thm.term_of o the o (TermC.parse thy)) "d_d x (x \<up> 2 + 3 * x + 4)";
32.1157 +"--- 1 ---";
32.1158 +val thm = @{thm "diff_sum"};
32.1159 +val (ct, _) = the (rewrite_inst_ thy tless_true erls_diff true subst thm ct);
32.1160 +"--- 2 ---";
32.1161 +val (ct, _) = the (rewrite_inst_ thy tless_true erls_diff true subst thm ct);
32.1162 +"--- 3 ---";
32.1163 +val thm = @{thm "diff_prod_const"};
32.1164 +val (ct, _) = the (rewrite_inst_ thy tless_true erls_diff true subst thm ct);
32.1165 +"--- 4 ---";
32.1166 +val thm = @{thm "diff_pow"};
32.1167 +val (ct, _) = the (rewrite_inst_ thy tless_true erls_diff true subst thm ct);
32.1168 +"--- 5 ---";
32.1169 +val thm = @{thm "diff_const"};
32.1170 +val (ct, _) = the (rewrite_inst_ thy tless_true erls_diff true subst thm ct);
32.1171 +"--- 6 ---";
32.1172 +val thm = @{thm "diff_var"};
32.1173 +val (ct, _) = the (rewrite_inst_ thy tless_true erls_diff true subst thm ct);
32.1174 +if UnparseC.term ct = "2 * x \<up> (2 - 1) + 3 * 1 + 0" then ()
32.1175 +else error "diff.sml diff.behav. in rewrite 1";
32.1176 +"--- 7 ---";
32.1177 +"--- 7 ---";
32.1178 +val rls = Test_simplify;
32.1179 +val ct = (Thm.term_of o the o (TermC.parse thy)) "2 * x \<up> (2 - 1) + 3 * 1 + 0";
32.1180 +val (ct, _) = the (rewrite_set_ thy true rls ct);
32.1181 +if UnparseC.term ct = "3 + 2 * x" then () else error "rewrite_set_ Test_simplify 2 changed";
32.1182 +
32.1183 +"----------- differentiate: me (*+ tacs input*) ---------";
32.1184 +"----------- differentiate: me (*+ tacs input*) ---------";
32.1185 +"----------- differentiate: me (*+ tacs input*) ---------";
32.1186 +val fmz = ["functionTerm (x \<up> 2 + 3 * x + 4)",
32.1187 + "differentiateFor x", "derivative f_f'"];
32.1188 +val (dI',pI',mI') =
32.1189 + ("Diff",["derivative_of", "function"],
32.1190 + ["diff", "diff_simpl"]);
32.1191 val p = e_pos'; val c = [];
32.1192 +"--- s1 ---";
32.1193 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.1194 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1195 +"--- s2 ---";
32.1196 +(*val nxt = ("Add_Given",
32.1197 +Add_Given "functionTerm (d_d x (x \<up> #2 + #3 * x + #4))");*)
32.1198 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1199 +"--- s3 ---";
32.1200 +(*val nxt = ("Add_Given",Add_Given "differentiateFor x");*)
32.1201 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1202 +"--- s4 ---";
32.1203 +(*val nxt = ("Add_Find",Add_Find "derivative f_f'");*)
32.1204 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1205 +"--- s5 ---";
32.1206 +(*val nxt = ("Specify_Theory",Specify_Theory dI');*)
32.1207 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1208 +"--- s6 ---";
32.1209 +(*val nxt = ("Specify_Problem",Specify_Problem pI');*)
32.1210 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1211 +"--- s7 ---";
32.1212 +(*val nxt = ("Specify_Method",Specify_Method mI');*)
32.1213 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1214 +"--- s8 ---";
32.1215 +(*val nxt = ("Apply_Method",Apply_Method mI');*)
32.1216 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1217 +"--- 1 ---";
32.1218 +(*val nxt = ("Rewrite_Inst",Rewrite_Inst (["(''bdv'',x)"],("diff_sum", "")));*)
32.1219 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1220 +"--- 2 ---";
32.1221 +(*val nxt = ("Rewrite_Inst",Rewrite_Inst (["(''bdv'',x)"],("diff_sum", "")));*)
32.1222 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1223 +(*val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1224 +val (p,_,f,nxt,_,pt) = me nxt p c pt;*)
32.1225 +"--- 3 ---";
32.1226 +(*val nxt = ("Rewrite_Inst",Rewrite_Inst (["(''bdv'',x)"],("diff_prod_const",...;*)
32.1227 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1228 +(*val (p,_,f,nxt,_,pt) = me nxt p c pt;*)
32.1229 +"--- 4 ---";
32.1230 +(*val nxt = ("Rewrite_Inst",Rewrite_Inst (["(''bdv'',x)"],("diff_pow", "")));*)
32.1231 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1232 +(*val (p,_,f,nxt,_,pt) = me nxt p c pt;*)
32.1233 +"--- 5 ---";
32.1234 +(*val nxt = ("Rewrite_Inst",Rewrite_Inst (["(''bdv'',x)"],("diff_prod_const",...;*)
32.1235 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1236 +(*val (p,_,f,nxt,_,pt) = me nxt p c pt;*)
32.1237 +"--- 6 ---";
32.1238 +(*val nxt = ("Rewrite_Inst",Rewrite_Inst (["(''bdv'',x)"],("diff_var", "")));*)
32.1239 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1240 +if f2str f = "2 * x \<up> (2 - 1) + 3 * 1 + 0" then ()
32.1241 +else error "diff.sml: diff.behav. in d_d x \<up> 2 + 3 * x + 4";
32.1242 +"--- 7 ---";
32.1243 +(*val nxt = ("Rewrite_Set",Rewrite_Set "make_polynomial");*)
32.1244 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1245 +"--- 8 ---";
32.1246 +(*val nxt = ("Check_Postcond",Check_Postcond ("Diff", "differentiate_on_R"));*)
32.1247 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1248 +"--- 9 ---";
32.1249 +(*val nxt = ("End_Proof'",End_Proof');*)
32.1250 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
32.1251 +if f2str f = "3 + 2 * x"
32.1252 + then case nxt of End_Proof' => ()
32.1253 + | _ => error "diff.sml: new.behav. in me (*+ tacs input*) 1"
32.1254 +else error "diff.sml: new.behav. in me (*+ tacs input*) 2";
32.1255 +(*if f = EmptyMout then () else error "new behaviour in + tacs input"*)
32.1256 +
32.1257 +"----------- 1.5.02 me from script ----------------------";
32.1258 +"----------- 1.5.02 me from script ----------------------";
32.1259 +"----------- 1.5.02 me from script ----------------------";
32.1260 +(*exp_Diff_No- 1.xml*)
32.1261 +val fmz = ["functionTerm (x \<up> 2 + 3 * x + 4)",
32.1262 + "differentiateFor x", "derivative f_f'"];
32.1263 +val (dI',pI',mI') =
32.1264 + ("Diff",["derivative_of", "function"],
32.1265 + ["diff", "diff_simpl"]);
32.1266 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.1267 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1268 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1269 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1270 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1271 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1272 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1273 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1274 +(*nxt = ("Apply_Method",Apply_Method ("Diff", "differentiate_on_R*)
32.1275 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1276 +
32.1277 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1278 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1279 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1280 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1281 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1282 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1283 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1284 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1285 +case nxt of End_Proof' => ()
32.1286 +| _ => error "new behaviour in tests/differentiate, 1.5.02 me from script";
32.1287 +
32.1288 +"----------- primed id ----------------------------------";
32.1289 +"----------- primed id ----------------------------------";
32.1290 +"----------- primed id ----------------------------------";
32.1291 +val f_ = TermC.str2term "f_f::bool";
32.1292 +val f = TermC.str2term "A = s * (a - s)";
32.1293 +val v_ = TermC.str2term "v_v";
32.1294 +val v = TermC.str2term "s";
32.1295 +val screxp0 = TermC.str2term "Take ((primed (lhs f_f)) = d_d v_v (rhs f_f))";
32.1296 +TermC.atomty screxp0;
32.1297 +
32.1298 +val screxp1 = subst_atomic [(f_, f), (v_, v)] screxp0;
32.1299 +UnparseC.term screxp1;
32.1300 +TermC.atomty screxp1;
32.1301 +
32.1302 +val SOME (f'_,_) = rewrite_set_ (@{theory "Isac_Knowledge"}) false srls_diff screxp1;
32.1303 +if UnparseC.term f'_= "Take (A' = d_d s (s * (a - s)))" then ()
32.1304 +else error "diff.sml: diff.behav. in 'primed'";
32.1305 +TermC.atomty f'_;
32.1306 +
32.1307 +val str = "Program DiffEqScr (f_f::bool) (v_v::real) = \
32.1308 +\ (let f_f' = Take ((primed (lhs f_f)) = d_d v_v (rhs f_f)) \
32.1309 +\ in (((Try (Repeat (Rewrite frac_conv))) #> \
32.1310 + \ (Try (Repeat (Rewrite root_conv))) #> \
32.1311 + \ (Try (Repeat (Rewrite realpow_pow))) #> \
32.1312 + \ (Repeat \
32.1313 + \ ((Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_sum )) Or \
32.1314 + \ (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_prod_const )) Or \
32.1315 + \ (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_prod )) Or \
32.1316 + \ (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_quot )) Or \
32.1317 + \ (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_sin )) Or \
32.1318 + \ (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_sin_chain )) Or \
32.1319 + \ (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_cos )) Or \
32.1320 + \ (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_cos_chain )) Or \
32.1321 + \ (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_pow )) Or \
32.1322 + \ (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_pow_chain )) Or \
32.1323 + \ (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_ln )) Or \
32.1324 + \ (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_ln_chain )) Or \
32.1325 + \ (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_exp )) Or \
32.1326 + \ (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_exp_chain )) Or \
32.1327 + \ (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_sqrt )) Or \
32.1328 + \ (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_sqrt_chain )) Or \
32.1329 + \ (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_const )) Or \
32.1330 + \ (Repeat (Rewrite_Inst [(''bdv'',v_v)] diff_var )) Or \
32.1331 + \ (Repeat (Rewrite_Set make_polynomial)))) #> \
32.1332 + \ (Try (Repeat (Rewrite sym_frac_conv))) #> \
32.1333 + \ (Try (Repeat (Rewrite sym_root_conv))))) f_f')"
32.1334 +;
32.1335 +val sc = (inst_abs o Thm.term_of o the o (TermC.parse thy)) str;
32.1336 +
32.1337 +
32.1338 +\<close> ML \<open>
32.1339 +"----------- diff_conv, sym_diff_conv -------------------";
32.1340 +"----------- diff_conv, sym_diff_conv -------------------";
32.1341 +"----------- diff_conv, sym_diff_conv -------------------";
32.1342 +val subs = [(TermC.str2term "bdv", TermC.str2term "x")];
32.1343 +val rls = diff_conv;
32.1344 +
32.1345 +val t = TermC.str2term "2/x \<up> 2";
32.1346 +val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; UnparseC.term t;
32.1347 +if UnparseC.term t = "2 * x \<up> - 2" then () else error "diff.sml 1/x";
32.1348 +
32.1349 +val t = TermC.str2term "sqrt (x \<up> 3)";
32.1350 +val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; UnparseC.term t;
32.1351 +if UnparseC.term t = "x \<up> (3 / 2)" then () else error "diff.sml x \<up> 1/2";
32.1352 +
32.1353 +val t = TermC.str2term "2 / sqrt x \<up> 3";
32.1354 +val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; UnparseC.term t;
32.1355 +if UnparseC.term t = "2 * x \<up> (- 3 / 2)" then () else error "diff.sml x \<up> - 1/2";
32.1356 +val rls = diff_sym_conv;
32.1357 +
32.1358 +val t = TermC.str2term "2 * x \<up> - 2";
32.1359 +val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; UnparseC.term t;
32.1360 +if UnparseC.term t = "2 / x \<up> 2" then () else error "diff.sml sym 1/x";
32.1361 +
32.1362 +val t = TermC.str2term "x \<up> (3 / 2)";
32.1363 +val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; UnparseC.term t;
32.1364 +if UnparseC.term t = "sqrt (x \<up> 3)" then ((*..wrong rewrite*)) else error"diff.sml sym x \<up> 1/x";
32.1365 +
32.1366 +val t = TermC.str2term "2 * x \<up> (-3 / 2)";
32.1367 +val SOME (t,_) = rewrite_set_inst_ thy false subs rls t; UnparseC.term t;
32.1368 +if UnparseC.term t ="2 / sqrt (x \<up> 3)"then()else error"diff.sml sym x \<up> - 1/x";
32.1369 +
32.1370 +
32.1371 +\<close> text \<open> (*loops autoCalculate (x \<up> 2 + x+ 1/x + 2/x \<up> 2)"*)
32.1372 +"----------- autoCalculate differentiate_on_R 2/x \<up> 2 -----";
32.1373 +"----------- autoCalculate differentiate_on_R 2/x \<up> 2 -----";
32.1374 +"----------- autoCalculate differentiate_on_R 2/x \<up> 2 -----";
32.1375 +reset_states ();
32.1376 +CalcTree
32.1377 +[(["functionTerm (x \<up> 2 + x+ 1/x + 2/x \<up> 2)",
32.1378 + (*"functionTerm ((x \<up> 3) \<up> 5)",*)
32.1379 + "differentiateFor x", "derivative f_f'"],
32.1380 + ("Isac_Knowledge", ["derivative_of", "function"],
32.1381 + ["diff", "differentiate_on_R"]))];
32.1382 +Iterator 1;
32.1383 +moveActiveRoot 1;
32.1384 +autoCalculate 1 CompleteCalc;
32.1385 +val ((pt,p),_) = get_calc 1; Test_Tool.show_pt pt;
32.1386 +if p = ([], Res) andalso UnparseC.term (get_obj g_res pt (fst p)) =
32.1387 + "1 + 2 * x + - 1 / x \<up> 2 + -4 / x \<up> 3" then ()
32.1388 +else error "diff.sml: differentiate_on_R 2/x \<up> 2 changed";
32.1389 +
32.1390 +\<close> text \<open> (*loops after repair of error "diff.sml sym 1/x": 2 * x \<up> - 2" --> 2 / x \<up> 2*)
32.1391 +"---------------------------------------------------------";
32.1392 +reset_states ();
32.1393 +CalcTree
32.1394 +[(["functionTerm (x \<up> 3 * x \<up> 5)",
32.1395 + "differentiateFor x", "derivative f_f'"],
32.1396 + ("Isac_Knowledge", ["derivative_of", "function"],
32.1397 + ["diff", "differentiate_on_R"]))];
32.1398 +Iterator 1;
32.1399 +moveActiveRoot 1;
32.1400 +autoCalculate 1 CompleteCalc;
32.1401 +(* Rewrite.trace_on := false; (*true false*)
32.1402 + LItool.trace_on := false;
32.1403 + *)
32.1404 +val ((pt,p),_) = get_calc 1; Test_Tool.show_pt pt;
32.1405 +
32.1406 +if p = ([], Res) andalso UnparseC.term (get_obj g_res pt (fst p)) =
32.1407 + "8 * x \<up> 7" then ()
32.1408 +else error "diff.sml: differentiate_on_R (x \<up> 3 * x \<up> 5) changed";
32.1409 +
32.1410 +\<close> text \<open> (*loops after repair of error "diff.sml sym 1/x": 2 * x \<up> - 2" --> 2 / x \<up> 2*)
32.1411 +"----------- autoCalculate diff after_simplification ----";
32.1412 +"----------- autoCalculate diff after_simplification ----";
32.1413 +"----------- autoCalculate diff after_simplification ----";
32.1414 +reset_states ();
32.1415 +CalcTree
32.1416 +[(["functionTerm (x \<up> 3 * x \<up> 5)",
32.1417 + "differentiateFor x", "derivative f_f'"],
32.1418 + ("Isac_Knowledge", ["derivative_of", "function"],
32.1419 + ["diff", "after_simplification"]))];
32.1420 +Iterator 1;
32.1421 +moveActiveRoot 1;
32.1422 +(* Rewrite.trace_on := true; (*true false*)
32.1423 + LItool.trace_on := true;
32.1424 + *)
32.1425 +autoCalculate 1 CompleteCalc;
32.1426 +(* Rewrite.trace_on := false; (*true false*)
32.1427 + LItool.trace_on := false;
32.1428 + *)
32.1429 +val ((pt,p),_) = get_calc 1; Test_Tool.show_pt pt;
32.1430 +if p = ([], Res) andalso UnparseC.term (get_obj g_res pt (fst p)) = "8 * x \<up> 7"
32.1431 +then () else error "biegelinie.sml: 1st biegelin.7.27 changed";
32.1432 +
32.1433 +\<close> text \<open> (*loops after repair of error "diff.sml sym 1/x": 2 * x \<up> - 2" --> 2 / x \<up> 2*)
32.1434 +"--------------------------------------------------------";
32.1435 +reset_states ();
32.1436 +CalcTree
32.1437 +[(["functionTerm ((x \<up> 3) \<up> 5)",
32.1438 + "differentiateFor x", "derivative f_f'"],
32.1439 + ("Isac_Knowledge", ["derivative_of", "function"],
32.1440 + ["diff", "after_simplification"]))];
32.1441 +Iterator 1;
32.1442 +moveActiveRoot 1;
32.1443 +autoCalculate 1 CompleteCalc;
32.1444 +val ((pt,p),_) = get_calc 1; Test_Tool.show_pt pt;
32.1445 +if p = ([], Res) andalso UnparseC.term (get_obj g_res pt (fst p)) = "15 * x \<up> 14"
32.1446 +then () else error "biegelinie.sml: 1st biegelin.7.27 changed";
32.1447 +
32.1448 +\<close> text \<open> (*loops autoCalculate (A = s * (a - (s::real))*)
32.1449 +"----------- autoCalculate differentiate_equality -------";
32.1450 +"----------- autoCalculate differentiate_equality -------";
32.1451 +"----------- autoCalculate differentiate_equality -------";
32.1452 +reset_states ();
32.1453 +CalcTree
32.1454 +[(["functionEq (A = s * (a - (s::real)))", "differentiateFor s", "derivativeEq f_f'"],
32.1455 + ("Isac_Knowledge", ["named", "derivative_of", "function"],
32.1456 + ["diff", "differentiate_equality"]))];
32.1457 +Iterator 1;
32.1458 +moveActiveRoot 1;
32.1459 +autoCalculate 1 CompleteCalc;
32.1460 +val ((pt,p),_) = get_calc 1; Test_Tool.show_pt pt;
32.1461 +
32.1462 +\<close> ML \<open>
32.1463 +"----------- tests for examples -------------------------";
32.1464 +"----------- tests for examples -------------------------";
32.1465 +"----------- tests for examples -------------------------";
32.1466 +"----- TermC.parse errors";
32.1467 +(*TermC.str2term "F = sqrt( y \<up> 2 - O) * (z + O \<up> 2)";
32.1468 +TermC.str2term "O";
32.1469 +TermC.str2term "OO"; ---errors*)
32.1470 +TermC.str2term "OOO";
32.1471 +
32.1472 +"----- thm 'diff_prod_const'";
32.1473 +val subs = [(TermC.str2term "bdv", TermC.str2term "l")];
32.1474 +val f = TermC.str2term "G' = d_d l (l * sqrt (7 * s \<up> 2 - l \<up> 2))";
32.1475 +
32.1476 +\<close> text \<open> (*loops after repair of error "diff.sml sym 1/x": 2 * x \<up> - 2" --> 2 / x \<up> 2*)
32.1477 +"------------inform for x \<up> 2+x+1 -------------------------";
32.1478 +"------------inform for x \<up> 2+x+1 -------------------------";
32.1479 +"------------inform for x \<up> 2+x+1 -------------------------";
32.1480 +reset_states ();
32.1481 +CalcTree
32.1482 +[(["functionTerm (x \<up> 2 + x + 1)",
32.1483 + "differentiateFor x", "derivative f_f'"],
32.1484 + ("Isac_Knowledge", ["derivative_of", "function"],
32.1485 + ["diff", "differentiate_on_R"]))];
32.1486 +Iterator 1;
32.1487 +moveActiveRoot 1;
32.1488 +autoCalculate 1 CompleteCalcHead;
32.1489 +autoCalculate 1 (Steps 1);
32.1490 +autoCalculate 1 (Steps 1);
32.1491 +autoCalculate 1 (Steps 1);
32.1492 +val ((pt,p),_) = get_calc 1; Test_Tool.show_pt pt;
32.1493 +appendFormula 1 "2*x + d_d x x + d_d x 1" (*|> Future.join*);
32.1494 +val ((pt,p),_) = get_calc 1; Test_Tool.show_pt pt;
32.1495 +if existpt' ([3], Res) pt then ()
32.1496 +else error "diff.sml: inform d_d x (x \<up> 2 + x + 1) doesnt work";
32.1497 +
32.1498 +\<close> ML \<open>
32.1499 +\<close> text \<open> (*-------^^^^^ diff.sml------------vvv integrate.sml-----------TOODOO------------*)
32.1500 +\<close>
32.1501 +
32.1502 +section \<open>======== check Knowledge/integrate.sml ============================================\<close>
32.1503 +ML \<open>
32.1504 +\<close> ML \<open>
32.1505 +(* Title: test/Tools/isac/Knowledge/integrate.sml
32.1506 + Author: Walther Neuper 050826
32.1507 + (c) due to copyright terms
32.1508 +*)
32.1509 +"--------------------------------------------------------";
32.1510 +"table of contents --------------------------------------";
32.1511 +"--------------------------------------------------------";
32.1512 +"----------- parsing ------------------------------------";
32.1513 +"----------- integrate by rewriting ---------------------";
32.1514 +"----------- test add_new_c, TermC.is_f_x ---------------------";
32.1515 +"----------- simplify by ruleset reducing make_ratpoly_in";
32.1516 +"----------- integrate by ruleset -----------------------";
32.1517 +"----------- rewrite 3rd integration in 7.27 ------------";
32.1518 +"----------- check probem type --------------------------";
32.1519 +"----------- me method [diff,integration] ---------------";
32.1520 +"----------- autoCalculate [diff,integration] -----------";
32.1521 +"----------- me method [diff,integration,named] ---------";
32.1522 +"----------- me met [diff,integration,named] Biegelinie.Q";
32.1523 +"----------- method analog to rls 'integration' ---------";
32.1524 +"--------------------------------------------------------";
32.1525 +"--------------------------------------------------------";
32.1526 +"--------------------------------------------------------";
32.1527 +
32.1528 +(*these val/fun provide for exact parsing in Integrate.thy, not Isac.thy;
32.1529 +they are used several times below; TODO remove duplicates*)
32.1530 +val thy = @{theory "Integrate"};
32.1531 +val ctxt = ThyC.to_ctxt thy;
32.1532 +
32.1533 +fun str2t str = parseNEW ctxt str |> the;
32.1534 +fun term2s t = UnparseC.term_in_ctxt ctxt t;
32.1535 +
32.1536 +val conditions_in_integration_rules =
32.1537 + Rule_Set.Repeat {id="conditions_in_integration_rules",
32.1538 + preconds = [],
32.1539 + rew_ord = ("termlessI",termlessI),
32.1540 + erls = Rule_Set.Empty,
32.1541 + srls = Rule_Set.Empty, calc = [], errpatts = [],
32.1542 + rules = [(*for rewriting conditions in Thm's*)
32.1543 + Eval ("Prog_Expr.occurs_in",
32.1544 + eval_occurs_in "#occurs_in_"),
32.1545 + Thm ("not_true",ThmC.numerals_to_Free @{thm not_true}),
32.1546 + Thm ("not_false",ThmC.numerals_to_Free @{thm not_false})],
32.1547 + scr = Empty_Prog};
32.1548 +val subs = [(str2t "bdv::real", str2t "x::real")];
32.1549 +\<close> ML \<open>
32.1550 +fun rewrit thm str =
32.1551 + fst (the (rewrite_inst_ thy tless_true
32.1552 + conditions_in_integration_rules
32.1553 + true subs thm str));
32.1554 +
32.1555 +
32.1556 +\<close> ML \<open>
32.1557 +"----------- parsing ------------------------------------";
32.1558 +"----------- parsing ------------------------------------";
32.1559 +"----------- parsing ------------------------------------";
32.1560 +val t = TermC.str2term "Integral x D x";
32.1561 +val t = TermC.str2term "Integral x \<up> 2 D x";
32.1562 +case t of
32.1563 + Const ("Integrate.Integral", _) $
32.1564 + (Const ("Transcendental.powr", _) $ Free _ $ _) $ Free ("x", _) => ()
32.1565 + | _ => error "integrate.sml: parsing: Integral x \<up> 2 D x";
32.1566 +
32.1567 +val t = TermC.str2term "ff x is_f_x";
32.1568 +case t of Const ("Integrate.is_f_x", _) $ _ => ()
32.1569 + | _ => error "integrate.sml: parsing: ff x is_f_x";
32.1570 +
32.1571 +
32.1572 +\<close> ML \<open>
32.1573 +"----------- integrate by rewriting ---------------------";
32.1574 +"----------- integrate by rewriting ---------------------";
32.1575 +"----------- integrate by rewriting ---------------------";
32.1576 +val str = rewrit @{thm "integral_const"} (TermC.str2term "Integral 1 D x");
32.1577 +if term2s str = "1 * x" then () else error "integrate.sml Integral 1 D x";
32.1578 +
32.1579 +val str = rewrit @{thm "integral_const"} (TermC.str2term "Integral M'/EJ D x");
32.1580 +if term2s str = "M' / EJ * x" then ()
32.1581 +else error "Integral M'/EJ D x BY integral_const";
32.1582 +
32.1583 +val str = rewrit @{thm "integral_var"} (TermC.str2term "Integral x D x");
32.1584 +if term2s str = "x \<up> 2 / 2" then ()
32.1585 +else error "Integral x D x BY integral_var";
32.1586 +
32.1587 +val str = rewrit @{thm "integral_add"} (TermC.str2term "Integral x + 1 D x");
32.1588 +if term2s str = "Integral x D x + Integral 1 D x" then ()
32.1589 +else error "Integral x + 1 D x BY integral_add";
32.1590 +
32.1591 +val str = rewrit @{thm "integral_mult"} (TermC.str2term "Integral M'/EJ * x \<up> 3 D x");
32.1592 +if term2s str = "M' / EJ * Integral x \<up> 3 D x" then ()
32.1593 +else error "Integral M'/EJ * x \<up> 3 D x BY integral_mult";
32.1594 +
32.1595 +val str = rewrit @{thm "integral_pow"} (TermC.str2term "Integral x \<up> 3 D x");
32.1596 +if term2s str = "x \<up> (3 + 1) / (3 + 1)" then ()
32.1597 +else error "integrate.sml Integral x \<up> 3 D x";
32.1598 +
32.1599 +
32.1600 +\<close> ML \<open>
32.1601 +"----------- test add_new_c, TermC.is_f_x ---------------------";
32.1602 +"----------- test add_new_c, TermC.is_f_x ---------------------";
32.1603 +"----------- test add_new_c, TermC.is_f_x ---------------------";
32.1604 +val term = TermC.str2term "x \<up> 2 * c + c_2";
32.1605 +val cc = new_c term;
32.1606 +if UnparseC.term cc = "c_3" then () else error "integrate.sml: new_c ???";
32.1607 +
32.1608 +val SOME (id,t') = eval_add_new_c "" "Integrate.add_new_c" term thy;
32.1609 +if UnparseC.term t' = "x \<up> 2 * c + c_2 = x \<up> 2 * c + c_2 + c_3" then ()
32.1610 +else error "intergrate.sml: diff. eval_add_new_c";
32.1611 +
32.1612 +val cc = ("Integrate.add_new_c", eval_add_new_c "add_new_c_");
32.1613 +val SOME (thmstr, thm) = adhoc_thm1_ thy cc term;
32.1614 +
32.1615 +val SOME (t',_) = rewrite_set_ thy true add_new_c term;
32.1616 +if UnparseC.term t' = "x \<up> 2 * c + c_2 + c_3" then ()
32.1617 +else error "intergrate.sml: diff. rewrite_set add_new_c 1";
32.1618 +
32.1619 +val term = TermC.str2term "ff x = x \<up> 2*c + c_2";
32.1620 +val SOME (t',_) = rewrite_set_ thy true add_new_c term;
32.1621 +if UnparseC.term t' = "ff x = x \<up> 2 * c + c_2 + c_3" then ()
32.1622 +else error "intergrate.sml: diff. rewrite_set add_new_c 2";
32.1623 +
32.1624 +
32.1625 +(*WN080222 replace call_new_c with add_new_c----------------------
32.1626 +val term = str2t "new_c (c * x \<up> 2 + c_2)";
32.1627 +val SOME (_,t') = eval_new_c 0 0 term 0;
32.1628 +if term2s t' = "new_c c * x \<up> 2 + c_2 = c_3" then ()
32.1629 +else error "integrate.sml: eval_new_c ???";
32.1630 +
32.1631 +val t = str2t "matches (?u + new_c ?v) (x \<up> 2 / 2)";
32.1632 +val SOME (_,t') = eval_matches "" "Prog_Expr.matches" t thy; term2s t';
32.1633 +if term2s t' = "matches (?u + new_c ?v) (x \<up> 2 / 2) = False" then ()
32.1634 +else error "integrate.sml: matches new_c = False";
32.1635 +
32.1636 +val t = str2t "matches (?u + new_c ?v) (x \<up> 2 / 2 + new_c x \<up> 2 / 2)";
32.1637 +val SOME (_,t') = eval_matches "" "Prog_Expr.matches" t thy; term2s t';
32.1638 +if term2s t'="matches (?u + new_c ?v) (x \<up> 2 / 2 + new_c x \<up> 2 / 2) = True"
32.1639 +then () else error "integrate.sml: matches new_c = True";
32.1640 +
32.1641 +val t = str2t "ff x TermC.is_f_x";
32.1642 +val SOME (_,t') = eval_is_f_x "" "" t thy; term2s t';
32.1643 +if term2s t' = "(ff x TermC.is_f_x) = True" then ()
32.1644 +else error "integrate.sml: eval_is_f_x --> true";
32.1645 +
32.1646 +val t = str2t "q_0/2 * L * x TermC.is_f_x";
32.1647 +val SOME (_,t') = eval_is_f_x "" "" t thy; term2s t';
32.1648 +if term2s t' = "(q_0 / 2 * L * x TermC.is_f_x) = False" then ()
32.1649 +else error "integrate.sml: eval_is_f_x --> false";
32.1650 +
32.1651 +val conditions_in_integration =
32.1652 +Rule_Set.Repeat {id="conditions_in_integration",
32.1653 + preconds = [],
32.1654 + rew_ord = ("termlessI",termlessI),
32.1655 + erls = Rule_Set.Empty,
32.1656 + srls = Rule_Set.Empty, calc = [], errpatts = [],
32.1657 + rules = [Eval ("Prog_Expr.matches",eval_matches ""),
32.1658 + Eval ("Integrate.is_f_x",
32.1659 + eval_is_f_x "is_f_x_"),
32.1660 + Thm ("not_true",ThmC.numerals_to_Free @{thm not_true}),
32.1661 + Thm ("not_false",ThmC.numerals_to_Free @{thm not_false})
32.1662 + ],
32.1663 + scr = Empty_Prog};
32.1664 +fun rewrit thm t =
32.1665 + fst (the (rewrite_inst_ thy tless_true
32.1666 + conditions_in_integration true subs thm t));
32.1667 +val t = rewrit call_for_new_c (str2t "x \<up> 2 / 2"); term2s t;
32.1668 +val t = (rewrit call_for_new_c t)
32.1669 + handle OPTION => str2t "no_rewrite";
32.1670 +
32.1671 +val t = rewrit call_for_new_c
32.1672 + (str2t "ff x = q_0/2 *L*x"); term2s t;
32.1673 +val t = (rewrit call_for_new_c
32.1674 + (str2t "ff x = q_0 / 2 * L * x + new_c q_0 / 2 * L * x"))
32.1675 + handle OPTION => (*NOT: + new_c ..=..!!*)str2t "no_rewrite";
32.1676 +--------------------------------------------------------------------*)
32.1677 +
32.1678 +
32.1679 +\<close> ML \<open>
32.1680 +"----------- simplify by ruleset reducing make_ratpoly_in";
32.1681 +"----------- simplify by ruleset reducing make_ratpoly_in";
32.1682 +"----------- simplify by ruleset reducing make_ratpoly_in";
32.1683 +val thy = @{theory "Isac_Knowledge"};
32.1684 +"===== test 1";
32.1685 +val t = TermC.str2term "1/EI * (L * q_0 * x / 2 + - 1 * q_0 * x \<up> 2 / 2)";
32.1686 +
32.1687 +"----- stepwise from the rulesets in simplify_Integral and below-----";
32.1688 +val rls = norm_Rational_noadd_fractions;
32.1689 +case rewrite_set_inst_ thy true subs rls t of
32.1690 + SOME _ => error "integrate.sml simplify by ruleset norm_Rational_.#2"
32.1691 + | NONE => ();
32.1692 +
32.1693 +"===== test 2";
32.1694 +val rls = order_add_mult_in;
32.1695 +(*//--- broken in child of.1790e1073acc : eliminate "handle _ => ..." from Rewrite.rewrite -----\\
32.1696 + assume flawed test setup hidden by "handle _ => ..."
32.1697 + ERROR ord_make_polynomial_in called with subst = []
32.1698 +val SOME (t,[]) = rewrite_set_ thy true rls t;
32.1699 +if UnparseC.term t = "1 / EI * (L * (q_0 * x) / 2 + - 1 * (q_0 * x \<up> 2) / 2)" then()
32.1700 +else error "integrate.sml simplify by ruleset order_add_mult_in #2";
32.1701 + \\--- broken in child of.1790e1073acc : eliminate "handle _ => ..." from Rewrite.rewrite -----//*)
32.1702 +
32.1703 +"===== test 3";
32.1704 +val rls = discard_parentheses;
32.1705 +(*//--- broken in child of.1790e1073acc : eliminate "handle _ => ..." from Rewrite.rewrite -----\\
32.1706 + assume flawed test setup hidden by "handle _ => ..."
32.1707 + ERROR ord_make_polynomial_in called with subst = []
32.1708 +val SOME (t,[]) = rewrite_set_ thy true rls t;
32.1709 +if UnparseC.term t = "1 / EI * (L * q_0 * x / 2 + - 1 * q_0 * x \<up> 2 / 2)" then ()
32.1710 +else error "integrate.sml simplify by ruleset discard_parenth.. #3";
32.1711 + \\--- broken in child of.1790e1073acc : eliminate "handle _ => ..." from Rewrite.rewrite -----//*)
32.1712 +
32.1713 +"===== test 4";
32.1714 +val subs = [(TermC.str2term "bdv::real", TermC.str2term "x::real")];
32.1715 +val rls =
32.1716 + (Rule_Set.append_rules "separate_bdv" collect_bdv
32.1717 + [Thm ("separate_bdv", ThmC.numerals_to_Free @{thm separate_bdv}),
32.1718 + (*"?a * ?bdv / ?b = ?a / ?b * ?bdv"*)
32.1719 + Thm ("separate_bdv_n", ThmC.numerals_to_Free @{thm separate_bdv_n}),
32.1720 + (*"?a * ?bdv \<up> ?n / ?b = ?a / ?b * ?bdv \<up> ?n"*)
32.1721 + Thm ("separate_1_bdv", ThmC.numerals_to_Free @{thm separate_1_bdv}),
32.1722 + (*"?bdv / ?b = (1 / ?b) * ?bdv"*)
32.1723 + Thm ("separate_1_bdv_n", ThmC.numerals_to_Free @{thm separate_1_bdv_n})
32.1724 + (*"?bdv \<up> ?n / ?b = 1 / ?b * ?bdv \<up> ?n"*)
32.1725 + ]);
32.1726 +(*show_types := true; --- do we need type-constraint in thms? *)
32.1727 +@{thm separate_bdv}; (*::?'a does NOT rewrite here WITHOUT type constraint*)
32.1728 +@{thm separate_bdv_n}; (*::real ..because of \<up> , rewrites*)
32.1729 +@{thm separate_1_bdv}; (*::?'a*)
32.1730 +val xxx = ThmC.numerals_to_Free @{thm separate_1_bdv}; (*::?'a*)
32.1731 +@{thm separate_1_bdv_n}; (*::real ..because of \<up> *)
32.1732 +(*show_types := false; --- do we need type-constraint in thms? YES ?!?!?!*)
32.1733 +
32.1734 +val SOME (t, []) = rewrite_set_inst_ thy true subs rls t;
32.1735 +if UnparseC.term t = "1 / EI * (L * q_0 / 2 * x + - 1 * q_0 / 2 * x \<up> 2)" then ()
32.1736 +else error "integrate.sml simplify by ruleset separate_bdv.. #4";
32.1737 +
32.1738 +"===== test 5";
32.1739 +val t = TermC.str2term "1/EI * (L * q_0 * x / 2 + - 1 * q_0 * x \<up> 2 / 2)";
32.1740 +val rls = simplify_Integral;
32.1741 +val SOME (t,[]) = rewrite_set_inst_ thy true subs rls t;
32.1742 +(* given was: "1 / EI * (L * q_0 * x / 2 + - 1 * q_0 * x \<up> 2 / 2)" *)
32.1743 +if UnparseC.term t = "1 / EI * (L * q_0 / 2 * x + - 1 * q_0 / 2 * x \<up> 2)" then ()
32.1744 +else error "integrate.sml, simplify_Integral #99";
32.1745 +
32.1746 +\<close> ML \<open>
32.1747 +"........... 2nd integral ........................................";
32.1748 +"........... 2nd integral ........................................";
32.1749 +"........... 2nd integral ........................................";
32.1750 +val thy = @{theory Biegelinie};
32.1751 +val t = TermC.str2term
32.1752 + "Integral 1 / EI * (L * q_0 / 2 * (x \<up> 2 / 2) + - 1 * q_0 / 2 * (x \<up> 3 / 3)) D x";
32.1753 +
32.1754 +val rls = simplify_Integral;
32.1755 +(*TOODOO simplify_Integral broken (required for Biegelinie) ---------------------------------\\
32.1756 + "Integral 1 / EI * (L * q_0 / 2 * (x \<up> 2 / 2) + - 1 * q_0 / 2 * (x \<up> 3 / 3)) D x";
32.1757 +\<down> "Integral 1 / EI * ((L * q_0 / 4) * x \<up> 2 + (- 1 * q_0 / 6) * x \<up> 3) D x" broken
32.1758 +(**)
32.1759 +val SOME (t,[]) = rewrite_set_inst_ thy true subs rls t;
32.1760 +if UnparseC.term t =
32.1761 + "Integral 1 / EI * (L * q_0 / 4 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3) D x"
32.1762 +then () else raise error "integrate.sml, simplify_Integral #198";
32.1763 +
32.1764 +val rls = integration_rules;
32.1765 +val SOME (t,[]) = rewrite_set_ thy true rls t;
32.1766 +UnparseC.term t;
32.1767 +if UnparseC.term t =
32.1768 + "1 / EI * (L * q_0 / 4 * (x \<up> 3 / 3) + - 1 * q_0 / 6 * (x \<up> 4 / 4))"
32.1769 +then () else error "integrate.sml, simplify_Integral #199";
32.1770 +-------------------------------------------------------------------------------------------//*)
32.1771 +
32.1772 +
32.1773 +\<close> ML \<open>
32.1774 +"----------- integrate by ruleset -----------------------";
32.1775 +"----------- integrate by ruleset -----------------------";
32.1776 +"----------- integrate by ruleset -----------------------";
32.1777 +val thy = @{theory "Integrate"};
32.1778 +val rls = integration_rules;
32.1779 +val subs = [(@{term "bdv::real"}, @{term "x::real"})];
32.1780 +(*~~~~~~~~~~~~~~~~~~~~~~~~~~~*)
32.1781 +
32.1782 +\<close> ML \<open>
32.1783 +val t = (Thm.term_of o the o (TermC.parse thy)) "Integral x D x";
32.1784 +val SOME (res, _) = rewrite_set_inst_ thy true subs rls t;
32.1785 +if UnparseC.term res = "x \<up> 2 / 2" then () else error "Integral x D x changed";
32.1786 +
32.1787 +val t = (Thm.term_of o the o (TermC.parse thy)) "Integral c * x \<up> 2 + c_2 D x";
32.1788 +val SOME (res, _) = rewrite_set_inst_ thy true subs rls t;
32.1789 +if UnparseC.term res = "c * (x \<up> 3 / 3) + c_2 * x" then () else error "Integral c * x \<up> 2 + c_2 D x";
32.1790 +
32.1791 +\<close> ML \<open>
32.1792 +val rls = add_new_c;
32.1793 +val t = (Thm.term_of o the o (TermC.parse thy)) "c * (x \<up> 3 / 3) + c_2 * x";
32.1794 +val SOME (res, _) = rewrite_set_inst_ thy true subs rls t;
32.1795 +if UnparseC.term res = "c * (x \<up> 3 / 3) + c_2 * x + c_3" then ()
32.1796 +else error "integrate.sml: diff.behav. in add_new_c simpl.";
32.1797 +
32.1798 +\<close> ML \<open>
32.1799 +val t = (Thm.term_of o the o (TermC.parse thy)) "F x = x \<up> 3 / 3 + x";
32.1800 +val SOME (res, _) = rewrite_set_inst_ thy true subs rls t;
32.1801 +if UnparseC.term res = "F x = x \<up> 3 / 3 + x + c"(*not "F x + c =..."*) then ()
32.1802 +else error "integrate.sml: diff.behav. in add_new_c equation";
32.1803 +
32.1804 +\<close> ML \<open>
32.1805 +val rls = simplify_Integral;
32.1806 +(*~~~~~~~~~~~~~~~~~~~~~~~~~~~*)
32.1807 +val t = (Thm.term_of o the o (TermC.parse thy)) "ff x = c * x + - 1 * q_0 * (x \<up> 2 / 2) + c_2";
32.1808 +val SOME (res, _) = rewrite_set_inst_ thy true subs rls t;
32.1809 +if UnparseC.term res = "ff x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2"
32.1810 +then () else error "integrate.sml: diff.behav. in simplify_I #1";
32.1811 +
32.1812 +\<close> ML \<open>
32.1813 +val rls = integration;
32.1814 +(*~~~~~~~~~~~~~~~~~~~~~~~~~~~*)
32.1815 +val t = (Thm.term_of o the o (TermC.parse thy)) "Integral c * x \<up> 2 + c_2 D x";
32.1816 +val SOME (res, _) = rewrite_set_inst_ thy true subs rls t;
32.1817 +if UnparseC.term res = "c_3 + c_2 * x + c / 3 * x \<up> 3"
32.1818 +then () else error "integrate.sml: diff.behav. in integration #1";
32.1819 +
32.1820 +\<close> ML \<open>
32.1821 +val t = (Thm.term_of o the o (TermC.parse thy)) "Integral 3*x \<up> 2 + 2*x + 1 D x";
32.1822 +val SOME (res, _) = rewrite_set_inst_ thy true subs rls t;
32.1823 +if UnparseC.term res = "c + x + x \<up> 2 + x \<up> 3" then ()
32.1824 +else error "integrate.sml: diff.behav. in integration #2";
32.1825 +
32.1826 +\<close> text \<open> (*TOODOO rls "integration" does NOT work anymore *)
32.1827 +val t = (Thm.term_of o the o (TermC.parse thy))
32.1828 + "Integral 1 / EI * (L * q_0 / 2 * x + - 1 * q_0 / 2 * x \<up> 2) D x";
32.1829 +val SOME (res, _) = rewrite_set_inst_ thy true subs rls t;
32.1830 +"Integral 1 / EI * (L * q_0 / 2 * x + - 1 * q_0 / 2 * x \<up> 2) D x";
32.1831 +if UnparseC.term res = "c + 1 / EI * (L * q_0 / 4 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3)"
32.1832 +then () else error "integrate.sml: diff.behav. in integration #3";
32.1833 +
32.1834 +\<close> text \<open> (*TOODOO rls "integration" does NOT work anymore *)
32.1835 +val t = (Thm.term_of o the o (TermC.parse thy)) ("Integral " ^ UnparseC.term res ^ " D x");
32.1836 +val SOME (res, _) = rewrite_set_inst_ thy true subs rls t;
32.1837 +if UnparseC.term res = "c_2 + c * x +\n1 / EI * (L * q_0 / 12 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)"
32.1838 +then () else error "integrate.sml: diff.behav. in integration #4";
32.1839 +
32.1840 +\<close> ML \<open>
32.1841 +"----------- rewrite 3rd integration in 7.27 ------------";
32.1842 +"----------- rewrite 3rd integration in 7.27 ------------";
32.1843 +"----------- rewrite 3rd integration in 7.27 ------------";
32.1844 +val thy = @{theory "Isac_Knowledge"} (*because of Undeclared constant "Biegelinie.EI*);
32.1845 +val t = TermC.str2term "Integral 1 / EI * ((L * q_0 * x + - 1 * q_0 * x \<up> 2) / 2) D x";
32.1846 +val SOME(t, _)= rewrite_set_inst_ thy true subs simplify_Integral t;
32.1847 +\<close> ML \<open>
32.1848 +UnparseC.term t =
32.1849 + "Integral 1 / EI * (L * q_0 * x / 2 + - 1 * q_0 * x \<up> 2 / 2) D x";
32.1850 +(*TOODOO simplify_Integral NOW weaker *)
32.1851 +\<close> text \<open> (* TOODOO rls simplify_Integral <------------------------------ START HERE *)
32.1852 +if UnparseC.term t =
32.1853 + "Integral 1 / EI * (L * q_0 / 2 * x + - 1 * q_0 / 2 * x \<up> 2) D x"
32.1854 +then () else error "integrate.sml 3rd integration in 7.27, simplify_Integral";
32.1855 +
32.1856 +\<close> ML \<open>
32.1857 +val SOME(t,_)= rewrite_set_inst_ thy true subs integration t;
32.1858 +\<close> ML \<open>
32.1859 +UnparseC.term t =
32.1860 + "c + Integral 1 / EI * (L * q_0 * x / 2 + - 1 * q_0 * x \<up> 2 / 2) D x";
32.1861 +\<close> text \<open> (*TOODOO thus rls "integration" does NOT work anymore *)
32.1862 +if UnparseC.term t =
32.1863 + "c + 1 / EI * (L * q_0 / 4 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3)"
32.1864 +then () else error "integrate.sml 3rd integration in 7.27, integration";
32.1865 +
32.1866 +
32.1867 +\<close> ML \<open>
32.1868 +"----------- check probem type --------------------------";
32.1869 +"----------- check probem type --------------------------";
32.1870 +"----------- check probem type --------------------------";
32.1871 +val thy = @{theory Integrate};
32.1872 +val model = {Given =["functionTerm f_f", "integrateBy v_v"],
32.1873 + Where =[],
32.1874 + Find =["antiDerivative F_F"],
32.1875 + With =[],
32.1876 + Relate=[]}:string ppc;
32.1877 +val chkmodel = ((map (the o (TermC.parse thy))) o P_Model.to_list) model;
32.1878 +val t1 = (Thm.term_of o hd) chkmodel;
32.1879 +val t2 = (Thm.term_of o hd o tl) chkmodel;
32.1880 +val t3 = (Thm.term_of o hd o tl o tl) chkmodel;
32.1881 +case t3 of Const ("Integrate.antiDerivative", _) $ _ => ()
32.1882 + | _ => error "integrate.sml: Integrate.antiDerivative ???";
32.1883 +
32.1884 +\<close> ML \<open>
32.1885 +val model = {Given =["functionTerm f_f", "integrateBy v_v"],
32.1886 + Where =[],
32.1887 + Find =["antiDerivativeName F_F"],
32.1888 + With =[],
32.1889 + Relate=[]}:string ppc;
32.1890 +val chkmodel = ((map (the o (TermC.parse thy))) o P_Model.to_list) model;
32.1891 +val t1 = (Thm.term_of o hd) chkmodel;
32.1892 +val t2 = (Thm.term_of o hd o tl) chkmodel;
32.1893 +val t3 = (Thm.term_of o hd o tl o tl) chkmodel;
32.1894 +case t3 of Const ("Integrate.antiDerivativeName", _) $ _ => ()
32.1895 + | _ => error "integrate.sml: Integrate.antiDerivativeName";
32.1896 +
32.1897 +\<close> ML \<open>
32.1898 +"----- compare 'Find's from problem, script, formalization -------";
32.1899 +val {ppc,...} = Problem.from_store ["named", "integrate", "function"];
32.1900 +val ("#Find", (Const ("Integrate.antiDerivativeName", _),
32.1901 + F1_ as Free ("F_F", F1_type))) = last_elem ppc;
32.1902 +val {scr = Prog sc,... } = MethodC.from_store ["diff", "integration", "named"];
32.1903 +val [_,_, F2_] = formal_args sc;
32.1904 +if F1_ = F2_ then () else error "integrate.sml: unequal find's";
32.1905 +
32.1906 +val ((dsc as Const ("Integrate.antiDerivativeName", _))
32.1907 + $ Free ("ff", F3_type)) = TermC.str2term "antiDerivativeName ff";
32.1908 +if Input_Descript.is_a dsc then () else error "integrate.sml: no description";
32.1909 +if F1_type = F3_type then ()
32.1910 +else error "integrate.sml: unequal types in find's";
32.1911 +
32.1912 +Test_Tool.show_ptyps();
32.1913 +val pbl = Problem.from_store ["integrate", "function"];
32.1914 +case #cas pbl of SOME (Const ("Integrate.Integrate",_) $ _) => ()
32.1915 + | _ => error "integrate.sml: Integrate.Integrate ???";
32.1916 +
32.1917 +
32.1918 +\<close> ML \<open>
32.1919 +"----------- me method [diff,integration] ---------------";
32.1920 +"----------- me method [diff,integration] ---------------";
32.1921 +"----------- me method [diff,integration] ---------------";
32.1922 +(*exp_CalcInt_No- 1.xml*)
32.1923 +val p = e_pos'; val c = [];
32.1924 +"----- step 0: returns nxt = Model_Problem ---";
32.1925 val (p,_,f,nxt,_,pt) =
32.1926 CalcTreeTEST
32.1927 [(["functionTerm (x \<up> 2 + 1)", "integrateBy x", "antiDerivative FF"],
32.1928 ("Integrate", ["integrate", "function"], ["diff", "integration"]))];
32.1929 +"----- step 1: returns nxt = Add_Given \"functionTerm (x \<up> 2 + 1)\" ---";
32.1930 val (p,_,f,nxt,_,pt) = me nxt p c pt; (*nxt = ("Tac ", ...) --> Add_Given...*)
32.1931 +"----- step 2: returns nxt = Add_Given \"integrateBy x\" ---";
32.1932 val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1933 +"----- step 3: returns nxt = Add_Find \"Integrate.antiDerivative FF\" ---";
32.1934 val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1935 +"----- step 4: returns nxt = Specify_Theory \"Integrate\" ---";
32.1936 val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1937 +"----- step 5: returns nxt = Specify_Problem [\"integrate\", \"function\"] ---";
32.1938 val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1939 +"----- step 6: returns nxt = Specify_Method [\"diff\", \"integration\"] ---";
32.1940 val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1941 +"----- step 7: returns nxt = Apply_Method [\"diff\", \"integration\"] ---";
32.1942 val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.1943 case nxt of (Apply_Method ["diff", "integration"]) => ()
32.1944 | _ => error "integrate.sml -- me method [diff,integration] -- spec";
32.1945 "----- step 8: returns nxt = Rewrite_Set_Inst ([\"(''bdv'', x)\"],\"integration\")";
32.1946 -
32.1947 -"~~~~~ fun me, args:"; val (tac, (p:pos'), _, (pt:ctree)) = (nxt, p, c, pt);
32.1948 -"~~~~~ fun Step.by_tactic, args:"; val (tac, (ptp as (pt, p))) = (tac, (pt,p));
32.1949 -val Applicable.Yes m = Step.check tac (pt, p);
32.1950 - (*if*) Tactic.for_specify' m; (*false*)
32.1951 -"~~~~~ fun loc_solve_ , args:"; val (m, (pt,pos)) = (m, ptp);
32.1952 -
32.1953 -"~~~~~ fun Step_Solve.by_tactic , args:"; val (m as Apply_Method' (mI, _, _, ctxt), (pt, (pos as (p,_))))
32.1954 - = (m, (pt, pos));
32.1955 - val {srls, ...} = MethodC.from_store mI;
32.1956 - val itms = case get_obj I pt p of
32.1957 - PblObj {meth=itms, ...} => itms
32.1958 - | _ => error "solve Apply_Method: uncovered case get_obj"
32.1959 - val thy' = get_obj g_domID pt p;
32.1960 - val thy = ThyC.get_theory thy';
32.1961 - val srls = LItool.get_simplifier (pt, pos)
32.1962 - val (is, env, ctxt, sc) = case LItool.init_pstate srls ctxt itms mI of
32.1963 - (is as Istate.Pstate {env, ...}, ctxt, sc) => (is, env, ctxt, sc)
32.1964 - | _ => error "solve Apply_Method: uncovered case init_pstate";
32.1965 -(*+*)pstate2str (the_pstate is) = "([\"\n(f_f, x \<up> 2 + 1)\",\"\n(v_v, x)\"], [], empty, NONE, \n??.empty, ORundef, false, true)";
32.1966 - val ini = LItool.implicit_take sc env;
32.1967 - val p = lev_dn p;
32.1968 -
32.1969 - val NONE = (*case*) ini (*of*);
32.1970 - val Next_Step (is', ctxt', m') =
32.1971 - LI.find_next_step sc (pt, (p, Res)) is ctxt;
32.1972 -(*+*)pstate2str (the_pstate is') = "([\"\n(f_f, x \<up> 2 + 1)\",\"\n(v_v, x)\"], [R,L,R], empty, NONE, \nIntegral x \<up> 2 + 1 D x, ORundef, false, false)";
32.1973 - val Safe_Step (_, _, Take' _) = (*case*)
32.1974 - locate_input_tactic sc (pt, (p, Res)) is' ctxt' m' (*of*);
32.1975 -"~~~~~ fun locate_input_tactic , args:"; val ((Prog prog), cstate, istate, ctxt, tac)
32.1976 - = (sc, (pt, (p, Res)), is', ctxt', m');
32.1977 -
32.1978 - (*case*) scan_to_tactic1 (prog, (cstate, ctxt, tac)) istate (*of*);
32.1979 -"~~~~~ fun scan_to_tactic1 , args:"; val ((prog, (cctt as ((_, p), _, _))), (Istate.Pstate (ist as {path, ...})))
32.1980 - = ((prog, (cstate, ctxt, tac)), istate);
32.1981 - (*if*) path = [] orelse ((last_elem o fst) p = 0 andalso snd p = Res) (*then*);
32.1982 -
32.1983 - val Accept_Tac1 (_, _, Take' _) =
32.1984 - scan_dn1 cctt (ist |> set_path [R] |> set_or ORundef) (Program.body_of prog);
32.1985 -"~~~~~ fun scan_dn1 , args:"; val (xxx, ist, (Const ("HOL.Let", _) $ e $ (Abs (id, T, b))))
32.1986 - = (cctt, (ist |> set_path [R] |> set_or ORundef), (Program.body_of prog));
32.1987 -
32.1988 -(*+*) if UnparseC.term e = "Take (Integral f_f D v_v)" then () else error "scan_dn1 Integral changed";
32.1989 -
32.1990 - (*case*)
32.1991 - scan_dn1 xxx (ist |> path_down [L, R]) e (*of*);
32.1992 - (*======= end of scanning tacticals, a leaf =======*)
32.1993 -"~~~~~ fun scan_dn1 , args:"; val (((pt, p), ctxt, tac), (ist as {eval, or, ...}), t)
32.1994 - = (xxx, (ist |> path_down [L, R]), e);
32.1995 -val (Program.Tac stac, a') = check_leaf "locate" ctxt eval (get_subst ist) t;
32.1996 -
32.1997 -
32.1998 -
32.1999 -"----------- re-build: fun locate_input_tactic -------------------------------------------------";
32.2000 -"----------- re-build: fun locate_input_tactic -------------------------------------------------";
32.2001 -"----------- re-build: fun locate_input_tactic -------------------------------------------------";
32.2002 -val fmz = ["equality (x+1=(2::real))", "solveFor x", "solutions L"];
32.2003 -val (dI',pI',mI') = ("Test", ["sqroot-test", "univariate", "equation", "test"],
32.2004 - ["Test", "squ-equ-test-subpbl1"]);
32.2005 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.2006 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.2007 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.2008 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.2009 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.2010 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.2011 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.2012 -(*[], Met*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = (_, Apply_Method ["Test", "squ-equ-test-subpbl1"])*);
32.2013 -(*[1], Frm*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = ("Rewrite_Set", Rewrite_Set "norm_equation")*)
32.2014 -
32.2015 -(*//------------------ begin step into ------------------------------------------------------\\*)
32.2016 -(*[1], Res*)val (p'''''_''',_,f,nxt'''''_''',_,pt'''''_''') = me nxt p [] pt; (*nxt = Rewrite_Set "Test_simplify"*)
32.2017 -
32.2018 -"~~~~~ fun me , args:"; val (tac, p, _(*NEW remove*), pt) = (nxt, p, [], pt);
32.2019 -
32.2020 - (** )val (***)xxxx(***) ( *("ok", (_, _, (pt, p))) =( **) (*case*)
32.2021 - Step.by_tactic tac (pt,p) (*of*);
32.2022 -"~~~~~ fun by_tactic , args:"; val (tac, (ptp as (pt, p))) = (tac, (pt,p));
32.2023 - val Applicable.Yes m = (*case*) Solve_Step.check tac (pt, p) (*of*);
32.2024 - (*if*) Tactic.for_specify' m; (*false*)
32.2025 -
32.2026 - (** )val (***)xxxxx_x(***) ( *(msg, cs') =( **)
32.2027 -Step_Solve.by_tactic m ptp;
32.2028 -"~~~~~ fun by_tactic , args:"; val (m, (pt, po as (p, p_))) = (m, ptp);
32.2029 -(*+*)val (pt'''''_', (p'''''_', p_'''''_')) = (pt, (p, p_));
32.2030 - (*if*) MethodC.id_empty = get_obj g_metID pt (par_pblobj pt p); (*else*)
32.2031 - val thy' = get_obj g_domID pt (par_pblobj pt p);
32.2032 - val (is, sc) = LItool.resume_prog thy' (p,p_) pt;
32.2033 -
32.2034 - locate_input_tactic sc (pt, po) (fst is) (snd is) m;
32.2035 -"~~~~~ fun locate_input_tactic , args:"; val (Prog prog, cstate, istate, ctxt, tac)
32.2036 - = (sc, (pt, po), (fst is), (snd is), m);
32.2037 - val srls = get_simplifier cstate;
32.2038 -
32.2039 - (** )val Accept_Tac1 ((is as (_,_,_,_,_,strong_ass), ctxt, ss as((tac', _, ctree, pos', _) :: _))) =( **)
32.2040 - (*case*) scan_to_tactic1 (prog, (cstate, ctxt, tac)) istate (*of*);
32.2041 -"~~~~~ fun scan_to_tactic1 , args:"; val ((prog, (cctt as ((_, p), _, _))), (Istate.Pstate (ist as {path, ...})))
32.2042 - = ((prog, (cstate, ctxt, tac)), istate);
32.2043 - (*if*) path = [] orelse ((last_elem o fst) p = 0 andalso snd p = Res) (*then*);
32.2044 -
32.2045 - (** )val xxxxx_xx = ( **)
32.2046 - scan_dn1 cctt (ist |> set_path [R] |> set_or ORundef) (Program.body_of prog);
32.2047 -"~~~~~ fun scan_dn1 , args:"; val (xxx, ist, (Const ("HOL.Let", _) $ e $ (Abs (id, T, b))))
32.2048 - = (cctt, (ist |> set_path [R] |> set_or ORundef), (Program.body_of prog));
32.2049 -
32.2050 - (*case*) scan_dn1 xxx (ist |> path_down [L, R]) e (*of*);
32.2051 -"~~~~~ fun scan_dn1 , args:"; val ((xxx as (cstate, _, _)), ist, (Const ("Tactical.Chain"(*1*), _) $ e1 $ e2 $ a))
32.2052 - = (xxx, (ist |> path_down [L, R]), e);
32.2053 -
32.2054 - (*case*) scan_dn1 xxx (ist |> path_down_form ([L, L, R], a)) e1 (*of*);
32.2055 -"~~~~~ fun scan_dn1 , args:"; val (xxx, ist, (Const ("Tactical.Try"(*2*), _) $ e))
32.2056 - = (xxx, (ist |> path_down_form ([L, L, R], a)), e1);
32.2057 -
32.2058 - (*case*) scan_dn1 xxx (ist |> path_down [R]) e (*of*);
32.2059 - (*======= end of scanning tacticals, a leaf =======*)
32.2060 -"~~~~~ fun scan_dn1 , args:"; val (((pt, p), ctxt, tac), (ist as {env, eval, or, ...}), t)
32.2061 - = (xxx, (ist |> path_down [R]), e);
32.2062 - val (Program.Tac stac, a') =
32.2063 - (*case*) check_leaf "locate" ctxt eval (get_subst ist) t (*of*);
32.2064 - val LItool.Associated (m, v', ctxt) =
32.2065 - (*case*) associate pt ctxt (m, stac) (*of*);
32.2066 -
32.2067 - Accept_Tac1 (ist |> set_subst_true (a', v'), ctxt, m) (*return value*);
32.2068 -"~~~~~ from scan_dn1 to scan_to_tactic1 return val:"; val (xxxxx_xx)
32.2069 - = (Accept_Tac1 (ist |> set_subst_true (a', v'), ctxt, m));
32.2070 -
32.2071 -"~~~~~ from scan_to_tactic1 to fun locate_input_tactic return val:"; val Accept_Tac1 ((ist as {assoc, ...}), ctxt, tac')
32.2072 - = (Accept_Tac1 (ist |> set_subst_true (a', v'), ctxt, m));
32.2073 - (*if*) LibraryC.assoc (*then*);
32.2074 -
32.2075 - Safe_Step (Istate.Pstate ist, ctxt, tac') (*return value*);
32.2076 -"~~~~~ from locate_input_tactic to fun Step_Solve.by_tactic return:"; val Safe_Step (istate, ctxt, tac)
32.2077 - = (*xxxxx_xx*)(**)Safe_Step (Istate.Pstate ist, ctxt, tac')(**);
32.2078 -
32.2079 -(*+*)val (pt, po as (p, p_)) = (pt'''''_', (p'''''_', p_'''''_')); (* from begin of by_tactic *)
32.2080 - val (p'', _, _,pt') =
32.2081 - Step.add tac (istate, ctxt) (pt, (lev_on p, Pbl));
32.2082 - (*in*)
32.2083 -
32.2084 - ("ok", ([(Tactic.input_from_T tac, tac, (p'', (istate, ctxt)))],
32.2085 - [(*ctree NOT cut*)], (pt', p''))) (*return value*);
32.2086 -"~~~~~ from Step_Solve.by_tactic \<longrightarrow> Step.by_tactic return:"; val ((msg, cs' : Calc.state_post))
32.2087 - = ("ok", ([(Tactic.input_from_T tac, tac, (p'', (istate, ctxt)) )],
32.2088 - [(*ctree NOT cut*)], (pt', p'')));
32.2089 -
32.2090 -"~~~~~ from Step.by_tactic to me return:"; val (("ok", (_, _, (pt, p)))) = (*** )xxxx( ***) ("ok", cs');
32.2091 - val (_, ts) =
32.2092 - (case Step.do_next p ((pt, Pos.e_pos'), []) of
32.2093 - ("ok", (ts as (_, _, _) :: _, _, _)) => ("", ts)
32.2094 - | ("helpless", _) => ("helpless: cannot propose tac", [])
32.2095 - | ("no-fmz-spec", _) => error "no-fmz-spec"
32.2096 - | ("end-of-calculation", (ts, _, _)) => ("", ts)
32.2097 - | _ => error "me: uncovered case")
32.2098 - handle ERROR msg => raise ERROR msg
32.2099 - val tac =
32.2100 - case ts of
32.2101 - tacis as (_::_) => let val (tac, _, _) = last_elem tacis in tac end
32.2102 - | _ => if p = ([], Pos.Res) then Tactic.End_Proof' else Tactic.Empty_Tac;
32.2103 -
32.2104 - (p, [] : NEW, TESTg_form (pt, p), (Tactic.tac2IDstr tac, tac), Celem.Sundef, pt);
32.2105 -"~~~~~ from me to TOOPLEVEL return:"; val (p,_,f,nxt,_,pt)
32.2106 - = (*** )xxx( ***) (p, [] : NEW, TESTg_form (pt, p), (Tactic.tac2IDstr tac, tac), Celem.Sundef, pt);
32.2107 -
32.2108 -(*//--------------------- check results from modified me ----------------------------------\\*)
32.2109 -if p = ([2], Res) andalso
32.2110 - pr_ctree pr_short pt = ". ----- pblobj -----\n1. x + 1 = 2\n2. x + 1 = 2\n"
32.2111 -then
32.2112 - (case nxt of ("Rewrite_Set", Rewrite_Set "Test_simplify") => ()
32.2113 - | _ => error "")
32.2114 -else error "check results from modified me CHANGED";
32.2115 -(*\\--------------------- check results from modified me ----------------------------------//*)
32.2116 -
32.2117 -"~~~~~ from me to TOPLEVEL return:"; val (p,_,f,nxt,_,pt) = (*** )xxx( ***) (**)(p, 000, f, nxt, 000, pt)(**);
32.2118 -(*\\------------------ end step into --------------------------------------------------------//*)
32.2119 -
32.2120 -(*[3], Res*)val (p,_,f,nxt,_,pt) = me nxt'''''_''' p'''''_''' [] pt'''''_'''; (*nxt = Subproblem ("Test", ["LINEAR", "univariate", "equation", "test"])*)
32.2121 -(*[3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Model_Problem*)
32.2122 -(*[3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Add_Given "equality (- 1 + x = 0)"*)
32.2123 -(*[3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Add_Given "solveFor x"*)
32.2124 -(*[3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Add_Find "solutions x_i"*)
32.2125 -(*[3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Specify_Theory "Test"*)
32.2126 -(*[3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Specify_Problem ["LINEAR", "univariate", "equation", "test"]*)
32.2127 -(*[3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Specify_Method ["Test", "solve_linear"]*)
32.2128 -(*[3], Met*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Apply_Method ["Test", "solve_linear"]*)
32.2129 -(*[3, 1], Frm*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Rewrite_Set_Inst (["(''bdv'', x)"], "isolate_bdv")*)
32.2130 -(*[3, 1], Res*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Rewrite_Set "Test_simplify"*)
32.2131 -(*[3, 2], Res*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Check_Postcond ["LINEAR", "univariate", "equation", "test"]*)
32.2132 -(*[3], Res*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Check_elementwise "Assumptions"*)
32.2133 -(*[4], Res*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Check_Postcond ["sqroot-test", "univariate", "equation", "test"]*)
32.2134 -(*[], Res*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = End_Proof'*)
32.2135 -
32.2136 -(*/--------------------- final test ----------------------------------\\*)
32.2137 -if p = ([], Res) andalso f2str f = "[x = 1]" andalso pr_ctree pr_short pt =
32.2138 - ". ----- pblobj -----\n" ^
32.2139 - "1. x + 1 = 2\n" ^
32.2140 - "2. x + 1 + - 1 * 2 = 0\n" ^
32.2141 - "3. ----- pblobj -----\n" ^
32.2142 - "3.1. - 1 + x = 0\n" ^
32.2143 - "3.2. x = 0 + - 1 * - 1\n" ^
32.2144 - "4. [x = 1]\n"
32.2145 -then case nxt of End_Proof' => () | _ => error "re-build: fun locate_input_tactic changed 1"
32.2146 -else error "re-build: fun locate_input_tactic changed 2";
32.2147 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
32.2148 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
32.2149 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
32.2150 +if f2str f = "c + x + 1 / 3 * x \<up> 3" then ()
32.2151 +else error "integrate.sml -- me method [diff,integration] -- end";
32.2152
32.2153
32.2154 \<close> ML \<open>
32.2155 -"----------- fun locate_input_tactic Helpless, NOT applicable ----------------------------------";
32.2156 -"----------- fun locate_input_tactic Helpless, NOT applicable ----------------------------------";
32.2157 -"----------- fun locate_input_tactic Helpless, NOT applicable ----------------------------------";
32.2158 -(*cp from -- try fun applyTactics ------- *)
32.2159 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(["Term (5*e + 6*f - 8*g - 9 - 7*e - 4*f + 10*g + 12)",
32.2160 - "normalform N"],
32.2161 - ("PolyMinus",["plus_minus", "polynom", "vereinfachen"],
32.2162 - ["simplification", "for_polynomials", "with_minus"]))];
32.2163 -val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.2164 -val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.2165 -val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.2166 -\<close> ML \<open>
32.2167 -f
32.2168 -\<close> ML \<open>
32.2169 -(*[1], Frm*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Rewrite_Set "ordne_alphabetisch"*)
32.2170 -\<close> ML \<open>
32.2171 -(*+*)val Test_Out.FormKF "5 * e + 6 * f - 8 * g - 9 - 7 * e - 4 * f + 10 * g + 12" = f
32.2172 -\<close> ML \<open>
32.2173 -(*[1], Res*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Rewrite_Set "fasse_zusammen"*)
32.2174 +"----------- autoCalculate [diff,integration] -----------";
32.2175 +"----------- autoCalculate [diff,integration] -----------";
32.2176 +"----------- autoCalculate [diff,integration] -----------";
32.2177 +reset_states ();
32.2178 +CalcTree
32.2179 + [(["functionTerm (x \<up> 2 + 1)", "integrateBy x", "antiDerivative FF"],
32.2180 + ("Integrate", ["integrate", "function"], ["diff", "integration"]))];
32.2181 +Iterator 1;
32.2182 +moveActiveRoot 1;
32.2183 +autoCalculate 1 CompleteCalc;
32.2184 +val ((pt,p),_) = get_calc 1; @{make_string} p; Test_Tool.show_pt pt;
32.2185 +val (Form t,_,_) = ME_Misc.pt_extract (pt, p);
32.2186 +if UnparseC.term t = "c + x + 1 / 3 * x \<up> 3" then ()
32.2187 +else error "integrate.sml -- interSteps [diff,integration] -- result";
32.2188 +
32.2189
32.2190 \<close> ML \<open>
32.2191 -(*+*)val Test_Out.FormKF "- 9 + 12 + 5 * e - 7 * e + 6 * f - 4 * f - 8 * g + 10 * g" = f
32.2192 -\<close> ML \<open>
32.2193 -\<close> ML \<open> (*GOON*)
32.2194 -map Tactic.input_to_string (specific_from_prog pt p)
32.2195 -\<close> ML \<open>
32.2196 -(*+*)if map Tactic.input_to_string (specific_from_prog pt p) =
32.2197 - ["Rewrite (\"subtrahiere_x_plus_minus\", \"\<lbrakk>?l is_const; ?m is_const\<rbrakk>\n\<Longrightarrow> ?x + ?m * ?v - ?l * ?v = ?x + (?m - ?l) * ?v\")",
32.2198 - "Rewrite (\"subtrahiere_x_minus_plus\", \"\<lbrakk>?l is_const; ?m is_const\<rbrakk>\n\<Longrightarrow> ?x - ?m * ?v + ?l * ?v = ?x + (- ?m + ?l) * ?v\")"]
32.2199 - then () else error "specific_from_prog ([1], Res) CHANGED";
32.2200 -(*[2], Res*)val ("ok", (_, _, ptp as (pt, p))) = Step.by_tactic (hd (specific_from_prog pt p)) (pt, p);
32.2201 +"----------- me method [diff,integration,named] ---------";
32.2202 +"----------- me method [diff,integration,named] ---------";
32.2203 +"----------- me method [diff,integration,named] ---------";
32.2204 +(*exp_CalcInt_No- 2.xml*)
32.2205 +val fmz = ["functionTerm (x \<up> 2 + (1::real))",
32.2206 + "integrateBy x", "antiDerivativeName F"];
32.2207 +val (dI',pI',mI') =
32.2208 + ("Integrate",["named", "integrate", "function"],
32.2209 + ["diff", "integration", "named"]);
32.2210 +val p = e_pos'; val c = [];
32.2211 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.2212 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.2213 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.2214 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*nxt <- Add_Find *);
32.2215 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.2216 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.2217 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.2218 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*nxt <- Apply_Method*);
32.2219 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.2220 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.2221 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
32.2222 +if f2str f = "F x = c + x + 1 / 3 * x \<up> 3" then()
32.2223 +else error "integrate.sml: method [diff,integration,named]";
32.2224 +
32.2225
32.2226 \<close> ML \<open>
32.2227 -(*+*)if map Tactic.input_to_string (specific_from_prog pt p) =
32.2228 - ["Rewrite (\"tausche_minus\", \"\<lbrakk>?b ist_monom; ?a kleiner ?b\<rbrakk>\n\<Longrightarrow> ?b - ?a = - ?a + ?b\")", "Rewrite (\"tausche_plus_minus\", \"?b kleiner ?c \<Longrightarrow> ?a + ?c - ?b = ?a - ?b + ?c\")",
32.2229 - "Rewrite (\"subtrahiere_x_plus_minus\", \"\<lbrakk>?l is_const; ?m is_const\<rbrakk>\n\<Longrightarrow> ?x + ?m * ?v - ?l * ?v = ?x + (?m - ?l) * ?v\")",
32.2230 - "Rewrite (\"subtrahiere_x_minus_plus\", \"\<lbrakk>?l is_const; ?m is_const\<rbrakk>\n\<Longrightarrow> ?x - ?m * ?v + ?l * ?v = ?x + (- ?m + ?l) * ?v\")", "Calculate MINUS"]
32.2231 - then () else error "specific_from_prog ([1], Res) CHANGED";
32.2232 -(* = ([3], Res)*)val ("ok", (_, _, ptp as (pt, p))) = Step.by_tactic (hd (specific_from_prog pt p)) (pt, p);
32.2233 +"----------- me met [diff,integration,named] Biegelinie.Q";
32.2234 +"----------- me met [diff,integration,named] Biegelinie.Q";
32.2235 +"----------- me met [diff,integration,named] Biegelinie.Q";
32.2236 +(*exp_CalcInt_No-3.xml*)
32.2237 +val fmz = ["functionTerm (- q_0)",
32.2238 + "integrateBy x", "antiDerivativeName Q"];
32.2239 +val (dI',pI',mI') =
32.2240 + ("Biegelinie",["named", "integrate", "function"],
32.2241 + ["diff", "integration", "named"]);
32.2242 +val p = e_pos'; val c = [];
32.2243 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.2244 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.2245 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.2246 +(*Error Tac Q not in ...*)
32.2247 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*nxt <- Add_Find *);
32.2248 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.2249 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.2250 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.2251 +val (p,_,f,nxt,_,pt) = me nxt p c pt(*nxt <- Apply_Method*);
32.2252 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.2253 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.2254 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
32.2255 +if f2str f = "Q x = c + - q_0 * x" then()
32.2256 +else error "integrate.sml: method [diff,integration,named] .Q";
32.2257 +
32.2258
32.2259 \<close> ML \<open>
32.2260 -(*//----------------- exception PTREE "get_obj f EmptyPtree" raised --------------------------\\*)
32.2261 -(** )val ("ok", (_, _, ptp as (pt, p))) =( **)
32.2262 - Step.by_tactic (hd (specific_from_prog pt p)) (pt, p);
32.2263 -"~~~~~ fun by_tactic , args:"; val (tac, (ptp as (pt, p))) = (hd (specific_from_prog pt p), (pt, p));
32.2264 - val Applicable.Yes m = (*case*) Solve_Step.check tac (pt, p) (*of*);
32.2265 - (*if*) Tactic.for_specify' m; (*false*)
32.2266 +\<close> text \<open> (*-------^^^^^ integrate.sml------------vvv eqsystem.sml--------TOODOO-----------*)
32.2267 +\<close>
32.2268
32.2269 -Step_Solve.by_tactic m (pt, p);
32.2270 -"~~~~~ fun by_tactic , args:"; val (m, (pt, po as (p, p_))) = (m, (pt, p));
32.2271 - (*if*) MethodC.id_empty = get_obj g_metID pt (par_pblobj pt p) (*else*);
32.2272 - val thy' = get_obj g_domID pt (par_pblobj pt p);
32.2273 - val (is, sc) = LItool.resume_prog thy' (p,p_) pt;
32.2274 +section \<open>======== check Knowledge/eqsystem.sml =============================================\<close>
32.2275 +ML \<open>
32.2276 +\<close> ML \<open>
32.2277 +(* Title: Knowledge/eqsystem.sml
32.2278 + Author: Walther Neuper 050826
32.2279 + (c) due to copyright terms
32.2280 +*)
32.2281
32.2282 - (*case*) locate_input_tactic sc (pt, po) (fst is) (snd is) m (*of*);
32.2283 -"~~~~~ fun locate_input_tactic , args:"; val ((Rule.Prog prog), (cstate as (pt, (*?*)pos(*?*))), istate, ctxt, tac)
32.2284 - = (sc, (pt, po), (fst is), (snd is), m);
32.2285 - val srls = LItool.get_simplifier cstate (*TODO: shift into Istate.T*);
32.2286 +"-----------------------------------------------------------------";
32.2287 +"table of contents -----------------------------------------------";
32.2288 +"-----------------------------------------------------------------";
32.2289 +"----------- occur_exactly_in ------------------------------------";
32.2290 +"----------- problems --------------------------------------------";
32.2291 +"----------- rewrite-order ord_simplify_System -------------------";
32.2292 +"----------- rewrite in [EqSystem,normalise,2x2] -----------------";
32.2293 +"----------- rewrite example from 2nd [EqSystem,normalise,2x2] ---";
32.2294 +"----------- rewrite in [EqSystem,top_down_substitution,2x2] -----";
32.2295 +"----------- rewrite in [EqSystem,normalise,4x4] -----------------";
32.2296 +"----------- script [EqSystem,top_down_substitution,2x2] Vers.1 --";
32.2297 +"----------- refine [linear,system]-------------------------------";
32.2298 +"----------- refine [2x2,linear,system] search error--------------";
32.2299 +"----------- me [EqSystem,normalise,2x2] -------------------------";
32.2300 +"----------- me [linear,system] ..normalise..top_down_sub..-------";
32.2301 +"----------- all systems from Biegelinie -------------------------";
32.2302 +"----------- 4x4 systems from Biegelinie -------------------------";
32.2303 +"-----------------------------------------------------------------";
32.2304 +"-----------------------------------------------------------------";
32.2305 +"-----------------------------------------------------------------";
32.2306
32.2307 - (*case*) scan_to_tactic1 (prog, (cstate, ctxt, tac)) istate (*of*);
32.2308 -"~~~~~ fun scan_to_tactic1 , args:"; val ((prog, (cctt as ((_, p), _, _))), (Istate.Pstate (ist as {path, ...})))
32.2309 - = ((prog, (cstate, ctxt, tac)), istate);
32.2310 - (*if*) path = [] orelse ((last_elem o fst) p = 0 andalso snd p = Res) (*else*);
32.2311 +val thy = @{theory "EqSystem"};
32.2312 +val ctxt = Proof_Context.init_global thy;
32.2313
32.2314 - go_scan_up1 (prog, cctt) ist;
32.2315 -"~~~~~ fun go_scan_up1 , args:"; val ((pcct as (prog, _)), (ist as {path, ...}))
32.2316 - = ((prog, cctt), ist);
32.2317 - (*if*) 1 < length path (*then*);
32.2318 +"----------- occur_exactly_in ------------------------------------";
32.2319 +"----------- occur_exactly_in ------------------------------------";
32.2320 +"----------- occur_exactly_in ------------------------------------";
32.2321 +val all = [TermC.str2term"c", TermC.str2term"c_2", TermC.str2term"c_3"];
32.2322 +val t = TermC.str2term"0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2";
32.2323
32.2324 - scan_up1 pcct (ist |> path_up) (TermC.sub_at (path_up' path) prog);
32.2325 -"~~~~~ and scan_up1 , args:"; val (pcct, ist, (Const ("Tactical.Try"(*2*), _) $ _))
32.2326 - = (pcct, (ist |> path_up), (TermC.sub_at (path_up' path) prog));
32.2327 +if occur_exactly_in [TermC.str2term"c", TermC.str2term"c_2"] all t
32.2328 +then () else error "eqsystem.sml occur_exactly_in 1";
32.2329
32.2330 - go_scan_up1 pcct ist;
32.2331 -"~~~~~ and go_scan_up1 , args:"; val ((pcct as (prog, _)), (ist as {path, ...}))
32.2332 - = (pcct, ist);
32.2333 - (*if*) 1 < length path (*then*);
32.2334 +if not (occur_exactly_in [TermC.str2term"c", TermC.str2term"c_2", TermC.str2term"c_3"] all t)
32.2335 +then () else error "eqsystem.sml occur_exactly_in 2";
32.2336
32.2337 - scan_up1 pcct (ist |> path_up) (TermC.sub_at (path_up' path) prog);
32.2338 -"~~~~~ and scan_up1 , args:"; val ((pcct as (prog, cct as (cstate, _, _))), ist,
32.2339 - (Const ("Tactical.Chain"(*3*), _) $ _ ))
32.2340 - = (pcct, (ist |> path_up), (TermC.sub_at (path_up' path) prog));
32.2341 - val e2 = check_Seq_up ist prog
32.2342 -;
32.2343 - (*case*) scan_dn1 cct (ist |> path_up_down [R] |> set_or ORundef) e2 (*of*);
32.2344 -"~~~~~ fun scan_dn1 , args:"; val (yyy, ist, (Const ("Tactical.Chain"(*2*), _) $ e1 $ e2))
32.2345 - = (cct, (ist |> path_up_down [R] |> set_or ORundef), e2);
32.2346 +if not (occur_exactly_in [TermC.str2term"c_2"] all t)
32.2347 +then () else error "eqsystem.sml occur_exactly_in 3";
32.2348
32.2349 - (*case*) scan_dn1 cct (ist |> path_down [L, R]) e1 (*of*);
32.2350 -"~~~~~ fun scan_dn1 , args:"; val (xxx, ist, (Const ("Tactical.Try"(*2*), _) $ e))
32.2351 - = (cct, (ist |> path_down [L, R]), e1);
32.2352 +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";
32.2353 +eval_occur_exactly_in 0 "EqSystem.occur_exactly_in" t 0;
32.2354 +val SOME (str, t') = eval_occur_exactly_in 0 "EqSystem.occur_exactly_in" t 0;
32.2355 +if str = "[c, c_2] from [c, c_2,\n" ^
32.2356 + " c_3] occur_exactly_in - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2 = True"
32.2357 +then () else error "eval_occur_exactly_in [c, c_2]";
32.2358
32.2359 - (*case*) scan_dn1 cct (ist |> path_down [R]) e (*of*);
32.2360 - (*======= end of scanning tacticals, a leaf =======*)
32.2361 -"~~~~~ fun scan_dn1 , args:"; val ((cct as (_, ctxt, _)), (ist as {eval, ...}), t)
32.2362 - = (cct, (ist |> path_down [R]), e);
32.2363 - (*if*) Tactical.contained_in t (*else*);
32.2364 - val (Program.Tac prog_tac, form_arg) = (*case*)
32.2365 - LItool.check_leaf "locate" ctxt eval (get_subst ist) t (*of*);
32.2366 +val t = TermC.str2term ("[c,c_2,c_3] from [c,c_2,c_3] occur_exactly_in " ^
32.2367 + "- 1 * q_0 * L \<up> 2 / 2 + L * c + c_2");
32.2368 +val SOME (str, t') = eval_occur_exactly_in 0 "EqSystem.occur_exactly_in" t 0;
32.2369 +if str = "[c, c_2,\n c_3] from [c, c_2,\n" ^
32.2370 +" c_3] occur_exactly_in - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2 = False"
32.2371 +then () else error "eval_occur_exactly_in [c, c_2, c_3]";
32.2372
32.2373 - check_tac1 cct ist (prog_tac, form_arg);
32.2374 -"~~~~~ fun check_tac1 , args:"; val (((pt, p), ctxt, tac), (ist as {act_arg, or, ...}), (prog_tac, form_arg)) =
32.2375 - (cct, ist, (prog_tac, form_arg));
32.2376 -val LItool.Not_Associated = (*case*)
32.2377 - LItool.associate pt ctxt (tac, prog_tac) (*of*);
32.2378 - val _(*ORundef*) = (*case*) or (*of*);
32.2379 - val Applicable.Yes m' =
32.2380 - (*case*) Solve_Step.check (LItool.tac_from_prog pt (ThyC.get_theory "Isac_Knowledge") prog_tac) (pt, p) (*of*);
32.2381 +val t = TermC.str2term"[c_2] from [c,c_2,c_3] occur_exactly_in \
32.2382 + \- 1 * q_0 * L \<up> 2 / 2 + L * c + c_2";
32.2383 +val SOME (str, t') = eval_occur_exactly_in 0 "EqSystem.occur_exactly_in" t 0;
32.2384 +if str = "[c_2] from [c, c_2,\n" ^
32.2385 + " c_3] occur_exactly_in - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2 = False"
32.2386 +then () else error "eval_occur_exactly_in [c, c_2, c_3]";
32.2387
32.2388 - Reject_Tac1 (ist |> set_subst_false (form_arg, Tactic.result m'), ctxt, tac)
32.2389 - (*return from check_tac1*);
32.2390 -"~~~~~ from fun check_tac1 \<longrightarrow>fun scan_dn1 \<longrightarrow>fun scan_dn1 \<longrightarrow>fun locate_input_tactic , return:"; val (Reject_Tac1 _) =
32.2391 - (Reject_Tac1 (ist |> set_subst_false (form_arg, Tactic.result m'), ctxt, tac));
32.2392 +val t = TermC.str2term"[] from [c,c_2,c_3] occur_exactly_in 0";
32.2393 +val SOME (str, t') = eval_occur_exactly_in 0 "EqSystem.occur_exactly_in" t 0;
32.2394 +if str = "[] from [c, c_2, c_3] occur_exactly_in 0 = True" then ()
32.2395 +else error "eval_occur_exactly_in [c, c_2, c_3]";
32.2396
32.2397 -(*/----- original before child of 7e314dd233fd -------------------------------------------------\* )
32.2398 - val (Program.Tac prog_tac, form_arg) = (*case*) check_leaf "locate" ctxt eval (get_subst ist) t (*of*);
32.2399 - val Not_Associated = (*case*) associate pt ctxt (tac, stac) (*of*);
32.2400 - val ORundef = (*case*) or (*of*);
32.2401 - val Applicable.No "norm_equation not applicable" =
32.2402 - (*case*) Solve_Step.check (LItool.tac_from_prog pt (ThyC.get_theory "Isac_Knowledge") stac) (pt, p) (*of*);
32.2403 +val t =
32.2404 + TermC.str2term
32.2405 + "[] from [c, c_2, c_3, c_4] occur_exactly_in - 1 * (q_0 * L \<up> 2) /2";
32.2406 +val SOME (str, t') = eval_occur_exactly_in 0 "EqSystem.occur_exactly_in" t 0;
32.2407 +if str = "[] from [c, c_2, c_3, c_4] occur_exactly_in \
32.2408 + \- 1 * (q_0 * L \<up> 2) / 2 = True" then ()
32.2409 +else error "eval_occur_exactly_in [c, c_2, c_3, c_4]";
32.2410
32.2411 - (Term_Val1 act_arg) (* return value *);
32.2412 +"----------- problems --------------------------------------------";
32.2413 +"----------- problems --------------------------------------------";
32.2414 +"----------- problems --------------------------------------------";
32.2415 +val t = TermC.str2term "Length [x+y=1,y=2] = 2";
32.2416 +TermC.atomty t;
32.2417 +val testrls = Rule_Set.append_rules "testrls" Rule_Set.empty
32.2418 + [(Thm ("LENGTH_NIL",ThmC.numerals_to_Free @{thm LENGTH_NIL})),
32.2419 + (Thm ("LENGTH_CONS",ThmC.numerals_to_Free @{thm LENGTH_CONS})),
32.2420 + Eval ("Groups.plus_class.plus", eval_binop "#add_"),
32.2421 + Eval ("HOL.eq",eval_equal "#equal_")
32.2422 + ];
32.2423 +val SOME (t',_) = rewrite_set_ thy false testrls t;
32.2424 +if UnparseC.term t' = "True" then ()
32.2425 +else error "eqsystem.sml: length_ [x+y=1,y=2] = 2";
32.2426
32.2427 -val Rewrite' ("PolyMinus", "tless_true", _, _, ("tausche_minus",_ (*"?b ist_monom \<Longrightarrow> ?a kleiner ?b \<Longrightarrow> ?b - ?a = - ?a + ?b"*)),
32.2428 - t, (res, asm)) = m;
32.2429 +val SOME t = TermC.parse thy "solution LL";
32.2430 +TermC.atomty (Thm.term_of t);
32.2431 +val SOME t = TermC.parse thy "solution LL";
32.2432 +TermC.atomty (Thm.term_of t);
32.2433
32.2434 -if pstate2str ist =
32.2435 - "([\"\n(t_t, 5 * e + 6 * f - 8 * g - 9 - 7 * e - 4 * f + 10 * g + 12)\"], [R,L,R,R,L,R,R], empty, SOME t_t, \n" ^
32.2436 - "- (8 * g) + (- 9 + 12 + 5 * e - 7 * e + (6 - 4) * f) + 10 * g, ORundef, true, false)"
32.2437 -andalso
32.2438 - UnparseC.term t = "- (8 * g) + (- 9 + 12 + 5 * e - 7 * e + (6 - 4) * f) + 10 * g"
32.2439 -andalso
32.2440 - UnparseC.term res = "- (8 * g) + (- 9 + 12 + 5 * e - 7 * e + (- 4 + 6) * f) + 10 * g"
32.2441 -andalso
32.2442 - UnparseC.terms asm = "[\"4 kleiner 6\",\"6 ist_monom\"]"
32.2443 -then () else error "locate_input_tactic Helpless, but applicable CHANGED";
32.2444 -( *\----- original before child of 7e314dd233fd -------------------------------------------------/*)
32.2445 +val t = TermC.str2term
32.2446 +"(tl (tl (tl v_s))) from v_s occur_exactly_in (NTH 1 (e_s::bool list))";
32.2447 +TermC.atomty t;
32.2448 +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 " ^
32.2449 + "(NTH 1 [c_4 = 1, 2 = 2, 3 = 3, 4 = 4])");
32.2450 +(*----- broken in child of.1790e1073acc : eliminate "handle _ => ..." from Rewrite.rewrite -----\\
32.2451 + assume flawed test setup hidden by "handle _ => ..."
32.2452 + ERROR rewrite__set_ called with 'Erls' for '1 < 1'
32.2453 +val SOME (t,_) =
32.2454 + rewrite_set_ thy true
32.2455 + (Rule_Set.append_rules "prls_" Rule_Set.empty
32.2456 + [Thm ("NTH_CONS",ThmC.numerals_to_Free @{thm NTH_CONS}),
32.2457 + Thm ("NTH_NIL",ThmC.numerals_to_Free @{thm NTH_NIL}),
32.2458 + Thm ("TL_CONS",ThmC.numerals_to_Free @{thm tl_Cons}),
32.2459 + Thm ("TL_NIL",ThmC.numerals_to_Free @{thm tl_Nil}),
32.2460 + Eval ("EqSystem.occur_exactly_in", eval_occur_exactly_in "#eval_occur_exactly_in_")
32.2461 + ]) t;
32.2462 +if t = @{term True} then ()
32.2463 +else error "eqsystem.sml ..occur_exactly_in (nth_ 1 [c_4..";
32.2464 + broken in child of.1790e1073acc : eliminate "handle _ => ..." from Rewrite.rewrite ---//*)
32.2465 +
32.2466 +
32.2467 +"----------- rewrite-order ord_simplify_System -------------------";
32.2468 +"----------- rewrite-order ord_simplify_System -------------------";
32.2469 +"----------- rewrite-order ord_simplify_System -------------------";
32.2470 +"M_b x = c * x + - 1 * q_0 * (x \<up> 2 / 2) + c_2";
32.2471 +"--- add.commute ---"; (* ... add.commute cf. b42e334c97ee *)
32.2472 +if ord_simplify_System false thy [] (TermC.str2term"- 1 * q_0 * (x \<up> 2 / 2)",
32.2473 + TermC.str2term"c * x") then ()
32.2474 +else error "integrate.sml, (- 1 * q_0 * (x \<up> 2 / 2)) < (c * x) not#1";
32.2475 +
32.2476 +if ord_simplify_System false thy [] (TermC.str2term"- 1 * q_0 * (x \<up> 2 / 2)",
32.2477 + TermC.str2term"c_2") then ()
32.2478 +else error "integrate.sml, (- 1 * q_0 * (x \<up> 2 / 2)) < (c_2) not#2";
32.2479 +
32.2480 +if ord_simplify_System false thy [] (TermC.str2term"c * x",
32.2481 + TermC.str2term"c_2") then ()
32.2482 +else error "integrate.sml, (c * x) < (c_2) not#3";
32.2483 +
32.2484 +"--- mult.commute ---";
32.2485 +if ord_simplify_System false thy [] (TermC.str2term"x * c",
32.2486 + TermC.str2term"c * x") then ()
32.2487 +else error "integrate.sml, (x * c) < (c * x) not#4";
32.2488 +
32.2489 +if ord_simplify_System false thy [] (TermC.str2term"- 1 * q_0 * (x \<up> 2 / 2) * c",
32.2490 + TermC.str2term"- 1 * q_0 * c * (x \<up> 2 / 2)")
32.2491 +then () else error "integrate.sml, (. * .) < (. * .) not#5";
32.2492 +
32.2493 +if ord_simplify_System false thy [] (TermC.str2term"- 1 * q_0 * (x \<up> 2 / 2) * c",
32.2494 + TermC.str2term"c * - 1 * q_0 * (x \<up> 2 / 2)")
32.2495 +then () else error "integrate.sml, (. * .) < (. * .) not#6";
32.2496
32.2497
32.2498 \<close> ML \<open>
32.2499 -"----------- re-build: fun find_next_step, mini ------------------------------------------------";
32.2500 -"----------- re-build: fun find_next_step, mini ------------------------------------------------";
32.2501 -"----------- re-build: fun find_next_step, mini ------------------------------------------------";
32.2502 -val fmz = ["Term (a + a ::real)", "normalform n_n"];
32.2503 -val (dI',pI',mI') = ("Poly",["polynomial", "simplification"],["simplification", "for_polynomials"]);
32.2504 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.2505 -(*[], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, Pos.e_pos'), []);(*Model_Problem*)
32.2506 -(*[], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, Pos.e_pos'), []);(*Specify_Theory "Poly"*)
32.2507 -(*[], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, Pos.e_pos'), []);(*Specify_Problem ["polynomial", "simplification"]*)
32.2508 -(*[], Met*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*Specify_Method ["simplification", "for_polynomials"]*)
32.2509 -(*1], Frm*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*Apply_Method ["simplification", "for_polynomials"]*)
32.2510 -(*[1], Res*)val (_, ([(tac'''''_', _, _)], _, (pt'''''_', p'''''_'))) =
32.2511 +"----------- rewrite in [EqSystem,normalise,2x2] -----------------";
32.2512 +"----------- rewrite in [EqSystem,normalise,2x2] -----------------";
32.2513 +"----------- rewrite in [EqSystem,normalise,2x2] -----------------";
32.2514 +val t = TermC.str2term"[0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2,\
32.2515 + \0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2]";
32.2516 +val bdvs = [(TermC.str2term"bdv_1",TermC.str2term"c"),
32.2517 + (TermC.str2term"bdv_2",TermC.str2term"c_2")];
32.2518 +val SOME(t,_)= rewrite_set_inst_ thy true bdvs simplify_System_parenthesized t;
32.2519 +\<close> ML \<open>
32.2520 +UnparseC.term t = "[0 = - 1 * q_0 * L \<up> 2 / 2 + (L * c + c_2), 0 = - 0 + c_2]"
32.2521 +\<close> text \<open>(* TOODOO: simplify_System_parenthesized \<longrightarrow> - 0 + c_4 ^^^^^^^^^^*)
32.2522 +(* inhertited errors -----------------------------------------------------------------------\\* )
32.2523 +if UnparseC.term t = "[0 = - 1 * q_0 * L \<up> 2 / 2 + (L * c + c_2), 0 = c_2]"
32.2524 +then () else error "eqsystem.sml rewrite in 2x2 simplify_System_par.1";
32.2525
32.2526 - Step.do_next p ((pt, e_pos'), []);(*Rewrite_Set "norm_Poly"*)
32.2527 -\<close> ML \<open>
32.2528 -(*//------------------ go into 1 ------------------------------------------------------------\\*)
32.2529 -"~~~~~ fun do_next , args:"; val ((ip as (_, p_)), (ptp as (pt, p), tacis))
32.2530 - = (p, ((pt, e_pos'), []));
32.2531 - val pIopt = Ctree.get_pblID (pt, ip);
32.2532 - (*if*) ip = ([], Res) (*else*);
32.2533 - val _ = (*case*) tacis (*of*);
32.2534 - val SOME _ = (*case*) pIopt (*of*);
32.2535 - (*if*) member op = [Pos.Pbl, Pos.Met] p_ (*else*);
32.2536 +val SOME (t,_) = rewrite_set_inst_ thy true bdvs isolate_bdvs t;
32.2537 +if UnparseC.term t = "[L * c + c_2 = 0 + - 1 * (- 1 * q_0 * L \<up> 2 / 2), c_2 = 0]"
32.2538 +then () else error "eqsystem.sml rewrite in 2x2 isolate_bdvs";
32.2539
32.2540 -val ("ok", ([(Rewrite_Set "norm_Poly", _, _)], _, (_, ([1], Res)))) =
32.2541 -Step_Solve.do_next (pt, ip);
32.2542 -"~~~~~ and do_next , args:"; val (ptp as (pt, pos as (p, p_))) = (pt, ip);
32.2543 - (*if*) MethodC.id_empty = get_obj g_metID pt (par_pblobj pt p) (*else*);
32.2544 - val thy' = get_obj g_domID pt (par_pblobj pt p);
32.2545 - val ((ist, ctxt), sc) = LItool.resume_prog thy' (p,p_) pt;
32.2546 +val SOME(t,_)= rewrite_set_inst_ thy true bdvs simplify_System t;
32.2547 +if UnparseC.term t = "[L * c + c_2 = q_0 * L \<up> 2 / 2, c_2 = 0]"
32.2548 +then () else error "eqsystem.sml rewrite in 2x2 simplify_System_par.2";
32.2549
32.2550 -val Next_Step (_, _, Rewrite_Set' ("Poly", _, Rule_Set.Sequence {id = "norm_Poly", ...}, _, _)) =
32.2551 - LI.find_next_step sc (pt, pos) ist ctxt (*of*);
32.2552 -"~~~~~ fun find_next_step , args:"; val ((Rule.Prog prog), (ptp as(pt, (p, _))), (Pstate ist), ctxt)
32.2553 - = (sc, (pt, pos), ist, ctxt);
32.2554 -
32.2555 -val Accept_Tac (Rewrite_Set' ("Poly", _, Rule_Set.Sequence {id = "norm_Poly", ...}, _, _), _, _) =
32.2556 - (*case*) scan_to_tactic (prog, (ptp, ctxt)) (Pstate ist) (*of*);
32.2557 -"~~~~~ fun scan_to_tactic , args:"; val ((prog, cc), (Pstate (ist as {path, ...})))
32.2558 - = ((prog, (ptp, ctxt)), (Pstate ist));
32.2559 - (*if*) path = [] (*then*);
32.2560 -
32.2561 -val Accept_Tac (Rewrite_Set' ("Poly", _, Rule_Set.Sequence {id = "norm_Poly", ...}, _, _), _, _) =
32.2562 - scan_dn cc (trans_scan_dn ist) (Program.body_of prog);
32.2563 -"~~~~~ fun scan_dn , args:"; val ((cc as (_, ctxt)), (ist as {eval, ...}), t)
32.2564 - = (cc, (trans_scan_dn ist), (Program.body_of prog));
32.2565 - (*if*) Tactical.contained_in t (*else*);
32.2566 - val (Program.Tac prog_tac, form_arg) = (*case*) LItool.check_leaf "next " ctxt eval (get_subst ist) t (*of*);
32.2567 -
32.2568 -val Accept_Tac (Rewrite_Set' ("Poly", _, Rule_Set.Sequence {id = "norm_Poly", ...}, _, _), _, _) =
32.2569 - check_tac cc ist (prog_tac, form_arg) (*return from xxx*);
32.2570 -"~~~~~ from fun scan_dn\<longrightarrow>fun scan_to_tactic\<longrightarrow>fun find_next_step, return:"; val (Accept_Tac (tac, ist, ctxt))
32.2571 - = (check_tac cc ist (prog_tac, form_arg));
32.2572 -
32.2573 - Next_Step (Pstate ist, Tactic.insert_assumptions tac ctxt, tac) (*return from find_next_step*);
32.2574 -"~~~~~ from fun find_next_step\<longrightarrow>and do_next\<longrightarrow>fun zzz, return:"; val (Next_Step (ist, ctxt, tac))
32.2575 - = (Next_Step (Pstate ist, Tactic.insert_assumptions tac ctxt, tac));
32.2576 -
32.2577 - LI.by_tactic tac (ist, Tactic.insert_assumptions tac ctxt) ptp (*return from and do_next*);
32.2578 -"~~~~~ from and do_next\<longrightarrow>fun do_next\<longrightarrow>toplevel, return:"; val (_, ([(tac''''', _, _)], _, (pt''''', p''''')))
32.2579 - = (LI.by_tactic tac (ist, Tactic.insert_assumptions tac ctxt) ptp);
32.2580 -(*\\------------------ end of go into 1 -----------------------------------------------------//*)
32.2581 -
32.2582 -(*[], Res*)val (_, ([(tac''''', _, _)], _, (pt''''', p'''''))) =
32.2583 -
32.2584 - Step.do_next p'''''_' ((pt'''''_', Pos.e_pos'), []);(* Check_Postcond ["polynomial", "simplification"]*)
32.2585 -(*//------------------ go into 2 ------------------------------------------------------------\\*)
32.2586 -"~~~~~ fun do_next , args:"; val ((ip as (_, p_)), (ptp as (pt, p), tacis))
32.2587 - = (p''''', ((pt''''', e_pos'), []));
32.2588 - val pIopt = Ctree.get_pblID (pt, ip);
32.2589 - (*if*) ip = ([], Res) (*else*);
32.2590 - val _ = (*case*) tacis (*of*);
32.2591 - val SOME _ = (*case*) pIopt (*of*);
32.2592 - (*if*) member op = [Pos.Pbl, Pos.Met] p_ (*else*);
32.2593 -
32.2594 -val ("ok", ([(Check_Postcond ["polynomial", "simplification"], _, _)], _, (_, ([], Res)))) =
32.2595 -Step_Solve.do_next (pt, ip);
32.2596 -"~~~~~ and do_next , args:"; val (ptp as (pt, pos as (p, p_))) = (pt, ip);
32.2597 - (*if*) MethodC.id_empty = get_obj g_metID pt (par_pblobj pt p) (*else*);
32.2598 - val thy' = get_obj g_domID pt (par_pblobj pt p);
32.2599 - val ((ist, ctxt), sc) = LItool.resume_prog thy' (p,p_) pt;
32.2600 -
32.2601 - (** )val End_Program (ist, tac) =
32.2602 - ( *case*) LI.find_next_step sc (pt, pos) ist ctxt (*of*);
32.2603 -"~~~~~ fun find_next_step , args:"; val ((Rule.Prog prog), (ptp as(pt, (p, _))), (Pstate ist), ctxt)
32.2604 - = (sc, (pt, pos), ist, ctxt);
32.2605 -
32.2606 -(* val Term_Val (Const ("Groups.times_class.times", _) $ Free ("2", _) $ Free ("a", _))*)
32.2607 - (** )val Term_Val prog_result =
32.2608 - ( *case*) scan_to_tactic (prog, (ptp, ctxt)) (Pstate ist) (*of*);
32.2609 -"~~~~~ fun scan_to_tactic , args:"; val ((prog, cc), (Pstate (ist as {path, ...})))
32.2610 - = ((prog, (ptp, ctxt)), (Pstate ist));
32.2611 - (*if*) path = [] (*else*);
32.2612 -
32.2613 - go_scan_up (prog, cc) (trans_scan_up ist |> set_found);
32.2614 -"~~~~~ fun go_scan_up , args:"; val ((pcc as (sc, _)), (ist as {path, act_arg, found_accept, ...}))
32.2615 - = ((prog, cc), (trans_scan_up ist(*|> set_found !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! *)));
32.2616 - (*if*) path = [R] (*then*);
32.2617 - (*if*) found_accept = true (*then*);
32.2618 -
32.2619 - Term_Val act_arg (*return from go_scan_up*);
32.2620 -"~~~~~ from fun go_scan_up\<longrightarrow>fun scan_to_tactic, return:"; val (Term_Val prog_result) = (Term_Val act_arg);
32.2621 -
32.2622 - Term_Val prog_result (*return from scan_to_tactic*);
32.2623 -"~~~~~ from fun scan_to_tactic\<longrightarrow>fun find_next_step, return:"; val (Term_Val prog_result) = (Term_Val prog_result);
32.2624 - val (true, p', _) = (*case*) parent_node pt p (*of*);
32.2625 - val (_, pblID, _) = get_obj g_spec pt p';
32.2626 -
32.2627 - End_Program (Pstate ist, Tactic.Check_Postcond' (pblID, prog_result))
32.2628 - (*return from find_next_step*);
32.2629 -"~~~~~ from fun find_next_step\<longrightarrow>and do_next\<longrightarrow>fun zzz, return:"; val (End_Program (ist, tac))
32.2630 - = (End_Program (Pstate ist, Tactic.Check_Postcond' (pblID,prog_result)));
32.2631 - val _ = (*case*) tac (*of*);
32.2632 -
32.2633 -val ("ok", ([(Check_Postcond ["polynomial", "simplification"], _, _)], _, (_, ([], Res))))
32.2634 - = LI.by_tactic tac (ist, ctxt) ptp (*return from and do_next*);
32.2635 -"~~~~~ from and do_next\<longrightarrow>top level, return:"; val (_, ([(tac''''', _, _)], _, (pt''''', p''''')))
32.2636 - = (LI.by_tactic tac (ist, ctxt) ptp);
32.2637 -(*\\------------------ end of go into 2 -----------------------------------------------------//*)
32.2638 -
32.2639 -(*[], Und*)val (msg, ([], _, (pt, p))) = Step.do_next p''''' ((pt''''', Pos.e_pos'), []);(**)
32.2640 -
32.2641 -Test_Tool.show_pt_tac pt; (*[
32.2642 -([], Frm), Simplify (a + a)
32.2643 -. . . . . . . . . . Apply_Method ["simplification", "for_polynomials"],
32.2644 -([1], Frm), a + a
32.2645 -. . . . . . . . . . Rewrite_Set "norm_Poly",
32.2646 -([1], Res), 2 * a
32.2647 -. . . . . . . . . . Check_Postcond ["polynomial", "simplification"],
32.2648 -([], Res), 2 * a]*)
32.2649 -
32.2650 -(*/--- final test ---------------------------------------------------------------------------\\*)
32.2651 -val (res, asm) = (get_obj g_result pt (fst p));
32.2652 -if UnparseC.term res = "2 * a" andalso map UnparseC.term asm = []
32.2653 -andalso p = ([], Und) andalso msg = "end-of-calculation"
32.2654 -andalso pr_ctree pr_short pt = ". ----- pblobj -----\n1. a + a\n"
32.2655 -then
32.2656 - case tac''''' of Check_Postcond ["polynomial", "simplification"] => ()
32.2657 - | _ => error "re-build: fun find_next_step, mini 1"
32.2658 -else error "re-build: fun find_next_step, mini 2"
32.2659 -
32.2660 +"--- 3--- see EqSystem.thy (*..if replaced by 'and' ...*)";
32.2661 +val SOME (t,_) = rewrite_set_ thy true order_system t;
32.2662 +if UnparseC.term t = "[c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2]"
32.2663 +then () else error "eqsystem.sml rewrite in 2x2 simplify_System_par.3";
32.2664 +( * inhertited errors -----------------------------------------------------------------------//*)
32.2665
32.2666 \<close> ML \<open>
32.2667 -"----------- re-build: fun locate_input_term ---------------------------------------------------";
32.2668 -"----------- re-build: fun locate_input_term ---------------------------------------------------";
32.2669 -"----------- re-build: fun locate_input_term ---------------------------------------------------";
32.2670 -(*cp from inform.sml
32.2671 - ----------- appendFormula: on Res + late deriv ------------------------------------------------*)
32.2672 -val fmz = ["equality (x+1=(2::real))", "solveFor x", "solutions L"];
32.2673 -val (dI',pI',mI') = ("Test", ["sqroot-test", "univariate", "equation", "test"],
32.2674 - ["Test", "squ-equ-test-subpbl1"]);
32.2675 +"----------- rewrite example from 2nd [EqSystem,normalise,2x2] ---";
32.2676 +"----------- rewrite example from 2nd [EqSystem,normalise,2x2] ---";
32.2677 +"----------- rewrite example from 2nd [EqSystem,normalise,2x2] ---";
32.2678 +val thy = @{theory "Isac_Knowledge"} (*because of Undeclared constant "Biegelinie.EI*);
32.2679 +val t =
32.2680 + TermC.str2term"[0 = c_2 + c * 0 + 1 / EI * (L * q_0 / 12 * 0 \<up> 3 + \
32.2681 + \ - 1 * q_0 / 24 * 0 \<up> 4),\
32.2682 + \ 0 = c_2 + c * L + 1 / EI * (L * q_0 / 12 * L \<up> 3 + \
32.2683 + \ - 1 * q_0 / 24 * L \<up> 4)]";
32.2684 +val SOME (t,_) = rewrite_set_ thy true norm_Rational t;
32.2685 +if UnparseC.term t =
32.2686 + "[0 = c_2,\n 0 = (24 * c_2 * EI + 24 * L * c * EI + L \<up> 4 * q_0) / (24 * EI)]"
32.2687 +then () else error "eqsystem.sml rewrite in 2x2 simplify_System_par.0b";
32.2688 +
32.2689 +val SOME(t,_)= rewrite_set_inst_ thy true bdvs simplify_System_parenthesized t;
32.2690 +if UnparseC.term t = (*"[0 = 0 / EI + c_2, 0 = q_0 * L \<up> 4 / (24 * EI) + (L * c + c_2)]"*)
32.2691 + "[0 = c_2, 0 = q_0 * L \<up> 4 / (24 * EI) + (L * c + c_2)]"
32.2692 +then () else error "eqsystem.sml rewrite in 2x2 simplify_System_par.1b";
32.2693 +
32.2694 +val SOME (t,_) = rewrite_set_inst_ thy true bdvs isolate_bdvs t;
32.2695 +if UnparseC.term t = (*"[c_2 = 0 + - 1 * (0 / EI),\n L * c + c_2 = 0 + - 1 * (q_0 * L \<up> 4 / (24 * EI))]"*)
32.2696 + "[c_2 = 0, L * c + c_2 = 0 + - 1 * (q_0 * L \<up> 4 / (24 * EI))]"
32.2697 +then () else error "eqsystem.sml rewrite in 2x2 isolate_bdvs b";
32.2698 +
32.2699 +val SOME(t,_)= rewrite_set_inst_ thy true bdvs simplify_System t;
32.2700 +if UnparseC.term t = (*"[c_2 = 0 / EI, L * c + c_2 = - 1 * q_0 * L \<up> 4 / (24 * EI)]"*)
32.2701 + "[c_2 = 0, L * c + c_2 = - 1 * q_0 * L \<up> 4 / (24 * EI)]"
32.2702 +then () else error "eqsystem.sml rewrite in 2x2 simplify_System.2b";
32.2703 +
32.2704 +val xxx = rewrite_set_ thy true order_system t;
32.2705 +if is_none xxx
32.2706 +then () else error "eqsystem.sml rewrite in 2x2 simplify_System.3b";
32.2707 +
32.2708 +
32.2709 +\<close> ML \<open>
32.2710 +"----------- rewrite in [EqSystem,top_down_substitution,2x2] -----";
32.2711 +"----------- rewrite in [EqSystem,top_down_substitution,2x2] -----";
32.2712 +"----------- rewrite in [EqSystem,top_down_substitution,2x2] -----";
32.2713 +val e1__ = TermC.str2term "c_2 = 77";
32.2714 +val e2__ = TermC.str2term "L * c + c_2 = q_0 * L \<up> 2 / 2";
32.2715 +val bdvs = [(TermC.str2term"bdv_1",TermC.str2term"c"),
32.2716 + (TermC.str2term"bdv_2",TermC.str2term"c_2")];
32.2717 +val SOME (e2__,_) = rewrite_terms_ thy dummy_ord Rule_Set.Empty [e1__] e2__;
32.2718 +if UnparseC.term e2__ = "L * c + 77 = q_0 * L \<up> 2 / 2" then ()
32.2719 +else error "eqsystem.sml top_down_substitution,2x2] subst";
32.2720 +
32.2721 +\<close> ML \<open>
32.2722 +val SOME (e2__,_) =
32.2723 + rewrite_set_inst_ thy true bdvs simplify_System_parenthesized e2__;
32.2724 +if UnparseC.term e2__ = "77 + L * c = q_0 * L \<up> 2 / 2" then ()
32.2725 +else error "eqsystem.sml top_down_substitution,2x2] simpl_par";
32.2726 +
32.2727 +\<close> ML \<open>
32.2728 +val SOME (e2__,_) = rewrite_set_inst_ thy true bdvs isolate_bdvs e2__;
32.2729 +if UnparseC.term e2__ = "c = (q_0 * L \<up> 2 / 2 + - 1 * 77) / L" then ()
32.2730 +else error "eqsystem.sml top_down_substitution,2x2] isolate";
32.2731 +
32.2732 +\<close> ML \<open>
32.2733 +val t = TermC.str2term "[c_2 = 77, c = (q_0 * L \<up> 2 / 2 + - 1 * 77) / L]";
32.2734 +val SOME (t,_) = rewrite_set_ thy true order_system t;
32.2735 +if UnparseC.term t = "[c = (q_0 * L \<up> 2 / 2 + - 1 * 77) / L, c_2 = 77]" then ()
32.2736 +else error "eqsystem.sml top_down_substitution,2x2] order_system";
32.2737 +
32.2738 +\<close> ML \<open>
32.2739 +if not (ord_simplify_System
32.2740 + false thy []
32.2741 + (TermC.str2term"[c_2 = 77, c = (q_0 * L \<up> 2 / 2 + - 1 * 77) / L]",
32.2742 + TermC.str2term"[c = (q_0 * L \<up> 2 / 2 + - 1 * 77) / L, c_2 = 77]"))
32.2743 +then () else error "eqsystem.sml, order_result rew_ord";
32.2744 +
32.2745 +
32.2746 +\<close> ML \<open>
32.2747 +"----------- rewrite in [EqSystem,normalise,4x4] -----------------";
32.2748 +"----------- rewrite in [EqSystem,normalise,4x4] -----------------";
32.2749 +"----------- rewrite in [EqSystem,normalise,4x4] -----------------";
32.2750 +(*STOPPED.WN06?: revise rewrite in [EqSystem,normalise,4x4] from before 0609*)
32.2751 +val t = TermC.str2term (
32.2752 + "[(0::real) = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c_3 + c_4, " ^
32.2753 + "(0::real) = - 1 * q_0 * L \<up> 2 / 2 + L * c_3 + c_4, " ^
32.2754 + "c + c_2 + c_3 + c_4 = 0, " ^
32.2755 + "c_2 + c_3 + c_4 = 0]");
32.2756 +\<close> ML \<open>
32.2757 +val bdvs = [(TermC.str2term"bdv_1::real",TermC.str2term"c::real"),
32.2758 + (TermC.str2term"bdv_2::real",TermC.str2term"c_2::real"),
32.2759 + (TermC.str2term"bdv_3::real",TermC.str2term"c_3::real"),
32.2760 + (TermC.str2term"bdv_4::real",TermC.str2term"c_4::real")];
32.2761 +val SOME (t, _) =
32.2762 + rewrite_set_inst_ thy true bdvs simplify_System_parenthesized t;
32.2763 +\<close> ML \<open>
32.2764 +UnparseC.term t =
32.2765 + "[0 = - 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]"
32.2766 +\<close> text \<open> (* ^^^^^^- TOODOO: simplify_System_parenthesized \<longrightarrow> - 0 + c_4*)
32.2767 +(* inhertited errors -----------------------------------------------------------------------\\* )
32.2768 +if UnparseC.term t = "[0 = c_4, 0 = - 1 * q_0 * L \<up> 2 / 2 + (L * c_3 + c_4), c + (c_2 + (c_3 + c_4)) = 0, c_2 + (c_3 + c_4) = 0]"
32.2769 +then () else error "eqsystem.sml rewrite in 4x4 simplify_System_paren";
32.2770 +
32.2771 +val SOME (t,_) = rewrite_set_inst_ thy true bdvs isolate_bdvs t;
32.2772 +if UnparseC.term t = "[c_4 = 0, \
32.2773 + \L * c_3 + c_4 = 0 + - 1 * (- 1 * q_0 * L \<up> 2 / 2),\n \
32.2774 + \c + (c_2 + (c_3 + c_4)) = 0, c_2 + (c_3 + c_4) = 0]"
32.2775 +then () else error "eqsystem.sml rewrite in 4x4 isolate_bdvs";
32.2776 +
32.2777 +val SOME(t,_)= rewrite_set_inst_ thy true bdvs simplify_System_parenthesized t;
32.2778 +if UnparseC.term t = "[c_4 = 0,\
32.2779 + \ L * c_3 + c_4 = q_0 * L \<up> 2 / 2,\
32.2780 + \ c + (c_2 + (c_3 + c_4)) = 0,\n\
32.2781 + \ c_2 + (c_3 + c_4) = 0]"
32.2782 +then () else error "eqsystem.sml rewrite in 4x4 simplify_System_p..2";
32.2783 +
32.2784 +val SOME (t,_) = rewrite_set_ thy true order_system t;
32.2785 +if UnparseC.term t = "[c_4 = 0,\
32.2786 + \ L * c_3 + c_4 = q_0 * L \<up> 2 / 2,\
32.2787 + \ c_2 + (c_3 + c_4) = 0,\n\
32.2788 + \ c + (c_2 + (c_3 + c_4)) = 0]"
32.2789 +then () else error "eqsystem.sml rewrite in 4x4 order_system";
32.2790 +( * inhertited errors -----------------------------------------------------------------------//*)
32.2791 +
32.2792 +\<close> ML \<open>
32.2793 +"----------- refine [linear,system]-------------------------------";
32.2794 +"----------- refine [linear,system]-------------------------------";
32.2795 +"----------- refine [linear,system]-------------------------------";
32.2796 +val fmz =
32.2797 + ["equalities [0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2," ^
32.2798 + "0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + (c_2::real)]",
32.2799 + "solveForVars [c, c_2]", "solution LL"];
32.2800 +
32.2801 +(*WN120313 in "solution L" above "Refine.refine fmz ["LINEAR", "system"]" caused an error...*)
32.2802 +"~~~~~ fun Refine.refine, args:"; val ((fmz: Formalise.model), (pblID:Problem.id)) = (fmz, ["LINEAR", "system"]);
32.2803 +"~~~~~ fun refin', args:"; val ((pblRD: Problem.id_reverse), fmz, pbls, ((Store.Node (pI, [py], [])): Problem.T Store.node)) =
32.2804 + ((rev o tl) pblID, fmz, [(*match list*)],
32.2805 + ((Store.Node ("LINEAR", [Problem.from_store ["LINEAR", "system"]], [])): Problem.T Store.node));
32.2806 + val {thy, ppc, where_, prls, ...} = py ;
32.2807 +"~~~~~ fun O_Model.init, args:"; val (fmz, thy, pbt) = (fmz, thy, ppc);
32.2808 + val ctxt = Proof_Context.init_global thy;
32.2809 +"~~~~~ fun declare_constraints, args:"; val (t, ctxt) = (nth 1 fmz, ctxt);
32.2810 + fun get_vars ((v,T)::vs) = (case raw_explode v |> Library.read_int of
32.2811 + (_, _::_) => (Free (v,T)::get_vars vs)
32.2812 + | (_, [] ) => get_vars vs) (*filter out nums as long as
32.2813 + we have Free ("123",_)*)
32.2814 + | get_vars [] = [];
32.2815 + t = "equalities [0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2,"^
32.2816 + "0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + (c_2::real)]";
32.2817 + val ts = Term.add_frees (Syntax.read_term ctxt t) [] |> get_vars;
32.2818 +val ctxt = Variable.declare_constraints (nth 1 ts) ctxt;
32.2819 +val ctxt = Variable.declare_constraints (nth 2 ts) ctxt;
32.2820 +val ctxt = Variable.declare_constraints (nth 3 ts) ctxt;
32.2821 +val ctxt = Variable.declare_constraints (nth 4 ts) ctxt;
32.2822 + val t = nth 2 fmz; t = "solveForVars [c, c_2]";
32.2823 + val ts = Term.add_frees (Syntax.read_term ctxt t) [] |> get_vars;
32.2824 +val ctxt = Variable.declare_constraints (nth 1 ts) ctxt;
32.2825 + val t = nth 3 fmz; t = "solution LL";
32.2826 + (*(Syntax.read_term ctxt t);
32.2827 +Type unification failed: Clash of types "real" and "_ list"
32.2828 +Type error in application: incompatible operand type
32.2829 +
32.2830 +Operator: solution :: bool list \<Rightarrow> toreall
32.2831 +Operand: L :: real ========== L was already present in equalities ========== *)
32.2832 +
32.2833 +\<close> ML \<open>
32.2834 +"===== case 1 =====";
32.2835 +val matches = Refine.refine fmz ["LINEAR", "system"];
32.2836 +case matches of
32.2837 + [M_Match.Matches (["LINEAR", "system"], _),
32.2838 + M_Match.Matches (["2x2", "LINEAR", "system"], _),
32.2839 + M_Match.NoMatch (["triangular", "2x2", "LINEAR", "system"], _),
32.2840 + M_Match.Matches (["normalise", "2x2", "LINEAR", "system"],
32.2841 + {Find = [Correct "solution LL"],
32.2842 + With = [],
32.2843 + Given =
32.2844 + [Correct
32.2845 + "equalities\n [0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2,\n 0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2]",
32.2846 + Correct "solveForVars [c, c_2]"],
32.2847 + Where = [],
32.2848 + Relate = []})] => ()
32.2849 +| _ => error "eqsystem.sml Refine.refine ['normalise','2x2'...]";
32.2850 +
32.2851 +\<close> ML \<open>
32.2852 +"===== case 2 =====";
32.2853 +val fmz = ["equalities [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2]",
32.2854 + "solveForVars [c, c_2]", "solution LL"];
32.2855 +val matches = Refine.refine fmz ["LINEAR", "system"];
32.2856 +case matches of [_,_,
32.2857 + M_Match.Matches
32.2858 + (["triangular", "2x2", "LINEAR", "system"],
32.2859 + {Find = [Correct "solution LL"],
32.2860 + With = [],
32.2861 + Given =
32.2862 + [Correct "equalities [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2]",
32.2863 + Correct "solveForVars [c, c_2]"],
32.2864 + Where = [Correct
32.2865 + "tl [c, c_2] from [c, c_2] occur_exactly_in NTH 1\n [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2]",
32.2866 + Correct
32.2867 + "[c, c_2] from [c, c_2] occur_exactly_in NTH 2\n [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2]"],
32.2868 + Relate = []})] => ()
32.2869 +| _ => error "eqsystem.sml Refine.refine ['triangular','2x2'...]";
32.2870 +
32.2871 +\<close> ML \<open>
32.2872 +(*WN051014-----------------------------------------------------------------------------------\\
32.2873 + the above 'val matches = Refine.refine fmz ["LINEAR", "system"]'
32.2874 + didn't work anymore; we investigated in these steps:(**)
32.2875 +val fmz = ["equalities [(c_2::real) = 0, L * (c::real) + c_2 = q_0 * L \<up> 2 / 2]",
32.2876 + "solveForVars [(c::real), (c_2::real)]", "solution LL"];
32.2877 +val matches = Refine.refine fmz ["triangular", "2x2", "LINEAR", "system"];
32.2878 +(*... resulted in
32.2879 + False "[c, c_2] from_ [c, c_2] occur_exactly_in nth_ 2\n
32.2880 + [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2]"]*)
32.2881 +val t = TermC.str2term ("[(c::real), (c_2::real)] from [(c::real), (c_2::real)] occur_exactly_in NTH 2" ^
32.2882 + "[(c_2::real) = 0, L * (c::real) + c_2 = q_0 * L \<up> 2 / 2]");
32.2883 +Rewrite.trace_on := false; (*true false*)
32.2884 +val SOME (t', _) = rewrite_set_ thy false prls_triangular t;
32.2885 +(*found:...
32.2886 +## try thm: NTH_CONS
32.2887 +### eval asms: 1 < 2 + - 1
32.2888 +==> nth_ (2 + - 1) [L * c + c_2 = q_0 * L \<up> 2 / 2] =
32.2889 + nth_ (2 + - 1 + - 1) []
32.2890 +#### rls: erls_prls_triangular on: 1 < 2 + - 1
32.2891 +##### try calc: op <'
32.2892 +### asms accepted: ["1 < 2 + - 1"] stored: ["1 < 2 + - 1"]
32.2893 +
32.2894 +... i.e Eval ("Groups.plus_class.plus", eval_binop "#add_") was missing in erls_prls_triangular*)
32.2895 +--------------------------------------------------------------------------------------------//*)
32.2896 +
32.2897 +\<close> ML \<open>
32.2898 +"===== case 3: relaxed preconditions for triangular system =====";
32.2899 +val fmz = ["equalities [L * q_0 = c, \
32.2900 + \ 0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2,\
32.2901 + \ 0 = c_4, \
32.2902 + \ 0 = c_3]",
32.2903 + "solveForVars [c, c_2, c_3, c_4]", "solution LL"];
32.2904 +(*============ inhibit exn WN120314 TODO: investigate type error (same) in these 2 cases:
32.2905 +probably exn thrown by fun declare_constraints
32.2906 +/-------------------------------------------------------\
32.2907 +Type unification failed
32.2908 +Type error in application: incompatible operand type
32.2909 +
32.2910 +Operator: op # c_3 :: 'a list \<Rightarrow> 'a list
32.2911 +Operand: [c_4] :: 'b list
32.2912 +\-------------------------------------------------------/
32.2913 +val TermC.matches = Refine.refine fmz ["LINEAR", "system"];
32.2914 +case TermC.matches of
32.2915 + [M_Match.Matches (["LINEAR", "system"], _),
32.2916 + M_Match.NoMatch (["2x2", "LINEAR", "system"], _),
32.2917 + M_Match.NoMatch (["3x3", "LINEAR", "system"], _),
32.2918 + M_Match.Matches (["4x4", "LINEAR", "system"], _),
32.2919 + M_Match.NoMatch (["triangular", "4x4", "LINEAR", "system"], _),
32.2920 + M_Match.Matches (["normalise", "4x4", "LINEAR", "system"], _)] => ()
32.2921 + | _ => error "eqsystem.sml: Refine.refine relaxed triangular sys M_Match.NoMatch";
32.2922 +(*WN060914 does NOT match, because 3rd and 4th equ are not ordered*)
32.2923 +
32.2924 +"===== case 4 =====";
32.2925 +val fmz = ["equalities [L * q_0 = c, \
32.2926 + \ 0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2,\
32.2927 + \ 0 = c_3, \
32.2928 + \ 0 = c_4]",
32.2929 + "solveForVars [c, c_2, c_3, c_4]", "solution LL"];
32.2930 +val TermC.matches = Refine.refine fmz ["triangular", "4x4", "LINEAR", "system"];
32.2931 +case TermC.matches of
32.2932 + [M_Match.Matches (["triangular", "4x4", "LINEAR", "system"], _)] => ()
32.2933 + | _ => error "eqsystem.sml: Refine.refine relaxed triangular sys M_Match.NoMatch";
32.2934 +val TermC.matches = Refine.refine fmz ["LINEAR", "system"];
32.2935 +============ inhibit exn WN120314 ==============================================*)
32.2936 +
32.2937 +\<close> ML \<open>
32.2938 +"----------- Refine.refine [2x2,linear,system] search error--------------";
32.2939 +"----------- Refine.refine [2x2,linear,system] search error--------------";
32.2940 +"----------- Refine.refine [2x2,linear,system] search error--------------";
32.2941 +(*didn't go into ["2x2", "LINEAR", "system"];
32.2942 + we investigated in these steps:*)
32.2943 +val fmz = ["equalities [0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2,\
32.2944 + \0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2]",
32.2945 + "solveForVars [c, c_2]", "solution LL"];
32.2946 +Rewrite.trace_on := false; (*true false*)
32.2947 +val matches = Refine.refine fmz ["2x2", "LINEAR", "system"];
32.2948 +Rewrite.trace_on := false; (*true false*)
32.2949 +(*default_print_depth 11;*) TermC.matches; (*default_print_depth 3;*)
32.2950 +(*brought: 'False "length_ es_ = 2"'*)
32.2951 +
32.2952 +(*-----fun refin' (pblRD:Problem.id_reverse) fmz pbls ((Store.Node (pI,[py],[])):pbt Store.store) =
32.2953 +(* val ((pblRD:Problem.id_reverse), fmz, pbls, ((Store.Node (pI,[py],[])):pbt Store.store)) =
32.2954 + (rev ["LINEAR", "system"], fmz, [(*match list*)],
32.2955 + ((Store.Node ("2x2",[Problem.from_store ["2x2", "LINEAR", "system"]],[])):pbt Store.store));
32.2956 + *)
32.2957 +> show_types:=true; UnparseC.term (hd where_); show_types:=false;
32.2958 +val it = "length_ (es_::real list) = (2::real)" : string
32.2959 +
32.2960 +=========================================================================\
32.2961 +-------fun Problem.prep_input
32.2962 +(* val (thy, (pblID, dsc_dats: (string * (string list)) list,
32.2963 + ev:rls, ca: string option, metIDs:metID list)) =
32.2964 + (EqSystem.thy, (["system"],
32.2965 + [("#Given" ,["equalities es_", "solveForVars v_s"]),
32.2966 + ("#Find" ,["solution ss___"](*___ is copy-named*))
32.2967 + ],
32.2968 + Rule_Set.append_rules "empty" Rule_Set.empty [(*for preds in where_*)],
32.2969 + SOME "solveSystem es_ v_s",
32.2970 + []));
32.2971 + *)
32.2972 +> val [("#Given", [equalities_es_, "solveForVars v_s"])] = gi;
32.2973 +val equalities_es_ = "equalities es_" : string
32.2974 +> val (dd, ii) = (split_did o Thm.term_of o the o (TermC.parse thy)) equalities_es_;
32.2975 +> show_types:=true; UnparseC.term ii; show_types:=false;
32.2976 +val it = "es_::bool list" : string
32.2977 +~~~~~~~~~~~~~~~ \<up> \<up> \<up> OK~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32.2978 +
32.2979 +> val {where_,...} = Problem.from_store ["2x2", "LINEAR", "system"];
32.2980 +> show_types:=true; UnparseC.term (hd where_); show_types:=false;
32.2981 +
32.2982 +=========================================================================/
32.2983 +
32.2984 +-----fun refin' ff:
32.2985 +> (writeln o (I_Model.to_string (ThyC.to_ctxt @{theory Isac_Knowledge}))) itms;
32.2986 +[
32.2987 +(1 ,[1] ,true ,#Given ,Cor equalities
32.2988 + [0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2,
32.2989 + 0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2] ,(es_, [[0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2,
32.2990 + 0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2]])),
32.2991 +(2 ,[1] ,true ,#Given ,Cor solveForVars [c, c_2] ,(v_s, [[c, c_2]])),
32.2992 +(3 ,[1] ,true ,#Find ,Cor solution L ,(ss___, [L]))]
32.2993 +
32.2994 +> (writeln o pres2str) pre';
32.2995 +[
32.2996 +(false, length_ es_ = 2),
32.2997 +(true, length_ [c, c_2] = 2)]
32.2998 +
32.2999 +----- fun match_oris':
32.3000 +> (writeln o (I_Model.to_string (ThyC.to_ctxt @{theory Isac_Knowledge}))) itms;
32.3001 +> (writeln o pres2str) pre';
32.3002 +..as in refin'
32.3003 +
32.3004 +----- fun check in Pre_Conds.
32.3005 +> (writeln o env2str) env;
32.3006 +["
32.3007 +(es_, [0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2,
32.3008 + 0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2])", "
32.3009 +(v_s, [c, c_2])", "
32.3010 +(ss___, L)"]
32.3011 +
32.3012 +> val es_ = (fst o hd) env;
32.3013 +val es_ = Free ("es_", "bool List.list") : Term.term
32.3014 +
32.3015 +> val pre1 = hd pres;
32.3016 +TermC.atomty pre1;
32.3017 +***
32.3018 +*** Const (op =, [real, real] => bool)
32.3019 +*** . Const (ListG.length_, real list => real)
32.3020 +*** . . Free (es_, real list)
32.3021 +~~~~~~~~~~~~~~~~~~~ \<up> \<up> \<up> should be bool list~~~~~~~~~~~~~~~~~~~
32.3022 +*** . Free (2, real)
32.3023 +***
32.3024 +
32.3025 +THE REASON WAS A non-type-constrained variable IN #WHERE OF PROBLEM
32.3026 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32.3027 +*)
32.3028 +
32.3029 +"----------- me [EqSystem,normalise,2x2] -------------------------";
32.3030 +"----------- me [EqSystem,normalise,2x2] -------------------------";
32.3031 +"----------- me [EqSystem,normalise,2x2] -------------------------";
32.3032 +val fmz = ["equalities [0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2,\
32.3033 + \0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2]",
32.3034 + "solveForVars [c, c_2]", "solution LL"];
32.3035 +val (dI',pI',mI') =
32.3036 + ("Biegelinie",["normalise", "2x2", "LINEAR", "system"],
32.3037 + ["EqSystem", "normalise", "2x2"]);
32.3038 +val p = e_pos'; val c = [];
32.3039 val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.3040 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.3041 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.3042 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.3043 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.3044 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.3045 -val (p,_,f,nxt,_,pt) = me nxt p [] pt;
32.3046 -(*[], Met*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*Apply_Method ["Test", "squ-equ-test-subpbl1"]*);
32.3047 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3048 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3049 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3050 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3051 +case nxt of Specify_Method ["EqSystem", "normalise", "2x2"] => ()
32.3052 + | _ => error "eqsystem.sml [EqSystem,normalise,2x2] specify";
32.3053
32.3054 -(*[1], Frm*)val (p,_,f,nxt,_,pt) = me nxt p [] pt;(*Rewrite_Set "norm_equation"*)
32.3055 -(*+*)if f2str f = "x + 1 = 2" then () else error "locate_input_term at ([1], Frm) CHANGED";
32.3056 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3057 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3058 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f(*["(bdv_1, c)", "(bdv_2, hd (tl [c, c_2] ... corrected srls; ran only AFTER use"RCODE-root.sml", store_met was NOT SUFFICIENT*);
32.3059 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3060 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3061 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3062 +case nxt of
32.3063 + (Subproblem ("Biegelinie", ["triangular", "2x2", "LINEAR",_])) => ()
32.3064 + | _ => error "eqsystem.sml me [EqSystem,normalise,2x2] SubProblem";
32.3065
32.3066 -(*[1], Res*)val (p,_,f,nxt,_,pt) = me nxt p [] pt;(*Rewrite_Set "Test_simplify"*)
32.3067 -(*+*)if f2str f = "x + 1 + - 1 * 2 = 0" then () else error "locate_input_term at ([1], Frm) CHANGED";
32.3068 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3069 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3070 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3071 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3072 +case nxt of
32.3073 + (Specify_Method ["EqSystem", "top_down_substitution", "2x2"]) => ()
32.3074 + | _ => error "eqsystem.sml me [EqSys...2x2] top_down_substitution";
32.3075
32.3076 -Test_Tool.show_pt_tac pt; (*[
32.3077 -([], Frm), solve (x + 1 = 2, x)
32.3078 -. . . . . . . . . . Apply_Method ["Test", "squ-equ-test-subpbl1"],
32.3079 -([1], Frm), x + 1 = 2
32.3080 -. . . . . . . . . . Rewrite_Set "norm_equation",
32.3081 -([1], Res), x + 1 + - 1 * 2 = 0 ///Check_Postcond..ERROR*)
32.3082 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3083 +val PblObj {probl,...} = get_obj I pt [5];
32.3084 + (writeln o (I_Model.to_string (ThyC.to_ctxt @{theory Isac_Knowledge}))) probl;
32.3085 +(*[
32.3086 +(1 ,[1] ,true ,#Given ,Cor equalities [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2] ,(es_, [[c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2]])),
32.3087 +(2 ,[1] ,true ,#Given ,Cor solveForVars [c, c_2] ,(v_s, [[c, c_2]])),
32.3088 +(3 ,[1] ,true ,#Find ,Cor solution ss___ ,(ss___, [ss___]))]
32.3089 +*)
32.3090 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3091 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3092 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3093 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3094 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3095 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3096 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3097 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3098 +case nxt of
32.3099 + (Check_Postcond ["triangular", "2x2", "LINEAR", "system"]) => ()
32.3100 + | _ => error "eqsystem.sml me Subpbl .[EqSys...2x2] finished";
32.3101 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3102 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3103 +if f2str f = "[c = L * q_0 / 2, c_2 = 0]" then ()
32.3104 +else error "eqsystem.sml me [EqSys...2x2] finished f2str f";
32.3105 +case nxt of
32.3106 + (End_Proof') => ()
32.3107 + | _ => error "eqsystem.sml me [EqSys...2x2] finished End_Proof'";
32.3108
32.3109 -(*//---------- appendFormula 1 "x = 1" \<longrightarrow> Step_Solve.inform \<longrightarrow> LI.locate_input_term ----------\\*)
32.3110 -"~~~~~ fun appendFormula , args:"; val ((*cI, *) ifo: TermC.as_string) = ((**) "x = 1");
32.3111 - val cs = (*get_calc cI*) ((pt, p), [(*nxt, nxt_, (pos, (ist, ctxt))*)])
32.3112 - val pos = (*get_pos cI 1*) p
32.3113 +\<close> ML \<open>
32.3114 +"----------- me [linear,system] ..normalise..top_down_sub..-------";
32.3115 +"----------- me [linear,system] ..normalise..top_down_sub..-------";
32.3116 +"----------- me [linear,system] ..normalise..top_down_sub..-------";
32.3117 +val fmz =
32.3118 + ["equalities\
32.3119 + \[0 = c_2 + c * 0 + 1 / EI * (L * q_0 / 12 * 0 \<up> 3 + \
32.3120 + \ - 1 * q_0 / 24 * 0 \<up> 4),\
32.3121 + \ 0 = c_2 + c * L + 1 / EI * (L * q_0 / 12 * L \<up> 3 + \
32.3122 + \ - 1 * q_0 / 24 * L \<up> 4)]",
32.3123 + "solveForVars [c, c_2]", "solution LL"];
32.3124 +val (dI',pI',mI') =
32.3125 + ("Biegelinie",["LINEAR", "system"], ["no_met"]);
32.3126 +val p = e_pos'; val c = [];
32.3127 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.3128 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3129 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3130 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3131 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3132 +case nxt of (Specify_Method ["EqSystem", "normalise", "2x2"]) => ()
32.3133 + | _ => error "eqsystem.sml [linear,system] specify b";
32.3134 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3135 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3136 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3137 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3138 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3139 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3140 +if f2str f =
32.3141 +"[c_2 = 0, L * c + c_2 = - 1 * q_0 * L \<up> 4 / (24 * EI)]"
32.3142 +then () else error "eqsystem.sml me simpl. before SubProblem b";
32.3143 +case nxt of
32.3144 + (Subproblem ("Biegelinie", ["triangular", "2x2", "LINEAR",_])) => ()
32.3145 + | _ => error "eqsystem.sml me [linear,system] SubProblem b";
32.3146
32.3147 -(*+*)val ptp''''' = (pt, p);
32.3148 -(*+*)if snd ptp''''' = ([1], Res) then () else error "old_cs changed";
32.3149 -(*+*)Test_Tool.show_pt_tac pt; (*[
32.3150 -(*+*)([], Frm), solve (x + 1 = 2, x)
32.3151 -(*+*). . . . . . . . . . Apply_Method ["Test", "squ-equ-test-subpbl1"],
32.3152 -(*+*)([1], Frm), x + 1 = 2
32.3153 -(*+*). . . . . . . . . . Rewrite_Set "norm_equation",
32.3154 -(*+*)([1], Res), x + 1 + - 1 * 2 = 0 ///Check_Postcond*)
32.3155 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3156 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3157 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3158 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3159 +case nxt of
32.3160 + (Specify_Method ["EqSystem", "top_down_substitution", "2x2"]) => ()
32.3161 + | _ => error "eqsystem.sml me [EqSys...2x2] top_down_substitution b";
32.3162
32.3163 - val ("ok", cs' as (_, _, ptp')) =
32.3164 - (*case*) Step.do_next pos cs (*of*);
32.3165 +val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3166 +val PblObj {probl,...} = get_obj I pt [5];
32.3167 + (writeln o (I_Model.to_string (ThyC.to_ctxt @{theory Isac_Knowledge}))) probl;
32.3168 +(*[
32.3169 +(1 ,[1] ,true ,#Given ,Cor equalities [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2] ,(es_, [[c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2]])),
32.3170 +(2 ,[1] ,true ,#Given ,Cor solveForVars [c, c_2] ,(v_s, [[c, c_2]])),
32.3171 +(3 ,[1] ,true ,#Find ,Cor solution ss___ ,(ss___, [ss___]))]
32.3172 +*)
32.3173 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3174 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3175 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3176 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3177 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3178 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3179 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3180 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3181 +case nxt of
32.3182 + (Check_Postcond ["triangular", "2x2", "LINEAR", "system"]) => ()
32.3183 + | _ => error "eqsystem.sml me Subpbl .[EqSys...2x2] finished b";
32.3184 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3185 +val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
32.3186
32.3187 -val ("ok", (_(*use in DG !!!*), [], ptp''''' as (pt''''', p'''''))) = (*case*)
32.3188 - Step_Solve.by_term ptp' (encode ifo) (*of*);
32.3189 -"~~~~~ fun Step_Solve.by_term , args:"; val ((pt, pos as (p, _)), istr)
32.3190 - = (ptp', (encode ifo));
32.3191 - val SOME f_in =
32.3192 - (*case*) TermC.parse (ThyC.get_theory "Isac_Knowledge") istr (*of*);
32.3193 - val f_in = Thm.term_of f_in
32.3194 - val pos_pred = lev_back(*'*) pos
32.3195 - val f_pred = Ctree.get_curr_formula (pt, pos_pred);
32.3196 - val f_succ = Ctree.get_curr_formula (pt, pos);
32.3197 - (*if*) f_succ = f_in (*else*);
32.3198 - val NONE =
32.3199 - (*case*) CAS_Cmd.input f_in (*of*);
32.3200 +if f2str f = "[c = - 1 * q_0 * L \<up> 3 / (24 * EI), c_2 = 0]"
32.3201 +then () else error "eqsystem.sml me [EqSys...2x2] finished f2str f b";
32.3202 +case nxt of
32.3203 + (End_Proof') => ()
32.3204 + | _ => error "eqsystem.sml me [EqSys...2x2] finished End_Proof'";
32.3205
32.3206 -(*old* ) val (_, _, metID) = get_obj g_spec pt (par_pblobj pt p)
32.3207 -(*old*) val {scr = prog, ...} = MethodC.from_store metID
32.3208 -(*old*) val istate = get_istate_LI pt pos
32.3209 -(*old*) val ctxt = get_ctxt pt pos
32.3210 - val LI.Found_Step (cstate'''''_', _(*istate*), _(*ctxt*)) = (*case*)
32.3211 - LI.locate_input_term prog (pt, pos) istate ctxt f_in (*of*);
32.3212 -"~~~~~ fun locate_input_term , args:"; val ((Rule.Prog _), ((pt, pos) : Calc.T), (_ : Istate.T), (_ : Proof.context), tm)
32.3213 - = (prog, (pt, pos), istate, ctxt, f_in);
32.3214 -( *old*)
32.3215
32.3216 -(*NEW*) LI.locate_input_term (pt, pos) f_in (*of*);
32.3217 -"~~~~~ fun locate_input_term , args:"; val ((pt, pos), tm) = ((pt, pos), f_in);
32.3218 - val pos_pred = Pos.lev_back' pos (*f_pred ---"step pos cs"---> f_succ in appendFormula*)
32.3219 +\<close> ML \<open>
32.3220 +"----------- all systems from Biegelinie -------------------------";
32.3221 +"----------- all systems from Biegelinie -------------------------";
32.3222 +"----------- all systems from Biegelinie -------------------------";
32.3223 +val thy = @{theory Isac_Knowledge}
32.3224 +val subst =
32.3225 + [(TermC.str2term "bdv_1", TermC.str2term "c"), (TermC.str2term "bdv_2", TermC.str2term "c_2"),
32.3226 + (TermC.str2term "bdv_3", TermC.str2term "c_3"), (TermC.str2term "bdv_4", TermC.str2term "c_4")];
32.3227
32.3228 - val ("ok", (_, _, cstate as (pt', pos'))) =
32.3229 - (*case*) compare_step ([], [], (pt, pos_pred)) tm (*of*);
32.3230 +"------- Bsp 7.27";
32.3231 +reset_states ();
32.3232 +CalcTree [(
32.3233 + ["Traegerlaenge L", "Streckenlast q_0", "Biegelinie y",
32.3234 + "Randbedingungen [y 0 = (0::real), y L = 0, M_b 0 = 0, M_b L = 0]", "FunktionsVariable x"],
32.3235 + ("Biegelinie", ["Biegelinien"], ["IntegrierenUndKonstanteBestimmen2"]))];
32.3236 +moveActiveRoot 1;
32.3237 +(*
32.3238 +LItool.trace_on := true; autoCalculate 1 CompleteCalc; LItool.trace_on := false;
32.3239 +##7.27## ordered substs
32.3240 + c_4 c_2
32.3241 +c c_2 c_3 c_4 c c_2 1->2: c
32.3242 + c_2 c_4
32.3243 +c c_2 c c_2 c_3 c_4 [2':c, 1:c_2, 3:c_4] -> 4:c_3*)
32.3244 +val t = TermC.str2term
32.3245 + ("[0 = c_4, " ^
32.3246 + "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), " ^
32.3247 + "0 = c_2, " ^
32.3248 + "0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2]");
32.3249 +val SOME (t, _) = rewrite_set_ thy false isolate_bdvs_4x4 t;
32.3250 +if UnparseC.term t =
32.3251 +"[c_4 = 0,\n (12 * L \<up> 2 * c_2 + 4 * L \<up> 3 * c + - 1 * L \<up> 4 * q_0) /\n (- 24 * EI) =\n - 1 * (c_4 + L * c_3) + 0,\n c_2 = 0, (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2 = 0]"
32.3252 +then () else error "Bsp 7.27";
32.3253
32.3254 -(*old* )
32.3255 - Found_Step (cstate, get_istate_LI pt' pos', get_ctxt pt' pos') (*return from locate_input_term*);
32.3256 -( *old*)
32.3257 -(*NEW*) Found_Step cstate (*return from locate_input_term*);
32.3258 - (*LI.Found_Step ( *)cstate(*, _(*istate*), _(*ctxt*))( *return from locate_input_term*);
32.3259 -"~~~~~ from fun locate_input_term\<longrightarrow>fun Step_Solve.by_term, return:"; val ("ok", (_(*use in DG !!!*), c, ptp as (_, p)))
32.3260 - = (("ok" , ([], [], cstate (* already contains istate, ctxt *))));
32.3261 +"----- Bsp 7.27 go through the rewrites in met_eqsys_norm_4x4";
32.3262 +val t = TermC.str2term "0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2";
32.3263 +val NONE = rewrite_set_ thy false norm_Rational t;
32.3264 +val SOME (t,_) =
32.3265 + rewrite_set_inst_ thy false subst simplify_System_parenthesized t;
32.3266 +if UnparseC.term t = "0 = - 1 * q_0 * L \<up> 2 / 2 + (L * c + c_2)"
32.3267 +then () else error "Bsp 7.27 go through the rewrites in met_eqsys_norm_4x4";
32.3268
32.3269 - ("ok", ((*_ use in DG !!!,*) c, ptp(* as (_*), p))(*)*)(*return from Step_Solve.by_term*);
32.3270 -"~~~~~ from fun Step_Solve.by_term\<longrightarrow>(fun appendFormula)!toplevel, return:"; val ("ok", (_(*use in DG !!!*), [], ptp''''' as (pt''''', p''''')))
32.3271 - = ("ok", ([], [], ptp));
32.3272 +"--- isolate_bdvs_4x4";
32.3273 +(*
32.3274 +val SOME (t,_) = rewrite_set_inst_ thy false subst isolate_bdvs_4x4 t;
32.3275 +UnparseC.term t;
32.3276 +val SOME (t,_) = rewrite_set_inst_ thy false subst simplify_System t;
32.3277 +UnparseC.term t;
32.3278 +val SOME (t,_) = rewrite_set_ thy false order_system t;
32.3279 +UnparseC.term t;
32.3280 +*)
32.3281
32.3282 -(*fun me requires nxt...*)
32.3283 - Step.do_next p''''' (ptp''''', []);
32.3284 - val ("ok", ([(nxt'''''_' as Check_Postcond ["LINEAR", "univariate", "equation", "test"], _, _)], _,
32.3285 - (pt'''''_', p'''''_'))) = Step.do_next p''''' (ptp''''', [])
32.3286 -(*\\---------- appendFormula 1 "x = 1" \<longrightarrow> Step_Solve.inform \<longrightarrow> LI.locate_input_term ----------//*)
32.3287 +"------- Bsp 7.28 ---------------vvvvvvvvvvvvv Momentenlinie postponed";
32.3288 +reset_states ();
32.3289 +CalcTree [((*WN130908 <ERROR> error in kernel </ERROR>*)
32.3290 + ["Traegerlaenge L", "Momentenlinie (-q_0 / L * x \<up> 3 / 6)",
32.3291 + "Biegelinie y",
32.3292 + "Randbedingungen [y L = 0, y' L = 0]",
32.3293 + "FunktionsVariable x"],
32.3294 + ("Biegelinie", ["vonMomentenlinieZu", "Biegelinien"],
32.3295 + ["Biegelinien", "AusMomentenlinie"]))];
32.3296 +(*
32.3297 +moveActiveRoot 1;
32.3298 +LItool.trace_on := true; autoCalculate 1 CompleteCalc; LItool.trace_on := false;
32.3299 +*)
32.3300
32.3301 -(*//----- REPLACED BY appendFormula 1 "x = 1" \<longrightarrow> Step_Solve.inform \<longrightarrow> LI.locate_input_term -----\\* )
32.3302 - (*[2], Res*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Subproblem ("Test", ["LINEAR", "univariate", "equation", "test"])*)
32.3303 - (*[3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Model_Problem*)
32.3304 - (*[3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Add_Given "equality (- 1 + x = 0)"*)
32.3305 - (*[3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Add_Given "solveFor x"*)
32.3306 - (*[3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Add_Find "solutions x_i"*)
32.3307 - (*[3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Specify_Theory "Test"*)
32.3308 - (*[3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Specify_Problem ["LINEAR", "univariate", "equation", "test"]*)
32.3309 - (*[3], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Specify_Method ["Test", "solve_linear"]*)
32.3310 - (*[3], Met*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Apply_Method ["Test", "solve_linear"]*)
32.3311 - (*[3, 1], Frm*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Rewrite_Set_Inst (["(''bdv'', x)"], "isolate_bdv")*)
32.3312 - (*[3, 1], Res*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Rewrite_Set "Test_simplify"*)
32.3313 - (*[3, 2], Res*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Check_Postcond ["LINEAR", "univariate", "equation", "test"]*)
32.3314 -( *\\----- REPLACED BY appendFormula 1 "x = 1" \<longrightarrow> Step_Solve.inform \<longrightarrow> LI.locate_input_term -----//*)
32.3315 +"------- Bsp 7.69";
32.3316 +reset_states ();
32.3317 +CalcTree [(
32.3318 + ["Traegerlaenge L", "Streckenlast q_0", "Biegelinie y",
32.3319 + "Randbedingungen [y 0 = (0::real), y L = 0, y' 0 = 0, y' L = 0]", "FunktionsVariable x"],
32.3320 + ("Biegelinie", ["Biegelinien"], ["IntegrierenUndKonstanteBestimmen2"]))];
32.3321 +moveActiveRoot 1;
32.3322 +(*
32.3323 +LItool.trace_on := true; autoCalculate 1 CompleteCalc; LItool.trace_on := false;
32.3324 +##7.69## ordered subst 2x2
32.3325 + c_4 c_3
32.3326 +c c_2 c_3 c_4 c c_2 c_3 1:c_3 -> 2:c c_2 2: c c_2
32.3327 + c_3 c_4
32.3328 +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*)
32.3329 +val t = TermC.str2term
32.3330 + ("[0 = c_4 + 0 / (- 1 * EI), " ^
32.3331 + "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), " ^
32.3332 + "0 = c_3 + 0 / (- 1 * EI), " ^
32.3333 + "0 = c_3 + (6 * L * c_2 + 3 * L \<up> 2 * c + - 1 * L \<up> 3 * q_0) / (-6 * EI)]");
32.3334
32.3335 - (*[3], Res*)val (p,_,f,nxt,_,pt) = me nxt'''''_' p'''''_' [] pt'''''_'; (*nxt = Check_elementwise "Assumptions"*)
32.3336 - (*[4], Res*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Check_Postcond ["sqroot-test", "univariate", "equation", "test"]*)
32.3337 - (*[], Res*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = End_Proof'*)
32.3338 +"------- Bsp 7.70";
32.3339 +reset_states ();
32.3340 +CalcTree [(
32.3341 + ["Traegerlaenge L", "Streckenlast q_0", "Biegelinie y",
32.3342 + "Randbedingungen [Q 0 = q_0 * L, M_b L = 0, y 0 = (0::real), y' 0 = 0]", "FunktionsVariable x"],
32.3343 + ("Biegelinie", ["Biegelinien"], ["IntegrierenUndKonstanteBestimmen2"] ))];
32.3344 +moveActiveRoot 1;
32.3345 +(*
32.3346 +LItool.trace_on := true; autoCalculate 1 CompleteCalc; LItool.trace_on := false;
32.3347 +##7.70## |subst
32.3348 +c |
32.3349 +c c_2 |1:c -> 2:c_2
32.3350 + c_3 |
32.3351 + c_4 | STOPPED.WN06? test methods @@@@@@@@@@@@@@@@@@@@@@@*)
32.3352
32.3353 -(*/--- final test ---------------------------------------------------------------------------\\*)
32.3354 -if p = ([], Res) andalso f2str f = "[x = 1]" andalso pr_ctree pr_short pt =
32.3355 - ". ----- pblobj -----\n" ^
32.3356 - "1. x + 1 = 2\n" ^
32.3357 - "2. x + 1 + - 1 * 2 = 0\n" ^
32.3358 - "3. ----- pblobj -----\n" ^
32.3359 - "3.1. - 1 + x = 0\n" ^
32.3360 - "3.2. x = 0 + - 1 * - 1\n" ^
32.3361 - "3.2.1. x = 0 + - 1 * - 1\n" ^
32.3362 - "3.2.2. x = 0 + 1\n" (*ATTENTION: see complete Calc below*)
32.3363 -then case nxt of End_Proof' => () | _ => error "re-build: fun locate_input_term CHANGED 1"
32.3364 -else error "re-build: fun locate_input_term CHANGED 2";
32.3365 +\<close> ML \<open>
32.3366 +"----- 7.70 go through the rewrites in met_eqsys_norm_4x4";
32.3367 +val t = TermC.str2term
32.3368 + ("[L * q_0 = c, " ^
32.3369 + "0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2, " ^
32.3370 + "0 = c_4, " ^
32.3371 + "0 = c_3]");
32.3372 +val SOME (t,_) = rewrite_ thy e_rew_ord Rule_Set.empty false (ThmC.numerals_to_Free @{thm commute_0_equality}) t;
32.3373 +val SOME (t,_) = rewrite_ thy e_rew_ord Rule_Set.empty false (ThmC.numerals_to_Free @{thm commute_0_equality}) t;
32.3374 +val SOME (t,_) = rewrite_ thy e_rew_ord Rule_Set.empty false (ThmC.numerals_to_Free @{thm commute_0_equality}) t;
32.3375 +if UnparseC.term t =
32.3376 + "[L * q_0 = c, (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2 = 0,\n c_4 = 0, c_3 = 0]"
32.3377 +then () else error "7.70 go through the rewrites in met_eqsys_norm_4x4, 1";
32.3378
32.3379 -Test_Tool.show_pt_tac pt; (*[
32.3380 -([], Frm), solve (x + 1 = 2, x)
32.3381 -. . . . . . . . . . Apply_Method ["Test", "squ-equ-test-subpbl1"],
32.3382 -([1], Frm), x + 1 = 2
32.3383 -. . . . . . . . . . Rewrite_Set "norm_equation",
32.3384 -([1], Res), x + 1 + - 1 * 2 = 0
32.3385 -. . . . . . . . . . Rewrite_Set "Test_simplify",
32.3386 -([2], Res), - 1 + x = 0
32.3387 -. . . . . . . . . . Subproblem (Test, ["LINEAR", "univariate", "equation", "test"]),
32.3388 -([3], Pbl), solve (- 1 + x = 0, x)
32.3389 -. . . . . . . . . . Apply_Method ["Test", "solve_linear"],
32.3390 -([3,1], Frm), - 1 + x = 0
32.3391 -. . . . . . . . . . Rewrite_Set_Inst ([(''bdv'', x)], "isolate_bdv"),
32.3392 -([3,1], Res), x = 0 + - 1 * - 1
32.3393 -. . . . . . . . . . Derive Test_simplify,
32.3394 -([3,2,1], Frm), x = 0 + - 1 * - 1
32.3395 -. . . . . . . . . . Rewrite ("#: - 1 * - 1 = 1", "- 1 * - 1 = 1"),
32.3396 -([3,2,1], Res), x = 0 + 1
32.3397 -. . . . . . . . . . Rewrite ("radd_0", "0 + ?k = ?k"),
32.3398 -([3,2,2], Res), x = 1
32.3399 -. . . . . . . . . . Tactic.input_to_string not impl. for ?!,
32.3400 -([3,2], Res), x = 1
32.3401 -. . . . . . . . . . Check_Postcond ["LINEAR", "univariate", "equation", "test"],
32.3402 -([3], Res), [x = 1]
32.3403 -. . . . . . . . . . Check_Postcond ["sqroot-test", "univariate", "equation", "test"],
32.3404 -([], Res), [x = 1]]*)
32.3405 +\<close> ML \<open>
32.3406 +val SOME (t,_) = rewrite_set_inst_ thy false subst simplify_System_parenthesized t;
32.3407 +if UnparseC.term t = "[L * q_0 = c, - 1 * q_0 * L \<up> 2 / 2 + (L * c + c_2) = 0, c_4 = 0,\n c_3 = 0]"
32.3408 +then () else error "7.70 go through the rewrites in met_eqsys_norm_4x4, 2";
32.3409
32.3410 +val SOME (t,_) = rewrite_set_inst_ thy false subst isolate_bdvs_4x4 t;
32.3411 +if UnparseC.term t =
32.3412 + "[c = (- 1 * (L * q_0) + 0) / - 1,\n" ^
32.3413 + " L * c + c_2 = - 1 * (- 1 * q_0 * L \<up> 2 / 2) + 0, c_4 = 0, c_3 = 0]"
32.3414 +then () else error "7.70 go through the rewrites in met_eqsys_norm_4x4, 3";
32.3415 +
32.3416 +val SOME (t,_) = rewrite_set_inst_ thy false subst simplify_System_parenthesized t;
32.3417 +\<close> ML \<open>
32.3418 +UnparseC.term t = "[c = - 0 + - 1 * L * q_0 / - 1, " ^
32.3419 + (*^^^^^^*) "L * c + c_2 = q_0 * L \<up> 2 / 2, c_4 = 0, c_3 = 0]"
32.3420 +\<close> text \<open> (*TOODOO simplify_System_parenthesized: \<longrightarrow> - 0 + - 1 * L * q_0 / - 1 *)
32.3421 +(** )
32.3422 +if UnparseC.term t = "[c = - 1 * L * q_0 / - 1, L * c + c_2 = q_0 * L \<up> 2 / 2, c_4 = 0, c_3 = 0]"
32.3423 +then () else error "7.70 go through the rewrites in met_eqsys_norm_4x4, 4";
32.3424 +( **)
32.3425 +
32.3426 +val SOME (t, _) = rewrite_set_ thy false order_system t;
32.3427 +\<close> ML \<open>
32.3428 +UnparseC.term t =
32.3429 + "[L * q_0 = c, (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2 = 0,\n c_4 = 0, c_3 = 0]"
32.3430 +\<close> ML \<open> (*TOODOO order_system: \<longrightarrow> c_4 = 0, c_3 = 0 *)
32.3431 +(** )
32.3432 +if UnparseC.term t = "[c = - 1 * L * q_0 / - 1, L * c + c_2 = q_0 * L \<up> 2 / 2, c_3 = 0, c_4 = 0]"
32.3433 +then () else error "eqsystem.sml: exp 7.70 normalise 4x4 by rewrite changed";
32.3434 +( **)
32.3435 +
32.3436 +\<close> ML \<open>
32.3437 +"----- 7.70 with met normalise: ";
32.3438 +val fmz = ["equalities" ^
32.3439 + "[L * q_0 = c, " ^
32.3440 + "0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2, " ^
32.3441 + "0 = c_4, " ^
32.3442 + "0 = c_3]", "solveForVars [c, c_2, c_3, c_4]", "solution LL"];
32.3443 +val (dI',pI',mI') = ("Biegelinie",["LINEAR", "system"], ["no_met"]);
32.3444 +val p = e_pos'; val c = [];
32.3445 +
32.3446 +\<close> ML \<open>
32.3447 +(*============ inhibit exn WN120314 TODO: investigate type error (same as above)==
32.3448 + in next but one test below the same type error.
32.3449 +/-------------------------------------------------------\
32.3450 +Type unification failed
32.3451 +Type error in application: incompatible operand type
32.3452 +
32.3453 +Operator: op # c_3 :: 'a list \<Rightarrow> 'a list
32.3454 +Operand: [c_4] :: 'b list
32.3455 +\-------------------------------------------------------/
32.3456 +
32.3457 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.3458 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3459 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3460 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3461 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3462 +case nxt of (_,Apply_Method ["EqSystem", "normalise", "4x4"]) => ()
32.3463 + | _ => error "eqsystem.sml [EqSystem,normalise,4x4] specify";
32.3464 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
32.3465 +
32.3466 +"----- outcommented before Isabelle2002 --> 2011 -------------------------";
32.3467 +(*-----------------------------------vvvWN080102 Exception- Match raised
32.3468 + since associate Rewrite .. Rewrite_Set
32.3469 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
32.3470 +
32.3471 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
32.3472 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
32.3473 +
32.3474 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
32.3475 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
32.3476 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
32.3477 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
32.3478 +if f2str f ="[c = L * q_0, L * c + c_2 = q_0 * L \<up> 2 / 2, c_3 = 0, c_4 = 0]"
32.3479 +then () else error "eqsystem.sml: exp 7.70 normalise 4x4 by met changed";
32.3480 +--------------------------------------------------------------------------*)
32.3481 +============ inhibit exn WN120314 ==============================================*)
32.3482 +
32.3483 +\<close> ML \<open>
32.3484 +"----- 7.70 with met top_down_: me";
32.3485 +val fmz = [
32.3486 + "equalities [(c::real) = L * q_0, L * c + (c_2::real) = q_0 * L \<up> 2 / 2, (c_3::real) = 0, (c_4::real) = 0]",
32.3487 + "solveForVars [(c::real), (c_2::real), (c_3::real), (c_4::real)]", "solution LL"];
32.3488 +val (dI',pI',mI') =
32.3489 + ("Biegelinie",["LINEAR", "system"],["no_met"]);
32.3490 +val p = e_pos'; val c = [];
32.3491 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.3492 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3493 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3494 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3495 +val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3496 +case nxt of Apply_Method ["EqSystem", "top_down_substitution", "4x4"] => ()
32.3497 + | _ => error "eqsystem.sml [EqSystem,top_down_,4x4] specify";
32.3498 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
32.3499 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
32.3500 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
32.3501 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
32.3502 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
32.3503 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
32.3504 +if p = ([], Res) andalso
32.3505 +(* "[c = L * q_0, c_2 = - 1 * L \<up> 2 * q_0 / 2, c_3 = 0, c_4 = 0]"*)
32.3506 + f2str f = "[c = L * q_0, c_2 = - 1 * L \<up> 2 * q_0 / 2, c_3 = 0, c_4 = 0]"
32.3507 +then () else error "eqsystem.sml: 7.70 with met top_down_: me";
32.3508 +
32.3509 +\<close> ML \<open>
32.3510 +"------- Bsp 7.71";
32.3511 +reset_states ();
32.3512 +CalcTree [(["Traegerlaenge L", "Streckenlast q_0", "Biegelinie y",
32.3513 + "Randbedingungen [M_b L = 0, y 0 = (0::real), y L = 0, y' 0 = 0]",
32.3514 + "FunktionsVariable x", "GleichungsVariablen [c, c_2, c_3, c_4]",
32.3515 + "AbleitungBiegelinie dy"],
32.3516 + ("Biegelinie", ["Biegelinien"],
32.3517 + ["IntegrierenUndKonstanteBestimmen2"] ))];
32.3518 +moveActiveRoot 1;
32.3519 +(*
32.3520 +LItool.trace_on := true; autoCalculate 1 CompleteCalc; LItool.trace_on := false;
32.3521 +##7.71## |ordered |subst.singles (recurs) |2x2 |diagonal
32.3522 +c c_2 |c c_2 |1' |1': c c_2 |
32.3523 + c_4 | c_3 |2:c_3 -> 4' :c c_2 c_4 | |
32.3524 +c c_2 c_3 c_4 | c_4 |3' | |
32.3525 + c_3 |c c_2 c_3 c_4 |3:c_4 -> 4'':c c_2 |4'':c c_2 | *)
32.3526 +val t = TermC.str2term"[0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2, \
32.3527 +\ 0 = c_4 + 0 / (- 1 * EI), \
32.3528 +\ 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),\
32.3529 +\ 0 = c_3 + 0 / (- 1 * EI)]";
32.3530 +
32.3531 +"------- Bsp 7.72a ---------------vvvvvvvvvvvvv Momentenlinie postponed";
32.3532 +reset_states ();
32.3533 +CalcTree [(["Traegerlaenge L",
32.3534 + "Momentenlinie ((q_0 * L)/ 6 * x - q_0 /(6 * L) * x \<up> ^3)",
32.3535 + "Biegelinie y",
32.3536 + "Randbedingungen [y 0 = (0::real), y L = 0]",
32.3537 + "FunktionsVariable x"],
32.3538 + ("Biegelinie", ["vonMomentenlinieZu", "Biegelinien"],
32.3539 + ["Biegelinien", "AusMomentenlinie"]))];
32.3540 +moveActiveRoot 1;
32.3541 +(*
32.3542 +LItool.trace_on := true; autoCalculate 1 CompleteCalc; LItool.trace_on := false;
32.3543 +*)
32.3544 +
32.3545 +\<close> ML \<open>
32.3546 +"------- Bsp 7.72b";
32.3547 +reset_states ();
32.3548 +CalcTree [(["Traegerlaenge L", "Streckenlast (q_0 / L * x)", "Biegelinie y",
32.3549 + "Randbedingungen [M_b 0 = 0, M_b L = 0, y 0 = (0::real), y L = 0]",
32.3550 + "FunktionsVariable x", "GleichungsVariablen [c, c_2, c_3, c_4]",
32.3551 + "AbleitungBiegelinie dy"],
32.3552 + ("Biegelinie", ["Biegelinien"],
32.3553 + ["IntegrierenUndKonstanteBestimmen2"] ))];
32.3554 +moveActiveRoot 1;
32.3555 +(*
32.3556 +LItool.trace_on := true; autoCalculate 1 CompleteCalc; LItool.trace_on := false;
32.3557 +##7.72b## |ord. |subst.singles |ord.triang.
32.3558 + c_2 | | |c_2
32.3559 +c c_2 | |1:c_2 -> 2':c |c_2 c
32.3560 + c_4 | | |
32.3561 +c c_2 c_3 c_4 | |3:c_4 -> 4':c c_2 c_3 |c_2 c c_3*)
32.3562 +val t = TermC.str2term"[0 = c_2, \
32.3563 +\ 0 = (6 * c_2 + 6 * L * c + - 1 * L \<up> 2 * q_0) / 6, \
32.3564 +\ 0 = c_4 + 0 / (- 1 * EI), \
32.3565 +\ 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)]";
32.3566 +
32.3567 +"------- Bsp 7.73 ---------------vvvvvvvvvvvvv Momentenlinie postponed";
32.3568 +reset_states ();
32.3569 +CalcTree [(["Traegerlaenge L", "Momentenlinie ???",(*description unclear*)
32.3570 + "Biegelinie y",
32.3571 + "Randbedingungen [y L = 0, y' L = 0]",
32.3572 + "FunktionsVariable x"],
32.3573 + ("Biegelinie", ["vonMomentenlinieZu", "Biegelinien"],
32.3574 + ["Biegelinien", "AusMomentenlinie"]))];
32.3575 +moveActiveRoot 1;
32.3576 +(*
32.3577 +LItool.trace_on := true; autoCalculate 1 CompleteCalc; LItool.trace_on := false;
32.3578 +*)
32.3579 +
32.3580 +\<close> ML \<open>
32.3581 +"----------- 4x4 systems from Biegelinie -------------------------";
32.3582 +"----------- 4x4 systems from Biegelinie -------------------------";
32.3583 +"----------- 4x4 systems from Biegelinie -------------------------";
32.3584 +(*STOPPED.WN08?? replace this test with 7.70 *)
32.3585 +"----- Bsp 7.27";
32.3586 +val fmz = ["equalities \
32.3587 + \[0 = c_4, \
32.3588 + \ 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), \
32.3589 + \ 0 = c_2, \
32.3590 + \ 0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2]",
32.3591 + "solveForVars [c, c_2, c_3, c_4]", "solution LL"];
32.3592 +val (dI',pI',mI') =
32.3593 + ("Biegelinie",["normalise", "4x4", "LINEAR", "system"],
32.3594 + ["EqSystem", "normalise", "4x4"]);
32.3595 +val p = e_pos'; val c = [];
32.3596 +val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
32.3597 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3598 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3599 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3600 +val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
32.3601 +"------------------------------------------- Apply_Method...";
32.3602 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
32.3603 +"[0 = c_4, \
32.3604 +\ 0 = c_4 + L * c_3 +\n (12 * L \<up> 2 * c_2 + 4 * L \<up> 3 * c + - 1 * L \<up> 4 * q_0) / (- 24 * EI), \
32.3605 +\ 0 = c_2, \
32.3606 +\ 0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2]";
32.3607 +(*vvvWN080102 Exception- Match raised
32.3608 + since associate Rewrite .. Rewrite_Set
32.3609 +"------------------------------------------- simplify_System_parenthesized...";
32.3610 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
32.3611 +"[0 = c_4, \
32.3612 +\ 0 = - 1 * q_0 * L \<up> 4 / (- 24 * EI) + \
32.3613 +\ (4 * L \<up> 3 * c / (- 24 * EI) + \
32.3614 +\ (12 * L \<up> 2 * c_2 / (- 24 * EI) + \
32.3615 +\ (L * c_3 + c_4))), \
32.3616 +\ 0 = c_2, \
32.3617 +\ 0 = - 1 * q_0 * L \<up> 2 / 2 + (L * c + c_2)]";
32.3618 +(*? "(4 * L \<up> 3 / (- 24 * EI) * c" statt "(4 * L \<up> 3 * c / (- 24 * EI)" ?*)
32.3619 +"------------------------------------------- isolate_bdvs...";
32.3620 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
32.3621 +"[c_4 = 0,\
32.3622 +\ c_4 = 0 + - 1 * (- 1 * q_0 * L \<up> 4 / (- 24 * EI)) + - 1 * (4 * L \<up> 3 * c / (- 24 * EI)) + - 1 * (12 * L \<up> 2 * c_2 / (- 24 * EI)) + - 1 * (L * c_3),\
32.3623 +\ c_2 = 0, \
32.3624 +\ c_2 = 0 + - 1 * (- 1 * q_0 * L \<up> 2 / 2) + - 1 * (L * c)]";
32.3625 +val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
32.3626 +
32.3627 +---------------------------------------------------------------------*)
32.3628 \<close> ML \<open>
32.3629 \<close> ML \<open>
32.3630 \<close>