test/Tools/isac/Test_Some.thy
author wneuper <Walther.Neuper@jku.at>
Wed, 19 Oct 2022 10:43:04 +0200
changeset 60567 bb3140a02f3d
parent 60558 2350ba2640fd
child 60569 f5454fd2e013
permissions -rw-r--r--
eliminate term2str in src, Prog_Tac.*_adapt_to_type
walther@59603
     1
theory Test_Some
walther@60387
     2
  imports "Isac.Build_Isac" "$ISABELLE_ISAC_TEST/Tools/isac/ADDTESTS/accumulate-val/Lucas_Interpreter"
wneuper@59265
     3
begin 
walther@59814
     4
walther@59814
     5
ML \<open>open ML_System\<close>
wneuper@59472
     6
ML \<open>
wneuper@59265
     7
  open Kernel;
walther@59814
     8
  open Math_Engine;
walther@59814
     9
  open Test_Code;              CalcTreeTEST;
walther@60126
    10
  open LItool;                 arguments_from_model;
walther@59817
    11
  open Sub_Problem;
walther@59858
    12
  open Fetch_Tacs;
walther@59807
    13
  open Step
walther@59659
    14
  open Env;
walther@59814
    15
  open LI;                     scan_dn;
wneuper@59578
    16
  open Istate;
walther@59909
    17
  open Error_Pattern;
walther@59909
    18
  open Error_Pattern_Def;
walther@59977
    19
  open Specification;
walther@60126
    20
  open Ctree;                  append_problem;
walther@59696
    21
  open Pos;
walther@59618
    22
  open Program;
wneuper@59601
    23
  open Prog_Tac;
walther@59603
    24
  open Tactical;
walther@59603
    25
  open Prog_Expr;
walther@60126
    26
  open Auto_Prog;              rule2stac;
walther@59618
    27
  open Input_Descript;
walther@59971
    28
  open Specify;
walther@59976
    29
  open Specify;
walther@59814
    30
  open Step_Specify;
walther@59814
    31
  open Step_Solve;
walther@59814
    32
  open Step;
wneuper@59316
    33
  open Solve;                  (* NONE *)
walther@60126
    34
  open ContextC;               transfer_asms_from_to;
wneuper@59575
    35
  open Tactic;                 (* NONE *)
walther@60126
    36
  open I_Model;
walther@60126
    37
  open O_Model;
walther@60126
    38
  open P_Model;                (* NONE *)
walther@59874
    39
  open Rewrite;
walther@60126
    40
  open Eval;                   get_pair;
wneuper@59417
    41
  open TermC;                  atomt;
walther@59858
    42
  open Rule;
walther@59969
    43
  open Rule_Set;               Sequence;
walther@59919
    44
  open Eval_Def
walther@59858
    45
  open ThyC
walther@59865
    46
  open ThmC_Def
walther@59858
    47
  open ThmC
walther@59858
    48
  open Rewrite_Ord
walther@59865
    49
  open UnparseC
wenzelm@60223
    50
\<close>
Walther@60493
    51
(**)ML_file "BridgeJEdit/vscode-example.sml"(**)
neuper@48765
    52
wneuper@59472
    53
section \<open>code for copy & paste ===============================================================\<close>
wneuper@59472
    54
ML \<open>
wneuper@59535
    55
"~~~~~ fun xxx , args:"; val () = ();
walther@59655
    56
"~~~~~ and xxx , args:"; val () = ();
walther@60220
    57
"~~~~~ from fun xxx \<longrightarrow>fun yyy \<longrightarrow>fun zzz , return:"; val () = ();
walther@60262
    58
(*if*) (*then*); (*else*);   (*case*) (*of*);  (*return value*); (*in*) (*end*);
wneuper@59579
    59
"xx"
Walther@60567
    60
^ "xxx"   (*+*) (*+++*) (* keep for continuation*) (*isa*) (*isa2*) (**)
Walther@60567
    61
