isac-java/src/java/isac/bridge/xml/JavaToIsa.scala
author Walther Neuper <walther.neuper@jku.at>
Fri, 26 Mar 2021 10:45:05 +0100
changeset 5239 b4e3883d7b66
parent 5229 6bf0e95981e3
permissions -rw-r--r--
reset mathematics-engine to Isabelle2015

note: for this version libisabelle was available,
which connects front-end (Java) and back-end (Isabelle/ML)
wneuper@4723
     1
/* 
wneuper@4723
     2
 * @author Walther Neuper
wneuper@4723
     3
 * Copyright (c) due to license terms
wneuper@4723
     4
 * Created on Jul 14, 2015
wneuper@4723
     5
 * Institute for Softwaretechnology, Graz University of Technology, Austria.
wneuper@4723
     6
 */
wneuper@4723
     7
wneuper@4723
     8
package isac.bridge.xml
wneuper@4723
     9
wneuper@4725
    10
import isac.bridge.CChanged
wneuper@4767
    11
import isac.util.formulae.CalcFormula
wneuper@4770
    12
import isac.util.formulae.CalcHead
wneuper@4768
    13
import isac.util.formulae.Formula
wneuper@4723
    14
import isac.util.formulae.Position
wneuper@4725
    15
import isac.util.formulae.Specification
wneuper@4773
    16
import isac.util.tactics.Tactic
wneuper@4725
    17
import isac.util.Variant
wneuper@4725
    18
import isac.util.Formalization
wneuper@4770
    19
import isac.wsdialog.IContextProvider.ContextType;
wneuper@4723
    20
walther@5239
    21
import edu.tum.cs.isabelle.api.XML
wneuper@4725
    22
wneuper@4723
    23
import java.util.ArrayList
wneuper@4723
    24
import java.util.Vector
wneuper@4723
    25
import java.math.BigInteger
wneuper@4723
    26
import scala.math.BigInt
wneuper@4723
    27
import scala.collection.JavaConverters._
wneuper@4725
    28
import scala.collection.JavaConversions._
wneuper@4723
    29
wneuper@4760
    30
/**
wneuper@4760
    31
 * Convert arguments of JSystem.invoke(Operations.* to XML;
wneuper@4760
    32
 * Conversions use Scala's pattern matching, which is not available in Java.
wneuper@4760
    33
 * The sequence in the kernel's signature below is maintained.
wneuper@4760
    34
 */
wneuper@4723
    35
