logics for data and knowledge representation introduction to algebra chiara ghidini, luciano...
Post on 26-Dec-2015
224 Views
Preview:
TRANSCRIPT
Logics for Data and KnowledgeRepresentation
Introduction to Algebra
Chiara Ghidini, Luciano Serafini, Fausto Giunchiglia and Vincenzo Maltese
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 35
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
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 35
7 9
A = {1, 3, 5, 7, 9}
A = { x | x is an odd number < 10}
A
SETS :: RELATIONS :: FUNCTIONS
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
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| = n then |P(A)| = 2n
7
SETS :: RELATIONS :: FUNCTIONS
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
A B
a
bc d
A B
a
bc d
A B
A B
SETS :: RELATIONS :: FUNCTIONS
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
A B
a
bd
A - Bc
A
_ A
U
SETS :: RELATIONS :: FUNCTIONS
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
Properties of sets A A = A A A = A A = A = A
A B = B A A 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
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
Relations A (binary) relation R from set A to set B is a subset of A x B
R A x B xRy 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
bB
a
(a,b) ∈ R
A
SETS :: RELATIONS :: FUNCTIONS
Relations (cont.) An n-ary relation Rn is a subset of A1 x … x An
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
bB
a
(b, a) ∈ R-1
A
SETS :: RELATIONS :: FUNCTIONS
Properties of relationsLet 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
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
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
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
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
top related