Logic seminar 2 Propositional logic 24.10.2005. Slobodan Petrović.

Slides:



Advertisements
Similar presentations
Completeness and Expressiveness
Advertisements

Introduction to Theorem Proving
Chapter 2 Fundamentals of Logic Dept of Information management National Central University Yen-Liang Chen.
1 Logic Logic in general is a subfield of philosophy and its development is credited to ancient Greeks. Symbolic or mathematical logic is used in AI. In.
Inference and Reasoning. Basic Idea Given a set of statements, does a new statement logically follow from this. For example If an animal has wings and.
1 Introduction to Abstract Mathematics Valid AND Invalid Arguments 2.3 Instructor: Hayk Melikya
Logic Concepts Lecture Module 11.
Truth Trees Intermediate Logic.
CS128 – Discrete Mathematics for Computer Science
Today’s Topics n Review Logical Implication & Truth Table Tests for Validity n Truth Value Analysis n Short Form Validity Tests n Consistency and validity.
From Chapter 4 Formal Specification using Z David Lightfoot
Knoweldge Representation & Reasoning
EE1J2 – Discrete Maths Lecture 5
EE1J2 – Discrete Maths Lecture 4 Analysis of arguments Logical consequence Rules of deduction Rules of equivalence Formal proof of arguments See: Anderson,
Copyright © Cengage Learning. All rights reserved.
Chapter 2: The Logic of Compound Statements 2.1 Logical Forms and Equivalence 12.1 Logical Forms and Equivalences Logic is a science of the necessary laws.
Adapted from Discrete Math
Propositional Logic Review
1.1 Sets and Logic Set – a collection of objects. Set brackets {} are used to enclose the elements of a set. Example: {1, 2, 5, 9} Elements – objects inside.
Mathematical Structures A collection of objects with operations defined on them and the accompanying properties form a mathematical structure or system.
Review I Rosen , 3.1 Know your definitions!
Propositional Equivalences
Chap. 2 Fundamentals of Logic. Proposition Proposition (or statement): an declarative sentence that is either true or false, but not both. e.g. –Margret.
Chapter 5 – Logic CSNB 143 Discrete Mathematical Structures.
(CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic.
Advanced Topics in Propositional Logic Chapter 17 Language, Proof and Logic.
Propositional Logic Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma Guadalajara
2.3Logical Implication: Rules of Inference From the notion of a valid argument, we begin a formal study of what we shall mean by an argument and when such.
CS344: Introduction to Artificial Intelligence Lecture: Herbrand’s Theorem Proving satisfiability of logic formulae using semantic trees (from Symbolic.
CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 28– Interpretation; Herbrand Interpertation 30 th Sept, 2010.
Chapter Three Truth Tables 1. Computing Truth-Values We can use truth tables to determine the truth-value of any compound sentence containing one of.
Reading: Chapter 4 (44-59) from the text book
SSK3003 DISCRETE STRUCTURES
Chapter 7 Logic, Sets, and Counting
Propositional Logic. Propositions Any statement that is either True (T) or False (F) is a proposition Propositional variables: a variable that can assume.
1 Introduction to Abstract Mathematics Expressions (Propositional formulas or forms) Instructor: Hayk Melikya
Lecture 9 Conditional Statements CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
Chapter 7 Logic, Sets, and Counting Section 1 Logic.
Section 1.2: Propositional Equivalences In the process of reasoning, we often replace a known statement with an equivalent statement that more closely.
Propositional Logic ITCS 2175 (Rosen Section 1.1, 1.2)
Extra slides for Chapter 3: Propositional Calculus & Normal Forms Based on Prof. Lila Kari’s slides For CS2209A, 2009 By Dr. Charles Ling;
CS6133 Software Specification and Verification
Chapter 2 Logic 2.1 Statements 2.2 The Negation of a Statement 2.3 The Disjunction and Conjunction of Statements 2.4 The Implication 2.5 More on Implications.
The Foundations: Logic and Proof, Sets, and Foundations PROPOSITIONS A proposition is a declarative sentence that is either True or False, but not the.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
CS2351 Artificial Intelligence Bhaskar.V Class Notes on Knowledge Representation - Logical Agents.
Symbolic Logic The Following slide were written using materials from the Book: The Following slide were written using materials from the Book: Discrete.
Methods of Proof – Page 1CSCI 1900 – Discrete Structures CSCI 1900 Discrete Structures Methods of Proof Reading: Kolman, Section 2.3.
Propositional Logic Rather than jumping right into FOL, we begin with propositional logic A logic involves: §Language (with a syntax) §Semantics §Proof.
ARTIFICIAL INTELLIGENCE Lecture 2 Propositional Calculus.
Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction.
1 Section 6.2 Propositional Calculus Propositional calculus is the language of propositions (statements that are true or false). We represent propositions.
Outline Logic Propositional Logic Well formed formula Truth table
Lecture 10 Methods of Proof CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
Foundations of Discrete Mathematics Chapter 1 By Dr. Dalia M. Gil, Ph.D.
Discrete Mathematical Structures: Theory and Applications 1 Logic: Learning Objectives  Learn about statements (propositions)  Learn how to use logical.
1 Section 7.1 First-Order Predicate Calculus Predicate calculus studies the internal structure of sentences where subjects are applied to predicates existentially.
Chapter 1 Logic and proofs
Logic.
2. The Logic of Compound Statements Summary
DISCRETE MATHEMATICS CHAPTER I.
Lecture 1 – Formal Logic.
Knowledge Representation and Reasoning
Discrete Mathematics Logic.
Truth Tables and Equivalent Statements
Information Technology Department
Logics for Data and Knowledge Representation
Propositional Equivalences
Discrete Mathematics Logic.
Foundations of Discrete Mathematics
Presentation transcript:

Logic seminar 2 Propositional logic Slobodan Petrović

Propositional logic In the propositional logic, we are interested in declarative sentences that can be either true or false. Any such declarative sentence is called a proposition. More formally, a proposition is a declarative sentence that is either true or false. Examples of propositions are: “Snow is white,” “Sugar is a hydrocarbon,” “Smith has a Ph.D. degree.” The “true” or “false” assigned to a proposition is called the truth value of the proposition.

Propositional logic Customarily, we represent “true” by T and “false” by F. Furthermore, for convenience, we use an uppercase symbol or a string of uppercase symbols to denote a proposition. For instance, we may denote the propositions as follows: –P: Snow is white, –Q: Sugar is a hydrocarbon, –R: Smith has a Ph.D. degree.

Propositional logic The symbols, such as P, Q, and R, that are used to denote propositions are called atomic formulas, or atoms. From propositions, we can build compound propositions by using logical connectives. Examples of compound propositions: –“Snow is white and the sky is clear” –“If John is not at home, then Mary is at home” The logical connectives in these two compound propositions are “and” and “if... then”. In the propositional logic, we use five logical connectives: –~ (not),  (and),  (or),  (if... then), and  (if and only if).

Propositional logic The logical connectives can be used to build compound propositions from propositions. More generally, they can be used to construct more complicated compound propositions from compound propositions by applying them repeatedly.

Propositional logic Example. We have the following sentences: –P: “Humidity is high” –Q: “Temperature is high” –C: “One feels comfortable”. Then the sentence “If the humidity is high and the temperature is high, then one does not feel comfortable” may be represented by ((P  Q)  (~C)).

Propositional logic A compound proposition can express a rather complicated idea. In the propositional logic, an expression that represents a proposition, such as P, and a compound proposition, such as ((P  Q)  (~C)) is called a well-formed formula.

Propositional logic Definition: Well-formed formulas, or formulas for short, in the propositional logic are defined recursively as follows: –1. An atom is a formula. –2. If G is a formula, then (~G) is a formula. –3. If G and H are formulas, then (G  H), (G  H), (G  H), and, (G  H) are formulas. –4. All formulas are generated by applying these rules. Example: (P  ) and (P  ) are not formulas.

Propositional logic When no confusion is possible, some pairs of parentheses may be dropped. For example, P  Q and P  Q are the formulas (P  Q) and (P  Q), respectively. We can further omit the use of parentheses by assigning decreasing ranks to the propositional connectives as follows: – , , , , ~. and requiring that the connective with greater rank always reaches further.

Propositional logic Examples: –P  Q  R means (P  (Q  R)) –P  Q  ~R  S means (P  (Q  ((~R)  S)))

Propositional logic Let G and H be two formulas. Then the truth values of the formulas (~G), (G  H), (G  H), (G  H), and (G  H) are related to the truth values of G and H in the following way: –1. ~G is true when G is false, and is false when G is true. ~G is called the negation of G. –2. (G  H) is true if G and H are both true; otherwise, (G  H) is false. (G  H) is called the conjunction of G and H.

Propositional logic –3. (G  H) is true if at least one of G and H is true; otherwise, (G  H) is false. (G  H) is called the conjunction of G and H. –4. (G  H) is false if G is true and H is false; otherwise, (G  H) is true. (G  H) is read as “If G, then H” or “G implies H”. –5. (G  H) is true whenever G and H have the same truth values; otherwise (G  H) is false.

Propositional logic Truth table –By the truth table, we describe ways to evaluate the truth values of a formula in terms of the truth values of atoms occurring in the formula.

Propositional logic GH~G~G (GH)(GH)(GH)(GH)(GH)(GH)(GH)(GH) FFTFFTT FTTFTTF TFFFTFF TTFTTTT

Interpretation of formulas in propositional logic –If P and Q are two atoms and their truth values are T and F, respectively, then, according to the third row of the truth table, with P and Q substituted for G and H, respectively, we find that the truth values of (~P), (P  Q), (P  Q), (P  Q), and (P  Q) are F, F, T, F and F, respectively. –Similarly, the truth value of any formula can be evaluated in terms of truth values of atoms.

Propositional logic Example: –G=(P  Q)  (R  (~S)). –The atoms in this formula are P, Q, R, and S. –Suppose the truth values of P, Q, R, and S are T, F, T, and T, respectively. –Then (P  Q) is F since Q is false; (~S) is F since S is T; (R  (~S)) is F since R is T and (~S) is F; and (P  Q)  (R  (~S)) is T since (P  Q) is F and (R  (~S)) is F. –Therefore, the formula G is T if P, Q, R, and S are assigned T, F, T, and T.

Propositional logic The assignment of the truth values {T, F, T, T} to {P, Q, R, S}, respectively, is called an interpretation of the formula G. Since each one of P, Q, R, and S can be assigned either T or F, there are 2 4 =16 interpretations of the formula G. All the interpretations of formulas are usually given in tables – a truth table.

Propositional logic PQRS~S~S (P  Q)(R  (~S))(P  Q)  (R  (~S)) FFFFTFFT FFFTFFTT FFTFTFTT FFTTFFFT FTFFTFFT FTFTFFTT FTTFTFTT FTTTFFFT TFFFTFFT TFFTFFTT TFTFTFTT TFTTFFFT TTFFTTFF TTFTFTTT TTTFTTTT TTTTFTFF

Propositional logic Definition –Given a propositional formula G, let A 1, A 2,..., A n be the atoms occurring in the formula G. Then an interpretation of G is an assignment of truth values to A 1, A 2,..., A n in which every A i is assigned either T or F. Definition –A formula G is said to be true under (or in) an interpretation if and only if G is evaluated to T in the interpretation; otherwise, G is said to be false under the interpretation.

Propositional logic If there are n distinct atoms in a formula, then there will be 2 n distinct interpretations for the formula. Sometimes, if A 1,..., A n are all atoms occurring in a formula, it may be more convenient to represent an interpretation by a set {m 1,..., m n }, where m i is either A i or ~A i. Example: –The set {P, ~Q, ~R, S} represents an interpretation in which P, Q, R, and S are, respectively, assigned T, F, F, and T. If an atom A is in a set that represents an interpretation, then A is assigned T; while if the negation of the atom A is in the set, then A is assigned F.

Propositional logic Validity and inconsistency in propositional logic –We consider formulas that are true under all their possible interpretations and formulas that are false under all their possible interpretations. –Example The formula: G=((P  Q)  P)  Q. The atoms in this formula are P and Q. Hence, the formula G has 2 2 =4 interpretations. The truth values of G under all its four interpretations are T, i.e. formula G is true under all its interpretations. This formula is called a valid formula (or a tautology).

Propositional logic ((P  Q)  P)  Q PQ (P  Q)(P  Q)  P((P  Q)  P)  Q FFTFT FTTFT TFFFT TTTTT

Propositional logic –Example The formula: G=(P  Q)  (P  (~Q)). The atoms in this formula are P and Q. Hence, the formula G has 2 2 =4 interpretations. The truth values of G under all its four interpretations are F, i.e. formula G is false under all its interpretations. This formula is called an inconsistent formula (or a contradiction).

Propositional logic G=(P  Q)  (P  (~Q)) PQ~Q~Q (P  Q)(P  (~Q))(P  Q)  (P  (~Q)) FFTTFF FTFTFF TFTFTF TTFTFF

Propositional logic Formal definitions of validity and inconsistency. Definition –A formula is valid if and only if it is true under al its interpretations. –A formula is said to be invalid if and only if it is not valid. Definition –A formula is said to he inconsistent (or unsatisfiable) if and only if it is false under all its interpretations. –A formula is said to be consistent (or satisfiable) if and only if it is not inconsistent.

Propositional logic Properties of validity and inconsistency –1. A formula is valid if and only if its negation is inconsistent. –2. A formula is inconsistent if and only if its negation is valid. –3. A formula is invalid if and only if there is at least one interpretation under which the formula is false.

Propositional logic Properties of validity and inconsistency (cont.) –4. A formula is consistent if and only if there is at least one interpretation under which the formula is true. –5. If a formula is valid, then it is consistent, but not vice versa. –6. If a formula is inconsistent, then it is invalid, but not vice versa.

Propositional logic Examples: 1. (P  (~P)) is inconsistent, therefore also invalid. 2. (P  (~P)) is valid, therefore also consistent. 3. (P  (~P)) is invalid, yet it is consistent.

Propositional logic If a formula F is true under an interpretation I, then we say that I satisfies F, or F is satisfied by I. On the other hand, if a formula F is false under an interpretation I, then we say that I falsifies F or F is falsified by I. For example, the formula (P  (~Q)) is satisfied by the interpretation {P,~Q}, but is falsified by the interpretation {P,Q}. When an interpretation I satisfies a formula F, I is also called a model of F.

Propositional logic In propositional logic, since the number of interpretations is finite, one can always decide whether or not a formula in the propositional logic is valid (inconsistent) by exhaustively examining all of its possible interpretations.

Propositional logic Normal forms in the propositional logic –It is often necessary to transform a formula from one form to another, especially to a “normal form” –This is accomplished by replacing a formula in the given formula by a formula “equivalent” to it and repeating this process until the desired form is obtained. Definition of “equivalence”: –Two formulas F and G are said to he equivalent (or F is equivalent to G), F = G, if and only if the truth values of F and G are the same under every interpretation of F and G.

Propositional logic Example –We can verify that (P  Q) is equivalent to (~P  Q) by examining the truth table. PQ PQPQ~PQ~PQ FFTT FTTT TFFF TTTT

Propositional logic In the propositional logic, let ■ denote the formula that is always true and □ the formula that is always false. Then we can verify the following “laws” by using truth tables: –Commutative laws –Associative laws –Distributive laws –De Morgan’s laws.

Propositional logic F  G=(F  G)  (G  F) F  G=~F  G F  G=G  FF  G=G  F F  □=F F  ■=F F  ■=■ F  □=□ F  (~F)=■ F  (~F)=□ ~(~F)=F

Propositional logic Associative laws: –(F  G)  H=F  (G  H) –(F  G)  H=F  (G  H) Distributive laws: –F  (G  H)=(F  G)  (F  H) –F  (G  H)=(F  G)  (F  H)

Propositional logic De Morgan’s laws: –~(F  G)=(~F)  (~G) –~(F  G)=(~F)  (~G)

Propositional logic Normal forms: –Definition A literal is an atom or the negation of an atom. –Definition A formula F is said to be in a conjunctive normal form if and only if F has the form F=F 1  …  F n, n  1, where each of F i is a disjunction of literals.

Propositional logic Example: –Let P, Q, andR be atoms. –Then F=(P  ~Q  R)  (~P  Q) is a formula in a conjunctive normal form. –For this formula, F 1 =(P  ~Q  R) and F 2 = (~P  Q). –F 1 is a disjunction of the literals P, ~Q, and R, and F 2 is a disjunction of the literals ~P and Q.

Propositional logic –Definition A formula F is said to be in a disjunctive normal form if and only if F has the form F=F 1  …  F n, n  1, where each of F i is a conjunction of literals. Example: –Let P, Q, and R be atoms. –Then F=(~P  Q)  (P  ~Q  ~R) is a formula in a disjunctive normal form. –For this formula, F 1 =(~P  Q) and F 2 =(P  ~Q  ~R). –F 1 is a conjunction of the literals ~P and Q, and F 2 is a conjunction of the literals P, ~Q, and ~R.

Propositional logic Any formula can be transformed into a normal form. This is accomplished by using the laws. The transformation procedure: –Step 1.Use the laws F  G=(F  G)  (G  F) F  G=~F  G –to eliminate the logical connectives  and .

Propositional logic –Step 2.Repeatedly use the law ~(~F)=F, and De Morgan’s laws: ~(F  G)=~F  ~G ~(F  G)=~F  ~G –to bring the negation signs immediately before atoms. –Step 3.Repeatedly use the distributive laws F  (G  H)=(F  G)  (F  H) F  (G  H)=(F  G)  (F  H) –and the other laws to obtain a normal form.

Propositional logic Example –Obtain a disjunctive normal form for the formula (P  ~Q)  R. (P  ~Q)  R=~(P  ~Q)  R =(~P  ~(~Q))  R =(~P  Q)  R

Propositional logic Example –Obtain a conjunctive normal form for the formula (P  (Q  R))  S. (P  (Q  R))  S=(P  (~Q  R))  S =~(P  (~Q  R))  S =(~P  (~(~Q  R)))  S =(~P  (~(~Q)  ~R))  S =(~P  (Q  ~R))  S =((~P  Q)  (~P  ~R))  S

Propositional logic Example (cont.) =S  ((~P  Q)  (~P  ~R)) =(S  (~P  Q))  (S  (~P  ~R)) =(S  ~P  Q)  (S  ~P  ~R)

Propositional logic Logical consequences –We often have to decide whether one statement follows from some other statements. –This leads to the concept of “logical consequence”. Example –Suppose the stock prices go down if the prime interest rate goes up. –Suppose also that most people are unhappy when stock prices go down. –Assume that the prime interest rate does go up. –Show that we can conclude that most people are unhappy.

Propositional logic Let us denote the statements as follows: –P=Prime interest rate goes up, –S=Stock prices go down, –U=Most people are unhappy. There are four statements in this example: –(1) If the prime interest rate goes up, stock prices go down. –(2) If stock prices go down, most people are unhappy.

Propositional logic –(3) The prime interest rate goes up. –(4) Most people are unhappy. These statements are first symbolized: –(1’) P  S –(2’) S  U –(3’) P –(4’) U. We have to show that (4') is true whenever (1’)  (2’)  (3’) is true.

Propositional logic We first transform ((P  S)  (S  U)  P), representing (1’)  (2’)  (3’) into a normal form: –((P  S)  (S  U)  P)=((~P  S)  (~S  U)  P) –=(P  (~P  S)  (~S  U)) –=(((P  ~P)  (P  S))  (~S  U)) –=((□  (P  S))  (~S  U)) –=(P  S)  (~S  U) –=(P  S  ~S)  (P  S  U) –=(P  □)  (P  S  U)

Propositional logic –=□  (P  S  U) –P  S  U Therefore, if ((P  S)  (S  U)  P) is true, then (P  S  U) is true. Since (P  S  U) is true only if P, S, and U are all true, we conclude that U is true. Because U is true whenever (P  S), (S  U), and P are true, in logic, U is called a logical consequence of (P  S), (S  U), and P.

Propositional logic Definition –Given formulas F 1, F 2,..., F n, and a formula G, G is said to be a logical consequence of F 1, F 2,..., F n (or G logically follows from F 1, F 2,..., F n ) if and only if for any interpretation I in which F 1  F 2 ...  F n is true, G is also true. –F 1, F 2,..., F n are called axioms (or postulates, premises) of G.

Propositional logic Theorem1 (Deduction Theorem) –Given formulas F 1, F 2,..., F n and a formula G, G is a logical consequence of F 1, F 2,..., F n if and only if the formula ((F 1  F 2 ...  F n )  G) is valid. Theorem 2 –Given formulas F 1, F 2,..., F n and a formula G, G is a logical consequence of F 1, F 2,..., F n if and only if the formula (F 1  F 2 ...  F n  ~G) is inconsistent.

Propositional logic If G is a logical consequence of F 1, F 2,..., F n the formula ((F 1  F 2 ...  F n )  G) is called a theorem. G is also called the conclusion of the theorem. In mathematics as well as in other fields, many problems can be formulated as problems of proving theorems.

Propositional logic Example –Given the formulas F 1 =P  Q F 2 =~Q G=~P, –show that G is a logical consequence of F 1 and F 2.

Propositional logic Method 1 –We can use the truth table technique to show that G is true in every model of (P  Q)  ~Q. –There is only one model for (P  Q)  ~Q, namely {~P,~Q}. –~P is certainly true in this model. –Thus, by the definition of logical consequence, we conclude that ~P is a logical consequence of (P  Q) and ~Q.

Propositional logic PQ PQPQ ~Q~Q (PQ)~Q(PQ)~Q ~P~P FFTTTT FTTFFT TFFTFF TTTFFF

Method 2 –We can use Theorem 1. –This can be done by extending the truth table or by evaluating the formula ((P  Q)  ~Q)  ~P. –From the extended truth table we can see that ((P  Q)  ~Q)  ~P is true in every interpretation. –Then ((P  Q)  ~Q)  ~P is valid and, according to the Theorem 1, ~P is a logical consequence of (P  Q) and ~Q.

Propositional logic PQ PQPQ ~Q~Q (PQ)~Q(PQ)~Q ~P~P ((P  Q)  ~Q)  ~P FFTTTTT FTTFFTT TFFTFFT TTTFFFT

Propositional logic We can also prove the validity of (((P  Q)  ~Q)  ~P) by transforming it into a conjunctive normal form. –((P  Q)  ~Q)  ~P=~((P  Q)  ~Q)  ~P –=~((~P  Q)  ~Q)  ~P –=~((~P  ~Q)  (Q  ~Q))  ~P –=~((~P  ~Q)  □)  ~P –=~(~P  ~Q)  ~P –=(P  Q)  ~P

Propositional logic –=(Q  P)  ~P –=Q  (P  ~P) –=Q  ■ –=■ Thus, ((P  Q)  ~Q)  ~P is valid.

Propositional logic Method 3 –We can use Theorem 2. –In this case, we prove that ((P  Q)  ~Q)  (~(~P))=(P  Q)  ~Q  P is inconsistent. –We can also use the truth table technique to show that (P  Q)  ~Q  P is false in every interpretation. – From the truth table we can conclude that (P  Q)  ~Q  P is inconsistent and, according to Theorem 2, ~P is a logical consequence of (P  Q) and ~Q.

Propositional logic PQ PQPQ ~Q~Q (PQ)~QP(PQ)~QP FFTTF FTTFF TFFTF TTTFF

We can also prove the inconsistency of (P  Q)  ~Q  P by transforming it into a disjunctive normal form: –(P  Q)  ~Q  P=(~P  Q)  ~Q  P –=(~P  ~Q  P)  (Q  ~Q  P) –=□  □= –=□ Thus, (P  Q)  ~Q  P is inconsistent.