Problem Set: from Propositional Calculus to Prolog
Total Page:16
File Type:pdf, Size:1020Kb
Problem Set: From Propositional Calculus to Prolog 1. People a. Jacques Herbrand was french mathematician who passed away at the age of 23, but still had a lasting impact on the field of symbolic logic. Before his passing Herbrand created a theorem that linked quantification theory and sentinel logic for his senior thesis. This has had a lasting effect on logic and mathematics because it allowed for the testing of formulas for sentinel validity. That concept had a large impact on propositional logic and predicate logic. b. Alfred Horn was an American mathematician who developed Horn clauses which later had a large role in the creation of logic programming. Horn spent most of his career studying lattice theory which involved working with algebraic structures that are similar to predicate calculus. Without Horn and his Horn clauses logic programming would cease to exist and symbolic logic as a whole would have suffered. c. John Alan Robinson was an English philosopher, mathematician, and computer scientist who worked for Syracuse University. Robinson, like Horn, played a large role in the foundation of logic programming and developed an automated theorem prover. He also was the editor and founder of the Journal of Logic Programming. Without Robinson, prolog would cease to exist and the field of logic programming would have suffered greatly. 2. Playful reminder that PC is a KR a. If she is sick, then she needs a doctor and if she has an accident, then she needs a lawyer. b. If she needs a doctor, then she is sick or she is injured. c. If she needs a doctor and she needs a lawyer, then she has an accident. d. She needs a doctor and she needs a lawyer, if and only if she is sick and she is injured. e. If she is not injured and she is not sick, then she does not need a doctor. 3. Reviewing definitional foundations a. An interpretation for a WFF is an assignment of a truth value to the WFF’s atoms. b. 16 interpretations. 2^4 = 16. c. If an interpretation satisfies an atom it means that the formula is true under the interpretation of the atom. d. PQR = TFT satisfies the formula ((P V Q) Λ R ). e. If an interpretation falsifies an atom it means that the formula is false under the interpretation of the atom. f. PQR = FFT falsifies the formula ((P V Q) Λ R ). g. A WFF is valid if and only if it is true under all interpretations. h. Atoms: PQR; Formula: (((P → Q) Λ R) → Q). PQR = TTT:(((T → T) Λ T) → T))=>((T Λ T) → T))=>(T → T)=> T PQR = TTF:(((T → T) Λ F) → T))=>((T Λ F) → T))=>(F → T)=> T PQR = TFT:(((T → F) Λ T) → F))=>((F Λ T) → F))=>(F → F)=> T PQR = TFF:(((T → F) Λ F) → F))=>((F Λ F) → F))=>(F → F)=> T PQR = FTT:(((F → T) Λ T) → T))=>((T Λ T) → T))=>(T → T)=> T PQR = FFT:(((F → F) Λ T) → F))=>((F Λ T) → F))=>(F → F)=> T PQR = FTF:(((F → T) Λ F) → T))=>((T Λ F) → F))=>(F → F)=> T PQR = FFF:(((F → F) Λ F) → F))=>((F Λ F) → F))=>(F → F)=> T i. If a WFF is inconsistent if and only if it is false under all of its interpretations. j. Atoms: P; Formula: (P Λ ~ P) P = T: (T Λ ~T)=>(T Λ F)=> F P = F: (F Λ ~F)=>(F Λ T)=> F Formula:(P Λ ~ P) is a refutation of P. 4. Normal Form Transformations a. Disjunctive normal form is when a formula F is said to have the form F1 V F2 V … V Fn where each Fi is a conjunction of literals. i. ((~P Λ Q) → R) =>~(~P Λ Q) V R (switcheroo) =>(~~P V ~Q) V R (DeMorgans) =>(P Λ ~Q) V R (double negation) ii. ~(P V ~Q) Λ (S → T) =>~(~(P V ~Q) Λ (S V T))(switcheroo) =>(~~P Λ ~Q) V (~S Λ ~T) (Demorgan's) =>(P Λ ~Q) V (~S Λ ~T) (double negation) iii. (P → Q) → R =>~(P V R) V R (switcheroo) =>(~P Λ ~R) V R(Demorgan’s) b. Conjunctive normal form is when a formula F is said to have the form F1 Λ F2 Λ … Λ Fn where each Fi is a disjunction of literals. i. P V (~P Λ Q Λ R) => (P V ~P) Λ (P V Q) Λ (P V R)(Distributive Law) ii. ~(P → Q) => ~(~P V Q) (switcheroo) => ~~P Λ ~Q (Demorgan’s) => P Λ Q (double negation) iii. (P → Q) → R => ~(~P V Q) V R (switcheroo) => ~~P Λ ~Q V R (Demorgan’s) => (P Λ ~Q) V R (double negation) => (P V R) Λ (~Q V R) (Distributive Law) 5. Models, Knowledge Representations and the Predicate Calculus a. The predicate calculus models logic using predicates and different mathematical rules. It can recognize different mathematical principles and relationships between things. In theory it can be used to generate truth values and truth tables. b. A model is a way of representing a process using rules and constraints. A knowledge representation is a set of conventions for describing knowledge and in this case it is logic. I would say all models are knowledge representations because models are a way of expressing knowledge and processing knowledge using rules. 6. State the resolution principle - For any two clauses C1 and C2, if there is a literal L1 in C1 that is complementary to a literal L2 in C2, then delete L1 and L2 from C1 and C2, respectively, and construct the disjunction of the remaining clauses. The constructed clause is a resovent of C1 and C2. 7. Define what is meant by Resolution Deduction - Given a set S of clauses, a resolution deduction of clause C from S is a finite sequence C1, C2, ..., Ck of clauses such that each Ci is either a clause in S or a resolvent of clauses preceding Ci and Ck = C. We say that a clause C is derived from S if there is a deduction from S to C. 8. Resolution 1. Translate to Casual Form a. ~P V S b. ~S V U c. P 2. Add the negation of the to set of the clauses S+ = a. ~P V S b. ~S V U c. P d. ~U 3. Refute a. ~P V S element of S+ b. ~S V U element of S+ c. ~P V U resolution of a and b d. P element of S+ e. U resolution of c and d f. ~U element of S+ g. ▢ resolution of (e) and (f) 9. Tree 10. WAY 1 P S U P → S S → U P U T T T T T T F T T F T F T T T F T F T T F T F F F T T T F T T T T F F F T F T F F T F F T T T F F F F F T T F T 11. A Horn Clause is a disjunction of literals with at most one positive literal. 12. Can the formula ( P V Q V R) → S be converted to a Horn clause? Yes. ~P V ~Q V ~ R V S where S is the positive. 13. Not a Horn Clause: [P,Q,R] 14. Write down a Horn clause involving P, Q, R, S and T. P V ~Q V ~R V ~S V ~T. 15. Argue that the following Prolog statement is a Horn clause: a :- b, c, d. It is a horn clause because the positive literal is a in ~b V ~c V ~d V a. 16. Prolog is essentially a Horn clause problem solver. (a)true (b)false 17. Prolog performs a computation by (1) converting its rules to Horn clauses, (2) negating a given goal, and (3) endeavoring to derive the empty clause by means of resolution. If variables are involved, they must be instantiated in order to obtain complementary literals. (a) true (b) false 18. Consider the following Prolog program: p :- q,t. p :- r,s. q :- r. r. t. S. a. Convert to Horn Clause i. p V ~q V ~t ii. p V ~r V ~s iii. q V ~r V ~s iv. r v. t vi. s b. Draw c. Draw 19. Draw 20. Big Picture Prolog - “Another major AI area that Prolog contributes is that of Natural Language Processing. Pattern matching capabilities and the declarative nature of grammar definitions, make Prolog a handy and powerful tool for processing natural language. For example, CAT2 (Sharp, 1991) is a unification-based natural language processing system, designed for analysis, generation and translation of natural language sentences. CAT2 is used for multilingual machine translation and for automatic translation of informative texts although the emphasis has been on European Commission texts, as well as general purpose texts. It embodies a particular formalism for natural language processing, as well as a grammar development environment. Grammars have been written for English, German, French, Spanish, with experimental versions for Russian, Greek, and Japanese.” -Lifted from http://what-when-how.com/information-science-and-technology /using-prolog-for-developing-real-world-artificial-intellig ence-applications-information-science/ Works Cited Gutenberg, P. (n.d.). John Alan Robinson. John Alan Robinson Project Gutenberg Self-Publishing - eBooks | Read eBooks online. http://www.self.gutenberg.org/articles/eng/John_Alan_Robins on. Jacques Herbrand - Biography. Maths History. (n.d.). https://mathshistory.st-andrews.ac.uk/Biographies/Herbrand. Wikimedia Foundation. (2021, April 15). Alfred Horn.