Packages

sealed abstract class Term extends FutureValue

This class represents a term (ML type term) in Isabelle. It can be transferred to and from the Isabelle process transparently by internally using MLValues (see below).

In most respects, Term behaves as if it was an algebraic datatype defined as follows:

sealed abstract class Term
final case class Const(name: String, typ: Typ)            // Corresponds to ML constructor 'Const'
final case class Free(name: String, typ: Typ)             // Corresponds to ML constructor 'Free'
final case class Var(name: String, index: Int, typ: Typ)  // Corresponds to ML constructor 'Var'
final case class Abs(name: String, typ: Typ, body: Term)  // Corresponds to ML constructor 'Abs'
final case class Bound private (index: Int)               // Corresponds to ML constructor 'Bound'
final case class App private (fun: Term, arg: Term)       // Corresponds to ML constructor '$'

tl;dr for the explanation below: Terms can be treated as if they were the case classes above (even though there actually are more classes), both in object creation and in pattern matching, with the exception that one should not use type patterns (e.g., case _ : Const =>).

Having Terms defined in terms of those case classes would mean that when retrieving a term from the Isabelle process, the whole term needs to be retrieved. Since terms can be very large and might be transferred back and forth a lot (with minor modifications), we choose an approach where terms may be partially stored in Scala, and partially in the Isabelle process. That is, an instance of Term can be any of the above classes, or a reference to a term in the object store in the Isabelle process, or both at the same time. And the same applies to subterms, too. So for example, if we retrieve terms t,u from Isabelle to Scala, and then in Scala construct App(t,u), and then transfer App(t,u) back to Isabelle, the terms t,u will never be serialized, and only the constructor App will need to be transferred.

In order to faciliate this, the classes Const, Free, Var, Abs, Bound, App (collectively referred to as a ConcreteTerm) additionally store an reference Term.mlValue to the Isabelle object store (this reference is initialized lazily, thus accessing it can force the term to be transferred to the Isabelle process). And furthermore, there is an additional subclass MLValueTerm of Term that represents a term that is stored in Isabelle but not available in Scala at class creation time. Instances of MLValueTerm never need to be created manually, though. You just have to be aware that some terms might not be instances of the six ConcreteTerm "case classes". (But if a ConcreteTerm is required, any term can be converted using term.concrete.)

Pattern matching works as expected, that is, when an MLValueTerm t, e.g., refers to an Isabelle term of the form Const (name,typ), then t will match the pattern case Const(name,typ) =>. (Necessary information will be transferred from the Isabelle process on demand.) Because of this, one can almost completely ignore the existence of MLValueTerm. The only caveat is that one should not do a pattern match on the type of the term. That is case _ : Const => will not match a term Const(name,typ) represented by an MLValueTerm.

Two terms are equal (w.r.t.~the equals method) iff they represent the same Isabelle terms. I.e., an MLValueTerm and a Const can be equal. (Equality tests try to transfer as little data as possible when determining equality.)

Furthermore, there is a subclass Cterm of Term that represents an ML value of type cterm. This is logically a term that is certified to be well-typed with respect to some Isabelle context. In this implementation, a Cterm is also a Term, so it is possible to do, e.g., equality tests between Cterms and regular terms (such as Const) without explicit conversions. Similarly, patterns such as case Const(name,typ) => also match Cterms.

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

Abstract Value Members

  1. abstract 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
    FutureValue
  2. abstract val concrete: ConcreteTerm

    Transforms this term into a ConcreteTerm.

    Transforms this term into a ConcreteTerm. A ConcreteTerm guarantees that the type of the term (App,Const,Abs...) corresponds to the top-level constructor on Isabelle side ($, Const, Abs, ...).

  3. abstract def concreteComputed: Boolean

    Indicates whether concrete has already been initialized.

    Indicates whether concrete has already been initialized. (I.e., whether it can be accessed without delay and without incurring communication with the Isabelle process.

  4. implicit abstract val isabelle: Isabelle

    Isabelle instance relative to which this term was constructed.

  5. abstract val mlValue: MLValue[Term]

    Transforms this term into an MLValue containing this term.

    Transforms this term into an MLValue containing this term. This causes transfer of the term to Isabelle only the first time it is accessed (and not at all if the term came from the Isabelle process in the first place).

  6. abstract 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
    FutureValue

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. def $(that: Term)(implicit ec: ExecutionContext): App

    t $ u is shorthand for App(t,u)

  4. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  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(that: Any): Boolean

    Equality of terms.

    Equality of terms. Returns true iff the two Term instances represent the same term in the Isabelle process. (E.g., a Cterm and a Const can be equal.) May throw an exception if the computation of the terms fails. (But will not fail if await or a related FutureValue method has returned successfully on both terms.)

    Definition Classes
    Term → AnyRef → Any
  9. def force: Term.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[Term.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

    Hash code compatible with equals.

    Hash code compatible with equals. May fail with an exception, see equals.

    Definition Classes
    Term → AnyRef → Any
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  16. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  17. def pretty(ctxt: Context)(implicit ec: ExecutionContext): String

    Produces a string representation of this term.

    Produces a string representation of this term. Uses the Isabelle pretty printer.

    ctxt

    The Isabelle proof context to use (this contains syntax declarations etc.)

  18. 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
  19. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  20. def toString(): String
    Definition Classes
    AnyRef → Any
  21. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  22. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  23. 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

Inherited from FutureValue

Inherited from AnyRef

Inherited from Any

Ungrouped