---
# System prepended metadata

title: 'Lab: A Plethora of Definitions (#18)'

---

# Lab: A Plethora of Definitions (#18)

## Problem 1: Representatives
**a.** 
+ A partial funciton
    + $x \in U$. $U =$ {$a,b,c,d,e$}
    + $y \in U_2$. $U_2 =$ {$1, 2,3,4,5$}
    + $R =$ {$(a,1),(b,1),(c,2)$}
+ An injective function.
    + here $x \in U$. $U =$ {$a,b,c,d,e$}
    +  $y \in U_2$. $U_2 =$ {$1, 2,3,4,5,6$}
    + $R =$ {$(a,1),(b,2),(c,3),(d,4),(e,5)$}
+ A surjective function.
    + $R =$ {$(a,b), (a,b), (e,f), (c, d)$}
+ A left-unique partial function.
    + here $x \in U$. $U =$ {$a,b,c,d,e$}
    +  $y \in U_2$. $U_2 =$ {$1, 2,3,4,5$}
    + $R =$ {$(a,1),(b,2),(c,3)$}
+ A bijection.
    + $x,y \in U$. $U =$ {$a,b,c$}
    + R = {(a, a), (b, b), (c, c)}
    + For the bijection, due to the multitude of cases that need to be satisfied (left-totality, right-totality, left-uniquness, right-uniqueness), the safest case is a relation of matching x and y. 

**b.** 
```Racket
(define transform-partial
    (lambda (x)
        (if (<= x 5) (* 0 x)))
        
(define transform-surjective
    (lambda (x)
        (* x 3))
```

## Problem 2:

- We would want to create a function that is a full function instead of a partial because we would want our outputs to be related to our inputs AND our inputs to be mapped to a unique output. For example, we wouldn't want our function to produce something unrelated to our input in any way and also to be able to create the same output for multiple inputs as this could create handling issues.
- We would prefer a total function over a partial function in programming for the sake of complexities sake. For example, if our function takes in an object Student and transforms it in some type of way, we want an output related to our input, i.e. a transformed student. We also want our output to be unique to our input for the sake of complexiity. It is easier to handle outputs when we know what the output will be, rather than a random output for an input.

## Problem 3:
- I don't believe a compression program using a surjective function would be a good program for file compression based on the fact that our function would not have a unique input to a unique output as an injective function would. We also would not want our compression output to be based on both the input and output but instead just related in terms of the input.
- Alternatively, having a compression program that uses an injective function would be good since the inputs and outputs are directly matched and are unique matches. As well as having all the elements related to the input as opposed to both the input and output.