src/Tools/isac/Specify/step-specify.sml
author wneuper <walther.neuper@jku.at>
Thu, 29 Apr 2021 12:43:50 +0200
changeset 60268 637f20154de6
parent 60223 740ebee5948b
child 60469 89e1d8a633bb
permissions -rw-r--r--
eliminate warnings from src/*, part 2
walther@59747
     1
(* Title:  Specify/step-specify.sml
walther@59747
     2
   Author: Walther Neuper 2019
walther@59747
     3
   (c) due to copyright terms
walther@59747
     4
*)
walther@59747
     5
walther@59747
     6
signature STEP_SPECIFY =
walther@59747
     7
sig
walther@59791
     8
(*val do_next: Step.specify_do_next requires LI.by_tactic, which is not yet known in Step_Specify*)
walther@60020
     9
  val by_tactic_input: Tactic.input -> Calc.T -> string * Calc.state_post
walther@59981
    10
  val by_tactic: Tactic.T -> Calc.T -> string * Calc.state_post
walther@59975
    11
walther@60150
    12
  val initialisePIDEHACK: theory -> Formalise.T ->
walther@60150
    13
    term * term * References.T * O_Model.T * Proof.context
walther@60113
    14
  val initialisePIDE: Formalise.T ->
walther@60114
    15
    term * term * References.T * O_Model.T * Proof.context
walther@59946
    16
  val nxt_specify_init_calc: Formalise.T -> Calc.T * State_Steps.T
walther@59747
    17
end
walther@59747
    18
walther@59747
    19
(**)
walther@59747
    20
structure Step_Specify(**): STEP_SPECIFY(**) =
walther@59747
    21
struct
walther@59747
    22
(**)
walther@59763
    23
open Pos
walther@59763
    24
open Ctree
walther@59977
    25
open Specification
walther@59747
    26
walther@59806
    27
fun by_tactic_input (tac as Tactic.Model_Problem) (pt, pos as (p, _)) =
walther@59763
    28
    let
walther@59763
    29
      val (oris, ospec, probl, spec, ctxt) = case get_obj I pt p of
walther@59763
    30
        PblObj {origin = (oris, ospec, _), probl, spec, ctxt, ...} => (oris, ospec, probl, spec, ctxt)
walther@59962
    31
      | _ => raise ERROR "by_tactic_input Model_Problem; uncovered case get_obj"
walther@59995
    32
      val (_, pI, mI) = References.select ospec spec
walther@60154
    33
      val mpc = (#ppc o MethodC.from_store) mI (* just for reuse I_Model.complete_method *)
walther@59970
    34
      val {cas, ppc, ...} = Problem.from_store pI
walther@59958
    35
      val pbl = I_Model.init ppc (* fill in descriptions *)
walther@59763
    36
      (*----------------if you think, this should be done by the Dialog 
walther@59763
    37
       in the java front-end, search there for WN060225-modelProblem----*)
walther@59763
    38
      val (pbl, met) = case cas of
walther@59763
    39
        NONE => (pbl, [])
walther@59988
    40
  		| _ => I_Model.complete_method (oris, mpc, ppc, probl)
walther@59763
    41
      (*----------------------------------------------------------------*)
walther@59763
    42
      val tac_ = Tactic.Model_Problem' (pI, pbl, met)
walther@59933
    43
      val (pos,c,_,pt) = Specify_Step.add tac_ (Istate_Def.Uistate, ctxt) (pt, pos)
walther@60020
    44
    in
walther@60020
    45
      ("ok",([(tac, tac_, (pos, (Istate_Def.Uistate, ContextC.empty)))], c, (pt,pos)))
walther@60020
    46
    end
walther@60021
    47
  | by_tactic_input (Tactic.Add_Given ct) ptp = Specify.by_Add_ "#Given" ct ptp
walther@60021
    48
  | by_tactic_input (Tactic.Add_Find  ct) ptp = Specify.by_Add_ "#Find"  ct ptp
walther@60021
    49
  | by_tactic_input (Tactic.Add_Relation ct) ptp = Specify.by_Add_"#Relate" ct ptp
walther@60021
    50
walther@60154
    51
    (* called with MethodC.id_empty *)     
walther@59810
    52
  | by_tactic_input (Tactic.Refine_Tacitly pI) (ptp as (pt, pos as (p, _))) =
walther@59763
    53
    let 
walther@59763
    54
      val (oris, dI, ctxt) = case get_obj I pt p of
walther@59763
    55
        (PblObj {origin = (oris, (dI, _, _), _), ctxt, ...}) => (oris, dI, ctxt)
walther@59962
    56
      | _ => raise ERROR "by_tactic_input Refine_Tacitly: uncovered case get_obj"
walther@59968
    57
      val opt = Refine.refine_ori oris pI
walther@59763
    58
    in 
walther@59763
    59
      case opt of
walther@59763
    60
	      SOME pI' => 
walther@59763
    61
	        let 
walther@59970
    62
            val {met, ...} = Problem.from_store pI'
walther@59763
    63
	          (*val pt = update_pbl pt p pbl ..done by Model_Problem*)
walther@60154
    64
	          val mI = if length met = 0 then MethodC.id_empty else hd met
walther@59763
    65
	          val (pos, c, _, pt) = 
walther@59933
    66
		          Specify_Step.add (Tactic.Refine_Tacitly' (pI, pI', dI, mI,(*pbl*)[])) (Istate_Def.Uistate, ctxt) (pt, pos)
walther@59763
    67
	        in
walther@60020
    68
	          ("ok", ([(Tactic.Refine_Tacitly pI, Tactic.Refine_Tacitly' (pI,pI',dI,mI,(*pbl*)[]),
walther@60020
    69
	              (pos, (Istate_Def.Uistate, ContextC.empty)))], c, (pt,pos)))
walther@59763
    70
          end
walther@60021
    71
	    | NONE => ("failure", ([], [], ptp))
walther@59763
    72
    end
walther@59806
    73
  | by_tactic_input (Tactic.Refine_Problem pI) (ptp as (pt, pos as (p,_))) =
walther@59763
    74
    let
walther@59763
    75
      val (dI, dI', probl, ctxt) = case get_obj I pt p of
walther@59763
    76
        PblObj {origin= (_, (dI, _, _), _), spec = (dI', _, _), probl, ctxt, ...} =>
walther@59763
    77
          (dI, dI', probl, ctxt)
walther@59962
    78
      | _ => raise ERROR "by_tactic_input Refine_Problem: uncovered case get_obj"
walther@59879
    79
	    val thy = if dI' = ThyC.id_empty then dI else dI'
walther@59763
    80
    in 
walther@59960
    81
      case Refine.problem (ThyC.get_theory thy) pI probl of
walther@60021
    82
	      NONE => ("failure", ([], [], ptp))
walther@59763
    83
	    | SOME rfd => 
walther@59763
    84
	      let 
walther@59933
    85
          val (pos,c,_,pt) = Specify_Step.add (Tactic.Refine_Problem' rfd) (Istate_Def.Uistate, ctxt) (pt, pos)
walther@59763
    86
	      in
walther@60020
    87
	        ("ok", ([(Tactic.Refine_Problem pI, Tactic.Refine_Problem' rfd,
walther@60020
    88
            (pos, (Istate_Def.Uistate, ContextC.empty)))], c, (pt,pos)))
walther@59763
    89
        end
walther@59763
    90
    end
walther@60020
    91
  | by_tactic_input (Tactic.Specify_Problem pI) (pt, pos as (p, _)) =
walther@59763
    92
    let
walther@59763
    93
      val (oris, dI, dI', pI', probl, ctxt) = case get_obj I pt p of
walther@59763
    94
        PblObj {origin = (oris, (dI,_,_),_), spec = (dI',pI',_), probl, ctxt, ...} =>
walther@59763
    95
          (oris, dI, dI', pI', probl, ctxt)
walther@59962
    96
      | _ => raise ERROR ""
walther@59881
    97
	    val thy = ThyC.get_theory (if dI' = ThyC.id_empty then dI else dI');
walther@59970
    98
      val {ppc,where_,prls,...} = Problem.from_store pI
walther@59763
    99
	    val pbl = 
walther@59903
   100
	      if pI' = Problem.id_empty andalso pI = Problem.id_empty
walther@59958
   101
	      then (false, (I_Model.init ppc, []))
walther@59984
   102
	      else M_Match.match_itms_oris thy probl (ppc,where_,prls) oris
walther@59763
   103
	      (*FIXXXME~~~~~~~~~~~~~~~: take pbl and compare with new pI WN.8.03*)
walther@59810
   104
	    val (c, pt) =
walther@59933
   105
	      case Specify_Step.add (Tactic.Specify_Problem' (pI, pbl)) (Istate_Def.Uistate, ctxt) (pt, pos) of
walther@59810
   106
  	      ((_, Pbl), c, _, pt) => (c, pt)
walther@59962
   107
  	    | _ => raise ERROR ""
walther@59763
   108
    in
walther@60020
   109
      ("ok", ([(Tactic.Specify_Problem pI, Tactic.Specify_Problem' (pI, pbl),
walther@60020
   110
        (pos, (Istate_Def.Uistate, ContextC.empty)))], c, (pt, pos)))
walther@59763
   111
    end
walther@60014
   112
  | by_tactic_input (Tactic.Specify_Method id) (pt, pos) =
walther@59763
   113
    let
walther@60014
   114
      val (o_model, ctxt, i_model) = Specify_Step.complete_for id (pt, pos)
walther@60014
   115
      val (pos, _, _, pt) = Specify_Step.add (Tactic.Specify_Method' (id, o_model, i_model))
walther@60014
   116
        (Istate_Def.Uistate, ctxt) (pt, pos)
walther@60011
   117
    in
walther@60020
   118
      ("ok", ([(Tactic.Specify_Method id, Tactic.Specify_Method' (id, o_model, i_model),
walther@60020
   119
        (pos, (Istate_Def.Uistate, ContextC.empty)))], [], (pt, pos)))
walther@59763
   120
    end    
walther@59806
   121
  | by_tactic_input (Tactic.Specify_Theory dI) (pt, pos as (_, Pbl)) =
walther@59763
   122
    let
walther@59763
   123
      val ctxt = get_ctxt pt pos
walther@60014
   124
	    val (pos, c, _, pt) =            
walther@59933
   125
	      Specify_Step.add (Tactic.Specify_Theory' dI)  (Istate_Def.Uistate, ctxt) (pt, pos)
walther@59763
   126
    in (*FIXXXME: check if pbl can still be parsed*)
walther@60020
   127
	    ("ok", ([(Tactic.Specify_Theory dI, Tactic.Specify_Theory' dI,
walther@60020
   128
        (pos, (Istate_Def.Uistate, ctxt)))], c, (pt, pos)))
walther@59763
   129
    end
walther@59806
   130
  | by_tactic_input (Tactic.Specify_Theory dI) (pt, pos as (_, Met)) =
walther@59763
   131
    let
walther@59763
   132
      val ctxt = get_ctxt pt pos
walther@59933
   133
	    val (pos, c, _, pt) = Specify_Step.add (Tactic.Specify_Theory' dI) (Istate_Def.Uistate, ctxt) (pt, pos)
walther@59763
   134
    in  (*FIXXXME: check if met can still be parsed*)
walther@60020
   135
	    ("ok", ([(Tactic.Specify_Theory dI, Tactic.Specify_Theory' dI,
walther@60020
   136
        (pos, (Istate_Def.Uistate, ctxt)))], c, (pt, pos)))
walther@59763
   137
    end
walther@59962
   138
  | by_tactic_input m' _ = raise ERROR ("by_tactic_input: not impl. for " ^ Tactic.input_to_string m')
walther@60020
   139
(**)
walther@60020
   140
walther@59806
   141
walther@60015
   142
fun by_tactic (Tactic.Model_Problem' (id, pbl, met)) (pt, pos)  =
walther@59806
   143
    let 
walther@60015
   144
      val ((p, _), _, _, pt) = Specify_Step.add (Tactic.Model_Problem'(id, pbl, met))
walther@60015
   145
        (Istate_Def.Uistate, ContextC.empty) (pt, pos)
walther@60015
   146
(* deprecated^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ *)
walther@59806
   147
    in
walther@59806
   148
      ("ok", ([], [], (pt, (p, Pbl))))
walther@59806
   149
    end
walther@59806
   150
    (* called only if no_met is specified *)     
walther@59806
   151
  | by_tactic (Tactic.Refine_Tacitly' (pI, pIre, _, _, _)) (pt, pos) =
walther@59806
   152
      let
walther@59970
   153
        val {met, thy,...} = Problem.from_store pIre
walther@60154
   154
        val (domID, metID) = (Context.theory_name thy, if length met = 0 then MethodC.id_empty else hd met)
walther@59806
   155
        val ((p,_), _, _, pt) = 
walther@59933
   156
	        Specify_Step.add (Tactic.Refine_Tacitly' (pI, pIre, domID, metID, [(*pbl*)]))
walther@59846
   157
            (Istate_Def.Uistate, ContextC.empty) (pt, pos)
walther@59806
   158
(* deprecated^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ *)
walther@59806
   159
      in 
walther@59806
   160
        ("ok", ([], [], (pt,(p, Pbl))))
walther@59806
   161
      end
walther@60021
   162
  | by_tactic (Tactic.Refine_Problem' (rfd as (id, _))) (pt, pos)  =
walther@59806
   163
      let
walther@59806
   164
        val ctxt = get_ctxt pt pos
walther@59806
   165
        val (pos, _, _, pt) =
walther@59933
   166
          Specify_Step.add (Tactic.Refine_Problem' rfd) (Istate_Def.Uistate, ctxt) (pt, pos)
walther@59806
   167
      in
walther@60021
   168
        ("ok", ([(Tactic.Refine_Problem id, Tactic.Refine_Problem' rfd,
walther@60021
   169
            (pos, (Istate_Def.Uistate,ctxt)))], [], (pt, pos)))
walther@59806
   170
      end
walther@59810
   171
  | by_tactic (Tactic.Specify_Problem' (pI, (ok, (itms, pre)))) (pt, pos as (p, _)) =
walther@59806
   172
      let
walther@59995
   173
        val (_, _, _, _, _, _, ctxt, _) = case get_obj I pt p of
walther@59806
   174
          PblObj {origin= (oris, (dI', pI', mI'), _), spec= (dI, _, mI), ctxt, meth = met, ...} =>
walther@59806
   175
            (oris, dI', pI', mI', dI, mI, ctxt, met)
walther@59962
   176
        | _ => raise ERROR "Step_Solve.by_tactic (Specify_Problem': uncovered case get_obj"
walther@59806
   177
        val (p, pt) =
walther@59933
   178
          case  Specify_Step.add (Tactic.Specify_Problem' (pI, (ok, (itms, pre)))) (Istate_Def.Uistate, ctxt) (pt, pos) of
walther@59806
   179
            ((p, Pbl), _, _, pt) => (p, pt)
walther@59962
   180
          | _ => raise ERROR "Step_Solve.by_tactic (Specify_Problem': uncovered case generate1 (WARNING WHY ?)"
walther@59806
   181
      in
walther@59806
   182
        ("ok", ([], [], (pt, (p, Pbl))))
walther@59806
   183
      end    
walther@60014
   184
  | by_tactic (Tactic.Specify_Method' (id, _, _)) (pt, pos) =
walther@59806
   185
      let
walther@60014
   186
        val (o_model, ctxt, i_model) = Specify_Step.complete_for id (pt, pos)
walther@60014
   187
        val (pos, _, _, pt) = Specify_Step.add (Tactic.Specify_Method' (id, o_model, i_model))
walther@60014
   188
          (Istate_Def.Uistate, ctxt) (pt, pos)
walther@60011
   189
      in
walther@59806
   190
        ("ok", ([], [], (pt, pos)))
walther@60014
   191
      end
walther@60016
   192
  | by_tactic (Tactic.Add_Given' (ct, _)) (pt, p)  = Specify.by_Add_ "#Given" ct (pt, p)
walther@60016
   193
  | by_tactic (Tactic.Add_Find'  (ct, _)) (pt, p) = Specify.by_Add_ "#Find" ct (pt, p)
walther@60016
   194
  | by_tactic (Tactic.Add_Relation' (ct, _)) (pt, p) = Specify.by_Add_"#Relate" ct (pt, p)
walther@60020
   195
    (*strange old code, redes*)
walther@60015
   196
  | by_tactic (Tactic.Specify_Theory' domID) (pt, (p, p_)) =
walther@59806
   197
      let
walther@59806
   198
        val p_ = case p_ of Met => Met | _ => Pbl
walther@60015
   199
        val {spec = (dI, _, _), ctxt, ...} = Calc.specify_data (pt, (p, p_))
walther@59806
   200
      in
walther@60015
   201
        if domID = dI then
walther@60015
   202
          ("ok", ([], [], (pt, (p, p_))))
walther@59806
   203
        else (*FIXME: check ppc wrt. (new!) domID ..? still parsable?*)
walther@59806
   204
	        let 
walther@60015
   205
	          val ((p, p_), _, _, pt) = Specify_Step.add (Tactic.Specify_Theory' domID)
walther@60015
   206
	            (Istate_Def.Uistate, ctxt) (pt, (p, p_))
walther@59806
   207
	        in
walther@59806
   208
            ("ok", ([], [], (pt, (p, p_))))
walther@59990
   209
          end                
walther@59806
   210
      end
walther@59806
   211
  | by_tactic _ _ = raise ERROR "Step_Specify.by_tactic uncovered pattern in fun.def"
walther@59806
   212
walther@60268
   213
fun initialisePIDEHACK HACKthy (fmz, (_, pI, mI)) = 
walther@60150
   214
    let
walther@60150
   215
(**)  val thy = HACKthy(**)
walther@60150
   216
(** )  val thy = ThyC.get_theory dI( **)
walther@60150
   217
	    val (pI, (pors, pctxt), mI) = 
walther@60150
   218
	      if mI = ["no_met"] 
walther@60150
   219
	      then 
walther@60150
   220
          let 
walther@60150
   221
            val pors = Problem.from_store pI |> #ppc |> O_Model.init fmz thy; (*..TermC.parseNEW'*)
walther@60150
   222
            val pctxt = ContextC.initialise' thy fmz;                (*..DUPLICATE ermC.parseNEW'*)
walther@60150
   223
		        val pI' = Refine.refine_ori' pors pI;
walther@60150
   224
		      in (pI', (pors (*refinement over models with diff.precond only*), pctxt),
walther@60150
   225
		        (hd o #met o Problem.from_store) pI')
walther@60150
   226
		      end
walther@60150
   227
	      else
walther@60150
   228
	        let
walther@60150
   229
	          val pors = Problem.from_store pI |> #ppc |> O_Model.init fmz thy; (*..TermC.parseNEW'*)
walther@60150
   230
            val pctxt = ContextC.initialise' thy fmz;                (*..DUPLICATE ermC.parseNEW'*)
walther@60150
   231
	        in (pI, (pors, pctxt), mI) end;
walther@60150
   232
	    val {cas, ppc, thy = thy', ...} = Problem.from_store pI (*take dI from _refined_ pbl*)
walther@60150
   233
	    val dI = Context.theory_name (ThyC.sub_common (thy, thy'))
walther@60150
   234
	    val hdl = case cas of
walther@60150
   235
		    NONE => Auto_Prog.pblterm dI pI
walther@60150
   236
		  | SOME t => subst_atomic ((Model_Pattern.variables ppc) ~~~ O_Model.values pors) t
walther@60150
   237
	    val hdlPIDE = case cas of
walther@60150
   238
		    NONE => Auto_Prog.pbltermPIDE dI pI
walther@60150
   239
		  | SOME t => subst_atomic ((Model_Pattern.variables ppc) ~~~ O_Model.values pors) t
walther@60150
   240
    in
walther@60150
   241
      (hdlPIDE, hdl, (dI, pI, mI), pors, pctxt)
walther@60150
   242
    end;
walther@59806
   243
(* create a calc-tree with oris via an cas.refined pbl *)
walther@60111
   244
(*  initialisePI <- nxt_specify_init_calc *)
walther@60111
   245
fun initialisePIDE (fmz, (dI, pI, mI)) = 
walther@60111
   246
    let
walther@60111
   247
	    val thy = ThyC.get_theory dI
walther@60111
   248
	    val (pI, (pors, pctxt), mI) = 
walther@60111
   249
	      if mI = ["no_met"] 
walther@60111
   250
	      then 
walther@60111
   251
          let 
walther@60112
   252
            val pors = Problem.from_store pI |> #ppc |> O_Model.init fmz thy; (*..TermC.parseNEW'*)
walther@60112
   253
            val pctxt = ContextC.initialise' thy fmz;                (*..DUPLICATE ermC.parseNEW'*)
walther@60111
   254
		        val pI' = Refine.refine_ori' pors pI;
walther@60111
   255
		      in (pI', (pors (*refinement over models with diff.precond only*), pctxt),
walther@60111
   256
		        (hd o #met o Problem.from_store) pI')
walther@60111
   257
		      end
walther@60111
   258
	      else
walther@60111
   259
	        let
walther@60112
   260
	          val pors = Problem.from_store pI |> #ppc |> O_Model.init fmz thy; (*..TermC.parseNEW'*)
walther@60112
   261
            val pctxt = ContextC.initialise' thy fmz;                (*..DUPLICATE ermC.parseNEW'*)
walther@60111
   262
	        in (pI, (pors, pctxt), mI) end;
walther@60111
   263
	    val {cas, ppc, thy = thy', ...} = Problem.from_store pI (*take dI from _refined_ pbl*)
walther@60111
   264
	    val dI = Context.theory_name (ThyC.sub_common (thy, thy'))
walther@60111
   265
	    val hdl = case cas of
walther@60111
   266
		    NONE => Auto_Prog.pblterm dI pI
walther@60111
   267
		  | SOME t => subst_atomic ((Model_Pattern.variables ppc) ~~~ O_Model.values pors) t
walther@60113
   268
	    val hdlPIDE = case cas of
walther@60113
   269
		    NONE => Auto_Prog.pbltermPIDE dI pI
walther@60113
   270
		  | SOME t => subst_atomic ((Model_Pattern.variables ppc) ~~~ O_Model.values pors) t
walther@60111
   271
    in
walther@60114
   272
      (hdlPIDE, hdl, (dI, pI, mI), pors, pctxt)
walther@60111
   273
    end;
walther@60111
   274
(*  nxt_specify_init_calc \<rightarrow> initialise *)
walther@60111
   275
fun nxt_specify_init_calc ([], (dI, pI, mI)) = (*this will probably be dropped with PIDE*)
walther@59806
   276
    if pI <> [] 
walther@59806
   277
    then (* from pbl-browser or from CAS cmd with pI=[e_pblID] *)
walther@59806
   278
	    let 
walther@59970
   279
        val {cas, met, ppc, thy, ...} = Problem.from_store pI
walther@59880
   280
	      val dI = if dI = "" then Context.theory_name thy else dI
walther@59806
   281
	      val mI = if mI = [] then hd met else mI
walther@59806
   282
	      val hdl = case cas of NONE => Auto_Prog.pblterm dI pI | SOME t => t
walther@59952
   283
	      val (pt, _) = cappend_problem e_ctree [] (Istate_Def.Uistate, ContextC.empty) ([], (dI, pI, mI))
walther@59846
   284
				  ([], (dI,pI,mI), hdl, ContextC.empty)
walther@59806
   285
	      val pt = update_spec pt [] (dI, pI, mI)
walther@59958
   286
	      val pits = I_Model.init ppc
walther@59806
   287
	      val pt = update_pbl pt [] pits
walther@59806
   288
	    in ((pt, ([] , Pbl)), []) end
walther@59806
   289
    else 
walther@59806
   290
      if mI <> [] 
walther@59806
   291
      then (* from met-browser *)
walther@59806
   292
	      let 
walther@60154
   293
          val {ppc, ...} = MethodC.from_store mI
walther@59806
   294
	        val dI = if dI = "" then "Isac_Knowledge" else dI
walther@59846
   295
	        val (pt, _) = cappend_problem e_ctree [] (Istate_Def.empty, ContextC.empty)
walther@59861
   296
	          ([], (dI, pI, mI)) ([], (dI, pI, mI), TermC.empty, ContextC.empty)
walther@59806
   297
	        val pt = update_spec pt [] (dI, pI, mI)
walther@59958
   298
	        val mits = I_Model.init ppc
walther@59806
   299
	        val pt = update_met pt [] mits
walther@59806
   300
	      in ((pt, ([], Met)), []) end
walther@59806
   301
      else (* new example, pepare for interactive modeling *)
walther@59806
   302
	      let
walther@59846
   303
	        val (pt, _) = cappend_problem e_ctree [] (Istate_Def.empty, ContextC.empty) 
walther@59976
   304
	          ([], References.empty) ([], References.empty, TermC.empty, ContextC.empty)
walther@59806
   305
	      in ((pt, ([], Pbl)), []) end
walther@59806
   306
  | nxt_specify_init_calc (fmz, (dI, pI, mI)) = 
walther@60111
   307
    let            (* both ^^^  ^^^^^^^^^^^^  are either empty or complete *)
walther@60114
   308
	    val (_, hdl, (dI, pI, mI), pors, pctxt) = initialisePIDE (fmz, (dI, pI, mI))
walther@59846
   309
      val (pt, _) = cappend_problem e_ctree [] (Istate_Def.empty, pctxt)
walther@59819
   310
        (fmz, (dI, pI, mI)) (pors, (dI, pI, mI), hdl, pctxt)
walther@59806
   311
    in
walther@60020
   312
      ((pt, ([], Pbl)), (fst3 o snd) (by_tactic_input Tactic.Model_Problem (pt, ([], Pbl))))
walther@59806
   313
    end
walther@59763
   314
walther@59763
   315
(**)end(**)