Exemplo n.º 1
0
        public static void TupleExample(Context ctx)
        {
            Console.WriteLine("TupleExample");

            Sort      int_type = ctx.IntSort;
            TupleSort tuple    = ctx.MkTupleSort(
                ctx.MkSymbol("mk_tuple"),                                       // name of tuple constructor
                new Symbol[] { ctx.MkSymbol("first"), ctx.MkSymbol("second") }, // names of projection operators
                new Sort[] { int_type, int_type } // types of projection operators
                );
            FuncDecl first  = tuple.FieldDecls[0]; // declarations are for projections
            FuncDecl second = tuple.FieldDecls[1];
            Expr     x      = ctx.MkConst("x", int_type);
            Expr     y      = ctx.MkConst("y", int_type);
            Expr     n1     = tuple.MkDecl[x, y];
            Expr     n2     = first[n1];
            BoolExpr n3     = ctx.MkEq(x, n2);

            Console.WriteLine("Tuple example: {0}", n3);
            Prove(ctx, n3);
        }
Exemplo n.º 2
0
    public Head(Z3Provider z3p, Expr head, TupleSort HEAD, TupleSort MOUTH, TupleSort NOSE)
    {
        if (!(head.Sort.Equals(HEAD)))
                throw new Exception("Wrong sort");

            this.z3p = z3p;

            this.head = head;
            this.HEAD = HEAD;
            this.MOUTH = MOUTH;
            this.NOSE = NOSE;
    }