object JavaToIsa {
wneuper@4723
    36
wneuper@4760
    37
/* from isabisac/src/Tools/Frontend/interface.sml
wneuper@4760
    38
signature MATH_ENGINE =
wneuper@4760
    39
  sig
wneuper@4760
    40
    val appendFormula : calcID -> cterm' -> XML.tree
wneuper@4760
    41
    val autoCalculate : calcID -> auto -> XML.tree
wneuper@4760
    42
    val applyTactic : calcID -> pos' -> tac -> XML.tree
wneuper@4760
    43
    val CalcTree : fmz list -> XML.tree
wneuper@4760
    44
    val checkContext : calcID -> pos' -> guh -> XML.tree
wneuper@4760
    45
    val DEconstrCalcTree : calcID -> XML.tree
wneuper@4760
    46
    val fetchApplicableTactics : calcID -> int -> pos' -> XML.tree
wneuper@4760
    47
    val fetchProposedTactic : calcID -> XML.tree
wneuper@4760
    48
    val findFillpatterns : calcID -> errpatID -> XML.tree
wneuper@4760
    49
    val getAccumulatedAsms : calcID -> pos' -> XML.tree
wneuper@4760
    50
    val getActiveFormula : calcID -> XML.tree
wneuper@4760
    51
    val getAssumptions : calcID -> pos' -> XML.tree
wneuper@4760
    52
    val getFormulaeFromTo : calcID -> pos' -> pos' -> int -> bool -> XML.tree
wneuper@4760
    53
    val getTactic : calcID -> pos' -> XML.tree
wneuper@4760
    54
    val initContext : calcID -> ketype -> pos' -> XML.tree
wneuper@4760
    55
    val inputFillFormula: calcID -> string -> XML.tree
wneuper@4760
    56
    val interSteps : calcID -> pos' -> XML.tree
wneuper@4760
    57
    val Iterator : calcID -> XML.tree
wneuper@4760
    58
    val IteratorTEST : calcID -> iterID
wneuper@4760
    59
    val modelProblem : calcID -> XML.tree
wneuper@4760
    60
    val modifyCalcHead : calcID -> icalhd -> XML.tree
wneuper@4760
    61
    val moveActiveCalcHead : calcID -> XML.tree
wneuper@4760
    62
    val moveActiveDown : calcID -> XML.tree
wneuper@4760
    63
    val moveActiveFormula : calcID -> pos' -> XML.tree
wneuper@4760
    64
    val moveActiveLevelDown : calcID -> XML.tree
wneuper@4760
    65
    val moveActiveLevelUp : calcID -> XML.tree
wneuper@4760
    66
    val moveActiveRoot : calcID -> XML.tree
wneuper@4760
    67
    val moveActiveRootTEST : calcID -> XML.tree
wneuper@4760
    68
    val moveActiveUp : calcID -> XML.tree
wneuper@4760
    69
    val moveCalcHead : calcID -> pos' -> XML.tree
wneuper@4760
    70
    val moveDown : calcID -> pos' -> XML.tree
wneuper@4760
    71
    val moveLevelDown : calcID -> pos' -> XML.tree
wneuper@4760
    72
    val moveLevelUp : calcID -> pos' -> XML.tree
wneuper@4760
    73
    val moveRoot : calcID -> XML.tree
wneuper@4760
    74
    val moveUp : calcID -> pos' -> XML.tree
wneuper@4760
    75
    val refFormula : calcID -> pos' -> XML.tree
wneuper@4760
    76
    val refineProblem : calcID -> pos' -> guh -> XML.tree
wneuper@4760
    77
    val replaceFormula : calcID -> cterm' -> XML.tree
wneuper@4760
    78
    val requestFillformula : calcID -> errpatID * fillpatID -> XML.tree
wneuper@4760
    79
    val resetCalcHead : calcID -> XML.tree
wneuper@4760
    80
    val setContext : calcID -> pos' -> guh -> XML.tree
wneuper@4760
    81
    val setMethod : calcID -> metID -> XML.tree
wneuper@4760
    82
    val setNextTactic : calcID -> tac -> XML.tree
wneuper@4760
    83
    val setProblem : calcID -> pblID -> XML.tree
wneuper@4760
    84
    val setTheory : calcID -> thyID -> XML.tree
wneuper@4760
    85
  end
wneuper@4760
    86
*/
wneuper@4760
    87
  
wneuper@4760
    88
  //fun appendFormula : calcID -> cterm' -> XML.tree
wneuper@4787
    89
  def append_form(calcid: scala.math.BigInt, form: Formula): XML.Tree =
wneuper@4848
    90
  { XML.Elem(("APPENDFORMULA", Nil), List(
wneuper@4848
    91
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString()))),
wneuper@4928
    92
      DataTypes.xml_of_Formula_NEW(form)))
wneuper@4767
    93
  }
wneuper@4723
    94
wneuper@4760
    95
  //fun autoCalculate : calcID -> auto -> XML.tree
wneuper@4753
    96
  def auto_calculate(calcid: scala.math.BigInt, scope: String, steps: scala.math.BigInt): XML.Tree =
wneuper@4753
    97
  { //ATTENTION the "if" below is according to "fun xml_to_auto" in datatypes.sml, 
wneuper@4753
    98
    //but NOT according to "if/else if" in BridgeRMI#autoCalculate for "isabelle tty".
wneuper@4753
    99
    if (steps == 0)
wneuper@4848
   100
      XML.Elem(("AUTOCALC", Nil), List(
wneuper@4848
   101
        XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString()))),
