Exemplo n.º 1
0
 public SimplifyLikeExprLineariser(TextWriter wr, UniqueNamer namer)
 {
     Contract.Requires(namer != null);
     Contract.Requires(wr != null);
     this.wr    = wr;
     this.Namer = namer;
 }
Exemplo n.º 2
0
 public static string ToSimplifyString(VCExpr e, UniqueNamer namer)
 {
     Contract.Requires(namer != null);
     Contract.Requires(e != null);
     Contract.Ensures(Contract.Result <string>() != null);
     return(ToString(e, LineariserOptions.SimplifyDefault, namer));
 }
Exemplo n.º 3
0
    private UniqueNamer(UniqueNamer namer) {
      Contract.Requires(namer != null);

      Spacer = namer.Spacer;
      GlobalNames = new Dictionary<Object, string>(namer.GlobalNames);
      LocalNames = new List<IDictionary<Object, string>>();

      foreach (IDictionary<Object/*!*/, string/*!*/>/*!*/ d in namer.LocalNames)
        LocalNames.Add(new Dictionary<Object/*!*/, string/*!*/>(d));

      UsedNames = new HashSet<string>(namer.UsedNames);
      CurrentCounters = new Dictionary<string, int>(namer.CurrentCounters);
      GlobalPlusLocalNames = new Dictionary<Object, string>(namer.GlobalPlusLocalNames);
    }
Exemplo n.º 4
0
        private UniqueNamer(UniqueNamer namer)
        {
            Contract.Requires(namer != null);

            Spacer      = namer.Spacer;
            GlobalNames = new Dictionary <Object, string>(namer.GlobalNames);
            LocalNames  = new List <IDictionary <Object, string> >();

            foreach (IDictionary <Object /*!*/, string /*!*/> /*!*/ d in namer.LocalNames)
            {
                LocalNames.Add(new Dictionary <Object /*!*/, string /*!*/>(d));
            }

            UsedNames            = new HashSet <string>(namer.UsedNames);
            CurrentCounters      = new Dictionary <string, int>(namer.CurrentCounters);
            GlobalPlusLocalNames = new Dictionary <Object, string>(namer.GlobalPlusLocalNames);
        }
Exemplo n.º 5
0
        public SMTLibProcessTheoremProver(ProverOptions options, VCExpressionGenerator gen,
            SMTLibProverContext ctx)
        {
            Contract.Requires(options != null);
              Contract.Requires(gen != null);
              Contract.Requires(ctx != null);

              InitializeGlobalInformation();

              this.options = (SMTLibProverOptions)options;
              this.ctx = ctx;
              this.gen = gen;
              this.usingUnsatCore = false;

              SetupAxiomBuilder(gen);

              Namer = new SMTLibNamer();
              ctx.parent = this;
              this.DeclCollector = new TypeDeclCollector((SMTLibProverOptions)options, Namer);

              SetupProcess();

              if (CommandLineOptions.Clo.StratifiedInlining > 0 || CommandLineOptions.Clo.ContractInfer)
              {
              // Prepare for ApiChecker usage
              if (options.LogFilename != null && currentLogFile == null)
              {
              currentLogFile = OpenOutputFile("");
              }
              if (CommandLineOptions.Clo.ContractInfer)
              {
              SendThisVC("(set-option :produce-unsat-cores true)");
              this.usingUnsatCore = true;
              }
              PrepareCommon();
              }
        }
Exemplo n.º 6
0
    public TPTPProcessTheoremProver(ProverOptions options, VCExpressionGenerator gen,
                                      DeclFreeProverContext ctx)
      : base(options, "", "", "", "", gen)
    {
      Contract.Requires(options != null);
      Contract.Requires(gen != null);
      Contract.Requires(ctx != null);

      // No bg predicate at the moment
      // InitializeGlobalInformation("UnivBackPred.tptp");

      this.ctx = ctx;
      this.Gen = gen;

      TypeAxiomBuilder axBuilder;
      switch (CommandLineOptions.Clo.TypeEncodingMethod) {
        case CommandLineOptions.TypeEncoding.Arguments:
          axBuilder = new TypeAxiomBuilderArguments(gen);
          axBuilder.Setup();
          break;
        case CommandLineOptions.TypeEncoding.Monomorphic:
          axBuilder = new TypeAxiomBuilderPremisses(gen);
          break;
        default:
          axBuilder = new TypeAxiomBuilderPremisses(gen);
          axBuilder.Setup();
          break;
      }
      AxBuilder = axBuilder;
      UniqueNamer namer = new UniqueNamer();      
      Namer = namer;
      Namer.Spacer = "__";
      this.DeclCollector = new TypeDeclCollector(namer);

    }
Exemplo n.º 7
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());
        }