CS 8520: Artificial Intelligence

Size: px
Start display at page:

Download "CS 8520: Artificial Intelligence"

Transcription

1 CS 8520: Artificial Intelligence Logical Agents and First Order Logic Paula Matuszek Spring

2 References These slides draw from a number of sources, including: Hwee Tou Ng, slides-ppt Russell, Diagrams are based on AIMA. Matuszek, ~matuszek/general/logic/logic-for-ai.ppt 2

3 Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic First Order Logic Inference rules and theorem proving forward chaining backward chaining resolution 3

4 Knowledge bases Knowledge base = set of sentences in a formal language Declarative approach to building an agent (or other system): Tell it what it needs to know Then it can Ask itself what to do - answers should follow from the KB Agents can be viewed at the knowledge level i.e., what they know, regardless of how implemented Or at the implementation level i.e., data structures in KB and algorithms that manipulate them 4

5 A simple knowledge-based agent 5

6 Simple Knowledge-Based Agent This agent tells the KB what it sees, asks the KB what to do, tells the KB what it has done (or is about to do). The agent must be able to: Represent states, actions, etc. Incorporate new percepts Update internal representations of the world Deduce hidden properties of the world Deduce appropriate actions 6

7 Wumpus World PEAS Description Performance measure gold +1000, death per step, -10 for using the arrow Environment Squares adjacent to wumpus are smelly Squares adjacent to pit are breezy Glitter iff gold is in the same square Shooting kills wumpus if you are facing it Shooting uses up the only arrow Grabbing picks up gold if in same square Releasing drops the gold in same square Sensors: Stench, Breeze, Glitter, Bump, Scream Actuators: Left turn, Right turn, Forward, Grab, Release, Shoot 7

8 Wumpus world characterization Fully Observable? No only local perception Deterministic? Yes outcomes exactly specified Static? Yes Wumpus and Pits do not move Discrete? Yes Episodic? No sequential at the level of actions Single-agent? Yes The wumpus itself is essentially a natural feature, not another agent 8

9 More Environment Some versions of Wumpus have a bat ( You hear squeaking.) If you enter the room with a bat, it carries you off and drops you elsewhere. Does that change the environment description? Fully Observable? Deterministic? Static? Discrete? Episodic? Single-agent? What about the Wumpus game we played? 9

10 Exploring a Wumpus world Directly observed: S: stench B: breeze G: glitter A: agent Inferred (mostly): OK: safe square P: pit W: wumpus 10

11 Exploring a wumpus world In 1,1 we don t get B or S, so we know 1,2 and 2,1 are safe. Move to 1,2. In 1,2 we feel a breeze. 11

12 Exploring a wumpus world In 1,2 we feel a breeze. So we know there is a pit in 1,3 or 2,2. 12

13 Exploring a wumpus world So go back to 1,1 then to 2,1 where we smell a stench. 13

14 Exploring a wumpus world Stench in 2,1, so the wumpus is in 3,1 or 2,2. We don't smell a stench in 1,2, so 2,2 can't be the wumpus, so 3,1 must be the wumpus. S W W 14

15 Exploring a wumpus world We don't feel a breeze in 2,1, so 2,2 can't be a pit, so 1,3 must be a pit. 2,2 has neither pit nor wumpus and is therefore okay. 15

16 Exploring a wumpus world We move to 2,2. We don t get any sensory input. 16

17 Exploring a wumpus world So we know that 2,3 and 3,2 are ok. 17

18 Exploring a wumpus world Move to 3,2, where we observe stench, breeze and glitter! We have found the gold and won. Do we want to kill the wumpus? (hint: look at the scoring function) 18

19 Representing Knowledge The agent that solves the wumpus world can most effectively be implemented by a knowledge-based approach Need to represent states and actions, update internal representations, deduce hidden properties and appropriate actions Need a formal representation for the KB And a way to reason about that representation 19

20 Logic in general Logics are formal languages for representing information such that conclusions can be drawn Syntax defines the sentences in the language Semantics define the "meaning" of sentences; i.e., define truth of a sentence in a world E.g., the language of arithmetic x+2 y is a sentence; x2+y > {} is not a sentence x+2 y is true iff the number x+2 is no less than the number y. x+2 y is true in a world where x = 7, y = 1 x+2 y is false in a world where x = 0, y = 6 20

21 What is logic? We can also think of logic as an algebra for manipulating only two values: true (T) and false (F) We will cover: Propositional logic--the simplest kind Predicate logic (a.k.a. predicate calculus)--an extension of propositional logic Resolution theory--a general way of doing proofs in predicate logic (and the basis for Prolog s inference). 21

22 Propositional logic: Syntax Propositional logic is the simplest logic illustrates basic ideas The proposition symbols P1, P2 etc are sentences If S is a sentence, S is a sentence (negation, not) If S1 and S2 are sentences, S1 S2 is a sentence (conjunction, AND) If S1 and S2 are sentences, S1 S2 is a sentence (disjunction, OR) If S1 and S2 are sentences, S1 S2 is a sentence (implication, IMPLIES) If S1 and S2 are sentences, S1 S2 is a sentence (biconditional) 22

23 Propositional logic Propositional logic consists of: The logical values true and false (T and F) Propositions: Sentences, which Are atomic (that is, they must be treated as indivisible units, with no internal structure), and Have a single logical value, either true or false Operators, both unary and binary; when applied to logical values, yield logical values The usual operators are and, or, not, and implies 23

24 Truth tables Logic, like arithmetic, has operators, which apply to one, two, or more values (operands) A truth table lists the results for each possible arrangement of operands Order is important: x op y may or may not give the same result as y op x The rows in a truth table list all possible sequences of truth values for n operands, and specify a result for each sequence Hence, there are 2 n rows in a truth table for n operands 24

