* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Certamen 1 de Representación del Conocimiento
Quantum logic wikipedia , lookup
Modal logic wikipedia , lookup
Mathematical logic wikipedia , lookup
Laws of Form wikipedia , lookup
Truth-bearer wikipedia , lookup
Boolean satisfiability problem wikipedia , lookup
First-order logic wikipedia , lookup
Curry–Howard correspondence wikipedia , lookup
Propositional formula wikipedia , lookup
Intuitionistic logic wikipedia , lookup
Law of thought wikipedia , lookup
Sequent calculus wikipedia , lookup
Certamen 1 de Representación del Conocimiento Segundo Semestre 2012 Question: 1 2 3 4 5 6 7 8 9 Total Points: 2 2 1 1/ 2 1/ 2 3 11/2 1 1/ 2 12 Here we show one way to solve each question, but there might be other ways to solve them. Propositional Logic 1. [2 ptos] Use structural induction to prove that a propositional formula has the same number of left parenthesis as right parenthesis. TIP: The syntax of propositional formulas is given in the appendix of this test. Solution: Let LP (ϕ) and RP (ϕ) denote the number of left and right parenthesis of ϕ Base case: for proposition p we have LP (p) = RP (p) = 0. Inductive cases: assume we have formulas φ1 and φ2 such that LP (φ1 ) = RP (φ1 ) = c1 and LP (φ2 ) = RP (φ2 ) = c2 : 1. Given a formula φ such that LP (φ) = RP (φ), prove that for ϕ = ¬φ, it holds LP (ϕ) = RP (ϕ). Proof: LP (ϕ) = LP (¬φ) = LP (φ) = RP (φ) = RP (¬ϕ) = RP (ϕ) 2. Given formulas φ1 and φ2 such that LP (φ1 ) = RP (φ1 ) and LP (φ2 ) = RP (φ2 ), prove that for ϕ = (φ1 ⊗φ2 ) where ∈ {∧, ∨, →, ↔}, it holds LP (ϕ) = RP (ϕ). Proof: LP (ϕ) = LP ((φ1 ⊗φ2 )) = 1+LP (φ1 )+LP (φ2 ) = 1+RP (φ1 )+RP (φ2 ) = RP ((φ1 ⊗ φ2 )) = rP (ϕ) 2. Consider Σ = {¬((¬p ∧ ¬q) ∨ (r → p)), ¬q}. (a) [1 pto] Prove in precise semantic1 terms that Σ |= r. Solution: The following table shows that Σ is inconsistent and therefore r is a logical consequence. 1 Using truth tables 1 Certamen 12 de Octubre, 2012 p 1 0 1 1 1 0 0 0 q 1 1 1 0 0 1 0 0 r 1 1 0 1 0 0 1 0 t1 = (¬p ∧ ¬q) 0 0 0 0 0 0 1 1 t2 = (r → p) 1 0 1 1 1 1 0 1 t1 ∨ t2 1 0 1 1 1 1 1 1 ¬(t1 ∨ t2 ) 0 1 0 0 0 0 0 0 Σ 0 0 0 0 0 0 0 0 (b) [1 pto] Prove by resolution that Σ |= (r ∨ s). Solution: We will prove that Σ ∪ {¬(r ∨ s)} is inconsistent. To apply resolution we need to put the formulas in CNF: ¬((¬p ∧ ¬q) ∨ (r → p)) ∧ ¬q ∧ (¬r ∧ ¬s) = (¬(¬p ∧ ¬q) ∧ ¬(¬r ∨ p)) ∧ ¬q ∧ ¬r ∧ ¬s = ((p ∨ q) ∧ (r ∧ ¬p)) ∧ ¬q ∧ ¬r ∧ ¬s = (p ∨ q) ∧ r ∧ ¬p ∧ ¬q ∧ ¬r ∧ ¬s Though, we need to apply resolution with the following clauses {p ∨ q, r, ¬p, ¬q, ¬r, ¬s}. By resolution between the first and third clause we get q. By applying resolution with the fourth clause we get an inconsistency. 3. Prove using the set of natural deduction rules that: (a) [1/2 pto] {(p ∧ q) → r, q → p, q} |= r Solution: 1. (p ∧ q) → r 2. q → p 3. q 4. p (result of applying rule (F) to 2 and 3) 5. p ∧ q (result of applying rule (A) to 3 and 4) 6. r (result of applying rule (F) to 1 and 5) (b) [1/2 pto] {p} |= (q → p) Solution: 1. p 2. Assume q a) p (true from 1) Página 2 de 7 Pase a la siguiente página. . . Certamen 12 de Octubre, 2012 3. q → p (result of applying rule (M) to 2) In your proofs you should say which deductive rules you are using. TIP: use the natural deduction rules in the appendix with the given names. 4. [1/2 pto] Prove that {(p ∨ ¬(q ∧ r)) → (s ∨ u), ¬r} 6|= u Solution: For an assignment that makes s true and the rest of the variables false (in particular r), makes {(p ∨ ¬(q ∧ r)) → (s ∨ u), ¬r} true but u is false. Thus, u is not a logical consequence. 5. [1/2 pto] Provide a short proof showing that for an inconsistent knowledge base Σ in propositional logic, every formula ϕ is a logical consequence of Σ. Solution: A formula ϕ is a logical consequence of a knowledge base Σ if every model that satisfies Σ it holds also that ϕ is true. In the case in which Σ is inconsistent, it has no model and therefore the requirement is trivially true for any formula ϕ. First Order Logic 6. Tony, Shi-Kuo and Ellen belong to the Hoofers Club. Every member of the Hoofers Club is either a skier or a mountain climber or both. No mountain climber likes rain, and all skiers like snow. Ellen dislikes whatever Tony likes and likes whatever Tony dislikes. Tony likes rain and snow. Prove via the resolution method and unification (where needed) that “Ellen is a mountain climber but not a skier”. More precisely: (a) [1 pto] Translate the sentences above into FOL Sentences. Solution: We can transform the knowledge base into the following rules (it is not the only solution): Tony, Shi-Kuo and Ellen belong to the Hoofers Club. HClub(T ony) HClub(ShiKuo) HClub(Ellen) Every member of the Hoofers Club is either a skier or a mountain climber or both. ∀x(HClub(x) → (Skier(x) ∨ Climber(x))) Página 3 de 7 Pase a la siguiente página. . . Certamen 12 de Octubre, 2012 No mountain climber likes rain, and all skiers like snow. ∀x(Climber(x) → ¬Like(x, Rain)) ∀x(Skier(x) → Like(x, Snow)) Ellen dislikes whatever Tony likes and likes whatever Tony dislikes. ∀xy(Likes(T ony, y) ↔ ¬Like(Ellen, y)) Tony likes rain and snow. Likes(T ony, Rain) Likes(T ony, Snow) Ellen is a mountain climber but not a skier (our goal) Climber(Ellen) ∧ ¬Skier(Ellen) (b) [1 pto] Convert to Clause Forms. Solution: The sentences are already in prenex normal form and there is no need to skolemize so they can be translate into the following clauses: 1. HClub(T ony) 2. HClub(ShiKuo) 3. HClub(Ellen) 4. ¬HClub(x) ∨ Skier(x) ∨ Climber(x) 5. ¬Skier(x) ∨ Like(x, Snow) 6. ¬Climber(x) ∨ ¬Like(x, Rain) 7. ¬Likes(T ony, y) ∨ ¬Like(Ellen, y) 8. Likes(T ony, Rain) 9. Likes(T ony, Snow) (c) [1 pto] Prove, using resolution, the goal sentence: “Ellen is a mountain climber but not a skier.” Solution: To prove it we will find a contradiction between the knowledge base and the negation of our goal. 10. ¬Climber(Ellen) ∨ Skier(Ellen) The inconsistency can be achieved by doing the following: 11. ¬HClub(Ellen) ∨ Skier(Ellen) (resolution between 4 + 10) 12. Skier(Ellen) (resolution between 11 + 3) 13. Like(Ellen, Snow) (resolution between 12 + 5) 14. ¬Like(T ony, Snow) (resolution between 13 + 7) 15. @ (resolution between 14 + 9) 7. Given a knowledge base Σ = {∀x(P (A, x) → ∃yR(x, y)), P (A, B)} 2 2 Note that A and B are constants Página 4 de 7 Pase a la siguiente página. . . Certamen 12 de Octubre, 2012 (a) [1/2 pto] Define a FOL signature S = {Ω, Π} for which formulas in Σ are well-formed. Solution: Ω = {A/0, B/0} and Π = {R/2, P/2} (b) [1/2 pto] Show that Σ is valid (provide an interpretation for S). Solution: Consider the interpretation I = (U, AI , B I , RI , P I ) where U = {A, B}, AI = A, B I = B, RI = {(B, B)} and P I = {(A, B)}. This interpretation is a model of Σ and therefore it is valid. (c) [1/2 pto] Is R(A, B) a logical consequence of Σ? Prove your answer. Solution: It is not. To prove it, it suffices to show a model of Σ for which R(A, B) is false. The model given in the previous question is such a model. First-Order Logic Programming 8. [1 pto] Consider the logic program P (x) ← R(x), not Q(x). Q(x) ← S(x). P (x) ← S(x). Q(a). S(a). R(b). Find all the answers to query P (x)? Show the resolution tree with the unifiers that are used. Solution: To simplify the presentation we will present the different branches of the tree. 1. Branch 1: ← P (x) ← R(x), not Q(x) ← not Q(b) (unifier b/x) We try to prove ← Q(b): ← S(b) Q(b) is false, therefore not Q(b) is true. Thus b is an answer to the query. 2. Branch 2: ← P (x) ← S(x) ← (unified for a/x) Thus a is an answer to the query. Página 5 de 7 Pase a la siguiente página. . . Certamen 12 de Octubre, 2012 9. [1/2 pto] Show by means of an example that first-order logic programming with negation as failure is non-monotonic. Solution: A logic is non-monotonic if an answer that was obtained from a knowledge base continues to be true after adding more knowledge. In the case of FOLprogramming this is not the case as the following example shows. Consider a logic program with a single fact: P (a). The answer to the query ← P (x), notQ(x) is x = a. But now, if we add Q(a) to the knowledge base we get that the query has no answers. Página 6 de 7 Pase a la siguiente página. . . Certamen 12 de Octubre, 2012 Appendix Syntaxis of Propositional Formulas ϕ ::= p|¬ϕ|(ϕ ∧ ϕ)|(ϕ ∨ ϕ)|(ϕ → ϕ)|(ϕ ↔ ϕ) Natural Deduction Rules • Non-hypothetical rules (with no assumptions) ϕ, ψ (A) ϕ ∧ ψ ϕ (D) ϕ ∨ ψ ϕ∧ψ (B) ϕ ψ (E) ϕ ∨ ψ ϕ∧ψ (C) ψ ϕ, ϕ → ψ (F) ψ (G) ϕ, ¬ϕ φ (H) ¬¬ϕ ϕ ϕ↔ψ (J) φ → ϕ ϕ → φ, φ → ϕ ϕ↔φ (K) ϕ↔ψ (I) ϕ → φ • Hypothetical rules (that require assumption) ϕ ∨ ψ, ϕ ` φ, ψ ` φ (L) φ ψ`ϕ (M) ψ → ϕ Página 7 de 7 ψ ` F alse (N) ¬ψ Fin del certamen.