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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

38 CHAPTER 3. ELEMENTARY DISCRETE MATH<br />

#({a, b, c}) = 3 (e.g. choose f = {〈a, 0〉, 〈b, 1〉, 〈c, 2〉})<br />

#(A ∪ B) ≤ #(A) + #(B)<br />

#(A ∩ B) ≤ min(#(A), #(B))<br />

#(A × B) = #(A) · #(B)<br />

With the definition above, we can prove them (last three Homework)<br />

©: Michael Kohlhase 58<br />

Next we turn to a higher-order function in the wild. The composition function takes two functions<br />

as arguments and yields a function as a result.<br />

Operations on Functions<br />

Definition 93 If f ∈ A → B and g ∈ B → C are functions, then we call<br />

g ◦ f : A → C; x ↦→ g(f(x))<br />

the composition of g and f (read g “after” f).<br />

Definition 94 Let f ∈ A → B and C ⊆ A, then we call the relation {〈c, b〉 | c ∈ C ∧ 〈c, b〉 ∈ f}<br />

the restriction of f to C.<br />

Definition 95 Let f : A → B be a function, A ′ ⊆ A and B ′ ⊆ B, then we call<br />

f(A ′ ) := {b ∈ B | ∃a ∈ A ′ .〈a, b〉 ∈ f} the image of A ′ under f,<br />

Im(f) := f(A) the image of f, and<br />

f −1 (B ′ ) := {a ∈ A | ∃b ∈ B ′ .〈a, b〉 ∈ f} the pre-image of B ′ under f<br />

©: Michael Kohlhase 59

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

Saved successfully!

Ooh no, something went wrong!