test/Tools/isac/Minisubpbl/530-error-Check_Elementwise.sml
author Walther Neuper <neuper@ist.tugraz.at>
Sat, 21 May 2011 09:40:02 +0200
branchdecompose-isar
changeset 42021 aab0a175688e
child 42387 767debe8a50c
permissions -rw-r--r--
tuned
     1 (* Title: 530-error-Check_Elementwise.sml
     2 Author: Walther Neuper 1105
     3 (c) copyright due to lincense terms.
     4 *)
     5 
     6 "----------- Minisubplb/530-error-Check_Elementwise.sml ----------";
     7 "----------- Minisubplb/530-error-Check_Elementwise.sml ----------";
     8 "----------- Minisubplb/530-error-Check_Elementwise.sml ----------";
     9 val fmz = ["equality (x+1=(2::real))", "solveFor x","solutions L"];
    10 val (dI',pI',mI') =
    11 ("Test", ["sqroot-test","univariate","equation","test"],
    12 ["Test","squ-equ-test-subpbl1"]);
    13 val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    14 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    15 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    16 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    17 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    18 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    19 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    20 val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Apply_Method ["Test", "squ-equ-test-subpbl1"]*)
    21 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    22 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    23 val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Subp ["linear", "univariate", "equation", "test"]*)
    24 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    25 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    26 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    27 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    28 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    29 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    30 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    31 val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Apply_Method ["Test", "solve_linear"]*)
    32 val (p,_,f,nxt,_,pt) = me nxt p'' [] pt''; (*nxt = Rewrite_Set_Inst isolate_bdv*);
    33 get_ctxt pt p |> is_e_ctxt; (*false*)
    34 val ctxt = get_ctxt pt p;
    35 val SOME t = parseNEW ctxt "Check_elementwise [x = 1] {(v_v::real). Assumptions}";
    36 get_loc pt p |> snd |> is_e_ctxt; (*false*)
    37 val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Rewrite_Set "Test_simplify"*);
    38 get_ctxt pt p |> is_e_ctxt; (*false*)
    39 val ctxt = get_ctxt pt p;
    40 val SOME t = parseNEW ctxt "Check_elementwise [x = 1] {(v_v::real). Assumptions}";
    41 get_loc pt p |> snd |> is_e_ctxt; (*false*)
    42 val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Check_Postcond ["linear","univariate", ...]) *);
    43 
    44 val (pt'''', p'''') = (pt, p);
    45 "~~~~~ fun me, args:"; val (_,tac) = nxt;
    46 val (pt, p) = case locatetac tac (pt,p) of
    47 ("ok", (_, _, ptp)) => ptp | _ => error "script.sml locatetac";
    48 show_pt pt; (*...(([3], Res), [x = 1])]... back in root, OK *)
    49 "~~~~~ fun step, args:"; val (ip as (_,p_), (ptp as (pt,p), tacis)) = (p, ((pt, e_pos'), []))
    50 val pIopt = get_pblID (pt,ip); (*= SOME ["sqroot-test", "univariate", ...]*)
    51 tacis; (*= []*)
    52 member op = [Pbl,Met] p_ andalso is_none (get_obj g_env pt (fst p)); (*= false*)
    53 "~~~~~ fun nxt_solve_, args:"; val (ptp as (pt, pos as (p, p_))) = (pt, ip);
    54 val thy' = get_obj g_domID pt (par_pblobj pt p);
    55 val (srls, is, sc) = from_pblobj_or_detail' thy' (p,p_) pt; (*is: which ctxt?*)
    56 "~~~~~ fun next_tac, args:"; val (thy, (ptp as (pt, pos as (p, _)):ptree * pos'), (sc as Script (h $ body)),
    57 (ScrState (E,l,a,v,s,b), ctxt)) = ((thy',srls), (pt,pos), sc, is);
    58 val ctxt = get_ctxt pt pos
    59 val SOME t = parseNEW ctxt "Check_elementwise [x = 1] {(v_v::real). Assumptions}";
    60 l; (*= [R, R, D, L, R]*)
    61 "~~~~~ fun nstep_up, args:"; val (thy, ptp, (Script sc), E, l, ay, a, v) =
    62 (thy, ptp, sc, E, l, Skip_, a, v);
    63 1 < length l; (*true*)
    64 val up = drop_last l;
    65 go up sc; (* = Const ("HOL.Let", *)
    66 "~~~~~ fun nxt_up, args:"; val (thy, ptp, (scr as (Script sc)), E, l, ay,
    67 (t as Const ("HOL.Let",_) $ _), a, v) =
    68 (thy, ptp, (Script sc), E, up, ay, (go up sc), a, v);
    69 ay = Napp_; (*false*)
    70 val up = drop_last l;
    71 val (Const ("HOL.Let",_) $ e $ (Abs (i,T,body))) = go up sc;
    72 val i = mk_Free (i, T);
    73 val E = upd_env E (i, v);
    74 body; (*= Const ("Script.Check'_elementwise"*)
    75 "~~~~~ fun appy, args:"; val ((thy as (th,sr)), (pt, p), E, l, t, a, v)=
    76 (thy, ptp, E, (up@[R,D]), body, a, v);
    77 handle_leaf "next " th sr E a v t; (*= (NONE, STac (Const ("Script.Check'_elementwise"*)
    78 val (a', STac stac) = handle_leaf "next " th sr E a v t;
    79 "~~~~~ fun stac2tac_, args:"; val (pt, thy, (Const("Script.Check'_elementwise",_) $ _ $
    80 (set as Const ("Set.Collect",_) $ Abs (_,_,pred)))) = (pt, (assoc_thy th), stac);
    81 (*2011 changed ^^^^^ *)
    82 val (p,_,f,nxt,_,pt) = me nxt p'''' [] pt''''; (*WAS nxt = ("Empty_Tac", Empty_Tac)*)
    83 if nxt = ("Check_elementwise", Check_elementwise "Assumptions") then ()
    84 else error "Check_elementwise changed; after switch sub-->root-method"