An Introduction to Logic 1.1 ~ 1.4 6/21/04 ~ 6/23/04

Similar documents
Chapter Summary. Propositional Logic. Predicate Logic. Proofs. The Language of Propositions (1.1) Applications (1.2) Logical Equivalences (1.

1 The Foundations. 1.1 Logic. A proposition is a declarative sentence that is either true or false, but not both.

Chapter 1, Part I: Propositional Logic. With Question/Answer Animations

Propositional logic ( ): Review from Mat 1348

CHAPTER 1 - LOGIC OF COMPOUND STATEMENTS

Discrete Mathematical Structures. Chapter 1 The Foundation: Logic

2/2/2018. CS 103 Discrete Structures. Chapter 1. Propositional Logic. Chapter 1.1. Propositional Logic

Introduction Propositional Logic. Discrete Mathematics Andrei Bulatov

Math.3336: Discrete Mathematics. Applications of Propositional Logic

What is Logic? Introduction to Logic. Simple Statements. Which one is statement?

Chapter 1, Section 1.1 Propositional Logic

Chapter 1: The Logic of Compound Statements. January 7, 2008

HW1 graded review form? HW2 released CSE 20 DISCRETE MATH. Fall

DISCRETE MATHEMATICS BA202

Compound Propositions

Lecture 2. Logic Compound Statements Conditional Statements Valid & Invalid Arguments Digital Logic Circuits. Reading (Epp s textbook)

Chapter 1, Part I: Propositional Logic. With Question/Answer Animations

Propositional Logic. Propositional Equivalences. Agenda. Yutaka HATA, IEEE Fellow. Ch1.1 Propositional Logic. Ch1.2 Propositional Equivalences

Propositional Logic 1

Logic and Proofs. Jan COT3100: Applications of Discrete Structures Jan 2007

CS 220: Discrete Structures and their Applications. Propositional Logic Sections in zybooks

Definition 2. Conjunction of p and q

CS100: DISCRETE STRUCTURES. Lecture 5: Logic (Ch1)

Note: The area of logic that deals with propositions is called the propositional calculus or propositional logic.

Discrete Structures for Computer Science

Today s Topic: Propositional Logic

Announcements. CS311H: Discrete Mathematics. Propositional Logic II. Inverse of an Implication. Converse of a Implication

AMTH140 Lecture 8. Symbolic Logic

Overview. 1. Introduction to Propositional Logic. 2. Operations on Propositions. 3. Truth Tables. 4. Translating Sentences into Logical Expressions

DISCRETE STRUCTURES WEEK5 LECTURE1

Discrete Mathematics and Its Applications

Logic. Def. A Proposition is a statement that is either true or false.

Discrete Structures of Computer Science Propositional Logic I

Discrete Mathematics

CSC Discrete Math I, Spring Propositional Logic

Sec$on Summary. Propositions Connectives. Truth Tables. Negation Conjunction Disjunction Implication; contrapositive, inverse, converse Biconditional

Discrete Mathematics and Applications COT3100

A statement is a sentence that is definitely either true or false but not both.

Announcements. CS243: Discrete Structures. Propositional Logic II. Review. Operator Precedence. Operator Precedence, cont. Operator Precedence Example

The Foundations: Logic and Proofs. Part I

Why Learning Logic? Logic. Propositional Logic. Compound Propositions

ICS141: Discrete Mathematics for Computer Science I

EECS 1028 M: Discrete Mathematics for Engineers

THE LOGIC OF COMPOUND STATEMENTS

CSE 240 Logic and Discrete Mathematics

2/13/2012. Logic: Truth Tables. CS160 Rosen Chapter 1. Logic?

software design & management Gachon University Chulyun Kim

LOGIC CONNECTIVES. Students who have an ACT score of at least 30 OR a GPA of at least 3.5 can receive a college scholarship.

TRUTH TABLES LOGIC (CONTINUED) Philosophical Methods

Announcements CompSci 102 Discrete Math for Computer Science

Propositional Languages

PROPOSITIONAL CALCULUS

Truth-Functional Logic

3/29/2017. Logic. Propositions and logical operations. Main concepts: propositions truth values propositional variables logical operations

The Logic of Compound Statements cont.

Example. Logic. Logical Statements. Outline of logic topics. Logical Connectives. Logical Connectives

AI Principles, Semester 2, Week 2, Lecture 5 Propositional Logic and Predicate Logic

Mathematical Logic Part One

Propositional Logic Basics Propositional Equivalences Normal forms Boolean functions and digital circuits. Propositional Logic.

Mathematical Logic Part One

Section 1.1: Logical Form and Logical Equivalence

10/5/2012. Logic? What is logic? Propositional Logic. Propositional Logic (Rosen, Chapter ) Logic is a truth-preserving system of inference

LOGIC & PROPOSITIONAL EQUIVALENCE

Discrete Structures & Algorithms. Propositional Logic EECE 320 // UBC

CSE 20 DISCRETE MATH. Fall

Discrete Mathematics and Its Applications

ECOM Discrete Mathematics

Section 3.1 Statements, Negations, and Quantified Statements

Chapter 2: The Logic of Compound Statements

Unit 1. Propositional Logic Reading do all quick-checks Propositional Logic: Ch. 2.intro, 2.2, 2.3, 2.4. Review 2.9

Logical Operators. Conjunction Disjunction Negation Exclusive Or Implication Biconditional

Mathematical Logic Part One

Propositional Logic. Fall () Propositional Logic Fall / 30

Lecture 02: Propositional Logic

Logical Agents. Knowledge based agents. Knowledge based agents. Knowledge based agents. The Wumpus World. Knowledge Bases 10/20/14

The statement calculus and logic

Introduction to Sets and Logic (MATH 1190)

Chapter 3: Logic. Diana Pell. A statement is a declarative sentence that is either true or false, but not both.

MACM 101 Discrete Mathematics I. Exercises on Propositional Logic. Due: Tuesday, September 29th (at the beginning of the class)

15414/614 Optional Lecture 1: Propositional Logic

CSE 20: Discrete Mathematics

Propositional Logic. Spring Propositional Logic Spring / 32

Introduction. Applications of discrete mathematics:

Propositions. Frequently, we will use the word statement instead of proposition.

CSE 311: Foundations of Computing I. Spring 2015 Lecture 1: Propositional Logic

2. The Logic of Compound Statements Summary. Aaron Tan August 2017

Boolean Logic. CS 231 Dianna Xu

Proofs. Joe Patten August 10, 2018

Introduction Logic Inference. Discrete Mathematics Andrei Bulatov

Chapter 1: Formal Logic

Proposition/Statement. Boolean Logic. Boolean variables. Logical operators: And. Logical operators: Not 9/3/13. Introduction to Logical Operators

UNIT-I: Propositional Logic

MAT2345 Discrete Math

Section 1.1 Propositional Logic. proposition : true = T (or 1) or false = F (or 0) (binary logic) the moon is made of green cheese

Propositional Logic and Semantics

Course Staff. Textbook

A Little Deductive Logic

n logical not (negation) n logical or (disjunction) n logical and (conjunction) n logical exclusive or n logical implication (conditional)

Chapter 5: Section 5-1 Mathematical Logic

Logic and Proofs. (A brief summary)

Transcription:

An Introduction to Logic 1.1 ~ 1.4 6/21/04 ~ 6/23/04 1

A Taste of Logic Logic puzzles (1) Knights and Knaves Knights: always tell the truth Knaves: always lie You encounter two people A and B. A says: "B is a knight" B says: "The two of us are opposite types" Q: What are A and B? (2) Murder suspects 3 suspects for murdering Cooper: Smith, Jones, Williams Smith: "Cooper is a friend of Jones, and Williams dislikes him" Jones: "I don't know Cooper and I am out of town that day" Williams:"I saw both Smith and Jones with Cooper that day, and either Smith or Jones must have killed him" Q: Who is the murder? 2

What is Logic? Mathematical Logic is a tool for providing precise meaning to mathematical statements. It includes: A formal language for expressing them. A concise notation for writing them. A methodology for objectively reasoning about their truth or falsity. Applications of Logic It is the foundation for expressing formal proofs in all branches of mathematics. In computer science Circuit design Program constructing Program verification 3

1.1 Logic DEF1: A proposition is a declarative sentence that is either true (T) or false (F), but not both. Ex1: propositions 1) Beijing is the capital of China 2) 2 + 3 = 5 3) 2 + 3 = 4 Ex2: not propositions 1) Is your major computer science? (question) 2) Finish the homework by yourself. (command) 3) What a smart student! (exclamation) 4) x + 1 = 3 (could be both T and F) Exercise1: proposition or not? 1) You are a student. 2) Lingli is a cute girl. 3) There is life on Mar. 4) x + 1 = 5 if x = 1 5) 2 + 3 4