wneuper@4848
   102
        XML.Elem(("AUTO", Nil), List(XML.Text(scope)))))
wneuper@4753
   103
    else
wneuper@4753
   104
      //dataypes.sml:
wneuper@4753
   105
      //xml_to_auto (XML.Elem (("AUTO", []), [XML.Text "Step", XML.Text i])) = Step (int_of_str i |>the)
wneuper@4848
   106
      XML.Elem(("AUTOCALC", Nil), List(
wneuper@4848
   107
        XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString()))),
wneuper@4848
   108
        XML.Elem(("AUTO", Nil), List(
wneuper@4848
   109
          XML.Elem(("STEP", Nil), List(XML.Text(steps.toString()))) )) ))
wneuper@4723
   110
  }
wneuper@4760
   111
  
wneuper@4773
   112
  //fun applyTactic : calcID -> pos' -> tac -> XML.tree  ...NOT IMPL. IN isac-java WN150813
wneuper@4773
   113
  //fun CalcTree : fmz list -> XML.tree                  ...uses only DataTypes..fmz..
wneuper@4769
   114
wneuper@4760
   115
  //fun checkContext : calcID -> pos' -> guh -> XML.tree
wneuper@4769
   116
  def   check_ctxt(calcid: scala.math.BigInt, from: Position, kestore_key: String): XML.Tree =
wneuper@4848
   117
  { XML.Elem(("CONTEXTTHY", Nil), List(
wneuper@4848
   118
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString()))),
wneuper@4769
   119
      DataTypes.xml_of_Position(from),
wneuper@4848
   120
      XML.Elem(("GUH", Nil), List(XML.Text(kestore_key)))))
wneuper@4769
   121
  } 
wneuper@4769
   122
  
wneuper@4773
   123
  //fun DEconstrCalcTree : calcID -> XML.tree    ...no further ado: scala.math.BigInt
wneuper@4769
   124
wneuper@4769
   125
  //fun fetchApplicableTactics : calcID -> int -> pos' -> XML.tree
wneuper@4769
   126
  def   fetch_applicable_tacs(calcid: scala.math.BigInt, scope: scala.math.BigInt, pos: Position): XML.Tree =
wneuper@4848
   127
  { XML.Elem(("APPLICABLETACTICS", Nil), List(
wneuper@4848
   128
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString()))),
wneuper@4848
   129
      XML.Elem(("INT", Nil), List(XML.Text(scope.toString()))),
wneuper@4769
   130
      DataTypes.xml_of_Position(pos)))
wneuper@4769
   131
  } 
wneuper@4767
   132
  
wneuper@4770
   133
  //fun fetchProposedTactic : calcID -> XML.tree
wneuper@4770
   134
  def   fetch_proposed_tac(calcid: scala.math.BigInt): XML.Tree =
wneuper@4848
   135
  { XML.Elem(("NEXTTAC", Nil), List(
wneuper@4848
   136
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString())))))
wneuper@4770
   137
  } 
wneuper@4769
   138
wneuper@4773
   139
  //fun findFillpatterns : calcID -> errpatID -> XML.tree  
wneuper@4773
   140
  //... only implemented in Math_Engine
wneuper@4770
   141
wneuper@4770
   142
  //fun getAccumulatedAsms : calcID -> pos' -> XML.tree
wneuper@4770
   143
  def   get_accumulated_asms(calcid: scala.math.BigInt, pos: Position): XML.Tree =
wneuper@4848
   144
  { XML.Elem(("GETASSUMPTIONS", Nil), List(
wneuper@4848
   145
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString()))),
wneuper@4770
   146
      DataTypes.xml_of_Position(pos)))
wneuper@4770
   147
  } 
wneuper@4767
   148
  
wneuper@4770
   149
  //fun getActiveFormula : calcID -> XML.tree
