test/Tools/isac/MathEngine/step.sml
author Walther Neuper <walther.neuper@jku.at>
Fri, 15 May 2020 11:46:43 +0200
changeset 59983 f1fdb213717b
parent 59959 0f0718c61f68
child 59996 7e314dd233fd
permissions -rw-r--r--
shift code from Specification to appropriate locations
walther@59763
     1
(* Title:  "MathEngine/step.sml"
walther@59763
     2
   Author: Walther Neuper
walther@59763
     3
   (c) due to copyright terms
walther@59763
     4
*)
walther@59763
     5
walther@59763
     6
"-----------------------------------------------------------------------------------------------";
walther@59763
     7
"table of contents -----------------------------------------------------------------------------";
walther@59763
     8
"-----------------------------------------------------------------------------------------------";
walther@59763
     9
"-----------------------------------------------------------------------------------------------";
walther@59814
    10
"----------- survey on istate, context ----- ---------------------------------------------------";
walther@59959
    11
"----------- embed fun Step.inconsistent -------------------------------------------------------";
walther@59763
    12
"-----------------------------------------------------------------------------------------------";
walther@59763
    13
"-----------------------------------------------------------------------------------------------";
walther@59763
    14
"-----------------------------------------------------------------------------------------------";
walther@59763
    15
walther@59814
    16
"----------- survey on istate, context ----- ---------------------------------------------------";
walther@59814
    17
"----------- survey on istate, context ----- ---------------------------------------------------";
walther@59814
    18
"----------- survey on istate, context ----- ---------------------------------------------------";
walther@59814
    19
(* run this ---vvv code * )
walther@59814
    20
"----------- fun me_trace all Minisubpbl -------------------------------------------------------";
walther@59814
    21
val fmz = ["equality (x+1=(2::real))", "solveFor x","solutions L"];
walther@59814
    22
val (dI',pI',mI') =
walther@59814
    23
  ("Test", ["sqroot-test","univariate","equation","test"],
walther@59814
    24
   ["Test","squ-equ-test-subpbl1"]);
walther@59814
    25
 (*[], Pbl*)val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];(*Model_Problem*)
walther@59814
    26
