src/HOL/Tools/Nitpick/kodkod.scala
author wenzelm
Thu, 27 Aug 2020 17:15:33 +0200
changeset 72218 a51736641843
parent 72204 cb746b19e1d7
child 72336 41a4352c5240
permissions -rw-r--r--
initial Kodkod.warmup: preloading and basic integrity test;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
72176
22c11f65ddf9 rudiments of Scala interface for Kodkod;
wenzelm
parents:
diff changeset
     1
/*  Title:      HOL/Tools/Nitpick/kodkod.scala
22c11f65ddf9 rudiments of Scala interface for Kodkod;
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
22c11f65ddf9 rudiments of Scala interface for Kodkod;
wenzelm
parents:
diff changeset
     3
22c11f65ddf9 rudiments of Scala interface for Kodkod;
wenzelm
parents:
diff changeset
     4
Scala interface for Kodkod.
22c11f65ddf9 rudiments of Scala interface for Kodkod;
wenzelm
parents:
diff changeset
     5
*/
22c11f65ddf9 rudiments of Scala interface for Kodkod;
wenzelm
parents:
diff changeset
     6
22c11f65ddf9 rudiments of Scala interface for Kodkod;
wenzelm
parents:
diff changeset
     7
package isabelle.nitpick
22c11f65ddf9 rudiments of Scala interface for Kodkod;
wenzelm
parents:
diff changeset
     8
22c11f65ddf9 rudiments of Scala interface for Kodkod;
wenzelm
parents:
diff changeset
     9
import isabelle._
22c11f65ddf9 rudiments of Scala interface for Kodkod;
wenzelm
parents:
diff changeset
    10
72177
fbaa6b40b439 update to kodkodi-1.5.4;
wenzelm
parents: 72176
diff changeset
    11
import java.util.concurrent.Executors
fbaa6b40b439 update to kodkodi-1.5.4;
wenzelm
parents: 72176
diff changeset
    12
72178
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
    13
import org.antlr.runtime.{ANTLRInputStream, RecognitionException}
72177
fbaa6b40b439 update to kodkodi-1.5.4;
wenzelm
parents: 72176
diff changeset
    14
import de.tum.in.isabelle.Kodkodi.{Context, KodkodiLexer, KodkodiParser}
72176
22c11f65ddf9 rudiments of Scala interface for Kodkod;
wenzelm
parents:
diff changeset
    15
22c11f65ddf9 rudiments of Scala interface for Kodkod;
wenzelm
parents:
diff changeset
    16
22c11f65ddf9 rudiments of Scala interface for Kodkod;
wenzelm
parents:
diff changeset
    17
