3
;; This book contains the top definitions and soundness theorems for
4
;; the model and countermodel procedures. This book is analogous
5
;; to a combination of the refute-n-check and prover books for the
6
;; refutation procedure, but it is much simpler, because the soundness
7
;; proof here is trivial.
9
(include-book "nnf") ; nnf
10
(include-book "rename-top") ; rename-all
11
(include-book "skolem-top") ; skolemize
12
(include-book "cnf") ; cnf
13
(include-book "pull-top") ; pull-quants
15
(include-book "derive")
17
(defstub external-modeler (clauses) t)
19
;; Function model-attempt is analogous to a combination of
20
;; refute-n-check and refutation-attempt. We compose all of the
21
;; preprocessing steps, build an initial proof object, and
22
;; call external-modeler, and check the result.
24
(defun model-attempt (f)
25
(declare (xargs :guard (and (wff f) (not (free-vars f)))))
26
(if (not (and (wff f) (not (free-vars f))))
30
(pull-quants (skolemize (rename-all (nnf f))))))
35
(remove-leading-alls preprocessed)) 1))))
36
(if (feval f mace-result)
40
;; This "soundness" proof is really trivial, because model-attempt
41
;; checks MACE's answer by calling feval.
43
(defthm model-attempt-fsound ;; Top Theorem #3
44
(implies (model-attempt f)
47
(feval f (model-attempt f)))))
49
(in-theory (disable model-attempt))
51
;; Now state it positively. That is, if we find a model of the negation
52
;; of a formula, then we have a countermodel of the formula.
53
;; This is a top function, so check the guard.
55
(defun countermodel-attempt (f)
56
(declare (xargs :guard (and (wff f) (not (free-vars f)))))
57
(if (not (and (wff f) (not (free-vars f))))
59
(model-attempt (list 'not f))))
61
(defthm countermodel-attempt-fsound ;; Top Theorem #4
62
(implies (countermodel-attempt f)
65
(not (feval f (countermodel-attempt f)))))
67
:in-theory (enable model-attempt))))
69
(in-theory (disable countermodel-attempt))