Ejemplo n.º 1
0
 public SimplifyLikeOpLineariser(SimplifyLikeExprLineariser ExprLineariser, TextWriter wr)
 {
     Contract.Requires(wr != null);
     Contract.Requires(ExprLineariser != null);
     this.ExprLineariser = ExprLineariser;
     this.wr             = wr;
 }
Ejemplo n.º 2
0
        public static string ToString(VCExpr /*!*/ e, LineariserOptions /*!*/ options, UniqueNamer /*!*/ namer)
        {
            Contract.Requires(e != null);
            Contract.Requires(options != null);
            Contract.Requires(namer != null);
            Contract.Ensures(Contract.Result <string>() != null);

            StringWriter sw = new StringWriter();
            SimplifyLikeExprLineariser lin = new SimplifyLikeExprLineariser(sw, namer);

            lin.Linearise(e, options);
            return(sw.ToString());
        }
Ejemplo n.º 3
0
            public bool VisitBoogieFunctionOp(VCExprNAry node, LineariserOptions options)
            {
                //Contract.Requires(options != null);
                //Contract.Requires(node != null);
                VCExprBoogieFunctionOp op = (VCExprBoogieFunctionOp)node.Op;

                Contract.Assert(op != null);
                string funcName = op.Func.Name;

                Contract.Assert(funcName != null);
                string bvzName     = op.Func.FindStringAttribute("external");
                string printedName = ExprLineariser.Namer.GetName(op.Func, funcName);

                Contract.Assert(printedName != null);
                if (bvzName != null)
                {
                    printedName = bvzName;
                }

                if (options.UseTypes)
                {
                    // we use term notation for arguments whose type is not bool, and
                    // formula notation for boolean arguments

                    wr.Write("(");
                    ExprLineariser.WriteId(printedName);

                    foreach (VCExpr e in node)
                    {
                        Contract.Assert(e != null);
                        wr.Write(" ");
                        ExprLineariser.Linearise(e, options.SetAsTerm(!e.Type.IsBool));
                    }

                    wr.Write(")");
                }
                else
                {
                    // arguments are always terms
                    WriteApplicationTermOnly(SimplifyLikeExprLineariser.MakeIdPrintable(printedName),
                                             node, options);
                }
                return(true);
            }