src/Tools/isac/Interpret/solve-step.sml
author Walther Neuper <walther.neuper@jku.at>
Fri, 01 May 2020 16:06:59 +0200
changeset 59922 9dbb624c2ec2
parent 59921 0766dade4a78
child 59923 cd730f07c9ac
permissions -rw-r--r--
separate Specify_Step.check
walther@59920
     1
(* Title:  Specify/solve-step.sml
walther@59920
     2
   Author: Walther Neuper
walther@59920
     3
   (c) due to copyright terms
walther@59920
     4
walther@59920
     5
Code for the solve-phase in analogy to structure Specify_Step for the specify-phase.
walther@59920
     6
*)
walther@59920
     7
walther@59920
     8
signature SOLVE_STEP =
walther@59920
     9
sig
walther@59921
    10
  val check: Tactic.input -> Calc.T -> Applicable.T
walther@59921
    11
(* ---- for tests only: shifted from below to remove the Warning "unused" at fun.def. --------- *)
walther@59921
    12
  (*NONE*)                                                     
walther@59921
    13
(*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\* )
walther@59921
    14
  (*NONE*)                                                     
walther@59921
    15
( *\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*)
walther@59920
    16
end
walther@59920
    17
walther@59920
    18
(**)
walther@59920
    19
structure Solve_Step(** ): SOLVE_STEP( **) =
walther@59920
    20
struct
walther@59920
    21
(**)
walther@59920
    22
walther@59922
    23
(*
walther@59922
    24
  check tactics (input by the user, mostly) for applicability
walther@59922
    25
  and determine as much of the result of the tactic as possible initially.
walther@59922
    26
*)
walther@59921
    27
fun check (Tactic.Check_Postcond pI) (_, (p, p_)) =
walther@59921
    28
      if member op = [Pos.Pbl, Pos.Met] p_                  