25 Unary operators There are four possible unary operators: X Constant T Constant F Identity X T T F T F F T F F T n Only the last of these (negation) is widely used (and has a symbol,,for the operation 25

26 Useful binary operators Here are the binary operators that are traditionally used: n n X Y AND X Y OR X Y IMPLIES X Y BICONDITIONAL X Y T T T T T T T F F T F F F T F T T F F F F F T T Notice in particular that material implication ( ) only approximately means the same as the English word implies Any other binary operators can be constructed from a combination of these (along with unary not, ) 26

27 Logical expressions All logical expressions can be computed with some combination of and ( ), or ( ), and not ( ) operators For example, logical implication can be computed this way: X Y X X Y X Y T T F T T T F F F F F T T T T F F T T T n Notice that X Y is equivalent to X Y 27

28 Another example Exclusive or (xor) is true if exactly one of its operands is true X Y X Y X Y X Y ( X Y) (X Y) X xor Y T T F F F F F F T F F T F T T T F T T F T F T T F F T T F F F F n Notice that ( X Y) (X Y) is equivalent to X xor Y 28

29 Worlds A world is a collection of prepositions and logical expressions relating those prepositions Example: Propositions: JohnLovesMary, MaryIsFemale, MaryIsRich Expressions: MaryIsFemale MaryIsRich JohnLovesMary A proposition says something about the world, but since it is atomic (you can t look inside it to see component parts), propositions tend to be very specialized and inflexible 29

30 Models A model is an assignment of a truth value to each proposition, for example: JohnLovesMary: T, MaryIsFemale: T, MaryIsRich: F An expression is satisfiable if there is a model for which the expression is true For example, the above model satisfies the expression MaryIsFemale MaryIsRich JohnLovesMary An expression is valid if it is satisfied by every model This expression is not valid: MaryIsFemale MaryIsRich JohnLovesMary because it is not satisfied by this model: JohnLovesMary: F, MaryIsFemale: T, MaryIsRich: T But this expression is valid: MaryIsFemale MaryIsRich MaryIsFemale 30

31 Wumpus world sentences Let P i,j be true if there is a pit in [i, j]. Let B i,j be true if there is a breeze in [i, j]. We have P1,1 B1,1 B2,1 "Pits cause breezes in adjacent squares" B1,1 (P1,2 P2,1) B2,1 (P1,1 P2,2 P3,1) 31

32 Grounding We must also be aware of the issue of grounding: the connection between our KB and the real world. Straightforward for Wumpus or adventure games More difficult when reasoning about real situations Real problems seldom perfectly grounded, because we must ignore details. Is the connection good enough to get useful answers? 32

33 Entailment Entailment means that one thing follows from another. Knowledge base KB entails sentence S if and only if S is true in all worlds where KB is true E.g., the KB containing the Wildcats won and the Bearcats won entails Either the Wildcats won or the Bearcats won E.g., x+y = 4 entails 4 = x+y Entailment is a relationship between sentences (i.e., syntax) that is based on semantics 33

34 Entailment in the wumpus world Situation after detecting nothing in [1,1], moving right, breeze in [2,1] Consider possible models for KB assuming only pits: there are 3 Boolean choices 8 possible models (ignoring sensory data) 34

35 Wumpus models for pits 35

36 What Do We Know? We know: P1,1 B 1,1 B 2,1 There is a breeze in square 2,1 One of our rules says: Breeze in square pit in adjacent square So what is entailed by these facts and this rule? 36

37 Wumpus models KB = wumpus-world rules + observations. Only the three models in red are consistent with KB. 37

38 Wumpus Models Consider S1: pit is not in 1.2. S1 model is dotted yellow boundary. KB is contained within S1 model, so KB entails S1; in every model in which KB is true, so is S1. We can conclude that the pit is not in1.2. Consider S2: pit is not in 2.2. S2 is dotted brown boundary. KB is not within S1, so KB does not entail S2; nor does S2 entail KB. So we can't conclude anything about the truth of S2 given KB. 38

39 Pros of propositional logic Declarative Allows partial/disjunctive/negated information Compositional: meaning of B1,1 P1,2 is derived from meaning of B1,1 and of P1,2 Meaning in propositional logic is contextindependent (unlike natural language, where meaning depends on context) Has a sound, complete inference procedure 39

40 Cons of Propositional Logic Very limited expressive power (unlike natural language) - Rapid proliferation of clauses. For instance, Wumpus KB contains "physics" sentences for every single square E.g., cannot say "pits cause breezes in adjacent squares except by writing one sentence for each square 40

41 Inference Given some sentences how do we get to new sentences? Inference! 41

42 Inference KB entailsi S means sentence S can be derived from KB by procedure i Soundness: i is sound if it derives only sentences S that are entailed by KB Completeness: i is complete if it derives all sentences S that are entailed by KB. Logic: Has a sound and complete inference procedure Which will answer any question whose answer follows from what is known by the KB. 42

43 Inference Simplest inference method is model-based inference enumerate all possible models check to see if a proposed sentence is true in every KB sound, complete, slow 43

44 Inference by enumeration Depth-first enumeration of all models is sound and complete n symbols, time complexity is O(2n), space complexity is O(n) 44

45 Inference-based agents in the wumpus world A wumpus-world agent using propositional logic: P1,1 W1,1 Bx,y (Px,y+1 Px,y-1 Px+1,y Px-1,y) Sx,y (Wx,y+1 Wx,y-1 Wx+1,y Wx-1,y) W1,1 W1,2 W4,4 W1,1 W1,2 W1,1 W1,3 64 distinct proposition symbols, 155 sentences 45

46 46

47 Inference by Theorem Proving Rather than enumerate all possible models, we can apply inference rules to the current sentences in the KB to derive new sentences A proof consists of a chain of rules beginning with known sentences (premises) and ending with the sentence we want to prove (conclusion) 47

48 Inference rules in propositional logic Here are just a few of the rules you can apply when reasoning in propositional logic: From aima.eecs.berkeley.edu/slides-ppt, chs

49 Implication elimination A particularly important rule allows you to get rid of the implication operator, : X Y X Y Thurs AI class AI class Thurs The symbol means is logically equivalent to We will use this later on as a necessary tool for simplifying logical expressions 49

50 Conjunction elimination Another important rule for simplifying logical expressions allows you to get rid of the conjunction (and) operator, : This rule simply says that if you have an and operator at the top level of a fact (logical expression), you can break the expression up into two separate facts: Breeze2,1 Breeze1,2 becomes: Breeze2,1 Breeze1,2 50

51 Inference by Theorem Proving Given: A set of sentences in the KB: the premises A sentence to be proved: the conclusion A set of sound rules Apply a rule to an appropriate sentence Add the resulting sentence to the KB Stop if we have added the conclusion to the KB Essentially a search problem Better than model-based if many models, short proofs But b is very large 51

52 Summary Logical agents apply inference to a knowledge base to derive new information and make decisions Basic concepts of logic: syntax: formal structure of sentences semantics: truth of sentences wrt models entailment: necessary truth of one sentence given another inference: deriving sentences from other sentences soundness: derivations produce only entailed sentences completeness: derivations can produce all entailed sentences Propositional logic lacks expressive power 52

53 First-order logic (Predicate Calculus) Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes the world contains Objects: people, houses, numbers, colors, baseball games, wars, Relations: red, round, prime, brother of, bigger than, part of, comes between, Functions: father of, best friend, one more than, plus, 53

54 Syntax of FOL: Basic elements All of propositional logic Constants kingjohn, 2, villanova,... Predicates brother, >,... Functions sqrt, leftlegof,... Variables X, Y, A, B,... Connectives,,,, Equality = Quantifiers, 54

55 Constants, functions, and predicates A constant represents a thing --it has no truth value, and it does not occur bare in a logical expression Examples: paulamatuszek, 5, earth, goodidea Given zero or more arguments, a function produces a constant as its value: Examples: studentof(paulamatuszek), add(2, 2), thisplanet() A predicate is like a function, but produces a truth value Examples: aiinstructor(paulamatuszek), isplanet (earth), greater(3, add(2, 2)) 55

56 Universal quantification The universal quantifier,, is read as for each or for every or for all Example: x, x 2 0 (for all x, x 2 is greater than or equal to zero) Typically, is the main connective with : x, at(x,villanova) smart(x) means Everyone at Villanova is smart Common mistake: using as the main connective with : x, at(x,villanova) smart(x) means Everyone is at Villanova and everyone is smart If there are no values satisfying the condition, the result is true Example: x, ispersonfrommars(x) smart(x) is true 56

57 Existential quantification The existential quantifier,, is read for some or there exists E.G.: x, x 2 < 0 (there exists an x such that x 2 < zero) Typically, is the main connective with : x, at(x,villanova) smart(x) means There is someone who is at Villanova and is smart Common mistake: using as the main connective with : x, at(x,villanova) smart(x) This is true if there is someone at Villanova who is smart......but it is also true if there is someone who is not at Villanova By the rules of material implication, the result of F T is T 57

58 Properties of quantifiers x y is the same as y x x y is the same as y x x y is not the same as y x x y Loves(x,y) There is a person who loves everyone in the world More exactly: x y (person(x) person(y) Loves(x,y)) y x Loves(x,y) Everyone in the world is loved by at least one person 58

59 More rules Quantifier duality: each can be expressed using the other x Likes(x,IceCream) x Likes(x,IceCream) x Likes(x,Broccoli) x Likes(x,Broccoli) Two additional important rules: x, p(x) x, p(x) If not every x satisfies p(x), then there exists a x that does not satisfy p(x) x, p(x) x, p(x) If there does not exist an x that satisfies p(x), then all x do not satisfy p(x) 59

60 Terms and Atomic sentences A term is a logical expression that refers to an object. book(andrew). Andrew s book. textbook(8520). Textbook for An atomic sentence states a fact. student(andrew). student(andrew, aaula). atudent(andrew, ai). Note that the interpretation of these is different; it depends on how we consider them to be grounded. 60

61 Complex sentences Complex sentences are made from atomic sentences using connectives S, S1 S2, S1 S2, S1 S2, S1 S2, E.g. sibling(kingjohn,richard) sibling (richard,kingjohn) 61

62 Truth in first-order logic Sentences are true with respect to a model and an interpretation Model contains objects (domain elements) and relations among them Interpretation specifies referents for constant symbols objects predicate symbols relations function symbols functional relations An atomic sentence predicate(term 1,...,term n ) is true iff the objects referred to by term 1,...,term n are in the relation referred to by predicate 62

63 Knowledge base for the wumpus world Perception t,s,b Percept([s,b,Glitter],t) Glitter(t) Reflex t Glitter(t) BestAction(Grab,t) 63

64 Deducing hidden properties x,y,a,b Adjacent([x,y],[a,b]) (x=a (y=b-1 y=b+1) (y=b (x=a-1 x=a+1)) Properties of squares: s,t At(Agent,s,t) Breeze(t) Breezy(s) Squares are breezy near a pit: Diagnostic rule---infer cause from effect s Breezy(s) r Adjacent(r,s) Pit(r) Causal rule---infer effect from cause r Pit(r) [ s Adjacent(r,s) Breezy(s)] 64

65 Knowledge engineering in FOL Identify the task Assemble the relevant knowledge: knowledge acquisition Decide on a vocabulary of predicates, functions, and constants: an ontology Encode general knowledge about the domain Encode a description of the specific problem instance Pose queries to the inference procedure and get answers Debug the knowledge base 65

66 Summary First-order logic: objects and relations are semantic primitives syntax: constants, functions, predicates, equality, quantifiers Increased expressive power: sufficient to define wumpus world compactly 66

67 Inference When we have all this knowledge we want to do something with it Typically, we want to infer new knowledge An appropriate action to take Additional information for the Knowledge Base Some typical forms of inference include Forward chaining Backward chaining Resolution 67

68 Example knowledge base The law says that it is a crime for an American to sell weapons to hostile nations. The country Nono, an enemy of America, has some missiles, and all of its missiles were sold to it by Colonel West, who is American. Prove that Col. West is a criminal 68

69 Example knowledge base contd.... it is a crime for an American to sell weapons to hostile nations: American(x) Weapon(y) Sells(x,y,z) Hostile(z) Criminal (x) Nono has some missiles: Owns(Nono,M1) all of its missiles were sold to it by Colonel West Missile(x) Owns(Nono,x) Sells(West,x,Nono) Missiles are weapons: Missile(x) Weapon(x) An enemy of America counts as "hostile : Enemy(x,America) Hostile(x) West, who is American: American(West) Missile(M1) The country Nono, an enemy of America: Enemy(Nono,America) 69

70 Forward chaining proof 70

71 Forward chaining proof 71

72 Forward chaining proof 72

73 Properties of forward chaining Sound and complete for first-order definite clauses Datalog = first-order definite clauses + no functions FC terminates for Datalog in finite number of iterations May not terminate in general if α is not entailed This is unavoidable: entailment with definite clauses is semidecidable 73

74 Efficiency of forward chaining Incremental forward chaining: no need to match a rule on iteration k if a premise wasn't added on iteration k-1 match each rule whose premise contains a newly added positive literal Matching itself can be expensive: Database indexing allows O(1) retrieval of known facts e.g., query Missile(x) retrieves Missile(M1) Forward chaining is widely used in deductive databases 74

75 Backward chaining example 75

76 Backward chaining example 76

77 Backward chaining example 77

78 Backward chaining example 78

79 Backward chaining example 79

80 Backward chaining example 80

81 Backward chaining example 81

82 Backward chaining example 82

83 Properties of backward chaining Depth-first recursive proof search: space is linear in size of proof Incomplete due to infinite loops fix by checking current goal against every goal on stack Inefficient due to repeated subgoals (both success and failure) fix using caching of previous results (extra space) Widely used for logic programming 83

84 Forward vs. backward chaining FC is data-driven, automatic, unconscious processing, e.g., object recognition, routine decisions May do lots of work that is irrelevant to the goal BC is goal-driven, appropriate for problem-solving, e.g., Where are my keys? How do I get into a PhD program? Complexity of BC can be much less than linear in size of KB Choice may depend on whether you are likely to have many goals or lots of data. 84

85 Resolution 85

86 Inference is Expensive! You start with a lot of facts (predicates) and a lot of possible transformations (rules) Some rules apply to a single fact to yield a new fact Some rules apply to a pair of facts to yield a new fact So at every step you must: Choose some rule to apply Choose one or two facts to apply it to If there are n facts There are n potential ways to apply a single-operand rule There are n * (n - 1) potential ways to apply a two-operand rule Add the new fact to your ever-expanding fact base The search space is huge! 86

87 The magic of resolution Here s how resolution works: You transform each of your facts into a particular form, called a clause You apply a single rule, the resolution principle, to a pair of clauses Clauses are closed with respect to resolution--that is, when you resolve two clauses, you get a new clause You add the new clause to your fact base So the number of facts you have grows linearly You still have to choose a pair of facts to resolve You never have to choose a rule, because there s only one 87

88 The fact base A fact base is a collection of facts, expressed in predicate calculus, that are presumed to be true (valid) These facts are implicitly anded together Example fact base: seafood(x) likes(john, X) (where X is a variable) seafood(shrimp) pasta(x) likes(mary, X) (where X is a different variable) pasta(spaghetti) That is, (seafood(x) likes(john, X)) seafood(shrimp) (pasta(y) likes(mary, Y)) pasta(spaghetti) Notice that we had to change some Xs to Ys The scope of a variable is the single fact in which it occurs 88

89 Clause form A clause is a disjunction ("or") of zero or more literals, some or all of which may be negated Example: sinks(x) dissolves(x, water) denser(x, water) Notice that clauses use only or and not they do not use and, implies, or either of the quantifiers for all or there exists The impressive part is that any predicate calculus expression can be put into clause form Existential quantifiers,, are the trickiest ones And any FOL expression can be expressed as a conjunction of clauses: Conjunctive Normal Form 89

90 Unification From the pair of facts (not yet clauses, just facts): seafood(x) likes(john, X) (where X is a variable) seafood(shrimp) We ought to be able to conclude likes(john, shrimp) We can do this by unifying the variable X with the constant shrimp This is the same unification as is done in Prolog This unification turns seafood(x) likes(john, X) into seafood(shrimp) likes(john, shrimp) Together with the given fact seafood(shrimp), the final deductive step is easy 90

91 The resolution principle Here it is: From X someliterals and X someotherliterals conclude: someliterals someotherliterals That s all there is to it! X and X are complementary literals; someliterals someotherliterals is the resolvent clause Example: broke(bob) well-fed(bob) broke(bob) hungry(bob) well-fed(bob) hungry(bob) 91

92 A common error You can only do one resolution at a time Example: broke(bob) well-fed(bob) happy(bob) broke(bob) hungry(bob) happy(bob) You can resolve on broke to get: well-fed(bob) happy(bob) hungry(bob) happy(bob) T Or you can resolve on happy to get: broke(bob) well-fed(bob) broke(bob) hungry(bob) T Note that both legal resolutions yield a tautology (a trivially true statement, containing X X), which is correct but useless But you cannot resolve on both at once to get: well-fed(bob) hungry(bob) 92

93 Contradiction A special case occurs when the result of a resolution (the resolvent) is empty, or NIL Example: hungry(bob) hungry(bob) NIL In this case, the fact base is inconsistent This will turn out to be a very useful observation in doing resolution theorem proving 93

94 A first example Everywhere that John goes, Rover goes. John is at school. at(john, X) at(rover, X) (not yet in clause form) at(john, school) (already in clause form) We use implication elimination to change the first of these into clause form: at(john, X) at(rover, X) at(john, school) We can resolve these on at(-, -), but to do so we have to unify X with school; this gives: at(rover, school) 94

95 Refutation resolution The previous example was easy because it had very few clauses When we have a lot of clauses, we want to focus our search on the thing we would like to prove We can do this as follows: Assume that our fact base is consistent (we can t derive NIL) Add the negation of the thing we want to prove to the fact base Show that the fact base is now inconsistent Conclude the thing we want to prove 95

96 Example of refutation resolution Everywhere that John goes, Rover goes. John is at school. Prove that Rover is at school. at(john, X) at(rover, X) at(john, school) at(rover, school) (this is the added clause) Resolve #1 and #3: at(john, X) Resolve #2 and #4: NIL Conclude the negation of the added clause: at(rover, school) This seems a roundabout approach for such a simple example, but it works well for larger problems 96

97 A second example n Start with: n it_is_raining it_is_sunny n n it_is_sunny I_stay_dry it_is_raining I_take_umbrella n n I_take_umbrella I_stay_dry Convert to clause form: 1. it_is_raining it_is_sunny 2. it_is_sunny I_stay_dry 3. it_is_raining I_take_umbrella 4. I_take_umbrella I_stay_dry n Proof: 6. (5, 2) it_is_sunny 7. (6, 1) it_is_raining 8. (5, 4) I_take_umbrella 9. (8, 3) it_is_raining 10. (9, 7) NIL n Prove that I stay dry: Therefore, ( I_stay_dry) 5. I_stay_dry I_stay_dry 97

98 Resolution Summary Resolution is a single inference role which is both sound and complete Every sentence in the KB is represented in clause form; any sentence in FOL can be reduced to this clause form. Two sentences can be resolved if one contains a positive literal and the other contains a matching negative literal; the result is a new fact which is thedisjunction of the remaining literals in both. Resolution can be used as a relatively efficient theoremprover by adding to the KB the negative of the sentence to be proved and attempting to derive a contradiction 98

99 Summary Inference is the process of adding information to the knowledge base We want inference to be sound: what we add is true if the KB is true And complete: if the KB entails a sentence we can derive it. Forward chaining, backward chaining, and resolution are typical inference mechanisms for first order logic. 99

E.g., Brother(KingJohn,RichardTheLionheart)

E.g., Brother(KingJohn,RichardTheLionheart) First-Order Logic Chapter 8 Outline Why FOL? Syntax and semantics of FOL Using FOL Wumpus world in FOL Knowledge engineering in FOL 1 Pros and cons of propositional logic Propositional logic is declarative

More information

Knowledge Representation. CS 486/686: Introduction to Artificial Intelligence

Knowledge Representation. CS 486/686: Introduction to Artificial Intelligence Knowledge Representation CS 486/686: Introduction to Artificial Intelligence 1 Outline Knowledge-based agents Logics in general Propositional Logic& Reasoning First Order Logic 2 Introduction So far we

More information

Inf2D 12: Resolution-Based Inference

Inf2D 12: Resolution-Based Inference School of Informatics, University of Edinburgh 09/02/18 Slide Credits: Jacques Fleuriot, Michael Rovatsos, Michael Herrmann Last time Unification: Given α and β, find θ such that αθ = βθ Most general unifier

More information

Outline. Forward chaining Backward chaining Resolution. West Knowledge Base. Forward chaining algorithm. Resolution-Based Inference.

Outline. Forward chaining Backward chaining Resolution. West Knowledge Base. Forward chaining algorithm. Resolution-Based Inference. Resolution-Based Inference Outline R&N: 9.3-9.6 Michael Rovatsos University of Edinburgh Forward chaining Backward chaining Resolution 10 th February 2015 Forward chaining algorithm West Knowledge Base

More information

Introduction to Artificial Intelligence 2 nd semester 2016/2017. Chapter 8: First-Order Logic (FOL)

Introduction to Artificial Intelligence 2 nd semester 2016/2017. Chapter 8: First-Order Logic (FOL) Introduction to Artificial Intelligence 2 nd semester 2016/2017 Chapter 8: First-Order Logic (FOL) Mohamed B. Abubaker Palestine Technical College Deir El-Balah 1 Introduction Propositional logic is used

More information

Foundations of AI. 9. Predicate Logic. Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution

Foundations of AI. 9. Predicate Logic. Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution Foundations of AI 9. Predicate Logic Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution Wolfram Burgard, Andreas Karwath, Bernhard Nebel, and Martin Riedmiller 09/1 Contents Motivation

More information

Implementation Techniques

Implementation Techniques Web Science & Technologies University of Koblenz Landau, Germany Implementation Techniques Acknowledgements to Angele, Gehrke, STI Word of Caution There is not the one silver bullet In actual systems,

More information

INF5390 Kunstig intelligens. First-Order Logic. Roar Fjellheim

INF5390 Kunstig intelligens. First-Order Logic. Roar Fjellheim INF5390 Kunstig intelligens First-Order Logic Roar Fjellheim Outline Logical commitments First-order logic First-order inference Resolution rule Reasoning systems Summary Extracts from AIMA Chapter 8:

More information

Question about Final Exam. CS 416 Artificial Intelligence. What do we like about propositional logic? First-order logic

Question about Final Exam. CS 416 Artificial Intelligence. What do we like about propositional logic? First-order logic Page 1 Question about Final Exam CS 416 Artificial Intelligence I will have a date for you by Tuesday of next week. Lecture 13 First-Order Logic Chapter 8 First-order logic We saw how propositional logic

More information

For next Tuesday. Read chapter 8 No written homework Initial posts due Thursday 1pm and responses due by class time Tuesday

For next Tuesday. Read chapter 8 No written homework Initial posts due Thursday 1pm and responses due by class time Tuesday For next Tuesday Read chapter 8 No written homework Initial posts due Thursday 1pm and responses due by class time Tuesday Any questions? Program 1 Imperfect Knowledge What issues arise when we don t know

More information

First Order Logic. Introduction to AI Bert Huang

First Order Logic. Introduction to AI Bert Huang First Order Logic Introduction to AI Bert Huang Review Propositional logic syntax and semantics Inference in propositional logic: table, inference rules, resolution Horn clauses, forward/backward chaining

More information

ARTIFICIAL INTELLIGENCE (CS 370D)

ARTIFICIAL INTELLIGENCE (CS 370D) Princess Nora University Faculty of Computer & Information Systems ARTIFICIAL INTELLIGENCE (CS 370D) (CHAPTER-7) LOGICAL AGENTS Outline Agent Case (Wumpus world) Knowledge-Representation Logic in general

More information

COMP3411: Artificial Intelligence 8. First Order Logic

COMP3411: Artificial Intelligence 8. First Order Logic COMP9414/9814/3411 16s1 First Order Logic 1 COMP3411: Artificial Intelligence 8. First Order Logic Overview First Order Logic Universal and Existential Quantifiers Russell & Norvig, Chapter 8. Fun with

More information

Resolution in FOPC. Deepak Kumar November Knowledge Engineering in FOPC

Resolution in FOPC. Deepak Kumar November Knowledge Engineering in FOPC Resolution in FOPC Deepak Kumar November 2017 Knowledge Engineering in FOPC Identify the task Assemble relevant knowledge Decide on a vocabulary of predicates, functions, and constants Encode general knowledge

More information

ITCS 6150 Intelligent Systems. Lecture 13 First-Order Logic Chapter 8

ITCS 6150 Intelligent Systems. Lecture 13 First-Order Logic Chapter 8 ITCS 6150 Intelligent Systems Lecture 13 First-Order Logic Chapter 8 First-order logic We saw how propositional logic can create intelligent behavior But propositional logic is a poor representation for

More information

Set 7: Predicate logic Chapter 8 R&N. ICS 271 Fall 2015

Set 7: Predicate logic Chapter 8 R&N. ICS 271 Fall 2015 Set 7: Predicate logic Chapter 8 R&N ICS 271 Fall 2015 Outline New ontology objects, relations, properties, functions New Syntax Constants, predicates, properties, functions New semantics meaning of new

More information

Predicate Calculus. Problems? Syntax. Atomic Sentences. Complex Sentences. Truth

Predicate Calculus. Problems? Syntax. Atomic Sentences. Complex Sentences. Truth Problems? What kinds of problems exist for propositional logic? Predicate Calculus A way to access the components of an individual assertion Predicate Calculus: used extensively in many AI programs, especially

More information

CSE 473 Lecture 12 Chapter 8. First-Order Logic. CSE AI faculty

CSE 473 Lecture 12 Chapter 8. First-Order Logic. CSE AI faculty CSE 473 Lecture 12 Chapter 8 First-Order Logic CSE AI faculty What s on our menu today? First-Order Logic Definitions Universal and Existential Quantifiers Skolemization Unification 2 Propositional vs.

More information

Vibhav Gogate University of Texas, Dallas Artificial Intelligence: CS 4365 First-order Logic

Vibhav Gogate University of Texas, Dallas Artificial Intelligence: CS 4365 First-order Logic Artificial Intelligence: CS 4365 First-order Logic Vibhav Gogate University of Texas, Dallas First-order Logic Course Outline: Where are we? Introduction and Agents Search, Heuristics and CSPs Adversarial

More information

Automated Reasoning PROLOG and Automated Reasoning 13.4 Further Issues in Automated Reasoning 13.5 Epilogue and References 13.

Automated Reasoning PROLOG and Automated Reasoning 13.4 Further Issues in Automated Reasoning 13.5 Epilogue and References 13. 13 Automated Reasoning 13.0 Introduction to Weak Methods in Theorem Proving 13.1 The General Problem Solver and Difference Tables 13.2 Resolution Theorem Proving 13.3 PROLOG and Automated Reasoning 13.4

More information

COMP4418 Knowledge Representation and Reasoning

COMP4418 Knowledge Representation and Reasoning COMP4418 Knowledge Representation and Reasoning Week 3 Practical Reasoning David Rajaratnam Click to edit Present s Name Practical Reasoning - My Interests Cognitive Robotics. Connect high level cognition

More information

CSC242: Intro to AI. Lecture 8 LOGIC

CSC242: Intro to AI. Lecture 8 LOGIC CSC242: Intro to AI Lecture 8 LOGIC Propositional Logic Fly Problem-solving state Transition Model World state Action Arad Sibiu Timosoara Zerind Rimnicu Vilcea Arad Arad Lugoj Arad Oradea Faragas Oradea

More information

Last time: Logic and Reasoning

Last time: Logic and Reasoning Last time: Logic and Reasoning Knowledge Base (KB): contains a set of sentences expressed using a knowledge representation language TELL: operator to add a sentence to the KB ASK: to query the KB Logics

More information

Resolution in FO logic (Ch. 9)

Resolution in FO logic (Ch. 9) Resolution in FO logic (Ch. 9) Review: CNF form Conjunctive normal form is a number of clauses stuck together with ANDs Each clause can only contain ORs, and logical negation must appears right next to

More information

CSL105: Discrete Mathematical Structures. Ragesh Jaiswal, CSE, IIT Delhi

CSL105: Discrete Mathematical Structures. Ragesh Jaiswal, CSE, IIT Delhi is another way of showing that an argument is correct. Definitions: Literal: A variable or a negation of a variable is called a literal. Sum and Product: A disjunction of literals is called a sum and a

More information

First-Order Logic Syntax

First-Order Logic Syntax First-Order Logic Syntax Reading: Chapter 8, 9.1-9.2, 9.5.1-9.5.5 FOL Syntax and Semantics read: 8.1-8.2 FOL Knowledge Engineering read: 8.3-8.5 FOL Inference read: Chapter 9.1-9.2, 9.5.1-9.5.5 (Please

More information

CS-171, Intro to A.I. Mid-term Exam Winter Quarter, 2014

CS-171, Intro to A.I. Mid-term Exam Winter Quarter, 2014 CS-171, Intro to A.I. Mid-term Exam Winter Quarter, 2014 YOUR NAME: YOUR ID: ID TO RIGHT: ROW: SEAT NO.: The exam will begin on the next page. Please, do not turn the page until told. When you are told

More information

CSC242: Intro to AI. Lecture 10. Tuesday, February 26, 13

CSC242: Intro to AI. Lecture 10. Tuesday, February 26, 13 CSC242: Intro to AI Lecture 10 No Quiz Propositional Logic Propositional Logic Fly Problem-solving state Transition Model World state Action Arad Sibiu Timosoara Zerind Rimnicu Vilcea Arad Arad Lugoj

More information

a. Given that we search depth first from left to right, list all leaf nodes above that we need to search/expand. (35 Points)

a. Given that we search depth first from left to right, list all leaf nodes above that we need to search/expand. (35 Points) Name: Course: CAP 4601 Semester: Summer 2013 Assignment: Assignment 06 Date: 08 JUL 2013 Complete the following written problems: 1. Alpha-Beta Pruning (40 Points). Consider the following min-max tree.

More information

Integrity Constraints (Chapter 7.3) Overview. Bottom-Up. Top-Down. Integrity Constraint. Disjunctive & Negative Knowledge. Proof by Refutation

Integrity Constraints (Chapter 7.3) Overview. Bottom-Up. Top-Down. Integrity Constraint. Disjunctive & Negative Knowledge. Proof by Refutation CSE560 Class 10: 1 c P. Heeman, 2010 Integrity Constraints Overview Disjunctive & Negative Knowledge Resolution Rule Bottom-Up Proof by Refutation Top-Down CSE560 Class 10: 2 c P. Heeman, 2010 Integrity

More information

Propositional logic (Ch. 7)

Propositional logic (Ch. 7) Propositional logic (Ch. 7) Announcements Writing 3 due Sunday - ideally use for project - if you haven't decided project by then, you will have to redo this work Logic: definitions We say that two sentences

More information

LOGIC AND DISCRETE MATHEMATICS

LOGIC AND DISCRETE MATHEMATICS LOGIC AND DISCRETE MATHEMATICS A Computer Science Perspective WINFRIED KARL GRASSMANN Department of Computer Science University of Saskatchewan JEAN-PAUL TREMBLAY Department of Computer Science University

More information

Logic and Computation

Logic and Computation Logic and Computation From Conceptualization to Formalization Here's what we do when we build a formal model (or do a computation): 0. Identify a collection of objects/events in the real world. This is

More information

Formal Methods of Software Design, Eric Hehner, segment 1 page 1 out of 5

Formal Methods of Software Design, Eric Hehner, segment 1 page 1 out of 5 Formal Methods of Software Design, Eric Hehner, segment 1 page 1 out of 5 [talking head] Formal Methods of Software Engineering means the use of mathematics as an aid to writing programs. Before we can

More information

Logical reasoning systems

Logical reasoning systems Logical reasoning systems Theorem provers and logic programming languages Production systems Frame systems and semantic networks Description logic systems CS 561, Session 19 1 Logical reasoning systems

More information

Resolution (14A) Young W. Lim 6/14/14

Resolution (14A) Young W. Lim 6/14/14 Copyright (c) 2013-2014. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free

More information

CSE 20 DISCRETE MATH. Fall

CSE 20 DISCRETE MATH. Fall CSE 20 DISCRETE MATH Fall 2017 http://cseweb.ucsd.edu/classes/fa17/cse20-ab/ Final exam The final exam is Saturday December 16 11:30am-2:30pm. Lecture A will take the exam in Lecture B will take the exam

More information

Logic: TD as search, Datalog (variables)

Logic: TD as search, Datalog (variables) Logic: TD as search, Datalog (variables) Computer Science cpsc322, Lecture 23 (Textbook Chpt 5.2 & some basic concepts from Chpt 12) June, 8, 2017 CPSC 322, Lecture 23 Slide 1 Lecture Overview Recap Top

More information

Propositional Logic. Part I

Propositional Logic. Part I Part I Propositional Logic 1 Classical Logic and the Material Conditional 1.1 Introduction 1.1.1 The first purpose of this chapter is to review classical propositional logic, including semantic tableaux.

More information

Lecture 17 of 41. Clausal (Conjunctive Normal) Form and Resolution Techniques

Lecture 17 of 41. Clausal (Conjunctive Normal) Form and Resolution Techniques Lecture 17 of 41 Clausal (Conjunctive Normal) Form and Resolution Techniques Wednesday, 29 September 2004 William H. Hsu, KSU http://www.kddresearch.org http://www.cis.ksu.edu/~bhsu Reading: Chapter 9,

More information

Module 6. Knowledge Representation and Logic (First Order Logic) Version 2 CSE IIT, Kharagpur

Module 6. Knowledge Representation and Logic (First Order Logic) Version 2 CSE IIT, Kharagpur Module 6 Knowledge Representation and Logic (First Order Logic) 6.1 Instructional Objective Students should understand the advantages of first order logic as a knowledge representation language Students

More information

CS-171, Intro to A.I. Mid-term Exam Summer Quarter, 2016

CS-171, Intro to A.I. Mid-term Exam Summer Quarter, 2016 CS-171, Intro to A.I. Mid-term Exam Summer Quarter, 2016 YOUR NAME: YOUR ID: ID TO RIGHT: ROW: SEAT: The exam will begin on the next page. Please, do not turn the page until told. When you are told to

More information

First Order Logic and Resolution

First Order Logic and Resolution Artificial Intelligence CS 6364 Professor Dan Moldovan Section 6 First Order Logic and Resolution First Order Logic (First Order Predicate Calculus) n n There is need to access components of a sentence.

More information

Mathematical Logic Prof. Arindama Singh Department of Mathematics Indian Institute of Technology, Madras. Lecture - 37 Resolution Rules

Mathematical Logic Prof. Arindama Singh Department of Mathematics Indian Institute of Technology, Madras. Lecture - 37 Resolution Rules Mathematical Logic Prof. Arindama Singh Department of Mathematics Indian Institute of Technology, Madras Lecture - 37 Resolution Rules If some literals can be unified, the same algorithm should be able

More information

Logic Languages. Hwansoo Han

Logic Languages. Hwansoo Han Logic Languages Hwansoo Han Logic Programming Based on first-order predicate calculus Operators Conjunction, disjunction, negation, implication Universal and existential quantifiers E A x for all x...

More information

CS103 Spring 2018 Mathematical Vocabulary

CS103 Spring 2018 Mathematical Vocabulary CS103 Spring 2018 Mathematical Vocabulary You keep using that word. I do not think it means what you think it means. - Inigo Montoya, from The Princess Bride Consider the humble while loop in most programming

More information

Program Verification & Testing; Review of Propositional Logic

Program Verification & Testing; Review of Propositional Logic 8/24: p.1, solved; 9/20: p.5 Program Verification & Testing; Review of Propositional Logic CS 536: Science of Programming, Fall 2018 A. Why Course guidelines are important. Active learning is the style

More information

Logic and its Applications

Logic and its Applications Logic and its Applications Edmund Burke and Eric Foxley PRENTICE HALL London New York Toronto Sydney Tokyo Singapore Madrid Mexico City Munich Contents Preface xiii Propositional logic 1 1.1 Informal introduction

More information

Logic Programming and Resolution Lecture notes for INF3170/4171

Logic Programming and Resolution Lecture notes for INF3170/4171 Logic Programming and Resolution Lecture notes for INF3170/4171 Leif Harald Karlsen Autumn 2015 1 Introduction This note will explain the connection between logic and computer programming using Horn Clauses

More information

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter p. 1/27

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter p. 1/27 CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 2.1-2.7 p. 1/27 CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer

More information

6.034 Notes: Section 11.1

6.034 Notes: Section 11.1 6.034 Notes: Section 11.1 Slide 11.1.1 We've now spent a fair bit of time learning about the language of first-order logic and the mechanisms of automatic inference. And, we've also found that (a) it is

More information

An Evolution of Mathematical Tools

An Evolution of Mathematical Tools An Evolution of Mathematical Tools From Conceptualization to Formalization Here's what we do when we build a formal model (or do a computation): 0. Identify a collection of objects/events in the real world.

More information

Declarative Programming. 2: theoretical backgrounds

Declarative Programming. 2: theoretical backgrounds Declarative Programming 2: theoretical backgrounds 1 Logic Systems: structure and meta-theoretical properties logic system syntax semantics proof theory defines which sentences are legal in the logical

More information

Constraint Solving. Systems and Internet Infrastructure Security

Constraint Solving. Systems and Internet Infrastructure Security Systems and Internet Infrastructure Security Network and Security Research Center Department of Computer Science and Engineering Pennsylvania State University, University Park PA Constraint Solving Systems

More information

Notes for Chapter 12 Logic Programming. The AI War Basic Concepts of Logic Programming Prolog Review questions

Notes for Chapter 12 Logic Programming. The AI War Basic Concepts of Logic Programming Prolog Review questions Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions The AI War How machines should learn: inductive or deductive? Deductive: Expert => rules =>

More information

Summary of Course Coverage

Summary of Course Coverage CS-227, Discrete Structures I Spring 2006 Semester Summary of Course Coverage 1) Propositional Calculus a) Negation (logical NOT) b) Conjunction (logical AND) c) Disjunction (logical inclusive-or) d) Inequalities

