summaryrefslogtreecommitdiff
path: root/proofs/signatures/drat_test.plf
blob: f2f2c7286a638552c919ece6c0a184c1439c55a0 (plain)
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
;depends on drat.plf
(declare check_rat
         (! f cnf
            (! c clause
               (! b bool
                  (! sc (^ (is_rat f c) b)
                    bottom)))))

(declare trust_cnf (! f cnf (cnf_holds f)))

; RAT Test 1
; Formula: (-p, -a) ^ (-p, b) ^( b, c) ^ (-c, a)
; Candidate RAT: (p, a)
; Answer: true
(check
  (% va var
     (% vb var
        (% vc var
           (% vp var
              (check_rat
                (cnfc (clc (neg vp) (clc (neg va) cln))
                      (cnfc (clc (neg vp) (clc (pos vb) cln))
                            (cnfc (clc (pos vb) (clc (pos vc) cln))
                                  (cnfc (clc (neg vc) (clc (pos va) cln)) cnfn))))
                (clc (pos vp) (clc (pos va) cln))
                tt))))))

; RAT Test 2
; Formula:
;  p cnf 4 8
;  1  2 -3 0
; -1 -2  3 0
;  2  3 -4 0
; -2 -3  4 0
; -1 -3 -4 0
;  1  3  4 0
; -1  2  4 0
;  1 -2 -4 0
; Candidate RAT: -1
(check
  (% v1 var
     (% v2 var
        (% v3 var
           (% v4 var
              (check_rat
                (cnfc (clc (pos v1) (clc (pos v2) (clc (neg v3) cln)))
                      (cnfc (clc (neg v1) (clc (neg v2) (clc (pos v3) cln)))
                      (cnfc (clc (pos v2) (clc (pos v3) (clc (neg v4) cln)))
                      (cnfc (clc (neg v2) (clc (neg v3) (clc (pos v4) cln)))
                      (cnfc (clc (neg v1) (clc (neg v3) (clc (neg v4) cln)))
                      (cnfc (clc (pos v1) (clc (pos v3) (clc (pos v4) cln)))
                      (cnfc (clc (neg v1) (clc (pos v2) (clc (pos v4) cln)))
                      (cnfc (clc (pos v1) (clc (neg v2) (clc (neg v4) cln)))
                      cnfn))))))))
                (clc (neg v1) cln)
                tt))))))

; RAT Test 3
; Formula:
;  p cnf 4 9
;  1  2 -3 0
; -1 -2  3 0
;  2  3 -4 0
; -2 -3  4 0
; -1 -3 -4 0
;  1  3  4 0
; -1  2  4 0
;  1 -2 -4 0
; -1 0
; Candidate RAT: 2
(check
  (% v1 var
     (% v2 var
        (% v3 var
           (% v4 var
              (check_rat
                (cnfc (clc (pos v1) (clc (pos v2) (clc (neg v3) cln)))
                      (cnfc (clc (neg v1) (clc (neg v2) (clc (pos v3) cln)))
                      (cnfc (clc (pos v2) (clc (pos v3) (clc (neg v4) cln)))
                      (cnfc (clc (neg v2) (clc (neg v3) (clc (pos v4) cln)))
                      (cnfc (clc (neg v1) (clc (neg v3) (clc (neg v4) cln)))
                      (cnfc (clc (pos v1) (clc (pos v3) (clc (pos v4) cln)))
                      (cnfc (clc (neg v1) (clc (pos v2) (clc (pos v4) cln)))
                      (cnfc (clc (pos v1) (clc (neg v2) (clc (neg v4) cln)))
                      (cnfc (clc (neg v1) cln)
                      cnfn)))))))))
                (clc (pos v2) cln)
                tt))))))

; RAT Test 4
; Formula:
;  p cnf 4 2
;  2 -3 0
;  1 -4 0
; Candidate RAT: 3
; Answer: false
(check
  (% v1 var
     (% v2 var
        (% v3 var
           (% v4 var
              (check_rat
                (cnfc (clc (pos v2) (clc (neg v3) cln))
                      (cnfc (clc (pos v1) (clc (neg v4) cln)) cnfn))
                (clc (pos v3) cln)
                ff))))))


