CITS2211 Discrete Structures. Propositional Logic

Similar documents
CSC Discrete Math I, Spring Propositional Logic

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

EECS 1028 M: Discrete Mathematics for Engineers

Introduction to Sets and Logic (MATH 1190)

Propositional Logic. Yimei Xiang 11 February format strictly follow the laws and never skip any step.

THE LOGIC OF COMPOUND STATEMENTS

Compound Propositions

LING 106. Knowledge of Meaning Lecture 3-1 Yimei Xiang Feb 6, Propositional logic

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

UNIT-I: Propositional Logic

Propositional logic ( ): Review from Mat 1348

Learning Goals of CS245 Logic and Computation

Today. Proof using contrapositive. Compound Propositions. Manipulating Propositions. Tautology

Propositional logic (revision) & semantic entailment. p. 1/34

Truth-Functional Logic

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

Tools for reasoning: Logic. Ch. 1: Introduction to Propositional Logic Truth values, truth tables Boolean logic: Implications:

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

Logic Propositional logic; First order/predicate logic

Logical Operators. Conjunction Disjunction Negation Exclusive Or Implication Biconditional

Discrete Mathematical Structures. Chapter 1 The Foundation: Logic

Logical Structures in Natural Language: Propositional Logic II (Truth Tables and Reasoning

CSCE 222 Discrete Structures for Computing. Propositional Logic. Dr. Hyunyoung Lee. !!!!!! Based on slides by Andreas Klappenecker

CSE 20: Discrete Mathematics

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

CS 173 Lecture 2: Propositional Logic

1.3 Propositional Equivalences

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

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

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

Section 1.1: Logical Form and Logical Equivalence

1.1 Language and Logic

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

Chapter 1, Section 1.1 Propositional Logic

Logic: Propositional Logic (Part I)

Lecture 7. Logic. Section1: Statement Logic.

Propositional Logic. Spring Propositional Logic Spring / 32

Propositional Logic. Jason Filippou UMCP. ason Filippou UMCP) Propositional Logic / 38

Math.3336: Discrete Mathematics. Propositional Equivalences

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

cis32-ai lecture # 18 mon-3-apr-2006

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

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

Knowledge representation DATA INFORMATION KNOWLEDGE WISDOM. Figure Relation ship between data, information knowledge and wisdom.

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

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

1.1 Language and Logic

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

A. Propositional Logic

Description Logics. Foundations of Propositional Logic. franconi. Enrico Franconi

15414/614 Optional Lecture 1: Propositional Logic

- 1.2 Implication P. Danziger. Implication

The statement calculus and logic

Packet #1: Logic & Proofs. Applied Discrete Mathematics

Language of Propositional Logic

Review. Propositional Logic. Propositions atomic and compound. Operators: negation, and, or, xor, implies, biconditional.

First Order Logic (1A) Young W. Lim 11/18/13

Chapter 1: Formal Logic

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

Computation and Logic Definitions

Part I: Propositional Calculus

CSE 311: Foundations of Computing. Lecture 2: More Logic, Equivalence & Digital Circuits

Logic. Propositional Logic: Syntax. Wffs

CHAPTER 10. Gentzen Style Proof Systems for Classical Logic

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

PROPOSITIONAL CALCULUS

The Logic of Compound Statements cont.

CSE 20. Final Review. CSE 20: Final Review

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

10 Propositional logic

1.1 Statements and Compound Statements

Propositional Logic George Belic

DISCRETE STRUCTURES WEEK5 LECTURE1

Propositional Logic Not Enough

Logic. Propositional Logic: Syntax

Propositional Logic Logical Implication (4A) Young W. Lim 4/21/17

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

Propositional Equivalence

Logic and Proofs. (A brief summary)

2.2: Logical Equivalence: The Laws of Logic

CHAPTER 2 INTRODUCTION TO CLASSICAL PROPOSITIONAL LOGIC

Inference in Propositional Logic

Propositional natural deduction

THE LOGIC OF COMPOUND STATEMENTS