More information

Artificial Intelligence. Chapters Reviews. Readings: Chapters 3-8 of Russell & Norvig.

Artificial Intelligence. Chapters Reviews. Readings: Chapters 3-8 of Russell & Norvig. Artificial Intelligence Chapters Reviews Readings: Chapters 3-8 of Russell & Norvig. Topics covered in the midterm Solving problems by searching (Chap. 3) How to formulate a search problem? How to measure

More information

Semantics via Syntax. f (4) = if define f (x) =2 x + 55.

Semantics via Syntax. f (4) = if define f (x) =2 x + 55. 1 Semantics via Syntax The specification of a programming language starts with its syntax. As every programmer knows, the syntax of a language comes in the shape of a variant of a BNF (Backus-Naur Form)

More information

Knowledge Representation and Reasoning Logics for Artificial Intelligence

Knowledge Representation and Reasoning Logics for Artificial Intelligence Knowledge Representation and Reasoning Logics for Artificial Intelligence Stuart C. Shapiro Department of Computer Science and Engineering and Center for Cognitive Science University at Buffalo, The State

More information

CS S-10 First Order Logic 1

CS S-10 First Order Logic 1 CS662-2013S-10 First Order Logic 1 10-0: Representation Propositional Logic has several nice features Lets us easily express disjunction and negation There is a pit in (1,1) or in (2,2) There is not a

More information

Module 6. Knowledge Representation and Logic (First Order Logic) Version 2 CSE IIT, Kharagpur

Module 6. Knowledge Representation and Logic (First Order Logic) Version 2 CSE IIT, Kharagpur Module 6 Knowledge Representation and Logic (First Order Logic) Lesson 15 Inference in FOL - I 6.2.8 Resolution We have introduced the inference rule Modus Ponens. Now we introduce another inference rule

More information

First-Order Predicate Logic. Introduction to Intelligent Systems

First-Order Predicate Logic. Introduction to Intelligent Systems First-Order Predicate Logic Introduction to Intelligent Systems First-Order (Predicate) Logic Propositional logic assumes the world contains facts Predicate logic (like natural language) assumes the world

More information

[Ch 6] Set Theory. 1. Basic Concepts and Definitions. 400 lecture note #4. 1) Basics

[Ch 6] Set Theory. 1. Basic Concepts and Definitions. 400 lecture note #4. 1) Basics 400 lecture note #4 [Ch 6] Set Theory 1. Basic Concepts and Definitions 1) Basics Element: ; A is a set consisting of elements x which is in a/another set S such that P(x) is true. Empty set: notated {

More information

Question 1: 25% of students lost more than 2 points Question 2: 50% of students lost 2-4 points; 50% got it entirely correct Question 3: 95% of

