Propositional Logic and Semantics

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

Logic: Propositional Logic (Part I)

Comp487/587 - Boolean Formulas

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

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

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

Propositional Languages

Topic 1: Propositional logic

Tecniche di Verifica. Introduction to Propositional Logic

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

UNIT-I: Propositional Logic

Sample Problems for all sections of CMSC250, Midterm 1 Fall 2014

Lecture 7. Logic. Section1: Statement Logic.

Language of Propositional Logic

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

Truth-Functional Logic

INTRODUCTION TO LOGIC. Propositional Logic. Examples of syntactic claims

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

1 Propositional Logic

3. Only sequences that were formed by using finitely many applications of rules 1 and 2, are propositional formulas.

Logic. Introduction to Artificial Intelligence CS/ECE 348 Lecture 11 September 27, 2001

PHIL12A Section answers, 16 February 2011

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

Propositional Logic: Models and Proofs

Learning Goals of CS245 Logic and Computation

CSC165 Mathematical Expression and Reasoning for Computer Science

CS 2800: Logic and Computation Fall 2010 (Lecture 13)

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

Propositional Logic: Part II - Syntax & Proofs 0-0

22c:145 Artificial Intelligence

1.1 Statements and Compound Statements

CSC Discrete Math I, Spring Propositional Logic

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

The Importance of Being Formal. Martin Henz. February 5, Propositional Logic

Logic, Sets, and Proofs

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

Natural Deduction for Propositional Logic

Definition 2. Conjunction of p and q

Logic as a Tool Chapter 1: Understanding Propositional Logic 1.1 Propositions and logical connectives. Truth tables and tautologies

