Propositional Logic.

Slides:



Advertisements
Similar presentations
Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
Advertisements

Propositional Logic CMSC 471 Chapter , 7.7 and Chuck Dyer
1 Introduction to Abstract Mathematics Valid AND Invalid Arguments 2.3 Instructor: Hayk Melikya
Deduction In addition to being able to represent facts, or real- world statements, as formulas, we want to be able to manipulate facts, e.g., derive new.
Logic.
CS128 – Discrete Mathematics for Computer Science
Logic in general Logics are formal languages for representing information such that conclusions can be drawn Syntax defines the sentences in the language.
Discrete Mathematics Lecture 1 Logic of Compound Statements Harper Langston New York University.
Syllabus Every Week: 2 Hourly Exams +Final - as noted on Syllabus
Knoweldge Representation & Reasoning
Adapted from Discrete Math
Review I Rosen , 3.1 Know your definitions!
Chap. 2 Fundamentals of Logic. Proposition Proposition (or statement): an declarative sentence that is either true or false, but not both. e.g. –Margret.
1 CMSC 471 Fall 2002 Class #10/12–Wednesday, October 2 / Wednesday, October 9.
Propositional Logic Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma Guadalajara
SSK3003 DISCRETE STRUCTURES
CS 381 DISCRETE STRUCTURES Gongjun Yan Aug 25, November 2015Introduction & Propositional Logic 1.
1 Introduction to Abstract Mathematics Expressions (Propositional formulas or forms) Instructor: Hayk Melikya
Logical Agents Chapter 7. Outline Knowledge-based agents Logic in general Propositional (Boolean) logic Equivalence, validity, satisfiability.
Propositional Logic ITCS 2175 (Rosen Section 1.1, 1.2)
CS6133 Software Specification and Verification
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
Chapter 7. Propositional and Predicate Logic Fall 2013 Comp3710 Artificial Intelligence Computing Science Thompson Rivers University.
Dr. Shazzad Hosain Department of EECS North South Universtiy Lecture 04 – Part B Propositional Logic.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
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.
March 3, 2016Introduction to Artificial Intelligence Lecture 12: Knowledge Representation & Reasoning I 1 Back to “Serious” Topics… Knowledge Representation.
Chapter 1 Logic and proofs
Logical Agents. Inference : Example 1 How many variables? 3 variables A,B,C How many models? 2 3 = 8 models.
Propositional Logic. Logic Logic: the science of reasoning, proof, thinking or inference. Logic allows us to analyze a piece of reasoning and determine.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
Logic.
Chapter 7. Propositional and Predicate Logic
2. The Logic of Compound Statements Summary
Propositional Logic Russell and Norvig: Chapter 6 Chapter 7, Sections 7.1—7.4 CS121 – Winter 2003.
Advanced Algorithms Analysis and Design
Discrete Mathematics Lecture 1 Logic of Compound Statements
Lecture 1 – Formal Logic.
Knowledge Representation and Reasoning
Discrete Mathematics Logic.
COMP 1380 Discrete Structures I Thompson Rivers University
Methods of proof Section 1.6 & 1.7 Wednesday, June 20, 2018
COT 3100, Spr Applications of Discrete Structures
(CSC 102) Discrete Structures Lecture 2.
The Propositional Calculus
Introduction to Symbolic Logic
Principles of Computing – UFCFA3-30-1
Logical Agents Chapter 7 Selected and slightly modified slides from
Propositional Calculus: Boolean Algebra and Simplification
Information Technology Department
CS201: Data Structures and Discrete Mathematics I
Logical Agents Chapter 7.
Mathematical Reasoning
Methods of Proof. Methods of Proof Definitions A theorem is a valid logical assertion which can be proved using Axioms: statements which are given.
CS 270 Math Foundations of CS
Applied Discrete Mathematics Week 1: Logic
Back to “Serious” Topics…
The Method of Deduction
Computer Security: Art and Science, 2nd Edition
Discrete Mathematics Logic.
Automated Reasoning in Propositional Logic
Chapter 7. Propositional and Predicate Logic
CSNB234 ARTIFICIAL INTELLIGENCE
Foundations of Discrete Mathematics
COMP 1380 Discrete Structures I Thompson Rivers University
Propositional Logic CMSC 471 Chapter , 7.7 and Chuck Dyer
Mathematical Reasoning
CS201: Data Structures and Discrete Mathematics I
The Foundations: Logic and Proofs
Presentation transcript:

Propositional Logic

Proposition A proposition is a statement that is either true or false, but not both. Atlanta was the site of the 1996 Summer Olympic games. 1+1 = 2 3+1 = 5 Who will win the elections in Israel?

Definition 1. Negation of p Let p be a proposition. The statement “It is not the case that p” is also a proposition, called the “negation of p” or ¬p (read “not p”) Table 1. The Truth Table for the Negation of a Proposition p ¬p T F F T p = The sky is blue. p = It is not the case that the sky is blue. p = The sky is not blue.

Definition 2. Conjunction of p and q Let p and q be propositions. The proposition “p and q,” denoted by pq is true when both p and q are true and is false otherwise. This is called the conjunction of p and q. Table 2. The Truth Table for the Conjunction of two propositions p q pq T T T T F F F T F F F F

Definition 3. Disjunction of p and q Let p and q be propositions. The proposition “p or q,” denoted by pq, is the proposition that is false when p and q are both false and true otherwise. Table 3. The Truth Table for the Disjunction of two propositions p q pq T T T T F T F T T F F F

Definition 5. Implication pq Let p and q be propositions. The implication pq is the proposition that is false when p is true and q is false, and true otherwise. In this implication p is called the hypothesis (or antecedent or premise) and q is called the conclusion (or consequence). Table 5. The Truth Table for the Implication of pq. p q pq T T T T F F F T T F F T

Implications How can both p and q be false, and pq be true? Think of p as a “contract” and q as its “obligation” that is only carried out if the contract is valid. Example: “If you make more than $25,000, then you must file a tax return.” This says nothing about someone who makes less than $25,000. So the implication is true no matter what someone making less than $25,000 does. Another example: p: Bill Gates is poor. q: Pigs can fly. pq is always true because Bill Gates is not poor. Another way of saying the implication is “Pigs can fly whenever Bill Gates is poor” which is true since neither p nor q is true.

Definition 6. Biconditional Let p and q be propositions. The biconditional pq is the proposition that is true when p and q have the same truth values and is false otherwise. “p if and only if q, p is necessary and sufficient for q” Table 6. The Truth Table for the biconditional pq. p q pq T T T T F F F T F F F T

Practice p: You learn the simple things well. q: The difficult things become easy. The difficult things become easy but you did not learn the simple things well. You learn the simple things well but the difficult things did not become easy. You do not learn the simple things well. If you learn the simple things well then the difficult things become easy. If you do not learn the simple things well, then the difficult things will not become easy. p q  p pq p  q p  q

Truth Table Puzzle Steve would like to determine the relative salaries of three coworkers using two facts (all salaries are distinct): If Fred is not the highest paid of the three, then Janice is. If Janice is not the lowest paid, then Maggie is paid the most. Who is paid the most and who is paid the least?

p : Janice is paid the most. q: Maggie is paid the most. r: Fred is paid the most. s: Janice is paid the least. p q r s rp s q (rp) (sq) T F F F T F F F T F T F T F F F T T T T T F T F F F T F F F T F T F F Fred, Maggie, Janice If Fred is not the highest paid of the three, then Janice is. If Janice is not the lowest paid, then Maggie is paid the most.

p : Janice is paid the most. q: Maggie is paid the most. r: Fred is paid the most. s: Janice is paid the least. p q r s rp s q (rp) (sq) T F F F T T T F T F T F T F F F T T T F F F T F F F T F F F T F T T T Fred, Janice, Maggie or Janice, Maggie, Fred or Janice, Fred, Maggie If Fred is not the highest paid of the three, then Janice is. If Janice is the lowest paid, then Maggie is paid the most.

