Discrete Mathematics in Computer Science Partial and Total Functions

Discrete Mathematics in Computer Science Partial and Total Functions

Discrete Mathematics in Computer Science Partial and Total Functions Malte Helmert, Gabriele R¨oger University of Basel Important Building Blocks of Discrete Mathematics Important building blocks: sets relations functions In principle, functions are just a special kind of relations: 2 f : N0 ! N0 with f (x) = x 2 relation R over N0 with R = f(x; y) j x; y 2 N0 and y = x g. Important Building Blocks of Discrete Mathematics Important building blocks: sets relations functions In principle, functions are just a special kind of relations: 2 f : N0 ! N0 with f (x) = x 2 relation R over N0 with R = f(x; y) j x; y 2 N0 and y = x g. Functional Relations Definition A binary relation R over sets A and B is functional if for every a 2 A there is at most one b 2 B with (a; b) 2 R. a 1 a 1 b 2 b 2 B B A c 3 A c 3 d 4 d 4 e e functional not functional Functions { Examples 2 f : N0 ! N0 with f (x) = x + 1 abs : Z ! N0 with ( x if x ≥ 0 abs(x) = −x otherwise 2 2 distance : R × R ! R with p 2 2 distance((x1; y1); (x2; y2)) = (x2 − x1) + (y2 − y1) Functions { Examples 2 f : N0 ! N0 with f (x) = x + 1 abs : Z ! N0 with ( x if x ≥ 0 abs(x) = −x otherwise 2 2 distance : R × R ! R with p 2 2 distance((x1; y1); (x2; y2)) = (x2 − x1) + (y2 − y1) Functions { Examples 2 f : N0 ! N0 with f (x) = x + 1 abs : Z ! N0 with ( x if x ≥ 0 abs(x) = −x otherwise 2 2 distance : R × R ! R with p 2 2 distance((x1; y1); (x2; y2)) = (x2 − x1) + (y2 − y1) Partial Function { Example Partial function r : Z × Z 9 Q with ( n if d 6= 0 r(n; d) = d undefined otherwise Partial Functions Definition (Partial function) A partial function f from set A to set B (written f : A 9 B) is given by a functional relation G over A and B. Relation G is called the graph of f . We write f (x) = y for (x; y) 2 G and say y is the image of x under f . If there is no y 2 B with (x; y) 2 G, then f (x) is undefined. Partial function r : Z × Z 9 Q with ( n if d 6= 0 r(n; d) = d undefined otherwise n 2 has graph f((n; d); d ) j n 2 Z; d 2 Z n f0gg ⊆ Z × Q. Partial Functions Definition (Partial function) A partial function f from set A to set B (written f : A 9 B) is given by a functional relation G over A and B. Relation G is called the graph of f . We write f (x) = y for (x; y) 2 G and say y is the image of x under f . If there is no y 2 B with (x; y) 2 G, then f (x) is undefined. Partial function r : Z × Z 9 Q with ( n if d 6= 0 r(n; d) = d undefined otherwise n 2 has graph f((n; d); d ) j n 2 Z; d 2 Z n f0gg ⊆ Z × Q. Partial Functions Definition (Partial function) A partial function f from set A to set B (written f : A 9 B) is given by a functional relation G over A and B. Relation G is called the graph of f . We write f (x) = y for (x; y) 2 G and say y is the image of x under f . If there is no y 2 B with (x; y) 2 G, then f (x) is undefined. Partial function r : Z × Z 9 Q with ( n if d 6= 0 r(n; d) = d undefined otherwise n 2 has graph f((n; d); d ) j n 2 Z; d 2 Z n f0gg ⊆ Z × Q. Partial Functions Definition (Partial function) A partial function f from set A to set B (written f : A 9 B) is given by a functional relation G over A and B. Relation G is called the graph of f . We write f (x) = y for (x; y) 2 G and say y is the image of x under f . If there is no y 2 B with (x; y) 2 G, then f (x) is undefined. Partial function r : Z × Z 9 Q with ( n if d 6= 0 r(n; d) = d undefined otherwise n 2 has graph f((n; d); d ) j n 2 Z; d 2 Z n f0gg ⊆ Z × Q. The domain of definition of f is the set dom(f ) = fx 2 A j there is a y 2 B with f (x) = yg. The image (or range) of f is the set img(f ) = fy j there is an x 2 A with f (x) = yg. f : fa; b; c; d; eg f1; 2; 3; 4g a 1 9 f (a) = 4; f (b) = 2; f (c) = 1; f (e) = 4 b 2 B domain fa; b; c; d; eg A c 3 codomain f1; 2; 3; 4g d 4 domain of definition dom(f ) = fa; b; c; eg e image img(f ) = f1; 2; 4g Domain (of Definition), Codomain, Image Definition (domain of definition, codomain, image) Let f : A 9 B be a partial function. Set A is called the domain of f , set B is its codomain. The domain of definition of f is the set dom(f ) = fx 2 A j there is a y 2 B with f (x) = yg. The image (or range) of f is the set img(f ) = fy j there is an x 2 A with f (x) = yg. domain of definition dom(f ) = fa; b; c; eg image img(f ) = f1; 2; 4g Domain (of Definition), Codomain, Image Definition (domain of definition, codomain, image) Let f : A 9 B be a partial function. Set A is called the domain of f , set B is its codomain. f : fa; b; c; d; eg f1; 2; 3; 4g a 1 9 f (a) = 4; f (b) = 2; f (c) = 1; f (e) = 4 b 2 B domain fa; b; c; d; eg A c 3 codomain f1; 2; 3; 4g d 4 e The image (or range) of f is the set img(f ) = fy j there is an x 2 A with f (x) = yg. image img(f ) = f1; 2; 4g Domain (of Definition), Codomain, Image Definition (domain of definition, codomain, image) Let f : A 9 B be a partial function. Set A is called the domain of f , set B is its codomain. The domain of definition of f is the set dom(f ) = fx 2 A j there is a y 2 B with f (x) = yg. f : fa; b; c; d; eg f1; 2; 3; 4g a 1 9 f (a) = 4; f (b) = 2; f (c) = 1; f (e) = 4 b 2 B domain fa; b; c; d; eg A c 3 codomain f1; 2; 3; 4g d 4 domain of definition dom(f ) = fa; b; c; eg e Domain (of Definition), Codomain, Image Definition (domain of definition, codomain, image) Let f : A 9 B be a partial function. Set A is called the domain of f , set B is its codomain. The domain of definition of f is the set dom(f ) = fx 2 A j there is a y 2 B with f (x) = yg. The image (or range) of f is the set img(f ) = fy j there is an x 2 A with f (x) = yg. f : fa; b; c; d; eg f1; 2; 3; 4g a 1 9 f (a) = 4; f (b) = 2; f (c) = 1; f (e) = 4 b 2 B domain fa; b; c; d; eg A c 3 codomain f1; 2; 3; 4g d 4 domain of definition dom(f ) = fa; b; c; eg e image img(f ) = f1; 2; 4g a 1 b 2 B A c 3 d 4 e Preimage The preimage contains all elements of the domain that are mapped to given elements of the codomain. Definition (Preimage) Let f : A 9 B be a partial function and let Y ⊆ B. The preimage of Y under f is the set f −1[Y ] = fx 2 A j f (x) 2 Y g. f −1[f1g] = f −1[f3g] = f −1[f4g] = f −1[f1; 2g] = Preimage The preimage contains all elements of the domain that are mapped to given elements of the codomain. Definition (Preimage) Let f : A 9 B be a partial function and let Y ⊆ B. The preimage of Y under f is the set f −1[Y ] = fx 2 A j f (x) 2 Y g. −1 a 1 f [f1g] = b 2 f −1[f3g] = B A c 3 f −1[f4g] = d 4 −1 e f [f1; 2g] = Total Functions Definition (Total function) A (total) function f : A ! B from set A to set B is a partial function from A to B such that f (x) is defined for all x 2 A. ! no difference between the domain and the domain of definition a 1 b 2 B A c 3 d 4 e Total Functions Definition (Total function) A (total) function f : A ! B from set A to set B is a partial function from A to B such that f (x) is defined for all x 2 A. ! no difference between the domain and the domain of definition a 1 b 2 B A c 3 d 4 e Total Functions Definition (Total function) A (total) function f : A ! B from set A to set B is a partial function from A to B such that f (x) is defined for all x 2 A.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    74 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us