(*[], Pbl*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;
walther@59814
    27
(*[], Pbl*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;
walther@59814
    28
(*[], Pbl*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;
walther@59814
    29
(*[], Pbl*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;
walther@59814
    30
(*[], Pbl*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;
walther@59814
    31
(*[], Pbl*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;
walther@59814
    32
(*[], Met*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;
walther@59814
    33
(*[1], Frm*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;(*Apply_Method ["Test","squ-equ-test-subpbl1"]*)
walther@59814
    34
(*[1], Res*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;(*Rewrite_Set "norm_equation"*)
walther@59814
    35
(*[2], Res*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;(*Rewrite_Set "Test_simplify"*)
walther@59814
    36
(*[3], Pbl*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;(*Subproblem ("Test", ["LINEAR", "univariate", "equation", "test"]*)
walther@59814
    37
(*[3], Pbl*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;
walther@59814
    38
(*[3], Pbl*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;
walther@59814
    39
(*[3], Pbl*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;
walther@59814
    40
(*[3], Pbl*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;
walther@59814
    41
(*[3], Pbl*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;
walther@59814
    42
(*[3], Pbl*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;
walther@59814
    43
(*[3], Met*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;
walther@59814
    44
(*[3, 1], Frm*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;(*Apply_Method ["Test","solve_linear"]*)
walther@59814
    45
(*[3, 1], Res*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;(*Rewrite_Set_Inst ([(''bdv'', x)], "isolate_bdv")*)
walther@59814
    46
(*[3, 2], Res*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;(*Rewrite_Set "Test_simplify"*)
walther@59814
    47
(*[3], Res*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;(*Check_Postcond ["LINEAR","univariate","equation","test"]*)
walther@59814
    48
(*[4], Res*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;(*Check_elementwise "Assumptions"*)
walther@59814
    49
(*[], Res*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;(*Check_Postcond ["sqroot-test","univariate","equation","test"]*)
walther@59814
    50
(*[], Res*)val ((pt, p), nxt, t) = me_trace (pt, p) nxt trace_ist_ctxt;(*End_Proof'*)
walther@59814
    51
( * run this ---^^^code *)
walther@59814
    52
walther@59814
    53
(* for this output:
walther@59814
    54
========= ([], Pbl)========= Step.by_tactic: Model_Problem  ================================== 
walther@59852
    55
Frm ..... (SOME (Pstate ([], [], Rule_Set.empty, NONE, ??.empty, ORundef, false, false),
walther@59814
    56
... ctxt:    []) , 
walther@59814
    57
Res .....  NONE) 
walther@59814
    58
--------- ([], Pbl)--------- Step.do_next \<rightarrow> Add_Given equality (x + 1 = 2)---------------------------------- 
walther@59814
    59
========= ([], Met)========= Step.by_tactic: Apply_Method ["Test","squ-equ-test-subpbl1"] ================================== 
walther@59852
    60
Frm ..... (SOME (Pstate ([(e_e, x + 1 = 2),(v_v, x)], [], Rule_Set.empty, NONE, ??.empty, ORundef, false, true),
walther@59814
    61
... ctxt:    ["precond_rootmet x"]) , 
walther@59814
    62
Res .....  NONE) 
walther@59814
    63
--------- ([1], Frm)--------- Step.do_next \<rightarrow> Rewrite_Set "norm_equation"---------------------------------- 
walther@59852
    64
Frm ..... (SOME (Pstate ([(e_e, x + 1 = 2),(v_v, x)], [], Rule_Set.empty, NONE, ??.empty, ORundef, false, true),
walther@59814
    65
... ctxt:    ["precond_rootmet x"]) , 
walther@59852
    66
Res .....  SOME (Pstate ([(e_e, x + 1 = 2),(v_v, x)], [R,L,R,L,L,R,R], Rule_Set.empty, SOME e_e, x + 1 + -1 * 2 = 0, ORundef, true, false),
walther@59814
    67
... ctxt:    ["precond_rootmet x"]) ) 
walther@59814
    68
========= ([1], Frm)========= Step.by_tactic: Rewrite_Set "norm_equation" ================================== 
walther@59852
    69
Frm ..... (SOME (Pstate ([(e_e, x + 1 = 2),(v_v, x)], [], Rule_Set.empty, NONE, ??.empty, ORundef, false, true),
walther@59814
    70
... ctxt:    ["precond_rootmet x"]) , 
walther@59852
    71
Res .....  SOME (Pstate ([(e_e, x + 1 = 2),(v_v, x)], [R,L,R,L,L,R,R], Rule_Set.empty, SOME e_e, x + 1 + -1 * 2 = 0, ORundef, true, true),
walther@59814
    72
... ctxt:    ["precond_rootmet x"]) ) 
walther@59814
    73
--------- ([1], Res)--------- Step.do_next \<rightarrow> Rewrite_Set "Test_simplify"---------------------------------- 
walther@59814
    74
Frm .....  (NONE, 
walther@59852
    75
Res .....  SOME (Pstate ([(e_e, x + 1 = 2),(v_v, x)], [R,L,R,L,R,R], Rule_Set.empty, SOME e_e, -1 + x = 0, ORundef, true, false),
walther@59814
    76
... ctxt:    ["precond_rootmet x"]) ) 
walther@59814
    77
========= ([1], Res)========= Step.by_tactic: Rewrite_Set "Test_simplify" ================================== 
walther@59814
    78
Frm .....  (NONE, 
walther@59852
    79
Res .....  SOME (Pstate ([(e_e, x + 1 = 2),(v_v, x)], [R,L,R,L,R,R], Rule_Set.empty, SOME e_e, -1 + x = 0, ORundef, true, false),
walther@59814
    80
... ctxt:    ["precond_rootmet x"]) ) 
walther@59814
    81
--------- ([2], Res)--------- Step.do_next \<rightarrow> Subproblem (Test, ["LINEAR","univariate","equation","test"])---------------------------------- 
walther@59852
    82
Frm ..... (SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x)], [R,R,D,L,R], Rule_Set.empty, NONE, Subproblem
walther@59814
    83
 (''Test'',
walther@59814
    84
  ??.\<^const>String.char.Char ''LINEAR'' ''univariate'' ''equation''
walther@59814
    85
   ''test''), ORundef, true, false),
walther@59814
    86
... ctxt:    ["precond_rootmet x"]) , 
walther@59814
    87
Res .....  NONE) 
walther@59814
    88
========= ([2], Res)========= Step.by_tactic: Subproblem (Test, ["LINEAR","univariate","equation","test"]) ================================== 
walther@59852
    89
Frm ..... (SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x)], [R,R,D,L,R], Rule_Set.empty, NONE, Subproblem
walther@59814
    90
 (''Test'',
walther@59814
    91
  ??.\<^const>String.char.Char ''LINEAR'' ''univariate'' ''equation''
walther@59814
    92
   ''test''), ORundef, true, true),
walther@59814
    93
... ctxt:    []) , 
walther@59814
    94
Res .....  NONE) 
walther@59814
    95
--------- ([3], Pbl)--------- Step.do_next \<rightarrow> Model_Problem ---------------------------------- 
walther@59814
    96
========= ([3], Pbl)========= Step.by_tactic: Model_Problem  ================================== 
walther@59852
    97
Frm ..... (SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x)], [R,R,D,L,R], Rule_Set.empty, NONE, Subproblem
walther@59814
    98
 (''Test'',
walther@59814
    99
  ??.\<^const>String.char.Char ''LINEAR'' ''univariate'' ''equation''
walther@59814
   100
   ''test''), ORundef, true, true),
walther@59814
   101
... ctxt:    []) , 
walther@59814
   102
Res .....  NONE) 
walther@59814
   103
--------- ([3], Pbl)--------- Step.do_next \<rightarrow> Add_Given equality (-1 + x = 0)---------------------------------- 
walther@59814
   104
========= ([3], Met)========= Step.by_tactic: Apply_Method ["Test","solve_linear"] ================================== 
walther@59852
   105
Frm ..... (SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x)], [], Rule_Set.empty, NONE, ??.empty, ORundef, false, true),
walther@59814
   106
... ctxt:    ["matches (?a = ?b) (-1 + x = 0)"]) , 
walther@59814
   107
Res .....  NONE) 
walther@59814
   108
--------- ([3,1], Frm)--------- Step.do_next \<rightarrow> Rewrite_Set_Inst ([(''bdv'', x)], "isolate_bdv")---------------------------------- 
walther@59852
   109
Frm ..... (SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x)], [], Rule_Set.empty, NONE, ??.empty, ORundef, false, true),
walther@59814
   110
... ctxt:    ["matches (?a = ?b) (-1 + x = 0)"]) , 
walther@59852
   111
Res .....  SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x)], [R,L,R,L,R,L,R], Rule_Set.empty, SOME e_e, x = 0 + -1 * -1, ORundef, true, false),
walther@59814
   112
... ctxt:    ["matches (?a = ?b) (-1 + x = 0)"]) ) 
walther@59814
   113
========= ([3,1], Frm)========= Step.by_tactic: Rewrite_Set_Inst ([(''bdv'', x)], "isolate_bdv") ================================== 
walther@59852
   114
Frm ..... (SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x)], [], Rule_Set.empty, NONE, ??.empty, ORundef, false, true),
walther@59814
   115
... ctxt:    ["matches (?a = ?b) (-1 + x = 0)"]) , 
walther@59852
   116
