1 / 32

A brief review of Logic

A brief review of Logic. CS4320/CS5314 Artificial Intelligence References: Logic for applications, A. Nerode, A. Shore, Springer-Verlag ed. Artificial Intelligence, a modern approach, Russel, Norvig, Prentice Hall ed. Applications of Logic. Programming paradigms Verifications of programs

meena
Download Presentation

A brief review of Logic

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A brief review of Logic CS4320/CS5314 Artificial Intelligence References: Logic for applications, A. Nerode, A. Shore, Springer-Verlag ed. Artificial Intelligence, a modern approach, Russel, Norvig, Prentice Hall ed.

  2. Applications of Logic • Programming paradigms • Verifications of programs • Interactive, concurrent, distributed, fault tolerant and real time computing • Knowledge-based systems • Deductive databases • Etc…

  3. Knowledge-based systems • Core of a KB system  Knowledge base (facts about our world) • Formal language to express knowledge and a way to reason about facts  a logic. • Formal language  knowledge representation language • Deriving new facts  inference mechanism

  4. Propositional logic • Definition: propositions are statements that assume either a true value of false value (boolean expressions) • Definition: the way statements are combined forms the syntax of logic • Definition: the way we interpret statements forms the semantics of logic

  5. The language • Connectives: ,,,,, • Parentheses: (,) • Propositional letters: A,A1,A2,…B,B1… Definition: the language is defined inductively by • Propositional letters are propositions • If x,y are propositions so are (xy),(xy), (xy),(xy), (x) • Nothing else is a proposition Exercise: show that the above language is a context-free language

  6. DNF and CNF • Definition: a propositional formula is in disjunctive normal form if it is of the form: x1…xn where xi is a proposition containing only the connectors  and . • Definition: a conjunctive normal form is defined similarly. • Property: any proposition can be written in CNF or DNF Exercise: find DNF for (AB)C and (AB)(C)

  7. Truth assignments and valuations • Semantics for propositional logic: assigning truth values to propositions • Definition: a truth assignment A is a function which assigns to each propositional letter A a unique truth value A(A) {T,F} • Definition: a truth valuation V is a function which assign to each proposition x a unique truth value V(x) in accordance with truth tables

  8. Tautologies and Validitity • Definition: a proposition x is said to be valid if for any valuation V, V(x)=T. The proposition is called a tautology. • Definition: two propositions x,y such that for any valuation V, V(x)=V(y) are called logically equivalent (written xy) Exercise: show that ((pq)p)q and (q(pq))p are tautologies

  9. Consequences • Definition: let  be a set of propositions. Then x is a consequence of  if for any valuation V, we have V(y)=T for all y in  implies V(x)=T • We will write ⊧x. • It reads  entails x. • Example:{p,pq} ⊧ ? Exercise: when do we have ⊧x if  is an empty set? (in this case we will write ⊧x ) This notion gives a semantic notion of consequence Remark: generation of new facts in a KB

  10. Models • Definition: a valuation V is a model of  if V(x)=T for every x in . M() denotes the set of all models of .

  11. Formal reasoning 1 • Inference rule premises, hypotheses ⊧ consequence In propositional logic: • Modus ponens AB,A ⊧ B or A,AB ⊧ B • Modus tollens AB, B ⊧ A • Conjunction A,B ⊧ AB

  12. Formal Reasoning 2 • Simplification AB ⊧ A • Addition (disjunction) A ⊧ AB • Disjunctive syllogism AB, A ⊧ B • Hypothetical syllogism AB,BC ⊧ AC

  13. An other set of inference rules for PL • Modus ponens • Simplification (and-elimination) • Addition (or-introduction) • Double negation elimination • Unit resolution AB, B ⊧ A • Resolution AB, BC ⊧ AC

  14. Formal reasoning system • Definition: a formal reasoning system (or a formal theory) is a 1. set of wffs 2. set of axioms 3. set of inference rules Example: euclidean geometry

  15. Proof • How do we describe reasoning? Proof? Theorem? • Definition: a proof is a finite sequence of wffs where each wff is either an axiom or can be derived from previous wffs in the sequence using inference rules Example:w1,…,wn is a proof. What are w1 and wn?

  16. Consistency vs. Completeness • Definition: a formal theory is consistent if you cannot prove both w and w. • We hope our formal theories to be consistent. • Definition: a formal theory is complete if you can always prove either w or w • We hope our formal theories to be also complete. • However, it is not always possible.

  17. Conditional proof • Assume you have A1A2…AnB • Each Ai is written vertically with a P (premise) • Use the rules seen previously to derive B Exercise: show (AB)(AC)ABC

  18. Indirect proof • Assume we want to prove AB • We do not know where to start, so we use AB  BA • Still can’t do it? Use AB  BAfalse (proof by contradiction) Example: (AB)(AC)(BD)DC. Write each premise with P, then the negated conclusion with P for IP and show false

  19. Exercises Show that (AB)(AB)B using equivalences only Show that (ABC)A(CB) is not a tautology Give a formal proof using CP of (ABC)AC

  20. Predicate calculus • Wffs as defined so far are too restrictive • A wff represents a sentence as a whole and “hides” some information • Syllogisms with quantifiers cannot be conveniently represented with propositional logic (at least we cannot verify if inference is correct) • Predicate calculus aims at solving this problem

  21. Syntax of predicate calculus • Variables: x,y,z,… • Constants: a,b,c,… • Functions: f,g,h,… • Predicates: p,q,r,… • Connective symbols: ,,,, • Quantifier:  • Punctuation: (,)

  22. Terms and Atoms • Definition: a term is either a variable, a constant or a function applied to arguments that are terms ex: a,x, f(x), g(x,h(b)) are terms • Definition: an atomic formula (or atom) is a predicate applied to arguments that are terms ex: p(x), q(f(x),g(y)) • In each case, respect the arity of the function or the predicate symbol.

  23. Well formed formulas • Definition: wffs are defined inductively as: 1. any atom is a wff 2. if V and W are wff and x is a variable, then (V), V, VW, VW, VW, xW, xW are also wffs. • Precedence:  first, followed with ,  then 

  24. Scope of a quantifier • Definition: the scope of a quantifier is the wff in which variables are influenced by the quantifier. It depends on the (,) • Definition: a variable is bound if it lies in the scope of a quantifier or if is the quantifier variable itself. • Definition: a variable not bound is called free Example: x p(x,y)q(x). What is the scope of the quantifier? What variables are bound? What variables are free?

  25. Interpretation - Example • x y s(x,y) • It is true for D=N the set of natural numbers • s(x,y) means y is successor of x What is the interpretation of this formula?

  26. Model in 1st order logic • Definition: an interpretation for a wff W is a model of W is W is true w.r.t the interpretation

  27. Validity and Satisfiability • Definition: a wff is valid if it is true for any interpretation. Otherwise it is invalid • Definition: a wff is unsatisfiable if it is false for any interpretation. Otherwise it is satisfiable • Example: x y s(x,y) is satisfiable but not valid. Why? • (yx p(x,y)xy p(x,y)) is unsatisfiable

  28. Equivalence in 1st order logic • Definition: two wffs W,W’ are equivalent if they have the same truth value with respect to every interpretation

  29. Useful equivalences • W(x) xW(x) • W(x) xW(x) • x(W(x)W’(x))  xW(x)xW’(x) • x(W(x)W’(x))  xW(x)xW’(x) • (W(x)W’(x))  xW(x)xW’(x) • xy W(x,y) yx W(x,y) • xy W(x,y) yx W(x,y)

  30. Restricted equivalences • Assume V does not have variable x • x(VW(x))  VxW(x) • x(VW(x))  VxW(x) • x(VW(x))  VxW(x) • x(VW(x))  VxW(x) • x(VW(x))  VxW(x) • x(VW(x))  VxW(x) • x(W(x)V)  xW(x)V • x(W(x)V)  xW(x)V

  31. Prenex Normal Forms • Definition: a wff is in prenex conjunctive normal form (resp. prenex disjunctive normal form) if it is written Q1x1…Qnxn (W1...Wn) where Wi is a conjunction of literals resp Q1x1…Qnxn (W1...Wn) where Wi is a disjunction of literals • Property: any wff has an equivalent prenex normal form

  32. Algorithm • Rename the variables in W so that no quantifiers use the same variable name and bound var. are distinct from free var. • Move quantifiers to the left using the equivalence seen in previous slides

More Related