Question 1: 25% of students lost more than 2 points Question 2: 50% of students lost 2-4 points; 50% got it entirely correct Question 3: 95% of Question 1: 25% of students lost more than 2 points Question 2: 50% of students lost 2-4 points; 50% got it entirely correct Question 3: 95% of students got this problem entirely correct Question 4: Only

More information

Lecture 5. Logic I. Statement Logic

Lecture 5. Logic I. Statement Logic Ling 726: Mathematical Linguistics, Logic. Statement Logic V. Borschev and B. Partee, September 27, 2 p. Lecture 5. Logic I. Statement Logic. Statement Logic...... Goals..... Syntax of Statement Logic....2.

More information

6.034 Notes: Section 10.1

6.034 Notes: Section 10.1 6.034 Notes: Section 10.1 Slide 10.1.1 A sentence written in conjunctive normal form looks like ((A or B or not C) and (B or D) and (not A) and (B or C)). Slide 10.1.2 Its outermost structure is a conjunction.

More information

Notes. Notes. Introduction. Notes. Propositional Functions. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry.

Notes. Notes. Introduction. Notes. Propositional Functions. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry Spring 2006 1 / 1 Computer Science & Engineering 235 Introduction to Discrete Mathematics Sections 1.3 1.4 of Rosen cse235@cse.unl.edu Introduction

