Sommerjobb ved FFI. INF3580 Semantic Technologies Spring 2012 Lecture 5: Mathematical Foundations. Outline. Today s Plan

Sommerjobb ved FFI INF3580 – Semantic Technologies – Spring 2012 Lecture 5: Mathematical Foundations Sommerjobber ved Forsvarets Forskningsinstitutt ...
Author: Douglas George
1 downloads 1 Views 350KB Size
Sommerjobb ved FFI INF3580 – Semantic Technologies – Spring 2012 Lecture 5: Mathematical Foundations

Sommerjobber ved Forsvarets Forskningsinstitutt P˚ a Kjeller ved Lillestrøm

Martin Giese

Omtrent 50 studenter ved FFI i 8-10 uker Mange forskjellige fagfelt, bl.a. semantiske teknologier

14th February 2012

Department of Informatics

angi ved søking!

Søknadsfrist: 1. mars Mer info: http://www.ffi.no/no/Om-ffi/Karriere/Sider/Sommerjobb.aspx

University of Oslo

INF3580 :: Spring 2012

Lecture 5 :: 14th February

2 / 41

Basic Set Algebra

Today’s Plan

Outline

1

Basic Set Algebra

1

Basic Set Algebra

2

Pairs and Relations

2

Pairs and Relations

3

Propositional Logic

3

Propositional Logic

INF3580 :: Spring 2012

Lecture 5 :: 14th February

3 / 41

INF3580 :: Spring 2012

Lecture 5 :: 14th February

4 / 41

Basic Set Algebra

Basic Set Algebra

Motivation

Sets: Cantor’s Definition

From the inventor of Set Theory, Georg Cantor (1845–1918): The great thing about Semantic Technologies is. . .

Unter einer “Menge” verstehen wir jede Zusammenfassung M von bestimmten wohlunterschiedenen Objekten m unserer Anschauung oder unseres Denkens (welche die “Elemente” von M genannt werden) zu einem Ganzen.

. . . Semantics! “The study of meaning” RDF has a precisely defined semantics (=meaning)

Translated:

Mathematics is best at precise definitions

A “set” is any collection M of definite, distinguishable objects m of our intuition or intellect (called the “elements” of M) to be conceived as a whole.

RDF has a mathematically defined semantics

There are some problems with this, but it’s good enough for us!

INF3580 :: Spring 2012

Lecture 5 :: 14th February

5 / 41

INF3580 :: Spring 2012

Basic Set Algebra

Lecture 5 :: 14th February

6 / 41

Basic Set Algebra

Sets

Elements, Set Equality Notation for finite sets: {‘a’, 1, 4}

A set is a mathematical object like a number, a function, etc. Knowing a set is

Contains ‘a’, 1, and 4, and nothing else. There is no order between elements

knowing what is in it knowing what is not

{1, 4} = {4, 1} Nothing can be in a set several times

There is no order between elements

{1, 4, 4} = {1, 4}

Nothing can be in a set several times Two sets A and B are equal if they contain the same elements

The notation {· · · } allows to write things several times! ⇒ different ways of writing the same thing! We use ∈ to say that something is element of a set:

everything that is in A is also in B everything that is in B is also in A

1 ∈ {‘a’, 1, 4} ‘b’ 6∈ {‘a’, 1, 4} INF3580 :: Spring 2012

{· · · }

Lecture 5 :: 14th February

7 / 41

INF3580 :: Spring 2012

Lecture 5 :: 14th February

∈ 8 / 41

Basic Set Algebra

Basic Set Algebra

Set Examples {3, 7, 12}:

Know Your Elements! Sets with different elements are different:

a set of numbers

3 ∈ {3, 7, 12}, 0 6∈ {3, 7, 12}

{0}:

{1, 2} = 6 {2, 3}

a set with only one element 0 ∈ {0}, 1 6∈ {0}

{‘a’, ‘b’, . . . , ‘z’}:

What about

a set of letters

{a, b} and {b, c}?

‘y’ ∈ {‘a’, ‘b’, . . . , ‘z’}, ‘æ’ 6∈ {‘a’, ‘b’, . . . , ‘z’},

If a, b, c are variables, maybe

The set P3580 of people in the lecture room right now Martin ∈ P3580 , Albert Einstein 6∈ P3580 .

N = {1, 2, 3, . . .}:

a = 1,

b = 2,

c=1

the set of all natural numbers Then

3580 ∈ N, π 6∈ N.

P = {2, 3, 5, 7, 11, 13, 17, . . .}:

{a, b} = {1, 2} = {2, 1} = {b, c}

the set of all prime numbers

257 ∈ P, 91 6∈ P.

{1, 2, 3} has 3 elements, what about {a, b, c}?

INF3580 :: Spring 2012

Lecture 5 :: 14th February

9 / 41

INF3580 :: Spring 2012

Basic Set Algebra

Lecture 5 :: 14th February

10 / 41

Basic Set Algebra

Sets as Properties

The Empty Set

Sets are used a lot in mathematical notation Often, just as a short way of writing things More specifically, that something has a property E.g. “n is a prime number.” In mathematics: n ∈ P E.g. “Martin is a human being”. In mathematics, m ∈ H, where

Sometimes, you need a set that has no elements. This is called the empty set Notation: ∅ or {}



x 6∈ ∅, whatever x is!

H is the set of all human beings m is Martin

