src/Pure/Tools/sledgehammer_params.scala
author wenzelm
Tue, 01 Apr 2014 22:25:01 +0200
changeset 56355 1a9f569b5b7e
parent 55200 777328c9f1ea
child 56385 76acce58aeab
permissions -rw-r--r--
some rephrasing to ensure that this becomes cheap "foreach" and not expensive "map" (cf. 0fc032898b05);
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
53055
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
     1
/*  Title:      Pure/Tools/sledgehammer_params.scala
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
     3
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
     4
Protocol for Sledgehammer parameters from ML (see also
55200
777328c9f1ea tuned comment
blanchet
parents: 54442
diff changeset
     5
HOL/Tools/Sledgehammer/sledgehammer_commands.ML).  */
53055
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
     6
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
     7
package isabelle
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
     8
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
     9
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    10
object Sledgehammer_Params
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    11
{
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    12
  /* global event bus */
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    13
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    14
  case object Provers
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    15
  val provers = new Event_Bus[Provers.type]
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    16
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    17
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    18
  /* per session result */
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    19
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    20
  def get_provers(session: Session): String =
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    21
    session.protocol_handler("isabelle.Sledgehammer_Params$Handler") match {
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    22
      case Some(handler: Handler) => handler.get_provers
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    23
      case _ => ""
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    24
    }
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    25
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    26
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    27
  /* handler */
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    28
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    29
  class Handler extends Session.Protocol_Handler
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    30
  {
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    31
    private var _provers: String = ""
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    32
    private def update_provers(s: String)
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    33
    {
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    34
      synchronized { _provers = s }
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    35
      provers.event(Provers)
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    36
    }
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    37
    def get_provers: String = synchronized { _provers }
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    38
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    39
    private def sledgehammer_provers(
54442
c39972ddd672 more specific Protocol_Output: empty message.body, main content via bytes/text;
wenzelm
parents: 53055
diff changeset
    40
      prover: Session.Prover, msg: Isabelle_Process.Protocol_Output): Boolean =
53055
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    41
    {
54442
c39972ddd672 more specific Protocol_Output: empty message.body, main content via bytes/text;
wenzelm
parents: 53055
diff changeset
    42
      update_provers(msg.text)
c39972ddd672 more specific Protocol_Output: empty message.body, main content via bytes/text;
wenzelm
parents: 53055
diff changeset
    43
      true
53055
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    44
    }
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    45
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    46
    val functions =
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    47
      Map(Markup.SLEDGEHAMMER_PROVERS -> sledgehammer_provers _)
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    48
  }
0fe8a9972eda some protocol to determine provers according to ML;
wenzelm
parents:
diff changeset
    49
}