More information

Chapter 1.3 Quantifiers, Predicates, and Validity. Reading: 1.3 Next Class: 1.4. Motivation

Chapter 1.3 Quantifiers, Predicates, and Validity. Reading: 1.3 Next Class: 1.4. Motivation Chapter 1.3 Quantifiers, Predicates, and Validity Reading: 1.3 Next Class: 1.4 1 Motivation Propositional logic allows to translate and prove certain arguments from natural language If John s wallet was

More information

Data Integration: Logic Query Languages

Data Integration: Logic Query Languages Data Integration: Logic Query Languages Jan Chomicki University at Buffalo Datalog Datalog A logic language Datalog programs consist of logical facts and rules Datalog is a subset of Prolog (no data structures)

More information

CS-171, Intro to A.I. Mid-term Exam Fall Quarter, 2013

CS-171, Intro to A.I. Mid-term Exam Fall Quarter, 2013 CS-171, Intro to A.I. Mid-term Exam Fall Quarter, 2013 YOUR NAME AND ID NUMBER: YOUR ID: ID TO RIGHT: ROW: NO. FROM RIGHT: The exam will begin on the next page. Please, do not turn the page until told.

More information

(More) Propositional Logic and an Intro to Predicate Logic. CSCI 3202, Fall 2010

(More) Propositional Logic and an Intro to Predicate Logic. CSCI 3202, Fall 2010 (More) Propositional Logic and an Intro to Predicate Logic CSCI 3202, Fall 2010 Assignments Next week: Guest lectures (Jim Martin and Nikolaus Correll); Read Chapter 9 (but you can skip sections on logic

More information

Lecture 4: January 12, 2015

Lecture 4: January 12, 2015 32002: AI (First Order Predicate Logic, Interpretation and Inferences) Spring 2015 Lecturer: K.R. Chowdhary Lecture 4: January 12, 2015 : Professor of CS (VF) Disclaimer: These notes have not been subjected

More information

DATABASE THEORY. Lecture 11: Introduction to Datalog. TU Dresden, 12th June Markus Krötzsch Knowledge-Based Systems

DATABASE THEORY. Lecture 11: Introduction to Datalog. TU Dresden, 12th June Markus Krötzsch Knowledge-Based Systems DATABASE THEORY Lecture 11: Introduction to Datalog Markus Krötzsch Knowledge-Based Systems TU Dresden, 12th June 2018 Announcement All lectures and the exercise on 19 June 2018 will be in room APB 1004

More information

CSE 20 DISCRETE MATH. Winter

CSE 20 DISCRETE MATH. Winter CSE 20 DISCRETE MATH Winter 2017 http://cseweb.ucsd.edu/classes/wi17/cse20-ab/ Final exam The final exam is Saturday March 18 8am-11am. Lecture A will take the exam in GH 242 Lecture B will take the exam

More information

Overview. CS389L: Automated Logical Reasoning. Lecture 6: First Order Logic Syntax and Semantics. Constants in First-Order Logic.

Overview. CS389L: Automated Logical Reasoning. Lecture 6: First Order Logic Syntax and Semantics. Constants in First-Order Logic. Overview CS389L: Automated Logical Reasoning Lecture 6: First Order Logic Syntax and Semantics Işıl Dillig So far: Automated reasoning in propositional logic. Propositional logic is simple and easy to

More information

Lecture Notes 15 Number systems and logic CSS Data Structures and Object-Oriented Programming Professor Clark F. Olson

Lecture Notes 15 Number systems and logic CSS Data Structures and Object-Oriented Programming Professor Clark F. Olson Lecture Notes 15 Number systems and logic CSS 501 - Data Structures and Object-Oriented Programming Professor Clark F. Olson Number systems The use of alternative number systems is important in computer

More information

Programming Languages Third Edition

Programming Languages Third Edition Programming Languages Third Edition Chapter 12 Formal Semantics Objectives Become familiar with a sample small language for the purpose of semantic specification Understand operational semantics Understand

More information

Prolog. Reading: Sethi, Chapter 11. Overview. Predicate Calculus. Substitution and Unication. Introduction to Prolog. Prolog Inference Rules

Prolog. Reading: Sethi, Chapter 11. Overview. Predicate Calculus. Substitution and Unication. Introduction to Prolog. Prolog Inference Rules Prolog Reading: Sethi, Chapter 11. Overview Predicate Calculus Substitution and Unication Introduction to Prolog Prolog Inference Rules Programming in Prolog - Recursion - List Processing - Arithmetic

More information

Preface Violine(stradivari1) 4string(stradivari1). x.violine(x) 4string(x)

Preface Violine(stradivari1) 4string(stradivari1). x.violine(x) 4string(x) circumscription Preface- FOL We have KB consist the sentence: Violine(stradivari1) We want to conclude it have 4 strings, there are exactly 2 possibilities. One is to add the explicit sentence: 4string(stradivari1).

More information

Chapter 2 & 3: Representations & Reasoning Systems (2.2)

Chapter 2 & 3: Representations & Reasoning Systems (2.2) Chapter 2 & 3: A Representation & Reasoning System & Using Definite Knowledge Representations & Reasoning Systems (RRS) (2.2) Simplifying Assumptions of the Initial RRS (2.3) Datalog (2.4) Semantics (2.5)

More information

Use lists. Use loops. Use conditionals. Define and use functions. Create and use code modules

Use lists. Use loops. Use conditionals. Define and use functions. Create and use code modules Hunt the Wumpus Objectives Use lists Use loops Use conditionals Define and use functions Create and use code modules Assignment Hunt the Wumpus is a game that has been around in computing for over 40 years.

More information

Operational Semantics

Operational Semantics 15-819K: Logic Programming Lecture 4 Operational Semantics Frank Pfenning September 7, 2006 In this lecture we begin in the quest to formally capture the operational semantics in order to prove properties

More information

Section Marks Pre-Midterm / 32. Logic / 29. Total / 100

Section Marks Pre-Midterm / 32. Logic / 29. Total / 100 Name: CS 331 Final Exam Spring 2011 You have 110 minutes to complete this final exam. You are only allowed to use your textbook, your notes, your assignments and solutions to those assignments during this

More information

Computation Club: Gödel s theorem

Computation Club: Gödel s theorem Computation Club: Gödel s theorem The big picture mathematicians do a lot of reasoning and write a lot of proofs formal systems try to capture the ideas of reasoning and proof in a purely mechanical set

More information

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions): CS 70 Discrete Mathematics for CS Fall 2003 Wagner Lecture 7 This lecture returns to the topic of propositional logic. Whereas in Lecture 1 we studied this topic as a way of understanding proper reasoning