walther@59921
    29
      then Applicable.No ((Tactic.input_to_string (Tactic.Check_Postcond pI)) ^ " not for pos " ^ Pos.pos'2str (p, p_))
walther@59921
    30
      else Applicable.Yes (Tactic.Check_Postcond' (pI, TermC.empty))
walther@59921
    31
  | check (Tactic.Take str) _ = Applicable.Yes (Tactic.Take' (TermC.str2term str)) (* always applicable ?*)
walther@59921
    32
  | check (Tactic.Free_Solve) _ = Applicable.Yes (Tactic.Free_Solve')        (* always applicable *)
walther@59921
    33
  | check (m as Tactic.Rewrite_Inst (subs, thm'')) (pt, (p, p_)) = 
walther@59921
    34
    if member op = [Pos.Pbl, Pos.Met] p_ 
walther@59921
    35
    then Applicable.No ((Tactic.input_to_string m)^" not for pos " ^ Pos.pos'2str (p, p_))
walther@59921
    36
    else
walther@59921
    37
      let 
walther@59921
    38
        val pp = Ctree.par_pblobj pt p;
walther@59921
    39
        val thy' = Ctree.get_obj Ctree.g_domID pt pp;
walther@59921
    40
        val thy = ThyC.get_theory thy';
walther@59921
    41
        val {rew_ord' = ro', erls = erls, ...} = Specify.get_met (Ctree.get_obj Ctree.g_metID pt pp);
walther@59921
    42
        val (f, _) = case p_ of (*p 12.4.00 unnecessary*)
walther@59921
    43
                      Frm => (Ctree.get_obj Ctree.g_form pt p, p)
walther@59921
    44
                    | Pos.Res => ((fst o (Ctree.get_obj Ctree.g_result pt)) p, Pos.lev_on p)
walther@59921
    45
                    | _ => error ("Solve_Step.check: call by " ^ Pos.pos'2str (p, p_));
walther@59921
    46
      in 
walther@59921
    47
        let
walther@59921
    48
          val subst = Subst.T_from_input thy subs;
walther@59921
    49
        in
walther@59921
    50
          case Rewrite.rewrite_inst_ thy (Rewrite_Ord.assoc_rew_ord ro') erls false subst (snd thm'') f of
walther@59921
    51
            SOME (f',asm) =>
walther@59921
    52
              Applicable.Yes (Tactic.Rewrite_Inst' (thy', ro', erls, false, subst, thm'', f, (f', asm)))
walther@59921
    53
          | NONE => Applicable.No ((fst thm'')^" not applicable")
walther@59921
    54
        end
walther@59921
    55
        handle _ => Applicable.No ("syntax error in "^(subs2str subs))
walther@59921
    56
      end
walther@59921
    57
  | check (m as Tactic.Rewrite thm'') (pt, (p, p_)) = 
walther@59921
    58
    if member op = [Pos.Pbl, Pos.Met] p_ 
walther@59921
    59
    then Applicable.No ((Tactic.input_to_string m)^" not for pos "^(Pos.pos'2str (p, p_)))
walther@59921
    60
    else
walther@59921
    61
      let
walther@59921
    62
        val (msg, thy', ro, rls', _)= ApplicableOLD.from_pblobj_or_detail_thm thm'' p pt;
walther@59921
    63
        val thy = ThyC.get_theory thy';
walther@59921
    64
        val f = case p_ of
walther@59921
    65
          Frm => Ctree.get_obj Ctree.g_form pt p
walther@59921
    66
	      | Pos.Res => (fst o (Ctree.get_obj Ctree.g_result pt)) p
walther@59921
    67
	      | _ => error ("Solve_Step.check Rewrite: call by " ^ Pos.pos'2str (p, p_));
walther@59921
    68
      in
walther@59921
    69
        if msg = "OK" 
walther@59921
    70
        then
walther@59921
    71
          case Rewrite.rewrite_ thy (Rewrite_Ord.assoc_rew_ord ro) rls' false (snd thm'') f of
walther@59921
    72
            SOME (f',asm) => Applicable.Yes (Tactic.Rewrite' (thy', ro, rls', false, thm'', f, (f', asm)))
walther@59921
    73
          | NONE => Applicable.No ("'" ^ fst thm'' ^"' not applicable") 
walther@59921
    74
        else Applicable.No msg
walther@59921
    75
      end
walther@59921
    76
  | check (m as Tactic.Detail_Set_Inst (subs, rls)) (pt, (p, p_)) = 
walther@59921
    77
    if member op = [Pos.Pbl, Pos.Met] p_ 
walther@59921
    78
    then Applicable.No ((Tactic.input_to_string m)^" not for pos "^(Pos.pos'2str (p, p_)))
walther@59921
    79
    else
walther@59921
    80
      let 
walther@59921
    81
        val pp = Ctree.par_pblobj pt p;
walther@59921
    82
        val thy' = Ctree.get_obj Ctree.g_domID pt pp;
walther@59921
    83
        val thy = ThyC.get_theory thy';
walther@59921
    84
        val f = case p_ of Frm => Ctree.get_obj Ctree.g_form pt p
walther@59921
    85
    		| Pos.Res => (fst o (Ctree.get_obj Ctree.g_result pt)) p
walther@59921
    86
    		| _ => error ("Solve_Step.check: call by " ^ Pos.pos'2str (p, p_));
walther@59921
    87
        val subst = Subst.T_from_input thy subs
walther@59921
    88
      in 
walther@59921
    89
        case Rewrite.rewrite_set_inst_ thy false subst (assoc_rls rls) f of
walther@59921
    90
          SOME (f', asm)
walther@59921
    91
            => Applicable.Yes (Tactic.Detail_Set_Inst' (thy', false, subst, assoc_rls rls, f, (f', asm)))
walther@59921
    92
        | NONE => Applicable.No (rls ^ " not applicable")
walther@59921
    93
        handle _ => Applicable.No ("syntax error in " ^ subs2str subs)
walther@59921
    94
      end
walther@59921
    95
  | check (m as Tactic.Rewrite_Set_Inst (subs, rls)) (pt, (p, p_)) =
walther@59921
    96
    if member op = [Pos.Pbl, Pos.Met] p_ 
walther@59921
    97
    then Applicable.No ((Tactic.input_to_string m)^" not for pos "^(Pos.pos'2str (p,p_)))
walther@59921
    98
    else
walther@59921
    99
      let 
walther@59921
   100
        val pp = Ctree.par_pblobj pt p;
walther@59921
   101
        val thy' = Ctree.get_obj Ctree.g_domID pt pp;
walther@59921
   102
        val thy = ThyC.get_theory thy';
walther@59921
   103
        val (f, _) = case p_ of
walther@59921
   104
          Frm => (Ctree.get_obj Ctree.g_form pt p, p)
walther@59921
   105
    	  | Pos.Res => ((fst o (Ctree.get_obj Ctree.g_result pt)) p, Pos.lev_on p)
walther@59921
   106
    	  | _ => error ("Solve_Step.check: call by " ^ Pos.pos'2str (p, p_));
walther@59921
   107
    	  val subst = Subst.T_from_input thy subs;
walther@59921
   108
      in 
walther@59921
   109
        case Rewrite.rewrite_set_inst_ thy (*put_asm*)false subst (assoc_rls rls) f of
walther@59921
   110
          SOME (f',asm)
walther@59921
   111
            => Applicable.Yes (Tactic.Rewrite_Set_Inst' (thy', false, subst, assoc_rls rls, f, (f', asm)))
walther@59921
   112
        | NONE => Applicable.No (rls ^ " not applicable")
walther@59921
   113
        handle _ => Applicable.No ("syntax error in " ^(subs2str subs))
walther@59921
   114
      end
walther@59921
   115
  | check (m as Tactic.Rewrite_Set rls) (pt, (p, p_)) =
walther@59921
   116
    if member op = [Pos.Pbl, Pos.Met] p_ 
walther@59921
   117
    then Applicable.No (Tactic.input_to_string m ^ " not for pos " ^ Pos.pos'2str (p, p_))
walther@59921
   118
    else
walther@59921
   119
      let 
walther@59921
   120
        val pp = Ctree.par_pblobj pt p; 
walther@59921
   121
        val thy' = Ctree.get_obj Ctree.g_domID pt pp;
walther@59921
   122
        val (f, _) = case p_ of
walther@59921
   123
          Frm => (Ctree.get_obj Ctree.g_form pt p, p)
walther@59921
   124
    	  | Pos.Res => ((fst o (Ctree.get_obj Ctree.g_result pt)) p, Pos.lev_on p)
walther@59921
   125
    	  | _ => error ("Solve_Step.check: call by " ^ Pos.pos'2str (p, p_));
walther@59921
   126
      in
walther@59921
   127
        case Rewrite.rewrite_set_ (ThyC.get_theory thy') false (assoc_rls rls) f of
walther@59921
   128
          SOME (f', asm)
walther@59921
   129
            => Applicable.Yes (Tactic.Rewrite_Set' (thy', false, assoc_rls rls, f, (f', asm)))
walther@59921
   130
          | NONE => Applicable.No (rls ^ " not applicable")
walther@59921
   131
      end
walther@59921
   132
  | check (m as Tactic.Detail_Set rls) (pt, (p, p_)) =
walther@59921
   133
    if member op = [Pos.Pbl, Pos.Met] p_ 
walther@59921
   134
    then Applicable.No (Tactic.input_to_string m ^ " not for pos " ^ Pos.pos'2str (p, p_))
walther@59921
   135
    else
walther@59921
   136
    	let
walther@59921
   137
    	  val pp = Ctree.par_pblobj pt p 
walther@59921
   138
    	  val thy' = Ctree.get_obj Ctree.g_domID pt pp
walther@59921
   139
    	  val f = case p_ of
walther@59921
   140
    			Frm => Ctree.get_obj Ctree.g_form pt p
walther@59921
   141
    		| Pos.Res => (fst o (Ctree.get_obj Ctree.g_result pt)) p
walther@59921
   142
    		| _ => error ("Solve_Step.check: call by " ^ Pos.pos'2str (p, p_));
walther@59921
   143
    	in
walther@59921
   144
    	  case Rewrite.rewrite_set_ (ThyC.get_theory thy') false (assoc_rls rls) f of
walther@59921
   145
    	    SOME (f',asm) => Applicable.Yes (Tactic.Detail_Set' (thy', false, assoc_rls rls, f, (f', asm)))
walther@59921
   146
    	  | NONE => Applicable.No (rls^" not applicable")
walther@59921
   147
    	end
walther@59921
   148
  | check Tactic.End_Ruleset _ = raise ERROR ("Solve_Step.check: not impl. for " ^ Tactic.input_to_string Tactic.End_Ruleset)
walther@59921
   149
  | check (m as Tactic.Calculate op_) (pt, (p, p_)) =
walther@59921
   150
    if member op = [Pos.Pbl, Pos.Met] p_
walther@59921
   151
    then Applicable.No ((Tactic.input_to_string m)^" not for pos "^(Pos.pos'2str (p,p_)))
walther@59921
   152
    else
walther@59921
   153
      let 
walther@59921
   154
        val (msg,thy',isa_fn) = ApplicableOLD.from_pblobj_or_detail_calc op_ p pt;
walther@59921
   155
        val f = case p_ of
walther@59921
   156
          Frm => Ctree.get_obj Ctree.g_form pt p
walther@59921
   157
    	  | Pos.Res => (fst o (Ctree.get_obj Ctree.g_result pt)) p
walther@59921
   158
      	| _ => raise ERROR ("Solve_Step.check: call by " ^ Pos.pos'2str (p, p_));
walther@59921
   159
      in
walther@59921
   160
        if msg = "OK"
walther@59921
   161
        then
walther@59921
   162
    	    case Rewrite.calculate_ (ThyC.get_theory thy') isa_fn f of
walther@59921
   163
    	      SOME (f', (id, thm))
walther@59921
   164
    	        => Applicable.Yes (Tactic.Calculate' (thy', op_, f, (f', (id, thm))))
walther@59921
   165
    	    | NONE => Applicable.No ("'calculate "^op_^"' not applicable") 
walther@59921
   166
        else Applicable.No msg
walther@59921
   167
      end
walther@59921
   168
    (*Substitute combines two different kind of "substitution":
walther@59921
   169
      (1) subst_atomic: for ?a..?z
walther@59921
   170
      (2) Pattern.match: for solving equational systems (which raises exn for ?a..?z)*)
walther@59921
   171
  | check (m as Tactic.Substitute sube) (pt, (p, p_)) =
walther@59921
   172
      if member op = [Pos.Pbl, Pos.Met] p_ 
walther@59921
   173
      then Applicable.No (Tactic.input_to_string m ^ " not for pos " ^ Pos.pos'2str (p, p_))
walther@59921
   174
      else 
walther@59921
   175
        let
walther@59921
   176
          val pp = Ctree.par_pblobj pt p
walther@59921
   177
          val thy = ThyC.get_theory (Ctree.get_obj Ctree.g_domID pt pp)
walther@59921
   178
          val f = case p_ of
walther@59921
   179
		        Frm => Ctree.get_obj Ctree.g_form pt p
walther@59921
   180
		      | Pos.Res => (fst o (Ctree.get_obj Ctree.g_result pt)) p
walther@59921
   181
      	  | _ => error ("Solve_Step.check: call by " ^ Pos.pos'2str (p, p_));
walther@59921
   182
		      val {rew_ord', erls, ...} = Specify.get_met (Ctree.get_obj Ctree.g_metID pt pp)
walther@59921
   183
		      val subte = Subst.input_to_terms sube
walther@59921
   184
		      val subst = Subst.T_from_string_eqs thy sube
walther@59921
   185
		      val ro = Rewrite_Ord.assoc_rew_ord rew_ord'
walther@59921
   186
		    in
walther@59921
   187
		      if foldl and_ (true, map TermC.contains_Var subte)
walther@59921
   188
		      then (*1*)
walther@59921
   189
		        let val f' = subst_atomic subst f
walther@59921
   190
		        in if f = f'
walther@59921
   191
		          then Applicable.No (Subst.string_eqs_to_string sube ^ " not applicable")
walther@59921
   192
		          else Applicable.Yes (Tactic.Substitute' (ro, erls, subte, f, f'))
walther@59921
   193
		        end
walther@59921
   194
		      else (*2*)
walther@59921
   195
		        case Rewrite.rewrite_terms_ thy ro erls subte f of
walther@59921
   196
		          SOME (f', _) =>  Applicable.Yes (Tactic.Substitute' (ro, erls, subte, f, f'))
walther@59921
   197
		        | NONE => Applicable.No (Subst.string_eqs_to_string sube ^ " not applicable")
walther@59921
   198
		    end
walther@59921
   199
  | check  (Tactic.Apply_Assumption cts') _ =
walther@59921
   200
    raise ERROR ("Solve_Step.check: not impl. for " ^ Tactic.input_to_string (Tactic.Apply_Assumption cts'))
walther@59921
   201
    (* 'logical' applicability wrt. script in locate_input_tactic: Inconsistent? *)
walther@59921
   202
  | check (Tactic.Take_Inst ct') _ =
walther@59921
   203
    raise ERROR ("Solve_Step.check: not impl. for " ^ Tactic.input_to_string (Tactic.Take_Inst ct'))
walther@59921
   204
  | check (m as Tactic.Subproblem (domID, pblID)) (_, (p, p_)) = 
walther@59921
   205
     if Pos.on_specification p_
walther@59921
   206
     then
walther@59921
   207
       Applicable.No (Tactic.input_to_string m ^ " not for pos " ^ Pos.pos'2str (p, p_))
walther@59921
   208
     else (*some fields filled later in LI*)
walther@59921
   209
       Applicable.Yes (Tactic.Subproblem' ((domID, pblID, Method.id_empty), [], 
walther@59921
   210
			   TermC.empty, [], ContextC.empty, Auto_Prog.subpbl domID pblID))
walther@59921
   211
  | check (Tactic.End_Subproblem) _ =
walther@59921
   212
    error ("Solve_Step.check: not impl. for " ^ Tactic.input_to_string Tactic.End_Subproblem)
walther@59921
   213
  | check (Tactic.CAScmd ct') _ =
walther@59921
   214
    error ("Solve_Step.check: not impl. for " ^ Tactic.input_to_string (Tactic.CAScmd ct'))  
walther@59921
   215
  | check (Tactic.Split_And) _ =
walther@59921
   216
    error ("Solve_Step.check: not impl. for " ^ Tactic.input_to_string Tactic.Split_And)
walther@59921
   217
  | check (Tactic.Conclude_And) _ =
walther@59921
   218
    error ("Solve_Step.check: not impl. for " ^ Tactic.input_to_string Tactic.Conclude_And)
walther@59921
   219
  | check (Tactic.Split_Or) _ =
walther@59921
   220
    error ("Solve_Step.check: not impl. for " ^ Tactic.input_to_string Tactic.Split_Or)
walther@59921
   221
  | check (Tactic.Conclude_Or) _ =
walther@59921
   222
    error ("Solve_Step.check: not impl. for " ^ Tactic.input_to_string Tactic.Conclude_Or)
walther@59921
   223
  | check (Tactic.Begin_Trans) (pt, (p, p_)) =
walther@59921
   224
    let
walther@59921
   225
      val (f, _) = case p_ of   (*p 12.4.00 unnecessary, implizit Take in gen*)
walther@59921
   226
        Pos.Frm => (Ctree.get_obj Ctree.g_form pt p, (Pos.lev_on o Pos.lev_dn) p)
walther@59921
   227
      | Pos.Res => ((fst o (Ctree.get_obj Ctree.g_result pt)) p, (Pos.lev_on o Pos.lev_dn o Pos.lev_on) p)
walther@59921
   228
      | _ => error ("Solve_Step.check: call by " ^ Pos.pos'2str (p, p_));
walther@59921
   229
    in (Applicable.Yes (Tactic.Begin_Trans' f))
walther@59921
   230
      handle _ => raise ERROR ("Solve_Step.check: Begin_Trans finds  syntaxerror in '" ^ UnparseC.term f ^ "'")
walther@59921
   231
    end
walther@59921
   232
  | check (Tactic.End_Trans) (pt, (p, p_)) = (*TODO: check parent branches*)
walther@59921
   233
    if p_ = Pos.Res 
walther@59921
   234
	  then Applicable.Yes (Tactic.End_Trans' (Ctree.get_obj Ctree.g_result pt p))
walther@59921
   235
    else Applicable.No "'End_Trans' is not applicable at the beginning of a transitive sequence"
walther@59921
   236
  | check (Tactic.Begin_Sequ) _ =
walther@59921
   237
    error ("Solve_Step.check: not impl. for " ^ Tactic.input_to_string (Tactic.Begin_Sequ))
walther@59921
   238
  | check (Tactic.End_Sequ) _ =
walther@59921
   239
    error ("Solve_Step.check: not impl. for " ^ Tactic.input_to_string (Tactic.End_Sequ))
walther@59921
   240
  | check (Tactic.Split_Intersect) _ =
walther@59921
   241
    error ("Solve_Step.check: not impl. for " ^ Tactic.input_to_string (Tactic.Split_Intersect))
walther@59921
   242
  | check (Tactic.End_Intersect) _ =
walther@59921
   243
    error ("Solve_Step.check: not impl. for " ^ Tactic.input_to_string (Tactic.End_Intersect))
walther@59921
   244
  | check (m as Tactic.Check_elementwise pred) (pt, (p, p_)) =
walther@59921
   245
    if member op = [Pos.Pbl, Pos.Met] p_ 
walther@59921
   246
    then Applicable.No ((Tactic.input_to_string m) ^ " not for pos " ^ Pos.pos'2str (p, p_))
walther@59921
   247
    else
walther@59921
   248
      let 
walther@59921
   249
        val pp = Ctree.par_pblobj pt p; 
walther@59921
   250
        val thy' = Ctree.get_obj Ctree.g_domID pt pp;
walther@59921
   251
        val thy = ThyC.get_theory thy'
walther@59921
   252
        val metID = (Ctree.get_obj Ctree.g_metID pt pp)
walther@59921
   253
        val {crls, ...} =  Specify.get_met metID
walther@59921
   254
        val (f, asm) = case p_ of
walther@59921
   255
          Frm => (Ctree.get_obj Ctree.g_form pt p , [])
walther@59921
   256
        | Pos.Res => Ctree.get_obj Ctree.g_result pt p
walther@59921
   257
        | _ => error ("Solve_Step.check: call by " ^ Pos.pos'2str (p, p_));
walther@59921
   258
        val vp = (ThyC.to_ctxt thy, pred) |-> TermC.parseNEW |> the |> ApplicableOLD.mk_set thy pt p f;
walther@59921
   259
      in
walther@59921
   260
        Applicable.Yes (Tactic.Check_elementwise' (f, pred, (f, asm)))
walther@59921
   261
      end
walther@59921
   262
  | check Tactic.Or_to_List (pt, (p, p_)) =
walther@59921
   263
    if member op = [Pos.Pbl, Pos.Met] p_ 
walther@59921
   264
    then Applicable.No ((Tactic.input_to_string Tactic.Or_to_List)^" not for pos "^(Pos.pos'2str (p,p_)))
walther@59921
   265
    else
walther@59921
   266
      let 
walther@59921
   267
        val f = case p_ of
walther@59921
   268
          Frm => Ctree.get_obj Ctree.g_form pt p
walther@59921
   269
    	  | Pos.Res => (fst o (Ctree.get_obj Ctree.g_result pt)) p
walther@59921
   270
        | _ => error ("Solve_Step.check: call by " ^ Pos.pos'2str (p, p_));
walther@59921
   271
      in (let val ls = Prog_Expr.or2list f
walther@59921
   272
          in Applicable.Yes (Tactic.Or_to_List' (f, ls)) end) 
walther@59921
   273
         handle _ => Applicable.No ("'Or_to_List' not applicable to " ^ UnparseC.term f)
walther@59921
   274
      end
walther@59921
   275
  | check Tactic.Collect_Trues _ =
walther@59921
   276
    error ("Solve_Step.check: not impl. for " ^ Tactic.input_to_string Tactic.Collect_Trues)
walther@59921
   277
  | check Tactic.Empty_Tac _ = Applicable.No "Empty_Tac is not applicable"
walther@59921
   278
  | check (Tactic.Tac id) (pt, (p, p_)) =
walther@59921
   279
    let 
walther@59921
   280
      val pp = Ctree.par_pblobj pt p; 
walther@59921
   281
      val thy' = Ctree.get_obj Ctree.g_domID pt pp;
walther@59921
   282
      val thy = ThyC.get_theory thy';
walther@59921
   283
      val f = case p_ of
walther@59921
   284
         Frm => Ctree.get_obj Ctree.g_form pt p
walther@59921
   285
      | Pos.Pbl => error "Solve_Step.check (p,Pos.Pbl) pt (Tac id): not at Pos.Pbl"
walther@59921
   286
  	  | Pos.Res => (fst o (Ctree.get_obj Ctree.g_result pt)) p
walther@59921
   287
      | _ => error ("Solve_Step.check: call by " ^ Pos.pos'2str (p, p_));
walther@59921
   288
    in case id of
walther@59921
   289
      "subproblem_equation_dummy" =>
walther@59921
   290
  	  if TermC.is_expliceq f
walther@59921
   291
  	  then Applicable.Yes (Tactic.Tac_ (thy, UnparseC.term f, id, "subproblem_equation_dummy (" ^ UnparseC.term f ^ ")"))
walther@59921
   292
  	  else Applicable.No "applicable only to equations made explicit"
walther@59921
   293
    | "solve_equation_dummy" =>
walther@59921
   294
  	  let val (id', f') = ApplicableOLD.split_dummy (UnparseC.term f);
walther@59921
   295
  	  in
walther@59921
   296
  	    if id' <> "subproblem_equation_dummy"
walther@59921
   297
  	    then Applicable.No "no subproblem"
walther@59921
   298
  	    else if (ThyC.to_ctxt thy, f') |-> TermC.parseNEW |> the |> TermC.is_expliceq
walther@59921
   299
  		    then Applicable.Yes (Tactic.Tac_ (thy, UnparseC.term f, id, "[" ^ f' ^ "]"))
walther@59921
   300
  		    else error ("Solve_Step.check: f= " ^ f')
walther@59921
   301
      end
walther@59921
   302
    | _ => Applicable.Yes (Tactic.Tac_ (thy, UnparseC.term f, id, UnparseC.term f))
walther@59921
   303
    end
walther@59921
   304
  | check Tactic.End_Proof' _ = Applicable.Yes Tactic.End_Proof''
walther@59921
   305
  | check m _ = raise ERROR ("Solve_Step.check called for " ^ Tactic.input_to_string m);
walther@59920
   306
(*-----^^^^^- solve ---------------------------------------------------------------------------*)
walther@59920
   307
walther@59920
   308
walther@59920
   309
walther@59920
   310
(**)end(**);