| 56 | } |
| 57 | |
| 58 | bool lt(ast * n1, ast * n2) { |
| 59 | unsigned num; |
| 60 | start: |
| 61 | if (n1 == n2) |
| 62 | return false; |
| 63 | check_value(n1->get_kind(), n2->get_kind()); |
| 64 | switch(n1->get_kind()) { |
| 65 | case AST_SORT: |
| 66 | check_symbol(to_sort(n1)->get_name(), to_sort(n2)->get_name()); |
| 67 | check_value(to_sort(n1)->get_num_parameters(), to_sort(n2)->get_num_parameters()); |
| 68 | num = to_sort(n1)->get_num_parameters(); |
| 69 | SASSERT(num > 0); |
| 70 | for (unsigned i = 0; i < num; ++i) { |
| 71 | const parameter &p1 = to_sort(n1)->get_parameter(i); |
| 72 | const parameter &p2 = to_sort(n2)->get_parameter(i); |
| 73 | check_parameter(p1, p2); |
| 74 | } |
| 75 | UNREACHABLE(); |
| 76 | return false; |
| 77 | case AST_FUNC_DECL: |
| 78 | check_symbol(to_func_decl(n1)->get_name(), to_func_decl(n2)->get_name()); |
| 79 | check_value(to_func_decl(n1)->get_arity(), to_func_decl(n2)->get_arity()); |
| 80 | check_value(to_func_decl(n1)->get_num_parameters(), to_func_decl(n2)->get_num_parameters()); |
| 81 | num = to_func_decl(n1)->get_num_parameters(); |
| 82 | for (unsigned i = 0; i < num; ++i) { |
| 83 | const parameter &p1 = to_func_decl(n1)->get_parameter(i); |
| 84 | const parameter &p2 = to_func_decl(n2)->get_parameter(i); |
| 85 | check_parameter(p1, p2); |
| 86 | } |
| 87 | num = to_func_decl(n1)->get_arity(); |
| 88 | for (unsigned i = 0; i < num; ++i) { |
| 89 | ast * d1 = to_func_decl(n1)->get_domain(i); |
| 90 | ast * d2 = to_func_decl(n2)->get_domain(i); |
| 91 | check_ast(d1, d2); |
| 92 | } |
| 93 | n1 = to_func_decl(n1)->get_range(); |
| 94 | n2 = to_func_decl(n2)->get_range(); |
| 95 | goto start; |
| 96 | case AST_APP: |
| 97 | check_value(to_app(n1)->get_num_args(), to_app(n2)->get_num_args()); |
| 98 | check_value(to_app(n1)->get_depth(), to_app(n2)->get_depth()); |
| 99 | check_ast(to_app(n1)->get_decl(), to_app(n2)->get_decl()); |
| 100 | num = to_app(n1)->get_num_args(); |
| 101 | for (unsigned i = 0; i < num; ++i) { |
| 102 | expr * arg1 = to_app(n1)->get_arg(i); |
| 103 | expr * arg2 = to_app(n2)->get_arg(i); |
| 104 | check_ast(arg1, arg2); |
| 105 | } |
| 106 | UNREACHABLE(); |
| 107 | return false; |
| 108 | case AST_QUANTIFIER: |
| 109 | check_value(to_quantifier(n1)->get_kind(), to_quantifier(n2)->get_kind()); |
| 110 | check_value(to_quantifier(n1)->get_num_decls(), to_quantifier(n2)->get_num_decls()); |
| 111 | check_value(to_quantifier(n1)->get_num_patterns(), to_quantifier(n2)->get_num_patterns()); |
| 112 | check_value(to_quantifier(n1)->get_num_no_patterns(), to_quantifier(n2)->get_num_no_patterns()); |
| 113 | check_value(to_quantifier(n1)->get_weight(), to_quantifier(n2)->get_weight()); |
| 114 | num = to_quantifier(n1)->get_num_decls(); |
| 115 | for (unsigned i = 0; i < num; ++i) { |