Packages

final class Theory extends FutureValue

Represents a theory (ML type theory) in the Isabelle process.

An instance of this class is merely a thin wrapper around an MLValue, all explanations and examples given for Context also apply here.

The name of the theory can be retrieved via the member name if the theory was created by Theory(name). Otherwise, name returns a placeholder.

An implict MLValue.Converter can be imported from Implicits._. The representation of a theory thy as an ML exception is E_Theory thy.

Source
Theory.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Theory
  2. FutureValue
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def await: Unit

    Blocks until this future value is computed.

    Blocks until this future value is computed. (Or throws an exception if the computation fails.)

    Definition Classes
    TheoryFutureValue
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  9. def force: Theory.this.type

    Waits till the computation of this value (in the Isabelle process) has finished.

    Waits till the computation of this value (in the Isabelle process) has finished. (Or until an exception is thrown.)

    returns

    this value, but it is guaranteed to have completed the computation

    Definition Classes
    FutureValue
  10. def forceFuture(implicit ec: ExecutionContext): Future[Theory.this.type]

    A future containing this object with the computation completed.

    A future containing this object with the computation completed. In particular, if this value throws an exception upon computation, the future holds that exception.

    Roughly the same as Future { this.force }.

    Definition Classes
    FutureValue
  11. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  12. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  13. def importMLStructure(name: String)(implicit isabelle: Isabelle, executionContext: ExecutionContext): Future[String]

    Like importMLStructureNow but returns a future containing the name of the imported structure without delay.

  14. def importMLStructureNow(name: String)(implicit isabelle: Isabelle, executionContext: ExecutionContext): String

    Imports an ML structure from a theory into the global ML namespace.

    Imports an ML structure from a theory into the global ML namespace.

    In an Isabelle theory T, it is possible to include ML source code using the ML_file command and related commands. In that ML source code, new symbols (values, types, structures) can be declared. These will be visible to further ML code in the same theory T and in theories that import T. However, it is not directly possible to use those symbols in ML code on the ML toplevel (i.e., in commands such as Isabelle.executeMLCode or MLValue.compileValue and friends). Instead, the symbols must be imported using this method. (Only supported for ML structures, not for values or types that are declared outside a structure.) importMLStructureNow(name) (or importMLStructure(name) for asynchronous execution) imports the structure called name under a new (unique) name into the toplevel, and returns the name of the structure.

    We give an example.

    File importMe.ML:

    structure ImportMe = struct
    val num = 123
    end

    This declares a structure ImportMe with a value member num.

    File ImportMeThy.thy:

    theory ImportMeThy imports Main begin
    
    ML_file "importMe.ML"
    
    end

    This declares a theory which loads the ML code from "importMe.ML" (and thus all theories importing ImportMeThy have access to the ML structure ImportMe).

    In Scala:

    implicit val isabelle = new Isabelle(... suitable setup ...)
    val thy : Theory = Theory(Path.of("ImportMeThy.thy"))              // load the theory TestThy
    val num1 : MLValue[Int] = MLValue.compileValue("ImportMe.num")     // fails
    val importMe : String = thy.importMLStructureNow("ImportMe")       // import the structure Test into the ML toplevel
    val num2 : MLValue[Int] = MLValue.compileValue(s"${importMe}.num") // access Test (under new name) in compiled ML code
    println(num2.retrieveNow)                                          // ==> 123
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. val mlValue: MLValue[Theory]
  17. val name: String
  18. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  19. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  20. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  21. def someFuture: Future[Any]

    Returns a future that completes when the computation of this object is complete.

    Returns a future that completes when the computation of this object is complete. (Or that holds an exception if that computation throws an exception.) However, upon successful completion, the future may return an arbitrary (and thus useless) value. May be faster to implement than forceFuture because there may be already a future available but that returns the wrong value.

    Definition Classes
    TheoryFutureValue
  22. def stateString: String

    A utility method that returns "" if this value was successfully computed, " (computing)" if it still computes, and " (failed)" if it finished with an exception.

    A utility method that returns "" if this value was successfully computed, " (computing)" if it still computes, and " (failed)" if it finished with an exception.

    This can be useful to constructing human readable messages about this value.

    Definition Classes
    FutureValue
  23. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  24. def toString(): String
    Definition Classes
    Theory → AnyRef → Any
  25. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  26. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  27. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated
  2. def importMLStructure(name: String, newName: String)(implicit isabelle: Isabelle, executionContext: ExecutionContext): Unit

    Imports an ML structure from a theory into the global ML namespace.

    Imports an ML structure from a theory into the global ML namespace.

    WARNING: This has a global effect on the Isabelle process because it modifies the ML name space. Use importMLStructure(String) instead.

    In an Isabelle theory T, it is possible to include ML source code using the ML_file command and related commands. In that ML source code, new symbols (values, types, structures) can be declared. These will be visible to further ML code in the same theory T and in theories that import T. However, it is not directly possible to use those symbols in ML code on the ML toplevel (i.e., in commands such as Isabelle.executeMLCode or MLValue.compileValue and friends). Instead, the symbols must be imported using this method. (Only supported for ML structures, not for values or types that are declared outside a structure.) importMLStructure(name,newName) will import the structure called name under the new name newName into the toplevel.

    We give an example.

    File test.ML:

    structure Test = struct
    val num = 123
    end

    This declares a structure Test with a value member num.

    File TestThy.thy:

    theory TestThy imports Main begin
    
    ML_file "test.ML"
    
    end

    This declares a theory which loads the ML code from "test.ML" (and thus all theories importing TestThy have access to the ML structure Test).

    In Scala:

    implicit val isabelle = new Isabelle(... suitable setup ...)
    val thy : Theory = Theory("Draft.TestThy")                  // load the theory TestThy
    val num1 : MLValue[Int] = MLValue.compileValue("Test.num")  // fails
    thy.importMLStructure("Test", "Test")                       // import the structure Test into the ML toplevel
    val num2 : MLValue[Int] = MLValue.compileValue("Test.num")  // access Test in compiled ML code
    println(num2.retrieveNow)                                   // ==> 123
    Annotations
    @deprecated
    Deprecated

    (Since version 0.1.1) Use importMLStructure(String) instead

Inherited from FutureValue

Inherited from AnyRef

Inherited from Any

Ungrouped