-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathprooftree-tests.scm
87 lines (84 loc) · 2.52 KB
/
prooftree-tests.scm
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
(load "mk.scm")
(load "utils.scm")
(load "prooftree.scm")
(load "meta.scm")
(load "matche.scm")
(load "ex-peano.scm")
(load "ex-stlc.scm")
(load "test-check.scm")
(test-check "pluso-prooftree"
(run 3 (q)
(fresh (a b c proof)
(== q `((,a ,b ,c) ,proof))
((prooftree pluso-clause-case)
`(pluso ,a ,b ,c) proof)))
'(((z _.0 _.0) (((pluso z _.0 _.0) () <-- ())))
(((s z) _.0 (s _.0))
(((pluso (s z) _.0 (s _.0))
() <--
(((pluso z _.0 _.0) () <-- ())))))
(((s (s z)) _.0 (s (s _.0)))
(((pluso (s (s z)) _.0 (s (s _.0)))
() <--
(((pluso (s z) _.0 (s _.0))
() <--
(((pluso z _.0 _.0) () <-- ())))))))))
(test-check "stlc-prooftree-no-eigen"
(run 2 (q)
(fresh (term proof)
(== q `(,term ,proof))
((prooftree !-o-clause-case)
`(!-o () ,term (A -> A))
proof)))
'((((lambda (_.0) _.0)
(((!-o () (lambda (_.0) _.0) (A -> A))
abs <--
(((!-o ((_.0 : A)) _.0 A) var <-- ())))))
(sym _.0))
(((lambda (_.0) ((lambda (_.1) _.1) _.0))
(((!-o () (lambda (_.0) ((lambda (_.1) _.1) _.0)) (A -> A))
abs <--
(((!-o ((_.0 : A)) ((lambda (_.1) _.1) _.0) A)
app <--
(((!-o ((_.0 : A)) (lambda (_.1) _.1) (A -> A))
abs <--
(((!-o ((_.1 : A) (_.0 : A)) _.1 A) var <-- ())))
((!-o ((_.0 : A)) _.0 A) var <-- ())))))))
(sym _.0 _.1))))
(test-check "stlc-prooftree-if"
(run* (q)
(fresh (term ty proof)
(== term '(lambda (x) (if x (lambda (y) x) (lambda (y) y))))
(== q `(,term ,ty ,proof))
((prooftree !!-o-clause-case)
`(!!-o () ,term ,ty)
proof)))
'(((lambda (x) (if x (lambda (y) x) (lambda (y) y)))
(boolean -> (boolean -> boolean))
(((!!-o
()
(lambda (x) (if x (lambda (y) x) (lambda (y) y)))
(boolean -> (boolean -> boolean)))
abs
<--
(((!!-o
((x : boolean))
(if x (lambda (y) x) (lambda (y) y))
(boolean -> boolean))
if
<--
(((!!-o ((x : boolean)) x boolean) var <-- ())
((!!-o ((x : boolean)) (lambda (y) x) (boolean -> boolean))
abs
<--
(((!!-o ((y : boolean) (x : boolean)) x boolean)
var
<--
())))
((!!-o ((x : boolean)) (lambda (y) y) (boolean -> boolean))
abs
<--
(((!!-o ((y : boolean) (x : boolean)) y boolean)
var
<--
())))))))))))