wneuper@4770
   150
  def   get_active_form(calcid: scala.math.BigInt): XML.Tree =
wneuper@4848
   151
  { XML.Elem(("CALCITERATOR", Nil), List(
wneuper@4848
   152
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString())))))
wneuper@4770
   153
  } 
wneuper@4760
   154
  //fun getAssumptions : calcID -> pos' -> XML.tree
wneuper@4770
   155
  def   get_asms(calcid: scala.math.BigInt, pos: Position): XML.Tree =
wneuper@4848
   156
  { XML.Elem(("APPLICABLETACTICS", Nil), List(
wneuper@4848
   157
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString()))),
wneuper@4770
   158
      DataTypes.xml_of_Position(pos)))
wneuper@4770
   159
  } 
wneuper@4723
   160
wneuper@4760
   161
  //fun getFormulaeFromTo : calcID -> pos' -> pos' -> int -> bool -> XML.tree
wneuper@4760
   162
  //def get_formulae(calcid: scala.math.BigInt, from: ICalcIterator,to: ICalcIterator,
wneuper@4760
   163
  def   get_formulae(calcid: scala.math.BigInt, from: Position,     to: Position,
wneuper@4760
   164
    level: scala.math.BigInt, rules: Boolean): XML.Tree =
wneuper@4848
   165
  { XML.Elem(("GETFORMULAEFROMTO", Nil), List(
wneuper@4848
   166
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString()))),
wneuper@4760
   167
      DataTypes.xml_of_Position(from), //Isabelle/Isac needs no further data from ICalcIterator
wneuper@4760
   168
      DataTypes.xml_of_Position(to),
wneuper@4848
   169
      XML.Elem(("INT", Nil), List(XML.Text(level.toString()))),
wneuper@4848
   170
      XML.Elem(("BOOL", Nil), List(XML.Text(rules.toString)))))
wneuper@4760
   171
  } 
wneuper@4760
   172
wneuper@4760
   173
  //fun getTactic : calcID -> pos' -> XML.tree
wneuper@4770
   174
  def   get_tac(calcid: scala.math.BigInt, pos: Position): XML.Tree =
wneuper@4848
   175
  { XML.Elem(("GETTACTIC", Nil), List(
wneuper@4848
   176
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString()))),
wneuper@4770
   177
      DataTypes.xml_of_Position(pos)))
wneuper@4770
   178
  } 
wneuper@4770
   179
wneuper@4760
   180
  //fun initContext : calcID -> ketype -> pos' -> XML.tree
wneuper@4770
   181
  def   init_ctxt(calcid: scala.math.BigInt, ketype: ContextType, pos: Position): XML.Tree =
wneuper@4848
   182
  { XML.Elem(("INITCONTEXT", Nil), List(
wneuper@4848
   183
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString()))),
wneuper@4770
   184
      DataTypes.xml_of_ContextType(ketype),
wneuper@4770
   185
      DataTypes.xml_of_Position(pos) ))
wneuper@4773
   186
  }
wneuper@4773
   187
  
wneuper@4773
   188
  //fun inputFillFormula: calcID -> string -> XML.tree   
wneuper@4773
   189
  //... ONLY IMPL. IN Math_Engine
wneuper@4770
   190
wneuper@4760
   191
  //fun interSteps : calcID -> pos' -> XML.tree
wneuper@4770
   192
  def   inter_steps(calcid: scala.math.BigInt, pos: Position): XML.Tree =
wneuper@4848
   193
  { XML.Elem(("INTERSTEPS", Nil), List(
wneuper@4848
   194
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString()))),
wneuper@4770
   195
      DataTypes.xml_of_Position(pos)))
wneuper@4770
   196
  } 
wneuper@4770
   197
wneuper@4773
   198
  //fun Iterator : calcID -> XML.tree                ...IS ONLY A scala.math.BigInt
wneuper@4773
   199
  //fun IteratorTEST : calcID -> iterID              ... only relevant for Isabelle/Isac