Logical operators DEF2: A proposition variable is a variable such as p, q, r over the boolean domain {T,F} DEF3: A logical operator is a rule defined by a truth table Some popular logical operators Operator Negation Conjunction Disjunction Exclusive-OR Implication Biconditional Nickname NOT AND OR XOR IMPLIES IFF notation 5

The Negation Operator Expression: "It is not the case that p" "p is false" Notation: p Truth table: Ex3: p p T F F T p = "Today is Friday" p = "Today is not Friday", or "It is not the case that today is Friday 6

The Conjunction Operator Expression: "p and q" "Both p and q are true" Notation: p q Truth table: p q p q F F F F T F T F F T T T Ex4: p = "Today is Friday" q = "It is raining today" p q = "Today is Friday and it is raining today" 7

The Disjunction Operator Expression "p or q" "Either p or q, or possible both are true" Notation: p q Truth table: p q p q F F F F T T T F T T T T Ex5: p = "Today is Friday" q = "It is raining today" p q = "Today is Friday or it is raining today" Note: Disjunction is also called "inclusive or" 8

The Exclusive OR Operator Expression: "Either p or q is true, but not both are true" Notation: p q Truth table: Ex6 p = "I will marry Helen" p q p q F F F F T T T F T T T F q = "You will marry Helen" p q = "Either you or I will marry Helen" 9