Res .....  SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x)], [R,L,R,L,R,L,R], Rule_Set.empty, SOME e_e, x = 0 + -1 * -1, ORundef, true, true),
walther@59814
   117
... ctxt:    ["matches (?a = ?b) (-1 + x = 0)"]) ) 
walther@59814
   118
--------- ([3,1], Res)--------- Step.do_next \<rightarrow> Rewrite_Set "Test_simplify"---------------------------------- 
walther@59814
   119
Frm .....  (NONE, 
walther@59852
   120
Res .....  SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x)], [R,L,R,L,R,R], Rule_Set.empty, SOME e_e, x = 1, ORundef, true, false),
walther@59814
   121
... ctxt:    ["matches (?a = ?b) (-1 + x = 0)"]) ) 
walther@59814
   122
========= ([3,1], Res)========= Step.by_tactic: Rewrite_Set "Test_simplify" ================================== 
walther@59814
   123
Frm .....  (NONE, 
walther@59852
   124
Res .....  SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x)], [R,L,R,L,R,R], Rule_Set.empty, SOME e_e, x = 1, ORundef, true, false),
walther@59814
   125
... ctxt:    ["matches (?a = ?b) (-1 + x = 0)"]) ) 
walther@59814
   126
--------- ([3,2], Res)--------- Step.do_next \<rightarrow> Check_Postcond ["LINEAR","univariate","equation","test"]---------------------------------- 
walther@59852
   127