wneuper@4773
   200
  //fun modelProblem : calcID -> XML.tree            ...IS ONLY A scala.math.BigInt
wneuper@4760
   201
  //fun modifyCalcHead : calcID -> icalhd -> XML.tree
wneuper@4770
   202
  def   modify_calchead(calcid: scala.math.BigInt, calchead: CalcHead): XML.Tree =
wneuper@4848
   203
  { XML.Elem(("MODIFYCALCHEAD", Nil), List(
wneuper@4848
   204
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString()))),
wneuper@4770
   205
      DataTypes.xml_of_CalcHead(calchead)))
wneuper@4770
   206
  } 
wneuper@4770
   207
wneuper@4760
   208
  //fun moveActiveCalcHead : calcID -> XML.tree
wneuper@4770
   209
  def   move_active_calchead(calcid: scala.math.BigInt): XML.Tree =
wneuper@4848
   210
  { XML.Elem(("CALCITERATOR", Nil), List(
wneuper@4848
   211
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString())))))
wneuper@4770
   212
  } 
wneuper@4770
   213
wneuper@4770
   214
  // BridgeRMI#moveActiveDown needs Protocol#move_active_down + Protocol#move_down
wneuper@4760
   215
  //fun moveActiveDown : calcID -> XML.tree
wneuper@4770
   216
  def   move_active_down(calcid: scala.math.BigInt): XML.Tree =
wneuper@4848
   217
  { XML.Elem(("CALCITERATOR", Nil), List(
wneuper@4848
   218
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString())))))
wneuper@4770
   219
  } 
wneuper@4770
   220
wneuper@4760
   221
  //fun moveActiveFormula : calcID -> pos' -> XML.tree
wneuper@4770
   222
  def   move_active_form(calcid: scala.math.BigInt, pos: Position): XML.Tree =
wneuper@4848
   223
  { XML.Elem(("CALCITERATOR", Nil), List(
wneuper@4848
   224
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString()))),
wneuper@4770
   225
      DataTypes.xml_of_Position(pos)))
wneuper@4770
   226
  } 
wneuper@4770
   227
wneuper@4760
   228
  //fun moveActiveLevelDown : calcID -> XML.tree
wneuper@4770
   229
  def   move_active_levdown(calcid: scala.math.BigInt): XML.Tree =
wneuper@4848
   230
  { XML.Elem(("CALCITERATOR", Nil), List(
wneuper@4848
   231
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString())))))
wneuper@4770
   232
  } 
wneuper@4770
   233
wneuper@4760
   234
  //fun moveActiveLevelUp : calcID -> XML.tree
wneuper@4770
   235
  def   move_active_levup(calcid: scala.math.BigInt): XML.Tree =
wneuper@4848
   236
  { XML.Elem(("CALCITERATOR", Nil), List(
wneuper@4848
   237
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString())))))
wneuper@4770
   238
  } 
wneuper@4770
   239
wneuper@4760
   240
  //fun moveActiveRoot : calcID -> XML.tree
wneuper@4784
   241
  //  uses only an BigInt, not an XML.Tree
wneuper@4784
   242
  
wneuper@4760
   243
  //fun moveActiveRootTEST : calcID -> XML.tree
wneuper@4773
   244
  //... only relevant for Isabelle/Isac
wneuper@4770
   245
wneuper@4760
   246
  //fun moveActiveUp : calcID -> XML.tree
wneuper@4770
   247
  def   move_active_up(calcid: scala.math.BigInt): XML.Tree =
wneuper@4848
   248
  { XML.Elem(("CALCITERATOR", Nil), List(
wneuper@4848
   249
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString())))))
wneuper@4770
   250
  } 
wneuper@4770
   251
wneuper@4760
   252
  //fun moveCalcHead : calcID -> pos' -> XML.tree
wneuper@4770
   253
  def   move_calchead(calcid: scala.math.BigInt, pos: Position): XML.Tree =
