Logics. The lecture Set theory Boolean Logic Logic reasoning Fuzzy sets Fuzzy logic Fuzzy reasoning...

Click here to load reader

download Logics. The lecture Set theory Boolean Logic Logic reasoning Fuzzy sets Fuzzy logic Fuzzy reasoning Implementing fuzzy logic in Java

of 75

  • date post

    05-Jan-2016
  • Category

    Documents

  • view

    249
  • download

    5

Embed Size (px)

Transcript of Logics. The lecture Set theory Boolean Logic Logic reasoning Fuzzy sets Fuzzy logic Fuzzy reasoning...

  • Logics

  • The lectureSet theoryBoolean LogicLogic reasoning

    Fuzzy setsFuzzy logicFuzzy reasoningImplementing fuzzy logic in Java

  • Paradoxes and impossibilitiesZenosCantorRussellGdelTuring

  • Logic - classic

  • Basic set theory(Nave or basic) Set theory was developed at the end of the 19th century (principally by Georg Cantor and Frege) in order to allow mathematicians to work with infinite sets consistently. A set is described as a collection of objects. Those objects that belong to a set are called its members.If x is a member of A, then we also say that x is an element of A, or that x belongs to A, or that x is in A, or that A owns x, that is expressed by xA.We define two sets to be equal when they have precisely the same elements (denoted symbolically as A=B ).

  • Basic set theory (cont.)The simplest way to describe a set is to list its elements between curly braces. Thus {1,2} denotes the set whose only elements are 1 and 2. Note the following points: Order of elements is immaterial; for example, {1,2} = {2,1}. Repetition of elements is irrelevant; for example, {1,2,2} = {1,1,1,2} = {1,2}. We can also use the notation {x|P(x)} to denote the set containing all objects for which the condition P holds. For example:{x| xis a dog} denotes the set {dogs} of all dogs.

  • Basic set theory (cont.)Subsets: given two sets A and B we say that A is a subset of B, if every element of A is also an element of B.

    A3526UniverseA = {2,6}U = { 2,3,5,6}

    A subset U

    2 A3 AVenn diagrams

  • Basic set theory (cont.)Intersections, unions, and relative complements Given two sets A and B, we may construct their union. This is the set consisting of all objects which are elements of A or of B or of both. It is denoted by AB. The intersection of A and B is the set of all objects which are both in A and in B. It is denoted by AB. Finally, the relative complement of B relative to A, is the set of all objects that belong to A but not to B. It is written as A\B.

    Symbolically, these are respectively: AB:= { x| (xA)or (xB) } AB:= { x| (xA)and (xB) }A\B := {x| (xA)andnot (xB) }

  • Basic set theory (cont.)A36Universe25BA = {2,6}B = {2,5}U = { 2,3,5,6}

    A B = { 2 }Intersection

  • Basic set theory (cont.)A36Universe25BA = {2,6}B = {2,5}U = { 2,3,5,6}

    A B = { 2,5,6 }Union

  • Basic set theory (cont.)Now let E be the set of all human beings, and let F be the set of all living things over 1000 years old. What is EF in this case? No human being is over 1000 years old, so EF must be the empty set {}.

    Cardinality:#A = number of elements of A

    If A={1,4,6} then #A = 3#{} = 0#N = infinity

  • Basic set theory - linksEvolution of set theory http://en.wikipedia.org/wiki/Set_theory http://en.wikipedia.org/wiki/Basic_Set_TheoryVenn diagrams http://en.wikipedia.org/wiki/Venn_diagram

  • Boolean algebraIt is named after George Boole, an Englishman, who first defined them as part of a system of logic in the mid 19th century. Boolean algebra was an attempt to use algebraic techniques to deal with expressions in the propositional calculus. Today, Boolean algebras find many applications in electronic design.

  • Boolean algebra (cont.)We needA set {0,1} and three operators , ,

  • Boolean algebra (cont.)p | q |p q|p q| p0 | 0 |0| 0|10 | 1 |0| 1|11 | 0 |0| 1|01 | 1 |1| 1|0

  • Boolean algebra (cont.)Visualizing OperatorsAnother way:http://florin.syr.edu/webarch/searchpro/boolean_tutorial.html pUniverseqU = 1{ } = 0

    p q = p qp q= p q p\U= p

  • Boolean algebra (cont.)p q = ( p q )(X)p q = ( p q )De Morgans rulesVisual proof of De Morgan rule (X)pUqp q = ( p\U q\U ) \U

  • pUqp q = ( p\U q\U ) \Up\UpUqq\U( p\U q\U )pUq( p\U q\U ) \UpUq

  • Boole and boolean algebra - linkshttp://en.wikipedia.org/wiki/Boolehttp://en.wikipedia.org/wiki/Boolean_algebrahttp://en.wikipedia.org/wiki/Logic_gate What's so logical about boolean algebra? http://www.home.gil.com.au/~bredshaw/boolean.htm http://www2.kcma.edu/library2/boolean.html

  • LogicFormal logic, also called symbolic logic, is concerned primarily with the structure of reasoning. Formal logic deals with the relationships between concepts and provides a way to compose proofs of statements. In formal logic, concepts are rigorously defined, and sentences are translated into a precise, compact, and unambiguous symbolic notation. Some examples of symbolic notation are: p: 1 + 2 = 3 This statement defines p is 1 + 2 = 3 and that is true. Two propositions can be combined using the operations of conjunction, disjunction or conditional. These are called binary logical operators. Such combined propositions are called compound propositions. For example:p: 1 + 1 = 2 and "logic is the study of reasoning." http://en.wikipedia.org/wiki/Propositional_calculus

  • Predicate logic (Gottlob Frege)Sentential logic explains the workings of words such as "and", "but", "or", "not", "if-then", "if and only if", and "neither-nor". Frege expanded logic to include words such as "all", "some", and "none". He showed how we can introduce variables and "quantifiers" to rearrange sentences. "All humans are mortal" becomes "All things x are such that, if x is a human then x is mortal." which may be written symbolically

  • Predicate logic (cont.)"Some humans are vegetarian" becomes "There exists some (at least one) thing x such that x is human and x is vegetarian" which may be written symbolically

    Frege's work started contemporary formal logic.

  • Predicate logic (cont.)p | q |p q|p q| p xor q0 | 0 |1| 1|00 | 1 |1| 0|11 | 0 |0| 0|11 | 1 |1| 1|0

    p q q p = p q

  • Special cases!

    p p = falsep p = true

    Modus ponens

    a b , a------------ b

    Example: (MonsterAhead MonsterAlive) Shoot , (MonsterAhead MonsterAlive)----------------------------------------------------------------------------------------------------Shoot1- If the monster is ahead and it is alive then I should shoot.2- I know that the monster is ahead and it is alive 3- Then I infer: we have to shoot!

  • Wumpus worldWumpus: The central monster (and, in many versions, the name) of a famous family of very early computer games called "Hunt The Wumpus'. The original was invented in 1970 by Gregory Yob. The wumpus lived somewhere in a cave; the player started somewhere at random in the cave with one arrow, that would kill the wumpus on a hit. Unfortunately for players, the movement necessary to map the maze was made hazardous not merely by the wumpus (which would eat you if you stepped on him) but also by bottomless pits. Play with the wumpushttp://www.taylor.org/~patrick/wumpus/ Definition:http://info.astrian.net/jargon/terms/w/wumpus.htmlhttp://scv.bu.edu/htbin/wcl

  • Wumpus world (cont.)The wumpus is a terrible beast of whom none as lived to describe. The only real things known is that it generally sleeps in one place unless disturbed, has very strong smell which can be smelt in neibouring rooms. In our version it is not moving!When you are close to a pit (1 cell distance), you feel a breeze.

  • Wumpus world (cont.)In a square the agent gets a vector of percepts, with components Stench,Breeze,Glitter,Bump,Scream For example [Stench,None,Glitter,None,None]

    Stench is perceived at a square iff the wumpus is at this square or in its neighborhood. Breeze is perceived at a square iff a pit is in the neighborhood of this square. Glitter is perceived at a square iff gold is in this square Bump is perceived at a square iff the agent goes Forward into a wall Scream is perceived at a square iff the wumpus is killed anywhere in the cave

  • Wumpus world (cont.)An agent can do the following actions (one at a time): Turn(Right), Turn(Left), Forward, Shoot, Grab, Release, Climb The agent can go Forward in the direction it is currently facing, or Turn Right, or Turn Left. Going Forward into a wall will generate a Bump percept. The agent has a single arrow that it can Shoot. It will go straight in the direction faced by the agent until it hits (and kills) the wumpus, or hits (and is absorbed by) a wall. The agent can Grab a portable object at the current square or it can Release an object that it is holding. The agent can Climb out of the cave if at the Start square.

  • Wumpus world (cont.)Reasoning

    BreezeAt(2,2) ( PitAt(2,3) PitAt(1,2) PitAt(2,1) PitAt(3,2) )Then we step into 2,3 and there is no pit there, so we move in 3,3 and there is no breeze:BreezeAt(2,2) PitAt(2,3) BreezeAt(3,3)

    We infer that there cannot be a pit in 3,2!!(...using inference rules)The pit must be in 1,2 or 2,1.2,22,33,22,11,22,2 P3,22,11,2 B

  • Logic - linksDefinition and history of Logic: http://en.wikipedia.org/wiki/Logic#Formal_logic Predicate logic http://en.wikipedia.org/wiki/Logic#Predicate_logic http://en.wikipedia.org/wiki/Propositional_calculus Wumpus world http://www.cis.temple.edu/~ingargio/cis587/readings/wumpus.shtml http://www.math.vanderbilt.edu/~schectex/logics/

  • Logic - fuzzy

  • Fuzzy set theoryFuzzy sets are an extension of the classical set theory.A fuzzy set is characterized by a membership-degree function, which maps the members of the universe into the unit interval [0,1]. The value 0 means that the member is not included in the given set, 1 describes a fully included member (this behaviour corresponds to the classical sets). The values between 0 and 1 characterize fuzzy members.

  • Fuzzy set theory (cont.)Lets define the fuzzy set Young. The universe is the set of all persons,The membership function is defined as:

    0, if age=55

  • Fuzzy set theor