# CT 100 Lecture 6 - Department of Computer Science

### Logic Continued

• • • • • • Quiz 4 Vocabulary Quiz 4 Problems Implication Translation of English Statements to Symbolic Logic Well-formed Boolean Expressions Digital Logic

### Quiz 4 Vocabulary

• • • • • • • Equivalence Contradiction Conclusion Law of excluded middle Law of non-contradiction Boolean Logic Premise • • • • • • Proposition Syllogism Symbolic logic Tautology Truth table Definitions for the new terms are at the end of chapter 3

### Quiz 4 Quiz Problems

• • • • • • • • Convert binary to base 10 Convert base 10 to binary Convert a sequence of characters to a sequence ASCII codes (numbers) Convert a sequence of numbers representing characters in ASCII to a sequence of characters Create a truth table for a Boolean expression Show that 2 Boolean expressions are equivalent Translate an English language statement into symbolic logic Determine if a expression is a well formed Boolean expression

### IMPLIES Truth Table

A

True True False False

B

True False True False

A IMPLIES B

True False True True

### Implication

• • • Conditionals If P Then Q – P is the antecedent – Q is the consequence Stoics – Philo of Megara • A conditional is false when and only when the antecedent is true and the consequence is false

### Implication

• • • Truth-functionality – The truth value of a compound statement is a (total) function based only on the truth values of its parts (which must be propositions) Frege Russell and Whitehead – P IMPLIES Q is equivalent to (NOT P) OR Q

### Implication

– http://plato.stanford.edu/entries/conditionals/ – http://plato.stanford.edu/entries/dialectical school/

### English to Symbolic Logic Translation

• • • • Let A represent the simple statement “Alex is a computer science major” Let B represent the simple statement “Alex takes CS 120” Let C represent the simple statement “Alex is a Biology major” Let D represent the simple statement “Alex takes BIO 105”

• • • • • • Translate the Following Statements into Symbolic Logic Expressions and Build the Truth Tables for the Expressions Alex is a computer science major and Alex is a biology major Alex is a computer science major or Alex is a biology major Alex is not a computer science major Alex does not take BIO 105 If Alex is a computer science major then Alex takes cs 120 If Alex takes BIO 105 then Alex is a biology major

• • • Translate the Following Statements into Symbolic Logic Expressions and Build the Truth Tables for the Expressions If Alex takes CS 120 then Alex is a computer science major If Alex is a computer science major or Alex is a biology major then Alex takes BIO 105 If Alex does not take BIO 105 then Alex is not a biology major

### Well-formed Expressions

• • Syntactically correct boolean expressions Rule 1 – Each single letter is a well-formed expression – True is a well-formed expression – False is a well-formed expression

### Well-formed Expressions

• • • Assume P and Q are well-formed expressions Rule 2 – P and Q is a well-formed expression – P or Q is a well-formed expression – P IMPLIES Q is a well-formed expression – P ≡ Q is a well-formed expression – NOT P is a well-formed expression Rule 3 – ( P ) is a well-formed expression

### Well-formed Expressions

• Are the following expressions well-formed expressions?

– P and (NOT Q) – (A OR B) AND (C OR D) – (R AND S) (NOT W) – (NOT (A AND B)) IMPLIES (B OR C) – (NOT P) IMPLIES (NOT Q) – NOT IMPLIES B OR C

### Digital Logic

• • • • Building Blocks Digital Computer Hardware Logic Gates – And gate – Or gate – Not gate Must be implemented with physical devices – For example transitors The are a low level abstraction

### Not Gate

0 0 0 0 0 1 0 1 1 0 1 0 1 1 1 1 +0 +1 +0 +1 +0 +1 +0 +1 00 01 01 10 01 10 10 11

1 1 1 0 1 0 0

C in

0

### Truth Table for One Bit Adder 0 means False and 1 means True

a

0 1 0 0 1 0 1 1 1 0 1 0

b

0 1 0 1 1 1 1 1 0 0 0

c out

0

s

0 0 1 1 1 0 0 1