- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

#### Presentation Transcript

**1. **Lecture 4 Truth Tables of compound propositions

**2. **Lecture 3 : truth tables of Compound propositions. Objectives
Understand the logic behind the definition of the compound statements .
Construct truth tables for compound statements.
Determine the true value of a compound statement for a specific case.

**3. **OVERVIEW
By using logical connectives we can build up complicated compound proposition , and use the truth tables to determine the truth values of these compound proposition .

**4. **Example 1: Construct the truth table of the compound proposition
(p V ¬q) ? (p ^ q)

**5. **Examples 2:
For the below truth table we can observe that
p ? q is a short form for (p? q) ? (q ? p)

**6. **Precedence of logical operators The table below represent the precedence Rule of logical operators
i.e : p^q V r means (p^q)Vr
pV q r means (pV q ) r

**7. **Translating English Sentences English sentences can be translated into into expression with propositional variables and logical connectives to :-
Remove sentences ambiguity.
Determine sentences truth values by analyze it’s logical expressions
Use the rules of inference to reasoning these sentences .

**8. **Example 1 Let p and q ,be the propositions
p = “It is below freezing”
q = “It is snowing “
Write these propositions using p and q and logical connectives .
1- It is below freezing and it is snowing (p ^ q)
2-It is below freezing but not snowing (p V¬q)
3- It is not below freezing and it is not snowing (¬ p^¬q )
4-It is either snowing or below freezing (or both) (p V q )
5-If it is below freezing, it is also snowing (p q)
6- It is either below freezing or it is snowing,
but it is not snowing if it is below freezing ((p Vq) ^ (p^¬q))
7- That it is below freezing is necessary and sufficient for it to be snowing or (i.e it snowing iff it is below freezing) q p

**9. **Example 2 You can access the Internet from campus only if you are a computer science major or you are not a freshman.
write with proposition a,c and f and logical connective:
Let a : access the internet
c: computer science student
f: not a fresh man
a (c V ¬ f)
You cannot ride the roller coaster if you are under 4 feet tall unless you are older than 16 years old.
p: you can ride the roller coaster
q: you are under 4 feet tall
s: you are older that 16 years old
( q ^ ¬s) ¬p

**10. **Logical and bit operations A bit is a symbol with two only two values 0 and 1 referred to as binary digit .
A bit can used to represent a truth values :1 bit to true , 0 bit to false .
A Boolean variables can be represented using a bits as it takes only either true or false .

**11. **Bit operations Bit operations are correspond to logical connectives by using 1 for T , 0 for F in truth tables .
OR,AND,XOR are used instead of ^,V,
Respectively.
Information represented using bit string which is a sequence of zeros and ones , length of this string is the number of bits in the string .

**12. **Bit operators OR,AND,XOR

**13. **Bitwise OR,AND and XOR
To find the bitwise OR ,AND and XOR of strings, we apply the truth values for each bit with it’s corresponding bit in other bit string .
Ex: find the bitwise and for strings :11101010 and 11001101
Solution:-
Arrange element as blocks of size 4 bit (right to left)
1 1 1 0 1 0 1 0
1 1 0 0 1 1 0 1
1 1 1 0 1 1 1 1 bitwise OR
1 1 0 0 1 0 0 0 bitwise AND
0 0 1 0 0 1 1 1 bitwise XOR

**14. **More Examples find the bitwise OR ,AND and XOR of string of
a ) 1011110 and 0100001
1 0 1 1 1 1 0
0 1 0 0 0 0 1
1 1 1 1 1 1 1 Bitwise Or
0 0 0 0 0 0 0 Bitwise And
1 1 1 1 1 1 1 Bitwise XOR

**15. **More Examples b) b) 0 1 0 1 0 1 1 0 and 0 0 1 1 0 0 1 0
0 1 0 1 0 1 1 0
0 0 1 1 0 0 1 0
0 0 0 1 0 0 1 0 Bitwise AND
0 1 1 1 0 1 1 0 Bitwise OR
0 1 1 0 0 1 0 0 Bitwise XOR