Beispiel #1
0
        protected string VCExpr2String(VCExpr expr, int polarity)
        {
            Contract.Requires(expr != null);
            Contract.Ensures(Contract.Result <string>() != null);

            DateTime start = DateTime.UtcNow;

            if (CommandLineOptions.Clo.Trace)
            {
                Console.Write("Linearising ... ");
            }

            // handle the types in the VCExpr
            TypeEraser eraser;

            switch (CommandLineOptions.Clo.TypeEncodingMethod)
            {
            case CommandLineOptions.TypeEncoding.Arguments:
                eraser = new TypeEraserArguments((TypeAxiomBuilderArguments)AxBuilder, gen);
                break;

            case CommandLineOptions.TypeEncoding.Monomorphic:
                eraser = null;
                break;

            default:
                eraser = new TypeEraserPremisses((TypeAxiomBuilderPremisses)AxBuilder, gen);
                break;
            }
            VCExpr exprWithoutTypes = eraser == null ? expr : eraser.Erase(expr, polarity);

            Contract.Assert(exprWithoutTypes != null);

            var letImplier     = new Let2ImpliesMutator(Gen);
            var flattener      = new TermFormulaFlattener(Gen);
            var exprWithLet    = flattener.Flatten(exprWithoutTypes);
            var exprWithoutLet = letImplier.Mutate(exprWithLet);

            var axiomsWithLet    = flattener.Flatten(AxBuilder.GetNewAxioms());
            var axiomsWithoutLet = letImplier.Mutate(axiomsWithLet);

            DeclCollector.Collect(axiomsWithoutLet);
            DeclCollector.Collect(exprWithoutLet);
            FeedTypeDeclsToProver();

            AddAxiom(TPTPExprLineariser.ToString(axiomsWithoutLet, Namer, Options));
            string res = TPTPExprLineariser.ToString(exprWithoutLet, Namer, Options);

            Contract.Assert(res != null);

            if (CommandLineOptions.Clo.Trace)
            {
                DateTime end     = DateTime.UtcNow;
                TimeSpan elapsed = end - start;
                Console.WriteLine("finished   [{0} s]", elapsed.TotalSeconds);
            }
            return(res);
        }
    protected string VCExpr2String(VCExpr expr, int polarity)
    {
      Contract.Requires(expr != null);
      Contract.Ensures(Contract.Result<string>() != null);

      DateTime start = DateTime.UtcNow;
      if (CommandLineOptions.Clo.Trace)
        Console.Write("Linearising ... ");

      // handle the types in the VCExpr
      TypeEraser eraser;
      switch (CommandLineOptions.Clo.TypeEncodingMethod) {
        case CommandLineOptions.TypeEncoding.Arguments:
          eraser = new TypeEraserArguments((TypeAxiomBuilderArguments)AxBuilder, gen);
          break;
        case CommandLineOptions.TypeEncoding.Monomorphic:
          eraser = null;
          break;
        default:
          eraser = new TypeEraserPremisses((TypeAxiomBuilderPremisses)AxBuilder, gen);
          break;
      }      
      VCExpr exprWithoutTypes = eraser == null ? expr : eraser.Erase(expr, polarity);
      Contract.Assert(exprWithoutTypes != null);

      var letImplier = new Let2ImpliesMutator(Gen);
      var flattener = new TermFormulaFlattener(Gen);
      var exprWithLet = flattener.Flatten(exprWithoutTypes);
      var exprWithoutLet = letImplier.Mutate(exprWithLet);

      var axiomsWithLet = flattener.Flatten(AxBuilder.GetNewAxioms());
      var axiomsWithoutLet = letImplier.Mutate(axiomsWithLet);

      DeclCollector.Collect(axiomsWithoutLet);
      DeclCollector.Collect(exprWithoutLet);
      FeedTypeDeclsToProver();

      AddAxiom(TPTPExprLineariser.ToString(axiomsWithoutLet, Namer, Options));
      string res = TPTPExprLineariser.ToString(exprWithoutLet, Namer, Options);
      Contract.Assert(res != null);

      if (CommandLineOptions.Clo.Trace) {
        DateTime end = DateTime.UtcNow;
        TimeSpan elapsed = end - start;
        Console.WriteLine("finished   [{0} s]", elapsed.TotalSeconds);
      }
      return res;
    }