object Kodkod
22c11f65ddf9 rudiments of Scala interface for Kodkod;
wenzelm
parents:
diff changeset
    18
{
72204
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    19
  /** result **/
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    20
72178
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
    21
  sealed case class Result(rc: Int, out: String, err: String)
72179
0841895ca438 clarified signature;
wenzelm
parents: 72178
diff changeset
    22
  {
0841895ca438 clarified signature;
wenzelm
parents: 72178
diff changeset
    23
    def ok: Boolean = rc == 0
0841895ca438 clarified signature;
wenzelm
parents: 72178
diff changeset
    24
    def check: String =
0841895ca438 clarified signature;
wenzelm
parents: 72178
diff changeset
    25
      if (ok) out else error(if (err.isEmpty) "Error" else err)
72196
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
    26
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
    27
    def encode: XML.Body =
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
    28
    {
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
    29
      import XML.Encode._
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
    30
      triple(int, string, string)((rc, out, err))
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
    31
    }
72179
0841895ca438 clarified signature;
wenzelm
parents: 72178
diff changeset
    32
  }
72178
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
    33
72204
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    34
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    35
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    36
  /** execute **/
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    37
72179
0841895ca438 clarified signature;
wenzelm
parents: 72178
diff changeset
    38
  def execute(source: String,
72176
22c11f65ddf9 rudiments of Scala interface for Kodkod;
wenzelm
parents:
diff changeset
    39
    solve_all: Boolean = false,
22c11f65ddf9 rudiments of Scala interface for Kodkod;
wenzelm
parents:
diff changeset
    40
    prove: Boolean = false,
22c11f65ddf9 rudiments of Scala interface for Kodkod;
wenzelm
parents:
diff changeset
    41
    max_solutions: Int = Integer.MAX_VALUE,
22c11f65ddf9 rudiments of Scala interface for Kodkod;
wenzelm
parents:
diff changeset
    42
    cleanup_inst: Boolean = false,
72178
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
    43
    timeout: Time = Time.zero,
72199
8dc2e4d9deaa proper default for max_threads;
wenzelm
parents: 72196
diff changeset
    44
    max_threads: Int = 0): Result =
72176
22c11f65ddf9 rudiments of Scala interface for Kodkod;
wenzelm
parents:
diff changeset
    45
  {
72204
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    46
    /* executor */
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    47
72201
wenzelm
parents: 72199
diff changeset
    48
    val pool_size = if (max_threads == 0) Isabelle_Thread.max_threads() else max_threads
72178
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
    49
72204
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    50
    val executor = Executors.newFixedThreadPool(pool_size)
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    51
    val executor_killed = Synchronized(false)
72178
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
    52
    def executor_kill(): Unit =
72204
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    53
      executor_killed.change(b =>
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    54
        if (b) b else { Isabelle_Thread.fork() { executor.shutdownNow() }; true })
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    55
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    56
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    57
    /* system context */
72178
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
    58
72203
733bab4c1be0 suppress odd warning for context.exit();
wenzelm
parents: 72201
diff changeset
    59
    class Exit extends Exception("EXIT")
72178
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
    60
72177
fbaa6b40b439 update to kodkodi-1.5.4;
wenzelm
parents: 72176
diff changeset
    61
    val context =
fbaa6b40b439 update to kodkodi-1.5.4;
wenzelm
parents: 72176
diff changeset
    62
      new Context {
72178
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
    63
        private var rc = 0
72177
fbaa6b40b439 update to kodkodi-1.5.4;
wenzelm
parents: 72176
diff changeset
    64
        private val out = new StringBuilder
fbaa6b40b439 update to kodkodi-1.5.4;
wenzelm
parents: 72176
diff changeset
    65
        private val err = new StringBuilder
72178
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
    66
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
    67
        def return_code(i: Int): Unit = synchronized { rc = rc max i}
72204
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    68
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    69
        override def output(s: String): Unit = synchronized {
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    70
          Exn.Interrupt.expose()
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    71
          out ++= s
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    72
          out += '\n'
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    73
        }
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    74
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    75
        override def error(s: String): Unit = synchronized {
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    76
          Exn.Interrupt.expose()
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    77
          err ++= s
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    78
          err += '\n'
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    79
        }
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    80
72178
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
    81
        override def exit(i: Int): Unit =
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
    82
          synchronized {
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
    83
            return_code(i)
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
    84
            executor_kill()
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
    85
            throw new Exit
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
    86
          }
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
    87
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
    88
        def result(): Result = synchronized { Result(rc, out.toString, err.toString) }
72177
fbaa6b40b439 update to kodkodi-1.5.4;
wenzelm
parents: 72176
diff changeset
    89
      }
72178
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
    90
72204
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    91
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    92
    /* main */
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
    93
72178
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
    94
    try {
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
    95
      val lexer = new KodkodiLexer(new ANTLRInputStream(Bytes(source).stream))
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
    96
      val parser =
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
    97
        KodkodiParser.create(context, executor,
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
    98
          false, solve_all, prove, max_solutions, cleanup_inst, lexer)
72176
22c11f65ddf9 rudiments of Scala interface for Kodkod;
wenzelm
parents:
diff changeset
    99
72178
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   100
      val timeout_request =
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   101
        if (timeout.is_zero) None
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   102
        else {
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   103
          Some(Event_Timer.request(Time.now() + timeout) {
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   104
            context.error("Ran out of time")
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   105
            context.return_code(2)
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   106
            executor_kill()
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   107
          })
72177
fbaa6b40b439 update to kodkodi-1.5.4;
wenzelm
parents: 72176
diff changeset
   108
        }
72178
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   109
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   110
      try { parser.problems() }
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   111
      catch { case exn: RecognitionException => parser.reportError(exn) }
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   112
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   113
      timeout_request.foreach(_.cancel)
72177
fbaa6b40b439 update to kodkodi-1.5.4;
wenzelm
parents: 72176
diff changeset
   114
72178
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   115
      if (parser.getTokenStream.LA(1) != KodkodiParser.EOF) {
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   116
        context.error("Error: trailing tokens")
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   117
        context.exit(1)
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   118
      }
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   119
      if (lexer.getNumberOfSyntaxErrors + parser.getNumberOfSyntaxErrors > 0) {
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   120
        context.exit(1)
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   121
      }
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   122
    }
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   123
    catch {
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   124
      case _: Exit =>
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   125
      case exn: Throwable =>
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   126
        val message = exn.getMessage
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   127
        context.error(if (message.isEmpty) exn.toString else "Error: " + message)
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   128
        context.return_code(1)
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   129
    }
72177
fbaa6b40b439 update to kodkodi-1.5.4;
wenzelm
parents: 72176
diff changeset
   130
72204
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
   131
    executor.shutdownNow()
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
   132
72178
2481cdb84832 more realistic kodkod invocation, imitating command-line tool;
wenzelm
parents: 72177
diff changeset
   133
    context.result()
72176
22c11f65ddf9 rudiments of Scala interface for Kodkod;
wenzelm
parents:
diff changeset
   134
  }
72179
0841895ca438 clarified signature;
wenzelm
parents: 72178
diff changeset
   135
72218
a51736641843 initial Kodkod.warmup: preloading and basic integrity test;
wenzelm
parents: 72204
diff changeset
   136
a51736641843 initial Kodkod.warmup: preloading and basic integrity test;
wenzelm
parents: 72204
diff changeset
   137
  /** protocol handler **/
a51736641843 initial Kodkod.warmup: preloading and basic integrity test;
wenzelm
parents: 72204
diff changeset
   138
72179
0841895ca438 clarified signature;
wenzelm
parents: 72178
diff changeset
   139
  def warmup(): String =
72181
6241cbbf5a58 preload library;
wenzelm
parents: 72179
diff changeset
   140
    execute(
72199
8dc2e4d9deaa proper default for max_threads;
wenzelm
parents: 72196
diff changeset
   141
      "solver: \"MiniSat\"\n" +
72181
6241cbbf5a58 preload library;
wenzelm
parents: 72179
diff changeset
   142
      File.read(Path.explode("$KODKODI/examples/weber3.kki"))).check
72196
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
   143
72218
a51736641843 initial Kodkod.warmup: preloading and basic integrity test;
wenzelm
parents: 72204
diff changeset
   144
  class Handler extends Session.Protocol_Handler
a51736641843 initial Kodkod.warmup: preloading and basic integrity test;
wenzelm
parents: 72204
diff changeset
   145
  {
a51736641843 initial Kodkod.warmup: preloading and basic integrity test;
wenzelm
parents: 72204
diff changeset
   146
    override def init(session: Session): Unit = warmup()
a51736641843 initial Kodkod.warmup: preloading and basic integrity test;
wenzelm
parents: 72204
diff changeset
   147
  }
a51736641843 initial Kodkod.warmup: preloading and basic integrity test;
wenzelm
parents: 72204
diff changeset
   148
72196
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
   149
72204
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
   150
cb746b19e1d7 more robust treatment of execution with interrupts;
wenzelm
parents: 72203
diff changeset
   151
  /** scala function **/
72196
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
   152
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
   153
  object Fun extends Scala.Fun("kodkod")
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
   154
  {
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
   155
    def apply(args: String): String =
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
   156
    {
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
   157
      val (timeout, (solve_all, (max_solutions, (max_threads, kki)))) =
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
   158
      {
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
   159
        import XML.Decode._
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
   160
        pair(int, pair(bool, pair(int, pair(int, string))))(YXML.parse_body(args))
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
   161
      }
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
   162
      val result =
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
   163
        execute(kki,
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
   164
          solve_all = solve_all,
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
   165
          max_solutions = max_solutions,
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
   166
          timeout = Time.ms(timeout),
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
   167
          max_threads = max_threads)
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
   168
      YXML.string_of_body(result.encode)
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
   169
    }
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
   170
  }
72176
22c11f65ddf9 rudiments of Scala interface for Kodkod;
wenzelm
parents:
diff changeset
   171
}
72196
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
   172
6dba090358d2 invoke Nitpick/Kodkod via Isabelle/Scala (instead of external process);
wenzelm
parents: 72181
diff changeset
   173
class Scala_Functions extends Scala.Functions(Kodkod.Fun)