followup 6a: tests run from @{context} without sessions
authorwneuper <Walther.Neuper@jku.at>
Thu, 20 Oct 2022 10:23:38 +0200
changeset 6057119a172de0bb5
parent 60570 44f83099227d
child 60572 5bbcda519d27
followup 6a: tests run from @{context} without sessions
TODO.md
src/Tools/isac/BaseDefinitions/theoryC.sml
src/Tools/isac/BridgeLibisabelle/interface.sml
src/Tools/isac/Build_Isac.thy
src/Tools/isac/Test_Code/Test_Code.thy
src/Tools/isac/Test_Code/test-code.sml
test/Pure/PIDE/xml.ML
test/Tools/isac/ADDTESTS/All_Ctxt.thy
test/Tools/isac/ADDTESTS/course/CADGME/example_1.thy
test/Tools/isac/ADDTESTS/course/SignalProcess/Build_Inverse_Z_Transform.thy
test/Tools/isac/ADDTESTS/course/SignalProcess/document/Build_Inverse_Z_Transform.tex
test/Tools/isac/ADDTESTS/course/phst11/T3_MathEngine.thy
test/Tools/isac/BaseDefinitions/contextC.sml
test/Tools/isac/BridgeJEdit/vscode-example.sml
test/Tools/isac/BridgeLibisabelle/interface.sml
test/Tools/isac/BridgeLibisabelle/thy-present.sml
test/Tools/isac/BridgeLibisabelle/use-cases.sml
test/Tools/isac/Interpret/error-pattern.sml
test/Tools/isac/Interpret/li-tool.sml
test/Tools/isac/Interpret/lucas-interpreter.sml
test/Tools/isac/Interpret/step-solve.sml
test/Tools/isac/Interpret/sub-problem.sml
test/Tools/isac/Knowledge/algein.sml
test/Tools/isac/Knowledge/biegelinie-1.sml
test/Tools/isac/Knowledge/biegelinie-2.sml
test/Tools/isac/Knowledge/biegelinie-3.sml
test/Tools/isac/Knowledge/biegelinie-4.sml
test/Tools/isac/Knowledge/diff-app.sml
test/Tools/isac/Knowledge/diff.sml
test/Tools/isac/Knowledge/diophanteq.sml
test/Tools/isac/Knowledge/eqsystem-1.sml
test/Tools/isac/Knowledge/eqsystem-1a.sml
test/Tools/isac/Knowledge/eqsystem-2.sml
test/Tools/isac/Knowledge/equation.sml
test/Tools/isac/Knowledge/inssort.sml
test/Tools/isac/Knowledge/integrate.sml
test/Tools/isac/Knowledge/inverse_z_transform.sml
test/Tools/isac/Knowledge/logexp.sml
test/Tools/isac/Knowledge/partial_fractions.sml
test/Tools/isac/Knowledge/poly-2.sml
test/Tools/isac/Knowledge/polyeq-1.sml
test/Tools/isac/Knowledge/polyeq-2.sml
test/Tools/isac/Knowledge/polyminus.sml
test/Tools/isac/Knowledge/rateq.sml
test/Tools/isac/Knowledge/rational-2.sml
test/Tools/isac/Knowledge/rlang.sml
test/Tools/isac/Knowledge/rooteq.sml
test/Tools/isac/Knowledge/rootrateq.sml
test/Tools/isac/Knowledge/simplify.sml
test/Tools/isac/Knowledge/system.sml
test/Tools/isac/MathEngBasic/ctree.sml
test/Tools/isac/MathEngine/detail-step.sml
test/Tools/isac/MathEngine/mathengine-stateless.sml
test/Tools/isac/MathEngine/me-misc.sml
test/Tools/isac/MathEngine/solve.sml
test/Tools/isac/MathEngine/states.sml
test/Tools/isac/MathEngine/step.sml
test/Tools/isac/Minisubpbl/100-init-rootpbl.sml
test/Tools/isac/Minisubpbl/150-add-given.sml
test/Tools/isac/Minisubpbl/200-start-method-NEXT_STEP.sml
test/Tools/isac/Minisubpbl/200-start-method.sml
test/Tools/isac/Minisubpbl/250-Rewrite_Set-from-method.sml
test/Tools/isac/Minisubpbl/300-init-subpbl-NEXT_STEP.sml
test/Tools/isac/Minisubpbl/300-init-subpbl.sml
test/Tools/isac/Minisubpbl/400-start-meth-subpbl.sml
test/Tools/isac/Minisubpbl/450-Rewrite_Set_Inst.sml
test/Tools/isac/Minisubpbl/470-Check_elementwise-NEXT_STEP.sml
test/Tools/isac/Minisubpbl/490-nxt-Check_Postcond.sml
test/Tools/isac/Minisubpbl/500-met-sub-to-root.sml
test/Tools/isac/Minisubpbl/530-error-Check_Elementwise.sml
test/Tools/isac/Minisubpbl/600-postcond-NEXT_STEP.sml
test/Tools/isac/Minisubpbl/600-postcond.sml
test/Tools/isac/Minisubpbl/700-interSteps.sml
test/Tools/isac/Minisubpbl/710-interSteps-short.sml
test/Tools/isac/Minisubpbl/790-complete-NEXT_STEP.sml
test/Tools/isac/Minisubpbl/790-complete.sml
test/Tools/isac/Minisubpbl/800-append-on-Frm.sml
test/Tools/isac/OLDTESTS/root-equ.sml
test/Tools/isac/OLDTESTS/script.sml
test/Tools/isac/OLDTESTS/script_if.sml
test/Tools/isac/OLDTESTS/subp-rooteq.sml
test/Tools/isac/OLDTESTS/tacis.sml
test/Tools/isac/ProgLang/auto_prog.sml
test/Tools/isac/ProgLang/evaluate.sml
test/Tools/isac/Specify/cas-command.sml
test/Tools/isac/Specify/i-model.sml
test/Tools/isac/Specify/o-model.sml
test/Tools/isac/Specify/refine.sml
test/Tools/isac/Specify/specify.sml
test/Tools/isac/Specify/step-specify.sml
test/Tools/isac/Test_Code/test-code.sml
test/Tools/isac/Test_Isac.thy
test/Tools/isac/Test_Isac_Short.thy
test/Tools/isac/Test_Some.thy
test/Tools/isac/Test_Theory.thy
     1.1 --- a/TODO.md	Wed Oct 19 15:39:15 2022 +0200
     1.2 +++ b/TODO.md	Thu Oct 20 10:23:38 2022 +0200
     1.3 @@ -62,8 +62,7 @@
     1.4  
     1.5  ***** priority of WN items is top down, most urgent/simple on top
     1.6  
     1.7 -* WN: follow up 6: ctxt_user at init Example mimiced by CalcTreeTest @{context}
     1.8 -                   Thus eliminate use of Thy_Info.get_theory
     1.9 +* WN: follow up 6: eliminate use of Thy_Info.get_theory
    1.10        follow up 7: ANSWER: represent items, which have not yet been input IN VSCode_Example.thy WITH "__"
    1.11  
    1.12  * WN: Sub_Problem.tac_from_prog: use ctxt from pt
     2.1 --- a/src/Tools/isac/BaseDefinitions/theoryC.sml	Wed Oct 19 15:39:15 2022 +0200
     2.2 +++ b/src/Tools/isac/BaseDefinitions/theoryC.sml	Thu Oct 20 10:23:38 2022 +0200
     2.3 @@ -15,6 +15,7 @@
     2.4    val session_specify_names: id list
     2.5    val session_interpret_names: id list
     2.6    val get_theory: id -> theory         (* restricted to Isac_Knowledge *)
     2.7 +  val get_theory_PIDE: Proof.context -> id -> theory
     2.8    val id_to_ctxt: id -> Proof.context
     2.9  
    2.10    val id_empty: id
    2.11 @@ -49,6 +50,14 @@
    2.12    else if member op = session_interpret_names thyID
    2.13    then Thy_Info.get_theory ("Interpret." ^ thyID)
    2.14    else Thy_Info.get_theory ("Isac." ^ thyID);
    2.15 +fun get_theory_PIDE ctxt thy_id =
    2.16 +  let
    2.17 +    val known_thys = Theory.nodes_of (Proof_Context.theory_of ctxt)
    2.18 +  in 
    2.19 +    (find_first (fn thy => Context.theory_name thy = thy_id) known_thys
    2.20 +      |> the)
    2.21 +    handle Option.Option => raise ERROR ("get_theory fails with " ^ quote thy_id)
    2.22 +  end
    2.23  fun get_theory thy =   
    2.24      if thy = id_empty
    2.25      then (get_thy "Base_Tools") (*lower bound of Knowledge*)
     3.1 --- a/src/Tools/isac/BridgeLibisabelle/interface.sml	Wed Oct 19 15:39:15 2022 +0200
     3.2 +++ b/src/Tools/isac/BridgeLibisabelle/interface.sml	Thu Oct 20 10:23:38 2022 +0200
     3.3 @@ -11,7 +11,7 @@
     3.4      val appendFormula : States.calcID -> TermC.as_string -> XML.tree (*unit future*)
     3.5      val autoCalculate : States.calcID -> Solve.auto -> XML.tree (*unit future*)
     3.6      val applyTactic : States.calcID -> Pos.pos' -> Tactic.input -> XML.tree
     3.7 -    val CalcTree : Formalise.T list -> XML.tree
     3.8 +    val CalcTree : Proof.context ->Formalise.T list -> XML.tree
     3.9      val DEconstrCalcTree : States.calcID -> XML.tree
    3.10      val fetchApplicableTactics : States.calcID -> int -> Pos.pos' -> XML.tree
    3.11      val fetchProposedTactic : States.calcID -> XML.tree
    3.12 @@ -75,18 +75,18 @@
    3.13  fun IteratorTEST cI = States.add_user cI;
    3.14  
    3.15  (* create a calc-tree; compare "fun CalcTreeTEST" *)
    3.16 -fun CalcTree [(model, refs as (thy_id, _, _))] (*for several variants lateron*) =
    3.17 +fun CalcTree ctxt [(model, refs as (thy_id, _, _))] =
    3.18     (case \<^try>\<open>
    3.19 -    	let
    3.20 -          val ctxt = thy_id |> ThyC.get_theory |> Proof_Context.init_global; (*will become an argument*)
    3.21 +    	  let
    3.22 +          val ctxt = thy_id |> ThyC.get_theory_PIDE ctxt |> Proof_Context.init_global
    3.23      	    val cs = Step_Specify.nxt_specify_init_calc ctxt (model, refs)
    3.24      	    val cI = States.add_calc cs (*FIXME.WN.8.03: error-handling missing*)
    3.25      	   in calctreeOK2xml cI end
    3.26        \<close> of
    3.27        SOME xml => xml
    3.28      | NONE => sysERROR2xml 0 "error in kernel 2")
    3.29 -	| CalcTree [] = raise ERROR "CalcTree: called with []"
    3.30 -	| CalcTree _ = raise ERROR "CalcTree: undef.case in fun.def"
    3.31 +	| CalcTree _ [] = raise ERROR "CalcTree: called with []"
    3.32 +	| CalcTree _ _ = raise ERROR "CalcTree: undef.case in fun.def"
    3.33  
    3.34  fun DEconstrCalcTree cI = deconstructcalctreeOK2xml (States.del_calc cI);
    3.35  fun getActiveFormula cI = iteratorOK2xml cI (States.get_pos cI 1);
     4.1 --- a/src/Tools/isac/Build_Isac.thy	Wed Oct 19 15:39:15 2022 +0200
     4.2 +++ b/src/Tools/isac/Build_Isac.thy	Thu Oct 20 10:23:38 2022 +0200
     4.3 @@ -165,6 +165,21 @@
     4.4  ML \<open>
     4.5  \<close> ML \<open>
     4.6  \<close> ML \<open>
     4.7 +\<close> ML \<open> (*\<longrightarrow> ThyC*)
     4.8 +fun get_theory_PIDE ctxt thy_id =
     4.9 +  let
    4.10 +    val known_thys = Theory.nodes_of (Proof_Context.theory_of ctxt)
    4.11 +  in 
    4.12 +    (find_first (fn thy => Context.theory_name thy = thy_id) known_thys
    4.13 +      |> the)
    4.14 +    handle Option.Option => raise ERROR ("get_theory fails with " ^ quote thy_id)
    4.15 +  end
    4.16 +\<close> ML \<open>
    4.17 +get_theory_PIDE: Proof.context -> ThyC.id -> theory
    4.18 +\<close> ML \<open>
    4.19 +the
    4.20 +\<close> ML \<open>
    4.21 +\<close> ML \<open>
    4.22  \<close> 
    4.23  
    4.24  text \<open>
     5.1 --- a/src/Tools/isac/Test_Code/Test_Code.thy	Wed Oct 19 15:39:15 2022 +0200
     5.2 +++ b/src/Tools/isac/Test_Code/Test_Code.thy	Thu Oct 20 10:23:38 2022 +0200
     5.3 @@ -14,6 +14,7 @@
     5.4  
     5.5  ML \<open>
     5.6  \<close> ML \<open>
     5.7 +ThyC.get_theory_PIDE
     5.8  \<close> ML \<open>
     5.9  \<close>
    5.10  end
     6.1 --- a/src/Tools/isac/Test_Code/test-code.sml	Wed Oct 19 15:39:15 2022 +0200
     6.2 +++ b/src/Tools/isac/Test_Code/test-code.sml	Thu Oct 20 10:23:38 2022 +0200
     6.3 @@ -10,7 +10,7 @@
     6.4    val f2str : Test_Out.mout -> TermC.as_string
     6.5    val TESTg_form : Calc.T -> Test_Out.mout
     6.6  
     6.7 -  val CalcTreeTEST : Formalise.T list -> Pos.pos' * NEW * Test_Out.mout * Tactic.input * Celem.safe * Ctree.ctree
     6.8 +  val init_calc : Proof.context -> Formalise.T list -> Pos.pos' * NEW * Test_Out.mout * Tactic.input * Celem.safe * Ctree.ctree
     6.9    val me : Tactic.input -> Pos.pos' -> NEW -> Ctree.ctree ->
    6.10      Pos.pos' * NEW * Test_Out.mout * Tactic.input * Celem.safe * Ctree.ctree
    6.11  
    6.12 @@ -18,7 +18,7 @@
    6.13    val me_trace: Calc.T -> Tactic.input -> (Calc.T -> Tactic.input -> unit) ->
    6.14      Calc.T * Tactic.input * Test_Out.mout
    6.15  
    6.16 -  val CalcTreeTEST': Formalise.T list -> Tactic.input * Calc.T
    6.17 +  val init_calc': Proof.context -> Formalise.T list -> Tactic.input * Calc.T
    6.18    val me': Tactic.input * Calc.T -> Tactic.input * Calc.T
    6.19  
    6.20    val tac2tac_ : Ctree.ctree -> Pos.pos' -> Tactic.input -> Tactic.T
    6.21 @@ -55,14 +55,14 @@
    6.22    | f2str _ = raise ERROR "f2str: uncovered case in fun.def.";                           
    6.23  
    6.24  (* create a calc-tree *)
    6.25 -fun CalcTreeTEST [(model, refs as (thy_id, _, _))] =
    6.26 +fun init_calc ctxt [(model, refs as (thy_id, _, _))] =
    6.27    let
    6.28 -    val ctxt = thy_id |> ThyC.get_theory |> Proof_Context.init_global; (*will become an argument*)
    6.29 +    val ctxt = thy_id |> ThyC.get_theory_PIDE ctxt |> Proof_Context.init_global
    6.30      val ((pt, p), tacis) = Step_Specify.nxt_specify_init_calc ctxt (model, refs)
    6.31  	  val tac = case tacis of [] => Tactic.Empty_Tac | _ => (#1 o hd) tacis
    6.32  	  val f = TESTg_form (pt,p)
    6.33    in (p, []:NEW, f, tac, Celem.Sundef, pt) end
    6.34 -| CalcTreeTEST _ = raise ERROR "CalcTreeTEST: uncovered case"
    6.35 +| init_calc _ _ = raise ERROR "Tess_Code.init_calc: uncovered case"
    6.36         
    6.37  fun me (*(Empty_Tac) p _ _ = raise ERROR ("me:  Empty_Tac at " ^ pos'2str p)
    6.38    | me*) tac p _(*NEW remove*) pt =
    6.39 @@ -171,14 +171,14 @@
    6.40  
    6.41  
    6.42  (** me' for |> **)
    6.43 -fun CalcTreeTEST' [(model, refs as (thy_id, _, _))] =
    6.44 +fun init_calc' ctxt [(model, refs as (thy_id, _, _))] =
    6.45    let
    6.46 -    val ctxt = thy_id |> ThyC.get_theory |> Proof_Context.init_global; (*will become an argument*)
    6.47 +    val ctxt = thy_id |> ThyC.get_theory_PIDE ctxt |> Proof_Context.init_global
    6.48      val ((pt, p), _) = Step_Specify.nxt_specify_init_calc ctxt (model, refs)
    6.49    in
    6.50      (Tactic.Model_Problem, (pt, p))                       (* thus <Output> shows Tactic on top *)
    6.51    end
    6.52 -| CalcTreeTEST' _ = raise ERROR "CalcTreeTEST': uncovered case"
    6.53 +| init_calc' _ _ = raise ERROR "Test_Code.init_calc' @{context}: uncovered case"
    6.54  
    6.55  fun me' (tac, (pt, p)) =                                  (* thus <Output> shows Tactic on top *)
    6.56    let 
     7.1 --- a/test/Pure/PIDE/xml.ML	Wed Oct 19 15:39:15 2022 +0200
     7.2 +++ b/test/Pure/PIDE/xml.ML	Thu Oct 20 10:23:38 2022 +0200
     7.3 @@ -19,7 +19,7 @@
     7.4  #I: Formalization
     7.5      isac-java/src/java/isac/util/Formalization.java
     7.6  #O: int
     7.7 -ML {* CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"],("Test",["sqroot-test","univariate","equation","test"],["Test","squ-equ-test-subpbl1"]))]; * }
     7.8 +ML {* CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"],("Test",["sqroot-test","univariate","equation","test"],["Test","squ-equ-test-subpbl1"]))]; * }
     7.9  *)
    7.10  val calcid = 111
    7.11  val result =
     8.1 --- a/test/Tools/isac/ADDTESTS/All_Ctxt.thy	Wed Oct 19 15:39:15 2022 +0200
     8.2 +++ b/test/Tools/isac/ADDTESTS/All_Ctxt.thy	Thu Oct 20 10:23:38 2022 +0200
     8.3 @@ -19,7 +19,7 @@
     8.4      ("Test", ["sqroot-test", "univariate", "equation", "test"],
     8.5       ["Test", "squ-equ-test-subpbl1"]);
     8.6  \<close> ML \<open>
     8.7 -  val (p,_,f,nxt,_,pt) = Test_Code.CalcTreeTEST [(fmz, (dI',pI',mI'))];
     8.8 +  val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
     8.9  \<close>
    8.10  
    8.11  section \<open>start of specify phase\<close>
     9.1 --- a/test/Tools/isac/ADDTESTS/course/CADGME/example_1.thy	Wed Oct 19 15:39:15 2022 +0200
     9.2 +++ b/test/Tools/isac/ADDTESTS/course/CADGME/example_1.thy	Thu Oct 20 10:23:38 2022 +0200
     9.3 @@ -18,7 +18,7 @@
     9.4  text \<open>Step through the Calculation\<close>
     9.5  
     9.6  ML \<open>
     9.7 -  val (p,_,f,nxt,_,pt) = CalcTreeTEST [(expr, (dI',pI',mI'))];
     9.8 +  val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(expr, (dI',pI',mI'))];
     9.9    val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    9.10    val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    9.11    val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    10.1 --- a/test/Tools/isac/ADDTESTS/course/SignalProcess/Build_Inverse_Z_Transform.thy	Wed Oct 19 15:39:15 2022 +0200
    10.2 +++ b/test/Tools/isac/ADDTESTS/course/SignalProcess/Build_Inverse_Z_Transform.thy	Thu Oct 20 10:23:38 2022 +0200
    10.3 @@ -303,7 +303,7 @@
    10.4          use of a so called calc tree seen downwards.\<close>
    10.5  
    10.6  ML \<open>
    10.7 -  val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    10.8 +  val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    10.9    val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   10.10    val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   10.11    val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   10.12 @@ -748,7 +748,7 @@
   10.13     * Solve the simple linear equation for A:
   10.14     * Return eq, not list of eq's
   10.15     *)
   10.16 -  val (p,_,fa,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   10.17 +  val (p,_,fa,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   10.18    val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
   10.19      (*Add_Given "equality (3=3*A/4)"*)
   10.20    val (p,_,fa,nxt,_,pt) = me nxt p [] pt;
   10.21 @@ -824,7 +824,7 @@
   10.22  
   10.23    val fmz = ["equality (3= -3*B/(4::real))", "solveFor B", "solutions L"];
   10.24    val (dI',pI',mI') =("Isac_Knowledge", ["univariate", "equation"], ["no_met"]);
   10.25 -  val (p,_,fb,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   10.26 +  val (p,_,fb,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   10.27    val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
   10.28    val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
   10.29    val (p,_,fb,nxt,_,pt) = me nxt p [] pt;
   10.30 @@ -1258,7 +1258,7 @@
   10.31      ("Isac_Knowledge", ["Inverse", "Z_Transform", "SignalProcessing"], 
   10.32               ["SignalProcessing", "Z_Transform", "Inverse"]);
   10.33               
   10.34 -  val (p,_,f,nxt,_,pt)  = CalcTreeTEST [(fmz, (dI,pI,mI))];
   10.35 +  val (p,_,f,nxt,_,pt)  = Test_Code.init_calc @{context} [(fmz, (dI,pI,mI))];
   10.36    val (p,_,f,nxt,_,pt) = me nxt p [] pt; 
   10.37      "Add_Given";
   10.38    val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    11.1 --- a/test/Tools/isac/ADDTESTS/course/SignalProcess/document/Build_Inverse_Z_Transform.tex	Wed Oct 19 15:39:15 2022 +0200
    11.2 +++ b/test/Tools/isac/ADDTESTS/course/SignalProcess/document/Build_Inverse_Z_Transform.tex	Thu Oct 20 10:23:38 2022 +0200
    11.3 @@ -707,7 +707,7 @@
    11.4  \isatagML
    11.5  \isacommand{ML}\isamarkupfalse%
    11.6  \ {\isaliteral{7B2A}{\isacharverbatimopen}}\isanewline
    11.7 -\ \ val\ {\isaliteral{28}{\isacharparenleft}}p{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}f{\isaliteral{2C}{\isacharcomma}}nxt{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}pt{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ CalcTreeTEST\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{28}{\isacharparenleft}}fmz{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{28}{\isacharparenleft}}dI{\isaliteral{27}{\isacharprime}}{\isaliteral{2C}{\isacharcomma}}pI{\isaliteral{27}{\isacharprime}}{\isaliteral{2C}{\isacharcomma}}mI{\isaliteral{27}{\isacharprime}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{3B}{\isacharsemicolon}}\isanewline
    11.8 +\ \ val\ {\isaliteral{28}{\isacharparenleft}}p{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}f{\isaliteral{2C}{\isacharcomma}}nxt{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}pt{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ Test_Code.init_calc @{context}\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{28}{\isacharparenleft}}fmz{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{28}{\isacharparenleft}}dI{\isaliteral{27}{\isacharprime}}{\isaliteral{2C}{\isacharcomma}}pI{\isaliteral{27}{\isacharprime}}{\isaliteral{2C}{\isacharcomma}}mI{\isaliteral{27}{\isacharprime}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{3B}{\isacharsemicolon}}\isanewline
    11.9  \ \ val\ {\isaliteral{28}{\isacharparenleft}}p{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}f{\isaliteral{2C}{\isacharcomma}}nxt{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}pt{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ me\ nxt\ p\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{5D}{\isacharbrackright}}\ pt{\isaliteral{3B}{\isacharsemicolon}}\isanewline
   11.10  \ \ val\ {\isaliteral{28}{\isacharparenleft}}p{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}f{\isaliteral{2C}{\isacharcomma}}nxt{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}pt{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ me\ nxt\ p\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{5D}{\isacharbrackright}}\ pt{\isaliteral{3B}{\isacharsemicolon}}\isanewline
   11.11  \ \ val\ {\isaliteral{28}{\isacharparenleft}}p{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}f{\isaliteral{2C}{\isacharcomma}}nxt{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}pt{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ me\ nxt\ p\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{5D}{\isacharbrackright}}\ pt{\isaliteral{3B}{\isacharsemicolon}}\isanewline
   11.12 @@ -1470,7 +1470,7 @@
   11.13  \ \ \ {\isaliteral{2A}{\isacharasterisk}}\ Solve\ the\ simple\ linear\ equation\ for\ A{\isaliteral{3A}{\isacharcolon}}\isanewline
   11.14  \ \ \ {\isaliteral{2A}{\isacharasterisk}}\ Return\ eq{\isaliteral{2C}{\isacharcomma}}\ not\ list\ of\ eq{\isaliteral{27}{\isacharprime}}s\isanewline
   11.15  \ \ \ {\isaliteral{2A}{\isacharasterisk}}{\isaliteral{29}{\isacharparenright}}\isanewline
   11.16 -\ \ val\ {\isaliteral{28}{\isacharparenleft}}p{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}fa{\isaliteral{2C}{\isacharcomma}}nxt{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}pt{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ CalcTreeTEST\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{28}{\isacharparenleft}}fmz{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{28}{\isacharparenleft}}dI{\isaliteral{27}{\isacharprime}}{\isaliteral{2C}{\isacharcomma}}pI{\isaliteral{27}{\isacharprime}}{\isaliteral{2C}{\isacharcomma}}mI{\isaliteral{27}{\isacharprime}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{3B}{\isacharsemicolon}}\isanewline
   11.17 +\ \ val\ {\isaliteral{28}{\isacharparenleft}}p{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}fa{\isaliteral{2C}{\isacharcomma}}nxt{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}pt{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ Test_Code.init_calc @{context}\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{28}{\isacharparenleft}}fmz{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{28}{\isacharparenleft}}dI{\isaliteral{27}{\isacharprime}}{\isaliteral{2C}{\isacharcomma}}pI{\isaliteral{27}{\isacharprime}}{\isaliteral{2C}{\isacharcomma}}mI{\isaliteral{27}{\isacharprime}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{3B}{\isacharsemicolon}}\isanewline
   11.18  \ \ val\ {\isaliteral{28}{\isacharparenleft}}p{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}fa{\isaliteral{2C}{\isacharcomma}}nxt{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}pt{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ me\ nxt\ p\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{5D}{\isacharbrackright}}\ pt{\isaliteral{3B}{\isacharsemicolon}}\isanewline
   11.19  \ \ \ \ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{2A}{\isacharasterisk}}Add{\isaliteral{5F}{\isacharunderscore}}Given\ {\isaliteral{22}{\isachardoublequote}}equality\ {\isaliteral{28}{\isacharparenleft}}{\isadigit{3}}{\isaliteral{3D}{\isacharequal}}{\isadigit{3}}{\isaliteral{2A}{\isacharasterisk}}A{\isaliteral{2F}{\isacharslash}}{\isadigit{4}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}{\isaliteral{2A}{\isacharasterisk}}{\isaliteral{29}{\isacharparenright}}\isanewline
   11.20  \ \ val\ {\isaliteral{28}{\isacharparenleft}}p{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}fa{\isaliteral{2C}{\isacharcomma}}nxt{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}pt{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ me\ nxt\ p\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{5D}{\isacharbrackright}}\ pt{\isaliteral{3B}{\isacharsemicolon}}\isanewline
   11.21 @@ -1586,7 +1586,7 @@
   11.22  \isanewline
   11.23  \ \ val\ fmz\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{22}{\isachardoublequote}}equality\ {\isaliteral{28}{\isacharparenleft}}{\isadigit{3}}{\isaliteral{3D}{\isacharequal}}\ {\isaliteral{2D}{\isacharminus}}{\isadigit{3}}{\isaliteral{2A}{\isacharasterisk}}B{\isaliteral{2F}{\isacharslash}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{4}}{\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}real{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{22}{\isachardoublequote}}solveFor\ B{\isaliteral{22}{\isachardoublequote}}{\isaliteral{2C}{\isacharcomma}}{\isaliteral{22}{\isachardoublequote}}solutions\ L{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{3B}{\isacharsemicolon}}\isanewline
   11.24  \ \ val\ {\isaliteral{28}{\isacharparenleft}}dI{\isaliteral{27}{\isacharprime}}{\isaliteral{2C}{\isacharcomma}}pI{\isaliteral{27}{\isacharprime}}{\isaliteral{2C}{\isacharcomma}}mI{\isaliteral{27}{\isacharprime}}{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{22}{\isachardoublequote}}Isac{\isaliteral{22}{\isachardoublequote}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{22}{\isachardoublequote}}univariate{\isaliteral{22}{\isachardoublequote}}{\isaliteral{2C}{\isacharcomma}}{\isaliteral{22}{\isachardoublequote}}equation{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{22}{\isachardoublequote}}no{\isaliteral{5F}{\isacharunderscore}}met{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{3B}{\isacharsemicolon}}\isanewline
   11.25 -\ \ val\ {\isaliteral{28}{\isacharparenleft}}p{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}fb{\isaliteral{2C}{\isacharcomma}}nxt{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}pt{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ CalcTreeTEST\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{28}{\isacharparenleft}}fmz{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{28}{\isacharparenleft}}dI{\isaliteral{27}{\isacharprime}}{\isaliteral{2C}{\isacharcomma}}pI{\isaliteral{27}{\isacharprime}}{\isaliteral{2C}{\isacharcomma}}mI{\isaliteral{27}{\isacharprime}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{3B}{\isacharsemicolon}}\isanewline
   11.26 +\ \ val\ {\isaliteral{28}{\isacharparenleft}}p{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}fb{\isaliteral{2C}{\isacharcomma}}nxt{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}pt{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ Test_Code.init_calc @{context}\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{28}{\isacharparenleft}}fmz{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{28}{\isacharparenleft}}dI{\isaliteral{27}{\isacharprime}}{\isaliteral{2C}{\isacharcomma}}pI{\isaliteral{27}{\isacharprime}}{\isaliteral{2C}{\isacharcomma}}mI{\isaliteral{27}{\isacharprime}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{3B}{\isacharsemicolon}}\isanewline
   11.27  \ \ val\ {\isaliteral{28}{\isacharparenleft}}p{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}fb{\isaliteral{2C}{\isacharcomma}}nxt{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}pt{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ me\ nxt\ p\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{5D}{\isacharbrackright}}\ pt{\isaliteral{3B}{\isacharsemicolon}}\isanewline
   11.28  \ \ val\ {\isaliteral{28}{\isacharparenleft}}p{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}fb{\isaliteral{2C}{\isacharcomma}}nxt{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}pt{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ me\ nxt\ p\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{5D}{\isacharbrackright}}\ pt{\isaliteral{3B}{\isacharsemicolon}}\isanewline
   11.29  \ \ val\ {\isaliteral{28}{\isacharparenleft}}p{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}fb{\isaliteral{2C}{\isacharcomma}}nxt{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}pt{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ me\ nxt\ p\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{5D}{\isacharbrackright}}\ pt{\isaliteral{3B}{\isacharsemicolon}}\isanewline
   11.30 @@ -2332,7 +2332,7 @@
   11.31  \ \ \ \ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{22}{\isachardoublequote}}Isac{\isaliteral{22}{\isachardoublequote}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{22}{\isachardoublequote}}inverse{\isaliteral{22}{\isachardoublequote}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{22}{\isachardoublequote}}Z{\isaliteral{5F}{\isacharunderscore}}Transform{\isaliteral{22}{\isachardoublequote}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{22}{\isachardoublequote}}SignalProcessing{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{2C}{\isacharcomma}}\ \isanewline
   11.32  \ \ \ \ \ \ \ \ \ \ \ \ \ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{22}{\isachardoublequote}}SignalProcessing{\isaliteral{22}{\isachardoublequote}}{\isaliteral{2C}{\isacharcomma}}{\isaliteral{22}{\isachardoublequote}}Z{\isaliteral{5F}{\isacharunderscore}}Transform{\isaliteral{22}{\isachardoublequote}}{\isaliteral{2C}{\isacharcomma}}{\isaliteral{22}{\isachardoublequote}}inverse{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{3B}{\isacharsemicolon}}\isanewline
   11.33  \ \ \ \ \ \ \ \ \ \ \ \ \ \isanewline
   11.34 -\ \ val\ {\isaliteral{28}{\isacharparenleft}}p{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}f{\isaliteral{2C}{\isacharcomma}}nxt{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}pt{\isaliteral{29}{\isacharparenright}}\ \ {\isaliteral{3D}{\isacharequal}}\ CalcTreeTEST\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{28}{\isacharparenleft}}fmz{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{28}{\isacharparenleft}}dI{\isaliteral{2C}{\isacharcomma}}pI{\isaliteral{2C}{\isacharcomma}}mI{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{3B}{\isacharsemicolon}}\isanewline
   11.35 +\ \ val\ {\isaliteral{28}{\isacharparenleft}}p{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}f{\isaliteral{2C}{\isacharcomma}}nxt{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}pt{\isaliteral{29}{\isacharparenright}}\ \ {\isaliteral{3D}{\isacharequal}}\ Test_Code.init_calc @{context}\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{28}{\isacharparenleft}}fmz{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{28}{\isacharparenleft}}dI{\isaliteral{2C}{\isacharcomma}}pI{\isaliteral{2C}{\isacharcomma}}mI{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{3B}{\isacharsemicolon}}\isanewline
   11.36  \ \ val\ {\isaliteral{28}{\isacharparenleft}}p{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}f{\isaliteral{2C}{\isacharcomma}}nxt{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}pt{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ me\ nxt\ p\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{5D}{\isacharbrackright}}\ pt{\isaliteral{3B}{\isacharsemicolon}}\ \isanewline
   11.37  \ \ \ \ {\isaliteral{22}{\isachardoublequote}}Add{\isaliteral{5F}{\isacharunderscore}}Given{\isaliteral{22}{\isachardoublequote}}{\isaliteral{3B}{\isacharsemicolon}}\isanewline
   11.38  \ \ val\ {\isaliteral{28}{\isacharparenleft}}p{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}f{\isaliteral{2C}{\isacharcomma}}nxt{\isaliteral{2C}{\isacharcomma}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2C}{\isacharcomma}}pt{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ me\ nxt\ p\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{5D}{\isacharbrackright}}\ pt{\isaliteral{3B}{\isacharsemicolon}}\isanewline
    12.1 --- a/test/Tools/isac/ADDTESTS/course/phst11/T3_MathEngine.thy	Wed Oct 19 15:39:15 2022 +0200
    12.2 +++ b/test/Tools/isac/ADDTESTS/course/phst11/T3_MathEngine.thy	Thu Oct 20 10:23:38 2022 +0200
    12.3 @@ -58,16 +58,16 @@
    12.4    (1) the theory "PolyMinus", (2) the problem ["plus_minus", "polynom", "vereinfachen"]
    12.5    and (3) the method ["simplification", "for_polynomials", "with_minus"].
    12.6  
    12.7 -  So we can start testing the example by calling 'CalcTreeTEST':
    12.8 +  So we can start testing the example by calling 'Test_Code.init_calc @  {context}':
    12.9  \<close>
   12.10  ML \<open>val (p,_,f,nxt,_,pt) = 
   12.11 -      Test_Code.CalcTreeTEST 
   12.12 +      Test_Code.init_calc @{context} 
   12.13          [(["Term (5*e + 6*f - 8*g - 9 - 7*e - 4*f + 10*g + 12)",
   12.14             "normalform N"],
   12.15  	          ("PolyMinus",["plus_minus", "polynom", "vereinfachen"],
   12.16  	           ["simplification", "for_polynomials", "with_minus"]))];
   12.17  \<close>
   12.18 -text \<open>The function 'CalcTreeTEST' returns the following values:
   12.19 +text \<open>The function 'Test_Code.init_calc @  {context}' returns the following values:
   12.20    p:    the position in the calculation
   12.21    f:    the formula produced by this step of calculation.
   12.22          In this case 'f' is an incomplete model of the problem.
   12.23 @@ -75,7 +75,7 @@
   12.24    pt:   the _whole_ calculation in an internal format; the calculation 'pt'
   12.25          will be fed back into the mathematics engine, the function 'me' below,
   12.26          'me' is purely functional, no further data remains in the memory.
   12.27 -        'me' returns the same data as 'CalcTreeTEST'.
   12.28 +        'me' returns the same data as 'Test_Code.init_calc @  {context}'.
   12.29  
   12.30    The first tactic suggested by ISAC is 'Model_Problem', we use this tactic
   12.31    (stored in 'nxt') and enter the 'specification phase'.
   12.32 @@ -142,7 +142,7 @@
   12.33    the formalisation:
   12.34  \<close>
   12.35  ML \<open>val (p,_,f,nxt,_,pt) = 
   12.36 -      Test_Code.CalcTreeTEST 
   12.37 +      Test_Code.init_calc @{context} 
   12.38          [(["Term (1 + 2 + 3)", "normalform N"],
   12.39  	          ("PolyMinus",["plus_minus", "polynom", "vereinfachen"],
   12.40  	           ["simplification", "for_polynomials", "with_minus"]))];
    13.1 --- a/test/Tools/isac/BaseDefinitions/contextC.sml	Wed Oct 19 15:39:15 2022 +0200
    13.2 +++ b/test/Tools/isac/BaseDefinitions/contextC.sml	Thu Oct 20 10:23:38 2022 +0200
    13.3 @@ -144,7 +144,7 @@
    13.4  val fmz = ["equality (x/(x \<up> 2 - 6*x+9) - 1/(x \<up> 2 - 3*x) =1/x)",
    13.5  	   "solveFor x", "solutions L"];
    13.6  val spec = ((** )"RatEq"( **)"PolyEq"(**),["univariate", "equation"],["no_met"]);
    13.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, spec)];                          (* 0. specify-phase *)
    13.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, spec)];                          (* 0. specify-phase *)
    13.9  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   13.10  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   13.11  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    14.1 --- a/test/Tools/isac/BridgeJEdit/vscode-example.sml	Wed Oct 19 15:39:15 2022 +0200
    14.2 +++ b/test/Tools/isac/BridgeJEdit/vscode-example.sml	Thu Oct 20 10:23:38 2022 +0200
    14.3 @@ -37,7 +37,7 @@
    14.4  ("Diff_App", ["univariate_calculus", "Optimisation"], ["Optimisation", "by_univariate_calculus"]);
    14.5  
    14.6  (*/------- start example as usual in tests ---------------------------------------------------* )
    14.7 -val (p,_,f, nxt,_,pt) = CalcTreeTEST [(fmz, refs)];
    14.8 +val (p,_,f, nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, refs)];
    14.9  val ptp = (pt, p);
   14.10  ( *-------- outcomment EITHER above OR below --------------------------------------------------*)
   14.11  case Store.get (KEStore_Elems.get_expls @{theory}) ["Diff_App-No.123a"] ["Diff_App-No.123a"] of
   14.12 @@ -108,7 +108,7 @@
   14.13    = Step.specify_do_next ptp;
   14.14  val ("ok", ([(Specify_Method ["Optimisation", "by_univariate_calculus"], _, _)], _, ptp))
   14.15    = Step.specify_do_next ptp;
   14.16 ----------------------------------------------------------------------- trace from CalcTreeTEST*)
   14.17 +---------------------------------------------------------------------- trace from Test_Code.init_calc @{context}*)
   14.18  
   14.19  (*** stepwise Specification: MethodC model ================================================ ***
   14.20  )
   14.21 @@ -118,7 +118,7 @@
   14.22    = Step.specify_do_next ptp;
   14.23  val ("ok", ([(Add_Given "ErrorBound (\<epsilon> = 0)", _, _)], _, ptp))
   14.24    = Step.specify_do_next ptp;
   14.25 ----------------------------------------------------------------------- trace from CalcTreeTEST*)
   14.26 +---------------------------------------------------------------------- trace from Test_Code.init_calc @{context}*)
   14.27  
   14.28  (*** Specification of Problem and MethodC model is complete =============================== ***)
   14.29  val PblObj {meth, ...} = get_obj I (fst ptp) [];
   14.30 @@ -127,7 +127,7 @@
   14.31    "(1 ,[1, 2, 3] ,true ,#Given ,Cor Constants [r = 7] ,(fixes, [[r = 7]]))]"
   14.32  ) then () else error "ERROR output CHANGED";
   14.33  
   14.34 -(*with CalcTreeTEST* )
   14.35 +(*with Test_Code.init_calc @{context}* )
   14.36  if I_Model.to_string @ {context} meth = "[\n" ^
   14.37    "(1 ,[1, 2, 3] ,true ,#Given ,Cor Constants [r = 7] ,(fixes, [[r = 7]])), \n" ^
   14.38    "(2 ,[1, 2, 3] ,true ,#Find ,Cor Maximum A ,(maxx, [A])), \n" ^
   14.39 @@ -138,7 +138,7 @@
   14.40    "(10 ,[1, 2] ,true ,#Given ,Cor Input_Descript.Domain {0<..<r} ,(doma, [{0<..<r}])), \n" ^
   14.41    "(12 ,[1, 2, 3] ,true ,#Given ,Cor ErrorBound (\<epsilon> = 0) ,(err, [\<epsilon> = 0]))]"
   14.42  then () else error "I_Model.to_string meth CHANGED";
   14.43 ----------------------------------------------------------------------- trace from CalcTreeTEST*)
   14.44 +---------------------------------------------------------------------- trace from Test_Code.init_calc @{context}*)
   14.45  
   14.46  (*** Solution starts ====================================================================== ***)
   14.47  (*---
    15.1 --- a/test/Tools/isac/BridgeLibisabelle/interface.sml	Wed Oct 19 15:39:15 2022 +0200
    15.2 +++ b/test/Tools/isac/BridgeLibisabelle/interface.sml	Thu Oct 20 10:23:38 2022 +0200
    15.3 @@ -51,7 +51,7 @@
    15.4  "-------- ME_Misc.get_interval from ctree with move_dn:modspec.sml -------------------";
    15.5  "=====new ctree 1: crippled by cut_level_'_ ======================";
    15.6  States.reset ();
    15.7 -CalcTree
    15.8 +CalcTree @{context}
    15.9  [(["equality (x/(x \<up> 2 - 6*x+9) - 1/(x \<up> 2 - 3*x) =1/x)",
   15.10  	   "solveFor x", "solutions L"], 
   15.11    ("RatEq",["univariate", "equation"],["no_met"]))];
    16.1 --- a/test/Tools/isac/BridgeLibisabelle/thy-present.sml	Wed Oct 19 15:39:15 2022 +0200
    16.2 +++ b/test/Tools/isac/BridgeLibisabelle/thy-present.sml	Thu Oct 20 10:23:38 2022 +0200
    16.3 @@ -80,7 +80,7 @@
    16.4  "----------- debugging on Tests/solve_linear_as_rootpbl -";
    16.5  "----- initContext -----";
    16.6  States.reset ();
    16.7 -CalcTree 
    16.8 +CalcTree @{context} 
    16.9      [(["equality (1+- 1*2+x=(0::real))", "solveFor x", "solutions L"],
   16.10        ("Test",
   16.11         ["LINEAR", "univariate", "equation", "test"],
   16.12 @@ -104,7 +104,7 @@
   16.13  
   16.14  "----- checkContext -----";
   16.15  States.reset ();
   16.16 -CalcTree 
   16.17 +CalcTree @{context} 
   16.18      [(["equality (1+- 1*2+x=(0::real))", "solveFor x", "solutions L"],
   16.19        ("Test",
   16.20         ["LINEAR", "univariate", "equation", "test"],
    17.1 --- a/test/Tools/isac/BridgeLibisabelle/use-cases.sml	Wed Oct 19 15:39:15 2022 +0200
    17.2 +++ b/test/Tools/isac/BridgeLibisabelle/use-cases.sml	Thu Oct 20 10:23:38 2022 +0200
    17.3 @@ -29,7 +29,7 @@
    17.4  "--------------------------------------------------------";
    17.5  (*"--------- empty rootpbl --------------------------------";*)
    17.6  "--------- solve_linear as rootpbl FE -------------------";
    17.7 -"--------- inspect the CalcTree No.1 with Iterator No.2 -";
    17.8 +"--------- inspect the CalcTree @{context} No.1 with Iterator No.2 -";
    17.9  "--------- miniscript with mini-subpbl ------------------";
   17.10  "--------- mini-subpbl AUTOCALCULATE Steps 1 ------------";
   17.11  "--------- solve_linear as rootpbl AUTO CompleteCalc ----";
   17.12 @@ -43,7 +43,7 @@
   17.13  "--------- tryMatchProblem, tryRefineProblem ------------";
   17.14  "--------- modifyCalcHead, resetCalcHead, modelProblem --";
   17.15  "--------- maximum-example, UC: Modeling an example -----";
   17.16 -"--------- solve_linear from pbl-hierarchy --------------";
   17.17 +(*"--------- solve_linear from pbl-hierarchy --------------";*)
   17.18  "--------- solve_linear as in an algebra system (CAS)----";
   17.19  "--------- interSteps: on 'miniscript with mini-subpbl' -";
   17.20  "--------- getTactic, fetchApplicableTactics ------------";
   17.21 @@ -82,7 +82,7 @@
   17.22  "--------- empty rootpbl --------------------------------";
   17.23  "--------- empty rootpbl --------------------------------";
   17.24  "--------- empty rootpbl --------------------------------";
   17.25 - CalcTree [([], ("", [], []))];
   17.26 + CalcTree @{context} [([], ("", [], []))];
   17.27   Iterator 1;
   17.28   moveActiveRoot 1;
   17.29   refFormula 1 (States.get_pos 1 1);
   17.30 @@ -95,14 +95,14 @@
   17.31  "--------- solve_linear as rootpbl FE -------------------";
   17.32  States.reset ();
   17.33  
   17.34 - CalcTree      (*start of calculation, return No.1*)
   17.35 + CalcTree @{context}      (*start of calculation, return No.1*)
   17.36       [(["equality (1+- 1*2+x=(0::real))", "solveFor x", "solutions L"],
   17.37         ("Test", 
   17.38  	["LINEAR", "univariate", "equation", "test"],
   17.39  	["Test", "solve_linear"]))];
   17.40 - Iterator 1;     (*create an active Iterator on CalcTree No.1*)
   17.41 + Iterator 1;     (*create an active Iterator on CalcTree @{context} No.1*)
   17.42   
   17.43 - moveActiveRoot 1;(*sets the CalcIterator No.1 at the root of CalcTree No.1*);
   17.44 + moveActiveRoot 1;(*sets the CalcIterator No.1 at the root of CalcTree @{context} No.1*);
   17.45   refFormula 1 (States.get_pos 1 1)  (*gets CalcHead; model is still empty*);
   17.46   
   17.47  
   17.48 @@ -262,9 +262,9 @@
   17.49   error "FE-Kernel-interface.sml: diff.behav. in solve_linear as rootpbl";
   17.50  
   17.51  
   17.52 -"--------- inspect the CalcTree No.1 with Iterator No.2 -";
   17.53 -"--------- inspect the CalcTree No.1 with Iterator No.2 -";
   17.54 -"--------- inspect the CalcTree No.1 with Iterator No.2 -";
   17.55 +"--------- inspect the CalcTree @{context} No.1 with Iterator No.2 -";
   17.56 +"--------- inspect the CalcTree @{context} No.1 with Iterator No.2 -";
   17.57 +"--------- inspect the CalcTree @{context} No.1 with Iterator No.2 -";
   17.58  (*WN041118: inspection shifted to Iterator No.1, because others need pos'*)
   17.59  (*-------- WN190723: doesnt work since changeset 59474	21d4d2868b83
   17.60   moveActiveRoot 1; 
   17.61 @@ -293,7 +293,7 @@
   17.62  "--------- miniscript with mini-subpbl ------------------";
   17.63  (*WN120210?not ME:\label{SOLVE:MANUAL:TACTIC:enter} UC 30.3.2.1 p.175 !!!!!NOT IMPL IN FE*)
   17.64  "=== this sequence of fun-calls resembles fun me ===";
   17.65 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   17.66 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   17.67     ("Test", ["sqroot-test", "univariate", "equation", "test"],
   17.68      ["Test", "squ-equ-test-subpbl1"]))];
   17.69   Iterator 1;
   17.70 @@ -416,7 +416,7 @@
   17.71  "--------- mini-subpbl AUTOCALCULATE Steps 1 -------------";
   17.72  "--------- mini-subpbl AUTOCALCULATE Steps 1 -------------";
   17.73  (*WN120210?not ME:\label{SOLVE:AUTO:one} UC 30.3.3.2 p.176*)
   17.74 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   17.75 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   17.76     ("Test", ["sqroot-test", "univariate", "equation", "test"],
   17.77      ["Test", "squ-equ-test-subpbl1"]))];
   17.78   Iterator 1;
   17.79 @@ -468,7 +468,7 @@
   17.80  "--------- solve_linear as rootpbl AUTO CompleteCalc ----";
   17.81  "--------- solve_linear as rootpbl AUTO CompleteCalc ----";
   17.82  (*WN120210?not ME:\label{SPECIFY:START:auto} UC 30.2.4.2 p.174*)
   17.83 - CalcTree
   17.84 + CalcTree @{context}
   17.85       [(["equality (1+- 1*2+x=(0::real))", "solveFor x", "solutions L"],
   17.86         ("Test", 
   17.87  	["LINEAR", "univariate", "equation", "test"],
   17.88 @@ -492,7 +492,7 @@
   17.89  "--------- solve_linear as rootpbl AUTO CompleteHead/Eval ";
   17.90  "--------- solve_linear as rootpbl AUTO CompleteHead/Eval ";
   17.91  (* ERROR: error in kernel ?? *)
   17.92 - CalcTree
   17.93 + CalcTree @{context}
   17.94       [(["equality (1+- 1*2+x=(0::real))", "solveFor x", "solutions L"],
   17.95         ("Test", 
   17.96  	["LINEAR", "univariate", "equation", "test"],
   17.97 @@ -514,7 +514,7 @@
   17.98  "--------- mini-subpbl AUTOCALCULATE CompleteCalc -------";
   17.99  "--------- mini-subpbl AUTOCALCULATE CompleteCalc -------";
  17.100  (*WN120210?not ME:\label{SPECIFY:START:auto} UC 30.2.4.2 p.174*)
  17.101 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.102 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.103     ("Test", ["sqroot-test", "univariate", "equation", "test"],
  17.104      ["Test", "squ-equ-test-subpbl1"]))];
  17.105   Iterator 1;
  17.106 @@ -542,7 +542,7 @@
  17.107  "--------- mini-subpbl AUTO CompleteCalcHead ------------";
  17.108  "--------- mini-subpbl AUTO CompleteCalcHead ------------";
  17.109  "--------- mini-subpbl AUTO CompleteCalcHead ------------";
  17.110 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.111 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.112     ("Test", ["sqroot-test", "univariate", "equation", "test"],
  17.113      ["Test", "squ-equ-test-subpbl1"]))];
  17.114   Iterator 1;
  17.115 @@ -563,7 +563,7 @@
  17.116  "--------- solve_linear as rootpbl AUTO CompleteModel ---";
  17.117  "--------- solve_linear as rootpbl AUTO CompleteModel ---";
  17.118  States.reset ();
  17.119 - CalcTree
  17.120 + CalcTree @{context}
  17.121       [(["equality (1+- 1*2+x=(0::real))", "solveFor x", "solutions L"],
  17.122         ("Test", 
  17.123  	["LINEAR", "univariate", "equation", "test"],
  17.124 @@ -605,7 +605,7 @@
  17.125  "--------- setContext..Thy ------------------------------";
  17.126  "--------- setContext..Thy ------------------------------";
  17.127  States.reset ();
  17.128 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.129 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.130    ("Test", ["sqroot-test", "univariate", "equation", "test"],
  17.131     ["Test", "squ-equ-test-subpbl1"]))];
  17.132   Iterator 1; moveActiveRoot 1;
  17.133 @@ -640,7 +640,7 @@
  17.134  "--------- mini-subpbl AUTOCALC CompleteToSubpbl --------";
  17.135  "--------- mini-subpbl AUTOCALC CompleteToSubpbl --------";
  17.136  States.reset ();
  17.137 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.138 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.139     ("Test", ["sqroot-test", "univariate", "equation", "test"],
  17.140      ["Test", "squ-equ-test-subpbl1"]))];
  17.141   Iterator 1; moveActiveRoot 1;
  17.142 @@ -673,7 +673,7 @@
  17.143  "--------- rat-eq + subpbl: no_met, NO solution dropped - see LI: '--- simpl.rat.term, '..";
  17.144  (*--- THIS IS RE-USED WITH fun me IN  test/../MathEngine/solve.sml -------------------
  17.145        ---- rat-eq + subpbl: set_found in check_tac1 ----*)
  17.146 - CalcTree
  17.147 + CalcTree @{context}
  17.148   [(["equality ((5*x)/(x - 2) - x/(x+2)=(4::real))", "solveFor x", "solutions L"],
  17.149     ((** )"RatEq"( **)"PolyEq"(*required for "make_ratpoly_in"*), 
  17.150      ["univariate", "equation"], ["no_met"]))];
  17.151 @@ -764,7 +764,7 @@
  17.152   * x \<up>2 + 4*x + 5 = 2
  17.153  see isac.bridge.TestSpecify#testMatchRefine*)
  17.154  States.reset ();
  17.155 - CalcTree
  17.156 + CalcTree @{context}
  17.157   [(["equality (x \<up> 2 + 4*x + 5 = (2::real))", "solveFor x", "solutions L"],
  17.158     ("Isac_Knowledge", 
  17.159      ["univariate", "equation"],
  17.160 @@ -883,7 +883,7 @@
  17.161  "--------- modifyCalcHead, resetCalcHead, modelProblem --";
  17.162  "--------- modifyCalcHead, resetCalcHead, modelProblem --";
  17.163  States.reset ();
  17.164 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.165 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.166     ("Test", ["sqroot-test", "univariate", "equation", "test"],
  17.167      ["Test", "squ-equ-test-subpbl1"]))];
  17.168   Iterator 1;
  17.169 @@ -965,7 +965,7 @@
  17.170  
  17.171  "#################################################################";
  17.172  States.reset ();
  17.173 - CalcTree [(elems, spec)];
  17.174 + CalcTree @{context} [(elems, spec)];
  17.175   Iterator 1;
  17.176   moveActiveRoot 1; 
  17.177   refFormula 1 (States.get_pos 1 1);
  17.178 @@ -1028,13 +1028,13 @@
  17.179   (*this final calcHead now has STATUS 'complete' !*)
  17.180   DEconstrCalcTree 1;
  17.181  
  17.182 -(*POSTPONE CORRECTION AT END OF TRANSITION TO Isabelle/PIDE/Isac
  17.183 +(*POSTPONE CORRECTION AT END OF TRANSITION TO Isabelle/PIDE/Isac (~ Cas_Cmd)
  17.184  "--------- solve_linear from pbl-hierarchy --------------";
  17.185  "--------- solve_linear from pbl-hierarchy --------------";
  17.186  "--------- solve_linear from pbl-hierarchy --------------";
  17.187  States.reset ();
  17.188   val (fmz, sp) = ([], ("", ["LINEAR", "univariate", "equation", "test"], []));
  17.189 - CalcTree [(fmz, sp)];
  17.190 + CalcTree @{context} [(fmz, sp)];
  17.191   Iterator 1; moveActiveRoot 1;
  17.192   refFormula 1 (States.get_pos 1 1);
  17.193   modifyCalcHead 1 (([],Pbl),"solve (1+- 1*2+x=(0::real))",
  17.194 @@ -1058,7 +1058,7 @@
  17.195  (*WN120210?not ME:\label{UC:cas-input} UC 30.1.2.5 p.168*)
  17.196  States.reset ();
  17.197   val (fmz, sp) = ([], ("", [], []));
  17.198 - CalcTree [(fmz, sp)];
  17.199 + CalcTree @{context} [(fmz, sp)];
  17.200   Iterator 1; moveActiveRoot 1;
  17.201   modifyCalcHead 1 (([],Pbl),"solveTest (1+- 1*2+x=0,x)", [], Pbl, ("", [], []));
  17.202   autoCalculate 1 CompleteCalc;
  17.203 @@ -1074,7 +1074,7 @@
  17.204  "--------- interSteps: on 'miniscript with mini-subpbl' -";
  17.205  "--------- interSteps: on 'miniscript with mini-subpbl' -";
  17.206  "--------- interSteps: on 'miniscript with mini-subpbl' -";
  17.207 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.208 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.209     ("Test", ["sqroot-test", "univariate", "equation", "test"],
  17.210      ["Test", "squ-equ-test-subpbl1"]))];
  17.211   Iterator 1;
  17.212 @@ -1112,7 +1112,7 @@
  17.213  (* compare test/../script.sml
  17.214  "----------- fun from_prog ---------------------------------------";
  17.215  *)
  17.216 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.217 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.218     ("Test", ["sqroot-test", "univariate", "equation", "test"],
  17.219      ["Test", "squ-equ-test-subpbl1"]))];
  17.220   Iterator 1; moveActiveRoot 1;
  17.221 @@ -1143,7 +1143,7 @@
  17.222  "--------- getAssumptions, getAccumulatedAsms -----------";
  17.223  "--------- getAssumptions, getAccumulatedAsms -----------";
  17.224  States.reset ();
  17.225 -CalcTree
  17.226 +CalcTree @{context}
  17.227  [(["equality (x/(x \<up> 2 - 6*x+9) - 1/(x \<up> 2 - 3*x) =1/x)",
  17.228  	   "solveFor x", "solutions L"], 
  17.229    ("RatEq",["univariate", "equation"],["no_met"]))];
  17.230 @@ -1180,7 +1180,7 @@
  17.231  "--------- arbitrary combinations of steps --------------";
  17.232  "--------- arbitrary combinations of steps --------------";
  17.233  "--------- arbitrary combinations of steps --------------";
  17.234 - CalcTree      (*start of calculation, return No.1*)
  17.235 + CalcTree @{context}      (*start of calculation, return No.1*)
  17.236       [(["equality (1+- 1*2+x=(0::real))", "solveFor x", "solutions L"],
  17.237         ("Test", 
  17.238  	["LINEAR", "univariate", "equation", "test"],
  17.239 @@ -1230,7 +1230,7 @@
  17.240  "--------- appendF label{SOLVE:MANUAL:FORMULA:enter}right";
  17.241  "--------- appendF label{SOLVE:MANUAL:FORMULA:enter}right";
  17.242  States.reset ();
  17.243 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.244 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.245     ("Test", ["sqroot-test", "univariate", "equation", "test"],
  17.246      ["Test", "squ-equ-test-subpbl1"]))];
  17.247   Iterator 1;
  17.248 @@ -1253,7 +1253,7 @@
  17.249  "--------- appendF label{SOLVE:MANUAL:FORMULA:enter}other"; (*UC 30.3.2.4 p.175*)
  17.250  "--------- appendF label{SOLVE:MANUAL:FORMULA:enter}other";
  17.251  "--------- appendF label{SOLVE:MANUAL:FORMULA:enter}other";
  17.252 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.253 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.254     ("Test", ["sqroot-test", "univariate", "equation", "test"],
  17.255      ["Test", "squ-equ-test-subpbl1"]))];
  17.256   Iterator 1;
  17.257 @@ -1276,7 +1276,7 @@
  17.258  "--------- appendF label{SOLVE:MANUAL:FORMULA:enter}oth 2"; (*UC 30.3.2.4 p.175*)
  17.259  "--------- appendF label{SOLVE:MANUAL:FORMULA:enter}oth 2";
  17.260  "--------- appendF label{SOLVE:MANUAL:FORMULA:enter}oth 2";
  17.261 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.262 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.263     ("Test", ["sqroot-test", "univariate", "equation", "test"],
  17.264      ["Test", "squ-equ-test-subpbl1"]))];
  17.265   Iterator 1;
  17.266 @@ -1300,7 +1300,7 @@
  17.267  "--------- appendF label{SOLVE:MANUAL:FORMULA:enter}NOTok"; (*UC 30.3.2.4 p.175*)
  17.268  "--------- appendF label{SOLVE:MANUAL:FORMULA:enter}NOTok";
  17.269  "--------- appendF label{SOLVE:MANUAL:FORMULA:enter}NOTok";
  17.270 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.271 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.272     ("Test", ["sqroot-test", "univariate", "equation", "test"],
  17.273      ["Test", "squ-equ-test-subpbl1"]))];
  17.274   Iterator 1;
  17.275 @@ -1322,7 +1322,7 @@
  17.276  "--------- replaceFormula {SOL:MAN:FOR:replace} right----";
  17.277  "--------- replaceFormula {SOL:MAN:FOR:replace} right----";
  17.278  (*\label{SOLVE:MANUAL:FORMULA:replace}*)
  17.279 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.280 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.281     ("Test", ["sqroot-test", "univariate", "equation", "test"],
  17.282      ["Test", "squ-equ-test-subpbl1"]))];
  17.283   Iterator 1;
  17.284 @@ -1343,10 +1343,10 @@
  17.285   error "FE-interface.sml: diff.behav. in FORMULA:replace} right 2";
  17.286  
  17.287  (*WN050211 replaceFormula didn't work on second ctree: thus now tested...*)
  17.288 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.289 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.290     ("Test", ["sqroot-test", "univariate", "equation", "test"],
  17.291      ["Test", "squ-equ-test-subpbl1"]))];
  17.292 - Iterator 2; (*! ! ! 1 CalcTree inbetween States.reset (); *)
  17.293 + Iterator 2; (*! ! ! 1 CalcTree @{context} inbetween States.reset (); *)
  17.294   moveActiveRoot 2;
  17.295   autoCalculate 2 CompleteCalc;
  17.296   moveActiveFormula 2 ([2],Res);
  17.297 @@ -1368,7 +1368,7 @@
  17.298  "--------- replaceFormula {SOL:MAN:FOR:replace} other----";
  17.299  "--------- replaceFormula {SOL:MAN:FOR:replace} other----";
  17.300  (*\label{SOLVE:MANUAL:FORMULA:replace}*)
  17.301 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.302 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.303     ("Test", ["sqroot-test", "univariate", "equation", "test"],
  17.304      ["Test", "squ-equ-test-subpbl1"]))];
  17.305   Iterator 1;
  17.306 @@ -1400,7 +1400,7 @@
  17.307  "--------- replaceFormula {SOL:MAN:FOR:replace} other 2--";
  17.308  "--------- replaceFormula {SOL:MAN:FOR:replace} other 2--";
  17.309  (*\label{SOLVE:MANUAL:FORMULA:replace}*)
  17.310 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.311 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.312     ("Test", ["sqroot-test", "univariate", "equation", "test"],
  17.313      ["Test", "squ-equ-test-subpbl1"]))];
  17.314   Iterator 1;
  17.315 @@ -1432,7 +1432,7 @@
  17.316  "--------- replaceFormula {SOL:MAN:FOR:replace} NOTok----";
  17.317  "--------- replaceFormula {SOL:MAN:FOR:replace} NOTok----";
  17.318  (*\label{SOLVE:MANUAL:FORMULA:replace}*)
  17.319 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.320 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  17.321     ("Test", ["sqroot-test", "univariate", "equation", "test"],
  17.322      ["Test", "squ-equ-test-subpbl1"]))];
  17.323   Iterator 1;
  17.324 @@ -1453,7 +1453,7 @@
  17.325  "--------- UC errpat chain-rule-diff-both, fillpat by input ------";
  17.326  "--------- UC errpat chain-rule-diff-both, fillpat by input ------";
  17.327  "--------- UC errpat chain-rule-diff-both, fillpat by input ------";
  17.328 -CalcTree
  17.329 +CalcTree @{context}
  17.330  [(["functionTerm (x  \<up>  2 + sin (x  \<up>  4))", "differentiateFor x", "derivative f_f'"], 
  17.331    ("Isac_Knowledge", ["derivative_of", "function"], ["diff", "differentiate_on_R"]))];
  17.332  Iterator 1;
  17.333 @@ -1536,7 +1536,7 @@
  17.334  "--------- UC errpat add-fraction, fillpat by input --------------";
  17.335  "--------- UC errpat add-fraction, fillpat by input --------------";
  17.336  (*cp from BridgeLog Java <=> SML*)
  17.337 -CalcTree [([], References.empty)];
  17.338 +CalcTree @{context} [([], References.empty)];
  17.339  Iterator 1;
  17.340  moveActiveRoot 1;
  17.341  moveActiveFormula 1 ([],Pbl);
  17.342 @@ -1553,7 +1553,7 @@
  17.343  "--------- UC errpat, fillpat step to Rewrite --------------------";
  17.344  "--------- UC errpat, fillpat step to Rewrite --------------------";
  17.345  (*TODO*)
  17.346 -CalcTree
  17.347 +CalcTree @{context}
  17.348  [(["functionTerm ((x  \<up>  2)  \<up>  3 + sin (x  \<up>  4))",
  17.349     "differentiateFor x", "derivative f_f'"], 
  17.350    ("Isac_Knowledge", ["derivative_of", "function"],
  17.351 @@ -1567,7 +1567,7 @@
  17.352  "--------- UC errpat, fillpat step to Rewrite_Set ----------------";
  17.353  "--------- UC errpat, fillpat step to Rewrite_Set ----------------";
  17.354  "--------- UC errpat, fillpat step to Rewrite_Set ----------------";
  17.355 -CalcTree
  17.356 +CalcTree @{context}
  17.357  [(["functionTerm ((x  \<up>  2)  \<up>  3 + sin (x  \<up>  4))",
  17.358     "differentiateFor x", "derivative f_f'"], 
  17.359    ("Isac_Knowledge", ["derivative_of", "function"],
    18.1 --- a/test/Tools/isac/Interpret/error-pattern.sml	Wed Oct 19 15:39:15 2022 +0200
    18.2 +++ b/test/Tools/isac/Interpret/error-pattern.sml	Thu Oct 20 10:23:38 2022 +0200
    18.3 @@ -23,12 +23,12 @@
    18.4  "--------- maximum-example, UC: Modeling / modifyCalcHead --------";*)
    18.5  "--------- syntax error ------------------------------------------";
    18.6  "CAS-command:";
    18.7 -"--------- CAS-command on ([],Pbl) -------------------------------";
    18.8 -"--------- CAS-command on ([],Pbl) FE-interface ------------------";
    18.9 +(*"--------- CAS-command on ([],Pbl) -------------------------------";*)
   18.10 +(*"--------- CAS-command on ([],Pbl) FE-interface ------------------";*)
   18.11  "--------- locate_input_term [rational,simplification] ----------------------";
   18.12 -"--------- Take as 1st tac, start with <NEW> (CAS input) ---------";
   18.13 +(*"--------- Take as 1st tac, start with <NEW> (CAS input) ---------";*)
   18.14  "--------- Take as 1st tac, start from exp -----------------------";
   18.15 -"--------- implicit_take, start with <NEW> (CAS input) ---------------";
   18.16 +(*"--------- implicit_take, start with <NEW> (CAS input) ---------------";*)
   18.17  "--------- build fun check_for' ------------------------------";
   18.18  "--------- build fun check_for' ?bdv -------------------------";
   18.19  "--------- build fun check_for ------------------------";
   18.20 @@ -53,7 +53,7 @@
   18.21   (writeln o UnparseC.term) sc;
   18.22  
   18.23   States.reset ();
   18.24 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   18.25 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   18.26  	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
   18.27  	     ["Test", "squ-equ-test-subpbl1"]))];
   18.28   Iterator 1; moveActiveRoot 1;
   18.29 @@ -138,7 +138,7 @@
   18.30  "--------- appendFormula: on Frm + equ_nrls ----------------------";
   18.31  "--------- appendFormula: on Frm + equ_nrls ----------------------";
   18.32   States.reset ();
   18.33 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   18.34 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   18.35  	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
   18.36  	     ["Test", "squ-equ-test-subpbl1"]))];
   18.37   Iterator 1; moveActiveRoot 1;
   18.38 @@ -173,7 +173,7 @@
   18.39  "--------- appendFormula: on Res + NO deriv ----------------------";
   18.40  "--------- appendFormula: on Res + NO deriv ----------------------";
   18.41   States.reset ();
   18.42 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   18.43 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   18.44  	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
   18.45  	     ["Test", "squ-equ-test-subpbl1"]))];
   18.46   Iterator 1; moveActiveRoot 1;
   18.47 @@ -206,7 +206,7 @@
   18.48   re-build: fun locate_input_term ---------------------------------------------------"; 
   18.49  *)
   18.50   States.reset ();
   18.51 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   18.52 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   18.53  	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
   18.54  	     ["Test", "squ-equ-test-subpbl1"]))];
   18.55   Iterator 1; moveActiveRoot 1;
   18.56 @@ -236,7 +236,7 @@
   18.57  "--------- appendFormula: on Res + late deriv [x = 3 + - 2]---///--";
   18.58  "--------- appendFormula: on Res + late deriv [x = 3 + - 2]---///--";
   18.59   States.reset ();
   18.60 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   18.61 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   18.62  	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
   18.63  	     ["Test", "squ-equ-test-subpbl1"]))];
   18.64   Iterator 1; moveActiveRoot 1;
   18.65 @@ -260,7 +260,7 @@
   18.66  "--------- replaceFormula: on Res + = ----------------------------";
   18.67  "--------- replaceFormula: on Res + = ----------------------------";
   18.68   States.reset ();
   18.69 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   18.70 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   18.71  	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
   18.72  	     ["Test", "squ-equ-test-subpbl1"]))];
   18.73   Iterator 1; moveActiveRoot 1;
   18.74 @@ -306,7 +306,7 @@
   18.75  "--------- replaceFormula: on Res + = 1st Nd ---------------------";
   18.76  "--------- replaceFormula: on Res + = 1st Nd ---------------------";
   18.77   States.reset ();
   18.78 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   18.79 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   18.80  	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
   18.81  	     ["Test", "squ-equ-test-subpbl1"]))];
   18.82   Iterator 1; moveActiveRoot 1;
   18.83 @@ -330,7 +330,7 @@
   18.84  "--------- replaceFormula: on Frm + = 1st Nd ---------------------";
   18.85  "--------- replaceFormula: on Frm + = 1st Nd ---------------------";
   18.86   States.reset (); 
   18.87 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   18.88 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   18.89  	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
   18.90  	     ["Test", "squ-equ-test-subpbl1"]))];
   18.91   Iterator 1; moveActiveRoot 1;
   18.92 @@ -353,7 +353,7 @@
   18.93  "--------- replaceFormula: cut calculation -----------------------";
   18.94  "--------- replaceFormula: cut calculation -----------------------";
   18.95   States.reset ();
   18.96 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   18.97 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   18.98  	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
   18.99  	     ["Test", "squ-equ-test-subpbl1"]))];
  18.100   Iterator 1; moveActiveRoot 1;
  18.101 @@ -397,7 +397,7 @@
  18.102  
  18.103  
  18.104   (*!!!!!!!!!!!!!!!!! DON'T USE me FOR FINDING nxt !!!!!!!!!!!!!!!!!!*)
  18.105 - val (p,_,f,nxt,_,pt) = CalcTreeTEST [(elems, spec)];
  18.106 + val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(elems, spec)];
  18.107   (*val nxt = ("Model_Problem", ...*)
  18.108   val pbl = get_obj g_pbl pt (fst p); (writeln o (I_Model.to_string ctxt)) pbl; 
  18.109  
  18.110 @@ -450,7 +450,7 @@
  18.111  "--------- syntax error ------------------------------------------";
  18.112  "--------- syntax error ------------------------------------------";
  18.113   States.reset ();
  18.114 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  18.115 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  18.116  	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
  18.117  	     ["Test", "squ-equ-test-subpbl1"]))];
  18.118   Iterator 1; moveActiveRoot 1;
  18.119 @@ -466,14 +466,15 @@
  18.120   else error "inform.sml: diff.behav.appendFormula: syntax error";
  18.121  DEconstrCalcTree 1;
  18.122  
  18.123 +(*POSTPONE CORRECTION AT END OF TRANSITION TO Isabelle/PIDE/Isac (~ Cas_Cmd)
  18.124  "--------- CAS-command on ([],Pbl) -------------------------------";
  18.125  "--------- CAS-command on ([],Pbl) -------------------------------";
  18.126  "--------- CAS-command on ([],Pbl) -------------------------------";
  18.127  val (p,_,f,nxt,_,pt) = 
  18.128 -    CalcTreeTEST [([], References.empty)];
  18.129 +    Test_Code.init_calc @{context} [([], References.empty)];
  18.130  val ifo = "solve(x+1=2,x)";
  18.131  val (_,(_,c,(pt,p))) = Step_Solve.by_term (pt,p) "solve(x+1=2,x)";
  18.132 -(*
  18.133 +( *
  18.134    This trick           \<up> \<up> \<up> micked input of \<up> \<up> \<up> \<up>  \<up> ^^ in the front-end.
  18.135    The trick worked in changeset fbaff8cf0179, it does not work in 59c5dd27d589 anymore
  18.136    (TODO hg bisect ?) and raises the ERROR Undefined fact: "xfoldr_Nil".
  18.137 @@ -488,11 +489,12 @@
  18.138  DEconstrCalcTree 1;
  18.139  -----------------------------------------------------------------------------------------------*)
  18.140  
  18.141 +(*POSTPONE CORRECTION AT END OF TRANSITION TO Isabelle/PIDE/Isac (~ Cas_Cmd)
  18.142  "--------- CAS-command on ([],Pbl) FE-interface ------------------";
  18.143  "--------- CAS-command on ([],Pbl) FE-interface ------------------";
  18.144  "--------- CAS-command on ([],Pbl) FE-interface ------------------";
  18.145  States.reset ();
  18.146 -CalcTree [([], References.empty)];
  18.147 +CalcTree @{context} [([], References.empty)];
  18.148  Iterator 1;
  18.149  moveActiveRoot 1;
  18.150  replaceFormula 1 "solve(x+1=2,x)";
  18.151 @@ -502,12 +504,13 @@
  18.152  if p = ([], Res) then ()
  18.153  else error "inform.sml: diff.behav. CAScmd ([],Pbl) FE-interface";
  18.154  DEconstrCalcTree 1;
  18.155 +-----------------------------------------------------------------------------------------------*)
  18.156  
  18.157  "--------- inform [rational,simplification] ----------------------";
  18.158  "--------- inform [rational,simplification] ----------------------";
  18.159  "--------- inform [rational,simplification] ----------------------";
  18.160  States.reset ();
  18.161 -CalcTree [(["Term (a * x / (b * x) + c * x / (d * x) + e / f)", "normalform N"],
  18.162 +CalcTree @{context} [(["Term (a * x / (b * x) + c * x / (d * x) + e / f)", "normalform N"],
  18.163  	("Rational", ["rational", "simplification"], ["simplification", "of_rationals"]))];
  18.164  Iterator 1; moveActiveRoot 1;
  18.165  autoCalculate 1 CompleteCalcHead;
  18.166 @@ -634,6 +637,7 @@
  18.167  *)
  18.168  DEconstrCalcTree 1;
  18.169  
  18.170 +(*POSTPONE CORRECTION AT END OF TRANSITION TO Isabelle/PIDE/Isac (~ Cas_Cmd)
  18.171  "--------- Take as 1st tac, start with <NEW> (CAS input) ---------";
  18.172  "--------- Take as 1st tac, start with <NEW> (CAS input) ---------";
  18.173  "--------- Take as 1st tac, start with <NEW> (CAS input) ---------";
  18.174 @@ -644,7 +648,7 @@
  18.175  TermC.atomty t;
  18.176  "-----------------------------------------------------------------";
  18.177  (*1>*)States.reset ();
  18.178 -(*2>*)CalcTree [([], References.empty)];
  18.179 +(*2>*)CalcTree @{context} [([], References.empty)];
  18.180  (*3>*)Iterator 1;moveActiveRoot 1;
  18.181  "----- here the Headline has been finished";
  18.182  (*4>*)moveActiveFormula 1 ([],Pbl);
  18.183 @@ -698,6 +702,7 @@
  18.184  if p = ([], Res) andalso UnparseC.term res = "1 + 2 * x" then ()
  18.185  else error "diff.sml behav.changed for Diff (x \<up> 2 + x + 1, x)";
  18.186  DEconstrCalcTree 1;
  18.187 +-----------------------------------------------------------------------------------------------*)
  18.188  
  18.189  "--------- Take as 1st tac, start from exp -----------------------";
  18.190  "--------- Take as 1st tac, start from exp -----------------------";
  18.191 @@ -705,7 +710,7 @@
  18.192  (*the following input is copied from BridgeLog Java <==> SML,
  18.193    omitting unnecessary inputs*)
  18.194  (*1>*)States.reset ();
  18.195 -(*2>*)CalcTree [(["functionTerm (x \<up> 2 + x + 1)", "differentiateFor x", "derivative f_'_f"],("Isac_Knowledge",["derivative_of", "function"],["diff", "differentiate_on_R"]))];
  18.196 +(*2>*)CalcTree @{context} [(["functionTerm (x \<up> 2 + x + 1)", "differentiateFor x", "derivative f_'_f"],("Isac_Knowledge",["derivative_of", "function"],["diff", "differentiate_on_R"]))];
  18.197  (*3>*)Iterator 1; moveActiveRoot 1;
  18.198  
  18.199  (*6>*)(*completeCalcHead*)autoCalculate 1 CompleteCalcHead;
  18.200 @@ -740,11 +745,12 @@
  18.201  else error "diff.sml Diff (x \<up> 2 + x + 1, x) from exp";
  18.202  DEconstrCalcTree 1;
  18.203  
  18.204 +(*POSTPONE CORRECTION AT END OF TRANSITION TO Isabelle/PIDE/Isac (~ Cas_Cmd)
  18.205  "--------- implicit_take, start with <NEW> (CAS input) ---------------";
  18.206  "--------- implicit_take, start with <NEW> (CAS input) ---------------";
  18.207  "--------- implicit_take, start with <NEW> (CAS input) ---------------";
  18.208  States.reset ();
  18.209 -CalcTree [([], References.empty)];
  18.210 +CalcTree @{context} [([], References.empty)];
  18.211  (*[[from sml: > @@@@@begin@@@@@
  18.212  [[from sml:  1 
  18.213  [[from sml: <CALCTREE>
  18.214 @@ -898,6 +904,7 @@
  18.215  [[from sml: </SYSERROR>
  18.216  [[from sml: @@@@@end@@@@@*)
  18.217  (*step into getFormulaeFromTo --- bug corrected...*)
  18.218 +-----------------------------------------------------------------------------------------------*)
  18.219  
  18.220  "--------- build fun check_for' ------------------------------";
  18.221  "--------- build fun check_for' ------------------------------";
  18.222 @@ -1007,7 +1014,7 @@
  18.223  "--------- embed fun check_for ------------------------";
  18.224  "--------- embed fun check_for ------------------------";
  18.225  States.reset ();     
  18.226 -CalcTree
  18.227 +CalcTree @{context}
  18.228  [(["functionTerm (x \<up> 2 + sin (x \<up> 4))", "differentiateFor x", "derivative f_f'"], 
  18.229    ("Isac_Knowledge", ["derivative_of", "function"], ["diff", "differentiate_on_R"]))];
  18.230  Iterator 1;
  18.231 @@ -1066,7 +1073,7 @@
  18.232  "--------- embed fun find_fill_patterns ---------------------------";
  18.233  "--------- embed fun find_fill_patterns ---------------------------";
  18.234  States.reset ();
  18.235 -CalcTree
  18.236 +CalcTree @{context}
  18.237  [(["functionTerm (x \<up> 2 + sin (x \<up> 4))", "differentiateFor x", "derivative f_f'"], 
  18.238    ("Isac_Knowledge", ["derivative_of", "function"], ["diff", "differentiate_on_R"]))];
  18.239  Iterator 1;
  18.240 @@ -1151,7 +1158,7 @@
  18.241  "--------- build fun is_exactly_equal, inputFillFormula ----------";
  18.242  "--------- build fun is_exactly_equal, inputFillFormula ----------";
  18.243  States.reset ();
  18.244 -CalcTree
  18.245 +CalcTree @{context}
  18.246  [(["functionTerm (x \<up> 2 + sin (x \<up> 4))", "differentiateFor x", "derivative f_f'"], 
  18.247    ("Isac_Knowledge", ["derivative_of", "function"], ["diff", "differentiate_on_R"]))];
  18.248  Iterator 1;
    19.1 --- a/test/Tools/isac/Interpret/li-tool.sml	Wed Oct 19 15:39:15 2022 +0200
    19.2 +++ b/test/Tools/isac/Interpret/li-tool.sml	Thu Oct 20 10:23:38 2022 +0200
    19.3 @@ -26,7 +26,7 @@
    19.4  val fmz = ["equality (x+1=(2::real))", "solveFor x", "solutions L"];
    19.5  val (dI',pI',mI') = ("Test",["sqroot-test", "univariate", "equation", "test"],
    19.6    ["Test", "squ-equ-test-subpbl1"]);
    19.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    19.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    19.9  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   19.10  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   19.11  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   19.12 @@ -60,7 +60,7 @@
   19.13  "--------- getTactic, fetchApplicableTactics ------------";
   19.14  *)
   19.15   States.reset ();
   19.16 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   19.17 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   19.18     ("Test", ["sqroot-test", "univariate", "equation", "test"],
   19.19      ["Test", "squ-equ-test-subpbl1"]))];
   19.20   Iterator 1;
   19.21 @@ -102,7 +102,7 @@
   19.22  "----------- fun specific_from_prog ----------------------------";
   19.23  "----------- fun specific_from_prog ----------------------------";
   19.24   States.reset ();
   19.25 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   19.26 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   19.27     ("Test", ["sqroot-test", "univariate", "equation", "test"],
   19.28      ["Test", "squ-equ-test-subpbl1"]))];
   19.29   Iterator 1;
   19.30 @@ -227,7 +227,7 @@
   19.31  val (dI',pI',mI') = ("Biegelinie", ["Biegelinien"],
   19.32  		     ["IntegrierenUndKonstanteBestimmen2"]);
   19.33  val p = e_pos'; val c = [];
   19.34 -(*[], Pbl*)val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))]; (*nxt = Model_Problem*)
   19.35 +(*[], Pbl*)val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))]; (*nxt = Model_Problem*)
   19.36  (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; (*\<rightarrow>Add_Given "Traegerlaenge L"*)
   19.37  (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; (*\<rightarrow>Add_Given "Streckenlast q_0"*)
   19.38  (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; (*\<rightarrow>Add_Find "Biegelinie y"*)
    20.1 --- a/test/Tools/isac/Interpret/lucas-interpreter.sml	Wed Oct 19 15:39:15 2022 +0200
    20.2 +++ b/test/Tools/isac/Interpret/lucas-interpreter.sml	Thu Oct 20 10:23:38 2022 +0200
    20.3 @@ -21,7 +21,7 @@
    20.4  "compare --- Apply_Method with initial Take by Step.do_next --- in test/../step-solve ----------";
    20.5  val p = e_pos'; val c = []; 
    20.6  val (p,_,f,nxt,_,pt) = 
    20.7 -    CalcTreeTEST 
    20.8 +    Test_Code.init_calc @{context} 
    20.9          [(["functionTerm (x \<up> 2 + 1)", "integrateBy x", "antiDerivative FF"],
   20.10            ("Integrate", ["integrate", "function"], ["diff", "integration"]))];
   20.11  val (p,_,f,nxt,_,pt) = me nxt p c pt; (*\<rightarrow> Add_Given "functionTerm (x \<up> 2 + 1)"*)
   20.12 @@ -183,7 +183,7 @@
   20.13  val fmz = ["equality (x+1=(2::real))", "solveFor x", "solutions L"];
   20.14  val (dI',pI',mI') = ("Test", ["sqroot-test", "univariate", "equation", "test"],
   20.15     ["Test", "squ-equ-test-subpbl1"]);
   20.16 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   20.17 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   20.18  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   20.19  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   20.20  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   20.21 @@ -331,7 +331,7 @@
   20.22  "----------- fun locate_input_tactic Helpless, NOT applicable ----------------------------------";
   20.23  "----------- fun locate_input_tactic Helpless, NOT applicable ----------------------------------";
   20.24  (*cp from -- try fun applyTactics ------- *)
   20.25 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(["Term (5*e + 6*f - 8*g - 9 - 7*e - 4*f + 10*g + 12)",
   20.26 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(["Term (5*e + 6*f - 8*g - 9 - 7*e - 4*f + 10*g + 12)",
   20.27  	    "normalform N"],
   20.28  	   ("PolyMinus",["plus_minus", "polynom", "vereinfachen"],
   20.29  	    ["simplification", "for_polynomials", "with_minus"]))];
   20.30 @@ -449,7 +449,7 @@
   20.31  "----------- re-build: fun find_next_step, mini ------------------------------------------------";
   20.32  val fmz = ["Term (a + a ::real)", "normalform n_n"];
   20.33  val (dI',pI',mI') = ("Poly",["polynomial", "simplification"],["simplification", "for_polynomials"]);
   20.34 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   20.35 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   20.36  (*[], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, Pos.e_pos'), []);(*Model_Problem*)
   20.37  (*[], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, Pos.e_pos'), []);(*Specify_Theory "Poly"*)
   20.38  (*[], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, Pos.e_pos'), []);(*Specify_Problem ["polynomial", "simplification"]*)
   20.39 @@ -593,7 +593,7 @@
   20.40  val fmz = ["equality (x+1=(2::real))", "solveFor x", "solutions L"];
   20.41  val (dI',pI',mI') = ("Test", ["sqroot-test", "univariate", "equation", "test"],
   20.42     ["Test", "squ-equ-test-subpbl1"]);
   20.43 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   20.44 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   20.45  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   20.46  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   20.47  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    21.1 --- a/test/Tools/isac/Interpret/step-solve.sml	Wed Oct 19 15:39:15 2022 +0200
    21.2 +++ b/test/Tools/isac/Interpret/step-solve.sml	Thu Oct 20 10:23:38 2022 +0200
    21.3 @@ -19,7 +19,7 @@
    21.4  "----------- me method [diff,integration] ---------------";
    21.5  val fmz = ["functionTerm (x \<up> 2 + 1)", "integrateBy x", "antiDerivative FF"];
    21.6  val spec = ("Integrate", ["integrate", "function"], ["diff", "integration"]);
    21.7 -(*[], Pbl*)val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, spec)];(*\<rightarrow>Model_Problem*)
    21.8 +(*[], Pbl*)val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, spec)];(*\<rightarrow>Model_Problem*)
    21.9  (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt;(*\<rightarrow>Add_Given "functionTerm (x \<up> 2 + 1)"*)
   21.10  (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt;(*\<rightarrow>Add_Given "integrateBy x"*)
   21.11  (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt;(*\<rightarrow>Add_Find "Integrate.antiDerivative FF"*)
    22.1 --- a/test/Tools/isac/Interpret/sub-problem.sml	Wed Oct 19 15:39:15 2022 +0200
    22.2 +++ b/test/Tools/isac/Interpret/sub-problem.sml	Thu Oct 20 10:23:38 2022 +0200
    22.3 @@ -18,7 +18,7 @@
    22.4  "----------- TODO: make steps around Subproblem more consistent --------------------------------";
    22.5  (* compare biegelinie-4.sml *)
    22.6  val (tac as Model_Problem (*["Biegelinien"]*), (pt, p as ([], Pbl))) =
    22.7 -CalcTreeTEST' [(["Traegerlaenge L", "Streckenlast q_0", "Biegelinie y",
    22.8 +Test_Code.init_calc' @{context} [(["Traegerlaenge L", "Streckenlast q_0", "Biegelinie y",
    22.9  	"Randbedingungen [y 0 = (0::real), y L = 0, M_b 0 = 0, M_b L = 0]", "FunktionsVariable x",
   22.10    "GleichungsVariablen [c, c_2, c_3, c_4]", "AbleitungBiegelinie dy"],
   22.11  ("Biegelinie", ["Biegelinien"], ["IntegrierenUndKonstanteBestimmen2"]))]
   22.12 @@ -39,7 +39,7 @@
   22.13    "GleichungsVariablen [c, c_2, c_3, c_4]", "AbleitungBiegelinie dy"];
   22.14  val refs =
   22.15    ("Biegelinie", ["Biegelinien"], ["IntegrierenUndKonstanteBestimmen2"]);
   22.16 -(*[], Pbl*)val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, refs)];
   22.17 +(*[], Pbl*)val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, refs)];
   22.18  (*[], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*\<rightarrow>Model_Problem*)
   22.19  (*[], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*\<rightarrow>Add_Given "Traegerlaenge L"*)
   22.20  (*[], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*\<rightarrow>Add_Given "Streckenlast q_0"*)
    23.1 --- a/test/Tools/isac/Knowledge/algein.sml	Wed Oct 19 15:39:15 2022 +0200
    23.2 +++ b/test/Tools/isac/Knowledge/algein.sml	Thu Oct 20 10:23:38 2022 +0200
    23.3 @@ -43,7 +43,7 @@
    23.4    ("Isac_Knowledge",["numerischSymbolische", "Berechnung"],
    23.5     ["Berechnung", "erstNumerisch"]);
    23.6  val p = e_pos'; val c = [];
    23.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))](*nxt = ("Model_Pr*);
    23.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))](*nxt = ("Model_Pr*);
    23.9  val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "KantenLaenge (k = 10)"*);
   23.10  val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "Querschnitt (q = 1)"*);
   23.11  val (p,_,f,nxt,_,pt) = me nxt p c pt(*Add_Given "KantenUnten [b1 = k - 2*q]"*);
   23.12 @@ -79,7 +79,7 @@
   23.13  "----------- auto 'Berechnung' 'erstSymbolisch' ------------------";
   23.14  "----------- auto 'Berechnung' 'erstSymbolisch' ------------------";
   23.15  "----------- auto 'Berechnung' 'erstSymbolisch' ------------------";
   23.16 -CalcTree
   23.17 +CalcTree @{context}
   23.18  [(["KantenLaenge (k=(10::real))", "Querschnitt (q=(1::real))",
   23.19       "KantenUnten [b1 = k - 2*(q::real), b2 = k - 2*(q::real), b3 = k - 2*(q::real), b4 = k - 2*(q::real) ]", 
   23.20       "KantenSenkrecht [v1 = (k::real), v2 = (k::real), v3 = (k::real), v4 = (k::real)]", 
    24.1 --- a/test/Tools/isac/Knowledge/biegelinie-1.sml	Wed Oct 19 15:39:15 2022 +0200
    24.2 +++ b/test/Tools/isac/Knowledge/biegelinie-1.sml	Thu Oct 20 10:23:38 2022 +0200
    24.3 @@ -90,7 +90,7 @@
    24.4  val (dI',pI',mI') = ("Biegelinie", ["makeFunctionTo", "equation"],
    24.5  		     ["Equation", "fromFunction"]);
    24.6  val p = e_pos'; val c = [];
    24.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    24.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    24.9  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   24.10  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   24.11  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
    25.1 --- a/test/Tools/isac/Knowledge/biegelinie-2.sml	Wed Oct 19 15:39:15 2022 +0200
    25.2 +++ b/test/Tools/isac/Knowledge/biegelinie-2.sml	Thu Oct 20 10:23:38 2022 +0200
    25.3 @@ -25,7 +25,7 @@
    25.4  		     ["Biegelinien", "ausBelastung"]);
    25.5  
    25.6  States.reset ();
    25.7 -CalcTree [(fmz, (dI',pI',mI'))];
    25.8 +CalcTree @{context} [(fmz, (dI',pI',mI'))];
    25.9  Iterator 1;
   25.10  moveActiveRoot 1;
   25.11  autoCalculate 1 CompleteCalc;
   25.12 @@ -52,7 +52,7 @@
   25.13  val (dI',pI',mI') = ("Biegelinie", ["vonBelastungZu", "Biegelinien"],
   25.14  		     ["Biegelinien", "ausBelastung"]);
   25.15  val p = e_pos'; val c = [];
   25.16 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   25.17 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   25.18  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   25.19  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   25.20  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
    26.1 --- a/test/Tools/isac/Knowledge/biegelinie-3.sml	Wed Oct 19 15:39:15 2022 +0200
    26.2 +++ b/test/Tools/isac/Knowledge/biegelinie-3.sml	Thu Oct 20 10:23:38 2022 +0200
    26.3 @@ -25,7 +25,7 @@
    26.4  		     ["Biegelinien", "setzeRandbedingungenEin"]);
    26.5  
    26.6  States.reset ();  
    26.7 -CalcTree [(fmz, (dI',pI',mI'))];
    26.8 +CalcTree @{context} [(fmz, (dI',pI',mI'))];
    26.9  Iterator 1;
   26.10  moveActiveRoot 1;
   26.11  autoCalculate 1 CompleteCalc;
   26.12 @@ -50,7 +50,7 @@
   26.13  val (dI',pI',mI') = ("Biegelinie", ["setzeRandbedingungen", "Biegelinien"],
   26.14  		     ["Biegelinien", "setzeRandbedingungenEin"]);
   26.15  val p = e_pos'; val c = [];
   26.16 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   26.17 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   26.18  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   26.19  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   26.20  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
    27.1 --- a/test/Tools/isac/Knowledge/biegelinie-4.sml	Wed Oct 19 15:39:15 2022 +0200
    27.2 +++ b/test/Tools/isac/Knowledge/biegelinie-4.sml	Thu Oct 20 10:23:38 2022 +0200
    27.3 @@ -25,7 +25,7 @@
    27.4  val (dI',pI',mI') = ("Biegelinie", ["Biegelinien"], ["IntegrierenUndKonstanteBestimmen2"]);
    27.5  
    27.6  States.reset ();
    27.7 -CalcTree [(fmz, (dI',pI',mI'))];                                     
    27.8 +CalcTree @{context} [(fmz, (dI',pI',mI'))];                                     
    27.9  Iterator 1;
   27.10  moveActiveRoot 1;
   27.11  autoCalculate 1 CompleteCalc;
   27.12 @@ -78,7 +78,7 @@
   27.13  "----------- IntegrierenUndKonstanteBestimmen2: Bsp.7.70. me' --------------------------------";
   27.14  
   27.15  val (tac as Model_Problem (*["Biegelinien"]*), (pt, p as ([], Pbl))) =
   27.16 -CalcTreeTEST' [(["Traegerlaenge L", "Streckenlast q_0", "Biegelinie y",
   27.17 +Test_Code.init_calc' @{context} [(["Traegerlaenge L", "Streckenlast q_0", "Biegelinie y",
   27.18  	"Randbedingungen [y 0 = (0::real), y L = 0, M_b 0 = 0, M_b L = 0]", "FunktionsVariable x",
   27.19    "GleichungsVariablen [c, c_2, c_3, c_4]", "AbleitungBiegelinie dy"],
   27.20  ("Biegelinie", ["Biegelinien"], ["IntegrierenUndKonstanteBestimmen2"]))]
   27.21 @@ -134,7 +134,7 @@
   27.22  "----------- biegel Bsp.7.70. check Problem + MethodC model ----------------------------------";
   27.23  (*this formalisation contains no variants, as opposed to maximum example*)
   27.24  val (tac as Model_Problem (*["Biegelinien"]*), ptp as (pt, p as ([], Pbl))) =
   27.25 -CalcTreeTEST' [([
   27.26 +Test_Code.init_calc' @{context} [([
   27.27  (*Problem model:*)
   27.28    "Traegerlaenge L", "Streckenlast q_0", "Biegelinie y",
   27.29  	"Randbedingungen [y 0 = (0::real), y L = 0, M_b 0 = 0, M_b L = 0]",
    28.1 --- a/test/Tools/isac/Knowledge/diff-app.sml	Wed Oct 19 15:39:15 2022 +0200
    28.2 +++ b/test/Tools/isac/Knowledge/diff-app.sml	Thu Oct 20 10:23:38 2022 +0200
    28.3 @@ -133,7 +133,7 @@
    28.4  	   "solutions L"];
    28.5  (*
    28.6  val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
    28.7 -val ((p,p_),_,_,_,_,(_,pt,_)) = CalcTreeTEST [fmz, (dI',pI',mI')))];
    28.8 +val ((p,p_),_,_,_,_,(_,pt,_)) = Test_Code.init_calc @{context} [fmz, (dI',pI',mI')))];
    28.9   -- \<up> -- ausgeliehen von test-root-equ/sml *)
   28.10  (*-------------- 9.6.03 --- cappend_ ... term -------irreparabler test
   28.11  val (pt,_) = 
   28.12 @@ -266,7 +266,7 @@
   28.13    ("Diff_App",["maximum_of", "function"],
   28.14     ["Diff_App", "max_by_calculus"]);
   28.15  
   28.16 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   28.17 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   28.18  (*=== inhibit exn 110722=============================================================
   28.19  val (p,_,f,nxt,_,pt) = me nxt p c pt;
   28.20  val (p,_,f,nxt,_,pt) = me nxt p c pt;
   28.21 @@ -417,7 +417,7 @@
   28.22    ("Diff_App",["maximum_of", "function"],
   28.23     ["Diff_App", "max_by_calculus"]);
   28.24  
   28.25 - CalcTree [(fmz, (dI',pI',mI'))];
   28.26 + CalcTree @{context} [(fmz, (dI',pI',mI'))];
   28.27   Iterator 1; moveActiveRoot 1;
   28.28   autoCalculate 1 CompleteCalcHead;
   28.29   refFormula 1 (States.get_pos 1 1); 
    29.1 --- a/test/Tools/isac/Knowledge/diff.sml	Wed Oct 19 15:39:15 2022 +0200
    29.2 +++ b/test/Tools/isac/Knowledge/diff.sml	Thu Oct 20 10:23:38 2022 +0200
    29.3 @@ -119,7 +119,7 @@
    29.4     ["diff", "diff_simpl"]);
    29.5  val p = e_pos'; val c = []; 
    29.6  "--- s1 ---";
    29.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    29.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    29.9  val (p,_,f,nxt,_,pt) = me nxt p c pt;
   29.10  "--- s2 ---";
   29.11  (*val nxt = ("Add_Given",
   29.12 @@ -192,7 +192,7 @@
   29.13  val (dI',pI',mI') =
   29.14    ("Diff",["derivative_of", "function"],
   29.15     ["diff", "diff_simpl"]);
   29.16 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   29.17 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   29.18  val (p,_,f,nxt,_,pt) = me nxt p c pt;
   29.19  val (p,_,f,nxt,_,pt) = me nxt p c pt;
   29.20  val (p,_,f,nxt,_,pt) = me nxt p c pt;
   29.21 @@ -302,7 +302,7 @@
   29.22  "----------- autoCalculate differentiate_on_R 2/x \<up> 2 -----";
   29.23  "----------- autoCalculate differentiate_on_R 2/x \<up> 2 -----";
   29.24  States.reset ();
   29.25 -CalcTree
   29.26 +CalcTree @{context}
   29.27  [(["functionTerm (x \<up> 2 + x+ 1/x + 2/x \<up> 2)",
   29.28     (*"functionTerm ((x \<up> 3) \<up> 5)",*)
   29.29     "differentiateFor x", "derivative f_f'"], 
   29.30 @@ -318,7 +318,7 @@
   29.31  
   29.32  "---------------------------------------------------------";
   29.33  States.reset ();
   29.34 -CalcTree
   29.35 +CalcTree @{context}
   29.36  [(["functionTerm (x \<up> 3 * x  \<up>  5)",
   29.37     "differentiateFor x", "derivative f_f'"], 
   29.38    ("Isac_Knowledge", ["derivative_of", "function"],
   29.39 @@ -339,7 +339,7 @@
   29.40  "----------- autoCalculate diff after_simplification ----";
   29.41  "----------- autoCalculate diff after_simplification ----";
   29.42  States.reset ();
   29.43 -CalcTree
   29.44 +CalcTree @{context}
   29.45  [(["functionTerm (x \<up> 3 * x \<up> 5)",
   29.46     "differentiateFor x", "derivative f_f'"], 
   29.47    ("Isac_Knowledge", ["derivative_of", "function"],
   29.48 @@ -359,7 +359,7 @@
   29.49  
   29.50  "--------------------------------------------------------";
   29.51  States.reset ();
   29.52 -CalcTree
   29.53 +CalcTree @{context}
   29.54  [(["functionTerm ((x \<up> 3) \<up> 5)",
   29.55     "differentiateFor x", "derivative f_f'"], 
   29.56    ("Isac_Knowledge", ["derivative_of", "function"],
   29.57 @@ -375,7 +375,7 @@
   29.58  "----------- autoCalculate differentiate_equality -------";
   29.59  "----------- autoCalculate differentiate_equality -------";
   29.60  States.reset ();
   29.61 -CalcTree
   29.62 +CalcTree @{context}
   29.63  [(["functionEq (A = s * (a - (s::real)))", "differentiateFor s", "derivativeEq f_f'"], 
   29.64    ("Isac_Knowledge", ["named", "derivative_of", "function"],
   29.65    ["diff", "differentiate_equality"]))];
   29.66 @@ -401,7 +401,7 @@
   29.67  "------------inform for x \<up> 2+x+1 -------------------------";
   29.68  "------------inform for x \<up> 2+x+1 -------------------------";
   29.69  States.reset ();
   29.70 -CalcTree
   29.71 +CalcTree @{context}
   29.72  [(["functionTerm (x \<up> 2 + x + 1)",
   29.73     "differentiateFor x", "derivative f_f'"], 
   29.74    ("Isac_Knowledge", ["derivative_of", "function"],
    30.1 --- a/test/Tools/isac/Knowledge/diophanteq.sml	Wed Oct 19 15:39:15 2022 +0200
    30.2 +++ b/test/Tools/isac/Knowledge/diophanteq.sml	Thu Oct 20 10:23:38 2022 +0200
    30.3 @@ -17,7 +17,7 @@
    30.4  
    30.5  (*there seemed to be no way to do these tests within DiophantEq.thy:
    30.6  val thy = @{theory};(**** ME_Isa: thy 'DiophantEq' not in system
    30.7 -  from CalcTreeTest*)
    30.8 +  from Test_Code.init_calc*)
    30.9  (*val thy = @{theory "Isac_Knowledge"};toplevel error from store_met?!?*)
   30.10  *)
   30.11  val thy = @{theory "DiophantEq"};
   30.12 @@ -51,7 +51,7 @@
   30.13      "intTestFind sss"],
   30.14     (Context.theory_name thy, ["diophantine", "equation"], 
   30.15      ["Test", "solve_diophant"]));
   30.16 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (thy, pbl, met))];
   30.17 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (thy, pbl, met))];
   30.18  val (p,_,f,nxt,_,pt) = me nxt p c pt; 
   30.19  val (p,_,f,nxt,_,pt) = me nxt p c pt; 
   30.20  val (p,_,f,nxt,_,pt) = me nxt p c pt; 
   30.21 @@ -85,7 +85,7 @@
   30.22  val (fmz, (thy, pbl, met)) = 
   30.23    (["intTestGiven (xxx + abc + - 1 * 111 + (123::int))", "intTestFind sss"],
   30.24     (Context.theory_name thy, ["inttype", "test"], ["Test", "intsimp"]));
   30.25 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (thy, pbl, met))];
   30.26 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (thy, pbl, met))];
   30.27  (*nxt = ("Model_Problem", ...)*)
   30.28  val (p,_,f,nxt,_,pt) = me nxt p c pt; 
   30.29  (*nxt = ("Add_Given", Add_Given "intTestGiven (xxx + abc + - 1 * 111 + 123)")*)
    31.1 --- a/test/Tools/isac/Knowledge/eqsystem-1.sml	Wed Oct 19 15:39:15 2022 +0200
    31.2 +++ b/test/Tools/isac/Knowledge/eqsystem-1.sml	Thu Oct 20 10:23:38 2022 +0200
    31.3 @@ -526,7 +526,7 @@
    31.4    ("Biegelinie",["normalise", "2x2", "LINEAR", "system"],
    31.5     ["EqSystem", "normalise", "2x2"]);
    31.6  val p = e_pos'; val c = []; 
    31.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    31.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    31.9  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   31.10  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   31.11  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
    32.1 --- a/test/Tools/isac/Knowledge/eqsystem-1a.sml	Wed Oct 19 15:39:15 2022 +0200
    32.2 +++ b/test/Tools/isac/Knowledge/eqsystem-1a.sml	Thu Oct 20 10:23:38 2022 +0200
    32.3 @@ -36,7 +36,7 @@
    32.4    ("Biegelinie",["normalise", "2x2", "LINEAR", "system"],
    32.5     ["EqSystem", "normalise", "2x2"]);
    32.6  val p = e_pos'; val c = []; 
    32.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    32.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    32.9  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   32.10  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   32.11  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
    33.1 --- a/test/Tools/isac/Knowledge/eqsystem-2.sml	Wed Oct 19 15:39:15 2022 +0200
    33.2 +++ b/test/Tools/isac/Knowledge/eqsystem-2.sml	Thu Oct 20 10:23:38 2022 +0200
    33.3 @@ -40,7 +40,7 @@
    33.4  val (dI',pI',mI') =
    33.5    ("Biegelinie",["LINEAR", "system"], ["no_met"]);
    33.6  val p = e_pos'; val c = []; 
    33.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    33.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    33.9  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   33.10  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   33.11  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   33.12 @@ -110,7 +110,7 @@
   33.13  
   33.14  "------- Bsp 7.27";
   33.15  States.reset ();
   33.16 -CalcTree [(
   33.17 +CalcTree @{context} [(
   33.18    ["Traegerlaenge L", "Streckenlast q_0", "Biegelinie y",
   33.19  	  "Randbedingungen [y 0 = (0::real), y L = 0, M_b 0 = 0, M_b L = 0]", "FunktionsVariable x"],
   33.20  	("Biegelinie", ["Biegelinien"], ["IntegrierenUndKonstanteBestimmen2"]))];
   33.21 @@ -152,7 +152,7 @@
   33.22  
   33.23  "------- Bsp 7.28 ---------------vvvvvvvvvvvvv Momentenlinie postponed";
   33.24  States.reset ();
   33.25 -CalcTree [((*WN130908  <ERROR> error in kernel </ERROR>*)
   33.26 +CalcTree @{context} [((*WN130908  <ERROR> error in kernel </ERROR>*)
   33.27    ["Traegerlaenge L", "Momentenlinie (-q_0 / L * x \<up> 3 / 6)",
   33.28  	    "Biegelinie y",
   33.29  	    "Randbedingungen [y L = 0, y' L = 0]",
   33.30 @@ -166,7 +166,7 @@
   33.31  
   33.32  "------- Bsp 7.69";
   33.33  States.reset ();
   33.34 -CalcTree [(
   33.35 +CalcTree @{context} [(
   33.36    ["Traegerlaenge L", "Streckenlast q_0", "Biegelinie y",
   33.37  	  "Randbedingungen [y 0 = (0::real), y L = 0, y' 0 = 0, y' L = 0]", "FunktionsVariable x"],
   33.38  	("Biegelinie", ["Biegelinien"], ["IntegrierenUndKonstanteBestimmen2"]))];
   33.39 @@ -186,7 +186,7 @@
   33.40  
   33.41  "------- Bsp 7.70";
   33.42  States.reset ();
   33.43 -CalcTree [(
   33.44 +CalcTree @{context} [(
   33.45    ["Traegerlaenge L", "Streckenlast q_0", "Biegelinie y",
   33.46  	  "Randbedingungen [Q 0 = q_0 * L, M_b L = 0, y 0 = (0::real), y' 0 = 0]", "FunktionsVariable x"],
   33.47  	("Biegelinie", ["Biegelinien"], ["IntegrierenUndKonstanteBestimmen2"] ))];
   33.48 @@ -251,7 +251,7 @@
   33.49  Operand:   [c_4] :: 'b list
   33.50  \-------------------------------------------------------/
   33.51  
   33.52 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   33.53 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   33.54  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   33.55  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   33.56  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   33.57 @@ -284,7 +284,7 @@
   33.58  val (dI',pI',mI') =
   33.59    ("Biegelinie",["LINEAR", "system"],["no_met"]);
   33.60  val p = e_pos'; val c = []; 
   33.61 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   33.62 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   33.63  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   33.64  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   33.65  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   33.66 @@ -304,7 +304,7 @@
   33.67  
   33.68  "------- Bsp 7.71";
   33.69  States.reset ();
   33.70 -CalcTree [(["Traegerlaenge L", "Streckenlast q_0", "Biegelinie y",
   33.71 +CalcTree @{context} [(["Traegerlaenge L", "Streckenlast q_0", "Biegelinie y",
   33.72  	     "Randbedingungen [M_b L = 0, y 0 = (0::real), y L = 0, y' 0 = 0]",
   33.73  	     "FunktionsVariable x", "GleichungsVariablen [c, c_2, c_3, c_4]",
   33.74  	     "AbleitungBiegelinie dy"],
   33.75 @@ -325,7 +325,7 @@
   33.76  
   33.77  "------- Bsp 7.72a ---------------vvvvvvvvvvvvv Momentenlinie postponed";
   33.78  States.reset ();
   33.79 -CalcTree [(["Traegerlaenge L",
   33.80 +CalcTree @{context} [(["Traegerlaenge L",
   33.81  	    "Momentenlinie ((q_0 * L)/ 6 * x - q_0 /(6 * L) * x \<up> ^3)",
   33.82  	    "Biegelinie y",
   33.83  	    "Randbedingungen [y 0 = (0::real), y L = 0]",
   33.84 @@ -339,7 +339,7 @@
   33.85  
   33.86  "------- Bsp 7.72b";
   33.87  States.reset ();
   33.88 -CalcTree [(["Traegerlaenge L", "Streckenlast (q_0 / L * x)", "Biegelinie y",
   33.89 +CalcTree @{context} [(["Traegerlaenge L", "Streckenlast (q_0 / L * x)", "Biegelinie y",
   33.90  	    "Randbedingungen [M_b 0 = 0, M_b L = 0, y 0 = (0::real), y L = 0]",
   33.91  	    "FunktionsVariable x", "GleichungsVariablen [c, c_2, c_3, c_4]",
   33.92  	    "AbleitungBiegelinie dy"],
   33.93 @@ -360,7 +360,7 @@
   33.94  
   33.95  "------- Bsp 7.73 ---------------vvvvvvvvvvvvv Momentenlinie postponed";
   33.96  States.reset ();
   33.97 -CalcTree [(["Traegerlaenge L", "Momentenlinie ???",(*description unclear*)
   33.98 +CalcTree @{context} [(["Traegerlaenge L", "Momentenlinie ???",(*description unclear*)
   33.99  	    "Biegelinie y",
  33.100  	    "Randbedingungen [y L = 0, y' L = 0]",
  33.101  	    "FunktionsVariable x"],
  33.102 @@ -386,7 +386,7 @@
  33.103    ("Biegelinie",["normalise", "4x4", "LINEAR", "system"],
  33.104     ["EqSystem", "normalise", "4x4"]);
  33.105  val p = e_pos'; val c = []; 
  33.106 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  33.107 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  33.108  val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
  33.109  val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
  33.110  val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
    34.1 --- a/test/Tools/isac/Knowledge/equation.sml	Wed Oct 19 15:39:15 2022 +0200
    34.2 +++ b/test/Tools/isac/Knowledge/equation.sml	Thu Oct 20 10:23:38 2022 +0200
    34.3 @@ -18,7 +18,7 @@
    34.4  "----------- CAS input -------------------------------------------";
    34.5  "----------- CAS input -------------------------------------------";
    34.6  States.reset ();
    34.7 -CalcTree [([], References.empty)];
    34.8 +CalcTree @{context} [([], References.empty)];
    34.9  Iterator 1;
   34.10  moveActiveRoot 1;
   34.11  replaceFormula 1 "solve (x+1=2, x)";
    35.1 --- a/test/Tools/isac/Knowledge/inssort.sml	Wed Oct 19 15:39:15 2022 +0200
    35.2 +++ b/test/Tools/isac/Knowledge/inssort.sml	Thu Oct 20 10:23:38 2022 +0200
    35.3 @@ -2,7 +2,8 @@
    35.4     Author: Walther Neuper 17.6.00
    35.5     (c) copyright due to lincense terms.
    35.6  
    35.7 -Strange ERROR "Undefined fact: "xfoldr_Nil""
    35.8 +S
    35.9 +trange ERROR "Undefined fact: "xfoldr_Nil""
   35.10  *)
   35.11  "-----------------------------------------------------------------------------";
   35.12  "-----------------------------------------------------------------------------";
   35.13 @@ -12,7 +13,7 @@
   35.14  "----------- insertion sort by rewrite stepwise ------------------------------";
   35.15  "----------- insertion sort with ruleset -------------------------------------";
   35.16  "----------- insertion sort with MathEngine ----------------------------------";
   35.17 -"----------- insertion sort: CAS-command -------------------------------------";
   35.18 +(*"----------- insertion sort: CAS-command -------------------------------------";*)
   35.19  "----------- insertion sort: met_Prog_sort_ins_steps -------------------------";
   35.20  "-----------------------------------------------------------------------------";
   35.21  "-----------------------------------------------------------------------------";
   35.22 @@ -101,7 +102,7 @@
   35.23  val (dI',pI',mI') = ("InsSort", ["insertion", "SORT", "Programming"], 
   35.24    ["Programming", "SORT", "insertion"]);
   35.25  val p = e_pos'; val c = []; 
   35.26 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))]; (*nxt = ("Model_Problem",..*)
   35.27 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))]; (*nxt = ("Model_Problem",..*)
   35.28  val (p,_,f,nxt,_,pt) = me nxt p c pt;
   35.29  val (p,_,f,nxt,_,pt) = me nxt p c pt;
   35.30  val (p,_,f,nxt,_,pt) = me nxt p c pt;
   35.31 @@ -116,14 +117,15 @@
   35.32    | _ => error "--- insertion sort with MathEngine CHANGED 1"
   35.33  else error "--- insertion sort with MathEngine CHANGED 2";
   35.34  
   35.35 +(*POSTPONE CORRECTION AT END OF TRANSITION TO Isabelle/PIDE/Isac (~ Cas_Cmd)
   35.36  "----------- insertion sort: CAS-command -------------------------------------";
   35.37  "----------- insertion sort: CAS-command -------------------------------------";
   35.38  "----------- insertion sort: CAS-command -------------------------------------";
   35.39 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [([], References.empty)];
   35.40 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [([], References.empty)];
   35.41  (*+*)if ((fst p) |> get_obj g_origin pt |> LibraryC.fst3) = []
   35.42  (*+*)then () else error "check correct of get_ctxt at start of (sub-)problem";
   35.43  val (_,(_,c,(pt,p))) = Step_Solve.by_term (pt, p) "Sort {||1, 3, 2||}";
   35.44 -Test_Tool.show_pt pt; (*this trick \<up> \<up> \<up> micked input of \<up> \<up> \<up> \<up> \<up> \<up>  in the front-end.
   35.45 +Test_Tool.show_pt pt; ( *this trick \<up> \<up> \<up> micked input of \<up> \<up> \<up> \<up> \<up> \<up>  in the front-end.
   35.46                the trick worked in changeset fbaff8cf0179, it does not work in 59c5dd27d589
   35.47                (TODO hg bisect ?) and raises the ERROR Undefined fact: "xfoldr_Nil" here.
   35.48                                                                                     vvvvv
   35.49 @@ -162,7 +164,7 @@
   35.50  "----------- insertion sort: met_Prog_sort_ins_steps -------------------------";
   35.51  "----------- insertion sort: met_Prog_sort_ins_steps -------------------------";
   35.52  States.reset ();
   35.53 -CalcTree
   35.54 +CalcTree @{context}
   35.55  [(["unsorted {||1, 3, 2||}", "sorted s_s"], 
   35.56    ("InsSort", ["insertion", "SORT", "Programming"], 
   35.57    ["Programming", "SORT", "insertion_steps"]))];
    36.1 --- a/test/Tools/isac/Knowledge/integrate.sml	Wed Oct 19 15:39:15 2022 +0200
    36.2 +++ b/test/Tools/isac/Knowledge/integrate.sml	Thu Oct 20 10:23:38 2022 +0200
    36.3 @@ -376,7 +376,7 @@
    36.4  val p = e_pos'; val c = []; 
    36.5  "----- step 0: returns nxt = Model_Problem ---";
    36.6  val (p,_,f,nxt,_,pt) = 
    36.7 -    CalcTreeTEST 
    36.8 +    Test_Code.init_calc @{context} 
    36.9          [(["functionTerm (x \<up> 2 + 1)", "integrateBy x", "antiDerivative FF"],
   36.10            ("Integrate", ["integrate", "function"], ["diff", "integration"]))];
   36.11  "----- step 1: returns nxt = Add_Given \"functionTerm (x \<up> 2 + 1)\" ---";
   36.12 @@ -407,7 +407,7 @@
   36.13  "----------- autoCalculate [diff,integration] -----------";
   36.14  "----------- autoCalculate [diff,integration] -----------";
   36.15  States.reset ();
   36.16 -CalcTree
   36.17 +CalcTree @{context}
   36.18      [(["functionTerm (x \<up> 2 + 1)", "integrateBy x", "antiDerivative FF"], 
   36.19        ("Integrate", ["integrate", "function"], ["diff", "integration"]))];
   36.20  Iterator 1;
   36.21 @@ -429,7 +429,7 @@
   36.22    ("Integrate",["named", "integrate", "function"],
   36.23     ["diff", "integration", "named"]);
   36.24  val p = e_pos'; val c = []; 
   36.25 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   36.26 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   36.27  val (p,_,f,nxt,_,pt) = me nxt p c pt;
   36.28  val (p,_,f,nxt,_,pt) = me nxt p c pt;
   36.29  val (p,_,f,nxt,_,pt) = me nxt p c pt(*nxt <- Add_Find *);
   36.30 @@ -454,7 +454,7 @@
   36.31    ("Biegelinie",["named", "integrate", "function"],
   36.32     ["diff", "integration", "named"]);
   36.33  val p = e_pos'; val c = [];
   36.34 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   36.35 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   36.36  val (p,_,f,nxt,_,pt) = me nxt p c pt;
   36.37  val (p,_,f,nxt,_,pt) = me nxt p c pt;
   36.38  (*Error Tac Q not in ...*)
    37.1 --- a/test/Tools/isac/Knowledge/inverse_z_transform.sml	Wed Oct 19 15:39:15 2022 +0200
    37.2 +++ b/test/Tools/isac/Knowledge/inverse_z_transform.sml	Thu Oct 20 10:23:38 2022 +0200
    37.3 @@ -26,7 +26,7 @@
    37.4    "functionName X_z", "stepResponse (x[n::real]::bool)"];
    37.5  val (dI, pI, mI) = ("Isac_Knowledge", ["Inverse", "Z_Transform", "SignalProcessing"], 
    37.6     ["SignalProcessing", "Z_Transform", "Inverse_sub"]);
    37.7 -(*[], Pbl*)val (p,_,fb,nxt,_,pt)  = CalcTreeTEST [(fmz, (dI,pI,mI))]; (*Model_Problem*)
    37.8 +(*[], Pbl*)val (p,_,fb,nxt,_,pt)  = Test_Code.init_calc @{context} [(fmz, (dI,pI,mI))]; (*Model_Problem*)
    37.9  (*[], Pbl*)val (p,_,fb,nxt,_,pt) = me nxt p [] pt; (*Add_Given "filterExpression (X z = ...*)
   37.10  (*[], Pbl*)val (p,_,fb,nxt,_,pt) = me nxt p [] pt; (*Add_Find "stepResponse (x [n])")*)
   37.11  (*[], Pbl*)val (p,_,fb,nxt,_,pt) = me nxt p [] pt; (*Specify_Theory "Isac_Knowledge"*)
   37.12 @@ -185,7 +185,7 @@
   37.13    "functionName X_z", "stepResponse (x[n::real]::bool)"];
   37.14  val (dI, pI, mI) = ("Isac_Knowledge", ["Inverse", "Z_Transform", "SignalProcessing"], 
   37.15     ["SignalProcessing", "Z_Transform", "Inverse_sub"]);
   37.16 -CalcTree [(fmz, (dI,pI,mI))];
   37.17 +CalcTree @{context} [(fmz, (dI,pI,mI))];
   37.18  Iterator 1;
   37.19  moveActiveRoot 1;
   37.20  autoCalculate 1 CompleteCalc; 
    38.1 --- a/test/Tools/isac/Knowledge/logexp.sml	Wed Oct 19 15:39:15 2022 +0200
    38.2 +++ b/test/Tools/isac/Knowledge/logexp.sml	Thu Oct 20 10:23:38 2022 +0200
    38.3 @@ -41,7 +41,7 @@
    38.4     ["Test", "solve_log"]);
    38.5  val p = e_pos'; val c = []; 
    38.6  (*============ inhibit exn 110726 ==============================================
    38.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    38.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    38.9  val (p,_,f,nxt,_,pt) = me nxt p c pt;
   38.10  val (p,_,f,nxt,_,pt) = me nxt p c pt;
   38.11  val (p,_,f,nxt,_,pt) = me nxt p c pt;
    39.1 --- a/test/Tools/isac/Knowledge/partial_fractions.sml	Wed Oct 19 15:39:15 2022 +0200
    39.2 +++ b/test/Tools/isac/Knowledge/partial_fractions.sml	Thu Oct 20 10:23:38 2022 +0200
    39.3 @@ -30,7 +30,7 @@
    39.4    "functionName X_z", "stepResponse (x[n::real]::bool)"];
    39.5  val (dI,pI,mI) = ("Isac_Knowledge", ["Inverse", "Z_Transform", "SignalProcessing"], 
    39.6    ["SignalProcessing", "Z_Transform", "Inverse"]);
    39.7 -val (p,_,f,nxt,_,pt)  = CalcTreeTEST [(fmz, (dI,pI,mI))]; 
    39.8 +val (p,_,f,nxt,_,pt)  = Test_Code.init_calc @{context} [(fmz, (dI,pI,mI))]; 
    39.9  val (p,_,f,nxt,_,pt) = me nxt p [] pt; "Add_Given";
   39.10  val (p,_,f,nxt,_,pt) = me nxt p [] pt; "Add_Find";
   39.11  val (p,_,f,nxt,_,pt) = me nxt p [] pt; "Specify_Theory";
   39.12 @@ -115,7 +115,7 @@
   39.13      ["partial_fraction", "rational", "simplification"],
   39.14      ["simplification", "of_rationals", "to_partial_fraction"]);
   39.15  (*[ ], Pbl*)val (p,_,f,nxt,_,pt) =
   39.16 -              CalcTreeTEST [(fmz, (dI',pI',mI'))]; (*nxt = Model_Problem*)
   39.17 +              Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))]; (*nxt = Model_Problem*)
   39.18  (*[ ], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Add_Given "functionTerm (3 / (z * (z - 1 / 4 + - 1 / 8 * (1 / z))))")*)
   39.19  (*[ ], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Add_Given "solveFor z")*)
   39.20  (*[ ], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Add_Find "decomposedFunction p_p")*)
   39.21 @@ -247,7 +247,7 @@
   39.22      ("Partial_Fractions", 
   39.23        ["partial_fraction", "rational", "simplification"],
   39.24        ["simplification", "of_rationals", "to_partial_fraction"]);
   39.25 -CalcTree [(fmz, (dI' ,pI' ,mI'))];
   39.26 +CalcTree @{context} [(fmz, (dI' ,pI' ,mI'))];
   39.27  Iterator 1;
   39.28  moveActiveRoot 1;
   39.29  autoCalculate 1 CompleteCalc; 
   39.30 @@ -354,7 +354,7 @@
   39.31         "decomposedFunction p_p'''"],
   39.32        ("Isac_Knowledge", ["partial_fraction", "rational", "simplification"],
   39.33         ["simplification", "of_rationals", "to_partial_fraction"]))
   39.34 -val (p,_,f,nxt,_,pt)  = CalcTreeTEST [(fmz_from_Subproblem_of_Inverse_sub)]; 
   39.35 +val (p,_,f,nxt,_,pt)  = Test_Code.init_calc @{context} [(fmz_from_Subproblem_of_Inverse_sub)]; 
   39.36  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   39.37  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   39.38  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   39.39 @@ -418,7 +418,7 @@
   39.40         "decomposedFunction p_p'''"],
   39.41        ("Isac_Knowledge", ["partial_fraction", "rational", "simplification"],
   39.42         ["simplification", "of_rationals", "to_partial_fraction"]));
   39.43 -CalcTree [fmz_from_Subproblem_of_Inverse_sub];
   39.44 +CalcTree @{context} [fmz_from_Subproblem_of_Inverse_sub];
   39.45  Iterator 1;
   39.46  moveActiveRoot 1;
   39.47  (*
    40.1 --- a/test/Tools/isac/Knowledge/poly-2.sml	Wed Oct 19 15:39:15 2022 +0200
    40.2 +++ b/test/Tools/isac/Knowledge/poly-2.sml	Thu Oct 20 10:23:38 2022 +0200
    40.3 @@ -635,7 +635,7 @@
    40.4    ("Poly",["polynomial", "simplification"],
    40.5     ["simplification", "for_polynomials"]);
    40.6  val p = e_pos'; val c = []; 
    40.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    40.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    40.9  (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt;(*Add_Given "Term\n ((5 * x \<up> 2 + 3) * (2 * x \<up> 7 + 3) -\n  (3 * x \<up> 5 + 8) * (6 * x \<up> 4 - 1))"*)
   40.10  (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt;(*Add_Find "normalform N"*)
   40.11  
   40.12 @@ -666,7 +666,7 @@
   40.13  "-------- interSteps for Schalk 299a -----------------------------------------------------------";
   40.14  "-------- interSteps for Schalk 299a -----------------------------------------------------------";
   40.15  States.reset ();
   40.16 -CalcTree
   40.17 +CalcTree @{context}
   40.18  [(["Term ((x - y)*(x + (y::real)))", "normalform N"], 
   40.19    ("Poly",["polynomial", "simplification"],
   40.20    ["simplification", "for_polynomials"]))];
    41.1 --- a/test/Tools/isac/Knowledge/polyeq-1.sml	Wed Oct 19 15:39:15 2022 +0200
    41.2 +++ b/test/Tools/isac/Knowledge/polyeq-1.sml	Thu Oct 20 10:23:38 2022 +0200
    41.3 @@ -411,7 +411,7 @@
    41.4  TODO: change to "equality (x + - 1*x = (0::real))"
    41.5        and search for an appropriate problem and method.
    41.6  
    41.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    41.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    41.9  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.10  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.11  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.12 @@ -425,7 +425,7 @@
   41.13  val fmz = ["equality (0 = (0::real))", "solveFor x", "solutions L"];
   41.14  val (dI',pI',mI') = ("PolyEq",["degree_0", "polynomial", "univariate", "equation"],
   41.15                       ["PolyEq", "solve_d0_polyeq_equation"]);
   41.16 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   41.17 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   41.18  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.19  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.20  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.21 @@ -443,7 +443,7 @@
   41.22  val fmz = ["equality (- 1/8 + (- 1/4)*z + z \<up> 2 = (0::real))", "solveFor z", "solutions L"];
   41.23  val (dI',pI',mI') =
   41.24    ("Isac_Knowledge", ["pqFormula", "degree_2", "polynomial", "univariate", "equation"], ["no_met"]);
   41.25 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   41.26 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   41.27  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.28  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.29  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.30 @@ -472,7 +472,7 @@
   41.31  "----- d2_pqformula1_neg ------";
   41.32  val fmz = ["equality (2 +(- 1)*x + x \<up> 2 = (0::real))", "solveFor x", "solutions L"];
   41.33  val (dI',pI',mI') = ("PolyEq",["pqFormula", "degree_2", "polynomial", "univariate", "equation"], ["PolyEq", "solve_d2_polyeq_pq_equation"]);
   41.34 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   41.35 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   41.36  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.37  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.38  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.39 @@ -498,7 +498,7 @@
   41.40  val fmz = ["equality (- 2 +(- 1)*x + 1*x \<up> 2 = 0)", "solveFor x", "solutions L"];
   41.41  val (dI',pI',mI') = ("PolyEq",["pqFormula", "degree_2", "polynomial", "univariate", "equation"],
   41.42                       ["PolyEq", "solve_d2_polyeq_pq_equation"]);
   41.43 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   41.44 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   41.45  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.46  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.47  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.48 @@ -520,7 +520,7 @@
   41.49  val fmz = ["equality (- 2 + x + x \<up> 2 = 0)", "solveFor x", "solutions L"];
   41.50  val (dI',pI',mI') = ("PolyEq",["pqFormula", "degree_2", "polynomial", "univariate", "equation"],
   41.51                       ["PolyEq", "solve_d2_polyeq_pq_equation"]);
   41.52 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   41.53 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   41.54  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.55  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.56  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.57 @@ -541,7 +541,7 @@
   41.58  val fmz = ["equality (2 + x + x \<up> 2 = 0)", "solveFor x", "solutions L"];
   41.59  val (dI',pI',mI') = ("PolyEq",["pqFormula", "degree_2", "polynomial", "univariate", "equation"],
   41.60                       ["PolyEq", "solve_d2_polyeq_pq_equation"]);
   41.61 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   41.62 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   41.63  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.64  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.65  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.66 @@ -561,7 +561,7 @@
   41.67  val fmz = ["equality (- 2 + x + 1*x \<up> 2 = 0)", "solveFor x", "solutions L"];
   41.68  val (dI',pI',mI') = ("PolyEq",["pqFormula", "degree_2", "polynomial", "univariate", "equation"],
   41.69                       ["PolyEq", "solve_d2_polyeq_pq_equation"]);
   41.70 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   41.71 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   41.72  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.73  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.74  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.75 @@ -580,7 +580,7 @@
   41.76  val fmz = ["equality (1*x +   x \<up> 2 = 0)", "solveFor x", "solutions L"];
   41.77  val (dI',pI',mI') = ("PolyEq",["pqFormula", "degree_2", "polynomial", "univariate", "equation"],
   41.78                       ["PolyEq", "solve_d2_polyeq_pq_equation"]);
   41.79 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   41.80 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   41.81  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.82  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.83  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.84 @@ -599,7 +599,7 @@
   41.85  val fmz = ["equality (1*x + 1*x \<up> 2 = 0)", "solveFor x", "solutions L"];
   41.86  val (dI',pI',mI') = ("PolyEq",["pqFormula", "degree_2", "polynomial", "univariate", "equation"],
   41.87                       ["PolyEq", "solve_d2_polyeq_pq_equation"]);
   41.88 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   41.89 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   41.90  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.91  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.92  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   41.93 @@ -619,7 +619,7 @@
   41.94  val fmz = ["equality (  x +   x \<up> 2 = 0)", "solveFor x", "solutions L"];
   41.95  val (dI',pI',mI') = ("PolyEq",["pqFormula", "degree_2", "polynomial", "univariate", "equation"],
   41.96                       ["PolyEq", "solve_d2_polyeq_pq_equation"]);
   41.97 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   41.98 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   41.99  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.100  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.101  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.102 @@ -638,7 +638,7 @@
  41.103  val fmz = ["equality (x + 1*x \<up> 2 = 0)", "solveFor x", "solutions L"];
  41.104  val (dI',pI',mI') = ("PolyEq",["pqFormula", "degree_2", "polynomial", "univariate", "equation"],
  41.105                       ["PolyEq", "solve_d2_polyeq_pq_equation"]);
  41.106 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  41.107 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  41.108  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.109  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.110  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.111 @@ -657,7 +657,7 @@
  41.112  val fmz = ["equality (-4 + x \<up> 2 = 0)", "solveFor x", "solutions L"];
  41.113  val (dI',pI',mI') = ("PolyEq",["pqFormula", "degree_2", "polynomial", "univariate", "equation"],
  41.114                       ["PolyEq", "solve_d2_polyeq_pq_equation"]);
  41.115 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  41.116 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  41.117  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.118  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.119  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.120 @@ -676,7 +676,7 @@
  41.121  val fmz = ["equality (4 + 1*x \<up> 2 = 0)", "solveFor x", "solutions L"];
  41.122  val (dI',pI',mI') = ("PolyEq",["pqFormula", "degree_2", "polynomial", "univariate", "equation"],
  41.123                       ["PolyEq", "solve_d2_polyeq_pq_equation"]);
  41.124 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  41.125 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  41.126  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.127  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.128  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.129 @@ -693,7 +693,7 @@
  41.130  val fmz = ["equality (- 1 +(- 1)*x + 2*x \<up> 2 = 0)", "solveFor x", "solutions L"];
  41.131  val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
  41.132                       ["PolyEq", "solve_d2_polyeq_abc_equation"]);
  41.133 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  41.134 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  41.135  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.136  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.137  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.138 @@ -710,7 +710,7 @@
  41.139  val fmz = ["equality (1 +(- 1)*x + 2*x \<up> 2 = 0)", "solveFor x", "solutions L"];
  41.140  val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
  41.141                       ["PolyEq", "solve_d2_polyeq_abc_equation"]);
  41.142 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  41.143 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  41.144  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.145  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.146  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.147 @@ -730,7 +730,7 @@
  41.148  val fmz = ["equality (- 1 + x + 2*x \<up> 2 = 0)", "solveFor x", "solutions L"];
  41.149  val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
  41.150                       ["PolyEq", "solve_d2_polyeq_abc_equation"]);
  41.151 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  41.152 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  41.153  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.154  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.155  
  41.156 @@ -750,7 +750,7 @@
  41.157  val fmz = ["equality (1 + x + 2*x \<up> 2 = 0)", "solveFor x", "solutions L"];
  41.158  val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
  41.159                       ["PolyEq", "solve_d2_polyeq_abc_equation"]);
  41.160 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  41.161 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  41.162  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.163  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.164  
  41.165 @@ -767,7 +767,7 @@
  41.166  val fmz = ["equality (- 2 + 1*x + x \<up> 2 = 0)", "solveFor x", "solutions L"];
  41.167  val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
  41.168                       ["PolyEq", "solve_d2_polyeq_abc_equation"]);
  41.169 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  41.170 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  41.171  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.172  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.173  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.174 @@ -781,7 +781,7 @@
  41.175  val fmz = ["equality ( 2 + 1*x + x \<up> 2 = 0)", "solveFor x", "solutions L"];
  41.176  val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
  41.177                       ["PolyEq", "solve_d2_polyeq_abc_equation"]);
  41.178 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  41.179 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  41.180  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.181  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.182  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.183 @@ -797,7 +797,7 @@
  41.184  val fmz = ["equality (- 2 + x + x \<up> 2 = 0)", "solveFor x", "solutions L"];
  41.185  val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
  41.186                       ["PolyEq", "solve_d2_polyeq_abc_equation"]);
  41.187 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  41.188 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  41.189  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.190  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.191  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.192 @@ -811,7 +811,7 @@
  41.193  val fmz = ["equality ( 2 + x + x \<up> 2 = 0)", "solveFor x", "solutions L"];
  41.194  val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
  41.195                       ["PolyEq", "solve_d2_polyeq_abc_equation"]);
  41.196 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  41.197 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  41.198  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.199  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.200  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.201 @@ -827,7 +827,7 @@
  41.202  val fmz = ["equality (-8 + 2*x \<up> 2 = 0)", "solveFor x", "solutions L"];
  41.203  val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
  41.204                       ["PolyEq", "solve_d2_polyeq_abc_equation"]);
  41.205 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  41.206 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  41.207  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.208  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.209  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.210 @@ -841,7 +841,7 @@
  41.211  val fmz = ["equality ( 8+ 2*x \<up> 2 = 0)", "solveFor x", "solutions L"];
  41.212  val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
  41.213                       ["PolyEq", "solve_d2_polyeq_abc_equation"]);
  41.214 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  41.215 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  41.216  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.217  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.218  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.219 @@ -855,7 +855,7 @@
  41.220  (*EP- 14*)
  41.221  val fmz = ["equality (-4 + x \<up> 2 = 0)", "solveFor x", "solutions L"];
  41.222  val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"], ["PolyEq", "solve_d2_polyeq_abc_equation"]);
  41.223 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  41.224 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  41.225  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.226  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.227  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.228 @@ -869,7 +869,7 @@
  41.229  
  41.230  val fmz = ["equality ( 4+ x \<up> 2 = 0)", "solveFor x", "solutions L"];
  41.231  val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"], ["PolyEq", "solve_d2_polyeq_abc_equation"]);
  41.232 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  41.233 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  41.234  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.235  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.236  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.237 @@ -884,7 +884,7 @@
  41.238  val fmz = ["equality (2*x + 2*x \<up> 2 = 0)", "solveFor x", "solutions L"];
  41.239  val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
  41.240                       ["PolyEq", "solve_d2_polyeq_abc_equation"]);
  41.241 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  41.242 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  41.243  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.244  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.245  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.246 @@ -898,7 +898,7 @@
  41.247  val fmz = ["equality (1*x + x \<up> 2 = 0)", "solveFor x", "solutions L"];
  41.248  val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
  41.249                       ["PolyEq", "solve_d2_polyeq_abc_equation"]);
  41.250 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  41.251 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  41.252  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.253  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.254  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.255 @@ -913,7 +913,7 @@
  41.256  val fmz = ["equality (x + 2 * x \<up> 2 = (0::real))", "solveFor (x::real)", "solutions L"];
  41.257  val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
  41.258                       ["PolyEq", "solve_d2_polyeq_abc_equation"]);
  41.259 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  41.260 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  41.261  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.262  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.263  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.264 @@ -933,7 +933,7 @@
  41.265  val fmz = ["equality (x + x \<up> 2 = 0)", "solveFor x", "solutions L"];
  41.266  val (dI',pI',mI') = ("PolyEq",["abcFormula", "degree_2", "polynomial", "univariate", "equation"],
  41.267                       ["PolyEq", "solve_d2_polyeq_abc_equation"]);
  41.268 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  41.269 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  41.270  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.271  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.272  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.273 @@ -958,7 +958,7 @@
  41.274   val (dI',pI',mI') =
  41.275       ("PolyEq",["degree_2", "expanded", "univariate", "equation"],
  41.276        ["PolyEq", "complete_square"]);
  41.277 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  41.278 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  41.279  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.280  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.281  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.282 @@ -1071,7 +1071,7 @@
  41.283   val (dI',pI',mI') =
  41.284       ("PolyEq",["degree_2", "expanded", "univariate", "equation"],
  41.285        ["PolyEq", "complete_square"]);
  41.286 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  41.287 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  41.288  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.289   val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.290   val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.291 @@ -1090,7 +1090,7 @@
  41.292   val (dI',pI',mI') =
  41.293       ("PolyEq",["degree_2", "expanded", "univariate", "equation"],
  41.294        ["PolyEq", "complete_square"]);
  41.295 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  41.296 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  41.297  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.298   val (p,_,f,nxt,_,pt) = me nxt p [] pt;
  41.299   val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    42.1 --- a/test/Tools/isac/Knowledge/polyeq-2.sml	Wed Oct 19 15:39:15 2022 +0200
    42.2 +++ b/test/Tools/isac/Knowledge/polyeq-2.sml	Thu Oct 20 10:23:38 2022 +0200
    42.3 @@ -31,7 +31,7 @@
    42.4   val (dI',pI',mI') =
    42.5       ("PolyEq",["degree_2", "expanded", "univariate", "equation"],
    42.6        ["PolyEq", "complete_square"]);
    42.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    42.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    42.9  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   42.10  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   42.11  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   42.12 @@ -69,7 +69,7 @@
   42.13   val (dI',pI',mI') =
   42.14       ("PolyEq",["degree_2", "expanded", "univariate", "equation"],
   42.15        ["PolyEq", "complete_square"]);
   42.16 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   42.17 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   42.18  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   42.19  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   42.20  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   42.21 @@ -96,7 +96,7 @@
   42.22  val (dI',pI',mI') =
   42.23       ("PolyEq",["degree_2", "expanded", "univariate", "equation"],
   42.24        ["PolyEq", "complete_square"]);
   42.25 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   42.26 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   42.27  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   42.28  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   42.29  val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   42.30 @@ -121,7 +121,7 @@
   42.31  (* Refine.refine fmz ["univariate", "equation"];
   42.32  *)
   42.33  val (dI',pI',mI') = ("PolyEq",["univariate", "equation"],["no_met"]);
   42.34 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   42.35 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   42.36  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   42.37  (* val nxt =
   42.38    ("Model_Problem",
   42.39 @@ -159,7 +159,7 @@
   42.40  val fmz = ["equality ((x+1)*(x+2) - (3*x - 2) \<up> 2=(2*x - 1) \<up> 2+(3*x - 1)*(x+1))",
   42.41  	   "solveFor x", "solutions L"];
   42.42  val (dI',pI',mI') = ("PolyEq",["univariate", "equation"],["no_met"]);
   42.43 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   42.44 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   42.45  (*val nxt = ("Refine_Tacitly",Refine_Tacitly ["univariate", "equation"])*)
   42.46  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   42.47  (* val nxt =
   42.48 @@ -199,7 +199,7 @@
   42.49  (* val fmz = ["equality (1 + x \<up> 2 =0)", "solveFor x", "solutions L"];*)
   42.50  (*val fmz = ["equality (0 =0)", "solveFor x", "solutions L"];*)
   42.51  val (dI',pI',mI') = ("PolyEq",["univariate", "equation"],["no_met"]);
   42.52 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   42.53 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   42.54  
   42.55  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   42.56  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   42.57 @@ -263,7 +263,7 @@
   42.58  "----------- interSteps ([1],Res); on Schalk Is86Bsp5-------------";
   42.59  "----------- interSteps ([1],Res); on Schalk Is86Bsp5-------------";
   42.60  States.reset ();
   42.61 -CalcTree
   42.62 +CalcTree @{context}
   42.63  [(["equality ((3::real)*x - 1 - (5*x - (2 - 4*x)) = - 11)", "solveFor x", "solutions L"], 
   42.64    ("PolyEq",["univariate", "equation"],["no_met"]))];
   42.65  Iterator 1;
    43.1 --- a/test/Tools/isac/Knowledge/polyminus.sml	Wed Oct 19 15:39:15 2022 +0200
    43.2 +++ b/test/Tools/isac/Knowledge/polyminus.sml	Thu Oct 20 10:23:38 2022 +0200
    43.3 @@ -346,7 +346,7 @@
    43.4  "----------- me simplification.for_polynomials.with_minus";
    43.5  val c = [];
    43.6  val (p,_,f,nxt,_,pt) = 
    43.7 -      CalcTreeTEST 
    43.8 +      Test_Code.init_calc @{context} 
    43.9          [(["Term (5*e + 6*f - 8*g - 9 - 7*e - 4*f + 10*g + 12)",
   43.10             "normalform N"],
   43.11  	          ("PolyMinus",["plus_minus", "polynom", "vereinfachen"],
   43.12 @@ -372,7 +372,7 @@
   43.13  "----------- pbl polynom vereinfachen p.33 -----------------------";
   43.14  "----------- 140 c ---";
   43.15  States.reset ();
   43.16 -CalcTree [(["Term (5*e + 6*f - 8*g - 9 - 7*e - 4*f + 10*g + 12)",
   43.17 +CalcTree @{context} [(["Term (5*e + 6*f - 8*g - 9 - 7*e - 4*f + 10*g + 12)",
   43.18  	    "normalform N"],
   43.19  	   ("PolyMinus",["plus_minus", "polynom", "vereinfachen"],
   43.20  	    ["simplification", "for_polynomials", "with_minus"]))];
   43.21 @@ -385,7 +385,7 @@
   43.22  
   43.23  "======= 140 d ---";
   43.24  States.reset ();
   43.25 -CalcTree [(["Term (-r - 2*s - 3*t + 5 + 4*r + 8*s - 5*t - 2)",
   43.26 +CalcTree @{context} [(["Term (-r - 2*s - 3*t + 5 + 4*r + 8*s - 5*t - 2)",
   43.27  	    "normalform N"],
   43.28  	   ("PolyMinus",["plus_minus", "polynom", "vereinfachen"],
   43.29  	    ["simplification", "for_polynomials", "with_minus"]))];
   43.30 @@ -398,7 +398,7 @@
   43.31  
   43.32  "======= 139 c ---";
   43.33  States.reset ();
   43.34 -CalcTree [(["Term (3*e - 6*f - 8*e - 4*f + 5*e + 7*f)",
   43.35 +CalcTree @{context} [(["Term (3*e - 6*f - 8*e - 4*f + 5*e + 7*f)",
   43.36  	    "normalform N"],
   43.37  	   ("PolyMinus",["plus_minus", "polynom", "vereinfachen"],
   43.38  	    ["simplification", "for_polynomials", "with_minus"]))];
   43.39 @@ -411,7 +411,7 @@
   43.40  
   43.41  "======= 139 b ---";
   43.42  States.reset ();
   43.43 -CalcTree [(["Term (8*u - 5*v - 5*u + 7*v - 6*u - 3*v)",
   43.44 +CalcTree @{context} [(["Term (8*u - 5*v - 5*u + 7*v - 6*u - 3*v)",
   43.45  	    "normalform N"],
   43.46  	   ("PolyMinus",["plus_minus", "polynom", "vereinfachen"],
   43.47  	    ["simplification", "for_polynomials", "with_minus"]))];
   43.48 @@ -424,7 +424,7 @@
   43.49  
   43.50  "======= 138 a ---";
   43.51  States.reset ();
   43.52 -CalcTree [(["Term (2*u - 3*v - 6*u + 5*v)",
   43.53 +CalcTree @{context} [(["Term (2*u - 3*v - 6*u + 5*v)",
   43.54  	    "normalform N"],
   43.55  	   ("PolyMinus",["plus_minus", "polynom", "vereinfachen"],
   43.56  	    ["simplification", "for_polynomials", "with_minus"]))];
   43.57 @@ -452,7 +452,7 @@
   43.58  "----------- pbl polynom probe -----------------------------------";
   43.59  "----------- pbl polynom probe -----------------------------------";
   43.60  States.reset ();
   43.61 -CalcTree [(["Pruefe ((5::int)*e + 6*f - 8*g - 9 - 7*e - 4*f + 10*g + 12 =\
   43.62 +CalcTree @{context} [(["Pruefe ((5::int)*e + 6*f - 8*g - 9 - 7*e - 4*f + 10*g + 12 =\
   43.63  	    \3 - 2 * e + 2 * f + 2 * (g::int))",
   43.64  	    "mitWert [e = (1::int), f = (2::int), g = (3::int)]",
   43.65  	    "Geprueft b"],
   43.66 @@ -476,7 +476,7 @@
   43.67  "----------- pbl klammer polynom vereinfachen p.34 ---------------";
   43.68  "----------- pbl klammer polynom vereinfachen p.34 ---------------";
   43.69  States.reset ();
   43.70 -CalcTree [(["Term (2*u - 5 - (3 - 4*u) + (8*u + 9))",
   43.71 +CalcTree @{context} [(["Term (2*u - 5 - (3 - 4*u) + (8*u + 9))",
   43.72  	    "normalform N"],
   43.73  	   ("PolyMinus",["klammer", "polynom", "vereinfachen"],
   43.74  	    ["simplification", "for_polynomials", "with_parentheses"]))];
   43.75 @@ -490,7 +490,7 @@
   43.76  
   43.77  "======= probe p.34 -----";
   43.78  States.reset ();
   43.79 -CalcTree [(["Pruefe (2*u - 5 - (3 - 4*u) + (8*u + 9) = 1 + 14 * (u::int))",
   43.80 +CalcTree @{context} [(["Pruefe (2*u - 5 - (3 - 4*u) + (8*u + 9) = 1 + 14 * (u::int))",
   43.81  	    "mitWert [u = (2::int)]",
   43.82  	    "Geprueft b"],
   43.83  	   ("PolyMinus",["polynom", "probe"],
   43.84 @@ -507,7 +507,7 @@
   43.85  "----------- try fun applyTactics --------------------------------";
   43.86  "----------- try fun applyTactics --------------------------------";
   43.87  States.reset ();
   43.88 -CalcTree [(["Term (5*e + 6*f - 8*g - 9 - 7*e - 4*f + 10*g + 12)",
   43.89 +CalcTree @{context} [(["Term (5*e + 6*f - 8*g - 9 - 7*e - 4*f + 10*g + 12)",
   43.90  	    "normalform N"],
   43.91  	   ("PolyMinus",["plus_minus", "polynom", "vereinfachen"],
   43.92  	    ["simplification", "for_polynomials", "with_minus"]))];
   43.93 @@ -570,7 +570,7 @@
   43.94  
   43.95  "#############################################################################";
   43.96  States.reset ();
   43.97 -CalcTree [(["Term (- (8 * g) + 10 * g + h)",
   43.98 +CalcTree @{context} [(["Term (- (8 * g) + 10 * g + h)",
   43.99  	    "normalform N"],
  43.100  	   ("PolyMinus",["plus_minus", "polynom", "vereinfachen"],
  43.101  	    ["simplification", "for_polynomials", "with_minus"]))];
  43.102 @@ -583,7 +583,7 @@
  43.103  
  43.104  "#############################################################################";
  43.105  States.reset ();
  43.106 -CalcTree [(["Term (- (8 * g) + 10 * g + f)",
  43.107 +CalcTree @{context} [(["Term (- (8 * g) + 10 * g + f)",
  43.108  	    "normalform N"],
  43.109  	   ("PolyMinus",["plus_minus", "polynom", "vereinfachen"],
  43.110  	    ["simplification", "for_polynomials", "with_minus"]))];
  43.111 @@ -628,7 +628,7 @@
  43.112  
  43.113  (*@@@@@@@*)
  43.114  States.reset ();
  43.115 -CalcTree [(["Term ((3*a + 2) * (4*a - 1))",
  43.116 +CalcTree @{context} [(["Term ((3*a + 2) * (4*a - 1))",
  43.117  	    "normalform N"],
  43.118  	   ("PolyMinus",["binom_klammer", "polynom", "vereinfachen"],
  43.119  	    ["simplification", "for_polynomials", "with_parentheses_mult"]))];
  43.120 @@ -645,7 +645,7 @@
  43.121  "----------- pbl binom polynom vereinfachen: cube ----------------";
  43.122  "----------- pbl binom polynom vereinfachen: cube ----------------";
  43.123  States.reset ();
  43.124 -CalcTree [(["Term (8*(a - q) + a - 2*q + 3*(a - 2*q))", "normalform N"],
  43.125 +CalcTree @{context} [(["Term (8*(a - q) + a - 2*q + 3*(a - 2*q))", "normalform N"],
  43.126  	   ("PolyMinus",["binom_klammer", "polynom", "vereinfachen"],
  43.127  	    ["simplification", "for_polynomials", "with_parentheses_mult"]))];
  43.128  moveActiveRoot 1;
    44.1 --- a/test/Tools/isac/Knowledge/rateq.sml	Wed Oct 19 15:39:15 2022 +0200
    44.2 +++ b/test/Tools/isac/Knowledge/rateq.sml	Thu Oct 20 10:23:38 2022 +0200
    44.3 @@ -55,7 +55,7 @@
    44.4  val (dI',pI',mI') = 
    44.5    ((** )"RatEq"( **)"PolyEq"(*rls "make_ratpoly_in" missing in theory "RatEq" (and ancestors)*),
    44.6    ["univariate", "equation"],["no_met"]);
    44.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    44.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    44.9  (* val (p,_,f,nxt,_,pt) = me nxt p [1] pt;------------- now Refine_Tacitly*)
   44.10  (*  nxt = ("Model_Problem",Model_Problem ["rational", "univariate", "equation"]) *)
   44.11  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   44.12 @@ -181,7 +181,7 @@
   44.13  val (dI',pI',mI') = 
   44.14    ((** )"RatEq"( **)"PolyEq"(*rls "make_ratpoly_in" missing in theory "RatEq" (and ancestors)*),
   44.15    ["univariate", "equation"],["no_met"]);
   44.16 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   44.17 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   44.18  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   44.19  (* nxt = ("Model_Problem",Model_Problem ["rational", "univariate", "equation"])*)
   44.20  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   44.21 @@ -235,7 +235,7 @@
   44.22  val (dI',pI',mI') = 
   44.23    ((** )"RatEq"( **)"PolyEq"(*rls "make_ratpoly_in" missing in theory "RatEq" (and ancestors)*),
   44.24    ["univariate", "equation"],["no_met"]);
   44.25 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   44.26 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   44.27  (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [1] pt; val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   44.28  (**)val (p,_,f,nxt,_,pt) = me nxt p [1] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;(**)
   44.29  (**)val (p,_,f,nxt,_,pt) = me nxt p [1] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;(**)
    45.1 --- a/test/Tools/isac/Knowledge/rational-2.sml	Wed Oct 19 15:39:15 2022 +0200
    45.2 +++ b/test/Tools/isac/Knowledge/rational-2.sml	Thu Oct 20 10:23:38 2022 +0200
    45.3 @@ -1416,7 +1416,7 @@
    45.4    ("Rational",["rational", "simplification"],
    45.5     ["simplification", "of_rationals"]);
    45.6  val p = e_pos'; val c = []; 
    45.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    45.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    45.9  val (p,_,f,nxt,_,pt) = me nxt p c pt;
   45.10  val (p,_,f,nxt,_,pt) = me nxt p c pt;
   45.11  val (p,_,f,nxt,_,pt) = me nxt p c pt;
   45.12 @@ -1437,7 +1437,7 @@
   45.13  "-------- interSteps ..Simp_Rat_Double_No- 1.xml ------------------------------";
   45.14  "-------- interSteps ..Simp_Rat_Double_No- 1.xml ------------------------------";
   45.15  States.reset ();
   45.16 -CalcTree [(["Term (((2 - x)/(2*a)) / (2*a/(x - 2)))", "normalform N"], 
   45.17 +CalcTree @{context} [(["Term (((2 - x)/(2*a)) / (2*a/(x - 2)))", "normalform N"], 
   45.18    ("Rational", ["rational", "simplification"], ["simplification", "of_rationals"]))];
   45.19  Iterator 1;
   45.20  moveActiveRoot 1;
   45.21 @@ -1482,7 +1482,7 @@
   45.22  "-------- interSteps ..Simp_Rat_Cancel_No- 1.xml ------------------------------";
   45.23  "-------- interSteps ..Simp_Rat_Cancel_No- 1.xml ------------------------------";
   45.24  States.reset ();
   45.25 -CalcTree [(["Term ((a \<up> 2 + - 1*b \<up> 2) / (a \<up> 2 + - 2*a*b + b \<up> 2))", "normalform N"], 
   45.26 +CalcTree @{context} [(["Term ((a \<up> 2 + - 1*b \<up> 2) / (a \<up> 2 + - 2*a*b + b \<up> 2))", "normalform N"], 
   45.27    ("Rational", ["rational", "simplification"], ["simplification", "of_rationals"]))];
   45.28  Iterator 1;
   45.29  moveActiveRoot 1;
   45.30 @@ -1613,7 +1613,7 @@
   45.31  (*WN12xxxx TODO: instead of Gabriella's example here (27.Jul.12) find a simpler one
   45.32    WN130912: kept this test, although not clear what for*)
   45.33  States.reset ();
   45.34 -CalcTree [(["Term ((5*b + 25)/(a^2 - b^2) * (a - b)/(5*b))", "normalform N"], 
   45.35 +CalcTree @{context} [(["Term ((5*b + 25)/(a^2 - b^2) * (a - b)/(5*b))", "normalform N"], 
   45.36    ("Rational", ["rational", "simplification"], ["simplification", "of_rationals"]))];
   45.37  Iterator 1;
   45.38  moveActiveRoot 1;
    46.1 --- a/test/Tools/isac/Knowledge/rlang.sml	Wed Oct 19 15:39:15 2022 +0200
    46.2 +++ b/test/Tools/isac/Knowledge/rlang.sml	Thu Oct 20 10:23:38 2022 +0200
    46.3 @@ -63,7 +63,7 @@
    46.4  val fmz = ["equality (3*x - 1 - (5*x - (2 - 4*x)) = - 11)",
    46.5  	   "solveFor x", "solutions L"];
    46.6  val (dI',pI',mI') = ("PolyEq",["univariate", "equation"],["no_met"]);
    46.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    46.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    46.9  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.10  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.11  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.12 @@ -90,7 +90,7 @@
   46.13  val fmz = ["equality ((x - 5)*(10 - x) = (3 - x)*(2 + x) + 2*(x + 20))",
   46.14  	   "solveFor x", "solutions L"];
   46.15  val (dI',pI',mI') = ("PolyEq",["univariate", "equation"],["no_met"]);
   46.16 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   46.17 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   46.18  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.19  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.20  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.21 @@ -116,7 +116,7 @@
   46.22  val fmz = ["equality ((2*x+5) \<up> 2+(3*x+4) \<up> 2=(13*x+2)*(x+1)+2*(15+14*x))",
   46.23  	   "solveFor x", "solutions L"];
   46.24  val (dI',pI',mI') = ("PolyEq",["univariate", "equation"],["no_met"]);
   46.25 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   46.26 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   46.27  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.28  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.29  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.30 @@ -142,7 +142,7 @@
   46.31  val fmz = ["equality ((2*x+1) \<up> 3+(x+1) \<up> 3=(2*x+1) \<up> 2*2*x+(x+2) \<up> 3+x \<up> 2)",
   46.32  	   "solveFor x", "solutions L"];
   46.33  val (dI',pI',mI') = ("PolyEq",["univariate", "equation"],["no_met"]);
   46.34 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   46.35 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   46.36  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.37  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.38  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.39 @@ -168,7 +168,7 @@
   46.40  val fmz = ["equality ((3*x+5)/18 - x/2 = -((3*x - 2)/9))",
   46.41  	   "solveFor x", "solutions L"];
   46.42  val (dI',pI',mI') = ("PolyEq",["univariate", "equation"],["no_met"]);
   46.43 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   46.44 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   46.45  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.46  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.47  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.48 @@ -207,7 +207,7 @@
   46.49  val fmz = ["equality ((17*x - 51)/9 - (-(13*x - 3)/6) + 11 - (9*x - 7)/4 = 0)",
   46.50  	   "solveFor x", "solutions L"];
   46.51  val (dI',pI',mI') = ("PolyEq",["univariate", "equation"],["no_met"]);
   46.52 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   46.53 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   46.54  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.55  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.56  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.57 @@ -243,7 +243,7 @@
   46.58  val fmz = ["equality (- 2/x + 3/(2*x) - 4/(3*x) + 5/(4*x) + 6/(5*x) = 65/8)",
   46.59  	   "solveFor x", "solutions L"];
   46.60  val (dI',pI',mI') = ("RatEq",["univariate", "equation"],["no_met"]);
   46.61 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   46.62 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   46.63  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.64  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.65  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.66 @@ -279,7 +279,7 @@
   46.67  val fmz = ["equality ((x+3)/(2*x - 4)=3)",
   46.68  	   "solveFor x", "solutions L"];
   46.69  val (dI',pI',mI') = ("RatEq",["univariate", "equation"],["no_met"]);
   46.70 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   46.71 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   46.72  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.73  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.74  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.75 @@ -317,7 +317,7 @@
   46.76  val fmz = ["equality ((1/2 + (5*x)/2) \<up> 2 - ((13*x)/2 - 5/2) \<up> 2 = - 1*(6*x) \<up> 2 + 29)",
   46.77  	   "solveFor x", "solutions L"];
   46.78  val (dI',pI',mI') = ("PolyEq",["univariate", "equation"],["no_met"]);
   46.79 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   46.80 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   46.81  Rewrite.trace_on:=true; (*true false*)
   46.82  
   46.83  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.84 @@ -360,7 +360,7 @@
   46.85  	   "solveFor x", "solutions L"];
   46.86  val (dI',pI',mI') = ("RatEq",["univariate", "equation"],["no_met"]);
   46.87  
   46.88 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   46.89 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   46.90  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.91  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.92  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   46.93 @@ -397,7 +397,7 @@
   46.94  	   "solveFor m1", "solutions L"];
   46.95  val (dI',pI',mI') = ("PolyEq",["univariate", "equation"],["no_met"]);
   46.96  
   46.97 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   46.98 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   46.99  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.100  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.101  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.102 @@ -423,7 +423,7 @@
  46.103  	   "solveFor v", "solutions L"];
  46.104  val (dI',pI',mI') = ("RatEq",["univariate", "equation"],["no_met"]);
  46.105  
  46.106 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  46.107 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  46.108  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.109  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.110  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.111 @@ -498,7 +498,7 @@
  46.112  val fmz = ["equality (f=((w+u)/(w+v))*v0)",
  46.113  	   "solveFor w", "solutions L"];
  46.114  val (dI',pI',mI') = ("RatEq",["univariate", "equation"],["no_met"]);
  46.115 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  46.116 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  46.117  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.118  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.119  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.120 @@ -543,7 +543,7 @@
  46.121  val fmz = ["equality (1/R=1/R1+1/R2)",
  46.122  	   "solveFor R1", "solutions L"];
  46.123  val (dI',pI',mI') = ("RatEq",["univariate", "equation"],["no_met"]);
  46.124 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  46.125 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  46.126  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.127  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.128  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.129 @@ -585,7 +585,7 @@
  46.130  val fmz = ["equality (y \<up> 2=2*p*x)",
  46.131  	   "solveFor p", "solutions L"];
  46.132  val (dI',pI',mI') = ("PolyEq",["univariate", "equation"],["no_met"]);
  46.133 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  46.134 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  46.135  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.136  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.137  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.138 @@ -615,7 +615,7 @@
  46.139  val fmz = ["equality (y \<up> 2=2*p*x)",
  46.140  	   "solveFor y", "solutions L"];
  46.141  val (dI',pI',mI') = ("PolyEq",["univariate", "equation"],["no_met"]);
  46.142 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  46.143 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  46.144  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.145  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.146  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.147 @@ -646,7 +646,7 @@
  46.148  val fmz = ["equality (b \<up> 2*x \<up> 2 + a \<up> 2*y \<up> 2 = a \<up> 2*b \<up> 2)",
  46.149  	   "solveFor x", "solutions L"];
  46.150  val (dI',pI',mI') = ("PolyEq",["univariate", "equation"],["no_met"]);
  46.151 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  46.152 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  46.153  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.154  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.155  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.156 @@ -692,7 +692,7 @@
  46.157  val fmz = ["equality (A = (1/2)*(x1*(y2 - y3)+x2*(y3 - y1)+x3*(y1 - y2)))",
  46.158  	   "solveFor x2", "solutions L"];
  46.159  val (dI',pI',mI') = ("PolyEq",["univariate", "equation"],["no_met"]);
  46.160 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  46.161 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  46.162  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.163  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.164  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.165 @@ -727,7 +727,7 @@
  46.166  val fmz = ["equality (4*sqrt(4*x+1)=3*sqrt(7*x+2))",
  46.167  	   "solveFor x", "solutions L"];
  46.168  val (dI',pI',mI') = ("RootEq",["univariate", "equation"],["no_met"]);
  46.169 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  46.170 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  46.171  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.172  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.173  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.174 @@ -761,7 +761,7 @@
  46.175  val fmz = ["equality (5*sqrt(x) - 1 = 7*sqrt(x) - 5)",
  46.176  	   "solveFor x", "solutions L"];
  46.177  val (dI',pI',mI') = ("RootEq",["univariate", "equation"],["no_met"]);
  46.178 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  46.179 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  46.180  (* val nxt = ("Model_Problem",Model_Problem ["normalise", "rootX", "univariate", "equation"])*)
  46.181  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.182  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.183 @@ -841,7 +841,7 @@
  46.184  	   "solveFor x", "solutions L"];
  46.185  val (dI',pI',mI') = ("RootEq",["univariate", "equation"],["no_met"]);
  46.186  
  46.187 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  46.188 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  46.189  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.190  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.191  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.192 @@ -891,7 +891,7 @@
  46.193  	   "solveFor x", "solutions L"];
  46.194  val (dI',pI',mI') = ("RootEq",["univariate", "equation"],["no_met"]);
  46.195  
  46.196 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  46.197 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  46.198  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.199  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.200  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.201 @@ -943,7 +943,7 @@
  46.202  	   "solveFor x", "solutions L"];
  46.203  val (dI',pI',mI') = ("RootEq",["univariate", "equation"],["no_met"]);
  46.204  
  46.205 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  46.206 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  46.207  (* val nxt = ("Model_Problem",Model_Problem ["sq", "rootX", "univariate", "equation"]) *)
  46.208  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.209  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.210 @@ -1005,7 +1005,7 @@
  46.211  val fmz = ["equality ((6*x - 9)*(5*x+7) - (4*x+7)*(3*x - 6) = 429)",
  46.212  	   "solveFor x", "solutions L"];
  46.213  val (dI',pI',mI') = ("PolyEq",["univariate", "equation"],["no_met"]);
  46.214 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  46.215 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  46.216  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.217  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.218  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.219 @@ -1031,7 +1031,7 @@
  46.220  	   "solveFor x", "solutions L"];
  46.221  val (dI',pI',mI') = ("RatEq",["univariate", "equation"],["no_met"]);
  46.222  
  46.223 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  46.224 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  46.225  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.226  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.227  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.228 @@ -1073,7 +1073,7 @@
  46.229  val fmz = ["equality (1/(x \<up> 2 - 9)+(2*x+3)/(x+3)=(3*x+4)/(x - 3))",
  46.230  	   "solveFor x", "solutions L"];
  46.231  val (dI',pI',mI') = ("RatEq",["univariate", "equation"],["no_met"]);
  46.232 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  46.233 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  46.234  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.235  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.236  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.237 @@ -1111,7 +1111,7 @@
  46.238  val fmz = ["equality (sqrt(29 - sqrt(x \<up> 2 - 9))=5)",
  46.239  	   "solveFor x", "solutions L"];
  46.240  val (dI',pI',mI') = ("RootEq",["univariate", "equation"],["no_met"]);
  46.241 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  46.242 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  46.243  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.244  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.245  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.246 @@ -1159,7 +1159,7 @@
  46.247  	   "solveFor x", "solutions L"];
  46.248  val (dI',pI',mI') = ("RootEq",["univariate", "equation"],["no_met"]);
  46.249  
  46.250 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  46.251 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  46.252  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.253  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.254  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.255 @@ -1201,7 +1201,7 @@
  46.256  val fmz = ["equality (A=(c/d)*sqrt(4*a \<up> 2 - c \<up> 2))",
  46.257  	   "solveFor a", "solutions L"];
  46.258  val (dI',pI',mI') = ("RootEq",["univariate", "equation"],["no_met"]);
  46.259 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  46.260 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  46.261  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.262  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.263  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.264 @@ -1242,7 +1242,7 @@
  46.265  val fmz = ["equality (1/(x - a+b)=1/x - 1/a + 1/b)",
  46.266  	   "solveFor x", "solutions L"];
  46.267  val (dI',pI',mI') = ("RatEq",["univariate", "equation"],["no_met"]);
  46.268 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  46.269 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  46.270  (* val nxt = ("Model_Problem",Model_Problem ["rational", "univariate", "equation"])*)
  46.271  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.272  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.273 @@ -1303,7 +1303,7 @@
  46.274  "Schalk II s.68 Bsp 56a ((a+b*x)/(a-b*x) - (a - b*x)/(a+b*x)= (4*a*b)/(a \<up> 2 - b \<up> 2))";
  46.275  val fmz = ["equality ((a+b*x)/(a-b*x) - (a - b*x)/(a+b*x)= (4*a*b)/(a \<up> 2 - b \<up> 2))", "solveFor x", "solutions L"];
  46.276  val (dI',pI',mI') = ("RatEq",["univariate", "equation"],["no_met"]);
  46.277 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  46.278 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  46.279  (* val nxt = ("Model_Problem",Model_Problem ["rational", "univariate", "equation"]) *)
  46.280  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.281  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.282 @@ -1392,7 +1392,7 @@
  46.283  	   "solveFor x", "solutions L"];
  46.284  val (dI',pI',mI') = ("RootEq",["univariate", "equation"],["no_met"]);
  46.285  
  46.286 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  46.287 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  46.288  (* val nxt = ("Model_Problem",Model_Problem ["sq", "rootX", "univariate", "equation"])*)
  46.289  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.290  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.291 @@ -1453,7 +1453,7 @@
  46.292  val fmz = ["equality (sqrt((x+a) \<up> 2+(x - 2*b) \<up> 2)=a+2*b)",
  46.293  	   "solveFor x", "solutions L"];
  46.294  val (dI',pI',mI') = ("RootEq",["univariate", "equation"],["no_met"]);
  46.295 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  46.296 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  46.297  (*val nxt = ("Model_Problem",Model_Problem ["sq", "rootX", "univariate", "equation"]) *)
  46.298  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.299  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.300 @@ -1514,7 +1514,7 @@
  46.301  val fmz = ["equality ((2*x+1)*x \<up> 2 = 0)",
  46.302  	   "solveFor x", "solutions L"];
  46.303  val (dI',pI',mI') = ("PolyEq",["univariate", "equation"],["no_met"]);
  46.304 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  46.305 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  46.306  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.307  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.308  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  46.309 @@ -1565,7 +1565,7 @@
  46.310  val fmz = ["equality ((a/2) \<up> 2 + (b/2) \<up> 2 = r \<up> 2)",
  46.311  	   "solveFor a", "solutions L"];
  46.312  val (dI',pI',mI') = ("PolyEq",["univariate", "equation"],["no_met"]);
  46.313 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  46.314 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  46.315  (*   Model_Problem ["normalise", "polynomial", "univariate", "equation"])*)
  46.316  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
  46.317  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
  46.318 @@ -1612,7 +1612,7 @@
  46.319  	   "solveFor u", "solutions L"];
  46.320  val (dI',pI',mI') = ("PolyEq",["univariate", "equation"],["no_met"]);
  46.321  
  46.322 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  46.323 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  46.324  (*   Model_Problem ["normalise", "rootX", "univariate", "equation"])*)
  46.325  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
  46.326  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
    47.1 --- a/test/Tools/isac/Knowledge/rooteq.sml	Wed Oct 19 15:39:15 2022 +0200
    47.2 +++ b/test/Tools/isac/Knowledge/rooteq.sml	Thu Oct 20 10:23:38 2022 +0200
    47.3 @@ -97,7 +97,7 @@
    47.4  val fmz = ["equality (1/sqrt(x)=5)", "solveFor x", "solutions L"];
    47.5  val (dI',pI',mI') = ("RootEq",["univariate", "equation"],["no_met"]);
    47.6  
    47.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    47.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    47.9  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   47.10  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   47.11  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   47.12 @@ -146,7 +146,7 @@
   47.13  val fmz = ["equality (sqrt(x+1)=5)", "solveFor x", "solutions L"];
   47.14  val (dI',pI',mI') = ("RootEq",["univariate", "equation"],["no_met"]);
   47.15  (*val p = e_pos'; 
   47.16 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   47.17 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   47.18  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   47.19  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   47.20  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   47.21 @@ -179,7 +179,7 @@
   47.22  val fmz = ["equality (4*sqrt(4*x+2)=3*sqrt(2*x+24))", "solveFor x", "solutions L"];
   47.23  val (dI',pI',mI') = ("RootEq",["univariate", "equation"],["no_met"]);
   47.24  
   47.25 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   47.26 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   47.27  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   47.28  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   47.29  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   47.30 @@ -213,7 +213,7 @@
   47.31  val fmz = ["equality (sqrt(x+1)+sqrt(4*x+4)=sqrt(9*x+9))", "solveFor x", "solutions L"];
   47.32  val (dI',pI',mI') = ("RootEq",["univariate", "equation"],["no_met"]);
   47.33  
   47.34 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   47.35 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   47.36  (*val nxt = Model_Problem ["sq", "rootX", "univariate", "equation"]) *)
   47.37  val (p,_,f,nxt,_,pt) = me nxt p c pt;
   47.38  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   47.39 @@ -266,7 +266,7 @@
   47.40       "solveFor x", "solutions L"];
   47.41  val (dI',pI',mI') = ("RootEq",["sq", "rootX", "univariate", "equation"],
   47.42  		     ["RootEq", "solve_sq_root_equation"]);
   47.43 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   47.44 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   47.45  val (p,_,f,nxt,_,pt) = me nxt p c pt;
   47.46  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   47.47  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   47.48 @@ -314,7 +314,7 @@
   47.49  val fmz = ["equality (sqrt(x) = 1)", "solveFor x", "solutions L"];
   47.50  val (dI',pI',mI') = ("RootEq",["sq", "rootX", "univariate", "equation"],
   47.51  		     ["RootEq", "solve_sq_root_equation"]);
   47.52 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   47.53 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   47.54  val (p,_,f,nxt,_,pt) = me nxt p c pt;
   47.55  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   47.56  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   47.57 @@ -372,7 +372,7 @@
   47.58  val fmz = ["equality (sqrt x = sqrt x)", "solveFor x", "solutions L"];
   47.59  val (dI',pI',mI') = ("RootEq",["sq", "rootX", "univariate", "equation"],
   47.60  		     ["RootEq", "solve_sq_root_equation"]);
   47.61 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   47.62 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   47.63  val (p,_,f,nxt,_,pt) = me nxt p c pt;
   47.64  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   47.65  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   47.66 @@ -420,7 +420,7 @@
   47.67  val fmz = ["equality (3*sqrt(x+3)+sqrt(x+6)=sqrt(4*x+33))", "solveFor x", "solutions L"];
   47.68  val (dI',pI',mI') = ("RootEq",["univariate", "equation"],["no_met"]);
   47.69  
   47.70 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   47.71 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   47.72  val (p,_,f,nxt,_,pt) = me nxt p c pt;
   47.73  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   47.74  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   47.75 @@ -479,7 +479,7 @@
   47.76  val (dI',pI',mI') =
   47.77    ("Test",["sqroot-test", "univariate", "equation", "test"],
   47.78     ["Test", "square_equation1"]);
   47.79 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   47.80 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   47.81  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   47.82  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   47.83  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   47.84 @@ -551,7 +551,7 @@
   47.85  val Prog sc = (#scr o MethodC.from_store ctxt) ["Test", "square_equation2"];
   47.86  (writeln o UnparseC.term) sc;
   47.87  
   47.88 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   47.89 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   47.90  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   47.91  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   47.92  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   47.93 @@ -628,7 +628,7 @@
   47.94  val (dI',pI',mI') =
   47.95    ("Test",["squareroot", "univariate", "equation", "test"],
   47.96     ["Test", "square_equation"]);
   47.97 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   47.98 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   47.99  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  47.100  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  47.101  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  47.102 @@ -688,7 +688,7 @@
  47.103   val Prog sc = (#scr o MethodC.from_store ctxt) ["Test", "square_equation"];
  47.104   (writeln o UnparseC.term) sc;
  47.105  
  47.106 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  47.107 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  47.108  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  47.109  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  47.110  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  47.111 @@ -741,7 +741,7 @@
  47.112  val (dI',pI',mI') =
  47.113    ("Test",["univariate", "equation", "test"],
  47.114     ["no_met"]);
  47.115 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
  47.116 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
  47.117  (*val nxt = ("Model_Problem",Model_Problem ["normalise", "univariate", "equati*)
  47.118  val (p,_,f,nxt,_,pt) = me nxt p c pt;
  47.119  val (p,_,f,nxt,_,pt) = me nxt p c pt;
    48.1 --- a/test/Tools/isac/Knowledge/rootrateq.sml	Wed Oct 19 15:39:15 2022 +0200
    48.2 +++ b/test/Tools/isac/Knowledge/rootrateq.sml	Thu Oct 20 10:23:38 2022 +0200
    48.3 @@ -69,7 +69,7 @@
    48.4  val c = [];
    48.5  val fmz = ["equality ( - 2 + 1/(1 - sqrt(x))= (0::real))", "solveFor x", "solutions L"];
    48.6  val (dI',pI',mI') = ("RootRatEq",["univariate", "equation"],["no_met"]);
    48.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    48.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    48.9  val (p,_,f,nxt,_,pt) = me nxt p c pt;
   48.10  val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
   48.11  val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
   48.12 @@ -181,7 +181,7 @@
   48.13  val fmz = ["equality (3/(1+sqrt(x))= 1)", "solveFor x", "solutions L"];
   48.14  val (dI',pI',mI') = ("RootRatEq",["univariate", "equation"],["no_met"]);
   48.15  
   48.16 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   48.17 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   48.18  val (p,_,f,nxt,_,pt) = me nxt p c pt;
   48.19  val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
   48.20  val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
   48.21 @@ -240,7 +240,7 @@
   48.22  val fmz = ["equality ( 0= - 2 + 1/(1 - sqrt(x)))", "solveFor x", "solutions L"];
   48.23  val (dI',pI',mI') = ("RootRatEq",["univariate", "equation"],["no_met"]);
   48.24  
   48.25 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   48.26 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   48.27  val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
   48.28  val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
   48.29  val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
   48.30 @@ -295,7 +295,7 @@
   48.31  val fmz = ["equality (1 = 3/(1+sqrt(x)))", "solveFor x", "solutions L"];
   48.32  val (dI',pI',mI') = ("RootRatEq",["univariate", "equation"],["no_met"]);
   48.33  
   48.34 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   48.35 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   48.36  val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
   48.37  val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
   48.38  val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
    49.1 --- a/test/Tools/isac/Knowledge/simplify.sml	Wed Oct 19 15:39:15 2022 +0200
    49.2 +++ b/test/Tools/isac/Knowledge/simplify.sml	Thu Oct 20 10:23:38 2022 +0200
    49.3 @@ -24,7 +24,7 @@
    49.4    "----------- CAS-command Simplify -----------------------";
    49.5    "----------- CAS-command Simplify -----------------------";
    49.6    States.reset ();
    49.7 -  CalcTree [([], References.empty)];
    49.8 +  CalcTree @{context} [([], References.empty)];
    49.9    Iterator 1;
   49.10    moveActiveRoot 1;
   49.11    replaceFormula 1 "Simplify (2*a + 3*a)";
   49.12 @@ -40,7 +40,7 @@
   49.13  "----------- append inform with final result ------------";
   49.14  "----------- append inform with final result ------------";
   49.15  States.reset ();
   49.16 -CalcTree [(["Term ((14 * x * y) / ( x * y ))", "normalform N"],
   49.17 +CalcTree @{context} [(["Term ((14 * x * y) / ( x * y ))", "normalform N"],
   49.18  	("Rational", ["rational", "simplification"], ["simplification", "of_rationals"]))];
   49.19  Iterator 1;
   49.20  moveActiveRoot 1;
    50.1 --- a/test/Tools/isac/Knowledge/system.sml	Wed Oct 19 15:39:15 2022 +0200
    50.2 +++ b/test/Tools/isac/Knowledge/system.sml	Thu Oct 20 10:23:38 2022 +0200
    50.3 @@ -50,7 +50,7 @@
    50.4    ("Biegelinie",["normalise", "2x2", "LINEAR", "system"],
    50.5     ["EqSystem", "normalise", "2x2"]);
    50.6  val p = e_pos'; val c = [];
    50.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    50.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    50.9  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   50.10  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   50.11  val (p,_,f,nxt,_,pt) = me nxt p c pt;
   50.12 @@ -70,7 +70,7 @@
   50.13  case nxt of (_, Subproblem ("Biegelinie", ["triangular", "2x2", 
   50.14  					       "LINEAR", "system"])) => ()
   50.15  	  | _ => error "system.sml diff.behav.in me --3";
   50.16 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   50.17 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   50.18  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   50.19  val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
   50.20  val (p,_,f,nxt,_,pt) = me nxt p c pt;
    51.1 --- a/test/Tools/isac/MathEngBasic/ctree.sml	Wed Oct 19 15:39:15 2022 +0200
    51.2 +++ b/test/Tools/isac/MathEngBasic/ctree.sml	Thu Oct 20 10:23:38 2022 +0200
    51.3 @@ -58,7 +58,7 @@
    51.4  val (dI',pI',mI') =
    51.5    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    51.6     ["Test", "squ-equ-test-subpbl1"]);
    51.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    51.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    51.9  case \<^try>\<open> (get_ctxt pt p)\<close> of
   51.10    SOME x => x
   51.11  | NONE => error "--- fun get_ctxt not even some ctxt found in PblObj";
   51.12 @@ -80,7 +80,7 @@
   51.13  val (dI',pI',mI') =
   51.14    ("Test",["sqroot-test", "univariate", "equation", "test"],
   51.15     ["Test", "squ-equ-test-subpbl1"]);
   51.16 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   51.17 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   51.18  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   51.19  (* nxt = Add_Given "equality (x + 1 = 2)"
   51.20     (writeln o (I_Model.to_string ctxt)) (get_obj g_pbl pt (fst p));
   51.21 @@ -342,7 +342,7 @@
   51.22  val (dI',pI',mI') =
   51.23    ("Test",["sqroot-test", "univariate", "equation", "test"],
   51.24     ["Test", "squ-equ-test-subpbl1"]);
   51.25 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   51.26 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   51.27  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   51.28  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   51.29  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   51.30 @@ -382,7 +382,7 @@
   51.31  "=====new ctree 2 miniscript with mini-subpbl ====================";
   51.32  "=====new ctree 2 miniscript with mini-subpbl ====================";
   51.33  States.reset ();
   51.34 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   51.35 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   51.36     ("Test", ["sqroot-test", "univariate", "equation", "test"],
   51.37      ["Test", "squ-equ-test-subpbl1"]))];
   51.38   Iterator 1; moveActiveRoot 1;
   51.39 @@ -452,7 +452,7 @@
   51.40  val (dI',pI',mI') =
   51.41    ("Test",["sqroot-test", "univariate", "equation", "test"],
   51.42     ["Test", "squ-equ-test-subpbl1"]);
   51.43 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   51.44 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   51.45  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   51.46  (* nxt = Add_Given "equality (x + 1 = 2)"
   51.47     (writeln o (I_Model.to_string ctxt)) (get_obj g_pbl pt (fst p));
   51.48 @@ -550,7 +550,7 @@
   51.49  "=====new ctree 3 ================================================";
   51.50  
   51.51  States.reset ();
   51.52 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   51.53 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   51.54     ("Test", ["sqroot-test", "univariate", "equation", "test"],
   51.55      ["Test", "squ-equ-test-subpbl1"]))];
   51.56   Iterator 1; moveActiveRoot 1;
   51.57 @@ -585,7 +585,7 @@
   51.58  "-------------- move_dn: Frm -> Res ------------------------------";
   51.59  "-------------- move_dn: Frm -> Res ------------------------------";
   51.60   States.reset ();
   51.61 - CalcTree      (*start of calculation, return No.1*)
   51.62 + CalcTree @{context}      (*start of calculation, return No.1*)
   51.63       [(["equality (1+- 1*2+x=(0::real))", "solveFor x", "solutions L"],
   51.64         ("Test", 
   51.65  	["LINEAR", "univariate", "equation", "test"],
   51.66 @@ -632,7 +632,7 @@
   51.67  "------ move into detail -----------------------------------------";
   51.68  "------ move into detail -----------------------------------------";
   51.69   States.reset ();
   51.70 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   51.71 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   51.72     ("Test", ["sqroot-test", "univariate", "equation", "test"],
   51.73      ["Test", "squ-equ-test-subpbl1"]))];
   51.74   Iterator 1; moveActiveRoot 1;
   51.75 @@ -664,7 +664,7 @@
   51.76  "=====new ctree 3a ===============================================";
   51.77  "=====new ctree 3a ===============================================";
   51.78   States.reset ();
   51.79 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   51.80 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   51.81     ("Test", ["sqroot-test", "univariate", "equation", "test"],
   51.82      ["Test", "squ-equ-test-subpbl1"]))];
   51.83   Iterator 1; moveActiveRoot 1;
   51.84 @@ -697,7 +697,7 @@
   51.85  "=====new ctree 4: crooked by cut_level_'_ =======================";
   51.86  "=====new ctree 4: crooked by cut_level_'_ =======================";
   51.87  States.reset ();
   51.88 -CalcTree
   51.89 +CalcTree @{context}
   51.90  [(["equality (x/(x \<up> 2 - 6*x+9) - 1/(x \<up> 2 - 3*x) =1/x)",
   51.91  	   "solveFor x", "solutions L"], 
   51.92    ("RatEq",["univariate", "equation"],["no_met"]))];
   51.93 @@ -913,7 +913,7 @@
   51.94  "=====new ctree 5 minisubpbl =====================================";
   51.95  "=====new ctree 5 minisubpbl =====================================";
   51.96  States.reset ();
   51.97 -CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   51.98 +CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   51.99     ("Test", ["sqroot-test", "univariate", "equation", "test"],
  51.100      ["Test", "squ-equ-test-subpbl1"]))];
  51.101  Iterator 1; moveActiveRoot 1;
  51.102 @@ -992,7 +992,7 @@
  51.103  "=====new ctree 6 minisubpbl intersteps ==========================";
  51.104  "=====new ctree 6 minisubpbl intersteps ==========================";
  51.105  States.reset ();
  51.106 -CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  51.107 +CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  51.108     ("Test", ["sqroot-test", "univariate", "equation", "test"],
  51.109      ["Test", "squ-equ-test-subpbl1"]))];
  51.110  Iterator 1; moveActiveRoot 1;
    52.1 --- a/test/Tools/isac/MathEngine/detail-step.sml	Wed Oct 19 15:39:15 2022 +0200
    52.2 +++ b/test/Tools/isac/MathEngine/detail-step.sml	Thu Oct 20 10:23:38 2022 +0200
    52.3 @@ -15,7 +15,7 @@
    52.4  "----------- interSteps [diff,integration] -----------------------------------------------------";
    52.5  "----------- interSteps [diff,integration] -----------------------------------------------------";
    52.6  States.reset ();
    52.7 -CalcTree
    52.8 +CalcTree @{context}
    52.9      [(["functionTerm (x^2 + 1)", "integrateBy x", "antiDerivative FF"], 
   52.10        ("Integrate", ["integrate", "function"], ["diff", "integration"]))];
   52.11  Iterator 1;
   52.12 @@ -28,7 +28,7 @@
   52.13  
   52.14  "----------------------------------------------------------------------------------------------";
   52.15  States.reset ();
   52.16 -CalcTree
   52.17 +CalcTree @{context}
   52.18  [(["functionTerm (Integral x^2 + 1 D x)", "integrateBy x", "antiDerivative FF"],
   52.19    ("Integrate", ["integrate", "function"], ["diff", "integration", "test"]))];
   52.20  Iterator 1;
    53.1 --- a/test/Tools/isac/MathEngine/mathengine-stateless.sml	Wed Oct 19 15:39:15 2022 +0200
    53.2 +++ b/test/Tools/isac/MathEngine/mathengine-stateless.sml	Thu Oct 20 10:23:38 2022 +0200
    53.3 @@ -13,7 +13,7 @@
    53.4  "----------- change to TermC.parse ctxt -----------------------";
    53.5  "----------- tryrefine ----------------------------------";
    53.6  "----------- search for Or_to_List ----------------------";
    53.7 -"----------- check thy in CalcTreeTEST ------------------";
    53.8 +"----------- check thy in Test_Code.init_calc @{context} ------------------";
    53.9  "----------- identified error in fun getTactic, ThmC.string_of_thm ---------------";
   53.10  "----------- improved fun getTactic for interSteps and numeral calculations --";
   53.11  "--------------------------------------------------------";
   53.12 @@ -34,7 +34,7 @@
   53.13  "----------- tryrefine ----------------------------------";
   53.14  "----------- tryrefine ----------------------------------";
   53.15  States.reset ();
   53.16 -CalcTree [(["equality (x/(x^2 - 6*x+9) - 1/(x^2 - 3*x) =1/x)", 
   53.17 +CalcTree @{context} [(["equality (x/(x^2 - 6*x+9) - 1/(x^2 - 3*x) =1/x)", 
   53.18  	    "solveFor x", "solutions L"],
   53.19  	   ("RatEq",["univariate", "equation"],["no_met"]))];
   53.20  Iterator 1;
   53.21 @@ -51,7 +51,7 @@
   53.22  "--------- search for Or_to_List ------------------------";
   53.23  val fmz = ["equality (x \<up> 2 + 4*x + 5 = (2::real))", "solveFor x", "solutions L"];
   53.24  val (dI',pI',mI') = ("Isac_Knowledge", ["univariate", "equation"], ["no_met"])
   53.25 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   53.26 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   53.27  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   53.28  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   53.29  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   53.30 @@ -93,10 +93,10 @@
   53.31  | _ => error "Or_to_List broken ?"
   53.32  
   53.33  
   53.34 -"----------- check thy in CalcTreeTEST ------------------";
   53.35 -"----------- check thy in CalcTreeTEST ------------------";
   53.36 -"----------- check thy in CalcTreeTEST ------------------";
   53.37 -"WN1109 with Inverse_Z_Transform.thy when starting tests with CalcTreeTEST \n" ^
   53.38 +"----------- check thy in Test_Code.init_calc @{context} ------------------";
   53.39 +"----------- check thy in Test_Code.init_calc @{context} ------------------";
   53.40 +"----------- check thy in Test_Code.init_calc @{context} ------------------";
   53.41 +"WN1109 with Inverse_Z_Transform.thy when starting tests with Test_Code.init_calc @{context} \n" ^
   53.42  "we got the message: ME_Isa: thy 'Build_Inverse_Z_Transform' not in system \n" ^
   53.43  "Below there are the steps which found out the reason: \n" ^
   53.44  "store_pbt mistakenly stored that theory.";
   53.45 @@ -109,10 +109,10 @@
   53.46  val (dI,pI,mI) = ("Isac_Knowledge", ["Inverse", "Z_Transform", "SignalProcessing"], 
   53.47    ["SignalProcessing", "Z_Transform", "Inverse"]);
   53.48  
   53.49 -val (p,_,fb,nxt,_,pt)  = CalcTreeTEST [(fmz, (dI,pI,mI))]; 
   53.50 +val (p,_,fb,nxt,_,pt)  = Test_Code.init_calc @{context} [(fmz, (dI,pI,mI))]; 
   53.51  (*WAS ME_Isa: thy 'Build_Inverse_Z_Transform' not in system*)
   53.52  
   53.53 -"~~~~~ fun CalcTreeTEST , args:"; val [(fmz, sp):Formalise.T] = [(fmz, (dI,pI,mI))];
   53.54 +"~~~~~ fun Test_Code.init_calc @{context} , args:"; val [(fmz, sp):Formalise.T] = [(fmz, (dI,pI,mI))];
   53.55      (*val ((pt, p), tacis) =*) 
   53.56  Step_Specify.nxt_specify_init_calc ctxt (fmz, sp);
   53.57  "~~~~~ fun nxt_specify_init_calc , args:"; val (fmz, (dI, pI, mI)) = (fmz, sp);
   53.58 @@ -150,7 +150,7 @@
   53.59  "----------- identified error in fun getTactic, ThmC.string_of_thm ---------------";
   53.60  "----------- identified error in fun getTactic, ThmC.string_of_thm ---------------";
   53.61  States.reset ();
   53.62 -CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"],
   53.63 +CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"],
   53.64    ("Test",["sqroot-test", "univariate", "equation", "test"],["Test", "squ-equ-test-subpbl1"]))];
   53.65  moveActiveRoot 1;
   53.66  autoCalculate 1 CompleteCalcHead;
   53.67 @@ -273,7 +273,7 @@
   53.68  "----------- improved fun getTactic for interSteps and numeral calculations --";
   53.69  val ctxt = Proof_Context.init_global @{theory Test};
   53.70  States.reset (); val cI = 1;
   53.71 -CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"],
   53.72 +CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"],
   53.73    ("Test",["sqroot-test", "univariate", "equation", "test"],["Test", "squ-equ-test-subpbl1"]))];
   53.74  moveActiveRoot 1;
   53.75  autoCalculate 1 CompleteCalcHead;
    54.1 --- a/test/Tools/isac/MathEngine/me-misc.sml	Wed Oct 19 15:39:15 2022 +0200
    54.2 +++ b/test/Tools/isac/MathEngine/me-misc.sml	Thu Oct 20 10:23:38 2022 +0200
    54.3 @@ -15,7 +15,7 @@
    54.4  "----------- fun get_interval after replace} other 2 -------------------------------------------";
    54.5  "----------- fun get_interval after replace} other 2 -------------------------------------------";
    54.6  States.reset ();
    54.7 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    54.8 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    54.9     ("Test", ["sqroot-test", "univariate", "equation", "test"],
   54.10      ["Test", "squ-equ-test-subpbl1"]))];
   54.11   Iterator 1;
    55.1 --- a/test/Tools/isac/MathEngine/solve.sml	Wed Oct 19 15:39:15 2022 +0200
    55.2 +++ b/test/Tools/isac/MathEngine/solve.sml	Thu Oct 20 10:23:38 2022 +0200
    55.3 @@ -38,7 +38,7 @@
    55.4  "--------- interSteps on norm_Rational ---------------------------";
    55.5  "--------- interSteps on norm_Rational ---------------------------";
    55.6  States.reset (); (*exp_IsacCore_Simp_Rat_Double_No-7.xml*)
    55.7 -CalcTree [(["Term ((2/(x+3) + 2/(x - 3)) / (8*x/(x \<up> 2 - 9)))", "normalform N"],
    55.8 +CalcTree @{context} [(["Term ((2/(x+3) + 2/(x - 3)) / (8*x/(x \<up> 2 - 9)))", "normalform N"],
    55.9  	("Rational", ["rational", "simplification"], ["simplification", "of_rationals"]))];
   55.10  moveActiveRoot 1;
   55.11  autoCalculate 1 CompleteCalc; 
    56.1 --- a/test/Tools/isac/MathEngine/states.sml	Wed Oct 19 15:39:15 2022 +0200
    56.2 +++ b/test/Tools/isac/MathEngine/states.sml	Thu Oct 20 10:23:38 2022 +0200
    56.3 @@ -33,7 +33,7 @@
    56.4  (* run n calculations in parallel, return measured time *)
    56.5  fun test n = let
    56.6        val _ = States.reset ();
    56.7 -      fun add_calc i = (CalcTree ex; moveActiveRoot i; i);
    56.8 +      fun add_calc i = (CalcTree @{context} ex; moveActiveRoot i; i);
    56.9        val ls = gen_ls n |> map add_calc;
   56.10        fun auto_calc i = autoCalculate i CompleteCalc;
   56.11        val t1 = Time.now ();
    57.1 --- a/test/Tools/isac/MathEngine/step.sml	Wed Oct 19 15:39:15 2022 +0200
    57.2 +++ b/test/Tools/isac/MathEngine/step.sml	Thu Oct 20 10:23:38 2022 +0200
    57.3 @@ -25,7 +25,7 @@
    57.4  val (dI',pI',mI') =
    57.5    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    57.6     ["Test", "squ-equ-test-subpbl1"]);
    57.7 - (*[], Pbl*)val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];(*Model_Problem*)
    57.8 + (*[], Pbl*)val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];(*Model_Problem*)
    57.9  (*[], Pbl*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;
   57.10  (*[], Pbl*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;
   57.11  (*[], Pbl*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;
   57.12 @@ -174,7 +174,7 @@
   57.13  "--------- embed fun Step.inconsistent -------------------";
   57.14  "--------- embed fun Step.inconsistent -------------------";
   57.15  States.reset ();
   57.16 -CalcTree
   57.17 +CalcTree @{context}
   57.18  [(["functionTerm (x ^ 2 + sin (x ^ 4))", "differentiateFor x", "derivative f_f'"], 
   57.19    ("Isac_Knowledge", ["derivative_of", "function"], ["diff", "differentiate_on_R"]))];
   57.20  Iterator 1;
   57.21 @@ -268,7 +268,7 @@
   57.22    "interval {x::real. 0 <= x & x <= pi}",
   57.23    "errorBound (eps=(0::real))"];
   57.24  val (dI',pI',mI') = ("Diff_App", ["maximum_of", "function"], ["Diff_App", "max_by_calculus"]);
   57.25 -val (p,_,f, nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   57.26 +val (p,_,f, nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   57.27  
   57.28  (*** stepwise Specification: Problem model================================================= ***)
   57.29  val ("ok", ([(Model_Problem, Model_Problem' (["maximum_of", "function"], _, _), _)], _, ptp))
   57.30 @@ -351,7 +351,7 @@
   57.31    ("Diff_App",["maximum_of", "function"],
   57.32     ["Diff_App", "max_by_calculus"]);
   57.33  val c = []:cid;
   57.34 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   57.35 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   57.36  
   57.37  val nxt = tac2tac_ pt p nxt; 
   57.38  val(p,_, Test_Out.PpcKF ppc, nxt,_,pt) = specify nxt e_pos' [] pt;
   57.39 @@ -428,7 +428,7 @@
   57.40  val (dI',pI',mI') = empty_spec;
   57.41  val c = []:cid;
   57.42  
   57.43 -(*val (p,_,f,(_,nxt),_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))]; !!!*)
   57.44 +(*val (p,_,f,(_,nxt),_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))]; !!!*)
   57.45  val(p,_, Test_Out.PpcKF ppc, nxt,_,pt) = specify nxt e_pos' [] 
   57.46    EmptyPtree;
   57.47  val nxt = tac2tac_ pt p nxt; 
    58.1 --- a/test/Tools/isac/Minisubpbl/100-init-rootpbl.sml	Wed Oct 19 15:39:15 2022 +0200
    58.2 +++ b/test/Tools/isac/Minisubpbl/100-init-rootpbl.sml	Thu Oct 20 10:23:38 2022 +0200
    58.3 @@ -10,7 +10,7 @@
    58.4  val (dI',pI',mI') =
    58.5    ("Isac_Knowledge", ["sqroot-test", "univariate", "equation", "test"],
    58.6     ["Test", "squ-equ-test-subpbl1"]);
    58.7 -"~~~~~ fun CalcTreeTEST , args:"; val [(fmz, sp): Formalise.T] = [(fmz, (dI',pI',mI'))];
    58.8 +"~~~~~ fun Test_Code.init_calc @{context} , args:"; val [(fmz, sp): Formalise.T] = [(fmz, (dI',pI',mI'))];
    58.9  
   58.10  Step_Specify.nxt_specify_init_calc ctxt (fmz, sp);
   58.11  "~~~~~ fun nxt_specify_init_calc , args:"; val (fmz, (dI, pI, mI)) = (fmz, sp);
   58.12 @@ -21,10 +21,10 @@
   58.13  (*return value*)
   58.14  ((pt, ([], Pbl)), (fst3 o snd) (Step_Specify.by_tactic_input Model_Problem (pt, ([], Pbl)))) : Calc.state_pre;
   58.15  
   58.16 -(* INVESTIGATE val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];*)
   58.17 +(* INVESTIGATE val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];*)
   58.18  (*///----------------------------------------- save for final check ------------------------\\\*)
   58.19  val [(fmz''''', spec''''')] = [(fmz, (dI',pI',mI'))];
   58.20 -"~~~~~ fun CalcTreeTEST, args:"; val ([(fmz, sp)]) = ([(fmz, (dI',pI',mI'))]);
   58.21 +"~~~~~ fun Test_Code.init_calc @{context}, args:"; val ([(fmz, sp)]) = ([(fmz, (dI',pI',mI'))]);
   58.22      val ((pt, p), tacis) = Step_Specify.nxt_specify_init_calc ctxt (fmz, sp)
   58.23  (*ADD check*) 
   58.24  val PblObj {origin= (oris, (dI', pI', mI'), _), spec= (dI, _, _), ctxt, ...} = get_obj I pt (fst p);
   58.25 @@ -71,8 +71,8 @@
   58.26  val [(fmz, (dI',pI',mI'))] = [(fmz''''', spec''''')];
   58.27  (*\\\----------------------------------------- saved for final check -----------------------///*)
   58.28  
   58.29 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   58.30 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   58.31  case nxt of Model_Problem => ()
   58.32 -| _ => error "minisubpbl: CalcTreeTEST has no nxt = Model_Problem";
   58.33 +| _ => error "minisubpbl: Test_Code.init_calc @{context} has no nxt = Model_Problem";
   58.34  
   58.35  Proof_Context.theory_of (Ctree.get_ctxt pt p); (*"Isac_Knowledge"*)
    59.1 --- a/test/Tools/isac/Minisubpbl/150-add-given.sml	Wed Oct 19 15:39:15 2022 +0200
    59.2 +++ b/test/Tools/isac/Minisubpbl/150-add-given.sml	Thu Oct 20 10:23:38 2022 +0200
    59.3 @@ -7,7 +7,7 @@
    59.4  val (dI',pI',mI') =
    59.5    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    59.6     ["Test", "squ-equ-test-subpbl1"]);
    59.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))]; (*nxt = ("Model_Problem"*)
    59.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))]; (*nxt = ("Model_Problem"*)
    59.9  (*for resuming after stepping into code*)
   59.10  val (p''',f''',nxt''',pt''') = (p,f,nxt,pt);
   59.11  
    60.1 --- a/test/Tools/isac/Minisubpbl/200-start-method-NEXT_STEP.sml	Wed Oct 19 15:39:15 2022 +0200
    60.2 +++ b/test/Tools/isac/Minisubpbl/200-start-method-NEXT_STEP.sml	Thu Oct 20 10:23:38 2022 +0200
    60.3 @@ -11,7 +11,7 @@
    60.4  val (dI',pI',mI') =
    60.5    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    60.6     ["Test", "squ-equ-test-subpbl1"]);
    60.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    60.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    60.9  (*[], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*Model_Problem*)
   60.10  
   60.11  (*rewrite__set_ called with 'Rule_Set.Empty' for 'precond_rootpbl x'*)
    61.1 --- a/test/Tools/isac/Minisubpbl/200-start-method.sml	Wed Oct 19 15:39:15 2022 +0200
    61.2 +++ b/test/Tools/isac/Minisubpbl/200-start-method.sml	Thu Oct 20 10:23:38 2022 +0200
    61.3 @@ -10,7 +10,7 @@
    61.4  val (dI',pI',mI') =
    61.5    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    61.6     ["Test", "squ-equ-test-subpbl1"]);
    61.7 -(*[], Pbl*)val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    61.8 +(*[], Pbl*)val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    61.9  (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*\<rightarrow>Add_Given "equality (x + 1 = 2)"*)
   61.10  (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*\<rightarrow>Add_Given "solveFor x"*)
   61.11  (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*\<rightarrow>Add_Find "solutions L"*)
    62.1 --- a/test/Tools/isac/Minisubpbl/250-Rewrite_Set-from-method.sml	Wed Oct 19 15:39:15 2022 +0200
    62.2 +++ b/test/Tools/isac/Minisubpbl/250-Rewrite_Set-from-method.sml	Thu Oct 20 10:23:38 2022 +0200
    62.3 @@ -10,7 +10,7 @@
    62.4  val (dI',pI',mI') =
    62.5    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    62.6     ["Test", "squ-equ-test-subpbl1"]);
    62.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    62.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    62.9  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   62.10  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   62.11  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    63.1 --- a/test/Tools/isac/Minisubpbl/300-init-subpbl-NEXT_STEP.sml	Wed Oct 19 15:39:15 2022 +0200
    63.2 +++ b/test/Tools/isac/Minisubpbl/300-init-subpbl-NEXT_STEP.sml	Thu Oct 20 10:23:38 2022 +0200
    63.3 @@ -11,7 +11,7 @@
    63.4  val (dI',pI',mI') =
    63.5    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    63.6     ["Test", "squ-equ-test-subpbl1"]);
    63.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    63.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    63.9  (*[], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, Pos.e_pos'), []);(*Model_Problem*)
   63.10  (*[], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, Pos.e_pos'), []);(*Specify_Theory*)
   63.11  (*[], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, Pos.e_pos'), []);(*Specify_Problem ["sqroot-test", "univariate", "equation", "test"*)
    64.1 --- a/test/Tools/isac/Minisubpbl/300-init-subpbl.sml	Wed Oct 19 15:39:15 2022 +0200
    64.2 +++ b/test/Tools/isac/Minisubpbl/300-init-subpbl.sml	Thu Oct 20 10:23:38 2022 +0200
    64.3 @@ -12,7 +12,7 @@
    64.4  val (dI',pI',mI') =
    64.5    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    64.6     ["Test", "squ-equ-test-subpbl1"]);
    64.7 -(*[], Pbl*)val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    64.8 +(*[], Pbl*)val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    64.9  (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   64.10  (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   64.11  (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   64.12 @@ -152,5 +152,5 @@
   64.13  if p = ([3], Pbl) andalso not (get_ctxt pt p |> ContextC.is_empty)
   64.14  then
   64.15    case nxt of (Model_Problem) => ()
   64.16 -  | _ => error "minisubpbl: CalcTreeTEST has no nxt = Model_Problem"
   64.17 +  | _ => error "minisubpbl: Test_Code.init_calc @{context} has no nxt = Model_Problem"
   64.18  else error "Minisubpbl/300-init-subpbl.sml changed";
    65.1 --- a/test/Tools/isac/Minisubpbl/400-start-meth-subpbl.sml	Wed Oct 19 15:39:15 2022 +0200
    65.2 +++ b/test/Tools/isac/Minisubpbl/400-start-meth-subpbl.sml	Thu Oct 20 10:23:38 2022 +0200
    65.3 @@ -10,7 +10,7 @@
    65.4  val (dI',pI',mI') =
    65.5     ("Test", ["sqroot-test", "univariate", "equation", "test"],
    65.6      ["Test", "squ-equ-test-subpbl1"]);
    65.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    65.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    65.9  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   65.10  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   65.11  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    66.1 --- a/test/Tools/isac/Minisubpbl/450-Rewrite_Set_Inst.sml	Wed Oct 19 15:39:15 2022 +0200
    66.2 +++ b/test/Tools/isac/Minisubpbl/450-Rewrite_Set_Inst.sml	Thu Oct 20 10:23:38 2022 +0200
    66.3 @@ -10,7 +10,7 @@
    66.4  val (dI',pI',mI') =
    66.5     ("Test", ["sqroot-test", "univariate", "equation", "test"],
    66.6      ["Test", "squ-equ-test-subpbl1"]);
    66.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    66.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    66.9  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   66.10  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   66.11  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    67.1 --- a/test/Tools/isac/Minisubpbl/470-Check_elementwise-NEXT_STEP.sml	Wed Oct 19 15:39:15 2022 +0200
    67.2 +++ b/test/Tools/isac/Minisubpbl/470-Check_elementwise-NEXT_STEP.sml	Thu Oct 20 10:23:38 2022 +0200
    67.3 @@ -11,7 +11,7 @@
    67.4  val (dI',pI',mI') =
    67.5    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    67.6     ["Test", "squ-equ-test-subpbl1"]);
    67.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    67.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    67.9  (*[], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, Pos.e_pos'), []);(*Model_Problem*)
   67.10  (*[], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, Pos.e_pos'), []);(*Specify_Theory*)
   67.11  (*[], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, Pos.e_pos'), []);(*Specify_Problem ["sqroot-test", "univariate", "equation", "test"*)
    68.1 --- a/test/Tools/isac/Minisubpbl/490-nxt-Check_Postcond.sml	Wed Oct 19 15:39:15 2022 +0200
    68.2 +++ b/test/Tools/isac/Minisubpbl/490-nxt-Check_Postcond.sml	Thu Oct 20 10:23:38 2022 +0200
    68.3 @@ -10,7 +10,7 @@
    68.4  val (dI',pI',mI') =
    68.5     ("Test", ["sqroot-test", "univariate", "equation", "test"],
    68.6      ["Test", "squ-equ-test-subpbl1"]);
    68.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    68.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    68.9  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   68.10  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   68.11  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    69.1 --- a/test/Tools/isac/Minisubpbl/500-met-sub-to-root.sml	Wed Oct 19 15:39:15 2022 +0200
    69.2 +++ b/test/Tools/isac/Minisubpbl/500-met-sub-to-root.sml	Thu Oct 20 10:23:38 2022 +0200
    69.3 @@ -10,7 +10,7 @@
    69.4  val (dI',pI',mI') =
    69.5     ("Test", ["sqroot-test", "univariate", "equation", "test"],
    69.6      ["Test", "squ-equ-test-subpbl1"]);
    69.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    69.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    69.9  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   69.10  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   69.11  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    70.1 --- a/test/Tools/isac/Minisubpbl/530-error-Check_Elementwise.sml	Wed Oct 19 15:39:15 2022 +0200
    70.2 +++ b/test/Tools/isac/Minisubpbl/530-error-Check_Elementwise.sml	Thu Oct 20 10:23:38 2022 +0200
    70.3 @@ -11,7 +11,7 @@
    70.4  val (dI',pI',mI') =
    70.5  ("Test", ["sqroot-test", "univariate", "equation", "test"],
    70.6  ["Test", "squ-equ-test-subpbl1"]);
    70.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    70.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    70.9  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   70.10  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   70.11  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    71.1 --- a/test/Tools/isac/Minisubpbl/600-postcond-NEXT_STEP.sml	Wed Oct 19 15:39:15 2022 +0200
    71.2 +++ b/test/Tools/isac/Minisubpbl/600-postcond-NEXT_STEP.sml	Thu Oct 20 10:23:38 2022 +0200
    71.3 @@ -10,7 +10,7 @@
    71.4  val (dI',pI',mI') =
    71.5    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    71.6     ["Test", "squ-equ-test-subpbl1"]);
    71.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    71.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    71.9  (*[], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*Model_Problem*)
   71.10  (*[], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*Specify_Theory*)
   71.11  (*[], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*Specify_Problem ["sqroot-test", "univariate", "equation", "test"*)
    72.1 --- a/test/Tools/isac/Minisubpbl/600-postcond.sml	Wed Oct 19 15:39:15 2022 +0200
    72.2 +++ b/test/Tools/isac/Minisubpbl/600-postcond.sml	Thu Oct 20 10:23:38 2022 +0200
    72.3 @@ -7,7 +7,7 @@
    72.4  val (dI',pI',mI') =
    72.5    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    72.6     ["Test", "squ-equ-test-subpbl1"]);
    72.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    72.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    72.9  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   72.10  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   72.11  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    73.1 --- a/test/Tools/isac/Minisubpbl/700-interSteps.sml	Wed Oct 19 15:39:15 2022 +0200
    73.2 +++ b/test/Tools/isac/Minisubpbl/700-interSteps.sml	Thu Oct 20 10:23:38 2022 +0200
    73.3 @@ -8,13 +8,13 @@
    73.4  (** adaption from rewtools.sml --- initContext..Ptool.Thy_, fun context_thm ---,
    73.5    *into a functional representation, i.e. we outcomment statements with side-effects:
    73.6   ** States.reset ();
    73.7 - ** CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    73.8 + ** CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    73.9   **   ("Test", ["sqroot-test", "univariate", "equation", "test"],
   73.10   **    ["Test", "squ-equ-test-subpbl1"]))];
   73.11   ** Iterator 1; moveActiveRoot 1;
   73.12   ** autoCalculate 1 CompleteCalc;
   73.13   **)
   73.14 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(["equality (x+1=(2::real))", "solveFor x", "solutions L"],
   73.15 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"],
   73.16    ("Test", ["sqroot-test", "univariate", "equation", "test"],
   73.17     ["Test", "squ-equ-test-subpbl1"]))];
   73.18  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    74.1 --- a/test/Tools/isac/Minisubpbl/710-interSteps-short.sml	Wed Oct 19 15:39:15 2022 +0200
    74.2 +++ b/test/Tools/isac/Minisubpbl/710-interSteps-short.sml	Thu Oct 20 10:23:38 2022 +0200
    74.3 @@ -7,7 +7,7 @@
    74.4  "----------- Minisubplb/710-interSteps-short.sml -----------------------------------------------";
    74.5  "----------- Minisubplb/710-interSteps-short.sml -----------------------------------------------";
    74.6  "----------- Minisubplb/710-interSteps-short.sml -----------------------------------------------";
    74.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(["equality (x+1=(2::real))", "solveFor x", "solutions L"],
    74.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"],
    74.9    ("Test", ["sqroot-test", "univariate", "equation", "test"],
   74.10     ["Test", "squ-equ-test-subpbl1"]))];
   74.11  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
    75.1 --- a/test/Tools/isac/Minisubpbl/790-complete-NEXT_STEP.sml	Wed Oct 19 15:39:15 2022 +0200
    75.2 +++ b/test/Tools/isac/Minisubpbl/790-complete-NEXT_STEP.sml	Thu Oct 20 10:23:38 2022 +0200
    75.3 @@ -11,7 +11,7 @@
    75.4  val (dI',pI',mI') =
    75.5    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    75.6     ["Test", "squ-equ-test-subpbl1"]);
    75.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    75.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    75.9  (*[], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*\<rightarrow>Model_Problem*)
   75.10  (*[], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*\<rightarrow>Specify_Theory*)
   75.11  (*[], Pbl*)val (_, ([(tac, _, _)], _, (pt, p))) = Step.do_next p ((pt, e_pos'), []);(*\<rightarrow>Specify_Problem ["sqroot-test", "univariate", "equation", "test"*)
    76.1 --- a/test/Tools/isac/Minisubpbl/790-complete.sml	Wed Oct 19 15:39:15 2022 +0200
    76.2 +++ b/test/Tools/isac/Minisubpbl/790-complete.sml	Thu Oct 20 10:23:38 2022 +0200
    76.3 @@ -8,7 +8,7 @@
    76.4  val fmz = ["equality (x+1=(2::real))", "solveFor x", "solutions L"];
    76.5  val (dI',pI',mI') = ("Test", ["sqroot-test", "univariate", "equation", "test"],
    76.6     ["Test", "squ-equ-test-subpbl1"]);
    76.7 -(*[], Pbl*)val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];(*Model_Problem*)
    76.8 +(*[], Pbl*)val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];(*Model_Problem*)
    76.9  (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt;(*\<rightarrow>Add_Given "equality (x + 1 = 2)"*)
   76.10  (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt;(*\<rightarrow>Add_Given "solveFor x"*)
   76.11  (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt;(*\<rightarrow>Add_Find "solutions L"*)
    77.1 --- a/test/Tools/isac/Minisubpbl/800-append-on-Frm.sml	Wed Oct 19 15:39:15 2022 +0200
    77.2 +++ b/test/Tools/isac/Minisubpbl/800-append-on-Frm.sml	Thu Oct 20 10:23:38 2022 +0200
    77.3 @@ -11,7 +11,7 @@
    77.4  val (dI',pI',mI') =
    77.5    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    77.6     ["Test", "squ-equ-test-subpbl1"]);
    77.7 - (*[], Pbl*)val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];(*Model_Problem*)
    77.8 + (*[], Pbl*)val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];(*Model_Problem*)
    77.9              (*autoCalculate 1 CompleteCalcHead;*)
   77.10   (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt;(*Add_Given "equality (x + 1 = 2)"*)
   77.11   (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt;(*Add_Given "solveFor x"*)
    78.1 --- a/test/Tools/isac/OLDTESTS/root-equ.sml	Wed Oct 19 15:39:15 2022 +0200
    78.2 +++ b/test/Tools/isac/OLDTESTS/root-equ.sml	Thu Oct 20 10:23:38 2022 +0200
    78.3 @@ -391,7 +391,7 @@
    78.4  val (dI',pI',mI') =
    78.5    ("Test",["sqroot-test", "univariate", "equation", "test"],
    78.6     ("Test", "sqrt-equ-test"));
    78.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    78.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    78.9  (*val nxt = ("Add_Given", Add_Given "equation (sqrt (#9 + #4 * x)  = sqrt x  + sqrt (#5 + x) )");*)
   78.10  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   78.11  (* val nxt = ("Add_Given",Add_Given "bound_variable x");*)
   78.12 @@ -493,7 +493,7 @@
   78.13    ("Test",["sqroot-test", "univariate", "equation", "test"],
   78.14     ["Test", "sqrt-equ-test"]);
   78.15  "--- s1 ---";
   78.16 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   78.17 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   78.18  "--- s1b ---";
   78.19  val nxt = ("Model_Problem",
   78.20  	   Model_Problem(*["sqroot-test", "univariate", "equation", "test"]*));
    79.1 --- a/test/Tools/isac/OLDTESTS/script.sml	Wed Oct 19 15:39:15 2022 +0200
    79.2 +++ b/test/Tools/isac/OLDTESTS/script.sml	Thu Oct 20 10:23:38 2022 +0200
    79.3 @@ -188,7 +188,7 @@
    79.4  val (dI',pI',mI') =
    79.5    ("Test",["sqroot-test", "univariate", "equation", "test"],
    79.6     ["Test", "sqrt-equ-test"]);
    79.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    79.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    79.9  val nxt = ("Model_Problem",
   79.10  	   Model_Problem ["sqroot-test", "univariate", "equation", "test"]);
   79.11  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   79.12 @@ -256,7 +256,7 @@
   79.13  val (dI',pI',mI') = ("Test",["sqroot-test", "univariate", "equation", "test"],
   79.14  		     ["Test", "sqrt-equ-test"]);
   79.15  val c = []; 
   79.16 -val (p,_,_,_,_,pt) = CalcTreeTEST [([], (dI',pI',mI')))];
   79.17 +val (p,_,_,_,_,pt) = Test_Code.init_calc @{context} [([], (dI',pI',mI')))];
   79.18  val nxt = ("Specify_Theory",Specify_Theory "Test");
   79.19  val (p,_,_,_,_,pt) = me nxt p c pt;
   79.20  val nxt = ("Specify_Method",Specify_Method ["Test", "sqrt-equ-test"]); (*for asm in square_equation_left*)
    80.1 --- a/test/Tools/isac/OLDTESTS/script_if.sml	Wed Oct 19 15:39:15 2022 +0200
    80.2 +++ b/test/Tools/isac/OLDTESTS/script_if.sml	Thu Oct 20 10:23:38 2022 +0200
    80.3 @@ -98,7 +98,7 @@
    80.4  val (dI',pI',mI') =
    80.5    ("Isac_Knowledge",["approximate", "univariate", "equation", "test"],
    80.6     ("Isac_Knowledge", "solve_univar_err"));
    80.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    80.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    80.9  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   80.10  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   80.11  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   80.12 @@ -135,7 +135,7 @@
   80.13  val (dI',pI',mI') =
   80.14    ("Isac_Knowledge",["approximate", "univariate", "equation", "test"],
   80.15     ("Isac_Knowledge", "solve_univar_err"));
   80.16 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   80.17 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   80.18  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   80.19  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   80.20  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
    81.1 --- a/test/Tools/isac/OLDTESTS/subp-rooteq.sml	Wed Oct 19 15:39:15 2022 +0200
    81.2 +++ b/test/Tools/isac/OLDTESTS/subp-rooteq.sml	Thu Oct 20 10:23:38 2022 +0200
    81.3 @@ -21,7 +21,7 @@
    81.4    ("Test",["LINEAR", "univariate", "equation", "test"],
    81.5     ["Test", "solve_linear"]);
    81.6  
    81.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))]; 
    81.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))]; 
    81.9  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   81.10  (*val nxt = ("Add_Given",Add_Given "equality (x + #1 + #-1 * #2 = #0)")*)
   81.11  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   81.12 @@ -63,7 +63,7 @@
   81.13  val (dI',pI',mI') =
   81.14    ("Test",["plain_square", "univariate", "equation", "test"],
   81.15     ["Test", "solve_plain_square"]);
   81.16 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   81.17 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
   81.18  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   81.19  
   81.20  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
    82.1 --- a/test/Tools/isac/OLDTESTS/tacis.sml	Wed Oct 19 15:39:15 2022 +0200
    82.2 +++ b/test/Tools/isac/OLDTESTS/tacis.sml	Thu Oct 20 10:23:38 2022 +0200
    82.3 @@ -13,7 +13,7 @@
    82.4  "------ fetchProposedTactic -> autoCalculate (Step1 ) ------------";
    82.5  "------ fetchProposedTactic -> autoCalculate (Step1 ) ------------";
    82.6   States.reset ();
    82.7 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    82.8 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    82.9  	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
   82.10  	     ["Test", "squ-equ-test-subpbl1"]))];
   82.11   Iterator 1; moveActiveRoot 1;
   82.12 @@ -83,7 +83,7 @@
   82.13  "------ setNextTactic -> autoCalculate (Step1 ) ------------------";
   82.14  "------ setNextTactic -> autoCalculate (Step1 ) ------------------";
   82.15   States.reset ();
   82.16 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   82.17 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   82.18  	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
   82.19  	     ["Test", "squ-equ-test-subpbl1"]))];
   82.20   Iterator 1; moveActiveRoot 1;
    83.1 --- a/test/Tools/isac/ProgLang/auto_prog.sml	Wed Oct 19 15:39:15 2022 +0200
    83.2 +++ b/test/Tools/isac/ProgLang/auto_prog.sml	Thu Oct 20 10:23:38 2022 +0200
    83.3 @@ -85,7 +85,7 @@
    83.4  then () else error "Auto_Prog.gen norm_Poly CHANGED";
    83.5  
    83.6  States.reset (); (*<-- evaluate, if ML-blocks are edited below*)
    83.7 -CalcTree
    83.8 +CalcTree @{context}
    83.9  [(["Term (b + a - b)", "normalform N"], 
   83.10    ("Poly",["polynomial", "simplification"],
   83.11    ["simplification", "for_polynomials"]))];
   83.12 @@ -182,7 +182,7 @@
   83.13  *** . . Const (empty, 'a)
   83.14  ***)
   83.15  States.reset ();
   83.16 -CalcTree
   83.17 +CalcTree @{context}
   83.18  [(["Term (b + a - b)", "normalform N"], 
   83.19    ((** )"Poly"( **)"Rational"(**),["polynomial", "simplification"],
   83.20    ["simplification", "of_rationals"]))];
    84.1 --- a/test/Tools/isac/ProgLang/evaluate.sml	Wed Oct 19 15:39:15 2022 +0200
    84.2 +++ b/test/Tools/isac/ProgLang/evaluate.sml	Thu Oct 20 10:23:38 2022 +0200
    84.3 @@ -83,7 +83,7 @@
    84.4  val (dI',pI',mI') =
    84.5    ("Test", ["calculate", "test"], ["Test", "test_calculate"]);
    84.6  
    84.7 -val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
    84.8 +val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    84.9  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   84.10  (*nxt =("Add_Given",Add_Given "realTestGiven (((#1 + #2) * #4 // #3)  \<up> #2)")*)
   84.11  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
    85.1 --- a/test/Tools/isac/Specify/cas-command.sml	Wed Oct 19 15:39:15 2022 +0200
    85.2 +++ b/test/Tools/isac/Specify/cas-command.sml	Thu Oct 20 10:23:38 2022 +0200
    85.3 @@ -6,17 +6,17 @@
    85.4  "-----------------------------------------------------------------------------------------------";
    85.5  "table of contents -----------------------------------------------------------------------------";
    85.6  "-----------------------------------------------------------------------------------------------";
    85.7 -"----------- start Calculation with CAS_Cmd, transferred from CalcTree to CalcTreeTEST ---------";
    85.8 +(*"----------- start Calculation with CAS_Cmd, transferred from CalcTree to Test_Code.init_calc --";*)
    85.9  "-----------------------------------------------------------------------------------------------";
   85.10  "-----------------------------------------------------------------------------------------------";
   85.11  "-----------------------------------------------------------------------------------------------";
   85.12  
   85.13 -"----------- start Calculation with CAS_Cmd, transferred from CalcTree to CalcTreeTEST ---------";
   85.14 -"----------- start Calculation with CAS_Cmd, transferred from CalcTree to CalcTreeTEST ---------";
   85.15 -"----------- start Calculation with CAS_Cmd, transferred from CalcTree to CalcTreeTEST ---------";
   85.16 -(*POSTPONE CORRECTION AT END OF TRANSITION TO Isabelle/PIDE/Isac
   85.17 -CalcTreeTEST [([], References.empty)];
   85.18 -"~~~~~ fun CalcTreeTEST, args:"; val [(fmz, sp) = [([], References.empty)];
   85.19 +(*POSTPONE CORRECTION AT END OF TRANSITION TO Isabelle/PIDE/Isac (~ Cas_Cmd)
   85.20 +"----------- start Calculation with CAS_Cmd, transferred from CalcTree to Test_Code.init_calc --";
   85.21 +"----------- start Calculation with CAS_Cmd, transferred from CalcTree to Test_Code.init_calc --";
   85.22 +"----------- start Calculation with CAS_Cmd, transferred from CalcTree to Test_Code.init_calc --";
   85.23 +Test_Code.init_calc @{context} [([], References.empty)];
   85.24 +"~~~~~ fun Test_Code.init_calc @{context}, args:"; val [(fmz, sp) = [([], References.empty)];
   85.25  "~~~~~ fun nxt_specify_init_calc , args:"; val (fmz : Formalise.model, (dI, pI, mI)) = (fmz, sp);
   85.26    val thy = ThyC.get_theory dI;
   85.27    (*if*) mI = ["no_met"]; (*else*)
   85.28 @@ -28,7 +28,7 @@
   85.29    ORGINALLY DONE IN test/../simplify.sml BY replaceFormula 1 "Simplify (2*a + 3*a)"
   85.30    after creation of the root Ctree.PblObj.
   85.31  ( **)
   85.32 +-----------------------------------------------------------------------------------------------*)
   85.33  
   85.34 -*)
   85.35  
   85.36  
    86.1 --- a/test/Tools/isac/Specify/i-model.sml	Wed Oct 19 15:39:15 2022 +0200
    86.2 +++ b/test/Tools/isac/Specify/i-model.sml	Thu Oct 20 10:23:38 2022 +0200
    86.3 @@ -20,7 +20,7 @@
    86.4  	"FunktionsVariable x", "GleichungsVariablen [c, c_2, c_3, c_4]",
    86.5    "AbleitungBiegelinie dy"];
    86.6  val f_spec = ("Biegelinie", ["Biegelinien"], ["IntegrierenUndKonstanteBestimmen2"]);
    86.7 -(*[], Pbl*)val (p,_,f,nxt,_,pt) = CalcTreeTEST [(f_model, f_spec)]; (*\<rightarrow>Model_Problem*)
    86.8 +(*[], Pbl*)val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(f_model, f_spec)]; (*\<rightarrow>Model_Problem*)
    86.9  (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*\<rightarrow>Add_Given "Traegerlaenge L"*)
   86.10  (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Add_Given "Streckenlast q_0"*)
   86.11  (*[], Pbl*)val (p''''',_,f,nxt''''',_,pt''''') = me nxt p [] pt; (*\<rightarrow>Add_Find "Biegelinie y"*)
    87.1 --- a/test/Tools/isac/Specify/o-model.sml	Wed Oct 19 15:39:15 2022 +0200
    87.2 +++ b/test/Tools/isac/Specify/o-model.sml	Thu Oct 20 10:23:38 2022 +0200
    87.3 @@ -27,9 +27,9 @@
    87.4  	"FunktionsVariable x", "GleichungsVariablen [c, c_2, c_3, c_4]",
    87.5    "AbleitungBiegelinie dy"];
    87.6  val f_spec = ("Biegelinie", ["Biegelinien"], ["IntegrierenUndKonstanteBestimmen2"]);
    87.7 -(*[], Pbl*)val (p,_,f,nxt,_,pt) = CalcTreeTEST [(f_model, f_spec)]; (*\<rightarrow>Model_Problem*)
    87.8 +(*[], Pbl*)val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(f_model, f_spec)]; (*\<rightarrow>Model_Problem*)
    87.9  
   87.10 -"~~~~~ fun CalcTreeTEST , args:"; val [(fmz, sp)] = [(f_model, f_spec)];
   87.11 +"~~~~~ fun Test_Code.init_calc @{context} , args:"; val [(fmz, sp)] = [(f_model, f_spec)];
   87.12  
   87.13  (*  val ((pt, p), tacis) =*)
   87.14  Step_Specify.nxt_specify_init_calc ctxt (fmz, sp);
    88.1 --- a/test/Tools/isac/Specify/refine.sml	Wed Oct 19 15:39:15 2022 +0200
    88.2 +++ b/test/Tools/isac/Specify/refine.sml	Thu Oct 20 10:23:38 2022 +0200
    88.3 @@ -330,7 +330,7 @@
    88.4  	   "errorBound (eps=0)", "solutions L"];
    88.5  val (dI',pI',mI') = ("Test",["sqroot-test", "univariate", "equation", "test"],
    88.6  		     ["Test", "squ-equ-test-subpbl1"]);
    88.7 -(*[], Pbl*)val (p,_,f,nxt,_,pt) = Test_Code.CalcTreeTEST [(fmz, (dI',pI',mI'))];
    88.8 +(*[], Pbl*)val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
    88.9  (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt;
   88.10  (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt;
   88.11  (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; (*\<rightarrow>Add_Find "solutions L"*)
   88.12 @@ -520,7 +520,7 @@
   88.13  val model = ["equality (x/(x \<up> 2 - 6*x+9) - 1/(x \<up> 2 - 3*x) =1/x)", "solveFor x", "solutions L"];
   88.14  val refs = ("PolyEq"(**), ["univariate", "equation"], ["no_met"]);
   88.15  
   88.16 -CalcTree [(model, refs)];
   88.17 +CalcTree @{context} [(model, refs)];
   88.18  
   88.19  Iterator 1;
   88.20  moveActiveRoot 1;
    89.1 --- a/test/Tools/isac/Specify/specify.sml	Wed Oct 19 15:39:15 2022 +0200
    89.2 +++ b/test/Tools/isac/Specify/specify.sml	Thu Oct 20 10:23:38 2022 +0200
    89.3 @@ -19,7 +19,7 @@
    89.4  "----------- maximum-example: Specify.finish_phase ---------------------------------------------";
    89.5  (*//-------- WAS OUT OF Test UNTIL 200209, ERROR PROBABLY FROM INTRO. OF Isabelle's funpack --\\* )
    89.6   val (p,_,f,nxt,_,pt) = 
    89.7 -     CalcTreeTEST 
    89.8 +     Test_Code.init_calc @{context} 
    89.9       [(["fixedValues [r=Arbfix]", "maximum A",
   89.10  	"valuesFor [a,b]",
   89.11  	"relations [A=a*b, (a/2) \<up> 2 + (b/2) \<up> 2 = r \<up> 2]",
   89.12 @@ -75,7 +75,7 @@
   89.13  "----------- maximum-example: I_Model.complete -------------------------------------------------";
   89.14  "----------- maximum-example: I_Model.complete -------------------------------------------------";
   89.15   val c = [];
   89.16 - val (p,_,f,nxt,_,pt) = CalcTreeTEST 
   89.17 + val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} 
   89.18   [(["fixedValues [r=Arbfix]", "maximum A",
   89.19  	"valuesFor [a,b]",
   89.20  	"relations [A=a*b, (a/2) \<up> 2 + (b/2) \<up> 2 = r \<up> 2]",
   89.21 @@ -161,9 +161,9 @@
   89.22  	     "AbleitungBiegelinie dy"];
   89.23  val references = ("Biegelinie", ["Biegelinien"], ["IntegrierenUndKonstanteBestimmen2"]);
   89.24  val p = e_pos'; val c = [];
   89.25 -(*[], Pbl*)val (p,_,f,nxt,_,pt) = CalcTreeTEST [(formalise, references)]; (*nxt = Model_Problem*)
   89.26 +(*[], Pbl*)val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(formalise, references)]; (*nxt = Model_Problem*)
   89.27  
   89.28 -(*/------------------- check result of CalcTreeTEST ----------------------------------------\*)
   89.29 +(*/------------------- check result of Test_Code.init_calc @{context} ----------------------------------------\*)
   89.30  (*+*)val (o_model, ("Biegelinie", ["Biegelinien"], ["IntegrierenUndKonstanteBestimmen2"]), _) =
   89.31    get_obj g_origin pt (fst p);
   89.32  (*+*)if O_Model.to_string o_model = "[\n" ^
   89.33 @@ -175,7 +175,7 @@
   89.34    "(6, [\"1\"], #undef, GleichungsVariablen, [\"[c]\", \"[c_2]\", \"[c_3]\", \"[c_4]\"]), \n" ^
   89.35    "(7, [\"1\"], #undef, AbleitungBiegelinie, [\"dy\"])]"
   89.36  then () else error "[IntegrierenUndKonstanteBestimmen2] O_Model CHANGED";
   89.37 -(*\------------------- check result of CalcTreeTEST ----------------------------------------/*)
   89.38 +(*\------------------- check result of Test_Code.init_calc @{context} ----------------------------------------/*)
   89.39  
   89.40  (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; (*\<rightarrow>Add_Given "Traegerlaenge L"*)
   89.41  (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; (*\<rightarrow>Add_Given "Streckenlast q_0"*)
    90.1 --- a/test/Tools/isac/Specify/step-specify.sml	Wed Oct 19 15:39:15 2022 +0200
    90.2 +++ b/test/Tools/isac/Specify/step-specify.sml	Thu Oct 20 10:23:38 2022 +0200
    90.3 @@ -17,7 +17,7 @@
    90.4  "----------- re-build: Step_Specify.do_next  ---------------------------------------------------";
    90.5  "----------- re-build: Step_Specify.do_next  ---------------------------------------------------";
    90.6  States.reset ();  
    90.7 -CalcTree (*ATTENTION: encode_fmz ... unlike CalcTreeTEST*)
    90.8 +CalcTree @{context} (*ATTENTION: encode_fmz ... unlike Test_Code.init_calc @{context}*)
    90.9      [(["functionTerm (x \<up> 2 + 1)", "integrateBy x", "antiDerivative FF"],
   90.10        ("Integrate", ["integrate", "function"], ["diff", "integration"]))];
   90.11  Iterator 1;
    91.1 --- a/test/Tools/isac/Test_Code/test-code.sml	Wed Oct 19 15:39:15 2022 +0200
    91.2 +++ b/test/Tools/isac/Test_Code/test-code.sml	Thu Oct 20 10:23:38 2022 +0200
    91.3 @@ -18,7 +18,7 @@
    91.4  val (dI',pI',mI') =
    91.5    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    91.6     ["Test", "squ-equ-test-subpbl1"]);
    91.7 - (*[], Pbl*)val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];(*Model_Problem*)
    91.8 + (*[], Pbl*)val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];(*Model_Problem*)
    91.9  (*[], Pbl*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;
   91.10  (*[], Pbl*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;
   91.11  (*[], Pbl*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;
    92.1 --- a/test/Tools/isac/Test_Isac.thy	Wed Oct 19 15:39:15 2022 +0200
    92.2 +++ b/test/Tools/isac/Test_Isac.thy	Thu Oct 20 10:23:38 2022 +0200
    92.3 @@ -91,7 +91,7 @@
    92.4  ML \<open>
    92.5    open Kernel;
    92.6    open Math_Engine;
    92.7 -  open Test_Code;              CalcTreeTEST;
    92.8 +  open Test_Code;              Test_Code.init_calc @{context};
    92.9    open LItool;                 arguments_from_model;
   92.10    open Sub_Problem;
   92.11    open Fetch_Tacs;
   92.12 @@ -320,6 +320,1632 @@
   92.13  ML \<open>
   92.14  \<close> ML \<open>
   92.15  \<close> ML \<open>
   92.16 +(* Title:  tests the interface of isac's SML-kernel in accordance to 
   92.17 +           java-tests/isac.bridge.
   92.18 +   Author: Walther Neuper
   92.19 +   (c) copyright due to lincense terms.
   92.20 +
   92.21 +Tests the interface of isac's SML-kernel in accordance to java-tests/isac.bridge.
   92.22 +Some tests are outcommented since "eliminate ThmC.numerals_to_Free";
   92.23 +these are considered irrelevant for Isabelle/Isac.
   92.24 +
   92.25 +WN050707 ... if true, the test ist marked with a \label referring
   92.26 +to the same UC in isac-docu.tex as the JUnit testcase.
   92.27 +WN120210?not ME: added some labels, which are not among the above,
   92.28 +repaired lost \label (s).
   92.29 +
   92.30 +theory Test_Some imports Isac.Build_Thydata begin 
   92.31 +ML {* KEStore_Elems.set_ref_thy @{theory};
   92.32 +  fun autoCalculate' cI auto = autoCalculate cI auto (*|> Future.join*) *}
   92.33 +ML_file "Frontend/use-cases.sml"
   92.34 +*)
   92.35 +
   92.36 +"--------------------------------------------------------";
   92.37 +"table of contents --------------------------------------";
   92.38 +"--------------------------------------------------------";
   92.39 +"within struct ------------------------------------------";
   92.40 +"--------------------------------------------------------";
   92.41 +"--------- encode ^ -> ^^ ------------------------------";
   92.42 +"--------------------------------------------------------";
   92.43 +"exported from struct -----------------------------------";
   92.44 +"--------------------------------------------------------";
   92.45 +(*"--------- empty rootpbl --------------------------------";*)
   92.46 +"--------- solve_linear as rootpbl FE -------------------";
   92.47 +"--------- inspect the CalcTree @{context} No.1 with Iterator No.2 -";
   92.48 +"--------- miniscript with mini-subpbl ------------------";
   92.49 +"--------- mini-subpbl AUTOCALCULATE Steps 1 ------------";
   92.50 +"--------- solve_linear as rootpbl AUTO CompleteCalc ----";
   92.51 +"--------- solve_linear as rootpbl AUTO CompleteHead/Eval ";
   92.52 +"--------- mini-subpbl AUTOCALCULATE CompleteCalc -------";
   92.53 +"--------- mini-subpbl AUTO CompleteCalcHead ------------";
   92.54 +"--------- solve_linear as rootpbl AUTO CompleteModel ---";
   92.55 +"--------- setContext..Thy ------------------------------";
   92.56 +"--------- mini-subpbl AUTOCALC CompleteToSubpbl --------";
   92.57 +"--------- rat-eq + subpbl: no_met, NO solution dropped - WITH fun me IN test/../solve.sml";
   92.58 +"--------- tryMatchProblem, tryRefineProblem ------------";
   92.59 +"--------- modifyCalcHead, resetCalcHead, modelProblem --";
   92.60 +"--------- maximum-example, UC: Modeling an example -----";
   92.61 +"--------- solve_linear from pbl-hierarchy --------------";
   92.62 +"--------- solve_linear as in an algebra system (CAS)----";
   92.63 +"--------- interSteps: on 'miniscript with mini-subpbl' -";
   92.64 +"--------- getTactic, fetchApplicableTactics ------------";
   92.65 +"--------- getAssumptions, getAccumulatedAsms -----------";
   92.66 +"--------- arbitrary combinations of steps --------------";
   92.67 +"--------- appendF label{SOLVE:MANUAL:FORMULA:enter}right";
   92.68 +"--------- appendF label{SOLVE:MANUAL:FORMULA:enter}other";
   92.69 +"--------- appendF label{SOLVE:MANUAL:FORMULA:enter}oth 2";
   92.70 +"--------- appendF label{SOLVE:MANUAL:FORMULA:enter}NOTok";
   92.71 +"--------- replaceFormula {SOL:MAN:FOR:replace} right----";
   92.72 +"--------- replaceFormula {SOL:MAN:FOR:replace} other----";
   92.73 +"--------- replaceFormula {SOL:MAN:FOR:replace} other 2--";
   92.74 +"--------- replaceFormula {SOL:MAN:FOR:replace} NOTok----";
   92.75 +"--------- UC errpat chain-rule-diff-both, fillpat by input ------";
   92.76 +"--------- UC errpat add-fraction, fillpat by input --------------";
   92.77 +"--------- UC errpat, fillpat step to Rewrite --------------------";
   92.78 +"--------- UC errpat, fillpat step to Rewrite_Set ----------------";
   92.79 +"--------------------------------------------------------";
   92.80 +
   92.81 +"within struct ---------------------------------------------------";
   92.82 +"within struct ---------------------------------------------------";
   92.83 +"within struct ---------------------------------------------------";
   92.84 +(*==================================================================
   92.85 +
   92.86 +==================================================================*)
   92.87 +"exported from struct --------------------------------------------";
   92.88 +"exported from struct --------------------------------------------";
   92.89 +"exported from struct --------------------------------------------";
   92.90 +
   92.91 +
   92.92 +(*------------ set at startup of the Kernel ----------------------*)
   92.93 +States.reset ();  (*resets all state information in Kernel        *)
   92.94 +(*----------------------------------------------------------------*)
   92.95 +
   92.96 +(*---------------------------------------------------- postpone to Outer_Syntax..Example -----
   92.97 +"--------- empty rootpbl --------------------------------";
   92.98 +"--------- empty rootpbl --------------------------------";
   92.99 +"--------- empty rootpbl --------------------------------";
  92.100 + CalcTree @{context} [([], ("", [], []))];
  92.101 + Iterator 1;
  92.102 + moveActiveRoot 1;
  92.103 + refFormula 1 (States.get_pos 1 1);
  92.104 +(*WN.040222: stoert das sehr, dass ThyC.id_empty etc. statt leer kommt ???*)
  92.105 +DEconstrCalcTree 1;
  92.106 +------------------------------------------------------ postpone to Outer_Syntax..Example -----*)
  92.107 +
  92.108 +"--------- solve_linear as rootpbl FE -------------------";
  92.109 +"--------- solve_linear as rootpbl FE -------------------";
  92.110 +"--------- solve_linear as rootpbl FE -------------------";
  92.111 +States.reset ();
  92.112 +
  92.113 + CalcTree @{context}      (*start of calculation, return No.1*)
  92.114 +     [(["equality (1+- 1*2+x=(0::real))", "solveFor x", "solutions L"],
  92.115 +       ("Test", 
  92.116 +	["LINEAR", "univariate", "equation", "test"],
  92.117 +	["Test", "solve_linear"]))];
  92.118 + Iterator 1;     (*create an active Iterator on CalcTree @{context} No.1*)
  92.119 + 
  92.120 + moveActiveRoot 1;(*sets the CalcIterator No.1 at the root of CalcTree @{context} No.1*);
  92.121 + refFormula 1 (States.get_pos 1 1)  (*gets CalcHead; model is still empty*);
  92.122 + 
  92.123 +
  92.124 +(*1*) fetchProposedTactic 1 (*by using Iterator No.1*);
  92.125 + setNextTactic 1 (Model_Problem); (*by using Iterator No.1*)
  92.126 + autoCalculate 1 (Steps 1);
  92.127 + refFormula 1 (States.get_pos 1 1)  (*model contains descriptions for all items*);
  92.128 + autoCalculate 1 (Steps 1);
  92.129 +(*-----since Model_Problem + complete_mod_ in case cas of SOME-----*
  92.130 +(*2*)  fetchProposedTactic 1;
  92.131 + setNextTactic 1 (Add_Given "equality (1 + - 1 * 2 + x = 0)");
  92.132 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1); (*equality added*);
  92.133 +
  92.134 +(*3*)  fetchProposedTactic 1;
  92.135 + setNextTactic 1 (Add_Given "solveFor x");
  92.136 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.137 +
  92.138 +(*4*)  fetchProposedTactic 1;
  92.139 + setNextTactic 1 (Add_Find "solutions L");
  92.140 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.141 +
  92.142 +(*5*)  fetchProposedTactic 1;
  92.143 + setNextTactic 1 (Specify_Theory "Test");
  92.144 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.145 +*-----since Model_Problem + complete_mod_ in case cas of SOME-----*)
  92.146 +
  92.147 +(*6*)  fetchProposedTactic 1;
  92.148 + setNextTactic 1 (Specify_Problem ["LINEAR", "univariate", "equation", "test"]);
  92.149 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.150 +(*-------------------------------------------------------------------------*)
  92.151 +(*7*)  fetchProposedTactic 1;
  92.152 + val (ptp as (pt,p), tacis) = States.get_calc 1; States.get_pos 1 1;
  92.153 +
  92.154 + setNextTactic 1 (Specify_Method ["Test", "solve_linear"]);
  92.155 + val (ptp as (pt,p), tacis) = States.get_calc 1; States.get_pos 1 1;
  92.156 +
  92.157 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.158 + val (ptp as (pt,p), tacis) = States.get_calc 1; States.get_pos 1 1;
  92.159 +
  92.160 +(*-------------------------------------------------------------------------*)
  92.161 +(*8*)  fetchProposedTactic 1;
  92.162 + val (ptp as (pt,p), tacis) = States.get_calc 1; States.get_pos 1 1;
  92.163 +
  92.164 +(*8*)  setNextTactic 1 (Apply_Method ["Test", "solve_linear"]);
  92.165 +   (*ERROR.110620 <SETNEXTTACTIC>..<MESSAGE> end-of-calculation*)
  92.166 + val (ptp as (pt,p), tacis) = States.get_calc 1; States.get_pos 1 1;
  92.167 + SpecificationC.is_complete ptp;
  92.168 + References.are_complete ptp;
  92.169 +
  92.170 +(*8*)  autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1); (*<---------------------- orig. test code*)
  92.171 +
  92.172 + val (ptp as (pt,p), tacis) = States.get_calc 1; States.get_pos 1 1; (*<---------------------- orig. test code*)
  92.173 +(*+isa=REP*) if p = ([1], Frm) andalso UnparseC.term (get_obj g_form pt [1]) = "1 + - 1 * 2 + x = 0"
  92.174 +andalso Istate.string_of (get_istate_LI pt p)
  92.175 +  = "Pstate ([\"\n(e_e, 1 + - 1 * 2 + x = 0)\", \"\n(v_v, x)\"], [], empty, NONE, \n??.empty, ORundef, false, true)"
  92.176 +then () else error "refFormula =   1 + - 1 * 2 + x = 0   changed";
  92.177 +(*-------------------------------------------------------------------------*)
  92.178 +
  92.179 +(*9*) fetchProposedTactic 1; (*<----------------------------------------------------- orig. test code*)
  92.180 +(*+\\------------------------------------------ isa == REP -----------------------------------//* )
  92.181 +(*+//========================================== isa <> REP (1) ===============================\\*)
  92.182 +(*9*) setNextTactic 1 (Rewrite_Set_Inst (["(''bdv'',x)"], "isolate_bdv")); ( *<------- orig. test code*)
  92.183 +
  92.184 +"~~~~~ fun setNextTactic , args:"; val (cI, tac) = (1, (Rewrite_Set_Inst (["(''bdv'',x)"], "isolate_bdv")));
  92.185 +    val ((pt'''''_', _), _) = States.get_calc cI
  92.186 +    val ip'''''_' = States.get_pos cI 1;
  92.187 +
  92.188 +    val xxxxx_x(*"ok", (tacis, _, _)*) = (*case*) Step.by_tactic tac (pt'''''_', ip'''''_') (*of*);
  92.189 +(*+isa+REP*)val ("ok", ( [ (Rewrite_Set_Inst (["(''bdv'', x)"], "isolate_bdv"),
  92.190 +     Rewrite_Set_Inst' _, (pos', (istate, ctxt))) ] , _, cstate)) = xxxxx_x;
  92.191 +
  92.192 +(*//******************* Step.by_tactic returns tac_ + istate + cstate *****************************\\*)
  92.193 +Step.by_tactic : Tactic.input -> state -> string * (State_Steps.T * pos' list * state);
  92.194 +if Istate.string_of istate
  92.195 + = "Pstate ([\"\n(e_e, 1 + - 1 * 2 + x = 0)\", \"\n(v_v, x)\"], [R, L, R, L, R, L, R], empty, SOME e_e, \nx = 0 + - 1 * (1 + - 1 * 2), ORundef, true, true)"
  92.196 +then () else error "from Step.by_tactic return --- changed 1";
  92.197 +
  92.198 +if Istate.string_of (get_istate_LI (fst cstate) (snd cstate))
  92.199 + = "Pstate ([\"\n(e_e, 1 + - 1 * 2 + x = 0)\", \"\n(v_v, x)\"], [R, L, R, L, R, L, R], empty, SOME e_e, \nx = 0 + - 1 * (1 + - 1 * 2), ORundef, true, true)"
  92.200 +then () else error "from Step.by_tactic return --- changed 2";
  92.201 +(*\\******************* Step.by_tactic returns tac_ + istate + cstate *****************************//*)
  92.202 +
  92.203 +"~~~~~ fun Step.by_tactic , args:"; val (tac, (ptp as (pt, p))) = (tac, (pt'''''_', ip'''''_'));
  92.204 +      val Applicable.Yes m = (*case*) Step.check tac (pt, p) (*of*);
  92.205 +      (*if*) Tactic.for_specify' m; (*false*)
  92.206 +
  92.207 +Step_Solve.by_tactic m (pt, p);
  92.208 +"~~~~~ fun by_tactic , args:"; val (m, (pt, po as (p, p_))) = (m, (pt, p));
  92.209 +    (*if*) MethodC.id_empty = get_obj g_metID pt (par_pblobj pt p); (*else*)
  92.210 +	      val thy' = get_obj g_domID pt (par_pblobj pt p);
  92.211 +	      val (is, sc) = LItool.resume_prog (p,p_) pt;
  92.212 +        val Safe_Step (istate, _, tac) =
  92.213 +          (*case*) LI.locate_input_tactic sc (pt, po) (fst is) (snd is) m (*of*);
  92.214 +
  92.215 +(*+*)Safe_Step: Istate.T * Proof.context * Tactic.T -> input_tactic_result;
  92.216 +(********************* locate_input_tactic returns cstate * istate * Proof.context  *************)
  92.217 +(*+*)if Istate.string_of istate
  92.218 +(*+isa*) = "Pstate ([\"\n(e_e, 1 + - 1 * 2 + x = 0)\", \"\n(v_v, x)\"], [R, L, R, L, R, L, R], empty, SOME e_e, \nx = 0 + - 1 * (1 + - 1 * 2), ORundef, true, true)"
  92.219 +then case m of Rewrite_Set_Inst' _ => ()
  92.220 +else error "from locate_input_tactic return --- changed";
  92.221 +
  92.222 +val ("ok", (tacis'''''_', _, _)) = xxxxx_x;
  92.223 +"~~~~~ from TOPLEVEL to states return:"; States.upd_calc cI ((pt'''''_', ip'''''_'), tacis'''''_');
  92.224 +(*\\=========================================== isa <> REP (1) ===============================//*)
  92.225 +(*//=========================================== isa <> REP (2) ===============================\\*)
  92.226 +(*9* ) autoCalculate 1 (Steps 1); (*<-------------------------------------------------- orig. test code*)
  92.227 +( *isa: <AUTOCALC><CALCID>1</CALCID><CALCCHANGED><UNCHANGED><INTLIST><INT>1</INT></INTLIST><POS>Frm</POS></UNCHANGED><DELETED><INTLIST><INT>1</INT></INTLIST><POS>Frm</POS></DELETED><GENERATED><INTLIST><INT>1</INT></INTLIST><POS>Res</POS></GENERATED></CALCCHANGED></AUTOCALC>*)
  92.228 +
  92.229 +"~~~~~ fun autoCalculate , args:"; val (cI, auto) = (1, (Steps 1));
  92.230 +     val pold = States.get_pos cI 1;
  92.231 +     val xxx = (States.get_calc cI);
  92.232 +(*isa*) val (**)xxxx(**) (**) = (**) 
  92.233 +       (*case*) Math_Engine.autocalc [] pold (xxx) auto (*of*);
  92.234 +"~~~~~ fun autocalc , args:"; val (c, ip, cs, (Solve.Steps s)) = ([], pold, (xxx), auto);
  92.235 +    (*if*) s <= 1; (*then*)
  92.236 +    (*val (str, (_, c', ptp)) =*)
  92.237 +
  92.238 +Step.do_next ip cs;
  92.239 +"~~~~~ fun do_next , args:"; val ((ip as (_, p_)), (ptp as (pt,p), tacis)) = (ip, cs);
  92.240 +
  92.241 +(*+isa==REP*)val [(Rewrite_Set_Inst (["(''bdv'', x)"], "isolate_bdv"),
  92.242 +     Rewrite_Set_Inst' _, (pos', (istate, ctxt)))] = tacis;
  92.243 +(*+*)if pos' = ([1], Res) andalso Istate.string_of istate
  92.244 + = "Pstate ([\"\n(e_e, 1 + - 1 * 2 + x = 0)\", \"\n(v_v, x)\"], [R, L, R, L, R, L, R], empty, SOME e_e, \nx = 0 + - 1 * (1 + - 1 * 2), ORundef, true, true)"
  92.245 +then () else error "init. step 1 + - 1 * 2 + x = 0 changed";
  92.246 +
  92.247 +       val pIopt = get_pblID (pt,ip);
  92.248 +       (*if*) ip = ([], Pos.Res);(*else*)
  92.249 +         val (_::_) = (*case*) tacis (*of*);
  92.250 +(*isa==REP*)    (*if*) ip = p;(*then*)
  92.251 +           (*val (pt',c',p') =*) Solve_Step.s_add_general tacis (pt,[],p);
  92.252 +(*//------------------------------------- final test -----------------------------------------\\*)
  92.253 +val ("ok", [], ptp as (pt, p)) = xxxx;
  92.254 +                                         
  92.255 +if Istate.string_of (get_istate_LI pt p) (*                <>                 <>                 <>                 <>                     \<up> \<up> \<up> \<up> ^*)
  92.256 +(*REP*) = "Pstate ([\"\n(e_e, 1 + - 1 * 2 + x = 0)\", \"\n(v_v, x)\"], [R, L, R, L, R, L, R], empty, SOME e_e, \nx = 0 + - 1 * (1 + - 1 * 2), ORundef, true, true)"
  92.257 +then () else error "REP autoCalculate on (e_e, 1 + - 1 * 2 + x = 0) changed"
  92.258 +
  92.259 +"~~~~~ from TOPLEVEL to states return:";  States.upd_calc cI (ptp, []); States.upd_ipos cI 1 p;
  92.260 +(*\\=========================================== isa <> REP (2) ===============================//*)
  92.261 +
  92.262 +(*10*)  fetchProposedTactic 1;
  92.263 + setNextTactic 1 (Rewrite_Set "Test_simplify");
  92.264 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.265 +
  92.266 +(*11*)  fetchProposedTactic 1;
  92.267 + setNextTactic 1 (Check_Postcond ["LINEAR", "univariate", "equation", "test"]);
  92.268 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.269 +
  92.270 +(*======= final test ==================================================*)
  92.271 + val ((pt,_),_) = States.get_calc 1;
  92.272 + val ip = States.get_pos 1 1;
  92.273 +
  92.274 + val (Form f, tac, asms) = ME_Misc.pt_extract (pt, ip);
  92.275 +     (*exception just above means: 'ModSpec' has been returned: error anyway*)
  92.276 + if ip = ([], Res) andalso UnparseC.term f = "[x = 1]" then () else 
  92.277 + error "FE-Kernel-interface.sml: diff.behav. in solve_linear as rootpbl";
  92.278 +
  92.279 +
  92.280 +"--------- inspect the CalcTree @{context} No.1 with Iterator No.2 -";
  92.281 +"--------- inspect the CalcTree @{context} No.1 with Iterator No.2 -";
  92.282 +"--------- inspect the CalcTree @{context} No.1 with Iterator No.2 -";
  92.283 +(*WN041118: inspection shifted to Iterator No.1, because others need pos'*)
  92.284 +(*-------- WN190723: doesnt work since changeset 59474	21d4d2868b83
  92.285 + moveActiveRoot 1; 
  92.286 + refFormula 1 ([],Pbl); getTactic 1 ([],Pbl);(*Error*)
  92.287 + moveActiveDown 1; 
  92.288 + refFormula 1 ([1],Frm); getTactic 1 ([1],Frm);(*Error*)
  92.289 + moveActiveDown 1 ; 
  92.290 + refFormula 1 ([1],Res); getTactic 1 ([1],Res);(*OK*) 
  92.291 + (*getAssumption 1 ([1],Res); TODO.WN041217*)
  92.292 + moveActiveDown 1 ; refFormula 1 ([2],Res);
  92.293 + moveActiveCalcHead 1; refFormula 1 ([],Pbl);
  92.294 + moveActiveDown 1;
  92.295 + moveActiveDown 1;
  92.296 + moveActiveDown 1;
  92.297 + if States.get_pos 1 1 = ([2], Res) then () else 
  92.298 + error "FE-interface.sml: diff.behav. in a inspect 1 with Iterator 2";
  92.299 + moveActiveDown 1; refFormula 1 ([], Res);
  92.300 + if States.get_pos 1 1 = ([], Res) then () else 
  92.301 + error "FE-interface.sml: diff.behav. in b inspect 1 with Iterator 2";
  92.302 + moveActiveCalcHead 1; refFormula 1 ([],Pbl);
  92.303 +DEconstrCalcTree 1;
  92.304 +------------------------------------------------------------------------------------------------*)
  92.305 +
  92.306 +"--------- miniscript with mini-subpbl ------------------";
  92.307 +"--------- miniscript with mini-subpbl ------------------";
  92.308 +"--------- miniscript with mini-subpbl ------------------";
  92.309 +(*WN120210?not ME:\label{SOLVE:MANUAL:TACTIC:enter} UC 30.3.2.1 p.175 !!!!!NOT IMPL IN FE*)
  92.310 +"=== this sequence of fun-calls resembles fun me ===";
  92.311 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  92.312 +   ("Test", ["sqroot-test", "univariate", "equation", "test"],
  92.313 +    ["Test", "squ-equ-test-subpbl1"]))];
  92.314 + Iterator 1;
  92.315 +
  92.316 + moveActiveRoot 1; 
  92.317 + refFormula 1 (States.get_pos 1 1);
  92.318 + fetchProposedTactic 1;
  92.319 + setNextTactic 1 (Model_Problem);
  92.320 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);(*gets ModSpec;model is still empty*)
  92.321 +
  92.322 + fetchProposedTactic 1; (*<SYSERROR><CALCID>1</CALCID><ERROR>error in kernel 3</ERROR></SYSERROR>* )
  92.323 + setNextTactic 1 (Add_Given "equality (x + 1 = 2)");
  92.324 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.325 +
  92.326 + fetchProposedTactic 1;
  92.327 + setNextTactic 1 (Add_Given "solveFor x");
  92.328 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.329 +
  92.330 + fetchProposedTactic 1;
  92.331 + setNextTactic 1 (Add_Find "solutions L");
  92.332 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.333 +
  92.334 + fetchProposedTactic 1;
  92.335 + setNextTactic 1 (Specify_Theory "Test");
  92.336 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.337 +
  92.338 + fetchProposedTactic 1;
  92.339 + setNextTactic 1 (Specify_Problem 
  92.340 +		      ["sqroot-test", "univariate", "equation", "test"]);
  92.341 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.342 +"1-----------------------------------------------------------------";
  92.343 +
  92.344 + fetchProposedTactic 1;
  92.345 + setNextTactic 1 (Specify_Method ["Test", "squ-equ-test-subpbl1"]);
  92.346 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.347 +
  92.348 + fetchProposedTactic 1;
  92.349 + setNextTactic 1 (Apply_Method ["Test", "squ-equ-test-subpbl1"]);
  92.350 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.351 +
  92.352 + fetchProposedTactic 1;
  92.353 + setNextTactic 1 (Rewrite_Set "norm_equation");
  92.354 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.355 +
  92.356 + fetchProposedTactic 1;
  92.357 + setNextTactic 1 (Rewrite_Set "Test_simplify");
  92.358 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.359 +
  92.360 + fetchProposedTactic 1;(*----------------Subproblem--------------------*);
  92.361 + setNextTactic 1 (Subproblem ("Test",
  92.362 +			      ["LINEAR", "univariate", "equation", "test"]));
  92.363 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.364 +
  92.365 + fetchProposedTactic 1;
  92.366 + setNextTactic 1 (Model_Problem );
  92.367 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.368 +
  92.369 + fetchProposedTactic 1;
  92.370 + setNextTactic 1 (Add_Given "equality (- 1 + x = 0)");
  92.371 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.372 +
  92.373 + fetchProposedTactic 1;
  92.374 + setNextTactic 1 (Add_Given "solveFor x");
  92.375 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.376 +
  92.377 + fetchProposedTactic 1;
  92.378 + setNextTactic 1 (Add_Find "solutions x_i");
  92.379 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.380 +
  92.381 + fetchProposedTactic 1;
  92.382 + setNextTactic 1 (Specify_Theory "Test");
  92.383 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.384 +
  92.385 + fetchProposedTactic 1;
  92.386 + setNextTactic 1 (Specify_Problem ["LINEAR", "univariate", "equation", "test"]);
  92.387 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.388 +"2-----------------------------------------------------------------";
  92.389 +
  92.390 + fetchProposedTactic 1;
  92.391 + setNextTactic 1 (Specify_Method ["Test", "solve_linear"]);
  92.392 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.393 +
  92.394 + fetchProposedTactic 1;
  92.395 + setNextTactic 1 (Apply_Method ["Test", "solve_linear"]);
  92.396 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.397 +
  92.398 + fetchProposedTactic 1;
  92.399 + setNextTactic 1 (Rewrite_Set_Inst (["(''bdv'',x)"], "isolate_bdv"));
  92.400 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.401 +
  92.402 + fetchProposedTactic 1;
  92.403 + setNextTactic 1 (Rewrite_Set "Test_simplify");
  92.404 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.405 +
  92.406 + fetchProposedTactic 1;
  92.407 + setNextTactic 1 (Check_Postcond ["LINEAR", "univariate", "equation", "test"]);
  92.408 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.409 +
  92.410 + fetchProposedTactic 1;
  92.411 + setNextTactic 1 (Check_elementwise "Assumptions");
  92.412 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.413 +
  92.414 + val xml = fetchProposedTactic 1;
  92.415 + setNextTactic 1 (Check_Postcond 
  92.416 +		      ["sqroot-test", "univariate", "equation", "test"]);
  92.417 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.418 +
  92.419 + val ((pt,_),_) = States.get_calc 1;
  92.420 + val str = pr_ctree pr_short pt;
  92.421 + writeln str;
  92.422 + val ip = States.get_pos 1 1;
  92.423 + val (Form f, tac, asms) = ME_Misc.pt_extract (pt, ip);
  92.424 +     (*exception just above means: 'ModSpec' has been returned: error anyway*)
  92.425 + if UnparseC.term f = "[x = 1]" then () else 
  92.426 + error "FE-interface.sml: diff.behav. in miniscript with mini-subpb";
  92.427 +(**)-------------------------------------------------------------------------------------------*)
  92.428 + DEconstrCalcTree 1;
  92.429 +
  92.430 +"--------- mini-subpbl AUTOCALCULATE Steps 1 -------------";
  92.431 +"--------- mini-subpbl AUTOCALCULATE Steps 1 -------------";
  92.432 +"--------- mini-subpbl AUTOCALCULATE Steps 1 -------------";
  92.433 +(*WN120210?not ME:\label{SOLVE:AUTO:one} UC 30.3.3.2 p.176*)
  92.434 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  92.435 +   ("Test", ["sqroot-test", "univariate", "equation", "test"],
  92.436 +    ["Test", "squ-equ-test-subpbl1"]))];
  92.437 + Iterator 1;
  92.438 + moveActiveRoot 1;
  92.439 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.440 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.441 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.442 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.443 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.444 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.445 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.446 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.447 + (*here the solve-phase starts*)
  92.448 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.449 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.450 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.451 + (*------------------------------------*)
  92.452 +(* (*default_print_depth 13*) States.get_calc 1;
  92.453 +   *)
  92.454 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.455 + (*calc-head of subproblem*)
  92.456 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.457 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.458 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.459 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.460 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.461 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.462 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.463 + (*solve-phase of the subproblem*)
  92.464 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.465 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.466 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.467 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.468 + (*finish subproblem*)
  92.469 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.470 + (*finish problem*)
  92.471 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1); 
  92.472 +
  92.473 + (*this checks the test for correctness..*)
  92.474 + val ((pt,_),_) = States.get_calc 1;
  92.475 + val p = States.get_pos 1 1;
  92.476 + val (Form f, tac, asms) = ME_Misc.pt_extract (pt, p);
  92.477 + if UnparseC.term f = "[x = 1]" andalso p = ([], Res) then () else 
  92.478 + error "FE-interface.sml: diff.behav. in miniscript with mini-subpb";
  92.479 + DEconstrCalcTree 1;
  92.480 +
  92.481 +
  92.482 +"--------- solve_linear as rootpbl AUTO CompleteCalc ----";
  92.483 +"--------- solve_linear as rootpbl AUTO CompleteCalc ----";
  92.484 +"--------- solve_linear as rootpbl AUTO CompleteCalc ----";
  92.485 +(*WN120210?not ME:\label{SPECIFY:START:auto} UC 30.2.4.2 p.174*)
  92.486 + CalcTree @{context}
  92.487 +     [(["equality (1+- 1*2+x=(0::real))", "solveFor x", "solutions L"],
  92.488 +       ("Test", 
  92.489 +	["LINEAR", "univariate", "equation", "test"],
  92.490 +	["Test", "solve_linear"]))];
  92.491 + Iterator 1;
  92.492 + moveActiveRoot 1;
  92.493 +getFormulaeFromTo 1 ([],Pbl) ([],Pbl) 999 false;
  92.494 +
  92.495 + autoCalculate 1 CompleteCalc; 
  92.496 + val (unc, del, gen) = (([],Pbl), ([],Pbl), ([],Res));
  92.497 + getFormulaeFromTo 1 unc gen 1 (*only level 1*) false;
  92.498 +
  92.499 + val ((pt,_),_) = States.get_calc 1;
  92.500 + val p = States.get_pos 1 1;
  92.501 + val (Form f, tac, asms) = ME_Misc.pt_extract (pt, p);
  92.502 + if UnparseC.term f = "[x = 1]" andalso p = ([], Res) then () else 
  92.503 + error "FE-interface.sml: diff.behav. in solve_linear/rt AUTOCALCULATE ";
  92.504 +DEconstrCalcTree 1;
  92.505 +
  92.506 +"--------- solve_linear as rootpbl AUTO CompleteHead/Eval ";
  92.507 +"--------- solve_linear as rootpbl AUTO CompleteHead/Eval ";
  92.508 +"--------- solve_linear as rootpbl AUTO CompleteHead/Eval ";
  92.509 +(* ERROR: error in kernel ?? *)
  92.510 + CalcTree @{context}
  92.511 +     [(["equality (1+- 1*2+x=(0::real))", "solveFor x", "solutions L"],
  92.512 +       ("Test", 
  92.513 +	["LINEAR", "univariate", "equation", "test"],
  92.514 +	["Test", "solve_linear"]))];
  92.515 + Iterator 1;
  92.516 + moveActiveRoot 1;
  92.517 +
  92.518 + autoCalculate 1 CompleteCalcHead;
  92.519 + refFormula 1 (States.get_pos 1 1);
  92.520 + val ((pt,p),_) = States.get_calc 1;
  92.521 +
  92.522 + autoCalculate 1 CompleteCalc; 
  92.523 + val ((pt,p),_) = States.get_calc 1;
  92.524 + if p=([], Res) then () else 
  92.525 + error "FE-interface.sml: diff.behav. in solve_linear AUTOC Head/Eval ";
  92.526 +DEconstrCalcTree 1;
  92.527 +
  92.528 +"--------- mini-subpbl AUTOCALCULATE CompleteCalc -------";
  92.529 +"--------- mini-subpbl AUTOCALCULATE CompleteCalc -------";
  92.530 +"--------- mini-subpbl AUTOCALCULATE CompleteCalc -------";
  92.531 +(*WN120210?not ME:\label{SPECIFY:START:auto} UC 30.2.4.2 p.174*)
  92.532 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  92.533 +   ("Test", ["sqroot-test", "univariate", "equation", "test"],
  92.534 +    ["Test", "squ-equ-test-subpbl1"]))];
  92.535 + Iterator 1;
  92.536 + moveActiveRoot 1;
  92.537 + autoCalculate 1 CompleteCalc;
  92.538 + val ((pt,p),_) = States.get_calc 1; Test_Tool.show_pt pt;
  92.539 +(*
  92.540 +getTactic 1 ([1],Frm);
  92.541 +getTactic 1 ([1],Res);
  92.542 +initContext 1 Ptool.Thy_ ([1],Res);
  92.543 +*)
  92.544 + (*... returns calcChangedEvent with*)
  92.545 + val (unc, del, gen) = (([],Pbl), ([],Pbl), ([],Res));
  92.546 + getFormulaeFromTo 1 unc gen 0 (*only result*) false;
  92.547 + getFormulaeFromTo 1 unc gen 1 (*only level 1*) false;
  92.548 + getFormulaeFromTo 1 unc gen 99999 (*all levels*) false;
  92.549 +
  92.550 + val ((pt,_),_) = States.get_calc 1;
  92.551 + val p = States.get_pos 1 1;
  92.552 + val (Form f, tac, asms) = ME_Misc.pt_extract (pt, p);
  92.553 + if UnparseC.term f = "[x = 1]" andalso p = ([], Res) then () else 
  92.554 + error "FE-interface.sml: diff.behav. in mini-subpbl AUTOCALCULATE 6";
  92.555 + DEconstrCalcTree 1;
  92.556 +
  92.557 +"--------- mini-subpbl AUTO CompleteCalcHead ------------";
  92.558 +"--------- mini-subpbl AUTO CompleteCalcHead ------------";
  92.559 +"--------- mini-subpbl AUTO CompleteCalcHead ------------";
  92.560 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  92.561 +   ("Test", ["sqroot-test", "univariate", "equation", "test"],
  92.562 +    ["Test", "squ-equ-test-subpbl1"]))];
  92.563 + Iterator 1;
  92.564 + moveActiveRoot 1;
  92.565 + autoCalculate 1 CompleteCalcHead;
  92.566 +
  92.567 +val ((Nd (PblObj {fmz = (fm, ("Test", pblID, metID)), loc = (SOME (env, ctxt1), NONE),
  92.568 +      meth, probl,
  92.569 +      spec = ("Test", ["sqroot-test", "univariate", "equation", "test"], 
  92.570 +        ["Test", "squ-equ-test-subpbl1"]), 
  92.571 +      branch = TransitiveB, ostate = Incomplete (*!?\<forall>*), ...}, []), 
  92.572 +   ([], Met)), []) = States.get_calc 1;
  92.573 +if length meth = 3 andalso length probl = 3 (*just some items tested*) then () 
  92.574 +else error "--- mini-subpbl AUTO CompleteCalcHead ---";
  92.575 +DEconstrCalcTree 1;
  92.576 +
  92.577 +"--------- solve_linear as rootpbl AUTO CompleteModel ---";
  92.578 +"--------- solve_linear as rootpbl AUTO CompleteModel ---";
  92.579 +"--------- solve_linear as rootpbl AUTO CompleteModel ---";
  92.580 +States.reset ();
  92.581 + CalcTree @{context}
  92.582 +     [(["equality (1+- 1*2+x=(0::real))", "solveFor x", "solutions L"],
  92.583 +       ("Test", 
  92.584 +	["LINEAR", "univariate", "equation", "test"],
  92.585 +	["Test", "solve_linear"]))];
  92.586 + Iterator 1;
  92.587 + moveActiveRoot 1;
  92.588 + autoCalculate 1 CompleteModel;  
  92.589 + refFormula 1 (States.get_pos 1 1);
  92.590 +
  92.591 +setProblem 1 ["LINEAR", "univariate", "equation", "test"];
  92.592 +val pos = States.get_pos 1 1;
  92.593 +(*setContext 1 pos (Ptool.kestoreID2guh Ptool.Pbl_["LINEAR", "univariate", "equation", "test"]);*)
  92.594 + refFormula 1 (States.get_pos 1 1);
  92.595 +
  92.596 +setMethod 1 ["Test", "solve_linear"];
  92.597 +(*setContext 1 pos (Ptool.kestoreID2guh Ptool.Met_ ["Test", "solve_linear"]);*)
  92.598 + refFormula 1 (States.get_pos 1 1);
  92.599 + val ((pt,_),_) = States.get_calc 1;
  92.600 + if get_obj g_spec pt [] = (ThyC.id_empty, 
  92.601 +			    ["LINEAR", "univariate", "equation", "test"],
  92.602 +			    ["Test", "solve_linear"]) then ()
  92.603 + else error "FE-interface.sml: diff.behav. in setProblem, setMethod";
  92.604 +
  92.605 + autoCalculate 1 CompleteCalcHead;
  92.606 + refFormula 1 (States.get_pos 1 1); 
  92.607 + autoCalculate 1 CompleteCalc; 
  92.608 + moveActiveDown 1;
  92.609 + moveActiveDown 1;
  92.610 + moveActiveDown 1;
  92.611 + refFormula 1 (States.get_pos 1 1); 
  92.612 + val ((pt,_),_) = States.get_calc 1;
  92.613 + val p = States.get_pos 1 1;
  92.614 + val (Form f, tac, asms) = ME_Misc.pt_extract (pt, p);
  92.615 + if UnparseC.term f = "[x = 1]" andalso p = ([], Res) then () else 
  92.616 + error "FE-interface.sml: diff.behav. in mini-subpbl AUTOCALCULATE 6";
  92.617 + DEconstrCalcTree 1;
  92.618 +
  92.619 +"--------- setContext..Thy ------------------------------";
  92.620 +"--------- setContext..Thy ------------------------------";
  92.621 +"--------- setContext..Thy ------------------------------";
  92.622 +States.reset ();
  92.623 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  92.624 +  ("Test", ["sqroot-test", "univariate", "equation", "test"],
  92.625 +   ["Test", "squ-equ-test-subpbl1"]))];
  92.626 + Iterator 1; moveActiveRoot 1;
  92.627 + autoCalculate 1 CompleteCalcHead;
  92.628 + autoCalculate 1 (Steps 1);
  92.629 + val ((pt,p),_) = States.get_calc 1;  Test_Tool.show_pt pt; (*2 lines, OK*)
  92.630 + (*
  92.631 + setNextTactic 1 (Rewrite_Set "Test_simplify"); (*--> "thy_isac_Test-rls-Test_simplify"*)
  92.632 + autoCalculate 1 (Steps 1);
  92.633 + val ((pt,p),_) = States.get_calc 1;  Test_Tool.show_pt pt;
  92.634 + *)
  92.635 +"----- \<up> ^^ and vvvvv do the same -----";
  92.636 +(*setContext 1 p "thy_isac_Test-rls-Test_simplify";*)
  92.637 + val ((pt,p),_) = States.get_calc 1;  Test_Tool.show_pt pt; (*2 lines, OK*)
  92.638 +
  92.639 + autoCalculate 1 (Steps 1);
  92.640 +(*setContext 1 p "thy_isac_Test-rls-Test_simplify";*)
  92.641 + val (((pt,_),_), p) = (States.get_calc 1, States.get_pos 1 1);
  92.642 + val (Form f, tac, asms) = ME_Misc.pt_extract (pt, p);
  92.643 + if p = ([1], Res) andalso UnparseC.term (get_obj g_res pt (fst p)) = "x + 1 + - 1 * 2 = 0"
  92.644 + then () else error "--- setContext..Thy --- autoCalculate 1 (Steps 1) #1";
  92.645 +
  92.646 + autoCalculate 1 CompleteCalc;
  92.647 + val (((pt,_),_), p) = (States.get_calc 1, States.get_pos 1 1);
  92.648 + val (Form f, tac, asms) = ME_Misc.pt_extract (pt, p);
  92.649 +
  92.650 + if UnparseC.term f = "[x = 1]" andalso p = ([], Res) then () 
  92.651 +  else error "--- setContext..Thy --- autoCalculate CompleteCalc";
  92.652 + DEconstrCalcTree 1;
  92.653 +
  92.654 +"--------- mini-subpbl AUTOCALC CompleteToSubpbl --------";
  92.655 +"--------- mini-subpbl AUTOCALC CompleteToSubpbl --------";
  92.656 +"--------- mini-subpbl AUTOCALC CompleteToSubpbl --------";
  92.657 +States.reset ();
  92.658 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  92.659 +   ("Test", ["sqroot-test", "univariate", "equation", "test"],
  92.660 +    ["Test", "squ-equ-test-subpbl1"]))];
  92.661 + Iterator 1; moveActiveRoot 1;
  92.662 + autoCalculate 1 CompleteToSubpbl;
  92.663 + refFormula 1 (States.get_pos 1 1); (*<ISA> - 1 + x = 0 </ISA>*);
  92.664 + val ((pt,_),_) = States.get_calc 1;
  92.665 + val str = pr_ctree pr_short pt;
  92.666 + writeln str;
  92.667 + if str = ".    ----- pblobj -----\n1.   x + 1 = 2\n2.   x + 1 + - 1 * 2 = 0\n"
  92.668 + then () else 
  92.669 + error "FE-interface.sml: diff.behav. in mini-subpbl CompleteToSubpbl- 1";
  92.670 +
  92.671 + autoCalculate 1 (Steps 1); (*proceeds only, if NOT 1 step before subplb*)
  92.672 + autoCalculate 1 CompleteToSubpbl;
  92.673 + val ((pt,_),_) = States.get_calc 1;
  92.674 + val str = pr_ctree pr_short pt;
  92.675 + writeln str;
  92.676 + autoCalculate 1 CompleteCalc; (*das geht ohnehin !*);
  92.677 + val ((pt,_),_) = States.get_calc 1;
  92.678 + val p = States.get_pos 1 1;
  92.679 +
  92.680 + val (Form f, tac, asms) = ME_Misc.pt_extract (pt, p);
  92.681 + if UnparseC.term f = "[x = 1]" andalso p = ([], Res) then () else 
  92.682 + error "FE-interface.sml: diff.behav. in mini-subpbl CompleteToSubpbl 1";
  92.683 + DEconstrCalcTree 1;
  92.684 +
  92.685 +"--------- rat-eq + subpbl: no_met, NO solution dropped -";
  92.686 +"--------- rat-eq + subpbl: no_met, NO solution dropped -";
  92.687 +"--------- rat-eq + subpbl: no_met, NO solution dropped -";
  92.688 +"--------- rat-eq + subpbl: no_met, NO solution dropped - see LI: '--- simpl.rat.term, '..";
  92.689 +(*--- THIS IS RE-USED WITH fun me IN  test/../MathEngine/solve.sml -------------------
  92.690 +      ---- rat-eq + subpbl: set_found in check_tac1 ----*)
  92.691 + CalcTree @{context}
  92.692 + [(["equality ((5*x)/(x - 2) - x/(x+2)=(4::real))", "solveFor x", "solutions L"],
  92.693 +   ((** )"RatEq"( **)"PolyEq"(*required for "make_ratpoly_in"*), 
  92.694 +    ["univariate", "equation"], ["no_met"]))];
  92.695 + Iterator 1;
  92.696 + moveActiveRoot 1; 
  92.697 + fetchProposedTactic 1;
  92.698 +
  92.699 + setNextTactic 1 (Model_Problem);
  92.700 + autoCalculate 1 (Steps 1); fetchProposedTactic 1;
  92.701 +
  92.702 + setNextTactic 1 (Specify_Theory "RatEq");
  92.703 + autoCalculate 1 (Steps 1); fetchProposedTactic 1;
  92.704 + setNextTactic 1 (Specify_Problem ["rational", "univariate", "equation"]);
  92.705 + autoCalculate 1 (Steps 1); fetchProposedTactic 1;
  92.706 + setNextTactic 1 (Specify_Method ["RatEq", "solve_rat_equation"]);
  92.707 + autoCalculate 1 (Steps 1); fetchProposedTactic 1;
  92.708 + setNextTactic 1 (Apply_Method ["RatEq", "solve_rat_equation"]);
  92.709 + autoCalculate 1 (Steps 1); fetchProposedTactic 1;
  92.710 + setNextTactic 1 (Rewrite_Set "RatEq_simplify");
  92.711 + autoCalculate 1 (Steps 1); fetchProposedTactic 1;
  92.712 + setNextTactic 1 (Rewrite_Set "norm_Rational");
  92.713 + autoCalculate 1 (Steps 1); fetchProposedTactic 1;
  92.714 + setNextTactic 1 (Rewrite_Set "RatEq_eliminate");
  92.715 + autoCalculate 1 (Steps 1); fetchProposedTactic 1;
  92.716 + (*               __________ for "12 * x + 4 * x \<up> 2 = 4 * (-4 + x \<up> 2)"*)
  92.717 + setNextTactic 1 (Subproblem ("PolyEq", ["normalise", "polynomial",
  92.718 +					    "univariate", "equation"]));
  92.719 + autoCalculate 1 (Steps 1); fetchProposedTactic 1;
  92.720 + setNextTactic 1 (Model_Problem );
  92.721 + autoCalculate 1 (Steps 1); fetchProposedTactic 1;
  92.722 + setNextTactic 1 (Specify_Theory "PolyEq");
  92.723 + autoCalculate 1 (Steps 1); fetchProposedTactic 1;
  92.724 + setNextTactic 1 (Specify_Problem ["normalise", "polynomial",
  92.725 +				   "univariate", "equation"]);
  92.726 + autoCalculate 1 (Steps 1); fetchProposedTactic 1;
  92.727 + setNextTactic 1 (Specify_Method ["PolyEq", "normalise_poly"]);
  92.728 + autoCalculate 1 (Steps 1); fetchProposedTactic 1;
  92.729 + setNextTactic 1 (Apply_Method ["PolyEq", "normalise_poly"]);
  92.730 + autoCalculate 1 (Steps 1); fetchProposedTactic 1;
  92.731 + setNextTactic 1 (Rewrite ("all_left", @{thm all_left}));
  92.732 + autoCalculate 1 (Steps 1); fetchProposedTactic 1;
  92.733 + setNextTactic 1 (Rewrite_Set_Inst (["(''bdv'',x)"], "make_ratpoly_in"));
  92.734 + autoCalculate 1 (Steps 1); fetchProposedTactic 1;
  92.735 + (*               __________ for "16 + 12 * x = 0"*)
  92.736 + setNextTactic 1 (Subproblem ("PolyEq",
  92.737 +			 ["degree_1", "polynomial", "univariate", "equation"]));
  92.738 + autoCalculate 1 (Steps 1); fetchProposedTactic 1;
  92.739 + setNextTactic 1 (Model_Problem );
  92.740 + autoCalculate 1 (Steps 1); fetchProposedTactic 1;
  92.741 + setNextTactic 1 (Specify_Theory "PolyEq");
  92.742 + (*------------- some trials in the problem-hierarchy ---------------*)
  92.743 + setNextTactic 1 (Specify_Problem ["LINEAR", "univariate", "equation"]);
  92.744 + autoCalculate 1 (Steps 1); fetchProposedTactic 1; (*<ERROR> helpless </ERROR> !!!*)
  92.745 + setNextTactic 1 (Refine_Problem ["univariate", "equation"]);
  92.746 + (*------------------------------------------------------------------*)
  92.747 + autoCalculate 1 (Steps 1); fetchProposedTactic 1;
  92.748 + setNextTactic 1 (Specify_Method ["PolyEq", "solve_d1_polyeq_equation"]);
  92.749 + autoCalculate 1 (Steps 1); fetchProposedTactic 1;
  92.750 + setNextTactic 1 (Apply_Method ["PolyEq", "solve_d1_polyeq_equation"]);
  92.751 + autoCalculate 1 (Steps 1); fetchProposedTactic 1;
  92.752 + setNextTactic 1 (Rewrite_Set_Inst (["(''bdv'',x)"], "d1_polyeq_simplify"));
  92.753 + autoCalculate 1 (Steps 1); fetchProposedTactic 1;
  92.754 + setNextTactic 1 (Rewrite_Set "polyeq_simplify");
  92.755 + autoCalculate 1 (Steps 1); fetchProposedTactic 1;
  92.756 + setNextTactic 1 Or_to_List;
  92.757 + autoCalculate 1 (Steps 1); fetchProposedTactic 1;
  92.758 + setNextTactic 1 (Check_elementwise "Assumptions"); 
  92.759 + autoCalculate 1 (Steps 1); fetchProposedTactic 1;
  92.760 + setNextTactic 1 (Check_Postcond ["degree_1", "polynomial",
  92.761 +				  "univariate", "equation"]);
  92.762 + autoCalculate 1 (Steps 1); fetchProposedTactic 1;
  92.763 + setNextTactic 1 (Check_Postcond ["normalise", "polynomial",
  92.764 +				  "univariate", "equation"]);
  92.765 + autoCalculate 1 (Steps 1); fetchProposedTactic 1;
  92.766 + setNextTactic 1 (Check_Postcond ["rational", "univariate", "equation"]);
  92.767 + val (ptp,_) = States.get_calc 1;
  92.768 + val (Form t,_,_) = ME_Misc.pt_extract ptp;
  92.769 + if States.get_pos 1 1 = ([], Res) andalso UnparseC.term t = "[x = -4 / 3]" then ()
  92.770 + else writeln "FE-inteface.sml: diff.behav. in rat-eq + subpbl: no_met, NO ..";
  92.771 + DEconstrCalcTree 1;
  92.772 +
  92.773 +
  92.774 +\<close> ML \<open>
  92.775 +"--------- tryMatchProblem, tryRefineProblem ------------";
  92.776 +"--------- tryMatchProblem, tryRefineProblem ------------";
  92.777 +"--------- tryMatchProblem, tryRefineProblem ------------";
  92.778 +(*{\bf\UC{Having \isac{} Refine the Problem
  92.779 + * Automatically}\label{SPECIFY:refine-auto}\\} test match and refine with
  92.780 + * x \<up>2 + 4*x + 5 = 2
  92.781 +see isac.bridge.TestSpecify#testMatchRefine*)
  92.782 +States.reset ();
  92.783 + CalcTree @{context}
  92.784 + [(["equality (x \<up> 2 + 4*x + 5 = (2::real))", "solveFor x", "solutions L"],
  92.785 +   ("Isac_Knowledge", 
  92.786 +    ["univariate", "equation"],
  92.787 +    ["no_met"]))];
  92.788 + Iterator 1;
  92.789 + moveActiveRoot 1; 
  92.790 +
  92.791 + fetchProposedTactic 1;
  92.792 + setNextTactic 1 (Model_Problem );
  92.793 + (*..this tactic should be done 'tacitly', too !*)
  92.794 +
  92.795 +(*
  92.796 +autoCalculate 1 CompleteCalcHead; 
  92.797 +checkContext 1 ([],Pbl) "pbl_equ_univ";
  92.798 +checkContext 1 ([],Pbl) (Ptool.kestoreID2guh Ptool.Pbl_ ["univariate", "equation"]);
  92.799 +*)
  92.800 +
  92.801 + autoCalculate 1 (Steps 1); 
  92.802 +
  92.803 + fetchProposedTactic 1;
  92.804 + setNextTactic 1 (Add_Given "equality (x \<up> 2 + 4 * x + 5 = (2::real))");
  92.805 + autoCalculate 1 (Steps 1); 
  92.806 +
  92.807 + "--------- we go into the ProblemBrowser (_NO_ pblID selected) -";
  92.808 +(*initContext 1 Ptool.Pbl_ ([],Pbl);*)
  92.809 +(* this would break if a calculation would be inserted before: CALCID...
  92.810 +   and pattern matching is not available in *.java.
  92.811 +if cut_xml xml = "(CONTEXTPBL)\n. (CALCID)\n. . 1\n. (/CALCID)\n. (CONTEXTDATA)\n. . (GUH)\n. . . pbl_equ_univ\n. . (/GUH)\n. . (STATUS)\n. . . correct\n. . (/STATUS)\n. . (HEAD)\n. . . (MATHML)\n. . . . (ISA)\n. . . . . solve (x ^ 2 + 4 * x + 5 = 2, x)\n. . . . (/ISA)\n. . . (/MATHML)\n. . (/HEAD)\n. . (MODEL)\n. . . (GIVEN)\n. . . . (ITEM status=correct)\n. . . . . (MATHML)\n. . . . . . (ISA)\n. . . . . . . equality (x ^ 2 + 4 * x + 5 = 2)\n. . . . . . (/ISA)\n. . . . . (/MATHML)\n. . . . (/ITEM)\n. . . . (ITEM status=correct)\n. . . . . (MATHML)\n. . . . . . (ISA)\n. . . . . . . solveFor x\n. . . . . . (/ISA)\n. . . . . (/MATHML)\n. . . . (/ITEM)\n. . . (/GIVEN)\n. . . (WHERE)\n. . . . (ITEM status=correct)\n. . . . . (MATHML)\n. . . . . . (ISA)\n. . . . . . . TermC.matches (?a = ?b) (x  \<up> ^ 2 + 4 * x + 5 = 2)\n. . . . . . (/ISA)\n. . . . . (/MATHML)\n. . . . (/ITEM)\n. . . (/WHERE)\n. . . (FIND)\n. . . . (ITEM status=correct)\n. . . . . (MATHML)\n. . . . . . (ISA)\n. . . . . . . solutions L\n. . . . . . (/ISA)\n. . . . . (/MATHML)\n. . . . (/ITEM)\n. . . (/FI"
  92.812 +then () else error "--- tryMatchProblem, tryRefineProblem: initContext 1 Ptool.Pbl_ ([],Pbl); CHANGED";
  92.813 +*)
  92.814 +(*initContext 1 Ptool.Met_ ([],Pbl);*)
  92.815 +(*<SYSERROR><CALCID>1</CALCID><ERROR>error in kernel 33</ERROR></SYSERROR>*)
  92.816 +
  92.817 + "--------- this match will show some incomplete items: ---------";
  92.818 +
  92.819 +(*checkContext 1 ([],Pbl) (Ptool.kestoreID2guh Ptool.Pbl_ ["univariate", "equation"]);
  92.820 +checkContext 1 ([],Pbl) (Ptool.kestoreID2guh Ptool.Met_ ["LinEq", "solve_lineq_equation"]);*)
  92.821 +
  92.822 +
  92.823 + fetchProposedTactic 1;
  92.824 + setNextTactic 1 (Add_Given "solveFor x"); autoCalculate 1 (Steps 1);
  92.825 +
  92.826 + fetchProposedTactic 1;
  92.827 + setNextTactic 1 (Add_Find "solutions L"); autoCalculate 1 (Steps 1);
  92.828 +
  92.829 + "--------- this is a matching model (all items correct): -------";
  92.830 +(*checkContext 1  ([],Pbl) (Ptool.kestoreID2guh Ptool.Pbl_ ["univariate", "equation"]);*)
  92.831 + "--------- this is a NOT matching model (some 'false': ---------";
  92.832 +(*checkContext 1  ([],Pbl)(Ptool.kestoreID2guh Ptool.Pbl_ ["LINEAR", "univariate", "equation"]);*)
  92.833 +
  92.834 + "--------- find out a matching problem: ------------------------";
  92.835 + "--------- find out a matching problem (FAILING: no new pbl) ---";
  92.836 + refineProblem 1 ([],Pbl)(Ptool.pblID2guh @{context} ["LINEAR", "univariate", "equation"]);
  92.837 +
  92.838 + "--------- find out a matching problem (SUCCESSFUL) ------------";
  92.839 + refineProblem 1 ([],Pbl) (Ptool.pblID2guh @{context} ["univariate", "equation"]);
  92.840 +
  92.841 + "--------- tryMatch, tryRefine did not change the calculation -";
  92.842 + "--------- this is done by <TRANSFER> on the pbl-browser: ------";
  92.843 + setNextTactic 1 (Specify_Problem ["normalise", "polynomial",
  92.844 +				 "univariate", "equation"]);
  92.845 + autoCalculate 1 (Steps 1);
  92.846 +(*WN050904 fetchProposedTactic again --> Specify_Problem ["normalise",...
  92.847 +  and Specify_Theory skipped in comparison to below --- \<up> -inserted      *)
  92.848 +(*------------vvv-inserted-----------------------------------------------*)
  92.849 + fetchProposedTactic 1;
  92.850 +(*/-----ERROR INTRODUCED BY CHILD OF 33913fe24685 --------------------------------------------\* )
  92.851 + setNextTactic 1 (Specify_Problem ["normalise", "polynomial",
  92.852 +				 "univariate", "equation"]);
  92.853 + autoCalculate 1 (Steps 1);
  92.854 +
  92.855 +(*and Specify_Theory skipped by fetchProposedTactic ?!?*)
  92.856 +
  92.857 + fetchProposedTactic 1;
  92.858 + setNextTactic 1 (Specify_Method ["PolyEq", "normalise_poly"]);
  92.859 + autoCalculate 1 (Steps 1);
  92.860 +
  92.861 + fetchProposedTactic 1;
  92.862 + setNextTactic 1 (Apply_Method ["PolyEq", "normalise_poly"]);
  92.863 +
  92.864 + autoCalculate 1 CompleteCalc;
  92.865 +
  92.866 + val ((pt,_),_) = States.get_calc 1;
  92.867 + Test_Tool.show_pt pt;
  92.868 + val p = States.get_pos 1 1;
  92.869 + val (Form f, tac, asms) = ME_Misc.pt_extract (pt, p);
  92.870 + if UnparseC.term f = "[x = - 1, x = -3]" andalso p = ([], Res) then () else 
  92.871 + error "FE-interface.sml: diff.behav. in tryMatchProblem, tryRefine";
  92.872 +
  92.873 +(*------------ \<up> -inserted-----------------------------------------------*)
  92.874 +(*WN050904 the fetchProposedTactic's below may not have worked like that
  92.875 +  before, too, because there was no check*)
  92.876 + fetchProposedTactic 1;
  92.877 + setNextTactic 1 (Specify_Theory "PolyEq");
  92.878 + autoCalculate 1 (Steps 1);
  92.879 +
  92.880 + fetchProposedTactic 1;
  92.881 + setNextTactic 1 (Specify_Method ["PolyEq", "normalise_poly"]);
  92.882 + autoCalculate 1 (Steps 1);
  92.883 +
  92.884 + fetchProposedTactic 1;
  92.885 + "--------- now the calc-header is ready for enter 'solving' ----";
  92.886 + autoCalculate 1 CompleteCalc;
  92.887 +
  92.888 + val ((pt,_),_) = States.get_calc 1;
  92.889 + rootthy pt;
  92.890 + Test_Tool.show_pt pt;
  92.891 + val p = States.get_pos 1 1;
  92.892 + val (Form f, tac, asms) = ME_Misc.pt_extract (pt, p);
  92.893 + if UnparseC.term f = "[x = - 1, x = -3]" andalso p = ([], Res) then () else 
  92.894 + error "FE-interface.sml: diff.behav. in tryMatchProblem, tryRefine";
  92.895 + DEconstrCalcTree 1;
  92.896 +( *\-----ERROR INTRODUCED BY CHILD OF 33913fe24685 --------------------------------------------/*)
  92.897 +
  92.898 +"--------- modifyCalcHead, resetCalcHead, modelProblem --";
  92.899 +"--------- modifyCalcHead, resetCalcHead, modelProblem --";
  92.900 +"--------- modifyCalcHead, resetCalcHead, modelProblem --";
  92.901 +States.reset ();
  92.902 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
  92.903 +   ("Test", ["sqroot-test", "univariate", "equation", "test"],
  92.904 +    ["Test", "squ-equ-test-subpbl1"]))];
  92.905 + Iterator 1;
  92.906 + moveActiveRoot 1; 
  92.907 +
  92.908 + modifyCalcHead 1 (([],Pbl),(*the position from refFormula*)
  92.909 +		  "solve (x+1=2, x)",(*the headline*)
  92.910 +		  [P_Spec.Given ["equality (x+1=(2::real))", "solveFor x"],
  92.911 +		   P_Spec.Find ["solutions L"](*,P_Spec.Relate []*)],
  92.912 +		  Pbl, 
  92.913 +		  ("Test", 
  92.914 +		   ["sqroot-test", "univariate", "equation", "test"],
  92.915 +		   ["Test", "squ-equ-test-subpbl1"]));
  92.916 + 
  92.917 +val ((Nd (PblObj {fmz = (fm, tpm),
  92.918 +                  loc = (SOME scrst_ctxt, NONE),
  92.919 +                  ctxt,
  92.920 +                  meth,
  92.921 +                  spec = (thy,
  92.922 +                          ["sqroot-test", "univariate", "equation", "test"],
  92.923 +                          ["Test", "squ-equ-test-subpbl1"]),
  92.924 +                  probl,
  92.925 +                  branch = TransitiveB,
  92.926 +                  origin,
  92.927 +                  ostate = Incomplete,
  92.928 +                  result},
  92.929 +               []),
  92.930 +         ([], Pbl)),
  92.931 +      []) = States.get_calc 1;
  92.932 +(*WN110622: is the same as in 2002, but shouldn't be probl = [3 items?]*)
  92.933 +if length meth = 0 andalso length probl = 0 (*just some items tested*) then () 
  92.934 +else error "--- modifyCalcHead, resetCalcHead, modelProblem 1 --";
  92.935 +
  92.936 +resetCalcHead 1;
  92.937 +modelProblem 1;
  92.938 +
  92.939 +States.get_calc 1;
  92.940 +val ((Nd (PblObj {fmz = (fm, tpm),
  92.941 +                  loc = (SOME scrst_ctxt, NONE),
  92.942 +                  ctxt,
  92.943 +                  meth,
  92.944 +                  spec = ("empty_thy_id", ["empty_probl_id"], ["empty_meth_id"]),
  92.945 +                  probl,
  92.946 +                  branch = TransitiveB,
  92.947 +                  origin,
  92.948 +                  ostate = Incomplete,
  92.949 +                  result},
  92.950 +               []),
  92.951 +         ([], Pbl)),
  92.952 +      []) = States.get_calc 1;
  92.953 +if length meth = 3 andalso length probl = 3 (*just some items tested*) then () 
  92.954 +else error "--- modifyCalcHead, resetCalcHead, modelProblem 2 --";
  92.955 +
  92.956 +"--------- maximum-example, UC: Modeling an example -----";
  92.957 +"--------- maximum-example, UC: Modeling an example -----";
  92.958 +"--------- maximum-example, UC: Modeling an example -----";
  92.959 +(* {\bf\UC{Editing the Model}\label{SPECIFY:enter}\label{SPECIFY:check}\\}
  92.960 +see isac.bridge.TestModel#testEditItems
  92.961 +*)
  92.962 + val elems = ["fixedValues [r=Arbfix]", "maximum A", "valuesFor [a,b]",
  92.963 +	      "relations [A=a*b, (a/2) \<up> 2 + (b/2) \<up> 2 = r \<up> 2]",
  92.964 +	      "relations [A=a*b, (a/2) \<up> 2 + (b/2) \<up> 2 = r \<up> 2]",
  92.965 +        "relations [A=a*b, a/2=r*sin alpha, b/2=r*cos (alpha::real)]",
  92.966 +	      (* \<up>  these are the elements for the root-problem (in variants)*)
  92.967 +              (*vvv these are elements required for subproblems*)
  92.968 +	      "boundVariable a", "boundVariable b", "boundVariable alpha",
  92.969 +	      "interval {x::real. 0 <= x & x <= 2*r}",
  92.970 +	      "interval {x::real. 0 <= x & x <= 2*r}",
  92.971 +	      "interval {x::real. 0 <= x & x <= pi}",
  92.972 +	      "errorBound (eps=(0::real))"]
  92.973 + (*specifying is not interesting for this example*)
  92.974 + val spec = ("Diff_App", ["maximum_of", "function"], 
  92.975 +	     ["Diff_App", "max_by_calculus"]);
  92.976 + (*the empty model with descriptions for user-guidance by Model_Problem*)
  92.977 + val empty_model = [P_Spec.Given ["fixedValues []"],
  92.978 +		    P_Spec.Find ["maximum", "valuesFor"],
  92.979 +		    P_Spec.Relate ["relations []"]]; 
  92.980 + DEconstrCalcTree 1;
  92.981 +
  92.982 +"#################################################################";
  92.983 +States.reset ();
  92.984 + CalcTree @{context} [(elems, spec)];
  92.985 + Iterator 1;
  92.986 + moveActiveRoot 1; 
  92.987 + refFormula 1 (States.get_pos 1 1);
  92.988 + (*this gives a completely empty model*) 
  92.989 +
  92.990 + fetchProposedTactic 1;
  92.991 +(*fill the CalcHead with Descriptions...*)
  92.992 + setNextTactic 1 (Model_Problem );
  92.993 + autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
  92.994 +
  92.995 + (*user input is !!!!!EITHER!!!!! _some_ (at least one) items of the model 
  92.996 + !!!!!OR!!!!! _one_ part of the specification !!!!!!!!!!!!!*)
  92.997 + (*input of two items, 'fixedValues [r=Arbfix]' and 'maximum b'...*)
  92.998 + modifyCalcHead 1 (([],Pbl) (*position, from previous refFormula*),
  92.999 +		  "Problem (Diff_App.thy, [maximum_of, function])",
 92.1000 +		  (*the head-form \<up> is not used for input here*)
 92.1001 +		  [P_Spec.Given ["fixedValues [r=Arbfix]"(*new input*)],
 92.1002 +		   P_Spec.Find ["maximum b"(*new input*), "valuesFor"], 
 92.1003 +		   P_Spec.Relate ["relations"]],
 92.1004 +		  (*input (Arbfix will dissappear soon)*)
 92.1005 +		  Pbl (*belongsto*),
 92.1006 +		  References.empty (*no input to the specification*));
 92.1007 +
 92.1008 + (*the user does not know, what 'superfluous' for 'maximum b' may mean
 92.1009 +  and asks what to do next*)
 92.1010 + fetchProposedTactic 1;
 92.1011 + (*the student follows the advice*)
 92.1012 + setNextTactic 1 (Add_Find "maximum A"); (*FIXME.17.11.03: does not yet work*)
 92.1013 +  autoCalculate 1 (Steps 1); refFormula 1 (States.get_pos 1 1);
 92.1014 + 
 92.1015 + (*this input completes the model*)
 92.1016 + modifyCalcHead 1 (([],Pbl), "not used here",
 92.1017 +		  [P_Spec.Given ["fixedValues [r=Arbfix]"],
 92.1018 +		   P_Spec.Find ["maximum A", "valuesFor [a,b]"(*new input*)], 
 92.1019 +		   P_Spec.Relate ["relations [A=a*b, \
 92.1020 +			   \(a/2) \<up> 2 + (b/2) \<up> 2 = r \<up> 2]"]], Pbl, References.empty);
 92.1021 +
 92.1022 + (*specification is not interesting and should be skipped by the dialogguide;
 92.1023 +   !!!!!!!!!!!!!!!!!!!! input of ONE part at a time !!!!!!!!!!!!!!!!!!!!!!*)
 92.1024 + modifyCalcHead 1 (([],Pbl), "not used here",
 92.1025 +		  [P_Spec.Given ["fixedValues [r=Arbfix]"],
 92.1026 +		   P_Spec.Find ["maximum A", "valuesFor [a,b]"(*new input*)], 
 92.1027 +		   P_Spec.Relate ["relations [A=a*b, \
 92.1028 +			   \(a/2) \<up> 2 + (b/2) \<up> 2 = r \<up> 2]"]], Pbl, 
 92.1029 +		  ("Diff_App", Problem.id_empty, MethodC.id_empty));
 92.1030 + modifyCalcHead 1 (([],Pbl), "not used here",
 92.1031 +		  [P_Spec.Given ["fixedValues [r=Arbfix]"],
 92.1032 +		   P_Spec.Find ["maximum A", "valuesFor [a,b]"(*new input*)], 
 92.1033 +		   P_Spec.Relate ["relations [A=a*b, \
 92.1034 +			   \(a/2) \<up> 2 + (b/2) \<up> 2 = r \<up> 2]"]], Pbl, 
 92.1035 +		  ("Diff_App", ["maximum_of", "function"], 
 92.1036 +		   MethodC.id_empty));
 92.1037 + modifyCalcHead 1 (([],Pbl), "not used here",
 92.1038 +		  [P_Spec.Given ["fixedValues [r=Arbfix]"],
 92.1039 +		   P_Spec.Find ["maximum A", "valuesFor [a,b]"(*new input*)], 
 92.1040 +		   P_Spec.Relate ["relations [A=a*b, \
 92.1041 +			   \(a/2) \<up> 2 + (b/2) \<up> 2 = r \<up> 2]"]], Pbl, 
 92.1042 +		  ("Diff_App", ["maximum_of", "function"], 
 92.1043 +		   ["Diff_App", "max_by_calculus"]));
 92.1044 + (*this final calcHead now has STATUS 'complete' !*)
 92.1045 + DEconstrCalcTree 1;
 92.1046 +
 92.1047 +(*POSTPONE CORRECTION AT END OF TRANSITION TO Isabelle/PIDE/Isac (~ Cas_Cmd)
 92.1048 +"--------- solve_linear from pbl-hierarchy --------------";
 92.1049 +"--------- solve_linear from pbl-hierarchy --------------";
 92.1050 +"--------- solve_linear from pbl-hierarchy --------------";
 92.1051 +States.reset ();
 92.1052 + val (fmz, sp) = ([], ("", ["LINEAR", "univariate", "equation", "test"], []));
 92.1053 + CalcTree @{context} [(fmz, sp)];
 92.1054 + Iterator 1; moveActiveRoot 1;
 92.1055 + refFormula 1 (States.get_pos 1 1);
 92.1056 + modifyCalcHead 1 (([],Pbl),"solve (1+- 1*2+x=(0::real))",
 92.1057 +		  [P_Spec.Given ["equality (1+- 1*2+x=(0::real))", "solveFor x"],
 92.1058 +		   P_Spec.Find ["solutions L"]],
 92.1059 +		  Pbl, 
 92.1060 +		  ("Test", ["LINEAR", "univariate", "equation", "test"],
 92.1061 +		   ["Test", "solve_linear"]));
 92.1062 + autoCalculate 1 CompleteCalc;
 92.1063 + refFormula 1 (States.get_pos 1 1);
 92.1064 + val ((pt,_),_) = States.get_calc 1;
 92.1065 + val p = States.get_pos 1 1;
 92.1066 + val (Form f, tac, asms) = ME_Misc.pt_extract (pt, p);
 92.1067 + if UnparseC.term f = "[x = 1]" andalso p = ([], Res) andalso map UnparseC.term asms = [] then () 
 92.1068 + else error "FE-interface.sml: diff.behav. in from pbl -hierarchy 1";
 92.1069 + DEconstrCalcTree 1;
 92.1070 +
 92.1071 +"--------- solve_linear as in an algebra system (CAS)----";
 92.1072 +"--------- solve_linear as in an algebra system (CAS)----";
 92.1073 +"--------- solve_linear as in an algebra system (CAS)----";
 92.1074 +(*WN120210?not ME:\label{UC:cas-input} UC 30.1.2.5 p.168*)
 92.1075 +States.reset ();
 92.1076 + val (fmz, sp) = ([], ("", [], []));
 92.1077 + CalcTree @{context} [(fmz, sp)];
 92.1078 + Iterator 1; moveActiveRoot 1;
 92.1079 + modifyCalcHead 1 (([],Pbl),"solveTest (1+- 1*2+x=0,x)", [], Pbl, ("", [], []));
 92.1080 + autoCalculate 1 CompleteCalc;
 92.1081 + refFormula 1 (States.get_pos 1 1);
 92.1082 + val ((pt,_),_) = States.get_calc 1;
 92.1083 + val p = States.get_pos 1 1;
 92.1084 + val (Form f, tac, asms) = ME_Misc.pt_extract (pt, p);
 92.1085 + if UnparseC.term f = "[x = 1]" andalso p = ([], Res) andalso map UnparseC.term asms = [] then () 
 92.1086 + else error "FE-interface.sml: diff.behav. in from pbl -hierarchy 2";
 92.1087 +DEconstrCalcTree 1;
 92.1088 +*)
 92.1089 +
 92.1090 +"--------- interSteps: on 'miniscript with mini-subpbl' -";
 92.1091 +"--------- interSteps: on 'miniscript with mini-subpbl' -";
 92.1092 +"--------- interSteps: on 'miniscript with mini-subpbl' -";
 92.1093 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
 92.1094 +   ("Test", ["sqroot-test", "univariate", "equation", "test"],
 92.1095 +    ["Test", "squ-equ-test-subpbl1"]))];
 92.1096 + Iterator 1;
 92.1097 + moveActiveRoot 1;
 92.1098 + autoCalculate 1 CompleteCalc; 
 92.1099 + val ((pt,_),_) = States.get_calc 1;
 92.1100 + Test_Tool.show_pt pt;
 92.1101 +
 92.1102 + (*UC\label{UC:inter-steps} UC 30.3.5.5 p.178*)
 92.1103 + interSteps 1 ([2],Res);
 92.1104 + val ((pt,_),_) = States.get_calc 1; Test_Tool.show_pt pt (*new ([2,1],Frm)..([2,6],Res)*);
 92.1105 + val (unc, del, gen) = (([1],Res),([1],Res),([2,6],Res));
 92.1106 + getFormulaeFromTo 1 unc gen 1 false; 
 92.1107 +
 92.1108 + (*UC\label{UC:inter-steps} UC 30.3.5.5 p.178*)
 92.1109 + interSteps 1 ([3,2],Res);
 92.1110 + val ((pt,_),_) = States.get_calc 1; Test_Tool.show_pt pt (*new ([3,2,1],Frm)..([3,2,2],Res)*);
 92.1111 + val (unc, del, gen) = (([3,1],Res),([3,1],Res),([3,2,2],Res));
 92.1112 + getFormulaeFromTo 1 unc gen 1 false; 
 92.1113 +
 92.1114 + (*UC\label{UC:inter-steps} UC 30.3.5.5 p.178*)
 92.1115 + interSteps 1 ([3],Res)  (*no new steps in subproblems*);
 92.1116 + val (unc, del, gen) = (([3],Pbl),([3],Pbl),([3,2],Res));
 92.1117 + getFormulaeFromTo 1 unc gen 1 false; 
 92.1118 +
 92.1119 + (*UC\label{UC:inter-steps} UC 30.3.5.5 p.178*)
 92.1120 + interSteps 1 ([],Res)  (*no new steps in subproblems*);
 92.1121 + val (unc, del, gen) = (([],Pbl),([],Pbl),([4],Res));
 92.1122 + getFormulaeFromTo 1 unc gen 1 false; 
 92.1123 +DEconstrCalcTree 1;
 92.1124 +
 92.1125 +"--------- getTactic, fetchApplicableTactics ------------";
 92.1126 +"--------- getTactic, fetchApplicableTactics ------------";
 92.1127 +"--------- getTactic, fetchApplicableTactics ------------";
 92.1128 +(* compare test/../script.sml
 92.1129 +"----------- fun from_prog ---------------------------------------";
 92.1130 +*)
 92.1131 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
 92.1132 +   ("Test", ["sqroot-test", "univariate", "equation", "test"],
 92.1133 +    ["Test", "squ-equ-test-subpbl1"]))];
 92.1134 + Iterator 1; moveActiveRoot 1;
 92.1135 + autoCalculate 1 CompleteCalc;
 92.1136 + val ((pt,_),_) = States.get_calc 1;
 92.1137 + Test_Tool.show_pt pt;
 92.1138 +
 92.1139 + (*UC\label{SOLVE:HIDE:getTactic} \label{SOLVE:AUTO:tactic} UC 30.3.3.1 p.176
 92.1140 +WN120210 not impl. in FE*)
 92.1141 + getTactic 1 ([],Pbl);
 92.1142 + getTactic 1 ([1],Res);
 92.1143 + getTactic 1 ([3],Pbl);
 92.1144 + getTactic 1 ([3,1],Frm);
 92.1145 + getTactic 1 ([3],Res);
 92.1146 + getTactic 1 ([],Res);
 92.1147 +
 92.1148 +(*UC\label{SOLVE:MANUAL:TACTIC:listall} UC 30.3.2.2 p.175*)
 92.1149 + fetchApplicableTactics 1 99999 ([],Pbl);
 92.1150 + fetchApplicableTactics 1 99999 ([1],Res);
 92.1151 + fetchApplicableTactics 1 99999 ([3],Pbl);
 92.1152 + fetchApplicableTactics 1 99999 ([3,1],Res);
 92.1153 + fetchApplicableTactics 1 99999 ([3],Res);
 92.1154 + fetchApplicableTactics 1 99999 ([],Res);
 92.1155 +DEconstrCalcTree 1;
 92.1156 +
 92.1157 +(*SINCE eliminate ThmC.numerals_to_Free: loops ---------------------------------------------\\* )
 92.1158 +"--------- getAssumptions, getAccumulatedAsms -----------";
 92.1159 +"--------- getAssumptions, getAccumulatedAsms -----------";
 92.1160 +"--------- getAssumptions, getAccumulatedAsms -----------";
 92.1161 +States.reset ();
 92.1162 +CalcTree @{context}
 92.1163 +[(["equality (x/(x \<up> 2 - 6*x+9) - 1/(x \<up> 2 - 3*x) =1/x)",
 92.1164 +	   "solveFor x", "solutions L"], 
 92.1165 +  ("RatEq",["univariate", "equation"],["no_met"]))];
 92.1166 +Iterator 1; moveActiveRoot 1;
 92.1167 +autoCalculate 1 CompleteCalc; 
 92.1168 +val ((pt,_),_) = States.get_calc 1;
 92.1169 +val p = States.get_pos 1 1;
 92.1170 +val (Form f, tac, asms) = ME_Misc.pt_extract (pt, p);
 92.1171 +(*============ inhibit exn WN120316 compare 2002-- 2011 ===========================
 92.1172 +if map UnparseC.term asms = 
 92.1173 + ["True |\n~ lhs ((3 + - 1 * x + x \<up> 2) * x =\n" ^
 92.1174 +  "       1 * (9 * x + -6 * x \<up> 2 + x \<up> 3)) is_poly_in x", "-6 * x + 5 * x \<up>\<up> 2 = 0", 
 92.1175 +  "lhs (-6 * x + 5 * x \<up> 2 = 0) is_poly_in x",
 92.1176 +  "lhs (-6 * x + 5 * x \<up>\<up> 2 = 0) has_degree_in x = 2", 
 92.1177 +  "9 * x + -6 * x \<up> 2 + x \<up> 3 ~= 0"] 
 92.1178 +andalso UnparseC.term f = "[-6 * x + 5 * x \<up> 2 = 0]" andalso p = ([], Res) then ()
 92.1179 +else error "TODO compare 2002-- 2011"; (*...data during test --- x / (x  \<up>  2 - 6 * x + 9) - 1...*)
 92.1180 +============ inhibit exn WN120316 compare 2002-- 2011 ===========================*)
 92.1181 +
 92.1182 +if p = ([], Res) andalso UnparseC.term f = "[x = 6 / 5]"
 92.1183 +andalso map UnparseC.term asms = []
 92.1184 +then () else error "rlang.sml: diff.behav. in  Schalk I s.87 Bsp 55b [x = 6 / 5]";
 92.1185 +
 92.1186 +(*UC\label{SOLVE:HELP:assumptions} UC 30.3.5.1 p.178*)
 92.1187 +getAssumptions 1 ([3], Res);
 92.1188 +getAssumptions 1 ([5], Res);
 92.1189 +(*UC\label{SOLVE:HELP:assumptions-origin} UC 30.3.5.2 p.178
 92.1190 +  WN0502 still without positions*)
 92.1191 +getAccumulatedAsms 1 ([3], Res);
 92.1192 +getAccumulatedAsms 1 ([5], Res);
 92.1193 +DEconstrCalcTree 1;
 92.1194 +( *SINCE eliminate ThmC.numerals_to_Free: loops ---------------------------------------------//*)
 92.1195 +
 92.1196 +\<close> ML \<open>
 92.1197 +"--------- arbitrary combinations of steps --------------";
 92.1198 +"--------- arbitrary combinations of steps --------------";
 92.1199 +"--------- arbitrary combinations of steps --------------";
 92.1200 + CalcTree @{context}      (*start of calculation, return No.1*)
 92.1201 +     [(["equality (1+- 1*2+x=(0::real))", "solveFor x", "solutions L"],
 92.1202 +       ("Test", 
 92.1203 +	["LINEAR", "univariate", "equation", "test"],
 92.1204 +	["Test", "solve_linear"]))];
 92.1205 + Iterator 1; moveActiveRoot 1;
 92.1206 +
 92.1207 + fetchProposedTactic 1;
 92.1208 +             (*ERROR States.get_calc 1 not existent*)
 92.1209 + setNextTactic 1 (Model_Problem );
 92.1210 + autoCalculate 1 (Steps 1); 
 92.1211 + fetchProposedTactic 1;
 92.1212 + fetchProposedTactic 1;
 92.1213 +
 92.1214 + setNextTactic 1 (Add_Find "solutions L");
 92.1215 + setNextTactic 1 (Add_Find "solutions L");
 92.1216 +
 92.1217 + autoCalculate 1 (Steps 1); 
 92.1218 + autoCalculate 1 (Steps 1); 
 92.1219 +
 92.1220 + setNextTactic 1 (Specify_Theory "Test");
 92.1221 + fetchProposedTactic 1;
 92.1222 + autoCalculate 1 (Steps 1); 
 92.1223 +
 92.1224 + autoCalculate 1 (Steps 1); 
 92.1225 + autoCalculate 1 (Steps 1); 
 92.1226 + autoCalculate 1 (Steps 1); 
 92.1227 + autoCalculate 1 (Steps 1); 
 92.1228 +(*------------------------- end calc-head*)
 92.1229 +
 92.1230 + fetchProposedTactic 1;
 92.1231 + setNextTactic 1 (Rewrite_Set_Inst (["(''bdv'',x)"], "isolate_bdv"));
 92.1232 + autoCalculate 1 (Steps 1); 
 92.1233 +
 92.1234 + setNextTactic 1 (Rewrite_Set "Test_simplify");
 92.1235 + fetchProposedTactic 1;
 92.1236 + autoCalculate 1 (Steps 1); 
 92.1237 +
 92.1238 + autoCalculate 1 CompleteCalc; 
 92.1239 + val ((pt,_),_) = States.get_calc 1;
 92.1240 + val p = States.get_pos 1 1;
 92.1241 + val (Form f, tac, asms) = ME_Misc.pt_extract (pt, p);
 92.1242 + if UnparseC.term f = "[x = 1]" andalso p = ([], Res) then () else 
 92.1243 + error "FE-interface.sml: diff.behav. in combinations of steps";
 92.1244 +DEconstrCalcTree 1;
 92.1245 +
 92.1246 +"--------- appendF label{SOLVE:MANUAL:FORMULA:enter}right"; (*UC 30.3.2.4 p.175*)
 92.1247 +"--------- appendF label{SOLVE:MANUAL:FORMULA:enter}right";
 92.1248 +"--------- appendF label{SOLVE:MANUAL:FORMULA:enter}right";
 92.1249 +States.reset ();
 92.1250 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
 92.1251 +   ("Test", ["sqroot-test", "univariate", "equation", "test"],
 92.1252 +    ["Test", "squ-equ-test-subpbl1"]))];
 92.1253 + Iterator 1;
 92.1254 + moveActiveRoot 1;
 92.1255 + autoCalculate 1 CompleteCalcHead;
 92.1256 + autoCalculate 1 (Steps 1);
 92.1257 + autoCalculate 1 (Steps 1);
 92.1258 + appendFormula 1 "- 1 + x = 0" (*|> Future.join*);
 92.1259 + (*... returns calcChangedEvent with*)
 92.1260 + val (unc, del, gen) = (([1],Res), ([1],Res), ([2],Res));
 92.1261 + getFormulaeFromTo 1 unc gen 99999 (*all levels*) false;
 92.1262 +
 92.1263 + val ((pt,_),_) = States.get_calc 1;
 92.1264 + val p = States.get_pos 1 1;
 92.1265 + val (Form f, tac, asms) = ME_Misc.pt_extract (pt, p);
 92.1266 + if UnparseC.term f = "- 1 + x = 0" andalso p = ([2], Res) then () else 
 92.1267 + error "FE-interface.sml: diff.behav. in FORMULA:enter} right";
 92.1268 +DEconstrCalcTree 1;
 92.1269 +
 92.1270 +"--------- appendF label{SOLVE:MANUAL:FORMULA:enter}other"; (*UC 30.3.2.4 p.175*)
 92.1271 +"--------- appendF label{SOLVE:MANUAL:FORMULA:enter}other";
 92.1272 +"--------- appendF label{SOLVE:MANUAL:FORMULA:enter}other";
 92.1273 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
 92.1274 +   ("Test", ["sqroot-test", "univariate", "equation", "test"],
 92.1275 +    ["Test", "squ-equ-test-subpbl1"]))];
 92.1276 + Iterator 1;
 92.1277 + moveActiveRoot 1;
 92.1278 + autoCalculate 1 CompleteCalcHead;
 92.1279 + autoCalculate 1 (Steps 1);
 92.1280 + autoCalculate 1 (Steps 1);
 92.1281 + appendFormula 1 "x - 1 = 0" (*|> Future.join*);
 92.1282 + val (unc, del, gen) = (([1],Res), ([1],Res), ([2],Res));
 92.1283 + getFormulaeFromTo 1 unc gen 99999 (*all levels*) false;
 92.1284 + (*11 elements !!!*)
 92.1285 +
 92.1286 + val ((pt,_),_) = States.get_calc 1;
 92.1287 + val p = States.get_pos 1 1;
 92.1288 + val (Form f, tac, asms) = ME_Misc.pt_extract (pt, p);
 92.1289 + if UnparseC.term f = "x - 1 = 0" andalso p = ([2], Res) then () else 
 92.1290 + error "FE-interface.sml: diff.behav. in FORMULA:enter} other";
 92.1291 +DEconstrCalcTree 1;
 92.1292 +
 92.1293 +"--------- appendF label{SOLVE:MANUAL:FORMULA:enter}oth 2"; (*UC 30.3.2.4 p.175*)
 92.1294 +"--------- appendF label{SOLVE:MANUAL:FORMULA:enter}oth 2";
 92.1295 +"--------- appendF label{SOLVE:MANUAL:FORMULA:enter}oth 2";
 92.1296 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
 92.1297 +   ("Test", ["sqroot-test", "univariate", "equation", "test"],
 92.1298 +    ["Test", "squ-equ-test-subpbl1"]))];
 92.1299 + Iterator 1;
 92.1300 + moveActiveRoot 1;
 92.1301 + autoCalculate 1 CompleteCalcHead;
 92.1302 + autoCalculate 1 (Steps 1);
 92.1303 + autoCalculate 1 (Steps 1);
 92.1304 + appendFormula 1 "x = 1" (*|> Future.join*);
 92.1305 + (*... returns calcChangedEvent with*)
 92.1306 + val (unc, del, gen) = (([1],Res), ([1],Res), ([3,2],Res));
 92.1307 + getFormulaeFromTo 1 unc gen 99999 (*all levels*) false;
 92.1308 + (*6 elements !!!*)
 92.1309 +
 92.1310 + val ((pt,_),_) = States.get_calc 1;
 92.1311 + val p = States.get_pos 1 1;
 92.1312 + val (Form f, tac, asms) = ME_Misc.pt_extract (pt, p);
 92.1313 + if UnparseC.term f = "x = 1" andalso p = ([3,2], Res) then () else 
 92.1314 + error "FE-interface.sml: diff.behav. in FORMULA:enter} oth 2";
 92.1315 +DEconstrCalcTree 1;
 92.1316 +
 92.1317 +"--------- appendF label{SOLVE:MANUAL:FORMULA:enter}NOTok"; (*UC 30.3.2.4 p.175*)
 92.1318 +"--------- appendF label{SOLVE:MANUAL:FORMULA:enter}NOTok";
 92.1319 +"--------- appendF label{SOLVE:MANUAL:FORMULA:enter}NOTok";
 92.1320 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
 92.1321 +   ("Test", ["sqroot-test", "univariate", "equation", "test"],
 92.1322 +    ["Test", "squ-equ-test-subpbl1"]))];
 92.1323 + Iterator 1;
 92.1324 + moveActiveRoot 1;
 92.1325 + autoCalculate 1 CompleteCalcHead;
 92.1326 + autoCalculate 1 (Steps 1);
 92.1327 + autoCalculate 1 (Steps 1);
 92.1328 + appendFormula 1 "x - 4711 = 0" (*|> Future.join*);
 92.1329 + (*... returns <ERROR> no derivation found </ERROR>*)
 92.1330 +
 92.1331 + val ((pt,_),_) = States.get_calc 1;
 92.1332 + val p = States.get_pos 1 1;
 92.1333 + val (Form f, tac, asms) = ME_Misc.pt_extract (pt, p);
 92.1334 + if UnparseC.term f = "x + 1 + - 1 * 2 = 0" andalso p = ([1], Res) then () else 
 92.1335 + error "FE-interface.sml: diff.behav. in FORMULA:enter} NOTok";
 92.1336 +DEconstrCalcTree 1;
 92.1337 +
 92.1338 +"--------- replaceFormula {SOL:MAN:FOR:replace} right----"; (*UC 30.3.2.5 p.176*)
 92.1339 +"--------- replaceFormula {SOL:MAN:FOR:replace} right----";
 92.1340 +"--------- replaceFormula {SOL:MAN:FOR:replace} right----";
 92.1341 +(*\label{SOLVE:MANUAL:FORMULA:replace}*)
 92.1342 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
 92.1343 +   ("Test", ["sqroot-test", "univariate", "equation", "test"],
 92.1344 +    ["Test", "squ-equ-test-subpbl1"]))];
 92.1345 + Iterator 1;
 92.1346 + moveActiveRoot 1;
 92.1347 + autoCalculate 1 CompleteCalc;
 92.1348 + moveActiveFormula 1 ([2],Res);
 92.1349 + replaceFormula 1 "- 1 + x = 0" (*i.e. repeats input*);
 92.1350 + (*... returns <ERROR> formula not changed </ERROR>*)
 92.1351 +
 92.1352 + val ((pt,_),_) = States.get_calc 1;
 92.1353 + val p = States.get_pos 1 1;
 92.1354 + val (Form f, tac, asms) = ME_Misc.pt_extract (pt, p);
 92.1355 + if UnparseC.term f = "- 1 + x = 0" andalso p = ([2], Res) then () else 
 92.1356 + error "FE-interface.sml: diff.behav. in FORMULA:replace} right 1";
 92.1357 + if map fst3 (ME_Misc.get_interval ([2],Res) ([],Res) 9999 pt) = 
 92.1358 +    [([2], Res), ([3], Pbl), ([3, 1], Frm), ([3, 1], Res), ([3, 2], Res),
 92.1359 +     ([3], Res), ([4], Res), ([], Res)] then () (*nothing deleted!*) else
 92.1360 + error "FE-interface.sml: diff.behav. in FORMULA:replace} right 2";
 92.1361 +
 92.1362 +(*WN050211 replaceFormula didn't work on second ctree: thus now tested...*)
 92.1363 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
 92.1364 +   ("Test", ["sqroot-test", "univariate", "equation", "test"],
 92.1365 +    ["Test", "squ-equ-test-subpbl1"]))];
 92.1366 + Iterator 2; (*! ! ! 1 CalcTree @{context} inbetween States.reset (); *)
 92.1367 + moveActiveRoot 2;
 92.1368 + autoCalculate 2 CompleteCalc;
 92.1369 + moveActiveFormula 2 ([2],Res);
 92.1370 + replaceFormula 2 "- 1 + x = 0" (*i.e. repeats input*);
 92.1371 + (*... returns <ERROR> formula not changed </ERROR>*)
 92.1372 +
 92.1373 + val ((pt,_),_) = States.get_calc 2;
 92.1374 + val p = States.get_pos 2 1;
 92.1375 + val (Form f, tac, asms) = ME_Misc.pt_extract (pt, p);
 92.1376 + if UnparseC.term f = "- 1 + x = 0" andalso p = ([2], Res) then () else 
 92.1377 + error "FE-interface.sml: diff.behav. in FORMULA:replace} right 1";
 92.1378 + if map fst3 (ME_Misc.get_interval ([2],Res) ([],Res) 9999 pt) = 
 92.1379 +    [([2], Res), ([3], Pbl), ([3, 1], Frm), ([3, 1], Res), ([3, 2], Res),
 92.1380 +     ([3], Res), ([4], Res), ([], Res)] then () (*nothing deleted!*) else
 92.1381 + error "FE-interface.sml: diff.behav. in FORMULA:replace} right 2b";
 92.1382 +DEconstrCalcTree 1;
 92.1383 +
 92.1384 +"--------- replaceFormula {SOL:MAN:FOR:replace} other----"; (*UC 30.3.2.5 p.176*)
 92.1385 +"--------- replaceFormula {SOL:MAN:FOR:replace} other----";
 92.1386 +"--------- replaceFormula {SOL:MAN:FOR:replace} other----";
 92.1387 +(*\label{SOLVE:MANUAL:FORMULA:replace}*)
 92.1388 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
 92.1389 +   ("Test", ["sqroot-test", "univariate", "equation", "test"],
 92.1390 +    ["Test", "squ-equ-test-subpbl1"]))];
 92.1391 + Iterator 1;
 92.1392 + moveActiveRoot 1;
 92.1393 + autoCalculate 1 CompleteCalc;
 92.1394 + moveActiveFormula 1 ([2],Res); (*there is "- 1 + x = 0"*)
 92.1395 + replaceFormula 1 "x - 1 = 0"; (*<-------------------------------------*)
 92.1396 + (*... returns calcChangedEvent with*)
 92.1397 + val (unc, del, gen) = (([1],Res), ([4],Res), ([2],Res));
 92.1398 + getFormulaeFromTo 1 unc gen 99999 (*all levels*) false;
 92.1399 +
 92.1400 + val ((pt,_),_) = States.get_calc 1;
 92.1401 + Test_Tool.show_pt pt;
 92.1402 + val p = States.get_pos 1 1;
 92.1403 + val (Form f, tac, asms) = ME_Misc.pt_extract (pt, p);
 92.1404 + if UnparseC.term f = "x - 1 = 0" andalso p = ([2], Res) then () else 
 92.1405 + error "FE-interface.sml: diff.behav. in FORMULA:replace} other 1";
 92.1406 +(* for getting the list in whole length ...
 92.1407 +(*default_print_depth 99*) map fst3 (ME_Misc.get_interval ([1],Res) ([],Res) 9999 pt); (*default_print_depth 3*)
 92.1408 +   *)
 92.1409 + if map fst3 (ME_Misc.get_interval ([1],Res) ([],Res) 9999 pt) = 
 92.1410 +    [([1], Res), ([2, 1], Frm), ([2, 1], Res), ([2, 2], Res), ([2, 3], Res),
 92.1411 +      ([2, 4], Res), ([2, 5], Res), ([2, 6], Res), ([2, 7], Res),
 92.1412 +      ([2, 8], Res), ([2, 9], Res), ([2], Res)] then () else
 92.1413 + error "FE-interface.sml: diff.behav. in FORMULA:replace} other 2";
 92.1414 +DEconstrCalcTree 1;
 92.1415 +
 92.1416 +"--------- replaceFormula {SOL:MAN:FOR:replace} other 2--"; (*UC 30.3.2.5 p.176*)
 92.1417 +"--------- replaceFormula {SOL:MAN:FOR:replace} other 2--";
 92.1418 +"--------- replaceFormula {SOL:MAN:FOR:replace} other 2--";
 92.1419 +(*\label{SOLVE:MANUAL:FORMULA:replace}*)
 92.1420 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
 92.1421 +   ("Test", ["sqroot-test", "univariate", "equation", "test"],
 92.1422 +    ["Test", "squ-equ-test-subpbl1"]))];
 92.1423 + Iterator 1;
 92.1424 + moveActiveRoot 1;
 92.1425 + autoCalculate 1 CompleteCalc;
 92.1426 + moveActiveFormula 1 ([2],Res); (*there is "- 1 + x = 0"*)
 92.1427 + replaceFormula 1 "x = 1"; (*<-------------------------------------*)
 92.1428 + (*... returns calcChangedEvent with ...*)
 92.1429 + val (unc, del, gen) = (([1],Res), ([4],Res), ([3,2],Res));
 92.1430 + getFormulaeFromTo 1 unc gen 99999 (*all levels*) false;
 92.1431 + (*9 elements !!!*)
 92.1432 +
 92.1433 + val ((pt,_),_) = States.get_calc 1;
 92.1434 + Test_Tool.show_pt pt; (*error: ...ME_Misc.get_interval drops ([3,2],Res) ...*)
 92.1435 + val (t,_) = get_obj g_result pt [3,2]; UnparseC.term t;
 92.1436 +  if map fst3 (ME_Misc.get_interval ([1],Res) ([],Res) 9999 pt) = 
 92.1437 +    [([1], Res), ([2], Res), ([3], Pbl), ([3, 1], Frm), ([3, 1], Res),
 92.1438 +      ([3, 2, 1], Frm), ([3, 2, 1], Res), ([3, 2, 2], Res), 
 92.1439 +      ([3,2],Res)] then () else
 92.1440 + error "FE-interface.sml: diff.behav. in FORMULA:replace} oth2 1";
 92.1441 +
 92.1442 + val p = States.get_pos 1 1;
 92.1443 + val (Form f, tac, asms) = ME_Misc.pt_extract (pt, p);
 92.1444 + if UnparseC.term f = "x = 1" andalso p = ([3,2], Res) then () else 
 92.1445 + error "FE-interface.sml: diff.behav. in FORMULA:replace} oth2 2";
 92.1446 +DEconstrCalcTree 1;
 92.1447 +
 92.1448 +\<close> ML \<open>
 92.1449 +"--------- replaceFormula {SOL:MAN:FOR:replace} NOTok----"; (*UC 30.3.2.5 p.176*)
 92.1450 +"--------- replaceFormula {SOL:MAN:FOR:replace} NOTok----";
 92.1451 +"--------- replaceFormula {SOL:MAN:FOR:replace} NOTok----";
 92.1452 +(*\label{SOLVE:MANUAL:FORMULA:replace}*)
 92.1453 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
 92.1454 +   ("Test", ["sqroot-test", "univariate", "equation", "test"],
 92.1455 +    ["Test", "squ-equ-test-subpbl1"]))];
 92.1456 + Iterator 1;
 92.1457 + moveActiveRoot 1;
 92.1458 + autoCalculate 1 CompleteCalc;
 92.1459 + moveActiveFormula 1 ([2],Res); (*there is "- 1 + x = 0"*)
 92.1460 + replaceFormula 1 "x - 4711 = 0"; 
 92.1461 + (*... returns <ERROR> no derivation found </ERROR>*)
 92.1462 +
 92.1463 + val ((pt,_),_) = States.get_calc 1;
 92.1464 + Test_Tool.show_pt pt;
 92.1465 + val p = States.get_pos 1 1;
 92.1466 + val (Form f, tac, asms) = ME_Misc.pt_extract (pt, p);
 92.1467 + if UnparseC.term f = "- 1 + x = 0" andalso p = ([2], Res) then () else 
 92.1468 + error "FE-interface.sml: diff.behav. in FORMULA:replace} NOTok";
 92.1469 + DEconstrCalcTree 1;
 92.1470 +
 92.1471 +"--------- UC errpat chain-rule-diff-both, fillpat by input ------";
 92.1472 +"--------- UC errpat chain-rule-diff-both, fillpat by input ------";
 92.1473 +"--------- UC errpat chain-rule-diff-both, fillpat by input ------";
 92.1474 +CalcTree @{context}
 92.1475 +[(["functionTerm (x  \<up>  2 + sin (x  \<up>  4))", "differentiateFor x", "derivative f_f'"], 
 92.1476 +  ("Isac_Knowledge", ["derivative_of", "function"], ["diff", "differentiate_on_R"]))];
 92.1477 +Iterator 1;
 92.1478 +moveActiveRoot 1;
 92.1479 +autoCalculate 1 CompleteCalcHead;
 92.1480 +autoCalculate 1 (Steps 1);
 92.1481 +autoCalculate 1 (Steps 1);(*([1], Res), d_d x (x \<up> 2) + d_d x (sin (x \<up> 4))*)
 92.1482 +appendFormula 1 "d_d x (x  \<up>  2) + cos (4 * x  \<up>  3)" (*|> Future.join*); (*<<<<<<<=========================*)
 92.1483 +(* the check for errpat is maximally liberal (whole term modulo "nrls" from "type met"),
 92.1484 +  would recognize "cos (4 * x  \<up>  (4 - 1)) + 2 * x" as well.
 92.1485 +  results in <CALCMESSAGE> error pattern #chain-rule-diff-both# </CALCMESSAGE>
 92.1486 +  instead of <CALCMESSAGE> no derivation found </CALCMESSAGE> *)
 92.1487 +  val ((pt,pos), _) = States.get_calc 1;
 92.1488 +  val p = States.get_pos 1 1;
 92.1489 +  val (Form f, _, asms) = ME_Misc.pt_extract (pt, p);
 92.1490 +
 92.1491 +  if p = ([1], Res) andalso UnparseC.term f = "d_d x (x \<up> 2) + d_d x (sin (x \<up> 4))"
 92.1492 +  then case get_obj g_tac pt (fst p) of Rewrite_Inst (["(''bdv'', x)"],
 92.1493 +      ("diff_sum", thm)) => () | _ => error "embed fun fill_form changed 0"
 92.1494 +  | _ => error "embed fun fill_form changed 1"
 92.1495 +else error "embed fun fill_form changed 2";
 92.1496 +
 92.1497 +(*========== inhibit exn WN1130621 Isabelle2012-->13 !thehier! ====================
 92.1498 +findFillpatterns 1 "chain-rule-diff-both"; (*<<<<<<<=================================*)
 92.1499 +(*<CALCMESSAGE> fill patterns #fill-d_d-arg#d_d x (x \<up> 2) + d_d x (sin (x \<up> 4)) =
 92.1500 +  d_d x (x \<up> 2) + cos (x \<up> 4) * d_d x ?_dummy_1#fill-both-args#...#...#... *)
 92.1501 +  val ((pt,pos),_) = States.get_calc 1;
 92.1502 +  val p = States.get_pos 1 1;
 92.1503 +
 92.1504 +  val (Form f, _, asms) = ME_Misc.pt_extract (pt, p);
 92.1505 +  if p = ([1], Res) andalso UnparseC.term f = "d_d x (x \<up> 2) + d_d x (sin (x \<up> 4))" andalso
 92.1506 +    get_obj g_tac pt (fst p) = Rewrite_Inst (["(''bdv'', x)"], ("diff_sum", "Diff.diff_sum"(*?!?*)))
 92.1507 +  then ()
 92.1508 +  else error "embed fun fill_form changed 2";
 92.1509 +
 92.1510 +(* if we assume, that the fill-patterns are ordered such that the 1st has large gaps
 92.1511 +   and the last has no gaps, then the number of fill-patterns would suffice
 92.1512 +   for the DialogGuide to select appropriately. *)
 92.1513 +requestFillformula 1 ("chain-rule-diff-both", "fill-both-args");(*<<<<<<<============*)
 92.1514 +  (*<AUTOCALC> ([1], Res) ([2], Res) ([2], Res) </AUTOCALC>*)
 92.1515 +  val ((pt,pos),_) = States.get_calc 1;
 92.1516 +  val p = States.get_pos 1 1;
 92.1517 +  val (Form f, _, asms) = ME_Misc.pt_extract (pt, p);
 92.1518 +  if p = ([1], Res) andalso existpt [2] pt andalso
 92.1519 +    UnparseC.term f = "d_d x (x \<up> 2) + d_d x (sin (x \<up>\<up> 4))" andalso
 92.1520 +    get_obj g_tac pt (fst p) = Rewrite_Inst (["(''bdv'', x)"], ("diff_sum", "Diff.diff_sum"))
 92.1521 +  then () else error "embed fun fill_form changed 3";
 92.1522 +
 92.1523 +inputFillFormula 1 "d_d x (x \<up> 2) + cos (x \<up> 4) * d_d x (x \<up> 4)";(*<<<<<<<=====*)
 92.1524 +  val ((pt, _),_) = States.get_calc 1;
 92.1525 +  val p = States.get_pos 1 1;
 92.1526 +  val (Form f, _, asms) = ME_Misc.pt_extract (pt, p);
 92.1527 +  if p = ([2], Res) andalso
 92.1528 +    UnparseC.term f = "d_d x (x \<up> 2) + cos (x \<up> 4) * d_d x (x \<up> 4)" andalso
 92.1529 +    get_obj g_tac pt (fst p) = Rewrite_Inst (["(''bdv'', x)"], ("diff_sin_chain", ""))
 92.1530 +  then () else error "inputFillFormula changed 11";
 92.1531 +
 92.1532 +autoCalculate 1 CompleteCalc;
 92.1533 +
 92.1534 +"~~~~~ final check: the input formula is inserted as it would have been correct from beginning";
 92.1535 +val ((pt, _),_) = States.get_calc 1;
 92.1536 +val p = States.get_pos 1 1;
 92.1537 +val (Form f, _, asms) = ME_Misc.pt_extract (pt, p);
 92.1538 +if p = ([], Res) andalso UnparseC.term f = "2 * x + cos (x \<up> 4) * 4 * x \<up> 3"
 92.1539 +then () else error "inputFillFormula changed 12";
 92.1540 +Test_Tool.show_pt pt;
 92.1541 +(*[
 92.1542 +(([], Frm), Diff (x \<up> 2 + sin (x \<up> 4), x)),
 92.1543 +(([1], Frm), d_d x (x \<up> 2 + sin (x \<up> 4))),
 92.1544 +(([1], Res), d_d x (x \<up> 2) + d_d x (sin (x \<up> 4))),
 92.1545 +(([2], Res), d_d x (x \<up> 2) + cos (x \<up> 4) * d_d x (x \<up> 4)),       (*<<<<<<<=====*)
 92.1546 +(([3], Res), d_d x (x \<up> 2) + cos (x \<up> 4) * (4 * x \<up> (4 - 1))),
 92.1547 +(([4], Res), 2 * x \<up> (2 - 1) + cos (x \<up> 4) * (4 * x \<up> (4 - 1))),
 92.1548 +(([5], Res), 2 * x + cos (x \<up> 4) * 4 * x \<up> 3),
 92.1549 +(([], Res), 2 * x + cos (x \<up> 4) * 4 * x \<up> 3)] *)
 92.1550 +============ inhibit exn WN1130621 Isabelle2012-->13 !thehier! ==================*)
 92.1551 +DEconstrCalcTree 1;
 92.1552 +
 92.1553 +\<close> ML \<open>
 92.1554 +(*POSTPONE CORRECTION AT END OF TRANSITION TO Isabelle/PIDE/Isac (~ Cas_Cmd ?)
 92.1555 +"--------- UC errpat add-fraction, fillpat by input --------------";
 92.1556 +"--------- UC errpat add-fraction, fillpat by input --------------";
 92.1557 +"--------- UC errpat add-fraction, fillpat by input --------------";
 92.1558 +(*cp from BridgeLog Java <=> SML*)
 92.1559 +CalcTree @{context} [([], References.empty)];
 92.1560 +Iterator 1;
 92.1561 +moveActiveRoot 1;
 92.1562 +moveActiveFormula 1 ([],Pbl);
 92.1563 +replaceFormula 1 "Simplify (5 * x / (4 * y) + 3 * x / (4 * y))";
 92.1564 +autoCalculate 1 CompleteCalcHead;
 92.1565 +autoCalculate 1 (Steps 1);
 92.1566 +appendFormula 1 "8 * x / (8 * y)" (*|> Future.join*);
 92.1567 +(*<CALCMESSAGE> no derivation found </CALCMESSAGE> 
 92.1568 +--- but in BridgeLog Java <=> SML:
 92.1569 +<CALCMESSAGE> error pattern #addition-of-fractions# </CALCMESSAGE>*)
 92.1570 +DEconstrCalcTree 1;
 92.1571 +-----------------------------------------------------------------------------------------------*)
 92.1572 +
 92.1573 +\<close> ML \<open>
 92.1574 +"--------- UC errpat, fillpat step to Rewrite --------------------";
 92.1575 +"--------- UC errpat, fillpat step to Rewrite --------------------";
 92.1576 +"--------- UC errpat, fillpat step to Rewrite --------------------";
 92.1577 +(*TODO*)
 92.1578 +CalcTree @{context}
 92.1579 +[(["functionTerm ((x  \<up>  2)  \<up>  3 + sin (x  \<up>  4))",
 92.1580 +   "differentiateFor x", "derivative f_f'"], 
 92.1581 +  ("Isac_Knowledge", ["derivative_of", "function"],
 92.1582 +  ["diff", "differentiate_on_R"]))]; (*<<<======= EP is directly in script*)
 92.1583 +Iterator 1;
 92.1584 +moveActiveRoot 1;
 92.1585 +autoCalculate 1 CompleteCalc;
 92.1586 +val ((pt,p),_) = States.get_calc 1; Test_Tool.show_pt pt;
 92.1587 +DEconstrCalcTree 1;
 92.1588 +
 92.1589 +\<close> ML \<open>
 92.1590 +"--------- UC errpat, fillpat step to Rewrite_Set ----------------";
 92.1591 +"--------- UC errpat, fillpat step to Rewrite_Set ----------------";
 92.1592 +"--------- UC errpat, fillpat step to Rewrite_Set ----------------";
 92.1593 +CalcTree @{context}
 92.1594 +[(["functionTerm ((x  \<up>  2)  \<up>  3 + sin (x  \<up>  4))",
 92.1595 +   "differentiateFor x", "derivative f_f'"], 
 92.1596 +  ("Isac_Knowledge", ["derivative_of", "function"],
 92.1597 +  ["diff", "after_simplification"]))]; (*<<<======= EP is in a ruleset*)
 92.1598 +Iterator 1;
 92.1599 +moveActiveRoot 1;
 92.1600 +autoCalculate 1 CompleteCalcHead;
 92.1601 +autoCalculate 1 (Steps 1); fetchProposedTactic 1;
 92.1602 +autoCalculate 1 (Steps 1); fetchProposedTactic 1;
 92.1603 +(*
 92.1604 +<NEXTTAC>
 92.1605 +  <CALCID> 1 </CALCID>
 92.1606 +  <TACTICERRORPATTERNS>
 92.1607 +    <STRINGLIST>
 92.1608 +      <STRING> chain-rule-diff-both </STRING>
 92.1609 +      <STRING> cancel </STRING>
 92.1610 +    </STRINGLIST>
 92.1611 +    <REWRITESETINSTTACTIC name="Rewrite_Set_Inst">
 92.1612 +      <RULESET> norm_diff </RULESET>
 92.1613 +      <SUBSTITUTION>
 92.1614 +        <PAIR>
 92.1615 +          <VARIABLE>
 92.1616 +            <MATHML>
 92.1617 +              <ISA> bdv </ISA>
 92.1618 +            </MATHML>
 92.1619 +          </VARIABLE>
 92.1620 +          <VALUE>
 92.1621 +            <MATHML>
 92.1622 +              <ISA> x </ISA>
 92.1623 +            </MATHML>
 92.1624 +          </VALUE>
 92.1625 +        </PAIR>
 92.1626 +      </SUBSTITUTION>
 92.1627 +    </REWRITESETINSTTACTIC>
 92.1628 +  </TACTICERRORPATTERNS>
 92.1629 +</NEXTTAC>
 92.1630 +
 92.1631 +
 92.1632 +(*WN1208 postponed due to efforts required for stepToErrorPatterns (NEW rewrite_set_)*)
 92.1633 +stepToErrorPatterns 1; (*--> calcChanged, rule immediately calls... *)
 92.1634 +stepOnErrorPatterns 1; (*--> calcChanged, rule calls getTactic and displays it *)
 92.1635 +(* then --- UC errpat, fillpat by input ---*)
 92.1636 +*)
 92.1637 +autoCalculate 1 CompleteCalc;
 92.1638 +val ((pt,p),_) = States.get_calc 1; Test_Tool.show_pt pt;
 92.1639 +(*WN1208 postponed due to efforts required for stepToErrorPatterns (NEW rewrite_set_)*)
 92.1640 +DEconstrCalcTree 1;
 92.1641 +
 92.1642  \<close> ML \<open>
 92.1643  \<close> ML \<open>
 92.1644  \<close>
    93.1 --- a/test/Tools/isac/Test_Isac_Short.thy	Wed Oct 19 15:39:15 2022 +0200
    93.2 +++ b/test/Tools/isac/Test_Isac_Short.thy	Thu Oct 20 10:23:38 2022 +0200
    93.3 @@ -92,7 +92,7 @@
    93.4  ML \<open>
    93.5    open Kernel;
    93.6    open Math_Engine;
    93.7 -  open Test_Code;              CalcTreeTEST;
    93.8 +  open Test_Code;              Test_Code.init_calc @{context};
    93.9    open LItool;                 arguments_from_model;
   93.10    open Sub_Problem;
   93.11    open Fetch_Tacs;
    94.1 --- a/test/Tools/isac/Test_Some.thy	Wed Oct 19 15:39:15 2022 +0200
    94.2 +++ b/test/Tools/isac/Test_Some.thy	Thu Oct 20 10:23:38 2022 +0200
    94.3 @@ -6,7 +6,7 @@
    94.4  ML \<open>
    94.5    open Kernel;
    94.6    open Math_Engine;
    94.7 -  open Test_Code;              CalcTreeTEST;
    94.8 +  open Test_Code;              Test_Code.init_calc @{context};
    94.9    open LItool;                 arguments_from_model;
   94.10    open Sub_Problem;
   94.11    open Fetch_Tacs;
    95.1 --- a/test/Tools/isac/Test_Theory.thy	Wed Oct 19 15:39:15 2022 +0200
    95.2 +++ b/test/Tools/isac/Test_Theory.thy	Thu Oct 20 10:23:38 2022 +0200
    95.3 @@ -2,7 +2,7 @@
    95.4  theory Test_Theory imports "$ISABELLE_ISAC/Specify/Specify"
    95.5  begin                                                                            
    95.6  ML_file "$ISABELLE_ISAC/BaseDefinitions/libraryC.sml"
    95.7 -(* ATTENTION: tests with CalcTreeTest, CalcTree do NOT work here, because Thy_Info.get_theory
    95.8 +(* ATTENTION: tests with Test_Code.init_calc, CalcTree @{context} do NOT work here, because Thy_Info.get_theory
    95.9    requires session Isac, see $ISABELLE_ISAC_TEST/Tools/isac/ADDTESTS/session-get_theory *)
   95.10  
   95.11  section \<open>code for copy & paste ===============================================================\<close>