final class Context extends MLValueWrapper[Context]
Represents a proof context (ML type Proof.context) in the Isabelle process.
An instance of this class is merely a thin wrapper around an MLValue, that is, the context is never transferred to the Scala process (which would not be possible because a context cannot be serialized). However, by having this wrapper, a context can be treated as if it were a Scala object (as opposed to a value stored in the Isabelle process).
This class is compatible with the MLValue mechanism. That is, from a Context context,
we can create an MLValueContext by MLValue(context), and we can get a Context back
using .retrieve/.retrieveNow. This conversion is needed
if we want to pass contexts to (or return contexts from) ML functions compiled using MLValue.compileFunction.
For example, say countTheorems : Proof.context -> int is an ML function, then we can compile it using
val countTheorems = MLValue.compileFunction[Context,Int]("countTheorems")
and invoke it as
val num : Int = countTheorems(context).retrieveNow // where context : Context
Make sure to import de.unruh.isabelle.pure.Implicits._ for the MLValue-related functions to work.
Not that contexts (being MLValues), are internally futures and may still fail. To make sure a Context actually contains a value, use, e.g., Context.force.
An implict MLValue.Converter can be imported from Implicits._. The ML type is Proof.context
and the representation of a context ctxt as an ML exception is E_Context ctxt.
- Source
- Context.scala
- Alphabetic
- By Inheritance
- Context
- MLValueWrapper
- FutureValue
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
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
- MLValueWrapper → FutureValue
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @HotSpotIntrinsicCandidate()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
force: Context.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[Context.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[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
val
mlValue: MLValue[Context]
An MLValue referencing
this(in the Isabelle process).An MLValue referencing
this(in the Isabelle process). Sincethisis just a thin wrapper around an MLValue, mlValue carries exactly the same data asthisand can be converted back and forth quickly (no transfer of data to/from the Isabelle process involved).Same as MLValue
(this), assuming the correct MLValue.Converter from the companion object forAis imported.- Definition Classes
- Context → MLValueWrapper
-
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
setMode(mode: Mode)(implicit isabelle: Isabelle, executionContext: ExecutionContext): Context
Sets the "inner syntax mode" of the context.
Sets the "inner syntax mode" of the context. This affects, e.g., parsing of terms/types. (Corresponds loosely to Proof_Context.set_mode in Isabelle/ML.)
- mode
the mode to enable
- returns
a new context with the corresponding mode
-
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
- MLValueWrapper → 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
theoryOf(implicit isabelle: Isabelle, executionContext: ExecutionContext): Theory
Returns the theory underlying this context.
-
def
toString(): String
Returns "context", "context (computing)", or "context (failed)" depending on whether this context is ready, still being computed, or computation has thrown an exception.
Returns "context", "context (computing)", or "context (failed)" depending on whether this context is ready, still being computed, or computation has thrown an exception.
- Definition Classes
- Context → AnyRef → Any
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )