File: satisfiable-add-proof-clause-drat.lisp

package info (click to toggle)
acl2 8.6%2Bdfsg-2
  • links: PTS
  • area: main
  • in suites: trixie
  • size: 1,111,420 kB
  • sloc: lisp: 17,818,294; java: 125,359; python: 28,122; javascript: 23,458; cpp: 18,851; ansic: 11,569; perl: 7,678; xml: 5,591; sh: 3,976; makefile: 3,833; ruby: 2,633; yacc: 1,126; ml: 763; awk: 295; csh: 233; lex: 197; php: 178; tcl: 49; asm: 23; haskell: 17
file content (161 lines) | stat: -rw-r--r-- 7,082 bytes parent folder | download | duplicates (5)
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
; Copyright (C) 2016, Regents of the University of Texas
; Marijn Heule, Warren A. Hunt, Jr., and Matt Kaufmann
; License: A 3-clause BSD license.  See the LICENSE file distributed with ACL2.

; See soundness.lisp.  Here we prove a key lemma in support of that book.

(in-package "LRAT")

(include-book "satisfiable-add-proof-clause-base")

; We include the following book at the top level, rather than locally to an
; encapsulate, because some of its lemmas other than the last one contribute to
; proofs in this book.

(include-book "sat-drat-claim-1")

(encapsulate
  ()
  (set-enforce-redundancy t)
  (defthm sat-drat-claim-1
    (implies (and (not (satisfiable (add-proof-clause index clause formula)))
                  (solution-p assignment formula)
                  (clause-or-assignment-p clause))
             (subsetp (negate-clause-or-assignment clause)
                      assignment))))

; The following might not be necessary, but it has perhaps been helpful during
; development of the events below.
(local (in-theory (disable verify-clause)))

(encapsulate
  ()
  (local (include-book "sat-drat-claim-2"))
  (set-enforce-redundancy t)
  (defthm sat-drat-claim-2
    (mv-let (ncls ndel new-formula)
      (verify-clause formula entry ncls ndel)
      (declare (ignore ndel))
      (implies (and ncls
                    (proof-entry-p entry)
                    (not (proof-entry-deletion-p entry))
                    (formula-p formula)
                    (solution-p assignment formula)
                    (not (equal (unit-propagation formula
                                                  (access add-step entry
                                                          :rup-indices)
                                                  (negate-clause-or-assignment
                                                   (access add-step entry
                                                           :clause)))
                                t))
                    (not (satisfiable (add-proof-clause
                                       (access add-step entry :index)
                                       (access add-step entry :clause)
                                       new-formula)))
                    (hons-assoc-equal index formula)
                    (not (equal (cdr (hons-assoc-equal index formula))
                                *deleted-clause*)))
               (equal (evaluate-clause
                       (cdr (hons-assoc-equal index formula))
                       (flip-literal (car (access add-step entry :clause))
                                     assignment))
                      t)))
    :rule-classes nil))

(defthm sat-drat-claim-2-for-formula
  (mv-let (ncls ndel new-formula)
    (verify-clause formula entry ncls ndel)
    (declare (ignore ndel))
    (implies (and ncls
                  (proof-entry-p entry)
                  (not (proof-entry-deletion-p entry))
                  (formula-p formula)
                  (solution-p assignment formula)
                  (not (equal (unit-propagation formula
                                                (access add-step entry
                                                        :rup-indices)
                                                (negate-clause-or-assignment
                                                 (access add-step entry
                                                         :clause)))
                              t))
                  (not (satisfiable (add-proof-clause
                                     (access add-step entry :index)
                                     (access add-step entry :clause)
                                     new-formula))))
             (formula-truep
              formula
              (flip-literal (car (access add-step entry :clause))
                            assignment))))
  :hints (("Goal"
           :in-theory
           (enable formula-truep)
           :use
           ((:instance sat-drat-claim-2
                       (index (formula-truep-witness
                               formula
                               (flip-literal (car (access add-step entry
                                                          :clause))
                                             assignment)))))))
  :rule-classes nil)

(include-book "satisfiable-maybe-shrink-formula")

(defthm sat-drat-key
  (mv-let (ncls ndel new-formula)
    (verify-clause formula entry ncls ndel)
    (declare (ignore ndel))
    (implies (and ncls
                  (proof-entry-p entry)
                  (not (proof-entry-deletion-p entry))
                  (formula-p formula)
                  (solution-p assignment formula)
                  (not (equal (unit-propagation formula
                                                (access add-step entry
                                                        :rup-indices)
                                                (negate-clause-or-assignment
                                                 (access add-step entry
                                                         :clause)))
                              t))
                  (consp (access add-step entry :clause)))
             (satisfiable (add-proof-clause
                           (access add-step entry :index)
                           (access add-step entry :clause)
                           new-formula))))
  :hints (("Goal"
           :in-theory (enable verify-clause)
           :restrict
           ((formula-truep-add-proof-clause
             ((lit (cadr (car entry)))))
            (satisfiable-suff
             ((assignment (flip-literal (cadr (car entry)) assignment)))))
           :use sat-drat-claim-2-for-formula)))

(defthm satisfiable-add-proof-clause-drat
  (mv-let (ncls ndel new-formula)
    (verify-clause formula entry ncls ndel)
    (declare (ignore ndel))
    (implies (and ncls
                  (proof-entry-p entry)
                  (not (proof-entry-deletion-p entry))
                  (formula-p formula)
                  (satisfiable formula)
                  (not (equal (unit-propagation formula
                                                (access add-step entry
                                                        :rup-indices)
                                                (negate-clause-or-assignment
                                                 (access add-step entry
                                                         :clause)))
                              t))
                  (consp (access add-step entry :clause)))
             (satisfiable (add-proof-clause
                           (access add-step entry :index)
                           (access add-step entry :clause)
                           new-formula))))
  :hints
  (("Goal"
    :in-theory (union-theories '(sat-drat-key)
                               (theory 'minimal-theory))
    :expand ((satisfiable formula))
    :use ((:instance sat-drat-key
                     (assignment (satisfiable-witness formula))))))
  :rule-classes nil)