Proofs with Facts and Rules How do Facts, Rules, and Queries relate to predicate logic? 1. Facts, Rules, and Queries are predicate logic statements 2. Facts and Rules are premises 3. Queries are conclusions 4. Inference (deduction) can be used to answer Queries Translate the statements (argument) into predicate logic. All students love pizza. Bob is a student. Therefore, Bob loves pizza. How does that look with Facts, Rules, and Queries? All students love pizza. Bob is a student. Therefore, Bob loves pizza. Implicit Universal Quantifiers (Notice there are no quantifiers in the Datalog version.) What type of quantifier applies to the variables in a Rule? For what values of 'x' is the Rule true? Rules: P(x) :- S(x). The rule is true for all values of 'x' Variables in a rule are implicitly universally quantified Universal Instantiation If a Rule is true for all values of 'x', does that mean the Rule is true for a specific value? Yes, 'Universal Instantiation' is another inference rule (P(x) :- S(x)) => (P('Bob') :- S('Bob')) Prove the Query using the Facts and Rules. Facts: S('Bob'). Rules: P(x) :- S(x). Queries: P('Bob')? Resolution with Facts and Rules That proof was great, but we really should use Resolution. Automatic provers typically use Resolution to answer Queries. What's the process for Resolution and Contradiction? 1. Convert the Facts, Rules, and Queries to clauses 2. Negate the Query (use this as the initial statement) 3. Apply resolution to obtain False a. Try to match with a Fact b. Try to match with the head of a Rule Instantiate the Rule to make it match (Note that starting with the negated query guides the proof.) (Note the proof works backwards, from conclusion to premises.) How do you convert Facts, Rules, and Queries to clauses? Facts: married('Jim', 'Sue'). child('Ned', 'Sue'). Rules: married(y,x) :- married(x,y). child(x,z) :- child(x,y), married(y,z). Queries: child('Ned', 'Jim')? Write the following Rules as clauses (disjunctions of literals). Prove the Query using Contradiction, Instantiation, and Resolution. Facts: S('Bob'). Rules: P(x) :- S(x). Queries: P('Bob')? Write the following Rules as clauses (disjunctions of literals). Prove the Query using Contradiction, Instantiation, and Resolution. Facts: married('Jim', 'Sue'). child('Ned', 'Sue'). Rules: married(y,x) :- married(x,y). child(x,z) :- child(x,y), married(y,z). Queries: child('Ned', 'Jim')? Classwork You may work with a partner. Write the following Rule as a clause (disjunction of literals). Prove the Query using Contradiction, Instantiation, and Resolution. Facts: sister('Ann', 'Bob'). parent('Bob', 'Jay'). Rules: aunt(x,z) :- sister(x,y), parent(y,z). Queries: aunt('Ann', 'Jay')?