trait Context extends BabelSignature
Captures constants, types, definitions, and background theory used in a proof.
Each of these different kinds of information is stored in a separate facet.Facet of the context. Each modification or addition to the context is recorded as an update.Update. Adding information is only possible by adding it as an update.Update. (Basically a Context is an extensible LCF-style kernel.)
There are several inferences in our LK proofs for which it is not enough that are syntactically valid: An induction inference might follow the syntactical scheme of an induction inference and satisfy the eigenvariable criterion, however if it excludes a constructor of the inductive type, then it still allows us to prove non-theorems. The same is also true for definition rules and theory axioms.
Hence we store all information necessary to validate these inferences inside a Context object. For completeness, it also includes the collection of constant symbols.
Having this information available is also important for a second reason: it allows us make decisions based on the current context:
- The induction tactic uses the information about inductive types to create the necessary subgoals.
- The Babel parser uses the information about constants to decide whether a free identifier is a variable or a constant, and if it is a constant, what type it should have.
- The unfold tactic uses the information about definitions to unfold them.
- The inductive prover can automatically generate random instances for base types.
- gapt.proofs.expansion.ExpansionProofToLK uses the information about the background theory to produce LK proofs modulo the background theory.
- Source
- Context.scala
- Alphabetic
- By Inheritance
- Context
- BabelSignature
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def state: State
Retrieves the context's current state.
Retrieves the context's current state.
- returns
The context's current state.
- abstract def toImmutable: ImmutableContext
Converts this context into an immutable context.
Converts this context into an immutable context.
- returns
A new immutable context that equals this context at the time of calling this method.
- abstract def updates: List[Update]
Retrieves the updates that have been applied to this context.
Retrieves the updates that have been applied to this context.
- returns
A list of updates with newer updates occurring before older ones.
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- def +(update: Update): ImmutableContext
Applies an update to this context.
Applies an update to this context.
- update
The update to be applied to this context.
- returns
An immutable context obtained by converting this context to an immutable context and by applying the update to that context.
- def ++(updates: Iterable[Update]): ImmutableContext
Applies several updates to the context.
Applies several updates to the context.
- updates
The updates to be applied to the context.
- returns
An immutable context obtained by applying iteratively applying the updates from left to right.
- def ->[B](y: B): (Context, B)
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def check[T](t: T)(implicit arg0: Checkable[T]): Unit
Checks an object with respect to this context.
Checks an object with respect to this context.
This method checks whether a given object is correctly constructed according to this context. For example for a type to check against a context the base types occurring in that type must all be declared in the context.
- T
The type of object to be checked.
- t
The object to be checked.
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
- def conditionalReductionRules: Iterable[ConditionalReductionRule]
Retrieves all expression-level conditional reduction rules.
Retrieves all expression-level conditional reduction rules.
- returns
Returns all the expression-level conditional reduction rules currently stored in this context.
- def constant(name: String, params: List[Ty]): Option[Const]
Retrieves constants by name and type parameters.
Retrieves constants by name and type parameters.
- name
The name for which a constant is to be looked up.
- params
The type parameters for which a constant is to be looked up.
- returns
Returns
Some ( c )
if the context currently contains a constantc
with namename
and type parametersparams
. OtherwiseNone
is returned.
- def constant(name: String): Option[Const]
Retrieves constants by name.
Retrieves constants by name.
- name
The name for which a constant is to be looked up.
- returns
Returns
Some( c )
wherec.name
equalsname
if the context currently contains such a constantc
, otherwiseNone
is retured.
- def constants: Iterable[Const]
Retrieves all the constants defined in this context.
Retrieves all the constants defined in this context.
- returns
A list of all the constants that are currently defined in this context.
- def contains(defn: Definition): Boolean
Checks whether the context contains a given definition.
Checks whether the context contains a given definition.
- defn
The definition that is to be checked.
- returns
Returns
true
if the given definition is an instance of a definition stored in this context.
- def defaultTypeToI: Boolean
- Definition Classes
- Context → BabelSignature
- def definition(c: Const): Option[Expr]
Looks up the definition of a constant.
Looks up the definition of a constant.
- c
The constant with type arguments
args
whose definition is to be looked up.- returns
If the constant
c
has a definition, thenSome( definition )
is returned wheredefinition
is obtained from the definition ofc
by instantiating the type variables according to args.
- def definitions: Map[Const, Expr]
Retrieves all the definitions of this context.
Retrieves all the definitions of this context.
- returns
The current definitions saved by this context i.e. a map associating constants with expressions.
- def ensuring(cond: (Context) => Boolean, msg: => Any): Context
- def ensuring(cond: (Context) => Boolean): Context
- def ensuring(cond: Boolean, msg: => Any): Context
- def ensuring(cond: Boolean): Context
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def get[T](implicit arg0: Facet[T]): T
Retrieves a facet of this context.
Retrieves a facet of this context.
- T
The facet's type.
- returns
Returns the facet associated with the given type. If this facet is not present yet, it is initialized and its initial value is returned.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- def getConstructors(ty: TBase): Option[Vector[Const]]
Looks up inductive type constructors for a given base type.
Looks up inductive type constructors for a given base type.
- ty
The base type whose type constructors are to be looked up.
- returns
Returns
Some( ctrs )
ifty
is an inductive type having constructorsctrs
, otherwiseNone
is returned.
- def getConstructors(ty: Ty): Option[Vector[Const]]
Retrieves inductive type constructors for a given type.
Retrieves inductive type constructors for a given type.
- ty
The type whose inductive type constructors are to be looked up.
- returns
Returns
Some( ctrs )
ifty
is an inductive type having constructorsctrs
, otherwiseNone
is returned.
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- def isDefEq(a: Expr, b: Expr): Boolean
Checks if two expressions normalize to the same expression.
Checks if two expressions normalize to the same expression.
- a
An expression to be checked.
- b
An expression to be checked.
- returns
Returns
true
if and only ifa
andb
normalize to the same expression in this context.
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isType(ty: TBase): Boolean
Checks whether the given base type is defined in this context.
Checks whether the given base type is defined in this context.
- ty
The base type that is to be checked.
- returns
true
ifty
is defined in this context,false
otherwise.
- def names: Iterable[String]
Retrieves all the names declared in this context.
Retrieves all the names declared in this context.
- returns
All the names currently declared in this context.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def newMutable: MutableContext
Converts this context into a mutable context.
Converts this context into a mutable context.
- returns
A new mutable context that equals this context at the time of calling this method.
- def newNameGenerator: NameGenerator
Creates a new name generator for this context.
Creates a new name generator for this context.
- returns
A new name generator that avoids all the names currently defined in the context.
- def normalize(expression: Expr): Expr
Normalizes an expression.
Normalizes an expression.
- expression
The expression to be normalized.
- returns
An expression obtained by normalizing
expression
according to the reduction rules currently stored in this context.
- def normalizer: Normalizer
The context's normalizer.
The context's normalizer.
- returns
The context's normalizer.
- def notationsForConst(const: ConstName): List[Notation]
- Definition Classes
- Context → BabelSignature
- def notationsForToken(token: Token): Option[Notation]
- Definition Classes
- Context → BabelSignature
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- def reductionRules: Iterable[ReductionRule]
Retrieves all expression-level reduction rules.
Retrieves all expression-level reduction rules.
- returns
Returns all the expression-level reduction rules currently stored in this context.
- def signatureLookup(s: String): VarConst
Decides whether the symbol with the given identifier should be a variable or constant, and what its type should be.
Decides whether the symbol with the given identifier should be a variable or constant, and what its type should be.
- s
The name of the symbol.
- returns
Either IsVar(type) or IsConst(type).
- Definition Classes
- Context → BabelSignature
- def skolemDef(skSym: Const): Option[Expr]
Retrieves the skolem definition of a constant.
Retrieves the skolem definition of a constant.
- skSym
The constant whose definition is to be looked up.
- returns
Returns
Some(definition)
if the constantskSym
is a skolem function with definitiondefinition
.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toReadonly: ReadOnlyMutableContext
Converts this context to a read-only context.
Converts this context to a read-only context.
- returns
A new read-only context that is equal to this context at the time of invoking this method.
- def toString(): String
- Definition Classes
- Context → 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])
- def whnf(expression: Expr): Expr
Reduces an expression to WHNF.
Reduces an expression to WHNF.
- expression
The expression to be reduced to WHNF.
- returns
An expression reduced to WHNF according to the reduction rules currently stored in this context.
Shadowed Implicit Value Members
- def +(other: String): String
- Implicit
- This member is added by an implicit conversion from Context toany2stringadd[Context] performed by method any2stringadd in scala.Predef.
- Shadowing
- This implicitly inherited member is shadowed by one or more members in this class.
To access this member you can use a type ascription:(context: any2stringadd[Context]).+(other)
- Definition Classes
- any2stringadd
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
- def formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from Context toStringFormat[Context] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @deprecated @inline()
- Deprecated
(Since version 2.12.16) Use
formatString.format(value)
instead ofvalue.formatted(formatString)
, or use thef""
string interpolator. In Java 15 and later,formatted
resolves to the new method in String which has reversed parameters.
- def →[B](y: B): (Context, B)
- Implicit
- This member is added by an implicit conversion from Context toArrowAssoc[Context] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use
->
instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.
This is the API documentation for GAPT.
The main package is gapt.