A brief introduction to Logic. (slides from

1.1 Language and Logic

Propositional Language - Semantics

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

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

Chapter 1, Section 1.1 Propositional Logic

Compound Propositions

Exclusive Disjunction

Logical Agents. Outline

CS156: The Calculus of Computation

1.1 Language and Logic

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

Propositional Logic: Methods of Proof (Part II)

Inf2D 06: Logical Agents: Knowledge Bases and the Wumpus World

Advanced Topics in LP and FP

We last time we began introducing equivalency laws.

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

Introduction to Sets and Logic (MATH 1190)

Chapter 4: Classical Propositional Semantics

Stanford University CS103: Math for Computer Science Handout LN9 Luca Trevisan April 25, 2014

Propositional logic. First order logic. Alexander Clark. Autumn 2014

Conjunctive Normal Form and SAT

Chapter 1 Elementary Logic

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

Propositional logic ( ): Review from Mat 1348

A Logic Primer. Stavros Tripakis University of California, Berkeley. Stavros Tripakis (UC Berkeley) EE 144/244, Fall 2014 A Logic Primer 1 / 35

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

Description Logics. Deduction in Propositional Logic. franconi. Enrico Franconi

Section 1.1: Logical Form and Logical Equivalence

7. Propositional Logic. Wolfram Burgard and Bernhard Nebel

Logic. Quantifiers. (real numbers understood). x [x is rotten in Denmark]. x<x+x 2 +1

15414/614 Optional Lecture 1: Propositional Logic

Conjunctive Normal Form and SAT

Logic and Inferences

Logic - recap. So far, we have seen that: Logic is a language which can be used to describe:

PHIL 422 Advanced Logic Inductive Proof

A Logic Primer. Stavros Tripakis University of California, Berkeley

2.2: Logical Equivalence: The Laws of Logic

Logic. Propositional Logic: Syntax

Math.3336: Discrete Mathematics. Propositional Equivalences

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

Propositional Logic: Syntax

Mathematical Logic Part One

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

A Little Deductive Logic

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

Inference in Propositional Logic

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

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

Introduction to Metalogic

02 Propositional Logic

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

Syntax of propositional logic. Syntax tree of a formula. Semantics of propositional logic (I) Subformulas

Logic Propositional logic; First order/predicate logic

Tautologies, Contradictions, and Contingencies

Part I: Propositional Calculus

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

EECS 1028 M: Discrete Mathematics for Engineers

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

Conjunction: p q is true if both p, q are true, and false if at least one of p, q is false. The truth table for conjunction is as follows.

Discrete Mathematics and Its Applications

Transcription:

Propositional Logic and Semantics English is naturally ambiguous. For example, consider the following employee (non)recommendations and their ambiguity in the English language: I can assure you that no person would be better for the job. All in all, I cannot say enough good things about this candidate or recommend him too highly. Goal: We want to be able to write formal boolean expressions such that there is no ambiguity. For example, p q r means (p q) r or p (q r)? Propositional Formulas Formal expressions involving conjunctions and propositional variables. We denote this set by F PV or simply F, and define F inductively. 2

Slight Diversion - Defining Sets Inductively Defining Sets Inductively What does the following definition construct? Let X be the smallest set such that: Basis: 0 X Inductive Step: if x X then x +1 X. the natural numbers Q: How could we define the integers, Z? Let Z be the smallest set containing: Basis: 0 Z Inductive Step: if z Z then z +1 Z and z 1 Z Q: How abou the rationals, Q? Basis: 0 Z Inductive Step: if z, y Z then 1. z +1 Z 2. z 1 Z 3. y z Z 3

Q: How abou the language of arithmetic, LA? Let LA be the smallest set such that: Basis: Q LA Inductive Step: Suppose that x, y LA then 1. x + y LA 2. x y LA 3. x y LA 4. x y LA Why define sets by induction? Consider the following conjecture: Let e be an element of LA. Let vr(e) represent the number of characters in e. Let op(e) represent the number of operations, ie., characters from {+,,, } in e. CLAIM 1: Let P(e) be vr(e) = op(e) + 1. Then e LA, P (e). We can prove this using a special version of induction called structural induction. 4

CLAIM 1: Let P(e) be vr(e) = op(e) + 1. Then e LA, P (e). We can prove this using a special version of induction called structural induction. Proof. STRUCTURAL INDUCTION on e: 1. Basis: Suppose e Q, then vr(e) =1and op(e) =0. 2. Induction Step: Assume that P (e 1 ) and P (e 2 ) are true for arbitrary expressions in LA. Let e = e 1 e 2 where {+,,, }. Then, vr(e) = vr(e 1 )+vr(e 2 ) by structural induction op(e) = op(e 1 )+1+op(e 2 )+1 op(e) = op(e 1 )+op(e 2 )+1 Therefore, vr(e) = op(e)+1 5

F PV is the smallest set such that: Base Case: true and false belong to F PV, and if p PV then p F PV. 6

Induction Step: If p and q F PV, then so are NEGATION: p CONJUNCTION: (p q) DISJUNCTION: (p q) CONDITIONAL: (p q) BICONDITIONAL: (p q) A formula in F PV is uniquely defined, i.e., there is no ambiguity. (see the Unique Readibility Theorem in the notes.) Q: What happens when a propositional formula is quite complex? such as, (((p y) (q (r t))) (s (u (v (x z))))) brackets make it hard to read. This has lead to conventions that define an informal notation that uses less brackets. 7

Bracketing Conventions 1. drop the outer most parenthesis e.g, (p q) is short hand for p q 2. give and precedence over and (like, + vs. <, = in arithmetic) eg., (p q) (p r) is short for p q p r 3. give precedence over (similar to vs. + in arithmetic) eg., (p q) t is short for p q r 4. group from the right when the same connective appears consecutively, eg., p q r is short hand for (p (q r)). Q: Using these conventions, how can (((p y) (q (r t))) (s (u (v (x z))))) be simplified? (p y (q r t)) (s (u v x z)) 8

The Meaning of τ Q: What is the difference between a propositional formula and a propositional statement? A propositional formula is syntactic. Ie., it is a bunch of symbols with no meaning assigned to them. A statement, has a value of true or false. We need to know what the value is of the propositional variables before we can evaluate the statement. Therefore we need a method to determine the truth value of a statement from the truth values assigned to the propositional variables. Let τ be a truth assignment, ie., a function. τ : PV {true, false}. If p PV and τ assigns true to p, then we write τ(p) =true. How does τ affect a propositional statement? τ assigns truth values to propositional variables, which in turn, give a propositional statement meaning. We need a function that behaves like τ, but operates on propositional statements. Let τ : F PV {true, false}. What does this mean? This means that τ take as input a propositional statement and outputs true or false. 9

We formally define τ using structural induction: Let Q, P F PV. Base Case: P PV. What is τ (P )? The input propositonal statement is simply a propositional variable P. So τ (P ) returns simply τ(p ). Inductive Step Now we assume that P, Q F PV and that τ (P) and τ (Q) return a value from {true, false}. Then: τ ( Q) = { true, ifif τ (Q) =false false, otherwise τ (Q P )= { true, if τ (Q) =τ (P )=true false, otherwise τ (Q P )= { false, if τ (Q) =τ (P )=false true, otherwise Semantics Satisfies If τ (Q) = true, then we say that τ satisfies Q. Falsifies If τ (Q) = false, then we say that τ falsifies Q. We can determine which truth assignments of the propositional variables satisfy a particular propositional statement using a truth table. 10

Truth Tables We will use {0,1} to represent {true, false}. p 1 p 2 p 1 p 2 p 1 p 2 p 1 p 2 p 1 p 2 p 1 p 2 0 0 0 1 1 0 1 1 Q: What does p 1 p 2 really mean? p 1 p 2 is true only when either both p 1 and p 2 are true or if p 1 is false. So this means that if p 1 is true then p 2 must be true. Exercise: using Venn diagrams, remind yourself about the meaning of by showing when p 1 p 2 is true and when it is false. Example: Can we determine which truth assignments τ satisfy (x y) ( x z)? x y z x y x z (x y) ( x z) τ 0 0 0 x y z 0 0 1 x y z 0 1 0 0 1 1 x y z 1 0 0 1 0 1 1 1 0 1 1 1 11

So, (x y) ( x z) is true whenever are true. Therefore, ( x y z) or ( x y z) or ( x y z) (x y) ( x z) ( x y z) ( x y z) ( x y z) A formula that is a conjuction or a bunch of s of propositional variables or their negation is called a minterm. DNF: A formula is in Disjunctive Normal Form if it is the disjunction ( ) of minterms. Example: ( x y z) ( x y z) ( x y z) is the DNF of (x y) ( x z) Q: What does the DNF construction tell us about all boolean functions? given the output of a boolean function, we can construct an equivalent DNF formula 12

Boolean Functions and Circuit Diagrams Q: How are DNF formulas useful? Given a DNF formula, we can can construct a parse tree and therefore circuit diagram Suppose we have a boolean function f(x, y, z), equivalent to the DNF formula: ( x y z) ( x y z) (x y z) (x y z). Then, we can convert f(x, y, z) into a parse tree: How can we create a circuit diagram from the parse tree? replace each,, with an AND, OR, NOT gate. 13

Conjuctive Normal Form Let s look at the truth table again: x y z (x y) ( x z) τ 0 0 0 1 0 0 1 1 0 1 0 0 x y z 0 1 1 1 1 0 0 0 x y z 1 0 1 0 x y z 1 1 0 0 x y z 1 1 1 0 x y z We used the truth assignments that make (x y) ( x z) true, to construct an equivalent formula in DNF. Q: Can we use the truth values that make (x y) ( x z) false to also construct an equivalent formula? yes! Notice that (x y) ( x z) is true when: line 3 is not true line 5 is not true line 6 is not true line 7 is not true line 8 is not true. Therefore, (x y) ( x z) (x y z) ( x y z) ( x y z) ( x y z) ( x y z) 14

So truth tables are great, right?? Q: How many rows would we need in a truth table if we have k propositional variables? 2 k!!! Goal: A proof system or method to determine whether a propositional statement is always true regardless of the truth assignments. More Definitions Tautology We say that a propositional formula P is a tautology if every truth assignment satisfies P. Satisfiable We say that a propositional formula P is satisfiable if some truth assignment satisfies P. Unsatisfiable We say that a propositional formula P is unsatisfiable if no truth assignment satisfies P. Examples Tautology: (x y) x Satisfiable: (x y) Unsatisfiable: x x 15

Logically Implies: P logically implies Q iff P Q is a tautology. Q: When is P Q a tautology? When every truth assignment that satisfies P also satisfies Q. We can denote P logically implies Q byp =Q or P Q. Q: What is the difference between P Q and P Q? one is syntactic and one is semantic, ie., the first talks about the meaning of P and Q, the second is simply a formula with no meaning. The first tells how the second behaves for all truth assignments, namely that if τ makes P true, then τ makes Q true. Logically Equivalent: P and Q are logically equivalent iff P Q and Q P. We denote this P Q Q: How are P Q and P Q related? The first is semantic and the second is syntactic. Again,P Q iff P Q is a tautology. So P says something about the behavior of P Q for all truth assignemnts τ. 16

Some Logical Equivalences Law of Double negation: De Morgan s Laws: Commutative Laws: Associative Laws: Distributive Laws: Identity Laws: Law: Law: 17

Propositional Logic Review Idea Want a formal way to make inferences from boolean statements. DEFINITIONS: Syntax The symbols that we use to represent expressions e.g., a programing language: a piece of code compiles if it has proper syntax. Semantics The meaning of what the symbols represent. e.g., a programming language: a piece of code meets its specifications if the semantics are correct. Proposition a statement that is a sentence that can be evaluated to true or false. Propositional Variable a variable that stands for or represents a primitive proposition, i.e., the simplest propositions we are considering. We denote the set of propositional variables as PV Connectives The symbols, {,,,, }, that we use to join propositions together to make new propositions.

Proving Two Formulas are Logically Equivalent Example 1 Proof. (x y) (x z) x (y z) (x y) (x z) ( x y) ( x z) law x (y z) distributive law x (y z) law Example 2 (Q P ) ( Q P ) P Proof: (Q P ) ( Q P ) ( Q P ) ( Q P ) law ( Q P ) (Q P )double negation (P Q) (P Q) commutative 2 (P ( Q Q) distributive (P (Q Q) commutative P identity Q: What did we just prove? That proof by cases is valid. 18

Proving Two Formulas are NOT Equivalent Q: How do we show that two formula are not equivalent? find a truth assignment that satisfies one, but not the other. Example 3 Simplify a bit first: (y x) (z x)?? (y z) x (y x) (z x) ( y x) ( z x) law ( y z) xdistributive law (y z) xdemorgan s law (y z) x Q: Is there a truth assignment that satisfies only one of (y z) x and (y z) x? yes, consider τ(x, y, z) =(0, 1, 0) 19

Back to Stuctural Induction... We have already seen that p q p q. Q. Can all propositional formulas be rewritten using just and? An Example Recall the definition of F. F be the smallest set such that: Basis: The set of propositional variables belong to F, e.g., P, Q, R,... F Induction Step: If P, Q belong to F then 1. (P Q) F 2. (P Q) F 3. (P Q) F 4. P F CLAIM: Let F be as defined above. If R F then R can be constructed using only 4. and 1. above. I.e., R F, there exists a logically equivalent formula in F constructed using only the operators and. 20

CLAIM: R F, there exists a logically equivalent formula in F constructed using only the operators and. Proof. Structural induction on R F. Basis: Suppose that R is a propositional variable, then R doesn t use any operators and we are done. Inductive Step: If R is not a propositional variable, then R is constructed from one of the 4 rules. Case 1. R is (P Q) Then by structural induction, P and Q are constructed using only and. Case 2. R is (P Q). What is (P Q) logically equivalent to in terms of and? (P Q) (P Q) by demorgan s By structural induction, P and Q can be rewritten using only and, hence so can R Case 3. R is (P Q). What is (P Q) logically equivalent to in terms of and? (P Q) ( P Q) By structural induction, P and Q can be rewritten using only and, hence so can R Case 4. R is P. Then by IH, P are constructed using only and. Therefore, by structural induction the claim holds. Q. What does this tell you about,, and? A. 21

Proving an item does NOT belong to a set Consider the following set H defined by induction: H is the smallest set such that: Basis: The set of propositional variables belongs to H Induction Step: if P H and Q H then 1. P Q H 2. P Q H Q: Can all propositional formulas belong to H? no, we can prove that P cannot. Q: How do we prove that an item does not belong to an inductively defined set? prove a property that holds for all items in the set, then show that the item does not satisfy the property. Q: Suppose that all propositional variables are assigned a value of true. What does this tell you about every item in H? It has truth value true, as T T T and T T T. Q: How does this help us? 22

Consider again P. If P T, what is the truth value of P? Let s prove our claim: CLAIM 3: h H, if every propositional variable in h has value true, then h is true. Proof. By structural induction on R H. Basis: If R is a propositional variable and R T then we are done. Inductive Step: Assume that P, Q H satisify the claim. Case 1: R P Q: By assumption, P T and Q T so R T T T. Done. Case 2:R P Q: By the IH, P T and Q T so R T T T. Done. 23

CLAIM 4: P H. Proof. If P H, then P must satisfy Claim 3. Note however, that if P T then P F. Q: What does CLAIM 4 tell us about and with respect to the set of all propositional formulas? that they are not complete...cannot be used instead of all 4 like and. 24