More information

Introduction to Software Testing Chapter 3, Sec# 1 & 2 Logic Coverage

Introduction to Software Testing Chapter 3, Sec# 1 & 2 Logic Coverage Introduction to Software Testing Chapter 3, Sec# 1 & 2 Logic Coverage Paul Ammann & Jeff Offutt http://www.cs.gmu.edu/~offutt/soft waretest/ Ch. 3 : Logic Coverage Four Structures for Modeling Software

More information

6. Inference and resolution

6. Inference and resolution Computer Science and Software Engineering University of Wisconsin - Platteville 6. Inference and resolution CS 3030 Lecture Notes Yan Shi UW-Platteville Read: Textbook Chapter 8 Part of the slides are

More information

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions): CS 70 Discrete Mathematics for CS Spring 2005 Clancy/Wagner Notes 7 This lecture returns to the topic of propositional logic. Whereas in Lecture Notes 1 we studied this topic as a way of understanding

More information

CS 416, Artificial Intelligence Midterm Examination Fall 2004

CS 416, Artificial Intelligence Midterm Examination Fall 2004 CS 416, Artificial Intelligence Midterm Examination Fall 2004 Name: This is a closed book, closed note exam. All questions and subquestions are equally weighted. Introductory Material 1) True or False:

More information

Diagonalization. The cardinality of a finite set is easy to grasp: {1,3,4} = 3. But what about infinite sets?