Frm ..... (SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x)], [R,R,D,L,R], Rule_Set.empty, NONE, Subproblem
walther@59814
   128
 (''Test'',
walther@59814
   129
  ??.\<^const>String.char.Char ''LINEAR'' ''univariate'' ''equation''
walther@59814
   130
   ''test''), ORundef, true, true),
walther@59814
   131
... ctxt:    []) , 
walther@59852
   132
Res .....  SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x)], [R,R,D,L,R], Rule_Set.empty, NONE, [x = 1], ORundef, true, true),
walther@59814
   133
... ctxt:    ["matches (?a = ?b) (-1 + x = 0)","x = 1"]) ) 
walther@59814
   134
========= ([3,2], Res)========= Step.by_tactic: Check_Postcond ["LINEAR","univariate","equation","test"] ================================== 
walther@59852
   135
Frm ..... (SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x)], [R,R,D,L,R], Rule_Set.empty, NONE, Subproblem
walther@59814
   136
 (''Test'',
walther@59814
   137
  ??.\<^const>String.char.Char ''LINEAR'' ''univariate'' ''equation''
walther@59814
   138
   ''test''), ORundef, true, true),
walther@59814
   139
... ctxt:    []) , 
walther@59852
   140
Res .....  SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x)], [R,R,D,L,R], Rule_Set.empty, NONE, [x = 1], ORundef, true, true),
walther@59814
   141
... ctxt:    ["matches (?a = ?b) (-1 + x = 0)","x = 1"]) ) 
walther@59814
   142
--------- ([3], Res)--------- Step.do_next \<rightarrow> Check_elementwise "Assumptions"---------------------------------- 
walther@59814
   143
Frm .....  (NONE, 
walther@59852
   144
Res .....  SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x),(L_L, [x = 1])], [R,R,D,R,D], Rule_Set.empty, NONE, [x = 1], ORundef, true, false),
walther@59814
   145
... ctxt:    ["matches (?a = ?b) (-1 + x = 0)","x = 1"]) ) 
walther@59814
   146
========= ([3], Res)========= Step.by_tactic: Check_elementwise "Assumptions" ================================== 
walther@59814
   147
Frm .....  (NONE, 
walther@59852
   148
Res .....  SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x),(L_L, [x = 1])], [R,R,D,R,D], Rule_Set.empty, NONE, [x = 1], ORundef, true, true),
walther@59814
   149
... ctxt:    ["matches (?a = ?b) (-1 + x = 0)","x = 1"]) ) 
walther@59814
   150
--------- ([4], Res)--------- Step.do_next \<rightarrow> Check_Postcond ["sqroot-test","univariate","equation","test"]---------------------------------- 
walther@59852
   151
Frm ..... (SOME (Pstate ([], [], Rule_Set.empty, NONE, ??.empty, ORundef, false, false),
walther@59814
   152
... ctxt:    []) , 
walther@59852
   153
Res .....  SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x),(L_L, [x = 1])], [R,R,D,R,D], Rule_Set.empty, NONE, [x = 1], ORundef, true, true),
walther@59814
   154
... ctxt:    ["matches (?a = ?b) (-1 + x = 0)","x = 1"]) ) 
walther@59814
   155
========= ([4], Res)========= Step.by_tactic: Check_Postcond ["sqroot-test","univariate","equation","test"] ================================== 
walther@59852
   156
Frm ..... (SOME (Pstate ([], [], Rule_Set.empty, NONE, ??.empty, ORundef, false, false),
walther@59814
   157
... ctxt:    []) , 
walther@59852
   158
Res .....  SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x),(L_L, [x = 1])], [R,R,D,R,D], Rule_Set.empty, NONE, [x = 1], ORundef, true, true),
walther@59814
   159
