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
- Alphabetic
- By Inheritance
- Theory
- FutureValue
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- 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
- Theory → FutureValue
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- 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
- 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.
- Definition Classes
- FutureValue
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- 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.
- 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 theML_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 theoryT
and in theories that importT
. 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 calledname
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 membernum
.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 structureImportMe
).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
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- val mlValue: MLValue[Theory]
- val name: String
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- 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
- Theory → FutureValue
- 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
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- Theory → AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
- 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 theML_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 theoryT
and in theories that importT
. 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 calledname
under the new namenewName
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 membernum
.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 structureTest
).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