public ParseSMTLIB2File ( string fileName, |
||
fileName | string | |
sortNames | ||
sorts | Microsoft.Z3.Sort | |
declNames | ||
decls | ||
Résultat |
/// <summary> /// Shows how to read an SMT2 file. /// </summary> static void SMT2FileTest(string filename) { System.DateTime before = System.DateTime.Now; Console.WriteLine("SMT2 File test "); System.GC.Collect(); using (Context ctx = new Context(new Dictionary<string, string>() { { "MODEL", "true" } })) { Expr a = ctx.ParseSMTLIB2File(filename); Console.WriteLine("SMT2 file read time: " + (System.DateTime.Now - before).TotalSeconds + " sec"); // Iterate over the formula. Queue q = new Queue(); q.Enqueue(a); uint cnt = 0; while (q.Count > 0) { AST cur = (AST)q.Dequeue(); cnt++; // This here ... if (cur is Expr) if (!(cur.IsVar)) foreach (Expr c in ((Expr)cur).Args) q.Enqueue(c); // Takes the same time as this: //switch ((cur).ASTKind) //{ // case Z3_ast_kind.Z3_APP_AST: // foreach (Expr e in ((Expr)cur).Args) // q.Enqueue(e); // break; // case Z3_ast_kind.Z3_QUANTIFIER_AST: // q.Enqueue(((Quantifier)cur).Args[0]); // break; // case Z3_ast_kind.Z3_VAR_AST: break; // case Z3_ast_kind.Z3_NUMERAL_AST: break; // case Z3_ast_kind.Z3_FUNC_DECL_AST: break; // case Z3_ast_kind.Z3_SORT_AST: break; //} } Console.WriteLine(cnt + " ASTs"); } Console.WriteLine("SMT2 file test took " + (System.DateTime.Now - before).TotalSeconds + " sec"); }