\<close> ML \<open> (*//----------- adhoc inserted n ----------------------------------------------------\\*)
Walther@60567
    62
 (*//----------------- adhoc inserted n ----------------------------------------------------\\*)
Walther@60567
    63
(*\\------------------ adhoc inserted n ----------------------------------------------------//*)
Walther@60567
    64
\<close> ML \<open> (*\\----------- adhoc inserted n ----------------------------------------------------//*)
Walther@60567
    65
Walther@60567
    66
\<close> ML \<open> (*//----------- step into XXXXX -----------------------------------------------------\\*)
Walther@60567
    67
(*//------------------ step into XXXXX -----------------------------------------------------\\*)
Walther@60567
    68
(*-------------------- stop step into XXXXX --------------------------------------------------*)
Walther@60567
    69
\<close> ML \<open> (*------------- stop step into XXXXX --------------------------------------------------*)
Walther@60567
    70
(*\\------------------ step into XXXXX -----------------------------------------------------//*)
Walther@60567
    71
\<close> ML \<open> (*\\----------- step into XXXXX -----------------------------------------------------//*)
Walther@60567
    72
Walther@60567
    73
(*/------------------- check entry to XXXXX -------------------------------------------------\*)
Walther@60567
    74
(*\------------------- check entry to XXXXX -------------------------------------------------/*)
Walther@60567
    75
(*/------------------- check within XXXXX ---------------------------------------------------\*)
Walther@60567
    76
(*\------------------- check within XXXXX ---------------------------------------------------/*)
Walther@60567
    77
(*/------------------- check result of XXXXX ------------------------------------------------\*)
Walther@60567
    78
(*\------------------- check result of XXXXX ------------------------------------------------/*)
Walther@60567
    79
(* final test ... ----------------------------------------------------------------------------*)
Walther@60567
    80
Walther@60567
    81
\<close> ML \<open> (*//----------- build new fun XXXXX -------------------------------------------------\\*)
Walther@60567
    82
(*//------------------ build new fun XXXXX -------------------------------------------------\\*)
Walther@60567
    83
(*\\------------------ build new fun XXXXX -------------------------------------------------//*)
Walther@60567
    84
\<close> ML \<open> (*\\----------- build new fun XXXXX -------------------------------------------------//*)
walther@59635
    85
\<close> ML \<open>
wneuper@59472
    86
\<close>
walther@59723
    87
ML \<open>
walther@59723
    88
\<close> ML \<open>
walther@59723
    89
\<close> ML \<open>
walther@59723
    90
\<close>
wneuper@59472
    91
text \<open>
neuper@52101
    92
  declare [[show_types]] 
neuper@55405
    93
  declare [[show_sorts]]            
neuper@52101
    94
  find_theorems "?a <= ?a"
neuper@52101
    95
  
wneuper@59230
    96
  print_theorems
neuper@52101
    97
  print_facts
neuper@52101
    98
  print_statement ""
neuper@52101
    99
  print_theory
wneuper@59230
   100
  ML_command \<open>Pretty.writeln prt\<close>
wneuper@59230
   101
  declare [[ML_print_depth = 999]]
wneuper@59252
   102
  declare [[ML_exception_trace]]
wneuper@59472
   103
\<close>
walther@59655
   104
walther@60260
   105
section \<open>===================================================================================\<close>
walther@60007
   106
ML \<open>
walther@60007
   107
\<close> ML \<open>
walther@60007
   108
\<close> ML \<open>
walther@60007
   109
\<close> ML \<open>
walther@60007
   110
\<close>
walther@60007
   111
Walther@60567
   112
section \<open>========= test/../Knowlegde/equsystem-1a.sml ======================================\<close>
Walther@60531
   113
ML \<open>
Walther@60531
   114
\<close> ML \<open>
Walther@60567
   115
"----------- me [EqSystem,normalise,2x2], refine Subproblem, step into istate---equsystem-1a.sml";
Walther@60567
   116
"----------- me [EqSystem,normalise,2x2], refine Subproblem, step into istate---equsystem-1a.sml";
Walther@60567
   117
"----------- me [EqSystem,normalise,2x2], refine Subproblem, step into istate---equsystem-1a.sml";
Walther@60567
   118
val fmz = ["equalities [0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2,\
Walther@60567
   119
	               \0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2]", 
Walther@60567
   120
	   "solveForVars [c, c_2]", "solution LL"];
Walther@60567
   121
val (dI',pI',mI') =
Walther@60567
   122
  ("Biegelinie",["normalise", "2x2", "LINEAR", "system"],
Walther@60567
   123
   ["EqSystem", "normalise", "2x2"]);
Walther@60567
   124
val p = e_pos'; val c = []; 
Walther@60567
   125
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
Walther@60567
   126
val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
Walther@60567
   127
val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
Walther@60567
   128
val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
Walther@60567
   129
val (p,_,f,nxt,_,pt) = me nxt p c pt;
Walther@60567
   130
case nxt of Specify_Method ["EqSystem", "normalise", "2x2"] => ()
Walther@60567
   131
	  | _ => error "eqsystem.sml [EqSystem,normalise,2x2] specify";
Walther@60567
   132
Walther@60567
   133
val (p,_,f,nxt,_,pt) = me nxt p c pt;
Walther@60567
   134
val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
Walther@60567
   135
Walther@60567
   136
(*+*)if f2str f =
Walther@60567
   137
  "[0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2,\n" ^
Walther@60567
   138
  " 0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2]" then () else error "";
Walther@60567
   139
(*+*)(Ctree.get_istate_LI pt p |> Istate.string_of) =
Walther@60567
   140
   "Pstate ([\"\n(e_s, [0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2,\n 0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2])\", \"\n(v_s, [c, c_2])\"], [], srls_normalise_2x2, NONE, \n??.empty, ORundef, false, true)";
Walther@60567
   141
Walther@60567
   142
val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
Walther@60567
   143
val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
Walther@60567
   144
val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
Walther@60567
   145
val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
Walther@60567
   146
Walther@60567
   147
(*+isa==isa2*)val "[c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2]" = f2str f;
Walther@60567
   148
  val "Pstate ([\"\n(e_s, [0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2,\n 0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2])\", \"\n(v_s, [c, c_2])\"], [R, L, R, L, R, R, R, L, R, R], srls_normalise_2x2, SOME e_s, \n[c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2], ORundef, true, false)" =
Walther@60567
   149
(*+isa==isa2*)(Ctree.get_istate_LI pt p |> Istate.string_of);
Walther@60567
   150
Walther@60567
   151
case nxt of
Walther@60567
   152
    (Subproblem ("Biegelinie", ["triangular", "2x2", "LINEAR",_])) => ()
Walther@60567
   153
  | _ => error "eqsystem.sml me [EqSystem,normalise,2x2] SubProblem";
Walther@60567
   154
Walther@60567
   155
val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
Walther@60567
   156
val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
Walther@60567
   157
val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
Walther@60567
   158
val (p,_,f,nxt,_,pt) = me nxt p c pt;val (p,_,f,nxt,_,pt) = me nxt p c pt;
Walther@60567
   159
case nxt of
Walther@60567
   160
    (Specify_Method ["EqSystem", "top_down_substitution", "2x2"]) => ()
Walther@60567
   161
  | _ => error "eqsystem.sml me [EqSys...2x2] top_down_substitution";
Walther@60567
   162
Walther@60567
   163
val (p,_,f,nxt,_,pt) = me nxt p c pt;
Walther@60567
   164
Walther@60567
   165
  val "Pstate ([\"\n(e_s, [0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2,\n 0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2])\", \"\n(v_s, [c, c_2])\", \"\n(e__s, [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2])\"], [R, R, D], srls_normalise_2x2, NONE, \nSubproblem\n (''Biegelinie'',\n  ??.\<^const>String.char.Char ''triangular'' ''2x2'' ''LINEAR'' ''system''), ORundef, true, true)" =
Walther@60567
   166
(*+isa==isa2*)(Ctree.get_istate_LI pt p |> Istate.string_of);
Walther@60567
   167
Walther@60567
   168
val (p''',_,f,nxt''',_,pt''') = me nxt p c pt;f2str f;
Walther@60567
   169
(*/------------------- step into me Apply_Method -------------------------------------------\*)
Walther@60567
   170
"~~~~~ fun me , args:"; val (tac, p, _, pt) = (nxt, p, c, pt);
Walther@60531
   171
\<close> ML \<open>
Walther@60567
   172
      val (pt'''', p'''') = (* keep for continuation*)
Walther@60567
   173
  	    (*Step.by_tactic is here for testing by me; do_next would suffice in me*)
Walther@60567
   174
Walther@60567
   175
 case Step.by_tactic tac (pt, p) of
Walther@60567
   176
  		    ("ok", (_, _, ptp)) => ptp;
Walther@60567
   177
"~~~~~ fun by_tactic , args:"; val (tac, (ptp as (pt, p))) = (tac, (pt, p));
Walther@60567
   178
Walther@60567
   179
(*+isa==isa2*)val ([5], Met) = p;
Walther@60567
   180
(*+isa==isa2*)val (SOME (is1, _), NONE) = get_obj g_loc pt (fst p);
Walther@60567
   181
  val "Pstate ([\"\n(e_s, [0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2,\n 0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2])\", \"\n(v_s, [c, c_2])\", \"\n(e__s, [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2])\"], [R, R, D], srls_normalise_2x2, NONE, \nSubproblem\n (''Biegelinie'',\n  ??.\<^const>String.char.Char ''triangular'' ''2x2'' ''LINEAR'' ''system''), ORundef, true, true)" =
Walther@60567
   182
(*+isa==isa2*)is1 |> Istate.string_of;
Walther@60567
   183
  val "Pstate ([\"\n(e_s, [0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2,\n 0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2])\", \"\n(v_s, [c, c_2])\", \"\n(e__s, [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2])\"], [R, R, D], srls_normalise_2x2, NONE, \nSubproblem\n (''Biegelinie'',\n  ??.\<^const>String.char.Char ''triangular'' ''2x2'' ''LINEAR'' ''system''), ORundef, true, true)" =
Walther@60567
   184
(*+isa==isa2*)(Ctree.get_istate_LI pt p |> Istate.string_of);
Walther@60567
   185
Walther@60567
   186
  (*case*)
Walther@60567
   187
      Step.check tac (pt, p) (*of*);
Walther@60567
   188
"~~~~~ fun check , args:"; val (tac, (ctree, pos)) = (tac, (pt, p) );
Walther@60567
   189
Walther@60567
   190
(*+*)val "Pstate ([\"\n(e_s, [0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2,\n 0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2])\", \"\n(v_s, [c, c_2])\", \"\n(e__s, [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2])\"], [R, R, D], srls_normalise_2x2, NONE, \nSubproblem\n (''Biegelinie'',\n  ??.\<^const>String.char.Char ''triangular'' ''2x2'' ''LINEAR'' ''system''), ORundef, true, true)" =
Walther@60567
   191
(*+isa==isa2*)(Ctree.get_istate_LI ctree pos |> Istate.string_of);
Walther@60567
   192
Walther@60567
   193
  (*if*) Tactic.for_specify tac (*else*);
Walther@60567
   194
val Applicable.Yes xxx =
Walther@60567
   195
Walther@60567
   196
Solve_Step.check tac (ctree, pos);
Walther@60567
   197
Walther@60567
   198
(*+*)val "Pstate ([\"\n(e_s, [0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2,\n 0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2])\", \"\n(v_s, [c, c_2])\", \"\n(e__s, [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2])\"], [R, R, D], srls_normalise_2x2, NONE, \nSubproblem\n (''Biegelinie'',\n  ??.\<^const>String.char.Char ''triangular'' ''2x2'' ''LINEAR'' ''system''), ORundef, true, true)" =
Walther@60567
   199
(*+isa==isa2*)(Ctree.get_istate_LI ctree pos |> Istate.string_of);
Walther@60567
   200
Walther@60567
   201
"~~~~~ from Step.check to Step.by_tactic return val:"; val (Applicable.Yes tac') = (Applicable.Yes xxx);
Walther@60567
   202
	    (*if*)  Tactic.for_specify' tac' (*else*);
Walther@60567
   203
Walther@60567
   204
Step_Solve.by_tactic tac' ptp;;
Walther@60567
   205
"~~~~~ fun by_tactic , args:"; val ((tac as Tactic.Apply_Method' _), (ptp as (pt, p)))
Walther@60567
   206
  = (tac', ptp);
Walther@60567
   207
Walther@60567
   208
(*+*)val "Pstate ([\"\n(e_s, [0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2,\n 0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2])\", \"\n(v_s, [c, c_2])\", \"\n(e__s, [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2])\"], [R, R, D], srls_normalise_2x2, NONE, \nSubproblem\n (''Biegelinie'',\n  ??.\<^const>String.char.Char ''triangular'' ''2x2'' ''LINEAR'' ''system''), ORundef, true, true)" =
Walther@60567
   209
(*+isa==isa2*)(Ctree.get_istate_LI pt p |> Istate.string_of);
Walther@60567
   210
Walther@60567
   211
        LI.by_tactic tac (get_istate_LI pt p, get_ctxt_LI pt p) ptp;
Walther@60567
   212
"~~~~~ fun by_tactic , args:"; val ((Tactic.Apply_Method' (mI, _, _, _)), (_, ctxt), (pt, pos as (p, _)))
Walther@60567
   213
  = (tac, (get_istate_LI pt p, get_ctxt_LI pt p), ptp);
Walther@60567
   214
         val (itms, oris, probl) = case get_obj I pt p of (*STILL asms=[]*)
Walther@60567
   215
           PblObj {meth = itms, origin = (oris, _, _), probl, ...} => (itms, oris, probl)
Walther@60567
   216
         val {ppc, ...} = MethodC.from_store ctxt mI;
Walther@60567
   217
         val itms = if itms <> [] then itms else I_Model.complete oris probl [] ppc
Walther@60567
   218
         val srls = LItool.get_simplifier (pt, pos)
Walther@60567
   219
         val (is, env, ctxt, prog) = case LItool.init_pstate srls ctxt itms mI of
Walther@60567
   220
           (is as Pstate {env, ...}, ctxt, scr) => (is, env, ctxt, scr)
Walther@60567
   221
Walther@60567
   222
(*+*)val "Pstate ([\"\n(e_s, [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2])\", \"\n(v_s, [c, c_2])\"], [], srls_normalise_2x2, NONE, \n??.empty, ORundef, false, true)" =
Walther@60567
   223
(*+isa==isa2*)is |> Istate.string_of
Walther@60567
   224
Walther@60567
   225
        val ini = LItool.implicit_take prog env;
Walther@60567
   226
        val pos = start_new_level pos
Walther@60567
   227
val NONE =
Walther@60567
   228
        (*case*) ini (*of*);
Walther@60567
   229
            val (tac''', ist''', ctxt''') = 
Walther@60567
   230
   case LI.find_next_step prog (pt, (lev_dn p, Res)) is ctxt of
Walther@60567
   231
                Next_Step (ist, ctxt, tac) => (tac, ist, ctxt)
Walther@60567
   232
Walther@60567
   233
  val "Pstate ([\"\n(e_s, [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2])\", \"\n(v_s, [c, c_2])\"], [R, L, R], srls_normalise_2x2, NONE, \nc_2 = 0, ORundef, true, false)" =
Walther@60567
   234
(*+isa==isa2*)ist''' |> Istate.string_of;
Walther@60567
   235
Walther@60567
   236
"~~~~~ fun find_next_step , args:"; val ((Rule.Prog prog), (ptp as (pt, pos as (p, _))), (Pstate ist), ctxt)
Walther@60567
   237
  = (prog ,(pt, (lev_dn p, Res)), is, ctxt);
Walther@60567
   238
val Accept_Tac
Walther@60567
   239
    (Take' ttt, iii, _) =
Walther@60567
   240
  (*case*) scan_to_tactic (prog, (ptp, ctxt)) (Pstate ist) (*of*);
Walther@60567
   241
Walther@60567
   242
(*+isa==isa2*)val "c_2 = 0" = (ttt |> UnparseC.term);
Walther@60567
   243
  val "Pstate ([\"\n(e_s, [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2])\", \"\n(v_s, [c, c_2])\"], [R, L, R], srls_normalise_2x2, NONE, \nc_2 = 0, ORundef, true, false)" =
Walther@60567
   244
(*+isa==isa2*)(Pstate iii |> Istate.string_of);
Walther@60567
   245
Walther@60567
   246
"~~~~~ fun scan_to_tactic , args:"; val ((prog, cc), (Pstate (ist as {path, ...})))
Walther@60567
   247
  = ((prog, (ptp, ctxt)), (Pstate ist));
Walther@60567
   248
  (*if*) path = [] (*then*);
Walther@60567
   249
Walther@60567
   250
           scan_dn cc (trans_scan_dn ist) (Program.body_of prog);
Walther@60567
   251
"~~~~~ fun scan_dn , args:"; val (cc, ist, (Const (\<^const_name>\<open>Let\<close>(*1*), _) $ e $ (Abs (i, T, b))))
Walther@60567
   252
  = (cc, (trans_scan_dn ist), (Program.body_of prog));
Walther@60567
   253
Walther@60567
   254
  (*case*) scan_dn cc (ist |> path_down [L, R]) e (*of*);
Walther@60567
   255
"~~~~~ fun scan_dn , args:"; val ((cc as (_, ctxt)), (ist as {eval, ...}), t)
Walther@60567
   256
  = (cc ,(ist |> path_down [L, R]), e);
Walther@60567
   257
Walther@60567
   258
  val "Pstate ([\"\n(e_s, [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2])\", \"\n(v_s, [c, c_2])\"], [R, L, R], srls_normalise_2x2, NONE, \n??.empty, ORundef, false, false)" =
Walther@60567
   259
(*+isa==isa2*)(Pstate ist |> Istate.string_of);
Walther@60567
   260
Walther@60567
   261
    (*if*) Tactical.contained_in t (*else*);
Walther@60567
   262
Walther@60567
   263
      (*case*)
Walther@60567
   264
    LItool.check_leaf "next  " ctxt eval (get_subst ist) t (*of*);
Walther@60567
   265
"~~~~~ fun check_leaf , args:"; val (call, ctxt, srls, (E, (a, v)), t)
Walther@60567
   266
  = ("next  ", ctxt, eval, (get_subst ist), t);
Walther@60567
   267
Walther@60567
   268
    (*case*)
Walther@60567
   269
  Prog_Tac.eval_leaf E a v t (*of*);
Walther@60567
   270
"~~~~~ fun eval_leaf , args:"; val (E, _, _, (t as (Const (\<^const_name>\<open>Prog_Tac.Take\<close>, _) $ _)))
Walther@60567
   271
  = (E, a, v, t);
Walther@60567
   272
Walther@60567
   273
val return =
Walther@60567
   274
     (Program.Tac (subst_atomic E t), NONE:term option);
Walther@60567
   275
"~~~~~ from fun eval_leaf \<longrightarrow>fun check_leaf , return:"; val (Program.Tac stac, a') = return;
Walther@60567
   276
	        val stac' = Rewrite.eval_prog_expr ctxt srls 
Walther@60567
   277
              (subst_atomic (Env.update_opt E (a, v)) stac)
Walther@60567
   278
Walther@60567
   279
val return =
Walther@60567
   280
      (Program.Tac stac', a');
Walther@60567
   281
"~~~~~ from fun check_leaf \<longrightarrow>fun scan_dn , return:"; val (Program.Tac prog_tac, form_arg) = return;
Walther@60567
   282
Walther@60567
   283
           check_tac cc ist (prog_tac, form_arg);
Walther@60567
   284
"~~~~~ fun check_tac , args:"; val (((pt, p), ctxt), ist, (prog_tac, form_arg))
Walther@60567
   285
  = (cc, ist, (prog_tac, form_arg));
Walther@60567
   286
    val m = LItool.tac_from_prog pt (Proof_Context.theory_of ctxt) prog_tac
Walther@60567
   287
val _ =
Walther@60567
   288
    (*case*) m (*of*); (*tac as string/input*)
Walther@60567
   289
Walther@60567
   290
      (*case*)
Walther@60567
   291
Solve_Step.check m (pt, p) (*of*);
Walther@60567
   292
"~~~~~ fun check , args:"; val ((Tactic.Take str), (pt, pos)) = (m, (pt, p));
Walther@60567
   293
Walther@60567
   294
val return =
Walther@60567
   295
    check_tac cc ist (prog_tac, form_arg)
Walther@60567
   296
Walther@60567
   297
  val "Pstate ([\"\n(e_s, [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2])\", \"\n(v_s, [c, c_2])\"], [R, L, R], srls_normalise_2x2, NONE, \n??.empty, ORundef, false, false)" =
Walther@60567
   298
(*+isa==isa2*)(Pstate ist |> Istate.string_of);
Walther@60567
   299
Walther@60567
   300
"~~~~~ from fun scan_dn \<longrightarrow>fun scan_to_tactic \<longrightarrow>fun find_next_step , return:";
Walther@60567
   301
       val (Accept_Tac (tac, ist, ctxt)) = return;
Walther@60567
   302
Walther@60567
   303
  val "Pstate ([\"\n(e_s, [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2])\", \"\n(v_s, [c, c_2])\"], [R, L, R], srls_normalise_2x2, NONE, \nc_2 = 0, ORundef, true, false)" =
Walther@60567
   304
(*+isa==isa2*)(Pstate ist |> Istate.string_of)
Walther@60567
   305
Walther@60567
   306
val return =
Walther@60567
   307
      Next_Step (Pstate ist, Tactic.insert_assumptions tac ctxt, tac);
Walther@60567
   308
"~~~~~ from fun find_next_step \<longrightarrow>fun by_tactic , return:"; val Next_Step (ist, ctxt, tac) = return;
Walther@60567
   309
            val (tac', ist', ctxt') = (tac, ist, ctxt)
Walther@60567
   310
val Tactic.Take' t =
Walther@60567
   311
            (*case*) tac' (*of*);
Walther@60567
   312
                  val show_add = Tactic.Apply_Method' (mI, SOME t, ist', ctxt');
Walther@60567
   313
Walther@60567
   314
(*+isa==isa2*)pos; (*from check_tac*)
Walther@60567
   315
(*+isa==isa2*)val (SOME (is1, _), NONE) = get_obj g_loc pt [5];
Walther@60567
   316
  val "Pstate ([\"\n(e_s, [0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2,\n 0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2])\", \"\n(v_s, [c, c_2])\", \"\n(e__s, [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2])\"], [R, R, D], srls_normalise_2x2, NONE, \nSubproblem\n (''Biegelinie'',\n  ??.\<^const>String.char.Char ''triangular'' ''2x2'' ''LINEAR'' ''system''), ORundef, true, true)" =
Walther@60567
   317
(*+isa==isa2*)is1 |> Istate.string_of;
Walther@60567
   318
  val "Pstate ([\"\n(e_s, [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2])\", \"\n(v_s, [c, c_2])\"], [R, L, R], srls_normalise_2x2, NONE, \nc_2 = 0, ORundef, true, false)" =
Walther@60567
   319
(*+isa==isa2*)(ist' |> Istate.string_of)
Walther@60567
   320
(*-------------------- stop step into me Apply_Method ----------------------------------------*)
Walther@60567
   321
(*+isa==isa2*)val "c_2 = 0" = f2str f;
Walther@60567
   322
  val "Pstate ([\"\n(e_s, [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2])\", \"\n(v_s, [c, c_2])\"], [R, L, R], srls_normalise_2x2, NONE, \nc_2 = 0, ORundef, true, false)" =
Walther@60567
   323
(*+isa==isa2*)(Ctree.get_istate_LI pt''' p''' |> Istate.string_of)
Walther@60567
   324
(*\\------------------- step into me Apply_Method ------------------------------------------//*)
Walther@60567
   325
Walther@60567
   326
\<close> ML \<open>
Walther@60567
   327
val (p'''',_,f,nxt'''',_,pt'''') = me nxt''' p''' c pt''';f2str f;
Walther@60567
   328
\<close> ML \<open>
Walther@60567
   329
(*+isa==isa2*)val ([5, 1], Frm) = p'''';
Walther@60567
   330
(*+isa==isa2*)val "L * c + c_2 = q_0 * L \<up> 2 / 2" = f2str f;
Walther@60567
   331
(*+isa<>isa2*)val (**)Check_Postcond ["triangular", "2x2", "LINEAR", "system"](** )
Walther@60567
   332
                       Substitute ["c_2 = 0"]( **) = nxt'''';
Walther@60567
   333
(*+isa==isa2*)val (SOME (is1, _), NONE) = get_obj g_loc pt'''' (fst p'''');
Walther@60567
   334
  val "Pstate ([\"\n(e_s, [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2])\", \"\n(v_s, [c, c_2])\", \"\n(e_1, c_2 = 0)\"], [R, R, D, R, D, L, R], srls_top_down_2x2, NONE, \nL * c + c_2 = q_0 * L \<up> 2 / 2, ORundef, true, true)" =
Walther@60567
   335
(*+isa==isa2*)is1 |> Istate.string_of;
Walther@60567
   336
  val "Pstate ([\"\n(e_s, [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2])\", \"\n(v_s, [c, c_2])\", \"\n(e_1, c_2 = 0)\"], [R, R, D, R, D, L, R], srls_top_down_2x2, NONE, \nL * c + c_2 = q_0 * L \<up> 2 / 2, ORundef, true, true)" =
Walther@60567
   337
(*+isa==isa2*)Ctree.get_istate_LI pt'''' p'''' |> Istate.string_of;
Walther@60567
   338
\<close> ML \<open> (*//----------- step into me Take ---------------------------------------------------\\*)
Walther@60567
   339
(*//------------------ step into me Take ---------------------------------------------------\\*)
Walther@60567
   340
"~~~~~ fun me , args:"; val (tac, p, _, pt) = (nxt''', p''', c, pt''');
Walther@60567
   341
\<close> ML \<open>
Walther@60567
   342
      val (pt, p) = (* keep for continuation*)
Walther@60567
   343
  	    (*Step.by_tactic is here for testing by me; do_next would suffice in me*)
Walther@60567
   344
Walther@60567
   345
 case Step.by_tactic tac (pt, p) of
Walther@60567
   346
  		    ("ok", (_, _, ptp)) => ptp;
Walther@60567
   347
\<close> ML \<open>
Walther@60567
   348
  val "Pstate ([\"\n(e_s, [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2])\", \"\n(v_s, [c, c_2])\", \"\n(e_1, c_2 = 0)\"], [R, R, D, R, D, L, R], srls_top_down_2x2, NONE, \nL * c + c_2 = q_0 * L \<up> 2 / 2, ORundef, true, true)" =
Walther@60567
   349
(*isa==isa2*)Ctree.get_istate_LI pt p |> Istate.string_of;
Walther@60567
   350
\<close> ML \<open>
Walther@60567
   351
    (*case*)
Walther@60567
   352
      Step.do_next p ((pt, Pos.e_pos'), []) (*of*);
Walther@60567
   353
\<close> ML \<open>
Walther@60567
   354
"~~~~~ fun do_next , args:"; val ((ip as (_, p_)), (ptp as (pt, p), tacis)) = (p, ((pt, Pos.e_pos'), []));
Walther@60567
   355
\<close> ML \<open>
Walther@60567
   356
  (*if*) Pos.on_calc_end ip (*else*);
Walther@60567
   357
\<close> ML \<open>
Walther@60567
   358
      val (_, probl_id, _) = Calc.references (pt, p);
Walther@60567
   359
\<close> ML \<open>
Walther@60567
   360
val _ =
Walther@60567
   361
      (*case*) tacis (*of*);
Walther@60567
   362
\<close> ML \<open>
Walther@60567
   363
        (*if*) probl_id = Problem.id_empty (*else*);
Walther@60567
   364
\<close> ML \<open>
Walther@60567
   365
           switch_specify_solve p_ (pt, ip);
Walther@60567
   366
\<close> ML \<open>
Walther@60567
   367
"~~~~~ fun switch_specify_solve , args:"; val (state_pos, (pt, input_pos)) = (p_, (pt, ip));
Walther@60567
   368
\<close> ML \<open>
Walther@60567
   369
      (*if*) Pos.on_specification ([], state_pos) (*else*);
Walther@60567
   370
\<close> ML \<open>
Walther@60567
   371
        LI.do_next (pt, input_pos);
Walther@60567
   372
\<close> ML \<open>
Walther@60567
   373
"~~~~~ and do_next , args:"; val (ptp as (pt, pos as (p, p_))) = (pt, input_pos);
Walther@60567
   374
\<close> ML \<open>
Walther@60567
   375
    (*if*) MethodC.id_empty = get_obj g_metID pt (par_pblobj pt p) (*else*);
Walther@60567
   376
\<close> ML \<open>
Walther@60567
   377
        val thy' = get_obj g_domID pt (par_pblobj pt p);
Walther@60567
   378
	      val ((ist, ctxt), sc) = LItool.resume_prog (p,p_) pt;
Walther@60567
   379
\<close> ML \<open>
Walther@60567
   380
  val "Pstate ([\"\n(e_s, [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2])\", \"\n(v_s, [c, c_2])\", \"\n(e_1, c_2 = 0)\"], [R, R, D, R, D, L, R], srls_top_down_2x2, NONE, \nL * c + c_2 = q_0 * L \<up> 2 / 2, ORundef, true, true)" =
Walther@60567
   381
(*+isa==isa2*)ist |> Istate.string_of;
Walther@60567
   382
\<close> ML \<open>
Walther@60567
   383
        (*case*) 
Walther@60567
   384
        LI.find_next_step sc (pt, pos) ist ctxt (*of*);
Walther@60567
   385
\<close> ML \<open>
Walther@60567
   386
"~~~~~ fun find_next_step , args:"; val ((Rule.Prog prog), (ptp as (pt, pos as (p, _))), (Pstate ist), ctxt)
Walther@60567
   387
  = (sc, (pt, pos), ist, ctxt);
Walther@60567
   388
\<close> ML \<open>
Walther@60567
   389
  (*case*) scan_to_tactic (prog, (ptp, ctxt)) (Pstate ist) (*of*);
Walther@60567
   390
\<close> ML \<open>
Walther@60567
   391
"~~~~~ fun scan_to_tactic , args:"; val ((prog, cc), (Pstate (ist as {path, ...})))
Walther@60567
   392
  = ((prog, (ptp, ctxt)), (Pstate ist));
Walther@60567
   393
\<close> ML \<open>
Walther@60567
   394
  (*if*) path = [] (*else*);
Walther@60567
   395
\<close> ML \<open>
Walther@60567
   396
           go_scan_up (prog, cc) (trans_scan_up ist);
Walther@60567
   397
\<close> ML \<open>
Walther@60567
   398
"~~~~~ fun go_scan_up , args:"; val ((pcc as (sc, _)), (ist as {path, act_arg, found_accept, ...}))
Walther@60567
   399
  = ((prog, cc), (trans_scan_up ist));
Walther@60567
   400
\<close> ML \<open>
Walther@60567
   401
  val "Pstate ([\"\n(e_s, [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2])\", \"\n(v_s, [c, c_2])\", \"\n(e_1, c_2 = 0)\"], [R, R, D, R, D, L, R], srls_top_down_2x2, NONE, \nL * c + c_2 = q_0 * L \<up> 2 / 2, ORundef, true, false)" =
Walther@60567
   402
(*+isa==isa2*)Pstate ist |> Istate.string_of;
Walther@60567
   403
(*+isa==isa2*)val "L * c + c_2 = q_0 * L \<up> 2 / 2" = act_arg |> UnparseC.term;
Walther@60567
   404
\<close> ML \<open>
Walther@60567
   405
    (*if*) path = [R] (*root of the program body*) (*else*);
Walther@60567
   406
\<close> ML \<open>
Walther@60567
   407
           scan_up pcc (ist |> path_up) (go_up path sc);
Walther@60567
   408
\<close> ML \<open>
Walther@60567
   409
"~~~~~ and scan_up , args:"; val ((pcc as (sc, cc)), ist, (Const (\<^const_name>\<open>Let\<close>(*1*), _) $ _))
Walther@60567
   410
  = (pcc, (ist |> path_up), (go_up path sc));
Walther@60567
   411
\<close> ML \<open>
Walther@60567
   412
        val (i, body) = check_Let_up ist sc
Walther@60567
   413
\<close> ML \<open>
Walther@60567
   414
  (*case*) scan_dn cc (ist |> path_up_down [R, D] |> upd_env i) body (*of*);
Walther@60567
   415
\<close> ML \<open>
Walther@60567
   416
"~~~~~ fun scan_dn , args:"; val (cc, ist, (Const (\<^const_name>\<open>Let\<close>(*1*), _) $ e $ (Abs (i, T, b))))
Walther@60567
   417
  = (cc, (ist |> path_up_down [R, D] |> upd_env i), body);
Walther@60567
   418
\<close> ML \<open>
Walther@60567
   419
val goback =
Walther@60567
   420
  (*case*) scan_dn cc (ist |> path_down [L, R]) e (*of*);
Walther@60567
   421
\<close> ML \<open>
Walther@60567
   422
"~~~~~ fun scan_dn , args:"; val (cc, ist, (Const (\<^const_name>\<open>Tactical.Chain\<close>(*1*), _) $ e1 $ e2 $ a))
Walther@60567
   423
  = (cc, (ist |> path_down [L, R]), e);
Walther@60567
   424
\<close> ML \<open>
Walther@60567
   425
  (*case*) scan_dn cc (ist |> path_down_form ([L, L, R], a)) e1 (*of*);
Walther@60567
   426
\<close> ML \<open>
Walther@60567
   427
"~~~~~ fun scan_dn , args:"; val ((cc as (_, ctxt)), (ist as {eval, ...}), t)
Walther@60567
   428
  = (cc, (ist |> path_down_form ([L, L, R], a)), e1);
Walther@60567
   429
\<close> ML \<open>
Walther@60567
   430
        (*if*) Tactical.contained_in t (*else*);
Walther@60567
   431
\<close> ML \<open>
Walther@60567
   432
      (*case*) 
Walther@60567
   433
    LItool.check_leaf "next  " ctxt eval (get_subst ist) t (*of*);
Walther@60567
   434
\<close> ML \<open>
Walther@60567
   435
"~~~~~ fun check_leaf , args:"; val (call, ctxt, srls, (E, (a, v)), t)
Walther@60567
   436
  = ("next  ", ctxt, eval, (get_subst ist), t);
Walther@60567
   437
\<close> ML \<open>
Walther@60567
   438
val (Program.Tac stac, a') =
Walther@60567
   439
    (*case*) Prog_Tac.eval_leaf E a v t (*of*);
Walther@60567
   440
\<close> ML \<open>
Walther@60567
   441
	        val stac' = Rewrite.eval_prog_expr ctxt srls 
Walther@60567
   442
              (subst_atomic (Env.update_opt E (a, v)) stac)
Walther@60567
   443
\<close> ML \<open>
Walther@60567
   444
(*+*)val "Substitute [c_2 = 0] (L * c + c_2 = q_0 * L \<up> 2 / 2)" = stac' |> UnparseC.term;
Walther@60567
   445
\<close> ML \<open>
Walther@60567
   446
val return =
Walther@60567
   447
        (Program.Tac stac', a')
Walther@60567
   448
\<close> ML \<open>
Walther@60567
   449
"~~~~~ from fun check_leaf \<longrightarrow>fun scan_dn , return:"; val ((Program.Tac prog_tac, form_arg))
Walther@60567
   450
   = (return);
Walther@60567
   451
\<close> ML \<open>
Walther@60567
   452
           check_tac cc ist (prog_tac, form_arg);
Walther@60567
   453
\<close> ML \<open>
Walther@60567
   454
"~~~~~ fun check_tac , args:"; val (((pt, p), ctxt), ist, (prog_tac, form_arg))
Walther@60567
   455
  = (cc, ist, (prog_tac, form_arg));
Walther@60567
   456
\<close> ML \<open>
Walther@60567
   457
    val m = LItool.tac_from_prog pt (Proof_Context.theory_of ctxt) prog_tac
Walther@60567
   458
\<close> ML \<open>
Walther@60567
   459
val _ =
Walther@60567
   460
    (*case*) m (*of*);
Walther@60567
   461
\<close> ML \<open>
Walther@60567
   462
      (*case*)
Walther@60567
   463
Solve_Step.check m (pt, p) (*of*);
Walther@60567
   464
\<close> ML \<open>
Walther@60567
   465
"~~~~~ fun check , args:"; val ((Tactic.Substitute sube), (cs as (pt, pos as (p, _))))
Walther@60567
   466
  = (m, (pt, p));
Walther@60567
   467
\<close> ML \<open>
Walther@60567
   468
        val pp = Ctree.par_pblobj pt p
Walther@60567
   469
        val ctxt = Ctree.get_loc pt pos |> snd
Walther@60567
   470
        val thy = Proof_Context.theory_of ctxt
Walther@60567
   471
        val f = Calc.current_formula cs;
Walther@60567
   472
		    val {rew_ord', erls, ...} = MethodC.from_store ctxt (Ctree.get_obj Ctree.g_metID pt pp)
Walther@60567
   473
		    val subte = Subst.input_to_terms ctxt sube (*?TODO: input requires parse _: _ -> _ option?*)
Walther@60567
   474
		    val ro = get_rew_ord ctxt rew_ord'
Walther@60567
   475
\<close> ML \<open>
Walther@60567
   476
		    (*if*) foldl and_ (true, map TermC.contains_Var subte) (*else*);
Walther@60567
   477
\<close> ML \<open>
Walther@60567
   478
(*+isa==isa2*)sube : TermC.as_string list
Walther@60567
   479
\<close> ML \<open>
Walther@60567
   480
(*+isa==isa2*)val "L * c + c_2 = q_0 * L \<up> 2 / 2" = f |> UnparseC.term
Walther@60567
   481
\<close> ML \<open>
Walther@60567
   482
(*+isa<>isa2*)val (** )["c_2 = (0::'a)"]( **)["c_2 = 0"](**) = subte |> map UnparseC.term
Walther@60567
   483
\<close> ML \<open>
Walther@60567
   484
val SOME ttt =
Walther@60567
   485
		      (*case*) Rewrite.rewrite_terms_ ctxt ro erls subte f (*of*);
Walther@60567
   486
\<close> ML \<open>
Walther@60567
   487
\<close> ML \<open> (*//----------- build new fun Subst.input_to_terms ----------------------------------\\*)
Walther@60567
   488
(*//------------------ build new fun XXXXX -------------------------------------------------\\*)
Walther@60567
   489
\<close> ML \<open>
Walther@60567
   490
fun input_to_terms ctxt strs = map (TermC.parse ctxt) strs;
Walther@60567
   491
\<close> ML \<open>
Walther@60567
   492
input_to_terms: Proof.context -> Subst.input -> Subst.as_eqs
Walther@60567
   493
\<close> ML \<open>
Walther@60567
   494
(* TermC.parse ctxt fails with "c_2 = 0" \<longrightarrow> \<open>c_2 = (0 :: 'a)\<close> and thus requires adapt_to_type*)
Walther@60567
   495
fun input_to_terms ctxt strs = strs
Walther@60567
   496
  |> map (TermC.parse ctxt)
Walther@60567
   497
  |> map (Model_Pattern.adapt_term_to_type ctxt)
Walther@60567
   498
\<close> ML \<open>
Walther@60567
   499
\<close> ML \<open>
Walther@60567
   500
\<close> ML \<open>
Walther@60567
   501
\<close> ML \<open>
Walther@60567
   502
(*\\------------------ build new fun XXXXX -------------------------------------------------//*)
Walther@60567
   503
\<close> ML \<open> (*\\----------- build new fun Subst.input_to_terms ----------------------------------//*)
Walther@60567
   504
\<close> ML \<open>
Walther@60567
   505
\<close> ML \<open>
Walther@60567
   506
\<close> ML \<open>
Walther@60567
   507
\<close> ML \<open>
Walther@60567
   508
\<close> ML \<open>
Walther@60567
   509
\<close> ML \<open>
Walther@60567
   510
\<close> ML \<open>
Walther@60567
   511
\<close> ML \<open>
Walther@60567
   512
\<close> text \<open>
Walther@60567
   513
"~~~~~ from fun scan_dn \<longrightarrow>fun scan_up , return:"; val (Accept_Tac ict) = (goback);
Walther@60567
   514
\<close> text \<open>
Walther@60567
   515
"~~~~~ from fun scan_up \<longrightarrow>fun go_scan_up" ^
Walther@60567
   516
       " \<longrightarrow>fun scan_to_tactic \<longrightarrow>fun find_next_step , return:"; val (Accept_Tac (tac, ist, ctxt)) 
Walther@60567
   517
  =  (Accept_Tac ict);
Walther@60567
   518
\<close> ML \<open>
Walther@60567
   519
\<close> ML \<open>
Walther@60567
   520
\<close> ML \<open>
Walther@60567
   521
\<close> ML \<open>
Walther@60567
   522
\<close> ML \<open>
Walther@60567
   523
\<close> ML \<open>
Walther@60567
   524
\<close> ML \<open>
Walther@60567
   525
\<close> ML \<open>
Walther@60567
   526
(*-------------------- stop step into me Take ------------------------------------------------*)
Walther@60567
   527
\<close> ML \<open> (*------------- stop step into me Take ------------------------------------------------*)
Walther@60567
   528
(*\\------------------ step into me Take ---------------------------------------------------//*)
Walther@60567
   529
\<close> ML \<open> (*\\----------- step into me Take ---------------------------------------------------//*)
Walther@60567
   530
\<close> ML \<open>
Walther@60567
   531
val (p,_,f,nxt,_,pt) = me nxt'''' p'''' c pt'''';f2str f;
Walther@60567
   532
val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
Walther@60567
   533
val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
Walther@60567
   534
val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
Walther@60567
   535
val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
Walther@60567
   536
val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
Walther@60567
   537
\<close> ML \<open>
Walther@60567
   538
(*+*)val (**)"L * c + c_2 = q_0 * L \<up> 2 / 2"(** )
Walther@60567
   539
             "[c = L * q_0 / 2, c_2 = 0]"( **) = f2str f;
Walther@60567
   540
\<close> ML \<open>
Walther@60567
   541
  val "Pstate ([\"\n(e_s, [0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2,\n 0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2])\", \"\n(v_s, [c, c_2])\", \"\n(e__s, [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2])\"], [R, R, D], srls_normalise_2x2, NONE, \nL * c + c_2 = q_0 * L \<up> 2 / 2, ORundef, true, true)" =
Walther@60567
   542
(*val "Pstate ([\"\n(e_s, [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2])\", \"\n(v_s, [c, c_2])\", \"\n(e_1, c_2 = 0)\", \"\n(e_2, c = L * q_0 / 2)\", \"\n(e__s, [c_2 = 0, c = L * q_0 / 2])\"], [R, R, D, R, D, R, D, R, D, R, D, L, R], srls_top_down_2x2, SOME e__s, \n[c = L * q_0 / 2, c_2 = 0], ORundef, true, true)" =*)
Walther@60567
   543
(*+*)(Ctree.get_istate_LI pt p |> Istate.string_of)
Walther@60567
   544
\<close> text \<open>
Walther@60567
   545
case nxt of
Walther@60567
   546
    (Check_Postcond ["triangular", "2x2", "LINEAR", "system"]) => ()
Walther@60567
   547
  | _ => error "eqsystem.sml me Subpbl .[EqSys...2x2] finished";
Walther@60567
   548
val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
Walther@60567
   549
val (p,_,f,nxt,_,pt) = me nxt p c pt;f2str f;
Walther@60567
   550
Walther@60567
   551
(* final test ... ----------------------------------------------------------------------------*)
Walther@60567
   552
if f2str f = "[c = L * q_0 / 2, c_2 = 0]" then ()
Walther@60567
   553
else error "eqsystem.sml me [EqSys...2x2] finished f2str f";
Walther@60567
   554
Walther@60567
   555
case nxt of
Walther@60567
   556
    (End_Proof') => ()
Walther@60567
   557
  | _ => error "eqsystem.sml me [EqSys...2x2] finished End_Proof'";
Walther@60567
   558
\<close> ML \<open>
Walther@60567
   559
Test_Tool.show_pt pt (*[
Walther@60567
   560
(([], Frm), solveSystem
Walther@60567
   561
 [[0 = - 1 * q_0 * 0 \<up> 2 div 2 + 0 * c + c_2],
Walther@60567
   562
  [0 = - 1 * q_0 * L \<up> 2 div 2 + L * c + c_2]]
Walther@60567
   563
 [[c], [c_2]]), 
Walther@60567
   564
(([1], Frm), [0 = - 1 * q_0 * 0 \<up> 2 / 2 + 0 * c + c_2,
Walther@60567
   565
 0 = - 1 * q_0 * L \<up> 2 / 2 + L * c + c_2]), 
Walther@60567
   566
(([1], Res), [0 = c_2, 0 = (2 * c_2 + 2 * L * c + - 1 * L \<up> 2 * q_0) / 2]), 
Walther@60567
   567
(([2], Res), [0 = c_2, 0 = - 1 * q_0 * L \<up> 2 / 2 + (L * c + c_2)]), 
Walther@60567
   568
(([3], Res), [c_2 = 0, L * c + c_2 = 0 + - 1 * (- 1 * q_0 * L \<up> 2 / 2)]), 
Walther@60567
   569
(([4], Res), [c_2 = 0, L * c + c_2 = q_0 * L \<up> 2 / 2]), 
Walther@60567
   570
(([5], Pbl), solveSystem [L * c + c_2 = q_0 * L \<up> 2 / 2] [c_2]),
Walther@60567
   571
(([5, 1], Frm), L * c + c_2 = q_0 * L \<up> 2 / 2), 
Walther@60567
   572
Walther@60567
   573
(([5, 1], Res), L * c + 0 = q_0 * L \<up> 2 / 2), 
Walther@60567
   574
(([5, 2], Res), L * c = q_0 * L \<up> 2 / 2), 
Walther@60567
   575
(([5, 3], Res), c = q_0 * L \<up> 2 / 2 / L), 
Walther@60567
   576
(([5, 4], Res), c = L * q_0 / 2), 
Walther@60567
   577
(([5, 5], Frm), [c_2 = 0, c = L * q_0 / 2]), 
Walther@60567
   578
(([5, 5], Res), [c = L * q_0 / 2, c_2 = 0]), 
Walther@60567
   579
(([5], Res), [c = L * q_0 / 2, c_2 = 0]), 
Walther@60567
   580
(([], Res), [c = L * q_0 / 2, c_2 = 0])] 
Walther@60567
   581
*)
walther@60406
   582
\<close> ML \<open>
walther@60406
   583
\<close>
walther@60406
   584
walther@60014
   585
section \<open>===================================================================================\<close>
walther@59998
   586
ML \<open>
walther@59998
   587
\<close> ML \<open>
walther@60014
   588
\<close> ML \<open>
walther@59932
   589
\<close> ML \<open>
walther@59842
   590
\<close>
walther@59834
   591
wneuper@59535
   592
section \<open>code for copy & paste ===============================================================\<close>
wneuper@59535
   593
ML \<open>
wneuper@59531
   594
"~~~~~ fun xxx , args:"; val () = ();
Walther@60567
   595
"~~~~~ and xxx , args:"; val () = ();
Walther@60567
   596
"~~~~~ from fun xxx \<longrightarrow>fun yyy \<longrightarrow>fun zzz , return:"; val () = ();
walther@60262
   597
(*if*) (*then*); (*else*);   (*case*) (*of*);  (*return value*); (*in*) (*end*);
wneuper@59582
   598
"xx"
Walther@60567
   599
^ "xxx"   (*+*) (*+++*) (* keep for continuation*) (*+isa<>isa2*) (**)
Walther@60567
   600
\<close> ML \<open> (*//----------- adhoc inserted n ----------------------------------------------------\\*)
Walther@60567
   601
 (*//----------------- adhoc inserted n ----------------------------------------------------\\*)
Walther@60567
   602
(*\\------------------ adhoc inserted n ----------------------------------------------------//*)
Walther@60567
   603
\<close> ML \<open> (*\\----------- adhoc inserted n ----------------------------------------------------//*)
Walther@60567
   604
Walther@60567
   605
\<close> ML \<open> (*//----------- step into XXXXX -----------------------------------------------------\\*)
Walther@60567
   606
(*//------------------ step into XXXXX -----------------------------------------------------\\*)
Walther@60567
   607
(*-------------------- stop step into XXXXX --------------------------------------------------*)
Walther@60567
   608
\<close> ML \<open> (*------------- stop step into XXXXX --------------------------------------------------*)
Walther@60567
   609
(*\\------------------ step into XXXXX -----------------------------------------------------//*)
Walther@60567
   610
\<close> ML \<open> (*\\----------- step into XXXXX -----------------------------------------------------//*)
Walther@60567
   611
Walther@60567
   612
\<close> ML \<open> (*//----------- build new fun XXXXX -------------------------------------------------\\*)
Walther@60567
   613
(*//------------------ build new fun XXXXX -------------------------------------------------\\*)
Walther@60567
   614
(*\\------------------ build new fun XXXXX -------------------------------------------------//*)
Walther@60567
   615
\<close> ML \<open> (*\\----------- build new fun XXXXX -------------------------------------------------//*)
wneuper@59535
   616
\<close>
neuper@41943
   617
end