test/Tools/isac/Knowledge/rateq.sml
author wneuper <Walther.Neuper@jku.at>
Sun, 09 Oct 2022 07:44:22 +0200
changeset 60565 f92963a33fe3
parent 60559 aba19e46dd84
child 60571 19a172de0bb5
permissions -rw-r--r--
eliminate term2str in test/*
neuper@42394
     1
(* Title:  Test for rational equations
neuper@42394
     2
   Author: Richard Lang 2009
neuper@42394
     3
   (c) copyright due to lincense terms.
neuper@42394
     4
*)
neuper@37906
     5
neuper@42394
     6
"-----------------------------------------------------------------";
neuper@42394
     7
"table of contents -----------------------------------------------";
neuper@42394
     8
"-----------------------------------------------------------------";
walther@59835
     9
"----------- pbl: rational, univariate, equation ----------------";
walther@59835
    10
"----------- solve (1/x = 5, x) by me ---------------------------";
walther@59835
    11
"----------- S.68, Bsp.: 40, ((x)/(x - 8) + (x - 8)/(x) = 26/5)--";
walther@59835
    12
"----------- x / (x ^ 2 - 6 * x + 9) - 1 / (x ^ 2 - 3 * x) = 1 /x";
walther@59835
    13
"----------- ((5*x)/(x - 2) - x/(x+2)=(4::real)), incl. refine ---------------------------------";
neuper@42394
    14
"-----------------------------------------------------------------";
neuper@42394
    15
"-----------------------------------------------------------------";
neuper@37906
    16
neuper@42394
    17
val thy = @{theory "RatEq"};
neuper@48761
    18
val ctxt = Proof_Context.init_global thy;
neuper@37906
    19
neuper@42394
    20
"------------ pbl: rational, univariate, equation ----------------";
neuper@42394
    21
"------------ pbl: rational, univariate, equation ----------------";
neuper@42394
    22
"------------ pbl: rational, univariate, equation ----------------";
Walther@60424
    23
val t = TermC.parseNEW' ctxt "(1/b+1/x=1) is_ratequation_in  x";
Walther@60500
    24
val SOME (t_, _) = rewrite_set_ ctxt  false RatEq_prls t;
walther@59868
    25
val result = UnparseC.term t_;
neuper@42394
    26
if result <>  "True"  then error "rateq.sml: new behaviour 1:" else ();
neuper@41943
    27
Walther@60424
    28
val t = TermC.parseNEW' ctxt "(sqrt(x)=1) is_ratequation_in  x";
Walther@60500
    29
val SOME (t_, _) = rewrite_set_ ctxt  false RatEq_prls t;
walther@59868
    30
val result = UnparseC.term t_;
neuper@42394
    31
if result <>  "False"  then error "rateq.sml: new behaviour 2:" else ();
neuper@37906
    32
Walther@60424
    33
val t = TermC.parseNEW' ctxt "(x=- 1) is_ratequation_in x";
Walther@60500
    34
val SOME (t_,_) = rewrite_set_ ctxt  false RatEq_prls t;
walther@59868
    35
val result = UnparseC.term t_;
neuper@42394
    36
if result <>  "False"  then error "rateq.sml: new behaviour 3:" else ();
neuper@37906
    37
Walther@60424
    38
val t = TermC.parseNEW' ctxt "(3 + x \<up> 2 + 1/(x \<up> 2+3)=1) is_ratequation_in x";
Walther@60500
    39
val SOME (t_,_) = rewrite_set_ ctxt  false RatEq_prls t;
walther@59868
    40
val result = UnparseC.term t_;
neuper@42394
    41
if result <>  "True"  then error "rateq.sml: new behaviour 4:" else ();
neuper@37906
    42
walther@59997
    43
val result = M_Match.match_pbl ["equality (x=(1::real))", "solveFor x", "solutions L"] 
Walther@60559
    44
  (Problem.from_store @{context} ["rational", "univariate", "equation"]); 
walther@59984
    45
case result of M_Match.NoMatch' _  => ()  | _ => error "rateq.sml: new behaviour: 5";
neuper@37906
    46
walther@60242
    47
val result = M_Match.match_pbl ["equality (3 + x \<up> 2 + 1/(x \<up> 2+3)=1)", "solveFor x", "solutions L"] 
Walther@60559
    48
  (Problem.from_store @{context} ["rational", "univariate", "equation"]); 
walther@59984
    49
case result of M_Match.Matches' _  => ()  | _ => error "rateq.sml: new behaviour: 6";
neuper@37906
    50
neuper@42394
    51
"------------ solve (1/x = 5, x) by me ---------------------------";
neuper@42394
    52
"------------ solve (1/x = 5, x) by me ---------------------------";
neuper@42394
    53
"------------ solve (1/x = 5, x) by me ---------------------------";
walther@59997
    54
val fmz = ["equality (1/x=(5::real))", "solveFor x", "solutions L"];
Walther@60549
    55
val (dI',pI',mI') = 
Walther@60549
    56
  ((** )"RatEq"( **)"PolyEq"(*rls "make_ratpoly_in" missing in theory "RatEq" (and ancestors)*),
Walther@60549
    57
  ["univariate", "equation"],["no_met"]);
neuper@37906
    58
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
neuper@42394
    59
(* val (p,_,f,nxt,_,pt) = me nxt p [1] pt;------------- now Refine_Tacitly*)
walther@59997
    60
(*  nxt = ("Model_Problem",Model_Problem ["rational", "univariate", "equation"]) *)
neuper@37906
    61
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
    62
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
    63
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
    64
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@42394
    65
Walther@60424
    66
case nxt of (Rewrite_Set "RatEq_eliminate") => () | _ => ((*not checked before*));
neuper@37906
    67
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@42394
    68
(*
walther@60023
    69
WN120317.TODO dropped rateq: here "x ~= 0 should TermC.sub_at to ctxt, but it does not:
neuper@42394
    70
 --- repair NO asms from rls RatEq_eliminate --- shows why.
neuper@42394
    71
so it needs more effort to find out, how Check_elementwise worked in 2002, see below.
neuper@42394
    72
*)
neuper@42394
    73
walther@59997
    74
(* val nxt = (_,Subproblem ("RatEq",["univariate", "equation"] ======= *)
neuper@37906
    75
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@42394
    76
(* val (p,_,f,nxt,_,pt) = me nxt p [1] pt;------------- now Refine_Tacitly*)
walther@59997
    77
(*val nxt = ("Model_Problem", Model_Problem ["normalise", "polynomial", "univariate", "equation"])*) 
neuper@37906
    78
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
    79
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
    80
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
    81
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
wneuper@59370
    82
(*val nxt = Apply_Method ["PolyEq", "normalise_poly"])*)
neuper@37906
    83
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
    84
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
walther@59997
    85
(* val nxt = (_,Subproblem ("PolyEq",["polynomial", "univariate", "equation"]=======*)
neuper@37906
    86
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
    87
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
walther@59997
    88
(*  ("Model_Problem", Model_Problem ["degree_1", "polynomial", "univariate", "equation"])*)
neuper@37906
    89
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
    90
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
    91
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
    92
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
    93
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
    94
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@42394
    95
val (p''',_,f,nxt''',_,pt''') = me nxt p [1] pt;
neuper@42394
    96
f2str f = "[x = 1 / 5]";
Walther@60424
    97
case nxt of (Check_elementwise "Assumptions") => () | _ => ((*not checked before*));
walther@59749
    98
"~~~~~ fun me, args:"; val (tac, (p:pos'), _, (pt:ctree)) = (nxt, p, c, pt);
walther@59804
    99
val (pt, p) = case Step.by_tactic tac (pt,p) of
walther@59804
   100
("ok", (_, _, ptp)) => ptp | _ => error "--- solve (1/x = 5.. Step.by_tactic";
walther@59765
   101
"~~~~~ fun Step.do_next, args:"; val (ip as (_,p_), (ptp as (pt,p), tacis)) = (p, ((pt, e_pos'), []))
neuper@42394
   102
val pIopt = get_pblID (pt,ip); (*= SOME ["rational", "univariate", "equation"]
walther@60329
   103
                       1- 1 associated to metID ["RatEq", "solve_rat_equation"]*)
neuper@42394
   104
tacis; (*= []*)
walther@60017
   105
member op = [Pbl,Met] p_; (*= false*)
walther@59760
   106
"~~~~~ fun do_next, args:"; val (ptp as (pt, pos as (p, p_))) = (pt, ip);
neuper@42394
   107
val thy' = get_obj g_domID pt (par_pblobj pt p);
Walther@60559
   108
val (is, sc) = resume_prog (p,p_) pt; (*is: which ctxt?*)
walther@59772
   109
"~~~~~ fun find_next_step, args:"; val () = ();
walther@59679
   110
(*----- outcommented during cleanup of args in lucas-interpreter.sml ------------------------\\* )
walther@59769
   111
"~~~~~ fun go_scan_up, args:"; val (thy, ptp, (Prog sc), E, l, ay, a, v) =
walther@59784
   112
(thy, ptp, sc, E, l, true, a, v);
neuper@42394
   113
1 < length l; (*true*)
neuper@42394
   114
val up = drop_last l;
walther@60336
   115
TermC.sub_at up sc; (* = Const (\<^const_name>\<open>Let\<close>, *)
walther@59769
   116
"~~~~~ fun scan_up, args:"; val (thy, ptp, (scr as (Prog sc)), E, l, ay,
walther@60336
   117
 (t as Const (\<^const_name>\<open>Let\<close>,_) $ _), a, v) = (thy, ptp, (Prog sc), E, up, ay, (TermC.sub_at up sc), a, v);
neuper@42394
   118
ay = Napp_; (*false*)
neuper@42394
   119
val up = drop_last l;
walther@60336
   120
val (Const (\<^const_name>\<open>Let\<close>,_) $ e $ (Abs (i,T,body))) = TermC.sub_at up sc; (*Const (\<^const_name>\<open>SubProblem\<close>,..*)
neuper@42394
   121
val i = mk_Free (i, T);
walther@59697
   122
val E = Env.update E (i, v);
walther@59769
   123
"~~~~~ fun scan_dn, args:"; val ((thy as (th,sr)), (pt, p), E, l, t, a, v) =
neuper@42394
   124
  (thy, ptp, E, (up@[R,D]), body, a, v);
walther@59772
   125
"~~~~~ fun check_leaf, args:"; val (call, thy, srls, (E, (a, v)), t) = ("next ", th, sr, (E, (a, v)), t);
walther@59718
   126
"~~~~~ fun eval_leaf, args:"; val (E, a, v, 
walther@60336
   127
	  (t as (Const (\<^const_name>\<open>Check_elementwise\<close>,_) $ _ $ _ ))) = (E, a, v, t);
walther@59717
   128
val Program.Tac tm = Program.Tac (subst_atomic E t);
walther@59868
   129
UnparseC.term tm = "Check_elementwise [x = 1 / 5] {v_v. Assumptions}";
walther@60242
   130
(*                                     ------ \<up> ----- ? "x" ?*)
walther@59772
   131
"~~~~~ to check_leaf return val:"; val ((Program.Tac stac, a')) = ((Program.Tac (subst_atomic E t), NONE));
walther@59881
   132
val stac' = eval_prog_expr (ThyC.get_theory thy) srls (subst_atomic (upd_env_opt E (a,v)) stac);
walther@59868
   133
UnparseC.term stac' = "Check_elementwise [x = 1 / 5] {v_v. Assumptions}";
walther@59769
   134
"~~~~~ to scan_dn return val:"; val ((a', Program.Tac stac)) = ((a', Program.Tac stac'));
walther@59881
   135
val m = LItool.tac_from_prog pt (ThyC.get_theory th) stac;
wneuper@59253
   136
case m of Check_elementwise "Assumptions" => () | _ => (); (*m' = Empty_Tac_ ???!??? *);
neuper@42394
   137
val (p''''', pt''''', m''''') = (p, pt, m);
walther@59922
   138
"~~~~~ fun check , args:"; val ((p,p_), pt, (m as Check_elementwise pred)) = (p, pt, m);
walther@60017
   139
member op = [Pbl,Met] p_; (* = false*)
neuper@42394
   140
        val pp = par_pblobj pt p; 
neuper@42394
   141
        val thy' = (get_obj g_domID pt pp):theory';
walther@59881
   142
        val thy = ThyC.get_theory thy'
neuper@42394
   143
        val metID = (get_obj g_metID pt pp)
Walther@60559
   144
        val {crls,...} =  MethodC.from_store ctxt metID
neuper@42394
   145
        val (f,asm) = case p_ of Frm => (get_obj g_form pt p , [])
neuper@42394
   146
                               | Res => get_obj g_result pt p;
walther@59868
   147
UnparseC.term f = "[x = 1 / 5]"; (*the current formula*)
walther@60360
   148
        val vp = (Proof_Context.init_global thy, pred) |-> parseNEW |> the |> mk_set thy pt p f;
neuper@42394
   149
val (bdv, asms) = vp;
neuper@42394
   150
walther@59868
   151
UnparseC.term bdv = "x";
walther@59868
   152
UnparseC.terms asms = (* asms from rewriting are missing : vvv *)
walther@60276
   153
  ("[\"~ (matches (?a = 0) (1 = 5 * x)) | ~ lhs (1 = 5 * x) is_poly_in x\",\"x = 1 / 5\", " ^
walther@59997
   154
   "\"lhs (1 + -5 * x = 0) is_poly_in x\",\"lhs (1 + -5 * x = 0) has_degree_in x = 1\", " ^
neuper@42394
   155
   "\"1 / x = 5 is_ratequation_in x\"]");
neuper@42394
   156
(*
neuper@42394
   157
WN120317.TODO dropped rateq: ctxt should contain "x ~= 0 here, but it does not, see above.
neuper@42394
   158
*)
neuper@42394
   159
walther@59922
   160
val Applicable.Yes (Check_elementwise' (curr_form, pred, (res, asms))) = check p''''' pt''''' m''''';
walther@59868
   161
UnparseC.term curr_form = "[x = 1 / 5]";
neuper@42394
   162
pred = "Assumptions";
Walther@60565
   163
res = TermC.parse_test @{context} "[]::bool list";
neuper@42394
   164
asms = [];
neuper@42394
   165
neuper@42394
   166
val (p,_,f,nxt,_,pt) = me nxt''' p''' [] pt'''; (*<<<----- this caused the error*)
neuper@42394
   167
f2str f = "[]";
neuper@37906
   168
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@42394
   169
wneuper@59581
   170
if p = ([], Res) andalso f2str f = "[x = 1 / 5]"
wneuper@59253
   171
then case nxt of ("End_Proof'", End_Proof') => ()
wneuper@59253
   172
  | _ => error "rateq.sml: new behaviour: [x = 1 / 5] 1"
walther@59617
   173
else error "rateq.sml: new behaviour: [x = 1 / 5] 2";
walther@59679
   174
( *----- outcommented during cleanup of args in lucas-interpreter.sml ------------------------//*)
neuper@37906
   175
neuper@42394
   176
"------------ S.68, Bsp.: 40, ((x)/(x - 8) + (x - 8)/(x) = 26/5)--";
neuper@42394
   177
"------------ S.68, Bsp.: 40, ((x)/(x - 8) + (x - 8)/(x) = 26/5)--";
neuper@42394
   178
"------------ S.68, Bsp.: 40, ((x)/(x - 8) + (x - 8)/(x) = 26/5)--";
neuper@37906
   179
(*EP Schalk_II_p68_n40*)
walther@59997
   180
val fmz = ["equality ((x)/(x - 8) + (x - 8)/(x) = 26/(5::real))", "solveFor x", "solutions L"];
Walther@60549
   181
val (dI',pI',mI') = 
Walther@60549
   182
  ((** )"RatEq"( **)"PolyEq"(*rls "make_ratpoly_in" missing in theory "RatEq" (and ancestors)*),
Walther@60549
   183
  ["univariate", "equation"],["no_met"]);
neuper@37906
   184
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
neuper@37906
   185
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
walther@59997
   186
(* nxt = ("Model_Problem",Model_Problem ["rational", "univariate", "equation"])*)
neuper@37906
   187
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
   188
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
   189
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
   190
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
   191
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
   192
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
walther@59997
   193
(* nxt = ("Subproblem",Subproblem ("RatEq",["univariate", "equation"]))*)
neuper@37906
   194
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
walther@59997
   195
(* nxt = ("Model_Problem", Model_Problem ["normalise", "polynomial", "univariate", "equation"])*)
neuper@37906
   196
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
   197
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
   198
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
   199
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
   200
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
walther@59627
   201
walther@59627
   202
if p = ([4, 3], Pbl) then ()
walther@59627
   203
else
walther@59627
   204
  (case nxt of
Walther@60424
   205
    (Add_Given "equality (320 + 128 * x + - 16 * x \<up> 2 = 0)") =>
walther@59627
   206
      (case f of
Walther@60424
   207
        Test_Out.PpcKF (Test_Out.Problem [], {
Walther@60424
   208
          Find = [Incompl "solutions []"], Given = [Incompl "equality", Incompl "solveFor"], 
Walther@60424
   209
          Relate = [], Where = [False "matches (?a + ?v_ \<up> 2 = 0) e_e \<or>\nmatches (?a + ?b * ?v_ \<up> 2 = 0) e_e"], 
Walther@60424
   210
          With = []}) => ()
walther@59627
   211
      | _ => error ("S.68, Bsp.: 40 PblObj changed"))
Walther@60424
   212
  | _ => error ("S.68, Bsp.: 40 changed nxt =" ^ Tactic.input_to_string (nxt)));
walther@59627
   213
neuper@37906
   214
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
walther@59997
   215
(* ("Subproblem", Subproblem ("PolyEq",["polynomial", "univariate", "equation"])) *)
neuper@37906
   216
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
   217
(* nxt = ("Model_Problem", Model_Problem
walther@59997
   218
     ["abcFormula", "degree_2", "polynomial", "univariate", "equation"])*)
neuper@37906
   219
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
   220
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
   221
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
   222
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
   223
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
   224
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@37906
   225
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
Walther@60424
   226
if p = ([], Res) andalso f2str f = "[x = - 2, x = 10]" then () 
walther@60329
   227
else error "rateq.sml: new behaviour: [x = - 2, x = 10]";
neuper@37906
   228
walther@59835
   229
walther@59835
   230
"----------- ((5*x)/(x - 2) - x/(x+2)=(4::real)), incl. refine ---------------------------------";
walther@59835
   231
"----------- ((5*x)/(x - 2) - x/(x+2)=(4::real)), incl. refine ---------------------------------";
walther@59835
   232
"----------- ((5*x)/(x - 2) - x/(x+2)=(4::real)), incl. refine ---------------------------------";
walther@59835
   233
(*was in test/../usecases.sml*)
walther@59997
   234
val fmz = ["equality ((5*x)/(x - 2) - x/(x+2)=(4::real))", "solveFor x", "solutions L"];
Walther@60549
   235
val (dI',pI',mI') = 
Walther@60549
   236
  ((** )"RatEq"( **)"PolyEq"(*rls "make_ratpoly_in" missing in theory "RatEq" (and ancestors)*),
Walther@60549
   237
  ["univariate", "equation"],["no_met"]);
walther@59835
   238
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59835
   239
(*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [1] pt; val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
walther@59835
   240
(**)val (p,_,f,nxt,_,pt) = me nxt p [1] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;(**)
walther@59835
   241
(**)val (p,_,f,nxt,_,pt) = me nxt p [1] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;(**)
walther@59835
   242
(*[], Met*)val (p,_,f,nxt,_,pt) = me nxt p [1] pt;(*Apply_Method ["RatEq", "solve_rat_equation"]*)
walther@59835
   243
(*[1], Frm*)val (p,_,f,nxt,_,pt) = me nxt p [] pt;(*Rewrite_Set "RatEq_simplify":*)
walther@59835
   244
walther@59844
   245
(*+*)if (get_istate_LI pt p |> Istate.string_of) (* still specify-phase: found_accept = false ---------------------------------> vvvvv*)
Walther@60424
   246
(*+*) = "Pstate ([\"\n(e_e, 5 * x / (x - 2) - x / (x + 2) = 4)\", \"\n(v_v, x)\"], [], empty, NONE, \n??.empty, ORundef, false, true)"
walther@59835
   247
(*+*)then () else error "rat-eq + subpbl: istate in specify-phase";
walther@59835
   248
walther@59835
   249
(*[1], Res*)val (p,_,f,nxt,_,pt) = me nxt p [1] pt;(*Rewrite_Set "norm_Rational"*)
walther@59835
   250
walther@59844
   251
(*+*)if (get_istate_LI pt p |> Istate.string_of) (* solve-phase: found_accept = true -----------------------------------------------------------------------------------------------> vvvvv*)
Walther@60424
   252
(*+*) = "Pstate ([\"\n(e_e, 5 * x / (x - 2) - x / (x + 2) = 4)\", \"\n(v_v, x)\"], [R, L, R, L, L, R, R, R], empty, SOME e_e, \n5 * x / (x + - 1 * 2) + - 1 * x / (x + 2) = 4, ORundef, true, true)"
walther@59835
   253
(*+*)then () else error "rat-eq + subpbl: istate after found_accept";
walther@59835
   254
walther@59835
   255
(*[2], Res*)val (p,_,f,nxt,_,pt) = me nxt p [] pt;(*Rewrite_Set "RatEq_eliminate"*)
walther@60242
   256
(* \<up>  2*05*)
Walther@60424
   257
walther@59835
   258
(*[3], Res*)val (p,_,f,nxt,_,pt) = me nxt p [1] pt;(*Subproblem ("PolyEq", ["normalise", "polynomial", "univariate", "equation"])*)
walther@59835
   259
(*[4], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt;(*Model_Problem*)
walther@59835
   260
walther@59835
   261
(**)val (p,_,f,nxt,_,pt) = me nxt p [1] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;(**)
walther@59835
   262
(**)val (p,_,f,nxt,_,pt) = me nxt p [1] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;(**)
walther@59835
   263
(**)val (p,_,f,nxt,_,pt) = me nxt p [1] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;(**)
walther@59835
   264
(**)val (p,_,f,nxt,_,pt) = me nxt p [1] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;(**)
walther@60242
   265
(* \<up>  2*10*)
walther@59835
   266
(**)val (p,_,f,nxt,_,pt) = me nxt p [1] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;(**)
walther@59835
   267
(**)val (p,_,f,nxt,_,pt) = me nxt p [1] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;(**)
walther@59835
   268
(**)val (p,_,f,nxt,_,pt) = me nxt p [1] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;(**)
walther@59835
   269
(**)val (p,_,f,nxt,_,pt) = me nxt p [1] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;(**)
walther@59835
   270
Walther@60424
   271
(*[4,4], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [1] pt;(*Specify_Problem ["degree_1", "polynomial", "univariate", "equation"]*)
Walther@60424
   272
(*[4,4], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [1] pt;(*Specify_Method ["PolyEq", "solve_d1_polyeq_equation"]*)
walther@60242
   273
(* \<up>  2*15*)
Walther@60424
   274
(*[4,4], Met*)val (p,_,f,nxt,_,pt) = me nxt p [1] pt;(*Apply_Method ["PolyEq", "solve_d1_polyeq_equation"]*)
Walther@60424
   275
(*[4,4,1], Frm*)val (p,_,f,nxt,_,pt) = me nxt p [1] pt;(*Rewrite_Set_Inst (["(''bdv'', x)"], "d1_polyeq_simplify")*)
Walther@60424
   276
(*[4,4,1], Res*)val (p,_,f,nxt,_,pt) = me nxt p [1] pt;(*Rewrite_Set "polyeq_simplify"*)
Walther@60424
   277
(*[4,4,2], Res*)val (p,_,f,nxt,_,pt) = me nxt p [] pt;(*Or_to_List*)
walther@59959
   278
(*                       f = Test_Out.FormKF "[x = -4 / 3]" *)
Walther@60424
   279
(*[4,4,3], Res*)val (p,_,f,nxt,_,pt) = me nxt p [] pt;(*Check_elementwise "Assumptions"*)
Walther@60424
   280
(*[4,4,4], Res*)val (p,_,f,nxt,_,pt) = me nxt p [] pt;(*Check_Postcond ["degree_1", "polynomial", "univariate", "equation"]*)
Walther@60424
   281
(*[4,4], Res*)val (p,_,f,nxt,_,pt) = me nxt p [] pt;(*Check_Postcond ["normalise", "polynomial", "univariate", "equation"]*)
walther@59835
   282
(*[4], Res*)val (p,_,f,nxt,_,pt) = me nxt p [] pt;(*Check_elementwise "Assumptions"*)
walther@59835
   283
(*[5], Res*)val (p,_,f,nxt,_,pt) = me nxt p [] pt;(*Check_Postcond ["rational", "univariate", "equation"]*)
walther@59835
   284
(*[], Res*)val (p,_,f,nxt,_,pt) = me nxt p [] pt;(*End_Proof'*)
walther@59835
   285
Walther@60424
   286
if p = ([], Res) andalso f2str f = "[x = - 4 / 3]"
walther@59835
   287
then case nxt of End_Proof' => () | _ => error "rat-eq + subpbl: end CHANGED 1"
walther@59835
   288
else error "rat-eq + subpbl: end CHANGED 2";
walther@59835
   289