mirror of
https://github.com/Z3Prover/z3
synced 2025-04-25 18:15:32 +00:00
integrate lambda expressions
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
bf4edef761
commit
520ce9a5ee
139 changed files with 2243 additions and 1506 deletions
|
@ -141,6 +141,7 @@ set(Z3_JAVA_JAR_SOURCE_FILES
|
|||
IntNum.java
|
||||
IntSort.java
|
||||
IntSymbol.java
|
||||
Lambda.java
|
||||
ListSort.java
|
||||
Log.java
|
||||
ModelDecRefQueue.java
|
||||
|
|
|
@ -518,7 +518,7 @@ public class Context implements AutoCloseable {
|
|||
|
||||
/**
|
||||
* Creates a fresh constant function declaration with a name prefixed with
|
||||
* {@code prefix"}.
|
||||
* {@code prefix}.
|
||||
* @see #mkFuncDecl(String,Sort,Sort)
|
||||
* @see #mkFuncDecl(String,Sort[],Sort)
|
||||
**/
|
||||
|
@ -696,7 +696,7 @@ public class Context implements AutoCloseable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates the equality {@code x"/> = <paramref name="y}.
|
||||
* Creates the equality {@code x = y}
|
||||
**/
|
||||
public BoolExpr mkEq(Expr x, Expr y)
|
||||
{
|
||||
|
@ -2498,6 +2498,40 @@ public class Context implements AutoCloseable {
|
|||
quantifierID, skolemID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a lambda expression.
|
||||
*
|
||||
* {@code sorts} is an array
|
||||
* with the sorts of the bound variables, {@code names} is an array with the
|
||||
* 'names' of the bound variables, and {@code body} is the body of the
|
||||
* lambda.
|
||||
* Note that the bound variables are de-Bruijn indices created using {@see #MkBound}
|
||||
* Z3 applies the convention that the last element in {@code names} and
|
||||
* {@code sorts} refers to the variable with index 0, the second to last element
|
||||
* of {@code names} and {@code sorts} refers to the variable
|
||||
* with index 1, etc.
|
||||
*
|
||||
* @param sorts the sorts of the bound variables.
|
||||
* @param names names of the bound variables.
|
||||
* @param body the body of the quantifier.
|
||||
**/
|
||||
public Lambda mkLambda(Sort[] sorts, Symbol[] names, Expr body)
|
||||
{
|
||||
return Lambda.of(this, sorts, names, body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a lambda expression.
|
||||
*
|
||||
* Creates a lambda expression using a list of constants that will
|
||||
* form the set of bound variables.
|
||||
**/
|
||||
public Lambda mkLambda(Expr[] boundConstants, Expr body)
|
||||
{
|
||||
return Lambda.of(this, boundConstants, body);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selects the format used for pretty-printing expressions.
|
||||
* Remarks: The
|
||||
|
@ -2653,7 +2687,7 @@ public class Context implements AutoCloseable {
|
|||
|
||||
/**
|
||||
* Create a tactic that applies {@code t1} to a Goal and then
|
||||
* {@code t2"/> to every subgoal produced by <paramref name="t1}.
|
||||
* {@code t2} to every subgoal produced by {@code t1}
|
||||
**/
|
||||
public Tactic andThen(Tactic t1, Tactic t2, Tactic... ts)
|
||||
|
||||
|
@ -2734,7 +2768,7 @@ public class Context implements AutoCloseable {
|
|||
|
||||
/**
|
||||
* Create a tactic that applies {@code t1} to a given goal if the
|
||||
* probe {@code p"/> evaluates to true and <paramref name="t2}
|
||||
* probe {@code p} evaluates to true and {@code t2}
|
||||
* otherwise.
|
||||
**/
|
||||
public Tactic cond(Probe p, Tactic t1, Tactic t2)
|
||||
|
@ -2895,7 +2929,7 @@ public class Context implements AutoCloseable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Create a probe that evaluates to "true" when the value returned by
|
||||
* Create a probe that evaluates to {@code true} when the value returned by
|
||||
* {@code p1} is less than the value returned by {@code p2}
|
||||
**/
|
||||
public Probe lt(Probe p1, Probe p2)
|
||||
|
@ -2907,7 +2941,7 @@ public class Context implements AutoCloseable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Create a probe that evaluates to "true" when the value returned by
|
||||
* Create a probe that evaluates to {@code true} when the value returned by
|
||||
* {@code p1} is greater than the value returned by {@code p2}
|
||||
**/
|
||||
public Probe gt(Probe p1, Probe p2)
|
||||
|
@ -2919,7 +2953,7 @@ public class Context implements AutoCloseable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Create a probe that evaluates to "true" when the value returned by
|
||||
* Create a probe that evaluates to {@code true} when the value returned by
|
||||
* {@code p1} is less than or equal the value returned by
|
||||
* {@code p2}
|
||||
**/
|
||||
|
@ -2932,7 +2966,7 @@ public class Context implements AutoCloseable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Create a probe that evaluates to "true" when the value returned by
|
||||
* Create a probe that evaluates to {@code true} when the value returned by
|
||||
* {@code p1} is greater than or equal the value returned by
|
||||
* {@code p2}
|
||||
**/
|
||||
|
@ -2945,7 +2979,7 @@ public class Context implements AutoCloseable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Create a probe that evaluates to "true" when the value returned by
|
||||
* Create a probe that evaluates to {@code true} when the value returned by
|
||||
* {@code p1} is equal to the value returned by {@code p2}
|
||||
**/
|
||||
public Probe eq(Probe p1, Probe p2)
|
||||
|
@ -2957,7 +2991,7 @@ public class Context implements AutoCloseable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Create a probe that evaluates to "true" when the value {@code p1} and {@code p2} evaluate to "true".
|
||||
* Create a probe that evaluates to {@code true} when the value {@code p1} and {@code p2} evaluate to {@code true}.
|
||||
**/
|
||||
public Probe and(Probe p1, Probe p2)
|
||||
{
|
||||
|
@ -2968,7 +3002,7 @@ public class Context implements AutoCloseable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Create a probe that evaluates to "true" when the value {@code p1} or {@code p2} evaluate to "true".
|
||||
* Create a probe that evaluates to {@code true} when the value {@code p1} or {@code p2} evaluate to {@code true}.
|
||||
**/
|
||||
public Probe or(Probe p1, Probe p2)
|
||||
{
|
||||
|
@ -2979,7 +3013,7 @@ public class Context implements AutoCloseable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Create a probe that evaluates to "true" when the value {@code p} does not evaluate to "true".
|
||||
* Create a probe that evaluates to {@code true} when the value {@code p} does not evaluate to {@code true}.
|
||||
**/
|
||||
public Probe not(Probe p)
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@ public class Quantifier extends BoolExpr
|
|||
**/
|
||||
public boolean isExistential()
|
||||
{
|
||||
return !isUniversal();
|
||||
return Native.isQuantifierExists(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue