DS - 1

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 16

Logic

(continuation)
Boolean
Logic and Bit Operations
Boolean Searches
 Logical Connectives are used extensively in searches
of large collections of information, such as indexes of
Web pages.
 Because these searches employ techniques from
propositional logic, they are called Boolean searches.
LOGICAL AND BIT OPERATIONS
 Computers represent information using bits.
 A bit has two possible values, namely 0(zero) and
1(one).
 The word bit comes from binary digit, since zeros and
ones are digits used in binary representations of numbers.
 1 bit represent true and 0 bit represent false.
 A variable is called a boolean variable if its value is
either true or false.
 Consequently, a boolean variable can be represented
using a bit.
LOGICAL AND BIT OPERATIONS
 Computer bit operations Table for the Bit Operators OR,
correspond to the logical AND, and XOR
connectives.
 Use the notation OR, AND, XOR x y xy xy xy
for the operators , , and  as is
done in various programming 0 0 0 0 0
languages.
 Information is often represented 0 1 1 0 1
using bit strings, which are
sequences of zeros and ones. When 1 0 1 0 1
it is done, operations on the bit
strings can be used to manipulate 1 1 1 1 0
this information.
Bit String, Length of Bit String
 A bit string is a sequence of zero or  Find the bitwise of the bit
more bits. The length of this string
strings of 0110110110 and
is the number of bits in the string.

1100011101. split bit strings
101010011 is a bit string of length
nine. into blocks of four bits to
 Extending bit operations to bit make them easier to read.
strings.
 Define bitwise OR, bitwise AND,
01 1011 0110
and bitwise XOR of two strings of
the same length to be the strings 11 0001 1101
that have their bits the OR, AND, 11 1011 1111 bitwise OR
and XOR of the corresponding bits
in the two strings, respectively. 01 0001 0100 bitwise AND
10 1010 1011 bitwise XOR
Practice Activity
 Find the bitwise OR, bitwise AND, bitwise XOR
of each of the following pairs of bit strings.
a) 1011110, 0100001
b) 11110000, 10101010
c) 0001110001, 1001001000
d) 1111111111,0000000000
Conjunction
Disjunction
Implication
Double Implication
Negation
Class Activity
i):
Construct the truth table of the compound proposition
(p ∨ ¬q) → (p ∧ q)

ii)
Class Activity
Implication and Exclusive OR are
reverse of each other

You might also like