We last time we began introducing equivalency laws.

n Empty Set:, or { }, subset of all sets n Cardinality: V = {a, e, i, o, u}, so V = 5 n Subset: A B, all elements in A are in B

Knowledge Representation. Propositional logic

Propositional Logic Language

Topic 1: Propositional logic

2/18/14. What is logic? Proposi0onal Logic. Logic? Propositional Logic, Truth Tables, and Predicate Logic (Rosen, Sections 1.1, 1.2, 1.

Propositional Logic and Semantics

Tecniche di Verifica. Introduction to Propositional Logic

CS 2740 Knowledge Representation. Lecture 4. Propositional logic. CS 2740 Knowledge Representation. Administration

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

CS1021. Why logic? Logic about inference or argument. Start from assumptions or axioms. Make deductions according to rules of reasoning.

Department of Computer Science & Software Engineering Comp232 Mathematics for Computer Science

MATHS 315 Mathematical Logic

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

Knowledge Representation. Propositional logic.

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

Transcription:

CITS2211 Discrete Structures Propositional Logic Unit coordinator: Rachel Cardell-Oliver July 31, 2017

Highlights This lecture will address the following questions: 1 What is a proposition? 2 How are propositions combined? 3 How are propositions related to natural language and things in the real world such as computer programs? 4 How is the truth or falsity of a proposition decided?

Reading Mathematics for Computer Science Introduction Chapter 1, Section 1.1 Chapter 3, Section 3.1 Chapter 3, Section 3.2

Why study propositional logic English language has many ambiguities. This is tolerable in normal conversation but not if we wish to formulate precise ideas. Propositions and logical connectives arise all the time in computer programs. For example, in conditional statements or loops. Computer programs themselves can be reasoned about using logic. It is possible (although difficult) to prove a program is correct. Leading CPU chip manufacturers now routinely prove chip correctness to avoid mistakes like the notorious Intel division bug in the 1990s.

The first topic in cits2211 is logic. Definition (from www.oxforddictionaries.com/definition/english/logic): Reasoning conducted or assessed according to strict principles of validity.

Example: Warm up: You have 4 cards. Each card has a number on one side and a letter on the other. If the cards are dealt so that you can see K 5 2 J Which cards would you have to turn over, to test the rule that if there s a J on one side then there s a 5 on the other side? Give reasons for your answer.

Definition: A proposition is a statement that is either true or false. Example: All men are mortal Example: The earth is flat Example: 1+1 = 2 Example: The evergreen forests of Canada comprise spruce, pine and fir trees.

In English, we combine simple propositions into more complex ones using connectives. Example: The earth is not flat (not F) Example: The earth is flat or I am mad (F or M) Example: The earth is flat unless I am mad (F or M) Example: Your money or your life (M or L, but be aware this really means M xor L) Example: If all men are mortal and all Greeks are men then all Greeks are mortal (if MX and GM then GX) Example: All babies are illogical (B implies not L)

Example: It is raining today and today is winter. (R and W) Example: It is raining despite the season being winter. (R and W) Example: If I can afford it then I will buy it (A implies B) Example: I will buy it if I can afford it (A implies B) Example: I will buy it when I can afford it (A implies B) Example: I can afford it only if I buy it (A implies B)

The logic operators are: not and or implies (if-then) iff (if and only if) The meaning of these operators can be defined using a truth table.

P P T F F T P Q P Q T T T F F T F F P Q P Q T T T F F T F F

P P T F F T P Q P Q T T T T F F F T F F F F P Q P Q T T T T F T F T T F F F

P Q P Q T T T F F T F F P Q P Q T T T F F T F F

P Q P Q T T T T F F F T T F F T P Q P Q T T T T F F F T F F F T

Implication is important, remember an implication is true exactly when the if-part is false or the then-part is true. False implies anything, True can not imply false. Example: True: If pigs can oink then the sky is blue Example: False: If the sky is blue then the sky is red Example: True: If pigs can fly then the sky is red Example: True: If pigs can fly then the sky is blue

Propositional logic is a formal language A formal language consists of 1 A set of permitted symbols; its alphabet 2 Rules defining the correct order of symbol in sentences; its syntax 3 Assignment of meaning to correctly written sentences; its semantics

Here is the formal language of propositional logic: 1 The alphabet of propositional logic consists of symbols for denoting propositions called identifiers. For example, P, Q and R, punctuation symbols, that is brackets ( ), and propositional connectives,,,,. 2 The syntax of propositional logic is defined by the following rules for construction of well formed formulae (wff), which represent propositions: An identifier is a proposition. If P and Q are propositions then so are P, P Q, P Q, P Q and P Q. Note that arbitrarily complex propositions can be built recursively using these rules. 3 The semantics of a proposition (its truth value) is derived from the possible truth values of its sub-parts and the truth tables for connectives.

Which of the following are wff of propositional logic? Why? P Q Q P Q R (S P) P P P Q

Brackets can be used to resolve ambiguity. But over-using brackets can be irritating. Definition: Precedence of Symbols: B rackets N egation C onjunction D isjunction I mplication E quivalence Example: Add (redundant!) brackets to the following formula to show how it is interpreted under the operator precedence rules. P Q S T V W

Today s lecture will address the following questions: 1 How to use truth tables to evaluate compound propositions 2 Introduce some common rules of propositional logic 3 How to identify tautologies and equivalences

Definition: Two propositions are equivalent if they have the same truth value for all possible values of their identifiers. Here are some commonly used propositional equivalences. Each can be derived from a truth table (exercise). Expression Equivalent To Name of Rule P Q Q P Commutativity P Q Q P (P Q) R P (Q R) Associativity (P Q) R P (Q R) (P Q) P Q De Morgan s laws (P Q) P Q P Q P Q Implication P Q Q P Contrapositive P ( P) Double negation

Example: Derive De Morgan s law (P Q) equivalent to P Q using a truth table. LHS RHS P Q P Q (P Q) P Q P Q LHS RHS T T T F F T F F

Example: Derive the contrapositive law using a truth table. LHS RHS P Q P Q Q P Q P LHS RHS T T T F F T F F

Propositional Logic in Programs Propositional logic is used in computer programs. If ( x > 0 ( x <= 0 && y > 100 ) ) return true; else return false; Example: Use propositional logic to simplify this statement.

Definition: A tautology is a compound proposition which is true under all possible assignments of truth values to its prime propositions. Example: Show that P P is a tautology. Definition: A contradiction is a compound proposition which is false under all possible assignments of truth values to its prime propositions. Example: Show that P P is a contradiction.

Definition: An contingent proposition is one which is neither a tautology nor a contradiction. Example: Show that P P is a contingent proposition. Definition: Two propositions are logically equivalent if and only if their equivalence is a tautology. Example: Show that P Q is logically equivalent to P Q

Axioms of Propositional Logic (1) Expression Equivalent To Name of Rule P Q Q P Commutativity P Q Q P (P Q) R P (Q R) Associativity (P Q) R P (Q R) P (Q R) (P Q) (P R) Distributivity P (Q R) (P Q) (P R) (P Q) P Q De Morgan (P Q) P Q P P Double Negation P P T Excluded Middle P P F Contradiction

Axioms of Propositional Logic (2) Expression Equivalent To Name of Rule P Q P Q Implication P Q (P Q) (Q P) Equivalence P (P Q) P Or Absorption P P P P T T P F P P (P Q) P And Absorption P P P P T P P F F P P Identity

Axioms of Propositional Logic (3) The table of rules on the previous two pages (axioms) can be used to derive all tautologies. An even more elegant axiomatisation was discovered by Edward Vermilye Huntington in 1933. Expression Equivalent To Name of Rule P Q Q P Commutativity (P Q) R P (Q R) Associativity ( P Q) ( P Q) P Huntington axiom But note that these axioms are not very convenient for writing proofs. So you are recommended to use a wider range of laws.