本文整理汇总了C#中Z3Provider.MkListCons方法的典型用法代码示例。如果您正苦于以下问题:C# Z3Provider.MkListCons方法的具体用法?C# Z3Provider.MkListCons怎么用?C# Z3Provider.MkListCons使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Z3Provider
的用法示例。
在下文中一共展示了Z3Provider.MkListCons方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestSTbSimplify
public void TestSTbSimplify()
{
string utf8decode_bek = @"
function fuse(r,c) = ((r << 6) | (c & 0x3F));
function one(c) = ((0 <= c) && (c <= 0x7F));
function C2_DF(c) = ((0xC2 <= c) && (c <= 0xDF));
function E1_EF(c) = ((0xE1 <= c) && (c <= 0xEF));
function A0_BF(c) = ((0xA0 <= c) && (c <= 0xBF));
function x80_BF(c) = ((0x80 <= c) && (c <= 0xBF));
function x80_9F(c) = ((0x80 <= c) && (c <= 0x9F));
program utf8decode(input){
return iter(c in input)[q := 0; r := 0;]
{
case (q == 0):
if (one(c)) {yield (c);}
else if (C2_DF(c)) {q := 2; r := (c & 0x1F);} // ------ 2 bytes --------
else if (c == 0xE0) {q := 4; r := (c & 0x0F);} // ------ 3 bytes --------
else if (c == 0xED) {q := 5; r := (c & 0x0F);} // ------ 3 bytes --------
else if (E1_EF(c)) {q := 3; r := (c & 0x0F);} // ------ 3 bytes --------
else {raise InvalidInput;}
case (q == 2):
if (x80_BF(c)) {q := 0; yield(fuse(r,c)); r := 0;}
else {raise InvalidInput;}
case (q == 3):
if (x80_BF(c)) {q := 2; r := fuse(r,c);}
else {raise InvalidInput;}
case (q == 4):
if (A0_BF(c)) {q := 2; r := fuse(r,c);}
else {raise InvalidInput;}
case (q == 5):
if (x80_9F(c)) {q := 2; r := fuse(r,c);}
else {raise InvalidInput;}
end case (!(q == 0)):
raise InvalidInput;
};
}
";
Z3Provider solver = new Z3Provider(BitWidth.BV16);
var dec = BekConverter.BekToSTb(solver, utf8decode_bek);
var utf8decode = dec.ExploreBools();
Sort bv32 = solver.MkBitVecSort(32);
Sort outSort = solver.MkTupleSort(solver.StringSort, bv32);
var initReg = solver.MkTuple(solver.GetNil(solver.StringSort), solver.MkNumeral(0,bv32));
var regVar = solver.MkVar(1,outSort);
var reg1 = solver.MkProj(1, regVar);
var reg0 = solver.MkProj(0, regVar);
STb<FuncDecl, Expr, Sort> parse = new STbModel(solver, "Parse", solver.CharacterSort, outSort, outSort, initReg, 0);
var letter = solver.MkOr(//solver.MkAnd(solver.MkCharLe(solver.MkCharExpr('\xC0'), solver.CharVar),
// solver.MkCharLe(solver.CharVar, solver.MkCharExpr('\xFF'))),
solver.MkAnd(solver.MkCharLe(solver.MkCharExpr('a'), solver.CharVar),
solver.MkCharLe(solver.CharVar, solver.MkCharExpr('z'))),
solver.MkAnd(solver.MkCharLe(solver.MkCharExpr('A'), solver.CharVar),
solver.MkCharLe(solver.CharVar, solver.MkCharExpr('Z'))));
//var not_letter = solver.MkNot(letter);
var digit = solver.MkAnd(solver.MkCharLe(solver.MkCharExpr('0'), solver.CharVar),
solver.MkCharLe(solver.CharVar, solver.MkCharExpr('9')));
var nl = solver.MkEq(solver.CharVar, solver.MkCharExpr('\n'));
var space = solver.MkEq(solver.CharVar, solver.MkCharExpr(' '));
//var not_nl = solver.MkNot(nl);
var _0 = solver.MkNumeral((int)'0', bv32);
//var z = solver.Z3.MkFreshConst("z", solver.CharacterSort);
//var constr = solver.MkNot(solver.Z3.MkExists(new Expr[] { z }, nl.Substitute(solver.CharVar, z)));
////var constr = nl.Substitute(solver.CharVar, z);
//solver.Z3S.Push();
//solver.Z3S.Assert((BoolExpr)solver.MkNot(constr));
//var status = solver.Check();
//var m = solver.Z3S.Model;
//var zval = m.Evaluate(z, true);
//solver.Z3S.Pop();
var loop_0 = new BaseRule<Expr>(Sequence<Expr>.Empty, regVar, 0);
var brule0_1 = new BaseRule<Expr>(Sequence<Expr>.Empty, solver.MkTuple(solver.MkListCons(solver.CharVar, reg0), reg1), 1);
var rule0 = new IteRule<Expr>(letter, brule0_1, new IteRule<Expr>(space, loop_0, UndefRule<Expr>.Default));
parse.AssignRule(0, rule0);
var brule1_2 = new BaseRule<Expr>(Sequence<Expr>.Empty, solver.MkTuple(solver.MkListCons(solver.CharVar, reg0), reg1), 2);
var brule_4 = new BaseRule<Expr>(Sequence<Expr>.Empty, regVar, 4);
var rule1 = new IteRule<Expr>(letter, brule1_2, new IteRule<Expr>(space, brule_4, UndefRule<Expr>.Default));
parse.AssignRule(1, rule1);
var brule2_3 = new BaseRule<Expr>(Sequence<Expr>.Empty, solver.MkTuple(solver.MkListCons(solver.CharVar, reg0), reg1), 4);
var rule2 = new IteRule<Expr>(letter, brule2_3, new IteRule<Expr>(space, brule_4, UndefRule<Expr>.Default));
parse.AssignRule(2, rule2);
//.........这里部分代码省略.........