diff options
Diffstat (limited to 'src/algebra/boolean.spad.pamphlet')
-rw-r--r-- | src/algebra/boolean.spad.pamphlet | 124 |
1 files changed, 64 insertions, 60 deletions
diff --git a/src/algebra/boolean.spad.pamphlet b/src/algebra/boolean.spad.pamphlet index 70373712..c3781e73 100644 --- a/src/algebra/boolean.spad.pamphlet +++ b/src/algebra/boolean.spad.pamphlet @@ -467,9 +467,9 @@ Logic: Category == BasicType with ++ true and false Boolean(): Join(OrderedSet, Finite, Logic, PropositionalLogic, ConvertibleTo InputForm) with - true : constant -> % + true: % ++ true is a logical constant. - false : constant -> % + false: % ++ false is a logical constant. _^ : % -> % ++ ^ n returns the negation of n. @@ -480,49 +480,49 @@ Boolean(): Join(OrderedSet, Finite, Logic, PropositionalLogic, ConvertibleTo Inp ++ nand(a,b) returns the logical negation of \spad{a} and b. nor : (%, %) -> % ++ nor(a,b) returns the logical negation of \spad{a} or b. - test: % -> Boolean + test: % -> % ++ test(b) returns b and is provided for compatibility with the new compiler. == add nt: % -> % - test a == a pretend Boolean + test a == a - nt b == (b pretend Boolean => false; true) + nt b == (b => false; true) true == EQ(2,2)$Lisp --well, 1 is rather special false == NIL$Lisp sample() == true - not b == (test b => false; true) - _^ b == (test b => false; true) - _~ b == (test b => false; true) - _and(a, b) == (test a => b; false) - _/_\(a, b) == (test a => b; false) - _or(a, b) == (test a => true; b) - _\_/(a, b) == (test a => true; b) - xor(a, b) == (test a => nt b; b) - nor(a, b) == (test a => false; nt b) - nand(a, b) == (test a => nt b; true) + not b == (b => false; true) + _^ b == (b => false; true) + _~ b == (b => false; true) + _and(a, b) == (a => b; false) + _/_\(a, b) == (a => b; false) + _or(a, b) == (a => true; b) + _\_/(a, b) == (a => true; b) + xor(a, b) == (a => nt b; b) + nor(a, b) == (a => false; nt b) + nand(a, b) == (a => nt b; true) a = b == BooleanEquality(a, b)$Lisp - implies(a, b) == (test a => b; true) + implies(a, b) == (a => b; true) equiv(a,b) == BooleanEquality(a, b)$Lisp - a < b == (test b => not(test a);false) + a < b == (b => not a; false) size() == 2 index i == even?(i::Integer) => false true lookup a == - a pretend Boolean => 1 + a => 1 2 random() == even?(random()$Integer) => false true convert(x:%):InputForm == - x pretend Boolean => convert("true"::Symbol) + x => convert("true"::Symbol) convert("false"::Symbol) coerce(x:%):OutputForm == - x pretend Boolean => message "true" + x => message "true" message "false" @ @@ -540,9 +540,9 @@ This is eventually forcibly replaced by a recompiled version. (/VERSIONCHECK 2) -(PUT '|BOOLEAN;test;$B;1| '|SPADreplace| '(XLAM (|a|) |a|)) +(PUT '|BOOLEAN;test;2$;1| '|SPADreplace| '(XLAM (|a|) |a|)) -(DEFUN |BOOLEAN;test;$B;1| (|a| $) |a|) +(DEFUN |BOOLEAN;test;2$;1| (|a| $) |a|) (DEFUN |BOOLEAN;nt| (|b| $) (COND (|b| 'NIL) ('T 'T))) @@ -588,34 +588,37 @@ This is eventually forcibly replaced by a recompiled version. (DEFUN |BOOLEAN;equiv;3$;17| (|a| |b| $) (|BooleanEquality| |a| |b|)) (DEFUN |BOOLEAN;<;2$B;18| (|a| |b| $) - (COND (|b| (SPADCALL |a| (QREFELT $ 23))) ('T 'NIL))) + (COND (|b| (SPADCALL |a| (|getShellEntry| $ 9))) ('T 'NIL))) (PUT '|BOOLEAN;size;Nni;19| '|SPADreplace| '(XLAM NIL 2)) (DEFUN |BOOLEAN;size;Nni;19| ($) 2) (DEFUN |BOOLEAN;index;Pi$;20| (|i| $) - (COND ((SPADCALL |i| (QREFELT $ 28)) 'NIL) ('T 'T))) + (COND ((SPADCALL |i| (|getShellEntry| $ 27)) 'NIL) ('T 'T))) (DEFUN |BOOLEAN;lookup;$Pi;21| (|a| $) (COND (|a| 1) ('T 2))) (DEFUN |BOOLEAN;random;$;22| ($) - (COND ((SPADCALL (|random|) (QREFELT $ 28)) 'NIL) ('T 'T))) + (COND ((SPADCALL (|random|) (|getShellEntry| $ 27)) 'NIL) ('T 'T))) (DEFUN |BOOLEAN;convert;$If;23| (|x| $) (COND - (|x| (SPADCALL (SPADCALL "true" (QREFELT $ 35)) (QREFELT $ 37))) - ('T (SPADCALL (SPADCALL "false" (QREFELT $ 35)) (QREFELT $ 37))))) + (|x| (SPADCALL (SPADCALL "true" (|getShellEntry| $ 34)) + (|getShellEntry| $ 36))) + ('T + (SPADCALL (SPADCALL "false" (|getShellEntry| $ 34)) + (|getShellEntry| $ 36))))) (DEFUN |BOOLEAN;coerce;$Of;24| (|x| $) (COND - (|x| (SPADCALL "true" (QREFELT $ 40))) - ('T (SPADCALL "false" (QREFELT $ 40))))) + (|x| (SPADCALL "true" (|getShellEntry| $ 39))) + ('T (SPADCALL "false" (|getShellEntry| $ 39))))) (DEFUN |Boolean| () (PROG () (RETURN - (PROG (#0=#:G1458) + (PROG (#0=#:G1421) (RETURN (COND ((LETT #0# (HGET |$ConstructorCache| '|Boolean|) |Boolean|) @@ -634,15 +637,16 @@ This is eventually forcibly replaced by a recompiled version. (RETURN (PROGN (LETT |dv$| '(|Boolean|) . #0=(|Boolean|)) - (LETT $ (GETREFV 43) . #0#) - (QSETREFV $ 0 |dv$|) - (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #0#)) + (LETT $ (|newShell| 42) . #0#) + (|setShellEntry| $ 0 |dv$|) + (|setShellEntry| $ 3 + (LETT |pv$| (|buildPredVector| 0 0 NIL) . #0#)) (|haddProp| |$ConstructorCache| '|Boolean| NIL (CONS 1 $)) (|stuffDomainSlots| $) $)))) (MAKEPROP '|Boolean| '|infovec| - (LIST '#(NIL NIL NIL NIL NIL NIL (|Boolean|) |BOOLEAN;test;$B;1| + (LIST '#(NIL NIL NIL NIL NIL NIL |BOOLEAN;test;2$;1| (CONS IDENTITY (FUNCALL (|dispatchFunction| |BOOLEAN;true;$;3|) $)) (CONS IDENTITY @@ -650,42 +654,42 @@ This is eventually forcibly replaced by a recompiled version. |BOOLEAN;not;2$;5| |BOOLEAN;^;2$;6| |BOOLEAN;~;2$;7| |BOOLEAN;and;3$;8| |BOOLEAN;/\\;3$;9| |BOOLEAN;or;3$;10| |BOOLEAN;\\/;3$;11| |BOOLEAN;xor;3$;12| - |BOOLEAN;nor;3$;13| |BOOLEAN;nand;3$;14| + |BOOLEAN;nor;3$;13| |BOOLEAN;nand;3$;14| (|Boolean|) |BOOLEAN;=;2$B;15| |BOOLEAN;implies;3$;16| - |BOOLEAN;equiv;3$;17| (0 . |not|) |BOOLEAN;<;2$B;18| + |BOOLEAN;equiv;3$;17| |BOOLEAN;<;2$B;18| (|NonNegativeInteger|) |BOOLEAN;size;Nni;19| (|Integer|) - (5 . |even?|) (|PositiveInteger|) |BOOLEAN;index;Pi$;20| + (0 . |even?|) (|PositiveInteger|) |BOOLEAN;index;Pi$;20| |BOOLEAN;lookup;$Pi;21| |BOOLEAN;random;$;22| (|String|) - (|Symbol|) (10 . |coerce|) (|InputForm|) (15 . |convert|) - |BOOLEAN;convert;$If;23| (|OutputForm|) (20 . |message|) + (|Symbol|) (5 . |coerce|) (|InputForm|) (10 . |convert|) + |BOOLEAN;convert;$If;23| (|OutputForm|) (15 . |message|) |BOOLEAN;coerce;$Of;24| (|SingleInteger|)) - '#(~= 25 ~ 31 |xor| 36 |true| 42 |test| 46 |size| 51 |random| - 55 |or| 59 |not| 65 |nor| 70 |nand| 76 |min| 82 |max| 88 - |lookup| 94 |latex| 99 |index| 104 |implies| 109 |hash| - 115 |false| 120 |equiv| 124 |convert| 130 |coerce| 135 - |and| 140 ^ 146 |\\/| 151 >= 157 > 163 = 169 <= 175 < 181 - |/\\| 187) + '#(~= 20 ~ 26 |xor| 31 |true| 37 |test| 41 |size| 46 |random| + 50 |or| 54 |not| 60 |nor| 65 |nand| 71 |min| 77 |max| 83 + |lookup| 89 |latex| 94 |index| 99 |implies| 104 |hash| 110 + |false| 115 |equiv| 119 |convert| 125 |coerce| 130 |and| + 135 ^ 141 |\\/| 146 >= 152 > 158 = 164 <= 170 < 176 |/\\| + 182) 'NIL (CONS (|makeByteWordVec2| 1 '(0 0 0 0 0 0 0 0)) (CONS '#(|OrderedSet&| NIL |Logic&| |SetCategory&| NIL NIL |BasicType&| NIL) (CONS '#((|OrderedSet|) (|Finite|) (|Logic|) - (|SetCategory|) (|ConvertibleTo| 36) + (|SetCategory|) (|ConvertibleTo| 35) (|PropositionalLogic|) (|BasicType|) - (|CoercibleTo| 39)) - (|makeByteWordVec2| 42 - '(1 6 0 0 23 1 27 6 0 28 1 34 0 33 35 1 - 36 0 34 37 1 39 0 33 40 2 0 6 0 0 1 1 - 0 0 0 12 2 0 0 0 0 17 0 0 0 8 1 0 6 0 - 7 0 0 25 26 0 0 0 32 2 0 0 0 0 15 1 0 - 0 0 10 2 0 0 0 0 18 2 0 0 0 0 19 2 0 - 0 0 0 1 2 0 0 0 0 1 1 0 29 0 31 1 0 - 33 0 1 1 0 0 29 30 2 0 0 0 0 21 1 0 - 42 0 1 0 0 0 9 2 0 0 0 0 22 1 0 36 0 - 38 1 0 39 0 41 2 0 0 0 0 13 1 0 0 0 - 11 2 0 0 0 0 16 2 0 6 0 0 1 2 0 6 0 0 - 1 2 0 6 0 0 20 2 0 6 0 0 1 2 0 6 0 0 - 24 2 0 0 0 0 14))))) + (|CoercibleTo| 38)) + (|makeByteWordVec2| 41 + '(1 26 19 0 27 1 33 0 32 34 1 35 0 33 + 36 1 38 0 32 39 2 0 19 0 0 1 1 0 0 0 + 11 2 0 0 0 0 16 0 0 0 7 1 0 0 0 6 0 0 + 24 25 0 0 0 31 2 0 0 0 0 14 1 0 0 0 9 + 2 0 0 0 0 17 2 0 0 0 0 18 2 0 0 0 0 1 + 2 0 0 0 0 1 1 0 28 0 30 1 0 32 0 1 1 + 0 0 28 29 2 0 0 0 0 21 1 0 41 0 1 0 0 + 0 8 2 0 0 0 0 22 1 0 35 0 37 1 0 38 0 + 40 2 0 0 0 0 12 1 0 0 0 10 2 0 0 0 0 + 15 2 0 19 0 0 1 2 0 19 0 0 1 2 0 19 0 + 0 20 2 0 19 0 0 1 2 0 19 0 0 23 2 0 0 + 0 0 13))))) '|lookupComplete|)) (MAKEPROP '|Boolean| 'NILADIC T) |