test/Tools/isac/Minisubpbl/200-start-method-NEXT_STEP.sml
author wneuper <Walther.Neuper@jku.at>
Fri, 07 Oct 2022 20:46:48 +0200
changeset 60558 2350ba2640fd
parent 60556 486223010ea8
child 60571 19a172de0bb5
permissions -rw-r--r--
follow up 3: MethodC.adapt_to_typ on loading by CalcTree, CalcTreeTEST
walther@59781
     1
(* Title:  "Minisubpbl/200-start-method-NEXT_STEP.sml"
walther@59781
     2
   Author: Walther Neuper 1105
walther@59781
     3
   (c) copyright due to lincense terms.
walther@59781
     4
*)
walther@59781
     5
walther@59781
     6
"----------- Minisubplb/200-start-method-NEXT_STEP.sml ---------------------------------------";
walther@59781
     7
"----------- Minisubplb/200-start-method-NEXT_STEP.sml ---------------------------------------";
walther@59781
     8
"----------- Minisubplb/200-start-method-NEXT_STEP.sml ---------------------------------------";
Walther@60500
     9
val ctxt = Proof_Context.init_global @{theory}
walther@59997
    10
val fmz = ["equality (x+1=(2::real))", "solveFor x", "solutions L"];
walther@59781
    11