wneuper@4848
   254
  { XML.Elem(("GETTACTIC"/*shortcut in coding*/, Nil), List(
wneuper@4848
   255
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString()))),
wneuper@4770
   256
      DataTypes.xml_of_Position(pos)))
wneuper@4770
   257
  } 
wneuper@4770
   258
wneuper@4760
   259
  //fun moveDown : calcID -> pos' -> XML.tree
wneuper@4770
   260
  def   move_down(calcid: scala.math.BigInt, pos: Position): XML.Tree =
wneuper@4848
   261
  { XML.Elem(("CALCITERATOR", Nil), List(
wneuper@4848
   262
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString()))),
wneuper@4770
   263
      DataTypes.xml_of_Position(pos)))
wneuper@4770
   264
  } 
wneuper@4760
   265
  //fun moveLevelDown : calcID -> pos' -> XML.tree
wneuper@4770
   266
  def   move_levdn(calcid: scala.math.BigInt, pos: Position): XML.Tree =
wneuper@4848
   267
  { XML.Elem(("CALCITERATOR", Nil), List(
wneuper@4848
   268
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString()))),
wneuper@4770
   269
      DataTypes.xml_of_Position(pos)))
wneuper@4770
   270
  } 
wneuper@4760
   271
  //fun moveLevelUp : calcID -> pos' -> XML.tree
wneuper@4770
   272
  def   move_levup(calcid: scala.math.BigInt, pos: Position): XML.Tree =
wneuper@4848
   273
  { XML.Elem(("CALCITERATOR", Nil), List(
wneuper@4848
   274
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString()))),
wneuper@4770
   275
      DataTypes.xml_of_Position(pos)))
wneuper@4770
   276
  } 
wneuper@4760
   277
  //fun moveRoot : calcID -> XML.tree
wneuper@4770
   278
  def   move_root(calcid: scala.math.BigInt): XML.Tree =
wneuper@4848
   279
  { XML.Elem(("CALCITERATOR", Nil), List(
wneuper@4848
   280
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString())))))
wneuper@4770
   281
  } 
wneuper@4760
   282
  //fun moveUp : calcID -> pos' -> XML.tree
wneuper@4770
   283
  def   move_up(calcid: scala.math.BigInt, pos: Position): XML.Tree =
wneuper@4848
   284
  { XML.Elem(("CALCITERATOR", Nil), List(
wneuper@4848
   285
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString()))),
wneuper@4770
   286
      DataTypes.xml_of_Position(pos)))
wneuper@4770
   287
  } 
wneuper@4760
   288
wneuper@4760
   289
  //fun refFormula : calcID -> pos' -> XML.tree
wneuper@4773
   290
  //def ref_formula(calcid: scala.math.BigInt, pos: ICalcIterator 
wneuper@4760
   291
  def   ref_formula(calcid: scala.math.BigInt, pos: Position): XML.Tree =
wneuper@4848
   292
  { XML.Elem(("REFFORMULA", Nil), List(
wneuper@4848
   293
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString()))),
wneuper@4760
   294
      DataTypes.xml_of_Position(pos)))
wneuper@4760
   295
  }  
wneuper@4760
   296
wneuper@4760
   297
  //fun refineProblem : calcID -> pos' -> guh -> XML.tree
wneuper@4770
   298
  def   refine_pbl(calcid: scala.math.BigInt, from: Position, kestore_key: String): XML.Tree =
wneuper@4848
   299
  { XML.Elem(("CONTEXTPBL", Nil), List(
wneuper@4848
   300
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString()))),
wneuper@4770
   301
      DataTypes.xml_of_Position(from),
wneuper@4848
   302
      XML.Elem(("GUH", Nil), List(XML.Text(kestore_key)))))
wneuper@4770
   303
  } 
wneuper@4770
   304
wneuper@4760
   305
  //fun replaceFormula : calcID -> cterm' -> XML.tree
wneuper@4787
   306
  def replace_form(calcid: scala.math.BigInt, form: Formula): XML.Tree =
