Fuzzy Relations Adriano Joaquim de O Cruz ©2009 NCE/UFRJ adriano@nce.ufrj.br Summary Introduction Crisp Relations Operations with Crisp Relations Fuzzy Relations Operations with Fuzzy Relations @2009 Adriano Cruz NCE e IM - UFRJ Relations 2 Introduction Relations are associations between elements of two or more sets. If the degree of association is one or zero there is a crisp association. Degrees of association can be between 0 and 1 in a fuzzy relation For example the relation x is greater than y. @2009 Adriano Cruz NCE e IM - UFRJ Relations 3 Functions and Relations Functions and Relations are mappings. Functions are many to one mappings. Relations can map many to many. @2009 Adriano Cruz NCE e IM - UFRJ Relations 4 Functions X @2009 Adriano Cruz f(X) NCE e IM - UFRJ Y Relations 5 Relations X @2009 Adriano Cruz f(X) NCE e IM - UFRJ Y Relations 6 Cartesian Product The Cartesian product of two crisp sets X and Y is defined as X Y {( x, y ) | x X e y Y } For n sets (Xi) the Cartesian product is defined as X 1 X 2 X n {( x1 , x2 , , xn ) | xi X i , i 1..n} @2009 Adriano Cruz NCE e IM - UFRJ Relations 7 Crisp Relations An relation is a subset of the Cartesian R( X 1 , X 2 ,, X n ) X 1 X 2 X n product The Cartesian product can be considered a relation without restrictions. A relation is also a set, therefore the basic set concepts such as union, intersection, complement, … can be applied. @2009 Adriano Cruz NCE e IM - UFRJ Relations 8 Crisp Relations Characteristic Function Shows the strength of the relation between the pairs. 1 ( x, y ) R R ( x, y ) 0 ( x, y ) R Every tuple that belongs to the relation receives a value 1 and 0 otherwise. @2009 Adriano Cruz NCE e IM - UFRJ Relations 10 Binary Relations A relation between two sets X and Y is called a binary relation (R(X,Y)). Binary relations can be defined on a single set (R(X,X)). These relations are often referred as directed graphs or digraphs @2009 Adriano Cruz NCE e IM - UFRJ Relations 11 Representing Relations Sets of ordered tuples. Consider a family and the relation is cousin of X { Beatriz , Clara , Débora , Marco } R cousin of R XX R {( Beatriz, Débora), ( Beatriz, Marco), (Clara, Débora), (Clara, Marco), ( Débora, Beatriz), ( Débora, Clara), ( Marco, Beatriz), ( Marco, Clara)} @2009 Adriano Cruz NCE e IM - UFRJ Relations 12 Representing Relations N-dimensional membership matrices Cousin Beatriz Clara Débora Marco @2009 Adriano Cruz Beatriz Clara Débora Marco 0 0 1 1 0 0 1 1 1 1 1 1 NCE e IM - UFRJ 0 0 0 0 Relations 13 Representing Relations Diagrams that display elements as points and the relations as arrows between points (Sagittal diagrams). Beatriz Beatriz Clara Clara Débora Débora Marco Marco @2009 Adriano Cruz NCE e IM - UFRJ Relations 14 Representing Relations Simple Diagrams. Beatriz Débora Clara Marco @2009 Adriano Cruz NCE e IM - UFRJ Relations 15 Representing Relations Equations x, y X x R y @2009 Adriano Cruz NCE e IM - UFRJ Relations 16 Special Relations Consider a set A={0,1,2} and the relations shown below on A A Identity Relation I = {0,0),(1,1),(2,2)} Universal Relation U={(0,0),(0,1),(0,2),(1,0),(1,1),(1,2),(2,0) ,(2,1),(2,2)} @2009 Adriano Cruz NCE e IM - UFRJ Relations 17 Relations - Continuous Universes y 2x R {( x, y ) | y 2 x, x X , y Y } 1 R ( x, y ) 0 @2009 Adriano Cruz NCE e IM - UFRJ y 2x y 2x Relations 18 Crisp Relation Properties Let X and Y be two sub-sets defined on an universe X. Consider the elements x and y. Let S be the Cartesian product X Y . Let R be a binary relation defined on S. Let Q be a binary relation defined on X X. @2009 Adriano Cruz NCE e IM - UFRJ Relations 19 Properties of Crisp Binary Relations Reflexive: Q is reflexive if and only if (x,x)R for every xX. Irreflexive: Q is irreflexive if there is at least one x such as (x,x)R. Antireflexive: Q is antireflexive if (x,x) R for all xX. @2009 Adriano Cruz NCE e IM - UFRJ Relations 20 Examples of Reflexive Relations Is greater/less than or equal to x Is a subset of 1 2 3 4 5 Divides 1 √ √ √ √ Is equal to 2 √ √ √ 3 4 5 @2009 Adriano Cruz NCE e IM - UFRJ √ √ √ Relations 21 Ex of Anti-Reflexive Relations Is not equal to Is greater than Is coprime x x>y 1 2 3 4 y @2009 Adriano Cruz 5 NCE e IM - UFRJ 1 2 3 4 5 X √ √ √ √ X √ √ √ X √ √ X √ X Relations 22 Properties of Crisp Relations Symmetric: R is symmetric if and only if (x,y)R e (y,x)R for all element xX e yY. Asymmetric: R is asymmetric if there is no elements xX and yY such as (x,y)R and (y,x)R. Antisymmetric: R is antisymmetric if for all xX and yY, whenever (x,y)R and (y,x)R then x=y. @2009 Adriano Cruz NCE e IM - UFRJ Relations 23 Examples of Symmetric Relations Is odd … and is odd too Is married to Is equal to 1 y @2009 Adriano Cruz 1 2 √ 3 4 √1 5 √2 2 3 x is odd and y is odd too x √1 √ √3 √2 √3 √ 4 5 NCE e IM - UFRJ Relations 24 Properties of Crisp Relations Transitive: R is transitive if for all x,y,z X, if (x,y)R and (y,z) R then (x,z)R. Antitransitive: R is antitransitive if (x,z) R, whenever (x,y)R and (y,z) R. Connected: R is connected if for all x,y X, if xy then (x,y)R or (y,x)R. @2009 Adriano Cruz NCE e IM - UFRJ Relations 25 Examples of Transitive Relations x Is greater than Is subset of Divisibility Implies 1 1 2 3 4 5 6 7 8 √ √ √ √ √ √ √ √ 2 3 4 y 5 6 x is divisible by y 7 8 @2009 Adriano Cruz NCE e IM - UFRJ √ √ √ √ √ √ √ √ √ √ √ √ Relations 26 Transitive Relations The converse of a transitive relation is always transitive: if “is a subset of” is transitive and “is a superset of” is its converse then is “a superset of” is transitive. The intersection of two transitive relations is always transitive: if "was born before" and "has the same first name as" are transitive then "was born before and has the same first name as" is transitive. The union of two transitive relations is not always transitive. For instance "was born before or has the same first name as" is not generally a transitive relation. The complement of a transitive relation is not always transitive. @2009 Adriano Cruz NCE e IM - UFRJ Relations 27 Properties of Crisp Relations Left Unique: R is left unique when for all x,y,zX, if (x,z)R and (y,z)R then x=y. Right Unique: R is unique when for all x,y,zX, if (x,y)R and (x,z)R then y=z. Biunique: a relation R which is both left unique and right unique is called biunique. @2009 Adriano Cruz NCE e IM - UFRJ Relations 28 Example Relation = cousin of The relation is not reflexive because no one is cousin of himself, therefore it is antireflexive and irreflexive. The relation is symmetric because if Beatriz is cousin of Débora then Débora is cousin of Beatriz.Therefore cousin of is not asymmetric. Beatriz Débora Clara Marco @2009 Adriano Cruz NCE e IM - UFRJ Relations 29 Example Relation = cousin of The relation is also not antisymmetric because it is not reflexive nor asymmetric. Beatriz Débora Clara Marco @2009 Adriano Cruz NCE e IM - UFRJ Relations 30 Example Relation = cousin of The relation is not transitive because Débora is Clara’s cousin and Clara is Marco’s cousin, but Débora is not a cousin of Marco. Beatriz Débora Clara Marco @2009 Adriano Cruz NCE e IM - UFRJ Relations 31 Example Relation = cousin of The relation is not connected because there are pairs of different elements to which the relation is not applicable. For example Marco is no cousin of Débora. Beatriz Débora Clara Marco @2009 Adriano Cruz NCE e IM - UFRJ Relations 32 Example Relation = cousin of The relation is not left unique because Beatriz and Clara are different persons and both are Débora’s cousin. Beatriz Débora Clara Marco @2009 Adriano Cruz NCE e IM - UFRJ Relations 33 Example Relation = cousin of The relation is not right unique because Beatriz is a cousin of Débora and Marco which are different persons. Beatriz Débora Clara Marco The relation is neither left unique nor right unique therefore it is not biunique. @2009 Adriano Cruz NCE e IM - UFRJ Relations 34 Crisp Equivalence Relations A crisp binary relation R(X,X) that is reflexive, symmetric and transitive is called an equivalence relation. The similarity of triangles is an equivalence relation. Work at the same building is an equivalence relation. @2009 Adriano Cruz NCE e IM - UFRJ Relations 35 Crisp Equivalence Relations For each element x X, there is a crisp set Ax, which contains all elements of X that are related to x by the equivalence relation R. Ax = { y | (x,y) R(x,y) } xR due to reflexivity of R. Each member of Ax is related to all the other members of Ax because R is transitive and symmetric. No element of Ax is related to any element of X not included in Ax @2009 Adriano Cruz NCE e IM - UFRJ Relations 36 Crisp Equivalence Relations Ex Let X = {1,2,3,…,10} Let R(X,X) = {(x,y) | x % 3 y % 3}, % is remainder when divided by 3 This relation is reflexive, symmetric and transitive therefore is an equivalence relation on X. The three equivalence classes are: A1 = A4 = A7 = A10 = {1,4,7,10} A2= A5 = A8 = {2,5,8} A3= A6 = A9 = {3,6,9} @2009 Adriano Cruz NCE e IM - UFRJ Relations 37 Crisp Tolerance Relations Relations that are reflexive and symmetric are called a compatibility relations or tolerance relations. The relation “city x is close to city y” is a tolerance relation. – Lisbon is obviously close to itself (reflexive). – If Lisbon is close to Paris then Paris is close to Lisbon (symmetric). – It is not certain that if Lisbon is close to Paris and Paris is close to Berlin then Lisbon is close to Berlin (not transitive). @2009 Adriano Cruz NCE e IM - UFRJ Relations 38 Partial Order A Relation that is reflexive, antisymmetric and transitive is called a partial order relations (≤ ou ≥). The relation “A is a subet of B (A B) is a partial order. – A A (reflexive) – If A B and B C then A C (transitive) – If A B and B A then A = B (antisymetric) A Partial Order does not guarantee that all pairs are comparable @2009 Adriano Cruz NCE e IM - UFRJ Relations 39 Strict Order A Relation that is antireflexive, antisymmetric and transitive is called a strict order relation (< ou >). @2009 Adriano Cruz NCE e IM - UFRJ Relations 40 Types of Binary Relations Reflexive Antireflex Equiv Quasi Equiv Tolerance Partial Order Strict Order X X Symmet X X X X X X @2009 Adriano Cruz Antisymm Transitive X NCE e IM - UFRJ X X X X Relations 41 Operations with Crisp Relations Let R and S be two relations on the Cartesian product XY. Let O and I be 0 0 0 0 0 0 O 0 0 0 @2009 Adriano Cruz 1 1 E 1 NCE e IM - UFRJ 1 1 1 1 1 1 Relations 42 Operations with Crisp Relations Operations Crisp Relations are basically sets defined over higher-dimensional universes, that is Cartesian products Usual operations such as union, intersection and so on are also applicable. @2009 Adriano Cruz NCE e IM - UFRJ Relations 44 Operations with Crisp Relations Let R and S be two relations on the Cartesian product XY. Let O and E be 0 0 0 0 0 0 O 0 0 0 @2009 Adriano Cruz 1 1 E 1 NCE e IM - UFRJ 1 1 1 1 1 1 Relations 45 Properties of Crisp Operations União : R S RS ( x, y ) max[ R ( x, y ), S ( x, y )] Interseção: R S RS ( x, y ) min[ R ( x, y ), S ( x, y )] Complemento : R ( x, y ) 1 R ( x, y ) @2009 Adriano Cruz NCE e IM - UFRJ Relations 46 Properties of Crisp Operations Comutativity A B B A Associativity A B B A A ( B C ) ( A B) C Distributivity A ( B C ) ( A B) C A ( B C ) ( A B) ( A C ) A ( B C ) ( A B) ( A C ) @2009 Adriano Cruz NCE e IM - UFRJ Relations 47 Properties of Crisp Operations Idempotency A A A Identity A A A A A A A X X A X A @2009 Adriano Cruz NCE e IM - UFRJ Relations 48 Properties of Crisp Operations Exclusion A A E of the middle A A De Morgan A B A B A B A B @2009 Adriano Cruz NCE e IM - UFRJ Relations 49 Composition of Crisp Relations R X S Y Z T=R°S @2009 Adriano Cruz NCE e IM - UFRJ Relations 50 Composition of Crisp Relations RS y [ R ( x, y) S ( x, y)] X Y max min or product The operation ° is similar to a matrix multiplication. @2009 Adriano Cruz NCE e IM - UFRJ Relations 51 Example of Composition x1 y1 z1 x2 y2 z2 x3 y3 z3 x4 @2009 Adriano Cruz R X Y S Y Z NCE e IM - UFRJ Relations 52 Example of Composition 1 0 R 0 0 1 0 1 0 0 1 0 1 1 0 0 S 0 0 1 1 0 0 1 0 RS 1 1 @2009 Adriano Cruz 0 1 0 1 0 0 0 0 NCE e IM - UFRJ Relations 53 Example of Composition x1 z1 x2 z2 x3 z3 1 0 RS 1 1 0 1 0 1 0 0 0 0 x4 @2009 Adriano Cruz NCE e IM - UFRJ Relations 54 Fuzzy Relations Fuzzy Relations Fuzzy relations (R) map elements from a set (X) into a set (Y). The strength of the relations is given by membership functions that can vary between 0 and 1. R:XY[0:1] @2009 Adriano Cruz NCE e IM - UFRJ Relations 56 Fuzzy Relations Let Ai be fuzzy sets. A fuzzy relation is a subset of the Cartesian product R( A1 , A2 ,, An ) A1 A2 An The Cartesian product can be considered an relation without restrictions. @2009 Adriano Cruz NCE e IM - UFRJ Relations 57 Properties of Fuzzy Relations Let X and Y two fuzzy subsets defined on an Universe U. Let the elements x X and y Y with membership degrees X(x) e Y(y). Let S be the Cartesian product X Y . Let R be a fuzzy relation on S. @2009 Adriano Cruz NCE e IM - UFRJ Relations 58 Properties of Fuzzy Relations Properties with similar definitions to crisp relations: Reflexive - µR(x,x) = 1 Irreflexive - µR(x,x) 1 for some x Antireflexive - µR(x,x) 1 for all x -Reflexive - µR(x,x) >= @2009 Adriano Cruz NCE e IM - UFRJ Relations 59 Properties of Fuzzy Relations Properties with similar definitions to crisp relations: Symmetric - µR(x,y) = µR(y,x) Assymetric - µR(x,y) µR(y,x) for some x,y X Antisymetric – when µR(x,y) > 0 and µR(y,x)>0 implies that x = y for all x,y X @2009 Adriano Cruz NCE e IM - UFRJ Relations 60 Properties of Fuzzy Relations Properties with similar definitions to crisp relations: Connected Left unique, right unique, biunique @2009 Adriano Cruz NCE e IM - UFRJ Relations 61 Properties of Fuzzy Relations Transitive: R is transitive if for all x,y,z we have that if (x,y)R and (y,z) R then (x,z)R. If R ( xi , x j ) 1 and R ( x j , xk ) 2 then R ( xi , xk ) min( 1 , 2 ) @2009 Adriano Cruz NCE e IM - UFRJ Relations 62 Fuzzy Similarity Relations A fuzzy binary relation that is reflexive, symmetric and transitive is known as a similarity relation. An equivalence relation groups elements that are equivalent. The similarity can be viewed from two different points of view. @2009 Adriano Cruz NCE e IM - UFRJ Relations 63 Fuzzy Similarity Relations The similarity can be considered to group elements into crisp sets whose members are similar to each other to some degree. When the degree is equal to one the grouping is an equivalence class. @2009 Adriano Cruz NCE e IM - UFRJ Relations 64 Fuzzy Similarity Relations The similarity can also consider the degree of similarity that the elements of X have to some specific element x X. Then for each X a similarity class can be defined. @2009 Adriano Cruz NCE e IM - UFRJ Relations 65 Fuzzy Similarity Relations Ex a b c d e f g a 1 .8 0 .4 0 0 0 @2009 Adriano Cruz b .8 1 0 .4 0 0 0 c 0 0 1 0 1 .9 .5 d .4 .4 0 1 0 0 0 NCE e IM - UFRJ e 0 0 1 0 1 .9 .5 f 0 0 .9 0 .9 1 .5 g 0 0 .5 0 .5 .5 1 Relations 66 Fuzzy Similarity Relations Ex X = {a, b, c, d, e, f, g} Level set = { 0, .4, .5, .8, .9, 1} Five nested partitions @2009 Adriano Cruz NCE e IM - UFRJ Relations 67 Fuzzy Similarity Relations Ex =.4 a b d c e f g g =.5 a b d c e f =.8 a b d c e f g f g =.9 a b d c e =1 a b d c e @2009 Adriano Cruz NCE e IM - UFRJ f g Relations 68 Fuzzy Tolerance Relations Relations that are reflexive and symmetric are called tolerance relations. The fuzzy relation “The city x is close to the city y” is a tolerance relation. @2009 Adriano Cruz NCE e IM - UFRJ Relations 69 Orderings Ordering Characteristics Similarity and tolerance are characterized by symmetry. Ordering relations require asymmetry (or antisymmetry) and transitivity. @2009 Adriano Cruz NCE e IM - UFRJ Relations 71 Partial Ordering A crisp binary relation R(X,X) that is reflexive, antisymmetric and transitive is called a partial ordering. The symbol is suggestive of the properties of this relation x y denotes (x,y) R and x precedes y A partial ordering does not guarantee (antisymmetric x y, but y may not x) that all pairs of elements x, y in X are comparable (x y or y x) @2009 Adriano Cruz NCE e IM - UFRJ Relations 72 Strict Ordering A crisp binary relation R(X,X) that is antireflexive, antisymmetric and transitive is called a strict ordering. Therefore (x,x) R, @2009 Adriano Cruz NCE e IM - UFRJ Relations 73 Operations with Fuzzy Relations Operations with Fuzzy Relations Let R and S be two fuzzy relations on the Cartesian Product XY. Let the relations 0 0 0 0 0 0 O 0 0 0 @2009 Adriano Cruz 1 1 E 1 NCE e IM - UFRJ 1 1 1 1 1 1 Relations 75 Operations with Fuzzy Relations Union : R S R S ( x, y ) max[ R ( x, y ), S ( x, y )] Intersecti on : R S R S ( x, y ) min[ R ( x, y ), S ( x, y )] Complement : R ( x, y ) 1 R ( x, y ) @2009 Adriano Cruz NCE e IM - UFRJ Relations 76 Properties of Operations Comutativity A B B A Associativity A B B A A ( B C ) ( A B) C Distributivity A ( B C ) ( A B) C A ( B C ) ( A B) ( A C ) A ( B C ) ( A B) ( A C ) @2009 Adriano Cruz NCE e IM - UFRJ Relations 77 Properties of Operations Idempotence A A A Identity A A A A A A A X X A X A @2009 Adriano Cruz NCE e IM - UFRJ Relations 78 Properties of Operations Exclusion of Middle A A E A A De Morgan A B A B A B A B @2009 Adriano Cruz NCE e IM - UFRJ Relations 79 Composition of Fuzzy Relations R X S Y Z T=R°S @2009 Adriano Cruz NCE e IM - UFRJ Relations 80 Composition of Fuzzy Relations RS y [ R ( x, y) S ( x, y)] X Y max min or product The operation ° is similar to a matrix multiplication. @2009 Adriano Cruz NCE e IM - UFRJ Relations 81 Example of Fuzzy Composition x1 x2 1.0 0.8 0.9 0.9 y1 z1 0.7 y2 z2 0.8 x3 0.8 1.0 x4 @2009 Adriano Cruz y3 z3 R X Y S Y Z NCE e IM - UFRJ Relations 82 Example of Fuzzy Composition 1 0.8 0 0 0.9 0 R 0 0 0.8 0 0 1.0 0.9 0 0 S 0 0 0.8 0.7 0 0 R ( x1 , z1 ) [(1 0.9) (0.8 0) (0 0.7)] 0.9 0 0 000 RS 0 0 0.7 0 0 0.7 @2009 Adriano Cruz 0 0 0 0 0.8 0 0 0 0 0 0.8 0 000 000 000 000 NCE e IM - UFRJ Relations 83 Example of Fuzzy Composition 0.9 z1 x1 0.8 x2 0.8 z2 0.7 x3 z3 0.9 0 RS 0. 7 0. 7 0 0.8 0 0.8 0 0 0 0 0.7 x4 @2009 Adriano Cruz NCE e IM - UFRJ Relations 84 Relation Example Relation Definition Consider a relation that express the relation petite in terms of height and weight of a female Consider the range of these variables as Height = [1.51, 1.54, 1.57, …, 1.69] Weight = [40.8, 43.1, 45.4, 47.6, 49.9, 52.2, 54.4, 56.7] @2009 Adriano Cruz NCE e IM - UFRJ Relations 86 Relation Matrix 40.8 43.1 45.4 47.6 49.9 52.2 54.4 56.7 1.51 1 1 1 1 1 1 0.5 0.2 1.54 1 1 1 1 1 0.9 0.3 0.1 1.57 1 1 1 1 1 0.7 0.1 0 1.60 1 1 1 1 0.5 0.3 0 0 1.63 0.8 0.6 0.4 0.2 0 0 0 0 1.66 0.6 0.4 0.4 0 0 0 0 0 1.69 0 0 0 0 0 0 0 0 @2009 Adriano Cruz NCE e IM - UFRJ Relations 87 Questions? What is the degree that a female with a specific height and a specific weight is considered to be petit? – Relation is equivalent to the membership function of a multidimensional fuzzy set. What is the possibility that a petit person has a specific of height and weight measures? – Relation is the possibility distribution assigned to a petit person whose height and weight are unknown. @2009 Adriano Cruz NCE e IM - UFRJ Relations 88 Other question? Given a two-dimensional relation and the possible values of one variable, infer the possible values of the other variable. What is the possible weight of a person who is about 1.63? Is it possible to this person to weigh 49.9? @2009 Adriano Cruz NCE e IM - UFRJ Relations 89 Answering the question What is the possibility that the person is 1.51 given that she is about 1.63? What is the possibility that the person is 1.51 and weighs 49.9? If both answers are positive then 49.9 is a possible weigh. Continue and ask: what is the possibility that the person is 1.54? What is the possibility that she weighs 49.9? @2009 Adriano Cruz NCE e IM - UFRJ Relations 90 Rule of inference (Possible-height(1.51) Petite (1.51,40.8)) (Possible-height(1.54) Petite (1.54,40.8)) … (Possible-height(1.69) Petite (1.69,40.8)) Possible-weight(40.8) (Possible-height(1.51) Petite (1.51,43.1)) … @2009 Adriano Cruz NCE e IM - UFRJ <=> Relations 91 Rule of inference weight ( x ) ( w j ) Height ( x ) (hi ) Petite(hi , w j ) hi Composition max-min Composition max-prod @2009 Adriano Cruz NCE e IM - UFRJ Relations 92