protected string VCExpr2String(VCExpr expr, int polarity) { Contract.Requires(expr != null); Contract.Ensures(Contract.Result<string>() != null); lock (gen) { 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); LetBindingSorter letSorter = new LetBindingSorter(gen); Contract.Assert(letSorter != null); VCExpr sortedExpr = letSorter.Mutate(exprWithoutTypes, true); Contract.Assert(sortedExpr != null); VCExpr sortedAxioms = letSorter.Mutate(AxBuilder.GetNewAxioms(), true); Contract.Assert(sortedAxioms != null); DeclCollector.Collect(sortedAxioms); DeclCollector.Collect(sortedExpr); FeedTypeDeclsToProver(); AddAxiom(SMTLibExprLineariser.ToString(sortedAxioms, Namer, options, namedAssumes: NamedAssumes)); string res = SMTLibExprLineariser.ToString(sortedExpr, Namer, options, NamedAssumes, OptimizationRequests); Contract.Assert(res != null); if (CommandLineOptions.Clo.Trace) { DateTime end = DateTime.UtcNow; TimeSpan elapsed = end - start; if (elapsed.TotalSeconds > 0.5) Console.WriteLine("Linearising [{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; }