wneuper@4848
   307
  { XML.Elem(("REPLACEFORMULA", Nil), List(
wneuper@4848
   308
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString()))),
wneuper@4928
   309
      DataTypes.xml_of_Formula_NEW(form)))
wneuper@4770
   310
  }
wneuper@4770
   311
wneuper@4773
   312
  //fun requestFillformula : calcID -> errpatID * fillpatID -> XML.tree
wneuper@4773
   313
  //...ONLY IMPLEMENTED IN Math_Engine
wneuper@4770
   314
wneuper@4760
   315
  //fun resetCalcHead : calcID -> XML.tree
wneuper@4770
   316
  def reset_calchead(calcid: scala.math.BigInt): XML.Tree =
wneuper@4848
   317
  { XML.Elem(("MODIFYCALCHEAD", Nil), List(
wneuper@4848
   318
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString())))))
wneuper@4770
   319
  }
wneuper@4770
   320
wneuper@4760
   321
  //fun setContext : calcID -> pos' -> guh -> XML.tree
wneuper@4770
   322
  def   set_ctxt(calcid: scala.math.BigInt, pos: Position, kestore_key: String): XML.Tree =
wneuper@4848
   323
  { XML.Elem(("CONTEXT", Nil), List(
wneuper@4848
   324
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString()))),
wneuper@4770
   325
      DataTypes.xml_of_Position(pos),
wneuper@4848
   326
      XML.Elem(("GUH", Nil), List(XML.Text(kestore_key)))))
wneuper@4770
   327
  } 
wneuper@4770
   328
wneuper@4760
   329
  //fun setMethod : calcID -> metID -> XML.tree
wneuper@4780
   330
  def   set_met(calcid: scala.math.BigInt, met_key: java.util.Vector[String]): XML.Tree =
wneuper@4848
   331
  { XML.Elem(("MODIFYCALCHEAD", Nil), List(
wneuper@4848
   332
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString()))),
wneuper@4848
   333
      XML.Elem(("METHODID", Nil), List(
wneuper@4780
   334
        DataTypes.xml_of_VectorString(met_key)))))
wneuper@4780
   335
  } 
wneuper@4770
   336
wneuper@4760
   337
  //fun setNextTactic : calcID -> tac -> XML.tree
wneuper@4773
   338
  def   set_next_tac(calcid: scala.math.BigInt, tac: Tactic): XML.Tree =
wneuper@4848
   339
  { XML.Elem(("SETNEXTTACTIC", Nil), List(
wneuper@4848
   340
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString()))),
wneuper@4773
   341
      DataTypesCompanion.xml_of_Tactic(tac)))
wneuper@4773
   342
  } 
wneuper@4771
   343
wneuper@4771
   344
  //fun setProblem : calcID -> pblID -> XML.tree
wneuper@4780
   345
  def   set_pbl(calcid: scala.math.BigInt, pbl_key: java.util.Vector[String]): XML.Tree =
wneuper@4848
   346
  { XML.Elem(("MODIFYCALCHEAD", Nil), List(
wneuper@4848
   347
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString()))),
wneuper@4848
   348
      XML.Elem(("PROBLEMID", Nil), List(
wneuper@4780
   349
        DataTypes.xml_of_VectorString(pbl_key)))))
wneuper@4780
   350
  } 
wneuper@4771
   351
  //fun setTheory : calcID -> thyID -> XML.tree
wneuper@4780
   352
  def   set_thy(calcid: scala.math.BigInt, thy_id: String): XML.Tree =
wneuper@4848
   353
  { XML.Elem(("MODIFYCALCHEAD", Nil), List(
wneuper@4848
   354
      XML.Elem(("CALCID", Nil), List(XML.Text(calcid.toString()))),
wneuper@4848
   355
      XML.Elem(("THEORYID", Nil), List(XML.Text(calcid.toString())))))
wneuper@4780
   356
  } 
wneuper@4770
   357
wneuper@4760
   358
  
walther@5239
   359
}