Skip to content

Commit 0eafeb9

Browse files
waywardmonkeysNikolajBjorner
authored andcommitted
Fix confusing tabs mixed in with spaces in C examples.
1 parent 0093157 commit 0eafeb9

File tree

1 file changed

+56
-56
lines changed

1 file changed

+56
-56
lines changed

examples/c/test_capi.c

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,13 @@ void check(Z3_context ctx, Z3_solver s, Z3_lbool expected_result)
215215
break;
216216
case Z3_L_UNDEF:
217217
printf("unknown\n");
218-
m = Z3_solver_get_model(ctx, s);
219-
if (m) Z3_model_inc_ref(ctx, m);
218+
m = Z3_solver_get_model(ctx, s);
219+
if (m) Z3_model_inc_ref(ctx, m);
220220
printf("potential model:\n%s\n", Z3_model_to_string(ctx, m));
221221
break;
222222
case Z3_L_TRUE:
223-
m = Z3_solver_get_model(ctx, s);
224-
if (m) Z3_model_inc_ref(ctx, m);
223+
m = Z3_solver_get_model(ctx, s);
224+
if (m) Z3_model_inc_ref(ctx, m);
225225
printf("sat\n%s\n", Z3_model_to_string(ctx, m));
226226
break;
227227
}
@@ -265,9 +265,9 @@ void prove(Z3_context ctx, Z3_solver s, Z3_ast f, bool is_valid)
265265
printf("unknown\n");
266266
m = Z3_solver_get_model(ctx, s);
267267
if (m != 0) {
268-
Z3_model_inc_ref(ctx, m);
268+
Z3_model_inc_ref(ctx, m);
269269
/* m should be viewed as a potential counterexample. */
270-
printf("potential counterexample:\n%s\n", Z3_model_to_string(ctx, m));
270+
printf("potential counterexample:\n%s\n", Z3_model_to_string(ctx, m));
271271
}
272272
if (is_valid) {
273273
exitf("unexpected result");
@@ -278,7 +278,7 @@ void prove(Z3_context ctx, Z3_solver s, Z3_ast f, bool is_valid)
278278
printf("invalid\n");
279279
m = Z3_solver_get_model(ctx, s);
280280
if (m) {
281-
Z3_model_inc_ref(ctx, m);
281+
Z3_model_inc_ref(ctx, m);
282282
/* the model returned by Z3 is a counterexample */
283283
printf("counterexample:\n%s\n", Z3_model_to_string(ctx, m));
284284
}
@@ -498,25 +498,25 @@ void display_sort(Z3_context c, FILE * out, Z3_sort ty)
498498
fprintf(out, "]");
499499
break;
500500
case Z3_DATATYPE_SORT:
501-
if (Z3_get_datatype_sort_num_constructors(c, ty) != 1)
502-
{
503-
fprintf(out, "%s", Z3_sort_to_string(c,ty));
504-
break;
505-
}
506-
{
507-
unsigned num_fields = Z3_get_tuple_sort_num_fields(c, ty);
508-
unsigned i;
509-
fprintf(out, "(");
510-
for (i = 0; i < num_fields; i++) {
511-
Z3_func_decl field = Z3_get_tuple_sort_field_decl(c, ty, i);
512-
if (i > 0) {
513-
fprintf(out, ", ");
501+
if (Z3_get_datatype_sort_num_constructors(c, ty) != 1)
502+
{
503+
fprintf(out, "%s", Z3_sort_to_string(c,ty));
504+
break;
505+
}
506+
{
507+
unsigned num_fields = Z3_get_tuple_sort_num_fields(c, ty);
508+
unsigned i;
509+
fprintf(out, "(");
510+
for (i = 0; i < num_fields; i++) {
511+
Z3_func_decl field = Z3_get_tuple_sort_field_decl(c, ty, i);
512+
if (i > 0) {
513+
fprintf(out, ", ");
514+
}
515+
display_sort(c, out, Z3_get_range(c, field));
514516
}
515-
display_sort(c, out, Z3_get_range(c, field));
517+
fprintf(out, ")");
518+
break;
516519
}
517-
fprintf(out, ")");
518-
break;
519-
}
520520
default:
521521
fprintf(out, "unknown[");
522522
display_symbol(c, out, Z3_get_sort_name(c, ty));
@@ -587,7 +587,7 @@ void display_function_interpretations(Z3_context c, FILE * out, Z3_model m)
587587

588588
fdecl = Z3_model_get_func_decl(c, m, i);
589589
finterp = Z3_model_get_func_interp(c, m, fdecl);
590-
Z3_func_interp_inc_ref(c, finterp);
590+
Z3_func_interp_inc_ref(c, finterp);
591591
name = Z3_get_decl_name(c, fdecl);
592592
display_symbol(c, out, name);
593593
fprintf(out, " = {");
@@ -596,7 +596,7 @@ void display_function_interpretations(Z3_context c, FILE * out, Z3_model m)
596596
for (j = 0; j < num_entries; j++) {
597597
unsigned num_args, k;
598598
Z3_func_entry fentry = Z3_func_interp_get_entry(c, finterp, j);
599-
Z3_func_entry_inc_ref(c, fentry);
599+
Z3_func_entry_inc_ref(c, fentry);
600600
if (j > 0) {
601601
fprintf(out, ", ");
602602
}
@@ -611,7 +611,7 @@ void display_function_interpretations(Z3_context c, FILE * out, Z3_model m)
611611
fprintf(out, "|->");
612612
display_ast(c, out, Z3_func_entry_get_value(c, fentry));
613613
fprintf(out, ")");
614-
Z3_func_entry_dec_ref(c, fentry);
614+
Z3_func_entry_dec_ref(c, fentry);
615615
}
616616
if (num_entries > 0) {
617617
fprintf(out, ", ");
@@ -620,7 +620,7 @@ void display_function_interpretations(Z3_context c, FILE * out, Z3_model m)
620620
func_else = Z3_func_interp_get_else(c, finterp);
621621
display_ast(c, out, func_else);
622622
fprintf(out, ")}\n");
623-
Z3_func_interp_dec_ref(c, finterp);
623+
Z3_func_interp_dec_ref(c, finterp);
624624
}
625625
}
626626

@@ -667,13 +667,13 @@ void check2(Z3_context ctx, Z3_solver s, Z3_lbool expected_result)
667667
printf("unknown\n");
668668
printf("potential model:\n");
669669
m = Z3_solver_get_model(ctx, s);
670-
if (m) Z3_model_inc_ref(ctx, m);
670+
if (m) Z3_model_inc_ref(ctx, m);
671671
display_model(ctx, stdout, m);
672672
break;
673673
case Z3_L_TRUE:
674674
printf("sat\n");
675675
m = Z3_solver_get_model(ctx, s);
676-
if (m) Z3_model_inc_ref(ctx, m);
676+
if (m) Z3_model_inc_ref(ctx, m);
677677
display_model(ctx, stdout, m);
678678
break;
679679
}
@@ -1245,7 +1245,7 @@ void array_example2()
12451245
/* context is satisfiable if n < 5 */
12461246
check2(ctx, s, n < 5 ? Z3_L_TRUE : Z3_L_FALSE);
12471247

1248-
del_solver(ctx, s);
1248+
del_solver(ctx, s);
12491249
Z3_del_context(ctx);
12501250
}
12511251
}
@@ -1281,7 +1281,7 @@ void array_example3()
12811281
display_sort(ctx, stdout, range);
12821282
printf("\n");
12831283

