-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlib.smtlib
92 lines (79 loc) · 1.63 KB
/
lib.smtlib
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
(define-fun-rec append
((l1 (List Int))
(l2 (List Int)))
(List Int)
(ite (= l1 nil)
l2
(insert (head l1) (append (tail l1) l2))))
(define-fun-rec last
((l (List Int))) Int
(ite (= (tail l) nil)
(head l)
(last (tail l))))
(define-fun-rec len
((l (List Int))) Int
(ite (= l nil)
0
(+ 1 (len (tail l)))))
(define-fun-rec nth
((n Int)
(l (List Int)))
Int
(ite (<= n 0)
(head l)
(nth (- n 1) (tail l))))
(define-fun-rec insertAt
((n Int)
(x Int)
(l (List Int)))
(List Int)
(ite (<= n 0)
(insert x l)
(insert (head l) (insertAt (- n 1) x (tail l)))))
(define-fun-rec dropAt
((n Int)
(l (List Int)))
(List Int)
(ite (<= n 0)
(tail l)
(insert (head l) (dropAt (- n 1) (tail l)))))
(define-fun swap2
((n Int)
(m Int)
(l (List Int)))
(List Int)
(insertAt n (nth m l) (dropAt n (insertAt m (nth n l) (dropAt m l)))))
(define-fun swap
((n Int)
(m Int)
(l (List Int)))
(List Int)
(swap2 (ite (< n 0) (+ (len l) n) n) (ite (< m 0) (+ (len l) m) m) l))
(define-fun-rec prod
((l (List Int))) Int
(ite (= l nil)
1
(* (head l) (prod (tail l)))))
(define-fun-rec init
((l (List Int))) (List Int)
(ite (= l nil)
nil
(ite (= (tail l) nil)
nil
(insert (head l) (init (tail l))))))
; TODO
(define-fun reshape
((l1 (List Int))
(l2 (List Int))) (List Int)
l2)
; TODO
(define-fun broadcast
((l1 (List Int))
(l2 (List Int))) (List Int)
l2)
(define-fun reshapeable
((l1 (List Int))
(l2 (List Int))) Bool (= (prod l1) (prod l2)))
(define-fun broadcastable
((l1 (List Int))
(l2 (List Int))) Bool (= l1 l2))