val (dI',pI',mI') =
walther@59997
    12
  ("Test", ["sqroot-test", "univariate", "equation", "test"],
walther@59997
    13
   ["Test", "squ-equ-test-subpbl1"]);
walther@59781
    14
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59787
    15
(*[], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*Model_Problem*)
walther@59851
    16
walther@59851
    17
(*rewrite__set_ called with 'Rule_Set.Empty' for 'precond_rootpbl x'*)
walther@59851
    18
(*[], Pbl*)val (_, ([(tac''''', _, _)], _, (pt''''', p'''''))) = Step.do_next p ((pt, e_pos'), []);(*Specify_Theory*)
walther@59851
    19
walther@59851
    20
(*/--------- step into Specify_Theory --------------------------------------------------------\*)
walther@59851
    21
"~~~~~ fun do_next , args:"; val ((ip as (_, p_)), (ptp as (pt, p), tacis)) = (p, ((pt, e_pos'), []));
walther@59851
    22
    val pIopt = Ctree.get_pblID (pt, ip);
walther@59851
    23
    (*if*) ip = ([], Pos.Res) (*else*);
walther@59851
    24
      val _ = (*case*) tacis (*of*);
walther@59851
    25
      val SOME _ = (*case*) pIopt (*of*);
walther@59851
    26
walther@59851
    27
(*rewrite__set_ called with 'Rule_Set.Empty' for 'precond_rootpbl x'*)
walther@59851
    28
           switch_specify_solve p_ (pt, ip);
walther@59851
    29
"~~~~~ fun switch_specify_solve , args:"; val (state_pos, (pt, input_pos)) = (p_, (pt, ip));
walther@60017
    30
      (*if*) member op = [Pos.Pbl, Pos.Met] state_pos (*then*);
walther@59851
    31
walther@59851
    32
(*rewrite__set_ called with 'Rule_Set.Empty' for 'precond_rootpbl x'*)
walther@59851
    33
           specify_do_next (pt, input_pos);
walther@59851
    34
"~~~~~ fun specify_do_next , args:"; val (ptp as (pt, (p, p_))) = (pt, input_pos);
walther@59851
    35
walther@59851
    36
(*rewrite__set_ called with 'Rule_Set.Empty' for 'precond_rootpbl x'*)
Walther@60556
    37
    val (_, (_(*p_'*), _(*tac*))) =
walther@59976
    38
Specify.find_next_step ptp;
Walther@60556
    39
"~~~~~ fun find_next_step , args:"; val (pt, pos as (_, p_)) = ptp;
Walther@60556
    40
    val {meth = met, origin = origin as (oris, o_refs as (_, pI', mI'), _), probl = pbl,
Walther@60556
    41
      spec = refs, ...} = Calc.specify_data (pt, pos);
Walther@60556
    42
    val ctxt = Ctree.get_ctxt pt pos;
Walther@60556
    43
    (*if*) Ctree.just_created (pt, pos) andalso origin <> Ctree.e_origin (*else*);
Walther@60556
    44
    (*if*) p_ = Pos.Pbl (*then*);
Walther@60556
    45
"~~~~~ from fun find_next_step \<longrightarrow>fun specify_do_next , return:"; val (_, (p_', tac)) =
Walther@60558
    46
        Specify.for_problem_PIDE ctxt oris (o_refs, refs) (pbl, met);
walther@59851
    47
(*\--------- step into Specify_Theory --------------------------------------------------------/*)
walther@59851
    48
walther@59851
    49
(*[], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p''''' ((pt''''', e_pos'), []);(*Specify_Problem ["sqroot-test", "univariate", "equation", "test"*)
walther@59787
    50
(*[], Met*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*Specify_Method ["Test", "squ-equ-test-subpbl1"]*)
walther@59787
    51
(*[1], Frm*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*Apply_Method ["Test", "squ-equ-test-subpbl1"]*)
walther@59787
    52
(*[1], Res*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*Rewrite_Set "norm_equation"*)
walther@60324
    53
(*[2], Res*)val (_, ([(tac, _, _)], _, (pt''''', p'''''))) = Step.do_next p ((pt, e_pos'), []);(*Rewrite_Set "Test_simplify"*)
walther@60324
    54
walther@60324
    55
(*/--------- investigate Rewrite_Set "Test_simplify" -----------------------------------------\*)
walther@60324
    56
(*+*)val form = get_obj g_res pt (fst p);
walther@60324
    57
(*+*)UnparseC.term form = "x + 1 + - 1 * 2 = 0"; (*isa*)
walther@60324
    58
(*+*)UnparseC.term form = "x + 1 + -1 * 2 = 0"; (*isa2*)
walther@60324
    59
walther@60324
    60
val Rewrite_Set "Test_simplify" = tac;
walther@60324
    61
walther@60324
    62
val res = get_obj g_res pt''''' (fst p''''');
walther@60324
    63
(*+* )UnparseC.term res = "1 + (x + - 2) = 0"; ( *isa*)
walther@60324
    64
(*+*)if UnparseC.term res = "- 1 + x = 0" (*isa2*) then () else error "Test_simplify CHANGED";
walther@60324
    65
Walther@60500
    66
val SOME (form', _) = rewrite_set_ ctxt true Test_simplify form;
walther@60324
    67
walther@60324
    68
(*+* )UnparseC.term form' = "1 + (x + - 2) = 0"; ( *isa*)
walther@60324
    69
(*+*)if UnparseC.term form' = "- 1 + x = 0" (*isa2*) then () else error "Test_simplify CHANGED";
walther@60324
    70
(*\--------- investigate Rewrite_Set "Test_simplify" -----------------------------------------/*)
walther@60324
    71
(*[3], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p''''' ((pt''''', e_pos'), []);(* Subproblem ("Test", ["LINEAR", "univariate", "equation", "test"])*)
walther@59787
    72
(*[3], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*Model_Problem*)
walther@59787
    73
(*[3], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*Specify_Theory "Test"*)
walther@60324
    74
walther@59787
    75
(*[3], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*Specify_Problem ["LINEAR", "univariate", "equation", "test"]*)
walther@59787
    76
(*[3], Met*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*Specify_Method ["Test", "solve_linear"]*)
walther@59787
    77
(*[3, 1], Frm*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*Apply_Method ["Test", "solve_linear"]*)
walther@59787
    78
(*[3, 1], Res*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*Rewrite_Set_Inst (["(''bdv'', x)"], "isolate_bdv")*)
walther@59851
    79
walther@59851
    80
val  Rewrite_Set_Inst (["(''bdv'', x)"], "isolate_bdv") = tac;
walther@59851
    81
walther@60324
    82
if p = ([3, 1], Res) andalso (get_obj g_res pt (fst p) |> UnparseC.term) = "x = 0 + - 1 * - 1"
walther@59851
    83
then case tac of Rewrite_Set_Inst (["(''bdv'', x)"], "isolate_bdv") => ()
walther@59851
    84
  | _ => error "Minisubplb/200-start-method-NEXT_STEP.sml CHANGED 1"
walther@59851
    85
else error "Minisubplb/200-start-method-NEXT_STEP.sml CHANGED 2"
Walther@60529
    86
Walther@60533
    87
Proof_Context.theory_of (Ctree.get_ctxt pt p); (*"Test"*)