MkBVSLE() 공개 메소드

Two's complement signed less-than or equal to.
The arguments must have the same bit-vector sort.
public MkBVSLE ( BitVecExpr t1, BitVecExpr t2 ) : BoolExpr
t1 BitVecExpr
t2 BitVecExpr
리턴 BoolExpr
예제 #1
0
파일: Z3Examples.cs 프로젝트: 0xCM/arrows
        /// <summary>
        /// Simple bit-vector example.
        /// </summary>
        /// <remarks>
        /// This example disproves that x - 10 &lt;= 0 IFF x &lt;= 10 for (32-bit) machine integers
        /// </remarks>
        public static void BitvectorExample1()
        {
            var ctx = new Z3.Context();

            using var svc = Z3Api.Own(ctx);


            var        bv_type     = ctx.MkBitVecSort(32);
            var        x           = (BitVecExpr)ctx.MkConst("x", bv_type);
            var        zero        = (BitVecNum)ctx.MkNumeral("0", bv_type);
            BitVecNum  ten         = ctx.MkBV(10, 32);
            BitVecExpr x_minus_ten = ctx.MkBVSub(x, ten);
            /* bvsle is signed less than or equal to */
            BoolExpr c1  = ctx.MkBVSLE(x, ten);
            BoolExpr c2  = ctx.MkBVSLE(x_minus_ten, zero);
            BoolExpr thm = ctx.MkIff(c1, c2);

            print("disprove: x - 10 <= 0 IFF x <= 10 for (32-bit) machine integers");
            Disprove(ctx, thm);
        }
예제 #2
0
파일: Program.cs 프로젝트: perillaseed/z3
        /// <summary>
        /// Simple bit-vector example.
        /// </summary>
        /// <remarks>
        /// This example disproves that x - 10 &lt;= 0 IFF x &lt;= 10 for (32-bit) machine integers
        /// </remarks>
        public static void BitvectorExample1(Context ctx)
        {
            Console.WriteLine("BitvectorExample1");

            Sort bv_type = ctx.MkBitVecSort(32);
            BitVecExpr x = (BitVecExpr)ctx.MkConst("x", bv_type);
            BitVecNum zero = (BitVecNum)ctx.MkNumeral("0", bv_type);
            BitVecNum ten = ctx.MkBV(10, 32);
            BitVecExpr x_minus_ten = ctx.MkBVSub(x, ten);
            /* bvsle is signed less than or equal to */
            BoolExpr c1 = ctx.MkBVSLE(x, ten);
            BoolExpr c2 = ctx.MkBVSLE(x_minus_ten, zero);
            BoolExpr thm = ctx.MkIff(c1, c2);
            Console.WriteLine("disprove: x - 10 <= 0 IFF x <= 10 for (32-bit) machine integers");
            Disprove(ctx, thm);
        }