public final class LogicChecking
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static LogicChecking |
createChecker(ClassSymbol csymbol,
Environment penv,
ErrorStream error)
Create checker for processing logical entities in environment set up
by the (already processed) local theory of a class.
|
static LogicChecking |
createChecker(ErrorStream error)
Create checker for processing logical entities in empty environment.
|
LogicEnvironment |
getLogicEnvironment()
Get the environment for looking up logic symbols.
|
TCCGenerator |
getTCCGenerator()
Get the generator for producing type checking conditions
|
boolean |
hasIntType(Term term,
Type type,
boolean gen)
Checks if term has type INT, may generate type checking condition.
|
boolean |
hasNatType(Term term,
Type type,
boolean gen)
Checks if term has type NAT, may generate type checking condition.
|
static boolean |
isBooleanType(Type type)
Check whether type denotes a boolean.
|
static boolean |
isIntegerType(Type type)
Determine whether type is (a subtype of) the integer type.
|
boolean |
process(Declaration[] decls)
Type-check declaration sequence in current theory.
|
boolean |
process(Formula formula)
Type-check formula in current theory.
|
Type |
process(Term term)
Type-check term in current theory and, as a side effect,
annotate the term with the type.
|
static boolean |
process(TheorySymbol tsymbol,
ErrorStream error)
Process the theory symbol i.e.
|
Type |
process(Type type)
Process type expression in current theory.
|
boolean |
processFormula(Formula formula)
Process formula and create type-checking conditions in context
set up by setStateContext().
|
boolean |
processIntTerm(Term term)
Process term denoting an integer number and create type-checking
conditions in context set up by setStateContext().
|
Type |
processTermCore(Term term)
Type-check term in current theory and, as a side effect,
annotate the term with the type.
|
void |
resetStateContext()
Reset the program state context.
|
void |
setStateContext(Formula pre,
StateType type,
Name[] vars,
Name[] excs,
TaskFolder folder)
Set the current program state context.
|
Type |
subType(Type type0,
Type type1)
Returns greatest lower bound of type0 and type1 (null, if none exists);
does not generate tccs.
|
static boolean |
validDefinitionType(Type type)
decide whether definition type is first order, i.e.,
- a function type is only allowed at the top level
- the type BOOLEAN is only allowed at the top level
or as the range of the function type
|
static boolean |
validTermType(Type type)
decide whether type does not contain a function type or BOOLEAN.
|
public static boolean process(TheorySymbol tsymbol, ErrorStream error)
tsymbol
- the theory symbol with a non-empty declaration.error
- the stream on which to write the error messages.public static LogicChecking createChecker(ClassSymbol csymbol, Environment penv, ErrorStream error)
csymbol
- the class symbolpenv
- the program environment used by the checker.error
- the stream on which to write error messages.public static LogicChecking createChecker(ErrorStream error)
error
- the stream on which to write error messages.public LogicEnvironment getLogicEnvironment()
public TCCGenerator getTCCGenerator()
public void setStateContext(Formula pre, StateType type, Name[] vars, Name[] excs, TaskFolder folder)
pre
- the precondition of the method (may be null).type
- the current state type (may be null).vars
- the variable frame of the current program state (may be null).excs
- the exceptions of the current program state (may be null).folder
- the folder for generating type checking conditionspublic void resetStateContext()
public static boolean validDefinitionType(Type type)
type
- an already processed type arising from a type definitionpublic static boolean validTermType(Type type)
type
- an already processed typepublic boolean processFormula(Formula formula)
formula
- the formula to be processed.public boolean processIntTerm(Term term)
term
- the term to be processed.public boolean process(Declaration[] decls)
decls
- the declarations to be type-checked.public boolean process(Formula formula)
formula
- the formula to be type-checked.public Type process(Term term)
term
- the term to be type-checked.public Type processTermCore(Term term)
term
- the term to be type-checked.public Type process(Type type)
type
- the type expression to be type-checked.public boolean hasNatType(Term term, Type type, boolean gen)
term
- the term (may be null, if gen is false).type
- its type determined by the type checker.gen
- true if type checking condition may be generated.public boolean hasIntType(Term term, Type type, boolean gen)
term
- the term (may be null, if gen is false).type
- its type determined by the type checker.gen
- true if type checking condition may be generated.public Type subType(Type type0, Type type1)
type0
- a typetype1
- a typepublic static boolean isIntegerType(Type type)
type
- the type.public static boolean isBooleanType(Type type)
type
- the type.