1284-
if (int_sort != domain || bool_sort != range) {
1284+
if (int_sort != domain || bool_sort != range) {
12851285
exitf("invalid array type");
12861286
}
12871287

@@ -1499,7 +1499,7 @@ void eval_example1()
14991499
Z3_ast args[2] = {x, y};
15001500
Z3_ast v;
15011501
m = Z3_solver_get_model(ctx, s);
1502-
if (m) Z3_model_inc_ref(ctx, m);
1502+
if (m) Z3_model_inc_ref(ctx, m);
15031503
printf("MODEL:\n%s", Z3_model_to_string(ctx, m));
15041504
x_plus_y = Z3_mk_add(ctx, 2, args);
15051505
printf("\nevaluating x+y\n");
@@ -1749,14 +1749,14 @@ void parser_example5() {
17491749
e = Z3_get_error_code(ctx);
17501750
if (e != Z3_OK) goto err;
17511751
unreachable();
1752-
del_solver(ctx, s);
1752+
del_solver(ctx, s);
17531753
Z3_del_context(ctx);
17541754
}
17551755
else {
17561756
err:
17571757
printf("Z3 error: %s.\n", Z3_get_error_msg(ctx, e));
17581758
if (ctx != NULL) {
1759-
del_solver(ctx, s);
1759+
del_solver(ctx, s);
17601760
Z3_del_context(ctx);
17611761
}
17621762
}
@@ -1909,14 +1909,14 @@ void list_example() {
19091909
x = mk_var(ctx, "x", int_ty);
19101910
y = mk_var(ctx, "y", int_ty);
19111911
l1 = mk_binary_app(ctx, cons_decl, x, nil);
1912-
l2 = mk_binary_app(ctx, cons_decl, y, nil);
1912+
l2 = mk_binary_app(ctx, cons_decl, y, nil);
19131913
prove(ctx, s, Z3_mk_implies(ctx, Z3_mk_eq(ctx,l1,l2), Z3_mk_eq(ctx, x, y)), true);
19141914

19151915
/* cons(x,u) = cons(x, v) => u = v */
19161916
u = mk_var(ctx, "u", int_list);
19171917
v = mk_var(ctx, "v", int_list);
19181918
l1 = mk_binary_app(ctx, cons_decl, x, u);
1919-
l2 = mk_binary_app(ctx, cons_decl, y, v);
1919+
l2 = mk_binary_app(ctx, cons_decl, y, v);
19201920
prove(ctx, s, Z3_mk_implies(ctx, Z3_mk_eq(ctx,l1,l2), Z3_mk_eq(ctx, u, v)), true);
19211921
prove(ctx, s, Z3_mk_implies(ctx, Z3_mk_eq(ctx,l1,l2), Z3_mk_eq(ctx, x, y)), true);
19221922

@@ -2266,21 +2266,21 @@ void unsat_core_and_proof_example() {
22662266

22672267
printf("\ncore:\n");
22682268
for (i = 0; i < Z3_ast_vector_size(ctx, core); ++i) {
2269-
printf("%s\n", Z3_ast_to_string(ctx, Z3_ast_vector_get(ctx, core, i)));
2269+
printf("%s\n", Z3_ast_to_string(ctx, Z3_ast_vector_get(ctx, core, i)));
22702270
}
22712271
printf("\n");
22722272
break;
22732273
case Z3_L_UNDEF:
22742274
printf("unknown\n");
22752275
printf("potential model:\n");
2276-
m = Z3_solver_get_model(ctx, s);
2277-
if (m) Z3_model_inc_ref(ctx, m);
2276+
m = Z3_solver_get_model(ctx, s);
2277+
if (m) Z3_model_inc_ref(ctx, m);
22782278
display_model(ctx, stdout, m);
22792279
break;
22802280
case Z3_L_TRUE:
22812281
printf("sat\n");
2282-
m = Z3_solver_get_model(ctx, s);
2283-
if (m) Z3_model_inc_ref(ctx, m);
2282+
m = Z3_solver_get_model(ctx, s);
2283+
if (m) Z3_model_inc_ref(ctx, m);
22842284
display_model(ctx, stdout, m);
22852285
break;
22862286
}
@@ -2300,7 +2300,7 @@ void unsat_core_and_proof_example() {
23002300
*/
23012301
typedef struct {
23022302
Z3_context m_context;
2303-
Z3_solver m_solver;
2303+
Z3_solver m_solver;
23042304
// IMPORTANT: the fields m_answer_literals, m_retracted and m_num_answer_literals must be saved/restored
23052305
// if push/pop operations are performed on m_context.
23062306
Z3_ast m_answer_literals[MAX_RETRACTABLE_ASSERTIONS];
@@ -2406,7 +2406,7 @@ Z3_lbool ext_check(Z3_ext_context ctx) {
24062406
// In this example, we display the core based on the assertion ids.
24072407
unsigned j;
24082408
for (j = 0; j < ctx->m_num_answer_literals; j++) {
2409-
if (Z3_ast_vector_get(ctx->m_context, core, i) == ctx->m_answer_literals[j]) {
2409+
if (Z3_ast_vector_get(ctx->m_context, core, i) == ctx->m_answer_literals[j]) {
24102410
printf("%d ", j);
24112411
break;
24122412
}
@@ -2449,7 +2449,7 @@ void incremental_example1() {
24492449
c4 = assert_retractable_cnstr(ext_ctx, Z3_mk_lt(ctx, y, one));
24502450

24512451
result = ext_check(ext_ctx);
2452-
if (result != Z3_L_FALSE)
2452+
if (result != Z3_L_FALSE)
24532453
exitf("bug in Z3");
24542454
printf("unsat\n");
24552455

@@ -2655,7 +2655,7 @@ void fpa_example() {
26552655
Z3_sort double_sort, rm_sort;
26562656
Z3_symbol s_rm, s_x, s_y, s_x_plus_y;
26572657
Z3_ast rm, x, y, n, x_plus_y, c1, c2, c3, c4, c5;
2658-
Z3_ast args[2], args2[2], and_args[3], args3[3];
2658+
Z3_ast args[2], args2[2], and_args[3], args3[3];
26592659

26602660
printf("\nFPA-example\n");
26612661
LOG_MSG("FPA-example");
@@ -2676,38 +2676,38 @@ void fpa_example() {
26762676
x = Z3_mk_const(ctx, s_x, double_sort);
26772677
y = Z3_mk_const(ctx, s_y, double_sort);
26782678
n = Z3_mk_fpa_numeral_double(ctx, 42.0, double_sort);
2679-
2679+
26802680
s_x_plus_y = Z3_mk_string_symbol(ctx, "x_plus_y");
26812681
x_plus_y = Z3_mk_const(ctx, s_x_plus_y, double_sort);
26822682
c1 = Z3_mk_eq(ctx, x_plus_y, Z3_mk_fpa_add(ctx, rm, x, y));
2683-
2683+
26842684
args[0] = c1;
26852685
args[1] = Z3_mk_eq(ctx, x_plus_y, n);
26862686
c2 = Z3_mk_and(ctx, 2, (Z3_ast*)&args);
2687-
2687+
26882688
args2[0] = c2;
26892689
args2[1] = Z3_mk_not(ctx, Z3_mk_eq(ctx, rm, Z3_mk_fpa_rtz(ctx)));
26902690
c3 = Z3_mk_and(ctx, 2, (Z3_ast*)&args2);
2691-
2691+
26922692
and_args[0] = Z3_mk_not(ctx, Z3_mk_fpa_is_zero(ctx, y));
26932693
and_args[1] = Z3_mk_not(ctx, Z3_mk_fpa_is_nan(ctx, y));
26942694
and_args[2] = Z3_mk_not(ctx, Z3_mk_fpa_is_infinite(ctx, y));
26952695
args3[0] = c3;
26962696
args3[1] = Z3_mk_and(ctx, 3, and_args);
26972697
c4 = Z3_mk_and(ctx, 2, (Z3_ast*)&args3);
2698-
2698+
26992699
printf("c4: %s\n", Z3_ast_to_string(ctx, c4));
27002700
Z3_solver_push(ctx, s);
27012701
Z3_solver_assert(ctx, s, c4);
27022702
check(ctx, s, Z3_L_TRUE);
27032703
Z3_solver_pop(ctx, s, 1);
2704-
2704+
27052705
// Show that the following are equal:
27062706
// (fp #b0 #b10000000001 #xc000000000000)
27072707
// ((_ to_fp 11 53) #x401c000000000000))
27082708
// ((_ to_fp 11 53) RTZ 1.75 2)))
27092709
// ((_ to_fp 11 53) RTZ 7.0)))
2710-
2710+
27112711
Z3_solver_push(ctx, s);
27122712
c1 = Z3_mk_fpa_fp(ctx,
27132713
Z3_mk_numeral(ctx, "0", Z3_mk_bv_sort(ctx, 1)),
@@ -2729,12 +2729,12 @@ void fpa_example() {
27292729
args3[1] = Z3_mk_eq(ctx, c1, c3);
27302730
args3[2] = Z3_mk_eq(ctx, c1, c4);
27312731
c5 = Z3_mk_and(ctx, 3, args3);
2732-
2732+
27332733
printf("c5: %s\n", Z3_ast_to_string(ctx, c5));
27342734
Z3_solver_assert(ctx, s, c5);
27352735
check(ctx, s, Z3_L_TRUE);
27362736
Z3_solver_pop(ctx, s, 1);
2737-
2737+
27382738
del_solver(ctx, s);
27392739
Z3_del_context(ctx);
27402740
}
@@ -2896,7 +2896,7 @@ void mk_model_example() {
28962896
}
28972897
}
28982898

2899-
{
2899+
{
29002900
// Evaluate c[0] + c[1] + c[2] under model
29012901
Z3_ast c0 = Z3_mk_select(ctx, cApp, zeroNumeral);
29022902
Z3_ast c1 = Z3_mk_select(ctx, cApp, oneNumeral);

0 commit comments

Comments
 (0)