aboutsummaryrefslogtreecommitdiff
path: root/src/algebra
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2009-05-28 21:44:26 +0000
committerdos-reis <gdr@axiomatics.org>2009-05-28 21:44:26 +0000
commit9a866efde4ed887d024c01a49b3cdde777d8deb3 (patch)
treec3434f7a42ddb6bc3590d9aba429129541c57c0a /src/algebra
parent0e6d0cdde92747cc02d9965eef8ef1edc31cb1ae (diff)
downloadopen-axiom-9a866efde4ed887d024c01a49b3cdde777d8deb3.tar.gz
* interp/compiler.boot (compVector): Tidy code generation.
(checkExternalEntity): Handle Builtin external entities. (compSignatureImport): Likewise. * algebra/boolean.spad.pamphlet (Boolean): Import Lisp function from Foreign Builtin. (KleeneTrivalentLogic): The constant `true' and `false' are now inherited.
Diffstat (limited to 'src/algebra')
-rw-r--r--src/algebra/boolean.spad.pamphlet32
-rw-r--r--src/algebra/strap/BOOLEAN.lsp141
2 files changed, 84 insertions, 89 deletions
diff --git a/src/algebra/boolean.spad.pamphlet b/src/algebra/boolean.spad.pamphlet
index f7cc1e9a..76c3c49b 100644
--- a/src/algebra/boolean.spad.pamphlet
+++ b/src/algebra/boolean.spad.pamphlet
@@ -315,25 +315,29 @@ Boolean(): Join(OrderedFinite, Logic, PropositionalLogic, ConvertibleTo InputFor
test: % -> %
++ test(b) returns b and is provided for compatibility with the new compiler.
== add
+ import EQ: (%,%) -> Boolean from Foreign Builtin
+ import AND: (%,%) -> % from Foreign Builtin
+ import OR: (%,%) -> % from Foreign Builtin
+ import NOT: % -> % from Foreign Builtin
+
test a == a
- nt(a: %): % == NOT(a)$Lisp
true == 'T pretend %
- false == NIL$Lisp
+ false == NIL$Foreign(Builtin)
sample() == true
- not b == nt b
+ not b == NOT b
~ b == (b => false; true)
- a and b == AND(a,b)$Lisp
- a /\ b == AND(a,b)$Lisp
- a or b == OR(a,b)$Lisp
- a \/ b == OR(a,b)$Lisp
- xor(a, b) == (a => nt b; b)
- nor(a, b) == (a => false; nt b)
- nand(a, b) == (a => nt b; true)
- a = b == EQ(a, b)$Lisp
+ a and b == AND(a,b)
+ a /\ b == AND(a,b)
+ a or b == OR(a,b)
+ a \/ b == OR(a,b)
+ xor(a, b) == (a => NOT b; b)
+ nor(a, b) == (a => false; NOT b)
+ nand(a, b) == (a => NOT b; true)
+ a = b == EQ(a, b)
implies(a, b) == (a => b; true)
- equiv(a,b) == EQ(a, b)$Lisp
- a < b == (b => nt a; false)
+ equiv(a,b) == EQ(a, b)
+ a < b == (b => NOT a; false)
size() == 2
index i ==
@@ -450,9 +454,7 @@ Bits(): Exports == Implementation where
++ This domain implements Kleene's 3-valued propositional logic.
KleeneTrivalentLogic(): Public == Private where
Public == PropositionalLogic with
- false: % ++ the definite falsehood value
unknown: % ++ the indefinite `unknown'
- true: % ++ the definite truth value
case: (%,[| false |]) -> Boolean
++ x case false holds if the value of `x' is `false'
case: (%,[| unknown |]) -> Boolean
diff --git a/src/algebra/strap/BOOLEAN.lsp b/src/algebra/strap/BOOLEAN.lsp
index b8bd682a..d672850f 100644
--- a/src/algebra/strap/BOOLEAN.lsp
+++ b/src/algebra/strap/BOOLEAN.lsp
@@ -6,160 +6,153 @@
(PUT '|BOOLEAN;test;2$;1| '|SPADreplace| '(XLAM (|a|) |a|))
-(DECLAIM (FTYPE (FUNCTION (|%Boolean| |%Shell|) |%Boolean|)
- |BOOLEAN;nt|))
-
-(PUT '|BOOLEAN;nt| '|SPADreplace| 'NOT)
+(DECLAIM (FTYPE (FUNCTION (|%Shell|) |%Boolean|) |BOOLEAN;true;$;2|))
-(DECLAIM (FTYPE (FUNCTION (|%Shell|) |%Boolean|) |BOOLEAN;true;$;3|))
+(PUT '|BOOLEAN;true;$;2| '|SPADreplace| '(XLAM NIL 'T))
-(PUT '|BOOLEAN;true;$;3| '|SPADreplace| '(XLAM NIL 'T))
+(DECLAIM (FTYPE (FUNCTION (|%Shell|) |%Boolean|) |BOOLEAN;false;$;3|))
-(DECLAIM (FTYPE (FUNCTION (|%Shell|) |%Boolean|) |BOOLEAN;false;$;4|))
-
-(PUT '|BOOLEAN;false;$;4| '|SPADreplace| '(XLAM NIL NIL))
+(PUT '|BOOLEAN;false;$;3| '|SPADreplace| '(XLAM NIL NIL))
(DECLAIM (FTYPE (FUNCTION (|%Boolean| |%Shell|) |%Boolean|)
- |BOOLEAN;not;2$;5|))
+ |BOOLEAN;not;2$;4|))
-(PUT '|BOOLEAN;not;2$;5| '|SPADreplace| 'NOT)
+(PUT '|BOOLEAN;not;2$;4| '|SPADreplace| 'NOT)
(DECLAIM (FTYPE (FUNCTION (|%Boolean| |%Shell|) |%Boolean|)
- |BOOLEAN;~;2$;6|))
+ |BOOLEAN;~;2$;5|))
(DECLAIM (FTYPE (FUNCTION (|%Boolean| |%Boolean| |%Shell|) |%Boolean|)
- |BOOLEAN;and;3$;7|))
+ |BOOLEAN;and;3$;6|))
-(PUT '|BOOLEAN;and;3$;7| '|SPADreplace| 'AND)
+(PUT '|BOOLEAN;and;3$;6| '|SPADreplace| 'AND)
(DECLAIM (FTYPE (FUNCTION (|%Boolean| |%Boolean| |%Shell|) |%Boolean|)
- |BOOLEAN;/\\;3$;8|))
+ |BOOLEAN;/\\;3$;7|))
-(PUT '|BOOLEAN;/\\;3$;8| '|SPADreplace| 'AND)
+(PUT '|BOOLEAN;/\\;3$;7| '|SPADreplace| 'AND)
(DECLAIM (FTYPE (FUNCTION (|%Boolean| |%Boolean| |%Shell|) |%Boolean|)
- |BOOLEAN;or;3$;9|))
+ |BOOLEAN;or;3$;8|))
-(PUT '|BOOLEAN;or;3$;9| '|SPADreplace| 'OR)
+(PUT '|BOOLEAN;or;3$;8| '|SPADreplace| 'OR)
(DECLAIM (FTYPE (FUNCTION (|%Boolean| |%Boolean| |%Shell|) |%Boolean|)
- |BOOLEAN;\\/;3$;10|))
+ |BOOLEAN;\\/;3$;9|))
-(PUT '|BOOLEAN;\\/;3$;10| '|SPADreplace| 'OR)
+(PUT '|BOOLEAN;\\/;3$;9| '|SPADreplace| 'OR)
(DECLAIM (FTYPE (FUNCTION (|%Boolean| |%Boolean| |%Shell|) |%Boolean|)
- |BOOLEAN;xor;3$;11|))
+ |BOOLEAN;xor;3$;10|))
(DECLAIM (FTYPE (FUNCTION (|%Boolean| |%Boolean| |%Shell|) |%Boolean|)
- |BOOLEAN;nor;3$;12|))
+ |BOOLEAN;nor;3$;11|))
(DECLAIM (FTYPE (FUNCTION (|%Boolean| |%Boolean| |%Shell|) |%Boolean|)
- |BOOLEAN;nand;3$;13|))
+ |BOOLEAN;nand;3$;12|))
(DECLAIM (FTYPE (FUNCTION (|%Boolean| |%Boolean| |%Shell|) |%Boolean|)
- |BOOLEAN;=;3$;14|))
+ |BOOLEAN;=;3$;13|))
-(PUT '|BOOLEAN;=;3$;14| '|SPADreplace| 'EQ)
+(PUT '|BOOLEAN;=;3$;13| '|SPADreplace| 'EQ)
(DECLAIM (FTYPE (FUNCTION (|%Boolean| |%Boolean| |%Shell|) |%Boolean|)
- |BOOLEAN;implies;3$;15|))
+ |BOOLEAN;implies;3$;14|))
(DECLAIM (FTYPE (FUNCTION (|%Boolean| |%Boolean| |%Shell|) |%Boolean|)
- |BOOLEAN;equiv;3$;16|))
+ |BOOLEAN;equiv;3$;15|))
-(PUT '|BOOLEAN;equiv;3$;16| '|SPADreplace| 'EQ)
+(PUT '|BOOLEAN;equiv;3$;15| '|SPADreplace| 'EQ)
(DECLAIM (FTYPE (FUNCTION (|%Boolean| |%Boolean| |%Shell|) |%Boolean|)
- |BOOLEAN;<;3$;17|))
+ |BOOLEAN;<;3$;16|))
(DECLAIM (FTYPE (FUNCTION (|%Shell|) (|%IntegerSection| 0))
- |BOOLEAN;size;Nni;18|))
+ |BOOLEAN;size;Nni;17|))
-(PUT '|BOOLEAN;size;Nni;18| '|SPADreplace| '(XLAM NIL 2))
+(PUT '|BOOLEAN;size;Nni;17| '|SPADreplace| '(XLAM NIL 2))
(DECLAIM (FTYPE (FUNCTION ((|%IntegerSection| 1) |%Shell|) |%Boolean|)
- |BOOLEAN;index;Pi$;19|))
+ |BOOLEAN;index;Pi$;18|))
(DECLAIM (FTYPE (FUNCTION (|%Boolean| |%Shell|) (|%IntegerSection| 1))
- |BOOLEAN;lookup;$Pi;20|))
+ |BOOLEAN;lookup;$Pi;19|))
-(DECLAIM (FTYPE (FUNCTION (|%Shell|) |%Boolean|) |BOOLEAN;random;$;21|))
+(DECLAIM (FTYPE (FUNCTION (|%Shell|) |%Boolean|) |BOOLEAN;random;$;20|))
(DECLAIM (FTYPE (FUNCTION (|%Boolean| |%Shell|) |%Thing|)
- |BOOLEAN;convert;$If;22|))
+ |BOOLEAN;convert;$If;21|))
(DECLAIM (FTYPE (FUNCTION (|%Boolean| |%Shell|) |%Thing|)
- |BOOLEAN;coerce;$Of;23|))
+ |BOOLEAN;coerce;$Of;22|))
(DEFUN |BOOLEAN;test;2$;1| (|a| $) (DECLARE (IGNORE $)) |a|)
-(DEFUN |BOOLEAN;nt| (|a| $) (DECLARE (IGNORE $)) (NOT |a|))
-
-(DEFUN |BOOLEAN;true;$;3| ($) (DECLARE (IGNORE $)) 'T)
+(DEFUN |BOOLEAN;true;$;2| ($) (DECLARE (IGNORE $)) 'T)
-(DEFUN |BOOLEAN;false;$;4| ($) (DECLARE (IGNORE $)) NIL)
+(DEFUN |BOOLEAN;false;$;3| ($) (DECLARE (IGNORE $)) NIL)
-(DEFUN |BOOLEAN;not;2$;5| (|b| $) (DECLARE (IGNORE $)) (NOT |b|))
+(DEFUN |BOOLEAN;not;2$;4| (|b| $) (DECLARE (IGNORE $)) (NOT |b|))
-(DEFUN |BOOLEAN;~;2$;6| (|b| $) (COND (|b| 'NIL) ('T 'T)))
+(DEFUN |BOOLEAN;~;2$;5| (|b| $) (COND (|b| 'NIL) ('T 'T)))
-(DEFUN |BOOLEAN;and;3$;7| (|a| |b| $)
+(DEFUN |BOOLEAN;and;3$;6| (|a| |b| $)
(DECLARE (IGNORE $))
(AND |a| |b|))
-(DEFUN |BOOLEAN;/\\;3$;8| (|a| |b| $)
+(DEFUN |BOOLEAN;/\\;3$;7| (|a| |b| $)
(DECLARE (IGNORE $))
(AND |a| |b|))
-(DEFUN |BOOLEAN;or;3$;9| (|a| |b| $)
+(DEFUN |BOOLEAN;or;3$;8| (|a| |b| $)
(DECLARE (IGNORE $))
(OR |a| |b|))
-(DEFUN |BOOLEAN;\\/;3$;10| (|a| |b| $)
+(DEFUN |BOOLEAN;\\/;3$;9| (|a| |b| $)
(DECLARE (IGNORE $))
(OR |a| |b|))
-(DEFUN |BOOLEAN;xor;3$;11| (|a| |b| $)
+(DEFUN |BOOLEAN;xor;3$;10| (|a| |b| $)
(COND (|a| (NOT |b|)) ('T |b|)))
-(DEFUN |BOOLEAN;nor;3$;12| (|a| |b| $)
+(DEFUN |BOOLEAN;nor;3$;11| (|a| |b| $)
(COND (|a| 'NIL) ('T (NOT |b|))))
-(DEFUN |BOOLEAN;nand;3$;13| (|a| |b| $)
+(DEFUN |BOOLEAN;nand;3$;12| (|a| |b| $)
(COND (|a| (NOT |b|)) ('T 'T)))
-(DEFUN |BOOLEAN;=;3$;14| (|a| |b| $)
+(DEFUN |BOOLEAN;=;3$;13| (|a| |b| $)
(DECLARE (IGNORE $))
(EQ |a| |b|))
-(DEFUN |BOOLEAN;implies;3$;15| (|a| |b| $) (COND (|a| |b|) ('T 'T)))
+(DEFUN |BOOLEAN;implies;3$;14| (|a| |b| $) (COND (|a| |b|) ('T 'T)))
-(DEFUN |BOOLEAN;equiv;3$;16| (|a| |b| $)
+(DEFUN |BOOLEAN;equiv;3$;15| (|a| |b| $)
(DECLARE (IGNORE $))
(EQ |a| |b|))
-(DEFUN |BOOLEAN;<;3$;17| (|a| |b| $) (COND (|b| (NOT |a|)) ('T 'NIL)))
+(DEFUN |BOOLEAN;<;3$;16| (|a| |b| $) (COND (|b| (NOT |a|)) ('T 'NIL)))
-(DEFUN |BOOLEAN;size;Nni;18| ($) (DECLARE (IGNORE $)) 2)
+(DEFUN |BOOLEAN;size;Nni;17| ($) (DECLARE (IGNORE $)) 2)
-(DEFUN |BOOLEAN;index;Pi$;19| (|i| $)
+(DEFUN |BOOLEAN;index;Pi$;18| (|i| $)
(COND ((SPADCALL |i| (|getShellEntry| $ 28)) 'NIL) ('T 'T)))
-(DEFUN |BOOLEAN;lookup;$Pi;20| (|a| $) (COND (|a| 1) ('T 2)))
+(DEFUN |BOOLEAN;lookup;$Pi;19| (|a| $) (COND (|a| 1) ('T 2)))
-(DEFUN |BOOLEAN;random;$;21| ($)
+(DEFUN |BOOLEAN;random;$;20| ($)
(COND ((SPADCALL (|random|) (|getShellEntry| $ 28)) 'NIL) ('T 'T)))
-(DEFUN |BOOLEAN;convert;$If;22| (|x| $)
+(DEFUN |BOOLEAN;convert;$If;21| (|x| $)
(COND (|x| '|true|) ('T '|false|)))
-(DEFUN |BOOLEAN;coerce;$Of;23| (|x| $)
+(DEFUN |BOOLEAN;coerce;$Of;22| (|x| $)
(COND (|x| '|true|) ('T '|false|)))
(DEFUN |Boolean| ()
(PROG ()
(RETURN
- (PROG (#0=#:G1426)
+ (PROG (#0=#:G1425)
(RETURN
(COND
((LETT #0# (HGET |$ConstructorCache| '|Boolean|) |Boolean|)
@@ -189,21 +182,21 @@
(MAKEPROP '|Boolean| '|infovec|
(LIST '#(NIL NIL NIL NIL NIL NIL |BOOLEAN;test;2$;1|
(CONS IDENTITY
- (FUNCALL (|dispatchFunction| |BOOLEAN;true;$;3|) $))
+ (FUNCALL (|dispatchFunction| |BOOLEAN;true;$;2|) $))
(CONS IDENTITY
- (FUNCALL (|dispatchFunction| |BOOLEAN;false;$;4|) $))
- |BOOLEAN;not;2$;5| (|Boolean|) (0 . |false|) (4 . |true|)
- |BOOLEAN;~;2$;6| |BOOLEAN;and;3$;7| |BOOLEAN;/\\;3$;8|
- |BOOLEAN;or;3$;9| |BOOLEAN;\\/;3$;10| |BOOLEAN;xor;3$;11|
- |BOOLEAN;nor;3$;12| |BOOLEAN;nand;3$;13| |BOOLEAN;=;3$;14|
- |BOOLEAN;implies;3$;15| |BOOLEAN;equiv;3$;16|
- |BOOLEAN;<;3$;17| (|NonNegativeInteger|)
- |BOOLEAN;size;Nni;18| (|Integer|) (8 . |even?|)
- (|PositiveInteger|) |BOOLEAN;index;Pi$;19| (13 . |One|)
- |BOOLEAN;lookup;$Pi;20| (17 . |random|)
- |BOOLEAN;random;$;21| (|InputForm|)
- |BOOLEAN;convert;$If;22| (|OutputForm|)
- |BOOLEAN;coerce;$Of;23| (|SingleInteger|) (|String|))
+ (FUNCALL (|dispatchFunction| |BOOLEAN;false;$;3|) $))
+ |BOOLEAN;not;2$;4| (|Boolean|) (0 . |false|) (4 . |true|)
+ |BOOLEAN;~;2$;5| |BOOLEAN;and;3$;6| |BOOLEAN;/\\;3$;7|
+ |BOOLEAN;or;3$;8| |BOOLEAN;\\/;3$;9| |BOOLEAN;xor;3$;10|
+ |BOOLEAN;nor;3$;11| |BOOLEAN;nand;3$;12| |BOOLEAN;=;3$;13|
+ |BOOLEAN;implies;3$;14| |BOOLEAN;equiv;3$;15|
+ |BOOLEAN;<;3$;16| (|NonNegativeInteger|)
+ |BOOLEAN;size;Nni;17| (|Integer|) (8 . |even?|)
+ (|PositiveInteger|) |BOOLEAN;index;Pi$;18| (13 . |One|)
+ |BOOLEAN;lookup;$Pi;19| (17 . |random|)
+ |BOOLEAN;random;$;20| (|InputForm|)
+ |BOOLEAN;convert;$If;21| (|OutputForm|)
+ |BOOLEAN;coerce;$Of;22| (|SingleInteger|) (|String|))
'#(~= 21 ~ 27 |xor| 32 |true| 38 |test| 42 |size| 47 |random|
51 |or| 55 |not| 61 |nor| 66 |nand| 72 |min| 78 |max| 88
|lookup| 98 |latex| 103 |index| 108 |implies| 113 |hash|