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
|
;;;-*-Mode:LISP; Package: CHAOS; Base:10; Syntax:Common-lisp -*-
;;;
;;; Copyright (c) 2000-2015, Toshimi Sawada. All rights reserved.
;;;
;;; Redistribution and use in source and binary forms, with or without
;;; modification, are permitted provided that the following conditions
;;; are met:
;;;
;;; * Redistributions of source code must retain the above copyright
;;; notice, this list of conditions and the following disclaimer.
;;;
;;; * Redistributions in binary form must reproduce the above
;;; copyright notice, this list of conditions and the following
;;; disclaimer in the documentation and/or other materials
;;; provided with the distribution.
;;;
;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;;
;;;
(in-package :chaos)
#|=============================================================================
System:Chaos
Module:BigPink
File:proof-sys.lisp
=============================================================================|#
#-:chaos-debug
(declaim (optimize (speed 3) (safety 0) #-GCL (debug 0)))
#+:chaos-debug
(declaim (optimize (speed 1) (safety 3) #-GCL (debug 3)))
;;;*****************************************************************************
;;; PROOF SYSTEM ASSOCIATED WITH MODULE
;;;*****************************************************************************
;;; extend module info
(defmacro module-proof-system (_mod)
`(getf (object-misc-info ,_mod) :proof-system))
(defun create-module-psystem (mod)
(declare (type module mod))
(if (module-proof-system mod)
(let ((psys (module-proof-system mod)))
(initialize-psystem psys mod))
(setf (module-proof-system mod)
(make-psystem :module mod
:clause-hash (make-hash-table :test #'eql)
:demodulators (make-hash-table :test #'eq)))
))
(defun update-module-proof-system (mod &optional do-anyway)
(declare (type module mod))
(let ((clear-passive nil))
(when (need-rewriting-preparation mod)
(compile-module mod)
(setq clear-passive t)
(setq do-anyway t))
(unless (module-proof-system mod)
(setq do-anyway t))
(let ((psystem (create-module-psystem mod)))
(when clear-passive
(setf (psystem-passive psystem) nil))
;; reset clause counter
(reset-clause-db psystem)
;; generate axioms in clause form
(module-axioms->clause psystem)
;; may introduce skolem functions.
(prepare-for-parsing mod)
;;
psystem)))
(defun reset-module-proof-system (module)
(declare (type module module))
;; setup lexical precedence of symbols.
(make-op-lex-prec-table module)
;; reset db:
(update-module-proof-system module t))
;;; PN-DB-RESET
;;;
(defun pn-db-reset (&optional (mod (get-context-module)))
(clear-all-index-tables)
(reset-module-proof-system mod))
(defun auto-db-reset (module)
(compile-module module)
(unless (module-proof-system module)
(create-module-psystem module))
(unless (psystem-axioms (module-proof-system module))
(pn-db-reset module)))
;;; CONTEXT MAKING MACRO
(defmacro with-proof-context ((_module_) &body body)
(once-only (_module_)
`(block with-proof-context
(block with-in-module
(let* ((*current-module* ,_module_)
(*current-sort-order* (module-sort-order *current-module*))
(*current-opinfo-table* (module-opinfo-table *current-module*))
(*current-ext-rule-table* (module-ext-rule-table *current-module*)))
(declare (special *current-module*
*current-sort-order*
*current-opinfo-table*
*current-ext-rule-table*))
(let* ((*current-proof-system* *current-module*)
(*current-psys* (module-proof-system *current-module*))
(*clause-hash* (psystem-clause-hash *current-psys*))
(*sos* (psystem-sos *current-psys*))
(*usable* (psystem-usable *current-psys*))
(*demodulators* (psystem-demodulators *current-psys*))
(*passive* (psystem-passive *current-psys*))
(*clause-given* nil)
)
(declare (special *current-proof-system*
*current-psys*
*clause-hash*
*sos*
*usable*
*clause-given*
*passive*))
;;
,@body)
)))))
;;; EOF
|