Logical Equivalence An important technique in proofs is to replace a statement with another statement that is “logically equivalent.” Tautology: compound proposition that is always true regardless of the truth values of the propositions in it. Contradiction: Compound proposition that is always false regardless of the truth values of the propositions in it.

Logically Equivalent Compound propositions P and Q are logically equivalent if PQ is a tautology. In other words, P and Q have the same truth values for all combinations of truth values of simple propositions. This is denoted: PQ (or by P Q)

Example: DeMorgans Prove that (pq)  (p  q) p q (pq) (pq) p q (p  q) T T T F F T F F T F F F F T F F T F T F T F F F T T T T

Illustration of De Morgan’s Law (pq) p q

Illustration of De Morgan’s Law p p

Illustration of De Morgan’s Law q q

Illustration of De Morgan’s Law p  q p q

Example: Distribution Prove that: p  (q  r)  (p  q)  (p  r) p q r qr p(qr) pq pr (pq)(pr) T T T T T T T T T T F F T T T T T F T F T T T T T F F F T T T T F T T T T T T T F T F F F T F F F F T F F F T F F F F F F F F F

Prove: pq(pq)  (qp) p q pq pq qp (pq)(qp) T T T T T T T F F F T F F T F T F F F F T T T T We call this biconditional equivalence.

List of Logical Equivalences pT  p; pF  p Identity Laws pT  T; pF  F Domination Laws pp  p; pp  p Idempotent Laws (p)  p Double Negation Law pq  qp; pq  qp Commutative Laws (pq) r  p (qr); (pq)  r  p  (qr) Associative Laws

List of Equivalences p(qr)  (pq)(pr) Distribution Laws (pq)(p  q) De Morgan’s Laws (pq)(p  q) Miscellaneous p  p  T Or Tautology p  p  F And Contradiction (pq)  (p  q) Implication Equivalence pq(pq)  (qp) Biconditional Equivalence

Logic Logic is a language for reasoning. It is a collection of rules that we use when doing logical reasoning. Human reasoning has been observed over centuries from at least the times of Greeks, and patterns appearing in reasoning have been extracted, abstracted, and streamlined.

Propositional Logic Propositional logic is a logic about truth and falsity of sentences. The smallest unit of propositional logic is thus a sentence. No analysis will be done to the components of a sentence. We are only interested in true or false sentences, but not both. Sentences that are either true or false are called propositions (or statements).

Propositions If a proposition is true, then we say it has a truth value of "true"; if a proposition is false, its truth value is "false". E.g.: 1. Ten is less than seven 2. 10 > 5 3. Open the door. 4. how are you? 5. She is very talented 6. There are life forms on other planets 7. x is great than 3 (1) and (2) are propositions (or statements). (1) is false and (2) is true. (3) – (7) are not propositions

Identifying logical forms argument 1 and 2 have the same form. If Jane is a math major or Jane is a computer major, then Jane will take Math 150. Jane is a computer science major Therefore Jane will take Math 150 2. If logic is easy or I will study hard , then I will get a A in this course . I will study hard Therefore, I will get a A in this course Logic form: if P or Q, then R Q Therefore, R

Logic Connectives Simple sentences which are true or false are basic propositions. Larger and more complex sentences are constructed from basic propositions by combining them using connectives. Thus, propositions and connectives are the basic elements of propositional logic. English word Connective Symbol Not Negation  () And Conjunction  Or Disjunction  If then Implication   if and only if Equivalence 

