Package com.microsoft.z3
Class Model
- java.lang.Object
-
- com.microsoft.z3.Z3Object
-
- com.microsoft.z3.Model
-
public class Model extends Z3Object
A Model contains interpretations (assignments) of constants and functions.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classModel.ModelEvaluationFailedExceptionA ModelEvaluationFailedException is thrown when an expression cannot be evaluated by the model.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Expreval(Expr t, boolean completion)Evaluates the expressiontin the current model.Exprevaluate(Expr t, boolean completion)Alias forEval.FuncDecl[]getConstDecls()The function declarations of the constants in the model.ExprgetConstInterp(Expr a)Retrieves the interpretation (the assignment) ofain the model.ExprgetConstInterp(FuncDecl f)Retrieves the interpretation (the assignment) offin the model.FuncDecl[]getDecls()All symbols that have an interpretation in the model.FuncDecl[]getFuncDecls()The function declarations of the function interpretations in the model.FuncInterpgetFuncInterp(FuncDecl f)Retrieves the interpretation (the assignment) of a non-constantfin the model.intgetNumConsts()The number of constants that have an interpretation in the model.intgetNumFuncs()The number of function interpretations in the model.intgetNumSorts()The number of uninterpreted sorts that the model has an interpretation for.Sort[]getSorts()The uninterpreted sorts that the model has an interpretation for.Expr[]getSortUniverse(Sort s)The finite set of distinct values that represent the interpretation for sorts.StringtoString()Conversion of models to strings.-
Methods inherited from class com.microsoft.z3.Z3Object
arrayLength, arrayToNative
-
-
-
-
Method Detail
-
getConstInterp
public Expr getConstInterp(Expr a)
Retrieves the interpretation (the assignment) ofain the model.- Parameters:
a- A Constant- Returns:
- An expression if the constant has an interpretation in the model, null otherwise.
- Throws:
Z3Exception
-
getConstInterp
public Expr getConstInterp(FuncDecl f)
Retrieves the interpretation (the assignment) offin the model.- Parameters:
f- A function declaration of zero arity- Returns:
- An expression if the function has an interpretation in the model, null otherwise.
- Throws:
Z3Exception
-
getFuncInterp
public FuncInterp getFuncInterp(FuncDecl f)
Retrieves the interpretation (the assignment) of a non-constantfin the model.- Parameters:
f- A function declaration of non-zero arity- Returns:
- A FunctionInterpretation if the function has an interpretation in the model, null otherwise.
- Throws:
Z3Exception
-
getNumConsts
public int getNumConsts()
The number of constants that have an interpretation in the model.
-
getConstDecls
public FuncDecl[] getConstDecls()
The function declarations of the constants in the model.- Throws:
Z3Exception
-
getNumFuncs
public int getNumFuncs()
The number of function interpretations in the model.
-
getFuncDecls
public FuncDecl[] getFuncDecls()
The function declarations of the function interpretations in the model.- Throws:
Z3Exception
-
getDecls
public FuncDecl[] getDecls()
All symbols that have an interpretation in the model.- Throws:
Z3Exception
-
eval
public Expr eval(Expr t, boolean completion)
Evaluates the expressiontin the current model. Remarks: This function may fail iftcontains quantifiers, is partial (MODEL_PARTIAL enabled), or iftis not well-sorted. In this case aModelEvaluationFailedExceptionis thrown.- Parameters:
t- the expression to evaluatecompletion- An expressioncompletionWhen this flag is enabled, a model value will be assigned to any constant or function that does not have an interpretation in the model.- Returns:
- The evaluation of
tin the model. - Throws:
Z3Exception
-
evaluate
public Expr evaluate(Expr t, boolean completion)
Alias forEval.- Throws:
Z3Exception
-
getNumSorts
public int getNumSorts()
The number of uninterpreted sorts that the model has an interpretation for.
-
getSorts
public Sort[] getSorts()
The uninterpreted sorts that the model has an interpretation for. Remarks: Z3 also provides an interpretation for uninterpreted sorts used in a formula. The interpretation for a sort is a finite set of distinct values. We say this finite set is the "universe" of the sort.- Throws:
Z3Exception- See Also:
getNumSorts(),getSortUniverse(com.microsoft.z3.Sort)
-
getSortUniverse
public Expr[] getSortUniverse(Sort s)
The finite set of distinct values that represent the interpretation for sorts.- Parameters:
s- An uninterpreted sort- Returns:
- An array of expressions, where each is an element of the universe
of
s - Throws:
Z3Exception
-
-