Example:Ambiguous function

From CS2800 wiki
Revision as of 17:23, 17 February 2018 by {{GENDER:Mdg39|[math]'"2}} [/math]'"7
(<math>1) </math>2 | <math>3 (</math>4) | <math>5 (</math>6)

The function [math]f : \{1,2\} \href{/cs2800/wiki/index.php/%E2%86%92}{→} \href{/cs2800/wiki/index.php/%E2%84%95}{ℕ} [/math] given by [math]f(1):=5 [/math], [math]f(2):=3 [/math], and [math]f(1):=2 [/math] is not well-defined, because the output on input 2 is ambiguous.

However, the function [math]f : \{1,2\} \href{/cs2800/wiki/index.php/%E2%86%92}{→} \href{/cs2800/wiki/index.php/%E2%84%95}{ℕ} [/math] given by [math]f(1):=5 [/math] and [math]f(2):=5 [/math] is a perfectly good function.