Construction of Complex Propositions Let X and Y represent arbitrary propositions. Then (X),   (X  Y), (X  Y), (X  Y), and (X  Y), are propositions. E.g., (A)  (B  C) is a proposition. It is obtained by first constructing (A) by applying (X), (B V C) by applying (X  Y) to propositions B and C, and then by applying (X  Y) to the two propositions (A)  (B  C) considering them as X and Y, respectively. A well-formed formula (wff): A legitimate string yes: (A)  (B  C) no: ((A  BC((

Logical Reasoning Logical reasoning is the process of drawing conclusions from premises using rules of inference These inference rules are results of observations of human reasoning over centuries. They have contributed significantly to the scientific and engineering progress of the mankind. Today they are universally accepted as the rules of logical reasoning and they should be followed in our reasoning.

Valid and invalid arguments An argument is a sequence of statements. All statements but the final one are called premises (assumptions or hypotheses). The final statement is called the conclusion. The symbol , read “therefore” is normally placed just before the conclusion. “An argument form is valid” means that no matter what statements are substituted for the statement variables in its premises, if the resulting premises are all true, then the conclusion is also true. A valid argument is called a proof.

Reasoning with Propositions The basic inference rule is modus ponens. It states that if both P  Q and P hold, then Q can be concluded, and it is written as P P  Q ---------  Q The lines above the dotted line are premises and the line below is the conclusion drawn from the premises.

Some more modus tollens Q P  Q ---------  P Conjunctive Simplification P  Q --------  P Conjunctive addition P Q -------------  P  Q Rule of contradiction P  c, where c is a contradiction ---------  P

Yet some more Disjunctive Addition P -------------  P  Q Disjunctive syllogism P  Q Q ---------  P Hypothetical syllogism P  Q Q  R --------  P  R Dilemma: proof by division into cases P  Q P  R Q  R --------  R

Proof A proof is a sequence of sentences, where each sentence is either a premise or a sentence derived from earlier sentences in the proof by one of the rules of inference. The last sentence is the theorem (also called goal or query) that we want to prove.

A complex example If my glasses are on the kitchen table, then I saw them at breakfast. I was reading the newspaper in the living room or I was reading the newspaper in the kitchen. If I was reading the newspaper in the living room, then my glasses are on the coffee table. I did not see my glasses at breakfast. If I was reading my book in bed, then my glasses are on the bed table. If I was reading the newspaper in the kitchen, then my glasses are on the kitchen table. Where are the glasses?

Translate them into symbols P = my glasses are on the kitchen table, Q = I saw my glasses at breakfast. R = I was reading the newspaper in the living room S = I was reading the newspaper in the kitchen. T = my glasses are on the coffee table. U = I was reading my book in bed. V= my glasses are on the bed table. Statements in the previous slide are translated as follows: 1. P  Q 2. R  S 3. R  T 4. Q 5. U  V 6. S  P

Example: weather problem If it is humid, it is hot. If it’s hot & humid, it’s raining. It is humid.

Example for the “weather problem” given above. 1 Hu Premise “It is humid” 2 HuHo Premise “If it is humid, it is hot” 3 Ho Modus Ponens(1,2) “It is hot” 4 (HoHu)R Premise “If it’s hot & humid, it’s raining” 5 HoHu And Introduction(1,2) “It is hot and humid” 6 R Modus Ponens(4,5) “It is raining”

Entailment Entailment: KB |= Q Q is entailed by KB (a set of premises or assumptions) if and only if there is no logically possible world in which Q is false while all the premises in KB are true. Or, stated positively, Q is entailed by KB if and only if the conclusion is true in every logically possible world in which all the premises in KB are true.

derivation Derivation: KB |- Q We can derive Q from KB if there is a proof consisting of a sequence of valid inference steps starting from the premises in KB and resulting in Q

Two important properties for inference 1. Soundness 2. Completeness

Soundness: If KB |- Q then KB |= Q If Q is derived from a set of sentences KB using a given set of rules of inference, then Q is entailed by KB. Hence, inference produces only real entailments, or any sentence that follows deductively from the premises is valid.

Completeness: If KB |= Q then KB |- Q If Q is entailed by a set of sentences KB, then Q can be derived from KB using the rules of inference. Hence, inference produces all entailments, or all valid sentences can be proved from the premises.

Logics Logics are formal languages for representing information such that conclusions can be drawn Syntax: defines the sentences in the language Semantics: define the “meaning” of sentences: i.e., define true of a sentence in a world Example: arithmetic

Worlds in Propositional Logic Assignment of a truth value – true or false – to every atomic sentence Examples: Let A, B, C, and D be the propositional symbols is m = {A=true, B=false, C=false, D=true} a world? is m’ = {A=true, B=false, C=false} a world? How many worlds can be defined over n propositional symbols?

Models A world is a possible truth assignment to the propositional symbols. Given a world m, we say m is a model of a sentence  if  is true in m M() is the set of all models of  Then KB  if and only if M(KB)  M() M() M(KB)

Inference KB |-i  : sentence  can be derived from KB by procedure i Soundness: i is sound if whenever KB |-i  it is also true that KB  Completeness: i is complete if whenever KB  it is also true that KB |-i 

Examples of Logics Propositional calculus A  B  C First-order predicate calculus ( x)( y) Mother(y,x) Logic of Belief B(John,Father(Zeus,Cronus))

Semantics of PL It specifies how to determine the truth value of any sentence in a world m The truth value of True is True The truth value of False is False The truth value of each atomic sentence is given by m The truth value of every other sentence is obtained recursively by using truth tables

Truth Tables A B  A A  B A  B A  B True False

Satisfiability of a KB A KB is satisfiable iff it admits at least one model; otherwise it is unsatisfiable KB1 = {P, QR} is satisfiable KB2 = {PP} is satisifiable KB3 = {P, P} is unsatisfiable valid sentence or tautology

Proof Methods Applications of inference rules Model checking Legitimate (sound) generation of new sentences from old Proof = a sequence of inference rule applications Model checking Truth table enumeration (exponential in n) Improved backtracking Heuristic search in model space (sound but incomplete) e.g. min-conflicts like hill-climbing algorithms

Inference Rule: Modus Ponens {  ,  }  

Example: Modus Ponens {  ,  }   {  ,  }   Battery-OK  Bulbs-OK  Headlights-Work Battery-OK  Starter-OK  Empty-Gas-Tank  Engine-Starts Engine-Starts  Flat-Tire  Car-OK Battery-OK  Bulbs-OK

Example: Modus Ponens {  ,  }   {  ,  }   Battery-OK  Bulbs-OK  Headlights-Work Battery-OK  Starter-OK  Empty-Gas-Tank  Engine-Starts Engine-Starts  Flat-Tire  Car-OK Battery-OK  Bulbs-OK

Example: Modus Ponens {  ,  }   {  ,  }   Battery-OK  Bulbs-OK  Headlights-Work Battery-OK  Starter-OK  Empty-Gas-Tank  Engine-Starts Engine-Starts  Flat-Tire  Car-OK Battery-OK  Bulbs-OK

Example: Modus Ponens {  ,  }   {  ,  }   Battery-OK  Bulbs-OK  Headlights-Work Battery-OK  Starter-OK  Empty-Gas-Tank  Engine-Starts Engine-Starts  Flat-Tire  Car-OK Battery-OK  Bulbs-OK Headlights-Work

Review: 2 Important Properties #1: If KB |- Q then KB |= Q If Q is derived from a set of sentences KB using a given set of rules of inference, then Q is entailed by KB. Hence, inference produces only real entailments, or any sentence that follows deductively from the premises is valid. #2: If KB |= Q then KB |- Q If Q is entailed by a set of sentences KB, then Q can be derived from KB using the rules of inference. Hence, inference produces all entailments, or all valid sentences can be proved from the premises. Soundness Completeness

Summary Basic concepts of logic: Syntax: formal structure of sentences Semantics: truth of sentences wrt worlds Entailment: necessary truth of one sentence given another Inference: deriving sentences from other sentences Soundness: derivations produce only entailed sentences Completeness: derivations can produce all entailed sentences