test/Tools/isac/Minisubpbl/530-error-Check_Elementwise.sml
author wneuper <Walther.Neuper@jku.at>
Mon, 01 Jan 2024 11:31:16 +0100
changeset 60789 8fa678b678e8
parent 60725 25233d8f7019
permissions -rw-r--r--
Doc/Specify_Phase 4: start use antiquotations from isar-ref
Walther@60640
     1
(* Title: "Minisubpbl/530-error-Check_Elementwise.sml"
Walther@60640
     2
   Author: Walther Neuper 1105
Walther@60640
     3
   (c) copyright due to lincense terms.
neuper@42021
     4
*)
neuper@42021
     5
neuper@42021
     6
"----------- Minisubplb/530-error-Check_Elementwise.sml ----------";
neuper@42021
     7
"----------- Minisubplb/530-error-Check_Elementwise.sml ----------";
neuper@42021
     8
"----------- Minisubplb/530-error-Check_Elementwise.sml ----------";
neuper@42394
     9
(*see also --- x / (x ^ 2 - 6 * x + 9) - 1 / (x ^ 2 - 3 * x) = 1 /x" by me ---*)
walther@59997
    10
val fmz = ["equality (x+1=(2::real))", "solveFor x", "solutions L"];
neuper@42021
    11
val (dI',pI',mI') =
walther@59997
    12
("Test", ["sqroot-test", "univariate", "equation", "test"],
walther@59997
    13
["Test", "squ-equ-test-subpbl1"]);
Walther@60571
    14
val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
neuper@42021
    15
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42021
    16
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42021
    17
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42021
    18
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42021
    19
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42021
    20
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
Walther@60725
    21
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val Apply_Method ["Test", "squ-equ-test-subpbl1"] = nxt;
neuper@42021
    22
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42021
    23
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
Walther@60725
    24
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val Subproblem ("Test", ["LINEAR", "univariate", "equation", "test"]) = nxt;
neuper@42021
    25
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42021
    26
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42021
    27
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42021
    28
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42021
    29
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42021
    30
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42021
    31
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
Walther@60725
    32
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val Apply_Method ["Test", "solve_linear"] = nxt;
neuper@42387
    33
Walther@60725
    34
val return_me_Rewrite_Set_Inst = me nxt p [] pt;
Walther@60725
    35
(*//------------------ step into me_Rewrite_Set_Inst ---------------------------------------\\*)
Walther@60725
    36
get_ctxt pt p |> ContextC.is_empty; (*OKfalse*)
neuper@42021
    37
val ctxt = get_ctxt pt p;
Walther@60663
    38
val SOME t = ParseC.term_opt ctxt "Check_elementwise [x = 1] {(v_v::real). Assumptions}";
Walther@60725
    39
get_loc pt p |> snd |> ContextC.is_empty; (**OKfalse*)
Walther@60725
    40
(*\\------------------ step into me_Rewrite_Set_Inst ---------------------------------------//*)
Walther@60725
    41
val (p,_,f,nxt,_,pt) = return_me_Rewrite_Set_Inst;
Walther@60725
    42
                                       val Rewrite_Set_Inst (["(''bdv'', x)"], "isolate_bdv") = nxt;
neuper@42021
    43
Walther@60725
    44
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val Rewrite_Set "Test_simplify" = nxt;
Walther@60725
    45
Walther@60725
    46
(*+*)get_ctxt pt p |> ContextC.is_empty; (*false*)
Walther@60725
    47
(*+*)val ctxt = get_ctxt pt p;
Walther@60725
    48
(*+*)val SOME t = ParseC.term_opt ctxt "Check_elementwise [x = 1] {(v_v::real). Assumptions}";
Walther@60725
    49
(*+*)get_loc pt p |> snd |> ContextC.is_empty; (*false*)
Walther@60725
    50
Walther@60725
    51
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val Check_Postcond ["LINEAR", "univariate", "equation", "test"] = nxt;
Walther@60725
    52
Walther@60725
    53
val return_me_Rewrite_Set = me nxt p [] pt;
Walther@60725
    54
(*//------------------ step into me_Rewrite_Set --------------------------------------------\\*)
Walther@60725
    55
"~~~~~ fun me, args:"; val (tac, p, _(*NEW remove*), pt) = (nxt, p, [], pt);
walther@59804
    56
val (pt, p) = case Step.by_tactic tac (pt,p) of
walther@59804
    57
("ok", (_, _, ptp)) => ptp | _ => error "script.sml Step.by_tactic";
walther@59983
    58
Test_Tool.show_pt pt; (*...(([3], Res), [x = 1])]... back in root, OK *)
walther@59761
    59
"~~~~~ fun do_next, args:"; val (ip as (_,p_), (ptp as (pt,p), tacis)) = (p, ((pt, e_pos'), []))
neuper@42021
    60
val pIopt = get_pblID (pt,ip); (*= SOME ["sqroot-test", "univariate", ...]*)
neuper@42021
    61
tacis; (*= []*)
walther@60017
    62
member op = [Pbl,Met] p_; (*= false*)
walther@59760
    63
"~~~~~ and do_next , args:"; val (ptp as (pt, pos as (p, p_))) = (pt, ip);
walther@60154
    64
    (*if*) MethodC.id_empty = get_obj g_metID pt (par_pblobj pt p) (*else*);
walther@59686
    65
        val thy' = get_obj g_domID pt (par_pblobj pt p);
Walther@60559
    66
	      val ((ist, ctxt), sc) = LItool.resume_prog (p,p_) pt;
walther@59686
    67
walther@59734
    68
    val Next_Step (_, _, Check_elementwise' _) =
walther@59791
    69
       (*case*) LI.find_next_step sc (pt, pos) ist ctxt (*of*);
walther@59772
    70
"~~~~~ fun find_next_step , args:"; val ((Rule.Prog prog), (ptp as (pt, (p, _))), Istate.Pstate ist, ctxt)
walther@59723
    71
  = (sc, (pt, pos), ist, ctxt);
walther@59686
    72
walther@59686
    73
      (*case*)
walther@59769
    74
           scan_to_tactic (prog, (ptp, ctxt)) (Istate.Pstate ist) (*of*);
walther@59769
    75
"~~~~~ fun scan_to_tactic , args:"; val ((prog, cct), (Istate.Pstate (ist as {path, ...})))
walther@59722
    76
  = ((prog, (ptp, ctxt)), (Istate.Pstate ist));
walther@59686
    77
  (*if*) 0 = length path (*else*);
walther@59686
    78
walther@59785
    79
       go_scan_up (prog, cct) (trans_scan_up ist |> set_found);
walther@59784
    80
"~~~~~ and go_scan_up , args:"; val ((yyy as (prog, _)), (ist as {env, path, found_accept, ...}))
walther@59785
    81
  = ((prog, cct), (trans_scan_up ist |> set_found));
walther@59686
    82
    (*if*) 1 < length path (*then*);
walther@59686
    83
Walther@60679
    84
           scan_up yyy (ist |> path_up) (go_up ctxt path prog);
wenzelm@60309
    85
"~~~~~ fun scan_up , args:"; val ((yyy as (prog, xxx)), (ist as {found_accept, ...}), (Const (\<^const_name>\<open>Let\<close>(*1*), _) $ _))
Walther@60679
    86
  = (yyy, (ist |> path_up), (go_up ctxt path prog));
walther@59784
    87
    (*if* ) found_accept = Napp_ ( *else*);
Walther@60611
    88
        val (i, body) = check_Let_up ctxt ist prog;
walther@59686
    89
walther@59686
    90
        (*case*)
walther@59769
    91
           scan_dn xxx (ist |> path_up_down [R, D] |> upd_env i) body (*of*);
walther@59686
    92
    (*========== a leaf has been found ==========*)   
walther@59769
    93
"~~~~~ fun scan_dn , args:"; val (((pt, p), ctxt), (ist as {env, eval, ...}), t)
walther@59698
    94
  = (xxx, (ist |> path_up_down [R, D] |> upd_env i), body);
walther@59721
    95
  val (Program.Tac stac, a') = (*case*)
walther@59772
    96
      check_leaf "next " ctxt eval (get_subst ist) t;
walther@59686
    97
walther@59825
    98
	      val Check_elementwise "Assumptions" =
Walther@60640
    99
    LItool.tac_from_prog (pt, p) stac;
walther@60336
   100
"~~~~~ fun tac_from_prog , args:"; val (pt, thy, (Const (\<^const_name>\<open>Check_elementwise\<close>, _) $ _ $
wenzelm@60309
   101
    (set as Const (\<^const_name>\<open>Collect\<close>,_) $ Abs (_,_,pred))))
walther@59722
   102
  = (pt, (Proof_Context.theory_of ctxt), stac);
Walther@60725
   103
(*\\------------------ step into me_Rewrite_Set --------------------------------------------//*)
Walther@60725
   104
val (p,_,f,nxt,_,pt) = return_me_Rewrite_Set;
Walther@60725
   105
                                       val Check_elementwise "Assumptions" = nxt;
neuper@42394
   106
Walther@60725
   107
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val Check_Postcond ["sqroot-test", "univariate", "equation", "test"] = nxt;