Exam Flashcards
What is Logic Programming?
- You present facts and rules to infer new facts by just asking questions
- When a question is asked, the runtime system searches through a database of facts and rules to determine (by logical deduction) the answer
What is Proof?
- A sequence of sequences, where each sentence is either a premise or a sentence, derived from earlier sentences in the proof by an inference rule
- The last sentence is the goal to be proved (T/F)
What is Modus Ponens?
If P → Q and P are true, then infer Q
What is Modus Tollens?
If P → Q and ¬ Q are true, then infer ¬ P
What is And Elimination?
If P ∧ Q is true, then infer both P and Q are true
What is And Introduction?
If P and Q are true, then infer P ∧ Q
What is Disjunctive Syllogism?
If addition (P v Q) and ¬ P are true, then infer Q
What does A→B mean?
If A is true, then B is true
What do A⇔B, A↔B and A≡B mean?
If both A and B are false, or both A and B are true
What does ¬A mean?
If A is false
What does A∧B mean?
If A and B are both true
What does A∨B mean?
If A, B or both are true
Example of Proof with Inference Rules
Premises:
- It is not sunny this afternoon and it is colder than yesterday. We will go swimming only if it is sunny.
- If we don’t go swimming, then we will take a canoe
- If we take a canoe trip, then we will be home by sunset
Conclusion:
- We will be home by sunset
Solution
Where:
- S: It is sunny this afternoon
- C: It is colder than yesterday
- W: We will go swimming
- T: We will take a canoe trip
- H: We will be home by sunset
Premises: ¬ S ∧ C W → S ¬ W → T T → H
Goal: H
Formal Proof:
- ¬ S ∧ C Premise
- ¬ S Simplification
- W → S Premise
- ¬ W Modus Tollens (2/3)
- ¬ W → T Premise
- T Modus Ponens (4/5)
- T → H Premise
- H Modus Ponens (6/7)
What are the limits of Propositional Logic?
Cannot represent:
- If X is married to Y, then Y is married to X
- If X is West of Y, and Y is West of Z, then X is West of Z
Solution:
- Extend representation by adding predicates
- Extend operator (resolution) by adding unification
What are Symbols in Predicate Calculus?
Symbols consist of:
- Set of letters (lower or uppercase)
- Set of digits: 0….9
- Underscore
- Must begin with a letter
What are Constants in Predicate Calculus?
- They name specific objects or properties in the world
- Must begin with a lowercase letter
- The constants “true” and “false” are reserved as truth symbols
- E.g. car, tree
What are Variables in Predicate Calculus?
- Used to assign general classes of objects or properties
- Must begin with an uppercase letter
- E.g. Car, Tree
What are Functions in Predicate Calculus?
- Must begin with a lowercase letter
- Replacing a function with its value is called evaluation
- plus (2, 3) whose value is 5
- E.g. wife (Ninny)
What are Predicates in Predicate Calculus?
- They must begin with a lowercase letter
- A predicate names a relationship between objects in the world
- E.g. loves (Billy, Ninny), equals (X, Y)
- Predicates are special functions with true/false as values
- Predicates of the same name with varying numbers of arguments are considered distinct
- E.g. loves (Billy, Ninny), loves (Billy, Ninny, Pepe)
What are Semantics?
- Terms are mapped to objects in their demain
- The semantics determine a truth value of an expression
What is Unification?
- The inference system must be able to determine when two expressions are the same
- Two expressions only match if syntactically identical
- Unification is an algorithm of determining the substitution list to make two predicate expressions match
- If P and Q are logical expressions:
- Then unify (P, Q) gives a substitution list S, that makes P and Q identical or fails
- The algorithm is complicated by the existence of variables