English "or" is ambiguous Ex7: "Tomorrow will be sunny or partially cloudy" Inclusive? Exclusive? Ex8: "Joe's major is computer science or chemical engineering" Inclusive? Exclusive? Note: We can infer the meaning of English "or" based on context, but not always Logic is more precise than natural languages Convention: In this class, "or" in default is inclusive 10

The Implication operator Expression: "If p then q", "if p, q", "p implies q", "q if p", "q whenever p", "q follows from p" "q is necessary for p", "p is sufficient for q", p q p q F F T F T T T F F T T T "p only if q", Notation: p q Truth table: Note: p q is F only when p is true and q is false. q can be true even if p is false p q does not require that p or q is true 11

The Implication operator Ex9: p = "Today is Friday" q = "2 + 3 =6" p q = "If today is Friday, then 2+3=6", T or F? Ex10: "1=0" "pigs can fly", T or F? "1=1" "pigs can fly", T or F? Related implications of p q: Negation: (p q) Converse: q p Contrapositive: q p Inverse: p q Note: only the contrapositive of p q has the same truth value as p q 12

The Biconditional Operator Expression: "p if and only if q" "p is necessary and sufficient for q" Notation: p q Truth table: Note: Ex11 this truth table is exactly the opposite of 's p q (p q) p = "You can take the flight" p q p q F F T F T F T F F T T T q = "You buy a ticket" p q = "You can take a flight if and only of you buy a ticket 13

Precedence of Logical Operators Ex12: r s q ( (r s)) q? ( r) (s q)? (r (s q))? (( r) s) q? Precedence Order from high to low:,,,,, and are left associative: p q r (p q) r p q r (p q) r 14

Logical Operators Operator Nickname Notation Precedence Negation NOT p 1 Conjunction AND p q 2 Disjunction OR p q 3 Exclusive-OR XOR p q 4 Implication IMPLIES p q 5 Biconditional IFF p q 6 15

Compound Propositions DEF4: An atomic propositional form is either a boolean constant or a propositional variable. DEF5: An compound propositional form is constructed by combining atomic propositional forms using logical operators Ex13: Some compound propositional forms on two variables: p, p q, p q, p q, p q, p q, (p q) q, Ex14: How can this English sentence be translated into a logical expression? "You can access the Internet from campus only if you are a computer science major or you are not a freshman." 16

Analyze compound propositions Ex15: Q: Analyze "p (r q)" using truth table A: p q r q r q (r q) p (r q) F F F T T F F F F T T T F F F T F F T F F F T T F F T F T F F T T F F T F T T T F F T T F F T F F T T T F F T T 17

Logic and Bit Operations Bit: 0 or 1 Represent truth values using bit: 1--T, 0--F Bit operators correspond to the logical operators by replacing T by 1 and F by 0 Bit operations can be extended to operate on bit strings: (bit-wise) 01 1011 0110 11 0001 1101 11 11 1011 1111 Bit-wise OR 01 01 0001 0100 Bit-wise AND 10 10 1010 1011 Bit-wise XOR 18

Logical Puzzles Ex16: Knights and Knaves Knights: always tell the truth Knaves: always lie You encounter two people A and B. A says: "B is a knight" B says: "The two of us are opposite types" Q: What are A and B? 19

Logical Puzzles Exercise2: Murder suspects 3 suspects for murdering Mr. Cooper: Smith, Jones, Williams. All of them denied the murdering. Smith said: "Cooper is a friend of Jones, and Williams dislikes Cooper." Jones said: "I don't know Cooper and I am out of town that day." Williams said:"i saw both Smith and Jones with Cooper that day, and either Smith or Jones must have killed him" Q: Who is the murder? 20