AI Principles, Semester 2, Week 3, Lecture 6 Inference Rules For
Total Page:16
File Type:pdf, Size:1020Kb
AI Principles, Semester 2, Week 3, Lecture 6 Inference rules for Propositional Logic Inference rules, validity and tautologies in Truth Tables Lots of example proofs Equivalences in Propositional Logic Limitations of Propositional Logic First Order Predicate Logic Predicates and quantification Equivalences in Predicate Logic English to Predicate Logic 1 Review of logic from last lecture Propositional logic Logical connectives Rules for wffs Formally representing English sentences Truth tables for the connectives Using Truth Tables to evaluate expressions Tautologies Entailment Soundness and completeness of inference rules 2 Inference rules should be sound, and even better complete We saw from last lecture that we want our inference rules to always produce entailed sentences This means that all inference rules should always be sound If an inference system can produce all entailed sentences then we say it is complete 3 Inference rules can be used manually or automated Doing manual inference you are free to use a large number of different inference rules Automated reasoning can be done by the automated computation of Truth Tables or by using inference rules. However, the automated use of inference rules has to be done differently to how humans use inference rules Automated reasoning and other forms of logic next lecture 4 Modus Ponens (MP) A →B A therefore B Conjunction Introduction (∧ I) A B therefore A ∧ B Conjunction Elimination (∧ E) A ∧ BA ∧ B therefore A and therefore B 5 Double Negation (DN) ¬¬P therefore P Disjunction Introduction (∨ I) AB therefore A ∨ B and therefore A ∨ B Disjunction Elimination (∨ E) A → C B → C A ∨ B therefore C 6 Valid Inferences and tautologies P →Q P therefore Q can be seen to be a valid inference because the conditional statement ((P →Q) ∧ P) →Q is a tautology 1 2 3 4 5 P Q (P→Q) (P→Q)∧ P ((P→Q) ∧ P) →Q) T T T T T T F F F T F T T F T F F T F T 7 Example proof 1 Given: 1 A → B 2 B→ C 3 A prove: C 8 Example proof 1 part 2 Given: 1 A → B 2 B → C 3 A 4 B (Modus Ponens on 1 and 3) 9 Example proof 1 part 3 Given: 1 A → B 2 B → C 3 A 4 B (Modus Ponens on 1 and 3) 5 C (Modus Ponens on 2 and 4) 10 Example proof 2 Prove C Given: 1 (A ∧ D) → B 2 A 3 D 4 B → C 11 Example proof 2 part 2 Prove C Given: 1 (A ∧ D) → B 2 A 3 D 4 B → C 5 (A ∧ D) ( ∧ I on 2 and 3) 12 Example proof 2 part 3 Prove C Given: 1 (A ∧ D) → B 2 A 3 D 4 B → C 5 (A ∧ D) ( ∧ I on 2 and 3) 6 B (MP on 1 and 5) 13 Example proof 2 part 4 Prove C Given: 1 (A ∧ D) → B 2 A 3 D 4 B → C 5 (A ∧ D) ( ∧ I on 2 and 3) 6 B (MP on 1 and 5) 7 C (MP on 4 and 6) 14 Example proof 3 Prove M Given: 1 M ∧ N 15 Example proof 4 Prove J Given: 1 ¬¬K 2 L 3 (K ∧ L) → M 4 M → J 16 Example proof 5 Prove G Given: 1 E → G 2 F → G 3 E ∨ F 17 Example proof 6 Prove G Given: 1 (E → G) ∧ (F → G) ∧ (E ∨ F) 18 Equivalences in Propositional Logic ¬¬ A ≡ A ¬(A ∨B)≡¬ A∧¬B ¬(A ∧B)≡¬ A∨¬B De Morgan’s Laws pages 24, 25, 26 in Callan, many more equivalences that you should learn 19 Limitations of Propositional Logic Formalise the following English sentences: Al is small Ted is small Someone is small Everyone is small No-one is not small Propositional Logic would represent each of these as a different Proposition, so the five propositions might be represented by P.Q, R, S and T What this representation is missing is the similarity between the propositions, they are all concerned with the relation ’small’ Predicate logic allows relations and quantification (which allows the representation of English descriptors like someone, everyone and no- one) 20 First Order Predicate Logic (FOPL) Sentence letters, connectives and parentheses are adopted from Propositional Logic In addition, FOPL allows predicate symbols to be used to represent claims about objects and relations between objects. smaller(Birmingham, London) Birmingham is smaller than London ¬country(Birmingham) Birmingham is not a country man(Charlton Heston) Charlton Heston is a man In general: predicate-name(a1, a2, ...) (The number of arguments in this atomic sentence (that is the number of an, terms) is the arity of the predicate) 21 Examples of predicates without quantifiers Formalise the following in FOPL: Kipper is not small Jo and Flo share a room Bob, Rob, Sam, Pam and Tom are in the same team Birmingham is west of London and Bristol is west of Birmingham 22 Quantifiers There are two kinds of quantification in FOPL The universal quantifier stands for all or everything and is represented by the symbol ∀ The existential quantifier stands for there exists or at least one and is represented by the symbol ∃ 23 Quantifiers, variables and constants Every student likes logic ∀ X.(student(X)→likes(X, logic) Every loyal subject likes Elizabeth Windsor ∀ X.(loyal-subject(X)→likes(X, Elizabeth-Windsor) 24 wffs An important aspect of forming wffs in Predicate Logic is using the correct arity for predicates the predicate large might have arity = 1, whereas the predicate bigger-than might have arity two large(elephant) bigger-than(elephant, mouse) more details in page 39 and 40 in Callan 25 Functions Certain kinds of relationships are best considered as functions. This occurs when a given object, (such as a human body or a car or some other artifact), must be related to exactly one other object, (such as, respectively, a leg (of the body), or a wheel (of the car) or some other part of the artifact in question) Russel and Norvig 245, 246 No questions on functions in class test 26 Scoping Scoping of variables is important when variables are replaced with other variables or terms. Only free occurences of variables can be replaced In the expresssions ∀ X.Φ and ∃ X.Φ the expression Φ is said to be the scope of the quantifier more details in page 40 and 41 in Callan 27 English to Predicate Logic Translate the following sentences into Predicate Logic: All students are human Some students are aliens No students are children 28 English to Predicate Logic Translate the following sentences into Predicate Logic: All students are human ∀ x(Sx → Hx) Some students are aliens ∃ x(Sx ∧ Ax) No students are children ∀ x(Sx → ¬ Cx) ¬∃ x(Sx ∧ Cx) 29 English to Predicate Logic Translate the following sentences into Predicate Logic: Children behave badly if not supervised Children behave badly only if not supervised No children behave badly if supervised 30 English to Predicate Logic Translate the following sentences into Predicate Logic: Children behave badly if not supervised ∀ x(Cx → (¬ Sx → Bx)) Children behave badly only if not supervised ∀ x(Cx → ( Bx → ¬ Sx)) No children behave badly if supervised ¬∃ x(Cx ∧ Bx ∧ Sx) 31 Equivalences in Predicate Logic De Morgan’s Rules ∀x¬P ≡ ¬∃xP ¬∀xP ≡ ∃x¬P ∀xP ≡ ¬∃x¬P ∃xP ≡ ¬∀x¬P page 38 Callan 32 Conclusion Inference rules for Propositional Logic Inference rules, validity and tautologies in Truth Tables Lots of example proofs Equivalences in Propositional Logic Limitations of Propositional Logic First Order Predicate Logic Predicates and quantification Equivalences in Predicate Logic English to Predicate Logic 33.