/usr/share/axiom-20170501/src/algebra/BOOLEAN.spad is in axiom-source 20170501-3.
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 | )abbrev domain BOOLEAN Boolean
++ Author: Stephen M. Watt
++ Description:
++ \spadtype{Boolean} is the elementary logic with 2 values:
++ true and false
Boolean() : SIG == CODE where
SIG ==> Join(OrderedSet, Finite, Logic, ConvertibleTo InputForm) with
true : constant -> %
++ \axiom{true} is a logical constant.
false : constant -> %
++ \axiom{false} is a logical constant.
_^ : % -> %
++ ^ n returns the negation of n.
_not : % -> %
++ not n returns the negation of n.
_and : (%, %) -> %
++ a and b returns the logical and of Boolean \spad{a} and b.
_or : (%, %) -> %
++ a or b returns the logical inclusive or
++ of Boolean \spad{a} and b.
xor : (%, %) -> %
++ xor(a,b) returns the logical exclusive or
++ of Boolean \spad{a} and b.
nand : (%, %) -> %
++ 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.
implies : (%, %) -> %
++ implies(a,b) returns the logical implication
++ of Boolean \spad{a} and b.
test : % -> Boolean
++ test(b) returns b and is provided for compatibility with the
++ new compiler.
CODE ==> add
nt: % -> %
test a == a pretend Boolean
nt b == (b pretend Boolean => 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)
a = b == BooleanEquality(a, b)$Lisp
implies(a, b) == (test a => b; true)
a < b == (test b => not(test a);false)
size() == 2
index i ==
even?(i::Integer) => false
true
lookup a ==
a pretend Boolean => 1
2
random() ==
even?(random()$Integer) => false
true
convert(x:%):InputForm ==
x pretend Boolean => convert("true"::Symbol)
convert("false"::Symbol)
coerce(x:%):OutputForm ==
x pretend Boolean => message "true"
message "false"
|