-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbitwuzla_cxx.ml
1974 lines (1450 loc) · 50.7 KB
/
bitwuzla_cxx.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(**************************************************************************)
(* Bitwuzla: Satisfiability Modulo Theories (SMT) solver. *)
(* *)
(* Copyright (C) 2023 by the authors listed in the AUTHORS file at *)
(* https://github.com/bitwuzla/bitwuzla/blob/main/AUTHORS *)
(* *)
(* This file is part of Bitwuzla under the MIT license. *)
(* See COPYING for more information at *)
(* https://github.com/bitwuzla/bitwuzla/blob/main/COPYING *)
(**************************************************************************)
external copyright : unit -> string = "ocaml_bitwuzla_cxx_copyright"
external version : unit -> string = "ocaml_bitwuzla_cxx_version"
external init_format : unit -> unit = "ocaml_bitwuzla_cxx_init_format"
let () =
Callback.register "Format.pp_open_vbox" Format.pp_open_vbox;
Callback.register "Format.pp_print_string" Format.pp_print_string;
Callback.register "Format.pp_print_char" Format.pp_print_char;
Callback.register "Format.pp_print_space" Format.pp_print_space;
Callback.register "Format.pp_close_box" Format.pp_close_box;
init_format ()
external mk_array_sort : Manager.t -> Sort.t -> Sort.t -> Sort.t
= "ocaml_bitwuzla_cxx_mk_array_sort"
external mk_bool_sort : Manager.t -> Sort.t = "ocaml_bitwuzla_cxx_mk_bool_sort"
external mk_bv_sort : Manager.t -> (int[@untagged]) -> Sort.t
= "ocaml_bitwuzla_cxx_mk_bv_sort" "native_bitwuzla_cxx_mk_bv_sort"
external mk_fp_sort :
Manager.t -> (int[@untagged]) -> (int[@untagged]) -> Sort.t
= "ocaml_bitwuzla_cxx_mk_fp_sort" "native_bitwuzla_cxx_mk_fp_sort"
external mk_fun_sort : Manager.t -> Sort.t array -> Sort.t -> Sort.t
= "ocaml_bitwuzla_cxx_mk_fun_sort"
external mk_rm_sort : Manager.t -> Sort.t = "ocaml_bitwuzla_cxx_mk_rm_sort"
external mk_uninterpreted_sort : Manager.t -> ?symbol:string -> unit -> Sort.t
= "ocaml_bitwuzla_cxx_mk_uninterpreted_sort"
external mk_true : Manager.t -> Term.t = "ocaml_bitwuzla_cxx_mk_true"
external mk_false : Manager.t -> Term.t = "ocaml_bitwuzla_cxx_mk_false"
external mk_bv_zero : Manager.t -> Sort.t -> Term.t
= "ocaml_bitwuzla_cxx_mk_bv_zero"
external mk_bv_one : Manager.t -> Sort.t -> Term.t
= "ocaml_bitwuzla_cxx_mk_bv_one"
external mk_bv_ones : Manager.t -> Sort.t -> Term.t
= "ocaml_bitwuzla_cxx_mk_bv_ones"
external mk_bv_min_signed : Manager.t -> Sort.t -> Term.t
= "ocaml_bitwuzla_cxx_mk_bv_min_signed"
external mk_bv_max_signed : Manager.t -> Sort.t -> Term.t
= "ocaml_bitwuzla_cxx_mk_bv_max_signed"
external mk_bv_value :
Manager.t -> Sort.t -> string -> (int[@untagged]) -> Term.t
= "ocaml_bitwuzla_cxx_mk_bv_value" "native_bitwuzla_cxx_mk_bv_value"
external mk_bv_value_int : Manager.t -> Sort.t -> (int[@untagged]) -> Term.t
= "ocaml_bitwuzla_cxx_mk_bv_value_int" "native_bitwuzla_cxx_mk_bv_value_int64"
external mk_bv_value_int64 : Manager.t -> Sort.t -> (int64[@unboxed]) -> Term.t
= "ocaml_bitwuzla_cxx_mk_bv_value_int64"
"native_bitwuzla_cxx_mk_bv_value_int64"
external mk_fp_pos_zero : Manager.t -> Sort.t -> Term.t
= "ocaml_bitwuzla_cxx_mk_fp_pos_zero"
external mk_fp_neg_zero : Manager.t -> Sort.t -> Term.t
= "ocaml_bitwuzla_cxx_mk_fp_neg_zero"
external mk_fp_pos_inf : Manager.t -> Sort.t -> Term.t
= "ocaml_bitwuzla_cxx_mk_fp_pos_inf"
external mk_fp_neg_inf : Manager.t -> Sort.t -> Term.t
= "ocaml_bitwuzla_cxx_mk_fp_neg_inf"
external mk_fp_nan : Manager.t -> Sort.t -> Term.t
= "ocaml_bitwuzla_cxx_mk_fp_nan"
external mk_fp_value : Manager.t -> Term.t -> Term.t -> Term.t -> Term.t
= "ocaml_bitwuzla_cxx_mk_fp_value"
external mk_fp_value_from_real :
Manager.t -> Sort.t -> Term.t -> string -> Term.t
= "ocaml_bitwuzla_cxx_mk_fp_value_from_real"
external mk_fp_value_from_rational :
Manager.t -> Sort.t -> Term.t -> string -> string -> Term.t
= "ocaml_bitwuzla_cxx_mk_fp_value_from_rational"
external mk_rm_value : Manager.t -> (int[@untagged]) -> Term.t
= "ocaml_bitwuzla_cxx_mk_rm_value" "native_bitwuzla_cxx_mk_rm_value"
external mk_term1 : Manager.t -> (int[@untagged]) -> Term.t -> Term.t
= "ocaml_bitwuzla_cxx_mk_term1" "native_bitwuzla_cxx_mk_term1"
external mk_term2 : Manager.t -> (int[@untagged]) -> Term.t -> Term.t -> Term.t
= "ocaml_bitwuzla_cxx_mk_term2" "native_bitwuzla_cxx_mk_term2"
external mk_term3 :
Manager.t -> (int[@untagged]) -> Term.t -> Term.t -> Term.t -> Term.t
= "ocaml_bitwuzla_cxx_mk_term3" "native_bitwuzla_cxx_mk_term3"
external mk_term1_indexed1 :
Manager.t -> (int[@untagged]) -> Term.t -> (int[@untagged]) -> Term.t
= "ocaml_bitwuzla_cxx_mk_term1_indexed1"
"native_bitwuzla_cxx_mk_term1_indexed1"
external mk_term1_indexed2 :
Manager.t ->
(int[@untagged]) ->
Term.t ->
(int[@untagged]) ->
(int[@untagged]) ->
Term.t
= "ocaml_bitwuzla_cxx_mk_term1_indexed2"
"native_bitwuzla_cxx_mk_term1_indexed2"
external mk_term2_indexed1 :
Manager.t ->
(int[@untagged]) ->
Term.t ->
Term.t ->
(int[@untagged]) ->
Term.t
= "ocaml_bitwuzla_cxx_mk_term2_indexed1"
"native_bitwuzla_cxx_mk_term2_indexed1"
external mk_term2_indexed2 :
Manager.t ->
(int[@untagged]) ->
Term.t ->
Term.t ->
(int[@untagged]) ->
(int[@untagged]) ->
Term.t
= "ocaml_bitwuzla_cxx_mk_term2_indexed2"
"native_bitwuzla_cxx_mk_term2_indexed2"
external mk_term :
Manager.t -> (int[@untagged]) -> Term.t array -> int array -> Term.t
= "ocaml_bitwuzla_cxx_mk_term" "native_bitwuzla_cxx_mk_term"
external mk_const : Manager.t -> ?symbol:string -> Sort.t -> Term.t
= "ocaml_bitwuzla_cxx_mk_const"
external mk_const_array : Manager.t -> Sort.t -> Term.t -> Term.t
= "ocaml_bitwuzla_cxx_mk_const_array"
external mk_var : Manager.t -> ?symbol:string -> Sort.t -> Term.t
= "ocaml_bitwuzla_cxx_mk_var"
external substitute_term :
Manager.t -> Term.t -> (Term.t * Term.t) array -> Term.t
= "ocaml_bitwuzla_cxx_substitute_term"
external substitute_terms :
Manager.t -> Term.t array -> (Term.t * Term.t) array -> unit
= "ocaml_bitwuzla_cxx_substitute_terms"
module Options = Options
module type S = sig
module Sort : sig
(** {1:sort Sort} *)
type t
(** A Bitwuzla sort. *)
(** {2:sort_util Util} *)
val hash : t -> int
(**
[hash t]
compute the hash value for a sort.
@param t The sort.
@return The hash value of the sort.
*)
val equal : t -> t -> bool
(**
[equal a b]
Syntactical equality operator.
@param a The first sort.
@param b The second sort.
@return True if the given sorts are equal.
*)
val compare : t -> t -> int
(**
[compare a b]
Syntactical comparison operator.
@param a The first sort.
@param b The second sort.
@return Zero if the given sorts are equal,
a positive number if [a] > [b],
a negative number otherwise.
*)
val pp : Format.formatter -> t -> unit
(**
[pp formatter t]
print sort.
@param t The sort.
@param formatter The outpout formatter.
*)
val to_string : t -> string
(**
[to_string t]
get string representation of this sort.
@return String representation of this sort.
*)
(** {2:sort_query Query} *)
val id : t -> int64
(**
[id t]
get the id of this sort.
@param t The sort.
@return The id value of the sort.
*)
val bv_size : t -> int
(**
[bv_size t]
get the size of a bit-vector sort.
Requires that given sort is a bit-vector sort.
@param t The sort.
@return The size of the bit-vector sort.
*)
val fp_exp_size : t -> int
(**
[fp_exp_size sort]
get the exponent size of a floating-point sort.
Requires that given sort is a floating-point sort.
@param t The sort.
@return The exponent size of the floating-point sort.
*)
val fp_sig_size : t -> int
(**
[fp_sig_size t]
get the significand size of a floating-point sort.
Requires that given sort is a floating-point sort.
@param t The sort.
@return The significand size of the floating-point sort.
*)
val array_index : t -> t
(**
[array_index t]
get the index sort of an array sort.
Requires that given sort is an array sort.
@param t The sort.
@return The index sort of the array sort.
*)
val array_element : t -> t
(**
[array_element t]
get the element sort of an array sort.
Requires that given sort is an array sort.
@param t The sort.
@return The element sort of the array sort.
*)
val fun_domain : t -> t array
(**
[fun_domain_sorts t]
get the domain sorts of a function sort.
Requires that given sort is a function sort.
@param t The sort.
@return The domain sorts of the function sort as an array of sort.
*)
val fun_codomain : t -> t
(**
[fun_codomain t]
get the codomain sort of a function sort.
Requires that given sort is a function sort.
@param t The sort.
@return The codomain sort of the function sort.
*)
val fun_arity : t -> int
(**
[fun_arity t]
get the arity of a function sort.
@param t The sort.
@return The number of arguments of the function sort.
*)
val uninterpreted_symbol : t -> string
(**
[uninterpreted_symbol t]
get the symbol of an uninterpreted sort.
@param t The sort.
@return The symbol.
@raise Not_found if no symbol is defined.
*)
val is_array : t -> bool
(**
[is_array t]
determine if a sort is an array sort.
@param t The sort.
@return [true] if [t] is an array sort.
*)
val is_bool : t -> bool
(**
[is_bool t]
determine if a sort is a Boolean sort.
@param t The sort.
@return [true] if [t] is a Boolean sort.
*)
val is_bv : t -> bool
(**
[is_bv t]
determine if a sort is a bit-vector sort.
@param t The sort.
@return [true] if [t] is a bit-vector sort.
*)
val is_fp : t -> bool
(**
[is_fp t]
determine if a sort is a floating-point sort.
@param t The sort.
@return [true] if [t] is a floating-point sort.
*)
val is_fun : t -> bool
(**
[is_fun t]
determine if a sort is a function sort.
@param t The sort.
@return [true] if [t] is a function sort.
*)
val is_rm : t -> bool
(**
[is_rm t]
determine if a sort is a Roundingmode sort.
@param t The sort.
@return [true] if [t] is a Roundingmode sort.
*)
val is_uninterpreted : t -> bool
(**
[is_uninterpreted t]
determine if a sort is an uninterpreted sort.
@param t The sort.
@return [true] if [t] is an uninterpreted sort.
*)
end
module RoundingMode : sig
(**
Rounding mode for floating-point operations.
For some floating-point operations, infinitely precise results may not be
representable in a given format. Hence, they are rounded modulo one of five
rounding modes to a representable floating-point number.
The following rounding modes follow the SMT-LIB theory for floating-point
arithmetic, which in turn is based on IEEE Standard 754.
The rounding modes are specified in Sections 4.3.1 and 4.3.2 of the IEEE
Standard 754.
*)
type t =
| Rne
(** Round to the nearest even number.
If the two nearest floating-point numbers bracketing an unrepresentable
infinitely precise result are equally near, the one with an even least
significant digit will be delivered.
SMT-LIB: [RNE] roundNearestTiesToEven
*)
| Rna
(** Round to the nearest number away from zero.
If the two nearest floating-point numbers bracketing an unrepresentable
infinitely precise result are equally near, the one with larger
magnitude will be selected.
SMT-LIB: [RNA] roundNearestTiesToAway
*)
| Rtn
(** Round towards negative infinity (-oo).
The result shall be the format’s floating-point number (possibly -oo)
closest to and no less than the infinitely precise result.
SMT-LIB: [RTN] roundTowardNegative
*)
| Rtp
(** Round towards positive infinity (+oo).
The result shall be the format’s floating-point number (possibly +oo)
closest to and no less than the infinitely precise result.
SMT-LIB: [RTP] roundTowardPositive
*)
| Rtz
(** Round towards zero.
The result shall be the format’s floating-point number closest to and no
greater in magnitude than the infinitely precise result.
SMT-LIB: [RTZ] roundTowardZero
*)
val to_string : t -> string
(**
[to_string t]
get string representation of this rounding mode.
@return String representation of this rounding mode.
*)
end
module Kind : sig
(** The term kind. *)
type t =
| Constant (** First order constant. *)
| Const_array (** Constant array. *)
| Value (** Value. *)
| Variable (** Bound variable. *)
| And (** Boolean and.
SMT-LIB: [and] *)
| Distinct (** Disequality.
SMT-LIB: [distinct] *)
| Equal (** Equality.
SMT-LIB: [=] *)
| Iff (** Boolean if and only if.
SMT-LIB: [=] *)
| Implies (** Boolean implies.
SMT-LIB: [=>] *)
| Not (** Boolean not.
SMT-LIB: [not] *)
| Or (** Boolean or.
SMT-LIB: [or] *)
| Xor (** Boolean xor.
SMT-LIB: [xor] *)
| Ite (** If-then-else.
SMT-LIB: [ite] *)
| Exists (** Existential quantification.
SMT-LIB: [exists] *)
| Forall
(** Universal quantification.
SMT-LIB: [forall] *)
| Apply (** Function application. *)
| Lambda (** Lambda. *)
| Select (** Array select.
SMT-LIB: [select] *)
| Store (** Array store.
SMT-LIB: [store] *)
| Bv_add (** Bit-vector addition.
SMT-LIB: [bvadd] *)
| Bv_and (** Bit-vector and.
SMT-LIB: [bvand] *)
| Bv_ashr
(** Bit-vector arithmetic right shift.
SMT-LIB: [bvashr] *)
| Bv_comp
(** Bit-vector comparison.
SMT-LIB: [bvcomp] *)
| Bv_concat
(** Bit-vector concat.
SMT-LIB: [concat] *)
| Bv_dec
(** Bit-vector decrement.
Decrement by one. *)
| Bv_inc
(** Bit-vector increment.
Increment by one. *)
| Bv_mul
(** Bit-vector multiplication.
SMT-LIB: [bvmul] *)
| Bv_nand (** Bit-vector nand.
SMT-LIB: [bvnand] *)
| Bv_neg
(** Bit-vector negation (two's complement).
SMT-LIB: [bvneg] *)
| Bv_nego
(** Bit-vector negation overflow test.
Predicate indicating if bit-vector negation produces an overflow.
SMT-LIB: [bvnego] *)
| Bv_nor (** Bit-vector nor.
SMT-LIB: [bvnor] *)
| Bv_not
(** Bit-vector not (one's complement).
SMT-LIB: [bvnot] *)
| Bv_or (** Bit-vector or.
SMT-LIB: [bvor] *)
| Bv_redand
(** Bit-vector and reduction.
Bit-wise {b and} reduction, all bits are {b and}'ed together into a single
bit.
This corresponds to bit-wise {b and} reduction as known from Verilog. *)
| Bv_redor
(** Bit-vector reduce or.
Bit-wise {b or} reduction, all bits are {b or}'ed together into a single
bit.
This corresponds to bit-wise {b or} reduction as known from Verilog. *)
| Bv_redxor
(** Bit-vector reduce xor.
Bit-wise {b xor} reduction, all bits are {b xor}'ed together into a
single bit.
This corresponds to bit-wise {b xor} reduction as known from Verilog. *)
| Bv_rol
(** Bit-vector rotate left (not indexed).
This is a non-indexed variant of SMT-LIB [rotate_left]. *)
| Bv_ror
(** Bit-vector rotate right.
This is a non-indexed variant of SMT-LIB [rotate_right]. *)
| Bv_saddo
(** Bit-vector signed addition overflow test.
Single bit to indicate if signed addition produces an overflow. *)
| Bv_sdivo
(** Bit-vector signed division overflow test.
Single bit to indicate if signed division produces an overflow. *)
| Bv_sdiv
(** Bit-vector signed division.
SMT-LIB: [bvsdiv] *)
| Bv_sge
(** Bit-vector signed greater than or equal.
SMT-LIB: [bvsge] *)
| Bv_sgt
(** Bit-vector signed greater than.
SMT-LIB: [bvsgt] *)
| Bv_shl
(** Bit-vector logical left shift.
SMT-LIB: [bvshl] *)
| Bv_shr
(** Bit-vector logical right shift.
SMT-LIB: [bvshr] *)
| Bv_sle
(** Bit-vector signed less than or equal.
SMT-LIB: [bvsle] *)
| Bv_slt (** Bit-vector signed less than.
SMT-LIB: [bvslt] *)
| Bv_smod (** Bit-vector signed modulo.
SMT-LIB: [bvsmod] *)
| Bv_smulo
(** Bit-vector signed multiplication overflow test.
SMT-LIB: [bvsmod] *)
| Bv_srem
(** Bit-vector signed remainder.
SMT-LIB: [bvsrem] *)
| Bv_ssubo
(** Bit-vector signed subtraction overflow test.
Single bit to indicate if signed subtraction produces an overflow. *)
| Bv_sub
(** Bit-vector subtraction.
SMT-LIB: [bvsub] *)
| Bv_uaddo
(** Bit-vector unsigned addition overflow test.
Single bit to indicate if unsigned addition produces an overflow. *)
| Bv_udiv
(** Bit-vector unsigned division.
SMT-LIB: [bvudiv] *)
| Bv_uge
(** Bit-vector unsigned greater than or equal.
SMT-LIB: [bvuge] *)
| Bv_ugt
(** Bit-vector unsigned greater than.
SMT-LIB: [bvugt] *)
| Bv_ule
(** Bit-vector unsigned less than or equal.
SMT-LIB: [bvule] *)
| Bv_ult
(** Bit-vector unsigned less than.
SMT-LIB: [bvult] *)
| Bv_umulo
(** Bit-vector unsigned multiplication overflow test.
Single bit to indicate if unsigned multiplication produces
an overflow. *)
| Bv_urem
(** Bit-vector unsigned remainder.
SMT-LIB: [bvurem] *)
| Bv_usubo
(** Bit-vector unsigned subtraction overflow test.
Single bit to indicate if unsigned subtraction produces an overflow. *)
| Bv_xnor (** Bit-vector xnor.
SMT-LIB: [bvxnor] *)
| Bv_xor (** Bit-vector xor.
SMT-LIB: [bvxor] *)
| Bv_extract
(** Bit-vector extract.
SMT-LIB: [extract] (indexed) *)
| Bv_repeat
(** Bit-vector repeat.
SMT-LIB: [repeat] (indexed) *)
| Bv_roli
(** Bit-vector rotate left by integer.
SMT-LIB: [rotate_left] (indexed) *)
| Bv_rori
(** Bit-vector rotate right by integer.
SMT-LIB: [rotate_right] (indexed) *)
| Bv_sign_extend
(** Bit-vector sign extend.
SMT-LIB: [sign_extend] (indexed) *)
| Bv_zero_extend
(** Bit-vector zero extend.
SMT-LIB: [zero_extend] (indexed) *)
| Fp_abs
(** Floating-point absolute value.
SMT-LIB: [fp.abs] *)
| Fp_add
(** Floating-point addition.
SMT-LIB: [fp.add] *)
| Fp_div
(** Floating-point division.
SMT-LIB: [fp.div] *)
| Fp_equal
(** Floating-point equality.
SMT-LIB: [fp.eq] *)
| Fp_fma
(** Floating-point fused multiplcation and addition.
SMT-LIB: [fp.fma] *)
| Fp_fp
(** Floating-point IEEE 754 value.
SMT-LIB: [fp] *)
| Fp_geq
(** Floating-point greater than or equal.
SMT-LIB: [fp.geq] *)
| Fp_gt
(** Floating-point greater than.
SMT-LIB: [fp.gt] *)
| Fp_is_inf
(** Floating-point is infinity tester.
SMT-LIB: [fp.isInfinite] *)
| Fp_is_nan
(** Floating-point is Nan tester.
SMT-LIB: [fp.isNaN] *)
| Fp_is_neg
(** Floating-point is negative tester.
SMT-LIB: [fp.isNegative] *)
| Fp_is_normal
(** Floating-point is normal tester.
SMT-LIB: [fp.isNormal] *)
| Fp_is_pos
(** Floating-point is positive tester.
SMT-LIB: [fp.isPositive] *)
| Fp_is_subnormal
(** Floating-point is subnormal tester.
SMT-LIB: [fp.isSubnormal] *)
| Fp_is_zero
(** Floating-point is zero tester.
SMT-LIB: [fp.isZero] *)
| Fp_leq
(** Floating-point less than or equal.
SMT-LIB: [fp.leq] *)
| Fp_lt
(** Floating-point less than.
SMT-LIB: [fp.lt] *)
| Fp_max (** Floating-point max.
SMT-LIB: [fp.max] *)
| Fp_min (** Floating-point min.
SMT-LIB: [fp.min] *)
| Fp_mul
(** Floating-point multiplcation.
SMT-LIB: [fp.mul] *)
| Fp_neg
(** Floating-point negation.
SMT-LIB: [fp.neg] *)
| Fp_rem
(** Floating-point remainder.
SMT-LIB: [fp.rem] *)
| Fp_rti
(** Floating-point round to integral.
SMT-LIB: [fp.roundToIntegral] *)
| Fp_sqrt
(** Floating-point round to square root.
SMT-LIB: [fp.sqrt] *)
| Fp_sub
(** Floating-point round to subtraction.
SMT-LIB: [fp.sqrt] *)
| Fp_to_fp_from_bv
(** Floating-point to_fp from IEEE 754 bit-vector.
SMT-LIB: [to_fp] (indexed) *)
| Fp_to_fp_from_fp
(** Floating-point to_fp from floating-point.
SMT-LIB: [to_fp] (indexed) *)
| Fp_to_fp_from_sbv
(** Floating-point to_fp from signed bit-vector value.
SMT-LIB: [to_fp] (indexed) *)
| Fp_to_fp_from_ubv
(** Floating-point to_fp from unsigned bit-vector value.
SMT-LIB: [to_fp_unsigned] (indexed) *)
| Fp_to_sbv
(** Floating-point to_sbv.
SMT-LIB: [fp.to_sbv] (indexed) *)
| Fp_to_ubv
(** Floating-point to_ubv.
SMT-LIB: [fp.to_ubv] (indexed) *)
val to_string : t -> string
(**
[to_string t]
get string representation of this kind.
@return String representation of this kind.
*)
end
module Term : sig
(** {1:term Term} *)
type t
(** A Bitwuzla term. *)
(** {2:sort_util Util} *)
val hash : t -> int
(**
[hash t]
compute the hash value for a term.
@param t The term.
@return The hash value of the term.
*)
val equal : t -> t -> bool
(**
[equal a b]
Syntactical equality operator.
@param a The first term.
@param b The second term.
@return True if the given terms are equal.
*)
val compare : t -> t -> int
(**
[compare a b]
Syntactical comparison operator.
@param a The first term.
@param b The second term.
@return Zero if the given term are equal,
a positive number if [a] > [b],
a negative number otherwise.
*)
val pp : Format.formatter -> t -> unit
(**
[pp formatter t]
print term.
(alias for {!val:pp_smt2}[ 2])
@param formatter The outpout formatter.
@param t The term.
*)
val pp_smt2 : bv_format:int -> Format.formatter -> t -> unit
(**
[pp_smt2 base formatter t]
print term in SMTlib format.
@param bv_format The bit-vector number format:
[2] for binary, [10] for decimal and [16] for hexadecimal.
@param formatter The output formatter.
@param t The term.
*)
val to_string : ?bv_format:int -> t -> string
(**
[to_string t ~bv_format]
get string representation of this term.
@param t The term.
@param bv_format The bit-vector number format:
[2] for binary \[{b default}\],
[10] for decimal and [16] for hexadecimal.
@return String representation of this term.
*)
(** {2:term_query Query} *)
val id : t -> int64
(**
[id t]
get the id of this term.
@param t The term.
@return The id value of the term.
*)
val kind : t -> Kind.t
(**
[kind t]
get the kind of a term.
@param t The term.
@return The kind of the given term.
*)
val sort : t -> Sort.t
(**
[sort t]
get the sort of a term.
@param t The term.
@return The sort of the term.
*)
val num_children : t -> int
(**
[num_children t]
get the number of child terms of a term.
@param t The term.
@return The number children of [t].
*)
val children : t -> t array
(**
[children t]
get the child terms of a term.
@param t The term.
@return The children of [t] as an array of terms.
*)
val get : t -> int -> t
(**
[get t i]
return child at position [i].
Only valid to call if [num_children t > 0].
@param i The position of the child.
@return The child node at position [i].
*)
val num_indices : t -> int
(**
[num_indices t]
get the number of indices of an indexed term.