Diagonalization. The cardinality of a finite set is easy to grasp: {1,3,4} = 3. But what about infinite sets? Diagonalization Cardinalities The cardinality of a finite set is easy to grasp: {1,3,4} = 3. But what about infinite sets? We say that a set S has at least as great cardinality as set T, written S T, if

More information

Part I Logic programming paradigm

Part I Logic programming paradigm Part I Logic programming paradigm 1 Logic programming and pure Prolog 1.1 Introduction 3 1.2 Syntax 4 1.3 The meaning of a program 7 1.4 Computing with equations 9 1.5 Prolog: the first steps 15 1.6 Two

More information

Chapter 3. Describing Syntax and Semantics

Chapter 3. Describing Syntax and Semantics Chapter 3 Describing Syntax and Semantics Chapter 3 Topics Introduction The General Problem of Describing Syntax Formal Methods of Describing Syntax Attribute Grammars Describing the Meanings of Programs:

More information

Knowledge Representation

Knowledge Representation Knowledge Representation References Rich and Knight, Artificial Intelligence, 2nd ed. McGraw-Hill, 1991 Russell and Norvig, Artificial Intelligence: A modern approach, 2nd ed. Prentice Hall, 2003 Outline

More information

First-Order Logic PREDICATE LOGIC. Syntax. Terms

First-Order Logic PREDICATE LOGIC. Syntax. Terms First-Order Logic PREDICATE LOGIC Aim of this lecture: to introduce first-order predicate logic. More expressive than propositional logic. Consider the following argument: all monitors are ready; X12 is

More information

CS Bootcamp Boolean Logic Autumn 2015 A B A B T T T T F F F T F F F F T T T T F T F T T F F F

CS Bootcamp Boolean Logic Autumn 2015 A B A B T T T T F F F T F F F F T T T T F T F T T F F F 1 Logical Operations 1.1 And The and operator is a binary operator, denoted as, &,, or sometimes by just concatenating symbols, is true only if both parameters are true. A B A B F T F F F F The expression

More information

Recursively Enumerable Languages, Turing Machines, and Decidability

Recursively Enumerable Languages, Turing Machines, and Decidability Recursively Enumerable Languages, Turing Machines, and Decidability 1 Problem Reduction: Basic Concepts and Analogies The concept of problem reduction is simple at a high level. You simply take an algorithm

More information

Towards a Logical Reconstruction of Relational Database Theory

Towards a Logical Reconstruction of Relational Database Theory Towards a Logical Reconstruction of Relational Database Theory On Conceptual Modelling, Lecture Notes in Computer Science. 1984 Raymond Reiter Summary by C. Rey November 27, 2008-1 / 63 Foreword DB: 2

More information

Propositional logic (Ch. 7)

Propositional logic (Ch. 7) Propositional logic (Ch. 7) Announcements Writing 2 graded - 2 weeks from today to resubmit Complete-state CSP So far we have been looking at incremental search (adding one value at a time) Complete-state

More information

STABILITY AND PARADOX IN ALGORITHMIC LOGIC

STABILITY AND PARADOX IN ALGORITHMIC LOGIC STABILITY AND PARADOX IN ALGORITHMIC LOGIC WAYNE AITKEN, JEFFREY A. BARRETT Abstract. Algorithmic logic is the logic of basic statements concerning algorithms and the algorithmic rules of deduction between

More information

Definition: A context-free grammar (CFG) is a 4- tuple. variables = nonterminals, terminals, rules = productions,,

Definition: A context-free grammar (CFG) is a 4- tuple. variables = nonterminals, terminals, rules = productions,, CMPSCI 601: Recall From Last Time Lecture 5 Definition: A context-free grammar (CFG) is a 4- tuple, variables = nonterminals, terminals, rules = productions,,, are all finite. 1 ( ) $ Pumping Lemma for

More information