1 / 56

USING PREDICTABLE LOGIC

USING PREDICTABLE LOGIC. Predicate logic.

goldiet
Download Presentation

USING PREDICTABLE 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. USING PREDICTABLE LOGIC

  2. Predicate logic • A predicate logic is a formal system that uses variables and quantifiers ( ∀ , ∃ , ∃ ! ) to formulate propositions. The first of these, predicate logic, involves using standard forms of logical symbolism which have been familiar to philosophers and mathematicians for many decades. • propositions that can either be false or true. Those propositions can be combined (∧,∨,⇒,⇔,¬∧,∨,⇒,⇔,¬ and more, but all others can be represented by those logical connectives). • A predicate logic is a formal system that uses variables and quantifiers (∀∀, ∃∃, ∃!∃!) to formulate propositions. • SUBJECT: - The subject is that about which something is said. • PREDICATE:- The predicate is the part of the preposition which denotes that what is affirmed or denied about the subject. • COPULA:- The copula is that part of the preposition which denotes the relations between the subject and the predicate.

  3. Predicate logic(cont..) • As for example: • MAN IS CULTURED SUBJECT -> MAN PREDICATE-> CULTURED COPULA-> IS • A predicate is a function p:X→{true,false}p:X→{true,false} where XX is any set.

  4. Predicate logic Symbol

  5. Represent the Basic Fact in Logic Form • SOCRATES IS A MAN MAN( SOCRATES) • PLATO IS A MAN MAN( PLATO) • The attribute “is a” which is being used to show class inclusion and the attribute “instance” which is being used to show class membership . These two specific attributes provide the basis for property inheritance as an inference technique . Using this technique the knowledge base has been explicitly stored. Is a attribute produces the indirect relationship between the objects

  6. Predicate Calculus

  7. First-order logic 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,

  8. Syntax of FOL: Basic elements Constants TaoiseachJohn, 2, DIT,... Predicates Brother, >,... Functions Sqrt, LeftLegOf,... Variables x, y, a, b,... Connectives , , , ,  Equality = Quantifiers , 

  9. Translating English to FOL • Every gardener likes the sun. • (x) gardener(x) => likes(x,Sun) • Not Every gardener likes the sun. • ~((x) gardener(x) => likes(x,Sun)) • You can fool some of the people all of the time. • (x)(t) person(x) ^ time(t) => can-be-fooled(x,t) • You can fool all of the people some of the time. • (x)(t) person(x) ^ time(t) => can-be-fooled(x,t) • (the time people are fooled may be different) • You can fool all of the people at some time. • (t)(x) person(x) ^ time(t) => can-be-fooled(x,t) • (all people are fooled at the same time) • You can not fool all of the people all of the time. • ~((x)(t) person(x) ^ time(t) => can-be-fooled(x,t)) • Everyone is younger than his father • (x) person(x) => younger(x, father(x))

  10. Translating English to FOL • All purple mushrooms are poisonous. • (x) (mushroom(x) ^ purple(x)) => poisonous(x) • No purple mushroom is poisonous. • ~(x) purple(x) ^ mushroom(x) ^ poisonous(x) • (x) (mushroom(x) ^ purple(x)) => ~poisonous(x) • There are exactly two purple mushrooms. • (x)(Ey) mushroom(x) ^ purple(x) ^ mushroom(y) ^ purple(y) ^ ~(x=y) ^ • (z) (mushroom(z) ^ purple(z)) => ((x=z) v (y=z)) • Clinton is not tall. • ~tall(Clinton) • X is above Y if X is directly on top of Y or there is a pile of one or more other objects directly on top of one another starting with X and ending with Y. • (x)(y) above(x,y) <=> (on(x,y) v (z) (on(x,z) ^ above(z,y)))

  11. Translating English to FOL • Build a small genealogy knowledge base by FOL that • contains facts of immediate family relations (spouses, parents, etc.) • contains definitions of more complex relations (ancestors, relatives) • is able to answer queries about relationships between people • Predicates: • parent(x, y), child (x, y), father(x, y), daughter(x, y), etc. • spouse(x, y), husband(x, y), wife(x,y) • ancestor(x, y), descendent(x, y) • relative(x, y) • Facts: • husband(Joe, Mary), son(Fred, Joe) • spouse(John, Nancy), male(John), son(Mark, Nancy) • father(Jack, Nancy), daughter(Linda, Jack) • daughter(Liz, Linda) • etc.

  12. Atomic sentences Atomic sentence = predicate (term1,...,termn) or term1 = term2 Term = function (term1,...,termn) or constant or variable E.g., Brother(TaoiseachJohn,RichardTheLionheart) > (Length(LeftLegOf(Richard)), Length(LeftLegOf(TaoiseachJohn)))

  13. Horn clause Horn clause is a logical formula of a particular rule-like form which gives it useful properties for use in logic programming, formal specification, and model theory. Horn clauses are named for the logician Alfred Horn,  A Horn clause is a clause (a disjunction of literals) with at most one positive, i.e. unnegated, literal. Conversely, a disjunction of literals with at most one negated literal is called a dual-Horn clause. A Horn clause with exactly one positive literal is a definite clause; a definite clause with no negative literals is sometimes called a fact; and a Horn clause without a positive literal is sometimes called a goal clause

  14. Horn clause Cont.. A Horn clause is either a definite clause or an integrity constraint. That is, a Horn clause has either false or a normal atom as its head. Integrity constraints allow the system to prove that some conjunction of atoms is false in all models of a knowledge base - that is, to prove disjunctions of negations of atoms. Recall that ¬p is the negation of p, which is true in an interpretation when p is false in that interpretation, and p∨q is the disjunction of p and q, which is true in an interpretation if p is true or q is true or both are true in the interpretation.

  15. Horn clause Cont.. The integrity constraint false←a1∧...∧ak is logically equivalent to ¬a1∨...∨¬ak. A Horn clause knowledge base can imply negations of atoms, as shown in Example 5.16. Example : Consider the knowledge base KB1: false←a∧b.a←c.b←c. The atom c is false in all models of KB1. If c were true in model I of KB1, then a and b would both betrue in I (otherwise I would not be a model of KB1). Because false is false in I and a and b are true in I, the first clause is false in I, a contradiction to I being a model of KB1. Thus, c is false in all models of KB1. This is expressed as KB1   ¬c

  16. Semantic Net A semantic net (or semantic network) is a knowledge representation technique used for propositional information. So it is also called a propositional net. Semantic nets convey meaning. They are two dimensional representations of knowledge. Mathematically a semantic net can be defined as a labelled directed graph. Semantic nets consist of nodes, links (edges) and link labels. In the semantic network diagram, nodes appear as circles or ellipses or rectangles to represent objects such as physical objects, concepts or situations. Links appear as arrows to express the relationships between objects, and link labels specify particular relations. Relationships provide the basic structure for organizing knowledge. The objects and relations involved need not be so concrete. As nodes are associated with other nodes semantic nets are also referred to as associative nets.

  17. Semantic Net Cont.. In the above figure all the objects are within ovals and connected using labelled arcs. Note that there is a link between Jill and FemalePersons with label MemberOf. Simlarly there is a MemberOf link between Jack and MalePersons and SisterOf link between Jill and Jack. The MemberOf link between Jill and FemalePersons indicates that Jill belongs to the category of female persons.

  18. DISADVANTAGE OF SEMANTIC NETS One of the drawbacks of semantic network is that the links between the objects represent only binary relations. For example, the sentence Run(ChennaiExpress, Chennai,Bangalore,Today) cannot be asserted directly. There is no standard definition of link names.

  19. ADVANTAGES OF SEMANTIC NETS Semantic nets have the ability to represent default values for categories. In the above figure Jack has one leg while he is a person and all persons have two legs. So persons have two legs has only default status which can be overridden by a specific value. They convey some meaning in a transparent manner. They nets are simple and easy to understand.

  20. Standardisation of Network Relationships Semantic network developed by Collins and Quillian in their research on human information storage and response times (Harmon and King, 1985)

  21. Standardisation of Network Relationships Semantic Network representation of properties of snow and ice E.g. What is common about ice and snow?

  22. Exercises • Try to represent the following two sentences into the appropriate semantic network diagram: • isa(person, mammal) • instance(Mike-Hall, person) all in one graph • team(Mike-Hall, Cardiff) • score(Cardiff, Llanelli, 23-6) • John gave Mary the book

  23. Solution 1 • isa(person, mammal), instance(Mike-Hall, person), team(Mike-Hall, Cardiff) mammal is_a has_part person head is_a team Mike Hall Cardiff

  24. Solution 2 • score(Spurs, Norwich, 3-1) Game Is_a Score Away_team Spurs Fixture 5 3 - 1 Home_team Norwich

  25. Solution 3 • John gave Mary the book Gave Book Action Instance Agent Object John Event 1 Book_69 Patient Mary

  26. Advantages of Semantic Networks • Easy to visualise and understand. • The knowledge engineer can arbitrarily defined the relationships. • Related knowledge is easily categorised. • Efficient in space requirements. • Node objects represented only once. • Standard definitions of semantic networks have been developed.

  27. Limitations of Semantic Networks • The limitations of conventional semantic networks were studied extensively by a number of workers in AI. • Many believe that the basic notion is a powerful one and has to be complemented by, for example, logic to improve the notion’s expressive power and robustness. • Others believe that the notion of semantic networks can be improved by incorporating reasoning used to describe events.

  28. who where John cause party what trouble Limitations of Semantic Networks • Binary relations are usually easy to represent, but some times is difficult. • E.g. try to represent the sentence: • "John caused trouble to the party".

  29. Limitations of Semantic Networks • Other problematic statements. . . • negation "John does not go fishing"; • disjunction "John eats pizza or fish and chips"; • … • Quantified statements are very hard for semantic nets. E.g.: • "Every dog has bitten a postman" • "Every dog has bitten every postman" • Solution: Partitioned semantic networks can represent quantified statements.

  30. Partitioned Semantic Networks • Hendrix (1976 : 21-49, 1979 : 51-91) developed the so-called partitioned semantic network to represent the difference between the description of an individual object or process and the description of a set of objects. The set description involves quantification. • Hendrix partitioned a semantic network whereby a semantic network, loosely speaking, can be divided into one or more networks for the description of an individual.

  31. Partitioned Semantic Networks • The central idea of partitioning is to allow groups, nodes and arcs to be bundled together into units called spaces – fundamental entities in partitioned networks, on the same level as nodes and arcs (Hendrix 1979:59). • Every node and every arc of a network belongs to (or lies in/on) one or more spaces. • Some spaces are used to encode 'background information' or generic relations; others are used to deal with specifics called 'scratch' space.

  32. S1 dog bite postman is_a is_a is_a agent patient Danny B Peter Partitioned Semantic Networks • Suppose that we wish to make a specific statement about a dog, Danny, who has bitten a postman, Peter: • " Danny the dog bit Peter the postman“ • Hendrix’s Partitioned network would express this statement as an ordinary semantic network:

  33. SA General Statement dog bite postman is_a S1 is_a is_a is_a form G agent patient D B P Partitioned Semantic Networks • Suppose that we now want to look at the statement: • "Every dog has bitten a postman" • Hendrix partitioned semantic network now comprises two partitions SA and S1. Node G is an instance of the special class of general statements about the world comprising link statement, form, and one universal quantifier

  34. SA General Statement dog bite postman is_a S1 is_a is_a is_a form G agent patient D B P Partitioned Semantic Networks • Suppose that we now want to look at the statement: • "Every dog has bitten every postman"

  35. SA dog ako General Statement town dog bite postman is_a S1 is_a is_a is_a form G agent patient D B P Partitioned Semantic Networks • Suppose that we now want to look at the statement: • "Every dog in town has bitten the postman" NB: 'ako' = 'A Kind Of'

  36. Partitioned Semantic Networks • The partitioning of a semantic network renders them more • logically adequate, in that one can distinguish between individuals and sets of individuals, • and indirectly more heuristically adequate by way of controlling the search space by delineating semantic networks. • Hendrix's partitioned semantic networks-oriented formalism has been used in building natural language front-ends for data bases and for programs to deduct information from databases.

  37. Exercises • Try to represent the following two sentences into the appropriate semantic network diagram: • "John believes that pizza is tasty" • "Every student loves to party"

  38. believes is_a agent John event object space tasty pizza is_a is_a has object property Solution 1: "John believes that pizza is tasty"

  39. General Statement is_a is_a GS1 student party love form is_a S1 is_a is_a S2 form GS2 exists receiver p1 l1 s1 agent Solution 2: "Every student loves to party"

  40. frame A frame is an artificial intelligencedata structure used to divide knowledgeinto substructures by representing "stereotyped situations." Frames are the primary data structure used in artificial intelligence frame language. Frames are also an extensive part of knowledge representation and reasoning schemes. Frames were originally derived from semantic networks and are therefore part of structure based knowledge representations. According to Russell and Norvig's "Artificial Intelligence, A Modern Approach," structural representations assemble "...facts about particular object and event types and arrange the types into a large taxonomic hierarchy analogous to a biological taxonomy.“ The frame contains information on how to use the frame, what to expect next, and what to do when these expectations are not met. Some information in the frame is generally unchanged while other information, stored in "terminals,” usually change. Different frames may share the same terminals.

  41. Frame Cont.. • Each piece of information about a particular frame is held in a slot. The information can contain: • Facts or Data • Values (called facets) • Procedures (also called procedural attachments) • IF-NEEDED : deferred evaluation • IF-ADDED : updates linked information • Default Values • For Data • For Procedures • Other Frames or Subframe

  42. Frame Cont.. Frame is a type of schema used in many AI applications including vision and natural language processing. Frames provide a convenient structure for representing objects that are typical to a stereotypical situations. The situations to represent may be visual scenes, structure of complex physical objects, etc. Frames are also useful for representing commonsense knowledge. As frames allow nodes to have structures they can be regarded as three-dimensional representations of knowledge. A frame is similar to a record structure and corresponding to the fields and values are slots and slot fillers. Basically it is a group of slots and fillers that defines a stereotypical object. A single frame is not much useful. Frame systems usually have collection of frames connected to each other. Value of an attribute of one frame may be another frame.

  43. Frame Cont.. A frame for a book is given below. The above example is simple one but most of the frames are complex. Moreover with filler slots and inheritance provided by frames powerful knowledge representation systems can be built. Frames can represent either generic or frame. Following is the example for generic frame.

  44. Frame Cont.. The fillers may values such as computer in the name slot or a range of values as in types slot. The procedures attached to the slots are called procedural attachments. There are mainly three types of procedural attachments: if-needed, default and if-added. As the name implies if-needed types of procedures will be executed when a filler value is needed. Default value is taken if no other value exists. Defaults are used to represent commonsense knowledge. Commonsense is generally used when no more situation specific knowledge is available. The if-added type is required if any value is to be added to a slot. In the above example, if a new type of computer is invented ADD_COMPUTER procedure should be executed to add that information. An if-removed type is used to remove a value from the slot.

  45. Mammal subclass: Animal warm_blooded: yes Elephant subclass: Mammal * colour: grey * size: large Clyde instance: Elephant color: pink owner: Fred Example

  46. Components of a Frame Entity • Name - correspond to a node in a semantic net • Attributes or slots filled with particular values • E.G. in the frame for Clyde, instance is the name of a slot, and elephant is the value of the slot. • Names of slots correspond to the links in semantic nets • Values of slots correspond to nodes. • Hence each slot can be another frame.

  47. Size: instance: Slot single_valued: yes range: Size-set Owner: instance: Slot single_valued: no range: Person Fred: instance: Person occupation: Elephant-breeder Example

  48. Resolution resolution is a rule of inference leading to a refutationtheorem-proving technique for sentences in propositional logic and first-order logic. In other words, iteratively applying the resolution rule in a suitable way allows for telling whether a propositional formula is satisfiable and for proving that a first-order formula is unsatisfiable. Attempting to prove a satisfiable first-order formula as unsatisfiable may result in a nonterminating computation; this problem doesn't occur in propositional logic.

  49. Forwards vs Backwards Reasoning Whether you use forward or backwards reasoning to solve a problem depends on the properties of your rule set and initial facts. Sometimes, if you have some particular goal (to test some hypothesis), then backward chaining will be much more efficient, as you avoid drawing conclusions from irrelevant facts. However, sometimes backward chaining can be very wasteful - there may be many possible ways of trying to prove something, and you may have to try almost all of them before you find one that works. Forward chaining may be better if you have lots of things you want to prove (or if you just want to find out in general what new facts are true); when you have a small set of initial facts; and when there tend to be lots of different rules which allow you to draw the same conclusion. Backward chaining may be better if you are trying to prove a single fact, given a large set of initial facts, and where, if you used forward chaining, lots of rules would be eligible to fire in any cycle.

  50. Forwards vs Backwards Reasoning Cont.. A search procedure must find a path between initial and goal states. There are two directions in which a search process could proceed. (1) Reason forward from the initial states: Being form the root of the search tree. General the next level of the tree by finding all the rules whose left sides match the root node, and use their right sides to generate the siblings. Repeat the process until a configuration that matches the goal state is generated. (2) Reason forward from the goal state(s): Begin building a search tree starting with the goal configuration(s) at the root. Generate the next level of the tree by finding all the rules whose right sides match with the root node. Use the left sides of the rules to generate the new nodes. Continue until a node that matches the start state is generated. This method of chaining backward from the desired final state is called goal directed reasoning or back tracing. Selection of forward reasoning or backward reasoning depends on which direction offers less branching factor and justifies its reasoning process to the user. Most of the search techniques can be used to search either forward or backward. One exception is the means-ends analysis technique which proceeds by reducing differences between current and goal states, sometimes reasoning forward and sometimes backward.

More Related