4c7fe682637be985e5c7c455873b1fa1.ppt
- Количество слайдов: 60
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”) p = The sky is blue. p = It is not the case that the sky is blue. p = The sky is not blue. Table 1. The Truth Table for the Negation of a Proposition p ¬p T F F T
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 Table 3. The Truth Table for the Disjunction of two propositions p q p q T T T T F F F 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.
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 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 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”
Practice p: You learn the simple things well. q: The difficult things become easy. • You do not learn the simple things well. p • If you learn the simple things well then the difficult things become easy. p q • If you do not learn the simple things well, then the difficult things will not become easy. p q • The difficult things become easy but you did not learn the simple things well. p q • You learn the simple things well but the difficult things did not become easy. 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 T F F q F T F r F F T s F T T F F Fred, Maggie, Janice r p T F T • 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. s q ( r p) ( s q) F F T T T F F F
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 T F F q F T F r F F T s F T T F F r p T F T • 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. s q T T F T T ( r p) (s q) T F F F T Fred, Janice, Maggie or Janice, Maggie, Fred or Janice, Fred, Maggie
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: De. Morgans • Prove that (p q) ( p q) p q (p q) p q ( p q) T T T F F T F F T F T F F F 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 F F T T T T F F F T T T F T T T T T F F F T F F F F T F F F T F F F F F
Prove: p q (p q) (q p) pq TT TF FT FF p q q p T T T F F T F T T T (p q) (q p) T F 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 p T p p F (p q) ( p q) Miscellaneous Or Tautology And Contradiction 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 • 1. 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 And Or If then if and only if Negation Conjunction Disjunction Implication Equivalence ( )
Construction of Complex Propositions • Let X and Y represent arbitrary propositions. Then ( X), (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 theorem (also called goal or query) that we want to prove.
A complex example 1. If my glasses are on the kitchen table, then I saw them at breakfast. 2. I was reading the newspaper in the living room or I was reading the newspaper in the kitchen. 3. If I was reading the newspaper in the living room, then my glasses are on the coffee table. 4. I did not see my glasses at breakfast. 5. If I was reading my book in bed, then my glasses are on the bed table. 6. 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 “It is hot” Modus Ponens(1, 2) 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 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(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 True B True A False A B True False False True False True
Satisfiability of a KB A KB is satisfiable iff it admits at least one model; otherwise it is unsatisfiable KB 1 = {P, Q R} is satisfiable KB 2 = { P P} is satisifiable KB 3 = {P, P} is unsatisfiable valid sentence or tautology
Proof Methods • Applications of inference rules – 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 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 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 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 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.
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