... ctxt:    ["matches (?a = ?b) (-1 + x = 0)","x = 1"]) ) 
walther@59814
   160
--------- ([], Res)--------- Step.do_next \<rightarrow> input End_Proof'---------------------------------- 
walther@59814
   161
========= ([], Res)========= Step.by_tactic: input End_Proof' ================================== 
walther@59852
   162
Frm ..... (SOME (Pstate ([], [], Rule_Set.empty, NONE, ??.empty, ORundef, false, false),
walther@59814
   163
... ctxt:    []) , 
walther@59852
   164
Res .....  SOME (Pstate ([(e_e, -1 + x = 0),(v_v, x),(L_L, [x = 1])], [R,R,D,R,D], Rule_Set.empty, NONE, [x = 1], ORundef, true, true),
walther@59814
   165
... ctxt:    ["matches (?a = ?b) (-1 + x = 0)","x = 1"]) ) 
walther@59814
   166
--------- ([], Res)--------- Step.do_next \<rightarrow> input End_Proof'---------------------------------- 
walther@59959
   167
*)
walther@59959
   168
walther@59959
   169
walther@59959
   170
"--------- embed fun Step.inconsistent -------------------";
walther@59959
   171
"--------- embed fun Step.inconsistent -------------------";
walther@59959
   172
"--------- embed fun Step.inconsistent -------------------";
walther@59959
   173
reset_states ();
walther@59959
   174
CalcTree
walther@59959
   175
[(["functionTerm (x ^ 2 + sin (x ^ 4))", "differentiateFor x", "derivative f_f'"], 
walther@59959
   176
  ("Isac_Knowledge", ["derivative_of","function"], ["diff","differentiate_on_R"]))];
walther@59959
   177
Iterator 1;
walther@59959
   178
moveActiveRoot 1;
walther@59959
   179
autoCalculate 1 CompleteCalcHead;
walther@59959
   180
autoCalculate 1 (Steps 1);
walther@59959
   181
autoCalculate 1 (Steps 1);(*([1], Res), d_d x (x ^^^ 2) + d_d x (sin (x ^^^ 4))*)
walther@59959
   182
appendFormula 1 "d_d x (x ^ 2) + cos (4 * x ^ 3)" (*|> Future.join*);
walther@59959
   183
(* the check for errpat is maximally liberal (whole term modulo "nrls" from "type met"),
walther@59959
   184
  would recognize "cos (4 * x ^ (4 - 1)) + 2 * x" as well.
walther@59959
   185
  results in <CALCMESSAGE> error pattern #chain-rule-diff-both# </CALCMESSAGE>
walther@59959
   186
  instead of <CALCMESSAGE> no derivation found </CALCMESSAGE> *)
walther@59959
   187
