NAME
Muldis::D::Core::Bool - Muldis D boolean logic operators
VERSION
This document is Muldis::D::Core::Bool version 0.101.0.
PREFACE
This document is part of the Muldis D language specification, whose root document is Muldis::D; you should read that root document before you read this one, which provides subservient details. Moreover, you should read the Muldis::D::Core document before this current document, as that forms its own tree beneath a root document branch.
DESCRIPTION
This document describes essentially all of the core Muldis D operators that are specific to the core data type Bool
, a superset of all the generic ones that a typical programming language should have.
This documentation is pending.
FUNCTIONS FOR BOOLEAN LOGIC
These functions implement commonly used boolean logic operations.
sys.std.Core.Bool.not
function sys.std.Core.Bool.not (Bool <-- $topic : Bool)
This function results in the logical not of its argument. This function results in Bool:true
iff its argument is Bool:false
, and Bool:false
otherwise. Note that this operation is also known as negation or ¬
or !
.
There also exists conceptually the logical monadic operation called proposition which results simply in its argument; this is the complement operation of negation. Now in practice any value expression that is an invocation of proposition can simply be replaced with its argument, so there is no reason for proposition to exist as an actual function.
sys.std.Core.Bool.and
function sys.std.Core.Bool.and (Bool <-- $topic? : set_of.Bool)
This function is a reduction operator that recursively takes each pair of its N input element values and does a logical and (which is commutative, associative, and idempotent) on them until just one is left, which is the function's result. For each pair of input values, the and of that pair is Bool:true
iff both input values are Bool:true
, and Bool:false
otherwise. If topic
has zero values, then and
results in Bool:true
, which is the identity value for logical and. Note that this operation is also known as all or every or conjunction or ∧
.
sys.std.Core.Bool.all
function sys.std.Core.Bool.all (Bool <-- $topic? : set_of.Bool)
This function is an alias for sys.std.Core.Bool.and
. This function results in Bool:true
iff all of its input element values are Bool:true
(or it has no input values), and Bool:false
otherwise (when it has at least one input value that is Bool:false
).
sys.std.Core.Bool.nand
function sys.std.Core.Bool.nand (Bool <-- $topic : Bool, $other : Bool)
This symmetric function results in Bool:false
iff its 2 arguments are both Bool:true
, and Bool:true
otherwise. Note that this operation is also known as not and or not both or alternative denial or ⊼
or ↑
.
sys.std.Core.Bool.or
function sys.std.Core.Bool.or (Bool <-- $topic? : set_of.Bool)
This function is a reduction operator that recursively takes each pair of its N input element values and does a logical inclusive-or (which is commutative, associative, and idempotent) on them until just one is left, which is the function's result. For each pair of input values, the or of that pair is Bool:false
iff both input values are Bool:false
, and Bool:true
otherwise. If topic
has zero values, then or
results in Bool:false
, which is the identity value for logical inclusive-or. Note that this operation is also known as any or some or disjunction or ∨
.
sys.std.Core.Bool.any
function sys.std.Core.Bool.any (Bool <-- $topic? : set_of.Bool)
This function is an alias for sys.std.Core.Bool.or
. This function results in Bool:true
iff any of its input element values are Bool:true
, and Bool:false
otherwise (when all of its input values are Bool:false
or if it has no input values).
sys.std.Core.Bool.nor
function sys.std.Core.Bool.nor (Bool <-- $topic : Bool, $other : Bool)
This symmetric function results in Bool:true
iff its 2 arguments are both Bool:false
, and Bool:false
otherwise. Note that this operation is also known as not or or neither ... nor or joint denial or ⊽
or ↓
.
sys.std.Core.Bool.xnor
function sys.std.Core.Bool.xnor (Bool <-- $topic? : bag_of.Bool)
This function is a reduction operator that recursively takes each pair of its N input element values and does a logical xnor (which is both commutative and associative) on them until just one is left, which is the function's result. For each pair of input values, the xnor of that pair is Bool:true
iff both input values are exactly the same value, and Bool:false
otherwise. If topic
has zero values, then xnor
results in Bool:true
, which is the identity value for logical xnor. Note that this operation is also known as not xor or iff (if and only if) or material equivalence or biconditional or equivalent (dyadic usage) or even parity or ↔
. Note that a dyadic (2 input value) invocation of xnor
is exactly the same operation as a sys.std.Core.Universal.is_identical
invocation whose arguments are both Bool
-typed.
sys.std.Core.Bool.iff
function sys.std.Core.Bool.iff (Bool <-- $topic? : bag_of.Bool)
This function is an alias for sys.std.Core.Bool.xnor
.
sys.std.Core.Bool.xor
function sys.std.Core.Bool.xor (Bool <-- $topic? : bag_of.Bool)
This function is a reduction operator that recursively takes each pair of its N input element values and does a logical exclusive-or (which is both commutative and associative) on them until just one is left, which is the function's result. For each pair of input values, the xor of that pair is Bool:false
iff both input values are exactly the same value, and Bool:true
otherwise. If topic
has zero values, then xor
results in Bool:false
, which is the identity value for logical exclusive-or. Note that this operation is also known as exclusive disjunction or not equivalent (dyadic usage) or odd parity or ⊻
or ↮
. Note that a dyadic (2 input value) invocation of xor
is exactly the same operation as a sys.std.Core.Universal.is_not_identical
invocation whose arguments are both Bool
-typed.
sys.std.Core.Bool.imp
function sys.std.Core.Bool.imp (Bool <-- $topic : Bool, $other : Bool)
This function results in Bool:false
iff its topic
argument is Bool:true
and its other
argument is Bool:false
, and Bool:true
otherwise. Note that this operation is also known as implies or material implication or →
.
sys.std.Core.Bool.implies
function sys.std.Core.Bool.implies (Bool <-- $topic : Bool, $other : Bool)
This function is an alias for sys.std.Core.Bool.imp
.
sys.std.Core.Bool.nimp
function sys.std.Core.Bool.nimp (Bool <-- $topic : Bool, $other : Bool)
This function is exactly the same as sys.std.Core.Bool.imp
except that it results in the opposite boolean value when given the same arguments. Note that this operation is also known as not implies or material nonimplication or ↛
.
sys.std.Core.Bool.if
function sys.std.Core.Bool.if (Bool <-- $topic : Bool, $other : Bool)
This function is an alias for sys.std.Core.Bool.imp
except that it transposes the topic
and other
arguments. This function results in Bool:false
iff its topic
argument is Bool:false
and its other
argument is Bool:true
, and Bool:true
otherwise. Note that this operation is also known as converse implication or reverse material implication or ←
.
sys.std.Core.Bool.nif
function sys.std.Core.Bool.nif (Bool <-- $topic : Bool, $other : Bool)
This function is exactly the same as sys.std.Core.Bool.if
except that it results in the opposite boolean value when given the same arguments. Note that this operation is also known as not if or converse nonimplication or ↚
.
sys.std.Core.Bool.not_all
function sys.std.Core.Bool.not_all (Bool <-- $topic? : set_of.Bool)
This function is exactly the same as sys.std.Core.Bool.all
except that it results in the opposite boolean value when given the same argument. This function results in Bool:true
iff not all of its input element values are Bool:true
, and Bool:false
otherwise (when all of its input values are Bool:true
or if it has no input values).
sys.std.Core.Bool.none
function sys.std.Core.Bool.none (Bool <-- $topic? : set_of.Bool)
This function is exactly the same as sys.std.Core.Bool.any
except that it results in the opposite boolean value when given the same argument. This function results in Bool:true
iff none of its input element values are Bool:true
(or it has no input values), and Bool:false
otherwise (when it has at least one input value that is Bool:true
). Note that this operation is also known as not any.
sys.std.Core.Bool.not_any
function sys.std.Core.Bool.not_any (Bool <-- $topic? : set_of.Bool)
This function is an alias for sys.std.Core.Bool.none
.
sys.std.Core.Bool.one
function sys.std.Core.Bool.one (Bool <-- $topic? : bag_of.Bool)
This function results in Bool:true
iff exactly one of its input element values is Bool:true
, and Bool:false
otherwise. Note that in some contexts, this operation would alternately be known as xor, but in Muldis D it is not.
sys.std.Core.Bool.not_one
function sys.std.Core.Bool.not_one (Bool <-- $topic? : bag_of.Bool)
This function is exactly the same as sys.std.Core.Bool.one
except that it results in the opposite boolean value when given the same argument.
sys.std.Core.Bool.exactly
function sys.std.Core.Bool.exactly (Bool <-- $topic? : bag_of.Bool, $count : NNInt)
This function results in Bool:true
iff the count of its input element values that are Bool:true
matches the count
argument, and Bool:false
otherwise.
sys.std.Core.Bool.not_exactly
function sys.std.Core.Bool.not_exactly (Bool <-- $topic? : bag_of.Bool, $count : NNInt)
This function is exactly the same as sys.std.Core.Bool.exactly
except that it results in the opposite boolean value when given the same argument.
sys.std.Core.Bool.true
function sys.std.Core.Bool.true (NNInt <-- $topic? : bag_of.Bool)
This function results in the count of its input element values that are Bool:true
.
sys.std.Core.Bool.false
function sys.std.Core.Bool.false (NNInt <-- $topic? : bag_of.Bool)
This function results in the count of its input element values that are Bool:false
.
SEE ALSO
Go to Muldis::D for the majority of distribution-internal references, and Muldis::D::SeeAlso for the majority of distribution-external references.
AUTHOR
Darren Duncan (darren@DarrenDuncan.net
)
LICENSE AND COPYRIGHT
This file is part of the formal specification of the Muldis D language.
Muldis D is Copyright © 2002-2009, Muldis Data Systems, Inc.
See the LICENSE AND COPYRIGHT of Muldis::D for details.
TRADEMARK POLICY
The TRADEMARK POLICY in Muldis::D applies to this file too.
ACKNOWLEDGEMENTS
The ACKNOWLEDGEMENTS in Muldis::D apply to this file too.