/usr/share/cafeobj-1.5/lib/ntruth.cafe is in cafeobj 1.5.7-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | ** -*- Mode:Lisp -*-
** new truth module
** system: Chaos
** module: library
** file: ntruth.cafe
**
** 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.
**
** -------------------------------------------------------------
--
-- NOTE: You may need to modify `setup-truth' if you change
-- the definition of module TRUTH
--
lispq
(when (fboundp 'setup-truth) (fmakubound 'setup-truth))
lispq
(defun setup-truth ()
(setq *TRUTH-module* (eval-modexp "TRUTH"))
(prepare-for-parsing *truth-module*)
(with-in-module (*truth-module*)
(let* ((sort-mem-op-info (find-operator '("_" ":is" "_")
2
*truth-module*))
(sort-mem-meth (lowest-method* (car (opinfo-methods sort-mem-op-info)))))
(setq *sort-membership* sort-mem-meth))
(let* ((if-op-info (find-operator '("if" "_" "then" "_" "else" "_" "fi")
3
*truth-module*))
(if-meth (lowest-method* (car (opinfo-methods if-op-info)))))
;; if_theh_else_fi must be treated in special manner
;; we need to see it globaly in system
(setq *BOOL-if* if-meth)
;;
(let* ((equal-op-info (find-operator '("_" "==" "_") 2 *truth-module*))
(equal-meth (lowest-method* (car (opinfo-methods equal-op-info))))
(beq-op-info (find-operator '("_" "=*=" "_") 2 *truth-module*))
(beq-meth (lowest-method* (car (opinfo-methods beq-op-info))))
(n-equal-op-info (find-operator '("_" "=/=" "_") 2 *truth-module*))
(n-equal-meth (lowest-method* (car (opinfo-methods n-equal-op-info))))
(beh-eq-info (find-operator '("_" "=b=" "_") 2 *truth-module*))
(beh-eq-meth (lowest-method* (car (opinfo-methods beh-eq-info)))))
;; also these operators are needed to be accessed globaly
;; for TRAM(BRUTE) interface and PigNose
(setq *bool-equal* equal-meth)
(setq *beh-equal* beq-meth)
(setq *bool-nonequal* n-equal-meth)
(setq *beh-eq-pred* beh-eq-meth)
))))
** allow using universal sorts
set sys universal-sort on
** we don't want to include BOOL of course
lispq
(progn
(setq *include-bool-save* *include-bool*)
(setq *include-bool* nil))
** TRUTH
sys:mod! TRUTH
principal-sort Bool
{
-- TRUTH-VALUE is a hardwired builtin which declares sort Bool and
-- two constants true and false.
protecting (TRUTH-VALUE)
signature {
pred _:is_ : Cosmos SortId { prec: 125 }
op if_then_else_fi : Bool *Cosmos* *Cosmos* -> *Cosmos*
{ strat: (1 0) prec: 0 }
pred _==_ : *Cosmos* *Cosmos* { prec: 51 }
pred _=*=_ : *HUniversal* *HUniversal* { prec: 51 }
pred _=b=_ : *Cosmos* *Cosmos* { prec: 51 }
pred _=/=_ : *Cosmos* *Cosmos* { prec: 51 }
}
axioms {
var XU : *Universal*
var YU : *Universal*
var CXU : *Cosmos*
var CYU : *Cosmos*
eq CXU :is Id:SortId = #!! (coerce-to-bool (test-term-sort-membership cxu id)) .
eq if true then CXU else CYU fi
= CXU .
eq if false then CXU else CYU fi
= CYU .
eq CXU == CYU = #!! (coerce-to-bool (term-equational-equal cxu cyu)) .
eq CXU =b= CYU = #!! (coerce-to-bool (term-equational-equal cxu cyu)) .
eq CXU =/= CYU = #!! (coerce-to-bool (not (term-equational-equal cxu cyu))) .
}
}
** setup truth module
lispq
(setup-truth)
lispq
(setup-tram-bool-modules)
lispq
(init-builtin-universal)
**
set sys universal-sort off
lispq
(setq *include-bool* *include-bool-save*)
**
provide truth
provide TRUTH
**
eof
|