Download presentation
Presentation is loading. Please wait.
Published byRoss McCarthy Modified over 9 years ago
1
Logics for Data and Knowledge Representation Introduction to Algebra Chiara Ghidini, Luciano Serafini, Fausto Giunchiglia and Vincenzo Maltese
2
Roadmap Set theory Basic notions Operations Properties Relations Functions 2
3
Describing the world 3 KimbaSimba Cita Hunts Eats Monkey Lion Near individuals sets relations
4
Sets A set is a collection of elements The description of a set must be unambiguous and unique: it must be possible to decide whether an element belongs to the set or not. 4 1 3 5 7 9 The set of odd numbers < 10 The set of students in this room The set of lions in a certain zoo SETS :: RELATIONS :: FUNCTIONS
5
Describing sets Listing: the set is described by listing all its elements Abstraction: the set is described through a common property of its elements Venn Diagrams: graphical representation that supports the formal description 5 1 3 5 7 9 A = {1, 3, 5, 7, 9} A = { x | x is an odd number < 10} A SETS :: RELATIONS :: FUNCTIONS
6
Basic notions on sets Empty Set: the set with no elements; A = { } A = Membership: element a belongs to the set A; A = {a, b, c} a A Non membership: element a doesn't belong to the set A A = {b, c} a A Equality: the sets A and B contain the same elements; A = {b, c}; B = {b, c}A = B 6 SETS :: RELATIONS :: FUNCTIONS
7
Basic notions on sets (cont.) Inequality: the sets A and B contain the same elements; A = {c}; B = {b, c}A ≠ B Subset: all elements of A belong to B; A = {c}; B = {b, c}A B Proper subset: all elements of A belong to B and they are not the same A B and A ≠ B then A B Power set: the set of all the subsets of A A = {a, b} P(A) = { , {a}, {b}, {a, b}} |A| = nthen |P(A)| = 2 n 7 SETS :: RELATIONS :: FUNCTIONS
8
Operations on sets Union: the set containing the the members of A or B Intersection: the set containing the members of both A and B 8 AB a b c d AB a b c d A B A B SETS :: RELATIONS :: FUNCTIONS
9
Operations on sets (cont.) Difference: the set containing the members of A and not of B Complement: given a universal set U, the complement of A is the set whose members are the members of U - A. 9 AB a b d A - B c A _A_A U SETS :: RELATIONS :: FUNCTIONS
10
Exercises Given A = {t, z} and B = {v, z, t}, say whether the following statements are true or false: A B A B z A B v B {v} B v A - B Given A = {a, b, c, d} and B = {c, d, f} Find a set X such that A B = B X. Is this set unique? Is there any set Y such that A Y = B ? 10 SETS :: RELATIONS :: FUNCTIONS
11
Properties of sets A A = AA A = A A = A = A A B = B AA B = B A(commutative) (A B) C = A (B C) (A B) C = A (B C) (associative) A (B C) = (A B) (A C) A (B C) = (A B) (A C) (distributive) _____ _ _ A B = A B _____ _ _ A B = A B (De Morgan laws) 11 SETS :: RELATIONS :: FUNCTIONS
12
Cartesian product Cartesian product of A and B: the set of ordered couples (a, b) where a is a member of A and b a member of B A x B = {(a, b) : a A and b B} Notice that A x B ≠ B x A Example: A = {a, b, c}, B = {s, t} A x B = {(a, s), (a, t), (b, s), (b, t), (c, s), (c, t)} 12 SETS :: RELATIONS :: FUNCTIONS
13
Relations A (binary) relation R from set A to set B is a subset of A x B R A x BxRy indicates that (x, y) R The domain of R is the set Dom(R) = {a A | ∃ b B s.t. aRb} The co-domain of R is the set Cod(R) = {b B | ∃ a A s.t. aRb} 13 b B a (a,b) ∈ R A SETS :: RELATIONS :: FUNCTIONS
14
Relations (cont.) An n-ary relation R n is a subset of A 1 x … x A n n is the arity of the relation The inverse relation of R A x B is the relation R -1 B x A where: R -1 = {(b, a) | (a, b) R} 14 b B a (b, a) ∈ R -1 A SETS :: RELATIONS :: FUNCTIONS
15
Properties of relations Let R be a binary relation on A, i.e. R A x A. R is said to be: reflexive iff aRa ∀ a A; symmetric iff aRb implies bRa ∀ a, b A; transitive iff aRb and bRc imply aRc ∀ a, b, c A; anti-symmetric iff aRb and bRa imply a = b ∀ a, b A; 15 SETS :: RELATIONS :: FUNCTIONS
16
Equivalence relations Given R A x A, R is an equivalence relation iff it is reflexive, symmetric and transitive. A partition of a set A is a family F of non-empty subsets of A s.t.: the subsets are pairwise disjoint the union of all the subsets is the set A Notice that each element of A belongs to exactly one subset in F. Given ≡ equivalence relation on A and a A, the equivalence class of a is the set [a] = {x | a ≡ x} Notice that if x [a] then [x] = [a] The quotient set of A w.r.t. ≡ is the set {[x] | x A} which defines a partition of A. 16 SETS :: RELATIONS :: FUNCTIONS
17
Order relations Given R A x A, R is a (partial) order relation iff it is reflexive, anti-symmetric and transitive. If the relation holds ∀ a, b A then it is a total order If ∀ a, b A either aRb or bRa or a = b then it is a strict order 17 SETS :: RELATIONS :: FUNCTIONS
18
Functions A function f from A to B is a binary relation that associates to each element a in A exactly one element b in B. f : A B The image of an element a A is denoted with f(a) B Notice that it can be the case that the same element in B is the image of several elements in A. 18 SETS :: RELATIONS :: FUNCTIONS
19
Functions (cont.) f: A B is injective if for distinct elements in A there is a distinct element in B: ∀ a, b A and a ≠ b then f(a) ≠ f(b) f: A B is surjective if for each element in B there is at least one element in A: ∀ b B ∃ a A s.t. f(a) = b f: A B is bijective if it is injective and surjective. 19 SETS :: RELATIONS :: FUNCTIONS
20
Functions (cont.) If f: A B is bijective we can define its inverse function f -1 : B A Given two functions f: A B and g: B C, the composition of f and g is the function g ○ f : C such that: g ○ f = {(a, g(f(a)) | a A} 20 SETS :: RELATIONS :: FUNCTIONS
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.