test/Tools/isac/Minisubpbl/300-init-subpbl-NEXT_STEP.sml
author Walther Neuper <walther.neuper@jku.at>
Tue, 04 Feb 2020 17:11:54 +0100
changeset 59790 a1944acd8dcf
parent 59765 3ac99a5f910b
child 59791 0db869a16f83
permissions -rw-r--r--
lucin: rename central structure to Lucin
walther@59722
     1
(* Title:  "Minisubpbl/300-init-subpbl-NEXT_STEP.sml"
walther@59722
     2
   Author: Walther Neuper 1105
walther@59722
     3
   (c) copyright due to lincense terms.
walther@59722
     4
*)
walther@59722
     5
walther@59722
     6
"----------- Minisubpbl/300-init-subpbl-NEXT_STEP.sml -----------------------------------------";
walther@59722
     7
"----------- Minisubpbl/300-init-subpbl-NEXT_STEP.sml -----------------------------------------";
walther@59722
     8
"----------- Minisubpbl/300-init-subpbl-NEXT_STEP.sml -----------------------------------------";
walther@59722
     9
walther@59722
    10
val fmz = ["equality (x+1=(2::real))", "solveFor x","solutions L"];
walther@59722
    11
val (dI',pI',mI') =
walther@59722
    12
  ("Test", ["sqroot-test","univariate","equation","test"],
walther@59722
    13
   ["Test","squ-equ-test-subpbl1"]);
walther@59722
    14
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59765
    15
(*[], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, Pos.e_pos'), []);(*Model_Problem*)
walther@59765
    16
(*[], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, Pos.e_pos'), []);(*Specify_Theory*)
walther@59765
    17
(*[], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, Pos.e_pos'), []);(*Specify_Problem ["sqroot-test", "univariate", "equation", "test"*)
walther@59765
    18
(*[], Met*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*Specify_Method ["Test", "squ-equ-test-subpbl1"]*)
walther@59765
    19
(*[1], Frm*)val (_, ([(tac''''', _, _)], _, (pt''''', p'''))) =(**) Step.do_next p ((pt, e_pos'), []);(*Apply_Method ["Test", "squ-equ-test-subpbl1"]*)
walther@59722
    20
walther@59722
    21
"~~~~~ fun step , args:"; val ((ip as (_, p_)), (ptp as (pt,p), tacis)) = (p ,((pt, e_pos'), []));
walther@59722
    22
    val pIopt = get_pblID (pt,ip);
walther@59722
    23
    (*if*) ip = ([], Pos.Res) (*else*);
walther@59722
    24
      val _ = (*case*) tacis (*of*);
walther@59722
    25
      val SOME _ = (*case*) pIopt (*of*);
walther@59722
    26
    (*if*) member op = [Pos.Pbl, Pos.Met] p_ 
walther@59722
    27
  	                    andalso is_none (Ctree.get_obj Ctree.g_env pt (fst p)) (*then*);
walther@59722
    28
walther@59762
    29
(*+*)val (_, ([_], _, (pt''''', p'''''))) =
walther@59764
    30
           Step.specify_do_next (pt, ip);
walther@59722
    31
"~~~~~ fun nxt_specify_ , args:"; val ((ptp as (pt, (p, p_)))) = (pt, ip);
walther@59722
    32
    val (pblobj, meth, origin, oris, dI', pI', mI', probl, dI, pI, mI) = 
walther@59722
    33
  	  case Ctree.get_obj I pt p of
walther@59722
    34
  	    pblobj as (Ctree.PblObj {meth, origin = origin as (oris, (dI', pI', mI'), _),
walther@59722
    35
  		  probl, spec = (dI, pI, mI), ...}) => (pblobj, meth, origin, oris, dI', pI', mI', probl, dI, pI, mI)
walther@59722
    36
      | Ctree.PrfObj _ => error "nxt_specify_: not on PrfObj";
walther@59722
    37
walther@59722
    38
   (*if*) Ctree.just_created_ pblobj (*by Subproblem*) andalso origin <> Ctree.e_origin (*else*);
walther@59722
    39
        val cpI = if pI = Celem.e_pblID then pI' else pI;
walther@59722
    40
  	    val cmI = if mI = Celem.e_metID then mI' else mI;
walther@59722
    41
  	    val {ppc, prls, where_, ...} = Specify.get_pbt cpI;
walther@59722
    42
  	    val pre = Stool.check_preconds "thy 100820" prls where_ probl;
walther@59722
    43
  	    val pb = foldl and_ (true, map fst pre);
walther@59722
    44
  	    val (_, tac) =
walther@59722
    45
  	      Chead.nxt_spec p_ pb oris (dI', pI', mI') (probl, meth) (ppc, (#ppc o Specify.get_met) cmI) (dI, pI, mI)
walther@59722
    46
        val ist_ctxt =  get_loc pt (p, p_)
walther@59722
    47
walther@59722
    48
        val Apply_Method mI = (*case*) tac (*of*);
walther@59762
    49
(*+*)val (_, (_, _, (pt'''', p''''))) =
walther@59790
    50
           Lucin.by_tactic (Tactic.Apply_Method' (mI, NONE, Istate.e_istate, ContextC.e_ctxt)) ist_ctxt ptp;
walther@59722
    51
"~~~~~ fun begin_end_prog , args:"; val ((Tactic.Apply_Method' (mI, _, _, _)), (ist, ctxt), (pt, pos as (p, _)))
walther@59722
    52
  = ((Tactic.Apply_Method' (mI, NONE, Istate.e_istate, ContextC.e_ctxt)), ist_ctxt, ptp);
walther@59722
    53
      val {ppc, ...} = Specify.get_met mI;
walther@59722
    54
      val (itms, oris, probl) = case get_obj I pt p of
walther@59722
    55
        PblObj {meth = itms, origin = (oris, _, _), probl, ...} => (itms, oris, probl)
walther@59722
    56
      | _ => error "begin_end_prog Apply_Method': uncovered case get_obj"
walther@59722
    57
      val itms = if itms <> [] then itms else Chead.complete_metitms oris probl [] ppc
walther@59722
    58
      val thy' = get_obj g_domID pt p;
walther@59722
    59
      val thy = Celem.assoc_thy thy';
walther@59790
    60
      val srls = LItool.get_simplifier (pt, pos);
walther@59722
    61
walther@59722
    62
  (*if*) mI = ["Biegelinien", "ausBelastung"] (*else*);
walther@59790
    63
     val (is, env, ctxt, scr) = case LItool.init_pstate srls ctxt itms mI of
walther@59722
    64
         (is as Istate.Pstate {env, ...}, ctxt, scr) => (is, env, ctxt, scr)
walther@59722
    65
       | _ => error "begin_end_prog Apply_Method': uncovered case init_pstate"
walther@59722
    66
walther@59722
    67
walther@59765
    68
(*[1], Res*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p''''' ((pt''''', e_pos'), []);(*Rewrite_Set "norm_equation"*)
walther@59722
    69
case tac of Rewrite_Set "norm_equation" => (
walther@59722
    70
  if p = ([1], Res) then (
walther@59722
    71
    if pr_ctree pr_short pt = ".    ----- pblobj -----\n1.   x + 1 = 2\n" then ()
walther@59722
    72
    else error "Apply_Method [Test, squ-equ-test-subpbl1] changed pt"
walther@59722
    73
    ) else error "Apply_Method [Test, squ-equ-test-subpbl1] changed p") 
walther@59722
    74
| _ => error "Apply_Method [Test, squ-equ-test-subpbl1] changed tac"