15.08.2013 Views

General Computer Science 320201 GenCS I & II Lecture ... - Kwarc

General Computer Science 320201 GenCS I & II Lecture ... - Kwarc

General Computer Science 320201 GenCS I & II Lecture ... - Kwarc

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Example 75 The simplest function we always try everything on is the identity function:<br />

λn ∈ N.n = {〈n, n〉 | n ∈ N} = IdN<br />

= {〈0, 0〉, 〈1, 1〉, 〈2, 2〉, 〈3, 3〉, . . .}<br />

Example 76 We can also to more complex expressions, here we take the square function<br />

λx ∈ N.x 2 = {〈x, x 2 〉 | x ∈ N}<br />

= {〈0, 0〉, 〈1, 1〉, 〈2, 4〉, 〈3, 9〉, . . .}<br />

Example 77 λ-notation also works for more complicated domains. In this case we have<br />

tuples as arguments.<br />

λ〈x, y〉 ∈ N 2 .x + y = {〈〈x, y〉, x + y〉 | x ∈ N ∧ y ∈ N}<br />

= {〈〈0, 0〉, 0〉, 〈〈0, 1〉, 1〉, 〈〈1, 0〉, 1〉,<br />

c○: Michael Kohlhase 54<br />

〈〈1, 1〉, 2〉, 〈〈0, 2〉, 2〉, 〈〈2, 0〉, 2〉, . . .}<br />

4 EdNote:4<br />

The three properties we define next give us information about whether we can invert functions.<br />

Properties of functions, and their converses<br />

Definition 78 A function f : S → T is called<br />

injective iff ∀x, y ∈ S.f(x) = f(y) ⇒ x = y.<br />

surjective iff ∀y ∈ T.∃x ∈ S.f(x) = y.<br />

bijective iff f is injective and surjective.<br />

Note: If f is injective, then the converse relation f −1 is a partial function.<br />

Note: If f is surjective, then the converse f −1 is a total relation.<br />

Definition 79 If f is bijective, call the converse relation f −1 the inverse function.<br />

Note: if f is bijective, then the converse relation f −1 is a total function.<br />

Example 80 The function ν : N1 → N with ν(o) = 0 and ν(s(n)) = ν(n) + 1 is a bijection<br />

between the unary natural numbers and the natural numbers from highschool.<br />

Note: Sets that can be related by a bijection are often considered equivalent, and sometimes<br />

confused. We will do so with N1 and N in the future<br />

Cardinality of Sets<br />

c○: Michael Kohlhase 55<br />

Now, we can make the notion of the size of a set formal, since we can associate members of<br />

sets by bijective functions.<br />

Definition 81 We say that a set A is finite and has cardinality #(A) ∈ N, iff there is a<br />

bijective function f : A → {n ∈ N | n < #(A)}.<br />

4 EdNote: define Idon and Bool somewhere else and import it here<br />

31

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!