One could define Prime(n), Human(m), etc. but that is not usual Instead of writing “x has property XYZ ” or “XYZ (x)”, let P be the set of all objects with property XYZ write x ∈ P. INF3580 :: Spring 2012

Lecture 5 :: 14th February

11 / 41

INF3580 :: Spring 2012

Lecture 5 :: 14th February

12 / 41

Basic Set Algebra

Basic Set Algebra

Subsets

Set Union The union of A and B contains

Let A and B be sets

A

B

if every element of A is also in B

all elements of A all elements of B also those in both A and B and nothing more.

then A is called a subset of B This is written A⊆B {1} ⊆ {1, ‘a’, 4} {1, 3} 6⊆ {1, 2} P⊆N ∅ ⊆ A for any set A



(A cup which you pour everything into) Examples {1, 2} ∪ {2, 3} = {1, 2, 3} {1, 3, 5, 7, 9, . . .} ∪ {2, 4, 6, 8, 10, . . .} = N ∅ ∪ {1, 2} = {1, 2}

Lecture 5 :: 14th February

13 / 41

INF3580 :: Spring 2012

Basic Set Algebra

Lecture 5 :: 14th February

14 / 41

Basic Set Algebra

Set Intersection

Set Difference The set difference of A and B contains

The intersection of A and B contains those elements of A that are also in B and nothing more.

A

those elements of A that are not in B and nothing more.

B

A∩B Examples

B A\B

A\B



\

Examples {1, 2} \ {2, 3} = {1} N \ P = {1, 4, 6, 8, 9, 10, 12, . . .} ∅ \ {1, 2} = ∅ {1, 2} \ ∅ = {1, 2}

{1, 2} ∩ {2, 3} = {2} P ∩ {2, 4, 6, 8, 10, . . .} = {2} ∅ ∩ {1, 2} = ∅

Lecture 5 :: 14th February

A

It is written

A∩B

It is written

INF3580 :: Spring 2012

A∪B A∪B

A = B if and only if A ⊆ B and B ⊆ A INF3580 :: Spring 2012

B

It is written



Examples

A

15 / 41

INF3580 :: Spring 2012

Lecture 5 :: 14th February

16 / 41

Basic Set Algebra

Pairs and Relations

Set Comprehensions

Outline

Sometimes enumerating all elements is not good enough E.g. there are infinitely many, and “. . .” is too vague

1

Basic Set Algebra

2

Pairs and Relations

3

Propositional Logic

Special notation: {x ∈ A | x has some property} The set of those elements of A which have the property. Examples:

{· · · | · · · }

{n ∈ N | n = 2k for some k ∈ N}: the even numbers {n ∈ N | n < 5} = {1, 2, 3, 4} {x ∈ A | x 6∈ B} = A \ B

INF3580 :: Spring 2012

Lecture 5 :: 14th February

17 / 41

INF3580 :: Spring 2012

Lecture 5 :: 14th February

18 / 41

Pairs and Relations

Pairs and Relations

Motivation

Pairs A pair is an ordered collection of two objects Written hx, y i

RDF is all about

h· · · i

Equal if components are equal:

Resources (objects) Their properties (rdf:type) Their relations amongst each other

ha, bi = hx, y i

Sets are good to group objects with some properties!

if and only if a = x

and b = y

Order matters: h1, ‘a’i = 6 h‘a’, 1i

How do we talk about relations between objects?

An object can be twice in a pair: h1, 1i hx, y i is a pair, no matter if x = y or not. INF3580 :: Spring 2012

Lecture 5 :: 14th February

19 / 41

INF3580 :: Spring 2012

Lecture 5 :: 14th February

20 / 41

Pairs and Relations

Pairs and Relations

The Cross Product

Relations A relation R between two sets A and B is. . . . . . a set of pairs ha, bi ∈ A × B R ⊆A×B

Let A and B be sets. Construct the set of all pairs ha, bi with a ∈ A and b ∈ B. This is called the cross product of A and B, written

We often write aRb to say that ha, bi ∈ R Example:

×

A×B

Let L = {‘a’, ‘b’, . . . , ‘z’} Let . relate each number between 1 and 26 to the corresponding letter in the alphabet:

Example: A = {1, 2, 3}, B = {‘a’, ‘b’}. A × B = { h1, ‘a’i , h2, ‘a’i , h1, ‘b’i , h2, ‘b’i ,

h3, ‘a’i , h3, ‘b’i }

1 . ’a’

Lecture 5 :: 14th February

...

26 . ’z’

Then . ⊆ N × L:

Why bother? Instead of “ha, bi is a pair of a natural number and a person in this room”. . . . . . ha, bi ∈ N × P3580 But most of all, there are subsets of cross products. . . INF3580 :: Spring 2012

2 . ’b’

. = {h1, ‘a’i , h2, ‘b’i , . . . , h26, ‘z’i} And we can write: h1, ‘a’i ∈ . 21 / 41

INF3580 :: Spring 2012

h2, ‘b’i ∈ .

...

h26, ‘z’i ∈ .

Lecture 5 :: 14th February

Pairs and Relations

22 / 41

Pairs and Relations

More Relations

Family Relations Consider the set S = {Homer, Marge, Bart, Lisa, Maggie}. Define a relation P on S such that

A relation R on some set A is a relation between A and A: R ⊆ A × A = A2

xP y

Example: