A Function as a Discrete Mapping
A function assigns exactly one result to each member of its declared domain. A table or formula can specify the assignments.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Inspect a complete table
A map assigning red to codes 1 and 3 and blue to code 2 is a function on those three codes. Sharing an image is allowed. Omitting code 3 makes the mapping partial on that domain. See dictionary lookup.
Choose the declared domain deliberately
If all integers are possible inputs but most codes are unsupported, describe a valid subset or make failure an explicit outcome. Function contracts in code communicate which domain and result set callers should expect.[1]
Check uniqueness for inputs while allowing repeated outputs
For a domain \(\{A,B,C\}\), assign A to north, B to east and C to north. The repeat of north is allowed because the function condition concerns one result per input. If B also maps to west, the graph of pairs no longer defines a function on that domain. See binary relations.
Input assigned region
A north
B east
C north
One output exists for each declared input
Validate totality independently from determinism
Deleting the row for B leaves a well-defined rule on a smaller domain but fails the original total function claim. Adding a row with an unknown input raises another question about domain. Test missing and multiply assigned inputs separately.