test/Tools/isac/Minisubpbl/150-add-given-Equation.sml
author wneuper <Walther.Neuper@jku.at>
Mon, 01 Jan 2024 11:31:16 +0100
changeset 60789 8fa678b678e8
parent 60726 23ad8297f4ed
permissions -rw-r--r--
Doc/Specify_Phase 4: start use antiquotations from isar-ref
Walther@60726
     1
(* Title:  "Minisubpbl/150-add-given-Equation.sml"
neuper@41986
     2
   Author: Walther Neuper 1105
neuper@41986
     3
   (c) copyright due to lincense terms.
neuper@41986
     4
*)
Walther@60725
     5
open Pos
Walther@60725
     6
open Ctree
Walther@60725
     7
open Tactic
Walther@60725
     8
open Test_Code
neuper@41986
     9
walther@59997
    10
val fmz = ["equality (x+1=(2::real))", "solveFor x", "solutions L"];
neuper@41986
    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'))]; (*nxt = ("Model_Problem"*)
Walther@60725
    15
                                       val Model_Problem = nxt
neuper@52070
    16
Walther@60726
    17
val return_me_Model_Problem =
Walther@60726
    18
           me nxt p [] pt;
Walther@60726
    19
(*/------------------- step into me Model_Problem ------------------------------------------\\*)
Walther@60578
    20
"~~~~~ fun me , args:"; val (tac, (p:Pos.pos'), (_:Test_Code.NEW), (pt:Ctree.ctree)) = (nxt, p, [], pt);
neuper@52070
    21
    val (pt, p) = 
walther@60011
    22
      (*ERROR Specify.item_to_add: types or dsc DO NOT MATCH BETWEEN fmz --- pbt ... see 100-init-rootpbl.sml*)
walther@59804
    23
	    case Step.by_tactic tac (pt,p) of
neuper@52070
    24
		    ("ok", (_, _, ptp)) => ptp;
walther@59839
    25
Walther@60726
    26
val return_do_next = (*case*)
walther@59839
    27
      Step.do_next p ((pt, Pos.e_pos'), []) (*of*);
Walther@60726
    28
(*//------------------ step into do_next ---------------------------------------------------\\*)
walther@59981
    29
"~~~~~ fun do_next , args:"; val (((ip as (_,p_)):pos'), ((ptp as (pt,p), tacis):Calc.state_pre)) =
neuper@52070
    30
  (p, ((pt, e_pos'),[]));
walther@59839
    31
    val pIopt = get_pblID (pt,ip);
walther@59839
    32
    (*if*) ip = ([],Res); (* = false*)
walther@59839
    33
      val _ = (*case*) tacis (*of*);
walther@59839
    34
      val SOME _ = (*case*) pIopt (*of*);
neuper@52070
    35
walther@60021
    36
    val ("ok", ([(Add_Given "equality (x + 1 = 2)", _, _)], [], _)) =
Walther@60589
    37
      Step.switch_specify_solve p_ (pt, ip);
walther@60021
    38
"~~~~~ fun switch_specify_solve , args:"; val (state_pos, (pt, input_pos)) = (p_, (pt, ip));
neuper@52070
    39
walther@60021
    40
      (*if*) Pos.on_specification ([], state_pos) (*then*);
neuper@52070
    41
Walther@60726
    42
    val return_specify_do_next as ("ok", ([(Add_Given "equality (x + 1 = 2)", _, _)], [], _)) =
Walther@60589
    43
      Step.specify_do_next (pt, input_pos);
neuper@52070
    44
walther@60021
    45
(*+ keep for fun specify_do_next \<longrightarrow>fun switch_specify_solve*)val (pt'''''_', input_pos'''''_') =
walther@60021
    46
                           (pt, input_pos);
neuper@52070
    47
Walther@60726
    48
(*///----------------- step into specify_do_next -------------------------------------------\\*)
walther@60021
    49
"~~~~~ fun specify_do_next , args:"; val (ptp as (pt, (p, p_))) = (pt, input_pos);
Walther@60726
    50
    val (_, (p_', tac as Add_Given "equality (x + 1 = 2)")) = Specify.find_next_step ptp
walther@60021
    51
    val ist_ctxt =  Ctree.get_loc pt (p, p_)
Walther@60726
    52
val _ =
Walther@60726
    53
    (*case*) tac (*of*);
walther@60021
    54
walther@60021
    55
    val ("ok", ([(Add_Given "equality (x + 1 = 2)", _, _)], [], _)) =
walther@60021
    56
      Step_Specify.by_tactic_input tac (pt, (p, p_'))  (*return from specify_do_next*);
Walther@60726
    57
(*\\\----------------- step into specify_do_next -------------------------------------------//*)
Walther@60726
    58
(*\\------------------ step into do_next ---------------------------------------------------//*)
Walther@60726
    59
val ("ok", (ts as (_, _, _) :: _, _, (pt, p))) = return_do_next;
Walther@60726
    60
(*|------------------- continue with me_Model_Problem ----------------------------------------*)
Walther@60726
    61
val tacis as (_::_) =
Walther@60726
    62
        (*case*) ts (*of*);
Walther@60726
    63
          val (tac, _, _) = last_elem tacis
walther@60021
    64
Walther@60726
    65
val return_me_Model_Problem =
Walther@60726
    66
      (p, [] : NEW, TESTg_form ctxt (pt, p) (* form output comes from Step.by_tactic *), 
Walther@60726
    67
  	    tac, Celem.Sundef, pt)
Walther@60725
    68
(*\------------------- step into me_Model_Problem ------------------------------------------//*)
Walther@60725
    69
val (p,_,f,nxt,_,pt) = return_me_Model_Problem
Walther@60725
    70
                                       val Add_Given "equality (x + 1 = 2)" = nxt
Walther@60726
    71
Walther@60726
    72
(*ERROR me: uncovered case Step.by_tactic* )
Walther@60725
    73
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val Add_Given "solveFor x" = nxt;
Walther@60726
    74
( *ERROR me: uncovered case Step.by_tactic*)