; DRAT Test 1 (from Example 1 @ https://www.cs.utexas.edu/~marijn/drat-trim/)
; without deletions
; Formula:
;   p cnf 4 8
;    1  2 -3 0
;   -1 -2  3 0
;    2  3 -4 0
;   -2 -3  4 0
;   -1 -3 -4 0
;    1  3  4 0
;   -1  2  4 0
;    1 -2 -4
; Proof:
;           -1 0
;            2 0
;              0
(check
  (% v1 var
     (% v2 var
        (% v3 var
           (% v4 var
              (:
                (holds cln)
                (drat_proof_of_bottom _
                  (trust_cnf (cnfc (clc (pos v1) (clc (pos v2) (clc (neg v3) cln)))
                        (cnfc (clc (neg v1) (clc (neg v2) (clc (pos v3) cln)))
                        (cnfc (clc (pos v2) (clc (pos v3) (clc (neg v4) cln)))
                        (cnfc (clc (neg v2) (clc (neg v3) (clc (pos v4) cln)))
                        (cnfc (clc (neg v1) (clc (neg v3) (clc (neg v4) cln)))
                        (cnfc (clc (pos v1) (clc (pos v3) (clc (pos v4) cln)))
                        (cnfc (clc (neg v1) (clc (pos v2) (clc (pos v4) cln)))
                        (cnfc (clc (pos v1) (clc (neg v2) (clc (neg v4) cln)))
                        cnfn)))))))))
                  (DRATProofa (clc (neg v1) cln)
                        (DRATProofa (clc (pos v2) cln)
                        (DRATProofa cln
                        DRATProofn))))))))))


; DRAT Test 2 (from Example 1 @ https://www.cs.utexas.edu/~marijn/drat-trim/)
; with deletions
; Formula:
;   p cnf 4 8
;    1  2 -3 0
;   -1 -2  3 0
;    2  3 -4 0
;   -2 -3  4 0
;   -1 -3 -4 0
;    1  3  4 0
;   -1  2  4 0
;    1 -2 -4
; Proof:
;           -1 0
;   d -1 -2  3 0
;   d -1 -3 -4 0
;   d -1  2  4 0
;            2 0
;   d  1  2 -3 0
;   d  2  3 -4 0
;              0
(check
  (% v1 var (% v2 var (% v3 var (% v4 var
     (: (holds cln)
       (drat_proof_of_bottom _
         (trust_cnf 
         (cnfc (clc (pos v1) (clc (pos v2) (clc (neg v3) cln)))
               (cnfc (clc (neg v1) (clc (neg v2) (clc (pos v3) cln)))
               (cnfc (clc (pos v2) (clc (pos v3) (clc (neg v4) cln)))
               (cnfc (clc (neg v2) (clc (neg v3) (clc (pos v4) cln)))
               (cnfc (clc (neg v1) (clc (neg v3) (clc (neg v4) cln)))
               (cnfc (clc (pos v1) (clc (pos v3) (clc (pos v4) cln)))
               (cnfc (clc (neg v1) (clc (pos v2) (clc (pos v4) cln)))
               (cnfc (clc (pos v1) (clc (neg v2) (clc (neg v4) cln)))
               cnfn)))))))))
         (DRATProofa (clc (neg v1) cln)
               (DRATProofd (clc (neg v1) (clc (neg v2) (clc (pos v3) cln)))
               (DRATProofd (clc (neg v1) (clc (neg v3) (clc (neg v4) cln)))
               (DRATProofd (clc (neg v1) (clc (pos v2) (clc (pos v4) cln)))
               (DRATProofa (clc (pos v2) cln)
               (DRATProofd (clc (pos v1) (clc (pos v2) (clc (neg v3) cln)))
               (DRATProofd (clc (pos v2) (clc (pos v3) (clc (neg v4) cln)))
               (DRATProofa cln
                DRATProofn)))))))))))))))
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback