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

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

Math.3336: Discrete Mathematics. Propositional Equivalences

CSC Discrete Math I, Spring Propositional Logic

Truth-Functional Logic

Course Staff. Textbook

Math.3336: Discrete Mathematics. Applications of Propositional Logic

Compound Propositions

2.2: Logical Equivalence: The Laws of Logic

Propositional Logic and Semantics

Logic: Propositional Logic (Part I)

UNIT-I: Propositional Logic

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

Propositional logic ( ): Review from Mat 1348

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

Overview, cont. Overview, cont. Logistics. Optional Reference #1. Optional Reference #2. Workload and Grading

The Logic of Compound Statements cont.

Propositional Logic. Spring Propositional Logic Spring / 32

Announcements. CS311H: Discrete Mathematics. Introduction to First-Order Logic. A Motivating Example. Why First-Order Logic?

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

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

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

Language of Propositional Logic

Tautologies, Contradictions, and Contingencies

Knowledge base (KB) = set of sentences in a formal language Declarative approach to building an agent (or other system):

Propositional Equivalence

Logic for Computer Science - Week 4 Natural Deduction

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

1.3 Propositional Equivalences

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

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

Propositional Languages

Lecture 7. Logic. Section1: Statement Logic.

Inference in Propositional Logic

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

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

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

Section 1.2 Propositional Equivalences. A tautology is a proposition which is always true. A contradiction is a proposition which is always false.

It is not the case that ϕ. p = It is not the case that it is snowing = It is not. r = It is not the case that Mary will go to the party =

CSE 20: Discrete Mathematics

Learning Goals of CS245 Logic and Computation

Boolean Logic. CS 231 Dianna Xu

Chapter 1, Section 1.1 Propositional Logic

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

Introduction to Decision Sciences Lecture 2

A brief introduction to Logic. (slides from

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

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

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

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

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

Propositional Logic. Testing, Quality Assurance, and Maintenance Winter Prof. Arie Gurfinkel

INTRODUCTION TO LOGIC. Propositional Logic. Examples of syntactic claims

22c:145 Artificial Intelligence

Chapter 4: Classical Propositional Semantics

Propositional Language - Semantics

a. ~p : if p is T, then ~p is F, and vice versa

Tecniche di Verifica. Introduction to Propositional Logic

CSC165 Mathematical Expression and Reasoning for Computer Science

Why Learning Logic? Logic. Propositional Logic. Compound Propositions

Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 2: Propositional Logic

CSE507. Introduction. Computer-Aided Reasoning for Software. Emina Torlak courses.cs.washington.edu/courses/cse507/17wi/

Propositional Calculus: Formula Simplification, Essential Laws, Normal Forms

ICS141: Discrete Mathematics for Computer Science I

We last time we began introducing equivalency laws.

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

15414/614 Optional Lecture 1: Propositional Logic

CISC-102 Winter 2016 Lecture 17

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

Introduction to Sets and Logic (MATH 1190)

ANALYSIS EXERCISE 1 SOLUTIONS

Chapter 1: Formal Logic

CSE507. Course Introduction. Computer-Aided Reasoning for Software. Emina Torlak

CS206 Lecture 03. Propositional Logic Proofs. Plan for Lecture 03. Axioms. Normal Forms

EECS 1028 M: Discrete Mathematics for Engineers

Discrete Mathematics and Applications COT3100

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

Introduction Logic Inference. Discrete Mathematics Andrei Bulatov

Knowledge Representation. Propositional logic

Discrete Mathematical Structures. Chapter 1 The Foundation: Logic

PL: Truth Trees. Handout Truth Trees: The Setup

ECE473 Lecture 15: Propositional Logic

Natural Deduction. Formal Methods in Verification of Computer Systems Jeremy Johnson

1 Propositional Logic

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

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

Solutions to Homework I (1.1)

Propositional Logic. Fall () Propositional Logic Fall / 30

Math.3336: Discrete Mathematics. Nested Quantifiers

AI Programming CS S-09 Knowledge Representation

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

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

CS 4700: Artificial Intelligence

Sec$on Summary. Tautologies, Contradictions, and Contingencies. Logical Equivalence. Normal Forms (optional, covered in exercises in text)

PROPOSITIONAL LOGIC. VL Logik: WS 2018/19

Knowledge Representation. Propositional logic.

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

CS156: The Calculus of Computation

Part Two: The Basic Components of the SOFL Specification Language

= x ( x 2 4 ) [factor out x] (2)

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

Transcription:

Announcements CS243: Discrete Structures Propositional Logic II Işıl Dillig First homework assignment out today! Due in one week, i.e., before lecture next Tuesday 09/11 Weilin s Tuesday office hours are 9-10 AM, not 10-11 AM Işıl Dillig, CS243: Discrete Structures Propositional Logic II 1/32 Işıl Dillig, CS243: Discrete Structures Propositional Logic II 2/32 Review Operator Precedence Propositional logic is simplest kind of logic Building blocks are propositions, i.e., statements that are true or false Formulas in propositional logic are formed using propositional variables and boolean connectives Connectives: negation, conjunction, disjunction, conditional, biconditional Truth table shows truth value of formula under all possible assignments to variables Given a formula p q r, do we parse this as (p q) r or p (q r)? Without settling on a convention, formulas without explicit paranthesization are ambiguous. To avoid ambiguity, we will specify precedence for logical connectives. Operator precedence is a convention that tells us how to parse formulas if they are not explicitly paranthesized. Işıl Dillig, CS243: Discrete Structures Propositional Logic II 3/32 Işıl Dillig, CS243: Discrete Structures Propositional Logic II 4/32 Operator Precedence, cont. Operator Precedence Example Negation ( ) has higher precedence than all other connectives. Question: Does p q mean (i) (p q) or (ii) ( p) q? Conjunction ( ) has next highest predence. Question: Does p q r mean (i) (p q) r or (ii) p (q r)? Disjunction ( ) has third highest precedence. Next highest is precedence is, and lowest precdence is Which is the correct interpretation of the formula p q r q r (A) ((p (q r)) q) ( r) (B) ((p q) r) q) ( r) (C) (p (q r)) (q ( r)) (D) (p ((q r) q)) ( r) Işıl Dillig, CS243: Discrete Structures Propositional Logic II 5/32 Işıl Dillig, CS243: Discrete Structures Propositional Logic II 6/32 1

Validity, Unsatisfiability Interpretations The truth value of a propositional formula depends on truth assignments to variables Example: p evaluates to true under under the assignment p = F and to false under p = T Some formulas evaluate to true for every assignment, e.g., p p Such formulas are called tautologies or valid formulas Some formulas evaluate to false for every assignment, e.g., p p Such formulas are called unsatisfiable formulas or contradictions Concepts of validity, satisfiability are very important in logic! To make them precise, we ll define interpretation of formula An interpretation I for a formula F is a mapping from each propositional variables in F to exactly one truth value I : {p true, q false, } In general, for formula with n propositional variables, there are 2 n interpretations Each interpretation corresponds to one row in the truth table Işıl Dillig, CS243: Discrete Structures Propositional Logic II 7/32 Işıl Dillig, CS243: Discrete Structures Propositional Logic II 8/32 Entailment Examples Consider the formula F : p q p q Under an interpretation, every propositional formula evaluates to T or F Formula F + Interpretation I = Truth value We write I = F if F evaluates to true under I Similarly, I = F if F evaluates to false under I. Theorem: I = F if and only if I = F Let I 1 be the interpretation such that [p true, q false] What does F evaluate to under I 1? Thus, I 1 = F Let I 2 be the interpretation such that [p true, q true] What does F evaluate to under I 2? Thus, I 2 = F Işıl Dillig, CS243: Discrete Structures Propositional Logic II 9/32 Işıl Dillig, CS243: Discrete Structures Propositional Logic II 10/32 Another Example Satisfiability, Validity F is satisfiable iff there exists interpretation I s.t. I = F Let F 1 and F 2 be two propositional formulas Suppose F 1 evaluates to true under interpretation I What does F 2 F 1 evaluate to under I? F is valid iff for all interpretations I, I = F F is unsatisfiable iff for all interpretations I, I = F F is contingent if it is satisfiable, but not valid. Valid formulas also called tautologies Unsatisfiable formulas called contradictions Işıl Dillig, CS243: Discrete Structures Propositional Logic II 11/32 Işıl Dillig, CS243: Discrete Structures Propositional Logic II 12/32 2

True/False Questions Duality Between Validity and Unsatisfiability Are the following statements true or false? If a formula is valid, then it is also satisfiable. Proof: F is valid if and only if F is unsatisfiable If a formula is satisfiable, then its negation is unsatisfiable. By definition, F is valid iff for all interpretations I, I = F If F 1 and F 2 are satisfiable, then F 1 F 2 is also satisfiable. A formula can be both contingent and unsatisfiable By theorem, I = F iff I = F Thus, F is valid iff for all interpretations I, I = F But if for all interpretations I, I = F, then F is unsat Thus, F valid iff F unsat Işıl Dillig, CS243: Discrete Structures Propositional Logic II 13/32 Işıl Dillig, CS243: Discrete Structures Propositional Logic II 14/32 Proving Validity Proving Satisfiability, Unsatisfiability, Contingency Question: How can we prove that a propositional formula is a tautology? Similarly, can prove satisfiability, unsatisfiability, contingency using truth tables: Exercise: Which formulas are tautologies? Prove your answer. 1. (p q) ( q p) Satisfiable: There exists a row where formula evaluates to true Unsatisfiable: In all rows, formula evaluates to false 2. (p q) p Contingent: Exists a row where formula evaluates to true, and another row where it evaluates to false Işıl Dillig, CS243: Discrete Structures Propositional Logic II 15/32 Işıl Dillig, CS243: Discrete Structures Propositional Logic II 16/32 Exercises Implication 1. Prove (p q) ( p q) is unsatisfiable 2. Prove (p q) (q p) is a contingency Formula F 1 implies F 2 (written F 1 F 2 ) iff for all interpretations I, I = F 1 F 2 F 1 F 2 iff F 1 F 2 is valid Caveat: F 1 F 2 is not a propositional logic formula; is not part of PL syntax! Instead, F 1 F 2 is a semantic judgment, like satisfiability! Işıl Dillig, CS243: Discrete Structures Propositional Logic II 17/32 Işıl Dillig, CS243: Discrete Structures Propositional Logic II 18/32 3

Syntax vs. Semantics Checking Implication Syntax: What you are allowed to write, are part of PL syntax, but, are not! p 1 p 2 is a syntactically valid PL formula, p 1 p 2 is not! Semantics: Concerns meaning of what is written Validity, satisfiability semantic notions b/c they concern meaning of the formula Question: How can we check if F 1 F 2? Exercise: Does p q imply p? Prove your answer! Semantics gives meaning to syntax Difference between syntax vs. semantics crucial in CS Comes up in logic, programming languages, theory of computation,... Işıl Dillig, CS243: Discrete Structures Propositional Logic II 19/32 Işıl Dillig, CS243: Discrete Structures Propositional Logic II 20/32 Equivalence Checking Equivalence Consider two propositional formulas F 1 and F 2. Sometimes F 1 and F 2 always have same truth value for every interpretation, e.g., p p and p p Such formulas F 1 and F 2 called equivalent, written F 1 F 2 or F 1 F 2 More precisely, formulas F 1 and F 2 are equivalent iff for all interpretations I, I = F 1 F 2 Question: How can we prove F 1 F 2? Exercise: Prove p q and p q are equivalent F 1 F 2 iff F 1 F 2 is valid, not part of PL syntax; they are semantic judgments! Işıl Dillig, CS243: Discrete Structures Propositional Logic II 21/32 Işıl Dillig, CS243: Discrete Structures Propositional Logic II 22/32 Important Equivalences Commutativity and Distibutivity Laws Some important equivalences are useful to know! Law of double negation: p p Identity Laws: p T p p F p Domination Laws: p T T p F F Idempotent Laws: p p p p p p Commutative Laws: p q q p p q q p Distributivity Law #1: (p (q r)) (p q) (p r) Distributivity Law #2: (p (q r)) (p q) (p r) Associativity Laws: p (q r) (p q) r p (q r) (p q) r Negation Laws: p p F p p T Işıl Dillig, CS243: Discrete Structures Propositional Logic II 23/32 Işıl Dillig, CS243: Discrete Structures Propositional Logic II 24/32 4

De Morgan s Laws Using Equivalences Let cs243 be the proposition John took CS243 and cs303 be the proposition John took CS303 In simple English what does (cs243 cs303) mean? DeMorgan s law expresses exactly this equivalence! De Morgan s Law #1: (p q) ( p q) De Morgan s Law #2: (p q) ( p q) When you push negations in, becomes and vice versa We saw one way to prove two formulas are equivalent: use truth table Another way: use known equivalences to rewrite one formula as the other Examples: Prove following formulas are equivalent using known equivalences. 1. (p ( p q)) and p q 2. (p q) and p q Işıl Dillig, CS243: Discrete Structures Propositional Logic II 25/32 Işıl Dillig, CS243: Discrete Structures Propositional Logic II 26/32 Formalizing English Arguments in Logic Example, cont We can use logic to prove correctness of English arguments. For example, consider the argument: If Joe drives fast, he gets a speeding ticket. Joe did not get a ticket. Therefore, he did not drive fast. : ((f t) t) f If Joe drives fast, he gets a speeding ticket. Joe did not get a ticket. Therefore, Joe did not drive fast. How can we prove this argument is valid? Can do this in two ways: 1. Use truth table to show formula is tautology Let f be the proposition Joe drives fast, and t be the proposition Joe gets a ticket How do we encode this argument as a logical formula? 2. Use known equivalences to rewrite formula to true Let s use equivalences Işıl Dillig, CS243: Discrete Structures Propositional Logic II 27/32 Işıl Dillig, CS243: Discrete Structures Propositional Logic II 28/32 Another Example Example, cont. Can also use to logic to prove an argument is not valid. Suppose your friend George make the following argument: If Jill carries an umbrella, it is raining. Jill is not carrying an umbrella. Therefore it is not raining. If Jill carries an umbrella, it is raining. Jill is not carrying an umbrella. Therefore it is not raining. : ((u r) u) r How can we prove George s argument is invalid? Let s use logic to prove George s argument doesn t hold water. Let u = Jill is carrying an umbrella, and r = It is raining How do we encode this argument in logic? Işıl Dillig, CS243: Discrete Structures Propositional Logic II 29/32 Işıl Dillig, CS243: Discrete Structures Propositional Logic II 30/32 5

Summary A formula is valid if it is true for all interpretations. A formula is satisfiable if it is true for at least one interpretation. A formula is unsatisfiable if it is false for all interpretations. A formula is contingent if it is true in at least one interpretation, and false in at least one interpretation. Two formulas F 1 and F 2 are equivalent, written F 1 F 2, if F 1 F 2 is valid Işıl Dillig, CS243: Discrete Structures Propositional Logic II 31/32 6