(*========== inhibit exn WN1130621 Isabelle2012-->13 !thehier! ====================
walther@59959
   188
findFillpatterns 1 "chain-rule-diff-both";
walther@59959
   189
(*<CALCMESSAGE> fill patterns #fill-d_d-arg#d_d x (x ^^^ 2) + d_d x (sin (x ^^^ 4)) =
walther@59959
   190
  d_d x (x ^^^ 2) + cos (x ^^^ 4) * d_d x ?_dummy_1#fill-both-args#...#...#... *)
walther@59959
   191
walther@59959
   192
"~~~~~ fun requestFillformula, args:"; val (cI, (errpatID, fillpatID)) =
walther@59959
   193
  (1, ("chain-rule-diff-both", "fill-both-args"));
walther@59959
   194
    val ((pt, _), _) = get_calc cI
walther@59959
   195
		    val pos as (p, _) = get_pos cI 1;
walther@59959
   196
    val fillforms = Error_Pattern.find_fill_patterns (pt, pos) errpatID;
walther@59959
   197
walther@59959
   198
if pos = ([1], Res) then () else error "Step.inconsistent changed 1";
walther@59959
   199
walther@59959
   200
 val (_, fillform, thm, sube_opt) :: _ = filter ((curry op = fillpatID) o 
walther@59959
   201
        (#1: (fillpatID * term * thm * (subs option) -> fillpatID))) fillforms;
walther@59959
   202
walther@59959
   203
"~~~~~ fun Step.inconsistent, args:";
walther@59959
   204
  val ((subs_opt, thm'), f', (is, ctxt), pos, pt) =
walther@59959
   205
    ((sube_opt, thm'_of_thm thm), fillform, (get_loc pt pos), pos, pt);
walther@59959
   206
walther@59959
   207
    val f = get_curr_formula (pt, pos);
walther@59959
   208
    val pos' as (p', _) = (lev_on p, Res);
walther@59959
   209
walther@59959
   210
if pos = ([1], Res) then () else error "Step.inconsistent changed 2a";
walther@59959
   211
if UnparseC.term f = "d_d x (x ^^^ 2) + d_d x (sin (x ^^^ 4))"
walther@59959
   212
  then () else error "Step.inconsistent changed 2b";
walther@59959
   213
walther@59959
   214
    val (pt,c) = 
walther@59959
   215
      case subs_opt of
walther@59959
   216
        NONE => cappend_atomic pt p' (is, ContextC.insert_assumptions [] ctxt) f
walther@59959
   217
          (Rewrite thm') (f', []) Inconsistent
walther@59959
   218
      | SOME subs => cappend_atomic pt p' (is, ContextC.insert_assumptions [] ctxt) f
walther@59959
   219
          (Rewrite_Inst (subs, thm')) (f', []) Inconsistent
walther@59959
   220
    val pt = update_branch pt p' TransitiveB;
walther@59959
   221
walther@59959
   222
if get_obj g_tac pt p' = Rewrite_Inst (["(''bdv'', x)"], ("diff_sin_chain", ""))
walther@59959
   223
  andalso pos = ([1], Res) andalso pos' = ([2], Res) andalso p' = [2]
walther@59959
   224
then () else error "Step.inconsistent changed 3";
walther@59959
   225
walther@59959
   226
"~~~~~ to requestFillformula return val:"; val (pt, pos') = (pt, pos');
walther@59959
   227
(*val (pt, pos') = Step.inconsistent (sube_opt, thm'_of_thm thm)
walther@59959
   228
            (fillform, []) (get_loc pt pos) pos' pt*)
walther@59959
   229
upd_calc cI ((pt, pos'), []); upd_ipos cI 1 pos';
walther@59959
   230
walther@59959
   231
"~~~~~ final check:";
walther@59959
   232
val ((pt, _),_) = get_calc 1;
walther@59959
   233
val p = get_pos 1 1;
walther@59983
   234
val (Form f, _, asms) = ME_Misc.pt_extract (pt, p);
walther@59959
   235
if p = ([2], Res) andalso 
walther@59959
   236
  get_obj g_tac pt (fst p) = Rewrite_Inst (["(''bdv'', x)"], ("diff_sin_chain", "")) andalso
walther@59959
   237
  UnparseC.term f =
walther@59959
   238
  "d_d x (x ^^^ 2) + d_d x (sin (x ^^^ 4)) =\nd_d x (x ^^^ 2) + cos ?u * d_d x ?_dummy_2"
walther@59959
   239
  (*WAS with old findFillpatterns:
walther@59959
   240
  "d_d x (x ^^^ 2) + d_d x (sin (x ^^^ 4)) =\nd_d x (x ^^^ 2) + cos ?_dummy_2 * d_d x ?_dummy_3"
walther@59959
   241
  WN120731 replaced 
walther@59959
   242
  "d_d x (x ^^^ 2) + d_d x (sin (x ^^^ 4)) =\nd_d x (x ^^^ 2) + cos ?u * d_d x ?_dummy_2"
walther@59959
   243
  WN120804 replaced
walther@59959
   244
  "d_d x (x ^^^ 2) + d_d x (sin (x ^^^ 4)) =\nd_d x (x ^^^ 2) + cos ?_dummy_1 * d_d x ?_dummy_2"*)
walther@59959
   245
then () else error "Step.inconsistent changed: fill-formula?";
walther@59959
   246
walther@59983
   247
Test_Tool.show_pt pt; (*ATTENTION: omits the last step, if pt is incomplete, ([2], Res) EXISTS !*)
walther@59959
   248
============ inhibit exn WN1130621 Isabelle2012-->13 !thehier! ==================*)