本文整理汇总了C#中Microsoft.Z3.FuncDecl类的典型用法代码示例。如果您正苦于以下问题:C# FuncDecl类的具体用法?C# FuncDecl怎么用?C# FuncDecl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FuncDecl类属于Microsoft.Z3命名空间,在下文中一共展示了FuncDecl类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AcceptorBase
internal AcceptorBase(FuncDecl symbol, Expr guard, ExprSet[] lookahead)
{
this.symbol = symbol;
this.guard = guard;
this.lookahead = lookahead;
this.lhs = new Pair<FuncDecl, Sequence<ExprSet>>(symbol, new Sequence<ExprSet>(lookahead));
}
开发者ID:AutomataDotNet,项目名称:Automata,代码行数:7,代码来源:TreeRule.cs
示例2: RegisterRelation
/// <summary>
/// Register predicate as recursive relation.
/// </summary>
public void RegisterRelation(FuncDecl f)
{
Contract.Requires(f != null);
Context.CheckContextMatch(f);
Native.Z3_fixedpoint_register_relation(Context.nCtx, NativeObject, f.NativeObject);
}
开发者ID:abhishekudupa,项目名称:z3-4.3.1,代码行数:10,代码来源:Fixedpoint.cs
示例3: AddFuncDecl
internal void AddFuncDecl(FuncDecl funcDecl, string name, params object[] keys)
{
object[] objs = new object[keys.Length + 1];
objs[0] = name;
Array.Copy(keys, 0, objs, 1, keys.Length);
var s = new Sequence<object>(objs);
funcDecls.Add(new Sequence<object>(objs), funcDecl);
}
开发者ID:AutomataDotNet,项目名称:Automata,代码行数:8,代码来源:DeclaredFuncDecls.cs
示例4: BinaryTreeInfo
public BinaryTreeInfo(FuncDecl mkTree, FuncDecl mkLeaf,
FuncDecl getLeafValue, FuncDecl isTree, FuncDecl isLeaf,
FuncDecl getLeft, FuncDecl getRight)
{
this.MkTree = mkTree;
this.GetLeft = getLeft;
this.GetRight = getRight;
this.MkLeaf = mkLeaf;
this.GetLeafValue = getLeafValue;
this.IsTree = isTree;
this.IsLeaf = isLeaf;
}
开发者ID:AutomataDotNet,项目名称:Automata,代码行数:12,代码来源:TreeInfo.cs
示例5: InjAxiom
/// <summary>
/// Create axiom: function f is injective in the i-th argument.
/// </summary>
/// <remarks>
/// The following axiom is produced:
/// <c>
/// forall (x_0, ..., x_n) finv(f(x_0, ..., x_i, ..., x_{n-1})) = x_i
/// </c>
/// Where, <code>finv</code>is a fresh function declaration.
/// </summary>
public static BoolExpr InjAxiom(Context ctx, FuncDecl f, int i)
{
Sort[] domain = f.Domain;
uint sz = f.DomainSize;
if (i >= sz)
{
Console.WriteLine("failed to create inj axiom");
return null;
}
/* declare the i-th inverse of f: finv */
Sort finv_domain = f.Range;
Sort finv_range = domain[i];
FuncDecl finv = ctx.MkFuncDecl("f_fresh", finv_domain, finv_range);
/* allocate temporary arrays */
Expr[] xs = new Expr[sz];
Symbol[] names = new Symbol[sz];
Sort[] types = new Sort[sz];
/* fill types, names and xs */
for (uint j = 0; j < sz; j++)
{
types[j] = domain[j];
names[j] = ctx.MkSymbol(String.Format("x_{0}", j));
xs[j] = ctx.MkBound(j, types[j]);
}
Expr x_i = xs[i];
/* create f(x_0, ..., x_i, ..., x_{n-1}) */
Expr fxs = f[xs];
/* create f_inv(f(x_0, ..., x_i, ..., x_{n-1})) */
Expr finv_fxs = finv[fxs];
/* create finv(f(x_0, ..., x_i, ..., x_{n-1})) = x_i */
Expr eq = ctx.MkEq(finv_fxs, x_i);
/* use f(x_0, ..., x_i, ..., x_{n-1}) as the pattern for the quantifier */
Pattern p = ctx.MkPattern(new Expr[] { fxs });
/* create & assert quantifier */
BoolExpr q = ctx.MkForall(
types, /* types of quantified variables */
names, /* names of quantified variables */
eq,
1,
new Pattern[] { p } /* patterns */);
return q;
}
开发者ID:perillaseed,项目名称:z3,代码行数:63,代码来源:Program.cs
示例6: TryGetFuncDecl
internal bool TryGetFuncDecl(out FuncDecl funcDecl, string name, params object[] keys)
{
object[] objs = new object[keys.Length + 1];
objs[0] = name;
Array.Copy(keys, 0, objs, 1, keys.Length);
Sequence<object> s = new Sequence<object>(objs);
if (funcDecls.TryGetValue(s, out funcDecl))
return true;
funcDecl = null;
return false;
}
开发者ID:AutomataDotNet,项目名称:Automata,代码行数:13,代码来源:DeclaredFuncDecls.cs
示例7: ConstInterp
/// <summary>
/// Retrieves the interpretation (the assignment) of <paramref name="f"/> in the model.
/// </summary>
/// <param name="f">A function declaration of zero arity</param>
/// <returns>An expression if the function has an interpretation in the model, null otherwise.</returns>
public Expr ConstInterp(FuncDecl f)
{
Contract.Requires(f != null);
Context.CheckContextMatch(f);
if (f.Arity != 0 ||
Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_range(Context.nCtx, f.NativeObject)) == (uint)Z3_sort_kind.Z3_ARRAY_SORT)
throw new Z3Exception("Non-zero arity functions and arrays have FunctionInterpretations as a model. Use FuncInterp.");
IntPtr n = Native.Z3_model_get_const_interp(Context.nCtx, NativeObject, f.NativeObject);
if (n == IntPtr.Zero)
return null;
else
return Expr.Create(Context, n);
}
开发者ID:abhishekudupa,项目名称:z3-4.3.1,代码行数:20,代码来源:Model.cs
示例8: RankedAlphabet
internal RankedAlphabet(
TreeTheory tt,
string[] symbols,
Dictionary<string, int> idMap,
Sort alphabetSort,
Sort nodeSort,
int[] ranks,
FuncDecl[] constructors,
FuncDecl[][] accessors,
FuncDecl[] testers,
FuncDecl acceptor,
Expr[] vars
)
{
this.tt = tt;
this.symbols = new List<string>(symbols).AsReadOnly();
this.idMap = idMap;
this.alphabetSort = alphabetSort;
this.nodeSort = nodeSort;
this.ranks = ranks;
this.constructors = constructors;
this.accessors = accessors;
this.testers = testers;
this.acceptor = acceptor;
this.vars = vars;
this.trans = tt.GetTrans(alphabetSort, alphabetSort);
this.emptyAcceptor = TreeTransducer.MkEmpty(this);
this.fullAcceptor = TreeTransducer.MkFull(this);
this.idAut = TreeTransducer.MkId(this);
this.symbolsOfRank = new Dictionary<int, List<FuncDecl>>();
for (int i = 0; i < ranks.Length; i++)
{
var r = ranks[i];
if (!symbolsOfRank.ContainsKey(r))
symbolsOfRank[r] = new List<FuncDecl>();
symbolsOfRank[r].Add(constructors[i]);
}
var attrDomain = tt.Z.MkFreshFuncDecl("_", new Sort[] { nodeSort }, tt.Z.BoolSort);
this.attrExpr = tt.Z.MkApp(attrDomain, vars[0]);
tt.Z.AssertAxiom(this.attrExpr, tt.Z.True, vars[0]);
}
开发者ID:AutomataDotNet,项目名称:Automata,代码行数:43,代码来源:RankedAlphabet.cs
示例9: UnrankedTreeInfo
public UnrankedTreeInfo(Sort treeListSort, FuncDecl getNodeValue, FuncDecl getSubtrees, FuncDecl mkNode,
FuncDecl mkLeaf, FuncDecl getLeafValue, FuncDecl isNode, FuncDecl isLeaf,
Expr empty, FuncDecl first, FuncDecl rest,
FuncDecl cons, FuncDecl isEmpty, FuncDecl isCons)
{
this.TreeListSort = treeListSort;
this.GetNodeLabel = getNodeValue;
this.GetNodeSubtrees = getSubtrees;
this.MkNode = mkNode;
this.EmptyTreeList = empty;
this.GetFirst = first;
this.GetRest = rest;
this.MkCons = cons;
this.IsEmpty = isEmpty;
this.IsCons = isCons;
this.MkLeaf = mkLeaf;
this.GetLeafValue = getLeafValue;
this.IsNode = isNode;
this.IsLeaf = isLeaf;
}
开发者ID:AutomataDotNet,项目名称:Automata,代码行数:20,代码来源:TreeInfo.cs
示例10: FuncInterp
/// <summary>
/// Retrieves the interpretation (the assignment) of a non-constant <paramref name="f"/> in the model.
/// </summary>
/// <param name="f">A function declaration of non-zero arity</param>
/// <returns>A FunctionInterpretation if the function has an interpretation in the model, null otherwise.</returns>
public FuncInterp FuncInterp(FuncDecl f)
{
Contract.Requires(f != null);
Context.CheckContextMatch(f);
Z3_sort_kind sk = (Z3_sort_kind)Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_range(Context.nCtx, f.NativeObject));
if (f.Arity == 0)
{
IntPtr n = Native.Z3_model_get_const_interp(Context.nCtx, NativeObject, f.NativeObject);
if (sk == Z3_sort_kind.Z3_ARRAY_SORT)
{
if (n == IntPtr.Zero)
return null;
else
{
if (Native.Z3_is_as_array(Context.nCtx, n) == 0)
throw new Z3Exception("Argument was not an array constant");
IntPtr fd = Native.Z3_get_as_array_func_decl(Context.nCtx, n);
return FuncInterp(new FuncDecl(Context, fd));
}
}
else
{
throw new Z3Exception("Constant functions do not have a function interpretation; use ConstInterp");
}
}
else
{
IntPtr n = Native.Z3_model_get_func_interp(Context.nCtx, NativeObject, f.NativeObject);
if (n == IntPtr.Zero)
return null;
else
return new FuncInterp(Context, n);
}
}
开发者ID:abhishekudupa,项目名称:z3-4.3.1,代码行数:43,代码来源:Model.cs
示例11: Parameter
internal Parameter(Z3_parameter_kind k, FuncDecl fd)
{
this.kind = k;
this.fd = fd;
}
开发者ID:jawline,项目名称:z3,代码行数:5,代码来源:FuncDecl.cs
示例12: MkApp
/// <summary>
/// Create a new function application.
/// </summary>
public Expr MkApp(FuncDecl f, IEnumerable<Expr> args)
{
Contract.Requires(f != null);
Contract.Requires(args == null || Contract.ForAll(args, a => a != null));
Contract.Ensures(Contract.Result<Expr>() != null);
CheckContextMatch(f);
CheckContextMatch(args);
return Expr.Create(this, f, args.ToArray());
}
开发者ID:martin-neuhaeusser,项目名称:z3,代码行数:13,代码来源:Context.cs
示例13: AddCover
/// <summary>
/// Add <tt>property</tt> about the <tt>predicate</tt>.
/// The property is added at <tt>level</tt>.
/// </summary>
public void AddCover(int level, FuncDecl predicate, Expr property)
{
Native.Z3_fixedpoint_add_cover(Context.nCtx, NativeObject, level, predicate.NativeObject, property.NativeObject);
}
开发者ID:annachen368,项目名称:HadoopStreamingTester,代码行数:8,代码来源:Fixedpoint.cs
示例14: SetPredicateRepresentation
/// <summary>
/// Instrument the Datalog engine on which table representation to use for recursive predicate.
/// </summary>
public void SetPredicateRepresentation(FuncDecl f, Symbol[] kinds)
{
Contract.Requires(f != null);
Native.Z3_fixedpoint_set_predicate_representation(Context.nCtx, NativeObject,
f.NativeObject, AST.ArrayLength(kinds), Symbol.ArrayToNative(kinds));
}
开发者ID:annachen368,项目名称:HadoopStreamingTester,代码行数:10,代码来源:Fixedpoint.cs
示例15: Query
/// <summary>
/// Query the fixedpoint solver.
/// A query is an array of relations.
/// The query is satisfiable if there is an instance of some relation that is non-empty.
/// The query is unsatisfiable if there are no derivations satisfying any of the relations.
/// </summary>
public Status Query(FuncDecl[] relations)
{
Contract.Requires(relations != null);
Contract.Requires(Contract.ForAll(0, relations.Length, i => relations[i] != null));
Context.CheckContextMatch(relations);
Z3_lbool r = (Z3_lbool)Native.Z3_fixedpoint_query_relations(Context.nCtx, NativeObject,
AST.ArrayLength(relations), AST.ArrayToNative(relations));
switch (r)
{
case Z3_lbool.Z3_L_TRUE: return Status.SATISFIABLE;
case Z3_lbool.Z3_L_FALSE: return Status.UNSATISFIABLE;
default: return Status.UNKNOWN;
}
}
开发者ID:annachen368,项目名称:HadoopStreamingTester,代码行数:21,代码来源:Fixedpoint.cs
示例16: GetNumLevels
/// <summary>
/// Retrieve the number of levels explored for a given predicate.
/// </summary>
public uint GetNumLevels(FuncDecl predicate)
{
return Native.Z3_fixedpoint_get_num_levels(Context.nCtx, NativeObject, predicate.NativeObject);
}
开发者ID:annachen368,项目名称:HadoopStreamingTester,代码行数:7,代码来源:Fixedpoint.cs
示例17: GetCoverDelta
/// <summary>
/// Retrieve the cover of a predicate.
/// </summary>
public Expr GetCoverDelta(int level, FuncDecl predicate)
{
IntPtr res = Native.Z3_fixedpoint_get_cover_delta(Context.nCtx, NativeObject, level, predicate.NativeObject);
return (res == IntPtr.Zero) ? null : Expr.Create(Context, res);
}
开发者ID:annachen368,项目名称:HadoopStreamingTester,代码行数:8,代码来源:Fixedpoint.cs
示例18: AddFact
/// <summary>
/// Add table fact to the fixedpoint solver.
/// </summary>
public void AddFact(FuncDecl pred, params uint[] args)
{
Contract.Requires(pred != null);
Contract.Requires(args != null);
Context.CheckContextMatch(pred);
Native.Z3_fixedpoint_add_fact(Context.nCtx, NativeObject, pred.NativeObject, (uint)args.Length, args);
}
开发者ID:annachen368,项目名称:HadoopStreamingTester,代码行数:11,代码来源:Fixedpoint.cs
示例19: ParseSMTLIBString
/// <summary>
/// Parse the given string using the SMT-LIB parser.
/// </summary>
/// <remarks>
/// The symbol table of the parser can be initialized using the given sorts and declarations.
/// The symbols in the arrays <paramref name="sortNames"/> and <paramref name="declNames"/>
/// don't need to match the names of the sorts and declarations in the arrays <paramref name="sorts"/>
/// and <paramref name="decls"/>. This is a useful feature since we can use arbitrary names to
/// reference sorts and declarations.
/// </remarks>
public void ParseSMTLIBString(string str, Symbol[] sortNames = null, Sort[] sorts = null, Symbol[] declNames = null, FuncDecl[] decls = null)
{
uint csn = Symbol.ArrayLength(sortNames);
uint cs = Sort.ArrayLength(sorts);
uint cdn = Symbol.ArrayLength(declNames);
uint cd = AST.ArrayLength(decls);
if (csn != cs || cdn != cd)
throw new Z3Exception("Argument size mismatch");
Native.Z3_parse_smtlib_string(nCtx, str,
AST.ArrayLength(sorts), Symbol.ArrayToNative(sortNames), AST.ArrayToNative(sorts),
AST.ArrayLength(decls), Symbol.ArrayToNative(declNames), AST.ArrayToNative(decls));
}
开发者ID:kayceesrk,项目名称:Z3,代码行数:22,代码来源:Context.cs
示例20: MkMap
/// <summary>
/// Maps f on the argument arrays.
/// </summary>
/// <remarks>
/// Eeach element of <c>args</c> must be of an array sort <c>[domain_i -> range_i]</c>.
/// The function declaration <c>f</c> must have type <c> range_1 .. range_n -> range</c>.
/// <c>v</c> must have sort range. The sort of the result is <c>[domain_i -> range]</c>.
/// <seealso cref="MkArraySort"/>
/// <seealso cref="MkSelect"/>
/// <seealso cref="MkStore"/>
/// </remarks>
public ArrayExpr MkMap(FuncDecl f, params ArrayExpr[] args)
{
Contract.Requires(f != null);
Contract.Requires(args == null || Contract.ForAll(args, a => a != null));
Contract.Ensures(Contract.Result<ArrayExpr>() != null);
CheckContextMatch(f);
CheckContextMatch(args);
return (ArrayExpr)Expr.Create(this, Native.Z3_mk_map(nCtx, f.NativeObject, AST.ArrayLength(args), AST.ArrayToNative(args)));
}
开发者ID:kayceesrk,项目名称:Z3,代码行数:21,代码来源:Context.cs
注:本文中的Microsoft.Z3.FuncDecl类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论