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.
Attributes
- Companion
- object
- Source
- Context.scala
- Graph
-
- Supertypes
- Known subtypes
-
class ImmutableContextclass MutableContext
Members list
Value members
Abstract methods
Retrieves the context's current state.
Retrieves the context's current state.
Attributes
- Returns
-
The context's current state.
- Source
- Context.scala
Converts this context into an immutable context.
Converts this context into an immutable context.
Attributes
- Returns
-
A new immutable context that equals this context at the time of calling this method.
- Source
- Context.scala
Retrieves the updates that have been applied to this context.
Retrieves the updates that have been applied to this context.
Attributes
- Returns
-
A list of updates with newer updates occurring before older ones.
- Source
- Context.scala
Concrete methods
Applies an update to this context.
Applies an update to this context.
Value parameters
- update
-
The update to be applied to this context.
Attributes
- Returns
-
An immutable context obtained by converting this context to an immutable context and by applying the update to that context.
- Source
- Context.scala
Applies several updates to the context.
Applies several updates to the context.
Value parameters
- updates
-
The updates to be applied to the context.
Attributes
- Returns
-
An immutable context obtained by applying iteratively applying the updates from left to right.
- Source
- Context.scala
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.
Type parameters
- T
-
The type of object to be checked.
Value parameters
- t
-
The object to be checked.
Attributes
- Source
- Context.scala
Retrieves all expression-level conditional reduction rules.
Retrieves all expression-level conditional reduction rules.
Attributes
- Returns
-
Returns all the expression-level conditional reduction rules currently stored in this context.
- Source
- Context.scala
Retrieves constants by name.
Retrieves constants by name.
Value parameters
- name
-
The name for which a constant is to be looked up.
Attributes
- Returns
-
Returns
Some( c )wherec.nameequalsnameif the context currently contains such a constantc, otherwiseNoneis retured. - Source
- Context.scala
Retrieves constants by name and type parameters.
Retrieves constants by name and type parameters.
Value 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.
Attributes
- Returns
-
Returns
Some ( c )if the context currently contains a constantcwith namenameand type parametersparams. OtherwiseNoneis returned. - Source
- Context.scala
Retrieves all the constants defined in this context.
Retrieves all the constants defined in this context.
Attributes
- Returns
-
A list of all the constants that are currently defined in this context.
- Source
- Context.scala
Checks whether the context contains a given definition.
Checks whether the context contains a given definition.
Value parameters
- defn
-
The definition that is to be checked.
Attributes
- Returns
-
Returns
trueif the given definition is an instance of a definition stored in this context. - Source
- Context.scala
Attributes
- Source
- Context.scala
Looks up the definition of a constant.
Looks up the definition of a constant.
Value parameters
- c
-
The constant with type arguments
argswhose definition is to be looked up.
Attributes
- Returns
-
If the constant
chas a definition, thenSome( definition )is returned wheredefinitionis obtained from the definition ofcby instantiating the type variables according to args. - Source
- Context.scala
Retrieves all the definitions of this context.
Retrieves all the definitions of this context.
Attributes
- Returns
-
The current definitions saved by this context i.e. a map associating constants with expressions.
- Source
- Context.scala
Retrieves a facet of this context.
Retrieves a facet of this context.
Type parameters
- T
-
The facet's type.
Attributes
- 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.
- Source
- Context.scala
Retrieves inductive type constructors for a given type.
Retrieves inductive type constructors for a given type.
Value parameters
- ty
-
The type whose inductive type constructors are to be looked up.
Attributes
- Returns
-
Returns
Some( ctrs )iftyis an inductive type having constructorsctrs, otherwiseNoneis returned. - Source
- Context.scala
Looks up inductive type constructors for a given base type.
Looks up inductive type constructors for a given base type.
Value parameters
- ty
-
The base type whose type constructors are to be looked up.
Attributes
- Returns
-
Returns
Some( ctrs )iftyis an inductive type having constructorsctrs, otherwiseNoneis returned. - Source
- Context.scala
Checks if two expressions normalize to the same expression.
Checks if two expressions normalize to the same expression.
Value parameters
- a
-
An expression to be checked.
- b
-
An expression to be checked.
Attributes
- Returns
-
Returns
trueif and only ifaandbnormalize to the same expression in this context. - Source
- Context.scala
Checks whether the given base type is defined in this context.
Checks whether the given base type is defined in this context.
Value parameters
- ty
-
The base type that is to be checked.
Attributes
- Returns
-
trueiftyis defined in this context,falseotherwise. - Source
- Context.scala
Retrieves all the names declared in this context.
Retrieves all the names declared in this context.
Attributes
- Returns
-
All the names currently declared in this context.
- Source
- Context.scala
Converts this context into a mutable context.
Converts this context into a mutable context.
Attributes
- Returns
-
A new mutable context that equals this context at the time of calling this method.
- Source
- Context.scala
Creates a new name generator for this context.
Creates a new name generator for this context.
Attributes
- Returns
-
A new name generator that avoids all the names currently defined in the context.
- Source
- Context.scala
Normalizes an expression.
Normalizes an expression.
Value parameters
- expression
-
The expression to be normalized.
Attributes
- Returns
-
An expression obtained by normalizing
expressionaccording to the reduction rules currently stored in this context. - Source
- Context.scala
The context's normalizer.
Attributes
- Source
- Context.scala
Attributes
- Source
- Context.scala
Retrieves all expression-level reduction rules.
Retrieves all expression-level reduction rules.
Attributes
- Returns
-
Returns all the expression-level reduction rules currently stored in this context.
- Source
- Context.scala
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.
Value parameters
- s
-
The name of the symbol.
Attributes
- Returns
-
Either IsVar(type) or IsConst(type).
- Source
- Context.scala
Retrieves the skolem definition of a constant.
Retrieves the skolem definition of a constant.
Value parameters
- skSym
-
The constant whose definition is to be looked up.
Attributes
- Returns
-
Returns
Some(definition)if the constantskSymis a skolem function with definitiondefinition. - Source
- Context.scala
Converts this context to a read-only context.
Converts this context to a read-only context.
Attributes
- Returns
-
A new read-only context that is equal to this context at the time of invoking this method.
- Source
- Context.scala
Returns a string representation of the object.
Returns a string representation of the object.
The default representation is platform dependent.
Attributes
- Returns
-
a string representation of the object.
- Definition Classes
-
Any
- Source
- Context.scala
Reduces an expression to WHNF.
Reduces an expression to WHNF.
Value parameters
- expression
-
The expression to be reduced to WHNF.
Attributes
- Returns
-
An expression reduced to WHNF according to the reduction rules currently stored in this context.
- Source
- Context.scala